@stencil/core 4.39.0 → 4.40.1-dev.1766552834.64f6089
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.cjs +1616 -41
- package/cli/index.js +1616 -41
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +2791 -2515
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +1665 -90
- package/internal/app-data/index.cjs +1 -0
- package/internal/app-data/index.js +1 -0
- package/internal/app-data/package.json +1 -1
- package/internal/app-globals/package.json +1 -1
- package/internal/client/index.js +1746 -105
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +1770 -133
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +1794 -104
- package/internal/package.json +1 -1
- package/internal/stencil-private.d.ts +25 -2
- package/internal/stencil-public-compiler.d.ts +33 -3
- package/internal/stencil-public-runtime.d.ts +14 -3
- package/internal/testing/index.js +1758 -133
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +8 -1
- package/mock-doc/index.js +8 -1
- package/mock-doc/package.json +1 -1
- package/package.json +1 -1
- package/screenshot/index.js +1608 -30
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/index.js +28 -28
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +1696 -109
- package/testing/package.json +1 -1
|
@@ -1,11 +1,253 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Stencil Hydrate Platform v4.
|
|
2
|
+
Stencil Hydrate 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/hydrate/platform/index.ts
|
|
11
253
|
import { BUILD as BUILD25 } from "@stencil/core/internal/app-data";
|
|
@@ -76,11 +318,11 @@ function getPropertyDescriptor(obj, memberName) {
|
|
|
76
318
|
}
|
|
77
319
|
|
|
78
320
|
// src/runtime/asset-path.ts
|
|
79
|
-
var getAssetPath = (
|
|
80
|
-
const assetUrl = new URL(
|
|
321
|
+
var getAssetPath = (path2) => {
|
|
322
|
+
const assetUrl = new URL(path2, plt.$resourcesUrl$);
|
|
81
323
|
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
|
|
82
324
|
};
|
|
83
|
-
var setAssetPath = (
|
|
325
|
+
var setAssetPath = (path2) => plt.$resourcesUrl$ = path2;
|
|
84
326
|
|
|
85
327
|
// src/runtime/bootstrap-custom-element.ts
|
|
86
328
|
import { BUILD as BUILD21 } from "@stencil/core/internal/app-data";
|
|
@@ -92,6 +334,1359 @@ var isComplexType = (o) => {
|
|
|
92
334
|
return o === "object" || o === "function";
|
|
93
335
|
};
|
|
94
336
|
|
|
337
|
+
// node_modules/minimatch/dist/esm/index.js
|
|
338
|
+
var import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
339
|
+
|
|
340
|
+
// node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
341
|
+
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
342
|
+
var assertValidPattern = (pattern) => {
|
|
343
|
+
if (typeof pattern !== "string") {
|
|
344
|
+
throw new TypeError("invalid pattern");
|
|
345
|
+
}
|
|
346
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
347
|
+
throw new TypeError("pattern is too long");
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
// node_modules/minimatch/dist/esm/brace-expressions.js
|
|
352
|
+
var posixClasses = {
|
|
353
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
354
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
355
|
+
"[:ascii:]": ["\\x00-\\x7f", false],
|
|
356
|
+
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
357
|
+
"[:cntrl:]": ["\\p{Cc}", true],
|
|
358
|
+
"[:digit:]": ["\\p{Nd}", true],
|
|
359
|
+
"[:graph:]": ["\\p{Z}\\p{C}", true, true],
|
|
360
|
+
"[:lower:]": ["\\p{Ll}", true],
|
|
361
|
+
"[:print:]": ["\\p{C}", true],
|
|
362
|
+
"[:punct:]": ["\\p{P}", true],
|
|
363
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
364
|
+
"[:upper:]": ["\\p{Lu}", true],
|
|
365
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
366
|
+
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
367
|
+
};
|
|
368
|
+
var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
369
|
+
var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
370
|
+
var rangesToString = (ranges) => ranges.join("");
|
|
371
|
+
var parseClass = (glob, position) => {
|
|
372
|
+
const pos = position;
|
|
373
|
+
if (glob.charAt(pos) !== "[") {
|
|
374
|
+
throw new Error("not in a brace expression");
|
|
375
|
+
}
|
|
376
|
+
const ranges = [];
|
|
377
|
+
const negs = [];
|
|
378
|
+
let i2 = pos + 1;
|
|
379
|
+
let sawStart = false;
|
|
380
|
+
let uflag = false;
|
|
381
|
+
let escaping = false;
|
|
382
|
+
let negate = false;
|
|
383
|
+
let endPos = pos;
|
|
384
|
+
let rangeStart = "";
|
|
385
|
+
WHILE: while (i2 < glob.length) {
|
|
386
|
+
const c = glob.charAt(i2);
|
|
387
|
+
if ((c === "!" || c === "^") && i2 === pos + 1) {
|
|
388
|
+
negate = true;
|
|
389
|
+
i2++;
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
if (c === "]" && sawStart && !escaping) {
|
|
393
|
+
endPos = i2 + 1;
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
sawStart = true;
|
|
397
|
+
if (c === "\\") {
|
|
398
|
+
if (!escaping) {
|
|
399
|
+
escaping = true;
|
|
400
|
+
i2++;
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (c === "[" && !escaping) {
|
|
405
|
+
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
406
|
+
if (glob.startsWith(cls, i2)) {
|
|
407
|
+
if (rangeStart) {
|
|
408
|
+
return ["$.", false, glob.length - pos, true];
|
|
409
|
+
}
|
|
410
|
+
i2 += cls.length;
|
|
411
|
+
if (neg)
|
|
412
|
+
negs.push(unip);
|
|
413
|
+
else
|
|
414
|
+
ranges.push(unip);
|
|
415
|
+
uflag = uflag || u;
|
|
416
|
+
continue WHILE;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
escaping = false;
|
|
421
|
+
if (rangeStart) {
|
|
422
|
+
if (c > rangeStart) {
|
|
423
|
+
ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
|
|
424
|
+
} else if (c === rangeStart) {
|
|
425
|
+
ranges.push(braceEscape(c));
|
|
426
|
+
}
|
|
427
|
+
rangeStart = "";
|
|
428
|
+
i2++;
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
if (glob.startsWith("-]", i2 + 1)) {
|
|
432
|
+
ranges.push(braceEscape(c + "-"));
|
|
433
|
+
i2 += 2;
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
if (glob.startsWith("-", i2 + 1)) {
|
|
437
|
+
rangeStart = c;
|
|
438
|
+
i2 += 2;
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
ranges.push(braceEscape(c));
|
|
442
|
+
i2++;
|
|
443
|
+
}
|
|
444
|
+
if (endPos < i2) {
|
|
445
|
+
return ["", false, 0, false];
|
|
446
|
+
}
|
|
447
|
+
if (!ranges.length && !negs.length) {
|
|
448
|
+
return ["$.", false, glob.length - pos, true];
|
|
449
|
+
}
|
|
450
|
+
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
|
|
451
|
+
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
452
|
+
return [regexpEscape(r), false, endPos - pos, false];
|
|
453
|
+
}
|
|
454
|
+
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
|
|
455
|
+
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
456
|
+
const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
|
|
457
|
+
return [comb, uflag, endPos - pos, true];
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
// node_modules/minimatch/dist/esm/unescape.js
|
|
461
|
+
var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
462
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
// node_modules/minimatch/dist/esm/ast.js
|
|
466
|
+
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
467
|
+
var isExtglobType = (c) => types.has(c);
|
|
468
|
+
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
469
|
+
var startNoDot = "(?!\\.)";
|
|
470
|
+
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
|
471
|
+
var justDots = /* @__PURE__ */ new Set(["..", "."]);
|
|
472
|
+
var reSpecials = new Set("().*{}+?[]^$\\!");
|
|
473
|
+
var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
474
|
+
var qmark = "[^/]";
|
|
475
|
+
var star = qmark + "*?";
|
|
476
|
+
var starNoEmpty = qmark + "+?";
|
|
477
|
+
var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
|
|
478
|
+
var _AST = class _AST {
|
|
479
|
+
constructor(type, parent, options = {}) {
|
|
480
|
+
__privateAdd(this, _AST_instances);
|
|
481
|
+
__publicField(this, "type");
|
|
482
|
+
__privateAdd(this, _root);
|
|
483
|
+
__privateAdd(this, _hasMagic);
|
|
484
|
+
__privateAdd(this, _uflag, false);
|
|
485
|
+
__privateAdd(this, _parts, []);
|
|
486
|
+
__privateAdd(this, _parent);
|
|
487
|
+
__privateAdd(this, _parentIndex);
|
|
488
|
+
__privateAdd(this, _negs);
|
|
489
|
+
__privateAdd(this, _filledNegs, false);
|
|
490
|
+
__privateAdd(this, _options);
|
|
491
|
+
__privateAdd(this, _toString);
|
|
492
|
+
// set to true if it's an extglob with no children
|
|
493
|
+
// (which really means one child of '')
|
|
494
|
+
__privateAdd(this, _emptyExt, false);
|
|
495
|
+
this.type = type;
|
|
496
|
+
if (type)
|
|
497
|
+
__privateSet(this, _hasMagic, true);
|
|
498
|
+
__privateSet(this, _parent, parent);
|
|
499
|
+
__privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
|
|
500
|
+
__privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
|
|
501
|
+
__privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
|
|
502
|
+
if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
|
|
503
|
+
__privateGet(this, _negs).push(this);
|
|
504
|
+
__privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
|
|
505
|
+
}
|
|
506
|
+
get hasMagic() {
|
|
507
|
+
if (__privateGet(this, _hasMagic) !== void 0)
|
|
508
|
+
return __privateGet(this, _hasMagic);
|
|
509
|
+
for (const p of __privateGet(this, _parts)) {
|
|
510
|
+
if (typeof p === "string")
|
|
511
|
+
continue;
|
|
512
|
+
if (p.type || p.hasMagic)
|
|
513
|
+
return __privateSet(this, _hasMagic, true);
|
|
514
|
+
}
|
|
515
|
+
return __privateGet(this, _hasMagic);
|
|
516
|
+
}
|
|
517
|
+
// reconstructs the pattern
|
|
518
|
+
toString() {
|
|
519
|
+
if (__privateGet(this, _toString) !== void 0)
|
|
520
|
+
return __privateGet(this, _toString);
|
|
521
|
+
if (!this.type) {
|
|
522
|
+
return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
|
|
523
|
+
} else {
|
|
524
|
+
return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
push(...parts) {
|
|
528
|
+
for (const p of parts) {
|
|
529
|
+
if (p === "")
|
|
530
|
+
continue;
|
|
531
|
+
if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
|
|
532
|
+
throw new Error("invalid part: " + p);
|
|
533
|
+
}
|
|
534
|
+
__privateGet(this, _parts).push(p);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
toJSON() {
|
|
538
|
+
var _a;
|
|
539
|
+
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())];
|
|
540
|
+
if (this.isStart() && !this.type)
|
|
541
|
+
ret.unshift([]);
|
|
542
|
+
if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")) {
|
|
543
|
+
ret.push({});
|
|
544
|
+
}
|
|
545
|
+
return ret;
|
|
546
|
+
}
|
|
547
|
+
isStart() {
|
|
548
|
+
var _a;
|
|
549
|
+
if (__privateGet(this, _root) === this)
|
|
550
|
+
return true;
|
|
551
|
+
if (!((_a = __privateGet(this, _parent)) == null ? void 0 : _a.isStart()))
|
|
552
|
+
return false;
|
|
553
|
+
if (__privateGet(this, _parentIndex) === 0)
|
|
554
|
+
return true;
|
|
555
|
+
const p = __privateGet(this, _parent);
|
|
556
|
+
for (let i2 = 0; i2 < __privateGet(this, _parentIndex); i2++) {
|
|
557
|
+
const pp = __privateGet(p, _parts)[i2];
|
|
558
|
+
if (!(pp instanceof _AST && pp.type === "!")) {
|
|
559
|
+
return false;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
return true;
|
|
563
|
+
}
|
|
564
|
+
isEnd() {
|
|
565
|
+
var _a, _b, _c;
|
|
566
|
+
if (__privateGet(this, _root) === this)
|
|
567
|
+
return true;
|
|
568
|
+
if (((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")
|
|
569
|
+
return true;
|
|
570
|
+
if (!((_b = __privateGet(this, _parent)) == null ? void 0 : _b.isEnd()))
|
|
571
|
+
return false;
|
|
572
|
+
if (!this.type)
|
|
573
|
+
return (_c = __privateGet(this, _parent)) == null ? void 0 : _c.isEnd();
|
|
574
|
+
const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
|
|
575
|
+
return __privateGet(this, _parentIndex) === pl - 1;
|
|
576
|
+
}
|
|
577
|
+
copyIn(part) {
|
|
578
|
+
if (typeof part === "string")
|
|
579
|
+
this.push(part);
|
|
580
|
+
else
|
|
581
|
+
this.push(part.clone(this));
|
|
582
|
+
}
|
|
583
|
+
clone(parent) {
|
|
584
|
+
const c = new _AST(this.type, parent);
|
|
585
|
+
for (const p of __privateGet(this, _parts)) {
|
|
586
|
+
c.copyIn(p);
|
|
587
|
+
}
|
|
588
|
+
return c;
|
|
589
|
+
}
|
|
590
|
+
static fromGlob(pattern, options = {}) {
|
|
591
|
+
var _a;
|
|
592
|
+
const ast = new _AST(null, void 0, options);
|
|
593
|
+
__privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
|
|
594
|
+
return ast;
|
|
595
|
+
}
|
|
596
|
+
// returns the regular expression if there's magic, or the unescaped
|
|
597
|
+
// string if not.
|
|
598
|
+
toMMPattern() {
|
|
599
|
+
if (this !== __privateGet(this, _root))
|
|
600
|
+
return __privateGet(this, _root).toMMPattern();
|
|
601
|
+
const glob = this.toString();
|
|
602
|
+
const [re, body, hasMagic, uflag] = this.toRegExpSource();
|
|
603
|
+
const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
604
|
+
if (!anyMagic) {
|
|
605
|
+
return body;
|
|
606
|
+
}
|
|
607
|
+
const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
|
|
608
|
+
return Object.assign(new RegExp(`^${re}$`, flags), {
|
|
609
|
+
_src: re,
|
|
610
|
+
_glob: glob
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
get options() {
|
|
614
|
+
return __privateGet(this, _options);
|
|
615
|
+
}
|
|
616
|
+
// returns the string match, the regexp source, whether there's magic
|
|
617
|
+
// in the regexp (so a regular expression is required) and whether or
|
|
618
|
+
// not the uflag is needed for the regular expression (for posix classes)
|
|
619
|
+
// TODO: instead of injecting the start/end at this point, just return
|
|
620
|
+
// the BODY of the regexp, along with the start/end portions suitable
|
|
621
|
+
// for binding the start/end in either a joined full-path makeRe context
|
|
622
|
+
// (where we bind to (^|/), or a standalone matchPart context (where
|
|
623
|
+
// we bind to ^, and not /). Otherwise slashes get duped!
|
|
624
|
+
//
|
|
625
|
+
// In part-matching mode, the start is:
|
|
626
|
+
// - if not isStart: nothing
|
|
627
|
+
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
|
628
|
+
// - if dots allowed or not possible: ^
|
|
629
|
+
// - if dots possible and not allowed: ^(?!\.)
|
|
630
|
+
// end is:
|
|
631
|
+
// - if not isEnd(): nothing
|
|
632
|
+
// - else: $
|
|
633
|
+
//
|
|
634
|
+
// In full-path matching mode, we put the slash at the START of the
|
|
635
|
+
// pattern, so start is:
|
|
636
|
+
// - if first pattern: same as part-matching mode
|
|
637
|
+
// - if not isStart(): nothing
|
|
638
|
+
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
|
639
|
+
// - if dots allowed or not possible: /
|
|
640
|
+
// - if dots possible and not allowed: /(?!\.)
|
|
641
|
+
// end is:
|
|
642
|
+
// - if last pattern, same as part-matching mode
|
|
643
|
+
// - else nothing
|
|
644
|
+
//
|
|
645
|
+
// Always put the (?:$|/) on negated tails, though, because that has to be
|
|
646
|
+
// there to bind the end of the negated pattern portion, and it's easier to
|
|
647
|
+
// just stick it in now rather than try to inject it later in the middle of
|
|
648
|
+
// the pattern.
|
|
649
|
+
//
|
|
650
|
+
// We can just always return the same end, and leave it up to the caller
|
|
651
|
+
// to know whether it's going to be used joined or in parts.
|
|
652
|
+
// And, if the start is adjusted slightly, can do the same there:
|
|
653
|
+
// - if not isStart: nothing
|
|
654
|
+
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
|
655
|
+
// - if dots allowed or not possible: (?:/|^)
|
|
656
|
+
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
|
657
|
+
//
|
|
658
|
+
// But it's better to have a simpler binding without a conditional, for
|
|
659
|
+
// performance, so probably better to return both start options.
|
|
660
|
+
//
|
|
661
|
+
// Then the caller just ignores the end if it's not the first pattern,
|
|
662
|
+
// and the start always gets applied.
|
|
663
|
+
//
|
|
664
|
+
// But that's always going to be $ if it's the ending pattern, or nothing,
|
|
665
|
+
// so the caller can just attach $ at the end of the pattern when building.
|
|
666
|
+
//
|
|
667
|
+
// So the todo is:
|
|
668
|
+
// - better detect what kind of start is needed
|
|
669
|
+
// - return both flavors of starting pattern
|
|
670
|
+
// - attach $ at the end of the pattern when creating the actual RegExp
|
|
671
|
+
//
|
|
672
|
+
// Ah, but wait, no, that all only applies to the root when the first pattern
|
|
673
|
+
// is not an extglob. If the first pattern IS an extglob, then we need all
|
|
674
|
+
// that dot prevention biz to live in the extglob portions, because eg
|
|
675
|
+
// +(*|.x*) can match .xy but not .yx.
|
|
676
|
+
//
|
|
677
|
+
// So, return the two flavors if it's #root and the first child is not an
|
|
678
|
+
// AST, otherwise leave it to the child AST to handle it, and there,
|
|
679
|
+
// use the (?:^|/) style of start binding.
|
|
680
|
+
//
|
|
681
|
+
// Even simplified further:
|
|
682
|
+
// - Since the start for a join is eg /(?!\.) and the start for a part
|
|
683
|
+
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
|
684
|
+
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
685
|
+
toRegExpSource(allowDot) {
|
|
686
|
+
var _a;
|
|
687
|
+
const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
|
|
688
|
+
if (__privateGet(this, _root) === this)
|
|
689
|
+
__privateMethod(this, _AST_instances, fillNegs_fn).call(this);
|
|
690
|
+
if (!this.type) {
|
|
691
|
+
const noEmpty = this.isStart() && this.isEnd();
|
|
692
|
+
const src = __privateGet(this, _parts).map((p) => {
|
|
693
|
+
var _a2;
|
|
694
|
+
const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a2 = _AST, _AST_static, parseGlob_fn).call(_a2, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
|
|
695
|
+
__privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
|
|
696
|
+
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
697
|
+
return re;
|
|
698
|
+
}).join("");
|
|
699
|
+
let start2 = "";
|
|
700
|
+
if (this.isStart()) {
|
|
701
|
+
if (typeof __privateGet(this, _parts)[0] === "string") {
|
|
702
|
+
const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
|
|
703
|
+
if (!dotTravAllowed) {
|
|
704
|
+
const aps = addPatternStart;
|
|
705
|
+
const needNoTrav = (
|
|
706
|
+
// dots are allowed, and the pattern starts with [ or .
|
|
707
|
+
dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
708
|
+
src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
709
|
+
src.startsWith("\\.\\.") && aps.has(src.charAt(4))
|
|
710
|
+
);
|
|
711
|
+
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
712
|
+
start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
let end = "";
|
|
717
|
+
if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!") {
|
|
718
|
+
end = "(?:$|\\/)";
|
|
719
|
+
}
|
|
720
|
+
const final2 = start2 + src + end;
|
|
721
|
+
return [
|
|
722
|
+
final2,
|
|
723
|
+
unescape(src),
|
|
724
|
+
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
725
|
+
__privateGet(this, _uflag)
|
|
726
|
+
];
|
|
727
|
+
}
|
|
728
|
+
const repeated = this.type === "*" || this.type === "+";
|
|
729
|
+
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
730
|
+
let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
|
|
731
|
+
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
732
|
+
const s = this.toString();
|
|
733
|
+
__privateSet(this, _parts, [s]);
|
|
734
|
+
this.type = null;
|
|
735
|
+
__privateSet(this, _hasMagic, void 0);
|
|
736
|
+
return [s, unescape(this.toString()), false, false];
|
|
737
|
+
}
|
|
738
|
+
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
|
|
739
|
+
if (bodyDotAllowed === body) {
|
|
740
|
+
bodyDotAllowed = "";
|
|
741
|
+
}
|
|
742
|
+
if (bodyDotAllowed) {
|
|
743
|
+
body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
|
744
|
+
}
|
|
745
|
+
let final = "";
|
|
746
|
+
if (this.type === "!" && __privateGet(this, _emptyExt)) {
|
|
747
|
+
final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
|
|
748
|
+
} else {
|
|
749
|
+
const close = this.type === "!" ? (
|
|
750
|
+
// !() must match something,but !(x) can match ''
|
|
751
|
+
"))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
|
|
752
|
+
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
|
|
753
|
+
final = start + body + close;
|
|
754
|
+
}
|
|
755
|
+
return [
|
|
756
|
+
final,
|
|
757
|
+
unescape(body),
|
|
758
|
+
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
759
|
+
__privateGet(this, _uflag)
|
|
760
|
+
];
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
_root = new WeakMap();
|
|
764
|
+
_hasMagic = new WeakMap();
|
|
765
|
+
_uflag = new WeakMap();
|
|
766
|
+
_parts = new WeakMap();
|
|
767
|
+
_parent = new WeakMap();
|
|
768
|
+
_parentIndex = new WeakMap();
|
|
769
|
+
_negs = new WeakMap();
|
|
770
|
+
_filledNegs = new WeakMap();
|
|
771
|
+
_options = new WeakMap();
|
|
772
|
+
_toString = new WeakMap();
|
|
773
|
+
_emptyExt = new WeakMap();
|
|
774
|
+
_AST_instances = new WeakSet();
|
|
775
|
+
fillNegs_fn = function() {
|
|
776
|
+
if (this !== __privateGet(this, _root))
|
|
777
|
+
throw new Error("should only call on root");
|
|
778
|
+
if (__privateGet(this, _filledNegs))
|
|
779
|
+
return this;
|
|
780
|
+
this.toString();
|
|
781
|
+
__privateSet(this, _filledNegs, true);
|
|
782
|
+
let n;
|
|
783
|
+
while (n = __privateGet(this, _negs).pop()) {
|
|
784
|
+
if (n.type !== "!")
|
|
785
|
+
continue;
|
|
786
|
+
let p = n;
|
|
787
|
+
let pp = __privateGet(p, _parent);
|
|
788
|
+
while (pp) {
|
|
789
|
+
for (let i2 = __privateGet(p, _parentIndex) + 1; !pp.type && i2 < __privateGet(pp, _parts).length; i2++) {
|
|
790
|
+
for (const part of __privateGet(n, _parts)) {
|
|
791
|
+
if (typeof part === "string") {
|
|
792
|
+
throw new Error("string part in extglob AST??");
|
|
793
|
+
}
|
|
794
|
+
part.copyIn(__privateGet(pp, _parts)[i2]);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
p = pp;
|
|
798
|
+
pp = __privateGet(p, _parent);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
return this;
|
|
802
|
+
};
|
|
803
|
+
_AST_static = new WeakSet();
|
|
804
|
+
parseAST_fn = function(str, ast, pos, opt) {
|
|
805
|
+
var _a, _b;
|
|
806
|
+
let escaping = false;
|
|
807
|
+
let inBrace = false;
|
|
808
|
+
let braceStart = -1;
|
|
809
|
+
let braceNeg = false;
|
|
810
|
+
if (ast.type === null) {
|
|
811
|
+
let i3 = pos;
|
|
812
|
+
let acc2 = "";
|
|
813
|
+
while (i3 < str.length) {
|
|
814
|
+
const c = str.charAt(i3++);
|
|
815
|
+
if (escaping || c === "\\") {
|
|
816
|
+
escaping = !escaping;
|
|
817
|
+
acc2 += c;
|
|
818
|
+
continue;
|
|
819
|
+
}
|
|
820
|
+
if (inBrace) {
|
|
821
|
+
if (i3 === braceStart + 1) {
|
|
822
|
+
if (c === "^" || c === "!") {
|
|
823
|
+
braceNeg = true;
|
|
824
|
+
}
|
|
825
|
+
} else if (c === "]" && !(i3 === braceStart + 2 && braceNeg)) {
|
|
826
|
+
inBrace = false;
|
|
827
|
+
}
|
|
828
|
+
acc2 += c;
|
|
829
|
+
continue;
|
|
830
|
+
} else if (c === "[") {
|
|
831
|
+
inBrace = true;
|
|
832
|
+
braceStart = i3;
|
|
833
|
+
braceNeg = false;
|
|
834
|
+
acc2 += c;
|
|
835
|
+
continue;
|
|
836
|
+
}
|
|
837
|
+
if (!opt.noext && isExtglobType(c) && str.charAt(i3) === "(") {
|
|
838
|
+
ast.push(acc2);
|
|
839
|
+
acc2 = "";
|
|
840
|
+
const ext2 = new _AST(c, ast);
|
|
841
|
+
i3 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext2, i3, opt);
|
|
842
|
+
ast.push(ext2);
|
|
843
|
+
continue;
|
|
844
|
+
}
|
|
845
|
+
acc2 += c;
|
|
846
|
+
}
|
|
847
|
+
ast.push(acc2);
|
|
848
|
+
return i3;
|
|
849
|
+
}
|
|
850
|
+
let i2 = pos + 1;
|
|
851
|
+
let part = new _AST(null, ast);
|
|
852
|
+
const parts = [];
|
|
853
|
+
let acc = "";
|
|
854
|
+
while (i2 < str.length) {
|
|
855
|
+
const c = str.charAt(i2++);
|
|
856
|
+
if (escaping || c === "\\") {
|
|
857
|
+
escaping = !escaping;
|
|
858
|
+
acc += c;
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
if (inBrace) {
|
|
862
|
+
if (i2 === braceStart + 1) {
|
|
863
|
+
if (c === "^" || c === "!") {
|
|
864
|
+
braceNeg = true;
|
|
865
|
+
}
|
|
866
|
+
} else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
|
|
867
|
+
inBrace = false;
|
|
868
|
+
}
|
|
869
|
+
acc += c;
|
|
870
|
+
continue;
|
|
871
|
+
} else if (c === "[") {
|
|
872
|
+
inBrace = true;
|
|
873
|
+
braceStart = i2;
|
|
874
|
+
braceNeg = false;
|
|
875
|
+
acc += c;
|
|
876
|
+
continue;
|
|
877
|
+
}
|
|
878
|
+
if (isExtglobType(c) && str.charAt(i2) === "(") {
|
|
879
|
+
part.push(acc);
|
|
880
|
+
acc = "";
|
|
881
|
+
const ext2 = new _AST(c, part);
|
|
882
|
+
part.push(ext2);
|
|
883
|
+
i2 = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext2, i2, opt);
|
|
884
|
+
continue;
|
|
885
|
+
}
|
|
886
|
+
if (c === "|") {
|
|
887
|
+
part.push(acc);
|
|
888
|
+
acc = "";
|
|
889
|
+
parts.push(part);
|
|
890
|
+
part = new _AST(null, ast);
|
|
891
|
+
continue;
|
|
892
|
+
}
|
|
893
|
+
if (c === ")") {
|
|
894
|
+
if (acc === "" && __privateGet(ast, _parts).length === 0) {
|
|
895
|
+
__privateSet(ast, _emptyExt, true);
|
|
896
|
+
}
|
|
897
|
+
part.push(acc);
|
|
898
|
+
acc = "";
|
|
899
|
+
ast.push(...parts, part);
|
|
900
|
+
return i2;
|
|
901
|
+
}
|
|
902
|
+
acc += c;
|
|
903
|
+
}
|
|
904
|
+
ast.type = null;
|
|
905
|
+
__privateSet(ast, _hasMagic, void 0);
|
|
906
|
+
__privateSet(ast, _parts, [str.substring(pos - 1)]);
|
|
907
|
+
return i2;
|
|
908
|
+
};
|
|
909
|
+
partsToRegExp_fn = function(dot) {
|
|
910
|
+
return __privateGet(this, _parts).map((p) => {
|
|
911
|
+
if (typeof p === "string") {
|
|
912
|
+
throw new Error("string type in extglob ast??");
|
|
913
|
+
}
|
|
914
|
+
const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
|
|
915
|
+
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
916
|
+
return re;
|
|
917
|
+
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
918
|
+
};
|
|
919
|
+
parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
|
|
920
|
+
let escaping = false;
|
|
921
|
+
let re = "";
|
|
922
|
+
let uflag = false;
|
|
923
|
+
for (let i2 = 0; i2 < glob.length; i2++) {
|
|
924
|
+
const c = glob.charAt(i2);
|
|
925
|
+
if (escaping) {
|
|
926
|
+
escaping = false;
|
|
927
|
+
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
if (c === "\\") {
|
|
931
|
+
if (i2 === glob.length - 1) {
|
|
932
|
+
re += "\\\\";
|
|
933
|
+
} else {
|
|
934
|
+
escaping = true;
|
|
935
|
+
}
|
|
936
|
+
continue;
|
|
937
|
+
}
|
|
938
|
+
if (c === "[") {
|
|
939
|
+
const [src, needUflag, consumed, magic] = parseClass(glob, i2);
|
|
940
|
+
if (consumed) {
|
|
941
|
+
re += src;
|
|
942
|
+
uflag = uflag || needUflag;
|
|
943
|
+
i2 += consumed - 1;
|
|
944
|
+
hasMagic = hasMagic || magic;
|
|
945
|
+
continue;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
if (c === "*") {
|
|
949
|
+
if (noEmpty && glob === "*")
|
|
950
|
+
re += starNoEmpty;
|
|
951
|
+
else
|
|
952
|
+
re += star;
|
|
953
|
+
hasMagic = true;
|
|
954
|
+
continue;
|
|
955
|
+
}
|
|
956
|
+
if (c === "?") {
|
|
957
|
+
re += qmark;
|
|
958
|
+
hasMagic = true;
|
|
959
|
+
continue;
|
|
960
|
+
}
|
|
961
|
+
re += regExpEscape(c);
|
|
962
|
+
}
|
|
963
|
+
return [re, unescape(glob), !!hasMagic, uflag];
|
|
964
|
+
};
|
|
965
|
+
__privateAdd(_AST, _AST_static);
|
|
966
|
+
var AST = _AST;
|
|
967
|
+
|
|
968
|
+
// node_modules/minimatch/dist/esm/escape.js
|
|
969
|
+
var escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
970
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
971
|
+
};
|
|
972
|
+
|
|
973
|
+
// node_modules/minimatch/dist/esm/index.js
|
|
974
|
+
var minimatch = (p, pattern, options = {}) => {
|
|
975
|
+
assertValidPattern(pattern);
|
|
976
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
977
|
+
return false;
|
|
978
|
+
}
|
|
979
|
+
return new Minimatch(pattern, options).match(p);
|
|
980
|
+
};
|
|
981
|
+
var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
|
|
982
|
+
var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
|
|
983
|
+
var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
|
|
984
|
+
var starDotExtTestNocase = (ext2) => {
|
|
985
|
+
ext2 = ext2.toLowerCase();
|
|
986
|
+
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
|
|
987
|
+
};
|
|
988
|
+
var starDotExtTestNocaseDot = (ext2) => {
|
|
989
|
+
ext2 = ext2.toLowerCase();
|
|
990
|
+
return (f) => f.toLowerCase().endsWith(ext2);
|
|
991
|
+
};
|
|
992
|
+
var starDotStarRE = /^\*+\.\*+$/;
|
|
993
|
+
var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
994
|
+
var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
995
|
+
var dotStarRE = /^\.\*+$/;
|
|
996
|
+
var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
997
|
+
var starRE = /^\*+$/;
|
|
998
|
+
var starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
999
|
+
var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
1000
|
+
var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
1001
|
+
var qmarksTestNocase = ([$0, ext2 = ""]) => {
|
|
1002
|
+
const noext = qmarksTestNoExt([$0]);
|
|
1003
|
+
if (!ext2)
|
|
1004
|
+
return noext;
|
|
1005
|
+
ext2 = ext2.toLowerCase();
|
|
1006
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
1007
|
+
};
|
|
1008
|
+
var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
|
|
1009
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
1010
|
+
if (!ext2)
|
|
1011
|
+
return noext;
|
|
1012
|
+
ext2 = ext2.toLowerCase();
|
|
1013
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
1014
|
+
};
|
|
1015
|
+
var qmarksTestDot = ([$0, ext2 = ""]) => {
|
|
1016
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
1017
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
1018
|
+
};
|
|
1019
|
+
var qmarksTest = ([$0, ext2 = ""]) => {
|
|
1020
|
+
const noext = qmarksTestNoExt([$0]);
|
|
1021
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
1022
|
+
};
|
|
1023
|
+
var qmarksTestNoExt = ([$0]) => {
|
|
1024
|
+
const len = $0.length;
|
|
1025
|
+
return (f) => f.length === len && !f.startsWith(".");
|
|
1026
|
+
};
|
|
1027
|
+
var qmarksTestNoExtDot = ([$0]) => {
|
|
1028
|
+
const len = $0.length;
|
|
1029
|
+
return (f) => f.length === len && f !== "." && f !== "..";
|
|
1030
|
+
};
|
|
1031
|
+
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
1032
|
+
var path = {
|
|
1033
|
+
win32: { sep: "\\" },
|
|
1034
|
+
posix: { sep: "/" }
|
|
1035
|
+
};
|
|
1036
|
+
var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
|
|
1037
|
+
minimatch.sep = sep;
|
|
1038
|
+
var GLOBSTAR = Symbol("globstar **");
|
|
1039
|
+
minimatch.GLOBSTAR = GLOBSTAR;
|
|
1040
|
+
var qmark2 = "[^/]";
|
|
1041
|
+
var star2 = qmark2 + "*?";
|
|
1042
|
+
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
1043
|
+
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
1044
|
+
var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
|
|
1045
|
+
minimatch.filter = filter;
|
|
1046
|
+
var ext = (a, b = {}) => Object.assign({}, a, b);
|
|
1047
|
+
var defaults = (def) => {
|
|
1048
|
+
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
1049
|
+
return minimatch;
|
|
1050
|
+
}
|
|
1051
|
+
const orig = minimatch;
|
|
1052
|
+
const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
|
|
1053
|
+
return Object.assign(m, {
|
|
1054
|
+
Minimatch: class Minimatch extends orig.Minimatch {
|
|
1055
|
+
constructor(pattern, options = {}) {
|
|
1056
|
+
super(pattern, ext(def, options));
|
|
1057
|
+
}
|
|
1058
|
+
static defaults(options) {
|
|
1059
|
+
return orig.defaults(ext(def, options)).Minimatch;
|
|
1060
|
+
}
|
|
1061
|
+
},
|
|
1062
|
+
AST: class AST extends orig.AST {
|
|
1063
|
+
/* c8 ignore start */
|
|
1064
|
+
constructor(type, parent, options = {}) {
|
|
1065
|
+
super(type, parent, ext(def, options));
|
|
1066
|
+
}
|
|
1067
|
+
/* c8 ignore stop */
|
|
1068
|
+
static fromGlob(pattern, options = {}) {
|
|
1069
|
+
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
1070
|
+
}
|
|
1071
|
+
},
|
|
1072
|
+
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
1073
|
+
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
1074
|
+
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
1075
|
+
defaults: (options) => orig.defaults(ext(def, options)),
|
|
1076
|
+
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
1077
|
+
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
1078
|
+
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
|
|
1079
|
+
sep: orig.sep,
|
|
1080
|
+
GLOBSTAR
|
|
1081
|
+
});
|
|
1082
|
+
};
|
|
1083
|
+
minimatch.defaults = defaults;
|
|
1084
|
+
var braceExpand = (pattern, options = {}) => {
|
|
1085
|
+
assertValidPattern(pattern);
|
|
1086
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
1087
|
+
return [pattern];
|
|
1088
|
+
}
|
|
1089
|
+
return (0, import_brace_expansion.default)(pattern);
|
|
1090
|
+
};
|
|
1091
|
+
minimatch.braceExpand = braceExpand;
|
|
1092
|
+
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
1093
|
+
minimatch.makeRe = makeRe;
|
|
1094
|
+
var match = (list, pattern, options = {}) => {
|
|
1095
|
+
const mm = new Minimatch(pattern, options);
|
|
1096
|
+
list = list.filter((f) => mm.match(f));
|
|
1097
|
+
if (mm.options.nonull && !list.length) {
|
|
1098
|
+
list.push(pattern);
|
|
1099
|
+
}
|
|
1100
|
+
return list;
|
|
1101
|
+
};
|
|
1102
|
+
minimatch.match = match;
|
|
1103
|
+
var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
1104
|
+
var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1105
|
+
var Minimatch = class {
|
|
1106
|
+
options;
|
|
1107
|
+
set;
|
|
1108
|
+
pattern;
|
|
1109
|
+
windowsPathsNoEscape;
|
|
1110
|
+
nonegate;
|
|
1111
|
+
negate;
|
|
1112
|
+
comment;
|
|
1113
|
+
empty;
|
|
1114
|
+
preserveMultipleSlashes;
|
|
1115
|
+
partial;
|
|
1116
|
+
globSet;
|
|
1117
|
+
globParts;
|
|
1118
|
+
nocase;
|
|
1119
|
+
isWindows;
|
|
1120
|
+
platform;
|
|
1121
|
+
windowsNoMagicRoot;
|
|
1122
|
+
regexp;
|
|
1123
|
+
constructor(pattern, options = {}) {
|
|
1124
|
+
assertValidPattern(pattern);
|
|
1125
|
+
options = options || {};
|
|
1126
|
+
this.options = options;
|
|
1127
|
+
this.pattern = pattern;
|
|
1128
|
+
this.platform = options.platform || defaultPlatform;
|
|
1129
|
+
this.isWindows = this.platform === "win32";
|
|
1130
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
|
1131
|
+
if (this.windowsPathsNoEscape) {
|
|
1132
|
+
this.pattern = this.pattern.replace(/\\/g, "/");
|
|
1133
|
+
}
|
|
1134
|
+
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
1135
|
+
this.regexp = null;
|
|
1136
|
+
this.negate = false;
|
|
1137
|
+
this.nonegate = !!options.nonegate;
|
|
1138
|
+
this.comment = false;
|
|
1139
|
+
this.empty = false;
|
|
1140
|
+
this.partial = !!options.partial;
|
|
1141
|
+
this.nocase = !!this.options.nocase;
|
|
1142
|
+
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
1143
|
+
this.globSet = [];
|
|
1144
|
+
this.globParts = [];
|
|
1145
|
+
this.set = [];
|
|
1146
|
+
this.make();
|
|
1147
|
+
}
|
|
1148
|
+
hasMagic() {
|
|
1149
|
+
if (this.options.magicalBraces && this.set.length > 1) {
|
|
1150
|
+
return true;
|
|
1151
|
+
}
|
|
1152
|
+
for (const pattern of this.set) {
|
|
1153
|
+
for (const part of pattern) {
|
|
1154
|
+
if (typeof part !== "string")
|
|
1155
|
+
return true;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
return false;
|
|
1159
|
+
}
|
|
1160
|
+
debug(..._) {
|
|
1161
|
+
}
|
|
1162
|
+
make() {
|
|
1163
|
+
const pattern = this.pattern;
|
|
1164
|
+
const options = this.options;
|
|
1165
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
1166
|
+
this.comment = true;
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
1169
|
+
if (!pattern) {
|
|
1170
|
+
this.empty = true;
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
this.parseNegate();
|
|
1174
|
+
this.globSet = [...new Set(this.braceExpand())];
|
|
1175
|
+
if (options.debug) {
|
|
1176
|
+
this.debug = (...args) => console.error(...args);
|
|
1177
|
+
}
|
|
1178
|
+
this.debug(this.pattern, this.globSet);
|
|
1179
|
+
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
1180
|
+
this.globParts = this.preprocess(rawGlobParts);
|
|
1181
|
+
this.debug(this.pattern, this.globParts);
|
|
1182
|
+
let set = this.globParts.map((s, _, __) => {
|
|
1183
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
1184
|
+
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
1185
|
+
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
1186
|
+
if (isUNC) {
|
|
1187
|
+
return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
1188
|
+
} else if (isDrive) {
|
|
1189
|
+
return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
return s.map((ss) => this.parse(ss));
|
|
1193
|
+
});
|
|
1194
|
+
this.debug(this.pattern, set);
|
|
1195
|
+
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
1196
|
+
if (this.isWindows) {
|
|
1197
|
+
for (let i2 = 0; i2 < this.set.length; i2++) {
|
|
1198
|
+
const p = this.set[i2];
|
|
1199
|
+
if (p[0] === "" && p[1] === "" && this.globParts[i2][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
|
|
1200
|
+
p[2] = "?";
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
this.debug(this.pattern, this.set);
|
|
1205
|
+
}
|
|
1206
|
+
// various transforms to equivalent pattern sets that are
|
|
1207
|
+
// faster to process in a filesystem walk. The goal is to
|
|
1208
|
+
// eliminate what we can, and push all ** patterns as far
|
|
1209
|
+
// to the right as possible, even if it increases the number
|
|
1210
|
+
// of patterns that we have to process.
|
|
1211
|
+
preprocess(globParts) {
|
|
1212
|
+
if (this.options.noglobstar) {
|
|
1213
|
+
for (let i2 = 0; i2 < globParts.length; i2++) {
|
|
1214
|
+
for (let j = 0; j < globParts[i2].length; j++) {
|
|
1215
|
+
if (globParts[i2][j] === "**") {
|
|
1216
|
+
globParts[i2][j] = "*";
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
const { optimizationLevel = 1 } = this.options;
|
|
1222
|
+
if (optimizationLevel >= 2) {
|
|
1223
|
+
globParts = this.firstPhasePreProcess(globParts);
|
|
1224
|
+
globParts = this.secondPhasePreProcess(globParts);
|
|
1225
|
+
} else if (optimizationLevel >= 1) {
|
|
1226
|
+
globParts = this.levelOneOptimize(globParts);
|
|
1227
|
+
} else {
|
|
1228
|
+
globParts = this.adjascentGlobstarOptimize(globParts);
|
|
1229
|
+
}
|
|
1230
|
+
return globParts;
|
|
1231
|
+
}
|
|
1232
|
+
// just get rid of adjascent ** portions
|
|
1233
|
+
adjascentGlobstarOptimize(globParts) {
|
|
1234
|
+
return globParts.map((parts) => {
|
|
1235
|
+
let gs = -1;
|
|
1236
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1237
|
+
let i2 = gs;
|
|
1238
|
+
while (parts[i2 + 1] === "**") {
|
|
1239
|
+
i2++;
|
|
1240
|
+
}
|
|
1241
|
+
if (i2 !== gs) {
|
|
1242
|
+
parts.splice(gs, i2 - gs);
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
return parts;
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
// get rid of adjascent ** and resolve .. portions
|
|
1249
|
+
levelOneOptimize(globParts) {
|
|
1250
|
+
return globParts.map((parts) => {
|
|
1251
|
+
parts = parts.reduce((set, part) => {
|
|
1252
|
+
const prev = set[set.length - 1];
|
|
1253
|
+
if (part === "**" && prev === "**") {
|
|
1254
|
+
return set;
|
|
1255
|
+
}
|
|
1256
|
+
if (part === "..") {
|
|
1257
|
+
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
1258
|
+
set.pop();
|
|
1259
|
+
return set;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
set.push(part);
|
|
1263
|
+
return set;
|
|
1264
|
+
}, []);
|
|
1265
|
+
return parts.length === 0 ? [""] : parts;
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
levelTwoFileOptimize(parts) {
|
|
1269
|
+
if (!Array.isArray(parts)) {
|
|
1270
|
+
parts = this.slashSplit(parts);
|
|
1271
|
+
}
|
|
1272
|
+
let didSomething = false;
|
|
1273
|
+
do {
|
|
1274
|
+
didSomething = false;
|
|
1275
|
+
if (!this.preserveMultipleSlashes) {
|
|
1276
|
+
for (let i2 = 1; i2 < parts.length - 1; i2++) {
|
|
1277
|
+
const p = parts[i2];
|
|
1278
|
+
if (i2 === 1 && p === "" && parts[0] === "")
|
|
1279
|
+
continue;
|
|
1280
|
+
if (p === "." || p === "") {
|
|
1281
|
+
didSomething = true;
|
|
1282
|
+
parts.splice(i2, 1);
|
|
1283
|
+
i2--;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1287
|
+
didSomething = true;
|
|
1288
|
+
parts.pop();
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
let dd = 0;
|
|
1292
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1293
|
+
const p = parts[dd - 1];
|
|
1294
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1295
|
+
didSomething = true;
|
|
1296
|
+
parts.splice(dd - 1, 2);
|
|
1297
|
+
dd -= 2;
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
} while (didSomething);
|
|
1301
|
+
return parts.length === 0 ? [""] : parts;
|
|
1302
|
+
}
|
|
1303
|
+
// First phase: single-pattern processing
|
|
1304
|
+
// <pre> is 1 or more portions
|
|
1305
|
+
// <rest> is 1 or more portions
|
|
1306
|
+
// <p> is any portion other than ., .., '', or **
|
|
1307
|
+
// <e> is . or ''
|
|
1308
|
+
//
|
|
1309
|
+
// **/.. is *brutal* for filesystem walking performance, because
|
|
1310
|
+
// it effectively resets the recursive walk each time it occurs,
|
|
1311
|
+
// and ** cannot be reduced out by a .. pattern part like a regexp
|
|
1312
|
+
// or most strings (other than .., ., and '') can be.
|
|
1313
|
+
//
|
|
1314
|
+
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
|
|
1315
|
+
// <pre>/<e>/<rest> -> <pre>/<rest>
|
|
1316
|
+
// <pre>/<p>/../<rest> -> <pre>/<rest>
|
|
1317
|
+
// **/**/<rest> -> **/<rest>
|
|
1318
|
+
//
|
|
1319
|
+
// **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
|
|
1320
|
+
// this WOULD be allowed if ** did follow symlinks, or * didn't
|
|
1321
|
+
firstPhasePreProcess(globParts) {
|
|
1322
|
+
let didSomething = false;
|
|
1323
|
+
do {
|
|
1324
|
+
didSomething = false;
|
|
1325
|
+
for (let parts of globParts) {
|
|
1326
|
+
let gs = -1;
|
|
1327
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1328
|
+
let gss = gs;
|
|
1329
|
+
while (parts[gss + 1] === "**") {
|
|
1330
|
+
gss++;
|
|
1331
|
+
}
|
|
1332
|
+
if (gss > gs) {
|
|
1333
|
+
parts.splice(gs + 1, gss - gs);
|
|
1334
|
+
}
|
|
1335
|
+
let next = parts[gs + 1];
|
|
1336
|
+
const p = parts[gs + 2];
|
|
1337
|
+
const p2 = parts[gs + 3];
|
|
1338
|
+
if (next !== "..")
|
|
1339
|
+
continue;
|
|
1340
|
+
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
|
|
1341
|
+
continue;
|
|
1342
|
+
}
|
|
1343
|
+
didSomething = true;
|
|
1344
|
+
parts.splice(gs, 1);
|
|
1345
|
+
const other = parts.slice(0);
|
|
1346
|
+
other[gs] = "**";
|
|
1347
|
+
globParts.push(other);
|
|
1348
|
+
gs--;
|
|
1349
|
+
}
|
|
1350
|
+
if (!this.preserveMultipleSlashes) {
|
|
1351
|
+
for (let i2 = 1; i2 < parts.length - 1; i2++) {
|
|
1352
|
+
const p = parts[i2];
|
|
1353
|
+
if (i2 === 1 && p === "" && parts[0] === "")
|
|
1354
|
+
continue;
|
|
1355
|
+
if (p === "." || p === "") {
|
|
1356
|
+
didSomething = true;
|
|
1357
|
+
parts.splice(i2, 1);
|
|
1358
|
+
i2--;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1362
|
+
didSomething = true;
|
|
1363
|
+
parts.pop();
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
let dd = 0;
|
|
1367
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1368
|
+
const p = parts[dd - 1];
|
|
1369
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1370
|
+
didSomething = true;
|
|
1371
|
+
const needDot = dd === 1 && parts[dd + 1] === "**";
|
|
1372
|
+
const splin = needDot ? ["."] : [];
|
|
1373
|
+
parts.splice(dd - 1, 2, ...splin);
|
|
1374
|
+
if (parts.length === 0)
|
|
1375
|
+
parts.push("");
|
|
1376
|
+
dd -= 2;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
} while (didSomething);
|
|
1381
|
+
return globParts;
|
|
1382
|
+
}
|
|
1383
|
+
// second phase: multi-pattern dedupes
|
|
1384
|
+
// {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
|
|
1385
|
+
// {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
|
|
1386
|
+
// {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
|
|
1387
|
+
//
|
|
1388
|
+
// {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
|
|
1389
|
+
// ^-- not valid because ** doens't follow symlinks
|
|
1390
|
+
secondPhasePreProcess(globParts) {
|
|
1391
|
+
for (let i2 = 0; i2 < globParts.length - 1; i2++) {
|
|
1392
|
+
for (let j = i2 + 1; j < globParts.length; j++) {
|
|
1393
|
+
const matched = this.partsMatch(globParts[i2], globParts[j], !this.preserveMultipleSlashes);
|
|
1394
|
+
if (!matched)
|
|
1395
|
+
continue;
|
|
1396
|
+
globParts[i2] = matched;
|
|
1397
|
+
globParts[j] = [];
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
return globParts.filter((gs) => gs.length);
|
|
1401
|
+
}
|
|
1402
|
+
partsMatch(a, b, emptyGSMatch = false) {
|
|
1403
|
+
let ai = 0;
|
|
1404
|
+
let bi = 0;
|
|
1405
|
+
let result = [];
|
|
1406
|
+
let which = "";
|
|
1407
|
+
while (ai < a.length && bi < b.length) {
|
|
1408
|
+
if (a[ai] === b[bi]) {
|
|
1409
|
+
result.push(which === "b" ? b[bi] : a[ai]);
|
|
1410
|
+
ai++;
|
|
1411
|
+
bi++;
|
|
1412
|
+
} else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
|
|
1413
|
+
result.push(a[ai]);
|
|
1414
|
+
ai++;
|
|
1415
|
+
} else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
|
|
1416
|
+
result.push(b[bi]);
|
|
1417
|
+
bi++;
|
|
1418
|
+
} else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
|
|
1419
|
+
if (which === "b")
|
|
1420
|
+
return false;
|
|
1421
|
+
which = "a";
|
|
1422
|
+
result.push(a[ai]);
|
|
1423
|
+
ai++;
|
|
1424
|
+
bi++;
|
|
1425
|
+
} else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
|
|
1426
|
+
if (which === "a")
|
|
1427
|
+
return false;
|
|
1428
|
+
which = "b";
|
|
1429
|
+
result.push(b[bi]);
|
|
1430
|
+
ai++;
|
|
1431
|
+
bi++;
|
|
1432
|
+
} else {
|
|
1433
|
+
return false;
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
return a.length === b.length && result;
|
|
1437
|
+
}
|
|
1438
|
+
parseNegate() {
|
|
1439
|
+
if (this.nonegate)
|
|
1440
|
+
return;
|
|
1441
|
+
const pattern = this.pattern;
|
|
1442
|
+
let negate = false;
|
|
1443
|
+
let negateOffset = 0;
|
|
1444
|
+
for (let i2 = 0; i2 < pattern.length && pattern.charAt(i2) === "!"; i2++) {
|
|
1445
|
+
negate = !negate;
|
|
1446
|
+
negateOffset++;
|
|
1447
|
+
}
|
|
1448
|
+
if (negateOffset)
|
|
1449
|
+
this.pattern = pattern.slice(negateOffset);
|
|
1450
|
+
this.negate = negate;
|
|
1451
|
+
}
|
|
1452
|
+
// set partial to true to test if, for example,
|
|
1453
|
+
// "/a/b" matches the start of "/*/b/*/d"
|
|
1454
|
+
// Partial means, if you run out of file before you run
|
|
1455
|
+
// out of pattern, then that's fine, as long as all
|
|
1456
|
+
// the parts match.
|
|
1457
|
+
matchOne(file, pattern, partial = false) {
|
|
1458
|
+
const options = this.options;
|
|
1459
|
+
if (this.isWindows) {
|
|
1460
|
+
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
1461
|
+
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
1462
|
+
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
1463
|
+
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
1464
|
+
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
1465
|
+
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
1466
|
+
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
1467
|
+
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
1468
|
+
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
1469
|
+
pattern[pdi] = fd;
|
|
1470
|
+
if (pdi > fdi) {
|
|
1471
|
+
pattern = pattern.slice(pdi);
|
|
1472
|
+
} else if (fdi > pdi) {
|
|
1473
|
+
file = file.slice(fdi);
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
const { optimizationLevel = 1 } = this.options;
|
|
1479
|
+
if (optimizationLevel >= 2) {
|
|
1480
|
+
file = this.levelTwoFileOptimize(file);
|
|
1481
|
+
}
|
|
1482
|
+
this.debug("matchOne", this, { file, pattern });
|
|
1483
|
+
this.debug("matchOne", file.length, pattern.length);
|
|
1484
|
+
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
1485
|
+
this.debug("matchOne loop");
|
|
1486
|
+
var p = pattern[pi];
|
|
1487
|
+
var f = file[fi];
|
|
1488
|
+
this.debug(pattern, p, f);
|
|
1489
|
+
if (p === false) {
|
|
1490
|
+
return false;
|
|
1491
|
+
}
|
|
1492
|
+
if (p === GLOBSTAR) {
|
|
1493
|
+
this.debug("GLOBSTAR", [pattern, p, f]);
|
|
1494
|
+
var fr = fi;
|
|
1495
|
+
var pr = pi + 1;
|
|
1496
|
+
if (pr === pl) {
|
|
1497
|
+
this.debug("** at the end");
|
|
1498
|
+
for (; fi < fl; fi++) {
|
|
1499
|
+
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
|
1500
|
+
return false;
|
|
1501
|
+
}
|
|
1502
|
+
return true;
|
|
1503
|
+
}
|
|
1504
|
+
while (fr < fl) {
|
|
1505
|
+
var swallowee = file[fr];
|
|
1506
|
+
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
1507
|
+
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
1508
|
+
this.debug("globstar found match!", fr, fl, swallowee);
|
|
1509
|
+
return true;
|
|
1510
|
+
} else {
|
|
1511
|
+
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
1512
|
+
this.debug("dot detected!", file, fr, pattern, pr);
|
|
1513
|
+
break;
|
|
1514
|
+
}
|
|
1515
|
+
this.debug("globstar swallow a segment, and continue");
|
|
1516
|
+
fr++;
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
if (partial) {
|
|
1520
|
+
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
1521
|
+
if (fr === fl) {
|
|
1522
|
+
return true;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
return false;
|
|
1526
|
+
}
|
|
1527
|
+
let hit;
|
|
1528
|
+
if (typeof p === "string") {
|
|
1529
|
+
hit = f === p;
|
|
1530
|
+
this.debug("string match", p, f, hit);
|
|
1531
|
+
} else {
|
|
1532
|
+
hit = p.test(f);
|
|
1533
|
+
this.debug("pattern match", p, f, hit);
|
|
1534
|
+
}
|
|
1535
|
+
if (!hit)
|
|
1536
|
+
return false;
|
|
1537
|
+
}
|
|
1538
|
+
if (fi === fl && pi === pl) {
|
|
1539
|
+
return true;
|
|
1540
|
+
} else if (fi === fl) {
|
|
1541
|
+
return partial;
|
|
1542
|
+
} else if (pi === pl) {
|
|
1543
|
+
return fi === fl - 1 && file[fi] === "";
|
|
1544
|
+
} else {
|
|
1545
|
+
throw new Error("wtf?");
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
braceExpand() {
|
|
1549
|
+
return braceExpand(this.pattern, this.options);
|
|
1550
|
+
}
|
|
1551
|
+
parse(pattern) {
|
|
1552
|
+
assertValidPattern(pattern);
|
|
1553
|
+
const options = this.options;
|
|
1554
|
+
if (pattern === "**")
|
|
1555
|
+
return GLOBSTAR;
|
|
1556
|
+
if (pattern === "")
|
|
1557
|
+
return "";
|
|
1558
|
+
let m;
|
|
1559
|
+
let fastTest = null;
|
|
1560
|
+
if (m = pattern.match(starRE)) {
|
|
1561
|
+
fastTest = options.dot ? starTestDot : starTest;
|
|
1562
|
+
} else if (m = pattern.match(starDotExtRE)) {
|
|
1563
|
+
fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
1564
|
+
} else if (m = pattern.match(qmarksRE)) {
|
|
1565
|
+
fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
1566
|
+
} else if (m = pattern.match(starDotStarRE)) {
|
|
1567
|
+
fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
1568
|
+
} else if (m = pattern.match(dotStarRE)) {
|
|
1569
|
+
fastTest = dotStarTest;
|
|
1570
|
+
}
|
|
1571
|
+
const re = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
1572
|
+
if (fastTest && typeof re === "object") {
|
|
1573
|
+
Reflect.defineProperty(re, "test", { value: fastTest });
|
|
1574
|
+
}
|
|
1575
|
+
return re;
|
|
1576
|
+
}
|
|
1577
|
+
makeRe() {
|
|
1578
|
+
if (this.regexp || this.regexp === false)
|
|
1579
|
+
return this.regexp;
|
|
1580
|
+
const set = this.set;
|
|
1581
|
+
if (!set.length) {
|
|
1582
|
+
this.regexp = false;
|
|
1583
|
+
return this.regexp;
|
|
1584
|
+
}
|
|
1585
|
+
const options = this.options;
|
|
1586
|
+
const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
|
|
1587
|
+
const flags = new Set(options.nocase ? ["i"] : []);
|
|
1588
|
+
let re = set.map((pattern) => {
|
|
1589
|
+
const pp = pattern.map((p) => {
|
|
1590
|
+
if (p instanceof RegExp) {
|
|
1591
|
+
for (const f of p.flags.split(""))
|
|
1592
|
+
flags.add(f);
|
|
1593
|
+
}
|
|
1594
|
+
return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
|
|
1595
|
+
});
|
|
1596
|
+
pp.forEach((p, i2) => {
|
|
1597
|
+
const next = pp[i2 + 1];
|
|
1598
|
+
const prev = pp[i2 - 1];
|
|
1599
|
+
if (p !== GLOBSTAR || prev === GLOBSTAR) {
|
|
1600
|
+
return;
|
|
1601
|
+
}
|
|
1602
|
+
if (prev === void 0) {
|
|
1603
|
+
if (next !== void 0 && next !== GLOBSTAR) {
|
|
1604
|
+
pp[i2 + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
1605
|
+
} else {
|
|
1606
|
+
pp[i2] = twoStar;
|
|
1607
|
+
}
|
|
1608
|
+
} else if (next === void 0) {
|
|
1609
|
+
pp[i2 - 1] = prev + "(?:\\/|" + twoStar + ")?";
|
|
1610
|
+
} else if (next !== GLOBSTAR) {
|
|
1611
|
+
pp[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
1612
|
+
pp[i2 + 1] = GLOBSTAR;
|
|
1613
|
+
}
|
|
1614
|
+
});
|
|
1615
|
+
return pp.filter((p) => p !== GLOBSTAR).join("/");
|
|
1616
|
+
}).join("|");
|
|
1617
|
+
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
1618
|
+
re = "^" + open + re + close + "$";
|
|
1619
|
+
if (this.negate)
|
|
1620
|
+
re = "^(?!" + re + ").+$";
|
|
1621
|
+
try {
|
|
1622
|
+
this.regexp = new RegExp(re, [...flags].join(""));
|
|
1623
|
+
} catch (ex) {
|
|
1624
|
+
this.regexp = false;
|
|
1625
|
+
}
|
|
1626
|
+
return this.regexp;
|
|
1627
|
+
}
|
|
1628
|
+
slashSplit(p) {
|
|
1629
|
+
if (this.preserveMultipleSlashes) {
|
|
1630
|
+
return p.split("/");
|
|
1631
|
+
} else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
|
|
1632
|
+
return ["", ...p.split(/\/+/)];
|
|
1633
|
+
} else {
|
|
1634
|
+
return p.split(/\/+/);
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
match(f, partial = this.partial) {
|
|
1638
|
+
this.debug("match", f, this.pattern);
|
|
1639
|
+
if (this.comment) {
|
|
1640
|
+
return false;
|
|
1641
|
+
}
|
|
1642
|
+
if (this.empty) {
|
|
1643
|
+
return f === "";
|
|
1644
|
+
}
|
|
1645
|
+
if (f === "/" && partial) {
|
|
1646
|
+
return true;
|
|
1647
|
+
}
|
|
1648
|
+
const options = this.options;
|
|
1649
|
+
if (this.isWindows) {
|
|
1650
|
+
f = f.split("\\").join("/");
|
|
1651
|
+
}
|
|
1652
|
+
const ff = this.slashSplit(f);
|
|
1653
|
+
this.debug(this.pattern, "split", ff);
|
|
1654
|
+
const set = this.set;
|
|
1655
|
+
this.debug(this.pattern, "set", set);
|
|
1656
|
+
let filename = ff[ff.length - 1];
|
|
1657
|
+
if (!filename) {
|
|
1658
|
+
for (let i2 = ff.length - 2; !filename && i2 >= 0; i2--) {
|
|
1659
|
+
filename = ff[i2];
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
for (let i2 = 0; i2 < set.length; i2++) {
|
|
1663
|
+
const pattern = set[i2];
|
|
1664
|
+
let file = ff;
|
|
1665
|
+
if (options.matchBase && pattern.length === 1) {
|
|
1666
|
+
file = [filename];
|
|
1667
|
+
}
|
|
1668
|
+
const hit = this.matchOne(file, pattern, partial);
|
|
1669
|
+
if (hit) {
|
|
1670
|
+
if (options.flipNegate) {
|
|
1671
|
+
return true;
|
|
1672
|
+
}
|
|
1673
|
+
return !this.negate;
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
if (options.flipNegate) {
|
|
1677
|
+
return false;
|
|
1678
|
+
}
|
|
1679
|
+
return this.negate;
|
|
1680
|
+
}
|
|
1681
|
+
static defaults(def) {
|
|
1682
|
+
return minimatch.defaults(def).Minimatch;
|
|
1683
|
+
}
|
|
1684
|
+
};
|
|
1685
|
+
minimatch.AST = AST;
|
|
1686
|
+
minimatch.Minimatch = Minimatch;
|
|
1687
|
+
minimatch.escape = escape;
|
|
1688
|
+
minimatch.unescape = unescape;
|
|
1689
|
+
|
|
95
1690
|
// src/utils/query-nonce-meta-tag-content.ts
|
|
96
1691
|
function queryNonceMetaTagContent(doc) {
|
|
97
1692
|
var _a, _b, _c;
|
|
@@ -259,6 +1854,31 @@ function deserializeProperty(value) {
|
|
|
259
1854
|
import { BUILD as BUILD2 } from "@stencil/core/internal/app-data";
|
|
260
1855
|
import { globalStyles } from "@stencil/core/internal/app-globals";
|
|
261
1856
|
|
|
1857
|
+
// src/runtime/runtime-constants.ts
|
|
1858
|
+
var CONTENT_REF_ID = "r";
|
|
1859
|
+
var ORG_LOCATION_ID = "o";
|
|
1860
|
+
var SLOT_NODE_ID = "s";
|
|
1861
|
+
var TEXT_NODE_ID = "t";
|
|
1862
|
+
var COMMENT_NODE_ID = "c";
|
|
1863
|
+
var HYDRATE_ID = "s-id";
|
|
1864
|
+
var HYDRATED_STYLE_ID = "sty-id";
|
|
1865
|
+
var HYDRATE_CHILD_ID = "c-id";
|
|
1866
|
+
var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
1867
|
+
var STENCIL_DOC_DATA = "_stencilDocData";
|
|
1868
|
+
var DEFAULT_DOC_DATA = {
|
|
1869
|
+
hostIds: 0,
|
|
1870
|
+
rootLevelIds: 0,
|
|
1871
|
+
staticComponents: /* @__PURE__ */ new Set()
|
|
1872
|
+
};
|
|
1873
|
+
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
1874
|
+
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
1875
|
+
var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
|
1876
|
+
"formAssociatedCallback",
|
|
1877
|
+
"formResetCallback",
|
|
1878
|
+
"formDisabledCallback",
|
|
1879
|
+
"formStateRestoreCallback"
|
|
1880
|
+
];
|
|
1881
|
+
|
|
262
1882
|
// src/utils/style.ts
|
|
263
1883
|
function createStyleSheetIfNeededAndSupported(styles2) {
|
|
264
1884
|
if (!styles2 || !supportsConstructableStylesheets) return void 0;
|
|
@@ -269,12 +1889,20 @@ function createStyleSheetIfNeededAndSupported(styles2) {
|
|
|
269
1889
|
|
|
270
1890
|
// src/utils/shadow-root.ts
|
|
271
1891
|
var globalStyleSheet;
|
|
1892
|
+
var GLOBAL_STYLE_ID = "sc-global";
|
|
272
1893
|
function createShadowRoot(cmpMeta) {
|
|
273
1894
|
var _a;
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
delegatesFocus
|
|
277
|
-
}
|
|
1895
|
+
const opts = { mode: "open" };
|
|
1896
|
+
if (BUILD2.shadowDelegatesFocus) {
|
|
1897
|
+
opts.delegatesFocus = !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */);
|
|
1898
|
+
}
|
|
1899
|
+
if (BUILD2.shadowSlotAssignmentManual) {
|
|
1900
|
+
const isManual = !!(cmpMeta.$flags$ & 1024 /* shadowSlotAssignmentManual */);
|
|
1901
|
+
if (isManual) {
|
|
1902
|
+
opts.slotAssignment = "manual";
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
const shadowRoot = this.attachShadow(opts);
|
|
278
1906
|
if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported(globalStyles)) != null ? _a : null;
|
|
279
1907
|
if (globalStyleSheet) {
|
|
280
1908
|
if (supportsMutableAdoptedStyleSheets) {
|
|
@@ -282,6 +1910,13 @@ function createShadowRoot(cmpMeta) {
|
|
|
282
1910
|
} else {
|
|
283
1911
|
shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
|
|
284
1912
|
}
|
|
1913
|
+
} else if (globalStyles && !supportsConstructableStylesheets) {
|
|
1914
|
+
const styleElm = document.createElement("style");
|
|
1915
|
+
styleElm.innerHTML = globalStyles;
|
|
1916
|
+
if (BUILD2.hotModuleReplacement) {
|
|
1917
|
+
styleElm.setAttribute(HYDRATED_STYLE_ID, GLOBAL_STYLE_ID);
|
|
1918
|
+
}
|
|
1919
|
+
shadowRoot.prepend(styleElm);
|
|
285
1920
|
}
|
|
286
1921
|
}
|
|
287
1922
|
|
|
@@ -310,33 +1945,6 @@ import { BUILD as BUILD4 } from "@stencil/core/internal/app-data";
|
|
|
310
1945
|
|
|
311
1946
|
// src/runtime/slot-polyfill-utils.ts
|
|
312
1947
|
import { BUILD as BUILD3 } from "@stencil/core/internal/app-data";
|
|
313
|
-
|
|
314
|
-
// src/runtime/runtime-constants.ts
|
|
315
|
-
var CONTENT_REF_ID = "r";
|
|
316
|
-
var ORG_LOCATION_ID = "o";
|
|
317
|
-
var SLOT_NODE_ID = "s";
|
|
318
|
-
var TEXT_NODE_ID = "t";
|
|
319
|
-
var COMMENT_NODE_ID = "c";
|
|
320
|
-
var HYDRATE_ID = "s-id";
|
|
321
|
-
var HYDRATED_STYLE_ID = "sty-id";
|
|
322
|
-
var HYDRATE_CHILD_ID = "c-id";
|
|
323
|
-
var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
|
|
324
|
-
var STENCIL_DOC_DATA = "_stencilDocData";
|
|
325
|
-
var DEFAULT_DOC_DATA = {
|
|
326
|
-
hostIds: 0,
|
|
327
|
-
rootLevelIds: 0,
|
|
328
|
-
staticComponents: /* @__PURE__ */ new Set()
|
|
329
|
-
};
|
|
330
|
-
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
331
|
-
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
332
|
-
var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
|
|
333
|
-
"formAssociatedCallback",
|
|
334
|
-
"formResetCallback",
|
|
335
|
-
"formDisabledCallback",
|
|
336
|
-
"formStateRestoreCallback"
|
|
337
|
-
];
|
|
338
|
-
|
|
339
|
-
// src/runtime/slot-polyfill-utils.ts
|
|
340
1948
|
var updateFallbackSlotVisibility = (elm) => {
|
|
341
1949
|
const childNodes = internalCall(elm, "childNodes");
|
|
342
1950
|
if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
|
|
@@ -960,7 +2568,7 @@ var registerStyle = (scopeId2, cssText, allowCS) => {
|
|
|
960
2568
|
styles.set(scopeId2, style);
|
|
961
2569
|
};
|
|
962
2570
|
var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
963
|
-
var _a;
|
|
2571
|
+
var _a, _b, _c;
|
|
964
2572
|
const scopeId2 = getScopeId(cmpMeta, mode);
|
|
965
2573
|
const style = styles.get(scopeId2);
|
|
966
2574
|
if (!BUILD6.attachStyles || !win.document) {
|
|
@@ -975,51 +2583,51 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
975
2583
|
if (!appliedStyles) {
|
|
976
2584
|
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
|
977
2585
|
}
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
|
1007
|
-
}
|
|
2586
|
+
const existingStyleElm = (BUILD6.hydrateClientSide || BUILD6.hotModuleReplacement) && styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
|
|
2587
|
+
if (existingStyleElm) {
|
|
2588
|
+
existingStyleElm.innerHTML = style;
|
|
2589
|
+
} else if (!appliedStyles.has(scopeId2)) {
|
|
2590
|
+
styleElm = win.document.createElement("style");
|
|
2591
|
+
styleElm.innerHTML = style;
|
|
2592
|
+
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
|
|
2593
|
+
if (nonce != null) {
|
|
2594
|
+
styleElm.setAttribute("nonce", nonce);
|
|
2595
|
+
}
|
|
2596
|
+
if ((BUILD6.hydrateServerSide || BUILD6.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */ || cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
2597
|
+
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
|
|
2598
|
+
}
|
|
2599
|
+
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
|
|
2600
|
+
if (styleContainerNode.nodeName === "HEAD") {
|
|
2601
|
+
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
|
2602
|
+
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
|
2603
|
+
styleContainerNode.insertBefore(
|
|
2604
|
+
styleElm,
|
|
2605
|
+
(referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
|
|
2606
|
+
);
|
|
2607
|
+
} else if ("host" in styleContainerNode) {
|
|
2608
|
+
if (supportsConstructableStylesheets) {
|
|
2609
|
+
const currentWindow = (_b = styleContainerNode.defaultView) != null ? _b : styleContainerNode.ownerDocument.defaultView;
|
|
2610
|
+
const stylesheet = new currentWindow.CSSStyleSheet();
|
|
2611
|
+
stylesheet.replaceSync(style);
|
|
2612
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
2613
|
+
styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
|
|
1008
2614
|
} else {
|
|
1009
|
-
|
|
1010
|
-
if (existingStyleContainer) {
|
|
1011
|
-
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
|
1012
|
-
} else {
|
|
1013
|
-
styleContainerNode.prepend(styleElm);
|
|
1014
|
-
}
|
|
2615
|
+
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
|
|
1015
2616
|
}
|
|
1016
2617
|
} else {
|
|
1017
|
-
styleContainerNode.
|
|
2618
|
+
const existingStyleContainer = styleContainerNode.querySelector("style");
|
|
2619
|
+
if (existingStyleContainer) {
|
|
2620
|
+
existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
|
|
2621
|
+
} else {
|
|
2622
|
+
styleContainerNode.prepend(styleElm);
|
|
2623
|
+
}
|
|
1018
2624
|
}
|
|
2625
|
+
} else {
|
|
2626
|
+
styleContainerNode.append(styleElm);
|
|
1019
2627
|
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
2628
|
+
}
|
|
2629
|
+
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
2630
|
+
styleContainerNode.insertBefore(styleElm, null);
|
|
1023
2631
|
}
|
|
1024
2632
|
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
|
|
1025
2633
|
styleElm.innerHTML += SLOT_FB_CSS;
|
|
@@ -1028,11 +2636,28 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
1028
2636
|
appliedStyles.add(scopeId2);
|
|
1029
2637
|
}
|
|
1030
2638
|
}
|
|
1031
|
-
} else if (BUILD6.constructableCSS
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
2639
|
+
} else if (BUILD6.constructableCSS) {
|
|
2640
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
2641
|
+
if (!appliedStyles) {
|
|
2642
|
+
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
|
|
2643
|
+
}
|
|
2644
|
+
if (!appliedStyles.has(scopeId2)) {
|
|
2645
|
+
const currentWindow = (_c = styleContainerNode.defaultView) != null ? _c : styleContainerNode.ownerDocument.defaultView;
|
|
2646
|
+
let stylesheet;
|
|
2647
|
+
if (style.constructor === currentWindow.CSSStyleSheet) {
|
|
2648
|
+
stylesheet = style;
|
|
2649
|
+
} else {
|
|
2650
|
+
stylesheet = new currentWindow.CSSStyleSheet();
|
|
2651
|
+
for (let i2 = 0; i2 < style.cssRules.length; i2++) {
|
|
2652
|
+
stylesheet.insertRule(style.cssRules[i2].cssText, i2);
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
if (supportsMutableAdoptedStyleSheets) {
|
|
2656
|
+
styleContainerNode.adoptedStyleSheets.push(stylesheet);
|
|
2657
|
+
} else {
|
|
2658
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
|
|
2659
|
+
}
|
|
2660
|
+
appliedStyles.add(scopeId2);
|
|
1036
2661
|
}
|
|
1037
2662
|
}
|
|
1038
2663
|
}
|
|
@@ -1212,7 +2837,7 @@ var validateInputProperties = (inputElm) => {
|
|
|
1212
2837
|
|
|
1213
2838
|
// src/runtime/client-hydrate.ts
|
|
1214
2839
|
var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
1215
|
-
var _a, _b;
|
|
2840
|
+
var _a, _b, _c, _d;
|
|
1216
2841
|
const endHydrate = createTime("hydrateClient", tagName);
|
|
1217
2842
|
const shadowRoot = hostElm.shadowRoot;
|
|
1218
2843
|
const childRenderNodes = [];
|
|
@@ -1305,6 +2930,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1305
2930
|
let snGroupIdx;
|
|
1306
2931
|
let snGroupLen;
|
|
1307
2932
|
let slottedItem;
|
|
2933
|
+
let currentPos = 0;
|
|
1308
2934
|
for (snIndex; snIndex < snLen; snIndex++) {
|
|
1309
2935
|
slotGroup = slottedNodes[snIndex];
|
|
1310
2936
|
if (!slotGroup || !slotGroup.length) continue;
|
|
@@ -1318,7 +2944,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1318
2944
|
if (!hosts[slottedItem.hostId]) continue;
|
|
1319
2945
|
const hostEle = hosts[slottedItem.hostId];
|
|
1320
2946
|
if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
|
|
1321
|
-
hostEle.
|
|
2947
|
+
hostEle.insertBefore(slottedItem.node, (_c = (_b = slotGroup[snGroupIdx - 1]) == null ? void 0 : _b.node) == null ? void 0 : _c.nextSibling);
|
|
1322
2948
|
}
|
|
1323
2949
|
if (!hostEle.shadowRoot || !shadowRoot) {
|
|
1324
2950
|
if (!slottedItem.slot["s-cr"]) {
|
|
@@ -1329,14 +2955,15 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1329
2955
|
slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
|
|
1330
2956
|
}
|
|
1331
2957
|
}
|
|
1332
|
-
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
|
|
1333
|
-
if (((
|
|
2958
|
+
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
|
|
2959
|
+
if (((_d = slottedItem.node.parentElement) == null ? void 0 : _d.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
|
|
1334
2960
|
slottedItem.node.removeAttribute("slot");
|
|
1335
2961
|
}
|
|
1336
2962
|
if (BUILD8.experimentalSlotFixes) {
|
|
1337
2963
|
patchSlottedNode(slottedItem.node);
|
|
1338
2964
|
}
|
|
1339
2965
|
}
|
|
2966
|
+
currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
|
|
1340
2967
|
}
|
|
1341
2968
|
}
|
|
1342
2969
|
if (BUILD8.scoped && scopeId2 && slotNodes.length) {
|
|
@@ -1358,7 +2985,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
|
1358
2985
|
if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
|
|
1359
2986
|
if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
|
|
1360
2987
|
node.removeAttribute("hidden");
|
|
1361
|
-
} else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue
|
|
2988
|
+
} else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue) {
|
|
1362
2989
|
node.parentNode.removeChild(node);
|
|
1363
2990
|
}
|
|
1364
2991
|
}
|
|
@@ -1525,10 +3152,6 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
|
|
|
1525
3152
|
vnode.$elm$ = node;
|
|
1526
3153
|
vnode.$index$ = "0";
|
|
1527
3154
|
parentVNode.$children$ = [vnode];
|
|
1528
|
-
} else {
|
|
1529
|
-
if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim() && !node["s-nr"]) {
|
|
1530
|
-
node.remove();
|
|
1531
|
-
}
|
|
1532
3155
|
}
|
|
1533
3156
|
return parentVNode;
|
|
1534
3157
|
};
|
|
@@ -1902,16 +3525,16 @@ var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
|
|
|
1902
3525
|
let scopedSelector = "";
|
|
1903
3526
|
let startIndex = 0;
|
|
1904
3527
|
let res;
|
|
1905
|
-
const
|
|
3528
|
+
const sep2 = /( |>|\+|~(?!=))(?=(?:[^()]*\([^()]*\))*[^()]*$)\s*/g;
|
|
1906
3529
|
const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
|
|
1907
3530
|
let shouldScope = !hasHost;
|
|
1908
|
-
while ((res =
|
|
3531
|
+
while ((res = sep2.exec(selector)) !== null) {
|
|
1909
3532
|
const separator = res[1];
|
|
1910
3533
|
const part2 = selector.slice(startIndex, res.index).trim();
|
|
1911
3534
|
shouldScope = shouldScope || part2.indexOf(_polyfillHostNoCombinator) > -1;
|
|
1912
3535
|
const scopedPart = shouldScope ? _scopeSelectorPart(part2) : part2;
|
|
1913
3536
|
scopedSelector += `${scopedPart} ${separator} `;
|
|
1914
|
-
startIndex =
|
|
3537
|
+
startIndex = sep2.lastIndex;
|
|
1915
3538
|
}
|
|
1916
3539
|
const part = selector.substring(startIndex);
|
|
1917
3540
|
shouldScope = !part.match(_safePartRe) && (shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1);
|
|
@@ -2358,10 +3981,11 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2358
3981
|
elm.classList.add(elm["s-si"] = scopeId);
|
|
2359
3982
|
}
|
|
2360
3983
|
if (newVNode2.$children$) {
|
|
3984
|
+
const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
|
|
2361
3985
|
for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
|
|
2362
3986
|
childNode = createElm(oldParentVNode, newVNode2, i2);
|
|
2363
3987
|
if (childNode) {
|
|
2364
|
-
|
|
3988
|
+
appendTarget.appendChild(childNode);
|
|
2365
3989
|
}
|
|
2366
3990
|
}
|
|
2367
3991
|
}
|
|
@@ -2448,6 +4072,9 @@ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
|
2448
4072
|
if (BUILD14.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
2449
4073
|
containerElm = containerElm.shadowRoot;
|
|
2450
4074
|
}
|
|
4075
|
+
if (parentVNode.$tag$ === "template") {
|
|
4076
|
+
containerElm = containerElm.content;
|
|
4077
|
+
}
|
|
2451
4078
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
2452
4079
|
if (vnodes[startIdx]) {
|
|
2453
4080
|
childNode = createElm(null, parentVNode, startIdx);
|
|
@@ -2491,6 +4118,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2491
4118
|
let newEndVnode = newCh[newEndIdx];
|
|
2492
4119
|
let node;
|
|
2493
4120
|
let elmToMove;
|
|
4121
|
+
const containerElm = newVNode2.$tag$ === "template" ? parentElm.content : parentElm;
|
|
2494
4122
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
2495
4123
|
if (oldStartVnode == null) {
|
|
2496
4124
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
@@ -2513,7 +4141,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2513
4141
|
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
2514
4142
|
}
|
|
2515
4143
|
patch(oldStartVnode, newEndVnode, isInitialRender);
|
|
2516
|
-
insertBefore(
|
|
4144
|
+
insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
2517
4145
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
2518
4146
|
newEndVnode = newCh[--newEndIdx];
|
|
2519
4147
|
} else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
|
|
@@ -2521,7 +4149,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
2521
4149
|
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
2522
4150
|
}
|
|
2523
4151
|
patch(oldEndVnode, newStartVnode, isInitialRender);
|
|
2524
|
-
insertBefore(
|
|
4152
|
+
insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
2525
4153
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
2526
4154
|
newStartVnode = newCh[++newStartIdx];
|
|
2527
4155
|
} else {
|
|
@@ -2796,13 +4424,16 @@ render() {
|
|
|
2796
4424
|
for (const relocateData of relocateNodes) {
|
|
2797
4425
|
const nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
2798
4426
|
const slotRefNode = relocateData.$slotRefNode$;
|
|
4427
|
+
if (nodeToRelocate.nodeType === 1 /* ElementNode */ && isInitialLoad) {
|
|
4428
|
+
nodeToRelocate["s-ih"] = (_a = nodeToRelocate.hidden) != null ? _a : false;
|
|
4429
|
+
}
|
|
2799
4430
|
if (slotRefNode) {
|
|
2800
4431
|
const parentNodeRef = slotRefNode.parentNode;
|
|
2801
4432
|
let insertBeforeNode = slotRefNode.nextSibling;
|
|
2802
4433
|
if (!BUILD14.hydrateServerSide && (!BUILD14.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */)) {
|
|
2803
|
-
let orgLocationNode = (
|
|
4434
|
+
let orgLocationNode = (_b = nodeToRelocate["s-ol"]) == null ? void 0 : _b.previousSibling;
|
|
2804
4435
|
while (orgLocationNode) {
|
|
2805
|
-
let refNode = (
|
|
4436
|
+
let refNode = (_c = orgLocationNode["s-nr"]) != null ? _c : null;
|
|
2806
4437
|
if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === (refNode.__parentNode || refNode.parentNode)) {
|
|
2807
4438
|
refNode = refNode.nextSibling;
|
|
2808
4439
|
while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
|
|
@@ -2825,18 +4456,13 @@ render() {
|
|
|
2825
4456
|
}
|
|
2826
4457
|
insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
|
|
2827
4458
|
if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
|
|
2828
|
-
nodeToRelocate.hidden = (
|
|
4459
|
+
nodeToRelocate.hidden = (_d = nodeToRelocate["s-ih"]) != null ? _d : false;
|
|
2829
4460
|
}
|
|
2830
4461
|
}
|
|
2831
4462
|
}
|
|
2832
4463
|
nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
|
|
2833
|
-
} else {
|
|
2834
|
-
|
|
2835
|
-
if (isInitialLoad) {
|
|
2836
|
-
nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
|
|
2837
|
-
}
|
|
2838
|
-
nodeToRelocate.hidden = true;
|
|
2839
|
-
}
|
|
4464
|
+
} else if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
4465
|
+
nodeToRelocate.hidden = true;
|
|
2840
4466
|
}
|
|
2841
4467
|
}
|
|
2842
4468
|
}
|
|
@@ -3190,7 +4816,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3190
4816
|
if (BUILD16.serializer && BUILD16.reflect && cmpMeta.$attrsToReflect$) {
|
|
3191
4817
|
if (instance && cmpMeta.$serializers$ && cmpMeta.$serializers$[propName]) {
|
|
3192
4818
|
let attrVal = newVal;
|
|
3193
|
-
for (const
|
|
4819
|
+
for (const serializer of cmpMeta.$serializers$[propName]) {
|
|
4820
|
+
const [[methodName]] = Object.entries(serializer);
|
|
3194
4821
|
attrVal = instance[methodName](attrVal, propName);
|
|
3195
4822
|
}
|
|
3196
4823
|
hostRef.$serializerValues$.set(propName, attrVal);
|
|
@@ -3219,27 +4846,34 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
3219
4846
|
);
|
|
3220
4847
|
}
|
|
3221
4848
|
}
|
|
3222
|
-
if (
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
4849
|
+
if (BUILD16.propChangeCallback && cmpMeta.$watchers$) {
|
|
4850
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
|
4851
|
+
if (watchMethods) {
|
|
4852
|
+
watchMethods.map((watcher) => {
|
|
4853
|
+
try {
|
|
4854
|
+
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
4855
|
+
if (flags & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */) {
|
|
4856
|
+
if (!instance) {
|
|
4857
|
+
hostRef.$fetchedCbList$.push(() => {
|
|
4858
|
+
hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
|
|
4859
|
+
});
|
|
4860
|
+
} else {
|
|
4861
|
+
instance[watchMethodName](newVal, oldVal, propName);
|
|
4862
|
+
}
|
|
3231
4863
|
}
|
|
3232
|
-
})
|
|
3233
|
-
|
|
3234
|
-
}
|
|
3235
|
-
if (BUILD16.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
3236
|
-
if (instance.componentShouldUpdate) {
|
|
3237
|
-
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
3238
|
-
return;
|
|
4864
|
+
} catch (e) {
|
|
4865
|
+
consoleError(e, elm);
|
|
3239
4866
|
}
|
|
4867
|
+
});
|
|
4868
|
+
}
|
|
4869
|
+
}
|
|
4870
|
+
if (BUILD16.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
4871
|
+
if (instance.componentShouldUpdate) {
|
|
4872
|
+
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
4873
|
+
return;
|
|
3240
4874
|
}
|
|
3241
|
-
scheduleUpdate(hostRef, false);
|
|
3242
4875
|
}
|
|
4876
|
+
scheduleUpdate(hostRef, false);
|
|
3243
4877
|
}
|
|
3244
4878
|
}
|
|
3245
4879
|
};
|
|
@@ -3422,7 +5056,8 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3422
5056
|
this[propName] = deserializeVal;
|
|
3423
5057
|
}
|
|
3424
5058
|
};
|
|
3425
|
-
for (const
|
|
5059
|
+
for (const deserializer of cmpMeta.$deserializers$[propName]) {
|
|
5060
|
+
const [[methodName]] = Object.entries(deserializer);
|
|
3426
5061
|
if (BUILD17.lazyLoad) {
|
|
3427
5062
|
if (hostRef.$lazyInstance$) {
|
|
3428
5063
|
setVal(methodName, hostRef.$lazyInstance$);
|
|
@@ -3441,13 +5076,14 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
|
|
|
3441
5076
|
return;
|
|
3442
5077
|
} else if (propName == null) {
|
|
3443
5078
|
const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
|
|
3444
|
-
if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) &&
|
|
5079
|
+
if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && newValue !== oldValue) {
|
|
3445
5080
|
const elm = BUILD17.lazyLoad ? hostRef.$hostElement$ : this;
|
|
3446
5081
|
const instance = BUILD17.lazyLoad ? hostRef.$lazyInstance$ : elm;
|
|
3447
5082
|
const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
|
|
3448
|
-
entry == null ? void 0 : entry.forEach((
|
|
3449
|
-
|
|
3450
|
-
|
|
5083
|
+
entry == null ? void 0 : entry.forEach((watcher) => {
|
|
5084
|
+
const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
|
|
5085
|
+
if (instance[watchMethodName] != null && (flags2 & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */)) {
|
|
5086
|
+
instance[watchMethodName].call(instance, newValue, oldValue, attrName);
|
|
3451
5087
|
}
|
|
3452
5088
|
});
|
|
3453
5089
|
}
|
|
@@ -3548,7 +5184,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
3548
5184
|
}
|
|
3549
5185
|
}
|
|
3550
5186
|
const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
|
|
3551
|
-
if (!styles.has(scopeId2)) {
|
|
5187
|
+
if (!styles.has(scopeId2) || BUILD18.hotModuleReplacement && hmrVersionId) {
|
|
3552
5188
|
const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
|
|
3553
5189
|
if (BUILD18.hydrateServerSide && BUILD18.shadowDom) {
|
|
3554
5190
|
if (cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
|
|
@@ -3716,7 +5352,7 @@ var proxyCustomElement = (Cstr, compactMeta) => {
|
|
|
3716
5352
|
if (BUILD21.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
3717
5353
|
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
|
|
3718
5354
|
}
|
|
3719
|
-
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /*
|
|
5355
|
+
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /* hasSlot */) {
|
|
3720
5356
|
if (BUILD21.experimentalSlotFixes) {
|
|
3721
5357
|
patchPseudoShadowDom(Cstr.prototype);
|
|
3722
5358
|
} else {
|
|
@@ -3948,7 +5584,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
3948
5584
|
return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
|
|
3949
5585
|
}
|
|
3950
5586
|
};
|
|
3951
|
-
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /*
|
|
5587
|
+
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /* hasSlot */) {
|
|
3952
5588
|
if (BUILD22.experimentalSlotFixes) {
|
|
3953
5589
|
patchPseudoShadowDom(HostElement.prototype);
|
|
3954
5590
|
} else {
|
|
@@ -4293,7 +5929,8 @@ function proxyHostElement(elm, cstr) {
|
|
|
4293
5929
|
const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(cstr.prototype, memberName) || {};
|
|
4294
5930
|
if (attrValue != null) {
|
|
4295
5931
|
if ((_a = cmpMeta.$deserializers$) == null ? void 0 : _a[memberName]) {
|
|
4296
|
-
for (const
|
|
5932
|
+
for (const deserializer of cmpMeta.$deserializers$[memberName]) {
|
|
5933
|
+
const [[methodName]] = Object.entries(deserializer);
|
|
4297
5934
|
attrPropVal = cstr.prototype[methodName](attrValue, memberName);
|
|
4298
5935
|
}
|
|
4299
5936
|
} else {
|