@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
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __typeError = (msg) => {
|
|
9
|
+
throw TypeError(msg);
|
|
10
|
+
};
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
13
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
|
+
};
|
|
6
15
|
var __export = (target, all) => {
|
|
7
16
|
for (var name in all)
|
|
8
17
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,7 +24,229 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
24
|
}
|
|
16
25
|
return to;
|
|
17
26
|
};
|
|
27
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
28
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
29
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
30
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
31
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
32
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
33
|
+
mod
|
|
34
|
+
));
|
|
18
35
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
37
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
38
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
39
|
+
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);
|
|
40
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
41
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
42
|
+
|
|
43
|
+
// node_modules/balanced-match/index.js
|
|
44
|
+
var require_balanced_match = __commonJS({
|
|
45
|
+
"node_modules/balanced-match/index.js"(exports2, module2) {
|
|
46
|
+
"use strict";
|
|
47
|
+
module2.exports = balanced;
|
|
48
|
+
function balanced(a, b, str) {
|
|
49
|
+
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
50
|
+
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
51
|
+
var r = range(a, b, str);
|
|
52
|
+
return r && {
|
|
53
|
+
start: r[0],
|
|
54
|
+
end: r[1],
|
|
55
|
+
pre: str.slice(0, r[0]),
|
|
56
|
+
body: str.slice(r[0] + a.length, r[1]),
|
|
57
|
+
post: str.slice(r[1] + b.length)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function maybeMatch(reg, str) {
|
|
61
|
+
var m = str.match(reg);
|
|
62
|
+
return m ? m[0] : null;
|
|
63
|
+
}
|
|
64
|
+
balanced.range = range;
|
|
65
|
+
function range(a, b, str) {
|
|
66
|
+
var begs, beg, left, right, result;
|
|
67
|
+
var ai = str.indexOf(a);
|
|
68
|
+
var bi = str.indexOf(b, ai + 1);
|
|
69
|
+
var i2 = ai;
|
|
70
|
+
if (ai >= 0 && bi > 0) {
|
|
71
|
+
if (a === b) {
|
|
72
|
+
return [ai, bi];
|
|
73
|
+
}
|
|
74
|
+
begs = [];
|
|
75
|
+
left = str.length;
|
|
76
|
+
while (i2 >= 0 && !result) {
|
|
77
|
+
if (i2 == ai) {
|
|
78
|
+
begs.push(i2);
|
|
79
|
+
ai = str.indexOf(a, i2 + 1);
|
|
80
|
+
} else if (begs.length == 1) {
|
|
81
|
+
result = [begs.pop(), bi];
|
|
82
|
+
} else {
|
|
83
|
+
beg = begs.pop();
|
|
84
|
+
if (beg < left) {
|
|
85
|
+
left = beg;
|
|
86
|
+
right = bi;
|
|
87
|
+
}
|
|
88
|
+
bi = str.indexOf(b, i2 + 1);
|
|
89
|
+
}
|
|
90
|
+
i2 = ai < bi && ai >= 0 ? ai : bi;
|
|
91
|
+
}
|
|
92
|
+
if (begs.length) {
|
|
93
|
+
result = [left, right];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// node_modules/brace-expansion/index.js
|
|
102
|
+
var require_brace_expansion = __commonJS({
|
|
103
|
+
"node_modules/brace-expansion/index.js"(exports2, module2) {
|
|
104
|
+
var balanced = require_balanced_match();
|
|
105
|
+
module2.exports = expandTop;
|
|
106
|
+
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
107
|
+
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
108
|
+
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
109
|
+
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
110
|
+
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
111
|
+
function numeric(str) {
|
|
112
|
+
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
113
|
+
}
|
|
114
|
+
function escapeBraces(str) {
|
|
115
|
+
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
116
|
+
}
|
|
117
|
+
function unescapeBraces(str) {
|
|
118
|
+
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
119
|
+
}
|
|
120
|
+
function parseCommaParts(str) {
|
|
121
|
+
if (!str)
|
|
122
|
+
return [""];
|
|
123
|
+
var parts = [];
|
|
124
|
+
var m = balanced("{", "}", str);
|
|
125
|
+
if (!m)
|
|
126
|
+
return str.split(",");
|
|
127
|
+
var pre = m.pre;
|
|
128
|
+
var body = m.body;
|
|
129
|
+
var post = m.post;
|
|
130
|
+
var p = pre.split(",");
|
|
131
|
+
p[p.length - 1] += "{" + body + "}";
|
|
132
|
+
var postParts = parseCommaParts(post);
|
|
133
|
+
if (post.length) {
|
|
134
|
+
p[p.length - 1] += postParts.shift();
|
|
135
|
+
p.push.apply(p, postParts);
|
|
136
|
+
}
|
|
137
|
+
parts.push.apply(parts, p);
|
|
138
|
+
return parts;
|
|
139
|
+
}
|
|
140
|
+
function expandTop(str) {
|
|
141
|
+
if (!str)
|
|
142
|
+
return [];
|
|
143
|
+
if (str.substr(0, 2) === "{}") {
|
|
144
|
+
str = "\\{\\}" + str.substr(2);
|
|
145
|
+
}
|
|
146
|
+
return expand2(escapeBraces(str), true).map(unescapeBraces);
|
|
147
|
+
}
|
|
148
|
+
function embrace(str) {
|
|
149
|
+
return "{" + str + "}";
|
|
150
|
+
}
|
|
151
|
+
function isPadded(el) {
|
|
152
|
+
return /^-?0\d/.test(el);
|
|
153
|
+
}
|
|
154
|
+
function lte(i2, y) {
|
|
155
|
+
return i2 <= y;
|
|
156
|
+
}
|
|
157
|
+
function gte(i2, y) {
|
|
158
|
+
return i2 >= y;
|
|
159
|
+
}
|
|
160
|
+
function expand2(str, isTop) {
|
|
161
|
+
var expansions = [];
|
|
162
|
+
var m = balanced("{", "}", str);
|
|
163
|
+
if (!m) return [str];
|
|
164
|
+
var pre = m.pre;
|
|
165
|
+
var post = m.post.length ? expand2(m.post, false) : [""];
|
|
166
|
+
if (/\$$/.test(m.pre)) {
|
|
167
|
+
for (var k = 0; k < post.length; k++) {
|
|
168
|
+
var expansion = pre + "{" + m.body + "}" + post[k];
|
|
169
|
+
expansions.push(expansion);
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
173
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
174
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
|
175
|
+
var isOptions = m.body.indexOf(",") >= 0;
|
|
176
|
+
if (!isSequence && !isOptions) {
|
|
177
|
+
if (m.post.match(/,(?!,).*\}/)) {
|
|
178
|
+
str = m.pre + "{" + m.body + escClose + m.post;
|
|
179
|
+
return expand2(str);
|
|
180
|
+
}
|
|
181
|
+
return [str];
|
|
182
|
+
}
|
|
183
|
+
var n;
|
|
184
|
+
if (isSequence) {
|
|
185
|
+
n = m.body.split(/\.\./);
|
|
186
|
+
} else {
|
|
187
|
+
n = parseCommaParts(m.body);
|
|
188
|
+
if (n.length === 1) {
|
|
189
|
+
n = expand2(n[0], false).map(embrace);
|
|
190
|
+
if (n.length === 1) {
|
|
191
|
+
return post.map(function(p) {
|
|
192
|
+
return m.pre + n[0] + p;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
var N;
|
|
198
|
+
if (isSequence) {
|
|
199
|
+
var x = numeric(n[0]);
|
|
200
|
+
var y = numeric(n[1]);
|
|
201
|
+
var width = Math.max(n[0].length, n[1].length);
|
|
202
|
+
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
|
|
203
|
+
var test = lte;
|
|
204
|
+
var reverse = y < x;
|
|
205
|
+
if (reverse) {
|
|
206
|
+
incr *= -1;
|
|
207
|
+
test = gte;
|
|
208
|
+
}
|
|
209
|
+
var pad = n.some(isPadded);
|
|
210
|
+
N = [];
|
|
211
|
+
for (var i2 = x; test(i2, y); i2 += incr) {
|
|
212
|
+
var c;
|
|
213
|
+
if (isAlphaSequence) {
|
|
214
|
+
c = String.fromCharCode(i2);
|
|
215
|
+
if (c === "\\")
|
|
216
|
+
c = "";
|
|
217
|
+
} else {
|
|
218
|
+
c = String(i2);
|
|
219
|
+
if (pad) {
|
|
220
|
+
var need = width - c.length;
|
|
221
|
+
if (need > 0) {
|
|
222
|
+
var z = new Array(need + 1).join("0");
|
|
223
|
+
if (i2 < 0)
|
|
224
|
+
c = "-" + z + c.slice(1);
|
|
225
|
+
else
|
|
226
|
+
c = z + c;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
N.push(c);
|
|
231
|
+
}
|
|
232
|
+
} else {
|
|
233
|
+
N = [];
|
|
234
|
+
for (var j = 0; j < n.length; j++) {
|
|
235
|
+
N.push.apply(N, expand2(n[j], false));
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
for (var j = 0; j < N.length; j++) {
|
|
239
|
+
for (var k = 0; k < post.length; k++) {
|
|
240
|
+
var expansion = pre + N[j] + post[k];
|
|
241
|
+
if (!isTop || isSequence || expansion)
|
|
242
|
+
expansions.push(expansion);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return expansions;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
});
|
|
19
250
|
|
|
20
251
|
// src/testing/platform/index.ts
|
|
21
252
|
var index_exports = {};
|
|
@@ -320,13 +551,13 @@ var supportsMutableAdoptedStyleSheets = false;
|
|
|
320
551
|
var setSupportsShadowDom = (supports) => {
|
|
321
552
|
supportsShadow = supports;
|
|
322
553
|
};
|
|
323
|
-
function resetPlatform(
|
|
554
|
+
function resetPlatform(defaults2 = {}) {
|
|
324
555
|
if (win && typeof win.close === "function") {
|
|
325
556
|
win.close();
|
|
326
557
|
}
|
|
327
558
|
styles.clear();
|
|
328
559
|
plt.$flags$ = 0;
|
|
329
|
-
Object.assign(plt,
|
|
560
|
+
Object.assign(plt, defaults2);
|
|
330
561
|
if (plt.$orgLocNodes$ != null) {
|
|
331
562
|
plt.$orgLocNodes$.clear();
|
|
332
563
|
plt.$orgLocNodes$ = void 0;
|
|
@@ -383,11 +614,11 @@ var isMemberInElement = (elm, memberName) => {
|
|
|
383
614
|
var import_app_data24 = require("@stencil/core/internal/app-data");
|
|
384
615
|
|
|
385
616
|
// src/runtime/asset-path.ts
|
|
386
|
-
var getAssetPath = (
|
|
387
|
-
const assetUrl = new URL(
|
|
617
|
+
var getAssetPath = (path2) => {
|
|
618
|
+
const assetUrl = new URL(path2, plt.$resourcesUrl$);
|
|
388
619
|
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
|
|
389
620
|
};
|
|
390
|
-
var setAssetPath = (
|
|
621
|
+
var setAssetPath = (path2) => plt.$resourcesUrl$ = path2;
|
|
391
622
|
|
|
392
623
|
// src/runtime/bootstrap-custom-element.ts
|
|
393
624
|
var import_app_data20 = require("@stencil/core/internal/app-data");
|
|
@@ -427,6 +658,1359 @@ var isComplexType = (o) => {
|
|
|
427
658
|
return o === "object" || o === "function";
|
|
428
659
|
};
|
|
429
660
|
|
|
661
|
+
// node_modules/minimatch/dist/esm/index.js
|
|
662
|
+
var import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
663
|
+
|
|
664
|
+
// node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
665
|
+
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
666
|
+
var assertValidPattern = (pattern) => {
|
|
667
|
+
if (typeof pattern !== "string") {
|
|
668
|
+
throw new TypeError("invalid pattern");
|
|
669
|
+
}
|
|
670
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
671
|
+
throw new TypeError("pattern is too long");
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
// node_modules/minimatch/dist/esm/brace-expressions.js
|
|
676
|
+
var posixClasses = {
|
|
677
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
678
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
679
|
+
"[:ascii:]": ["\\x00-\\x7f", false],
|
|
680
|
+
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
681
|
+
"[:cntrl:]": ["\\p{Cc}", true],
|
|
682
|
+
"[:digit:]": ["\\p{Nd}", true],
|
|
683
|
+
"[:graph:]": ["\\p{Z}\\p{C}", true, true],
|
|
684
|
+
"[:lower:]": ["\\p{Ll}", true],
|
|
685
|
+
"[:print:]": ["\\p{C}", true],
|
|
686
|
+
"[:punct:]": ["\\p{P}", true],
|
|
687
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
688
|
+
"[:upper:]": ["\\p{Lu}", true],
|
|
689
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
690
|
+
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
691
|
+
};
|
|
692
|
+
var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
693
|
+
var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
694
|
+
var rangesToString = (ranges) => ranges.join("");
|
|
695
|
+
var parseClass = (glob, position) => {
|
|
696
|
+
const pos = position;
|
|
697
|
+
if (glob.charAt(pos) !== "[") {
|
|
698
|
+
throw new Error("not in a brace expression");
|
|
699
|
+
}
|
|
700
|
+
const ranges = [];
|
|
701
|
+
const negs = [];
|
|
702
|
+
let i2 = pos + 1;
|
|
703
|
+
let sawStart = false;
|
|
704
|
+
let uflag = false;
|
|
705
|
+
let escaping = false;
|
|
706
|
+
let negate = false;
|
|
707
|
+
let endPos = pos;
|
|
708
|
+
let rangeStart = "";
|
|
709
|
+
WHILE: while (i2 < glob.length) {
|
|
710
|
+
const c = glob.charAt(i2);
|
|
711
|
+
if ((c === "!" || c === "^") && i2 === pos + 1) {
|
|
712
|
+
negate = true;
|
|
713
|
+
i2++;
|
|
714
|
+
continue;
|
|
715
|
+
}
|
|
716
|
+
if (c === "]" && sawStart && !escaping) {
|
|
717
|
+
endPos = i2 + 1;
|
|
718
|
+
break;
|
|
719
|
+
}
|
|
720
|
+
sawStart = true;
|
|
721
|
+
if (c === "\\") {
|
|
722
|
+
if (!escaping) {
|
|
723
|
+
escaping = true;
|
|
724
|
+
i2++;
|
|
725
|
+
continue;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
if (c === "[" && !escaping) {
|
|
729
|
+
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
730
|
+
if (glob.startsWith(cls, i2)) {
|
|
731
|
+
if (rangeStart) {
|
|
732
|
+
return ["$.", false, glob.length - pos, true];
|
|
733
|
+
}
|
|
734
|
+
i2 += cls.length;
|
|
735
|
+
if (neg)
|
|
736
|
+
negs.push(unip);
|
|
737
|
+
else
|
|
738
|
+
ranges.push(unip);
|
|
739
|
+
uflag = uflag || u;
|
|
740
|
+
continue WHILE;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
escaping = false;
|
|
745
|
+
if (rangeStart) {
|
|
746
|
+
if (c > rangeStart) {
|
|
747
|
+
ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
|
|
748
|
+
} else if (c === rangeStart) {
|
|
749
|
+
ranges.push(braceEscape(c));
|
|
750
|
+
}
|
|
751
|
+
rangeStart = "";
|
|
752
|
+
i2++;
|
|
753
|
+
continue;
|
|
754
|
+
}
|
|
755
|
+
if (glob.startsWith("-]", i2 + 1)) {
|
|
756
|
+
ranges.push(braceEscape(c + "-"));
|
|
757
|
+
i2 += 2;
|
|
758
|
+
continue;
|
|
759
|
+
}
|
|
760
|
+
if (glob.startsWith("-", i2 + 1)) {
|
|
761
|
+
rangeStart = c;
|
|
762
|
+
i2 += 2;
|
|
763
|
+
continue;
|
|
764
|
+
}
|
|
765
|
+
ranges.push(braceEscape(c));
|
|
766
|
+
i2++;
|
|
767
|
+
}
|
|
768
|
+
if (endPos < i2) {
|
|
769
|
+
return ["", false, 0, false];
|
|
770
|
+
}
|
|
771
|
+
if (!ranges.length && !negs.length) {
|
|
772
|
+
return ["$.", false, glob.length - pos, true];
|
|
773
|
+
}
|
|
774
|
+
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
|
|
775
|
+
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
776
|
+
return [regexpEscape(r), false, endPos - pos, false];
|
|
777
|
+
}
|
|
778
|
+
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
|
|
779
|
+
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
780
|
+
const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
|
|
781
|
+
return [comb, uflag, endPos - pos, true];
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
// node_modules/minimatch/dist/esm/unescape.js
|
|
785
|
+
var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
786
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
787
|
+
};
|
|
788
|
+
|
|
789
|
+
// node_modules/minimatch/dist/esm/ast.js
|
|
790
|
+
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
791
|
+
var isExtglobType = (c) => types.has(c);
|
|
792
|
+
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
793
|
+
var startNoDot = "(?!\\.)";
|
|
794
|
+
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
|
795
|
+
var justDots = /* @__PURE__ */ new Set(["..", "."]);
|
|
796
|
+
var reSpecials = new Set("().*{}+?[]^$\\!");
|
|
797
|
+
var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
798
|
+
var qmark = "[^/]";
|
|
799
|
+
var star = qmark + "*?";
|
|
800
|
+
var starNoEmpty = qmark + "+?";
|
|
801
|
+
var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
|
|
802
|
+
var _AST = class _AST {
|
|
803
|
+
constructor(type, parent, options = {}) {
|
|
804
|
+
__privateAdd(this, _AST_instances);
|
|
805
|
+
__publicField(this, "type");
|
|
806
|
+
__privateAdd(this, _root);
|
|
807
|
+
__privateAdd(this, _hasMagic);
|
|
808
|
+
__privateAdd(this, _uflag, false);
|
|
809
|
+
__privateAdd(this, _parts, []);
|
|
810
|
+
__privateAdd(this, _parent);
|
|
811
|
+
__privateAdd(this, _parentIndex);
|
|
812
|
+
__privateAdd(this, _negs);
|
|
813
|
+
__privateAdd(this, _filledNegs, false);
|
|
814
|
+
__privateAdd(this, _options);
|
|
815
|
+
__privateAdd(this, _toString);
|
|
816
|
+
// set to true if it's an extglob with no children
|
|
817
|
+
// (which really means one child of '')
|
|
818
|
+
__privateAdd(this, _emptyExt, false);
|
|
819
|
+
this.type = type;
|
|
820
|
+
if (type)
|
|
821
|
+
__privateSet(this, _hasMagic, true);
|
|
822
|
+
__privateSet(this, _parent, parent);
|
|
823
|
+
__privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
|
|
824
|
+
__privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
|
|
825
|
+
__privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
|
|
826
|
+
if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
|
|
827
|
+
__privateGet(this, _negs).push(this);
|
|
828
|
+
__privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
|
|
829
|
+
}
|
|
830
|
+
get hasMagic() {
|
|
831
|
+
if (__privateGet(this, _hasMagic) !== void 0)
|
|
832
|
+
return __privateGet(this, _hasMagic);
|
|
833
|
+
for (const p of __privateGet(this, _parts)) {
|
|
834
|
+
if (typeof p === "string")
|
|
835
|
+
continue;
|
|
836
|
+
if (p.type || p.hasMagic)
|
|
837
|
+
return __privateSet(this, _hasMagic, true);
|
|
838
|
+
}
|
|
839
|
+
return __privateGet(this, _hasMagic);
|
|
840
|
+
}
|
|
841
|
+
// reconstructs the pattern
|
|
842
|
+
toString() {
|
|
843
|
+
if (__privateGet(this, _toString) !== void 0)
|
|
844
|
+
return __privateGet(this, _toString);
|
|
845
|
+
if (!this.type) {
|
|
846
|
+
return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
|
|
847
|
+
} else {
|
|
848
|
+
return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
push(...parts) {
|
|
852
|
+
for (const p of parts) {
|
|
853
|
+
if (p === "")
|
|
854
|
+
continue;
|
|
855
|
+
if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
|
|
856
|
+
throw new Error("invalid part: " + p);
|
|
857
|
+
}
|
|
858
|
+
__privateGet(this, _parts).push(p);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
toJSON() {
|
|
862
|
+
var _a;
|
|
863
|
+
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())];
|
|
864
|
+
if (this.isStart() && !this.type)
|
|
865
|
+
ret.unshift([]);
|
|
866
|
+
if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")) {
|
|
867
|
+
ret.push({});
|
|
868
|
+
}
|
|
869
|
+
return ret;
|
|
870
|
+
}
|
|
871
|
+
isStart() {
|
|
872
|
+
var _a;
|
|
873
|
+
if (__privateGet(this, _root) === this)
|
|
874
|
+
return true;
|
|
875
|
+
if (!((_a = __privateGet(this, _parent)) == null ? void 0 : _a.isStart()))
|
|
876
|
+
return false;
|
|
877
|
+
if (__privateGet(this, _parentIndex) === 0)
|
|
878
|
+
return true;
|
|
879
|
+
const p = __privateGet(this, _parent);
|
|
880
|
+
for (let i2 = 0; i2 < __privateGet(this, _parentIndex); i2++) {
|
|
881
|
+
const pp = __privateGet(p, _parts)[i2];
|
|
882
|
+
if (!(pp instanceof _AST && pp.type === "!")) {
|
|
883
|
+
return false;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
return true;
|
|
887
|
+
}
|
|
888
|
+
isEnd() {
|
|
889
|
+
var _a, _b, _c;
|
|
890
|
+
if (__privateGet(this, _root) === this)
|
|
891
|
+
return true;
|
|
892
|
+
if (((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")
|
|
893
|
+
return true;
|
|
894
|
+
if (!((_b = __privateGet(this, _parent)) == null ? void 0 : _b.isEnd()))
|
|
895
|
+
return false;
|
|
896
|
+
if (!this.type)
|
|
897
|
+
return (_c = __privateGet(this, _parent)) == null ? void 0 : _c.isEnd();
|
|
898
|
+
const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
|
|
899
|
+
return __privateGet(this, _parentIndex) === pl - 1;
|
|
900
|
+
}
|
|
901
|
+
copyIn(part) {
|
|
902
|
+
if (typeof part === "string")
|
|
903
|
+
this.push(part);
|
|
904
|
+
else
|
|
905
|
+
this.push(part.clone(this));
|
|
906
|
+
}
|
|
907
|
+
clone(parent) {
|
|
908
|
+
const c = new _AST(this.type, parent);
|
|
909
|
+
for (const p of __privateGet(this, _parts)) {
|
|
910
|
+
c.copyIn(p);
|
|
911
|
+
}
|
|
912
|
+
return c;
|
|
913
|
+
}
|
|
914
|
+
static fromGlob(pattern, options = {}) {
|
|
915
|
+
var _a;
|
|
916
|
+
const ast = new _AST(null, void 0, options);
|
|
917
|
+
__privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
|
|
918
|
+
return ast;
|
|
919
|
+
}
|
|
920
|
+
// returns the regular expression if there's magic, or the unescaped
|
|
921
|
+
// string if not.
|
|
922
|
+
toMMPattern() {
|
|
923
|
+
if (this !== __privateGet(this, _root))
|
|
924
|
+
return __privateGet(this, _root).toMMPattern();
|
|
925
|
+
const glob = this.toString();
|
|
926
|
+
const [re, body, hasMagic, uflag] = this.toRegExpSource();
|
|
927
|
+
const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
928
|
+
if (!anyMagic) {
|
|
929
|
+
return body;
|
|
930
|
+
}
|
|
931
|
+
const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
|
|
932
|
+
return Object.assign(new RegExp(`^${re}$`, flags), {
|
|
933
|
+
_src: re,
|
|
934
|
+
_glob: glob
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
get options() {
|
|
938
|
+
return __privateGet(this, _options);
|
|
939
|
+
}
|
|
940
|
+
// returns the string match, the regexp source, whether there's magic
|
|
941
|
+
// in the regexp (so a regular expression is required) and whether or
|
|
942
|
+
// not the uflag is needed for the regular expression (for posix classes)
|
|
943
|
+
// TODO: instead of injecting the start/end at this point, just return
|
|
944
|
+
// the BODY of the regexp, along with the start/end portions suitable
|
|
945
|
+
// for binding the start/end in either a joined full-path makeRe context
|
|
946
|
+
// (where we bind to (^|/), or a standalone matchPart context (where
|
|
947
|
+
// we bind to ^, and not /). Otherwise slashes get duped!
|
|
948
|
+
//
|
|
949
|
+
// In part-matching mode, the start is:
|
|
950
|
+
// - if not isStart: nothing
|
|
951
|
+
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
|
952
|
+
// - if dots allowed or not possible: ^
|
|
953
|
+
// - if dots possible and not allowed: ^(?!\.)
|
|
954
|
+
// end is:
|
|
955
|
+
// - if not isEnd(): nothing
|
|
956
|
+
// - else: $
|
|
957
|
+
//
|
|
958
|
+
// In full-path matching mode, we put the slash at the START of the
|
|
959
|
+
// pattern, so start is:
|
|
960
|
+
// - if first pattern: same as part-matching mode
|
|
961
|
+
// - if not isStart(): nothing
|
|
962
|
+
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
|
963
|
+
// - if dots allowed or not possible: /
|
|
964
|
+
// - if dots possible and not allowed: /(?!\.)
|
|
965
|
+
// end is:
|
|
966
|
+
// - if last pattern, same as part-matching mode
|
|
967
|
+
// - else nothing
|
|
968
|
+
//
|
|
969
|
+
// Always put the (?:$|/) on negated tails, though, because that has to be
|
|
970
|
+
// there to bind the end of the negated pattern portion, and it's easier to
|
|
971
|
+
// just stick it in now rather than try to inject it later in the middle of
|
|
972
|
+
// the pattern.
|
|
973
|
+
//
|
|
974
|
+
// We can just always return the same end, and leave it up to the caller
|
|
975
|
+
// to know whether it's going to be used joined or in parts.
|
|
976
|
+
// And, if the start is adjusted slightly, can do the same there:
|
|
977
|
+
// - if not isStart: nothing
|
|
978
|
+
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
|
979
|
+
// - if dots allowed or not possible: (?:/|^)
|
|
980
|
+
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
|
981
|
+
//
|
|
982
|
+
// But it's better to have a simpler binding without a conditional, for
|
|
983
|
+
// performance, so probably better to return both start options.
|
|
984
|
+
//
|
|
985
|
+
// Then the caller just ignores the end if it's not the first pattern,
|
|
986
|
+
// and the start always gets applied.
|
|
987
|
+
//
|
|
988
|
+
// But that's always going to be $ if it's the ending pattern, or nothing,
|
|
989
|
+
// so the caller can just attach $ at the end of the pattern when building.
|
|
990
|
+
//
|
|
991
|
+
// So the todo is:
|
|
992
|
+
// - better detect what kind of start is needed
|
|
993
|
+
// - return both flavors of starting pattern
|
|
994
|
+
// - attach $ at the end of the pattern when creating the actual RegExp
|
|
995
|
+
//
|
|
996
|
+
// Ah, but wait, no, that all only applies to the root when the first pattern
|
|
997
|
+
// is not an extglob. If the first pattern IS an extglob, then we need all
|
|
998
|
+
// that dot prevention biz to live in the extglob portions, because eg
|
|
999
|
+
// +(*|.x*) can match .xy but not .yx.
|
|
1000
|
+
//
|
|
1001
|
+
// So, return the two flavors if it's #root and the first child is not an
|
|
1002
|
+
// AST, otherwise leave it to the child AST to handle it, and there,
|
|
1003
|
+
// use the (?:^|/) style of start binding.
|
|
1004
|
+
//
|
|
1005
|
+
// Even simplified further:
|
|
1006
|
+
// - Since the start for a join is eg /(?!\.) and the start for a part
|
|
1007
|
+
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
|
1008
|
+
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
1009
|
+
toRegExpSource(allowDot) {
|
|
1010
|
+
var _a;
|
|
1011
|
+
const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
|
|
1012
|
+
if (__privateGet(this, _root) === this)
|
|
1013
|
+
__privateMethod(this, _AST_instances, fillNegs_fn).call(this);
|
|
1014
|
+
if (!this.type) {
|
|
1015
|
+
const noEmpty = this.isStart() && this.isEnd();
|
|
1016
|
+
const src = __privateGet(this, _parts).map((p) => {
|
|
1017
|
+
var _a2;
|
|
1018
|
+
const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a2 = _AST, _AST_static, parseGlob_fn).call(_a2, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
|
|
1019
|
+
__privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
|
|
1020
|
+
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
1021
|
+
return re;
|
|
1022
|
+
}).join("");
|
|
1023
|
+
let start2 = "";
|
|
1024
|
+
if (this.isStart()) {
|
|
1025
|
+
if (typeof __privateGet(this, _parts)[0] === "string") {
|
|
1026
|
+
const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
|
|
1027
|
+
if (!dotTravAllowed) {
|
|
1028
|
+
const aps = addPatternStart;
|
|
1029
|
+
const needNoTrav = (
|
|
1030
|
+
// dots are allowed, and the pattern starts with [ or .
|
|
1031
|
+
dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
1032
|
+
src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
1033
|
+
src.startsWith("\\.\\.") && aps.has(src.charAt(4))
|
|
1034
|
+
);
|
|
1035
|
+
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
1036
|
+
start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
let end = "";
|
|
1041
|
+
if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!") {
|
|
1042
|
+
end = "(?:$|\\/)";
|
|
1043
|
+
}
|
|
1044
|
+
const final2 = start2 + src + end;
|
|
1045
|
+
return [
|
|
1046
|
+
final2,
|
|
1047
|
+
unescape(src),
|
|
1048
|
+
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
1049
|
+
__privateGet(this, _uflag)
|
|
1050
|
+
];
|
|
1051
|
+
}
|
|
1052
|
+
const repeated = this.type === "*" || this.type === "+";
|
|
1053
|
+
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
1054
|
+
let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
|
|
1055
|
+
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
1056
|
+
const s = this.toString();
|
|
1057
|
+
__privateSet(this, _parts, [s]);
|
|
1058
|
+
this.type = null;
|
|
1059
|
+
__privateSet(this, _hasMagic, void 0);
|
|
1060
|
+
return [s, unescape(this.toString()), false, false];
|
|
1061
|
+
}
|
|
1062
|
+
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
|
|
1063
|
+
if (bodyDotAllowed === body) {
|
|
1064
|
+
bodyDotAllowed = "";
|
|
1065
|
+
}
|
|
1066
|
+
if (bodyDotAllowed) {
|
|
1067
|
+
body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
|
1068
|
+
}
|
|
1069
|
+
let final = "";
|
|
1070
|
+
if (this.type === "!" && __privateGet(this, _emptyExt)) {
|
|
1071
|
+
final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
|
|
1072
|
+
} else {
|
|
1073
|
+
const close = this.type === "!" ? (
|
|
1074
|
+
// !() must match something,but !(x) can match ''
|
|
1075
|
+
"))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
|
|
1076
|
+
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
|
|
1077
|
+
final = start + body + close;
|
|
1078
|
+
}
|
|
1079
|
+
return [
|
|
1080
|
+
final,
|
|
1081
|
+
unescape(body),
|
|
1082
|
+
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
1083
|
+
__privateGet(this, _uflag)
|
|
1084
|
+
];
|
|
1085
|
+
}
|
|
1086
|
+
};
|
|
1087
|
+
_root = new WeakMap();
|
|
1088
|
+
_hasMagic = new WeakMap();
|
|
1089
|
+
_uflag = new WeakMap();
|
|
1090
|
+
_parts = new WeakMap();
|
|
1091
|
+
_parent = new WeakMap();
|
|
1092
|
+
_parentIndex = new WeakMap();
|
|
1093
|
+
_negs = new WeakMap();
|
|
1094
|
+
_filledNegs = new WeakMap();
|
|
1095
|
+
_options = new WeakMap();
|
|
1096
|
+
_toString = new WeakMap();
|
|
1097
|
+
_emptyExt = new WeakMap();
|
|
1098
|
+
_AST_instances = new WeakSet();
|
|
1099
|
+
fillNegs_fn = function() {
|
|
1100
|
+
if (this !== __privateGet(this, _root))
|
|
1101
|
+
throw new Error("should only call on root");
|
|
1102
|
+
if (__privateGet(this, _filledNegs))
|
|
1103
|
+
return this;
|
|
1104
|
+
this.toString();
|
|
1105
|
+
__privateSet(this, _filledNegs, true);
|
|
1106
|
+
let n;
|
|
1107
|
+
while (n = __privateGet(this, _negs).pop()) {
|
|
1108
|
+
if (n.type !== "!")
|
|
1109
|
+
continue;
|
|
1110
|
+
let p = n;
|
|
1111
|
+
let pp = __privateGet(p, _parent);
|
|
1112
|
+
while (pp) {
|
|
1113
|
+
for (let i2 = __privateGet(p, _parentIndex) + 1; !pp.type && i2 < __privateGet(pp, _parts).length; i2++) {
|
|
1114
|
+
for (const part of __privateGet(n, _parts)) {
|
|
1115
|
+
if (typeof part === "string") {
|
|
1116
|
+
throw new Error("string part in extglob AST??");
|
|
1117
|
+
}
|
|
1118
|
+
part.copyIn(__privateGet(pp, _parts)[i2]);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
p = pp;
|
|
1122
|
+
pp = __privateGet(p, _parent);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
return this;
|
|
1126
|
+
};
|
|
1127
|
+
_AST_static = new WeakSet();
|
|
1128
|
+
parseAST_fn = function(str, ast, pos, opt) {
|
|
1129
|
+
var _a, _b;
|
|
1130
|
+
let escaping = false;
|
|
1131
|
+
let inBrace = false;
|
|
1132
|
+
let braceStart = -1;
|
|
1133
|
+
let braceNeg = false;
|
|
1134
|
+
if (ast.type === null) {
|
|
1135
|
+
let i3 = pos;
|
|
1136
|
+
let acc2 = "";
|
|
1137
|
+
while (i3 < str.length) {
|
|
1138
|
+
const c = str.charAt(i3++);
|
|
1139
|
+
if (escaping || c === "\\") {
|
|
1140
|
+
escaping = !escaping;
|
|
1141
|
+
acc2 += c;
|
|
1142
|
+
continue;
|
|
1143
|
+
}
|
|
1144
|
+
if (inBrace) {
|
|
1145
|
+
if (i3 === braceStart + 1) {
|
|
1146
|
+
if (c === "^" || c === "!") {
|
|
1147
|
+
braceNeg = true;
|
|
1148
|
+
}
|
|
1149
|
+
} else if (c === "]" && !(i3 === braceStart + 2 && braceNeg)) {
|
|
1150
|
+
inBrace = false;
|
|
1151
|
+
}
|
|
1152
|
+
acc2 += c;
|
|
1153
|
+
continue;
|
|
1154
|
+
} else if (c === "[") {
|
|
1155
|
+
inBrace = true;
|
|
1156
|
+
braceStart = i3;
|
|
1157
|
+
braceNeg = false;
|
|
1158
|
+
acc2 += c;
|
|
1159
|
+
continue;
|
|
1160
|
+
}
|
|
1161
|
+
if (!opt.noext && isExtglobType(c) && str.charAt(i3) === "(") {
|
|
1162
|
+
ast.push(acc2);
|
|
1163
|
+
acc2 = "";
|
|
1164
|
+
const ext2 = new _AST(c, ast);
|
|
1165
|
+
i3 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext2, i3, opt);
|
|
1166
|
+
ast.push(ext2);
|
|
1167
|
+
continue;
|
|
1168
|
+
}
|
|
1169
|
+
acc2 += c;
|
|
1170
|
+
}
|
|
1171
|
+
ast.push(acc2);
|
|
1172
|
+
return i3;
|
|
1173
|
+
}
|
|
1174
|
+
let i2 = pos + 1;
|
|
1175
|
+
let part = new _AST(null, ast);
|
|
1176
|
+
const parts = [];
|
|
1177
|
+
let acc = "";
|
|
1178
|
+
while (i2 < str.length) {
|
|
1179
|
+
const c = str.charAt(i2++);
|
|
1180
|
+
if (escaping || c === "\\") {
|
|
1181
|
+
escaping = !escaping;
|
|
1182
|
+
acc += c;
|
|
1183
|
+
continue;
|
|
1184
|
+
}
|
|
1185
|
+
if (inBrace) {
|
|
1186
|
+
if (i2 === braceStart + 1) {
|
|
1187
|
+
if (c === "^" || c === "!") {
|
|
1188
|
+
braceNeg = true;
|
|
1189
|
+
}
|
|
1190
|
+
} else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
|
|
1191
|
+
inBrace = false;
|
|
1192
|
+
}
|
|
1193
|
+
acc += c;
|
|
1194
|
+
continue;
|
|
1195
|
+
} else if (c === "[") {
|
|
1196
|
+
inBrace = true;
|
|
1197
|
+
braceStart = i2;
|
|
1198
|
+
braceNeg = false;
|
|
1199
|
+
acc += c;
|
|
1200
|
+
continue;
|
|
1201
|
+
}
|
|
1202
|
+
if (isExtglobType(c) && str.charAt(i2) === "(") {
|
|
1203
|
+
part.push(acc);
|
|
1204
|
+
acc = "";
|
|
1205
|
+
const ext2 = new _AST(c, part);
|
|
1206
|
+
part.push(ext2);
|
|
1207
|
+
i2 = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext2, i2, opt);
|
|
1208
|
+
continue;
|
|
1209
|
+
}
|
|
1210
|
+
if (c === "|") {
|
|
1211
|
+
part.push(acc);
|
|
1212
|
+
acc = "";
|
|
1213
|
+
parts.push(part);
|
|
1214
|
+
part = new _AST(null, ast);
|
|
1215
|
+
continue;
|
|
1216
|
+
}
|
|
1217
|
+
if (c === ")") {
|
|
1218
|
+
if (acc === "" && __privateGet(ast, _parts).length === 0) {
|
|
1219
|
+
__privateSet(ast, _emptyExt, true);
|
|
1220
|
+
}
|
|
1221
|
+
part.push(acc);
|
|
1222
|
+
acc = "";
|
|
1223
|
+
ast.push(...parts, part);
|
|
1224
|
+
return i2;
|
|
1225
|
+
}
|
|
1226
|
+
acc += c;
|
|
1227
|
+
}
|
|
1228
|
+
ast.type = null;
|
|
1229
|
+
__privateSet(ast, _hasMagic, void 0);
|
|
1230
|
+
__privateSet(ast, _parts, [str.substring(pos - 1)]);
|
|
1231
|
+
return i2;
|
|
1232
|
+
};
|
|
1233
|
+
partsToRegExp_fn = function(dot) {
|
|
1234
|
+
return __privateGet(this, _parts).map((p) => {
|
|
1235
|
+
if (typeof p === "string") {
|
|
1236
|
+
throw new Error("string type in extglob ast??");
|
|
1237
|
+
}
|
|
1238
|
+
const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
|
|
1239
|
+
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
1240
|
+
return re;
|
|
1241
|
+
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
1242
|
+
};
|
|
1243
|
+
parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
|
|
1244
|
+
let escaping = false;
|
|
1245
|
+
let re = "";
|
|
1246
|
+
let uflag = false;
|
|
1247
|
+
for (let i2 = 0; i2 < glob.length; i2++) {
|
|
1248
|
+
const c = glob.charAt(i2);
|
|
1249
|
+
if (escaping) {
|
|
1250
|
+
escaping = false;
|
|
1251
|
+
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
1252
|
+
continue;
|
|
1253
|
+
}
|
|
1254
|
+
if (c === "\\") {
|
|
1255
|
+
if (i2 === glob.length - 1) {
|
|
1256
|
+
re += "\\\\";
|
|
1257
|
+
} else {
|
|
1258
|
+
escaping = true;
|
|
1259
|
+
}
|
|
1260
|
+
continue;
|
|
1261
|
+
}
|
|
1262
|
+
if (c === "[") {
|
|
1263
|
+
const [src, needUflag, consumed, magic] = parseClass(glob, i2);
|
|
1264
|
+
if (consumed) {
|
|
1265
|
+
re += src;
|
|
1266
|
+
uflag = uflag || needUflag;
|
|
1267
|
+
i2 += consumed - 1;
|
|
1268
|
+
hasMagic = hasMagic || magic;
|
|
1269
|
+
continue;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
if (c === "*") {
|
|
1273
|
+
if (noEmpty && glob === "*")
|
|
1274
|
+
re += starNoEmpty;
|
|
1275
|
+
else
|
|
1276
|
+
re += star;
|
|
1277
|
+
hasMagic = true;
|
|
1278
|
+
continue;
|
|
1279
|
+
}
|
|
1280
|
+
if (c === "?") {
|
|
1281
|
+
re += qmark;
|
|
1282
|
+
hasMagic = true;
|
|
1283
|
+
continue;
|
|
1284
|
+
}
|
|
1285
|
+
re += regExpEscape(c);
|
|
1286
|
+
}
|
|
1287
|
+
return [re, unescape(glob), !!hasMagic, uflag];
|
|
1288
|
+
};
|
|
1289
|
+
__privateAdd(_AST, _AST_static);
|
|
1290
|
+
var AST = _AST;
|
|
1291
|
+
|
|
1292
|
+
// node_modules/minimatch/dist/esm/escape.js
|
|
1293
|
+
var escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
1294
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
1295
|
+
};
|
|
1296
|
+
|
|
1297
|
+
// node_modules/minimatch/dist/esm/index.js
|
|
1298
|
+
var minimatch = (p, pattern, options = {}) => {
|
|
1299
|
+
assertValidPattern(pattern);
|
|
1300
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
1301
|
+
return false;
|
|
1302
|
+
}
|
|
1303
|
+
return new Minimatch(pattern, options).match(p);
|
|
1304
|
+
};
|
|
1305
|
+
var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
|
|
1306
|
+
var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
|
|
1307
|
+
var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
|
|
1308
|
+
var starDotExtTestNocase = (ext2) => {
|
|
1309
|
+
ext2 = ext2.toLowerCase();
|
|
1310
|
+
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
|
|
1311
|
+
};
|
|
1312
|
+
var starDotExtTestNocaseDot = (ext2) => {
|
|
1313
|
+
ext2 = ext2.toLowerCase();
|
|
1314
|
+
return (f) => f.toLowerCase().endsWith(ext2);
|
|
1315
|
+
};
|
|
1316
|
+
var starDotStarRE = /^\*+\.\*+$/;
|
|
1317
|
+
var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
1318
|
+
var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
1319
|
+
var dotStarRE = /^\.\*+$/;
|
|
1320
|
+
var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
1321
|
+
var starRE = /^\*+$/;
|
|
1322
|
+
var starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
1323
|
+
var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
1324
|
+
var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
1325
|
+
var qmarksTestNocase = ([$0, ext2 = ""]) => {
|
|
1326
|
+
const noext = qmarksTestNoExt([$0]);
|
|
1327
|
+
if (!ext2)
|
|
1328
|
+
return noext;
|
|
1329
|
+
ext2 = ext2.toLowerCase();
|
|
1330
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
1331
|
+
};
|
|
1332
|
+
var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
|
|
1333
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
1334
|
+
if (!ext2)
|
|
1335
|
+
return noext;
|
|
1336
|
+
ext2 = ext2.toLowerCase();
|
|
1337
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
1338
|
+
};
|
|
1339
|
+
var qmarksTestDot = ([$0, ext2 = ""]) => {
|
|
1340
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
1341
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
1342
|
+
};
|
|
1343
|
+
var qmarksTest = ([$0, ext2 = ""]) => {
|
|
1344
|
+
const noext = qmarksTestNoExt([$0]);
|
|
1345
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
1346
|
+
};
|
|
1347
|
+
var qmarksTestNoExt = ([$0]) => {
|
|
1348
|
+
const len = $0.length;
|
|
1349
|
+
return (f) => f.length === len && !f.startsWith(".");
|
|
1350
|
+
};
|
|
1351
|
+
var qmarksTestNoExtDot = ([$0]) => {
|
|
1352
|
+
const len = $0.length;
|
|
1353
|
+
return (f) => f.length === len && f !== "." && f !== "..";
|
|
1354
|
+
};
|
|
1355
|
+
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
1356
|
+
var path = {
|
|
1357
|
+
win32: { sep: "\\" },
|
|
1358
|
+
posix: { sep: "/" }
|
|
1359
|
+
};
|
|
1360
|
+
var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
|
|
1361
|
+
minimatch.sep = sep;
|
|
1362
|
+
var GLOBSTAR = Symbol("globstar **");
|
|
1363
|
+
minimatch.GLOBSTAR = GLOBSTAR;
|
|
1364
|
+
var qmark2 = "[^/]";
|
|
1365
|
+
var star2 = qmark2 + "*?";
|
|
1366
|
+
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
1367
|
+
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
1368
|
+
var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
|
|
1369
|
+
minimatch.filter = filter;
|
|
1370
|
+
var ext = (a, b = {}) => Object.assign({}, a, b);
|
|
1371
|
+
var defaults = (def) => {
|
|
1372
|
+
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
1373
|
+
return minimatch;
|
|
1374
|
+
}
|
|
1375
|
+
const orig = minimatch;
|
|
1376
|
+
const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
|
|
1377
|
+
return Object.assign(m, {
|
|
1378
|
+
Minimatch: class Minimatch extends orig.Minimatch {
|
|
1379
|
+
constructor(pattern, options = {}) {
|
|
1380
|
+
super(pattern, ext(def, options));
|
|
1381
|
+
}
|
|
1382
|
+
static defaults(options) {
|
|
1383
|
+
return orig.defaults(ext(def, options)).Minimatch;
|
|
1384
|
+
}
|
|
1385
|
+
},
|
|
1386
|
+
AST: class AST extends orig.AST {
|
|
1387
|
+
/* c8 ignore start */
|
|
1388
|
+
constructor(type, parent, options = {}) {
|
|
1389
|
+
super(type, parent, ext(def, options));
|
|
1390
|
+
}
|
|
1391
|
+
/* c8 ignore stop */
|
|
1392
|
+
static fromGlob(pattern, options = {}) {
|
|
1393
|
+
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
1394
|
+
}
|
|
1395
|
+
},
|
|
1396
|
+
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
1397
|
+
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
1398
|
+
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
1399
|
+
defaults: (options) => orig.defaults(ext(def, options)),
|
|
1400
|
+
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
1401
|
+
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
1402
|
+
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
|
|
1403
|
+
sep: orig.sep,
|
|
1404
|
+
GLOBSTAR
|
|
1405
|
+
});
|
|
1406
|
+
};
|
|
1407
|
+
minimatch.defaults = defaults;
|
|
1408
|
+
var braceExpand = (pattern, options = {}) => {
|
|
1409
|
+
assertValidPattern(pattern);
|
|
1410
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
1411
|
+
return [pattern];
|
|
1412
|
+
}
|
|
1413
|
+
return (0, import_brace_expansion.default)(pattern);
|
|
1414
|
+
};
|
|
1415
|
+
minimatch.braceExpand = braceExpand;
|
|
1416
|
+
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
1417
|
+
minimatch.makeRe = makeRe;
|
|
1418
|
+
var match = (list, pattern, options = {}) => {
|
|
1419
|
+
const mm = new Minimatch(pattern, options);
|
|
1420
|
+
list = list.filter((f) => mm.match(f));
|
|
1421
|
+
if (mm.options.nonull && !list.length) {
|
|
1422
|
+
list.push(pattern);
|
|
1423
|
+
}
|
|
1424
|
+
return list;
|
|
1425
|
+
};
|
|
1426
|
+
minimatch.match = match;
|
|
1427
|
+
var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
1428
|
+
var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1429
|
+
var Minimatch = class {
|
|
1430
|
+
options;
|
|
1431
|
+
set;
|
|
1432
|
+
pattern;
|
|
1433
|
+
windowsPathsNoEscape;
|
|
1434
|
+
nonegate;
|
|
1435
|
+
negate;
|
|
1436
|
+
comment;
|
|
1437
|
+
empty;
|
|
1438
|
+
preserveMultipleSlashes;
|
|
1439
|
+
partial;
|
|
1440
|
+
globSet;
|
|
1441
|
+
globParts;
|
|
1442
|
+
nocase;
|
|
1443
|
+
isWindows;
|
|
1444
|
+
platform;
|
|
1445
|
+
windowsNoMagicRoot;
|
|
1446
|
+
regexp;
|
|
1447
|
+
constructor(pattern, options = {}) {
|
|
1448
|
+
assertValidPattern(pattern);
|
|
1449
|
+
options = options || {};
|
|
1450
|
+
this.options = options;
|
|
1451
|
+
this.pattern = pattern;
|
|
1452
|
+
this.platform = options.platform || defaultPlatform;
|
|
1453
|
+
this.isWindows = this.platform === "win32";
|
|
1454
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
|
1455
|
+
if (this.windowsPathsNoEscape) {
|
|
1456
|
+
this.pattern = this.pattern.replace(/\\/g, "/");
|
|
1457
|
+
}
|
|
1458
|
+
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
1459
|
+
this.regexp = null;
|
|
1460
|
+
this.negate = false;
|
|
1461
|
+
this.nonegate = !!options.nonegate;
|
|
1462
|
+
this.comment = false;
|
|
1463
|
+
this.empty = false;
|
|
1464
|
+
this.partial = !!options.partial;
|
|
1465
|
+
this.nocase = !!this.options.nocase;
|
|
1466
|
+
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
1467
|
+
this.globSet = [];
|
|
1468
|
+
this.globParts = [];
|
|
1469
|
+
this.set = [];
|
|
1470
|
+
this.make();
|
|
1471
|
+
}
|
|
1472
|
+
hasMagic() {
|
|
1473
|
+
if (this.options.magicalBraces && this.set.length > 1) {
|
|
1474
|
+
return true;
|
|
1475
|
+
}
|
|
1476
|
+
for (const pattern of this.set) {
|
|
1477
|
+
for (const part of pattern) {
|
|
1478
|
+
if (typeof part !== "string")
|
|
1479
|
+
return true;
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
return false;
|
|
1483
|
+
}
|
|
1484
|
+
debug(..._) {
|
|
1485
|
+
}
|
|
1486
|
+
make() {
|
|
1487
|
+
const pattern = this.pattern;
|
|
1488
|
+
const options = this.options;
|
|
1489
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
1490
|
+
this.comment = true;
|
|
1491
|
+
return;
|
|
1492
|
+
}
|
|
1493
|
+
if (!pattern) {
|
|
1494
|
+
this.empty = true;
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
this.parseNegate();
|
|
1498
|
+
this.globSet = [...new Set(this.braceExpand())];
|
|
1499
|
+
if (options.debug) {
|
|
1500
|
+
this.debug = (...args) => console.error(...args);
|
|
1501
|
+
}
|
|
1502
|
+
this.debug(this.pattern, this.globSet);
|
|
1503
|
+
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
1504
|
+
this.globParts = this.preprocess(rawGlobParts);
|
|
1505
|
+
this.debug(this.pattern, this.globParts);
|
|
1506
|
+
let set = this.globParts.map((s, _, __) => {
|
|
1507
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
1508
|
+
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
1509
|
+
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
1510
|
+
if (isUNC) {
|
|
1511
|
+
return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
1512
|
+
} else if (isDrive) {
|
|
1513
|
+
return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
return s.map((ss) => this.parse(ss));
|
|
1517
|
+
});
|
|
1518
|
+
this.debug(this.pattern, set);
|
|
1519
|
+
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
1520
|
+
if (this.isWindows) {
|
|
1521
|
+
for (let i2 = 0; i2 < this.set.length; i2++) {
|
|
1522
|
+
const p = this.set[i2];
|
|
1523
|
+
if (p[0] === "" && p[1] === "" && this.globParts[i2][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
|
|
1524
|
+
p[2] = "?";
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
this.debug(this.pattern, this.set);
|
|
1529
|
+
}
|
|
1530
|
+
// various transforms to equivalent pattern sets that are
|
|
1531
|
+
// faster to process in a filesystem walk. The goal is to
|
|
1532
|
+
// eliminate what we can, and push all ** patterns as far
|
|
1533
|
+
// to the right as possible, even if it increases the number
|
|
1534
|
+
// of patterns that we have to process.
|
|
1535
|
+
preprocess(globParts) {
|
|
1536
|
+
if (this.options.noglobstar) {
|
|
1537
|
+
for (let i2 = 0; i2 < globParts.length; i2++) {
|
|
1538
|
+
for (let j = 0; j < globParts[i2].length; j++) {
|
|
1539
|
+
if (globParts[i2][j] === "**") {
|
|
1540
|
+
globParts[i2][j] = "*";
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
const { optimizationLevel = 1 } = this.options;
|
|
1546
|
+
if (optimizationLevel >= 2) {
|
|
1547
|
+
globParts = this.firstPhasePreProcess(globParts);
|
|
1548
|
+
globParts = this.secondPhasePreProcess(globParts);
|
|
1549
|
+
} else if (optimizationLevel >= 1) {
|
|
1550
|
+
globParts = this.levelOneOptimize(globParts);
|
|
1551
|
+
} else {
|
|
1552
|
+
globParts = this.adjascentGlobstarOptimize(globParts);
|
|
1553
|
+
}
|
|
1554
|
+
return globParts;
|
|
1555
|
+
}
|
|
1556
|
+
// just get rid of adjascent ** portions
|
|
1557
|
+
adjascentGlobstarOptimize(globParts) {
|
|
1558
|
+
return globParts.map((parts) => {
|
|
1559
|
+
let gs = -1;
|
|
1560
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1561
|
+
let i2 = gs;
|
|
1562
|
+
while (parts[i2 + 1] === "**") {
|
|
1563
|
+
i2++;
|
|
1564
|
+
}
|
|
1565
|
+
if (i2 !== gs) {
|
|
1566
|
+
parts.splice(gs, i2 - gs);
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
return parts;
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1572
|
+
// get rid of adjascent ** and resolve .. portions
|
|
1573
|
+
levelOneOptimize(globParts) {
|
|
1574
|
+
return globParts.map((parts) => {
|
|
1575
|
+
parts = parts.reduce((set, part) => {
|
|
1576
|
+
const prev = set[set.length - 1];
|
|
1577
|
+
if (part === "**" && prev === "**") {
|
|
1578
|
+
return set;
|
|
1579
|
+
}
|
|
1580
|
+
if (part === "..") {
|
|
1581
|
+
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
1582
|
+
set.pop();
|
|
1583
|
+
return set;
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
set.push(part);
|
|
1587
|
+
return set;
|
|
1588
|
+
}, []);
|
|
1589
|
+
return parts.length === 0 ? [""] : parts;
|
|
1590
|
+
});
|
|
1591
|
+
}
|
|
1592
|
+
levelTwoFileOptimize(parts) {
|
|
1593
|
+
if (!Array.isArray(parts)) {
|
|
1594
|
+
parts = this.slashSplit(parts);
|
|
1595
|
+
}
|
|
1596
|
+
let didSomething = false;
|
|
1597
|
+
do {
|
|
1598
|
+
didSomething = false;
|
|
1599
|
+
if (!this.preserveMultipleSlashes) {
|
|
1600
|
+
for (let i2 = 1; i2 < parts.length - 1; i2++) {
|
|
1601
|
+
const p = parts[i2];
|
|
1602
|
+
if (i2 === 1 && p === "" && parts[0] === "")
|
|
1603
|
+
continue;
|
|
1604
|
+
if (p === "." || p === "") {
|
|
1605
|
+
didSomething = true;
|
|
1606
|
+
parts.splice(i2, 1);
|
|
1607
|
+
i2--;
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1611
|
+
didSomething = true;
|
|
1612
|
+
parts.pop();
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
let dd = 0;
|
|
1616
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1617
|
+
const p = parts[dd - 1];
|
|
1618
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1619
|
+
didSomething = true;
|
|
1620
|
+
parts.splice(dd - 1, 2);
|
|
1621
|
+
dd -= 2;
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
} while (didSomething);
|
|
1625
|
+
return parts.length === 0 ? [""] : parts;
|
|
1626
|
+
}
|
|
1627
|
+
// First phase: single-pattern processing
|
|
1628
|
+
// <pre> is 1 or more portions
|
|
1629
|
+
// <rest> is 1 or more portions
|
|
1630
|
+
// <p> is any portion other than ., .., '', or **
|
|
1631
|
+
// <e> is . or ''
|
|
1632
|
+
//
|
|
1633
|
+
// **/.. is *brutal* for filesystem walking performance, because
|
|
1634
|
+
// it effectively resets the recursive walk each time it occurs,
|
|
1635
|
+
// and ** cannot be reduced out by a .. pattern part like a regexp
|
|
1636
|
+
// or most strings (other than .., ., and '') can be.
|
|
1637
|
+
//
|
|
1638
|
+
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
|
|
1639
|
+
// <pre>/<e>/<rest> -> <pre>/<rest>
|
|
1640
|
+
// <pre>/<p>/../<rest> -> <pre>/<rest>
|
|
1641
|
+
// **/**/<rest> -> **/<rest>
|
|
1642
|
+
//
|
|
1643
|
+
// **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
|
|
1644
|
+
// this WOULD be allowed if ** did follow symlinks, or * didn't
|
|
1645
|
+
firstPhasePreProcess(globParts) {
|
|
1646
|
+
let didSomething = false;
|
|
1647
|
+
do {
|
|
1648
|
+
didSomething = false;
|
|
1649
|
+
for (let parts of globParts) {
|
|
1650
|
+
let gs = -1;
|
|
1651
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1652
|
+
let gss = gs;
|
|
1653
|
+
while (parts[gss + 1] === "**") {
|
|
1654
|
+
gss++;
|
|
1655
|
+
}
|
|
1656
|
+
if (gss > gs) {
|
|
1657
|
+
parts.splice(gs + 1, gss - gs);
|
|
1658
|
+
}
|
|
1659
|
+
let next = parts[gs + 1];
|
|
1660
|
+
const p = parts[gs + 2];
|
|
1661
|
+
const p2 = parts[gs + 3];
|
|
1662
|
+
if (next !== "..")
|
|
1663
|
+
continue;
|
|
1664
|
+
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
|
|
1665
|
+
continue;
|
|
1666
|
+
}
|
|
1667
|
+
didSomething = true;
|
|
1668
|
+
parts.splice(gs, 1);
|
|
1669
|
+
const other = parts.slice(0);
|
|
1670
|
+
other[gs] = "**";
|
|
1671
|
+
globParts.push(other);
|
|
1672
|
+
gs--;
|
|
1673
|
+
}
|
|
1674
|
+
if (!this.preserveMultipleSlashes) {
|
|
1675
|
+
for (let i2 = 1; i2 < parts.length - 1; i2++) {
|
|
1676
|
+
const p = parts[i2];
|
|
1677
|
+
if (i2 === 1 && p === "" && parts[0] === "")
|
|
1678
|
+
continue;
|
|
1679
|
+
if (p === "." || p === "") {
|
|
1680
|
+
didSomething = true;
|
|
1681
|
+
parts.splice(i2, 1);
|
|
1682
|
+
i2--;
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1686
|
+
didSomething = true;
|
|
1687
|
+
parts.pop();
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
let dd = 0;
|
|
1691
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1692
|
+
const p = parts[dd - 1];
|
|
1693
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1694
|
+
didSomething = true;
|
|
1695
|
+
const needDot = dd === 1 && parts[dd + 1] === "**";
|
|
1696
|
+
const splin = needDot ? ["."] : [];
|
|
1697
|
+
parts.splice(dd - 1, 2, ...splin);
|
|
1698
|
+
if (parts.length === 0)
|
|
1699
|
+
parts.push("");
|
|
1700
|
+
dd -= 2;
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
} while (didSomething);
|
|
1705
|
+
return globParts;
|
|
1706
|
+
}
|
|
1707
|
+
// second phase: multi-pattern dedupes
|
|
1708
|
+
// {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
|
|
1709
|
+
// {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
|
|
1710
|
+
// {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
|
|
1711
|
+
//
|
|
1712
|
+
// {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
|
|
1713
|
+
// ^-- not valid because ** doens't follow symlinks
|
|
1714
|
+
secondPhasePreProcess(globParts) {
|
|
1715
|
+
for (let i2 = 0; i2 < globParts.length - 1; i2++) {
|
|
1716
|
+
for (let j = i2 + 1; j < globParts.length; j++) {
|
|
1717
|
+
const matched = this.partsMatch(globParts[i2], globParts[j], !this.preserveMultipleSlashes);
|
|
1718
|
+
if (!matched)
|
|
1719
|
+
continue;
|
|
1720
|
+
globParts[i2] = matched;
|
|
1721
|
+
globParts[j] = [];
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
return globParts.filter((gs) => gs.length);
|
|
1725
|
+
}
|
|
1726
|
+
partsMatch(a, b, emptyGSMatch = false) {
|
|
1727
|
+
let ai = 0;
|
|
1728
|
+
let bi = 0;
|
|
1729
|
+
let result = [];
|
|
1730
|
+
let which = "";
|
|
1731
|
+
while (ai < a.length && bi < b.length) {
|
|
1732
|
+
if (a[ai] === b[bi]) {
|
|
1733
|
+
result.push(which === "b" ? b[bi] : a[ai]);
|
|
1734
|
+
ai++;
|
|
1735
|
+
bi++;
|
|
1736
|
+
} else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
|
|
1737
|
+
result.push(a[ai]);
|
|
1738
|
+
ai++;
|
|
1739
|
+
} else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
|
|
1740
|
+
result.push(b[bi]);
|
|
1741
|
+
bi++;
|
|
1742
|
+
} else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
|
|
1743
|
+
if (which === "b")
|
|
1744
|
+
return false;
|
|
1745
|
+
which = "a";
|
|
1746
|
+
result.push(a[ai]);
|
|
1747
|
+
ai++;
|
|
1748
|
+
bi++;
|
|
1749
|
+
} else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
|
|
1750
|
+
if (which === "a")
|
|
1751
|
+
return false;
|
|
1752
|
+
which = "b";
|
|
1753
|
+
result.push(b[bi]);
|
|
1754
|
+
ai++;
|
|
1755
|
+
bi++;
|
|
1756
|
+
} else {
|
|
1757
|
+
return false;
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
return a.length === b.length && result;
|
|
1761
|
+
}
|
|
1762
|
+
parseNegate() {
|
|
1763
|
+
if (this.nonegate)
|
|
1764
|
+
return;
|
|
1765
|
+
const pattern = this.pattern;
|
|
1766
|
+
let negate = false;
|
|
1767
|
+
let negateOffset = 0;
|
|
1768
|
+
for (let i2 = 0; i2 < pattern.length && pattern.charAt(i2) === "!"; i2++) {
|
|
1769
|
+
negate = !negate;
|
|
1770
|
+
negateOffset++;
|
|
1771
|
+
}
|
|
1772
|
+
if (negateOffset)
|
|
1773
|
+
this.pattern = pattern.slice(negateOffset);
|
|
1774
|
+
this.negate = negate;
|
|
1775
|
+
}
|
|
1776
|
+
// set partial to true to test if, for example,
|
|
1777
|
+
// "/a/b" matches the start of "/*/b/*/d"
|
|
1778
|
+
// Partial means, if you run out of file before you run
|
|
1779
|
+
// out of pattern, then that's fine, as long as all
|
|
1780
|
+
// the parts match.
|
|
1781
|
+
matchOne(file, pattern, partial = false) {
|
|
1782
|
+
const options = this.options;
|
|
1783
|
+
if (this.isWindows) {
|
|
1784
|
+
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
1785
|
+
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
1786
|
+
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
1787
|
+
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
1788
|
+
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
1789
|
+
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
1790
|
+
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
1791
|
+
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
1792
|
+
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
1793
|
+
pattern[pdi] = fd;
|
|
1794
|
+
if (pdi > fdi) {
|
|
1795
|
+
pattern = pattern.slice(pdi);
|
|
1796
|
+
} else if (fdi > pdi) {
|
|
1797
|
+
file = file.slice(fdi);
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
const { optimizationLevel = 1 } = this.options;
|
|
1803
|
+
if (optimizationLevel >= 2) {
|
|
1804
|
+
file = this.levelTwoFileOptimize(file);
|
|
1805
|
+
}
|
|
1806
|
+
this.debug("matchOne", this, { file, pattern });
|
|
1807
|
+
this.debug("matchOne", file.length, pattern.length);
|
|
1808
|
+
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
1809
|
+
this.debug("matchOne loop");
|
|
1810
|
+
var p = pattern[pi];
|
|
1811
|
+
var f = file[fi];
|
|
1812
|
+
this.debug(pattern, p, f);
|
|
1813
|
+
if (p === false) {
|
|
1814
|
+
return false;
|
|
1815
|
+
}
|
|
1816
|
+
if (p === GLOBSTAR) {
|
|
1817
|
+
this.debug("GLOBSTAR", [pattern, p, f]);
|
|
1818
|
+
var fr = fi;
|
|
1819
|
+
var pr = pi + 1;
|
|
1820
|
+
if (pr === pl) {
|
|
1821
|
+
this.debug("** at the end");
|
|
1822
|
+
for (; fi < fl; fi++) {
|
|
1823
|
+
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
|
1824
|
+
return false;
|
|
1825
|
+
}
|
|
1826
|
+
return true;
|
|
1827
|
+
}
|
|
1828
|
+
while (fr < fl) {
|
|
1829
|
+
var swallowee = file[fr];
|
|
1830
|
+
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
1831
|
+
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
1832
|
+
this.debug("globstar found match!", fr, fl, swallowee);
|
|
1833
|
+
return true;
|
|
1834
|
+
} else {
|
|
1835
|
+
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
1836
|
+
this.debug("dot detected!", file, fr, pattern, pr);
|
|
1837
|
+
break;
|
|
1838
|
+
}
|
|
1839
|
+
this.debug("globstar swallow a segment, and continue");
|
|
1840
|
+
fr++;
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
if (partial) {
|
|
1844
|
+
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
1845
|
+
if (fr === fl) {
|
|
1846
|
+
return true;
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
return false;
|
|
1850
|
+
}
|
|
1851
|
+
let hit;
|
|
1852
|
+
if (typeof p === "string") {
|
|
1853
|
+
hit = f === p;
|
|
1854
|
+
this.debug("string match", p, f, hit);
|
|
1855
|
+
} else {
|
|
1856
|
+
hit = p.test(f);
|
|
1857
|
+
this.debug("pattern match", p, f, hit);
|
|
1858
|
+
}
|
|
1859
|
+
if (!hit)
|
|
1860
|
+
return false;
|
|
1861
|
+
}
|
|
1862
|
+
if (fi === fl && pi === pl) {
|
|
1863
|
+
return true;
|
|
1864
|
+
} else if (fi === fl) {
|
|
1865
|
+
return partial;
|
|
1866
|
+
} else if (pi === pl) {
|
|
1867
|
+
return fi === fl - 1 && file[fi] === "";
|
|
1868
|
+
} else {
|
|
1869
|
+
throw new Error("wtf?");
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
braceExpand() {
|
|
1873
|
+
return braceExpand(this.pattern, this.options);
|
|
1874
|
+
}
|
|
1875
|
+
parse(pattern) {
|
|
1876
|
+
assertValidPattern(pattern);
|
|
1877
|
+
const options = this.options;
|
|
1878
|
+
if (pattern === "**")
|
|
1879
|
+
return GLOBSTAR;
|
|
1880
|
+
if (pattern === "")
|
|
1881
|
+
return "";
|
|
1882
|
+
let m;
|
|
1883
|
+
let fastTest = null;
|
|
1884
|
+
if (m = pattern.match(starRE)) {
|
|
1885
|
+
fastTest = options.dot ? starTestDot : starTest;
|
|
1886
|
+
} else if (m = pattern.match(starDotExtRE)) {
|
|
1887
|
+
fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
1888
|
+
} else if (m = pattern.match(qmarksRE)) {
|
|
1889
|
+
fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
1890
|
+
} else if (m = pattern.match(starDotStarRE)) {
|
|
1891
|
+
fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
1892
|
+
} else if (m = pattern.match(dotStarRE)) {
|
|
1893
|
+
fastTest = dotStarTest;
|
|
1894
|
+
}
|
|
1895
|
+
const re = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
1896
|
+
if (fastTest && typeof re === "object") {
|
|
1897
|
+
Reflect.defineProperty(re, "test", { value: fastTest });
|
|
1898
|
+
}
|
|
1899
|
+
return re;
|
|
1900
|
+
}
|
|
1901
|
+
makeRe() {
|
|
1902
|
+
if (this.regexp || this.regexp === false)
|
|
1903
|
+
return this.regexp;
|
|
1904
|
+
const set = this.set;
|
|
1905
|
+
if (!set.length) {
|
|
1906
|
+
this.regexp = false;
|
|
1907
|
+
return this.regexp;
|
|
1908
|
+
}
|
|
1909
|
+
const options = this.options;
|
|
1910
|
+
const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
|
|
1911
|
+
const flags = new Set(options.nocase ? ["i"] : []);
|
|
1912
|
+
let re = set.map((pattern) => {
|
|
1913
|
+
const pp = pattern.map((p) => {
|
|
1914
|
+
if (p instanceof RegExp) {
|
|
1915
|
+
for (const f of p.flags.split(""))
|
|
1916
|
+
flags.add(f);
|
|
1917
|
+
}
|
|
1918
|
+
return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
|
|
1919
|
+
});
|
|
1920
|
+
pp.forEach((p, i2) => {
|
|
1921
|
+
const next = pp[i2 + 1];
|
|
1922
|
+
const prev = pp[i2 - 1];
|
|
1923
|
+
if (p !== GLOBSTAR || prev === GLOBSTAR) {
|
|
1924
|
+
return;
|
|
1925
|
+
}
|
|
1926
|
+
if (prev === void 0) {
|
|
1927
|
+
if (next !== void 0 && next !== GLOBSTAR) {
|
|
1928
|
+
pp[i2 + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
1929
|
+
} else {
|
|
1930
|
+
pp[i2] = twoStar;
|
|
1931
|
+
}
|
|
1932
|
+
} else if (next === void 0) {
|
|
1933
|
+
pp[i2 - 1] = prev + "(?:\\/|" + twoStar + ")?";
|
|
1934
|
+
} else if (next !== GLOBSTAR) {
|
|
1935
|
+
pp[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
1936
|
+
pp[i2 + 1] = GLOBSTAR;
|
|
1937
|
+
}
|
|
1938
|
+
});
|
|
1939
|
+
return pp.filter((p) => p !== GLOBSTAR).join("/");
|
|
1940
|
+
}).join("|");
|
|
1941
|
+
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
1942
|
+
re = "^" + open + re + close + "$";
|
|
1943
|
+
if (this.negate)
|
|
1944
|
+
re = "^(?!" + re + ").+$";
|
|
1945
|
+
try {
|
|
1946
|
+
this.regexp = new RegExp(re, [...flags].join(""));
|
|
1947
|
+
} catch (ex) {
|
|
1948
|
+
this.regexp = false;
|
|
1949
|
+
}
|
|
1950
|
+
return this.regexp;
|
|
1951
|
+
}
|
|
1952
|
+
slashSplit(p) {
|
|
1953
|
+
if (this.preserveMultipleSlashes) {
|
|
1954
|
+
return p.split("/");
|
|
1955
|
+
} else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
|
|
1956
|
+
return ["", ...p.split(/\/+/)];
|
|
1957
|
+
} else {
|
|
1958
|
+
return p.split(/\/+/);
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
match(f, partial = this.partial) {
|
|
1962
|
+
this.debug("match", f, this.pattern);
|
|
1963
|
+
if (this.comment) {
|
|
1964
|
+
return false;
|
|
1965
|
+
}
|
|
1966
|
+
if (this.empty) {
|
|
1967
|
+
return f === "";
|
|
1968
|
+
}
|
|
1969
|
+
if (f === "/" && partial) {
|
|
1970
|
+
return true;
|
|
1971
|
+
}
|
|
1972
|
+
const options = this.options;
|
|
1973
|
+
if (this.isWindows) {
|
|
1974
|
+
f = f.split("\\").join("/");
|
|
1975
|
+
}
|
|
1976
|
+
const ff = this.slashSplit(f);
|
|
1977
|
+
this.debug(this.pattern, "split", ff);
|
|
1978
|
+
const set = this.set;
|
|
1979
|
+
this.debug(this.pattern, "set", set);
|
|
1980
|
+
let filename = ff[ff.length - 1];
|
|
1981
|
+
if (!filename) {
|
|
1982
|
+
for (let i2 = ff.length - 2; !filename && i2 >= 0; i2--) {
|
|
1983
|
+
filename = ff[i2];
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
for (let i2 = 0; i2 < set.length; i2++) {
|
|
1987
|
+
const pattern = set[i2];
|
|
1988
|
+
let file = ff;
|
|
1989
|
+
if (options.matchBase && pattern.length === 1) {
|
|
1990
|
+
file = [filename];
|
|
1991
|
+
}
|
|
1992
|
+
const hit = this.matchOne(file, pattern, partial);
|
|
1993
|
+
if (hit) {
|
|
1994
|
+
if (options.flipNegate) {
|
|
1995
|
+
return true;
|
|
1996
|
+
}
|
|
1997
|
+
return !this.negate;
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
if (options.flipNegate) {
|
|
2001
|
+
return false;
|
|
2002
|
+
}
|
|
2003
|
+
return this.negate;
|
|
2004
|
+
}
|
|
2005
|
+
static defaults(def) {
|
|
2006
|
+
return minimatch.defaults(def).Minimatch;
|
|
2007
|
+
}
|
|
2008
|
+
};
|
|
2009
|
+
minimatch.AST = AST;
|
|
2010
|
+
minimatch.Minimatch = Minimatch;
|
|
2011
|
+
minimatch.escape = escape;
|
|
2012
|
+
minimatch.unescape = unescape;
|
|
2013
|
+
|
|
430
2014
|
// src/utils/query-nonce-meta-tag-content.ts
|
|
431
2015
|
function queryNonceMetaTagContent(doc) {
|
|
432
2016
|
var _a, _b, _c;
|
|
@@ -599,6 +2183,31 @@ var globalStyles = (
|
|
|
599
2183
|
""
|
|
600
2184
|
);
|
|
601
2185
|
|
|
2186
|
+
// src/runtime/runtime-constants.ts
|
|
2187
|
+
var CONTENT_REF_ID = "r";
|
|
2188
|
+
var ORG_LOCATION_ID = "o";
|
|
2189
|
+
var SLOT_NODE_ID = "s";
|
|
2190
|
+
var TEXT_NODE_ID = "t";
|
|
2191
|
+
var COMMENT_NODE_ID = "c";
|
|
2192
|
+
var HYDRATE_ID = "s-id";
|
|
2193
|
+
var HYDRATED_STYLE_ID = "sty-id";
|
|
2194
|
+
var HYDRATE_CHILD_ID = "c-id";
|
|
2195
|
+
var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
2196
|
+
var STENCIL_DOC_DATA = "_stencilDocData";
|
|
2197
|
+
var DEFAULT_DOC_DATA = {
|
|
2198
|
+
hostIds: 0,
|
|
2199
|
+
rootLevelIds: 0,
|
|
2200
|
+
staticComponents: /* @__PURE__ */ new Set()
|
|
2201
|
+
};
|
|
2202
|
+
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
2203
|
+
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
2204
|
+
var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
|
2205
|
+
"formAssociatedCallback",
|
|
2206
|
+
"formResetCallback",
|
|
2207
|
+
"formDisabledCallback",
|
|
2208
|
+
"formStateRestoreCallback"
|
|
2209
|
+
];
|
|
2210
|
+
|
|
602
2211
|
// src/utils/style.ts
|
|
603
2212
|
function createStyleSheetIfNeededAndSupported(styles2) {
|
|
604
2213
|
if (!styles2 || !supportsConstructableStylesheets) return void 0;
|
|
@@ -609,12 +2218,20 @@ function createStyleSheetIfNeededAndSupported(styles2) {
|
|
|
609
2218
|
|
|
610
2219
|
// src/utils/shadow-root.ts
|
|
611
2220
|
var globalStyleSheet;
|
|
2221
|
+
var GLOBAL_STYLE_ID = "sc-global";
|
|
612
2222
|
function createShadowRoot(cmpMeta) {
|
|
613
2223
|
var _a;
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
delegatesFocus
|
|
617
|
-
}
|
|
2224
|
+
const opts = { mode: "open" };
|
|
2225
|
+
if (import_app_data.BUILD.shadowDelegatesFocus) {
|
|
2226
|
+
opts.delegatesFocus = !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */);
|
|
2227
|
+
}
|
|
2228
|
+
if (import_app_data.BUILD.shadowSlotAssignmentManual) {
|
|
2229
|
+
const isManual = !!(cmpMeta.$flags$ & 1024 /* shadowSlotAssignmentManual */);
|
|
2230
|
+
if (isManual) {
|
|
2231
|
+
opts.slotAssignment = "manual";
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
const shadowRoot = this.attachShadow(opts);
|
|
618
2235
|
if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported(globalStyles)) != null ? _a : null;
|
|
619
2236
|
if (globalStyleSheet) {
|
|
620
2237
|
if (supportsMutableAdoptedStyleSheets) {
|
|
@@ -622,6 +2239,13 @@ function createShadowRoot(cmpMeta) {
|
|
|
622
2239
|
} else {
|
|
623
2240
|
shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
|
|
624
2241
|
}
|
|
2242
|
+
} else if (globalStyles && !supportsConstructableStylesheets) {
|
|
2243
|
+
const styleElm = document.createElement("style");
|
|
2244
|
+
styleElm.innerHTML = globalStyles;
|
|
2245
|
+
if (import_app_data.BUILD.hotModuleReplacement) {
|
|
2246
|
+
styleElm.setAttribute(HYDRATED_STYLE_ID, GLOBAL_STYLE_ID);
|
|
2247
|
+
}
|
|
2248
|
+
shadowRoot.prepend(styleElm);
|
|
625
2249
|
}
|
|
626
2250
|
}
|
|
627
2251
|
|
|
@@ -650,33 +2274,6 @@ var import_app_data3 = require("@stencil/core/internal/app-data");
|
|
|
650
2274
|
|
|
651
2275
|
// src/runtime/slot-polyfill-utils.ts
|
|
652
2276
|
var import_app_data2 = require("@stencil/core/internal/app-data");
|
|
653
|
-
|
|
654
|
-
// src/runtime/runtime-constants.ts
|
|
655
|
-
var CONTENT_REF_ID = "r";
|
|
656
|
-
var ORG_LOCATION_ID = "o";
|
|
657
|
-
var SLOT_NODE_ID = "s";
|
|
658
|
-
var TEXT_NODE_ID = "t";
|
|
659
|
-
var COMMENT_NODE_ID = "c";
|
|
660
|
-
var HYDRATE_ID = "s-id";
|
|
661
|
-
var HYDRATED_STYLE_ID = "sty-id";
|
|
662
|
-
var HYDRATE_CHILD_ID = "c-id";
|
|
663
|
-
var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
664
|
-
var STENCIL_DOC_DATA = "_stencilDocData";
|
|
665
|
-
var DEFAULT_DOC_DATA = {
|
|
666
|
-
hostIds: 0,
|
|
667
|
-
rootLevelIds: 0,
|
|
668
|
-
staticComponents: /* @__PURE__ */ new Set()
|
|
669
|
-
};
|
|
670
|
-
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
671
|
-
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
672
|
-
var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
|
673
|
-
"formAssociatedCallback",
|
|
674
|
-
"formResetCallback",
|
|
675
|
-
"formDisabledCallback",
|
|
676
|
-
"formStateRestoreCallback"
|
|
677
|
-
];
|
|
678
|
-
|
|
679
|
-
// src/runtime/slot-polyfill-utils.ts
|
|
680
2277
|
var updateFallbackSlotVisibility = (elm) => {
|
|
681
2278
|
const childNodes = internalCall(elm, "childNodes");
|
|
682
2279
|
if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
|
|
@@ -1300,7 +2897,7 @@ var registerStyle = (scopeId2, cssText, allowCS) => {
|
|
|
1300
2897
|
styles.set(scopeId2, style);
|
|
1301
2898
|
};
|
|
1302
2899
|
var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
1303
|
-
var _a;
|
|
2900
|
+
var _a, _b, _c;
|
|
1304
2901
|
const scopeId2 = getScopeId(cmpMeta, mode);
|
|
1305
2902
|
const style = styles.get(scopeId2);
|
|
1306
2903
|
if (!import_app_data5.BUILD.attachStyles || !win.document) {
|
|
@@ -1315,52 +2912,52 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1315
2912
|
if (!appliedStyles) {
|
|
1316
2913
|
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
|
1317
2914
|
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
|
1347
|
-
}
|
|
2915
|
+
const existingStyleElm = (import_app_data5.BUILD.hydrateClientSide || import_app_data5.BUILD.hotModuleReplacement) && styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
|
|
2916
|
+
if (existingStyleElm) {
|
|
2917
|
+
existingStyleElm.innerHTML = style;
|
|
2918
|
+
} else if (!appliedStyles.has(scopeId2)) {
|
|
2919
|
+
styleElm = win.document.createElement("style");
|
|
2920
|
+
styleElm.innerHTML = style;
|
|
2921
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
2922
|
+
if (nonce != null) {
|
|
2923
|
+
styleElm.setAttribute("nonce", nonce);
|
|
2924
|
+
}
|
|
2925
|
+
if ((import_app_data5.BUILD.hydrateServerSide || import_app_data5.BUILD.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */ || cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
2926
|
+
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
|
|
2927
|
+
}
|
|
2928
|
+
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
2929
|
+
if (styleContainerNode.nodeName === "HEAD") {
|
|
2930
|
+
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
|
2931
|
+
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
|
2932
|
+
styleContainerNode.insertBefore(
|
|
2933
|
+
styleElm,
|
|
2934
|
+
(referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
|
|
2935
|
+
);
|
|
2936
|
+
} else if ("host" in styleContainerNode) {
|
|
2937
|
+
if (supportsConstructableStylesheets) {
|
|
2938
|
+
const currentWindow = (_b = styleContainerNode.defaultView) != null ? _b : styleContainerNode.ownerDocument.defaultView;
|
|
2939
|
+
const stylesheet = new currentWindow.CSSStyleSheet();
|
|
2940
|
+
stylesheet.replaceSync(style);
|
|
2941
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
2942
|
+
styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
|
|
1348
2943
|
} else {
|
|
1349
|
-
|
|
1350
|
-
if (existingStyleContainer) {
|
|
1351
|
-
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
|
1352
|
-
} else {
|
|
1353
|
-
styleContainerNode.prepend(styleElm);
|
|
1354
|
-
}
|
|
2944
|
+
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
|
1355
2945
|
}
|
|
1356
2946
|
} else {
|
|
1357
|
-
styleContainerNode.
|
|
2947
|
+
const existingStyleContainer = styleContainerNode.querySelector("style");
|
|
2948
|
+
if (existingStyleContainer) {
|
|
2949
|
+
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
|
2950
|
+
} else {
|
|
2951
|
+
styleContainerNode.prepend(styleElm);
|
|
2952
|
+
}
|
|
1358
2953
|
}
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
styleContainerNode.insertBefore(styleElm, null);
|
|
2954
|
+
} else {
|
|
2955
|
+
styleContainerNode.append(styleElm);
|
|
1362
2956
|
}
|
|
1363
2957
|
}
|
|
2958
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2959
|
+
styleContainerNode.insertBefore(styleElm, null);
|
|
2960
|
+
}
|
|
1364
2961
|
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
|
1365
2962
|
styleElm.innerHTML += SLOT_FB_CSS;
|
|
1366
2963
|
}
|
|
@@ -1368,11 +2965,28 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1368
2965
|
appliedStyles.add(scopeId2);
|
|
1369
2966
|
}
|
|
1370
2967
|
}
|
|
1371
|
-
} else if (import_app_data5.BUILD.constructableCSS
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
2968
|
+
} else if (import_app_data5.BUILD.constructableCSS) {
|
|
2969
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
2970
|
+
if (!appliedStyles) {
|
|
2971
|
+
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
|
2972
|
+
}
|
|
2973
|
+
if (!appliedStyles.has(scopeId2)) {
|
|
2974
|
+
const currentWindow = (_c = styleContainerNode.defaultView) != null ? _c : styleContainerNode.ownerDocument.defaultView;
|
|
2975
|
+
let stylesheet;
|
|
2976
|
+
if (style.constructor === currentWindow.CSSStyleSheet) {
|
|
2977
|
+
stylesheet = style;
|
|
2978
|
+
} else {
|
|
2979
|
+
stylesheet = new currentWindow.CSSStyleSheet();
|
|
2980
|
+
for (let i2 = 0; i2 < style.cssRules.length; i2++) {
|
|
2981
|
+
stylesheet.insertRule(style.cssRules[i2].cssText, i2);
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
2985
|
+
styleContainerNode.adoptedStyleSheets.push(stylesheet);
|
|
2986
|
+
} else {
|
|
2987
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
|
|
2988
|
+
}
|
|
2989
|
+
appliedStyles.add(scopeId2);
|
|
1376
2990
|
}
|
|
1377
2991
|
}
|
|
1378
2992
|
}
|
|
@@ -1552,7 +3166,7 @@ var validateInputProperties = (inputElm) => {
|
|
|
1552
3166
|
|
|
1553
3167
|
// src/runtime/client-hydrate.ts
|
|
1554
3168
|
var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
1555
|
-
var _a, _b;
|
|
3169
|
+
var _a, _b, _c, _d;
|
|
1556
3170
|
const endHydrate = createTime("hydrateClient", tagName);
|
|
1557
3171
|
const shadowRoot = hostElm.shadowRoot;
|
|
1558
3172
|
const childRenderNodes = [];
|
|
@@ -1645,6 +3259,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1645
3259
|
let snGroupIdx;
|
|
1646
3260
|
let snGroupLen;
|
|
1647
3261
|
let slottedItem;
|
|
3262
|
+
let currentPos = 0;
|
|
1648
3263
|
for (snIndex; snIndex < snLen; snIndex++) {
|
|
1649
3264
|
slotGroup = slottedNodes[snIndex];
|
|
1650
3265
|
if (!slotGroup || !slotGroup.length) continue;
|
|
@@ -1658,7 +3273,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1658
3273
|
if (!hosts[slottedItem.hostId]) continue;
|
|
1659
3274
|
const hostEle = hosts[slottedItem.hostId];
|
|
1660
3275
|
if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
|
|
1661
|
-
hostEle.
|
|
3276
|
+
hostEle.insertBefore(slottedItem.node, (_c = (_b = slotGroup[snGroupIdx - 1]) == null ? void 0 : _b.node) == null ? void 0 : _c.nextSibling);
|
|
1662
3277
|
}
|
|
1663
3278
|
if (!hostEle.shadowRoot || !shadowRoot) {
|
|
1664
3279
|
if (!slottedItem.slot["s-cr"]) {
|
|
@@ -1669,14 +3284,15 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1669
3284
|
slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
|
|
1670
3285
|
}
|
|
1671
3286
|
}
|
|
1672
|
-
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
|
|
1673
|
-
if (((
|
|
3287
|
+
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
|
|
3288
|
+
if (((_d = slottedItem.node.parentElement) == null ? void 0 : _d.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
|
|
1674
3289
|
slottedItem.node.removeAttribute("slot");
|
|
1675
3290
|
}
|
|
1676
3291
|
if (import_app_data7.BUILD.experimentalSlotFixes) {
|
|
1677
3292
|
patchSlottedNode(slottedItem.node);
|
|
1678
3293
|
}
|
|
1679
3294
|
}
|
|
3295
|
+
currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
|
|
1680
3296
|
}
|
|
1681
3297
|
}
|
|
1682
3298
|
if (import_app_data7.BUILD.scoped && scopeId2 && slotNodes.length) {
|
|
@@ -1698,7 +3314,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1698
3314
|
if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
|
|
1699
3315
|
if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
|
|
1700
3316
|
node.removeAttribute("hidden");
|
|
1701
|
-
} else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue
|
|
3317
|
+
} else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue) {
|
|
1702
3318
|
node.parentNode.removeChild(node);
|
|
1703
3319
|
}
|
|
1704
3320
|
}
|
|
@@ -1865,10 +3481,6 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1865
3481
|
vnode.$elm$ = node;
|
|
1866
3482
|
vnode.$index$ = "0";
|
|
1867
3483
|
parentVNode.$children$ = [vnode];
|
|
1868
|
-
} else {
|
|
1869
|
-
if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim() && !node["s-nr"]) {
|
|
1870
|
-
node.remove();
|
|
1871
|
-
}
|
|
1872
3484
|
}
|
|
1873
3485
|
return parentVNode;
|
|
1874
3486
|
};
|
|
@@ -2242,16 +3854,16 @@ var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
|
|
|
2242
3854
|
let scopedSelector = "";
|
|
2243
3855
|
let startIndex = 0;
|
|
2244
3856
|
let res;
|
|
2245
|
-
const
|
|
3857
|
+
const sep2 = /( |>|\+|~(?!=))(?=(?:[^()]*\([^()]*\))*[^()]*$)\s*/g;
|
|
2246
3858
|
const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
|
|
2247
3859
|
let shouldScope = !hasHost;
|
|
2248
|
-
while ((res =
|
|
3860
|
+
while ((res = sep2.exec(selector)) !== null) {
|
|
2249
3861
|
const separator = res[1];
|
|
2250
3862
|
const part2 = selector.slice(startIndex, res.index).trim();
|
|
2251
3863
|
shouldScope = shouldScope || part2.indexOf(_polyfillHostNoCombinator) > -1;
|
|
2252
3864
|
const scopedPart = shouldScope ? _scopeSelectorPart(part2) : part2;
|
|
2253
3865
|
scopedSelector += `${scopedPart} ${separator} `;
|
|
2254
|
-
startIndex =
|
|
3866
|
+
startIndex = sep2.lastIndex;
|
|
2255
3867
|
}
|
|
2256
3868
|
const part = selector.substring(startIndex);
|
|
2257
3869
|
shouldScope = !part.match(_safePartRe) && (shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1);
|
|
@@ -2698,10 +4310,11 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2698
4310
|
elm.classList.add(elm["s-si"] = scopeId);
|
|
2699
4311
|
}
|
|
2700
4312
|
if (newVNode2.$children$) {
|
|
4313
|
+
const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
|
|
2701
4314
|
for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
|
|
2702
4315
|
childNode = createElm(oldParentVNode, newVNode2, i2);
|
|
2703
4316
|
if (childNode) {
|
|
2704
|
-
|
|
4317
|
+
appendTarget.appendChild(childNode);
|
|
2705
4318
|
}
|
|
2706
4319
|
}
|
|
2707
4320
|
}
|
|
@@ -2788,6 +4401,9 @@ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
|
2788
4401
|
if (import_app_data13.BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
2789
4402
|
containerElm = containerElm.shadowRoot;
|
|
2790
4403
|
}
|
|
4404
|
+
if (parentVNode.$tag$ === "template") {
|
|
4405
|
+
containerElm = containerElm.content;
|
|
4406
|
+
}
|
|
2791
4407
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
2792
4408
|
if (vnodes[startIdx]) {
|
|
2793
4409
|
childNode = createElm(null, parentVNode, startIdx);
|
|
@@ -2831,6 +4447,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2831
4447
|
let newEndVnode = newCh[newEndIdx];
|
|
2832
4448
|
let node;
|
|
2833
4449
|
let elmToMove;
|
|
4450
|
+
const containerElm = newVNode2.$tag$ === "template" ? parentElm.content : parentElm;
|
|
2834
4451
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
2835
4452
|
if (oldStartVnode == null) {
|
|
2836
4453
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
@@ -2853,7 +4470,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2853
4470
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
2854
4471
|
}
|
|
2855
4472
|
patch(oldStartVnode, newEndVnode, isInitialRender);
|
|
2856
|
-
insertBefore(
|
|
4473
|
+
insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
2857
4474
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
2858
4475
|
newEndVnode = newCh[--newEndIdx];
|
|
2859
4476
|
} else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
|
|
@@ -2861,7 +4478,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2861
4478
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
2862
4479
|
}
|
|
2863
4480
|
patch(oldEndVnode, newStartVnode, isInitialRender);
|
|
2864
|
-
insertBefore(
|
|
4481
|
+
insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
2865
4482
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
2866
4483
|
newStartVnode = newCh[++newStartIdx];
|
|
2867
4484
|
} else {
|
|
@@ -3136,13 +4753,16 @@ render() {
|
|
|
3136
4753
|
for (const relocateData of relocateNodes) {
|
|
3137
4754
|
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
3138
4755
|
const slotRefNode = relocateData.$slotRefNode$;
|
|
4756
|
+
if (nodeToRelocate.nodeType === 1 /* ElementNode */ && isInitialLoad) {
|
|
4757
|
+
nodeToRelocate["s-ih"] = (_a = nodeToRelocate.hidden) != null ? _a : false;
|
|
4758
|
+
}
|
|
3139
4759
|
if (slotRefNode) {
|
|
3140
4760
|
const parentNodeRef = slotRefNode.parentNode;
|
|
3141
4761
|
let insertBeforeNode = slotRefNode.nextSibling;
|
|
3142
4762
|
if (!import_app_data13.BUILD.hydrateServerSide && (!import_app_data13.BUILD.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */)) {
|
|
3143
|
-
let orgLocationNode = (
|
|
4763
|
+
let orgLocationNode = (_b = nodeToRelocate["s-ol"]) == null ? void 0 : _b.previousSibling;
|
|
3144
4764
|
while (orgLocationNode) {
|
|
3145
|
-
let refNode = (
|
|
4765
|
+
let refNode = (_c = orgLocationNode["s-nr"]) != null ? _c : null;
|
|
3146
4766
|
if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === (refNode.__parentNode || refNode.parentNode)) {
|
|
3147
4767
|
refNode = refNode.nextSibling;
|
|
3148
4768
|
while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
|
|
@@ -3165,18 +4785,13 @@ render() {
|
|
|
3165
4785
|
}
|
|
3166
4786
|
insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
|
|
3167
4787
|
if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
|
|
3168
|
-
nodeToRelocate.hidden = (
|
|
4788
|
+
nodeToRelocate.hidden = (_d = nodeToRelocate["s-ih"]) != null ? _d : false;
|
|
3169
4789
|
}
|
|
3170
4790
|
}
|
|
3171
4791
|
}
|
|
3172
4792
|
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
|
|
3173
|
-
} else {
|
|
3174
|
-
|
|
3175
|
-
if (isInitialLoad) {
|
|
3176
|
-
nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
|
|
3177
|
-
}
|
|
3178
|
-
nodeToRelocate.hidden = true;
|
|
3179
|
-
}
|
|
4793
|
+
} else if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
4794
|
+
nodeToRelocate.hidden = true;
|
|
3180
4795
|
}
|
|
3181
4796
|
}
|
|
3182
4797
|
}
|
|
@@ -3530,7 +5145,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3530
5145
|
if (import_app_data15.BUILD.serializer && import_app_data15.BUILD.reflect && cmpMeta.$attrsToReflect$) {
|
|
3531
5146
|
if (instance && cmpMeta.$serializers$ && cmpMeta.$serializers$[propName]) {
|
|
3532
5147
|
let attrVal = newVal;
|
|
3533
|
-
for (const
|
|
5148
|
+
for (const serializer of cmpMeta.$serializers$[propName]) {
|
|
5149
|
+
const [[methodName]] = Object.entries(serializer);
|
|
3534
5150
|
attrVal = instance[methodName](attrVal, propName);
|
|
3535
5151
|
}
|
|
3536
5152
|
hostRef.$serializerValues$.set(propName, attrVal);
|
|
@@ -3559,27 +5175,34 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3559
5175
|
);
|
|
3560
5176
|
}
|
|
3561
5177
|
}
|
|
3562
|
-
if (
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
5178
|
+
if (import_app_data15.BUILD.propChangeCallback && cmpMeta.$watchers$) {
|
|
5179
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
|
5180
|
+
if (watchMethods) {
|
|
5181
|
+
watchMethods.map((watcher) => {
|
|
5182
|
+
try {
|
|
5183
|
+
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
5184
|
+
if (flags & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */) {
|
|
5185
|
+
if (!instance) {
|
|
5186
|
+
hostRef.$fetchedCbList$.push(() => {
|
|
5187
|
+
hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
|
|
5188
|
+
});
|
|
5189
|
+
} else {
|
|
5190
|
+
instance[watchMethodName](newVal, oldVal, propName);
|
|
5191
|
+
}
|
|
3571
5192
|
}
|
|
3572
|
-
})
|
|
3573
|
-
|
|
3574
|
-
}
|
|
3575
|
-
if (import_app_data15.BUILD.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
3576
|
-
if (instance.componentShouldUpdate) {
|
|
3577
|
-
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
3578
|
-
return;
|
|
5193
|
+
} catch (e) {
|
|
5194
|
+
consoleError(e, elm);
|
|
3579
5195
|
}
|
|
5196
|
+
});
|
|
5197
|
+
}
|
|
5198
|
+
}
|
|
5199
|
+
if (import_app_data15.BUILD.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
5200
|
+
if (instance.componentShouldUpdate) {
|
|
5201
|
+
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
5202
|
+
return;
|
|
3580
5203
|
}
|
|
3581
|
-
scheduleUpdate(hostRef, false);
|
|
3582
5204
|
}
|
|
5205
|
+
scheduleUpdate(hostRef, false);
|
|
3583
5206
|
}
|
|
3584
5207
|
}
|
|
3585
5208
|
};
|
|
@@ -3762,7 +5385,8 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3762
5385
|
this[propName] = deserializeVal;
|
|
3763
5386
|
}
|
|
3764
5387
|
};
|
|
3765
|
-
for (const
|
|
5388
|
+
for (const deserializer of cmpMeta.$deserializers$[propName]) {
|
|
5389
|
+
const [[methodName]] = Object.entries(deserializer);
|
|
3766
5390
|
if (import_app_data16.BUILD.lazyLoad) {
|
|
3767
5391
|
if (hostRef.$lazyInstance$) {
|
|
3768
5392
|
setVal(methodName, hostRef.$lazyInstance$);
|
|
@@ -3781,13 +5405,14 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3781
5405
|
return;
|
|
3782
5406
|
} else if (propName == null) {
|
|
3783
5407
|
const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
|
|
3784
|
-
if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) &&
|
|
5408
|
+
if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && newValue !== oldValue) {
|
|
3785
5409
|
const elm = import_app_data16.BUILD.lazyLoad ? hostRef.$hostElement$ : this;
|
|
3786
5410
|
const instance = import_app_data16.BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
3787
5411
|
const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
|
|
3788
|
-
entry == null ? void 0 : entry.forEach((
|
|
3789
|
-
|
|
3790
|
-
|
|
5412
|
+
entry == null ? void 0 : entry.forEach((watcher) => {
|
|
5413
|
+
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
5414
|
+
if (instance[watchMethodName] != null && (flags2 & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */)) {
|
|
5415
|
+
instance[watchMethodName].call(instance, newValue, oldValue, attrName);
|
|
3791
5416
|
}
|
|
3792
5417
|
});
|
|
3793
5418
|
}
|
|
@@ -3888,7 +5513,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3888
5513
|
}
|
|
3889
5514
|
}
|
|
3890
5515
|
const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
|
|
3891
|
-
if (!styles.has(scopeId2)) {
|
|
5516
|
+
if (!styles.has(scopeId2) || import_app_data17.BUILD.hotModuleReplacement && hmrVersionId) {
|
|
3892
5517
|
const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
|
|
3893
5518
|
if (import_app_data17.BUILD.hydrateServerSide && import_app_data17.BUILD.shadowDom) {
|
|
3894
5519
|
if (cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
|
|
@@ -4056,7 +5681,7 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
4056
5681
|
if (import_app_data20.BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
4057
5682
|
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
4058
5683
|
}
|
|
4059
|
-
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /*
|
|
5684
|
+
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /* hasSlot */) {
|
|
4060
5685
|
if (import_app_data20.BUILD.experimentalSlotFixes) {
|
|
4061
5686
|
patchPseudoShadowDom(Cstr.prototype);
|
|
4062
5687
|
} else {
|
|
@@ -4288,7 +5913,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4288
5913
|
return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
|
|
4289
5914
|
}
|
|
4290
5915
|
};
|
|
4291
|
-
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /*
|
|
5916
|
+
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /* hasSlot */) {
|
|
4292
5917
|
if (import_app_data21.BUILD.experimentalSlotFixes) {
|
|
4293
5918
|
patchPseudoShadowDom(HostElement.prototype);
|
|
4294
5919
|
} else {
|