@stencil/core 4.39.0 → 4.40.1-dev.1766552834.64f6089
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.cjs +1616 -41
- package/cli/index.js +1616 -41
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +2791 -2515
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +1665 -90
- package/internal/app-data/index.cjs +1 -0
- package/internal/app-data/index.js +1 -0
- package/internal/app-data/package.json +1 -1
- package/internal/app-globals/package.json +1 -1
- package/internal/client/index.js +1746 -105
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +1770 -133
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +1794 -104
- package/internal/package.json +1 -1
- package/internal/stencil-private.d.ts +25 -2
- package/internal/stencil-public-compiler.d.ts +33 -3
- package/internal/stencil-public-runtime.d.ts +14 -3
- package/internal/testing/index.js +1758 -133
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +8 -1
- package/mock-doc/index.js +8 -1
- package/mock-doc/package.json +1 -1
- package/package.json +1 -1
- package/screenshot/index.js +1608 -30
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/index.js +28 -28
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +1696 -109
- package/testing/package.json +1 -1
package/internal/client/index.js
CHANGED
|
@@ -1,11 +1,253 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Client Platform v4.
|
|
2
|
+
Stencil Client Platform v4.40.1-dev.1766552834.64f6089 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
|
+
var __create = Object.create;
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __typeError = (msg) => {
|
|
11
|
+
throw TypeError(msg);
|
|
12
|
+
};
|
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
14
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
15
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
|
+
};
|
|
5
17
|
var __export = (target, all) => {
|
|
6
18
|
for (var name in all)
|
|
7
19
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
20
|
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (let key of __getOwnPropNames(from))
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
37
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
38
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
39
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
40
|
+
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);
|
|
41
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
42
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
43
|
+
|
|
44
|
+
// node_modules/balanced-match/index.js
|
|
45
|
+
var require_balanced_match = __commonJS({
|
|
46
|
+
"node_modules/balanced-match/index.js"(exports, module) {
|
|
47
|
+
"use strict";
|
|
48
|
+
module.exports = balanced;
|
|
49
|
+
function balanced(a, b, str) {
|
|
50
|
+
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
51
|
+
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
52
|
+
var r = range(a, b, str);
|
|
53
|
+
return r && {
|
|
54
|
+
start: r[0],
|
|
55
|
+
end: r[1],
|
|
56
|
+
pre: str.slice(0, r[0]),
|
|
57
|
+
body: str.slice(r[0] + a.length, r[1]),
|
|
58
|
+
post: str.slice(r[1] + b.length)
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function maybeMatch(reg, str) {
|
|
62
|
+
var m = str.match(reg);
|
|
63
|
+
return m ? m[0] : null;
|
|
64
|
+
}
|
|
65
|
+
balanced.range = range;
|
|
66
|
+
function range(a, b, str) {
|
|
67
|
+
var begs, beg, left, right, result;
|
|
68
|
+
var ai = str.indexOf(a);
|
|
69
|
+
var bi = str.indexOf(b, ai + 1);
|
|
70
|
+
var i2 = ai;
|
|
71
|
+
if (ai >= 0 && bi > 0) {
|
|
72
|
+
if (a === b) {
|
|
73
|
+
return [ai, bi];
|
|
74
|
+
}
|
|
75
|
+
begs = [];
|
|
76
|
+
left = str.length;
|
|
77
|
+
while (i2 >= 0 && !result) {
|
|
78
|
+
if (i2 == ai) {
|
|
79
|
+
begs.push(i2);
|
|
80
|
+
ai = str.indexOf(a, i2 + 1);
|
|
81
|
+
} else if (begs.length == 1) {
|
|
82
|
+
result = [begs.pop(), bi];
|
|
83
|
+
} else {
|
|
84
|
+
beg = begs.pop();
|
|
85
|
+
if (beg < left) {
|
|
86
|
+
left = beg;
|
|
87
|
+
right = bi;
|
|
88
|
+
}
|
|
89
|
+
bi = str.indexOf(b, i2 + 1);
|
|
90
|
+
}
|
|
91
|
+
i2 = ai < bi && ai >= 0 ? ai : bi;
|
|
92
|
+
}
|
|
93
|
+
if (begs.length) {
|
|
94
|
+
result = [left, right];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// node_modules/brace-expansion/index.js
|
|
103
|
+
var require_brace_expansion = __commonJS({
|
|
104
|
+
"node_modules/brace-expansion/index.js"(exports, module) {
|
|
105
|
+
var balanced = require_balanced_match();
|
|
106
|
+
module.exports = expandTop;
|
|
107
|
+
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
108
|
+
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
109
|
+
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
110
|
+
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
111
|
+
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
112
|
+
function numeric(str) {
|
|
113
|
+
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
114
|
+
}
|
|
115
|
+
function escapeBraces(str) {
|
|
116
|
+
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
117
|
+
}
|
|
118
|
+
function unescapeBraces(str) {
|
|
119
|
+
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
120
|
+
}
|
|
121
|
+
function parseCommaParts(str) {
|
|
122
|
+
if (!str)
|
|
123
|
+
return [""];
|
|
124
|
+
var parts = [];
|
|
125
|
+
var m = balanced("{", "}", str);
|
|
126
|
+
if (!m)
|
|
127
|
+
return str.split(",");
|
|
128
|
+
var pre = m.pre;
|
|
129
|
+
var body = m.body;
|
|
130
|
+
var post = m.post;
|
|
131
|
+
var p = pre.split(",");
|
|
132
|
+
p[p.length - 1] += "{" + body + "}";
|
|
133
|
+
var postParts = parseCommaParts(post);
|
|
134
|
+
if (post.length) {
|
|
135
|
+
p[p.length - 1] += postParts.shift();
|
|
136
|
+
p.push.apply(p, postParts);
|
|
137
|
+
}
|
|
138
|
+
parts.push.apply(parts, p);
|
|
139
|
+
return parts;
|
|
140
|
+
}
|
|
141
|
+
function expandTop(str) {
|
|
142
|
+
if (!str)
|
|
143
|
+
return [];
|
|
144
|
+
if (str.substr(0, 2) === "{}") {
|
|
145
|
+
str = "\\{\\}" + str.substr(2);
|
|
146
|
+
}
|
|
147
|
+
return expand2(escapeBraces(str), true).map(unescapeBraces);
|
|
148
|
+
}
|
|
149
|
+
function embrace(str) {
|
|
150
|
+
return "{" + str + "}";
|
|
151
|
+
}
|
|
152
|
+
function isPadded(el) {
|
|
153
|
+
return /^-?0\d/.test(el);
|
|
154
|
+
}
|
|
155
|
+
function lte(i2, y) {
|
|
156
|
+
return i2 <= y;
|
|
157
|
+
}
|
|
158
|
+
function gte(i2, y) {
|
|
159
|
+
return i2 >= y;
|
|
160
|
+
}
|
|
161
|
+
function expand2(str, isTop) {
|
|
162
|
+
var expansions = [];
|
|
163
|
+
var m = balanced("{", "}", str);
|
|
164
|
+
if (!m) return [str];
|
|
165
|
+
var pre = m.pre;
|
|
166
|
+
var post = m.post.length ? expand2(m.post, false) : [""];
|
|
167
|
+
if (/\$$/.test(m.pre)) {
|
|
168
|
+
for (var k = 0; k < post.length; k++) {
|
|
169
|
+
var expansion = pre + "{" + m.body + "}" + post[k];
|
|
170
|
+
expansions.push(expansion);
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
174
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
175
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
|
176
|
+
var isOptions = m.body.indexOf(",") >= 0;
|
|
177
|
+
if (!isSequence && !isOptions) {
|
|
178
|
+
if (m.post.match(/,(?!,).*\}/)) {
|
|
179
|
+
str = m.pre + "{" + m.body + escClose + m.post;
|
|
180
|
+
return expand2(str);
|
|
181
|
+
}
|
|
182
|
+
return [str];
|
|
183
|
+
}
|
|
184
|
+
var n;
|
|
185
|
+
if (isSequence) {
|
|
186
|
+
n = m.body.split(/\.\./);
|
|
187
|
+
} else {
|
|
188
|
+
n = parseCommaParts(m.body);
|
|
189
|
+
if (n.length === 1) {
|
|
190
|
+
n = expand2(n[0], false).map(embrace);
|
|
191
|
+
if (n.length === 1) {
|
|
192
|
+
return post.map(function(p) {
|
|
193
|
+
return m.pre + n[0] + p;
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
var N;
|
|
199
|
+
if (isSequence) {
|
|
200
|
+
var x = numeric(n[0]);
|
|
201
|
+
var y = numeric(n[1]);
|
|
202
|
+
var width = Math.max(n[0].length, n[1].length);
|
|
203
|
+
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
|
|
204
|
+
var test = lte;
|
|
205
|
+
var reverse = y < x;
|
|
206
|
+
if (reverse) {
|
|
207
|
+
incr *= -1;
|
|
208
|
+
test = gte;
|
|
209
|
+
}
|
|
210
|
+
var pad = n.some(isPadded);
|
|
211
|
+
N = [];
|
|
212
|
+
for (var i2 = x; test(i2, y); i2 += incr) {
|
|
213
|
+
var c;
|
|
214
|
+
if (isAlphaSequence) {
|
|
215
|
+
c = String.fromCharCode(i2);
|
|
216
|
+
if (c === "\\")
|
|
217
|
+
c = "";
|
|
218
|
+
} else {
|
|
219
|
+
c = String(i2);
|
|
220
|
+
if (pad) {
|
|
221
|
+
var need = width - c.length;
|
|
222
|
+
if (need > 0) {
|
|
223
|
+
var z = new Array(need + 1).join("0");
|
|
224
|
+
if (i2 < 0)
|
|
225
|
+
c = "-" + z + c.slice(1);
|
|
226
|
+
else
|
|
227
|
+
c = z + c;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
N.push(c);
|
|
232
|
+
}
|
|
233
|
+
} else {
|
|
234
|
+
N = [];
|
|
235
|
+
for (var j = 0; j < n.length; j++) {
|
|
236
|
+
N.push.apply(N, expand2(n[j], false));
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
for (var j = 0; j < N.length; j++) {
|
|
240
|
+
for (var k = 0; k < post.length; k++) {
|
|
241
|
+
var expansion = pre + N[j] + post[k];
|
|
242
|
+
if (!isTop || isSequence || expansion)
|
|
243
|
+
expansions.push(expansion);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return expansions;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
});
|
|
9
251
|
|
|
10
252
|
// src/client/client-build.ts
|
|
11
253
|
import { BUILD } from "@stencil/core/internal/app-data";
|
|
@@ -255,6 +497,9 @@ var supportsListenerOptions = /* @__PURE__ */ (() => {
|
|
|
255
497
|
var promiseResolve = (v) => Promise.resolve(v);
|
|
256
498
|
var supportsConstructableStylesheets = BUILD6.constructableCSS ? /* @__PURE__ */ (() => {
|
|
257
499
|
try {
|
|
500
|
+
if (!win.document.adoptedStyleSheets) {
|
|
501
|
+
return false;
|
|
502
|
+
}
|
|
258
503
|
new CSSStyleSheet();
|
|
259
504
|
return typeof new CSSStyleSheet().replaceSync === "function";
|
|
260
505
|
} catch (e) {
|
|
@@ -339,11 +584,11 @@ var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
|
|
|
339
584
|
import { BUILD as BUILD31, Env, NAMESPACE as NAMESPACE2 } from "@stencil/core/internal/app-data";
|
|
340
585
|
|
|
341
586
|
// src/runtime/asset-path.ts
|
|
342
|
-
var getAssetPath = (
|
|
343
|
-
const assetUrl = new URL(
|
|
587
|
+
var getAssetPath = (path2) => {
|
|
588
|
+
const assetUrl = new URL(path2, plt.$resourcesUrl$);
|
|
344
589
|
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
|
|
345
590
|
};
|
|
346
|
-
var setAssetPath = (
|
|
591
|
+
var setAssetPath = (path2) => plt.$resourcesUrl$ = path2;
|
|
347
592
|
|
|
348
593
|
// src/runtime/bootstrap-custom-element.ts
|
|
349
594
|
import { BUILD as BUILD27 } from "@stencil/core/internal/app-data";
|
|
@@ -355,6 +600,1359 @@ var isComplexType = (o) => {
|
|
|
355
600
|
return o === "object" || o === "function";
|
|
356
601
|
};
|
|
357
602
|
|
|
603
|
+
// node_modules/minimatch/dist/esm/index.js
|
|
604
|
+
var import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
605
|
+
|
|
606
|
+
// node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
607
|
+
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
608
|
+
var assertValidPattern = (pattern) => {
|
|
609
|
+
if (typeof pattern !== "string") {
|
|
610
|
+
throw new TypeError("invalid pattern");
|
|
611
|
+
}
|
|
612
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
613
|
+
throw new TypeError("pattern is too long");
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
// node_modules/minimatch/dist/esm/brace-expressions.js
|
|
618
|
+
var posixClasses = {
|
|
619
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
620
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
621
|
+
"[:ascii:]": ["\\x00-\\x7f", false],
|
|
622
|
+
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
623
|
+
"[:cntrl:]": ["\\p{Cc}", true],
|
|
624
|
+
"[:digit:]": ["\\p{Nd}", true],
|
|
625
|
+
"[:graph:]": ["\\p{Z}\\p{C}", true, true],
|
|
626
|
+
"[:lower:]": ["\\p{Ll}", true],
|
|
627
|
+
"[:print:]": ["\\p{C}", true],
|
|
628
|
+
"[:punct:]": ["\\p{P}", true],
|
|
629
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
630
|
+
"[:upper:]": ["\\p{Lu}", true],
|
|
631
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
632
|
+
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
633
|
+
};
|
|
634
|
+
var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
635
|
+
var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
636
|
+
var rangesToString = (ranges) => ranges.join("");
|
|
637
|
+
var parseClass = (glob, position) => {
|
|
638
|
+
const pos = position;
|
|
639
|
+
if (glob.charAt(pos) !== "[") {
|
|
640
|
+
throw new Error("not in a brace expression");
|
|
641
|
+
}
|
|
642
|
+
const ranges = [];
|
|
643
|
+
const negs = [];
|
|
644
|
+
let i2 = pos + 1;
|
|
645
|
+
let sawStart = false;
|
|
646
|
+
let uflag = false;
|
|
647
|
+
let escaping = false;
|
|
648
|
+
let negate = false;
|
|
649
|
+
let endPos = pos;
|
|
650
|
+
let rangeStart = "";
|
|
651
|
+
WHILE: while (i2 < glob.length) {
|
|
652
|
+
const c = glob.charAt(i2);
|
|
653
|
+
if ((c === "!" || c === "^") && i2 === pos + 1) {
|
|
654
|
+
negate = true;
|
|
655
|
+
i2++;
|
|
656
|
+
continue;
|
|
657
|
+
}
|
|
658
|
+
if (c === "]" && sawStart && !escaping) {
|
|
659
|
+
endPos = i2 + 1;
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
sawStart = true;
|
|
663
|
+
if (c === "\\") {
|
|
664
|
+
if (!escaping) {
|
|
665
|
+
escaping = true;
|
|
666
|
+
i2++;
|
|
667
|
+
continue;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
if (c === "[" && !escaping) {
|
|
671
|
+
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
672
|
+
if (glob.startsWith(cls, i2)) {
|
|
673
|
+
if (rangeStart) {
|
|
674
|
+
return ["$.", false, glob.length - pos, true];
|
|
675
|
+
}
|
|
676
|
+
i2 += cls.length;
|
|
677
|
+
if (neg)
|
|
678
|
+
negs.push(unip);
|
|
679
|
+
else
|
|
680
|
+
ranges.push(unip);
|
|
681
|
+
uflag = uflag || u;
|
|
682
|
+
continue WHILE;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
escaping = false;
|
|
687
|
+
if (rangeStart) {
|
|
688
|
+
if (c > rangeStart) {
|
|
689
|
+
ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
|
|
690
|
+
} else if (c === rangeStart) {
|
|
691
|
+
ranges.push(braceEscape(c));
|
|
692
|
+
}
|
|
693
|
+
rangeStart = "";
|
|
694
|
+
i2++;
|
|
695
|
+
continue;
|
|
696
|
+
}
|
|
697
|
+
if (glob.startsWith("-]", i2 + 1)) {
|
|
698
|
+
ranges.push(braceEscape(c + "-"));
|
|
699
|
+
i2 += 2;
|
|
700
|
+
continue;
|
|
701
|
+
}
|
|
702
|
+
if (glob.startsWith("-", i2 + 1)) {
|
|
703
|
+
rangeStart = c;
|
|
704
|
+
i2 += 2;
|
|
705
|
+
continue;
|
|
706
|
+
}
|
|
707
|
+
ranges.push(braceEscape(c));
|
|
708
|
+
i2++;
|
|
709
|
+
}
|
|
710
|
+
if (endPos < i2) {
|
|
711
|
+
return ["", false, 0, false];
|
|
712
|
+
}
|
|
713
|
+
if (!ranges.length && !negs.length) {
|
|
714
|
+
return ["$.", false, glob.length - pos, true];
|
|
715
|
+
}
|
|
716
|
+
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
|
|
717
|
+
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
718
|
+
return [regexpEscape(r), false, endPos - pos, false];
|
|
719
|
+
}
|
|
720
|
+
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
|
|
721
|
+
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
722
|
+
const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
|
|
723
|
+
return [comb, uflag, endPos - pos, true];
|
|
724
|
+
};
|
|
725
|
+
|
|
726
|
+
// node_modules/minimatch/dist/esm/unescape.js
|
|
727
|
+
var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
728
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
// node_modules/minimatch/dist/esm/ast.js
|
|
732
|
+
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
733
|
+
var isExtglobType = (c) => types.has(c);
|
|
734
|
+
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
735
|
+
var startNoDot = "(?!\\.)";
|
|
736
|
+
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
|
737
|
+
var justDots = /* @__PURE__ */ new Set(["..", "."]);
|
|
738
|
+
var reSpecials = new Set("().*{}+?[]^$\\!");
|
|
739
|
+
var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
740
|
+
var qmark = "[^/]";
|
|
741
|
+
var star = qmark + "*?";
|
|
742
|
+
var starNoEmpty = qmark + "+?";
|
|
743
|
+
var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
|
|
744
|
+
var _AST = class _AST {
|
|
745
|
+
constructor(type, parent, options = {}) {
|
|
746
|
+
__privateAdd(this, _AST_instances);
|
|
747
|
+
__publicField(this, "type");
|
|
748
|
+
__privateAdd(this, _root);
|
|
749
|
+
__privateAdd(this, _hasMagic);
|
|
750
|
+
__privateAdd(this, _uflag, false);
|
|
751
|
+
__privateAdd(this, _parts, []);
|
|
752
|
+
__privateAdd(this, _parent);
|
|
753
|
+
__privateAdd(this, _parentIndex);
|
|
754
|
+
__privateAdd(this, _negs);
|
|
755
|
+
__privateAdd(this, _filledNegs, false);
|
|
756
|
+
__privateAdd(this, _options);
|
|
757
|
+
__privateAdd(this, _toString);
|
|
758
|
+
// set to true if it's an extglob with no children
|
|
759
|
+
// (which really means one child of '')
|
|
760
|
+
__privateAdd(this, _emptyExt, false);
|
|
761
|
+
this.type = type;
|
|
762
|
+
if (type)
|
|
763
|
+
__privateSet(this, _hasMagic, true);
|
|
764
|
+
__privateSet(this, _parent, parent);
|
|
765
|
+
__privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
|
|
766
|
+
__privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
|
|
767
|
+
__privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
|
|
768
|
+
if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
|
|
769
|
+
__privateGet(this, _negs).push(this);
|
|
770
|
+
__privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
|
|
771
|
+
}
|
|
772
|
+
get hasMagic() {
|
|
773
|
+
if (__privateGet(this, _hasMagic) !== void 0)
|
|
774
|
+
return __privateGet(this, _hasMagic);
|
|
775
|
+
for (const p of __privateGet(this, _parts)) {
|
|
776
|
+
if (typeof p === "string")
|
|
777
|
+
continue;
|
|
778
|
+
if (p.type || p.hasMagic)
|
|
779
|
+
return __privateSet(this, _hasMagic, true);
|
|
780
|
+
}
|
|
781
|
+
return __privateGet(this, _hasMagic);
|
|
782
|
+
}
|
|
783
|
+
// reconstructs the pattern
|
|
784
|
+
toString() {
|
|
785
|
+
if (__privateGet(this, _toString) !== void 0)
|
|
786
|
+
return __privateGet(this, _toString);
|
|
787
|
+
if (!this.type) {
|
|
788
|
+
return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
|
|
789
|
+
} else {
|
|
790
|
+
return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
push(...parts) {
|
|
794
|
+
for (const p of parts) {
|
|
795
|
+
if (p === "")
|
|
796
|
+
continue;
|
|
797
|
+
if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
|
|
798
|
+
throw new Error("invalid part: " + p);
|
|
799
|
+
}
|
|
800
|
+
__privateGet(this, _parts).push(p);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
toJSON() {
|
|
804
|
+
var _a;
|
|
805
|
+
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())];
|
|
806
|
+
if (this.isStart() && !this.type)
|
|
807
|
+
ret.unshift([]);
|
|
808
|
+
if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")) {
|
|
809
|
+
ret.push({});
|
|
810
|
+
}
|
|
811
|
+
return ret;
|
|
812
|
+
}
|
|
813
|
+
isStart() {
|
|
814
|
+
var _a;
|
|
815
|
+
if (__privateGet(this, _root) === this)
|
|
816
|
+
return true;
|
|
817
|
+
if (!((_a = __privateGet(this, _parent)) == null ? void 0 : _a.isStart()))
|
|
818
|
+
return false;
|
|
819
|
+
if (__privateGet(this, _parentIndex) === 0)
|
|
820
|
+
return true;
|
|
821
|
+
const p = __privateGet(this, _parent);
|
|
822
|
+
for (let i2 = 0; i2 < __privateGet(this, _parentIndex); i2++) {
|
|
823
|
+
const pp = __privateGet(p, _parts)[i2];
|
|
824
|
+
if (!(pp instanceof _AST && pp.type === "!")) {
|
|
825
|
+
return false;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
return true;
|
|
829
|
+
}
|
|
830
|
+
isEnd() {
|
|
831
|
+
var _a, _b, _c;
|
|
832
|
+
if (__privateGet(this, _root) === this)
|
|
833
|
+
return true;
|
|
834
|
+
if (((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")
|
|
835
|
+
return true;
|
|
836
|
+
if (!((_b = __privateGet(this, _parent)) == null ? void 0 : _b.isEnd()))
|
|
837
|
+
return false;
|
|
838
|
+
if (!this.type)
|
|
839
|
+
return (_c = __privateGet(this, _parent)) == null ? void 0 : _c.isEnd();
|
|
840
|
+
const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
|
|
841
|
+
return __privateGet(this, _parentIndex) === pl - 1;
|
|
842
|
+
}
|
|
843
|
+
copyIn(part) {
|
|
844
|
+
if (typeof part === "string")
|
|
845
|
+
this.push(part);
|
|
846
|
+
else
|
|
847
|
+
this.push(part.clone(this));
|
|
848
|
+
}
|
|
849
|
+
clone(parent) {
|
|
850
|
+
const c = new _AST(this.type, parent);
|
|
851
|
+
for (const p of __privateGet(this, _parts)) {
|
|
852
|
+
c.copyIn(p);
|
|
853
|
+
}
|
|
854
|
+
return c;
|
|
855
|
+
}
|
|
856
|
+
static fromGlob(pattern, options = {}) {
|
|
857
|
+
var _a;
|
|
858
|
+
const ast = new _AST(null, void 0, options);
|
|
859
|
+
__privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
|
|
860
|
+
return ast;
|
|
861
|
+
}
|
|
862
|
+
// returns the regular expression if there's magic, or the unescaped
|
|
863
|
+
// string if not.
|
|
864
|
+
toMMPattern() {
|
|
865
|
+
if (this !== __privateGet(this, _root))
|
|
866
|
+
return __privateGet(this, _root).toMMPattern();
|
|
867
|
+
const glob = this.toString();
|
|
868
|
+
const [re, body, hasMagic, uflag] = this.toRegExpSource();
|
|
869
|
+
const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
870
|
+
if (!anyMagic) {
|
|
871
|
+
return body;
|
|
872
|
+
}
|
|
873
|
+
const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
|
|
874
|
+
return Object.assign(new RegExp(`^${re}$`, flags), {
|
|
875
|
+
_src: re,
|
|
876
|
+
_glob: glob
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
get options() {
|
|
880
|
+
return __privateGet(this, _options);
|
|
881
|
+
}
|
|
882
|
+
// returns the string match, the regexp source, whether there's magic
|
|
883
|
+
// in the regexp (so a regular expression is required) and whether or
|
|
884
|
+
// not the uflag is needed for the regular expression (for posix classes)
|
|
885
|
+
// TODO: instead of injecting the start/end at this point, just return
|
|
886
|
+
// the BODY of the regexp, along with the start/end portions suitable
|
|
887
|
+
// for binding the start/end in either a joined full-path makeRe context
|
|
888
|
+
// (where we bind to (^|/), or a standalone matchPart context (where
|
|
889
|
+
// we bind to ^, and not /). Otherwise slashes get duped!
|
|
890
|
+
//
|
|
891
|
+
// In part-matching mode, the start is:
|
|
892
|
+
// - if not isStart: nothing
|
|
893
|
+
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
|
894
|
+
// - if dots allowed or not possible: ^
|
|
895
|
+
// - if dots possible and not allowed: ^(?!\.)
|
|
896
|
+
// end is:
|
|
897
|
+
// - if not isEnd(): nothing
|
|
898
|
+
// - else: $
|
|
899
|
+
//
|
|
900
|
+
// In full-path matching mode, we put the slash at the START of the
|
|
901
|
+
// pattern, so start is:
|
|
902
|
+
// - if first pattern: same as part-matching mode
|
|
903
|
+
// - if not isStart(): nothing
|
|
904
|
+
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
|
905
|
+
// - if dots allowed or not possible: /
|
|
906
|
+
// - if dots possible and not allowed: /(?!\.)
|
|
907
|
+
// end is:
|
|
908
|
+
// - if last pattern, same as part-matching mode
|
|
909
|
+
// - else nothing
|
|
910
|
+
//
|
|
911
|
+
// Always put the (?:$|/) on negated tails, though, because that has to be
|
|
912
|
+
// there to bind the end of the negated pattern portion, and it's easier to
|
|
913
|
+
// just stick it in now rather than try to inject it later in the middle of
|
|
914
|
+
// the pattern.
|
|
915
|
+
//
|
|
916
|
+
// We can just always return the same end, and leave it up to the caller
|
|
917
|
+
// to know whether it's going to be used joined or in parts.
|
|
918
|
+
// And, if the start is adjusted slightly, can do the same there:
|
|
919
|
+
// - if not isStart: nothing
|
|
920
|
+
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
|
921
|
+
// - if dots allowed or not possible: (?:/|^)
|
|
922
|
+
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
|
923
|
+
//
|
|
924
|
+
// But it's better to have a simpler binding without a conditional, for
|
|
925
|
+
// performance, so probably better to return both start options.
|
|
926
|
+
//
|
|
927
|
+
// Then the caller just ignores the end if it's not the first pattern,
|
|
928
|
+
// and the start always gets applied.
|
|
929
|
+
//
|
|
930
|
+
// But that's always going to be $ if it's the ending pattern, or nothing,
|
|
931
|
+
// so the caller can just attach $ at the end of the pattern when building.
|
|
932
|
+
//
|
|
933
|
+
// So the todo is:
|
|
934
|
+
// - better detect what kind of start is needed
|
|
935
|
+
// - return both flavors of starting pattern
|
|
936
|
+
// - attach $ at the end of the pattern when creating the actual RegExp
|
|
937
|
+
//
|
|
938
|
+
// Ah, but wait, no, that all only applies to the root when the first pattern
|
|
939
|
+
// is not an extglob. If the first pattern IS an extglob, then we need all
|
|
940
|
+
// that dot prevention biz to live in the extglob portions, because eg
|
|
941
|
+
// +(*|.x*) can match .xy but not .yx.
|
|
942
|
+
//
|
|
943
|
+
// So, return the two flavors if it's #root and the first child is not an
|
|
944
|
+
// AST, otherwise leave it to the child AST to handle it, and there,
|
|
945
|
+
// use the (?:^|/) style of start binding.
|
|
946
|
+
//
|
|
947
|
+
// Even simplified further:
|
|
948
|
+
// - Since the start for a join is eg /(?!\.) and the start for a part
|
|
949
|
+
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
|
950
|
+
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
951
|
+
toRegExpSource(allowDot) {
|
|
952
|
+
var _a;
|
|
953
|
+
const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
|
|
954
|
+
if (__privateGet(this, _root) === this)
|
|
955
|
+
__privateMethod(this, _AST_instances, fillNegs_fn).call(this);
|
|
956
|
+
if (!this.type) {
|
|
957
|
+
const noEmpty = this.isStart() && this.isEnd();
|
|
958
|
+
const src = __privateGet(this, _parts).map((p) => {
|
|
959
|
+
var _a2;
|
|
960
|
+
const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a2 = _AST, _AST_static, parseGlob_fn).call(_a2, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
|
|
961
|
+
__privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
|
|
962
|
+
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
963
|
+
return re;
|
|
964
|
+
}).join("");
|
|
965
|
+
let start2 = "";
|
|
966
|
+
if (this.isStart()) {
|
|
967
|
+
if (typeof __privateGet(this, _parts)[0] === "string") {
|
|
968
|
+
const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
|
|
969
|
+
if (!dotTravAllowed) {
|
|
970
|
+
const aps = addPatternStart;
|
|
971
|
+
const needNoTrav = (
|
|
972
|
+
// dots are allowed, and the pattern starts with [ or .
|
|
973
|
+
dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
974
|
+
src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
975
|
+
src.startsWith("\\.\\.") && aps.has(src.charAt(4))
|
|
976
|
+
);
|
|
977
|
+
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
978
|
+
start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
let end = "";
|
|
983
|
+
if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!") {
|
|
984
|
+
end = "(?:$|\\/)";
|
|
985
|
+
}
|
|
986
|
+
const final2 = start2 + src + end;
|
|
987
|
+
return [
|
|
988
|
+
final2,
|
|
989
|
+
unescape(src),
|
|
990
|
+
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
991
|
+
__privateGet(this, _uflag)
|
|
992
|
+
];
|
|
993
|
+
}
|
|
994
|
+
const repeated = this.type === "*" || this.type === "+";
|
|
995
|
+
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
996
|
+
let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
|
|
997
|
+
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
998
|
+
const s = this.toString();
|
|
999
|
+
__privateSet(this, _parts, [s]);
|
|
1000
|
+
this.type = null;
|
|
1001
|
+
__privateSet(this, _hasMagic, void 0);
|
|
1002
|
+
return [s, unescape(this.toString()), false, false];
|
|
1003
|
+
}
|
|
1004
|
+
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
|
|
1005
|
+
if (bodyDotAllowed === body) {
|
|
1006
|
+
bodyDotAllowed = "";
|
|
1007
|
+
}
|
|
1008
|
+
if (bodyDotAllowed) {
|
|
1009
|
+
body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
|
1010
|
+
}
|
|
1011
|
+
let final = "";
|
|
1012
|
+
if (this.type === "!" && __privateGet(this, _emptyExt)) {
|
|
1013
|
+
final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
|
|
1014
|
+
} else {
|
|
1015
|
+
const close = this.type === "!" ? (
|
|
1016
|
+
// !() must match something,but !(x) can match ''
|
|
1017
|
+
"))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
|
|
1018
|
+
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
|
|
1019
|
+
final = start + body + close;
|
|
1020
|
+
}
|
|
1021
|
+
return [
|
|
1022
|
+
final,
|
|
1023
|
+
unescape(body),
|
|
1024
|
+
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
1025
|
+
__privateGet(this, _uflag)
|
|
1026
|
+
];
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1029
|
+
_root = new WeakMap();
|
|
1030
|
+
_hasMagic = new WeakMap();
|
|
1031
|
+
_uflag = new WeakMap();
|
|
1032
|
+
_parts = new WeakMap();
|
|
1033
|
+
_parent = new WeakMap();
|
|
1034
|
+
_parentIndex = new WeakMap();
|
|
1035
|
+
_negs = new WeakMap();
|
|
1036
|
+
_filledNegs = new WeakMap();
|
|
1037
|
+
_options = new WeakMap();
|
|
1038
|
+
_toString = new WeakMap();
|
|
1039
|
+
_emptyExt = new WeakMap();
|
|
1040
|
+
_AST_instances = new WeakSet();
|
|
1041
|
+
fillNegs_fn = function() {
|
|
1042
|
+
if (this !== __privateGet(this, _root))
|
|
1043
|
+
throw new Error("should only call on root");
|
|
1044
|
+
if (__privateGet(this, _filledNegs))
|
|
1045
|
+
return this;
|
|
1046
|
+
this.toString();
|
|
1047
|
+
__privateSet(this, _filledNegs, true);
|
|
1048
|
+
let n;
|
|
1049
|
+
while (n = __privateGet(this, _negs).pop()) {
|
|
1050
|
+
if (n.type !== "!")
|
|
1051
|
+
continue;
|
|
1052
|
+
let p = n;
|
|
1053
|
+
let pp = __privateGet(p, _parent);
|
|
1054
|
+
while (pp) {
|
|
1055
|
+
for (let i2 = __privateGet(p, _parentIndex) + 1; !pp.type && i2 < __privateGet(pp, _parts).length; i2++) {
|
|
1056
|
+
for (const part of __privateGet(n, _parts)) {
|
|
1057
|
+
if (typeof part === "string") {
|
|
1058
|
+
throw new Error("string part in extglob AST??");
|
|
1059
|
+
}
|
|
1060
|
+
part.copyIn(__privateGet(pp, _parts)[i2]);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
p = pp;
|
|
1064
|
+
pp = __privateGet(p, _parent);
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
return this;
|
|
1068
|
+
};
|
|
1069
|
+
_AST_static = new WeakSet();
|
|
1070
|
+
parseAST_fn = function(str, ast, pos, opt) {
|
|
1071
|
+
var _a, _b;
|
|
1072
|
+
let escaping = false;
|
|
1073
|
+
let inBrace = false;
|
|
1074
|
+
let braceStart = -1;
|
|
1075
|
+
let braceNeg = false;
|
|
1076
|
+
if (ast.type === null) {
|
|
1077
|
+
let i3 = pos;
|
|
1078
|
+
let acc2 = "";
|
|
1079
|
+
while (i3 < str.length) {
|
|
1080
|
+
const c = str.charAt(i3++);
|
|
1081
|
+
if (escaping || c === "\\") {
|
|
1082
|
+
escaping = !escaping;
|
|
1083
|
+
acc2 += c;
|
|
1084
|
+
continue;
|
|
1085
|
+
}
|
|
1086
|
+
if (inBrace) {
|
|
1087
|
+
if (i3 === braceStart + 1) {
|
|
1088
|
+
if (c === "^" || c === "!") {
|
|
1089
|
+
braceNeg = true;
|
|
1090
|
+
}
|
|
1091
|
+
} else if (c === "]" && !(i3 === braceStart + 2 && braceNeg)) {
|
|
1092
|
+
inBrace = false;
|
|
1093
|
+
}
|
|
1094
|
+
acc2 += c;
|
|
1095
|
+
continue;
|
|
1096
|
+
} else if (c === "[") {
|
|
1097
|
+
inBrace = true;
|
|
1098
|
+
braceStart = i3;
|
|
1099
|
+
braceNeg = false;
|
|
1100
|
+
acc2 += c;
|
|
1101
|
+
continue;
|
|
1102
|
+
}
|
|
1103
|
+
if (!opt.noext && isExtglobType(c) && str.charAt(i3) === "(") {
|
|
1104
|
+
ast.push(acc2);
|
|
1105
|
+
acc2 = "";
|
|
1106
|
+
const ext2 = new _AST(c, ast);
|
|
1107
|
+
i3 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext2, i3, opt);
|
|
1108
|
+
ast.push(ext2);
|
|
1109
|
+
continue;
|
|
1110
|
+
}
|
|
1111
|
+
acc2 += c;
|
|
1112
|
+
}
|
|
1113
|
+
ast.push(acc2);
|
|
1114
|
+
return i3;
|
|
1115
|
+
}
|
|
1116
|
+
let i2 = pos + 1;
|
|
1117
|
+
let part = new _AST(null, ast);
|
|
1118
|
+
const parts = [];
|
|
1119
|
+
let acc = "";
|
|
1120
|
+
while (i2 < str.length) {
|
|
1121
|
+
const c = str.charAt(i2++);
|
|
1122
|
+
if (escaping || c === "\\") {
|
|
1123
|
+
escaping = !escaping;
|
|
1124
|
+
acc += c;
|
|
1125
|
+
continue;
|
|
1126
|
+
}
|
|
1127
|
+
if (inBrace) {
|
|
1128
|
+
if (i2 === braceStart + 1) {
|
|
1129
|
+
if (c === "^" || c === "!") {
|
|
1130
|
+
braceNeg = true;
|
|
1131
|
+
}
|
|
1132
|
+
} else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
|
|
1133
|
+
inBrace = false;
|
|
1134
|
+
}
|
|
1135
|
+
acc += c;
|
|
1136
|
+
continue;
|
|
1137
|
+
} else if (c === "[") {
|
|
1138
|
+
inBrace = true;
|
|
1139
|
+
braceStart = i2;
|
|
1140
|
+
braceNeg = false;
|
|
1141
|
+
acc += c;
|
|
1142
|
+
continue;
|
|
1143
|
+
}
|
|
1144
|
+
if (isExtglobType(c) && str.charAt(i2) === "(") {
|
|
1145
|
+
part.push(acc);
|
|
1146
|
+
acc = "";
|
|
1147
|
+
const ext2 = new _AST(c, part);
|
|
1148
|
+
part.push(ext2);
|
|
1149
|
+
i2 = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext2, i2, opt);
|
|
1150
|
+
continue;
|
|
1151
|
+
}
|
|
1152
|
+
if (c === "|") {
|
|
1153
|
+
part.push(acc);
|
|
1154
|
+
acc = "";
|
|
1155
|
+
parts.push(part);
|
|
1156
|
+
part = new _AST(null, ast);
|
|
1157
|
+
continue;
|
|
1158
|
+
}
|
|
1159
|
+
if (c === ")") {
|
|
1160
|
+
if (acc === "" && __privateGet(ast, _parts).length === 0) {
|
|
1161
|
+
__privateSet(ast, _emptyExt, true);
|
|
1162
|
+
}
|
|
1163
|
+
part.push(acc);
|
|
1164
|
+
acc = "";
|
|
1165
|
+
ast.push(...parts, part);
|
|
1166
|
+
return i2;
|
|
1167
|
+
}
|
|
1168
|
+
acc += c;
|
|
1169
|
+
}
|
|
1170
|
+
ast.type = null;
|
|
1171
|
+
__privateSet(ast, _hasMagic, void 0);
|
|
1172
|
+
__privateSet(ast, _parts, [str.substring(pos - 1)]);
|
|
1173
|
+
return i2;
|
|
1174
|
+
};
|
|
1175
|
+
partsToRegExp_fn = function(dot) {
|
|
1176
|
+
return __privateGet(this, _parts).map((p) => {
|
|
1177
|
+
if (typeof p === "string") {
|
|
1178
|
+
throw new Error("string type in extglob ast??");
|
|
1179
|
+
}
|
|
1180
|
+
const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
|
|
1181
|
+
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
1182
|
+
return re;
|
|
1183
|
+
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
1184
|
+
};
|
|
1185
|
+
parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
|
|
1186
|
+
let escaping = false;
|
|
1187
|
+
let re = "";
|
|
1188
|
+
let uflag = false;
|
|
1189
|
+
for (let i2 = 0; i2 < glob.length; i2++) {
|
|
1190
|
+
const c = glob.charAt(i2);
|
|
1191
|
+
if (escaping) {
|
|
1192
|
+
escaping = false;
|
|
1193
|
+
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
1194
|
+
continue;
|
|
1195
|
+
}
|
|
1196
|
+
if (c === "\\") {
|
|
1197
|
+
if (i2 === glob.length - 1) {
|
|
1198
|
+
re += "\\\\";
|
|
1199
|
+
} else {
|
|
1200
|
+
escaping = true;
|
|
1201
|
+
}
|
|
1202
|
+
continue;
|
|
1203
|
+
}
|
|
1204
|
+
if (c === "[") {
|
|
1205
|
+
const [src, needUflag, consumed, magic] = parseClass(glob, i2);
|
|
1206
|
+
if (consumed) {
|
|
1207
|
+
re += src;
|
|
1208
|
+
uflag = uflag || needUflag;
|
|
1209
|
+
i2 += consumed - 1;
|
|
1210
|
+
hasMagic = hasMagic || magic;
|
|
1211
|
+
continue;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
if (c === "*") {
|
|
1215
|
+
if (noEmpty && glob === "*")
|
|
1216
|
+
re += starNoEmpty;
|
|
1217
|
+
else
|
|
1218
|
+
re += star;
|
|
1219
|
+
hasMagic = true;
|
|
1220
|
+
continue;
|
|
1221
|
+
}
|
|
1222
|
+
if (c === "?") {
|
|
1223
|
+
re += qmark;
|
|
1224
|
+
hasMagic = true;
|
|
1225
|
+
continue;
|
|
1226
|
+
}
|
|
1227
|
+
re += regExpEscape(c);
|
|
1228
|
+
}
|
|
1229
|
+
return [re, unescape(glob), !!hasMagic, uflag];
|
|
1230
|
+
};
|
|
1231
|
+
__privateAdd(_AST, _AST_static);
|
|
1232
|
+
var AST = _AST;
|
|
1233
|
+
|
|
1234
|
+
// node_modules/minimatch/dist/esm/escape.js
|
|
1235
|
+
var escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
1236
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
1237
|
+
};
|
|
1238
|
+
|
|
1239
|
+
// node_modules/minimatch/dist/esm/index.js
|
|
1240
|
+
var minimatch = (p, pattern, options = {}) => {
|
|
1241
|
+
assertValidPattern(pattern);
|
|
1242
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
1243
|
+
return false;
|
|
1244
|
+
}
|
|
1245
|
+
return new Minimatch(pattern, options).match(p);
|
|
1246
|
+
};
|
|
1247
|
+
var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
|
|
1248
|
+
var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
|
|
1249
|
+
var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
|
|
1250
|
+
var starDotExtTestNocase = (ext2) => {
|
|
1251
|
+
ext2 = ext2.toLowerCase();
|
|
1252
|
+
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
|
|
1253
|
+
};
|
|
1254
|
+
var starDotExtTestNocaseDot = (ext2) => {
|
|
1255
|
+
ext2 = ext2.toLowerCase();
|
|
1256
|
+
return (f) => f.toLowerCase().endsWith(ext2);
|
|
1257
|
+
};
|
|
1258
|
+
var starDotStarRE = /^\*+\.\*+$/;
|
|
1259
|
+
var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
1260
|
+
var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
1261
|
+
var dotStarRE = /^\.\*+$/;
|
|
1262
|
+
var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
1263
|
+
var starRE = /^\*+$/;
|
|
1264
|
+
var starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
1265
|
+
var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
1266
|
+
var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
1267
|
+
var qmarksTestNocase = ([$0, ext2 = ""]) => {
|
|
1268
|
+
const noext = qmarksTestNoExt([$0]);
|
|
1269
|
+
if (!ext2)
|
|
1270
|
+
return noext;
|
|
1271
|
+
ext2 = ext2.toLowerCase();
|
|
1272
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
1273
|
+
};
|
|
1274
|
+
var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
|
|
1275
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
1276
|
+
if (!ext2)
|
|
1277
|
+
return noext;
|
|
1278
|
+
ext2 = ext2.toLowerCase();
|
|
1279
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
1280
|
+
};
|
|
1281
|
+
var qmarksTestDot = ([$0, ext2 = ""]) => {
|
|
1282
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
1283
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
1284
|
+
};
|
|
1285
|
+
var qmarksTest = ([$0, ext2 = ""]) => {
|
|
1286
|
+
const noext = qmarksTestNoExt([$0]);
|
|
1287
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
1288
|
+
};
|
|
1289
|
+
var qmarksTestNoExt = ([$0]) => {
|
|
1290
|
+
const len = $0.length;
|
|
1291
|
+
return (f) => f.length === len && !f.startsWith(".");
|
|
1292
|
+
};
|
|
1293
|
+
var qmarksTestNoExtDot = ([$0]) => {
|
|
1294
|
+
const len = $0.length;
|
|
1295
|
+
return (f) => f.length === len && f !== "." && f !== "..";
|
|
1296
|
+
};
|
|
1297
|
+
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
1298
|
+
var path = {
|
|
1299
|
+
win32: { sep: "\\" },
|
|
1300
|
+
posix: { sep: "/" }
|
|
1301
|
+
};
|
|
1302
|
+
var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
|
|
1303
|
+
minimatch.sep = sep;
|
|
1304
|
+
var GLOBSTAR = Symbol("globstar **");
|
|
1305
|
+
minimatch.GLOBSTAR = GLOBSTAR;
|
|
1306
|
+
var qmark2 = "[^/]";
|
|
1307
|
+
var star2 = qmark2 + "*?";
|
|
1308
|
+
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
1309
|
+
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
1310
|
+
var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
|
|
1311
|
+
minimatch.filter = filter;
|
|
1312
|
+
var ext = (a, b = {}) => Object.assign({}, a, b);
|
|
1313
|
+
var defaults = (def) => {
|
|
1314
|
+
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
1315
|
+
return minimatch;
|
|
1316
|
+
}
|
|
1317
|
+
const orig = minimatch;
|
|
1318
|
+
const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
|
|
1319
|
+
return Object.assign(m, {
|
|
1320
|
+
Minimatch: class Minimatch extends orig.Minimatch {
|
|
1321
|
+
constructor(pattern, options = {}) {
|
|
1322
|
+
super(pattern, ext(def, options));
|
|
1323
|
+
}
|
|
1324
|
+
static defaults(options) {
|
|
1325
|
+
return orig.defaults(ext(def, options)).Minimatch;
|
|
1326
|
+
}
|
|
1327
|
+
},
|
|
1328
|
+
AST: class AST extends orig.AST {
|
|
1329
|
+
/* c8 ignore start */
|
|
1330
|
+
constructor(type, parent, options = {}) {
|
|
1331
|
+
super(type, parent, ext(def, options));
|
|
1332
|
+
}
|
|
1333
|
+
/* c8 ignore stop */
|
|
1334
|
+
static fromGlob(pattern, options = {}) {
|
|
1335
|
+
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
1336
|
+
}
|
|
1337
|
+
},
|
|
1338
|
+
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
1339
|
+
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
1340
|
+
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
1341
|
+
defaults: (options) => orig.defaults(ext(def, options)),
|
|
1342
|
+
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
1343
|
+
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
1344
|
+
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
|
|
1345
|
+
sep: orig.sep,
|
|
1346
|
+
GLOBSTAR
|
|
1347
|
+
});
|
|
1348
|
+
};
|
|
1349
|
+
minimatch.defaults = defaults;
|
|
1350
|
+
var braceExpand = (pattern, options = {}) => {
|
|
1351
|
+
assertValidPattern(pattern);
|
|
1352
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
1353
|
+
return [pattern];
|
|
1354
|
+
}
|
|
1355
|
+
return (0, import_brace_expansion.default)(pattern);
|
|
1356
|
+
};
|
|
1357
|
+
minimatch.braceExpand = braceExpand;
|
|
1358
|
+
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
1359
|
+
minimatch.makeRe = makeRe;
|
|
1360
|
+
var match = (list, pattern, options = {}) => {
|
|
1361
|
+
const mm = new Minimatch(pattern, options);
|
|
1362
|
+
list = list.filter((f) => mm.match(f));
|
|
1363
|
+
if (mm.options.nonull && !list.length) {
|
|
1364
|
+
list.push(pattern);
|
|
1365
|
+
}
|
|
1366
|
+
return list;
|
|
1367
|
+
};
|
|
1368
|
+
minimatch.match = match;
|
|
1369
|
+
var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
1370
|
+
var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1371
|
+
var Minimatch = class {
|
|
1372
|
+
options;
|
|
1373
|
+
set;
|
|
1374
|
+
pattern;
|
|
1375
|
+
windowsPathsNoEscape;
|
|
1376
|
+
nonegate;
|
|
1377
|
+
negate;
|
|
1378
|
+
comment;
|
|
1379
|
+
empty;
|
|
1380
|
+
preserveMultipleSlashes;
|
|
1381
|
+
partial;
|
|
1382
|
+
globSet;
|
|
1383
|
+
globParts;
|
|
1384
|
+
nocase;
|
|
1385
|
+
isWindows;
|
|
1386
|
+
platform;
|
|
1387
|
+
windowsNoMagicRoot;
|
|
1388
|
+
regexp;
|
|
1389
|
+
constructor(pattern, options = {}) {
|
|
1390
|
+
assertValidPattern(pattern);
|
|
1391
|
+
options = options || {};
|
|
1392
|
+
this.options = options;
|
|
1393
|
+
this.pattern = pattern;
|
|
1394
|
+
this.platform = options.platform || defaultPlatform;
|
|
1395
|
+
this.isWindows = this.platform === "win32";
|
|
1396
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
|
1397
|
+
if (this.windowsPathsNoEscape) {
|
|
1398
|
+
this.pattern = this.pattern.replace(/\\/g, "/");
|
|
1399
|
+
}
|
|
1400
|
+
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
1401
|
+
this.regexp = null;
|
|
1402
|
+
this.negate = false;
|
|
1403
|
+
this.nonegate = !!options.nonegate;
|
|
1404
|
+
this.comment = false;
|
|
1405
|
+
this.empty = false;
|
|
1406
|
+
this.partial = !!options.partial;
|
|
1407
|
+
this.nocase = !!this.options.nocase;
|
|
1408
|
+
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
1409
|
+
this.globSet = [];
|
|
1410
|
+
this.globParts = [];
|
|
1411
|
+
this.set = [];
|
|
1412
|
+
this.make();
|
|
1413
|
+
}
|
|
1414
|
+
hasMagic() {
|
|
1415
|
+
if (this.options.magicalBraces && this.set.length > 1) {
|
|
1416
|
+
return true;
|
|
1417
|
+
}
|
|
1418
|
+
for (const pattern of this.set) {
|
|
1419
|
+
for (const part of pattern) {
|
|
1420
|
+
if (typeof part !== "string")
|
|
1421
|
+
return true;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
return false;
|
|
1425
|
+
}
|
|
1426
|
+
debug(..._) {
|
|
1427
|
+
}
|
|
1428
|
+
make() {
|
|
1429
|
+
const pattern = this.pattern;
|
|
1430
|
+
const options = this.options;
|
|
1431
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
1432
|
+
this.comment = true;
|
|
1433
|
+
return;
|
|
1434
|
+
}
|
|
1435
|
+
if (!pattern) {
|
|
1436
|
+
this.empty = true;
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1439
|
+
this.parseNegate();
|
|
1440
|
+
this.globSet = [...new Set(this.braceExpand())];
|
|
1441
|
+
if (options.debug) {
|
|
1442
|
+
this.debug = (...args) => console.error(...args);
|
|
1443
|
+
}
|
|
1444
|
+
this.debug(this.pattern, this.globSet);
|
|
1445
|
+
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
1446
|
+
this.globParts = this.preprocess(rawGlobParts);
|
|
1447
|
+
this.debug(this.pattern, this.globParts);
|
|
1448
|
+
let set = this.globParts.map((s, _, __) => {
|
|
1449
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
1450
|
+
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
1451
|
+
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
1452
|
+
if (isUNC) {
|
|
1453
|
+
return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
1454
|
+
} else if (isDrive) {
|
|
1455
|
+
return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
return s.map((ss) => this.parse(ss));
|
|
1459
|
+
});
|
|
1460
|
+
this.debug(this.pattern, set);
|
|
1461
|
+
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
1462
|
+
if (this.isWindows) {
|
|
1463
|
+
for (let i2 = 0; i2 < this.set.length; i2++) {
|
|
1464
|
+
const p = this.set[i2];
|
|
1465
|
+
if (p[0] === "" && p[1] === "" && this.globParts[i2][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
|
|
1466
|
+
p[2] = "?";
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
this.debug(this.pattern, this.set);
|
|
1471
|
+
}
|
|
1472
|
+
// various transforms to equivalent pattern sets that are
|
|
1473
|
+
// faster to process in a filesystem walk. The goal is to
|
|
1474
|
+
// eliminate what we can, and push all ** patterns as far
|
|
1475
|
+
// to the right as possible, even if it increases the number
|
|
1476
|
+
// of patterns that we have to process.
|
|
1477
|
+
preprocess(globParts) {
|
|
1478
|
+
if (this.options.noglobstar) {
|
|
1479
|
+
for (let i2 = 0; i2 < globParts.length; i2++) {
|
|
1480
|
+
for (let j = 0; j < globParts[i2].length; j++) {
|
|
1481
|
+
if (globParts[i2][j] === "**") {
|
|
1482
|
+
globParts[i2][j] = "*";
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
const { optimizationLevel = 1 } = this.options;
|
|
1488
|
+
if (optimizationLevel >= 2) {
|
|
1489
|
+
globParts = this.firstPhasePreProcess(globParts);
|
|
1490
|
+
globParts = this.secondPhasePreProcess(globParts);
|
|
1491
|
+
} else if (optimizationLevel >= 1) {
|
|
1492
|
+
globParts = this.levelOneOptimize(globParts);
|
|
1493
|
+
} else {
|
|
1494
|
+
globParts = this.adjascentGlobstarOptimize(globParts);
|
|
1495
|
+
}
|
|
1496
|
+
return globParts;
|
|
1497
|
+
}
|
|
1498
|
+
// just get rid of adjascent ** portions
|
|
1499
|
+
adjascentGlobstarOptimize(globParts) {
|
|
1500
|
+
return globParts.map((parts) => {
|
|
1501
|
+
let gs = -1;
|
|
1502
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1503
|
+
let i2 = gs;
|
|
1504
|
+
while (parts[i2 + 1] === "**") {
|
|
1505
|
+
i2++;
|
|
1506
|
+
}
|
|
1507
|
+
if (i2 !== gs) {
|
|
1508
|
+
parts.splice(gs, i2 - gs);
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
return parts;
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
// get rid of adjascent ** and resolve .. portions
|
|
1515
|
+
levelOneOptimize(globParts) {
|
|
1516
|
+
return globParts.map((parts) => {
|
|
1517
|
+
parts = parts.reduce((set, part) => {
|
|
1518
|
+
const prev = set[set.length - 1];
|
|
1519
|
+
if (part === "**" && prev === "**") {
|
|
1520
|
+
return set;
|
|
1521
|
+
}
|
|
1522
|
+
if (part === "..") {
|
|
1523
|
+
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
1524
|
+
set.pop();
|
|
1525
|
+
return set;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
set.push(part);
|
|
1529
|
+
return set;
|
|
1530
|
+
}, []);
|
|
1531
|
+
return parts.length === 0 ? [""] : parts;
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
levelTwoFileOptimize(parts) {
|
|
1535
|
+
if (!Array.isArray(parts)) {
|
|
1536
|
+
parts = this.slashSplit(parts);
|
|
1537
|
+
}
|
|
1538
|
+
let didSomething = false;
|
|
1539
|
+
do {
|
|
1540
|
+
didSomething = false;
|
|
1541
|
+
if (!this.preserveMultipleSlashes) {
|
|
1542
|
+
for (let i2 = 1; i2 < parts.length - 1; i2++) {
|
|
1543
|
+
const p = parts[i2];
|
|
1544
|
+
if (i2 === 1 && p === "" && parts[0] === "")
|
|
1545
|
+
continue;
|
|
1546
|
+
if (p === "." || p === "") {
|
|
1547
|
+
didSomething = true;
|
|
1548
|
+
parts.splice(i2, 1);
|
|
1549
|
+
i2--;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1553
|
+
didSomething = true;
|
|
1554
|
+
parts.pop();
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
let dd = 0;
|
|
1558
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1559
|
+
const p = parts[dd - 1];
|
|
1560
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1561
|
+
didSomething = true;
|
|
1562
|
+
parts.splice(dd - 1, 2);
|
|
1563
|
+
dd -= 2;
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
} while (didSomething);
|
|
1567
|
+
return parts.length === 0 ? [""] : parts;
|
|
1568
|
+
}
|
|
1569
|
+
// First phase: single-pattern processing
|
|
1570
|
+
// <pre> is 1 or more portions
|
|
1571
|
+
// <rest> is 1 or more portions
|
|
1572
|
+
// <p> is any portion other than ., .., '', or **
|
|
1573
|
+
// <e> is . or ''
|
|
1574
|
+
//
|
|
1575
|
+
// **/.. is *brutal* for filesystem walking performance, because
|
|
1576
|
+
// it effectively resets the recursive walk each time it occurs,
|
|
1577
|
+
// and ** cannot be reduced out by a .. pattern part like a regexp
|
|
1578
|
+
// or most strings (other than .., ., and '') can be.
|
|
1579
|
+
//
|
|
1580
|
+
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
|
|
1581
|
+
// <pre>/<e>/<rest> -> <pre>/<rest>
|
|
1582
|
+
// <pre>/<p>/../<rest> -> <pre>/<rest>
|
|
1583
|
+
// **/**/<rest> -> **/<rest>
|
|
1584
|
+
//
|
|
1585
|
+
// **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
|
|
1586
|
+
// this WOULD be allowed if ** did follow symlinks, or * didn't
|
|
1587
|
+
firstPhasePreProcess(globParts) {
|
|
1588
|
+
let didSomething = false;
|
|
1589
|
+
do {
|
|
1590
|
+
didSomething = false;
|
|
1591
|
+
for (let parts of globParts) {
|
|
1592
|
+
let gs = -1;
|
|
1593
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1594
|
+
let gss = gs;
|
|
1595
|
+
while (parts[gss + 1] === "**") {
|
|
1596
|
+
gss++;
|
|
1597
|
+
}
|
|
1598
|
+
if (gss > gs) {
|
|
1599
|
+
parts.splice(gs + 1, gss - gs);
|
|
1600
|
+
}
|
|
1601
|
+
let next = parts[gs + 1];
|
|
1602
|
+
const p = parts[gs + 2];
|
|
1603
|
+
const p2 = parts[gs + 3];
|
|
1604
|
+
if (next !== "..")
|
|
1605
|
+
continue;
|
|
1606
|
+
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
|
|
1607
|
+
continue;
|
|
1608
|
+
}
|
|
1609
|
+
didSomething = true;
|
|
1610
|
+
parts.splice(gs, 1);
|
|
1611
|
+
const other = parts.slice(0);
|
|
1612
|
+
other[gs] = "**";
|
|
1613
|
+
globParts.push(other);
|
|
1614
|
+
gs--;
|
|
1615
|
+
}
|
|
1616
|
+
if (!this.preserveMultipleSlashes) {
|
|
1617
|
+
for (let i2 = 1; i2 < parts.length - 1; i2++) {
|
|
1618
|
+
const p = parts[i2];
|
|
1619
|
+
if (i2 === 1 && p === "" && parts[0] === "")
|
|
1620
|
+
continue;
|
|
1621
|
+
if (p === "." || p === "") {
|
|
1622
|
+
didSomething = true;
|
|
1623
|
+
parts.splice(i2, 1);
|
|
1624
|
+
i2--;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1628
|
+
didSomething = true;
|
|
1629
|
+
parts.pop();
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
let dd = 0;
|
|
1633
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1634
|
+
const p = parts[dd - 1];
|
|
1635
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1636
|
+
didSomething = true;
|
|
1637
|
+
const needDot = dd === 1 && parts[dd + 1] === "**";
|
|
1638
|
+
const splin = needDot ? ["."] : [];
|
|
1639
|
+
parts.splice(dd - 1, 2, ...splin);
|
|
1640
|
+
if (parts.length === 0)
|
|
1641
|
+
parts.push("");
|
|
1642
|
+
dd -= 2;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
} while (didSomething);
|
|
1647
|
+
return globParts;
|
|
1648
|
+
}
|
|
1649
|
+
// second phase: multi-pattern dedupes
|
|
1650
|
+
// {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
|
|
1651
|
+
// {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
|
|
1652
|
+
// {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
|
|
1653
|
+
//
|
|
1654
|
+
// {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
|
|
1655
|
+
// ^-- not valid because ** doens't follow symlinks
|
|
1656
|
+
secondPhasePreProcess(globParts) {
|
|
1657
|
+
for (let i2 = 0; i2 < globParts.length - 1; i2++) {
|
|
1658
|
+
for (let j = i2 + 1; j < globParts.length; j++) {
|
|
1659
|
+
const matched = this.partsMatch(globParts[i2], globParts[j], !this.preserveMultipleSlashes);
|
|
1660
|
+
if (!matched)
|
|
1661
|
+
continue;
|
|
1662
|
+
globParts[i2] = matched;
|
|
1663
|
+
globParts[j] = [];
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
return globParts.filter((gs) => gs.length);
|
|
1667
|
+
}
|
|
1668
|
+
partsMatch(a, b, emptyGSMatch = false) {
|
|
1669
|
+
let ai = 0;
|
|
1670
|
+
let bi = 0;
|
|
1671
|
+
let result = [];
|
|
1672
|
+
let which = "";
|
|
1673
|
+
while (ai < a.length && bi < b.length) {
|
|
1674
|
+
if (a[ai] === b[bi]) {
|
|
1675
|
+
result.push(which === "b" ? b[bi] : a[ai]);
|
|
1676
|
+
ai++;
|
|
1677
|
+
bi++;
|
|
1678
|
+
} else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
|
|
1679
|
+
result.push(a[ai]);
|
|
1680
|
+
ai++;
|
|
1681
|
+
} else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
|
|
1682
|
+
result.push(b[bi]);
|
|
1683
|
+
bi++;
|
|
1684
|
+
} else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
|
|
1685
|
+
if (which === "b")
|
|
1686
|
+
return false;
|
|
1687
|
+
which = "a";
|
|
1688
|
+
result.push(a[ai]);
|
|
1689
|
+
ai++;
|
|
1690
|
+
bi++;
|
|
1691
|
+
} else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
|
|
1692
|
+
if (which === "a")
|
|
1693
|
+
return false;
|
|
1694
|
+
which = "b";
|
|
1695
|
+
result.push(b[bi]);
|
|
1696
|
+
ai++;
|
|
1697
|
+
bi++;
|
|
1698
|
+
} else {
|
|
1699
|
+
return false;
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
return a.length === b.length && result;
|
|
1703
|
+
}
|
|
1704
|
+
parseNegate() {
|
|
1705
|
+
if (this.nonegate)
|
|
1706
|
+
return;
|
|
1707
|
+
const pattern = this.pattern;
|
|
1708
|
+
let negate = false;
|
|
1709
|
+
let negateOffset = 0;
|
|
1710
|
+
for (let i2 = 0; i2 < pattern.length && pattern.charAt(i2) === "!"; i2++) {
|
|
1711
|
+
negate = !negate;
|
|
1712
|
+
negateOffset++;
|
|
1713
|
+
}
|
|
1714
|
+
if (negateOffset)
|
|
1715
|
+
this.pattern = pattern.slice(negateOffset);
|
|
1716
|
+
this.negate = negate;
|
|
1717
|
+
}
|
|
1718
|
+
// set partial to true to test if, for example,
|
|
1719
|
+
// "/a/b" matches the start of "/*/b/*/d"
|
|
1720
|
+
// Partial means, if you run out of file before you run
|
|
1721
|
+
// out of pattern, then that's fine, as long as all
|
|
1722
|
+
// the parts match.
|
|
1723
|
+
matchOne(file, pattern, partial = false) {
|
|
1724
|
+
const options = this.options;
|
|
1725
|
+
if (this.isWindows) {
|
|
1726
|
+
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
1727
|
+
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
1728
|
+
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
1729
|
+
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
1730
|
+
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
1731
|
+
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
1732
|
+
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
1733
|
+
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
1734
|
+
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
1735
|
+
pattern[pdi] = fd;
|
|
1736
|
+
if (pdi > fdi) {
|
|
1737
|
+
pattern = pattern.slice(pdi);
|
|
1738
|
+
} else if (fdi > pdi) {
|
|
1739
|
+
file = file.slice(fdi);
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
const { optimizationLevel = 1 } = this.options;
|
|
1745
|
+
if (optimizationLevel >= 2) {
|
|
1746
|
+
file = this.levelTwoFileOptimize(file);
|
|
1747
|
+
}
|
|
1748
|
+
this.debug("matchOne", this, { file, pattern });
|
|
1749
|
+
this.debug("matchOne", file.length, pattern.length);
|
|
1750
|
+
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
1751
|
+
this.debug("matchOne loop");
|
|
1752
|
+
var p = pattern[pi];
|
|
1753
|
+
var f = file[fi];
|
|
1754
|
+
this.debug(pattern, p, f);
|
|
1755
|
+
if (p === false) {
|
|
1756
|
+
return false;
|
|
1757
|
+
}
|
|
1758
|
+
if (p === GLOBSTAR) {
|
|
1759
|
+
this.debug("GLOBSTAR", [pattern, p, f]);
|
|
1760
|
+
var fr = fi;
|
|
1761
|
+
var pr = pi + 1;
|
|
1762
|
+
if (pr === pl) {
|
|
1763
|
+
this.debug("** at the end");
|
|
1764
|
+
for (; fi < fl; fi++) {
|
|
1765
|
+
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
|
1766
|
+
return false;
|
|
1767
|
+
}
|
|
1768
|
+
return true;
|
|
1769
|
+
}
|
|
1770
|
+
while (fr < fl) {
|
|
1771
|
+
var swallowee = file[fr];
|
|
1772
|
+
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
1773
|
+
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
1774
|
+
this.debug("globstar found match!", fr, fl, swallowee);
|
|
1775
|
+
return true;
|
|
1776
|
+
} else {
|
|
1777
|
+
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
1778
|
+
this.debug("dot detected!", file, fr, pattern, pr);
|
|
1779
|
+
break;
|
|
1780
|
+
}
|
|
1781
|
+
this.debug("globstar swallow a segment, and continue");
|
|
1782
|
+
fr++;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
if (partial) {
|
|
1786
|
+
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
1787
|
+
if (fr === fl) {
|
|
1788
|
+
return true;
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
return false;
|
|
1792
|
+
}
|
|
1793
|
+
let hit;
|
|
1794
|
+
if (typeof p === "string") {
|
|
1795
|
+
hit = f === p;
|
|
1796
|
+
this.debug("string match", p, f, hit);
|
|
1797
|
+
} else {
|
|
1798
|
+
hit = p.test(f);
|
|
1799
|
+
this.debug("pattern match", p, f, hit);
|
|
1800
|
+
}
|
|
1801
|
+
if (!hit)
|
|
1802
|
+
return false;
|
|
1803
|
+
}
|
|
1804
|
+
if (fi === fl && pi === pl) {
|
|
1805
|
+
return true;
|
|
1806
|
+
} else if (fi === fl) {
|
|
1807
|
+
return partial;
|
|
1808
|
+
} else if (pi === pl) {
|
|
1809
|
+
return fi === fl - 1 && file[fi] === "";
|
|
1810
|
+
} else {
|
|
1811
|
+
throw new Error("wtf?");
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
braceExpand() {
|
|
1815
|
+
return braceExpand(this.pattern, this.options);
|
|
1816
|
+
}
|
|
1817
|
+
parse(pattern) {
|
|
1818
|
+
assertValidPattern(pattern);
|
|
1819
|
+
const options = this.options;
|
|
1820
|
+
if (pattern === "**")
|
|
1821
|
+
return GLOBSTAR;
|
|
1822
|
+
if (pattern === "")
|
|
1823
|
+
return "";
|
|
1824
|
+
let m;
|
|
1825
|
+
let fastTest = null;
|
|
1826
|
+
if (m = pattern.match(starRE)) {
|
|
1827
|
+
fastTest = options.dot ? starTestDot : starTest;
|
|
1828
|
+
} else if (m = pattern.match(starDotExtRE)) {
|
|
1829
|
+
fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
1830
|
+
} else if (m = pattern.match(qmarksRE)) {
|
|
1831
|
+
fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
1832
|
+
} else if (m = pattern.match(starDotStarRE)) {
|
|
1833
|
+
fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
1834
|
+
} else if (m = pattern.match(dotStarRE)) {
|
|
1835
|
+
fastTest = dotStarTest;
|
|
1836
|
+
}
|
|
1837
|
+
const re = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
1838
|
+
if (fastTest && typeof re === "object") {
|
|
1839
|
+
Reflect.defineProperty(re, "test", { value: fastTest });
|
|
1840
|
+
}
|
|
1841
|
+
return re;
|
|
1842
|
+
}
|
|
1843
|
+
makeRe() {
|
|
1844
|
+
if (this.regexp || this.regexp === false)
|
|
1845
|
+
return this.regexp;
|
|
1846
|
+
const set = this.set;
|
|
1847
|
+
if (!set.length) {
|
|
1848
|
+
this.regexp = false;
|
|
1849
|
+
return this.regexp;
|
|
1850
|
+
}
|
|
1851
|
+
const options = this.options;
|
|
1852
|
+
const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
|
|
1853
|
+
const flags = new Set(options.nocase ? ["i"] : []);
|
|
1854
|
+
let re = set.map((pattern) => {
|
|
1855
|
+
const pp = pattern.map((p) => {
|
|
1856
|
+
if (p instanceof RegExp) {
|
|
1857
|
+
for (const f of p.flags.split(""))
|
|
1858
|
+
flags.add(f);
|
|
1859
|
+
}
|
|
1860
|
+
return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
|
|
1861
|
+
});
|
|
1862
|
+
pp.forEach((p, i2) => {
|
|
1863
|
+
const next = pp[i2 + 1];
|
|
1864
|
+
const prev = pp[i2 - 1];
|
|
1865
|
+
if (p !== GLOBSTAR || prev === GLOBSTAR) {
|
|
1866
|
+
return;
|
|
1867
|
+
}
|
|
1868
|
+
if (prev === void 0) {
|
|
1869
|
+
if (next !== void 0 && next !== GLOBSTAR) {
|
|
1870
|
+
pp[i2 + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
1871
|
+
} else {
|
|
1872
|
+
pp[i2] = twoStar;
|
|
1873
|
+
}
|
|
1874
|
+
} else if (next === void 0) {
|
|
1875
|
+
pp[i2 - 1] = prev + "(?:\\/|" + twoStar + ")?";
|
|
1876
|
+
} else if (next !== GLOBSTAR) {
|
|
1877
|
+
pp[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
1878
|
+
pp[i2 + 1] = GLOBSTAR;
|
|
1879
|
+
}
|
|
1880
|
+
});
|
|
1881
|
+
return pp.filter((p) => p !== GLOBSTAR).join("/");
|
|
1882
|
+
}).join("|");
|
|
1883
|
+
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
1884
|
+
re = "^" + open + re + close + "$";
|
|
1885
|
+
if (this.negate)
|
|
1886
|
+
re = "^(?!" + re + ").+$";
|
|
1887
|
+
try {
|
|
1888
|
+
this.regexp = new RegExp(re, [...flags].join(""));
|
|
1889
|
+
} catch (ex) {
|
|
1890
|
+
this.regexp = false;
|
|
1891
|
+
}
|
|
1892
|
+
return this.regexp;
|
|
1893
|
+
}
|
|
1894
|
+
slashSplit(p) {
|
|
1895
|
+
if (this.preserveMultipleSlashes) {
|
|
1896
|
+
return p.split("/");
|
|
1897
|
+
} else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
|
|
1898
|
+
return ["", ...p.split(/\/+/)];
|
|
1899
|
+
} else {
|
|
1900
|
+
return p.split(/\/+/);
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
match(f, partial = this.partial) {
|
|
1904
|
+
this.debug("match", f, this.pattern);
|
|
1905
|
+
if (this.comment) {
|
|
1906
|
+
return false;
|
|
1907
|
+
}
|
|
1908
|
+
if (this.empty) {
|
|
1909
|
+
return f === "";
|
|
1910
|
+
}
|
|
1911
|
+
if (f === "/" && partial) {
|
|
1912
|
+
return true;
|
|
1913
|
+
}
|
|
1914
|
+
const options = this.options;
|
|
1915
|
+
if (this.isWindows) {
|
|
1916
|
+
f = f.split("\\").join("/");
|
|
1917
|
+
}
|
|
1918
|
+
const ff = this.slashSplit(f);
|
|
1919
|
+
this.debug(this.pattern, "split", ff);
|
|
1920
|
+
const set = this.set;
|
|
1921
|
+
this.debug(this.pattern, "set", set);
|
|
1922
|
+
let filename = ff[ff.length - 1];
|
|
1923
|
+
if (!filename) {
|
|
1924
|
+
for (let i2 = ff.length - 2; !filename && i2 >= 0; i2--) {
|
|
1925
|
+
filename = ff[i2];
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
for (let i2 = 0; i2 < set.length; i2++) {
|
|
1929
|
+
const pattern = set[i2];
|
|
1930
|
+
let file = ff;
|
|
1931
|
+
if (options.matchBase && pattern.length === 1) {
|
|
1932
|
+
file = [filename];
|
|
1933
|
+
}
|
|
1934
|
+
const hit = this.matchOne(file, pattern, partial);
|
|
1935
|
+
if (hit) {
|
|
1936
|
+
if (options.flipNegate) {
|
|
1937
|
+
return true;
|
|
1938
|
+
}
|
|
1939
|
+
return !this.negate;
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
if (options.flipNegate) {
|
|
1943
|
+
return false;
|
|
1944
|
+
}
|
|
1945
|
+
return this.negate;
|
|
1946
|
+
}
|
|
1947
|
+
static defaults(def) {
|
|
1948
|
+
return minimatch.defaults(def).Minimatch;
|
|
1949
|
+
}
|
|
1950
|
+
};
|
|
1951
|
+
minimatch.AST = AST;
|
|
1952
|
+
minimatch.Minimatch = Minimatch;
|
|
1953
|
+
minimatch.escape = escape;
|
|
1954
|
+
minimatch.unescape = unescape;
|
|
1955
|
+
|
|
358
1956
|
// src/utils/query-nonce-meta-tag-content.ts
|
|
359
1957
|
function queryNonceMetaTagContent(doc) {
|
|
360
1958
|
var _a, _b, _c;
|
|
@@ -532,12 +2130,20 @@ function createStyleSheetIfNeededAndSupported(styles2) {
|
|
|
532
2130
|
|
|
533
2131
|
// src/utils/shadow-root.ts
|
|
534
2132
|
var globalStyleSheet;
|
|
2133
|
+
var GLOBAL_STYLE_ID = "sc-global";
|
|
535
2134
|
function createShadowRoot(cmpMeta) {
|
|
536
2135
|
var _a;
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
delegatesFocus
|
|
540
|
-
}
|
|
2136
|
+
const opts = { mode: "open" };
|
|
2137
|
+
if (BUILD8.shadowDelegatesFocus) {
|
|
2138
|
+
opts.delegatesFocus = !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */);
|
|
2139
|
+
}
|
|
2140
|
+
if (BUILD8.shadowSlotAssignmentManual) {
|
|
2141
|
+
const isManual = !!(cmpMeta.$flags$ & 1024 /* shadowSlotAssignmentManual */);
|
|
2142
|
+
if (isManual) {
|
|
2143
|
+
opts.slotAssignment = "manual";
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
const shadowRoot = this.attachShadow(opts);
|
|
541
2147
|
if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported(globalStyles)) != null ? _a : null;
|
|
542
2148
|
if (globalStyleSheet) {
|
|
543
2149
|
if (supportsMutableAdoptedStyleSheets) {
|
|
@@ -545,6 +2151,13 @@ function createShadowRoot(cmpMeta) {
|
|
|
545
2151
|
} else {
|
|
546
2152
|
shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
|
|
547
2153
|
}
|
|
2154
|
+
} else if (globalStyles && !supportsConstructableStylesheets) {
|
|
2155
|
+
const styleElm = document.createElement("style");
|
|
2156
|
+
styleElm.innerHTML = globalStyles;
|
|
2157
|
+
if (BUILD8.hotModuleReplacement) {
|
|
2158
|
+
styleElm.setAttribute(HYDRATED_STYLE_ID, GLOBAL_STYLE_ID);
|
|
2159
|
+
}
|
|
2160
|
+
shadowRoot.prepend(styleElm);
|
|
548
2161
|
}
|
|
549
2162
|
}
|
|
550
2163
|
|
|
@@ -1196,7 +2809,7 @@ var registerStyle = (scopeId2, cssText, allowCS) => {
|
|
|
1196
2809
|
styles.set(scopeId2, style);
|
|
1197
2810
|
};
|
|
1198
2811
|
var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
1199
|
-
var _a;
|
|
2812
|
+
var _a, _b, _c;
|
|
1200
2813
|
const scopeId2 = getScopeId(cmpMeta, mode);
|
|
1201
2814
|
const style = styles.get(scopeId2);
|
|
1202
2815
|
if (!BUILD12.attachStyles || !win.document) {
|
|
@@ -1211,52 +2824,52 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1211
2824
|
if (!appliedStyles) {
|
|
1212
2825
|
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
|
1213
2826
|
}
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
|
1243
|
-
}
|
|
2827
|
+
const existingStyleElm = (BUILD12.hydrateClientSide || BUILD12.hotModuleReplacement) && styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
|
|
2828
|
+
if (existingStyleElm) {
|
|
2829
|
+
existingStyleElm.innerHTML = style;
|
|
2830
|
+
} else if (!appliedStyles.has(scopeId2)) {
|
|
2831
|
+
styleElm = win.document.createElement("style");
|
|
2832
|
+
styleElm.innerHTML = style;
|
|
2833
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
2834
|
+
if (nonce != null) {
|
|
2835
|
+
styleElm.setAttribute("nonce", nonce);
|
|
2836
|
+
}
|
|
2837
|
+
if ((BUILD12.hydrateServerSide || BUILD12.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */ || cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
2838
|
+
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
|
|
2839
|
+
}
|
|
2840
|
+
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
2841
|
+
if (styleContainerNode.nodeName === "HEAD") {
|
|
2842
|
+
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
|
2843
|
+
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
|
2844
|
+
styleContainerNode.insertBefore(
|
|
2845
|
+
styleElm,
|
|
2846
|
+
(referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
|
|
2847
|
+
);
|
|
2848
|
+
} else if ("host" in styleContainerNode) {
|
|
2849
|
+
if (supportsConstructableStylesheets) {
|
|
2850
|
+
const currentWindow = (_b = styleContainerNode.defaultView) != null ? _b : styleContainerNode.ownerDocument.defaultView;
|
|
2851
|
+
const stylesheet = new currentWindow.CSSStyleSheet();
|
|
2852
|
+
stylesheet.replaceSync(style);
|
|
2853
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
2854
|
+
styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
|
|
1244
2855
|
} else {
|
|
1245
|
-
|
|
1246
|
-
if (existingStyleContainer) {
|
|
1247
|
-
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
|
1248
|
-
} else {
|
|
1249
|
-
styleContainerNode.prepend(styleElm);
|
|
1250
|
-
}
|
|
2856
|
+
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
|
1251
2857
|
}
|
|
1252
2858
|
} else {
|
|
1253
|
-
styleContainerNode.
|
|
2859
|
+
const existingStyleContainer = styleContainerNode.querySelector("style");
|
|
2860
|
+
if (existingStyleContainer) {
|
|
2861
|
+
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
|
2862
|
+
} else {
|
|
2863
|
+
styleContainerNode.prepend(styleElm);
|
|
2864
|
+
}
|
|
1254
2865
|
}
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
styleContainerNode.insertBefore(styleElm, null);
|
|
2866
|
+
} else {
|
|
2867
|
+
styleContainerNode.append(styleElm);
|
|
1258
2868
|
}
|
|
1259
2869
|
}
|
|
2870
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2871
|
+
styleContainerNode.insertBefore(styleElm, null);
|
|
2872
|
+
}
|
|
1260
2873
|
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
|
1261
2874
|
styleElm.innerHTML += SLOT_FB_CSS;
|
|
1262
2875
|
}
|
|
@@ -1264,11 +2877,28 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1264
2877
|
appliedStyles.add(scopeId2);
|
|
1265
2878
|
}
|
|
1266
2879
|
}
|
|
1267
|
-
} else if (BUILD12.constructableCSS
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
2880
|
+
} else if (BUILD12.constructableCSS) {
|
|
2881
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
2882
|
+
if (!appliedStyles) {
|
|
2883
|
+
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
|
2884
|
+
}
|
|
2885
|
+
if (!appliedStyles.has(scopeId2)) {
|
|
2886
|
+
const currentWindow = (_c = styleContainerNode.defaultView) != null ? _c : styleContainerNode.ownerDocument.defaultView;
|
|
2887
|
+
let stylesheet;
|
|
2888
|
+
if (style.constructor === currentWindow.CSSStyleSheet) {
|
|
2889
|
+
stylesheet = style;
|
|
2890
|
+
} else {
|
|
2891
|
+
stylesheet = new currentWindow.CSSStyleSheet();
|
|
2892
|
+
for (let i2 = 0; i2 < style.cssRules.length; i2++) {
|
|
2893
|
+
stylesheet.insertRule(style.cssRules[i2].cssText, i2);
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
2897
|
+
styleContainerNode.adoptedStyleSheets.push(stylesheet);
|
|
2898
|
+
} else {
|
|
2899
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
|
|
2900
|
+
}
|
|
2901
|
+
appliedStyles.add(scopeId2);
|
|
1272
2902
|
}
|
|
1273
2903
|
}
|
|
1274
2904
|
}
|
|
@@ -1448,7 +3078,7 @@ var validateInputProperties = (inputElm) => {
|
|
|
1448
3078
|
|
|
1449
3079
|
// src/runtime/client-hydrate.ts
|
|
1450
3080
|
var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
1451
|
-
var _a, _b;
|
|
3081
|
+
var _a, _b, _c, _d;
|
|
1452
3082
|
const endHydrate = createTime("hydrateClient", tagName);
|
|
1453
3083
|
const shadowRoot = hostElm.shadowRoot;
|
|
1454
3084
|
const childRenderNodes = [];
|
|
@@ -1541,6 +3171,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1541
3171
|
let snGroupIdx;
|
|
1542
3172
|
let snGroupLen;
|
|
1543
3173
|
let slottedItem;
|
|
3174
|
+
let currentPos = 0;
|
|
1544
3175
|
for (snIndex; snIndex < snLen; snIndex++) {
|
|
1545
3176
|
slotGroup = slottedNodes[snIndex];
|
|
1546
3177
|
if (!slotGroup || !slotGroup.length) continue;
|
|
@@ -1554,7 +3185,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1554
3185
|
if (!hosts[slottedItem.hostId]) continue;
|
|
1555
3186
|
const hostEle = hosts[slottedItem.hostId];
|
|
1556
3187
|
if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
|
|
1557
|
-
hostEle.
|
|
3188
|
+
hostEle.insertBefore(slottedItem.node, (_c = (_b = slotGroup[snGroupIdx - 1]) == null ? void 0 : _b.node) == null ? void 0 : _c.nextSibling);
|
|
1558
3189
|
}
|
|
1559
3190
|
if (!hostEle.shadowRoot || !shadowRoot) {
|
|
1560
3191
|
if (!slottedItem.slot["s-cr"]) {
|
|
@@ -1565,14 +3196,15 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1565
3196
|
slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
|
|
1566
3197
|
}
|
|
1567
3198
|
}
|
|
1568
|
-
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
|
|
1569
|
-
if (((
|
|
3199
|
+
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
|
|
3200
|
+
if (((_d = slottedItem.node.parentElement) == null ? void 0 : _d.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
|
|
1570
3201
|
slottedItem.node.removeAttribute("slot");
|
|
1571
3202
|
}
|
|
1572
3203
|
if (BUILD14.experimentalSlotFixes) {
|
|
1573
3204
|
patchSlottedNode(slottedItem.node);
|
|
1574
3205
|
}
|
|
1575
3206
|
}
|
|
3207
|
+
currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
|
|
1576
3208
|
}
|
|
1577
3209
|
}
|
|
1578
3210
|
if (BUILD14.scoped && scopeId2 && slotNodes.length) {
|
|
@@ -1594,7 +3226,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1594
3226
|
if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
|
|
1595
3227
|
if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
|
|
1596
3228
|
node.removeAttribute("hidden");
|
|
1597
|
-
} else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue
|
|
3229
|
+
} else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue) {
|
|
1598
3230
|
node.parentNode.removeChild(node);
|
|
1599
3231
|
}
|
|
1600
3232
|
}
|
|
@@ -1761,10 +3393,6 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1761
3393
|
vnode.$elm$ = node;
|
|
1762
3394
|
vnode.$index$ = "0";
|
|
1763
3395
|
parentVNode.$children$ = [vnode];
|
|
1764
|
-
} else {
|
|
1765
|
-
if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim() && !node["s-nr"]) {
|
|
1766
|
-
node.remove();
|
|
1767
|
-
}
|
|
1768
3396
|
}
|
|
1769
3397
|
return parentVNode;
|
|
1770
3398
|
};
|
|
@@ -2138,16 +3766,16 @@ var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
|
|
|
2138
3766
|
let scopedSelector = "";
|
|
2139
3767
|
let startIndex = 0;
|
|
2140
3768
|
let res;
|
|
2141
|
-
const
|
|
3769
|
+
const sep2 = /( |>|\+|~(?!=))(?=(?:[^()]*\([^()]*\))*[^()]*$)\s*/g;
|
|
2142
3770
|
const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
|
|
2143
3771
|
let shouldScope = !hasHost;
|
|
2144
|
-
while ((res =
|
|
3772
|
+
while ((res = sep2.exec(selector)) !== null) {
|
|
2145
3773
|
const separator = res[1];
|
|
2146
3774
|
const part2 = selector.slice(startIndex, res.index).trim();
|
|
2147
3775
|
shouldScope = shouldScope || part2.indexOf(_polyfillHostNoCombinator) > -1;
|
|
2148
3776
|
const scopedPart = shouldScope ? _scopeSelectorPart(part2) : part2;
|
|
2149
3777
|
scopedSelector += `${scopedPart} ${separator} `;
|
|
2150
|
-
startIndex =
|
|
3778
|
+
startIndex = sep2.lastIndex;
|
|
2151
3779
|
}
|
|
2152
3780
|
const part = selector.substring(startIndex);
|
|
2153
3781
|
shouldScope = !part.match(_safePartRe) && (shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1);
|
|
@@ -2594,10 +4222,11 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2594
4222
|
elm.classList.add(elm["s-si"] = scopeId);
|
|
2595
4223
|
}
|
|
2596
4224
|
if (newVNode2.$children$) {
|
|
4225
|
+
const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
|
|
2597
4226
|
for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
|
|
2598
4227
|
childNode = createElm(oldParentVNode, newVNode2, i2);
|
|
2599
4228
|
if (childNode) {
|
|
2600
|
-
|
|
4229
|
+
appendTarget.appendChild(childNode);
|
|
2601
4230
|
}
|
|
2602
4231
|
}
|
|
2603
4232
|
}
|
|
@@ -2684,6 +4313,9 @@ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
|
2684
4313
|
if (BUILD20.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
2685
4314
|
containerElm = containerElm.shadowRoot;
|
|
2686
4315
|
}
|
|
4316
|
+
if (parentVNode.$tag$ === "template") {
|
|
4317
|
+
containerElm = containerElm.content;
|
|
4318
|
+
}
|
|
2687
4319
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
2688
4320
|
if (vnodes[startIdx]) {
|
|
2689
4321
|
childNode = createElm(null, parentVNode, startIdx);
|
|
@@ -2727,6 +4359,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2727
4359
|
let newEndVnode = newCh[newEndIdx];
|
|
2728
4360
|
let node;
|
|
2729
4361
|
let elmToMove;
|
|
4362
|
+
const containerElm = newVNode2.$tag$ === "template" ? parentElm.content : parentElm;
|
|
2730
4363
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
2731
4364
|
if (oldStartVnode == null) {
|
|
2732
4365
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
@@ -2749,7 +4382,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2749
4382
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
2750
4383
|
}
|
|
2751
4384
|
patch(oldStartVnode, newEndVnode, isInitialRender);
|
|
2752
|
-
insertBefore(
|
|
4385
|
+
insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
2753
4386
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
2754
4387
|
newEndVnode = newCh[--newEndIdx];
|
|
2755
4388
|
} else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
|
|
@@ -2757,7 +4390,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2757
4390
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
2758
4391
|
}
|
|
2759
4392
|
patch(oldEndVnode, newStartVnode, isInitialRender);
|
|
2760
|
-
insertBefore(
|
|
4393
|
+
insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
2761
4394
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
2762
4395
|
newStartVnode = newCh[++newStartIdx];
|
|
2763
4396
|
} else {
|
|
@@ -3032,13 +4665,16 @@ render() {
|
|
|
3032
4665
|
for (const relocateData of relocateNodes) {
|
|
3033
4666
|
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
3034
4667
|
const slotRefNode = relocateData.$slotRefNode$;
|
|
4668
|
+
if (nodeToRelocate.nodeType === 1 /* ElementNode */ && isInitialLoad) {
|
|
4669
|
+
nodeToRelocate["s-ih"] = (_a = nodeToRelocate.hidden) != null ? _a : false;
|
|
4670
|
+
}
|
|
3035
4671
|
if (slotRefNode) {
|
|
3036
4672
|
const parentNodeRef = slotRefNode.parentNode;
|
|
3037
4673
|
let insertBeforeNode = slotRefNode.nextSibling;
|
|
3038
4674
|
if (!BUILD20.hydrateServerSide && (!BUILD20.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */)) {
|
|
3039
|
-
let orgLocationNode = (
|
|
4675
|
+
let orgLocationNode = (_b = nodeToRelocate["s-ol"]) == null ? void 0 : _b.previousSibling;
|
|
3040
4676
|
while (orgLocationNode) {
|
|
3041
|
-
let refNode = (
|
|
4677
|
+
let refNode = (_c = orgLocationNode["s-nr"]) != null ? _c : null;
|
|
3042
4678
|
if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === (refNode.__parentNode || refNode.parentNode)) {
|
|
3043
4679
|
refNode = refNode.nextSibling;
|
|
3044
4680
|
while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
|
|
@@ -3061,18 +4697,13 @@ render() {
|
|
|
3061
4697
|
}
|
|
3062
4698
|
insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
|
|
3063
4699
|
if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
|
|
3064
|
-
nodeToRelocate.hidden = (
|
|
4700
|
+
nodeToRelocate.hidden = (_d = nodeToRelocate["s-ih"]) != null ? _d : false;
|
|
3065
4701
|
}
|
|
3066
4702
|
}
|
|
3067
4703
|
}
|
|
3068
4704
|
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
|
|
3069
|
-
} else {
|
|
3070
|
-
|
|
3071
|
-
if (isInitialLoad) {
|
|
3072
|
-
nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
|
|
3073
|
-
}
|
|
3074
|
-
nodeToRelocate.hidden = true;
|
|
3075
|
-
}
|
|
4705
|
+
} else if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
4706
|
+
nodeToRelocate.hidden = true;
|
|
3076
4707
|
}
|
|
3077
4708
|
}
|
|
3078
4709
|
}
|
|
@@ -3426,7 +5057,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3426
5057
|
if (BUILD22.serializer && BUILD22.reflect && cmpMeta.$attrsToReflect$) {
|
|
3427
5058
|
if (instance && cmpMeta.$serializers$ && cmpMeta.$serializers$[propName]) {
|
|
3428
5059
|
let attrVal = newVal;
|
|
3429
|
-
for (const
|
|
5060
|
+
for (const serializer of cmpMeta.$serializers$[propName]) {
|
|
5061
|
+
const [[methodName]] = Object.entries(serializer);
|
|
3430
5062
|
attrVal = instance[methodName](attrVal, propName);
|
|
3431
5063
|
}
|
|
3432
5064
|
hostRef.$serializerValues$.set(propName, attrVal);
|
|
@@ -3455,27 +5087,34 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3455
5087
|
);
|
|
3456
5088
|
}
|
|
3457
5089
|
}
|
|
3458
|
-
if (
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
5090
|
+
if (BUILD22.propChangeCallback && cmpMeta.$watchers$) {
|
|
5091
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
|
5092
|
+
if (watchMethods) {
|
|
5093
|
+
watchMethods.map((watcher) => {
|
|
5094
|
+
try {
|
|
5095
|
+
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
5096
|
+
if (flags & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */) {
|
|
5097
|
+
if (!instance) {
|
|
5098
|
+
hostRef.$fetchedCbList$.push(() => {
|
|
5099
|
+
hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
|
|
5100
|
+
});
|
|
5101
|
+
} else {
|
|
5102
|
+
instance[watchMethodName](newVal, oldVal, propName);
|
|
5103
|
+
}
|
|
3467
5104
|
}
|
|
3468
|
-
})
|
|
3469
|
-
|
|
3470
|
-
}
|
|
3471
|
-
if (BUILD22.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
3472
|
-
if (instance.componentShouldUpdate) {
|
|
3473
|
-
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
3474
|
-
return;
|
|
5105
|
+
} catch (e) {
|
|
5106
|
+
consoleError(e, elm);
|
|
3475
5107
|
}
|
|
5108
|
+
});
|
|
5109
|
+
}
|
|
5110
|
+
}
|
|
5111
|
+
if (BUILD22.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
5112
|
+
if (instance.componentShouldUpdate) {
|
|
5113
|
+
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
5114
|
+
return;
|
|
3476
5115
|
}
|
|
3477
|
-
scheduleUpdate(hostRef, false);
|
|
3478
5116
|
}
|
|
5117
|
+
scheduleUpdate(hostRef, false);
|
|
3479
5118
|
}
|
|
3480
5119
|
}
|
|
3481
5120
|
};
|
|
@@ -3658,7 +5297,8 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3658
5297
|
this[propName] = deserializeVal;
|
|
3659
5298
|
}
|
|
3660
5299
|
};
|
|
3661
|
-
for (const
|
|
5300
|
+
for (const deserializer of cmpMeta.$deserializers$[propName]) {
|
|
5301
|
+
const [[methodName]] = Object.entries(deserializer);
|
|
3662
5302
|
if (BUILD23.lazyLoad) {
|
|
3663
5303
|
if (hostRef.$lazyInstance$) {
|
|
3664
5304
|
setVal(methodName, hostRef.$lazyInstance$);
|
|
@@ -3677,13 +5317,14 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3677
5317
|
return;
|
|
3678
5318
|
} else if (propName == null) {
|
|
3679
5319
|
const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
|
|
3680
|
-
if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) &&
|
|
5320
|
+
if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && newValue !== oldValue) {
|
|
3681
5321
|
const elm = BUILD23.lazyLoad ? hostRef.$hostElement$ : this;
|
|
3682
5322
|
const instance = BUILD23.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
3683
5323
|
const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
|
|
3684
|
-
entry == null ? void 0 : entry.forEach((
|
|
3685
|
-
|
|
3686
|
-
|
|
5324
|
+
entry == null ? void 0 : entry.forEach((watcher) => {
|
|
5325
|
+
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
5326
|
+
if (instance[watchMethodName] != null && (flags2 & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */)) {
|
|
5327
|
+
instance[watchMethodName].call(instance, newValue, oldValue, attrName);
|
|
3687
5328
|
}
|
|
3688
5329
|
});
|
|
3689
5330
|
}
|
|
@@ -3784,7 +5425,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3784
5425
|
}
|
|
3785
5426
|
}
|
|
3786
5427
|
const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
|
|
3787
|
-
if (!styles.has(scopeId2)) {
|
|
5428
|
+
if (!styles.has(scopeId2) || BUILD24.hotModuleReplacement && hmrVersionId) {
|
|
3788
5429
|
const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
|
|
3789
5430
|
if (BUILD24.hydrateServerSide && BUILD24.shadowDom) {
|
|
3790
5431
|
if (cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
|
|
@@ -3952,7 +5593,7 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3952
5593
|
if (BUILD27.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
3953
5594
|
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
3954
5595
|
}
|
|
3955
|
-
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /*
|
|
5596
|
+
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /* hasSlot */) {
|
|
3956
5597
|
if (BUILD27.experimentalSlotFixes) {
|
|
3957
5598
|
patchPseudoShadowDom(Cstr.prototype);
|
|
3958
5599
|
} else {
|
|
@@ -4184,7 +5825,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
4184
5825
|
return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
|
|
4185
5826
|
}
|
|
4186
5827
|
};
|
|
4187
|
-
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /*
|
|
5828
|
+
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /* hasSlot */) {
|
|
4188
5829
|
if (BUILD28.experimentalSlotFixes) {
|
|
4189
5830
|
patchPseudoShadowDom(HostElement.prototype);
|
|
4190
5831
|
} else {
|