Skip to content

Remove icss option #1189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@
}
]
},
"icss": {
"description": "Enables/Disables handling the CSS module interoperable import/export format ((https://github.com/webpack-contrib/css-loader#icss)",
"type": "boolean"
},
"sourceMap": {
"description": "Enables/Disables generation of source maps (https://github.com/webpack-contrib/css-loader#sourcemap).",
"type": "boolean"
Expand Down
2 changes: 0 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ function normalizeOptions(rawOptions, loaderContext) {
url: typeof rawOptions.url === 'undefined' ? true : rawOptions.url,
import: typeof rawOptions.import === 'undefined' ? true : rawOptions.import,
modules: modulesOptions,
// TODO remove in the next major release
icss: typeof rawOptions.icss === 'undefined' ? false : rawOptions.icss,
sourceMap:
typeof rawOptions.sourceMap === 'boolean'
? rawOptions.sourceMap
Expand Down
46 changes: 0 additions & 46 deletions test/__snapshots__/modules-option.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12529,52 +12529,6 @@ Array [

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

exports[`"modules" option show work and warn about the "icss" option deprecation: errors 1`] = `Array []`;

exports[`"modules" option show work and warn about the "icss" option deprecation: module 1`] = `
"// Imports
import ___CSS_LOADER_API_IMPORT___ from \\"../../../../../../src/runtime/api.js\\";
import ___CSS_LOADER_ICSS_IMPORT_0___ from \\"-!../../../../../../src/index.js??[ident]!./vars.css\\";
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(false);
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_ICSS_IMPORT_0___, \\"\\", true);
// Module
___CSS_LOADER_EXPORT___.push([module.id, \\".className {\\\\n color: \\" + ___CSS_LOADER_ICSS_IMPORT_0___.locals[\\"primary-color\\"] + \\";\\\\n}\\\\n\\", \\"\\"]);
// Exports
___CSS_LOADER_EXPORT___.locals = {
\\"primary-color\\": \\"\\" + ___CSS_LOADER_ICSS_IMPORT_0___.locals[\\"primary-color\\"] + \\"\\"
};
export default ___CSS_LOADER_EXPORT___;
"
`;

exports[`"modules" option show work and warn about the "icss" option deprecation: result 1`] = `
Array [
Array [
"../../src/index.js?[ident]!./modules/icss/tests-cases/import/vars.css",
"
",
"",
],
Array [
"./modules/icss/tests-cases/import/source.css",
".className {
color: red;
}
",
"",
],
]
`;

exports[`"modules" option show work and warn about the "icss" option deprecation: warnings 1`] = `
Array [
"ModuleWarning: Module Warning (from \`replaced original path\`):
The \\"icss\\" option is deprecated, use \\"modules.compileType: \\"icss\\"\\" instead",
"ModuleWarning: Module Warning (from \`replaced original path\`):
The \\"icss\\" option is deprecated, use \\"modules.compileType: \\"icss\\"\\" instead",
]
`;

exports[`"modules" option show work with the "compileType" and "exportOnlyLocals" options: errors 1`] = `Array []`;

exports[`"modules" option show work with the "compileType" and "exportOnlyLocals" options: module 1`] = `
Expand Down
28 changes: 8 additions & 20 deletions test/__snapshots__/validate-options.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ exports[`validate options should throw an error on the "esModule" option with "t
-> Use the ES modules syntax (https://github.com/webpack-contrib/css-loader#esmodule)."
`;

exports[`validate options should throw an error on the "icss" option with "1" value 1`] = `
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options.icss should be a boolean.
-> Enables/Disables handling the CSS module interoperable import/export format ((https://github.com/webpack-contrib/css-loader#icss)"
`;

exports[`validate options should throw an error on the "icss" option with "true" value 1`] = `
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options.icss should be a boolean.
-> Enables/Disables handling the CSS module interoperable import/export format ((https://github.com/webpack-contrib/css-loader#icss)"
`;

exports[`validate options should throw an error on the "import" option with "true" value 1`] = `
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options.import should be one of these:
Expand Down Expand Up @@ -245,49 +233,49 @@ exports[`validate options should throw an error on the "sourceMap" option with "
exports[`validate options should throw an error on the "unknown" option with "/test/" value 1`] = `
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'unknown'. These properties are valid:
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
`;

exports[`validate options should throw an error on the "unknown" option with "[]" value 1`] = `
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'unknown'. These properties are valid:
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
`;

exports[`validate options should throw an error on the "unknown" option with "{"foo":"bar"}" value 1`] = `
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'unknown'. These properties are valid:
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
`;

exports[`validate options should throw an error on the "unknown" option with "{}" value 1`] = `
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'unknown'. These properties are valid:
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
`;

exports[`validate options should throw an error on the "unknown" option with "1" value 1`] = `
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'unknown'. These properties are valid:
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
`;

exports[`validate options should throw an error on the "unknown" option with "false" value 1`] = `
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'unknown'. These properties are valid:
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
`;

exports[`validate options should throw an error on the "unknown" option with "test" value 1`] = `
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'unknown'. These properties are valid:
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
`;

exports[`validate options should throw an error on the "unknown" option with "true" value 1`] = `
"Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'unknown'. These properties are valid:
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }"
object { url?, import?, modules?, sourceMap?, importLoaders?, esModule? }"
`;

exports[`validate options should throw an error on the "url" option with "true" value 1`] = `
Expand Down
19 changes: 0 additions & 19 deletions test/modules-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1239,25 +1239,6 @@ describe('"modules" option', () => {
});
});

it('show work and warn about the "icss" option deprecation', async () => {
const compiler = getCompiler(
'./modules/icss/tests-cases/import/source.js',
{
icss: true,
}
);
const stats = await compile(compiler);

expect(
getModuleSource('./modules/icss/tests-cases/import/source.css', stats)
).toMatchSnapshot('module');
expect(getExecutedCode('main.bundle.js', compiler, stats)).toMatchSnapshot(
'result'
);
expect(getWarnings(stats)).toMatchSnapshot('warnings');
expect(getErrors(stats)).toMatchSnapshot('errors');
});

it('show work with the "compileType" and "exportOnlyLocals" options', async () => {
const compiler = getCompiler(
'./modules/icss/tests-cases/import/source.js',
Expand Down
4 changes: 0 additions & 4 deletions test/validate-options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ describe('validate options', () => {
success: [true, false, () => {}],
failure: ['true'],
},
icss: {
success: [true, false],
failure: ['true', 1],
},
modules: {
success: [
true,
Expand Down