unplugin-vue-components 29.2.0 → 31.0.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/README.md +4 -36
- package/dist/esbuild.d.mts +7 -0
- package/dist/esbuild.mjs +9 -0
- package/dist/{index.d.cts → index.d.mts} +4 -2
- package/dist/index.mjs +4 -0
- package/dist/nuxt.d.mts +7 -0
- package/dist/{nuxt.js → nuxt.mjs} +4 -4
- package/dist/{resolvers.d.ts → resolvers.d.mts} +189 -218
- package/dist/{resolvers.js → resolvers.mjs} +28 -83
- package/dist/rolldown.d.mts +7 -0
- package/dist/rolldown.mjs +9 -0
- package/dist/rollup.d.mts +7 -0
- package/dist/rollup.mjs +9 -0
- package/dist/rspack.d.mts +6 -0
- package/dist/rspack.mjs +9 -0
- package/dist/{src-bfjkatac.js → src-pYuu2TZ_.mjs} +53 -141
- package/dist/types-CWfK8m_y.d.mts +217 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +1 -0
- package/dist/utils-DuuqqWXg.mjs +234 -0
- package/dist/vite.d.mts +9 -0
- package/dist/vite.mjs +9 -0
- package/dist/webpack.d.mts +7 -0
- package/dist/webpack.mjs +9 -0
- package/package.json +40 -78
- package/dist/esbuild.cjs +0 -9
- package/dist/esbuild.d.cts +0 -6
- package/dist/esbuild.d.ts +0 -7
- package/dist/esbuild.js +0 -9
- package/dist/index.cjs +0 -9
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -5
- package/dist/nuxt.cjs +0 -14
- package/dist/nuxt.d.cts +0 -6
- package/dist/nuxt.d.ts +0 -7
- package/dist/resolvers.cjs +0 -2074
- package/dist/resolvers.d.cts +0 -574
- package/dist/rolldown.cjs +0 -9
- package/dist/rolldown.d.cts +0 -6
- package/dist/rolldown.d.ts +0 -7
- package/dist/rolldown.js +0 -9
- package/dist/rollup.cjs +0 -9
- package/dist/rollup.d.cts +0 -6
- package/dist/rollup.d.ts +0 -7
- package/dist/rollup.js +0 -9
- package/dist/rspack.cjs +0 -9
- package/dist/rspack.d.cts +0 -5
- package/dist/rspack.d.ts +0 -6
- package/dist/rspack.js +0 -9
- package/dist/src-BTwFq3T3.cjs +0 -188
- package/dist/src-D2-JfLYq.js +0 -187
- package/dist/src-DAvVDVLg.cjs +0 -769
- package/dist/types-CBTc19th.cjs +0 -0
- package/dist/types-DSJ5r-ta.d.cts +0 -225
- package/dist/types-rC3290ja.d.ts +0 -225
- package/dist/types.cjs +0 -1
- package/dist/types.d.cts +0 -2
- package/dist/types.d.ts +0 -2
- package/dist/types.js +0 -3
- package/dist/utils-8UQ22cuO.cjs +0 -1689
- package/dist/utils-BoXu-4gQ.js +0 -1523
- package/dist/vite.cjs +0 -9
- package/dist/vite.d.cts +0 -8
- package/dist/vite.d.ts +0 -9
- package/dist/vite.js +0 -9
- package/dist/webpack.cjs +0 -9
- package/dist/webpack.d.cts +0 -6
- package/dist/webpack.d.ts +0 -7
- package/dist/webpack.js +0 -9
- /package/dist/{types-DQoXDiso.js → types--fVOUYBq.mjs} +0 -0
package/dist/utils-BoXu-4gQ.js
DELETED
|
@@ -1,1523 +0,0 @@
|
|
|
1
|
-
import process$1 from "node:process";
|
|
2
|
-
import { parse } from "node:path";
|
|
3
|
-
import { getPackageInfo, isPackageExists } from "local-pkg";
|
|
4
|
-
|
|
5
|
-
//#region node_modules/.pnpm/@antfu+utils@9.3.0/node_modules/@antfu/utils/dist/index.mjs
|
|
6
|
-
function toArray(array) {
|
|
7
|
-
array = array ?? [];
|
|
8
|
-
return Array.isArray(array) ? array : [array];
|
|
9
|
-
}
|
|
10
|
-
function notNullish(v) {
|
|
11
|
-
return v != null;
|
|
12
|
-
}
|
|
13
|
-
function slash(str) {
|
|
14
|
-
return str.replace(/\\/g, "/");
|
|
15
|
-
}
|
|
16
|
-
const VOID = Symbol("p-void");
|
|
17
|
-
/**
|
|
18
|
-
* Throttle execution of a function. Especially useful for rate limiting
|
|
19
|
-
* execution of handlers on events like resize and scroll.
|
|
20
|
-
*
|
|
21
|
-
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)
|
|
22
|
-
* are most useful.
|
|
23
|
-
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,
|
|
24
|
-
* as-is, to `callback` when the throttled-function is executed.
|
|
25
|
-
* @param {object} [options] - An object to configure options.
|
|
26
|
-
* @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds
|
|
27
|
-
* while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed
|
|
28
|
-
* one final time after the last throttled-function call. (After the throttled-function has not been called for
|
|
29
|
-
* `delay` milliseconds, the internal counter is reset).
|
|
30
|
-
* @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback
|
|
31
|
-
* immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that
|
|
32
|
-
* callback will never executed if both noLeading = true and noTrailing = true.
|
|
33
|
-
* @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is
|
|
34
|
-
* false (at end), schedule `callback` to execute after `delay` ms.
|
|
35
|
-
*
|
|
36
|
-
* @returns {Function} A new, throttled, function.
|
|
37
|
-
*/
|
|
38
|
-
function throttle$1(delay, callback, options) {
|
|
39
|
-
var _ref = options || {}, _ref$noTrailing = _ref.noTrailing, noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing, _ref$noLeading = _ref.noLeading, noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading, _ref$debounceMode = _ref.debounceMode, debounceMode = _ref$debounceMode === void 0 ? void 0 : _ref$debounceMode;
|
|
40
|
-
var timeoutID;
|
|
41
|
-
var cancelled = false;
|
|
42
|
-
var lastExec = 0;
|
|
43
|
-
function clearExistingTimeout() {
|
|
44
|
-
if (timeoutID) clearTimeout(timeoutID);
|
|
45
|
-
}
|
|
46
|
-
function cancel(options$1) {
|
|
47
|
-
var _ref2$upcomingOnly = (options$1 || {}).upcomingOnly, upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
|
|
48
|
-
clearExistingTimeout();
|
|
49
|
-
cancelled = !upcomingOnly;
|
|
50
|
-
}
|
|
51
|
-
function wrapper() {
|
|
52
|
-
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) arguments_[_key] = arguments[_key];
|
|
53
|
-
var self = this;
|
|
54
|
-
var elapsed = Date.now() - lastExec;
|
|
55
|
-
if (cancelled) return;
|
|
56
|
-
function exec() {
|
|
57
|
-
lastExec = Date.now();
|
|
58
|
-
callback.apply(self, arguments_);
|
|
59
|
-
}
|
|
60
|
-
function clear() {
|
|
61
|
-
timeoutID = void 0;
|
|
62
|
-
}
|
|
63
|
-
if (!noLeading && debounceMode && !timeoutID) exec();
|
|
64
|
-
clearExistingTimeout();
|
|
65
|
-
if (debounceMode === void 0 && elapsed > delay) if (noLeading) {
|
|
66
|
-
lastExec = Date.now();
|
|
67
|
-
if (!noTrailing) timeoutID = setTimeout(debounceMode ? clear : exec, delay);
|
|
68
|
-
} else exec();
|
|
69
|
-
else if (noTrailing !== true) timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === void 0 ? delay - elapsed : delay);
|
|
70
|
-
}
|
|
71
|
-
wrapper.cancel = cancel;
|
|
72
|
-
return wrapper;
|
|
73
|
-
}
|
|
74
|
-
function throttle(...args) {
|
|
75
|
-
return throttle$1(...args);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
//#endregion
|
|
79
|
-
//#region src/core/constants.ts
|
|
80
|
-
const DISABLE_COMMENT = "/* unplugin-vue-components disabled */";
|
|
81
|
-
const DIRECTIVE_IMPORT_PREFIX = "v";
|
|
82
|
-
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region node_modules/.pnpm/@isaacs+balanced-match@4.0.1/node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
85
|
-
const balanced = (a, b, str) => {
|
|
86
|
-
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
87
|
-
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
|
|
88
|
-
const r = ma !== null && mb != null && range(ma, mb, str);
|
|
89
|
-
return r && {
|
|
90
|
-
start: r[0],
|
|
91
|
-
end: r[1],
|
|
92
|
-
pre: str.slice(0, r[0]),
|
|
93
|
-
body: str.slice(r[0] + ma.length, r[1]),
|
|
94
|
-
post: str.slice(r[1] + mb.length)
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
const maybeMatch = (reg, str) => {
|
|
98
|
-
const m = str.match(reg);
|
|
99
|
-
return m ? m[0] : null;
|
|
100
|
-
};
|
|
101
|
-
const range = (a, b, str) => {
|
|
102
|
-
let begs, beg, left, right = void 0, result;
|
|
103
|
-
let ai = str.indexOf(a);
|
|
104
|
-
let bi = str.indexOf(b, ai + 1);
|
|
105
|
-
let i = ai;
|
|
106
|
-
if (ai >= 0 && bi > 0) {
|
|
107
|
-
if (a === b) return [ai, bi];
|
|
108
|
-
begs = [];
|
|
109
|
-
left = str.length;
|
|
110
|
-
while (i >= 0 && !result) {
|
|
111
|
-
if (i === ai) {
|
|
112
|
-
begs.push(i);
|
|
113
|
-
ai = str.indexOf(a, i + 1);
|
|
114
|
-
} else if (begs.length === 1) {
|
|
115
|
-
const r = begs.pop();
|
|
116
|
-
if (r !== void 0) result = [r, bi];
|
|
117
|
-
} else {
|
|
118
|
-
beg = begs.pop();
|
|
119
|
-
if (beg !== void 0 && beg < left) {
|
|
120
|
-
left = beg;
|
|
121
|
-
right = bi;
|
|
122
|
-
}
|
|
123
|
-
bi = str.indexOf(b, i + 1);
|
|
124
|
-
}
|
|
125
|
-
i = ai < bi && ai >= 0 ? ai : bi;
|
|
126
|
-
}
|
|
127
|
-
if (begs.length && right !== void 0) result = [left, right];
|
|
128
|
-
}
|
|
129
|
-
return result;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
//#endregion
|
|
133
|
-
//#region node_modules/.pnpm/@isaacs+brace-expansion@5.0.0/node_modules/@isaacs/brace-expansion/dist/esm/index.js
|
|
134
|
-
const escSlash = "\0SLASH" + Math.random() + "\0";
|
|
135
|
-
const escOpen = "\0OPEN" + Math.random() + "\0";
|
|
136
|
-
const escClose = "\0CLOSE" + Math.random() + "\0";
|
|
137
|
-
const escComma = "\0COMMA" + Math.random() + "\0";
|
|
138
|
-
const escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
139
|
-
const escSlashPattern = new RegExp(escSlash, "g");
|
|
140
|
-
const escOpenPattern = new RegExp(escOpen, "g");
|
|
141
|
-
const escClosePattern = new RegExp(escClose, "g");
|
|
142
|
-
const escCommaPattern = new RegExp(escComma, "g");
|
|
143
|
-
const escPeriodPattern = new RegExp(escPeriod, "g");
|
|
144
|
-
const slashPattern = /\\\\/g;
|
|
145
|
-
const openPattern = /\\{/g;
|
|
146
|
-
const closePattern = /\\}/g;
|
|
147
|
-
const commaPattern = /\\,/g;
|
|
148
|
-
const periodPattern = /\\./g;
|
|
149
|
-
function numeric(str) {
|
|
150
|
-
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
151
|
-
}
|
|
152
|
-
function escapeBraces(str) {
|
|
153
|
-
return str.replace(slashPattern, escSlash).replace(openPattern, escOpen).replace(closePattern, escClose).replace(commaPattern, escComma).replace(periodPattern, escPeriod);
|
|
154
|
-
}
|
|
155
|
-
function unescapeBraces(str) {
|
|
156
|
-
return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Basically just str.split(","), but handling cases
|
|
160
|
-
* where we have nested braced sections, which should be
|
|
161
|
-
* treated as individual members, like {a,{b,c},d}
|
|
162
|
-
*/
|
|
163
|
-
function parseCommaParts(str) {
|
|
164
|
-
if (!str) return [""];
|
|
165
|
-
const parts = [];
|
|
166
|
-
const m = balanced("{", "}", str);
|
|
167
|
-
if (!m) return str.split(",");
|
|
168
|
-
const { pre, body, post } = m;
|
|
169
|
-
const p = pre.split(",");
|
|
170
|
-
p[p.length - 1] += "{" + body + "}";
|
|
171
|
-
const postParts = parseCommaParts(post);
|
|
172
|
-
if (post.length) {
|
|
173
|
-
p[p.length - 1] += postParts.shift();
|
|
174
|
-
p.push.apply(p, postParts);
|
|
175
|
-
}
|
|
176
|
-
parts.push.apply(parts, p);
|
|
177
|
-
return parts;
|
|
178
|
-
}
|
|
179
|
-
function expand(str) {
|
|
180
|
-
if (!str) return [];
|
|
181
|
-
if (str.slice(0, 2) === "{}") str = "\\{\\}" + str.slice(2);
|
|
182
|
-
return expand_(escapeBraces(str), true).map(unescapeBraces);
|
|
183
|
-
}
|
|
184
|
-
function embrace(str) {
|
|
185
|
-
return "{" + str + "}";
|
|
186
|
-
}
|
|
187
|
-
function isPadded(el) {
|
|
188
|
-
return /^-?0\d/.test(el);
|
|
189
|
-
}
|
|
190
|
-
function lte(i, y) {
|
|
191
|
-
return i <= y;
|
|
192
|
-
}
|
|
193
|
-
function gte(i, y) {
|
|
194
|
-
return i >= y;
|
|
195
|
-
}
|
|
196
|
-
function expand_(str, isTop) {
|
|
197
|
-
/** @type {string[]} */
|
|
198
|
-
const expansions = [];
|
|
199
|
-
const m = balanced("{", "}", str);
|
|
200
|
-
if (!m) return [str];
|
|
201
|
-
const pre = m.pre;
|
|
202
|
-
const post = m.post.length ? expand_(m.post, false) : [""];
|
|
203
|
-
if (/\$$/.test(m.pre)) for (let k = 0; k < post.length; k++) {
|
|
204
|
-
const expansion = pre + "{" + m.body + "}" + post[k];
|
|
205
|
-
expansions.push(expansion);
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
209
|
-
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
210
|
-
const isSequence = isNumericSequence || isAlphaSequence;
|
|
211
|
-
const isOptions = m.body.indexOf(",") >= 0;
|
|
212
|
-
if (!isSequence && !isOptions) {
|
|
213
|
-
if (m.post.match(/,(?!,).*\}/)) {
|
|
214
|
-
str = m.pre + "{" + m.body + escClose + m.post;
|
|
215
|
-
return expand_(str);
|
|
216
|
-
}
|
|
217
|
-
return [str];
|
|
218
|
-
}
|
|
219
|
-
let n;
|
|
220
|
-
if (isSequence) n = m.body.split(/\.\./);
|
|
221
|
-
else {
|
|
222
|
-
n = parseCommaParts(m.body);
|
|
223
|
-
if (n.length === 1 && n[0] !== void 0) {
|
|
224
|
-
n = expand_(n[0], false).map(embrace);
|
|
225
|
-
/* c8 ignore start */
|
|
226
|
-
if (n.length === 1) return post.map((p) => m.pre + n[0] + p);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
let N;
|
|
230
|
-
if (isSequence && n[0] !== void 0 && n[1] !== void 0) {
|
|
231
|
-
const x = numeric(n[0]);
|
|
232
|
-
const y = numeric(n[1]);
|
|
233
|
-
const width = Math.max(n[0].length, n[1].length);
|
|
234
|
-
let incr = n.length === 3 && n[2] !== void 0 ? Math.abs(numeric(n[2])) : 1;
|
|
235
|
-
let test = lte;
|
|
236
|
-
if (y < x) {
|
|
237
|
-
incr *= -1;
|
|
238
|
-
test = gte;
|
|
239
|
-
}
|
|
240
|
-
const pad = n.some(isPadded);
|
|
241
|
-
N = [];
|
|
242
|
-
for (let i = x; test(i, y); i += incr) {
|
|
243
|
-
let c;
|
|
244
|
-
if (isAlphaSequence) {
|
|
245
|
-
c = String.fromCharCode(i);
|
|
246
|
-
if (c === "\\") c = "";
|
|
247
|
-
} else {
|
|
248
|
-
c = String(i);
|
|
249
|
-
if (pad) {
|
|
250
|
-
const need = width - c.length;
|
|
251
|
-
if (need > 0) {
|
|
252
|
-
const z = new Array(need + 1).join("0");
|
|
253
|
-
if (i < 0) c = "-" + z + c.slice(1);
|
|
254
|
-
else c = z + c;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
N.push(c);
|
|
259
|
-
}
|
|
260
|
-
} else {
|
|
261
|
-
N = [];
|
|
262
|
-
for (let j = 0; j < n.length; j++) N.push.apply(N, expand_(n[j], false));
|
|
263
|
-
}
|
|
264
|
-
for (let j = 0; j < N.length; j++) for (let k = 0; k < post.length; k++) {
|
|
265
|
-
const expansion = pre + N[j] + post[k];
|
|
266
|
-
if (!isTop || isSequence || expansion) expansions.push(expansion);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
return expansions;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
//#endregion
|
|
273
|
-
//#region node_modules/.pnpm/minimatch@10.0.3/node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
274
|
-
const MAX_PATTERN_LENGTH = 1024 * 64;
|
|
275
|
-
const assertValidPattern = (pattern) => {
|
|
276
|
-
if (typeof pattern !== "string") throw new TypeError("invalid pattern");
|
|
277
|
-
if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
//#endregion
|
|
281
|
-
//#region node_modules/.pnpm/minimatch@10.0.3/node_modules/minimatch/dist/esm/brace-expressions.js
|
|
282
|
-
const posixClasses = {
|
|
283
|
-
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
284
|
-
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
285
|
-
"[:ascii:]": ["\\x00-\\x7f", false],
|
|
286
|
-
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
287
|
-
"[:cntrl:]": ["\\p{Cc}", true],
|
|
288
|
-
"[:digit:]": ["\\p{Nd}", true],
|
|
289
|
-
"[:graph:]": [
|
|
290
|
-
"\\p{Z}\\p{C}",
|
|
291
|
-
true,
|
|
292
|
-
true
|
|
293
|
-
],
|
|
294
|
-
"[:lower:]": ["\\p{Ll}", true],
|
|
295
|
-
"[:print:]": ["\\p{C}", true],
|
|
296
|
-
"[:punct:]": ["\\p{P}", true],
|
|
297
|
-
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
298
|
-
"[:upper:]": ["\\p{Lu}", true],
|
|
299
|
-
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
300
|
-
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
301
|
-
};
|
|
302
|
-
const braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
303
|
-
const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
304
|
-
const rangesToString = (ranges) => ranges.join("");
|
|
305
|
-
const parseClass = (glob, position) => {
|
|
306
|
-
const pos = position;
|
|
307
|
-
/* c8 ignore start */
|
|
308
|
-
if (glob.charAt(pos) !== "[") throw new Error("not in a brace expression");
|
|
309
|
-
/* c8 ignore stop */
|
|
310
|
-
const ranges = [];
|
|
311
|
-
const negs = [];
|
|
312
|
-
let i = pos + 1;
|
|
313
|
-
let sawStart = false;
|
|
314
|
-
let uflag = false;
|
|
315
|
-
let escaping = false;
|
|
316
|
-
let negate = false;
|
|
317
|
-
let endPos = pos;
|
|
318
|
-
let rangeStart = "";
|
|
319
|
-
WHILE: while (i < glob.length) {
|
|
320
|
-
const c = glob.charAt(i);
|
|
321
|
-
if ((c === "!" || c === "^") && i === pos + 1) {
|
|
322
|
-
negate = true;
|
|
323
|
-
i++;
|
|
324
|
-
continue;
|
|
325
|
-
}
|
|
326
|
-
if (c === "]" && sawStart && !escaping) {
|
|
327
|
-
endPos = i + 1;
|
|
328
|
-
break;
|
|
329
|
-
}
|
|
330
|
-
sawStart = true;
|
|
331
|
-
if (c === "\\") {
|
|
332
|
-
if (!escaping) {
|
|
333
|
-
escaping = true;
|
|
334
|
-
i++;
|
|
335
|
-
continue;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
if (c === "[" && !escaping) {
|
|
339
|
-
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) if (glob.startsWith(cls, i)) {
|
|
340
|
-
if (rangeStart) return [
|
|
341
|
-
"$.",
|
|
342
|
-
false,
|
|
343
|
-
glob.length - pos,
|
|
344
|
-
true
|
|
345
|
-
];
|
|
346
|
-
i += cls.length;
|
|
347
|
-
if (neg) negs.push(unip);
|
|
348
|
-
else ranges.push(unip);
|
|
349
|
-
uflag = uflag || u;
|
|
350
|
-
continue WHILE;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
escaping = false;
|
|
354
|
-
if (rangeStart) {
|
|
355
|
-
if (c > rangeStart) ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
|
|
356
|
-
else if (c === rangeStart) ranges.push(braceEscape(c));
|
|
357
|
-
rangeStart = "";
|
|
358
|
-
i++;
|
|
359
|
-
continue;
|
|
360
|
-
}
|
|
361
|
-
if (glob.startsWith("-]", i + 1)) {
|
|
362
|
-
ranges.push(braceEscape(c + "-"));
|
|
363
|
-
i += 2;
|
|
364
|
-
continue;
|
|
365
|
-
}
|
|
366
|
-
if (glob.startsWith("-", i + 1)) {
|
|
367
|
-
rangeStart = c;
|
|
368
|
-
i += 2;
|
|
369
|
-
continue;
|
|
370
|
-
}
|
|
371
|
-
ranges.push(braceEscape(c));
|
|
372
|
-
i++;
|
|
373
|
-
}
|
|
374
|
-
if (endPos < i) return [
|
|
375
|
-
"",
|
|
376
|
-
false,
|
|
377
|
-
0,
|
|
378
|
-
false
|
|
379
|
-
];
|
|
380
|
-
if (!ranges.length && !negs.length) return [
|
|
381
|
-
"$.",
|
|
382
|
-
false,
|
|
383
|
-
glob.length - pos,
|
|
384
|
-
true
|
|
385
|
-
];
|
|
386
|
-
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) return [
|
|
387
|
-
regexpEscape(ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0]),
|
|
388
|
-
false,
|
|
389
|
-
endPos - pos,
|
|
390
|
-
false
|
|
391
|
-
];
|
|
392
|
-
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
|
|
393
|
-
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
394
|
-
return [
|
|
395
|
-
ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs,
|
|
396
|
-
uflag,
|
|
397
|
-
endPos - pos,
|
|
398
|
-
true
|
|
399
|
-
];
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
//#endregion
|
|
403
|
-
//#region node_modules/.pnpm/minimatch@10.0.3/node_modules/minimatch/dist/esm/unescape.js
|
|
404
|
-
/**
|
|
405
|
-
* Un-escape a string that has been escaped with {@link escape}.
|
|
406
|
-
*
|
|
407
|
-
* If the {@link windowsPathsNoEscape} option is used, then square-brace
|
|
408
|
-
* escapes are removed, but not backslash escapes. For example, it will turn
|
|
409
|
-
* the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`,
|
|
410
|
-
* becuase `\` is a path separator in `windowsPathsNoEscape` mode.
|
|
411
|
-
*
|
|
412
|
-
* When `windowsPathsNoEscape` is not set, then both brace escapes and
|
|
413
|
-
* backslash escapes are removed.
|
|
414
|
-
*
|
|
415
|
-
* Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
|
|
416
|
-
* or unescaped.
|
|
417
|
-
*/
|
|
418
|
-
const unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
419
|
-
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
420
|
-
};
|
|
421
|
-
|
|
422
|
-
//#endregion
|
|
423
|
-
//#region node_modules/.pnpm/minimatch@10.0.3/node_modules/minimatch/dist/esm/ast.js
|
|
424
|
-
const types = new Set([
|
|
425
|
-
"!",
|
|
426
|
-
"?",
|
|
427
|
-
"+",
|
|
428
|
-
"*",
|
|
429
|
-
"@"
|
|
430
|
-
]);
|
|
431
|
-
const isExtglobType = (c) => types.has(c);
|
|
432
|
-
const startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
433
|
-
const startNoDot = "(?!\\.)";
|
|
434
|
-
const addPatternStart = new Set(["[", "."]);
|
|
435
|
-
const justDots = new Set(["..", "."]);
|
|
436
|
-
const reSpecials = /* @__PURE__ */ new Set("().*{}+?[]^$\\!");
|
|
437
|
-
const regExpEscape$1 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
438
|
-
const qmark = "[^/]";
|
|
439
|
-
const star$1 = qmark + "*?";
|
|
440
|
-
const starNoEmpty = qmark + "+?";
|
|
441
|
-
var AST = class AST {
|
|
442
|
-
type;
|
|
443
|
-
#root;
|
|
444
|
-
#hasMagic;
|
|
445
|
-
#uflag = false;
|
|
446
|
-
#parts = [];
|
|
447
|
-
#parent;
|
|
448
|
-
#parentIndex;
|
|
449
|
-
#negs;
|
|
450
|
-
#filledNegs = false;
|
|
451
|
-
#options;
|
|
452
|
-
#toString;
|
|
453
|
-
#emptyExt = false;
|
|
454
|
-
constructor(type, parent, options = {}) {
|
|
455
|
-
this.type = type;
|
|
456
|
-
if (type) this.#hasMagic = true;
|
|
457
|
-
this.#parent = parent;
|
|
458
|
-
this.#root = this.#parent ? this.#parent.#root : this;
|
|
459
|
-
this.#options = this.#root === this ? options : this.#root.#options;
|
|
460
|
-
this.#negs = this.#root === this ? [] : this.#root.#negs;
|
|
461
|
-
if (type === "!" && !this.#root.#filledNegs) this.#negs.push(this);
|
|
462
|
-
this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
|
|
463
|
-
}
|
|
464
|
-
get hasMagic() {
|
|
465
|
-
/* c8 ignore start */
|
|
466
|
-
if (this.#hasMagic !== void 0) return this.#hasMagic;
|
|
467
|
-
/* c8 ignore stop */
|
|
468
|
-
for (const p of this.#parts) {
|
|
469
|
-
if (typeof p === "string") continue;
|
|
470
|
-
if (p.type || p.hasMagic) return this.#hasMagic = true;
|
|
471
|
-
}
|
|
472
|
-
return this.#hasMagic;
|
|
473
|
-
}
|
|
474
|
-
toString() {
|
|
475
|
-
if (this.#toString !== void 0) return this.#toString;
|
|
476
|
-
if (!this.type) return this.#toString = this.#parts.map((p) => String(p)).join("");
|
|
477
|
-
else return this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
|
|
478
|
-
}
|
|
479
|
-
#fillNegs() {
|
|
480
|
-
/* c8 ignore start */
|
|
481
|
-
if (this !== this.#root) throw new Error("should only call on root");
|
|
482
|
-
if (this.#filledNegs) return this;
|
|
483
|
-
/* c8 ignore stop */
|
|
484
|
-
this.toString();
|
|
485
|
-
this.#filledNegs = true;
|
|
486
|
-
let n;
|
|
487
|
-
while (n = this.#negs.pop()) {
|
|
488
|
-
if (n.type !== "!") continue;
|
|
489
|
-
let p = n;
|
|
490
|
-
let pp = p.#parent;
|
|
491
|
-
while (pp) {
|
|
492
|
-
for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) for (const part of n.#parts) {
|
|
493
|
-
/* c8 ignore start */
|
|
494
|
-
if (typeof part === "string") throw new Error("string part in extglob AST??");
|
|
495
|
-
/* c8 ignore stop */
|
|
496
|
-
part.copyIn(pp.#parts[i]);
|
|
497
|
-
}
|
|
498
|
-
p = pp;
|
|
499
|
-
pp = p.#parent;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
return this;
|
|
503
|
-
}
|
|
504
|
-
push(...parts) {
|
|
505
|
-
for (const p of parts) {
|
|
506
|
-
if (p === "") continue;
|
|
507
|
-
/* c8 ignore start */
|
|
508
|
-
if (typeof p !== "string" && !(p instanceof AST && p.#parent === this)) throw new Error("invalid part: " + p);
|
|
509
|
-
/* c8 ignore stop */
|
|
510
|
-
this.#parts.push(p);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
toJSON() {
|
|
514
|
-
var _this$parent;
|
|
515
|
-
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
516
|
-
if (this.isStart() && !this.type) ret.unshift([]);
|
|
517
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && ((_this$parent = this.#parent) === null || _this$parent === void 0 ? void 0 : _this$parent.type) === "!")) ret.push({});
|
|
518
|
-
return ret;
|
|
519
|
-
}
|
|
520
|
-
isStart() {
|
|
521
|
-
var _this$parent2;
|
|
522
|
-
if (this.#root === this) return true;
|
|
523
|
-
if (!((_this$parent2 = this.#parent) === null || _this$parent2 === void 0 ? void 0 : _this$parent2.isStart())) return false;
|
|
524
|
-
if (this.#parentIndex === 0) return true;
|
|
525
|
-
const p = this.#parent;
|
|
526
|
-
for (let i = 0; i < this.#parentIndex; i++) {
|
|
527
|
-
const pp = p.#parts[i];
|
|
528
|
-
if (!(pp instanceof AST && pp.type === "!")) return false;
|
|
529
|
-
}
|
|
530
|
-
return true;
|
|
531
|
-
}
|
|
532
|
-
isEnd() {
|
|
533
|
-
var _this$parent3, _this$parent4, _this$parent5;
|
|
534
|
-
if (this.#root === this) return true;
|
|
535
|
-
if (((_this$parent3 = this.#parent) === null || _this$parent3 === void 0 ? void 0 : _this$parent3.type) === "!") return true;
|
|
536
|
-
if (!((_this$parent4 = this.#parent) === null || _this$parent4 === void 0 ? void 0 : _this$parent4.isEnd())) return false;
|
|
537
|
-
if (!this.type) return (_this$parent5 = this.#parent) === null || _this$parent5 === void 0 ? void 0 : _this$parent5.isEnd();
|
|
538
|
-
/* c8 ignore start */
|
|
539
|
-
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
540
|
-
/* c8 ignore stop */
|
|
541
|
-
return this.#parentIndex === pl - 1;
|
|
542
|
-
}
|
|
543
|
-
copyIn(part) {
|
|
544
|
-
if (typeof part === "string") this.push(part);
|
|
545
|
-
else this.push(part.clone(this));
|
|
546
|
-
}
|
|
547
|
-
clone(parent) {
|
|
548
|
-
const c = new AST(this.type, parent);
|
|
549
|
-
for (const p of this.#parts) c.copyIn(p);
|
|
550
|
-
return c;
|
|
551
|
-
}
|
|
552
|
-
static #parseAST(str, ast, pos, opt) {
|
|
553
|
-
let escaping = false;
|
|
554
|
-
let inBrace = false;
|
|
555
|
-
let braceStart = -1;
|
|
556
|
-
let braceNeg = false;
|
|
557
|
-
if (ast.type === null) {
|
|
558
|
-
let i$1 = pos;
|
|
559
|
-
let acc$1 = "";
|
|
560
|
-
while (i$1 < str.length) {
|
|
561
|
-
const c = str.charAt(i$1++);
|
|
562
|
-
if (escaping || c === "\\") {
|
|
563
|
-
escaping = !escaping;
|
|
564
|
-
acc$1 += c;
|
|
565
|
-
continue;
|
|
566
|
-
}
|
|
567
|
-
if (inBrace) {
|
|
568
|
-
if (i$1 === braceStart + 1) {
|
|
569
|
-
if (c === "^" || c === "!") braceNeg = true;
|
|
570
|
-
} else if (c === "]" && !(i$1 === braceStart + 2 && braceNeg)) inBrace = false;
|
|
571
|
-
acc$1 += c;
|
|
572
|
-
continue;
|
|
573
|
-
} else if (c === "[") {
|
|
574
|
-
inBrace = true;
|
|
575
|
-
braceStart = i$1;
|
|
576
|
-
braceNeg = false;
|
|
577
|
-
acc$1 += c;
|
|
578
|
-
continue;
|
|
579
|
-
}
|
|
580
|
-
if (!opt.noext && isExtglobType(c) && str.charAt(i$1) === "(") {
|
|
581
|
-
ast.push(acc$1);
|
|
582
|
-
acc$1 = "";
|
|
583
|
-
const ext$1 = new AST(c, ast);
|
|
584
|
-
i$1 = AST.#parseAST(str, ext$1, i$1, opt);
|
|
585
|
-
ast.push(ext$1);
|
|
586
|
-
continue;
|
|
587
|
-
}
|
|
588
|
-
acc$1 += c;
|
|
589
|
-
}
|
|
590
|
-
ast.push(acc$1);
|
|
591
|
-
return i$1;
|
|
592
|
-
}
|
|
593
|
-
let i = pos + 1;
|
|
594
|
-
let part = new AST(null, ast);
|
|
595
|
-
const parts = [];
|
|
596
|
-
let acc = "";
|
|
597
|
-
while (i < str.length) {
|
|
598
|
-
const c = str.charAt(i++);
|
|
599
|
-
if (escaping || c === "\\") {
|
|
600
|
-
escaping = !escaping;
|
|
601
|
-
acc += c;
|
|
602
|
-
continue;
|
|
603
|
-
}
|
|
604
|
-
if (inBrace) {
|
|
605
|
-
if (i === braceStart + 1) {
|
|
606
|
-
if (c === "^" || c === "!") braceNeg = true;
|
|
607
|
-
} else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
|
|
608
|
-
acc += c;
|
|
609
|
-
continue;
|
|
610
|
-
} else if (c === "[") {
|
|
611
|
-
inBrace = true;
|
|
612
|
-
braceStart = i;
|
|
613
|
-
braceNeg = false;
|
|
614
|
-
acc += c;
|
|
615
|
-
continue;
|
|
616
|
-
}
|
|
617
|
-
if (isExtglobType(c) && str.charAt(i) === "(") {
|
|
618
|
-
part.push(acc);
|
|
619
|
-
acc = "";
|
|
620
|
-
const ext$1 = new AST(c, part);
|
|
621
|
-
part.push(ext$1);
|
|
622
|
-
i = AST.#parseAST(str, ext$1, i, opt);
|
|
623
|
-
continue;
|
|
624
|
-
}
|
|
625
|
-
if (c === "|") {
|
|
626
|
-
part.push(acc);
|
|
627
|
-
acc = "";
|
|
628
|
-
parts.push(part);
|
|
629
|
-
part = new AST(null, ast);
|
|
630
|
-
continue;
|
|
631
|
-
}
|
|
632
|
-
if (c === ")") {
|
|
633
|
-
if (acc === "" && ast.#parts.length === 0) ast.#emptyExt = true;
|
|
634
|
-
part.push(acc);
|
|
635
|
-
acc = "";
|
|
636
|
-
ast.push(...parts, part);
|
|
637
|
-
return i;
|
|
638
|
-
}
|
|
639
|
-
acc += c;
|
|
640
|
-
}
|
|
641
|
-
ast.type = null;
|
|
642
|
-
ast.#hasMagic = void 0;
|
|
643
|
-
ast.#parts = [str.substring(pos - 1)];
|
|
644
|
-
return i;
|
|
645
|
-
}
|
|
646
|
-
static fromGlob(pattern, options = {}) {
|
|
647
|
-
const ast = new AST(null, void 0, options);
|
|
648
|
-
AST.#parseAST(pattern, ast, 0, options);
|
|
649
|
-
return ast;
|
|
650
|
-
}
|
|
651
|
-
toMMPattern() {
|
|
652
|
-
/* c8 ignore start */
|
|
653
|
-
if (this !== this.#root) return this.#root.toMMPattern();
|
|
654
|
-
/* c8 ignore stop */
|
|
655
|
-
const glob = this.toString();
|
|
656
|
-
const [re, body, hasMagic, uflag] = this.toRegExpSource();
|
|
657
|
-
if (!(hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase())) return body;
|
|
658
|
-
const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
|
|
659
|
-
return Object.assign(new RegExp(`^${re}$`, flags), {
|
|
660
|
-
_src: re,
|
|
661
|
-
_glob: glob
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
get options() {
|
|
665
|
-
return this.#options;
|
|
666
|
-
}
|
|
667
|
-
toRegExpSource(allowDot) {
|
|
668
|
-
const dot = allowDot ?? !!this.#options.dot;
|
|
669
|
-
if (this.#root === this) this.#fillNegs();
|
|
670
|
-
if (!this.type) {
|
|
671
|
-
var _this$parent6;
|
|
672
|
-
const noEmpty = this.isStart() && this.isEnd();
|
|
673
|
-
const src = this.#parts.map((p) => {
|
|
674
|
-
const [re, _, hasMagic, uflag] = typeof p === "string" ? AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
675
|
-
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
676
|
-
this.#uflag = this.#uflag || uflag;
|
|
677
|
-
return re;
|
|
678
|
-
}).join("");
|
|
679
|
-
let start$1 = "";
|
|
680
|
-
if (this.isStart()) {
|
|
681
|
-
if (typeof this.#parts[0] === "string") {
|
|
682
|
-
if (!(this.#parts.length === 1 && justDots.has(this.#parts[0]))) {
|
|
683
|
-
const aps = addPatternStart;
|
|
684
|
-
const needNoTrav = dot && aps.has(src.charAt(0)) || src.startsWith("\\.") && aps.has(src.charAt(2)) || src.startsWith("\\.\\.") && aps.has(src.charAt(4));
|
|
685
|
-
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
686
|
-
start$1 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
let end = "";
|
|
691
|
-
if (this.isEnd() && this.#root.#filledNegs && ((_this$parent6 = this.#parent) === null || _this$parent6 === void 0 ? void 0 : _this$parent6.type) === "!") end = "(?:$|\\/)";
|
|
692
|
-
return [
|
|
693
|
-
start$1 + src + end,
|
|
694
|
-
unescape(src),
|
|
695
|
-
this.#hasMagic = !!this.#hasMagic,
|
|
696
|
-
this.#uflag
|
|
697
|
-
];
|
|
698
|
-
}
|
|
699
|
-
const repeated = this.type === "*" || this.type === "+";
|
|
700
|
-
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
701
|
-
let body = this.#partsToRegExp(dot);
|
|
702
|
-
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
703
|
-
const s = this.toString();
|
|
704
|
-
this.#parts = [s];
|
|
705
|
-
this.type = null;
|
|
706
|
-
this.#hasMagic = void 0;
|
|
707
|
-
return [
|
|
708
|
-
s,
|
|
709
|
-
unescape(this.toString()),
|
|
710
|
-
false,
|
|
711
|
-
false
|
|
712
|
-
];
|
|
713
|
-
}
|
|
714
|
-
let bodyDotAllowed = !repeated || allowDot || dot || false ? "" : this.#partsToRegExp(true);
|
|
715
|
-
if (bodyDotAllowed === body) bodyDotAllowed = "";
|
|
716
|
-
if (bodyDotAllowed) body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
|
717
|
-
let final = "";
|
|
718
|
-
if (this.type === "!" && this.#emptyExt) final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
|
|
719
|
-
else {
|
|
720
|
-
const close = this.type === "!" ? "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star$1 + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
|
|
721
|
-
final = start + body + close;
|
|
722
|
-
}
|
|
723
|
-
return [
|
|
724
|
-
final,
|
|
725
|
-
unescape(body),
|
|
726
|
-
this.#hasMagic = !!this.#hasMagic,
|
|
727
|
-
this.#uflag
|
|
728
|
-
];
|
|
729
|
-
}
|
|
730
|
-
#partsToRegExp(dot) {
|
|
731
|
-
return this.#parts.map((p) => {
|
|
732
|
-
/* c8 ignore start */
|
|
733
|
-
if (typeof p === "string") throw new Error("string type in extglob ast??");
|
|
734
|
-
/* c8 ignore stop */
|
|
735
|
-
const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
|
|
736
|
-
this.#uflag = this.#uflag || uflag;
|
|
737
|
-
return re;
|
|
738
|
-
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
739
|
-
}
|
|
740
|
-
static #parseGlob(glob, hasMagic, noEmpty = false) {
|
|
741
|
-
let escaping = false;
|
|
742
|
-
let re = "";
|
|
743
|
-
let uflag = false;
|
|
744
|
-
for (let i = 0; i < glob.length; i++) {
|
|
745
|
-
const c = glob.charAt(i);
|
|
746
|
-
if (escaping) {
|
|
747
|
-
escaping = false;
|
|
748
|
-
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
749
|
-
continue;
|
|
750
|
-
}
|
|
751
|
-
if (c === "\\") {
|
|
752
|
-
if (i === glob.length - 1) re += "\\\\";
|
|
753
|
-
else escaping = true;
|
|
754
|
-
continue;
|
|
755
|
-
}
|
|
756
|
-
if (c === "[") {
|
|
757
|
-
const [src, needUflag, consumed, magic] = parseClass(glob, i);
|
|
758
|
-
if (consumed) {
|
|
759
|
-
re += src;
|
|
760
|
-
uflag = uflag || needUflag;
|
|
761
|
-
i += consumed - 1;
|
|
762
|
-
hasMagic = hasMagic || magic;
|
|
763
|
-
continue;
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
if (c === "*") {
|
|
767
|
-
if (noEmpty && glob === "*") re += starNoEmpty;
|
|
768
|
-
else re += star$1;
|
|
769
|
-
hasMagic = true;
|
|
770
|
-
continue;
|
|
771
|
-
}
|
|
772
|
-
if (c === "?") {
|
|
773
|
-
re += qmark;
|
|
774
|
-
hasMagic = true;
|
|
775
|
-
continue;
|
|
776
|
-
}
|
|
777
|
-
re += regExpEscape$1(c);
|
|
778
|
-
}
|
|
779
|
-
return [
|
|
780
|
-
re,
|
|
781
|
-
unescape(glob),
|
|
782
|
-
!!hasMagic,
|
|
783
|
-
uflag
|
|
784
|
-
];
|
|
785
|
-
}
|
|
786
|
-
};
|
|
787
|
-
|
|
788
|
-
//#endregion
|
|
789
|
-
//#region node_modules/.pnpm/minimatch@10.0.3/node_modules/minimatch/dist/esm/escape.js
|
|
790
|
-
/**
|
|
791
|
-
* Escape all magic characters in a glob pattern.
|
|
792
|
-
*
|
|
793
|
-
* If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}
|
|
794
|
-
* option is used, then characters are escaped by wrapping in `[]`, because
|
|
795
|
-
* a magic character wrapped in a character class can only be satisfied by
|
|
796
|
-
* that exact character. In this mode, `\` is _not_ escaped, because it is
|
|
797
|
-
* not interpreted as a magic character, but instead as a path separator.
|
|
798
|
-
*/
|
|
799
|
-
const escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
800
|
-
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
801
|
-
};
|
|
802
|
-
|
|
803
|
-
//#endregion
|
|
804
|
-
//#region node_modules/.pnpm/minimatch@10.0.3/node_modules/minimatch/dist/esm/index.js
|
|
805
|
-
const minimatch = (p, pattern, options = {}) => {
|
|
806
|
-
assertValidPattern(pattern);
|
|
807
|
-
if (!options.nocomment && pattern.charAt(0) === "#") return false;
|
|
808
|
-
return new Minimatch(pattern, options).match(p);
|
|
809
|
-
};
|
|
810
|
-
const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
|
|
811
|
-
const starDotExtTest = (ext$1) => (f) => !f.startsWith(".") && f.endsWith(ext$1);
|
|
812
|
-
const starDotExtTestDot = (ext$1) => (f) => f.endsWith(ext$1);
|
|
813
|
-
const starDotExtTestNocase = (ext$1) => {
|
|
814
|
-
ext$1 = ext$1.toLowerCase();
|
|
815
|
-
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext$1);
|
|
816
|
-
};
|
|
817
|
-
const starDotExtTestNocaseDot = (ext$1) => {
|
|
818
|
-
ext$1 = ext$1.toLowerCase();
|
|
819
|
-
return (f) => f.toLowerCase().endsWith(ext$1);
|
|
820
|
-
};
|
|
821
|
-
const starDotStarRE = /^\*+\.\*+$/;
|
|
822
|
-
const starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
823
|
-
const starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
824
|
-
const dotStarRE = /^\.\*+$/;
|
|
825
|
-
const dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
826
|
-
const starRE = /^\*+$/;
|
|
827
|
-
const starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
828
|
-
const starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
829
|
-
const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
830
|
-
const qmarksTestNocase = ([$0, ext$1 = ""]) => {
|
|
831
|
-
const noext = qmarksTestNoExt([$0]);
|
|
832
|
-
if (!ext$1) return noext;
|
|
833
|
-
ext$1 = ext$1.toLowerCase();
|
|
834
|
-
return (f) => noext(f) && f.toLowerCase().endsWith(ext$1);
|
|
835
|
-
};
|
|
836
|
-
const qmarksTestNocaseDot = ([$0, ext$1 = ""]) => {
|
|
837
|
-
const noext = qmarksTestNoExtDot([$0]);
|
|
838
|
-
if (!ext$1) return noext;
|
|
839
|
-
ext$1 = ext$1.toLowerCase();
|
|
840
|
-
return (f) => noext(f) && f.toLowerCase().endsWith(ext$1);
|
|
841
|
-
};
|
|
842
|
-
const qmarksTestDot = ([$0, ext$1 = ""]) => {
|
|
843
|
-
const noext = qmarksTestNoExtDot([$0]);
|
|
844
|
-
return !ext$1 ? noext : (f) => noext(f) && f.endsWith(ext$1);
|
|
845
|
-
};
|
|
846
|
-
const qmarksTest = ([$0, ext$1 = ""]) => {
|
|
847
|
-
const noext = qmarksTestNoExt([$0]);
|
|
848
|
-
return !ext$1 ? noext : (f) => noext(f) && f.endsWith(ext$1);
|
|
849
|
-
};
|
|
850
|
-
const qmarksTestNoExt = ([$0]) => {
|
|
851
|
-
const len = $0.length;
|
|
852
|
-
return (f) => f.length === len && !f.startsWith(".");
|
|
853
|
-
};
|
|
854
|
-
const qmarksTestNoExtDot = ([$0]) => {
|
|
855
|
-
const len = $0.length;
|
|
856
|
-
return (f) => f.length === len && f !== "." && f !== "..";
|
|
857
|
-
};
|
|
858
|
-
/* c8 ignore start */
|
|
859
|
-
const defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
860
|
-
const path = {
|
|
861
|
-
win32: { sep: "\\" },
|
|
862
|
-
posix: { sep: "/" }
|
|
863
|
-
};
|
|
864
|
-
/* c8 ignore stop */
|
|
865
|
-
const sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
|
|
866
|
-
minimatch.sep = sep;
|
|
867
|
-
const GLOBSTAR = Symbol("globstar **");
|
|
868
|
-
minimatch.GLOBSTAR = GLOBSTAR;
|
|
869
|
-
const star = "[^/]*?";
|
|
870
|
-
const twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
871
|
-
const twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
872
|
-
const filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
|
|
873
|
-
minimatch.filter = filter;
|
|
874
|
-
const ext = (a, b = {}) => Object.assign({}, a, b);
|
|
875
|
-
const defaults = (def) => {
|
|
876
|
-
if (!def || typeof def !== "object" || !Object.keys(def).length) return minimatch;
|
|
877
|
-
const orig = minimatch;
|
|
878
|
-
const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
|
|
879
|
-
return Object.assign(m, {
|
|
880
|
-
Minimatch: class Minimatch$1 extends orig.Minimatch {
|
|
881
|
-
constructor(pattern, options = {}) {
|
|
882
|
-
super(pattern, ext(def, options));
|
|
883
|
-
}
|
|
884
|
-
static defaults(options) {
|
|
885
|
-
return orig.defaults(ext(def, options)).Minimatch;
|
|
886
|
-
}
|
|
887
|
-
},
|
|
888
|
-
AST: class AST$1 extends orig.AST {
|
|
889
|
-
/* c8 ignore start */
|
|
890
|
-
constructor(type, parent, options = {}) {
|
|
891
|
-
super(type, parent, ext(def, options));
|
|
892
|
-
}
|
|
893
|
-
/* c8 ignore stop */
|
|
894
|
-
static fromGlob(pattern, options = {}) {
|
|
895
|
-
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
896
|
-
}
|
|
897
|
-
},
|
|
898
|
-
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
899
|
-
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
900
|
-
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
901
|
-
defaults: (options) => orig.defaults(ext(def, options)),
|
|
902
|
-
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
903
|
-
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
904
|
-
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
|
|
905
|
-
sep: orig.sep,
|
|
906
|
-
GLOBSTAR
|
|
907
|
-
});
|
|
908
|
-
};
|
|
909
|
-
minimatch.defaults = defaults;
|
|
910
|
-
const braceExpand = (pattern, options = {}) => {
|
|
911
|
-
assertValidPattern(pattern);
|
|
912
|
-
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) return [pattern];
|
|
913
|
-
return expand(pattern);
|
|
914
|
-
};
|
|
915
|
-
minimatch.braceExpand = braceExpand;
|
|
916
|
-
const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
917
|
-
minimatch.makeRe = makeRe;
|
|
918
|
-
const match = (list, pattern, options = {}) => {
|
|
919
|
-
const mm = new Minimatch(pattern, options);
|
|
920
|
-
list = list.filter((f) => mm.match(f));
|
|
921
|
-
if (mm.options.nonull && !list.length) list.push(pattern);
|
|
922
|
-
return list;
|
|
923
|
-
};
|
|
924
|
-
minimatch.match = match;
|
|
925
|
-
const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
926
|
-
const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
927
|
-
var Minimatch = class {
|
|
928
|
-
options;
|
|
929
|
-
set;
|
|
930
|
-
pattern;
|
|
931
|
-
windowsPathsNoEscape;
|
|
932
|
-
nonegate;
|
|
933
|
-
negate;
|
|
934
|
-
comment;
|
|
935
|
-
empty;
|
|
936
|
-
preserveMultipleSlashes;
|
|
937
|
-
partial;
|
|
938
|
-
globSet;
|
|
939
|
-
globParts;
|
|
940
|
-
nocase;
|
|
941
|
-
isWindows;
|
|
942
|
-
platform;
|
|
943
|
-
windowsNoMagicRoot;
|
|
944
|
-
regexp;
|
|
945
|
-
constructor(pattern, options = {}) {
|
|
946
|
-
assertValidPattern(pattern);
|
|
947
|
-
options = options || {};
|
|
948
|
-
this.options = options;
|
|
949
|
-
this.pattern = pattern;
|
|
950
|
-
this.platform = options.platform || defaultPlatform;
|
|
951
|
-
this.isWindows = this.platform === "win32";
|
|
952
|
-
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
|
953
|
-
if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
|
|
954
|
-
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
955
|
-
this.regexp = null;
|
|
956
|
-
this.negate = false;
|
|
957
|
-
this.nonegate = !!options.nonegate;
|
|
958
|
-
this.comment = false;
|
|
959
|
-
this.empty = false;
|
|
960
|
-
this.partial = !!options.partial;
|
|
961
|
-
this.nocase = !!this.options.nocase;
|
|
962
|
-
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
963
|
-
this.globSet = [];
|
|
964
|
-
this.globParts = [];
|
|
965
|
-
this.set = [];
|
|
966
|
-
this.make();
|
|
967
|
-
}
|
|
968
|
-
hasMagic() {
|
|
969
|
-
if (this.options.magicalBraces && this.set.length > 1) return true;
|
|
970
|
-
for (const pattern of this.set) for (const part of pattern) if (typeof part !== "string") return true;
|
|
971
|
-
return false;
|
|
972
|
-
}
|
|
973
|
-
debug(..._) {}
|
|
974
|
-
make() {
|
|
975
|
-
const pattern = this.pattern;
|
|
976
|
-
const options = this.options;
|
|
977
|
-
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
978
|
-
this.comment = true;
|
|
979
|
-
return;
|
|
980
|
-
}
|
|
981
|
-
if (!pattern) {
|
|
982
|
-
this.empty = true;
|
|
983
|
-
return;
|
|
984
|
-
}
|
|
985
|
-
this.parseNegate();
|
|
986
|
-
this.globSet = [...new Set(this.braceExpand())];
|
|
987
|
-
if (options.debug) this.debug = (...args) => console.error(...args);
|
|
988
|
-
this.debug(this.pattern, this.globSet);
|
|
989
|
-
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
990
|
-
this.globParts = this.preprocess(rawGlobParts);
|
|
991
|
-
this.debug(this.pattern, this.globParts);
|
|
992
|
-
let set = this.globParts.map((s, _, __) => {
|
|
993
|
-
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
994
|
-
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
995
|
-
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
996
|
-
if (isUNC) return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
997
|
-
else if (isDrive) return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
998
|
-
}
|
|
999
|
-
return s.map((ss) => this.parse(ss));
|
|
1000
|
-
});
|
|
1001
|
-
this.debug(this.pattern, set);
|
|
1002
|
-
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
1003
|
-
if (this.isWindows) for (let i = 0; i < this.set.length; i++) {
|
|
1004
|
-
const p = this.set[i];
|
|
1005
|
-
if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) p[2] = "?";
|
|
1006
|
-
}
|
|
1007
|
-
this.debug(this.pattern, this.set);
|
|
1008
|
-
}
|
|
1009
|
-
preprocess(globParts) {
|
|
1010
|
-
if (this.options.noglobstar) {
|
|
1011
|
-
for (let i = 0; i < globParts.length; i++) for (let j = 0; j < globParts[i].length; j++) if (globParts[i][j] === "**") globParts[i][j] = "*";
|
|
1012
|
-
}
|
|
1013
|
-
const { optimizationLevel = 1 } = this.options;
|
|
1014
|
-
if (optimizationLevel >= 2) {
|
|
1015
|
-
globParts = this.firstPhasePreProcess(globParts);
|
|
1016
|
-
globParts = this.secondPhasePreProcess(globParts);
|
|
1017
|
-
} else if (optimizationLevel >= 1) globParts = this.levelOneOptimize(globParts);
|
|
1018
|
-
else globParts = this.adjascentGlobstarOptimize(globParts);
|
|
1019
|
-
return globParts;
|
|
1020
|
-
}
|
|
1021
|
-
adjascentGlobstarOptimize(globParts) {
|
|
1022
|
-
return globParts.map((parts) => {
|
|
1023
|
-
let gs = -1;
|
|
1024
|
-
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1025
|
-
let i = gs;
|
|
1026
|
-
while (parts[i + 1] === "**") i++;
|
|
1027
|
-
if (i !== gs) parts.splice(gs, i - gs);
|
|
1028
|
-
}
|
|
1029
|
-
return parts;
|
|
1030
|
-
});
|
|
1031
|
-
}
|
|
1032
|
-
levelOneOptimize(globParts) {
|
|
1033
|
-
return globParts.map((parts) => {
|
|
1034
|
-
parts = parts.reduce((set, part) => {
|
|
1035
|
-
const prev = set[set.length - 1];
|
|
1036
|
-
if (part === "**" && prev === "**") return set;
|
|
1037
|
-
if (part === "..") {
|
|
1038
|
-
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
1039
|
-
set.pop();
|
|
1040
|
-
return set;
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
set.push(part);
|
|
1044
|
-
return set;
|
|
1045
|
-
}, []);
|
|
1046
|
-
return parts.length === 0 ? [""] : parts;
|
|
1047
|
-
});
|
|
1048
|
-
}
|
|
1049
|
-
levelTwoFileOptimize(parts) {
|
|
1050
|
-
if (!Array.isArray(parts)) parts = this.slashSplit(parts);
|
|
1051
|
-
let didSomething = false;
|
|
1052
|
-
do {
|
|
1053
|
-
didSomething = false;
|
|
1054
|
-
if (!this.preserveMultipleSlashes) {
|
|
1055
|
-
for (let i = 1; i < parts.length - 1; i++) {
|
|
1056
|
-
const p = parts[i];
|
|
1057
|
-
if (i === 1 && p === "" && parts[0] === "") continue;
|
|
1058
|
-
if (p === "." || p === "") {
|
|
1059
|
-
didSomething = true;
|
|
1060
|
-
parts.splice(i, 1);
|
|
1061
|
-
i--;
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1065
|
-
didSomething = true;
|
|
1066
|
-
parts.pop();
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
let dd = 0;
|
|
1070
|
-
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1071
|
-
const p = parts[dd - 1];
|
|
1072
|
-
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1073
|
-
didSomething = true;
|
|
1074
|
-
parts.splice(dd - 1, 2);
|
|
1075
|
-
dd -= 2;
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
} while (didSomething);
|
|
1079
|
-
return parts.length === 0 ? [""] : parts;
|
|
1080
|
-
}
|
|
1081
|
-
firstPhasePreProcess(globParts) {
|
|
1082
|
-
let didSomething = false;
|
|
1083
|
-
do {
|
|
1084
|
-
didSomething = false;
|
|
1085
|
-
for (let parts of globParts) {
|
|
1086
|
-
let gs = -1;
|
|
1087
|
-
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1088
|
-
let gss = gs;
|
|
1089
|
-
while (parts[gss + 1] === "**") gss++;
|
|
1090
|
-
if (gss > gs) parts.splice(gs + 1, gss - gs);
|
|
1091
|
-
let next = parts[gs + 1];
|
|
1092
|
-
const p = parts[gs + 2];
|
|
1093
|
-
const p2 = parts[gs + 3];
|
|
1094
|
-
if (next !== "..") continue;
|
|
1095
|
-
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") continue;
|
|
1096
|
-
didSomething = true;
|
|
1097
|
-
parts.splice(gs, 1);
|
|
1098
|
-
const other = parts.slice(0);
|
|
1099
|
-
other[gs] = "**";
|
|
1100
|
-
globParts.push(other);
|
|
1101
|
-
gs--;
|
|
1102
|
-
}
|
|
1103
|
-
if (!this.preserveMultipleSlashes) {
|
|
1104
|
-
for (let i = 1; i < parts.length - 1; i++) {
|
|
1105
|
-
const p = parts[i];
|
|
1106
|
-
if (i === 1 && p === "" && parts[0] === "") continue;
|
|
1107
|
-
if (p === "." || p === "") {
|
|
1108
|
-
didSomething = true;
|
|
1109
|
-
parts.splice(i, 1);
|
|
1110
|
-
i--;
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1114
|
-
didSomething = true;
|
|
1115
|
-
parts.pop();
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
let dd = 0;
|
|
1119
|
-
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1120
|
-
const p = parts[dd - 1];
|
|
1121
|
-
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1122
|
-
didSomething = true;
|
|
1123
|
-
const splin = dd === 1 && parts[dd + 1] === "**" ? ["."] : [];
|
|
1124
|
-
parts.splice(dd - 1, 2, ...splin);
|
|
1125
|
-
if (parts.length === 0) parts.push("");
|
|
1126
|
-
dd -= 2;
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
} while (didSomething);
|
|
1131
|
-
return globParts;
|
|
1132
|
-
}
|
|
1133
|
-
secondPhasePreProcess(globParts) {
|
|
1134
|
-
for (let i = 0; i < globParts.length - 1; i++) for (let j = i + 1; j < globParts.length; j++) {
|
|
1135
|
-
const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
|
|
1136
|
-
if (matched) {
|
|
1137
|
-
globParts[i] = [];
|
|
1138
|
-
globParts[j] = matched;
|
|
1139
|
-
break;
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
return globParts.filter((gs) => gs.length);
|
|
1143
|
-
}
|
|
1144
|
-
partsMatch(a, b, emptyGSMatch = false) {
|
|
1145
|
-
let ai = 0;
|
|
1146
|
-
let bi = 0;
|
|
1147
|
-
let result = [];
|
|
1148
|
-
let which = "";
|
|
1149
|
-
while (ai < a.length && bi < b.length) if (a[ai] === b[bi]) {
|
|
1150
|
-
result.push(which === "b" ? b[bi] : a[ai]);
|
|
1151
|
-
ai++;
|
|
1152
|
-
bi++;
|
|
1153
|
-
} else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
|
|
1154
|
-
result.push(a[ai]);
|
|
1155
|
-
ai++;
|
|
1156
|
-
} else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
|
|
1157
|
-
result.push(b[bi]);
|
|
1158
|
-
bi++;
|
|
1159
|
-
} else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
|
|
1160
|
-
if (which === "b") return false;
|
|
1161
|
-
which = "a";
|
|
1162
|
-
result.push(a[ai]);
|
|
1163
|
-
ai++;
|
|
1164
|
-
bi++;
|
|
1165
|
-
} else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
|
|
1166
|
-
if (which === "a") return false;
|
|
1167
|
-
which = "b";
|
|
1168
|
-
result.push(b[bi]);
|
|
1169
|
-
ai++;
|
|
1170
|
-
bi++;
|
|
1171
|
-
} else return false;
|
|
1172
|
-
return a.length === b.length && result;
|
|
1173
|
-
}
|
|
1174
|
-
parseNegate() {
|
|
1175
|
-
if (this.nonegate) return;
|
|
1176
|
-
const pattern = this.pattern;
|
|
1177
|
-
let negate = false;
|
|
1178
|
-
let negateOffset = 0;
|
|
1179
|
-
for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
|
|
1180
|
-
negate = !negate;
|
|
1181
|
-
negateOffset++;
|
|
1182
|
-
}
|
|
1183
|
-
if (negateOffset) this.pattern = pattern.slice(negateOffset);
|
|
1184
|
-
this.negate = negate;
|
|
1185
|
-
}
|
|
1186
|
-
matchOne(file, pattern, partial = false) {
|
|
1187
|
-
const options = this.options;
|
|
1188
|
-
if (this.isWindows) {
|
|
1189
|
-
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
1190
|
-
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
1191
|
-
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
1192
|
-
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
1193
|
-
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
1194
|
-
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
1195
|
-
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
1196
|
-
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
1197
|
-
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
1198
|
-
pattern[pdi] = fd;
|
|
1199
|
-
if (pdi > fdi) pattern = pattern.slice(pdi);
|
|
1200
|
-
else if (fdi > pdi) file = file.slice(fdi);
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
const { optimizationLevel = 1 } = this.options;
|
|
1205
|
-
if (optimizationLevel >= 2) file = this.levelTwoFileOptimize(file);
|
|
1206
|
-
this.debug("matchOne", this, {
|
|
1207
|
-
file,
|
|
1208
|
-
pattern
|
|
1209
|
-
});
|
|
1210
|
-
this.debug("matchOne", file.length, pattern.length);
|
|
1211
|
-
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
1212
|
-
this.debug("matchOne loop");
|
|
1213
|
-
var p = pattern[pi];
|
|
1214
|
-
var f = file[fi];
|
|
1215
|
-
this.debug(pattern, p, f);
|
|
1216
|
-
/* c8 ignore start */
|
|
1217
|
-
if (p === false) return false;
|
|
1218
|
-
/* c8 ignore stop */
|
|
1219
|
-
if (p === GLOBSTAR) {
|
|
1220
|
-
this.debug("GLOBSTAR", [
|
|
1221
|
-
pattern,
|
|
1222
|
-
p,
|
|
1223
|
-
f
|
|
1224
|
-
]);
|
|
1225
|
-
var fr = fi;
|
|
1226
|
-
var pr = pi + 1;
|
|
1227
|
-
if (pr === pl) {
|
|
1228
|
-
this.debug("** at the end");
|
|
1229
|
-
for (; fi < fl; fi++) if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
|
1230
|
-
return true;
|
|
1231
|
-
}
|
|
1232
|
-
while (fr < fl) {
|
|
1233
|
-
var swallowee = file[fr];
|
|
1234
|
-
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
1235
|
-
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
1236
|
-
this.debug("globstar found match!", fr, fl, swallowee);
|
|
1237
|
-
return true;
|
|
1238
|
-
} else {
|
|
1239
|
-
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
1240
|
-
this.debug("dot detected!", file, fr, pattern, pr);
|
|
1241
|
-
break;
|
|
1242
|
-
}
|
|
1243
|
-
this.debug("globstar swallow a segment, and continue");
|
|
1244
|
-
fr++;
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
/* c8 ignore start */
|
|
1248
|
-
if (partial) {
|
|
1249
|
-
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
1250
|
-
if (fr === fl) return true;
|
|
1251
|
-
}
|
|
1252
|
-
/* c8 ignore stop */
|
|
1253
|
-
return false;
|
|
1254
|
-
}
|
|
1255
|
-
let hit;
|
|
1256
|
-
if (typeof p === "string") {
|
|
1257
|
-
hit = f === p;
|
|
1258
|
-
this.debug("string match", p, f, hit);
|
|
1259
|
-
} else {
|
|
1260
|
-
hit = p.test(f);
|
|
1261
|
-
this.debug("pattern match", p, f, hit);
|
|
1262
|
-
}
|
|
1263
|
-
if (!hit) return false;
|
|
1264
|
-
}
|
|
1265
|
-
if (fi === fl && pi === pl) return true;
|
|
1266
|
-
else if (fi === fl) return partial;
|
|
1267
|
-
else if (pi === pl) return fi === fl - 1 && file[fi] === "";
|
|
1268
|
-
else throw new Error("wtf?");
|
|
1269
|
-
/* c8 ignore stop */
|
|
1270
|
-
}
|
|
1271
|
-
braceExpand() {
|
|
1272
|
-
return braceExpand(this.pattern, this.options);
|
|
1273
|
-
}
|
|
1274
|
-
parse(pattern) {
|
|
1275
|
-
assertValidPattern(pattern);
|
|
1276
|
-
const options = this.options;
|
|
1277
|
-
if (pattern === "**") return GLOBSTAR;
|
|
1278
|
-
if (pattern === "") return "";
|
|
1279
|
-
let m;
|
|
1280
|
-
let fastTest = null;
|
|
1281
|
-
if (m = pattern.match(starRE)) fastTest = options.dot ? starTestDot : starTest;
|
|
1282
|
-
else if (m = pattern.match(starDotExtRE)) fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
1283
|
-
else if (m = pattern.match(qmarksRE)) fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
1284
|
-
else if (m = pattern.match(starDotStarRE)) fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
1285
|
-
else if (m = pattern.match(dotStarRE)) fastTest = dotStarTest;
|
|
1286
|
-
const re = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
1287
|
-
if (fastTest && typeof re === "object") Reflect.defineProperty(re, "test", { value: fastTest });
|
|
1288
|
-
return re;
|
|
1289
|
-
}
|
|
1290
|
-
makeRe() {
|
|
1291
|
-
if (this.regexp || this.regexp === false) return this.regexp;
|
|
1292
|
-
const set = this.set;
|
|
1293
|
-
if (!set.length) {
|
|
1294
|
-
this.regexp = false;
|
|
1295
|
-
return this.regexp;
|
|
1296
|
-
}
|
|
1297
|
-
const options = this.options;
|
|
1298
|
-
const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
|
|
1299
|
-
const flags = new Set(options.nocase ? ["i"] : []);
|
|
1300
|
-
let re = set.map((pattern) => {
|
|
1301
|
-
const pp = pattern.map((p) => {
|
|
1302
|
-
if (p instanceof RegExp) for (const f of p.flags.split("")) flags.add(f);
|
|
1303
|
-
return typeof p === "string" ? regExpEscape(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
|
|
1304
|
-
});
|
|
1305
|
-
pp.forEach((p, i) => {
|
|
1306
|
-
const next = pp[i + 1];
|
|
1307
|
-
const prev = pp[i - 1];
|
|
1308
|
-
if (p !== GLOBSTAR || prev === GLOBSTAR) return;
|
|
1309
|
-
if (prev === void 0) if (next !== void 0 && next !== GLOBSTAR) pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
1310
|
-
else pp[i] = twoStar;
|
|
1311
|
-
else if (next === void 0) pp[i - 1] = prev + "(?:\\/|" + twoStar + ")?";
|
|
1312
|
-
else if (next !== GLOBSTAR) {
|
|
1313
|
-
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
1314
|
-
pp[i + 1] = GLOBSTAR;
|
|
1315
|
-
}
|
|
1316
|
-
});
|
|
1317
|
-
return pp.filter((p) => p !== GLOBSTAR).join("/");
|
|
1318
|
-
}).join("|");
|
|
1319
|
-
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
1320
|
-
re = "^" + open + re + close + "$";
|
|
1321
|
-
if (this.negate) re = "^(?!" + re + ").+$";
|
|
1322
|
-
try {
|
|
1323
|
-
this.regexp = new RegExp(re, [...flags].join(""));
|
|
1324
|
-
} catch (ex) {
|
|
1325
|
-
this.regexp = false;
|
|
1326
|
-
}
|
|
1327
|
-
/* c8 ignore stop */
|
|
1328
|
-
return this.regexp;
|
|
1329
|
-
}
|
|
1330
|
-
slashSplit(p) {
|
|
1331
|
-
if (this.preserveMultipleSlashes) return p.split("/");
|
|
1332
|
-
else if (this.isWindows && /^\/\/[^\/]+/.test(p)) return ["", ...p.split(/\/+/)];
|
|
1333
|
-
else return p.split(/\/+/);
|
|
1334
|
-
}
|
|
1335
|
-
match(f, partial = this.partial) {
|
|
1336
|
-
this.debug("match", f, this.pattern);
|
|
1337
|
-
if (this.comment) return false;
|
|
1338
|
-
if (this.empty) return f === "";
|
|
1339
|
-
if (f === "/" && partial) return true;
|
|
1340
|
-
const options = this.options;
|
|
1341
|
-
if (this.isWindows) f = f.split("\\").join("/");
|
|
1342
|
-
const ff = this.slashSplit(f);
|
|
1343
|
-
this.debug(this.pattern, "split", ff);
|
|
1344
|
-
const set = this.set;
|
|
1345
|
-
this.debug(this.pattern, "set", set);
|
|
1346
|
-
let filename = ff[ff.length - 1];
|
|
1347
|
-
if (!filename) for (let i = ff.length - 2; !filename && i >= 0; i--) filename = ff[i];
|
|
1348
|
-
for (let i = 0; i < set.length; i++) {
|
|
1349
|
-
const pattern = set[i];
|
|
1350
|
-
let file = ff;
|
|
1351
|
-
if (options.matchBase && pattern.length === 1) file = [filename];
|
|
1352
|
-
if (this.matchOne(file, pattern, partial)) {
|
|
1353
|
-
if (options.flipNegate) return true;
|
|
1354
|
-
return !this.negate;
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
if (options.flipNegate) return false;
|
|
1358
|
-
return this.negate;
|
|
1359
|
-
}
|
|
1360
|
-
static defaults(def) {
|
|
1361
|
-
return minimatch.defaults(def).Minimatch;
|
|
1362
|
-
}
|
|
1363
|
-
};
|
|
1364
|
-
/* c8 ignore stop */
|
|
1365
|
-
minimatch.AST = AST;
|
|
1366
|
-
minimatch.Minimatch = Minimatch;
|
|
1367
|
-
minimatch.escape = escape;
|
|
1368
|
-
minimatch.unescape = unescape;
|
|
1369
|
-
|
|
1370
|
-
//#endregion
|
|
1371
|
-
//#region src/core/utils.ts
|
|
1372
|
-
const isSSR = Boolean(process$1.env.SSR || process$1.env.SSG || process$1.env.VITE_SSR || process$1.env.VITE_SSG);
|
|
1373
|
-
function pascalCase(str) {
|
|
1374
|
-
return capitalize(camelCase(str));
|
|
1375
|
-
}
|
|
1376
|
-
function camelCase(str) {
|
|
1377
|
-
return str.replace(/-(\w)/g, (_, c) => c ? c.toUpperCase() : "");
|
|
1378
|
-
}
|
|
1379
|
-
function kebabCase(key) {
|
|
1380
|
-
return key.replace(/([A-Z])/g, " $1").trim().split(" ").join("-").toLowerCase();
|
|
1381
|
-
}
|
|
1382
|
-
function capitalize(str) {
|
|
1383
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1384
|
-
}
|
|
1385
|
-
function parseId(id) {
|
|
1386
|
-
const index = id.indexOf("?");
|
|
1387
|
-
if (index < 0) return {
|
|
1388
|
-
path: id,
|
|
1389
|
-
query: {}
|
|
1390
|
-
};
|
|
1391
|
-
else {
|
|
1392
|
-
const query = Object.fromEntries(new URLSearchParams(id.slice(index)));
|
|
1393
|
-
return {
|
|
1394
|
-
path: id.slice(0, index),
|
|
1395
|
-
query
|
|
1396
|
-
};
|
|
1397
|
-
}
|
|
1398
|
-
}
|
|
1399
|
-
function isEmpty(value) {
|
|
1400
|
-
if (!value || value === null || value === void 0 || Array.isArray(value) && Object.keys(value).length <= 0) return true;
|
|
1401
|
-
else return false;
|
|
1402
|
-
}
|
|
1403
|
-
function matchGlobs(filepath, globs) {
|
|
1404
|
-
for (const glob of globs) {
|
|
1405
|
-
const isNegated = glob.startsWith("!");
|
|
1406
|
-
if (minimatch(slash(filepath), isNegated ? glob.slice(1) : glob)) return !isNegated;
|
|
1407
|
-
}
|
|
1408
|
-
return false;
|
|
1409
|
-
}
|
|
1410
|
-
function getTransformedPath(path$1, importPathTransform) {
|
|
1411
|
-
if (importPathTransform) {
|
|
1412
|
-
const result = importPathTransform(path$1);
|
|
1413
|
-
if (result != null) path$1 = result;
|
|
1414
|
-
}
|
|
1415
|
-
return path$1;
|
|
1416
|
-
}
|
|
1417
|
-
function stringifyImport(info) {
|
|
1418
|
-
if (typeof info === "string") return `import '${info}'`;
|
|
1419
|
-
if (!info.as) return `import '${info.from}'`;
|
|
1420
|
-
else if (info.name) return `import { ${info.name} as ${info.as} } from '${info.from}'`;
|
|
1421
|
-
else return `import ${info.as} from '${info.from}'`;
|
|
1422
|
-
}
|
|
1423
|
-
function normalizeComponentInfo(info) {
|
|
1424
|
-
if ("path" in info) return {
|
|
1425
|
-
from: info.path,
|
|
1426
|
-
as: info.name,
|
|
1427
|
-
name: info.importName,
|
|
1428
|
-
sideEffects: info.sideEffects
|
|
1429
|
-
};
|
|
1430
|
-
return info;
|
|
1431
|
-
}
|
|
1432
|
-
function stringifyComponentImport({ as: name, from: path$1, name: importName, sideEffects }, ctx) {
|
|
1433
|
-
path$1 = getTransformedPath(path$1, ctx.options.importPathTransform);
|
|
1434
|
-
const imports = [stringifyImport({
|
|
1435
|
-
as: name,
|
|
1436
|
-
from: path$1,
|
|
1437
|
-
name: importName
|
|
1438
|
-
})];
|
|
1439
|
-
if (sideEffects) toArray(sideEffects).forEach((i) => imports.push(stringifyImport(i)));
|
|
1440
|
-
return imports.join(";");
|
|
1441
|
-
}
|
|
1442
|
-
function getNameFromFilePath(filePath, options) {
|
|
1443
|
-
const { resolvedDirs, directoryAsNamespace, globalNamespaces, collapseSamePrefixes, root } = options;
|
|
1444
|
-
const parsedFilePath = parse(slash(filePath));
|
|
1445
|
-
let strippedPath = "";
|
|
1446
|
-
for (const dir of resolvedDirs) if (parsedFilePath.dir.startsWith(dir)) {
|
|
1447
|
-
strippedPath = parsedFilePath.dir.slice(dir.length);
|
|
1448
|
-
break;
|
|
1449
|
-
}
|
|
1450
|
-
let folders = strippedPath.slice(1).split("/").filter(Boolean);
|
|
1451
|
-
let filename = parsedFilePath.name;
|
|
1452
|
-
if (filename === "index" && !directoryAsNamespace) {
|
|
1453
|
-
if (isEmpty(folders)) folders = parsedFilePath.dir.slice(root.length + 1).split("/").filter(Boolean);
|
|
1454
|
-
filename = `${folders.slice(-1)[0]}`;
|
|
1455
|
-
return filename;
|
|
1456
|
-
}
|
|
1457
|
-
if (directoryAsNamespace) {
|
|
1458
|
-
if (globalNamespaces.some((name) => folders.includes(name))) folders = folders.filter((f) => !globalNamespaces.includes(f));
|
|
1459
|
-
folders = folders.map((f) => f.replace(/[^a-z0-9\-]/gi, ""));
|
|
1460
|
-
if (filename.toLowerCase() === "index") filename = "";
|
|
1461
|
-
if (!isEmpty(folders)) {
|
|
1462
|
-
let namespaced = [...folders, filename];
|
|
1463
|
-
if (collapseSamePrefixes) {
|
|
1464
|
-
const collapsed = [];
|
|
1465
|
-
for (const fileOrFolderName of namespaced) {
|
|
1466
|
-
let cumulativePrefix = "";
|
|
1467
|
-
let didCollapse = false;
|
|
1468
|
-
const pascalCasedName = pascalCase(fileOrFolderName);
|
|
1469
|
-
for (const parentFolder of [...collapsed].reverse()) {
|
|
1470
|
-
cumulativePrefix = `${parentFolder}${cumulativePrefix}`;
|
|
1471
|
-
if (pascalCasedName.startsWith(cumulativePrefix)) {
|
|
1472
|
-
const collapseSamePrefix = pascalCasedName.slice(cumulativePrefix.length);
|
|
1473
|
-
collapsed.push(collapseSamePrefix);
|
|
1474
|
-
didCollapse = true;
|
|
1475
|
-
break;
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
if (!didCollapse) collapsed.push(pascalCasedName);
|
|
1479
|
-
}
|
|
1480
|
-
namespaced = collapsed;
|
|
1481
|
-
}
|
|
1482
|
-
filename = namespaced.filter(Boolean).join("-");
|
|
1483
|
-
}
|
|
1484
|
-
return filename;
|
|
1485
|
-
}
|
|
1486
|
-
return filename;
|
|
1487
|
-
}
|
|
1488
|
-
function resolveAlias(filepath, alias) {
|
|
1489
|
-
const result = filepath;
|
|
1490
|
-
if (Array.isArray(alias)) for (const { find, replacement } of alias) result.replace(find, replacement);
|
|
1491
|
-
return result;
|
|
1492
|
-
}
|
|
1493
|
-
async function getPkgVersion(pkgName, defaultVersion) {
|
|
1494
|
-
try {
|
|
1495
|
-
if (isPackageExists(pkgName)) {
|
|
1496
|
-
const pkg = await getPackageInfo(pkgName);
|
|
1497
|
-
return (pkg === null || pkg === void 0 ? void 0 : pkg.version) ?? defaultVersion;
|
|
1498
|
-
} else return defaultVersion;
|
|
1499
|
-
} catch (err) {
|
|
1500
|
-
console.error(err);
|
|
1501
|
-
return defaultVersion;
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
function shouldTransform(code) {
|
|
1505
|
-
if (code.includes(DISABLE_COMMENT)) return false;
|
|
1506
|
-
return true;
|
|
1507
|
-
}
|
|
1508
|
-
function isExclude(name, exclude) {
|
|
1509
|
-
if (!exclude) return false;
|
|
1510
|
-
if (typeof exclude === "string") return name === exclude;
|
|
1511
|
-
if (exclude instanceof RegExp) return !!name.match(exclude);
|
|
1512
|
-
if (Array.isArray(exclude)) {
|
|
1513
|
-
for (const item of exclude) if (name === item || name.match(item)) return true;
|
|
1514
|
-
}
|
|
1515
|
-
return false;
|
|
1516
|
-
}
|
|
1517
|
-
const ESCAPE_PARENTHESES_REGEX = /[()]/g;
|
|
1518
|
-
function escapeSpecialChars(str) {
|
|
1519
|
-
return str.replace(ESCAPE_PARENTHESES_REGEX, "\\$&");
|
|
1520
|
-
}
|
|
1521
|
-
|
|
1522
|
-
//#endregion
|
|
1523
|
-
export { DIRECTIVE_IMPORT_PREFIX, DISABLE_COMMENT, camelCase, escapeSpecialChars, getNameFromFilePath, getPkgVersion, getTransformedPath, isExclude, isSSR, kebabCase, matchGlobs, normalizeComponentInfo, notNullish, parseId, pascalCase, resolveAlias, shouldTransform, slash, stringifyComponentImport, throttle, toArray };
|