generated from atls-lab/template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pnp.loader.mjs
7030 lines (6896 loc) · 249 KB
/
.pnp.loader.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import fs$1 from 'node:fs';
import { fileURLToPath as fileURLToPath$1, pathToFileURL as pathToFileURL$1 } from 'node:url';
import fs from 'fs';
import path$1 from 'path';
import require$$1 from 'util';
import require$$1$1 from 'events';
import require$$0$1, { createHash } from 'crypto';
import require$$1$2, { EOL } from 'os';
import require$$1$3 from 'buffer';
import require$$2, { fileURLToPath, pathToFileURL } from 'url';
import require$$0$2 from 'readline';
import { createRequire } from 'node:module';
import { extname } from 'node:path';
import esmModule, { createRequire as createRequire$1, isBuiltin } from 'module';
import assert from 'assert';
const [major, minor] = process.versions.node.split(`.`).map((value) => parseInt(value, 10));
const WATCH_MODE_MESSAGE_USES_ARRAYS = major > 19 || major === 19 && minor >= 2 || major === 18 && minor >= 13;
const SUPPORTS_IMPORT_ATTRIBUTES = major >= 21 || major === 20 && minor >= 10 || major === 18 && minor >= 20;
const SUPPORTS_IMPORT_ATTRIBUTES_ONLY = major >= 22;
const PortablePath = {
root: `/`,
dot: `.`,
parent: `..`
};
const npath = Object.create(path$1);
const ppath = Object.create(path$1.posix);
npath.cwd = () => process.cwd();
ppath.cwd = process.platform === `win32` ? () => toPortablePath(process.cwd()) : process.cwd;
if (process.platform === `win32`) {
ppath.resolve = (...segments) => {
if (segments.length > 0 && ppath.isAbsolute(segments[0])) {
return path$1.posix.resolve(...segments);
} else {
return path$1.posix.resolve(ppath.cwd(), ...segments);
}
};
}
const contains = function(pathUtils, from, to) {
from = pathUtils.normalize(from);
to = pathUtils.normalize(to);
if (from === to)
return `.`;
if (!from.endsWith(pathUtils.sep))
from = from + pathUtils.sep;
if (to.startsWith(from)) {
return to.slice(from.length);
} else {
return null;
}
};
npath.contains = (from, to) => contains(npath, from, to);
ppath.contains = (from, to) => contains(ppath, from, to);
const WINDOWS_PATH_REGEXP = /^([a-zA-Z]:.*)$/;
const UNC_WINDOWS_PATH_REGEXP = /^\/\/(\.\/)?(.*)$/;
const PORTABLE_PATH_REGEXP = /^\/([a-zA-Z]:.*)$/;
const UNC_PORTABLE_PATH_REGEXP = /^\/unc\/(\.dot\/)?(.*)$/;
function fromPortablePathWin32(p) {
let portablePathMatch, uncPortablePathMatch;
if (portablePathMatch = p.match(PORTABLE_PATH_REGEXP))
p = portablePathMatch[1];
else if (uncPortablePathMatch = p.match(UNC_PORTABLE_PATH_REGEXP))
p = `\\\\${uncPortablePathMatch[1] ? `.\\` : ``}${uncPortablePathMatch[2]}`;
else
return p;
return p.replace(/\//g, `\\`);
}
function toPortablePathWin32(p) {
p = p.replace(/\\/g, `/`);
let windowsPathMatch, uncWindowsPathMatch;
if (windowsPathMatch = p.match(WINDOWS_PATH_REGEXP))
p = `/${windowsPathMatch[1]}`;
else if (uncWindowsPathMatch = p.match(UNC_WINDOWS_PATH_REGEXP))
p = `/unc/${uncWindowsPathMatch[1] ? `.dot/` : ``}${uncWindowsPathMatch[2]}`;
return p;
}
const toPortablePath = process.platform === `win32` ? toPortablePathWin32 : (p) => p;
const fromPortablePath = process.platform === `win32` ? fromPortablePathWin32 : (p) => p;
npath.fromPortablePath = fromPortablePath;
npath.toPortablePath = toPortablePath;
function convertPath(targetPathUtils, sourcePath) {
return targetPathUtils === npath ? fromPortablePath(sourcePath) : toPortablePath(sourcePath);
}
function readPackageScope(checkPath) {
const rootSeparatorIndex = checkPath.indexOf(npath.sep);
let separatorIndex;
do {
separatorIndex = checkPath.lastIndexOf(npath.sep);
checkPath = checkPath.slice(0, separatorIndex);
if (checkPath.endsWith(`${npath.sep}node_modules`))
return false;
const pjson = readPackage(checkPath + npath.sep);
if (pjson) {
return {
data: pjson,
path: checkPath
};
}
} while (separatorIndex > rootSeparatorIndex);
return false;
}
function readPackage(requestPath) {
const jsonPath = npath.resolve(requestPath, `package.json`);
if (!fs.existsSync(jsonPath))
return null;
return JSON.parse(fs.readFileSync(jsonPath, `utf8`));
}
async function tryReadFile$1(path2) {
try {
return await fs.promises.readFile(path2, `utf8`);
} catch (error) {
if (error.code === `ENOENT`)
return null;
throw error;
}
}
function tryParseURL(str, base) {
try {
return new URL(str, base);
} catch {
return null;
}
}
let entrypointPath = null;
function setEntrypointPath(file) {
entrypointPath = file;
}
function getFileFormat$1(filepath) {
var _a, _b;
const ext = path$1.extname(filepath);
switch (ext) {
case `.mjs`: {
return `module`;
}
case `.cjs`: {
return `commonjs`;
}
case `.wasm`: {
throw new Error(
`Unknown file extension ".wasm" for ${filepath}`
);
}
case `.json`: {
return `json`;
}
case `.js`: {
const pkg = readPackageScope(filepath);
if (!pkg)
return `commonjs`;
return (_a = pkg.data.type) != null ? _a : `commonjs`;
}
default: {
if (entrypointPath !== filepath)
return null;
const pkg = readPackageScope(filepath);
if (!pkg)
return `commonjs`;
if (pkg.data.type === `module`)
return null;
return (_b = pkg.data.type) != null ? _b : `commonjs`;
}
}
}
function getDefaultExportFromNamespaceIfPresent (n) {
return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
}
var lib = {};
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
}
function __runInitializers(thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
}
function __propKey(x) {
return typeof x === "symbol" ? x : "".concat(x);
}
function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
var __createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
function __exportStar(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
/** @deprecated */
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
}
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose, inner;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
if (async) inner = dispose;
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
var r, s = 0;
function next() {
while (r = env.stack.pop()) {
try {
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
if (r.dispose) {
var result = r.dispose.call(r.value);
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
else s |= 1;
}
catch (e) {
fail(e);
}
}
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
if (env.hasError) throw env.error;
}
return next();
}
function __rewriteRelativeImportExtension(path, preserveJsx) {
if (typeof path === "string" && /^\.\.?\//.test(path)) {
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
});
}
return path;
}
const tslib_es6 = {
__extends,
__assign,
__rest,
__decorate,
__param,
__esDecorate,
__runInitializers,
__propKey,
__setFunctionName,
__metadata,
__awaiter,
__generator,
__createBinding,
__exportStar,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__addDisposableResource,
__disposeResources,
__rewriteRelativeImportExtension,
};
const tslib_es6$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
__proto__: null,
__addDisposableResource,
get __assign () { return __assign; },
__asyncDelegator,
__asyncGenerator,
__asyncValues,
__await,
__awaiter,
__classPrivateFieldGet,
__classPrivateFieldIn,
__classPrivateFieldSet,
__createBinding,
__decorate,
__disposeResources,
__esDecorate,
__exportStar,
__extends,
__generator,
__importDefault,
__importStar,
__makeTemplateObject,
__metadata,
__param,
__propKey,
__read,
__rest,
__rewriteRelativeImportExtension,
__runInitializers,
__setFunctionName,
__spread,
__spreadArray,
__spreadArrays,
__values,
default: tslib_es6
}, Symbol.toStringTag, { value: 'Module' }));
const require$$0 = /*@__PURE__*/getDefaultExportFromNamespaceIfPresent(tslib_es6$1);
var constants = {};
var hasRequiredConstants;
function requireConstants () {
if (hasRequiredConstants) return constants;
hasRequiredConstants = 1;
Object.defineProperty(constants, "__esModule", { value: true });
constants.SAFE_TIME = constants.S_IFLNK = constants.S_IFREG = constants.S_IFDIR = constants.S_IFMT = void 0;
constants.S_IFMT = 0o170000;
constants.S_IFDIR = 0o040000;
constants.S_IFREG = 0o100000;
constants.S_IFLNK = 0o120000;
/**
* Unix timestamp for `1984-06-22T21:50:00.000Z`
*
* It needs to be after 1980-01-01 because that's what Zip supports, and it
* needs to have a slight offset to account for different timezones (because
* zip assumes that all times are local to whoever writes the file, which is
* really silly).
*/
constants.SAFE_TIME = 456789000;
return constants;
}
var errors = {};
var hasRequiredErrors;
function requireErrors () {
if (hasRequiredErrors) return errors;
hasRequiredErrors = 1;
Object.defineProperty(errors, "__esModule", { value: true });
errors.EBUSY = EBUSY;
errors.ENOSYS = ENOSYS;
errors.EINVAL = EINVAL;
errors.EBADF = EBADF;
errors.ENOENT = ENOENT;
errors.ENOTDIR = ENOTDIR;
errors.EISDIR = EISDIR;
errors.EEXIST = EEXIST;
errors.EROFS = EROFS;
errors.ENOTEMPTY = ENOTEMPTY;
errors.EOPNOTSUPP = EOPNOTSUPP;
errors.ERR_DIR_CLOSED = ERR_DIR_CLOSED;
function makeError(code, message) {
return Object.assign(new Error(`${code}: ${message}`), { code });
}
function EBUSY(message) {
return makeError(`EBUSY`, message);
}
function ENOSYS(message, reason) {
return makeError(`ENOSYS`, `${message}, ${reason}`);
}
function EINVAL(reason) {
return makeError(`EINVAL`, `invalid argument, ${reason}`);
}
function EBADF(reason) {
return makeError(`EBADF`, `bad file descriptor, ${reason}`);
}
function ENOENT(reason) {
return makeError(`ENOENT`, `no such file or directory, ${reason}`);
}
function ENOTDIR(reason) {
return makeError(`ENOTDIR`, `not a directory, ${reason}`);
}
function EISDIR(reason) {
return makeError(`EISDIR`, `illegal operation on a directory, ${reason}`);
}
function EEXIST(reason) {
return makeError(`EEXIST`, `file already exists, ${reason}`);
}
function EROFS(reason) {
return makeError(`EROFS`, `read-only filesystem, ${reason}`);
}
function ENOTEMPTY(reason) {
return makeError(`ENOTEMPTY`, `directory not empty, ${reason}`);
}
function EOPNOTSUPP(reason) {
return makeError(`EOPNOTSUPP`, `operation not supported, ${reason}`);
}
// ------------------------------------------------------------------------
function ERR_DIR_CLOSED() {
return makeError(`ERR_DIR_CLOSED`, `Directory handle was closed`);
}
return errors;
}
var statUtils = {};
var hasRequiredStatUtils;
function requireStatUtils () {
if (hasRequiredStatUtils) return statUtils;
hasRequiredStatUtils = 1;
(function (exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.BigIntStatsEntry = exports.StatEntry = exports.DirEntry = exports.DEFAULT_MODE = void 0;
exports.makeDefaultStats = makeDefaultStats;
exports.makeEmptyStats = makeEmptyStats;
exports.clearStats = clearStats;
exports.convertToBigIntStats = convertToBigIntStats;
exports.areStatsEqual = areStatsEqual;
const tslib_1 = require$$0;
const nodeUtils = tslib_1.__importStar(require$$1);
const constants_1 = requireConstants();
exports.DEFAULT_MODE = constants_1.S_IFREG | 0o644;
class DirEntry {
constructor() {
this.name = ``;
this.path = ``;
this.mode = 0;
}
isBlockDevice() {
return false;
}
isCharacterDevice() {
return false;
}
isDirectory() {
return (this.mode & constants_1.S_IFMT) === constants_1.S_IFDIR;
}
isFIFO() {
return false;
}
isFile() {
return (this.mode & constants_1.S_IFMT) === constants_1.S_IFREG;
}
isSocket() {
return false;
}
isSymbolicLink() {
return (this.mode & constants_1.S_IFMT) === constants_1.S_IFLNK;
}
}
exports.DirEntry = DirEntry;
class StatEntry {
constructor() {
this.uid = 0;
this.gid = 0;
this.size = 0;
this.blksize = 0;
this.atimeMs = 0;
this.mtimeMs = 0;
this.ctimeMs = 0;
this.birthtimeMs = 0;
this.atime = new Date(0);
this.mtime = new Date(0);
this.ctime = new Date(0);
this.birthtime = new Date(0);
this.dev = 0;
this.ino = 0;
this.mode = exports.DEFAULT_MODE;
this.nlink = 1;
this.rdev = 0;
this.blocks = 1;
}
isBlockDevice() {
return false;
}
isCharacterDevice() {
return false;
}
isDirectory() {
return (this.mode & constants_1.S_IFMT) === constants_1.S_IFDIR;
}
isFIFO() {
return false;
}
isFile() {
return (this.mode & constants_1.S_IFMT) === constants_1.S_IFREG;
}
isSocket() {
return false;
}
isSymbolicLink() {
return (this.mode & constants_1.S_IFMT) === constants_1.S_IFLNK;
}
}
exports.StatEntry = StatEntry;
class BigIntStatsEntry {
constructor() {
this.uid = BigInt(0);
this.gid = BigInt(0);
this.size = BigInt(0);
this.blksize = BigInt(0);
this.atimeMs = BigInt(0);
this.mtimeMs = BigInt(0);
this.ctimeMs = BigInt(0);
this.birthtimeMs = BigInt(0);
this.atimeNs = BigInt(0);
this.mtimeNs = BigInt(0);
this.ctimeNs = BigInt(0);
this.birthtimeNs = BigInt(0);
this.atime = new Date(0);
this.mtime = new Date(0);
this.ctime = new Date(0);
this.birthtime = new Date(0);
this.dev = BigInt(0);
this.ino = BigInt(0);
this.mode = BigInt(exports.DEFAULT_MODE);
this.nlink = BigInt(1);
this.rdev = BigInt(0);
this.blocks = BigInt(1);
}
isBlockDevice() {
return false;
}
isCharacterDevice() {
return false;
}
isDirectory() {
return (this.mode & BigInt(constants_1.S_IFMT)) === BigInt(constants_1.S_IFDIR);
}
isFIFO() {
return false;
}
isFile() {
return (this.mode & BigInt(constants_1.S_IFMT)) === BigInt(constants_1.S_IFREG);
}
isSocket() {
return false;
}
isSymbolicLink() {
return (this.mode & BigInt(constants_1.S_IFMT)) === BigInt(constants_1.S_IFLNK);
}
}
exports.BigIntStatsEntry = BigIntStatsEntry;
function makeDefaultStats() {
return new StatEntry();
}
function makeEmptyStats() {
return clearStats(makeDefaultStats());
}
/**
* Mutates the provided stats object to zero it out then returns it for convenience
*/
function clearStats(stats) {
for (const key in stats) {
if (Object.hasOwn(stats, key)) {
const element = stats[key];
if (typeof element === `number`) {
// @ts-expect-error Typescript can't tell that stats[key] is a number
stats[key] = 0;
}
else if (typeof element === `bigint`) {
// @ts-expect-error Typescript can't tell that stats[key] is a bigint
stats[key] = BigInt(0);
}
else if (nodeUtils.types.isDate(element)) {
// @ts-expect-error Typescript can't tell that stats[key] is a bigint
stats[key] = new Date(0);
}
}
}
return stats;
}
function convertToBigIntStats(stats) {
const bigintStats = new BigIntStatsEntry();
for (const key in stats) {
if (Object.hasOwn(stats, key)) {
const element = stats[key];
if (typeof element === `number`) {
// @ts-expect-error Typescript isn't able to tell this is valid
bigintStats[key] = BigInt(element);
}
else if (nodeUtils.types.isDate(element)) {
// @ts-expect-error Typescript isn't able to tell this is valid
bigintStats[key] = new Date(element);
}
}
}
bigintStats.atimeNs = bigintStats.atimeMs * BigInt(1e6);
bigintStats.mtimeNs = bigintStats.mtimeMs * BigInt(1e6);
bigintStats.ctimeNs = bigintStats.ctimeMs * BigInt(1e6);
bigintStats.birthtimeNs = bigintStats.birthtimeMs * BigInt(1e6);
return bigintStats;
}
function areStatsEqual(a, b) {
if (a.atimeMs !== b.atimeMs)
return false;
if (a.birthtimeMs !== b.birthtimeMs)
return false;
if (a.blksize !== b.blksize)
return false;
if (a.blocks !== b.blocks)
return false;
if (a.ctimeMs !== b.ctimeMs)
return false;
if (a.dev !== b.dev)
return false;
if (a.gid !== b.gid)
return false;
if (a.ino !== b.ino)
return false;
if (a.isBlockDevice() !== b.isBlockDevice())
return false;
if (a.isCharacterDevice() !== b.isCharacterDevice())
return false;
if (a.isDirectory() !== b.isDirectory())
return false;
if (a.isFIFO() !== b.isFIFO())
return false;
if (a.isFile() !== b.isFile())
return false;
if (a.isSocket() !== b.isSocket())
return false;
if (a.isSymbolicLink() !== b.isSymbolicLink())
return false;
if (a.mode !== b.mode)
return false;
if (a.mtimeMs !== b.mtimeMs)
return false;
if (a.nlink !== b.nlink)
return false;
if (a.rdev !== b.rdev)
return false;
if (a.size !== b.size)
return false;
if (a.uid !== b.uid)
return false;
const aN = a;
const bN = b;
if (aN.atimeNs !== bN.atimeNs)
return false;
if (aN.mtimeNs !== bN.mtimeNs)
return false;
if (aN.ctimeNs !== bN.ctimeNs)
return false;
if (aN.birthtimeNs !== bN.birthtimeNs)
return false;
return true;
}
} (statUtils));
return statUtils;
}
var copyPromise$1 = {};
var path = {};
var hasRequiredPath;
function requirePath () {
if (hasRequiredPath) return path;
hasRequiredPath = 1;
(function (exports) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.ppath = exports.npath = exports.Filename = exports.PortablePath = void 0;
exports.convertPath = convertPath;
const tslib_1 = require$$0;
const path_1 = tslib_1.__importDefault(path$1);
var PathType;
(function (PathType) {
PathType[PathType["File"] = 0] = "File";
PathType[PathType["Portable"] = 1] = "Portable";
PathType[PathType["Native"] = 2] = "Native";
})(PathType || (PathType = {}));
exports.PortablePath = {
root: `/`,
dot: `.`,
parent: `..`,
};
exports.Filename = {
home: `~`,
nodeModules: `node_modules`,
manifest: `package.json`,
lockfile: `yarn.lock`,
virtual: `__virtual__`,
/**
* @deprecated
*/
pnpJs: `.pnp.js`,
pnpCjs: `.pnp.cjs`,
pnpData: `.pnp.data.json`,
pnpEsmLoader: `.pnp.loader.mjs`,
rc: `.yarnrc.yml`,
env: `.env`,
};
exports.npath = Object.create(path_1.default);
exports.ppath = Object.create(path_1.default.posix);
exports.npath.cwd = () => process.cwd();
exports.ppath.cwd = process.platform === `win32`
? () => toPortablePath(process.cwd())
: process.cwd;
if (process.platform === `win32`) {
exports.ppath.resolve = (...segments) => {
if (segments.length > 0 && exports.ppath.isAbsolute(segments[0])) {
return path_1.default.posix.resolve(...segments);
}
else {