storybook 9.0.0-alpha.1 → 9.0.0-alpha.11
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/README.md +31 -29
- package/assets/browser/favicon.svg +1 -0
- package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
- package/assets/browser/nunito-sans-bold.woff2 +0 -0
- package/assets/browser/nunito-sans-italic.woff2 +0 -0
- package/assets/browser/nunito-sans-regular.woff2 +0 -0
- package/assets/docs/addon-controls-args-annotated.png +0 -0
- package/assets/docs/addon-controls-args-background-color.png +0 -0
- package/assets/docs/addon-controls-args-background-string.png +0 -0
- package/assets/docs/addon-controls-args-docs.png +0 -0
- package/assets/docs/addon-controls-args-logging.png +0 -0
- package/assets/docs/addon-controls-args-no-annotation.png +0 -0
- package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
- package/assets/docs/addon-controls-args-reflow.png +0 -0
- package/assets/docs/addon-controls-args-template.png +0 -0
- package/assets/docs/addon-controls-expanded.png +0 -0
- package/assets/docs/addon-controls-hero.gif +0 -0
- package/assets/docs/addon-controls-install.png +0 -0
- package/assets/docs/hero.gif +0 -0
- package/assets/docs/message-reference.png +0 -0
- package/assets/docs/viewport.png +0 -0
- package/assets/server/addon.tsconfig.json +6 -0
- package/assets/server/base-preview-body.html +119 -0
- package/assets/server/base-preview-head.html +451 -0
- package/assets/server/template.ejs +87 -0
- package/bin/index.cjs +1 -1
- package/dist/actions/decorator.d.ts +6 -0
- package/dist/actions/decorator.js +139 -0
- package/dist/actions/index.cjs +127 -0
- package/dist/actions/index.d.ts +105 -0
- package/dist/actions/index.js +112 -0
- package/dist/actions/manager.js +1196 -0
- package/dist/actions/preview.cjs +165 -0
- package/dist/actions/preview.d.ts +55 -0
- package/dist/actions/preview.js +156 -0
- package/dist/babel/index.cjs +54034 -0
- package/dist/babel/index.d.ts +7488 -0
- package/dist/babel/index.js +54044 -0
- package/dist/bin/index.cjs +118 -0
- package/dist/bin/index.js +112 -0
- package/dist/builder-manager/index.cjs +2140 -0
- package/dist/builder-manager/index.d.ts +19 -0
- package/dist/builder-manager/index.js +2162 -0
- package/dist/channels/index.cjs +1913 -0
- package/dist/channels/index.d.ts +108 -0
- package/dist/channels/index.js +1881 -0
- package/dist/cli/bin/index.cjs +2687 -0
- package/dist/cli/bin/index.d.ts +2 -0
- package/dist/cli/bin/index.js +2707 -0
- package/dist/cli/index.cjs +17327 -0
- package/dist/cli/index.d.ts +209 -0
- package/dist/cli/index.js +17349 -0
- package/dist/client-logger/index.cjs +80 -0
- package/dist/client-logger/index.d.ts +29 -0
- package/dist/client-logger/index.js +64 -0
- package/dist/common/index.cjs +20568 -0
- package/dist/common/index.d.ts +948 -0
- package/dist/common/index.js +20653 -0
- package/dist/component-testing/index.cjs +23 -0
- package/dist/component-testing/index.d.ts +3 -0
- package/dist/component-testing/index.js +5 -0
- package/dist/component-testing/manager.css +170 -0
- package/dist/component-testing/manager.js +3099 -0
- package/dist/component-testing/preview.cjs +40 -0
- package/dist/component-testing/preview.d.ts +5 -0
- package/dist/component-testing/preview.js +25 -0
- package/dist/components/index.cjs +27925 -0
- package/dist/components/index.d.ts +1423 -0
- package/dist/components/index.js +24674 -0
- package/dist/controls/decorator.d.ts +5 -0
- package/dist/controls/decorator.js +8 -0
- package/dist/controls/index.cjs +26 -0
- package/dist/controls/index.d.ts +39 -0
- package/dist/controls/index.js +6 -0
- package/dist/controls/manager.js +5545 -0
- package/dist/controls/preview.cjs +26 -0
- package/dist/controls/preview.d.ts +55 -0
- package/dist/controls/preview.js +9 -0
- package/dist/core-events/index.cjs +167 -0
- package/dist/core-events/index.d.ts +426 -0
- package/dist/core-events/index.js +149 -0
- package/dist/core-server/index.cjs +38183 -0
- package/dist/core-server/index.d.ts +720 -0
- package/dist/core-server/index.js +38272 -0
- package/dist/core-server/presets/common-manager.js +20 -0
- package/dist/core-server/presets/common-override-preset.cjs +4824 -0
- package/dist/core-server/presets/common-override-preset.js +4829 -0
- package/dist/core-server/presets/common-preset.cjs +10231 -0
- package/dist/core-server/presets/common-preset.js +10309 -0
- package/dist/csf/index.cjs +179 -0
- package/dist/csf/index.d.ts +750 -0
- package/dist/csf/index.js +172 -0
- package/dist/csf-tools/index.cjs +1422 -0
- package/dist/csf-tools/index.d.ts +250 -0
- package/dist/csf-tools/index.js +1439 -0
- package/dist/docs-tools/index.cjs +2891 -0
- package/dist/docs-tools/index.d.ts +162 -0
- package/dist/docs-tools/index.js +2876 -0
- package/dist/index.cjs +17 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -7
- package/dist/instrumenter/index.cjs +3492 -0
- package/dist/instrumenter/index.d.ts +104 -0
- package/dist/instrumenter/index.js +4964 -0
- package/dist/manager/globals-module-info.cjs +817 -0
- package/dist/manager/globals-module-info.d.ts +36 -0
- package/dist/manager/globals-module-info.js +804 -0
- package/dist/manager/globals-runtime.js +83389 -0
- package/dist/manager/globals.cjs +47 -0
- package/dist/manager/globals.d.ts +24 -0
- package/dist/manager/globals.js +34 -0
- package/dist/manager/runtime.js +12323 -0
- package/dist/manager-api/index.cjs +11074 -0
- package/dist/manager-api/index.d.ts +1512 -0
- package/dist/manager-api/index.js +4835 -0
- package/dist/manager-errors.d.ts +89 -0
- package/dist/manager-errors.js +99 -0
- package/dist/node-logger/index.cjs +1642 -0
- package/dist/node-logger/index.d.ts +117 -0
- package/dist/node-logger/index.js +1652 -0
- package/dist/preview/globals.cjs +38 -0
- package/dist/preview/globals.d.ts +15 -0
- package/dist/preview/globals.js +25 -0
- package/dist/preview/runtime.js +44921 -0
- package/dist/preview-api/index.cjs +5227 -0
- package/dist/preview-api/index.d.ts +1093 -0
- package/dist/preview-api/index.js +5295 -0
- package/dist/preview-errors.cjs +503 -0
- package/dist/preview-errors.d.ts +212 -0
- package/dist/preview-errors.js +449 -0
- package/dist/router/index.cjs +3296 -0
- package/dist/router/index.d.ts +385 -0
- package/dist/router/index.js +1843 -0
- package/dist/server-errors.cjs +727 -0
- package/dist/server-errors.d.ts +296 -0
- package/dist/server-errors.js +728 -0
- package/dist/telemetry/index.cjs +2756 -0
- package/dist/telemetry/index.d.ts +133 -0
- package/dist/telemetry/index.js +2797 -0
- package/dist/test/index.cjs +35685 -0
- package/dist/test/index.d.ts +186 -0
- package/dist/test/index.js +33751 -0
- package/dist/test/preview.cjs +15869 -0
- package/dist/test/preview.d.ts +54 -0
- package/dist/test/preview.js +14440 -0
- package/dist/test/spy.cjs +257 -0
- package/dist/test/spy.d.ts +66 -0
- package/dist/test/spy.js +239 -0
- package/dist/theming/create.cjs +232 -0
- package/dist/theming/create.d.ts +50 -0
- package/dist/theming/create.js +216 -0
- package/dist/theming/index.cjs +2665 -0
- package/dist/theming/index.d.ts +11939 -0
- package/dist/theming/index.js +2485 -0
- package/dist/types/index.cjs +27 -0
- package/dist/types/index.d.ts +2795 -0
- package/dist/types/index.js +7 -0
- package/dist/viewport/index.cjs +310 -0
- package/dist/viewport/index.d.ts +320 -0
- package/dist/viewport/index.js +290 -0
- package/dist/viewport/manager.js +400 -0
- package/dist/viewport/preview.cjs +35 -0
- package/dist/viewport/preview.d.ts +69 -0
- package/dist/viewport/preview.js +19 -0
- package/package.json +539 -209
- package/.eslintrc.cjs +0 -31
- package/__mocks__/@aw-web-design/x-default-browser.js +0 -2
- package/core/babel/index.cjs +0 -1
- package/core/babel/index.d.ts +0 -2
- package/core/babel/index.js +0 -1
- package/core/builder-manager/index.cjs +0 -1
- package/core/builder-manager/index.d.ts +0 -2
- package/core/builder-manager/index.js +0 -1
- package/core/channels/index.cjs +0 -1
- package/core/channels/index.d.ts +0 -2
- package/core/channels/index.js +0 -1
- package/core/cli/bin/index.cjs +0 -1
- package/core/cli/bin/index.d.ts +0 -2
- package/core/cli/bin/index.js +0 -1
- package/core/cli/index.cjs +0 -1
- package/core/cli/index.d.ts +0 -2
- package/core/cli/index.js +0 -1
- package/core/client-logger/index.cjs +0 -1
- package/core/client-logger/index.d.ts +0 -2
- package/core/client-logger/index.js +0 -1
- package/core/common/index.cjs +0 -1
- package/core/common/index.d.ts +0 -2
- package/core/common/index.js +0 -1
- package/core/components/index.cjs +0 -1
- package/core/components/index.d.ts +0 -2
- package/core/components/index.js +0 -1
- package/core/core-events/index.cjs +0 -1
- package/core/core-events/index.d.ts +0 -2
- package/core/core-events/index.js +0 -1
- package/core/core-server/index.cjs +0 -1
- package/core/core-server/index.d.ts +0 -2
- package/core/core-server/index.js +0 -1
- package/core/core-server/presets/common-manager.js +0 -1
- package/core/core-server/presets/common-override-preset.cjs +0 -1
- package/core/core-server/presets/common-override-preset.js +0 -1
- package/core/core-server/presets/common-preset.cjs +0 -1
- package/core/core-server/presets/common-preset.js +0 -1
- package/core/csf/index.cjs +0 -1
- package/core/csf/index.d.ts +0 -2
- package/core/csf/index.js +0 -1
- package/core/csf-tools/index.cjs +0 -1
- package/core/csf-tools/index.d.ts +0 -2
- package/core/csf-tools/index.js +0 -1
- package/core/docs-tools/index.cjs +0 -1
- package/core/docs-tools/index.d.ts +0 -2
- package/core/docs-tools/index.js +0 -1
- package/core/index.cjs +0 -1
- package/core/index.d.ts +0 -2
- package/core/index.js +0 -1
- package/core/manager/globals-module-info.cjs +0 -1
- package/core/manager/globals-module-info.d.ts +0 -2
- package/core/manager/globals-module-info.js +0 -1
- package/core/manager/globals-runtime.js +0 -1
- package/core/manager/globals.cjs +0 -1
- package/core/manager/globals.d.ts +0 -2
- package/core/manager/globals.js +0 -1
- package/core/manager-api/index.cjs +0 -1
- package/core/manager-api/index.d.ts +0 -2
- package/core/manager-api/index.js +0 -1
- package/core/manager-errors.d.ts +0 -2
- package/core/manager-errors.js +0 -1
- package/core/node-logger/index.cjs +0 -1
- package/core/node-logger/index.d.ts +0 -2
- package/core/node-logger/index.js +0 -1
- package/core/preview/globals.cjs +0 -1
- package/core/preview/globals.d.ts +0 -2
- package/core/preview/globals.js +0 -1
- package/core/preview/runtime.js +0 -1
- package/core/preview-api/index.cjs +0 -1
- package/core/preview-api/index.d.ts +0 -2
- package/core/preview-api/index.js +0 -1
- package/core/preview-errors.cjs +0 -1
- package/core/preview-errors.d.ts +0 -2
- package/core/preview-errors.js +0 -1
- package/core/router/index.cjs +0 -1
- package/core/router/index.d.ts +0 -2
- package/core/router/index.js +0 -1
- package/core/server-errors.cjs +0 -1
- package/core/server-errors.d.ts +0 -2
- package/core/server-errors.js +0 -1
- package/core/telemetry/index.cjs +0 -1
- package/core/telemetry/index.d.ts +0 -2
- package/core/telemetry/index.js +0 -1
- package/core/theming/create.cjs +0 -1
- package/core/theming/create.d.ts +0 -2
- package/core/theming/create.js +0 -1
- package/core/theming/index.cjs +0 -1
- package/core/theming/index.d.ts +0 -2
- package/core/theming/index.js +0 -1
- package/core/types/index.cjs +0 -1
- package/core/types/index.d.ts +0 -2
- package/core/types/index.js +0 -1
- package/core.cjs +0 -0
- package/core.d.ts +0 -0
- package/core.js +0 -1
- package/dist/chunk-OWLSIX54.js +0 -8
- package/dist/core-path.cjs +0 -1
- package/dist/core-path.d.ts +0 -3
- package/dist/core-path.js +0 -9
- package/dist/proxy.cjs +0 -1
- package/dist/proxy.d.ts +0 -2
- package/dist/proxy.js +0 -9
|
@@ -0,0 +1,4829 @@
|
|
|
1
|
+
import ESM_COMPAT_Module from "node:module";
|
|
2
|
+
import { fileURLToPath as ESM_COMPAT_fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as ESM_COMPAT_dirname } from 'node:path';
|
|
4
|
+
const __filename = ESM_COMPAT_fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = ESM_COMPAT_dirname(__filename);
|
|
6
|
+
const require = ESM_COMPAT_Module.createRequire(import.meta.url);
|
|
7
|
+
var gs = Object.create;
|
|
8
|
+
var qt = Object.defineProperty;
|
|
9
|
+
var ws = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var ys = Object.getOwnPropertyNames;
|
|
11
|
+
var bs = Object.getPrototypeOf, Ss = Object.prototype.hasOwnProperty;
|
|
12
|
+
var l = (n, t) => qt(n, "name", { value: t, configurable: !0 });
|
|
13
|
+
var me = (n, t) => () => (t || n((t = { exports: {} }).exports, t), t.exports);
|
|
14
|
+
var Es = (n, t, e, s) => {
|
|
15
|
+
if (t && typeof t == "object" || typeof t == "function")
|
|
16
|
+
for (let i of ys(t))
|
|
17
|
+
!Ss.call(n, i) && i !== e && qt(n, i, { get: () => t[i], enumerable: !(s = ws(t, i)) || s.enumerable });
|
|
18
|
+
return n;
|
|
19
|
+
};
|
|
20
|
+
var xs = (n, t, e) => (e = n != null ? gs(bs(n)) : {}, Es(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
t || !n || !n.__esModule ? qt(e, "default", { value: n, enumerable: !0 }) : e,
|
|
26
|
+
n
|
|
27
|
+
));
|
|
28
|
+
|
|
29
|
+
// ../node_modules/balanced-match/index.js
|
|
30
|
+
var Se = me((tr, be) => {
|
|
31
|
+
"use strict";
|
|
32
|
+
be.exports = we;
|
|
33
|
+
function we(n, t, e) {
|
|
34
|
+
n instanceof RegExp && (n = ge(n, e)), t instanceof RegExp && (t = ge(t, e));
|
|
35
|
+
var s = ye(n, t, e);
|
|
36
|
+
return s && {
|
|
37
|
+
start: s[0],
|
|
38
|
+
end: s[1],
|
|
39
|
+
pre: e.slice(0, s[0]),
|
|
40
|
+
body: e.slice(s[0] + n.length, s[1]),
|
|
41
|
+
post: e.slice(s[1] + t.length)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
l(we, "balanced");
|
|
45
|
+
function ge(n, t) {
|
|
46
|
+
var e = t.match(n);
|
|
47
|
+
return e ? e[0] : null;
|
|
48
|
+
}
|
|
49
|
+
l(ge, "maybeMatch");
|
|
50
|
+
we.range = ye;
|
|
51
|
+
function ye(n, t, e) {
|
|
52
|
+
var s, i, r, o, h, a = e.indexOf(n), c = e.indexOf(t, a + 1), f = a;
|
|
53
|
+
if (a >= 0 && c > 0) {
|
|
54
|
+
if (n === t)
|
|
55
|
+
return [a, c];
|
|
56
|
+
for (s = [], r = e.length; f >= 0 && !h; )
|
|
57
|
+
f == a ? (s.push(f), a = e.indexOf(n, f + 1)) : s.length == 1 ? h = [s.pop(), c] : (i = s.pop(), i < r && (r = i, o = c), c = e.indexOf(
|
|
58
|
+
t, f + 1)), f = a < c && a >= 0 ? a : c;
|
|
59
|
+
s.length && (h = [r, o]);
|
|
60
|
+
}
|
|
61
|
+
return h;
|
|
62
|
+
}
|
|
63
|
+
l(ye, "range");
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// ../node_modules/brace-expansion/index.js
|
|
67
|
+
var Re = me((sr, Ae) => {
|
|
68
|
+
var Ee = Se();
|
|
69
|
+
Ae.exports = Cs;
|
|
70
|
+
var xe = "\0SLASH" + Math.random() + "\0", ve = "\0OPEN" + Math.random() + "\0", Vt = "\0CLOSE" + Math.random() + "\0", Te = "\0COMMA" + Math.
|
|
71
|
+
random() + "\0", Ce = "\0PERIOD" + Math.random() + "\0";
|
|
72
|
+
function Kt(n) {
|
|
73
|
+
return parseInt(n, 10) == n ? parseInt(n, 10) : n.charCodeAt(0);
|
|
74
|
+
}
|
|
75
|
+
l(Kt, "numeric");
|
|
76
|
+
function vs(n) {
|
|
77
|
+
return n.split("\\\\").join(xe).split("\\{").join(ve).split("\\}").join(Vt).split("\\,").join(Te).split("\\.").join(Ce);
|
|
78
|
+
}
|
|
79
|
+
l(vs, "escapeBraces");
|
|
80
|
+
function Ts(n) {
|
|
81
|
+
return n.split(xe).join("\\").split(ve).join("{").split(Vt).join("}").split(Te).join(",").split(Ce).join(".");
|
|
82
|
+
}
|
|
83
|
+
l(Ts, "unescapeBraces");
|
|
84
|
+
function ke(n) {
|
|
85
|
+
if (!n)
|
|
86
|
+
return [""];
|
|
87
|
+
var t = [], e = Ee("{", "}", n);
|
|
88
|
+
if (!e)
|
|
89
|
+
return n.split(",");
|
|
90
|
+
var s = e.pre, i = e.body, r = e.post, o = s.split(",");
|
|
91
|
+
o[o.length - 1] += "{" + i + "}";
|
|
92
|
+
var h = ke(r);
|
|
93
|
+
return r.length && (o[o.length - 1] += h.shift(), o.push.apply(o, h)), t.push.apply(t, o), t;
|
|
94
|
+
}
|
|
95
|
+
l(ke, "parseCommaParts");
|
|
96
|
+
function Cs(n) {
|
|
97
|
+
return n ? (n.substr(0, 2) === "{}" && (n = "\\{\\}" + n.substr(2)), ct(vs(n), !0).map(Ts)) : [];
|
|
98
|
+
}
|
|
99
|
+
l(Cs, "expandTop");
|
|
100
|
+
function ks(n) {
|
|
101
|
+
return "{" + n + "}";
|
|
102
|
+
}
|
|
103
|
+
l(ks, "embrace");
|
|
104
|
+
function As(n) {
|
|
105
|
+
return /^-?0\d/.test(n);
|
|
106
|
+
}
|
|
107
|
+
l(As, "isPadded");
|
|
108
|
+
function Rs(n, t) {
|
|
109
|
+
return n <= t;
|
|
110
|
+
}
|
|
111
|
+
l(Rs, "lte");
|
|
112
|
+
function Ds(n, t) {
|
|
113
|
+
return n >= t;
|
|
114
|
+
}
|
|
115
|
+
l(Ds, "gte");
|
|
116
|
+
function ct(n, t) {
|
|
117
|
+
var e = [], s = Ee("{", "}", n);
|
|
118
|
+
if (!s) return [n];
|
|
119
|
+
var i = s.pre, r = s.post.length ? ct(s.post, !1) : [""];
|
|
120
|
+
if (/\$$/.test(s.pre))
|
|
121
|
+
for (var o = 0; o < r.length; o++) {
|
|
122
|
+
var h = i + "{" + s.body + "}" + r[o];
|
|
123
|
+
e.push(h);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
var a = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body), c = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body), f = a || c, u = s.body.
|
|
127
|
+
indexOf(",") >= 0;
|
|
128
|
+
if (!f && !u)
|
|
129
|
+
return s.post.match(/,.*\}/) ? (n = s.pre + "{" + s.body + Vt + s.post, ct(n)) : [n];
|
|
130
|
+
var d;
|
|
131
|
+
if (f)
|
|
132
|
+
d = s.body.split(/\.\./);
|
|
133
|
+
else if (d = ke(s.body), d.length === 1 && (d = ct(d[0], !1).map(ks), d.length === 1))
|
|
134
|
+
return r.map(function(kt) {
|
|
135
|
+
return s.pre + d[0] + kt;
|
|
136
|
+
});
|
|
137
|
+
var p;
|
|
138
|
+
if (f) {
|
|
139
|
+
var w = Kt(d[0]), m = Kt(d[1]), y = Math.max(d[0].length, d[1].length), g = d.length == 3 ? Math.abs(Kt(d[2])) : 1, E = Rs, S = m < w;
|
|
140
|
+
S && (g *= -1, E = Ds);
|
|
141
|
+
var b = d.some(As);
|
|
142
|
+
p = [];
|
|
143
|
+
for (var x = w; E(x, m); x += g) {
|
|
144
|
+
var T;
|
|
145
|
+
if (c)
|
|
146
|
+
T = String.fromCharCode(x), T === "\\" && (T = "");
|
|
147
|
+
else if (T = String(x), b) {
|
|
148
|
+
var j = y - T.length;
|
|
149
|
+
if (j > 0) {
|
|
150
|
+
var J = new Array(j + 1).join("0");
|
|
151
|
+
x < 0 ? T = "-" + J + T.slice(1) : T = J + T;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
p.push(T);
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
p = [];
|
|
158
|
+
for (var I = 0; I < d.length; I++)
|
|
159
|
+
p.push.apply(p, ct(d[I], !1));
|
|
160
|
+
}
|
|
161
|
+
for (var I = 0; I < p.length; I++)
|
|
162
|
+
for (var o = 0; o < r.length; o++) {
|
|
163
|
+
var h = i + p[I] + r[o];
|
|
164
|
+
(!t || f || h) && e.push(h);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return e;
|
|
168
|
+
}
|
|
169
|
+
l(ct, "expand");
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// src/core-server/utils/remove-mdx-entries.ts
|
|
173
|
+
import { isAbsolute as ds, join as pe, relative as Yi } from "node:path";
|
|
174
|
+
import { commonGlobOptions as Ji, normalizeStories as Zi } from "storybook/internal/common";
|
|
175
|
+
|
|
176
|
+
// ../node_modules/glob/node_modules/minimatch/dist/esm/index.js
|
|
177
|
+
var Pe = xs(Re(), 1);
|
|
178
|
+
|
|
179
|
+
// ../node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
180
|
+
var ft = /* @__PURE__ */ l((n) => {
|
|
181
|
+
if (typeof n != "string")
|
|
182
|
+
throw new TypeError("invalid pattern");
|
|
183
|
+
if (n.length > 65536)
|
|
184
|
+
throw new TypeError("pattern is too long");
|
|
185
|
+
}, "assertValidPattern");
|
|
186
|
+
|
|
187
|
+
// ../node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.js
|
|
188
|
+
var Os = {
|
|
189
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
|
|
190
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", !0],
|
|
191
|
+
"[:ascii:]": ["\\x00-\\x7f", !1],
|
|
192
|
+
"[:blank:]": ["\\p{Zs}\\t", !0],
|
|
193
|
+
"[:cntrl:]": ["\\p{Cc}", !0],
|
|
194
|
+
"[:digit:]": ["\\p{Nd}", !0],
|
|
195
|
+
"[:graph:]": ["\\p{Z}\\p{C}", !0, !0],
|
|
196
|
+
"[:lower:]": ["\\p{Ll}", !0],
|
|
197
|
+
"[:print:]": ["\\p{C}", !0],
|
|
198
|
+
"[:punct:]": ["\\p{P}", !0],
|
|
199
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", !0],
|
|
200
|
+
"[:upper:]": ["\\p{Lu}", !0],
|
|
201
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
|
|
202
|
+
"[:xdigit:]": ["A-Fa-f0-9", !1]
|
|
203
|
+
}, ut = /* @__PURE__ */ l((n) => n.replace(/[[\]\\-]/g, "\\$&"), "braceEscape"), Fs = /* @__PURE__ */ l((n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
|
|
204
|
+
"\\$&"), "regexpEscape"), De = /* @__PURE__ */ l((n) => n.join(""), "rangesToString"), Oe = /* @__PURE__ */ l((n, t) => {
|
|
205
|
+
let e = t;
|
|
206
|
+
if (n.charAt(e) !== "[")
|
|
207
|
+
throw new Error("not in a brace expression");
|
|
208
|
+
let s = [], i = [], r = e + 1, o = !1, h = !1, a = !1, c = !1, f = e, u = "";
|
|
209
|
+
t: for (; r < n.length; ) {
|
|
210
|
+
let m = n.charAt(r);
|
|
211
|
+
if ((m === "!" || m === "^") && r === e + 1) {
|
|
212
|
+
c = !0, r++;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (m === "]" && o && !a) {
|
|
216
|
+
f = r + 1;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
if (o = !0, m === "\\" && !a) {
|
|
220
|
+
a = !0, r++;
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
if (m === "[" && !a) {
|
|
224
|
+
for (let [y, [g, E, S]] of Object.entries(Os))
|
|
225
|
+
if (n.startsWith(y, r)) {
|
|
226
|
+
if (u)
|
|
227
|
+
return ["$.", !1, n.length - e, !0];
|
|
228
|
+
r += y.length, S ? i.push(g) : s.push(g), h = h || E;
|
|
229
|
+
continue t;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (a = !1, u) {
|
|
233
|
+
m > u ? s.push(ut(u) + "-" + ut(m)) : m === u && s.push(ut(m)), u = "", r++;
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
if (n.startsWith("-]", r + 1)) {
|
|
237
|
+
s.push(ut(m + "-")), r += 2;
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
if (n.startsWith("-", r + 1)) {
|
|
241
|
+
u = m, r += 2;
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
s.push(ut(m)), r++;
|
|
245
|
+
}
|
|
246
|
+
if (f < r)
|
|
247
|
+
return ["", !1, 0, !1];
|
|
248
|
+
if (!s.length && !i.length)
|
|
249
|
+
return ["$.", !1, n.length - e, !0];
|
|
250
|
+
if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !c) {
|
|
251
|
+
let m = s[0].length === 2 ? s[0].slice(-1) : s[0];
|
|
252
|
+
return [Fs(m), !1, f - e, !1];
|
|
253
|
+
}
|
|
254
|
+
let d = "[" + (c ? "^" : "") + De(s) + "]", p = "[" + (c ? "" : "^") + De(i) + "]";
|
|
255
|
+
return [s.length && i.length ? "(" + d + "|" + p + ")" : s.length ? d : p, h, f - e, !0];
|
|
256
|
+
}, "parseClass");
|
|
257
|
+
|
|
258
|
+
// ../node_modules/glob/node_modules/minimatch/dist/esm/unescape.js
|
|
259
|
+
var z = /* @__PURE__ */ l((n, { windowsPathsNoEscape: t = !1 } = {}) => t ? n.replace(/\[([^\/\\])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\])\]/g,
|
|
260
|
+
"$1$2").replace(/\\([^\/])/g, "$1"), "unescape");
|
|
261
|
+
|
|
262
|
+
// ../node_modules/glob/node_modules/minimatch/dist/esm/ast.js
|
|
263
|
+
var Ms = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), Fe = /* @__PURE__ */ l((n) => Ms.has(n), "isExtglobType"), _s = "(?!(?:^|/)\\.\\.\
|
|
264
|
+
?(?:$|/))", At = "(?!\\.)", Ns = /* @__PURE__ */ new Set(["[", "."]), Ls = /* @__PURE__ */ new Set(["..", "."]), Ps = new Set("().*{}+?[]^$\\\
|
|
265
|
+
!"), Ws = /* @__PURE__ */ l((n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), "regExpEscape"), Xt = "[^/]", Me = Xt + "*?", _e = Xt + "+\
|
|
266
|
+
?", tt = class n {
|
|
267
|
+
static {
|
|
268
|
+
l(this, "AST");
|
|
269
|
+
}
|
|
270
|
+
type;
|
|
271
|
+
#t;
|
|
272
|
+
#e;
|
|
273
|
+
#n = !1;
|
|
274
|
+
#i = [];
|
|
275
|
+
#o;
|
|
276
|
+
#S;
|
|
277
|
+
#l;
|
|
278
|
+
#f = !1;
|
|
279
|
+
#h;
|
|
280
|
+
#a;
|
|
281
|
+
// set to true if it's an extglob with no children
|
|
282
|
+
// (which really means one child of '')
|
|
283
|
+
#r = !1;
|
|
284
|
+
constructor(t, e, s = {}) {
|
|
285
|
+
this.type = t, t && (this.#e = !0), this.#o = e, this.#t = this.#o ? this.#o.#t : this, this.#h = this.#t === this ? s : this.#t.#h, this.#l =
|
|
286
|
+
this.#t === this ? [] : this.#t.#l, t === "!" && !this.#t.#f && this.#l.push(this), this.#S = this.#o ? this.#o.#i.length : 0;
|
|
287
|
+
}
|
|
288
|
+
get hasMagic() {
|
|
289
|
+
if (this.#e !== void 0)
|
|
290
|
+
return this.#e;
|
|
291
|
+
for (let t of this.#i)
|
|
292
|
+
if (typeof t != "string" && (t.type || t.hasMagic))
|
|
293
|
+
return this.#e = !0;
|
|
294
|
+
return this.#e;
|
|
295
|
+
}
|
|
296
|
+
// reconstructs the pattern
|
|
297
|
+
toString() {
|
|
298
|
+
return this.#a !== void 0 ? this.#a : this.type ? this.#a = this.type + "(" + this.#i.map((t) => String(t)).join("|") + ")" : this.#a = this.#i.
|
|
299
|
+
map((t) => String(t)).join("");
|
|
300
|
+
}
|
|
301
|
+
#g() {
|
|
302
|
+
if (this !== this.#t)
|
|
303
|
+
throw new Error("should only call on root");
|
|
304
|
+
if (this.#f)
|
|
305
|
+
return this;
|
|
306
|
+
this.toString(), this.#f = !0;
|
|
307
|
+
let t;
|
|
308
|
+
for (; t = this.#l.pop(); ) {
|
|
309
|
+
if (t.type !== "!")
|
|
310
|
+
continue;
|
|
311
|
+
let e = t, s = e.#o;
|
|
312
|
+
for (; s; ) {
|
|
313
|
+
for (let i = e.#S + 1; !s.type && i < s.#i.length; i++)
|
|
314
|
+
for (let r of t.#i) {
|
|
315
|
+
if (typeof r == "string")
|
|
316
|
+
throw new Error("string part in extglob AST??");
|
|
317
|
+
r.copyIn(s.#i[i]);
|
|
318
|
+
}
|
|
319
|
+
e = s, s = e.#o;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return this;
|
|
323
|
+
}
|
|
324
|
+
push(...t) {
|
|
325
|
+
for (let e of t)
|
|
326
|
+
if (e !== "") {
|
|
327
|
+
if (typeof e != "string" && !(e instanceof n && e.#o === this))
|
|
328
|
+
throw new Error("invalid part: " + e);
|
|
329
|
+
this.#i.push(e);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
toJSON() {
|
|
333
|
+
let t = this.type === null ? this.#i.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#i.map((e) => e.toJSON())];
|
|
334
|
+
return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#t || this.#t.#f && this.#o?.type === "!") && t.push(
|
|
335
|
+
{}), t;
|
|
336
|
+
}
|
|
337
|
+
isStart() {
|
|
338
|
+
if (this.#t === this)
|
|
339
|
+
return !0;
|
|
340
|
+
if (!this.#o?.isStart())
|
|
341
|
+
return !1;
|
|
342
|
+
if (this.#S === 0)
|
|
343
|
+
return !0;
|
|
344
|
+
let t = this.#o;
|
|
345
|
+
for (let e = 0; e < this.#S; e++) {
|
|
346
|
+
let s = t.#i[e];
|
|
347
|
+
if (!(s instanceof n && s.type === "!"))
|
|
348
|
+
return !1;
|
|
349
|
+
}
|
|
350
|
+
return !0;
|
|
351
|
+
}
|
|
352
|
+
isEnd() {
|
|
353
|
+
if (this.#t === this || this.#o?.type === "!")
|
|
354
|
+
return !0;
|
|
355
|
+
if (!this.#o?.isEnd())
|
|
356
|
+
return !1;
|
|
357
|
+
if (!this.type)
|
|
358
|
+
return this.#o?.isEnd();
|
|
359
|
+
let t = this.#o ? this.#o.#i.length : 0;
|
|
360
|
+
return this.#S === t - 1;
|
|
361
|
+
}
|
|
362
|
+
copyIn(t) {
|
|
363
|
+
typeof t == "string" ? this.push(t) : this.push(t.clone(this));
|
|
364
|
+
}
|
|
365
|
+
clone(t) {
|
|
366
|
+
let e = new n(this.type, t);
|
|
367
|
+
for (let s of this.#i)
|
|
368
|
+
e.copyIn(s);
|
|
369
|
+
return e;
|
|
370
|
+
}
|
|
371
|
+
static #w(t, e, s, i) {
|
|
372
|
+
let r = !1, o = !1, h = -1, a = !1;
|
|
373
|
+
if (e.type === null) {
|
|
374
|
+
let p = s, w = "";
|
|
375
|
+
for (; p < t.length; ) {
|
|
376
|
+
let m = t.charAt(p++);
|
|
377
|
+
if (r || m === "\\") {
|
|
378
|
+
r = !r, w += m;
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
if (o) {
|
|
382
|
+
p === h + 1 ? (m === "^" || m === "!") && (a = !0) : m === "]" && !(p === h + 2 && a) && (o = !1), w += m;
|
|
383
|
+
continue;
|
|
384
|
+
} else if (m === "[") {
|
|
385
|
+
o = !0, h = p, a = !1, w += m;
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
if (!i.noext && Fe(m) && t.charAt(p) === "(") {
|
|
389
|
+
e.push(w), w = "";
|
|
390
|
+
let y = new n(m, e);
|
|
391
|
+
p = n.#w(t, y, p, i), e.push(y);
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
w += m;
|
|
395
|
+
}
|
|
396
|
+
return e.push(w), p;
|
|
397
|
+
}
|
|
398
|
+
let c = s + 1, f = new n(null, e), u = [], d = "";
|
|
399
|
+
for (; c < t.length; ) {
|
|
400
|
+
let p = t.charAt(c++);
|
|
401
|
+
if (r || p === "\\") {
|
|
402
|
+
r = !r, d += p;
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
if (o) {
|
|
406
|
+
c === h + 1 ? (p === "^" || p === "!") && (a = !0) : p === "]" && !(c === h + 2 && a) && (o = !1), d += p;
|
|
407
|
+
continue;
|
|
408
|
+
} else if (p === "[") {
|
|
409
|
+
o = !0, h = c, a = !1, d += p;
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
if (Fe(p) && t.charAt(c) === "(") {
|
|
413
|
+
f.push(d), d = "";
|
|
414
|
+
let w = new n(p, f);
|
|
415
|
+
f.push(w), c = n.#w(t, w, c, i);
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
if (p === "|") {
|
|
419
|
+
f.push(d), d = "", u.push(f), f = new n(null, e);
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
if (p === ")")
|
|
423
|
+
return d === "" && e.#i.length === 0 && (e.#r = !0), f.push(d), d = "", e.push(...u, f), c;
|
|
424
|
+
d += p;
|
|
425
|
+
}
|
|
426
|
+
return e.type = null, e.#e = void 0, e.#i = [t.substring(s - 1)], c;
|
|
427
|
+
}
|
|
428
|
+
static fromGlob(t, e = {}) {
|
|
429
|
+
let s = new n(null, void 0, e);
|
|
430
|
+
return n.#w(t, s, 0, e), s;
|
|
431
|
+
}
|
|
432
|
+
// returns the regular expression if there's magic, or the unescaped
|
|
433
|
+
// string if not.
|
|
434
|
+
toMMPattern() {
|
|
435
|
+
if (this !== this.#t)
|
|
436
|
+
return this.#t.toMMPattern();
|
|
437
|
+
let t = this.toString(), [e, s, i, r] = this.toRegExpSource();
|
|
438
|
+
if (!(i || this.#e || this.#h.nocase && !this.#h.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase()))
|
|
439
|
+
return s;
|
|
440
|
+
let h = (this.#h.nocase ? "i" : "") + (r ? "u" : "");
|
|
441
|
+
return Object.assign(new RegExp(`^${e}$`, h), {
|
|
442
|
+
_src: e,
|
|
443
|
+
_glob: t
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
get options() {
|
|
447
|
+
return this.#h;
|
|
448
|
+
}
|
|
449
|
+
// returns the string match, the regexp source, whether there's magic
|
|
450
|
+
// in the regexp (so a regular expression is required) and whether or
|
|
451
|
+
// not the uflag is needed for the regular expression (for posix classes)
|
|
452
|
+
// TODO: instead of injecting the start/end at this point, just return
|
|
453
|
+
// the BODY of the regexp, along with the start/end portions suitable
|
|
454
|
+
// for binding the start/end in either a joined full-path makeRe context
|
|
455
|
+
// (where we bind to (^|/), or a standalone matchPart context (where
|
|
456
|
+
// we bind to ^, and not /). Otherwise slashes get duped!
|
|
457
|
+
//
|
|
458
|
+
// In part-matching mode, the start is:
|
|
459
|
+
// - if not isStart: nothing
|
|
460
|
+
// - if traversal possible, but not allowed: ^(?!\.\.?$)
|
|
461
|
+
// - if dots allowed or not possible: ^
|
|
462
|
+
// - if dots possible and not allowed: ^(?!\.)
|
|
463
|
+
// end is:
|
|
464
|
+
// - if not isEnd(): nothing
|
|
465
|
+
// - else: $
|
|
466
|
+
//
|
|
467
|
+
// In full-path matching mode, we put the slash at the START of the
|
|
468
|
+
// pattern, so start is:
|
|
469
|
+
// - if first pattern: same as part-matching mode
|
|
470
|
+
// - if not isStart(): nothing
|
|
471
|
+
// - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
|
|
472
|
+
// - if dots allowed or not possible: /
|
|
473
|
+
// - if dots possible and not allowed: /(?!\.)
|
|
474
|
+
// end is:
|
|
475
|
+
// - if last pattern, same as part-matching mode
|
|
476
|
+
// - else nothing
|
|
477
|
+
//
|
|
478
|
+
// Always put the (?:$|/) on negated tails, though, because that has to be
|
|
479
|
+
// there to bind the end of the negated pattern portion, and it's easier to
|
|
480
|
+
// just stick it in now rather than try to inject it later in the middle of
|
|
481
|
+
// the pattern.
|
|
482
|
+
//
|
|
483
|
+
// We can just always return the same end, and leave it up to the caller
|
|
484
|
+
// to know whether it's going to be used joined or in parts.
|
|
485
|
+
// And, if the start is adjusted slightly, can do the same there:
|
|
486
|
+
// - if not isStart: nothing
|
|
487
|
+
// - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
|
|
488
|
+
// - if dots allowed or not possible: (?:/|^)
|
|
489
|
+
// - if dots possible and not allowed: (?:/|^)(?!\.)
|
|
490
|
+
//
|
|
491
|
+
// But it's better to have a simpler binding without a conditional, for
|
|
492
|
+
// performance, so probably better to return both start options.
|
|
493
|
+
//
|
|
494
|
+
// Then the caller just ignores the end if it's not the first pattern,
|
|
495
|
+
// and the start always gets applied.
|
|
496
|
+
//
|
|
497
|
+
// But that's always going to be $ if it's the ending pattern, or nothing,
|
|
498
|
+
// so the caller can just attach $ at the end of the pattern when building.
|
|
499
|
+
//
|
|
500
|
+
// So the todo is:
|
|
501
|
+
// - better detect what kind of start is needed
|
|
502
|
+
// - return both flavors of starting pattern
|
|
503
|
+
// - attach $ at the end of the pattern when creating the actual RegExp
|
|
504
|
+
//
|
|
505
|
+
// Ah, but wait, no, that all only applies to the root when the first pattern
|
|
506
|
+
// is not an extglob. If the first pattern IS an extglob, then we need all
|
|
507
|
+
// that dot prevention biz to live in the extglob portions, because eg
|
|
508
|
+
// +(*|.x*) can match .xy but not .yx.
|
|
509
|
+
//
|
|
510
|
+
// So, return the two flavors if it's #root and the first child is not an
|
|
511
|
+
// AST, otherwise leave it to the child AST to handle it, and there,
|
|
512
|
+
// use the (?:^|/) style of start binding.
|
|
513
|
+
//
|
|
514
|
+
// Even simplified further:
|
|
515
|
+
// - Since the start for a join is eg /(?!\.) and the start for a part
|
|
516
|
+
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
|
|
517
|
+
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
518
|
+
toRegExpSource(t) {
|
|
519
|
+
let e = t ?? !!this.#h.dot;
|
|
520
|
+
if (this.#t === this && this.#g(), !this.type) {
|
|
521
|
+
let a = this.isStart() && this.isEnd(), c = this.#i.map((p) => {
|
|
522
|
+
let [w, m, y, g] = typeof p == "string" ? n.#u(p, this.#e, a) : p.toRegExpSource(t);
|
|
523
|
+
return this.#e = this.#e || y, this.#n = this.#n || g, w;
|
|
524
|
+
}).join(""), f = "";
|
|
525
|
+
if (this.isStart() && typeof this.#i[0] == "string" && !(this.#i.length === 1 && Ls.has(this.#i[0]))) {
|
|
526
|
+
let w = Ns, m = (
|
|
527
|
+
// dots are allowed, and the pattern starts with [ or .
|
|
528
|
+
e && w.has(c.charAt(0)) || // the pattern starts with \., and then [ or .
|
|
529
|
+
c.startsWith("\\.") && w.has(c.charAt(2)) || // the pattern starts with \.\., and then [ or .
|
|
530
|
+
c.startsWith("\\.\\.") && w.has(c.charAt(4))
|
|
531
|
+
), y = !e && !t && w.has(c.charAt(0));
|
|
532
|
+
f = m ? _s : y ? At : "";
|
|
533
|
+
}
|
|
534
|
+
let u = "";
|
|
535
|
+
return this.isEnd() && this.#t.#f && this.#o?.type === "!" && (u = "(?:$|\\/)"), [
|
|
536
|
+
f + c + u,
|
|
537
|
+
z(c),
|
|
538
|
+
this.#e = !!this.#e,
|
|
539
|
+
this.#n
|
|
540
|
+
];
|
|
541
|
+
}
|
|
542
|
+
let s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:", r = this.#d(e);
|
|
543
|
+
if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
|
|
544
|
+
let a = this.toString();
|
|
545
|
+
return this.#i = [a], this.type = null, this.#e = void 0, [a, z(this.toString()), !1, !1];
|
|
546
|
+
}
|
|
547
|
+
let o = !s || t || e || !At ? "" : this.#d(!0);
|
|
548
|
+
o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
|
|
549
|
+
let h = "";
|
|
550
|
+
if (this.type === "!" && this.#r)
|
|
551
|
+
h = (this.isStart() && !e ? At : "") + _e;
|
|
552
|
+
else {
|
|
553
|
+
let a = this.type === "!" ? (
|
|
554
|
+
// !() must match something,but !(x) can match ''
|
|
555
|
+
"))" + (this.isStart() && !e && !t ? At : "") + Me + ")"
|
|
556
|
+
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
|
|
557
|
+
h = i + r + a;
|
|
558
|
+
}
|
|
559
|
+
return [
|
|
560
|
+
h,
|
|
561
|
+
z(r),
|
|
562
|
+
this.#e = !!this.#e,
|
|
563
|
+
this.#n
|
|
564
|
+
];
|
|
565
|
+
}
|
|
566
|
+
#d(t) {
|
|
567
|
+
return this.#i.map((e) => {
|
|
568
|
+
if (typeof e == "string")
|
|
569
|
+
throw new Error("string type in extglob ast??");
|
|
570
|
+
let [s, i, r, o] = e.toRegExpSource(t);
|
|
571
|
+
return this.#n = this.#n || o, s;
|
|
572
|
+
}).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
|
|
573
|
+
}
|
|
574
|
+
static #u(t, e, s = !1) {
|
|
575
|
+
let i = !1, r = "", o = !1;
|
|
576
|
+
for (let h = 0; h < t.length; h++) {
|
|
577
|
+
let a = t.charAt(h);
|
|
578
|
+
if (i) {
|
|
579
|
+
i = !1, r += (Ps.has(a) ? "\\" : "") + a;
|
|
580
|
+
continue;
|
|
581
|
+
}
|
|
582
|
+
if (a === "\\") {
|
|
583
|
+
h === t.length - 1 ? r += "\\\\" : i = !0;
|
|
584
|
+
continue;
|
|
585
|
+
}
|
|
586
|
+
if (a === "[") {
|
|
587
|
+
let [c, f, u, d] = Oe(t, h);
|
|
588
|
+
if (u) {
|
|
589
|
+
r += c, o = o || f, h += u - 1, e = e || d;
|
|
590
|
+
continue;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
if (a === "*") {
|
|
594
|
+
s && t === "*" ? r += _e : r += Me, e = !0;
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
if (a === "?") {
|
|
598
|
+
r += Xt, e = !0;
|
|
599
|
+
continue;
|
|
600
|
+
}
|
|
601
|
+
r += Ws(a);
|
|
602
|
+
}
|
|
603
|
+
return [r, z(t), !!e, o];
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
// ../node_modules/glob/node_modules/minimatch/dist/esm/escape.js
|
|
608
|
+
var et = /* @__PURE__ */ l((n, { windowsPathsNoEscape: t = !1 } = {}) => t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$\
|
|
609
|
+
&"), "escape");
|
|
610
|
+
|
|
611
|
+
// ../node_modules/glob/node_modules/minimatch/dist/esm/index.js
|
|
612
|
+
var F = /* @__PURE__ */ l((n, t, e = {}) => (ft(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new _(t, e).match(n)), "minimatch"), js = /^\*+([^+@!?\*\[\(]*)$/,
|
|
613
|
+
Is = /* @__PURE__ */ l((n) => (t) => !t.startsWith(".") && t.endsWith(n), "starDotExtTest"), zs = /* @__PURE__ */ l((n) => (t) => t.endsWith(
|
|
614
|
+
n), "starDotExtTestDot"), Bs = /* @__PURE__ */ l((n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n)), "st\
|
|
615
|
+
arDotExtTestNocase"), Us = /* @__PURE__ */ l((n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n)), "starDotExtTestNocaseDot"), $s = /^\*+\.\*+$/,
|
|
616
|
+
Gs = /* @__PURE__ */ l((n) => !n.startsWith(".") && n.includes("."), "starDotStarTest"), Hs = /* @__PURE__ */ l((n) => n !== "." && n !== ".\
|
|
617
|
+
." && n.includes("."), "starDotStarTestDot"), qs = /^\.\*+$/, Ks = /* @__PURE__ */ l((n) => n !== "." && n !== ".." && n.startsWith("."), "d\
|
|
618
|
+
otStarTest"), Vs = /^\*+$/, Xs = /* @__PURE__ */ l((n) => n.length !== 0 && !n.startsWith("."), "starTest"), Ys = /* @__PURE__ */ l((n) => n.
|
|
619
|
+
length !== 0 && n !== "." && n !== "..", "starTestDot"), Js = /^\?+([^+@!?\*\[\(]*)?$/, Zs = /* @__PURE__ */ l(([n, t = ""]) => {
|
|
620
|
+
let e = We([n]);
|
|
621
|
+
return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
|
|
622
|
+
}, "qmarksTestNocase"), Qs = /* @__PURE__ */ l(([n, t = ""]) => {
|
|
623
|
+
let e = je([n]);
|
|
624
|
+
return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
|
|
625
|
+
}, "qmarksTestNocaseDot"), ti = /* @__PURE__ */ l(([n, t = ""]) => {
|
|
626
|
+
let e = je([n]);
|
|
627
|
+
return t ? (s) => e(s) && s.endsWith(t) : e;
|
|
628
|
+
}, "qmarksTestDot"), ei = /* @__PURE__ */ l(([n, t = ""]) => {
|
|
629
|
+
let e = We([n]);
|
|
630
|
+
return t ? (s) => e(s) && s.endsWith(t) : e;
|
|
631
|
+
}, "qmarksTest"), We = /* @__PURE__ */ l(([n]) => {
|
|
632
|
+
let t = n.length;
|
|
633
|
+
return (e) => e.length === t && !e.startsWith(".");
|
|
634
|
+
}, "qmarksTestNoExt"), je = /* @__PURE__ */ l(([n]) => {
|
|
635
|
+
let t = n.length;
|
|
636
|
+
return (e) => e.length === t && e !== "." && e !== "..";
|
|
637
|
+
}, "qmarksTestNoExtDot"), Ie = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ ||
|
|
638
|
+
process.platform : "posix", Ne = {
|
|
639
|
+
win32: { sep: "\\" },
|
|
640
|
+
posix: { sep: "/" }
|
|
641
|
+
}, si = Ie === "win32" ? Ne.win32.sep : Ne.posix.sep;
|
|
642
|
+
F.sep = si;
|
|
643
|
+
var R = Symbol("globstar **");
|
|
644
|
+
F.GLOBSTAR = R;
|
|
645
|
+
var ii = "[^/]", ri = ii + "*?", ni = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", oi = "(?:(?!(?:\\/|^)\\.).)*?", hi = /* @__PURE__ */ l((n, t = {}) => (e) => F(
|
|
646
|
+
e, n, t), "filter");
|
|
647
|
+
F.filter = hi;
|
|
648
|
+
var L = /* @__PURE__ */ l((n, t = {}) => Object.assign({}, n, t), "ext"), ai = /* @__PURE__ */ l((n) => {
|
|
649
|
+
if (!n || typeof n != "object" || !Object.keys(n).length)
|
|
650
|
+
return F;
|
|
651
|
+
let t = F;
|
|
652
|
+
return Object.assign(/* @__PURE__ */ l((s, i, r = {}) => t(s, i, L(n, r)), "m"), {
|
|
653
|
+
Minimatch: class extends t.Minimatch {
|
|
654
|
+
static {
|
|
655
|
+
l(this, "Minimatch");
|
|
656
|
+
}
|
|
657
|
+
constructor(i, r = {}) {
|
|
658
|
+
super(i, L(n, r));
|
|
659
|
+
}
|
|
660
|
+
static defaults(i) {
|
|
661
|
+
return t.defaults(L(n, i)).Minimatch;
|
|
662
|
+
}
|
|
663
|
+
},
|
|
664
|
+
AST: class extends t.AST {
|
|
665
|
+
static {
|
|
666
|
+
l(this, "AST");
|
|
667
|
+
}
|
|
668
|
+
/* c8 ignore start */
|
|
669
|
+
constructor(i, r, o = {}) {
|
|
670
|
+
super(i, r, L(n, o));
|
|
671
|
+
}
|
|
672
|
+
/* c8 ignore stop */
|
|
673
|
+
static fromGlob(i, r = {}) {
|
|
674
|
+
return t.AST.fromGlob(i, L(n, r));
|
|
675
|
+
}
|
|
676
|
+
},
|
|
677
|
+
unescape: /* @__PURE__ */ l((s, i = {}) => t.unescape(s, L(n, i)), "unescape"),
|
|
678
|
+
escape: /* @__PURE__ */ l((s, i = {}) => t.escape(s, L(n, i)), "escape"),
|
|
679
|
+
filter: /* @__PURE__ */ l((s, i = {}) => t.filter(s, L(n, i)), "filter"),
|
|
680
|
+
defaults: /* @__PURE__ */ l((s) => t.defaults(L(n, s)), "defaults"),
|
|
681
|
+
makeRe: /* @__PURE__ */ l((s, i = {}) => t.makeRe(s, L(n, i)), "makeRe"),
|
|
682
|
+
braceExpand: /* @__PURE__ */ l((s, i = {}) => t.braceExpand(s, L(n, i)), "braceExpand"),
|
|
683
|
+
match: /* @__PURE__ */ l((s, i, r = {}) => t.match(s, i, L(n, r)), "match"),
|
|
684
|
+
sep: t.sep,
|
|
685
|
+
GLOBSTAR: R
|
|
686
|
+
});
|
|
687
|
+
}, "defaults");
|
|
688
|
+
F.defaults = ai;
|
|
689
|
+
var ze = /* @__PURE__ */ l((n, t = {}) => (ft(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : (0, Pe.default)(n)), "braceExpand");
|
|
690
|
+
F.braceExpand = ze;
|
|
691
|
+
var li = /* @__PURE__ */ l((n, t = {}) => new _(n, t).makeRe(), "makeRe");
|
|
692
|
+
F.makeRe = li;
|
|
693
|
+
var ci = /* @__PURE__ */ l((n, t, e = {}) => {
|
|
694
|
+
let s = new _(t, e);
|
|
695
|
+
return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n;
|
|
696
|
+
}, "match");
|
|
697
|
+
F.match = ci;
|
|
698
|
+
var Le = /[?*]|[+@!]\(.*?\)|\[|\]/, fi = /* @__PURE__ */ l((n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), "regExpEscape"), _ = class {
|
|
699
|
+
static {
|
|
700
|
+
l(this, "Minimatch");
|
|
701
|
+
}
|
|
702
|
+
options;
|
|
703
|
+
set;
|
|
704
|
+
pattern;
|
|
705
|
+
windowsPathsNoEscape;
|
|
706
|
+
nonegate;
|
|
707
|
+
negate;
|
|
708
|
+
comment;
|
|
709
|
+
empty;
|
|
710
|
+
preserveMultipleSlashes;
|
|
711
|
+
partial;
|
|
712
|
+
globSet;
|
|
713
|
+
globParts;
|
|
714
|
+
nocase;
|
|
715
|
+
isWindows;
|
|
716
|
+
platform;
|
|
717
|
+
windowsNoMagicRoot;
|
|
718
|
+
regexp;
|
|
719
|
+
constructor(t, e = {}) {
|
|
720
|
+
ft(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ie, this.isWindows = this.platform === "win32", this.
|
|
721
|
+
windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.
|
|
722
|
+
replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!e.
|
|
723
|
+
nonegate, this.comment = !1, this.empty = !1, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot =
|
|
724
|
+
e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.
|
|
725
|
+
set = [], this.make();
|
|
726
|
+
}
|
|
727
|
+
hasMagic() {
|
|
728
|
+
if (this.options.magicalBraces && this.set.length > 1)
|
|
729
|
+
return !0;
|
|
730
|
+
for (let t of this.set)
|
|
731
|
+
for (let e of t)
|
|
732
|
+
if (typeof e != "string")
|
|
733
|
+
return !0;
|
|
734
|
+
return !1;
|
|
735
|
+
}
|
|
736
|
+
debug(...t) {
|
|
737
|
+
}
|
|
738
|
+
make() {
|
|
739
|
+
let t = this.pattern, e = this.options;
|
|
740
|
+
if (!e.nocomment && t.charAt(0) === "#") {
|
|
741
|
+
this.comment = !0;
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
if (!t) {
|
|
745
|
+
this.empty = !0;
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(
|
|
749
|
+
this.pattern, this.globSet);
|
|
750
|
+
let s = this.globSet.map((r) => this.slashSplit(r));
|
|
751
|
+
this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts);
|
|
752
|
+
let i = this.globParts.map((r, o, h) => {
|
|
753
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
754
|
+
let a = r[0] === "" && r[1] === "" && (r[2] === "?" || !Le.test(r[2])) && !Le.test(r[3]), c = /^[a-z]:/i.test(r[0]);
|
|
755
|
+
if (a)
|
|
756
|
+
return [...r.slice(0, 4), ...r.slice(4).map((f) => this.parse(f))];
|
|
757
|
+
if (c)
|
|
758
|
+
return [r[0], ...r.slice(1).map((f) => this.parse(f))];
|
|
759
|
+
}
|
|
760
|
+
return r.map((a) => this.parse(a));
|
|
761
|
+
});
|
|
762
|
+
if (this.debug(this.pattern, i), this.set = i.filter((r) => r.indexOf(!1) === -1), this.isWindows)
|
|
763
|
+
for (let r = 0; r < this.set.length; r++) {
|
|
764
|
+
let o = this.set[r];
|
|
765
|
+
o[0] === "" && o[1] === "" && this.globParts[r][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
|
|
766
|
+
}
|
|
767
|
+
this.debug(this.pattern, this.set);
|
|
768
|
+
}
|
|
769
|
+
// various transforms to equivalent pattern sets that are
|
|
770
|
+
// faster to process in a filesystem walk. The goal is to
|
|
771
|
+
// eliminate what we can, and push all ** patterns as far
|
|
772
|
+
// to the right as possible, even if it increases the number
|
|
773
|
+
// of patterns that we have to process.
|
|
774
|
+
preprocess(t) {
|
|
775
|
+
if (this.options.noglobstar)
|
|
776
|
+
for (let s = 0; s < t.length; s++)
|
|
777
|
+
for (let i = 0; i < t[s].length; i++)
|
|
778
|
+
t[s][i] === "**" && (t[s][i] = "*");
|
|
779
|
+
let { optimizationLevel: e = 1 } = this.options;
|
|
780
|
+
return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.
|
|
781
|
+
adjascentGlobstarOptimize(t), t;
|
|
782
|
+
}
|
|
783
|
+
// just get rid of adjascent ** portions
|
|
784
|
+
adjascentGlobstarOptimize(t) {
|
|
785
|
+
return t.map((e) => {
|
|
786
|
+
let s = -1;
|
|
787
|
+
for (; (s = e.indexOf("**", s + 1)) !== -1; ) {
|
|
788
|
+
let i = s;
|
|
789
|
+
for (; e[i + 1] === "**"; )
|
|
790
|
+
i++;
|
|
791
|
+
i !== s && e.splice(s, i - s);
|
|
792
|
+
}
|
|
793
|
+
return e;
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
// get rid of adjascent ** and resolve .. portions
|
|
797
|
+
levelOneOptimize(t) {
|
|
798
|
+
return t.map((e) => (e = e.reduce((s, i) => {
|
|
799
|
+
let r = s[s.length - 1];
|
|
800
|
+
return i === "**" && r === "**" ? s : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (s.pop(), s) : (s.push(i), s);
|
|
801
|
+
}, []), e.length === 0 ? [""] : e));
|
|
802
|
+
}
|
|
803
|
+
levelTwoFileOptimize(t) {
|
|
804
|
+
Array.isArray(t) || (t = this.slashSplit(t));
|
|
805
|
+
let e = !1;
|
|
806
|
+
do {
|
|
807
|
+
if (e = !1, !this.preserveMultipleSlashes) {
|
|
808
|
+
for (let i = 1; i < t.length - 1; i++) {
|
|
809
|
+
let r = t[i];
|
|
810
|
+
i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = !0, t.splice(i, 1), i--);
|
|
811
|
+
}
|
|
812
|
+
t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = !0, t.pop());
|
|
813
|
+
}
|
|
814
|
+
let s = 0;
|
|
815
|
+
for (; (s = t.indexOf("..", s + 1)) !== -1; ) {
|
|
816
|
+
let i = t[s - 1];
|
|
817
|
+
i && i !== "." && i !== ".." && i !== "**" && (e = !0, t.splice(s - 1, 2), s -= 2);
|
|
818
|
+
}
|
|
819
|
+
} while (e);
|
|
820
|
+
return t.length === 0 ? [""] : t;
|
|
821
|
+
}
|
|
822
|
+
// First phase: single-pattern processing
|
|
823
|
+
// <pre> is 1 or more portions
|
|
824
|
+
// <rest> is 1 or more portions
|
|
825
|
+
// <p> is any portion other than ., .., '', or **
|
|
826
|
+
// <e> is . or ''
|
|
827
|
+
//
|
|
828
|
+
// **/.. is *brutal* for filesystem walking performance, because
|
|
829
|
+
// it effectively resets the recursive walk each time it occurs,
|
|
830
|
+
// and ** cannot be reduced out by a .. pattern part like a regexp
|
|
831
|
+
// or most strings (other than .., ., and '') can be.
|
|
832
|
+
//
|
|
833
|
+
// <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
|
|
834
|
+
// <pre>/<e>/<rest> -> <pre>/<rest>
|
|
835
|
+
// <pre>/<p>/../<rest> -> <pre>/<rest>
|
|
836
|
+
// **/**/<rest> -> **/<rest>
|
|
837
|
+
//
|
|
838
|
+
// **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
|
|
839
|
+
// this WOULD be allowed if ** did follow symlinks, or * didn't
|
|
840
|
+
firstPhasePreProcess(t) {
|
|
841
|
+
let e = !1;
|
|
842
|
+
do {
|
|
843
|
+
e = !1;
|
|
844
|
+
for (let s of t) {
|
|
845
|
+
let i = -1;
|
|
846
|
+
for (; (i = s.indexOf("**", i + 1)) !== -1; ) {
|
|
847
|
+
let o = i;
|
|
848
|
+
for (; s[o + 1] === "**"; )
|
|
849
|
+
o++;
|
|
850
|
+
o > i && s.splice(i + 1, o - i);
|
|
851
|
+
let h = s[i + 1], a = s[i + 2], c = s[i + 3];
|
|
852
|
+
if (h !== ".." || !a || a === "." || a === ".." || !c || c === "." || c === "..")
|
|
853
|
+
continue;
|
|
854
|
+
e = !0, s.splice(i, 1);
|
|
855
|
+
let f = s.slice(0);
|
|
856
|
+
f[i] = "**", t.push(f), i--;
|
|
857
|
+
}
|
|
858
|
+
if (!this.preserveMultipleSlashes) {
|
|
859
|
+
for (let o = 1; o < s.length - 1; o++) {
|
|
860
|
+
let h = s[o];
|
|
861
|
+
o === 1 && h === "" && s[0] === "" || (h === "." || h === "") && (e = !0, s.splice(o, 1), o--);
|
|
862
|
+
}
|
|
863
|
+
s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = !0, s.pop());
|
|
864
|
+
}
|
|
865
|
+
let r = 0;
|
|
866
|
+
for (; (r = s.indexOf("..", r + 1)) !== -1; ) {
|
|
867
|
+
let o = s[r - 1];
|
|
868
|
+
if (o && o !== "." && o !== ".." && o !== "**") {
|
|
869
|
+
e = !0;
|
|
870
|
+
let a = r === 1 && s[r + 1] === "**" ? ["."] : [];
|
|
871
|
+
s.splice(r - 1, 2, ...a), s.length === 0 && s.push(""), r -= 2;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
} while (e);
|
|
876
|
+
return t;
|
|
877
|
+
}
|
|
878
|
+
// second phase: multi-pattern dedupes
|
|
879
|
+
// {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
|
|
880
|
+
// {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
|
|
881
|
+
// {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
|
|
882
|
+
//
|
|
883
|
+
// {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
|
|
884
|
+
// ^-- not valid because ** doens't follow symlinks
|
|
885
|
+
secondPhasePreProcess(t) {
|
|
886
|
+
for (let e = 0; e < t.length - 1; e++)
|
|
887
|
+
for (let s = e + 1; s < t.length; s++) {
|
|
888
|
+
let i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
|
|
889
|
+
if (i) {
|
|
890
|
+
t[e] = [], t[s] = i;
|
|
891
|
+
break;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
return t.filter((e) => e.length);
|
|
895
|
+
}
|
|
896
|
+
partsMatch(t, e, s = !1) {
|
|
897
|
+
let i = 0, r = 0, o = [], h = "";
|
|
898
|
+
for (; i < t.length && r < e.length; )
|
|
899
|
+
if (t[i] === e[r])
|
|
900
|
+
o.push(h === "b" ? e[r] : t[i]), i++, r++;
|
|
901
|
+
else if (s && t[i] === "**" && e[r] === t[i + 1])
|
|
902
|
+
o.push(t[i]), i++;
|
|
903
|
+
else if (s && e[r] === "**" && t[i] === e[r + 1])
|
|
904
|
+
o.push(e[r]), r++;
|
|
905
|
+
else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
|
|
906
|
+
if (h === "b")
|
|
907
|
+
return !1;
|
|
908
|
+
h = "a", o.push(t[i]), i++, r++;
|
|
909
|
+
} else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
|
|
910
|
+
if (h === "a")
|
|
911
|
+
return !1;
|
|
912
|
+
h = "b", o.push(e[r]), i++, r++;
|
|
913
|
+
} else
|
|
914
|
+
return !1;
|
|
915
|
+
return t.length === e.length && o;
|
|
916
|
+
}
|
|
917
|
+
parseNegate() {
|
|
918
|
+
if (this.nonegate)
|
|
919
|
+
return;
|
|
920
|
+
let t = this.pattern, e = !1, s = 0;
|
|
921
|
+
for (let i = 0; i < t.length && t.charAt(i) === "!"; i++)
|
|
922
|
+
e = !e, s++;
|
|
923
|
+
s && (this.pattern = t.slice(s)), this.negate = e;
|
|
924
|
+
}
|
|
925
|
+
// set partial to true to test if, for example,
|
|
926
|
+
// "/a/b" matches the start of "/*/b/*/d"
|
|
927
|
+
// Partial means, if you run out of file before you run
|
|
928
|
+
// out of pattern, then that's fine, as long as all
|
|
929
|
+
// the parts match.
|
|
930
|
+
matchOne(t, e, s = !1) {
|
|
931
|
+
let i = this.options;
|
|
932
|
+
if (this.isWindows) {
|
|
933
|
+
let m = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), y = !m && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]),
|
|
934
|
+
g = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), E = !g && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" &&
|
|
935
|
+
/^[a-z]:$/i.test(e[3]), S = y ? 3 : m ? 0 : void 0, b = E ? 3 : g ? 0 : void 0;
|
|
936
|
+
if (typeof S == "number" && typeof b == "number") {
|
|
937
|
+
let [x, T] = [t[S], e[b]];
|
|
938
|
+
x.toLowerCase() === T.toLowerCase() && (e[b] = x, b > S ? e = e.slice(b) : S > b && (t = t.slice(S)));
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
let { optimizationLevel: r = 1 } = this.options;
|
|
942
|
+
r >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.
|
|
943
|
+
length);
|
|
944
|
+
for (var o = 0, h = 0, a = t.length, c = e.length; o < a && h < c; o++, h++) {
|
|
945
|
+
this.debug("matchOne loop");
|
|
946
|
+
var f = e[h], u = t[o];
|
|
947
|
+
if (this.debug(e, f, u), f === !1)
|
|
948
|
+
return !1;
|
|
949
|
+
if (f === R) {
|
|
950
|
+
this.debug("GLOBSTAR", [e, f, u]);
|
|
951
|
+
var d = o, p = h + 1;
|
|
952
|
+
if (p === c) {
|
|
953
|
+
for (this.debug("** at the end"); o < a; o++)
|
|
954
|
+
if (t[o] === "." || t[o] === ".." || !i.dot && t[o].charAt(0) === ".")
|
|
955
|
+
return !1;
|
|
956
|
+
return !0;
|
|
957
|
+
}
|
|
958
|
+
for (; d < a; ) {
|
|
959
|
+
var w = t[d];
|
|
960
|
+
if (this.debug(`
|
|
961
|
+
globstar while`, t, d, e, p, w), this.matchOne(t.slice(d), e.slice(p), s))
|
|
962
|
+
return this.debug("globstar found match!", d, a, w), !0;
|
|
963
|
+
if (w === "." || w === ".." || !i.dot && w.charAt(0) === ".") {
|
|
964
|
+
this.debug("dot detected!", t, d, e, p);
|
|
965
|
+
break;
|
|
966
|
+
}
|
|
967
|
+
this.debug("globstar swallow a segment, and continue"), d++;
|
|
968
|
+
}
|
|
969
|
+
return !!(s && (this.debug(`
|
|
970
|
+
>>> no match, partial?`, t, d, e, p), d === a));
|
|
971
|
+
}
|
|
972
|
+
let m;
|
|
973
|
+
if (typeof f == "string" ? (m = u === f, this.debug("string match", f, u, m)) : (m = f.test(u), this.debug("pattern match", f, u, m)),
|
|
974
|
+
!m)
|
|
975
|
+
return !1;
|
|
976
|
+
}
|
|
977
|
+
if (o === a && h === c)
|
|
978
|
+
return !0;
|
|
979
|
+
if (o === a)
|
|
980
|
+
return s;
|
|
981
|
+
if (h === c)
|
|
982
|
+
return o === a - 1 && t[o] === "";
|
|
983
|
+
throw new Error("wtf?");
|
|
984
|
+
}
|
|
985
|
+
braceExpand() {
|
|
986
|
+
return ze(this.pattern, this.options);
|
|
987
|
+
}
|
|
988
|
+
parse(t) {
|
|
989
|
+
ft(t);
|
|
990
|
+
let e = this.options;
|
|
991
|
+
if (t === "**")
|
|
992
|
+
return R;
|
|
993
|
+
if (t === "")
|
|
994
|
+
return "";
|
|
995
|
+
let s, i = null;
|
|
996
|
+
(s = t.match(Vs)) ? i = e.dot ? Ys : Xs : (s = t.match(js)) ? i = (e.nocase ? e.dot ? Us : Bs : e.dot ? zs : Is)(s[1]) : (s = t.match(Js)) ?
|
|
997
|
+
i = (e.nocase ? e.dot ? Qs : Zs : e.dot ? ti : ei)(s) : (s = t.match($s)) ? i = e.dot ? Hs : Gs : (s = t.match(qs)) && (i = Ks);
|
|
998
|
+
let r = tt.fromGlob(t, this.options).toMMPattern();
|
|
999
|
+
return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
|
|
1000
|
+
}
|
|
1001
|
+
makeRe() {
|
|
1002
|
+
if (this.regexp || this.regexp === !1)
|
|
1003
|
+
return this.regexp;
|
|
1004
|
+
let t = this.set;
|
|
1005
|
+
if (!t.length)
|
|
1006
|
+
return this.regexp = !1, this.regexp;
|
|
1007
|
+
let e = this.options, s = e.noglobstar ? ri : e.dot ? ni : oi, i = new Set(e.nocase ? ["i"] : []), r = t.map((a) => {
|
|
1008
|
+
let c = a.map((f) => {
|
|
1009
|
+
if (f instanceof RegExp)
|
|
1010
|
+
for (let u of f.flags.split(""))
|
|
1011
|
+
i.add(u);
|
|
1012
|
+
return typeof f == "string" ? fi(f) : f === R ? R : f._src;
|
|
1013
|
+
});
|
|
1014
|
+
return c.forEach((f, u) => {
|
|
1015
|
+
let d = c[u + 1], p = c[u - 1];
|
|
1016
|
+
f !== R || p === R || (p === void 0 ? d !== void 0 && d !== R ? c[u + 1] = "(?:\\/|" + s + "\\/)?" + d : c[u] = s : d === void 0 ? c[u -
|
|
1017
|
+
1] = p + "(?:\\/|" + s + ")?" : d !== R && (c[u - 1] = p + "(?:\\/|\\/" + s + "\\/)" + d, c[u + 1] = R));
|
|
1018
|
+
}), c.filter((f) => f !== R).join("/");
|
|
1019
|
+
}).join("|"), [o, h] = t.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
1020
|
+
r = "^" + o + r + h + "$", this.negate && (r = "^(?!" + r + ").+$");
|
|
1021
|
+
try {
|
|
1022
|
+
this.regexp = new RegExp(r, [...i].join(""));
|
|
1023
|
+
} catch {
|
|
1024
|
+
this.regexp = !1;
|
|
1025
|
+
}
|
|
1026
|
+
return this.regexp;
|
|
1027
|
+
}
|
|
1028
|
+
slashSplit(t) {
|
|
1029
|
+
return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^\/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/);
|
|
1030
|
+
}
|
|
1031
|
+
match(t, e = this.partial) {
|
|
1032
|
+
if (this.debug("match", t, this.pattern), this.comment)
|
|
1033
|
+
return !1;
|
|
1034
|
+
if (this.empty)
|
|
1035
|
+
return t === "";
|
|
1036
|
+
if (t === "/" && e)
|
|
1037
|
+
return !0;
|
|
1038
|
+
let s = this.options;
|
|
1039
|
+
this.isWindows && (t = t.split("\\").join("/"));
|
|
1040
|
+
let i = this.slashSplit(t);
|
|
1041
|
+
this.debug(this.pattern, "split", i);
|
|
1042
|
+
let r = this.set;
|
|
1043
|
+
this.debug(this.pattern, "set", r);
|
|
1044
|
+
let o = i[i.length - 1];
|
|
1045
|
+
if (!o)
|
|
1046
|
+
for (let h = i.length - 2; !o && h >= 0; h--)
|
|
1047
|
+
o = i[h];
|
|
1048
|
+
for (let h = 0; h < r.length; h++) {
|
|
1049
|
+
let a = r[h], c = i;
|
|
1050
|
+
if (s.matchBase && a.length === 1 && (c = [o]), this.matchOne(c, a, e))
|
|
1051
|
+
return s.flipNegate ? !0 : !this.negate;
|
|
1052
|
+
}
|
|
1053
|
+
return s.flipNegate ? !1 : this.negate;
|
|
1054
|
+
}
|
|
1055
|
+
static defaults(t) {
|
|
1056
|
+
return F.defaults(t).Minimatch;
|
|
1057
|
+
}
|
|
1058
|
+
};
|
|
1059
|
+
F.AST = tt;
|
|
1060
|
+
F.Minimatch = _;
|
|
1061
|
+
F.escape = et;
|
|
1062
|
+
F.unescape = z;
|
|
1063
|
+
|
|
1064
|
+
// ../node_modules/glob/dist/esm/glob.js
|
|
1065
|
+
import { fileURLToPath as $i } from "node:url";
|
|
1066
|
+
|
|
1067
|
+
// ../node_modules/lru-cache/dist/esm/index.js
|
|
1068
|
+
var st = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, Ue = /* @__PURE__ */ new Set(),
|
|
1069
|
+
Yt = typeof process == "object" && process ? process : {}, $e = /* @__PURE__ */ l((n, t, e, s) => {
|
|
1070
|
+
typeof Yt.emitWarning == "function" ? Yt.emitWarning(n, t, e, s) : console.error(`[${e}] ${t}: ${n}`);
|
|
1071
|
+
}, "emitWarning"), Rt = globalThis.AbortController, Be = globalThis.AbortSignal;
|
|
1072
|
+
if (typeof Rt > "u") {
|
|
1073
|
+
Be = class {
|
|
1074
|
+
static {
|
|
1075
|
+
l(this, "AbortSignal");
|
|
1076
|
+
}
|
|
1077
|
+
onabort;
|
|
1078
|
+
_onabort = [];
|
|
1079
|
+
reason;
|
|
1080
|
+
aborted = !1;
|
|
1081
|
+
addEventListener(s, i) {
|
|
1082
|
+
this._onabort.push(i);
|
|
1083
|
+
}
|
|
1084
|
+
}, Rt = class {
|
|
1085
|
+
static {
|
|
1086
|
+
l(this, "AbortController");
|
|
1087
|
+
}
|
|
1088
|
+
constructor() {
|
|
1089
|
+
t();
|
|
1090
|
+
}
|
|
1091
|
+
signal = new Be();
|
|
1092
|
+
abort(s) {
|
|
1093
|
+
if (!this.signal.aborted) {
|
|
1094
|
+
this.signal.reason = s, this.signal.aborted = !0;
|
|
1095
|
+
for (let i of this.signal._onabort)
|
|
1096
|
+
i(s);
|
|
1097
|
+
this.signal.onabort?.(s);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
};
|
|
1101
|
+
let n = Yt.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = /* @__PURE__ */ l(() => {
|
|
1102
|
+
n && (n = !1, $e("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-c\
|
|
1103
|
+
ontroller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, pass\
|
|
1104
|
+
ing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WAR\
|
|
1105
|
+
NING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
|
|
1106
|
+
}, "warnACPolyfill");
|
|
1107
|
+
}
|
|
1108
|
+
var ui = /* @__PURE__ */ l((n) => !Ue.has(n), "shouldWarn"), Dr = Symbol("type"), V = /* @__PURE__ */ l((n) => n && n === Math.floor(n) && n >
|
|
1109
|
+
0 && isFinite(n), "isPosInt"), Ge = /* @__PURE__ */ l((n) => V(n) ? n <= Math.pow(2, 8) ? Uint8Array : n <= Math.pow(2, 16) ? Uint16Array : n <=
|
|
1110
|
+
Math.pow(2, 32) ? Uint32Array : n <= Number.MAX_SAFE_INTEGER ? it : null : null, "getUintArray"), it = class extends Array {
|
|
1111
|
+
static {
|
|
1112
|
+
l(this, "ZeroArray");
|
|
1113
|
+
}
|
|
1114
|
+
constructor(t) {
|
|
1115
|
+
super(t), this.fill(0);
|
|
1116
|
+
}
|
|
1117
|
+
}, Jt = class n {
|
|
1118
|
+
static {
|
|
1119
|
+
l(this, "Stack");
|
|
1120
|
+
}
|
|
1121
|
+
heap;
|
|
1122
|
+
length;
|
|
1123
|
+
// private constructor
|
|
1124
|
+
static #t = !1;
|
|
1125
|
+
static create(t) {
|
|
1126
|
+
let e = Ge(t);
|
|
1127
|
+
if (!e)
|
|
1128
|
+
return [];
|
|
1129
|
+
n.#t = !0;
|
|
1130
|
+
let s = new n(t, e);
|
|
1131
|
+
return n.#t = !1, s;
|
|
1132
|
+
}
|
|
1133
|
+
constructor(t, e) {
|
|
1134
|
+
if (!n.#t)
|
|
1135
|
+
throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
1136
|
+
this.heap = new e(t), this.length = 0;
|
|
1137
|
+
}
|
|
1138
|
+
push(t) {
|
|
1139
|
+
this.heap[this.length++] = t;
|
|
1140
|
+
}
|
|
1141
|
+
pop() {
|
|
1142
|
+
return this.heap[--this.length];
|
|
1143
|
+
}
|
|
1144
|
+
}, dt = class n {
|
|
1145
|
+
static {
|
|
1146
|
+
l(this, "LRUCache");
|
|
1147
|
+
}
|
|
1148
|
+
// options that cannot be changed without disaster
|
|
1149
|
+
#t;
|
|
1150
|
+
#e;
|
|
1151
|
+
#n;
|
|
1152
|
+
#i;
|
|
1153
|
+
#o;
|
|
1154
|
+
#S;
|
|
1155
|
+
/**
|
|
1156
|
+
* {@link LRUCache.OptionsBase.ttl}
|
|
1157
|
+
*/
|
|
1158
|
+
ttl;
|
|
1159
|
+
/**
|
|
1160
|
+
* {@link LRUCache.OptionsBase.ttlResolution}
|
|
1161
|
+
*/
|
|
1162
|
+
ttlResolution;
|
|
1163
|
+
/**
|
|
1164
|
+
* {@link LRUCache.OptionsBase.ttlAutopurge}
|
|
1165
|
+
*/
|
|
1166
|
+
ttlAutopurge;
|
|
1167
|
+
/**
|
|
1168
|
+
* {@link LRUCache.OptionsBase.updateAgeOnGet}
|
|
1169
|
+
*/
|
|
1170
|
+
updateAgeOnGet;
|
|
1171
|
+
/**
|
|
1172
|
+
* {@link LRUCache.OptionsBase.updateAgeOnHas}
|
|
1173
|
+
*/
|
|
1174
|
+
updateAgeOnHas;
|
|
1175
|
+
/**
|
|
1176
|
+
* {@link LRUCache.OptionsBase.allowStale}
|
|
1177
|
+
*/
|
|
1178
|
+
allowStale;
|
|
1179
|
+
/**
|
|
1180
|
+
* {@link LRUCache.OptionsBase.noDisposeOnSet}
|
|
1181
|
+
*/
|
|
1182
|
+
noDisposeOnSet;
|
|
1183
|
+
/**
|
|
1184
|
+
* {@link LRUCache.OptionsBase.noUpdateTTL}
|
|
1185
|
+
*/
|
|
1186
|
+
noUpdateTTL;
|
|
1187
|
+
/**
|
|
1188
|
+
* {@link LRUCache.OptionsBase.maxEntrySize}
|
|
1189
|
+
*/
|
|
1190
|
+
maxEntrySize;
|
|
1191
|
+
/**
|
|
1192
|
+
* {@link LRUCache.OptionsBase.sizeCalculation}
|
|
1193
|
+
*/
|
|
1194
|
+
sizeCalculation;
|
|
1195
|
+
/**
|
|
1196
|
+
* {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
|
|
1197
|
+
*/
|
|
1198
|
+
noDeleteOnFetchRejection;
|
|
1199
|
+
/**
|
|
1200
|
+
* {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
|
|
1201
|
+
*/
|
|
1202
|
+
noDeleteOnStaleGet;
|
|
1203
|
+
/**
|
|
1204
|
+
* {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
|
|
1205
|
+
*/
|
|
1206
|
+
allowStaleOnFetchAbort;
|
|
1207
|
+
/**
|
|
1208
|
+
* {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
|
|
1209
|
+
*/
|
|
1210
|
+
allowStaleOnFetchRejection;
|
|
1211
|
+
/**
|
|
1212
|
+
* {@link LRUCache.OptionsBase.ignoreFetchAbort}
|
|
1213
|
+
*/
|
|
1214
|
+
ignoreFetchAbort;
|
|
1215
|
+
// computed properties
|
|
1216
|
+
#l;
|
|
1217
|
+
#f;
|
|
1218
|
+
#h;
|
|
1219
|
+
#a;
|
|
1220
|
+
#r;
|
|
1221
|
+
#g;
|
|
1222
|
+
#w;
|
|
1223
|
+
#d;
|
|
1224
|
+
#u;
|
|
1225
|
+
#v;
|
|
1226
|
+
#m;
|
|
1227
|
+
#T;
|
|
1228
|
+
#C;
|
|
1229
|
+
#b;
|
|
1230
|
+
#E;
|
|
1231
|
+
#x;
|
|
1232
|
+
#p;
|
|
1233
|
+
/**
|
|
1234
|
+
* Do not call this method unless you need to inspect the
|
|
1235
|
+
* inner workings of the cache. If anything returned by this
|
|
1236
|
+
* object is modified in any way, strange breakage may occur.
|
|
1237
|
+
*
|
|
1238
|
+
* These fields are private for a reason!
|
|
1239
|
+
*
|
|
1240
|
+
* @internal
|
|
1241
|
+
*/
|
|
1242
|
+
static unsafeExposeInternals(t) {
|
|
1243
|
+
return {
|
|
1244
|
+
// properties
|
|
1245
|
+
starts: t.#C,
|
|
1246
|
+
ttls: t.#b,
|
|
1247
|
+
sizes: t.#T,
|
|
1248
|
+
keyMap: t.#h,
|
|
1249
|
+
keyList: t.#a,
|
|
1250
|
+
valList: t.#r,
|
|
1251
|
+
next: t.#g,
|
|
1252
|
+
prev: t.#w,
|
|
1253
|
+
get head() {
|
|
1254
|
+
return t.#d;
|
|
1255
|
+
},
|
|
1256
|
+
get tail() {
|
|
1257
|
+
return t.#u;
|
|
1258
|
+
},
|
|
1259
|
+
free: t.#v,
|
|
1260
|
+
// methods
|
|
1261
|
+
isBackgroundFetch: /* @__PURE__ */ l((e) => t.#c(e), "isBackgroundFetch"),
|
|
1262
|
+
backgroundFetch: /* @__PURE__ */ l((e, s, i, r) => t.#j(e, s, i, r), "backgroundFetch"),
|
|
1263
|
+
moveToTail: /* @__PURE__ */ l((e) => t.#z(e), "moveToTail"),
|
|
1264
|
+
indexes: /* @__PURE__ */ l((e) => t.#A(e), "indexes"),
|
|
1265
|
+
rindexes: /* @__PURE__ */ l((e) => t.#R(e), "rindexes"),
|
|
1266
|
+
isStale: /* @__PURE__ */ l((e) => t.#y(e), "isStale")
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
// Protected read-only members
|
|
1270
|
+
/**
|
|
1271
|
+
* {@link LRUCache.OptionsBase.max} (read-only)
|
|
1272
|
+
*/
|
|
1273
|
+
get max() {
|
|
1274
|
+
return this.#t;
|
|
1275
|
+
}
|
|
1276
|
+
/**
|
|
1277
|
+
* {@link LRUCache.OptionsBase.maxSize} (read-only)
|
|
1278
|
+
*/
|
|
1279
|
+
get maxSize() {
|
|
1280
|
+
return this.#e;
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* The total computed size of items in the cache (read-only)
|
|
1284
|
+
*/
|
|
1285
|
+
get calculatedSize() {
|
|
1286
|
+
return this.#f;
|
|
1287
|
+
}
|
|
1288
|
+
/**
|
|
1289
|
+
* The number of items stored in the cache (read-only)
|
|
1290
|
+
*/
|
|
1291
|
+
get size() {
|
|
1292
|
+
return this.#l;
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* {@link LRUCache.OptionsBase.fetchMethod} (read-only)
|
|
1296
|
+
*/
|
|
1297
|
+
get fetchMethod() {
|
|
1298
|
+
return this.#o;
|
|
1299
|
+
}
|
|
1300
|
+
get memoMethod() {
|
|
1301
|
+
return this.#S;
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* {@link LRUCache.OptionsBase.dispose} (read-only)
|
|
1305
|
+
*/
|
|
1306
|
+
get dispose() {
|
|
1307
|
+
return this.#n;
|
|
1308
|
+
}
|
|
1309
|
+
/**
|
|
1310
|
+
* {@link LRUCache.OptionsBase.disposeAfter} (read-only)
|
|
1311
|
+
*/
|
|
1312
|
+
get disposeAfter() {
|
|
1313
|
+
return this.#i;
|
|
1314
|
+
}
|
|
1315
|
+
constructor(t) {
|
|
1316
|
+
let { max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: r, updateAgeOnGet: o, updateAgeOnHas: h, allowStale: a, dispose: c, disposeAfter: f,
|
|
1317
|
+
noDisposeOnSet: u, noUpdateTTL: d, maxSize: p = 0, maxEntrySize: w = 0, sizeCalculation: m, fetchMethod: y, memoMethod: g, noDeleteOnFetchRejection: E,
|
|
1318
|
+
noDeleteOnStaleGet: S, allowStaleOnFetchRejection: b, allowStaleOnFetchAbort: x, ignoreFetchAbort: T } = t;
|
|
1319
|
+
if (e !== 0 && !V(e))
|
|
1320
|
+
throw new TypeError("max option must be a nonnegative integer");
|
|
1321
|
+
let j = e ? Ge(e) : Array;
|
|
1322
|
+
if (!j)
|
|
1323
|
+
throw new Error("invalid max value: " + e);
|
|
1324
|
+
if (this.#t = e, this.#e = p, this.maxEntrySize = w || this.#e, this.sizeCalculation = m, this.sizeCalculation) {
|
|
1325
|
+
if (!this.#e && !this.maxEntrySize)
|
|
1326
|
+
throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
1327
|
+
if (typeof this.sizeCalculation != "function")
|
|
1328
|
+
throw new TypeError("sizeCalculation set to non-function");
|
|
1329
|
+
}
|
|
1330
|
+
if (g !== void 0 && typeof g != "function")
|
|
1331
|
+
throw new TypeError("memoMethod must be a function if defined");
|
|
1332
|
+
if (this.#S = g, y !== void 0 && typeof y != "function")
|
|
1333
|
+
throw new TypeError("fetchMethod must be a function if specified");
|
|
1334
|
+
if (this.#o = y, this.#x = !!y, this.#h = /* @__PURE__ */ new Map(), this.#a = new Array(e).fill(void 0), this.#r = new Array(e).fill(void 0),
|
|
1335
|
+
this.#g = new j(e), this.#w = new j(e), this.#d = 0, this.#u = 0, this.#v = Jt.create(e), this.#l = 0, this.#f = 0, typeof c == "functio\
|
|
1336
|
+
n" && (this.#n = c), typeof f == "function" ? (this.#i = f, this.#m = []) : (this.#i = void 0, this.#m = void 0), this.#E = !!this.#n, this.#p =
|
|
1337
|
+
!!this.#i, this.noDisposeOnSet = !!u, this.noUpdateTTL = !!d, this.noDeleteOnFetchRejection = !!E, this.allowStaleOnFetchRejection = !!b,
|
|
1338
|
+
this.allowStaleOnFetchAbort = !!x, this.ignoreFetchAbort = !!T, this.maxEntrySize !== 0) {
|
|
1339
|
+
if (this.#e !== 0 && !V(this.#e))
|
|
1340
|
+
throw new TypeError("maxSize must be a positive integer if specified");
|
|
1341
|
+
if (!V(this.maxEntrySize))
|
|
1342
|
+
throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
1343
|
+
this.#O();
|
|
1344
|
+
}
|
|
1345
|
+
if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!S, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!h, this.ttlResolution = V(i) ||
|
|
1346
|
+
i === 0 ? i : 1, this.ttlAutopurge = !!r, this.ttl = s || 0, this.ttl) {
|
|
1347
|
+
if (!V(this.ttl))
|
|
1348
|
+
throw new TypeError("ttl must be a positive integer if specified");
|
|
1349
|
+
this.#D();
|
|
1350
|
+
}
|
|
1351
|
+
if (this.#t === 0 && this.ttl === 0 && this.#e === 0)
|
|
1352
|
+
throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
1353
|
+
if (!this.ttlAutopurge && !this.#t && !this.#e) {
|
|
1354
|
+
let J = "LRU_CACHE_UNBOUNDED";
|
|
1355
|
+
ui(J) && (Ue.add(J), $e("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCac\
|
|
1356
|
+
heWarning", J, n));
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Return the number of ms left in the item's TTL. If item is not in cache,
|
|
1361
|
+
* returns `0`. Returns `Infinity` if item is in cache without a defined TTL.
|
|
1362
|
+
*/
|
|
1363
|
+
getRemainingTTL(t) {
|
|
1364
|
+
return this.#h.has(t) ? 1 / 0 : 0;
|
|
1365
|
+
}
|
|
1366
|
+
#D() {
|
|
1367
|
+
let t = new it(this.#t), e = new it(this.#t);
|
|
1368
|
+
this.#b = t, this.#C = e, this.#M = (r, o, h = st.now()) => {
|
|
1369
|
+
if (e[r] = o !== 0 ? h : 0, t[r] = o, o !== 0 && this.ttlAutopurge) {
|
|
1370
|
+
let a = setTimeout(() => {
|
|
1371
|
+
this.#y(r) && this.#F(this.#a[r], "expire");
|
|
1372
|
+
}, o + 1);
|
|
1373
|
+
a.unref && a.unref();
|
|
1374
|
+
}
|
|
1375
|
+
}, this.#k = (r) => {
|
|
1376
|
+
e[r] = t[r] !== 0 ? st.now() : 0;
|
|
1377
|
+
}, this.#s = (r, o) => {
|
|
1378
|
+
if (t[o]) {
|
|
1379
|
+
let h = t[o], a = e[o];
|
|
1380
|
+
if (!h || !a)
|
|
1381
|
+
return;
|
|
1382
|
+
r.ttl = h, r.start = a, r.now = s || i();
|
|
1383
|
+
let c = r.now - a;
|
|
1384
|
+
r.remainingTTL = h - c;
|
|
1385
|
+
}
|
|
1386
|
+
};
|
|
1387
|
+
let s = 0, i = /* @__PURE__ */ l(() => {
|
|
1388
|
+
let r = st.now();
|
|
1389
|
+
if (this.ttlResolution > 0) {
|
|
1390
|
+
s = r;
|
|
1391
|
+
let o = setTimeout(() => s = 0, this.ttlResolution);
|
|
1392
|
+
o.unref && o.unref();
|
|
1393
|
+
}
|
|
1394
|
+
return r;
|
|
1395
|
+
}, "getNow");
|
|
1396
|
+
this.getRemainingTTL = (r) => {
|
|
1397
|
+
let o = this.#h.get(r);
|
|
1398
|
+
if (o === void 0)
|
|
1399
|
+
return 0;
|
|
1400
|
+
let h = t[o], a = e[o];
|
|
1401
|
+
if (!h || !a)
|
|
1402
|
+
return 1 / 0;
|
|
1403
|
+
let c = (s || i()) - a;
|
|
1404
|
+
return h - c;
|
|
1405
|
+
}, this.#y = (r) => {
|
|
1406
|
+
let o = e[r], h = t[r];
|
|
1407
|
+
return !!h && !!o && (s || i()) - o > h;
|
|
1408
|
+
};
|
|
1409
|
+
}
|
|
1410
|
+
// conditionally set private methods related to TTL
|
|
1411
|
+
#k = /* @__PURE__ */ l(() => {
|
|
1412
|
+
}, "#updateItemAge");
|
|
1413
|
+
#s = /* @__PURE__ */ l(() => {
|
|
1414
|
+
}, "#statusTTL");
|
|
1415
|
+
#M = /* @__PURE__ */ l(() => {
|
|
1416
|
+
}, "#setItemTTL");
|
|
1417
|
+
/* c8 ignore stop */
|
|
1418
|
+
#y = /* @__PURE__ */ l(() => !1, "#isStale");
|
|
1419
|
+
#O() {
|
|
1420
|
+
let t = new it(this.#t);
|
|
1421
|
+
this.#f = 0, this.#T = t, this.#_ = (e) => {
|
|
1422
|
+
this.#f -= t[e], t[e] = 0;
|
|
1423
|
+
}, this.#L = (e, s, i, r) => {
|
|
1424
|
+
if (this.#c(s))
|
|
1425
|
+
return 0;
|
|
1426
|
+
if (!V(i))
|
|
1427
|
+
if (r) {
|
|
1428
|
+
if (typeof r != "function")
|
|
1429
|
+
throw new TypeError("sizeCalculation must be a function");
|
|
1430
|
+
if (i = r(s, e), !V(i))
|
|
1431
|
+
throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
1432
|
+
} else
|
|
1433
|
+
throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size \
|
|
1434
|
+
must be set.");
|
|
1435
|
+
return i;
|
|
1436
|
+
}, this.#N = (e, s, i) => {
|
|
1437
|
+
if (t[e] = s, this.#e) {
|
|
1438
|
+
let r = this.#e - t[e];
|
|
1439
|
+
for (; this.#f > r; )
|
|
1440
|
+
this.#W(!0);
|
|
1441
|
+
}
|
|
1442
|
+
this.#f += t[e], i && (i.entrySize = s, i.totalCalculatedSize = this.#f);
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
#_ = /* @__PURE__ */ l((t) => {
|
|
1446
|
+
}, "#removeItemSize");
|
|
1447
|
+
#N = /* @__PURE__ */ l((t, e, s) => {
|
|
1448
|
+
}, "#addItemSize");
|
|
1449
|
+
#L = /* @__PURE__ */ l((t, e, s, i) => {
|
|
1450
|
+
if (s || i)
|
|
1451
|
+
throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
1452
|
+
return 0;
|
|
1453
|
+
}, "#requireSize");
|
|
1454
|
+
*#A({ allowStale: t = this.allowStale } = {}) {
|
|
1455
|
+
if (this.#l)
|
|
1456
|
+
for (let e = this.#u; !(!this.#P(e) || ((t || !this.#y(e)) && (yield e), e === this.#d)); )
|
|
1457
|
+
e = this.#w[e];
|
|
1458
|
+
}
|
|
1459
|
+
*#R({ allowStale: t = this.allowStale } = {}) {
|
|
1460
|
+
if (this.#l)
|
|
1461
|
+
for (let e = this.#d; !(!this.#P(e) || ((t || !this.#y(e)) && (yield e), e === this.#u)); )
|
|
1462
|
+
e = this.#g[e];
|
|
1463
|
+
}
|
|
1464
|
+
#P(t) {
|
|
1465
|
+
return t !== void 0 && this.#h.get(this.#a[t]) === t;
|
|
1466
|
+
}
|
|
1467
|
+
/**
|
|
1468
|
+
* Return a generator yielding `[key, value]` pairs,
|
|
1469
|
+
* in order from most recently used to least recently used.
|
|
1470
|
+
*/
|
|
1471
|
+
*entries() {
|
|
1472
|
+
for (let t of this.#A())
|
|
1473
|
+
this.#r[t] !== void 0 && this.#a[t] !== void 0 && !this.#c(this.#r[t]) && (yield [this.#a[t], this.#r[t]]);
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Inverse order version of {@link LRUCache.entries}
|
|
1477
|
+
*
|
|
1478
|
+
* Return a generator yielding `[key, value]` pairs,
|
|
1479
|
+
* in order from least recently used to most recently used.
|
|
1480
|
+
*/
|
|
1481
|
+
*rentries() {
|
|
1482
|
+
for (let t of this.#R())
|
|
1483
|
+
this.#r[t] !== void 0 && this.#a[t] !== void 0 && !this.#c(this.#r[t]) && (yield [this.#a[t], this.#r[t]]);
|
|
1484
|
+
}
|
|
1485
|
+
/**
|
|
1486
|
+
* Return a generator yielding the keys in the cache,
|
|
1487
|
+
* in order from most recently used to least recently used.
|
|
1488
|
+
*/
|
|
1489
|
+
*keys() {
|
|
1490
|
+
for (let t of this.#A()) {
|
|
1491
|
+
let e = this.#a[t];
|
|
1492
|
+
e !== void 0 && !this.#c(this.#r[t]) && (yield e);
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
/**
|
|
1496
|
+
* Inverse order version of {@link LRUCache.keys}
|
|
1497
|
+
*
|
|
1498
|
+
* Return a generator yielding the keys in the cache,
|
|
1499
|
+
* in order from least recently used to most recently used.
|
|
1500
|
+
*/
|
|
1501
|
+
*rkeys() {
|
|
1502
|
+
for (let t of this.#R()) {
|
|
1503
|
+
let e = this.#a[t];
|
|
1504
|
+
e !== void 0 && !this.#c(this.#r[t]) && (yield e);
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
/**
|
|
1508
|
+
* Return a generator yielding the values in the cache,
|
|
1509
|
+
* in order from most recently used to least recently used.
|
|
1510
|
+
*/
|
|
1511
|
+
*values() {
|
|
1512
|
+
for (let t of this.#A())
|
|
1513
|
+
this.#r[t] !== void 0 && !this.#c(this.#r[t]) && (yield this.#r[t]);
|
|
1514
|
+
}
|
|
1515
|
+
/**
|
|
1516
|
+
* Inverse order version of {@link LRUCache.values}
|
|
1517
|
+
*
|
|
1518
|
+
* Return a generator yielding the values in the cache,
|
|
1519
|
+
* in order from least recently used to most recently used.
|
|
1520
|
+
*/
|
|
1521
|
+
*rvalues() {
|
|
1522
|
+
for (let t of this.#R())
|
|
1523
|
+
this.#r[t] !== void 0 && !this.#c(this.#r[t]) && (yield this.#r[t]);
|
|
1524
|
+
}
|
|
1525
|
+
/**
|
|
1526
|
+
* Iterating over the cache itself yields the same results as
|
|
1527
|
+
* {@link LRUCache.entries}
|
|
1528
|
+
*/
|
|
1529
|
+
[Symbol.iterator]() {
|
|
1530
|
+
return this.entries();
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* A String value that is used in the creation of the default string
|
|
1534
|
+
* description of an object. Called by the built-in method
|
|
1535
|
+
* `Object.prototype.toString`.
|
|
1536
|
+
*/
|
|
1537
|
+
[Symbol.toStringTag] = "LRUCache";
|
|
1538
|
+
/**
|
|
1539
|
+
* Find a value for which the supplied fn method returns a truthy value,
|
|
1540
|
+
* similar to `Array.find()`. fn is called as `fn(value, key, cache)`.
|
|
1541
|
+
*/
|
|
1542
|
+
find(t, e = {}) {
|
|
1543
|
+
for (let s of this.#A()) {
|
|
1544
|
+
let i = this.#r[s], r = this.#c(i) ? i.__staleWhileFetching : i;
|
|
1545
|
+
if (r !== void 0 && t(r, this.#a[s], this))
|
|
1546
|
+
return this.get(this.#a[s], e);
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* Call the supplied function on each item in the cache, in order from most
|
|
1551
|
+
* recently used to least recently used.
|
|
1552
|
+
*
|
|
1553
|
+
* `fn` is called as `fn(value, key, cache)`.
|
|
1554
|
+
*
|
|
1555
|
+
* If `thisp` is provided, function will be called in the `this`-context of
|
|
1556
|
+
* the provided object, or the cache if no `thisp` object is provided.
|
|
1557
|
+
*
|
|
1558
|
+
* Does not update age or recenty of use, or iterate over stale values.
|
|
1559
|
+
*/
|
|
1560
|
+
forEach(t, e = this) {
|
|
1561
|
+
for (let s of this.#A()) {
|
|
1562
|
+
let i = this.#r[s], r = this.#c(i) ? i.__staleWhileFetching : i;
|
|
1563
|
+
r !== void 0 && t.call(e, r, this.#a[s], this);
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
* The same as {@link LRUCache.forEach} but items are iterated over in
|
|
1568
|
+
* reverse order. (ie, less recently used items are iterated over first.)
|
|
1569
|
+
*/
|
|
1570
|
+
rforEach(t, e = this) {
|
|
1571
|
+
for (let s of this.#R()) {
|
|
1572
|
+
let i = this.#r[s], r = this.#c(i) ? i.__staleWhileFetching : i;
|
|
1573
|
+
r !== void 0 && t.call(e, r, this.#a[s], this);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
/**
|
|
1577
|
+
* Delete any stale entries. Returns true if anything was removed,
|
|
1578
|
+
* false otherwise.
|
|
1579
|
+
*/
|
|
1580
|
+
purgeStale() {
|
|
1581
|
+
let t = !1;
|
|
1582
|
+
for (let e of this.#R({ allowStale: !0 }))
|
|
1583
|
+
this.#y(e) && (this.#F(this.#a[e], "expire"), t = !0);
|
|
1584
|
+
return t;
|
|
1585
|
+
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Get the extended info about a given entry, to get its value, size, and
|
|
1588
|
+
* TTL info simultaneously. Returns `undefined` if the key is not present.
|
|
1589
|
+
*
|
|
1590
|
+
* Unlike {@link LRUCache#dump}, which is designed to be portable and survive
|
|
1591
|
+
* serialization, the `start` value is always the current timestamp, and the
|
|
1592
|
+
* `ttl` is a calculated remaining time to live (negative if expired).
|
|
1593
|
+
*
|
|
1594
|
+
* Always returns stale values, if their info is found in the cache, so be
|
|
1595
|
+
* sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl})
|
|
1596
|
+
* if relevant.
|
|
1597
|
+
*/
|
|
1598
|
+
info(t) {
|
|
1599
|
+
let e = this.#h.get(t);
|
|
1600
|
+
if (e === void 0)
|
|
1601
|
+
return;
|
|
1602
|
+
let s = this.#r[e], i = this.#c(s) ? s.__staleWhileFetching : s;
|
|
1603
|
+
if (i === void 0)
|
|
1604
|
+
return;
|
|
1605
|
+
let r = { value: i };
|
|
1606
|
+
if (this.#b && this.#C) {
|
|
1607
|
+
let o = this.#b[e], h = this.#C[e];
|
|
1608
|
+
if (o && h) {
|
|
1609
|
+
let a = o - (st.now() - h);
|
|
1610
|
+
r.ttl = a, r.start = Date.now();
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
return this.#T && (r.size = this.#T[e]), r;
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
|
1617
|
+
* passed to {@link LRLUCache#load}.
|
|
1618
|
+
*
|
|
1619
|
+
* The `start` fields are calculated relative to a portable `Date.now()`
|
|
1620
|
+
* timestamp, even if `performance.now()` is available.
|
|
1621
|
+
*
|
|
1622
|
+
* Stale entries are always included in the `dump`, even if
|
|
1623
|
+
* {@link LRUCache.OptionsBase.allowStale} is false.
|
|
1624
|
+
*
|
|
1625
|
+
* Note: this returns an actual array, not a generator, so it can be more
|
|
1626
|
+
* easily passed around.
|
|
1627
|
+
*/
|
|
1628
|
+
dump() {
|
|
1629
|
+
let t = [];
|
|
1630
|
+
for (let e of this.#A({ allowStale: !0 })) {
|
|
1631
|
+
let s = this.#a[e], i = this.#r[e], r = this.#c(i) ? i.__staleWhileFetching : i;
|
|
1632
|
+
if (r === void 0 || s === void 0)
|
|
1633
|
+
continue;
|
|
1634
|
+
let o = { value: r };
|
|
1635
|
+
if (this.#b && this.#C) {
|
|
1636
|
+
o.ttl = this.#b[e];
|
|
1637
|
+
let h = st.now() - this.#C[e];
|
|
1638
|
+
o.start = Math.floor(Date.now() - h);
|
|
1639
|
+
}
|
|
1640
|
+
this.#T && (o.size = this.#T[e]), t.unshift([s, o]);
|
|
1641
|
+
}
|
|
1642
|
+
return t;
|
|
1643
|
+
}
|
|
1644
|
+
/**
|
|
1645
|
+
* Reset the cache and load in the items in entries in the order listed.
|
|
1646
|
+
*
|
|
1647
|
+
* The shape of the resulting cache may be different if the same options are
|
|
1648
|
+
* not used in both caches.
|
|
1649
|
+
*
|
|
1650
|
+
* The `start` fields are assumed to be calculated relative to a portable
|
|
1651
|
+
* `Date.now()` timestamp, even if `performance.now()` is available.
|
|
1652
|
+
*/
|
|
1653
|
+
load(t) {
|
|
1654
|
+
this.clear();
|
|
1655
|
+
for (let [e, s] of t) {
|
|
1656
|
+
if (s.start) {
|
|
1657
|
+
let i = Date.now() - s.start;
|
|
1658
|
+
s.start = st.now() - i;
|
|
1659
|
+
}
|
|
1660
|
+
this.set(e, s.value, s);
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
/**
|
|
1664
|
+
* Add a value to the cache.
|
|
1665
|
+
*
|
|
1666
|
+
* Note: if `undefined` is specified as a value, this is an alias for
|
|
1667
|
+
* {@link LRUCache#delete}
|
|
1668
|
+
*
|
|
1669
|
+
* Fields on the {@link LRUCache.SetOptions} options param will override
|
|
1670
|
+
* their corresponding values in the constructor options for the scope
|
|
1671
|
+
* of this single `set()` operation.
|
|
1672
|
+
*
|
|
1673
|
+
* If `start` is provided, then that will set the effective start
|
|
1674
|
+
* time for the TTL calculation. Note that this must be a previous
|
|
1675
|
+
* value of `performance.now()` if supported, or a previous value of
|
|
1676
|
+
* `Date.now()` if not.
|
|
1677
|
+
*
|
|
1678
|
+
* Options object may also include `size`, which will prevent
|
|
1679
|
+
* calling the `sizeCalculation` function and just use the specified
|
|
1680
|
+
* number if it is a positive integer, and `noDisposeOnSet` which
|
|
1681
|
+
* will prevent calling a `dispose` function in the case of
|
|
1682
|
+
* overwrites.
|
|
1683
|
+
*
|
|
1684
|
+
* If the `size` (or return value of `sizeCalculation`) for a given
|
|
1685
|
+
* entry is greater than `maxEntrySize`, then the item will not be
|
|
1686
|
+
* added to the cache.
|
|
1687
|
+
*
|
|
1688
|
+
* Will update the recency of the entry.
|
|
1689
|
+
*
|
|
1690
|
+
* If the value is `undefined`, then this is an alias for
|
|
1691
|
+
* `cache.delete(key)`. `undefined` is never stored in the cache.
|
|
1692
|
+
*/
|
|
1693
|
+
set(t, e, s = {}) {
|
|
1694
|
+
if (e === void 0)
|
|
1695
|
+
return this.delete(t), this;
|
|
1696
|
+
let { ttl: i = this.ttl, start: r, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: a } = s, {
|
|
1697
|
+
noUpdateTTL: c = this.noUpdateTTL } = s, f = this.#L(t, e, s.size || 0, h);
|
|
1698
|
+
if (this.maxEntrySize && f > this.maxEntrySize)
|
|
1699
|
+
return a && (a.set = "miss", a.maxEntrySizeExceeded = !0), this.#F(t, "set"), this;
|
|
1700
|
+
let u = this.#l === 0 ? void 0 : this.#h.get(t);
|
|
1701
|
+
if (u === void 0)
|
|
1702
|
+
u = this.#l === 0 ? this.#u : this.#v.length !== 0 ? this.#v.pop() : this.#l === this.#t ? this.#W(!1) : this.#l, this.#a[u] = t, this.#r[u] =
|
|
1703
|
+
e, this.#h.set(t, u), this.#g[this.#u] = u, this.#w[u] = this.#u, this.#u = u, this.#l++, this.#N(u, f, a), a && (a.set = "add"), c = !1;
|
|
1704
|
+
else {
|
|
1705
|
+
this.#z(u);
|
|
1706
|
+
let d = this.#r[u];
|
|
1707
|
+
if (e !== d) {
|
|
1708
|
+
if (this.#x && this.#c(d)) {
|
|
1709
|
+
d.__abortController.abort(new Error("replaced"));
|
|
1710
|
+
let { __staleWhileFetching: p } = d;
|
|
1711
|
+
p !== void 0 && !o && (this.#E && this.#n?.(p, t, "set"), this.#p && this.#m?.push([p, t, "set"]));
|
|
1712
|
+
} else o || (this.#E && this.#n?.(d, t, "set"), this.#p && this.#m?.push([d, t, "set"]));
|
|
1713
|
+
if (this.#_(u), this.#N(u, f, a), this.#r[u] = e, a) {
|
|
1714
|
+
a.set = "replace";
|
|
1715
|
+
let p = d && this.#c(d) ? d.__staleWhileFetching : d;
|
|
1716
|
+
p !== void 0 && (a.oldValue = p);
|
|
1717
|
+
}
|
|
1718
|
+
} else a && (a.set = "update");
|
|
1719
|
+
}
|
|
1720
|
+
if (i !== 0 && !this.#b && this.#D(), this.#b && (c || this.#M(u, i, r), a && this.#s(a, u)), !o && this.#p && this.#m) {
|
|
1721
|
+
let d = this.#m, p;
|
|
1722
|
+
for (; p = d?.shift(); )
|
|
1723
|
+
this.#i?.(...p);
|
|
1724
|
+
}
|
|
1725
|
+
return this;
|
|
1726
|
+
}
|
|
1727
|
+
/**
|
|
1728
|
+
* Evict the least recently used item, returning its value or
|
|
1729
|
+
* `undefined` if cache is empty.
|
|
1730
|
+
*/
|
|
1731
|
+
pop() {
|
|
1732
|
+
try {
|
|
1733
|
+
for (; this.#l; ) {
|
|
1734
|
+
let t = this.#r[this.#d];
|
|
1735
|
+
if (this.#W(!0), this.#c(t)) {
|
|
1736
|
+
if (t.__staleWhileFetching)
|
|
1737
|
+
return t.__staleWhileFetching;
|
|
1738
|
+
} else if (t !== void 0)
|
|
1739
|
+
return t;
|
|
1740
|
+
}
|
|
1741
|
+
} finally {
|
|
1742
|
+
if (this.#p && this.#m) {
|
|
1743
|
+
let t = this.#m, e;
|
|
1744
|
+
for (; e = t?.shift(); )
|
|
1745
|
+
this.#i?.(...e);
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
#W(t) {
|
|
1750
|
+
let e = this.#d, s = this.#a[e], i = this.#r[e];
|
|
1751
|
+
return this.#x && this.#c(i) ? i.__abortController.abort(new Error("evicted")) : (this.#E || this.#p) && (this.#E && this.#n?.(i, s, "ev\
|
|
1752
|
+
ict"), this.#p && this.#m?.push([i, s, "evict"])), this.#_(e), t && (this.#a[e] = void 0, this.#r[e] = void 0, this.#v.push(e)), this.#l ===
|
|
1753
|
+
1 ? (this.#d = this.#u = 0, this.#v.length = 0) : this.#d = this.#g[e], this.#h.delete(s), this.#l--, e;
|
|
1754
|
+
}
|
|
1755
|
+
/**
|
|
1756
|
+
* Check if a key is in the cache, without updating the recency of use.
|
|
1757
|
+
* Will return false if the item is stale, even though it is technically
|
|
1758
|
+
* in the cache.
|
|
1759
|
+
*
|
|
1760
|
+
* Check if a key is in the cache, without updating the recency of
|
|
1761
|
+
* use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set
|
|
1762
|
+
* to `true` in either the options or the constructor.
|
|
1763
|
+
*
|
|
1764
|
+
* Will return `false` if the item is stale, even though it is technically in
|
|
1765
|
+
* the cache. The difference can be determined (if it matters) by using a
|
|
1766
|
+
* `status` argument, and inspecting the `has` field.
|
|
1767
|
+
*
|
|
1768
|
+
* Will not update item age unless
|
|
1769
|
+
* {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
|
|
1770
|
+
*/
|
|
1771
|
+
has(t, e = {}) {
|
|
1772
|
+
let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, r = this.#h.get(t);
|
|
1773
|
+
if (r !== void 0) {
|
|
1774
|
+
let o = this.#r[r];
|
|
1775
|
+
if (this.#c(o) && o.__staleWhileFetching === void 0)
|
|
1776
|
+
return !1;
|
|
1777
|
+
if (this.#y(r))
|
|
1778
|
+
i && (i.has = "stale", this.#s(i, r));
|
|
1779
|
+
else return s && this.#k(r), i && (i.has = "hit", this.#s(i, r)), !0;
|
|
1780
|
+
} else i && (i.has = "miss");
|
|
1781
|
+
return !1;
|
|
1782
|
+
}
|
|
1783
|
+
/**
|
|
1784
|
+
* Like {@link LRUCache#get} but doesn't update recency or delete stale
|
|
1785
|
+
* items.
|
|
1786
|
+
*
|
|
1787
|
+
* Returns `undefined` if the item is stale, unless
|
|
1788
|
+
* {@link LRUCache.OptionsBase.allowStale} is set.
|
|
1789
|
+
*/
|
|
1790
|
+
peek(t, e = {}) {
|
|
1791
|
+
let { allowStale: s = this.allowStale } = e, i = this.#h.get(t);
|
|
1792
|
+
if (i === void 0 || !s && this.#y(i))
|
|
1793
|
+
return;
|
|
1794
|
+
let r = this.#r[i];
|
|
1795
|
+
return this.#c(r) ? r.__staleWhileFetching : r;
|
|
1796
|
+
}
|
|
1797
|
+
#j(t, e, s, i) {
|
|
1798
|
+
let r = e === void 0 ? void 0 : this.#r[e];
|
|
1799
|
+
if (this.#c(r))
|
|
1800
|
+
return r;
|
|
1801
|
+
let o = new Rt(), { signal: h } = s;
|
|
1802
|
+
h?.addEventListener("abort", () => o.abort(h.reason), {
|
|
1803
|
+
signal: o.signal
|
|
1804
|
+
});
|
|
1805
|
+
let a = {
|
|
1806
|
+
signal: o.signal,
|
|
1807
|
+
options: s,
|
|
1808
|
+
context: i
|
|
1809
|
+
}, c = /* @__PURE__ */ l((m, y = !1) => {
|
|
1810
|
+
let { aborted: g } = o.signal, E = s.ignoreFetchAbort && m !== void 0;
|
|
1811
|
+
if (s.status && (g && !y ? (s.status.fetchAborted = !0, s.status.fetchError = o.signal.reason, E && (s.status.fetchAbortIgnored = !0)) :
|
|
1812
|
+
s.status.fetchResolved = !0), g && !E && !y)
|
|
1813
|
+
return u(o.signal.reason);
|
|
1814
|
+
let S = p;
|
|
1815
|
+
return this.#r[e] === p && (m === void 0 ? S.__staleWhileFetching ? this.#r[e] = S.__staleWhileFetching : this.#F(t, "fetch") : (s.status &&
|
|
1816
|
+
(s.status.fetchUpdated = !0), this.set(t, m, a.options))), m;
|
|
1817
|
+
}, "cb"), f = /* @__PURE__ */ l((m) => (s.status && (s.status.fetchRejected = !0, s.status.fetchError = m), u(m)), "eb"), u = /* @__PURE__ */ l(
|
|
1818
|
+
(m) => {
|
|
1819
|
+
let { aborted: y } = o.signal, g = y && s.allowStaleOnFetchAbort, E = g || s.allowStaleOnFetchRejection, S = E || s.noDeleteOnFetchRejection,
|
|
1820
|
+
b = p;
|
|
1821
|
+
if (this.#r[e] === p && (!S || b.__staleWhileFetching === void 0 ? this.#F(t, "fetch") : g || (this.#r[e] = b.__staleWhileFetching)), E)
|
|
1822
|
+
return s.status && b.__staleWhileFetching !== void 0 && (s.status.returnedStale = !0), b.__staleWhileFetching;
|
|
1823
|
+
if (b.__returned === b)
|
|
1824
|
+
throw m;
|
|
1825
|
+
}, "fetchFail"), d = /* @__PURE__ */ l((m, y) => {
|
|
1826
|
+
let g = this.#o?.(t, r, a);
|
|
1827
|
+
g && g instanceof Promise && g.then((E) => m(E === void 0 ? void 0 : E), y), o.signal.addEventListener("abort", () => {
|
|
1828
|
+
(!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (m(void 0), s.allowStaleOnFetchAbort && (m = /* @__PURE__ */ l((E) => c(E, !0),
|
|
1829
|
+
"res")));
|
|
1830
|
+
});
|
|
1831
|
+
}, "pcall");
|
|
1832
|
+
s.status && (s.status.fetchDispatched = !0);
|
|
1833
|
+
let p = new Promise(d).then(c, f), w = Object.assign(p, {
|
|
1834
|
+
__abortController: o,
|
|
1835
|
+
__staleWhileFetching: r,
|
|
1836
|
+
__returned: void 0
|
|
1837
|
+
});
|
|
1838
|
+
return e === void 0 ? (this.set(t, w, { ...a.options, status: void 0 }), e = this.#h.get(t)) : this.#r[e] = w, w;
|
|
1839
|
+
}
|
|
1840
|
+
#c(t) {
|
|
1841
|
+
if (!this.#x)
|
|
1842
|
+
return !1;
|
|
1843
|
+
let e = t;
|
|
1844
|
+
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof Rt;
|
|
1845
|
+
}
|
|
1846
|
+
async fetch(t, e = {}) {
|
|
1847
|
+
let {
|
|
1848
|
+
// get options
|
|
1849
|
+
allowStale: s = this.allowStale,
|
|
1850
|
+
updateAgeOnGet: i = this.updateAgeOnGet,
|
|
1851
|
+
noDeleteOnStaleGet: r = this.noDeleteOnStaleGet,
|
|
1852
|
+
// set options
|
|
1853
|
+
ttl: o = this.ttl,
|
|
1854
|
+
noDisposeOnSet: h = this.noDisposeOnSet,
|
|
1855
|
+
size: a = 0,
|
|
1856
|
+
sizeCalculation: c = this.sizeCalculation,
|
|
1857
|
+
noUpdateTTL: f = this.noUpdateTTL,
|
|
1858
|
+
// fetch exclusive options
|
|
1859
|
+
noDeleteOnFetchRejection: u = this.noDeleteOnFetchRejection,
|
|
1860
|
+
allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection,
|
|
1861
|
+
ignoreFetchAbort: p = this.ignoreFetchAbort,
|
|
1862
|
+
allowStaleOnFetchAbort: w = this.allowStaleOnFetchAbort,
|
|
1863
|
+
context: m,
|
|
1864
|
+
forceRefresh: y = !1,
|
|
1865
|
+
status: g,
|
|
1866
|
+
signal: E
|
|
1867
|
+
} = e;
|
|
1868
|
+
if (!this.#x)
|
|
1869
|
+
return g && (g.fetch = "get"), this.get(t, {
|
|
1870
|
+
allowStale: s,
|
|
1871
|
+
updateAgeOnGet: i,
|
|
1872
|
+
noDeleteOnStaleGet: r,
|
|
1873
|
+
status: g
|
|
1874
|
+
});
|
|
1875
|
+
let S = {
|
|
1876
|
+
allowStale: s,
|
|
1877
|
+
updateAgeOnGet: i,
|
|
1878
|
+
noDeleteOnStaleGet: r,
|
|
1879
|
+
ttl: o,
|
|
1880
|
+
noDisposeOnSet: h,
|
|
1881
|
+
size: a,
|
|
1882
|
+
sizeCalculation: c,
|
|
1883
|
+
noUpdateTTL: f,
|
|
1884
|
+
noDeleteOnFetchRejection: u,
|
|
1885
|
+
allowStaleOnFetchRejection: d,
|
|
1886
|
+
allowStaleOnFetchAbort: w,
|
|
1887
|
+
ignoreFetchAbort: p,
|
|
1888
|
+
status: g,
|
|
1889
|
+
signal: E
|
|
1890
|
+
}, b = this.#h.get(t);
|
|
1891
|
+
if (b === void 0) {
|
|
1892
|
+
g && (g.fetch = "miss");
|
|
1893
|
+
let x = this.#j(t, b, S, m);
|
|
1894
|
+
return x.__returned = x;
|
|
1895
|
+
} else {
|
|
1896
|
+
let x = this.#r[b];
|
|
1897
|
+
if (this.#c(x)) {
|
|
1898
|
+
let kt = s && x.__staleWhileFetching !== void 0;
|
|
1899
|
+
return g && (g.fetch = "inflight", kt && (g.returnedStale = !0)), kt ? x.__staleWhileFetching : x.__returned = x;
|
|
1900
|
+
}
|
|
1901
|
+
let T = this.#y(b);
|
|
1902
|
+
if (!y && !T)
|
|
1903
|
+
return g && (g.fetch = "hit"), this.#z(b), i && this.#k(b), g && this.#s(g, b), x;
|
|
1904
|
+
let j = this.#j(t, b, S, m), I = j.__staleWhileFetching !== void 0 && s;
|
|
1905
|
+
return g && (g.fetch = T ? "stale" : "refresh", I && T && (g.returnedStale = !0)), I ? j.__staleWhileFetching : j.__returned = j;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
async forceFetch(t, e = {}) {
|
|
1909
|
+
let s = await this.fetch(t, e);
|
|
1910
|
+
if (s === void 0)
|
|
1911
|
+
throw new Error("fetch() returned undefined");
|
|
1912
|
+
return s;
|
|
1913
|
+
}
|
|
1914
|
+
memo(t, e = {}) {
|
|
1915
|
+
let s = this.#S;
|
|
1916
|
+
if (!s)
|
|
1917
|
+
throw new Error("no memoMethod provided to constructor");
|
|
1918
|
+
let { context: i, forceRefresh: r, ...o } = e, h = this.get(t, o);
|
|
1919
|
+
if (!r && h !== void 0)
|
|
1920
|
+
return h;
|
|
1921
|
+
let a = s(t, h, {
|
|
1922
|
+
options: o,
|
|
1923
|
+
context: i
|
|
1924
|
+
});
|
|
1925
|
+
return this.set(t, a, o), a;
|
|
1926
|
+
}
|
|
1927
|
+
/**
|
|
1928
|
+
* Return a value from the cache. Will update the recency of the cache
|
|
1929
|
+
* entry found.
|
|
1930
|
+
*
|
|
1931
|
+
* If the key is not found, get() will return `undefined`.
|
|
1932
|
+
*/
|
|
1933
|
+
get(t, e = {}) {
|
|
1934
|
+
let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, status: o } = e,
|
|
1935
|
+
h = this.#h.get(t);
|
|
1936
|
+
if (h !== void 0) {
|
|
1937
|
+
let a = this.#r[h], c = this.#c(a);
|
|
1938
|
+
return o && this.#s(o, h), this.#y(h) ? (o && (o.get = "stale"), c ? (o && s && a.__staleWhileFetching !== void 0 && (o.returnedStale =
|
|
1939
|
+
!0), s ? a.__staleWhileFetching : void 0) : (r || this.#F(t, "expire"), o && s && (o.returnedStale = !0), s ? a : void 0)) : (o && (o.
|
|
1940
|
+
get = "hit"), c ? a.__staleWhileFetching : (this.#z(h), i && this.#k(h), a));
|
|
1941
|
+
} else o && (o.get = "miss");
|
|
1942
|
+
}
|
|
1943
|
+
#I(t, e) {
|
|
1944
|
+
this.#w[e] = t, this.#g[t] = e;
|
|
1945
|
+
}
|
|
1946
|
+
#z(t) {
|
|
1947
|
+
t !== this.#u && (t === this.#d ? this.#d = this.#g[t] : this.#I(this.#w[t], this.#g[t]), this.#I(this.#u, t), this.#u = t);
|
|
1948
|
+
}
|
|
1949
|
+
/**
|
|
1950
|
+
* Deletes a key out of the cache.
|
|
1951
|
+
*
|
|
1952
|
+
* Returns true if the key was deleted, false otherwise.
|
|
1953
|
+
*/
|
|
1954
|
+
delete(t) {
|
|
1955
|
+
return this.#F(t, "delete");
|
|
1956
|
+
}
|
|
1957
|
+
#F(t, e) {
|
|
1958
|
+
let s = !1;
|
|
1959
|
+
if (this.#l !== 0) {
|
|
1960
|
+
let i = this.#h.get(t);
|
|
1961
|
+
if (i !== void 0)
|
|
1962
|
+
if (s = !0, this.#l === 1)
|
|
1963
|
+
this.#B(e);
|
|
1964
|
+
else {
|
|
1965
|
+
this.#_(i);
|
|
1966
|
+
let r = this.#r[i];
|
|
1967
|
+
if (this.#c(r) ? r.__abortController.abort(new Error("deleted")) : (this.#E || this.#p) && (this.#E && this.#n?.(r, t, e), this.#p &&
|
|
1968
|
+
this.#m?.push([r, t, e])), this.#h.delete(t), this.#a[i] = void 0, this.#r[i] = void 0, i === this.#u)
|
|
1969
|
+
this.#u = this.#w[i];
|
|
1970
|
+
else if (i === this.#d)
|
|
1971
|
+
this.#d = this.#g[i];
|
|
1972
|
+
else {
|
|
1973
|
+
let o = this.#w[i];
|
|
1974
|
+
this.#g[o] = this.#g[i];
|
|
1975
|
+
let h = this.#g[i];
|
|
1976
|
+
this.#w[h] = this.#w[i];
|
|
1977
|
+
}
|
|
1978
|
+
this.#l--, this.#v.push(i);
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
if (this.#p && this.#m?.length) {
|
|
1982
|
+
let i = this.#m, r;
|
|
1983
|
+
for (; r = i?.shift(); )
|
|
1984
|
+
this.#i?.(...r);
|
|
1985
|
+
}
|
|
1986
|
+
return s;
|
|
1987
|
+
}
|
|
1988
|
+
/**
|
|
1989
|
+
* Clear the cache entirely, throwing away all values.
|
|
1990
|
+
*/
|
|
1991
|
+
clear() {
|
|
1992
|
+
return this.#B("delete");
|
|
1993
|
+
}
|
|
1994
|
+
#B(t) {
|
|
1995
|
+
for (let e of this.#R({ allowStale: !0 })) {
|
|
1996
|
+
let s = this.#r[e];
|
|
1997
|
+
if (this.#c(s))
|
|
1998
|
+
s.__abortController.abort(new Error("deleted"));
|
|
1999
|
+
else {
|
|
2000
|
+
let i = this.#a[e];
|
|
2001
|
+
this.#E && this.#n?.(s, i, t), this.#p && this.#m?.push([s, i, t]);
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
if (this.#h.clear(), this.#r.fill(void 0), this.#a.fill(void 0), this.#b && this.#C && (this.#b.fill(0), this.#C.fill(0)), this.#T && this.#T.
|
|
2005
|
+
fill(0), this.#d = 0, this.#u = 0, this.#v.length = 0, this.#f = 0, this.#l = 0, this.#p && this.#m) {
|
|
2006
|
+
let e = this.#m, s;
|
|
2007
|
+
for (; s = e?.shift(); )
|
|
2008
|
+
this.#i?.(...s);
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
};
|
|
2012
|
+
|
|
2013
|
+
// ../node_modules/path-scurry/dist/esm/index.js
|
|
2014
|
+
import { posix as vi, win32 as he } from "node:path";
|
|
2015
|
+
import { fileURLToPath as Ti } from "node:url";
|
|
2016
|
+
import { lstatSync as Ci, readdir as ki, readdirSync as Ai, readlinkSync as Ri, realpathSync as Di } from "fs";
|
|
2017
|
+
import * as Oi from "node:fs";
|
|
2018
|
+
import { lstat as Mi, readdir as _i, readlink as Ni, realpath as Li } from "node:fs/promises";
|
|
2019
|
+
|
|
2020
|
+
// ../node_modules/minipass/dist/esm/index.js
|
|
2021
|
+
import { EventEmitter as re } from "node:events";
|
|
2022
|
+
import Xe from "node:stream";
|
|
2023
|
+
import { StringDecoder as di } from "node:string_decoder";
|
|
2024
|
+
var He = typeof process == "object" && process ? process : {
|
|
2025
|
+
stdout: null,
|
|
2026
|
+
stderr: null
|
|
2027
|
+
}, pi = /* @__PURE__ */ l((n) => !!n && typeof n == "object" && (n instanceof Y || n instanceof Xe || mi(n) || gi(n)), "isStream"), mi = /* @__PURE__ */ l(
|
|
2028
|
+
(n) => !!n && typeof n == "object" && n instanceof re && typeof n.pipe == "function" && // node core Writable streams have a pipe() method, but it throws
|
|
2029
|
+
n.pipe !== Xe.Writable.prototype.pipe, "isReadable"), gi = /* @__PURE__ */ l((n) => !!n && typeof n == "object" && n instanceof re && typeof n.
|
|
2030
|
+
write == "function" && typeof n.end == "function", "isWritable"), q = Symbol("EOF"), K = Symbol("maybeEmitEnd"), X = Symbol("emittedEnd"), Dt = Symbol(
|
|
2031
|
+
"emittingEnd"), pt = Symbol("emittedError"), Ot = Symbol("closed"), qe = Symbol("read"), Ft = Symbol("flush"), Ke = Symbol("flushChunk"), B = Symbol(
|
|
2032
|
+
"encoding"), rt = Symbol("decoder"), C = Symbol("flowing"), mt = Symbol("paused"), nt = Symbol("resume"), k = Symbol("buffer"), M = Symbol("\
|
|
2033
|
+
pipes"), A = Symbol("bufferLength"), Zt = Symbol("bufferPush"), Mt = Symbol("bufferShift"), D = Symbol("objectMode"), v = Symbol("destroyed"),
|
|
2034
|
+
Qt = Symbol("error"), te = Symbol("emitData"), Ve = Symbol("emitEnd"), ee = Symbol("emitEnd2"), G = Symbol("async"), se = Symbol("abort"), _t = Symbol(
|
|
2035
|
+
"aborted"), gt = Symbol("signal"), Z = Symbol("dataListeners"), N = Symbol("discarded"), wt = /* @__PURE__ */ l((n) => Promise.resolve().then(
|
|
2036
|
+
n), "defer"), wi = /* @__PURE__ */ l((n) => n(), "nodefer"), yi = /* @__PURE__ */ l((n) => n === "end" || n === "finish" || n === "prefinish",
|
|
2037
|
+
"isEndish"), bi = /* @__PURE__ */ l((n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name ===
|
|
2038
|
+
"ArrayBuffer" && n.byteLength >= 0, "isArrayBufferLike"), Si = /* @__PURE__ */ l((n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n), "isArr\
|
|
2039
|
+
ayBufferView"), Nt = class {
|
|
2040
|
+
static {
|
|
2041
|
+
l(this, "Pipe");
|
|
2042
|
+
}
|
|
2043
|
+
src;
|
|
2044
|
+
dest;
|
|
2045
|
+
opts;
|
|
2046
|
+
ondrain;
|
|
2047
|
+
constructor(t, e, s) {
|
|
2048
|
+
this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[nt](), this.dest.on("drain", this.ondrain);
|
|
2049
|
+
}
|
|
2050
|
+
unpipe() {
|
|
2051
|
+
this.dest.removeListener("drain", this.ondrain);
|
|
2052
|
+
}
|
|
2053
|
+
// only here for the prototype
|
|
2054
|
+
/* c8 ignore start */
|
|
2055
|
+
proxyErrors(t) {
|
|
2056
|
+
}
|
|
2057
|
+
/* c8 ignore stop */
|
|
2058
|
+
end() {
|
|
2059
|
+
this.unpipe(), this.opts.end && this.dest.end();
|
|
2060
|
+
}
|
|
2061
|
+
}, ie = class extends Nt {
|
|
2062
|
+
static {
|
|
2063
|
+
l(this, "PipeProxyErrors");
|
|
2064
|
+
}
|
|
2065
|
+
unpipe() {
|
|
2066
|
+
this.src.removeListener("error", this.proxyErrors), super.unpipe();
|
|
2067
|
+
}
|
|
2068
|
+
constructor(t, e, s) {
|
|
2069
|
+
super(t, e, s), this.proxyErrors = (i) => e.emit("error", i), t.on("error", this.proxyErrors);
|
|
2070
|
+
}
|
|
2071
|
+
}, Ei = /* @__PURE__ */ l((n) => !!n.objectMode, "isObjectModeOptions"), xi = /* @__PURE__ */ l((n) => !n.objectMode && !!n.encoding && n.encoding !==
|
|
2072
|
+
"buffer", "isEncodingOptions"), Y = class extends re {
|
|
2073
|
+
static {
|
|
2074
|
+
l(this, "Minipass");
|
|
2075
|
+
}
|
|
2076
|
+
[C] = !1;
|
|
2077
|
+
[mt] = !1;
|
|
2078
|
+
[M] = [];
|
|
2079
|
+
[k] = [];
|
|
2080
|
+
[D];
|
|
2081
|
+
[B];
|
|
2082
|
+
[G];
|
|
2083
|
+
[rt];
|
|
2084
|
+
[q] = !1;
|
|
2085
|
+
[X] = !1;
|
|
2086
|
+
[Dt] = !1;
|
|
2087
|
+
[Ot] = !1;
|
|
2088
|
+
[pt] = null;
|
|
2089
|
+
[A] = 0;
|
|
2090
|
+
[v] = !1;
|
|
2091
|
+
[gt];
|
|
2092
|
+
[_t] = !1;
|
|
2093
|
+
[Z] = 0;
|
|
2094
|
+
[N] = !1;
|
|
2095
|
+
/**
|
|
2096
|
+
* true if the stream can be written
|
|
2097
|
+
*/
|
|
2098
|
+
writable = !0;
|
|
2099
|
+
/**
|
|
2100
|
+
* true if the stream can be read
|
|
2101
|
+
*/
|
|
2102
|
+
readable = !0;
|
|
2103
|
+
/**
|
|
2104
|
+
* If `RType` is Buffer, then options do not need to be provided.
|
|
2105
|
+
* Otherwise, an options object must be provided to specify either
|
|
2106
|
+
* {@link Minipass.SharedOptions.objectMode} or
|
|
2107
|
+
* {@link Minipass.SharedOptions.encoding}, as appropriate.
|
|
2108
|
+
*/
|
|
2109
|
+
constructor(...t) {
|
|
2110
|
+
let e = t[0] || {};
|
|
2111
|
+
if (super(), e.objectMode && typeof e.encoding == "string")
|
|
2112
|
+
throw new TypeError("Encoding and objectMode may not be used together");
|
|
2113
|
+
Ei(e) ? (this[D] = !0, this[B] = null) : xi(e) ? (this[B] = e.encoding, this[D] = !1) : (this[D] = !1, this[B] = null), this[G] = !!e.async,
|
|
2114
|
+
this[rt] = this[B] ? new di(this[B]) : null, e && e.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: /* @__PURE__ */ l(
|
|
2115
|
+
() => this[k], "get") }), e && e.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: /* @__PURE__ */ l(() => this[M],
|
|
2116
|
+
"get") });
|
|
2117
|
+
let { signal: s } = e;
|
|
2118
|
+
s && (this[gt] = s, s.aborted ? this[se]() : s.addEventListener("abort", () => this[se]()));
|
|
2119
|
+
}
|
|
2120
|
+
/**
|
|
2121
|
+
* The amount of data stored in the buffer waiting to be read.
|
|
2122
|
+
*
|
|
2123
|
+
* For Buffer strings, this will be the total byte length.
|
|
2124
|
+
* For string encoding streams, this will be the string character length,
|
|
2125
|
+
* according to JavaScript's `string.length` logic.
|
|
2126
|
+
* For objectMode streams, this is a count of the items waiting to be
|
|
2127
|
+
* emitted.
|
|
2128
|
+
*/
|
|
2129
|
+
get bufferLength() {
|
|
2130
|
+
return this[A];
|
|
2131
|
+
}
|
|
2132
|
+
/**
|
|
2133
|
+
* The `BufferEncoding` currently in use, or `null`
|
|
2134
|
+
*/
|
|
2135
|
+
get encoding() {
|
|
2136
|
+
return this[B];
|
|
2137
|
+
}
|
|
2138
|
+
/**
|
|
2139
|
+
* @deprecated - This is a read only property
|
|
2140
|
+
*/
|
|
2141
|
+
set encoding(t) {
|
|
2142
|
+
throw new Error("Encoding must be set at instantiation time");
|
|
2143
|
+
}
|
|
2144
|
+
/**
|
|
2145
|
+
* @deprecated - Encoding may only be set at instantiation time
|
|
2146
|
+
*/
|
|
2147
|
+
setEncoding(t) {
|
|
2148
|
+
throw new Error("Encoding must be set at instantiation time");
|
|
2149
|
+
}
|
|
2150
|
+
/**
|
|
2151
|
+
* True if this is an objectMode stream
|
|
2152
|
+
*/
|
|
2153
|
+
get objectMode() {
|
|
2154
|
+
return this[D];
|
|
2155
|
+
}
|
|
2156
|
+
/**
|
|
2157
|
+
* @deprecated - This is a read-only property
|
|
2158
|
+
*/
|
|
2159
|
+
set objectMode(t) {
|
|
2160
|
+
throw new Error("objectMode must be set at instantiation time");
|
|
2161
|
+
}
|
|
2162
|
+
/**
|
|
2163
|
+
* true if this is an async stream
|
|
2164
|
+
*/
|
|
2165
|
+
get async() {
|
|
2166
|
+
return this[G];
|
|
2167
|
+
}
|
|
2168
|
+
/**
|
|
2169
|
+
* Set to true to make this stream async.
|
|
2170
|
+
*
|
|
2171
|
+
* Once set, it cannot be unset, as this would potentially cause incorrect
|
|
2172
|
+
* behavior. Ie, a sync stream can be made async, but an async stream
|
|
2173
|
+
* cannot be safely made sync.
|
|
2174
|
+
*/
|
|
2175
|
+
set async(t) {
|
|
2176
|
+
this[G] = this[G] || !!t;
|
|
2177
|
+
}
|
|
2178
|
+
// drop everything and get out of the flow completely
|
|
2179
|
+
[se]() {
|
|
2180
|
+
this[_t] = !0, this.emit("abort", this[gt]?.reason), this.destroy(this[gt]?.reason);
|
|
2181
|
+
}
|
|
2182
|
+
/**
|
|
2183
|
+
* True if the stream has been aborted.
|
|
2184
|
+
*/
|
|
2185
|
+
get aborted() {
|
|
2186
|
+
return this[_t];
|
|
2187
|
+
}
|
|
2188
|
+
/**
|
|
2189
|
+
* No-op setter. Stream aborted status is set via the AbortSignal provided
|
|
2190
|
+
* in the constructor options.
|
|
2191
|
+
*/
|
|
2192
|
+
set aborted(t) {
|
|
2193
|
+
}
|
|
2194
|
+
write(t, e, s) {
|
|
2195
|
+
if (this[_t])
|
|
2196
|
+
return !1;
|
|
2197
|
+
if (this[q])
|
|
2198
|
+
throw new Error("write after end");
|
|
2199
|
+
if (this[v])
|
|
2200
|
+
return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })),
|
|
2201
|
+
!0;
|
|
2202
|
+
typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
|
|
2203
|
+
let i = this[G] ? wt : wi;
|
|
2204
|
+
if (!this[D] && !Buffer.isBuffer(t)) {
|
|
2205
|
+
if (Si(t))
|
|
2206
|
+
t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
|
|
2207
|
+
else if (bi(t))
|
|
2208
|
+
t = Buffer.from(t);
|
|
2209
|
+
else if (typeof t != "string")
|
|
2210
|
+
throw new Error("Non-contiguous data written to non-objectMode stream");
|
|
2211
|
+
}
|
|
2212
|
+
return this[D] ? (this[C] && this[A] !== 0 && this[Ft](!0), this[C] ? this.emit("data", t) : this[Zt](t), this[A] !== 0 && this.emit("re\
|
|
2213
|
+
adable"), s && i(s), this[C]) : t.length ? (typeof t == "string" && // unless it is a string already ready for us to use
|
|
2214
|
+
!(e === this[B] && !this[rt]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[B] && (t = this[rt].write(t)), this[C] &&
|
|
2215
|
+
this[A] !== 0 && this[Ft](!0), this[C] ? this.emit("data", t) : this[Zt](t), this[A] !== 0 && this.emit("readable"), s && i(s), this[C]) :
|
|
2216
|
+
(this[A] !== 0 && this.emit("readable"), s && i(s), this[C]);
|
|
2217
|
+
}
|
|
2218
|
+
/**
|
|
2219
|
+
* Low-level explicit read method.
|
|
2220
|
+
*
|
|
2221
|
+
* In objectMode, the argument is ignored, and one item is returned if
|
|
2222
|
+
* available.
|
|
2223
|
+
*
|
|
2224
|
+
* `n` is the number of bytes (or in the case of encoding streams,
|
|
2225
|
+
* characters) to consume. If `n` is not provided, then the entire buffer
|
|
2226
|
+
* is returned, or `null` is returned if no data is available.
|
|
2227
|
+
*
|
|
2228
|
+
* If `n` is greater that the amount of data in the internal buffer,
|
|
2229
|
+
* then `null` is returned.
|
|
2230
|
+
*/
|
|
2231
|
+
read(t) {
|
|
2232
|
+
if (this[v])
|
|
2233
|
+
return null;
|
|
2234
|
+
if (this[N] = !1, this[A] === 0 || t === 0 || t && t > this[A])
|
|
2235
|
+
return this[K](), null;
|
|
2236
|
+
this[D] && (t = null), this[k].length > 1 && !this[D] && (this[k] = [
|
|
2237
|
+
this[B] ? this[k].join("") : Buffer.concat(this[k], this[A])
|
|
2238
|
+
]);
|
|
2239
|
+
let e = this[qe](t || null, this[k][0]);
|
|
2240
|
+
return this[K](), e;
|
|
2241
|
+
}
|
|
2242
|
+
[qe](t, e) {
|
|
2243
|
+
if (this[D])
|
|
2244
|
+
this[Mt]();
|
|
2245
|
+
else {
|
|
2246
|
+
let s = e;
|
|
2247
|
+
t === s.length || t === null ? this[Mt]() : typeof s == "string" ? (this[k][0] = s.slice(t), e = s.slice(0, t), this[A] -= t) : (this[k][0] =
|
|
2248
|
+
s.subarray(t), e = s.subarray(0, t), this[A] -= t);
|
|
2249
|
+
}
|
|
2250
|
+
return this.emit("data", e), !this[k].length && !this[q] && this.emit("drain"), e;
|
|
2251
|
+
}
|
|
2252
|
+
end(t, e, s) {
|
|
2253
|
+
return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s &&
|
|
2254
|
+
this.once("end", s), this[q] = !0, this.writable = !1, (this[C] || !this[mt]) && this[K](), this;
|
|
2255
|
+
}
|
|
2256
|
+
// don't let the internal resume be overwritten
|
|
2257
|
+
[nt]() {
|
|
2258
|
+
this[v] || (!this[Z] && !this[M].length && (this[N] = !0), this[mt] = !1, this[C] = !0, this.emit("resume"), this[k].length ? this[Ft]() :
|
|
2259
|
+
this[q] ? this[K]() : this.emit("drain"));
|
|
2260
|
+
}
|
|
2261
|
+
/**
|
|
2262
|
+
* Resume the stream if it is currently in a paused state
|
|
2263
|
+
*
|
|
2264
|
+
* If called when there are no pipe destinations or `data` event listeners,
|
|
2265
|
+
* this will place the stream in a "discarded" state, where all data will
|
|
2266
|
+
* be thrown away. The discarded state is removed if a pipe destination or
|
|
2267
|
+
* data handler is added, if pause() is called, or if any synchronous or
|
|
2268
|
+
* asynchronous iteration is started.
|
|
2269
|
+
*/
|
|
2270
|
+
resume() {
|
|
2271
|
+
return this[nt]();
|
|
2272
|
+
}
|
|
2273
|
+
/**
|
|
2274
|
+
* Pause the stream
|
|
2275
|
+
*/
|
|
2276
|
+
pause() {
|
|
2277
|
+
this[C] = !1, this[mt] = !0, this[N] = !1;
|
|
2278
|
+
}
|
|
2279
|
+
/**
|
|
2280
|
+
* true if the stream has been forcibly destroyed
|
|
2281
|
+
*/
|
|
2282
|
+
get destroyed() {
|
|
2283
|
+
return this[v];
|
|
2284
|
+
}
|
|
2285
|
+
/**
|
|
2286
|
+
* true if the stream is currently in a flowing state, meaning that
|
|
2287
|
+
* any writes will be immediately emitted.
|
|
2288
|
+
*/
|
|
2289
|
+
get flowing() {
|
|
2290
|
+
return this[C];
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* true if the stream is currently in a paused state
|
|
2294
|
+
*/
|
|
2295
|
+
get paused() {
|
|
2296
|
+
return this[mt];
|
|
2297
|
+
}
|
|
2298
|
+
[Zt](t) {
|
|
2299
|
+
this[D] ? this[A] += 1 : this[A] += t.length, this[k].push(t);
|
|
2300
|
+
}
|
|
2301
|
+
[Mt]() {
|
|
2302
|
+
return this[D] ? this[A] -= 1 : this[A] -= this[k][0].length, this[k].shift();
|
|
2303
|
+
}
|
|
2304
|
+
[Ft](t = !1) {
|
|
2305
|
+
do
|
|
2306
|
+
;
|
|
2307
|
+
while (this[Ke](this[Mt]()) && this[k].length);
|
|
2308
|
+
!t && !this[k].length && !this[q] && this.emit("drain");
|
|
2309
|
+
}
|
|
2310
|
+
[Ke](t) {
|
|
2311
|
+
return this.emit("data", t), this[C];
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* Pipe all data emitted by this stream into the destination provided.
|
|
2315
|
+
*
|
|
2316
|
+
* Triggers the flow of data.
|
|
2317
|
+
*/
|
|
2318
|
+
pipe(t, e) {
|
|
2319
|
+
if (this[v])
|
|
2320
|
+
return t;
|
|
2321
|
+
this[N] = !1;
|
|
2322
|
+
let s = this[X];
|
|
2323
|
+
return e = e || {}, t === He.stdout || t === He.stderr ? e.end = !1 : e.end = e.end !== !1, e.proxyErrors = !!e.proxyErrors, s ? e.end &&
|
|
2324
|
+
t.end() : (this[M].push(e.proxyErrors ? new ie(this, t, e) : new Nt(this, t, e)), this[G] ? wt(() => this[nt]()) : this[nt]()), t;
|
|
2325
|
+
}
|
|
2326
|
+
/**
|
|
2327
|
+
* Fully unhook a piped destination stream.
|
|
2328
|
+
*
|
|
2329
|
+
* If the destination stream was the only consumer of this stream (ie,
|
|
2330
|
+
* there are no other piped destinations or `'data'` event listeners)
|
|
2331
|
+
* then the flow of data will stop until there is another consumer or
|
|
2332
|
+
* {@link Minipass#resume} is explicitly called.
|
|
2333
|
+
*/
|
|
2334
|
+
unpipe(t) {
|
|
2335
|
+
let e = this[M].find((s) => s.dest === t);
|
|
2336
|
+
e && (this[M].length === 1 ? (this[C] && this[Z] === 0 && (this[C] = !1), this[M] = []) : this[M].splice(this[M].indexOf(e), 1), e.unpipe());
|
|
2337
|
+
}
|
|
2338
|
+
/**
|
|
2339
|
+
* Alias for {@link Minipass#on}
|
|
2340
|
+
*/
|
|
2341
|
+
addListener(t, e) {
|
|
2342
|
+
return this.on(t, e);
|
|
2343
|
+
}
|
|
2344
|
+
/**
|
|
2345
|
+
* Mostly identical to `EventEmitter.on`, with the following
|
|
2346
|
+
* behavior differences to prevent data loss and unnecessary hangs:
|
|
2347
|
+
*
|
|
2348
|
+
* - Adding a 'data' event handler will trigger the flow of data
|
|
2349
|
+
*
|
|
2350
|
+
* - Adding a 'readable' event handler when there is data waiting to be read
|
|
2351
|
+
* will cause 'readable' to be emitted immediately.
|
|
2352
|
+
*
|
|
2353
|
+
* - Adding an 'endish' event handler ('end', 'finish', etc.) which has
|
|
2354
|
+
* already passed will cause the event to be emitted immediately and all
|
|
2355
|
+
* handlers removed.
|
|
2356
|
+
*
|
|
2357
|
+
* - Adding an 'error' event handler after an error has been emitted will
|
|
2358
|
+
* cause the event to be re-emitted immediately with the error previously
|
|
2359
|
+
* raised.
|
|
2360
|
+
*/
|
|
2361
|
+
on(t, e) {
|
|
2362
|
+
let s = super.on(t, e);
|
|
2363
|
+
if (t === "data")
|
|
2364
|
+
this[N] = !1, this[Z]++, !this[M].length && !this[C] && this[nt]();
|
|
2365
|
+
else if (t === "readable" && this[A] !== 0)
|
|
2366
|
+
super.emit("readable");
|
|
2367
|
+
else if (yi(t) && this[X])
|
|
2368
|
+
super.emit(t), this.removeAllListeners(t);
|
|
2369
|
+
else if (t === "error" && this[pt]) {
|
|
2370
|
+
let i = e;
|
|
2371
|
+
this[G] ? wt(() => i.call(this, this[pt])) : i.call(this, this[pt]);
|
|
2372
|
+
}
|
|
2373
|
+
return s;
|
|
2374
|
+
}
|
|
2375
|
+
/**
|
|
2376
|
+
* Alias for {@link Minipass#off}
|
|
2377
|
+
*/
|
|
2378
|
+
removeListener(t, e) {
|
|
2379
|
+
return this.off(t, e);
|
|
2380
|
+
}
|
|
2381
|
+
/**
|
|
2382
|
+
* Mostly identical to `EventEmitter.off`
|
|
2383
|
+
*
|
|
2384
|
+
* If a 'data' event handler is removed, and it was the last consumer
|
|
2385
|
+
* (ie, there are no pipe destinations or other 'data' event listeners),
|
|
2386
|
+
* then the flow of data will stop until there is another consumer or
|
|
2387
|
+
* {@link Minipass#resume} is explicitly called.
|
|
2388
|
+
*/
|
|
2389
|
+
off(t, e) {
|
|
2390
|
+
let s = super.off(t, e);
|
|
2391
|
+
return t === "data" && (this[Z] = this.listeners("data").length, this[Z] === 0 && !this[N] && !this[M].length && (this[C] = !1)), s;
|
|
2392
|
+
}
|
|
2393
|
+
/**
|
|
2394
|
+
* Mostly identical to `EventEmitter.removeAllListeners`
|
|
2395
|
+
*
|
|
2396
|
+
* If all 'data' event handlers are removed, and they were the last consumer
|
|
2397
|
+
* (ie, there are no pipe destinations), then the flow of data will stop
|
|
2398
|
+
* until there is another consumer or {@link Minipass#resume} is explicitly
|
|
2399
|
+
* called.
|
|
2400
|
+
*/
|
|
2401
|
+
removeAllListeners(t) {
|
|
2402
|
+
let e = super.removeAllListeners(t);
|
|
2403
|
+
return (t === "data" || t === void 0) && (this[Z] = 0, !this[N] && !this[M].length && (this[C] = !1)), e;
|
|
2404
|
+
}
|
|
2405
|
+
/**
|
|
2406
|
+
* true if the 'end' event has been emitted
|
|
2407
|
+
*/
|
|
2408
|
+
get emittedEnd() {
|
|
2409
|
+
return this[X];
|
|
2410
|
+
}
|
|
2411
|
+
[K]() {
|
|
2412
|
+
!this[Dt] && !this[X] && !this[v] && this[k].length === 0 && this[q] && (this[Dt] = !0, this.emit("end"), this.emit("prefinish"), this.emit(
|
|
2413
|
+
"finish"), this[Ot] && this.emit("close"), this[Dt] = !1);
|
|
2414
|
+
}
|
|
2415
|
+
/**
|
|
2416
|
+
* Mostly identical to `EventEmitter.emit`, with the following
|
|
2417
|
+
* behavior differences to prevent data loss and unnecessary hangs:
|
|
2418
|
+
*
|
|
2419
|
+
* If the stream has been destroyed, and the event is something other
|
|
2420
|
+
* than 'close' or 'error', then `false` is returned and no handlers
|
|
2421
|
+
* are called.
|
|
2422
|
+
*
|
|
2423
|
+
* If the event is 'end', and has already been emitted, then the event
|
|
2424
|
+
* is ignored. If the stream is in a paused or non-flowing state, then
|
|
2425
|
+
* the event will be deferred until data flow resumes. If the stream is
|
|
2426
|
+
* async, then handlers will be called on the next tick rather than
|
|
2427
|
+
* immediately.
|
|
2428
|
+
*
|
|
2429
|
+
* If the event is 'close', and 'end' has not yet been emitted, then
|
|
2430
|
+
* the event will be deferred until after 'end' is emitted.
|
|
2431
|
+
*
|
|
2432
|
+
* If the event is 'error', and an AbortSignal was provided for the stream,
|
|
2433
|
+
* and there are no listeners, then the event is ignored, matching the
|
|
2434
|
+
* behavior of node core streams in the presense of an AbortSignal.
|
|
2435
|
+
*
|
|
2436
|
+
* If the event is 'finish' or 'prefinish', then all listeners will be
|
|
2437
|
+
* removed after emitting the event, to prevent double-firing.
|
|
2438
|
+
*/
|
|
2439
|
+
emit(t, ...e) {
|
|
2440
|
+
let s = e[0];
|
|
2441
|
+
if (t !== "error" && t !== "close" && t !== v && this[v])
|
|
2442
|
+
return !1;
|
|
2443
|
+
if (t === "data")
|
|
2444
|
+
return !this[D] && !s ? !1 : this[G] ? (wt(() => this[te](s)), !0) : this[te](s);
|
|
2445
|
+
if (t === "end")
|
|
2446
|
+
return this[Ve]();
|
|
2447
|
+
if (t === "close") {
|
|
2448
|
+
if (this[Ot] = !0, !this[X] && !this[v])
|
|
2449
|
+
return !1;
|
|
2450
|
+
let r = super.emit("close");
|
|
2451
|
+
return this.removeAllListeners("close"), r;
|
|
2452
|
+
} else if (t === "error") {
|
|
2453
|
+
this[pt] = s, super.emit(Qt, s);
|
|
2454
|
+
let r = !this[gt] || this.listeners("error").length ? super.emit("error", s) : !1;
|
|
2455
|
+
return this[K](), r;
|
|
2456
|
+
} else if (t === "resume") {
|
|
2457
|
+
let r = super.emit("resume");
|
|
2458
|
+
return this[K](), r;
|
|
2459
|
+
} else if (t === "finish" || t === "prefinish") {
|
|
2460
|
+
let r = super.emit(t);
|
|
2461
|
+
return this.removeAllListeners(t), r;
|
|
2462
|
+
}
|
|
2463
|
+
let i = super.emit(t, ...e);
|
|
2464
|
+
return this[K](), i;
|
|
2465
|
+
}
|
|
2466
|
+
[te](t) {
|
|
2467
|
+
for (let s of this[M])
|
|
2468
|
+
s.dest.write(t) === !1 && this.pause();
|
|
2469
|
+
let e = this[N] ? !1 : super.emit("data", t);
|
|
2470
|
+
return this[K](), e;
|
|
2471
|
+
}
|
|
2472
|
+
[Ve]() {
|
|
2473
|
+
return this[X] ? !1 : (this[X] = !0, this.readable = !1, this[G] ? (wt(() => this[ee]()), !0) : this[ee]());
|
|
2474
|
+
}
|
|
2475
|
+
[ee]() {
|
|
2476
|
+
if (this[rt]) {
|
|
2477
|
+
let e = this[rt].end();
|
|
2478
|
+
if (e) {
|
|
2479
|
+
for (let s of this[M])
|
|
2480
|
+
s.dest.write(e);
|
|
2481
|
+
this[N] || super.emit("data", e);
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
for (let e of this[M])
|
|
2485
|
+
e.end();
|
|
2486
|
+
let t = super.emit("end");
|
|
2487
|
+
return this.removeAllListeners("end"), t;
|
|
2488
|
+
}
|
|
2489
|
+
/**
|
|
2490
|
+
* Return a Promise that resolves to an array of all emitted data once
|
|
2491
|
+
* the stream ends.
|
|
2492
|
+
*/
|
|
2493
|
+
async collect() {
|
|
2494
|
+
let t = Object.assign([], {
|
|
2495
|
+
dataLength: 0
|
|
2496
|
+
});
|
|
2497
|
+
this[D] || (t.dataLength = 0);
|
|
2498
|
+
let e = this.promise();
|
|
2499
|
+
return this.on("data", (s) => {
|
|
2500
|
+
t.push(s), this[D] || (t.dataLength += s.length);
|
|
2501
|
+
}), await e, t;
|
|
2502
|
+
}
|
|
2503
|
+
/**
|
|
2504
|
+
* Return a Promise that resolves to the concatenation of all emitted data
|
|
2505
|
+
* once the stream ends.
|
|
2506
|
+
*
|
|
2507
|
+
* Not allowed on objectMode streams.
|
|
2508
|
+
*/
|
|
2509
|
+
async concat() {
|
|
2510
|
+
if (this[D])
|
|
2511
|
+
throw new Error("cannot concat in objectMode");
|
|
2512
|
+
let t = await this.collect();
|
|
2513
|
+
return this[B] ? t.join("") : Buffer.concat(t, t.dataLength);
|
|
2514
|
+
}
|
|
2515
|
+
/**
|
|
2516
|
+
* Return a void Promise that resolves once the stream ends.
|
|
2517
|
+
*/
|
|
2518
|
+
async promise() {
|
|
2519
|
+
return new Promise((t, e) => {
|
|
2520
|
+
this.on(v, () => e(new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
|
|
2521
|
+
});
|
|
2522
|
+
}
|
|
2523
|
+
/**
|
|
2524
|
+
* Asynchronous `for await of` iteration.
|
|
2525
|
+
*
|
|
2526
|
+
* This will continue emitting all chunks until the stream terminates.
|
|
2527
|
+
*/
|
|
2528
|
+
[Symbol.asyncIterator]() {
|
|
2529
|
+
this[N] = !1;
|
|
2530
|
+
let t = !1, e = /* @__PURE__ */ l(async () => (this.pause(), t = !0, { value: void 0, done: !0 }), "stop");
|
|
2531
|
+
return {
|
|
2532
|
+
next: /* @__PURE__ */ l(() => {
|
|
2533
|
+
if (t)
|
|
2534
|
+
return e();
|
|
2535
|
+
let i = this.read();
|
|
2536
|
+
if (i !== null)
|
|
2537
|
+
return Promise.resolve({ done: !1, value: i });
|
|
2538
|
+
if (this[q])
|
|
2539
|
+
return e();
|
|
2540
|
+
let r, o, h = /* @__PURE__ */ l((u) => {
|
|
2541
|
+
this.off("data", a), this.off("end", c), this.off(v, f), e(), o(u);
|
|
2542
|
+
}, "onerr"), a = /* @__PURE__ */ l((u) => {
|
|
2543
|
+
this.off("error", h), this.off("end", c), this.off(v, f), this.pause(), r({ value: u, done: !!this[q] });
|
|
2544
|
+
}, "ondata"), c = /* @__PURE__ */ l(() => {
|
|
2545
|
+
this.off("error", h), this.off("data", a), this.off(v, f), e(), r({ done: !0, value: void 0 });
|
|
2546
|
+
}, "onend"), f = /* @__PURE__ */ l(() => h(new Error("stream destroyed")), "ondestroy");
|
|
2547
|
+
return new Promise((u, d) => {
|
|
2548
|
+
o = d, r = u, this.once(v, f), this.once("error", h), this.once("end", c), this.once("data", a);
|
|
2549
|
+
});
|
|
2550
|
+
}, "next"),
|
|
2551
|
+
throw: e,
|
|
2552
|
+
return: e,
|
|
2553
|
+
[Symbol.asyncIterator]() {
|
|
2554
|
+
return this;
|
|
2555
|
+
}
|
|
2556
|
+
};
|
|
2557
|
+
}
|
|
2558
|
+
/**
|
|
2559
|
+
* Synchronous `for of` iteration.
|
|
2560
|
+
*
|
|
2561
|
+
* The iteration will terminate when the internal buffer runs out, even
|
|
2562
|
+
* if the stream has not yet terminated.
|
|
2563
|
+
*/
|
|
2564
|
+
[Symbol.iterator]() {
|
|
2565
|
+
this[N] = !1;
|
|
2566
|
+
let t = !1, e = /* @__PURE__ */ l(() => (this.pause(), this.off(Qt, e), this.off(v, e), this.off("end", e), t = !0, { done: !0, value: void 0 }),
|
|
2567
|
+
"stop"), s = /* @__PURE__ */ l(() => {
|
|
2568
|
+
if (t)
|
|
2569
|
+
return e();
|
|
2570
|
+
let i = this.read();
|
|
2571
|
+
return i === null ? e() : { done: !1, value: i };
|
|
2572
|
+
}, "next");
|
|
2573
|
+
return this.once("end", e), this.once(Qt, e), this.once(v, e), {
|
|
2574
|
+
next: s,
|
|
2575
|
+
throw: e,
|
|
2576
|
+
return: e,
|
|
2577
|
+
[Symbol.iterator]() {
|
|
2578
|
+
return this;
|
|
2579
|
+
}
|
|
2580
|
+
};
|
|
2581
|
+
}
|
|
2582
|
+
/**
|
|
2583
|
+
* Destroy a stream, preventing it from being used for any further purpose.
|
|
2584
|
+
*
|
|
2585
|
+
* If the stream has a `close()` method, then it will be called on
|
|
2586
|
+
* destruction.
|
|
2587
|
+
*
|
|
2588
|
+
* After destruction, any attempt to write data, read data, or emit most
|
|
2589
|
+
* events will be ignored.
|
|
2590
|
+
*
|
|
2591
|
+
* If an error argument is provided, then it will be emitted in an
|
|
2592
|
+
* 'error' event.
|
|
2593
|
+
*/
|
|
2594
|
+
destroy(t) {
|
|
2595
|
+
if (this[v])
|
|
2596
|
+
return t ? this.emit("error", t) : this.emit(v), this;
|
|
2597
|
+
this[v] = !0, this[N] = !0, this[k].length = 0, this[A] = 0;
|
|
2598
|
+
let e = this;
|
|
2599
|
+
return typeof e.close == "function" && !this[Ot] && e.close(), t ? this.emit("error", t) : this.emit(v), this;
|
|
2600
|
+
}
|
|
2601
|
+
/**
|
|
2602
|
+
* Alias for {@link isStream}
|
|
2603
|
+
*
|
|
2604
|
+
* Former export location, maintained for backwards compatibility.
|
|
2605
|
+
*
|
|
2606
|
+
* @deprecated
|
|
2607
|
+
*/
|
|
2608
|
+
static get isStream() {
|
|
2609
|
+
return pi;
|
|
2610
|
+
}
|
|
2611
|
+
};
|
|
2612
|
+
|
|
2613
|
+
// ../node_modules/path-scurry/dist/esm/index.js
|
|
2614
|
+
var Fi = Di.native, bt = {
|
|
2615
|
+
lstatSync: Ci,
|
|
2616
|
+
readdir: ki,
|
|
2617
|
+
readdirSync: Ai,
|
|
2618
|
+
readlinkSync: Ri,
|
|
2619
|
+
realpathSync: Fi,
|
|
2620
|
+
promises: {
|
|
2621
|
+
lstat: Mi,
|
|
2622
|
+
readdir: _i,
|
|
2623
|
+
readlink: Ni,
|
|
2624
|
+
realpath: Li
|
|
2625
|
+
}
|
|
2626
|
+
}, ts = /* @__PURE__ */ l((n) => !n || n === bt || n === Oi ? bt : {
|
|
2627
|
+
...bt,
|
|
2628
|
+
...n,
|
|
2629
|
+
promises: {
|
|
2630
|
+
...bt.promises,
|
|
2631
|
+
...n.promises || {}
|
|
2632
|
+
}
|
|
2633
|
+
}, "fsFromOption"), es = /^\\\\\?\\([a-z]:)\\?$/i, Pi = /* @__PURE__ */ l((n) => n.replace(/\//g, "\\").replace(es, "$1\\"), "uncToDrive"), Wi = /[\\\/]/,
|
|
2634
|
+
W = 0, ss = 1, is = 2, H = 4, rs = 6, ns = 8, Q = 10, os = 12, P = 15, yt = ~P, ne = 16, Ye = 32, St = 64, U = 128, Lt = 256, Wt = 512, Je = St |
|
|
2635
|
+
U | Wt, ji = 1023, oe = /* @__PURE__ */ l((n) => n.isFile() ? ns : n.isDirectory() ? H : n.isSymbolicLink() ? Q : n.isCharacterDevice() ? is :
|
|
2636
|
+
n.isBlockDevice() ? rs : n.isSocket() ? os : n.isFIFO() ? ss : W, "entToType"), Ze = /* @__PURE__ */ new Map(), Et = /* @__PURE__ */ l((n) => {
|
|
2637
|
+
let t = Ze.get(n);
|
|
2638
|
+
if (t)
|
|
2639
|
+
return t;
|
|
2640
|
+
let e = n.normalize("NFKD");
|
|
2641
|
+
return Ze.set(n, e), e;
|
|
2642
|
+
}, "normalize"), Qe = /* @__PURE__ */ new Map(), Pt = /* @__PURE__ */ l((n) => {
|
|
2643
|
+
let t = Qe.get(n);
|
|
2644
|
+
if (t)
|
|
2645
|
+
return t;
|
|
2646
|
+
let e = Et(n.toLowerCase());
|
|
2647
|
+
return Qe.set(n, e), e;
|
|
2648
|
+
}, "normalizeNocase"), jt = class extends dt {
|
|
2649
|
+
static {
|
|
2650
|
+
l(this, "ResolveCache");
|
|
2651
|
+
}
|
|
2652
|
+
constructor() {
|
|
2653
|
+
super({ max: 256 });
|
|
2654
|
+
}
|
|
2655
|
+
}, ae = class extends dt {
|
|
2656
|
+
static {
|
|
2657
|
+
l(this, "ChildrenCache");
|
|
2658
|
+
}
|
|
2659
|
+
constructor(t = 16 * 1024) {
|
|
2660
|
+
super({
|
|
2661
|
+
maxSize: t,
|
|
2662
|
+
// parent + children
|
|
2663
|
+
sizeCalculation: /* @__PURE__ */ l((e) => e.length + 1, "sizeCalculation")
|
|
2664
|
+
});
|
|
2665
|
+
}
|
|
2666
|
+
}, hs = Symbol("PathScurry setAsCwd"), O = class {
|
|
2667
|
+
static {
|
|
2668
|
+
l(this, "PathBase");
|
|
2669
|
+
}
|
|
2670
|
+
/**
|
|
2671
|
+
* the basename of this path
|
|
2672
|
+
*
|
|
2673
|
+
* **Important**: *always* test the path name against any test string
|
|
2674
|
+
* usingthe {@link isNamed} method, and not by directly comparing this
|
|
2675
|
+
* string. Otherwise, unicode path strings that the system sees as identical
|
|
2676
|
+
* will not be properly treated as the same path, leading to incorrect
|
|
2677
|
+
* behavior and possible security issues.
|
|
2678
|
+
*/
|
|
2679
|
+
name;
|
|
2680
|
+
/**
|
|
2681
|
+
* the Path entry corresponding to the path root.
|
|
2682
|
+
*
|
|
2683
|
+
* @internal
|
|
2684
|
+
*/
|
|
2685
|
+
root;
|
|
2686
|
+
/**
|
|
2687
|
+
* All roots found within the current PathScurry family
|
|
2688
|
+
*
|
|
2689
|
+
* @internal
|
|
2690
|
+
*/
|
|
2691
|
+
roots;
|
|
2692
|
+
/**
|
|
2693
|
+
* a reference to the parent path, or undefined in the case of root entries
|
|
2694
|
+
*
|
|
2695
|
+
* @internal
|
|
2696
|
+
*/
|
|
2697
|
+
parent;
|
|
2698
|
+
/**
|
|
2699
|
+
* boolean indicating whether paths are compared case-insensitively
|
|
2700
|
+
* @internal
|
|
2701
|
+
*/
|
|
2702
|
+
nocase;
|
|
2703
|
+
/**
|
|
2704
|
+
* boolean indicating that this path is the current working directory
|
|
2705
|
+
* of the PathScurry collection that contains it.
|
|
2706
|
+
*/
|
|
2707
|
+
isCWD = !1;
|
|
2708
|
+
// potential default fs override
|
|
2709
|
+
#t;
|
|
2710
|
+
// Stats fields
|
|
2711
|
+
#e;
|
|
2712
|
+
get dev() {
|
|
2713
|
+
return this.#e;
|
|
2714
|
+
}
|
|
2715
|
+
#n;
|
|
2716
|
+
get mode() {
|
|
2717
|
+
return this.#n;
|
|
2718
|
+
}
|
|
2719
|
+
#i;
|
|
2720
|
+
get nlink() {
|
|
2721
|
+
return this.#i;
|
|
2722
|
+
}
|
|
2723
|
+
#o;
|
|
2724
|
+
get uid() {
|
|
2725
|
+
return this.#o;
|
|
2726
|
+
}
|
|
2727
|
+
#S;
|
|
2728
|
+
get gid() {
|
|
2729
|
+
return this.#S;
|
|
2730
|
+
}
|
|
2731
|
+
#l;
|
|
2732
|
+
get rdev() {
|
|
2733
|
+
return this.#l;
|
|
2734
|
+
}
|
|
2735
|
+
#f;
|
|
2736
|
+
get blksize() {
|
|
2737
|
+
return this.#f;
|
|
2738
|
+
}
|
|
2739
|
+
#h;
|
|
2740
|
+
get ino() {
|
|
2741
|
+
return this.#h;
|
|
2742
|
+
}
|
|
2743
|
+
#a;
|
|
2744
|
+
get size() {
|
|
2745
|
+
return this.#a;
|
|
2746
|
+
}
|
|
2747
|
+
#r;
|
|
2748
|
+
get blocks() {
|
|
2749
|
+
return this.#r;
|
|
2750
|
+
}
|
|
2751
|
+
#g;
|
|
2752
|
+
get atimeMs() {
|
|
2753
|
+
return this.#g;
|
|
2754
|
+
}
|
|
2755
|
+
#w;
|
|
2756
|
+
get mtimeMs() {
|
|
2757
|
+
return this.#w;
|
|
2758
|
+
}
|
|
2759
|
+
#d;
|
|
2760
|
+
get ctimeMs() {
|
|
2761
|
+
return this.#d;
|
|
2762
|
+
}
|
|
2763
|
+
#u;
|
|
2764
|
+
get birthtimeMs() {
|
|
2765
|
+
return this.#u;
|
|
2766
|
+
}
|
|
2767
|
+
#v;
|
|
2768
|
+
get atime() {
|
|
2769
|
+
return this.#v;
|
|
2770
|
+
}
|
|
2771
|
+
#m;
|
|
2772
|
+
get mtime() {
|
|
2773
|
+
return this.#m;
|
|
2774
|
+
}
|
|
2775
|
+
#T;
|
|
2776
|
+
get ctime() {
|
|
2777
|
+
return this.#T;
|
|
2778
|
+
}
|
|
2779
|
+
#C;
|
|
2780
|
+
get birthtime() {
|
|
2781
|
+
return this.#C;
|
|
2782
|
+
}
|
|
2783
|
+
#b;
|
|
2784
|
+
#E;
|
|
2785
|
+
#x;
|
|
2786
|
+
#p;
|
|
2787
|
+
#D;
|
|
2788
|
+
#k;
|
|
2789
|
+
#s;
|
|
2790
|
+
#M;
|
|
2791
|
+
#y;
|
|
2792
|
+
#O;
|
|
2793
|
+
/**
|
|
2794
|
+
* This property is for compatibility with the Dirent class as of
|
|
2795
|
+
* Node v20, where Dirent['parentPath'] refers to the path of the
|
|
2796
|
+
* directory that was passed to readdir. For root entries, it's the path
|
|
2797
|
+
* to the entry itself.
|
|
2798
|
+
*/
|
|
2799
|
+
get parentPath() {
|
|
2800
|
+
return (this.parent || this).fullpath();
|
|
2801
|
+
}
|
|
2802
|
+
/**
|
|
2803
|
+
* Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,
|
|
2804
|
+
* this property refers to the *parent* path, not the path object itself.
|
|
2805
|
+
*/
|
|
2806
|
+
get path() {
|
|
2807
|
+
return this.parentPath;
|
|
2808
|
+
}
|
|
2809
|
+
/**
|
|
2810
|
+
* Do not create new Path objects directly. They should always be accessed
|
|
2811
|
+
* via the PathScurry class or other methods on the Path class.
|
|
2812
|
+
*
|
|
2813
|
+
* @internal
|
|
2814
|
+
*/
|
|
2815
|
+
constructor(t, e = W, s, i, r, o, h) {
|
|
2816
|
+
this.name = t, this.#b = r ? Pt(t) : Et(t), this.#s = e & ji, this.nocase = r, this.roots = i, this.root = s || this, this.#M = o, this.#x =
|
|
2817
|
+
h.fullpath, this.#D = h.relative, this.#k = h.relativePosix, this.parent = h.parent, this.parent ? this.#t = this.parent.#t : this.#t = ts(
|
|
2818
|
+
h.fs);
|
|
2819
|
+
}
|
|
2820
|
+
/**
|
|
2821
|
+
* Returns the depth of the Path object from its root.
|
|
2822
|
+
*
|
|
2823
|
+
* For example, a path at `/foo/bar` would have a depth of 2.
|
|
2824
|
+
*/
|
|
2825
|
+
depth() {
|
|
2826
|
+
return this.#E !== void 0 ? this.#E : this.parent ? this.#E = this.parent.depth() + 1 : this.#E = 0;
|
|
2827
|
+
}
|
|
2828
|
+
/**
|
|
2829
|
+
* @internal
|
|
2830
|
+
*/
|
|
2831
|
+
childrenCache() {
|
|
2832
|
+
return this.#M;
|
|
2833
|
+
}
|
|
2834
|
+
/**
|
|
2835
|
+
* Get the Path object referenced by the string path, resolved from this Path
|
|
2836
|
+
*/
|
|
2837
|
+
resolve(t) {
|
|
2838
|
+
if (!t)
|
|
2839
|
+
return this;
|
|
2840
|
+
let e = this.getRootString(t), i = t.substring(e.length).split(this.splitSep);
|
|
2841
|
+
return e ? this.getRoot(e).#_(i) : this.#_(i);
|
|
2842
|
+
}
|
|
2843
|
+
#_(t) {
|
|
2844
|
+
let e = this;
|
|
2845
|
+
for (let s of t)
|
|
2846
|
+
e = e.child(s);
|
|
2847
|
+
return e;
|
|
2848
|
+
}
|
|
2849
|
+
/**
|
|
2850
|
+
* Returns the cached children Path objects, if still available. If they
|
|
2851
|
+
* have fallen out of the cache, then returns an empty array, and resets the
|
|
2852
|
+
* READDIR_CALLED bit, so that future calls to readdir() will require an fs
|
|
2853
|
+
* lookup.
|
|
2854
|
+
*
|
|
2855
|
+
* @internal
|
|
2856
|
+
*/
|
|
2857
|
+
children() {
|
|
2858
|
+
let t = this.#M.get(this);
|
|
2859
|
+
if (t)
|
|
2860
|
+
return t;
|
|
2861
|
+
let e = Object.assign([], { provisional: 0 });
|
|
2862
|
+
return this.#M.set(this, e), this.#s &= ~ne, e;
|
|
2863
|
+
}
|
|
2864
|
+
/**
|
|
2865
|
+
* Resolves a path portion and returns or creates the child Path.
|
|
2866
|
+
*
|
|
2867
|
+
* Returns `this` if pathPart is `''` or `'.'`, or `parent` if pathPart is
|
|
2868
|
+
* `'..'`.
|
|
2869
|
+
*
|
|
2870
|
+
* This should not be called directly. If `pathPart` contains any path
|
|
2871
|
+
* separators, it will lead to unsafe undefined behavior.
|
|
2872
|
+
*
|
|
2873
|
+
* Use `Path.resolve()` instead.
|
|
2874
|
+
*
|
|
2875
|
+
* @internal
|
|
2876
|
+
*/
|
|
2877
|
+
child(t, e) {
|
|
2878
|
+
if (t === "" || t === ".")
|
|
2879
|
+
return this;
|
|
2880
|
+
if (t === "..")
|
|
2881
|
+
return this.parent || this;
|
|
2882
|
+
let s = this.children(), i = this.nocase ? Pt(t) : Et(t);
|
|
2883
|
+
for (let a of s)
|
|
2884
|
+
if (a.#b === i)
|
|
2885
|
+
return a;
|
|
2886
|
+
let r = this.parent ? this.sep : "", o = this.#x ? this.#x + r + t : void 0, h = this.newChild(t, W, {
|
|
2887
|
+
...e,
|
|
2888
|
+
parent: this,
|
|
2889
|
+
fullpath: o
|
|
2890
|
+
});
|
|
2891
|
+
return this.canReaddir() || (h.#s |= U), s.push(h), h;
|
|
2892
|
+
}
|
|
2893
|
+
/**
|
|
2894
|
+
* The relative path from the cwd. If it does not share an ancestor with
|
|
2895
|
+
* the cwd, then this ends up being equivalent to the fullpath()
|
|
2896
|
+
*/
|
|
2897
|
+
relative() {
|
|
2898
|
+
if (this.isCWD)
|
|
2899
|
+
return "";
|
|
2900
|
+
if (this.#D !== void 0)
|
|
2901
|
+
return this.#D;
|
|
2902
|
+
let t = this.name, e = this.parent;
|
|
2903
|
+
if (!e)
|
|
2904
|
+
return this.#D = this.name;
|
|
2905
|
+
let s = e.relative();
|
|
2906
|
+
return s + (!s || !e.parent ? "" : this.sep) + t;
|
|
2907
|
+
}
|
|
2908
|
+
/**
|
|
2909
|
+
* The relative path from the cwd, using / as the path separator.
|
|
2910
|
+
* If it does not share an ancestor with
|
|
2911
|
+
* the cwd, then this ends up being equivalent to the fullpathPosix()
|
|
2912
|
+
* On posix systems, this is identical to relative().
|
|
2913
|
+
*/
|
|
2914
|
+
relativePosix() {
|
|
2915
|
+
if (this.sep === "/")
|
|
2916
|
+
return this.relative();
|
|
2917
|
+
if (this.isCWD)
|
|
2918
|
+
return "";
|
|
2919
|
+
if (this.#k !== void 0)
|
|
2920
|
+
return this.#k;
|
|
2921
|
+
let t = this.name, e = this.parent;
|
|
2922
|
+
if (!e)
|
|
2923
|
+
return this.#k = this.fullpathPosix();
|
|
2924
|
+
let s = e.relativePosix();
|
|
2925
|
+
return s + (!s || !e.parent ? "" : "/") + t;
|
|
2926
|
+
}
|
|
2927
|
+
/**
|
|
2928
|
+
* The fully resolved path string for this Path entry
|
|
2929
|
+
*/
|
|
2930
|
+
fullpath() {
|
|
2931
|
+
if (this.#x !== void 0)
|
|
2932
|
+
return this.#x;
|
|
2933
|
+
let t = this.name, e = this.parent;
|
|
2934
|
+
if (!e)
|
|
2935
|
+
return this.#x = this.name;
|
|
2936
|
+
let i = e.fullpath() + (e.parent ? this.sep : "") + t;
|
|
2937
|
+
return this.#x = i;
|
|
2938
|
+
}
|
|
2939
|
+
/**
|
|
2940
|
+
* On platforms other than windows, this is identical to fullpath.
|
|
2941
|
+
*
|
|
2942
|
+
* On windows, this is overridden to return the forward-slash form of the
|
|
2943
|
+
* full UNC path.
|
|
2944
|
+
*/
|
|
2945
|
+
fullpathPosix() {
|
|
2946
|
+
if (this.#p !== void 0)
|
|
2947
|
+
return this.#p;
|
|
2948
|
+
if (this.sep === "/")
|
|
2949
|
+
return this.#p = this.fullpath();
|
|
2950
|
+
if (!this.parent) {
|
|
2951
|
+
let i = this.fullpath().replace(/\\/g, "/");
|
|
2952
|
+
return /^[a-z]:\//i.test(i) ? this.#p = `//?/${i}` : this.#p = i;
|
|
2953
|
+
}
|
|
2954
|
+
let t = this.parent, e = t.fullpathPosix(), s = e + (!e || !t.parent ? "" : "/") + this.name;
|
|
2955
|
+
return this.#p = s;
|
|
2956
|
+
}
|
|
2957
|
+
/**
|
|
2958
|
+
* Is the Path of an unknown type?
|
|
2959
|
+
*
|
|
2960
|
+
* Note that we might know *something* about it if there has been a previous
|
|
2961
|
+
* filesystem operation, for example that it does not exist, or is not a
|
|
2962
|
+
* link, or whether it has child entries.
|
|
2963
|
+
*/
|
|
2964
|
+
isUnknown() {
|
|
2965
|
+
return (this.#s & P) === W;
|
|
2966
|
+
}
|
|
2967
|
+
isType(t) {
|
|
2968
|
+
return this[`is${t}`]();
|
|
2969
|
+
}
|
|
2970
|
+
getType() {
|
|
2971
|
+
return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" :
|
|
2972
|
+
this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : (
|
|
2973
|
+
/* c8 ignore start */
|
|
2974
|
+
this.isSocket() ? "Socket" : "Unknown"
|
|
2975
|
+
);
|
|
2976
|
+
}
|
|
2977
|
+
/**
|
|
2978
|
+
* Is the Path a regular file?
|
|
2979
|
+
*/
|
|
2980
|
+
isFile() {
|
|
2981
|
+
return (this.#s & P) === ns;
|
|
2982
|
+
}
|
|
2983
|
+
/**
|
|
2984
|
+
* Is the Path a directory?
|
|
2985
|
+
*/
|
|
2986
|
+
isDirectory() {
|
|
2987
|
+
return (this.#s & P) === H;
|
|
2988
|
+
}
|
|
2989
|
+
/**
|
|
2990
|
+
* Is the path a character device?
|
|
2991
|
+
*/
|
|
2992
|
+
isCharacterDevice() {
|
|
2993
|
+
return (this.#s & P) === is;
|
|
2994
|
+
}
|
|
2995
|
+
/**
|
|
2996
|
+
* Is the path a block device?
|
|
2997
|
+
*/
|
|
2998
|
+
isBlockDevice() {
|
|
2999
|
+
return (this.#s & P) === rs;
|
|
3000
|
+
}
|
|
3001
|
+
/**
|
|
3002
|
+
* Is the path a FIFO pipe?
|
|
3003
|
+
*/
|
|
3004
|
+
isFIFO() {
|
|
3005
|
+
return (this.#s & P) === ss;
|
|
3006
|
+
}
|
|
3007
|
+
/**
|
|
3008
|
+
* Is the path a socket?
|
|
3009
|
+
*/
|
|
3010
|
+
isSocket() {
|
|
3011
|
+
return (this.#s & P) === os;
|
|
3012
|
+
}
|
|
3013
|
+
/**
|
|
3014
|
+
* Is the path a symbolic link?
|
|
3015
|
+
*/
|
|
3016
|
+
isSymbolicLink() {
|
|
3017
|
+
return (this.#s & Q) === Q;
|
|
3018
|
+
}
|
|
3019
|
+
/**
|
|
3020
|
+
* Return the entry if it has been subject of a successful lstat, or
|
|
3021
|
+
* undefined otherwise.
|
|
3022
|
+
*
|
|
3023
|
+
* Does not read the filesystem, so an undefined result *could* simply
|
|
3024
|
+
* mean that we haven't called lstat on it.
|
|
3025
|
+
*/
|
|
3026
|
+
lstatCached() {
|
|
3027
|
+
return this.#s & Ye ? this : void 0;
|
|
3028
|
+
}
|
|
3029
|
+
/**
|
|
3030
|
+
* Return the cached link target if the entry has been the subject of a
|
|
3031
|
+
* successful readlink, or undefined otherwise.
|
|
3032
|
+
*
|
|
3033
|
+
* Does not read the filesystem, so an undefined result *could* just mean we
|
|
3034
|
+
* don't have any cached data. Only use it if you are very sure that a
|
|
3035
|
+
* readlink() has been called at some point.
|
|
3036
|
+
*/
|
|
3037
|
+
readlinkCached() {
|
|
3038
|
+
return this.#y;
|
|
3039
|
+
}
|
|
3040
|
+
/**
|
|
3041
|
+
* Returns the cached realpath target if the entry has been the subject
|
|
3042
|
+
* of a successful realpath, or undefined otherwise.
|
|
3043
|
+
*
|
|
3044
|
+
* Does not read the filesystem, so an undefined result *could* just mean we
|
|
3045
|
+
* don't have any cached data. Only use it if you are very sure that a
|
|
3046
|
+
* realpath() has been called at some point.
|
|
3047
|
+
*/
|
|
3048
|
+
realpathCached() {
|
|
3049
|
+
return this.#O;
|
|
3050
|
+
}
|
|
3051
|
+
/**
|
|
3052
|
+
* Returns the cached child Path entries array if the entry has been the
|
|
3053
|
+
* subject of a successful readdir(), or [] otherwise.
|
|
3054
|
+
*
|
|
3055
|
+
* Does not read the filesystem, so an empty array *could* just mean we
|
|
3056
|
+
* don't have any cached data. Only use it if you are very sure that a
|
|
3057
|
+
* readdir() has been called recently enough to still be valid.
|
|
3058
|
+
*/
|
|
3059
|
+
readdirCached() {
|
|
3060
|
+
let t = this.children();
|
|
3061
|
+
return t.slice(0, t.provisional);
|
|
3062
|
+
}
|
|
3063
|
+
/**
|
|
3064
|
+
* Return true if it's worth trying to readlink. Ie, we don't (yet) have
|
|
3065
|
+
* any indication that readlink will definitely fail.
|
|
3066
|
+
*
|
|
3067
|
+
* Returns false if the path is known to not be a symlink, if a previous
|
|
3068
|
+
* readlink failed, or if the entry does not exist.
|
|
3069
|
+
*/
|
|
3070
|
+
canReadlink() {
|
|
3071
|
+
if (this.#y)
|
|
3072
|
+
return !0;
|
|
3073
|
+
if (!this.parent)
|
|
3074
|
+
return !1;
|
|
3075
|
+
let t = this.#s & P;
|
|
3076
|
+
return !(t !== W && t !== Q || this.#s & Lt || this.#s & U);
|
|
3077
|
+
}
|
|
3078
|
+
/**
|
|
3079
|
+
* Return true if readdir has previously been successfully called on this
|
|
3080
|
+
* path, indicating that cachedReaddir() is likely valid.
|
|
3081
|
+
*/
|
|
3082
|
+
calledReaddir() {
|
|
3083
|
+
return !!(this.#s & ne);
|
|
3084
|
+
}
|
|
3085
|
+
/**
|
|
3086
|
+
* Returns true if the path is known to not exist. That is, a previous lstat
|
|
3087
|
+
* or readdir failed to verify its existence when that would have been
|
|
3088
|
+
* expected, or a parent entry was marked either enoent or enotdir.
|
|
3089
|
+
*/
|
|
3090
|
+
isENOENT() {
|
|
3091
|
+
return !!(this.#s & U);
|
|
3092
|
+
}
|
|
3093
|
+
/**
|
|
3094
|
+
* Return true if the path is a match for the given path name. This handles
|
|
3095
|
+
* case sensitivity and unicode normalization.
|
|
3096
|
+
*
|
|
3097
|
+
* Note: even on case-sensitive systems, it is **not** safe to test the
|
|
3098
|
+
* equality of the `.name` property to determine whether a given pathname
|
|
3099
|
+
* matches, due to unicode normalization mismatches.
|
|
3100
|
+
*
|
|
3101
|
+
* Always use this method instead of testing the `path.name` property
|
|
3102
|
+
* directly.
|
|
3103
|
+
*/
|
|
3104
|
+
isNamed(t) {
|
|
3105
|
+
return this.nocase ? this.#b === Pt(t) : this.#b === Et(t);
|
|
3106
|
+
}
|
|
3107
|
+
/**
|
|
3108
|
+
* Return the Path object corresponding to the target of a symbolic link.
|
|
3109
|
+
*
|
|
3110
|
+
* If the Path is not a symbolic link, or if the readlink call fails for any
|
|
3111
|
+
* reason, `undefined` is returned.
|
|
3112
|
+
*
|
|
3113
|
+
* Result is cached, and thus may be outdated if the filesystem is mutated.
|
|
3114
|
+
*/
|
|
3115
|
+
async readlink() {
|
|
3116
|
+
let t = this.#y;
|
|
3117
|
+
if (t)
|
|
3118
|
+
return t;
|
|
3119
|
+
if (this.canReadlink() && this.parent)
|
|
3120
|
+
try {
|
|
3121
|
+
let e = await this.#t.promises.readlink(this.fullpath()), s = (await this.parent.realpath())?.resolve(e);
|
|
3122
|
+
if (s)
|
|
3123
|
+
return this.#y = s;
|
|
3124
|
+
} catch (e) {
|
|
3125
|
+
this.#c(e.code);
|
|
3126
|
+
return;
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
/**
|
|
3130
|
+
* Synchronous {@link PathBase.readlink}
|
|
3131
|
+
*/
|
|
3132
|
+
readlinkSync() {
|
|
3133
|
+
let t = this.#y;
|
|
3134
|
+
if (t)
|
|
3135
|
+
return t;
|
|
3136
|
+
if (this.canReadlink() && this.parent)
|
|
3137
|
+
try {
|
|
3138
|
+
let e = this.#t.readlinkSync(this.fullpath()), s = this.parent.realpathSync()?.resolve(e);
|
|
3139
|
+
if (s)
|
|
3140
|
+
return this.#y = s;
|
|
3141
|
+
} catch (e) {
|
|
3142
|
+
this.#c(e.code);
|
|
3143
|
+
return;
|
|
3144
|
+
}
|
|
3145
|
+
}
|
|
3146
|
+
#N(t) {
|
|
3147
|
+
this.#s |= ne;
|
|
3148
|
+
for (let e = t.provisional; e < t.length; e++) {
|
|
3149
|
+
let s = t[e];
|
|
3150
|
+
s && s.#L();
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
#L() {
|
|
3154
|
+
this.#s & U || (this.#s = (this.#s | U) & yt, this.#A());
|
|
3155
|
+
}
|
|
3156
|
+
#A() {
|
|
3157
|
+
let t = this.children();
|
|
3158
|
+
t.provisional = 0;
|
|
3159
|
+
for (let e of t)
|
|
3160
|
+
e.#L();
|
|
3161
|
+
}
|
|
3162
|
+
#R() {
|
|
3163
|
+
this.#s |= Wt, this.#P();
|
|
3164
|
+
}
|
|
3165
|
+
// save the information when we know the entry is not a dir
|
|
3166
|
+
#P() {
|
|
3167
|
+
if (this.#s & St)
|
|
3168
|
+
return;
|
|
3169
|
+
let t = this.#s;
|
|
3170
|
+
(t & P) === H && (t &= yt), this.#s = t | St, this.#A();
|
|
3171
|
+
}
|
|
3172
|
+
#W(t = "") {
|
|
3173
|
+
t === "ENOTDIR" || t === "EPERM" ? this.#P() : t === "ENOENT" ? this.#L() : this.children().provisional = 0;
|
|
3174
|
+
}
|
|
3175
|
+
#j(t = "") {
|
|
3176
|
+
t === "ENOTDIR" ? this.parent.#P() : t === "ENOENT" && this.#L();
|
|
3177
|
+
}
|
|
3178
|
+
#c(t = "") {
|
|
3179
|
+
let e = this.#s;
|
|
3180
|
+
e |= Lt, t === "ENOENT" && (e |= U), (t === "EINVAL" || t === "UNKNOWN") && (e &= yt), this.#s = e, t === "ENOTDIR" && this.parent && this.
|
|
3181
|
+
parent.#P();
|
|
3182
|
+
}
|
|
3183
|
+
#I(t, e) {
|
|
3184
|
+
return this.#F(t, e) || this.#z(t, e);
|
|
3185
|
+
}
|
|
3186
|
+
#z(t, e) {
|
|
3187
|
+
let s = oe(t), i = this.newChild(t.name, s, { parent: this }), r = i.#s & P;
|
|
3188
|
+
return r !== H && r !== Q && r !== W && (i.#s |= St), e.unshift(i), e.provisional++, i;
|
|
3189
|
+
}
|
|
3190
|
+
#F(t, e) {
|
|
3191
|
+
for (let s = e.provisional; s < e.length; s++) {
|
|
3192
|
+
let i = e[s];
|
|
3193
|
+
if ((this.nocase ? Pt(t.name) : Et(t.name)) === i.#b)
|
|
3194
|
+
return this.#B(t, i, s, e);
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3197
|
+
#B(t, e, s, i) {
|
|
3198
|
+
let r = e.name;
|
|
3199
|
+
return e.#s = e.#s & yt | oe(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1),
|
|
3200
|
+
i.unshift(e)), i.provisional++, e;
|
|
3201
|
+
}
|
|
3202
|
+
/**
|
|
3203
|
+
* Call lstat() on this Path, and update all known information that can be
|
|
3204
|
+
* determined.
|
|
3205
|
+
*
|
|
3206
|
+
* Note that unlike `fs.lstat()`, the returned value does not contain some
|
|
3207
|
+
* information, such as `mode`, `dev`, `nlink`, and `ino`. If that
|
|
3208
|
+
* information is required, you will need to call `fs.lstat` yourself.
|
|
3209
|
+
*
|
|
3210
|
+
* If the Path refers to a nonexistent file, or if the lstat call fails for
|
|
3211
|
+
* any reason, `undefined` is returned. Otherwise the updated Path object is
|
|
3212
|
+
* returned.
|
|
3213
|
+
*
|
|
3214
|
+
* Results are cached, and thus may be out of date if the filesystem is
|
|
3215
|
+
* mutated.
|
|
3216
|
+
*/
|
|
3217
|
+
async lstat() {
|
|
3218
|
+
if ((this.#s & U) === 0)
|
|
3219
|
+
try {
|
|
3220
|
+
return this.#H(await this.#t.promises.lstat(this.fullpath())), this;
|
|
3221
|
+
} catch (t) {
|
|
3222
|
+
this.#j(t.code);
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
/**
|
|
3226
|
+
* synchronous {@link PathBase.lstat}
|
|
3227
|
+
*/
|
|
3228
|
+
lstatSync() {
|
|
3229
|
+
if ((this.#s & U) === 0)
|
|
3230
|
+
try {
|
|
3231
|
+
return this.#H(this.#t.lstatSync(this.fullpath())), this;
|
|
3232
|
+
} catch (t) {
|
|
3233
|
+
this.#j(t.code);
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
#H(t) {
|
|
3237
|
+
let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: r, blksize: o, blocks: h, ctime: a, ctimeMs: c, dev: f, gid: u, ino: d, mode: p, mtime: w,
|
|
3238
|
+
mtimeMs: m, nlink: y, rdev: g, size: E, uid: S } = t;
|
|
3239
|
+
this.#v = e, this.#g = s, this.#C = i, this.#u = r, this.#f = o, this.#r = h, this.#T = a, this.#d = c, this.#e = f, this.#S = u, this.#h =
|
|
3240
|
+
d, this.#n = p, this.#m = w, this.#w = m, this.#i = y, this.#l = g, this.#a = E, this.#o = S;
|
|
3241
|
+
let b = oe(t);
|
|
3242
|
+
this.#s = this.#s & yt | b | Ye, b !== W && b !== H && b !== Q && (this.#s |= St);
|
|
3243
|
+
}
|
|
3244
|
+
#$ = [];
|
|
3245
|
+
#G = !1;
|
|
3246
|
+
#q(t) {
|
|
3247
|
+
this.#G = !1;
|
|
3248
|
+
let e = this.#$.slice();
|
|
3249
|
+
this.#$.length = 0, e.forEach((s) => s(null, t));
|
|
3250
|
+
}
|
|
3251
|
+
/**
|
|
3252
|
+
* Standard node-style callback interface to get list of directory entries.
|
|
3253
|
+
*
|
|
3254
|
+
* If the Path cannot or does not contain any children, then an empty array
|
|
3255
|
+
* is returned.
|
|
3256
|
+
*
|
|
3257
|
+
* Results are cached, and thus may be out of date if the filesystem is
|
|
3258
|
+
* mutated.
|
|
3259
|
+
*
|
|
3260
|
+
* @param cb The callback called with (er, entries). Note that the `er`
|
|
3261
|
+
* param is somewhat extraneous, as all readdir() errors are handled and
|
|
3262
|
+
* simply result in an empty set of entries being returned.
|
|
3263
|
+
* @param allowZalgo Boolean indicating that immediately known results should
|
|
3264
|
+
* *not* be deferred with `queueMicrotask`. Defaults to `false`. Release
|
|
3265
|
+
* zalgo at your peril, the dark pony lord is devious and unforgiving.
|
|
3266
|
+
*/
|
|
3267
|
+
readdirCB(t, e = !1) {
|
|
3268
|
+
if (!this.canReaddir()) {
|
|
3269
|
+
e ? t(null, []) : queueMicrotask(() => t(null, []));
|
|
3270
|
+
return;
|
|
3271
|
+
}
|
|
3272
|
+
let s = this.children();
|
|
3273
|
+
if (this.calledReaddir()) {
|
|
3274
|
+
let r = s.slice(0, s.provisional);
|
|
3275
|
+
e ? t(null, r) : queueMicrotask(() => t(null, r));
|
|
3276
|
+
return;
|
|
3277
|
+
}
|
|
3278
|
+
if (this.#$.push(t), this.#G)
|
|
3279
|
+
return;
|
|
3280
|
+
this.#G = !0;
|
|
3281
|
+
let i = this.fullpath();
|
|
3282
|
+
this.#t.readdir(i, { withFileTypes: !0 }, (r, o) => {
|
|
3283
|
+
if (r)
|
|
3284
|
+
this.#W(r.code), s.provisional = 0;
|
|
3285
|
+
else {
|
|
3286
|
+
for (let h of o)
|
|
3287
|
+
this.#I(h, s);
|
|
3288
|
+
this.#N(s);
|
|
3289
|
+
}
|
|
3290
|
+
this.#q(s.slice(0, s.provisional));
|
|
3291
|
+
});
|
|
3292
|
+
}
|
|
3293
|
+
#U;
|
|
3294
|
+
/**
|
|
3295
|
+
* Return an array of known child entries.
|
|
3296
|
+
*
|
|
3297
|
+
* If the Path cannot or does not contain any children, then an empty array
|
|
3298
|
+
* is returned.
|
|
3299
|
+
*
|
|
3300
|
+
* Results are cached, and thus may be out of date if the filesystem is
|
|
3301
|
+
* mutated.
|
|
3302
|
+
*/
|
|
3303
|
+
async readdir() {
|
|
3304
|
+
if (!this.canReaddir())
|
|
3305
|
+
return [];
|
|
3306
|
+
let t = this.children();
|
|
3307
|
+
if (this.calledReaddir())
|
|
3308
|
+
return t.slice(0, t.provisional);
|
|
3309
|
+
let e = this.fullpath();
|
|
3310
|
+
if (this.#U)
|
|
3311
|
+
await this.#U;
|
|
3312
|
+
else {
|
|
3313
|
+
let s = /* @__PURE__ */ l(() => {
|
|
3314
|
+
}, "resolve");
|
|
3315
|
+
this.#U = new Promise((i) => s = i);
|
|
3316
|
+
try {
|
|
3317
|
+
for (let i of await this.#t.promises.readdir(e, {
|
|
3318
|
+
withFileTypes: !0
|
|
3319
|
+
}))
|
|
3320
|
+
this.#I(i, t);
|
|
3321
|
+
this.#N(t);
|
|
3322
|
+
} catch (i) {
|
|
3323
|
+
this.#W(i.code), t.provisional = 0;
|
|
3324
|
+
}
|
|
3325
|
+
this.#U = void 0, s();
|
|
3326
|
+
}
|
|
3327
|
+
return t.slice(0, t.provisional);
|
|
3328
|
+
}
|
|
3329
|
+
/**
|
|
3330
|
+
* synchronous {@link PathBase.readdir}
|
|
3331
|
+
*/
|
|
3332
|
+
readdirSync() {
|
|
3333
|
+
if (!this.canReaddir())
|
|
3334
|
+
return [];
|
|
3335
|
+
let t = this.children();
|
|
3336
|
+
if (this.calledReaddir())
|
|
3337
|
+
return t.slice(0, t.provisional);
|
|
3338
|
+
let e = this.fullpath();
|
|
3339
|
+
try {
|
|
3340
|
+
for (let s of this.#t.readdirSync(e, {
|
|
3341
|
+
withFileTypes: !0
|
|
3342
|
+
}))
|
|
3343
|
+
this.#I(s, t);
|
|
3344
|
+
this.#N(t);
|
|
3345
|
+
} catch (s) {
|
|
3346
|
+
this.#W(s.code), t.provisional = 0;
|
|
3347
|
+
}
|
|
3348
|
+
return t.slice(0, t.provisional);
|
|
3349
|
+
}
|
|
3350
|
+
canReaddir() {
|
|
3351
|
+
if (this.#s & Je)
|
|
3352
|
+
return !1;
|
|
3353
|
+
let t = P & this.#s;
|
|
3354
|
+
return t === W || t === H || t === Q;
|
|
3355
|
+
}
|
|
3356
|
+
shouldWalk(t, e) {
|
|
3357
|
+
return (this.#s & H) === H && !(this.#s & Je) && !t.has(this) && (!e || e(this));
|
|
3358
|
+
}
|
|
3359
|
+
/**
|
|
3360
|
+
* Return the Path object corresponding to path as resolved
|
|
3361
|
+
* by realpath(3).
|
|
3362
|
+
*
|
|
3363
|
+
* If the realpath call fails for any reason, `undefined` is returned.
|
|
3364
|
+
*
|
|
3365
|
+
* Result is cached, and thus may be outdated if the filesystem is mutated.
|
|
3366
|
+
* On success, returns a Path object.
|
|
3367
|
+
*/
|
|
3368
|
+
async realpath() {
|
|
3369
|
+
if (this.#O)
|
|
3370
|
+
return this.#O;
|
|
3371
|
+
if (!((Wt | Lt | U) & this.#s))
|
|
3372
|
+
try {
|
|
3373
|
+
let t = await this.#t.promises.realpath(this.fullpath());
|
|
3374
|
+
return this.#O = this.resolve(t);
|
|
3375
|
+
} catch {
|
|
3376
|
+
this.#R();
|
|
3377
|
+
}
|
|
3378
|
+
}
|
|
3379
|
+
/**
|
|
3380
|
+
* Synchronous {@link realpath}
|
|
3381
|
+
*/
|
|
3382
|
+
realpathSync() {
|
|
3383
|
+
if (this.#O)
|
|
3384
|
+
return this.#O;
|
|
3385
|
+
if (!((Wt | Lt | U) & this.#s))
|
|
3386
|
+
try {
|
|
3387
|
+
let t = this.#t.realpathSync(this.fullpath());
|
|
3388
|
+
return this.#O = this.resolve(t);
|
|
3389
|
+
} catch {
|
|
3390
|
+
this.#R();
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
/**
|
|
3394
|
+
* Internal method to mark this Path object as the scurry cwd,
|
|
3395
|
+
* called by {@link PathScurry#chdir}
|
|
3396
|
+
*
|
|
3397
|
+
* @internal
|
|
3398
|
+
*/
|
|
3399
|
+
[hs](t) {
|
|
3400
|
+
if (t === this)
|
|
3401
|
+
return;
|
|
3402
|
+
t.isCWD = !1, this.isCWD = !0;
|
|
3403
|
+
let e = /* @__PURE__ */ new Set([]), s = [], i = this;
|
|
3404
|
+
for (; i && i.parent; )
|
|
3405
|
+
e.add(i), i.#D = s.join(this.sep), i.#k = s.join("/"), i = i.parent, s.push("..");
|
|
3406
|
+
for (i = t; i && i.parent && !e.has(i); )
|
|
3407
|
+
i.#D = void 0, i.#k = void 0, i = i.parent;
|
|
3408
|
+
}
|
|
3409
|
+
}, It = class n extends O {
|
|
3410
|
+
static {
|
|
3411
|
+
l(this, "PathWin32");
|
|
3412
|
+
}
|
|
3413
|
+
/**
|
|
3414
|
+
* Separator for generating path strings.
|
|
3415
|
+
*/
|
|
3416
|
+
sep = "\\";
|
|
3417
|
+
/**
|
|
3418
|
+
* Separator for parsing path strings.
|
|
3419
|
+
*/
|
|
3420
|
+
splitSep = Wi;
|
|
3421
|
+
/**
|
|
3422
|
+
* Do not create new Path objects directly. They should always be accessed
|
|
3423
|
+
* via the PathScurry class or other methods on the Path class.
|
|
3424
|
+
*
|
|
3425
|
+
* @internal
|
|
3426
|
+
*/
|
|
3427
|
+
constructor(t, e = W, s, i, r, o, h) {
|
|
3428
|
+
super(t, e, s, i, r, o, h);
|
|
3429
|
+
}
|
|
3430
|
+
/**
|
|
3431
|
+
* @internal
|
|
3432
|
+
*/
|
|
3433
|
+
newChild(t, e = W, s = {}) {
|
|
3434
|
+
return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
|
|
3435
|
+
}
|
|
3436
|
+
/**
|
|
3437
|
+
* @internal
|
|
3438
|
+
*/
|
|
3439
|
+
getRootString(t) {
|
|
3440
|
+
return he.parse(t).root;
|
|
3441
|
+
}
|
|
3442
|
+
/**
|
|
3443
|
+
* @internal
|
|
3444
|
+
*/
|
|
3445
|
+
getRoot(t) {
|
|
3446
|
+
if (t = Pi(t.toUpperCase()), t === this.root.name)
|
|
3447
|
+
return this.root;
|
|
3448
|
+
for (let [e, s] of Object.entries(this.roots))
|
|
3449
|
+
if (this.sameRoot(t, e))
|
|
3450
|
+
return this.roots[t] = s;
|
|
3451
|
+
return this.roots[t] = new ot(t, this).root;
|
|
3452
|
+
}
|
|
3453
|
+
/**
|
|
3454
|
+
* @internal
|
|
3455
|
+
*/
|
|
3456
|
+
sameRoot(t, e = this.root.name) {
|
|
3457
|
+
return t = t.toUpperCase().replace(/\//g, "\\").replace(es, "$1\\"), t === e;
|
|
3458
|
+
}
|
|
3459
|
+
}, zt = class n extends O {
|
|
3460
|
+
static {
|
|
3461
|
+
l(this, "PathPosix");
|
|
3462
|
+
}
|
|
3463
|
+
/**
|
|
3464
|
+
* separator for parsing path strings
|
|
3465
|
+
*/
|
|
3466
|
+
splitSep = "/";
|
|
3467
|
+
/**
|
|
3468
|
+
* separator for generating path strings
|
|
3469
|
+
*/
|
|
3470
|
+
sep = "/";
|
|
3471
|
+
/**
|
|
3472
|
+
* Do not create new Path objects directly. They should always be accessed
|
|
3473
|
+
* via the PathScurry class or other methods on the Path class.
|
|
3474
|
+
*
|
|
3475
|
+
* @internal
|
|
3476
|
+
*/
|
|
3477
|
+
constructor(t, e = W, s, i, r, o, h) {
|
|
3478
|
+
super(t, e, s, i, r, o, h);
|
|
3479
|
+
}
|
|
3480
|
+
/**
|
|
3481
|
+
* @internal
|
|
3482
|
+
*/
|
|
3483
|
+
getRootString(t) {
|
|
3484
|
+
return t.startsWith("/") ? "/" : "";
|
|
3485
|
+
}
|
|
3486
|
+
/**
|
|
3487
|
+
* @internal
|
|
3488
|
+
*/
|
|
3489
|
+
getRoot(t) {
|
|
3490
|
+
return this.root;
|
|
3491
|
+
}
|
|
3492
|
+
/**
|
|
3493
|
+
* @internal
|
|
3494
|
+
*/
|
|
3495
|
+
newChild(t, e = W, s = {}) {
|
|
3496
|
+
return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
|
|
3497
|
+
}
|
|
3498
|
+
}, Bt = class {
|
|
3499
|
+
static {
|
|
3500
|
+
l(this, "PathScurryBase");
|
|
3501
|
+
}
|
|
3502
|
+
/**
|
|
3503
|
+
* The root Path entry for the current working directory of this Scurry
|
|
3504
|
+
*/
|
|
3505
|
+
root;
|
|
3506
|
+
/**
|
|
3507
|
+
* The string path for the root of this Scurry's current working directory
|
|
3508
|
+
*/
|
|
3509
|
+
rootPath;
|
|
3510
|
+
/**
|
|
3511
|
+
* A collection of all roots encountered, referenced by rootPath
|
|
3512
|
+
*/
|
|
3513
|
+
roots;
|
|
3514
|
+
/**
|
|
3515
|
+
* The Path entry corresponding to this PathScurry's current working directory.
|
|
3516
|
+
*/
|
|
3517
|
+
cwd;
|
|
3518
|
+
#t;
|
|
3519
|
+
#e;
|
|
3520
|
+
#n;
|
|
3521
|
+
/**
|
|
3522
|
+
* Perform path comparisons case-insensitively.
|
|
3523
|
+
*
|
|
3524
|
+
* Defaults true on Darwin and Windows systems, false elsewhere.
|
|
3525
|
+
*/
|
|
3526
|
+
nocase;
|
|
3527
|
+
#i;
|
|
3528
|
+
/**
|
|
3529
|
+
* This class should not be instantiated directly.
|
|
3530
|
+
*
|
|
3531
|
+
* Use PathScurryWin32, PathScurryDarwin, PathScurryPosix, or PathScurry
|
|
3532
|
+
*
|
|
3533
|
+
* @internal
|
|
3534
|
+
*/
|
|
3535
|
+
constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16 * 1024, fs: o = bt } = {}) {
|
|
3536
|
+
this.#i = ts(o), (t instanceof URL || t.startsWith("file://")) && (t = Ti(t));
|
|
3537
|
+
let h = e.resolve(t);
|
|
3538
|
+
this.roots = /* @__PURE__ */ Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new jt(), this.#e = new jt(), this.#n =
|
|
3539
|
+
new ae(r);
|
|
3540
|
+
let a = h.substring(this.rootPath.length).split(s);
|
|
3541
|
+
if (a.length === 1 && !a[0] && a.pop(), i === void 0)
|
|
3542
|
+
throw new TypeError("must provide nocase setting to PathScurryBase ctor");
|
|
3543
|
+
this.nocase = i, this.root = this.newRoot(this.#i), this.roots[this.rootPath] = this.root;
|
|
3544
|
+
let c = this.root, f = a.length - 1, u = e.sep, d = this.rootPath, p = !1;
|
|
3545
|
+
for (let w of a) {
|
|
3546
|
+
let m = f--;
|
|
3547
|
+
c = c.child(w, {
|
|
3548
|
+
relative: new Array(m).fill("..").join(u),
|
|
3549
|
+
relativePosix: new Array(m).fill("..").join("/"),
|
|
3550
|
+
fullpath: d += (p ? "" : u) + w
|
|
3551
|
+
}), p = !0;
|
|
3552
|
+
}
|
|
3553
|
+
this.cwd = c;
|
|
3554
|
+
}
|
|
3555
|
+
/**
|
|
3556
|
+
* Get the depth of a provided path, string, or the cwd
|
|
3557
|
+
*/
|
|
3558
|
+
depth(t = this.cwd) {
|
|
3559
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
|
|
3560
|
+
}
|
|
3561
|
+
/**
|
|
3562
|
+
* Return the cache of child entries. Exposed so subclasses can create
|
|
3563
|
+
* child Path objects in a platform-specific way.
|
|
3564
|
+
*
|
|
3565
|
+
* @internal
|
|
3566
|
+
*/
|
|
3567
|
+
childrenCache() {
|
|
3568
|
+
return this.#n;
|
|
3569
|
+
}
|
|
3570
|
+
/**
|
|
3571
|
+
* Resolve one or more path strings to a resolved string
|
|
3572
|
+
*
|
|
3573
|
+
* Same interface as require('path').resolve.
|
|
3574
|
+
*
|
|
3575
|
+
* Much faster than path.resolve() when called multiple times for the same
|
|
3576
|
+
* path, because the resolved Path objects are cached. Much slower
|
|
3577
|
+
* otherwise.
|
|
3578
|
+
*/
|
|
3579
|
+
resolve(...t) {
|
|
3580
|
+
let e = "";
|
|
3581
|
+
for (let r = t.length - 1; r >= 0; r--) {
|
|
3582
|
+
let o = t[r];
|
|
3583
|
+
if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o)))
|
|
3584
|
+
break;
|
|
3585
|
+
}
|
|
3586
|
+
let s = this.#t.get(e);
|
|
3587
|
+
if (s !== void 0)
|
|
3588
|
+
return s;
|
|
3589
|
+
let i = this.cwd.resolve(e).fullpath();
|
|
3590
|
+
return this.#t.set(e, i), i;
|
|
3591
|
+
}
|
|
3592
|
+
/**
|
|
3593
|
+
* Resolve one or more path strings to a resolved string, returning
|
|
3594
|
+
* the posix path. Identical to .resolve() on posix systems, but on
|
|
3595
|
+
* windows will return a forward-slash separated UNC path.
|
|
3596
|
+
*
|
|
3597
|
+
* Same interface as require('path').resolve.
|
|
3598
|
+
*
|
|
3599
|
+
* Much faster than path.resolve() when called multiple times for the same
|
|
3600
|
+
* path, because the resolved Path objects are cached. Much slower
|
|
3601
|
+
* otherwise.
|
|
3602
|
+
*/
|
|
3603
|
+
resolvePosix(...t) {
|
|
3604
|
+
let e = "";
|
|
3605
|
+
for (let r = t.length - 1; r >= 0; r--) {
|
|
3606
|
+
let o = t[r];
|
|
3607
|
+
if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o)))
|
|
3608
|
+
break;
|
|
3609
|
+
}
|
|
3610
|
+
let s = this.#e.get(e);
|
|
3611
|
+
if (s !== void 0)
|
|
3612
|
+
return s;
|
|
3613
|
+
let i = this.cwd.resolve(e).fullpathPosix();
|
|
3614
|
+
return this.#e.set(e, i), i;
|
|
3615
|
+
}
|
|
3616
|
+
/**
|
|
3617
|
+
* find the relative path from the cwd to the supplied path string or entry
|
|
3618
|
+
*/
|
|
3619
|
+
relative(t = this.cwd) {
|
|
3620
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
|
|
3621
|
+
}
|
|
3622
|
+
/**
|
|
3623
|
+
* find the relative path from the cwd to the supplied path string or
|
|
3624
|
+
* entry, using / as the path delimiter, even on Windows.
|
|
3625
|
+
*/
|
|
3626
|
+
relativePosix(t = this.cwd) {
|
|
3627
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
|
|
3628
|
+
}
|
|
3629
|
+
/**
|
|
3630
|
+
* Return the basename for the provided string or Path object
|
|
3631
|
+
*/
|
|
3632
|
+
basename(t = this.cwd) {
|
|
3633
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
|
|
3634
|
+
}
|
|
3635
|
+
/**
|
|
3636
|
+
* Return the dirname for the provided string or Path object
|
|
3637
|
+
*/
|
|
3638
|
+
dirname(t = this.cwd) {
|
|
3639
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
|
|
3640
|
+
}
|
|
3641
|
+
async readdir(t = this.cwd, e = {
|
|
3642
|
+
withFileTypes: !0
|
|
3643
|
+
}) {
|
|
3644
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
|
|
3645
|
+
let { withFileTypes: s } = e;
|
|
3646
|
+
if (t.canReaddir()) {
|
|
3647
|
+
let i = await t.readdir();
|
|
3648
|
+
return s ? i : i.map((r) => r.name);
|
|
3649
|
+
} else
|
|
3650
|
+
return [];
|
|
3651
|
+
}
|
|
3652
|
+
readdirSync(t = this.cwd, e = {
|
|
3653
|
+
withFileTypes: !0
|
|
3654
|
+
}) {
|
|
3655
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
|
|
3656
|
+
let { withFileTypes: s = !0 } = e;
|
|
3657
|
+
return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
|
|
3658
|
+
}
|
|
3659
|
+
/**
|
|
3660
|
+
* Call lstat() on the string or Path object, and update all known
|
|
3661
|
+
* information that can be determined.
|
|
3662
|
+
*
|
|
3663
|
+
* Note that unlike `fs.lstat()`, the returned value does not contain some
|
|
3664
|
+
* information, such as `mode`, `dev`, `nlink`, and `ino`. If that
|
|
3665
|
+
* information is required, you will need to call `fs.lstat` yourself.
|
|
3666
|
+
*
|
|
3667
|
+
* If the Path refers to a nonexistent file, or if the lstat call fails for
|
|
3668
|
+
* any reason, `undefined` is returned. Otherwise the updated Path object is
|
|
3669
|
+
* returned.
|
|
3670
|
+
*
|
|
3671
|
+
* Results are cached, and thus may be out of date if the filesystem is
|
|
3672
|
+
* mutated.
|
|
3673
|
+
*/
|
|
3674
|
+
async lstat(t = this.cwd) {
|
|
3675
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
|
|
3676
|
+
}
|
|
3677
|
+
/**
|
|
3678
|
+
* synchronous {@link PathScurryBase.lstat}
|
|
3679
|
+
*/
|
|
3680
|
+
lstatSync(t = this.cwd) {
|
|
3681
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
|
|
3682
|
+
}
|
|
3683
|
+
async readlink(t = this.cwd, { withFileTypes: e } = {
|
|
3684
|
+
withFileTypes: !1
|
|
3685
|
+
}) {
|
|
3686
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t.withFileTypes, t = this.cwd);
|
|
3687
|
+
let s = await t.readlink();
|
|
3688
|
+
return e ? s : s?.fullpath();
|
|
3689
|
+
}
|
|
3690
|
+
readlinkSync(t = this.cwd, { withFileTypes: e } = {
|
|
3691
|
+
withFileTypes: !1
|
|
3692
|
+
}) {
|
|
3693
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t.withFileTypes, t = this.cwd);
|
|
3694
|
+
let s = t.readlinkSync();
|
|
3695
|
+
return e ? s : s?.fullpath();
|
|
3696
|
+
}
|
|
3697
|
+
async realpath(t = this.cwd, { withFileTypes: e } = {
|
|
3698
|
+
withFileTypes: !1
|
|
3699
|
+
}) {
|
|
3700
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t.withFileTypes, t = this.cwd);
|
|
3701
|
+
let s = await t.realpath();
|
|
3702
|
+
return e ? s : s?.fullpath();
|
|
3703
|
+
}
|
|
3704
|
+
realpathSync(t = this.cwd, { withFileTypes: e } = {
|
|
3705
|
+
withFileTypes: !1
|
|
3706
|
+
}) {
|
|
3707
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t.withFileTypes, t = this.cwd);
|
|
3708
|
+
let s = t.realpathSync();
|
|
3709
|
+
return e ? s : s?.fullpath();
|
|
3710
|
+
}
|
|
3711
|
+
async walk(t = this.cwd, e = {}) {
|
|
3712
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
|
|
3713
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
|
|
3714
|
+
(!r || r(t)) && h.push(s ? t : t.fullpath());
|
|
3715
|
+
let a = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ l((u, d) => {
|
|
3716
|
+
a.add(u), u.readdirCB((p, w) => {
|
|
3717
|
+
if (p)
|
|
3718
|
+
return d(p);
|
|
3719
|
+
let m = w.length;
|
|
3720
|
+
if (!m)
|
|
3721
|
+
return d();
|
|
3722
|
+
let y = /* @__PURE__ */ l(() => {
|
|
3723
|
+
--m === 0 && d();
|
|
3724
|
+
}, "next");
|
|
3725
|
+
for (let g of w)
|
|
3726
|
+
(!r || r(g)) && h.push(s ? g : g.fullpath()), i && g.isSymbolicLink() ? g.realpath().then((E) => E?.isUnknown() ? E.lstat() : E).then(
|
|
3727
|
+
(E) => E?.shouldWalk(a, o) ? c(E, y) : y()) : g.shouldWalk(a, o) ? c(g, y) : y();
|
|
3728
|
+
}, !0);
|
|
3729
|
+
}, "walk"), f = t;
|
|
3730
|
+
return new Promise((u, d) => {
|
|
3731
|
+
c(f, (p) => {
|
|
3732
|
+
if (p)
|
|
3733
|
+
return d(p);
|
|
3734
|
+
u(h);
|
|
3735
|
+
});
|
|
3736
|
+
});
|
|
3737
|
+
}
|
|
3738
|
+
walkSync(t = this.cwd, e = {}) {
|
|
3739
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
|
|
3740
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
|
|
3741
|
+
(!r || r(t)) && h.push(s ? t : t.fullpath());
|
|
3742
|
+
let a = /* @__PURE__ */ new Set([t]);
|
|
3743
|
+
for (let c of a) {
|
|
3744
|
+
let f = c.readdirSync();
|
|
3745
|
+
for (let u of f) {
|
|
3746
|
+
(!r || r(u)) && h.push(s ? u : u.fullpath());
|
|
3747
|
+
let d = u;
|
|
3748
|
+
if (u.isSymbolicLink()) {
|
|
3749
|
+
if (!(i && (d = u.realpathSync())))
|
|
3750
|
+
continue;
|
|
3751
|
+
d.isUnknown() && d.lstatSync();
|
|
3752
|
+
}
|
|
3753
|
+
d.shouldWalk(a, o) && a.add(d);
|
|
3754
|
+
}
|
|
3755
|
+
}
|
|
3756
|
+
return h;
|
|
3757
|
+
}
|
|
3758
|
+
/**
|
|
3759
|
+
* Support for `for await`
|
|
3760
|
+
*
|
|
3761
|
+
* Alias for {@link PathScurryBase.iterate}
|
|
3762
|
+
*
|
|
3763
|
+
* Note: As of Node 19, this is very slow, compared to other methods of
|
|
3764
|
+
* walking. Consider using {@link PathScurryBase.stream} if memory overhead
|
|
3765
|
+
* and backpressure are concerns, or {@link PathScurryBase.walk} if not.
|
|
3766
|
+
*/
|
|
3767
|
+
[Symbol.asyncIterator]() {
|
|
3768
|
+
return this.iterate();
|
|
3769
|
+
}
|
|
3770
|
+
iterate(t = this.cwd, e = {}) {
|
|
3771
|
+
return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
|
|
3772
|
+
}
|
|
3773
|
+
/**
|
|
3774
|
+
* Iterating over a PathScurry performs a synchronous walk.
|
|
3775
|
+
*
|
|
3776
|
+
* Alias for {@link PathScurryBase.iterateSync}
|
|
3777
|
+
*/
|
|
3778
|
+
[Symbol.iterator]() {
|
|
3779
|
+
return this.iterateSync();
|
|
3780
|
+
}
|
|
3781
|
+
*iterateSync(t = this.cwd, e = {}) {
|
|
3782
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
|
|
3783
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e;
|
|
3784
|
+
(!r || r(t)) && (yield s ? t : t.fullpath());
|
|
3785
|
+
let h = /* @__PURE__ */ new Set([t]);
|
|
3786
|
+
for (let a of h) {
|
|
3787
|
+
let c = a.readdirSync();
|
|
3788
|
+
for (let f of c) {
|
|
3789
|
+
(!r || r(f)) && (yield s ? f : f.fullpath());
|
|
3790
|
+
let u = f;
|
|
3791
|
+
if (f.isSymbolicLink()) {
|
|
3792
|
+
if (!(i && (u = f.realpathSync())))
|
|
3793
|
+
continue;
|
|
3794
|
+
u.isUnknown() && u.lstatSync();
|
|
3795
|
+
}
|
|
3796
|
+
u.shouldWalk(h, o) && h.add(u);
|
|
3797
|
+
}
|
|
3798
|
+
}
|
|
3799
|
+
}
|
|
3800
|
+
stream(t = this.cwd, e = {}) {
|
|
3801
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
|
|
3802
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new Y({ objectMode: !0 });
|
|
3803
|
+
(!r || r(t)) && h.write(s ? t : t.fullpath());
|
|
3804
|
+
let a = /* @__PURE__ */ new Set(), c = [t], f = 0, u = /* @__PURE__ */ l(() => {
|
|
3805
|
+
let d = !1;
|
|
3806
|
+
for (; !d; ) {
|
|
3807
|
+
let p = c.shift();
|
|
3808
|
+
if (!p) {
|
|
3809
|
+
f === 0 && h.end();
|
|
3810
|
+
return;
|
|
3811
|
+
}
|
|
3812
|
+
f++, a.add(p);
|
|
3813
|
+
let w = /* @__PURE__ */ l((y, g, E = !1) => {
|
|
3814
|
+
if (y)
|
|
3815
|
+
return h.emit("error", y);
|
|
3816
|
+
if (i && !E) {
|
|
3817
|
+
let S = [];
|
|
3818
|
+
for (let b of g)
|
|
3819
|
+
b.isSymbolicLink() && S.push(b.realpath().then((x) => x?.isUnknown() ? x.lstat() : x));
|
|
3820
|
+
if (S.length) {
|
|
3821
|
+
Promise.all(S).then(() => w(null, g, !0));
|
|
3822
|
+
return;
|
|
3823
|
+
}
|
|
3824
|
+
}
|
|
3825
|
+
for (let S of g)
|
|
3826
|
+
S && (!r || r(S)) && (h.write(s ? S : S.fullpath()) || (d = !0));
|
|
3827
|
+
f--;
|
|
3828
|
+
for (let S of g) {
|
|
3829
|
+
let b = S.realpathCached() || S;
|
|
3830
|
+
b.shouldWalk(a, o) && c.push(b);
|
|
3831
|
+
}
|
|
3832
|
+
d && !h.flowing ? h.once("drain", u) : m || u();
|
|
3833
|
+
}, "onReaddir"), m = !0;
|
|
3834
|
+
p.readdirCB(w, !0), m = !1;
|
|
3835
|
+
}
|
|
3836
|
+
}, "process");
|
|
3837
|
+
return u(), h;
|
|
3838
|
+
}
|
|
3839
|
+
streamSync(t = this.cwd, e = {}) {
|
|
3840
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
|
|
3841
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new Y({ objectMode: !0 }), a = /* @__PURE__ */ new Set();
|
|
3842
|
+
(!r || r(t)) && h.write(s ? t : t.fullpath());
|
|
3843
|
+
let c = [t], f = 0, u = /* @__PURE__ */ l(() => {
|
|
3844
|
+
let d = !1;
|
|
3845
|
+
for (; !d; ) {
|
|
3846
|
+
let p = c.shift();
|
|
3847
|
+
if (!p) {
|
|
3848
|
+
f === 0 && h.end();
|
|
3849
|
+
return;
|
|
3850
|
+
}
|
|
3851
|
+
f++, a.add(p);
|
|
3852
|
+
let w = p.readdirSync();
|
|
3853
|
+
for (let m of w)
|
|
3854
|
+
(!r || r(m)) && (h.write(s ? m : m.fullpath()) || (d = !0));
|
|
3855
|
+
f--;
|
|
3856
|
+
for (let m of w) {
|
|
3857
|
+
let y = m;
|
|
3858
|
+
if (m.isSymbolicLink()) {
|
|
3859
|
+
if (!(i && (y = m.realpathSync())))
|
|
3860
|
+
continue;
|
|
3861
|
+
y.isUnknown() && y.lstatSync();
|
|
3862
|
+
}
|
|
3863
|
+
y.shouldWalk(a, o) && c.push(y);
|
|
3864
|
+
}
|
|
3865
|
+
}
|
|
3866
|
+
d && !h.flowing && h.once("drain", u);
|
|
3867
|
+
}, "process");
|
|
3868
|
+
return u(), h;
|
|
3869
|
+
}
|
|
3870
|
+
chdir(t = this.cwd) {
|
|
3871
|
+
let e = this.cwd;
|
|
3872
|
+
this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[hs](e);
|
|
3873
|
+
}
|
|
3874
|
+
}, ot = class extends Bt {
|
|
3875
|
+
static {
|
|
3876
|
+
l(this, "PathScurryWin32");
|
|
3877
|
+
}
|
|
3878
|
+
/**
|
|
3879
|
+
* separator for generating path strings
|
|
3880
|
+
*/
|
|
3881
|
+
sep = "\\";
|
|
3882
|
+
constructor(t = process.cwd(), e = {}) {
|
|
3883
|
+
let { nocase: s = !0 } = e;
|
|
3884
|
+
super(t, he, "\\", { ...e, nocase: s }), this.nocase = s;
|
|
3885
|
+
for (let i = this.cwd; i; i = i.parent)
|
|
3886
|
+
i.nocase = this.nocase;
|
|
3887
|
+
}
|
|
3888
|
+
/**
|
|
3889
|
+
* @internal
|
|
3890
|
+
*/
|
|
3891
|
+
parseRootPath(t) {
|
|
3892
|
+
return he.parse(t).root.toUpperCase();
|
|
3893
|
+
}
|
|
3894
|
+
/**
|
|
3895
|
+
* @internal
|
|
3896
|
+
*/
|
|
3897
|
+
newRoot(t) {
|
|
3898
|
+
return new It(this.rootPath, H, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
|
|
3899
|
+
}
|
|
3900
|
+
/**
|
|
3901
|
+
* Return true if the provided path string is an absolute path
|
|
3902
|
+
*/
|
|
3903
|
+
isAbsolute(t) {
|
|
3904
|
+
return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
|
|
3905
|
+
}
|
|
3906
|
+
}, ht = class extends Bt {
|
|
3907
|
+
static {
|
|
3908
|
+
l(this, "PathScurryPosix");
|
|
3909
|
+
}
|
|
3910
|
+
/**
|
|
3911
|
+
* separator for generating path strings
|
|
3912
|
+
*/
|
|
3913
|
+
sep = "/";
|
|
3914
|
+
constructor(t = process.cwd(), e = {}) {
|
|
3915
|
+
let { nocase: s = !1 } = e;
|
|
3916
|
+
super(t, vi, "/", { ...e, nocase: s }), this.nocase = s;
|
|
3917
|
+
}
|
|
3918
|
+
/**
|
|
3919
|
+
* @internal
|
|
3920
|
+
*/
|
|
3921
|
+
parseRootPath(t) {
|
|
3922
|
+
return "/";
|
|
3923
|
+
}
|
|
3924
|
+
/**
|
|
3925
|
+
* @internal
|
|
3926
|
+
*/
|
|
3927
|
+
newRoot(t) {
|
|
3928
|
+
return new zt(this.rootPath, H, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
|
|
3929
|
+
}
|
|
3930
|
+
/**
|
|
3931
|
+
* Return true if the provided path string is an absolute path
|
|
3932
|
+
*/
|
|
3933
|
+
isAbsolute(t) {
|
|
3934
|
+
return t.startsWith("/");
|
|
3935
|
+
}
|
|
3936
|
+
}, xt = class extends ht {
|
|
3937
|
+
static {
|
|
3938
|
+
l(this, "PathScurryDarwin");
|
|
3939
|
+
}
|
|
3940
|
+
constructor(t = process.cwd(), e = {}) {
|
|
3941
|
+
let { nocase: s = !0 } = e;
|
|
3942
|
+
super(t, { ...e, nocase: s });
|
|
3943
|
+
}
|
|
3944
|
+
}, $r = process.platform === "win32" ? It : zt, as = process.platform === "win32" ? ot : process.platform === "darwin" ? xt : ht;
|
|
3945
|
+
|
|
3946
|
+
// ../node_modules/glob/dist/esm/pattern.js
|
|
3947
|
+
var Ii = /* @__PURE__ */ l((n) => n.length >= 1, "isPatternList"), zi = /* @__PURE__ */ l((n) => n.length >= 1, "isGlobList"), at = class n {
|
|
3948
|
+
static {
|
|
3949
|
+
l(this, "Pattern");
|
|
3950
|
+
}
|
|
3951
|
+
#t;
|
|
3952
|
+
#e;
|
|
3953
|
+
#n;
|
|
3954
|
+
length;
|
|
3955
|
+
#i;
|
|
3956
|
+
#o;
|
|
3957
|
+
#S;
|
|
3958
|
+
#l;
|
|
3959
|
+
#f;
|
|
3960
|
+
#h;
|
|
3961
|
+
#a = !0;
|
|
3962
|
+
constructor(t, e, s, i) {
|
|
3963
|
+
if (!Ii(t))
|
|
3964
|
+
throw new TypeError("empty pattern list");
|
|
3965
|
+
if (!zi(e))
|
|
3966
|
+
throw new TypeError("empty glob list");
|
|
3967
|
+
if (e.length !== t.length)
|
|
3968
|
+
throw new TypeError("mismatched pattern list and glob list lengths");
|
|
3969
|
+
if (this.length = t.length, s < 0 || s >= this.length)
|
|
3970
|
+
throw new TypeError("index out of range");
|
|
3971
|
+
if (this.#t = t, this.#e = e, this.#n = s, this.#i = i, this.#n === 0) {
|
|
3972
|
+
if (this.isUNC()) {
|
|
3973
|
+
let [r, o, h, a, ...c] = this.#t, [f, u, d, p, ...w] = this.#e;
|
|
3974
|
+
c[0] === "" && (c.shift(), w.shift());
|
|
3975
|
+
let m = [r, o, h, a, ""].join("/"), y = [f, u, d, p, ""].join("/");
|
|
3976
|
+
this.#t = [m, ...c], this.#e = [y, ...w], this.length = this.#t.length;
|
|
3977
|
+
} else if (this.isDrive() || this.isAbsolute()) {
|
|
3978
|
+
let [r, ...o] = this.#t, [h, ...a] = this.#e;
|
|
3979
|
+
o[0] === "" && (o.shift(), a.shift());
|
|
3980
|
+
let c = r + "/", f = h + "/";
|
|
3981
|
+
this.#t = [c, ...o], this.#e = [f, ...a], this.length = this.#t.length;
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
}
|
|
3985
|
+
/**
|
|
3986
|
+
* The first entry in the parsed list of patterns
|
|
3987
|
+
*/
|
|
3988
|
+
pattern() {
|
|
3989
|
+
return this.#t[this.#n];
|
|
3990
|
+
}
|
|
3991
|
+
/**
|
|
3992
|
+
* true of if pattern() returns a string
|
|
3993
|
+
*/
|
|
3994
|
+
isString() {
|
|
3995
|
+
return typeof this.#t[this.#n] == "string";
|
|
3996
|
+
}
|
|
3997
|
+
/**
|
|
3998
|
+
* true of if pattern() returns GLOBSTAR
|
|
3999
|
+
*/
|
|
4000
|
+
isGlobstar() {
|
|
4001
|
+
return this.#t[this.#n] === R;
|
|
4002
|
+
}
|
|
4003
|
+
/**
|
|
4004
|
+
* true if pattern() returns a regexp
|
|
4005
|
+
*/
|
|
4006
|
+
isRegExp() {
|
|
4007
|
+
return this.#t[this.#n] instanceof RegExp;
|
|
4008
|
+
}
|
|
4009
|
+
/**
|
|
4010
|
+
* The /-joined set of glob parts that make up this pattern
|
|
4011
|
+
*/
|
|
4012
|
+
globString() {
|
|
4013
|
+
return this.#S = this.#S || (this.#n === 0 ? this.isAbsolute() ? this.#e[0] + this.#e.slice(1).join("/") : this.#e.join("/") : this.#e.slice(
|
|
4014
|
+
this.#n).join("/"));
|
|
4015
|
+
}
|
|
4016
|
+
/**
|
|
4017
|
+
* true if there are more pattern parts after this one
|
|
4018
|
+
*/
|
|
4019
|
+
hasMore() {
|
|
4020
|
+
return this.length > this.#n + 1;
|
|
4021
|
+
}
|
|
4022
|
+
/**
|
|
4023
|
+
* The rest of the pattern after this part, or null if this is the end
|
|
4024
|
+
*/
|
|
4025
|
+
rest() {
|
|
4026
|
+
return this.#o !== void 0 ? this.#o : this.hasMore() ? (this.#o = new n(this.#t, this.#e, this.#n + 1, this.#i), this.#o.#h = this.#h, this.#o.#f =
|
|
4027
|
+
this.#f, this.#o.#l = this.#l, this.#o) : this.#o = null;
|
|
4028
|
+
}
|
|
4029
|
+
/**
|
|
4030
|
+
* true if the pattern represents a //unc/path/ on windows
|
|
4031
|
+
*/
|
|
4032
|
+
isUNC() {
|
|
4033
|
+
let t = this.#t;
|
|
4034
|
+
return this.#f !== void 0 ? this.#f : this.#f = this.#i === "win32" && this.#n === 0 && t[0] === "" && t[1] === "" && typeof t[2] == "st\
|
|
4035
|
+
ring" && !!t[2] && typeof t[3] == "string" && !!t[3];
|
|
4036
|
+
}
|
|
4037
|
+
// pattern like C:/...
|
|
4038
|
+
// split = ['C:', ...]
|
|
4039
|
+
// XXX: would be nice to handle patterns like `c:*` to test the cwd
|
|
4040
|
+
// in c: for *, but I don't know of a way to even figure out what that
|
|
4041
|
+
// cwd is without actually chdir'ing into it?
|
|
4042
|
+
/**
|
|
4043
|
+
* True if the pattern starts with a drive letter on Windows
|
|
4044
|
+
*/
|
|
4045
|
+
isDrive() {
|
|
4046
|
+
let t = this.#t;
|
|
4047
|
+
return this.#l !== void 0 ? this.#l : this.#l = this.#i === "win32" && this.#n === 0 && this.length > 1 && typeof t[0] == "string" && /^[a-z]:$/i.
|
|
4048
|
+
test(t[0]);
|
|
4049
|
+
}
|
|
4050
|
+
// pattern = '/' or '/...' or '/x/...'
|
|
4051
|
+
// split = ['', ''] or ['', ...] or ['', 'x', ...]
|
|
4052
|
+
// Drive and UNC both considered absolute on windows
|
|
4053
|
+
/**
|
|
4054
|
+
* True if the pattern is rooted on an absolute path
|
|
4055
|
+
*/
|
|
4056
|
+
isAbsolute() {
|
|
4057
|
+
let t = this.#t;
|
|
4058
|
+
return this.#h !== void 0 ? this.#h : this.#h = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
|
|
4059
|
+
}
|
|
4060
|
+
/**
|
|
4061
|
+
* consume the root of the pattern, and return it
|
|
4062
|
+
*/
|
|
4063
|
+
root() {
|
|
4064
|
+
let t = this.#t[0];
|
|
4065
|
+
return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : "";
|
|
4066
|
+
}
|
|
4067
|
+
/**
|
|
4068
|
+
* Check to see if the current globstar pattern is allowed to follow
|
|
4069
|
+
* a symbolic link.
|
|
4070
|
+
*/
|
|
4071
|
+
checkFollowGlobstar() {
|
|
4072
|
+
return !(this.#n === 0 || !this.isGlobstar() || !this.#a);
|
|
4073
|
+
}
|
|
4074
|
+
/**
|
|
4075
|
+
* Mark that the current globstar pattern is following a symbolic link
|
|
4076
|
+
*/
|
|
4077
|
+
markFollowGlobstar() {
|
|
4078
|
+
return this.#n === 0 || !this.isGlobstar() || !this.#a ? !1 : (this.#a = !1, !0);
|
|
4079
|
+
}
|
|
4080
|
+
};
|
|
4081
|
+
|
|
4082
|
+
// ../node_modules/glob/dist/esm/ignore.js
|
|
4083
|
+
var Bi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", lt = class {
|
|
4084
|
+
static {
|
|
4085
|
+
l(this, "Ignore");
|
|
4086
|
+
}
|
|
4087
|
+
relative;
|
|
4088
|
+
relativeChildren;
|
|
4089
|
+
absolute;
|
|
4090
|
+
absoluteChildren;
|
|
4091
|
+
platform;
|
|
4092
|
+
mmopts;
|
|
4093
|
+
constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: o = Bi }) {
|
|
4094
|
+
this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = o, this.mmopts = {
|
|
4095
|
+
dot: !0,
|
|
4096
|
+
nobrace: e,
|
|
4097
|
+
nocase: s,
|
|
4098
|
+
noext: i,
|
|
4099
|
+
noglobstar: r,
|
|
4100
|
+
optimizationLevel: 2,
|
|
4101
|
+
platform: o,
|
|
4102
|
+
nocomment: !0,
|
|
4103
|
+
nonegate: !0
|
|
4104
|
+
};
|
|
4105
|
+
for (let h of t)
|
|
4106
|
+
this.add(h);
|
|
4107
|
+
}
|
|
4108
|
+
add(t) {
|
|
4109
|
+
let e = new _(t, this.mmopts);
|
|
4110
|
+
for (let s = 0; s < e.set.length; s++) {
|
|
4111
|
+
let i = e.set[s], r = e.globParts[s];
|
|
4112
|
+
if (!i || !r)
|
|
4113
|
+
throw new Error("invalid pattern object");
|
|
4114
|
+
for (; i[0] === "." && r[0] === "."; )
|
|
4115
|
+
i.shift(), r.shift();
|
|
4116
|
+
let o = new at(i, r, 0, this.platform), h = new _(o.globString(), this.mmopts), a = r[r.length - 1] === "**", c = o.isAbsolute();
|
|
4117
|
+
c ? this.absolute.push(h) : this.relative.push(h), a && (c ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
|
|
4118
|
+
}
|
|
4119
|
+
}
|
|
4120
|
+
ignored(t) {
|
|
4121
|
+
let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`;
|
|
4122
|
+
for (let o of this.relative)
|
|
4123
|
+
if (o.match(i) || o.match(r))
|
|
4124
|
+
return !0;
|
|
4125
|
+
for (let o of this.absolute)
|
|
4126
|
+
if (o.match(e) || o.match(s))
|
|
4127
|
+
return !0;
|
|
4128
|
+
return !1;
|
|
4129
|
+
}
|
|
4130
|
+
childrenIgnored(t) {
|
|
4131
|
+
let e = t.fullpath() + "/", s = (t.relative() || ".") + "/";
|
|
4132
|
+
for (let i of this.relativeChildren)
|
|
4133
|
+
if (i.match(s))
|
|
4134
|
+
return !0;
|
|
4135
|
+
for (let i of this.absoluteChildren)
|
|
4136
|
+
if (i.match(e))
|
|
4137
|
+
return !0;
|
|
4138
|
+
return !1;
|
|
4139
|
+
}
|
|
4140
|
+
};
|
|
4141
|
+
|
|
4142
|
+
// ../node_modules/glob/dist/esm/processor.js
|
|
4143
|
+
var le = class n {
|
|
4144
|
+
static {
|
|
4145
|
+
l(this, "HasWalkedCache");
|
|
4146
|
+
}
|
|
4147
|
+
store;
|
|
4148
|
+
constructor(t = /* @__PURE__ */ new Map()) {
|
|
4149
|
+
this.store = t;
|
|
4150
|
+
}
|
|
4151
|
+
copy() {
|
|
4152
|
+
return new n(new Map(this.store));
|
|
4153
|
+
}
|
|
4154
|
+
hasWalked(t, e) {
|
|
4155
|
+
return this.store.get(t.fullpath())?.has(e.globString());
|
|
4156
|
+
}
|
|
4157
|
+
storeWalked(t, e) {
|
|
4158
|
+
let s = t.fullpath(), i = this.store.get(s);
|
|
4159
|
+
i ? i.add(e.globString()) : this.store.set(s, /* @__PURE__ */ new Set([e.globString()]));
|
|
4160
|
+
}
|
|
4161
|
+
}, ce = class {
|
|
4162
|
+
static {
|
|
4163
|
+
l(this, "MatchRecord");
|
|
4164
|
+
}
|
|
4165
|
+
store = /* @__PURE__ */ new Map();
|
|
4166
|
+
add(t, e, s) {
|
|
4167
|
+
let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
|
|
4168
|
+
this.store.set(t, r === void 0 ? i : i & r);
|
|
4169
|
+
}
|
|
4170
|
+
// match, absolute, ifdir
|
|
4171
|
+
entries() {
|
|
4172
|
+
return [...this.store.entries()].map(([t, e]) => [
|
|
4173
|
+
t,
|
|
4174
|
+
!!(e & 2),
|
|
4175
|
+
!!(e & 1)
|
|
4176
|
+
]);
|
|
4177
|
+
}
|
|
4178
|
+
}, fe = class {
|
|
4179
|
+
static {
|
|
4180
|
+
l(this, "SubWalks");
|
|
4181
|
+
}
|
|
4182
|
+
store = /* @__PURE__ */ new Map();
|
|
4183
|
+
add(t, e) {
|
|
4184
|
+
if (!t.canReaddir())
|
|
4185
|
+
return;
|
|
4186
|
+
let s = this.store.get(t);
|
|
4187
|
+
s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
|
|
4188
|
+
}
|
|
4189
|
+
get(t) {
|
|
4190
|
+
let e = this.store.get(t);
|
|
4191
|
+
if (!e)
|
|
4192
|
+
throw new Error("attempting to walk unknown path");
|
|
4193
|
+
return e;
|
|
4194
|
+
}
|
|
4195
|
+
entries() {
|
|
4196
|
+
return this.keys().map((t) => [t, this.store.get(t)]);
|
|
4197
|
+
}
|
|
4198
|
+
keys() {
|
|
4199
|
+
return [...this.store.keys()].filter((t) => t.canReaddir());
|
|
4200
|
+
}
|
|
4201
|
+
}, vt = class n {
|
|
4202
|
+
static {
|
|
4203
|
+
l(this, "Processor");
|
|
4204
|
+
}
|
|
4205
|
+
hasWalkedCache;
|
|
4206
|
+
matches = new ce();
|
|
4207
|
+
subwalks = new fe();
|
|
4208
|
+
patterns;
|
|
4209
|
+
follow;
|
|
4210
|
+
dot;
|
|
4211
|
+
opts;
|
|
4212
|
+
constructor(t, e) {
|
|
4213
|
+
this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new le();
|
|
4214
|
+
}
|
|
4215
|
+
processPatterns(t, e) {
|
|
4216
|
+
this.patterns = e;
|
|
4217
|
+
let s = e.map((i) => [t, i]);
|
|
4218
|
+
for (let [i, r] of s) {
|
|
4219
|
+
this.hasWalkedCache.storeWalked(i, r);
|
|
4220
|
+
let o = r.root(), h = r.isAbsolute() && this.opts.absolute !== !1;
|
|
4221
|
+
if (o) {
|
|
4222
|
+
i = i.resolve(o === "/" && this.opts.root !== void 0 ? this.opts.root : o);
|
|
4223
|
+
let u = r.rest();
|
|
4224
|
+
if (u)
|
|
4225
|
+
r = u;
|
|
4226
|
+
else {
|
|
4227
|
+
this.matches.add(i, !0, !1);
|
|
4228
|
+
continue;
|
|
4229
|
+
}
|
|
4230
|
+
}
|
|
4231
|
+
if (i.isENOENT())
|
|
4232
|
+
continue;
|
|
4233
|
+
let a, c, f = !1;
|
|
4234
|
+
for (; typeof (a = r.pattern()) == "string" && (c = r.rest()); )
|
|
4235
|
+
i = i.resolve(a), r = c, f = !0;
|
|
4236
|
+
if (a = r.pattern(), c = r.rest(), f) {
|
|
4237
|
+
if (this.hasWalkedCache.hasWalked(i, r))
|
|
4238
|
+
continue;
|
|
4239
|
+
this.hasWalkedCache.storeWalked(i, r);
|
|
4240
|
+
}
|
|
4241
|
+
if (typeof a == "string") {
|
|
4242
|
+
let u = a === ".." || a === "" || a === ".";
|
|
4243
|
+
this.matches.add(i.resolve(a), h, u);
|
|
4244
|
+
continue;
|
|
4245
|
+
} else if (a === R) {
|
|
4246
|
+
(!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
|
|
4247
|
+
let u = c?.pattern(), d = c?.rest();
|
|
4248
|
+
if (!c || (u === "" || u === ".") && !d)
|
|
4249
|
+
this.matches.add(i, h, u === "" || u === ".");
|
|
4250
|
+
else if (u === "..") {
|
|
4251
|
+
let p = i.parent || i;
|
|
4252
|
+
d ? this.hasWalkedCache.hasWalked(p, d) || this.subwalks.add(p, d) : this.matches.add(p, h, !0);
|
|
4253
|
+
}
|
|
4254
|
+
} else a instanceof RegExp && this.subwalks.add(i, r);
|
|
4255
|
+
}
|
|
4256
|
+
return this;
|
|
4257
|
+
}
|
|
4258
|
+
subwalkTargets() {
|
|
4259
|
+
return this.subwalks.keys();
|
|
4260
|
+
}
|
|
4261
|
+
child() {
|
|
4262
|
+
return new n(this.opts, this.hasWalkedCache);
|
|
4263
|
+
}
|
|
4264
|
+
// return a new Processor containing the subwalks for each
|
|
4265
|
+
// child entry, and a set of matches, and
|
|
4266
|
+
// a hasWalkedCache that's a copy of this one
|
|
4267
|
+
// then we're going to call
|
|
4268
|
+
filterEntries(t, e) {
|
|
4269
|
+
let s = this.subwalks.get(t), i = this.child();
|
|
4270
|
+
for (let r of e)
|
|
4271
|
+
for (let o of s) {
|
|
4272
|
+
let h = o.isAbsolute(), a = o.pattern(), c = o.rest();
|
|
4273
|
+
a === R ? i.testGlobstar(r, o, c, h) : a instanceof RegExp ? i.testRegExp(r, a, c, h) : i.testString(r, a, c, h);
|
|
4274
|
+
}
|
|
4275
|
+
return i;
|
|
4276
|
+
}
|
|
4277
|
+
testGlobstar(t, e, s, i) {
|
|
4278
|
+
if ((this.dot || !t.name.startsWith(".")) && (e.hasMore() || this.matches.add(t, i, !1), t.canReaddir() && (this.follow || !t.isSymbolicLink() ?
|
|
4279
|
+
this.subwalks.add(t, e) : t.isSymbolicLink() && (s && e.checkFollowGlobstar() ? this.subwalks.add(t, s) : e.markFollowGlobstar() && this.
|
|
4280
|
+
subwalks.add(t, e)))), s) {
|
|
4281
|
+
let r = s.pattern();
|
|
4282
|
+
if (typeof r == "string" && // dots and empty were handled already
|
|
4283
|
+
r !== ".." && r !== "" && r !== ".")
|
|
4284
|
+
this.testString(t, r, s.rest(), i);
|
|
4285
|
+
else if (r === "..") {
|
|
4286
|
+
let o = t.parent || t;
|
|
4287
|
+
this.subwalks.add(o, s);
|
|
4288
|
+
} else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i);
|
|
4289
|
+
}
|
|
4290
|
+
}
|
|
4291
|
+
testRegExp(t, e, s, i) {
|
|
4292
|
+
e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
|
|
4293
|
+
}
|
|
4294
|
+
testString(t, e, s, i) {
|
|
4295
|
+
t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
|
|
4296
|
+
}
|
|
4297
|
+
};
|
|
4298
|
+
|
|
4299
|
+
// ../node_modules/glob/dist/esm/walker.js
|
|
4300
|
+
var Ui = /* @__PURE__ */ l((n, t) => typeof n == "string" ? new lt([n], t) : Array.isArray(n) ? new lt(n, t) : n, "makeIgnore"), Ut = class {
|
|
4301
|
+
static {
|
|
4302
|
+
l(this, "GlobUtil");
|
|
4303
|
+
}
|
|
4304
|
+
path;
|
|
4305
|
+
patterns;
|
|
4306
|
+
opts;
|
|
4307
|
+
seen = /* @__PURE__ */ new Set();
|
|
4308
|
+
paused = !1;
|
|
4309
|
+
aborted = !1;
|
|
4310
|
+
#t = [];
|
|
4311
|
+
#e;
|
|
4312
|
+
#n;
|
|
4313
|
+
signal;
|
|
4314
|
+
maxDepth;
|
|
4315
|
+
includeChildMatches;
|
|
4316
|
+
constructor(t, e, s) {
|
|
4317
|
+
if (this.patterns = t, this.path = e, this.opts = s, this.#n = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches =
|
|
4318
|
+
s.includeChildMatches !== !1, (s.ignore || !this.includeChildMatches) && (this.#e = Ui(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#e.
|
|
4319
|
+
add != "function")) {
|
|
4320
|
+
let i = "cannot ignore child matches, ignore lacks add() method.";
|
|
4321
|
+
throw new Error(i);
|
|
4322
|
+
}
|
|
4323
|
+
this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
|
|
4324
|
+
this.#t.length = 0;
|
|
4325
|
+
}));
|
|
4326
|
+
}
|
|
4327
|
+
#i(t) {
|
|
4328
|
+
return this.seen.has(t) || !!this.#e?.ignored?.(t);
|
|
4329
|
+
}
|
|
4330
|
+
#o(t) {
|
|
4331
|
+
return !!this.#e?.childrenIgnored?.(t);
|
|
4332
|
+
}
|
|
4333
|
+
// backpressure mechanism
|
|
4334
|
+
pause() {
|
|
4335
|
+
this.paused = !0;
|
|
4336
|
+
}
|
|
4337
|
+
resume() {
|
|
4338
|
+
if (this.signal?.aborted)
|
|
4339
|
+
return;
|
|
4340
|
+
this.paused = !1;
|
|
4341
|
+
let t;
|
|
4342
|
+
for (; !this.paused && (t = this.#t.shift()); )
|
|
4343
|
+
t();
|
|
4344
|
+
}
|
|
4345
|
+
onResume(t) {
|
|
4346
|
+
this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
|
|
4347
|
+
}
|
|
4348
|
+
// do the requisite realpath/stat checking, and return the path
|
|
4349
|
+
// to add or undefined to filter it out.
|
|
4350
|
+
async matchCheck(t, e) {
|
|
4351
|
+
if (e && this.opts.nodir)
|
|
4352
|
+
return;
|
|
4353
|
+
let s;
|
|
4354
|
+
if (this.opts.realpath) {
|
|
4355
|
+
if (s = t.realpathCached() || await t.realpath(), !s)
|
|
4356
|
+
return;
|
|
4357
|
+
t = s;
|
|
4358
|
+
}
|
|
4359
|
+
let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
|
|
4360
|
+
if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
|
|
4361
|
+
let o = await r.realpath();
|
|
4362
|
+
o && (o.isUnknown() || this.opts.stat) && await o.lstat();
|
|
4363
|
+
}
|
|
4364
|
+
return this.matchCheckTest(r, e);
|
|
4365
|
+
}
|
|
4366
|
+
matchCheckTest(t, e) {
|
|
4367
|
+
return t && (this.maxDepth === 1 / 0 || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) &&
|
|
4368
|
+
(!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#i(t) ? t : void 0;
|
|
4369
|
+
}
|
|
4370
|
+
matchCheckSync(t, e) {
|
|
4371
|
+
if (e && this.opts.nodir)
|
|
4372
|
+
return;
|
|
4373
|
+
let s;
|
|
4374
|
+
if (this.opts.realpath) {
|
|
4375
|
+
if (s = t.realpathCached() || t.realpathSync(), !s)
|
|
4376
|
+
return;
|
|
4377
|
+
t = s;
|
|
4378
|
+
}
|
|
4379
|
+
let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
|
|
4380
|
+
if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
|
|
4381
|
+
let o = r.realpathSync();
|
|
4382
|
+
o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
|
|
4383
|
+
}
|
|
4384
|
+
return this.matchCheckTest(r, e);
|
|
4385
|
+
}
|
|
4386
|
+
matchFinish(t, e) {
|
|
4387
|
+
if (this.#i(t))
|
|
4388
|
+
return;
|
|
4389
|
+
if (!this.includeChildMatches && this.#e?.add) {
|
|
4390
|
+
let r = `${t.relativePosix()}/**`;
|
|
4391
|
+
this.#e.add(r);
|
|
4392
|
+
}
|
|
4393
|
+
let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
|
|
4394
|
+
this.seen.add(t);
|
|
4395
|
+
let i = this.opts.mark && t.isDirectory() ? this.#n : "";
|
|
4396
|
+
if (this.opts.withFileTypes)
|
|
4397
|
+
this.matchEmit(t);
|
|
4398
|
+
else if (s) {
|
|
4399
|
+
let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
|
|
4400
|
+
this.matchEmit(r + i);
|
|
4401
|
+
} else {
|
|
4402
|
+
let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n :
|
|
4403
|
+
"";
|
|
4404
|
+
this.matchEmit(r ? o + r + i : "." + i);
|
|
4405
|
+
}
|
|
4406
|
+
}
|
|
4407
|
+
async match(t, e, s) {
|
|
4408
|
+
let i = await this.matchCheck(t, s);
|
|
4409
|
+
i && this.matchFinish(i, e);
|
|
4410
|
+
}
|
|
4411
|
+
matchSync(t, e, s) {
|
|
4412
|
+
let i = this.matchCheckSync(t, s);
|
|
4413
|
+
i && this.matchFinish(i, e);
|
|
4414
|
+
}
|
|
4415
|
+
walkCB(t, e, s) {
|
|
4416
|
+
this.signal?.aborted && s(), this.walkCB2(t, e, new vt(this.opts), s);
|
|
4417
|
+
}
|
|
4418
|
+
walkCB2(t, e, s, i) {
|
|
4419
|
+
if (this.#o(t))
|
|
4420
|
+
return i();
|
|
4421
|
+
if (this.signal?.aborted && i(), this.paused) {
|
|
4422
|
+
this.onResume(() => this.walkCB2(t, e, s, i));
|
|
4423
|
+
return;
|
|
4424
|
+
}
|
|
4425
|
+
s.processPatterns(t, e);
|
|
4426
|
+
let r = 1, o = /* @__PURE__ */ l(() => {
|
|
4427
|
+
--r === 0 && i();
|
|
4428
|
+
}, "next");
|
|
4429
|
+
for (let [h, a, c] of s.matches.entries())
|
|
4430
|
+
this.#i(h) || (r++, this.match(h, a, c).then(() => o()));
|
|
4431
|
+
for (let h of s.subwalkTargets()) {
|
|
4432
|
+
if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth)
|
|
4433
|
+
continue;
|
|
4434
|
+
r++;
|
|
4435
|
+
let a = h.readdirCached();
|
|
4436
|
+
h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((c, f) => this.walkCB3(h, f, s, o), !0);
|
|
4437
|
+
}
|
|
4438
|
+
o();
|
|
4439
|
+
}
|
|
4440
|
+
walkCB3(t, e, s, i) {
|
|
4441
|
+
s = s.filterEntries(t, e);
|
|
4442
|
+
let r = 1, o = /* @__PURE__ */ l(() => {
|
|
4443
|
+
--r === 0 && i();
|
|
4444
|
+
}, "next");
|
|
4445
|
+
for (let [h, a, c] of s.matches.entries())
|
|
4446
|
+
this.#i(h) || (r++, this.match(h, a, c).then(() => o()));
|
|
4447
|
+
for (let [h, a] of s.subwalks.entries())
|
|
4448
|
+
r++, this.walkCB2(h, a, s.child(), o);
|
|
4449
|
+
o();
|
|
4450
|
+
}
|
|
4451
|
+
walkCBSync(t, e, s) {
|
|
4452
|
+
this.signal?.aborted && s(), this.walkCB2Sync(t, e, new vt(this.opts), s);
|
|
4453
|
+
}
|
|
4454
|
+
walkCB2Sync(t, e, s, i) {
|
|
4455
|
+
if (this.#o(t))
|
|
4456
|
+
return i();
|
|
4457
|
+
if (this.signal?.aborted && i(), this.paused) {
|
|
4458
|
+
this.onResume(() => this.walkCB2Sync(t, e, s, i));
|
|
4459
|
+
return;
|
|
4460
|
+
}
|
|
4461
|
+
s.processPatterns(t, e);
|
|
4462
|
+
let r = 1, o = /* @__PURE__ */ l(() => {
|
|
4463
|
+
--r === 0 && i();
|
|
4464
|
+
}, "next");
|
|
4465
|
+
for (let [h, a, c] of s.matches.entries())
|
|
4466
|
+
this.#i(h) || this.matchSync(h, a, c);
|
|
4467
|
+
for (let h of s.subwalkTargets()) {
|
|
4468
|
+
if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth)
|
|
4469
|
+
continue;
|
|
4470
|
+
r++;
|
|
4471
|
+
let a = h.readdirSync();
|
|
4472
|
+
this.walkCB3Sync(h, a, s, o);
|
|
4473
|
+
}
|
|
4474
|
+
o();
|
|
4475
|
+
}
|
|
4476
|
+
walkCB3Sync(t, e, s, i) {
|
|
4477
|
+
s = s.filterEntries(t, e);
|
|
4478
|
+
let r = 1, o = /* @__PURE__ */ l(() => {
|
|
4479
|
+
--r === 0 && i();
|
|
4480
|
+
}, "next");
|
|
4481
|
+
for (let [h, a, c] of s.matches.entries())
|
|
4482
|
+
this.#i(h) || this.matchSync(h, a, c);
|
|
4483
|
+
for (let [h, a] of s.subwalks.entries())
|
|
4484
|
+
r++, this.walkCB2Sync(h, a, s.child(), o);
|
|
4485
|
+
o();
|
|
4486
|
+
}
|
|
4487
|
+
}, Tt = class extends Ut {
|
|
4488
|
+
static {
|
|
4489
|
+
l(this, "GlobWalker");
|
|
4490
|
+
}
|
|
4491
|
+
matches = /* @__PURE__ */ new Set();
|
|
4492
|
+
constructor(t, e, s) {
|
|
4493
|
+
super(t, e, s);
|
|
4494
|
+
}
|
|
4495
|
+
matchEmit(t) {
|
|
4496
|
+
this.matches.add(t);
|
|
4497
|
+
}
|
|
4498
|
+
async walk() {
|
|
4499
|
+
if (this.signal?.aborted)
|
|
4500
|
+
throw this.signal.reason;
|
|
4501
|
+
return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
|
|
4502
|
+
this.walkCB(this.path, this.patterns, () => {
|
|
4503
|
+
this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
|
|
4504
|
+
});
|
|
4505
|
+
}), this.matches;
|
|
4506
|
+
}
|
|
4507
|
+
walkSync() {
|
|
4508
|
+
if (this.signal?.aborted)
|
|
4509
|
+
throw this.signal.reason;
|
|
4510
|
+
return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
|
|
4511
|
+
if (this.signal?.aborted)
|
|
4512
|
+
throw this.signal.reason;
|
|
4513
|
+
}), this.matches;
|
|
4514
|
+
}
|
|
4515
|
+
}, Ct = class extends Ut {
|
|
4516
|
+
static {
|
|
4517
|
+
l(this, "GlobStream");
|
|
4518
|
+
}
|
|
4519
|
+
results;
|
|
4520
|
+
constructor(t, e, s) {
|
|
4521
|
+
super(t, e, s), this.results = new Y({
|
|
4522
|
+
signal: this.signal,
|
|
4523
|
+
objectMode: !0
|
|
4524
|
+
}), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
|
|
4525
|
+
}
|
|
4526
|
+
matchEmit(t) {
|
|
4527
|
+
this.results.write(t), this.results.flowing || this.pause();
|
|
4528
|
+
}
|
|
4529
|
+
stream() {
|
|
4530
|
+
let t = this.path;
|
|
4531
|
+
return t.isUnknown() ? t.lstat().then(() => {
|
|
4532
|
+
this.walkCB(t, this.patterns, () => this.results.end());
|
|
4533
|
+
}) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
|
|
4534
|
+
}
|
|
4535
|
+
streamSync() {
|
|
4536
|
+
return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
|
|
4537
|
+
}
|
|
4538
|
+
};
|
|
4539
|
+
|
|
4540
|
+
// ../node_modules/glob/dist/esm/glob.js
|
|
4541
|
+
var Gi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", $ = class {
|
|
4542
|
+
static {
|
|
4543
|
+
l(this, "Glob");
|
|
4544
|
+
}
|
|
4545
|
+
absolute;
|
|
4546
|
+
cwd;
|
|
4547
|
+
root;
|
|
4548
|
+
dot;
|
|
4549
|
+
dotRelative;
|
|
4550
|
+
follow;
|
|
4551
|
+
ignore;
|
|
4552
|
+
magicalBraces;
|
|
4553
|
+
mark;
|
|
4554
|
+
matchBase;
|
|
4555
|
+
maxDepth;
|
|
4556
|
+
nobrace;
|
|
4557
|
+
nocase;
|
|
4558
|
+
nodir;
|
|
4559
|
+
noext;
|
|
4560
|
+
noglobstar;
|
|
4561
|
+
pattern;
|
|
4562
|
+
platform;
|
|
4563
|
+
realpath;
|
|
4564
|
+
scurry;
|
|
4565
|
+
stat;
|
|
4566
|
+
signal;
|
|
4567
|
+
windowsPathsNoEscape;
|
|
4568
|
+
withFileTypes;
|
|
4569
|
+
includeChildMatches;
|
|
4570
|
+
/**
|
|
4571
|
+
* The options provided to the constructor.
|
|
4572
|
+
*/
|
|
4573
|
+
opts;
|
|
4574
|
+
/**
|
|
4575
|
+
* An array of parsed immutable {@link Pattern} objects.
|
|
4576
|
+
*/
|
|
4577
|
+
patterns;
|
|
4578
|
+
/**
|
|
4579
|
+
* All options are stored as properties on the `Glob` object.
|
|
4580
|
+
*
|
|
4581
|
+
* See {@link GlobOptions} for full options descriptions.
|
|
4582
|
+
*
|
|
4583
|
+
* Note that a previous `Glob` object can be passed as the
|
|
4584
|
+
* `GlobOptions` to another `Glob` instantiation to re-use settings
|
|
4585
|
+
* and caches with a new pattern.
|
|
4586
|
+
*
|
|
4587
|
+
* Traversal functions can be called multiple times to run the walk
|
|
4588
|
+
* again.
|
|
4589
|
+
*/
|
|
4590
|
+
constructor(t, e) {
|
|
4591
|
+
if (!e)
|
|
4592
|
+
throw new TypeError("glob options required");
|
|
4593
|
+
if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.
|
|
4594
|
+
dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = $i(
|
|
4595
|
+
e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace,
|
|
4596
|
+
this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== !1,
|
|
4597
|
+
this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : 1 / 0, this.
|
|
4598
|
+
stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0)
|
|
4599
|
+
throw new Error("cannot set absolute and withFileTypes:true");
|
|
4600
|
+
if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape &&
|
|
4601
|
+
(t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
|
|
4602
|
+
if (e.noglobstar)
|
|
4603
|
+
throw new TypeError("base matching requires globstar");
|
|
4604
|
+
t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
|
|
4605
|
+
}
|
|
4606
|
+
if (this.pattern = t, this.platform = e.platform || Gi, this.opts = { ...e, platform: this.platform }, e.scurry) {
|
|
4607
|
+
if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase)
|
|
4608
|
+
throw new Error("nocase option contradicts provided scurry option");
|
|
4609
|
+
} else {
|
|
4610
|
+
let a = e.platform === "win32" ? ot : e.platform === "darwin" ? xt : e.platform ? ht : as;
|
|
4611
|
+
this.scurry = new a(this.cwd, {
|
|
4612
|
+
nocase: e.nocase,
|
|
4613
|
+
fs: e.fs
|
|
4614
|
+
});
|
|
4615
|
+
}
|
|
4616
|
+
this.nocase = this.scurry.nocase;
|
|
4617
|
+
let s = this.platform === "darwin" || this.platform === "win32", i = {
|
|
4618
|
+
// default nocase based on platform
|
|
4619
|
+
...e,
|
|
4620
|
+
dot: this.dot,
|
|
4621
|
+
matchBase: this.matchBase,
|
|
4622
|
+
nobrace: this.nobrace,
|
|
4623
|
+
nocase: this.nocase,
|
|
4624
|
+
nocaseMagicOnly: s,
|
|
4625
|
+
nocomment: !0,
|
|
4626
|
+
noext: this.noext,
|
|
4627
|
+
nonegate: !0,
|
|
4628
|
+
optimizationLevel: 2,
|
|
4629
|
+
platform: this.platform,
|
|
4630
|
+
windowsPathsNoEscape: this.windowsPathsNoEscape,
|
|
4631
|
+
debug: !!this.opts.debug
|
|
4632
|
+
}, r = this.pattern.map((a) => new _(a, i)), [o, h] = r.reduce((a, c) => (a[0].push(...c.set), a[1].push(...c.globParts), a), [[], []]);
|
|
4633
|
+
this.patterns = o.map((a, c) => {
|
|
4634
|
+
let f = h[c];
|
|
4635
|
+
if (!f)
|
|
4636
|
+
throw new Error("invalid pattern object");
|
|
4637
|
+
return new at(a, f, 0, this.platform);
|
|
4638
|
+
});
|
|
4639
|
+
}
|
|
4640
|
+
async walk() {
|
|
4641
|
+
return [
|
|
4642
|
+
...await new Tt(this.patterns, this.scurry.cwd, {
|
|
4643
|
+
...this.opts,
|
|
4644
|
+
maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
|
|
4645
|
+
platform: this.platform,
|
|
4646
|
+
nocase: this.nocase,
|
|
4647
|
+
includeChildMatches: this.includeChildMatches
|
|
4648
|
+
}).walk()
|
|
4649
|
+
];
|
|
4650
|
+
}
|
|
4651
|
+
walkSync() {
|
|
4652
|
+
return [
|
|
4653
|
+
...new Tt(this.patterns, this.scurry.cwd, {
|
|
4654
|
+
...this.opts,
|
|
4655
|
+
maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
|
|
4656
|
+
platform: this.platform,
|
|
4657
|
+
nocase: this.nocase,
|
|
4658
|
+
includeChildMatches: this.includeChildMatches
|
|
4659
|
+
}).walkSync()
|
|
4660
|
+
];
|
|
4661
|
+
}
|
|
4662
|
+
stream() {
|
|
4663
|
+
return new Ct(this.patterns, this.scurry.cwd, {
|
|
4664
|
+
...this.opts,
|
|
4665
|
+
maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
|
|
4666
|
+
platform: this.platform,
|
|
4667
|
+
nocase: this.nocase,
|
|
4668
|
+
includeChildMatches: this.includeChildMatches
|
|
4669
|
+
}).stream();
|
|
4670
|
+
}
|
|
4671
|
+
streamSync() {
|
|
4672
|
+
return new Ct(this.patterns, this.scurry.cwd, {
|
|
4673
|
+
...this.opts,
|
|
4674
|
+
maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
|
|
4675
|
+
platform: this.platform,
|
|
4676
|
+
nocase: this.nocase,
|
|
4677
|
+
includeChildMatches: this.includeChildMatches
|
|
4678
|
+
}).streamSync();
|
|
4679
|
+
}
|
|
4680
|
+
/**
|
|
4681
|
+
* Default sync iteration function. Returns a Generator that
|
|
4682
|
+
* iterates over the results.
|
|
4683
|
+
*/
|
|
4684
|
+
iterateSync() {
|
|
4685
|
+
return this.streamSync()[Symbol.iterator]();
|
|
4686
|
+
}
|
|
4687
|
+
[Symbol.iterator]() {
|
|
4688
|
+
return this.iterateSync();
|
|
4689
|
+
}
|
|
4690
|
+
/**
|
|
4691
|
+
* Default async iteration function. Returns an AsyncGenerator that
|
|
4692
|
+
* iterates over the results.
|
|
4693
|
+
*/
|
|
4694
|
+
iterate() {
|
|
4695
|
+
return this.stream()[Symbol.asyncIterator]();
|
|
4696
|
+
}
|
|
4697
|
+
[Symbol.asyncIterator]() {
|
|
4698
|
+
return this.iterate();
|
|
4699
|
+
}
|
|
4700
|
+
};
|
|
4701
|
+
|
|
4702
|
+
// ../node_modules/glob/dist/esm/has-magic.js
|
|
4703
|
+
var ue = /* @__PURE__ */ l((n, t = {}) => {
|
|
4704
|
+
Array.isArray(n) || (n = [n]);
|
|
4705
|
+
for (let e of n)
|
|
4706
|
+
if (new _(e, t).hasMagic())
|
|
4707
|
+
return !0;
|
|
4708
|
+
return !1;
|
|
4709
|
+
}, "hasMagic");
|
|
4710
|
+
|
|
4711
|
+
// ../node_modules/glob/dist/esm/index.js
|
|
4712
|
+
function Gt(n, t = {}) {
|
|
4713
|
+
return new $(n, t).streamSync();
|
|
4714
|
+
}
|
|
4715
|
+
l(Gt, "globStreamSync");
|
|
4716
|
+
function cs(n, t = {}) {
|
|
4717
|
+
return new $(n, t).stream();
|
|
4718
|
+
}
|
|
4719
|
+
l(cs, "globStream");
|
|
4720
|
+
function fs(n, t = {}) {
|
|
4721
|
+
return new $(n, t).walkSync();
|
|
4722
|
+
}
|
|
4723
|
+
l(fs, "globSync");
|
|
4724
|
+
async function ls(n, t = {}) {
|
|
4725
|
+
return new $(n, t).walk();
|
|
4726
|
+
}
|
|
4727
|
+
l(ls, "glob_");
|
|
4728
|
+
function Ht(n, t = {}) {
|
|
4729
|
+
return new $(n, t).iterateSync();
|
|
4730
|
+
}
|
|
4731
|
+
l(Ht, "globIterateSync");
|
|
4732
|
+
function us(n, t = {}) {
|
|
4733
|
+
return new $(n, t).iterate();
|
|
4734
|
+
}
|
|
4735
|
+
l(us, "globIterate");
|
|
4736
|
+
var Hi = Gt, qi = Object.assign(cs, { sync: Gt }), Ki = Ht, Vi = Object.assign(us, {
|
|
4737
|
+
sync: Ht
|
|
4738
|
+
}), Xi = Object.assign(fs, {
|
|
4739
|
+
stream: Gt,
|
|
4740
|
+
iterate: Ht
|
|
4741
|
+
}), $t = Object.assign(ls, {
|
|
4742
|
+
glob: ls,
|
|
4743
|
+
globSync: fs,
|
|
4744
|
+
sync: Xi,
|
|
4745
|
+
globStream: cs,
|
|
4746
|
+
stream: qi,
|
|
4747
|
+
globStreamSync: Gt,
|
|
4748
|
+
streamSync: Hi,
|
|
4749
|
+
globIterate: us,
|
|
4750
|
+
iterate: Vi,
|
|
4751
|
+
globIterateSync: Ht,
|
|
4752
|
+
iterateSync: Ki,
|
|
4753
|
+
Glob: $,
|
|
4754
|
+
hasMagic: ue,
|
|
4755
|
+
escape: et,
|
|
4756
|
+
unescape: z
|
|
4757
|
+
});
|
|
4758
|
+
$t.glob = $t;
|
|
4759
|
+
|
|
4760
|
+
// ../node_modules/slash/index.js
|
|
4761
|
+
function de(n) {
|
|
4762
|
+
return n.startsWith("\\\\?\\") ? n : n.replace(/\\/g, "/");
|
|
4763
|
+
}
|
|
4764
|
+
l(de, "slash");
|
|
4765
|
+
|
|
4766
|
+
// src/core-server/utils/remove-mdx-entries.ts
|
|
4767
|
+
async function ps(n, t) {
|
|
4768
|
+
let e = Zi(n, {
|
|
4769
|
+
configDir: t.configDir,
|
|
4770
|
+
workingDir: t.configDir,
|
|
4771
|
+
defaultFilesPattern: "**/*.@(stories.@(js|jsx|mjs|ts|tsx))"
|
|
4772
|
+
});
|
|
4773
|
+
return (await Promise.all(
|
|
4774
|
+
e.map(async ({ directory: i, files: r, titlePrefix: o }) => {
|
|
4775
|
+
let h = pe(i, r), a = ds(h) ? h : pe(t.configDir, h), c = ds(i) ? i : pe(t.configDir, i);
|
|
4776
|
+
return {
|
|
4777
|
+
files: (await $t(de(a), {
|
|
4778
|
+
...Ji(a),
|
|
4779
|
+
follow: !0
|
|
4780
|
+
})).map((f) => Yi(c, f)),
|
|
4781
|
+
directory: i,
|
|
4782
|
+
titlePrefix: o
|
|
4783
|
+
};
|
|
4784
|
+
})
|
|
4785
|
+
)).flatMap(({ directory: i, files: r, titlePrefix: o }, h) => {
|
|
4786
|
+
let a = r.filter((f) => !f.endsWith(".mdx")), c = [];
|
|
4787
|
+
return a.length < r.length ? c = a.map((f) => ({
|
|
4788
|
+
directory: i,
|
|
4789
|
+
titlePrefix: o,
|
|
4790
|
+
files: `**/${f}`
|
|
4791
|
+
})) : c = [
|
|
4792
|
+
{ directory: e[h].directory, titlePrefix: e[h].titlePrefix, files: e[h].files }
|
|
4793
|
+
], c;
|
|
4794
|
+
});
|
|
4795
|
+
}
|
|
4796
|
+
l(ps, "removeMDXEntries");
|
|
4797
|
+
|
|
4798
|
+
// src/core-server/presets/common-override-preset.ts
|
|
4799
|
+
var Pn = /* @__PURE__ */ l(async (n) => {
|
|
4800
|
+
let t = typeof n == "string" ? n : n?.name, e = typeof n == "string" ? {} : n?.options || {};
|
|
4801
|
+
return {
|
|
4802
|
+
name: t,
|
|
4803
|
+
options: e
|
|
4804
|
+
};
|
|
4805
|
+
}, "framework"), Wn = /* @__PURE__ */ l(async (n, t) => t?.build?.test?.disableMDXEntries ? ps(n, t) : n, "stories"), jn = /* @__PURE__ */ l(
|
|
4806
|
+
async (n, t) => t?.build?.test?.disableDocgen ? { ...n ?? {}, reactDocgen: !1, check: !1 } : n, "typescript"), In = /* @__PURE__ */ l(async (n, t) => t?.
|
|
4807
|
+
build?.test?.disableAutoDocs ? {} : n, "docs"), ms = /* @__PURE__ */ l((n) => ({
|
|
4808
|
+
disableBlocks: n,
|
|
4809
|
+
disabledAddons: n ? ["@storybook/addon-docs", "@storybook/addon-essentials/docs", "@storybook/addon-coverage"] : [],
|
|
4810
|
+
disableMDXEntries: n,
|
|
4811
|
+
disableAutoDocs: n,
|
|
4812
|
+
disableDocgen: n,
|
|
4813
|
+
disableSourcemaps: n,
|
|
4814
|
+
disableTreeShaking: n,
|
|
4815
|
+
esbuildMinify: n
|
|
4816
|
+
}), "createTestBuildFeatures"), zn = /* @__PURE__ */ l(async (n, t) => ({
|
|
4817
|
+
...n,
|
|
4818
|
+
test: t.test ? {
|
|
4819
|
+
...ms(!!t.test),
|
|
4820
|
+
...n?.test
|
|
4821
|
+
} : ms(!1)
|
|
4822
|
+
}), "build");
|
|
4823
|
+
export {
|
|
4824
|
+
zn as build,
|
|
4825
|
+
In as docs,
|
|
4826
|
+
Pn as framework,
|
|
4827
|
+
Wn as stories,
|
|
4828
|
+
jn as typescript
|
|
4829
|
+
};
|