Skip to content

Commit afed2db

Browse files
committed
chore: remove support for deprecate sourceMap option
1 parent e0fe0d7 commit afed2db

4 files changed

Lines changed: 1 addition & 79 deletions

File tree

src/rollup-plugin-prettier.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import prettier from 'prettier';
3636
*/
3737
const OPTIONS = new Set([
3838
'sourcemap',
39-
'sourceMap',
4039
'cwd',
4140
]);
4241

@@ -78,9 +77,6 @@ export class RollupPluginPrettier {
7877
// Check if sourcemap is enabled by default.
7978
if (hasIn(options, 'sourcemap')) {
8079
this._sourcemap = options.sourcemap;
81-
} else if (hasIn(options, 'sourceMap')) {
82-
console.warn(`[${this.name}] The sourceMap option is deprecated, please use sourcemap instead.`);
83-
this._sourcemap = options.sourceMap;
8480
} else {
8581
this._sourcemap = null;
8682
}

test/index.spec.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {verifyWarnLogsBecauseOfSourcemap} from './utils/verify-warn-logs-because
2929
import {verifyWarnLogsNotTriggered} from './utils/verify-warn-logs-not-triggered.js';
3030
import {installWarnSpy} from './utils/install-warn-spy.js';
3131

32-
describe('rollup-plugin-prettier [stable]', () => {
32+
describe('rollup-plugin-prettier', () => {
3333
beforeEach(() => {
3434
installWarnSpy();
3535
});
@@ -94,25 +94,6 @@ describe('rollup-plugin-prettier [stable]', () => {
9494
);
9595
});
9696

97-
it('should run prettier with sourcemap (camelcase) in plugin options', () => {
98-
const instance = rollupPluginPrettier({
99-
sourceMap: true,
100-
parser: 'babel',
101-
});
102-
103-
const code = 'var foo=0;var test="hello world";';
104-
const chunk = {isEntry: false, imports: []};
105-
const outputOptions = {};
106-
const result = instance.renderChunk(code, chunk, outputOptions);
107-
108-
verifyWarnLogsBecauseOfSourcemap();
109-
expect(result.map).toBeDefined();
110-
expect(result.code).toBe(
111-
'var foo = 0;\n' +
112-
'var test = "hello world";\n'
113-
);
114-
});
115-
11697
it('should run prettier with sourcemap disabled in output options', () => {
11798
const instance = rollupPluginPrettier({
11899
parser: 'babel',

test/it/it.spec.js

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -240,42 +240,6 @@ describe('rollup-plugin-prettier', () => {
240240
});
241241
});
242242

243-
it('should enable sourcemap (camelcase) on plugin', (done) => {
244-
const output = path.join(tmpDir.name, 'bundle.js');
245-
const config = {
246-
input: getBundlePath(),
247-
248-
output: {
249-
file: output,
250-
format: 'es',
251-
},
252-
253-
plugins: [
254-
prettier({
255-
parser: 'babel',
256-
sourceMap: true,
257-
}),
258-
],
259-
};
260-
261-
rollup.rollup(config)
262-
.then((bundle) => bundle.write(config.output))
263-
.then(() => {
264-
fs.readFile(output, 'utf8', (err, data) => {
265-
if (err) {
266-
done.fail(err);
267-
return;
268-
}
269-
270-
verifyWarnLogsBecauseOfSourcemap();
271-
done();
272-
});
273-
})
274-
.catch((err) => {
275-
done.fail(err);
276-
});
277-
});
278-
279243
/**
280244
* Get the output bundle absolute path.
281245
*

test/rollup-plugin-prettier.spec.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,25 +78,6 @@ describe('RollupPluginPrettier', () => {
7878
);
7979
});
8080

81-
it('should run prettier with sourceMap (camelcase)', () => {
82-
const plugin = new RollupPluginPrettier({
83-
parser: 'babel',
84-
sourceMap: true,
85-
});
86-
87-
const code = 'var foo=0;var test="hello world";';
88-
const result = plugin.reformat(code);
89-
90-
expect(plugin.getSourcemap()).toBe(true);
91-
92-
verifyWarnLogsBecauseOfSourcemap();
93-
expect(result.map).toBeDefined();
94-
expect(result.code).toBe(
95-
'var foo = 0;\n' +
96-
'var test = "hello world";\n'
97-
);
98-
});
99-
10081
it('should run prettier with sourcemap if it has been enabled', () => {
10182
const plugin = new RollupPluginPrettier({
10283
parser: 'babel',

0 commit comments

Comments
 (0)