lakutata 2.0.11 → 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 +39 -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 +10 -3
- package/src/components/docker/Docker.mjs +10 -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/components/docker/options/container/ContainerSettingOptions.cjs +4 -0
- package/src/components/docker/options/container/ContainerSettingOptions.mjs +4 -0
- 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 +29 -19
- 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 +22 -12
- 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 +8748 -8652
- 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.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { e as t } from "../../../vendor/Package.73.mjs";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { fileURLToPath as e } from "node:url";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { win32 as s, posix as i } from "node:path";
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import { realpathSync as n, lstatSync as r, readdir as o, readdirSync as h, readlinkSync as a } from "fs";
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import * as l from "node:fs";
|
|
10
10
|
|
|
11
|
-
import { lstat as c, readdir as f, readlink as u, realpath as d } from "fs/promises";
|
|
11
|
+
import { lstat as c, readdir as f, readlink as u, realpath as d } from "node:fs/promises";
|
|
12
12
|
|
|
13
|
-
import { EventEmitter as p } from "events";
|
|
13
|
+
import { EventEmitter as p } from "node:events";
|
|
14
14
|
|
|
15
|
-
import g from "stream";
|
|
15
|
+
import g from "node:stream";
|
|
16
16
|
|
|
17
|
-
import { StringDecoder as m } from "string_decoder";
|
|
17
|
+
import { StringDecoder as m } from "node:string_decoder";
|
|
18
18
|
|
|
19
19
|
import "../../../vendor/Package.5.mjs";
|
|
20
20
|
|
|
@@ -140,19 +140,19 @@ const x = (t, e) => {
|
|
|
140
140
|
|
|
141
141
|
const E = (t, {windowsPathsNoEscape: e = false} = {}) => e ? t.replace(/\[([^\/\\])\]/g, "$1") : t.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
142
142
|
|
|
143
|
-
const
|
|
143
|
+
const C = new Set([ "!", "?", "+", "*", "@" ]);
|
|
144
144
|
|
|
145
|
-
const
|
|
145
|
+
const T = t => C.has(t);
|
|
146
146
|
|
|
147
|
-
const
|
|
147
|
+
const L = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
148
148
|
|
|
149
|
-
const
|
|
149
|
+
const A = "(?!\\.)";
|
|
150
150
|
|
|
151
|
-
const
|
|
151
|
+
const M = new Set([ "[", "." ]);
|
|
152
152
|
|
|
153
153
|
const P = new Set([ "..", "." ]);
|
|
154
154
|
|
|
155
|
-
const
|
|
155
|
+
const F = new Set("().*{}+?[]^$\\!");
|
|
156
156
|
|
|
157
157
|
const R = t => t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
158
158
|
|
|
@@ -306,7 +306,7 @@ class AST {
|
|
|
306
306
|
l += s;
|
|
307
307
|
continue;
|
|
308
308
|
}
|
|
309
|
-
if (!i.noext &&
|
|
309
|
+
if (!i.noext && T(s) && t.charAt(a) === "(") {
|
|
310
310
|
e.push(l);
|
|
311
311
|
l = "";
|
|
312
312
|
const n = new AST(s, e);
|
|
@@ -347,7 +347,7 @@ class AST {
|
|
|
347
347
|
f += s;
|
|
348
348
|
continue;
|
|
349
349
|
}
|
|
350
|
-
if (
|
|
350
|
+
if (T(s) && t.charAt(a) === "(") {
|
|
351
351
|
l.push(f);
|
|
352
352
|
f = "";
|
|
353
353
|
const e = new AST(s, l);
|
|
@@ -397,6 +397,9 @@ class AST {
|
|
|
397
397
|
_glob: t
|
|
398
398
|
});
|
|
399
399
|
}
|
|
400
|
+
get options() {
|
|
401
|
+
return this.#a;
|
|
402
|
+
}
|
|
400
403
|
toRegExpSource(t) {
|
|
401
404
|
const e = t ?? !!this.#a.dot;
|
|
402
405
|
if (this.#t === this) this.#f();
|
|
@@ -413,10 +416,10 @@ class AST {
|
|
|
413
416
|
if (typeof this.#i[0] === "string") {
|
|
414
417
|
const s = this.#i.length === 1 && P.has(this.#i[0]);
|
|
415
418
|
if (!s) {
|
|
416
|
-
const s =
|
|
419
|
+
const s = M;
|
|
417
420
|
const r = e && s.has(i.charAt(0)) || i.startsWith("\\.") && s.has(i.charAt(2)) || i.startsWith("\\.\\.") && s.has(i.charAt(4));
|
|
418
421
|
const o = !e && !t && s.has(i.charAt(0));
|
|
419
|
-
n = r ?
|
|
422
|
+
n = r ? L : o ? A : "";
|
|
420
423
|
}
|
|
421
424
|
}
|
|
422
425
|
}
|
|
@@ -437,7 +440,7 @@ class AST {
|
|
|
437
440
|
this.#e = undefined;
|
|
438
441
|
return [ t, E(this.toString()), false, false ];
|
|
439
442
|
}
|
|
440
|
-
let r = !s || t || e || !
|
|
443
|
+
let r = !s || t || e || !A ? "" : this.#p(true);
|
|
441
444
|
if (r === n) {
|
|
442
445
|
r = "";
|
|
443
446
|
}
|
|
@@ -446,9 +449,9 @@ class AST {
|
|
|
446
449
|
}
|
|
447
450
|
let o = "";
|
|
448
451
|
if (this.type === "!" && this.#c) {
|
|
449
|
-
o = (this.isStart() && !e ?
|
|
452
|
+
o = (this.isStart() && !e ? A : "") + D;
|
|
450
453
|
} else {
|
|
451
|
-
const s = this.type === "!" ? "))" + (this.isStart() && !e && !t ?
|
|
454
|
+
const s = this.type === "!" ? "))" + (this.isStart() && !e && !t ? A : "") + O + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && r ? ")" : this.type === "*" && r ? `)?` : `)${this.type}`;
|
|
452
455
|
o = i + n + s;
|
|
453
456
|
}
|
|
454
457
|
return [ o, E(n), this.#e = !!this.#e, this.#s ];
|
|
@@ -471,7 +474,7 @@ class AST {
|
|
|
471
474
|
const h = t.charAt(o);
|
|
472
475
|
if (i) {
|
|
473
476
|
i = false;
|
|
474
|
-
n += (
|
|
477
|
+
n += (F.has(h) ? "\\" : "") + h;
|
|
475
478
|
continue;
|
|
476
479
|
}
|
|
477
480
|
if (h === "\\") {
|
|
@@ -936,9 +939,11 @@ class Minimatch {
|
|
|
936
939
|
for (let e = 0; e < t.length - 1; e++) {
|
|
937
940
|
for (let s = e + 1; s < t.length; s++) {
|
|
938
941
|
const i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
|
|
939
|
-
if (
|
|
940
|
-
|
|
941
|
-
|
|
942
|
+
if (i) {
|
|
943
|
+
t[e] = [];
|
|
944
|
+
t[s] = i;
|
|
945
|
+
break;
|
|
946
|
+
}
|
|
942
947
|
}
|
|
943
948
|
}
|
|
944
949
|
return t.filter((t => t.length));
|
|
@@ -1103,9 +1108,12 @@ class Minimatch {
|
|
|
1103
1108
|
i = Z;
|
|
1104
1109
|
}
|
|
1105
1110
|
const n = AST.fromGlob(t, this.options).toMMPattern();
|
|
1106
|
-
|
|
1107
|
-
test
|
|
1108
|
-
|
|
1111
|
+
if (i && typeof n === "object") {
|
|
1112
|
+
Reflect.defineProperty(n, "test", {
|
|
1113
|
+
value: i
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
return n;
|
|
1109
1117
|
}
|
|
1110
1118
|
makeRe() {
|
|
1111
1119
|
if (this.regexp || this.regexp === false) return this.regexp;
|
|
@@ -1233,10 +1241,10 @@ const xt = (t, e, s, i) => {
|
|
|
1233
1241
|
|
|
1234
1242
|
let Et = globalThis.AbortController;
|
|
1235
1243
|
|
|
1236
|
-
let
|
|
1244
|
+
let Ct = globalThis.AbortSignal;
|
|
1237
1245
|
|
|
1238
1246
|
if (typeof Et === "undefined") {
|
|
1239
|
-
|
|
1247
|
+
Ct = class AbortSignal {
|
|
1240
1248
|
onabort;
|
|
1241
1249
|
_onabort=[];
|
|
1242
1250
|
reason;
|
|
@@ -1249,7 +1257,7 @@ if (typeof Et === "undefined") {
|
|
|
1249
1257
|
constructor() {
|
|
1250
1258
|
e();
|
|
1251
1259
|
}
|
|
1252
|
-
signal=new
|
|
1260
|
+
signal=new Ct;
|
|
1253
1261
|
abort(t) {
|
|
1254
1262
|
if (this.signal.aborted) return;
|
|
1255
1263
|
this.signal.reason = t;
|
|
@@ -1268,13 +1276,13 @@ if (typeof Et === "undefined") {
|
|
|
1268
1276
|
};
|
|
1269
1277
|
}
|
|
1270
1278
|
|
|
1271
|
-
const
|
|
1279
|
+
const Tt = t => !kt.has(t);
|
|
1272
1280
|
|
|
1273
|
-
const
|
|
1281
|
+
const Lt = Symbol("type");
|
|
1274
1282
|
|
|
1275
|
-
const
|
|
1283
|
+
const At = t => t && t === Math.floor(t) && t > 0 && isFinite(t);
|
|
1276
1284
|
|
|
1277
|
-
const
|
|
1285
|
+
const Mt = t => !At(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;
|
|
1278
1286
|
|
|
1279
1287
|
class ZeroArray extends Array {
|
|
1280
1288
|
constructor(t) {
|
|
@@ -1288,7 +1296,7 @@ class Stack {
|
|
|
1288
1296
|
length;
|
|
1289
1297
|
static #g=false;
|
|
1290
1298
|
static create(t) {
|
|
1291
|
-
const e =
|
|
1299
|
+
const e = Mt(t);
|
|
1292
1300
|
if (!e) return [];
|
|
1293
1301
|
Stack.#g = true;
|
|
1294
1302
|
const s = new Stack(t, e);
|
|
@@ -1316,6 +1324,7 @@ class LRUCache {
|
|
|
1316
1324
|
#y;
|
|
1317
1325
|
#b;
|
|
1318
1326
|
#S;
|
|
1327
|
+
#k;
|
|
1319
1328
|
ttl;
|
|
1320
1329
|
ttlResolution;
|
|
1321
1330
|
ttlAutopurge;
|
|
@@ -1331,46 +1340,46 @@ class LRUCache {
|
|
|
1331
1340
|
allowStaleOnFetchAbort;
|
|
1332
1341
|
allowStaleOnFetchRejection;
|
|
1333
1342
|
ignoreFetchAbort;
|
|
1334
|
-
#k;
|
|
1335
1343
|
#v;
|
|
1336
1344
|
#x;
|
|
1337
1345
|
#E;
|
|
1346
|
+
#C;
|
|
1338
1347
|
#T;
|
|
1339
1348
|
#L;
|
|
1340
1349
|
#A;
|
|
1341
|
-
#C;
|
|
1342
|
-
#F;
|
|
1343
|
-
#P;
|
|
1344
1350
|
#M;
|
|
1351
|
+
#P;
|
|
1352
|
+
#F;
|
|
1345
1353
|
#R;
|
|
1346
1354
|
#z;
|
|
1347
1355
|
#O;
|
|
1348
1356
|
#D;
|
|
1349
1357
|
#N;
|
|
1350
1358
|
#B;
|
|
1359
|
+
#W;
|
|
1351
1360
|
static unsafeExposeInternals(t) {
|
|
1352
1361
|
return {
|
|
1353
|
-
starts: t.#
|
|
1354
|
-
ttls: t.#
|
|
1355
|
-
sizes: t.#
|
|
1356
|
-
keyMap: t.#
|
|
1357
|
-
keyList: t.#
|
|
1362
|
+
starts: t.#O,
|
|
1363
|
+
ttls: t.#D,
|
|
1364
|
+
sizes: t.#z,
|
|
1365
|
+
keyMap: t.#E,
|
|
1366
|
+
keyList: t.#C,
|
|
1358
1367
|
valList: t.#T,
|
|
1359
1368
|
next: t.#L,
|
|
1360
1369
|
prev: t.#A,
|
|
1361
1370
|
get head() {
|
|
1362
|
-
return t.#
|
|
1371
|
+
return t.#M;
|
|
1363
1372
|
},
|
|
1364
1373
|
get tail() {
|
|
1365
|
-
return t.#
|
|
1374
|
+
return t.#P;
|
|
1366
1375
|
},
|
|
1367
|
-
free: t.#
|
|
1368
|
-
isBackgroundFetch: e => t.#
|
|
1369
|
-
backgroundFetch: (e, s, i, n) => t.#
|
|
1370
|
-
moveToTail: e => t.#
|
|
1371
|
-
indexes: e => t.#
|
|
1372
|
-
rindexes: e => t.#
|
|
1373
|
-
isStale: e => t
|
|
1376
|
+
free: t.#F,
|
|
1377
|
+
isBackgroundFetch: e => t.#_(e),
|
|
1378
|
+
backgroundFetch: (e, s, i, n) => t.#I(e, s, i, n),
|
|
1379
|
+
moveToTail: e => t.#j(e),
|
|
1380
|
+
indexes: e => t.#U(e),
|
|
1381
|
+
rindexes: e => t.#G(e),
|
|
1382
|
+
isStale: e => t.#$(e)
|
|
1374
1383
|
};
|
|
1375
1384
|
}
|
|
1376
1385
|
get max() {
|
|
@@ -1380,14 +1389,17 @@ class LRUCache {
|
|
|
1380
1389
|
return this.#w;
|
|
1381
1390
|
}
|
|
1382
1391
|
get calculatedSize() {
|
|
1383
|
-
return this.#
|
|
1392
|
+
return this.#x;
|
|
1384
1393
|
}
|
|
1385
1394
|
get size() {
|
|
1386
|
-
return this.#
|
|
1395
|
+
return this.#v;
|
|
1387
1396
|
}
|
|
1388
1397
|
get fetchMethod() {
|
|
1389
1398
|
return this.#S;
|
|
1390
1399
|
}
|
|
1400
|
+
get memoMethod() {
|
|
1401
|
+
return this.#k;
|
|
1402
|
+
}
|
|
1391
1403
|
get dispose() {
|
|
1392
1404
|
return this.#y;
|
|
1393
1405
|
}
|
|
@@ -1395,12 +1407,12 @@ class LRUCache {
|
|
|
1395
1407
|
return this.#b;
|
|
1396
1408
|
}
|
|
1397
1409
|
constructor(t) {
|
|
1398
|
-
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,
|
|
1399
|
-
if (e !== 0 && !
|
|
1410
|
+
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;
|
|
1411
|
+
if (e !== 0 && !At(e)) {
|
|
1400
1412
|
throw new TypeError("max option must be a nonnegative integer");
|
|
1401
1413
|
}
|
|
1402
|
-
const
|
|
1403
|
-
if (!
|
|
1414
|
+
const v = e ? Mt(e) : Array;
|
|
1415
|
+
if (!v) {
|
|
1404
1416
|
throw new Error("invalid max value: " + e);
|
|
1405
1417
|
}
|
|
1406
1418
|
this.#m = e;
|
|
@@ -1415,69 +1427,73 @@ class LRUCache {
|
|
|
1415
1427
|
throw new TypeError("sizeCalculation set to non-function");
|
|
1416
1428
|
}
|
|
1417
1429
|
}
|
|
1430
|
+
if (m !== undefined && typeof m !== "function") {
|
|
1431
|
+
throw new TypeError("memoMethod must be a function if defined");
|
|
1432
|
+
}
|
|
1433
|
+
this.#k = m;
|
|
1418
1434
|
if (g !== undefined && typeof g !== "function") {
|
|
1419
1435
|
throw new TypeError("fetchMethod must be a function if specified");
|
|
1420
1436
|
}
|
|
1421
1437
|
this.#S = g;
|
|
1422
|
-
this.#
|
|
1423
|
-
this.#
|
|
1424
|
-
this.#
|
|
1438
|
+
this.#B = !!g;
|
|
1439
|
+
this.#E = new Map;
|
|
1440
|
+
this.#C = new Array(e).fill(undefined);
|
|
1425
1441
|
this.#T = new Array(e).fill(undefined);
|
|
1426
|
-
this.#L = new
|
|
1427
|
-
this.#A = new
|
|
1428
|
-
this.#
|
|
1429
|
-
this.#
|
|
1430
|
-
this.#
|
|
1431
|
-
this.#k = 0;
|
|
1442
|
+
this.#L = new v(e);
|
|
1443
|
+
this.#A = new v(e);
|
|
1444
|
+
this.#M = 0;
|
|
1445
|
+
this.#P = 0;
|
|
1446
|
+
this.#F = Stack.create(e);
|
|
1432
1447
|
this.#v = 0;
|
|
1448
|
+
this.#x = 0;
|
|
1433
1449
|
if (typeof a === "function") {
|
|
1434
1450
|
this.#y = a;
|
|
1435
1451
|
}
|
|
1436
1452
|
if (typeof l === "function") {
|
|
1437
1453
|
this.#b = l;
|
|
1438
|
-
this.#
|
|
1454
|
+
this.#R = [];
|
|
1439
1455
|
} else {
|
|
1440
1456
|
this.#b = undefined;
|
|
1441
|
-
this.#
|
|
1457
|
+
this.#R = undefined;
|
|
1442
1458
|
}
|
|
1443
|
-
this.#
|
|
1444
|
-
this.#
|
|
1459
|
+
this.#N = !!this.#y;
|
|
1460
|
+
this.#W = !!this.#b;
|
|
1445
1461
|
this.noDisposeOnSet = !!c;
|
|
1446
1462
|
this.noUpdateTTL = !!f;
|
|
1447
|
-
this.noDeleteOnFetchRejection = !!
|
|
1448
|
-
this.allowStaleOnFetchRejection = !!
|
|
1449
|
-
this.allowStaleOnFetchAbort = !!
|
|
1450
|
-
this.ignoreFetchAbort = !!
|
|
1463
|
+
this.noDeleteOnFetchRejection = !!w;
|
|
1464
|
+
this.allowStaleOnFetchRejection = !!b;
|
|
1465
|
+
this.allowStaleOnFetchAbort = !!S;
|
|
1466
|
+
this.ignoreFetchAbort = !!k;
|
|
1451
1467
|
if (this.maxEntrySize !== 0) {
|
|
1452
1468
|
if (this.#w !== 0) {
|
|
1453
|
-
if (!
|
|
1469
|
+
if (!At(this.#w)) {
|
|
1454
1470
|
throw new TypeError("maxSize must be a positive integer if specified");
|
|
1455
1471
|
}
|
|
1456
1472
|
}
|
|
1457
|
-
if (!
|
|
1473
|
+
if (!At(this.maxEntrySize)) {
|
|
1458
1474
|
throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
1459
1475
|
}
|
|
1460
|
-
this
|
|
1476
|
+
this.#H();
|
|
1461
1477
|
}
|
|
1462
1478
|
this.allowStale = !!h;
|
|
1463
|
-
this.noDeleteOnStaleGet = !!
|
|
1479
|
+
this.noDeleteOnStaleGet = !!y;
|
|
1464
1480
|
this.updateAgeOnGet = !!r;
|
|
1465
1481
|
this.updateAgeOnHas = !!o;
|
|
1466
|
-
this.ttlResolution =
|
|
1482
|
+
this.ttlResolution = At(i) || i === 0 ? i : 1;
|
|
1467
1483
|
this.ttlAutopurge = !!n;
|
|
1468
1484
|
this.ttl = s || 0;
|
|
1469
1485
|
if (this.ttl) {
|
|
1470
|
-
if (!
|
|
1486
|
+
if (!At(this.ttl)) {
|
|
1471
1487
|
throw new TypeError("ttl must be a positive integer if specified");
|
|
1472
1488
|
}
|
|
1473
|
-
this.#
|
|
1489
|
+
this.#q();
|
|
1474
1490
|
}
|
|
1475
1491
|
if (this.#m === 0 && this.ttl === 0 && this.#w === 0) {
|
|
1476
1492
|
throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
1477
1493
|
}
|
|
1478
1494
|
if (!this.ttlAutopurge && !this.#m && !this.#w) {
|
|
1479
1495
|
const t = "LRU_CACHE_UNBOUNDED";
|
|
1480
|
-
if (
|
|
1496
|
+
if (Tt(t)) {
|
|
1481
1497
|
kt.add(t);
|
|
1482
1498
|
const e = "TTL caching without ttlAutopurge, max, or maxSize can " + "result in unbounded memory consumption.";
|
|
1483
1499
|
xt(e, "UnboundedCacheWarning", t, LRUCache);
|
|
@@ -1485,20 +1501,20 @@ class LRUCache {
|
|
|
1485
1501
|
}
|
|
1486
1502
|
}
|
|
1487
1503
|
getRemainingTTL(t) {
|
|
1488
|
-
return this.#
|
|
1504
|
+
return this.#E.has(t) ? Infinity : 0;
|
|
1489
1505
|
}
|
|
1490
|
-
#
|
|
1506
|
+
#q() {
|
|
1491
1507
|
const t = new ZeroArray(this.#m);
|
|
1492
1508
|
const e = new ZeroArray(this.#m);
|
|
1493
|
-
this.#
|
|
1494
|
-
this.#
|
|
1495
|
-
this.#
|
|
1509
|
+
this.#D = t;
|
|
1510
|
+
this.#O = e;
|
|
1511
|
+
this.#Z = (s, i, n = St.now()) => {
|
|
1496
1512
|
e[s] = i !== 0 ? n : 0;
|
|
1497
1513
|
t[s] = i;
|
|
1498
1514
|
if (i !== 0 && this.ttlAutopurge) {
|
|
1499
1515
|
const t = setTimeout((() => {
|
|
1500
|
-
if (this
|
|
1501
|
-
this
|
|
1516
|
+
if (this.#$(s)) {
|
|
1517
|
+
this.#V(this.#C[s], "expire");
|
|
1502
1518
|
}
|
|
1503
1519
|
}), i + 1);
|
|
1504
1520
|
if (t.unref) {
|
|
@@ -1506,10 +1522,10 @@ class LRUCache {
|
|
|
1506
1522
|
}
|
|
1507
1523
|
}
|
|
1508
1524
|
};
|
|
1509
|
-
this.#
|
|
1525
|
+
this.#J = s => {
|
|
1510
1526
|
e[s] = t[s] !== 0 ? St.now() : 0;
|
|
1511
1527
|
};
|
|
1512
|
-
this.#
|
|
1528
|
+
this.#K = (n, r) => {
|
|
1513
1529
|
if (t[r]) {
|
|
1514
1530
|
const o = t[r];
|
|
1515
1531
|
const h = e[r];
|
|
@@ -1534,7 +1550,7 @@ class LRUCache {
|
|
|
1534
1550
|
return t;
|
|
1535
1551
|
};
|
|
1536
1552
|
this.getRemainingTTL = n => {
|
|
1537
|
-
const r = this.#
|
|
1553
|
+
const r = this.#E.get(n);
|
|
1538
1554
|
if (r === undefined) {
|
|
1539
1555
|
return 0;
|
|
1540
1556
|
}
|
|
@@ -1546,35 +1562,35 @@ class LRUCache {
|
|
|
1546
1562
|
const a = (s || i()) - h;
|
|
1547
1563
|
return o - a;
|
|
1548
1564
|
};
|
|
1549
|
-
this
|
|
1565
|
+
this.#$ = n => {
|
|
1550
1566
|
const r = e[n];
|
|
1551
1567
|
const o = t[n];
|
|
1552
1568
|
return !!o && !!r && (s || i()) - r > o;
|
|
1553
1569
|
};
|
|
1554
1570
|
}
|
|
1571
|
+
#J=() => {};
|
|
1572
|
+
#K=() => {};
|
|
1555
1573
|
#Z=() => {};
|
|
1556
|
-
|
|
1557
|
-
#
|
|
1558
|
-
#G=() => false;
|
|
1559
|
-
#$() {
|
|
1574
|
+
#$=() => false;
|
|
1575
|
+
#H() {
|
|
1560
1576
|
const t = new ZeroArray(this.#m);
|
|
1561
|
-
this.#
|
|
1562
|
-
this.#
|
|
1563
|
-
this.#
|
|
1564
|
-
this.#
|
|
1577
|
+
this.#x = 0;
|
|
1578
|
+
this.#z = t;
|
|
1579
|
+
this.#Y = e => {
|
|
1580
|
+
this.#x -= t[e];
|
|
1565
1581
|
t[e] = 0;
|
|
1566
1582
|
};
|
|
1567
|
-
this.#
|
|
1568
|
-
if (this.#
|
|
1583
|
+
this.#X = (t, e, s, i) => {
|
|
1584
|
+
if (this.#_(e)) {
|
|
1569
1585
|
return 0;
|
|
1570
1586
|
}
|
|
1571
|
-
if (!
|
|
1587
|
+
if (!At(s)) {
|
|
1572
1588
|
if (i) {
|
|
1573
1589
|
if (typeof i !== "function") {
|
|
1574
1590
|
throw new TypeError("sizeCalculation must be a function");
|
|
1575
1591
|
}
|
|
1576
1592
|
s = i(e, t);
|
|
1577
|
-
if (!
|
|
1593
|
+
if (!At(s)) {
|
|
1578
1594
|
throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
1579
1595
|
}
|
|
1580
1596
|
} else {
|
|
@@ -1583,39 +1599,39 @@ class LRUCache {
|
|
|
1583
1599
|
}
|
|
1584
1600
|
return s;
|
|
1585
1601
|
};
|
|
1586
|
-
this.#
|
|
1602
|
+
this.#Q = (e, s, i) => {
|
|
1587
1603
|
t[e] = s;
|
|
1588
1604
|
if (this.#w) {
|
|
1589
1605
|
const s = this.#w - t[e];
|
|
1590
|
-
while (this.#
|
|
1591
|
-
this.#
|
|
1606
|
+
while (this.#x > s) {
|
|
1607
|
+
this.#tt(true);
|
|
1592
1608
|
}
|
|
1593
1609
|
}
|
|
1594
|
-
this.#
|
|
1610
|
+
this.#x += t[e];
|
|
1595
1611
|
if (i) {
|
|
1596
1612
|
i.entrySize = s;
|
|
1597
|
-
i.totalCalculatedSize = this.#
|
|
1613
|
+
i.totalCalculatedSize = this.#x;
|
|
1598
1614
|
}
|
|
1599
1615
|
};
|
|
1600
1616
|
}
|
|
1601
|
-
#
|
|
1602
|
-
#
|
|
1603
|
-
#
|
|
1617
|
+
#Y=t => {};
|
|
1618
|
+
#Q=(t, e, s) => {};
|
|
1619
|
+
#X=(t, e, s, i) => {
|
|
1604
1620
|
if (s || i) {
|
|
1605
1621
|
throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
1606
1622
|
}
|
|
1607
1623
|
return 0;
|
|
1608
1624
|
};
|
|
1609
|
-
* #
|
|
1610
|
-
if (this.#
|
|
1611
|
-
for (let e = this.#
|
|
1612
|
-
if (!this.#
|
|
1625
|
+
* #U({allowStale: t = this.allowStale} = {}) {
|
|
1626
|
+
if (this.#v) {
|
|
1627
|
+
for (let e = this.#P; true; ) {
|
|
1628
|
+
if (!this.#et(e)) {
|
|
1613
1629
|
break;
|
|
1614
1630
|
}
|
|
1615
|
-
if (t || !this
|
|
1631
|
+
if (t || !this.#$(e)) {
|
|
1616
1632
|
yield e;
|
|
1617
1633
|
}
|
|
1618
|
-
if (e === this.#
|
|
1634
|
+
if (e === this.#M) {
|
|
1619
1635
|
break;
|
|
1620
1636
|
} else {
|
|
1621
1637
|
e = this.#A[e];
|
|
@@ -1623,16 +1639,16 @@ class LRUCache {
|
|
|
1623
1639
|
}
|
|
1624
1640
|
}
|
|
1625
1641
|
}
|
|
1626
|
-
* #
|
|
1627
|
-
if (this.#
|
|
1628
|
-
for (let e = this.#
|
|
1629
|
-
if (!this.#
|
|
1642
|
+
* #G({allowStale: t = this.allowStale} = {}) {
|
|
1643
|
+
if (this.#v) {
|
|
1644
|
+
for (let e = this.#M; true; ) {
|
|
1645
|
+
if (!this.#et(e)) {
|
|
1630
1646
|
break;
|
|
1631
1647
|
}
|
|
1632
|
-
if (t || !this
|
|
1648
|
+
if (t || !this.#$(e)) {
|
|
1633
1649
|
yield e;
|
|
1634
1650
|
}
|
|
1635
|
-
if (e === this.#
|
|
1651
|
+
if (e === this.#P) {
|
|
1636
1652
|
break;
|
|
1637
1653
|
} else {
|
|
1638
1654
|
e = this.#L[e];
|
|
@@ -1640,51 +1656,51 @@ class LRUCache {
|
|
|
1640
1656
|
}
|
|
1641
1657
|
}
|
|
1642
1658
|
}
|
|
1643
|
-
#
|
|
1644
|
-
return t !== undefined && this.#
|
|
1659
|
+
#et(t) {
|
|
1660
|
+
return t !== undefined && this.#E.get(this.#C[t]) === t;
|
|
1645
1661
|
}
|
|
1646
1662
|
* entries() {
|
|
1647
|
-
for (const t of this.#
|
|
1648
|
-
if (this.#T[t] !== undefined && this.#
|
|
1649
|
-
yield [ this.#
|
|
1663
|
+
for (const t of this.#U()) {
|
|
1664
|
+
if (this.#T[t] !== undefined && this.#C[t] !== undefined && !this.#_(this.#T[t])) {
|
|
1665
|
+
yield [ this.#C[t], this.#T[t] ];
|
|
1650
1666
|
}
|
|
1651
1667
|
}
|
|
1652
1668
|
}
|
|
1653
1669
|
* rentries() {
|
|
1654
|
-
for (const t of this.#
|
|
1655
|
-
if (this.#T[t] !== undefined && this.#
|
|
1656
|
-
yield [ this.#
|
|
1670
|
+
for (const t of this.#G()) {
|
|
1671
|
+
if (this.#T[t] !== undefined && this.#C[t] !== undefined && !this.#_(this.#T[t])) {
|
|
1672
|
+
yield [ this.#C[t], this.#T[t] ];
|
|
1657
1673
|
}
|
|
1658
1674
|
}
|
|
1659
1675
|
}
|
|
1660
1676
|
* keys() {
|
|
1661
|
-
for (const t of this.#
|
|
1662
|
-
const e = this.#
|
|
1663
|
-
if (e !== undefined && !this.#
|
|
1677
|
+
for (const t of this.#U()) {
|
|
1678
|
+
const e = this.#C[t];
|
|
1679
|
+
if (e !== undefined && !this.#_(this.#T[t])) {
|
|
1664
1680
|
yield e;
|
|
1665
1681
|
}
|
|
1666
1682
|
}
|
|
1667
1683
|
}
|
|
1668
1684
|
* rkeys() {
|
|
1669
|
-
for (const t of this.#
|
|
1670
|
-
const e = this.#
|
|
1671
|
-
if (e !== undefined && !this.#
|
|
1685
|
+
for (const t of this.#G()) {
|
|
1686
|
+
const e = this.#C[t];
|
|
1687
|
+
if (e !== undefined && !this.#_(this.#T[t])) {
|
|
1672
1688
|
yield e;
|
|
1673
1689
|
}
|
|
1674
1690
|
}
|
|
1675
1691
|
}
|
|
1676
1692
|
* values() {
|
|
1677
|
-
for (const t of this.#
|
|
1693
|
+
for (const t of this.#U()) {
|
|
1678
1694
|
const e = this.#T[t];
|
|
1679
|
-
if (e !== undefined && !this.#
|
|
1695
|
+
if (e !== undefined && !this.#_(this.#T[t])) {
|
|
1680
1696
|
yield this.#T[t];
|
|
1681
1697
|
}
|
|
1682
1698
|
}
|
|
1683
1699
|
}
|
|
1684
1700
|
* rvalues() {
|
|
1685
|
-
for (const t of this.#
|
|
1701
|
+
for (const t of this.#G()) {
|
|
1686
1702
|
const e = this.#T[t];
|
|
1687
|
-
if (e !== undefined && !this.#
|
|
1703
|
+
if (e !== undefined && !this.#_(this.#T[t])) {
|
|
1688
1704
|
yield this.#T[t];
|
|
1689
1705
|
}
|
|
1690
1706
|
}
|
|
@@ -1694,85 +1710,85 @@ class LRUCache {
|
|
|
1694
1710
|
}
|
|
1695
1711
|
[Symbol.toStringTag]="LRUCache";
|
|
1696
1712
|
find(t, e = {}) {
|
|
1697
|
-
for (const s of this.#
|
|
1713
|
+
for (const s of this.#U()) {
|
|
1698
1714
|
const i = this.#T[s];
|
|
1699
|
-
const n = this.#
|
|
1715
|
+
const n = this.#_(i) ? i.__staleWhileFetching : i;
|
|
1700
1716
|
if (n === undefined) continue;
|
|
1701
|
-
if (t(n, this.#
|
|
1702
|
-
return this.get(this.#
|
|
1717
|
+
if (t(n, this.#C[s], this)) {
|
|
1718
|
+
return this.get(this.#C[s], e);
|
|
1703
1719
|
}
|
|
1704
1720
|
}
|
|
1705
1721
|
}
|
|
1706
1722
|
forEach(t, e = this) {
|
|
1707
|
-
for (const s of this.#
|
|
1723
|
+
for (const s of this.#U()) {
|
|
1708
1724
|
const i = this.#T[s];
|
|
1709
|
-
const n = this.#
|
|
1725
|
+
const n = this.#_(i) ? i.__staleWhileFetching : i;
|
|
1710
1726
|
if (n === undefined) continue;
|
|
1711
|
-
t.call(e, n, this.#
|
|
1727
|
+
t.call(e, n, this.#C[s], this);
|
|
1712
1728
|
}
|
|
1713
1729
|
}
|
|
1714
1730
|
rforEach(t, e = this) {
|
|
1715
|
-
for (const s of this.#
|
|
1731
|
+
for (const s of this.#G()) {
|
|
1716
1732
|
const i = this.#T[s];
|
|
1717
|
-
const n = this.#
|
|
1733
|
+
const n = this.#_(i) ? i.__staleWhileFetching : i;
|
|
1718
1734
|
if (n === undefined) continue;
|
|
1719
|
-
t.call(e, n, this.#
|
|
1735
|
+
t.call(e, n, this.#C[s], this);
|
|
1720
1736
|
}
|
|
1721
1737
|
}
|
|
1722
1738
|
purgeStale() {
|
|
1723
1739
|
let t = false;
|
|
1724
|
-
for (const e of this.#
|
|
1740
|
+
for (const e of this.#G({
|
|
1725
1741
|
allowStale: true
|
|
1726
1742
|
})) {
|
|
1727
|
-
if (this
|
|
1728
|
-
this
|
|
1743
|
+
if (this.#$(e)) {
|
|
1744
|
+
this.#V(this.#C[e], "expire");
|
|
1729
1745
|
t = true;
|
|
1730
1746
|
}
|
|
1731
1747
|
}
|
|
1732
1748
|
return t;
|
|
1733
1749
|
}
|
|
1734
1750
|
info(t) {
|
|
1735
|
-
const e = this.#
|
|
1751
|
+
const e = this.#E.get(t);
|
|
1736
1752
|
if (e === undefined) return undefined;
|
|
1737
1753
|
const s = this.#T[e];
|
|
1738
|
-
const i = this.#
|
|
1754
|
+
const i = this.#_(s) ? s.__staleWhileFetching : s;
|
|
1739
1755
|
if (i === undefined) return undefined;
|
|
1740
1756
|
const n = {
|
|
1741
1757
|
value: i
|
|
1742
1758
|
};
|
|
1743
|
-
if (this.#
|
|
1744
|
-
const t = this.#
|
|
1745
|
-
const s = this.#
|
|
1759
|
+
if (this.#D && this.#O) {
|
|
1760
|
+
const t = this.#D[e];
|
|
1761
|
+
const s = this.#O[e];
|
|
1746
1762
|
if (t && s) {
|
|
1747
1763
|
const e = t - (St.now() - s);
|
|
1748
1764
|
n.ttl = e;
|
|
1749
1765
|
n.start = Date.now();
|
|
1750
1766
|
}
|
|
1751
1767
|
}
|
|
1752
|
-
if (this.#
|
|
1753
|
-
n.size = this.#
|
|
1768
|
+
if (this.#z) {
|
|
1769
|
+
n.size = this.#z[e];
|
|
1754
1770
|
}
|
|
1755
1771
|
return n;
|
|
1756
1772
|
}
|
|
1757
1773
|
dump() {
|
|
1758
1774
|
const t = [];
|
|
1759
|
-
for (const e of this.#
|
|
1775
|
+
for (const e of this.#U({
|
|
1760
1776
|
allowStale: true
|
|
1761
1777
|
})) {
|
|
1762
|
-
const s = this.#
|
|
1778
|
+
const s = this.#C[e];
|
|
1763
1779
|
const i = this.#T[e];
|
|
1764
|
-
const n = this.#
|
|
1780
|
+
const n = this.#_(i) ? i.__staleWhileFetching : i;
|
|
1765
1781
|
if (n === undefined || s === undefined) continue;
|
|
1766
1782
|
const r = {
|
|
1767
1783
|
value: n
|
|
1768
1784
|
};
|
|
1769
|
-
if (this.#
|
|
1770
|
-
r.ttl = this.#
|
|
1771
|
-
const t = St.now() - this.#
|
|
1785
|
+
if (this.#D && this.#O) {
|
|
1786
|
+
r.ttl = this.#D[e];
|
|
1787
|
+
const t = St.now() - this.#O[e];
|
|
1772
1788
|
r.start = Math.floor(Date.now() - t);
|
|
1773
1789
|
}
|
|
1774
|
-
if (this.#
|
|
1775
|
-
r.size = this.#
|
|
1790
|
+
if (this.#z) {
|
|
1791
|
+
r.size = this.#z[e];
|
|
1776
1792
|
}
|
|
1777
1793
|
t.unshift([ s, r ]);
|
|
1778
1794
|
}
|
|
@@ -1795,74 +1811,74 @@ class LRUCache {
|
|
|
1795
1811
|
}
|
|
1796
1812
|
const {ttl: i = this.ttl, start: n, noDisposeOnSet: r = this.noDisposeOnSet, sizeCalculation: o = this.sizeCalculation, status: h} = s;
|
|
1797
1813
|
let {noUpdateTTL: a = this.noUpdateTTL} = s;
|
|
1798
|
-
const l = this.#
|
|
1814
|
+
const l = this.#X(t, e, s.size || 0, o);
|
|
1799
1815
|
if (this.maxEntrySize && l > this.maxEntrySize) {
|
|
1800
1816
|
if (h) {
|
|
1801
1817
|
h.set = "miss";
|
|
1802
1818
|
h.maxEntrySizeExceeded = true;
|
|
1803
1819
|
}
|
|
1804
|
-
this
|
|
1820
|
+
this.#V(t, "set");
|
|
1805
1821
|
return this;
|
|
1806
1822
|
}
|
|
1807
|
-
let c = this.#
|
|
1823
|
+
let c = this.#v === 0 ? undefined : this.#E.get(t);
|
|
1808
1824
|
if (c === undefined) {
|
|
1809
|
-
c = this.#
|
|
1810
|
-
this.#
|
|
1825
|
+
c = this.#v === 0 ? this.#P : this.#F.length !== 0 ? this.#F.pop() : this.#v === this.#m ? this.#tt(false) : this.#v;
|
|
1826
|
+
this.#C[c] = t;
|
|
1811
1827
|
this.#T[c] = e;
|
|
1812
|
-
this.#
|
|
1813
|
-
this.#L[this.#
|
|
1814
|
-
this.#A[c] = this.#
|
|
1815
|
-
this.#
|
|
1816
|
-
this.#
|
|
1817
|
-
this.#
|
|
1828
|
+
this.#E.set(t, c);
|
|
1829
|
+
this.#L[this.#P] = c;
|
|
1830
|
+
this.#A[c] = this.#P;
|
|
1831
|
+
this.#P = c;
|
|
1832
|
+
this.#v++;
|
|
1833
|
+
this.#Q(c, l, h);
|
|
1818
1834
|
if (h) h.set = "add";
|
|
1819
1835
|
a = false;
|
|
1820
1836
|
} else {
|
|
1821
|
-
this.#
|
|
1837
|
+
this.#j(c);
|
|
1822
1838
|
const s = this.#T[c];
|
|
1823
1839
|
if (e !== s) {
|
|
1824
|
-
if (this.#
|
|
1840
|
+
if (this.#B && this.#_(s)) {
|
|
1825
1841
|
s.__abortController.abort(new Error("replaced"));
|
|
1826
1842
|
const {__staleWhileFetching: e} = s;
|
|
1827
1843
|
if (e !== undefined && !r) {
|
|
1828
|
-
if (this.#
|
|
1844
|
+
if (this.#N) {
|
|
1829
1845
|
this.#y?.(e, t, "set");
|
|
1830
1846
|
}
|
|
1831
|
-
if (this.#
|
|
1832
|
-
this.#
|
|
1847
|
+
if (this.#W) {
|
|
1848
|
+
this.#R?.push([ e, t, "set" ]);
|
|
1833
1849
|
}
|
|
1834
1850
|
}
|
|
1835
1851
|
} else if (!r) {
|
|
1836
|
-
if (this.#
|
|
1852
|
+
if (this.#N) {
|
|
1837
1853
|
this.#y?.(s, t, "set");
|
|
1838
1854
|
}
|
|
1839
|
-
if (this.#
|
|
1840
|
-
this.#
|
|
1855
|
+
if (this.#W) {
|
|
1856
|
+
this.#R?.push([ s, t, "set" ]);
|
|
1841
1857
|
}
|
|
1842
1858
|
}
|
|
1843
|
-
this.#
|
|
1844
|
-
this.#
|
|
1859
|
+
this.#Y(c);
|
|
1860
|
+
this.#Q(c, l, h);
|
|
1845
1861
|
this.#T[c] = e;
|
|
1846
1862
|
if (h) {
|
|
1847
1863
|
h.set = "replace";
|
|
1848
|
-
const t = s && this.#
|
|
1864
|
+
const t = s && this.#_(s) ? s.__staleWhileFetching : s;
|
|
1849
1865
|
if (t !== undefined) h.oldValue = t;
|
|
1850
1866
|
}
|
|
1851
1867
|
} else if (h) {
|
|
1852
1868
|
h.set = "update";
|
|
1853
1869
|
}
|
|
1854
1870
|
}
|
|
1855
|
-
if (i !== 0 && !this.#
|
|
1856
|
-
this.#
|
|
1871
|
+
if (i !== 0 && !this.#D) {
|
|
1872
|
+
this.#q();
|
|
1857
1873
|
}
|
|
1858
|
-
if (this.#
|
|
1874
|
+
if (this.#D) {
|
|
1859
1875
|
if (!a) {
|
|
1860
|
-
this.#
|
|
1876
|
+
this.#Z(c, i, n);
|
|
1861
1877
|
}
|
|
1862
|
-
if (h) this.#
|
|
1878
|
+
if (h) this.#K(h, c);
|
|
1863
1879
|
}
|
|
1864
|
-
if (!r && this.#
|
|
1865
|
-
const t = this.#
|
|
1880
|
+
if (!r && this.#W && this.#R) {
|
|
1881
|
+
const t = this.#R;
|
|
1866
1882
|
let e;
|
|
1867
1883
|
while (e = t?.shift()) {
|
|
1868
1884
|
this.#b?.(...e);
|
|
@@ -1872,10 +1888,10 @@ class LRUCache {
|
|
|
1872
1888
|
}
|
|
1873
1889
|
pop() {
|
|
1874
1890
|
try {
|
|
1875
|
-
while (this.#
|
|
1876
|
-
const t = this.#T[this.#
|
|
1877
|
-
this.#
|
|
1878
|
-
if (this.#
|
|
1891
|
+
while (this.#v) {
|
|
1892
|
+
const t = this.#T[this.#M];
|
|
1893
|
+
this.#tt(true);
|
|
1894
|
+
if (this.#_(t)) {
|
|
1879
1895
|
if (t.__staleWhileFetching) {
|
|
1880
1896
|
return t.__staleWhileFetching;
|
|
1881
1897
|
}
|
|
@@ -1884,8 +1900,8 @@ class LRUCache {
|
|
|
1884
1900
|
}
|
|
1885
1901
|
}
|
|
1886
1902
|
} finally {
|
|
1887
|
-
if (this.#
|
|
1888
|
-
const t = this.#
|
|
1903
|
+
if (this.#W && this.#R) {
|
|
1904
|
+
const t = this.#R;
|
|
1889
1905
|
let e;
|
|
1890
1906
|
while (e = t?.shift()) {
|
|
1891
1907
|
this.#b?.(...e);
|
|
@@ -1893,56 +1909,56 @@ class LRUCache {
|
|
|
1893
1909
|
}
|
|
1894
1910
|
}
|
|
1895
1911
|
}
|
|
1896
|
-
#
|
|
1897
|
-
const e = this.#
|
|
1898
|
-
const s = this.#
|
|
1912
|
+
#tt(t) {
|
|
1913
|
+
const e = this.#M;
|
|
1914
|
+
const s = this.#C[e];
|
|
1899
1915
|
const i = this.#T[e];
|
|
1900
|
-
if (this.#
|
|
1916
|
+
if (this.#B && this.#_(i)) {
|
|
1901
1917
|
i.__abortController.abort(new Error("evicted"));
|
|
1902
|
-
} else if (this.#
|
|
1903
|
-
if (this.#
|
|
1918
|
+
} else if (this.#N || this.#W) {
|
|
1919
|
+
if (this.#N) {
|
|
1904
1920
|
this.#y?.(i, s, "evict");
|
|
1905
1921
|
}
|
|
1906
|
-
if (this.#
|
|
1907
|
-
this.#
|
|
1922
|
+
if (this.#W) {
|
|
1923
|
+
this.#R?.push([ i, s, "evict" ]);
|
|
1908
1924
|
}
|
|
1909
1925
|
}
|
|
1910
|
-
this.#
|
|
1926
|
+
this.#Y(e);
|
|
1911
1927
|
if (t) {
|
|
1912
|
-
this.#
|
|
1928
|
+
this.#C[e] = undefined;
|
|
1913
1929
|
this.#T[e] = undefined;
|
|
1914
|
-
this.#
|
|
1930
|
+
this.#F.push(e);
|
|
1915
1931
|
}
|
|
1916
|
-
if (this.#
|
|
1917
|
-
this.#
|
|
1918
|
-
this.#
|
|
1932
|
+
if (this.#v === 1) {
|
|
1933
|
+
this.#M = this.#P = 0;
|
|
1934
|
+
this.#F.length = 0;
|
|
1919
1935
|
} else {
|
|
1920
|
-
this.#
|
|
1936
|
+
this.#M = this.#L[e];
|
|
1921
1937
|
}
|
|
1922
|
-
this.#
|
|
1923
|
-
this.#
|
|
1938
|
+
this.#E.delete(s);
|
|
1939
|
+
this.#v--;
|
|
1924
1940
|
return e;
|
|
1925
1941
|
}
|
|
1926
1942
|
has(t, e = {}) {
|
|
1927
1943
|
const {updateAgeOnHas: s = this.updateAgeOnHas, status: i} = e;
|
|
1928
|
-
const n = this.#
|
|
1944
|
+
const n = this.#E.get(t);
|
|
1929
1945
|
if (n !== undefined) {
|
|
1930
1946
|
const t = this.#T[n];
|
|
1931
|
-
if (this.#
|
|
1947
|
+
if (this.#_(t) && t.__staleWhileFetching === undefined) {
|
|
1932
1948
|
return false;
|
|
1933
1949
|
}
|
|
1934
|
-
if (!this
|
|
1950
|
+
if (!this.#$(n)) {
|
|
1935
1951
|
if (s) {
|
|
1936
|
-
this.#
|
|
1952
|
+
this.#J(n);
|
|
1937
1953
|
}
|
|
1938
1954
|
if (i) {
|
|
1939
1955
|
i.has = "hit";
|
|
1940
|
-
this.#
|
|
1956
|
+
this.#K(i, n);
|
|
1941
1957
|
}
|
|
1942
1958
|
return true;
|
|
1943
1959
|
} else if (i) {
|
|
1944
1960
|
i.has = "stale";
|
|
1945
|
-
this.#
|
|
1961
|
+
this.#K(i, n);
|
|
1946
1962
|
}
|
|
1947
1963
|
} else if (i) {
|
|
1948
1964
|
i.has = "miss";
|
|
@@ -1951,16 +1967,16 @@ class LRUCache {
|
|
|
1951
1967
|
}
|
|
1952
1968
|
peek(t, e = {}) {
|
|
1953
1969
|
const {allowStale: s = this.allowStale} = e;
|
|
1954
|
-
const i = this.#
|
|
1955
|
-
if (i === undefined || !s && this
|
|
1970
|
+
const i = this.#E.get(t);
|
|
1971
|
+
if (i === undefined || !s && this.#$(i)) {
|
|
1956
1972
|
return;
|
|
1957
1973
|
}
|
|
1958
1974
|
const n = this.#T[i];
|
|
1959
|
-
return this.#
|
|
1975
|
+
return this.#_(n) ? n.__staleWhileFetching : n;
|
|
1960
1976
|
}
|
|
1961
|
-
#
|
|
1977
|
+
#I(t, e, s, i) {
|
|
1962
1978
|
const n = e === undefined ? undefined : this.#T[e];
|
|
1963
|
-
if (this.#
|
|
1979
|
+
if (this.#_(n)) {
|
|
1964
1980
|
return n;
|
|
1965
1981
|
}
|
|
1966
1982
|
const r = new Et;
|
|
@@ -1994,7 +2010,7 @@ class LRUCache {
|
|
|
1994
2010
|
if (l.__staleWhileFetching) {
|
|
1995
2011
|
this.#T[e] = l.__staleWhileFetching;
|
|
1996
2012
|
} else {
|
|
1997
|
-
this
|
|
2013
|
+
this.#V(t, "fetch");
|
|
1998
2014
|
}
|
|
1999
2015
|
} else {
|
|
2000
2016
|
if (s.status) s.status.fetchUpdated = true;
|
|
@@ -2019,7 +2035,7 @@ class LRUCache {
|
|
|
2019
2035
|
if (this.#T[e] === u) {
|
|
2020
2036
|
const s = !a || l.__staleWhileFetching === undefined;
|
|
2021
2037
|
if (s) {
|
|
2022
|
-
this
|
|
2038
|
+
this.#V(t, "fetch");
|
|
2023
2039
|
} else if (!o) {
|
|
2024
2040
|
this.#T[e] = l.__staleWhileFetching;
|
|
2025
2041
|
}
|
|
@@ -2059,20 +2075,20 @@ class LRUCache {
|
|
|
2059
2075
|
...h.options,
|
|
2060
2076
|
status: undefined
|
|
2061
2077
|
});
|
|
2062
|
-
e = this.#
|
|
2078
|
+
e = this.#E.get(t);
|
|
2063
2079
|
} else {
|
|
2064
2080
|
this.#T[e] = d;
|
|
2065
2081
|
}
|
|
2066
2082
|
return d;
|
|
2067
2083
|
}
|
|
2068
|
-
#
|
|
2069
|
-
if (!this.#
|
|
2084
|
+
#_(t) {
|
|
2085
|
+
if (!this.#B) return false;
|
|
2070
2086
|
const e = t;
|
|
2071
2087
|
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof Et;
|
|
2072
2088
|
}
|
|
2073
2089
|
async fetch(t, e = {}) {
|
|
2074
2090
|
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;
|
|
2075
|
-
if (!this.#
|
|
2091
|
+
if (!this.#B) {
|
|
2076
2092
|
if (m) m.fetch = "get";
|
|
2077
2093
|
return this.get(t, {
|
|
2078
2094
|
allowStale: s,
|
|
@@ -2097,14 +2113,14 @@ class LRUCache {
|
|
|
2097
2113
|
status: m,
|
|
2098
2114
|
signal: w
|
|
2099
2115
|
};
|
|
2100
|
-
let b = this.#
|
|
2116
|
+
let b = this.#E.get(t);
|
|
2101
2117
|
if (b === undefined) {
|
|
2102
2118
|
if (m) m.fetch = "miss";
|
|
2103
|
-
const e = this.#
|
|
2119
|
+
const e = this.#I(t, b, y, p);
|
|
2104
2120
|
return e.__returned = e;
|
|
2105
2121
|
} else {
|
|
2106
2122
|
const e = this.#T[b];
|
|
2107
|
-
if (this.#
|
|
2123
|
+
if (this.#_(e)) {
|
|
2108
2124
|
const t = s && e.__staleWhileFetching !== undefined;
|
|
2109
2125
|
if (m) {
|
|
2110
2126
|
m.fetch = "inflight";
|
|
@@ -2112,17 +2128,17 @@ class LRUCache {
|
|
|
2112
2128
|
}
|
|
2113
2129
|
return t ? e.__staleWhileFetching : e.__returned = e;
|
|
2114
2130
|
}
|
|
2115
|
-
const n = this
|
|
2131
|
+
const n = this.#$(b);
|
|
2116
2132
|
if (!g && !n) {
|
|
2117
2133
|
if (m) m.fetch = "hit";
|
|
2118
|
-
this.#
|
|
2134
|
+
this.#j(b);
|
|
2119
2135
|
if (i) {
|
|
2120
|
-
this.#
|
|
2136
|
+
this.#J(b);
|
|
2121
2137
|
}
|
|
2122
|
-
if (m) this.#
|
|
2138
|
+
if (m) this.#K(m, b);
|
|
2123
2139
|
return e;
|
|
2124
2140
|
}
|
|
2125
|
-
const r = this.#
|
|
2141
|
+
const r = this.#I(t, b, y, p);
|
|
2126
2142
|
const o = r.__staleWhileFetching !== undefined;
|
|
2127
2143
|
const h = o && s;
|
|
2128
2144
|
if (m) {
|
|
@@ -2132,18 +2148,38 @@ class LRUCache {
|
|
|
2132
2148
|
return h ? r.__staleWhileFetching : r.__returned = r;
|
|
2133
2149
|
}
|
|
2134
2150
|
}
|
|
2151
|
+
async forceFetch(t, e = {}) {
|
|
2152
|
+
const s = await this.fetch(t, e);
|
|
2153
|
+
if (s === undefined) throw new Error("fetch() returned undefined");
|
|
2154
|
+
return s;
|
|
2155
|
+
}
|
|
2156
|
+
memo(t, e = {}) {
|
|
2157
|
+
const s = this.#k;
|
|
2158
|
+
if (!s) {
|
|
2159
|
+
throw new Error("no memoMethod provided to constructor");
|
|
2160
|
+
}
|
|
2161
|
+
const {context: i, forceRefresh: n, ...r} = e;
|
|
2162
|
+
const o = this.get(t, r);
|
|
2163
|
+
if (!n && o !== undefined) return o;
|
|
2164
|
+
const h = s(t, o, {
|
|
2165
|
+
options: r,
|
|
2166
|
+
context: i
|
|
2167
|
+
});
|
|
2168
|
+
this.set(t, h, r);
|
|
2169
|
+
return h;
|
|
2170
|
+
}
|
|
2135
2171
|
get(t, e = {}) {
|
|
2136
2172
|
const {allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: r} = e;
|
|
2137
|
-
const o = this.#
|
|
2173
|
+
const o = this.#E.get(t);
|
|
2138
2174
|
if (o !== undefined) {
|
|
2139
2175
|
const e = this.#T[o];
|
|
2140
|
-
const h = this.#
|
|
2141
|
-
if (r) this.#
|
|
2142
|
-
if (this
|
|
2176
|
+
const h = this.#_(e);
|
|
2177
|
+
if (r) this.#K(r, o);
|
|
2178
|
+
if (this.#$(o)) {
|
|
2143
2179
|
if (r) r.get = "stale";
|
|
2144
2180
|
if (!h) {
|
|
2145
2181
|
if (!n) {
|
|
2146
|
-
this
|
|
2182
|
+
this.#V(t, "expire");
|
|
2147
2183
|
}
|
|
2148
2184
|
if (r && s) r.returnedStale = true;
|
|
2149
2185
|
return s ? e : undefined;
|
|
@@ -2158,9 +2194,9 @@ class LRUCache {
|
|
|
2158
2194
|
if (h) {
|
|
2159
2195
|
return e.__staleWhileFetching;
|
|
2160
2196
|
}
|
|
2161
|
-
this.#
|
|
2197
|
+
this.#j(o);
|
|
2162
2198
|
if (i) {
|
|
2163
|
-
this.#
|
|
2199
|
+
this.#J(o);
|
|
2164
2200
|
}
|
|
2165
2201
|
return e;
|
|
2166
2202
|
}
|
|
@@ -2168,103 +2204,109 @@ class LRUCache {
|
|
|
2168
2204
|
r.get = "miss";
|
|
2169
2205
|
}
|
|
2170
2206
|
}
|
|
2171
|
-
#
|
|
2207
|
+
#st(t, e) {
|
|
2172
2208
|
this.#A[e] = t;
|
|
2173
2209
|
this.#L[t] = e;
|
|
2174
2210
|
}
|
|
2175
|
-
#
|
|
2176
|
-
if (t !== this.#
|
|
2177
|
-
if (t === this.#
|
|
2178
|
-
this.#
|
|
2211
|
+
#j(t) {
|
|
2212
|
+
if (t !== this.#P) {
|
|
2213
|
+
if (t === this.#M) {
|
|
2214
|
+
this.#M = this.#L[t];
|
|
2179
2215
|
} else {
|
|
2180
|
-
this.#
|
|
2216
|
+
this.#st(this.#A[t], this.#L[t]);
|
|
2181
2217
|
}
|
|
2182
|
-
this.#
|
|
2183
|
-
this.#
|
|
2218
|
+
this.#st(this.#P, t);
|
|
2219
|
+
this.#P = t;
|
|
2184
2220
|
}
|
|
2185
2221
|
}
|
|
2186
2222
|
delete(t) {
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2223
|
+
return this.#V(t, "delete");
|
|
2224
|
+
}
|
|
2225
|
+
#V(t, e) {
|
|
2226
|
+
let s = false;
|
|
2227
|
+
if (this.#v !== 0) {
|
|
2228
|
+
const i = this.#E.get(t);
|
|
2229
|
+
if (i !== undefined) {
|
|
2230
|
+
s = true;
|
|
2231
|
+
if (this.#v === 1) {
|
|
2232
|
+
this.#it(e);
|
|
2194
2233
|
} else {
|
|
2195
|
-
this.#
|
|
2196
|
-
const
|
|
2197
|
-
if (this.#
|
|
2198
|
-
|
|
2199
|
-
} else if (this.#
|
|
2200
|
-
if (this.#
|
|
2201
|
-
this.#y?.(
|
|
2234
|
+
this.#Y(i);
|
|
2235
|
+
const s = this.#T[i];
|
|
2236
|
+
if (this.#_(s)) {
|
|
2237
|
+
s.__abortController.abort(new Error("deleted"));
|
|
2238
|
+
} else if (this.#N || this.#W) {
|
|
2239
|
+
if (this.#N) {
|
|
2240
|
+
this.#y?.(s, t, e);
|
|
2202
2241
|
}
|
|
2203
|
-
if (this.#
|
|
2204
|
-
this.#
|
|
2242
|
+
if (this.#W) {
|
|
2243
|
+
this.#R?.push([ s, t, e ]);
|
|
2205
2244
|
}
|
|
2206
2245
|
}
|
|
2207
|
-
this.#
|
|
2208
|
-
this.#
|
|
2209
|
-
this.#T[
|
|
2210
|
-
if (
|
|
2211
|
-
this.#
|
|
2212
|
-
} else if (
|
|
2213
|
-
this.#
|
|
2246
|
+
this.#E.delete(t);
|
|
2247
|
+
this.#C[i] = undefined;
|
|
2248
|
+
this.#T[i] = undefined;
|
|
2249
|
+
if (i === this.#P) {
|
|
2250
|
+
this.#P = this.#A[i];
|
|
2251
|
+
} else if (i === this.#M) {
|
|
2252
|
+
this.#M = this.#L[i];
|
|
2214
2253
|
} else {
|
|
2215
|
-
const t = this.#A[
|
|
2216
|
-
this.#L[t] = this.#L[
|
|
2217
|
-
const e = this.#L[
|
|
2218
|
-
this.#A[e] = this.#A[
|
|
2254
|
+
const t = this.#A[i];
|
|
2255
|
+
this.#L[t] = this.#L[i];
|
|
2256
|
+
const e = this.#L[i];
|
|
2257
|
+
this.#A[e] = this.#A[i];
|
|
2219
2258
|
}
|
|
2220
|
-
this.#
|
|
2221
|
-
this.#
|
|
2259
|
+
this.#v--;
|
|
2260
|
+
this.#F.push(i);
|
|
2222
2261
|
}
|
|
2223
2262
|
}
|
|
2224
2263
|
}
|
|
2225
|
-
if (this.#
|
|
2226
|
-
const t = this.#
|
|
2264
|
+
if (this.#W && this.#R?.length) {
|
|
2265
|
+
const t = this.#R;
|
|
2227
2266
|
let e;
|
|
2228
2267
|
while (e = t?.shift()) {
|
|
2229
2268
|
this.#b?.(...e);
|
|
2230
2269
|
}
|
|
2231
2270
|
}
|
|
2232
|
-
return
|
|
2271
|
+
return s;
|
|
2233
2272
|
}
|
|
2234
2273
|
clear() {
|
|
2235
|
-
|
|
2274
|
+
return this.#it("delete");
|
|
2275
|
+
}
|
|
2276
|
+
#it(t) {
|
|
2277
|
+
for (const e of this.#G({
|
|
2236
2278
|
allowStale: true
|
|
2237
2279
|
})) {
|
|
2238
|
-
const
|
|
2239
|
-
if (this.#
|
|
2240
|
-
|
|
2280
|
+
const s = this.#T[e];
|
|
2281
|
+
if (this.#_(s)) {
|
|
2282
|
+
s.__abortController.abort(new Error("deleted"));
|
|
2241
2283
|
} else {
|
|
2242
|
-
const
|
|
2243
|
-
if (this.#
|
|
2244
|
-
this.#y?.(
|
|
2284
|
+
const i = this.#C[e];
|
|
2285
|
+
if (this.#N) {
|
|
2286
|
+
this.#y?.(s, i, t);
|
|
2245
2287
|
}
|
|
2246
|
-
if (this.#
|
|
2247
|
-
this.#
|
|
2288
|
+
if (this.#W) {
|
|
2289
|
+
this.#R?.push([ s, i, t ]);
|
|
2248
2290
|
}
|
|
2249
2291
|
}
|
|
2250
2292
|
}
|
|
2251
|
-
this.#
|
|
2293
|
+
this.#E.clear();
|
|
2252
2294
|
this.#T.fill(undefined);
|
|
2253
|
-
this.#
|
|
2254
|
-
if (this.#
|
|
2295
|
+
this.#C.fill(undefined);
|
|
2296
|
+
if (this.#D && this.#O) {
|
|
2297
|
+
this.#D.fill(0);
|
|
2255
2298
|
this.#O.fill(0);
|
|
2256
|
-
this.#z.fill(0);
|
|
2257
2299
|
}
|
|
2258
|
-
if (this.#
|
|
2259
|
-
this.#
|
|
2300
|
+
if (this.#z) {
|
|
2301
|
+
this.#z.fill(0);
|
|
2260
2302
|
}
|
|
2261
|
-
this.#
|
|
2262
|
-
this.#
|
|
2263
|
-
this.#
|
|
2303
|
+
this.#M = 0;
|
|
2304
|
+
this.#P = 0;
|
|
2305
|
+
this.#F.length = 0;
|
|
2306
|
+
this.#x = 0;
|
|
2264
2307
|
this.#v = 0;
|
|
2265
|
-
this.#
|
|
2266
|
-
|
|
2267
|
-
const t = this.#M;
|
|
2308
|
+
if (this.#W && this.#R) {
|
|
2309
|
+
const t = this.#R;
|
|
2268
2310
|
let e;
|
|
2269
2311
|
while (e = t?.shift()) {
|
|
2270
2312
|
this.#b?.(...e);
|
|
@@ -2278,7 +2320,7 @@ const Pt = typeof process === "object" && process ? process : {
|
|
|
2278
2320
|
stderr: null
|
|
2279
2321
|
};
|
|
2280
2322
|
|
|
2281
|
-
const
|
|
2323
|
+
const Ft = t => !!t && typeof t === "object" && (t instanceof Minipass || t instanceof g || Rt(t) || zt(t));
|
|
2282
2324
|
|
|
2283
2325
|
const Rt = t => !!t && typeof t === "object" && t instanceof p && typeof t.pipe === "function" && t.pipe !== g.Writable.prototype.pipe;
|
|
2284
2326
|
|
|
@@ -2918,17 +2960,17 @@ class Minipass extends p {
|
|
|
2918
2960
|
return this;
|
|
2919
2961
|
}
|
|
2920
2962
|
static get isStream() {
|
|
2921
|
-
return
|
|
2963
|
+
return Ft;
|
|
2922
2964
|
}
|
|
2923
2965
|
}
|
|
2924
2966
|
|
|
2925
|
-
const ye =
|
|
2967
|
+
const ye = n.native;
|
|
2926
2968
|
|
|
2927
2969
|
const be = {
|
|
2928
|
-
lstatSync:
|
|
2929
|
-
readdir:
|
|
2930
|
-
readdirSync:
|
|
2931
|
-
readlinkSync:
|
|
2970
|
+
lstatSync: r,
|
|
2971
|
+
readdir: o,
|
|
2972
|
+
readdirSync: h,
|
|
2973
|
+
readlinkSync: a,
|
|
2932
2974
|
realpathSync: ye,
|
|
2933
2975
|
promises: {
|
|
2934
2976
|
lstat: c,
|
|
@@ -2938,7 +2980,7 @@ const be = {
|
|
|
2938
2980
|
}
|
|
2939
2981
|
};
|
|
2940
2982
|
|
|
2941
|
-
const Se = t => !t || t === be || t ===
|
|
2983
|
+
const Se = t => !t || t === be || t === l ? be : {
|
|
2942
2984
|
...be,
|
|
2943
2985
|
...t,
|
|
2944
2986
|
promises: {
|
|
@@ -2955,19 +2997,19 @@ const xe = /[\\\/]/;
|
|
|
2955
2997
|
|
|
2956
2998
|
const Ee = 0;
|
|
2957
2999
|
|
|
2958
|
-
const
|
|
3000
|
+
const Ce = 1;
|
|
2959
3001
|
|
|
2960
|
-
const
|
|
3002
|
+
const Te = 2;
|
|
2961
3003
|
|
|
2962
|
-
const
|
|
3004
|
+
const Le = 4;
|
|
2963
3005
|
|
|
2964
|
-
const
|
|
3006
|
+
const Ae = 6;
|
|
2965
3007
|
|
|
2966
|
-
const
|
|
3008
|
+
const Me = 8;
|
|
2967
3009
|
|
|
2968
3010
|
const Pe = 10;
|
|
2969
3011
|
|
|
2970
|
-
const
|
|
3012
|
+
const Fe = 12;
|
|
2971
3013
|
|
|
2972
3014
|
const Re = 15;
|
|
2973
3015
|
|
|
@@ -2989,7 +3031,7 @@ const Ie = Ne | Be | _e;
|
|
|
2989
3031
|
|
|
2990
3032
|
const je = 1023;
|
|
2991
3033
|
|
|
2992
|
-
const Ue = t => t.isFile() ?
|
|
3034
|
+
const Ue = t => t.isFile() ? Me : t.isDirectory() ? Le : t.isSymbolicLink() ? Pe : t.isCharacterDevice() ? Te : t.isBlockDevice() ? Ae : t.isSocket() ? Fe : t.isFIFO() ? Ce : Ee;
|
|
2993
3035
|
|
|
2994
3036
|
const Ge = new Map;
|
|
2995
3037
|
|
|
@@ -3036,117 +3078,121 @@ class PathBase {
|
|
|
3036
3078
|
roots;
|
|
3037
3079
|
parent;
|
|
3038
3080
|
nocase;
|
|
3039
|
-
|
|
3040
|
-
#st;
|
|
3041
|
-
get dev() {
|
|
3042
|
-
return this.#st;
|
|
3043
|
-
}
|
|
3044
|
-
#it;
|
|
3045
|
-
get mode() {
|
|
3046
|
-
return this.#it;
|
|
3047
|
-
}
|
|
3081
|
+
isCWD=false;
|
|
3048
3082
|
#nt;
|
|
3049
|
-
get nlink() {
|
|
3050
|
-
return this.#nt;
|
|
3051
|
-
}
|
|
3052
3083
|
#rt;
|
|
3053
|
-
get
|
|
3084
|
+
get dev() {
|
|
3054
3085
|
return this.#rt;
|
|
3055
3086
|
}
|
|
3056
3087
|
#ot;
|
|
3057
|
-
get
|
|
3088
|
+
get mode() {
|
|
3058
3089
|
return this.#ot;
|
|
3059
3090
|
}
|
|
3060
3091
|
#ht;
|
|
3061
|
-
get
|
|
3092
|
+
get nlink() {
|
|
3062
3093
|
return this.#ht;
|
|
3063
3094
|
}
|
|
3064
3095
|
#at;
|
|
3065
|
-
get
|
|
3096
|
+
get uid() {
|
|
3066
3097
|
return this.#at;
|
|
3067
3098
|
}
|
|
3068
3099
|
#lt;
|
|
3069
|
-
get
|
|
3100
|
+
get gid() {
|
|
3070
3101
|
return this.#lt;
|
|
3071
3102
|
}
|
|
3072
|
-
#k;
|
|
3073
|
-
get size() {
|
|
3074
|
-
return this.#k;
|
|
3075
|
-
}
|
|
3076
3103
|
#ct;
|
|
3077
|
-
get
|
|
3104
|
+
get rdev() {
|
|
3078
3105
|
return this.#ct;
|
|
3079
3106
|
}
|
|
3080
3107
|
#ft;
|
|
3081
|
-
get
|
|
3108
|
+
get blksize() {
|
|
3082
3109
|
return this.#ft;
|
|
3083
3110
|
}
|
|
3084
3111
|
#ut;
|
|
3085
|
-
get
|
|
3112
|
+
get ino() {
|
|
3086
3113
|
return this.#ut;
|
|
3087
3114
|
}
|
|
3115
|
+
#v;
|
|
3116
|
+
get size() {
|
|
3117
|
+
return this.#v;
|
|
3118
|
+
}
|
|
3088
3119
|
#dt;
|
|
3089
|
-
get
|
|
3120
|
+
get blocks() {
|
|
3090
3121
|
return this.#dt;
|
|
3091
3122
|
}
|
|
3092
3123
|
#pt;
|
|
3093
|
-
get
|
|
3124
|
+
get atimeMs() {
|
|
3094
3125
|
return this.#pt;
|
|
3095
3126
|
}
|
|
3096
3127
|
#gt;
|
|
3097
|
-
get
|
|
3128
|
+
get mtimeMs() {
|
|
3098
3129
|
return this.#gt;
|
|
3099
3130
|
}
|
|
3100
3131
|
#mt;
|
|
3101
|
-
get
|
|
3132
|
+
get ctimeMs() {
|
|
3102
3133
|
return this.#mt;
|
|
3103
3134
|
}
|
|
3104
3135
|
#wt;
|
|
3105
|
-
get
|
|
3136
|
+
get birthtimeMs() {
|
|
3106
3137
|
return this.#wt;
|
|
3107
3138
|
}
|
|
3108
3139
|
#yt;
|
|
3109
|
-
get
|
|
3140
|
+
get atime() {
|
|
3110
3141
|
return this.#yt;
|
|
3111
3142
|
}
|
|
3112
3143
|
#bt;
|
|
3144
|
+
get mtime() {
|
|
3145
|
+
return this.#bt;
|
|
3146
|
+
}
|
|
3113
3147
|
#St;
|
|
3148
|
+
get ctime() {
|
|
3149
|
+
return this.#St;
|
|
3150
|
+
}
|
|
3114
3151
|
#kt;
|
|
3152
|
+
get birthtime() {
|
|
3153
|
+
return this.#kt;
|
|
3154
|
+
}
|
|
3115
3155
|
#vt;
|
|
3116
3156
|
#xt;
|
|
3117
3157
|
#Et;
|
|
3158
|
+
#Ct;
|
|
3118
3159
|
#Tt;
|
|
3119
3160
|
#Lt;
|
|
3120
3161
|
#At;
|
|
3121
|
-
#
|
|
3122
|
-
|
|
3162
|
+
#Mt;
|
|
3163
|
+
#Pt;
|
|
3164
|
+
#Ft;
|
|
3165
|
+
get parentPath() {
|
|
3123
3166
|
return (this.parent || this).fullpath();
|
|
3124
3167
|
}
|
|
3168
|
+
get path() {
|
|
3169
|
+
return this.parentPath;
|
|
3170
|
+
}
|
|
3125
3171
|
constructor(t, e = Ee, s, i, n, r, o) {
|
|
3126
3172
|
this.name = t;
|
|
3127
|
-
this.#
|
|
3128
|
-
this.#
|
|
3173
|
+
this.#vt = n ? qe(t) : $e(t);
|
|
3174
|
+
this.#At = e & je;
|
|
3129
3175
|
this.nocase = n;
|
|
3130
3176
|
this.roots = i;
|
|
3131
3177
|
this.root = s || this;
|
|
3132
|
-
this.#
|
|
3133
|
-
this.#
|
|
3134
|
-
this.#
|
|
3135
|
-
this.#
|
|
3178
|
+
this.#Mt = r;
|
|
3179
|
+
this.#Et = o.fullpath;
|
|
3180
|
+
this.#Tt = o.relative;
|
|
3181
|
+
this.#Lt = o.relativePosix;
|
|
3136
3182
|
this.parent = o.parent;
|
|
3137
3183
|
if (this.parent) {
|
|
3138
|
-
this.#
|
|
3184
|
+
this.#nt = this.parent.#nt;
|
|
3139
3185
|
} else {
|
|
3140
|
-
this.#
|
|
3186
|
+
this.#nt = Se(o.fs);
|
|
3141
3187
|
}
|
|
3142
3188
|
}
|
|
3143
3189
|
depth() {
|
|
3144
|
-
if (this.#
|
|
3145
|
-
if (!this.parent) return this.#
|
|
3146
|
-
return this.#
|
|
3190
|
+
if (this.#xt !== undefined) return this.#xt;
|
|
3191
|
+
if (!this.parent) return this.#xt = 0;
|
|
3192
|
+
return this.#xt = this.parent.depth() + 1;
|
|
3147
3193
|
}
|
|
3148
3194
|
childrenCache() {
|
|
3149
|
-
return this.#
|
|
3195
|
+
return this.#Mt;
|
|
3150
3196
|
}
|
|
3151
3197
|
resolve(t) {
|
|
3152
3198
|
if (!t) {
|
|
@@ -3155,10 +3201,10 @@ class PathBase {
|
|
|
3155
3201
|
const e = this.getRootString(t);
|
|
3156
3202
|
const s = t.substring(e.length);
|
|
3157
3203
|
const i = s.split(this.splitSep);
|
|
3158
|
-
const n = e ? this.getRoot(e).#
|
|
3204
|
+
const n = e ? this.getRoot(e).#Rt(i) : this.#Rt(i);
|
|
3159
3205
|
return n;
|
|
3160
3206
|
}
|
|
3161
|
-
#
|
|
3207
|
+
#Rt(t) {
|
|
3162
3208
|
let e = this;
|
|
3163
3209
|
for (const s of t) {
|
|
3164
3210
|
e = e.child(s);
|
|
@@ -3166,15 +3212,15 @@ class PathBase {
|
|
|
3166
3212
|
return e;
|
|
3167
3213
|
}
|
|
3168
3214
|
children() {
|
|
3169
|
-
const t = this.#
|
|
3215
|
+
const t = this.#Mt.get(this);
|
|
3170
3216
|
if (t) {
|
|
3171
3217
|
return t;
|
|
3172
3218
|
}
|
|
3173
3219
|
const e = Object.assign([], {
|
|
3174
3220
|
provisional: 0
|
|
3175
3221
|
});
|
|
3176
|
-
this.#
|
|
3177
|
-
this.#
|
|
3222
|
+
this.#Mt.set(this, e);
|
|
3223
|
+
this.#At &= ~Oe;
|
|
3178
3224
|
return e;
|
|
3179
3225
|
}
|
|
3180
3226
|
child(t, e) {
|
|
@@ -3187,77 +3233,79 @@ class PathBase {
|
|
|
3187
3233
|
const s = this.children();
|
|
3188
3234
|
const i = this.nocase ? qe(t) : $e(t);
|
|
3189
3235
|
for (const t of s) {
|
|
3190
|
-
if (t.#
|
|
3236
|
+
if (t.#vt === i) {
|
|
3191
3237
|
return t;
|
|
3192
3238
|
}
|
|
3193
3239
|
}
|
|
3194
3240
|
const n = this.parent ? this.sep : "";
|
|
3195
|
-
const r = this.#
|
|
3241
|
+
const r = this.#Et ? this.#Et + n + t : undefined;
|
|
3196
3242
|
const o = this.newChild(t, Ee, {
|
|
3197
3243
|
...e,
|
|
3198
3244
|
parent: this,
|
|
3199
3245
|
fullpath: r
|
|
3200
3246
|
});
|
|
3201
3247
|
if (!this.canReaddir()) {
|
|
3202
|
-
o.#
|
|
3248
|
+
o.#At |= Be;
|
|
3203
3249
|
}
|
|
3204
3250
|
s.push(o);
|
|
3205
3251
|
return o;
|
|
3206
3252
|
}
|
|
3207
3253
|
relative() {
|
|
3208
|
-
if (this
|
|
3209
|
-
|
|
3254
|
+
if (this.isCWD) return "";
|
|
3255
|
+
if (this.#Tt !== undefined) {
|
|
3256
|
+
return this.#Tt;
|
|
3210
3257
|
}
|
|
3211
3258
|
const t = this.name;
|
|
3212
3259
|
const e = this.parent;
|
|
3213
3260
|
if (!e) {
|
|
3214
|
-
return this.#
|
|
3261
|
+
return this.#Tt = this.name;
|
|
3215
3262
|
}
|
|
3216
3263
|
const s = e.relative();
|
|
3217
3264
|
return s + (!s || !e.parent ? "" : this.sep) + t;
|
|
3218
3265
|
}
|
|
3219
3266
|
relativePosix() {
|
|
3220
3267
|
if (this.sep === "/") return this.relative();
|
|
3221
|
-
if (this
|
|
3268
|
+
if (this.isCWD) return "";
|
|
3269
|
+
if (this.#Lt !== undefined) return this.#Lt;
|
|
3222
3270
|
const t = this.name;
|
|
3223
3271
|
const e = this.parent;
|
|
3224
3272
|
if (!e) {
|
|
3225
|
-
return this.#
|
|
3273
|
+
return this.#Lt = this.fullpathPosix();
|
|
3226
3274
|
}
|
|
3227
3275
|
const s = e.relativePosix();
|
|
3228
3276
|
return s + (!s || !e.parent ? "" : "/") + t;
|
|
3229
3277
|
}
|
|
3230
3278
|
fullpath() {
|
|
3231
|
-
if (this.#
|
|
3232
|
-
return this.#
|
|
3279
|
+
if (this.#Et !== undefined) {
|
|
3280
|
+
return this.#Et;
|
|
3233
3281
|
}
|
|
3234
3282
|
const t = this.name;
|
|
3235
3283
|
const e = this.parent;
|
|
3236
3284
|
if (!e) {
|
|
3237
|
-
return this.#
|
|
3285
|
+
return this.#Et = this.name;
|
|
3238
3286
|
}
|
|
3239
3287
|
const s = e.fullpath();
|
|
3240
3288
|
const i = s + (!e.parent ? "" : this.sep) + t;
|
|
3241
|
-
return this.#
|
|
3289
|
+
return this.#Et = i;
|
|
3242
3290
|
}
|
|
3243
3291
|
fullpathPosix() {
|
|
3244
|
-
if (this.#
|
|
3245
|
-
if (this.sep === "/") return this.#
|
|
3292
|
+
if (this.#Ct !== undefined) return this.#Ct;
|
|
3293
|
+
if (this.sep === "/") return this.#Ct = this.fullpath();
|
|
3246
3294
|
if (!this.parent) {
|
|
3247
3295
|
const t = this.fullpath().replace(/\\/g, "/");
|
|
3248
3296
|
if (/^[a-z]:\//i.test(t)) {
|
|
3249
|
-
return this.#
|
|
3297
|
+
return this.#Ct = `//?/${t}`;
|
|
3250
3298
|
} else {
|
|
3251
|
-
return this.#
|
|
3299
|
+
return this.#Ct = t;
|
|
3252
3300
|
}
|
|
3253
3301
|
}
|
|
3254
3302
|
const t = this.parent;
|
|
3255
3303
|
const e = t.fullpathPosix();
|
|
3256
3304
|
const s = e + (!e || !t.parent ? "" : "/") + this.name;
|
|
3257
|
-
return this.#
|
|
3305
|
+
return this.#Ct = s;
|
|
3258
3306
|
}
|
|
3259
3307
|
isUnknown() {
|
|
3260
|
-
return (this.#
|
|
3308
|
+
return (this.#At & Re) === Ee;
|
|
3261
3309
|
}
|
|
3262
3310
|
isType(t) {
|
|
3263
3311
|
return this[`is${t}`]();
|
|
@@ -3266,56 +3314,56 @@ class PathBase {
|
|
|
3266
3314
|
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";
|
|
3267
3315
|
}
|
|
3268
3316
|
isFile() {
|
|
3269
|
-
return (this.#
|
|
3317
|
+
return (this.#At & Re) === Me;
|
|
3270
3318
|
}
|
|
3271
3319
|
isDirectory() {
|
|
3272
|
-
return (this.#
|
|
3320
|
+
return (this.#At & Re) === Le;
|
|
3273
3321
|
}
|
|
3274
3322
|
isCharacterDevice() {
|
|
3275
|
-
return (this.#
|
|
3323
|
+
return (this.#At & Re) === Te;
|
|
3276
3324
|
}
|
|
3277
3325
|
isBlockDevice() {
|
|
3278
|
-
return (this.#
|
|
3326
|
+
return (this.#At & Re) === Ae;
|
|
3279
3327
|
}
|
|
3280
3328
|
isFIFO() {
|
|
3281
|
-
return (this.#
|
|
3329
|
+
return (this.#At & Re) === Ce;
|
|
3282
3330
|
}
|
|
3283
3331
|
isSocket() {
|
|
3284
|
-
return (this.#
|
|
3332
|
+
return (this.#At & Re) === Fe;
|
|
3285
3333
|
}
|
|
3286
3334
|
isSymbolicLink() {
|
|
3287
|
-
return (this.#
|
|
3335
|
+
return (this.#At & Pe) === Pe;
|
|
3288
3336
|
}
|
|
3289
3337
|
lstatCached() {
|
|
3290
|
-
return this.#
|
|
3338
|
+
return this.#At & De ? this : undefined;
|
|
3291
3339
|
}
|
|
3292
3340
|
readlinkCached() {
|
|
3293
|
-
return this.#
|
|
3341
|
+
return this.#Pt;
|
|
3294
3342
|
}
|
|
3295
3343
|
realpathCached() {
|
|
3296
|
-
return this.#
|
|
3344
|
+
return this.#Ft;
|
|
3297
3345
|
}
|
|
3298
3346
|
readdirCached() {
|
|
3299
3347
|
const t = this.children();
|
|
3300
3348
|
return t.slice(0, t.provisional);
|
|
3301
3349
|
}
|
|
3302
3350
|
canReadlink() {
|
|
3303
|
-
if (this.#
|
|
3351
|
+
if (this.#Pt) return true;
|
|
3304
3352
|
if (!this.parent) return false;
|
|
3305
|
-
const t = this.#
|
|
3306
|
-
return !(t !== Ee && t !== Pe || this.#
|
|
3353
|
+
const t = this.#At & Re;
|
|
3354
|
+
return !(t !== Ee && t !== Pe || this.#At & We || this.#At & Be);
|
|
3307
3355
|
}
|
|
3308
3356
|
calledReaddir() {
|
|
3309
|
-
return !!(this.#
|
|
3357
|
+
return !!(this.#At & Oe);
|
|
3310
3358
|
}
|
|
3311
3359
|
isENOENT() {
|
|
3312
|
-
return !!(this.#
|
|
3360
|
+
return !!(this.#At & Be);
|
|
3313
3361
|
}
|
|
3314
3362
|
isNamed(t) {
|
|
3315
|
-
return !this.nocase ? this.#
|
|
3363
|
+
return !this.nocase ? this.#vt === $e(t) : this.#vt === qe(t);
|
|
3316
3364
|
}
|
|
3317
3365
|
async readlink() {
|
|
3318
|
-
const t = this.#
|
|
3366
|
+
const t = this.#Pt;
|
|
3319
3367
|
if (t) {
|
|
3320
3368
|
return t;
|
|
3321
3369
|
}
|
|
@@ -3326,18 +3374,18 @@ class PathBase {
|
|
|
3326
3374
|
return undefined;
|
|
3327
3375
|
}
|
|
3328
3376
|
try {
|
|
3329
|
-
const t = await this.#
|
|
3377
|
+
const t = await this.#nt.promises.readlink(this.fullpath());
|
|
3330
3378
|
const e = (await this.parent.realpath())?.resolve(t);
|
|
3331
3379
|
if (e) {
|
|
3332
|
-
return this.#
|
|
3380
|
+
return this.#Pt = e;
|
|
3333
3381
|
}
|
|
3334
3382
|
} catch (t) {
|
|
3335
|
-
this.#
|
|
3383
|
+
this.#zt(t.code);
|
|
3336
3384
|
return undefined;
|
|
3337
3385
|
}
|
|
3338
3386
|
}
|
|
3339
3387
|
readlinkSync() {
|
|
3340
|
-
const t = this.#
|
|
3388
|
+
const t = this.#Pt;
|
|
3341
3389
|
if (t) {
|
|
3342
3390
|
return t;
|
|
3343
3391
|
}
|
|
@@ -3348,104 +3396,104 @@ class PathBase {
|
|
|
3348
3396
|
return undefined;
|
|
3349
3397
|
}
|
|
3350
3398
|
try {
|
|
3351
|
-
const t = this.#
|
|
3399
|
+
const t = this.#nt.readlinkSync(this.fullpath());
|
|
3352
3400
|
const e = this.parent.realpathSync()?.resolve(t);
|
|
3353
3401
|
if (e) {
|
|
3354
|
-
return this.#
|
|
3402
|
+
return this.#Pt = e;
|
|
3355
3403
|
}
|
|
3356
3404
|
} catch (t) {
|
|
3357
|
-
this.#
|
|
3405
|
+
this.#zt(t.code);
|
|
3358
3406
|
return undefined;
|
|
3359
3407
|
}
|
|
3360
3408
|
}
|
|
3361
|
-
#
|
|
3362
|
-
this.#
|
|
3409
|
+
#Ot(t) {
|
|
3410
|
+
this.#At |= Oe;
|
|
3363
3411
|
for (let e = t.provisional; e < t.length; e++) {
|
|
3364
3412
|
const s = t[e];
|
|
3365
|
-
if (s) s.#
|
|
3413
|
+
if (s) s.#Dt();
|
|
3366
3414
|
}
|
|
3367
3415
|
}
|
|
3368
|
-
#
|
|
3369
|
-
if (this.#
|
|
3370
|
-
this.#
|
|
3371
|
-
this.#
|
|
3416
|
+
#Dt() {
|
|
3417
|
+
if (this.#At & Be) return;
|
|
3418
|
+
this.#At = (this.#At | Be) & ze;
|
|
3419
|
+
this.#Nt();
|
|
3372
3420
|
}
|
|
3373
|
-
#
|
|
3421
|
+
#Nt() {
|
|
3374
3422
|
const t = this.children();
|
|
3375
3423
|
t.provisional = 0;
|
|
3376
3424
|
for (const e of t) {
|
|
3377
|
-
e.#
|
|
3425
|
+
e.#Dt();
|
|
3378
3426
|
}
|
|
3379
3427
|
}
|
|
3380
|
-
#
|
|
3381
|
-
this.#
|
|
3382
|
-
this.#
|
|
3428
|
+
#Bt() {
|
|
3429
|
+
this.#At |= _e;
|
|
3430
|
+
this.#Wt();
|
|
3383
3431
|
}
|
|
3384
|
-
#
|
|
3385
|
-
if (this.#
|
|
3386
|
-
let t = this.#
|
|
3387
|
-
if ((t & Re) ===
|
|
3388
|
-
this.#
|
|
3389
|
-
this.#
|
|
3432
|
+
#Wt() {
|
|
3433
|
+
if (this.#At & Ne) return;
|
|
3434
|
+
let t = this.#At;
|
|
3435
|
+
if ((t & Re) === Le) t &= ze;
|
|
3436
|
+
this.#At = t | Ne;
|
|
3437
|
+
this.#Nt();
|
|
3390
3438
|
}
|
|
3391
|
-
#
|
|
3439
|
+
#_t(t = "") {
|
|
3392
3440
|
if (t === "ENOTDIR" || t === "EPERM") {
|
|
3393
|
-
this.#
|
|
3441
|
+
this.#Wt();
|
|
3394
3442
|
} else if (t === "ENOENT") {
|
|
3395
|
-
this.#
|
|
3443
|
+
this.#Dt();
|
|
3396
3444
|
} else {
|
|
3397
3445
|
this.children().provisional = 0;
|
|
3398
3446
|
}
|
|
3399
3447
|
}
|
|
3400
|
-
#
|
|
3448
|
+
#It(t = "") {
|
|
3401
3449
|
if (t === "ENOTDIR") {
|
|
3402
3450
|
const t = this.parent;
|
|
3403
|
-
t.#
|
|
3451
|
+
t.#Wt();
|
|
3404
3452
|
} else if (t === "ENOENT") {
|
|
3405
|
-
this.#
|
|
3453
|
+
this.#Dt();
|
|
3406
3454
|
}
|
|
3407
3455
|
}
|
|
3408
|
-
#
|
|
3409
|
-
let e = this.#
|
|
3456
|
+
#zt(t = "") {
|
|
3457
|
+
let e = this.#At;
|
|
3410
3458
|
e |= We;
|
|
3411
3459
|
if (t === "ENOENT") e |= Be;
|
|
3412
3460
|
if (t === "EINVAL" || t === "UNKNOWN") {
|
|
3413
3461
|
e &= ze;
|
|
3414
3462
|
}
|
|
3415
|
-
this.#
|
|
3463
|
+
this.#At = e;
|
|
3416
3464
|
if (t === "ENOTDIR" && this.parent) {
|
|
3417
|
-
this.parent.#
|
|
3465
|
+
this.parent.#Wt();
|
|
3418
3466
|
}
|
|
3419
3467
|
}
|
|
3420
|
-
#
|
|
3421
|
-
return this.#
|
|
3468
|
+
#jt(t, e) {
|
|
3469
|
+
return this.#Ut(t, e) || this.#Gt(t, e);
|
|
3422
3470
|
}
|
|
3423
|
-
#
|
|
3471
|
+
#Gt(t, e) {
|
|
3424
3472
|
const s = Ue(t);
|
|
3425
3473
|
const i = this.newChild(t.name, s, {
|
|
3426
3474
|
parent: this
|
|
3427
3475
|
});
|
|
3428
|
-
const n = i.#
|
|
3429
|
-
if (n !==
|
|
3430
|
-
i.#
|
|
3476
|
+
const n = i.#At & Re;
|
|
3477
|
+
if (n !== Le && n !== Pe && n !== Ee) {
|
|
3478
|
+
i.#At |= Ne;
|
|
3431
3479
|
}
|
|
3432
3480
|
e.unshift(i);
|
|
3433
3481
|
e.provisional++;
|
|
3434
3482
|
return i;
|
|
3435
3483
|
}
|
|
3436
|
-
#
|
|
3484
|
+
#Ut(t, e) {
|
|
3437
3485
|
for (let s = e.provisional; s < e.length; s++) {
|
|
3438
3486
|
const i = e[s];
|
|
3439
3487
|
const n = this.nocase ? qe(t.name) : $e(t.name);
|
|
3440
|
-
if (n !== i.#
|
|
3488
|
+
if (n !== i.#vt) {
|
|
3441
3489
|
continue;
|
|
3442
3490
|
}
|
|
3443
|
-
return this
|
|
3491
|
+
return this.#$t(t, i, s, e);
|
|
3444
3492
|
}
|
|
3445
3493
|
}
|
|
3446
|
-
|
|
3494
|
+
#$t(t, e, s, i) {
|
|
3447
3495
|
const n = e.name;
|
|
3448
|
-
e.#
|
|
3496
|
+
e.#At = e.#At & ze | Ue(t);
|
|
3449
3497
|
if (n !== t.name) e.name = t.name;
|
|
3450
3498
|
if (s !== i.provisional) {
|
|
3451
3499
|
if (s === i.length - 1) i.pop(); else i.splice(s, 1);
|
|
@@ -3455,57 +3503,57 @@ class PathBase {
|
|
|
3455
3503
|
return e;
|
|
3456
3504
|
}
|
|
3457
3505
|
async lstat() {
|
|
3458
|
-
if ((this.#
|
|
3506
|
+
if ((this.#At & Be) === 0) {
|
|
3459
3507
|
try {
|
|
3460
|
-
this.#
|
|
3508
|
+
this.#Ht(await this.#nt.promises.lstat(this.fullpath()));
|
|
3461
3509
|
return this;
|
|
3462
3510
|
} catch (t) {
|
|
3463
|
-
this.#
|
|
3511
|
+
this.#It(t.code);
|
|
3464
3512
|
}
|
|
3465
3513
|
}
|
|
3466
3514
|
}
|
|
3467
3515
|
lstatSync() {
|
|
3468
|
-
if ((this.#
|
|
3516
|
+
if ((this.#At & Be) === 0) {
|
|
3469
3517
|
try {
|
|
3470
|
-
this.#
|
|
3518
|
+
this.#Ht(this.#nt.lstatSync(this.fullpath()));
|
|
3471
3519
|
return this;
|
|
3472
3520
|
} catch (t) {
|
|
3473
|
-
this.#
|
|
3521
|
+
this.#It(t.code);
|
|
3474
3522
|
}
|
|
3475
3523
|
}
|
|
3476
3524
|
}
|
|
3477
|
-
#
|
|
3525
|
+
#Ht(t) {
|
|
3478
3526
|
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;
|
|
3479
|
-
this.#
|
|
3480
|
-
this.#
|
|
3481
|
-
this.#
|
|
3482
|
-
this.#
|
|
3483
|
-
this.#
|
|
3484
|
-
this.#
|
|
3485
|
-
this.#
|
|
3486
|
-
this.#
|
|
3487
|
-
this.#
|
|
3488
|
-
this.#
|
|
3489
|
-
this.#
|
|
3490
|
-
this.#
|
|
3491
|
-
this.#
|
|
3492
|
-
this.#
|
|
3493
|
-
this.#
|
|
3494
|
-
this.#
|
|
3495
|
-
this.#
|
|
3496
|
-
this.#
|
|
3527
|
+
this.#yt = e;
|
|
3528
|
+
this.#pt = s;
|
|
3529
|
+
this.#kt = i;
|
|
3530
|
+
this.#wt = n;
|
|
3531
|
+
this.#ft = r;
|
|
3532
|
+
this.#dt = o;
|
|
3533
|
+
this.#St = h;
|
|
3534
|
+
this.#mt = a;
|
|
3535
|
+
this.#rt = l;
|
|
3536
|
+
this.#lt = c;
|
|
3537
|
+
this.#ut = f;
|
|
3538
|
+
this.#ot = u;
|
|
3539
|
+
this.#bt = d;
|
|
3540
|
+
this.#gt = p;
|
|
3541
|
+
this.#ht = g;
|
|
3542
|
+
this.#ct = m;
|
|
3543
|
+
this.#v = w;
|
|
3544
|
+
this.#at = y;
|
|
3497
3545
|
const b = Ue(t);
|
|
3498
|
-
this.#
|
|
3499
|
-
if (b !== Ee && b !==
|
|
3500
|
-
this.#
|
|
3546
|
+
this.#At = this.#At & ze | b | De;
|
|
3547
|
+
if (b !== Ee && b !== Le && b !== Pe) {
|
|
3548
|
+
this.#At |= Ne;
|
|
3501
3549
|
}
|
|
3502
3550
|
}
|
|
3503
|
-
#
|
|
3504
|
-
|
|
3505
|
-
#
|
|
3506
|
-
this
|
|
3507
|
-
const e = this.#
|
|
3508
|
-
this.#
|
|
3551
|
+
#qt=[];
|
|
3552
|
+
#Zt=false;
|
|
3553
|
+
#Vt(t) {
|
|
3554
|
+
this.#Zt = false;
|
|
3555
|
+
const e = this.#qt.slice();
|
|
3556
|
+
this.#qt.length = 0;
|
|
3509
3557
|
e.forEach((e => e(null, t)));
|
|
3510
3558
|
}
|
|
3511
3559
|
readdirCB(t, e = false) {
|
|
@@ -3519,29 +3567,29 @@ class PathBase {
|
|
|
3519
3567
|
if (e) t(null, i); else queueMicrotask((() => t(null, i)));
|
|
3520
3568
|
return;
|
|
3521
3569
|
}
|
|
3522
|
-
this.#
|
|
3523
|
-
if (this
|
|
3570
|
+
this.#qt.push(t);
|
|
3571
|
+
if (this.#Zt) {
|
|
3524
3572
|
return;
|
|
3525
3573
|
}
|
|
3526
|
-
this
|
|
3574
|
+
this.#Zt = true;
|
|
3527
3575
|
const i = this.fullpath();
|
|
3528
|
-
this.#
|
|
3576
|
+
this.#nt.readdir(i, {
|
|
3529
3577
|
withFileTypes: true
|
|
3530
3578
|
}, ((t, e) => {
|
|
3531
3579
|
if (t) {
|
|
3532
|
-
this.#
|
|
3580
|
+
this.#_t(t.code);
|
|
3533
3581
|
s.provisional = 0;
|
|
3534
3582
|
} else {
|
|
3535
3583
|
for (const t of e) {
|
|
3536
|
-
this.#
|
|
3584
|
+
this.#jt(t, s);
|
|
3537
3585
|
}
|
|
3538
|
-
this.#
|
|
3586
|
+
this.#Ot(s);
|
|
3539
3587
|
}
|
|
3540
|
-
this.#
|
|
3588
|
+
this.#Vt(s.slice(0, s.provisional));
|
|
3541
3589
|
return;
|
|
3542
3590
|
}));
|
|
3543
3591
|
}
|
|
3544
|
-
#
|
|
3592
|
+
#Jt;
|
|
3545
3593
|
async readdir() {
|
|
3546
3594
|
if (!this.canReaddir()) {
|
|
3547
3595
|
return [];
|
|
@@ -3551,23 +3599,23 @@ class PathBase {
|
|
|
3551
3599
|
return t.slice(0, t.provisional);
|
|
3552
3600
|
}
|
|
3553
3601
|
const e = this.fullpath();
|
|
3554
|
-
if (this.#
|
|
3555
|
-
await this.#
|
|
3602
|
+
if (this.#Jt) {
|
|
3603
|
+
await this.#Jt;
|
|
3556
3604
|
} else {
|
|
3557
3605
|
let s = () => {};
|
|
3558
|
-
this.#
|
|
3606
|
+
this.#Jt = new Promise((t => s = t));
|
|
3559
3607
|
try {
|
|
3560
|
-
for (const s of await this.#
|
|
3608
|
+
for (const s of await this.#nt.promises.readdir(e, {
|
|
3561
3609
|
withFileTypes: true
|
|
3562
3610
|
})) {
|
|
3563
|
-
this.#
|
|
3611
|
+
this.#jt(s, t);
|
|
3564
3612
|
}
|
|
3565
|
-
this.#
|
|
3613
|
+
this.#Ot(t);
|
|
3566
3614
|
} catch (e) {
|
|
3567
|
-
this.#
|
|
3615
|
+
this.#_t(e.code);
|
|
3568
3616
|
t.provisional = 0;
|
|
3569
3617
|
}
|
|
3570
|
-
this.#
|
|
3618
|
+
this.#Jt = undefined;
|
|
3571
3619
|
s();
|
|
3572
3620
|
}
|
|
3573
3621
|
return t.slice(0, t.provisional);
|
|
@@ -3582,65 +3630,67 @@ class PathBase {
|
|
|
3582
3630
|
}
|
|
3583
3631
|
const e = this.fullpath();
|
|
3584
3632
|
try {
|
|
3585
|
-
for (const s of this.#
|
|
3633
|
+
for (const s of this.#nt.readdirSync(e, {
|
|
3586
3634
|
withFileTypes: true
|
|
3587
3635
|
})) {
|
|
3588
|
-
this.#
|
|
3636
|
+
this.#jt(s, t);
|
|
3589
3637
|
}
|
|
3590
|
-
this.#
|
|
3638
|
+
this.#Ot(t);
|
|
3591
3639
|
} catch (e) {
|
|
3592
|
-
this.#
|
|
3640
|
+
this.#_t(e.code);
|
|
3593
3641
|
t.provisional = 0;
|
|
3594
3642
|
}
|
|
3595
3643
|
return t.slice(0, t.provisional);
|
|
3596
3644
|
}
|
|
3597
3645
|
canReaddir() {
|
|
3598
|
-
if (this.#
|
|
3599
|
-
const t = Re & this.#
|
|
3600
|
-
if (!(t === Ee || t ===
|
|
3646
|
+
if (this.#At & Ie) return false;
|
|
3647
|
+
const t = Re & this.#At;
|
|
3648
|
+
if (!(t === Ee || t === Le || t === Pe)) {
|
|
3601
3649
|
return false;
|
|
3602
3650
|
}
|
|
3603
3651
|
return true;
|
|
3604
3652
|
}
|
|
3605
3653
|
shouldWalk(t, e) {
|
|
3606
|
-
return (this.#
|
|
3654
|
+
return (this.#At & Le) === Le && !(this.#At & Ie) && !t.has(this) && (!e || e(this));
|
|
3607
3655
|
}
|
|
3608
3656
|
async realpath() {
|
|
3609
|
-
if (this.#
|
|
3610
|
-
if ((_e | We | Be) & this.#
|
|
3657
|
+
if (this.#Ft) return this.#Ft;
|
|
3658
|
+
if ((_e | We | Be) & this.#At) return undefined;
|
|
3611
3659
|
try {
|
|
3612
|
-
const t = await this.#
|
|
3613
|
-
return this.#
|
|
3660
|
+
const t = await this.#nt.promises.realpath(this.fullpath());
|
|
3661
|
+
return this.#Ft = this.resolve(t);
|
|
3614
3662
|
} catch (t) {
|
|
3615
|
-
this.#
|
|
3663
|
+
this.#Bt();
|
|
3616
3664
|
}
|
|
3617
3665
|
}
|
|
3618
3666
|
realpathSync() {
|
|
3619
|
-
if (this.#
|
|
3620
|
-
if ((_e | We | Be) & this.#
|
|
3667
|
+
if (this.#Ft) return this.#Ft;
|
|
3668
|
+
if ((_e | We | Be) & this.#At) return undefined;
|
|
3621
3669
|
try {
|
|
3622
|
-
const t = this.#
|
|
3623
|
-
return this.#
|
|
3670
|
+
const t = this.#nt.realpathSync(this.fullpath());
|
|
3671
|
+
return this.#Ft = this.resolve(t);
|
|
3624
3672
|
} catch (t) {
|
|
3625
|
-
this.#
|
|
3673
|
+
this.#Bt();
|
|
3626
3674
|
}
|
|
3627
3675
|
}
|
|
3628
3676
|
[Ze](t) {
|
|
3629
3677
|
if (t === this) return;
|
|
3678
|
+
t.isCWD = false;
|
|
3679
|
+
this.isCWD = true;
|
|
3630
3680
|
const e = new Set([]);
|
|
3631
3681
|
let s = [];
|
|
3632
3682
|
let i = this;
|
|
3633
3683
|
while (i && i.parent) {
|
|
3634
3684
|
e.add(i);
|
|
3635
|
-
i.#
|
|
3636
|
-
i.#
|
|
3685
|
+
i.#Tt = s.join(this.sep);
|
|
3686
|
+
i.#Lt = s.join("/");
|
|
3637
3687
|
i = i.parent;
|
|
3638
3688
|
s.push("..");
|
|
3639
3689
|
}
|
|
3640
3690
|
i = t;
|
|
3641
3691
|
while (i && i.parent && !e.has(i)) {
|
|
3642
|
-
i.#
|
|
3643
|
-
i.#
|
|
3692
|
+
i.#Tt = undefined;
|
|
3693
|
+
i.#Lt = undefined;
|
|
3644
3694
|
i = i.parent;
|
|
3645
3695
|
}
|
|
3646
3696
|
}
|
|
@@ -3656,7 +3706,7 @@ class PathWin32 extends PathBase {
|
|
|
3656
3706
|
return new PathWin32(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
|
|
3657
3707
|
}
|
|
3658
3708
|
getRootString(t) {
|
|
3659
|
-
return
|
|
3709
|
+
return s.parse(t).root;
|
|
3660
3710
|
}
|
|
3661
3711
|
getRoot(t) {
|
|
3662
3712
|
t = ve(t.toUpperCase());
|
|
@@ -3698,23 +3748,23 @@ class PathScurryBase {
|
|
|
3698
3748
|
rootPath;
|
|
3699
3749
|
roots;
|
|
3700
3750
|
cwd;
|
|
3701
|
-
#
|
|
3702
|
-
#
|
|
3703
|
-
#
|
|
3751
|
+
#Kt;
|
|
3752
|
+
#Yt;
|
|
3753
|
+
#Mt;
|
|
3704
3754
|
nocase;
|
|
3705
|
-
#
|
|
3706
|
-
constructor(t = process.cwd(),
|
|
3707
|
-
this.#
|
|
3755
|
+
#nt;
|
|
3756
|
+
constructor(t = process.cwd(), s, i, {nocase: n, childrenCacheSize: r = 16 * 1024, fs: o = be} = {}) {
|
|
3757
|
+
this.#nt = Se(o);
|
|
3708
3758
|
if (t instanceof URL || t.startsWith("file://")) {
|
|
3709
|
-
t =
|
|
3759
|
+
t = e(t);
|
|
3710
3760
|
}
|
|
3711
|
-
const h =
|
|
3761
|
+
const h = s.resolve(t);
|
|
3712
3762
|
this.roots = Object.create(null);
|
|
3713
3763
|
this.rootPath = this.parseRootPath(h);
|
|
3714
|
-
this.#
|
|
3715
|
-
this.#
|
|
3716
|
-
this.#
|
|
3717
|
-
const a = h.substring(this.rootPath.length).split(
|
|
3764
|
+
this.#Kt = new ResolveCache;
|
|
3765
|
+
this.#Yt = new ResolveCache;
|
|
3766
|
+
this.#Mt = new ChildrenCache(r);
|
|
3767
|
+
const a = h.substring(this.rootPath.length).split(i);
|
|
3718
3768
|
if (a.length === 1 && !a[0]) {
|
|
3719
3769
|
a.pop();
|
|
3720
3770
|
}
|
|
@@ -3722,11 +3772,11 @@ class PathScurryBase {
|
|
|
3722
3772
|
throw new TypeError("must provide nocase setting to PathScurryBase ctor");
|
|
3723
3773
|
}
|
|
3724
3774
|
this.nocase = n;
|
|
3725
|
-
this.root = this.newRoot(this.#
|
|
3775
|
+
this.root = this.newRoot(this.#nt);
|
|
3726
3776
|
this.roots[this.rootPath] = this.root;
|
|
3727
3777
|
let l = this.root;
|
|
3728
3778
|
let c = a.length - 1;
|
|
3729
|
-
const f =
|
|
3779
|
+
const f = s.sep;
|
|
3730
3780
|
let u = this.rootPath;
|
|
3731
3781
|
let d = false;
|
|
3732
3782
|
for (const t of a) {
|
|
@@ -3747,7 +3797,7 @@ class PathScurryBase {
|
|
|
3747
3797
|
return t.depth();
|
|
3748
3798
|
}
|
|
3749
3799
|
childrenCache() {
|
|
3750
|
-
return this.#
|
|
3800
|
+
return this.#Mt;
|
|
3751
3801
|
}
|
|
3752
3802
|
resolve(...t) {
|
|
3753
3803
|
let e = "";
|
|
@@ -3759,12 +3809,12 @@ class PathScurryBase {
|
|
|
3759
3809
|
break;
|
|
3760
3810
|
}
|
|
3761
3811
|
}
|
|
3762
|
-
const s = this.#
|
|
3812
|
+
const s = this.#Kt.get(e);
|
|
3763
3813
|
if (s !== undefined) {
|
|
3764
3814
|
return s;
|
|
3765
3815
|
}
|
|
3766
3816
|
const i = this.cwd.resolve(e).fullpath();
|
|
3767
|
-
this.#
|
|
3817
|
+
this.#Kt.set(e, i);
|
|
3768
3818
|
return i;
|
|
3769
3819
|
}
|
|
3770
3820
|
resolvePosix(...t) {
|
|
@@ -3777,12 +3827,12 @@ class PathScurryBase {
|
|
|
3777
3827
|
break;
|
|
3778
3828
|
}
|
|
3779
3829
|
}
|
|
3780
|
-
const s = this.#
|
|
3830
|
+
const s = this.#Yt.get(e);
|
|
3781
3831
|
if (s !== undefined) {
|
|
3782
3832
|
return s;
|
|
3783
3833
|
}
|
|
3784
3834
|
const i = this.cwd.resolve(e).fullpathPosix();
|
|
3785
|
-
this.#
|
|
3835
|
+
this.#Yt.set(e, i);
|
|
3786
3836
|
return i;
|
|
3787
3837
|
}
|
|
3788
3838
|
relative(t = this.cwd) {
|
|
@@ -4159,10 +4209,10 @@ class PathScurryBase {
|
|
|
4159
4209
|
|
|
4160
4210
|
class PathScurryWin32 extends PathScurryBase {
|
|
4161
4211
|
sep="\\";
|
|
4162
|
-
constructor(t = process.cwd(),
|
|
4163
|
-
const {nocase: i = true} =
|
|
4164
|
-
super(t,
|
|
4165
|
-
...
|
|
4212
|
+
constructor(t = process.cwd(), e = {}) {
|
|
4213
|
+
const {nocase: i = true} = e;
|
|
4214
|
+
super(t, s, "\\", {
|
|
4215
|
+
...e,
|
|
4166
4216
|
nocase: i
|
|
4167
4217
|
});
|
|
4168
4218
|
this.nocase = i;
|
|
@@ -4171,10 +4221,10 @@ class PathScurryWin32 extends PathScurryBase {
|
|
|
4171
4221
|
}
|
|
4172
4222
|
}
|
|
4173
4223
|
parseRootPath(t) {
|
|
4174
|
-
return
|
|
4224
|
+
return s.parse(t).root.toUpperCase();
|
|
4175
4225
|
}
|
|
4176
4226
|
newRoot(t) {
|
|
4177
|
-
return new PathWin32(this.rootPath,
|
|
4227
|
+
return new PathWin32(this.rootPath, Le, undefined, this.roots, this.nocase, this.childrenCache(), {
|
|
4178
4228
|
fs: t
|
|
4179
4229
|
});
|
|
4180
4230
|
}
|
|
@@ -4186,18 +4236,18 @@ class PathScurryWin32 extends PathScurryBase {
|
|
|
4186
4236
|
class PathScurryPosix extends PathScurryBase {
|
|
4187
4237
|
sep="/";
|
|
4188
4238
|
constructor(t = process.cwd(), e = {}) {
|
|
4189
|
-
const {nocase:
|
|
4190
|
-
super(t,
|
|
4239
|
+
const {nocase: s = false} = e;
|
|
4240
|
+
super(t, i, "/", {
|
|
4191
4241
|
...e,
|
|
4192
|
-
nocase:
|
|
4242
|
+
nocase: s
|
|
4193
4243
|
});
|
|
4194
|
-
this.nocase =
|
|
4244
|
+
this.nocase = s;
|
|
4195
4245
|
}
|
|
4196
4246
|
parseRootPath(t) {
|
|
4197
4247
|
return "/";
|
|
4198
4248
|
}
|
|
4199
4249
|
newRoot(t) {
|
|
4200
|
-
return new PathPosix(this.rootPath,
|
|
4250
|
+
return new PathPosix(this.rootPath, Le, undefined, this.roots, this.nocase, this.childrenCache(), {
|
|
4201
4251
|
fs: t
|
|
4202
4252
|
});
|
|
4203
4253
|
}
|
|
@@ -4225,17 +4275,17 @@ const Ke = t => t.length >= 1;
|
|
|
4225
4275
|
const Ye = t => t.length >= 1;
|
|
4226
4276
|
|
|
4227
4277
|
class Pattern {
|
|
4228
|
-
#Jt;
|
|
4229
|
-
#Kt;
|
|
4230
|
-
#Yt;
|
|
4231
|
-
length;
|
|
4232
4278
|
#Xt;
|
|
4233
4279
|
#Qt;
|
|
4234
4280
|
#te;
|
|
4281
|
+
length;
|
|
4235
4282
|
#ee;
|
|
4236
4283
|
#se;
|
|
4237
4284
|
#ie;
|
|
4238
|
-
#ne
|
|
4285
|
+
#ne;
|
|
4286
|
+
#re;
|
|
4287
|
+
#oe;
|
|
4288
|
+
#he=true;
|
|
4239
4289
|
constructor(t, e, s, i) {
|
|
4240
4290
|
if (!Ke(t)) {
|
|
4241
4291
|
throw new TypeError("empty pattern list");
|
|
@@ -4250,87 +4300,87 @@ class Pattern {
|
|
|
4250
4300
|
if (s < 0 || s >= this.length) {
|
|
4251
4301
|
throw new TypeError("index out of range");
|
|
4252
4302
|
}
|
|
4253
|
-
this.#
|
|
4254
|
-
this.#
|
|
4255
|
-
this.#
|
|
4256
|
-
this.#
|
|
4257
|
-
if (this.#
|
|
4303
|
+
this.#Xt = t;
|
|
4304
|
+
this.#Qt = e;
|
|
4305
|
+
this.#te = s;
|
|
4306
|
+
this.#ee = i;
|
|
4307
|
+
if (this.#te === 0) {
|
|
4258
4308
|
if (this.isUNC()) {
|
|
4259
|
-
const [t, e, s, i, ...n] = this.#
|
|
4260
|
-
const [r, o, h, a, ...l] = this.#
|
|
4309
|
+
const [t, e, s, i, ...n] = this.#Xt;
|
|
4310
|
+
const [r, o, h, a, ...l] = this.#Qt;
|
|
4261
4311
|
if (n[0] === "") {
|
|
4262
4312
|
n.shift();
|
|
4263
4313
|
l.shift();
|
|
4264
4314
|
}
|
|
4265
4315
|
const c = [ t, e, s, i, "" ].join("/");
|
|
4266
4316
|
const f = [ r, o, h, a, "" ].join("/");
|
|
4267
|
-
this.#
|
|
4268
|
-
this.#
|
|
4269
|
-
this.length = this.#
|
|
4317
|
+
this.#Xt = [ c, ...n ];
|
|
4318
|
+
this.#Qt = [ f, ...l ];
|
|
4319
|
+
this.length = this.#Xt.length;
|
|
4270
4320
|
} else if (this.isDrive() || this.isAbsolute()) {
|
|
4271
|
-
const [t, ...e] = this.#
|
|
4272
|
-
const [s, ...i] = this.#
|
|
4321
|
+
const [t, ...e] = this.#Xt;
|
|
4322
|
+
const [s, ...i] = this.#Qt;
|
|
4273
4323
|
if (e[0] === "") {
|
|
4274
4324
|
e.shift();
|
|
4275
4325
|
i.shift();
|
|
4276
4326
|
}
|
|
4277
4327
|
const n = t + "/";
|
|
4278
4328
|
const r = s + "/";
|
|
4279
|
-
this.#
|
|
4280
|
-
this.#
|
|
4281
|
-
this.length = this.#
|
|
4329
|
+
this.#Xt = [ n, ...e ];
|
|
4330
|
+
this.#Qt = [ r, ...i ];
|
|
4331
|
+
this.length = this.#Xt.length;
|
|
4282
4332
|
}
|
|
4283
4333
|
}
|
|
4284
4334
|
}
|
|
4285
4335
|
pattern() {
|
|
4286
|
-
return this.#
|
|
4336
|
+
return this.#Xt[this.#te];
|
|
4287
4337
|
}
|
|
4288
4338
|
isString() {
|
|
4289
|
-
return typeof this.#
|
|
4339
|
+
return typeof this.#Xt[this.#te] === "string";
|
|
4290
4340
|
}
|
|
4291
4341
|
isGlobstar() {
|
|
4292
|
-
return this.#
|
|
4342
|
+
return this.#Xt[this.#te] === ht;
|
|
4293
4343
|
}
|
|
4294
4344
|
isRegExp() {
|
|
4295
|
-
return this.#
|
|
4345
|
+
return this.#Xt[this.#te] instanceof RegExp;
|
|
4296
4346
|
}
|
|
4297
4347
|
globString() {
|
|
4298
|
-
return this.#
|
|
4348
|
+
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("/"));
|
|
4299
4349
|
}
|
|
4300
4350
|
hasMore() {
|
|
4301
|
-
return this.length > this.#
|
|
4351
|
+
return this.length > this.#te + 1;
|
|
4302
4352
|
}
|
|
4303
4353
|
rest() {
|
|
4304
|
-
if (this.#
|
|
4305
|
-
if (!this.hasMore()) return this.#
|
|
4306
|
-
this.#
|
|
4307
|
-
this.#
|
|
4308
|
-
this.#
|
|
4309
|
-
this.#
|
|
4310
|
-
return this.#
|
|
4354
|
+
if (this.#se !== undefined) return this.#se;
|
|
4355
|
+
if (!this.hasMore()) return this.#se = null;
|
|
4356
|
+
this.#se = new Pattern(this.#Xt, this.#Qt, this.#te + 1, this.#ee);
|
|
4357
|
+
this.#se.#oe = this.#oe;
|
|
4358
|
+
this.#se.#re = this.#re;
|
|
4359
|
+
this.#se.#ne = this.#ne;
|
|
4360
|
+
return this.#se;
|
|
4311
4361
|
}
|
|
4312
4362
|
isUNC() {
|
|
4313
|
-
const t = this.#
|
|
4314
|
-
return this.#
|
|
4363
|
+
const t = this.#Xt;
|
|
4364
|
+
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];
|
|
4315
4365
|
}
|
|
4316
4366
|
isDrive() {
|
|
4317
|
-
const t = this.#
|
|
4318
|
-
return this.#
|
|
4367
|
+
const t = this.#Xt;
|
|
4368
|
+
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]);
|
|
4319
4369
|
}
|
|
4320
4370
|
isAbsolute() {
|
|
4321
|
-
const t = this.#
|
|
4322
|
-
return this.#
|
|
4371
|
+
const t = this.#Xt;
|
|
4372
|
+
return this.#oe !== undefined ? this.#oe : this.#oe = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
|
|
4323
4373
|
}
|
|
4324
4374
|
root() {
|
|
4325
|
-
const t = this.#
|
|
4326
|
-
return typeof t === "string" && this.isAbsolute() && this.#
|
|
4375
|
+
const t = this.#Xt[0];
|
|
4376
|
+
return typeof t === "string" && this.isAbsolute() && this.#te === 0 ? t : "";
|
|
4327
4377
|
}
|
|
4328
4378
|
checkFollowGlobstar() {
|
|
4329
|
-
return !(this.#
|
|
4379
|
+
return !(this.#te === 0 || !this.isGlobstar() || !this.#he);
|
|
4330
4380
|
}
|
|
4331
4381
|
markFollowGlobstar() {
|
|
4332
|
-
if (this.#
|
|
4333
|
-
this.#
|
|
4382
|
+
if (this.#te === 0 || !this.isGlobstar() || !this.#he) return false;
|
|
4383
|
+
this.#he = false;
|
|
4334
4384
|
return true;
|
|
4335
4385
|
}
|
|
4336
4386
|
}
|
|
@@ -4342,12 +4392,15 @@ class Ignore {
|
|
|
4342
4392
|
relativeChildren;
|
|
4343
4393
|
absolute;
|
|
4344
4394
|
absoluteChildren;
|
|
4395
|
+
platform;
|
|
4396
|
+
mmopts;
|
|
4345
4397
|
constructor(t, {nobrace: e, nocase: s, noext: i, noglobstar: n, platform: r = Xe}) {
|
|
4346
4398
|
this.relative = [];
|
|
4347
4399
|
this.absolute = [];
|
|
4348
4400
|
this.relativeChildren = [];
|
|
4349
4401
|
this.absoluteChildren = [];
|
|
4350
|
-
|
|
4402
|
+
this.platform = r;
|
|
4403
|
+
this.mmopts = {
|
|
4351
4404
|
dot: true,
|
|
4352
4405
|
nobrace: e,
|
|
4353
4406
|
nocase: s,
|
|
@@ -4358,26 +4411,27 @@ class Ignore {
|
|
|
4358
4411
|
nocomment: true,
|
|
4359
4412
|
nonegate: true
|
|
4360
4413
|
};
|
|
4361
|
-
for (const e of t)
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4414
|
+
for (const e of t) this.add(e);
|
|
4415
|
+
}
|
|
4416
|
+
add(t) {
|
|
4417
|
+
const e = new Minimatch(t, this.mmopts);
|
|
4418
|
+
for (let t = 0; t < e.set.length; t++) {
|
|
4419
|
+
const s = e.set[t];
|
|
4420
|
+
const i = e.globParts[t];
|
|
4421
|
+
if (!s || !i) {
|
|
4422
|
+
throw new Error("invalid pattern object");
|
|
4423
|
+
}
|
|
4424
|
+
while (s[0] === "." && i[0] === ".") {
|
|
4425
|
+
s.shift();
|
|
4426
|
+
i.shift();
|
|
4427
|
+
}
|
|
4428
|
+
const n = new Pattern(s, i, 0, this.platform);
|
|
4429
|
+
const r = new Minimatch(n.globString(), this.mmopts);
|
|
4430
|
+
const o = i[i.length - 1] === "**";
|
|
4431
|
+
const h = n.isAbsolute();
|
|
4432
|
+
if (h) this.absolute.push(r); else this.relative.push(r);
|
|
4433
|
+
if (o) {
|
|
4434
|
+
if (h) this.absoluteChildren.push(r); else this.relativeChildren.push(r);
|
|
4381
4435
|
}
|
|
4382
4436
|
}
|
|
4383
4437
|
}
|
|
@@ -4619,32 +4673,38 @@ class GlobUtil {
|
|
|
4619
4673
|
seen=new Set;
|
|
4620
4674
|
paused=false;
|
|
4621
4675
|
aborted=false;
|
|
4622
|
-
#
|
|
4623
|
-
#
|
|
4624
|
-
#
|
|
4676
|
+
#ae=[];
|
|
4677
|
+
#le;
|
|
4678
|
+
#ce;
|
|
4625
4679
|
signal;
|
|
4626
4680
|
maxDepth;
|
|
4681
|
+
includeChildMatches;
|
|
4627
4682
|
constructor(t, e, s) {
|
|
4628
4683
|
this.patterns = t;
|
|
4629
4684
|
this.path = e;
|
|
4630
4685
|
this.opts = s;
|
|
4631
|
-
this.#
|
|
4632
|
-
|
|
4633
|
-
|
|
4686
|
+
this.#ce = !s.posix && s.platform === "win32" ? "\\" : "/";
|
|
4687
|
+
this.includeChildMatches = s.includeChildMatches !== false;
|
|
4688
|
+
if (s.ignore || !this.includeChildMatches) {
|
|
4689
|
+
this.#le = Qe(s.ignore ?? [], s);
|
|
4690
|
+
if (!this.includeChildMatches && typeof this.#le.add !== "function") {
|
|
4691
|
+
const t = "cannot ignore child matches, ignore lacks add() method.";
|
|
4692
|
+
throw new Error(t);
|
|
4693
|
+
}
|
|
4634
4694
|
}
|
|
4635
4695
|
this.maxDepth = s.maxDepth || Infinity;
|
|
4636
4696
|
if (s.signal) {
|
|
4637
4697
|
this.signal = s.signal;
|
|
4638
4698
|
this.signal.addEventListener("abort", (() => {
|
|
4639
|
-
this.#
|
|
4699
|
+
this.#ae.length = 0;
|
|
4640
4700
|
}));
|
|
4641
4701
|
}
|
|
4642
4702
|
}
|
|
4643
|
-
#
|
|
4644
|
-
return this.seen.has(t) || !!this.#
|
|
4703
|
+
#fe(t) {
|
|
4704
|
+
return this.seen.has(t) || !!this.#le?.ignored?.(t);
|
|
4645
4705
|
}
|
|
4646
|
-
#
|
|
4647
|
-
return !!this.#
|
|
4706
|
+
#ue(t) {
|
|
4707
|
+
return !!this.#le?.childrenIgnored?.(t);
|
|
4648
4708
|
}
|
|
4649
4709
|
pause() {
|
|
4650
4710
|
this.paused = true;
|
|
@@ -4653,7 +4713,7 @@ class GlobUtil {
|
|
|
4653
4713
|
if (this.signal?.aborted) return;
|
|
4654
4714
|
this.paused = false;
|
|
4655
4715
|
let t = undefined;
|
|
4656
|
-
while (!this.paused && (t = this.#
|
|
4716
|
+
while (!this.paused && (t = this.#ae.shift())) {
|
|
4657
4717
|
t();
|
|
4658
4718
|
}
|
|
4659
4719
|
}
|
|
@@ -4662,7 +4722,7 @@ class GlobUtil {
|
|
|
4662
4722
|
if (!this.paused) {
|
|
4663
4723
|
t();
|
|
4664
4724
|
} else {
|
|
4665
|
-
this.#
|
|
4725
|
+
this.#ae.push(t);
|
|
4666
4726
|
}
|
|
4667
4727
|
}
|
|
4668
4728
|
async matchCheck(t, e) {
|
|
@@ -4684,7 +4744,7 @@ class GlobUtil {
|
|
|
4684
4744
|
return this.matchCheckTest(n, e);
|
|
4685
4745
|
}
|
|
4686
4746
|
matchCheckTest(t, e) {
|
|
4687
|
-
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.#
|
|
4747
|
+
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;
|
|
4688
4748
|
}
|
|
4689
4749
|
matchCheckSync(t, e) {
|
|
4690
4750
|
if (e && this.opts.nodir) return undefined;
|
|
@@ -4705,10 +4765,14 @@ class GlobUtil {
|
|
|
4705
4765
|
return this.matchCheckTest(n, e);
|
|
4706
4766
|
}
|
|
4707
4767
|
matchFinish(t, e) {
|
|
4708
|
-
if (this.#
|
|
4768
|
+
if (this.#fe(t)) return;
|
|
4769
|
+
if (!this.includeChildMatches && this.#le?.add) {
|
|
4770
|
+
const e = `${t.relativePosix()}/**`;
|
|
4771
|
+
this.#le.add(e);
|
|
4772
|
+
}
|
|
4709
4773
|
const s = this.opts.absolute === undefined ? e : this.opts.absolute;
|
|
4710
4774
|
this.seen.add(t);
|
|
4711
|
-
const i = this.opts.mark && t.isDirectory() ? this.#
|
|
4775
|
+
const i = this.opts.mark && t.isDirectory() ? this.#ce : "";
|
|
4712
4776
|
if (this.opts.withFileTypes) {
|
|
4713
4777
|
this.matchEmit(t);
|
|
4714
4778
|
} else if (s) {
|
|
@@ -4716,7 +4780,7 @@ class GlobUtil {
|
|
|
4716
4780
|
this.matchEmit(e + i);
|
|
4717
4781
|
} else {
|
|
4718
4782
|
const e = this.opts.posix ? t.relativePosix() : t.relative();
|
|
4719
|
-
const s = this.opts.dotRelative && !e.startsWith(".." + this.#
|
|
4783
|
+
const s = this.opts.dotRelative && !e.startsWith(".." + this.#ce) ? "." + this.#ce : "";
|
|
4720
4784
|
this.matchEmit(!e ? "." + i : s + e + i);
|
|
4721
4785
|
}
|
|
4722
4786
|
}
|
|
@@ -4733,7 +4797,7 @@ class GlobUtil {
|
|
|
4733
4797
|
this.walkCB2(t, e, new Processor(this.opts), s);
|
|
4734
4798
|
}
|
|
4735
4799
|
walkCB2(t, e, s, i) {
|
|
4736
|
-
if (this.#
|
|
4800
|
+
if (this.#ue(t)) return i();
|
|
4737
4801
|
if (this.signal?.aborted) i();
|
|
4738
4802
|
if (this.paused) {
|
|
4739
4803
|
this.onResume((() => this.walkCB2(t, e, s, i)));
|
|
@@ -4745,7 +4809,7 @@ class GlobUtil {
|
|
|
4745
4809
|
if (--n === 0) i();
|
|
4746
4810
|
};
|
|
4747
4811
|
for (const [t, e, i] of s.matches.entries()) {
|
|
4748
|
-
if (this.#
|
|
4812
|
+
if (this.#fe(t)) continue;
|
|
4749
4813
|
n++;
|
|
4750
4814
|
this.match(t, e, i).then((() => r()));
|
|
4751
4815
|
}
|
|
@@ -4768,7 +4832,7 @@ class GlobUtil {
|
|
|
4768
4832
|
if (--n === 0) i();
|
|
4769
4833
|
};
|
|
4770
4834
|
for (const [t, e, i] of s.matches.entries()) {
|
|
4771
|
-
if (this.#
|
|
4835
|
+
if (this.#fe(t)) continue;
|
|
4772
4836
|
n++;
|
|
4773
4837
|
this.match(t, e, i).then((() => r()));
|
|
4774
4838
|
}
|
|
@@ -4783,7 +4847,7 @@ class GlobUtil {
|
|
|
4783
4847
|
this.walkCB2Sync(t, e, new Processor(this.opts), s);
|
|
4784
4848
|
}
|
|
4785
4849
|
walkCB2Sync(t, e, s, i) {
|
|
4786
|
-
if (this.#
|
|
4850
|
+
if (this.#ue(t)) return i();
|
|
4787
4851
|
if (this.signal?.aborted) i();
|
|
4788
4852
|
if (this.paused) {
|
|
4789
4853
|
this.onResume((() => this.walkCB2Sync(t, e, s, i)));
|
|
@@ -4795,7 +4859,7 @@ class GlobUtil {
|
|
|
4795
4859
|
if (--n === 0) i();
|
|
4796
4860
|
};
|
|
4797
4861
|
for (const [t, e, i] of s.matches.entries()) {
|
|
4798
|
-
if (this.#
|
|
4862
|
+
if (this.#fe(t)) continue;
|
|
4799
4863
|
this.matchSync(t, e, i);
|
|
4800
4864
|
}
|
|
4801
4865
|
for (const t of s.subwalkTargets()) {
|
|
@@ -4815,7 +4879,7 @@ class GlobUtil {
|
|
|
4815
4879
|
if (--n === 0) i();
|
|
4816
4880
|
};
|
|
4817
4881
|
for (const [t, e, i] of s.matches.entries()) {
|
|
4818
|
-
if (this.#
|
|
4882
|
+
if (this.#fe(t)) continue;
|
|
4819
4883
|
this.matchSync(t, e, i);
|
|
4820
4884
|
}
|
|
4821
4885
|
for (const [t, e] of s.subwalks.entries()) {
|
|
@@ -4827,10 +4891,9 @@ class GlobUtil {
|
|
|
4827
4891
|
}
|
|
4828
4892
|
|
|
4829
4893
|
class GlobWalker extends GlobUtil {
|
|
4830
|
-
matches;
|
|
4894
|
+
matches=new Set;
|
|
4831
4895
|
constructor(t, e, s) {
|
|
4832
4896
|
super(t, e, s);
|
|
4833
|
-
this.matches = new Set;
|
|
4834
4897
|
}
|
|
4835
4898
|
matchEmit(t) {
|
|
4836
4899
|
this.matches.add(t);
|
|
@@ -4925,77 +4988,79 @@ let es = class Glob {
|
|
|
4925
4988
|
signal;
|
|
4926
4989
|
windowsPathsNoEscape;
|
|
4927
4990
|
withFileTypes;
|
|
4991
|
+
includeChildMatches;
|
|
4928
4992
|
opts;
|
|
4929
4993
|
patterns;
|
|
4930
|
-
constructor(t,
|
|
4931
|
-
if (!
|
|
4932
|
-
this.withFileTypes = !!
|
|
4933
|
-
this.signal =
|
|
4934
|
-
this.follow = !!
|
|
4935
|
-
this.dot = !!
|
|
4936
|
-
this.dotRelative = !!
|
|
4937
|
-
this.nodir = !!
|
|
4938
|
-
this.mark = !!
|
|
4939
|
-
if (!
|
|
4994
|
+
constructor(t, s) {
|
|
4995
|
+
if (!s) throw new TypeError("glob options required");
|
|
4996
|
+
this.withFileTypes = !!s.withFileTypes;
|
|
4997
|
+
this.signal = s.signal;
|
|
4998
|
+
this.follow = !!s.follow;
|
|
4999
|
+
this.dot = !!s.dot;
|
|
5000
|
+
this.dotRelative = !!s.dotRelative;
|
|
5001
|
+
this.nodir = !!s.nodir;
|
|
5002
|
+
this.mark = !!s.mark;
|
|
5003
|
+
if (!s.cwd) {
|
|
4940
5004
|
this.cwd = "";
|
|
4941
|
-
} else if (
|
|
4942
|
-
|
|
4943
|
-
}
|
|
4944
|
-
this.cwd =
|
|
4945
|
-
this.root =
|
|
4946
|
-
this.magicalBraces = !!
|
|
4947
|
-
this.nobrace = !!
|
|
4948
|
-
this.noext = !!
|
|
4949
|
-
this.realpath = !!
|
|
4950
|
-
this.absolute =
|
|
4951
|
-
this.
|
|
4952
|
-
this.
|
|
4953
|
-
this.
|
|
4954
|
-
this.
|
|
4955
|
-
this.
|
|
5005
|
+
} else if (s.cwd instanceof URL || s.cwd.startsWith("file://")) {
|
|
5006
|
+
s.cwd = e(s.cwd);
|
|
5007
|
+
}
|
|
5008
|
+
this.cwd = s.cwd || "";
|
|
5009
|
+
this.root = s.root;
|
|
5010
|
+
this.magicalBraces = !!s.magicalBraces;
|
|
5011
|
+
this.nobrace = !!s.nobrace;
|
|
5012
|
+
this.noext = !!s.noext;
|
|
5013
|
+
this.realpath = !!s.realpath;
|
|
5014
|
+
this.absolute = s.absolute;
|
|
5015
|
+
this.includeChildMatches = s.includeChildMatches !== false;
|
|
5016
|
+
this.noglobstar = !!s.noglobstar;
|
|
5017
|
+
this.matchBase = !!s.matchBase;
|
|
5018
|
+
this.maxDepth = typeof s.maxDepth === "number" ? s.maxDepth : Infinity;
|
|
5019
|
+
this.stat = !!s.stat;
|
|
5020
|
+
this.ignore = s.ignore;
|
|
4956
5021
|
if (this.withFileTypes && this.absolute !== undefined) {
|
|
4957
5022
|
throw new Error("cannot set absolute and withFileTypes:true");
|
|
4958
5023
|
}
|
|
4959
5024
|
if (typeof t === "string") {
|
|
4960
5025
|
t = [ t ];
|
|
4961
5026
|
}
|
|
4962
|
-
this.windowsPathsNoEscape = !!
|
|
5027
|
+
this.windowsPathsNoEscape = !!s.windowsPathsNoEscape || s.allowWindowsEscape === false;
|
|
4963
5028
|
if (this.windowsPathsNoEscape) {
|
|
4964
5029
|
t = t.map((t => t.replace(/\\/g, "/")));
|
|
4965
5030
|
}
|
|
4966
5031
|
if (this.matchBase) {
|
|
4967
|
-
if (
|
|
5032
|
+
if (s.noglobstar) {
|
|
4968
5033
|
throw new TypeError("base matching requires globstar");
|
|
4969
5034
|
}
|
|
4970
5035
|
t = t.map((t => t.includes("/") ? t : `./**/${t}`));
|
|
4971
5036
|
}
|
|
4972
5037
|
this.pattern = t;
|
|
4973
|
-
this.platform =
|
|
5038
|
+
this.platform = s.platform || ts;
|
|
4974
5039
|
this.opts = {
|
|
4975
|
-
...
|
|
5040
|
+
...s,
|
|
4976
5041
|
platform: this.platform
|
|
4977
5042
|
};
|
|
4978
|
-
if (
|
|
4979
|
-
this.scurry =
|
|
4980
|
-
if (
|
|
5043
|
+
if (s.scurry) {
|
|
5044
|
+
this.scurry = s.scurry;
|
|
5045
|
+
if (s.nocase !== undefined && s.nocase !== s.scurry.nocase) {
|
|
4981
5046
|
throw new Error("nocase option contradicts provided scurry option");
|
|
4982
5047
|
}
|
|
4983
5048
|
} else {
|
|
4984
|
-
const t =
|
|
5049
|
+
const t = s.platform === "win32" ? PathScurryWin32 : s.platform === "darwin" ? PathScurryDarwin : s.platform ? PathScurryPosix : Je;
|
|
4985
5050
|
this.scurry = new t(this.cwd, {
|
|
4986
|
-
nocase:
|
|
4987
|
-
fs:
|
|
5051
|
+
nocase: s.nocase,
|
|
5052
|
+
fs: s.fs
|
|
4988
5053
|
});
|
|
4989
5054
|
}
|
|
4990
5055
|
this.nocase = this.scurry.nocase;
|
|
4991
|
-
const
|
|
5056
|
+
const i = this.platform === "darwin" || this.platform === "win32";
|
|
4992
5057
|
const n = {
|
|
4993
|
-
...
|
|
5058
|
+
...s,
|
|
4994
5059
|
dot: this.dot,
|
|
4995
5060
|
matchBase: this.matchBase,
|
|
4996
5061
|
nobrace: this.nobrace,
|
|
4997
5062
|
nocase: this.nocase,
|
|
4998
|
-
nocaseMagicOnly:
|
|
5063
|
+
nocaseMagicOnly: i,
|
|
4999
5064
|
nocomment: true,
|
|
5000
5065
|
noext: this.noext,
|
|
5001
5066
|
nonegate: true,
|
|
@@ -5021,7 +5086,8 @@ let es = class Glob {
|
|
|
5021
5086
|
...this.opts,
|
|
5022
5087
|
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
5023
5088
|
platform: this.platform,
|
|
5024
|
-
nocase: this.nocase
|
|
5089
|
+
nocase: this.nocase,
|
|
5090
|
+
includeChildMatches: this.includeChildMatches
|
|
5025
5091
|
}).walk() ];
|
|
5026
5092
|
}
|
|
5027
5093
|
walkSync() {
|
|
@@ -5029,7 +5095,8 @@ let es = class Glob {
|
|
|
5029
5095
|
...this.opts,
|
|
5030
5096
|
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
5031
5097
|
platform: this.platform,
|
|
5032
|
-
nocase: this.nocase
|
|
5098
|
+
nocase: this.nocase,
|
|
5099
|
+
includeChildMatches: this.includeChildMatches
|
|
5033
5100
|
}).walkSync() ];
|
|
5034
5101
|
}
|
|
5035
5102
|
stream() {
|
|
@@ -5037,7 +5104,8 @@ let es = class Glob {
|
|
|
5037
5104
|
...this.opts,
|
|
5038
5105
|
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
5039
5106
|
platform: this.platform,
|
|
5040
|
-
nocase: this.nocase
|
|
5107
|
+
nocase: this.nocase,
|
|
5108
|
+
includeChildMatches: this.includeChildMatches
|
|
5041
5109
|
}).stream();
|
|
5042
5110
|
}
|
|
5043
5111
|
streamSync() {
|
|
@@ -5045,7 +5113,8 @@ let es = class Glob {
|
|
|
5045
5113
|
...this.opts,
|
|
5046
5114
|
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
5047
5115
|
platform: this.platform,
|
|
5048
|
-
nocase: this.nocase
|
|
5116
|
+
nocase: this.nocase,
|
|
5117
|
+
includeChildMatches: this.includeChildMatches
|
|
5049
5118
|
}).streamSync();
|
|
5050
5119
|
}
|
|
5051
5120
|
iterateSync() {
|