@rsbuild/core 1.7.2 → 2.0.0-alpha.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/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/http-proxy-middleware/index.d.ts +2 -2
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/ws/index.js +59 -54
- package/compiled/ws/package.json +1 -1
- package/dist/131.js +1000 -1065
- package/dist/31.js +336 -0
- package/dist/710.js +445 -0
- package/dist/743.js +7 -0
- package/dist/{136.mjs → 88.js} +11 -13
- package/dist/client/hmr.js +0 -1
- package/dist/client/overlay.js +32 -21
- package/dist/connect.js +581 -0
- package/dist/connect.js.LICENSE.txt +54 -0
- package/dist/cors.js +188 -0
- package/dist/cors.js.LICENSE.txt +11 -0
- package/dist/launch-editor-middleware.js +439 -0
- package/dist/manifest-plugin.js +177 -0
- package/dist/memfs.js +3644 -0
- package/dist/{0~open.js → open.js} +21 -13
- package/dist/{0~range-parser.js → range-parser.js} +1 -1
- package/dist/remapping.js +196 -0
- package/dist/sirv.js +122 -0
- package/dist/tinyglobby.js +1463 -0
- package/dist/transformLoader.mjs +1 -1
- package/dist/transformRawLoader.mjs +1 -1
- package/dist-types/{provider/build.d.ts → build.d.ts} +2 -2
- package/dist-types/cli/commands.d.ts +1 -1
- package/dist-types/configChain.d.ts +0 -2
- package/dist-types/constants.d.ts +2 -3
- package/dist-types/{provider/createCompiler.d.ts → createCompiler.d.ts} +1 -1
- package/dist-types/defaultConfig.d.ts +1 -1
- package/dist-types/helpers/index.d.ts +1 -1
- package/dist-types/helpers/url.d.ts +0 -1
- package/dist-types/helpers/vendors.d.ts +0 -13
- package/dist-types/hooks.d.ts +3 -5
- package/dist-types/index.d.ts +1 -1
- package/dist-types/{provider/initConfigs.d.ts → initConfigs.d.ts} +1 -1
- package/dist-types/inspectConfig.d.ts +5 -33
- package/dist-types/pluginHelper.d.ts +1 -1
- package/dist-types/plugins/css.d.ts +1 -1
- package/dist-types/plugins/inlineChunk.d.ts +1 -1
- package/dist-types/plugins/minimize.d.ts +2 -2
- package/dist-types/{provider/rspackConfig.d.ts → rspackConfig.d.ts} +1 -1
- package/dist-types/server/assets-middleware/setupOutputFileSystem.d.ts +1 -1
- package/dist-types/server/browserLogs.d.ts +1 -1
- package/dist-types/server/devMiddlewares.d.ts +1 -1
- package/dist-types/server/devServer.d.ts +1 -1
- package/dist-types/server/gzipMiddleware.d.ts +1 -1
- package/dist-types/server/helper.d.ts +3 -2
- package/dist-types/server/proxy.d.ts +1 -1
- package/dist-types/server/socketServer.d.ts +1 -1
- package/dist-types/types/config.d.ts +7 -51
- package/dist-types/types/context.d.ts +3 -2
- package/dist-types/types/hooks.d.ts +9 -9
- package/dist-types/types/plugin.d.ts +3 -40
- package/dist-types/types/rsbuild.d.ts +6 -31
- package/dist-types/types/thirdParty.d.ts +1 -4
- package/package.json +14 -19
- package/compiled/@jridgewell/remapping/index.d.ts +0 -1
- package/compiled/@jridgewell/remapping/index.js +0 -1222
- package/compiled/@jridgewell/remapping/license +0 -19
- package/compiled/@jridgewell/remapping/package.json +0 -1
- package/compiled/@jridgewell/trace-mapping/index.d.ts +0 -194
- package/compiled/@jridgewell/trace-mapping/index.js +0 -1408
- package/compiled/@jridgewell/trace-mapping/license +0 -19
- package/compiled/@jridgewell/trace-mapping/package.json +0 -1
- package/compiled/connect/index.d.ts +0 -90
- package/compiled/connect/index.js +0 -1240
- package/compiled/connect/license +0 -25
- package/compiled/connect/package.json +0 -1
- package/compiled/cors/index.d.ts +0 -56
- package/compiled/cors/index.js +0 -371
- package/compiled/cors/license +0 -22
- package/compiled/cors/package.json +0 -1
- package/compiled/launch-editor-middleware/index.d.ts +0 -1
- package/compiled/launch-editor-middleware/index.js +0 -719
- package/compiled/launch-editor-middleware/license +0 -21
- package/compiled/launch-editor-middleware/package.json +0 -1
- package/compiled/memfs/index.d.ts +0 -1462
- package/compiled/memfs/index.js +0 -1
- package/compiled/memfs/license +0 -201
- package/compiled/memfs/package.json +0 -1
- package/compiled/mrmime/index.d.ts +0 -4
- package/compiled/mrmime/index.js +0 -456
- package/compiled/mrmime/package.json +0 -1
- package/compiled/picocolors/index.d.ts +0 -55
- package/compiled/picocolors/index.js +0 -108
- package/compiled/picocolors/license +0 -15
- package/compiled/picocolors/package.json +0 -1
- package/compiled/rspack-manifest-plugin/index.d.ts +0 -48
- package/compiled/rspack-manifest-plugin/index.js +0 -409
- package/compiled/rspack-manifest-plugin/license +0 -21
- package/compiled/rspack-manifest-plugin/package.json +0 -1
- package/compiled/sirv/index.d.ts +0 -1
- package/compiled/sirv/index.js +0 -274
- package/compiled/sirv/package.json +0 -1
- package/compiled/tinyglobby/index.d.ts +0 -46
- package/compiled/tinyglobby/index.js +0 -2664
- package/compiled/tinyglobby/license +0 -21
- package/compiled/tinyglobby/package.json +0 -1
- package/compiled/webpack-bundle-analyzer/index.d.ts +0 -160
- package/compiled/webpack-bundle-analyzer/index.js +0 -23
- package/compiled/webpack-bundle-analyzer/license +0 -20
- package/compiled/webpack-bundle-analyzer/package.json +0 -1
- package/compiled/webpack-bundle-analyzer/public/viewer.js +0 -16
- package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +0 -10
- package/dist/2~open.cjs +0 -436
- package/dist/2~range-parser.cjs +0 -52
- package/dist/2~range-parser.cjs.LICENSE.txt +0 -6
- package/dist/index.cjs +0 -9456
- package/dist/index.cjs.LICENSE.txt +0 -26
- package/dist-types/plugins/bundleAnalyzer.d.ts +0 -2
- package/dist-types/plugins/performance.d.ts +0 -5
- package/dist-types/provider/helpers.d.ts +0 -12
- package/dist-types/provider/provider.d.ts +0 -2
- /package/dist/{0~range-parser.js.LICENSE.txt → range-parser.js.LICENSE.txt} +0 -0
|
@@ -1,2664 +0,0 @@
|
|
|
1
|
-
(() => {
|
|
2
|
-
var __webpack_modules__ = {
|
|
3
|
-
676: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
|
-
"use strict";
|
|
5
|
-
const pico = __nccwpck_require__(582);
|
|
6
|
-
const utils = __nccwpck_require__(473);
|
|
7
|
-
function picomatch(glob, options, returnState = false) {
|
|
8
|
-
if (
|
|
9
|
-
options &&
|
|
10
|
-
(options.windows === null || options.windows === undefined)
|
|
11
|
-
) {
|
|
12
|
-
options = { ...options, windows: utils.isWindows() };
|
|
13
|
-
}
|
|
14
|
-
return pico(glob, options, returnState);
|
|
15
|
-
}
|
|
16
|
-
Object.assign(picomatch, pico);
|
|
17
|
-
module.exports = picomatch;
|
|
18
|
-
},
|
|
19
|
-
717: (module) => {
|
|
20
|
-
"use strict";
|
|
21
|
-
const WIN_SLASH = "\\\\/";
|
|
22
|
-
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
23
|
-
const DOT_LITERAL = "\\.";
|
|
24
|
-
const PLUS_LITERAL = "\\+";
|
|
25
|
-
const QMARK_LITERAL = "\\?";
|
|
26
|
-
const SLASH_LITERAL = "\\/";
|
|
27
|
-
const ONE_CHAR = "(?=.)";
|
|
28
|
-
const QMARK = "[^/]";
|
|
29
|
-
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
30
|
-
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
31
|
-
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
32
|
-
const NO_DOT = `(?!${DOT_LITERAL})`;
|
|
33
|
-
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
34
|
-
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
35
|
-
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
36
|
-
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
37
|
-
const STAR = `${QMARK}*?`;
|
|
38
|
-
const SEP = "/";
|
|
39
|
-
const POSIX_CHARS = {
|
|
40
|
-
DOT_LITERAL,
|
|
41
|
-
PLUS_LITERAL,
|
|
42
|
-
QMARK_LITERAL,
|
|
43
|
-
SLASH_LITERAL,
|
|
44
|
-
ONE_CHAR,
|
|
45
|
-
QMARK,
|
|
46
|
-
END_ANCHOR,
|
|
47
|
-
DOTS_SLASH,
|
|
48
|
-
NO_DOT,
|
|
49
|
-
NO_DOTS,
|
|
50
|
-
NO_DOT_SLASH,
|
|
51
|
-
NO_DOTS_SLASH,
|
|
52
|
-
QMARK_NO_DOT,
|
|
53
|
-
STAR,
|
|
54
|
-
START_ANCHOR,
|
|
55
|
-
SEP,
|
|
56
|
-
};
|
|
57
|
-
const WINDOWS_CHARS = {
|
|
58
|
-
...POSIX_CHARS,
|
|
59
|
-
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
60
|
-
QMARK: WIN_NO_SLASH,
|
|
61
|
-
STAR: `${WIN_NO_SLASH}*?`,
|
|
62
|
-
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
63
|
-
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
64
|
-
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
65
|
-
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
66
|
-
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
67
|
-
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
68
|
-
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
69
|
-
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
70
|
-
SEP: "\\",
|
|
71
|
-
};
|
|
72
|
-
const POSIX_REGEX_SOURCE = {
|
|
73
|
-
alnum: "a-zA-Z0-9",
|
|
74
|
-
alpha: "a-zA-Z",
|
|
75
|
-
ascii: "\\x00-\\x7F",
|
|
76
|
-
blank: " \\t",
|
|
77
|
-
cntrl: "\\x00-\\x1F\\x7F",
|
|
78
|
-
digit: "0-9",
|
|
79
|
-
graph: "\\x21-\\x7E",
|
|
80
|
-
lower: "a-z",
|
|
81
|
-
print: "\\x20-\\x7E ",
|
|
82
|
-
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
83
|
-
space: " \\t\\r\\n\\v\\f",
|
|
84
|
-
upper: "A-Z",
|
|
85
|
-
word: "A-Za-z0-9_",
|
|
86
|
-
xdigit: "A-Fa-f0-9",
|
|
87
|
-
};
|
|
88
|
-
module.exports = {
|
|
89
|
-
MAX_LENGTH: 1024 * 64,
|
|
90
|
-
POSIX_REGEX_SOURCE,
|
|
91
|
-
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
92
|
-
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
93
|
-
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
94
|
-
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
95
|
-
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
96
|
-
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
97
|
-
REPLACEMENTS: {
|
|
98
|
-
__proto__: null,
|
|
99
|
-
"***": "*",
|
|
100
|
-
"**/**": "**",
|
|
101
|
-
"**/**/**": "**",
|
|
102
|
-
},
|
|
103
|
-
CHAR_0: 48,
|
|
104
|
-
CHAR_9: 57,
|
|
105
|
-
CHAR_UPPERCASE_A: 65,
|
|
106
|
-
CHAR_LOWERCASE_A: 97,
|
|
107
|
-
CHAR_UPPERCASE_Z: 90,
|
|
108
|
-
CHAR_LOWERCASE_Z: 122,
|
|
109
|
-
CHAR_LEFT_PARENTHESES: 40,
|
|
110
|
-
CHAR_RIGHT_PARENTHESES: 41,
|
|
111
|
-
CHAR_ASTERISK: 42,
|
|
112
|
-
CHAR_AMPERSAND: 38,
|
|
113
|
-
CHAR_AT: 64,
|
|
114
|
-
CHAR_BACKWARD_SLASH: 92,
|
|
115
|
-
CHAR_CARRIAGE_RETURN: 13,
|
|
116
|
-
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
117
|
-
CHAR_COLON: 58,
|
|
118
|
-
CHAR_COMMA: 44,
|
|
119
|
-
CHAR_DOT: 46,
|
|
120
|
-
CHAR_DOUBLE_QUOTE: 34,
|
|
121
|
-
CHAR_EQUAL: 61,
|
|
122
|
-
CHAR_EXCLAMATION_MARK: 33,
|
|
123
|
-
CHAR_FORM_FEED: 12,
|
|
124
|
-
CHAR_FORWARD_SLASH: 47,
|
|
125
|
-
CHAR_GRAVE_ACCENT: 96,
|
|
126
|
-
CHAR_HASH: 35,
|
|
127
|
-
CHAR_HYPHEN_MINUS: 45,
|
|
128
|
-
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
129
|
-
CHAR_LEFT_CURLY_BRACE: 123,
|
|
130
|
-
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
131
|
-
CHAR_LINE_FEED: 10,
|
|
132
|
-
CHAR_NO_BREAK_SPACE: 160,
|
|
133
|
-
CHAR_PERCENT: 37,
|
|
134
|
-
CHAR_PLUS: 43,
|
|
135
|
-
CHAR_QUESTION_MARK: 63,
|
|
136
|
-
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
137
|
-
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
138
|
-
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
139
|
-
CHAR_SEMICOLON: 59,
|
|
140
|
-
CHAR_SINGLE_QUOTE: 39,
|
|
141
|
-
CHAR_SPACE: 32,
|
|
142
|
-
CHAR_TAB: 9,
|
|
143
|
-
CHAR_UNDERSCORE: 95,
|
|
144
|
-
CHAR_VERTICAL_LINE: 124,
|
|
145
|
-
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
146
|
-
extglobChars(chars) {
|
|
147
|
-
return {
|
|
148
|
-
"!": {
|
|
149
|
-
type: "negate",
|
|
150
|
-
open: "(?:(?!(?:",
|
|
151
|
-
close: `))${chars.STAR})`,
|
|
152
|
-
},
|
|
153
|
-
"?": { type: "qmark", open: "(?:", close: ")?" },
|
|
154
|
-
"+": { type: "plus", open: "(?:", close: ")+" },
|
|
155
|
-
"*": { type: "star", open: "(?:", close: ")*" },
|
|
156
|
-
"@": { type: "at", open: "(?:", close: ")" },
|
|
157
|
-
};
|
|
158
|
-
},
|
|
159
|
-
globChars(win32) {
|
|
160
|
-
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
161
|
-
},
|
|
162
|
-
};
|
|
163
|
-
},
|
|
164
|
-
339: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
165
|
-
"use strict";
|
|
166
|
-
const constants = __nccwpck_require__(717);
|
|
167
|
-
const utils = __nccwpck_require__(473);
|
|
168
|
-
const {
|
|
169
|
-
MAX_LENGTH,
|
|
170
|
-
POSIX_REGEX_SOURCE,
|
|
171
|
-
REGEX_NON_SPECIAL_CHARS,
|
|
172
|
-
REGEX_SPECIAL_CHARS_BACKREF,
|
|
173
|
-
REPLACEMENTS,
|
|
174
|
-
} = constants;
|
|
175
|
-
const expandRange = (args, options) => {
|
|
176
|
-
if (typeof options.expandRange === "function") {
|
|
177
|
-
return options.expandRange(...args, options);
|
|
178
|
-
}
|
|
179
|
-
args.sort();
|
|
180
|
-
const value = `[${args.join("-")}]`;
|
|
181
|
-
try {
|
|
182
|
-
new RegExp(value);
|
|
183
|
-
} catch (ex) {
|
|
184
|
-
return args.map((v) => utils.escapeRegex(v)).join("..");
|
|
185
|
-
}
|
|
186
|
-
return value;
|
|
187
|
-
};
|
|
188
|
-
const syntaxError = (type, char) =>
|
|
189
|
-
`Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
190
|
-
const parse = (input, options) => {
|
|
191
|
-
if (typeof input !== "string") {
|
|
192
|
-
throw new TypeError("Expected a string");
|
|
193
|
-
}
|
|
194
|
-
input = REPLACEMENTS[input] || input;
|
|
195
|
-
const opts = { ...options };
|
|
196
|
-
const max =
|
|
197
|
-
typeof opts.maxLength === "number"
|
|
198
|
-
? Math.min(MAX_LENGTH, opts.maxLength)
|
|
199
|
-
: MAX_LENGTH;
|
|
200
|
-
let len = input.length;
|
|
201
|
-
if (len > max) {
|
|
202
|
-
throw new SyntaxError(
|
|
203
|
-
`Input length: ${len}, exceeds maximum allowed length: ${max}`,
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
const bos = { type: "bos", value: "", output: opts.prepend || "" };
|
|
207
|
-
const tokens = [bos];
|
|
208
|
-
const capture = opts.capture ? "" : "?:";
|
|
209
|
-
const PLATFORM_CHARS = constants.globChars(opts.windows);
|
|
210
|
-
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
211
|
-
const {
|
|
212
|
-
DOT_LITERAL,
|
|
213
|
-
PLUS_LITERAL,
|
|
214
|
-
SLASH_LITERAL,
|
|
215
|
-
ONE_CHAR,
|
|
216
|
-
DOTS_SLASH,
|
|
217
|
-
NO_DOT,
|
|
218
|
-
NO_DOT_SLASH,
|
|
219
|
-
NO_DOTS_SLASH,
|
|
220
|
-
QMARK,
|
|
221
|
-
QMARK_NO_DOT,
|
|
222
|
-
STAR,
|
|
223
|
-
START_ANCHOR,
|
|
224
|
-
} = PLATFORM_CHARS;
|
|
225
|
-
const globstar = (opts) =>
|
|
226
|
-
`(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
227
|
-
const nodot = opts.dot ? "" : NO_DOT;
|
|
228
|
-
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
229
|
-
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
230
|
-
if (opts.capture) {
|
|
231
|
-
star = `(${star})`;
|
|
232
|
-
}
|
|
233
|
-
if (typeof opts.noext === "boolean") {
|
|
234
|
-
opts.noextglob = opts.noext;
|
|
235
|
-
}
|
|
236
|
-
const state = {
|
|
237
|
-
input,
|
|
238
|
-
index: -1,
|
|
239
|
-
start: 0,
|
|
240
|
-
dot: opts.dot === true,
|
|
241
|
-
consumed: "",
|
|
242
|
-
output: "",
|
|
243
|
-
prefix: "",
|
|
244
|
-
backtrack: false,
|
|
245
|
-
negated: false,
|
|
246
|
-
brackets: 0,
|
|
247
|
-
braces: 0,
|
|
248
|
-
parens: 0,
|
|
249
|
-
quotes: 0,
|
|
250
|
-
globstar: false,
|
|
251
|
-
tokens,
|
|
252
|
-
};
|
|
253
|
-
input = utils.removePrefix(input, state);
|
|
254
|
-
len = input.length;
|
|
255
|
-
const extglobs = [];
|
|
256
|
-
const braces = [];
|
|
257
|
-
const stack = [];
|
|
258
|
-
let prev = bos;
|
|
259
|
-
let value;
|
|
260
|
-
const eos = () => state.index === len - 1;
|
|
261
|
-
const peek = (state.peek = (n = 1) => input[state.index + n]);
|
|
262
|
-
const advance = (state.advance = () => input[++state.index] || "");
|
|
263
|
-
const remaining = () => input.slice(state.index + 1);
|
|
264
|
-
const consume = (value = "", num = 0) => {
|
|
265
|
-
state.consumed += value;
|
|
266
|
-
state.index += num;
|
|
267
|
-
};
|
|
268
|
-
const append = (token) => {
|
|
269
|
-
state.output += token.output != null ? token.output : token.value;
|
|
270
|
-
consume(token.value);
|
|
271
|
-
};
|
|
272
|
-
const negate = () => {
|
|
273
|
-
let count = 1;
|
|
274
|
-
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
|
275
|
-
advance();
|
|
276
|
-
state.start++;
|
|
277
|
-
count++;
|
|
278
|
-
}
|
|
279
|
-
if (count % 2 === 0) {
|
|
280
|
-
return false;
|
|
281
|
-
}
|
|
282
|
-
state.negated = true;
|
|
283
|
-
state.start++;
|
|
284
|
-
return true;
|
|
285
|
-
};
|
|
286
|
-
const increment = (type) => {
|
|
287
|
-
state[type]++;
|
|
288
|
-
stack.push(type);
|
|
289
|
-
};
|
|
290
|
-
const decrement = (type) => {
|
|
291
|
-
state[type]--;
|
|
292
|
-
stack.pop();
|
|
293
|
-
};
|
|
294
|
-
const push = (tok) => {
|
|
295
|
-
if (prev.type === "globstar") {
|
|
296
|
-
const isBrace =
|
|
297
|
-
state.braces > 0 &&
|
|
298
|
-
(tok.type === "comma" || tok.type === "brace");
|
|
299
|
-
const isExtglob =
|
|
300
|
-
tok.extglob === true ||
|
|
301
|
-
(extglobs.length &&
|
|
302
|
-
(tok.type === "pipe" || tok.type === "paren"));
|
|
303
|
-
if (
|
|
304
|
-
tok.type !== "slash" &&
|
|
305
|
-
tok.type !== "paren" &&
|
|
306
|
-
!isBrace &&
|
|
307
|
-
!isExtglob
|
|
308
|
-
) {
|
|
309
|
-
state.output = state.output.slice(0, -prev.output.length);
|
|
310
|
-
prev.type = "star";
|
|
311
|
-
prev.value = "*";
|
|
312
|
-
prev.output = star;
|
|
313
|
-
state.output += prev.output;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
if (extglobs.length && tok.type !== "paren") {
|
|
317
|
-
extglobs[extglobs.length - 1].inner += tok.value;
|
|
318
|
-
}
|
|
319
|
-
if (tok.value || tok.output) append(tok);
|
|
320
|
-
if (prev && prev.type === "text" && tok.type === "text") {
|
|
321
|
-
prev.output = (prev.output || prev.value) + tok.value;
|
|
322
|
-
prev.value += tok.value;
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
tok.prev = prev;
|
|
326
|
-
tokens.push(tok);
|
|
327
|
-
prev = tok;
|
|
328
|
-
};
|
|
329
|
-
const extglobOpen = (type, value) => {
|
|
330
|
-
const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: "" };
|
|
331
|
-
token.prev = prev;
|
|
332
|
-
token.parens = state.parens;
|
|
333
|
-
token.output = state.output;
|
|
334
|
-
const output = (opts.capture ? "(" : "") + token.open;
|
|
335
|
-
increment("parens");
|
|
336
|
-
push({ type, value, output: state.output ? "" : ONE_CHAR });
|
|
337
|
-
push({ type: "paren", extglob: true, value: advance(), output });
|
|
338
|
-
extglobs.push(token);
|
|
339
|
-
};
|
|
340
|
-
const extglobClose = (token) => {
|
|
341
|
-
let output = token.close + (opts.capture ? ")" : "");
|
|
342
|
-
let rest;
|
|
343
|
-
if (token.type === "negate") {
|
|
344
|
-
let extglobStar = star;
|
|
345
|
-
if (
|
|
346
|
-
token.inner &&
|
|
347
|
-
token.inner.length > 1 &&
|
|
348
|
-
token.inner.includes("/")
|
|
349
|
-
) {
|
|
350
|
-
extglobStar = globstar(opts);
|
|
351
|
-
}
|
|
352
|
-
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
353
|
-
output = token.close = `)$))${extglobStar}`;
|
|
354
|
-
}
|
|
355
|
-
if (
|
|
356
|
-
token.inner.includes("*") &&
|
|
357
|
-
(rest = remaining()) &&
|
|
358
|
-
/^\.[^\\/.]+$/.test(rest)
|
|
359
|
-
) {
|
|
360
|
-
const expression = parse(rest, {
|
|
361
|
-
...options,
|
|
362
|
-
fastpaths: false,
|
|
363
|
-
}).output;
|
|
364
|
-
output = token.close = `)${expression})${extglobStar})`;
|
|
365
|
-
}
|
|
366
|
-
if (token.prev.type === "bos") {
|
|
367
|
-
state.negatedExtglob = true;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
push({ type: "paren", extglob: true, value, output });
|
|
371
|
-
decrement("parens");
|
|
372
|
-
};
|
|
373
|
-
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
374
|
-
let backslashes = false;
|
|
375
|
-
let output = input.replace(
|
|
376
|
-
REGEX_SPECIAL_CHARS_BACKREF,
|
|
377
|
-
(m, esc, chars, first, rest, index) => {
|
|
378
|
-
if (first === "\\") {
|
|
379
|
-
backslashes = true;
|
|
380
|
-
return m;
|
|
381
|
-
}
|
|
382
|
-
if (first === "?") {
|
|
383
|
-
if (esc) {
|
|
384
|
-
return esc + first + (rest ? QMARK.repeat(rest.length) : "");
|
|
385
|
-
}
|
|
386
|
-
if (index === 0) {
|
|
387
|
-
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
|
388
|
-
}
|
|
389
|
-
return QMARK.repeat(chars.length);
|
|
390
|
-
}
|
|
391
|
-
if (first === ".") {
|
|
392
|
-
return DOT_LITERAL.repeat(chars.length);
|
|
393
|
-
}
|
|
394
|
-
if (first === "*") {
|
|
395
|
-
if (esc) {
|
|
396
|
-
return esc + first + (rest ? star : "");
|
|
397
|
-
}
|
|
398
|
-
return star;
|
|
399
|
-
}
|
|
400
|
-
return esc ? m : `\\${m}`;
|
|
401
|
-
},
|
|
402
|
-
);
|
|
403
|
-
if (backslashes === true) {
|
|
404
|
-
if (opts.unescape === true) {
|
|
405
|
-
output = output.replace(/\\/g, "");
|
|
406
|
-
} else {
|
|
407
|
-
output = output.replace(/\\+/g, (m) =>
|
|
408
|
-
m.length % 2 === 0 ? "\\\\" : m ? "\\" : "",
|
|
409
|
-
);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
if (output === input && opts.contains === true) {
|
|
413
|
-
state.output = input;
|
|
414
|
-
return state;
|
|
415
|
-
}
|
|
416
|
-
state.output = utils.wrapOutput(output, state, options);
|
|
417
|
-
return state;
|
|
418
|
-
}
|
|
419
|
-
while (!eos()) {
|
|
420
|
-
value = advance();
|
|
421
|
-
if (value === "\0") {
|
|
422
|
-
continue;
|
|
423
|
-
}
|
|
424
|
-
if (value === "\\") {
|
|
425
|
-
const next = peek();
|
|
426
|
-
if (next === "/" && opts.bash !== true) {
|
|
427
|
-
continue;
|
|
428
|
-
}
|
|
429
|
-
if (next === "." || next === ";") {
|
|
430
|
-
continue;
|
|
431
|
-
}
|
|
432
|
-
if (!next) {
|
|
433
|
-
value += "\\";
|
|
434
|
-
push({ type: "text", value });
|
|
435
|
-
continue;
|
|
436
|
-
}
|
|
437
|
-
const match = /^\\+/.exec(remaining());
|
|
438
|
-
let slashes = 0;
|
|
439
|
-
if (match && match[0].length > 2) {
|
|
440
|
-
slashes = match[0].length;
|
|
441
|
-
state.index += slashes;
|
|
442
|
-
if (slashes % 2 !== 0) {
|
|
443
|
-
value += "\\";
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
if (opts.unescape === true) {
|
|
447
|
-
value = advance();
|
|
448
|
-
} else {
|
|
449
|
-
value += advance();
|
|
450
|
-
}
|
|
451
|
-
if (state.brackets === 0) {
|
|
452
|
-
push({ type: "text", value });
|
|
453
|
-
continue;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
if (
|
|
457
|
-
state.brackets > 0 &&
|
|
458
|
-
(value !== "]" || prev.value === "[" || prev.value === "[^")
|
|
459
|
-
) {
|
|
460
|
-
if (opts.posix !== false && value === ":") {
|
|
461
|
-
const inner = prev.value.slice(1);
|
|
462
|
-
if (inner.includes("[")) {
|
|
463
|
-
prev.posix = true;
|
|
464
|
-
if (inner.includes(":")) {
|
|
465
|
-
const idx = prev.value.lastIndexOf("[");
|
|
466
|
-
const pre = prev.value.slice(0, idx);
|
|
467
|
-
const rest = prev.value.slice(idx + 2);
|
|
468
|
-
const posix = POSIX_REGEX_SOURCE[rest];
|
|
469
|
-
if (posix) {
|
|
470
|
-
prev.value = pre + posix;
|
|
471
|
-
state.backtrack = true;
|
|
472
|
-
advance();
|
|
473
|
-
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
474
|
-
bos.output = ONE_CHAR;
|
|
475
|
-
}
|
|
476
|
-
continue;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
if (
|
|
482
|
-
(value === "[" && peek() !== ":") ||
|
|
483
|
-
(value === "-" && peek() === "]")
|
|
484
|
-
) {
|
|
485
|
-
value = `\\${value}`;
|
|
486
|
-
}
|
|
487
|
-
if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
|
|
488
|
-
value = `\\${value}`;
|
|
489
|
-
}
|
|
490
|
-
if (opts.posix === true && value === "!" && prev.value === "[") {
|
|
491
|
-
value = "^";
|
|
492
|
-
}
|
|
493
|
-
prev.value += value;
|
|
494
|
-
append({ value });
|
|
495
|
-
continue;
|
|
496
|
-
}
|
|
497
|
-
if (state.quotes === 1 && value !== '"') {
|
|
498
|
-
value = utils.escapeRegex(value);
|
|
499
|
-
prev.value += value;
|
|
500
|
-
append({ value });
|
|
501
|
-
continue;
|
|
502
|
-
}
|
|
503
|
-
if (value === '"') {
|
|
504
|
-
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
505
|
-
if (opts.keepQuotes === true) {
|
|
506
|
-
push({ type: "text", value });
|
|
507
|
-
}
|
|
508
|
-
continue;
|
|
509
|
-
}
|
|
510
|
-
if (value === "(") {
|
|
511
|
-
increment("parens");
|
|
512
|
-
push({ type: "paren", value });
|
|
513
|
-
continue;
|
|
514
|
-
}
|
|
515
|
-
if (value === ")") {
|
|
516
|
-
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
517
|
-
throw new SyntaxError(syntaxError("opening", "("));
|
|
518
|
-
}
|
|
519
|
-
const extglob = extglobs[extglobs.length - 1];
|
|
520
|
-
if (extglob && state.parens === extglob.parens + 1) {
|
|
521
|
-
extglobClose(extglobs.pop());
|
|
522
|
-
continue;
|
|
523
|
-
}
|
|
524
|
-
push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
|
|
525
|
-
decrement("parens");
|
|
526
|
-
continue;
|
|
527
|
-
}
|
|
528
|
-
if (value === "[") {
|
|
529
|
-
if (opts.nobracket === true || !remaining().includes("]")) {
|
|
530
|
-
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
531
|
-
throw new SyntaxError(syntaxError("closing", "]"));
|
|
532
|
-
}
|
|
533
|
-
value = `\\${value}`;
|
|
534
|
-
} else {
|
|
535
|
-
increment("brackets");
|
|
536
|
-
}
|
|
537
|
-
push({ type: "bracket", value });
|
|
538
|
-
continue;
|
|
539
|
-
}
|
|
540
|
-
if (value === "]") {
|
|
541
|
-
if (
|
|
542
|
-
opts.nobracket === true ||
|
|
543
|
-
(prev && prev.type === "bracket" && prev.value.length === 1)
|
|
544
|
-
) {
|
|
545
|
-
push({ type: "text", value, output: `\\${value}` });
|
|
546
|
-
continue;
|
|
547
|
-
}
|
|
548
|
-
if (state.brackets === 0) {
|
|
549
|
-
if (opts.strictBrackets === true) {
|
|
550
|
-
throw new SyntaxError(syntaxError("opening", "["));
|
|
551
|
-
}
|
|
552
|
-
push({ type: "text", value, output: `\\${value}` });
|
|
553
|
-
continue;
|
|
554
|
-
}
|
|
555
|
-
decrement("brackets");
|
|
556
|
-
const prevValue = prev.value.slice(1);
|
|
557
|
-
if (
|
|
558
|
-
prev.posix !== true &&
|
|
559
|
-
prevValue[0] === "^" &&
|
|
560
|
-
!prevValue.includes("/")
|
|
561
|
-
) {
|
|
562
|
-
value = `/${value}`;
|
|
563
|
-
}
|
|
564
|
-
prev.value += value;
|
|
565
|
-
append({ value });
|
|
566
|
-
if (
|
|
567
|
-
opts.literalBrackets === false ||
|
|
568
|
-
utils.hasRegexChars(prevValue)
|
|
569
|
-
) {
|
|
570
|
-
continue;
|
|
571
|
-
}
|
|
572
|
-
const escaped = utils.escapeRegex(prev.value);
|
|
573
|
-
state.output = state.output.slice(0, -prev.value.length);
|
|
574
|
-
if (opts.literalBrackets === true) {
|
|
575
|
-
state.output += escaped;
|
|
576
|
-
prev.value = escaped;
|
|
577
|
-
continue;
|
|
578
|
-
}
|
|
579
|
-
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
580
|
-
state.output += prev.value;
|
|
581
|
-
continue;
|
|
582
|
-
}
|
|
583
|
-
if (value === "{" && opts.nobrace !== true) {
|
|
584
|
-
increment("braces");
|
|
585
|
-
const open = {
|
|
586
|
-
type: "brace",
|
|
587
|
-
value,
|
|
588
|
-
output: "(",
|
|
589
|
-
outputIndex: state.output.length,
|
|
590
|
-
tokensIndex: state.tokens.length,
|
|
591
|
-
};
|
|
592
|
-
braces.push(open);
|
|
593
|
-
push(open);
|
|
594
|
-
continue;
|
|
595
|
-
}
|
|
596
|
-
if (value === "}") {
|
|
597
|
-
const brace = braces[braces.length - 1];
|
|
598
|
-
if (opts.nobrace === true || !brace) {
|
|
599
|
-
push({ type: "text", value, output: value });
|
|
600
|
-
continue;
|
|
601
|
-
}
|
|
602
|
-
let output = ")";
|
|
603
|
-
if (brace.dots === true) {
|
|
604
|
-
const arr = tokens.slice();
|
|
605
|
-
const range = [];
|
|
606
|
-
for (let i = arr.length - 1; i >= 0; i--) {
|
|
607
|
-
tokens.pop();
|
|
608
|
-
if (arr[i].type === "brace") {
|
|
609
|
-
break;
|
|
610
|
-
}
|
|
611
|
-
if (arr[i].type !== "dots") {
|
|
612
|
-
range.unshift(arr[i].value);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
output = expandRange(range, opts);
|
|
616
|
-
state.backtrack = true;
|
|
617
|
-
}
|
|
618
|
-
if (brace.comma !== true && brace.dots !== true) {
|
|
619
|
-
const out = state.output.slice(0, brace.outputIndex);
|
|
620
|
-
const toks = state.tokens.slice(brace.tokensIndex);
|
|
621
|
-
brace.value = brace.output = "\\{";
|
|
622
|
-
value = output = "\\}";
|
|
623
|
-
state.output = out;
|
|
624
|
-
for (const t of toks) {
|
|
625
|
-
state.output += t.output || t.value;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
push({ type: "brace", value, output });
|
|
629
|
-
decrement("braces");
|
|
630
|
-
braces.pop();
|
|
631
|
-
continue;
|
|
632
|
-
}
|
|
633
|
-
if (value === "|") {
|
|
634
|
-
if (extglobs.length > 0) {
|
|
635
|
-
extglobs[extglobs.length - 1].conditions++;
|
|
636
|
-
}
|
|
637
|
-
push({ type: "text", value });
|
|
638
|
-
continue;
|
|
639
|
-
}
|
|
640
|
-
if (value === ",") {
|
|
641
|
-
let output = value;
|
|
642
|
-
const brace = braces[braces.length - 1];
|
|
643
|
-
if (brace && stack[stack.length - 1] === "braces") {
|
|
644
|
-
brace.comma = true;
|
|
645
|
-
output = "|";
|
|
646
|
-
}
|
|
647
|
-
push({ type: "comma", value, output });
|
|
648
|
-
continue;
|
|
649
|
-
}
|
|
650
|
-
if (value === "/") {
|
|
651
|
-
if (prev.type === "dot" && state.index === state.start + 1) {
|
|
652
|
-
state.start = state.index + 1;
|
|
653
|
-
state.consumed = "";
|
|
654
|
-
state.output = "";
|
|
655
|
-
tokens.pop();
|
|
656
|
-
prev = bos;
|
|
657
|
-
continue;
|
|
658
|
-
}
|
|
659
|
-
push({ type: "slash", value, output: SLASH_LITERAL });
|
|
660
|
-
continue;
|
|
661
|
-
}
|
|
662
|
-
if (value === ".") {
|
|
663
|
-
if (state.braces > 0 && prev.type === "dot") {
|
|
664
|
-
if (prev.value === ".") prev.output = DOT_LITERAL;
|
|
665
|
-
const brace = braces[braces.length - 1];
|
|
666
|
-
prev.type = "dots";
|
|
667
|
-
prev.output += value;
|
|
668
|
-
prev.value += value;
|
|
669
|
-
brace.dots = true;
|
|
670
|
-
continue;
|
|
671
|
-
}
|
|
672
|
-
if (
|
|
673
|
-
state.braces + state.parens === 0 &&
|
|
674
|
-
prev.type !== "bos" &&
|
|
675
|
-
prev.type !== "slash"
|
|
676
|
-
) {
|
|
677
|
-
push({ type: "text", value, output: DOT_LITERAL });
|
|
678
|
-
continue;
|
|
679
|
-
}
|
|
680
|
-
push({ type: "dot", value, output: DOT_LITERAL });
|
|
681
|
-
continue;
|
|
682
|
-
}
|
|
683
|
-
if (value === "?") {
|
|
684
|
-
const isGroup = prev && prev.value === "(";
|
|
685
|
-
if (
|
|
686
|
-
!isGroup &&
|
|
687
|
-
opts.noextglob !== true &&
|
|
688
|
-
peek() === "(" &&
|
|
689
|
-
peek(2) !== "?"
|
|
690
|
-
) {
|
|
691
|
-
extglobOpen("qmark", value);
|
|
692
|
-
continue;
|
|
693
|
-
}
|
|
694
|
-
if (prev && prev.type === "paren") {
|
|
695
|
-
const next = peek();
|
|
696
|
-
let output = value;
|
|
697
|
-
if (
|
|
698
|
-
(prev.value === "(" && !/[!=<:]/.test(next)) ||
|
|
699
|
-
(next === "<" && !/<([!=]|\w+>)/.test(remaining()))
|
|
700
|
-
) {
|
|
701
|
-
output = `\\${value}`;
|
|
702
|
-
}
|
|
703
|
-
push({ type: "text", value, output });
|
|
704
|
-
continue;
|
|
705
|
-
}
|
|
706
|
-
if (
|
|
707
|
-
opts.dot !== true &&
|
|
708
|
-
(prev.type === "slash" || prev.type === "bos")
|
|
709
|
-
) {
|
|
710
|
-
push({ type: "qmark", value, output: QMARK_NO_DOT });
|
|
711
|
-
continue;
|
|
712
|
-
}
|
|
713
|
-
push({ type: "qmark", value, output: QMARK });
|
|
714
|
-
continue;
|
|
715
|
-
}
|
|
716
|
-
if (value === "!") {
|
|
717
|
-
if (opts.noextglob !== true && peek() === "(") {
|
|
718
|
-
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
|
719
|
-
extglobOpen("negate", value);
|
|
720
|
-
continue;
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
if (opts.nonegate !== true && state.index === 0) {
|
|
724
|
-
negate();
|
|
725
|
-
continue;
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
if (value === "+") {
|
|
729
|
-
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
730
|
-
extglobOpen("plus", value);
|
|
731
|
-
continue;
|
|
732
|
-
}
|
|
733
|
-
if ((prev && prev.value === "(") || opts.regex === false) {
|
|
734
|
-
push({ type: "plus", value, output: PLUS_LITERAL });
|
|
735
|
-
continue;
|
|
736
|
-
}
|
|
737
|
-
if (
|
|
738
|
-
(prev &&
|
|
739
|
-
(prev.type === "bracket" ||
|
|
740
|
-
prev.type === "paren" ||
|
|
741
|
-
prev.type === "brace")) ||
|
|
742
|
-
state.parens > 0
|
|
743
|
-
) {
|
|
744
|
-
push({ type: "plus", value });
|
|
745
|
-
continue;
|
|
746
|
-
}
|
|
747
|
-
push({ type: "plus", value: PLUS_LITERAL });
|
|
748
|
-
continue;
|
|
749
|
-
}
|
|
750
|
-
if (value === "@") {
|
|
751
|
-
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
752
|
-
push({ type: "at", extglob: true, value, output: "" });
|
|
753
|
-
continue;
|
|
754
|
-
}
|
|
755
|
-
push({ type: "text", value });
|
|
756
|
-
continue;
|
|
757
|
-
}
|
|
758
|
-
if (value !== "*") {
|
|
759
|
-
if (value === "$" || value === "^") {
|
|
760
|
-
value = `\\${value}`;
|
|
761
|
-
}
|
|
762
|
-
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
763
|
-
if (match) {
|
|
764
|
-
value += match[0];
|
|
765
|
-
state.index += match[0].length;
|
|
766
|
-
}
|
|
767
|
-
push({ type: "text", value });
|
|
768
|
-
continue;
|
|
769
|
-
}
|
|
770
|
-
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
771
|
-
prev.type = "star";
|
|
772
|
-
prev.star = true;
|
|
773
|
-
prev.value += value;
|
|
774
|
-
prev.output = star;
|
|
775
|
-
state.backtrack = true;
|
|
776
|
-
state.globstar = true;
|
|
777
|
-
consume(value);
|
|
778
|
-
continue;
|
|
779
|
-
}
|
|
780
|
-
let rest = remaining();
|
|
781
|
-
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
782
|
-
extglobOpen("star", value);
|
|
783
|
-
continue;
|
|
784
|
-
}
|
|
785
|
-
if (prev.type === "star") {
|
|
786
|
-
if (opts.noglobstar === true) {
|
|
787
|
-
consume(value);
|
|
788
|
-
continue;
|
|
789
|
-
}
|
|
790
|
-
const prior = prev.prev;
|
|
791
|
-
const before = prior.prev;
|
|
792
|
-
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
793
|
-
const afterStar =
|
|
794
|
-
before && (before.type === "star" || before.type === "globstar");
|
|
795
|
-
if (
|
|
796
|
-
opts.bash === true &&
|
|
797
|
-
(!isStart || (rest[0] && rest[0] !== "/"))
|
|
798
|
-
) {
|
|
799
|
-
push({ type: "star", value, output: "" });
|
|
800
|
-
continue;
|
|
801
|
-
}
|
|
802
|
-
const isBrace =
|
|
803
|
-
state.braces > 0 &&
|
|
804
|
-
(prior.type === "comma" || prior.type === "brace");
|
|
805
|
-
const isExtglob =
|
|
806
|
-
extglobs.length &&
|
|
807
|
-
(prior.type === "pipe" || prior.type === "paren");
|
|
808
|
-
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
809
|
-
push({ type: "star", value, output: "" });
|
|
810
|
-
continue;
|
|
811
|
-
}
|
|
812
|
-
while (rest.slice(0, 3) === "/**") {
|
|
813
|
-
const after = input[state.index + 4];
|
|
814
|
-
if (after && after !== "/") {
|
|
815
|
-
break;
|
|
816
|
-
}
|
|
817
|
-
rest = rest.slice(3);
|
|
818
|
-
consume("/**", 3);
|
|
819
|
-
}
|
|
820
|
-
if (prior.type === "bos" && eos()) {
|
|
821
|
-
prev.type = "globstar";
|
|
822
|
-
prev.value += value;
|
|
823
|
-
prev.output = globstar(opts);
|
|
824
|
-
state.output = prev.output;
|
|
825
|
-
state.globstar = true;
|
|
826
|
-
consume(value);
|
|
827
|
-
continue;
|
|
828
|
-
}
|
|
829
|
-
if (
|
|
830
|
-
prior.type === "slash" &&
|
|
831
|
-
prior.prev.type !== "bos" &&
|
|
832
|
-
!afterStar &&
|
|
833
|
-
eos()
|
|
834
|
-
) {
|
|
835
|
-
state.output = state.output.slice(
|
|
836
|
-
0,
|
|
837
|
-
-(prior.output + prev.output).length,
|
|
838
|
-
);
|
|
839
|
-
prior.output = `(?:${prior.output}`;
|
|
840
|
-
prev.type = "globstar";
|
|
841
|
-
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
|
842
|
-
prev.value += value;
|
|
843
|
-
state.globstar = true;
|
|
844
|
-
state.output += prior.output + prev.output;
|
|
845
|
-
consume(value);
|
|
846
|
-
continue;
|
|
847
|
-
}
|
|
848
|
-
if (
|
|
849
|
-
prior.type === "slash" &&
|
|
850
|
-
prior.prev.type !== "bos" &&
|
|
851
|
-
rest[0] === "/"
|
|
852
|
-
) {
|
|
853
|
-
const end = rest[1] !== void 0 ? "|$" : "";
|
|
854
|
-
state.output = state.output.slice(
|
|
855
|
-
0,
|
|
856
|
-
-(prior.output + prev.output).length,
|
|
857
|
-
);
|
|
858
|
-
prior.output = `(?:${prior.output}`;
|
|
859
|
-
prev.type = "globstar";
|
|
860
|
-
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
861
|
-
prev.value += value;
|
|
862
|
-
state.output += prior.output + prev.output;
|
|
863
|
-
state.globstar = true;
|
|
864
|
-
consume(value + advance());
|
|
865
|
-
push({ type: "slash", value: "/", output: "" });
|
|
866
|
-
continue;
|
|
867
|
-
}
|
|
868
|
-
if (prior.type === "bos" && rest[0] === "/") {
|
|
869
|
-
prev.type = "globstar";
|
|
870
|
-
prev.value += value;
|
|
871
|
-
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
872
|
-
state.output = prev.output;
|
|
873
|
-
state.globstar = true;
|
|
874
|
-
consume(value + advance());
|
|
875
|
-
push({ type: "slash", value: "/", output: "" });
|
|
876
|
-
continue;
|
|
877
|
-
}
|
|
878
|
-
state.output = state.output.slice(0, -prev.output.length);
|
|
879
|
-
prev.type = "globstar";
|
|
880
|
-
prev.output = globstar(opts);
|
|
881
|
-
prev.value += value;
|
|
882
|
-
state.output += prev.output;
|
|
883
|
-
state.globstar = true;
|
|
884
|
-
consume(value);
|
|
885
|
-
continue;
|
|
886
|
-
}
|
|
887
|
-
const token = { type: "star", value, output: star };
|
|
888
|
-
if (opts.bash === true) {
|
|
889
|
-
token.output = ".*?";
|
|
890
|
-
if (prev.type === "bos" || prev.type === "slash") {
|
|
891
|
-
token.output = nodot + token.output;
|
|
892
|
-
}
|
|
893
|
-
push(token);
|
|
894
|
-
continue;
|
|
895
|
-
}
|
|
896
|
-
if (
|
|
897
|
-
prev &&
|
|
898
|
-
(prev.type === "bracket" || prev.type === "paren") &&
|
|
899
|
-
opts.regex === true
|
|
900
|
-
) {
|
|
901
|
-
token.output = value;
|
|
902
|
-
push(token);
|
|
903
|
-
continue;
|
|
904
|
-
}
|
|
905
|
-
if (
|
|
906
|
-
state.index === state.start ||
|
|
907
|
-
prev.type === "slash" ||
|
|
908
|
-
prev.type === "dot"
|
|
909
|
-
) {
|
|
910
|
-
if (prev.type === "dot") {
|
|
911
|
-
state.output += NO_DOT_SLASH;
|
|
912
|
-
prev.output += NO_DOT_SLASH;
|
|
913
|
-
} else if (opts.dot === true) {
|
|
914
|
-
state.output += NO_DOTS_SLASH;
|
|
915
|
-
prev.output += NO_DOTS_SLASH;
|
|
916
|
-
} else {
|
|
917
|
-
state.output += nodot;
|
|
918
|
-
prev.output += nodot;
|
|
919
|
-
}
|
|
920
|
-
if (peek() !== "*") {
|
|
921
|
-
state.output += ONE_CHAR;
|
|
922
|
-
prev.output += ONE_CHAR;
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
push(token);
|
|
926
|
-
}
|
|
927
|
-
while (state.brackets > 0) {
|
|
928
|
-
if (opts.strictBrackets === true)
|
|
929
|
-
throw new SyntaxError(syntaxError("closing", "]"));
|
|
930
|
-
state.output = utils.escapeLast(state.output, "[");
|
|
931
|
-
decrement("brackets");
|
|
932
|
-
}
|
|
933
|
-
while (state.parens > 0) {
|
|
934
|
-
if (opts.strictBrackets === true)
|
|
935
|
-
throw new SyntaxError(syntaxError("closing", ")"));
|
|
936
|
-
state.output = utils.escapeLast(state.output, "(");
|
|
937
|
-
decrement("parens");
|
|
938
|
-
}
|
|
939
|
-
while (state.braces > 0) {
|
|
940
|
-
if (opts.strictBrackets === true)
|
|
941
|
-
throw new SyntaxError(syntaxError("closing", "}"));
|
|
942
|
-
state.output = utils.escapeLast(state.output, "{");
|
|
943
|
-
decrement("braces");
|
|
944
|
-
}
|
|
945
|
-
if (
|
|
946
|
-
opts.strictSlashes !== true &&
|
|
947
|
-
(prev.type === "star" || prev.type === "bracket")
|
|
948
|
-
) {
|
|
949
|
-
push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
|
|
950
|
-
}
|
|
951
|
-
if (state.backtrack === true) {
|
|
952
|
-
state.output = "";
|
|
953
|
-
for (const token of state.tokens) {
|
|
954
|
-
state.output += token.output != null ? token.output : token.value;
|
|
955
|
-
if (token.suffix) {
|
|
956
|
-
state.output += token.suffix;
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
return state;
|
|
961
|
-
};
|
|
962
|
-
parse.fastpaths = (input, options) => {
|
|
963
|
-
const opts = { ...options };
|
|
964
|
-
const max =
|
|
965
|
-
typeof opts.maxLength === "number"
|
|
966
|
-
? Math.min(MAX_LENGTH, opts.maxLength)
|
|
967
|
-
: MAX_LENGTH;
|
|
968
|
-
const len = input.length;
|
|
969
|
-
if (len > max) {
|
|
970
|
-
throw new SyntaxError(
|
|
971
|
-
`Input length: ${len}, exceeds maximum allowed length: ${max}`,
|
|
972
|
-
);
|
|
973
|
-
}
|
|
974
|
-
input = REPLACEMENTS[input] || input;
|
|
975
|
-
const {
|
|
976
|
-
DOT_LITERAL,
|
|
977
|
-
SLASH_LITERAL,
|
|
978
|
-
ONE_CHAR,
|
|
979
|
-
DOTS_SLASH,
|
|
980
|
-
NO_DOT,
|
|
981
|
-
NO_DOTS,
|
|
982
|
-
NO_DOTS_SLASH,
|
|
983
|
-
STAR,
|
|
984
|
-
START_ANCHOR,
|
|
985
|
-
} = constants.globChars(opts.windows);
|
|
986
|
-
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
987
|
-
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
988
|
-
const capture = opts.capture ? "" : "?:";
|
|
989
|
-
const state = { negated: false, prefix: "" };
|
|
990
|
-
let star = opts.bash === true ? ".*?" : STAR;
|
|
991
|
-
if (opts.capture) {
|
|
992
|
-
star = `(${star})`;
|
|
993
|
-
}
|
|
994
|
-
const globstar = (opts) => {
|
|
995
|
-
if (opts.noglobstar === true) return star;
|
|
996
|
-
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
997
|
-
};
|
|
998
|
-
const create = (str) => {
|
|
999
|
-
switch (str) {
|
|
1000
|
-
case "*":
|
|
1001
|
-
return `${nodot}${ONE_CHAR}${star}`;
|
|
1002
|
-
case ".*":
|
|
1003
|
-
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1004
|
-
case "*.*":
|
|
1005
|
-
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1006
|
-
case "*/*":
|
|
1007
|
-
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
1008
|
-
case "**":
|
|
1009
|
-
return nodot + globstar(opts);
|
|
1010
|
-
case "**/*":
|
|
1011
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
1012
|
-
case "**/*.*":
|
|
1013
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1014
|
-
case "**/.*":
|
|
1015
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
1016
|
-
default: {
|
|
1017
|
-
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
1018
|
-
if (!match) return;
|
|
1019
|
-
const source = create(match[1]);
|
|
1020
|
-
if (!source) return;
|
|
1021
|
-
return source + DOT_LITERAL + match[2];
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
};
|
|
1025
|
-
const output = utils.removePrefix(input, state);
|
|
1026
|
-
let source = create(output);
|
|
1027
|
-
if (source && opts.strictSlashes !== true) {
|
|
1028
|
-
source += `${SLASH_LITERAL}?`;
|
|
1029
|
-
}
|
|
1030
|
-
return source;
|
|
1031
|
-
};
|
|
1032
|
-
module.exports = parse;
|
|
1033
|
-
},
|
|
1034
|
-
582: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1035
|
-
"use strict";
|
|
1036
|
-
const scan = __nccwpck_require__(279);
|
|
1037
|
-
const parse = __nccwpck_require__(339);
|
|
1038
|
-
const utils = __nccwpck_require__(473);
|
|
1039
|
-
const constants = __nccwpck_require__(717);
|
|
1040
|
-
const isObject = (val) =>
|
|
1041
|
-
val && typeof val === "object" && !Array.isArray(val);
|
|
1042
|
-
const picomatch = (glob, options, returnState = false) => {
|
|
1043
|
-
if (Array.isArray(glob)) {
|
|
1044
|
-
const fns = glob.map((input) =>
|
|
1045
|
-
picomatch(input, options, returnState),
|
|
1046
|
-
);
|
|
1047
|
-
const arrayMatcher = (str) => {
|
|
1048
|
-
for (const isMatch of fns) {
|
|
1049
|
-
const state = isMatch(str);
|
|
1050
|
-
if (state) return state;
|
|
1051
|
-
}
|
|
1052
|
-
return false;
|
|
1053
|
-
};
|
|
1054
|
-
return arrayMatcher;
|
|
1055
|
-
}
|
|
1056
|
-
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
1057
|
-
if (glob === "" || (typeof glob !== "string" && !isState)) {
|
|
1058
|
-
throw new TypeError("Expected pattern to be a non-empty string");
|
|
1059
|
-
}
|
|
1060
|
-
const opts = options || {};
|
|
1061
|
-
const posix = opts.windows;
|
|
1062
|
-
const regex = isState
|
|
1063
|
-
? picomatch.compileRe(glob, options)
|
|
1064
|
-
: picomatch.makeRe(glob, options, false, true);
|
|
1065
|
-
const state = regex.state;
|
|
1066
|
-
delete regex.state;
|
|
1067
|
-
let isIgnored = () => false;
|
|
1068
|
-
if (opts.ignore) {
|
|
1069
|
-
const ignoreOpts = {
|
|
1070
|
-
...options,
|
|
1071
|
-
ignore: null,
|
|
1072
|
-
onMatch: null,
|
|
1073
|
-
onResult: null,
|
|
1074
|
-
};
|
|
1075
|
-
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
1076
|
-
}
|
|
1077
|
-
const matcher = (input, returnObject = false) => {
|
|
1078
|
-
const { isMatch, match, output } = picomatch.test(
|
|
1079
|
-
input,
|
|
1080
|
-
regex,
|
|
1081
|
-
options,
|
|
1082
|
-
{ glob, posix },
|
|
1083
|
-
);
|
|
1084
|
-
const result = {
|
|
1085
|
-
glob,
|
|
1086
|
-
state,
|
|
1087
|
-
regex,
|
|
1088
|
-
posix,
|
|
1089
|
-
input,
|
|
1090
|
-
output,
|
|
1091
|
-
match,
|
|
1092
|
-
isMatch,
|
|
1093
|
-
};
|
|
1094
|
-
if (typeof opts.onResult === "function") {
|
|
1095
|
-
opts.onResult(result);
|
|
1096
|
-
}
|
|
1097
|
-
if (isMatch === false) {
|
|
1098
|
-
result.isMatch = false;
|
|
1099
|
-
return returnObject ? result : false;
|
|
1100
|
-
}
|
|
1101
|
-
if (isIgnored(input)) {
|
|
1102
|
-
if (typeof opts.onIgnore === "function") {
|
|
1103
|
-
opts.onIgnore(result);
|
|
1104
|
-
}
|
|
1105
|
-
result.isMatch = false;
|
|
1106
|
-
return returnObject ? result : false;
|
|
1107
|
-
}
|
|
1108
|
-
if (typeof opts.onMatch === "function") {
|
|
1109
|
-
opts.onMatch(result);
|
|
1110
|
-
}
|
|
1111
|
-
return returnObject ? result : true;
|
|
1112
|
-
};
|
|
1113
|
-
if (returnState) {
|
|
1114
|
-
matcher.state = state;
|
|
1115
|
-
}
|
|
1116
|
-
return matcher;
|
|
1117
|
-
};
|
|
1118
|
-
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
1119
|
-
if (typeof input !== "string") {
|
|
1120
|
-
throw new TypeError("Expected input to be a string");
|
|
1121
|
-
}
|
|
1122
|
-
if (input === "") {
|
|
1123
|
-
return { isMatch: false, output: "" };
|
|
1124
|
-
}
|
|
1125
|
-
const opts = options || {};
|
|
1126
|
-
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
1127
|
-
let match = input === glob;
|
|
1128
|
-
let output = match && format ? format(input) : input;
|
|
1129
|
-
if (match === false) {
|
|
1130
|
-
output = format ? format(input) : input;
|
|
1131
|
-
match = output === glob;
|
|
1132
|
-
}
|
|
1133
|
-
if (match === false || opts.capture === true) {
|
|
1134
|
-
if (opts.matchBase === true || opts.basename === true) {
|
|
1135
|
-
match = picomatch.matchBase(input, regex, options, posix);
|
|
1136
|
-
} else {
|
|
1137
|
-
match = regex.exec(output);
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
return { isMatch: Boolean(match), match, output };
|
|
1141
|
-
};
|
|
1142
|
-
picomatch.matchBase = (input, glob, options) => {
|
|
1143
|
-
const regex =
|
|
1144
|
-
glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
1145
|
-
return regex.test(utils.basename(input));
|
|
1146
|
-
};
|
|
1147
|
-
picomatch.isMatch = (str, patterns, options) =>
|
|
1148
|
-
picomatch(patterns, options)(str);
|
|
1149
|
-
picomatch.parse = (pattern, options) => {
|
|
1150
|
-
if (Array.isArray(pattern))
|
|
1151
|
-
return pattern.map((p) => picomatch.parse(p, options));
|
|
1152
|
-
return parse(pattern, { ...options, fastpaths: false });
|
|
1153
|
-
};
|
|
1154
|
-
picomatch.scan = (input, options) => scan(input, options);
|
|
1155
|
-
picomatch.compileRe = (
|
|
1156
|
-
state,
|
|
1157
|
-
options,
|
|
1158
|
-
returnOutput = false,
|
|
1159
|
-
returnState = false,
|
|
1160
|
-
) => {
|
|
1161
|
-
if (returnOutput === true) {
|
|
1162
|
-
return state.output;
|
|
1163
|
-
}
|
|
1164
|
-
const opts = options || {};
|
|
1165
|
-
const prepend = opts.contains ? "" : "^";
|
|
1166
|
-
const append = opts.contains ? "" : "$";
|
|
1167
|
-
let source = `${prepend}(?:${state.output})${append}`;
|
|
1168
|
-
if (state && state.negated === true) {
|
|
1169
|
-
source = `^(?!${source}).*$`;
|
|
1170
|
-
}
|
|
1171
|
-
const regex = picomatch.toRegex(source, options);
|
|
1172
|
-
if (returnState === true) {
|
|
1173
|
-
regex.state = state;
|
|
1174
|
-
}
|
|
1175
|
-
return regex;
|
|
1176
|
-
};
|
|
1177
|
-
picomatch.makeRe = (
|
|
1178
|
-
input,
|
|
1179
|
-
options = {},
|
|
1180
|
-
returnOutput = false,
|
|
1181
|
-
returnState = false,
|
|
1182
|
-
) => {
|
|
1183
|
-
if (!input || typeof input !== "string") {
|
|
1184
|
-
throw new TypeError("Expected a non-empty string");
|
|
1185
|
-
}
|
|
1186
|
-
let parsed = { negated: false, fastpaths: true };
|
|
1187
|
-
if (
|
|
1188
|
-
options.fastpaths !== false &&
|
|
1189
|
-
(input[0] === "." || input[0] === "*")
|
|
1190
|
-
) {
|
|
1191
|
-
parsed.output = parse.fastpaths(input, options);
|
|
1192
|
-
}
|
|
1193
|
-
if (!parsed.output) {
|
|
1194
|
-
parsed = parse(input, options);
|
|
1195
|
-
}
|
|
1196
|
-
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
1197
|
-
};
|
|
1198
|
-
picomatch.toRegex = (source, options) => {
|
|
1199
|
-
try {
|
|
1200
|
-
const opts = options || {};
|
|
1201
|
-
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
1202
|
-
} catch (err) {
|
|
1203
|
-
if (options && options.debug === true) throw err;
|
|
1204
|
-
return /$^/;
|
|
1205
|
-
}
|
|
1206
|
-
};
|
|
1207
|
-
picomatch.constants = constants;
|
|
1208
|
-
module.exports = picomatch;
|
|
1209
|
-
},
|
|
1210
|
-
279: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1211
|
-
"use strict";
|
|
1212
|
-
const utils = __nccwpck_require__(473);
|
|
1213
|
-
const {
|
|
1214
|
-
CHAR_ASTERISK,
|
|
1215
|
-
CHAR_AT,
|
|
1216
|
-
CHAR_BACKWARD_SLASH,
|
|
1217
|
-
CHAR_COMMA,
|
|
1218
|
-
CHAR_DOT,
|
|
1219
|
-
CHAR_EXCLAMATION_MARK,
|
|
1220
|
-
CHAR_FORWARD_SLASH,
|
|
1221
|
-
CHAR_LEFT_CURLY_BRACE,
|
|
1222
|
-
CHAR_LEFT_PARENTHESES,
|
|
1223
|
-
CHAR_LEFT_SQUARE_BRACKET,
|
|
1224
|
-
CHAR_PLUS,
|
|
1225
|
-
CHAR_QUESTION_MARK,
|
|
1226
|
-
CHAR_RIGHT_CURLY_BRACE,
|
|
1227
|
-
CHAR_RIGHT_PARENTHESES,
|
|
1228
|
-
CHAR_RIGHT_SQUARE_BRACKET,
|
|
1229
|
-
} = __nccwpck_require__(717);
|
|
1230
|
-
const isPathSeparator = (code) =>
|
|
1231
|
-
code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
1232
|
-
const depth = (token) => {
|
|
1233
|
-
if (token.isPrefix !== true) {
|
|
1234
|
-
token.depth = token.isGlobstar ? Infinity : 1;
|
|
1235
|
-
}
|
|
1236
|
-
};
|
|
1237
|
-
const scan = (input, options) => {
|
|
1238
|
-
const opts = options || {};
|
|
1239
|
-
const length = input.length - 1;
|
|
1240
|
-
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
1241
|
-
const slashes = [];
|
|
1242
|
-
const tokens = [];
|
|
1243
|
-
const parts = [];
|
|
1244
|
-
let str = input;
|
|
1245
|
-
let index = -1;
|
|
1246
|
-
let start = 0;
|
|
1247
|
-
let lastIndex = 0;
|
|
1248
|
-
let isBrace = false;
|
|
1249
|
-
let isBracket = false;
|
|
1250
|
-
let isGlob = false;
|
|
1251
|
-
let isExtglob = false;
|
|
1252
|
-
let isGlobstar = false;
|
|
1253
|
-
let braceEscaped = false;
|
|
1254
|
-
let backslashes = false;
|
|
1255
|
-
let negated = false;
|
|
1256
|
-
let negatedExtglob = false;
|
|
1257
|
-
let finished = false;
|
|
1258
|
-
let braces = 0;
|
|
1259
|
-
let prev;
|
|
1260
|
-
let code;
|
|
1261
|
-
let token = { value: "", depth: 0, isGlob: false };
|
|
1262
|
-
const eos = () => index >= length;
|
|
1263
|
-
const peek = () => str.charCodeAt(index + 1);
|
|
1264
|
-
const advance = () => {
|
|
1265
|
-
prev = code;
|
|
1266
|
-
return str.charCodeAt(++index);
|
|
1267
|
-
};
|
|
1268
|
-
while (index < length) {
|
|
1269
|
-
code = advance();
|
|
1270
|
-
let next;
|
|
1271
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
1272
|
-
backslashes = token.backslashes = true;
|
|
1273
|
-
code = advance();
|
|
1274
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
1275
|
-
braceEscaped = true;
|
|
1276
|
-
}
|
|
1277
|
-
continue;
|
|
1278
|
-
}
|
|
1279
|
-
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
1280
|
-
braces++;
|
|
1281
|
-
while (eos() !== true && (code = advance())) {
|
|
1282
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
1283
|
-
backslashes = token.backslashes = true;
|
|
1284
|
-
advance();
|
|
1285
|
-
continue;
|
|
1286
|
-
}
|
|
1287
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
1288
|
-
braces++;
|
|
1289
|
-
continue;
|
|
1290
|
-
}
|
|
1291
|
-
if (
|
|
1292
|
-
braceEscaped !== true &&
|
|
1293
|
-
code === CHAR_DOT &&
|
|
1294
|
-
(code = advance()) === CHAR_DOT
|
|
1295
|
-
) {
|
|
1296
|
-
isBrace = token.isBrace = true;
|
|
1297
|
-
isGlob = token.isGlob = true;
|
|
1298
|
-
finished = true;
|
|
1299
|
-
if (scanToEnd === true) {
|
|
1300
|
-
continue;
|
|
1301
|
-
}
|
|
1302
|
-
break;
|
|
1303
|
-
}
|
|
1304
|
-
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
1305
|
-
isBrace = token.isBrace = true;
|
|
1306
|
-
isGlob = token.isGlob = true;
|
|
1307
|
-
finished = true;
|
|
1308
|
-
if (scanToEnd === true) {
|
|
1309
|
-
continue;
|
|
1310
|
-
}
|
|
1311
|
-
break;
|
|
1312
|
-
}
|
|
1313
|
-
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
1314
|
-
braces--;
|
|
1315
|
-
if (braces === 0) {
|
|
1316
|
-
braceEscaped = false;
|
|
1317
|
-
isBrace = token.isBrace = true;
|
|
1318
|
-
finished = true;
|
|
1319
|
-
break;
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
if (scanToEnd === true) {
|
|
1324
|
-
continue;
|
|
1325
|
-
}
|
|
1326
|
-
break;
|
|
1327
|
-
}
|
|
1328
|
-
if (code === CHAR_FORWARD_SLASH) {
|
|
1329
|
-
slashes.push(index);
|
|
1330
|
-
tokens.push(token);
|
|
1331
|
-
token = { value: "", depth: 0, isGlob: false };
|
|
1332
|
-
if (finished === true) continue;
|
|
1333
|
-
if (prev === CHAR_DOT && index === start + 1) {
|
|
1334
|
-
start += 2;
|
|
1335
|
-
continue;
|
|
1336
|
-
}
|
|
1337
|
-
lastIndex = index + 1;
|
|
1338
|
-
continue;
|
|
1339
|
-
}
|
|
1340
|
-
if (opts.noext !== true) {
|
|
1341
|
-
const isExtglobChar =
|
|
1342
|
-
code === CHAR_PLUS ||
|
|
1343
|
-
code === CHAR_AT ||
|
|
1344
|
-
code === CHAR_ASTERISK ||
|
|
1345
|
-
code === CHAR_QUESTION_MARK ||
|
|
1346
|
-
code === CHAR_EXCLAMATION_MARK;
|
|
1347
|
-
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
1348
|
-
isGlob = token.isGlob = true;
|
|
1349
|
-
isExtglob = token.isExtglob = true;
|
|
1350
|
-
finished = true;
|
|
1351
|
-
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
1352
|
-
negatedExtglob = true;
|
|
1353
|
-
}
|
|
1354
|
-
if (scanToEnd === true) {
|
|
1355
|
-
while (eos() !== true && (code = advance())) {
|
|
1356
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
1357
|
-
backslashes = token.backslashes = true;
|
|
1358
|
-
code = advance();
|
|
1359
|
-
continue;
|
|
1360
|
-
}
|
|
1361
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1362
|
-
isGlob = token.isGlob = true;
|
|
1363
|
-
finished = true;
|
|
1364
|
-
break;
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
continue;
|
|
1368
|
-
}
|
|
1369
|
-
break;
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
if (code === CHAR_ASTERISK) {
|
|
1373
|
-
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
1374
|
-
isGlob = token.isGlob = true;
|
|
1375
|
-
finished = true;
|
|
1376
|
-
if (scanToEnd === true) {
|
|
1377
|
-
continue;
|
|
1378
|
-
}
|
|
1379
|
-
break;
|
|
1380
|
-
}
|
|
1381
|
-
if (code === CHAR_QUESTION_MARK) {
|
|
1382
|
-
isGlob = token.isGlob = true;
|
|
1383
|
-
finished = true;
|
|
1384
|
-
if (scanToEnd === true) {
|
|
1385
|
-
continue;
|
|
1386
|
-
}
|
|
1387
|
-
break;
|
|
1388
|
-
}
|
|
1389
|
-
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
1390
|
-
while (eos() !== true && (next = advance())) {
|
|
1391
|
-
if (next === CHAR_BACKWARD_SLASH) {
|
|
1392
|
-
backslashes = token.backslashes = true;
|
|
1393
|
-
advance();
|
|
1394
|
-
continue;
|
|
1395
|
-
}
|
|
1396
|
-
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
1397
|
-
isBracket = token.isBracket = true;
|
|
1398
|
-
isGlob = token.isGlob = true;
|
|
1399
|
-
finished = true;
|
|
1400
|
-
break;
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
if (scanToEnd === true) {
|
|
1404
|
-
continue;
|
|
1405
|
-
}
|
|
1406
|
-
break;
|
|
1407
|
-
}
|
|
1408
|
-
if (
|
|
1409
|
-
opts.nonegate !== true &&
|
|
1410
|
-
code === CHAR_EXCLAMATION_MARK &&
|
|
1411
|
-
index === start
|
|
1412
|
-
) {
|
|
1413
|
-
negated = token.negated = true;
|
|
1414
|
-
start++;
|
|
1415
|
-
continue;
|
|
1416
|
-
}
|
|
1417
|
-
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
1418
|
-
isGlob = token.isGlob = true;
|
|
1419
|
-
if (scanToEnd === true) {
|
|
1420
|
-
while (eos() !== true && (code = advance())) {
|
|
1421
|
-
if (code === CHAR_LEFT_PARENTHESES) {
|
|
1422
|
-
backslashes = token.backslashes = true;
|
|
1423
|
-
code = advance();
|
|
1424
|
-
continue;
|
|
1425
|
-
}
|
|
1426
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1427
|
-
finished = true;
|
|
1428
|
-
break;
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
continue;
|
|
1432
|
-
}
|
|
1433
|
-
break;
|
|
1434
|
-
}
|
|
1435
|
-
if (isGlob === true) {
|
|
1436
|
-
finished = true;
|
|
1437
|
-
if (scanToEnd === true) {
|
|
1438
|
-
continue;
|
|
1439
|
-
}
|
|
1440
|
-
break;
|
|
1441
|
-
}
|
|
1442
|
-
}
|
|
1443
|
-
if (opts.noext === true) {
|
|
1444
|
-
isExtglob = false;
|
|
1445
|
-
isGlob = false;
|
|
1446
|
-
}
|
|
1447
|
-
let base = str;
|
|
1448
|
-
let prefix = "";
|
|
1449
|
-
let glob = "";
|
|
1450
|
-
if (start > 0) {
|
|
1451
|
-
prefix = str.slice(0, start);
|
|
1452
|
-
str = str.slice(start);
|
|
1453
|
-
lastIndex -= start;
|
|
1454
|
-
}
|
|
1455
|
-
if (base && isGlob === true && lastIndex > 0) {
|
|
1456
|
-
base = str.slice(0, lastIndex);
|
|
1457
|
-
glob = str.slice(lastIndex);
|
|
1458
|
-
} else if (isGlob === true) {
|
|
1459
|
-
base = "";
|
|
1460
|
-
glob = str;
|
|
1461
|
-
} else {
|
|
1462
|
-
base = str;
|
|
1463
|
-
}
|
|
1464
|
-
if (base && base !== "" && base !== "/" && base !== str) {
|
|
1465
|
-
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
1466
|
-
base = base.slice(0, -1);
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
|
-
if (opts.unescape === true) {
|
|
1470
|
-
if (glob) glob = utils.removeBackslashes(glob);
|
|
1471
|
-
if (base && backslashes === true) {
|
|
1472
|
-
base = utils.removeBackslashes(base);
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
const state = {
|
|
1476
|
-
prefix,
|
|
1477
|
-
input,
|
|
1478
|
-
start,
|
|
1479
|
-
base,
|
|
1480
|
-
glob,
|
|
1481
|
-
isBrace,
|
|
1482
|
-
isBracket,
|
|
1483
|
-
isGlob,
|
|
1484
|
-
isExtglob,
|
|
1485
|
-
isGlobstar,
|
|
1486
|
-
negated,
|
|
1487
|
-
negatedExtglob,
|
|
1488
|
-
};
|
|
1489
|
-
if (opts.tokens === true) {
|
|
1490
|
-
state.maxDepth = 0;
|
|
1491
|
-
if (!isPathSeparator(code)) {
|
|
1492
|
-
tokens.push(token);
|
|
1493
|
-
}
|
|
1494
|
-
state.tokens = tokens;
|
|
1495
|
-
}
|
|
1496
|
-
if (opts.parts === true || opts.tokens === true) {
|
|
1497
|
-
let prevIndex;
|
|
1498
|
-
for (let idx = 0; idx < slashes.length; idx++) {
|
|
1499
|
-
const n = prevIndex ? prevIndex + 1 : start;
|
|
1500
|
-
const i = slashes[idx];
|
|
1501
|
-
const value = input.slice(n, i);
|
|
1502
|
-
if (opts.tokens) {
|
|
1503
|
-
if (idx === 0 && start !== 0) {
|
|
1504
|
-
tokens[idx].isPrefix = true;
|
|
1505
|
-
tokens[idx].value = prefix;
|
|
1506
|
-
} else {
|
|
1507
|
-
tokens[idx].value = value;
|
|
1508
|
-
}
|
|
1509
|
-
depth(tokens[idx]);
|
|
1510
|
-
state.maxDepth += tokens[idx].depth;
|
|
1511
|
-
}
|
|
1512
|
-
if (idx !== 0 || value !== "") {
|
|
1513
|
-
parts.push(value);
|
|
1514
|
-
}
|
|
1515
|
-
prevIndex = i;
|
|
1516
|
-
}
|
|
1517
|
-
if (prevIndex && prevIndex + 1 < input.length) {
|
|
1518
|
-
const value = input.slice(prevIndex + 1);
|
|
1519
|
-
parts.push(value);
|
|
1520
|
-
if (opts.tokens) {
|
|
1521
|
-
tokens[tokens.length - 1].value = value;
|
|
1522
|
-
depth(tokens[tokens.length - 1]);
|
|
1523
|
-
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
state.slashes = slashes;
|
|
1527
|
-
state.parts = parts;
|
|
1528
|
-
}
|
|
1529
|
-
return state;
|
|
1530
|
-
};
|
|
1531
|
-
module.exports = scan;
|
|
1532
|
-
},
|
|
1533
|
-
473: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
1534
|
-
"use strict";
|
|
1535
|
-
const {
|
|
1536
|
-
REGEX_BACKSLASH,
|
|
1537
|
-
REGEX_REMOVE_BACKSLASH,
|
|
1538
|
-
REGEX_SPECIAL_CHARS,
|
|
1539
|
-
REGEX_SPECIAL_CHARS_GLOBAL,
|
|
1540
|
-
} = __nccwpck_require__(717);
|
|
1541
|
-
exports.isObject = (val) =>
|
|
1542
|
-
val !== null && typeof val === "object" && !Array.isArray(val);
|
|
1543
|
-
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
1544
|
-
exports.isRegexChar = (str) =>
|
|
1545
|
-
str.length === 1 && exports.hasRegexChars(str);
|
|
1546
|
-
exports.escapeRegex = (str) =>
|
|
1547
|
-
str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
1548
|
-
exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
1549
|
-
exports.isWindows = () => {
|
|
1550
|
-
if (typeof navigator !== "undefined" && navigator.platform) {
|
|
1551
|
-
const platform = navigator.platform.toLowerCase();
|
|
1552
|
-
return platform === "win32" || platform === "windows";
|
|
1553
|
-
}
|
|
1554
|
-
if (typeof process !== "undefined" && process.platform) {
|
|
1555
|
-
return process.platform === "win32";
|
|
1556
|
-
}
|
|
1557
|
-
return false;
|
|
1558
|
-
};
|
|
1559
|
-
exports.removeBackslashes = (str) =>
|
|
1560
|
-
str.replace(REGEX_REMOVE_BACKSLASH, (match) =>
|
|
1561
|
-
match === "\\" ? "" : match,
|
|
1562
|
-
);
|
|
1563
|
-
exports.escapeLast = (input, char, lastIdx) => {
|
|
1564
|
-
const idx = input.lastIndexOf(char, lastIdx);
|
|
1565
|
-
if (idx === -1) return input;
|
|
1566
|
-
if (input[idx - 1] === "\\")
|
|
1567
|
-
return exports.escapeLast(input, char, idx - 1);
|
|
1568
|
-
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
1569
|
-
};
|
|
1570
|
-
exports.removePrefix = (input, state = {}) => {
|
|
1571
|
-
let output = input;
|
|
1572
|
-
if (output.startsWith("./")) {
|
|
1573
|
-
output = output.slice(2);
|
|
1574
|
-
state.prefix = "./";
|
|
1575
|
-
}
|
|
1576
|
-
return output;
|
|
1577
|
-
};
|
|
1578
|
-
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
1579
|
-
const prepend = options.contains ? "" : "^";
|
|
1580
|
-
const append = options.contains ? "" : "$";
|
|
1581
|
-
let output = `${prepend}(?:${input})${append}`;
|
|
1582
|
-
if (state.negated === true) {
|
|
1583
|
-
output = `(?:^(?!${output}).*$)`;
|
|
1584
|
-
}
|
|
1585
|
-
return output;
|
|
1586
|
-
};
|
|
1587
|
-
exports.basename = (path, { windows } = {}) => {
|
|
1588
|
-
const segs = path.split(windows ? /[\\/]/ : "/");
|
|
1589
|
-
const last = segs[segs.length - 1];
|
|
1590
|
-
if (last === "") {
|
|
1591
|
-
return segs[segs.length - 2];
|
|
1592
|
-
}
|
|
1593
|
-
return last;
|
|
1594
|
-
};
|
|
1595
|
-
},
|
|
1596
|
-
896: (module) => {
|
|
1597
|
-
"use strict";
|
|
1598
|
-
module.exports = require("fs");
|
|
1599
|
-
},
|
|
1600
|
-
928: (module) => {
|
|
1601
|
-
"use strict";
|
|
1602
|
-
module.exports = require("path");
|
|
1603
|
-
},
|
|
1604
|
-
278: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
1605
|
-
var __create = Object.create;
|
|
1606
|
-
var __defProp = Object.defineProperty;
|
|
1607
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1608
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1609
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
1610
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1611
|
-
var __copyProps = (to, from, except, desc) => {
|
|
1612
|
-
if ((from && typeof from === "object") || typeof from === "function")
|
|
1613
|
-
for (
|
|
1614
|
-
var keys = __getOwnPropNames(from), i = 0, n = keys.length, key;
|
|
1615
|
-
i < n;
|
|
1616
|
-
i++
|
|
1617
|
-
) {
|
|
1618
|
-
key = keys[i];
|
|
1619
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
1620
|
-
__defProp(to, key, {
|
|
1621
|
-
get: ((k) => from[k]).bind(null, key),
|
|
1622
|
-
enumerable:
|
|
1623
|
-
!(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
1624
|
-
});
|
|
1625
|
-
}
|
|
1626
|
-
return to;
|
|
1627
|
-
};
|
|
1628
|
-
var __toESM = (mod, isNodeMode, target) => (
|
|
1629
|
-
(target = mod != null ? __create(__getProtoOf(mod)) : {}),
|
|
1630
|
-
__copyProps(
|
|
1631
|
-
isNodeMode || !mod || !mod.__esModule
|
|
1632
|
-
? __defProp(target, "default", { value: mod, enumerable: true })
|
|
1633
|
-
: target,
|
|
1634
|
-
mod,
|
|
1635
|
-
)
|
|
1636
|
-
);
|
|
1637
|
-
const path = __toESM(__nccwpck_require__(928));
|
|
1638
|
-
const fs = __toESM(__nccwpck_require__(896));
|
|
1639
|
-
function cleanPath(path$1) {
|
|
1640
|
-
let normalized = (0, path.normalize)(path$1);
|
|
1641
|
-
if (
|
|
1642
|
-
normalized.length > 1 &&
|
|
1643
|
-
normalized[normalized.length - 1] === path.sep
|
|
1644
|
-
)
|
|
1645
|
-
normalized = normalized.substring(0, normalized.length - 1);
|
|
1646
|
-
return normalized;
|
|
1647
|
-
}
|
|
1648
|
-
const SLASHES_REGEX = /[\\/]/g;
|
|
1649
|
-
function convertSlashes(path$1, separator) {
|
|
1650
|
-
return path$1.replace(SLASHES_REGEX, separator);
|
|
1651
|
-
}
|
|
1652
|
-
const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
|
|
1653
|
-
function isRootDirectory(path$1) {
|
|
1654
|
-
return path$1 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path$1);
|
|
1655
|
-
}
|
|
1656
|
-
function normalizePath(path$1, options) {
|
|
1657
|
-
const {
|
|
1658
|
-
resolvePaths,
|
|
1659
|
-
normalizePath: normalizePath$1,
|
|
1660
|
-
pathSeparator,
|
|
1661
|
-
} = options;
|
|
1662
|
-
const pathNeedsCleaning =
|
|
1663
|
-
(process.platform === "win32" && path$1.includes("/")) ||
|
|
1664
|
-
path$1.startsWith(".");
|
|
1665
|
-
if (resolvePaths) path$1 = (0, path.resolve)(path$1);
|
|
1666
|
-
if (normalizePath$1 || pathNeedsCleaning) path$1 = cleanPath(path$1);
|
|
1667
|
-
if (path$1 === ".") return "";
|
|
1668
|
-
const needsSeperator = path$1[path$1.length - 1] !== pathSeparator;
|
|
1669
|
-
return convertSlashes(
|
|
1670
|
-
needsSeperator ? path$1 + pathSeparator : path$1,
|
|
1671
|
-
pathSeparator,
|
|
1672
|
-
);
|
|
1673
|
-
}
|
|
1674
|
-
function joinPathWithBasePath(filename, directoryPath) {
|
|
1675
|
-
return directoryPath + filename;
|
|
1676
|
-
}
|
|
1677
|
-
function joinPathWithRelativePath(root, options) {
|
|
1678
|
-
return function (filename, directoryPath) {
|
|
1679
|
-
const sameRoot = directoryPath.startsWith(root);
|
|
1680
|
-
if (sameRoot) return directoryPath.slice(root.length) + filename;
|
|
1681
|
-
else
|
|
1682
|
-
return (
|
|
1683
|
-
convertSlashes(
|
|
1684
|
-
(0, path.relative)(root, directoryPath),
|
|
1685
|
-
options.pathSeparator,
|
|
1686
|
-
) +
|
|
1687
|
-
options.pathSeparator +
|
|
1688
|
-
filename
|
|
1689
|
-
);
|
|
1690
|
-
};
|
|
1691
|
-
}
|
|
1692
|
-
function joinPath(filename) {
|
|
1693
|
-
return filename;
|
|
1694
|
-
}
|
|
1695
|
-
function joinDirectoryPath(filename, directoryPath, separator) {
|
|
1696
|
-
return directoryPath + filename + separator;
|
|
1697
|
-
}
|
|
1698
|
-
function build$7(root, options) {
|
|
1699
|
-
const { relativePaths, includeBasePath } = options;
|
|
1700
|
-
return relativePaths && root
|
|
1701
|
-
? joinPathWithRelativePath(root, options)
|
|
1702
|
-
: includeBasePath
|
|
1703
|
-
? joinPathWithBasePath
|
|
1704
|
-
: joinPath;
|
|
1705
|
-
}
|
|
1706
|
-
function pushDirectoryWithRelativePath(root) {
|
|
1707
|
-
return function (directoryPath, paths) {
|
|
1708
|
-
paths.push(directoryPath.substring(root.length) || ".");
|
|
1709
|
-
};
|
|
1710
|
-
}
|
|
1711
|
-
function pushDirectoryFilterWithRelativePath(root) {
|
|
1712
|
-
return function (directoryPath, paths, filters) {
|
|
1713
|
-
const relativePath = directoryPath.substring(root.length) || ".";
|
|
1714
|
-
if (filters.every((filter) => filter(relativePath, true)))
|
|
1715
|
-
paths.push(relativePath);
|
|
1716
|
-
};
|
|
1717
|
-
}
|
|
1718
|
-
const pushDirectory = (directoryPath, paths) => {
|
|
1719
|
-
paths.push(directoryPath || ".");
|
|
1720
|
-
};
|
|
1721
|
-
const pushDirectoryFilter = (directoryPath, paths, filters) => {
|
|
1722
|
-
const path$1 = directoryPath || ".";
|
|
1723
|
-
if (filters.every((filter) => filter(path$1, true))) paths.push(path$1);
|
|
1724
|
-
};
|
|
1725
|
-
const empty$2 = () => {};
|
|
1726
|
-
function build$6(root, options) {
|
|
1727
|
-
const { includeDirs, filters, relativePaths } = options;
|
|
1728
|
-
if (!includeDirs) return empty$2;
|
|
1729
|
-
if (relativePaths)
|
|
1730
|
-
return filters && filters.length
|
|
1731
|
-
? pushDirectoryFilterWithRelativePath(root)
|
|
1732
|
-
: pushDirectoryWithRelativePath(root);
|
|
1733
|
-
return filters && filters.length ? pushDirectoryFilter : pushDirectory;
|
|
1734
|
-
}
|
|
1735
|
-
const pushFileFilterAndCount = (filename, _paths, counts, filters) => {
|
|
1736
|
-
if (filters.every((filter) => filter(filename, false))) counts.files++;
|
|
1737
|
-
};
|
|
1738
|
-
const pushFileFilter = (filename, paths, _counts, filters) => {
|
|
1739
|
-
if (filters.every((filter) => filter(filename, false)))
|
|
1740
|
-
paths.push(filename);
|
|
1741
|
-
};
|
|
1742
|
-
const pushFileCount = (_filename, _paths, counts, _filters) => {
|
|
1743
|
-
counts.files++;
|
|
1744
|
-
};
|
|
1745
|
-
const pushFile = (filename, paths) => {
|
|
1746
|
-
paths.push(filename);
|
|
1747
|
-
};
|
|
1748
|
-
const empty$1 = () => {};
|
|
1749
|
-
function build$5(options) {
|
|
1750
|
-
const { excludeFiles, filters, onlyCounts } = options;
|
|
1751
|
-
if (excludeFiles) return empty$1;
|
|
1752
|
-
if (filters && filters.length)
|
|
1753
|
-
return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
|
|
1754
|
-
else if (onlyCounts) return pushFileCount;
|
|
1755
|
-
else return pushFile;
|
|
1756
|
-
}
|
|
1757
|
-
const getArray = (paths) => paths;
|
|
1758
|
-
const getArrayGroup = () => [""].slice(0, 0);
|
|
1759
|
-
function build$4(options) {
|
|
1760
|
-
return options.group ? getArrayGroup : getArray;
|
|
1761
|
-
}
|
|
1762
|
-
const groupFiles = (groups, directory, files) => {
|
|
1763
|
-
groups.push({ directory, files, dir: directory });
|
|
1764
|
-
};
|
|
1765
|
-
const empty = () => {};
|
|
1766
|
-
function build$3(options) {
|
|
1767
|
-
return options.group ? groupFiles : empty;
|
|
1768
|
-
}
|
|
1769
|
-
const resolveSymlinksAsync = function (path$1, state, callback$1) {
|
|
1770
|
-
const {
|
|
1771
|
-
queue,
|
|
1772
|
-
fs: fs$1,
|
|
1773
|
-
options: { suppressErrors },
|
|
1774
|
-
} = state;
|
|
1775
|
-
queue.enqueue();
|
|
1776
|
-
fs$1.realpath(path$1, (error, resolvedPath) => {
|
|
1777
|
-
if (error) return queue.dequeue(suppressErrors ? null : error, state);
|
|
1778
|
-
fs$1.stat(resolvedPath, (error$1, stat) => {
|
|
1779
|
-
if (error$1)
|
|
1780
|
-
return queue.dequeue(suppressErrors ? null : error$1, state);
|
|
1781
|
-
if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state))
|
|
1782
|
-
return queue.dequeue(null, state);
|
|
1783
|
-
callback$1(stat, resolvedPath);
|
|
1784
|
-
queue.dequeue(null, state);
|
|
1785
|
-
});
|
|
1786
|
-
});
|
|
1787
|
-
};
|
|
1788
|
-
const resolveSymlinks = function (path$1, state, callback$1) {
|
|
1789
|
-
const {
|
|
1790
|
-
queue,
|
|
1791
|
-
fs: fs$1,
|
|
1792
|
-
options: { suppressErrors },
|
|
1793
|
-
} = state;
|
|
1794
|
-
queue.enqueue();
|
|
1795
|
-
try {
|
|
1796
|
-
const resolvedPath = fs$1.realpathSync(path$1);
|
|
1797
|
-
const stat = fs$1.statSync(resolvedPath);
|
|
1798
|
-
if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state))
|
|
1799
|
-
return;
|
|
1800
|
-
callback$1(stat, resolvedPath);
|
|
1801
|
-
} catch (e) {
|
|
1802
|
-
if (!suppressErrors) throw e;
|
|
1803
|
-
}
|
|
1804
|
-
};
|
|
1805
|
-
function build$2(options, isSynchronous) {
|
|
1806
|
-
if (!options.resolveSymlinks || options.excludeSymlinks) return null;
|
|
1807
|
-
return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
|
|
1808
|
-
}
|
|
1809
|
-
function isRecursive(path$1, resolved, state) {
|
|
1810
|
-
if (state.options.useRealPaths)
|
|
1811
|
-
return isRecursiveUsingRealPaths(resolved, state);
|
|
1812
|
-
let parent = (0, path.dirname)(path$1);
|
|
1813
|
-
let depth = 1;
|
|
1814
|
-
while (parent !== state.root && depth < 2) {
|
|
1815
|
-
const resolvedPath = state.symlinks.get(parent);
|
|
1816
|
-
const isSameRoot =
|
|
1817
|
-
!!resolvedPath &&
|
|
1818
|
-
(resolvedPath === resolved ||
|
|
1819
|
-
resolvedPath.startsWith(resolved) ||
|
|
1820
|
-
resolved.startsWith(resolvedPath));
|
|
1821
|
-
if (isSameRoot) depth++;
|
|
1822
|
-
else parent = (0, path.dirname)(parent);
|
|
1823
|
-
}
|
|
1824
|
-
state.symlinks.set(path$1, resolved);
|
|
1825
|
-
return depth > 1;
|
|
1826
|
-
}
|
|
1827
|
-
function isRecursiveUsingRealPaths(resolved, state) {
|
|
1828
|
-
return state.visited.includes(resolved + state.options.pathSeparator);
|
|
1829
|
-
}
|
|
1830
|
-
const onlyCountsSync = (state) => state.counts;
|
|
1831
|
-
const groupsSync = (state) => state.groups;
|
|
1832
|
-
const defaultSync = (state) => state.paths;
|
|
1833
|
-
const limitFilesSync = (state) =>
|
|
1834
|
-
state.paths.slice(0, state.options.maxFiles);
|
|
1835
|
-
const onlyCountsAsync = (state, error, callback$1) => {
|
|
1836
|
-
report(error, callback$1, state.counts, state.options.suppressErrors);
|
|
1837
|
-
return null;
|
|
1838
|
-
};
|
|
1839
|
-
const defaultAsync = (state, error, callback$1) => {
|
|
1840
|
-
report(error, callback$1, state.paths, state.options.suppressErrors);
|
|
1841
|
-
return null;
|
|
1842
|
-
};
|
|
1843
|
-
const limitFilesAsync = (state, error, callback$1) => {
|
|
1844
|
-
report(
|
|
1845
|
-
error,
|
|
1846
|
-
callback$1,
|
|
1847
|
-
state.paths.slice(0, state.options.maxFiles),
|
|
1848
|
-
state.options.suppressErrors,
|
|
1849
|
-
);
|
|
1850
|
-
return null;
|
|
1851
|
-
};
|
|
1852
|
-
const groupsAsync = (state, error, callback$1) => {
|
|
1853
|
-
report(error, callback$1, state.groups, state.options.suppressErrors);
|
|
1854
|
-
return null;
|
|
1855
|
-
};
|
|
1856
|
-
function report(error, callback$1, output, suppressErrors) {
|
|
1857
|
-
if (error && !suppressErrors) callback$1(error, output);
|
|
1858
|
-
else callback$1(null, output);
|
|
1859
|
-
}
|
|
1860
|
-
function build$1(options, isSynchronous) {
|
|
1861
|
-
const { onlyCounts, group, maxFiles } = options;
|
|
1862
|
-
if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
|
|
1863
|
-
else if (group) return isSynchronous ? groupsSync : groupsAsync;
|
|
1864
|
-
else if (maxFiles)
|
|
1865
|
-
return isSynchronous ? limitFilesSync : limitFilesAsync;
|
|
1866
|
-
else return isSynchronous ? defaultSync : defaultAsync;
|
|
1867
|
-
}
|
|
1868
|
-
const readdirOpts = { withFileTypes: true };
|
|
1869
|
-
const walkAsync = (
|
|
1870
|
-
state,
|
|
1871
|
-
crawlPath,
|
|
1872
|
-
directoryPath,
|
|
1873
|
-
currentDepth,
|
|
1874
|
-
callback$1,
|
|
1875
|
-
) => {
|
|
1876
|
-
state.queue.enqueue();
|
|
1877
|
-
if (currentDepth < 0) return state.queue.dequeue(null, state);
|
|
1878
|
-
const { fs: fs$1 } = state;
|
|
1879
|
-
state.visited.push(crawlPath);
|
|
1880
|
-
state.counts.directories++;
|
|
1881
|
-
fs$1.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
|
|
1882
|
-
callback$1(entries, directoryPath, currentDepth);
|
|
1883
|
-
state.queue.dequeue(
|
|
1884
|
-
state.options.suppressErrors ? null : error,
|
|
1885
|
-
state,
|
|
1886
|
-
);
|
|
1887
|
-
});
|
|
1888
|
-
};
|
|
1889
|
-
const walkSync = (
|
|
1890
|
-
state,
|
|
1891
|
-
crawlPath,
|
|
1892
|
-
directoryPath,
|
|
1893
|
-
currentDepth,
|
|
1894
|
-
callback$1,
|
|
1895
|
-
) => {
|
|
1896
|
-
const { fs: fs$1 } = state;
|
|
1897
|
-
if (currentDepth < 0) return;
|
|
1898
|
-
state.visited.push(crawlPath);
|
|
1899
|
-
state.counts.directories++;
|
|
1900
|
-
let entries = [];
|
|
1901
|
-
try {
|
|
1902
|
-
entries = fs$1.readdirSync(crawlPath || ".", readdirOpts);
|
|
1903
|
-
} catch (e) {
|
|
1904
|
-
if (!state.options.suppressErrors) throw e;
|
|
1905
|
-
}
|
|
1906
|
-
callback$1(entries, directoryPath, currentDepth);
|
|
1907
|
-
};
|
|
1908
|
-
function build(isSynchronous) {
|
|
1909
|
-
return isSynchronous ? walkSync : walkAsync;
|
|
1910
|
-
}
|
|
1911
|
-
var Queue = class {
|
|
1912
|
-
count = 0;
|
|
1913
|
-
constructor(onQueueEmpty) {
|
|
1914
|
-
this.onQueueEmpty = onQueueEmpty;
|
|
1915
|
-
}
|
|
1916
|
-
enqueue() {
|
|
1917
|
-
this.count++;
|
|
1918
|
-
return this.count;
|
|
1919
|
-
}
|
|
1920
|
-
dequeue(error, output) {
|
|
1921
|
-
if (this.onQueueEmpty && (--this.count <= 0 || error)) {
|
|
1922
|
-
this.onQueueEmpty(error, output);
|
|
1923
|
-
if (error) {
|
|
1924
|
-
output.controller.abort();
|
|
1925
|
-
this.onQueueEmpty = void 0;
|
|
1926
|
-
}
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
};
|
|
1930
|
-
var Counter = class {
|
|
1931
|
-
_files = 0;
|
|
1932
|
-
_directories = 0;
|
|
1933
|
-
set files(num) {
|
|
1934
|
-
this._files = num;
|
|
1935
|
-
}
|
|
1936
|
-
get files() {
|
|
1937
|
-
return this._files;
|
|
1938
|
-
}
|
|
1939
|
-
set directories(num) {
|
|
1940
|
-
this._directories = num;
|
|
1941
|
-
}
|
|
1942
|
-
get directories() {
|
|
1943
|
-
return this._directories;
|
|
1944
|
-
}
|
|
1945
|
-
get dirs() {
|
|
1946
|
-
return this._directories;
|
|
1947
|
-
}
|
|
1948
|
-
};
|
|
1949
|
-
var Aborter = class {
|
|
1950
|
-
aborted = false;
|
|
1951
|
-
abort() {
|
|
1952
|
-
this.aborted = true;
|
|
1953
|
-
}
|
|
1954
|
-
};
|
|
1955
|
-
var Walker = class {
|
|
1956
|
-
root;
|
|
1957
|
-
isSynchronous;
|
|
1958
|
-
state;
|
|
1959
|
-
joinPath;
|
|
1960
|
-
pushDirectory;
|
|
1961
|
-
pushFile;
|
|
1962
|
-
getArray;
|
|
1963
|
-
groupFiles;
|
|
1964
|
-
resolveSymlink;
|
|
1965
|
-
walkDirectory;
|
|
1966
|
-
callbackInvoker;
|
|
1967
|
-
constructor(root, options, callback$1) {
|
|
1968
|
-
this.isSynchronous = !callback$1;
|
|
1969
|
-
this.callbackInvoker = build$1(options, this.isSynchronous);
|
|
1970
|
-
this.root = normalizePath(root, options);
|
|
1971
|
-
this.state = {
|
|
1972
|
-
root: isRootDirectory(this.root)
|
|
1973
|
-
? this.root
|
|
1974
|
-
: this.root.slice(0, -1),
|
|
1975
|
-
paths: [""].slice(0, 0),
|
|
1976
|
-
groups: [],
|
|
1977
|
-
counts: new Counter(),
|
|
1978
|
-
options,
|
|
1979
|
-
queue: new Queue((error, state) =>
|
|
1980
|
-
this.callbackInvoker(state, error, callback$1),
|
|
1981
|
-
),
|
|
1982
|
-
symlinks: new Map(),
|
|
1983
|
-
visited: [""].slice(0, 0),
|
|
1984
|
-
controller: new Aborter(),
|
|
1985
|
-
fs: options.fs || fs,
|
|
1986
|
-
};
|
|
1987
|
-
this.joinPath = build$7(this.root, options);
|
|
1988
|
-
this.pushDirectory = build$6(this.root, options);
|
|
1989
|
-
this.pushFile = build$5(options);
|
|
1990
|
-
this.getArray = build$4(options);
|
|
1991
|
-
this.groupFiles = build$3(options);
|
|
1992
|
-
this.resolveSymlink = build$2(options, this.isSynchronous);
|
|
1993
|
-
this.walkDirectory = build(this.isSynchronous);
|
|
1994
|
-
}
|
|
1995
|
-
start() {
|
|
1996
|
-
this.pushDirectory(
|
|
1997
|
-
this.root,
|
|
1998
|
-
this.state.paths,
|
|
1999
|
-
this.state.options.filters,
|
|
2000
|
-
);
|
|
2001
|
-
this.walkDirectory(
|
|
2002
|
-
this.state,
|
|
2003
|
-
this.root,
|
|
2004
|
-
this.root,
|
|
2005
|
-
this.state.options.maxDepth,
|
|
2006
|
-
this.walk,
|
|
2007
|
-
);
|
|
2008
|
-
return this.isSynchronous
|
|
2009
|
-
? this.callbackInvoker(this.state, null)
|
|
2010
|
-
: null;
|
|
2011
|
-
}
|
|
2012
|
-
walk = (entries, directoryPath, depth) => {
|
|
2013
|
-
const {
|
|
2014
|
-
paths,
|
|
2015
|
-
options: {
|
|
2016
|
-
filters,
|
|
2017
|
-
resolveSymlinks: resolveSymlinks$1,
|
|
2018
|
-
excludeSymlinks,
|
|
2019
|
-
exclude,
|
|
2020
|
-
maxFiles,
|
|
2021
|
-
signal,
|
|
2022
|
-
useRealPaths,
|
|
2023
|
-
pathSeparator,
|
|
2024
|
-
},
|
|
2025
|
-
controller,
|
|
2026
|
-
} = this.state;
|
|
2027
|
-
if (
|
|
2028
|
-
controller.aborted ||
|
|
2029
|
-
(signal && signal.aborted) ||
|
|
2030
|
-
(maxFiles && paths.length > maxFiles)
|
|
2031
|
-
)
|
|
2032
|
-
return;
|
|
2033
|
-
const files = this.getArray(this.state.paths);
|
|
2034
|
-
for (let i = 0; i < entries.length; ++i) {
|
|
2035
|
-
const entry = entries[i];
|
|
2036
|
-
if (
|
|
2037
|
-
entry.isFile() ||
|
|
2038
|
-
(entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks)
|
|
2039
|
-
) {
|
|
2040
|
-
const filename = this.joinPath(entry.name, directoryPath);
|
|
2041
|
-
this.pushFile(filename, files, this.state.counts, filters);
|
|
2042
|
-
} else if (entry.isDirectory()) {
|
|
2043
|
-
let path$1 = joinDirectoryPath(
|
|
2044
|
-
entry.name,
|
|
2045
|
-
directoryPath,
|
|
2046
|
-
this.state.options.pathSeparator,
|
|
2047
|
-
);
|
|
2048
|
-
if (exclude && exclude(entry.name, path$1)) continue;
|
|
2049
|
-
this.pushDirectory(path$1, paths, filters);
|
|
2050
|
-
this.walkDirectory(
|
|
2051
|
-
this.state,
|
|
2052
|
-
path$1,
|
|
2053
|
-
path$1,
|
|
2054
|
-
depth - 1,
|
|
2055
|
-
this.walk,
|
|
2056
|
-
);
|
|
2057
|
-
} else if (this.resolveSymlink && entry.isSymbolicLink()) {
|
|
2058
|
-
let path$1 = joinPathWithBasePath(entry.name, directoryPath);
|
|
2059
|
-
this.resolveSymlink(path$1, this.state, (stat, resolvedPath) => {
|
|
2060
|
-
if (stat.isDirectory()) {
|
|
2061
|
-
resolvedPath = normalizePath(
|
|
2062
|
-
resolvedPath,
|
|
2063
|
-
this.state.options,
|
|
2064
|
-
);
|
|
2065
|
-
if (
|
|
2066
|
-
exclude &&
|
|
2067
|
-
exclude(
|
|
2068
|
-
entry.name,
|
|
2069
|
-
useRealPaths ? resolvedPath : path$1 + pathSeparator,
|
|
2070
|
-
)
|
|
2071
|
-
)
|
|
2072
|
-
return;
|
|
2073
|
-
this.walkDirectory(
|
|
2074
|
-
this.state,
|
|
2075
|
-
resolvedPath,
|
|
2076
|
-
useRealPaths ? resolvedPath : path$1 + pathSeparator,
|
|
2077
|
-
depth - 1,
|
|
2078
|
-
this.walk,
|
|
2079
|
-
);
|
|
2080
|
-
} else {
|
|
2081
|
-
resolvedPath = useRealPaths ? resolvedPath : path$1;
|
|
2082
|
-
const filename = (0, path.basename)(resolvedPath);
|
|
2083
|
-
const directoryPath$1 = normalizePath(
|
|
2084
|
-
(0, path.dirname)(resolvedPath),
|
|
2085
|
-
this.state.options,
|
|
2086
|
-
);
|
|
2087
|
-
resolvedPath = this.joinPath(filename, directoryPath$1);
|
|
2088
|
-
this.pushFile(
|
|
2089
|
-
resolvedPath,
|
|
2090
|
-
files,
|
|
2091
|
-
this.state.counts,
|
|
2092
|
-
filters,
|
|
2093
|
-
);
|
|
2094
|
-
}
|
|
2095
|
-
});
|
|
2096
|
-
}
|
|
2097
|
-
}
|
|
2098
|
-
this.groupFiles(this.state.groups, directoryPath, files);
|
|
2099
|
-
};
|
|
2100
|
-
};
|
|
2101
|
-
function promise(root, options) {
|
|
2102
|
-
return new Promise((resolve$1, reject) => {
|
|
2103
|
-
callback(root, options, (err, output) => {
|
|
2104
|
-
if (err) return reject(err);
|
|
2105
|
-
resolve$1(output);
|
|
2106
|
-
});
|
|
2107
|
-
});
|
|
2108
|
-
}
|
|
2109
|
-
function callback(root, options, callback$1) {
|
|
2110
|
-
let walker = new Walker(root, options, callback$1);
|
|
2111
|
-
walker.start();
|
|
2112
|
-
}
|
|
2113
|
-
function sync(root, options) {
|
|
2114
|
-
const walker = new Walker(root, options);
|
|
2115
|
-
return walker.start();
|
|
2116
|
-
}
|
|
2117
|
-
var APIBuilder = class {
|
|
2118
|
-
constructor(root, options) {
|
|
2119
|
-
this.root = root;
|
|
2120
|
-
this.options = options;
|
|
2121
|
-
}
|
|
2122
|
-
withPromise() {
|
|
2123
|
-
return promise(this.root, this.options);
|
|
2124
|
-
}
|
|
2125
|
-
withCallback(cb) {
|
|
2126
|
-
callback(this.root, this.options, cb);
|
|
2127
|
-
}
|
|
2128
|
-
sync() {
|
|
2129
|
-
return sync(this.root, this.options);
|
|
2130
|
-
}
|
|
2131
|
-
};
|
|
2132
|
-
let pm = null;
|
|
2133
|
-
try {
|
|
2134
|
-
676;
|
|
2135
|
-
pm = __nccwpck_require__(676);
|
|
2136
|
-
} catch {}
|
|
2137
|
-
var Builder = class {
|
|
2138
|
-
globCache = {};
|
|
2139
|
-
options = {
|
|
2140
|
-
maxDepth: Infinity,
|
|
2141
|
-
suppressErrors: true,
|
|
2142
|
-
pathSeparator: path.sep,
|
|
2143
|
-
filters: [],
|
|
2144
|
-
};
|
|
2145
|
-
globFunction;
|
|
2146
|
-
constructor(options) {
|
|
2147
|
-
this.options = { ...this.options, ...options };
|
|
2148
|
-
this.globFunction = this.options.globFunction;
|
|
2149
|
-
}
|
|
2150
|
-
group() {
|
|
2151
|
-
this.options.group = true;
|
|
2152
|
-
return this;
|
|
2153
|
-
}
|
|
2154
|
-
withPathSeparator(separator) {
|
|
2155
|
-
this.options.pathSeparator = separator;
|
|
2156
|
-
return this;
|
|
2157
|
-
}
|
|
2158
|
-
withBasePath() {
|
|
2159
|
-
this.options.includeBasePath = true;
|
|
2160
|
-
return this;
|
|
2161
|
-
}
|
|
2162
|
-
withRelativePaths() {
|
|
2163
|
-
this.options.relativePaths = true;
|
|
2164
|
-
return this;
|
|
2165
|
-
}
|
|
2166
|
-
withDirs() {
|
|
2167
|
-
this.options.includeDirs = true;
|
|
2168
|
-
return this;
|
|
2169
|
-
}
|
|
2170
|
-
withMaxDepth(depth) {
|
|
2171
|
-
this.options.maxDepth = depth;
|
|
2172
|
-
return this;
|
|
2173
|
-
}
|
|
2174
|
-
withMaxFiles(limit) {
|
|
2175
|
-
this.options.maxFiles = limit;
|
|
2176
|
-
return this;
|
|
2177
|
-
}
|
|
2178
|
-
withFullPaths() {
|
|
2179
|
-
this.options.resolvePaths = true;
|
|
2180
|
-
this.options.includeBasePath = true;
|
|
2181
|
-
return this;
|
|
2182
|
-
}
|
|
2183
|
-
withErrors() {
|
|
2184
|
-
this.options.suppressErrors = false;
|
|
2185
|
-
return this;
|
|
2186
|
-
}
|
|
2187
|
-
withSymlinks({ resolvePaths = true } = {}) {
|
|
2188
|
-
this.options.resolveSymlinks = true;
|
|
2189
|
-
this.options.useRealPaths = resolvePaths;
|
|
2190
|
-
return this.withFullPaths();
|
|
2191
|
-
}
|
|
2192
|
-
withAbortSignal(signal) {
|
|
2193
|
-
this.options.signal = signal;
|
|
2194
|
-
return this;
|
|
2195
|
-
}
|
|
2196
|
-
normalize() {
|
|
2197
|
-
this.options.normalizePath = true;
|
|
2198
|
-
return this;
|
|
2199
|
-
}
|
|
2200
|
-
filter(predicate) {
|
|
2201
|
-
this.options.filters.push(predicate);
|
|
2202
|
-
return this;
|
|
2203
|
-
}
|
|
2204
|
-
onlyDirs() {
|
|
2205
|
-
this.options.excludeFiles = true;
|
|
2206
|
-
this.options.includeDirs = true;
|
|
2207
|
-
return this;
|
|
2208
|
-
}
|
|
2209
|
-
exclude(predicate) {
|
|
2210
|
-
this.options.exclude = predicate;
|
|
2211
|
-
return this;
|
|
2212
|
-
}
|
|
2213
|
-
onlyCounts() {
|
|
2214
|
-
this.options.onlyCounts = true;
|
|
2215
|
-
return this;
|
|
2216
|
-
}
|
|
2217
|
-
crawl(root) {
|
|
2218
|
-
return new APIBuilder(root || ".", this.options);
|
|
2219
|
-
}
|
|
2220
|
-
withGlobFunction(fn) {
|
|
2221
|
-
this.globFunction = fn;
|
|
2222
|
-
return this;
|
|
2223
|
-
}
|
|
2224
|
-
crawlWithOptions(root, options) {
|
|
2225
|
-
this.options = { ...this.options, ...options };
|
|
2226
|
-
return new APIBuilder(root || ".", this.options);
|
|
2227
|
-
}
|
|
2228
|
-
glob(...patterns) {
|
|
2229
|
-
if (this.globFunction) return this.globWithOptions(patterns);
|
|
2230
|
-
return this.globWithOptions(patterns, ...[{ dot: true }]);
|
|
2231
|
-
}
|
|
2232
|
-
globWithOptions(patterns, ...options) {
|
|
2233
|
-
const globFn = this.globFunction || pm;
|
|
2234
|
-
if (!globFn)
|
|
2235
|
-
throw new Error(
|
|
2236
|
-
"Please specify a glob function to use glob matching.",
|
|
2237
|
-
);
|
|
2238
|
-
var isMatch = this.globCache[patterns.join("\0")];
|
|
2239
|
-
if (!isMatch) {
|
|
2240
|
-
isMatch = globFn(patterns, ...options);
|
|
2241
|
-
this.globCache[patterns.join("\0")] = isMatch;
|
|
2242
|
-
}
|
|
2243
|
-
this.options.filters.push((path$1) => isMatch(path$1));
|
|
2244
|
-
return this;
|
|
2245
|
-
}
|
|
2246
|
-
};
|
|
2247
|
-
exports.fdir = Builder;
|
|
2248
|
-
},
|
|
2249
|
-
};
|
|
2250
|
-
var __webpack_module_cache__ = {};
|
|
2251
|
-
function __nccwpck_require__(moduleId) {
|
|
2252
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
2253
|
-
if (cachedModule !== undefined) {
|
|
2254
|
-
return cachedModule.exports;
|
|
2255
|
-
}
|
|
2256
|
-
var module = (__webpack_module_cache__[moduleId] = { exports: {} });
|
|
2257
|
-
var threw = true;
|
|
2258
|
-
try {
|
|
2259
|
-
__webpack_modules__[moduleId](
|
|
2260
|
-
module,
|
|
2261
|
-
module.exports,
|
|
2262
|
-
__nccwpck_require__,
|
|
2263
|
-
);
|
|
2264
|
-
threw = false;
|
|
2265
|
-
} finally {
|
|
2266
|
-
if (threw) delete __webpack_module_cache__[moduleId];
|
|
2267
|
-
}
|
|
2268
|
-
return module.exports;
|
|
2269
|
-
}
|
|
2270
|
-
if (typeof __nccwpck_require__ !== "undefined")
|
|
2271
|
-
__nccwpck_require__.ab = __dirname + "/";
|
|
2272
|
-
var __webpack_exports__ = {};
|
|
2273
|
-
(() => {
|
|
2274
|
-
var exports = __webpack_exports__;
|
|
2275
|
-
var __create = Object.create;
|
|
2276
|
-
var __defProp = Object.defineProperty;
|
|
2277
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2278
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2279
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
2280
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2281
|
-
var __copyProps = (to, from, except, desc) => {
|
|
2282
|
-
if ((from && typeof from === "object") || typeof from === "function")
|
|
2283
|
-
for (
|
|
2284
|
-
var keys = __getOwnPropNames(from), i = 0, n = keys.length, key;
|
|
2285
|
-
i < n;
|
|
2286
|
-
i++
|
|
2287
|
-
) {
|
|
2288
|
-
key = keys[i];
|
|
2289
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
2290
|
-
__defProp(to, key, {
|
|
2291
|
-
get: ((k) => from[k]).bind(null, key),
|
|
2292
|
-
enumerable:
|
|
2293
|
-
!(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
|
|
2294
|
-
});
|
|
2295
|
-
}
|
|
2296
|
-
return to;
|
|
2297
|
-
};
|
|
2298
|
-
var __toESM = (mod, isNodeMode, target) => (
|
|
2299
|
-
(target = mod != null ? __create(__getProtoOf(mod)) : {}),
|
|
2300
|
-
__copyProps(
|
|
2301
|
-
isNodeMode || !mod || !mod.__esModule
|
|
2302
|
-
? __defProp(target, "default", { value: mod, enumerable: true })
|
|
2303
|
-
: target,
|
|
2304
|
-
mod,
|
|
2305
|
-
)
|
|
2306
|
-
);
|
|
2307
|
-
const path = __toESM(__nccwpck_require__(928));
|
|
2308
|
-
const fdir = __toESM(__nccwpck_require__(278));
|
|
2309
|
-
const picomatch = __toESM(__nccwpck_require__(676));
|
|
2310
|
-
const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
2311
|
-
function getPartialMatcher(patterns, options) {
|
|
2312
|
-
const patternsCount = patterns.length;
|
|
2313
|
-
const patternsParts = Array(patternsCount);
|
|
2314
|
-
const regexes = Array(patternsCount);
|
|
2315
|
-
for (let i = 0; i < patternsCount; i++) {
|
|
2316
|
-
const parts = splitPattern(patterns[i]);
|
|
2317
|
-
patternsParts[i] = parts;
|
|
2318
|
-
const partsCount = parts.length;
|
|
2319
|
-
const partRegexes = Array(partsCount);
|
|
2320
|
-
for (let j = 0; j < partsCount; j++)
|
|
2321
|
-
partRegexes[j] = picomatch.default.makeRe(parts[j], options);
|
|
2322
|
-
regexes[i] = partRegexes;
|
|
2323
|
-
}
|
|
2324
|
-
return (input) => {
|
|
2325
|
-
const inputParts = input.split("/");
|
|
2326
|
-
if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input))
|
|
2327
|
-
return true;
|
|
2328
|
-
for (let i = 0; i < patterns.length; i++) {
|
|
2329
|
-
const patternParts = patternsParts[i];
|
|
2330
|
-
const regex = regexes[i];
|
|
2331
|
-
const inputPatternCount = inputParts.length;
|
|
2332
|
-
const minParts = Math.min(inputPatternCount, patternParts.length);
|
|
2333
|
-
let j = 0;
|
|
2334
|
-
while (j < minParts) {
|
|
2335
|
-
const part = patternParts[j];
|
|
2336
|
-
if (part.includes("/")) return true;
|
|
2337
|
-
const match = regex[j].test(inputParts[j]);
|
|
2338
|
-
if (!match) break;
|
|
2339
|
-
if (part === "**") return true;
|
|
2340
|
-
j++;
|
|
2341
|
-
}
|
|
2342
|
-
if (j === inputPatternCount) return true;
|
|
2343
|
-
}
|
|
2344
|
-
return false;
|
|
2345
|
-
};
|
|
2346
|
-
}
|
|
2347
|
-
const splitPatternOptions = { parts: true };
|
|
2348
|
-
function splitPattern(path$2) {
|
|
2349
|
-
var _result$parts;
|
|
2350
|
-
const result = picomatch.default.scan(path$2, splitPatternOptions);
|
|
2351
|
-
return (
|
|
2352
|
-
(_result$parts = result.parts) === null || _result$parts === void 0
|
|
2353
|
-
? void 0
|
|
2354
|
-
: _result$parts.length
|
|
2355
|
-
)
|
|
2356
|
-
? result.parts
|
|
2357
|
-
: [path$2];
|
|
2358
|
-
}
|
|
2359
|
-
const isWin = process.platform === "win32";
|
|
2360
|
-
const ESCAPED_WIN32_BACKSLASHES = /\\(?![()[\]{}!+@])/g;
|
|
2361
|
-
function convertPosixPathToPattern(path$2) {
|
|
2362
|
-
return escapePosixPath(path$2);
|
|
2363
|
-
}
|
|
2364
|
-
function convertWin32PathToPattern(path$2) {
|
|
2365
|
-
return escapeWin32Path(path$2).replace(ESCAPED_WIN32_BACKSLASHES, "/");
|
|
2366
|
-
}
|
|
2367
|
-
const convertPathToPattern = isWin
|
|
2368
|
-
? convertWin32PathToPattern
|
|
2369
|
-
: convertPosixPathToPattern;
|
|
2370
|
-
const POSIX_UNESCAPED_GLOB_SYMBOLS =
|
|
2371
|
-
/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
2372
|
-
const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
2373
|
-
const escapePosixPath = (path$2) =>
|
|
2374
|
-
path$2.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
2375
|
-
const escapeWin32Path = (path$2) =>
|
|
2376
|
-
path$2.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
2377
|
-
const escapePath = isWin ? escapeWin32Path : escapePosixPath;
|
|
2378
|
-
function isDynamicPattern(pattern, options) {
|
|
2379
|
-
if (
|
|
2380
|
-
(options === null || options === void 0
|
|
2381
|
-
? void 0
|
|
2382
|
-
: options.caseSensitiveMatch) === false
|
|
2383
|
-
)
|
|
2384
|
-
return true;
|
|
2385
|
-
const scan = picomatch.default.scan(pattern);
|
|
2386
|
-
return scan.isGlob || scan.negated;
|
|
2387
|
-
}
|
|
2388
|
-
function log(...tasks) {
|
|
2389
|
-
console.log(
|
|
2390
|
-
`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,
|
|
2391
|
-
...tasks,
|
|
2392
|
-
);
|
|
2393
|
-
}
|
|
2394
|
-
const PARENT_DIRECTORY = /^(\/?\.\.)+/;
|
|
2395
|
-
const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
|
|
2396
|
-
const BACKSLASHES = /\\/g;
|
|
2397
|
-
function normalizePattern(
|
|
2398
|
-
pattern,
|
|
2399
|
-
expandDirectories,
|
|
2400
|
-
cwd,
|
|
2401
|
-
props,
|
|
2402
|
-
isIgnore,
|
|
2403
|
-
) {
|
|
2404
|
-
let result = pattern;
|
|
2405
|
-
if (pattern.endsWith("/")) result = pattern.slice(0, -1);
|
|
2406
|
-
if (!result.endsWith("*") && expandDirectories) result += "/**";
|
|
2407
|
-
const escapedCwd = escapePath(cwd);
|
|
2408
|
-
if (path.default.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")))
|
|
2409
|
-
result = path.posix.relative(escapedCwd, result);
|
|
2410
|
-
else result = path.posix.normalize(result);
|
|
2411
|
-
const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
|
|
2412
|
-
const parts = splitPattern(result);
|
|
2413
|
-
if (
|
|
2414
|
-
parentDirectoryMatch === null || parentDirectoryMatch === void 0
|
|
2415
|
-
? void 0
|
|
2416
|
-
: parentDirectoryMatch[0]
|
|
2417
|
-
) {
|
|
2418
|
-
const n = (parentDirectoryMatch[0].length + 1) / 3;
|
|
2419
|
-
let i = 0;
|
|
2420
|
-
const cwdParts = escapedCwd.split("/");
|
|
2421
|
-
while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
|
|
2422
|
-
result =
|
|
2423
|
-
result.slice(0, (n - i - 1) * 3) +
|
|
2424
|
-
result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
|
|
2425
|
-
i++;
|
|
2426
|
-
}
|
|
2427
|
-
const potentialRoot = path.posix.join(
|
|
2428
|
-
cwd,
|
|
2429
|
-
parentDirectoryMatch[0].slice(i * 3),
|
|
2430
|
-
);
|
|
2431
|
-
if (
|
|
2432
|
-
!potentialRoot.startsWith(".") &&
|
|
2433
|
-
props.root.length > potentialRoot.length
|
|
2434
|
-
) {
|
|
2435
|
-
props.root = potentialRoot;
|
|
2436
|
-
props.depthOffset = -n + i;
|
|
2437
|
-
}
|
|
2438
|
-
}
|
|
2439
|
-
if (!isIgnore && props.depthOffset >= 0) {
|
|
2440
|
-
var _props$commonPath;
|
|
2441
|
-
((_props$commonPath = props.commonPath) !== null &&
|
|
2442
|
-
_props$commonPath !== void 0) ||
|
|
2443
|
-
(props.commonPath = parts);
|
|
2444
|
-
const newCommonPath = [];
|
|
2445
|
-
const length = Math.min(props.commonPath.length, parts.length);
|
|
2446
|
-
for (let i = 0; i < length; i++) {
|
|
2447
|
-
const part = parts[i];
|
|
2448
|
-
if (part === "**" && !parts[i + 1]) {
|
|
2449
|
-
newCommonPath.pop();
|
|
2450
|
-
break;
|
|
2451
|
-
}
|
|
2452
|
-
if (
|
|
2453
|
-
part !== props.commonPath[i] ||
|
|
2454
|
-
isDynamicPattern(part) ||
|
|
2455
|
-
i === parts.length - 1
|
|
2456
|
-
)
|
|
2457
|
-
break;
|
|
2458
|
-
newCommonPath.push(part);
|
|
2459
|
-
}
|
|
2460
|
-
props.depthOffset = newCommonPath.length;
|
|
2461
|
-
props.commonPath = newCommonPath;
|
|
2462
|
-
props.root =
|
|
2463
|
-
newCommonPath.length > 0
|
|
2464
|
-
? path.default.posix.join(cwd, ...newCommonPath)
|
|
2465
|
-
: cwd;
|
|
2466
|
-
}
|
|
2467
|
-
return result;
|
|
2468
|
-
}
|
|
2469
|
-
function processPatterns(
|
|
2470
|
-
{ patterns, ignore = [], expandDirectories = true },
|
|
2471
|
-
cwd,
|
|
2472
|
-
props,
|
|
2473
|
-
) {
|
|
2474
|
-
if (typeof patterns === "string") patterns = [patterns];
|
|
2475
|
-
else if (!patterns) patterns = ["**/*"];
|
|
2476
|
-
if (typeof ignore === "string") ignore = [ignore];
|
|
2477
|
-
const matchPatterns = [];
|
|
2478
|
-
const ignorePatterns = [];
|
|
2479
|
-
for (const pattern of ignore) {
|
|
2480
|
-
if (!pattern) continue;
|
|
2481
|
-
if (pattern[0] !== "!" || pattern[1] === "(")
|
|
2482
|
-
ignorePatterns.push(
|
|
2483
|
-
normalizePattern(pattern, expandDirectories, cwd, props, true),
|
|
2484
|
-
);
|
|
2485
|
-
}
|
|
2486
|
-
for (const pattern of patterns) {
|
|
2487
|
-
if (!pattern) continue;
|
|
2488
|
-
if (pattern[0] !== "!" || pattern[1] === "(")
|
|
2489
|
-
matchPatterns.push(
|
|
2490
|
-
normalizePattern(pattern, expandDirectories, cwd, props, false),
|
|
2491
|
-
);
|
|
2492
|
-
else if (pattern[1] !== "!" || pattern[2] === "(")
|
|
2493
|
-
ignorePatterns.push(
|
|
2494
|
-
normalizePattern(
|
|
2495
|
-
pattern.slice(1),
|
|
2496
|
-
expandDirectories,
|
|
2497
|
-
cwd,
|
|
2498
|
-
props,
|
|
2499
|
-
true,
|
|
2500
|
-
),
|
|
2501
|
-
);
|
|
2502
|
-
}
|
|
2503
|
-
return { match: matchPatterns, ignore: ignorePatterns };
|
|
2504
|
-
}
|
|
2505
|
-
function getRelativePath(path$2, cwd, root) {
|
|
2506
|
-
return path.posix.relative(cwd, `${root}/${path$2}`) || ".";
|
|
2507
|
-
}
|
|
2508
|
-
function processPath(path$2, cwd, root, isDirectory, absolute) {
|
|
2509
|
-
const relativePath = absolute
|
|
2510
|
-
? path$2.slice(root === "/" ? 1 : root.length + 1) || "."
|
|
2511
|
-
: path$2;
|
|
2512
|
-
if (root === cwd)
|
|
2513
|
-
return isDirectory && relativePath !== "."
|
|
2514
|
-
? relativePath.slice(0, -1)
|
|
2515
|
-
: relativePath;
|
|
2516
|
-
return getRelativePath(relativePath, cwd, root);
|
|
2517
|
-
}
|
|
2518
|
-
function formatPaths(paths, cwd, root) {
|
|
2519
|
-
for (let i = paths.length - 1; i >= 0; i--) {
|
|
2520
|
-
const path$2 = paths[i];
|
|
2521
|
-
paths[i] =
|
|
2522
|
-
getRelativePath(path$2, cwd, root) +
|
|
2523
|
-
(!path$2 || path$2.endsWith("/") ? "/" : "");
|
|
2524
|
-
}
|
|
2525
|
-
return paths;
|
|
2526
|
-
}
|
|
2527
|
-
function crawl(options, cwd, sync) {
|
|
2528
|
-
if (process.env.TINYGLOBBY_DEBUG) options.debug = true;
|
|
2529
|
-
if (options.debug) log("globbing with options:", options, "cwd:", cwd);
|
|
2530
|
-
if (Array.isArray(options.patterns) && options.patterns.length === 0)
|
|
2531
|
-
return sync ? [] : Promise.resolve([]);
|
|
2532
|
-
const props = { root: cwd, commonPath: null, depthOffset: 0 };
|
|
2533
|
-
const processed = processPatterns(options, cwd, props);
|
|
2534
|
-
const nocase = options.caseSensitiveMatch === false;
|
|
2535
|
-
if (options.debug) log("internal processing patterns:", processed);
|
|
2536
|
-
const matcher = (0, picomatch.default)(processed.match, {
|
|
2537
|
-
dot: options.dot,
|
|
2538
|
-
nocase,
|
|
2539
|
-
ignore: processed.ignore,
|
|
2540
|
-
});
|
|
2541
|
-
const ignore = (0, picomatch.default)(processed.ignore, {
|
|
2542
|
-
dot: options.dot,
|
|
2543
|
-
nocase,
|
|
2544
|
-
});
|
|
2545
|
-
const partialMatcher = getPartialMatcher(processed.match, {
|
|
2546
|
-
dot: options.dot,
|
|
2547
|
-
nocase,
|
|
2548
|
-
});
|
|
2549
|
-
const fdirOptions = {
|
|
2550
|
-
filters: [
|
|
2551
|
-
options.debug
|
|
2552
|
-
? (p, isDirectory) => {
|
|
2553
|
-
const path$2 = processPath(
|
|
2554
|
-
p,
|
|
2555
|
-
cwd,
|
|
2556
|
-
props.root,
|
|
2557
|
-
isDirectory,
|
|
2558
|
-
options.absolute,
|
|
2559
|
-
);
|
|
2560
|
-
const matches = matcher(path$2);
|
|
2561
|
-
if (matches) log(`matched ${path$2}`);
|
|
2562
|
-
return matches;
|
|
2563
|
-
}
|
|
2564
|
-
: (p, isDirectory) =>
|
|
2565
|
-
matcher(
|
|
2566
|
-
processPath(
|
|
2567
|
-
p,
|
|
2568
|
-
cwd,
|
|
2569
|
-
props.root,
|
|
2570
|
-
isDirectory,
|
|
2571
|
-
options.absolute,
|
|
2572
|
-
),
|
|
2573
|
-
),
|
|
2574
|
-
],
|
|
2575
|
-
exclude: options.debug
|
|
2576
|
-
? (_, p) => {
|
|
2577
|
-
const relativePath = processPath(p, cwd, props.root, true, true);
|
|
2578
|
-
const skipped =
|
|
2579
|
-
(relativePath !== "." && !partialMatcher(relativePath)) ||
|
|
2580
|
-
ignore(relativePath);
|
|
2581
|
-
if (skipped) log(`skipped ${p}`);
|
|
2582
|
-
else log(`crawling ${p}`);
|
|
2583
|
-
return skipped;
|
|
2584
|
-
}
|
|
2585
|
-
: (_, p) => {
|
|
2586
|
-
const relativePath = processPath(p, cwd, props.root, true, true);
|
|
2587
|
-
return (
|
|
2588
|
-
(relativePath !== "." && !partialMatcher(relativePath)) ||
|
|
2589
|
-
ignore(relativePath)
|
|
2590
|
-
);
|
|
2591
|
-
},
|
|
2592
|
-
pathSeparator: "/",
|
|
2593
|
-
relativePaths: true,
|
|
2594
|
-
resolveSymlinks: true,
|
|
2595
|
-
};
|
|
2596
|
-
if (options.deep !== void 0)
|
|
2597
|
-
fdirOptions.maxDepth = Math.round(options.deep - props.depthOffset);
|
|
2598
|
-
if (options.absolute) {
|
|
2599
|
-
fdirOptions.relativePaths = false;
|
|
2600
|
-
fdirOptions.resolvePaths = true;
|
|
2601
|
-
fdirOptions.includeBasePath = true;
|
|
2602
|
-
}
|
|
2603
|
-
if (options.followSymbolicLinks === false) {
|
|
2604
|
-
fdirOptions.resolveSymlinks = false;
|
|
2605
|
-
fdirOptions.excludeSymlinks = true;
|
|
2606
|
-
}
|
|
2607
|
-
if (options.onlyDirectories) {
|
|
2608
|
-
fdirOptions.excludeFiles = true;
|
|
2609
|
-
fdirOptions.includeDirs = true;
|
|
2610
|
-
} else if (options.onlyFiles === false) fdirOptions.includeDirs = true;
|
|
2611
|
-
props.root = props.root.replace(BACKSLASHES, "");
|
|
2612
|
-
const root = props.root;
|
|
2613
|
-
if (options.debug) log("internal properties:", props);
|
|
2614
|
-
const api = new fdir.fdir(fdirOptions).crawl(root);
|
|
2615
|
-
if (cwd === root || options.absolute)
|
|
2616
|
-
return sync ? api.sync() : api.withPromise();
|
|
2617
|
-
return sync
|
|
2618
|
-
? formatPaths(api.sync(), cwd, root)
|
|
2619
|
-
: api.withPromise().then((paths) => formatPaths(paths, cwd, root));
|
|
2620
|
-
}
|
|
2621
|
-
async function glob(patternsOrOptions, options) {
|
|
2622
|
-
if (
|
|
2623
|
-
patternsOrOptions &&
|
|
2624
|
-
(options === null || options === void 0 ? void 0 : options.patterns)
|
|
2625
|
-
)
|
|
2626
|
-
throw new Error(
|
|
2627
|
-
"Cannot pass patterns as both an argument and an option",
|
|
2628
|
-
);
|
|
2629
|
-
const opts =
|
|
2630
|
-
Array.isArray(patternsOrOptions) ||
|
|
2631
|
-
typeof patternsOrOptions === "string"
|
|
2632
|
-
? { ...options, patterns: patternsOrOptions }
|
|
2633
|
-
: patternsOrOptions;
|
|
2634
|
-
const cwd = opts.cwd
|
|
2635
|
-
? path.default.resolve(opts.cwd).replace(BACKSLASHES, "/")
|
|
2636
|
-
: process.cwd().replace(BACKSLASHES, "/");
|
|
2637
|
-
return crawl(opts, cwd, false);
|
|
2638
|
-
}
|
|
2639
|
-
function globSync(patternsOrOptions, options) {
|
|
2640
|
-
if (
|
|
2641
|
-
patternsOrOptions &&
|
|
2642
|
-
(options === null || options === void 0 ? void 0 : options.patterns)
|
|
2643
|
-
)
|
|
2644
|
-
throw new Error(
|
|
2645
|
-
"Cannot pass patterns as both an argument and an option",
|
|
2646
|
-
);
|
|
2647
|
-
const opts =
|
|
2648
|
-
Array.isArray(patternsOrOptions) ||
|
|
2649
|
-
typeof patternsOrOptions === "string"
|
|
2650
|
-
? { ...options, patterns: patternsOrOptions }
|
|
2651
|
-
: patternsOrOptions;
|
|
2652
|
-
const cwd = opts.cwd
|
|
2653
|
-
? path.default.resolve(opts.cwd).replace(BACKSLASHES, "/")
|
|
2654
|
-
: process.cwd().replace(BACKSLASHES, "/");
|
|
2655
|
-
return crawl(opts, cwd, true);
|
|
2656
|
-
}
|
|
2657
|
-
exports.convertPathToPattern = convertPathToPattern;
|
|
2658
|
-
exports.escapePath = escapePath;
|
|
2659
|
-
exports.glob = glob;
|
|
2660
|
-
exports.globSync = globSync;
|
|
2661
|
-
exports.isDynamicPattern = isDynamicPattern;
|
|
2662
|
-
})();
|
|
2663
|
-
module.exports = __webpack_exports__;
|
|
2664
|
-
})();
|