stylelint-webpack-plugin 3.1.1 → 3.2.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/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright JS Foundation and other contributors
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- 'Software'), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright JS Foundation and other contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ 'Software'), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -21,16 +21,40 @@ This plugin uses [`stylelint`](https://stylelint.io/) that helps you avoid error
21
21
 
22
22
  To begin, you'll need to install `stylelint-webpack-plugin`:
23
23
 
24
- ```bash
24
+ ```console
25
25
  npm install stylelint-webpack-plugin --save-dev
26
26
  ```
27
27
 
28
+ or
29
+
30
+ ```console
31
+ yarn add -D install stylelint-webpack-plugin
32
+ ```
33
+
34
+ or
35
+
36
+ ```console
37
+ pnpm add -D stylelint-webpack-plugin
38
+ ```
39
+
28
40
  **Note**: You also need to install `stylelint >= 13` from npm, if you haven't already:
29
41
 
30
- ```bash
42
+ ```console
31
43
  npm install stylelint --save-dev
32
44
  ```
33
45
 
46
+ or
47
+
48
+ ```console
49
+ yarn add -D stylelint
50
+ ```
51
+
52
+ or
53
+
54
+ ```console
55
+ pnpm add -D stylelint
56
+ ```
57
+
34
58
  **Note**: If you are using Stylelint 13 rather than 14+, you might also need to install `@types/stylelint` as a dev dependency if getting stylelint related type errors.
35
59
 
36
60
  Then add the plugin to your webpack config. For example:
@@ -51,7 +75,12 @@ See [stylelint's options](https://stylelint.io/user-guide/usage/node-api#options
51
75
 
52
76
  ### `configFile`
53
77
 
54
- - Type: `String`
78
+ - Type:
79
+
80
+ ```ts
81
+ type context = string;
82
+ ```
83
+
55
84
  - Default: `undefined`
56
85
 
57
86
  Specify the config file location to be used by `stylelint`.
@@ -60,63 +89,110 @@ Specify the config file location to be used by `stylelint`.
60
89
 
61
90
  ### `context`
62
91
 
63
- - Type: `String`
92
+ - Type:
93
+
94
+ ```ts
95
+ type context = string;
96
+ ```
97
+
64
98
  - Default: `compiler.context`
65
99
 
66
100
  A string indicating the root of your files.
67
101
 
68
102
  ### `exclude`
69
103
 
70
- - Type: `String|Array[String]`
104
+ - Type:
105
+
106
+ ```ts
107
+ type exclude = string | Array<string>;
108
+ ```
109
+
71
110
  - Default: `['node_modules', compiler.options.output.path]`
72
111
 
73
112
  Specify the files and/or directories to exclude. Must be relative to `options.context`.
74
113
 
75
114
  ### `extensions`
76
115
 
77
- - Type: `String|Array[String]`
116
+ - Type:
117
+
118
+ ```ts
119
+ type extensions = string | Array<string>;
120
+ ```
121
+
78
122
  - Default: `['css', 'scss', 'sass']`
79
123
 
80
124
  Specify extensions that should be checked.
81
125
 
82
126
  ### `files`
83
127
 
84
- - Type: `String|Array[String]`
128
+ - Type:
129
+
130
+ ```ts
131
+ type files = string | Array<string>;
132
+ ```
133
+
85
134
  - Default: `null`
86
135
 
87
- Specify directories, files, or globs. Must be relative to `options.context`. Directories are traveresed recursively looking for files matching `options.extensions`. File and glob patterns ignore `options.extensions`.
136
+ Specify directories, files, or globs. Must be relative to `options.context`. Directories are traversed recursively looking for files matching `options.extensions`. File and glob patterns ignore `options.extensions`.
88
137
 
89
138
  ### `fix`
90
139
 
91
- - Type: `Boolean`
140
+ - Type:
141
+
142
+ ```ts
143
+ type fix = boolean;
144
+ ```
145
+
92
146
  - Default: `false`
93
147
 
94
148
  If `true`, `stylelint` will fix as many errors as possible. The fixes are made to the actual source files. All unfixed errors will be reported. See [Autofixing errors](https://stylelint.io/user-guide/usage/options#fix) docs.
95
149
 
96
150
  ### `formatter`
97
151
 
98
- - Type: `String|Function`
152
+ - Type:
153
+
154
+ ```ts
155
+ type formatter = string | (
156
+ results: Array<import('stylelint').LintResult>
157
+ ) => string
158
+ ```
159
+
99
160
  - Default: `'string'`
100
161
 
101
162
  Specify the formatter that you would like to use to format your results. See [formatter option](https://stylelint.io/user-guide/usage/options#formatter).
102
163
 
103
164
  ### `lintDirtyModulesOnly`
104
165
 
105
- - Type: `Boolean`
166
+ - Type:
167
+
168
+ ```ts
169
+ type lintDirtyModulesOnly = boolean;
170
+ ```
171
+
106
172
  - Default: `false`
107
173
 
108
174
  Lint only changed files, skip lint on start.
109
175
 
110
176
  ### `stylelintPath`
111
177
 
112
- - Type: `String`
178
+ - Type:
179
+
180
+ ```ts
181
+ type stylelintPath = string;
182
+ ```
183
+
113
184
  - Default: `stylelint`
114
185
 
115
186
  Path to `stylelint` instance that will be used for linting.
116
187
 
117
188
  ### `threads`
118
189
 
119
- - Type: `Boolean | Number`
190
+ - Type:
191
+
192
+ ```ts
193
+ type threads = boolean | number;
194
+ ```
195
+
120
196
  - Default: `false`
121
197
 
122
198
  Set to true for an auto-selected pool size based on number of cpus. Set to a number greater than 1 to set an explicit pool size. Set to false, 1, or less to disable and only run in main process.
@@ -128,42 +204,82 @@ You can still force this behavior by using `emitError` **or** `emitWarning` opti
128
204
 
129
205
  #### `emitError`
130
206
 
131
- - Type: `Boolean`
207
+ - Type:
208
+
209
+ ```ts
210
+ type emitError = boolean;
211
+ ```
212
+
132
213
  - Default: `true`
133
214
 
134
215
  The errors found will always be emitted, to disable set to `false`.
135
216
 
136
217
  #### `emitWarning`
137
218
 
138
- - Type: `Boolean`
219
+ - Type:
220
+
221
+ ```ts
222
+ type emitWarning = boolean;
223
+ ```
224
+
139
225
  - Default: `true`
140
226
 
141
227
  The warnings found will always be emitted, to disable set to `false`.
142
228
 
143
229
  #### `failOnError`
144
230
 
145
- - Type: `Boolean`
231
+ - Type:
232
+
233
+ ```ts
234
+ type failOnError = boolean;
235
+ ```
236
+
146
237
  - Default: `true`
147
238
 
148
239
  Will cause the module build to fail if there are any errors, to disable set to `false`.
149
240
 
150
241
  #### `failOnWarning`
151
242
 
152
- - Type: `Boolean`
243
+ - Type:
244
+
245
+ ```ts
246
+ type failOnWarning = boolean;
247
+ ```
248
+
153
249
  - Default: `false`
154
250
 
155
251
  Will cause the module build to fail if there are any warnings, if set to `true`.
156
252
 
157
253
  #### `quiet`
158
254
 
159
- - Type: `Boolean`
255
+ - Type:
256
+
257
+ ```ts
258
+ type quiet = boolean;
259
+ ```
260
+
160
261
  - Default: `false`
161
262
 
162
263
  Will process and report errors only and ignore warnings, if set to `true`.
163
264
 
164
265
  #### `outputReport`
165
266
 
166
- - Type: `Boolean|Object`
267
+ - Type:
268
+
269
+ ```ts
270
+ type outputReport =
271
+ | boolean
272
+ | {
273
+ filePath?: string | undefined;
274
+ formatter?:
275
+ | (
276
+ | string
277
+ | ((results: Array<import('stylelint').LintResult>) => string)
278
+ )
279
+ | undefined;
280
+ };
281
+ ```
282
+
167
283
  - Default: `false`
168
284
 
169
285
  Write the output of the errors to a file, for example a `json` file for use for reporting.
@@ -1,10 +1,5 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
3
  class StylelintError extends Error {
9
4
  /**
10
5
  * @param {string=} messages
@@ -17,5 +12,4 @@ class StylelintError extends Error {
17
12
 
18
13
  }
19
14
 
20
- var _default = StylelintError;
21
- exports.default = _default;
15
+ module.exports = StylelintError;
@@ -1,23 +1,29 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = getStylelint;
3
+ const {
4
+ cpus
5
+ } = require('os');
7
6
 
8
- var _os = require("os");
7
+ const {
8
+ Worker: JestWorker
9
+ } = require('jest-worker'); // @ts-ignore
9
10
 
10
- var _jestWorker = require("jest-worker");
11
11
 
12
- var _worker = require("./worker");
12
+ const {
13
+ setup,
14
+ lintFiles
15
+ } = require('./worker');
13
16
 
14
- var _utils = require("./utils");
17
+ const {
18
+ jsonStringifyReplacerSortKeys
19
+ } = require('./utils');
15
20
 
16
- var _options = require("./options");
21
+ const {
22
+ getStylelintOptions
23
+ } = require('./options');
24
+ /** @type {{[key: string]: any}} */
17
25
 
18
- // @ts-ignore
19
26
 
20
- /** @type {{[key: string]: any}} */
21
27
  const cache = {};
22
28
  /** @typedef {import('stylelint')} Stylelint */
23
29
 
@@ -29,7 +35,7 @@ const cache = {};
29
35
 
30
36
  /** @typedef {(files: string|string[]) => Promise<LintResult[]>} LintTask */
31
37
 
32
- /** @typedef {{stylelint: Stylelint, lintFiles: LintTask, cleanup: AsyncTask, threads: number, }} Linter */
38
+ /** @typedef {{api: import('stylelint').InternalApi, stylelint: Stylelint, lintFiles: LintTask, cleanup: AsyncTask, threads: number, }} Linter */
33
39
 
34
40
  /** @typedef {import('jest-worker').Worker & {lintFiles: LintTask}} Worker */
35
41
 
@@ -39,10 +45,12 @@ const cache = {};
39
45
  */
40
46
 
41
47
  function loadStylelint(options) {
42
- const stylelint = (0, _worker.setup)(options, (0, _options.getStylelintOptions)(options));
48
+ const stylelintOptions = getStylelintOptions(options);
49
+ const stylelint = setup(options, stylelintOptions);
43
50
  return {
44
51
  stylelint,
45
- lintFiles: _worker.lintFiles,
52
+ api: stylelint.createLinter(stylelintOptions),
53
+ lintFiles,
46
54
  cleanup: async () => {},
47
55
  threads: 1
48
56
  };
@@ -63,12 +71,12 @@ function loadStylelintThreaded(key, poolSize, options) {
63
71
  const workerOptions = {
64
72
  enableWorkerThreads: true,
65
73
  numWorkers: poolSize,
66
- setupArgs: [options, (0, _options.getStylelintOptions)(options)]
74
+ setupArgs: [options, getStylelintOptions(options)]
67
75
  };
68
76
  const local = loadStylelint(options);
69
77
  let worker =
70
78
  /** @type {Worker?} */
71
- new _jestWorker.Worker(source, workerOptions);
79
+ new JestWorker(source, workerOptions);
72
80
  /** @type {Linter} */
73
81
 
74
82
  const context = { ...local,
@@ -102,7 +110,7 @@ function getStylelint(key, {
102
110
  threads,
103
111
  ...options
104
112
  }) {
105
- const max = typeof threads !== 'number' ? threads ? (0, _os.cpus)().length - 1 : 1 : threads;
113
+ const max = typeof threads !== 'number' ? threads ? cpus().length - 1 : 1 : threads;
106
114
  const cacheKey = getCacheKey(key, {
107
115
  threads,
108
116
  ...options
@@ -125,5 +133,7 @@ function getCacheKey(key, options) {
125
133
  return JSON.stringify({
126
134
  key,
127
135
  options
128
- }, _utils.jsonStringifyReplacerSortKeys);
129
- }
136
+ }, jsonStringifyReplacerSortKeys);
137
+ }
138
+
139
+ module.exports = getStylelint;
package/dist/index.js CHANGED
@@ -1,26 +1,27 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
3
+ const {
4
+ isAbsolute,
5
+ join
6
+ } = require('path');
7
7
 
8
- var _path = require("path");
8
+ const globby = require('globby');
9
9
 
10
- var _globby = _interopRequireDefault(require("globby"));
10
+ const {
11
+ isMatch
12
+ } = require('micromatch');
11
13
 
12
- var _micromatch = require("micromatch");
14
+ const {
15
+ getOptions
16
+ } = require('./options');
13
17
 
14
- var _options = require("./options");
15
-
16
- var _linter = _interopRequireDefault(require("./linter"));
17
-
18
- var _utils = require("./utils");
19
-
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
- // @ts-ignore
18
+ const linter = require('./linter');
23
19
 
20
+ const {
21
+ arrify,
22
+ parseFiles,
23
+ parseFoldersToGlobs
24
+ } = require('./utils');
24
25
  /** @typedef {import('webpack').Compiler} Compiler */
25
26
 
26
27
  /** @typedef {import('webpack').Module} Module */
@@ -28,6 +29,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
28
29
  /** @typedef {import('./options').Options} Options */
29
30
 
30
31
  /** @typedef {Partial<{timestamp:number} | number>} FileSystemInfoEntry */
32
+
33
+
31
34
  const STYLELINT_PLUGIN = 'StylelintWebpackPlugin';
32
35
  let counter = 0;
33
36
 
@@ -37,7 +40,7 @@ class StylelintWebpackPlugin {
37
40
  */
38
41
  constructor(options = {}) {
39
42
  this.key = STYLELINT_PLUGIN;
40
- this.options = (0, _options.getOptions)(options);
43
+ this.options = getOptions(options);
41
44
  this.run = this.run.bind(this);
42
45
  this.startTime = Date.now();
43
46
  this.prevTimestamps = new Map();
@@ -87,15 +90,18 @@ class StylelintWebpackPlugin {
87
90
  const context = this.getContext(compiler);
88
91
  const excludeDefault = ['**/node_modules/**', String(compiler.options.output.path)];
89
92
  const options = { ...this.options,
90
- exclude: (0, _utils.parseFiles)(this.options.exclude || excludeDefault, context),
91
- extensions: (0, _utils.arrify)(this.options.extensions),
92
- files: (0, _utils.parseFiles)(this.options.files || '', context)
93
+ exclude: parseFiles(this.options.exclude || excludeDefault, context),
94
+ extensions: arrify(this.options.extensions),
95
+ files: parseFiles(this.options.files || '', context)
93
96
  };
94
- const wanted = (0, _utils.parseFoldersToGlobs)(options.files, options.extensions);
95
- const exclude = (0, _utils.parseFoldersToGlobs)(options.exclude);
97
+ const wanted = parseFoldersToGlobs(options.files, options.extensions);
98
+ const exclude = parseFoldersToGlobs(options.exclude);
96
99
  compiler.hooks.thisCompilation.tap(this.key, compilation => {
97
100
  /** @type {import('./linter').Linter} */
98
101
  let lint;
102
+ /** @type {import('stylelint').InternalApi} */
103
+
104
+ let api;
99
105
  /** @type {import('./linter').Reporter} */
100
106
 
101
107
  let report;
@@ -106,30 +112,39 @@ class StylelintWebpackPlugin {
106
112
  try {
107
113
  ({
108
114
  lint,
115
+ api,
109
116
  report,
110
117
  threads
111
- } = (0, _linter.default)(this.key, options, compilation));
118
+ } = linter(this.key, options, compilation));
112
119
  } catch (e) {
113
120
  compilation.errors.push(e);
114
121
  return;
115
122
  }
116
123
 
117
- compilation.hooks.finishModules.tap(this.key, () => {
118
- const files = compiler.modifiedFiles ? Array.from(compiler.modifiedFiles).filter(file => (0, _micromatch.isMatch)(file, wanted, {
124
+ compilation.hooks.finishModules.tapPromise(this.key, async () => {
125
+ /** @type {string[]} */
126
+ // @ts-ignore
127
+ const files = (await Promise.all((compiler.modifiedFiles ? Array.from(compiler.modifiedFiles).filter(file => isMatch(file, wanted, {
119
128
  dot: true
120
- }) && !(0, _micromatch.isMatch)(file, exclude, {
129
+ }) && !isMatch(file, exclude, {
121
130
  dot: true
122
- })) : _globby.default.sync(wanted, {
131
+ })) : globby.sync(wanted, {
123
132
  dot: true,
124
133
  ignore: exclude
125
- });
134
+ })).map(async file => {
135
+ try {
136
+ return (await api.isPathIgnored(file)) ? false : file;
137
+ } catch (e) {
138
+ return file;
139
+ }
140
+ }))).filter(file => file !== false);
126
141
 
127
142
  if (threads > 1) {
128
143
  for (const file of files) {
129
- lint((0, _utils.parseFiles)(file, context));
144
+ lint(parseFiles(file, context));
130
145
  }
131
146
  } else if (files.length > 0) {
132
- lint((0, _utils.parseFiles)(files, context));
147
+ lint(parseFiles(files, context));
133
148
  }
134
149
  }); // await and interpret results
135
150
 
@@ -176,8 +191,8 @@ class StylelintWebpackPlugin {
176
191
  return String(compiler.options.context);
177
192
  }
178
193
 
179
- if (!(0, _path.isAbsolute)(this.options.context)) {
180
- return (0, _path.join)(String(compiler.options.context), this.options.context);
194
+ if (!isAbsolute(this.options.context)) {
195
+ return join(String(compiler.options.context), this.options.context);
181
196
  }
182
197
 
183
198
  return this.options.context;
@@ -185,5 +200,4 @@ class StylelintWebpackPlugin {
185
200
 
186
201
  }
187
202
 
188
- var _default = StylelintWebpackPlugin;
189
- exports.default = _default;
203
+ module.exports = StylelintWebpackPlugin;
package/dist/linter.js CHANGED
@@ -1,24 +1,24 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = linter;
3
+ const {
4
+ dirname,
5
+ isAbsolute,
6
+ join
7
+ } = require('path');
7
8
 
8
- var _path = require("path");
9
+ const StylelintError = require('./StylelintError');
9
10
 
10
- var _StylelintError = _interopRequireDefault(require("./StylelintError"));
11
-
12
- var _getStylelint = _interopRequireDefault(require("./getStylelint"));
13
-
14
- var _utils = require("./utils");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ const getStylelint = require('./getStylelint');
17
12
 
13
+ const {
14
+ arrify
15
+ } = require('./utils');
18
16
  /** @typedef {import('stylelint')} Stylelint */
19
17
 
20
18
  /** @typedef {import('stylelint').LintResult} LintResult */
21
19
 
20
+ /** @typedef {import('stylelint').InternalApi} InternalApi */
21
+
22
22
  /** @typedef {import('webpack').Compiler} Compiler */
23
23
 
24
24
  /** @typedef {import('webpack').Compilation} Compilation */
@@ -40,17 +40,22 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
40
40
  /** @typedef {{[files: string]: LintResult}} LintResultMap */
41
41
 
42
42
  /** @type {WeakMap<Compiler, LintResultMap>} */
43
+
44
+
43
45
  const resultStorage = new WeakMap();
44
46
  /**
45
47
  * @param {string|undefined} key
46
48
  * @param {Options} options
47
49
  * @param {Compilation} compilation
48
- * @returns {{lint: Linter, report: Reporter, threads: number}}
50
+ * @returns {{api: InternalApi, lint: Linter, report: Reporter, threads: number}}
49
51
  */
50
52
 
51
53
  function linter(key, options, compilation) {
52
54
  /** @type {Stylelint} */
53
55
  let stylelint;
56
+ /** @type {InternalApi} */
57
+
58
+ let api;
54
59
  /** @type {(files: string|string[]) => Promise<LintResult[]>} */
55
60
 
56
61
  let lintFiles;
@@ -68,16 +73,18 @@ function linter(key, options, compilation) {
68
73
  try {
69
74
  ({
70
75
  stylelint,
76
+ api,
71
77
  lintFiles,
72
78
  cleanup,
73
79
  threads
74
- } = (0, _getStylelint.default)(key, options));
80
+ } = getStylelint(key, options));
75
81
  } catch (e) {
76
- throw new _StylelintError.default(e.message);
82
+ throw new StylelintError(e.message);
77
83
  }
78
84
 
79
85
  return {
80
86
  lint,
87
+ api,
81
88
  report,
82
89
  threads
83
90
  };
@@ -86,7 +93,7 @@ function linter(key, options, compilation) {
86
93
  */
87
94
 
88
95
  function lint(files) {
89
- for (const file of (0, _utils.arrify)(files)) {
96
+ for (const file of arrify(files)) {
90
97
  delete crossRunResultStorage[file];
91
98
  }
92
99
 
@@ -147,7 +154,7 @@ function linter(key, options, compilation) {
147
154
  } = compiler.outputFileSystem; // ensure directory exists
148
155
  // @ts-ignore - the types for `outputFileSystem` are missing the 3 arg overload
149
156
 
150
- mkdir((0, _path.dirname)(name), {
157
+ mkdir(dirname(name), {
151
158
  recursive: true
152
159
  }, err => {
153
160
  /* istanbul ignore if */
@@ -167,8 +174,8 @@ function linter(key, options, compilation) {
167
174
  filePath
168
175
  } = outputReport;
169
176
 
170
- if (!(0, _path.isAbsolute)(filePath)) {
171
- filePath = (0, _path.join)(compiler.outputPath, filePath);
177
+ if (!isAbsolute(filePath)) {
178
+ filePath = join(compiler.outputPath, filePath);
172
179
  }
173
180
 
174
181
  await save(filePath, content);
@@ -187,11 +194,11 @@ function formatResults(formatter, results) {
187
194
  let warnings;
188
195
 
189
196
  if (results.warnings.length > 0) {
190
- warnings = new _StylelintError.default(formatter(results.warnings));
197
+ warnings = new StylelintError(formatter(results.warnings));
191
198
  }
192
199
 
193
200
  if (results.errors.length > 0) {
194
- errors = new _StylelintError.default(formatter(results.errors));
201
+ errors = new StylelintError(formatter(results.errors));
195
202
  }
196
203
 
197
204
  return {
@@ -295,4 +302,6 @@ function getResultStorage({
295
302
  }
296
303
 
297
304
  return storage;
298
- }
305
+ }
306
+
307
+ module.exports = linter;
package/dist/options.js CHANGED
@@ -1,19 +1,10 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getOptions = getOptions;
7
- exports.getStylelintOptions = getStylelintOptions;
8
-
9
- var _schemaUtils = require("schema-utils");
10
-
11
- var _options = _interopRequireDefault(require("./options.json"));
12
-
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
-
15
- // @ts-ignore
3
+ const {
4
+ validate
5
+ } = require('schema-utils');
16
6
 
7
+ const schema = require('./options.json');
17
8
  /** @typedef {import("stylelint")} stylelint */
18
9
 
19
10
  /** @typedef {import("stylelint").LinterOptions} StylelintOptions */
@@ -50,6 +41,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
50
41
  * @param {Options} pluginOptions
51
42
  * @returns {Partial<PluginOptions>}
52
43
  */
44
+
45
+
53
46
  function getOptions(pluginOptions) {
54
47
  const options = {
55
48
  extensions: ['css', 'scss', 'sass'],
@@ -63,7 +56,7 @@ function getOptions(pluginOptions) {
63
56
  } : {})
64
57
  }; // @ts-ignore
65
58
 
66
- (0, _schemaUtils.validate)(_options.default, options, {
59
+ validate(schema, options, {
67
60
  name: 'Stylelint Webpack Plugin',
68
61
  baseDataPath: 'options'
69
62
  });
@@ -83,7 +76,7 @@ function getStylelintOptions(pluginOptions) {
83
76
  files,
84
77
  formatter,
85
78
  ...stylelintOnlyOptions
86
- } = _options.default.properties; // No need to guard the for-in because schema.properties has hardcoded keys.
79
+ } = schema.properties; // No need to guard the for-in because schema.properties has hardcoded keys.
87
80
  // eslint-disable-next-line guard-for-in
88
81
 
89
82
  for (const option in stylelintOnlyOptions) {
@@ -92,4 +85,9 @@ function getStylelintOptions(pluginOptions) {
92
85
  }
93
86
 
94
87
  return stylelintOptions;
95
- }
88
+ }
89
+
90
+ module.exports = {
91
+ getOptions,
92
+ getStylelintOptions
93
+ };
package/dist/utils.js CHANGED
@@ -1,23 +1,14 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.arrify = arrify;
7
- exports.jsonStringifyReplacerSortKeys = void 0;
8
- exports.parseFiles = parseFiles;
9
- exports.parseFoldersToGlobs = parseFoldersToGlobs;
3
+ const {
4
+ resolve
5
+ } = require('path');
10
6
 
11
- var _path = require("path");
12
-
13
- var _fs = require("fs");
14
-
15
- var _normalizePath = _interopRequireDefault(require("normalize-path"));
16
-
17
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
-
19
- // @ts-ignore
7
+ const {
8
+ statSync
9
+ } = require('fs');
20
10
 
11
+ const normalizePath = require('normalize-path');
21
12
  /**
22
13
  * @template T
23
14
  * @param {T} value
@@ -35,6 +26,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
35
26
  */
36
27
 
37
28
  /* istanbul ignore next */
29
+
30
+
38
31
  function arrify(value) {
39
32
  // eslint-disable-next-line no-undefined
40
33
  if (value === null || value === undefined) {
@@ -71,7 +64,7 @@ function arrify(value) {
71
64
  function parseFiles(files, context) {
72
65
  return arrify(files).map((
73
66
  /** @type {string} */
74
- file) => (0, _normalizePath.default)((0, _path.resolve)(context, file)));
67
+ file) => normalizePath(resolve(context, file)));
75
68
  }
76
69
  /**
77
70
  * @param {string|string[]} patterns
@@ -91,7 +84,7 @@ function parseFoldersToGlobs(patterns, extensions = []) {
91
84
  pattern) => {
92
85
  try {
93
86
  // The patterns are absolute because they are prepended with the context.
94
- const stats = (0, _fs.statSync)(pattern);
87
+ const stats = statSync(pattern);
95
88
  /* istanbul ignore else */
96
89
 
97
90
  if (stats.isDirectory()) {
@@ -124,4 +117,9 @@ const jsonStringifyReplacerSortKeys = (_, value) => {
124
117
  return value instanceof Object && !(value instanceof Array) ? Object.keys(value).sort().reduce(insert, {}) : value;
125
118
  };
126
119
 
127
- exports.jsonStringifyReplacerSortKeys = jsonStringifyReplacerSortKeys;
120
+ module.exports = {
121
+ arrify,
122
+ parseFiles,
123
+ parseFoldersToGlobs,
124
+ jsonStringifyReplacerSortKeys
125
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stylelint-webpack-plugin",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "description": "A Stylelint plugin for webpack",
5
5
  "license": "MIT",
6
6
  "repository": "webpack-contrib/stylelint-webpack-plugin",
@@ -11,16 +11,16 @@
11
11
  "type": "opencollective",
12
12
  "url": "https://opencollective.com/webpack"
13
13
  },
14
- "main": "dist/cjs.js",
15
- "types": "declarations/index.d.ts",
14
+ "main": "dist/index.js",
15
+ "types": "types/index.d.ts",
16
16
  "engines": {
17
17
  "node": ">= 12.13.0"
18
18
  },
19
19
  "scripts": {
20
20
  "start": "npm run build -- -w",
21
- "clean": "del-cli dist declarations",
21
+ "clean": "del-cli dist types",
22
22
  "prebuild": "npm run clean",
23
- "build:types": "tsc --declaration --emitDeclarationOnly --outDir declarations && prettier \"declarations/**/*.ts\" --write",
23
+ "build:types": "tsc --declaration --emitDeclarationOnly --outDir types && prettier \"types/**/*.ts\" --write",
24
24
  "build:code": "cross-env NODE_ENV=production babel src -d dist --copy-files",
25
25
  "build": "npm-run-all -p \"build:**\"",
26
26
  "commitlint": "commitlint --from=master",
@@ -39,51 +39,51 @@
39
39
  },
40
40
  "files": [
41
41
  "dist",
42
- "declarations"
42
+ "types"
43
43
  ],
44
44
  "peerDependencies": {
45
45
  "stylelint": "^13.0.0 || ^14.0.0",
46
46
  "webpack": "^5.0.0"
47
47
  },
48
48
  "dependencies": {
49
- "jest-worker": "^27.3.1",
50
- "globby": "^11.0.4",
49
+ "jest-worker": "^27.5.1",
50
+ "globby": "^11.1.0",
51
51
  "micromatch": "^4.0.4",
52
52
  "normalize-path": "^3.0.0",
53
53
  "schema-utils": "^4.0.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@babel/cli": "^7.16.0",
57
- "@babel/core": "^7.16.0",
58
- "@babel/preset-env": "^7.16.4",
59
- "@commitlint/cli": "^15.0.0",
60
- "@commitlint/config-conventional": "^15.0.0",
56
+ "@babel/cli": "^7.17.6",
57
+ "@babel/core": "^7.17.7",
58
+ "@babel/preset-env": "^7.16.11",
59
+ "@commitlint/cli": "^16.2.3",
60
+ "@commitlint/config-conventional": "^16.2.1",
61
61
  "@types/fs-extra": "^9.0.13",
62
62
  "@types/micromatch": "^4.0.2",
63
63
  "@types/normalize-path": "^3.0.0",
64
64
  "@types/webpack": "^5.28.0",
65
65
  "@webpack-contrib/eslint-config-webpack": "^3.0.0",
66
66
  "babel-eslint": "^10.1.0",
67
- "babel-jest": "^27.3.1",
67
+ "babel-jest": "^27.5.1",
68
68
  "chokidar": "^3.5.2",
69
69
  "cross-env": "^7.0.3",
70
70
  "del": "^6.0.0",
71
71
  "del-cli": "^4.0.1",
72
- "eslint": "^8.3.0",
73
- "eslint-config-prettier": "^8.3.0",
74
- "eslint-plugin-import": "^2.25.3",
72
+ "eslint": "^8.11.0",
73
+ "eslint-config-prettier": "^8.5.0",
74
+ "eslint-plugin-import": "^2.25.4",
75
75
  "file-loader": "^6.2.0",
76
- "fs-extra": "^10.0.0",
76
+ "fs-extra": "^10.0.1",
77
77
  "husky": "^7.0.4",
78
- "jest": "^27.3.1",
79
- "lint-staged": "^12.1.2",
78
+ "jest": "^27.5.1",
79
+ "lint-staged": "^12.3.6",
80
80
  "npm-run-all": "^4.1.5",
81
- "postcss-scss": "^4.0.2",
82
- "prettier": "^2.4.1",
81
+ "postcss-scss": "^4.0.3",
82
+ "prettier": "^2.6.0",
83
83
  "standard-version": "^9.3.2",
84
- "stylelint": "^14.1.0",
85
- "typescript": "^4.5.2",
86
- "webpack": "^5.64.3"
84
+ "stylelint": "^14.6.0",
85
+ "typescript": "^4.6.2",
86
+ "webpack": "^5.70.0"
87
87
  },
88
88
  "keywords": [
89
89
  "stylelint",
@@ -0,0 +1,8 @@
1
+ export = StylelintError;
2
+ declare class StylelintError extends Error {
3
+ /**
4
+ * @param {string=} messages
5
+ */
6
+ constructor(messages?: string | undefined);
7
+ stack: string;
8
+ }
@@ -1,14 +1,34 @@
1
1
  /// <reference types="stylelint" />
2
+ export = getStylelint;
2
3
  /**
3
4
  * @param {string|undefined} key
4
5
  * @param {Options} options
5
6
  * @returns {Linter}
6
7
  */
7
- export default function getStylelint(
8
+ declare function getStylelint(
8
9
  key: string | undefined,
9
10
  { threads, ...options }: Options
10
11
  ): Linter;
11
- export type Stylelint = import('postcss').PluginCreator<
12
+ declare namespace getStylelint {
13
+ export {
14
+ Stylelint,
15
+ LintResult,
16
+ Options,
17
+ AsyncTask,
18
+ LintTask,
19
+ Linter,
20
+ Worker,
21
+ };
22
+ }
23
+ type Options = import('./options').Options;
24
+ type Linter = {
25
+ api: import('stylelint').InternalApi;
26
+ stylelint: Stylelint;
27
+ lintFiles: LintTask;
28
+ cleanup: AsyncTask;
29
+ threads: number;
30
+ };
31
+ type Stylelint = import('postcss').PluginCreator<
12
32
  import('stylelint').PostcssPluginOptions
13
33
  > & {
14
34
  lint: (
@@ -30,6 +50,15 @@ export type Stylelint = import('postcss').PluginCreator<
30
50
  createLinter: (
31
51
  options: import('stylelint').LinterOptions
32
52
  ) => import('stylelint').InternalApi;
53
+ resolveConfig: (
54
+ filePath: string,
55
+ options?:
56
+ | Pick<
57
+ import('stylelint').LinterOptions,
58
+ 'cwd' | 'config' | 'configFile' | 'configBasedir'
59
+ >
60
+ | undefined
61
+ ) => Promise<import('stylelint').Config | undefined>;
33
62
  utils: {
34
63
  report: (problem: import('stylelint').Problem) => void;
35
64
  ruleMessages: <
@@ -54,16 +83,9 @@ export type Stylelint = import('postcss').PluginCreator<
54
83
  ) => void;
55
84
  };
56
85
  };
57
- export type LintResult = import('stylelint').LintResult;
58
- export type Options = import('./options').Options;
59
- export type AsyncTask = () => Promise<void>;
60
- export type LintTask = (files: string | string[]) => Promise<LintResult[]>;
61
- export type Linter = {
62
- stylelint: Stylelint;
63
- lintFiles: LintTask;
64
- cleanup: AsyncTask;
65
- threads: number;
66
- };
67
- export type Worker = import('jest-worker').Worker & {
86
+ type LintResult = import('stylelint').LintResult;
87
+ type AsyncTask = () => Promise<void>;
88
+ type LintTask = (files: string | string[]) => Promise<LintResult[]>;
89
+ type Worker = import('jest-worker').Worker & {
68
90
  lintFiles: LintTask;
69
91
  };
@@ -1,13 +1,4 @@
1
- export default StylelintWebpackPlugin;
2
- export type Compiler = import('webpack').Compiler;
3
- export type Module = import('webpack').Module;
4
- export type Options = import('./options').Options;
5
- export type FileSystemInfoEntry = Partial<
6
- | {
7
- timestamp: number;
8
- }
9
- | number
10
- >;
1
+ export = StylelintWebpackPlugin;
11
2
  declare class StylelintWebpackPlugin {
12
3
  /**
13
4
  * @param {Options} options
@@ -33,3 +24,15 @@ declare class StylelintWebpackPlugin {
33
24
  */
34
25
  getContext(compiler: Compiler): string;
35
26
  }
27
+ declare namespace StylelintWebpackPlugin {
28
+ export { Compiler, Module, Options, FileSystemInfoEntry };
29
+ }
30
+ type Compiler = import('webpack').Compiler;
31
+ type Options = import('./options').Options;
32
+ type Module = import('webpack').Module;
33
+ type FileSystemInfoEntry = Partial<
34
+ | {
35
+ timestamp: number;
36
+ }
37
+ | number
38
+ >;
@@ -1,20 +1,44 @@
1
1
  /// <reference types="stylelint" />
2
+ export = linter;
2
3
  /**
3
4
  * @param {string|undefined} key
4
5
  * @param {Options} options
5
6
  * @param {Compilation} compilation
6
- * @returns {{lint: Linter, report: Reporter, threads: number}}
7
+ * @returns {{api: InternalApi, lint: Linter, report: Reporter, threads: number}}
7
8
  */
8
- export default function linter(
9
+ declare function linter(
9
10
  key: string | undefined,
10
11
  options: Options,
11
12
  compilation: Compilation
12
13
  ): {
14
+ api: InternalApi;
13
15
  lint: Linter;
14
16
  report: Reporter;
15
17
  threads: number;
16
18
  };
17
- export type Stylelint = import('postcss').PluginCreator<
19
+ declare namespace linter {
20
+ export {
21
+ Stylelint,
22
+ LintResult,
23
+ InternalApi,
24
+ Compiler,
25
+ Compilation,
26
+ Options,
27
+ FormatterType,
28
+ FormatterFunction,
29
+ GenerateReport,
30
+ Report,
31
+ Reporter,
32
+ Linter,
33
+ LintResultMap,
34
+ };
35
+ }
36
+ type Options = import('./options').Options;
37
+ type Compilation = import('webpack').Compilation;
38
+ type InternalApi = import('stylelint').InternalApi;
39
+ type Linter = (files: string | string[]) => void;
40
+ type Reporter = () => Promise<Report>;
41
+ type Stylelint = import('postcss').PluginCreator<
18
42
  import('stylelint').PostcssPluginOptions
19
43
  > & {
20
44
  lint: (
@@ -36,6 +60,15 @@ export type Stylelint = import('postcss').PluginCreator<
36
60
  createLinter: (
37
61
  options: import('stylelint').LinterOptions
38
62
  ) => import('stylelint').InternalApi;
63
+ resolveConfig: (
64
+ filePath: string,
65
+ options?:
66
+ | Pick<
67
+ import('stylelint').LinterOptions,
68
+ 'cwd' | 'config' | 'configFile' | 'configBasedir'
69
+ >
70
+ | undefined
71
+ ) => Promise<import('stylelint').Config | undefined>;
39
72
  utils: {
40
73
  report: (problem: import('stylelint').Problem) => void;
41
74
  ruleMessages: <
@@ -60,21 +93,17 @@ export type Stylelint = import('postcss').PluginCreator<
60
93
  ) => void;
61
94
  };
62
95
  };
63
- export type LintResult = import('stylelint').LintResult;
64
- export type Compiler = import('webpack').Compiler;
65
- export type Compilation = import('webpack').Compilation;
66
- export type Options = import('./options').Options;
67
- export type FormatterType = import('./options').FormatterType;
68
- export type FormatterFunction = (results: LintResult[]) => string;
69
- export type GenerateReport = (compilation: Compilation) => Promise<void>;
70
- export type Report = {
96
+ type LintResult = import('stylelint').LintResult;
97
+ type Compiler = import('webpack').Compiler;
98
+ type FormatterType = import('./options').FormatterType;
99
+ type FormatterFunction = (results: LintResult[]) => string;
100
+ type GenerateReport = (compilation: Compilation) => Promise<void>;
101
+ type Report = {
71
102
  errors?: StylelintError;
72
103
  warnings?: StylelintError;
73
104
  generateReportAsset?: GenerateReport;
74
105
  };
75
- export type Reporter = () => Promise<Report>;
76
- export type Linter = (files: string | string[]) => void;
77
- export type LintResultMap = {
106
+ type LintResultMap = {
78
107
  [files: string]: import('stylelint').LintResult;
79
108
  };
80
- import StylelintError from './StylelintError';
109
+ import StylelintError = require('./StylelintError');
@@ -1,42 +1,4 @@
1
1
  /// <reference types="stylelint" />
2
- /** @typedef {import("stylelint")} stylelint */
3
- /** @typedef {import("stylelint").LinterOptions} StylelintOptions */
4
- /** @typedef {import("stylelint").FormatterType} FormatterType */
5
- /**
6
- * @typedef {Object} OutputReport
7
- * @property {string=} filePath
8
- * @property {FormatterType=} formatter
9
- */
10
- /**
11
- * @typedef {Object} PluginOptions
12
- * @property {string} context
13
- * @property {boolean} emitError
14
- * @property {boolean} emitWarning
15
- * @property {string|string[]=} exclude
16
- * @property {string|string[]} extensions
17
- * @property {boolean} failOnError
18
- * @property {boolean} failOnWarning
19
- * @property {string|string[]} files
20
- * @property {FormatterType} formatter
21
- * @property {boolean} lintDirtyModulesOnly
22
- * @property {boolean} quiet
23
- * @property {string} stylelintPath
24
- * @property {OutputReport} outputReport
25
- * @property {number|boolean=} threads
26
- */
27
- /** @typedef {Partial<PluginOptions & StylelintOptions>} Options */
28
- /**
29
- * @param {Options} pluginOptions
30
- * @returns {Partial<PluginOptions>}
31
- */
32
- export function getOptions(pluginOptions: Options): Partial<PluginOptions>;
33
- /**
34
- * @param {Options} pluginOptions
35
- * @returns {Partial<StylelintOptions>}
36
- */
37
- export function getStylelintOptions(
38
- pluginOptions: Options
39
- ): Partial<StylelintOptions>;
40
2
  export type stylelint = import('postcss').PluginCreator<
41
3
  import('stylelint').PostcssPluginOptions
42
4
  > & {
@@ -59,6 +21,15 @@ export type stylelint = import('postcss').PluginCreator<
59
21
  createLinter: (
60
22
  options: import('stylelint').LinterOptions
61
23
  ) => import('stylelint').InternalApi;
24
+ resolveConfig: (
25
+ filePath: string,
26
+ options?:
27
+ | Pick<
28
+ import('stylelint').LinterOptions,
29
+ 'cwd' | 'config' | 'configFile' | 'configBasedir'
30
+ >
31
+ | undefined
32
+ ) => Promise<import('stylelint').Config | undefined>;
62
33
  utils: {
63
34
  report: (problem: import('stylelint').Problem) => void;
64
35
  ruleMessages: <
@@ -106,3 +77,41 @@ export type PluginOptions = {
106
77
  threads?: (number | boolean) | undefined;
107
78
  };
108
79
  export type Options = Partial<PluginOptions & StylelintOptions>;
80
+ /** @typedef {import("stylelint")} stylelint */
81
+ /** @typedef {import("stylelint").LinterOptions} StylelintOptions */
82
+ /** @typedef {import("stylelint").FormatterType} FormatterType */
83
+ /**
84
+ * @typedef {Object} OutputReport
85
+ * @property {string=} filePath
86
+ * @property {FormatterType=} formatter
87
+ */
88
+ /**
89
+ * @typedef {Object} PluginOptions
90
+ * @property {string} context
91
+ * @property {boolean} emitError
92
+ * @property {boolean} emitWarning
93
+ * @property {string|string[]=} exclude
94
+ * @property {string|string[]} extensions
95
+ * @property {boolean} failOnError
96
+ * @property {boolean} failOnWarning
97
+ * @property {string|string[]} files
98
+ * @property {FormatterType} formatter
99
+ * @property {boolean} lintDirtyModulesOnly
100
+ * @property {boolean} quiet
101
+ * @property {string} stylelintPath
102
+ * @property {OutputReport} outputReport
103
+ * @property {number|boolean=} threads
104
+ */
105
+ /** @typedef {Partial<PluginOptions & StylelintOptions>} Options */
106
+ /**
107
+ * @param {Options} pluginOptions
108
+ * @returns {Partial<PluginOptions>}
109
+ */
110
+ export function getOptions(pluginOptions: Options): Partial<PluginOptions>;
111
+ /**
112
+ * @param {Options} pluginOptions
113
+ * @returns {Partial<StylelintOptions>}
114
+ */
115
+ export function getStylelintOptions(
116
+ pluginOptions: Options
117
+ ): Partial<StylelintOptions>;
@@ -39,4 +39,9 @@ export function parseFoldersToGlobs(
39
39
  patterns: string | string[],
40
40
  extensions?: string | string[]
41
41
  ): string[];
42
+ /**
43
+ *
44
+ * @param {string} _ key, but unused
45
+ * @param {any} value
46
+ */
42
47
  export function jsonStringifyReplacerSortKeys(_: string, value: any): any;
@@ -21,6 +21,15 @@ export type Stylelint = import('postcss').PluginCreator<
21
21
  createLinter: (
22
22
  options: import('stylelint').LinterOptions
23
23
  ) => import('stylelint').InternalApi;
24
+ resolveConfig: (
25
+ filePath: string,
26
+ options?:
27
+ | Pick<
28
+ import('stylelint').LinterOptions,
29
+ 'cwd' | 'config' | 'configFile' | 'configBasedir'
30
+ >
31
+ | undefined
32
+ ) => Promise<import('stylelint').Config | undefined>;
24
33
  utils: {
25
34
  report: (problem: import('stylelint').Problem) => void;
26
35
  ruleMessages: <
@@ -1,2 +0,0 @@
1
- export default StylelintError;
2
- declare class StylelintError extends Error {}
@@ -1,3 +0,0 @@
1
- declare const _exports: typeof plugin.default;
2
- export = _exports;
3
- import plugin = require('./index');
package/dist/cjs.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- const plugin = require('./index');
4
-
5
- module.exports = plugin.default;