css-loader 6.7.3 → 6.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +21 -11
  2. package/dist/index.js +6 -1
  3. package/package.json +20 -17
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  [![node][node]][node-url]
12
12
  [![tests][tests]][tests-url]
13
13
  [![coverage][cover]][cover-url]
14
- [![chat][chat]][chat-url]
14
+ [![discussion][discussion]][discussion-url]
15
15
  [![size][size]][size-url]
16
16
 
17
17
  # css-loader
@@ -22,7 +22,7 @@ The `css-loader` interprets `@import` and `url()` like `import/require()` and wi
22
22
 
23
23
  > **Warning**
24
24
  >
25
- > To use css-loader, webpack@5 is required
25
+ > To use the latest version of css-loader, webpack@5 is required
26
26
 
27
27
  To begin, you'll need to install `css-loader`:
28
28
 
@@ -184,9 +184,17 @@ Type:
184
184
  <!-- use other name to prettify since import is reserved keyword -->
185
185
 
186
186
  ```ts
187
- type import =
187
+ type importFn =
188
188
  | boolean
189
- | { filter: (url: string, media: string, resourcePath: string) => boolean };
189
+ | {
190
+ filter: (
191
+ url: string,
192
+ media: string,
193
+ resourcePath: string,
194
+ supports?: string,
195
+ layer?: string
196
+ ) => boolean;
197
+ };
190
198
  ```
191
199
 
192
200
  Default: `true`
@@ -693,11 +701,11 @@ Type:
693
701
 
694
702
  ```ts
695
703
  type mode =
696
- | "local"
697
- | "global"
698
- | "pure"
699
- | "icss"
700
- | ((resourcePath) => "local" | "global" | "pure" | "icss"))`
704
+ | "local"
705
+ | "global"
706
+ | "pure"
707
+ | "icss"
708
+ | ((resourcePath: string) => "local" | "global" | "pure" | "icss");
701
709
  ```
702
710
 
703
711
  Default: `'local'`
@@ -1696,6 +1704,8 @@ module.exports = {
1696
1704
  module: {
1697
1705
  rules: [
1698
1706
  {
1707
+ // If you enable `experiments.css` or `experiments.futureDefaults`, please uncomment line below
1708
+ // type: "javascript/auto",
1699
1709
  test: /\.(sa|sc|c)ss$/i,
1700
1710
  use: [
1701
1711
  devMode ? "style-loader" : MiniCssExtractPlugin.loader,
@@ -2026,7 +2036,7 @@ Please take a moment to read our contributing guidelines if you haven't yet done
2026
2036
  [tests-url]: https://github.com/webpack-contrib/css-loader/actions
2027
2037
  [cover]: https://codecov.io/gh/webpack-contrib/css-loader/branch/master/graph/badge.svg
2028
2038
  [cover-url]: https://codecov.io/gh/webpack-contrib/css-loader
2029
- [chat]: https://badges.gitter.im/webpack/webpack.svg
2030
- [chat-url]: https://gitter.im/webpack/webpack
2039
+ [discussion]: https://img.shields.io/github/discussions/webpack/webpack
2040
+ [discussion-url]: https://github.com/webpack/webpack/discussions
2031
2041
  [size]: https://packagephobia.now.sh/badge?p=css-loader
2032
2042
  [size-url]: https://packagephobia.now.sh/result?p=css-loader
package/dist/index.js CHANGED
@@ -20,8 +20,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
20
 
21
21
  async function loader(content, map, meta) {
22
22
  const rawOptions = this.getOptions(_options.default);
23
- const plugins = [];
24
23
  const callback = this.async();
24
+ if (this._compiler && this._compiler.options && this._compiler.options.experiments && this._compiler.options.experiments.css && this._module && this._module.type === "css") {
25
+ this.emitWarning(new Error('You can\'t use `experiments.css` (`experiments.futureDefaults` enable built-in CSS support by default) and `css-loader` together, please set `experiments.css` to `false` or set `{ type: "javascript/auto" }` for rules with `css-loader` in your webpack config (now css-loader does nothing).'));
26
+ callback(null, content, map, meta);
27
+ return;
28
+ }
25
29
  let options;
26
30
  try {
27
31
  options = (0, _utils.normalizeOptions)(rawOptions, this);
@@ -29,6 +33,7 @@ async function loader(content, map, meta) {
29
33
  callback(error);
30
34
  return;
31
35
  }
36
+ const plugins = [];
32
37
  const replacements = [];
33
38
  const exports = [];
34
39
  if ((0, _utils.shouldUseModulesPlugins)(options)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "css-loader",
3
- "version": "6.7.3",
3
+ "version": "6.7.4",
4
4
  "description": "css loader module for webpack",
5
5
  "license": "MIT",
6
6
  "repository": "webpack-contrib/css-loader",
@@ -28,6 +28,9 @@
28
28
  "lint:js": "eslint --cache .",
29
29
  "lint:spelling": "cspell \"**/*.*\"",
30
30
  "lint": "npm-run-all -l -p \"lint:**\"",
31
+ "fix:js": "npm run lint:js -- --fix",
32
+ "fix:prettier": "npm run lint:prettier -- --write",
33
+ "fix": "npm-run-all -l fix:js fix:prettier",
31
34
  "test:only": "cross-env NODE_ENV=test jest",
32
35
  "test:watch": "npm run test:only -- --watch",
33
36
  "test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
@@ -44,30 +47,30 @@
44
47
  },
45
48
  "dependencies": {
46
49
  "icss-utils": "^5.1.0",
47
- "postcss": "^8.4.19",
50
+ "postcss": "^8.4.21",
48
51
  "postcss-modules-extract-imports": "^3.0.0",
49
- "postcss-modules-local-by-default": "^4.0.0",
52
+ "postcss-modules-local-by-default": "^4.0.1",
50
53
  "postcss-modules-scope": "^3.0.0",
51
54
  "postcss-modules-values": "^4.0.0",
52
55
  "postcss-value-parser": "^4.2.0",
53
56
  "semver": "^7.3.8"
54
57
  },
55
58
  "devDependencies": {
56
- "@babel/cli": "^7.19.3",
57
- "@babel/core": "^7.20.5",
58
- "@babel/preset-env": "^7.20.2",
59
+ "@babel/cli": "^7.21.0",
60
+ "@babel/core": "^7.21.4",
61
+ "@babel/preset-env": "^7.21.4",
59
62
  "@commitlint/cli": "^16.3.0",
60
63
  "@commitlint/config-conventional": "^16.2.4",
61
64
  "@webpack-contrib/eslint-config-webpack": "^3.0.0",
62
65
  "babel-jest": "^28.1.3",
63
66
  "cross-env": "^7.0.3",
64
- "cspell": "^6.15.1",
67
+ "cspell": "^6.31.1",
65
68
  "del": "^6.1.1",
66
69
  "del-cli": "^4.0.1",
67
- "es-check": "^7.0.1",
68
- "eslint": "^8.28.0",
69
- "eslint-config-prettier": "^8.5.0",
70
- "eslint-plugin-import": "^2.26.0",
70
+ "es-check": "^7.1.0",
71
+ "eslint": "^8.37.0",
72
+ "eslint-config-prettier": "^8.8.0",
73
+ "eslint-plugin-import": "^2.27.5",
71
74
  "file-loader": "^6.2.0",
72
75
  "husky": "^7.0.1",
73
76
  "jest": "^28.1.3",
@@ -75,21 +78,21 @@
75
78
  "less": "^4.1.3",
76
79
  "less-loader": "^10.0.1",
77
80
  "lint-staged": "^12.5.0",
78
- "memfs": "^3.4.12",
79
- "mini-css-extract-plugin": "^2.7.1",
81
+ "memfs": "^3.4.13",
82
+ "mini-css-extract-plugin": "^2.7.5",
80
83
  "npm-run-all": "^4.1.5",
81
84
  "postcss-loader": "^6.2.1",
82
85
  "postcss-preset-env": "^7.8.3",
83
- "prettier": "^2.8.0",
84
- "sass": "^1.56.1",
86
+ "prettier": "^2.8.7",
87
+ "sass": "^1.60.0",
85
88
  "sass-loader": "^12.6.0",
86
89
  "standard-version": "^9.5.0",
87
90
  "strip-ansi": "^6.0.0",
88
- "style-loader": "^3.1.0",
91
+ "style-loader": "^3.3.2",
89
92
  "stylus": "^0.56.0",
90
93
  "stylus-loader": "^6.1.0",
91
94
  "url-loader": "^4.1.1",
92
- "webpack": "^5.75.0"
95
+ "webpack": "^5.77.0"
93
96
  },
94
97
  "keywords": [
95
98
  "webpack",