@umijs/bundler-webpack 4.0.0-rc.1 → 4.0.0-rc.2
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/compiled/autoprefixer/browserslist/index.d.ts +4 -0
- package/compiled/autoprefixer/index.js +3 -3
- package/compiled/autoprefixer/postcss/lib/at-rule.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/comment.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/declaration.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/rule.d.ts +1 -1
- package/compiled/autoprefixer/source-map-js/source-map.d.ts +99 -82
- package/compiled/copy-webpack-plugin/576.index.js +1171 -0
- package/compiled/copy-webpack-plugin/index.js +16 -10
- package/compiled/copy-webpack-plugin/package.json +1 -1
- package/compiled/css-minimizer-webpack-plugin/index.js +8 -2
- package/compiled/css-minimizer-webpack-plugin/minify.js +25 -11
- package/compiled/css-minimizer-webpack-plugin/package.json +1 -1
- package/compiled/css-minimizer-webpack-plugin/utils.js +225 -28
- package/compiled/cssnano/index.js +12 -11
- package/compiled/express/index.js +57 -74
- package/compiled/fork-ts-checker-webpack-plugin/index.js +14 -15
- package/compiled/http-proxy-middleware/dist/types.d.ts +5 -5
- package/compiled/http-proxy-middleware/http-proxy/index.d.ts +1 -1
- package/compiled/http-proxy-middleware/index.js +10 -10
- package/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js +60 -8
- package/compiled/mini-css-extract-plugin/hmr/normalize-url.js +13 -1
- package/compiled/mini-css-extract-plugin/index.js +4427 -3979
- package/compiled/mini-css-extract-plugin/loader.js +177 -54
- package/compiled/mini-css-extract-plugin/package.json +1 -1
- package/compiled/mini-css-extract-plugin/utils.js +77 -23
- package/compiled/sass-loader/index.js +1 -1
- package/compiled/terser-webpack-plugin/index.js +296 -297
- package/compiled/terser-webpack-plugin/minify.js +4 -2
- package/compiled/terser-webpack-plugin/package.json +1 -1
- package/compiled/terser-webpack-plugin/types/index.d.ts +180 -146
- package/compiled/terser-webpack-plugin/types/minify.d.ts +17 -0
- package/compiled/terser-webpack-plugin/types/utils.d.ts +1 -3
- package/compiled/terser-webpack-plugin/utils.js +9 -12
- package/compiled/webpack/index.js +8652 -3904
- package/compiled/webpack-dev-middleware/index.js +7 -7
- package/compiled/webpack-dev-middleware/package.json +1 -1
- package/compiled/webpack-manifest-plugin/index.js +1 -1
- package/compiled/webpack-sources/index.js +1 -1
- package/compiled/ws/index.d.ts +1 -2
- package/compiled/ws/index.js +1 -1
- package/dist/build.d.ts +2 -1
- package/dist/build.js +1 -1
- package/dist/config/config.js +4 -3
- package/dist/config/detectDeadCode.d.ts +12 -0
- package/dist/config/detectDeadCode.js +120 -0
- package/dist/config/detectDeadCodePlugin.d.ts +9 -0
- package/dist/config/detectDeadCodePlugin.js +71 -0
- package/dist/config/javaScriptRules.js +3 -6
- package/dist/constants.d.ts +3 -0
- package/dist/constants.js +4 -1
- package/dist/dev.d.ts +1 -0
- package/dist/dev.js +7 -5
- package/dist/loader/swc.js +14 -18
- package/dist/requireHook.js +1 -1
- package/dist/schema.js +2 -0
- package/dist/swcPlugins/autoCSSModules.d.ts +7 -2
- package/dist/swcPlugins/autoCSSModules.js +11 -16
- package/dist/types.d.ts +9 -12
- package/dist/utils/depMatch.js +1 -1
- package/package.json +31 -31
- package/dist/esbuildHandler/autoCssModules.d.ts +0 -2
- package/dist/esbuildHandler/autoCssModules.js +0 -23
- package/dist/loader/esbuild.d.ts +0 -5
- package/dist/loader/esbuild.js +0 -53
|
@@ -0,0 +1,1171 @@
|
|
|
1
|
+
exports.id = 576;
|
|
2
|
+
exports.ids = [576];
|
|
3
|
+
exports.modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 1199:
|
|
6
|
+
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
|
|
10
|
+
const path = __webpack_require__(1017);
|
|
11
|
+
const pathType = __webpack_require__(6163);
|
|
12
|
+
|
|
13
|
+
const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0];
|
|
14
|
+
|
|
15
|
+
const getPath = (filepath, cwd) => {
|
|
16
|
+
const pth = filepath[0] === '!' ? filepath.slice(1) : filepath;
|
|
17
|
+
return path.isAbsolute(pth) ? pth : path.join(cwd, pth);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const addExtensions = (file, extensions) => {
|
|
21
|
+
if (path.extname(file)) {
|
|
22
|
+
return `**/${file}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return `**/${file}.${getExtensions(extensions)}`;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const getGlob = (directory, options) => {
|
|
29
|
+
if (options.files && !Array.isArray(options.files)) {
|
|
30
|
+
throw new TypeError(`Expected \`files\` to be of type \`Array\` but received type \`${typeof options.files}\``);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (options.extensions && !Array.isArray(options.extensions)) {
|
|
34
|
+
throw new TypeError(`Expected \`extensions\` to be of type \`Array\` but received type \`${typeof options.extensions}\``);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (options.files && options.extensions) {
|
|
38
|
+
return options.files.map(x => path.posix.join(directory, addExtensions(x, options.extensions)));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (options.files) {
|
|
42
|
+
return options.files.map(x => path.posix.join(directory, `**/${x}`));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (options.extensions) {
|
|
46
|
+
return [path.posix.join(directory, `**/*.${getExtensions(options.extensions)}`)];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return [path.posix.join(directory, '**')];
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
module.exports = async (input, options) => {
|
|
53
|
+
options = {
|
|
54
|
+
cwd: process.cwd(),
|
|
55
|
+
...options
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
if (typeof options.cwd !== 'string') {
|
|
59
|
+
throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const globs = await Promise.all([].concat(input).map(async x => {
|
|
63
|
+
const isDirectory = await pathType.isDirectory(getPath(x, options.cwd));
|
|
64
|
+
return isDirectory ? getGlob(x, options) : x;
|
|
65
|
+
}));
|
|
66
|
+
|
|
67
|
+
return [].concat.apply([], globs); // eslint-disable-line prefer-spread
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
module.exports.sync = (input, options) => {
|
|
71
|
+
options = {
|
|
72
|
+
cwd: process.cwd(),
|
|
73
|
+
...options
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
if (typeof options.cwd !== 'string') {
|
|
77
|
+
throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const globs = [].concat(input).map(x => pathType.isDirectorySync(getPath(x, options.cwd)) ? getGlob(x, options) : x);
|
|
81
|
+
|
|
82
|
+
return [].concat.apply([], globs); // eslint-disable-line prefer-spread
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
/***/ }),
|
|
87
|
+
|
|
88
|
+
/***/ 6339:
|
|
89
|
+
/***/ (function(module) {
|
|
90
|
+
|
|
91
|
+
// A simple implementation of make-array
|
|
92
|
+
function makeArray (subject) {
|
|
93
|
+
return Array.isArray(subject)
|
|
94
|
+
? subject
|
|
95
|
+
: [subject]
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const EMPTY = ''
|
|
99
|
+
const SPACE = ' '
|
|
100
|
+
const ESCAPE = '\\'
|
|
101
|
+
const REGEX_TEST_BLANK_LINE = /^\s+$/
|
|
102
|
+
const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/
|
|
103
|
+
const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/
|
|
104
|
+
const REGEX_SPLITALL_CRLF = /\r?\n/g
|
|
105
|
+
// /foo,
|
|
106
|
+
// ./foo,
|
|
107
|
+
// ../foo,
|
|
108
|
+
// .
|
|
109
|
+
// ..
|
|
110
|
+
const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/
|
|
111
|
+
|
|
112
|
+
const SLASH = '/'
|
|
113
|
+
const KEY_IGNORE = typeof Symbol !== 'undefined'
|
|
114
|
+
? Symbol.for('node-ignore')
|
|
115
|
+
/* istanbul ignore next */
|
|
116
|
+
: 'node-ignore'
|
|
117
|
+
|
|
118
|
+
const define = (object, key, value) =>
|
|
119
|
+
Object.defineProperty(object, key, {value})
|
|
120
|
+
|
|
121
|
+
const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g
|
|
122
|
+
|
|
123
|
+
const RETURN_FALSE = () => false
|
|
124
|
+
|
|
125
|
+
// Sanitize the range of a regular expression
|
|
126
|
+
// The cases are complicated, see test cases for details
|
|
127
|
+
const sanitizeRange = range => range.replace(
|
|
128
|
+
REGEX_REGEXP_RANGE,
|
|
129
|
+
(match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0)
|
|
130
|
+
? match
|
|
131
|
+
// Invalid range (out of order) which is ok for gitignore rules but
|
|
132
|
+
// fatal for JavaScript regular expression, so eliminate it.
|
|
133
|
+
: EMPTY
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
// See fixtures #59
|
|
137
|
+
const cleanRangeBackSlash = slashes => {
|
|
138
|
+
const {length} = slashes
|
|
139
|
+
return slashes.slice(0, length - length % 2)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// > If the pattern ends with a slash,
|
|
143
|
+
// > it is removed for the purpose of the following description,
|
|
144
|
+
// > but it would only find a match with a directory.
|
|
145
|
+
// > In other words, foo/ will match a directory foo and paths underneath it,
|
|
146
|
+
// > but will not match a regular file or a symbolic link foo
|
|
147
|
+
// > (this is consistent with the way how pathspec works in general in Git).
|
|
148
|
+
// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
|
|
149
|
+
// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
|
|
150
|
+
// you could use option `mark: true` with `glob`
|
|
151
|
+
|
|
152
|
+
// '`foo/`' should not continue with the '`..`'
|
|
153
|
+
const REPLACERS = [
|
|
154
|
+
|
|
155
|
+
// > Trailing spaces are ignored unless they are quoted with backslash ("\")
|
|
156
|
+
[
|
|
157
|
+
// (a\ ) -> (a )
|
|
158
|
+
// (a ) -> (a)
|
|
159
|
+
// (a \ ) -> (a )
|
|
160
|
+
/\\?\s+$/,
|
|
161
|
+
match => match.indexOf('\\') === 0
|
|
162
|
+
? SPACE
|
|
163
|
+
: EMPTY
|
|
164
|
+
],
|
|
165
|
+
|
|
166
|
+
// replace (\ ) with ' '
|
|
167
|
+
[
|
|
168
|
+
/\\\s/g,
|
|
169
|
+
() => SPACE
|
|
170
|
+
],
|
|
171
|
+
|
|
172
|
+
// Escape metacharacters
|
|
173
|
+
// which is written down by users but means special for regular expressions.
|
|
174
|
+
|
|
175
|
+
// > There are 12 characters with special meanings:
|
|
176
|
+
// > - the backslash \,
|
|
177
|
+
// > - the caret ^,
|
|
178
|
+
// > - the dollar sign $,
|
|
179
|
+
// > - the period or dot .,
|
|
180
|
+
// > - the vertical bar or pipe symbol |,
|
|
181
|
+
// > - the question mark ?,
|
|
182
|
+
// > - the asterisk or star *,
|
|
183
|
+
// > - the plus sign +,
|
|
184
|
+
// > - the opening parenthesis (,
|
|
185
|
+
// > - the closing parenthesis ),
|
|
186
|
+
// > - and the opening square bracket [,
|
|
187
|
+
// > - the opening curly brace {,
|
|
188
|
+
// > These special characters are often called "metacharacters".
|
|
189
|
+
[
|
|
190
|
+
/[\\$.|*+(){^]/g,
|
|
191
|
+
match => `\\${match}`
|
|
192
|
+
],
|
|
193
|
+
|
|
194
|
+
[
|
|
195
|
+
// > a question mark (?) matches a single character
|
|
196
|
+
/(?!\\)\?/g,
|
|
197
|
+
() => '[^/]'
|
|
198
|
+
],
|
|
199
|
+
|
|
200
|
+
// leading slash
|
|
201
|
+
[
|
|
202
|
+
|
|
203
|
+
// > A leading slash matches the beginning of the pathname.
|
|
204
|
+
// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
|
|
205
|
+
// A leading slash matches the beginning of the pathname
|
|
206
|
+
/^\//,
|
|
207
|
+
() => '^'
|
|
208
|
+
],
|
|
209
|
+
|
|
210
|
+
// replace special metacharacter slash after the leading slash
|
|
211
|
+
[
|
|
212
|
+
/\//g,
|
|
213
|
+
() => '\\/'
|
|
214
|
+
],
|
|
215
|
+
|
|
216
|
+
[
|
|
217
|
+
// > A leading "**" followed by a slash means match in all directories.
|
|
218
|
+
// > For example, "**/foo" matches file or directory "foo" anywhere,
|
|
219
|
+
// > the same as pattern "foo".
|
|
220
|
+
// > "**/foo/bar" matches file or directory "bar" anywhere that is directly
|
|
221
|
+
// > under directory "foo".
|
|
222
|
+
// Notice that the '*'s have been replaced as '\\*'
|
|
223
|
+
/^\^*\\\*\\\*\\\//,
|
|
224
|
+
|
|
225
|
+
// '**/foo' <-> 'foo'
|
|
226
|
+
() => '^(?:.*\\/)?'
|
|
227
|
+
],
|
|
228
|
+
|
|
229
|
+
// starting
|
|
230
|
+
[
|
|
231
|
+
// there will be no leading '/'
|
|
232
|
+
// (which has been replaced by section "leading slash")
|
|
233
|
+
// If starts with '**', adding a '^' to the regular expression also works
|
|
234
|
+
/^(?=[^^])/,
|
|
235
|
+
function startingReplacer () {
|
|
236
|
+
// If has a slash `/` at the beginning or middle
|
|
237
|
+
return !/\/(?!$)/.test(this)
|
|
238
|
+
// > Prior to 2.22.1
|
|
239
|
+
// > If the pattern does not contain a slash /,
|
|
240
|
+
// > Git treats it as a shell glob pattern
|
|
241
|
+
// Actually, if there is only a trailing slash,
|
|
242
|
+
// git also treats it as a shell glob pattern
|
|
243
|
+
|
|
244
|
+
// After 2.22.1 (compatible but clearer)
|
|
245
|
+
// > If there is a separator at the beginning or middle (or both)
|
|
246
|
+
// > of the pattern, then the pattern is relative to the directory
|
|
247
|
+
// > level of the particular .gitignore file itself.
|
|
248
|
+
// > Otherwise the pattern may also match at any level below
|
|
249
|
+
// > the .gitignore level.
|
|
250
|
+
? '(?:^|\\/)'
|
|
251
|
+
|
|
252
|
+
// > Otherwise, Git treats the pattern as a shell glob suitable for
|
|
253
|
+
// > consumption by fnmatch(3)
|
|
254
|
+
: '^'
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
|
|
258
|
+
// two globstars
|
|
259
|
+
[
|
|
260
|
+
// Use lookahead assertions so that we could match more than one `'/**'`
|
|
261
|
+
/\\\/\\\*\\\*(?=\\\/|$)/g,
|
|
262
|
+
|
|
263
|
+
// Zero, one or several directories
|
|
264
|
+
// should not use '*', or it will be replaced by the next replacer
|
|
265
|
+
|
|
266
|
+
// Check if it is not the last `'/**'`
|
|
267
|
+
(_, index, str) => index + 6 < str.length
|
|
268
|
+
|
|
269
|
+
// case: /**/
|
|
270
|
+
// > A slash followed by two consecutive asterisks then a slash matches
|
|
271
|
+
// > zero or more directories.
|
|
272
|
+
// > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
|
|
273
|
+
// '/**/'
|
|
274
|
+
? '(?:\\/[^\\/]+)*'
|
|
275
|
+
|
|
276
|
+
// case: /**
|
|
277
|
+
// > A trailing `"/**"` matches everything inside.
|
|
278
|
+
|
|
279
|
+
// #21: everything inside but it should not include the current folder
|
|
280
|
+
: '\\/.+'
|
|
281
|
+
],
|
|
282
|
+
|
|
283
|
+
// intermediate wildcards
|
|
284
|
+
[
|
|
285
|
+
// Never replace escaped '*'
|
|
286
|
+
// ignore rule '\*' will match the path '*'
|
|
287
|
+
|
|
288
|
+
// 'abc.*/' -> go
|
|
289
|
+
// 'abc.*' -> skip this rule
|
|
290
|
+
/(^|[^\\]+)\\\*(?=.+)/g,
|
|
291
|
+
|
|
292
|
+
// '*.js' matches '.js'
|
|
293
|
+
// '*.js' doesn't match 'abc'
|
|
294
|
+
(_, p1) => `${p1}[^\\/]*`
|
|
295
|
+
],
|
|
296
|
+
|
|
297
|
+
[
|
|
298
|
+
// unescape, revert step 3 except for back slash
|
|
299
|
+
// For example, if a user escape a '\\*',
|
|
300
|
+
// after step 3, the result will be '\\\\\\*'
|
|
301
|
+
/\\\\\\(?=[$.|*+(){^])/g,
|
|
302
|
+
() => ESCAPE
|
|
303
|
+
],
|
|
304
|
+
|
|
305
|
+
[
|
|
306
|
+
// '\\\\' -> '\\'
|
|
307
|
+
/\\\\/g,
|
|
308
|
+
() => ESCAPE
|
|
309
|
+
],
|
|
310
|
+
|
|
311
|
+
[
|
|
312
|
+
// > The range notation, e.g. [a-zA-Z],
|
|
313
|
+
// > can be used to match one of the characters in a range.
|
|
314
|
+
|
|
315
|
+
// `\` is escaped by step 3
|
|
316
|
+
/(\\)?\[([^\]/]*?)(\\*)($|\])/g,
|
|
317
|
+
(match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE
|
|
318
|
+
// '\\[bar]' -> '\\\\[bar\\]'
|
|
319
|
+
? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}`
|
|
320
|
+
: close === ']'
|
|
321
|
+
? endEscape.length % 2 === 0
|
|
322
|
+
// A normal case, and it is a range notation
|
|
323
|
+
// '[bar]'
|
|
324
|
+
// '[bar\\\\]'
|
|
325
|
+
? `[${sanitizeRange(range)}${endEscape}]`
|
|
326
|
+
// Invalid range notaton
|
|
327
|
+
// '[bar\\]' -> '[bar\\\\]'
|
|
328
|
+
: '[]'
|
|
329
|
+
: '[]'
|
|
330
|
+
],
|
|
331
|
+
|
|
332
|
+
// ending
|
|
333
|
+
[
|
|
334
|
+
// 'js' will not match 'js.'
|
|
335
|
+
// 'ab' will not match 'abc'
|
|
336
|
+
/(?:[^*])$/,
|
|
337
|
+
|
|
338
|
+
// WTF!
|
|
339
|
+
// https://git-scm.com/docs/gitignore
|
|
340
|
+
// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
|
|
341
|
+
// which re-fixes #24, #38
|
|
342
|
+
|
|
343
|
+
// > If there is a separator at the end of the pattern then the pattern
|
|
344
|
+
// > will only match directories, otherwise the pattern can match both
|
|
345
|
+
// > files and directories.
|
|
346
|
+
|
|
347
|
+
// 'js*' will not match 'a.js'
|
|
348
|
+
// 'js/' will not match 'a.js'
|
|
349
|
+
// 'js' will match 'a.js' and 'a.js/'
|
|
350
|
+
match => /\/$/.test(match)
|
|
351
|
+
// foo/ will not match 'foo'
|
|
352
|
+
? `${match}$`
|
|
353
|
+
// foo matches 'foo' and 'foo/'
|
|
354
|
+
: `${match}(?=$|\\/$)`
|
|
355
|
+
],
|
|
356
|
+
|
|
357
|
+
// trailing wildcard
|
|
358
|
+
[
|
|
359
|
+
/(\^|\\\/)?\\\*$/,
|
|
360
|
+
(_, p1) => {
|
|
361
|
+
const prefix = p1
|
|
362
|
+
// '\^':
|
|
363
|
+
// '/*' does not match EMPTY
|
|
364
|
+
// '/*' does not match everything
|
|
365
|
+
|
|
366
|
+
// '\\\/':
|
|
367
|
+
// 'abc/*' does not match 'abc/'
|
|
368
|
+
? `${p1}[^/]+`
|
|
369
|
+
|
|
370
|
+
// 'a*' matches 'a'
|
|
371
|
+
// 'a*' matches 'aa'
|
|
372
|
+
: '[^/]*'
|
|
373
|
+
|
|
374
|
+
return `${prefix}(?=$|\\/$)`
|
|
375
|
+
}
|
|
376
|
+
],
|
|
377
|
+
]
|
|
378
|
+
|
|
379
|
+
// A simple cache, because an ignore rule only has only one certain meaning
|
|
380
|
+
const regexCache = Object.create(null)
|
|
381
|
+
|
|
382
|
+
// @param {pattern}
|
|
383
|
+
const makeRegex = (pattern, ignoreCase) => {
|
|
384
|
+
let source = regexCache[pattern]
|
|
385
|
+
|
|
386
|
+
if (!source) {
|
|
387
|
+
source = REPLACERS.reduce(
|
|
388
|
+
(prev, current) => prev.replace(current[0], current[1].bind(pattern)),
|
|
389
|
+
pattern
|
|
390
|
+
)
|
|
391
|
+
regexCache[pattern] = source
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
return ignoreCase
|
|
395
|
+
? new RegExp(source, 'i')
|
|
396
|
+
: new RegExp(source)
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
const isString = subject => typeof subject === 'string'
|
|
400
|
+
|
|
401
|
+
// > A blank line matches no files, so it can serve as a separator for readability.
|
|
402
|
+
const checkPattern = pattern => pattern
|
|
403
|
+
&& isString(pattern)
|
|
404
|
+
&& !REGEX_TEST_BLANK_LINE.test(pattern)
|
|
405
|
+
|
|
406
|
+
// > A line starting with # serves as a comment.
|
|
407
|
+
&& pattern.indexOf('#') !== 0
|
|
408
|
+
|
|
409
|
+
const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF)
|
|
410
|
+
|
|
411
|
+
class IgnoreRule {
|
|
412
|
+
constructor (
|
|
413
|
+
origin,
|
|
414
|
+
pattern,
|
|
415
|
+
negative,
|
|
416
|
+
regex
|
|
417
|
+
) {
|
|
418
|
+
this.origin = origin
|
|
419
|
+
this.pattern = pattern
|
|
420
|
+
this.negative = negative
|
|
421
|
+
this.regex = regex
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
const createRule = (pattern, ignoreCase) => {
|
|
426
|
+
const origin = pattern
|
|
427
|
+
let negative = false
|
|
428
|
+
|
|
429
|
+
// > An optional prefix "!" which negates the pattern;
|
|
430
|
+
if (pattern.indexOf('!') === 0) {
|
|
431
|
+
negative = true
|
|
432
|
+
pattern = pattern.substr(1)
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
pattern = pattern
|
|
436
|
+
// > Put a backslash ("\") in front of the first "!" for patterns that
|
|
437
|
+
// > begin with a literal "!", for example, `"\!important!.txt"`.
|
|
438
|
+
.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!')
|
|
439
|
+
// > Put a backslash ("\") in front of the first hash for patterns that
|
|
440
|
+
// > begin with a hash.
|
|
441
|
+
.replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#')
|
|
442
|
+
|
|
443
|
+
const regex = makeRegex(pattern, ignoreCase)
|
|
444
|
+
|
|
445
|
+
return new IgnoreRule(
|
|
446
|
+
origin,
|
|
447
|
+
pattern,
|
|
448
|
+
negative,
|
|
449
|
+
regex
|
|
450
|
+
)
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
const throwError = (message, Ctor) => {
|
|
454
|
+
throw new Ctor(message)
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
const checkPath = (path, originalPath, doThrow) => {
|
|
458
|
+
if (!isString(path)) {
|
|
459
|
+
return doThrow(
|
|
460
|
+
`path must be a string, but got \`${originalPath}\``,
|
|
461
|
+
TypeError
|
|
462
|
+
)
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// We don't know if we should ignore EMPTY, so throw
|
|
466
|
+
if (!path) {
|
|
467
|
+
return doThrow(`path must not be empty`, TypeError)
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// Check if it is a relative path
|
|
471
|
+
if (checkPath.isNotRelative(path)) {
|
|
472
|
+
const r = '`path.relative()`d'
|
|
473
|
+
return doThrow(
|
|
474
|
+
`path should be a ${r} string, but got "${originalPath}"`,
|
|
475
|
+
RangeError
|
|
476
|
+
)
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
return true
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path)
|
|
483
|
+
|
|
484
|
+
checkPath.isNotRelative = isNotRelative
|
|
485
|
+
checkPath.convert = p => p
|
|
486
|
+
|
|
487
|
+
class Ignore {
|
|
488
|
+
constructor ({
|
|
489
|
+
ignorecase = true,
|
|
490
|
+
ignoreCase = ignorecase,
|
|
491
|
+
allowRelativePaths = false
|
|
492
|
+
} = {}) {
|
|
493
|
+
define(this, KEY_IGNORE, true)
|
|
494
|
+
|
|
495
|
+
this._rules = []
|
|
496
|
+
this._ignoreCase = ignoreCase
|
|
497
|
+
this._allowRelativePaths = allowRelativePaths
|
|
498
|
+
this._initCache()
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
_initCache () {
|
|
502
|
+
this._ignoreCache = Object.create(null)
|
|
503
|
+
this._testCache = Object.create(null)
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
_addPattern (pattern) {
|
|
507
|
+
// #32
|
|
508
|
+
if (pattern && pattern[KEY_IGNORE]) {
|
|
509
|
+
this._rules = this._rules.concat(pattern._rules)
|
|
510
|
+
this._added = true
|
|
511
|
+
return
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if (checkPattern(pattern)) {
|
|
515
|
+
const rule = createRule(pattern, this._ignoreCase)
|
|
516
|
+
this._added = true
|
|
517
|
+
this._rules.push(rule)
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// @param {Array<string> | string | Ignore} pattern
|
|
522
|
+
add (pattern) {
|
|
523
|
+
this._added = false
|
|
524
|
+
|
|
525
|
+
makeArray(
|
|
526
|
+
isString(pattern)
|
|
527
|
+
? splitPattern(pattern)
|
|
528
|
+
: pattern
|
|
529
|
+
).forEach(this._addPattern, this)
|
|
530
|
+
|
|
531
|
+
// Some rules have just added to the ignore,
|
|
532
|
+
// making the behavior changed.
|
|
533
|
+
if (this._added) {
|
|
534
|
+
this._initCache()
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
return this
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// legacy
|
|
541
|
+
addPattern (pattern) {
|
|
542
|
+
return this.add(pattern)
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// | ignored : unignored
|
|
546
|
+
// negative | 0:0 | 0:1 | 1:0 | 1:1
|
|
547
|
+
// -------- | ------- | ------- | ------- | --------
|
|
548
|
+
// 0 | TEST | TEST | SKIP | X
|
|
549
|
+
// 1 | TESTIF | SKIP | TEST | X
|
|
550
|
+
|
|
551
|
+
// - SKIP: always skip
|
|
552
|
+
// - TEST: always test
|
|
553
|
+
// - TESTIF: only test if checkUnignored
|
|
554
|
+
// - X: that never happen
|
|
555
|
+
|
|
556
|
+
// @param {boolean} whether should check if the path is unignored,
|
|
557
|
+
// setting `checkUnignored` to `false` could reduce additional
|
|
558
|
+
// path matching.
|
|
559
|
+
|
|
560
|
+
// @returns {TestResult} true if a file is ignored
|
|
561
|
+
_testOne (path, checkUnignored) {
|
|
562
|
+
let ignored = false
|
|
563
|
+
let unignored = false
|
|
564
|
+
|
|
565
|
+
this._rules.forEach(rule => {
|
|
566
|
+
const {negative} = rule
|
|
567
|
+
if (
|
|
568
|
+
unignored === negative && ignored !== unignored
|
|
569
|
+
|| negative && !ignored && !unignored && !checkUnignored
|
|
570
|
+
) {
|
|
571
|
+
return
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
const matched = rule.regex.test(path)
|
|
575
|
+
|
|
576
|
+
if (matched) {
|
|
577
|
+
ignored = !negative
|
|
578
|
+
unignored = negative
|
|
579
|
+
}
|
|
580
|
+
})
|
|
581
|
+
|
|
582
|
+
return {
|
|
583
|
+
ignored,
|
|
584
|
+
unignored
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// @returns {TestResult}
|
|
589
|
+
_test (originalPath, cache, checkUnignored, slices) {
|
|
590
|
+
const path = originalPath
|
|
591
|
+
// Supports nullable path
|
|
592
|
+
&& checkPath.convert(originalPath)
|
|
593
|
+
|
|
594
|
+
checkPath(
|
|
595
|
+
path,
|
|
596
|
+
originalPath,
|
|
597
|
+
this._allowRelativePaths
|
|
598
|
+
? RETURN_FALSE
|
|
599
|
+
: throwError
|
|
600
|
+
)
|
|
601
|
+
|
|
602
|
+
return this._t(path, cache, checkUnignored, slices)
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
_t (path, cache, checkUnignored, slices) {
|
|
606
|
+
if (path in cache) {
|
|
607
|
+
return cache[path]
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
if (!slices) {
|
|
611
|
+
// path/to/a.js
|
|
612
|
+
// ['path', 'to', 'a.js']
|
|
613
|
+
slices = path.split(SLASH)
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
slices.pop()
|
|
617
|
+
|
|
618
|
+
// If the path has no parent directory, just test it
|
|
619
|
+
if (!slices.length) {
|
|
620
|
+
return cache[path] = this._testOne(path, checkUnignored)
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
const parent = this._t(
|
|
624
|
+
slices.join(SLASH) + SLASH,
|
|
625
|
+
cache,
|
|
626
|
+
checkUnignored,
|
|
627
|
+
slices
|
|
628
|
+
)
|
|
629
|
+
|
|
630
|
+
// If the path contains a parent directory, check the parent first
|
|
631
|
+
return cache[path] = parent.ignored
|
|
632
|
+
// > It is not possible to re-include a file if a parent directory of
|
|
633
|
+
// > that file is excluded.
|
|
634
|
+
? parent
|
|
635
|
+
: this._testOne(path, checkUnignored)
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
ignores (path) {
|
|
639
|
+
return this._test(path, this._ignoreCache, false).ignored
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
createFilter () {
|
|
643
|
+
return path => !this.ignores(path)
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
filter (paths) {
|
|
647
|
+
return makeArray(paths).filter(this.createFilter())
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// @returns {TestResult}
|
|
651
|
+
test (path) {
|
|
652
|
+
return this._test(path, this._testCache, true)
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
const factory = options => new Ignore(options)
|
|
657
|
+
|
|
658
|
+
const isPathValid = path =>
|
|
659
|
+
checkPath(path && checkPath.convert(path), path, RETURN_FALSE)
|
|
660
|
+
|
|
661
|
+
factory.isPathValid = isPathValid
|
|
662
|
+
|
|
663
|
+
// Fixes typescript
|
|
664
|
+
factory.default = factory
|
|
665
|
+
|
|
666
|
+
module.exports = factory
|
|
667
|
+
|
|
668
|
+
// Windows
|
|
669
|
+
// --------------------------------------------------------------
|
|
670
|
+
/* istanbul ignore if */
|
|
671
|
+
if (
|
|
672
|
+
// Detect `process` so that it can run in browsers.
|
|
673
|
+
typeof process !== 'undefined'
|
|
674
|
+
&& (
|
|
675
|
+
process.env && process.env.IGNORE_TEST_WIN32
|
|
676
|
+
|| process.platform === 'win32'
|
|
677
|
+
)
|
|
678
|
+
) {
|
|
679
|
+
/* eslint no-control-regex: "off" */
|
|
680
|
+
const makePosix = str => /^\\\\\?\\/.test(str)
|
|
681
|
+
|| /["<>|\u0000-\u001F]+/u.test(str)
|
|
682
|
+
? str
|
|
683
|
+
: str.replace(/\\/g, '/')
|
|
684
|
+
|
|
685
|
+
checkPath.convert = makePosix
|
|
686
|
+
|
|
687
|
+
// 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/'
|
|
688
|
+
// 'd:\\foo'
|
|
689
|
+
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i
|
|
690
|
+
checkPath.isNotRelative = path =>
|
|
691
|
+
REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path)
|
|
692
|
+
|| isNotRelative(path)
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
/***/ }),
|
|
697
|
+
|
|
698
|
+
/***/ 6163:
|
|
699
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
700
|
+
|
|
701
|
+
"use strict";
|
|
702
|
+
|
|
703
|
+
const {promisify} = __webpack_require__(3837);
|
|
704
|
+
const fs = __webpack_require__(7147);
|
|
705
|
+
|
|
706
|
+
async function isType(fsStatType, statsMethodName, filePath) {
|
|
707
|
+
if (typeof filePath !== 'string') {
|
|
708
|
+
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
try {
|
|
712
|
+
const stats = await promisify(fs[fsStatType])(filePath);
|
|
713
|
+
return stats[statsMethodName]();
|
|
714
|
+
} catch (error) {
|
|
715
|
+
if (error.code === 'ENOENT') {
|
|
716
|
+
return false;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
throw error;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
function isTypeSync(fsStatType, statsMethodName, filePath) {
|
|
724
|
+
if (typeof filePath !== 'string') {
|
|
725
|
+
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
try {
|
|
729
|
+
return fs[fsStatType](filePath)[statsMethodName]();
|
|
730
|
+
} catch (error) {
|
|
731
|
+
if (error.code === 'ENOENT') {
|
|
732
|
+
return false;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
throw error;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
exports.isFile = isType.bind(null, 'stat', 'isFile');
|
|
740
|
+
exports.isDirectory = isType.bind(null, 'stat', 'isDirectory');
|
|
741
|
+
exports.isSymlink = isType.bind(null, 'lstat', 'isSymbolicLink');
|
|
742
|
+
exports.isFileSync = isTypeSync.bind(null, 'statSync', 'isFile');
|
|
743
|
+
exports.isDirectorySync = isTypeSync.bind(null, 'statSync', 'isDirectory');
|
|
744
|
+
exports.isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink');
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
/***/ }),
|
|
748
|
+
|
|
749
|
+
/***/ 3576:
|
|
750
|
+
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
751
|
+
|
|
752
|
+
"use strict";
|
|
753
|
+
// ESM COMPAT FLAG
|
|
754
|
+
__webpack_require__.r(__webpack_exports__);
|
|
755
|
+
|
|
756
|
+
// EXPORTS
|
|
757
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
758
|
+
"generateGlobTasks": function() { return /* binding */ generateGlobTasks; },
|
|
759
|
+
"globby": function() { return /* binding */ globby; },
|
|
760
|
+
"globbyStream": function() { return /* binding */ globbyStream; },
|
|
761
|
+
"globbySync": function() { return /* binding */ globbySync; },
|
|
762
|
+
"isDynamicPattern": function() { return /* binding */ isDynamicPattern; },
|
|
763
|
+
"isGitIgnored": function() { return /* reexport */ isGitIgnored; },
|
|
764
|
+
"isGitIgnoredSync": function() { return /* reexport */ isGitIgnoredSync; }
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
// EXTERNAL MODULE: external "node:fs"
|
|
768
|
+
var external_node_fs_ = __webpack_require__(7561);
|
|
769
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/array-union@3.0.1/node_modules/array-union/index.js
|
|
770
|
+
const arrayUnion = (...arguments_) => [...new Set(arguments_.flat())];
|
|
771
|
+
|
|
772
|
+
/* harmony default export */ var array_union = (arrayUnion);
|
|
773
|
+
|
|
774
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/merge2@1.4.1/node_modules/merge2/index.js
|
|
775
|
+
var merge2 = __webpack_require__(3891);
|
|
776
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/fast-glob@3.2.11/node_modules/fast-glob/out/index.js
|
|
777
|
+
var out = __webpack_require__(9918);
|
|
778
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/dir-glob@3.0.1/node_modules/dir-glob/index.js
|
|
779
|
+
var dir_glob = __webpack_require__(1199);
|
|
780
|
+
// EXTERNAL MODULE: external "node:url"
|
|
781
|
+
var external_node_url_ = __webpack_require__(1041);
|
|
782
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/globby@12.2.0/node_modules/globby/to-path.js
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
const toPath = urlOrPath => {
|
|
786
|
+
if (!urlOrPath) {
|
|
787
|
+
return urlOrPath;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
if (urlOrPath instanceof URL) {
|
|
791
|
+
urlOrPath = urlOrPath.href;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
return urlOrPath.startsWith('file://') ? (0,external_node_url_.fileURLToPath)(urlOrPath) : urlOrPath;
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
/* harmony default export */ var to_path = (toPath);
|
|
798
|
+
|
|
799
|
+
// EXTERNAL MODULE: external "node:process"
|
|
800
|
+
var external_node_process_ = __webpack_require__(7742);
|
|
801
|
+
// EXTERNAL MODULE: external "node:path"
|
|
802
|
+
var external_node_path_ = __webpack_require__(9411);
|
|
803
|
+
// EXTERNAL MODULE: ../../node_modules/.pnpm/ignore@5.2.0/node_modules/ignore/index.js
|
|
804
|
+
var ignore = __webpack_require__(6339);
|
|
805
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/slash@4.0.0/node_modules/slash/index.js
|
|
806
|
+
function slash(path) {
|
|
807
|
+
const isExtendedLengthPath = /^\\\\\?\\/.test(path);
|
|
808
|
+
const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex
|
|
809
|
+
|
|
810
|
+
if (isExtendedLengthPath || hasNonAscii) {
|
|
811
|
+
return path;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
return path.replace(/\\/g, '/');
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/globby@12.2.0/node_modules/globby/gitignore.js
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
const DEFAULT_IGNORE = [
|
|
827
|
+
'**/node_modules/**',
|
|
828
|
+
'**/flow-typed/**',
|
|
829
|
+
'**/coverage/**',
|
|
830
|
+
'**/.git',
|
|
831
|
+
];
|
|
832
|
+
|
|
833
|
+
const mapGitIgnorePatternTo = base => ignore => {
|
|
834
|
+
if (ignore.startsWith('!')) {
|
|
835
|
+
return '!' + external_node_path_.posix.join(base, ignore.slice(1));
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
return external_node_path_.posix.join(base, ignore);
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
const parseGitIgnore = (content, options) => {
|
|
842
|
+
const base = slash(external_node_path_.relative(options.cwd, external_node_path_.dirname(options.fileName)));
|
|
843
|
+
|
|
844
|
+
return content
|
|
845
|
+
.split(/\r?\n/)
|
|
846
|
+
.filter(Boolean)
|
|
847
|
+
.filter(line => !line.startsWith('#'))
|
|
848
|
+
.map(mapGitIgnorePatternTo(base));
|
|
849
|
+
};
|
|
850
|
+
|
|
851
|
+
const reduceIgnore = files => {
|
|
852
|
+
const ignores = ignore();
|
|
853
|
+
for (const file of files) {
|
|
854
|
+
ignores.add(parseGitIgnore(file.content, {
|
|
855
|
+
cwd: file.cwd,
|
|
856
|
+
fileName: file.filePath,
|
|
857
|
+
}));
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
return ignores;
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
const ensureAbsolutePathForCwd = (cwd, p) => {
|
|
864
|
+
cwd = slash(cwd);
|
|
865
|
+
if (external_node_path_.isAbsolute(p)) {
|
|
866
|
+
if (slash(p).startsWith(cwd)) {
|
|
867
|
+
return p;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
throw new Error(`Path ${p} is not in cwd ${cwd}`);
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
return external_node_path_.join(cwd, p);
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
const getIsIgnoredPredicate = (ignores, cwd) => p => ignores.ignores(slash(external_node_path_.relative(cwd, ensureAbsolutePathForCwd(cwd, to_path(p.path || p)))));
|
|
877
|
+
|
|
878
|
+
const getFile = async (file, cwd) => {
|
|
879
|
+
const filePath = external_node_path_.join(cwd, file);
|
|
880
|
+
const content = await external_node_fs_.promises.readFile(filePath, 'utf8');
|
|
881
|
+
|
|
882
|
+
return {
|
|
883
|
+
cwd,
|
|
884
|
+
filePath,
|
|
885
|
+
content,
|
|
886
|
+
};
|
|
887
|
+
};
|
|
888
|
+
|
|
889
|
+
const getFileSync = (file, cwd) => {
|
|
890
|
+
const filePath = external_node_path_.join(cwd, file);
|
|
891
|
+
const content = external_node_fs_.readFileSync(filePath, 'utf8');
|
|
892
|
+
|
|
893
|
+
return {
|
|
894
|
+
cwd,
|
|
895
|
+
filePath,
|
|
896
|
+
content,
|
|
897
|
+
};
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
const normalizeOptions = ({
|
|
901
|
+
ignore = [],
|
|
902
|
+
cwd = slash(external_node_process_.cwd()),
|
|
903
|
+
} = {}) => ({ignore: [...DEFAULT_IGNORE, ...ignore], cwd: to_path(cwd)});
|
|
904
|
+
|
|
905
|
+
const isGitIgnored = async options => {
|
|
906
|
+
options = normalizeOptions(options);
|
|
907
|
+
|
|
908
|
+
const paths = await out('**/.gitignore', options);
|
|
909
|
+
|
|
910
|
+
const files = await Promise.all(paths.map(file => getFile(file, options.cwd)));
|
|
911
|
+
const ignores = reduceIgnore(files);
|
|
912
|
+
|
|
913
|
+
return getIsIgnoredPredicate(ignores, options.cwd);
|
|
914
|
+
};
|
|
915
|
+
|
|
916
|
+
const isGitIgnoredSync = options => {
|
|
917
|
+
options = normalizeOptions(options);
|
|
918
|
+
|
|
919
|
+
const paths = out.sync('**/.gitignore', options);
|
|
920
|
+
|
|
921
|
+
const files = paths.map(file => getFileSync(file, options.cwd));
|
|
922
|
+
const ignores = reduceIgnore(files);
|
|
923
|
+
|
|
924
|
+
return getIsIgnoredPredicate(ignores, options.cwd);
|
|
925
|
+
};
|
|
926
|
+
|
|
927
|
+
// EXTERNAL MODULE: external "node:stream"
|
|
928
|
+
var external_node_stream_ = __webpack_require__(4492);
|
|
929
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/globby@12.2.0/node_modules/globby/stream-utils.js
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
class ObjectTransform extends external_node_stream_.Transform {
|
|
933
|
+
constructor() {
|
|
934
|
+
super({
|
|
935
|
+
objectMode: true,
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
class FilterStream extends ObjectTransform {
|
|
941
|
+
constructor(filter) {
|
|
942
|
+
super();
|
|
943
|
+
this._filter = filter;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
_transform(data, encoding, callback) {
|
|
947
|
+
if (this._filter(data)) {
|
|
948
|
+
this.push(data);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
callback();
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
class UniqueStream extends ObjectTransform {
|
|
956
|
+
constructor() {
|
|
957
|
+
super();
|
|
958
|
+
this._pushed = new Set();
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
_transform(data, encoding, callback) {
|
|
962
|
+
if (!this._pushed.has(data)) {
|
|
963
|
+
this.push(data);
|
|
964
|
+
this._pushed.add(data);
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
callback();
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
;// CONCATENATED MODULE: ../../node_modules/.pnpm/globby@12.2.0/node_modules/globby/index.js
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
const DEFAULT_FILTER = () => false;
|
|
982
|
+
|
|
983
|
+
const isNegative = pattern => pattern[0] === '!';
|
|
984
|
+
|
|
985
|
+
const assertPatternsInput = patterns => {
|
|
986
|
+
if (!patterns.every(pattern => typeof pattern === 'string')) {
|
|
987
|
+
throw new TypeError('Patterns must be a string or an array of strings');
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
const checkCwdOption = options => {
|
|
992
|
+
if (!options.cwd) {
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
let stat;
|
|
997
|
+
try {
|
|
998
|
+
stat = external_node_fs_.statSync(options.cwd);
|
|
999
|
+
} catch {
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
if (!stat.isDirectory()) {
|
|
1004
|
+
throw new Error('The `cwd` option must be a path to a directory');
|
|
1005
|
+
}
|
|
1006
|
+
};
|
|
1007
|
+
|
|
1008
|
+
const getPathString = p => p.stats instanceof external_node_fs_.Stats ? p.path : p;
|
|
1009
|
+
|
|
1010
|
+
const generateGlobTasks = (patterns, taskOptions = {}) => {
|
|
1011
|
+
patterns = array_union([patterns].flat());
|
|
1012
|
+
assertPatternsInput(patterns);
|
|
1013
|
+
|
|
1014
|
+
const globTasks = [];
|
|
1015
|
+
|
|
1016
|
+
taskOptions = {
|
|
1017
|
+
ignore: [],
|
|
1018
|
+
expandDirectories: true,
|
|
1019
|
+
...taskOptions,
|
|
1020
|
+
cwd: to_path(taskOptions.cwd),
|
|
1021
|
+
};
|
|
1022
|
+
|
|
1023
|
+
checkCwdOption(taskOptions);
|
|
1024
|
+
|
|
1025
|
+
for (const [index, pattern] of patterns.entries()) {
|
|
1026
|
+
if (isNegative(pattern)) {
|
|
1027
|
+
continue;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
const ignore = patterns
|
|
1031
|
+
.slice(index)
|
|
1032
|
+
.filter(pattern => isNegative(pattern))
|
|
1033
|
+
.map(pattern => pattern.slice(1));
|
|
1034
|
+
|
|
1035
|
+
const options = {
|
|
1036
|
+
...taskOptions,
|
|
1037
|
+
ignore: [...taskOptions.ignore, ...ignore],
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
globTasks.push({pattern, options});
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
return globTasks;
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
const globDirectories = (task, fn) => {
|
|
1047
|
+
let options = {};
|
|
1048
|
+
if (task.options.cwd) {
|
|
1049
|
+
options.cwd = task.options.cwd;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
if (Array.isArray(task.options.expandDirectories)) {
|
|
1053
|
+
options = {
|
|
1054
|
+
...options,
|
|
1055
|
+
files: task.options.expandDirectories,
|
|
1056
|
+
};
|
|
1057
|
+
} else if (typeof task.options.expandDirectories === 'object') {
|
|
1058
|
+
options = {
|
|
1059
|
+
...options,
|
|
1060
|
+
...task.options.expandDirectories,
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
return fn(task.pattern, options);
|
|
1065
|
+
};
|
|
1066
|
+
|
|
1067
|
+
const getPattern = (task, fn) => task.options.expandDirectories ? globDirectories(task, fn) : [task.pattern];
|
|
1068
|
+
|
|
1069
|
+
const getFilterSync = options => options && options.gitignore
|
|
1070
|
+
? isGitIgnoredSync({cwd: options.cwd, ignore: options.ignore})
|
|
1071
|
+
: DEFAULT_FILTER;
|
|
1072
|
+
|
|
1073
|
+
const globToTask = task => async glob => {
|
|
1074
|
+
const {options} = task;
|
|
1075
|
+
if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) {
|
|
1076
|
+
options.ignore = await dir_glob(options.ignore);
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
return {
|
|
1080
|
+
pattern: glob,
|
|
1081
|
+
options,
|
|
1082
|
+
};
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1085
|
+
const globToTaskSync = task => glob => {
|
|
1086
|
+
const {options} = task;
|
|
1087
|
+
if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) {
|
|
1088
|
+
options.ignore = dir_glob.sync(options.ignore);
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
return {
|
|
1092
|
+
pattern: glob,
|
|
1093
|
+
options,
|
|
1094
|
+
};
|
|
1095
|
+
};
|
|
1096
|
+
|
|
1097
|
+
const globby = async (patterns, options) => {
|
|
1098
|
+
const globTasks = generateGlobTasks(patterns, options);
|
|
1099
|
+
|
|
1100
|
+
const getFilter = async () => options && options.gitignore
|
|
1101
|
+
? isGitIgnored({cwd: options.cwd, ignore: options.ignore})
|
|
1102
|
+
: DEFAULT_FILTER;
|
|
1103
|
+
|
|
1104
|
+
const getTasks = async () => {
|
|
1105
|
+
const tasks = await Promise.all(globTasks.map(async task => {
|
|
1106
|
+
const globs = await getPattern(task, dir_glob);
|
|
1107
|
+
return Promise.all(globs.map(globToTask(task)));
|
|
1108
|
+
}));
|
|
1109
|
+
|
|
1110
|
+
return array_union(...tasks);
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1113
|
+
const [filter, tasks] = await Promise.all([getFilter(), getTasks()]);
|
|
1114
|
+
const paths = await Promise.all(tasks.map(task => out(task.pattern, task.options)));
|
|
1115
|
+
|
|
1116
|
+
return array_union(...paths).filter(path_ => !filter(getPathString(path_)));
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
const globbySync = (patterns, options) => {
|
|
1120
|
+
const globTasks = generateGlobTasks(patterns, options);
|
|
1121
|
+
|
|
1122
|
+
const tasks = [];
|
|
1123
|
+
for (const task of globTasks) {
|
|
1124
|
+
const newTask = getPattern(task, dir_glob.sync).map(globToTaskSync(task));
|
|
1125
|
+
tasks.push(...newTask);
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
const filter = getFilterSync(options);
|
|
1129
|
+
|
|
1130
|
+
let matches = [];
|
|
1131
|
+
for (const task of tasks) {
|
|
1132
|
+
matches = array_union(matches, out.sync(task.pattern, task.options));
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
return matches.filter(path_ => !filter(path_));
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1138
|
+
const globbyStream = (patterns, options) => {
|
|
1139
|
+
const globTasks = generateGlobTasks(patterns, options);
|
|
1140
|
+
|
|
1141
|
+
const tasks = [];
|
|
1142
|
+
for (const task of globTasks) {
|
|
1143
|
+
const newTask = getPattern(task, dir_glob.sync).map(globToTaskSync(task));
|
|
1144
|
+
tasks.push(...newTask);
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
const filter = getFilterSync(options);
|
|
1148
|
+
const filterStream = new FilterStream(p => !filter(p));
|
|
1149
|
+
const uniqueStream = new UniqueStream();
|
|
1150
|
+
|
|
1151
|
+
return merge2(tasks.map(task => out.stream(task.pattern, task.options)))
|
|
1152
|
+
.pipe(filterStream)
|
|
1153
|
+
.pipe(uniqueStream);
|
|
1154
|
+
};
|
|
1155
|
+
|
|
1156
|
+
const isDynamicPattern = (patterns, options = {}) => {
|
|
1157
|
+
options = {
|
|
1158
|
+
...options,
|
|
1159
|
+
cwd: to_path(options.cwd),
|
|
1160
|
+
};
|
|
1161
|
+
|
|
1162
|
+
return [patterns].flat().some(pattern => out.isDynamicPattern(pattern, options));
|
|
1163
|
+
};
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
|
|
1168
|
+
/***/ })
|
|
1169
|
+
|
|
1170
|
+
};
|
|
1171
|
+
;
|