storybook 10.2.0-alpha.0 → 10.2.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_browser-chunks/Color-E5XDEOX4.js +484 -0
- package/dist/_browser-chunks/{WithTooltip-IO6J4KBT.js → WithTooltip-65CFNBJE.js} +70 -70
- package/dist/_browser-chunks/{chunk-45UGUKRX.js → chunk-242VQQM5.js} +1 -1
- package/dist/_browser-chunks/chunk-2NDLAB5X.js +363 -0
- package/dist/_browser-chunks/{chunk-JP7NCOJX.js → chunk-3LY4VQVK.js} +1 -1
- package/dist/_browser-chunks/{chunk-XJNX76GA.js → chunk-54PNNATT.js} +3 -20
- package/dist/_browser-chunks/{chunk-VYJQ7RU5.js → chunk-6QKNWBQB.js} +17 -17
- package/dist/_browser-chunks/chunk-CLSHX4VX.js +4140 -0
- package/dist/_browser-chunks/{chunk-2XZMBGTA.js → chunk-DOSERVNW.js} +1 -1
- package/dist/_browser-chunks/chunk-HPYUT3WS.js +199 -0
- package/dist/_browser-chunks/{chunk-BRX2HXH7.js → chunk-IH6QJILI.js} +1 -1
- package/dist/_browser-chunks/{chunk-AS2HQEYC.js → chunk-IWQGIXJS.js} +1 -1
- package/dist/_browser-chunks/{chunk-UD6FQLAF.js → chunk-JK6U3MQW.js} +3 -3
- package/dist/_browser-chunks/{chunk-CHUV5WSW.js → chunk-LE2LTDW3.js} +1 -1
- package/dist/_browser-chunks/{chunk-RP5RXKFU.js → chunk-MOYJJEXA.js} +38 -29
- package/dist/_browser-chunks/chunk-NZMVUW5T.js +7 -0
- package/dist/_browser-chunks/{chunk-AXG2BOBL.js → chunk-S6TK43XQ.js} +10 -10
- package/dist/_browser-chunks/{chunk-H6XK3RSC.js → chunk-UAYGIC3L.js} +6 -6
- package/dist/_browser-chunks/{chunk-YKE5S47A.js → chunk-V2VKKSMQ.js} +18 -18
- package/dist/_browser-chunks/chunk-VIJ7SQRO.js +568 -0
- package/dist/_browser-chunks/chunk-XCZK5QUJ.js +0 -0
- package/dist/_browser-chunks/{chunk-3OXGAGBE.js → chunk-XLJZ7AOP.js} +14 -14
- package/dist/_browser-chunks/{chunk-SS2NHR7W.js → chunk-Y6HZAT53.js} +10 -12
- package/dist/_browser-chunks/{chunk-P4F4UVXX.js → chunk-YKABRMAI.js} +15 -15
- package/dist/_browser-chunks/{chunk-WJYERY3R.js → chunk-ZCFV7BZB.js} +2 -2
- package/dist/_browser-chunks/{formatter-QJ4M4OGQ.js → formatter-EIJCOSYU.js} +2 -2
- package/dist/_browser-chunks/{syntaxhighlighter-IQDEPFLK.js → syntaxhighlighter-ED5Y7EFY.js} +119 -119
- package/dist/_node-chunks/{builder-manager-7Y5SBM27.js → builder-manager-ZK4QXZNX.js} +22 -22
- package/dist/_node-chunks/{camelcase-VIOG5GUK.js → camelcase-QWQG7I72.js} +8 -8
- package/dist/_node-chunks/{chunk-G2SSRQRU.js → chunk-2AFVBCGF.js} +6 -6
- package/dist/_node-chunks/{chunk-YS4ZBVQ2.js → chunk-5VZMCPTH.js} +18 -18
- package/dist/_node-chunks/{chunk-RZYKYZNC.js → chunk-6OZRMRVO.js} +31 -31
- package/dist/_node-chunks/chunk-CLCLRZYL.js +61 -0
- package/dist/_node-chunks/{chunk-6I6BDAIH.js → chunk-CW7HJRCY.js} +9 -9
- package/dist/_node-chunks/chunk-DF3QP62W.js +18 -0
- package/dist/_node-chunks/{chunk-RQYJV7HO.js → chunk-DWVHBQGR.js} +165 -191
- package/dist/_node-chunks/chunk-EVBCPGQO.js +20 -0
- package/dist/_node-chunks/{chunk-NSWP6O57.js → chunk-EXZXVBZO.js} +8 -8
- package/dist/_node-chunks/{chunk-46UKK4ME.js → chunk-FZFZ5TOM.js} +9 -9
- package/dist/_node-chunks/{chunk-IIAWDLTX.js → chunk-GKEAARBQ.js} +10 -10
- package/dist/_node-chunks/{chunk-RFI7ULWH.js → chunk-HMFROKHU.js} +19 -19
- package/dist/_node-chunks/{chunk-KKTHRW4D.js → chunk-I5TOD3AY.js} +66 -72
- package/dist/_node-chunks/{chunk-MTAECA6H.js → chunk-KVNLJSAB.js} +619 -148
- package/dist/_node-chunks/{chunk-DGCZNDMZ.js → chunk-NKOHF7TQ.js} +10 -10
- package/dist/_node-chunks/{chunk-4APIDVTW.js → chunk-OV2CP4VV.js} +7 -7
- package/dist/_node-chunks/chunk-PCMFKXWQ.js +23 -0
- package/dist/_node-chunks/{chunk-T3T35CKM.js → chunk-Q5ZQH2OQ.js} +15 -15
- package/dist/_node-chunks/{chunk-VMPPKUVU.js → chunk-QFSK4B7R.js} +8 -8
- package/dist/_node-chunks/{chunk-WOPURGV3.js → chunk-R2J3OB3H.js} +6 -6
- package/dist/_node-chunks/{chunk-UCXU3VCO.js → chunk-RGQC4G3L.js} +165 -21
- package/dist/_node-chunks/{chunk-KX2RIBIP.js → chunk-TOXVUAH2.js} +6 -6
- package/dist/_node-chunks/{chunk-XE4QTYSE.js → chunk-URBB5EGY.js} +8 -8
- package/dist/_node-chunks/{chunk-XCRYZZCA.js → chunk-UWJ4BOOL.js} +597 -593
- package/dist/_node-chunks/{chunk-RTFXQIIL.js → chunk-VJPI73BB.js} +230 -236
- package/dist/_node-chunks/{chunk-I7HQSEQK.js → chunk-WOS3OQVT.js} +6 -6
- package/dist/_node-chunks/{chunk-UGZX6OPP.js → chunk-WUKWNPSQ.js} +17 -17
- package/dist/_node-chunks/{chunk-2265F7MI.js → chunk-XFU23B4C.js} +9 -9
- package/dist/_node-chunks/{dist-GV3REIPT.js → dist-UBFMIJZC.js} +10 -10
- package/dist/_node-chunks/{globby-QE4LR4PT.js → globby-VD3CGPVI.js} +154 -154
- package/dist/_node-chunks/{lib-NXQ5B2WJ.js → lib-MMJB47J3.js} +16 -16
- package/dist/_node-chunks/{mdx-N42X6CFJ-IGCQXXC5.js → mdx-N42X6CFJ-3J2G7NZZ.js} +11 -11
- package/dist/_node-chunks/{p-limit-S2V3UH5Q.js → p-limit-SOBWTEVH.js} +8 -8
- package/dist/babel/index.js +10 -10
- package/dist/bin/core.js +28 -28
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +14 -11
- package/dist/channels/index.js +3 -3
- package/dist/cli/index.d.ts +2 -1
- package/dist/cli/index.js +18 -18
- package/dist/common/index.js +19 -19
- package/dist/components/index.d.ts +9 -2
- package/dist/components/index.js +327 -311
- package/dist/core-server/index.js +127 -127
- package/dist/core-server/presets/common-manager.css +2 -2
- package/dist/core-server/presets/common-manager.js +43 -38
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +4390 -173
- package/dist/csf/index.js +39 -35
- package/dist/csf-tools/index.js +9 -9
- package/dist/docs-tools/index.js +6 -5
- package/dist/instrumenter/index.js +1 -1
- package/dist/manager/globals-runtime.js +18956 -12602
- package/dist/manager/runtime.js +148 -132
- package/dist/manager-api/index.js +31 -22
- package/dist/mocking-utils/index.js +14 -14
- package/dist/node-logger/index.d.ts +2 -2
- package/dist/node-logger/index.js +9 -9
- package/dist/preview/runtime.js +30784 -24388
- package/dist/preview-api/index.js +12 -11
- package/dist/preview-errors.js +2 -2
- package/dist/router/index.js +12 -13
- package/dist/server-errors.js +11 -11
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.js +23 -23
- package/dist/test/index.js +3104 -1604
- package/dist/theming/create.js +3 -3
- package/dist/theming/index.js +38 -38
- package/package.json +2 -8
- package/dist/_browser-chunks/Color-TNPFN3FC.js +0 -1097
- package/dist/_browser-chunks/chunk-3IAH5M2U.js +0 -171
- package/dist/_browser-chunks/chunk-AIOS4NGK.js +0 -252
- package/dist/_browser-chunks/chunk-EZSQOHRI.js +0 -18
- package/dist/_browser-chunks/chunk-GFLS4VP3.js +0 -64
- package/dist/_browser-chunks/chunk-QKODTO7K.js +0 -7
- package/dist/_node-chunks/chunk-5JSWIKE2.js +0 -18
- package/dist/_node-chunks/chunk-BJMYJWGF.js +0 -20
- package/dist/_node-chunks/chunk-BYYI4JA6.js +0 -61
- package/dist/_node-chunks/chunk-RQ4GZHOA.js +0 -23
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_wtqlduo6et from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_wtqlduo6et from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_wtqlduo6et from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_wtqlduo6et.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_wtqlduo6et.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_wtqlduo6et.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,11 +12,11 @@ var require = CJS_COMPAT_NODE_MODULE_skf7bajczt8.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
__commonJS,
|
|
14
14
|
__toESM
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TOXVUAH2.js";
|
|
16
16
|
|
|
17
|
-
//
|
|
17
|
+
// ../../node_modules/balanced-match/index.js
|
|
18
18
|
var require_balanced_match = __commonJS({
|
|
19
|
-
"
|
|
19
|
+
"../../node_modules/balanced-match/index.js"(exports, module) {
|
|
20
20
|
"use strict";
|
|
21
21
|
module.exports = balanced;
|
|
22
22
|
function balanced(a, b, str) {
|
|
@@ -49,9 +49,9 @@ var require_balanced_match = __commonJS({
|
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
//
|
|
52
|
+
// ../../node_modules/brace-expansion/index.js
|
|
53
53
|
var require_brace_expansion = __commonJS({
|
|
54
|
-
"
|
|
54
|
+
"../../node_modules/brace-expansion/index.js"(exports, module) {
|
|
55
55
|
var balanced = require_balanced_match();
|
|
56
56
|
module.exports = expandTop;
|
|
57
57
|
var escSlash = "\0SLASH" + Math.random() + "\0", escOpen = "\0OPEN" + Math.random() + "\0", escClose = "\0CLOSE" + Math.random() + "\0", escComma = "\0COMMA" + Math.random() + "\0", escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
@@ -102,7 +102,7 @@ var require_brace_expansion = __commonJS({
|
|
|
102
102
|
else {
|
|
103
103
|
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body), isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body), isSequence = isNumericSequence || isAlphaSequence, isOptions = m.body.indexOf(",") >= 0;
|
|
104
104
|
if (!isSequence && !isOptions)
|
|
105
|
-
return m.post.match(
|
|
105
|
+
return m.post.match(/,.*\}/) ? (str = m.pre + "{" + m.body + escClose + m.post, expand2(str)) : [str];
|
|
106
106
|
var n;
|
|
107
107
|
if (isSequence)
|
|
108
108
|
n = m.body.split(/\.\./);
|
|
@@ -145,10 +145,10 @@ var require_brace_expansion = __commonJS({
|
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
-
//
|
|
148
|
+
// ../../node_modules/glob/node_modules/minimatch/dist/esm/index.js
|
|
149
149
|
var import_brace_expansion = __toESM(require_brace_expansion(), 1);
|
|
150
150
|
|
|
151
|
-
//
|
|
151
|
+
// ../../node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
152
152
|
var assertValidPattern = (pattern) => {
|
|
153
153
|
if (typeof pattern != "string")
|
|
154
154
|
throw new TypeError("invalid pattern");
|
|
@@ -156,7 +156,7 @@ var assertValidPattern = (pattern) => {
|
|
|
156
156
|
throw new TypeError("pattern is too long");
|
|
157
157
|
};
|
|
158
158
|
|
|
159
|
-
//
|
|
159
|
+
// ../../node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.js
|
|
160
160
|
var posixClasses = {
|
|
161
161
|
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
|
|
162
162
|
"[:alpha:]": ["\\p{L}\\p{Nl}", !0],
|
|
@@ -226,10 +226,10 @@ var posixClasses = {
|
|
|
226
226
|
return [ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs, uflag, endPos - pos, !0];
|
|
227
227
|
};
|
|
228
228
|
|
|
229
|
-
//
|
|
229
|
+
// ../../node_modules/glob/node_modules/minimatch/dist/esm/unescape.js
|
|
230
230
|
var unescape = (s, { windowsPathsNoEscape = !1 } = {}) => windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
231
231
|
|
|
232
|
-
//
|
|
232
|
+
// ../../node_modules/glob/node_modules/minimatch/dist/esm/ast.js
|
|
233
233
|
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), isExtglobType = (c) => types.has(c), startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))", startNoDot = "(?!\\.)", addPatternStart = /* @__PURE__ */ new Set(["[", "."]), justDots = /* @__PURE__ */ new Set(["..", "."]), reSpecials = new Set("().*{}+?[]^$\\!"), regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), qmark = "[^/]", star = qmark + "*?", starNoEmpty = qmark + "+?", AST = class _AST {
|
|
234
234
|
type;
|
|
235
235
|
#root;
|
|
@@ -565,10 +565,10 @@ var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), isExtglobType =
|
|
|
565
565
|
}
|
|
566
566
|
};
|
|
567
567
|
|
|
568
|
-
//
|
|
568
|
+
// ../../node_modules/glob/node_modules/minimatch/dist/esm/escape.js
|
|
569
569
|
var escape = (s, { windowsPathsNoEscape = !1 } = {}) => windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
570
570
|
|
|
571
|
-
//
|
|
571
|
+
// ../../node_modules/glob/node_modules/minimatch/dist/esm/index.js
|
|
572
572
|
var minimatch = (p, pattern, options = {}) => (assertValidPattern(pattern), !options.nocomment && pattern.charAt(0) === "#" ? !1 : new Minimatch(pattern, options).match(p)), starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/, starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2), starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2), starDotExtTestNocase = (ext2) => (ext2 = ext2.toLowerCase(), (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2)), starDotExtTestNocaseDot = (ext2) => (ext2 = ext2.toLowerCase(), (f) => f.toLowerCase().endsWith(ext2)), starDotStarRE = /^\*+\.\*+$/, starDotStarTest = (f) => !f.startsWith(".") && f.includes("."), starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes("."), dotStarRE = /^\.\*+$/, dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith("."), starRE = /^\*+$/, starTest = (f) => f.length !== 0 && !f.startsWith("."), starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..", qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/, qmarksTestNocase = ([$0, ext2 = ""]) => {
|
|
573
573
|
let noext = qmarksTestNoExt([$0]);
|
|
574
574
|
return ext2 ? (ext2 = ext2.toLowerCase(), (f) => noext(f) && f.toLowerCase().endsWith(ext2)) : noext;
|
|
@@ -990,10 +990,10 @@ minimatch.Minimatch = Minimatch;
|
|
|
990
990
|
minimatch.escape = escape;
|
|
991
991
|
minimatch.unescape = unescape;
|
|
992
992
|
|
|
993
|
-
//
|
|
993
|
+
// ../../node_modules/glob/dist/esm/glob.js
|
|
994
994
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
995
995
|
|
|
996
|
-
//
|
|
996
|
+
// ../../node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js
|
|
997
997
|
var perf = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, warned = /* @__PURE__ */ new Set(), PROCESS = typeof process == "object" && process ? process : {}, emitWarning = (msg, type, code, fn) => {
|
|
998
998
|
typeof PROCESS.emitWarning == "function" ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`);
|
|
999
999
|
}, AC = globalThis.AbortController, AS = globalThis.AbortSignal;
|
|
@@ -1053,13 +1053,14 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1053
1053
|
return this.heap[--this.length];
|
|
1054
1054
|
}
|
|
1055
1055
|
}, LRUCache = class _LRUCache {
|
|
1056
|
-
// options
|
|
1056
|
+
// properties coming in from the options of these, only max and maxSize
|
|
1057
|
+
// really *need* to be protected. The rest can be modified, as they just
|
|
1058
|
+
// set defaults for various methods.
|
|
1057
1059
|
#max;
|
|
1058
1060
|
#maxSize;
|
|
1059
1061
|
#dispose;
|
|
1060
1062
|
#disposeAfter;
|
|
1061
1063
|
#fetchMethod;
|
|
1062
|
-
#memoMethod;
|
|
1063
1064
|
/**
|
|
1064
1065
|
* {@link LRUCache.OptionsBase.ttl}
|
|
1065
1066
|
*/
|
|
@@ -1205,9 +1206,6 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1205
1206
|
get fetchMethod() {
|
|
1206
1207
|
return this.#fetchMethod;
|
|
1207
1208
|
}
|
|
1208
|
-
get memoMethod() {
|
|
1209
|
-
return this.#memoMethod;
|
|
1210
|
-
}
|
|
1211
1209
|
/**
|
|
1212
1210
|
* {@link LRUCache.OptionsBase.dispose} (read-only)
|
|
1213
1211
|
*/
|
|
@@ -1221,7 +1219,7 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1221
1219
|
return this.#disposeAfter;
|
|
1222
1220
|
}
|
|
1223
1221
|
constructor(options) {
|
|
1224
|
-
let { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod,
|
|
1222
|
+
let { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
|
|
1225
1223
|
if (max !== 0 && !isPosInt(max))
|
|
1226
1224
|
throw new TypeError("max option must be a nonnegative integer");
|
|
1227
1225
|
let UintArray = max ? getUintArray(max) : Array;
|
|
@@ -1233,9 +1231,7 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1233
1231
|
if (typeof this.sizeCalculation != "function")
|
|
1234
1232
|
throw new TypeError("sizeCalculation set to non-function");
|
|
1235
1233
|
}
|
|
1236
|
-
if (
|
|
1237
|
-
throw new TypeError("memoMethod must be a function if defined");
|
|
1238
|
-
if (this.#memoMethod = memoMethod, fetchMethod !== void 0 && typeof fetchMethod != "function")
|
|
1234
|
+
if (fetchMethod !== void 0 && typeof fetchMethod != "function")
|
|
1239
1235
|
throw new TypeError("fetchMethod must be a function if specified");
|
|
1240
1236
|
if (this.#fetchMethod = fetchMethod, this.#hasFetchMethod = !!fetchMethod, this.#keyMap = /* @__PURE__ */ new Map(), this.#keyList = new Array(max).fill(void 0), this.#valList = new Array(max).fill(void 0), this.#next = new UintArray(max), this.#prev = new UintArray(max), this.#head = 0, this.#tail = 0, this.#free = Stack.create(max), this.#size = 0, this.#calculatedSize = 0, typeof dispose == "function" && (this.#dispose = dispose), typeof disposeAfter == "function" ? (this.#disposeAfter = disposeAfter, this.#disposed = []) : (this.#disposeAfter = void 0, this.#disposed = void 0), this.#hasDispose = !!this.#dispose, this.#hasDisposeAfter = !!this.#disposeAfter, this.noDisposeOnSet = !!noDisposeOnSet, this.noUpdateTTL = !!noUpdateTTL, this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection, this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection, this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort, this.ignoreFetchAbort = !!ignoreFetchAbort, this.maxEntrySize !== 0) {
|
|
1241
1237
|
if (this.#maxSize !== 0 && !isPosInt(this.#maxSize))
|
|
@@ -1257,8 +1253,7 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1257
1253
|
}
|
|
1258
1254
|
}
|
|
1259
1255
|
/**
|
|
1260
|
-
* Return the
|
|
1261
|
-
* returns `0`. Returns `Infinity` if item is in cache without a defined TTL.
|
|
1256
|
+
* Return the remaining TTL time for a given entry key
|
|
1262
1257
|
*/
|
|
1263
1258
|
getRemainingTTL(key) {
|
|
1264
1259
|
return this.#keyMap.has(key) ? 1 / 0 : 0;
|
|
@@ -1268,7 +1263,7 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1268
1263
|
this.#ttls = ttls, this.#starts = starts, this.#setItemTTL = (index, ttl, start = perf.now()) => {
|
|
1269
1264
|
if (starts[index] = ttl !== 0 ? start : 0, ttls[index] = ttl, ttl !== 0 && this.ttlAutopurge) {
|
|
1270
1265
|
let t = setTimeout(() => {
|
|
1271
|
-
this.#isStale(index) && this
|
|
1266
|
+
this.#isStale(index) && this.delete(this.#keyList[index]);
|
|
1272
1267
|
}, ttl + 1);
|
|
1273
1268
|
t.unref && t.unref();
|
|
1274
1269
|
}
|
|
@@ -1429,14 +1424,13 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1429
1424
|
return this.entries();
|
|
1430
1425
|
}
|
|
1431
1426
|
/**
|
|
1432
|
-
* A String value that is used in the creation of the default string
|
|
1433
|
-
*
|
|
1434
|
-
* `Object.prototype.toString`.
|
|
1427
|
+
* A String value that is used in the creation of the default string description of an object.
|
|
1428
|
+
* Called by the built-in method Object.prototype.toString.
|
|
1435
1429
|
*/
|
|
1436
1430
|
[Symbol.toStringTag] = "LRUCache";
|
|
1437
1431
|
/**
|
|
1438
1432
|
* Find a value for which the supplied fn method returns a truthy value,
|
|
1439
|
-
* similar to
|
|
1433
|
+
* similar to Array.find(). fn is called as fn(value, key, cache).
|
|
1440
1434
|
*/
|
|
1441
1435
|
find(fn, getOptions = {}) {
|
|
1442
1436
|
for (let i of this.#indexes()) {
|
|
@@ -1446,15 +1440,10 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1446
1440
|
}
|
|
1447
1441
|
}
|
|
1448
1442
|
/**
|
|
1449
|
-
* Call the supplied function on each item in the cache, in order from
|
|
1450
|
-
* recently used to least recently used.
|
|
1451
|
-
*
|
|
1452
|
-
*
|
|
1453
|
-
*
|
|
1454
|
-
* If `thisp` is provided, function will be called in the `this`-context of
|
|
1455
|
-
* the provided object, or the cache if no `thisp` object is provided.
|
|
1456
|
-
*
|
|
1457
|
-
* Does not update age or recenty of use, or iterate over stale values.
|
|
1443
|
+
* Call the supplied function on each item in the cache, in order from
|
|
1444
|
+
* most recently used to least recently used. fn is called as
|
|
1445
|
+
* fn(value, key, cache). Does not update age or recenty of use.
|
|
1446
|
+
* Does not iterate over stale values.
|
|
1458
1447
|
*/
|
|
1459
1448
|
forEach(fn, thisp = this) {
|
|
1460
1449
|
for (let i of this.#indexes()) {
|
|
@@ -1479,20 +1468,14 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1479
1468
|
purgeStale() {
|
|
1480
1469
|
let deleted = !1;
|
|
1481
1470
|
for (let i of this.#rindexes({ allowStale: !0 }))
|
|
1482
|
-
this.#isStale(i) && (this
|
|
1471
|
+
this.#isStale(i) && (this.delete(this.#keyList[i]), deleted = !0);
|
|
1483
1472
|
return deleted;
|
|
1484
1473
|
}
|
|
1485
1474
|
/**
|
|
1486
1475
|
* Get the extended info about a given entry, to get its value, size, and
|
|
1487
|
-
* TTL info simultaneously.
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1490
|
-
* serialization, the `start` value is always the current timestamp, and the
|
|
1491
|
-
* `ttl` is a calculated remaining time to live (negative if expired).
|
|
1492
|
-
*
|
|
1493
|
-
* Always returns stale values, if their info is found in the cache, so be
|
|
1494
|
-
* sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl})
|
|
1495
|
-
* if relevant.
|
|
1476
|
+
* TTL info simultaneously. Like {@link LRUCache#dump}, but just for a
|
|
1477
|
+
* single key. Always returns stale values, if their info is found in the
|
|
1478
|
+
* cache, so be sure to check for expired TTLs if relevant.
|
|
1496
1479
|
*/
|
|
1497
1480
|
info(key) {
|
|
1498
1481
|
let i = this.#keyMap.get(key);
|
|
@@ -1513,16 +1496,7 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1513
1496
|
}
|
|
1514
1497
|
/**
|
|
1515
1498
|
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
|
1516
|
-
* passed to
|
|
1517
|
-
*
|
|
1518
|
-
* The `start` fields are calculated relative to a portable `Date.now()`
|
|
1519
|
-
* timestamp, even if `performance.now()` is available.
|
|
1520
|
-
*
|
|
1521
|
-
* Stale entries are always included in the `dump`, even if
|
|
1522
|
-
* {@link LRUCache.OptionsBase.allowStale} is false.
|
|
1523
|
-
*
|
|
1524
|
-
* Note: this returns an actual array, not a generator, so it can be more
|
|
1525
|
-
* easily passed around.
|
|
1499
|
+
* passed to cache.load()
|
|
1526
1500
|
*/
|
|
1527
1501
|
dump() {
|
|
1528
1502
|
let arr = [];
|
|
@@ -1542,12 +1516,8 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1542
1516
|
}
|
|
1543
1517
|
/**
|
|
1544
1518
|
* Reset the cache and load in the items in entries in the order listed.
|
|
1545
|
-
*
|
|
1546
|
-
*
|
|
1547
|
-
* not used in both caches.
|
|
1548
|
-
*
|
|
1549
|
-
* The `start` fields are assumed to be calculated relative to a portable
|
|
1550
|
-
* `Date.now()` timestamp, even if `performance.now()` is available.
|
|
1519
|
+
* Note that the shape of the resulting cache may be different if the
|
|
1520
|
+
* same options are not used in both caches.
|
|
1551
1521
|
*/
|
|
1552
1522
|
load(arr) {
|
|
1553
1523
|
this.clear();
|
|
@@ -1564,37 +1534,13 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1564
1534
|
*
|
|
1565
1535
|
* Note: if `undefined` is specified as a value, this is an alias for
|
|
1566
1536
|
* {@link LRUCache#delete}
|
|
1567
|
-
*
|
|
1568
|
-
* Fields on the {@link LRUCache.SetOptions} options param will override
|
|
1569
|
-
* their corresponding values in the constructor options for the scope
|
|
1570
|
-
* of this single `set()` operation.
|
|
1571
|
-
*
|
|
1572
|
-
* If `start` is provided, then that will set the effective start
|
|
1573
|
-
* time for the TTL calculation. Note that this must be a previous
|
|
1574
|
-
* value of `performance.now()` if supported, or a previous value of
|
|
1575
|
-
* `Date.now()` if not.
|
|
1576
|
-
*
|
|
1577
|
-
* Options object may also include `size`, which will prevent
|
|
1578
|
-
* calling the `sizeCalculation` function and just use the specified
|
|
1579
|
-
* number if it is a positive integer, and `noDisposeOnSet` which
|
|
1580
|
-
* will prevent calling a `dispose` function in the case of
|
|
1581
|
-
* overwrites.
|
|
1582
|
-
*
|
|
1583
|
-
* If the `size` (or return value of `sizeCalculation`) for a given
|
|
1584
|
-
* entry is greater than `maxEntrySize`, then the item will not be
|
|
1585
|
-
* added to the cache.
|
|
1586
|
-
*
|
|
1587
|
-
* Will update the recency of the entry.
|
|
1588
|
-
*
|
|
1589
|
-
* If the value is `undefined`, then this is an alias for
|
|
1590
|
-
* `cache.delete(key)`. `undefined` is never stored in the cache.
|
|
1591
1537
|
*/
|
|
1592
1538
|
set(k, v, setOptions = {}) {
|
|
1593
1539
|
if (v === void 0)
|
|
1594
1540
|
return this.delete(k), this;
|
|
1595
1541
|
let { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions, { noUpdateTTL = this.noUpdateTTL } = setOptions, size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
|
|
1596
1542
|
if (this.maxEntrySize && size > this.maxEntrySize)
|
|
1597
|
-
return status && (status.set = "miss", status.maxEntrySizeExceeded = !0), this
|
|
1543
|
+
return status && (status.set = "miss", status.maxEntrySizeExceeded = !0), this.delete(k), this;
|
|
1598
1544
|
let index = this.#size === 0 ? void 0 : this.#keyMap.get(k);
|
|
1599
1545
|
if (index === void 0)
|
|
1600
1546
|
index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(!1) : this.#size, this.#keyList[index] = k, this.#valList[index] = v, this.#keyMap.set(k, index), this.#next[this.#tail] = index, this.#prev[index] = this.#tail, this.#tail = index, this.#size++, this.#addItemSize(index, size, status), status && (status.set = "add"), noUpdateTTL = !1;
|
|
@@ -1652,14 +1598,6 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1652
1598
|
* Will return false if the item is stale, even though it is technically
|
|
1653
1599
|
* in the cache.
|
|
1654
1600
|
*
|
|
1655
|
-
* Check if a key is in the cache, without updating the recency of
|
|
1656
|
-
* use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set
|
|
1657
|
-
* to `true` in either the options or the constructor.
|
|
1658
|
-
*
|
|
1659
|
-
* Will return `false` if the item is stale, even though it is technically in
|
|
1660
|
-
* the cache. The difference can be determined (if it matters) by using a
|
|
1661
|
-
* `status` argument, and inspecting the `has` field.
|
|
1662
|
-
*
|
|
1663
1601
|
* Will not update item age unless
|
|
1664
1602
|
* {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
|
|
1665
1603
|
*/
|
|
@@ -1706,10 +1644,10 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1706
1644
|
if (options.status && (aborted && !updateCache ? (options.status.fetchAborted = !0, options.status.fetchError = ac.signal.reason, ignoreAbort && (options.status.fetchAbortIgnored = !0)) : options.status.fetchResolved = !0), aborted && !ignoreAbort && !updateCache)
|
|
1707
1645
|
return fetchFail(ac.signal.reason);
|
|
1708
1646
|
let bf2 = p;
|
|
1709
|
-
return this.#valList[index] === p && (v2 === void 0 ? bf2.__staleWhileFetching ? this.#valList[index] = bf2.__staleWhileFetching : this
|
|
1647
|
+
return this.#valList[index] === p && (v2 === void 0 ? bf2.__staleWhileFetching ? this.#valList[index] = bf2.__staleWhileFetching : this.delete(k) : (options.status && (options.status.fetchUpdated = !0), this.set(k, v2, fetchOpts.options))), v2;
|
|
1710
1648
|
}, eb = (er) => (options.status && (options.status.fetchRejected = !0, options.status.fetchError = er), fetchFail(er)), fetchFail = (er) => {
|
|
1711
1649
|
let { aborted } = ac.signal, allowStaleAborted = aborted && options.allowStaleOnFetchAbort, allowStale = allowStaleAborted || options.allowStaleOnFetchRejection, noDelete = allowStale || options.noDeleteOnFetchRejection, bf2 = p;
|
|
1712
|
-
if (this.#valList[index] === p && (!noDelete || bf2.__staleWhileFetching === void 0 ? this
|
|
1650
|
+
if (this.#valList[index] === p && (!noDelete || bf2.__staleWhileFetching === void 0 ? this.delete(k) : allowStaleAborted || (this.#valList[index] = bf2.__staleWhileFetching)), allowStale)
|
|
1713
1651
|
return options.status && bf2.__staleWhileFetching !== void 0 && (options.status.returnedStale = !0), bf2.__staleWhileFetching;
|
|
1714
1652
|
if (bf2.__returned === bf2)
|
|
1715
1653
|
throw er;
|
|
@@ -1795,25 +1733,6 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1795
1733
|
return status && (status.fetch = isStale ? "stale" : "refresh", staleVal && isStale && (status.returnedStale = !0)), staleVal ? p.__staleWhileFetching : p.__returned = p;
|
|
1796
1734
|
}
|
|
1797
1735
|
}
|
|
1798
|
-
async forceFetch(k, fetchOptions = {}) {
|
|
1799
|
-
let v = await this.fetch(k, fetchOptions);
|
|
1800
|
-
if (v === void 0)
|
|
1801
|
-
throw new Error("fetch() returned undefined");
|
|
1802
|
-
return v;
|
|
1803
|
-
}
|
|
1804
|
-
memo(k, memoOptions = {}) {
|
|
1805
|
-
let memoMethod = this.#memoMethod;
|
|
1806
|
-
if (!memoMethod)
|
|
1807
|
-
throw new Error("no memoMethod provided to constructor");
|
|
1808
|
-
let { context, forceRefresh, ...options } = memoOptions, v = this.get(k, options);
|
|
1809
|
-
if (!forceRefresh && v !== void 0)
|
|
1810
|
-
return v;
|
|
1811
|
-
let vv = memoMethod(k, v, {
|
|
1812
|
-
options,
|
|
1813
|
-
context
|
|
1814
|
-
});
|
|
1815
|
-
return this.set(k, vv, options), vv;
|
|
1816
|
-
}
|
|
1817
1736
|
/**
|
|
1818
1737
|
* Return a value from the cache. Will update the recency of the cache
|
|
1819
1738
|
* entry found.
|
|
@@ -1824,7 +1743,7 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1824
1743
|
let { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions, index = this.#keyMap.get(k);
|
|
1825
1744
|
if (index !== void 0) {
|
|
1826
1745
|
let value = this.#valList[index], fetching = this.#isBackgroundFetch(value);
|
|
1827
|
-
return status && this.#statusTTL(status, index), this.#isStale(index) ? (status && (status.get = "stale"), fetching ? (status && allowStale && value.__staleWhileFetching !== void 0 && (status.returnedStale = !0), allowStale ? value.__staleWhileFetching : void 0) : (noDeleteOnStaleGet || this
|
|
1746
|
+
return status && this.#statusTTL(status, index), this.#isStale(index) ? (status && (status.get = "stale"), fetching ? (status && allowStale && value.__staleWhileFetching !== void 0 && (status.returnedStale = !0), allowStale ? value.__staleWhileFetching : void 0) : (noDeleteOnStaleGet || this.delete(k), status && allowStale && (status.returnedStale = !0), allowStale ? value : void 0)) : (status && (status.get = "hit"), fetching ? value.__staleWhileFetching : (this.#moveToTail(index), updateAgeOnGet && this.#updateItemAge(index), value));
|
|
1828
1747
|
} else status && (status.get = "miss");
|
|
1829
1748
|
}
|
|
1830
1749
|
#connect(p, n) {
|
|
@@ -1835,23 +1754,19 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1835
1754
|
}
|
|
1836
1755
|
/**
|
|
1837
1756
|
* Deletes a key out of the cache.
|
|
1838
|
-
*
|
|
1839
1757
|
* Returns true if the key was deleted, false otherwise.
|
|
1840
1758
|
*/
|
|
1841
1759
|
delete(k) {
|
|
1842
|
-
return this.#delete(k, "delete");
|
|
1843
|
-
}
|
|
1844
|
-
#delete(k, reason) {
|
|
1845
1760
|
let deleted = !1;
|
|
1846
1761
|
if (this.#size !== 0) {
|
|
1847
1762
|
let index = this.#keyMap.get(k);
|
|
1848
1763
|
if (index !== void 0)
|
|
1849
1764
|
if (deleted = !0, this.#size === 1)
|
|
1850
|
-
this
|
|
1765
|
+
this.clear();
|
|
1851
1766
|
else {
|
|
1852
1767
|
this.#removeItemSize(index);
|
|
1853
1768
|
let v = this.#valList[index];
|
|
1854
|
-
if (this.#isBackgroundFetch(v) ? v.__abortController.abort(new Error("deleted")) : (this.#hasDispose || this.#hasDisposeAfter) && (this.#hasDispose && this.#dispose?.(v, k,
|
|
1769
|
+
if (this.#isBackgroundFetch(v) ? v.__abortController.abort(new Error("deleted")) : (this.#hasDispose || this.#hasDisposeAfter) && (this.#hasDispose && this.#dispose?.(v, k, "delete"), this.#hasDisposeAfter && this.#disposed?.push([v, k, "delete"])), this.#keyMap.delete(k), this.#keyList[index] = void 0, this.#valList[index] = void 0, index === this.#tail)
|
|
1855
1770
|
this.#tail = this.#prev[index];
|
|
1856
1771
|
else if (index === this.#head)
|
|
1857
1772
|
this.#head = this.#next[index];
|
|
@@ -1875,16 +1790,13 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1875
1790
|
* Clear the cache entirely, throwing away all values.
|
|
1876
1791
|
*/
|
|
1877
1792
|
clear() {
|
|
1878
|
-
return this.#clear("delete");
|
|
1879
|
-
}
|
|
1880
|
-
#clear(reason) {
|
|
1881
1793
|
for (let index of this.#rindexes({ allowStale: !0 })) {
|
|
1882
1794
|
let v = this.#valList[index];
|
|
1883
1795
|
if (this.#isBackgroundFetch(v))
|
|
1884
1796
|
v.__abortController.abort(new Error("deleted"));
|
|
1885
1797
|
else {
|
|
1886
1798
|
let k = this.#keyList[index];
|
|
1887
|
-
this.#hasDispose && this.#dispose?.(v, k,
|
|
1799
|
+
this.#hasDispose && this.#dispose?.(v, k, "delete"), this.#hasDisposeAfter && this.#disposed?.push([v, k, "delete"]);
|
|
1888
1800
|
}
|
|
1889
1801
|
}
|
|
1890
1802
|
if (this.#keyMap.clear(), this.#valList.fill(void 0), this.#keyList.fill(void 0), this.#ttls && this.#starts && (this.#ttls.fill(0), this.#starts.fill(0)), this.#sizes && this.#sizes.fill(0), this.#head = 0, this.#tail = 0, this.#free.length = 0, this.#calculatedSize = 0, this.#size = 0, this.#hasDisposeAfter && this.#disposed) {
|
|
@@ -1895,14 +1807,14 @@ var shouldWarn = (code) => !warned.has(code), TYPE = Symbol("type"), isPosInt =
|
|
|
1895
1807
|
}
|
|
1896
1808
|
};
|
|
1897
1809
|
|
|
1898
|
-
//
|
|
1810
|
+
// ../../node_modules/path-scurry/dist/esm/index.js
|
|
1899
1811
|
import { posix, win32 } from "node:path";
|
|
1900
1812
|
import { fileURLToPath } from "node:url";
|
|
1901
1813
|
import { lstatSync, readdir as readdirCB, readdirSync, readlinkSync, realpathSync as rps } from "fs";
|
|
1902
1814
|
import * as actualFS from "node:fs";
|
|
1903
1815
|
import { lstat, readdir, readlink, realpath } from "node:fs/promises";
|
|
1904
1816
|
|
|
1905
|
-
//
|
|
1817
|
+
// ../../node_modules/path-scurry/node_modules/minipass/dist/esm/index.js
|
|
1906
1818
|
import { EventEmitter } from "node:events";
|
|
1907
1819
|
import Stream from "node:stream";
|
|
1908
1820
|
import { StringDecoder } from "node:string_decoder";
|
|
@@ -2461,7 +2373,7 @@ s.pipe !== Stream.Writable.prototype.pipe, isWritable = (s) => !!s && typeof s =
|
|
|
2461
2373
|
}
|
|
2462
2374
|
};
|
|
2463
2375
|
|
|
2464
|
-
//
|
|
2376
|
+
// ../../node_modules/path-scurry/dist/esm/index.js
|
|
2465
2377
|
var realpathSync = rps.native, defaultFS = {
|
|
2466
2378
|
lstatSync,
|
|
2467
2379
|
readdir: readdirCB,
|
|
@@ -3755,7 +3667,7 @@ var realpathSync = rps.native, defaultFS = {
|
|
|
3755
3667
|
}
|
|
3756
3668
|
}, Path = process.platform === "win32" ? PathWin32 : PathPosix, PathScurry = process.platform === "win32" ? PathScurryWin32 : process.platform === "darwin" ? PathScurryDarwin : PathScurryPosix;
|
|
3757
3669
|
|
|
3758
|
-
//
|
|
3670
|
+
// ../../node_modules/glob/dist/esm/pattern.js
|
|
3759
3671
|
var isPatternList = (pl) => pl.length >= 1, isGlobList = (gl) => gl.length >= 1, Pattern = class _Pattern {
|
|
3760
3672
|
#patternList;
|
|
3761
3673
|
#globList;
|
|
@@ -3884,7 +3796,566 @@ var isPatternList = (pl) => pl.length >= 1, isGlobList = (gl) => gl.length >= 1,
|
|
|
3884
3796
|
}
|
|
3885
3797
|
};
|
|
3886
3798
|
|
|
3887
|
-
//
|
|
3799
|
+
// ../../node_modules/glob/node_modules/minipass/dist/esm/index.js
|
|
3800
|
+
import { EventEmitter as EventEmitter2 } from "node:events";
|
|
3801
|
+
import Stream2 from "node:stream";
|
|
3802
|
+
import { StringDecoder as StringDecoder2 } from "node:string_decoder";
|
|
3803
|
+
var proc2 = typeof process == "object" && process ? process : {
|
|
3804
|
+
stdout: null,
|
|
3805
|
+
stderr: null
|
|
3806
|
+
}, isStream2 = (s) => !!s && typeof s == "object" && (s instanceof Minipass2 || s instanceof Stream2 || isReadable2(s) || isWritable2(s)), isReadable2 = (s) => !!s && typeof s == "object" && s instanceof EventEmitter2 && typeof s.pipe == "function" && // node core Writable streams have a pipe() method, but it throws
|
|
3807
|
+
s.pipe !== Stream2.Writable.prototype.pipe, isWritable2 = (s) => !!s && typeof s == "object" && s instanceof EventEmitter2 && typeof s.write == "function" && typeof s.end == "function", EOF2 = Symbol("EOF"), MAYBE_EMIT_END2 = Symbol("maybeEmitEnd"), EMITTED_END2 = Symbol("emittedEnd"), EMITTING_END2 = Symbol("emittingEnd"), EMITTED_ERROR2 = Symbol("emittedError"), CLOSED2 = Symbol("closed"), READ2 = Symbol("read"), FLUSH2 = Symbol("flush"), FLUSHCHUNK2 = Symbol("flushChunk"), ENCODING2 = Symbol("encoding"), DECODER2 = Symbol("decoder"), FLOWING2 = Symbol("flowing"), PAUSED2 = Symbol("paused"), RESUME2 = Symbol("resume"), BUFFER2 = Symbol("buffer"), PIPES2 = Symbol("pipes"), BUFFERLENGTH2 = Symbol("bufferLength"), BUFFERPUSH2 = Symbol("bufferPush"), BUFFERSHIFT2 = Symbol("bufferShift"), OBJECTMODE2 = Symbol("objectMode"), DESTROYED2 = Symbol("destroyed"), ERROR2 = Symbol("error"), EMITDATA2 = Symbol("emitData"), EMITEND3 = Symbol("emitEnd"), EMITEND22 = Symbol("emitEnd2"), ASYNC2 = Symbol("async"), ABORT2 = Symbol("abort"), ABORTED2 = Symbol("aborted"), SIGNAL2 = Symbol("signal"), DATALISTENERS2 = Symbol("dataListeners"), DISCARDED2 = Symbol("discarded"), defer2 = (fn) => Promise.resolve().then(fn), nodefer2 = (fn) => fn(), isEndish2 = (ev) => ev === "end" || ev === "finish" || ev === "prefinish", isArrayBufferLike2 = (b) => b instanceof ArrayBuffer || !!b && typeof b == "object" && b.constructor && b.constructor.name === "ArrayBuffer" && b.byteLength >= 0, isArrayBufferView2 = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b), Pipe2 = class {
|
|
3808
|
+
src;
|
|
3809
|
+
dest;
|
|
3810
|
+
opts;
|
|
3811
|
+
ondrain;
|
|
3812
|
+
constructor(src, dest, opts) {
|
|
3813
|
+
this.src = src, this.dest = dest, this.opts = opts, this.ondrain = () => src[RESUME2](), this.dest.on("drain", this.ondrain);
|
|
3814
|
+
}
|
|
3815
|
+
unpipe() {
|
|
3816
|
+
this.dest.removeListener("drain", this.ondrain);
|
|
3817
|
+
}
|
|
3818
|
+
// only here for the prototype
|
|
3819
|
+
/* c8 ignore start */
|
|
3820
|
+
proxyErrors(_er) {
|
|
3821
|
+
}
|
|
3822
|
+
/* c8 ignore stop */
|
|
3823
|
+
end() {
|
|
3824
|
+
this.unpipe(), this.opts.end && this.dest.end();
|
|
3825
|
+
}
|
|
3826
|
+
}, PipeProxyErrors2 = class extends Pipe2 {
|
|
3827
|
+
unpipe() {
|
|
3828
|
+
this.src.removeListener("error", this.proxyErrors), super.unpipe();
|
|
3829
|
+
}
|
|
3830
|
+
constructor(src, dest, opts) {
|
|
3831
|
+
super(src, dest, opts), this.proxyErrors = (er) => dest.emit("error", er), src.on("error", this.proxyErrors);
|
|
3832
|
+
}
|
|
3833
|
+
}, isObjectModeOptions2 = (o) => !!o.objectMode, isEncodingOptions2 = (o) => !o.objectMode && !!o.encoding && o.encoding !== "buffer", Minipass2 = class extends EventEmitter2 {
|
|
3834
|
+
[FLOWING2] = !1;
|
|
3835
|
+
[PAUSED2] = !1;
|
|
3836
|
+
[PIPES2] = [];
|
|
3837
|
+
[BUFFER2] = [];
|
|
3838
|
+
[OBJECTMODE2];
|
|
3839
|
+
[ENCODING2];
|
|
3840
|
+
[ASYNC2];
|
|
3841
|
+
[DECODER2];
|
|
3842
|
+
[EOF2] = !1;
|
|
3843
|
+
[EMITTED_END2] = !1;
|
|
3844
|
+
[EMITTING_END2] = !1;
|
|
3845
|
+
[CLOSED2] = !1;
|
|
3846
|
+
[EMITTED_ERROR2] = null;
|
|
3847
|
+
[BUFFERLENGTH2] = 0;
|
|
3848
|
+
[DESTROYED2] = !1;
|
|
3849
|
+
[SIGNAL2];
|
|
3850
|
+
[ABORTED2] = !1;
|
|
3851
|
+
[DATALISTENERS2] = 0;
|
|
3852
|
+
[DISCARDED2] = !1;
|
|
3853
|
+
/**
|
|
3854
|
+
* true if the stream can be written
|
|
3855
|
+
*/
|
|
3856
|
+
writable = !0;
|
|
3857
|
+
/**
|
|
3858
|
+
* true if the stream can be read
|
|
3859
|
+
*/
|
|
3860
|
+
readable = !0;
|
|
3861
|
+
/**
|
|
3862
|
+
* If `RType` is Buffer, then options do not need to be provided.
|
|
3863
|
+
* Otherwise, an options object must be provided to specify either
|
|
3864
|
+
* {@link Minipass.SharedOptions.objectMode} or
|
|
3865
|
+
* {@link Minipass.SharedOptions.encoding}, as appropriate.
|
|
3866
|
+
*/
|
|
3867
|
+
constructor(...args) {
|
|
3868
|
+
let options = args[0] || {};
|
|
3869
|
+
if (super(), options.objectMode && typeof options.encoding == "string")
|
|
3870
|
+
throw new TypeError("Encoding and objectMode may not be used together");
|
|
3871
|
+
isObjectModeOptions2(options) ? (this[OBJECTMODE2] = !0, this[ENCODING2] = null) : isEncodingOptions2(options) ? (this[ENCODING2] = options.encoding, this[OBJECTMODE2] = !1) : (this[OBJECTMODE2] = !1, this[ENCODING2] = null), this[ASYNC2] = !!options.async, this[DECODER2] = this[ENCODING2] ? new StringDecoder2(this[ENCODING2]) : null, options && options.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[BUFFER2] }), options && options.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[PIPES2] });
|
|
3872
|
+
let { signal } = options;
|
|
3873
|
+
signal && (this[SIGNAL2] = signal, signal.aborted ? this[ABORT2]() : signal.addEventListener("abort", () => this[ABORT2]()));
|
|
3874
|
+
}
|
|
3875
|
+
/**
|
|
3876
|
+
* The amount of data stored in the buffer waiting to be read.
|
|
3877
|
+
*
|
|
3878
|
+
* For Buffer strings, this will be the total byte length.
|
|
3879
|
+
* For string encoding streams, this will be the string character length,
|
|
3880
|
+
* according to JavaScript's `string.length` logic.
|
|
3881
|
+
* For objectMode streams, this is a count of the items waiting to be
|
|
3882
|
+
* emitted.
|
|
3883
|
+
*/
|
|
3884
|
+
get bufferLength() {
|
|
3885
|
+
return this[BUFFERLENGTH2];
|
|
3886
|
+
}
|
|
3887
|
+
/**
|
|
3888
|
+
* The `BufferEncoding` currently in use, or `null`
|
|
3889
|
+
*/
|
|
3890
|
+
get encoding() {
|
|
3891
|
+
return this[ENCODING2];
|
|
3892
|
+
}
|
|
3893
|
+
/**
|
|
3894
|
+
* @deprecated - This is a read only property
|
|
3895
|
+
*/
|
|
3896
|
+
set encoding(_enc) {
|
|
3897
|
+
throw new Error("Encoding must be set at instantiation time");
|
|
3898
|
+
}
|
|
3899
|
+
/**
|
|
3900
|
+
* @deprecated - Encoding may only be set at instantiation time
|
|
3901
|
+
*/
|
|
3902
|
+
setEncoding(_enc) {
|
|
3903
|
+
throw new Error("Encoding must be set at instantiation time");
|
|
3904
|
+
}
|
|
3905
|
+
/**
|
|
3906
|
+
* True if this is an objectMode stream
|
|
3907
|
+
*/
|
|
3908
|
+
get objectMode() {
|
|
3909
|
+
return this[OBJECTMODE2];
|
|
3910
|
+
}
|
|
3911
|
+
/**
|
|
3912
|
+
* @deprecated - This is a read-only property
|
|
3913
|
+
*/
|
|
3914
|
+
set objectMode(_om) {
|
|
3915
|
+
throw new Error("objectMode must be set at instantiation time");
|
|
3916
|
+
}
|
|
3917
|
+
/**
|
|
3918
|
+
* true if this is an async stream
|
|
3919
|
+
*/
|
|
3920
|
+
get async() {
|
|
3921
|
+
return this[ASYNC2];
|
|
3922
|
+
}
|
|
3923
|
+
/**
|
|
3924
|
+
* Set to true to make this stream async.
|
|
3925
|
+
*
|
|
3926
|
+
* Once set, it cannot be unset, as this would potentially cause incorrect
|
|
3927
|
+
* behavior. Ie, a sync stream can be made async, but an async stream
|
|
3928
|
+
* cannot be safely made sync.
|
|
3929
|
+
*/
|
|
3930
|
+
set async(a) {
|
|
3931
|
+
this[ASYNC2] = this[ASYNC2] || !!a;
|
|
3932
|
+
}
|
|
3933
|
+
// drop everything and get out of the flow completely
|
|
3934
|
+
[ABORT2]() {
|
|
3935
|
+
this[ABORTED2] = !0, this.emit("abort", this[SIGNAL2]?.reason), this.destroy(this[SIGNAL2]?.reason);
|
|
3936
|
+
}
|
|
3937
|
+
/**
|
|
3938
|
+
* True if the stream has been aborted.
|
|
3939
|
+
*/
|
|
3940
|
+
get aborted() {
|
|
3941
|
+
return this[ABORTED2];
|
|
3942
|
+
}
|
|
3943
|
+
/**
|
|
3944
|
+
* No-op setter. Stream aborted status is set via the AbortSignal provided
|
|
3945
|
+
* in the constructor options.
|
|
3946
|
+
*/
|
|
3947
|
+
set aborted(_) {
|
|
3948
|
+
}
|
|
3949
|
+
write(chunk, encoding, cb) {
|
|
3950
|
+
if (this[ABORTED2])
|
|
3951
|
+
return !1;
|
|
3952
|
+
if (this[EOF2])
|
|
3953
|
+
throw new Error("write after end");
|
|
3954
|
+
if (this[DESTROYED2])
|
|
3955
|
+
return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), !0;
|
|
3956
|
+
typeof encoding == "function" && (cb = encoding, encoding = "utf8"), encoding || (encoding = "utf8");
|
|
3957
|
+
let fn = this[ASYNC2] ? defer2 : nodefer2;
|
|
3958
|
+
if (!this[OBJECTMODE2] && !Buffer.isBuffer(chunk)) {
|
|
3959
|
+
if (isArrayBufferView2(chunk))
|
|
3960
|
+
chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
3961
|
+
else if (isArrayBufferLike2(chunk))
|
|
3962
|
+
chunk = Buffer.from(chunk);
|
|
3963
|
+
else if (typeof chunk != "string")
|
|
3964
|
+
throw new Error("Non-contiguous data written to non-objectMode stream");
|
|
3965
|
+
}
|
|
3966
|
+
return this[OBJECTMODE2] ? (this[FLOWING2] && this[BUFFERLENGTH2] !== 0 && this[FLUSH2](!0), this[FLOWING2] ? this.emit("data", chunk) : this[BUFFERPUSH2](chunk), this[BUFFERLENGTH2] !== 0 && this.emit("readable"), cb && fn(cb), this[FLOWING2]) : chunk.length ? (typeof chunk == "string" && // unless it is a string already ready for us to use
|
|
3967
|
+
!(encoding === this[ENCODING2] && !this[DECODER2]?.lastNeed) && (chunk = Buffer.from(chunk, encoding)), Buffer.isBuffer(chunk) && this[ENCODING2] && (chunk = this[DECODER2].write(chunk)), this[FLOWING2] && this[BUFFERLENGTH2] !== 0 && this[FLUSH2](!0), this[FLOWING2] ? this.emit("data", chunk) : this[BUFFERPUSH2](chunk), this[BUFFERLENGTH2] !== 0 && this.emit("readable"), cb && fn(cb), this[FLOWING2]) : (this[BUFFERLENGTH2] !== 0 && this.emit("readable"), cb && fn(cb), this[FLOWING2]);
|
|
3968
|
+
}
|
|
3969
|
+
/**
|
|
3970
|
+
* Low-level explicit read method.
|
|
3971
|
+
*
|
|
3972
|
+
* In objectMode, the argument is ignored, and one item is returned if
|
|
3973
|
+
* available.
|
|
3974
|
+
*
|
|
3975
|
+
* `n` is the number of bytes (or in the case of encoding streams,
|
|
3976
|
+
* characters) to consume. If `n` is not provided, then the entire buffer
|
|
3977
|
+
* is returned, or `null` is returned if no data is available.
|
|
3978
|
+
*
|
|
3979
|
+
* If `n` is greater that the amount of data in the internal buffer,
|
|
3980
|
+
* then `null` is returned.
|
|
3981
|
+
*/
|
|
3982
|
+
read(n) {
|
|
3983
|
+
if (this[DESTROYED2])
|
|
3984
|
+
return null;
|
|
3985
|
+
if (this[DISCARDED2] = !1, this[BUFFERLENGTH2] === 0 || n === 0 || n && n > this[BUFFERLENGTH2])
|
|
3986
|
+
return this[MAYBE_EMIT_END2](), null;
|
|
3987
|
+
this[OBJECTMODE2] && (n = null), this[BUFFER2].length > 1 && !this[OBJECTMODE2] && (this[BUFFER2] = [
|
|
3988
|
+
this[ENCODING2] ? this[BUFFER2].join("") : Buffer.concat(this[BUFFER2], this[BUFFERLENGTH2])
|
|
3989
|
+
]);
|
|
3990
|
+
let ret = this[READ2](n || null, this[BUFFER2][0]);
|
|
3991
|
+
return this[MAYBE_EMIT_END2](), ret;
|
|
3992
|
+
}
|
|
3993
|
+
[READ2](n, chunk) {
|
|
3994
|
+
if (this[OBJECTMODE2])
|
|
3995
|
+
this[BUFFERSHIFT2]();
|
|
3996
|
+
else {
|
|
3997
|
+
let c = chunk;
|
|
3998
|
+
n === c.length || n === null ? this[BUFFERSHIFT2]() : typeof c == "string" ? (this[BUFFER2][0] = c.slice(n), chunk = c.slice(0, n), this[BUFFERLENGTH2] -= n) : (this[BUFFER2][0] = c.subarray(n), chunk = c.subarray(0, n), this[BUFFERLENGTH2] -= n);
|
|
3999
|
+
}
|
|
4000
|
+
return this.emit("data", chunk), !this[BUFFER2].length && !this[EOF2] && this.emit("drain"), chunk;
|
|
4001
|
+
}
|
|
4002
|
+
end(chunk, encoding, cb) {
|
|
4003
|
+
return typeof chunk == "function" && (cb = chunk, chunk = void 0), typeof encoding == "function" && (cb = encoding, encoding = "utf8"), chunk !== void 0 && this.write(chunk, encoding), cb && this.once("end", cb), this[EOF2] = !0, this.writable = !1, (this[FLOWING2] || !this[PAUSED2]) && this[MAYBE_EMIT_END2](), this;
|
|
4004
|
+
}
|
|
4005
|
+
// don't let the internal resume be overwritten
|
|
4006
|
+
[RESUME2]() {
|
|
4007
|
+
this[DESTROYED2] || (!this[DATALISTENERS2] && !this[PIPES2].length && (this[DISCARDED2] = !0), this[PAUSED2] = !1, this[FLOWING2] = !0, this.emit("resume"), this[BUFFER2].length ? this[FLUSH2]() : this[EOF2] ? this[MAYBE_EMIT_END2]() : this.emit("drain"));
|
|
4008
|
+
}
|
|
4009
|
+
/**
|
|
4010
|
+
* Resume the stream if it is currently in a paused state
|
|
4011
|
+
*
|
|
4012
|
+
* If called when there are no pipe destinations or `data` event listeners,
|
|
4013
|
+
* this will place the stream in a "discarded" state, where all data will
|
|
4014
|
+
* be thrown away. The discarded state is removed if a pipe destination or
|
|
4015
|
+
* data handler is added, if pause() is called, or if any synchronous or
|
|
4016
|
+
* asynchronous iteration is started.
|
|
4017
|
+
*/
|
|
4018
|
+
resume() {
|
|
4019
|
+
return this[RESUME2]();
|
|
4020
|
+
}
|
|
4021
|
+
/**
|
|
4022
|
+
* Pause the stream
|
|
4023
|
+
*/
|
|
4024
|
+
pause() {
|
|
4025
|
+
this[FLOWING2] = !1, this[PAUSED2] = !0, this[DISCARDED2] = !1;
|
|
4026
|
+
}
|
|
4027
|
+
/**
|
|
4028
|
+
* true if the stream has been forcibly destroyed
|
|
4029
|
+
*/
|
|
4030
|
+
get destroyed() {
|
|
4031
|
+
return this[DESTROYED2];
|
|
4032
|
+
}
|
|
4033
|
+
/**
|
|
4034
|
+
* true if the stream is currently in a flowing state, meaning that
|
|
4035
|
+
* any writes will be immediately emitted.
|
|
4036
|
+
*/
|
|
4037
|
+
get flowing() {
|
|
4038
|
+
return this[FLOWING2];
|
|
4039
|
+
}
|
|
4040
|
+
/**
|
|
4041
|
+
* true if the stream is currently in a paused state
|
|
4042
|
+
*/
|
|
4043
|
+
get paused() {
|
|
4044
|
+
return this[PAUSED2];
|
|
4045
|
+
}
|
|
4046
|
+
[BUFFERPUSH2](chunk) {
|
|
4047
|
+
this[OBJECTMODE2] ? this[BUFFERLENGTH2] += 1 : this[BUFFERLENGTH2] += chunk.length, this[BUFFER2].push(chunk);
|
|
4048
|
+
}
|
|
4049
|
+
[BUFFERSHIFT2]() {
|
|
4050
|
+
return this[OBJECTMODE2] ? this[BUFFERLENGTH2] -= 1 : this[BUFFERLENGTH2] -= this[BUFFER2][0].length, this[BUFFER2].shift();
|
|
4051
|
+
}
|
|
4052
|
+
[FLUSH2](noDrain = !1) {
|
|
4053
|
+
do
|
|
4054
|
+
;
|
|
4055
|
+
while (this[FLUSHCHUNK2](this[BUFFERSHIFT2]()) && this[BUFFER2].length);
|
|
4056
|
+
!noDrain && !this[BUFFER2].length && !this[EOF2] && this.emit("drain");
|
|
4057
|
+
}
|
|
4058
|
+
[FLUSHCHUNK2](chunk) {
|
|
4059
|
+
return this.emit("data", chunk), this[FLOWING2];
|
|
4060
|
+
}
|
|
4061
|
+
/**
|
|
4062
|
+
* Pipe all data emitted by this stream into the destination provided.
|
|
4063
|
+
*
|
|
4064
|
+
* Triggers the flow of data.
|
|
4065
|
+
*/
|
|
4066
|
+
pipe(dest, opts) {
|
|
4067
|
+
if (this[DESTROYED2])
|
|
4068
|
+
return dest;
|
|
4069
|
+
this[DISCARDED2] = !1;
|
|
4070
|
+
let ended = this[EMITTED_END2];
|
|
4071
|
+
return opts = opts || {}, dest === proc2.stdout || dest === proc2.stderr ? opts.end = !1 : opts.end = opts.end !== !1, opts.proxyErrors = !!opts.proxyErrors, ended ? opts.end && dest.end() : (this[PIPES2].push(opts.proxyErrors ? new PipeProxyErrors2(this, dest, opts) : new Pipe2(this, dest, opts)), this[ASYNC2] ? defer2(() => this[RESUME2]()) : this[RESUME2]()), dest;
|
|
4072
|
+
}
|
|
4073
|
+
/**
|
|
4074
|
+
* Fully unhook a piped destination stream.
|
|
4075
|
+
*
|
|
4076
|
+
* If the destination stream was the only consumer of this stream (ie,
|
|
4077
|
+
* there are no other piped destinations or `'data'` event listeners)
|
|
4078
|
+
* then the flow of data will stop until there is another consumer or
|
|
4079
|
+
* {@link Minipass#resume} is explicitly called.
|
|
4080
|
+
*/
|
|
4081
|
+
unpipe(dest) {
|
|
4082
|
+
let p = this[PIPES2].find((p2) => p2.dest === dest);
|
|
4083
|
+
p && (this[PIPES2].length === 1 ? (this[FLOWING2] && this[DATALISTENERS2] === 0 && (this[FLOWING2] = !1), this[PIPES2] = []) : this[PIPES2].splice(this[PIPES2].indexOf(p), 1), p.unpipe());
|
|
4084
|
+
}
|
|
4085
|
+
/**
|
|
4086
|
+
* Alias for {@link Minipass#on}
|
|
4087
|
+
*/
|
|
4088
|
+
addListener(ev, handler) {
|
|
4089
|
+
return this.on(ev, handler);
|
|
4090
|
+
}
|
|
4091
|
+
/**
|
|
4092
|
+
* Mostly identical to `EventEmitter.on`, with the following
|
|
4093
|
+
* behavior differences to prevent data loss and unnecessary hangs:
|
|
4094
|
+
*
|
|
4095
|
+
* - Adding a 'data' event handler will trigger the flow of data
|
|
4096
|
+
*
|
|
4097
|
+
* - Adding a 'readable' event handler when there is data waiting to be read
|
|
4098
|
+
* will cause 'readable' to be emitted immediately.
|
|
4099
|
+
*
|
|
4100
|
+
* - Adding an 'endish' event handler ('end', 'finish', etc.) which has
|
|
4101
|
+
* already passed will cause the event to be emitted immediately and all
|
|
4102
|
+
* handlers removed.
|
|
4103
|
+
*
|
|
4104
|
+
* - Adding an 'error' event handler after an error has been emitted will
|
|
4105
|
+
* cause the event to be re-emitted immediately with the error previously
|
|
4106
|
+
* raised.
|
|
4107
|
+
*/
|
|
4108
|
+
on(ev, handler) {
|
|
4109
|
+
let ret = super.on(ev, handler);
|
|
4110
|
+
if (ev === "data")
|
|
4111
|
+
this[DISCARDED2] = !1, this[DATALISTENERS2]++, !this[PIPES2].length && !this[FLOWING2] && this[RESUME2]();
|
|
4112
|
+
else if (ev === "readable" && this[BUFFERLENGTH2] !== 0)
|
|
4113
|
+
super.emit("readable");
|
|
4114
|
+
else if (isEndish2(ev) && this[EMITTED_END2])
|
|
4115
|
+
super.emit(ev), this.removeAllListeners(ev);
|
|
4116
|
+
else if (ev === "error" && this[EMITTED_ERROR2]) {
|
|
4117
|
+
let h = handler;
|
|
4118
|
+
this[ASYNC2] ? defer2(() => h.call(this, this[EMITTED_ERROR2])) : h.call(this, this[EMITTED_ERROR2]);
|
|
4119
|
+
}
|
|
4120
|
+
return ret;
|
|
4121
|
+
}
|
|
4122
|
+
/**
|
|
4123
|
+
* Alias for {@link Minipass#off}
|
|
4124
|
+
*/
|
|
4125
|
+
removeListener(ev, handler) {
|
|
4126
|
+
return this.off(ev, handler);
|
|
4127
|
+
}
|
|
4128
|
+
/**
|
|
4129
|
+
* Mostly identical to `EventEmitter.off`
|
|
4130
|
+
*
|
|
4131
|
+
* If a 'data' event handler is removed, and it was the last consumer
|
|
4132
|
+
* (ie, there are no pipe destinations or other 'data' event listeners),
|
|
4133
|
+
* then the flow of data will stop until there is another consumer or
|
|
4134
|
+
* {@link Minipass#resume} is explicitly called.
|
|
4135
|
+
*/
|
|
4136
|
+
off(ev, handler) {
|
|
4137
|
+
let ret = super.off(ev, handler);
|
|
4138
|
+
return ev === "data" && (this[DATALISTENERS2] = this.listeners("data").length, this[DATALISTENERS2] === 0 && !this[DISCARDED2] && !this[PIPES2].length && (this[FLOWING2] = !1)), ret;
|
|
4139
|
+
}
|
|
4140
|
+
/**
|
|
4141
|
+
* Mostly identical to `EventEmitter.removeAllListeners`
|
|
4142
|
+
*
|
|
4143
|
+
* If all 'data' event handlers are removed, and they were the last consumer
|
|
4144
|
+
* (ie, there are no pipe destinations), then the flow of data will stop
|
|
4145
|
+
* until there is another consumer or {@link Minipass#resume} is explicitly
|
|
4146
|
+
* called.
|
|
4147
|
+
*/
|
|
4148
|
+
removeAllListeners(ev) {
|
|
4149
|
+
let ret = super.removeAllListeners(ev);
|
|
4150
|
+
return (ev === "data" || ev === void 0) && (this[DATALISTENERS2] = 0, !this[DISCARDED2] && !this[PIPES2].length && (this[FLOWING2] = !1)), ret;
|
|
4151
|
+
}
|
|
4152
|
+
/**
|
|
4153
|
+
* true if the 'end' event has been emitted
|
|
4154
|
+
*/
|
|
4155
|
+
get emittedEnd() {
|
|
4156
|
+
return this[EMITTED_END2];
|
|
4157
|
+
}
|
|
4158
|
+
[MAYBE_EMIT_END2]() {
|
|
4159
|
+
!this[EMITTING_END2] && !this[EMITTED_END2] && !this[DESTROYED2] && this[BUFFER2].length === 0 && this[EOF2] && (this[EMITTING_END2] = !0, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[CLOSED2] && this.emit("close"), this[EMITTING_END2] = !1);
|
|
4160
|
+
}
|
|
4161
|
+
/**
|
|
4162
|
+
* Mostly identical to `EventEmitter.emit`, with the following
|
|
4163
|
+
* behavior differences to prevent data loss and unnecessary hangs:
|
|
4164
|
+
*
|
|
4165
|
+
* If the stream has been destroyed, and the event is something other
|
|
4166
|
+
* than 'close' or 'error', then `false` is returned and no handlers
|
|
4167
|
+
* are called.
|
|
4168
|
+
*
|
|
4169
|
+
* If the event is 'end', and has already been emitted, then the event
|
|
4170
|
+
* is ignored. If the stream is in a paused or non-flowing state, then
|
|
4171
|
+
* the event will be deferred until data flow resumes. If the stream is
|
|
4172
|
+
* async, then handlers will be called on the next tick rather than
|
|
4173
|
+
* immediately.
|
|
4174
|
+
*
|
|
4175
|
+
* If the event is 'close', and 'end' has not yet been emitted, then
|
|
4176
|
+
* the event will be deferred until after 'end' is emitted.
|
|
4177
|
+
*
|
|
4178
|
+
* If the event is 'error', and an AbortSignal was provided for the stream,
|
|
4179
|
+
* and there are no listeners, then the event is ignored, matching the
|
|
4180
|
+
* behavior of node core streams in the presense of an AbortSignal.
|
|
4181
|
+
*
|
|
4182
|
+
* If the event is 'finish' or 'prefinish', then all listeners will be
|
|
4183
|
+
* removed after emitting the event, to prevent double-firing.
|
|
4184
|
+
*/
|
|
4185
|
+
emit(ev, ...args) {
|
|
4186
|
+
let data = args[0];
|
|
4187
|
+
if (ev !== "error" && ev !== "close" && ev !== DESTROYED2 && this[DESTROYED2])
|
|
4188
|
+
return !1;
|
|
4189
|
+
if (ev === "data")
|
|
4190
|
+
return !this[OBJECTMODE2] && !data ? !1 : this[ASYNC2] ? (defer2(() => this[EMITDATA2](data)), !0) : this[EMITDATA2](data);
|
|
4191
|
+
if (ev === "end")
|
|
4192
|
+
return this[EMITEND3]();
|
|
4193
|
+
if (ev === "close") {
|
|
4194
|
+
if (this[CLOSED2] = !0, !this[EMITTED_END2] && !this[DESTROYED2])
|
|
4195
|
+
return !1;
|
|
4196
|
+
let ret2 = super.emit("close");
|
|
4197
|
+
return this.removeAllListeners("close"), ret2;
|
|
4198
|
+
} else if (ev === "error") {
|
|
4199
|
+
this[EMITTED_ERROR2] = data, super.emit(ERROR2, data);
|
|
4200
|
+
let ret2 = !this[SIGNAL2] || this.listeners("error").length ? super.emit("error", data) : !1;
|
|
4201
|
+
return this[MAYBE_EMIT_END2](), ret2;
|
|
4202
|
+
} else if (ev === "resume") {
|
|
4203
|
+
let ret2 = super.emit("resume");
|
|
4204
|
+
return this[MAYBE_EMIT_END2](), ret2;
|
|
4205
|
+
} else if (ev === "finish" || ev === "prefinish") {
|
|
4206
|
+
let ret2 = super.emit(ev);
|
|
4207
|
+
return this.removeAllListeners(ev), ret2;
|
|
4208
|
+
}
|
|
4209
|
+
let ret = super.emit(ev, ...args);
|
|
4210
|
+
return this[MAYBE_EMIT_END2](), ret;
|
|
4211
|
+
}
|
|
4212
|
+
[EMITDATA2](data) {
|
|
4213
|
+
for (let p of this[PIPES2])
|
|
4214
|
+
p.dest.write(data) === !1 && this.pause();
|
|
4215
|
+
let ret = this[DISCARDED2] ? !1 : super.emit("data", data);
|
|
4216
|
+
return this[MAYBE_EMIT_END2](), ret;
|
|
4217
|
+
}
|
|
4218
|
+
[EMITEND3]() {
|
|
4219
|
+
return this[EMITTED_END2] ? !1 : (this[EMITTED_END2] = !0, this.readable = !1, this[ASYNC2] ? (defer2(() => this[EMITEND22]()), !0) : this[EMITEND22]());
|
|
4220
|
+
}
|
|
4221
|
+
[EMITEND22]() {
|
|
4222
|
+
if (this[DECODER2]) {
|
|
4223
|
+
let data = this[DECODER2].end();
|
|
4224
|
+
if (data) {
|
|
4225
|
+
for (let p of this[PIPES2])
|
|
4226
|
+
p.dest.write(data);
|
|
4227
|
+
this[DISCARDED2] || super.emit("data", data);
|
|
4228
|
+
}
|
|
4229
|
+
}
|
|
4230
|
+
for (let p of this[PIPES2])
|
|
4231
|
+
p.end();
|
|
4232
|
+
let ret = super.emit("end");
|
|
4233
|
+
return this.removeAllListeners("end"), ret;
|
|
4234
|
+
}
|
|
4235
|
+
/**
|
|
4236
|
+
* Return a Promise that resolves to an array of all emitted data once
|
|
4237
|
+
* the stream ends.
|
|
4238
|
+
*/
|
|
4239
|
+
async collect() {
|
|
4240
|
+
let buf = Object.assign([], {
|
|
4241
|
+
dataLength: 0
|
|
4242
|
+
});
|
|
4243
|
+
this[OBJECTMODE2] || (buf.dataLength = 0);
|
|
4244
|
+
let p = this.promise();
|
|
4245
|
+
return this.on("data", (c) => {
|
|
4246
|
+
buf.push(c), this[OBJECTMODE2] || (buf.dataLength += c.length);
|
|
4247
|
+
}), await p, buf;
|
|
4248
|
+
}
|
|
4249
|
+
/**
|
|
4250
|
+
* Return a Promise that resolves to the concatenation of all emitted data
|
|
4251
|
+
* once the stream ends.
|
|
4252
|
+
*
|
|
4253
|
+
* Not allowed on objectMode streams.
|
|
4254
|
+
*/
|
|
4255
|
+
async concat() {
|
|
4256
|
+
if (this[OBJECTMODE2])
|
|
4257
|
+
throw new Error("cannot concat in objectMode");
|
|
4258
|
+
let buf = await this.collect();
|
|
4259
|
+
return this[ENCODING2] ? buf.join("") : Buffer.concat(buf, buf.dataLength);
|
|
4260
|
+
}
|
|
4261
|
+
/**
|
|
4262
|
+
* Return a void Promise that resolves once the stream ends.
|
|
4263
|
+
*/
|
|
4264
|
+
async promise() {
|
|
4265
|
+
return new Promise((resolve, reject) => {
|
|
4266
|
+
this.on(DESTROYED2, () => reject(new Error("stream destroyed"))), this.on("error", (er) => reject(er)), this.on("end", () => resolve());
|
|
4267
|
+
});
|
|
4268
|
+
}
|
|
4269
|
+
/**
|
|
4270
|
+
* Asynchronous `for await of` iteration.
|
|
4271
|
+
*
|
|
4272
|
+
* This will continue emitting all chunks until the stream terminates.
|
|
4273
|
+
*/
|
|
4274
|
+
[Symbol.asyncIterator]() {
|
|
4275
|
+
this[DISCARDED2] = !1;
|
|
4276
|
+
let stopped = !1, stop = async () => (this.pause(), stopped = !0, { value: void 0, done: !0 });
|
|
4277
|
+
return {
|
|
4278
|
+
next: () => {
|
|
4279
|
+
if (stopped)
|
|
4280
|
+
return stop();
|
|
4281
|
+
let res = this.read();
|
|
4282
|
+
if (res !== null)
|
|
4283
|
+
return Promise.resolve({ done: !1, value: res });
|
|
4284
|
+
if (this[EOF2])
|
|
4285
|
+
return stop();
|
|
4286
|
+
let resolve, reject, onerr = (er) => {
|
|
4287
|
+
this.off("data", ondata), this.off("end", onend), this.off(DESTROYED2, ondestroy), stop(), reject(er);
|
|
4288
|
+
}, ondata = (value) => {
|
|
4289
|
+
this.off("error", onerr), this.off("end", onend), this.off(DESTROYED2, ondestroy), this.pause(), resolve({ value, done: !!this[EOF2] });
|
|
4290
|
+
}, onend = () => {
|
|
4291
|
+
this.off("error", onerr), this.off("data", ondata), this.off(DESTROYED2, ondestroy), stop(), resolve({ done: !0, value: void 0 });
|
|
4292
|
+
}, ondestroy = () => onerr(new Error("stream destroyed"));
|
|
4293
|
+
return new Promise((res2, rej) => {
|
|
4294
|
+
reject = rej, resolve = res2, this.once(DESTROYED2, ondestroy), this.once("error", onerr), this.once("end", onend), this.once("data", ondata);
|
|
4295
|
+
});
|
|
4296
|
+
},
|
|
4297
|
+
throw: stop,
|
|
4298
|
+
return: stop,
|
|
4299
|
+
[Symbol.asyncIterator]() {
|
|
4300
|
+
return this;
|
|
4301
|
+
}
|
|
4302
|
+
};
|
|
4303
|
+
}
|
|
4304
|
+
/**
|
|
4305
|
+
* Synchronous `for of` iteration.
|
|
4306
|
+
*
|
|
4307
|
+
* The iteration will terminate when the internal buffer runs out, even
|
|
4308
|
+
* if the stream has not yet terminated.
|
|
4309
|
+
*/
|
|
4310
|
+
[Symbol.iterator]() {
|
|
4311
|
+
this[DISCARDED2] = !1;
|
|
4312
|
+
let stopped = !1, stop = () => (this.pause(), this.off(ERROR2, stop), this.off(DESTROYED2, stop), this.off("end", stop), stopped = !0, { done: !0, value: void 0 }), next = () => {
|
|
4313
|
+
if (stopped)
|
|
4314
|
+
return stop();
|
|
4315
|
+
let value = this.read();
|
|
4316
|
+
return value === null ? stop() : { done: !1, value };
|
|
4317
|
+
};
|
|
4318
|
+
return this.once("end", stop), this.once(ERROR2, stop), this.once(DESTROYED2, stop), {
|
|
4319
|
+
next,
|
|
4320
|
+
throw: stop,
|
|
4321
|
+
return: stop,
|
|
4322
|
+
[Symbol.iterator]() {
|
|
4323
|
+
return this;
|
|
4324
|
+
}
|
|
4325
|
+
};
|
|
4326
|
+
}
|
|
4327
|
+
/**
|
|
4328
|
+
* Destroy a stream, preventing it from being used for any further purpose.
|
|
4329
|
+
*
|
|
4330
|
+
* If the stream has a `close()` method, then it will be called on
|
|
4331
|
+
* destruction.
|
|
4332
|
+
*
|
|
4333
|
+
* After destruction, any attempt to write data, read data, or emit most
|
|
4334
|
+
* events will be ignored.
|
|
4335
|
+
*
|
|
4336
|
+
* If an error argument is provided, then it will be emitted in an
|
|
4337
|
+
* 'error' event.
|
|
4338
|
+
*/
|
|
4339
|
+
destroy(er) {
|
|
4340
|
+
if (this[DESTROYED2])
|
|
4341
|
+
return er ? this.emit("error", er) : this.emit(DESTROYED2), this;
|
|
4342
|
+
this[DESTROYED2] = !0, this[DISCARDED2] = !0, this[BUFFER2].length = 0, this[BUFFERLENGTH2] = 0;
|
|
4343
|
+
let wc = this;
|
|
4344
|
+
return typeof wc.close == "function" && !this[CLOSED2] && wc.close(), er ? this.emit("error", er) : this.emit(DESTROYED2), this;
|
|
4345
|
+
}
|
|
4346
|
+
/**
|
|
4347
|
+
* Alias for {@link isStream}
|
|
4348
|
+
*
|
|
4349
|
+
* Former export location, maintained for backwards compatibility.
|
|
4350
|
+
*
|
|
4351
|
+
* @deprecated
|
|
4352
|
+
*/
|
|
4353
|
+
static get isStream() {
|
|
4354
|
+
return isStream2;
|
|
4355
|
+
}
|
|
4356
|
+
};
|
|
4357
|
+
|
|
4358
|
+
// ../../node_modules/glob/dist/esm/ignore.js
|
|
3888
4359
|
var defaultPlatform2 = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", Ignore = class {
|
|
3889
4360
|
relative;
|
|
3890
4361
|
relativeChildren;
|
|
@@ -3941,7 +4412,7 @@ var defaultPlatform2 = typeof process == "object" && process && typeof process.p
|
|
|
3941
4412
|
}
|
|
3942
4413
|
};
|
|
3943
4414
|
|
|
3944
|
-
//
|
|
4415
|
+
// ../../node_modules/glob/dist/esm/processor.js
|
|
3945
4416
|
var HasWalkedCache = class _HasWalkedCache {
|
|
3946
4417
|
store;
|
|
3947
4418
|
constructor(store = /* @__PURE__ */ new Map()) {
|
|
@@ -4084,7 +4555,7 @@ var HasWalkedCache = class _HasWalkedCache {
|
|
|
4084
4555
|
}
|
|
4085
4556
|
};
|
|
4086
4557
|
|
|
4087
|
-
//
|
|
4558
|
+
// ../../node_modules/glob/dist/esm/walker.js
|
|
4088
4559
|
var makeIgnore = (ignore, opts) => typeof ignore == "string" ? new Ignore([ignore], opts) : Array.isArray(ignore) ? new Ignore(ignore, opts) : ignore, GlobUtil = class {
|
|
4089
4560
|
path;
|
|
4090
4561
|
patterns;
|
|
@@ -4293,7 +4764,7 @@ var makeIgnore = (ignore, opts) => typeof ignore == "string" ? new Ignore([ignor
|
|
|
4293
4764
|
}, GlobStream = class extends GlobUtil {
|
|
4294
4765
|
results;
|
|
4295
4766
|
constructor(patterns, path2, opts) {
|
|
4296
|
-
super(patterns, path2, opts), this.results = new
|
|
4767
|
+
super(patterns, path2, opts), this.results = new Minipass2({
|
|
4297
4768
|
signal: this.signal,
|
|
4298
4769
|
objectMode: !0
|
|
4299
4770
|
}), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
|
|
@@ -4312,7 +4783,7 @@ var makeIgnore = (ignore, opts) => typeof ignore == "string" ? new Ignore([ignor
|
|
|
4312
4783
|
}
|
|
4313
4784
|
};
|
|
4314
4785
|
|
|
4315
|
-
//
|
|
4786
|
+
// ../../node_modules/glob/dist/esm/glob.js
|
|
4316
4787
|
var defaultPlatform3 = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", Glob = class {
|
|
4317
4788
|
absolute;
|
|
4318
4789
|
cwd;
|
|
@@ -4465,7 +4936,7 @@ var defaultPlatform3 = typeof process == "object" && process && typeof process.p
|
|
|
4465
4936
|
}
|
|
4466
4937
|
};
|
|
4467
4938
|
|
|
4468
|
-
//
|
|
4939
|
+
// ../../node_modules/glob/dist/esm/has-magic.js
|
|
4469
4940
|
var hasMagic = (pattern, options = {}) => {
|
|
4470
4941
|
Array.isArray(pattern) || (pattern = [pattern]);
|
|
4471
4942
|
for (let p of pattern)
|
|
@@ -4474,7 +4945,7 @@ var hasMagic = (pattern, options = {}) => {
|
|
|
4474
4945
|
return !1;
|
|
4475
4946
|
};
|
|
4476
4947
|
|
|
4477
|
-
//
|
|
4948
|
+
// ../../node_modules/glob/dist/esm/index.js
|
|
4478
4949
|
function globStreamSync(pattern, options = {}) {
|
|
4479
4950
|
return new Glob(pattern, options).streamSync();
|
|
4480
4951
|
}
|