nitro-nightly 3.0.1-20251203-231615-3a2d2662 → 3.0.1-20251204-201435-0c3150df
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_build/common.mjs +1 -1
- package/dist/_build/rolldown.mjs +9 -10
- package/dist/_build/rollup.mjs +13 -20
- package/dist/_build/vite.build.mjs +12 -14
- package/dist/_build/vite.plugin.mjs +20 -23
- package/dist/_chunks/{Ddt06bL8.mjs → CycPUgTQ.mjs} +1 -1
- package/dist/_chunks/{BY3yPF44.mjs → DT-wSyHv.mjs} +1 -1
- package/dist/_chunks/{CytQIojr.mjs → DzjzT3Xu.mjs} +1 -1
- package/dist/{_dev.mjs → _chunks/dcDd0pkY.mjs} +22 -23
- package/dist/_chunks/{CvxEFBdh.mjs → vCTaGRPD.mjs} +2 -2
- package/dist/_libs/@pi0/vite-plugin-fullstack.mjs +1923 -0
- package/dist/_libs/@rollup/plugin-commonjs.mjs +3859 -0
- package/dist/_libs/{plugin-inject.mjs → @rollup/plugin-inject.mjs} +2 -3
- package/dist/_libs/{plugin-node-resolve.mjs → @rollup/plugin-node-resolve.mjs} +424 -5
- package/dist/_libs/{plugin-replace.mjs → @rollup/plugin-replace.mjs} +1 -1
- package/dist/_libs/estree-walker.mjs +1 -144
- package/dist/_libs/tinyglobby.mjs +1 -2
- package/dist/_libs/unimport.mjs +3 -4
- package/dist/_libs/unwasm.mjs +1 -1
- package/dist/_presets.mjs +2 -2
- package/dist/builder.d.mts +4 -4
- package/dist/builder.mjs +7 -7
- package/dist/cli/_chunks/detect-acorn.mjs +2 -2
- package/dist/cli/_chunks/dev.mjs +2 -2
- package/dist/runtime/internal/vite/{dev-worker.mjs → node-runner.mjs} +30 -5
- package/dist/types/index.d.mts +36 -38
- package/dist/vite.mjs +12 -14
- package/package.json +3 -3
- package/dist/_libs/commondir.mjs +0 -22
- package/dist/_libs/deepmerge.mjs +0 -86
- package/dist/_libs/fdir.mjs +0 -514
- package/dist/_libs/function-bind.mjs +0 -63
- package/dist/_libs/hasown.mjs +0 -14
- package/dist/_libs/is-core-module.mjs +0 -220
- package/dist/_libs/is-module.mjs +0 -13
- package/dist/_libs/is-reference.mjs +0 -33
- package/dist/_libs/js-tokens.mjs +0 -382
- package/dist/_libs/magic-string.mjs +0 -939
- package/dist/_libs/path-parse.mjs +0 -47
- package/dist/_libs/picomatch.mjs +0 -1673
- package/dist/_libs/plugin-commonjs.mjs +0 -1491
- package/dist/_libs/strip-literal.mjs +0 -51
- package/dist/_libs/vite-plugin-fullstack.mjs +0 -561
- /package/dist/_chunks/{DJvLZH4H.mjs → Df3_4Pam.mjs} +0 -0
- /package/dist/_libs/{gen-mapping.mjs → @jridgewell/gen-mapping.mjs} +0 -0
- /package/dist/_libs/{remapping.mjs → @jridgewell/remapping.mjs} +0 -0
- /package/dist/_libs/{plugin-alias.mjs → @rollup/plugin-alias.mjs} +0 -0
- /package/dist/_libs/{plugin-json.mjs → @rollup/plugin-json.mjs} +0 -0
package/dist/_libs/picomatch.mjs
DELETED
|
@@ -1,1673 +0,0 @@
|
|
|
1
|
-
import { t as __commonJSMin } from "../_chunks/QkUO_zA6.mjs";
|
|
2
|
-
|
|
3
|
-
//#region node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js
|
|
4
|
-
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
|
-
const WIN_SLASH = "\\\\/";
|
|
6
|
-
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
7
|
-
/**
|
|
8
|
-
* Posix glob regex
|
|
9
|
-
*/
|
|
10
|
-
const DOT_LITERAL = "\\.";
|
|
11
|
-
const PLUS_LITERAL = "\\+";
|
|
12
|
-
const QMARK_LITERAL = "\\?";
|
|
13
|
-
const SLASH_LITERAL = "\\/";
|
|
14
|
-
const ONE_CHAR = "(?=.)";
|
|
15
|
-
const QMARK = "[^/]";
|
|
16
|
-
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
17
|
-
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
18
|
-
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
19
|
-
const POSIX_CHARS = {
|
|
20
|
-
DOT_LITERAL,
|
|
21
|
-
PLUS_LITERAL,
|
|
22
|
-
QMARK_LITERAL,
|
|
23
|
-
SLASH_LITERAL,
|
|
24
|
-
ONE_CHAR,
|
|
25
|
-
QMARK,
|
|
26
|
-
END_ANCHOR,
|
|
27
|
-
DOTS_SLASH,
|
|
28
|
-
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
29
|
-
NO_DOTS: `(?!${START_ANCHOR}${DOTS_SLASH})`,
|
|
30
|
-
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,
|
|
31
|
-
NO_DOTS_SLASH: `(?!${DOTS_SLASH})`,
|
|
32
|
-
QMARK_NO_DOT: `[^.${SLASH_LITERAL}]`,
|
|
33
|
-
STAR: `${QMARK}*?`,
|
|
34
|
-
START_ANCHOR,
|
|
35
|
-
SEP: "/"
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Windows glob regex
|
|
39
|
-
*/
|
|
40
|
-
const WINDOWS_CHARS = {
|
|
41
|
-
...POSIX_CHARS,
|
|
42
|
-
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
43
|
-
QMARK: WIN_NO_SLASH,
|
|
44
|
-
STAR: `${WIN_NO_SLASH}*?`,
|
|
45
|
-
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
46
|
-
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
47
|
-
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
48
|
-
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
49
|
-
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
50
|
-
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
51
|
-
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
52
|
-
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
|
|
53
|
-
SEP: "\\"
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* POSIX Bracket Regex
|
|
57
|
-
*/
|
|
58
|
-
const POSIX_REGEX_SOURCE$1 = {
|
|
59
|
-
alnum: "a-zA-Z0-9",
|
|
60
|
-
alpha: "a-zA-Z",
|
|
61
|
-
ascii: "\\x00-\\x7F",
|
|
62
|
-
blank: " \\t",
|
|
63
|
-
cntrl: "\\x00-\\x1F\\x7F",
|
|
64
|
-
digit: "0-9",
|
|
65
|
-
graph: "\\x21-\\x7E",
|
|
66
|
-
lower: "a-z",
|
|
67
|
-
print: "\\x20-\\x7E ",
|
|
68
|
-
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
69
|
-
space: " \\t\\r\\n\\v\\f",
|
|
70
|
-
upper: "A-Z",
|
|
71
|
-
word: "A-Za-z0-9_",
|
|
72
|
-
xdigit: "A-Fa-f0-9"
|
|
73
|
-
};
|
|
74
|
-
module.exports = {
|
|
75
|
-
MAX_LENGTH: 1024 * 64,
|
|
76
|
-
POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
|
|
77
|
-
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
78
|
-
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
79
|
-
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
80
|
-
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
81
|
-
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
82
|
-
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
83
|
-
REPLACEMENTS: {
|
|
84
|
-
__proto__: null,
|
|
85
|
-
"***": "*",
|
|
86
|
-
"**/**": "**",
|
|
87
|
-
"**/**/**": "**"
|
|
88
|
-
},
|
|
89
|
-
CHAR_0: 48,
|
|
90
|
-
CHAR_9: 57,
|
|
91
|
-
CHAR_UPPERCASE_A: 65,
|
|
92
|
-
CHAR_LOWERCASE_A: 97,
|
|
93
|
-
CHAR_UPPERCASE_Z: 90,
|
|
94
|
-
CHAR_LOWERCASE_Z: 122,
|
|
95
|
-
CHAR_LEFT_PARENTHESES: 40,
|
|
96
|
-
CHAR_RIGHT_PARENTHESES: 41,
|
|
97
|
-
CHAR_ASTERISK: 42,
|
|
98
|
-
CHAR_AMPERSAND: 38,
|
|
99
|
-
CHAR_AT: 64,
|
|
100
|
-
CHAR_BACKWARD_SLASH: 92,
|
|
101
|
-
CHAR_CARRIAGE_RETURN: 13,
|
|
102
|
-
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
103
|
-
CHAR_COLON: 58,
|
|
104
|
-
CHAR_COMMA: 44,
|
|
105
|
-
CHAR_DOT: 46,
|
|
106
|
-
CHAR_DOUBLE_QUOTE: 34,
|
|
107
|
-
CHAR_EQUAL: 61,
|
|
108
|
-
CHAR_EXCLAMATION_MARK: 33,
|
|
109
|
-
CHAR_FORM_FEED: 12,
|
|
110
|
-
CHAR_FORWARD_SLASH: 47,
|
|
111
|
-
CHAR_GRAVE_ACCENT: 96,
|
|
112
|
-
CHAR_HASH: 35,
|
|
113
|
-
CHAR_HYPHEN_MINUS: 45,
|
|
114
|
-
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
115
|
-
CHAR_LEFT_CURLY_BRACE: 123,
|
|
116
|
-
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
117
|
-
CHAR_LINE_FEED: 10,
|
|
118
|
-
CHAR_NO_BREAK_SPACE: 160,
|
|
119
|
-
CHAR_PERCENT: 37,
|
|
120
|
-
CHAR_PLUS: 43,
|
|
121
|
-
CHAR_QUESTION_MARK: 63,
|
|
122
|
-
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
123
|
-
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
124
|
-
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
125
|
-
CHAR_SEMICOLON: 59,
|
|
126
|
-
CHAR_SINGLE_QUOTE: 39,
|
|
127
|
-
CHAR_SPACE: 32,
|
|
128
|
-
CHAR_TAB: 9,
|
|
129
|
-
CHAR_UNDERSCORE: 95,
|
|
130
|
-
CHAR_VERTICAL_LINE: 124,
|
|
131
|
-
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
132
|
-
extglobChars(chars) {
|
|
133
|
-
return {
|
|
134
|
-
"!": {
|
|
135
|
-
type: "negate",
|
|
136
|
-
open: "(?:(?!(?:",
|
|
137
|
-
close: `))${chars.STAR})`
|
|
138
|
-
},
|
|
139
|
-
"?": {
|
|
140
|
-
type: "qmark",
|
|
141
|
-
open: "(?:",
|
|
142
|
-
close: ")?"
|
|
143
|
-
},
|
|
144
|
-
"+": {
|
|
145
|
-
type: "plus",
|
|
146
|
-
open: "(?:",
|
|
147
|
-
close: ")+"
|
|
148
|
-
},
|
|
149
|
-
"*": {
|
|
150
|
-
type: "star",
|
|
151
|
-
open: "(?:",
|
|
152
|
-
close: ")*"
|
|
153
|
-
},
|
|
154
|
-
"@": {
|
|
155
|
-
type: "at",
|
|
156
|
-
open: "(?:",
|
|
157
|
-
close: ")"
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
},
|
|
161
|
-
globChars(win32) {
|
|
162
|
-
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
}));
|
|
166
|
-
|
|
167
|
-
//#endregion
|
|
168
|
-
//#region node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js
|
|
169
|
-
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
170
|
-
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
171
|
-
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
172
|
-
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
173
|
-
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
|
174
|
-
exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
175
|
-
exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
176
|
-
exports.isWindows = () => {
|
|
177
|
-
if (typeof navigator !== "undefined" && navigator.platform) {
|
|
178
|
-
const platform = navigator.platform.toLowerCase();
|
|
179
|
-
return platform === "win32" || platform === "windows";
|
|
180
|
-
}
|
|
181
|
-
if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
|
|
182
|
-
return false;
|
|
183
|
-
};
|
|
184
|
-
exports.removeBackslashes = (str) => {
|
|
185
|
-
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
186
|
-
return match === "\\" ? "" : match;
|
|
187
|
-
});
|
|
188
|
-
};
|
|
189
|
-
exports.escapeLast = (input, char, lastIdx) => {
|
|
190
|
-
const idx = input.lastIndexOf(char, lastIdx);
|
|
191
|
-
if (idx === -1) return input;
|
|
192
|
-
if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
|
|
193
|
-
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
194
|
-
};
|
|
195
|
-
exports.removePrefix = (input, state = {}) => {
|
|
196
|
-
let output = input;
|
|
197
|
-
if (output.startsWith("./")) {
|
|
198
|
-
output = output.slice(2);
|
|
199
|
-
state.prefix = "./";
|
|
200
|
-
}
|
|
201
|
-
return output;
|
|
202
|
-
};
|
|
203
|
-
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
204
|
-
let output = `${options.contains ? "" : "^"}(?:${input})${options.contains ? "" : "$"}`;
|
|
205
|
-
if (state.negated === true) output = `(?:^(?!${output}).*$)`;
|
|
206
|
-
return output;
|
|
207
|
-
};
|
|
208
|
-
exports.basename = (path, { windows } = {}) => {
|
|
209
|
-
const segs = path.split(windows ? /[\\/]/ : "/");
|
|
210
|
-
const last = segs[segs.length - 1];
|
|
211
|
-
if (last === "") return segs[segs.length - 2];
|
|
212
|
-
return last;
|
|
213
|
-
};
|
|
214
|
-
}));
|
|
215
|
-
|
|
216
|
-
//#endregion
|
|
217
|
-
//#region node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js
|
|
218
|
-
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
219
|
-
const utils$3 = require_utils();
|
|
220
|
-
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
|
|
221
|
-
const isPathSeparator = (code) => {
|
|
222
|
-
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
223
|
-
};
|
|
224
|
-
const depth = (token) => {
|
|
225
|
-
if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
|
|
226
|
-
};
|
|
227
|
-
/**
|
|
228
|
-
* Quickly scans a glob pattern and returns an object with a handful of
|
|
229
|
-
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
|
230
|
-
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
|
231
|
-
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
|
232
|
-
*
|
|
233
|
-
* ```js
|
|
234
|
-
* const pm = require('picomatch');
|
|
235
|
-
* console.log(pm.scan('foo/bar/*.js'));
|
|
236
|
-
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
|
237
|
-
* ```
|
|
238
|
-
* @param {String} `str`
|
|
239
|
-
* @param {Object} `options`
|
|
240
|
-
* @return {Object} Returns an object with tokens and regex source string.
|
|
241
|
-
* @api public
|
|
242
|
-
*/
|
|
243
|
-
const scan$1 = (input, options) => {
|
|
244
|
-
const opts = options || {};
|
|
245
|
-
const length = input.length - 1;
|
|
246
|
-
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
247
|
-
const slashes = [];
|
|
248
|
-
const tokens = [];
|
|
249
|
-
const parts = [];
|
|
250
|
-
let str = input;
|
|
251
|
-
let index = -1;
|
|
252
|
-
let start = 0;
|
|
253
|
-
let lastIndex = 0;
|
|
254
|
-
let isBrace = false;
|
|
255
|
-
let isBracket = false;
|
|
256
|
-
let isGlob = false;
|
|
257
|
-
let isExtglob = false;
|
|
258
|
-
let isGlobstar = false;
|
|
259
|
-
let braceEscaped = false;
|
|
260
|
-
let backslashes = false;
|
|
261
|
-
let negated = false;
|
|
262
|
-
let negatedExtglob = false;
|
|
263
|
-
let finished = false;
|
|
264
|
-
let braces = 0;
|
|
265
|
-
let prev;
|
|
266
|
-
let code;
|
|
267
|
-
let token = {
|
|
268
|
-
value: "",
|
|
269
|
-
depth: 0,
|
|
270
|
-
isGlob: false
|
|
271
|
-
};
|
|
272
|
-
const eos = () => index >= length;
|
|
273
|
-
const peek = () => str.charCodeAt(index + 1);
|
|
274
|
-
const advance = () => {
|
|
275
|
-
prev = code;
|
|
276
|
-
return str.charCodeAt(++index);
|
|
277
|
-
};
|
|
278
|
-
while (index < length) {
|
|
279
|
-
code = advance();
|
|
280
|
-
let next;
|
|
281
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
282
|
-
backslashes = token.backslashes = true;
|
|
283
|
-
code = advance();
|
|
284
|
-
if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
|
|
285
|
-
continue;
|
|
286
|
-
}
|
|
287
|
-
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
288
|
-
braces++;
|
|
289
|
-
while (eos() !== true && (code = advance())) {
|
|
290
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
291
|
-
backslashes = token.backslashes = true;
|
|
292
|
-
advance();
|
|
293
|
-
continue;
|
|
294
|
-
}
|
|
295
|
-
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
296
|
-
braces++;
|
|
297
|
-
continue;
|
|
298
|
-
}
|
|
299
|
-
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
300
|
-
isBrace = token.isBrace = true;
|
|
301
|
-
isGlob = token.isGlob = true;
|
|
302
|
-
finished = true;
|
|
303
|
-
if (scanToEnd === true) continue;
|
|
304
|
-
break;
|
|
305
|
-
}
|
|
306
|
-
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
307
|
-
isBrace = token.isBrace = true;
|
|
308
|
-
isGlob = token.isGlob = true;
|
|
309
|
-
finished = true;
|
|
310
|
-
if (scanToEnd === true) continue;
|
|
311
|
-
break;
|
|
312
|
-
}
|
|
313
|
-
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
314
|
-
braces--;
|
|
315
|
-
if (braces === 0) {
|
|
316
|
-
braceEscaped = false;
|
|
317
|
-
isBrace = token.isBrace = true;
|
|
318
|
-
finished = true;
|
|
319
|
-
break;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
if (scanToEnd === true) continue;
|
|
324
|
-
break;
|
|
325
|
-
}
|
|
326
|
-
if (code === CHAR_FORWARD_SLASH) {
|
|
327
|
-
slashes.push(index);
|
|
328
|
-
tokens.push(token);
|
|
329
|
-
token = {
|
|
330
|
-
value: "",
|
|
331
|
-
depth: 0,
|
|
332
|
-
isGlob: false
|
|
333
|
-
};
|
|
334
|
-
if (finished === true) continue;
|
|
335
|
-
if (prev === CHAR_DOT && index === start + 1) {
|
|
336
|
-
start += 2;
|
|
337
|
-
continue;
|
|
338
|
-
}
|
|
339
|
-
lastIndex = index + 1;
|
|
340
|
-
continue;
|
|
341
|
-
}
|
|
342
|
-
if (opts.noext !== true) {
|
|
343
|
-
if ((code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
344
|
-
isGlob = token.isGlob = true;
|
|
345
|
-
isExtglob = token.isExtglob = true;
|
|
346
|
-
finished = true;
|
|
347
|
-
if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
|
|
348
|
-
if (scanToEnd === true) {
|
|
349
|
-
while (eos() !== true && (code = advance())) {
|
|
350
|
-
if (code === CHAR_BACKWARD_SLASH) {
|
|
351
|
-
backslashes = token.backslashes = true;
|
|
352
|
-
code = advance();
|
|
353
|
-
continue;
|
|
354
|
-
}
|
|
355
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
356
|
-
isGlob = token.isGlob = true;
|
|
357
|
-
finished = true;
|
|
358
|
-
break;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
continue;
|
|
362
|
-
}
|
|
363
|
-
break;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
if (code === CHAR_ASTERISK) {
|
|
367
|
-
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
368
|
-
isGlob = token.isGlob = true;
|
|
369
|
-
finished = true;
|
|
370
|
-
if (scanToEnd === true) continue;
|
|
371
|
-
break;
|
|
372
|
-
}
|
|
373
|
-
if (code === CHAR_QUESTION_MARK) {
|
|
374
|
-
isGlob = token.isGlob = true;
|
|
375
|
-
finished = true;
|
|
376
|
-
if (scanToEnd === true) continue;
|
|
377
|
-
break;
|
|
378
|
-
}
|
|
379
|
-
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
380
|
-
while (eos() !== true && (next = advance())) {
|
|
381
|
-
if (next === CHAR_BACKWARD_SLASH) {
|
|
382
|
-
backslashes = token.backslashes = true;
|
|
383
|
-
advance();
|
|
384
|
-
continue;
|
|
385
|
-
}
|
|
386
|
-
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
387
|
-
isBracket = token.isBracket = true;
|
|
388
|
-
isGlob = token.isGlob = true;
|
|
389
|
-
finished = true;
|
|
390
|
-
break;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
if (scanToEnd === true) continue;
|
|
394
|
-
break;
|
|
395
|
-
}
|
|
396
|
-
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
397
|
-
negated = token.negated = true;
|
|
398
|
-
start++;
|
|
399
|
-
continue;
|
|
400
|
-
}
|
|
401
|
-
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
402
|
-
isGlob = token.isGlob = true;
|
|
403
|
-
if (scanToEnd === true) {
|
|
404
|
-
while (eos() !== true && (code = advance())) {
|
|
405
|
-
if (code === CHAR_LEFT_PARENTHESES) {
|
|
406
|
-
backslashes = token.backslashes = true;
|
|
407
|
-
code = advance();
|
|
408
|
-
continue;
|
|
409
|
-
}
|
|
410
|
-
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
411
|
-
finished = true;
|
|
412
|
-
break;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
continue;
|
|
416
|
-
}
|
|
417
|
-
break;
|
|
418
|
-
}
|
|
419
|
-
if (isGlob === true) {
|
|
420
|
-
finished = true;
|
|
421
|
-
if (scanToEnd === true) continue;
|
|
422
|
-
break;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
if (opts.noext === true) {
|
|
426
|
-
isExtglob = false;
|
|
427
|
-
isGlob = false;
|
|
428
|
-
}
|
|
429
|
-
let base = str;
|
|
430
|
-
let prefix = "";
|
|
431
|
-
let glob = "";
|
|
432
|
-
if (start > 0) {
|
|
433
|
-
prefix = str.slice(0, start);
|
|
434
|
-
str = str.slice(start);
|
|
435
|
-
lastIndex -= start;
|
|
436
|
-
}
|
|
437
|
-
if (base && isGlob === true && lastIndex > 0) {
|
|
438
|
-
base = str.slice(0, lastIndex);
|
|
439
|
-
glob = str.slice(lastIndex);
|
|
440
|
-
} else if (isGlob === true) {
|
|
441
|
-
base = "";
|
|
442
|
-
glob = str;
|
|
443
|
-
} else base = str;
|
|
444
|
-
if (base && base !== "" && base !== "/" && base !== str) {
|
|
445
|
-
if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
|
|
446
|
-
}
|
|
447
|
-
if (opts.unescape === true) {
|
|
448
|
-
if (glob) glob = utils$3.removeBackslashes(glob);
|
|
449
|
-
if (base && backslashes === true) base = utils$3.removeBackslashes(base);
|
|
450
|
-
}
|
|
451
|
-
const state = {
|
|
452
|
-
prefix,
|
|
453
|
-
input,
|
|
454
|
-
start,
|
|
455
|
-
base,
|
|
456
|
-
glob,
|
|
457
|
-
isBrace,
|
|
458
|
-
isBracket,
|
|
459
|
-
isGlob,
|
|
460
|
-
isExtglob,
|
|
461
|
-
isGlobstar,
|
|
462
|
-
negated,
|
|
463
|
-
negatedExtglob
|
|
464
|
-
};
|
|
465
|
-
if (opts.tokens === true) {
|
|
466
|
-
state.maxDepth = 0;
|
|
467
|
-
if (!isPathSeparator(code)) tokens.push(token);
|
|
468
|
-
state.tokens = tokens;
|
|
469
|
-
}
|
|
470
|
-
if (opts.parts === true || opts.tokens === true) {
|
|
471
|
-
let prevIndex;
|
|
472
|
-
for (let idx = 0; idx < slashes.length; idx++) {
|
|
473
|
-
const n = prevIndex ? prevIndex + 1 : start;
|
|
474
|
-
const i = slashes[idx];
|
|
475
|
-
const value = input.slice(n, i);
|
|
476
|
-
if (opts.tokens) {
|
|
477
|
-
if (idx === 0 && start !== 0) {
|
|
478
|
-
tokens[idx].isPrefix = true;
|
|
479
|
-
tokens[idx].value = prefix;
|
|
480
|
-
} else tokens[idx].value = value;
|
|
481
|
-
depth(tokens[idx]);
|
|
482
|
-
state.maxDepth += tokens[idx].depth;
|
|
483
|
-
}
|
|
484
|
-
if (idx !== 0 || value !== "") parts.push(value);
|
|
485
|
-
prevIndex = i;
|
|
486
|
-
}
|
|
487
|
-
if (prevIndex && prevIndex + 1 < input.length) {
|
|
488
|
-
const value = input.slice(prevIndex + 1);
|
|
489
|
-
parts.push(value);
|
|
490
|
-
if (opts.tokens) {
|
|
491
|
-
tokens[tokens.length - 1].value = value;
|
|
492
|
-
depth(tokens[tokens.length - 1]);
|
|
493
|
-
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
state.slashes = slashes;
|
|
497
|
-
state.parts = parts;
|
|
498
|
-
}
|
|
499
|
-
return state;
|
|
500
|
-
};
|
|
501
|
-
module.exports = scan$1;
|
|
502
|
-
}));
|
|
503
|
-
|
|
504
|
-
//#endregion
|
|
505
|
-
//#region node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js
|
|
506
|
-
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
507
|
-
const constants$1 = require_constants();
|
|
508
|
-
const utils$2 = require_utils();
|
|
509
|
-
/**
|
|
510
|
-
* Constants
|
|
511
|
-
*/
|
|
512
|
-
const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants$1;
|
|
513
|
-
/**
|
|
514
|
-
* Helpers
|
|
515
|
-
*/
|
|
516
|
-
const expandRange = (args, options) => {
|
|
517
|
-
if (typeof options.expandRange === "function") return options.expandRange(...args, options);
|
|
518
|
-
args.sort();
|
|
519
|
-
const value = `[${args.join("-")}]`;
|
|
520
|
-
try {
|
|
521
|
-
new RegExp(value);
|
|
522
|
-
} catch (ex) {
|
|
523
|
-
return args.map((v) => utils$2.escapeRegex(v)).join("..");
|
|
524
|
-
}
|
|
525
|
-
return value;
|
|
526
|
-
};
|
|
527
|
-
/**
|
|
528
|
-
* Create the message for a syntax error
|
|
529
|
-
*/
|
|
530
|
-
const syntaxError = (type, char) => {
|
|
531
|
-
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
532
|
-
};
|
|
533
|
-
/**
|
|
534
|
-
* Parse the given input string.
|
|
535
|
-
* @param {String} input
|
|
536
|
-
* @param {Object} options
|
|
537
|
-
* @return {Object}
|
|
538
|
-
*/
|
|
539
|
-
const parse$1 = (input, options) => {
|
|
540
|
-
if (typeof input !== "string") throw new TypeError("Expected a string");
|
|
541
|
-
input = REPLACEMENTS[input] || input;
|
|
542
|
-
const opts = { ...options };
|
|
543
|
-
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
544
|
-
let len = input.length;
|
|
545
|
-
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
546
|
-
const bos = {
|
|
547
|
-
type: "bos",
|
|
548
|
-
value: "",
|
|
549
|
-
output: opts.prepend || ""
|
|
550
|
-
};
|
|
551
|
-
const tokens = [bos];
|
|
552
|
-
const capture = opts.capture ? "" : "?:";
|
|
553
|
-
const PLATFORM_CHARS = constants$1.globChars(opts.windows);
|
|
554
|
-
const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
|
|
555
|
-
const { DOT_LITERAL: DOT_LITERAL$1, PLUS_LITERAL: PLUS_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK: QMARK$1, QMARK_NO_DOT, STAR, START_ANCHOR: START_ANCHOR$1 } = PLATFORM_CHARS;
|
|
556
|
-
const globstar = (opts$1) => {
|
|
557
|
-
return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
|
|
558
|
-
};
|
|
559
|
-
const nodot = opts.dot ? "" : NO_DOT;
|
|
560
|
-
const qmarkNoDot = opts.dot ? QMARK$1 : QMARK_NO_DOT;
|
|
561
|
-
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
562
|
-
if (opts.capture) star = `(${star})`;
|
|
563
|
-
if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
|
|
564
|
-
const state = {
|
|
565
|
-
input,
|
|
566
|
-
index: -1,
|
|
567
|
-
start: 0,
|
|
568
|
-
dot: opts.dot === true,
|
|
569
|
-
consumed: "",
|
|
570
|
-
output: "",
|
|
571
|
-
prefix: "",
|
|
572
|
-
backtrack: false,
|
|
573
|
-
negated: false,
|
|
574
|
-
brackets: 0,
|
|
575
|
-
braces: 0,
|
|
576
|
-
parens: 0,
|
|
577
|
-
quotes: 0,
|
|
578
|
-
globstar: false,
|
|
579
|
-
tokens
|
|
580
|
-
};
|
|
581
|
-
input = utils$2.removePrefix(input, state);
|
|
582
|
-
len = input.length;
|
|
583
|
-
const extglobs = [];
|
|
584
|
-
const braces = [];
|
|
585
|
-
const stack = [];
|
|
586
|
-
let prev = bos;
|
|
587
|
-
let value;
|
|
588
|
-
/**
|
|
589
|
-
* Tokenizing helpers
|
|
590
|
-
*/
|
|
591
|
-
const eos = () => state.index === len - 1;
|
|
592
|
-
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
593
|
-
const advance = state.advance = () => input[++state.index] || "";
|
|
594
|
-
const remaining = () => input.slice(state.index + 1);
|
|
595
|
-
const consume = (value$1 = "", num = 0) => {
|
|
596
|
-
state.consumed += value$1;
|
|
597
|
-
state.index += num;
|
|
598
|
-
};
|
|
599
|
-
const append = (token) => {
|
|
600
|
-
state.output += token.output != null ? token.output : token.value;
|
|
601
|
-
consume(token.value);
|
|
602
|
-
};
|
|
603
|
-
const negate = () => {
|
|
604
|
-
let count = 1;
|
|
605
|
-
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
|
606
|
-
advance();
|
|
607
|
-
state.start++;
|
|
608
|
-
count++;
|
|
609
|
-
}
|
|
610
|
-
if (count % 2 === 0) return false;
|
|
611
|
-
state.negated = true;
|
|
612
|
-
state.start++;
|
|
613
|
-
return true;
|
|
614
|
-
};
|
|
615
|
-
const increment = (type) => {
|
|
616
|
-
state[type]++;
|
|
617
|
-
stack.push(type);
|
|
618
|
-
};
|
|
619
|
-
const decrement = (type) => {
|
|
620
|
-
state[type]--;
|
|
621
|
-
stack.pop();
|
|
622
|
-
};
|
|
623
|
-
/**
|
|
624
|
-
* Push tokens onto the tokens array. This helper speeds up
|
|
625
|
-
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
|
626
|
-
* and 2) helping us avoid creating extra tokens when consecutive
|
|
627
|
-
* characters are plain text. This improves performance and simplifies
|
|
628
|
-
* lookbehinds.
|
|
629
|
-
*/
|
|
630
|
-
const push = (tok) => {
|
|
631
|
-
if (prev.type === "globstar") {
|
|
632
|
-
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
|
633
|
-
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
|
634
|
-
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
|
635
|
-
state.output = state.output.slice(0, -prev.output.length);
|
|
636
|
-
prev.type = "star";
|
|
637
|
-
prev.value = "*";
|
|
638
|
-
prev.output = star;
|
|
639
|
-
state.output += prev.output;
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
if (extglobs.length && tok.type !== "paren") extglobs[extglobs.length - 1].inner += tok.value;
|
|
643
|
-
if (tok.value || tok.output) append(tok);
|
|
644
|
-
if (prev && prev.type === "text" && tok.type === "text") {
|
|
645
|
-
prev.output = (prev.output || prev.value) + tok.value;
|
|
646
|
-
prev.value += tok.value;
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
tok.prev = prev;
|
|
650
|
-
tokens.push(tok);
|
|
651
|
-
prev = tok;
|
|
652
|
-
};
|
|
653
|
-
const extglobOpen = (type, value$1) => {
|
|
654
|
-
const token = {
|
|
655
|
-
...EXTGLOB_CHARS[value$1],
|
|
656
|
-
conditions: 1,
|
|
657
|
-
inner: ""
|
|
658
|
-
};
|
|
659
|
-
token.prev = prev;
|
|
660
|
-
token.parens = state.parens;
|
|
661
|
-
token.output = state.output;
|
|
662
|
-
const output = (opts.capture ? "(" : "") + token.open;
|
|
663
|
-
increment("parens");
|
|
664
|
-
push({
|
|
665
|
-
type,
|
|
666
|
-
value: value$1,
|
|
667
|
-
output: state.output ? "" : ONE_CHAR$1
|
|
668
|
-
});
|
|
669
|
-
push({
|
|
670
|
-
type: "paren",
|
|
671
|
-
extglob: true,
|
|
672
|
-
value: advance(),
|
|
673
|
-
output
|
|
674
|
-
});
|
|
675
|
-
extglobs.push(token);
|
|
676
|
-
};
|
|
677
|
-
const extglobClose = (token) => {
|
|
678
|
-
let output = token.close + (opts.capture ? ")" : "");
|
|
679
|
-
let rest;
|
|
680
|
-
if (token.type === "negate") {
|
|
681
|
-
let extglobStar = star;
|
|
682
|
-
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
|
|
683
|
-
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
|
|
684
|
-
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) output = token.close = `)${parse$1(rest, {
|
|
685
|
-
...options,
|
|
686
|
-
fastpaths: false
|
|
687
|
-
}).output})${extglobStar})`;
|
|
688
|
-
if (token.prev.type === "bos") state.negatedExtglob = true;
|
|
689
|
-
}
|
|
690
|
-
push({
|
|
691
|
-
type: "paren",
|
|
692
|
-
extglob: true,
|
|
693
|
-
value,
|
|
694
|
-
output
|
|
695
|
-
});
|
|
696
|
-
decrement("parens");
|
|
697
|
-
};
|
|
698
|
-
/**
|
|
699
|
-
* Fast paths
|
|
700
|
-
*/
|
|
701
|
-
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
702
|
-
let backslashes = false;
|
|
703
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
704
|
-
if (first === "\\") {
|
|
705
|
-
backslashes = true;
|
|
706
|
-
return m;
|
|
707
|
-
}
|
|
708
|
-
if (first === "?") {
|
|
709
|
-
if (esc) return esc + first + (rest ? QMARK$1.repeat(rest.length) : "");
|
|
710
|
-
if (index === 0) return qmarkNoDot + (rest ? QMARK$1.repeat(rest.length) : "");
|
|
711
|
-
return QMARK$1.repeat(chars.length);
|
|
712
|
-
}
|
|
713
|
-
if (first === ".") return DOT_LITERAL$1.repeat(chars.length);
|
|
714
|
-
if (first === "*") {
|
|
715
|
-
if (esc) return esc + first + (rest ? star : "");
|
|
716
|
-
return star;
|
|
717
|
-
}
|
|
718
|
-
return esc ? m : `\\${m}`;
|
|
719
|
-
});
|
|
720
|
-
if (backslashes === true) if (opts.unescape === true) output = output.replace(/\\/g, "");
|
|
721
|
-
else output = output.replace(/\\+/g, (m) => {
|
|
722
|
-
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
723
|
-
});
|
|
724
|
-
if (output === input && opts.contains === true) {
|
|
725
|
-
state.output = input;
|
|
726
|
-
return state;
|
|
727
|
-
}
|
|
728
|
-
state.output = utils$2.wrapOutput(output, state, options);
|
|
729
|
-
return state;
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* Tokenize input until we reach end-of-string
|
|
733
|
-
*/
|
|
734
|
-
while (!eos()) {
|
|
735
|
-
value = advance();
|
|
736
|
-
if (value === "\0") continue;
|
|
737
|
-
/**
|
|
738
|
-
* Escaped characters
|
|
739
|
-
*/
|
|
740
|
-
if (value === "\\") {
|
|
741
|
-
const next = peek();
|
|
742
|
-
if (next === "/" && opts.bash !== true) continue;
|
|
743
|
-
if (next === "." || next === ";") continue;
|
|
744
|
-
if (!next) {
|
|
745
|
-
value += "\\";
|
|
746
|
-
push({
|
|
747
|
-
type: "text",
|
|
748
|
-
value
|
|
749
|
-
});
|
|
750
|
-
continue;
|
|
751
|
-
}
|
|
752
|
-
const match = /^\\+/.exec(remaining());
|
|
753
|
-
let slashes = 0;
|
|
754
|
-
if (match && match[0].length > 2) {
|
|
755
|
-
slashes = match[0].length;
|
|
756
|
-
state.index += slashes;
|
|
757
|
-
if (slashes % 2 !== 0) value += "\\";
|
|
758
|
-
}
|
|
759
|
-
if (opts.unescape === true) value = advance();
|
|
760
|
-
else value += advance();
|
|
761
|
-
if (state.brackets === 0) {
|
|
762
|
-
push({
|
|
763
|
-
type: "text",
|
|
764
|
-
value
|
|
765
|
-
});
|
|
766
|
-
continue;
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
/**
|
|
770
|
-
* If we're inside a regex character class, continue
|
|
771
|
-
* until we reach the closing bracket.
|
|
772
|
-
*/
|
|
773
|
-
if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
|
774
|
-
if (opts.posix !== false && value === ":") {
|
|
775
|
-
const inner = prev.value.slice(1);
|
|
776
|
-
if (inner.includes("[")) {
|
|
777
|
-
prev.posix = true;
|
|
778
|
-
if (inner.includes(":")) {
|
|
779
|
-
const idx = prev.value.lastIndexOf("[");
|
|
780
|
-
const pre = prev.value.slice(0, idx);
|
|
781
|
-
const posix = POSIX_REGEX_SOURCE[prev.value.slice(idx + 2)];
|
|
782
|
-
if (posix) {
|
|
783
|
-
prev.value = pre + posix;
|
|
784
|
-
state.backtrack = true;
|
|
785
|
-
advance();
|
|
786
|
-
if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR$1;
|
|
787
|
-
continue;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") value = `\\${value}`;
|
|
793
|
-
if (value === "]" && (prev.value === "[" || prev.value === "[^")) value = `\\${value}`;
|
|
794
|
-
if (opts.posix === true && value === "!" && prev.value === "[") value = "^";
|
|
795
|
-
prev.value += value;
|
|
796
|
-
append({ value });
|
|
797
|
-
continue;
|
|
798
|
-
}
|
|
799
|
-
/**
|
|
800
|
-
* If we're inside a quoted string, continue
|
|
801
|
-
* until we reach the closing double quote.
|
|
802
|
-
*/
|
|
803
|
-
if (state.quotes === 1 && value !== "\"") {
|
|
804
|
-
value = utils$2.escapeRegex(value);
|
|
805
|
-
prev.value += value;
|
|
806
|
-
append({ value });
|
|
807
|
-
continue;
|
|
808
|
-
}
|
|
809
|
-
/**
|
|
810
|
-
* Double quotes
|
|
811
|
-
*/
|
|
812
|
-
if (value === "\"") {
|
|
813
|
-
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
814
|
-
if (opts.keepQuotes === true) push({
|
|
815
|
-
type: "text",
|
|
816
|
-
value
|
|
817
|
-
});
|
|
818
|
-
continue;
|
|
819
|
-
}
|
|
820
|
-
/**
|
|
821
|
-
* Parentheses
|
|
822
|
-
*/
|
|
823
|
-
if (value === "(") {
|
|
824
|
-
increment("parens");
|
|
825
|
-
push({
|
|
826
|
-
type: "paren",
|
|
827
|
-
value
|
|
828
|
-
});
|
|
829
|
-
continue;
|
|
830
|
-
}
|
|
831
|
-
if (value === ")") {
|
|
832
|
-
if (state.parens === 0 && opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "("));
|
|
833
|
-
const extglob = extglobs[extglobs.length - 1];
|
|
834
|
-
if (extglob && state.parens === extglob.parens + 1) {
|
|
835
|
-
extglobClose(extglobs.pop());
|
|
836
|
-
continue;
|
|
837
|
-
}
|
|
838
|
-
push({
|
|
839
|
-
type: "paren",
|
|
840
|
-
value,
|
|
841
|
-
output: state.parens ? ")" : "\\)"
|
|
842
|
-
});
|
|
843
|
-
decrement("parens");
|
|
844
|
-
continue;
|
|
845
|
-
}
|
|
846
|
-
/**
|
|
847
|
-
* Square brackets
|
|
848
|
-
*/
|
|
849
|
-
if (value === "[") {
|
|
850
|
-
if (opts.nobracket === true || !remaining().includes("]")) {
|
|
851
|
-
if (opts.nobracket !== true && opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
|
852
|
-
value = `\\${value}`;
|
|
853
|
-
} else increment("brackets");
|
|
854
|
-
push({
|
|
855
|
-
type: "bracket",
|
|
856
|
-
value
|
|
857
|
-
});
|
|
858
|
-
continue;
|
|
859
|
-
}
|
|
860
|
-
if (value === "]") {
|
|
861
|
-
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
|
862
|
-
push({
|
|
863
|
-
type: "text",
|
|
864
|
-
value,
|
|
865
|
-
output: `\\${value}`
|
|
866
|
-
});
|
|
867
|
-
continue;
|
|
868
|
-
}
|
|
869
|
-
if (state.brackets === 0) {
|
|
870
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "["));
|
|
871
|
-
push({
|
|
872
|
-
type: "text",
|
|
873
|
-
value,
|
|
874
|
-
output: `\\${value}`
|
|
875
|
-
});
|
|
876
|
-
continue;
|
|
877
|
-
}
|
|
878
|
-
decrement("brackets");
|
|
879
|
-
const prevValue = prev.value.slice(1);
|
|
880
|
-
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
|
|
881
|
-
prev.value += value;
|
|
882
|
-
append({ value });
|
|
883
|
-
if (opts.literalBrackets === false || utils$2.hasRegexChars(prevValue)) continue;
|
|
884
|
-
const escaped = utils$2.escapeRegex(prev.value);
|
|
885
|
-
state.output = state.output.slice(0, -prev.value.length);
|
|
886
|
-
if (opts.literalBrackets === true) {
|
|
887
|
-
state.output += escaped;
|
|
888
|
-
prev.value = escaped;
|
|
889
|
-
continue;
|
|
890
|
-
}
|
|
891
|
-
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
892
|
-
state.output += prev.value;
|
|
893
|
-
continue;
|
|
894
|
-
}
|
|
895
|
-
/**
|
|
896
|
-
* Braces
|
|
897
|
-
*/
|
|
898
|
-
if (value === "{" && opts.nobrace !== true) {
|
|
899
|
-
increment("braces");
|
|
900
|
-
const open = {
|
|
901
|
-
type: "brace",
|
|
902
|
-
value,
|
|
903
|
-
output: "(",
|
|
904
|
-
outputIndex: state.output.length,
|
|
905
|
-
tokensIndex: state.tokens.length
|
|
906
|
-
};
|
|
907
|
-
braces.push(open);
|
|
908
|
-
push(open);
|
|
909
|
-
continue;
|
|
910
|
-
}
|
|
911
|
-
if (value === "}") {
|
|
912
|
-
const brace = braces[braces.length - 1];
|
|
913
|
-
if (opts.nobrace === true || !brace) {
|
|
914
|
-
push({
|
|
915
|
-
type: "text",
|
|
916
|
-
value,
|
|
917
|
-
output: value
|
|
918
|
-
});
|
|
919
|
-
continue;
|
|
920
|
-
}
|
|
921
|
-
let output = ")";
|
|
922
|
-
if (brace.dots === true) {
|
|
923
|
-
const arr = tokens.slice();
|
|
924
|
-
const range = [];
|
|
925
|
-
for (let i = arr.length - 1; i >= 0; i--) {
|
|
926
|
-
tokens.pop();
|
|
927
|
-
if (arr[i].type === "brace") break;
|
|
928
|
-
if (arr[i].type !== "dots") range.unshift(arr[i].value);
|
|
929
|
-
}
|
|
930
|
-
output = expandRange(range, opts);
|
|
931
|
-
state.backtrack = true;
|
|
932
|
-
}
|
|
933
|
-
if (brace.comma !== true && brace.dots !== true) {
|
|
934
|
-
const out = state.output.slice(0, brace.outputIndex);
|
|
935
|
-
const toks = state.tokens.slice(brace.tokensIndex);
|
|
936
|
-
brace.value = brace.output = "\\{";
|
|
937
|
-
value = output = "\\}";
|
|
938
|
-
state.output = out;
|
|
939
|
-
for (const t of toks) state.output += t.output || t.value;
|
|
940
|
-
}
|
|
941
|
-
push({
|
|
942
|
-
type: "brace",
|
|
943
|
-
value,
|
|
944
|
-
output
|
|
945
|
-
});
|
|
946
|
-
decrement("braces");
|
|
947
|
-
braces.pop();
|
|
948
|
-
continue;
|
|
949
|
-
}
|
|
950
|
-
/**
|
|
951
|
-
* Pipes
|
|
952
|
-
*/
|
|
953
|
-
if (value === "|") {
|
|
954
|
-
if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
|
|
955
|
-
push({
|
|
956
|
-
type: "text",
|
|
957
|
-
value
|
|
958
|
-
});
|
|
959
|
-
continue;
|
|
960
|
-
}
|
|
961
|
-
/**
|
|
962
|
-
* Commas
|
|
963
|
-
*/
|
|
964
|
-
if (value === ",") {
|
|
965
|
-
let output = value;
|
|
966
|
-
const brace = braces[braces.length - 1];
|
|
967
|
-
if (brace && stack[stack.length - 1] === "braces") {
|
|
968
|
-
brace.comma = true;
|
|
969
|
-
output = "|";
|
|
970
|
-
}
|
|
971
|
-
push({
|
|
972
|
-
type: "comma",
|
|
973
|
-
value,
|
|
974
|
-
output
|
|
975
|
-
});
|
|
976
|
-
continue;
|
|
977
|
-
}
|
|
978
|
-
/**
|
|
979
|
-
* Slashes
|
|
980
|
-
*/
|
|
981
|
-
if (value === "/") {
|
|
982
|
-
if (prev.type === "dot" && state.index === state.start + 1) {
|
|
983
|
-
state.start = state.index + 1;
|
|
984
|
-
state.consumed = "";
|
|
985
|
-
state.output = "";
|
|
986
|
-
tokens.pop();
|
|
987
|
-
prev = bos;
|
|
988
|
-
continue;
|
|
989
|
-
}
|
|
990
|
-
push({
|
|
991
|
-
type: "slash",
|
|
992
|
-
value,
|
|
993
|
-
output: SLASH_LITERAL$1
|
|
994
|
-
});
|
|
995
|
-
continue;
|
|
996
|
-
}
|
|
997
|
-
/**
|
|
998
|
-
* Dots
|
|
999
|
-
*/
|
|
1000
|
-
if (value === ".") {
|
|
1001
|
-
if (state.braces > 0 && prev.type === "dot") {
|
|
1002
|
-
if (prev.value === ".") prev.output = DOT_LITERAL$1;
|
|
1003
|
-
const brace = braces[braces.length - 1];
|
|
1004
|
-
prev.type = "dots";
|
|
1005
|
-
prev.output += value;
|
|
1006
|
-
prev.value += value;
|
|
1007
|
-
brace.dots = true;
|
|
1008
|
-
continue;
|
|
1009
|
-
}
|
|
1010
|
-
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
|
1011
|
-
push({
|
|
1012
|
-
type: "text",
|
|
1013
|
-
value,
|
|
1014
|
-
output: DOT_LITERAL$1
|
|
1015
|
-
});
|
|
1016
|
-
continue;
|
|
1017
|
-
}
|
|
1018
|
-
push({
|
|
1019
|
-
type: "dot",
|
|
1020
|
-
value,
|
|
1021
|
-
output: DOT_LITERAL$1
|
|
1022
|
-
});
|
|
1023
|
-
continue;
|
|
1024
|
-
}
|
|
1025
|
-
/**
|
|
1026
|
-
* Question marks
|
|
1027
|
-
*/
|
|
1028
|
-
if (value === "?") {
|
|
1029
|
-
if (!(prev && prev.value === "(") && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1030
|
-
extglobOpen("qmark", value);
|
|
1031
|
-
continue;
|
|
1032
|
-
}
|
|
1033
|
-
if (prev && prev.type === "paren") {
|
|
1034
|
-
const next = peek();
|
|
1035
|
-
let output = value;
|
|
1036
|
-
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
|
|
1037
|
-
push({
|
|
1038
|
-
type: "text",
|
|
1039
|
-
value,
|
|
1040
|
-
output
|
|
1041
|
-
});
|
|
1042
|
-
continue;
|
|
1043
|
-
}
|
|
1044
|
-
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
1045
|
-
push({
|
|
1046
|
-
type: "qmark",
|
|
1047
|
-
value,
|
|
1048
|
-
output: QMARK_NO_DOT
|
|
1049
|
-
});
|
|
1050
|
-
continue;
|
|
1051
|
-
}
|
|
1052
|
-
push({
|
|
1053
|
-
type: "qmark",
|
|
1054
|
-
value,
|
|
1055
|
-
output: QMARK$1
|
|
1056
|
-
});
|
|
1057
|
-
continue;
|
|
1058
|
-
}
|
|
1059
|
-
/**
|
|
1060
|
-
* Exclamation
|
|
1061
|
-
*/
|
|
1062
|
-
if (value === "!") {
|
|
1063
|
-
if (opts.noextglob !== true && peek() === "(") {
|
|
1064
|
-
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
|
1065
|
-
extglobOpen("negate", value);
|
|
1066
|
-
continue;
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
if (opts.nonegate !== true && state.index === 0) {
|
|
1070
|
-
negate();
|
|
1071
|
-
continue;
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
/**
|
|
1075
|
-
* Plus
|
|
1076
|
-
*/
|
|
1077
|
-
if (value === "+") {
|
|
1078
|
-
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1079
|
-
extglobOpen("plus", value);
|
|
1080
|
-
continue;
|
|
1081
|
-
}
|
|
1082
|
-
if (prev && prev.value === "(" || opts.regex === false) {
|
|
1083
|
-
push({
|
|
1084
|
-
type: "plus",
|
|
1085
|
-
value,
|
|
1086
|
-
output: PLUS_LITERAL$1
|
|
1087
|
-
});
|
|
1088
|
-
continue;
|
|
1089
|
-
}
|
|
1090
|
-
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
|
1091
|
-
push({
|
|
1092
|
-
type: "plus",
|
|
1093
|
-
value
|
|
1094
|
-
});
|
|
1095
|
-
continue;
|
|
1096
|
-
}
|
|
1097
|
-
push({
|
|
1098
|
-
type: "plus",
|
|
1099
|
-
value: PLUS_LITERAL$1
|
|
1100
|
-
});
|
|
1101
|
-
continue;
|
|
1102
|
-
}
|
|
1103
|
-
/**
|
|
1104
|
-
* Plain text
|
|
1105
|
-
*/
|
|
1106
|
-
if (value === "@") {
|
|
1107
|
-
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
1108
|
-
push({
|
|
1109
|
-
type: "at",
|
|
1110
|
-
extglob: true,
|
|
1111
|
-
value,
|
|
1112
|
-
output: ""
|
|
1113
|
-
});
|
|
1114
|
-
continue;
|
|
1115
|
-
}
|
|
1116
|
-
push({
|
|
1117
|
-
type: "text",
|
|
1118
|
-
value
|
|
1119
|
-
});
|
|
1120
|
-
continue;
|
|
1121
|
-
}
|
|
1122
|
-
/**
|
|
1123
|
-
* Plain text
|
|
1124
|
-
*/
|
|
1125
|
-
if (value !== "*") {
|
|
1126
|
-
if (value === "$" || value === "^") value = `\\${value}`;
|
|
1127
|
-
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
1128
|
-
if (match) {
|
|
1129
|
-
value += match[0];
|
|
1130
|
-
state.index += match[0].length;
|
|
1131
|
-
}
|
|
1132
|
-
push({
|
|
1133
|
-
type: "text",
|
|
1134
|
-
value
|
|
1135
|
-
});
|
|
1136
|
-
continue;
|
|
1137
|
-
}
|
|
1138
|
-
/**
|
|
1139
|
-
* Stars
|
|
1140
|
-
*/
|
|
1141
|
-
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
1142
|
-
prev.type = "star";
|
|
1143
|
-
prev.star = true;
|
|
1144
|
-
prev.value += value;
|
|
1145
|
-
prev.output = star;
|
|
1146
|
-
state.backtrack = true;
|
|
1147
|
-
state.globstar = true;
|
|
1148
|
-
consume(value);
|
|
1149
|
-
continue;
|
|
1150
|
-
}
|
|
1151
|
-
let rest = remaining();
|
|
1152
|
-
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
1153
|
-
extglobOpen("star", value);
|
|
1154
|
-
continue;
|
|
1155
|
-
}
|
|
1156
|
-
if (prev.type === "star") {
|
|
1157
|
-
if (opts.noglobstar === true) {
|
|
1158
|
-
consume(value);
|
|
1159
|
-
continue;
|
|
1160
|
-
}
|
|
1161
|
-
const prior = prev.prev;
|
|
1162
|
-
const before = prior.prev;
|
|
1163
|
-
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
1164
|
-
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
|
1165
|
-
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
|
1166
|
-
push({
|
|
1167
|
-
type: "star",
|
|
1168
|
-
value,
|
|
1169
|
-
output: ""
|
|
1170
|
-
});
|
|
1171
|
-
continue;
|
|
1172
|
-
}
|
|
1173
|
-
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
|
1174
|
-
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
|
1175
|
-
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
1176
|
-
push({
|
|
1177
|
-
type: "star",
|
|
1178
|
-
value,
|
|
1179
|
-
output: ""
|
|
1180
|
-
});
|
|
1181
|
-
continue;
|
|
1182
|
-
}
|
|
1183
|
-
while (rest.slice(0, 3) === "/**") {
|
|
1184
|
-
const after = input[state.index + 4];
|
|
1185
|
-
if (after && after !== "/") break;
|
|
1186
|
-
rest = rest.slice(3);
|
|
1187
|
-
consume("/**", 3);
|
|
1188
|
-
}
|
|
1189
|
-
if (prior.type === "bos" && eos()) {
|
|
1190
|
-
prev.type = "globstar";
|
|
1191
|
-
prev.value += value;
|
|
1192
|
-
prev.output = globstar(opts);
|
|
1193
|
-
state.output = prev.output;
|
|
1194
|
-
state.globstar = true;
|
|
1195
|
-
consume(value);
|
|
1196
|
-
continue;
|
|
1197
|
-
}
|
|
1198
|
-
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
|
1199
|
-
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
1200
|
-
prior.output = `(?:${prior.output}`;
|
|
1201
|
-
prev.type = "globstar";
|
|
1202
|
-
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
|
1203
|
-
prev.value += value;
|
|
1204
|
-
state.globstar = true;
|
|
1205
|
-
state.output += prior.output + prev.output;
|
|
1206
|
-
consume(value);
|
|
1207
|
-
continue;
|
|
1208
|
-
}
|
|
1209
|
-
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
|
1210
|
-
const end = rest[1] !== void 0 ? "|$" : "";
|
|
1211
|
-
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
1212
|
-
prior.output = `(?:${prior.output}`;
|
|
1213
|
-
prev.type = "globstar";
|
|
1214
|
-
prev.output = `${globstar(opts)}${SLASH_LITERAL$1}|${SLASH_LITERAL$1}${end})`;
|
|
1215
|
-
prev.value += value;
|
|
1216
|
-
state.output += prior.output + prev.output;
|
|
1217
|
-
state.globstar = true;
|
|
1218
|
-
consume(value + advance());
|
|
1219
|
-
push({
|
|
1220
|
-
type: "slash",
|
|
1221
|
-
value: "/",
|
|
1222
|
-
output: ""
|
|
1223
|
-
});
|
|
1224
|
-
continue;
|
|
1225
|
-
}
|
|
1226
|
-
if (prior.type === "bos" && rest[0] === "/") {
|
|
1227
|
-
prev.type = "globstar";
|
|
1228
|
-
prev.value += value;
|
|
1229
|
-
prev.output = `(?:^|${SLASH_LITERAL$1}|${globstar(opts)}${SLASH_LITERAL$1})`;
|
|
1230
|
-
state.output = prev.output;
|
|
1231
|
-
state.globstar = true;
|
|
1232
|
-
consume(value + advance());
|
|
1233
|
-
push({
|
|
1234
|
-
type: "slash",
|
|
1235
|
-
value: "/",
|
|
1236
|
-
output: ""
|
|
1237
|
-
});
|
|
1238
|
-
continue;
|
|
1239
|
-
}
|
|
1240
|
-
state.output = state.output.slice(0, -prev.output.length);
|
|
1241
|
-
prev.type = "globstar";
|
|
1242
|
-
prev.output = globstar(opts);
|
|
1243
|
-
prev.value += value;
|
|
1244
|
-
state.output += prev.output;
|
|
1245
|
-
state.globstar = true;
|
|
1246
|
-
consume(value);
|
|
1247
|
-
continue;
|
|
1248
|
-
}
|
|
1249
|
-
const token = {
|
|
1250
|
-
type: "star",
|
|
1251
|
-
value,
|
|
1252
|
-
output: star
|
|
1253
|
-
};
|
|
1254
|
-
if (opts.bash === true) {
|
|
1255
|
-
token.output = ".*?";
|
|
1256
|
-
if (prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
|
|
1257
|
-
push(token);
|
|
1258
|
-
continue;
|
|
1259
|
-
}
|
|
1260
|
-
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
|
1261
|
-
token.output = value;
|
|
1262
|
-
push(token);
|
|
1263
|
-
continue;
|
|
1264
|
-
}
|
|
1265
|
-
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
|
1266
|
-
if (prev.type === "dot") {
|
|
1267
|
-
state.output += NO_DOT_SLASH;
|
|
1268
|
-
prev.output += NO_DOT_SLASH;
|
|
1269
|
-
} else if (opts.dot === true) {
|
|
1270
|
-
state.output += NO_DOTS_SLASH;
|
|
1271
|
-
prev.output += NO_DOTS_SLASH;
|
|
1272
|
-
} else {
|
|
1273
|
-
state.output += nodot;
|
|
1274
|
-
prev.output += nodot;
|
|
1275
|
-
}
|
|
1276
|
-
if (peek() !== "*") {
|
|
1277
|
-
state.output += ONE_CHAR$1;
|
|
1278
|
-
prev.output += ONE_CHAR$1;
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
push(token);
|
|
1282
|
-
}
|
|
1283
|
-
while (state.brackets > 0) {
|
|
1284
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
|
1285
|
-
state.output = utils$2.escapeLast(state.output, "[");
|
|
1286
|
-
decrement("brackets");
|
|
1287
|
-
}
|
|
1288
|
-
while (state.parens > 0) {
|
|
1289
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
|
|
1290
|
-
state.output = utils$2.escapeLast(state.output, "(");
|
|
1291
|
-
decrement("parens");
|
|
1292
|
-
}
|
|
1293
|
-
while (state.braces > 0) {
|
|
1294
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
|
|
1295
|
-
state.output = utils$2.escapeLast(state.output, "{");
|
|
1296
|
-
decrement("braces");
|
|
1297
|
-
}
|
|
1298
|
-
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
|
|
1299
|
-
type: "maybe_slash",
|
|
1300
|
-
value: "",
|
|
1301
|
-
output: `${SLASH_LITERAL$1}?`
|
|
1302
|
-
});
|
|
1303
|
-
if (state.backtrack === true) {
|
|
1304
|
-
state.output = "";
|
|
1305
|
-
for (const token of state.tokens) {
|
|
1306
|
-
state.output += token.output != null ? token.output : token.value;
|
|
1307
|
-
if (token.suffix) state.output += token.suffix;
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
return state;
|
|
1311
|
-
};
|
|
1312
|
-
/**
|
|
1313
|
-
* Fast paths for creating regular expressions for common glob patterns.
|
|
1314
|
-
* This can significantly speed up processing and has very little downside
|
|
1315
|
-
* impact when none of the fast paths match.
|
|
1316
|
-
*/
|
|
1317
|
-
parse$1.fastpaths = (input, options) => {
|
|
1318
|
-
const opts = { ...options };
|
|
1319
|
-
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
1320
|
-
const len = input.length;
|
|
1321
|
-
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
1322
|
-
input = REPLACEMENTS[input] || input;
|
|
1323
|
-
const { DOT_LITERAL: DOT_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR: START_ANCHOR$1 } = constants$1.globChars(opts.windows);
|
|
1324
|
-
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
1325
|
-
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
1326
|
-
const capture = opts.capture ? "" : "?:";
|
|
1327
|
-
const state = {
|
|
1328
|
-
negated: false,
|
|
1329
|
-
prefix: ""
|
|
1330
|
-
};
|
|
1331
|
-
let star = opts.bash === true ? ".*?" : STAR;
|
|
1332
|
-
if (opts.capture) star = `(${star})`;
|
|
1333
|
-
const globstar = (opts$1) => {
|
|
1334
|
-
if (opts$1.noglobstar === true) return star;
|
|
1335
|
-
return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
|
|
1336
|
-
};
|
|
1337
|
-
const create = (str) => {
|
|
1338
|
-
switch (str) {
|
|
1339
|
-
case "*": return `${nodot}${ONE_CHAR$1}${star}`;
|
|
1340
|
-
case ".*": return `${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
1341
|
-
case "*.*": return `${nodot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
1342
|
-
case "*/*": return `${nodot}${star}${SLASH_LITERAL$1}${ONE_CHAR$1}${slashDot}${star}`;
|
|
1343
|
-
case "**": return nodot + globstar(opts);
|
|
1344
|
-
case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${ONE_CHAR$1}${star}`;
|
|
1345
|
-
case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
1346
|
-
case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
|
1347
|
-
default: {
|
|
1348
|
-
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
1349
|
-
if (!match) return;
|
|
1350
|
-
const source$1 = create(match[1]);
|
|
1351
|
-
if (!source$1) return;
|
|
1352
|
-
return source$1 + DOT_LITERAL$1 + match[2];
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
};
|
|
1356
|
-
let source = create(utils$2.removePrefix(input, state));
|
|
1357
|
-
if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL$1}?`;
|
|
1358
|
-
return source;
|
|
1359
|
-
};
|
|
1360
|
-
module.exports = parse$1;
|
|
1361
|
-
}));
|
|
1362
|
-
|
|
1363
|
-
//#endregion
|
|
1364
|
-
//#region node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js
|
|
1365
|
-
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1366
|
-
const scan = require_scan();
|
|
1367
|
-
const parse = require_parse();
|
|
1368
|
-
const utils$1 = require_utils();
|
|
1369
|
-
const constants = require_constants();
|
|
1370
|
-
const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
1371
|
-
/**
|
|
1372
|
-
* Creates a matcher function from one or more glob patterns. The
|
|
1373
|
-
* returned function takes a string to match as its first argument,
|
|
1374
|
-
* and returns true if the string is a match. The returned matcher
|
|
1375
|
-
* function also takes a boolean as the second argument that, when true,
|
|
1376
|
-
* returns an object with additional information.
|
|
1377
|
-
*
|
|
1378
|
-
* ```js
|
|
1379
|
-
* const picomatch = require('picomatch');
|
|
1380
|
-
* // picomatch(glob[, options]);
|
|
1381
|
-
*
|
|
1382
|
-
* const isMatch = picomatch('*.!(*a)');
|
|
1383
|
-
* console.log(isMatch('a.a')); //=> false
|
|
1384
|
-
* console.log(isMatch('a.b')); //=> true
|
|
1385
|
-
* ```
|
|
1386
|
-
* @name picomatch
|
|
1387
|
-
* @param {String|Array} `globs` One or more glob patterns.
|
|
1388
|
-
* @param {Object=} `options`
|
|
1389
|
-
* @return {Function=} Returns a matcher function.
|
|
1390
|
-
* @api public
|
|
1391
|
-
*/
|
|
1392
|
-
const picomatch$1 = (glob, options, returnState = false) => {
|
|
1393
|
-
if (Array.isArray(glob)) {
|
|
1394
|
-
const fns = glob.map((input) => picomatch$1(input, options, returnState));
|
|
1395
|
-
const arrayMatcher = (str) => {
|
|
1396
|
-
for (const isMatch of fns) {
|
|
1397
|
-
const state$1 = isMatch(str);
|
|
1398
|
-
if (state$1) return state$1;
|
|
1399
|
-
}
|
|
1400
|
-
return false;
|
|
1401
|
-
};
|
|
1402
|
-
return arrayMatcher;
|
|
1403
|
-
}
|
|
1404
|
-
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
1405
|
-
if (glob === "" || typeof glob !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
|
|
1406
|
-
const opts = options || {};
|
|
1407
|
-
const posix = opts.windows;
|
|
1408
|
-
const regex = isState ? picomatch$1.compileRe(glob, options) : picomatch$1.makeRe(glob, options, false, true);
|
|
1409
|
-
const state = regex.state;
|
|
1410
|
-
delete regex.state;
|
|
1411
|
-
let isIgnored = () => false;
|
|
1412
|
-
if (opts.ignore) {
|
|
1413
|
-
const ignoreOpts = {
|
|
1414
|
-
...options,
|
|
1415
|
-
ignore: null,
|
|
1416
|
-
onMatch: null,
|
|
1417
|
-
onResult: null
|
|
1418
|
-
};
|
|
1419
|
-
isIgnored = picomatch$1(opts.ignore, ignoreOpts, returnState);
|
|
1420
|
-
}
|
|
1421
|
-
const matcher = (input, returnObject = false) => {
|
|
1422
|
-
const { isMatch, match, output } = picomatch$1.test(input, regex, options, {
|
|
1423
|
-
glob,
|
|
1424
|
-
posix
|
|
1425
|
-
});
|
|
1426
|
-
const result = {
|
|
1427
|
-
glob,
|
|
1428
|
-
state,
|
|
1429
|
-
regex,
|
|
1430
|
-
posix,
|
|
1431
|
-
input,
|
|
1432
|
-
output,
|
|
1433
|
-
match,
|
|
1434
|
-
isMatch
|
|
1435
|
-
};
|
|
1436
|
-
if (typeof opts.onResult === "function") opts.onResult(result);
|
|
1437
|
-
if (isMatch === false) {
|
|
1438
|
-
result.isMatch = false;
|
|
1439
|
-
return returnObject ? result : false;
|
|
1440
|
-
}
|
|
1441
|
-
if (isIgnored(input)) {
|
|
1442
|
-
if (typeof opts.onIgnore === "function") opts.onIgnore(result);
|
|
1443
|
-
result.isMatch = false;
|
|
1444
|
-
return returnObject ? result : false;
|
|
1445
|
-
}
|
|
1446
|
-
if (typeof opts.onMatch === "function") opts.onMatch(result);
|
|
1447
|
-
return returnObject ? result : true;
|
|
1448
|
-
};
|
|
1449
|
-
if (returnState) matcher.state = state;
|
|
1450
|
-
return matcher;
|
|
1451
|
-
};
|
|
1452
|
-
/**
|
|
1453
|
-
* Test `input` with the given `regex`. This is used by the main
|
|
1454
|
-
* `picomatch()` function to test the input string.
|
|
1455
|
-
*
|
|
1456
|
-
* ```js
|
|
1457
|
-
* const picomatch = require('picomatch');
|
|
1458
|
-
* // picomatch.test(input, regex[, options]);
|
|
1459
|
-
*
|
|
1460
|
-
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
|
1461
|
-
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
|
1462
|
-
* ```
|
|
1463
|
-
* @param {String} `input` String to test.
|
|
1464
|
-
* @param {RegExp} `regex`
|
|
1465
|
-
* @return {Object} Returns an object with matching info.
|
|
1466
|
-
* @api public
|
|
1467
|
-
*/
|
|
1468
|
-
picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
|
|
1469
|
-
if (typeof input !== "string") throw new TypeError("Expected input to be a string");
|
|
1470
|
-
if (input === "") return {
|
|
1471
|
-
isMatch: false,
|
|
1472
|
-
output: ""
|
|
1473
|
-
};
|
|
1474
|
-
const opts = options || {};
|
|
1475
|
-
const format = opts.format || (posix ? utils$1.toPosixSlashes : null);
|
|
1476
|
-
let match = input === glob;
|
|
1477
|
-
let output = match && format ? format(input) : input;
|
|
1478
|
-
if (match === false) {
|
|
1479
|
-
output = format ? format(input) : input;
|
|
1480
|
-
match = output === glob;
|
|
1481
|
-
}
|
|
1482
|
-
if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch$1.matchBase(input, regex, options, posix);
|
|
1483
|
-
else match = regex.exec(output);
|
|
1484
|
-
return {
|
|
1485
|
-
isMatch: Boolean(match),
|
|
1486
|
-
match,
|
|
1487
|
-
output
|
|
1488
|
-
};
|
|
1489
|
-
};
|
|
1490
|
-
/**
|
|
1491
|
-
* Match the basename of a filepath.
|
|
1492
|
-
*
|
|
1493
|
-
* ```js
|
|
1494
|
-
* const picomatch = require('picomatch');
|
|
1495
|
-
* // picomatch.matchBase(input, glob[, options]);
|
|
1496
|
-
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
|
1497
|
-
* ```
|
|
1498
|
-
* @param {String} `input` String to test.
|
|
1499
|
-
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
|
1500
|
-
* @return {Boolean}
|
|
1501
|
-
* @api public
|
|
1502
|
-
*/
|
|
1503
|
-
picomatch$1.matchBase = (input, glob, options) => {
|
|
1504
|
-
return (glob instanceof RegExp ? glob : picomatch$1.makeRe(glob, options)).test(utils$1.basename(input));
|
|
1505
|
-
};
|
|
1506
|
-
/**
|
|
1507
|
-
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
1508
|
-
*
|
|
1509
|
-
* ```js
|
|
1510
|
-
* const picomatch = require('picomatch');
|
|
1511
|
-
* // picomatch.isMatch(string, patterns[, options]);
|
|
1512
|
-
*
|
|
1513
|
-
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
1514
|
-
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
|
1515
|
-
* ```
|
|
1516
|
-
* @param {String|Array} str The string to test.
|
|
1517
|
-
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
|
1518
|
-
* @param {Object} [options] See available [options](#options).
|
|
1519
|
-
* @return {Boolean} Returns true if any patterns match `str`
|
|
1520
|
-
* @api public
|
|
1521
|
-
*/
|
|
1522
|
-
picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)(str);
|
|
1523
|
-
/**
|
|
1524
|
-
* Parse a glob pattern to create the source string for a regular
|
|
1525
|
-
* expression.
|
|
1526
|
-
*
|
|
1527
|
-
* ```js
|
|
1528
|
-
* const picomatch = require('picomatch');
|
|
1529
|
-
* const result = picomatch.parse(pattern[, options]);
|
|
1530
|
-
* ```
|
|
1531
|
-
* @param {String} `pattern`
|
|
1532
|
-
* @param {Object} `options`
|
|
1533
|
-
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
|
1534
|
-
* @api public
|
|
1535
|
-
*/
|
|
1536
|
-
picomatch$1.parse = (pattern, options) => {
|
|
1537
|
-
if (Array.isArray(pattern)) return pattern.map((p) => picomatch$1.parse(p, options));
|
|
1538
|
-
return parse(pattern, {
|
|
1539
|
-
...options,
|
|
1540
|
-
fastpaths: false
|
|
1541
|
-
});
|
|
1542
|
-
};
|
|
1543
|
-
/**
|
|
1544
|
-
* Scan a glob pattern to separate the pattern into segments.
|
|
1545
|
-
*
|
|
1546
|
-
* ```js
|
|
1547
|
-
* const picomatch = require('picomatch');
|
|
1548
|
-
* // picomatch.scan(input[, options]);
|
|
1549
|
-
*
|
|
1550
|
-
* const result = picomatch.scan('!./foo/*.js');
|
|
1551
|
-
* console.log(result);
|
|
1552
|
-
* { prefix: '!./',
|
|
1553
|
-
* input: '!./foo/*.js',
|
|
1554
|
-
* start: 3,
|
|
1555
|
-
* base: 'foo',
|
|
1556
|
-
* glob: '*.js',
|
|
1557
|
-
* isBrace: false,
|
|
1558
|
-
* isBracket: false,
|
|
1559
|
-
* isGlob: true,
|
|
1560
|
-
* isExtglob: false,
|
|
1561
|
-
* isGlobstar: false,
|
|
1562
|
-
* negated: true }
|
|
1563
|
-
* ```
|
|
1564
|
-
* @param {String} `input` Glob pattern to scan.
|
|
1565
|
-
* @param {Object} `options`
|
|
1566
|
-
* @return {Object} Returns an object with
|
|
1567
|
-
* @api public
|
|
1568
|
-
*/
|
|
1569
|
-
picomatch$1.scan = (input, options) => scan(input, options);
|
|
1570
|
-
/**
|
|
1571
|
-
* Compile a regular expression from the `state` object returned by the
|
|
1572
|
-
* [parse()](#parse) method.
|
|
1573
|
-
*
|
|
1574
|
-
* @param {Object} `state`
|
|
1575
|
-
* @param {Object} `options`
|
|
1576
|
-
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
1577
|
-
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
|
1578
|
-
* @return {RegExp}
|
|
1579
|
-
* @api public
|
|
1580
|
-
*/
|
|
1581
|
-
picomatch$1.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
1582
|
-
if (returnOutput === true) return state.output;
|
|
1583
|
-
const opts = options || {};
|
|
1584
|
-
const prepend = opts.contains ? "" : "^";
|
|
1585
|
-
const append = opts.contains ? "" : "$";
|
|
1586
|
-
let source = `${prepend}(?:${state.output})${append}`;
|
|
1587
|
-
if (state && state.negated === true) source = `^(?!${source}).*$`;
|
|
1588
|
-
const regex = picomatch$1.toRegex(source, options);
|
|
1589
|
-
if (returnState === true) regex.state = state;
|
|
1590
|
-
return regex;
|
|
1591
|
-
};
|
|
1592
|
-
/**
|
|
1593
|
-
* Create a regular expression from a parsed glob pattern.
|
|
1594
|
-
*
|
|
1595
|
-
* ```js
|
|
1596
|
-
* const picomatch = require('picomatch');
|
|
1597
|
-
* const state = picomatch.parse('*.js');
|
|
1598
|
-
* // picomatch.compileRe(state[, options]);
|
|
1599
|
-
*
|
|
1600
|
-
* console.log(picomatch.compileRe(state));
|
|
1601
|
-
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
1602
|
-
* ```
|
|
1603
|
-
* @param {String} `state` The object returned from the `.parse` method.
|
|
1604
|
-
* @param {Object} `options`
|
|
1605
|
-
* @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
|
|
1606
|
-
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
|
1607
|
-
* @return {RegExp} Returns a regex created from the given pattern.
|
|
1608
|
-
* @api public
|
|
1609
|
-
*/
|
|
1610
|
-
picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
1611
|
-
if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
|
|
1612
|
-
let parsed = {
|
|
1613
|
-
negated: false,
|
|
1614
|
-
fastpaths: true
|
|
1615
|
-
};
|
|
1616
|
-
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
|
|
1617
|
-
if (!parsed.output) parsed = parse(input, options);
|
|
1618
|
-
return picomatch$1.compileRe(parsed, options, returnOutput, returnState);
|
|
1619
|
-
};
|
|
1620
|
-
/**
|
|
1621
|
-
* Create a regular expression from the given regex source string.
|
|
1622
|
-
*
|
|
1623
|
-
* ```js
|
|
1624
|
-
* const picomatch = require('picomatch');
|
|
1625
|
-
* // picomatch.toRegex(source[, options]);
|
|
1626
|
-
*
|
|
1627
|
-
* const { output } = picomatch.parse('*.js');
|
|
1628
|
-
* console.log(picomatch.toRegex(output));
|
|
1629
|
-
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
1630
|
-
* ```
|
|
1631
|
-
* @param {String} `source` Regular expression source string.
|
|
1632
|
-
* @param {Object} `options`
|
|
1633
|
-
* @return {RegExp}
|
|
1634
|
-
* @api public
|
|
1635
|
-
*/
|
|
1636
|
-
picomatch$1.toRegex = (source, options) => {
|
|
1637
|
-
try {
|
|
1638
|
-
const opts = options || {};
|
|
1639
|
-
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
1640
|
-
} catch (err) {
|
|
1641
|
-
if (options && options.debug === true) throw err;
|
|
1642
|
-
return /$^/;
|
|
1643
|
-
}
|
|
1644
|
-
};
|
|
1645
|
-
/**
|
|
1646
|
-
* Picomatch constants.
|
|
1647
|
-
* @return {Object}
|
|
1648
|
-
*/
|
|
1649
|
-
picomatch$1.constants = constants;
|
|
1650
|
-
/**
|
|
1651
|
-
* Expose "picomatch"
|
|
1652
|
-
*/
|
|
1653
|
-
module.exports = picomatch$1;
|
|
1654
|
-
}));
|
|
1655
|
-
|
|
1656
|
-
//#endregion
|
|
1657
|
-
//#region node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js
|
|
1658
|
-
var require_picomatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1659
|
-
const pico = require_picomatch$1();
|
|
1660
|
-
const utils = require_utils();
|
|
1661
|
-
function picomatch(glob, options, returnState = false) {
|
|
1662
|
-
if (options && (options.windows === null || options.windows === void 0)) options = {
|
|
1663
|
-
...options,
|
|
1664
|
-
windows: utils.isWindows()
|
|
1665
|
-
};
|
|
1666
|
-
return pico(glob, options, returnState);
|
|
1667
|
-
}
|
|
1668
|
-
Object.assign(picomatch, pico);
|
|
1669
|
-
module.exports = picomatch;
|
|
1670
|
-
}));
|
|
1671
|
-
|
|
1672
|
-
//#endregion
|
|
1673
|
-
export { require_picomatch as t };
|