@stencil/core 4.39.0 → 4.40.1-dev.1766552834.64f6089
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/cli/index.cjs +1616 -41
- package/cli/index.js +1616 -41
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +2791 -2515
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +1665 -90
- package/internal/app-data/index.cjs +1 -0
- package/internal/app-data/index.js +1 -0
- package/internal/app-data/package.json +1 -1
- package/internal/app-globals/package.json +1 -1
- package/internal/client/index.js +1746 -105
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +1770 -133
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +1794 -104
- package/internal/package.json +1 -1
- package/internal/stencil-private.d.ts +25 -2
- package/internal/stencil-public-compiler.d.ts +33 -3
- package/internal/stencil-public-runtime.d.ts +14 -3
- package/internal/testing/index.js +1758 -133
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +8 -1
- package/mock-doc/index.js +8 -1
- package/mock-doc/package.json +1 -1
- package/package.json +1 -1
- package/screenshot/index.js +1608 -30
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/index.js +28 -28
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +1696 -109
- package/testing/package.json +1 -1
package/cli/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil CLI (CommonJS) v4.
|
|
2
|
+
Stencil CLI (CommonJS) v4.40.1-dev.1766552834.64f6089 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
"use strict";
|
|
5
5
|
var __create = Object.create;
|
|
@@ -8,6 +8,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
8
8
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
9
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __typeError = (msg) => {
|
|
12
|
+
throw TypeError(msg);
|
|
13
|
+
};
|
|
14
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
15
|
var __commonJS = (cb, mod) => function __require() {
|
|
12
16
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
17
|
};
|
|
@@ -32,6 +36,220 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
32
36
|
mod
|
|
33
37
|
));
|
|
34
38
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
40
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
41
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
42
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
43
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
44
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
45
|
+
|
|
46
|
+
// node_modules/balanced-match/index.js
|
|
47
|
+
var require_balanced_match = __commonJS({
|
|
48
|
+
"node_modules/balanced-match/index.js"(exports2, module2) {
|
|
49
|
+
"use strict";
|
|
50
|
+
module2.exports = balanced;
|
|
51
|
+
function balanced(a, b, str) {
|
|
52
|
+
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
53
|
+
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
54
|
+
var r = range(a, b, str);
|
|
55
|
+
return r && {
|
|
56
|
+
start: r[0],
|
|
57
|
+
end: r[1],
|
|
58
|
+
pre: str.slice(0, r[0]),
|
|
59
|
+
body: str.slice(r[0] + a.length, r[1]),
|
|
60
|
+
post: str.slice(r[1] + b.length)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function maybeMatch(reg, str) {
|
|
64
|
+
var m = str.match(reg);
|
|
65
|
+
return m ? m[0] : null;
|
|
66
|
+
}
|
|
67
|
+
balanced.range = range;
|
|
68
|
+
function range(a, b, str) {
|
|
69
|
+
var begs, beg, left, right, result;
|
|
70
|
+
var ai = str.indexOf(a);
|
|
71
|
+
var bi = str.indexOf(b, ai + 1);
|
|
72
|
+
var i = ai;
|
|
73
|
+
if (ai >= 0 && bi > 0) {
|
|
74
|
+
if (a === b) {
|
|
75
|
+
return [ai, bi];
|
|
76
|
+
}
|
|
77
|
+
begs = [];
|
|
78
|
+
left = str.length;
|
|
79
|
+
while (i >= 0 && !result) {
|
|
80
|
+
if (i == ai) {
|
|
81
|
+
begs.push(i);
|
|
82
|
+
ai = str.indexOf(a, i + 1);
|
|
83
|
+
} else if (begs.length == 1) {
|
|
84
|
+
result = [begs.pop(), bi];
|
|
85
|
+
} else {
|
|
86
|
+
beg = begs.pop();
|
|
87
|
+
if (beg < left) {
|
|
88
|
+
left = beg;
|
|
89
|
+
right = bi;
|
|
90
|
+
}
|
|
91
|
+
bi = str.indexOf(b, i + 1);
|
|
92
|
+
}
|
|
93
|
+
i = ai < bi && ai >= 0 ? ai : bi;
|
|
94
|
+
}
|
|
95
|
+
if (begs.length) {
|
|
96
|
+
result = [left, right];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// node_modules/brace-expansion/index.js
|
|
105
|
+
var require_brace_expansion = __commonJS({
|
|
106
|
+
"node_modules/brace-expansion/index.js"(exports2, module2) {
|
|
107
|
+
var balanced = require_balanced_match();
|
|
108
|
+
module2.exports = expandTop;
|
|
109
|
+
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
110
|
+
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
111
|
+
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
112
|
+
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
113
|
+
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
114
|
+
function numeric(str) {
|
|
115
|
+
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
116
|
+
}
|
|
117
|
+
function escapeBraces(str) {
|
|
118
|
+
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
119
|
+
}
|
|
120
|
+
function unescapeBraces(str) {
|
|
121
|
+
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
122
|
+
}
|
|
123
|
+
function parseCommaParts(str) {
|
|
124
|
+
if (!str)
|
|
125
|
+
return [""];
|
|
126
|
+
var parts = [];
|
|
127
|
+
var m = balanced("{", "}", str);
|
|
128
|
+
if (!m)
|
|
129
|
+
return str.split(",");
|
|
130
|
+
var pre = m.pre;
|
|
131
|
+
var body = m.body;
|
|
132
|
+
var post = m.post;
|
|
133
|
+
var p = pre.split(",");
|
|
134
|
+
p[p.length - 1] += "{" + body + "}";
|
|
135
|
+
var postParts = parseCommaParts(post);
|
|
136
|
+
if (post.length) {
|
|
137
|
+
p[p.length - 1] += postParts.shift();
|
|
138
|
+
p.push.apply(p, postParts);
|
|
139
|
+
}
|
|
140
|
+
parts.push.apply(parts, p);
|
|
141
|
+
return parts;
|
|
142
|
+
}
|
|
143
|
+
function expandTop(str) {
|
|
144
|
+
if (!str)
|
|
145
|
+
return [];
|
|
146
|
+
if (str.substr(0, 2) === "{}") {
|
|
147
|
+
str = "\\{\\}" + str.substr(2);
|
|
148
|
+
}
|
|
149
|
+
return expand2(escapeBraces(str), true).map(unescapeBraces);
|
|
150
|
+
}
|
|
151
|
+
function embrace(str) {
|
|
152
|
+
return "{" + str + "}";
|
|
153
|
+
}
|
|
154
|
+
function isPadded(el) {
|
|
155
|
+
return /^-?0\d/.test(el);
|
|
156
|
+
}
|
|
157
|
+
function lte(i, y) {
|
|
158
|
+
return i <= y;
|
|
159
|
+
}
|
|
160
|
+
function gte(i, y) {
|
|
161
|
+
return i >= y;
|
|
162
|
+
}
|
|
163
|
+
function expand2(str, isTop) {
|
|
164
|
+
var expansions = [];
|
|
165
|
+
var m = balanced("{", "}", str);
|
|
166
|
+
if (!m) return [str];
|
|
167
|
+
var pre = m.pre;
|
|
168
|
+
var post = m.post.length ? expand2(m.post, false) : [""];
|
|
169
|
+
if (/\$$/.test(m.pre)) {
|
|
170
|
+
for (var k = 0; k < post.length; k++) {
|
|
171
|
+
var expansion = pre + "{" + m.body + "}" + post[k];
|
|
172
|
+
expansions.push(expansion);
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
175
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
176
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
177
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
|
178
|
+
var isOptions = m.body.indexOf(",") >= 0;
|
|
179
|
+
if (!isSequence && !isOptions) {
|
|
180
|
+
if (m.post.match(/,(?!,).*\}/)) {
|
|
181
|
+
str = m.pre + "{" + m.body + escClose + m.post;
|
|
182
|
+
return expand2(str);
|
|
183
|
+
}
|
|
184
|
+
return [str];
|
|
185
|
+
}
|
|
186
|
+
var n;
|
|
187
|
+
if (isSequence) {
|
|
188
|
+
n = m.body.split(/\.\./);
|
|
189
|
+
} else {
|
|
190
|
+
n = parseCommaParts(m.body);
|
|
191
|
+
if (n.length === 1) {
|
|
192
|
+
n = expand2(n[0], false).map(embrace);
|
|
193
|
+
if (n.length === 1) {
|
|
194
|
+
return post.map(function(p) {
|
|
195
|
+
return m.pre + n[0] + p;
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
var N;
|
|
201
|
+
if (isSequence) {
|
|
202
|
+
var x = numeric(n[0]);
|
|
203
|
+
var y = numeric(n[1]);
|
|
204
|
+
var width = Math.max(n[0].length, n[1].length);
|
|
205
|
+
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
|
|
206
|
+
var test = lte;
|
|
207
|
+
var reverse = y < x;
|
|
208
|
+
if (reverse) {
|
|
209
|
+
incr *= -1;
|
|
210
|
+
test = gte;
|
|
211
|
+
}
|
|
212
|
+
var pad = n.some(isPadded);
|
|
213
|
+
N = [];
|
|
214
|
+
for (var i = x; test(i, y); i += incr) {
|
|
215
|
+
var c;
|
|
216
|
+
if (isAlphaSequence) {
|
|
217
|
+
c = String.fromCharCode(i);
|
|
218
|
+
if (c === "\\")
|
|
219
|
+
c = "";
|
|
220
|
+
} else {
|
|
221
|
+
c = String(i);
|
|
222
|
+
if (pad) {
|
|
223
|
+
var need = width - c.length;
|
|
224
|
+
if (need > 0) {
|
|
225
|
+
var z = new Array(need + 1).join("0");
|
|
226
|
+
if (i < 0)
|
|
227
|
+
c = "-" + z + c.slice(1);
|
|
228
|
+
else
|
|
229
|
+
c = z + c;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
N.push(c);
|
|
234
|
+
}
|
|
235
|
+
} else {
|
|
236
|
+
N = [];
|
|
237
|
+
for (var j = 0; j < n.length; j++) {
|
|
238
|
+
N.push.apply(N, expand2(n[j], false));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
for (var j = 0; j < N.length; j++) {
|
|
242
|
+
for (var k = 0; k < post.length; k++) {
|
|
243
|
+
var expansion = pre + N[j] + post[k];
|
|
244
|
+
if (!isTop || isSequence || expansion)
|
|
245
|
+
expansions.push(expansion);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return expansions;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
});
|
|
35
253
|
|
|
36
254
|
// node_modules/kleur/index.js
|
|
37
255
|
var require_kleur = __commonJS({
|
|
@@ -1205,9 +1423,9 @@ var require_date = __commonJS({
|
|
|
1205
1423
|
let result;
|
|
1206
1424
|
this.parts = [];
|
|
1207
1425
|
while (result = regex.exec(mask)) {
|
|
1208
|
-
let
|
|
1426
|
+
let match2 = result.shift();
|
|
1209
1427
|
let idx = result.findIndex((gr) => gr != null);
|
|
1210
|
-
this.parts.push(idx in regexGroups ? regexGroups[idx]({ token: result[idx] ||
|
|
1428
|
+
this.parts.push(idx in regexGroups ? regexGroups[idx]({ token: result[idx] || match2, date: this.date, parts: this.parts, locales: this.locales }) : result[idx] || match2);
|
|
1211
1429
|
}
|
|
1212
1430
|
let parts = this.parts.reduce((arr, i) => {
|
|
1213
1431
|
if (typeof i === "string" && typeof arr[arr.length - 1] === "string")
|
|
@@ -2224,9 +2442,9 @@ var require_prompts = __commonJS({
|
|
|
2224
2442
|
$.date = (args) => toPrompt("DatePrompt", args);
|
|
2225
2443
|
$.confirm = (args) => toPrompt("ConfirmPrompt", args);
|
|
2226
2444
|
$.list = (args) => {
|
|
2227
|
-
const
|
|
2445
|
+
const sep2 = args.separator || ",";
|
|
2228
2446
|
return toPrompt("TextPrompt", args, {
|
|
2229
|
-
onSubmit: (str) => str.split(
|
|
2447
|
+
onSubmit: (str) => str.split(sep2).map((s) => s.trim())
|
|
2230
2448
|
});
|
|
2231
2449
|
};
|
|
2232
2450
|
$.toggle = (args) => toPrompt("TogglePrompt", args);
|
|
@@ -2601,12 +2819,12 @@ var shouldIgnoreError = (msg) => {
|
|
|
2601
2819
|
var TASK_CANCELED_MSG = `task canceled`;
|
|
2602
2820
|
|
|
2603
2821
|
// src/utils/path.ts
|
|
2604
|
-
var normalizePath = (
|
|
2605
|
-
if (typeof
|
|
2822
|
+
var normalizePath = (path2, relativize = true) => {
|
|
2823
|
+
if (typeof path2 !== "string") {
|
|
2606
2824
|
throw new Error(`invalid path to normalize`);
|
|
2607
2825
|
}
|
|
2608
|
-
|
|
2609
|
-
const components = pathComponents(
|
|
2826
|
+
path2 = normalizeSlashes(path2.trim());
|
|
2827
|
+
const components = pathComponents(path2, getRootLength(path2));
|
|
2610
2828
|
const reducedComponents = reducePathComponents(components);
|
|
2611
2829
|
const rootPart = reducedComponents[0];
|
|
2612
2830
|
const secondPart = reducedComponents[1];
|
|
@@ -2614,12 +2832,12 @@ var normalizePath = (path, relativize = true) => {
|
|
|
2614
2832
|
if (normalized === "") {
|
|
2615
2833
|
return ".";
|
|
2616
2834
|
}
|
|
2617
|
-
if (rootPart === "" && secondPart &&
|
|
2835
|
+
if (rootPart === "" && secondPart && path2.includes("/") && !secondPart.startsWith(".") && !secondPart.startsWith("@") && relativize) {
|
|
2618
2836
|
return "./" + normalized;
|
|
2619
2837
|
}
|
|
2620
2838
|
return normalized;
|
|
2621
2839
|
};
|
|
2622
|
-
var normalizeSlashes = (
|
|
2840
|
+
var normalizeSlashes = (path2) => path2.replace(backslashRegExp, "/");
|
|
2623
2841
|
var altDirectorySeparator = "\\";
|
|
2624
2842
|
var urlSchemeSeparator = "://";
|
|
2625
2843
|
var backslashRegExp = /\\/g;
|
|
@@ -2644,45 +2862,45 @@ var reducePathComponents = (components) => {
|
|
|
2644
2862
|
}
|
|
2645
2863
|
return reduced;
|
|
2646
2864
|
};
|
|
2647
|
-
var getRootLength = (
|
|
2648
|
-
const rootLength = getEncodedRootLength(
|
|
2865
|
+
var getRootLength = (path2) => {
|
|
2866
|
+
const rootLength = getEncodedRootLength(path2);
|
|
2649
2867
|
return rootLength < 0 ? ~rootLength : rootLength;
|
|
2650
2868
|
};
|
|
2651
|
-
var getEncodedRootLength = (
|
|
2652
|
-
if (!
|
|
2653
|
-
const ch0 =
|
|
2869
|
+
var getEncodedRootLength = (path2) => {
|
|
2870
|
+
if (!path2) return 0;
|
|
2871
|
+
const ch0 = path2.charCodeAt(0);
|
|
2654
2872
|
if (ch0 === 47 /* slash */ || ch0 === 92 /* backslash */) {
|
|
2655
|
-
if (
|
|
2656
|
-
const p1 =
|
|
2657
|
-
if (p1 < 0) return
|
|
2873
|
+
if (path2.charCodeAt(1) !== ch0) return 1;
|
|
2874
|
+
const p1 = path2.indexOf(ch0 === 47 /* slash */ ? "/" : altDirectorySeparator, 2);
|
|
2875
|
+
if (p1 < 0) return path2.length;
|
|
2658
2876
|
return p1 + 1;
|
|
2659
2877
|
}
|
|
2660
|
-
if (isVolumeCharacter(ch0) &&
|
|
2661
|
-
const ch2 =
|
|
2878
|
+
if (isVolumeCharacter(ch0) && path2.charCodeAt(1) === 58 /* colon */) {
|
|
2879
|
+
const ch2 = path2.charCodeAt(2);
|
|
2662
2880
|
if (ch2 === 47 /* slash */ || ch2 === 92 /* backslash */) return 3;
|
|
2663
|
-
if (
|
|
2881
|
+
if (path2.length === 2) return 2;
|
|
2664
2882
|
}
|
|
2665
|
-
const schemeEnd =
|
|
2883
|
+
const schemeEnd = path2.indexOf(urlSchemeSeparator);
|
|
2666
2884
|
if (schemeEnd !== -1) {
|
|
2667
2885
|
const authorityStart = schemeEnd + urlSchemeSeparator.length;
|
|
2668
|
-
const authorityEnd =
|
|
2886
|
+
const authorityEnd = path2.indexOf("/", authorityStart);
|
|
2669
2887
|
if (authorityEnd !== -1) {
|
|
2670
|
-
const scheme =
|
|
2671
|
-
const authority =
|
|
2672
|
-
if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(
|
|
2673
|
-
const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(
|
|
2888
|
+
const scheme = path2.slice(0, schemeEnd);
|
|
2889
|
+
const authority = path2.slice(authorityStart, authorityEnd);
|
|
2890
|
+
if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(path2.charCodeAt(authorityEnd + 1))) {
|
|
2891
|
+
const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path2, authorityEnd + 2);
|
|
2674
2892
|
if (volumeSeparatorEnd !== -1) {
|
|
2675
|
-
if (
|
|
2893
|
+
if (path2.charCodeAt(volumeSeparatorEnd) === 47 /* slash */) {
|
|
2676
2894
|
return ~(volumeSeparatorEnd + 1);
|
|
2677
2895
|
}
|
|
2678
|
-
if (volumeSeparatorEnd ===
|
|
2896
|
+
if (volumeSeparatorEnd === path2.length) {
|
|
2679
2897
|
return ~volumeSeparatorEnd;
|
|
2680
2898
|
}
|
|
2681
2899
|
}
|
|
2682
2900
|
}
|
|
2683
2901
|
return ~(authorityEnd + 1);
|
|
2684
2902
|
}
|
|
2685
|
-
return ~
|
|
2903
|
+
return ~path2.length;
|
|
2686
2904
|
}
|
|
2687
2905
|
return 0;
|
|
2688
2906
|
};
|
|
@@ -2696,9 +2914,9 @@ var getFileUrlVolumeSeparatorEnd = (url, start) => {
|
|
|
2696
2914
|
}
|
|
2697
2915
|
return -1;
|
|
2698
2916
|
};
|
|
2699
|
-
var pathComponents = (
|
|
2700
|
-
const root =
|
|
2701
|
-
const rest =
|
|
2917
|
+
var pathComponents = (path2, rootLength) => {
|
|
2918
|
+
const root = path2.substring(0, rootLength);
|
|
2919
|
+
const rest = path2.substring(rootLength).split("/");
|
|
2702
2920
|
const restLen = rest.length;
|
|
2703
2921
|
if (restLen > 0 && !rest[restLen - 1]) {
|
|
2704
2922
|
rest.pop();
|
|
@@ -2706,6 +2924,1359 @@ var pathComponents = (path, rootLength) => {
|
|
|
2706
2924
|
return [root, ...rest];
|
|
2707
2925
|
};
|
|
2708
2926
|
|
|
2927
|
+
// node_modules/minimatch/dist/esm/index.js
|
|
2928
|
+
var import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
2929
|
+
|
|
2930
|
+
// node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
2931
|
+
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
2932
|
+
var assertValidPattern = (pattern) => {
|
|
2933
|
+
if (typeof pattern !== "string") {
|
|
2934
|
+
throw new TypeError("invalid pattern");
|
|
2935
|
+
}
|
|
2936
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
2937
|
+
throw new TypeError("pattern is too long");
|
|
2938
|
+
}
|
|
2939
|
+
};
|
|
2940
|
+
|
|
2941
|
+
// node_modules/minimatch/dist/esm/brace-expressions.js
|
|
2942
|
+
var posixClasses = {
|
|
2943
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
2944
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
2945
|
+
"[:ascii:]": ["\\x00-\\x7f", false],
|
|
2946
|
+
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
2947
|
+
"[:cntrl:]": ["\\p{Cc}", true],
|
|
2948
|
+
"[:digit:]": ["\\p{Nd}", true],
|
|
2949
|
+
"[:graph:]": ["\\p{Z}\\p{C}", true, true],
|
|
2950
|
+
"[:lower:]": ["\\p{Ll}", true],
|
|
2951
|
+
"[:print:]": ["\\p{C}", true],
|
|
2952
|
+
"[:punct:]": ["\\p{P}", true],
|
|
2953
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
2954
|
+
"[:upper:]": ["\\p{Lu}", true],
|
|
2955
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
2956
|
+
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
2957
|
+
};
|
|
2958
|
+
var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
2959
|
+
var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
2960
|
+
var rangesToString = (ranges) => ranges.join("");
|
|
2961
|
+
var parseClass = (glob, position) => {
|
|
2962
|
+
const pos = position;
|
|
2963
|
+
if (glob.charAt(pos) !== "[") {
|
|
2964
|
+
throw new Error("not in a brace expression");
|
|
2965
|
+
}
|
|
2966
|
+
const ranges = [];
|
|
2967
|
+
const negs = [];
|
|
2968
|
+
let i = pos + 1;
|
|
2969
|
+
let sawStart = false;
|
|
2970
|
+
let uflag = false;
|
|
2971
|
+
let escaping = false;
|
|
2972
|
+
let negate = false;
|
|
2973
|
+
let endPos = pos;
|
|
2974
|
+
let rangeStart = "";
|
|
2975
|
+
WHILE: while (i < glob.length) {
|
|
2976
|
+
const c = glob.charAt(i);
|
|
2977
|
+
if ((c === "!" || c === "^") && i === pos + 1) {
|
|
2978
|
+
negate = true;
|
|
2979
|
+
i++;
|
|
2980
|
+
continue;
|
|
2981
|
+
}
|
|
2982
|
+
if (c === "]" && sawStart && !escaping) {
|
|
2983
|
+
endPos = i + 1;
|
|
2984
|
+
break;
|
|
2985
|
+
}
|
|
2986
|
+
sawStart = true;
|
|
2987
|
+
if (c === "\\") {
|
|
2988
|
+
if (!escaping) {
|
|
2989
|
+
escaping = true;
|
|
2990
|
+
i++;
|
|
2991
|
+
continue;
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
if (c === "[" && !escaping) {
|
|
2995
|
+
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
2996
|
+
if (glob.startsWith(cls, i)) {
|
|
2997
|
+
if (rangeStart) {
|
|
2998
|
+
return ["$.", false, glob.length - pos, true];
|
|
2999
|
+
}
|
|
3000
|
+
i += cls.length;
|
|
3001
|
+
if (neg)
|
|
3002
|
+
negs.push(unip);
|
|
3003
|
+
else
|
|
3004
|
+
ranges.push(unip);
|
|
3005
|
+
uflag = uflag || u;
|
|
3006
|
+
continue WHILE;
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
escaping = false;
|
|
3011
|
+
if (rangeStart) {
|
|
3012
|
+
if (c > rangeStart) {
|
|
3013
|
+
ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
|
|
3014
|
+
} else if (c === rangeStart) {
|
|
3015
|
+
ranges.push(braceEscape(c));
|
|
3016
|
+
}
|
|
3017
|
+
rangeStart = "";
|
|
3018
|
+
i++;
|
|
3019
|
+
continue;
|
|
3020
|
+
}
|
|
3021
|
+
if (glob.startsWith("-]", i + 1)) {
|
|
3022
|
+
ranges.push(braceEscape(c + "-"));
|
|
3023
|
+
i += 2;
|
|
3024
|
+
continue;
|
|
3025
|
+
}
|
|
3026
|
+
if (glob.startsWith("-", i + 1)) {
|
|
3027
|
+
rangeStart = c;
|
|
3028
|
+
i += 2;
|
|
3029
|
+
continue;
|
|
3030
|
+
}
|
|
3031
|
+
ranges.push(braceEscape(c));
|
|
3032
|
+
i++;
|
|
3033
|
+
}
|
|
3034
|
+
if (endPos < i) {
|
|
3035
|
+
return ["", false, 0, false];
|
|
3036
|
+
}
|
|
3037
|
+
if (!ranges.length && !negs.length) {
|
|
3038
|
+
return ["$.", false, glob.length - pos, true];
|
|
3039
|
+
}
|
|
3040
|
+
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
|
|
3041
|
+
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
3042
|
+
return [regexpEscape(r), false, endPos - pos, false];
|
|
3043
|
+
}
|
|
3044
|
+
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
|
|
3045
|
+
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
3046
|
+
const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
|
|
3047
|
+
return [comb, uflag, endPos - pos, true];
|
|
3048
|
+
};
|
|
3049
|
+
|
|
3050
|
+
// node_modules/minimatch/dist/esm/unescape.js
|
|
3051
|
+
var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
3052
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
3053
|
+
};
|
|
3054
|
+
|
|
3055
|
+
// node_modules/minimatch/dist/esm/ast.js
|
|
3056
|
+
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
3057
|
+
var isExtglobType = (c) => types.has(c);
|
|
3058
|
+
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
3059
|
+
var startNoDot = "(?!\\.)";
|
|
3060
|
+
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
|
3061
|
+
var justDots = /* @__PURE__ */ new Set(["..", "."]);
|
|
3062
|
+
var reSpecials = new Set("().*{}+?[]^$\\!");
|
|
3063
|
+
var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
3064
|
+
var qmark = "[^/]";
|
|
3065
|
+
var star = qmark + "*?";
|
|
3066
|
+
var starNoEmpty = qmark + "+?";
|
|
3067
|
+
var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
|
|
3068
|
+
var _AST = class _AST {
|
|
3069
|
+
constructor(type, parent, options = {}) {
|
|
3070
|
+
__privateAdd(this, _AST_instances);
|
|
3071
|
+
__publicField(this, "type");
|
|
3072
|
+
__privateAdd(this, _root);
|
|
3073
|
+
__privateAdd(this, _hasMagic);
|
|
3074
|
+
__privateAdd(this, _uflag, false);
|
|
3075
|
+
__privateAdd(this, _parts, []);
|
|
3076
|
+
__privateAdd(this, _parent);
|
|
3077
|
+
__privateAdd(this, _parentIndex);
|
|
3078
|
+
__privateAdd(this, _negs);
|
|
3079
|
+
__privateAdd(this, _filledNegs, false);
|
|
3080
|
+
__privateAdd(this, _options);
|
|
3081
|
+
__privateAdd(this, _toString);
|
|
3082
|
+
// set to true if it's an extglob with no children
|
|
3083
|
+
// (which really means one child of '')
|
|
3084
|
+
__privateAdd(this, _emptyExt, false);
|
|
3085
|
+
this.type = type;
|
|
3086
|
+
if (type)
|
|
3087
|
+
__privateSet(this, _hasMagic, true);
|
|
3088
|
+
__privateSet(this, _parent, parent);
|
|
3089
|
+
__privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
|
|
3090
|
+
__privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
|
|
3091
|
+
__privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
|
|
3092
|
+
if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
|
|
3093
|
+
__privateGet(this, _negs).push(this);
|
|
3094
|
+
__privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
|
|
3095
|
+
}
|
|
3096
|
+
get hasMagic() {
|
|
3097
|
+
if (__privateGet(this, _hasMagic) !== void 0)
|
|
3098
|
+
return __privateGet(this, _hasMagic);
|
|
3099
|
+
for (const p of __privateGet(this, _parts)) {
|
|
3100
|
+
if (typeof p === "string")
|
|
3101
|
+
continue;
|
|
3102
|
+
if (p.type || p.hasMagic)
|
|
3103
|
+
return __privateSet(this, _hasMagic, true);
|
|
3104
|
+
}
|
|
3105
|
+
return __privateGet(this, _hasMagic);
|
|
3106
|
+
}
|
|
3107
|
+
// reconstructs the pattern
|
|
3108
|
+
toString() {
|
|
3109
|
+
if (__privateGet(this, _toString) !== void 0)
|
|
3110
|
+
return __privateGet(this, _toString);
|
|
3111
|
+
if (!this.type) {
|
|
3112
|
+
return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
|
|
3113
|
+
} else {
|
|
3114
|
+
return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
push(...parts) {
|
|
3118
|
+
for (const p of parts) {
|
|
3119
|
+
if (p === "")
|
|
3120
|
+
continue;
|
|
3121
|
+
if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
|
|
3122
|
+
throw new Error("invalid part: " + p);
|
|
3123
|
+
}
|
|
3124
|
+
__privateGet(this, _parts).push(p);
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
toJSON() {
|
|
3128
|
+
var _a;
|
|
3129
|
+
const ret = this.type === null ? __privateGet(this, _parts).slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...__privateGet(this, _parts).map((p) => p.toJSON())];
|
|
3130
|
+
if (this.isStart() && !this.type)
|
|
3131
|
+
ret.unshift([]);
|
|
3132
|
+
if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")) {
|
|
3133
|
+
ret.push({});
|
|
3134
|
+
}
|
|
3135
|
+
return ret;
|
|
3136
|
+
}
|
|
3137
|
+
isStart() {
|
|
3138
|
+
var _a;
|
|
3139
|
+
if (__privateGet(this, _root) === this)
|
|
3140
|
+
return true;
|
|
3141
|
+
if (!((_a = __privateGet(this, _parent)) == null ? void 0 : _a.isStart()))
|
|
3142
|
+
return false;
|
|
3143
|
+
if (__privateGet(this, _parentIndex) === 0)
|
|
3144
|
+
return true;
|
|
3145
|
+
const p = __privateGet(this, _parent);
|
|
3146
|
+
for (let i = 0; i < __privateGet(this, _parentIndex); i++) {
|
|
3147
|
+
const pp = __privateGet(p, _parts)[i];
|
|
3148
|
+
if (!(pp instanceof _AST && pp.type === "!")) {
|
|
3149
|
+
return false;
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3152
|
+
return true;
|
|
3153
|
+
}
|
|
3154
|
+
isEnd() {
|
|
3155
|
+
var _a, _b, _c;
|
|
3156
|
+
if (__privateGet(this, _root) === this)
|
|
3157
|
+
return true;
|
|
3158
|
+
if (((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")
|
|
3159
|
+
return true;
|
|
3160
|
+
if (!((_b = __privateGet(this, _parent)) == null ? void 0 : _b.isEnd()))
|
|
3161
|
+
return false;
|
|
3162
|
+
if (!this.type)
|
|
3163
|
+
return (_c = __privateGet(this, _parent)) == null ? void 0 : _c.isEnd();
|
|
3164
|
+
const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
|
|
3165
|
+
return __privateGet(this, _parentIndex) === pl - 1;
|
|
3166
|
+
}
|
|
3167
|
+
copyIn(part) {
|
|
3168
|
+
if (typeof part === "string")
|
|
3169
|
+
this.push(part);
|
|
3170
|
+
else
|
|
3171
|
+
this.push(part.clone(this));
|
|
3172
|
+
}
|
|
3173
|
+
clone(parent) {
|
|
3174
|
+
const c = new _AST(this.type, parent);
|
|
3175
|
+
for (const p of __privateGet(this, _parts)) {
|
|
3176
|
+
c.copyIn(p);
|
|
3177
|
+
}
|
|
3178
|
+
return c;
|
|
3179
|
+
}
|
|
3180
|
+
static fromGlob(pattern, options = {}) {
|
|
3181
|
+
var _a;
|
|
3182
|
+
const ast = new _AST(null, void 0, options);
|
|
3183
|
+
__privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
|
|
3184
|
+
return ast;
|
|
3185
|
+
}
|
|
3186
|
+
// returns the regular expression if there's magic, or the unescaped
|
|
3187
|
+
// string if not.
|
|
3188
|
+
toMMPattern() {
|
|
3189
|
+
if (this !== __privateGet(this, _root))
|
|
3190
|
+
return __privateGet(this, _root).toMMPattern();
|
|
3191
|
+
const glob = this.toString();
|
|
3192
|
+
const [re, body, hasMagic, uflag] = this.toRegExpSource();
|
|
3193
|
+
const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
3194
|
+
if (!anyMagic) {
|
|
3195
|
+
return body;
|
|
3196
|
+
}
|
|
3197
|
+
const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
|
|
3198
|
+
return Object.assign(new RegExp(`^${re}$`, flags), {
|
|
3199
|
+
_src: re,
|
|
3200
|
+
_glob: glob
|
|
3201
|
+
});
|
|
3202
|
+
}
|
|
3203
|
+
get options() {
|
|
3204
|
+
return __privateGet(this, _options);
|
|
3205
|
+
}
|
|
3206
|
+
// returns the string match, the regexp source, whether there's magic
|
|
3207
|
+
// in the regexp (so a regular expression is required) and whether or
|
|
3208
|
+
// not the uflag is needed for the regular expression (for posix classes)
|
|
3209
|
+
// TODO: instead of injecting the start/end at this point, just return
|
|
3210
|
+
// the BODY of the regexp, along with the start/end portions suitable
|
|
3211
|
+
// for binding the start/end in either a joined full-path makeRe context
|
|
3212
|
+
// (where we bind to (^|/), or a standalone matchPart context (where
|
|
3213
|
+
// we bind to ^, and not /). Otherwise slashes get duped!
|
|
3214
|
+
//
|
|
3215
|
+
// In part-matching mode, the start is:
|
|
3216
|
+
// - if not isStart: nothing
|
|
3217
|
+
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
|
3218
|
+
// - if dots allowed or not possible: ^
|
|
3219
|
+
// - if dots possible and not allowed: ^(?!\.)
|
|
3220
|
+
// end is:
|
|
3221
|
+
// - if not isEnd(): nothing
|
|
3222
|
+
// - else: $
|
|
3223
|
+
//
|
|
3224
|
+
// In full-path matching mode, we put the slash at the START of the
|
|
3225
|
+
// pattern, so start is:
|
|
3226
|
+
// - if first pattern: same as part-matching mode
|
|
3227
|
+
// - if not isStart(): nothing
|
|
3228
|
+
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
|
3229
|
+
// - if dots allowed or not possible: /
|
|
3230
|
+
// - if dots possible and not allowed: /(?!\.)
|
|
3231
|
+
// end is:
|
|
3232
|
+
// - if last pattern, same as part-matching mode
|
|
3233
|
+
// - else nothing
|
|
3234
|
+
//
|
|
3235
|
+
// Always put the (?:$|/) on negated tails, though, because that has to be
|
|
3236
|
+
// there to bind the end of the negated pattern portion, and it's easier to
|
|
3237
|
+
// just stick it in now rather than try to inject it later in the middle of
|
|
3238
|
+
// the pattern.
|
|
3239
|
+
//
|
|
3240
|
+
// We can just always return the same end, and leave it up to the caller
|
|
3241
|
+
// to know whether it's going to be used joined or in parts.
|
|
3242
|
+
// And, if the start is adjusted slightly, can do the same there:
|
|
3243
|
+
// - if not isStart: nothing
|
|
3244
|
+
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
|
3245
|
+
// - if dots allowed or not possible: (?:/|^)
|
|
3246
|
+
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
|
3247
|
+
//
|
|
3248
|
+
// But it's better to have a simpler binding without a conditional, for
|
|
3249
|
+
// performance, so probably better to return both start options.
|
|
3250
|
+
//
|
|
3251
|
+
// Then the caller just ignores the end if it's not the first pattern,
|
|
3252
|
+
// and the start always gets applied.
|
|
3253
|
+
//
|
|
3254
|
+
// But that's always going to be $ if it's the ending pattern, or nothing,
|
|
3255
|
+
// so the caller can just attach $ at the end of the pattern when building.
|
|
3256
|
+
//
|
|
3257
|
+
// So the todo is:
|
|
3258
|
+
// - better detect what kind of start is needed
|
|
3259
|
+
// - return both flavors of starting pattern
|
|
3260
|
+
// - attach $ at the end of the pattern when creating the actual RegExp
|
|
3261
|
+
//
|
|
3262
|
+
// Ah, but wait, no, that all only applies to the root when the first pattern
|
|
3263
|
+
// is not an extglob. If the first pattern IS an extglob, then we need all
|
|
3264
|
+
// that dot prevention biz to live in the extglob portions, because eg
|
|
3265
|
+
// +(*|.x*) can match .xy but not .yx.
|
|
3266
|
+
//
|
|
3267
|
+
// So, return the two flavors if it's #root and the first child is not an
|
|
3268
|
+
// AST, otherwise leave it to the child AST to handle it, and there,
|
|
3269
|
+
// use the (?:^|/) style of start binding.
|
|
3270
|
+
//
|
|
3271
|
+
// Even simplified further:
|
|
3272
|
+
// - Since the start for a join is eg /(?!\.) and the start for a part
|
|
3273
|
+
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
|
3274
|
+
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
3275
|
+
toRegExpSource(allowDot) {
|
|
3276
|
+
var _a;
|
|
3277
|
+
const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
|
|
3278
|
+
if (__privateGet(this, _root) === this)
|
|
3279
|
+
__privateMethod(this, _AST_instances, fillNegs_fn).call(this);
|
|
3280
|
+
if (!this.type) {
|
|
3281
|
+
const noEmpty = this.isStart() && this.isEnd();
|
|
3282
|
+
const src = __privateGet(this, _parts).map((p) => {
|
|
3283
|
+
var _a2;
|
|
3284
|
+
const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a2 = _AST, _AST_static, parseGlob_fn).call(_a2, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
|
|
3285
|
+
__privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
|
|
3286
|
+
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
3287
|
+
return re;
|
|
3288
|
+
}).join("");
|
|
3289
|
+
let start2 = "";
|
|
3290
|
+
if (this.isStart()) {
|
|
3291
|
+
if (typeof __privateGet(this, _parts)[0] === "string") {
|
|
3292
|
+
const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
|
|
3293
|
+
if (!dotTravAllowed) {
|
|
3294
|
+
const aps = addPatternStart;
|
|
3295
|
+
const needNoTrav = (
|
|
3296
|
+
// dots are allowed, and the pattern starts with [ or .
|
|
3297
|
+
dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
3298
|
+
src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
3299
|
+
src.startsWith("\\.\\.") && aps.has(src.charAt(4))
|
|
3300
|
+
);
|
|
3301
|
+
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
3302
|
+
start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
let end = "";
|
|
3307
|
+
if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!") {
|
|
3308
|
+
end = "(?:$|\\/)";
|
|
3309
|
+
}
|
|
3310
|
+
const final2 = start2 + src + end;
|
|
3311
|
+
return [
|
|
3312
|
+
final2,
|
|
3313
|
+
unescape(src),
|
|
3314
|
+
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
3315
|
+
__privateGet(this, _uflag)
|
|
3316
|
+
];
|
|
3317
|
+
}
|
|
3318
|
+
const repeated = this.type === "*" || this.type === "+";
|
|
3319
|
+
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
3320
|
+
let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
|
|
3321
|
+
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
3322
|
+
const s = this.toString();
|
|
3323
|
+
__privateSet(this, _parts, [s]);
|
|
3324
|
+
this.type = null;
|
|
3325
|
+
__privateSet(this, _hasMagic, void 0);
|
|
3326
|
+
return [s, unescape(this.toString()), false, false];
|
|
3327
|
+
}
|
|
3328
|
+
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
|
|
3329
|
+
if (bodyDotAllowed === body) {
|
|
3330
|
+
bodyDotAllowed = "";
|
|
3331
|
+
}
|
|
3332
|
+
if (bodyDotAllowed) {
|
|
3333
|
+
body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
|
3334
|
+
}
|
|
3335
|
+
let final = "";
|
|
3336
|
+
if (this.type === "!" && __privateGet(this, _emptyExt)) {
|
|
3337
|
+
final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
|
|
3338
|
+
} else {
|
|
3339
|
+
const close = this.type === "!" ? (
|
|
3340
|
+
// !() must match something,but !(x) can match ''
|
|
3341
|
+
"))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
|
|
3342
|
+
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
|
|
3343
|
+
final = start + body + close;
|
|
3344
|
+
}
|
|
3345
|
+
return [
|
|
3346
|
+
final,
|
|
3347
|
+
unescape(body),
|
|
3348
|
+
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
3349
|
+
__privateGet(this, _uflag)
|
|
3350
|
+
];
|
|
3351
|
+
}
|
|
3352
|
+
};
|
|
3353
|
+
_root = new WeakMap();
|
|
3354
|
+
_hasMagic = new WeakMap();
|
|
3355
|
+
_uflag = new WeakMap();
|
|
3356
|
+
_parts = new WeakMap();
|
|
3357
|
+
_parent = new WeakMap();
|
|
3358
|
+
_parentIndex = new WeakMap();
|
|
3359
|
+
_negs = new WeakMap();
|
|
3360
|
+
_filledNegs = new WeakMap();
|
|
3361
|
+
_options = new WeakMap();
|
|
3362
|
+
_toString = new WeakMap();
|
|
3363
|
+
_emptyExt = new WeakMap();
|
|
3364
|
+
_AST_instances = new WeakSet();
|
|
3365
|
+
fillNegs_fn = function() {
|
|
3366
|
+
if (this !== __privateGet(this, _root))
|
|
3367
|
+
throw new Error("should only call on root");
|
|
3368
|
+
if (__privateGet(this, _filledNegs))
|
|
3369
|
+
return this;
|
|
3370
|
+
this.toString();
|
|
3371
|
+
__privateSet(this, _filledNegs, true);
|
|
3372
|
+
let n;
|
|
3373
|
+
while (n = __privateGet(this, _negs).pop()) {
|
|
3374
|
+
if (n.type !== "!")
|
|
3375
|
+
continue;
|
|
3376
|
+
let p = n;
|
|
3377
|
+
let pp = __privateGet(p, _parent);
|
|
3378
|
+
while (pp) {
|
|
3379
|
+
for (let i = __privateGet(p, _parentIndex) + 1; !pp.type && i < __privateGet(pp, _parts).length; i++) {
|
|
3380
|
+
for (const part of __privateGet(n, _parts)) {
|
|
3381
|
+
if (typeof part === "string") {
|
|
3382
|
+
throw new Error("string part in extglob AST??");
|
|
3383
|
+
}
|
|
3384
|
+
part.copyIn(__privateGet(pp, _parts)[i]);
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
p = pp;
|
|
3388
|
+
pp = __privateGet(p, _parent);
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
return this;
|
|
3392
|
+
};
|
|
3393
|
+
_AST_static = new WeakSet();
|
|
3394
|
+
parseAST_fn = function(str, ast, pos, opt) {
|
|
3395
|
+
var _a, _b;
|
|
3396
|
+
let escaping = false;
|
|
3397
|
+
let inBrace = false;
|
|
3398
|
+
let braceStart = -1;
|
|
3399
|
+
let braceNeg = false;
|
|
3400
|
+
if (ast.type === null) {
|
|
3401
|
+
let i2 = pos;
|
|
3402
|
+
let acc2 = "";
|
|
3403
|
+
while (i2 < str.length) {
|
|
3404
|
+
const c = str.charAt(i2++);
|
|
3405
|
+
if (escaping || c === "\\") {
|
|
3406
|
+
escaping = !escaping;
|
|
3407
|
+
acc2 += c;
|
|
3408
|
+
continue;
|
|
3409
|
+
}
|
|
3410
|
+
if (inBrace) {
|
|
3411
|
+
if (i2 === braceStart + 1) {
|
|
3412
|
+
if (c === "^" || c === "!") {
|
|
3413
|
+
braceNeg = true;
|
|
3414
|
+
}
|
|
3415
|
+
} else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
|
|
3416
|
+
inBrace = false;
|
|
3417
|
+
}
|
|
3418
|
+
acc2 += c;
|
|
3419
|
+
continue;
|
|
3420
|
+
} else if (c === "[") {
|
|
3421
|
+
inBrace = true;
|
|
3422
|
+
braceStart = i2;
|
|
3423
|
+
braceNeg = false;
|
|
3424
|
+
acc2 += c;
|
|
3425
|
+
continue;
|
|
3426
|
+
}
|
|
3427
|
+
if (!opt.noext && isExtglobType(c) && str.charAt(i2) === "(") {
|
|
3428
|
+
ast.push(acc2);
|
|
3429
|
+
acc2 = "";
|
|
3430
|
+
const ext2 = new _AST(c, ast);
|
|
3431
|
+
i2 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext2, i2, opt);
|
|
3432
|
+
ast.push(ext2);
|
|
3433
|
+
continue;
|
|
3434
|
+
}
|
|
3435
|
+
acc2 += c;
|
|
3436
|
+
}
|
|
3437
|
+
ast.push(acc2);
|
|
3438
|
+
return i2;
|
|
3439
|
+
}
|
|
3440
|
+
let i = pos + 1;
|
|
3441
|
+
let part = new _AST(null, ast);
|
|
3442
|
+
const parts = [];
|
|
3443
|
+
let acc = "";
|
|
3444
|
+
while (i < str.length) {
|
|
3445
|
+
const c = str.charAt(i++);
|
|
3446
|
+
if (escaping || c === "\\") {
|
|
3447
|
+
escaping = !escaping;
|
|
3448
|
+
acc += c;
|
|
3449
|
+
continue;
|
|
3450
|
+
}
|
|
3451
|
+
if (inBrace) {
|
|
3452
|
+
if (i === braceStart + 1) {
|
|
3453
|
+
if (c === "^" || c === "!") {
|
|
3454
|
+
braceNeg = true;
|
|
3455
|
+
}
|
|
3456
|
+
} else if (c === "]" && !(i === braceStart + 2 && braceNeg)) {
|
|
3457
|
+
inBrace = false;
|
|
3458
|
+
}
|
|
3459
|
+
acc += c;
|
|
3460
|
+
continue;
|
|
3461
|
+
} else if (c === "[") {
|
|
3462
|
+
inBrace = true;
|
|
3463
|
+
braceStart = i;
|
|
3464
|
+
braceNeg = false;
|
|
3465
|
+
acc += c;
|
|
3466
|
+
continue;
|
|
3467
|
+
}
|
|
3468
|
+
if (isExtglobType(c) && str.charAt(i) === "(") {
|
|
3469
|
+
part.push(acc);
|
|
3470
|
+
acc = "";
|
|
3471
|
+
const ext2 = new _AST(c, part);
|
|
3472
|
+
part.push(ext2);
|
|
3473
|
+
i = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext2, i, opt);
|
|
3474
|
+
continue;
|
|
3475
|
+
}
|
|
3476
|
+
if (c === "|") {
|
|
3477
|
+
part.push(acc);
|
|
3478
|
+
acc = "";
|
|
3479
|
+
parts.push(part);
|
|
3480
|
+
part = new _AST(null, ast);
|
|
3481
|
+
continue;
|
|
3482
|
+
}
|
|
3483
|
+
if (c === ")") {
|
|
3484
|
+
if (acc === "" && __privateGet(ast, _parts).length === 0) {
|
|
3485
|
+
__privateSet(ast, _emptyExt, true);
|
|
3486
|
+
}
|
|
3487
|
+
part.push(acc);
|
|
3488
|
+
acc = "";
|
|
3489
|
+
ast.push(...parts, part);
|
|
3490
|
+
return i;
|
|
3491
|
+
}
|
|
3492
|
+
acc += c;
|
|
3493
|
+
}
|
|
3494
|
+
ast.type = null;
|
|
3495
|
+
__privateSet(ast, _hasMagic, void 0);
|
|
3496
|
+
__privateSet(ast, _parts, [str.substring(pos - 1)]);
|
|
3497
|
+
return i;
|
|
3498
|
+
};
|
|
3499
|
+
partsToRegExp_fn = function(dot) {
|
|
3500
|
+
return __privateGet(this, _parts).map((p) => {
|
|
3501
|
+
if (typeof p === "string") {
|
|
3502
|
+
throw new Error("string type in extglob ast??");
|
|
3503
|
+
}
|
|
3504
|
+
const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
|
|
3505
|
+
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
3506
|
+
return re;
|
|
3507
|
+
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
3508
|
+
};
|
|
3509
|
+
parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
|
|
3510
|
+
let escaping = false;
|
|
3511
|
+
let re = "";
|
|
3512
|
+
let uflag = false;
|
|
3513
|
+
for (let i = 0; i < glob.length; i++) {
|
|
3514
|
+
const c = glob.charAt(i);
|
|
3515
|
+
if (escaping) {
|
|
3516
|
+
escaping = false;
|
|
3517
|
+
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
3518
|
+
continue;
|
|
3519
|
+
}
|
|
3520
|
+
if (c === "\\") {
|
|
3521
|
+
if (i === glob.length - 1) {
|
|
3522
|
+
re += "\\\\";
|
|
3523
|
+
} else {
|
|
3524
|
+
escaping = true;
|
|
3525
|
+
}
|
|
3526
|
+
continue;
|
|
3527
|
+
}
|
|
3528
|
+
if (c === "[") {
|
|
3529
|
+
const [src, needUflag, consumed, magic] = parseClass(glob, i);
|
|
3530
|
+
if (consumed) {
|
|
3531
|
+
re += src;
|
|
3532
|
+
uflag = uflag || needUflag;
|
|
3533
|
+
i += consumed - 1;
|
|
3534
|
+
hasMagic = hasMagic || magic;
|
|
3535
|
+
continue;
|
|
3536
|
+
}
|
|
3537
|
+
}
|
|
3538
|
+
if (c === "*") {
|
|
3539
|
+
if (noEmpty && glob === "*")
|
|
3540
|
+
re += starNoEmpty;
|
|
3541
|
+
else
|
|
3542
|
+
re += star;
|
|
3543
|
+
hasMagic = true;
|
|
3544
|
+
continue;
|
|
3545
|
+
}
|
|
3546
|
+
if (c === "?") {
|
|
3547
|
+
re += qmark;
|
|
3548
|
+
hasMagic = true;
|
|
3549
|
+
continue;
|
|
3550
|
+
}
|
|
3551
|
+
re += regExpEscape(c);
|
|
3552
|
+
}
|
|
3553
|
+
return [re, unescape(glob), !!hasMagic, uflag];
|
|
3554
|
+
};
|
|
3555
|
+
__privateAdd(_AST, _AST_static);
|
|
3556
|
+
var AST = _AST;
|
|
3557
|
+
|
|
3558
|
+
// node_modules/minimatch/dist/esm/escape.js
|
|
3559
|
+
var escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
3560
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
3561
|
+
};
|
|
3562
|
+
|
|
3563
|
+
// node_modules/minimatch/dist/esm/index.js
|
|
3564
|
+
var minimatch = (p, pattern, options = {}) => {
|
|
3565
|
+
assertValidPattern(pattern);
|
|
3566
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
3567
|
+
return false;
|
|
3568
|
+
}
|
|
3569
|
+
return new Minimatch(pattern, options).match(p);
|
|
3570
|
+
};
|
|
3571
|
+
var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
|
|
3572
|
+
var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
|
|
3573
|
+
var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
|
|
3574
|
+
var starDotExtTestNocase = (ext2) => {
|
|
3575
|
+
ext2 = ext2.toLowerCase();
|
|
3576
|
+
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
|
|
3577
|
+
};
|
|
3578
|
+
var starDotExtTestNocaseDot = (ext2) => {
|
|
3579
|
+
ext2 = ext2.toLowerCase();
|
|
3580
|
+
return (f) => f.toLowerCase().endsWith(ext2);
|
|
3581
|
+
};
|
|
3582
|
+
var starDotStarRE = /^\*+\.\*+$/;
|
|
3583
|
+
var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
3584
|
+
var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
3585
|
+
var dotStarRE = /^\.\*+$/;
|
|
3586
|
+
var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
3587
|
+
var starRE = /^\*+$/;
|
|
3588
|
+
var starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
3589
|
+
var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
3590
|
+
var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
3591
|
+
var qmarksTestNocase = ([$0, ext2 = ""]) => {
|
|
3592
|
+
const noext = qmarksTestNoExt([$0]);
|
|
3593
|
+
if (!ext2)
|
|
3594
|
+
return noext;
|
|
3595
|
+
ext2 = ext2.toLowerCase();
|
|
3596
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
3597
|
+
};
|
|
3598
|
+
var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
|
|
3599
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
3600
|
+
if (!ext2)
|
|
3601
|
+
return noext;
|
|
3602
|
+
ext2 = ext2.toLowerCase();
|
|
3603
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
3604
|
+
};
|
|
3605
|
+
var qmarksTestDot = ([$0, ext2 = ""]) => {
|
|
3606
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
3607
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
3608
|
+
};
|
|
3609
|
+
var qmarksTest = ([$0, ext2 = ""]) => {
|
|
3610
|
+
const noext = qmarksTestNoExt([$0]);
|
|
3611
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
3612
|
+
};
|
|
3613
|
+
var qmarksTestNoExt = ([$0]) => {
|
|
3614
|
+
const len = $0.length;
|
|
3615
|
+
return (f) => f.length === len && !f.startsWith(".");
|
|
3616
|
+
};
|
|
3617
|
+
var qmarksTestNoExtDot = ([$0]) => {
|
|
3618
|
+
const len = $0.length;
|
|
3619
|
+
return (f) => f.length === len && f !== "." && f !== "..";
|
|
3620
|
+
};
|
|
3621
|
+
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
3622
|
+
var path = {
|
|
3623
|
+
win32: { sep: "\\" },
|
|
3624
|
+
posix: { sep: "/" }
|
|
3625
|
+
};
|
|
3626
|
+
var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
|
|
3627
|
+
minimatch.sep = sep;
|
|
3628
|
+
var GLOBSTAR = Symbol("globstar **");
|
|
3629
|
+
minimatch.GLOBSTAR = GLOBSTAR;
|
|
3630
|
+
var qmark2 = "[^/]";
|
|
3631
|
+
var star2 = qmark2 + "*?";
|
|
3632
|
+
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
3633
|
+
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
3634
|
+
var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
|
|
3635
|
+
minimatch.filter = filter;
|
|
3636
|
+
var ext = (a, b = {}) => Object.assign({}, a, b);
|
|
3637
|
+
var defaults = (def) => {
|
|
3638
|
+
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
3639
|
+
return minimatch;
|
|
3640
|
+
}
|
|
3641
|
+
const orig = minimatch;
|
|
3642
|
+
const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
|
|
3643
|
+
return Object.assign(m, {
|
|
3644
|
+
Minimatch: class Minimatch extends orig.Minimatch {
|
|
3645
|
+
constructor(pattern, options = {}) {
|
|
3646
|
+
super(pattern, ext(def, options));
|
|
3647
|
+
}
|
|
3648
|
+
static defaults(options) {
|
|
3649
|
+
return orig.defaults(ext(def, options)).Minimatch;
|
|
3650
|
+
}
|
|
3651
|
+
},
|
|
3652
|
+
AST: class AST extends orig.AST {
|
|
3653
|
+
/* c8 ignore start */
|
|
3654
|
+
constructor(type, parent, options = {}) {
|
|
3655
|
+
super(type, parent, ext(def, options));
|
|
3656
|
+
}
|
|
3657
|
+
/* c8 ignore stop */
|
|
3658
|
+
static fromGlob(pattern, options = {}) {
|
|
3659
|
+
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
3660
|
+
}
|
|
3661
|
+
},
|
|
3662
|
+
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
3663
|
+
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
3664
|
+
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
3665
|
+
defaults: (options) => orig.defaults(ext(def, options)),
|
|
3666
|
+
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
3667
|
+
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
3668
|
+
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
|
|
3669
|
+
sep: orig.sep,
|
|
3670
|
+
GLOBSTAR
|
|
3671
|
+
});
|
|
3672
|
+
};
|
|
3673
|
+
minimatch.defaults = defaults;
|
|
3674
|
+
var braceExpand = (pattern, options = {}) => {
|
|
3675
|
+
assertValidPattern(pattern);
|
|
3676
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
3677
|
+
return [pattern];
|
|
3678
|
+
}
|
|
3679
|
+
return (0, import_brace_expansion.default)(pattern);
|
|
3680
|
+
};
|
|
3681
|
+
minimatch.braceExpand = braceExpand;
|
|
3682
|
+
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
3683
|
+
minimatch.makeRe = makeRe;
|
|
3684
|
+
var match = (list, pattern, options = {}) => {
|
|
3685
|
+
const mm = new Minimatch(pattern, options);
|
|
3686
|
+
list = list.filter((f) => mm.match(f));
|
|
3687
|
+
if (mm.options.nonull && !list.length) {
|
|
3688
|
+
list.push(pattern);
|
|
3689
|
+
}
|
|
3690
|
+
return list;
|
|
3691
|
+
};
|
|
3692
|
+
minimatch.match = match;
|
|
3693
|
+
var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
3694
|
+
var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
3695
|
+
var Minimatch = class {
|
|
3696
|
+
options;
|
|
3697
|
+
set;
|
|
3698
|
+
pattern;
|
|
3699
|
+
windowsPathsNoEscape;
|
|
3700
|
+
nonegate;
|
|
3701
|
+
negate;
|
|
3702
|
+
comment;
|
|
3703
|
+
empty;
|
|
3704
|
+
preserveMultipleSlashes;
|
|
3705
|
+
partial;
|
|
3706
|
+
globSet;
|
|
3707
|
+
globParts;
|
|
3708
|
+
nocase;
|
|
3709
|
+
isWindows;
|
|
3710
|
+
platform;
|
|
3711
|
+
windowsNoMagicRoot;
|
|
3712
|
+
regexp;
|
|
3713
|
+
constructor(pattern, options = {}) {
|
|
3714
|
+
assertValidPattern(pattern);
|
|
3715
|
+
options = options || {};
|
|
3716
|
+
this.options = options;
|
|
3717
|
+
this.pattern = pattern;
|
|
3718
|
+
this.platform = options.platform || defaultPlatform;
|
|
3719
|
+
this.isWindows = this.platform === "win32";
|
|
3720
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
|
3721
|
+
if (this.windowsPathsNoEscape) {
|
|
3722
|
+
this.pattern = this.pattern.replace(/\\/g, "/");
|
|
3723
|
+
}
|
|
3724
|
+
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
3725
|
+
this.regexp = null;
|
|
3726
|
+
this.negate = false;
|
|
3727
|
+
this.nonegate = !!options.nonegate;
|
|
3728
|
+
this.comment = false;
|
|
3729
|
+
this.empty = false;
|
|
3730
|
+
this.partial = !!options.partial;
|
|
3731
|
+
this.nocase = !!this.options.nocase;
|
|
3732
|
+
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
3733
|
+
this.globSet = [];
|
|
3734
|
+
this.globParts = [];
|
|
3735
|
+
this.set = [];
|
|
3736
|
+
this.make();
|
|
3737
|
+
}
|
|
3738
|
+
hasMagic() {
|
|
3739
|
+
if (this.options.magicalBraces && this.set.length > 1) {
|
|
3740
|
+
return true;
|
|
3741
|
+
}
|
|
3742
|
+
for (const pattern of this.set) {
|
|
3743
|
+
for (const part of pattern) {
|
|
3744
|
+
if (typeof part !== "string")
|
|
3745
|
+
return true;
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
return false;
|
|
3749
|
+
}
|
|
3750
|
+
debug(..._) {
|
|
3751
|
+
}
|
|
3752
|
+
make() {
|
|
3753
|
+
const pattern = this.pattern;
|
|
3754
|
+
const options = this.options;
|
|
3755
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
3756
|
+
this.comment = true;
|
|
3757
|
+
return;
|
|
3758
|
+
}
|
|
3759
|
+
if (!pattern) {
|
|
3760
|
+
this.empty = true;
|
|
3761
|
+
return;
|
|
3762
|
+
}
|
|
3763
|
+
this.parseNegate();
|
|
3764
|
+
this.globSet = [...new Set(this.braceExpand())];
|
|
3765
|
+
if (options.debug) {
|
|
3766
|
+
this.debug = (...args) => console.error(...args);
|
|
3767
|
+
}
|
|
3768
|
+
this.debug(this.pattern, this.globSet);
|
|
3769
|
+
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
3770
|
+
this.globParts = this.preprocess(rawGlobParts);
|
|
3771
|
+
this.debug(this.pattern, this.globParts);
|
|
3772
|
+
let set = this.globParts.map((s, _, __) => {
|
|
3773
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
3774
|
+
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
3775
|
+
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
3776
|
+
if (isUNC) {
|
|
3777
|
+
return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
3778
|
+
} else if (isDrive) {
|
|
3779
|
+
return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
return s.map((ss) => this.parse(ss));
|
|
3783
|
+
});
|
|
3784
|
+
this.debug(this.pattern, set);
|
|
3785
|
+
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
3786
|
+
if (this.isWindows) {
|
|
3787
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
3788
|
+
const p = this.set[i];
|
|
3789
|
+
if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
|
|
3790
|
+
p[2] = "?";
|
|
3791
|
+
}
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
this.debug(this.pattern, this.set);
|
|
3795
|
+
}
|
|
3796
|
+
// various transforms to equivalent pattern sets that are
|
|
3797
|
+
// faster to process in a filesystem walk. The goal is to
|
|
3798
|
+
// eliminate what we can, and push all ** patterns as far
|
|
3799
|
+
// to the right as possible, even if it increases the number
|
|
3800
|
+
// of patterns that we have to process.
|
|
3801
|
+
preprocess(globParts) {
|
|
3802
|
+
if (this.options.noglobstar) {
|
|
3803
|
+
for (let i = 0; i < globParts.length; i++) {
|
|
3804
|
+
for (let j = 0; j < globParts[i].length; j++) {
|
|
3805
|
+
if (globParts[i][j] === "**") {
|
|
3806
|
+
globParts[i][j] = "*";
|
|
3807
|
+
}
|
|
3808
|
+
}
|
|
3809
|
+
}
|
|
3810
|
+
}
|
|
3811
|
+
const { optimizationLevel = 1 } = this.options;
|
|
3812
|
+
if (optimizationLevel >= 2) {
|
|
3813
|
+
globParts = this.firstPhasePreProcess(globParts);
|
|
3814
|
+
globParts = this.secondPhasePreProcess(globParts);
|
|
3815
|
+
} else if (optimizationLevel >= 1) {
|
|
3816
|
+
globParts = this.levelOneOptimize(globParts);
|
|
3817
|
+
} else {
|
|
3818
|
+
globParts = this.adjascentGlobstarOptimize(globParts);
|
|
3819
|
+
}
|
|
3820
|
+
return globParts;
|
|
3821
|
+
}
|
|
3822
|
+
// just get rid of adjascent ** portions
|
|
3823
|
+
adjascentGlobstarOptimize(globParts) {
|
|
3824
|
+
return globParts.map((parts) => {
|
|
3825
|
+
let gs = -1;
|
|
3826
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
3827
|
+
let i = gs;
|
|
3828
|
+
while (parts[i + 1] === "**") {
|
|
3829
|
+
i++;
|
|
3830
|
+
}
|
|
3831
|
+
if (i !== gs) {
|
|
3832
|
+
parts.splice(gs, i - gs);
|
|
3833
|
+
}
|
|
3834
|
+
}
|
|
3835
|
+
return parts;
|
|
3836
|
+
});
|
|
3837
|
+
}
|
|
3838
|
+
// get rid of adjascent ** and resolve .. portions
|
|
3839
|
+
levelOneOptimize(globParts) {
|
|
3840
|
+
return globParts.map((parts) => {
|
|
3841
|
+
parts = parts.reduce((set, part) => {
|
|
3842
|
+
const prev = set[set.length - 1];
|
|
3843
|
+
if (part === "**" && prev === "**") {
|
|
3844
|
+
return set;
|
|
3845
|
+
}
|
|
3846
|
+
if (part === "..") {
|
|
3847
|
+
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
3848
|
+
set.pop();
|
|
3849
|
+
return set;
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
set.push(part);
|
|
3853
|
+
return set;
|
|
3854
|
+
}, []);
|
|
3855
|
+
return parts.length === 0 ? [""] : parts;
|
|
3856
|
+
});
|
|
3857
|
+
}
|
|
3858
|
+
levelTwoFileOptimize(parts) {
|
|
3859
|
+
if (!Array.isArray(parts)) {
|
|
3860
|
+
parts = this.slashSplit(parts);
|
|
3861
|
+
}
|
|
3862
|
+
let didSomething = false;
|
|
3863
|
+
do {
|
|
3864
|
+
didSomething = false;
|
|
3865
|
+
if (!this.preserveMultipleSlashes) {
|
|
3866
|
+
for (let i = 1; i < parts.length - 1; i++) {
|
|
3867
|
+
const p = parts[i];
|
|
3868
|
+
if (i === 1 && p === "" && parts[0] === "")
|
|
3869
|
+
continue;
|
|
3870
|
+
if (p === "." || p === "") {
|
|
3871
|
+
didSomething = true;
|
|
3872
|
+
parts.splice(i, 1);
|
|
3873
|
+
i--;
|
|
3874
|
+
}
|
|
3875
|
+
}
|
|
3876
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
3877
|
+
didSomething = true;
|
|
3878
|
+
parts.pop();
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
let dd = 0;
|
|
3882
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
3883
|
+
const p = parts[dd - 1];
|
|
3884
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
3885
|
+
didSomething = true;
|
|
3886
|
+
parts.splice(dd - 1, 2);
|
|
3887
|
+
dd -= 2;
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
} while (didSomething);
|
|
3891
|
+
return parts.length === 0 ? [""] : parts;
|
|
3892
|
+
}
|
|
3893
|
+
// First phase: single-pattern processing
|
|
3894
|
+
// <pre> is 1 or more portions
|
|
3895
|
+
// <rest> is 1 or more portions
|
|
3896
|
+
// <p> is any portion other than ., .., '', or **
|
|
3897
|
+
// <e> is . or ''
|
|
3898
|
+
//
|
|
3899
|
+
// **/.. is *brutal* for filesystem walking performance, because
|
|
3900
|
+
// it effectively resets the recursive walk each time it occurs,
|
|
3901
|
+
// and ** cannot be reduced out by a .. pattern part like a regexp
|
|
3902
|
+
// or most strings (other than .., ., and '') can be.
|
|
3903
|
+
//
|
|
3904
|
+
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
|
|
3905
|
+
// <pre>/<e>/<rest> -> <pre>/<rest>
|
|
3906
|
+
// <pre>/<p>/../<rest> -> <pre>/<rest>
|
|
3907
|
+
// **/**/<rest> -> **/<rest>
|
|
3908
|
+
//
|
|
3909
|
+
// **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
|
|
3910
|
+
// this WOULD be allowed if ** did follow symlinks, or * didn't
|
|
3911
|
+
firstPhasePreProcess(globParts) {
|
|
3912
|
+
let didSomething = false;
|
|
3913
|
+
do {
|
|
3914
|
+
didSomething = false;
|
|
3915
|
+
for (let parts of globParts) {
|
|
3916
|
+
let gs = -1;
|
|
3917
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
3918
|
+
let gss = gs;
|
|
3919
|
+
while (parts[gss + 1] === "**") {
|
|
3920
|
+
gss++;
|
|
3921
|
+
}
|
|
3922
|
+
if (gss > gs) {
|
|
3923
|
+
parts.splice(gs + 1, gss - gs);
|
|
3924
|
+
}
|
|
3925
|
+
let next = parts[gs + 1];
|
|
3926
|
+
const p = parts[gs + 2];
|
|
3927
|
+
const p2 = parts[gs + 3];
|
|
3928
|
+
if (next !== "..")
|
|
3929
|
+
continue;
|
|
3930
|
+
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
|
|
3931
|
+
continue;
|
|
3932
|
+
}
|
|
3933
|
+
didSomething = true;
|
|
3934
|
+
parts.splice(gs, 1);
|
|
3935
|
+
const other = parts.slice(0);
|
|
3936
|
+
other[gs] = "**";
|
|
3937
|
+
globParts.push(other);
|
|
3938
|
+
gs--;
|
|
3939
|
+
}
|
|
3940
|
+
if (!this.preserveMultipleSlashes) {
|
|
3941
|
+
for (let i = 1; i < parts.length - 1; i++) {
|
|
3942
|
+
const p = parts[i];
|
|
3943
|
+
if (i === 1 && p === "" && parts[0] === "")
|
|
3944
|
+
continue;
|
|
3945
|
+
if (p === "." || p === "") {
|
|
3946
|
+
didSomething = true;
|
|
3947
|
+
parts.splice(i, 1);
|
|
3948
|
+
i--;
|
|
3949
|
+
}
|
|
3950
|
+
}
|
|
3951
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
3952
|
+
didSomething = true;
|
|
3953
|
+
parts.pop();
|
|
3954
|
+
}
|
|
3955
|
+
}
|
|
3956
|
+
let dd = 0;
|
|
3957
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
3958
|
+
const p = parts[dd - 1];
|
|
3959
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
3960
|
+
didSomething = true;
|
|
3961
|
+
const needDot = dd === 1 && parts[dd + 1] === "**";
|
|
3962
|
+
const splin = needDot ? ["."] : [];
|
|
3963
|
+
parts.splice(dd - 1, 2, ...splin);
|
|
3964
|
+
if (parts.length === 0)
|
|
3965
|
+
parts.push("");
|
|
3966
|
+
dd -= 2;
|
|
3967
|
+
}
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3970
|
+
} while (didSomething);
|
|
3971
|
+
return globParts;
|
|
3972
|
+
}
|
|
3973
|
+
// second phase: multi-pattern dedupes
|
|
3974
|
+
// {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
|
|
3975
|
+
// {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
|
|
3976
|
+
// {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
|
|
3977
|
+
//
|
|
3978
|
+
// {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
|
|
3979
|
+
// ^-- not valid because ** doens't follow symlinks
|
|
3980
|
+
secondPhasePreProcess(globParts) {
|
|
3981
|
+
for (let i = 0; i < globParts.length - 1; i++) {
|
|
3982
|
+
for (let j = i + 1; j < globParts.length; j++) {
|
|
3983
|
+
const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
|
|
3984
|
+
if (!matched)
|
|
3985
|
+
continue;
|
|
3986
|
+
globParts[i] = matched;
|
|
3987
|
+
globParts[j] = [];
|
|
3988
|
+
}
|
|
3989
|
+
}
|
|
3990
|
+
return globParts.filter((gs) => gs.length);
|
|
3991
|
+
}
|
|
3992
|
+
partsMatch(a, b, emptyGSMatch = false) {
|
|
3993
|
+
let ai = 0;
|
|
3994
|
+
let bi = 0;
|
|
3995
|
+
let result = [];
|
|
3996
|
+
let which = "";
|
|
3997
|
+
while (ai < a.length && bi < b.length) {
|
|
3998
|
+
if (a[ai] === b[bi]) {
|
|
3999
|
+
result.push(which === "b" ? b[bi] : a[ai]);
|
|
4000
|
+
ai++;
|
|
4001
|
+
bi++;
|
|
4002
|
+
} else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
|
|
4003
|
+
result.push(a[ai]);
|
|
4004
|
+
ai++;
|
|
4005
|
+
} else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
|
|
4006
|
+
result.push(b[bi]);
|
|
4007
|
+
bi++;
|
|
4008
|
+
} else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
|
|
4009
|
+
if (which === "b")
|
|
4010
|
+
return false;
|
|
4011
|
+
which = "a";
|
|
4012
|
+
result.push(a[ai]);
|
|
4013
|
+
ai++;
|
|
4014
|
+
bi++;
|
|
4015
|
+
} else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
|
|
4016
|
+
if (which === "a")
|
|
4017
|
+
return false;
|
|
4018
|
+
which = "b";
|
|
4019
|
+
result.push(b[bi]);
|
|
4020
|
+
ai++;
|
|
4021
|
+
bi++;
|
|
4022
|
+
} else {
|
|
4023
|
+
return false;
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
return a.length === b.length && result;
|
|
4027
|
+
}
|
|
4028
|
+
parseNegate() {
|
|
4029
|
+
if (this.nonegate)
|
|
4030
|
+
return;
|
|
4031
|
+
const pattern = this.pattern;
|
|
4032
|
+
let negate = false;
|
|
4033
|
+
let negateOffset = 0;
|
|
4034
|
+
for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
|
|
4035
|
+
negate = !negate;
|
|
4036
|
+
negateOffset++;
|
|
4037
|
+
}
|
|
4038
|
+
if (negateOffset)
|
|
4039
|
+
this.pattern = pattern.slice(negateOffset);
|
|
4040
|
+
this.negate = negate;
|
|
4041
|
+
}
|
|
4042
|
+
// set partial to true to test if, for example,
|
|
4043
|
+
// "/a/b" matches the start of "/*/b/*/d"
|
|
4044
|
+
// Partial means, if you run out of file before you run
|
|
4045
|
+
// out of pattern, then that's fine, as long as all
|
|
4046
|
+
// the parts match.
|
|
4047
|
+
matchOne(file, pattern, partial = false) {
|
|
4048
|
+
const options = this.options;
|
|
4049
|
+
if (this.isWindows) {
|
|
4050
|
+
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
4051
|
+
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
4052
|
+
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
4053
|
+
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
4054
|
+
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
4055
|
+
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
4056
|
+
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
4057
|
+
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
4058
|
+
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
4059
|
+
pattern[pdi] = fd;
|
|
4060
|
+
if (pdi > fdi) {
|
|
4061
|
+
pattern = pattern.slice(pdi);
|
|
4062
|
+
} else if (fdi > pdi) {
|
|
4063
|
+
file = file.slice(fdi);
|
|
4064
|
+
}
|
|
4065
|
+
}
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4068
|
+
const { optimizationLevel = 1 } = this.options;
|
|
4069
|
+
if (optimizationLevel >= 2) {
|
|
4070
|
+
file = this.levelTwoFileOptimize(file);
|
|
4071
|
+
}
|
|
4072
|
+
this.debug("matchOne", this, { file, pattern });
|
|
4073
|
+
this.debug("matchOne", file.length, pattern.length);
|
|
4074
|
+
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
4075
|
+
this.debug("matchOne loop");
|
|
4076
|
+
var p = pattern[pi];
|
|
4077
|
+
var f = file[fi];
|
|
4078
|
+
this.debug(pattern, p, f);
|
|
4079
|
+
if (p === false) {
|
|
4080
|
+
return false;
|
|
4081
|
+
}
|
|
4082
|
+
if (p === GLOBSTAR) {
|
|
4083
|
+
this.debug("GLOBSTAR", [pattern, p, f]);
|
|
4084
|
+
var fr = fi;
|
|
4085
|
+
var pr = pi + 1;
|
|
4086
|
+
if (pr === pl) {
|
|
4087
|
+
this.debug("** at the end");
|
|
4088
|
+
for (; fi < fl; fi++) {
|
|
4089
|
+
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
|
4090
|
+
return false;
|
|
4091
|
+
}
|
|
4092
|
+
return true;
|
|
4093
|
+
}
|
|
4094
|
+
while (fr < fl) {
|
|
4095
|
+
var swallowee = file[fr];
|
|
4096
|
+
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
4097
|
+
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
4098
|
+
this.debug("globstar found match!", fr, fl, swallowee);
|
|
4099
|
+
return true;
|
|
4100
|
+
} else {
|
|
4101
|
+
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
4102
|
+
this.debug("dot detected!", file, fr, pattern, pr);
|
|
4103
|
+
break;
|
|
4104
|
+
}
|
|
4105
|
+
this.debug("globstar swallow a segment, and continue");
|
|
4106
|
+
fr++;
|
|
4107
|
+
}
|
|
4108
|
+
}
|
|
4109
|
+
if (partial) {
|
|
4110
|
+
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
4111
|
+
if (fr === fl) {
|
|
4112
|
+
return true;
|
|
4113
|
+
}
|
|
4114
|
+
}
|
|
4115
|
+
return false;
|
|
4116
|
+
}
|
|
4117
|
+
let hit;
|
|
4118
|
+
if (typeof p === "string") {
|
|
4119
|
+
hit = f === p;
|
|
4120
|
+
this.debug("string match", p, f, hit);
|
|
4121
|
+
} else {
|
|
4122
|
+
hit = p.test(f);
|
|
4123
|
+
this.debug("pattern match", p, f, hit);
|
|
4124
|
+
}
|
|
4125
|
+
if (!hit)
|
|
4126
|
+
return false;
|
|
4127
|
+
}
|
|
4128
|
+
if (fi === fl && pi === pl) {
|
|
4129
|
+
return true;
|
|
4130
|
+
} else if (fi === fl) {
|
|
4131
|
+
return partial;
|
|
4132
|
+
} else if (pi === pl) {
|
|
4133
|
+
return fi === fl - 1 && file[fi] === "";
|
|
4134
|
+
} else {
|
|
4135
|
+
throw new Error("wtf?");
|
|
4136
|
+
}
|
|
4137
|
+
}
|
|
4138
|
+
braceExpand() {
|
|
4139
|
+
return braceExpand(this.pattern, this.options);
|
|
4140
|
+
}
|
|
4141
|
+
parse(pattern) {
|
|
4142
|
+
assertValidPattern(pattern);
|
|
4143
|
+
const options = this.options;
|
|
4144
|
+
if (pattern === "**")
|
|
4145
|
+
return GLOBSTAR;
|
|
4146
|
+
if (pattern === "")
|
|
4147
|
+
return "";
|
|
4148
|
+
let m;
|
|
4149
|
+
let fastTest = null;
|
|
4150
|
+
if (m = pattern.match(starRE)) {
|
|
4151
|
+
fastTest = options.dot ? starTestDot : starTest;
|
|
4152
|
+
} else if (m = pattern.match(starDotExtRE)) {
|
|
4153
|
+
fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
4154
|
+
} else if (m = pattern.match(qmarksRE)) {
|
|
4155
|
+
fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
4156
|
+
} else if (m = pattern.match(starDotStarRE)) {
|
|
4157
|
+
fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
4158
|
+
} else if (m = pattern.match(dotStarRE)) {
|
|
4159
|
+
fastTest = dotStarTest;
|
|
4160
|
+
}
|
|
4161
|
+
const re = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
4162
|
+
if (fastTest && typeof re === "object") {
|
|
4163
|
+
Reflect.defineProperty(re, "test", { value: fastTest });
|
|
4164
|
+
}
|
|
4165
|
+
return re;
|
|
4166
|
+
}
|
|
4167
|
+
makeRe() {
|
|
4168
|
+
if (this.regexp || this.regexp === false)
|
|
4169
|
+
return this.regexp;
|
|
4170
|
+
const set = this.set;
|
|
4171
|
+
if (!set.length) {
|
|
4172
|
+
this.regexp = false;
|
|
4173
|
+
return this.regexp;
|
|
4174
|
+
}
|
|
4175
|
+
const options = this.options;
|
|
4176
|
+
const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
|
|
4177
|
+
const flags = new Set(options.nocase ? ["i"] : []);
|
|
4178
|
+
let re = set.map((pattern) => {
|
|
4179
|
+
const pp = pattern.map((p) => {
|
|
4180
|
+
if (p instanceof RegExp) {
|
|
4181
|
+
for (const f of p.flags.split(""))
|
|
4182
|
+
flags.add(f);
|
|
4183
|
+
}
|
|
4184
|
+
return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
|
|
4185
|
+
});
|
|
4186
|
+
pp.forEach((p, i) => {
|
|
4187
|
+
const next = pp[i + 1];
|
|
4188
|
+
const prev = pp[i - 1];
|
|
4189
|
+
if (p !== GLOBSTAR || prev === GLOBSTAR) {
|
|
4190
|
+
return;
|
|
4191
|
+
}
|
|
4192
|
+
if (prev === void 0) {
|
|
4193
|
+
if (next !== void 0 && next !== GLOBSTAR) {
|
|
4194
|
+
pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
4195
|
+
} else {
|
|
4196
|
+
pp[i] = twoStar;
|
|
4197
|
+
}
|
|
4198
|
+
} else if (next === void 0) {
|
|
4199
|
+
pp[i - 1] = prev + "(?:\\/|" + twoStar + ")?";
|
|
4200
|
+
} else if (next !== GLOBSTAR) {
|
|
4201
|
+
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
4202
|
+
pp[i + 1] = GLOBSTAR;
|
|
4203
|
+
}
|
|
4204
|
+
});
|
|
4205
|
+
return pp.filter((p) => p !== GLOBSTAR).join("/");
|
|
4206
|
+
}).join("|");
|
|
4207
|
+
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
4208
|
+
re = "^" + open + re + close + "$";
|
|
4209
|
+
if (this.negate)
|
|
4210
|
+
re = "^(?!" + re + ").+$";
|
|
4211
|
+
try {
|
|
4212
|
+
this.regexp = new RegExp(re, [...flags].join(""));
|
|
4213
|
+
} catch (ex) {
|
|
4214
|
+
this.regexp = false;
|
|
4215
|
+
}
|
|
4216
|
+
return this.regexp;
|
|
4217
|
+
}
|
|
4218
|
+
slashSplit(p) {
|
|
4219
|
+
if (this.preserveMultipleSlashes) {
|
|
4220
|
+
return p.split("/");
|
|
4221
|
+
} else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
|
|
4222
|
+
return ["", ...p.split(/\/+/)];
|
|
4223
|
+
} else {
|
|
4224
|
+
return p.split(/\/+/);
|
|
4225
|
+
}
|
|
4226
|
+
}
|
|
4227
|
+
match(f, partial = this.partial) {
|
|
4228
|
+
this.debug("match", f, this.pattern);
|
|
4229
|
+
if (this.comment) {
|
|
4230
|
+
return false;
|
|
4231
|
+
}
|
|
4232
|
+
if (this.empty) {
|
|
4233
|
+
return f === "";
|
|
4234
|
+
}
|
|
4235
|
+
if (f === "/" && partial) {
|
|
4236
|
+
return true;
|
|
4237
|
+
}
|
|
4238
|
+
const options = this.options;
|
|
4239
|
+
if (this.isWindows) {
|
|
4240
|
+
f = f.split("\\").join("/");
|
|
4241
|
+
}
|
|
4242
|
+
const ff = this.slashSplit(f);
|
|
4243
|
+
this.debug(this.pattern, "split", ff);
|
|
4244
|
+
const set = this.set;
|
|
4245
|
+
this.debug(this.pattern, "set", set);
|
|
4246
|
+
let filename = ff[ff.length - 1];
|
|
4247
|
+
if (!filename) {
|
|
4248
|
+
for (let i = ff.length - 2; !filename && i >= 0; i--) {
|
|
4249
|
+
filename = ff[i];
|
|
4250
|
+
}
|
|
4251
|
+
}
|
|
4252
|
+
for (let i = 0; i < set.length; i++) {
|
|
4253
|
+
const pattern = set[i];
|
|
4254
|
+
let file = ff;
|
|
4255
|
+
if (options.matchBase && pattern.length === 1) {
|
|
4256
|
+
file = [filename];
|
|
4257
|
+
}
|
|
4258
|
+
const hit = this.matchOne(file, pattern, partial);
|
|
4259
|
+
if (hit) {
|
|
4260
|
+
if (options.flipNegate) {
|
|
4261
|
+
return true;
|
|
4262
|
+
}
|
|
4263
|
+
return !this.negate;
|
|
4264
|
+
}
|
|
4265
|
+
}
|
|
4266
|
+
if (options.flipNegate) {
|
|
4267
|
+
return false;
|
|
4268
|
+
}
|
|
4269
|
+
return this.negate;
|
|
4270
|
+
}
|
|
4271
|
+
static defaults(def) {
|
|
4272
|
+
return minimatch.defaults(def).Minimatch;
|
|
4273
|
+
}
|
|
4274
|
+
};
|
|
4275
|
+
minimatch.AST = AST;
|
|
4276
|
+
minimatch.Minimatch = Minimatch;
|
|
4277
|
+
minimatch.escape = escape;
|
|
4278
|
+
minimatch.unescape = unescape;
|
|
4279
|
+
|
|
2709
4280
|
// src/utils/output-target.ts
|
|
2710
4281
|
var isOutputTargetHydrate = (o) => o.type === DIST_HYDRATE_SCRIPT;
|
|
2711
4282
|
var isOutputTargetDocs = (o) => o.type === DOCS_README || o.type === DOCS_JSON || o.type === DOCS_CUSTOM || o.type === DOCS_VSCODE;
|
|
@@ -2836,6 +4407,7 @@ var BUILD = {
|
|
|
2836
4407
|
constructableCSS: true,
|
|
2837
4408
|
devTools: false,
|
|
2838
4409
|
shadowDelegatesFocus: true,
|
|
4410
|
+
shadowSlotAssignmentManual: false,
|
|
2839
4411
|
initializeNextTick: false,
|
|
2840
4412
|
asyncLoading: true,
|
|
2841
4413
|
asyncQueue: false,
|
|
@@ -2867,6 +4439,9 @@ var H = win.HTMLElement || class {
|
|
|
2867
4439
|
var supportsShadow = BUILD.shadowDom;
|
|
2868
4440
|
var supportsConstructableStylesheets = BUILD.constructableCSS ? /* @__PURE__ */ (() => {
|
|
2869
4441
|
try {
|
|
4442
|
+
if (!win.document.adoptedStyleSheets) {
|
|
4443
|
+
return false;
|
|
4444
|
+
}
|
|
2870
4445
|
new CSSStyleSheet();
|
|
2871
4446
|
return typeof new CSSStyleSheet().replaceSync === "function";
|
|
2872
4447
|
} catch (e) {
|
|
@@ -3401,8 +4976,8 @@ function uuidv4() {
|
|
|
3401
4976
|
return v.toString(16);
|
|
3402
4977
|
});
|
|
3403
4978
|
}
|
|
3404
|
-
async function readJson(sys,
|
|
3405
|
-
const file = await sys.readFile(
|
|
4979
|
+
async function readJson(sys, path2) {
|
|
4980
|
+
const file = await sys.readFile(path2);
|
|
3406
4981
|
return !!file && JSON.parse(file);
|
|
3407
4982
|
}
|
|
3408
4983
|
function hasDebug(flags) {
|
|
@@ -3857,16 +5432,16 @@ var getBoilerplateAndWriteFile = async (config, componentName, withCss, file, st
|
|
|
3857
5432
|
var checkForOverwrite = async (files, config) => {
|
|
3858
5433
|
const alreadyPresent = [];
|
|
3859
5434
|
await Promise.all(
|
|
3860
|
-
files.map(async ({ path }) => {
|
|
3861
|
-
if (await config.sys.readFile(
|
|
3862
|
-
alreadyPresent.push(
|
|
5435
|
+
files.map(async ({ path: path2 }) => {
|
|
5436
|
+
if (await config.sys.readFile(path2) !== void 0) {
|
|
5437
|
+
alreadyPresent.push(path2);
|
|
3863
5438
|
}
|
|
3864
5439
|
})
|
|
3865
5440
|
);
|
|
3866
5441
|
if (alreadyPresent.length > 0) {
|
|
3867
5442
|
config.logger.error(
|
|
3868
5443
|
"Generating code would overwrite the following files:",
|
|
3869
|
-
...alreadyPresent.map((
|
|
5444
|
+
...alreadyPresent.map((path2) => " " + normalizePath(path2))
|
|
3870
5445
|
);
|
|
3871
5446
|
await config.sys.exit(1);
|
|
3872
5447
|
}
|
|
@@ -3913,7 +5488,7 @@ export class ${toPascalCase(tagName)} {
|
|
|
3913
5488
|
}
|
|
3914
5489
|
`;
|
|
3915
5490
|
};
|
|
3916
|
-
var getStyleUrlBoilerplate = (
|
|
5491
|
+
var getStyleUrlBoilerplate = (ext2) => ext2 === "sass" ? `:host
|
|
3917
5492
|
display: block
|
|
3918
5493
|
` : `:host {
|
|
3919
5494
|
display: block;
|