lakutata 2.0.12 → 2.0.13
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/com/database.cjs +13 -3
- package/com/database.mjs +13 -3
- package/com/docker.cjs +6 -2
- package/com/docker.d.ts +29 -11
- package/com/docker.mjs +6 -2
- package/com/logger.cjs +2 -2
- package/com/logger.mjs +2 -2
- package/decorator/orm.cjs +21 -11
- package/decorator/orm.mjs +13 -3
- package/helper.cjs +12 -12
- package/helper.d.ts +559 -82
- package/helper.mjs +5 -5
- package/lakutata.cjs +2 -2
- package/lakutata.mjs +2 -2
- package/orm.cjs +13 -3
- package/orm.mjs +39 -29
- package/package.json +2 -4
- package/src/components/Database.cjs +17 -7
- package/src/components/Database.mjs +13 -3
- package/src/components/Logger.cjs +2 -2
- package/src/components/Logger.mjs +2 -2
- package/src/components/docker/ConnectionOptionsBuilder.cjs +6 -2
- package/src/components/docker/ConnectionOptionsBuilder.mjs +6 -2
- package/src/components/docker/Docker.cjs +8 -3
- package/src/components/docker/Docker.mjs +8 -3
- package/src/components/docker/lib/DockerContainer.cjs +10 -6
- package/src/components/docker/lib/DockerContainer.mjs +6 -2
- package/src/components/docker/lib/DockerContainerTTY.cjs +6 -2
- package/src/components/docker/lib/DockerContainerTTY.mjs +6 -2
- package/src/decorators/orm/AfterInsert.cjs +13 -3
- package/src/decorators/orm/AfterInsert.mjs +17 -7
- package/src/decorators/orm/AfterLoad.cjs +17 -7
- package/src/decorators/orm/AfterLoad.mjs +13 -3
- package/src/decorators/orm/AfterRecover.cjs +17 -7
- package/src/decorators/orm/AfterRecover.mjs +17 -7
- package/src/decorators/orm/AfterRemove.cjs +17 -7
- package/src/decorators/orm/AfterRemove.mjs +22 -12
- package/src/decorators/orm/AfterSoftRemove.cjs +13 -3
- package/src/decorators/orm/AfterSoftRemove.mjs +24 -14
- package/src/decorators/orm/AfterUpdate.cjs +13 -3
- package/src/decorators/orm/AfterUpdate.mjs +22 -12
- package/src/decorators/orm/BeforeInsert.cjs +17 -7
- package/src/decorators/orm/BeforeInsert.mjs +17 -7
- package/src/decorators/orm/BeforeRecover.cjs +17 -7
- package/src/decorators/orm/BeforeRecover.mjs +22 -12
- package/src/decorators/orm/BeforeRemove.cjs +17 -7
- package/src/decorators/orm/BeforeRemove.mjs +17 -7
- package/src/decorators/orm/BeforeSoftRemove.cjs +17 -7
- package/src/decorators/orm/BeforeSoftRemove.mjs +23 -13
- package/src/decorators/orm/BeforeUpdate.cjs +17 -7
- package/src/decorators/orm/BeforeUpdate.mjs +22 -12
- package/src/decorators/orm/Check.cjs +18 -8
- package/src/decorators/orm/Check.mjs +13 -3
- package/src/decorators/orm/ChildEntity.cjs +13 -3
- package/src/decorators/orm/ChildEntity.mjs +13 -3
- package/src/decorators/orm/Column.cjs +26 -16
- package/src/decorators/orm/Column.mjs +23 -13
- package/src/decorators/orm/CreateDateColumn.cjs +19 -9
- package/src/decorators/orm/CreateDateColumn.mjs +24 -14
- package/src/decorators/orm/DeleteDateColumn.cjs +19 -9
- package/src/decorators/orm/DeleteDateColumn.mjs +23 -13
- package/src/decorators/orm/Entity.cjs +26 -16
- package/src/decorators/orm/Entity.mjs +32 -22
- package/src/decorators/orm/EventSubscriber.cjs +13 -3
- package/src/decorators/orm/EventSubscriber.mjs +18 -8
- package/src/decorators/orm/Exclusion.cjs +21 -11
- package/src/decorators/orm/Exclusion.mjs +21 -11
- package/src/decorators/orm/Generated.cjs +13 -3
- package/src/decorators/orm/Generated.mjs +13 -3
- package/src/decorators/orm/Index.cjs +22 -12
- package/src/decorators/orm/Index.mjs +27 -17
- package/src/decorators/orm/JoinColumn.cjs +19 -9
- package/src/decorators/orm/JoinColumn.mjs +27 -17
- package/src/decorators/orm/JoinTable.cjs +13 -3
- package/src/decorators/orm/JoinTable.mjs +29 -19
- package/src/decorators/orm/ManyToMany.cjs +25 -15
- package/src/decorators/orm/ManyToMany.mjs +26 -16
- package/src/decorators/orm/ManyToOne.cjs +25 -15
- package/src/decorators/orm/ManyToOne.mjs +26 -16
- package/src/decorators/orm/ObjectIdColumn.cjs +13 -3
- package/src/decorators/orm/ObjectIdColumn.mjs +26 -16
- package/src/decorators/orm/OneToMany.cjs +21 -11
- package/src/decorators/orm/OneToMany.mjs +22 -12
- package/src/decorators/orm/OneToOne.cjs +16 -6
- package/src/decorators/orm/OneToOne.mjs +36 -26
- package/src/decorators/orm/PrimaryColumn.cjs +23 -13
- package/src/decorators/orm/PrimaryColumn.mjs +24 -14
- package/src/decorators/orm/PrimaryGeneratedColumn.cjs +32 -22
- package/src/decorators/orm/PrimaryGeneratedColumn.mjs +18 -8
- package/src/decorators/orm/RelationId.cjs +19 -9
- package/src/decorators/orm/RelationId.mjs +18 -8
- package/src/decorators/orm/TableInheritance.cjs +17 -7
- package/src/decorators/orm/TableInheritance.mjs +26 -16
- package/src/decorators/orm/Tree.cjs +13 -3
- package/src/decorators/orm/Tree.mjs +26 -16
- package/src/decorators/orm/TreeChildren.cjs +15 -5
- package/src/decorators/orm/TreeChildren.mjs +18 -8
- package/src/decorators/orm/TreeLevelColumn.cjs +13 -3
- package/src/decorators/orm/TreeLevelColumn.mjs +20 -10
- package/src/decorators/orm/TreeParent.cjs +19 -9
- package/src/decorators/orm/TreeParent.mjs +13 -3
- package/src/decorators/orm/Unique.cjs +29 -19
- package/src/decorators/orm/Unique.mjs +30 -20
- package/src/decorators/orm/UpdateDateColumn.cjs +19 -9
- package/src/decorators/orm/UpdateDateColumn.mjs +25 -15
- package/src/decorators/orm/VersionColumn.cjs +13 -3
- package/src/decorators/orm/VersionColumn.mjs +26 -16
- package/src/decorators/orm/ViewColumn.cjs +13 -3
- package/src/decorators/orm/ViewColumn.mjs +26 -16
- package/src/decorators/orm/ViewEntity.cjs +27 -17
- package/src/decorators/orm/ViewEntity.mjs +19 -9
- package/src/decorators/orm/VirtualColumn.cjs +18 -8
- package/src/decorators/orm/VirtualColumn.mjs +30 -20
- package/src/lib/base/internal/PatternManager.cjs +2 -2
- package/src/lib/base/internal/PatternManager.mjs +2 -2
- package/src/lib/core/Application.cjs +2 -2
- package/src/lib/core/Application.mjs +2 -2
- package/src/lib/helpers/Glob.cjs +1220 -1149
- package/src/lib/helpers/Glob.mjs +769 -700
- package/src/lib/helpers/IsXML.cjs +863 -801
- package/src/lib/helpers/IsXML.mjs +862 -800
- package/src/lib/ioc/ListModules.cjs +967 -909
- package/src/lib/ioc/ListModules.mjs +849 -791
- package/src/lib/validation/VLD.cjs +20 -10
- package/src/lib/validation/VLD.mjs +20 -10
- package/vendor/Package.1.cjs +170 -129
- package/vendor/Package.1.mjs +169 -128
- package/vendor/Package.13.cjs +0 -2
- package/vendor/Package.13.mjs +0 -2
- package/vendor/Package.14.cjs +8756 -8658
- package/vendor/Package.14.mjs +8665 -8581
- package/vendor/Package.16.cjs +36855 -15590
- package/vendor/Package.16.mjs +36893 -15633
- package/vendor/Package.2.cjs +2442 -2440
- package/vendor/Package.2.mjs +444 -442
- package/vendor/Package.4.cjs +325 -319
- package/vendor/Package.4.mjs +326 -320
- package/vendor/Package.7.cjs +299 -299
- package/vendor/Package.7.mjs +299 -299
- package/vendor/TypeDef.5.d.ts +6 -0
package/src/lib/helpers/Glob.cjs
CHANGED
|
@@ -6,27 +6,29 @@ Object.defineProperty(exports, Symbol.toStringTag, {
|
|
|
6
6
|
|
|
7
7
|
const t = require("../../../vendor/Package.73.cjs");
|
|
8
8
|
|
|
9
|
-
const e = require("
|
|
9
|
+
const e = require("node:url");
|
|
10
10
|
|
|
11
|
-
const s = require("
|
|
11
|
+
const s = require("node:path");
|
|
12
12
|
|
|
13
13
|
const i = require("fs");
|
|
14
14
|
|
|
15
|
-
const n = require("fs
|
|
15
|
+
const n = require("node:fs");
|
|
16
16
|
|
|
17
|
-
const r = require("
|
|
17
|
+
const r = require("node:fs/promises");
|
|
18
18
|
|
|
19
|
-
const o = require("
|
|
19
|
+
const o = require("node:events");
|
|
20
20
|
|
|
21
|
-
const h = require("
|
|
21
|
+
const h = require("node:stream");
|
|
22
|
+
|
|
23
|
+
const a = require("node:string_decoder");
|
|
22
24
|
|
|
23
25
|
require("../../../vendor/Package.5.cjs");
|
|
24
26
|
|
|
25
|
-
const
|
|
27
|
+
const l = t => t && t.__esModule ? t : {
|
|
26
28
|
default: t
|
|
27
29
|
};
|
|
28
30
|
|
|
29
|
-
function
|
|
31
|
+
function c(t) {
|
|
30
32
|
if (t && t.__esModule) return t;
|
|
31
33
|
const e = Object.create(null, {
|
|
32
34
|
[Symbol.toStringTag]: {
|
|
@@ -48,22 +50,22 @@ function l(t) {
|
|
|
48
50
|
return Object.freeze(e);
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
const
|
|
53
|
+
const f = c(n);
|
|
52
54
|
|
|
53
|
-
const
|
|
55
|
+
const u = l(h);
|
|
54
56
|
|
|
55
|
-
const
|
|
57
|
+
const d = 1024 * 64;
|
|
56
58
|
|
|
57
|
-
const
|
|
59
|
+
const p = t => {
|
|
58
60
|
if (typeof t !== "string") {
|
|
59
61
|
throw new TypeError("invalid pattern");
|
|
60
62
|
}
|
|
61
|
-
if (t.length >
|
|
63
|
+
if (t.length > d) {
|
|
62
64
|
throw new TypeError("pattern is too long");
|
|
63
65
|
}
|
|
64
66
|
};
|
|
65
67
|
|
|
66
|
-
const
|
|
68
|
+
const g = {
|
|
67
69
|
"[:alnum:]": [ "\\p{L}\\p{Nl}\\p{Nd}", true ],
|
|
68
70
|
"[:alpha:]": [ "\\p{L}\\p{Nl}", true ],
|
|
69
71
|
"[:ascii:]": [ "\\x" + "00-\\x" + "7f", false ],
|
|
@@ -80,13 +82,13 @@ const p = {
|
|
|
80
82
|
"[:xdigit:]": [ "A-Fa-f0-9", false ]
|
|
81
83
|
};
|
|
82
84
|
|
|
83
|
-
const
|
|
85
|
+
const m = t => t.replace(/[[\]\\-]/g, "\\$&");
|
|
84
86
|
|
|
85
|
-
const
|
|
87
|
+
const w = t => t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
86
88
|
|
|
87
|
-
const
|
|
89
|
+
const y = t => t.join("");
|
|
88
90
|
|
|
89
|
-
const
|
|
91
|
+
const b = (t, e) => {
|
|
90
92
|
const s = e;
|
|
91
93
|
if (t.charAt(s) !== "[") {
|
|
92
94
|
throw new Error("not in a brace expression");
|
|
@@ -120,7 +122,7 @@ const y = (t, e) => {
|
|
|
120
122
|
}
|
|
121
123
|
}
|
|
122
124
|
if (e === "[" && !a) {
|
|
123
|
-
for (const [e, [o, a, l]] of Object.entries(
|
|
125
|
+
for (const [e, [o, a, l]] of Object.entries(g)) {
|
|
124
126
|
if (t.startsWith(e, r)) {
|
|
125
127
|
if (f) {
|
|
126
128
|
return [ "$.", false, t.length - s, true ];
|
|
@@ -135,16 +137,16 @@ const y = (t, e) => {
|
|
|
135
137
|
a = false;
|
|
136
138
|
if (f) {
|
|
137
139
|
if (e > f) {
|
|
138
|
-
i.push(
|
|
140
|
+
i.push(m(f) + "-" + m(e));
|
|
139
141
|
} else if (e === f) {
|
|
140
|
-
i.push(
|
|
142
|
+
i.push(m(e));
|
|
141
143
|
}
|
|
142
144
|
f = "";
|
|
143
145
|
r++;
|
|
144
146
|
continue;
|
|
145
147
|
}
|
|
146
148
|
if (t.startsWith("-]", r + 1)) {
|
|
147
|
-
i.push(
|
|
149
|
+
i.push(m(e + "-"));
|
|
148
150
|
r += 2;
|
|
149
151
|
continue;
|
|
150
152
|
}
|
|
@@ -153,7 +155,7 @@ const y = (t, e) => {
|
|
|
153
155
|
r += 2;
|
|
154
156
|
continue;
|
|
155
157
|
}
|
|
156
|
-
i.push(
|
|
158
|
+
i.push(m(e));
|
|
157
159
|
r++;
|
|
158
160
|
}
|
|
159
161
|
if (c < r) {
|
|
@@ -164,37 +166,37 @@ const y = (t, e) => {
|
|
|
164
166
|
}
|
|
165
167
|
if (n.length === 0 && i.length === 1 && /^\\?.$/.test(i[0]) && !l) {
|
|
166
168
|
const t = i[0].length === 2 ? i[0].slice(-1) : i[0];
|
|
167
|
-
return [
|
|
169
|
+
return [ w(t), false, c - s, false ];
|
|
168
170
|
}
|
|
169
|
-
const u = "[" + (l ? "^" : "") +
|
|
170
|
-
const d = "[" + (l ? "" : "^") +
|
|
171
|
-
const
|
|
172
|
-
return [
|
|
171
|
+
const u = "[" + (l ? "^" : "") + y(i) + "]";
|
|
172
|
+
const d = "[" + (l ? "" : "^") + y(n) + "]";
|
|
173
|
+
const p = i.length && n.length ? "(" + u + "|" + d + ")" : i.length ? u : d;
|
|
174
|
+
return [ p, h, c - s, true ];
|
|
173
175
|
};
|
|
174
176
|
|
|
175
|
-
const
|
|
177
|
+
const S = (t, {windowsPathsNoEscape: e = false} = {}) => e ? t.replace(/\[([^\/\\])\]/g, "$1") : t.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
176
178
|
|
|
177
|
-
const
|
|
179
|
+
const k = new Set([ "!", "?", "+", "*", "@" ]);
|
|
178
180
|
|
|
179
|
-
const
|
|
181
|
+
const v = t => k.has(t);
|
|
180
182
|
|
|
181
|
-
const
|
|
183
|
+
const x = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
182
184
|
|
|
183
|
-
const
|
|
185
|
+
const E = "(?!\\.)";
|
|
184
186
|
|
|
185
|
-
const
|
|
187
|
+
const T = new Set([ "[", "." ]);
|
|
186
188
|
|
|
187
|
-
const
|
|
189
|
+
const C = new Set([ "..", "." ]);
|
|
188
190
|
|
|
189
191
|
const L = new Set("().*{}+?[]^$\\!");
|
|
190
192
|
|
|
191
193
|
const A = t => t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
192
194
|
|
|
193
|
-
const
|
|
195
|
+
const M = "[^/]";
|
|
194
196
|
|
|
195
|
-
const P =
|
|
197
|
+
const P = M + "*?";
|
|
196
198
|
|
|
197
|
-
const F =
|
|
199
|
+
const F = M + "+?";
|
|
198
200
|
|
|
199
201
|
class AST {
|
|
200
202
|
type;
|
|
@@ -340,7 +342,7 @@ class AST {
|
|
|
340
342
|
l += s;
|
|
341
343
|
continue;
|
|
342
344
|
}
|
|
343
|
-
if (!i.noext &&
|
|
345
|
+
if (!i.noext && v(s) && t.charAt(a) === "(") {
|
|
344
346
|
e.push(l);
|
|
345
347
|
l = "";
|
|
346
348
|
const n = new AST(s, e);
|
|
@@ -381,7 +383,7 @@ class AST {
|
|
|
381
383
|
f += s;
|
|
382
384
|
continue;
|
|
383
385
|
}
|
|
384
|
-
if (
|
|
386
|
+
if (v(s) && t.charAt(a) === "(") {
|
|
385
387
|
l.push(f);
|
|
386
388
|
f = "";
|
|
387
389
|
const e = new AST(s, l);
|
|
@@ -431,6 +433,9 @@ class AST {
|
|
|
431
433
|
_glob: t
|
|
432
434
|
});
|
|
433
435
|
}
|
|
436
|
+
get options() {
|
|
437
|
+
return this.#a;
|
|
438
|
+
}
|
|
434
439
|
toRegExpSource(t) {
|
|
435
440
|
const e = t ?? !!this.#a.dot;
|
|
436
441
|
if (this.#t === this) this.#f();
|
|
@@ -445,12 +450,12 @@ class AST {
|
|
|
445
450
|
let n = "";
|
|
446
451
|
if (this.isStart()) {
|
|
447
452
|
if (typeof this.#i[0] === "string") {
|
|
448
|
-
const s = this.#i.length === 1 &&
|
|
453
|
+
const s = this.#i.length === 1 && C.has(this.#i[0]);
|
|
449
454
|
if (!s) {
|
|
450
|
-
const s =
|
|
455
|
+
const s = T;
|
|
451
456
|
const r = e && s.has(i.charAt(0)) || i.startsWith("\\.") && s.has(i.charAt(2)) || i.startsWith("\\.\\.") && s.has(i.charAt(4));
|
|
452
457
|
const o = !e && !t && s.has(i.charAt(0));
|
|
453
|
-
n = r ?
|
|
458
|
+
n = r ? x : o ? E : "";
|
|
454
459
|
}
|
|
455
460
|
}
|
|
456
461
|
}
|
|
@@ -459,7 +464,7 @@ class AST {
|
|
|
459
464
|
r = "(?:$|\\/)";
|
|
460
465
|
}
|
|
461
466
|
const o = n + i + r;
|
|
462
|
-
return [ o,
|
|
467
|
+
return [ o, S(i), this.#e = !!this.#e, this.#s ];
|
|
463
468
|
}
|
|
464
469
|
const s = this.type === "*" || this.type === "+";
|
|
465
470
|
const i = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
@@ -469,9 +474,9 @@ class AST {
|
|
|
469
474
|
this.#i = [ t ];
|
|
470
475
|
this.type = null;
|
|
471
476
|
this.#e = undefined;
|
|
472
|
-
return [ t,
|
|
477
|
+
return [ t, S(this.toString()), false, false ];
|
|
473
478
|
}
|
|
474
|
-
let r = !s || t || e || !
|
|
479
|
+
let r = !s || t || e || !E ? "" : this.#p(true);
|
|
475
480
|
if (r === n) {
|
|
476
481
|
r = "";
|
|
477
482
|
}
|
|
@@ -480,12 +485,12 @@ class AST {
|
|
|
480
485
|
}
|
|
481
486
|
let o = "";
|
|
482
487
|
if (this.type === "!" && this.#c) {
|
|
483
|
-
o = (this.isStart() && !e ?
|
|
488
|
+
o = (this.isStart() && !e ? E : "") + F;
|
|
484
489
|
} else {
|
|
485
|
-
const s = this.type === "!" ? "))" + (this.isStart() && !e && !t ?
|
|
490
|
+
const s = this.type === "!" ? "))" + (this.isStart() && !e && !t ? E : "") + P + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && r ? ")" : this.type === "*" && r ? `)?` : `)${this.type}`;
|
|
486
491
|
o = i + n + s;
|
|
487
492
|
}
|
|
488
|
-
return [ o,
|
|
493
|
+
return [ o, S(n), this.#e = !!this.#e, this.#s ];
|
|
489
494
|
}
|
|
490
495
|
#p(t) {
|
|
491
496
|
return this.#i.map((e => {
|
|
@@ -517,7 +522,7 @@ class AST {
|
|
|
517
522
|
continue;
|
|
518
523
|
}
|
|
519
524
|
if (h === "[") {
|
|
520
|
-
const [s, i, h, a] =
|
|
525
|
+
const [s, i, h, a] = b(t, o);
|
|
521
526
|
if (h) {
|
|
522
527
|
n += s;
|
|
523
528
|
r = r || i;
|
|
@@ -532,20 +537,20 @@ class AST {
|
|
|
532
537
|
continue;
|
|
533
538
|
}
|
|
534
539
|
if (h === "?") {
|
|
535
|
-
n +=
|
|
540
|
+
n += M;
|
|
536
541
|
e = true;
|
|
537
542
|
continue;
|
|
538
543
|
}
|
|
539
544
|
n += A(h);
|
|
540
545
|
}
|
|
541
|
-
return [ n,
|
|
546
|
+
return [ n, S(t), !!e, r ];
|
|
542
547
|
}
|
|
543
548
|
}
|
|
544
549
|
|
|
545
|
-
const
|
|
550
|
+
const R = (t, {windowsPathsNoEscape: e = false} = {}) => e ? t.replace(/[?*()[\]]/g, "[$&]") : t.replace(/[?*()[\]\\]/g, "\\$&");
|
|
546
551
|
|
|
547
|
-
const
|
|
548
|
-
|
|
552
|
+
const z = (t, e, s = {}) => {
|
|
553
|
+
p(e);
|
|
549
554
|
if (!s.nocomment && e.charAt(0) === "#") {
|
|
550
555
|
return false;
|
|
551
556
|
}
|
|
@@ -554,75 +559,75 @@ const R = (t, e, s = {}) => {
|
|
|
554
559
|
|
|
555
560
|
const O = /^\*+([^+@!?\*\[\(]*)$/;
|
|
556
561
|
|
|
557
|
-
const
|
|
562
|
+
const D = t => e => !e.startsWith(".") && e.endsWith(t);
|
|
558
563
|
|
|
559
|
-
const
|
|
564
|
+
const N = t => e => e.endsWith(t);
|
|
560
565
|
|
|
561
|
-
const
|
|
566
|
+
const B = t => {
|
|
562
567
|
t = t.toLowerCase();
|
|
563
568
|
return e => !e.startsWith(".") && e.toLowerCase().endsWith(t);
|
|
564
569
|
};
|
|
565
570
|
|
|
566
|
-
const
|
|
571
|
+
const W = t => {
|
|
567
572
|
t = t.toLowerCase();
|
|
568
573
|
return e => e.toLowerCase().endsWith(t);
|
|
569
574
|
};
|
|
570
575
|
|
|
571
|
-
const
|
|
576
|
+
const _ = /^\*+\.\*+$/;
|
|
572
577
|
|
|
573
|
-
const
|
|
578
|
+
const I = t => !t.startsWith(".") && t.includes(".");
|
|
574
579
|
|
|
575
|
-
const
|
|
580
|
+
const j = t => t !== "." && t !== ".." && t.includes(".");
|
|
576
581
|
|
|
577
|
-
const
|
|
582
|
+
const U = /^\.\*+$/;
|
|
578
583
|
|
|
579
|
-
const
|
|
584
|
+
const G = t => t !== "." && t !== ".." && t.startsWith(".");
|
|
580
585
|
|
|
581
|
-
const
|
|
586
|
+
const $ = /^\*+$/;
|
|
582
587
|
|
|
583
|
-
const
|
|
588
|
+
const q = t => t.length !== 0 && !t.startsWith(".");
|
|
584
589
|
|
|
585
|
-
const
|
|
590
|
+
const H = t => t.length !== 0 && t !== "." && t !== "..";
|
|
586
591
|
|
|
587
|
-
const
|
|
592
|
+
const Z = /^\?+([^+@!?\*\[\(]*)?$/;
|
|
588
593
|
|
|
589
|
-
const
|
|
590
|
-
const s =
|
|
594
|
+
const V = ([t, e = ""]) => {
|
|
595
|
+
const s = X([ t ]);
|
|
591
596
|
if (!e) return s;
|
|
592
597
|
e = e.toLowerCase();
|
|
593
598
|
return t => s(t) && t.toLowerCase().endsWith(e);
|
|
594
599
|
};
|
|
595
600
|
|
|
596
|
-
const
|
|
597
|
-
const s =
|
|
601
|
+
const J = ([t, e = ""]) => {
|
|
602
|
+
const s = Q([ t ]);
|
|
598
603
|
if (!e) return s;
|
|
599
604
|
e = e.toLowerCase();
|
|
600
605
|
return t => s(t) && t.toLowerCase().endsWith(e);
|
|
601
606
|
};
|
|
602
607
|
|
|
603
|
-
const
|
|
604
|
-
const s =
|
|
608
|
+
const K = ([t, e = ""]) => {
|
|
609
|
+
const s = Q([ t ]);
|
|
605
610
|
return !e ? s : t => s(t) && t.endsWith(e);
|
|
606
611
|
};
|
|
607
612
|
|
|
608
|
-
const
|
|
609
|
-
const s =
|
|
613
|
+
const Y = ([t, e = ""]) => {
|
|
614
|
+
const s = X([ t ]);
|
|
610
615
|
return !e ? s : t => s(t) && t.endsWith(e);
|
|
611
616
|
};
|
|
612
617
|
|
|
613
|
-
const
|
|
618
|
+
const X = ([t]) => {
|
|
614
619
|
const e = t.length;
|
|
615
620
|
return t => t.length === e && !t.startsWith(".");
|
|
616
621
|
};
|
|
617
622
|
|
|
618
|
-
const
|
|
623
|
+
const Q = ([t]) => {
|
|
619
624
|
const e = t.length;
|
|
620
625
|
return t => t.length === e && t !== "." && t !== "..";
|
|
621
626
|
};
|
|
622
627
|
|
|
623
|
-
const
|
|
628
|
+
const tt = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
624
629
|
|
|
625
|
-
const
|
|
630
|
+
const et = {
|
|
626
631
|
win32: {
|
|
627
632
|
sep: "\\"
|
|
628
633
|
},
|
|
@@ -631,80 +636,80 @@ const tt = {
|
|
|
631
636
|
}
|
|
632
637
|
};
|
|
633
638
|
|
|
634
|
-
const
|
|
639
|
+
const st = tt === "win32" ? et.win32.sep : et.posix.sep;
|
|
635
640
|
|
|
636
|
-
|
|
641
|
+
z.sep = st;
|
|
637
642
|
|
|
638
|
-
const
|
|
643
|
+
const it = Symbol("globstar **");
|
|
639
644
|
|
|
640
|
-
|
|
645
|
+
z.GLOBSTAR = it;
|
|
641
646
|
|
|
642
|
-
const
|
|
647
|
+
const nt = "[^/]";
|
|
643
648
|
|
|
644
|
-
const
|
|
649
|
+
const rt = nt + "*?";
|
|
645
650
|
|
|
646
|
-
const
|
|
651
|
+
const ot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
647
652
|
|
|
648
|
-
const
|
|
653
|
+
const ht = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
649
654
|
|
|
650
|
-
const
|
|
655
|
+
const at = (t, e = {}) => s => z(s, t, e);
|
|
651
656
|
|
|
652
|
-
|
|
657
|
+
z.filter = at;
|
|
653
658
|
|
|
654
|
-
const
|
|
659
|
+
const lt = (t, e = {}) => Object.assign({}, t, e);
|
|
655
660
|
|
|
656
|
-
const
|
|
661
|
+
const ct = t => {
|
|
657
662
|
if (!t || typeof t !== "object" || !Object.keys(t).length) {
|
|
658
|
-
return
|
|
663
|
+
return z;
|
|
659
664
|
}
|
|
660
|
-
const e =
|
|
661
|
-
const s = (s, i, n = {}) => e(s, i,
|
|
665
|
+
const e = z;
|
|
666
|
+
const s = (s, i, n = {}) => e(s, i, lt(t, n));
|
|
662
667
|
return Object.assign(s, {
|
|
663
668
|
Minimatch: class Minimatch extends e.Minimatch {
|
|
664
669
|
constructor(e, s = {}) {
|
|
665
|
-
super(e,
|
|
670
|
+
super(e, lt(t, s));
|
|
666
671
|
}
|
|
667
672
|
static defaults(s) {
|
|
668
|
-
return e.defaults(
|
|
673
|
+
return e.defaults(lt(t, s)).Minimatch;
|
|
669
674
|
}
|
|
670
675
|
},
|
|
671
676
|
AST: class AST extends e.AST {
|
|
672
677
|
constructor(e, s, i = {}) {
|
|
673
|
-
super(e, s,
|
|
678
|
+
super(e, s, lt(t, i));
|
|
674
679
|
}
|
|
675
680
|
static fromGlob(s, i = {}) {
|
|
676
|
-
return e.AST.fromGlob(s,
|
|
681
|
+
return e.AST.fromGlob(s, lt(t, i));
|
|
677
682
|
}
|
|
678
683
|
},
|
|
679
|
-
unescape: (s, i = {}) => e.unescape(s,
|
|
680
|
-
escape: (s, i = {}) => e.escape(s,
|
|
681
|
-
filter: (s, i = {}) => e.filter(s,
|
|
682
|
-
defaults: s => e.defaults(
|
|
683
|
-
makeRe: (s, i = {}) => e.makeRe(s,
|
|
684
|
-
braceExpand: (s, i = {}) => e.braceExpand(s,
|
|
685
|
-
match: (s, i, n = {}) => e.match(s, i,
|
|
684
|
+
unescape: (s, i = {}) => e.unescape(s, lt(t, i)),
|
|
685
|
+
escape: (s, i = {}) => e.escape(s, lt(t, i)),
|
|
686
|
+
filter: (s, i = {}) => e.filter(s, lt(t, i)),
|
|
687
|
+
defaults: s => e.defaults(lt(t, s)),
|
|
688
|
+
makeRe: (s, i = {}) => e.makeRe(s, lt(t, i)),
|
|
689
|
+
braceExpand: (s, i = {}) => e.braceExpand(s, lt(t, i)),
|
|
690
|
+
match: (s, i, n = {}) => e.match(s, i, lt(t, n)),
|
|
686
691
|
sep: e.sep,
|
|
687
|
-
GLOBSTAR:
|
|
692
|
+
GLOBSTAR: it
|
|
688
693
|
});
|
|
689
694
|
};
|
|
690
695
|
|
|
691
|
-
|
|
696
|
+
z.defaults = ct;
|
|
692
697
|
|
|
693
|
-
const
|
|
694
|
-
|
|
698
|
+
const ft = (e, s = {}) => {
|
|
699
|
+
p(e);
|
|
695
700
|
if (s.nobrace || !/\{(?:(?!\{).)*\}/.test(e)) {
|
|
696
701
|
return [ e ];
|
|
697
702
|
}
|
|
698
703
|
return t.expand(e);
|
|
699
704
|
};
|
|
700
705
|
|
|
701
|
-
|
|
706
|
+
z.braceExpand = ft;
|
|
702
707
|
|
|
703
|
-
const
|
|
708
|
+
const ut = (t, e = {}) => new Minimatch(t, e).makeRe();
|
|
704
709
|
|
|
705
|
-
|
|
710
|
+
z.makeRe = ut;
|
|
706
711
|
|
|
707
|
-
const
|
|
712
|
+
const dt = (t, e, s = {}) => {
|
|
708
713
|
const i = new Minimatch(e, s);
|
|
709
714
|
t = t.filter((t => i.match(t)));
|
|
710
715
|
if (i.options.nonull && !t.length) {
|
|
@@ -713,11 +718,11 @@ const ut = (t, e, s = {}) => {
|
|
|
713
718
|
return t;
|
|
714
719
|
};
|
|
715
720
|
|
|
716
|
-
|
|
721
|
+
z.match = dt;
|
|
717
722
|
|
|
718
|
-
const
|
|
723
|
+
const pt = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
719
724
|
|
|
720
|
-
const
|
|
725
|
+
const gt = t => t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
721
726
|
|
|
722
727
|
class Minimatch {
|
|
723
728
|
options;
|
|
@@ -738,11 +743,11 @@ class Minimatch {
|
|
|
738
743
|
windowsNoMagicRoot;
|
|
739
744
|
regexp;
|
|
740
745
|
constructor(t, e = {}) {
|
|
741
|
-
|
|
746
|
+
p(t);
|
|
742
747
|
e = e || {};
|
|
743
748
|
this.options = e;
|
|
744
749
|
this.pattern = t;
|
|
745
|
-
this.platform = e.platform ||
|
|
750
|
+
this.platform = e.platform || tt;
|
|
746
751
|
this.isWindows = this.platform === "win32";
|
|
747
752
|
this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === false;
|
|
748
753
|
if (this.windowsPathsNoEscape) {
|
|
@@ -796,7 +801,7 @@ class Minimatch {
|
|
|
796
801
|
this.debug(this.pattern, this.globParts);
|
|
797
802
|
let i = this.globParts.map(((t, e, s) => {
|
|
798
803
|
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
799
|
-
const e = t[0] === "" && t[1] === "" && (t[2] === "?" || !
|
|
804
|
+
const e = t[0] === "" && t[1] === "" && (t[2] === "?" || !pt.test(t[2])) && !pt.test(t[3]);
|
|
800
805
|
const s = /^[a-z]:/i.test(t[0]);
|
|
801
806
|
if (e) {
|
|
802
807
|
return [ ...t.slice(0, 4), ...t.slice(4).map((t => this.parse(t))) ];
|
|
@@ -970,9 +975,11 @@ class Minimatch {
|
|
|
970
975
|
for (let e = 0; e < t.length - 1; e++) {
|
|
971
976
|
for (let s = e + 1; s < t.length; s++) {
|
|
972
977
|
const i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
|
|
973
|
-
if (
|
|
974
|
-
|
|
975
|
-
|
|
978
|
+
if (i) {
|
|
979
|
+
t[e] = [];
|
|
980
|
+
t[s] = i;
|
|
981
|
+
break;
|
|
982
|
+
}
|
|
976
983
|
}
|
|
977
984
|
}
|
|
978
985
|
return t.filter((t => t.length));
|
|
@@ -1061,7 +1068,7 @@ class Minimatch {
|
|
|
1061
1068
|
if (l === false) {
|
|
1062
1069
|
return false;
|
|
1063
1070
|
}
|
|
1064
|
-
if (l ===
|
|
1071
|
+
if (l === it) {
|
|
1065
1072
|
this.debug("GLOBSTAR", [ e, l, c ]);
|
|
1066
1073
|
var f = r;
|
|
1067
1074
|
var u = o + 1;
|
|
@@ -1116,30 +1123,33 @@ class Minimatch {
|
|
|
1116
1123
|
}
|
|
1117
1124
|
}
|
|
1118
1125
|
braceExpand() {
|
|
1119
|
-
return
|
|
1126
|
+
return ft(this.pattern, this.options);
|
|
1120
1127
|
}
|
|
1121
1128
|
parse(t) {
|
|
1122
|
-
|
|
1129
|
+
p(t);
|
|
1123
1130
|
const e = this.options;
|
|
1124
|
-
if (t === "**") return
|
|
1131
|
+
if (t === "**") return it;
|
|
1125
1132
|
if (t === "") return "";
|
|
1126
1133
|
let s;
|
|
1127
1134
|
let i = null;
|
|
1128
|
-
if (s = t.match(
|
|
1129
|
-
i = e.dot ?
|
|
1135
|
+
if (s = t.match($)) {
|
|
1136
|
+
i = e.dot ? H : q;
|
|
1130
1137
|
} else if (s = t.match(O)) {
|
|
1131
|
-
i = (e.nocase ? e.dot ?
|
|
1132
|
-
} else if (s = t.match(
|
|
1133
|
-
i = (e.nocase ? e.dot ?
|
|
1134
|
-
} else if (s = t.match(
|
|
1135
|
-
i = e.dot ?
|
|
1136
|
-
} else if (s = t.match(
|
|
1137
|
-
i =
|
|
1138
|
+
i = (e.nocase ? e.dot ? W : B : e.dot ? N : D)(s[1]);
|
|
1139
|
+
} else if (s = t.match(Z)) {
|
|
1140
|
+
i = (e.nocase ? e.dot ? J : V : e.dot ? K : Y)(s);
|
|
1141
|
+
} else if (s = t.match(_)) {
|
|
1142
|
+
i = e.dot ? j : I;
|
|
1143
|
+
} else if (s = t.match(U)) {
|
|
1144
|
+
i = G;
|
|
1138
1145
|
}
|
|
1139
1146
|
const n = AST.fromGlob(t, this.options).toMMPattern();
|
|
1140
|
-
|
|
1141
|
-
test
|
|
1142
|
-
|
|
1147
|
+
if (i && typeof n === "object") {
|
|
1148
|
+
Reflect.defineProperty(n, "test", {
|
|
1149
|
+
value: i
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
return n;
|
|
1143
1153
|
}
|
|
1144
1154
|
makeRe() {
|
|
1145
1155
|
if (this.regexp || this.regexp === false) return this.regexp;
|
|
@@ -1149,35 +1159,35 @@ class Minimatch {
|
|
|
1149
1159
|
return this.regexp;
|
|
1150
1160
|
}
|
|
1151
1161
|
const e = this.options;
|
|
1152
|
-
const s = e.noglobstar ?
|
|
1162
|
+
const s = e.noglobstar ? rt : e.dot ? ot : ht;
|
|
1153
1163
|
const i = new Set(e.nocase ? [ "i" ] : []);
|
|
1154
1164
|
let n = t.map((t => {
|
|
1155
1165
|
const e = t.map((t => {
|
|
1156
1166
|
if (t instanceof RegExp) {
|
|
1157
1167
|
for (const e of t.flags.split("")) i.add(e);
|
|
1158
1168
|
}
|
|
1159
|
-
return typeof t === "string" ?
|
|
1169
|
+
return typeof t === "string" ? gt(t) : t === it ? it : t._src;
|
|
1160
1170
|
}));
|
|
1161
1171
|
e.forEach(((t, i) => {
|
|
1162
1172
|
const n = e[i + 1];
|
|
1163
1173
|
const r = e[i - 1];
|
|
1164
|
-
if (t !==
|
|
1174
|
+
if (t !== it || r === it) {
|
|
1165
1175
|
return;
|
|
1166
1176
|
}
|
|
1167
1177
|
if (r === undefined) {
|
|
1168
|
-
if (n !== undefined && n !==
|
|
1178
|
+
if (n !== undefined && n !== it) {
|
|
1169
1179
|
e[i + 1] = "(?:\\/|" + s + "\\/)?" + n;
|
|
1170
1180
|
} else {
|
|
1171
1181
|
e[i] = s;
|
|
1172
1182
|
}
|
|
1173
1183
|
} else if (n === undefined) {
|
|
1174
1184
|
e[i - 1] = r + "(?:\\/|" + s + ")?";
|
|
1175
|
-
} else if (n !==
|
|
1185
|
+
} else if (n !== it) {
|
|
1176
1186
|
e[i - 1] = r + "(?:\\/|\\/" + s + "\\/)" + n;
|
|
1177
|
-
e[i + 1] =
|
|
1187
|
+
e[i + 1] = it;
|
|
1178
1188
|
}
|
|
1179
1189
|
}));
|
|
1180
|
-
return e.filter((t => t !==
|
|
1190
|
+
return e.filter((t => t !== it)).join("/");
|
|
1181
1191
|
})).join("|");
|
|
1182
1192
|
const [r, o] = t.length > 1 ? [ "(?:", ")" ] : [ "", "" ];
|
|
1183
1193
|
n = "^" + r + n + o + "$";
|
|
@@ -1243,34 +1253,34 @@ class Minimatch {
|
|
|
1243
1253
|
return this.negate;
|
|
1244
1254
|
}
|
|
1245
1255
|
static defaults(t) {
|
|
1246
|
-
return
|
|
1256
|
+
return z.defaults(t).Minimatch;
|
|
1247
1257
|
}
|
|
1248
1258
|
}
|
|
1249
1259
|
|
|
1250
|
-
|
|
1260
|
+
z.AST = AST;
|
|
1251
1261
|
|
|
1252
|
-
|
|
1262
|
+
z.Minimatch = Minimatch;
|
|
1253
1263
|
|
|
1254
|
-
|
|
1264
|
+
z.escape = R;
|
|
1255
1265
|
|
|
1256
|
-
|
|
1266
|
+
z.unescape = S;
|
|
1257
1267
|
|
|
1258
|
-
const
|
|
1268
|
+
const mt = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
|
|
1259
1269
|
|
|
1260
|
-
const
|
|
1270
|
+
const wt = new Set;
|
|
1261
1271
|
|
|
1262
|
-
const
|
|
1272
|
+
const yt = typeof process === "object" && !!process ? process : {};
|
|
1263
1273
|
|
|
1264
|
-
const
|
|
1265
|
-
typeof
|
|
1274
|
+
const bt = (t, e, s, i) => {
|
|
1275
|
+
typeof yt.emitWarning === "function" ? yt.emitWarning(t, e, s, i) : console.error(`[${s}] ${e}: ${t}`);
|
|
1266
1276
|
};
|
|
1267
1277
|
|
|
1268
|
-
let
|
|
1278
|
+
let St = globalThis.AbortController;
|
|
1269
1279
|
|
|
1270
|
-
let
|
|
1280
|
+
let kt = globalThis.AbortSignal;
|
|
1271
1281
|
|
|
1272
|
-
if (typeof
|
|
1273
|
-
|
|
1282
|
+
if (typeof St === "undefined") {
|
|
1283
|
+
kt = class AbortSignal {
|
|
1274
1284
|
onabort;
|
|
1275
1285
|
_onabort=[];
|
|
1276
1286
|
reason;
|
|
@@ -1279,11 +1289,11 @@ if (typeof bt === "undefined") {
|
|
|
1279
1289
|
this._onabort.push(e);
|
|
1280
1290
|
}
|
|
1281
1291
|
};
|
|
1282
|
-
|
|
1292
|
+
St = class AbortController {
|
|
1283
1293
|
constructor() {
|
|
1284
1294
|
e();
|
|
1285
1295
|
}
|
|
1286
|
-
signal=new
|
|
1296
|
+
signal=new kt;
|
|
1287
1297
|
abort(t) {
|
|
1288
1298
|
if (this.signal.aborted) return;
|
|
1289
1299
|
this.signal.reason = t;
|
|
@@ -1294,21 +1304,21 @@ if (typeof bt === "undefined") {
|
|
|
1294
1304
|
this.signal.onabort?.(t);
|
|
1295
1305
|
}
|
|
1296
1306
|
};
|
|
1297
|
-
let t =
|
|
1307
|
+
let t = yt.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
|
|
1298
1308
|
const e = () => {
|
|
1299
1309
|
if (!t) return;
|
|
1300
1310
|
t = false;
|
|
1301
|
-
|
|
1311
|
+
bt("AbortController is not defined. If using lru-cache in " + "node 14, load an AbortController polyfill from the " + "`node-abort-controller` package. A minimal polyfill is " + "provided for use by LRUCache.fetch(), but it should not be " + "relied upon in other contexts (eg, passing it to other APIs that " + "use AbortController/AbortSignal might have undesirable effects). " + "You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", e);
|
|
1302
1312
|
};
|
|
1303
1313
|
}
|
|
1304
1314
|
|
|
1305
|
-
const
|
|
1315
|
+
const vt = t => !wt.has(t);
|
|
1306
1316
|
|
|
1307
|
-
const
|
|
1317
|
+
const xt = Symbol("type");
|
|
1308
1318
|
|
|
1309
|
-
const
|
|
1319
|
+
const Et = t => t && t === Math.floor(t) && t > 0 && isFinite(t);
|
|
1310
1320
|
|
|
1311
|
-
const
|
|
1321
|
+
const Tt = t => !Et(t) ? null : t <= Math.pow(2, 8) ? Uint8Array : t <= Math.pow(2, 16) ? Uint16Array : t <= Math.pow(2, 32) ? Uint32Array : t <= Number.MAX_SAFE_INTEGER ? ZeroArray : null;
|
|
1312
1322
|
|
|
1313
1323
|
class ZeroArray extends Array {
|
|
1314
1324
|
constructor(t) {
|
|
@@ -1322,7 +1332,7 @@ class Stack {
|
|
|
1322
1332
|
length;
|
|
1323
1333
|
static #g=false;
|
|
1324
1334
|
static create(t) {
|
|
1325
|
-
const e =
|
|
1335
|
+
const e = Tt(t);
|
|
1326
1336
|
if (!e) return [];
|
|
1327
1337
|
Stack.#g = true;
|
|
1328
1338
|
const s = new Stack(t, e);
|
|
@@ -1350,6 +1360,7 @@ class LRUCache {
|
|
|
1350
1360
|
#y;
|
|
1351
1361
|
#b;
|
|
1352
1362
|
#S;
|
|
1363
|
+
#k;
|
|
1353
1364
|
ttl;
|
|
1354
1365
|
ttlResolution;
|
|
1355
1366
|
ttlAutopurge;
|
|
@@ -1365,46 +1376,46 @@ class LRUCache {
|
|
|
1365
1376
|
allowStaleOnFetchAbort;
|
|
1366
1377
|
allowStaleOnFetchRejection;
|
|
1367
1378
|
ignoreFetchAbort;
|
|
1368
|
-
#k;
|
|
1369
1379
|
#v;
|
|
1370
1380
|
#x;
|
|
1371
1381
|
#E;
|
|
1372
1382
|
#T;
|
|
1383
|
+
#C;
|
|
1373
1384
|
#L;
|
|
1374
1385
|
#A;
|
|
1375
|
-
#
|
|
1386
|
+
#M;
|
|
1376
1387
|
#P;
|
|
1377
1388
|
#F;
|
|
1378
|
-
#M;
|
|
1379
1389
|
#R;
|
|
1380
|
-
#O;
|
|
1381
1390
|
#z;
|
|
1391
|
+
#O;
|
|
1382
1392
|
#D;
|
|
1383
1393
|
#N;
|
|
1384
1394
|
#B;
|
|
1395
|
+
#W;
|
|
1385
1396
|
static unsafeExposeInternals(t) {
|
|
1386
1397
|
return {
|
|
1387
1398
|
starts: t.#O,
|
|
1388
|
-
ttls: t.#
|
|
1389
|
-
sizes: t.#
|
|
1390
|
-
keyMap: t.#
|
|
1391
|
-
keyList: t.#
|
|
1392
|
-
valList: t.#
|
|
1399
|
+
ttls: t.#D,
|
|
1400
|
+
sizes: t.#z,
|
|
1401
|
+
keyMap: t.#E,
|
|
1402
|
+
keyList: t.#T,
|
|
1403
|
+
valList: t.#C,
|
|
1393
1404
|
next: t.#L,
|
|
1394
1405
|
prev: t.#A,
|
|
1395
1406
|
get head() {
|
|
1396
|
-
return t.#
|
|
1407
|
+
return t.#M;
|
|
1397
1408
|
},
|
|
1398
1409
|
get tail() {
|
|
1399
1410
|
return t.#P;
|
|
1400
1411
|
},
|
|
1401
1412
|
free: t.#F,
|
|
1402
|
-
isBackgroundFetch: e => t.#
|
|
1403
|
-
backgroundFetch: (e, s, i, n) => t.#
|
|
1404
|
-
moveToTail: e => t.#
|
|
1405
|
-
indexes: e => t.#
|
|
1406
|
-
rindexes: e => t.#
|
|
1407
|
-
isStale: e => t
|
|
1413
|
+
isBackgroundFetch: e => t.#_(e),
|
|
1414
|
+
backgroundFetch: (e, s, i, n) => t.#I(e, s, i, n),
|
|
1415
|
+
moveToTail: e => t.#j(e),
|
|
1416
|
+
indexes: e => t.#U(e),
|
|
1417
|
+
rindexes: e => t.#G(e),
|
|
1418
|
+
isStale: e => t.#$(e)
|
|
1408
1419
|
};
|
|
1409
1420
|
}
|
|
1410
1421
|
get max() {
|
|
@@ -1414,14 +1425,17 @@ class LRUCache {
|
|
|
1414
1425
|
return this.#w;
|
|
1415
1426
|
}
|
|
1416
1427
|
get calculatedSize() {
|
|
1417
|
-
return this.#
|
|
1428
|
+
return this.#x;
|
|
1418
1429
|
}
|
|
1419
1430
|
get size() {
|
|
1420
|
-
return this.#
|
|
1431
|
+
return this.#v;
|
|
1421
1432
|
}
|
|
1422
1433
|
get fetchMethod() {
|
|
1423
1434
|
return this.#S;
|
|
1424
1435
|
}
|
|
1436
|
+
get memoMethod() {
|
|
1437
|
+
return this.#k;
|
|
1438
|
+
}
|
|
1425
1439
|
get dispose() {
|
|
1426
1440
|
return this.#y;
|
|
1427
1441
|
}
|
|
@@ -1429,12 +1443,12 @@ class LRUCache {
|
|
|
1429
1443
|
return this.#b;
|
|
1430
1444
|
}
|
|
1431
1445
|
constructor(t) {
|
|
1432
|
-
const {max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: n, updateAgeOnGet: r, updateAgeOnHas: o, allowStale: h, dispose: a, disposeAfter: l, noDisposeOnSet: c, noUpdateTTL: f, maxSize: u = 0, maxEntrySize: d = 0, sizeCalculation: p, fetchMethod: g,
|
|
1433
|
-
if (e !== 0 && !
|
|
1446
|
+
const {max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: n, updateAgeOnGet: r, updateAgeOnHas: o, allowStale: h, dispose: a, disposeAfter: l, noDisposeOnSet: c, noUpdateTTL: f, maxSize: u = 0, maxEntrySize: d = 0, sizeCalculation: p, fetchMethod: g, memoMethod: m, noDeleteOnFetchRejection: w, noDeleteOnStaleGet: y, allowStaleOnFetchRejection: b, allowStaleOnFetchAbort: S, ignoreFetchAbort: k} = t;
|
|
1447
|
+
if (e !== 0 && !Et(e)) {
|
|
1434
1448
|
throw new TypeError("max option must be a nonnegative integer");
|
|
1435
1449
|
}
|
|
1436
|
-
const
|
|
1437
|
-
if (!
|
|
1450
|
+
const v = e ? Tt(e) : Array;
|
|
1451
|
+
if (!v) {
|
|
1438
1452
|
throw new Error("invalid max value: " + e);
|
|
1439
1453
|
}
|
|
1440
1454
|
this.#m = e;
|
|
@@ -1449,90 +1463,94 @@ class LRUCache {
|
|
|
1449
1463
|
throw new TypeError("sizeCalculation set to non-function");
|
|
1450
1464
|
}
|
|
1451
1465
|
}
|
|
1466
|
+
if (m !== undefined && typeof m !== "function") {
|
|
1467
|
+
throw new TypeError("memoMethod must be a function if defined");
|
|
1468
|
+
}
|
|
1469
|
+
this.#k = m;
|
|
1452
1470
|
if (g !== undefined && typeof g !== "function") {
|
|
1453
1471
|
throw new TypeError("fetchMethod must be a function if specified");
|
|
1454
1472
|
}
|
|
1455
1473
|
this.#S = g;
|
|
1456
|
-
this.#
|
|
1457
|
-
this.#
|
|
1458
|
-
this.#E = new Array(e).fill(undefined);
|
|
1474
|
+
this.#B = !!g;
|
|
1475
|
+
this.#E = new Map;
|
|
1459
1476
|
this.#T = new Array(e).fill(undefined);
|
|
1460
|
-
this.#
|
|
1461
|
-
this.#
|
|
1462
|
-
this.#
|
|
1477
|
+
this.#C = new Array(e).fill(undefined);
|
|
1478
|
+
this.#L = new v(e);
|
|
1479
|
+
this.#A = new v(e);
|
|
1480
|
+
this.#M = 0;
|
|
1463
1481
|
this.#P = 0;
|
|
1464
1482
|
this.#F = Stack.create(e);
|
|
1465
|
-
this.#k = 0;
|
|
1466
1483
|
this.#v = 0;
|
|
1484
|
+
this.#x = 0;
|
|
1467
1485
|
if (typeof a === "function") {
|
|
1468
1486
|
this.#y = a;
|
|
1469
1487
|
}
|
|
1470
1488
|
if (typeof l === "function") {
|
|
1471
1489
|
this.#b = l;
|
|
1472
|
-
this.#
|
|
1490
|
+
this.#R = [];
|
|
1473
1491
|
} else {
|
|
1474
1492
|
this.#b = undefined;
|
|
1475
|
-
this.#
|
|
1493
|
+
this.#R = undefined;
|
|
1476
1494
|
}
|
|
1477
|
-
this.#
|
|
1478
|
-
this.#
|
|
1495
|
+
this.#N = !!this.#y;
|
|
1496
|
+
this.#W = !!this.#b;
|
|
1479
1497
|
this.noDisposeOnSet = !!c;
|
|
1480
1498
|
this.noUpdateTTL = !!f;
|
|
1481
|
-
this.noDeleteOnFetchRejection = !!
|
|
1482
|
-
this.allowStaleOnFetchRejection = !!
|
|
1483
|
-
this.allowStaleOnFetchAbort = !!
|
|
1484
|
-
this.ignoreFetchAbort = !!
|
|
1499
|
+
this.noDeleteOnFetchRejection = !!w;
|
|
1500
|
+
this.allowStaleOnFetchRejection = !!b;
|
|
1501
|
+
this.allowStaleOnFetchAbort = !!S;
|
|
1502
|
+
this.ignoreFetchAbort = !!k;
|
|
1485
1503
|
if (this.maxEntrySize !== 0) {
|
|
1486
1504
|
if (this.#w !== 0) {
|
|
1487
|
-
if (!
|
|
1505
|
+
if (!Et(this.#w)) {
|
|
1488
1506
|
throw new TypeError("maxSize must be a positive integer if specified");
|
|
1489
1507
|
}
|
|
1490
1508
|
}
|
|
1491
|
-
if (!
|
|
1509
|
+
if (!Et(this.maxEntrySize)) {
|
|
1492
1510
|
throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
1493
1511
|
}
|
|
1494
|
-
this
|
|
1512
|
+
this.#q();
|
|
1495
1513
|
}
|
|
1496
1514
|
this.allowStale = !!h;
|
|
1497
|
-
this.noDeleteOnStaleGet = !!
|
|
1515
|
+
this.noDeleteOnStaleGet = !!y;
|
|
1498
1516
|
this.updateAgeOnGet = !!r;
|
|
1499
1517
|
this.updateAgeOnHas = !!o;
|
|
1500
|
-
this.ttlResolution =
|
|
1518
|
+
this.ttlResolution = Et(i) || i === 0 ? i : 1;
|
|
1501
1519
|
this.ttlAutopurge = !!n;
|
|
1502
1520
|
this.ttl = s || 0;
|
|
1503
1521
|
if (this.ttl) {
|
|
1504
|
-
if (!
|
|
1522
|
+
if (!Et(this.ttl)) {
|
|
1505
1523
|
throw new TypeError("ttl must be a positive integer if specified");
|
|
1506
1524
|
}
|
|
1507
|
-
this.#
|
|
1525
|
+
this.#H();
|
|
1508
1526
|
}
|
|
1509
1527
|
if (this.#m === 0 && this.ttl === 0 && this.#w === 0) {
|
|
1510
1528
|
throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
1511
1529
|
}
|
|
1512
1530
|
if (!this.ttlAutopurge && !this.#m && !this.#w) {
|
|
1513
1531
|
const t = "LRU_CACHE_UNBOUNDED";
|
|
1514
|
-
if (
|
|
1515
|
-
|
|
1532
|
+
if (vt(t)) {
|
|
1533
|
+
wt.add(t);
|
|
1516
1534
|
const e = "TTL caching without ttlAutopurge, max, or maxSize can " + "result in unbounded memory consumption.";
|
|
1517
|
-
|
|
1535
|
+
bt(e, "UnboundedCacheWarning", t, LRUCache);
|
|
1518
1536
|
}
|
|
1519
1537
|
}
|
|
1520
1538
|
}
|
|
1521
1539
|
getRemainingTTL(t) {
|
|
1522
|
-
return this.#
|
|
1540
|
+
return this.#E.has(t) ? Infinity : 0;
|
|
1523
1541
|
}
|
|
1524
|
-
#
|
|
1542
|
+
#H() {
|
|
1525
1543
|
const t = new ZeroArray(this.#m);
|
|
1526
1544
|
const e = new ZeroArray(this.#m);
|
|
1527
|
-
this.#
|
|
1545
|
+
this.#D = t;
|
|
1528
1546
|
this.#O = e;
|
|
1529
|
-
this.#
|
|
1547
|
+
this.#Z = (s, i, n = mt.now()) => {
|
|
1530
1548
|
e[s] = i !== 0 ? n : 0;
|
|
1531
1549
|
t[s] = i;
|
|
1532
1550
|
if (i !== 0 && this.ttlAutopurge) {
|
|
1533
1551
|
const t = setTimeout((() => {
|
|
1534
|
-
if (this
|
|
1535
|
-
this
|
|
1552
|
+
if (this.#$(s)) {
|
|
1553
|
+
this.#V(this.#T[s], "expire");
|
|
1536
1554
|
}
|
|
1537
1555
|
}), i + 1);
|
|
1538
1556
|
if (t.unref) {
|
|
@@ -1540,10 +1558,10 @@ class LRUCache {
|
|
|
1540
1558
|
}
|
|
1541
1559
|
}
|
|
1542
1560
|
};
|
|
1543
|
-
this.#
|
|
1544
|
-
e[s] = t[s] !== 0 ?
|
|
1561
|
+
this.#J = s => {
|
|
1562
|
+
e[s] = t[s] !== 0 ? mt.now() : 0;
|
|
1545
1563
|
};
|
|
1546
|
-
this.#
|
|
1564
|
+
this.#K = (n, r) => {
|
|
1547
1565
|
if (t[r]) {
|
|
1548
1566
|
const o = t[r];
|
|
1549
1567
|
const h = e[r];
|
|
@@ -1557,7 +1575,7 @@ class LRUCache {
|
|
|
1557
1575
|
};
|
|
1558
1576
|
let s = 0;
|
|
1559
1577
|
const i = () => {
|
|
1560
|
-
const t =
|
|
1578
|
+
const t = mt.now();
|
|
1561
1579
|
if (this.ttlResolution > 0) {
|
|
1562
1580
|
s = t;
|
|
1563
1581
|
const e = setTimeout((() => s = 0), this.ttlResolution);
|
|
@@ -1568,7 +1586,7 @@ class LRUCache {
|
|
|
1568
1586
|
return t;
|
|
1569
1587
|
};
|
|
1570
1588
|
this.getRemainingTTL = n => {
|
|
1571
|
-
const r = this.#
|
|
1589
|
+
const r = this.#E.get(n);
|
|
1572
1590
|
if (r === undefined) {
|
|
1573
1591
|
return 0;
|
|
1574
1592
|
}
|
|
@@ -1580,35 +1598,35 @@ class LRUCache {
|
|
|
1580
1598
|
const a = (s || i()) - h;
|
|
1581
1599
|
return o - a;
|
|
1582
1600
|
};
|
|
1583
|
-
this
|
|
1601
|
+
this.#$ = n => {
|
|
1584
1602
|
const r = e[n];
|
|
1585
1603
|
const o = t[n];
|
|
1586
1604
|
return !!o && !!r && (s || i()) - r > o;
|
|
1587
1605
|
};
|
|
1588
1606
|
}
|
|
1607
|
+
#J=() => {};
|
|
1608
|
+
#K=() => {};
|
|
1589
1609
|
#Z=() => {};
|
|
1590
|
-
|
|
1591
|
-
#
|
|
1592
|
-
#G=() => false;
|
|
1593
|
-
#$() {
|
|
1610
|
+
#$=() => false;
|
|
1611
|
+
#q() {
|
|
1594
1612
|
const t = new ZeroArray(this.#m);
|
|
1595
|
-
this.#
|
|
1596
|
-
this.#
|
|
1597
|
-
this.#
|
|
1598
|
-
this.#
|
|
1613
|
+
this.#x = 0;
|
|
1614
|
+
this.#z = t;
|
|
1615
|
+
this.#Y = e => {
|
|
1616
|
+
this.#x -= t[e];
|
|
1599
1617
|
t[e] = 0;
|
|
1600
1618
|
};
|
|
1601
|
-
this.#
|
|
1602
|
-
if (this.#
|
|
1619
|
+
this.#X = (t, e, s, i) => {
|
|
1620
|
+
if (this.#_(e)) {
|
|
1603
1621
|
return 0;
|
|
1604
1622
|
}
|
|
1605
|
-
if (!
|
|
1623
|
+
if (!Et(s)) {
|
|
1606
1624
|
if (i) {
|
|
1607
1625
|
if (typeof i !== "function") {
|
|
1608
1626
|
throw new TypeError("sizeCalculation must be a function");
|
|
1609
1627
|
}
|
|
1610
1628
|
s = i(e, t);
|
|
1611
|
-
if (!
|
|
1629
|
+
if (!Et(s)) {
|
|
1612
1630
|
throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
1613
1631
|
}
|
|
1614
1632
|
} else {
|
|
@@ -1617,39 +1635,39 @@ class LRUCache {
|
|
|
1617
1635
|
}
|
|
1618
1636
|
return s;
|
|
1619
1637
|
};
|
|
1620
|
-
this.#
|
|
1638
|
+
this.#Q = (e, s, i) => {
|
|
1621
1639
|
t[e] = s;
|
|
1622
1640
|
if (this.#w) {
|
|
1623
1641
|
const s = this.#w - t[e];
|
|
1624
|
-
while (this.#
|
|
1625
|
-
this.#
|
|
1642
|
+
while (this.#x > s) {
|
|
1643
|
+
this.#tt(true);
|
|
1626
1644
|
}
|
|
1627
1645
|
}
|
|
1628
|
-
this.#
|
|
1646
|
+
this.#x += t[e];
|
|
1629
1647
|
if (i) {
|
|
1630
1648
|
i.entrySize = s;
|
|
1631
|
-
i.totalCalculatedSize = this.#
|
|
1649
|
+
i.totalCalculatedSize = this.#x;
|
|
1632
1650
|
}
|
|
1633
1651
|
};
|
|
1634
1652
|
}
|
|
1635
|
-
#
|
|
1636
|
-
#
|
|
1637
|
-
#
|
|
1653
|
+
#Y=t => {};
|
|
1654
|
+
#Q=(t, e, s) => {};
|
|
1655
|
+
#X=(t, e, s, i) => {
|
|
1638
1656
|
if (s || i) {
|
|
1639
1657
|
throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
1640
1658
|
}
|
|
1641
1659
|
return 0;
|
|
1642
1660
|
};
|
|
1643
|
-
* #
|
|
1644
|
-
if (this.#
|
|
1661
|
+
* #U({allowStale: t = this.allowStale} = {}) {
|
|
1662
|
+
if (this.#v) {
|
|
1645
1663
|
for (let e = this.#P; true; ) {
|
|
1646
|
-
if (!this.#
|
|
1664
|
+
if (!this.#et(e)) {
|
|
1647
1665
|
break;
|
|
1648
1666
|
}
|
|
1649
|
-
if (t || !this
|
|
1667
|
+
if (t || !this.#$(e)) {
|
|
1650
1668
|
yield e;
|
|
1651
1669
|
}
|
|
1652
|
-
if (e === this.#
|
|
1670
|
+
if (e === this.#M) {
|
|
1653
1671
|
break;
|
|
1654
1672
|
} else {
|
|
1655
1673
|
e = this.#A[e];
|
|
@@ -1657,13 +1675,13 @@ class LRUCache {
|
|
|
1657
1675
|
}
|
|
1658
1676
|
}
|
|
1659
1677
|
}
|
|
1660
|
-
* #
|
|
1661
|
-
if (this.#
|
|
1662
|
-
for (let e = this.#
|
|
1663
|
-
if (!this.#
|
|
1678
|
+
* #G({allowStale: t = this.allowStale} = {}) {
|
|
1679
|
+
if (this.#v) {
|
|
1680
|
+
for (let e = this.#M; true; ) {
|
|
1681
|
+
if (!this.#et(e)) {
|
|
1664
1682
|
break;
|
|
1665
1683
|
}
|
|
1666
|
-
if (t || !this
|
|
1684
|
+
if (t || !this.#$(e)) {
|
|
1667
1685
|
yield e;
|
|
1668
1686
|
}
|
|
1669
1687
|
if (e === this.#P) {
|
|
@@ -1674,52 +1692,52 @@ class LRUCache {
|
|
|
1674
1692
|
}
|
|
1675
1693
|
}
|
|
1676
1694
|
}
|
|
1677
|
-
#
|
|
1678
|
-
return t !== undefined && this.#
|
|
1695
|
+
#et(t) {
|
|
1696
|
+
return t !== undefined && this.#E.get(this.#T[t]) === t;
|
|
1679
1697
|
}
|
|
1680
1698
|
* entries() {
|
|
1681
|
-
for (const t of this.#
|
|
1682
|
-
if (this.#
|
|
1683
|
-
yield [ this.#
|
|
1699
|
+
for (const t of this.#U()) {
|
|
1700
|
+
if (this.#C[t] !== undefined && this.#T[t] !== undefined && !this.#_(this.#C[t])) {
|
|
1701
|
+
yield [ this.#T[t], this.#C[t] ];
|
|
1684
1702
|
}
|
|
1685
1703
|
}
|
|
1686
1704
|
}
|
|
1687
1705
|
* rentries() {
|
|
1688
|
-
for (const t of this.#
|
|
1689
|
-
if (this.#
|
|
1690
|
-
yield [ this.#
|
|
1706
|
+
for (const t of this.#G()) {
|
|
1707
|
+
if (this.#C[t] !== undefined && this.#T[t] !== undefined && !this.#_(this.#C[t])) {
|
|
1708
|
+
yield [ this.#T[t], this.#C[t] ];
|
|
1691
1709
|
}
|
|
1692
1710
|
}
|
|
1693
1711
|
}
|
|
1694
1712
|
* keys() {
|
|
1695
|
-
for (const t of this.#
|
|
1696
|
-
const e = this.#
|
|
1697
|
-
if (e !== undefined && !this.#
|
|
1713
|
+
for (const t of this.#U()) {
|
|
1714
|
+
const e = this.#T[t];
|
|
1715
|
+
if (e !== undefined && !this.#_(this.#C[t])) {
|
|
1698
1716
|
yield e;
|
|
1699
1717
|
}
|
|
1700
1718
|
}
|
|
1701
1719
|
}
|
|
1702
1720
|
* rkeys() {
|
|
1703
|
-
for (const t of this.#
|
|
1704
|
-
const e = this.#
|
|
1705
|
-
if (e !== undefined && !this.#
|
|
1721
|
+
for (const t of this.#G()) {
|
|
1722
|
+
const e = this.#T[t];
|
|
1723
|
+
if (e !== undefined && !this.#_(this.#C[t])) {
|
|
1706
1724
|
yield e;
|
|
1707
1725
|
}
|
|
1708
1726
|
}
|
|
1709
1727
|
}
|
|
1710
1728
|
* values() {
|
|
1711
|
-
for (const t of this.#
|
|
1712
|
-
const e = this.#
|
|
1713
|
-
if (e !== undefined && !this.#
|
|
1714
|
-
yield this.#
|
|
1729
|
+
for (const t of this.#U()) {
|
|
1730
|
+
const e = this.#C[t];
|
|
1731
|
+
if (e !== undefined && !this.#_(this.#C[t])) {
|
|
1732
|
+
yield this.#C[t];
|
|
1715
1733
|
}
|
|
1716
1734
|
}
|
|
1717
1735
|
}
|
|
1718
1736
|
* rvalues() {
|
|
1719
|
-
for (const t of this.#
|
|
1720
|
-
const e = this.#
|
|
1721
|
-
if (e !== undefined && !this.#
|
|
1722
|
-
yield this.#
|
|
1737
|
+
for (const t of this.#G()) {
|
|
1738
|
+
const e = this.#C[t];
|
|
1739
|
+
if (e !== undefined && !this.#_(this.#C[t])) {
|
|
1740
|
+
yield this.#C[t];
|
|
1723
1741
|
}
|
|
1724
1742
|
}
|
|
1725
1743
|
}
|
|
@@ -1728,85 +1746,85 @@ class LRUCache {
|
|
|
1728
1746
|
}
|
|
1729
1747
|
[Symbol.toStringTag]="LRUCache";
|
|
1730
1748
|
find(t, e = {}) {
|
|
1731
|
-
for (const s of this.#
|
|
1732
|
-
const i = this.#
|
|
1733
|
-
const n = this.#
|
|
1749
|
+
for (const s of this.#U()) {
|
|
1750
|
+
const i = this.#C[s];
|
|
1751
|
+
const n = this.#_(i) ? i.__staleWhileFetching : i;
|
|
1734
1752
|
if (n === undefined) continue;
|
|
1735
|
-
if (t(n, this.#
|
|
1736
|
-
return this.get(this.#
|
|
1753
|
+
if (t(n, this.#T[s], this)) {
|
|
1754
|
+
return this.get(this.#T[s], e);
|
|
1737
1755
|
}
|
|
1738
1756
|
}
|
|
1739
1757
|
}
|
|
1740
1758
|
forEach(t, e = this) {
|
|
1741
|
-
for (const s of this.#
|
|
1742
|
-
const i = this.#
|
|
1743
|
-
const n = this.#
|
|
1759
|
+
for (const s of this.#U()) {
|
|
1760
|
+
const i = this.#C[s];
|
|
1761
|
+
const n = this.#_(i) ? i.__staleWhileFetching : i;
|
|
1744
1762
|
if (n === undefined) continue;
|
|
1745
|
-
t.call(e, n, this.#
|
|
1763
|
+
t.call(e, n, this.#T[s], this);
|
|
1746
1764
|
}
|
|
1747
1765
|
}
|
|
1748
1766
|
rforEach(t, e = this) {
|
|
1749
|
-
for (const s of this.#
|
|
1750
|
-
const i = this.#
|
|
1751
|
-
const n = this.#
|
|
1767
|
+
for (const s of this.#G()) {
|
|
1768
|
+
const i = this.#C[s];
|
|
1769
|
+
const n = this.#_(i) ? i.__staleWhileFetching : i;
|
|
1752
1770
|
if (n === undefined) continue;
|
|
1753
|
-
t.call(e, n, this.#
|
|
1771
|
+
t.call(e, n, this.#T[s], this);
|
|
1754
1772
|
}
|
|
1755
1773
|
}
|
|
1756
1774
|
purgeStale() {
|
|
1757
1775
|
let t = false;
|
|
1758
|
-
for (const e of this.#
|
|
1776
|
+
for (const e of this.#G({
|
|
1759
1777
|
allowStale: true
|
|
1760
1778
|
})) {
|
|
1761
|
-
if (this
|
|
1762
|
-
this
|
|
1779
|
+
if (this.#$(e)) {
|
|
1780
|
+
this.#V(this.#T[e], "expire");
|
|
1763
1781
|
t = true;
|
|
1764
1782
|
}
|
|
1765
1783
|
}
|
|
1766
1784
|
return t;
|
|
1767
1785
|
}
|
|
1768
1786
|
info(t) {
|
|
1769
|
-
const e = this.#
|
|
1787
|
+
const e = this.#E.get(t);
|
|
1770
1788
|
if (e === undefined) return undefined;
|
|
1771
|
-
const s = this.#
|
|
1772
|
-
const i = this.#
|
|
1789
|
+
const s = this.#C[e];
|
|
1790
|
+
const i = this.#_(s) ? s.__staleWhileFetching : s;
|
|
1773
1791
|
if (i === undefined) return undefined;
|
|
1774
1792
|
const n = {
|
|
1775
1793
|
value: i
|
|
1776
1794
|
};
|
|
1777
|
-
if (this.#
|
|
1778
|
-
const t = this.#
|
|
1795
|
+
if (this.#D && this.#O) {
|
|
1796
|
+
const t = this.#D[e];
|
|
1779
1797
|
const s = this.#O[e];
|
|
1780
1798
|
if (t && s) {
|
|
1781
|
-
const e = t - (
|
|
1799
|
+
const e = t - (mt.now() - s);
|
|
1782
1800
|
n.ttl = e;
|
|
1783
1801
|
n.start = Date.now();
|
|
1784
1802
|
}
|
|
1785
1803
|
}
|
|
1786
|
-
if (this.#
|
|
1787
|
-
n.size = this.#
|
|
1804
|
+
if (this.#z) {
|
|
1805
|
+
n.size = this.#z[e];
|
|
1788
1806
|
}
|
|
1789
1807
|
return n;
|
|
1790
1808
|
}
|
|
1791
1809
|
dump() {
|
|
1792
1810
|
const t = [];
|
|
1793
|
-
for (const e of this.#
|
|
1811
|
+
for (const e of this.#U({
|
|
1794
1812
|
allowStale: true
|
|
1795
1813
|
})) {
|
|
1796
|
-
const s = this.#
|
|
1797
|
-
const i = this.#
|
|
1798
|
-
const n = this.#
|
|
1814
|
+
const s = this.#T[e];
|
|
1815
|
+
const i = this.#C[e];
|
|
1816
|
+
const n = this.#_(i) ? i.__staleWhileFetching : i;
|
|
1799
1817
|
if (n === undefined || s === undefined) continue;
|
|
1800
1818
|
const r = {
|
|
1801
1819
|
value: n
|
|
1802
1820
|
};
|
|
1803
|
-
if (this.#
|
|
1804
|
-
r.ttl = this.#
|
|
1805
|
-
const t =
|
|
1821
|
+
if (this.#D && this.#O) {
|
|
1822
|
+
r.ttl = this.#D[e];
|
|
1823
|
+
const t = mt.now() - this.#O[e];
|
|
1806
1824
|
r.start = Math.floor(Date.now() - t);
|
|
1807
1825
|
}
|
|
1808
|
-
if (this.#
|
|
1809
|
-
r.size = this.#
|
|
1826
|
+
if (this.#z) {
|
|
1827
|
+
r.size = this.#z[e];
|
|
1810
1828
|
}
|
|
1811
1829
|
t.unshift([ s, r ]);
|
|
1812
1830
|
}
|
|
@@ -1817,7 +1835,7 @@ class LRUCache {
|
|
|
1817
1835
|
for (const [e, s] of t) {
|
|
1818
1836
|
if (s.start) {
|
|
1819
1837
|
const t = Date.now() - s.start;
|
|
1820
|
-
s.start =
|
|
1838
|
+
s.start = mt.now() - t;
|
|
1821
1839
|
}
|
|
1822
1840
|
this.set(e, s.value, s);
|
|
1823
1841
|
}
|
|
@@ -1829,74 +1847,74 @@ class LRUCache {
|
|
|
1829
1847
|
}
|
|
1830
1848
|
const {ttl: i = this.ttl, start: n, noDisposeOnSet: r = this.noDisposeOnSet, sizeCalculation: o = this.sizeCalculation, status: h} = s;
|
|
1831
1849
|
let {noUpdateTTL: a = this.noUpdateTTL} = s;
|
|
1832
|
-
const l = this.#
|
|
1850
|
+
const l = this.#X(t, e, s.size || 0, o);
|
|
1833
1851
|
if (this.maxEntrySize && l > this.maxEntrySize) {
|
|
1834
1852
|
if (h) {
|
|
1835
1853
|
h.set = "miss";
|
|
1836
1854
|
h.maxEntrySizeExceeded = true;
|
|
1837
1855
|
}
|
|
1838
|
-
this
|
|
1856
|
+
this.#V(t, "set");
|
|
1839
1857
|
return this;
|
|
1840
1858
|
}
|
|
1841
|
-
let c = this.#
|
|
1859
|
+
let c = this.#v === 0 ? undefined : this.#E.get(t);
|
|
1842
1860
|
if (c === undefined) {
|
|
1843
|
-
c = this.#
|
|
1844
|
-
this.#
|
|
1845
|
-
this.#
|
|
1846
|
-
this.#
|
|
1861
|
+
c = this.#v === 0 ? this.#P : this.#F.length !== 0 ? this.#F.pop() : this.#v === this.#m ? this.#tt(false) : this.#v;
|
|
1862
|
+
this.#T[c] = t;
|
|
1863
|
+
this.#C[c] = e;
|
|
1864
|
+
this.#E.set(t, c);
|
|
1847
1865
|
this.#L[this.#P] = c;
|
|
1848
1866
|
this.#A[c] = this.#P;
|
|
1849
1867
|
this.#P = c;
|
|
1850
|
-
this.#
|
|
1851
|
-
this.#
|
|
1868
|
+
this.#v++;
|
|
1869
|
+
this.#Q(c, l, h);
|
|
1852
1870
|
if (h) h.set = "add";
|
|
1853
1871
|
a = false;
|
|
1854
1872
|
} else {
|
|
1855
|
-
this.#
|
|
1856
|
-
const s = this.#
|
|
1873
|
+
this.#j(c);
|
|
1874
|
+
const s = this.#C[c];
|
|
1857
1875
|
if (e !== s) {
|
|
1858
|
-
if (this.#
|
|
1876
|
+
if (this.#B && this.#_(s)) {
|
|
1859
1877
|
s.__abortController.abort(new Error("replaced"));
|
|
1860
1878
|
const {__staleWhileFetching: e} = s;
|
|
1861
1879
|
if (e !== undefined && !r) {
|
|
1862
|
-
if (this.#
|
|
1880
|
+
if (this.#N) {
|
|
1863
1881
|
this.#y?.(e, t, "set");
|
|
1864
1882
|
}
|
|
1865
|
-
if (this.#
|
|
1866
|
-
this.#
|
|
1883
|
+
if (this.#W) {
|
|
1884
|
+
this.#R?.push([ e, t, "set" ]);
|
|
1867
1885
|
}
|
|
1868
1886
|
}
|
|
1869
1887
|
} else if (!r) {
|
|
1870
|
-
if (this.#
|
|
1888
|
+
if (this.#N) {
|
|
1871
1889
|
this.#y?.(s, t, "set");
|
|
1872
1890
|
}
|
|
1873
|
-
if (this.#
|
|
1874
|
-
this.#
|
|
1891
|
+
if (this.#W) {
|
|
1892
|
+
this.#R?.push([ s, t, "set" ]);
|
|
1875
1893
|
}
|
|
1876
1894
|
}
|
|
1877
|
-
this.#
|
|
1878
|
-
this.#
|
|
1879
|
-
this.#
|
|
1895
|
+
this.#Y(c);
|
|
1896
|
+
this.#Q(c, l, h);
|
|
1897
|
+
this.#C[c] = e;
|
|
1880
1898
|
if (h) {
|
|
1881
1899
|
h.set = "replace";
|
|
1882
|
-
const t = s && this.#
|
|
1900
|
+
const t = s && this.#_(s) ? s.__staleWhileFetching : s;
|
|
1883
1901
|
if (t !== undefined) h.oldValue = t;
|
|
1884
1902
|
}
|
|
1885
1903
|
} else if (h) {
|
|
1886
1904
|
h.set = "update";
|
|
1887
1905
|
}
|
|
1888
1906
|
}
|
|
1889
|
-
if (i !== 0 && !this.#
|
|
1890
|
-
this.#
|
|
1907
|
+
if (i !== 0 && !this.#D) {
|
|
1908
|
+
this.#H();
|
|
1891
1909
|
}
|
|
1892
|
-
if (this.#
|
|
1910
|
+
if (this.#D) {
|
|
1893
1911
|
if (!a) {
|
|
1894
|
-
this.#
|
|
1912
|
+
this.#Z(c, i, n);
|
|
1895
1913
|
}
|
|
1896
|
-
if (h) this.#
|
|
1914
|
+
if (h) this.#K(h, c);
|
|
1897
1915
|
}
|
|
1898
|
-
if (!r && this.#
|
|
1899
|
-
const t = this.#
|
|
1916
|
+
if (!r && this.#W && this.#R) {
|
|
1917
|
+
const t = this.#R;
|
|
1900
1918
|
let e;
|
|
1901
1919
|
while (e = t?.shift()) {
|
|
1902
1920
|
this.#b?.(...e);
|
|
@@ -1906,10 +1924,10 @@ class LRUCache {
|
|
|
1906
1924
|
}
|
|
1907
1925
|
pop() {
|
|
1908
1926
|
try {
|
|
1909
|
-
while (this.#
|
|
1910
|
-
const t = this.#
|
|
1911
|
-
this.#
|
|
1912
|
-
if (this.#
|
|
1927
|
+
while (this.#v) {
|
|
1928
|
+
const t = this.#C[this.#M];
|
|
1929
|
+
this.#tt(true);
|
|
1930
|
+
if (this.#_(t)) {
|
|
1913
1931
|
if (t.__staleWhileFetching) {
|
|
1914
1932
|
return t.__staleWhileFetching;
|
|
1915
1933
|
}
|
|
@@ -1918,8 +1936,8 @@ class LRUCache {
|
|
|
1918
1936
|
}
|
|
1919
1937
|
}
|
|
1920
1938
|
} finally {
|
|
1921
|
-
if (this.#
|
|
1922
|
-
const t = this.#
|
|
1939
|
+
if (this.#W && this.#R) {
|
|
1940
|
+
const t = this.#R;
|
|
1923
1941
|
let e;
|
|
1924
1942
|
while (e = t?.shift()) {
|
|
1925
1943
|
this.#b?.(...e);
|
|
@@ -1927,56 +1945,56 @@ class LRUCache {
|
|
|
1927
1945
|
}
|
|
1928
1946
|
}
|
|
1929
1947
|
}
|
|
1930
|
-
#
|
|
1931
|
-
const e = this.#
|
|
1932
|
-
const s = this.#
|
|
1933
|
-
const i = this.#
|
|
1934
|
-
if (this.#
|
|
1948
|
+
#tt(t) {
|
|
1949
|
+
const e = this.#M;
|
|
1950
|
+
const s = this.#T[e];
|
|
1951
|
+
const i = this.#C[e];
|
|
1952
|
+
if (this.#B && this.#_(i)) {
|
|
1935
1953
|
i.__abortController.abort(new Error("evicted"));
|
|
1936
|
-
} else if (this.#
|
|
1937
|
-
if (this.#
|
|
1954
|
+
} else if (this.#N || this.#W) {
|
|
1955
|
+
if (this.#N) {
|
|
1938
1956
|
this.#y?.(i, s, "evict");
|
|
1939
1957
|
}
|
|
1940
|
-
if (this.#
|
|
1941
|
-
this.#
|
|
1958
|
+
if (this.#W) {
|
|
1959
|
+
this.#R?.push([ i, s, "evict" ]);
|
|
1942
1960
|
}
|
|
1943
1961
|
}
|
|
1944
|
-
this.#
|
|
1962
|
+
this.#Y(e);
|
|
1945
1963
|
if (t) {
|
|
1946
|
-
this.#E[e] = undefined;
|
|
1947
1964
|
this.#T[e] = undefined;
|
|
1965
|
+
this.#C[e] = undefined;
|
|
1948
1966
|
this.#F.push(e);
|
|
1949
1967
|
}
|
|
1950
|
-
if (this.#
|
|
1951
|
-
this.#
|
|
1968
|
+
if (this.#v === 1) {
|
|
1969
|
+
this.#M = this.#P = 0;
|
|
1952
1970
|
this.#F.length = 0;
|
|
1953
1971
|
} else {
|
|
1954
|
-
this.#
|
|
1972
|
+
this.#M = this.#L[e];
|
|
1955
1973
|
}
|
|
1956
|
-
this.#
|
|
1957
|
-
this.#
|
|
1974
|
+
this.#E.delete(s);
|
|
1975
|
+
this.#v--;
|
|
1958
1976
|
return e;
|
|
1959
1977
|
}
|
|
1960
1978
|
has(t, e = {}) {
|
|
1961
1979
|
const {updateAgeOnHas: s = this.updateAgeOnHas, status: i} = e;
|
|
1962
|
-
const n = this.#
|
|
1980
|
+
const n = this.#E.get(t);
|
|
1963
1981
|
if (n !== undefined) {
|
|
1964
|
-
const t = this.#
|
|
1965
|
-
if (this.#
|
|
1982
|
+
const t = this.#C[n];
|
|
1983
|
+
if (this.#_(t) && t.__staleWhileFetching === undefined) {
|
|
1966
1984
|
return false;
|
|
1967
1985
|
}
|
|
1968
|
-
if (!this
|
|
1986
|
+
if (!this.#$(n)) {
|
|
1969
1987
|
if (s) {
|
|
1970
|
-
this.#
|
|
1988
|
+
this.#J(n);
|
|
1971
1989
|
}
|
|
1972
1990
|
if (i) {
|
|
1973
1991
|
i.has = "hit";
|
|
1974
|
-
this.#
|
|
1992
|
+
this.#K(i, n);
|
|
1975
1993
|
}
|
|
1976
1994
|
return true;
|
|
1977
1995
|
} else if (i) {
|
|
1978
1996
|
i.has = "stale";
|
|
1979
|
-
this.#
|
|
1997
|
+
this.#K(i, n);
|
|
1980
1998
|
}
|
|
1981
1999
|
} else if (i) {
|
|
1982
2000
|
i.has = "miss";
|
|
@@ -1985,19 +2003,19 @@ class LRUCache {
|
|
|
1985
2003
|
}
|
|
1986
2004
|
peek(t, e = {}) {
|
|
1987
2005
|
const {allowStale: s = this.allowStale} = e;
|
|
1988
|
-
const i = this.#
|
|
1989
|
-
if (i === undefined || !s && this
|
|
2006
|
+
const i = this.#E.get(t);
|
|
2007
|
+
if (i === undefined || !s && this.#$(i)) {
|
|
1990
2008
|
return;
|
|
1991
2009
|
}
|
|
1992
|
-
const n = this.#
|
|
1993
|
-
return this.#
|
|
2010
|
+
const n = this.#C[i];
|
|
2011
|
+
return this.#_(n) ? n.__staleWhileFetching : n;
|
|
1994
2012
|
}
|
|
1995
|
-
#
|
|
1996
|
-
const n = e === undefined ? undefined : this.#
|
|
1997
|
-
if (this.#
|
|
2013
|
+
#I(t, e, s, i) {
|
|
2014
|
+
const n = e === undefined ? undefined : this.#C[e];
|
|
2015
|
+
if (this.#_(n)) {
|
|
1998
2016
|
return n;
|
|
1999
2017
|
}
|
|
2000
|
-
const r = new
|
|
2018
|
+
const r = new St;
|
|
2001
2019
|
const {signal: o} = s;
|
|
2002
2020
|
o?.addEventListener("abort", (() => r.abort(o.reason)), {
|
|
2003
2021
|
signal: r.signal
|
|
@@ -2023,12 +2041,12 @@ class LRUCache {
|
|
|
2023
2041
|
return c(r.signal.reason);
|
|
2024
2042
|
}
|
|
2025
2043
|
const l = u;
|
|
2026
|
-
if (this.#
|
|
2044
|
+
if (this.#C[e] === u) {
|
|
2027
2045
|
if (i === undefined) {
|
|
2028
2046
|
if (l.__staleWhileFetching) {
|
|
2029
|
-
this.#
|
|
2047
|
+
this.#C[e] = l.__staleWhileFetching;
|
|
2030
2048
|
} else {
|
|
2031
|
-
this
|
|
2049
|
+
this.#V(t, "fetch");
|
|
2032
2050
|
}
|
|
2033
2051
|
} else {
|
|
2034
2052
|
if (s.status) s.status.fetchUpdated = true;
|
|
@@ -2050,12 +2068,12 @@ class LRUCache {
|
|
|
2050
2068
|
const h = o || s.allowStaleOnFetchRejection;
|
|
2051
2069
|
const a = h || s.noDeleteOnFetchRejection;
|
|
2052
2070
|
const l = u;
|
|
2053
|
-
if (this.#
|
|
2071
|
+
if (this.#C[e] === u) {
|
|
2054
2072
|
const s = !a || l.__staleWhileFetching === undefined;
|
|
2055
2073
|
if (s) {
|
|
2056
|
-
this
|
|
2074
|
+
this.#V(t, "fetch");
|
|
2057
2075
|
} else if (!o) {
|
|
2058
|
-
this.#
|
|
2076
|
+
this.#C[e] = l.__staleWhileFetching;
|
|
2059
2077
|
}
|
|
2060
2078
|
}
|
|
2061
2079
|
if (h) {
|
|
@@ -2093,20 +2111,20 @@ class LRUCache {
|
|
|
2093
2111
|
...h.options,
|
|
2094
2112
|
status: undefined
|
|
2095
2113
|
});
|
|
2096
|
-
e = this.#
|
|
2114
|
+
e = this.#E.get(t);
|
|
2097
2115
|
} else {
|
|
2098
|
-
this.#
|
|
2116
|
+
this.#C[e] = d;
|
|
2099
2117
|
}
|
|
2100
2118
|
return d;
|
|
2101
2119
|
}
|
|
2102
|
-
#
|
|
2103
|
-
if (!this.#
|
|
2120
|
+
#_(t) {
|
|
2121
|
+
if (!this.#B) return false;
|
|
2104
2122
|
const e = t;
|
|
2105
|
-
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof
|
|
2123
|
+
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof St;
|
|
2106
2124
|
}
|
|
2107
2125
|
async fetch(t, e = {}) {
|
|
2108
2126
|
const {allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: r = this.ttl, noDisposeOnSet: o = this.noDisposeOnSet, size: h = 0, sizeCalculation: a = this.sizeCalculation, noUpdateTTL: l = this.noUpdateTTL, noDeleteOnFetchRejection: c = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: f = this.allowStaleOnFetchRejection, ignoreFetchAbort: u = this.ignoreFetchAbort, allowStaleOnFetchAbort: d = this.allowStaleOnFetchAbort, context: p, forceRefresh: g = false, status: m, signal: w} = e;
|
|
2109
|
-
if (!this.#
|
|
2127
|
+
if (!this.#B) {
|
|
2110
2128
|
if (m) m.fetch = "get";
|
|
2111
2129
|
return this.get(t, {
|
|
2112
2130
|
allowStale: s,
|
|
@@ -2131,14 +2149,14 @@ class LRUCache {
|
|
|
2131
2149
|
status: m,
|
|
2132
2150
|
signal: w
|
|
2133
2151
|
};
|
|
2134
|
-
let b = this.#
|
|
2152
|
+
let b = this.#E.get(t);
|
|
2135
2153
|
if (b === undefined) {
|
|
2136
2154
|
if (m) m.fetch = "miss";
|
|
2137
|
-
const e = this.#
|
|
2155
|
+
const e = this.#I(t, b, y, p);
|
|
2138
2156
|
return e.__returned = e;
|
|
2139
2157
|
} else {
|
|
2140
|
-
const e = this.#
|
|
2141
|
-
if (this.#
|
|
2158
|
+
const e = this.#C[b];
|
|
2159
|
+
if (this.#_(e)) {
|
|
2142
2160
|
const t = s && e.__staleWhileFetching !== undefined;
|
|
2143
2161
|
if (m) {
|
|
2144
2162
|
m.fetch = "inflight";
|
|
@@ -2146,17 +2164,17 @@ class LRUCache {
|
|
|
2146
2164
|
}
|
|
2147
2165
|
return t ? e.__staleWhileFetching : e.__returned = e;
|
|
2148
2166
|
}
|
|
2149
|
-
const n = this
|
|
2167
|
+
const n = this.#$(b);
|
|
2150
2168
|
if (!g && !n) {
|
|
2151
2169
|
if (m) m.fetch = "hit";
|
|
2152
|
-
this.#
|
|
2170
|
+
this.#j(b);
|
|
2153
2171
|
if (i) {
|
|
2154
|
-
this.#
|
|
2172
|
+
this.#J(b);
|
|
2155
2173
|
}
|
|
2156
|
-
if (m) this.#
|
|
2174
|
+
if (m) this.#K(m, b);
|
|
2157
2175
|
return e;
|
|
2158
2176
|
}
|
|
2159
|
-
const r = this.#
|
|
2177
|
+
const r = this.#I(t, b, y, p);
|
|
2160
2178
|
const o = r.__staleWhileFetching !== undefined;
|
|
2161
2179
|
const h = o && s;
|
|
2162
2180
|
if (m) {
|
|
@@ -2166,18 +2184,38 @@ class LRUCache {
|
|
|
2166
2184
|
return h ? r.__staleWhileFetching : r.__returned = r;
|
|
2167
2185
|
}
|
|
2168
2186
|
}
|
|
2187
|
+
async forceFetch(t, e = {}) {
|
|
2188
|
+
const s = await this.fetch(t, e);
|
|
2189
|
+
if (s === undefined) throw new Error("fetch() returned undefined");
|
|
2190
|
+
return s;
|
|
2191
|
+
}
|
|
2192
|
+
memo(t, e = {}) {
|
|
2193
|
+
const s = this.#k;
|
|
2194
|
+
if (!s) {
|
|
2195
|
+
throw new Error("no memoMethod provided to constructor");
|
|
2196
|
+
}
|
|
2197
|
+
const {context: i, forceRefresh: n, ...r} = e;
|
|
2198
|
+
const o = this.get(t, r);
|
|
2199
|
+
if (!n && o !== undefined) return o;
|
|
2200
|
+
const h = s(t, o, {
|
|
2201
|
+
options: r,
|
|
2202
|
+
context: i
|
|
2203
|
+
});
|
|
2204
|
+
this.set(t, h, r);
|
|
2205
|
+
return h;
|
|
2206
|
+
}
|
|
2169
2207
|
get(t, e = {}) {
|
|
2170
2208
|
const {allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: r} = e;
|
|
2171
|
-
const o = this.#
|
|
2209
|
+
const o = this.#E.get(t);
|
|
2172
2210
|
if (o !== undefined) {
|
|
2173
|
-
const e = this.#
|
|
2174
|
-
const h = this.#
|
|
2175
|
-
if (r) this.#
|
|
2176
|
-
if (this
|
|
2211
|
+
const e = this.#C[o];
|
|
2212
|
+
const h = this.#_(e);
|
|
2213
|
+
if (r) this.#K(r, o);
|
|
2214
|
+
if (this.#$(o)) {
|
|
2177
2215
|
if (r) r.get = "stale";
|
|
2178
2216
|
if (!h) {
|
|
2179
2217
|
if (!n) {
|
|
2180
|
-
this
|
|
2218
|
+
this.#V(t, "expire");
|
|
2181
2219
|
}
|
|
2182
2220
|
if (r && s) r.returnedStale = true;
|
|
2183
2221
|
return s ? e : undefined;
|
|
@@ -2192,9 +2230,9 @@ class LRUCache {
|
|
|
2192
2230
|
if (h) {
|
|
2193
2231
|
return e.__staleWhileFetching;
|
|
2194
2232
|
}
|
|
2195
|
-
this.#
|
|
2233
|
+
this.#j(o);
|
|
2196
2234
|
if (i) {
|
|
2197
|
-
this.#
|
|
2235
|
+
this.#J(o);
|
|
2198
2236
|
}
|
|
2199
2237
|
return e;
|
|
2200
2238
|
}
|
|
@@ -2202,103 +2240,109 @@ class LRUCache {
|
|
|
2202
2240
|
r.get = "miss";
|
|
2203
2241
|
}
|
|
2204
2242
|
}
|
|
2205
|
-
#
|
|
2243
|
+
#st(t, e) {
|
|
2206
2244
|
this.#A[e] = t;
|
|
2207
2245
|
this.#L[t] = e;
|
|
2208
2246
|
}
|
|
2209
|
-
#
|
|
2247
|
+
#j(t) {
|
|
2210
2248
|
if (t !== this.#P) {
|
|
2211
|
-
if (t === this.#
|
|
2212
|
-
this.#
|
|
2249
|
+
if (t === this.#M) {
|
|
2250
|
+
this.#M = this.#L[t];
|
|
2213
2251
|
} else {
|
|
2214
|
-
this.#
|
|
2252
|
+
this.#st(this.#A[t], this.#L[t]);
|
|
2215
2253
|
}
|
|
2216
|
-
this.#
|
|
2254
|
+
this.#st(this.#P, t);
|
|
2217
2255
|
this.#P = t;
|
|
2218
2256
|
}
|
|
2219
2257
|
}
|
|
2220
2258
|
delete(t) {
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2259
|
+
return this.#V(t, "delete");
|
|
2260
|
+
}
|
|
2261
|
+
#V(t, e) {
|
|
2262
|
+
let s = false;
|
|
2263
|
+
if (this.#v !== 0) {
|
|
2264
|
+
const i = this.#E.get(t);
|
|
2265
|
+
if (i !== undefined) {
|
|
2266
|
+
s = true;
|
|
2267
|
+
if (this.#v === 1) {
|
|
2268
|
+
this.#it(e);
|
|
2228
2269
|
} else {
|
|
2229
|
-
this.#
|
|
2230
|
-
const
|
|
2231
|
-
if (this.#
|
|
2232
|
-
|
|
2233
|
-
} else if (this.#
|
|
2234
|
-
if (this.#
|
|
2235
|
-
this.#y?.(
|
|
2270
|
+
this.#Y(i);
|
|
2271
|
+
const s = this.#C[i];
|
|
2272
|
+
if (this.#_(s)) {
|
|
2273
|
+
s.__abortController.abort(new Error("deleted"));
|
|
2274
|
+
} else if (this.#N || this.#W) {
|
|
2275
|
+
if (this.#N) {
|
|
2276
|
+
this.#y?.(s, t, e);
|
|
2236
2277
|
}
|
|
2237
|
-
if (this.#
|
|
2238
|
-
this.#
|
|
2278
|
+
if (this.#W) {
|
|
2279
|
+
this.#R?.push([ s, t, e ]);
|
|
2239
2280
|
}
|
|
2240
2281
|
}
|
|
2241
|
-
this.#
|
|
2242
|
-
this.#
|
|
2243
|
-
this.#
|
|
2244
|
-
if (
|
|
2245
|
-
this.#P = this.#A[
|
|
2246
|
-
} else if (
|
|
2247
|
-
this.#
|
|
2282
|
+
this.#E.delete(t);
|
|
2283
|
+
this.#T[i] = undefined;
|
|
2284
|
+
this.#C[i] = undefined;
|
|
2285
|
+
if (i === this.#P) {
|
|
2286
|
+
this.#P = this.#A[i];
|
|
2287
|
+
} else if (i === this.#M) {
|
|
2288
|
+
this.#M = this.#L[i];
|
|
2248
2289
|
} else {
|
|
2249
|
-
const t = this.#A[
|
|
2250
|
-
this.#L[t] = this.#L[
|
|
2251
|
-
const e = this.#L[
|
|
2252
|
-
this.#A[e] = this.#A[
|
|
2290
|
+
const t = this.#A[i];
|
|
2291
|
+
this.#L[t] = this.#L[i];
|
|
2292
|
+
const e = this.#L[i];
|
|
2293
|
+
this.#A[e] = this.#A[i];
|
|
2253
2294
|
}
|
|
2254
|
-
this.#
|
|
2255
|
-
this.#F.push(
|
|
2295
|
+
this.#v--;
|
|
2296
|
+
this.#F.push(i);
|
|
2256
2297
|
}
|
|
2257
2298
|
}
|
|
2258
2299
|
}
|
|
2259
|
-
if (this.#
|
|
2260
|
-
const t = this.#
|
|
2300
|
+
if (this.#W && this.#R?.length) {
|
|
2301
|
+
const t = this.#R;
|
|
2261
2302
|
let e;
|
|
2262
2303
|
while (e = t?.shift()) {
|
|
2263
2304
|
this.#b?.(...e);
|
|
2264
2305
|
}
|
|
2265
2306
|
}
|
|
2266
|
-
return
|
|
2307
|
+
return s;
|
|
2267
2308
|
}
|
|
2268
2309
|
clear() {
|
|
2269
|
-
|
|
2310
|
+
return this.#it("delete");
|
|
2311
|
+
}
|
|
2312
|
+
#it(t) {
|
|
2313
|
+
for (const e of this.#G({
|
|
2270
2314
|
allowStale: true
|
|
2271
2315
|
})) {
|
|
2272
|
-
const
|
|
2273
|
-
if (this.#
|
|
2274
|
-
|
|
2316
|
+
const s = this.#C[e];
|
|
2317
|
+
if (this.#_(s)) {
|
|
2318
|
+
s.__abortController.abort(new Error("deleted"));
|
|
2275
2319
|
} else {
|
|
2276
|
-
const
|
|
2277
|
-
if (this.#
|
|
2278
|
-
this.#y?.(
|
|
2320
|
+
const i = this.#T[e];
|
|
2321
|
+
if (this.#N) {
|
|
2322
|
+
this.#y?.(s, i, t);
|
|
2279
2323
|
}
|
|
2280
|
-
if (this.#
|
|
2281
|
-
this.#
|
|
2324
|
+
if (this.#W) {
|
|
2325
|
+
this.#R?.push([ s, i, t ]);
|
|
2282
2326
|
}
|
|
2283
2327
|
}
|
|
2284
2328
|
}
|
|
2285
|
-
this.#
|
|
2329
|
+
this.#E.clear();
|
|
2330
|
+
this.#C.fill(undefined);
|
|
2286
2331
|
this.#T.fill(undefined);
|
|
2287
|
-
this.#
|
|
2288
|
-
|
|
2289
|
-
this.#z.fill(0);
|
|
2332
|
+
if (this.#D && this.#O) {
|
|
2333
|
+
this.#D.fill(0);
|
|
2290
2334
|
this.#O.fill(0);
|
|
2291
2335
|
}
|
|
2292
|
-
if (this.#
|
|
2293
|
-
this.#
|
|
2336
|
+
if (this.#z) {
|
|
2337
|
+
this.#z.fill(0);
|
|
2294
2338
|
}
|
|
2295
|
-
this.#
|
|
2339
|
+
this.#M = 0;
|
|
2296
2340
|
this.#P = 0;
|
|
2297
2341
|
this.#F.length = 0;
|
|
2342
|
+
this.#x = 0;
|
|
2298
2343
|
this.#v = 0;
|
|
2299
|
-
this.#
|
|
2300
|
-
|
|
2301
|
-
const t = this.#M;
|
|
2344
|
+
if (this.#W && this.#R) {
|
|
2345
|
+
const t = this.#R;
|
|
2302
2346
|
let e;
|
|
2303
2347
|
while (e = t?.shift()) {
|
|
2304
2348
|
this.#b?.(...e);
|
|
@@ -2307,88 +2351,88 @@ class LRUCache {
|
|
|
2307
2351
|
}
|
|
2308
2352
|
}
|
|
2309
2353
|
|
|
2310
|
-
const
|
|
2354
|
+
const Ct = typeof process === "object" && process ? process : {
|
|
2311
2355
|
stdout: null,
|
|
2312
2356
|
stderr: null
|
|
2313
2357
|
};
|
|
2314
2358
|
|
|
2315
|
-
const Lt = t => !!t && typeof t === "object" && (t instanceof Minipass || t instanceof
|
|
2359
|
+
const Lt = t => !!t && typeof t === "object" && (t instanceof Minipass || t instanceof u.default || At(t) || Mt(t));
|
|
2316
2360
|
|
|
2317
|
-
const At = t => !!t && typeof t === "object" && t instanceof
|
|
2361
|
+
const At = t => !!t && typeof t === "object" && t instanceof o.EventEmitter && typeof t.pipe === "function" && t.pipe !== u.default.Writable.prototype.pipe;
|
|
2318
2362
|
|
|
2319
|
-
const
|
|
2363
|
+
const Mt = t => !!t && typeof t === "object" && t instanceof o.EventEmitter && typeof t.write === "function" && typeof t.end === "function";
|
|
2320
2364
|
|
|
2321
2365
|
const Pt = Symbol("EOF");
|
|
2322
2366
|
|
|
2323
2367
|
const Ft = Symbol("maybeEmitEnd");
|
|
2324
2368
|
|
|
2325
|
-
const
|
|
2369
|
+
const Rt = Symbol("emittedEnd");
|
|
2326
2370
|
|
|
2327
|
-
const
|
|
2371
|
+
const zt = Symbol("emittingEnd");
|
|
2328
2372
|
|
|
2329
2373
|
const Ot = Symbol("emittedError");
|
|
2330
2374
|
|
|
2331
|
-
const
|
|
2375
|
+
const Dt = Symbol("closed");
|
|
2332
2376
|
|
|
2333
|
-
const
|
|
2377
|
+
const Nt = Symbol("read");
|
|
2334
2378
|
|
|
2335
|
-
const
|
|
2379
|
+
const Bt = Symbol("flush");
|
|
2336
2380
|
|
|
2337
|
-
const
|
|
2381
|
+
const Wt = Symbol("flushChunk");
|
|
2338
2382
|
|
|
2339
|
-
const
|
|
2383
|
+
const _t = Symbol("encoding");
|
|
2340
2384
|
|
|
2341
|
-
const
|
|
2385
|
+
const It = Symbol("decoder");
|
|
2342
2386
|
|
|
2343
|
-
const
|
|
2387
|
+
const jt = Symbol("flowing");
|
|
2344
2388
|
|
|
2345
|
-
const
|
|
2389
|
+
const Ut = Symbol("paused");
|
|
2346
2390
|
|
|
2347
|
-
const
|
|
2391
|
+
const Gt = Symbol("resume");
|
|
2348
2392
|
|
|
2349
|
-
const
|
|
2393
|
+
const $t = Symbol("buffer");
|
|
2350
2394
|
|
|
2351
|
-
const
|
|
2395
|
+
const qt = Symbol("pipes");
|
|
2352
2396
|
|
|
2353
|
-
const
|
|
2397
|
+
const Ht = Symbol("bufferLength");
|
|
2354
2398
|
|
|
2355
|
-
const
|
|
2399
|
+
const Zt = Symbol("bufferPush");
|
|
2356
2400
|
|
|
2357
|
-
const
|
|
2401
|
+
const Vt = Symbol("bufferShift");
|
|
2358
2402
|
|
|
2359
|
-
const
|
|
2403
|
+
const Jt = Symbol("objectMode");
|
|
2360
2404
|
|
|
2361
|
-
const
|
|
2405
|
+
const Kt = Symbol("destroyed");
|
|
2362
2406
|
|
|
2363
|
-
const
|
|
2407
|
+
const Yt = Symbol("error");
|
|
2364
2408
|
|
|
2365
|
-
const
|
|
2409
|
+
const Xt = Symbol("emitData");
|
|
2366
2410
|
|
|
2367
|
-
const
|
|
2411
|
+
const Qt = Symbol("emitEnd");
|
|
2368
2412
|
|
|
2369
|
-
const
|
|
2413
|
+
const te = Symbol("emitEnd2");
|
|
2370
2414
|
|
|
2371
|
-
const
|
|
2415
|
+
const ee = Symbol("async");
|
|
2372
2416
|
|
|
2373
|
-
const
|
|
2417
|
+
const se = Symbol("abort");
|
|
2374
2418
|
|
|
2375
|
-
const
|
|
2419
|
+
const ie = Symbol("aborted");
|
|
2376
2420
|
|
|
2377
|
-
const
|
|
2421
|
+
const ne = Symbol("signal");
|
|
2378
2422
|
|
|
2379
|
-
const
|
|
2423
|
+
const re = Symbol("dataListeners");
|
|
2380
2424
|
|
|
2381
|
-
const
|
|
2425
|
+
const oe = Symbol("discarded");
|
|
2382
2426
|
|
|
2383
|
-
const
|
|
2427
|
+
const he = t => Promise.resolve().then(t);
|
|
2384
2428
|
|
|
2385
|
-
const
|
|
2429
|
+
const ae = t => t();
|
|
2386
2430
|
|
|
2387
|
-
const
|
|
2431
|
+
const le = t => t === "end" || t === "finish" || t === "prefinish";
|
|
2388
2432
|
|
|
2389
|
-
const
|
|
2433
|
+
const ce = t => t instanceof ArrayBuffer || !!t && typeof t === "object" && t.constructor && t.constructor.name === "ArrayBuffer" && t.byteLength >= 0;
|
|
2390
2434
|
|
|
2391
|
-
const
|
|
2435
|
+
const fe = t => !Buffer.isBuffer(t) && ArrayBuffer.isView(t);
|
|
2392
2436
|
|
|
2393
2437
|
class Pipe {
|
|
2394
2438
|
src;
|
|
@@ -2399,7 +2443,7 @@ class Pipe {
|
|
|
2399
2443
|
this.src = t;
|
|
2400
2444
|
this.dest = e;
|
|
2401
2445
|
this.opts = s;
|
|
2402
|
-
this.ondrain = () => t[
|
|
2446
|
+
this.ondrain = () => t[Gt]();
|
|
2403
2447
|
this.dest.on("drain", this.ondrain);
|
|
2404
2448
|
}
|
|
2405
2449
|
unpipe() {
|
|
@@ -2424,30 +2468,30 @@ class PipeProxyErrors extends Pipe {
|
|
|
2424
2468
|
}
|
|
2425
2469
|
}
|
|
2426
2470
|
|
|
2427
|
-
const
|
|
2471
|
+
const ue = t => !!t.objectMode;
|
|
2428
2472
|
|
|
2429
|
-
const
|
|
2473
|
+
const de = t => !t.objectMode && !!t.encoding && t.encoding !== "buffer";
|
|
2430
2474
|
|
|
2431
|
-
class Minipass extends
|
|
2432
|
-
[It]=false;
|
|
2475
|
+
class Minipass extends o.EventEmitter {
|
|
2433
2476
|
[jt]=false;
|
|
2477
|
+
[Ut]=false;
|
|
2478
|
+
[qt]=[];
|
|
2434
2479
|
[$t]=[];
|
|
2435
|
-
[
|
|
2436
|
-
[Vt];
|
|
2437
|
-
[Wt];
|
|
2438
|
-
[te];
|
|
2480
|
+
[Jt];
|
|
2439
2481
|
[_t];
|
|
2482
|
+
[ee];
|
|
2483
|
+
[It];
|
|
2440
2484
|
[Pt]=false;
|
|
2441
|
-
[Mt]=false;
|
|
2442
2485
|
[Rt]=false;
|
|
2443
2486
|
[zt]=false;
|
|
2487
|
+
[Dt]=false;
|
|
2444
2488
|
[Ot]=null;
|
|
2445
|
-
[
|
|
2446
|
-
[
|
|
2447
|
-
[
|
|
2448
|
-
[
|
|
2449
|
-
[
|
|
2450
|
-
[
|
|
2489
|
+
[Ht]=0;
|
|
2490
|
+
[Kt]=false;
|
|
2491
|
+
[ne];
|
|
2492
|
+
[ie]=false;
|
|
2493
|
+
[re]=0;
|
|
2494
|
+
[oe]=false;
|
|
2451
2495
|
writable=true;
|
|
2452
2496
|
readable=true;
|
|
2453
2497
|
constructor(...t) {
|
|
@@ -2456,43 +2500,43 @@ class Minipass extends r.EventEmitter {
|
|
|
2456
2500
|
if (e.objectMode && typeof e.encoding === "string") {
|
|
2457
2501
|
throw new TypeError("Encoding and objectMode may not be used together");
|
|
2458
2502
|
}
|
|
2459
|
-
if (
|
|
2460
|
-
this[
|
|
2461
|
-
this[
|
|
2462
|
-
} else if (
|
|
2463
|
-
this[
|
|
2464
|
-
this[
|
|
2503
|
+
if (ue(e)) {
|
|
2504
|
+
this[Jt] = true;
|
|
2505
|
+
this[_t] = null;
|
|
2506
|
+
} else if (de(e)) {
|
|
2507
|
+
this[_t] = e.encoding;
|
|
2508
|
+
this[Jt] = false;
|
|
2465
2509
|
} else {
|
|
2466
|
-
this[
|
|
2467
|
-
this[
|
|
2510
|
+
this[Jt] = false;
|
|
2511
|
+
this[_t] = null;
|
|
2468
2512
|
}
|
|
2469
|
-
this[
|
|
2470
|
-
this[
|
|
2513
|
+
this[ee] = !!e.async;
|
|
2514
|
+
this[It] = this[_t] ? new a.StringDecoder(this[_t]) : null;
|
|
2471
2515
|
if (e && e.debugExposeBuffer === true) {
|
|
2472
2516
|
Object.defineProperty(this, "buffer", {
|
|
2473
|
-
get: () => this[
|
|
2517
|
+
get: () => this[$t]
|
|
2474
2518
|
});
|
|
2475
2519
|
}
|
|
2476
2520
|
if (e && e.debugExposePipes === true) {
|
|
2477
2521
|
Object.defineProperty(this, "pipes", {
|
|
2478
|
-
get: () => this[
|
|
2522
|
+
get: () => this[qt]
|
|
2479
2523
|
});
|
|
2480
2524
|
}
|
|
2481
2525
|
const {signal: s} = e;
|
|
2482
2526
|
if (s) {
|
|
2483
|
-
this[
|
|
2527
|
+
this[ne] = s;
|
|
2484
2528
|
if (s.aborted) {
|
|
2485
|
-
this[
|
|
2529
|
+
this[se]();
|
|
2486
2530
|
} else {
|
|
2487
|
-
s.addEventListener("abort", (() => this[
|
|
2531
|
+
s.addEventListener("abort", (() => this[se]()));
|
|
2488
2532
|
}
|
|
2489
2533
|
}
|
|
2490
2534
|
}
|
|
2491
2535
|
get bufferLength() {
|
|
2492
|
-
return this[
|
|
2536
|
+
return this[Ht];
|
|
2493
2537
|
}
|
|
2494
2538
|
get encoding() {
|
|
2495
|
-
return this[
|
|
2539
|
+
return this[_t];
|
|
2496
2540
|
}
|
|
2497
2541
|
set encoding(t) {
|
|
2498
2542
|
throw new Error("Encoding must be set at instantiation time");
|
|
@@ -2501,30 +2545,30 @@ class Minipass extends r.EventEmitter {
|
|
|
2501
2545
|
throw new Error("Encoding must be set at instantiation time");
|
|
2502
2546
|
}
|
|
2503
2547
|
get objectMode() {
|
|
2504
|
-
return this[
|
|
2548
|
+
return this[Jt];
|
|
2505
2549
|
}
|
|
2506
2550
|
set objectMode(t) {
|
|
2507
2551
|
throw new Error("objectMode must be set at instantiation time");
|
|
2508
2552
|
}
|
|
2509
2553
|
get ["async"]() {
|
|
2510
|
-
return this[
|
|
2554
|
+
return this[ee];
|
|
2511
2555
|
}
|
|
2512
2556
|
set ["async"](t) {
|
|
2513
|
-
this[
|
|
2557
|
+
this[ee] = this[ee] || !!t;
|
|
2514
2558
|
}
|
|
2515
|
-
[
|
|
2516
|
-
this[
|
|
2517
|
-
this.emit("abort", this[
|
|
2518
|
-
this.destroy(this[
|
|
2559
|
+
[se]() {
|
|
2560
|
+
this[ie] = true;
|
|
2561
|
+
this.emit("abort", this[ne]?.reason);
|
|
2562
|
+
this.destroy(this[ne]?.reason);
|
|
2519
2563
|
}
|
|
2520
2564
|
get aborted() {
|
|
2521
|
-
return this[
|
|
2565
|
+
return this[ie];
|
|
2522
2566
|
}
|
|
2523
2567
|
set aborted(t) {}
|
|
2524
2568
|
write(t, e, s) {
|
|
2525
|
-
if (this[
|
|
2569
|
+
if (this[ie]) return false;
|
|
2526
2570
|
if (this[Pt]) throw new Error("write after end");
|
|
2527
|
-
if (this[
|
|
2571
|
+
if (this[Kt]) {
|
|
2528
2572
|
this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), {
|
|
2529
2573
|
code: "ERR_STREAM_DESTROYED"
|
|
2530
2574
|
}));
|
|
@@ -2535,70 +2579,70 @@ class Minipass extends r.EventEmitter {
|
|
|
2535
2579
|
e = "utf8";
|
|
2536
2580
|
}
|
|
2537
2581
|
if (!e) e = "utf8";
|
|
2538
|
-
const i = this[
|
|
2539
|
-
if (!this[
|
|
2540
|
-
if (
|
|
2582
|
+
const i = this[ee] ? he : ae;
|
|
2583
|
+
if (!this[Jt] && !Buffer.isBuffer(t)) {
|
|
2584
|
+
if (fe(t)) {
|
|
2541
2585
|
t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
|
|
2542
|
-
} else if (
|
|
2586
|
+
} else if (ce(t)) {
|
|
2543
2587
|
t = Buffer.from(t);
|
|
2544
2588
|
} else if (typeof t !== "string") {
|
|
2545
2589
|
throw new Error("Non-contiguous data written to non-objectMode stream");
|
|
2546
2590
|
}
|
|
2547
2591
|
}
|
|
2548
|
-
if (this[
|
|
2549
|
-
if (this[
|
|
2550
|
-
if (this[
|
|
2551
|
-
if (this[
|
|
2592
|
+
if (this[Jt]) {
|
|
2593
|
+
if (this[jt] && this[Ht] !== 0) this[Bt](true);
|
|
2594
|
+
if (this[jt]) this.emit("data", t); else this[Zt](t);
|
|
2595
|
+
if (this[Ht] !== 0) this.emit("readable");
|
|
2552
2596
|
if (s) i(s);
|
|
2553
|
-
return this[
|
|
2597
|
+
return this[jt];
|
|
2554
2598
|
}
|
|
2555
2599
|
if (!t.length) {
|
|
2556
|
-
if (this[
|
|
2600
|
+
if (this[Ht] !== 0) this.emit("readable");
|
|
2557
2601
|
if (s) i(s);
|
|
2558
|
-
return this[
|
|
2602
|
+
return this[jt];
|
|
2559
2603
|
}
|
|
2560
|
-
if (typeof t === "string" && !(e === this[
|
|
2604
|
+
if (typeof t === "string" && !(e === this[_t] && !this[It]?.lastNeed)) {
|
|
2561
2605
|
t = Buffer.from(t, e);
|
|
2562
2606
|
}
|
|
2563
|
-
if (Buffer.isBuffer(t) && this[
|
|
2564
|
-
t = this[
|
|
2607
|
+
if (Buffer.isBuffer(t) && this[_t]) {
|
|
2608
|
+
t = this[It].write(t);
|
|
2565
2609
|
}
|
|
2566
|
-
if (this[
|
|
2567
|
-
if (this[
|
|
2568
|
-
if (this[
|
|
2610
|
+
if (this[jt] && this[Ht] !== 0) this[Bt](true);
|
|
2611
|
+
if (this[jt]) this.emit("data", t); else this[Zt](t);
|
|
2612
|
+
if (this[Ht] !== 0) this.emit("readable");
|
|
2569
2613
|
if (s) i(s);
|
|
2570
|
-
return this[
|
|
2614
|
+
return this[jt];
|
|
2571
2615
|
}
|
|
2572
2616
|
read(t) {
|
|
2573
|
-
if (this[
|
|
2574
|
-
this[
|
|
2575
|
-
if (this[
|
|
2617
|
+
if (this[Kt]) return null;
|
|
2618
|
+
this[oe] = false;
|
|
2619
|
+
if (this[Ht] === 0 || t === 0 || t && t > this[Ht]) {
|
|
2576
2620
|
this[Ft]();
|
|
2577
2621
|
return null;
|
|
2578
2622
|
}
|
|
2579
|
-
if (this[
|
|
2580
|
-
if (this[
|
|
2581
|
-
this[
|
|
2623
|
+
if (this[Jt]) t = null;
|
|
2624
|
+
if (this[$t].length > 1 && !this[Jt]) {
|
|
2625
|
+
this[$t] = [ this[_t] ? this[$t].join("") : Buffer.concat(this[$t], this[Ht]) ];
|
|
2582
2626
|
}
|
|
2583
|
-
const e = this[
|
|
2627
|
+
const e = this[Nt](t || null, this[$t][0]);
|
|
2584
2628
|
this[Ft]();
|
|
2585
2629
|
return e;
|
|
2586
2630
|
}
|
|
2587
|
-
[
|
|
2588
|
-
if (this[
|
|
2631
|
+
[Nt](t, e) {
|
|
2632
|
+
if (this[Jt]) this[Vt](); else {
|
|
2589
2633
|
const s = e;
|
|
2590
|
-
if (t === s.length || t === null) this[
|
|
2591
|
-
this[
|
|
2634
|
+
if (t === s.length || t === null) this[Vt](); else if (typeof s === "string") {
|
|
2635
|
+
this[$t][0] = s.slice(t);
|
|
2592
2636
|
e = s.slice(0, t);
|
|
2593
|
-
this[
|
|
2637
|
+
this[Ht] -= t;
|
|
2594
2638
|
} else {
|
|
2595
|
-
this[
|
|
2639
|
+
this[$t][0] = s.subarray(t);
|
|
2596
2640
|
e = s.subarray(0, t);
|
|
2597
|
-
this[
|
|
2641
|
+
this[Ht] -= t;
|
|
2598
2642
|
}
|
|
2599
2643
|
}
|
|
2600
2644
|
this.emit("data", e);
|
|
2601
|
-
if (!this[
|
|
2645
|
+
if (!this[$t].length && !this[Pt]) this.emit("drain");
|
|
2602
2646
|
return e;
|
|
2603
2647
|
}
|
|
2604
2648
|
end(t, e, s) {
|
|
@@ -2614,76 +2658,76 @@ class Minipass extends r.EventEmitter {
|
|
|
2614
2658
|
if (s) this.once("end", s);
|
|
2615
2659
|
this[Pt] = true;
|
|
2616
2660
|
this.writable = false;
|
|
2617
|
-
if (this[
|
|
2661
|
+
if (this[jt] || !this[Ut]) this[Ft]();
|
|
2618
2662
|
return this;
|
|
2619
2663
|
}
|
|
2620
|
-
[
|
|
2621
|
-
if (this[
|
|
2622
|
-
if (!this[
|
|
2623
|
-
this[
|
|
2664
|
+
[Gt]() {
|
|
2665
|
+
if (this[Kt]) return;
|
|
2666
|
+
if (!this[re] && !this[qt].length) {
|
|
2667
|
+
this[oe] = true;
|
|
2624
2668
|
}
|
|
2625
|
-
this[
|
|
2626
|
-
this[
|
|
2669
|
+
this[Ut] = false;
|
|
2670
|
+
this[jt] = true;
|
|
2627
2671
|
this.emit("resume");
|
|
2628
|
-
if (this[
|
|
2672
|
+
if (this[$t].length) this[Bt](); else if (this[Pt]) this[Ft](); else this.emit("drain");
|
|
2629
2673
|
}
|
|
2630
2674
|
resume() {
|
|
2631
|
-
return this[
|
|
2675
|
+
return this[Gt]();
|
|
2632
2676
|
}
|
|
2633
2677
|
pause() {
|
|
2634
|
-
this[
|
|
2635
|
-
this[
|
|
2636
|
-
this[
|
|
2678
|
+
this[jt] = false;
|
|
2679
|
+
this[Ut] = true;
|
|
2680
|
+
this[oe] = false;
|
|
2637
2681
|
}
|
|
2638
2682
|
get destroyed() {
|
|
2639
|
-
return this[
|
|
2683
|
+
return this[Kt];
|
|
2640
2684
|
}
|
|
2641
2685
|
get flowing() {
|
|
2642
|
-
return this[
|
|
2686
|
+
return this[jt];
|
|
2643
2687
|
}
|
|
2644
2688
|
get paused() {
|
|
2645
|
-
return this[
|
|
2689
|
+
return this[Ut];
|
|
2646
2690
|
}
|
|
2647
|
-
[
|
|
2648
|
-
if (this[
|
|
2649
|
-
this[
|
|
2691
|
+
[Zt](t) {
|
|
2692
|
+
if (this[Jt]) this[Ht] += 1; else this[Ht] += t.length;
|
|
2693
|
+
this[$t].push(t);
|
|
2650
2694
|
}
|
|
2651
|
-
[
|
|
2652
|
-
if (this[
|
|
2653
|
-
return this[
|
|
2695
|
+
[Vt]() {
|
|
2696
|
+
if (this[Jt]) this[Ht] -= 1; else this[Ht] -= this[$t][0].length;
|
|
2697
|
+
return this[$t].shift();
|
|
2654
2698
|
}
|
|
2655
|
-
[
|
|
2656
|
-
do {} while (this[
|
|
2657
|
-
if (!t && !this[
|
|
2699
|
+
[Bt](t = false) {
|
|
2700
|
+
do {} while (this[Wt](this[Vt]()) && this[$t].length);
|
|
2701
|
+
if (!t && !this[$t].length && !this[Pt]) this.emit("drain");
|
|
2658
2702
|
}
|
|
2659
|
-
[
|
|
2703
|
+
[Wt](t) {
|
|
2660
2704
|
this.emit("data", t);
|
|
2661
|
-
return this[
|
|
2705
|
+
return this[jt];
|
|
2662
2706
|
}
|
|
2663
2707
|
pipe(t, e) {
|
|
2664
|
-
if (this[
|
|
2665
|
-
this[
|
|
2666
|
-
const s = this[
|
|
2708
|
+
if (this[Kt]) return t;
|
|
2709
|
+
this[oe] = false;
|
|
2710
|
+
const s = this[Rt];
|
|
2667
2711
|
e = e || {};
|
|
2668
|
-
if (t ===
|
|
2712
|
+
if (t === Ct.stdout || t === Ct.stderr) e.end = false; else e.end = e.end !== false;
|
|
2669
2713
|
e.proxyErrors = !!e.proxyErrors;
|
|
2670
2714
|
if (s) {
|
|
2671
2715
|
if (e.end) t.end();
|
|
2672
2716
|
} else {
|
|
2673
|
-
this[
|
|
2674
|
-
if (this[
|
|
2717
|
+
this[qt].push(!e.proxyErrors ? new Pipe(this, t, e) : new PipeProxyErrors(this, t, e));
|
|
2718
|
+
if (this[ee]) he((() => this[Gt]())); else this[Gt]();
|
|
2675
2719
|
}
|
|
2676
2720
|
return t;
|
|
2677
2721
|
}
|
|
2678
2722
|
unpipe(t) {
|
|
2679
|
-
const e = this[
|
|
2723
|
+
const e = this[qt].find((e => e.dest === t));
|
|
2680
2724
|
if (e) {
|
|
2681
|
-
if (this[
|
|
2682
|
-
if (this[
|
|
2683
|
-
this[
|
|
2725
|
+
if (this[qt].length === 1) {
|
|
2726
|
+
if (this[jt] && this[re] === 0) {
|
|
2727
|
+
this[jt] = false;
|
|
2684
2728
|
}
|
|
2685
|
-
this[
|
|
2686
|
-
} else this[
|
|
2729
|
+
this[qt] = [];
|
|
2730
|
+
} else this[qt].splice(this[qt].indexOf(e), 1);
|
|
2687
2731
|
e.unpipe();
|
|
2688
2732
|
}
|
|
2689
2733
|
}
|
|
@@ -2693,19 +2737,19 @@ class Minipass extends r.EventEmitter {
|
|
|
2693
2737
|
on(t, e) {
|
|
2694
2738
|
const s = super.on(t, e);
|
|
2695
2739
|
if (t === "data") {
|
|
2696
|
-
this[
|
|
2697
|
-
this[
|
|
2698
|
-
if (!this[
|
|
2699
|
-
this[
|
|
2740
|
+
this[oe] = false;
|
|
2741
|
+
this[re]++;
|
|
2742
|
+
if (!this[qt].length && !this[jt]) {
|
|
2743
|
+
this[Gt]();
|
|
2700
2744
|
}
|
|
2701
|
-
} else if (t === "readable" && this[
|
|
2745
|
+
} else if (t === "readable" && this[Ht] !== 0) {
|
|
2702
2746
|
super.emit("readable");
|
|
2703
|
-
} else if (
|
|
2747
|
+
} else if (le(t) && this[Rt]) {
|
|
2704
2748
|
super.emit(t);
|
|
2705
2749
|
this.removeAllListeners(t);
|
|
2706
2750
|
} else if (t === "error" && this[Ot]) {
|
|
2707
2751
|
const t = e;
|
|
2708
|
-
if (this[
|
|
2752
|
+
if (this[ee]) he((() => t.call(this, this[Ot]))); else t.call(this, this[Ot]);
|
|
2709
2753
|
}
|
|
2710
2754
|
return s;
|
|
2711
2755
|
}
|
|
@@ -2715,9 +2759,9 @@ class Minipass extends r.EventEmitter {
|
|
|
2715
2759
|
off(t, e) {
|
|
2716
2760
|
const s = super.off(t, e);
|
|
2717
2761
|
if (t === "data") {
|
|
2718
|
-
this[
|
|
2719
|
-
if (this[
|
|
2720
|
-
this[
|
|
2762
|
+
this[re] = this.listeners("data").length;
|
|
2763
|
+
if (this[re] === 0 && !this[oe] && !this[qt].length) {
|
|
2764
|
+
this[jt] = false;
|
|
2721
2765
|
}
|
|
2722
2766
|
}
|
|
2723
2767
|
return s;
|
|
@@ -2725,44 +2769,44 @@ class Minipass extends r.EventEmitter {
|
|
|
2725
2769
|
removeAllListeners(t) {
|
|
2726
2770
|
const e = super.removeAllListeners(t);
|
|
2727
2771
|
if (t === "data" || t === undefined) {
|
|
2728
|
-
this[
|
|
2729
|
-
if (!this[
|
|
2730
|
-
this[
|
|
2772
|
+
this[re] = 0;
|
|
2773
|
+
if (!this[oe] && !this[qt].length) {
|
|
2774
|
+
this[jt] = false;
|
|
2731
2775
|
}
|
|
2732
2776
|
}
|
|
2733
2777
|
return e;
|
|
2734
2778
|
}
|
|
2735
2779
|
get emittedEnd() {
|
|
2736
|
-
return this[
|
|
2780
|
+
return this[Rt];
|
|
2737
2781
|
}
|
|
2738
2782
|
[Ft]() {
|
|
2739
|
-
if (!this[
|
|
2740
|
-
this[
|
|
2783
|
+
if (!this[zt] && !this[Rt] && !this[Kt] && this[$t].length === 0 && this[Pt]) {
|
|
2784
|
+
this[zt] = true;
|
|
2741
2785
|
this.emit("end");
|
|
2742
2786
|
this.emit("prefinish");
|
|
2743
2787
|
this.emit("finish");
|
|
2744
|
-
if (this[
|
|
2745
|
-
this[
|
|
2788
|
+
if (this[Dt]) this.emit("close");
|
|
2789
|
+
this[zt] = false;
|
|
2746
2790
|
}
|
|
2747
2791
|
}
|
|
2748
2792
|
emit(t, ...e) {
|
|
2749
2793
|
const s = e[0];
|
|
2750
|
-
if (t !== "error" && t !== "close" && t !==
|
|
2794
|
+
if (t !== "error" && t !== "close" && t !== Kt && this[Kt]) {
|
|
2751
2795
|
return false;
|
|
2752
2796
|
} else if (t === "data") {
|
|
2753
|
-
return !this[
|
|
2797
|
+
return !this[Jt] && !s ? false : this[ee] ? (he((() => this[Xt](s))), true) : this[Xt](s);
|
|
2754
2798
|
} else if (t === "end") {
|
|
2755
|
-
return this[
|
|
2799
|
+
return this[Qt]();
|
|
2756
2800
|
} else if (t === "close") {
|
|
2757
|
-
this[
|
|
2758
|
-
if (!this[
|
|
2801
|
+
this[Dt] = true;
|
|
2802
|
+
if (!this[Rt] && !this[Kt]) return false;
|
|
2759
2803
|
const t = super.emit("close");
|
|
2760
2804
|
this.removeAllListeners("close");
|
|
2761
2805
|
return t;
|
|
2762
2806
|
} else if (t === "error") {
|
|
2763
2807
|
this[Ot] = s;
|
|
2764
|
-
super.emit(
|
|
2765
|
-
const t = !this[
|
|
2808
|
+
super.emit(Yt, s);
|
|
2809
|
+
const t = !this[ne] || this.listeners("error").length ? super.emit("error", s) : false;
|
|
2766
2810
|
this[Ft]();
|
|
2767
2811
|
return t;
|
|
2768
2812
|
} else if (t === "resume") {
|
|
@@ -2778,31 +2822,31 @@ class Minipass extends r.EventEmitter {
|
|
|
2778
2822
|
this[Ft]();
|
|
2779
2823
|
return i;
|
|
2780
2824
|
}
|
|
2781
|
-
[
|
|
2782
|
-
for (const e of this[
|
|
2825
|
+
[Xt](t) {
|
|
2826
|
+
for (const e of this[qt]) {
|
|
2783
2827
|
if (e.dest.write(t) === false) this.pause();
|
|
2784
2828
|
}
|
|
2785
|
-
const e = this[
|
|
2829
|
+
const e = this[oe] ? false : super.emit("data", t);
|
|
2786
2830
|
this[Ft]();
|
|
2787
2831
|
return e;
|
|
2788
2832
|
}
|
|
2789
|
-
[
|
|
2790
|
-
if (this[
|
|
2791
|
-
this[
|
|
2833
|
+
[Qt]() {
|
|
2834
|
+
if (this[Rt]) return false;
|
|
2835
|
+
this[Rt] = true;
|
|
2792
2836
|
this.readable = false;
|
|
2793
|
-
return this[
|
|
2837
|
+
return this[ee] ? (he((() => this[te]())), true) : this[te]();
|
|
2794
2838
|
}
|
|
2795
|
-
[
|
|
2796
|
-
if (this[
|
|
2797
|
-
const t = this[
|
|
2839
|
+
[te]() {
|
|
2840
|
+
if (this[It]) {
|
|
2841
|
+
const t = this[It].end();
|
|
2798
2842
|
if (t) {
|
|
2799
|
-
for (const e of this[
|
|
2843
|
+
for (const e of this[qt]) {
|
|
2800
2844
|
e.dest.write(t);
|
|
2801
2845
|
}
|
|
2802
|
-
if (!this[
|
|
2846
|
+
if (!this[oe]) super.emit("data", t);
|
|
2803
2847
|
}
|
|
2804
2848
|
}
|
|
2805
|
-
for (const t of this[
|
|
2849
|
+
for (const t of this[qt]) {
|
|
2806
2850
|
t.end();
|
|
2807
2851
|
}
|
|
2808
2852
|
const t = super.emit("end");
|
|
@@ -2813,31 +2857,31 @@ class Minipass extends r.EventEmitter {
|
|
|
2813
2857
|
const t = Object.assign([], {
|
|
2814
2858
|
dataLength: 0
|
|
2815
2859
|
});
|
|
2816
|
-
if (!this[
|
|
2860
|
+
if (!this[Jt]) t.dataLength = 0;
|
|
2817
2861
|
const e = this.promise();
|
|
2818
2862
|
this.on("data", (e => {
|
|
2819
2863
|
t.push(e);
|
|
2820
|
-
if (!this[
|
|
2864
|
+
if (!this[Jt]) t.dataLength += e.length;
|
|
2821
2865
|
}));
|
|
2822
2866
|
await e;
|
|
2823
2867
|
return t;
|
|
2824
2868
|
}
|
|
2825
2869
|
async concat() {
|
|
2826
|
-
if (this[
|
|
2870
|
+
if (this[Jt]) {
|
|
2827
2871
|
throw new Error("cannot concat in objectMode");
|
|
2828
2872
|
}
|
|
2829
2873
|
const t = await this.collect();
|
|
2830
|
-
return this[
|
|
2874
|
+
return this[_t] ? t.join("") : Buffer.concat(t, t.dataLength);
|
|
2831
2875
|
}
|
|
2832
2876
|
async promise() {
|
|
2833
2877
|
return new Promise(((t, e) => {
|
|
2834
|
-
this.on(
|
|
2878
|
+
this.on(Kt, (() => e(new Error("stream destroyed"))));
|
|
2835
2879
|
this.on("error", (t => e(t)));
|
|
2836
2880
|
this.on("end", (() => t()));
|
|
2837
2881
|
}));
|
|
2838
2882
|
}
|
|
2839
2883
|
[Symbol.asyncIterator]() {
|
|
2840
|
-
this[
|
|
2884
|
+
this[oe] = false;
|
|
2841
2885
|
let t = false;
|
|
2842
2886
|
const e = async () => {
|
|
2843
2887
|
this.pause();
|
|
@@ -2860,14 +2904,14 @@ class Minipass extends r.EventEmitter {
|
|
|
2860
2904
|
const r = t => {
|
|
2861
2905
|
this.off("data", o);
|
|
2862
2906
|
this.off("end", h);
|
|
2863
|
-
this.off(
|
|
2907
|
+
this.off(Kt, a);
|
|
2864
2908
|
e();
|
|
2865
2909
|
n(t);
|
|
2866
2910
|
};
|
|
2867
2911
|
const o = t => {
|
|
2868
2912
|
this.off("error", r);
|
|
2869
2913
|
this.off("end", h);
|
|
2870
|
-
this.off(
|
|
2914
|
+
this.off(Kt, a);
|
|
2871
2915
|
this.pause();
|
|
2872
2916
|
i({
|
|
2873
2917
|
value: t,
|
|
@@ -2877,7 +2921,7 @@ class Minipass extends r.EventEmitter {
|
|
|
2877
2921
|
const h = () => {
|
|
2878
2922
|
this.off("error", r);
|
|
2879
2923
|
this.off("data", o);
|
|
2880
|
-
this.off(
|
|
2924
|
+
this.off(Kt, a);
|
|
2881
2925
|
e();
|
|
2882
2926
|
i({
|
|
2883
2927
|
done: true,
|
|
@@ -2888,7 +2932,7 @@ class Minipass extends r.EventEmitter {
|
|
|
2888
2932
|
return new Promise(((t, e) => {
|
|
2889
2933
|
n = e;
|
|
2890
2934
|
i = t;
|
|
2891
|
-
this.once(
|
|
2935
|
+
this.once(Kt, a);
|
|
2892
2936
|
this.once("error", r);
|
|
2893
2937
|
this.once("end", h);
|
|
2894
2938
|
this.once("data", o);
|
|
@@ -2904,12 +2948,12 @@ class Minipass extends r.EventEmitter {
|
|
|
2904
2948
|
};
|
|
2905
2949
|
}
|
|
2906
2950
|
[Symbol.iterator]() {
|
|
2907
|
-
this[
|
|
2951
|
+
this[oe] = false;
|
|
2908
2952
|
let t = false;
|
|
2909
2953
|
const e = () => {
|
|
2910
2954
|
this.pause();
|
|
2955
|
+
this.off(Yt, e);
|
|
2911
2956
|
this.off(Kt, e);
|
|
2912
|
-
this.off(Jt, e);
|
|
2913
2957
|
this.off("end", e);
|
|
2914
2958
|
t = true;
|
|
2915
2959
|
return {
|
|
@@ -2926,8 +2970,8 @@ class Minipass extends r.EventEmitter {
|
|
|
2926
2970
|
};
|
|
2927
2971
|
};
|
|
2928
2972
|
this.once("end", e);
|
|
2973
|
+
this.once(Yt, e);
|
|
2929
2974
|
this.once(Kt, e);
|
|
2930
|
-
this.once(Jt, e);
|
|
2931
2975
|
return {
|
|
2932
2976
|
next: s,
|
|
2933
2977
|
throw: e,
|
|
@@ -2938,17 +2982,17 @@ class Minipass extends r.EventEmitter {
|
|
|
2938
2982
|
};
|
|
2939
2983
|
}
|
|
2940
2984
|
destroy(t) {
|
|
2941
|
-
if (this[
|
|
2942
|
-
if (t) this.emit("error", t); else this.emit(
|
|
2985
|
+
if (this[Kt]) {
|
|
2986
|
+
if (t) this.emit("error", t); else this.emit(Kt);
|
|
2943
2987
|
return this;
|
|
2944
2988
|
}
|
|
2945
|
-
this[
|
|
2946
|
-
this[
|
|
2947
|
-
this[
|
|
2948
|
-
this[
|
|
2989
|
+
this[Kt] = true;
|
|
2990
|
+
this[oe] = true;
|
|
2991
|
+
this[$t].length = 0;
|
|
2992
|
+
this[Ht] = 0;
|
|
2949
2993
|
const e = this;
|
|
2950
|
-
if (typeof e.close === "function" && !this[
|
|
2951
|
-
if (t) this.emit("error", t); else this.emit(
|
|
2994
|
+
if (typeof e.close === "function" && !this[Dt]) e.close();
|
|
2995
|
+
if (t) this.emit("error", t); else this.emit(Kt);
|
|
2952
2996
|
return this;
|
|
2953
2997
|
}
|
|
2954
2998
|
static get isStream() {
|
|
@@ -2956,92 +3000,92 @@ class Minipass extends r.EventEmitter {
|
|
|
2956
3000
|
}
|
|
2957
3001
|
}
|
|
2958
3002
|
|
|
2959
|
-
const
|
|
3003
|
+
const pe = i.realpathSync.native;
|
|
2960
3004
|
|
|
2961
|
-
const
|
|
3005
|
+
const ge = {
|
|
2962
3006
|
lstatSync: i.lstatSync,
|
|
2963
3007
|
readdir: i.readdir,
|
|
2964
3008
|
readdirSync: i.readdirSync,
|
|
2965
3009
|
readlinkSync: i.readlinkSync,
|
|
2966
|
-
realpathSync:
|
|
3010
|
+
realpathSync: pe,
|
|
2967
3011
|
promises: {
|
|
2968
|
-
lstat:
|
|
2969
|
-
readdir:
|
|
2970
|
-
readlink:
|
|
2971
|
-
realpath:
|
|
3012
|
+
lstat: r.lstat,
|
|
3013
|
+
readdir: r.readdir,
|
|
3014
|
+
readlink: r.readlink,
|
|
3015
|
+
realpath: r.realpath
|
|
2972
3016
|
}
|
|
2973
3017
|
};
|
|
2974
3018
|
|
|
2975
|
-
const
|
|
2976
|
-
...
|
|
3019
|
+
const me = t => !t || t === ge || t === f ? ge : {
|
|
3020
|
+
...ge,
|
|
2977
3021
|
...t,
|
|
2978
3022
|
promises: {
|
|
2979
|
-
...
|
|
3023
|
+
...ge.promises,
|
|
2980
3024
|
...t.promises || {}
|
|
2981
3025
|
}
|
|
2982
3026
|
};
|
|
2983
3027
|
|
|
2984
|
-
const
|
|
3028
|
+
const we = /^\\\\\?\\([a-z]:)\\?$/i;
|
|
2985
3029
|
|
|
2986
|
-
const
|
|
3030
|
+
const ye = t => t.replace(/\//g, "\\").replace(we, "$1\\");
|
|
2987
3031
|
|
|
2988
|
-
const
|
|
3032
|
+
const be = /[\\\/]/;
|
|
2989
3033
|
|
|
2990
|
-
const
|
|
3034
|
+
const Se = 0;
|
|
2991
3035
|
|
|
2992
|
-
const
|
|
3036
|
+
const ke = 1;
|
|
2993
3037
|
|
|
2994
|
-
const
|
|
3038
|
+
const ve = 2;
|
|
2995
3039
|
|
|
2996
|
-
const
|
|
3040
|
+
const xe = 4;
|
|
2997
3041
|
|
|
2998
|
-
const
|
|
3042
|
+
const Ee = 6;
|
|
2999
3043
|
|
|
3000
|
-
const
|
|
3044
|
+
const Te = 8;
|
|
3001
3045
|
|
|
3002
|
-
const
|
|
3046
|
+
const Ce = 10;
|
|
3003
3047
|
|
|
3004
3048
|
const Le = 12;
|
|
3005
3049
|
|
|
3006
3050
|
const Ae = 15;
|
|
3007
3051
|
|
|
3008
|
-
const
|
|
3052
|
+
const Me = ~Ae;
|
|
3009
3053
|
|
|
3010
3054
|
const Pe = 16;
|
|
3011
3055
|
|
|
3012
3056
|
const Fe = 32;
|
|
3013
3057
|
|
|
3014
|
-
const
|
|
3058
|
+
const Re = 64;
|
|
3015
3059
|
|
|
3016
|
-
const
|
|
3060
|
+
const ze = 128;
|
|
3017
3061
|
|
|
3018
3062
|
const Oe = 256;
|
|
3019
3063
|
|
|
3020
|
-
const
|
|
3064
|
+
const De = 512;
|
|
3021
3065
|
|
|
3022
|
-
const
|
|
3066
|
+
const Ne = Re | ze | De;
|
|
3023
3067
|
|
|
3024
|
-
const
|
|
3068
|
+
const Be = 1023;
|
|
3025
3069
|
|
|
3026
|
-
const
|
|
3070
|
+
const We = t => t.isFile() ? Te : t.isDirectory() ? xe : t.isSymbolicLink() ? Ce : t.isCharacterDevice() ? ve : t.isBlockDevice() ? Ee : t.isSocket() ? Le : t.isFIFO() ? ke : Se;
|
|
3027
3071
|
|
|
3028
|
-
const
|
|
3072
|
+
const _e = new Map;
|
|
3029
3073
|
|
|
3030
|
-
const
|
|
3031
|
-
const e =
|
|
3074
|
+
const Ie = t => {
|
|
3075
|
+
const e = _e.get(t);
|
|
3032
3076
|
if (e) return e;
|
|
3033
3077
|
const s = t.normalize("NFKD");
|
|
3034
|
-
|
|
3078
|
+
_e.set(t, s);
|
|
3035
3079
|
return s;
|
|
3036
3080
|
};
|
|
3037
3081
|
|
|
3038
|
-
const
|
|
3082
|
+
const je = new Map;
|
|
3039
3083
|
|
|
3040
|
-
const
|
|
3041
|
-
const e =
|
|
3084
|
+
const Ue = t => {
|
|
3085
|
+
const e = je.get(t);
|
|
3042
3086
|
if (e) return e;
|
|
3043
|
-
const s =
|
|
3044
|
-
|
|
3087
|
+
const s = Ie(t.toLowerCase());
|
|
3088
|
+
je.set(t, s);
|
|
3045
3089
|
return s;
|
|
3046
3090
|
};
|
|
3047
3091
|
|
|
@@ -3062,7 +3106,7 @@ class ChildrenCache extends LRUCache {
|
|
|
3062
3106
|
}
|
|
3063
3107
|
}
|
|
3064
3108
|
|
|
3065
|
-
const
|
|
3109
|
+
const Ge = Symbol("PathScurry setAsCwd");
|
|
3066
3110
|
|
|
3067
3111
|
class PathBase {
|
|
3068
3112
|
name;
|
|
@@ -3070,117 +3114,121 @@ class PathBase {
|
|
|
3070
3114
|
roots;
|
|
3071
3115
|
parent;
|
|
3072
3116
|
nocase;
|
|
3073
|
-
|
|
3074
|
-
#st;
|
|
3075
|
-
get dev() {
|
|
3076
|
-
return this.#st;
|
|
3077
|
-
}
|
|
3078
|
-
#it;
|
|
3079
|
-
get mode() {
|
|
3080
|
-
return this.#it;
|
|
3081
|
-
}
|
|
3117
|
+
isCWD=false;
|
|
3082
3118
|
#nt;
|
|
3083
|
-
get nlink() {
|
|
3084
|
-
return this.#nt;
|
|
3085
|
-
}
|
|
3086
3119
|
#rt;
|
|
3087
|
-
get
|
|
3120
|
+
get dev() {
|
|
3088
3121
|
return this.#rt;
|
|
3089
3122
|
}
|
|
3090
3123
|
#ot;
|
|
3091
|
-
get
|
|
3124
|
+
get mode() {
|
|
3092
3125
|
return this.#ot;
|
|
3093
3126
|
}
|
|
3094
3127
|
#ht;
|
|
3095
|
-
get
|
|
3128
|
+
get nlink() {
|
|
3096
3129
|
return this.#ht;
|
|
3097
3130
|
}
|
|
3098
3131
|
#at;
|
|
3099
|
-
get
|
|
3132
|
+
get uid() {
|
|
3100
3133
|
return this.#at;
|
|
3101
3134
|
}
|
|
3102
3135
|
#lt;
|
|
3103
|
-
get
|
|
3136
|
+
get gid() {
|
|
3104
3137
|
return this.#lt;
|
|
3105
3138
|
}
|
|
3106
|
-
#k;
|
|
3107
|
-
get size() {
|
|
3108
|
-
return this.#k;
|
|
3109
|
-
}
|
|
3110
3139
|
#ct;
|
|
3111
|
-
get
|
|
3140
|
+
get rdev() {
|
|
3112
3141
|
return this.#ct;
|
|
3113
3142
|
}
|
|
3114
3143
|
#ft;
|
|
3115
|
-
get
|
|
3144
|
+
get blksize() {
|
|
3116
3145
|
return this.#ft;
|
|
3117
3146
|
}
|
|
3118
3147
|
#ut;
|
|
3119
|
-
get
|
|
3148
|
+
get ino() {
|
|
3120
3149
|
return this.#ut;
|
|
3121
3150
|
}
|
|
3151
|
+
#v;
|
|
3152
|
+
get size() {
|
|
3153
|
+
return this.#v;
|
|
3154
|
+
}
|
|
3122
3155
|
#dt;
|
|
3123
|
-
get
|
|
3156
|
+
get blocks() {
|
|
3124
3157
|
return this.#dt;
|
|
3125
3158
|
}
|
|
3126
3159
|
#pt;
|
|
3127
|
-
get
|
|
3160
|
+
get atimeMs() {
|
|
3128
3161
|
return this.#pt;
|
|
3129
3162
|
}
|
|
3130
3163
|
#gt;
|
|
3131
|
-
get
|
|
3164
|
+
get mtimeMs() {
|
|
3132
3165
|
return this.#gt;
|
|
3133
3166
|
}
|
|
3134
3167
|
#mt;
|
|
3135
|
-
get
|
|
3168
|
+
get ctimeMs() {
|
|
3136
3169
|
return this.#mt;
|
|
3137
3170
|
}
|
|
3138
3171
|
#wt;
|
|
3139
|
-
get
|
|
3172
|
+
get birthtimeMs() {
|
|
3140
3173
|
return this.#wt;
|
|
3141
3174
|
}
|
|
3142
3175
|
#yt;
|
|
3143
|
-
get
|
|
3176
|
+
get atime() {
|
|
3144
3177
|
return this.#yt;
|
|
3145
3178
|
}
|
|
3146
3179
|
#bt;
|
|
3180
|
+
get mtime() {
|
|
3181
|
+
return this.#bt;
|
|
3182
|
+
}
|
|
3147
3183
|
#St;
|
|
3184
|
+
get ctime() {
|
|
3185
|
+
return this.#St;
|
|
3186
|
+
}
|
|
3148
3187
|
#kt;
|
|
3188
|
+
get birthtime() {
|
|
3189
|
+
return this.#kt;
|
|
3190
|
+
}
|
|
3149
3191
|
#vt;
|
|
3150
3192
|
#xt;
|
|
3151
3193
|
#Et;
|
|
3152
3194
|
#Tt;
|
|
3195
|
+
#Ct;
|
|
3153
3196
|
#Lt;
|
|
3154
3197
|
#At;
|
|
3155
|
-
#
|
|
3156
|
-
|
|
3198
|
+
#Mt;
|
|
3199
|
+
#Pt;
|
|
3200
|
+
#Ft;
|
|
3201
|
+
get parentPath() {
|
|
3157
3202
|
return (this.parent || this).fullpath();
|
|
3158
3203
|
}
|
|
3159
|
-
|
|
3204
|
+
get path() {
|
|
3205
|
+
return this.parentPath;
|
|
3206
|
+
}
|
|
3207
|
+
constructor(t, e = Se, s, i, n, r, o) {
|
|
3160
3208
|
this.name = t;
|
|
3161
|
-
this.#
|
|
3162
|
-
this.#
|
|
3209
|
+
this.#vt = n ? Ue(t) : Ie(t);
|
|
3210
|
+
this.#At = e & Be;
|
|
3163
3211
|
this.nocase = n;
|
|
3164
3212
|
this.roots = i;
|
|
3165
3213
|
this.root = s || this;
|
|
3166
|
-
this.#
|
|
3167
|
-
this.#
|
|
3168
|
-
this.#
|
|
3169
|
-
this.#
|
|
3214
|
+
this.#Mt = r;
|
|
3215
|
+
this.#Et = o.fullpath;
|
|
3216
|
+
this.#Ct = o.relative;
|
|
3217
|
+
this.#Lt = o.relativePosix;
|
|
3170
3218
|
this.parent = o.parent;
|
|
3171
3219
|
if (this.parent) {
|
|
3172
|
-
this.#
|
|
3220
|
+
this.#nt = this.parent.#nt;
|
|
3173
3221
|
} else {
|
|
3174
|
-
this.#
|
|
3222
|
+
this.#nt = me(o.fs);
|
|
3175
3223
|
}
|
|
3176
3224
|
}
|
|
3177
3225
|
depth() {
|
|
3178
|
-
if (this.#
|
|
3179
|
-
if (!this.parent) return this.#
|
|
3180
|
-
return this.#
|
|
3226
|
+
if (this.#xt !== undefined) return this.#xt;
|
|
3227
|
+
if (!this.parent) return this.#xt = 0;
|
|
3228
|
+
return this.#xt = this.parent.depth() + 1;
|
|
3181
3229
|
}
|
|
3182
3230
|
childrenCache() {
|
|
3183
|
-
return this.#
|
|
3231
|
+
return this.#Mt;
|
|
3184
3232
|
}
|
|
3185
3233
|
resolve(t) {
|
|
3186
3234
|
if (!t) {
|
|
@@ -3189,10 +3237,10 @@ class PathBase {
|
|
|
3189
3237
|
const e = this.getRootString(t);
|
|
3190
3238
|
const s = t.substring(e.length);
|
|
3191
3239
|
const i = s.split(this.splitSep);
|
|
3192
|
-
const n = e ? this.getRoot(e).#
|
|
3240
|
+
const n = e ? this.getRoot(e).#Rt(i) : this.#Rt(i);
|
|
3193
3241
|
return n;
|
|
3194
3242
|
}
|
|
3195
|
-
#
|
|
3243
|
+
#Rt(t) {
|
|
3196
3244
|
let e = this;
|
|
3197
3245
|
for (const s of t) {
|
|
3198
3246
|
e = e.child(s);
|
|
@@ -3200,15 +3248,15 @@ class PathBase {
|
|
|
3200
3248
|
return e;
|
|
3201
3249
|
}
|
|
3202
3250
|
children() {
|
|
3203
|
-
const t = this.#
|
|
3251
|
+
const t = this.#Mt.get(this);
|
|
3204
3252
|
if (t) {
|
|
3205
3253
|
return t;
|
|
3206
3254
|
}
|
|
3207
3255
|
const e = Object.assign([], {
|
|
3208
3256
|
provisional: 0
|
|
3209
3257
|
});
|
|
3210
|
-
this.#
|
|
3211
|
-
this.#
|
|
3258
|
+
this.#Mt.set(this, e);
|
|
3259
|
+
this.#At &= ~Pe;
|
|
3212
3260
|
return e;
|
|
3213
3261
|
}
|
|
3214
3262
|
child(t, e) {
|
|
@@ -3219,79 +3267,81 @@ class PathBase {
|
|
|
3219
3267
|
return this.parent || this;
|
|
3220
3268
|
}
|
|
3221
3269
|
const s = this.children();
|
|
3222
|
-
const i = this.nocase ?
|
|
3270
|
+
const i = this.nocase ? Ue(t) : Ie(t);
|
|
3223
3271
|
for (const t of s) {
|
|
3224
|
-
if (t.#
|
|
3272
|
+
if (t.#vt === i) {
|
|
3225
3273
|
return t;
|
|
3226
3274
|
}
|
|
3227
3275
|
}
|
|
3228
3276
|
const n = this.parent ? this.sep : "";
|
|
3229
|
-
const r = this.#
|
|
3230
|
-
const o = this.newChild(t,
|
|
3277
|
+
const r = this.#Et ? this.#Et + n + t : undefined;
|
|
3278
|
+
const o = this.newChild(t, Se, {
|
|
3231
3279
|
...e,
|
|
3232
3280
|
parent: this,
|
|
3233
3281
|
fullpath: r
|
|
3234
3282
|
});
|
|
3235
3283
|
if (!this.canReaddir()) {
|
|
3236
|
-
o.#
|
|
3284
|
+
o.#At |= ze;
|
|
3237
3285
|
}
|
|
3238
3286
|
s.push(o);
|
|
3239
3287
|
return o;
|
|
3240
3288
|
}
|
|
3241
3289
|
relative() {
|
|
3242
|
-
if (this
|
|
3243
|
-
|
|
3290
|
+
if (this.isCWD) return "";
|
|
3291
|
+
if (this.#Ct !== undefined) {
|
|
3292
|
+
return this.#Ct;
|
|
3244
3293
|
}
|
|
3245
3294
|
const t = this.name;
|
|
3246
3295
|
const e = this.parent;
|
|
3247
3296
|
if (!e) {
|
|
3248
|
-
return this.#
|
|
3297
|
+
return this.#Ct = this.name;
|
|
3249
3298
|
}
|
|
3250
3299
|
const s = e.relative();
|
|
3251
3300
|
return s + (!s || !e.parent ? "" : this.sep) + t;
|
|
3252
3301
|
}
|
|
3253
3302
|
relativePosix() {
|
|
3254
3303
|
if (this.sep === "/") return this.relative();
|
|
3255
|
-
if (this
|
|
3304
|
+
if (this.isCWD) return "";
|
|
3305
|
+
if (this.#Lt !== undefined) return this.#Lt;
|
|
3256
3306
|
const t = this.name;
|
|
3257
3307
|
const e = this.parent;
|
|
3258
3308
|
if (!e) {
|
|
3259
|
-
return this.#
|
|
3309
|
+
return this.#Lt = this.fullpathPosix();
|
|
3260
3310
|
}
|
|
3261
3311
|
const s = e.relativePosix();
|
|
3262
3312
|
return s + (!s || !e.parent ? "" : "/") + t;
|
|
3263
3313
|
}
|
|
3264
3314
|
fullpath() {
|
|
3265
|
-
if (this.#
|
|
3266
|
-
return this.#
|
|
3315
|
+
if (this.#Et !== undefined) {
|
|
3316
|
+
return this.#Et;
|
|
3267
3317
|
}
|
|
3268
3318
|
const t = this.name;
|
|
3269
3319
|
const e = this.parent;
|
|
3270
3320
|
if (!e) {
|
|
3271
|
-
return this.#
|
|
3321
|
+
return this.#Et = this.name;
|
|
3272
3322
|
}
|
|
3273
3323
|
const s = e.fullpath();
|
|
3274
3324
|
const i = s + (!e.parent ? "" : this.sep) + t;
|
|
3275
|
-
return this.#
|
|
3325
|
+
return this.#Et = i;
|
|
3276
3326
|
}
|
|
3277
3327
|
fullpathPosix() {
|
|
3278
|
-
if (this.#
|
|
3279
|
-
if (this.sep === "/") return this.#
|
|
3328
|
+
if (this.#Tt !== undefined) return this.#Tt;
|
|
3329
|
+
if (this.sep === "/") return this.#Tt = this.fullpath();
|
|
3280
3330
|
if (!this.parent) {
|
|
3281
3331
|
const t = this.fullpath().replace(/\\/g, "/");
|
|
3282
3332
|
if (/^[a-z]:\//i.test(t)) {
|
|
3283
|
-
return this.#
|
|
3333
|
+
return this.#Tt = `//?/${t}`;
|
|
3284
3334
|
} else {
|
|
3285
|
-
return this.#
|
|
3335
|
+
return this.#Tt = t;
|
|
3286
3336
|
}
|
|
3287
3337
|
}
|
|
3288
3338
|
const t = this.parent;
|
|
3289
3339
|
const e = t.fullpathPosix();
|
|
3290
3340
|
const s = e + (!e || !t.parent ? "" : "/") + this.name;
|
|
3291
|
-
return this.#
|
|
3341
|
+
return this.#Tt = s;
|
|
3292
3342
|
}
|
|
3293
3343
|
isUnknown() {
|
|
3294
|
-
return (this.#
|
|
3344
|
+
return (this.#At & Ae) === Se;
|
|
3295
3345
|
}
|
|
3296
3346
|
isType(t) {
|
|
3297
3347
|
return this[`is${t}`]();
|
|
@@ -3300,56 +3350,56 @@ class PathBase {
|
|
|
3300
3350
|
return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : this.isSocket() ? "Socket" : "Unknown";
|
|
3301
3351
|
}
|
|
3302
3352
|
isFile() {
|
|
3303
|
-
return (this.#
|
|
3353
|
+
return (this.#At & Ae) === Te;
|
|
3304
3354
|
}
|
|
3305
3355
|
isDirectory() {
|
|
3306
|
-
return (this.#
|
|
3356
|
+
return (this.#At & Ae) === xe;
|
|
3307
3357
|
}
|
|
3308
3358
|
isCharacterDevice() {
|
|
3309
|
-
return (this.#
|
|
3359
|
+
return (this.#At & Ae) === ve;
|
|
3310
3360
|
}
|
|
3311
3361
|
isBlockDevice() {
|
|
3312
|
-
return (this.#
|
|
3362
|
+
return (this.#At & Ae) === Ee;
|
|
3313
3363
|
}
|
|
3314
3364
|
isFIFO() {
|
|
3315
|
-
return (this.#
|
|
3365
|
+
return (this.#At & Ae) === ke;
|
|
3316
3366
|
}
|
|
3317
3367
|
isSocket() {
|
|
3318
|
-
return (this.#
|
|
3368
|
+
return (this.#At & Ae) === Le;
|
|
3319
3369
|
}
|
|
3320
3370
|
isSymbolicLink() {
|
|
3321
|
-
return (this.#
|
|
3371
|
+
return (this.#At & Ce) === Ce;
|
|
3322
3372
|
}
|
|
3323
3373
|
lstatCached() {
|
|
3324
|
-
return this.#
|
|
3374
|
+
return this.#At & Fe ? this : undefined;
|
|
3325
3375
|
}
|
|
3326
3376
|
readlinkCached() {
|
|
3327
|
-
return this.#
|
|
3377
|
+
return this.#Pt;
|
|
3328
3378
|
}
|
|
3329
3379
|
realpathCached() {
|
|
3330
|
-
return this.#
|
|
3380
|
+
return this.#Ft;
|
|
3331
3381
|
}
|
|
3332
3382
|
readdirCached() {
|
|
3333
3383
|
const t = this.children();
|
|
3334
3384
|
return t.slice(0, t.provisional);
|
|
3335
3385
|
}
|
|
3336
3386
|
canReadlink() {
|
|
3337
|
-
if (this.#
|
|
3387
|
+
if (this.#Pt) return true;
|
|
3338
3388
|
if (!this.parent) return false;
|
|
3339
|
-
const t = this.#
|
|
3340
|
-
return !(t !==
|
|
3389
|
+
const t = this.#At & Ae;
|
|
3390
|
+
return !(t !== Se && t !== Ce || this.#At & Oe || this.#At & ze);
|
|
3341
3391
|
}
|
|
3342
3392
|
calledReaddir() {
|
|
3343
|
-
return !!(this.#
|
|
3393
|
+
return !!(this.#At & Pe);
|
|
3344
3394
|
}
|
|
3345
3395
|
isENOENT() {
|
|
3346
|
-
return !!(this.#
|
|
3396
|
+
return !!(this.#At & ze);
|
|
3347
3397
|
}
|
|
3348
3398
|
isNamed(t) {
|
|
3349
|
-
return !this.nocase ? this.#
|
|
3399
|
+
return !this.nocase ? this.#vt === Ie(t) : this.#vt === Ue(t);
|
|
3350
3400
|
}
|
|
3351
3401
|
async readlink() {
|
|
3352
|
-
const t = this.#
|
|
3402
|
+
const t = this.#Pt;
|
|
3353
3403
|
if (t) {
|
|
3354
3404
|
return t;
|
|
3355
3405
|
}
|
|
@@ -3360,18 +3410,18 @@ class PathBase {
|
|
|
3360
3410
|
return undefined;
|
|
3361
3411
|
}
|
|
3362
3412
|
try {
|
|
3363
|
-
const t = await this.#
|
|
3413
|
+
const t = await this.#nt.promises.readlink(this.fullpath());
|
|
3364
3414
|
const e = (await this.parent.realpath())?.resolve(t);
|
|
3365
3415
|
if (e) {
|
|
3366
|
-
return this.#
|
|
3416
|
+
return this.#Pt = e;
|
|
3367
3417
|
}
|
|
3368
3418
|
} catch (t) {
|
|
3369
|
-
this.#
|
|
3419
|
+
this.#zt(t.code);
|
|
3370
3420
|
return undefined;
|
|
3371
3421
|
}
|
|
3372
3422
|
}
|
|
3373
3423
|
readlinkSync() {
|
|
3374
|
-
const t = this.#
|
|
3424
|
+
const t = this.#Pt;
|
|
3375
3425
|
if (t) {
|
|
3376
3426
|
return t;
|
|
3377
3427
|
}
|
|
@@ -3382,104 +3432,104 @@ class PathBase {
|
|
|
3382
3432
|
return undefined;
|
|
3383
3433
|
}
|
|
3384
3434
|
try {
|
|
3385
|
-
const t = this.#
|
|
3435
|
+
const t = this.#nt.readlinkSync(this.fullpath());
|
|
3386
3436
|
const e = this.parent.realpathSync()?.resolve(t);
|
|
3387
3437
|
if (e) {
|
|
3388
|
-
return this.#
|
|
3438
|
+
return this.#Pt = e;
|
|
3389
3439
|
}
|
|
3390
3440
|
} catch (t) {
|
|
3391
|
-
this.#
|
|
3441
|
+
this.#zt(t.code);
|
|
3392
3442
|
return undefined;
|
|
3393
3443
|
}
|
|
3394
3444
|
}
|
|
3395
|
-
#
|
|
3396
|
-
this.#
|
|
3445
|
+
#Ot(t) {
|
|
3446
|
+
this.#At |= Pe;
|
|
3397
3447
|
for (let e = t.provisional; e < t.length; e++) {
|
|
3398
3448
|
const s = t[e];
|
|
3399
|
-
if (s) s.#
|
|
3449
|
+
if (s) s.#Dt();
|
|
3400
3450
|
}
|
|
3401
3451
|
}
|
|
3402
|
-
#
|
|
3403
|
-
if (this.#
|
|
3404
|
-
this.#
|
|
3405
|
-
this.#
|
|
3452
|
+
#Dt() {
|
|
3453
|
+
if (this.#At & ze) return;
|
|
3454
|
+
this.#At = (this.#At | ze) & Me;
|
|
3455
|
+
this.#Nt();
|
|
3406
3456
|
}
|
|
3407
|
-
#
|
|
3457
|
+
#Nt() {
|
|
3408
3458
|
const t = this.children();
|
|
3409
3459
|
t.provisional = 0;
|
|
3410
3460
|
for (const e of t) {
|
|
3411
|
-
e.#
|
|
3461
|
+
e.#Dt();
|
|
3412
3462
|
}
|
|
3413
3463
|
}
|
|
3414
|
-
#
|
|
3415
|
-
this.#
|
|
3416
|
-
this.#
|
|
3464
|
+
#Bt() {
|
|
3465
|
+
this.#At |= De;
|
|
3466
|
+
this.#Wt();
|
|
3417
3467
|
}
|
|
3418
|
-
#
|
|
3419
|
-
if (this.#
|
|
3420
|
-
let t = this.#
|
|
3421
|
-
if ((t & Ae) ===
|
|
3422
|
-
this.#
|
|
3423
|
-
this.#
|
|
3468
|
+
#Wt() {
|
|
3469
|
+
if (this.#At & Re) return;
|
|
3470
|
+
let t = this.#At;
|
|
3471
|
+
if ((t & Ae) === xe) t &= Me;
|
|
3472
|
+
this.#At = t | Re;
|
|
3473
|
+
this.#Nt();
|
|
3424
3474
|
}
|
|
3425
|
-
#
|
|
3475
|
+
#_t(t = "") {
|
|
3426
3476
|
if (t === "ENOTDIR" || t === "EPERM") {
|
|
3427
|
-
this.#
|
|
3477
|
+
this.#Wt();
|
|
3428
3478
|
} else if (t === "ENOENT") {
|
|
3429
|
-
this.#
|
|
3479
|
+
this.#Dt();
|
|
3430
3480
|
} else {
|
|
3431
3481
|
this.children().provisional = 0;
|
|
3432
3482
|
}
|
|
3433
3483
|
}
|
|
3434
|
-
#
|
|
3484
|
+
#It(t = "") {
|
|
3435
3485
|
if (t === "ENOTDIR") {
|
|
3436
3486
|
const t = this.parent;
|
|
3437
|
-
t.#
|
|
3487
|
+
t.#Wt();
|
|
3438
3488
|
} else if (t === "ENOENT") {
|
|
3439
|
-
this.#
|
|
3489
|
+
this.#Dt();
|
|
3440
3490
|
}
|
|
3441
3491
|
}
|
|
3442
|
-
#
|
|
3443
|
-
let e = this.#
|
|
3492
|
+
#zt(t = "") {
|
|
3493
|
+
let e = this.#At;
|
|
3444
3494
|
e |= Oe;
|
|
3445
|
-
if (t === "ENOENT") e |=
|
|
3495
|
+
if (t === "ENOENT") e |= ze;
|
|
3446
3496
|
if (t === "EINVAL" || t === "UNKNOWN") {
|
|
3447
|
-
e &=
|
|
3497
|
+
e &= Me;
|
|
3448
3498
|
}
|
|
3449
|
-
this.#
|
|
3499
|
+
this.#At = e;
|
|
3450
3500
|
if (t === "ENOTDIR" && this.parent) {
|
|
3451
|
-
this.parent.#
|
|
3501
|
+
this.parent.#Wt();
|
|
3452
3502
|
}
|
|
3453
3503
|
}
|
|
3454
|
-
#
|
|
3455
|
-
return this.#
|
|
3504
|
+
#jt(t, e) {
|
|
3505
|
+
return this.#Ut(t, e) || this.#Gt(t, e);
|
|
3456
3506
|
}
|
|
3457
|
-
#
|
|
3458
|
-
const s =
|
|
3507
|
+
#Gt(t, e) {
|
|
3508
|
+
const s = We(t);
|
|
3459
3509
|
const i = this.newChild(t.name, s, {
|
|
3460
3510
|
parent: this
|
|
3461
3511
|
});
|
|
3462
|
-
const n = i.#
|
|
3463
|
-
if (n !==
|
|
3464
|
-
i.#
|
|
3512
|
+
const n = i.#At & Ae;
|
|
3513
|
+
if (n !== xe && n !== Ce && n !== Se) {
|
|
3514
|
+
i.#At |= Re;
|
|
3465
3515
|
}
|
|
3466
3516
|
e.unshift(i);
|
|
3467
3517
|
e.provisional++;
|
|
3468
3518
|
return i;
|
|
3469
3519
|
}
|
|
3470
|
-
#
|
|
3520
|
+
#Ut(t, e) {
|
|
3471
3521
|
for (let s = e.provisional; s < e.length; s++) {
|
|
3472
3522
|
const i = e[s];
|
|
3473
|
-
const n = this.nocase ?
|
|
3474
|
-
if (n !== i.#
|
|
3523
|
+
const n = this.nocase ? Ue(t.name) : Ie(t.name);
|
|
3524
|
+
if (n !== i.#vt) {
|
|
3475
3525
|
continue;
|
|
3476
3526
|
}
|
|
3477
|
-
return this
|
|
3527
|
+
return this.#$t(t, i, s, e);
|
|
3478
3528
|
}
|
|
3479
3529
|
}
|
|
3480
|
-
|
|
3530
|
+
#$t(t, e, s, i) {
|
|
3481
3531
|
const n = e.name;
|
|
3482
|
-
e.#
|
|
3532
|
+
e.#At = e.#At & Me | We(t);
|
|
3483
3533
|
if (n !== t.name) e.name = t.name;
|
|
3484
3534
|
if (s !== i.provisional) {
|
|
3485
3535
|
if (s === i.length - 1) i.pop(); else i.splice(s, 1);
|
|
@@ -3489,57 +3539,57 @@ class PathBase {
|
|
|
3489
3539
|
return e;
|
|
3490
3540
|
}
|
|
3491
3541
|
async lstat() {
|
|
3492
|
-
if ((this.#
|
|
3542
|
+
if ((this.#At & ze) === 0) {
|
|
3493
3543
|
try {
|
|
3494
|
-
this.#
|
|
3544
|
+
this.#qt(await this.#nt.promises.lstat(this.fullpath()));
|
|
3495
3545
|
return this;
|
|
3496
3546
|
} catch (t) {
|
|
3497
|
-
this.#
|
|
3547
|
+
this.#It(t.code);
|
|
3498
3548
|
}
|
|
3499
3549
|
}
|
|
3500
3550
|
}
|
|
3501
3551
|
lstatSync() {
|
|
3502
|
-
if ((this.#
|
|
3552
|
+
if ((this.#At & ze) === 0) {
|
|
3503
3553
|
try {
|
|
3504
|
-
this.#
|
|
3554
|
+
this.#qt(this.#nt.lstatSync(this.fullpath()));
|
|
3505
3555
|
return this;
|
|
3506
3556
|
} catch (t) {
|
|
3507
|
-
this.#
|
|
3557
|
+
this.#It(t.code);
|
|
3508
3558
|
}
|
|
3509
3559
|
}
|
|
3510
3560
|
}
|
|
3511
|
-
#Ut(t) {
|
|
3512
|
-
const {atime: e, atimeMs: s, birthtime: i, birthtimeMs: n, blksize: r, blocks: o, ctime: h, ctimeMs: a, dev: l, gid: c, ino: f, mode: u, mtime: d, mtimeMs: p, nlink: g, rdev: m, size: w, uid: y} = t;
|
|
3513
|
-
this.#gt = e;
|
|
3514
|
-
this.#ft = s;
|
|
3515
|
-
this.#yt = i;
|
|
3516
|
-
this.#pt = n;
|
|
3517
|
-
this.#at = r;
|
|
3518
|
-
this.#ct = o;
|
|
3519
|
-
this.#wt = h;
|
|
3520
|
-
this.#dt = a;
|
|
3521
|
-
this.#st = l;
|
|
3522
|
-
this.#ot = c;
|
|
3523
|
-
this.#lt = f;
|
|
3524
|
-
this.#it = u;
|
|
3525
|
-
this.#mt = d;
|
|
3526
|
-
this.#ut = p;
|
|
3527
|
-
this.#nt = g;
|
|
3528
|
-
this.#ht = m;
|
|
3529
|
-
this.#k = w;
|
|
3530
|
-
this.#rt = y;
|
|
3531
|
-
const b = Be(t);
|
|
3532
|
-
this.#Tt = this.#Tt & Ce | b | Fe;
|
|
3533
|
-
if (b !== be && b !== ve && b !== Te) {
|
|
3534
|
-
this.#Tt |= Me;
|
|
3535
|
-
}
|
|
3536
|
-
}
|
|
3537
|
-
#Gt=[];
|
|
3538
|
-
#$t=false;
|
|
3539
3561
|
#qt(t) {
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
this.#
|
|
3562
|
+
const {atime: e, atimeMs: s, birthtime: i, birthtimeMs: n, blksize: r, blocks: o, ctime: h, ctimeMs: a, dev: l, gid: c, ino: f, mode: u, mtime: d, mtimeMs: p, nlink: g, rdev: m, size: w, uid: y} = t;
|
|
3563
|
+
this.#yt = e;
|
|
3564
|
+
this.#pt = s;
|
|
3565
|
+
this.#kt = i;
|
|
3566
|
+
this.#wt = n;
|
|
3567
|
+
this.#ft = r;
|
|
3568
|
+
this.#dt = o;
|
|
3569
|
+
this.#St = h;
|
|
3570
|
+
this.#mt = a;
|
|
3571
|
+
this.#rt = l;
|
|
3572
|
+
this.#lt = c;
|
|
3573
|
+
this.#ut = f;
|
|
3574
|
+
this.#ot = u;
|
|
3575
|
+
this.#bt = d;
|
|
3576
|
+
this.#gt = p;
|
|
3577
|
+
this.#ht = g;
|
|
3578
|
+
this.#ct = m;
|
|
3579
|
+
this.#v = w;
|
|
3580
|
+
this.#at = y;
|
|
3581
|
+
const b = We(t);
|
|
3582
|
+
this.#At = this.#At & Me | b | Fe;
|
|
3583
|
+
if (b !== Se && b !== xe && b !== Ce) {
|
|
3584
|
+
this.#At |= Re;
|
|
3585
|
+
}
|
|
3586
|
+
}
|
|
3587
|
+
#Ht=[];
|
|
3588
|
+
#Zt=false;
|
|
3589
|
+
#Vt(t) {
|
|
3590
|
+
this.#Zt = false;
|
|
3591
|
+
const e = this.#Ht.slice();
|
|
3592
|
+
this.#Ht.length = 0;
|
|
3543
3593
|
e.forEach((e => e(null, t)));
|
|
3544
3594
|
}
|
|
3545
3595
|
readdirCB(t, e = false) {
|
|
@@ -3553,29 +3603,29 @@ class PathBase {
|
|
|
3553
3603
|
if (e) t(null, i); else queueMicrotask((() => t(null, i)));
|
|
3554
3604
|
return;
|
|
3555
3605
|
}
|
|
3556
|
-
this.#
|
|
3557
|
-
if (this
|
|
3606
|
+
this.#Ht.push(t);
|
|
3607
|
+
if (this.#Zt) {
|
|
3558
3608
|
return;
|
|
3559
3609
|
}
|
|
3560
|
-
this
|
|
3610
|
+
this.#Zt = true;
|
|
3561
3611
|
const i = this.fullpath();
|
|
3562
|
-
this.#
|
|
3612
|
+
this.#nt.readdir(i, {
|
|
3563
3613
|
withFileTypes: true
|
|
3564
3614
|
}, ((t, e) => {
|
|
3565
3615
|
if (t) {
|
|
3566
|
-
this.#
|
|
3616
|
+
this.#_t(t.code);
|
|
3567
3617
|
s.provisional = 0;
|
|
3568
3618
|
} else {
|
|
3569
3619
|
for (const t of e) {
|
|
3570
|
-
this.#
|
|
3620
|
+
this.#jt(t, s);
|
|
3571
3621
|
}
|
|
3572
|
-
this.#
|
|
3622
|
+
this.#Ot(s);
|
|
3573
3623
|
}
|
|
3574
|
-
this.#
|
|
3624
|
+
this.#Vt(s.slice(0, s.provisional));
|
|
3575
3625
|
return;
|
|
3576
3626
|
}));
|
|
3577
3627
|
}
|
|
3578
|
-
#
|
|
3628
|
+
#Jt;
|
|
3579
3629
|
async readdir() {
|
|
3580
3630
|
if (!this.canReaddir()) {
|
|
3581
3631
|
return [];
|
|
@@ -3585,23 +3635,23 @@ class PathBase {
|
|
|
3585
3635
|
return t.slice(0, t.provisional);
|
|
3586
3636
|
}
|
|
3587
3637
|
const e = this.fullpath();
|
|
3588
|
-
if (this.#
|
|
3589
|
-
await this.#
|
|
3638
|
+
if (this.#Jt) {
|
|
3639
|
+
await this.#Jt;
|
|
3590
3640
|
} else {
|
|
3591
3641
|
let s = () => {};
|
|
3592
|
-
this.#
|
|
3642
|
+
this.#Jt = new Promise((t => s = t));
|
|
3593
3643
|
try {
|
|
3594
|
-
for (const s of await this.#
|
|
3644
|
+
for (const s of await this.#nt.promises.readdir(e, {
|
|
3595
3645
|
withFileTypes: true
|
|
3596
3646
|
})) {
|
|
3597
|
-
this.#
|
|
3647
|
+
this.#jt(s, t);
|
|
3598
3648
|
}
|
|
3599
|
-
this.#
|
|
3649
|
+
this.#Ot(t);
|
|
3600
3650
|
} catch (e) {
|
|
3601
|
-
this.#
|
|
3651
|
+
this.#_t(e.code);
|
|
3602
3652
|
t.provisional = 0;
|
|
3603
3653
|
}
|
|
3604
|
-
this.#
|
|
3654
|
+
this.#Jt = undefined;
|
|
3605
3655
|
s();
|
|
3606
3656
|
}
|
|
3607
3657
|
return t.slice(0, t.provisional);
|
|
@@ -3616,65 +3666,67 @@ class PathBase {
|
|
|
3616
3666
|
}
|
|
3617
3667
|
const e = this.fullpath();
|
|
3618
3668
|
try {
|
|
3619
|
-
for (const s of this.#
|
|
3669
|
+
for (const s of this.#nt.readdirSync(e, {
|
|
3620
3670
|
withFileTypes: true
|
|
3621
3671
|
})) {
|
|
3622
|
-
this.#
|
|
3672
|
+
this.#jt(s, t);
|
|
3623
3673
|
}
|
|
3624
|
-
this.#
|
|
3674
|
+
this.#Ot(t);
|
|
3625
3675
|
} catch (e) {
|
|
3626
|
-
this.#
|
|
3676
|
+
this.#_t(e.code);
|
|
3627
3677
|
t.provisional = 0;
|
|
3628
3678
|
}
|
|
3629
3679
|
return t.slice(0, t.provisional);
|
|
3630
3680
|
}
|
|
3631
3681
|
canReaddir() {
|
|
3632
|
-
if (this.#
|
|
3633
|
-
const t = Ae & this.#
|
|
3634
|
-
if (!(t ===
|
|
3682
|
+
if (this.#At & Ne) return false;
|
|
3683
|
+
const t = Ae & this.#At;
|
|
3684
|
+
if (!(t === Se || t === xe || t === Ce)) {
|
|
3635
3685
|
return false;
|
|
3636
3686
|
}
|
|
3637
3687
|
return true;
|
|
3638
3688
|
}
|
|
3639
3689
|
shouldWalk(t, e) {
|
|
3640
|
-
return (this.#
|
|
3690
|
+
return (this.#At & xe) === xe && !(this.#At & Ne) && !t.has(this) && (!e || e(this));
|
|
3641
3691
|
}
|
|
3642
3692
|
async realpath() {
|
|
3643
|
-
if (this.#
|
|
3644
|
-
if ((
|
|
3693
|
+
if (this.#Ft) return this.#Ft;
|
|
3694
|
+
if ((De | Oe | ze) & this.#At) return undefined;
|
|
3645
3695
|
try {
|
|
3646
|
-
const t = await this.#
|
|
3647
|
-
return this.#
|
|
3696
|
+
const t = await this.#nt.promises.realpath(this.fullpath());
|
|
3697
|
+
return this.#Ft = this.resolve(t);
|
|
3648
3698
|
} catch (t) {
|
|
3649
|
-
this.#
|
|
3699
|
+
this.#Bt();
|
|
3650
3700
|
}
|
|
3651
3701
|
}
|
|
3652
3702
|
realpathSync() {
|
|
3653
|
-
if (this.#
|
|
3654
|
-
if ((
|
|
3703
|
+
if (this.#Ft) return this.#Ft;
|
|
3704
|
+
if ((De | Oe | ze) & this.#At) return undefined;
|
|
3655
3705
|
try {
|
|
3656
|
-
const t = this.#
|
|
3657
|
-
return this.#
|
|
3706
|
+
const t = this.#nt.realpathSync(this.fullpath());
|
|
3707
|
+
return this.#Ft = this.resolve(t);
|
|
3658
3708
|
} catch (t) {
|
|
3659
|
-
this.#
|
|
3709
|
+
this.#Bt();
|
|
3660
3710
|
}
|
|
3661
3711
|
}
|
|
3662
|
-
[
|
|
3712
|
+
[Ge](t) {
|
|
3663
3713
|
if (t === this) return;
|
|
3714
|
+
t.isCWD = false;
|
|
3715
|
+
this.isCWD = true;
|
|
3664
3716
|
const e = new Set([]);
|
|
3665
3717
|
let s = [];
|
|
3666
3718
|
let i = this;
|
|
3667
3719
|
while (i && i.parent) {
|
|
3668
3720
|
e.add(i);
|
|
3669
|
-
i.#
|
|
3670
|
-
i.#
|
|
3721
|
+
i.#Ct = s.join(this.sep);
|
|
3722
|
+
i.#Lt = s.join("/");
|
|
3671
3723
|
i = i.parent;
|
|
3672
3724
|
s.push("..");
|
|
3673
3725
|
}
|
|
3674
3726
|
i = t;
|
|
3675
3727
|
while (i && i.parent && !e.has(i)) {
|
|
3676
|
-
i.#
|
|
3677
|
-
i.#
|
|
3728
|
+
i.#Ct = undefined;
|
|
3729
|
+
i.#Lt = undefined;
|
|
3678
3730
|
i = i.parent;
|
|
3679
3731
|
}
|
|
3680
3732
|
}
|
|
@@ -3682,18 +3734,18 @@ class PathBase {
|
|
|
3682
3734
|
|
|
3683
3735
|
class PathWin32 extends PathBase {
|
|
3684
3736
|
sep="\\";
|
|
3685
|
-
splitSep=
|
|
3686
|
-
constructor(t, e =
|
|
3737
|
+
splitSep=be;
|
|
3738
|
+
constructor(t, e = Se, s, i, n, r, o) {
|
|
3687
3739
|
super(t, e, s, i, n, r, o);
|
|
3688
3740
|
}
|
|
3689
|
-
newChild(t, e =
|
|
3741
|
+
newChild(t, e = Se, s = {}) {
|
|
3690
3742
|
return new PathWin32(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
|
|
3691
3743
|
}
|
|
3692
3744
|
getRootString(t) {
|
|
3693
|
-
return
|
|
3745
|
+
return s.win32.parse(t).root;
|
|
3694
3746
|
}
|
|
3695
3747
|
getRoot(t) {
|
|
3696
|
-
t =
|
|
3748
|
+
t = ye(t.toUpperCase());
|
|
3697
3749
|
if (t === this.root.name) {
|
|
3698
3750
|
return this.root;
|
|
3699
3751
|
}
|
|
@@ -3705,7 +3757,7 @@ class PathWin32 extends PathBase {
|
|
|
3705
3757
|
return this.roots[t] = new PathScurryWin32(t, this).root;
|
|
3706
3758
|
}
|
|
3707
3759
|
sameRoot(t, e = this.root.name) {
|
|
3708
|
-
t = t.toUpperCase().replace(/\//g, "\\").replace(
|
|
3760
|
+
t = t.toUpperCase().replace(/\//g, "\\").replace(we, "$1\\");
|
|
3709
3761
|
return t === e;
|
|
3710
3762
|
}
|
|
3711
3763
|
}
|
|
@@ -3713,7 +3765,7 @@ class PathWin32 extends PathBase {
|
|
|
3713
3765
|
class PathPosix extends PathBase {
|
|
3714
3766
|
splitSep="/";
|
|
3715
3767
|
sep="/";
|
|
3716
|
-
constructor(t, e =
|
|
3768
|
+
constructor(t, e = Se, s, i, n, r, o) {
|
|
3717
3769
|
super(t, e, s, i, n, r, o);
|
|
3718
3770
|
}
|
|
3719
3771
|
getRootString(t) {
|
|
@@ -3722,7 +3774,7 @@ class PathPosix extends PathBase {
|
|
|
3722
3774
|
getRoot(t) {
|
|
3723
3775
|
return this.root;
|
|
3724
3776
|
}
|
|
3725
|
-
newChild(t, e =
|
|
3777
|
+
newChild(t, e = Se, s = {}) {
|
|
3726
3778
|
return new PathPosix(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
|
|
3727
3779
|
}
|
|
3728
3780
|
}
|
|
@@ -3732,22 +3784,22 @@ class PathScurryBase {
|
|
|
3732
3784
|
rootPath;
|
|
3733
3785
|
roots;
|
|
3734
3786
|
cwd;
|
|
3735
|
-
#
|
|
3736
|
-
#
|
|
3737
|
-
#
|
|
3787
|
+
#Kt;
|
|
3788
|
+
#Yt;
|
|
3789
|
+
#Mt;
|
|
3738
3790
|
nocase;
|
|
3739
|
-
#
|
|
3740
|
-
constructor(t = process.cwd(),
|
|
3741
|
-
this.#
|
|
3791
|
+
#nt;
|
|
3792
|
+
constructor(t = process.cwd(), s, i, {nocase: n, childrenCacheSize: r = 16 * 1024, fs: o = ge} = {}) {
|
|
3793
|
+
this.#nt = me(o);
|
|
3742
3794
|
if (t instanceof URL || t.startsWith("file://")) {
|
|
3743
|
-
t =
|
|
3795
|
+
t = e.fileURLToPath(t);
|
|
3744
3796
|
}
|
|
3745
|
-
const h =
|
|
3797
|
+
const h = s.resolve(t);
|
|
3746
3798
|
this.roots = Object.create(null);
|
|
3747
3799
|
this.rootPath = this.parseRootPath(h);
|
|
3748
|
-
this.#
|
|
3749
|
-
this.#
|
|
3750
|
-
this.#
|
|
3800
|
+
this.#Kt = new ResolveCache;
|
|
3801
|
+
this.#Yt = new ResolveCache;
|
|
3802
|
+
this.#Mt = new ChildrenCache(r);
|
|
3751
3803
|
const a = h.substring(this.rootPath.length).split(i);
|
|
3752
3804
|
if (a.length === 1 && !a[0]) {
|
|
3753
3805
|
a.pop();
|
|
@@ -3756,11 +3808,11 @@ class PathScurryBase {
|
|
|
3756
3808
|
throw new TypeError("must provide nocase setting to PathScurryBase ctor");
|
|
3757
3809
|
}
|
|
3758
3810
|
this.nocase = n;
|
|
3759
|
-
this.root = this.newRoot(this.#
|
|
3811
|
+
this.root = this.newRoot(this.#nt);
|
|
3760
3812
|
this.roots[this.rootPath] = this.root;
|
|
3761
3813
|
let l = this.root;
|
|
3762
3814
|
let c = a.length - 1;
|
|
3763
|
-
const f =
|
|
3815
|
+
const f = s.sep;
|
|
3764
3816
|
let u = this.rootPath;
|
|
3765
3817
|
let d = false;
|
|
3766
3818
|
for (const t of a) {
|
|
@@ -3781,7 +3833,7 @@ class PathScurryBase {
|
|
|
3781
3833
|
return t.depth();
|
|
3782
3834
|
}
|
|
3783
3835
|
childrenCache() {
|
|
3784
|
-
return this.#
|
|
3836
|
+
return this.#Mt;
|
|
3785
3837
|
}
|
|
3786
3838
|
resolve(...t) {
|
|
3787
3839
|
let e = "";
|
|
@@ -3793,12 +3845,12 @@ class PathScurryBase {
|
|
|
3793
3845
|
break;
|
|
3794
3846
|
}
|
|
3795
3847
|
}
|
|
3796
|
-
const s = this.#
|
|
3848
|
+
const s = this.#Kt.get(e);
|
|
3797
3849
|
if (s !== undefined) {
|
|
3798
3850
|
return s;
|
|
3799
3851
|
}
|
|
3800
3852
|
const i = this.cwd.resolve(e).fullpath();
|
|
3801
|
-
this.#
|
|
3853
|
+
this.#Kt.set(e, i);
|
|
3802
3854
|
return i;
|
|
3803
3855
|
}
|
|
3804
3856
|
resolvePosix(...t) {
|
|
@@ -3811,12 +3863,12 @@ class PathScurryBase {
|
|
|
3811
3863
|
break;
|
|
3812
3864
|
}
|
|
3813
3865
|
}
|
|
3814
|
-
const s = this.#
|
|
3866
|
+
const s = this.#Yt.get(e);
|
|
3815
3867
|
if (s !== undefined) {
|
|
3816
3868
|
return s;
|
|
3817
3869
|
}
|
|
3818
3870
|
const i = this.cwd.resolve(e).fullpathPosix();
|
|
3819
|
-
this.#
|
|
3871
|
+
this.#Yt.set(e, i);
|
|
3820
3872
|
return i;
|
|
3821
3873
|
}
|
|
3822
3874
|
relative(t = this.cwd) {
|
|
@@ -4187,16 +4239,16 @@ class PathScurryBase {
|
|
|
4187
4239
|
chdir(t = this.cwd) {
|
|
4188
4240
|
const e = this.cwd;
|
|
4189
4241
|
this.cwd = typeof t === "string" ? this.cwd.resolve(t) : t;
|
|
4190
|
-
this.cwd[
|
|
4242
|
+
this.cwd[Ge](e);
|
|
4191
4243
|
}
|
|
4192
4244
|
}
|
|
4193
4245
|
|
|
4194
4246
|
class PathScurryWin32 extends PathScurryBase {
|
|
4195
4247
|
sep="\\";
|
|
4196
|
-
constructor(t = process.cwd(),
|
|
4197
|
-
const {nocase: i = true} =
|
|
4198
|
-
super(t,
|
|
4199
|
-
...
|
|
4248
|
+
constructor(t = process.cwd(), e = {}) {
|
|
4249
|
+
const {nocase: i = true} = e;
|
|
4250
|
+
super(t, s.win32, "\\", {
|
|
4251
|
+
...e,
|
|
4200
4252
|
nocase: i
|
|
4201
4253
|
});
|
|
4202
4254
|
this.nocase = i;
|
|
@@ -4205,10 +4257,10 @@ class PathScurryWin32 extends PathScurryBase {
|
|
|
4205
4257
|
}
|
|
4206
4258
|
}
|
|
4207
4259
|
parseRootPath(t) {
|
|
4208
|
-
return
|
|
4260
|
+
return s.win32.parse(t).root.toUpperCase();
|
|
4209
4261
|
}
|
|
4210
4262
|
newRoot(t) {
|
|
4211
|
-
return new PathWin32(this.rootPath,
|
|
4263
|
+
return new PathWin32(this.rootPath, xe, undefined, this.roots, this.nocase, this.childrenCache(), {
|
|
4212
4264
|
fs: t
|
|
4213
4265
|
});
|
|
4214
4266
|
}
|
|
@@ -4219,10 +4271,10 @@ class PathScurryWin32 extends PathScurryBase {
|
|
|
4219
4271
|
|
|
4220
4272
|
class PathScurryPosix extends PathScurryBase {
|
|
4221
4273
|
sep="/";
|
|
4222
|
-
constructor(t = process.cwd(),
|
|
4223
|
-
const {nocase: i = false} =
|
|
4224
|
-
super(t,
|
|
4225
|
-
...
|
|
4274
|
+
constructor(t = process.cwd(), e = {}) {
|
|
4275
|
+
const {nocase: i = false} = e;
|
|
4276
|
+
super(t, s.posix, "/", {
|
|
4277
|
+
...e,
|
|
4226
4278
|
nocase: i
|
|
4227
4279
|
});
|
|
4228
4280
|
this.nocase = i;
|
|
@@ -4231,7 +4283,7 @@ class PathScurryPosix extends PathScurryBase {
|
|
|
4231
4283
|
return "/";
|
|
4232
4284
|
}
|
|
4233
4285
|
newRoot(t) {
|
|
4234
|
-
return new PathPosix(this.rootPath,
|
|
4286
|
+
return new PathPosix(this.rootPath, xe, undefined, this.roots, this.nocase, this.childrenCache(), {
|
|
4235
4287
|
fs: t
|
|
4236
4288
|
});
|
|
4237
4289
|
}
|
|
@@ -4250,31 +4302,31 @@ class PathScurryDarwin extends PathScurryPosix {
|
|
|
4250
4302
|
}
|
|
4251
4303
|
}
|
|
4252
4304
|
|
|
4253
|
-
const
|
|
4305
|
+
const $e = process.platform === "win32" ? PathWin32 : PathPosix;
|
|
4254
4306
|
|
|
4255
|
-
const
|
|
4256
|
-
|
|
4257
|
-
const qe = t => t.length >= 1;
|
|
4307
|
+
const qe = process.platform === "win32" ? PathScurryWin32 : process.platform === "darwin" ? PathScurryDarwin : PathScurryPosix;
|
|
4258
4308
|
|
|
4259
4309
|
const He = t => t.length >= 1;
|
|
4260
4310
|
|
|
4311
|
+
const Ze = t => t.length >= 1;
|
|
4312
|
+
|
|
4261
4313
|
class Pattern {
|
|
4262
|
-
#Jt;
|
|
4263
|
-
#Kt;
|
|
4264
|
-
#Yt;
|
|
4265
|
-
length;
|
|
4266
4314
|
#Xt;
|
|
4267
4315
|
#Qt;
|
|
4268
4316
|
#te;
|
|
4317
|
+
length;
|
|
4269
4318
|
#ee;
|
|
4270
4319
|
#se;
|
|
4271
4320
|
#ie;
|
|
4272
|
-
#ne
|
|
4321
|
+
#ne;
|
|
4322
|
+
#re;
|
|
4323
|
+
#oe;
|
|
4324
|
+
#he=true;
|
|
4273
4325
|
constructor(t, e, s, i) {
|
|
4274
|
-
if (!
|
|
4326
|
+
if (!He(t)) {
|
|
4275
4327
|
throw new TypeError("empty pattern list");
|
|
4276
4328
|
}
|
|
4277
|
-
if (!
|
|
4329
|
+
if (!Ze(e)) {
|
|
4278
4330
|
throw new TypeError("empty glob list");
|
|
4279
4331
|
}
|
|
4280
4332
|
if (e.length !== t.length) {
|
|
@@ -4284,104 +4336,107 @@ class Pattern {
|
|
|
4284
4336
|
if (s < 0 || s >= this.length) {
|
|
4285
4337
|
throw new TypeError("index out of range");
|
|
4286
4338
|
}
|
|
4287
|
-
this.#
|
|
4288
|
-
this.#
|
|
4289
|
-
this.#
|
|
4290
|
-
this.#
|
|
4291
|
-
if (this.#
|
|
4339
|
+
this.#Xt = t;
|
|
4340
|
+
this.#Qt = e;
|
|
4341
|
+
this.#te = s;
|
|
4342
|
+
this.#ee = i;
|
|
4343
|
+
if (this.#te === 0) {
|
|
4292
4344
|
if (this.isUNC()) {
|
|
4293
|
-
const [t, e, s, i, ...n] = this.#
|
|
4294
|
-
const [r, o, h, a, ...l] = this.#
|
|
4345
|
+
const [t, e, s, i, ...n] = this.#Xt;
|
|
4346
|
+
const [r, o, h, a, ...l] = this.#Qt;
|
|
4295
4347
|
if (n[0] === "") {
|
|
4296
4348
|
n.shift();
|
|
4297
4349
|
l.shift();
|
|
4298
4350
|
}
|
|
4299
4351
|
const c = [ t, e, s, i, "" ].join("/");
|
|
4300
4352
|
const f = [ r, o, h, a, "" ].join("/");
|
|
4301
|
-
this.#
|
|
4302
|
-
this.#
|
|
4303
|
-
this.length = this.#
|
|
4353
|
+
this.#Xt = [ c, ...n ];
|
|
4354
|
+
this.#Qt = [ f, ...l ];
|
|
4355
|
+
this.length = this.#Xt.length;
|
|
4304
4356
|
} else if (this.isDrive() || this.isAbsolute()) {
|
|
4305
|
-
const [t, ...e] = this.#
|
|
4306
|
-
const [s, ...i] = this.#
|
|
4357
|
+
const [t, ...e] = this.#Xt;
|
|
4358
|
+
const [s, ...i] = this.#Qt;
|
|
4307
4359
|
if (e[0] === "") {
|
|
4308
4360
|
e.shift();
|
|
4309
4361
|
i.shift();
|
|
4310
4362
|
}
|
|
4311
4363
|
const n = t + "/";
|
|
4312
4364
|
const r = s + "/";
|
|
4313
|
-
this.#
|
|
4314
|
-
this.#
|
|
4315
|
-
this.length = this.#
|
|
4365
|
+
this.#Xt = [ n, ...e ];
|
|
4366
|
+
this.#Qt = [ r, ...i ];
|
|
4367
|
+
this.length = this.#Xt.length;
|
|
4316
4368
|
}
|
|
4317
4369
|
}
|
|
4318
4370
|
}
|
|
4319
4371
|
pattern() {
|
|
4320
|
-
return this.#
|
|
4372
|
+
return this.#Xt[this.#te];
|
|
4321
4373
|
}
|
|
4322
4374
|
isString() {
|
|
4323
|
-
return typeof this.#
|
|
4375
|
+
return typeof this.#Xt[this.#te] === "string";
|
|
4324
4376
|
}
|
|
4325
4377
|
isGlobstar() {
|
|
4326
|
-
return this.#
|
|
4378
|
+
return this.#Xt[this.#te] === it;
|
|
4327
4379
|
}
|
|
4328
4380
|
isRegExp() {
|
|
4329
|
-
return this.#
|
|
4381
|
+
return this.#Xt[this.#te] instanceof RegExp;
|
|
4330
4382
|
}
|
|
4331
4383
|
globString() {
|
|
4332
|
-
return this.#
|
|
4384
|
+
return this.#ie = this.#ie || (this.#te === 0 ? this.isAbsolute() ? this.#Qt[0] + this.#Qt.slice(1).join("/") : this.#Qt.join("/") : this.#Qt.slice(this.#te).join("/"));
|
|
4333
4385
|
}
|
|
4334
4386
|
hasMore() {
|
|
4335
|
-
return this.length > this.#
|
|
4387
|
+
return this.length > this.#te + 1;
|
|
4336
4388
|
}
|
|
4337
4389
|
rest() {
|
|
4338
|
-
if (this.#
|
|
4339
|
-
if (!this.hasMore()) return this.#
|
|
4340
|
-
this.#
|
|
4341
|
-
this.#
|
|
4342
|
-
this.#
|
|
4343
|
-
this.#
|
|
4344
|
-
return this.#
|
|
4390
|
+
if (this.#se !== undefined) return this.#se;
|
|
4391
|
+
if (!this.hasMore()) return this.#se = null;
|
|
4392
|
+
this.#se = new Pattern(this.#Xt, this.#Qt, this.#te + 1, this.#ee);
|
|
4393
|
+
this.#se.#oe = this.#oe;
|
|
4394
|
+
this.#se.#re = this.#re;
|
|
4395
|
+
this.#se.#ne = this.#ne;
|
|
4396
|
+
return this.#se;
|
|
4345
4397
|
}
|
|
4346
4398
|
isUNC() {
|
|
4347
|
-
const t = this.#
|
|
4348
|
-
return this.#
|
|
4399
|
+
const t = this.#Xt;
|
|
4400
|
+
return this.#re !== undefined ? this.#re : this.#re = this.#ee === "win32" && this.#te === 0 && t[0] === "" && t[1] === "" && typeof t[2] === "string" && !!t[2] && typeof t[3] === "string" && !!t[3];
|
|
4349
4401
|
}
|
|
4350
4402
|
isDrive() {
|
|
4351
|
-
const t = this.#
|
|
4352
|
-
return this.#
|
|
4403
|
+
const t = this.#Xt;
|
|
4404
|
+
return this.#ne !== undefined ? this.#ne : this.#ne = this.#ee === "win32" && this.#te === 0 && this.length > 1 && typeof t[0] === "string" && /^[a-z]:$/i.test(t[0]);
|
|
4353
4405
|
}
|
|
4354
4406
|
isAbsolute() {
|
|
4355
|
-
const t = this.#
|
|
4356
|
-
return this.#
|
|
4407
|
+
const t = this.#Xt;
|
|
4408
|
+
return this.#oe !== undefined ? this.#oe : this.#oe = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
|
|
4357
4409
|
}
|
|
4358
4410
|
root() {
|
|
4359
|
-
const t = this.#
|
|
4360
|
-
return typeof t === "string" && this.isAbsolute() && this.#
|
|
4411
|
+
const t = this.#Xt[0];
|
|
4412
|
+
return typeof t === "string" && this.isAbsolute() && this.#te === 0 ? t : "";
|
|
4361
4413
|
}
|
|
4362
4414
|
checkFollowGlobstar() {
|
|
4363
|
-
return !(this.#
|
|
4415
|
+
return !(this.#te === 0 || !this.isGlobstar() || !this.#he);
|
|
4364
4416
|
}
|
|
4365
4417
|
markFollowGlobstar() {
|
|
4366
|
-
if (this.#
|
|
4367
|
-
this.#
|
|
4418
|
+
if (this.#te === 0 || !this.isGlobstar() || !this.#he) return false;
|
|
4419
|
+
this.#he = false;
|
|
4368
4420
|
return true;
|
|
4369
4421
|
}
|
|
4370
4422
|
}
|
|
4371
4423
|
|
|
4372
|
-
const
|
|
4424
|
+
const Ve = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
|
|
4373
4425
|
|
|
4374
4426
|
class Ignore {
|
|
4375
4427
|
relative;
|
|
4376
4428
|
relativeChildren;
|
|
4377
4429
|
absolute;
|
|
4378
4430
|
absoluteChildren;
|
|
4379
|
-
|
|
4431
|
+
platform;
|
|
4432
|
+
mmopts;
|
|
4433
|
+
constructor(t, {nobrace: e, nocase: s, noext: i, noglobstar: n, platform: r = Ve}) {
|
|
4380
4434
|
this.relative = [];
|
|
4381
4435
|
this.absolute = [];
|
|
4382
4436
|
this.relativeChildren = [];
|
|
4383
4437
|
this.absoluteChildren = [];
|
|
4384
|
-
|
|
4438
|
+
this.platform = r;
|
|
4439
|
+
this.mmopts = {
|
|
4385
4440
|
dot: true,
|
|
4386
4441
|
nobrace: e,
|
|
4387
4442
|
nocase: s,
|
|
@@ -4392,26 +4447,27 @@ class Ignore {
|
|
|
4392
4447
|
nocomment: true,
|
|
4393
4448
|
nonegate: true
|
|
4394
4449
|
};
|
|
4395
|
-
for (const e of t)
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4450
|
+
for (const e of t) this.add(e);
|
|
4451
|
+
}
|
|
4452
|
+
add(t) {
|
|
4453
|
+
const e = new Minimatch(t, this.mmopts);
|
|
4454
|
+
for (let t = 0; t < e.set.length; t++) {
|
|
4455
|
+
const s = e.set[t];
|
|
4456
|
+
const i = e.globParts[t];
|
|
4457
|
+
if (!s || !i) {
|
|
4458
|
+
throw new Error("invalid pattern object");
|
|
4459
|
+
}
|
|
4460
|
+
while (s[0] === "." && i[0] === ".") {
|
|
4461
|
+
s.shift();
|
|
4462
|
+
i.shift();
|
|
4463
|
+
}
|
|
4464
|
+
const n = new Pattern(s, i, 0, this.platform);
|
|
4465
|
+
const r = new Minimatch(n.globString(), this.mmopts);
|
|
4466
|
+
const o = i[i.length - 1] === "**";
|
|
4467
|
+
const h = n.isAbsolute();
|
|
4468
|
+
if (h) this.absolute.push(r); else this.relative.push(r);
|
|
4469
|
+
if (o) {
|
|
4470
|
+
if (h) this.absoluteChildren.push(r); else this.relativeChildren.push(r);
|
|
4415
4471
|
}
|
|
4416
4472
|
}
|
|
4417
4473
|
}
|
|
@@ -4550,7 +4606,7 @@ class Processor {
|
|
|
4550
4606
|
const e = n === ".." || n === "" || n === ".";
|
|
4551
4607
|
this.matches.add(t.resolve(n), i, e);
|
|
4552
4608
|
continue;
|
|
4553
|
-
} else if (n ===
|
|
4609
|
+
} else if (n === it) {
|
|
4554
4610
|
if (!t.isSymbolicLink() || this.follow || e.checkFollowGlobstar()) {
|
|
4555
4611
|
this.subwalks.add(t, e);
|
|
4556
4612
|
}
|
|
@@ -4586,7 +4642,7 @@ class Processor {
|
|
|
4586
4642
|
const s = e.isAbsolute();
|
|
4587
4643
|
const n = e.pattern();
|
|
4588
4644
|
const r = e.rest();
|
|
4589
|
-
if (n ===
|
|
4645
|
+
if (n === it) {
|
|
4590
4646
|
i.testGlobstar(t, e, r, s);
|
|
4591
4647
|
} else if (n instanceof RegExp) {
|
|
4592
4648
|
i.testRegExp(t, n, r, s);
|
|
@@ -4644,7 +4700,7 @@ class Processor {
|
|
|
4644
4700
|
}
|
|
4645
4701
|
}
|
|
4646
4702
|
|
|
4647
|
-
const
|
|
4703
|
+
const Je = (t, e) => typeof t === "string" ? new Ignore([ t ], e) : Array.isArray(t) ? new Ignore(t, e) : t;
|
|
4648
4704
|
|
|
4649
4705
|
class GlobUtil {
|
|
4650
4706
|
path;
|
|
@@ -4653,32 +4709,38 @@ class GlobUtil {
|
|
|
4653
4709
|
seen=new Set;
|
|
4654
4710
|
paused=false;
|
|
4655
4711
|
aborted=false;
|
|
4656
|
-
#
|
|
4657
|
-
#
|
|
4658
|
-
#
|
|
4712
|
+
#ae=[];
|
|
4713
|
+
#le;
|
|
4714
|
+
#ce;
|
|
4659
4715
|
signal;
|
|
4660
4716
|
maxDepth;
|
|
4717
|
+
includeChildMatches;
|
|
4661
4718
|
constructor(t, e, s) {
|
|
4662
4719
|
this.patterns = t;
|
|
4663
4720
|
this.path = e;
|
|
4664
4721
|
this.opts = s;
|
|
4665
|
-
this.#
|
|
4666
|
-
|
|
4667
|
-
|
|
4722
|
+
this.#ce = !s.posix && s.platform === "win32" ? "\\" : "/";
|
|
4723
|
+
this.includeChildMatches = s.includeChildMatches !== false;
|
|
4724
|
+
if (s.ignore || !this.includeChildMatches) {
|
|
4725
|
+
this.#le = Je(s.ignore ?? [], s);
|
|
4726
|
+
if (!this.includeChildMatches && typeof this.#le.add !== "function") {
|
|
4727
|
+
const t = "cannot ignore child matches, ignore lacks add() method.";
|
|
4728
|
+
throw new Error(t);
|
|
4729
|
+
}
|
|
4668
4730
|
}
|
|
4669
4731
|
this.maxDepth = s.maxDepth || Infinity;
|
|
4670
4732
|
if (s.signal) {
|
|
4671
4733
|
this.signal = s.signal;
|
|
4672
4734
|
this.signal.addEventListener("abort", (() => {
|
|
4673
|
-
this.#
|
|
4735
|
+
this.#ae.length = 0;
|
|
4674
4736
|
}));
|
|
4675
4737
|
}
|
|
4676
4738
|
}
|
|
4677
|
-
#
|
|
4678
|
-
return this.seen.has(t) || !!this.#
|
|
4739
|
+
#fe(t) {
|
|
4740
|
+
return this.seen.has(t) || !!this.#le?.ignored?.(t);
|
|
4679
4741
|
}
|
|
4680
|
-
#
|
|
4681
|
-
return !!this.#
|
|
4742
|
+
#ue(t) {
|
|
4743
|
+
return !!this.#le?.childrenIgnored?.(t);
|
|
4682
4744
|
}
|
|
4683
4745
|
pause() {
|
|
4684
4746
|
this.paused = true;
|
|
@@ -4687,7 +4749,7 @@ class GlobUtil {
|
|
|
4687
4749
|
if (this.signal?.aborted) return;
|
|
4688
4750
|
this.paused = false;
|
|
4689
4751
|
let t = undefined;
|
|
4690
|
-
while (!this.paused && (t = this.#
|
|
4752
|
+
while (!this.paused && (t = this.#ae.shift())) {
|
|
4691
4753
|
t();
|
|
4692
4754
|
}
|
|
4693
4755
|
}
|
|
@@ -4696,7 +4758,7 @@ class GlobUtil {
|
|
|
4696
4758
|
if (!this.paused) {
|
|
4697
4759
|
t();
|
|
4698
4760
|
} else {
|
|
4699
|
-
this.#
|
|
4761
|
+
this.#ae.push(t);
|
|
4700
4762
|
}
|
|
4701
4763
|
}
|
|
4702
4764
|
async matchCheck(t, e) {
|
|
@@ -4718,7 +4780,7 @@ class GlobUtil {
|
|
|
4718
4780
|
return this.matchCheckTest(n, e);
|
|
4719
4781
|
}
|
|
4720
4782
|
matchCheckTest(t, e) {
|
|
4721
|
-
return t && (this.maxDepth === Infinity || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#
|
|
4783
|
+
return t && (this.maxDepth === Infinity || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#fe(t) ? t : undefined;
|
|
4722
4784
|
}
|
|
4723
4785
|
matchCheckSync(t, e) {
|
|
4724
4786
|
if (e && this.opts.nodir) return undefined;
|
|
@@ -4739,10 +4801,14 @@ class GlobUtil {
|
|
|
4739
4801
|
return this.matchCheckTest(n, e);
|
|
4740
4802
|
}
|
|
4741
4803
|
matchFinish(t, e) {
|
|
4742
|
-
if (this.#
|
|
4804
|
+
if (this.#fe(t)) return;
|
|
4805
|
+
if (!this.includeChildMatches && this.#le?.add) {
|
|
4806
|
+
const e = `${t.relativePosix()}/**`;
|
|
4807
|
+
this.#le.add(e);
|
|
4808
|
+
}
|
|
4743
4809
|
const s = this.opts.absolute === undefined ? e : this.opts.absolute;
|
|
4744
4810
|
this.seen.add(t);
|
|
4745
|
-
const i = this.opts.mark && t.isDirectory() ? this.#
|
|
4811
|
+
const i = this.opts.mark && t.isDirectory() ? this.#ce : "";
|
|
4746
4812
|
if (this.opts.withFileTypes) {
|
|
4747
4813
|
this.matchEmit(t);
|
|
4748
4814
|
} else if (s) {
|
|
@@ -4750,7 +4816,7 @@ class GlobUtil {
|
|
|
4750
4816
|
this.matchEmit(e + i);
|
|
4751
4817
|
} else {
|
|
4752
4818
|
const e = this.opts.posix ? t.relativePosix() : t.relative();
|
|
4753
|
-
const s = this.opts.dotRelative && !e.startsWith(".." + this.#
|
|
4819
|
+
const s = this.opts.dotRelative && !e.startsWith(".." + this.#ce) ? "." + this.#ce : "";
|
|
4754
4820
|
this.matchEmit(!e ? "." + i : s + e + i);
|
|
4755
4821
|
}
|
|
4756
4822
|
}
|
|
@@ -4767,7 +4833,7 @@ class GlobUtil {
|
|
|
4767
4833
|
this.walkCB2(t, e, new Processor(this.opts), s);
|
|
4768
4834
|
}
|
|
4769
4835
|
walkCB2(t, e, s, i) {
|
|
4770
|
-
if (this.#
|
|
4836
|
+
if (this.#ue(t)) return i();
|
|
4771
4837
|
if (this.signal?.aborted) i();
|
|
4772
4838
|
if (this.paused) {
|
|
4773
4839
|
this.onResume((() => this.walkCB2(t, e, s, i)));
|
|
@@ -4779,7 +4845,7 @@ class GlobUtil {
|
|
|
4779
4845
|
if (--n === 0) i();
|
|
4780
4846
|
};
|
|
4781
4847
|
for (const [t, e, i] of s.matches.entries()) {
|
|
4782
|
-
if (this.#
|
|
4848
|
+
if (this.#fe(t)) continue;
|
|
4783
4849
|
n++;
|
|
4784
4850
|
this.match(t, e, i).then((() => r()));
|
|
4785
4851
|
}
|
|
@@ -4802,7 +4868,7 @@ class GlobUtil {
|
|
|
4802
4868
|
if (--n === 0) i();
|
|
4803
4869
|
};
|
|
4804
4870
|
for (const [t, e, i] of s.matches.entries()) {
|
|
4805
|
-
if (this.#
|
|
4871
|
+
if (this.#fe(t)) continue;
|
|
4806
4872
|
n++;
|
|
4807
4873
|
this.match(t, e, i).then((() => r()));
|
|
4808
4874
|
}
|
|
@@ -4817,7 +4883,7 @@ class GlobUtil {
|
|
|
4817
4883
|
this.walkCB2Sync(t, e, new Processor(this.opts), s);
|
|
4818
4884
|
}
|
|
4819
4885
|
walkCB2Sync(t, e, s, i) {
|
|
4820
|
-
if (this.#
|
|
4886
|
+
if (this.#ue(t)) return i();
|
|
4821
4887
|
if (this.signal?.aborted) i();
|
|
4822
4888
|
if (this.paused) {
|
|
4823
4889
|
this.onResume((() => this.walkCB2Sync(t, e, s, i)));
|
|
@@ -4829,7 +4895,7 @@ class GlobUtil {
|
|
|
4829
4895
|
if (--n === 0) i();
|
|
4830
4896
|
};
|
|
4831
4897
|
for (const [t, e, i] of s.matches.entries()) {
|
|
4832
|
-
if (this.#
|
|
4898
|
+
if (this.#fe(t)) continue;
|
|
4833
4899
|
this.matchSync(t, e, i);
|
|
4834
4900
|
}
|
|
4835
4901
|
for (const t of s.subwalkTargets()) {
|
|
@@ -4849,7 +4915,7 @@ class GlobUtil {
|
|
|
4849
4915
|
if (--n === 0) i();
|
|
4850
4916
|
};
|
|
4851
4917
|
for (const [t, e, i] of s.matches.entries()) {
|
|
4852
|
-
if (this.#
|
|
4918
|
+
if (this.#fe(t)) continue;
|
|
4853
4919
|
this.matchSync(t, e, i);
|
|
4854
4920
|
}
|
|
4855
4921
|
for (const [t, e] of s.subwalks.entries()) {
|
|
@@ -4861,10 +4927,9 @@ class GlobUtil {
|
|
|
4861
4927
|
}
|
|
4862
4928
|
|
|
4863
4929
|
class GlobWalker extends GlobUtil {
|
|
4864
|
-
matches;
|
|
4930
|
+
matches=new Set;
|
|
4865
4931
|
constructor(t, e, s) {
|
|
4866
4932
|
super(t, e, s);
|
|
4867
|
-
this.matches = new Set;
|
|
4868
4933
|
}
|
|
4869
4934
|
matchEmit(t) {
|
|
4870
4935
|
this.matches.add(t);
|
|
@@ -4932,9 +4997,9 @@ class GlobStream extends GlobUtil {
|
|
|
4932
4997
|
}
|
|
4933
4998
|
}
|
|
4934
4999
|
|
|
4935
|
-
const
|
|
5000
|
+
const Ke = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux";
|
|
4936
5001
|
|
|
4937
|
-
let
|
|
5002
|
+
let Ye = class Glob {
|
|
4938
5003
|
absolute;
|
|
4939
5004
|
cwd;
|
|
4940
5005
|
root;
|
|
@@ -4959,72 +5024,74 @@ let Ke = class Glob {
|
|
|
4959
5024
|
signal;
|
|
4960
5025
|
windowsPathsNoEscape;
|
|
4961
5026
|
withFileTypes;
|
|
5027
|
+
includeChildMatches;
|
|
4962
5028
|
opts;
|
|
4963
5029
|
patterns;
|
|
4964
|
-
constructor(t,
|
|
4965
|
-
if (!
|
|
4966
|
-
this.withFileTypes = !!
|
|
4967
|
-
this.signal =
|
|
4968
|
-
this.follow = !!
|
|
4969
|
-
this.dot = !!
|
|
4970
|
-
this.dotRelative = !!
|
|
4971
|
-
this.nodir = !!
|
|
4972
|
-
this.mark = !!
|
|
4973
|
-
if (!
|
|
5030
|
+
constructor(t, s) {
|
|
5031
|
+
if (!s) throw new TypeError("glob options required");
|
|
5032
|
+
this.withFileTypes = !!s.withFileTypes;
|
|
5033
|
+
this.signal = s.signal;
|
|
5034
|
+
this.follow = !!s.follow;
|
|
5035
|
+
this.dot = !!s.dot;
|
|
5036
|
+
this.dotRelative = !!s.dotRelative;
|
|
5037
|
+
this.nodir = !!s.nodir;
|
|
5038
|
+
this.mark = !!s.mark;
|
|
5039
|
+
if (!s.cwd) {
|
|
4974
5040
|
this.cwd = "";
|
|
4975
|
-
} else if (
|
|
4976
|
-
|
|
4977
|
-
}
|
|
4978
|
-
this.cwd =
|
|
4979
|
-
this.root =
|
|
4980
|
-
this.magicalBraces = !!
|
|
4981
|
-
this.nobrace = !!
|
|
4982
|
-
this.noext = !!
|
|
4983
|
-
this.realpath = !!
|
|
4984
|
-
this.absolute =
|
|
4985
|
-
this.
|
|
4986
|
-
this.
|
|
4987
|
-
this.
|
|
4988
|
-
this.
|
|
4989
|
-
this.
|
|
5041
|
+
} else if (s.cwd instanceof URL || s.cwd.startsWith("file://")) {
|
|
5042
|
+
s.cwd = e.fileURLToPath(s.cwd);
|
|
5043
|
+
}
|
|
5044
|
+
this.cwd = s.cwd || "";
|
|
5045
|
+
this.root = s.root;
|
|
5046
|
+
this.magicalBraces = !!s.magicalBraces;
|
|
5047
|
+
this.nobrace = !!s.nobrace;
|
|
5048
|
+
this.noext = !!s.noext;
|
|
5049
|
+
this.realpath = !!s.realpath;
|
|
5050
|
+
this.absolute = s.absolute;
|
|
5051
|
+
this.includeChildMatches = s.includeChildMatches !== false;
|
|
5052
|
+
this.noglobstar = !!s.noglobstar;
|
|
5053
|
+
this.matchBase = !!s.matchBase;
|
|
5054
|
+
this.maxDepth = typeof s.maxDepth === "number" ? s.maxDepth : Infinity;
|
|
5055
|
+
this.stat = !!s.stat;
|
|
5056
|
+
this.ignore = s.ignore;
|
|
4990
5057
|
if (this.withFileTypes && this.absolute !== undefined) {
|
|
4991
5058
|
throw new Error("cannot set absolute and withFileTypes:true");
|
|
4992
5059
|
}
|
|
4993
5060
|
if (typeof t === "string") {
|
|
4994
5061
|
t = [ t ];
|
|
4995
5062
|
}
|
|
4996
|
-
this.windowsPathsNoEscape = !!
|
|
5063
|
+
this.windowsPathsNoEscape = !!s.windowsPathsNoEscape || s.allowWindowsEscape === false;
|
|
4997
5064
|
if (this.windowsPathsNoEscape) {
|
|
4998
5065
|
t = t.map((t => t.replace(/\\/g, "/")));
|
|
4999
5066
|
}
|
|
5000
5067
|
if (this.matchBase) {
|
|
5001
|
-
if (
|
|
5068
|
+
if (s.noglobstar) {
|
|
5002
5069
|
throw new TypeError("base matching requires globstar");
|
|
5003
5070
|
}
|
|
5004
5071
|
t = t.map((t => t.includes("/") ? t : `./**/${t}`));
|
|
5005
5072
|
}
|
|
5006
5073
|
this.pattern = t;
|
|
5007
|
-
this.platform =
|
|
5074
|
+
this.platform = s.platform || Ke;
|
|
5008
5075
|
this.opts = {
|
|
5009
|
-
...
|
|
5076
|
+
...s,
|
|
5010
5077
|
platform: this.platform
|
|
5011
5078
|
};
|
|
5012
|
-
if (
|
|
5013
|
-
this.scurry =
|
|
5014
|
-
if (
|
|
5079
|
+
if (s.scurry) {
|
|
5080
|
+
this.scurry = s.scurry;
|
|
5081
|
+
if (s.nocase !== undefined && s.nocase !== s.scurry.nocase) {
|
|
5015
5082
|
throw new Error("nocase option contradicts provided scurry option");
|
|
5016
5083
|
}
|
|
5017
5084
|
} else {
|
|
5018
|
-
const t =
|
|
5085
|
+
const t = s.platform === "win32" ? PathScurryWin32 : s.platform === "darwin" ? PathScurryDarwin : s.platform ? PathScurryPosix : qe;
|
|
5019
5086
|
this.scurry = new t(this.cwd, {
|
|
5020
|
-
nocase:
|
|
5021
|
-
fs:
|
|
5087
|
+
nocase: s.nocase,
|
|
5088
|
+
fs: s.fs
|
|
5022
5089
|
});
|
|
5023
5090
|
}
|
|
5024
5091
|
this.nocase = this.scurry.nocase;
|
|
5025
5092
|
const i = this.platform === "darwin" || this.platform === "win32";
|
|
5026
5093
|
const n = {
|
|
5027
|
-
...
|
|
5094
|
+
...s,
|
|
5028
5095
|
dot: this.dot,
|
|
5029
5096
|
matchBase: this.matchBase,
|
|
5030
5097
|
nobrace: this.nobrace,
|
|
@@ -5055,7 +5122,8 @@ let Ke = class Glob {
|
|
|
5055
5122
|
...this.opts,
|
|
5056
5123
|
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
5057
5124
|
platform: this.platform,
|
|
5058
|
-
nocase: this.nocase
|
|
5125
|
+
nocase: this.nocase,
|
|
5126
|
+
includeChildMatches: this.includeChildMatches
|
|
5059
5127
|
}).walk() ];
|
|
5060
5128
|
}
|
|
5061
5129
|
walkSync() {
|
|
@@ -5063,7 +5131,8 @@ let Ke = class Glob {
|
|
|
5063
5131
|
...this.opts,
|
|
5064
5132
|
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
5065
5133
|
platform: this.platform,
|
|
5066
|
-
nocase: this.nocase
|
|
5134
|
+
nocase: this.nocase,
|
|
5135
|
+
includeChildMatches: this.includeChildMatches
|
|
5067
5136
|
}).walkSync() ];
|
|
5068
5137
|
}
|
|
5069
5138
|
stream() {
|
|
@@ -5071,7 +5140,8 @@ let Ke = class Glob {
|
|
|
5071
5140
|
...this.opts,
|
|
5072
5141
|
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
5073
5142
|
platform: this.platform,
|
|
5074
|
-
nocase: this.nocase
|
|
5143
|
+
nocase: this.nocase,
|
|
5144
|
+
includeChildMatches: this.includeChildMatches
|
|
5075
5145
|
}).stream();
|
|
5076
5146
|
}
|
|
5077
5147
|
streamSync() {
|
|
@@ -5079,7 +5149,8 @@ let Ke = class Glob {
|
|
|
5079
5149
|
...this.opts,
|
|
5080
5150
|
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
5081
5151
|
platform: this.platform,
|
|
5082
|
-
nocase: this.nocase
|
|
5152
|
+
nocase: this.nocase,
|
|
5153
|
+
includeChildMatches: this.includeChildMatches
|
|
5083
5154
|
}).streamSync();
|
|
5084
5155
|
}
|
|
5085
5156
|
iterateSync() {
|
|
@@ -5096,7 +5167,7 @@ let Ke = class Glob {
|
|
|
5096
5167
|
}
|
|
5097
5168
|
};
|
|
5098
5169
|
|
|
5099
|
-
const
|
|
5170
|
+
const Xe = (t, e = {}) => {
|
|
5100
5171
|
if (!Array.isArray(t)) {
|
|
5101
5172
|
t = [ t ];
|
|
5102
5173
|
}
|
|
@@ -5106,69 +5177,69 @@ const Ye = (t, e = {}) => {
|
|
|
5106
5177
|
return false;
|
|
5107
5178
|
};
|
|
5108
5179
|
|
|
5109
|
-
function Xe(t, e = {}) {
|
|
5110
|
-
return new Ke(t, e).streamSync();
|
|
5111
|
-
}
|
|
5112
|
-
|
|
5113
5180
|
function Qe(t, e = {}) {
|
|
5114
|
-
return new
|
|
5181
|
+
return new Ye(t, e).streamSync();
|
|
5115
5182
|
}
|
|
5116
5183
|
|
|
5117
5184
|
function ts(t, e = {}) {
|
|
5118
|
-
return new
|
|
5185
|
+
return new Ye(t, e).stream();
|
|
5119
5186
|
}
|
|
5120
5187
|
|
|
5121
|
-
|
|
5122
|
-
return new
|
|
5188
|
+
function es(t, e = {}) {
|
|
5189
|
+
return new Ye(t, e).walkSync();
|
|
5123
5190
|
}
|
|
5124
5191
|
|
|
5125
|
-
function ss(t, e = {}) {
|
|
5126
|
-
return new
|
|
5192
|
+
async function ss(t, e = {}) {
|
|
5193
|
+
return new Ye(t, e).walk();
|
|
5127
5194
|
}
|
|
5128
5195
|
|
|
5129
5196
|
function is(t, e = {}) {
|
|
5130
|
-
return new
|
|
5197
|
+
return new Ye(t, e).iterateSync();
|
|
5198
|
+
}
|
|
5199
|
+
|
|
5200
|
+
function ns(t, e = {}) {
|
|
5201
|
+
return new Ye(t, e).iterate();
|
|
5131
5202
|
}
|
|
5132
5203
|
|
|
5133
|
-
const
|
|
5204
|
+
const rs = Qe;
|
|
5134
5205
|
|
|
5135
|
-
const
|
|
5136
|
-
sync:
|
|
5206
|
+
const os = Object.assign(ts, {
|
|
5207
|
+
sync: Qe
|
|
5137
5208
|
});
|
|
5138
5209
|
|
|
5139
|
-
const
|
|
5210
|
+
const hs = is;
|
|
5140
5211
|
|
|
5141
|
-
const
|
|
5142
|
-
sync:
|
|
5212
|
+
const as = Object.assign(ns, {
|
|
5213
|
+
sync: is
|
|
5143
5214
|
});
|
|
5144
5215
|
|
|
5145
|
-
const
|
|
5146
|
-
stream:
|
|
5147
|
-
iterate:
|
|
5216
|
+
const ls = Object.assign(es, {
|
|
5217
|
+
stream: Qe,
|
|
5218
|
+
iterate: is
|
|
5148
5219
|
});
|
|
5149
5220
|
|
|
5150
|
-
const
|
|
5151
|
-
glob:
|
|
5152
|
-
globSync:
|
|
5153
|
-
sync:
|
|
5154
|
-
globStream:
|
|
5155
|
-
stream:
|
|
5156
|
-
globStreamSync:
|
|
5157
|
-
streamSync:
|
|
5158
|
-
globIterate:
|
|
5159
|
-
iterate:
|
|
5160
|
-
globIterateSync:
|
|
5161
|
-
iterateSync:
|
|
5162
|
-
Glob:
|
|
5163
|
-
hasMagic:
|
|
5164
|
-
escape:
|
|
5165
|
-
unescape:
|
|
5221
|
+
const cs = Object.assign(ss, {
|
|
5222
|
+
glob: ss,
|
|
5223
|
+
globSync: es,
|
|
5224
|
+
sync: ls,
|
|
5225
|
+
globStream: ts,
|
|
5226
|
+
stream: os,
|
|
5227
|
+
globStreamSync: Qe,
|
|
5228
|
+
streamSync: rs,
|
|
5229
|
+
globIterate: ns,
|
|
5230
|
+
iterate: as,
|
|
5231
|
+
globIterateSync: is,
|
|
5232
|
+
iterateSync: hs,
|
|
5233
|
+
Glob: Ye,
|
|
5234
|
+
hasMagic: Xe,
|
|
5235
|
+
escape: R,
|
|
5236
|
+
unescape: S
|
|
5166
5237
|
});
|
|
5167
5238
|
|
|
5168
|
-
|
|
5239
|
+
cs.glob = cs;
|
|
5169
5240
|
|
|
5170
|
-
async function
|
|
5171
|
-
return e ? await
|
|
5241
|
+
async function fs(t, e) {
|
|
5242
|
+
return e ? await cs(t, e) : await cs(t);
|
|
5172
5243
|
}
|
|
5173
5244
|
|
|
5174
|
-
exports.Glob =
|
|
5245
|
+
exports.Glob = fs;
|