@mgdis/core-ui-helpers 1.1.1 → 1.1.2
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/.turbo/turbo-build.log +17 -17
- package/CHANGELOG.md +7 -0
- package/dist/stencil/index.cjs +0 -1669
- package/dist/stencil/index.cjs.map +1 -1
- package/dist/stencil/index.js +0 -1669
- package/dist/stencil/index.js.map +1 -1
- package/dist/stencil/index.umd.js +216 -1885
- package/dist/stencil/index.umd.js.map +1 -1
- package/dist/storybook/index.cjs +168 -1705
- package/dist/storybook/index.cjs.map +1 -1
- package/dist/storybook/index.js +168 -1705
- package/dist/storybook/index.js.map +1 -1
- package/dist/storybook/index.umd.js +168 -1705
- package/dist/storybook/index.umd.js.map +1 -1
- package/package.json +7 -7
package/dist/storybook/index.js
CHANGED
|
@@ -1,264 +1,24 @@
|
|
|
1
1
|
// src/app-data/index.ts
|
|
2
2
|
var BUILD = {
|
|
3
3
|
updatable: true,
|
|
4
|
-
slotRelocation: true
|
|
5
|
-
// TODO(STENCIL-914): remove this option when `experimentalSlotFixes` is the default behavior
|
|
6
|
-
experimentalSlotFixes: false
|
|
7
|
-
};
|
|
4
|
+
slotRelocation: true};
|
|
8
5
|
|
|
9
6
|
/*
|
|
10
|
-
Stencil Client Platform v4.
|
|
7
|
+
Stencil Client Platform v4.43.4 | MIT Licensed | https://stenciljs.com
|
|
11
8
|
*/
|
|
12
|
-
|
|
13
|
-
var __defProp = Object.defineProperty;
|
|
14
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
15
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
16
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
17
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
-
var __typeError = (msg) => {
|
|
19
|
-
throw TypeError(msg);
|
|
20
|
-
};
|
|
21
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
22
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
23
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
24
|
-
};
|
|
25
|
-
var __export = (target, all) => {
|
|
26
|
-
for (var name in all)
|
|
27
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
|
-
};
|
|
29
|
-
var __copyProps = (to, from, except, desc) => {
|
|
30
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
31
|
-
for (let key of __getOwnPropNames(from))
|
|
32
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
33
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
34
|
-
}
|
|
35
|
-
return to;
|
|
36
|
-
};
|
|
37
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
38
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
39
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
40
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
41
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
42
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
43
|
-
mod
|
|
44
|
-
));
|
|
45
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
46
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
47
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
48
|
-
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);
|
|
49
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
50
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
51
|
-
|
|
52
|
-
// node_modules/balanced-match/index.js
|
|
53
|
-
var require_balanced_match = __commonJS({
|
|
54
|
-
"node_modules/balanced-match/index.js"(exports$1, module) {
|
|
55
|
-
module.exports = balanced;
|
|
56
|
-
function balanced(a, b, str) {
|
|
57
|
-
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
58
|
-
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
59
|
-
var r = range(a, b, str);
|
|
60
|
-
return r && {
|
|
61
|
-
start: r[0],
|
|
62
|
-
end: r[1],
|
|
63
|
-
pre: str.slice(0, r[0]),
|
|
64
|
-
body: str.slice(r[0] + a.length, r[1]),
|
|
65
|
-
post: str.slice(r[1] + b.length)
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function maybeMatch(reg, str) {
|
|
69
|
-
var m = str.match(reg);
|
|
70
|
-
return m ? m[0] : null;
|
|
71
|
-
}
|
|
72
|
-
balanced.range = range;
|
|
73
|
-
function range(a, b, str) {
|
|
74
|
-
var begs, beg, left, right, result;
|
|
75
|
-
var ai = str.indexOf(a);
|
|
76
|
-
var bi = str.indexOf(b, ai + 1);
|
|
77
|
-
var i2 = ai;
|
|
78
|
-
if (ai >= 0 && bi > 0) {
|
|
79
|
-
if (a === b) {
|
|
80
|
-
return [ai, bi];
|
|
81
|
-
}
|
|
82
|
-
begs = [];
|
|
83
|
-
left = str.length;
|
|
84
|
-
while (i2 >= 0 && !result) {
|
|
85
|
-
if (i2 == ai) {
|
|
86
|
-
begs.push(i2);
|
|
87
|
-
ai = str.indexOf(a, i2 + 1);
|
|
88
|
-
} else if (begs.length == 1) {
|
|
89
|
-
result = [begs.pop(), bi];
|
|
90
|
-
} else {
|
|
91
|
-
beg = begs.pop();
|
|
92
|
-
if (beg < left) {
|
|
93
|
-
left = beg;
|
|
94
|
-
right = bi;
|
|
95
|
-
}
|
|
96
|
-
bi = str.indexOf(b, i2 + 1);
|
|
97
|
-
}
|
|
98
|
-
i2 = ai < bi && ai >= 0 ? ai : bi;
|
|
99
|
-
}
|
|
100
|
-
if (begs.length) {
|
|
101
|
-
result = [left, right];
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return result;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
// node_modules/brace-expansion/index.js
|
|
110
|
-
var require_brace_expansion = __commonJS({
|
|
111
|
-
"node_modules/brace-expansion/index.js"(exports$1, module) {
|
|
112
|
-
var balanced = require_balanced_match();
|
|
113
|
-
module.exports = expandTop;
|
|
114
|
-
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
115
|
-
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
116
|
-
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
117
|
-
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
118
|
-
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
119
|
-
function numeric(str) {
|
|
120
|
-
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
121
|
-
}
|
|
122
|
-
function escapeBraces(str) {
|
|
123
|
-
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
124
|
-
}
|
|
125
|
-
function unescapeBraces(str) {
|
|
126
|
-
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
127
|
-
}
|
|
128
|
-
function parseCommaParts(str) {
|
|
129
|
-
if (!str)
|
|
130
|
-
return [""];
|
|
131
|
-
var parts = [];
|
|
132
|
-
var m = balanced("{", "}", str);
|
|
133
|
-
if (!m)
|
|
134
|
-
return str.split(",");
|
|
135
|
-
var pre = m.pre;
|
|
136
|
-
var body = m.body;
|
|
137
|
-
var post = m.post;
|
|
138
|
-
var p = pre.split(",");
|
|
139
|
-
p[p.length - 1] += "{" + body + "}";
|
|
140
|
-
var postParts = parseCommaParts(post);
|
|
141
|
-
if (post.length) {
|
|
142
|
-
p[p.length - 1] += postParts.shift();
|
|
143
|
-
p.push.apply(p, postParts);
|
|
144
|
-
}
|
|
145
|
-
parts.push.apply(parts, p);
|
|
146
|
-
return parts;
|
|
147
|
-
}
|
|
148
|
-
function expandTop(str) {
|
|
149
|
-
if (!str)
|
|
150
|
-
return [];
|
|
151
|
-
if (str.substr(0, 2) === "{}") {
|
|
152
|
-
str = "\\{\\}" + str.substr(2);
|
|
153
|
-
}
|
|
154
|
-
return expand2(escapeBraces(str), true).map(unescapeBraces);
|
|
155
|
-
}
|
|
156
|
-
function embrace(str) {
|
|
157
|
-
return "{" + str + "}";
|
|
158
|
-
}
|
|
159
|
-
function isPadded(el) {
|
|
160
|
-
return /^-?0\d/.test(el);
|
|
161
|
-
}
|
|
162
|
-
function lte(i2, y) {
|
|
163
|
-
return i2 <= y;
|
|
164
|
-
}
|
|
165
|
-
function gte(i2, y) {
|
|
166
|
-
return i2 >= y;
|
|
167
|
-
}
|
|
168
|
-
function expand2(str, isTop) {
|
|
169
|
-
var expansions = [];
|
|
170
|
-
var m = balanced("{", "}", str);
|
|
171
|
-
if (!m) return [str];
|
|
172
|
-
var pre = m.pre;
|
|
173
|
-
var post = m.post.length ? expand2(m.post, false) : [""];
|
|
174
|
-
if (/\$$/.test(m.pre)) {
|
|
175
|
-
for (var k = 0; k < post.length; k++) {
|
|
176
|
-
var expansion = pre + "{" + m.body + "}" + post[k];
|
|
177
|
-
expansions.push(expansion);
|
|
178
|
-
}
|
|
179
|
-
} else {
|
|
180
|
-
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
181
|
-
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
182
|
-
var isSequence = isNumericSequence || isAlphaSequence;
|
|
183
|
-
var isOptions = m.body.indexOf(",") >= 0;
|
|
184
|
-
if (!isSequence && !isOptions) {
|
|
185
|
-
if (m.post.match(/,(?!,).*\}/)) {
|
|
186
|
-
str = m.pre + "{" + m.body + escClose + m.post;
|
|
187
|
-
return expand2(str);
|
|
188
|
-
}
|
|
189
|
-
return [str];
|
|
190
|
-
}
|
|
191
|
-
var n;
|
|
192
|
-
if (isSequence) {
|
|
193
|
-
n = m.body.split(/\.\./);
|
|
194
|
-
} else {
|
|
195
|
-
n = parseCommaParts(m.body);
|
|
196
|
-
if (n.length === 1) {
|
|
197
|
-
n = expand2(n[0], false).map(embrace);
|
|
198
|
-
if (n.length === 1) {
|
|
199
|
-
return post.map(function(p) {
|
|
200
|
-
return m.pre + n[0] + p;
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
var N;
|
|
206
|
-
if (isSequence) {
|
|
207
|
-
var x = numeric(n[0]);
|
|
208
|
-
var y = numeric(n[1]);
|
|
209
|
-
var width = Math.max(n[0].length, n[1].length);
|
|
210
|
-
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
|
|
211
|
-
var test = lte;
|
|
212
|
-
var reverse = y < x;
|
|
213
|
-
if (reverse) {
|
|
214
|
-
incr *= -1;
|
|
215
|
-
test = gte;
|
|
216
|
-
}
|
|
217
|
-
var pad = n.some(isPadded);
|
|
218
|
-
N = [];
|
|
219
|
-
for (var i2 = x; test(i2, y); i2 += incr) {
|
|
220
|
-
var c;
|
|
221
|
-
if (isAlphaSequence) {
|
|
222
|
-
c = String.fromCharCode(i2);
|
|
223
|
-
if (c === "\\")
|
|
224
|
-
c = "";
|
|
225
|
-
} else {
|
|
226
|
-
c = String(i2);
|
|
227
|
-
if (pad) {
|
|
228
|
-
var need = width - c.length;
|
|
229
|
-
if (need > 0) {
|
|
230
|
-
var z = new Array(need + 1).join("0");
|
|
231
|
-
if (i2 < 0)
|
|
232
|
-
c = "-" + z + c.slice(1);
|
|
233
|
-
else
|
|
234
|
-
c = z + c;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
N.push(c);
|
|
239
|
-
}
|
|
240
|
-
} else {
|
|
241
|
-
N = [];
|
|
242
|
-
for (var j = 0; j < n.length; j++) {
|
|
243
|
-
N.push.apply(N, expand2(n[j], false));
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
for (var j = 0; j < N.length; j++) {
|
|
247
|
-
for (var k = 0; k < post.length; k++) {
|
|
248
|
-
var expansion = pre + N[j] + post[k];
|
|
249
|
-
if (!isTop || isSequence || expansion)
|
|
250
|
-
expansions.push(expansion);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
return expansions;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
});
|
|
9
|
+
|
|
258
10
|
|
|
259
11
|
// src/utils/constants.ts
|
|
260
12
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
261
13
|
var HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
14
|
+
|
|
15
|
+
// src/client/client-host-ref.ts
|
|
16
|
+
var getHostRef = (ref) => {
|
|
17
|
+
if (ref.__stencil__getHostRef) {
|
|
18
|
+
return ref.__stencil__getHostRef();
|
|
19
|
+
}
|
|
20
|
+
return void 0;
|
|
21
|
+
};
|
|
262
22
|
var isMemberInElement = (elm, memberName) => memberName in elm;
|
|
263
23
|
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
264
24
|
var win = typeof window !== "undefined" ? window : {};
|
|
@@ -271,1420 +31,6 @@ var plt = {
|
|
|
271
31
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
272
32
|
ce: (eventName, opts) => new CustomEvent(eventName, opts)
|
|
273
33
|
};
|
|
274
|
-
|
|
275
|
-
// src/utils/helpers.ts
|
|
276
|
-
var isDef = (v) => v != null && v !== void 0;
|
|
277
|
-
var isComplexType = (o) => {
|
|
278
|
-
o = typeof o;
|
|
279
|
-
return o === "object" || o === "function";
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
// node_modules/minimatch/dist/esm/index.js
|
|
283
|
-
var import_brace_expansion = __toESM(require_brace_expansion());
|
|
284
|
-
|
|
285
|
-
// node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
286
|
-
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
287
|
-
var assertValidPattern = (pattern) => {
|
|
288
|
-
if (typeof pattern !== "string") {
|
|
289
|
-
throw new TypeError("invalid pattern");
|
|
290
|
-
}
|
|
291
|
-
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
292
|
-
throw new TypeError("pattern is too long");
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
// node_modules/minimatch/dist/esm/brace-expressions.js
|
|
297
|
-
var posixClasses = {
|
|
298
|
-
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
299
|
-
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
300
|
-
"[:ascii:]": ["\\x00-\\x7f", false],
|
|
301
|
-
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
302
|
-
"[:cntrl:]": ["\\p{Cc}", true],
|
|
303
|
-
"[:digit:]": ["\\p{Nd}", true],
|
|
304
|
-
"[:graph:]": ["\\p{Z}\\p{C}", true, true],
|
|
305
|
-
"[:lower:]": ["\\p{Ll}", true],
|
|
306
|
-
"[:print:]": ["\\p{C}", true],
|
|
307
|
-
"[:punct:]": ["\\p{P}", true],
|
|
308
|
-
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
309
|
-
"[:upper:]": ["\\p{Lu}", true],
|
|
310
|
-
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
311
|
-
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
312
|
-
};
|
|
313
|
-
var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
314
|
-
var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
315
|
-
var rangesToString = (ranges) => ranges.join("");
|
|
316
|
-
var parseClass = (glob, position) => {
|
|
317
|
-
const pos = position;
|
|
318
|
-
if (glob.charAt(pos) !== "[") {
|
|
319
|
-
throw new Error("not in a brace expression");
|
|
320
|
-
}
|
|
321
|
-
const ranges = [];
|
|
322
|
-
const negs = [];
|
|
323
|
-
let i2 = pos + 1;
|
|
324
|
-
let sawStart = false;
|
|
325
|
-
let uflag = false;
|
|
326
|
-
let escaping = false;
|
|
327
|
-
let negate = false;
|
|
328
|
-
let endPos = pos;
|
|
329
|
-
let rangeStart = "";
|
|
330
|
-
WHILE: while (i2 < glob.length) {
|
|
331
|
-
const c = glob.charAt(i2);
|
|
332
|
-
if ((c === "!" || c === "^") && i2 === pos + 1) {
|
|
333
|
-
negate = true;
|
|
334
|
-
i2++;
|
|
335
|
-
continue;
|
|
336
|
-
}
|
|
337
|
-
if (c === "]" && sawStart && !escaping) {
|
|
338
|
-
endPos = i2 + 1;
|
|
339
|
-
break;
|
|
340
|
-
}
|
|
341
|
-
sawStart = true;
|
|
342
|
-
if (c === "\\") {
|
|
343
|
-
if (!escaping) {
|
|
344
|
-
escaping = true;
|
|
345
|
-
i2++;
|
|
346
|
-
continue;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
if (c === "[" && !escaping) {
|
|
350
|
-
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
351
|
-
if (glob.startsWith(cls, i2)) {
|
|
352
|
-
if (rangeStart) {
|
|
353
|
-
return ["$.", false, glob.length - pos, true];
|
|
354
|
-
}
|
|
355
|
-
i2 += cls.length;
|
|
356
|
-
if (neg)
|
|
357
|
-
negs.push(unip);
|
|
358
|
-
else
|
|
359
|
-
ranges.push(unip);
|
|
360
|
-
uflag = uflag || u;
|
|
361
|
-
continue WHILE;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
escaping = false;
|
|
366
|
-
if (rangeStart) {
|
|
367
|
-
if (c > rangeStart) {
|
|
368
|
-
ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
|
|
369
|
-
} else if (c === rangeStart) {
|
|
370
|
-
ranges.push(braceEscape(c));
|
|
371
|
-
}
|
|
372
|
-
rangeStart = "";
|
|
373
|
-
i2++;
|
|
374
|
-
continue;
|
|
375
|
-
}
|
|
376
|
-
if (glob.startsWith("-]", i2 + 1)) {
|
|
377
|
-
ranges.push(braceEscape(c + "-"));
|
|
378
|
-
i2 += 2;
|
|
379
|
-
continue;
|
|
380
|
-
}
|
|
381
|
-
if (glob.startsWith("-", i2 + 1)) {
|
|
382
|
-
rangeStart = c;
|
|
383
|
-
i2 += 2;
|
|
384
|
-
continue;
|
|
385
|
-
}
|
|
386
|
-
ranges.push(braceEscape(c));
|
|
387
|
-
i2++;
|
|
388
|
-
}
|
|
389
|
-
if (endPos < i2) {
|
|
390
|
-
return ["", false, 0, false];
|
|
391
|
-
}
|
|
392
|
-
if (!ranges.length && !negs.length) {
|
|
393
|
-
return ["$.", false, glob.length - pos, true];
|
|
394
|
-
}
|
|
395
|
-
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
|
|
396
|
-
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
397
|
-
return [regexpEscape(r), false, endPos - pos, false];
|
|
398
|
-
}
|
|
399
|
-
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
|
|
400
|
-
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
401
|
-
const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
|
|
402
|
-
return [comb, uflag, endPos - pos, true];
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
// node_modules/minimatch/dist/esm/unescape.js
|
|
406
|
-
var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
407
|
-
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
// node_modules/minimatch/dist/esm/ast.js
|
|
411
|
-
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
412
|
-
var isExtglobType = (c) => types.has(c);
|
|
413
|
-
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
414
|
-
var startNoDot = "(?!\\.)";
|
|
415
|
-
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
|
416
|
-
var justDots = /* @__PURE__ */ new Set(["..", "."]);
|
|
417
|
-
var reSpecials = new Set("().*{}+?[]^$\\!");
|
|
418
|
-
var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
419
|
-
var qmark = "[^/]";
|
|
420
|
-
var star = qmark + "*?";
|
|
421
|
-
var starNoEmpty = qmark + "+?";
|
|
422
|
-
var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
|
|
423
|
-
var _AST = class _AST {
|
|
424
|
-
constructor(type, parent, options = {}) {
|
|
425
|
-
__privateAdd(this, _AST_instances);
|
|
426
|
-
__publicField(this, "type");
|
|
427
|
-
__privateAdd(this, _root);
|
|
428
|
-
__privateAdd(this, _hasMagic);
|
|
429
|
-
__privateAdd(this, _uflag, false);
|
|
430
|
-
__privateAdd(this, _parts, []);
|
|
431
|
-
__privateAdd(this, _parent);
|
|
432
|
-
__privateAdd(this, _parentIndex);
|
|
433
|
-
__privateAdd(this, _negs);
|
|
434
|
-
__privateAdd(this, _filledNegs, false);
|
|
435
|
-
__privateAdd(this, _options);
|
|
436
|
-
__privateAdd(this, _toString);
|
|
437
|
-
// set to true if it's an extglob with no children
|
|
438
|
-
// (which really means one child of '')
|
|
439
|
-
__privateAdd(this, _emptyExt, false);
|
|
440
|
-
this.type = type;
|
|
441
|
-
if (type)
|
|
442
|
-
__privateSet(this, _hasMagic, true);
|
|
443
|
-
__privateSet(this, _parent, parent);
|
|
444
|
-
__privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
|
|
445
|
-
__privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
|
|
446
|
-
__privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
|
|
447
|
-
if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
|
|
448
|
-
__privateGet(this, _negs).push(this);
|
|
449
|
-
__privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
|
|
450
|
-
}
|
|
451
|
-
get hasMagic() {
|
|
452
|
-
if (__privateGet(this, _hasMagic) !== void 0)
|
|
453
|
-
return __privateGet(this, _hasMagic);
|
|
454
|
-
for (const p of __privateGet(this, _parts)) {
|
|
455
|
-
if (typeof p === "string")
|
|
456
|
-
continue;
|
|
457
|
-
if (p.type || p.hasMagic)
|
|
458
|
-
return __privateSet(this, _hasMagic, true);
|
|
459
|
-
}
|
|
460
|
-
return __privateGet(this, _hasMagic);
|
|
461
|
-
}
|
|
462
|
-
// reconstructs the pattern
|
|
463
|
-
toString() {
|
|
464
|
-
if (__privateGet(this, _toString) !== void 0)
|
|
465
|
-
return __privateGet(this, _toString);
|
|
466
|
-
if (!this.type) {
|
|
467
|
-
return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
|
|
468
|
-
} else {
|
|
469
|
-
return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
push(...parts) {
|
|
473
|
-
for (const p of parts) {
|
|
474
|
-
if (p === "")
|
|
475
|
-
continue;
|
|
476
|
-
if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
|
|
477
|
-
throw new Error("invalid part: " + p);
|
|
478
|
-
}
|
|
479
|
-
__privateGet(this, _parts).push(p);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
toJSON() {
|
|
483
|
-
var _a;
|
|
484
|
-
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())];
|
|
485
|
-
if (this.isStart() && !this.type)
|
|
486
|
-
ret.unshift([]);
|
|
487
|
-
if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")) {
|
|
488
|
-
ret.push({});
|
|
489
|
-
}
|
|
490
|
-
return ret;
|
|
491
|
-
}
|
|
492
|
-
isStart() {
|
|
493
|
-
var _a;
|
|
494
|
-
if (__privateGet(this, _root) === this)
|
|
495
|
-
return true;
|
|
496
|
-
if (!((_a = __privateGet(this, _parent)) == null ? void 0 : _a.isStart()))
|
|
497
|
-
return false;
|
|
498
|
-
if (__privateGet(this, _parentIndex) === 0)
|
|
499
|
-
return true;
|
|
500
|
-
const p = __privateGet(this, _parent);
|
|
501
|
-
for (let i2 = 0; i2 < __privateGet(this, _parentIndex); i2++) {
|
|
502
|
-
const pp = __privateGet(p, _parts)[i2];
|
|
503
|
-
if (!(pp instanceof _AST && pp.type === "!")) {
|
|
504
|
-
return false;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
return true;
|
|
508
|
-
}
|
|
509
|
-
isEnd() {
|
|
510
|
-
var _a, _b, _c;
|
|
511
|
-
if (__privateGet(this, _root) === this)
|
|
512
|
-
return true;
|
|
513
|
-
if (((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")
|
|
514
|
-
return true;
|
|
515
|
-
if (!((_b = __privateGet(this, _parent)) == null ? void 0 : _b.isEnd()))
|
|
516
|
-
return false;
|
|
517
|
-
if (!this.type)
|
|
518
|
-
return (_c = __privateGet(this, _parent)) == null ? void 0 : _c.isEnd();
|
|
519
|
-
const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
|
|
520
|
-
return __privateGet(this, _parentIndex) === pl - 1;
|
|
521
|
-
}
|
|
522
|
-
copyIn(part) {
|
|
523
|
-
if (typeof part === "string")
|
|
524
|
-
this.push(part);
|
|
525
|
-
else
|
|
526
|
-
this.push(part.clone(this));
|
|
527
|
-
}
|
|
528
|
-
clone(parent) {
|
|
529
|
-
const c = new _AST(this.type, parent);
|
|
530
|
-
for (const p of __privateGet(this, _parts)) {
|
|
531
|
-
c.copyIn(p);
|
|
532
|
-
}
|
|
533
|
-
return c;
|
|
534
|
-
}
|
|
535
|
-
static fromGlob(pattern, options = {}) {
|
|
536
|
-
var _a;
|
|
537
|
-
const ast = new _AST(null, void 0, options);
|
|
538
|
-
__privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
|
|
539
|
-
return ast;
|
|
540
|
-
}
|
|
541
|
-
// returns the regular expression if there's magic, or the unescaped
|
|
542
|
-
// string if not.
|
|
543
|
-
toMMPattern() {
|
|
544
|
-
if (this !== __privateGet(this, _root))
|
|
545
|
-
return __privateGet(this, _root).toMMPattern();
|
|
546
|
-
const glob = this.toString();
|
|
547
|
-
const [re, body, hasMagic, uflag] = this.toRegExpSource();
|
|
548
|
-
const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
549
|
-
if (!anyMagic) {
|
|
550
|
-
return body;
|
|
551
|
-
}
|
|
552
|
-
const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
|
|
553
|
-
return Object.assign(new RegExp(`^${re}$`, flags), {
|
|
554
|
-
_src: re,
|
|
555
|
-
_glob: glob
|
|
556
|
-
});
|
|
557
|
-
}
|
|
558
|
-
get options() {
|
|
559
|
-
return __privateGet(this, _options);
|
|
560
|
-
}
|
|
561
|
-
// returns the string match, the regexp source, whether there's magic
|
|
562
|
-
// in the regexp (so a regular expression is required) and whether or
|
|
563
|
-
// not the uflag is needed for the regular expression (for posix classes)
|
|
564
|
-
// TODO: instead of injecting the start/end at this point, just return
|
|
565
|
-
// the BODY of the regexp, along with the start/end portions suitable
|
|
566
|
-
// for binding the start/end in either a joined full-path makeRe context
|
|
567
|
-
// (where we bind to (^|/), or a standalone matchPart context (where
|
|
568
|
-
// we bind to ^, and not /). Otherwise slashes get duped!
|
|
569
|
-
//
|
|
570
|
-
// In part-matching mode, the start is:
|
|
571
|
-
// - if not isStart: nothing
|
|
572
|
-
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
|
573
|
-
// - if dots allowed or not possible: ^
|
|
574
|
-
// - if dots possible and not allowed: ^(?!\.)
|
|
575
|
-
// end is:
|
|
576
|
-
// - if not isEnd(): nothing
|
|
577
|
-
// - else: $
|
|
578
|
-
//
|
|
579
|
-
// In full-path matching mode, we put the slash at the START of the
|
|
580
|
-
// pattern, so start is:
|
|
581
|
-
// - if first pattern: same as part-matching mode
|
|
582
|
-
// - if not isStart(): nothing
|
|
583
|
-
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
|
584
|
-
// - if dots allowed or not possible: /
|
|
585
|
-
// - if dots possible and not allowed: /(?!\.)
|
|
586
|
-
// end is:
|
|
587
|
-
// - if last pattern, same as part-matching mode
|
|
588
|
-
// - else nothing
|
|
589
|
-
//
|
|
590
|
-
// Always put the (?:$|/) on negated tails, though, because that has to be
|
|
591
|
-
// there to bind the end of the negated pattern portion, and it's easier to
|
|
592
|
-
// just stick it in now rather than try to inject it later in the middle of
|
|
593
|
-
// the pattern.
|
|
594
|
-
//
|
|
595
|
-
// We can just always return the same end, and leave it up to the caller
|
|
596
|
-
// to know whether it's going to be used joined or in parts.
|
|
597
|
-
// And, if the start is adjusted slightly, can do the same there:
|
|
598
|
-
// - if not isStart: nothing
|
|
599
|
-
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
|
600
|
-
// - if dots allowed or not possible: (?:/|^)
|
|
601
|
-
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
|
602
|
-
//
|
|
603
|
-
// But it's better to have a simpler binding without a conditional, for
|
|
604
|
-
// performance, so probably better to return both start options.
|
|
605
|
-
//
|
|
606
|
-
// Then the caller just ignores the end if it's not the first pattern,
|
|
607
|
-
// and the start always gets applied.
|
|
608
|
-
//
|
|
609
|
-
// But that's always going to be $ if it's the ending pattern, or nothing,
|
|
610
|
-
// so the caller can just attach $ at the end of the pattern when building.
|
|
611
|
-
//
|
|
612
|
-
// So the todo is:
|
|
613
|
-
// - better detect what kind of start is needed
|
|
614
|
-
// - return both flavors of starting pattern
|
|
615
|
-
// - attach $ at the end of the pattern when creating the actual RegExp
|
|
616
|
-
//
|
|
617
|
-
// Ah, but wait, no, that all only applies to the root when the first pattern
|
|
618
|
-
// is not an extglob. If the first pattern IS an extglob, then we need all
|
|
619
|
-
// that dot prevention biz to live in the extglob portions, because eg
|
|
620
|
-
// +(*|.x*) can match .xy but not .yx.
|
|
621
|
-
//
|
|
622
|
-
// So, return the two flavors if it's #root and the first child is not an
|
|
623
|
-
// AST, otherwise leave it to the child AST to handle it, and there,
|
|
624
|
-
// use the (?:^|/) style of start binding.
|
|
625
|
-
//
|
|
626
|
-
// Even simplified further:
|
|
627
|
-
// - Since the start for a join is eg /(?!\.) and the start for a part
|
|
628
|
-
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
|
629
|
-
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
630
|
-
toRegExpSource(allowDot) {
|
|
631
|
-
var _a;
|
|
632
|
-
const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
|
|
633
|
-
if (__privateGet(this, _root) === this)
|
|
634
|
-
__privateMethod(this, _AST_instances, fillNegs_fn).call(this);
|
|
635
|
-
if (!this.type) {
|
|
636
|
-
const noEmpty = this.isStart() && this.isEnd();
|
|
637
|
-
const src = __privateGet(this, _parts).map((p) => {
|
|
638
|
-
var _a2;
|
|
639
|
-
const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a2 = _AST, _AST_static, parseGlob_fn).call(_a2, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
|
|
640
|
-
__privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
|
|
641
|
-
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
642
|
-
return re;
|
|
643
|
-
}).join("");
|
|
644
|
-
let start2 = "";
|
|
645
|
-
if (this.isStart()) {
|
|
646
|
-
if (typeof __privateGet(this, _parts)[0] === "string") {
|
|
647
|
-
const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
|
|
648
|
-
if (!dotTravAllowed) {
|
|
649
|
-
const aps = addPatternStart;
|
|
650
|
-
const needNoTrav = (
|
|
651
|
-
// dots are allowed, and the pattern starts with [ or .
|
|
652
|
-
dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
653
|
-
src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
654
|
-
src.startsWith("\\.\\.") && aps.has(src.charAt(4))
|
|
655
|
-
);
|
|
656
|
-
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
657
|
-
start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
let end = "";
|
|
662
|
-
if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!") {
|
|
663
|
-
end = "(?:$|\\/)";
|
|
664
|
-
}
|
|
665
|
-
const final2 = start2 + src + end;
|
|
666
|
-
return [
|
|
667
|
-
final2,
|
|
668
|
-
unescape(src),
|
|
669
|
-
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
670
|
-
__privateGet(this, _uflag)
|
|
671
|
-
];
|
|
672
|
-
}
|
|
673
|
-
const repeated = this.type === "*" || this.type === "+";
|
|
674
|
-
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
675
|
-
let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
|
|
676
|
-
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
677
|
-
const s = this.toString();
|
|
678
|
-
__privateSet(this, _parts, [s]);
|
|
679
|
-
this.type = null;
|
|
680
|
-
__privateSet(this, _hasMagic, void 0);
|
|
681
|
-
return [s, unescape(this.toString()), false, false];
|
|
682
|
-
}
|
|
683
|
-
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
|
|
684
|
-
if (bodyDotAllowed === body) {
|
|
685
|
-
bodyDotAllowed = "";
|
|
686
|
-
}
|
|
687
|
-
if (bodyDotAllowed) {
|
|
688
|
-
body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
|
689
|
-
}
|
|
690
|
-
let final = "";
|
|
691
|
-
if (this.type === "!" && __privateGet(this, _emptyExt)) {
|
|
692
|
-
final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
|
|
693
|
-
} else {
|
|
694
|
-
const close = this.type === "!" ? (
|
|
695
|
-
// !() must match something,but !(x) can match ''
|
|
696
|
-
"))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
|
|
697
|
-
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
|
|
698
|
-
final = start + body + close;
|
|
699
|
-
}
|
|
700
|
-
return [
|
|
701
|
-
final,
|
|
702
|
-
unescape(body),
|
|
703
|
-
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
704
|
-
__privateGet(this, _uflag)
|
|
705
|
-
];
|
|
706
|
-
}
|
|
707
|
-
};
|
|
708
|
-
_root = new WeakMap();
|
|
709
|
-
_hasMagic = new WeakMap();
|
|
710
|
-
_uflag = new WeakMap();
|
|
711
|
-
_parts = new WeakMap();
|
|
712
|
-
_parent = new WeakMap();
|
|
713
|
-
_parentIndex = new WeakMap();
|
|
714
|
-
_negs = new WeakMap();
|
|
715
|
-
_filledNegs = new WeakMap();
|
|
716
|
-
_options = new WeakMap();
|
|
717
|
-
_toString = new WeakMap();
|
|
718
|
-
_emptyExt = new WeakMap();
|
|
719
|
-
_AST_instances = new WeakSet();
|
|
720
|
-
fillNegs_fn = function() {
|
|
721
|
-
if (this !== __privateGet(this, _root))
|
|
722
|
-
throw new Error("should only call on root");
|
|
723
|
-
if (__privateGet(this, _filledNegs))
|
|
724
|
-
return this;
|
|
725
|
-
this.toString();
|
|
726
|
-
__privateSet(this, _filledNegs, true);
|
|
727
|
-
let n;
|
|
728
|
-
while (n = __privateGet(this, _negs).pop()) {
|
|
729
|
-
if (n.type !== "!")
|
|
730
|
-
continue;
|
|
731
|
-
let p = n;
|
|
732
|
-
let pp = __privateGet(p, _parent);
|
|
733
|
-
while (pp) {
|
|
734
|
-
for (let i2 = __privateGet(p, _parentIndex) + 1; !pp.type && i2 < __privateGet(pp, _parts).length; i2++) {
|
|
735
|
-
for (const part of __privateGet(n, _parts)) {
|
|
736
|
-
if (typeof part === "string") {
|
|
737
|
-
throw new Error("string part in extglob AST??");
|
|
738
|
-
}
|
|
739
|
-
part.copyIn(__privateGet(pp, _parts)[i2]);
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
p = pp;
|
|
743
|
-
pp = __privateGet(p, _parent);
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
return this;
|
|
747
|
-
};
|
|
748
|
-
_AST_static = new WeakSet();
|
|
749
|
-
parseAST_fn = function(str, ast, pos, opt) {
|
|
750
|
-
var _a, _b;
|
|
751
|
-
let escaping = false;
|
|
752
|
-
let inBrace = false;
|
|
753
|
-
let braceStart = -1;
|
|
754
|
-
let braceNeg = false;
|
|
755
|
-
if (ast.type === null) {
|
|
756
|
-
let i3 = pos;
|
|
757
|
-
let acc2 = "";
|
|
758
|
-
while (i3 < str.length) {
|
|
759
|
-
const c = str.charAt(i3++);
|
|
760
|
-
if (escaping || c === "\\") {
|
|
761
|
-
escaping = !escaping;
|
|
762
|
-
acc2 += c;
|
|
763
|
-
continue;
|
|
764
|
-
}
|
|
765
|
-
if (inBrace) {
|
|
766
|
-
if (i3 === braceStart + 1) {
|
|
767
|
-
if (c === "^" || c === "!") {
|
|
768
|
-
braceNeg = true;
|
|
769
|
-
}
|
|
770
|
-
} else if (c === "]" && !(i3 === braceStart + 2 && braceNeg)) {
|
|
771
|
-
inBrace = false;
|
|
772
|
-
}
|
|
773
|
-
acc2 += c;
|
|
774
|
-
continue;
|
|
775
|
-
} else if (c === "[") {
|
|
776
|
-
inBrace = true;
|
|
777
|
-
braceStart = i3;
|
|
778
|
-
braceNeg = false;
|
|
779
|
-
acc2 += c;
|
|
780
|
-
continue;
|
|
781
|
-
}
|
|
782
|
-
if (!opt.noext && isExtglobType(c) && str.charAt(i3) === "(") {
|
|
783
|
-
ast.push(acc2);
|
|
784
|
-
acc2 = "";
|
|
785
|
-
const ext2 = new _AST(c, ast);
|
|
786
|
-
i3 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext2, i3, opt);
|
|
787
|
-
ast.push(ext2);
|
|
788
|
-
continue;
|
|
789
|
-
}
|
|
790
|
-
acc2 += c;
|
|
791
|
-
}
|
|
792
|
-
ast.push(acc2);
|
|
793
|
-
return i3;
|
|
794
|
-
}
|
|
795
|
-
let i2 = pos + 1;
|
|
796
|
-
let part = new _AST(null, ast);
|
|
797
|
-
const parts = [];
|
|
798
|
-
let acc = "";
|
|
799
|
-
while (i2 < str.length) {
|
|
800
|
-
const c = str.charAt(i2++);
|
|
801
|
-
if (escaping || c === "\\") {
|
|
802
|
-
escaping = !escaping;
|
|
803
|
-
acc += c;
|
|
804
|
-
continue;
|
|
805
|
-
}
|
|
806
|
-
if (inBrace) {
|
|
807
|
-
if (i2 === braceStart + 1) {
|
|
808
|
-
if (c === "^" || c === "!") {
|
|
809
|
-
braceNeg = true;
|
|
810
|
-
}
|
|
811
|
-
} else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
|
|
812
|
-
inBrace = false;
|
|
813
|
-
}
|
|
814
|
-
acc += c;
|
|
815
|
-
continue;
|
|
816
|
-
} else if (c === "[") {
|
|
817
|
-
inBrace = true;
|
|
818
|
-
braceStart = i2;
|
|
819
|
-
braceNeg = false;
|
|
820
|
-
acc += c;
|
|
821
|
-
continue;
|
|
822
|
-
}
|
|
823
|
-
if (isExtglobType(c) && str.charAt(i2) === "(") {
|
|
824
|
-
part.push(acc);
|
|
825
|
-
acc = "";
|
|
826
|
-
const ext2 = new _AST(c, part);
|
|
827
|
-
part.push(ext2);
|
|
828
|
-
i2 = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext2, i2, opt);
|
|
829
|
-
continue;
|
|
830
|
-
}
|
|
831
|
-
if (c === "|") {
|
|
832
|
-
part.push(acc);
|
|
833
|
-
acc = "";
|
|
834
|
-
parts.push(part);
|
|
835
|
-
part = new _AST(null, ast);
|
|
836
|
-
continue;
|
|
837
|
-
}
|
|
838
|
-
if (c === ")") {
|
|
839
|
-
if (acc === "" && __privateGet(ast, _parts).length === 0) {
|
|
840
|
-
__privateSet(ast, _emptyExt, true);
|
|
841
|
-
}
|
|
842
|
-
part.push(acc);
|
|
843
|
-
acc = "";
|
|
844
|
-
ast.push(...parts, part);
|
|
845
|
-
return i2;
|
|
846
|
-
}
|
|
847
|
-
acc += c;
|
|
848
|
-
}
|
|
849
|
-
ast.type = null;
|
|
850
|
-
__privateSet(ast, _hasMagic, void 0);
|
|
851
|
-
__privateSet(ast, _parts, [str.substring(pos - 1)]);
|
|
852
|
-
return i2;
|
|
853
|
-
};
|
|
854
|
-
partsToRegExp_fn = function(dot) {
|
|
855
|
-
return __privateGet(this, _parts).map((p) => {
|
|
856
|
-
if (typeof p === "string") {
|
|
857
|
-
throw new Error("string type in extglob ast??");
|
|
858
|
-
}
|
|
859
|
-
const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
|
|
860
|
-
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
861
|
-
return re;
|
|
862
|
-
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
863
|
-
};
|
|
864
|
-
parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
|
|
865
|
-
let escaping = false;
|
|
866
|
-
let re = "";
|
|
867
|
-
let uflag = false;
|
|
868
|
-
for (let i2 = 0; i2 < glob.length; i2++) {
|
|
869
|
-
const c = glob.charAt(i2);
|
|
870
|
-
if (escaping) {
|
|
871
|
-
escaping = false;
|
|
872
|
-
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
873
|
-
continue;
|
|
874
|
-
}
|
|
875
|
-
if (c === "\\") {
|
|
876
|
-
if (i2 === glob.length - 1) {
|
|
877
|
-
re += "\\\\";
|
|
878
|
-
} else {
|
|
879
|
-
escaping = true;
|
|
880
|
-
}
|
|
881
|
-
continue;
|
|
882
|
-
}
|
|
883
|
-
if (c === "[") {
|
|
884
|
-
const [src, needUflag, consumed, magic] = parseClass(glob, i2);
|
|
885
|
-
if (consumed) {
|
|
886
|
-
re += src;
|
|
887
|
-
uflag = uflag || needUflag;
|
|
888
|
-
i2 += consumed - 1;
|
|
889
|
-
hasMagic = hasMagic || magic;
|
|
890
|
-
continue;
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
if (c === "*") {
|
|
894
|
-
if (noEmpty && glob === "*")
|
|
895
|
-
re += starNoEmpty;
|
|
896
|
-
else
|
|
897
|
-
re += star;
|
|
898
|
-
hasMagic = true;
|
|
899
|
-
continue;
|
|
900
|
-
}
|
|
901
|
-
if (c === "?") {
|
|
902
|
-
re += qmark;
|
|
903
|
-
hasMagic = true;
|
|
904
|
-
continue;
|
|
905
|
-
}
|
|
906
|
-
re += regExpEscape(c);
|
|
907
|
-
}
|
|
908
|
-
return [re, unescape(glob), !!hasMagic, uflag];
|
|
909
|
-
};
|
|
910
|
-
__privateAdd(_AST, _AST_static);
|
|
911
|
-
var AST = _AST;
|
|
912
|
-
|
|
913
|
-
// node_modules/minimatch/dist/esm/escape.js
|
|
914
|
-
var escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
915
|
-
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
916
|
-
};
|
|
917
|
-
|
|
918
|
-
// node_modules/minimatch/dist/esm/index.js
|
|
919
|
-
var minimatch = (p, pattern, options = {}) => {
|
|
920
|
-
assertValidPattern(pattern);
|
|
921
|
-
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
922
|
-
return false;
|
|
923
|
-
}
|
|
924
|
-
return new Minimatch(pattern, options).match(p);
|
|
925
|
-
};
|
|
926
|
-
var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
|
|
927
|
-
var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
|
|
928
|
-
var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
|
|
929
|
-
var starDotExtTestNocase = (ext2) => {
|
|
930
|
-
ext2 = ext2.toLowerCase();
|
|
931
|
-
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
|
|
932
|
-
};
|
|
933
|
-
var starDotExtTestNocaseDot = (ext2) => {
|
|
934
|
-
ext2 = ext2.toLowerCase();
|
|
935
|
-
return (f) => f.toLowerCase().endsWith(ext2);
|
|
936
|
-
};
|
|
937
|
-
var starDotStarRE = /^\*+\.\*+$/;
|
|
938
|
-
var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
939
|
-
var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
940
|
-
var dotStarRE = /^\.\*+$/;
|
|
941
|
-
var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
942
|
-
var starRE = /^\*+$/;
|
|
943
|
-
var starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
944
|
-
var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
945
|
-
var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
946
|
-
var qmarksTestNocase = ([$0, ext2 = ""]) => {
|
|
947
|
-
const noext = qmarksTestNoExt([$0]);
|
|
948
|
-
if (!ext2)
|
|
949
|
-
return noext;
|
|
950
|
-
ext2 = ext2.toLowerCase();
|
|
951
|
-
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
952
|
-
};
|
|
953
|
-
var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
|
|
954
|
-
const noext = qmarksTestNoExtDot([$0]);
|
|
955
|
-
if (!ext2)
|
|
956
|
-
return noext;
|
|
957
|
-
ext2 = ext2.toLowerCase();
|
|
958
|
-
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
959
|
-
};
|
|
960
|
-
var qmarksTestDot = ([$0, ext2 = ""]) => {
|
|
961
|
-
const noext = qmarksTestNoExtDot([$0]);
|
|
962
|
-
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
963
|
-
};
|
|
964
|
-
var qmarksTest = ([$0, ext2 = ""]) => {
|
|
965
|
-
const noext = qmarksTestNoExt([$0]);
|
|
966
|
-
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
967
|
-
};
|
|
968
|
-
var qmarksTestNoExt = ([$0]) => {
|
|
969
|
-
const len = $0.length;
|
|
970
|
-
return (f) => f.length === len && !f.startsWith(".");
|
|
971
|
-
};
|
|
972
|
-
var qmarksTestNoExtDot = ([$0]) => {
|
|
973
|
-
const len = $0.length;
|
|
974
|
-
return (f) => f.length === len && f !== "." && f !== "..";
|
|
975
|
-
};
|
|
976
|
-
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
977
|
-
var path = {
|
|
978
|
-
win32: { sep: "\\" },
|
|
979
|
-
posix: { sep: "/" }
|
|
980
|
-
};
|
|
981
|
-
var sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
|
|
982
|
-
minimatch.sep = sep;
|
|
983
|
-
var GLOBSTAR = Symbol("globstar **");
|
|
984
|
-
minimatch.GLOBSTAR = GLOBSTAR;
|
|
985
|
-
var qmark2 = "[^/]";
|
|
986
|
-
var star2 = qmark2 + "*?";
|
|
987
|
-
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
988
|
-
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
989
|
-
var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
|
|
990
|
-
minimatch.filter = filter;
|
|
991
|
-
var ext = (a, b = {}) => Object.assign({}, a, b);
|
|
992
|
-
var defaults = (def) => {
|
|
993
|
-
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
994
|
-
return minimatch;
|
|
995
|
-
}
|
|
996
|
-
const orig = minimatch;
|
|
997
|
-
const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
|
|
998
|
-
return Object.assign(m, {
|
|
999
|
-
Minimatch: class Minimatch extends orig.Minimatch {
|
|
1000
|
-
constructor(pattern, options = {}) {
|
|
1001
|
-
super(pattern, ext(def, options));
|
|
1002
|
-
}
|
|
1003
|
-
static defaults(options) {
|
|
1004
|
-
return orig.defaults(ext(def, options)).Minimatch;
|
|
1005
|
-
}
|
|
1006
|
-
},
|
|
1007
|
-
AST: class AST extends orig.AST {
|
|
1008
|
-
/* c8 ignore start */
|
|
1009
|
-
constructor(type, parent, options = {}) {
|
|
1010
|
-
super(type, parent, ext(def, options));
|
|
1011
|
-
}
|
|
1012
|
-
/* c8 ignore stop */
|
|
1013
|
-
static fromGlob(pattern, options = {}) {
|
|
1014
|
-
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
1015
|
-
}
|
|
1016
|
-
},
|
|
1017
|
-
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
1018
|
-
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
1019
|
-
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
1020
|
-
defaults: (options) => orig.defaults(ext(def, options)),
|
|
1021
|
-
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
1022
|
-
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
1023
|
-
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
|
|
1024
|
-
sep: orig.sep,
|
|
1025
|
-
GLOBSTAR
|
|
1026
|
-
});
|
|
1027
|
-
};
|
|
1028
|
-
minimatch.defaults = defaults;
|
|
1029
|
-
var braceExpand = (pattern, options = {}) => {
|
|
1030
|
-
assertValidPattern(pattern);
|
|
1031
|
-
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
1032
|
-
return [pattern];
|
|
1033
|
-
}
|
|
1034
|
-
return (0, import_brace_expansion.default)(pattern);
|
|
1035
|
-
};
|
|
1036
|
-
minimatch.braceExpand = braceExpand;
|
|
1037
|
-
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
1038
|
-
minimatch.makeRe = makeRe;
|
|
1039
|
-
var match = (list, pattern, options = {}) => {
|
|
1040
|
-
const mm = new Minimatch(pattern, options);
|
|
1041
|
-
list = list.filter((f) => mm.match(f));
|
|
1042
|
-
if (mm.options.nonull && !list.length) {
|
|
1043
|
-
list.push(pattern);
|
|
1044
|
-
}
|
|
1045
|
-
return list;
|
|
1046
|
-
};
|
|
1047
|
-
minimatch.match = match;
|
|
1048
|
-
var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
1049
|
-
var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1050
|
-
var Minimatch = class {
|
|
1051
|
-
options;
|
|
1052
|
-
set;
|
|
1053
|
-
pattern;
|
|
1054
|
-
windowsPathsNoEscape;
|
|
1055
|
-
nonegate;
|
|
1056
|
-
negate;
|
|
1057
|
-
comment;
|
|
1058
|
-
empty;
|
|
1059
|
-
preserveMultipleSlashes;
|
|
1060
|
-
partial;
|
|
1061
|
-
globSet;
|
|
1062
|
-
globParts;
|
|
1063
|
-
nocase;
|
|
1064
|
-
isWindows;
|
|
1065
|
-
platform;
|
|
1066
|
-
windowsNoMagicRoot;
|
|
1067
|
-
regexp;
|
|
1068
|
-
constructor(pattern, options = {}) {
|
|
1069
|
-
assertValidPattern(pattern);
|
|
1070
|
-
options = options || {};
|
|
1071
|
-
this.options = options;
|
|
1072
|
-
this.pattern = pattern;
|
|
1073
|
-
this.platform = options.platform || defaultPlatform;
|
|
1074
|
-
this.isWindows = this.platform === "win32";
|
|
1075
|
-
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
|
1076
|
-
if (this.windowsPathsNoEscape) {
|
|
1077
|
-
this.pattern = this.pattern.replace(/\\/g, "/");
|
|
1078
|
-
}
|
|
1079
|
-
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
1080
|
-
this.regexp = null;
|
|
1081
|
-
this.negate = false;
|
|
1082
|
-
this.nonegate = !!options.nonegate;
|
|
1083
|
-
this.comment = false;
|
|
1084
|
-
this.empty = false;
|
|
1085
|
-
this.partial = !!options.partial;
|
|
1086
|
-
this.nocase = !!this.options.nocase;
|
|
1087
|
-
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
1088
|
-
this.globSet = [];
|
|
1089
|
-
this.globParts = [];
|
|
1090
|
-
this.set = [];
|
|
1091
|
-
this.make();
|
|
1092
|
-
}
|
|
1093
|
-
hasMagic() {
|
|
1094
|
-
if (this.options.magicalBraces && this.set.length > 1) {
|
|
1095
|
-
return true;
|
|
1096
|
-
}
|
|
1097
|
-
for (const pattern of this.set) {
|
|
1098
|
-
for (const part of pattern) {
|
|
1099
|
-
if (typeof part !== "string")
|
|
1100
|
-
return true;
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
return false;
|
|
1104
|
-
}
|
|
1105
|
-
debug(..._) {
|
|
1106
|
-
}
|
|
1107
|
-
make() {
|
|
1108
|
-
const pattern = this.pattern;
|
|
1109
|
-
const options = this.options;
|
|
1110
|
-
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
1111
|
-
this.comment = true;
|
|
1112
|
-
return;
|
|
1113
|
-
}
|
|
1114
|
-
if (!pattern) {
|
|
1115
|
-
this.empty = true;
|
|
1116
|
-
return;
|
|
1117
|
-
}
|
|
1118
|
-
this.parseNegate();
|
|
1119
|
-
this.globSet = [...new Set(this.braceExpand())];
|
|
1120
|
-
if (options.debug) {
|
|
1121
|
-
this.debug = (...args) => console.error(...args);
|
|
1122
|
-
}
|
|
1123
|
-
this.debug(this.pattern, this.globSet);
|
|
1124
|
-
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
1125
|
-
this.globParts = this.preprocess(rawGlobParts);
|
|
1126
|
-
this.debug(this.pattern, this.globParts);
|
|
1127
|
-
let set = this.globParts.map((s, _, __) => {
|
|
1128
|
-
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
1129
|
-
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
1130
|
-
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
1131
|
-
if (isUNC) {
|
|
1132
|
-
return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
1133
|
-
} else if (isDrive) {
|
|
1134
|
-
return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
return s.map((ss) => this.parse(ss));
|
|
1138
|
-
});
|
|
1139
|
-
this.debug(this.pattern, set);
|
|
1140
|
-
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
1141
|
-
if (this.isWindows) {
|
|
1142
|
-
for (let i2 = 0; i2 < this.set.length; i2++) {
|
|
1143
|
-
const p = this.set[i2];
|
|
1144
|
-
if (p[0] === "" && p[1] === "" && this.globParts[i2][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
|
|
1145
|
-
p[2] = "?";
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
this.debug(this.pattern, this.set);
|
|
1150
|
-
}
|
|
1151
|
-
// various transforms to equivalent pattern sets that are
|
|
1152
|
-
// faster to process in a filesystem walk. The goal is to
|
|
1153
|
-
// eliminate what we can, and push all ** patterns as far
|
|
1154
|
-
// to the right as possible, even if it increases the number
|
|
1155
|
-
// of patterns that we have to process.
|
|
1156
|
-
preprocess(globParts) {
|
|
1157
|
-
if (this.options.noglobstar) {
|
|
1158
|
-
for (let i2 = 0; i2 < globParts.length; i2++) {
|
|
1159
|
-
for (let j = 0; j < globParts[i2].length; j++) {
|
|
1160
|
-
if (globParts[i2][j] === "**") {
|
|
1161
|
-
globParts[i2][j] = "*";
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
const { optimizationLevel = 1 } = this.options;
|
|
1167
|
-
if (optimizationLevel >= 2) {
|
|
1168
|
-
globParts = this.firstPhasePreProcess(globParts);
|
|
1169
|
-
globParts = this.secondPhasePreProcess(globParts);
|
|
1170
|
-
} else if (optimizationLevel >= 1) {
|
|
1171
|
-
globParts = this.levelOneOptimize(globParts);
|
|
1172
|
-
} else {
|
|
1173
|
-
globParts = this.adjascentGlobstarOptimize(globParts);
|
|
1174
|
-
}
|
|
1175
|
-
return globParts;
|
|
1176
|
-
}
|
|
1177
|
-
// just get rid of adjascent ** portions
|
|
1178
|
-
adjascentGlobstarOptimize(globParts) {
|
|
1179
|
-
return globParts.map((parts) => {
|
|
1180
|
-
let gs = -1;
|
|
1181
|
-
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1182
|
-
let i2 = gs;
|
|
1183
|
-
while (parts[i2 + 1] === "**") {
|
|
1184
|
-
i2++;
|
|
1185
|
-
}
|
|
1186
|
-
if (i2 !== gs) {
|
|
1187
|
-
parts.splice(gs, i2 - gs);
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
return parts;
|
|
1191
|
-
});
|
|
1192
|
-
}
|
|
1193
|
-
// get rid of adjascent ** and resolve .. portions
|
|
1194
|
-
levelOneOptimize(globParts) {
|
|
1195
|
-
return globParts.map((parts) => {
|
|
1196
|
-
parts = parts.reduce((set, part) => {
|
|
1197
|
-
const prev = set[set.length - 1];
|
|
1198
|
-
if (part === "**" && prev === "**") {
|
|
1199
|
-
return set;
|
|
1200
|
-
}
|
|
1201
|
-
if (part === "..") {
|
|
1202
|
-
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
1203
|
-
set.pop();
|
|
1204
|
-
return set;
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
set.push(part);
|
|
1208
|
-
return set;
|
|
1209
|
-
}, []);
|
|
1210
|
-
return parts.length === 0 ? [""] : parts;
|
|
1211
|
-
});
|
|
1212
|
-
}
|
|
1213
|
-
levelTwoFileOptimize(parts) {
|
|
1214
|
-
if (!Array.isArray(parts)) {
|
|
1215
|
-
parts = this.slashSplit(parts);
|
|
1216
|
-
}
|
|
1217
|
-
let didSomething = false;
|
|
1218
|
-
do {
|
|
1219
|
-
didSomething = false;
|
|
1220
|
-
if (!this.preserveMultipleSlashes) {
|
|
1221
|
-
for (let i2 = 1; i2 < parts.length - 1; i2++) {
|
|
1222
|
-
const p = parts[i2];
|
|
1223
|
-
if (i2 === 1 && p === "" && parts[0] === "")
|
|
1224
|
-
continue;
|
|
1225
|
-
if (p === "." || p === "") {
|
|
1226
|
-
didSomething = true;
|
|
1227
|
-
parts.splice(i2, 1);
|
|
1228
|
-
i2--;
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1232
|
-
didSomething = true;
|
|
1233
|
-
parts.pop();
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
let dd = 0;
|
|
1237
|
-
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1238
|
-
const p = parts[dd - 1];
|
|
1239
|
-
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1240
|
-
didSomething = true;
|
|
1241
|
-
parts.splice(dd - 1, 2);
|
|
1242
|
-
dd -= 2;
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
} while (didSomething);
|
|
1246
|
-
return parts.length === 0 ? [""] : parts;
|
|
1247
|
-
}
|
|
1248
|
-
// First phase: single-pattern processing
|
|
1249
|
-
// <pre> is 1 or more portions
|
|
1250
|
-
// <rest> is 1 or more portions
|
|
1251
|
-
// <p> is any portion other than ., .., '', or **
|
|
1252
|
-
// <e> is . or ''
|
|
1253
|
-
//
|
|
1254
|
-
// **/.. is *brutal* for filesystem walking performance, because
|
|
1255
|
-
// it effectively resets the recursive walk each time it occurs,
|
|
1256
|
-
// and ** cannot be reduced out by a .. pattern part like a regexp
|
|
1257
|
-
// or most strings (other than .., ., and '') can be.
|
|
1258
|
-
//
|
|
1259
|
-
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
|
|
1260
|
-
// <pre>/<e>/<rest> -> <pre>/<rest>
|
|
1261
|
-
// <pre>/<p>/../<rest> -> <pre>/<rest>
|
|
1262
|
-
// **/**/<rest> -> **/<rest>
|
|
1263
|
-
//
|
|
1264
|
-
// **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
|
|
1265
|
-
// this WOULD be allowed if ** did follow symlinks, or * didn't
|
|
1266
|
-
firstPhasePreProcess(globParts) {
|
|
1267
|
-
let didSomething = false;
|
|
1268
|
-
do {
|
|
1269
|
-
didSomething = false;
|
|
1270
|
-
for (let parts of globParts) {
|
|
1271
|
-
let gs = -1;
|
|
1272
|
-
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1273
|
-
let gss = gs;
|
|
1274
|
-
while (parts[gss + 1] === "**") {
|
|
1275
|
-
gss++;
|
|
1276
|
-
}
|
|
1277
|
-
if (gss > gs) {
|
|
1278
|
-
parts.splice(gs + 1, gss - gs);
|
|
1279
|
-
}
|
|
1280
|
-
let next = parts[gs + 1];
|
|
1281
|
-
const p = parts[gs + 2];
|
|
1282
|
-
const p2 = parts[gs + 3];
|
|
1283
|
-
if (next !== "..")
|
|
1284
|
-
continue;
|
|
1285
|
-
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
|
|
1286
|
-
continue;
|
|
1287
|
-
}
|
|
1288
|
-
didSomething = true;
|
|
1289
|
-
parts.splice(gs, 1);
|
|
1290
|
-
const other = parts.slice(0);
|
|
1291
|
-
other[gs] = "**";
|
|
1292
|
-
globParts.push(other);
|
|
1293
|
-
gs--;
|
|
1294
|
-
}
|
|
1295
|
-
if (!this.preserveMultipleSlashes) {
|
|
1296
|
-
for (let i2 = 1; i2 < parts.length - 1; i2++) {
|
|
1297
|
-
const p = parts[i2];
|
|
1298
|
-
if (i2 === 1 && p === "" && parts[0] === "")
|
|
1299
|
-
continue;
|
|
1300
|
-
if (p === "." || p === "") {
|
|
1301
|
-
didSomething = true;
|
|
1302
|
-
parts.splice(i2, 1);
|
|
1303
|
-
i2--;
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1307
|
-
didSomething = true;
|
|
1308
|
-
parts.pop();
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
let dd = 0;
|
|
1312
|
-
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1313
|
-
const p = parts[dd - 1];
|
|
1314
|
-
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1315
|
-
didSomething = true;
|
|
1316
|
-
const needDot = dd === 1 && parts[dd + 1] === "**";
|
|
1317
|
-
const splin = needDot ? ["."] : [];
|
|
1318
|
-
parts.splice(dd - 1, 2, ...splin);
|
|
1319
|
-
if (parts.length === 0)
|
|
1320
|
-
parts.push("");
|
|
1321
|
-
dd -= 2;
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
} while (didSomething);
|
|
1326
|
-
return globParts;
|
|
1327
|
-
}
|
|
1328
|
-
// second phase: multi-pattern dedupes
|
|
1329
|
-
// {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
|
|
1330
|
-
// {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
|
|
1331
|
-
// {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
|
|
1332
|
-
//
|
|
1333
|
-
// {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
|
|
1334
|
-
// ^-- not valid because ** doens't follow symlinks
|
|
1335
|
-
secondPhasePreProcess(globParts) {
|
|
1336
|
-
for (let i2 = 0; i2 < globParts.length - 1; i2++) {
|
|
1337
|
-
for (let j = i2 + 1; j < globParts.length; j++) {
|
|
1338
|
-
const matched = this.partsMatch(globParts[i2], globParts[j], !this.preserveMultipleSlashes);
|
|
1339
|
-
if (!matched)
|
|
1340
|
-
continue;
|
|
1341
|
-
globParts[i2] = matched;
|
|
1342
|
-
globParts[j] = [];
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
return globParts.filter((gs) => gs.length);
|
|
1346
|
-
}
|
|
1347
|
-
partsMatch(a, b, emptyGSMatch = false) {
|
|
1348
|
-
let ai = 0;
|
|
1349
|
-
let bi = 0;
|
|
1350
|
-
let result = [];
|
|
1351
|
-
let which = "";
|
|
1352
|
-
while (ai < a.length && bi < b.length) {
|
|
1353
|
-
if (a[ai] === b[bi]) {
|
|
1354
|
-
result.push(which === "b" ? b[bi] : a[ai]);
|
|
1355
|
-
ai++;
|
|
1356
|
-
bi++;
|
|
1357
|
-
} else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
|
|
1358
|
-
result.push(a[ai]);
|
|
1359
|
-
ai++;
|
|
1360
|
-
} else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
|
|
1361
|
-
result.push(b[bi]);
|
|
1362
|
-
bi++;
|
|
1363
|
-
} else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
|
|
1364
|
-
if (which === "b")
|
|
1365
|
-
return false;
|
|
1366
|
-
which = "a";
|
|
1367
|
-
result.push(a[ai]);
|
|
1368
|
-
ai++;
|
|
1369
|
-
bi++;
|
|
1370
|
-
} else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
|
|
1371
|
-
if (which === "a")
|
|
1372
|
-
return false;
|
|
1373
|
-
which = "b";
|
|
1374
|
-
result.push(b[bi]);
|
|
1375
|
-
ai++;
|
|
1376
|
-
bi++;
|
|
1377
|
-
} else {
|
|
1378
|
-
return false;
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
return a.length === b.length && result;
|
|
1382
|
-
}
|
|
1383
|
-
parseNegate() {
|
|
1384
|
-
if (this.nonegate)
|
|
1385
|
-
return;
|
|
1386
|
-
const pattern = this.pattern;
|
|
1387
|
-
let negate = false;
|
|
1388
|
-
let negateOffset = 0;
|
|
1389
|
-
for (let i2 = 0; i2 < pattern.length && pattern.charAt(i2) === "!"; i2++) {
|
|
1390
|
-
negate = !negate;
|
|
1391
|
-
negateOffset++;
|
|
1392
|
-
}
|
|
1393
|
-
if (negateOffset)
|
|
1394
|
-
this.pattern = pattern.slice(negateOffset);
|
|
1395
|
-
this.negate = negate;
|
|
1396
|
-
}
|
|
1397
|
-
// set partial to true to test if, for example,
|
|
1398
|
-
// "/a/b" matches the start of "/*/b/*/d"
|
|
1399
|
-
// Partial means, if you run out of file before you run
|
|
1400
|
-
// out of pattern, then that's fine, as long as all
|
|
1401
|
-
// the parts match.
|
|
1402
|
-
matchOne(file, pattern, partial = false) {
|
|
1403
|
-
const options = this.options;
|
|
1404
|
-
if (this.isWindows) {
|
|
1405
|
-
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
1406
|
-
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
1407
|
-
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
1408
|
-
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
1409
|
-
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
1410
|
-
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
1411
|
-
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
1412
|
-
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
1413
|
-
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
1414
|
-
pattern[pdi] = fd;
|
|
1415
|
-
if (pdi > fdi) {
|
|
1416
|
-
pattern = pattern.slice(pdi);
|
|
1417
|
-
} else if (fdi > pdi) {
|
|
1418
|
-
file = file.slice(fdi);
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
const { optimizationLevel = 1 } = this.options;
|
|
1424
|
-
if (optimizationLevel >= 2) {
|
|
1425
|
-
file = this.levelTwoFileOptimize(file);
|
|
1426
|
-
}
|
|
1427
|
-
this.debug("matchOne", this, { file, pattern });
|
|
1428
|
-
this.debug("matchOne", file.length, pattern.length);
|
|
1429
|
-
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
1430
|
-
this.debug("matchOne loop");
|
|
1431
|
-
var p = pattern[pi];
|
|
1432
|
-
var f = file[fi];
|
|
1433
|
-
this.debug(pattern, p, f);
|
|
1434
|
-
if (p === false) {
|
|
1435
|
-
return false;
|
|
1436
|
-
}
|
|
1437
|
-
if (p === GLOBSTAR) {
|
|
1438
|
-
this.debug("GLOBSTAR", [pattern, p, f]);
|
|
1439
|
-
var fr = fi;
|
|
1440
|
-
var pr = pi + 1;
|
|
1441
|
-
if (pr === pl) {
|
|
1442
|
-
this.debug("** at the end");
|
|
1443
|
-
for (; fi < fl; fi++) {
|
|
1444
|
-
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
|
1445
|
-
return false;
|
|
1446
|
-
}
|
|
1447
|
-
return true;
|
|
1448
|
-
}
|
|
1449
|
-
while (fr < fl) {
|
|
1450
|
-
var swallowee = file[fr];
|
|
1451
|
-
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
1452
|
-
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
1453
|
-
this.debug("globstar found match!", fr, fl, swallowee);
|
|
1454
|
-
return true;
|
|
1455
|
-
} else {
|
|
1456
|
-
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
1457
|
-
this.debug("dot detected!", file, fr, pattern, pr);
|
|
1458
|
-
break;
|
|
1459
|
-
}
|
|
1460
|
-
this.debug("globstar swallow a segment, and continue");
|
|
1461
|
-
fr++;
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
if (partial) {
|
|
1465
|
-
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
1466
|
-
if (fr === fl) {
|
|
1467
|
-
return true;
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
return false;
|
|
1471
|
-
}
|
|
1472
|
-
let hit;
|
|
1473
|
-
if (typeof p === "string") {
|
|
1474
|
-
hit = f === p;
|
|
1475
|
-
this.debug("string match", p, f, hit);
|
|
1476
|
-
} else {
|
|
1477
|
-
hit = p.test(f);
|
|
1478
|
-
this.debug("pattern match", p, f, hit);
|
|
1479
|
-
}
|
|
1480
|
-
if (!hit)
|
|
1481
|
-
return false;
|
|
1482
|
-
}
|
|
1483
|
-
if (fi === fl && pi === pl) {
|
|
1484
|
-
return true;
|
|
1485
|
-
} else if (fi === fl) {
|
|
1486
|
-
return partial;
|
|
1487
|
-
} else if (pi === pl) {
|
|
1488
|
-
return fi === fl - 1 && file[fi] === "";
|
|
1489
|
-
} else {
|
|
1490
|
-
throw new Error("wtf?");
|
|
1491
|
-
}
|
|
1492
|
-
}
|
|
1493
|
-
braceExpand() {
|
|
1494
|
-
return braceExpand(this.pattern, this.options);
|
|
1495
|
-
}
|
|
1496
|
-
parse(pattern) {
|
|
1497
|
-
assertValidPattern(pattern);
|
|
1498
|
-
const options = this.options;
|
|
1499
|
-
if (pattern === "**")
|
|
1500
|
-
return GLOBSTAR;
|
|
1501
|
-
if (pattern === "")
|
|
1502
|
-
return "";
|
|
1503
|
-
let m;
|
|
1504
|
-
let fastTest = null;
|
|
1505
|
-
if (m = pattern.match(starRE)) {
|
|
1506
|
-
fastTest = options.dot ? starTestDot : starTest;
|
|
1507
|
-
} else if (m = pattern.match(starDotExtRE)) {
|
|
1508
|
-
fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
1509
|
-
} else if (m = pattern.match(qmarksRE)) {
|
|
1510
|
-
fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
1511
|
-
} else if (m = pattern.match(starDotStarRE)) {
|
|
1512
|
-
fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
1513
|
-
} else if (m = pattern.match(dotStarRE)) {
|
|
1514
|
-
fastTest = dotStarTest;
|
|
1515
|
-
}
|
|
1516
|
-
const re = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
1517
|
-
if (fastTest && typeof re === "object") {
|
|
1518
|
-
Reflect.defineProperty(re, "test", { value: fastTest });
|
|
1519
|
-
}
|
|
1520
|
-
return re;
|
|
1521
|
-
}
|
|
1522
|
-
makeRe() {
|
|
1523
|
-
if (this.regexp || this.regexp === false)
|
|
1524
|
-
return this.regexp;
|
|
1525
|
-
const set = this.set;
|
|
1526
|
-
if (!set.length) {
|
|
1527
|
-
this.regexp = false;
|
|
1528
|
-
return this.regexp;
|
|
1529
|
-
}
|
|
1530
|
-
const options = this.options;
|
|
1531
|
-
const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
|
|
1532
|
-
const flags = new Set(options.nocase ? ["i"] : []);
|
|
1533
|
-
let re = set.map((pattern) => {
|
|
1534
|
-
const pp = pattern.map((p) => {
|
|
1535
|
-
if (p instanceof RegExp) {
|
|
1536
|
-
for (const f of p.flags.split(""))
|
|
1537
|
-
flags.add(f);
|
|
1538
|
-
}
|
|
1539
|
-
return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
|
|
1540
|
-
});
|
|
1541
|
-
pp.forEach((p, i2) => {
|
|
1542
|
-
const next = pp[i2 + 1];
|
|
1543
|
-
const prev = pp[i2 - 1];
|
|
1544
|
-
if (p !== GLOBSTAR || prev === GLOBSTAR) {
|
|
1545
|
-
return;
|
|
1546
|
-
}
|
|
1547
|
-
if (prev === void 0) {
|
|
1548
|
-
if (next !== void 0 && next !== GLOBSTAR) {
|
|
1549
|
-
pp[i2 + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
1550
|
-
} else {
|
|
1551
|
-
pp[i2] = twoStar;
|
|
1552
|
-
}
|
|
1553
|
-
} else if (next === void 0) {
|
|
1554
|
-
pp[i2 - 1] = prev + "(?:\\/|" + twoStar + ")?";
|
|
1555
|
-
} else if (next !== GLOBSTAR) {
|
|
1556
|
-
pp[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
1557
|
-
pp[i2 + 1] = GLOBSTAR;
|
|
1558
|
-
}
|
|
1559
|
-
});
|
|
1560
|
-
return pp.filter((p) => p !== GLOBSTAR).join("/");
|
|
1561
|
-
}).join("|");
|
|
1562
|
-
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
1563
|
-
re = "^" + open + re + close + "$";
|
|
1564
|
-
if (this.negate)
|
|
1565
|
-
re = "^(?!" + re + ").+$";
|
|
1566
|
-
try {
|
|
1567
|
-
this.regexp = new RegExp(re, [...flags].join(""));
|
|
1568
|
-
} catch (ex) {
|
|
1569
|
-
this.regexp = false;
|
|
1570
|
-
}
|
|
1571
|
-
return this.regexp;
|
|
1572
|
-
}
|
|
1573
|
-
slashSplit(p) {
|
|
1574
|
-
if (this.preserveMultipleSlashes) {
|
|
1575
|
-
return p.split("/");
|
|
1576
|
-
} else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
|
|
1577
|
-
return ["", ...p.split(/\/+/)];
|
|
1578
|
-
} else {
|
|
1579
|
-
return p.split(/\/+/);
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
|
-
match(f, partial = this.partial) {
|
|
1583
|
-
this.debug("match", f, this.pattern);
|
|
1584
|
-
if (this.comment) {
|
|
1585
|
-
return false;
|
|
1586
|
-
}
|
|
1587
|
-
if (this.empty) {
|
|
1588
|
-
return f === "";
|
|
1589
|
-
}
|
|
1590
|
-
if (f === "/" && partial) {
|
|
1591
|
-
return true;
|
|
1592
|
-
}
|
|
1593
|
-
const options = this.options;
|
|
1594
|
-
if (this.isWindows) {
|
|
1595
|
-
f = f.split("\\").join("/");
|
|
1596
|
-
}
|
|
1597
|
-
const ff = this.slashSplit(f);
|
|
1598
|
-
this.debug(this.pattern, "split", ff);
|
|
1599
|
-
const set = this.set;
|
|
1600
|
-
this.debug(this.pattern, "set", set);
|
|
1601
|
-
let filename = ff[ff.length - 1];
|
|
1602
|
-
if (!filename) {
|
|
1603
|
-
for (let i2 = ff.length - 2; !filename && i2 >= 0; i2--) {
|
|
1604
|
-
filename = ff[i2];
|
|
1605
|
-
}
|
|
1606
|
-
}
|
|
1607
|
-
for (let i2 = 0; i2 < set.length; i2++) {
|
|
1608
|
-
const pattern = set[i2];
|
|
1609
|
-
let file = ff;
|
|
1610
|
-
if (options.matchBase && pattern.length === 1) {
|
|
1611
|
-
file = [filename];
|
|
1612
|
-
}
|
|
1613
|
-
const hit = this.matchOne(file, pattern, partial);
|
|
1614
|
-
if (hit) {
|
|
1615
|
-
if (options.flipNegate) {
|
|
1616
|
-
return true;
|
|
1617
|
-
}
|
|
1618
|
-
return !this.negate;
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
if (options.flipNegate) {
|
|
1622
|
-
return false;
|
|
1623
|
-
}
|
|
1624
|
-
return this.negate;
|
|
1625
|
-
}
|
|
1626
|
-
static defaults(def) {
|
|
1627
|
-
return minimatch.defaults(def).Minimatch;
|
|
1628
|
-
}
|
|
1629
|
-
};
|
|
1630
|
-
minimatch.AST = AST;
|
|
1631
|
-
minimatch.Minimatch = Minimatch;
|
|
1632
|
-
minimatch.escape = escape;
|
|
1633
|
-
minimatch.unescape = unescape;
|
|
1634
|
-
|
|
1635
|
-
// src/utils/regular-expression.ts
|
|
1636
|
-
var escapeRegExpSpecialCharacters = (text) => {
|
|
1637
|
-
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1638
|
-
};
|
|
1639
|
-
|
|
1640
|
-
// src/utils/result.ts
|
|
1641
|
-
var result_exports = {};
|
|
1642
|
-
__export(result_exports, {
|
|
1643
|
-
err: () => err,
|
|
1644
|
-
map: () => map,
|
|
1645
|
-
ok: () => ok,
|
|
1646
|
-
unwrap: () => unwrap,
|
|
1647
|
-
unwrapErr: () => unwrapErr
|
|
1648
|
-
});
|
|
1649
|
-
var ok = (value) => ({
|
|
1650
|
-
isOk: true,
|
|
1651
|
-
isErr: false,
|
|
1652
|
-
value
|
|
1653
|
-
});
|
|
1654
|
-
var err = (value) => ({
|
|
1655
|
-
isOk: false,
|
|
1656
|
-
isErr: true,
|
|
1657
|
-
value
|
|
1658
|
-
});
|
|
1659
|
-
function map(result, fn) {
|
|
1660
|
-
if (result.isOk) {
|
|
1661
|
-
const val = fn(result.value);
|
|
1662
|
-
if (val instanceof Promise) {
|
|
1663
|
-
return val.then((newVal) => ok(newVal));
|
|
1664
|
-
} else {
|
|
1665
|
-
return ok(val);
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
if (result.isErr) {
|
|
1669
|
-
const value = result.value;
|
|
1670
|
-
return err(value);
|
|
1671
|
-
}
|
|
1672
|
-
throw "should never get here";
|
|
1673
|
-
}
|
|
1674
|
-
var unwrap = (result) => {
|
|
1675
|
-
if (result.isOk) {
|
|
1676
|
-
return result.value;
|
|
1677
|
-
} else {
|
|
1678
|
-
throw result.value;
|
|
1679
|
-
}
|
|
1680
|
-
};
|
|
1681
|
-
var unwrapErr = (result) => {
|
|
1682
|
-
if (result.isErr) {
|
|
1683
|
-
return result.value;
|
|
1684
|
-
} else {
|
|
1685
|
-
throw result.value;
|
|
1686
|
-
}
|
|
1687
|
-
};
|
|
1688
34
|
var updateFallbackSlotVisibility = (elm) => {
|
|
1689
35
|
const childNodes = internalCall(elm, "childNodes");
|
|
1690
36
|
if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
|
|
@@ -1722,8 +68,9 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
1722
68
|
let childNode;
|
|
1723
69
|
for (; i2 < childNodes.length; i2++) {
|
|
1724
70
|
childNode = childNodes[i2];
|
|
1725
|
-
if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0)) {
|
|
71
|
+
if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
|
|
1726
72
|
slottedNodes.push(childNode);
|
|
73
|
+
if (typeof slotName !== "undefined") return slottedNodes;
|
|
1727
74
|
}
|
|
1728
75
|
slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
|
|
1729
76
|
}
|
|
@@ -1781,6 +128,18 @@ function patchSlotNode(node) {
|
|
|
1781
128
|
node.assignedElements = assignedFactory(true);
|
|
1782
129
|
node.assignedNodes = assignedFactory(false);
|
|
1783
130
|
}
|
|
131
|
+
function dispatchSlotChangeEvent(elm) {
|
|
132
|
+
elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
|
|
133
|
+
}
|
|
134
|
+
function findSlotFromSlottedNode(slottedNode, parentHost) {
|
|
135
|
+
var _a;
|
|
136
|
+
parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
|
|
137
|
+
if (!parentHost) return { slotNode: null, slotName: "" };
|
|
138
|
+
const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
|
|
139
|
+
const childNodes = internalCall(parentHost, "childNodes");
|
|
140
|
+
const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
|
|
141
|
+
return { slotNode, slotName };
|
|
142
|
+
}
|
|
1784
143
|
function internalCall(node, method) {
|
|
1785
144
|
if ("__" + method in node) {
|
|
1786
145
|
const toReturn = node["__" + method];
|
|
@@ -1791,6 +150,15 @@ function internalCall(node, method) {
|
|
|
1791
150
|
return node[method].bind(node);
|
|
1792
151
|
}
|
|
1793
152
|
}
|
|
153
|
+
|
|
154
|
+
// src/utils/helpers.ts
|
|
155
|
+
var isDef = (v) => v != null && v !== void 0;
|
|
156
|
+
var isComplexType = (o) => {
|
|
157
|
+
o = typeof o;
|
|
158
|
+
return o === "object" || o === "function";
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// src/runtime/vdom/h.ts
|
|
1794
162
|
var h = (nodeName, vnodeData, ...children) => {
|
|
1795
163
|
let child = null;
|
|
1796
164
|
let key = null;
|
|
@@ -1834,7 +202,8 @@ var newVNode = (tag, text) => {
|
|
|
1834
202
|
const vnode = {
|
|
1835
203
|
$flags$: 0,
|
|
1836
204
|
$tag$: tag,
|
|
1837
|
-
|
|
205
|
+
// Normalize undefined to null to prevent rendering "undefined" as text
|
|
206
|
+
$text$: text != null ? text : null,
|
|
1838
207
|
$elm$: null,
|
|
1839
208
|
$children$: null
|
|
1840
209
|
};
|
|
@@ -1851,18 +220,6 @@ var newVNode = (tag, text) => {
|
|
|
1851
220
|
};
|
|
1852
221
|
var Host = {};
|
|
1853
222
|
var isHost = (node) => node && node.$tag$ === Host;
|
|
1854
|
-
var createSupportsRuleRe = (selector) => {
|
|
1855
|
-
const safeSelector2 = escapeRegExpSpecialCharacters(selector);
|
|
1856
|
-
return new RegExp(
|
|
1857
|
-
// First capture group: match any context before the selector that's not inside @supports selector()
|
|
1858
|
-
// Using negative lookahead to avoid matching inside @supports selector(...) condition
|
|
1859
|
-
`(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
|
|
1860
|
-
"g"
|
|
1861
|
-
);
|
|
1862
|
-
};
|
|
1863
|
-
createSupportsRuleRe("::slotted");
|
|
1864
|
-
createSupportsRuleRe(":host");
|
|
1865
|
-
createSupportsRuleRe(":host-context");
|
|
1866
223
|
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
1867
224
|
if (oldValue === newValue) {
|
|
1868
225
|
return;
|
|
@@ -1900,7 +257,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
1900
257
|
}
|
|
1901
258
|
} else if (memberName === "key") ; else if (memberName === "ref") {
|
|
1902
259
|
if (newValue) {
|
|
1903
|
-
newValue
|
|
260
|
+
queueRefAttachment(newValue, elm);
|
|
1904
261
|
}
|
|
1905
262
|
} else if ((!elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
|
|
1906
263
|
if (memberName[2] === "-") {
|
|
@@ -1920,6 +277,36 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
1920
277
|
plt.ael(elm, memberName, newValue, capture);
|
|
1921
278
|
}
|
|
1922
279
|
}
|
|
280
|
+
} else if (memberName[0] === "a" && memberName.startsWith("attr:")) {
|
|
281
|
+
const propName = memberName.slice(5);
|
|
282
|
+
let attrName;
|
|
283
|
+
{
|
|
284
|
+
const hostRef = getHostRef(elm);
|
|
285
|
+
if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {
|
|
286
|
+
const memberMeta = hostRef.$cmpMeta$.$members$[propName];
|
|
287
|
+
if (memberMeta && memberMeta[1]) {
|
|
288
|
+
attrName = memberMeta[1];
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (!attrName) {
|
|
293
|
+
attrName = propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
294
|
+
}
|
|
295
|
+
if (newValue == null || newValue === false) {
|
|
296
|
+
if (newValue !== false || elm.getAttribute(attrName) === "") {
|
|
297
|
+
elm.removeAttribute(attrName);
|
|
298
|
+
}
|
|
299
|
+
} else {
|
|
300
|
+
elm.setAttribute(attrName, newValue === true ? "" : newValue);
|
|
301
|
+
}
|
|
302
|
+
return;
|
|
303
|
+
} else if (memberName[0] === "p" && memberName.startsWith("prop:")) {
|
|
304
|
+
const propName = memberName.slice(5);
|
|
305
|
+
try {
|
|
306
|
+
elm[propName] = newValue;
|
|
307
|
+
} catch (e) {
|
|
308
|
+
}
|
|
309
|
+
return;
|
|
1923
310
|
} else {
|
|
1924
311
|
const isComplex = isComplexType(newValue);
|
|
1925
312
|
if ((isProp || isComplex && newValue !== null) && !isSvg) {
|
|
@@ -1928,7 +315,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
1928
315
|
const n = newValue == null ? "" : newValue;
|
|
1929
316
|
if (memberName === "list") {
|
|
1930
317
|
isProp = false;
|
|
1931
|
-
} else if (oldValue == null || elm[memberName]
|
|
318
|
+
} else if (oldValue == null || elm[memberName] !== n) {
|
|
1932
319
|
if (typeof elm.__lookupSetter__(memberName) === "function") {
|
|
1933
320
|
elm[memberName] = n;
|
|
1934
321
|
} else {
|
|
@@ -2025,6 +412,8 @@ var useNativeShadowDom = false;
|
|
|
2025
412
|
var checkSlotFallbackVisibility = false;
|
|
2026
413
|
var checkSlotRelocate = false;
|
|
2027
414
|
var isSvgMode = false;
|
|
415
|
+
var refCallbacksToRemove = [];
|
|
416
|
+
var refCallbacksToAttach = [];
|
|
2028
417
|
var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
2029
418
|
var _a;
|
|
2030
419
|
const newVNode2 = newParentVNode.$children$[childIndex];
|
|
@@ -2047,7 +436,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2047
436
|
);
|
|
2048
437
|
}
|
|
2049
438
|
}
|
|
2050
|
-
if (newVNode2.$text$
|
|
439
|
+
if (newVNode2.$text$ != null) {
|
|
2051
440
|
elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
|
|
2052
441
|
} else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
|
|
2053
442
|
elm = newVNode2.$elm$ = win.document.createTextNode("");
|
|
@@ -2059,9 +448,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2059
448
|
isSvgMode = newVNode2.$tag$ === "svg";
|
|
2060
449
|
}
|
|
2061
450
|
if (!win.document) {
|
|
2062
|
-
throw new Error(
|
|
2063
|
-
"You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
|
|
2064
|
-
);
|
|
451
|
+
throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
|
|
2065
452
|
}
|
|
2066
453
|
elm = newVNode2.$elm$ = win.document.createElementNS(
|
|
2067
454
|
isSvgMode ? SVG_NS : HTML_NS,
|
|
@@ -2103,9 +490,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2103
490
|
patchSlotNode(elm);
|
|
2104
491
|
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
2105
492
|
if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
|
|
2106
|
-
|
|
2107
|
-
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
2108
|
-
}
|
|
493
|
+
relocateToHostRoot(oldParentVNode.$elm$);
|
|
2109
494
|
}
|
|
2110
495
|
{
|
|
2111
496
|
addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$);
|
|
@@ -2114,10 +499,37 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
|
2114
499
|
}
|
|
2115
500
|
return elm;
|
|
2116
501
|
};
|
|
502
|
+
var relocateToHostRoot = (parentElm) => {
|
|
503
|
+
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
504
|
+
const host = parentElm.closest(hostTagName.toLowerCase());
|
|
505
|
+
if (host != null) {
|
|
506
|
+
const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
|
|
507
|
+
(ref) => ref["s-cr"]
|
|
508
|
+
);
|
|
509
|
+
const childNodeArray = Array.from(
|
|
510
|
+
parentElm.__childNodes || parentElm.childNodes
|
|
511
|
+
);
|
|
512
|
+
for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
|
|
513
|
+
if (childNode["s-sh"] != null) {
|
|
514
|
+
insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
|
|
515
|
+
childNode["s-sh"] = void 0;
|
|
516
|
+
checkSlotRelocate = true;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
plt.$flags$ &= -2 /* isTmpDisconnected */;
|
|
521
|
+
};
|
|
2117
522
|
var putBackInOriginalLocation = (parentElm, recursive) => {
|
|
2118
523
|
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
2119
524
|
const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
|
|
2120
|
-
if (parentElm["s-sr"]
|
|
525
|
+
if (parentElm["s-sr"]) {
|
|
526
|
+
let node = parentElm;
|
|
527
|
+
while (node = node.nextSibling) {
|
|
528
|
+
if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
|
|
529
|
+
oldSlotChildNodes.push(node);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
2121
533
|
for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
|
|
2122
534
|
const childNode = oldSlotChildNodes[i2];
|
|
2123
535
|
if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
|
|
@@ -2290,11 +702,17 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
2290
702
|
const tag = newVNode2.$tag$;
|
|
2291
703
|
const text = newVNode2.$text$;
|
|
2292
704
|
let defaultHolder;
|
|
2293
|
-
if (text
|
|
705
|
+
if (text == null) {
|
|
2294
706
|
{
|
|
2295
707
|
isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
|
|
2296
708
|
}
|
|
2297
709
|
{
|
|
710
|
+
if (tag === "slot" && !useNativeShadowDom) {
|
|
711
|
+
if (oldVNode.$name$ !== newVNode2.$name$) {
|
|
712
|
+
newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
|
|
713
|
+
relocateToHostRoot(newVNode2.$elm$.parentElement);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
2298
716
|
updateElement(oldVNode, newVNode2, isSvgMode);
|
|
2299
717
|
}
|
|
2300
718
|
if (oldChildren !== null && newChildren !== null) {
|
|
@@ -2331,7 +749,7 @@ var markSlotContentForRelocation = (elm) => {
|
|
|
2331
749
|
const slotName = childNode["s-sn"];
|
|
2332
750
|
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
2333
751
|
node = hostContentNodes[j];
|
|
2334
|
-
if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (
|
|
752
|
+
if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
|
|
2335
753
|
if (isNodeLocatedInSlot(node, slotName)) {
|
|
2336
754
|
let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
2337
755
|
checkSlotFallbackVisibility = true;
|
|
@@ -2371,15 +789,39 @@ var markSlotContentForRelocation = (elm) => {
|
|
|
2371
789
|
};
|
|
2372
790
|
var nullifyVNodeRefs = (vNode) => {
|
|
2373
791
|
{
|
|
2374
|
-
vNode.$attrs$ && vNode.$attrs$.ref
|
|
792
|
+
if (vNode.$attrs$ && vNode.$attrs$.ref) {
|
|
793
|
+
refCallbacksToRemove.push(() => vNode.$attrs$.ref(null));
|
|
794
|
+
}
|
|
2375
795
|
vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
|
|
2376
796
|
}
|
|
2377
797
|
};
|
|
2378
|
-
var
|
|
2379
|
-
|
|
2380
|
-
|
|
798
|
+
var queueRefAttachment = (refCallback, elm) => {
|
|
799
|
+
{
|
|
800
|
+
refCallbacksToAttach.push(() => refCallback(elm));
|
|
2381
801
|
}
|
|
802
|
+
};
|
|
803
|
+
var flushQueuedRefCallbacks = () => {
|
|
2382
804
|
{
|
|
805
|
+
refCallbacksToRemove.forEach((cb) => cb());
|
|
806
|
+
refCallbacksToRemove.length = 0;
|
|
807
|
+
refCallbacksToAttach.forEach((cb) => cb());
|
|
808
|
+
refCallbacksToAttach.length = 0;
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
var insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
812
|
+
{
|
|
813
|
+
if (typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
|
|
814
|
+
addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
|
|
815
|
+
} else if (typeof newNode["s-sn"] === "string") {
|
|
816
|
+
parent.insertBefore(newNode, reference);
|
|
817
|
+
const { slotNode } = findSlotFromSlottedNode(newNode);
|
|
818
|
+
if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
|
|
819
|
+
return newNode;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
if (parent.__insertBefore) {
|
|
823
|
+
return parent.__insertBefore(newNode, reference);
|
|
824
|
+
} else {
|
|
2383
825
|
return parent == null ? void 0 : parent.insertBefore(newNode, reference);
|
|
2384
826
|
}
|
|
2385
827
|
};
|
|
@@ -2451,7 +893,12 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
2451
893
|
if (!nodeToRelocate["s-ol"] && win.document) {
|
|
2452
894
|
const orgLocationNode = win.document.createTextNode("");
|
|
2453
895
|
orgLocationNode["s-nr"] = nodeToRelocate;
|
|
2454
|
-
insertBefore(
|
|
896
|
+
insertBefore(
|
|
897
|
+
nodeToRelocate.parentNode,
|
|
898
|
+
nodeToRelocate["s-ol"] = orgLocationNode,
|
|
899
|
+
nodeToRelocate,
|
|
900
|
+
isInitialLoad
|
|
901
|
+
);
|
|
2455
902
|
}
|
|
2456
903
|
}
|
|
2457
904
|
for (const relocateData of relocateNodes) {
|
|
@@ -2463,7 +910,7 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
2463
910
|
if (slotRefNode) {
|
|
2464
911
|
const parentNodeRef = slotRefNode.parentNode;
|
|
2465
912
|
let insertBeforeNode = slotRefNode.nextSibling;
|
|
2466
|
-
{
|
|
913
|
+
if (insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */) {
|
|
2467
914
|
let orgLocationNode = (_b = nodeToRelocate["s-ol"]) == null ? void 0 : _b.previousSibling;
|
|
2468
915
|
while (orgLocationNode) {
|
|
2469
916
|
let refNode = (_c = orgLocationNode["s-nr"]) != null ? _c : null;
|
|
@@ -2484,10 +931,18 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
2484
931
|
const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling;
|
|
2485
932
|
if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) {
|
|
2486
933
|
if (nodeToRelocate !== insertBeforeNode) {
|
|
2487
|
-
|
|
2488
|
-
|
|
934
|
+
insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode, isInitialLoad);
|
|
935
|
+
if (nodeToRelocate.nodeType === 8 /* CommentNode */ && nodeToRelocate.nodeValue.startsWith("s-nt-")) {
|
|
936
|
+
const textNode = win.document.createTextNode(nodeToRelocate.nodeValue.replace(/^s-nt-/, ""));
|
|
937
|
+
textNode["s-hn"] = nodeToRelocate["s-hn"];
|
|
938
|
+
textNode["s-sn"] = nodeToRelocate["s-sn"];
|
|
939
|
+
textNode["s-sh"] = nodeToRelocate["s-sh"];
|
|
940
|
+
textNode["s-sr"] = nodeToRelocate["s-sr"];
|
|
941
|
+
textNode["s-ol"] = nodeToRelocate["s-ol"];
|
|
942
|
+
textNode["s-ol"]["s-nr"] = textNode;
|
|
943
|
+
insertBefore(nodeToRelocate.parentNode, textNode, nodeToRelocate, isInitialLoad);
|
|
944
|
+
nodeToRelocate.parentNode.removeChild(nodeToRelocate);
|
|
2489
945
|
}
|
|
2490
|
-
insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
|
|
2491
946
|
if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
|
|
2492
947
|
nodeToRelocate.hidden = (_d = nodeToRelocate["s-ih"]) != null ? _d : false;
|
|
2493
948
|
}
|
|
@@ -2505,18 +960,26 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
2505
960
|
plt.$flags$ &= -2 /* isTmpDisconnected */;
|
|
2506
961
|
relocateNodes.length = 0;
|
|
2507
962
|
}
|
|
2508
|
-
if (
|
|
963
|
+
if (!useNativeShadowDom && !(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && hostElm["s-cr"]) {
|
|
2509
964
|
const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
|
|
2510
965
|
for (const childNode of children) {
|
|
2511
|
-
if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]
|
|
966
|
+
if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
|
|
2512
967
|
if (isInitialLoad && childNode["s-ih"] == null) {
|
|
2513
968
|
childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
|
|
2514
969
|
}
|
|
2515
|
-
childNode.
|
|
970
|
+
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
971
|
+
childNode.hidden = true;
|
|
972
|
+
} else if (childNode.nodeType === 3 /* TextNode */ && !!childNode.nodeValue.trim()) {
|
|
973
|
+
const textCommentNode = win.document.createComment("s-nt-" + childNode.nodeValue);
|
|
974
|
+
textCommentNode["s-sn"] = childNode["s-sn"];
|
|
975
|
+
insertBefore(childNode.parentNode, textCommentNode, childNode, isInitialLoad);
|
|
976
|
+
childNode.parentNode.removeChild(childNode);
|
|
977
|
+
}
|
|
2516
978
|
}
|
|
2517
979
|
}
|
|
2518
980
|
}
|
|
2519
981
|
contentRef = void 0;
|
|
982
|
+
flushQueuedRefCallbacks();
|
|
2520
983
|
};
|
|
2521
984
|
|
|
2522
985
|
/**
|
|
@@ -3302,7 +1765,7 @@ const enqueue = (html) => {
|
|
|
3302
1765
|
*
|
|
3303
1766
|
* @returns {string}
|
|
3304
1767
|
*/
|
|
3305
|
-
const process
|
|
1768
|
+
const process = () => {
|
|
3306
1769
|
const { config, constants } = getState();
|
|
3307
1770
|
const step = " ".repeat(config.tab_size);
|
|
3308
1771
|
const tag_wrap = config.tag_wrap;
|
|
@@ -3519,7 +1982,7 @@ const prettify = (html, config) => {
|
|
|
3519
1982
|
|
|
3520
1983
|
html = minify(html);
|
|
3521
1984
|
enqueue(html);
|
|
3522
|
-
html = process
|
|
1985
|
+
html = process();
|
|
3523
1986
|
|
|
3524
1987
|
/* Revert html text within attribute values. */
|
|
3525
1988
|
html = unsetIgnoreAttribute(html);
|