@stencil/core 4.39.0 → 4.40.1-dev.1766552834.64f6089
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/index.cjs +1616 -41
- package/cli/index.js +1616 -41
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +2791 -2515
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +1665 -90
- package/internal/app-data/index.cjs +1 -0
- package/internal/app-data/index.js +1 -0
- package/internal/app-data/package.json +1 -1
- package/internal/app-globals/package.json +1 -1
- package/internal/client/index.js +1746 -105
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/hydrate/index.js +1770 -133
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +1794 -104
- package/internal/package.json +1 -1
- package/internal/stencil-private.d.ts +25 -2
- package/internal/stencil-public-compiler.d.ts +33 -3
- package/internal/stencil-public-runtime.d.ts +14 -3
- package/internal/testing/index.js +1758 -133
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +8 -1
- package/mock-doc/index.js +8 -1
- package/mock-doc/package.json +1 -1
- package/package.json +1 -1
- package/screenshot/index.js +1608 -30
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +1 -1
- package/sys/node/index.js +28 -28
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +1696 -109
- package/testing/package.json +1 -1
package/testing/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Testing v4.
|
|
2
|
+
Stencil Testing v4.40.1-dev.1766552834.64f6089 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
@@ -25,6 +25,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
25
25
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
26
26
|
var __getProtoOf = Object.getPrototypeOf;
|
|
27
27
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
28
|
+
var __typeError = (msg) => {
|
|
29
|
+
throw TypeError(msg);
|
|
30
|
+
};
|
|
31
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
28
32
|
var __commonJS = (cb, mod) => function __require() {
|
|
29
33
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
30
34
|
};
|
|
@@ -49,6 +53,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
49
53
|
mod
|
|
50
54
|
));
|
|
51
55
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
56
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
57
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
58
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
59
|
+
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);
|
|
60
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
61
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
52
62
|
|
|
53
63
|
// node_modules/semver/internal/debug.js
|
|
54
64
|
var require_debug = __commonJS({
|
|
@@ -393,8 +403,8 @@ var require_semver = __commonJS({
|
|
|
393
403
|
throw new Error("invalid increment argument: identifier is empty");
|
|
394
404
|
}
|
|
395
405
|
if (identifier) {
|
|
396
|
-
const
|
|
397
|
-
if (!
|
|
406
|
+
const match2 = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
407
|
+
if (!match2 || match2[1] !== identifier) {
|
|
398
408
|
throw new Error(`invalid identifier: ${identifier}`);
|
|
399
409
|
}
|
|
400
410
|
}
|
|
@@ -513,6 +523,214 @@ var require_major = __commonJS({
|
|
|
513
523
|
}
|
|
514
524
|
});
|
|
515
525
|
|
|
526
|
+
// node_modules/balanced-match/index.js
|
|
527
|
+
var require_balanced_match = __commonJS({
|
|
528
|
+
"node_modules/balanced-match/index.js"(exports2, module2) {
|
|
529
|
+
"use strict";
|
|
530
|
+
module2.exports = balanced;
|
|
531
|
+
function balanced(a, b, str) {
|
|
532
|
+
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
533
|
+
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
534
|
+
var r = range(a, b, str);
|
|
535
|
+
return r && {
|
|
536
|
+
start: r[0],
|
|
537
|
+
end: r[1],
|
|
538
|
+
pre: str.slice(0, r[0]),
|
|
539
|
+
body: str.slice(r[0] + a.length, r[1]),
|
|
540
|
+
post: str.slice(r[1] + b.length)
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
function maybeMatch(reg, str) {
|
|
544
|
+
var m = str.match(reg);
|
|
545
|
+
return m ? m[0] : null;
|
|
546
|
+
}
|
|
547
|
+
balanced.range = range;
|
|
548
|
+
function range(a, b, str) {
|
|
549
|
+
var begs, beg, left, right, result2;
|
|
550
|
+
var ai = str.indexOf(a);
|
|
551
|
+
var bi = str.indexOf(b, ai + 1);
|
|
552
|
+
var i = ai;
|
|
553
|
+
if (ai >= 0 && bi > 0) {
|
|
554
|
+
if (a === b) {
|
|
555
|
+
return [ai, bi];
|
|
556
|
+
}
|
|
557
|
+
begs = [];
|
|
558
|
+
left = str.length;
|
|
559
|
+
while (i >= 0 && !result2) {
|
|
560
|
+
if (i == ai) {
|
|
561
|
+
begs.push(i);
|
|
562
|
+
ai = str.indexOf(a, i + 1);
|
|
563
|
+
} else if (begs.length == 1) {
|
|
564
|
+
result2 = [begs.pop(), bi];
|
|
565
|
+
} else {
|
|
566
|
+
beg = begs.pop();
|
|
567
|
+
if (beg < left) {
|
|
568
|
+
left = beg;
|
|
569
|
+
right = bi;
|
|
570
|
+
}
|
|
571
|
+
bi = str.indexOf(b, i + 1);
|
|
572
|
+
}
|
|
573
|
+
i = ai < bi && ai >= 0 ? ai : bi;
|
|
574
|
+
}
|
|
575
|
+
if (begs.length) {
|
|
576
|
+
result2 = [left, right];
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
return result2;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
// node_modules/brace-expansion/index.js
|
|
585
|
+
var require_brace_expansion = __commonJS({
|
|
586
|
+
"node_modules/brace-expansion/index.js"(exports2, module2) {
|
|
587
|
+
var balanced = require_balanced_match();
|
|
588
|
+
module2.exports = expandTop;
|
|
589
|
+
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
590
|
+
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
591
|
+
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
592
|
+
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
593
|
+
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
594
|
+
function numeric(str) {
|
|
595
|
+
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
596
|
+
}
|
|
597
|
+
function escapeBraces(str) {
|
|
598
|
+
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
599
|
+
}
|
|
600
|
+
function unescapeBraces(str) {
|
|
601
|
+
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
602
|
+
}
|
|
603
|
+
function parseCommaParts(str) {
|
|
604
|
+
if (!str)
|
|
605
|
+
return [""];
|
|
606
|
+
var parts = [];
|
|
607
|
+
var m = balanced("{", "}", str);
|
|
608
|
+
if (!m)
|
|
609
|
+
return str.split(",");
|
|
610
|
+
var pre = m.pre;
|
|
611
|
+
var body = m.body;
|
|
612
|
+
var post = m.post;
|
|
613
|
+
var p = pre.split(",");
|
|
614
|
+
p[p.length - 1] += "{" + body + "}";
|
|
615
|
+
var postParts = parseCommaParts(post);
|
|
616
|
+
if (post.length) {
|
|
617
|
+
p[p.length - 1] += postParts.shift();
|
|
618
|
+
p.push.apply(p, postParts);
|
|
619
|
+
}
|
|
620
|
+
parts.push.apply(parts, p);
|
|
621
|
+
return parts;
|
|
622
|
+
}
|
|
623
|
+
function expandTop(str) {
|
|
624
|
+
if (!str)
|
|
625
|
+
return [];
|
|
626
|
+
if (str.substr(0, 2) === "{}") {
|
|
627
|
+
str = "\\{\\}" + str.substr(2);
|
|
628
|
+
}
|
|
629
|
+
return expand2(escapeBraces(str), true).map(unescapeBraces);
|
|
630
|
+
}
|
|
631
|
+
function embrace(str) {
|
|
632
|
+
return "{" + str + "}";
|
|
633
|
+
}
|
|
634
|
+
function isPadded(el) {
|
|
635
|
+
return /^-?0\d/.test(el);
|
|
636
|
+
}
|
|
637
|
+
function lte(i, y) {
|
|
638
|
+
return i <= y;
|
|
639
|
+
}
|
|
640
|
+
function gte(i, y) {
|
|
641
|
+
return i >= y;
|
|
642
|
+
}
|
|
643
|
+
function expand2(str, isTop) {
|
|
644
|
+
var expansions = [];
|
|
645
|
+
var m = balanced("{", "}", str);
|
|
646
|
+
if (!m) return [str];
|
|
647
|
+
var pre = m.pre;
|
|
648
|
+
var post = m.post.length ? expand2(m.post, false) : [""];
|
|
649
|
+
if (/\$$/.test(m.pre)) {
|
|
650
|
+
for (var k = 0; k < post.length; k++) {
|
|
651
|
+
var expansion = pre + "{" + m.body + "}" + post[k];
|
|
652
|
+
expansions.push(expansion);
|
|
653
|
+
}
|
|
654
|
+
} else {
|
|
655
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
656
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
657
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
|
658
|
+
var isOptions = m.body.indexOf(",") >= 0;
|
|
659
|
+
if (!isSequence && !isOptions) {
|
|
660
|
+
if (m.post.match(/,(?!,).*\}/)) {
|
|
661
|
+
str = m.pre + "{" + m.body + escClose + m.post;
|
|
662
|
+
return expand2(str);
|
|
663
|
+
}
|
|
664
|
+
return [str];
|
|
665
|
+
}
|
|
666
|
+
var n;
|
|
667
|
+
if (isSequence) {
|
|
668
|
+
n = m.body.split(/\.\./);
|
|
669
|
+
} else {
|
|
670
|
+
n = parseCommaParts(m.body);
|
|
671
|
+
if (n.length === 1) {
|
|
672
|
+
n = expand2(n[0], false).map(embrace);
|
|
673
|
+
if (n.length === 1) {
|
|
674
|
+
return post.map(function(p) {
|
|
675
|
+
return m.pre + n[0] + p;
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
var N;
|
|
681
|
+
if (isSequence) {
|
|
682
|
+
var x = numeric(n[0]);
|
|
683
|
+
var y = numeric(n[1]);
|
|
684
|
+
var width = Math.max(n[0].length, n[1].length);
|
|
685
|
+
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
|
|
686
|
+
var test4 = lte;
|
|
687
|
+
var reverse = y < x;
|
|
688
|
+
if (reverse) {
|
|
689
|
+
incr *= -1;
|
|
690
|
+
test4 = gte;
|
|
691
|
+
}
|
|
692
|
+
var pad = n.some(isPadded);
|
|
693
|
+
N = [];
|
|
694
|
+
for (var i = x; test4(i, y); i += incr) {
|
|
695
|
+
var c;
|
|
696
|
+
if (isAlphaSequence) {
|
|
697
|
+
c = String.fromCharCode(i);
|
|
698
|
+
if (c === "\\")
|
|
699
|
+
c = "";
|
|
700
|
+
} else {
|
|
701
|
+
c = String(i);
|
|
702
|
+
if (pad) {
|
|
703
|
+
var need = width - c.length;
|
|
704
|
+
if (need > 0) {
|
|
705
|
+
var z = new Array(need + 1).join("0");
|
|
706
|
+
if (i < 0)
|
|
707
|
+
c = "-" + z + c.slice(1);
|
|
708
|
+
else
|
|
709
|
+
c = z + c;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
N.push(c);
|
|
714
|
+
}
|
|
715
|
+
} else {
|
|
716
|
+
N = [];
|
|
717
|
+
for (var j = 0; j < n.length; j++) {
|
|
718
|
+
N.push.apply(N, expand2(n[j], false));
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
for (var j = 0; j < N.length; j++) {
|
|
722
|
+
for (var k = 0; k < post.length; k++) {
|
|
723
|
+
var expansion = pre + N[j] + post[k];
|
|
724
|
+
if (!isTop || isSequence || expansion)
|
|
725
|
+
expansions.push(expansion);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
return expansions;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
|
|
516
734
|
// node_modules/resolve/lib/homedir.js
|
|
517
735
|
var require_homedir = __commonJS({
|
|
518
736
|
"node_modules/resolve/lib/homedir.js"(exports2, module2) {
|
|
@@ -613,8 +831,8 @@ var require_path_parse = __commonJS({
|
|
|
613
831
|
// node_modules/resolve/lib/node-modules-paths.js
|
|
614
832
|
var require_node_modules_paths = __commonJS({
|
|
615
833
|
"node_modules/resolve/lib/node-modules-paths.js"(exports2, module2) {
|
|
616
|
-
var
|
|
617
|
-
var parse =
|
|
834
|
+
var path7 = require("path");
|
|
835
|
+
var parse = path7.parse || require_path_parse();
|
|
618
836
|
var getNodeModulesDirs = function getNodeModulesDirs2(absoluteStart, modules) {
|
|
619
837
|
var prefix = "/";
|
|
620
838
|
if (/^([A-Za-z]:)/.test(absoluteStart)) {
|
|
@@ -630,7 +848,7 @@ var require_node_modules_paths = __commonJS({
|
|
|
630
848
|
}
|
|
631
849
|
return paths.reduce(function(dirs, aPath) {
|
|
632
850
|
return dirs.concat(modules.map(function(moduleDir) {
|
|
633
|
-
return
|
|
851
|
+
return path7.resolve(prefix, aPath, moduleDir);
|
|
634
852
|
}));
|
|
635
853
|
}, []);
|
|
636
854
|
};
|
|
@@ -993,7 +1211,7 @@ var require_async = __commonJS({
|
|
|
993
1211
|
"node_modules/resolve/lib/async.js"(exports2, module2) {
|
|
994
1212
|
var fs2 = require("fs");
|
|
995
1213
|
var getHomedir = require_homedir();
|
|
996
|
-
var
|
|
1214
|
+
var path7 = require("path");
|
|
997
1215
|
var caller = require_caller();
|
|
998
1216
|
var nodeModulesPaths = require_node_modules_paths();
|
|
999
1217
|
var normalizeOptions = require_normalize_options();
|
|
@@ -1002,8 +1220,8 @@ var require_async = __commonJS({
|
|
|
1002
1220
|
var homedir2 = getHomedir();
|
|
1003
1221
|
var defaultPaths = function() {
|
|
1004
1222
|
return [
|
|
1005
|
-
|
|
1006
|
-
|
|
1223
|
+
path7.join(homedir2, ".node_modules"),
|
|
1224
|
+
path7.join(homedir2, ".node_libraries")
|
|
1007
1225
|
];
|
|
1008
1226
|
};
|
|
1009
1227
|
var defaultIsFile = function isFile(file, cb) {
|
|
@@ -1053,7 +1271,7 @@ var require_async = __commonJS({
|
|
|
1053
1271
|
var getPackageCandidates = function getPackageCandidates2(x, start2, opts) {
|
|
1054
1272
|
var dirs = nodeModulesPaths(start2, opts, x);
|
|
1055
1273
|
for (var i = 0; i < dirs.length; i++) {
|
|
1056
|
-
dirs[i] =
|
|
1274
|
+
dirs[i] = path7.join(dirs[i], x);
|
|
1057
1275
|
}
|
|
1058
1276
|
return dirs;
|
|
1059
1277
|
};
|
|
@@ -1085,10 +1303,10 @@ var require_async = __commonJS({
|
|
|
1085
1303
|
var packageIterator = opts.packageIterator;
|
|
1086
1304
|
var extensions = opts.extensions || [".js"];
|
|
1087
1305
|
var includeCoreModules = opts.includeCoreModules !== false;
|
|
1088
|
-
var basedir = opts.basedir ||
|
|
1306
|
+
var basedir = opts.basedir || path7.dirname(caller());
|
|
1089
1307
|
var parent = opts.filename || basedir;
|
|
1090
1308
|
opts.paths = opts.paths || defaultPaths();
|
|
1091
|
-
var absoluteStart =
|
|
1309
|
+
var absoluteStart = path7.resolve(basedir);
|
|
1092
1310
|
maybeRealpath(
|
|
1093
1311
|
realpath,
|
|
1094
1312
|
absoluteStart,
|
|
@@ -1101,7 +1319,7 @@ var require_async = __commonJS({
|
|
|
1101
1319
|
var res;
|
|
1102
1320
|
function init(basedir2) {
|
|
1103
1321
|
if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
|
|
1104
|
-
res =
|
|
1322
|
+
res = path7.resolve(basedir2, x);
|
|
1105
1323
|
if (x === "." || x === ".." || x.slice(-1) === "/") res += "/";
|
|
1106
1324
|
if (/\/$/.test(x) && res === basedir2) {
|
|
1107
1325
|
loadAsDirectory(res, opts.package, onfile);
|
|
@@ -1159,17 +1377,17 @@ var require_async = __commonJS({
|
|
|
1159
1377
|
var file = x3 + exts2[0];
|
|
1160
1378
|
var pkg = loadPackage;
|
|
1161
1379
|
if (pkg) onpkg(null, pkg);
|
|
1162
|
-
else loadpkg(
|
|
1380
|
+
else loadpkg(path7.dirname(file), onpkg);
|
|
1163
1381
|
function onpkg(err3, pkg_, dir) {
|
|
1164
1382
|
pkg = pkg_;
|
|
1165
1383
|
if (err3) return cb2(err3);
|
|
1166
1384
|
if (dir && pkg && opts.pathFilter) {
|
|
1167
|
-
var rfile =
|
|
1385
|
+
var rfile = path7.relative(dir, file);
|
|
1168
1386
|
var rel = rfile.slice(0, rfile.length - exts2[0].length);
|
|
1169
1387
|
var r = opts.pathFilter(pkg, x3, rel);
|
|
1170
1388
|
if (r) return load(
|
|
1171
1389
|
[""].concat(extensions.slice()),
|
|
1172
|
-
|
|
1390
|
+
path7.resolve(dir, r),
|
|
1173
1391
|
pkg
|
|
1174
1392
|
);
|
|
1175
1393
|
}
|
|
@@ -1189,10 +1407,10 @@ var require_async = __commonJS({
|
|
|
1189
1407
|
}
|
|
1190
1408
|
if (/[/\\]node_modules[/\\]*$/.test(dir)) return cb2(null);
|
|
1191
1409
|
maybeRealpath(realpath, dir, opts, function(unwrapErr2, pkgdir) {
|
|
1192
|
-
if (unwrapErr2) return loadpkg(
|
|
1193
|
-
var pkgfile =
|
|
1410
|
+
if (unwrapErr2) return loadpkg(path7.dirname(dir), cb2);
|
|
1411
|
+
var pkgfile = path7.join(pkgdir, "package.json");
|
|
1194
1412
|
isFile(pkgfile, function(err3, ex) {
|
|
1195
|
-
if (!ex) return loadpkg(
|
|
1413
|
+
if (!ex) return loadpkg(path7.dirname(dir), cb2);
|
|
1196
1414
|
readPackage(readFile, pkgfile, function(err4, pkgParam) {
|
|
1197
1415
|
if (err4) cb2(err4);
|
|
1198
1416
|
var pkg = pkgParam;
|
|
@@ -1213,10 +1431,10 @@ var require_async = __commonJS({
|
|
|
1213
1431
|
}
|
|
1214
1432
|
maybeRealpath(realpath, x2, opts, function(unwrapErr2, pkgdir) {
|
|
1215
1433
|
if (unwrapErr2) return cb2(unwrapErr2);
|
|
1216
|
-
var pkgfile =
|
|
1434
|
+
var pkgfile = path7.join(pkgdir, "package.json");
|
|
1217
1435
|
isFile(pkgfile, function(err3, ex) {
|
|
1218
1436
|
if (err3) return cb2(err3);
|
|
1219
|
-
if (!ex) return loadAsFile(
|
|
1437
|
+
if (!ex) return loadAsFile(path7.join(x2, "index"), fpkg, cb2);
|
|
1220
1438
|
readPackage(readFile, pkgfile, function(err4, pkgParam) {
|
|
1221
1439
|
if (err4) return cb2(err4);
|
|
1222
1440
|
var pkg = pkgParam;
|
|
@@ -1232,20 +1450,20 @@ var require_async = __commonJS({
|
|
|
1232
1450
|
if (pkg.main === "." || pkg.main === "./") {
|
|
1233
1451
|
pkg.main = "index";
|
|
1234
1452
|
}
|
|
1235
|
-
loadAsFile(
|
|
1453
|
+
loadAsFile(path7.resolve(x2, pkg.main), pkg, function(err5, m, pkg2) {
|
|
1236
1454
|
if (err5) return cb2(err5);
|
|
1237
1455
|
if (m) return cb2(null, m, pkg2);
|
|
1238
|
-
if (!pkg2) return loadAsFile(
|
|
1239
|
-
var dir =
|
|
1456
|
+
if (!pkg2) return loadAsFile(path7.join(x2, "index"), pkg2, cb2);
|
|
1457
|
+
var dir = path7.resolve(x2, pkg2.main);
|
|
1240
1458
|
loadAsDirectory(dir, pkg2, function(err6, n, pkg3) {
|
|
1241
1459
|
if (err6) return cb2(err6);
|
|
1242
1460
|
if (n) return cb2(null, n, pkg3);
|
|
1243
|
-
loadAsFile(
|
|
1461
|
+
loadAsFile(path7.join(x2, "index"), pkg3, cb2);
|
|
1244
1462
|
});
|
|
1245
1463
|
});
|
|
1246
1464
|
return;
|
|
1247
1465
|
}
|
|
1248
|
-
loadAsFile(
|
|
1466
|
+
loadAsFile(path7.join(x2, "/index"), pkg, cb2);
|
|
1249
1467
|
});
|
|
1250
1468
|
});
|
|
1251
1469
|
});
|
|
@@ -1253,7 +1471,7 @@ var require_async = __commonJS({
|
|
|
1253
1471
|
function processDirs(cb2, dirs) {
|
|
1254
1472
|
if (dirs.length === 0) return cb2(null, void 0);
|
|
1255
1473
|
var dir = dirs[0];
|
|
1256
|
-
isDirectory(
|
|
1474
|
+
isDirectory(path7.dirname(dir), isdir);
|
|
1257
1475
|
function isdir(err3, isdir2) {
|
|
1258
1476
|
if (err3) return cb2(err3);
|
|
1259
1477
|
if (!isdir2) return processDirs(cb2, dirs.slice(1));
|
|
@@ -1483,7 +1701,7 @@ var require_sync = __commonJS({
|
|
|
1483
1701
|
"node_modules/resolve/lib/sync.js"(exports2, module2) {
|
|
1484
1702
|
var isCore = require_is_core_module();
|
|
1485
1703
|
var fs2 = require("fs");
|
|
1486
|
-
var
|
|
1704
|
+
var path7 = require("path");
|
|
1487
1705
|
var getHomedir = require_homedir();
|
|
1488
1706
|
var caller = require_caller();
|
|
1489
1707
|
var nodeModulesPaths = require_node_modules_paths();
|
|
@@ -1492,8 +1710,8 @@ var require_sync = __commonJS({
|
|
|
1492
1710
|
var homedir2 = getHomedir();
|
|
1493
1711
|
var defaultPaths = function() {
|
|
1494
1712
|
return [
|
|
1495
|
-
|
|
1496
|
-
|
|
1713
|
+
path7.join(homedir2, ".node_modules"),
|
|
1714
|
+
path7.join(homedir2, ".node_libraries")
|
|
1497
1715
|
];
|
|
1498
1716
|
};
|
|
1499
1717
|
var defaultIsFile = function isFile(file) {
|
|
@@ -1541,7 +1759,7 @@ var require_sync = __commonJS({
|
|
|
1541
1759
|
var getPackageCandidates = function getPackageCandidates2(x, start2, opts) {
|
|
1542
1760
|
var dirs = nodeModulesPaths(start2, opts, x);
|
|
1543
1761
|
for (var i = 0; i < dirs.length; i++) {
|
|
1544
|
-
dirs[i] =
|
|
1762
|
+
dirs[i] = path7.join(dirs[i], x);
|
|
1545
1763
|
}
|
|
1546
1764
|
return dirs;
|
|
1547
1765
|
};
|
|
@@ -1561,12 +1779,12 @@ var require_sync = __commonJS({
|
|
|
1561
1779
|
var packageIterator = opts.packageIterator;
|
|
1562
1780
|
var extensions = opts.extensions || [".js"];
|
|
1563
1781
|
var includeCoreModules = opts.includeCoreModules !== false;
|
|
1564
|
-
var basedir = opts.basedir ||
|
|
1782
|
+
var basedir = opts.basedir || path7.dirname(caller());
|
|
1565
1783
|
var parent = opts.filename || basedir;
|
|
1566
1784
|
opts.paths = opts.paths || defaultPaths();
|
|
1567
|
-
var absoluteStart = maybeRealpathSync(realpathSync,
|
|
1785
|
+
var absoluteStart = maybeRealpathSync(realpathSync, path7.resolve(basedir), opts);
|
|
1568
1786
|
if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
|
|
1569
|
-
var res =
|
|
1787
|
+
var res = path7.resolve(absoluteStart, x);
|
|
1570
1788
|
if (x === "." || x === ".." || x.slice(-1) === "/") res += "/";
|
|
1571
1789
|
var m = loadAsFileSync(res) || loadAsDirectorySync(res);
|
|
1572
1790
|
if (m) return maybeRealpathSync(realpathSync, m, opts);
|
|
@@ -1580,12 +1798,12 @@ var require_sync = __commonJS({
|
|
|
1580
1798
|
err2.code = "MODULE_NOT_FOUND";
|
|
1581
1799
|
throw err2;
|
|
1582
1800
|
function loadAsFileSync(x2) {
|
|
1583
|
-
var pkg = loadpkg(
|
|
1801
|
+
var pkg = loadpkg(path7.dirname(x2));
|
|
1584
1802
|
if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
|
|
1585
|
-
var rfile =
|
|
1803
|
+
var rfile = path7.relative(pkg.dir, x2);
|
|
1586
1804
|
var r = opts.pathFilter(pkg.pkg, x2, rfile);
|
|
1587
1805
|
if (r) {
|
|
1588
|
-
x2 =
|
|
1806
|
+
x2 = path7.resolve(pkg.dir, r);
|
|
1589
1807
|
}
|
|
1590
1808
|
}
|
|
1591
1809
|
if (isFile(x2)) {
|
|
@@ -1604,9 +1822,9 @@ var require_sync = __commonJS({
|
|
|
1604
1822
|
return;
|
|
1605
1823
|
}
|
|
1606
1824
|
if (/[/\\]node_modules[/\\]*$/.test(dir)) return;
|
|
1607
|
-
var pkgfile =
|
|
1825
|
+
var pkgfile = path7.join(maybeRealpathSync(realpathSync, dir, opts), "package.json");
|
|
1608
1826
|
if (!isFile(pkgfile)) {
|
|
1609
|
-
return loadpkg(
|
|
1827
|
+
return loadpkg(path7.dirname(dir));
|
|
1610
1828
|
}
|
|
1611
1829
|
var pkg = readPackageSync(readFileSync, pkgfile);
|
|
1612
1830
|
if (pkg && opts.packageFilter) {
|
|
@@ -1619,7 +1837,7 @@ var require_sync = __commonJS({
|
|
|
1619
1837
|
return { pkg, dir };
|
|
1620
1838
|
}
|
|
1621
1839
|
function loadAsDirectorySync(x2) {
|
|
1622
|
-
var pkgfile =
|
|
1840
|
+
var pkgfile = path7.join(maybeRealpathSync(realpathSync, x2, opts), "/package.json");
|
|
1623
1841
|
if (isFile(pkgfile)) {
|
|
1624
1842
|
try {
|
|
1625
1843
|
var pkg = readPackageSync(readFileSync, pkgfile);
|
|
@@ -1642,15 +1860,15 @@ var require_sync = __commonJS({
|
|
|
1642
1860
|
pkg.main = "index";
|
|
1643
1861
|
}
|
|
1644
1862
|
try {
|
|
1645
|
-
var m2 = loadAsFileSync(
|
|
1863
|
+
var m2 = loadAsFileSync(path7.resolve(x2, pkg.main));
|
|
1646
1864
|
if (m2) return m2;
|
|
1647
|
-
var n2 = loadAsDirectorySync(
|
|
1865
|
+
var n2 = loadAsDirectorySync(path7.resolve(x2, pkg.main));
|
|
1648
1866
|
if (n2) return n2;
|
|
1649
1867
|
} catch (e) {
|
|
1650
1868
|
}
|
|
1651
1869
|
}
|
|
1652
1870
|
}
|
|
1653
|
-
return loadAsFileSync(
|
|
1871
|
+
return loadAsFileSync(path7.join(x2, "/index"));
|
|
1654
1872
|
}
|
|
1655
1873
|
function loadNodeModulesSync(x2, start2) {
|
|
1656
1874
|
var thunk = function() {
|
|
@@ -1659,7 +1877,7 @@ var require_sync = __commonJS({
|
|
|
1659
1877
|
var dirs = packageIterator ? packageIterator(x2, start2, thunk, opts) : thunk();
|
|
1660
1878
|
for (var i = 0; i < dirs.length; i++) {
|
|
1661
1879
|
var dir = dirs[i];
|
|
1662
|
-
if (isDirectory(
|
|
1880
|
+
if (isDirectory(path7.dirname(dir))) {
|
|
1663
1881
|
var m2 = loadAsFileSync(dir);
|
|
1664
1882
|
if (m2) return m2;
|
|
1665
1883
|
var n2 = loadAsDirectorySync(dir);
|
|
@@ -1776,7 +1994,11 @@ ${e}`);
|
|
|
1776
1994
|
devtools: config.testing.browserDevtools,
|
|
1777
1995
|
...connectOpts
|
|
1778
1996
|
};
|
|
1779
|
-
|
|
1997
|
+
try {
|
|
1998
|
+
launchOpts.executablePath = process.env.PUPPETEER_EXECUTABLE_PATH || process.env.CHROME_PATH || puppeteer.executablePath(launchOpts);
|
|
1999
|
+
} catch (_) {
|
|
2000
|
+
launchOpts.executablePath = puppeteer.executablePath(launchOpts.channel);
|
|
2001
|
+
}
|
|
1780
2002
|
browser = await puppeteer.launch({ ...launchOpts });
|
|
1781
2003
|
}
|
|
1782
2004
|
env2.__STENCIL_BROWSER_WS_ENDPOINT__ = browser.wsEndpoint();
|
|
@@ -1902,6 +2124,9 @@ var formatComponentRuntimeMeta = (compilerMeta, includeMethods) => {
|
|
|
1902
2124
|
if (compilerMeta.shadowDelegatesFocus) {
|
|
1903
2125
|
flags |= 16 /* shadowDelegatesFocus */;
|
|
1904
2126
|
}
|
|
2127
|
+
if (compilerMeta.slotAssignment === "manual") {
|
|
2128
|
+
flags |= 1024 /* shadowSlotAssignmentManual */;
|
|
2129
|
+
}
|
|
1905
2130
|
} else if (compilerMeta.encapsulation === "scoped") {
|
|
1906
2131
|
flags |= 2 /* scopedCssEncapsulation */;
|
|
1907
2132
|
}
|
|
@@ -1911,8 +2136,8 @@ var formatComponentRuntimeMeta = (compilerMeta, includeMethods) => {
|
|
|
1911
2136
|
if (compilerMeta.encapsulation !== "shadow" && compilerMeta.htmlTagNames.includes("slot")) {
|
|
1912
2137
|
flags |= 4 /* hasSlotRelocation */;
|
|
1913
2138
|
}
|
|
1914
|
-
if (compilerMeta.
|
|
1915
|
-
flags |= 256 /*
|
|
2139
|
+
if (compilerMeta.hasSlot) {
|
|
2140
|
+
flags |= 256 /* hasSlot */;
|
|
1916
2141
|
}
|
|
1917
2142
|
if (compilerMeta.hasMode) {
|
|
1918
2143
|
flags |= 32 /* hasMode */;
|
|
@@ -1938,9 +2163,13 @@ var formatComponentRuntimeMeta = (compilerMeta, includeMethods) => {
|
|
|
1938
2163
|
var formatComponentRuntimeReactiveHandlers = (compilerMeta, decorator) => {
|
|
1939
2164
|
var _a;
|
|
1940
2165
|
const handlers = {};
|
|
1941
|
-
(_a = compilerMeta[decorator]) == null ? void 0 : _a.forEach(({ propName, methodName }) => {
|
|
2166
|
+
(_a = compilerMeta[decorator]) == null ? void 0 : _a.forEach(({ propName, methodName, handlerOptions }) => {
|
|
1942
2167
|
var _a2;
|
|
1943
|
-
|
|
2168
|
+
let watcherFlags = 0;
|
|
2169
|
+
if (handlerOptions == null ? void 0 : handlerOptions.immediate) {
|
|
2170
|
+
watcherFlags |= 1 /* Immediate */;
|
|
2171
|
+
}
|
|
2172
|
+
handlers[propName] = [...(_a2 = handlers[propName]) != null ? _a2 : [], { [methodName]: watcherFlags }];
|
|
1944
2173
|
});
|
|
1945
2174
|
return handlers;
|
|
1946
2175
|
};
|
|
@@ -2203,12 +2432,12 @@ var splitLineBreaks = (sourceText) => {
|
|
|
2203
2432
|
|
|
2204
2433
|
// src/utils/path.ts
|
|
2205
2434
|
var import_path = __toESM(require("path"));
|
|
2206
|
-
var normalizePath = (
|
|
2207
|
-
if (typeof
|
|
2435
|
+
var normalizePath = (path7, relativize = true) => {
|
|
2436
|
+
if (typeof path7 !== "string") {
|
|
2208
2437
|
throw new Error(`invalid path to normalize`);
|
|
2209
2438
|
}
|
|
2210
|
-
|
|
2211
|
-
const components = pathComponents(
|
|
2439
|
+
path7 = normalizeSlashes(path7.trim());
|
|
2440
|
+
const components = pathComponents(path7, getRootLength(path7));
|
|
2212
2441
|
const reducedComponents = reducePathComponents(components);
|
|
2213
2442
|
const rootPart = reducedComponents[0];
|
|
2214
2443
|
const secondPart = reducedComponents[1];
|
|
@@ -2216,12 +2445,12 @@ var normalizePath = (path6, relativize = true) => {
|
|
|
2216
2445
|
if (normalized === "") {
|
|
2217
2446
|
return ".";
|
|
2218
2447
|
}
|
|
2219
|
-
if (rootPart === "" && secondPart &&
|
|
2448
|
+
if (rootPart === "" && secondPart && path7.includes("/") && !secondPart.startsWith(".") && !secondPart.startsWith("@") && relativize) {
|
|
2220
2449
|
return "./" + normalized;
|
|
2221
2450
|
}
|
|
2222
2451
|
return normalized;
|
|
2223
2452
|
};
|
|
2224
|
-
var normalizeSlashes = (
|
|
2453
|
+
var normalizeSlashes = (path7) => path7.replace(backslashRegExp, "/");
|
|
2225
2454
|
var altDirectorySeparator = "\\";
|
|
2226
2455
|
var urlSchemeSeparator = "://";
|
|
2227
2456
|
var backslashRegExp = /\\/g;
|
|
@@ -2246,45 +2475,45 @@ var reducePathComponents = (components) => {
|
|
|
2246
2475
|
}
|
|
2247
2476
|
return reduced;
|
|
2248
2477
|
};
|
|
2249
|
-
var getRootLength = (
|
|
2250
|
-
const rootLength = getEncodedRootLength(
|
|
2478
|
+
var getRootLength = (path7) => {
|
|
2479
|
+
const rootLength = getEncodedRootLength(path7);
|
|
2251
2480
|
return rootLength < 0 ? ~rootLength : rootLength;
|
|
2252
2481
|
};
|
|
2253
|
-
var getEncodedRootLength = (
|
|
2254
|
-
if (!
|
|
2255
|
-
const ch0 =
|
|
2482
|
+
var getEncodedRootLength = (path7) => {
|
|
2483
|
+
if (!path7) return 0;
|
|
2484
|
+
const ch0 = path7.charCodeAt(0);
|
|
2256
2485
|
if (ch0 === 47 /* slash */ || ch0 === 92 /* backslash */) {
|
|
2257
|
-
if (
|
|
2258
|
-
const p1 =
|
|
2259
|
-
if (p1 < 0) return
|
|
2486
|
+
if (path7.charCodeAt(1) !== ch0) return 1;
|
|
2487
|
+
const p1 = path7.indexOf(ch0 === 47 /* slash */ ? "/" : altDirectorySeparator, 2);
|
|
2488
|
+
if (p1 < 0) return path7.length;
|
|
2260
2489
|
return p1 + 1;
|
|
2261
2490
|
}
|
|
2262
|
-
if (isVolumeCharacter(ch0) &&
|
|
2263
|
-
const ch2 =
|
|
2491
|
+
if (isVolumeCharacter(ch0) && path7.charCodeAt(1) === 58 /* colon */) {
|
|
2492
|
+
const ch2 = path7.charCodeAt(2);
|
|
2264
2493
|
if (ch2 === 47 /* slash */ || ch2 === 92 /* backslash */) return 3;
|
|
2265
|
-
if (
|
|
2494
|
+
if (path7.length === 2) return 2;
|
|
2266
2495
|
}
|
|
2267
|
-
const schemeEnd =
|
|
2496
|
+
const schemeEnd = path7.indexOf(urlSchemeSeparator);
|
|
2268
2497
|
if (schemeEnd !== -1) {
|
|
2269
2498
|
const authorityStart = schemeEnd + urlSchemeSeparator.length;
|
|
2270
|
-
const authorityEnd =
|
|
2499
|
+
const authorityEnd = path7.indexOf("/", authorityStart);
|
|
2271
2500
|
if (authorityEnd !== -1) {
|
|
2272
|
-
const scheme =
|
|
2273
|
-
const authority =
|
|
2274
|
-
if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(
|
|
2275
|
-
const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(
|
|
2501
|
+
const scheme = path7.slice(0, schemeEnd);
|
|
2502
|
+
const authority = path7.slice(authorityStart, authorityEnd);
|
|
2503
|
+
if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(path7.charCodeAt(authorityEnd + 1))) {
|
|
2504
|
+
const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path7, authorityEnd + 2);
|
|
2276
2505
|
if (volumeSeparatorEnd !== -1) {
|
|
2277
|
-
if (
|
|
2506
|
+
if (path7.charCodeAt(volumeSeparatorEnd) === 47 /* slash */) {
|
|
2278
2507
|
return ~(volumeSeparatorEnd + 1);
|
|
2279
2508
|
}
|
|
2280
|
-
if (volumeSeparatorEnd ===
|
|
2509
|
+
if (volumeSeparatorEnd === path7.length) {
|
|
2281
2510
|
return ~volumeSeparatorEnd;
|
|
2282
2511
|
}
|
|
2283
2512
|
}
|
|
2284
2513
|
}
|
|
2285
2514
|
return ~(authorityEnd + 1);
|
|
2286
2515
|
}
|
|
2287
|
-
return ~
|
|
2516
|
+
return ~path7.length;
|
|
2288
2517
|
}
|
|
2289
2518
|
return 0;
|
|
2290
2519
|
};
|
|
@@ -2298,9 +2527,9 @@ var getFileUrlVolumeSeparatorEnd = (url, start2) => {
|
|
|
2298
2527
|
}
|
|
2299
2528
|
return -1;
|
|
2300
2529
|
};
|
|
2301
|
-
var pathComponents = (
|
|
2302
|
-
const root =
|
|
2303
|
-
const rest =
|
|
2530
|
+
var pathComponents = (path7, rootLength) => {
|
|
2531
|
+
const root = path7.substring(0, rootLength);
|
|
2532
|
+
const rest = path7.substring(rootLength).split("/");
|
|
2304
2533
|
const restLen = rest.length;
|
|
2305
2534
|
if (restLen > 0 && !rest[restLen - 1]) {
|
|
2306
2535
|
rest.pop();
|
|
@@ -2408,6 +2637,1359 @@ var flattenDiagnosticMessageText = (tsDiagnostic, diag) => {
|
|
|
2408
2637
|
return result2.trim();
|
|
2409
2638
|
};
|
|
2410
2639
|
|
|
2640
|
+
// node_modules/minimatch/dist/esm/index.js
|
|
2641
|
+
var import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
2642
|
+
|
|
2643
|
+
// node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
2644
|
+
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
2645
|
+
var assertValidPattern = (pattern) => {
|
|
2646
|
+
if (typeof pattern !== "string") {
|
|
2647
|
+
throw new TypeError("invalid pattern");
|
|
2648
|
+
}
|
|
2649
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
2650
|
+
throw new TypeError("pattern is too long");
|
|
2651
|
+
}
|
|
2652
|
+
};
|
|
2653
|
+
|
|
2654
|
+
// node_modules/minimatch/dist/esm/brace-expressions.js
|
|
2655
|
+
var posixClasses = {
|
|
2656
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
2657
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
2658
|
+
"[:ascii:]": ["\\x00-\\x7f", false],
|
|
2659
|
+
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
2660
|
+
"[:cntrl:]": ["\\p{Cc}", true],
|
|
2661
|
+
"[:digit:]": ["\\p{Nd}", true],
|
|
2662
|
+
"[:graph:]": ["\\p{Z}\\p{C}", true, true],
|
|
2663
|
+
"[:lower:]": ["\\p{Ll}", true],
|
|
2664
|
+
"[:print:]": ["\\p{C}", true],
|
|
2665
|
+
"[:punct:]": ["\\p{P}", true],
|
|
2666
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
2667
|
+
"[:upper:]": ["\\p{Lu}", true],
|
|
2668
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
2669
|
+
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
2670
|
+
};
|
|
2671
|
+
var braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
2672
|
+
var regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
2673
|
+
var rangesToString = (ranges) => ranges.join("");
|
|
2674
|
+
var parseClass = (glob, position) => {
|
|
2675
|
+
const pos = position;
|
|
2676
|
+
if (glob.charAt(pos) !== "[") {
|
|
2677
|
+
throw new Error("not in a brace expression");
|
|
2678
|
+
}
|
|
2679
|
+
const ranges = [];
|
|
2680
|
+
const negs = [];
|
|
2681
|
+
let i = pos + 1;
|
|
2682
|
+
let sawStart = false;
|
|
2683
|
+
let uflag = false;
|
|
2684
|
+
let escaping = false;
|
|
2685
|
+
let negate = false;
|
|
2686
|
+
let endPos = pos;
|
|
2687
|
+
let rangeStart = "";
|
|
2688
|
+
WHILE: while (i < glob.length) {
|
|
2689
|
+
const c = glob.charAt(i);
|
|
2690
|
+
if ((c === "!" || c === "^") && i === pos + 1) {
|
|
2691
|
+
negate = true;
|
|
2692
|
+
i++;
|
|
2693
|
+
continue;
|
|
2694
|
+
}
|
|
2695
|
+
if (c === "]" && sawStart && !escaping) {
|
|
2696
|
+
endPos = i + 1;
|
|
2697
|
+
break;
|
|
2698
|
+
}
|
|
2699
|
+
sawStart = true;
|
|
2700
|
+
if (c === "\\") {
|
|
2701
|
+
if (!escaping) {
|
|
2702
|
+
escaping = true;
|
|
2703
|
+
i++;
|
|
2704
|
+
continue;
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
2707
|
+
if (c === "[" && !escaping) {
|
|
2708
|
+
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
2709
|
+
if (glob.startsWith(cls, i)) {
|
|
2710
|
+
if (rangeStart) {
|
|
2711
|
+
return ["$.", false, glob.length - pos, true];
|
|
2712
|
+
}
|
|
2713
|
+
i += cls.length;
|
|
2714
|
+
if (neg)
|
|
2715
|
+
negs.push(unip);
|
|
2716
|
+
else
|
|
2717
|
+
ranges.push(unip);
|
|
2718
|
+
uflag = uflag || u;
|
|
2719
|
+
continue WHILE;
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
escaping = false;
|
|
2724
|
+
if (rangeStart) {
|
|
2725
|
+
if (c > rangeStart) {
|
|
2726
|
+
ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
|
|
2727
|
+
} else if (c === rangeStart) {
|
|
2728
|
+
ranges.push(braceEscape(c));
|
|
2729
|
+
}
|
|
2730
|
+
rangeStart = "";
|
|
2731
|
+
i++;
|
|
2732
|
+
continue;
|
|
2733
|
+
}
|
|
2734
|
+
if (glob.startsWith("-]", i + 1)) {
|
|
2735
|
+
ranges.push(braceEscape(c + "-"));
|
|
2736
|
+
i += 2;
|
|
2737
|
+
continue;
|
|
2738
|
+
}
|
|
2739
|
+
if (glob.startsWith("-", i + 1)) {
|
|
2740
|
+
rangeStart = c;
|
|
2741
|
+
i += 2;
|
|
2742
|
+
continue;
|
|
2743
|
+
}
|
|
2744
|
+
ranges.push(braceEscape(c));
|
|
2745
|
+
i++;
|
|
2746
|
+
}
|
|
2747
|
+
if (endPos < i) {
|
|
2748
|
+
return ["", false, 0, false];
|
|
2749
|
+
}
|
|
2750
|
+
if (!ranges.length && !negs.length) {
|
|
2751
|
+
return ["$.", false, glob.length - pos, true];
|
|
2752
|
+
}
|
|
2753
|
+
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
|
|
2754
|
+
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
2755
|
+
return [regexpEscape(r), false, endPos - pos, false];
|
|
2756
|
+
}
|
|
2757
|
+
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
|
|
2758
|
+
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
2759
|
+
const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
|
|
2760
|
+
return [comb, uflag, endPos - pos, true];
|
|
2761
|
+
};
|
|
2762
|
+
|
|
2763
|
+
// node_modules/minimatch/dist/esm/unescape.js
|
|
2764
|
+
var unescape2 = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
2765
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
2766
|
+
};
|
|
2767
|
+
|
|
2768
|
+
// node_modules/minimatch/dist/esm/ast.js
|
|
2769
|
+
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
2770
|
+
var isExtglobType = (c) => types.has(c);
|
|
2771
|
+
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
2772
|
+
var startNoDot = "(?!\\.)";
|
|
2773
|
+
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
|
2774
|
+
var justDots = /* @__PURE__ */ new Set(["..", "."]);
|
|
2775
|
+
var reSpecials = new Set("().*{}+?[]^$\\!");
|
|
2776
|
+
var regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
2777
|
+
var qmark = "[^/]";
|
|
2778
|
+
var star = qmark + "*?";
|
|
2779
|
+
var starNoEmpty = qmark + "+?";
|
|
2780
|
+
var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn;
|
|
2781
|
+
var _AST = class _AST {
|
|
2782
|
+
constructor(type, parent, options = {}) {
|
|
2783
|
+
__privateAdd(this, _AST_instances);
|
|
2784
|
+
__publicField(this, "type");
|
|
2785
|
+
__privateAdd(this, _root);
|
|
2786
|
+
__privateAdd(this, _hasMagic);
|
|
2787
|
+
__privateAdd(this, _uflag, false);
|
|
2788
|
+
__privateAdd(this, _parts, []);
|
|
2789
|
+
__privateAdd(this, _parent);
|
|
2790
|
+
__privateAdd(this, _parentIndex);
|
|
2791
|
+
__privateAdd(this, _negs);
|
|
2792
|
+
__privateAdd(this, _filledNegs, false);
|
|
2793
|
+
__privateAdd(this, _options);
|
|
2794
|
+
__privateAdd(this, _toString);
|
|
2795
|
+
// set to true if it's an extglob with no children
|
|
2796
|
+
// (which really means one child of '')
|
|
2797
|
+
__privateAdd(this, _emptyExt, false);
|
|
2798
|
+
this.type = type;
|
|
2799
|
+
if (type)
|
|
2800
|
+
__privateSet(this, _hasMagic, true);
|
|
2801
|
+
__privateSet(this, _parent, parent);
|
|
2802
|
+
__privateSet(this, _root, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _root) : this);
|
|
2803
|
+
__privateSet(this, _options, __privateGet(this, _root) === this ? options : __privateGet(__privateGet(this, _root), _options));
|
|
2804
|
+
__privateSet(this, _negs, __privateGet(this, _root) === this ? [] : __privateGet(__privateGet(this, _root), _negs));
|
|
2805
|
+
if (type === "!" && !__privateGet(__privateGet(this, _root), _filledNegs))
|
|
2806
|
+
__privateGet(this, _negs).push(this);
|
|
2807
|
+
__privateSet(this, _parentIndex, __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0);
|
|
2808
|
+
}
|
|
2809
|
+
get hasMagic() {
|
|
2810
|
+
if (__privateGet(this, _hasMagic) !== void 0)
|
|
2811
|
+
return __privateGet(this, _hasMagic);
|
|
2812
|
+
for (const p of __privateGet(this, _parts)) {
|
|
2813
|
+
if (typeof p === "string")
|
|
2814
|
+
continue;
|
|
2815
|
+
if (p.type || p.hasMagic)
|
|
2816
|
+
return __privateSet(this, _hasMagic, true);
|
|
2817
|
+
}
|
|
2818
|
+
return __privateGet(this, _hasMagic);
|
|
2819
|
+
}
|
|
2820
|
+
// reconstructs the pattern
|
|
2821
|
+
toString() {
|
|
2822
|
+
if (__privateGet(this, _toString) !== void 0)
|
|
2823
|
+
return __privateGet(this, _toString);
|
|
2824
|
+
if (!this.type) {
|
|
2825
|
+
return __privateSet(this, _toString, __privateGet(this, _parts).map((p) => String(p)).join(""));
|
|
2826
|
+
} else {
|
|
2827
|
+
return __privateSet(this, _toString, this.type + "(" + __privateGet(this, _parts).map((p) => String(p)).join("|") + ")");
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
push(...parts) {
|
|
2831
|
+
for (const p of parts) {
|
|
2832
|
+
if (p === "")
|
|
2833
|
+
continue;
|
|
2834
|
+
if (typeof p !== "string" && !(p instanceof _AST && __privateGet(p, _parent) === this)) {
|
|
2835
|
+
throw new Error("invalid part: " + p);
|
|
2836
|
+
}
|
|
2837
|
+
__privateGet(this, _parts).push(p);
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
toJSON() {
|
|
2841
|
+
var _a;
|
|
2842
|
+
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())];
|
|
2843
|
+
if (this.isStart() && !this.type)
|
|
2844
|
+
ret.unshift([]);
|
|
2845
|
+
if (this.isEnd() && (this === __privateGet(this, _root) || __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")) {
|
|
2846
|
+
ret.push({});
|
|
2847
|
+
}
|
|
2848
|
+
return ret;
|
|
2849
|
+
}
|
|
2850
|
+
isStart() {
|
|
2851
|
+
var _a;
|
|
2852
|
+
if (__privateGet(this, _root) === this)
|
|
2853
|
+
return true;
|
|
2854
|
+
if (!((_a = __privateGet(this, _parent)) == null ? void 0 : _a.isStart()))
|
|
2855
|
+
return false;
|
|
2856
|
+
if (__privateGet(this, _parentIndex) === 0)
|
|
2857
|
+
return true;
|
|
2858
|
+
const p = __privateGet(this, _parent);
|
|
2859
|
+
for (let i = 0; i < __privateGet(this, _parentIndex); i++) {
|
|
2860
|
+
const pp = __privateGet(p, _parts)[i];
|
|
2861
|
+
if (!(pp instanceof _AST && pp.type === "!")) {
|
|
2862
|
+
return false;
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
return true;
|
|
2866
|
+
}
|
|
2867
|
+
isEnd() {
|
|
2868
|
+
var _a, _b, _c;
|
|
2869
|
+
if (__privateGet(this, _root) === this)
|
|
2870
|
+
return true;
|
|
2871
|
+
if (((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!")
|
|
2872
|
+
return true;
|
|
2873
|
+
if (!((_b = __privateGet(this, _parent)) == null ? void 0 : _b.isEnd()))
|
|
2874
|
+
return false;
|
|
2875
|
+
if (!this.type)
|
|
2876
|
+
return (_c = __privateGet(this, _parent)) == null ? void 0 : _c.isEnd();
|
|
2877
|
+
const pl = __privateGet(this, _parent) ? __privateGet(__privateGet(this, _parent), _parts).length : 0;
|
|
2878
|
+
return __privateGet(this, _parentIndex) === pl - 1;
|
|
2879
|
+
}
|
|
2880
|
+
copyIn(part) {
|
|
2881
|
+
if (typeof part === "string")
|
|
2882
|
+
this.push(part);
|
|
2883
|
+
else
|
|
2884
|
+
this.push(part.clone(this));
|
|
2885
|
+
}
|
|
2886
|
+
clone(parent) {
|
|
2887
|
+
const c = new _AST(this.type, parent);
|
|
2888
|
+
for (const p of __privateGet(this, _parts)) {
|
|
2889
|
+
c.copyIn(p);
|
|
2890
|
+
}
|
|
2891
|
+
return c;
|
|
2892
|
+
}
|
|
2893
|
+
static fromGlob(pattern, options = {}) {
|
|
2894
|
+
var _a;
|
|
2895
|
+
const ast = new _AST(null, void 0, options);
|
|
2896
|
+
__privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, pattern, ast, 0, options);
|
|
2897
|
+
return ast;
|
|
2898
|
+
}
|
|
2899
|
+
// returns the regular expression if there's magic, or the unescaped
|
|
2900
|
+
// string if not.
|
|
2901
|
+
toMMPattern() {
|
|
2902
|
+
if (this !== __privateGet(this, _root))
|
|
2903
|
+
return __privateGet(this, _root).toMMPattern();
|
|
2904
|
+
const glob = this.toString();
|
|
2905
|
+
const [re, body, hasMagic, uflag] = this.toRegExpSource();
|
|
2906
|
+
const anyMagic = hasMagic || __privateGet(this, _hasMagic) || __privateGet(this, _options).nocase && !__privateGet(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
2907
|
+
if (!anyMagic) {
|
|
2908
|
+
return body;
|
|
2909
|
+
}
|
|
2910
|
+
const flags = (__privateGet(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
|
|
2911
|
+
return Object.assign(new RegExp(`^${re}$`, flags), {
|
|
2912
|
+
_src: re,
|
|
2913
|
+
_glob: glob
|
|
2914
|
+
});
|
|
2915
|
+
}
|
|
2916
|
+
get options() {
|
|
2917
|
+
return __privateGet(this, _options);
|
|
2918
|
+
}
|
|
2919
|
+
// returns the string match, the regexp source, whether there's magic
|
|
2920
|
+
// in the regexp (so a regular expression is required) and whether or
|
|
2921
|
+
// not the uflag is needed for the regular expression (for posix classes)
|
|
2922
|
+
// TODO: instead of injecting the start/end at this point, just return
|
|
2923
|
+
// the BODY of the regexp, along with the start/end portions suitable
|
|
2924
|
+
// for binding the start/end in either a joined full-path makeRe context
|
|
2925
|
+
// (where we bind to (^|/), or a standalone matchPart context (where
|
|
2926
|
+
// we bind to ^, and not /). Otherwise slashes get duped!
|
|
2927
|
+
//
|
|
2928
|
+
// In part-matching mode, the start is:
|
|
2929
|
+
// - if not isStart: nothing
|
|
2930
|
+
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
|
2931
|
+
// - if dots allowed or not possible: ^
|
|
2932
|
+
// - if dots possible and not allowed: ^(?!\.)
|
|
2933
|
+
// end is:
|
|
2934
|
+
// - if not isEnd(): nothing
|
|
2935
|
+
// - else: $
|
|
2936
|
+
//
|
|
2937
|
+
// In full-path matching mode, we put the slash at the START of the
|
|
2938
|
+
// pattern, so start is:
|
|
2939
|
+
// - if first pattern: same as part-matching mode
|
|
2940
|
+
// - if not isStart(): nothing
|
|
2941
|
+
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
|
2942
|
+
// - if dots allowed or not possible: /
|
|
2943
|
+
// - if dots possible and not allowed: /(?!\.)
|
|
2944
|
+
// end is:
|
|
2945
|
+
// - if last pattern, same as part-matching mode
|
|
2946
|
+
// - else nothing
|
|
2947
|
+
//
|
|
2948
|
+
// Always put the (?:$|/) on negated tails, though, because that has to be
|
|
2949
|
+
// there to bind the end of the negated pattern portion, and it's easier to
|
|
2950
|
+
// just stick it in now rather than try to inject it later in the middle of
|
|
2951
|
+
// the pattern.
|
|
2952
|
+
//
|
|
2953
|
+
// We can just always return the same end, and leave it up to the caller
|
|
2954
|
+
// to know whether it's going to be used joined or in parts.
|
|
2955
|
+
// And, if the start is adjusted slightly, can do the same there:
|
|
2956
|
+
// - if not isStart: nothing
|
|
2957
|
+
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
|
2958
|
+
// - if dots allowed or not possible: (?:/|^)
|
|
2959
|
+
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
|
2960
|
+
//
|
|
2961
|
+
// But it's better to have a simpler binding without a conditional, for
|
|
2962
|
+
// performance, so probably better to return both start options.
|
|
2963
|
+
//
|
|
2964
|
+
// Then the caller just ignores the end if it's not the first pattern,
|
|
2965
|
+
// and the start always gets applied.
|
|
2966
|
+
//
|
|
2967
|
+
// But that's always going to be $ if it's the ending pattern, or nothing,
|
|
2968
|
+
// so the caller can just attach $ at the end of the pattern when building.
|
|
2969
|
+
//
|
|
2970
|
+
// So the todo is:
|
|
2971
|
+
// - better detect what kind of start is needed
|
|
2972
|
+
// - return both flavors of starting pattern
|
|
2973
|
+
// - attach $ at the end of the pattern when creating the actual RegExp
|
|
2974
|
+
//
|
|
2975
|
+
// Ah, but wait, no, that all only applies to the root when the first pattern
|
|
2976
|
+
// is not an extglob. If the first pattern IS an extglob, then we need all
|
|
2977
|
+
// that dot prevention biz to live in the extglob portions, because eg
|
|
2978
|
+
// +(*|.x*) can match .xy but not .yx.
|
|
2979
|
+
//
|
|
2980
|
+
// So, return the two flavors if it's #root and the first child is not an
|
|
2981
|
+
// AST, otherwise leave it to the child AST to handle it, and there,
|
|
2982
|
+
// use the (?:^|/) style of start binding.
|
|
2983
|
+
//
|
|
2984
|
+
// Even simplified further:
|
|
2985
|
+
// - Since the start for a join is eg /(?!\.) and the start for a part
|
|
2986
|
+
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
|
2987
|
+
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
2988
|
+
toRegExpSource(allowDot) {
|
|
2989
|
+
var _a;
|
|
2990
|
+
const dot = allowDot != null ? allowDot : !!__privateGet(this, _options).dot;
|
|
2991
|
+
if (__privateGet(this, _root) === this)
|
|
2992
|
+
__privateMethod(this, _AST_instances, fillNegs_fn).call(this);
|
|
2993
|
+
if (!this.type) {
|
|
2994
|
+
const noEmpty = this.isStart() && this.isEnd();
|
|
2995
|
+
const src = __privateGet(this, _parts).map((p) => {
|
|
2996
|
+
var _a2;
|
|
2997
|
+
const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a2 = _AST, _AST_static, parseGlob_fn).call(_a2, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
|
|
2998
|
+
__privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
|
|
2999
|
+
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
3000
|
+
return re;
|
|
3001
|
+
}).join("");
|
|
3002
|
+
let start3 = "";
|
|
3003
|
+
if (this.isStart()) {
|
|
3004
|
+
if (typeof __privateGet(this, _parts)[0] === "string") {
|
|
3005
|
+
const dotTravAllowed = __privateGet(this, _parts).length === 1 && justDots.has(__privateGet(this, _parts)[0]);
|
|
3006
|
+
if (!dotTravAllowed) {
|
|
3007
|
+
const aps = addPatternStart;
|
|
3008
|
+
const needNoTrav = (
|
|
3009
|
+
// dots are allowed, and the pattern starts with [ or .
|
|
3010
|
+
dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
3011
|
+
src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
3012
|
+
src.startsWith("\\.\\.") && aps.has(src.charAt(4))
|
|
3013
|
+
);
|
|
3014
|
+
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
3015
|
+
start3 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
}
|
|
3019
|
+
let end = "";
|
|
3020
|
+
if (this.isEnd() && __privateGet(__privateGet(this, _root), _filledNegs) && ((_a = __privateGet(this, _parent)) == null ? void 0 : _a.type) === "!") {
|
|
3021
|
+
end = "(?:$|\\/)";
|
|
3022
|
+
}
|
|
3023
|
+
const final2 = start3 + src + end;
|
|
3024
|
+
return [
|
|
3025
|
+
final2,
|
|
3026
|
+
unescape2(src),
|
|
3027
|
+
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
3028
|
+
__privateGet(this, _uflag)
|
|
3029
|
+
];
|
|
3030
|
+
}
|
|
3031
|
+
const repeated = this.type === "*" || this.type === "+";
|
|
3032
|
+
const start2 = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
3033
|
+
let body = __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, dot);
|
|
3034
|
+
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
3035
|
+
const s = this.toString();
|
|
3036
|
+
__privateSet(this, _parts, [s]);
|
|
3037
|
+
this.type = null;
|
|
3038
|
+
__privateSet(this, _hasMagic, void 0);
|
|
3039
|
+
return [s, unescape2(this.toString()), false, false];
|
|
3040
|
+
}
|
|
3041
|
+
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : __privateMethod(this, _AST_instances, partsToRegExp_fn).call(this, true);
|
|
3042
|
+
if (bodyDotAllowed === body) {
|
|
3043
|
+
bodyDotAllowed = "";
|
|
3044
|
+
}
|
|
3045
|
+
if (bodyDotAllowed) {
|
|
3046
|
+
body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
|
3047
|
+
}
|
|
3048
|
+
let final = "";
|
|
3049
|
+
if (this.type === "!" && __privateGet(this, _emptyExt)) {
|
|
3050
|
+
final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
|
|
3051
|
+
} else {
|
|
3052
|
+
const close = this.type === "!" ? (
|
|
3053
|
+
// !() must match something,but !(x) can match ''
|
|
3054
|
+
"))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")"
|
|
3055
|
+
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
|
|
3056
|
+
final = start2 + body + close;
|
|
3057
|
+
}
|
|
3058
|
+
return [
|
|
3059
|
+
final,
|
|
3060
|
+
unescape2(body),
|
|
3061
|
+
__privateSet(this, _hasMagic, !!__privateGet(this, _hasMagic)),
|
|
3062
|
+
__privateGet(this, _uflag)
|
|
3063
|
+
];
|
|
3064
|
+
}
|
|
3065
|
+
};
|
|
3066
|
+
_root = new WeakMap();
|
|
3067
|
+
_hasMagic = new WeakMap();
|
|
3068
|
+
_uflag = new WeakMap();
|
|
3069
|
+
_parts = new WeakMap();
|
|
3070
|
+
_parent = new WeakMap();
|
|
3071
|
+
_parentIndex = new WeakMap();
|
|
3072
|
+
_negs = new WeakMap();
|
|
3073
|
+
_filledNegs = new WeakMap();
|
|
3074
|
+
_options = new WeakMap();
|
|
3075
|
+
_toString = new WeakMap();
|
|
3076
|
+
_emptyExt = new WeakMap();
|
|
3077
|
+
_AST_instances = new WeakSet();
|
|
3078
|
+
fillNegs_fn = function() {
|
|
3079
|
+
if (this !== __privateGet(this, _root))
|
|
3080
|
+
throw new Error("should only call on root");
|
|
3081
|
+
if (__privateGet(this, _filledNegs))
|
|
3082
|
+
return this;
|
|
3083
|
+
this.toString();
|
|
3084
|
+
__privateSet(this, _filledNegs, true);
|
|
3085
|
+
let n;
|
|
3086
|
+
while (n = __privateGet(this, _negs).pop()) {
|
|
3087
|
+
if (n.type !== "!")
|
|
3088
|
+
continue;
|
|
3089
|
+
let p = n;
|
|
3090
|
+
let pp = __privateGet(p, _parent);
|
|
3091
|
+
while (pp) {
|
|
3092
|
+
for (let i = __privateGet(p, _parentIndex) + 1; !pp.type && i < __privateGet(pp, _parts).length; i++) {
|
|
3093
|
+
for (const part of __privateGet(n, _parts)) {
|
|
3094
|
+
if (typeof part === "string") {
|
|
3095
|
+
throw new Error("string part in extglob AST??");
|
|
3096
|
+
}
|
|
3097
|
+
part.copyIn(__privateGet(pp, _parts)[i]);
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
p = pp;
|
|
3101
|
+
pp = __privateGet(p, _parent);
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3104
|
+
return this;
|
|
3105
|
+
};
|
|
3106
|
+
_AST_static = new WeakSet();
|
|
3107
|
+
parseAST_fn = function(str, ast, pos, opt) {
|
|
3108
|
+
var _a, _b;
|
|
3109
|
+
let escaping = false;
|
|
3110
|
+
let inBrace = false;
|
|
3111
|
+
let braceStart = -1;
|
|
3112
|
+
let braceNeg = false;
|
|
3113
|
+
if (ast.type === null) {
|
|
3114
|
+
let i2 = pos;
|
|
3115
|
+
let acc2 = "";
|
|
3116
|
+
while (i2 < str.length) {
|
|
3117
|
+
const c = str.charAt(i2++);
|
|
3118
|
+
if (escaping || c === "\\") {
|
|
3119
|
+
escaping = !escaping;
|
|
3120
|
+
acc2 += c;
|
|
3121
|
+
continue;
|
|
3122
|
+
}
|
|
3123
|
+
if (inBrace) {
|
|
3124
|
+
if (i2 === braceStart + 1) {
|
|
3125
|
+
if (c === "^" || c === "!") {
|
|
3126
|
+
braceNeg = true;
|
|
3127
|
+
}
|
|
3128
|
+
} else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
|
|
3129
|
+
inBrace = false;
|
|
3130
|
+
}
|
|
3131
|
+
acc2 += c;
|
|
3132
|
+
continue;
|
|
3133
|
+
} else if (c === "[") {
|
|
3134
|
+
inBrace = true;
|
|
3135
|
+
braceStart = i2;
|
|
3136
|
+
braceNeg = false;
|
|
3137
|
+
acc2 += c;
|
|
3138
|
+
continue;
|
|
3139
|
+
}
|
|
3140
|
+
if (!opt.noext && isExtglobType(c) && str.charAt(i2) === "(") {
|
|
3141
|
+
ast.push(acc2);
|
|
3142
|
+
acc2 = "";
|
|
3143
|
+
const ext2 = new _AST(c, ast);
|
|
3144
|
+
i2 = __privateMethod(_a = _AST, _AST_static, parseAST_fn).call(_a, str, ext2, i2, opt);
|
|
3145
|
+
ast.push(ext2);
|
|
3146
|
+
continue;
|
|
3147
|
+
}
|
|
3148
|
+
acc2 += c;
|
|
3149
|
+
}
|
|
3150
|
+
ast.push(acc2);
|
|
3151
|
+
return i2;
|
|
3152
|
+
}
|
|
3153
|
+
let i = pos + 1;
|
|
3154
|
+
let part = new _AST(null, ast);
|
|
3155
|
+
const parts = [];
|
|
3156
|
+
let acc = "";
|
|
3157
|
+
while (i < str.length) {
|
|
3158
|
+
const c = str.charAt(i++);
|
|
3159
|
+
if (escaping || c === "\\") {
|
|
3160
|
+
escaping = !escaping;
|
|
3161
|
+
acc += c;
|
|
3162
|
+
continue;
|
|
3163
|
+
}
|
|
3164
|
+
if (inBrace) {
|
|
3165
|
+
if (i === braceStart + 1) {
|
|
3166
|
+
if (c === "^" || c === "!") {
|
|
3167
|
+
braceNeg = true;
|
|
3168
|
+
}
|
|
3169
|
+
} else if (c === "]" && !(i === braceStart + 2 && braceNeg)) {
|
|
3170
|
+
inBrace = false;
|
|
3171
|
+
}
|
|
3172
|
+
acc += c;
|
|
3173
|
+
continue;
|
|
3174
|
+
} else if (c === "[") {
|
|
3175
|
+
inBrace = true;
|
|
3176
|
+
braceStart = i;
|
|
3177
|
+
braceNeg = false;
|
|
3178
|
+
acc += c;
|
|
3179
|
+
continue;
|
|
3180
|
+
}
|
|
3181
|
+
if (isExtglobType(c) && str.charAt(i) === "(") {
|
|
3182
|
+
part.push(acc);
|
|
3183
|
+
acc = "";
|
|
3184
|
+
const ext2 = new _AST(c, part);
|
|
3185
|
+
part.push(ext2);
|
|
3186
|
+
i = __privateMethod(_b = _AST, _AST_static, parseAST_fn).call(_b, str, ext2, i, opt);
|
|
3187
|
+
continue;
|
|
3188
|
+
}
|
|
3189
|
+
if (c === "|") {
|
|
3190
|
+
part.push(acc);
|
|
3191
|
+
acc = "";
|
|
3192
|
+
parts.push(part);
|
|
3193
|
+
part = new _AST(null, ast);
|
|
3194
|
+
continue;
|
|
3195
|
+
}
|
|
3196
|
+
if (c === ")") {
|
|
3197
|
+
if (acc === "" && __privateGet(ast, _parts).length === 0) {
|
|
3198
|
+
__privateSet(ast, _emptyExt, true);
|
|
3199
|
+
}
|
|
3200
|
+
part.push(acc);
|
|
3201
|
+
acc = "";
|
|
3202
|
+
ast.push(...parts, part);
|
|
3203
|
+
return i;
|
|
3204
|
+
}
|
|
3205
|
+
acc += c;
|
|
3206
|
+
}
|
|
3207
|
+
ast.type = null;
|
|
3208
|
+
__privateSet(ast, _hasMagic, void 0);
|
|
3209
|
+
__privateSet(ast, _parts, [str.substring(pos - 1)]);
|
|
3210
|
+
return i;
|
|
3211
|
+
};
|
|
3212
|
+
partsToRegExp_fn = function(dot) {
|
|
3213
|
+
return __privateGet(this, _parts).map((p) => {
|
|
3214
|
+
if (typeof p === "string") {
|
|
3215
|
+
throw new Error("string type in extglob ast??");
|
|
3216
|
+
}
|
|
3217
|
+
const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
|
|
3218
|
+
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
|
|
3219
|
+
return re;
|
|
3220
|
+
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
3221
|
+
};
|
|
3222
|
+
parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
|
|
3223
|
+
let escaping = false;
|
|
3224
|
+
let re = "";
|
|
3225
|
+
let uflag = false;
|
|
3226
|
+
for (let i = 0; i < glob.length; i++) {
|
|
3227
|
+
const c = glob.charAt(i);
|
|
3228
|
+
if (escaping) {
|
|
3229
|
+
escaping = false;
|
|
3230
|
+
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
3231
|
+
continue;
|
|
3232
|
+
}
|
|
3233
|
+
if (c === "\\") {
|
|
3234
|
+
if (i === glob.length - 1) {
|
|
3235
|
+
re += "\\\\";
|
|
3236
|
+
} else {
|
|
3237
|
+
escaping = true;
|
|
3238
|
+
}
|
|
3239
|
+
continue;
|
|
3240
|
+
}
|
|
3241
|
+
if (c === "[") {
|
|
3242
|
+
const [src, needUflag, consumed, magic] = parseClass(glob, i);
|
|
3243
|
+
if (consumed) {
|
|
3244
|
+
re += src;
|
|
3245
|
+
uflag = uflag || needUflag;
|
|
3246
|
+
i += consumed - 1;
|
|
3247
|
+
hasMagic = hasMagic || magic;
|
|
3248
|
+
continue;
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
if (c === "*") {
|
|
3252
|
+
if (noEmpty && glob === "*")
|
|
3253
|
+
re += starNoEmpty;
|
|
3254
|
+
else
|
|
3255
|
+
re += star;
|
|
3256
|
+
hasMagic = true;
|
|
3257
|
+
continue;
|
|
3258
|
+
}
|
|
3259
|
+
if (c === "?") {
|
|
3260
|
+
re += qmark;
|
|
3261
|
+
hasMagic = true;
|
|
3262
|
+
continue;
|
|
3263
|
+
}
|
|
3264
|
+
re += regExpEscape(c);
|
|
3265
|
+
}
|
|
3266
|
+
return [re, unescape2(glob), !!hasMagic, uflag];
|
|
3267
|
+
};
|
|
3268
|
+
__privateAdd(_AST, _AST_static);
|
|
3269
|
+
var AST = _AST;
|
|
3270
|
+
|
|
3271
|
+
// node_modules/minimatch/dist/esm/escape.js
|
|
3272
|
+
var escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
3273
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
3274
|
+
};
|
|
3275
|
+
|
|
3276
|
+
// node_modules/minimatch/dist/esm/index.js
|
|
3277
|
+
var minimatch = (p, pattern, options = {}) => {
|
|
3278
|
+
assertValidPattern(pattern);
|
|
3279
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
3280
|
+
return false;
|
|
3281
|
+
}
|
|
3282
|
+
return new Minimatch(pattern, options).match(p);
|
|
3283
|
+
};
|
|
3284
|
+
var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
|
|
3285
|
+
var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
|
|
3286
|
+
var starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
|
|
3287
|
+
var starDotExtTestNocase = (ext2) => {
|
|
3288
|
+
ext2 = ext2.toLowerCase();
|
|
3289
|
+
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
|
|
3290
|
+
};
|
|
3291
|
+
var starDotExtTestNocaseDot = (ext2) => {
|
|
3292
|
+
ext2 = ext2.toLowerCase();
|
|
3293
|
+
return (f) => f.toLowerCase().endsWith(ext2);
|
|
3294
|
+
};
|
|
3295
|
+
var starDotStarRE = /^\*+\.\*+$/;
|
|
3296
|
+
var starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
3297
|
+
var starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
3298
|
+
var dotStarRE = /^\.\*+$/;
|
|
3299
|
+
var dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
3300
|
+
var starRE = /^\*+$/;
|
|
3301
|
+
var starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
3302
|
+
var starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
3303
|
+
var qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
3304
|
+
var qmarksTestNocase = ([$0, ext2 = ""]) => {
|
|
3305
|
+
const noext = qmarksTestNoExt([$0]);
|
|
3306
|
+
if (!ext2)
|
|
3307
|
+
return noext;
|
|
3308
|
+
ext2 = ext2.toLowerCase();
|
|
3309
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
3310
|
+
};
|
|
3311
|
+
var qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
|
|
3312
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
3313
|
+
if (!ext2)
|
|
3314
|
+
return noext;
|
|
3315
|
+
ext2 = ext2.toLowerCase();
|
|
3316
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
|
|
3317
|
+
};
|
|
3318
|
+
var qmarksTestDot = ([$0, ext2 = ""]) => {
|
|
3319
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
3320
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
3321
|
+
};
|
|
3322
|
+
var qmarksTest = ([$0, ext2 = ""]) => {
|
|
3323
|
+
const noext = qmarksTestNoExt([$0]);
|
|
3324
|
+
return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
|
|
3325
|
+
};
|
|
3326
|
+
var qmarksTestNoExt = ([$0]) => {
|
|
3327
|
+
const len = $0.length;
|
|
3328
|
+
return (f) => f.length === len && !f.startsWith(".");
|
|
3329
|
+
};
|
|
3330
|
+
var qmarksTestNoExtDot = ([$0]) => {
|
|
3331
|
+
const len = $0.length;
|
|
3332
|
+
return (f) => f.length === len && f !== "." && f !== "..";
|
|
3333
|
+
};
|
|
3334
|
+
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
3335
|
+
var path2 = {
|
|
3336
|
+
win32: { sep: "\\" },
|
|
3337
|
+
posix: { sep: "/" }
|
|
3338
|
+
};
|
|
3339
|
+
var sep = defaultPlatform === "win32" ? path2.win32.sep : path2.posix.sep;
|
|
3340
|
+
minimatch.sep = sep;
|
|
3341
|
+
var GLOBSTAR = Symbol("globstar **");
|
|
3342
|
+
minimatch.GLOBSTAR = GLOBSTAR;
|
|
3343
|
+
var qmark2 = "[^/]";
|
|
3344
|
+
var star2 = qmark2 + "*?";
|
|
3345
|
+
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
3346
|
+
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
3347
|
+
var filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
|
|
3348
|
+
minimatch.filter = filter;
|
|
3349
|
+
var ext = (a, b = {}) => Object.assign({}, a, b);
|
|
3350
|
+
var defaults = (def) => {
|
|
3351
|
+
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
3352
|
+
return minimatch;
|
|
3353
|
+
}
|
|
3354
|
+
const orig = minimatch;
|
|
3355
|
+
const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
|
|
3356
|
+
return Object.assign(m, {
|
|
3357
|
+
Minimatch: class Minimatch extends orig.Minimatch {
|
|
3358
|
+
constructor(pattern, options = {}) {
|
|
3359
|
+
super(pattern, ext(def, options));
|
|
3360
|
+
}
|
|
3361
|
+
static defaults(options) {
|
|
3362
|
+
return orig.defaults(ext(def, options)).Minimatch;
|
|
3363
|
+
}
|
|
3364
|
+
},
|
|
3365
|
+
AST: class AST extends orig.AST {
|
|
3366
|
+
/* c8 ignore start */
|
|
3367
|
+
constructor(type, parent, options = {}) {
|
|
3368
|
+
super(type, parent, ext(def, options));
|
|
3369
|
+
}
|
|
3370
|
+
/* c8 ignore stop */
|
|
3371
|
+
static fromGlob(pattern, options = {}) {
|
|
3372
|
+
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
3373
|
+
}
|
|
3374
|
+
},
|
|
3375
|
+
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
3376
|
+
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
3377
|
+
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
3378
|
+
defaults: (options) => orig.defaults(ext(def, options)),
|
|
3379
|
+
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
3380
|
+
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
3381
|
+
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
|
|
3382
|
+
sep: orig.sep,
|
|
3383
|
+
GLOBSTAR
|
|
3384
|
+
});
|
|
3385
|
+
};
|
|
3386
|
+
minimatch.defaults = defaults;
|
|
3387
|
+
var braceExpand = (pattern, options = {}) => {
|
|
3388
|
+
assertValidPattern(pattern);
|
|
3389
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
3390
|
+
return [pattern];
|
|
3391
|
+
}
|
|
3392
|
+
return (0, import_brace_expansion.default)(pattern);
|
|
3393
|
+
};
|
|
3394
|
+
minimatch.braceExpand = braceExpand;
|
|
3395
|
+
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
3396
|
+
minimatch.makeRe = makeRe;
|
|
3397
|
+
var match = (list, pattern, options = {}) => {
|
|
3398
|
+
const mm = new Minimatch(pattern, options);
|
|
3399
|
+
list = list.filter((f) => mm.match(f));
|
|
3400
|
+
if (mm.options.nonull && !list.length) {
|
|
3401
|
+
list.push(pattern);
|
|
3402
|
+
}
|
|
3403
|
+
return list;
|
|
3404
|
+
};
|
|
3405
|
+
minimatch.match = match;
|
|
3406
|
+
var globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
3407
|
+
var regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
3408
|
+
var Minimatch = class {
|
|
3409
|
+
options;
|
|
3410
|
+
set;
|
|
3411
|
+
pattern;
|
|
3412
|
+
windowsPathsNoEscape;
|
|
3413
|
+
nonegate;
|
|
3414
|
+
negate;
|
|
3415
|
+
comment;
|
|
3416
|
+
empty;
|
|
3417
|
+
preserveMultipleSlashes;
|
|
3418
|
+
partial;
|
|
3419
|
+
globSet;
|
|
3420
|
+
globParts;
|
|
3421
|
+
nocase;
|
|
3422
|
+
isWindows;
|
|
3423
|
+
platform;
|
|
3424
|
+
windowsNoMagicRoot;
|
|
3425
|
+
regexp;
|
|
3426
|
+
constructor(pattern, options = {}) {
|
|
3427
|
+
assertValidPattern(pattern);
|
|
3428
|
+
options = options || {};
|
|
3429
|
+
this.options = options;
|
|
3430
|
+
this.pattern = pattern;
|
|
3431
|
+
this.platform = options.platform || defaultPlatform;
|
|
3432
|
+
this.isWindows = this.platform === "win32";
|
|
3433
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
|
3434
|
+
if (this.windowsPathsNoEscape) {
|
|
3435
|
+
this.pattern = this.pattern.replace(/\\/g, "/");
|
|
3436
|
+
}
|
|
3437
|
+
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
3438
|
+
this.regexp = null;
|
|
3439
|
+
this.negate = false;
|
|
3440
|
+
this.nonegate = !!options.nonegate;
|
|
3441
|
+
this.comment = false;
|
|
3442
|
+
this.empty = false;
|
|
3443
|
+
this.partial = !!options.partial;
|
|
3444
|
+
this.nocase = !!this.options.nocase;
|
|
3445
|
+
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
3446
|
+
this.globSet = [];
|
|
3447
|
+
this.globParts = [];
|
|
3448
|
+
this.set = [];
|
|
3449
|
+
this.make();
|
|
3450
|
+
}
|
|
3451
|
+
hasMagic() {
|
|
3452
|
+
if (this.options.magicalBraces && this.set.length > 1) {
|
|
3453
|
+
return true;
|
|
3454
|
+
}
|
|
3455
|
+
for (const pattern of this.set) {
|
|
3456
|
+
for (const part of pattern) {
|
|
3457
|
+
if (typeof part !== "string")
|
|
3458
|
+
return true;
|
|
3459
|
+
}
|
|
3460
|
+
}
|
|
3461
|
+
return false;
|
|
3462
|
+
}
|
|
3463
|
+
debug(..._) {
|
|
3464
|
+
}
|
|
3465
|
+
make() {
|
|
3466
|
+
const pattern = this.pattern;
|
|
3467
|
+
const options = this.options;
|
|
3468
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
3469
|
+
this.comment = true;
|
|
3470
|
+
return;
|
|
3471
|
+
}
|
|
3472
|
+
if (!pattern) {
|
|
3473
|
+
this.empty = true;
|
|
3474
|
+
return;
|
|
3475
|
+
}
|
|
3476
|
+
this.parseNegate();
|
|
3477
|
+
this.globSet = [...new Set(this.braceExpand())];
|
|
3478
|
+
if (options.debug) {
|
|
3479
|
+
this.debug = (...args) => console.error(...args);
|
|
3480
|
+
}
|
|
3481
|
+
this.debug(this.pattern, this.globSet);
|
|
3482
|
+
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
3483
|
+
this.globParts = this.preprocess(rawGlobParts);
|
|
3484
|
+
this.debug(this.pattern, this.globParts);
|
|
3485
|
+
let set = this.globParts.map((s, _, __) => {
|
|
3486
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
3487
|
+
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
3488
|
+
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
3489
|
+
if (isUNC) {
|
|
3490
|
+
return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
3491
|
+
} else if (isDrive) {
|
|
3492
|
+
return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
3493
|
+
}
|
|
3494
|
+
}
|
|
3495
|
+
return s.map((ss) => this.parse(ss));
|
|
3496
|
+
});
|
|
3497
|
+
this.debug(this.pattern, set);
|
|
3498
|
+
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
3499
|
+
if (this.isWindows) {
|
|
3500
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
3501
|
+
const p = this.set[i];
|
|
3502
|
+
if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
|
|
3503
|
+
p[2] = "?";
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3507
|
+
this.debug(this.pattern, this.set);
|
|
3508
|
+
}
|
|
3509
|
+
// various transforms to equivalent pattern sets that are
|
|
3510
|
+
// faster to process in a filesystem walk. The goal is to
|
|
3511
|
+
// eliminate what we can, and push all ** patterns as far
|
|
3512
|
+
// to the right as possible, even if it increases the number
|
|
3513
|
+
// of patterns that we have to process.
|
|
3514
|
+
preprocess(globParts) {
|
|
3515
|
+
if (this.options.noglobstar) {
|
|
3516
|
+
for (let i = 0; i < globParts.length; i++) {
|
|
3517
|
+
for (let j = 0; j < globParts[i].length; j++) {
|
|
3518
|
+
if (globParts[i][j] === "**") {
|
|
3519
|
+
globParts[i][j] = "*";
|
|
3520
|
+
}
|
|
3521
|
+
}
|
|
3522
|
+
}
|
|
3523
|
+
}
|
|
3524
|
+
const { optimizationLevel = 1 } = this.options;
|
|
3525
|
+
if (optimizationLevel >= 2) {
|
|
3526
|
+
globParts = this.firstPhasePreProcess(globParts);
|
|
3527
|
+
globParts = this.secondPhasePreProcess(globParts);
|
|
3528
|
+
} else if (optimizationLevel >= 1) {
|
|
3529
|
+
globParts = this.levelOneOptimize(globParts);
|
|
3530
|
+
} else {
|
|
3531
|
+
globParts = this.adjascentGlobstarOptimize(globParts);
|
|
3532
|
+
}
|
|
3533
|
+
return globParts;
|
|
3534
|
+
}
|
|
3535
|
+
// just get rid of adjascent ** portions
|
|
3536
|
+
adjascentGlobstarOptimize(globParts) {
|
|
3537
|
+
return globParts.map((parts) => {
|
|
3538
|
+
let gs = -1;
|
|
3539
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
3540
|
+
let i = gs;
|
|
3541
|
+
while (parts[i + 1] === "**") {
|
|
3542
|
+
i++;
|
|
3543
|
+
}
|
|
3544
|
+
if (i !== gs) {
|
|
3545
|
+
parts.splice(gs, i - gs);
|
|
3546
|
+
}
|
|
3547
|
+
}
|
|
3548
|
+
return parts;
|
|
3549
|
+
});
|
|
3550
|
+
}
|
|
3551
|
+
// get rid of adjascent ** and resolve .. portions
|
|
3552
|
+
levelOneOptimize(globParts) {
|
|
3553
|
+
return globParts.map((parts) => {
|
|
3554
|
+
parts = parts.reduce((set, part) => {
|
|
3555
|
+
const prev = set[set.length - 1];
|
|
3556
|
+
if (part === "**" && prev === "**") {
|
|
3557
|
+
return set;
|
|
3558
|
+
}
|
|
3559
|
+
if (part === "..") {
|
|
3560
|
+
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
3561
|
+
set.pop();
|
|
3562
|
+
return set;
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
set.push(part);
|
|
3566
|
+
return set;
|
|
3567
|
+
}, []);
|
|
3568
|
+
return parts.length === 0 ? [""] : parts;
|
|
3569
|
+
});
|
|
3570
|
+
}
|
|
3571
|
+
levelTwoFileOptimize(parts) {
|
|
3572
|
+
if (!Array.isArray(parts)) {
|
|
3573
|
+
parts = this.slashSplit(parts);
|
|
3574
|
+
}
|
|
3575
|
+
let didSomething = false;
|
|
3576
|
+
do {
|
|
3577
|
+
didSomething = false;
|
|
3578
|
+
if (!this.preserveMultipleSlashes) {
|
|
3579
|
+
for (let i = 1; i < parts.length - 1; i++) {
|
|
3580
|
+
const p = parts[i];
|
|
3581
|
+
if (i === 1 && p === "" && parts[0] === "")
|
|
3582
|
+
continue;
|
|
3583
|
+
if (p === "." || p === "") {
|
|
3584
|
+
didSomething = true;
|
|
3585
|
+
parts.splice(i, 1);
|
|
3586
|
+
i--;
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
3590
|
+
didSomething = true;
|
|
3591
|
+
parts.pop();
|
|
3592
|
+
}
|
|
3593
|
+
}
|
|
3594
|
+
let dd = 0;
|
|
3595
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
3596
|
+
const p = parts[dd - 1];
|
|
3597
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
3598
|
+
didSomething = true;
|
|
3599
|
+
parts.splice(dd - 1, 2);
|
|
3600
|
+
dd -= 2;
|
|
3601
|
+
}
|
|
3602
|
+
}
|
|
3603
|
+
} while (didSomething);
|
|
3604
|
+
return parts.length === 0 ? [""] : parts;
|
|
3605
|
+
}
|
|
3606
|
+
// First phase: single-pattern processing
|
|
3607
|
+
// <pre> is 1 or more portions
|
|
3608
|
+
// <rest> is 1 or more portions
|
|
3609
|
+
// <p> is any portion other than ., .., '', or **
|
|
3610
|
+
// <e> is . or ''
|
|
3611
|
+
//
|
|
3612
|
+
// **/.. is *brutal* for filesystem walking performance, because
|
|
3613
|
+
// it effectively resets the recursive walk each time it occurs,
|
|
3614
|
+
// and ** cannot be reduced out by a .. pattern part like a regexp
|
|
3615
|
+
// or most strings (other than .., ., and '') can be.
|
|
3616
|
+
//
|
|
3617
|
+
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
|
|
3618
|
+
// <pre>/<e>/<rest> -> <pre>/<rest>
|
|
3619
|
+
// <pre>/<p>/../<rest> -> <pre>/<rest>
|
|
3620
|
+
// **/**/<rest> -> **/<rest>
|
|
3621
|
+
//
|
|
3622
|
+
// **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
|
|
3623
|
+
// this WOULD be allowed if ** did follow symlinks, or * didn't
|
|
3624
|
+
firstPhasePreProcess(globParts) {
|
|
3625
|
+
let didSomething = false;
|
|
3626
|
+
do {
|
|
3627
|
+
didSomething = false;
|
|
3628
|
+
for (let parts of globParts) {
|
|
3629
|
+
let gs = -1;
|
|
3630
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
3631
|
+
let gss = gs;
|
|
3632
|
+
while (parts[gss + 1] === "**") {
|
|
3633
|
+
gss++;
|
|
3634
|
+
}
|
|
3635
|
+
if (gss > gs) {
|
|
3636
|
+
parts.splice(gs + 1, gss - gs);
|
|
3637
|
+
}
|
|
3638
|
+
let next = parts[gs + 1];
|
|
3639
|
+
const p = parts[gs + 2];
|
|
3640
|
+
const p2 = parts[gs + 3];
|
|
3641
|
+
if (next !== "..")
|
|
3642
|
+
continue;
|
|
3643
|
+
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
|
|
3644
|
+
continue;
|
|
3645
|
+
}
|
|
3646
|
+
didSomething = true;
|
|
3647
|
+
parts.splice(gs, 1);
|
|
3648
|
+
const other = parts.slice(0);
|
|
3649
|
+
other[gs] = "**";
|
|
3650
|
+
globParts.push(other);
|
|
3651
|
+
gs--;
|
|
3652
|
+
}
|
|
3653
|
+
if (!this.preserveMultipleSlashes) {
|
|
3654
|
+
for (let i = 1; i < parts.length - 1; i++) {
|
|
3655
|
+
const p = parts[i];
|
|
3656
|
+
if (i === 1 && p === "" && parts[0] === "")
|
|
3657
|
+
continue;
|
|
3658
|
+
if (p === "." || p === "") {
|
|
3659
|
+
didSomething = true;
|
|
3660
|
+
parts.splice(i, 1);
|
|
3661
|
+
i--;
|
|
3662
|
+
}
|
|
3663
|
+
}
|
|
3664
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
3665
|
+
didSomething = true;
|
|
3666
|
+
parts.pop();
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
let dd = 0;
|
|
3670
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
3671
|
+
const p = parts[dd - 1];
|
|
3672
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
3673
|
+
didSomething = true;
|
|
3674
|
+
const needDot = dd === 1 && parts[dd + 1] === "**";
|
|
3675
|
+
const splin = needDot ? ["."] : [];
|
|
3676
|
+
parts.splice(dd - 1, 2, ...splin);
|
|
3677
|
+
if (parts.length === 0)
|
|
3678
|
+
parts.push("");
|
|
3679
|
+
dd -= 2;
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3682
|
+
}
|
|
3683
|
+
} while (didSomething);
|
|
3684
|
+
return globParts;
|
|
3685
|
+
}
|
|
3686
|
+
// second phase: multi-pattern dedupes
|
|
3687
|
+
// {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
|
|
3688
|
+
// {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
|
|
3689
|
+
// {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
|
|
3690
|
+
//
|
|
3691
|
+
// {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
|
|
3692
|
+
// ^-- not valid because ** doens't follow symlinks
|
|
3693
|
+
secondPhasePreProcess(globParts) {
|
|
3694
|
+
for (let i = 0; i < globParts.length - 1; i++) {
|
|
3695
|
+
for (let j = i + 1; j < globParts.length; j++) {
|
|
3696
|
+
const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
|
|
3697
|
+
if (!matched)
|
|
3698
|
+
continue;
|
|
3699
|
+
globParts[i] = matched;
|
|
3700
|
+
globParts[j] = [];
|
|
3701
|
+
}
|
|
3702
|
+
}
|
|
3703
|
+
return globParts.filter((gs) => gs.length);
|
|
3704
|
+
}
|
|
3705
|
+
partsMatch(a, b, emptyGSMatch = false) {
|
|
3706
|
+
let ai = 0;
|
|
3707
|
+
let bi = 0;
|
|
3708
|
+
let result2 = [];
|
|
3709
|
+
let which = "";
|
|
3710
|
+
while (ai < a.length && bi < b.length) {
|
|
3711
|
+
if (a[ai] === b[bi]) {
|
|
3712
|
+
result2.push(which === "b" ? b[bi] : a[ai]);
|
|
3713
|
+
ai++;
|
|
3714
|
+
bi++;
|
|
3715
|
+
} else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
|
|
3716
|
+
result2.push(a[ai]);
|
|
3717
|
+
ai++;
|
|
3718
|
+
} else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
|
|
3719
|
+
result2.push(b[bi]);
|
|
3720
|
+
bi++;
|
|
3721
|
+
} else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
|
|
3722
|
+
if (which === "b")
|
|
3723
|
+
return false;
|
|
3724
|
+
which = "a";
|
|
3725
|
+
result2.push(a[ai]);
|
|
3726
|
+
ai++;
|
|
3727
|
+
bi++;
|
|
3728
|
+
} else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
|
|
3729
|
+
if (which === "a")
|
|
3730
|
+
return false;
|
|
3731
|
+
which = "b";
|
|
3732
|
+
result2.push(b[bi]);
|
|
3733
|
+
ai++;
|
|
3734
|
+
bi++;
|
|
3735
|
+
} else {
|
|
3736
|
+
return false;
|
|
3737
|
+
}
|
|
3738
|
+
}
|
|
3739
|
+
return a.length === b.length && result2;
|
|
3740
|
+
}
|
|
3741
|
+
parseNegate() {
|
|
3742
|
+
if (this.nonegate)
|
|
3743
|
+
return;
|
|
3744
|
+
const pattern = this.pattern;
|
|
3745
|
+
let negate = false;
|
|
3746
|
+
let negateOffset = 0;
|
|
3747
|
+
for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
|
|
3748
|
+
negate = !negate;
|
|
3749
|
+
negateOffset++;
|
|
3750
|
+
}
|
|
3751
|
+
if (negateOffset)
|
|
3752
|
+
this.pattern = pattern.slice(negateOffset);
|
|
3753
|
+
this.negate = negate;
|
|
3754
|
+
}
|
|
3755
|
+
// set partial to true to test if, for example,
|
|
3756
|
+
// "/a/b" matches the start of "/*/b/*/d"
|
|
3757
|
+
// Partial means, if you run out of file before you run
|
|
3758
|
+
// out of pattern, then that's fine, as long as all
|
|
3759
|
+
// the parts match.
|
|
3760
|
+
matchOne(file, pattern, partial = false) {
|
|
3761
|
+
const options = this.options;
|
|
3762
|
+
if (this.isWindows) {
|
|
3763
|
+
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
3764
|
+
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
3765
|
+
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
3766
|
+
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
3767
|
+
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
3768
|
+
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
3769
|
+
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
3770
|
+
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
3771
|
+
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
3772
|
+
pattern[pdi] = fd;
|
|
3773
|
+
if (pdi > fdi) {
|
|
3774
|
+
pattern = pattern.slice(pdi);
|
|
3775
|
+
} else if (fdi > pdi) {
|
|
3776
|
+
file = file.slice(fdi);
|
|
3777
|
+
}
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
}
|
|
3781
|
+
const { optimizationLevel = 1 } = this.options;
|
|
3782
|
+
if (optimizationLevel >= 2) {
|
|
3783
|
+
file = this.levelTwoFileOptimize(file);
|
|
3784
|
+
}
|
|
3785
|
+
this.debug("matchOne", this, { file, pattern });
|
|
3786
|
+
this.debug("matchOne", file.length, pattern.length);
|
|
3787
|
+
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
3788
|
+
this.debug("matchOne loop");
|
|
3789
|
+
var p = pattern[pi];
|
|
3790
|
+
var f = file[fi];
|
|
3791
|
+
this.debug(pattern, p, f);
|
|
3792
|
+
if (p === false) {
|
|
3793
|
+
return false;
|
|
3794
|
+
}
|
|
3795
|
+
if (p === GLOBSTAR) {
|
|
3796
|
+
this.debug("GLOBSTAR", [pattern, p, f]);
|
|
3797
|
+
var fr = fi;
|
|
3798
|
+
var pr = pi + 1;
|
|
3799
|
+
if (pr === pl) {
|
|
3800
|
+
this.debug("** at the end");
|
|
3801
|
+
for (; fi < fl; fi++) {
|
|
3802
|
+
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
|
3803
|
+
return false;
|
|
3804
|
+
}
|
|
3805
|
+
return true;
|
|
3806
|
+
}
|
|
3807
|
+
while (fr < fl) {
|
|
3808
|
+
var swallowee = file[fr];
|
|
3809
|
+
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
3810
|
+
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
3811
|
+
this.debug("globstar found match!", fr, fl, swallowee);
|
|
3812
|
+
return true;
|
|
3813
|
+
} else {
|
|
3814
|
+
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
3815
|
+
this.debug("dot detected!", file, fr, pattern, pr);
|
|
3816
|
+
break;
|
|
3817
|
+
}
|
|
3818
|
+
this.debug("globstar swallow a segment, and continue");
|
|
3819
|
+
fr++;
|
|
3820
|
+
}
|
|
3821
|
+
}
|
|
3822
|
+
if (partial) {
|
|
3823
|
+
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
3824
|
+
if (fr === fl) {
|
|
3825
|
+
return true;
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
return false;
|
|
3829
|
+
}
|
|
3830
|
+
let hit;
|
|
3831
|
+
if (typeof p === "string") {
|
|
3832
|
+
hit = f === p;
|
|
3833
|
+
this.debug("string match", p, f, hit);
|
|
3834
|
+
} else {
|
|
3835
|
+
hit = p.test(f);
|
|
3836
|
+
this.debug("pattern match", p, f, hit);
|
|
3837
|
+
}
|
|
3838
|
+
if (!hit)
|
|
3839
|
+
return false;
|
|
3840
|
+
}
|
|
3841
|
+
if (fi === fl && pi === pl) {
|
|
3842
|
+
return true;
|
|
3843
|
+
} else if (fi === fl) {
|
|
3844
|
+
return partial;
|
|
3845
|
+
} else if (pi === pl) {
|
|
3846
|
+
return fi === fl - 1 && file[fi] === "";
|
|
3847
|
+
} else {
|
|
3848
|
+
throw new Error("wtf?");
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
braceExpand() {
|
|
3852
|
+
return braceExpand(this.pattern, this.options);
|
|
3853
|
+
}
|
|
3854
|
+
parse(pattern) {
|
|
3855
|
+
assertValidPattern(pattern);
|
|
3856
|
+
const options = this.options;
|
|
3857
|
+
if (pattern === "**")
|
|
3858
|
+
return GLOBSTAR;
|
|
3859
|
+
if (pattern === "")
|
|
3860
|
+
return "";
|
|
3861
|
+
let m;
|
|
3862
|
+
let fastTest = null;
|
|
3863
|
+
if (m = pattern.match(starRE)) {
|
|
3864
|
+
fastTest = options.dot ? starTestDot : starTest;
|
|
3865
|
+
} else if (m = pattern.match(starDotExtRE)) {
|
|
3866
|
+
fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
3867
|
+
} else if (m = pattern.match(qmarksRE)) {
|
|
3868
|
+
fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
3869
|
+
} else if (m = pattern.match(starDotStarRE)) {
|
|
3870
|
+
fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
3871
|
+
} else if (m = pattern.match(dotStarRE)) {
|
|
3872
|
+
fastTest = dotStarTest;
|
|
3873
|
+
}
|
|
3874
|
+
const re = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
3875
|
+
if (fastTest && typeof re === "object") {
|
|
3876
|
+
Reflect.defineProperty(re, "test", { value: fastTest });
|
|
3877
|
+
}
|
|
3878
|
+
return re;
|
|
3879
|
+
}
|
|
3880
|
+
makeRe() {
|
|
3881
|
+
if (this.regexp || this.regexp === false)
|
|
3882
|
+
return this.regexp;
|
|
3883
|
+
const set = this.set;
|
|
3884
|
+
if (!set.length) {
|
|
3885
|
+
this.regexp = false;
|
|
3886
|
+
return this.regexp;
|
|
3887
|
+
}
|
|
3888
|
+
const options = this.options;
|
|
3889
|
+
const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
|
|
3890
|
+
const flags = new Set(options.nocase ? ["i"] : []);
|
|
3891
|
+
let re = set.map((pattern) => {
|
|
3892
|
+
const pp = pattern.map((p) => {
|
|
3893
|
+
if (p instanceof RegExp) {
|
|
3894
|
+
for (const f of p.flags.split(""))
|
|
3895
|
+
flags.add(f);
|
|
3896
|
+
}
|
|
3897
|
+
return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
|
|
3898
|
+
});
|
|
3899
|
+
pp.forEach((p, i) => {
|
|
3900
|
+
const next = pp[i + 1];
|
|
3901
|
+
const prev = pp[i - 1];
|
|
3902
|
+
if (p !== GLOBSTAR || prev === GLOBSTAR) {
|
|
3903
|
+
return;
|
|
3904
|
+
}
|
|
3905
|
+
if (prev === void 0) {
|
|
3906
|
+
if (next !== void 0 && next !== GLOBSTAR) {
|
|
3907
|
+
pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
3908
|
+
} else {
|
|
3909
|
+
pp[i] = twoStar;
|
|
3910
|
+
}
|
|
3911
|
+
} else if (next === void 0) {
|
|
3912
|
+
pp[i - 1] = prev + "(?:\\/|" + twoStar + ")?";
|
|
3913
|
+
} else if (next !== GLOBSTAR) {
|
|
3914
|
+
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
3915
|
+
pp[i + 1] = GLOBSTAR;
|
|
3916
|
+
}
|
|
3917
|
+
});
|
|
3918
|
+
return pp.filter((p) => p !== GLOBSTAR).join("/");
|
|
3919
|
+
}).join("|");
|
|
3920
|
+
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
3921
|
+
re = "^" + open + re + close + "$";
|
|
3922
|
+
if (this.negate)
|
|
3923
|
+
re = "^(?!" + re + ").+$";
|
|
3924
|
+
try {
|
|
3925
|
+
this.regexp = new RegExp(re, [...flags].join(""));
|
|
3926
|
+
} catch (ex) {
|
|
3927
|
+
this.regexp = false;
|
|
3928
|
+
}
|
|
3929
|
+
return this.regexp;
|
|
3930
|
+
}
|
|
3931
|
+
slashSplit(p) {
|
|
3932
|
+
if (this.preserveMultipleSlashes) {
|
|
3933
|
+
return p.split("/");
|
|
3934
|
+
} else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
|
|
3935
|
+
return ["", ...p.split(/\/+/)];
|
|
3936
|
+
} else {
|
|
3937
|
+
return p.split(/\/+/);
|
|
3938
|
+
}
|
|
3939
|
+
}
|
|
3940
|
+
match(f, partial = this.partial) {
|
|
3941
|
+
this.debug("match", f, this.pattern);
|
|
3942
|
+
if (this.comment) {
|
|
3943
|
+
return false;
|
|
3944
|
+
}
|
|
3945
|
+
if (this.empty) {
|
|
3946
|
+
return f === "";
|
|
3947
|
+
}
|
|
3948
|
+
if (f === "/" && partial) {
|
|
3949
|
+
return true;
|
|
3950
|
+
}
|
|
3951
|
+
const options = this.options;
|
|
3952
|
+
if (this.isWindows) {
|
|
3953
|
+
f = f.split("\\").join("/");
|
|
3954
|
+
}
|
|
3955
|
+
const ff = this.slashSplit(f);
|
|
3956
|
+
this.debug(this.pattern, "split", ff);
|
|
3957
|
+
const set = this.set;
|
|
3958
|
+
this.debug(this.pattern, "set", set);
|
|
3959
|
+
let filename = ff[ff.length - 1];
|
|
3960
|
+
if (!filename) {
|
|
3961
|
+
for (let i = ff.length - 2; !filename && i >= 0; i--) {
|
|
3962
|
+
filename = ff[i];
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
for (let i = 0; i < set.length; i++) {
|
|
3966
|
+
const pattern = set[i];
|
|
3967
|
+
let file = ff;
|
|
3968
|
+
if (options.matchBase && pattern.length === 1) {
|
|
3969
|
+
file = [filename];
|
|
3970
|
+
}
|
|
3971
|
+
const hit = this.matchOne(file, pattern, partial);
|
|
3972
|
+
if (hit) {
|
|
3973
|
+
if (options.flipNegate) {
|
|
3974
|
+
return true;
|
|
3975
|
+
}
|
|
3976
|
+
return !this.negate;
|
|
3977
|
+
}
|
|
3978
|
+
}
|
|
3979
|
+
if (options.flipNegate) {
|
|
3980
|
+
return false;
|
|
3981
|
+
}
|
|
3982
|
+
return this.negate;
|
|
3983
|
+
}
|
|
3984
|
+
static defaults(def) {
|
|
3985
|
+
return minimatch.defaults(def).Minimatch;
|
|
3986
|
+
}
|
|
3987
|
+
};
|
|
3988
|
+
minimatch.AST = AST;
|
|
3989
|
+
minimatch.Minimatch = Minimatch;
|
|
3990
|
+
minimatch.escape = escape;
|
|
3991
|
+
minimatch.unescape = unescape2;
|
|
3992
|
+
|
|
2411
3993
|
// src/utils/output-target.ts
|
|
2412
3994
|
var getComponentsDtsTypesFilePath = (outputTarget) => join(outputTarget.typesDir, GENERATED_DTS);
|
|
2413
3995
|
var isOutputTargetDist = (o) => o.type === DIST;
|
|
@@ -2669,14 +4251,14 @@ function getCompilerOptions(rootDir4) {
|
|
|
2669
4251
|
}
|
|
2670
4252
|
function shouldTransform(filePath, sourceText) {
|
|
2671
4253
|
var _a;
|
|
2672
|
-
const
|
|
2673
|
-
if (
|
|
4254
|
+
const ext2 = ((_a = filePath.split(".").pop()) != null ? _a : "").toLowerCase().split("?")[0];
|
|
4255
|
+
if (ext2 === "ts" || ext2 === "tsx" || ext2 === "jsx") {
|
|
2674
4256
|
return true;
|
|
2675
4257
|
}
|
|
2676
|
-
if (
|
|
4258
|
+
if (ext2 === "mjs") {
|
|
2677
4259
|
return true;
|
|
2678
4260
|
}
|
|
2679
|
-
if (
|
|
4261
|
+
if (ext2 === "js") {
|
|
2680
4262
|
if (sourceText.includes("import ") || sourceText.includes("import.") || sourceText.includes("import(")) {
|
|
2681
4263
|
return true;
|
|
2682
4264
|
}
|
|
@@ -2684,7 +4266,7 @@ function shouldTransform(filePath, sourceText) {
|
|
|
2684
4266
|
return true;
|
|
2685
4267
|
}
|
|
2686
4268
|
}
|
|
2687
|
-
if (
|
|
4269
|
+
if (ext2 === "css") {
|
|
2688
4270
|
return true;
|
|
2689
4271
|
}
|
|
2690
4272
|
return false;
|
|
@@ -3969,14 +5551,14 @@ function getCompilerOptions2(rootDir4) {
|
|
|
3969
5551
|
}
|
|
3970
5552
|
function shouldTransform2(filePath, sourceText) {
|
|
3971
5553
|
var _a;
|
|
3972
|
-
const
|
|
3973
|
-
if (
|
|
5554
|
+
const ext2 = ((_a = filePath.split(".").pop()) != null ? _a : "").toLowerCase().split("?")[0];
|
|
5555
|
+
if (ext2 === "ts" || ext2 === "tsx" || ext2 === "jsx") {
|
|
3974
5556
|
return true;
|
|
3975
5557
|
}
|
|
3976
|
-
if (
|
|
5558
|
+
if (ext2 === "mjs") {
|
|
3977
5559
|
return true;
|
|
3978
5560
|
}
|
|
3979
|
-
if (
|
|
5561
|
+
if (ext2 === "js") {
|
|
3980
5562
|
if (sourceText.includes("import ") || sourceText.includes("import.") || sourceText.includes("import(")) {
|
|
3981
5563
|
return true;
|
|
3982
5564
|
}
|
|
@@ -3984,7 +5566,7 @@ function shouldTransform2(filePath, sourceText) {
|
|
|
3984
5566
|
return true;
|
|
3985
5567
|
}
|
|
3986
5568
|
}
|
|
3987
|
-
if (
|
|
5569
|
+
if (ext2 === "css") {
|
|
3988
5570
|
return true;
|
|
3989
5571
|
}
|
|
3990
5572
|
return false;
|
|
@@ -5002,14 +6584,14 @@ function getCompilerOptions3(rootDir4) {
|
|
|
5002
6584
|
}
|
|
5003
6585
|
function shouldTransform3(filePath, sourceText) {
|
|
5004
6586
|
var _a;
|
|
5005
|
-
const
|
|
5006
|
-
if (
|
|
6587
|
+
const ext2 = ((_a = filePath.split(".").pop()) != null ? _a : "").toLowerCase().split("?")[0];
|
|
6588
|
+
if (ext2 === "ts" || ext2 === "tsx" || ext2 === "jsx") {
|
|
5007
6589
|
return true;
|
|
5008
6590
|
}
|
|
5009
|
-
if (
|
|
6591
|
+
if (ext2 === "mjs") {
|
|
5010
6592
|
return true;
|
|
5011
6593
|
}
|
|
5012
|
-
if (
|
|
6594
|
+
if (ext2 === "js") {
|
|
5013
6595
|
if (sourceText.includes("import ") || sourceText.includes("import.") || sourceText.includes("import(")) {
|
|
5014
6596
|
return true;
|
|
5015
6597
|
}
|
|
@@ -5017,7 +6599,7 @@ function shouldTransform3(filePath, sourceText) {
|
|
|
5017
6599
|
return true;
|
|
5018
6600
|
}
|
|
5019
6601
|
}
|
|
5020
|
-
if (
|
|
6602
|
+
if (ext2 === "css") {
|
|
5021
6603
|
return true;
|
|
5022
6604
|
}
|
|
5023
6605
|
return false;
|
|
@@ -6325,6 +7907,9 @@ var validateHydrateScript = (config, userOutputs) => {
|
|
|
6325
7907
|
if (!isBoolean(outputTarget.empty)) {
|
|
6326
7908
|
outputTarget.empty = true;
|
|
6327
7909
|
}
|
|
7910
|
+
if (!isBoolean(outputTarget.minify)) {
|
|
7911
|
+
outputTarget.minify = false;
|
|
7912
|
+
}
|
|
6328
7913
|
outputTarget.external = outputTarget.external || [];
|
|
6329
7914
|
outputTarget.external.push("fs");
|
|
6330
7915
|
outputTarget.external.push("path");
|
|
@@ -7207,6 +8792,7 @@ var validateConfig = (userConfig = {}, bootstrapConfig) => {
|
|
|
7207
8792
|
minifyJs: (_e = config.minifyJs) != null ? _e : !devMode,
|
|
7208
8793
|
outputTargets: (_f = config.outputTargets) != null ? _f : [],
|
|
7209
8794
|
rollupConfig: validateRollupConfig(config),
|
|
8795
|
+
sourceMap: config.sourceMap === true || devMode && (config.sourceMap === "dev" || typeof config.sourceMap === "undefined"),
|
|
7210
8796
|
sys: (_h = (_g = config.sys) != null ? _g : bootstrapConfig.sys) != null ? _h : (0, import_sys_api_node.createNodeSys)({ logger }),
|
|
7211
8797
|
testing: (_i = config.testing) != null ? _i : {},
|
|
7212
8798
|
docs: validateDocs2(config, logger),
|
|
@@ -7252,12 +8838,6 @@ var validateConfig = (userConfig = {}, bootstrapConfig) => {
|
|
|
7252
8838
|
validatedConfig.extras.scopedSlotTextContentFix = !!validatedConfig.extras.scopedSlotTextContentFix;
|
|
7253
8839
|
validatedConfig.extras.experimentalScopedSlotChanges = !!validatedConfig.extras.experimentalScopedSlotChanges;
|
|
7254
8840
|
}
|
|
7255
|
-
setBooleanConfig(
|
|
7256
|
-
validatedConfig,
|
|
7257
|
-
"sourceMap",
|
|
7258
|
-
null,
|
|
7259
|
-
typeof validatedConfig.sourceMap === "undefined" ? true : validatedConfig.sourceMap
|
|
7260
|
-
);
|
|
7261
8841
|
setBooleanConfig(validatedConfig, "watch", "watch", false);
|
|
7262
8842
|
setBooleanConfig(validatedConfig, "buildDocs", "docs", !validatedConfig.devMode);
|
|
7263
8843
|
setBooleanConfig(validatedConfig, "buildDist", "esm", !validatedConfig.devMode || !!validatedConfig.buildEs5);
|
|
@@ -7297,6 +8877,9 @@ var validateConfig = (userConfig = {}, bootstrapConfig) => {
|
|
|
7297
8877
|
} else {
|
|
7298
8878
|
validatedConfig.bundles = [];
|
|
7299
8879
|
}
|
|
8880
|
+
if (!Array.isArray(validatedConfig.excludeComponents)) {
|
|
8881
|
+
validatedConfig.excludeComponents = [];
|
|
8882
|
+
}
|
|
7300
8883
|
validateWorkers(validatedConfig);
|
|
7301
8884
|
setBooleanConfig(validatedConfig, "devInspector", null, validatedConfig.devMode);
|
|
7302
8885
|
if (!validatedConfig._isTesting) {
|
|
@@ -7841,7 +9424,7 @@ var createInMemoryFs = (sys) => {
|
|
|
7841
9424
|
} else {
|
|
7842
9425
|
if (Array.isArray(opts.excludeExtensions)) {
|
|
7843
9426
|
const p = item.relPath.toLowerCase();
|
|
7844
|
-
if (opts.excludeExtensions.some((
|
|
9427
|
+
if (opts.excludeExtensions.some((ext2) => p.endsWith(ext2))) {
|
|
7845
9428
|
return true;
|
|
7846
9429
|
}
|
|
7847
9430
|
}
|
|
@@ -8079,16 +9662,16 @@ var createInMemoryFs = (sys) => {
|
|
|
8079
9662
|
dirsAdded
|
|
8080
9663
|
};
|
|
8081
9664
|
};
|
|
8082
|
-
const ensureDir = async (
|
|
9665
|
+
const ensureDir = async (path7, inMemoryOnly) => {
|
|
8083
9666
|
if (!inMemoryOnly) {
|
|
8084
|
-
await sys.createDir((0, import_path20.dirname)(
|
|
9667
|
+
await sys.createDir((0, import_path20.dirname)(path7), { recursive: true });
|
|
8085
9668
|
return;
|
|
8086
9669
|
}
|
|
8087
9670
|
const allDirs = [];
|
|
8088
9671
|
while (true) {
|
|
8089
|
-
|
|
8090
|
-
if (typeof
|
|
8091
|
-
allDirs.push(
|
|
9672
|
+
path7 = (0, import_path20.dirname)(path7);
|
|
9673
|
+
if (typeof path7 === "string" && path7.length > 0 && path7 !== "/" && path7.endsWith(":/") === false && path7.endsWith(":\\") === false) {
|
|
9674
|
+
allDirs.push(path7);
|
|
8092
9675
|
} else {
|
|
8093
9676
|
break;
|
|
8094
9677
|
}
|
|
@@ -8439,6 +10022,7 @@ var stubComponentCompilerMeta = (overrides = {}) => ({
|
|
|
8439
10022
|
hasReflect: false,
|
|
8440
10023
|
hasRenderFn: false,
|
|
8441
10024
|
hasSerializer: false,
|
|
10025
|
+
hasSlot: false,
|
|
8442
10026
|
hasState: false,
|
|
8443
10027
|
hasStyle: false,
|
|
8444
10028
|
hasVdomAttribute: false,
|
|
@@ -8467,6 +10051,7 @@ var stubComponentCompilerMeta = (overrides = {}) => ({
|
|
|
8467
10051
|
properties: [],
|
|
8468
10052
|
serializers: [],
|
|
8469
10053
|
shadowDelegatesFocus: false,
|
|
10054
|
+
slotAssignment: null,
|
|
8470
10055
|
sourceFilePath: "/some/stubbed/path/my-component.tsx",
|
|
8471
10056
|
sourceMapPath: "/some/stubbed/path/my-component.js.map",
|
|
8472
10057
|
states: [],
|
|
@@ -9087,8 +10672,8 @@ var createSystem = (c) => {
|
|
|
9087
10672
|
const getLocalModulePath = (opts) => join(opts.rootDir, "node_modules", opts.moduleId, opts.path);
|
|
9088
10673
|
const getRemoteModuleUrl = (opts) => {
|
|
9089
10674
|
const npmBaseUrl = "https://cdn.jsdelivr.net/npm/";
|
|
9090
|
-
const
|
|
9091
|
-
return new URL(
|
|
10675
|
+
const path7 = `${opts.moduleId}${opts.version ? "@" + opts.version : ""}/${opts.path}`;
|
|
10676
|
+
return new URL(path7, npmBaseUrl).href;
|
|
9092
10677
|
};
|
|
9093
10678
|
const fileWatchTimeout = 32;
|
|
9094
10679
|
createDirSync("/");
|
|
@@ -9252,6 +10837,7 @@ function mockValidatedConfig(overrides = {}) {
|
|
|
9252
10837
|
outputTargets: (_a = baseConfig.outputTargets) != null ? _a : [],
|
|
9253
10838
|
packageJsonFilePath: import_path24.default.join(rootDir4, "package.json"),
|
|
9254
10839
|
rootDir: rootDir4,
|
|
10840
|
+
sourceMap: true,
|
|
9255
10841
|
srcDir: "/src",
|
|
9256
10842
|
srcIndexHtml: "src/index.html",
|
|
9257
10843
|
suppressReservedPublicNameWarnings: false,
|
|
@@ -9310,14 +10896,14 @@ function mockConfig(overrides = {}) {
|
|
|
9310
10896
|
};
|
|
9311
10897
|
}
|
|
9312
10898
|
var mockLoadConfigInit = (overrides) => {
|
|
9313
|
-
const
|
|
10899
|
+
const defaults2 = {
|
|
9314
10900
|
config: {},
|
|
9315
10901
|
configPath: void 0,
|
|
9316
10902
|
initTsConfig: true,
|
|
9317
10903
|
logger: void 0,
|
|
9318
10904
|
sys: void 0
|
|
9319
10905
|
};
|
|
9320
|
-
return { ...
|
|
10906
|
+
return { ...defaults2, ...overrides };
|
|
9321
10907
|
};
|
|
9322
10908
|
function mockCompilerCtx(config) {
|
|
9323
10909
|
const innerConfig = config || mockValidatedConfig();
|
|
@@ -10857,6 +12443,7 @@ var getBuildFeatures = (cmps) => {
|
|
|
10857
12443
|
serializer: cmps.some((c) => c.hasSerializer),
|
|
10858
12444
|
shadowDom,
|
|
10859
12445
|
shadowDelegatesFocus: shadowDom && cmps.some((c) => c.shadowDelegatesFocus),
|
|
12446
|
+
shadowSlotAssignmentManual: shadowDom && cmps.some((c) => c.slotAssignment === "manual"),
|
|
10860
12447
|
slot,
|
|
10861
12448
|
slotRelocation,
|
|
10862
12449
|
state: cmps.some((c) => c.hasState),
|