css-loader 3.5.3 → 3.6.0

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [3.6.0](https://github.com/webpack-contrib/css-loader/compare/v3.5.3...v3.6.0) (2020-06-13)
6
+
7
+
8
+ ### Features
9
+
10
+ * allow `modules.auto` to be a filter function ([#1086](https://github.com/webpack-contrib/css-loader/issues/1086)) ([0902353](https://github.com/webpack-contrib/css-loader/commit/0902353c328d4d18e8ed2755fe9c83c03c53df81))
11
+
5
12
  ### [3.5.3](https://github.com/webpack-contrib/css-loader/compare/v3.5.2...v3.5.3) (2020-04-24)
6
13
 
7
14
 
package/README.md CHANGED
@@ -542,7 +542,7 @@ module.exports = {
542
542
 
543
543
  ##### `auto`
544
544
 
545
- Type: `Boolean|RegExp`
545
+ Type: `Boolean|RegExp|Function`
546
546
  Default: `'undefined'`
547
547
 
548
548
  Allows auto enable css modules based on filename.
@@ -576,7 +576,7 @@ module.exports = {
576
576
 
577
577
  ###### `RegExp`
578
578
 
579
- Enable css modules for files based on a filename and satisfying your regex.
579
+ Enable css modules for files based on the filename satisfying your regex check.
580
580
 
581
581
  **webpack.config.js**
582
582
 
@@ -598,6 +598,30 @@ module.exports = {
598
598
  };
599
599
  ```
600
600
 
601
+ ###### `Function`
602
+
603
+ Enable css modules for files based on the filename satisfying your filter function check.
604
+
605
+ **webpack.config.js**
606
+
607
+ ```js
608
+ module.exports = {
609
+ module: {
610
+ rules: [
611
+ {
612
+ test: /\.css$/i,
613
+ loader: 'css-loader',
614
+ options: {
615
+ modules: {
616
+ auto: (resourcePath) => resourcePath.endsWith('.custom-module.css'),
617
+ },
618
+ },
619
+ },
620
+ ],
621
+ },
622
+ };
623
+ ```
624
+
601
625
  ##### `mode`
602
626
 
603
627
  Type: `String|Function`
package/dist/options.json CHANGED
@@ -41,6 +41,9 @@
41
41
  {
42
42
  "instanceof": "RegExp"
43
43
  },
44
+ {
45
+ "instanceof": "Function"
46
+ },
44
47
  {
45
48
  "type": "boolean"
46
49
  }
package/dist/utils.js CHANGED
@@ -124,6 +124,10 @@ function shouldUseModulesPlugins(modules, resourcePath) {
124
124
  return modules.auto.test(resourcePath);
125
125
  }
126
126
 
127
+ if (typeof modules.auto === 'function') {
128
+ return modules.auto(resourcePath);
129
+ }
130
+
127
131
  return true;
128
132
  }
129
133
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "css-loader",
3
- "version": "3.5.3",
3
+ "version": "3.6.0",
4
4
  "description": "css loader module for webpack",
5
5
  "license": "MIT",
6
6
  "repository": "webpack-contrib/css-loader",
@@ -48,43 +48,43 @@
48
48
  "icss-utils": "^4.1.1",
49
49
  "loader-utils": "^1.2.3",
50
50
  "normalize-path": "^3.0.0",
51
- "postcss": "^7.0.27",
51
+ "postcss": "^7.0.32",
52
52
  "postcss-modules-extract-imports": "^2.0.0",
53
53
  "postcss-modules-local-by-default": "^3.0.2",
54
54
  "postcss-modules-scope": "^2.2.0",
55
55
  "postcss-modules-values": "^3.0.0",
56
- "postcss-value-parser": "^4.0.3",
57
- "schema-utils": "^2.6.6",
56
+ "postcss-value-parser": "^4.1.0",
57
+ "schema-utils": "^2.7.0",
58
58
  "semver": "^6.3.0"
59
59
  },
60
60
  "devDependencies": {
61
- "@babel/cli": "^7.8.4",
62
- "@babel/core": "^7.9.0",
63
- "@babel/preset-env": "^7.9.5",
61
+ "@babel/cli": "^7.10.1",
62
+ "@babel/core": "^7.10.2",
63
+ "@babel/preset-env": "^7.10.2",
64
64
  "@commitlint/cli": "^8.3.5",
65
65
  "@commitlint/config-conventional": "^8.3.4",
66
66
  "@webpack-contrib/defaults": "^6.3.0",
67
67
  "@webpack-contrib/eslint-config-webpack": "^3.0.0",
68
- "babel-jest": "^25.4.0",
68
+ "babel-jest": "^25.5.1",
69
69
  "cross-env": "^7.0.2",
70
70
  "del": "^5.1.0",
71
- "del-cli": "^3.0.0",
71
+ "del-cli": "^3.0.1",
72
72
  "es-check": "^5.1.0",
73
73
  "eslint": "^6.8.0",
74
74
  "eslint-config-prettier": "^6.11.0",
75
- "eslint-plugin-import": "^2.20.2",
75
+ "eslint-plugin-import": "^2.21.2",
76
76
  "file-loader": "^6.0.0",
77
77
  "husky": "^4.2.5",
78
- "jest": "^25.4.0",
79
- "lint-staged": "^10.1.7",
80
- "memfs": "^3.1.2",
78
+ "jest": "^25.5.4",
79
+ "lint-staged": "^10.2.10",
80
+ "memfs": "^3.2.0",
81
81
  "npm-run-all": "^4.1.5",
82
82
  "postcss-loader": "^3.0.0",
83
83
  "postcss-preset-env": "^6.7.0",
84
84
  "prettier": "^2.0.5",
85
- "sass": "^1.26.3",
85
+ "sass": "^1.26.8",
86
86
  "sass-loader": "^8.0.2",
87
- "standard-version": "^7.1.0",
87
+ "standard-version": "^8.0.0",
88
88
  "strip-ansi": "^6.0.0",
89
89
  "url-loader": "^4.1.0",
90
90
  "webpack": "^4.43.0"