@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/screenshot/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Screenshot v4.
|
|
2
|
+
Stencil Screenshot 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,13 @@ 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;
|
|
15
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
16
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
|
+
};
|
|
11
18
|
var __export = (target, all) => {
|
|
12
19
|
for (var name in all)
|
|
13
20
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -29,6 +36,220 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
36
|
mod
|
|
30
37
|
));
|
|
31
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
|
+
});
|
|
32
253
|
|
|
33
254
|
// src/screenshot/index.ts
|
|
34
255
|
var index_exports = {};
|
|
@@ -428,12 +649,12 @@ var ScreenshotConnector = class {
|
|
|
428
649
|
};
|
|
429
650
|
|
|
430
651
|
// src/utils/path.ts
|
|
431
|
-
var normalizePath = (
|
|
432
|
-
if (typeof
|
|
652
|
+
var normalizePath = (path3, relativize = true) => {
|
|
653
|
+
if (typeof path3 !== "string") {
|
|
433
654
|
throw new Error(`invalid path to normalize`);
|
|
434
655
|
}
|
|
435
|
-
|
|
436
|
-
const components = pathComponents(
|
|
656
|
+
path3 = normalizeSlashes(path3.trim());
|
|
657
|
+
const components = pathComponents(path3, getRootLength(path3));
|
|
437
658
|
const reducedComponents = reducePathComponents(components);
|
|
438
659
|
const rootPart = reducedComponents[0];
|
|
439
660
|
const secondPart = reducedComponents[1];
|
|
@@ -441,12 +662,12 @@ var normalizePath = (path2, relativize = true) => {
|
|
|
441
662
|
if (normalized === "") {
|
|
442
663
|
return ".";
|
|
443
664
|
}
|
|
444
|
-
if (rootPart === "" && secondPart &&
|
|
665
|
+
if (rootPart === "" && secondPart && path3.includes("/") && !secondPart.startsWith(".") && !secondPart.startsWith("@") && relativize) {
|
|
445
666
|
return "./" + normalized;
|
|
446
667
|
}
|
|
447
668
|
return normalized;
|
|
448
669
|
};
|
|
449
|
-
var normalizeSlashes = (
|
|
670
|
+
var normalizeSlashes = (path3) => path3.replace(backslashRegExp, "/");
|
|
450
671
|
var altDirectorySeparator = "\\";
|
|
451
672
|
var urlSchemeSeparator = "://";
|
|
452
673
|
var backslashRegExp = /\\/g;
|
|
@@ -471,45 +692,45 @@ var reducePathComponents = (components) => {
|
|
|
471
692
|
}
|
|
472
693
|
return reduced;
|
|
473
694
|
};
|
|
474
|
-
var getRootLength = (
|
|
475
|
-
const rootLength = getEncodedRootLength(
|
|
695
|
+
var getRootLength = (path3) => {
|
|
696
|
+
const rootLength = getEncodedRootLength(path3);
|
|
476
697
|
return rootLength < 0 ? ~rootLength : rootLength;
|
|
477
698
|
};
|
|
478
|
-
var getEncodedRootLength = (
|
|
479
|
-
if (!
|
|
480
|
-
const ch0 =
|
|
699
|
+
var getEncodedRootLength = (path3) => {
|
|
700
|
+
if (!path3) return 0;
|
|
701
|
+
const ch0 = path3.charCodeAt(0);
|
|
481
702
|
if (ch0 === 47 /* slash */ || ch0 === 92 /* backslash */) {
|
|
482
|
-
if (
|
|
483
|
-
const p1 =
|
|
484
|
-
if (p1 < 0) return
|
|
703
|
+
if (path3.charCodeAt(1) !== ch0) return 1;
|
|
704
|
+
const p1 = path3.indexOf(ch0 === 47 /* slash */ ? "/" : altDirectorySeparator, 2);
|
|
705
|
+
if (p1 < 0) return path3.length;
|
|
485
706
|
return p1 + 1;
|
|
486
707
|
}
|
|
487
|
-
if (isVolumeCharacter(ch0) &&
|
|
488
|
-
const ch2 =
|
|
708
|
+
if (isVolumeCharacter(ch0) && path3.charCodeAt(1) === 58 /* colon */) {
|
|
709
|
+
const ch2 = path3.charCodeAt(2);
|
|
489
710
|
if (ch2 === 47 /* slash */ || ch2 === 92 /* backslash */) return 3;
|
|
490
|
-
if (
|
|
711
|
+
if (path3.length === 2) return 2;
|
|
491
712
|
}
|
|
492
|
-
const schemeEnd =
|
|
713
|
+
const schemeEnd = path3.indexOf(urlSchemeSeparator);
|
|
493
714
|
if (schemeEnd !== -1) {
|
|
494
715
|
const authorityStart = schemeEnd + urlSchemeSeparator.length;
|
|
495
|
-
const authorityEnd =
|
|
716
|
+
const authorityEnd = path3.indexOf("/", authorityStart);
|
|
496
717
|
if (authorityEnd !== -1) {
|
|
497
|
-
const scheme =
|
|
498
|
-
const authority =
|
|
499
|
-
if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(
|
|
500
|
-
const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(
|
|
718
|
+
const scheme = path3.slice(0, schemeEnd);
|
|
719
|
+
const authority = path3.slice(authorityStart, authorityEnd);
|
|
720
|
+
if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(path3.charCodeAt(authorityEnd + 1))) {
|
|
721
|
+
const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path3, authorityEnd + 2);
|
|
501
722
|
if (volumeSeparatorEnd !== -1) {
|
|
502
|
-
if (
|
|
723
|
+
if (path3.charCodeAt(volumeSeparatorEnd) === 47 /* slash */) {
|
|
503
724
|
return ~(volumeSeparatorEnd + 1);
|
|
504
725
|
}
|
|
505
|
-
if (volumeSeparatorEnd ===
|
|
726
|
+
if (volumeSeparatorEnd === path3.length) {
|
|
506
727
|
return ~volumeSeparatorEnd;
|
|
507
728
|
}
|
|
508
729
|
}
|
|
509
730
|
}
|
|
510
731
|
return ~(authorityEnd + 1);
|
|
511
732
|
}
|
|
512
|
-
return ~
|
|
733
|
+
return ~path3.length;
|
|
513
734
|
}
|
|
514
735
|
return 0;
|
|
515
736
|
};
|
|
@@ -523,9 +744,9 @@ var getFileUrlVolumeSeparatorEnd = (url, start) => {
|
|
|
523
744
|
}
|
|
524
745
|
return -1;
|
|
525
746
|
};
|
|
526
|
-
var pathComponents = (
|
|
527
|
-
const root =
|
|
528
|
-
const rest =
|
|
747
|
+
var pathComponents = (path3, rootLength) => {
|
|
748
|
+
const root = path3.substring(0, rootLength);
|
|
749
|
+
const rest = path3.substring(rootLength).split("/");
|
|
529
750
|
const restLen = rest.length;
|
|
530
751
|
if (restLen > 0 && !rest[restLen - 1]) {
|
|
531
752
|
rest.pop();
|
|
@@ -533,6 +754,1359 @@ var pathComponents = (path2, rootLength) => {
|
|
|
533
754
|
return [root, ...rest];
|
|
534
755
|
};
|
|
535
756
|
|
|
757
|
+
// node_modules/minimatch/dist/esm/index.js
|
|
758
|
+
var import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
759
|
+
|
|
760
|
+
// node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
761
|
+
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
762
|
+
var assertValidPattern = (pattern) => {
|
|
763
|
+
if (typeof pattern !== "string") {
|
|
764
|
+
throw new TypeError("invalid pattern");
|
|
765
|
+
}
|
|
766
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
767
|
+
throw new TypeError("pattern is too long");
|
|
768
|
+
}
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
// node_modules/minimatch/dist/esm/brace-expressions.js
|
|
772
|
+
var posixClasses = {
|
|
773
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
774
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
775
|
+
"[:ascii:]": ["\\x00-\\x7f", false],
|
|
776
|
+
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
777
|
+
"[:cntrl:]": ["\\p{Cc}", true],
|
|
778
|
+
"[:digit:]": ["\\p{Nd}", true],
|
|
779
|
+
"[:graph:]": ["\\p{Z}\\p{C}", true, true],
|
|
780
|
+
"[:lower:]": ["\\p{Ll}", true],
|
|
781
|
+
"[:print:]": ["\\p{C}", true],
|
|
782
|
+
"[:punct:]": ["\\p{P}", true],
|
|
783
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
784
|
+
"[:upper:]": ["\\p{Lu}", true],
|
|
785
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
786
|
+
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
787
|
+
};
|
|
788
|
+
var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
789
|
+
var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
790
|
+
var rangesToString = (ranges) => ranges.join("");
|
|
791
|
+
var parseClass = (glob, position) => {
|
|
792
|
+
const pos = position;
|
|
793
|
+
if (glob.charAt(pos) !== "[") {
|
|
794
|
+
throw new Error("not in a brace expression");
|
|
795
|
+
}
|
|
796
|
+
const ranges = [];
|
|
797
|
+
const negs = [];
|
|
798
|
+
let i = pos + 1;
|
|
799
|
+
let sawStart = false;
|
|
800
|
+
let uflag = false;
|
|
801
|
+
let escaping = false;
|
|
802
|
+
let negate = false;
|
|
803
|
+
let endPos = pos;
|
|
804
|
+
let rangeStart = "";
|
|
805
|
+
WHILE: while (i < glob.length) {
|
|
806
|
+
const c = glob.charAt(i);
|
|
807
|
+
if ((c === "!" || c === "^") && i === pos + 1) {
|
|
808
|
+
negate = true;
|
|
809
|
+
i++;
|
|
810
|
+
continue;
|
|
811
|
+
}
|
|
812
|
+
if (c === "]" && sawStart && !escaping) {
|
|
813
|
+
endPos = i + 1;
|
|
814
|
+
break;
|
|
815
|
+
}
|
|
816
|
+
sawStart = true;
|
|
817
|
+
if (c === "\\") {
|
|
818
|
+
if (!escaping) {
|
|
819
|
+
escaping = true;
|
|
820
|
+
i++;
|
|
821
|
+
continue;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
if (c === "[" && !escaping) {
|
|
825
|
+
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
826
|
+
if (glob.startsWith(cls, i)) {
|
|
827
|
+
if (rangeStart) {
|
|
828
|
+
return ["$.", false, glob.length - pos, true];
|
|
829
|
+
}
|
|
830
|
+
i += cls.length;
|
|
831
|
+
if (neg)
|
|
832
|
+
negs.push(unip);
|
|
833
|
+
else
|
|
834
|
+
ranges.push(unip);
|
|
835
|
+
uflag = uflag || u;
|
|
836
|
+
continue WHILE;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
escaping = false;
|
|
841
|
+
if (rangeStart) {
|
|
842
|
+
if (c > rangeStart) {
|
|
843
|
+
ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
|
|
844
|
+
} else if (c === rangeStart) {
|
|
845
|
+
ranges.push(braceEscape(c));
|
|
846
|
+
}
|
|
847
|
+
rangeStart = "";
|
|
848
|
+
i++;
|
|
849
|
+
continue;
|
|
850
|
+
}
|
|
851
|
+
if (glob.startsWith("-]", i + 1)) {
|
|
852
|
+
ranges.push(braceEscape(c + "-"));
|
|
853
|
+
i += 2;
|
|
854
|
+
continue;
|
|
855
|
+
}
|
|
856
|
+
if (glob.startsWith("-", i + 1)) {
|
|
857
|
+
rangeStart = c;
|
|
858
|
+
i += 2;
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
ranges.push(braceEscape(c));
|
|
862
|
+
i++;
|
|
863
|
+
}
|
|
864
|
+
if (endPos < i) {
|
|
865
|
+
return ["", false, 0, false];
|
|
866
|
+
}
|
|
867
|
+
if (!ranges.length && !negs.length) {
|
|
868
|
+
return ["$.", false, glob.length - pos, true];
|
|
869
|
+
}
|
|
870
|
+
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
|
|
871
|
+
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
872
|
+
return [regexpEscape(r), false, endPos - pos, false];
|
|
873
|
+
}
|
|
874
|
+
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
|
|
875
|
+
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
876
|
+
const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
|
|
877
|
+
return [comb, uflag, endPos - pos, true];
|
|
878
|
+
};
|
|
879
|
+
|
|
880
|
+
// node_modules/minimatch/dist/esm/unescape.js
|
|
881
|
+
var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
882
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
// node_modules/minimatch/dist/esm/ast.js
|
|
886
|
+
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
887
|
+
var isExtglobType = (c) => types.has(c);
|
|
888
|
+
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
889
|
+
var startNoDot = "(?!\\.)";
|
|
890
|
+
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
|
891
|
+
var justDots = /* @__PURE__ */ new Set(["..", "."]);
|
|
892
|
+
var reSpecials = new Set("().*{}+?[]^$\\!");
|
|
893
|
+
var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
894
|
+
var qmark = "[^/]";
|
|
895
|
+
var star = qmark + "*?";
|
|
896
|
+
var starNoEmpty = qmark + "+?";
|
|
897
|
+
var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
|
|
898
|
+
var _AST = class _AST {
|
|
899
|
+
constructor(type, parent, options = {}) {
|
|
900
|
+
__privateAdd(this, _AST_instances);
|
|
901
|
+
__publicField(this, "type");
|
|
902
|
+
__privateAdd(this, _root);
|
|
903
|
+
__privateAdd(this, _hasMagic);
|
|
904
|
+
__privateAdd(this, _uflag, false);
|
|
905
|
+
__privateAdd(this, _parts, []);
|
|
906
|
+
__privateAdd(this, _parent);
|
|
907
|
+
__privateAdd(this, _parentIndex);
|
|
908
|
+
__privateAdd(this, _negs);
|
|
909
|
+
__privateAdd(this, _filledNegs, false);
|
|
910
|
+
__privateAdd(this, _options);
|
|
911
|
+
__privateAdd(this, _toString);
|
|
912
|
+
// set to true if it's an extglob with no children
|
|
913
|
+
// (which really means one child of '')
|
|
914
|
+
__privateAdd(this, _emptyExt, false);
|
|
915
|
+
this.type = type;
|
|
916
|
+
if (type)
|
|
917
|
+
__privateSet(this, _hasMagic, true);
|
|
918
|
+
__privateSet(this, _parent, parent);
|
|
919
|
+
__privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
|
|
920
|
+
__privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
|
|
921
|
+
__privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
|
|
922
|
+
if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
|
|
923
|
+
__privateGet(this, _negs).push(this);
|
|
924
|
+
__privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
|
|
925
|
+
}
|
|
926
|
+
get hasMagic() {
|
|
927
|
+
if (__privateGet(this, _hasMagic) !== void 0)
|
|
928
|
+
return __privateGet(this, _hasMagic);
|
|
929
|
+
for (const p of __privateGet(this, _parts)) {
|
|
930
|
+
if (typeof p === "string")
|
|
931
|
+
continue;
|
|
932
|
+
if (p.type || p.hasMagic)
|
|
933
|
+
return __privateSet(this, _hasMagic, true);
|
|
934
|
+
}
|
|
935
|
+
return __privateGet(this, _hasMagic);
|
|
936
|
+
}
|
|
937
|
+
// reconstructs the pattern
|
|
938
|
+
toString() {
|
|
939
|
+
if (__privateGet(this, _toString) !== void 0)
|
|
940
|
+
return __privateGet(this, _toString);
|
|
941
|
+
if (!this.type) {
|
|
942
|
+
return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
|
|
943
|
+
} else {
|
|
944
|
+
return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
push(...parts) {
|
|
948
|
+
for (const p of parts) {
|
|
949
|
+
if (p === "")
|
|
950
|
+
continue;
|
|
951
|
+
if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
|
|
952
|
+
throw new Error("invalid part: " + p);
|
|
953
|
+
}
|
|
954
|
+
__privateGet(this, _parts).push(p);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
toJSON() {
|
|
958
|
+
var _a;
|
|
959
|
+
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())];
|
|
960
|
+
if (this.isStart() && !this.type)
|
|
961
|
+
ret.unshift([]);
|
|
962
|
+
if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")) {
|
|
963
|
+
ret.push({});
|
|
964
|
+
}
|
|
965
|
+
return ret;
|
|
966
|
+
}
|
|
967
|
+
isStart() {
|
|
968
|
+
var _a;
|
|
969
|
+
if (__privateGet(this, _root) === this)
|
|
970
|
+
return true;
|
|
971
|
+
if (!((_a = __privateGet(this, _parent)) == null ? void 0 : _a.isStart()))
|
|
972
|
+
return false;
|
|
973
|
+
if (__privateGet(this, _parentIndex) === 0)
|
|
974
|
+
return true;
|
|
975
|
+
const p = __privateGet(this, _parent);
|
|
976
|
+
for (let i = 0; i < __privateGet(this, _parentIndex); i++) {
|
|
977
|
+
const pp = __privateGet(p, _parts)[i];
|
|
978
|
+
if (!(pp instanceof _AST && pp.type === "!")) {
|
|
979
|
+
return false;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
return true;
|
|
983
|
+
}
|
|
984
|
+
isEnd() {
|
|
985
|
+
var _a, _b, _c;
|
|
986
|
+
if (__privateGet(this, _root) === this)
|
|
987
|
+
return true;
|
|
988
|
+
if (((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")
|
|
989
|
+
return true;
|
|
990
|
+
if (!((_b = __privateGet(this, _parent)) == null ? void 0 : _b.isEnd()))
|
|
991
|
+
return false;
|
|
992
|
+
if (!this.type)
|
|
993
|
+
return (_c = __privateGet(this, _parent)) == null ? void 0 : _c.isEnd();
|
|
994
|
+
const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
|
|
995
|
+
return __privateGet(this, _parentIndex) === pl - 1;
|
|
996
|
+
}
|
|
997
|
+
copyIn(part) {
|
|
998
|
+
if (typeof part === "string")
|
|
999
|
+
this.push(part);
|
|
1000
|
+
else
|
|
1001
|
+
this.push(part.clone(this));
|
|
1002
|
+
}
|
|
1003
|
+
clone(parent) {
|
|
1004
|
+
const c = new _AST(this.type, parent);
|
|
1005
|
+
for (const p of __privateGet(this, _parts)) {
|
|
1006
|
+
c.copyIn(p);
|
|
1007
|
+
}
|
|
1008
|
+
return c;
|
|
1009
|
+
}
|
|
1010
|
+
static fromGlob(pattern, options = {}) {
|
|
1011
|
+
var _a;
|
|
1012
|
+
const ast = new _AST(null, void 0, options);
|
|
1013
|
+
__privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
|
|
1014
|
+
return ast;
|
|
1015
|
+
}
|
|
1016
|
+
// returns the regular expression if there's magic, or the unescaped
|
|
1017
|
+
// string if not.
|
|
1018
|
+
toMMPattern() {
|
|
1019
|
+
if (this !== __privateGet(this, _root))
|
|
1020
|
+
return __privateGet(this, _root).toMMPattern();
|
|
1021
|
+
const glob = this.toString();
|
|
1022
|
+
const [re, body, hasMagic, uflag] = this.toRegExpSource();
|
|
1023
|
+
const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
1024
|
+
if (!anyMagic) {
|
|
1025
|
+
return body;
|
|
1026
|
+
}
|
|
1027
|
+
const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
|
|
1028
|
+
return Object.assign(new RegExp(`^${re}$`, flags), {
|
|
1029
|
+
_src: re,
|
|
1030
|
+
_glob: glob
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
get options() {
|
|
1034
|
+
return __privateGet(this, _options);
|
|
1035
|
+
}
|
|
1036
|
+
// returns the string match, the regexp source, whether there's magic
|
|
1037
|
+
// in the regexp (so a regular expression is required) and whether or
|
|
1038
|
+
// not the uflag is needed for the regular expression (for posix classes)
|
|
1039
|
+
// TODO: instead of injecting the start/end at this point, just return
|
|
1040
|
+
// the BODY of the regexp, along with the start/end portions suitable
|
|
1041
|
+
// for binding the start/end in either a joined full-path makeRe context
|
|
1042
|
+
// (where we bind to (^|/), or a standalone matchPart context (where
|
|
1043
|
+
// we bind to ^, and not /). Otherwise slashes get duped!
|
|
1044
|
+
//
|
|
1045
|
+
// In part-matching mode, the start is:
|
|
1046
|
+
// - if not isStart: nothing
|
|
1047
|
+
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
|
1048
|
+
// - if dots allowed or not possible: ^
|
|
1049
|
+
// - if dots possible and not allowed: ^(?!\.)
|
|
1050
|
+
// end is:
|
|
1051
|
+
// - if not isEnd(): nothing
|
|
1052
|
+
// - else: $
|
|
1053
|
+
//
|
|
1054
|
+
// In full-path matching mode, we put the slash at the START of the
|
|
1055
|
+
// pattern, so start is:
|
|
1056
|
+
// - if first pattern: same as part-matching mode
|
|
1057
|
+
// - if not isStart(): nothing
|
|
1058
|
+
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
|
1059
|
+
// - if dots allowed or not possible: /
|
|
1060
|
+
// - if dots possible and not allowed: /(?!\.)
|
|
1061
|
+
// end is:
|
|
1062
|
+
// - if last pattern, same as part-matching mode
|
|
1063
|
+
// - else nothing
|
|
1064
|
+
//
|
|
1065
|
+
// Always put the (?:$|/) on negated tails, though, because that has to be
|
|
1066
|
+
// there to bind the end of the negated pattern portion, and it's easier to
|
|
1067
|
+
// just stick it in now rather than try to inject it later in the middle of
|
|
1068
|
+
// the pattern.
|
|
1069
|
+
//
|
|
1070
|
+
// We can just always return the same end, and leave it up to the caller
|
|
1071
|
+
// to know whether it's going to be used joined or in parts.
|
|
1072
|
+
// And, if the start is adjusted slightly, can do the same there:
|
|
1073
|
+
// - if not isStart: nothing
|
|
1074
|
+
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
|
1075
|
+
// - if dots allowed or not possible: (?:/|^)
|
|
1076
|
+
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
|
1077
|
+
//
|
|
1078
|
+
// But it's better to have a simpler binding without a conditional, for
|
|
1079
|
+
// performance, so probably better to return both start options.
|
|
1080
|
+
//
|
|
1081
|
+
// Then the caller just ignores the end if it's not the first pattern,
|
|
1082
|
+
// and the start always gets applied.
|
|
1083
|
+
//
|
|
1084
|
+
// But that's always going to be $ if it's the ending pattern, or nothing,
|
|
1085
|
+
// so the caller can just attach $ at the end of the pattern when building.
|
|
1086
|
+
//
|
|
1087
|
+
// So the todo is:
|
|
1088
|
+
// - better detect what kind of start is needed
|
|
1089
|
+
// - return both flavors of starting pattern
|
|
1090
|
+
// - attach $ at the end of the pattern when creating the actual RegExp
|
|
1091
|
+
//
|
|
1092
|
+
// Ah, but wait, no, that all only applies to the root when the first pattern
|
|
1093
|
+
// is not an extglob. If the first pattern IS an extglob, then we need all
|
|
1094
|
+
// that dot prevention biz to live in the extglob portions, because eg
|
|
1095
|
+
// +(*|.x*) can match .xy but not .yx.
|
|
1096
|
+
//
|
|
1097
|
+
// So, return the two flavors if it's #root and the first child is not an
|
|
1098
|
+
// AST, otherwise leave it to the child AST to handle it, and there,
|
|
1099
|
+
// use the (?:^|/) style of start binding.
|
|
1100
|
+
//
|
|
1101
|
+
// Even simplified further:
|
|
1102
|
+
// - Since the start for a join is eg /(?!\.) and the start for a part
|
|
1103
|
+
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
|
1104
|
+
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
1105
|
+
toRegExpSource(allowDot) {
|
|
1106
|
+
var _a;
|
|
1107
|
+
const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
|
|
1108
|
+
if (__privateGet(this, _root) === this)
|
|
1109
|
+
__privateMethod(this, _AST_instances, fillNegs_fn).call(this);
|
|
1110
|
+
if (!this.type) {
|
|
1111
|
+
const noEmpty = this.isStart() && this.isEnd();
|
|
1112
|
+
const src = __privateGet(this, _parts).map((p) => {
|
|
1113
|
+
var _a2;
|
|
1114
|
+
const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a2 = _AST, _AST_static, parseGlob_fn).call(_a2, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
|
|
1115
|
+
__privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
|
|
1116
|
+
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
1117
|
+
return re;
|
|
1118
|
+
}).join("");
|
|
1119
|
+
let start2 = "";
|
|
1120
|
+
if (this.isStart()) {
|
|
1121
|
+
if (typeof __privateGet(this, _parts)[0] === "string") {
|
|
1122
|
+
const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
|
|
1123
|
+
if (!dotTravAllowed) {
|
|
1124
|
+
const aps = addPatternStart;
|
|
1125
|
+
const needNoTrav = (
|
|
1126
|
+
// dots are allowed, and the pattern starts with [ or .
|
|
1127
|
+
dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
1128
|
+
src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
1129
|
+
src.startsWith("\\.\\.") && aps.has(src.charAt(4))
|
|
1130
|
+
);
|
|
1131
|
+
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
1132
|
+
start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
let end = "";
|
|
1137
|
+
if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!") {
|
|
1138
|
+
end = "(?:$|\\/)";
|
|
1139
|
+
}
|
|
1140
|
+
const final2 = start2 + src + end;
|
|
1141
|
+
return [
|
|
1142
|
+
final2,
|
|
1143
|
+
unescape(src),
|
|
1144
|
+
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
1145
|
+
__privateGet(this, _uflag)
|
|
1146
|
+
];
|
|
1147
|
+
}
|
|
1148
|
+
const repeated = this.type === "*" || this.type === "+";
|
|
1149
|
+
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
1150
|
+
let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
|
|
1151
|
+
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
1152
|
+
const s = this.toString();
|
|
1153
|
+
__privateSet(this, _parts, [s]);
|
|
1154
|
+
this.type = null;
|
|
1155
|
+
__privateSet(this, _hasMagic, void 0);
|
|
1156
|
+
return [s, unescape(this.toString()), false, false];
|
|
1157
|
+
}
|
|
1158
|
+
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
|
|
1159
|
+
if (bodyDotAllowed === body) {
|
|
1160
|
+
bodyDotAllowed = "";
|
|
1161
|
+
}
|
|
1162
|
+
if (bodyDotAllowed) {
|
|
1163
|
+
body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
|
1164
|
+
}
|
|
1165
|
+
let final = "";
|
|
1166
|
+
if (this.type === "!" && __privateGet(this, _emptyExt)) {
|
|
1167
|
+
final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
|
|
1168
|
+
} else {
|
|
1169
|
+
const close = this.type === "!" ? (
|
|
1170
|
+
// !() must match something,but !(x) can match ''
|
|
1171
|
+
"))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
|
|
1172
|
+
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
|
|
1173
|
+
final = start + body + close;
|
|
1174
|
+
}
|
|
1175
|
+
return [
|
|
1176
|
+
final,
|
|
1177
|
+
unescape(body),
|
|
1178
|
+
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
1179
|
+
__privateGet(this, _uflag)
|
|
1180
|
+
];
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
_root = new WeakMap();
|
|
1184
|
+
_hasMagic = new WeakMap();
|
|
1185
|
+
_uflag = new WeakMap();
|
|
1186
|
+
_parts = new WeakMap();
|
|
1187
|
+
_parent = new WeakMap();
|
|
1188
|
+
_parentIndex = new WeakMap();
|
|
1189
|
+
_negs = new WeakMap();
|
|
1190
|
+
_filledNegs = new WeakMap();
|
|
1191
|
+
_options = new WeakMap();
|
|
1192
|
+
_toString = new WeakMap();
|
|
1193
|
+
_emptyExt = new WeakMap();
|
|
1194
|
+
_AST_instances = new WeakSet();
|
|
1195
|
+
fillNegs_fn = function() {
|
|
1196
|
+
if (this !== __privateGet(this, _root))
|
|
1197
|
+
throw new Error("should only call on root");
|
|
1198
|
+
if (__privateGet(this, _filledNegs))
|
|
1199
|
+
return this;
|
|
1200
|
+
this.toString();
|
|
1201
|
+
__privateSet(this, _filledNegs, true);
|
|
1202
|
+
let n;
|
|
1203
|
+
while (n = __privateGet(this, _negs).pop()) {
|
|
1204
|
+
if (n.type !== "!")
|
|
1205
|
+
continue;
|
|
1206
|
+
let p = n;
|
|
1207
|
+
let pp = __privateGet(p, _parent);
|
|
1208
|
+
while (pp) {
|
|
1209
|
+
for (let i = __privateGet(p, _parentIndex) + 1; !pp.type && i < __privateGet(pp, _parts).length; i++) {
|
|
1210
|
+
for (const part of __privateGet(n, _parts)) {
|
|
1211
|
+
if (typeof part === "string") {
|
|
1212
|
+
throw new Error("string part in extglob AST??");
|
|
1213
|
+
}
|
|
1214
|
+
part.copyIn(__privateGet(pp, _parts)[i]);
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
p = pp;
|
|
1218
|
+
pp = __privateGet(p, _parent);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
return this;
|
|
1222
|
+
};
|
|
1223
|
+
_AST_static = new WeakSet();
|
|
1224
|
+
parseAST_fn = function(str, ast, pos, opt) {
|
|
1225
|
+
var _a, _b;
|
|
1226
|
+
let escaping = false;
|
|
1227
|
+
let inBrace = false;
|
|
1228
|
+
let braceStart = -1;
|
|
1229
|
+
let braceNeg = false;
|
|
1230
|
+
if (ast.type === null) {
|
|
1231
|
+
let i2 = pos;
|
|
1232
|
+
let acc2 = "";
|
|
1233
|
+
while (i2 < str.length) {
|
|
1234
|
+
const c = str.charAt(i2++);
|
|
1235
|
+
if (escaping || c === "\\") {
|
|
1236
|
+
escaping = !escaping;
|
|
1237
|
+
acc2 += c;
|
|
1238
|
+
continue;
|
|
1239
|
+
}
|
|
1240
|
+
if (inBrace) {
|
|
1241
|
+
if (i2 === braceStart + 1) {
|
|
1242
|
+
if (c === "^" || c === "!") {
|
|
1243
|
+
braceNeg = true;
|
|
1244
|
+
}
|
|
1245
|
+
} else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
|
|
1246
|
+
inBrace = false;
|
|
1247
|
+
}
|
|
1248
|
+
acc2 += c;
|
|
1249
|
+
continue;
|
|
1250
|
+
} else if (c === "[") {
|
|
1251
|
+
inBrace = true;
|
|
1252
|
+
braceStart = i2;
|
|
1253
|
+
braceNeg = false;
|
|
1254
|
+
acc2 += c;
|
|
1255
|
+
continue;
|
|
1256
|
+
}
|
|
1257
|
+
if (!opt.noext && isExtglobType(c) && str.charAt(i2) === "(") {
|
|
1258
|
+
ast.push(acc2);
|
|
1259
|
+
acc2 = "";
|
|
1260
|
+
const ext2 = new _AST(c, ast);
|
|
1261
|
+
i2 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext2, i2, opt);
|
|
1262
|
+
ast.push(ext2);
|
|
1263
|
+
continue;
|
|
1264
|
+
}
|
|
1265
|
+
acc2 += c;
|
|
1266
|
+
}
|
|
1267
|
+
ast.push(acc2);
|
|
1268
|
+
return i2;
|
|
1269
|
+
}
|
|
1270
|
+
let i = pos + 1;
|
|
1271
|
+
let part = new _AST(null, ast);
|
|
1272
|
+
const parts = [];
|
|
1273
|
+
let acc = "";
|
|
1274
|
+
while (i < str.length) {
|
|
1275
|
+
const c = str.charAt(i++);
|
|
1276
|
+
if (escaping || c === "\\") {
|
|
1277
|
+
escaping = !escaping;
|
|
1278
|
+
acc += c;
|
|
1279
|
+
continue;
|
|
1280
|
+
}
|
|
1281
|
+
if (inBrace) {
|
|
1282
|
+
if (i === braceStart + 1) {
|
|
1283
|
+
if (c === "^" || c === "!") {
|
|
1284
|
+
braceNeg = true;
|
|
1285
|
+
}
|
|
1286
|
+
} else if (c === "]" && !(i === braceStart + 2 && braceNeg)) {
|
|
1287
|
+
inBrace = false;
|
|
1288
|
+
}
|
|
1289
|
+
acc += c;
|
|
1290
|
+
continue;
|
|
1291
|
+
} else if (c === "[") {
|
|
1292
|
+
inBrace = true;
|
|
1293
|
+
braceStart = i;
|
|
1294
|
+
braceNeg = false;
|
|
1295
|
+
acc += c;
|
|
1296
|
+
continue;
|
|
1297
|
+
}
|
|
1298
|
+
if (isExtglobType(c) && str.charAt(i) === "(") {
|
|
1299
|
+
part.push(acc);
|
|
1300
|
+
acc = "";
|
|
1301
|
+
const ext2 = new _AST(c, part);
|
|
1302
|
+
part.push(ext2);
|
|
1303
|
+
i = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext2, i, opt);
|
|
1304
|
+
continue;
|
|
1305
|
+
}
|
|
1306
|
+
if (c === "|") {
|
|
1307
|
+
part.push(acc);
|
|
1308
|
+
acc = "";
|
|
1309
|
+
parts.push(part);
|
|
1310
|
+
part = new _AST(null, ast);
|
|
1311
|
+
continue;
|
|
1312
|
+
}
|
|
1313
|
+
if (c === ")") {
|
|
1314
|
+
if (acc === "" && __privateGet(ast, _parts).length === 0) {
|
|
1315
|
+
__privateSet(ast, _emptyExt, true);
|
|
1316
|
+
}
|
|
1317
|
+
part.push(acc);
|
|
1318
|
+
acc = "";
|
|
1319
|
+
ast.push(...parts, part);
|
|
1320
|
+
return i;
|
|
1321
|
+
}
|
|
1322
|
+
acc += c;
|
|
1323
|
+
}
|
|
1324
|
+
ast.type = null;
|
|
1325
|
+
__privateSet(ast, _hasMagic, void 0);
|
|
1326
|
+
__privateSet(ast, _parts, [str.substring(pos - 1)]);
|
|
1327
|
+
return i;
|
|
1328
|
+
};
|
|
1329
|
+
partsToRegExp_fn = function(dot) {
|
|
1330
|
+
return __privateGet(this, _parts).map((p) => {
|
|
1331
|
+
if (typeof p === "string") {
|
|
1332
|
+
throw new Error("string type in extglob ast??");
|
|
1333
|
+
}
|
|
1334
|
+
const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
|
|
1335
|
+
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
1336
|
+
return re;
|
|
1337
|
+
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
1338
|
+
};
|
|
1339
|
+
parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
|
|
1340
|
+
let escaping = false;
|
|
1341
|
+
let re = "";
|
|
1342
|
+
let uflag = false;
|
|
1343
|
+
for (let i = 0; i < glob.length; i++) {
|
|
1344
|
+
const c = glob.charAt(i);
|
|
1345
|
+
if (escaping) {
|
|
1346
|
+
escaping = false;
|
|
1347
|
+
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
1348
|
+
continue;
|
|
1349
|
+
}
|
|
1350
|
+
if (c === "\\") {
|
|
1351
|
+
if (i === glob.length - 1) {
|
|
1352
|
+
re += "\\\\";
|
|
1353
|
+
} else {
|
|
1354
|
+
escaping = true;
|
|
1355
|
+
}
|
|
1356
|
+
continue;
|
|
1357
|
+
}
|
|
1358
|
+
if (c === "[") {
|
|
1359
|
+
const [src, needUflag, consumed, magic] = parseClass(glob, i);
|
|
1360
|
+
if (consumed) {
|
|
1361
|
+
re += src;
|
|
1362
|
+
uflag = uflag || needUflag;
|
|
1363
|
+
i += consumed - 1;
|
|
1364
|
+
hasMagic = hasMagic || magic;
|
|
1365
|
+
continue;
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
if (c === "*") {
|
|
1369
|
+
if (noEmpty && glob === "*")
|
|
1370
|
+
re += starNoEmpty;
|
|
1371
|
+
else
|
|
1372
|
+
re += star;
|
|
1373
|
+
hasMagic = true;
|
|
1374
|
+
continue;
|
|
1375
|
+
}
|
|
1376
|
+
if (c === "?") {
|
|
1377
|
+
re += qmark;
|
|
1378
|
+
hasMagic = true;
|
|
1379
|
+
continue;
|
|
1380
|
+
}
|
|
1381
|
+
re += regExpEscape(c);
|
|
1382
|
+
}
|
|
1383
|
+
return [re, unescape(glob), !!hasMagic, uflag];
|
|
1384
|
+
};
|
|
1385
|
+
__privateAdd(_AST, _AST_static);
|
|
1386
|
+
var AST = _AST;
|
|
1387
|
+
|
|
1388
|
+
// node_modules/minimatch/dist/esm/escape.js
|
|
1389
|
+
var escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
1390
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
1391
|
+
};
|
|
1392
|
+
|
|
1393
|
+
// node_modules/minimatch/dist/esm/index.js
|
|
1394
|
+
var minimatch = (p, pattern, options = {}) => {
|
|
1395
|
+
assertValidPattern(pattern);
|
|
1396
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
1397
|
+
return false;
|
|
1398
|
+
}
|
|
1399
|
+
return new Minimatch(pattern, options).match(p);
|
|
1400
|
+
};
|
|
1401
|
+
var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
|
|
1402
|
+
var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
|
|
1403
|
+
var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
|
|
1404
|
+
var starDotExtTestNocase = (ext2) => {
|
|
1405
|
+
ext2 = ext2.toLowerCase();
|
|
1406
|
+
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
|
|
1407
|
+
};
|
|
1408
|
+
var starDotExtTestNocaseDot = (ext2) => {
|
|
1409
|
+
ext2 = ext2.toLowerCase();
|
|
1410
|
+
return (f) => f.toLowerCase().endsWith(ext2);
|
|
1411
|
+
};
|
|
1412
|
+
var starDotStarRE = /^\*+\.\*+$/;
|
|
1413
|
+
var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
1414
|
+
var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
1415
|
+
var dotStarRE = /^\.\*+$/;
|
|
1416
|
+
var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
1417
|
+
var starRE = /^\*+$/;
|
|
1418
|
+
var starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
1419
|
+
var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
1420
|
+
var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
1421
|
+
var qmarksTestNocase = ([$0, ext2 = ""]) => {
|
|
1422
|
+
const noext = qmarksTestNoExt([$0]);
|
|
1423
|
+
if (!ext2)
|
|
1424
|
+
return noext;
|
|
1425
|
+
ext2 = ext2.toLowerCase();
|
|
1426
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
1427
|
+
};
|
|
1428
|
+
var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
|
|
1429
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
1430
|
+
if (!ext2)
|
|
1431
|
+
return noext;
|
|
1432
|
+
ext2 = ext2.toLowerCase();
|
|
1433
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
1434
|
+
};
|
|
1435
|
+
var qmarksTestDot = ([$0, ext2 = ""]) => {
|
|
1436
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
1437
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
1438
|
+
};
|
|
1439
|
+
var qmarksTest = ([$0, ext2 = ""]) => {
|
|
1440
|
+
const noext = qmarksTestNoExt([$0]);
|
|
1441
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
1442
|
+
};
|
|
1443
|
+
var qmarksTestNoExt = ([$0]) => {
|
|
1444
|
+
const len = $0.length;
|
|
1445
|
+
return (f) => f.length === len && !f.startsWith(".");
|
|
1446
|
+
};
|
|
1447
|
+
var qmarksTestNoExtDot = ([$0]) => {
|
|
1448
|
+
const len = $0.length;
|
|
1449
|
+
return (f) => f.length === len && f !== "." && f !== "..";
|
|
1450
|
+
};
|
|
1451
|
+
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
1452
|
+
var path2 = {
|
|
1453
|
+
win32: { sep: "\\" },
|
|
1454
|
+
posix: { sep: "/" }
|
|
1455
|
+
};
|
|
1456
|
+
var sep = defaultPlatform === "win32" ? path2.win32.sep : path2.posix.sep;
|
|
1457
|
+
minimatch.sep = sep;
|
|
1458
|
+
var GLOBSTAR = Symbol("globstar **");
|
|
1459
|
+
minimatch.GLOBSTAR = GLOBSTAR;
|
|
1460
|
+
var qmark2 = "[^/]";
|
|
1461
|
+
var star2 = qmark2 + "*?";
|
|
1462
|
+
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
1463
|
+
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
1464
|
+
var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
|
|
1465
|
+
minimatch.filter = filter;
|
|
1466
|
+
var ext = (a, b = {}) => Object.assign({}, a, b);
|
|
1467
|
+
var defaults = (def) => {
|
|
1468
|
+
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
1469
|
+
return minimatch;
|
|
1470
|
+
}
|
|
1471
|
+
const orig = minimatch;
|
|
1472
|
+
const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
|
|
1473
|
+
return Object.assign(m, {
|
|
1474
|
+
Minimatch: class Minimatch extends orig.Minimatch {
|
|
1475
|
+
constructor(pattern, options = {}) {
|
|
1476
|
+
super(pattern, ext(def, options));
|
|
1477
|
+
}
|
|
1478
|
+
static defaults(options) {
|
|
1479
|
+
return orig.defaults(ext(def, options)).Minimatch;
|
|
1480
|
+
}
|
|
1481
|
+
},
|
|
1482
|
+
AST: class AST extends orig.AST {
|
|
1483
|
+
/* c8 ignore start */
|
|
1484
|
+
constructor(type, parent, options = {}) {
|
|
1485
|
+
super(type, parent, ext(def, options));
|
|
1486
|
+
}
|
|
1487
|
+
/* c8 ignore stop */
|
|
1488
|
+
static fromGlob(pattern, options = {}) {
|
|
1489
|
+
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
1490
|
+
}
|
|
1491
|
+
},
|
|
1492
|
+
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
1493
|
+
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
1494
|
+
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
1495
|
+
defaults: (options) => orig.defaults(ext(def, options)),
|
|
1496
|
+
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
1497
|
+
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
1498
|
+
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
|
|
1499
|
+
sep: orig.sep,
|
|
1500
|
+
GLOBSTAR
|
|
1501
|
+
});
|
|
1502
|
+
};
|
|
1503
|
+
minimatch.defaults = defaults;
|
|
1504
|
+
var braceExpand = (pattern, options = {}) => {
|
|
1505
|
+
assertValidPattern(pattern);
|
|
1506
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
1507
|
+
return [pattern];
|
|
1508
|
+
}
|
|
1509
|
+
return (0, import_brace_expansion.default)(pattern);
|
|
1510
|
+
};
|
|
1511
|
+
minimatch.braceExpand = braceExpand;
|
|
1512
|
+
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
1513
|
+
minimatch.makeRe = makeRe;
|
|
1514
|
+
var match = (list, pattern, options = {}) => {
|
|
1515
|
+
const mm = new Minimatch(pattern, options);
|
|
1516
|
+
list = list.filter((f) => mm.match(f));
|
|
1517
|
+
if (mm.options.nonull && !list.length) {
|
|
1518
|
+
list.push(pattern);
|
|
1519
|
+
}
|
|
1520
|
+
return list;
|
|
1521
|
+
};
|
|
1522
|
+
minimatch.match = match;
|
|
1523
|
+
var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
1524
|
+
var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1525
|
+
var Minimatch = class {
|
|
1526
|
+
options;
|
|
1527
|
+
set;
|
|
1528
|
+
pattern;
|
|
1529
|
+
windowsPathsNoEscape;
|
|
1530
|
+
nonegate;
|
|
1531
|
+
negate;
|
|
1532
|
+
comment;
|
|
1533
|
+
empty;
|
|
1534
|
+
preserveMultipleSlashes;
|
|
1535
|
+
partial;
|
|
1536
|
+
globSet;
|
|
1537
|
+
globParts;
|
|
1538
|
+
nocase;
|
|
1539
|
+
isWindows;
|
|
1540
|
+
platform;
|
|
1541
|
+
windowsNoMagicRoot;
|
|
1542
|
+
regexp;
|
|
1543
|
+
constructor(pattern, options = {}) {
|
|
1544
|
+
assertValidPattern(pattern);
|
|
1545
|
+
options = options || {};
|
|
1546
|
+
this.options = options;
|
|
1547
|
+
this.pattern = pattern;
|
|
1548
|
+
this.platform = options.platform || defaultPlatform;
|
|
1549
|
+
this.isWindows = this.platform === "win32";
|
|
1550
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
|
1551
|
+
if (this.windowsPathsNoEscape) {
|
|
1552
|
+
this.pattern = this.pattern.replace(/\\/g, "/");
|
|
1553
|
+
}
|
|
1554
|
+
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
1555
|
+
this.regexp = null;
|
|
1556
|
+
this.negate = false;
|
|
1557
|
+
this.nonegate = !!options.nonegate;
|
|
1558
|
+
this.comment = false;
|
|
1559
|
+
this.empty = false;
|
|
1560
|
+
this.partial = !!options.partial;
|
|
1561
|
+
this.nocase = !!this.options.nocase;
|
|
1562
|
+
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
1563
|
+
this.globSet = [];
|
|
1564
|
+
this.globParts = [];
|
|
1565
|
+
this.set = [];
|
|
1566
|
+
this.make();
|
|
1567
|
+
}
|
|
1568
|
+
hasMagic() {
|
|
1569
|
+
if (this.options.magicalBraces && this.set.length > 1) {
|
|
1570
|
+
return true;
|
|
1571
|
+
}
|
|
1572
|
+
for (const pattern of this.set) {
|
|
1573
|
+
for (const part of pattern) {
|
|
1574
|
+
if (typeof part !== "string")
|
|
1575
|
+
return true;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
return false;
|
|
1579
|
+
}
|
|
1580
|
+
debug(..._) {
|
|
1581
|
+
}
|
|
1582
|
+
make() {
|
|
1583
|
+
const pattern = this.pattern;
|
|
1584
|
+
const options = this.options;
|
|
1585
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
1586
|
+
this.comment = true;
|
|
1587
|
+
return;
|
|
1588
|
+
}
|
|
1589
|
+
if (!pattern) {
|
|
1590
|
+
this.empty = true;
|
|
1591
|
+
return;
|
|
1592
|
+
}
|
|
1593
|
+
this.parseNegate();
|
|
1594
|
+
this.globSet = [...new Set(this.braceExpand())];
|
|
1595
|
+
if (options.debug) {
|
|
1596
|
+
this.debug = (...args) => console.error(...args);
|
|
1597
|
+
}
|
|
1598
|
+
this.debug(this.pattern, this.globSet);
|
|
1599
|
+
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
1600
|
+
this.globParts = this.preprocess(rawGlobParts);
|
|
1601
|
+
this.debug(this.pattern, this.globParts);
|
|
1602
|
+
let set = this.globParts.map((s, _, __) => {
|
|
1603
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
1604
|
+
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
1605
|
+
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
1606
|
+
if (isUNC) {
|
|
1607
|
+
return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
1608
|
+
} else if (isDrive) {
|
|
1609
|
+
return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
return s.map((ss) => this.parse(ss));
|
|
1613
|
+
});
|
|
1614
|
+
this.debug(this.pattern, set);
|
|
1615
|
+
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
1616
|
+
if (this.isWindows) {
|
|
1617
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
1618
|
+
const p = this.set[i];
|
|
1619
|
+
if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
|
|
1620
|
+
p[2] = "?";
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
this.debug(this.pattern, this.set);
|
|
1625
|
+
}
|
|
1626
|
+
// various transforms to equivalent pattern sets that are
|
|
1627
|
+
// faster to process in a filesystem walk. The goal is to
|
|
1628
|
+
// eliminate what we can, and push all ** patterns as far
|
|
1629
|
+
// to the right as possible, even if it increases the number
|
|
1630
|
+
// of patterns that we have to process.
|
|
1631
|
+
preprocess(globParts) {
|
|
1632
|
+
if (this.options.noglobstar) {
|
|
1633
|
+
for (let i = 0; i < globParts.length; i++) {
|
|
1634
|
+
for (let j = 0; j < globParts[i].length; j++) {
|
|
1635
|
+
if (globParts[i][j] === "**") {
|
|
1636
|
+
globParts[i][j] = "*";
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
const { optimizationLevel = 1 } = this.options;
|
|
1642
|
+
if (optimizationLevel >= 2) {
|
|
1643
|
+
globParts = this.firstPhasePreProcess(globParts);
|
|
1644
|
+
globParts = this.secondPhasePreProcess(globParts);
|
|
1645
|
+
} else if (optimizationLevel >= 1) {
|
|
1646
|
+
globParts = this.levelOneOptimize(globParts);
|
|
1647
|
+
} else {
|
|
1648
|
+
globParts = this.adjascentGlobstarOptimize(globParts);
|
|
1649
|
+
}
|
|
1650
|
+
return globParts;
|
|
1651
|
+
}
|
|
1652
|
+
// just get rid of adjascent ** portions
|
|
1653
|
+
adjascentGlobstarOptimize(globParts) {
|
|
1654
|
+
return globParts.map((parts) => {
|
|
1655
|
+
let gs = -1;
|
|
1656
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1657
|
+
let i = gs;
|
|
1658
|
+
while (parts[i + 1] === "**") {
|
|
1659
|
+
i++;
|
|
1660
|
+
}
|
|
1661
|
+
if (i !== gs) {
|
|
1662
|
+
parts.splice(gs, i - gs);
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
return parts;
|
|
1666
|
+
});
|
|
1667
|
+
}
|
|
1668
|
+
// get rid of adjascent ** and resolve .. portions
|
|
1669
|
+
levelOneOptimize(globParts) {
|
|
1670
|
+
return globParts.map((parts) => {
|
|
1671
|
+
parts = parts.reduce((set, part) => {
|
|
1672
|
+
const prev = set[set.length - 1];
|
|
1673
|
+
if (part === "**" && prev === "**") {
|
|
1674
|
+
return set;
|
|
1675
|
+
}
|
|
1676
|
+
if (part === "..") {
|
|
1677
|
+
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
1678
|
+
set.pop();
|
|
1679
|
+
return set;
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
set.push(part);
|
|
1683
|
+
return set;
|
|
1684
|
+
}, []);
|
|
1685
|
+
return parts.length === 0 ? [""] : parts;
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
levelTwoFileOptimize(parts) {
|
|
1689
|
+
if (!Array.isArray(parts)) {
|
|
1690
|
+
parts = this.slashSplit(parts);
|
|
1691
|
+
}
|
|
1692
|
+
let didSomething = false;
|
|
1693
|
+
do {
|
|
1694
|
+
didSomething = false;
|
|
1695
|
+
if (!this.preserveMultipleSlashes) {
|
|
1696
|
+
for (let i = 1; i < parts.length - 1; i++) {
|
|
1697
|
+
const p = parts[i];
|
|
1698
|
+
if (i === 1 && p === "" && parts[0] === "")
|
|
1699
|
+
continue;
|
|
1700
|
+
if (p === "." || p === "") {
|
|
1701
|
+
didSomething = true;
|
|
1702
|
+
parts.splice(i, 1);
|
|
1703
|
+
i--;
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1707
|
+
didSomething = true;
|
|
1708
|
+
parts.pop();
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
let dd = 0;
|
|
1712
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1713
|
+
const p = parts[dd - 1];
|
|
1714
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1715
|
+
didSomething = true;
|
|
1716
|
+
parts.splice(dd - 1, 2);
|
|
1717
|
+
dd -= 2;
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
} while (didSomething);
|
|
1721
|
+
return parts.length === 0 ? [""] : parts;
|
|
1722
|
+
}
|
|
1723
|
+
// First phase: single-pattern processing
|
|
1724
|
+
// <pre> is 1 or more portions
|
|
1725
|
+
// <rest> is 1 or more portions
|
|
1726
|
+
// <p> is any portion other than ., .., '', or **
|
|
1727
|
+
// <e> is . or ''
|
|
1728
|
+
//
|
|
1729
|
+
// **/.. is *brutal* for filesystem walking performance, because
|
|
1730
|
+
// it effectively resets the recursive walk each time it occurs,
|
|
1731
|
+
// and ** cannot be reduced out by a .. pattern part like a regexp
|
|
1732
|
+
// or most strings (other than .., ., and '') can be.
|
|
1733
|
+
//
|
|
1734
|
+
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
|
|
1735
|
+
// <pre>/<e>/<rest> -> <pre>/<rest>
|
|
1736
|
+
// <pre>/<p>/../<rest> -> <pre>/<rest>
|
|
1737
|
+
// **/**/<rest> -> **/<rest>
|
|
1738
|
+
//
|
|
1739
|
+
// **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
|
|
1740
|
+
// this WOULD be allowed if ** did follow symlinks, or * didn't
|
|
1741
|
+
firstPhasePreProcess(globParts) {
|
|
1742
|
+
let didSomething = false;
|
|
1743
|
+
do {
|
|
1744
|
+
didSomething = false;
|
|
1745
|
+
for (let parts of globParts) {
|
|
1746
|
+
let gs = -1;
|
|
1747
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1748
|
+
let gss = gs;
|
|
1749
|
+
while (parts[gss + 1] === "**") {
|
|
1750
|
+
gss++;
|
|
1751
|
+
}
|
|
1752
|
+
if (gss > gs) {
|
|
1753
|
+
parts.splice(gs + 1, gss - gs);
|
|
1754
|
+
}
|
|
1755
|
+
let next = parts[gs + 1];
|
|
1756
|
+
const p = parts[gs + 2];
|
|
1757
|
+
const p2 = parts[gs + 3];
|
|
1758
|
+
if (next !== "..")
|
|
1759
|
+
continue;
|
|
1760
|
+
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
|
|
1761
|
+
continue;
|
|
1762
|
+
}
|
|
1763
|
+
didSomething = true;
|
|
1764
|
+
parts.splice(gs, 1);
|
|
1765
|
+
const other = parts.slice(0);
|
|
1766
|
+
other[gs] = "**";
|
|
1767
|
+
globParts.push(other);
|
|
1768
|
+
gs--;
|
|
1769
|
+
}
|
|
1770
|
+
if (!this.preserveMultipleSlashes) {
|
|
1771
|
+
for (let i = 1; i < parts.length - 1; i++) {
|
|
1772
|
+
const p = parts[i];
|
|
1773
|
+
if (i === 1 && p === "" && parts[0] === "")
|
|
1774
|
+
continue;
|
|
1775
|
+
if (p === "." || p === "") {
|
|
1776
|
+
didSomething = true;
|
|
1777
|
+
parts.splice(i, 1);
|
|
1778
|
+
i--;
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1782
|
+
didSomething = true;
|
|
1783
|
+
parts.pop();
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
let dd = 0;
|
|
1787
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1788
|
+
const p = parts[dd - 1];
|
|
1789
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1790
|
+
didSomething = true;
|
|
1791
|
+
const needDot = dd === 1 && parts[dd + 1] === "**";
|
|
1792
|
+
const splin = needDot ? ["."] : [];
|
|
1793
|
+
parts.splice(dd - 1, 2, ...splin);
|
|
1794
|
+
if (parts.length === 0)
|
|
1795
|
+
parts.push("");
|
|
1796
|
+
dd -= 2;
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
} while (didSomething);
|
|
1801
|
+
return globParts;
|
|
1802
|
+
}
|
|
1803
|
+
// second phase: multi-pattern dedupes
|
|
1804
|
+
// {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
|
|
1805
|
+
// {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
|
|
1806
|
+
// {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
|
|
1807
|
+
//
|
|
1808
|
+
// {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
|
|
1809
|
+
// ^-- not valid because ** doens't follow symlinks
|
|
1810
|
+
secondPhasePreProcess(globParts) {
|
|
1811
|
+
for (let i = 0; i < globParts.length - 1; i++) {
|
|
1812
|
+
for (let j = i + 1; j < globParts.length; j++) {
|
|
1813
|
+
const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
|
|
1814
|
+
if (!matched)
|
|
1815
|
+
continue;
|
|
1816
|
+
globParts[i] = matched;
|
|
1817
|
+
globParts[j] = [];
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
return globParts.filter((gs) => gs.length);
|
|
1821
|
+
}
|
|
1822
|
+
partsMatch(a, b, emptyGSMatch = false) {
|
|
1823
|
+
let ai = 0;
|
|
1824
|
+
let bi = 0;
|
|
1825
|
+
let result = [];
|
|
1826
|
+
let which = "";
|
|
1827
|
+
while (ai < a.length && bi < b.length) {
|
|
1828
|
+
if (a[ai] === b[bi]) {
|
|
1829
|
+
result.push(which === "b" ? b[bi] : a[ai]);
|
|
1830
|
+
ai++;
|
|
1831
|
+
bi++;
|
|
1832
|
+
} else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
|
|
1833
|
+
result.push(a[ai]);
|
|
1834
|
+
ai++;
|
|
1835
|
+
} else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
|
|
1836
|
+
result.push(b[bi]);
|
|
1837
|
+
bi++;
|
|
1838
|
+
} else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
|
|
1839
|
+
if (which === "b")
|
|
1840
|
+
return false;
|
|
1841
|
+
which = "a";
|
|
1842
|
+
result.push(a[ai]);
|
|
1843
|
+
ai++;
|
|
1844
|
+
bi++;
|
|
1845
|
+
} else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
|
|
1846
|
+
if (which === "a")
|
|
1847
|
+
return false;
|
|
1848
|
+
which = "b";
|
|
1849
|
+
result.push(b[bi]);
|
|
1850
|
+
ai++;
|
|
1851
|
+
bi++;
|
|
1852
|
+
} else {
|
|
1853
|
+
return false;
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
return a.length === b.length && result;
|
|
1857
|
+
}
|
|
1858
|
+
parseNegate() {
|
|
1859
|
+
if (this.nonegate)
|
|
1860
|
+
return;
|
|
1861
|
+
const pattern = this.pattern;
|
|
1862
|
+
let negate = false;
|
|
1863
|
+
let negateOffset = 0;
|
|
1864
|
+
for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
|
|
1865
|
+
negate = !negate;
|
|
1866
|
+
negateOffset++;
|
|
1867
|
+
}
|
|
1868
|
+
if (negateOffset)
|
|
1869
|
+
this.pattern = pattern.slice(negateOffset);
|
|
1870
|
+
this.negate = negate;
|
|
1871
|
+
}
|
|
1872
|
+
// set partial to true to test if, for example,
|
|
1873
|
+
// "/a/b" matches the start of "/*/b/*/d"
|
|
1874
|
+
// Partial means, if you run out of file before you run
|
|
1875
|
+
// out of pattern, then that's fine, as long as all
|
|
1876
|
+
// the parts match.
|
|
1877
|
+
matchOne(file, pattern, partial = false) {
|
|
1878
|
+
const options = this.options;
|
|
1879
|
+
if (this.isWindows) {
|
|
1880
|
+
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
1881
|
+
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
1882
|
+
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
1883
|
+
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
1884
|
+
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
1885
|
+
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
1886
|
+
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
1887
|
+
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
1888
|
+
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
1889
|
+
pattern[pdi] = fd;
|
|
1890
|
+
if (pdi > fdi) {
|
|
1891
|
+
pattern = pattern.slice(pdi);
|
|
1892
|
+
} else if (fdi > pdi) {
|
|
1893
|
+
file = file.slice(fdi);
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
const { optimizationLevel = 1 } = this.options;
|
|
1899
|
+
if (optimizationLevel >= 2) {
|
|
1900
|
+
file = this.levelTwoFileOptimize(file);
|
|
1901
|
+
}
|
|
1902
|
+
this.debug("matchOne", this, { file, pattern });
|
|
1903
|
+
this.debug("matchOne", file.length, pattern.length);
|
|
1904
|
+
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
1905
|
+
this.debug("matchOne loop");
|
|
1906
|
+
var p = pattern[pi];
|
|
1907
|
+
var f = file[fi];
|
|
1908
|
+
this.debug(pattern, p, f);
|
|
1909
|
+
if (p === false) {
|
|
1910
|
+
return false;
|
|
1911
|
+
}
|
|
1912
|
+
if (p === GLOBSTAR) {
|
|
1913
|
+
this.debug("GLOBSTAR", [pattern, p, f]);
|
|
1914
|
+
var fr = fi;
|
|
1915
|
+
var pr = pi + 1;
|
|
1916
|
+
if (pr === pl) {
|
|
1917
|
+
this.debug("** at the end");
|
|
1918
|
+
for (; fi < fl; fi++) {
|
|
1919
|
+
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
|
1920
|
+
return false;
|
|
1921
|
+
}
|
|
1922
|
+
return true;
|
|
1923
|
+
}
|
|
1924
|
+
while (fr < fl) {
|
|
1925
|
+
var swallowee = file[fr];
|
|
1926
|
+
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
1927
|
+
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
1928
|
+
this.debug("globstar found match!", fr, fl, swallowee);
|
|
1929
|
+
return true;
|
|
1930
|
+
} else {
|
|
1931
|
+
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
1932
|
+
this.debug("dot detected!", file, fr, pattern, pr);
|
|
1933
|
+
break;
|
|
1934
|
+
}
|
|
1935
|
+
this.debug("globstar swallow a segment, and continue");
|
|
1936
|
+
fr++;
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
if (partial) {
|
|
1940
|
+
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
1941
|
+
if (fr === fl) {
|
|
1942
|
+
return true;
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
return false;
|
|
1946
|
+
}
|
|
1947
|
+
let hit;
|
|
1948
|
+
if (typeof p === "string") {
|
|
1949
|
+
hit = f === p;
|
|
1950
|
+
this.debug("string match", p, f, hit);
|
|
1951
|
+
} else {
|
|
1952
|
+
hit = p.test(f);
|
|
1953
|
+
this.debug("pattern match", p, f, hit);
|
|
1954
|
+
}
|
|
1955
|
+
if (!hit)
|
|
1956
|
+
return false;
|
|
1957
|
+
}
|
|
1958
|
+
if (fi === fl && pi === pl) {
|
|
1959
|
+
return true;
|
|
1960
|
+
} else if (fi === fl) {
|
|
1961
|
+
return partial;
|
|
1962
|
+
} else if (pi === pl) {
|
|
1963
|
+
return fi === fl - 1 && file[fi] === "";
|
|
1964
|
+
} else {
|
|
1965
|
+
throw new Error("wtf?");
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
braceExpand() {
|
|
1969
|
+
return braceExpand(this.pattern, this.options);
|
|
1970
|
+
}
|
|
1971
|
+
parse(pattern) {
|
|
1972
|
+
assertValidPattern(pattern);
|
|
1973
|
+
const options = this.options;
|
|
1974
|
+
if (pattern === "**")
|
|
1975
|
+
return GLOBSTAR;
|
|
1976
|
+
if (pattern === "")
|
|
1977
|
+
return "";
|
|
1978
|
+
let m;
|
|
1979
|
+
let fastTest = null;
|
|
1980
|
+
if (m = pattern.match(starRE)) {
|
|
1981
|
+
fastTest = options.dot ? starTestDot : starTest;
|
|
1982
|
+
} else if (m = pattern.match(starDotExtRE)) {
|
|
1983
|
+
fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
1984
|
+
} else if (m = pattern.match(qmarksRE)) {
|
|
1985
|
+
fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
1986
|
+
} else if (m = pattern.match(starDotStarRE)) {
|
|
1987
|
+
fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
1988
|
+
} else if (m = pattern.match(dotStarRE)) {
|
|
1989
|
+
fastTest = dotStarTest;
|
|
1990
|
+
}
|
|
1991
|
+
const re = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
1992
|
+
if (fastTest && typeof re === "object") {
|
|
1993
|
+
Reflect.defineProperty(re, "test", { value: fastTest });
|
|
1994
|
+
}
|
|
1995
|
+
return re;
|
|
1996
|
+
}
|
|
1997
|
+
makeRe() {
|
|
1998
|
+
if (this.regexp || this.regexp === false)
|
|
1999
|
+
return this.regexp;
|
|
2000
|
+
const set = this.set;
|
|
2001
|
+
if (!set.length) {
|
|
2002
|
+
this.regexp = false;
|
|
2003
|
+
return this.regexp;
|
|
2004
|
+
}
|
|
2005
|
+
const options = this.options;
|
|
2006
|
+
const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
|
|
2007
|
+
const flags = new Set(options.nocase ? ["i"] : []);
|
|
2008
|
+
let re = set.map((pattern) => {
|
|
2009
|
+
const pp = pattern.map((p) => {
|
|
2010
|
+
if (p instanceof RegExp) {
|
|
2011
|
+
for (const f of p.flags.split(""))
|
|
2012
|
+
flags.add(f);
|
|
2013
|
+
}
|
|
2014
|
+
return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
|
|
2015
|
+
});
|
|
2016
|
+
pp.forEach((p, i) => {
|
|
2017
|
+
const next = pp[i + 1];
|
|
2018
|
+
const prev = pp[i - 1];
|
|
2019
|
+
if (p !== GLOBSTAR || prev === GLOBSTAR) {
|
|
2020
|
+
return;
|
|
2021
|
+
}
|
|
2022
|
+
if (prev === void 0) {
|
|
2023
|
+
if (next !== void 0 && next !== GLOBSTAR) {
|
|
2024
|
+
pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
2025
|
+
} else {
|
|
2026
|
+
pp[i] = twoStar;
|
|
2027
|
+
}
|
|
2028
|
+
} else if (next === void 0) {
|
|
2029
|
+
pp[i - 1] = prev + "(?:\\/|" + twoStar + ")?";
|
|
2030
|
+
} else if (next !== GLOBSTAR) {
|
|
2031
|
+
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
2032
|
+
pp[i + 1] = GLOBSTAR;
|
|
2033
|
+
}
|
|
2034
|
+
});
|
|
2035
|
+
return pp.filter((p) => p !== GLOBSTAR).join("/");
|
|
2036
|
+
}).join("|");
|
|
2037
|
+
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
2038
|
+
re = "^" + open + re + close + "$";
|
|
2039
|
+
if (this.negate)
|
|
2040
|
+
re = "^(?!" + re + ").+$";
|
|
2041
|
+
try {
|
|
2042
|
+
this.regexp = new RegExp(re, [...flags].join(""));
|
|
2043
|
+
} catch (ex) {
|
|
2044
|
+
this.regexp = false;
|
|
2045
|
+
}
|
|
2046
|
+
return this.regexp;
|
|
2047
|
+
}
|
|
2048
|
+
slashSplit(p) {
|
|
2049
|
+
if (this.preserveMultipleSlashes) {
|
|
2050
|
+
return p.split("/");
|
|
2051
|
+
} else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
|
|
2052
|
+
return ["", ...p.split(/\/+/)];
|
|
2053
|
+
} else {
|
|
2054
|
+
return p.split(/\/+/);
|
|
2055
|
+
}
|
|
2056
|
+
}
|
|
2057
|
+
match(f, partial = this.partial) {
|
|
2058
|
+
this.debug("match", f, this.pattern);
|
|
2059
|
+
if (this.comment) {
|
|
2060
|
+
return false;
|
|
2061
|
+
}
|
|
2062
|
+
if (this.empty) {
|
|
2063
|
+
return f === "";
|
|
2064
|
+
}
|
|
2065
|
+
if (f === "/" && partial) {
|
|
2066
|
+
return true;
|
|
2067
|
+
}
|
|
2068
|
+
const options = this.options;
|
|
2069
|
+
if (this.isWindows) {
|
|
2070
|
+
f = f.split("\\").join("/");
|
|
2071
|
+
}
|
|
2072
|
+
const ff = this.slashSplit(f);
|
|
2073
|
+
this.debug(this.pattern, "split", ff);
|
|
2074
|
+
const set = this.set;
|
|
2075
|
+
this.debug(this.pattern, "set", set);
|
|
2076
|
+
let filename = ff[ff.length - 1];
|
|
2077
|
+
if (!filename) {
|
|
2078
|
+
for (let i = ff.length - 2; !filename && i >= 0; i--) {
|
|
2079
|
+
filename = ff[i];
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
for (let i = 0; i < set.length; i++) {
|
|
2083
|
+
const pattern = set[i];
|
|
2084
|
+
let file = ff;
|
|
2085
|
+
if (options.matchBase && pattern.length === 1) {
|
|
2086
|
+
file = [filename];
|
|
2087
|
+
}
|
|
2088
|
+
const hit = this.matchOne(file, pattern, partial);
|
|
2089
|
+
if (hit) {
|
|
2090
|
+
if (options.flipNegate) {
|
|
2091
|
+
return true;
|
|
2092
|
+
}
|
|
2093
|
+
return !this.negate;
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
if (options.flipNegate) {
|
|
2097
|
+
return false;
|
|
2098
|
+
}
|
|
2099
|
+
return this.negate;
|
|
2100
|
+
}
|
|
2101
|
+
static defaults(def) {
|
|
2102
|
+
return minimatch.defaults(def).Minimatch;
|
|
2103
|
+
}
|
|
2104
|
+
};
|
|
2105
|
+
minimatch.AST = AST;
|
|
2106
|
+
minimatch.Minimatch = Minimatch;
|
|
2107
|
+
minimatch.escape = escape;
|
|
2108
|
+
minimatch.unescape = unescape;
|
|
2109
|
+
|
|
536
2110
|
// src/utils/regular-expression.ts
|
|
537
2111
|
var escapeRegExpSpecialCharacters = (text) => {
|
|
538
2112
|
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -659,6 +2233,7 @@ var BUILD = {
|
|
|
659
2233
|
constructableCSS: true,
|
|
660
2234
|
devTools: false,
|
|
661
2235
|
shadowDelegatesFocus: true,
|
|
2236
|
+
shadowSlotAssignmentManual: false,
|
|
662
2237
|
initializeNextTick: false,
|
|
663
2238
|
asyncLoading: true,
|
|
664
2239
|
asyncQueue: false,
|
|
@@ -690,6 +2265,9 @@ var H = win.HTMLElement || class {
|
|
|
690
2265
|
var supportsShadow = BUILD.shadowDom;
|
|
691
2266
|
var supportsConstructableStylesheets = BUILD.constructableCSS ? /* @__PURE__ */ (() => {
|
|
692
2267
|
try {
|
|
2268
|
+
if (!win.document.adoptedStyleSheets) {
|
|
2269
|
+
return false;
|
|
2270
|
+
}
|
|
693
2271
|
new CSSStyleSheet();
|
|
694
2272
|
return typeof new CSSStyleSheet().replaceSync === "function";
|
|
695
2273
|
} catch (e) {
|