Skip to content

Commit cfe669f

Browse files
refactor: remove icss option (#1189)
BRAKING CHANGE: the `icss` option was removed, please use `modules.compileType: 'icss'`
1 parent 57eb505 commit cfe669f

6 files changed

+8
-95
lines changed

src/options.json

-4
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,6 @@
122122
}
123123
]
124124
},
125-
"icss": {
126-
"description": "Enables/Disables handling the CSS module interoperable import/export format ((https://github.com/webpack-contrib/css-loader#icss)",
127-
"type": "boolean"
128-
},
129125
"sourceMap": {
130126
"description": "Enables/Disables generation of source maps (https://github.com/webpack-contrib/css-loader#sourcemap).",
131127
"type": "boolean"

src/utils.js

-2
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,6 @@ function normalizeOptions(rawOptions, loaderContext) {
219219
url: typeof rawOptions.url === 'undefined' ? true : rawOptions.url,
220220
import: typeof rawOptions.import === 'undefined' ? true : rawOptions.import,
221221
modules: modulesOptions,
222-
// TODO remove in the next major release
223-
icss: typeof rawOptions.icss === 'undefined' ? false : rawOptions.icss,
224222
sourceMap:
225223
typeof rawOptions.sourceMap === 'boolean'
226224
? rawOptions.sourceMap

test/__snapshots__/modules-option.test.js.snap

-46
Original file line numberDiff line numberDiff line change
@@ -12529,52 +12529,6 @@ Array [
1252912529

1253012530
exports[`"modules" option should work with the \`exportGlobals\` option (the \`mode\` option is \`pure\`): warnings 1`] = `Array []`;
1253112531

12532-
exports[`"modules" option show work and warn about the "icss" option deprecation: errors 1`] = `Array []`;
12533-
12534-
exports[`"modules" option show work and warn about the "icss" option deprecation: module 1`] = `
12535-
"// Imports
12536-
import ___CSS_LOADER_API_IMPORT___ from \\"../../../../../../src/runtime/api.js\\";
12537-
import ___CSS_LOADER_ICSS_IMPORT_0___ from \\"-!../../../../../../src/index.js??[ident]!./vars.css\\";
12538-
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(false);
12539-
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_ICSS_IMPORT_0___, \\"\\", true);
12540-
// Module
12541-
___CSS_LOADER_EXPORT___.push([module.id, \\".className {\\\\n color: \\" + ___CSS_LOADER_ICSS_IMPORT_0___.locals[\\"primary-color\\"] + \\";\\\\n}\\\\n\\", \\"\\"]);
12542-
// Exports
12543-
___CSS_LOADER_EXPORT___.locals = {
12544-
\\"primary-color\\": \\"\\" + ___CSS_LOADER_ICSS_IMPORT_0___.locals[\\"primary-color\\"] + \\"\\"
12545-
};
12546-
export default ___CSS_LOADER_EXPORT___;
12547-
"
12548-
`;
12549-
12550-
exports[`"modules" option show work and warn about the "icss" option deprecation: result 1`] = `
12551-
Array [
12552-
Array [
12553-
"../../src/index.js?[ident]!./modules/icss/tests-cases/import/vars.css",
12554-
"
12555-
",
12556-
"",
12557-
],
12558-
Array [
12559-
"./modules/icss/tests-cases/import/source.css",
12560-
".className {
12561-
color: red;
12562-
}
12563-
",
12564-
"",
12565-
],
12566-
]
12567-
`;
12568-
12569-
exports[`"modules" option show work and warn about the "icss" option deprecation: warnings 1`] = `
12570-
Array [
12571-
"ModuleWarning: Module Warning (from \`replaced original path\`):
12572-
The \\"icss\\" option is deprecated, use \\"modules.compileType: \\"icss\\"\\" instead",
12573-
"ModuleWarning: Module Warning (from \`replaced original path\`):
12574-
The \\"icss\\" option is deprecated, use \\"modules.compileType: \\"icss\\"\\" instead",
12575-
]
12576-
`;
12577-
1257812532
exports[`"modules" option show work with the "compileType" and "exportOnlyLocals" options: errors 1`] = `Array []`;
1257912533

1258012534
exports[`"modules" option show work with the "compileType" and "exportOnlyLocals" options: module 1`] = `

test/__snapshots__/validate-options.test.js.snap

+8-20
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,6 @@ exports[`validate options should throw an error on the "esModule" option with "t
66
-> Use the ES modules syntax (https://github.com/webpack-contrib/css-loader#esmodule)."
77
`;
88

9-
exports[`validate options should throw an error on the "icss" option with "1" value 1`] = `
10-
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
11-
- options.icss should be a boolean.
12-
-> Enables/Disables handling the CSS module interoperable import/export format ((https://github.com/webpack-contrib/css-loader#icss)"
13-
`;
14-
15-
exports[`validate options should throw an error on the "icss" option with "true" value 1`] = `
16-
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
17-
- options.icss should be a boolean.
18-
-> Enables/Disables handling the CSS module interoperable import/export format ((https://github.com/webpack-contrib/css-loader#icss)"
19-
`;
20-
219
exports[`validate options should throw an error on the "import" option with "true" value 1`] = `
2210
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
2311
- options.import should be one of these:
@@ -245,49 +233,49 @@ exports[`validate options should throw an error on the "sourceMap" option with "
245233
exports[`validate options should throw an error on the "unknown" option with "/test/" value 1`] = `
246234
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
247235
- options has an unknown property 'unknown'. These properties are valid:
248-
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
236+
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
249237
`;
250238
251239
exports[`validate options should throw an error on the "unknown" option with "[]" value 1`] = `
252240
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
253241
- options has an unknown property 'unknown'. These properties are valid:
254-
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
242+
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
255243
`;
256244
257245
exports[`validate options should throw an error on the "unknown" option with "{"foo":"bar"}" value 1`] = `
258246
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
259247
- options has an unknown property 'unknown'. These properties are valid:
260-
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
248+
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
261249
`;
262250
263251
exports[`validate options should throw an error on the "unknown" option with "{}" value 1`] = `
264252
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
265253
- options has an unknown property 'unknown'. These properties are valid:
266-
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
254+
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
267255
`;
268256
269257
exports[`validate options should throw an error on the "unknown" option with "1" value 1`] = `
270258
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
271259
- options has an unknown property 'unknown'. These properties are valid:
272-
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
260+
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
273261
`;
274262
275263
exports[`validate options should throw an error on the "unknown" option with "false" value 1`] = `
276264
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
277265
- options has an unknown property 'unknown'. These properties are valid:
278-
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
266+
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
279267
`;
280268
281269
exports[`validate options should throw an error on the "unknown" option with "test" value 1`] = `
282270
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
283271
- options has an unknown property 'unknown'. These properties are valid:
284-
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
272+
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
285273
`;
286274
287275
exports[`validate options should throw an error on the "unknown" option with "true" value 1`] = `
288276
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
289277
- options has an unknown property 'unknown'. These properties are valid:
290-
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
278+
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
291279
`;
292280
293281
exports[`validate options should throw an error on the "url" option with "true" value 1`] = `

test/modules-option.test.js

-19
Original file line numberDiff line numberDiff line change
@@ -1239,25 +1239,6 @@ describe('"modules" option', () => {
12391239
});
12401240
});
12411241

1242-
it('show work and warn about the "icss" option deprecation', async () => {
1243-
const compiler = getCompiler(
1244-
'./modules/icss/tests-cases/import/source.js',
1245-
{
1246-
icss: true,
1247-
}
1248-
);
1249-
const stats = await compile(compiler);
1250-
1251-
expect(
1252-
getModuleSource('./modules/icss/tests-cases/import/source.css', stats)
1253-
).toMatchSnapshot('module');
1254-
expect(getExecutedCode('main.bundle.js', compiler, stats)).toMatchSnapshot(
1255-
'result'
1256-
);
1257-
expect(getWarnings(stats)).toMatchSnapshot('warnings');
1258-
expect(getErrors(stats)).toMatchSnapshot('errors');
1259-
});
1260-
12611242
it('show work with the "compileType" and "exportOnlyLocals" options', async () => {
12621243
const compiler = getCompiler(
12631244
'./modules/icss/tests-cases/import/source.js',

test/validate-options.test.js

-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ describe('validate options', () => {
1010
success: [true, false, () => {}],
1111
failure: ['true'],
1212
},
13-
icss: {
14-
success: [true, false],
15-
failure: ['true', 1],
16-
},
1713
modules: {
1814
success: [
1915
true,

0 commit comments

Comments
 (0)