Repository: webpack-contrib/css-loader
Pull request #1189 (2020-09-22 13:47:35)

Remove icss option
<!--
  HOLY CRAP a Pull Request. We ❤️ those!

  If you remove or skip this template, you'll make the 🐼 sad and the mighty god
  of Github will appear and pile-drive the close button from a great height
  while making animal noises.

  Please place an x (no spaces!) in all [ ] that apply
-->

This PR contains a:

- [ ] **bugfix**
- [ ] new **feature**
- [x] **code refactor**
- [x] **test update** <!-- if bug or feature is checked, this should be too -->
- [ ] **typo fix**
- [ ] **metadata update**

### Motivation / Use-Case

Remove icss option

### Breaking Changes

Yes

### Additional Info

No


codecov[bot]: # [Codecov](https://codecov.io/gh/webpack-contrib/css-loader/pull/1189?src=pr&el=h1) Report
> Merging [#1189](https://codecov.io/gh/webpack-contrib/css-loader/pull/1189?src=pr&el=desc) into [master](https://codecov.io/gh/webpack-contrib/css-loader/commit/57eb5059759f2ed1470b9c7efb6c457d90e6baeb?el=desc) will **decrease** coverage by `0.45%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/webpack-contrib/css-loader/pull/1189/graphs/tree.svg?width=650&height=150&src=pr&token=DlN3OQ0JnO)](https://codecov.io/gh/webpack-contrib/css-loader/pull/1189?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #1189      +/-   ##
==========================================
- Coverage   99.10%   98.64%   -0.46%     
==========================================
  Files          10       10              
  Lines         667      666       -1     
  Branches      213      212       -1     
==========================================
- Hits          661      657       -4     
- Misses          6        9       +3     
```


| [Impacted Files](https://codecov.io/gh/webpack-contrib/css-loader/pull/1189?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/utils.js](https://codecov.io/gh/webpack-contrib/css-loader/pull/1189/diff?src=pr&el=tree#diff-c3JjL3V0aWxzLmpz) | `97.01% <ø> (-1.00%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/webpack-contrib/css-loader/pull/1189?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/webpack-contrib/css-loader/pull/1189?src=pr&el=footer). Last update [57eb505...ddb6718](https://codecov.io/gh/webpack-contrib/css-loader/pull/1189?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/src/options.json b/src/options.json
index 0895597..ce59489 100644
--- a/src/options.json
+++ b/src/options.json
@@ -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"
diff --git a/src/utils.js b/src/utils.js
index 9b50681..67e5056 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -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


Test patch:
diff --git a/test/__snapshots__/modules-option.test.js.snap b/test/__snapshots__/modules-option.test.js.snap
index 087eba1..7e4dfd8 100644
--- a/test/__snapshots__/modules-option.test.js.snap
+++ b/test/__snapshots__/modules-option.test.js.snap
@@ -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`] = `
diff --git a/test/__snapshots__/validate-options.test.js.snap b/test/__snapshots__/validate-options.test.js.snap
index f3f6ecc..f8a113d 100644
--- a/test/__snapshots__/validate-options.test.js.snap
+++ b/test/__snapshots__/validate-options.test.js.snap
@@ -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:
@@ -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`] = `
diff --git a/test/modules-option.test.js b/test/modules-option.test.js
index 3fe8f55..44276e1 100644
--- a/test/modules-option.test.js
+++ b/test/modules-option.test.js
@@ -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',
diff --git a/test/validate-options.test.js b/test/validate-options.test.js
index 95c50fc..748c8c5 100644
--- a/test/validate-options.test.js
+++ b/test/validate-options.test.js
@@ -10,10 +10,6 @@ describe('validate options', () => {
       success: [true, false, () => {}],
       failure: ['true'],
     },
-    icss: {
-      success: [true, false],
-      failure: ['true', 1],
-    },
     modules: {
       success: [
         true,