stylelint-webpack-plugin 2.3.2 → 3.1.1

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/dist/utils.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.arrify = arrify;
6
7
  exports.jsonStringifyReplacerSortKeys = void 0;
7
8
  exports.parseFiles = parseFiles;
8
9
  exports.parseFoldersToGlobs = parseFoldersToGlobs;
@@ -13,39 +14,79 @@ var _fs = require("fs");
13
14
 
14
15
  var _normalizePath = _interopRequireDefault(require("normalize-path"));
15
16
 
16
- var _arrify = _interopRequireDefault(require("arrify"));
17
-
18
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
18
 
20
19
  // @ts-ignore
21
- // @ts-ignore
22
20
 
23
- /**
24
- * @param {string|(string|undefined)[]} files
25
- * @param {string} context
26
- * @returns {string[]}
21
+ /**
22
+ * @template T
23
+ * @param {T} value
24
+ * @return {
25
+ T extends (null | undefined)
26
+ ? []
27
+ : T extends string
28
+ ? [string]
29
+ : T extends readonly unknown[]
30
+ ? T
31
+ : T extends Iterable<infer T>
32
+ ? T[]
33
+ : [T]
34
+ }
35
+ */
36
+
37
+ /* istanbul ignore next */
38
+ function arrify(value) {
39
+ // eslint-disable-next-line no-undefined
40
+ if (value === null || value === undefined) {
41
+ // @ts-ignore
42
+ return [];
43
+ }
44
+
45
+ if (Array.isArray(value)) {
46
+ // @ts-ignore
47
+ return value;
48
+ }
49
+
50
+ if (typeof value === 'string') {
51
+ // @ts-ignore
52
+ return [value];
53
+ } // @ts-ignore
54
+
55
+
56
+ if (typeof value[Symbol.iterator] === 'function') {
57
+ // @ts-ignore
58
+ return [...value];
59
+ } // @ts-ignore
60
+
61
+
62
+ return [value];
63
+ }
64
+ /**
65
+ * @param {string|string[]} files
66
+ * @param {string} context
67
+ * @returns {string[]}
27
68
  */
69
+
70
+
28
71
  function parseFiles(files, context) {
29
- return (0, _arrify.default)(files).filter((
30
- /** @type {string} */
31
- file) => typeof file === 'string').map((
72
+ return arrify(files).map((
32
73
  /** @type {string} */
33
74
  file) => (0, _normalizePath.default)((0, _path.resolve)(context, file)));
34
75
  }
35
- /**
36
- * @param {string|string[]} patterns
37
- * @param {string|string[]} extensions
38
- * @returns {string[]}
76
+ /**
77
+ * @param {string|string[]} patterns
78
+ * @param {string|string[]} extensions
79
+ * @returns {string[]}
39
80
  */
40
81
 
41
82
 
42
83
  function parseFoldersToGlobs(patterns, extensions = []) {
43
- const extensionsList = (0, _arrify.default)(extensions);
84
+ const extensionsList = arrify(extensions);
44
85
  const [prefix, postfix] = extensionsList.length > 1 ? ['{', '}'] : ['', ''];
45
86
  const extensionsGlob = extensionsList.map((
46
87
  /** @type {string} */
47
88
  extension) => extension.replace(/^\./u, '')).join(',');
48
- return (0, _arrify.default)(patterns).map((
89
+ return arrify(patterns).map((
49
90
  /** @type {string} */
50
91
  pattern) => {
51
92
  try {
@@ -62,17 +103,17 @@ function parseFoldersToGlobs(patterns, extensions = []) {
62
103
  return pattern;
63
104
  });
64
105
  }
65
- /**
66
- *
67
- * @param {string} _ key, but unused
68
- * @param {any} value
106
+ /**
107
+ *
108
+ * @param {string} _ key, but unused
109
+ * @param {any} value
69
110
  */
70
111
 
71
112
 
72
113
  const jsonStringifyReplacerSortKeys = (_, value) => {
73
- /**
74
- * @param {{ [x: string]: any; }} sorted
75
- * @param {string | number} key
114
+ /**
115
+ * @param {{ [x: string]: any; }} sorted
116
+ * @param {string | number} key
76
117
  */
77
118
  const insert = (sorted, key) => {
78
119
  // eslint-disable-next-line no-param-reassign
package/dist/worker.js CHANGED
@@ -15,9 +15,9 @@ let stylelint;
15
15
  /** @type {Partial<StylelintOptions>} */
16
16
 
17
17
  let linterOptions;
18
- /**
19
- * @param {Options} options
20
- * @param {Partial<StylelintOptions>} stylelintOptions
18
+ /**
19
+ * @param {Options} options
20
+ * @param {Partial<StylelintOptions>} stylelintOptions
21
21
  */
22
22
 
23
23
  function setup(options, stylelintOptions) {
@@ -25,8 +25,8 @@ function setup(options, stylelintOptions) {
25
25
  linterOptions = stylelintOptions;
26
26
  return stylelint;
27
27
  }
28
- /**
29
- * @param {string | string[]} files
28
+ /**
29
+ * @param {string | string[]} files
30
30
  */
31
31
 
32
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stylelint-webpack-plugin",
3
- "version": "2.3.2",
3
+ "version": "3.1.1",
4
4
  "description": "A Stylelint plugin for webpack",
5
5
  "license": "MIT",
6
6
  "repository": "webpack-contrib/stylelint-webpack-plugin",
@@ -14,7 +14,7 @@
14
14
  "main": "dist/cjs.js",
15
15
  "types": "declarations/index.d.ts",
16
16
  "engines": {
17
- "node": ">= 10.13.0"
17
+ "node": ">= 12.13.0"
18
18
  },
19
19
  "scripts": {
20
20
  "start": "npm run build -- -w",
@@ -43,22 +43,21 @@
43
43
  ],
44
44
  "peerDependencies": {
45
45
  "stylelint": "^13.0.0 || ^14.0.0",
46
- "webpack": "^4.0.0 || ^5.0.0"
46
+ "webpack": "^5.0.0"
47
47
  },
48
48
  "dependencies": {
49
- "arrify": "^2.0.1",
50
- "globby": "^11.0.4",
51
49
  "jest-worker": "^27.3.1",
50
+ "globby": "^11.0.4",
52
51
  "micromatch": "^4.0.4",
53
52
  "normalize-path": "^3.0.0",
54
- "schema-utils": "^3.1.1"
53
+ "schema-utils": "^4.0.0"
55
54
  },
56
55
  "devDependencies": {
57
56
  "@babel/cli": "^7.16.0",
58
57
  "@babel/core": "^7.16.0",
59
- "@babel/preset-env": "^7.16.0",
60
- "@commitlint/cli": "^12.1.4",
61
- "@commitlint/config-conventional": "^12.1.4",
58
+ "@babel/preset-env": "^7.16.4",
59
+ "@commitlint/cli": "^15.0.0",
60
+ "@commitlint/config-conventional": "^15.0.0",
62
61
  "@types/fs-extra": "^9.0.13",
63
62
  "@types/micromatch": "^4.0.2",
64
63
  "@types/normalize-path": "^3.0.0",
@@ -69,22 +68,22 @@
69
68
  "chokidar": "^3.5.2",
70
69
  "cross-env": "^7.0.3",
71
70
  "del": "^6.0.0",
72
- "del-cli": "^3.0.1",
73
- "eslint": "^7.32.0",
71
+ "del-cli": "^4.0.1",
72
+ "eslint": "^8.3.0",
74
73
  "eslint-config-prettier": "^8.3.0",
75
- "eslint-plugin-import": "^2.25.2",
74
+ "eslint-plugin-import": "^2.25.3",
76
75
  "file-loader": "^6.2.0",
77
- "fs-extra": "^9.1.0",
78
- "husky": "^6.0.0",
76
+ "fs-extra": "^10.0.0",
77
+ "husky": "^7.0.4",
79
78
  "jest": "^27.3.1",
80
- "lint-staged": "^10.5.4",
79
+ "lint-staged": "^12.1.2",
81
80
  "npm-run-all": "^4.1.5",
82
- "postcss-scss": "^3.0.5",
81
+ "postcss-scss": "^4.0.2",
83
82
  "prettier": "^2.4.1",
84
83
  "standard-version": "^9.3.2",
85
- "stylelint": "^14.0.1",
86
- "typescript": "^4.4.4",
87
- "webpack": "^5.62.1"
84
+ "stylelint": "^14.1.0",
85
+ "typescript": "^4.5.2",
86
+ "webpack": "^5.64.3"
88
87
  },
89
88
  "keywords": [
90
89
  "stylelint",