rsbuild-plugin-arethetypeswrong 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/453.js +185 -0
- package/dist/854.js +156 -0
- package/dist/@arethetypeswrong/core.js +3412 -0
- package/dist/createTarball.js +856 -0
- package/dist/getExitCode.js +26 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -279
- package/dist/render.js +1836 -0
- package/dist/{806.js → utils.js} +135 -146
- package/package.json +20 -24
- package/dist/223.js +0 -66537
- package/dist/237.js +0 -63
- package/dist/395.js +0 -686
- package/dist/698.js +0 -74
- package/dist/723.js +0 -3419
- package/dist/737.js +0 -144
- package/dist/index.js.LICENSE.txt +0 -3
- /package/dist/{723.js.LICENSE.txt → @arethetypeswrong/core.js.LICENSE.txt} +0 -0
- /package/dist/{237.js.LICENSE.txt → getExitCode.js.LICENSE.txt} +0 -0
- /package/dist/{737.js.LICENSE.txt → render.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,3412 @@
|
|
|
1
|
+
/*! LICENSE: core.js.LICENSE.txt */
|
|
2
|
+
import typescript from "typescript";
|
|
3
|
+
import { createRequire } from "module";
|
|
4
|
+
import { __webpack_require__ } from "../453.js";
|
|
5
|
+
import { getResolutionOption, getResolutionKinds, visitResolutions, allBuildTools, resolvedThroughFallback } from "../utils.js";
|
|
6
|
+
__webpack_require__.add({
|
|
7
|
+
"./node_modules/.pnpm/@andrewbranch+untar.js@1.0.3/node_modules/@andrewbranch/untar.js/lib/bytestream.js" (module) {
|
|
8
|
+
const ByteStream = function(ab, opt_offset, opt_length) {
|
|
9
|
+
var offset = opt_offset || 0;
|
|
10
|
+
var length = opt_length || ab.byteLength;
|
|
11
|
+
this.bytes = new Uint8Array(ab, offset, length);
|
|
12
|
+
this.ptr = 0;
|
|
13
|
+
};
|
|
14
|
+
ByteStream.prototype.peekNumber = function(n) {
|
|
15
|
+
if (n <= 0 || "number" != typeof n) return -1;
|
|
16
|
+
var result = 0;
|
|
17
|
+
var curByte = this.ptr + n - 1;
|
|
18
|
+
while(curByte >= this.ptr){
|
|
19
|
+
result <<= 8;
|
|
20
|
+
result |= this.bytes[curByte];
|
|
21
|
+
--curByte;
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
ByteStream.prototype.readNumber = function(n) {
|
|
26
|
+
var num = this.peekNumber(n);
|
|
27
|
+
this.ptr += n;
|
|
28
|
+
return num;
|
|
29
|
+
};
|
|
30
|
+
ByteStream.prototype.peekSignedNumber = function(n) {
|
|
31
|
+
var num = this.peekNumber(n);
|
|
32
|
+
var HALF = Math.pow(2, 8 * n - 1);
|
|
33
|
+
var FULL = 2 * HALF;
|
|
34
|
+
if (num >= HALF) num -= FULL;
|
|
35
|
+
return num;
|
|
36
|
+
};
|
|
37
|
+
ByteStream.prototype.readSignedNumber = function(n) {
|
|
38
|
+
var num = this.peekSignedNumber(n);
|
|
39
|
+
this.ptr += n;
|
|
40
|
+
return num;
|
|
41
|
+
};
|
|
42
|
+
ByteStream.prototype.peekBytes = function(n, movePointers) {
|
|
43
|
+
if (n <= 0 || "number" != typeof n) return null;
|
|
44
|
+
var result = this.bytes.subarray(this.ptr, this.ptr + n);
|
|
45
|
+
if (movePointers) this.ptr += n;
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
ByteStream.prototype.readBytes = function(n) {
|
|
49
|
+
return this.peekBytes(n, true);
|
|
50
|
+
};
|
|
51
|
+
ByteStream.prototype.peekString = function(n) {
|
|
52
|
+
if (n <= 0 || "number" != typeof n) return "";
|
|
53
|
+
var result = "";
|
|
54
|
+
for(var p = this.ptr, end = this.ptr + n; p < end; ++p)result += String.fromCharCode(this.bytes[p]);
|
|
55
|
+
return result;
|
|
56
|
+
};
|
|
57
|
+
ByteStream.prototype.readString = function(n) {
|
|
58
|
+
var strToReturn = this.peekString(n);
|
|
59
|
+
this.ptr += n;
|
|
60
|
+
return strToReturn;
|
|
61
|
+
};
|
|
62
|
+
module.exports = ByteStream;
|
|
63
|
+
},
|
|
64
|
+
"./node_modules/.pnpm/@andrewbranch+untar.js@1.0.3/node_modules/@andrewbranch/untar.js/lib/untar.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
65
|
+
const ByteStream = __webpack_require__("./node_modules/.pnpm/@andrewbranch+untar.js@1.0.3/node_modules/@andrewbranch/untar.js/lib/bytestream.js");
|
|
66
|
+
const readCleanString = function(bstr, numBytes) {
|
|
67
|
+
const str = bstr.readString(numBytes);
|
|
68
|
+
const zIndex = str.indexOf(String.fromCharCode(0));
|
|
69
|
+
return -1 != zIndex ? str.substring(0, zIndex) : str;
|
|
70
|
+
};
|
|
71
|
+
function TarLocalFile(bstream) {
|
|
72
|
+
this.isValid = false;
|
|
73
|
+
this.name = readCleanString(bstream, 100);
|
|
74
|
+
this.mode = readCleanString(bstream, 8);
|
|
75
|
+
this.uid = readCleanString(bstream, 8);
|
|
76
|
+
this.gid = readCleanString(bstream, 8);
|
|
77
|
+
this.size = parseInt(readCleanString(bstream, 12), 8);
|
|
78
|
+
this.mtime = readCleanString(bstream, 12);
|
|
79
|
+
this.chksum = readCleanString(bstream, 8);
|
|
80
|
+
this.typeflag = readCleanString(bstream, 1);
|
|
81
|
+
this.linkname = readCleanString(bstream, 100);
|
|
82
|
+
this.maybeMagic = readCleanString(bstream, 6);
|
|
83
|
+
if ("ustar" == this.maybeMagic) {
|
|
84
|
+
this.version = readCleanString(bstream, 2);
|
|
85
|
+
this.uname = readCleanString(bstream, 32);
|
|
86
|
+
this.gname = readCleanString(bstream, 32);
|
|
87
|
+
this.devmajor = readCleanString(bstream, 8);
|
|
88
|
+
this.devminor = readCleanString(bstream, 8);
|
|
89
|
+
this.prefix = readCleanString(bstream, 155);
|
|
90
|
+
if (this.prefix.length) this.name = this.prefix + "/" + this.name;
|
|
91
|
+
bstream.readBytes(12);
|
|
92
|
+
} else bstream.readBytes(249);
|
|
93
|
+
this.filename = this.name;
|
|
94
|
+
this.fileData = null;
|
|
95
|
+
if (0 === +this.typeflag) {
|
|
96
|
+
this.fileData = new Uint8Array(bstream.bytes.buffer, bstream.ptr, this.size);
|
|
97
|
+
if (this.name.length > 0 && this.fileData && this.fileData.buffer) this.isValid = true;
|
|
98
|
+
}
|
|
99
|
+
bstream.ptr += this.size;
|
|
100
|
+
const remaining = 512 - bstream.ptr % 512;
|
|
101
|
+
if (remaining > 0 && remaining < 512) bstream.readBytes(remaining);
|
|
102
|
+
}
|
|
103
|
+
module.exports.P = function(arrayBuffer) {
|
|
104
|
+
const bstream = new ByteStream(arrayBuffer);
|
|
105
|
+
const localFiles = [];
|
|
106
|
+
while(0 != bstream.peekNumber(4)){
|
|
107
|
+
const oneLocalFile = new TarLocalFile(bstream);
|
|
108
|
+
if (oneLocalFile && oneLocalFile.isValid) localFiles.push(oneLocalFile);
|
|
109
|
+
}
|
|
110
|
+
return localFiles;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
let lexer_A;
|
|
115
|
+
const lexer_Q = 1 === new Uint8Array(new Uint16Array([
|
|
116
|
+
1
|
|
117
|
+
]).buffer)[0];
|
|
118
|
+
function parse(g, I = "@") {
|
|
119
|
+
if (!lexer_A) throw new Error("Not initialized");
|
|
120
|
+
const D = g.length + 1, N = (lexer_A.__heap_base.value || lexer_A.__heap_base) + 4 * D - lexer_A.memory.buffer.byteLength;
|
|
121
|
+
N > 0 && lexer_A.memory.grow(Math.ceil(N / 65536));
|
|
122
|
+
const k = lexer_A.sa(D);
|
|
123
|
+
(lexer_Q ? C : lexer_E)(g, new Uint16Array(lexer_A.memory.buffer, k, D));
|
|
124
|
+
const w = lexer_A.parseCJS(k, g.length, 0, 0, 0);
|
|
125
|
+
if (w) {
|
|
126
|
+
const Q = new Error(`Parse error ${I}${lexer_A.e()}:${g.slice(0, lexer_A.e()).split("\n").length}:${lexer_A.e() - g.lastIndexOf("\n", lexer_A.e() - 1)}`);
|
|
127
|
+
throw Object.assign(Q, {
|
|
128
|
+
idx: lexer_A.e()
|
|
129
|
+
}), 5 !== w && 6 !== w && 7 !== w || Object.assign(Q, {
|
|
130
|
+
code: "ERR_LEXER_ESM_SYNTAX"
|
|
131
|
+
}), Q;
|
|
132
|
+
}
|
|
133
|
+
let H = new Set, J = new Set, o = new Set;
|
|
134
|
+
for(; lexer_A.rre();){
|
|
135
|
+
const Q = lexer_B(g.slice(lexer_A.res(), lexer_A.ree()));
|
|
136
|
+
Q && J.add(Q);
|
|
137
|
+
}
|
|
138
|
+
for(; lexer_A.ru();)o.add(lexer_B(g.slice(lexer_A.us(), lexer_A.ue())));
|
|
139
|
+
for(; lexer_A.re();){
|
|
140
|
+
let Q = lexer_B(g.slice(lexer_A.es(), lexer_A.ee()));
|
|
141
|
+
void 0 === Q || o.has(Q) || H.add(Q);
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
exports: [
|
|
145
|
+
...H
|
|
146
|
+
],
|
|
147
|
+
reexports: [
|
|
148
|
+
...J
|
|
149
|
+
]
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function lexer_B(A) {
|
|
153
|
+
if ('"' !== A[0] && "'" !== A[0]) return A;
|
|
154
|
+
try {
|
|
155
|
+
const Q = (0, eval)(A);
|
|
156
|
+
for(let A = 0; A < Q.length; A++){
|
|
157
|
+
const B = 64512 & Q.charCodeAt(A);
|
|
158
|
+
if (!(B < 55296)) {
|
|
159
|
+
if (55296 !== B) return;
|
|
160
|
+
if (56320 != (64512 & Q.charCodeAt(++A))) return;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return Q;
|
|
164
|
+
} catch {}
|
|
165
|
+
}
|
|
166
|
+
function lexer_E(A, Q) {
|
|
167
|
+
const B = A.length;
|
|
168
|
+
let E = 0;
|
|
169
|
+
for(; E < B;){
|
|
170
|
+
const B = A.charCodeAt(E);
|
|
171
|
+
Q[E++] = (255 & B) << 8 | B >>> 8;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function C(A, Q) {
|
|
175
|
+
const B = A.length;
|
|
176
|
+
let E = 0;
|
|
177
|
+
for(; E < B;)Q[E] = A.charCodeAt(E++);
|
|
178
|
+
}
|
|
179
|
+
function lexer_g() {
|
|
180
|
+
const A = "AGFzbQEAAAABrAERYAJ/fwBgAABgAX8Bf2AAAX9gBn9/f39/fwF/YAF/AGAXf39/f39/f39/f39/f39/f39/f39/f38Bf2AIf39/f39/f38Bf2AHf39/f39/fwF/YAN/f38Bf2AFf39/f38Bf2AOf39/f39/f39/f39/f38Bf2AKf39/f39/f39/fwF/YAt/f39/f39/f39/fwF/YAJ/fwF/YAR/f39/AX9gCX9/f39/f39/fwF/A0NCAgMDAwMDAwMDAwMAAAABBAICBQQBBgcBBQEFBQUBAQICAgIBAQIIAwICAgkKAgELAgwNDgQPCA4HAgICAhACAgMJBAUBcAEFBQUDAQABBg8CfwFB0JgCC38AQdCYAgsHXA4GbWVtb3J5AgACc2EAAAFlAAECZXMAAgJlZQADA3JlcwAEA3JlZQAFAnVzAAYCdWUABwJyZQAIA3JyZQAJAnJ1AAoIcGFyc2VDSlMADwtfX2hlYXBfYmFzZQMBCQoBAEEBCwQLDA0OCt2fAUJ4AQF/QQAoApgfIgEgAEEBdGoiAEEAOwEAQQAgAEECaiIANgLkH0EAIAA2AugfQQBBADYCwB9BAEEANgLIH0EAQQA2AsQfQQBBADYCzB9BAEEANgLUH0EAQQA2AtAfQQBBADYC2B9BAEEANgLgH0EAQQA2AtwfIAELCABBACgC7B8LFQBBACgCxB8oAgBBACgCmB9rQQF1CxUAQQAoAsQfKAIEQQAoApgfa0EBdQsVAEEAKALQHygCAEEAKAKYH2tBAXULFQBBACgC0B8oAgRBACgCmB9rQQF1CxUAQQAoAtwfKAIAQQAoApgfa0EBdQsVAEEAKALcHygCBEEAKAKYH2tBAXULJQEBf0EAQQAoAsQfIgBBCGpBwB8gABsoAgAiADYCxB8gAEEARwslAQF/QQBBACgC0B8iAEEIakHMH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QsdAAJAQQAoApgfIABHDQBBAQ8LIABBfmovAQAQJQv1AgEEf0EAKAKYHyEBAkADQCAAQX5qIQIgAC8BACIDQSBHDQEgACABSyEEIAIhACAEDQALCwJAIANBPUcNAAJAA0AgAkF+aiEAIAIvAQBBIEcNASACIAFLIQQgACECIAQNAAsLIABBAmohAiAAQQRqIQNBACEEAkADQCACECghACACIAFNDQEgAEUNASAAQdwARg0CIAAQKUUNASACQX5BfCAAQYCABEkbaiECIAAQKiEEDAALCyAEQQFxRQ0AIAIvAQBBIEcNAEEAKAK0oAEiBEEAKAKwH0YNACAEIAM2AgwgBCACQQJqNgIIIAJBfmohAEEgIQICQANAIABBAmogAU0NASACQf//A3FBIEcNASAALwEAIQIgAEF+aiEADAALCwJAAkACQCACQf//A3FBjn9qDgMAAwEDCyAAQfYAQeEAECsNAQwCCyAAQewAQeUAECsNACAAQeMAQe8AQe4AQfMAECxFDQELQQAgBEEQajYCtKABCws/AQF/QQAhBgJAIAAvAQAgAUcNACAALwECIAJHDQAgAC8BBCADRw0AIAAvAQYgBEcNACAALwEIIAVGIQYLIAYLowEBA39BAEEAKAK8oAEiAEEMaiIBNgK8oAECQAJAAkACQAJAAkACQBAnIgJBWWoOCAIDAQIBAQEEAAsgAkEiRg0BIAJB+wBGDQELQQAoArygASABRg0EC0EALwGGQEUNAkEAQQAoArygAUF+ajYCvKABDwtBAEEALwGGQCICQQFqOwGGQEEAKAKwoAEgAkECdGogADYCAA8LQQUQGw8LQQYQGwsL6QEBAX9BACEXAkAgAC8BACABRw0AIAAvAQIgAkcNACAALwEEIANHDQAgAC8BBiAERw0AIAAvAQggBUcNACAALwEKIAZHDQAgAC8BDCAHRw0AIAAvAQ4gCEcNACAALwEQIAlHDQAgAC8BEiAKRw0AIAAvARQgC0cNACAALwEWIAxHDQAgAC8BGCANRw0AIAAvARogDkcNACAALwEcIA9HDQAgAC8BHiAQRw0AIAAvASAgEUcNACAALwEiIBJHDQAgAC8BJCATRw0AIAAvASYgFEcNAC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UNA0EAIABBDGo2ArygARAnGkEAKAK8oAEiACACIAYQQQ0DQQAgACAHQQF0ajYCvKABECdB2wBHDQNBAEEAKAK8oAFBAmo2ArygARAnGkEAKAK8oAEiACAEIAMQQQ0DQQAgACAIQQF0ajYCvKABECdB3QBHDQNBAEEAKAK8oAFBAmo2ArygAQJAECciAEE7Rw0AQQBBACgCvKABQQJqNgK8oAEQJyEACyAAQf0ARw0DQQBBACgCvKABQQJqNgK8oAECQBAnIgBBLEcNAEEAQQAoArygAUECajYCvKABECchAAsgAEH9AEcNA0EAQQAoArygAUECajYCvKABECdBKUcNA0EAQQAoArygAUECajYCvKABECciAEE7Rw0BQQBBACgCvKABQQJqNgK8oAELECchAAsgAEH9AEcNAUEAQQAoArygAUECajYCvKABECdBKUcNAUEAKAK0oAEhBEGAICEAA0ACQAJAIAQgAEYNACAHIABBDGooAgAgAEEIaigCACIDa0EBdUcNASACIAMgBhBBDQEgACgCACAAQQRqKAIAQQAoAqAfEQAAQQAgATYCvKABCw8LIABBEGohAAwACwsgAiAAQQAoAqQfEQAAC0EAIAE2ArygAQtBAAJAQQAoAvAfDQBBACAANgLwHwtBACgCvKABIQBBAEEAKALAoAFBAmo2ArygAUEAIABBACgCmB9rQQF1NgLsHwuOAQEEf0EAKAK8oAEhAUEAKALAoAEhAgJAAkADQCABIgNBAmohASADIAJPDQEgAS8BACIEIABGDQICQCAEQdwARg0AIARBdmoOBAIBAQIBCyADQQRqIQEgAy8BBEENRw0AIANBBmogASADLwEGQQpGGyEBDAALC0EAIAE2ArygAUEJEBsPC0EAIAE2ArygAQtKAQN/QQAoArygAUECaiEAQQAoAsCgASEBAkADQCAAIgJBfmogAU8NASACQQJqIQAgAi8BAEF2ag4EAQAAAQALC0EAIAI2ArygAQt8AQJ/QQBBACgCvKABIgBBAmo2ArygASAAQQZqIQBBACgCwKABIQEDQAJAAkACQCAAQXxqIAFPDQAgAEF+ai8BAEEqRw0CIAAvAQBBL0cNAkEAIABBfmo2ArygAQwBCy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IABBqgFJDQEgABA8DwsgABA6IQELIAELTAEDf0EAIQMCQCAAQX5qIgRBACgCmB8iBUkNACAELwEAIAFHDQAgAC8BACACRw0AAkAgBCAFRw0AQQEPCyAAQXxqLwEAECUhAwsgAwtmAQN/QQAhBQJAIABBemoiBkEAKAKYHyIHSQ0AIAYvAQAgAUcNACAAQXxqLwEAIAJHDQAgAEF+ai8BACADRw0AIAAvAQAgBEcNAAJAIAYgB0cNAEEBDwsgAEF4ai8BABAlIQULIAULhQEBAn8gABA+IgAQKiEBAkACQCAAQdwARg0AQQAhAiABRQ0BC0EAKAK8oAFBAkEEIABBgIAESRtqIQACQANAQQAgADYCvKABIAAvAQAQPiIBRQ0BAkAgARApRQ0AIABBAkEEIAFBgIAESRtqIQAMAQsLQQAhAiABQdwARg0BC0EBIQILIAIL2gMBBH9BACgCvKABIgBBfmohAQNAQQAgAEECajYCvKABAkACQAJAIABBACgCwKABTw0AECchAEEAKAK8oAEhAgJAAkAgABAtRQ0AQQAoArygASEDAkACQBAnIgBBOkcNAEEAQQAoArygAUECajYCvKABECcQLUUNAUEAKAK8oAEvAQAhAAsgAiADQQAoApwfEQAADAILQQAgATYCvKABDwsCQAJAIABBIkYNACAAQS5GDQEgAEEnRw0EC0EAKAK8oAEhAiAAEBxBAEEAKAK8oAFBAmoiAzYCvKABECciAEE6Rw0BQQBBACgCvKABQQJqNgK8oAECQBAnEC1FDQBBACgCvKABLwEAIQAgAiADQQAoApwfEQAADAILQQAgATYCvKABDwtBACgCvKABIgAvAQJBLkcNAiAALwEEQS5HDQJBACAAQQZqNgK8oAECQAJAAkAgAC8BBiIAQfIARw0AQQEQECEAQQAoArygASECIAANASACLwEAIQALIABB//8DcRAtDQFBACABNgK8oAEPC0EAIAJBAmo2ArygAQsQJyEACyAAQf//A3EiAEEsRg0CIABB/QBGDQBBACABNgK8oAELDwtBACABNgK8oAEPC0EAKAK8oAEhAAwACwuPAQEBf0EAIQ4CQCAALwEAIAFHDQAgAC8BAiACRw0AI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Buffer ? Buffer.from(A, "base64") : Uint8Array.from(atob(A), (A)=>A.charCodeAt(0));
|
|
182
|
+
}
|
|
183
|
+
let lexer_I;
|
|
184
|
+
function lexer_init() {
|
|
185
|
+
return lexer_I || (lexer_I = (async ()=>{
|
|
186
|
+
const Q = await WebAssembly.compile(lexer_g()), { exports: B } = await WebAssembly.instantiate(Q);
|
|
187
|
+
lexer_A = B;
|
|
188
|
+
})());
|
|
189
|
+
}
|
|
190
|
+
function defineCheck(options) {
|
|
191
|
+
return options;
|
|
192
|
+
}
|
|
193
|
+
const cjsOnlyExportsDefault = defineCheck({
|
|
194
|
+
name: "CJSOnlyExportsDefault",
|
|
195
|
+
dependencies: ({ entrypoints, subpath, resolutionKind })=>{
|
|
196
|
+
var _a;
|
|
197
|
+
const entrypoint = entrypoints[subpath].resolutions[resolutionKind];
|
|
198
|
+
const implementationFileName = null == (_a = entrypoint.implementationResolution) ? void 0 : _a.fileName;
|
|
199
|
+
return [
|
|
200
|
+
implementationFileName,
|
|
201
|
+
resolutionKind
|
|
202
|
+
];
|
|
203
|
+
},
|
|
204
|
+
execute: ([implementationFileName, resolutionKind], context)=>{
|
|
205
|
+
var _a, _b, _c;
|
|
206
|
+
if (!implementationFileName) return;
|
|
207
|
+
if ("node10" === resolutionKind || "node16-cjs" === resolutionKind) return;
|
|
208
|
+
const host = null != (_a = context.hosts.findHostForFiles([
|
|
209
|
+
implementationFileName
|
|
210
|
+
])) ? _a : context.hosts.bundler;
|
|
211
|
+
const sourceFile = host.getSourceFile(implementationFileName);
|
|
212
|
+
if (!sourceFile.externalModuleIndicator && sourceFile.commonJsModuleIndicator && (null == (_c = null == (_b = sourceFile.symbol) ? void 0 : _b.exports) ? void 0 : _c.has(typescript.InternalSymbolName.Default)) && sourceFile.symbol.exports.has(typescript.escapeLeadingUnderscores("__esModule")) && !sourceFile.symbol.exports.has(typescript.InternalSymbolName.ExportEquals)) {
|
|
213
|
+
const decl = sourceFile.symbol.exports.get(typescript.InternalSymbolName.Default).declarations[0];
|
|
214
|
+
return {
|
|
215
|
+
kind: "CJSOnlyExportsDefault",
|
|
216
|
+
fileName: implementationFileName,
|
|
217
|
+
pos: decl.getStart(sourceFile),
|
|
218
|
+
end: decl.end
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
var esm_require = createRequire('/');
|
|
224
|
+
try {
|
|
225
|
+
esm_require('worker_threads').Worker;
|
|
226
|
+
} catch (e) {}
|
|
227
|
+
var u8 = Uint8Array, u16 = Uint16Array, i32 = Int32Array;
|
|
228
|
+
var fleb = new u8([
|
|
229
|
+
0,
|
|
230
|
+
0,
|
|
231
|
+
0,
|
|
232
|
+
0,
|
|
233
|
+
0,
|
|
234
|
+
0,
|
|
235
|
+
0,
|
|
236
|
+
0,
|
|
237
|
+
1,
|
|
238
|
+
1,
|
|
239
|
+
1,
|
|
240
|
+
1,
|
|
241
|
+
2,
|
|
242
|
+
2,
|
|
243
|
+
2,
|
|
244
|
+
2,
|
|
245
|
+
3,
|
|
246
|
+
3,
|
|
247
|
+
3,
|
|
248
|
+
3,
|
|
249
|
+
4,
|
|
250
|
+
4,
|
|
251
|
+
4,
|
|
252
|
+
4,
|
|
253
|
+
5,
|
|
254
|
+
5,
|
|
255
|
+
5,
|
|
256
|
+
5,
|
|
257
|
+
0,
|
|
258
|
+
0,
|
|
259
|
+
0,
|
|
260
|
+
0
|
|
261
|
+
]);
|
|
262
|
+
var fdeb = new u8([
|
|
263
|
+
0,
|
|
264
|
+
0,
|
|
265
|
+
0,
|
|
266
|
+
0,
|
|
267
|
+
1,
|
|
268
|
+
1,
|
|
269
|
+
2,
|
|
270
|
+
2,
|
|
271
|
+
3,
|
|
272
|
+
3,
|
|
273
|
+
4,
|
|
274
|
+
4,
|
|
275
|
+
5,
|
|
276
|
+
5,
|
|
277
|
+
6,
|
|
278
|
+
6,
|
|
279
|
+
7,
|
|
280
|
+
7,
|
|
281
|
+
8,
|
|
282
|
+
8,
|
|
283
|
+
9,
|
|
284
|
+
9,
|
|
285
|
+
10,
|
|
286
|
+
10,
|
|
287
|
+
11,
|
|
288
|
+
11,
|
|
289
|
+
12,
|
|
290
|
+
12,
|
|
291
|
+
13,
|
|
292
|
+
13,
|
|
293
|
+
0,
|
|
294
|
+
0
|
|
295
|
+
]);
|
|
296
|
+
var clim = new u8([
|
|
297
|
+
16,
|
|
298
|
+
17,
|
|
299
|
+
18,
|
|
300
|
+
0,
|
|
301
|
+
8,
|
|
302
|
+
7,
|
|
303
|
+
9,
|
|
304
|
+
6,
|
|
305
|
+
10,
|
|
306
|
+
5,
|
|
307
|
+
11,
|
|
308
|
+
4,
|
|
309
|
+
12,
|
|
310
|
+
3,
|
|
311
|
+
13,
|
|
312
|
+
2,
|
|
313
|
+
14,
|
|
314
|
+
1,
|
|
315
|
+
15
|
|
316
|
+
]);
|
|
317
|
+
var freb = function(eb, start) {
|
|
318
|
+
var b = new u16(31);
|
|
319
|
+
for(var i = 0; i < 31; ++i)b[i] = start += 1 << eb[i - 1];
|
|
320
|
+
var r = new i32(b[30]);
|
|
321
|
+
for(var i = 1; i < 30; ++i)for(var j = b[i]; j < b[i + 1]; ++j)r[j] = j - b[i] << 5 | i;
|
|
322
|
+
return {
|
|
323
|
+
b: b,
|
|
324
|
+
r: r
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
var esm_a = freb(fleb, 2), esm_fl = esm_a.b, revfl = esm_a.r;
|
|
328
|
+
esm_fl[28] = 258, revfl[258] = 28;
|
|
329
|
+
var esm_b = freb(fdeb, 0), fd = esm_b.b;
|
|
330
|
+
esm_b.r;
|
|
331
|
+
var rev = new u16(32768);
|
|
332
|
+
for(var esm_i = 0; esm_i < 32768; ++esm_i){
|
|
333
|
+
var x = (0xAAAA & esm_i) >> 1 | (0x5555 & esm_i) << 1;
|
|
334
|
+
x = (0xCCCC & x) >> 2 | (0x3333 & x) << 2;
|
|
335
|
+
x = (0xF0F0 & x) >> 4 | (0x0F0F & x) << 4;
|
|
336
|
+
rev[esm_i] = ((0xFF00 & x) >> 8 | (0x00FF & x) << 8) >> 1;
|
|
337
|
+
}
|
|
338
|
+
var hMap = function(cd, mb, r) {
|
|
339
|
+
var s = cd.length;
|
|
340
|
+
var i = 0;
|
|
341
|
+
var l = new u16(mb);
|
|
342
|
+
for(; i < s; ++i)if (cd[i]) ++l[cd[i] - 1];
|
|
343
|
+
var le = new u16(mb);
|
|
344
|
+
for(i = 1; i < mb; ++i)le[i] = le[i - 1] + l[i - 1] << 1;
|
|
345
|
+
var co;
|
|
346
|
+
if (r) {
|
|
347
|
+
co = new u16(1 << mb);
|
|
348
|
+
var rvb = 15 - mb;
|
|
349
|
+
for(i = 0; i < s; ++i)if (cd[i]) {
|
|
350
|
+
var sv = i << 4 | cd[i];
|
|
351
|
+
var r_1 = mb - cd[i];
|
|
352
|
+
var v = le[cd[i] - 1]++ << r_1;
|
|
353
|
+
for(var m = v | (1 << r_1) - 1; v <= m; ++v)co[rev[v] >> rvb] = sv;
|
|
354
|
+
}
|
|
355
|
+
} else {
|
|
356
|
+
co = new u16(s);
|
|
357
|
+
for(i = 0; i < s; ++i)if (cd[i]) co[i] = rev[le[cd[i] - 1]++] >> 15 - cd[i];
|
|
358
|
+
}
|
|
359
|
+
return co;
|
|
360
|
+
};
|
|
361
|
+
var flt = new u8(288);
|
|
362
|
+
for(var esm_i = 0; esm_i < 144; ++esm_i)flt[esm_i] = 8;
|
|
363
|
+
for(var esm_i = 144; esm_i < 256; ++esm_i)flt[esm_i] = 9;
|
|
364
|
+
for(var esm_i = 256; esm_i < 280; ++esm_i)flt[esm_i] = 7;
|
|
365
|
+
for(var esm_i = 280; esm_i < 288; ++esm_i)flt[esm_i] = 8;
|
|
366
|
+
var fdt = new u8(32);
|
|
367
|
+
for(var esm_i = 0; esm_i < 32; ++esm_i)fdt[esm_i] = 5;
|
|
368
|
+
var flrm = /*#__PURE__*/ hMap(flt, 9, 1);
|
|
369
|
+
var fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);
|
|
370
|
+
var esm_max = function(a) {
|
|
371
|
+
var m = a[0];
|
|
372
|
+
for(var i = 1; i < a.length; ++i)if (a[i] > m) m = a[i];
|
|
373
|
+
return m;
|
|
374
|
+
};
|
|
375
|
+
var bits = function(d, p, m) {
|
|
376
|
+
var o = p / 8 | 0;
|
|
377
|
+
return (d[o] | d[o + 1] << 8) >> (7 & p) & m;
|
|
378
|
+
};
|
|
379
|
+
var bits16 = function(d, p) {
|
|
380
|
+
var o = p / 8 | 0;
|
|
381
|
+
return (d[o] | d[o + 1] << 8 | d[o + 2] << 16) >> (7 & p);
|
|
382
|
+
};
|
|
383
|
+
var shft = function(p) {
|
|
384
|
+
return (p + 7) / 8 | 0;
|
|
385
|
+
};
|
|
386
|
+
var slc = function(v, s, e) {
|
|
387
|
+
if (null == s || s < 0) s = 0;
|
|
388
|
+
if (null == e || e > v.length) e = v.length;
|
|
389
|
+
return new u8(v.subarray(s, e));
|
|
390
|
+
};
|
|
391
|
+
var ec = [
|
|
392
|
+
'unexpected EOF',
|
|
393
|
+
'invalid block type',
|
|
394
|
+
'invalid length/literal',
|
|
395
|
+
'invalid distance',
|
|
396
|
+
'stream finished',
|
|
397
|
+
'no stream handler',
|
|
398
|
+
,
|
|
399
|
+
'no callback',
|
|
400
|
+
'invalid UTF-8 data',
|
|
401
|
+
'extra field too long',
|
|
402
|
+
'date not in range 1980-2099',
|
|
403
|
+
'filename too long',
|
|
404
|
+
'stream finishing',
|
|
405
|
+
'invalid zip data'
|
|
406
|
+
];
|
|
407
|
+
var esm_err = function(ind, msg, nt) {
|
|
408
|
+
var e = new Error(msg || ec[ind]);
|
|
409
|
+
e.code = ind;
|
|
410
|
+
if (Error.captureStackTrace) Error.captureStackTrace(e, esm_err);
|
|
411
|
+
if (!nt) throw e;
|
|
412
|
+
return e;
|
|
413
|
+
};
|
|
414
|
+
var inflt = function(dat, st, buf, dict) {
|
|
415
|
+
var sl = dat.length, dl = dict ? dict.length : 0;
|
|
416
|
+
if (!sl || st.f && !st.l) return buf || new u8(0);
|
|
417
|
+
var noBuf = !buf;
|
|
418
|
+
var resize = noBuf || 2 != st.i;
|
|
419
|
+
var noSt = st.i;
|
|
420
|
+
if (noBuf) buf = new u8(3 * sl);
|
|
421
|
+
var cbuf = function(l) {
|
|
422
|
+
var bl = buf.length;
|
|
423
|
+
if (l > bl) {
|
|
424
|
+
var nbuf = new u8(Math.max(2 * bl, l));
|
|
425
|
+
nbuf.set(buf);
|
|
426
|
+
buf = nbuf;
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;
|
|
430
|
+
var tbts = 8 * sl;
|
|
431
|
+
do {
|
|
432
|
+
if (!lm) {
|
|
433
|
+
final = bits(dat, pos, 1);
|
|
434
|
+
var type = bits(dat, pos + 1, 3);
|
|
435
|
+
pos += 3;
|
|
436
|
+
if (type) if (1 == type) lm = flrm, dm = fdrm, lbt = 9, dbt = 5;
|
|
437
|
+
else if (2 == type) {
|
|
438
|
+
var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;
|
|
439
|
+
var tl = hLit + bits(dat, pos + 5, 31) + 1;
|
|
440
|
+
pos += 14;
|
|
441
|
+
var ldt = new u8(tl);
|
|
442
|
+
var clt = new u8(19);
|
|
443
|
+
for(var i = 0; i < hcLen; ++i)clt[clim[i]] = bits(dat, pos + 3 * i, 7);
|
|
444
|
+
pos += 3 * hcLen;
|
|
445
|
+
var clb = esm_max(clt), clbmsk = (1 << clb) - 1;
|
|
446
|
+
var clm = hMap(clt, clb, 1);
|
|
447
|
+
for(var i = 0; i < tl;){
|
|
448
|
+
var r = clm[bits(dat, pos, clbmsk)];
|
|
449
|
+
pos += 15 & r;
|
|
450
|
+
var s = r >> 4;
|
|
451
|
+
if (s < 16) ldt[i++] = s;
|
|
452
|
+
else {
|
|
453
|
+
var c = 0, n = 0;
|
|
454
|
+
if (16 == s) n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];
|
|
455
|
+
else if (17 == s) n = 3 + bits(dat, pos, 7), pos += 3;
|
|
456
|
+
else if (18 == s) n = 11 + bits(dat, pos, 127), pos += 7;
|
|
457
|
+
while(n--)ldt[i++] = c;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);
|
|
461
|
+
lbt = esm_max(lt);
|
|
462
|
+
dbt = esm_max(dt);
|
|
463
|
+
lm = hMap(lt, lbt, 1);
|
|
464
|
+
dm = hMap(dt, dbt, 1);
|
|
465
|
+
} else esm_err(1);
|
|
466
|
+
else {
|
|
467
|
+
var s = shft(pos) + 4, l = dat[s - 4] | dat[s - 3] << 8, t = s + l;
|
|
468
|
+
if (t > sl) {
|
|
469
|
+
if (noSt) esm_err(0);
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
if (resize) cbuf(bt + l);
|
|
473
|
+
buf.set(dat.subarray(s, t), bt);
|
|
474
|
+
st.b = bt += l, st.p = pos = 8 * t, st.f = final;
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
if (pos > tbts) {
|
|
478
|
+
if (noSt) esm_err(0);
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
if (resize) cbuf(bt + 131072);
|
|
483
|
+
var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;
|
|
484
|
+
var lpos = pos;
|
|
485
|
+
for(;; lpos = pos){
|
|
486
|
+
var c = lm[bits16(dat, pos) & lms], sym = c >> 4;
|
|
487
|
+
pos += 15 & c;
|
|
488
|
+
if (pos > tbts) {
|
|
489
|
+
if (noSt) esm_err(0);
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
if (!c) esm_err(2);
|
|
493
|
+
if (sym < 256) buf[bt++] = sym;
|
|
494
|
+
else if (256 == sym) {
|
|
495
|
+
lpos = pos, lm = null;
|
|
496
|
+
break;
|
|
497
|
+
} else {
|
|
498
|
+
var add = sym - 254;
|
|
499
|
+
if (sym > 264) {
|
|
500
|
+
var i = sym - 257, b = fleb[i];
|
|
501
|
+
add = bits(dat, pos, (1 << b) - 1) + esm_fl[i];
|
|
502
|
+
pos += b;
|
|
503
|
+
}
|
|
504
|
+
var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;
|
|
505
|
+
if (!d) esm_err(3);
|
|
506
|
+
pos += 15 & d;
|
|
507
|
+
var dt = fd[dsym];
|
|
508
|
+
if (dsym > 3) {
|
|
509
|
+
var b = fdeb[dsym];
|
|
510
|
+
dt += bits16(dat, pos) & (1 << b) - 1, pos += b;
|
|
511
|
+
}
|
|
512
|
+
if (pos > tbts) {
|
|
513
|
+
if (noSt) esm_err(0);
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
if (resize) cbuf(bt + 131072);
|
|
517
|
+
var end = bt + add;
|
|
518
|
+
if (bt < dt) {
|
|
519
|
+
var shift = dl - dt, dend = Math.min(dt, end);
|
|
520
|
+
if (shift + bt < 0) esm_err(3);
|
|
521
|
+
for(; bt < dend; ++bt)buf[bt] = dict[shift + bt];
|
|
522
|
+
}
|
|
523
|
+
for(; bt < end; ++bt)buf[bt] = buf[bt - dt];
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
st.l = lm, st.p = lpos, st.b = bt, st.f = final;
|
|
527
|
+
if (lm) final = 1, st.m = lbt, st.d = dm, st.n = dbt;
|
|
528
|
+
}while (!final);
|
|
529
|
+
return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);
|
|
530
|
+
};
|
|
531
|
+
var et = /*#__PURE__*/ new u8(0);
|
|
532
|
+
var gzs = function(d) {
|
|
533
|
+
if (31 != d[0] || 139 != d[1] || 8 != d[2]) esm_err(6, 'invalid gzip data');
|
|
534
|
+
var flg = d[3];
|
|
535
|
+
var st = 10;
|
|
536
|
+
if (4 & flg) st += (d[10] | d[11] << 8) + 2;
|
|
537
|
+
for(var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++]);
|
|
538
|
+
return st + (2 & flg);
|
|
539
|
+
};
|
|
540
|
+
var esm_Inflate = /*#__PURE__*/ function() {
|
|
541
|
+
function Inflate(opts, cb) {
|
|
542
|
+
if ('function' == typeof opts) cb = opts, opts = {};
|
|
543
|
+
this.ondata = cb;
|
|
544
|
+
var dict = opts && opts.dictionary && opts.dictionary.subarray(-32768);
|
|
545
|
+
this.s = {
|
|
546
|
+
i: 0,
|
|
547
|
+
b: dict ? dict.length : 0
|
|
548
|
+
};
|
|
549
|
+
this.o = new u8(32768);
|
|
550
|
+
this.p = new u8(0);
|
|
551
|
+
if (dict) this.o.set(dict);
|
|
552
|
+
}
|
|
553
|
+
Inflate.prototype.e = function(c) {
|
|
554
|
+
if (!this.ondata) esm_err(5);
|
|
555
|
+
if (this.d) esm_err(4);
|
|
556
|
+
if (this.p.length) {
|
|
557
|
+
if (c.length) {
|
|
558
|
+
var n = new u8(this.p.length + c.length);
|
|
559
|
+
n.set(this.p), n.set(c, this.p.length), this.p = n;
|
|
560
|
+
}
|
|
561
|
+
} else this.p = c;
|
|
562
|
+
};
|
|
563
|
+
Inflate.prototype.c = function(final) {
|
|
564
|
+
this.s.i = +(this.d = final || false);
|
|
565
|
+
var bts = this.s.b;
|
|
566
|
+
var dt = inflt(this.p, this.s, this.o);
|
|
567
|
+
this.ondata(slc(dt, bts, this.s.b), this.d);
|
|
568
|
+
this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;
|
|
569
|
+
this.p = slc(this.p, this.s.p / 8 | 0), this.s.p &= 7;
|
|
570
|
+
};
|
|
571
|
+
Inflate.prototype.push = function(chunk, final) {
|
|
572
|
+
this.e(chunk), this.c(final);
|
|
573
|
+
};
|
|
574
|
+
return Inflate;
|
|
575
|
+
}();
|
|
576
|
+
var esm_Gunzip = /*#__PURE__*/ function() {
|
|
577
|
+
function Gunzip(opts, cb) {
|
|
578
|
+
this.v = 1;
|
|
579
|
+
this.r = 0;
|
|
580
|
+
esm_Inflate.call(this, opts, cb);
|
|
581
|
+
}
|
|
582
|
+
Gunzip.prototype.push = function(chunk, final) {
|
|
583
|
+
esm_Inflate.prototype.e.call(this, chunk);
|
|
584
|
+
this.r += chunk.length;
|
|
585
|
+
if (this.v) {
|
|
586
|
+
var p = this.p.subarray(this.v - 1);
|
|
587
|
+
var s = p.length > 3 ? gzs(p) : 4;
|
|
588
|
+
if (s > p.length) {
|
|
589
|
+
if (!final) return;
|
|
590
|
+
} else if (this.v > 1 && this.onmember) this.onmember(this.r - p.length);
|
|
591
|
+
this.p = p.subarray(s), this.v = 0;
|
|
592
|
+
}
|
|
593
|
+
esm_Inflate.prototype.c.call(this, final);
|
|
594
|
+
if (this.s.f && !this.s.l && !final) {
|
|
595
|
+
this.v = shft(this.s.p) + 9;
|
|
596
|
+
this.s = {
|
|
597
|
+
i: 0
|
|
598
|
+
};
|
|
599
|
+
this.o = new u8(0);
|
|
600
|
+
this.push(new u8(0), final);
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
return Gunzip;
|
|
604
|
+
}();
|
|
605
|
+
var esm_td = "u" > typeof TextDecoder && /*#__PURE__*/ new TextDecoder();
|
|
606
|
+
try {
|
|
607
|
+
esm_td.decode(et, {
|
|
608
|
+
stream: true
|
|
609
|
+
});
|
|
610
|
+
} catch (e) {}
|
|
611
|
+
'function' == typeof queueMicrotask ? queueMicrotask : 'function' == typeof setTimeout && setTimeout;
|
|
612
|
+
__webpack_require__("./node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js");
|
|
613
|
+
const untar = __webpack_require__("./node_modules/.pnpm/@andrewbranch+untar.js@1.0.3/node_modules/@andrewbranch/untar.js/lib/untar.js");
|
|
614
|
+
var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
|
|
615
|
+
if ("m" === kind) throw new TypeError("Private method is not writable");
|
|
616
|
+
if ("a" === kind && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
617
|
+
if ("function" == typeof state ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
618
|
+
return "a" === kind ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
619
|
+
};
|
|
620
|
+
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
621
|
+
if ("a" === kind && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
622
|
+
if ("function" == typeof state ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
623
|
+
return "m" === kind ? f : "a" === kind ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
624
|
+
};
|
|
625
|
+
var _Package_files;
|
|
626
|
+
class Package {
|
|
627
|
+
constructor(files, packageName, packageVersion, resolvedUrl, typesPackage){
|
|
628
|
+
_Package_files.set(this, {});
|
|
629
|
+
__classPrivateFieldSet(this, _Package_files, files, "f");
|
|
630
|
+
this.packageName = packageName;
|
|
631
|
+
this.packageVersion = packageVersion;
|
|
632
|
+
this.resolvedUrl = resolvedUrl;
|
|
633
|
+
this.typesPackage = typesPackage;
|
|
634
|
+
}
|
|
635
|
+
tryReadFile(path) {
|
|
636
|
+
const file = __classPrivateFieldGet(this, _Package_files, "f")[path];
|
|
637
|
+
if (void 0 === file) return;
|
|
638
|
+
if ("string" == typeof file) return file;
|
|
639
|
+
const content = new TextDecoder().decode(file);
|
|
640
|
+
__classPrivateFieldGet(this, _Package_files, "f")[path] = content;
|
|
641
|
+
return content;
|
|
642
|
+
}
|
|
643
|
+
readFile(path) {
|
|
644
|
+
const content = this.tryReadFile(path);
|
|
645
|
+
if (void 0 === content) throw new Error(`File not found: ${path}`);
|
|
646
|
+
return content;
|
|
647
|
+
}
|
|
648
|
+
fileExists(path) {
|
|
649
|
+
return path in __classPrivateFieldGet(this, _Package_files, "f");
|
|
650
|
+
}
|
|
651
|
+
directoryExists(path) {
|
|
652
|
+
path = typescript.ensureTrailingDirectorySeparator(path);
|
|
653
|
+
for(const file in __classPrivateFieldGet(this, _Package_files, "f"))if (file.startsWith(path)) return true;
|
|
654
|
+
return false;
|
|
655
|
+
}
|
|
656
|
+
containsTypes(directory = "/") {
|
|
657
|
+
return this.listFiles(directory).some(typescript.hasTSFileExtension);
|
|
658
|
+
}
|
|
659
|
+
listFiles(directory = "/") {
|
|
660
|
+
directory = typescript.ensureTrailingDirectorySeparator(directory);
|
|
661
|
+
return "/" === directory ? Object.keys(__classPrivateFieldGet(this, _Package_files, "f")) : Object.keys(__classPrivateFieldGet(this, _Package_files, "f")).filter((f)=>f.startsWith(directory));
|
|
662
|
+
}
|
|
663
|
+
mergedWithTypes(typesPackage) {
|
|
664
|
+
const files = {
|
|
665
|
+
...__classPrivateFieldGet(this, _Package_files, "f"),
|
|
666
|
+
...__classPrivateFieldGet(typesPackage, _Package_files, "f")
|
|
667
|
+
};
|
|
668
|
+
return new Package(files, this.packageName, this.packageVersion, this.resolvedUrl, {
|
|
669
|
+
packageName: typesPackage.packageName,
|
|
670
|
+
packageVersion: typesPackage.packageVersion,
|
|
671
|
+
resolvedUrl: typesPackage.resolvedUrl
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
_Package_files = new WeakMap();
|
|
676
|
+
function createPackageFromTarballData(tarball) {
|
|
677
|
+
const { files, packageName, packageVersion } = extractTarball(tarball);
|
|
678
|
+
return new Package(files, packageName, packageVersion);
|
|
679
|
+
}
|
|
680
|
+
function extractTarball(tarball) {
|
|
681
|
+
var _a;
|
|
682
|
+
let unzipped;
|
|
683
|
+
new esm_Gunzip((chunk)=>unzipped = chunk).push(tarball, true);
|
|
684
|
+
const data = (0, untar.P)(unzipped);
|
|
685
|
+
const prefix = data[0].filename.substring(0, data[0].filename.indexOf("/") + 1);
|
|
686
|
+
const packageJsonText = null == (_a = data.find((f)=>f.filename === `${prefix}package.json`)) ? void 0 : _a.fileData;
|
|
687
|
+
const packageJson = JSON.parse(new TextDecoder().decode(packageJsonText));
|
|
688
|
+
const packageName = packageJson.name;
|
|
689
|
+
const packageVersion = packageJson.version;
|
|
690
|
+
const files = data.reduce((acc, file)=>{
|
|
691
|
+
acc[typescript.combinePaths("/node_modules/" + packageName, file.filename.substring(prefix.length))] = file.fileData;
|
|
692
|
+
return acc;
|
|
693
|
+
}, {});
|
|
694
|
+
return {
|
|
695
|
+
files,
|
|
696
|
+
packageName,
|
|
697
|
+
packageVersion
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
function* extractDestructedNames(node) {
|
|
701
|
+
switch(node.kind){
|
|
702
|
+
case typescript.SyntaxKind.ArrayBindingPattern:
|
|
703
|
+
for (const element of node.elements)if (element.kind === typescript.SyntaxKind.BindingElement) yield* extractDestructedNames(element.name);
|
|
704
|
+
break;
|
|
705
|
+
case typescript.SyntaxKind.Identifier:
|
|
706
|
+
yield node.text;
|
|
707
|
+
break;
|
|
708
|
+
case typescript.SyntaxKind.ObjectBindingPattern:
|
|
709
|
+
for (const element of node.elements)yield* extractDestructedNames(element.name);
|
|
710
|
+
break;
|
|
711
|
+
default:
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
function getEsmModuleBindings(sourceText) {
|
|
715
|
+
const options = {
|
|
716
|
+
languageVersion: typescript.ScriptTarget.ESNext,
|
|
717
|
+
impliedNodeFormat: typescript.ModuleKind.ESNext
|
|
718
|
+
};
|
|
719
|
+
const sourceFile = typescript.createSourceFile("module.cjs", sourceText, options, false, typescript.ScriptKind.JS);
|
|
720
|
+
const exports = [];
|
|
721
|
+
const reexports = [];
|
|
722
|
+
for (const statement of sourceFile.statements)switch(statement.kind){
|
|
723
|
+
case typescript.SyntaxKind.ExportDeclaration:
|
|
724
|
+
{
|
|
725
|
+
const declaration = statement;
|
|
726
|
+
const { exportClause } = declaration;
|
|
727
|
+
if (!declaration.isTypeOnly) {
|
|
728
|
+
if (exportClause) if (exportClause.kind === typescript.SyntaxKind.NamedExports) {
|
|
729
|
+
for (const element of exportClause.elements)if (!element.isTypeOnly) exports.push(element.name.text);
|
|
730
|
+
} else exports.push(exportClause.name.text);
|
|
731
|
+
else if (declaration.moduleSpecifier && typescript.isStringLiteral(declaration.moduleSpecifier)) reexports.push(declaration.moduleSpecifier.text);
|
|
732
|
+
}
|
|
733
|
+
break;
|
|
734
|
+
}
|
|
735
|
+
case typescript.SyntaxKind.ExportAssignment:
|
|
736
|
+
{
|
|
737
|
+
const assignment = statement;
|
|
738
|
+
if (!assignment.isExportEquals) exports.push("default");
|
|
739
|
+
break;
|
|
740
|
+
}
|
|
741
|
+
case typescript.SyntaxKind.ClassDeclaration:
|
|
742
|
+
case typescript.SyntaxKind.FunctionDeclaration:
|
|
743
|
+
{
|
|
744
|
+
const declaration = statement;
|
|
745
|
+
if (typescript.hasSyntacticModifier(declaration, typescript.ModifierFlags.Export)) {
|
|
746
|
+
if (typescript.hasSyntacticModifier(declaration, typescript.ModifierFlags.Default)) exports.push("default");
|
|
747
|
+
else if (declaration.name) exports.push(declaration.name.text);
|
|
748
|
+
}
|
|
749
|
+
break;
|
|
750
|
+
}
|
|
751
|
+
case typescript.SyntaxKind.VariableStatement:
|
|
752
|
+
{
|
|
753
|
+
const declaration = statement;
|
|
754
|
+
if (typescript.hasSyntacticModifier(declaration, typescript.ModifierFlags.Export)) for (const declarator of declaration.declarationList.declarations)exports.push(...extractDestructedNames(declarator.name));
|
|
755
|
+
break;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
return {
|
|
759
|
+
exports,
|
|
760
|
+
reexports
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
function getCjsModuleBindings(sourceText) {
|
|
764
|
+
return parse(sourceText);
|
|
765
|
+
}
|
|
766
|
+
const Pull = Symbol.for("Task.Pull");
|
|
767
|
+
function acquire(value) {
|
|
768
|
+
let initial = value;
|
|
769
|
+
return ()=>{
|
|
770
|
+
if (initial === Never) throw new Error("Value was acquired more than once");
|
|
771
|
+
const result = initial;
|
|
772
|
+
initial = Never;
|
|
773
|
+
return result;
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
const Never = Symbol("Never");
|
|
777
|
+
function pull(pullable, signal, channel) {
|
|
778
|
+
if (signal.aborted) return void channel.halt(signal.reason);
|
|
779
|
+
if (null !== pullable && "object" == typeof pullable) {
|
|
780
|
+
if (Pull in pullable) return void pullable[Pull](signal, channel);
|
|
781
|
+
else if ("function" == typeof pullable.then) {
|
|
782
|
+
const forwardAbort = ()=>{
|
|
783
|
+
send = ()=>{};
|
|
784
|
+
channel.halt(signal.reason);
|
|
785
|
+
};
|
|
786
|
+
signal.addEventListener("abort", forwardAbort);
|
|
787
|
+
let send = (receive)=>{
|
|
788
|
+
signal.removeEventListener("abort", forwardAbort);
|
|
789
|
+
receive(channel);
|
|
790
|
+
};
|
|
791
|
+
pullable.then((value)=>send((channel)=>channel.resolve(value)), (error)=>send((channel)=>channel.reject(error)));
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
} else if (void 0 === pullable) return void channel.resolve(void 0);
|
|
795
|
+
channel.reject(new Error("Yielded value is not pullable"));
|
|
796
|
+
}
|
|
797
|
+
class HaltHolder {
|
|
798
|
+
reason;
|
|
799
|
+
constructor(reason){
|
|
800
|
+
this.reason = reason;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
function resolveMaybeHalt(channel, value) {
|
|
804
|
+
if (value instanceof HaltHolder) channel.halt(value.reason);
|
|
805
|
+
else channel.resolve(value);
|
|
806
|
+
}
|
|
807
|
+
function driver(signal, channel, task) {
|
|
808
|
+
if (signal.aborted) {
|
|
809
|
+
try {
|
|
810
|
+
if (!task.next().done) task.return(void 0);
|
|
811
|
+
channel.halt(signal.reason);
|
|
812
|
+
} catch (error) {
|
|
813
|
+
channel.reject(error);
|
|
814
|
+
}
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
const abortController = new AbortController();
|
|
818
|
+
const forwardAbort = ()=>{
|
|
819
|
+
abortController.abort(signal.reason);
|
|
820
|
+
};
|
|
821
|
+
signal.addEventListener("abort", forwardAbort);
|
|
822
|
+
const cleanup = ()=>{
|
|
823
|
+
signal.removeEventListener("abort", forwardAbort);
|
|
824
|
+
abortController.abort("Terminated");
|
|
825
|
+
};
|
|
826
|
+
const resumeDriver = (operation)=>{
|
|
827
|
+
try {
|
|
828
|
+
let next = operation;
|
|
829
|
+
let step = (operation)=>{
|
|
830
|
+
next = operation;
|
|
831
|
+
};
|
|
832
|
+
const stepChannel = {
|
|
833
|
+
resolve: (value)=>step(()=>task.next(value)),
|
|
834
|
+
reject: (reason)=>step(()=>task.throw(reason)),
|
|
835
|
+
halt: (reason)=>step(()=>task.return(new HaltHolder(reason)))
|
|
836
|
+
};
|
|
837
|
+
do {
|
|
838
|
+
const result = next();
|
|
839
|
+
next = null;
|
|
840
|
+
if (result.done) {
|
|
841
|
+
cleanup();
|
|
842
|
+
resolveMaybeHalt(channel, result.value);
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
pull(result.value, abortController.signal, stepChannel);
|
|
846
|
+
}while (next);
|
|
847
|
+
step = resumeDriver;
|
|
848
|
+
} catch (error) {
|
|
849
|
+
cleanup();
|
|
850
|
+
channel.reject(error);
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
resumeDriver(()=>task.next());
|
|
854
|
+
}
|
|
855
|
+
class Future {
|
|
856
|
+
replay = null;
|
|
857
|
+
pending = [];
|
|
858
|
+
constructor(executor){
|
|
859
|
+
const settle = (replay)=>{
|
|
860
|
+
this.replay = replay;
|
|
861
|
+
for (const channel of this.pending.splice(0))replay(channel);
|
|
862
|
+
};
|
|
863
|
+
executor((value)=>settle((channel)=>channel.resolve(value)), (error)=>settle((channel)=>channel.reject(error)), (reason)=>settle((channel)=>channel.halt(reason)));
|
|
864
|
+
}
|
|
865
|
+
static resolve(value) {
|
|
866
|
+
return new Future((resolve)=>resolve(value));
|
|
867
|
+
}
|
|
868
|
+
static reject(reason) {
|
|
869
|
+
return new Future((resolve, reject)=>reject(reason));
|
|
870
|
+
}
|
|
871
|
+
static halt(reason) {
|
|
872
|
+
return new Future((resolve, reject, halt)=>halt(reason));
|
|
873
|
+
}
|
|
874
|
+
[Pull](signal, channel) {
|
|
875
|
+
if (null === this.replay) this.pending.push(channel);
|
|
876
|
+
else this.replay(channel);
|
|
877
|
+
}
|
|
878
|
+
continue(halted) {
|
|
879
|
+
return new Promise((resolve, reject)=>{
|
|
880
|
+
this[Pull](null, {
|
|
881
|
+
resolve,
|
|
882
|
+
reject,
|
|
883
|
+
halt (reason) {
|
|
884
|
+
try {
|
|
885
|
+
resolve(halted?.(reason));
|
|
886
|
+
} catch (error) {
|
|
887
|
+
reject(error);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
});
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
then(resolved, rejected) {
|
|
894
|
+
const promise = new Promise((resolve, reject)=>{
|
|
895
|
+
this[Pull](null, {
|
|
896
|
+
resolve,
|
|
897
|
+
reject,
|
|
898
|
+
halt (reason) {
|
|
899
|
+
reject(new Error(`Future was halted with reason: ${reason}`));
|
|
900
|
+
}
|
|
901
|
+
});
|
|
902
|
+
});
|
|
903
|
+
return promise.then(resolved, rejected);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
function begin(task, { signal } = {}) {
|
|
907
|
+
return pullAsFuture(task, signal);
|
|
908
|
+
}
|
|
909
|
+
function task_task(body, { signal } = {}) {
|
|
910
|
+
let future;
|
|
911
|
+
const holder = acquire(body());
|
|
912
|
+
const pullable = {
|
|
913
|
+
[Pull] (pullSignal, channel) {
|
|
914
|
+
const combinedSignal = function() {
|
|
915
|
+
if (!signal) return pullSignal;
|
|
916
|
+
if (signal.aborted) return signal;
|
|
917
|
+
{
|
|
918
|
+
const controller = new AbortController();
|
|
919
|
+
const cleanup = ()=>{
|
|
920
|
+
signal.removeEventListener("abort", handleSignal);
|
|
921
|
+
pullSignal.removeEventListener("abort", handlePullSignal);
|
|
922
|
+
};
|
|
923
|
+
const handleSignal = ()=>{
|
|
924
|
+
cleanup();
|
|
925
|
+
controller.abort(signal.reason);
|
|
926
|
+
};
|
|
927
|
+
const handlePullSignal = ()=>{
|
|
928
|
+
cleanup();
|
|
929
|
+
controller.abort(pullSignal.reason);
|
|
930
|
+
};
|
|
931
|
+
signal.addEventListener("abort", handleSignal);
|
|
932
|
+
pullSignal.addEventListener("abort", handlePullSignal);
|
|
933
|
+
return controller.signal;
|
|
934
|
+
}
|
|
935
|
+
}();
|
|
936
|
+
driver(combinedSignal, channel, holder());
|
|
937
|
+
},
|
|
938
|
+
then (resolve, reject) {
|
|
939
|
+
future ??= pullAsFuture(pullable, signal);
|
|
940
|
+
return future.then(resolve, reject);
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
return pullable;
|
|
944
|
+
}
|
|
945
|
+
function pullAsFuture(pullable, signal) {
|
|
946
|
+
return new Future((resolve, reject, abort)=>pullable[Pull](signal ?? new AbortController().signal, {
|
|
947
|
+
resolve,
|
|
948
|
+
reject,
|
|
949
|
+
halt: abort
|
|
950
|
+
}));
|
|
951
|
+
}
|
|
952
|
+
function expect(pullable) {
|
|
953
|
+
const controller = new AbortController();
|
|
954
|
+
let send = ()=>{
|
|
955
|
+
const error = new Error("Expected value was not resolved");
|
|
956
|
+
controller.abort(error);
|
|
957
|
+
throw error;
|
|
958
|
+
};
|
|
959
|
+
pullable[Pull](controller.signal, {
|
|
960
|
+
resolve (value) {
|
|
961
|
+
send = ()=>value;
|
|
962
|
+
},
|
|
963
|
+
reject (error) {
|
|
964
|
+
controller.abort(error);
|
|
965
|
+
send = ()=>{
|
|
966
|
+
throw error;
|
|
967
|
+
};
|
|
968
|
+
},
|
|
969
|
+
halt (reason) {
|
|
970
|
+
send = ()=>{
|
|
971
|
+
throw new Error(`Expected value was halted with reason: ${reason}`);
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
return send();
|
|
976
|
+
}
|
|
977
|
+
function makeFileSystemSyncAdapter(fs) {
|
|
978
|
+
return {
|
|
979
|
+
*directoryExists (path) {
|
|
980
|
+
return fs.directoryExists(path);
|
|
981
|
+
},
|
|
982
|
+
*fileExists (path) {
|
|
983
|
+
return fs.fileExists(path);
|
|
984
|
+
},
|
|
985
|
+
*readFileJSON (path) {
|
|
986
|
+
return fs.readFileJSON(path);
|
|
987
|
+
},
|
|
988
|
+
*readLink (path) {
|
|
989
|
+
return fs.readLink(path);
|
|
990
|
+
}
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
const nodeCoreModules = [
|
|
994
|
+
"assert",
|
|
995
|
+
"assert/strict",
|
|
996
|
+
"async_hooks",
|
|
997
|
+
"buffer",
|
|
998
|
+
"child_process",
|
|
999
|
+
"cluster",
|
|
1000
|
+
"console",
|
|
1001
|
+
"constants",
|
|
1002
|
+
"crypto",
|
|
1003
|
+
"dgram",
|
|
1004
|
+
"diagnostics_channel",
|
|
1005
|
+
"dns",
|
|
1006
|
+
"dns/promises",
|
|
1007
|
+
"domain",
|
|
1008
|
+
"events",
|
|
1009
|
+
"fs",
|
|
1010
|
+
"fs/promises",
|
|
1011
|
+
"http",
|
|
1012
|
+
"http2",
|
|
1013
|
+
"https",
|
|
1014
|
+
"inspector",
|
|
1015
|
+
"inspector/promises",
|
|
1016
|
+
"module",
|
|
1017
|
+
"net",
|
|
1018
|
+
"os",
|
|
1019
|
+
"path",
|
|
1020
|
+
"path/posix",
|
|
1021
|
+
"path/win32",
|
|
1022
|
+
"perf_hooks",
|
|
1023
|
+
"process",
|
|
1024
|
+
"punycode",
|
|
1025
|
+
"querystring",
|
|
1026
|
+
"readline",
|
|
1027
|
+
"readline/promises",
|
|
1028
|
+
"repl",
|
|
1029
|
+
"stream",
|
|
1030
|
+
"stream/consumers",
|
|
1031
|
+
"stream/promises",
|
|
1032
|
+
"stream/web",
|
|
1033
|
+
"string_decoder",
|
|
1034
|
+
"sys",
|
|
1035
|
+
"test",
|
|
1036
|
+
"test/reporters",
|
|
1037
|
+
"timers",
|
|
1038
|
+
"timers/promises",
|
|
1039
|
+
"tls",
|
|
1040
|
+
"trace_events",
|
|
1041
|
+
"tty",
|
|
1042
|
+
"url",
|
|
1043
|
+
"util",
|
|
1044
|
+
"util/types",
|
|
1045
|
+
"v8",
|
|
1046
|
+
"vm",
|
|
1047
|
+
"wasi",
|
|
1048
|
+
"worker_threads",
|
|
1049
|
+
"zlib"
|
|
1050
|
+
];
|
|
1051
|
+
function resolveSync(fs, specifier, parentURL) {
|
|
1052
|
+
return expect(begin(task_task(()=>resolver(makeFileSystemSyncAdapter(fs), specifier, parentURL))));
|
|
1053
|
+
}
|
|
1054
|
+
const defaultConditions = [
|
|
1055
|
+
"node",
|
|
1056
|
+
"import"
|
|
1057
|
+
];
|
|
1058
|
+
function* resolver(fs, specifier, parentURL) {
|
|
1059
|
+
const url = yield* function*() {
|
|
1060
|
+
if (URL.canParse(specifier)) return new URL(specifier);
|
|
1061
|
+
if (/^(\/|\.\.?\/)/.test(specifier)) return yield* resolveFileLinks(fs, new URL(specifier, parentURL));
|
|
1062
|
+
if (specifier.startsWith("#")) {
|
|
1063
|
+
const resolved = yield* packageImportsResolve(fs, specifier, parentURL, defaultConditions);
|
|
1064
|
+
return yield* resolveFileLinks(fs, resolved);
|
|
1065
|
+
}
|
|
1066
|
+
const resolved = yield* packageResolve(fs, specifier, parentURL);
|
|
1067
|
+
if ("node:" === resolved.protocol) return resolved;
|
|
1068
|
+
return yield* resolveFileLinks(fs, resolved);
|
|
1069
|
+
}();
|
|
1070
|
+
const format = yield* function*() {
|
|
1071
|
+
if ("file:" === url.protocol) {
|
|
1072
|
+
if (/%2f|%5c/i.test(url.href)) throw new Error("Invalid Module Specifier");
|
|
1073
|
+
if (yield* fs.directoryExists(url)) throw new Error("Unsupported Directory Import");
|
|
1074
|
+
if (!(yield* fs.fileExists(url))) throw new Error("Module Not Found");
|
|
1075
|
+
return yield* esmFileFormat(fs, url);
|
|
1076
|
+
}
|
|
1077
|
+
if ("node:" === url.protocol) return "builtin";
|
|
1078
|
+
}();
|
|
1079
|
+
return {
|
|
1080
|
+
format,
|
|
1081
|
+
url
|
|
1082
|
+
};
|
|
1083
|
+
}
|
|
1084
|
+
function* packageResolve(fs, packageSpecifier, parentURL) {
|
|
1085
|
+
if (nodeCoreModules.includes(packageSpecifier)) return new URL(`node:${packageSpecifier}`);
|
|
1086
|
+
const packageName = function() {
|
|
1087
|
+
if ("" === packageSpecifier) throw new Error("Invalid Module Specifier");
|
|
1088
|
+
if (packageSpecifier.startsWith("@")) {
|
|
1089
|
+
let slash = packageSpecifier.indexOf("/");
|
|
1090
|
+
if (-1 === slash) throw new Error("Invalid Module Specifier");
|
|
1091
|
+
slash = packageSpecifier.indexOf("/", slash + 1);
|
|
1092
|
+
return -1 === slash ? packageSpecifier : packageSpecifier.slice(0, slash);
|
|
1093
|
+
}
|
|
1094
|
+
{
|
|
1095
|
+
const slash = packageSpecifier.indexOf("/");
|
|
1096
|
+
return -1 === slash ? packageSpecifier : packageSpecifier.slice(0, slash);
|
|
1097
|
+
}
|
|
1098
|
+
}();
|
|
1099
|
+
if (packageName.startsWith(".") || packageName.includes("\\") || packageName.includes("%")) throw new Error("Invalid Module Specifier");
|
|
1100
|
+
const packageSubpath = `.${packageSpecifier.substring(packageName.length)}`;
|
|
1101
|
+
const selfUrl = yield* packageSelfResolve(fs, packageName, packageSubpath, parentURL);
|
|
1102
|
+
if (void 0 !== selfUrl) return selfUrl;
|
|
1103
|
+
const sentinel = new URL(`/node_modules/${packageName}/`, parentURL);
|
|
1104
|
+
let packageURL;
|
|
1105
|
+
do {
|
|
1106
|
+
packageURL = new URL(`node_modules/${packageName}/`, parentURL);
|
|
1107
|
+
parentURL = new URL("..", parentURL);
|
|
1108
|
+
if (!(yield* fs.directoryExists(packageURL))) continue;
|
|
1109
|
+
const pjson = yield* readPackageJson(fs, packageURL);
|
|
1110
|
+
packageURL = yield* resolveDirectoryLinks(fs, packageURL);
|
|
1111
|
+
if (pjson?.exports != null) return yield* packageExportsResolve(fs, packageURL, packageSubpath, pjson.exports, defaultConditions);
|
|
1112
|
+
if ("." === packageSubpath) {
|
|
1113
|
+
packageURL = yield* resolveDirectoryLinks(fs, packageURL);
|
|
1114
|
+
if ("string" == typeof pjson?.main) {
|
|
1115
|
+
if ("module" !== pjson.type) {
|
|
1116
|
+
const directoryFragment = pjson.main.endsWith("/") ? pjson.main : `${pjson.main}/`;
|
|
1117
|
+
if (yield* fs.directoryExists(new URL(directoryFragment, packageURL))) {
|
|
1118
|
+
const legacyResolution = yield* loadAsDirectory(fs, new URL(directoryFragment, packageURL), defaultExtensions);
|
|
1119
|
+
if (legacyResolution) return legacyResolution.url;
|
|
1120
|
+
} else {
|
|
1121
|
+
const legacyResolution = yield* loadAsFile(fs, pjson.main, packageURL, defaultExtensions);
|
|
1122
|
+
if (legacyResolution) return legacyResolution.url;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
return new URL(pjson.main, packageURL);
|
|
1126
|
+
}
|
|
1127
|
+
if (pjson?.type !== "module") {
|
|
1128
|
+
const legacyResolution = yield* loadIndex(fs, ".", packageURL, defaultExtensions);
|
|
1129
|
+
if (legacyResolution) return legacyResolution.url;
|
|
1130
|
+
}
|
|
1131
|
+
return new URL(packageSubpath, packageURL);
|
|
1132
|
+
}
|
|
1133
|
+
if (pjson?.type !== "module") {
|
|
1134
|
+
const legacyResolution = yield* loadAsFile(fs, packageSubpath, packageURL, defaultExtensions);
|
|
1135
|
+
if (legacyResolution) return legacyResolution.url;
|
|
1136
|
+
}
|
|
1137
|
+
}while (packageURL.href !== sentinel.href);
|
|
1138
|
+
throw new Error("Module Not Found");
|
|
1139
|
+
}
|
|
1140
|
+
function* packageSelfResolve(fs, packageName, packageSubpath, parentURL) {
|
|
1141
|
+
const packageURL = yield* lookupPackageScope(fs, parentURL);
|
|
1142
|
+
if (null === packageURL) return;
|
|
1143
|
+
const pjson = yield* readPackageJson(fs, packageURL);
|
|
1144
|
+
if (pjson?.exports == null) return;
|
|
1145
|
+
if (pjson.name === packageName) return yield* packageExportsResolve(fs, packageURL, packageSubpath, pjson.exports, defaultConditions);
|
|
1146
|
+
}
|
|
1147
|
+
function* packageExportsResolve(fs, packageURL, subpath, exports, conditions) {
|
|
1148
|
+
const exportsIsObject = "object" == typeof exports && null !== exports;
|
|
1149
|
+
const exportsKeys = exportsIsObject ? Object.keys(exports) : void 0;
|
|
1150
|
+
const hasDotKeys = exportsKeys?.some((key)=>key.startsWith("."));
|
|
1151
|
+
const hasNonDotKeys = exportsKeys?.some((key)=>!key.startsWith("."));
|
|
1152
|
+
if (hasDotKeys && hasNonDotKeys) throw new Error("Invalid Package Configuration");
|
|
1153
|
+
if ("." === subpath) {
|
|
1154
|
+
const mainExport = function() {
|
|
1155
|
+
if ("string" == typeof exports || Array.isArray(exports) || !hasDotKeys) return exports;
|
|
1156
|
+
if (exportsIsObject && "." in exports) return exports["."];
|
|
1157
|
+
}();
|
|
1158
|
+
if (void 0 !== mainExport) {
|
|
1159
|
+
const resolved = yield* packageTargetResolve(fs, packageURL, mainExport, null, false, conditions);
|
|
1160
|
+
if (null != resolved) return resolved;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
if (exportsIsObject && hasDotKeys && !hasNonDotKeys) {
|
|
1164
|
+
const exportRecord = exports;
|
|
1165
|
+
const resolved = yield* packageImportsExportsResolve(fs, subpath, exportRecord, packageURL, false, conditions);
|
|
1166
|
+
if (null != resolved) return resolved;
|
|
1167
|
+
}
|
|
1168
|
+
throw new Error("Package Path Not Exported");
|
|
1169
|
+
}
|
|
1170
|
+
function* packageImportsResolve(fs, specifier, parentURL, conditions) {
|
|
1171
|
+
if ("#" === specifier || specifier.startsWith("#/")) throw new Error("Invalid Module Specifier");
|
|
1172
|
+
const packageURL = yield* lookupPackageScope(fs, parentURL);
|
|
1173
|
+
if (null !== packageURL) {
|
|
1174
|
+
const pjson = yield* readPackageJson(fs, packageURL);
|
|
1175
|
+
if ("object" == typeof pjson?.imports && null !== pjson.imports) {
|
|
1176
|
+
const imports = pjson.imports;
|
|
1177
|
+
const resolved = yield* packageImportsExportsResolve(fs, specifier, imports, packageURL, true, conditions);
|
|
1178
|
+
if (null != resolved) return resolved;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
throw new Error("Package Import Not Defined");
|
|
1182
|
+
}
|
|
1183
|
+
function* packageImportsExportsResolve(fs, matchKey, matchObj, packageURL, isImports, conditions) {
|
|
1184
|
+
if (matchKey.endsWith("/")) throw new Error("Invalid Module Specifier");
|
|
1185
|
+
if (matchKey in matchObj && !matchKey.includes("*")) {
|
|
1186
|
+
const target = matchObj[matchKey];
|
|
1187
|
+
return yield* packageTargetResolve(fs, packageURL, target, null, isImports, conditions);
|
|
1188
|
+
}
|
|
1189
|
+
const expansionKeys = Object.keys(matchObj).filter((key)=>{
|
|
1190
|
+
const ii = key.indexOf("*");
|
|
1191
|
+
return -1 !== ii && ii === key.lastIndexOf("*");
|
|
1192
|
+
}).sort(patternKeyCompare);
|
|
1193
|
+
for (const key of expansionKeys){
|
|
1194
|
+
const patternBase = key.substring(0, key.indexOf("*"));
|
|
1195
|
+
if (matchKey.startsWith(patternBase) && matchKey !== patternBase) {
|
|
1196
|
+
const patternTrailer = key.substring(key.indexOf("*") + 1);
|
|
1197
|
+
if (0 === patternTrailer.length || matchKey.endsWith(patternTrailer) && matchKey.length >= key.length) {
|
|
1198
|
+
const target = matchObj[key];
|
|
1199
|
+
const patternMatch = matchKey.substring(patternBase.length, matchKey.length - patternTrailer.length);
|
|
1200
|
+
return yield* packageTargetResolve(fs, packageURL, target, patternMatch, isImports, conditions);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
return null;
|
|
1205
|
+
}
|
|
1206
|
+
function patternKeyCompare(keyA, keyB) {
|
|
1207
|
+
const indexOfStarA = keyA.indexOf("*");
|
|
1208
|
+
const baseLengthA = -1 === indexOfStarA ? keyA.length : indexOfStarA + 1;
|
|
1209
|
+
const indexOfStarB = keyB.indexOf("*");
|
|
1210
|
+
const baseLengthB = -1 === indexOfStarB ? keyB.length : indexOfStarB + 1;
|
|
1211
|
+
const baseDifference = baseLengthB - baseLengthA;
|
|
1212
|
+
if (0 !== baseDifference) return baseDifference;
|
|
1213
|
+
if (-1 === indexOfStarA) return 1;
|
|
1214
|
+
if (-1 === baseLengthB) return -1;
|
|
1215
|
+
const difference = keyB.length - keyA.length;
|
|
1216
|
+
if (0 !== difference) return difference;
|
|
1217
|
+
return 0;
|
|
1218
|
+
}
|
|
1219
|
+
function* packageTargetResolve(fs, packageURL, target, patternMatch, isImports, conditions) {
|
|
1220
|
+
if ("string" == typeof target) {
|
|
1221
|
+
if (!target.startsWith("./")) {
|
|
1222
|
+
if (!isImports || target.startsWith("../") || target.startsWith("/") || URL.canParse(target)) throw new Error("Invalid Package Target");
|
|
1223
|
+
if (null === patternMatch) return yield* packageResolve(fs, target, new URL(`${packageURL.href}/`));
|
|
1224
|
+
return yield* packageResolve(fs, target.replaceAll("*", patternMatch), new URL(`${packageURL.href}/`));
|
|
1225
|
+
}
|
|
1226
|
+
if (target.slice(2).split(/\/|\\/).some((segment)=>"" === segment || "." === segment || ".." === segment || "node_modules" === segment)) throw new Error("Invalid Package Target");
|
|
1227
|
+
const resolvedTarget = new URL(target, packageURL);
|
|
1228
|
+
if (null === patternMatch) return resolvedTarget;
|
|
1229
|
+
if (patternMatch.split(/\/|\\/).some((segment)=>"" === segment || "." === segment || ".." === segment || "node_modules" === segment)) throw new Error("Invalid Module Specifier");
|
|
1230
|
+
return new URL(resolvedTarget.href.replaceAll("*", patternMatch));
|
|
1231
|
+
}
|
|
1232
|
+
if ("object" == typeof target && null !== target) {
|
|
1233
|
+
if (Object.keys(target).some((key)=>/^[0-9]+$/.test(key))) throw new Error("Invalid Package Configuration");
|
|
1234
|
+
for (const [property, targetValue] of Object.entries(target))if ("default" === property || conditions.includes(property)) {
|
|
1235
|
+
const resolved = yield* packageTargetResolve(fs, packageURL, targetValue, patternMatch, isImports, conditions);
|
|
1236
|
+
if (void 0 === resolved) continue;
|
|
1237
|
+
return resolved;
|
|
1238
|
+
}
|
|
1239
|
+
return;
|
|
1240
|
+
}
|
|
1241
|
+
if (Array.isArray(target)) {
|
|
1242
|
+
if (0 === target.length) return null;
|
|
1243
|
+
for (const targetValue of target){
|
|
1244
|
+
const resolved = yield* packageTargetResolve(fs, packageURL, targetValue, patternMatch, isImports, conditions);
|
|
1245
|
+
if (void 0 !== resolved) return resolved;
|
|
1246
|
+
}
|
|
1247
|
+
return null;
|
|
1248
|
+
}
|
|
1249
|
+
if (null === target) return null;
|
|
1250
|
+
throw new Error("Invalid Package Target");
|
|
1251
|
+
}
|
|
1252
|
+
function* esmFileFormat(fs, url) {
|
|
1253
|
+
if (url.pathname.endsWith(".mjs")) return "module";
|
|
1254
|
+
if (url.pathname.endsWith(".cjs")) return "commonjs";
|
|
1255
|
+
if (url.pathname.endsWith(".json")) return "json";
|
|
1256
|
+
if (url.pathname.endsWith(".wasm")) return "wasm";
|
|
1257
|
+
if (url.pathname.endsWith(".node")) return "addon";
|
|
1258
|
+
const packageURL = yield* lookupPackageScope(fs, url);
|
|
1259
|
+
if (null === packageURL) throw new Error("Invalid Module Specifier");
|
|
1260
|
+
const pjson = yield* readPackageJson(fs, packageURL);
|
|
1261
|
+
const packageType = pjson?.type === "module" || pjson?.type === "commonjs" ? pjson.type : null;
|
|
1262
|
+
if (url.pathname.endsWith(".js")) {
|
|
1263
|
+
if (null !== packageType) {
|
|
1264
|
+
if ("string" != typeof packageType) throw new Error("Invalid Package Configuration");
|
|
1265
|
+
return packageType;
|
|
1266
|
+
}
|
|
1267
|
+
return "commonjs";
|
|
1268
|
+
}
|
|
1269
|
+
const segments = url.pathname.split("/");
|
|
1270
|
+
if (!segments[segments.length - 1].includes(".")) {
|
|
1271
|
+
if (null !== packageType) return packageType;
|
|
1272
|
+
return "commonjs";
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
function* lookupPackageScope(fs, url) {
|
|
1276
|
+
let scopeURL = url;
|
|
1277
|
+
const sentinel = new URL("/package.json", url);
|
|
1278
|
+
while(true){
|
|
1279
|
+
const pjsonURL = new URL("package.json", scopeURL);
|
|
1280
|
+
if (yield* fs.fileExists(pjsonURL)) return new URL(".", scopeURL);
|
|
1281
|
+
if (scopeURL.href === sentinel.href) break;
|
|
1282
|
+
scopeURL = new URL("../package.json", scopeURL);
|
|
1283
|
+
if (scopeURL.pathname.endsWith("/node_modules/package.json")) break;
|
|
1284
|
+
}
|
|
1285
|
+
return null;
|
|
1286
|
+
}
|
|
1287
|
+
function* readPackageJson(fs, packageURL) {
|
|
1288
|
+
const pjsonURL = new URL("package.json", packageURL);
|
|
1289
|
+
if (!(yield* fs.fileExists(pjsonURL))) return null;
|
|
1290
|
+
const jsonPayload = yield* fs.readFileJSON(pjsonURL);
|
|
1291
|
+
if ("object" == typeof jsonPayload && null !== jsonPayload) return jsonPayload;
|
|
1292
|
+
throw new Error("Invalid Package Configuration");
|
|
1293
|
+
}
|
|
1294
|
+
function makeDetectCycle() {
|
|
1295
|
+
const seen = new Set();
|
|
1296
|
+
return (url)=>{
|
|
1297
|
+
const { href } = url;
|
|
1298
|
+
if (seen.has(href)) throw new Error("Circular Link");
|
|
1299
|
+
seen.add(href);
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
function* resolveFileLinks(fs, path) {
|
|
1303
|
+
const detectCycle = makeDetectCycle();
|
|
1304
|
+
const read = function*(url) {
|
|
1305
|
+
detectCycle(url);
|
|
1306
|
+
const link = yield* fs.readLink(url);
|
|
1307
|
+
if (void 0 === link) return url;
|
|
1308
|
+
return yield* read(new URL(link, url));
|
|
1309
|
+
};
|
|
1310
|
+
return yield* read(path);
|
|
1311
|
+
}
|
|
1312
|
+
function* resolveDirectoryLinks(fs, path) {
|
|
1313
|
+
const detectCycle = makeDetectCycle();
|
|
1314
|
+
const read = function*(url) {
|
|
1315
|
+
detectCycle(url);
|
|
1316
|
+
const link = yield* fs.readLink(new URL(url.pathname.slice(0, -1), url));
|
|
1317
|
+
if (void 0 === link) return url;
|
|
1318
|
+
if ("/" === link) return new URL("/", url);
|
|
1319
|
+
if (link.startsWith("/")) return yield* read(new URL(`${link}/`, url));
|
|
1320
|
+
if (link.endsWith("..")) return yield* read(new URL(`../${link}`, url));
|
|
1321
|
+
return yield* read(new URL(`../${link}/`, url));
|
|
1322
|
+
};
|
|
1323
|
+
return yield* read(path);
|
|
1324
|
+
}
|
|
1325
|
+
const cjs_defaultConditions = [
|
|
1326
|
+
"node",
|
|
1327
|
+
"require"
|
|
1328
|
+
];
|
|
1329
|
+
const defaultExtensions = [
|
|
1330
|
+
".js",
|
|
1331
|
+
".json",
|
|
1332
|
+
".node"
|
|
1333
|
+
];
|
|
1334
|
+
function cjs_resolveSync(fs, specifier, parentURL, context) {
|
|
1335
|
+
return expect(begin(task_task(()=>cjs_resolver(makeFileSystemSyncAdapter(fs), specifier, parentURL, context))));
|
|
1336
|
+
}
|
|
1337
|
+
function* cjs_resolver(fs, fragment, parentURL, context) {
|
|
1338
|
+
const extensions = context?.extensions ?? defaultExtensions;
|
|
1339
|
+
if (fragment.startsWith("node:")) return {
|
|
1340
|
+
format: "builtin",
|
|
1341
|
+
url: new URL(encodeFragment(fragment))
|
|
1342
|
+
};
|
|
1343
|
+
if (nodeCoreModules.includes(fragment)) return {
|
|
1344
|
+
format: "builtin",
|
|
1345
|
+
url: new URL(`node:${encodeFragment(fragment)}`)
|
|
1346
|
+
};
|
|
1347
|
+
if (fragment.startsWith("/")) parentURL = new URL("/", parentURL);
|
|
1348
|
+
if ("." === fragment || fragment.startsWith("./") || fragment.startsWith("/") || fragment.startsWith("../")) {
|
|
1349
|
+
const asFile = yield* loadAsFile(fs, fragment, parentURL, extensions);
|
|
1350
|
+
if (asFile) return asFile;
|
|
1351
|
+
const asDirectory = yield* loadAsDirectory(fs, new URL(`${encodeFragment(fragment)}/`, parentURL), extensions);
|
|
1352
|
+
if (asDirectory) return asDirectory;
|
|
1353
|
+
throw new Error("not found");
|
|
1354
|
+
}
|
|
1355
|
+
const conditions = context?.conditions ?? cjs_defaultConditions;
|
|
1356
|
+
if (fragment.startsWith("#")) {
|
|
1357
|
+
const asPackageImports = yield* loadPackageImports(fs, fragment, new URL(".", parentURL), conditions);
|
|
1358
|
+
if (asPackageImports) return asPackageImports;
|
|
1359
|
+
}
|
|
1360
|
+
const asSelf = yield* loadPackageSelf(fs, fragment, new URL(".", parentURL), conditions);
|
|
1361
|
+
if (asSelf) return asSelf;
|
|
1362
|
+
const asNodeModules = yield* loadNodeModules(fs, fragment, new URL(".", parentURL), context);
|
|
1363
|
+
if (asNodeModules) return asNodeModules;
|
|
1364
|
+
throw new Error("not found");
|
|
1365
|
+
}
|
|
1366
|
+
function maybeDetectAndLoad(fs, file) {
|
|
1367
|
+
return loadWithFormat(fs, file);
|
|
1368
|
+
}
|
|
1369
|
+
function* loadAsFile(fs, fragment, parentURL, extensions) {
|
|
1370
|
+
const encodedFragment = encodeFragment(fragment);
|
|
1371
|
+
const asFile = new URL(encodedFragment, parentURL);
|
|
1372
|
+
if (yield* fs.fileExists(asFile)) {
|
|
1373
|
+
const realname = yield* resolveFileLinks(fs, asFile);
|
|
1374
|
+
return yield* loadWithFormat(fs, realname);
|
|
1375
|
+
}
|
|
1376
|
+
for (const extension of extensions){
|
|
1377
|
+
const withExtension = new URL(encodedFragment + extension, parentURL);
|
|
1378
|
+
if (yield* fs.fileExists(withExtension)) {
|
|
1379
|
+
const realname = yield* resolveFileLinks(fs, withExtension);
|
|
1380
|
+
switch(extension){
|
|
1381
|
+
case ".js":
|
|
1382
|
+
{
|
|
1383
|
+
const packageURL = yield* lookupPackageScope(fs, parentURL);
|
|
1384
|
+
if (null === packageURL) return yield* maybeDetectAndLoad(fs, realname);
|
|
1385
|
+
const pjson = yield* readPackageJson(fs, packageURL);
|
|
1386
|
+
if (pjson?.type === "module") return {
|
|
1387
|
+
format: "module",
|
|
1388
|
+
url: realname
|
|
1389
|
+
};
|
|
1390
|
+
if (pjson?.type === "commonjs") return {
|
|
1391
|
+
format: "commonjs",
|
|
1392
|
+
url: realname
|
|
1393
|
+
};
|
|
1394
|
+
return yield* maybeDetectAndLoad(fs, realname);
|
|
1395
|
+
}
|
|
1396
|
+
case ".json":
|
|
1397
|
+
return {
|
|
1398
|
+
format: "json",
|
|
1399
|
+
url: realname
|
|
1400
|
+
};
|
|
1401
|
+
case ".node":
|
|
1402
|
+
return {
|
|
1403
|
+
format: "builtin",
|
|
1404
|
+
url: realname
|
|
1405
|
+
};
|
|
1406
|
+
default:
|
|
1407
|
+
return {
|
|
1408
|
+
format: void 0,
|
|
1409
|
+
url: realname
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
function* loadIndex(fs, fragment, parentURL, extensions) {
|
|
1416
|
+
const encodedFragment = encodeFragment(fragment);
|
|
1417
|
+
for (const extension of extensions){
|
|
1418
|
+
const withIndex = new URL(`${encodedFragment}/index${extension}`, parentURL);
|
|
1419
|
+
if (yield* fs.fileExists(withIndex)) {
|
|
1420
|
+
const realname = yield* resolveFileLinks(fs, withIndex);
|
|
1421
|
+
switch(extension){
|
|
1422
|
+
case ".js":
|
|
1423
|
+
{
|
|
1424
|
+
const packageURL = yield* lookupPackageScope(fs, parentURL);
|
|
1425
|
+
if (null === packageURL) return {
|
|
1426
|
+
format: "commonjs",
|
|
1427
|
+
url: realname
|
|
1428
|
+
};
|
|
1429
|
+
const pjson = yield* readPackageJson(fs, packageURL);
|
|
1430
|
+
if (pjson?.type === "module") return {
|
|
1431
|
+
format: "module",
|
|
1432
|
+
url: realname
|
|
1433
|
+
};
|
|
1434
|
+
return {
|
|
1435
|
+
format: "commonjs",
|
|
1436
|
+
url: realname
|
|
1437
|
+
};
|
|
1438
|
+
}
|
|
1439
|
+
case ".json":
|
|
1440
|
+
return {
|
|
1441
|
+
format: "json",
|
|
1442
|
+
url: realname
|
|
1443
|
+
};
|
|
1444
|
+
case ".node":
|
|
1445
|
+
return {
|
|
1446
|
+
format: "addon",
|
|
1447
|
+
url: realname
|
|
1448
|
+
};
|
|
1449
|
+
default:
|
|
1450
|
+
return {
|
|
1451
|
+
format: void 0,
|
|
1452
|
+
url: realname
|
|
1453
|
+
};
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
function* loadAsDirectory(fs, path, extensions) {
|
|
1459
|
+
const pjson = yield* readPackageJson(fs, path);
|
|
1460
|
+
if ("string" == typeof pjson?.main) {
|
|
1461
|
+
const asFile = yield* loadAsFile(fs, pjson.main, path, extensions);
|
|
1462
|
+
if (asFile) return asFile;
|
|
1463
|
+
const asIndex = yield* loadIndex(fs, pjson.main, path, extensions);
|
|
1464
|
+
if (asIndex) return asIndex;
|
|
1465
|
+
const asDeprecatedIndex = yield* loadIndex(fs, ".", path, extensions);
|
|
1466
|
+
if (asDeprecatedIndex) return asDeprecatedIndex;
|
|
1467
|
+
throw new Error("not found");
|
|
1468
|
+
}
|
|
1469
|
+
return yield* loadIndex(fs, ".", path, extensions);
|
|
1470
|
+
}
|
|
1471
|
+
function* loadWithFormat(fs, url) {
|
|
1472
|
+
const format = yield* esmFileFormat(fs, url);
|
|
1473
|
+
return {
|
|
1474
|
+
format,
|
|
1475
|
+
url
|
|
1476
|
+
};
|
|
1477
|
+
}
|
|
1478
|
+
function* loadNodeModules(fs, fragment, parentURL, context) {
|
|
1479
|
+
const nameAndSubpath = function() {
|
|
1480
|
+
const matches = /^(?<name>(?:@[^/]+\/)?[^@][^/]*)(?<subpath>.*)$/.exec(fragment);
|
|
1481
|
+
if (null === matches) return;
|
|
1482
|
+
return matches.groups;
|
|
1483
|
+
}();
|
|
1484
|
+
const subpathFragment = nameAndSubpath ? `.${nameAndSubpath.subpath}` : ".";
|
|
1485
|
+
const conditions = context?.conditions ?? cjs_defaultConditions;
|
|
1486
|
+
const extensions = context?.extensions ?? defaultExtensions;
|
|
1487
|
+
for (const dir of nodeModulesPaths(parentURL)){
|
|
1488
|
+
if (!(yield* fs.directoryExists(dir))) continue;
|
|
1489
|
+
const realname = yield* resolveDirectoryLinks(fs, new URL(encodeFragment(`${nameAndSubpath ? nameAndSubpath.name : fragment}/`), dir));
|
|
1490
|
+
if (nameAndSubpath) {
|
|
1491
|
+
const asPackageExports = yield* loadPackageExports(fs, nameAndSubpath.subpath, realname, conditions);
|
|
1492
|
+
if (asPackageExports) return asPackageExports;
|
|
1493
|
+
}
|
|
1494
|
+
const asFile = yield* loadAsFile(fs, subpathFragment, realname, extensions);
|
|
1495
|
+
if (asFile) return asFile;
|
|
1496
|
+
const asDirectory = yield* loadAsDirectory(fs, new URL(`${encodeFragment(subpathFragment)}/`, realname), extensions);
|
|
1497
|
+
if (asDirectory) return asDirectory;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
function* nodeModulesPaths(path) {
|
|
1501
|
+
const sentinel = new URL("/", path);
|
|
1502
|
+
do {
|
|
1503
|
+
if (!path.pathname.endsWith("/node_modules/")) yield new URL("node_modules/", path);
|
|
1504
|
+
path = new URL("..", path);
|
|
1505
|
+
}while (path.href !== sentinel.href);
|
|
1506
|
+
}
|
|
1507
|
+
function* loadPackageImports(fs, fragment, parentURL, conditions) {
|
|
1508
|
+
const packageURL = yield* lookupPackageScope(fs, parentURL);
|
|
1509
|
+
if (null === packageURL) return;
|
|
1510
|
+
const pjson = yield* readPackageJson(fs, packageURL);
|
|
1511
|
+
if (pjson?.imports == null) return;
|
|
1512
|
+
const match = yield* packageImportsResolve(fs, fragment, packageURL, conditions);
|
|
1513
|
+
return yield* resolveEsmMatch(fs, match);
|
|
1514
|
+
}
|
|
1515
|
+
function* loadPackageExports(fs, subpath, parentURL, conditions) {
|
|
1516
|
+
const pjson = yield* readPackageJson(fs, parentURL);
|
|
1517
|
+
if (null === pjson) return;
|
|
1518
|
+
if (null == pjson.exports) return;
|
|
1519
|
+
const match = yield* packageExportsResolve(fs, parentURL, `.${subpath}`, pjson.exports, conditions);
|
|
1520
|
+
return yield* resolveEsmMatch(fs, match);
|
|
1521
|
+
}
|
|
1522
|
+
function* loadPackageSelf(fs, fragment, parentURL, conditions) {
|
|
1523
|
+
const packageURL = yield* lookupPackageScope(fs, parentURL);
|
|
1524
|
+
if (null === packageURL) return;
|
|
1525
|
+
const pjson = yield* readPackageJson(fs, packageURL);
|
|
1526
|
+
if (pjson?.exports == null) return;
|
|
1527
|
+
if ("string" != typeof pjson.name || fragment !== pjson.name && !fragment.startsWith(`${pjson.name}/`)) return;
|
|
1528
|
+
const match = yield* packageExportsResolve(fs, packageURL, `.${fragment.slice(pjson.name.length)}`, pjson.exports, conditions);
|
|
1529
|
+
return yield* resolveEsmMatch(fs, match);
|
|
1530
|
+
}
|
|
1531
|
+
function* resolveEsmMatch(fs, match) {
|
|
1532
|
+
if (yield* fs.fileExists(match)) {
|
|
1533
|
+
const realname = yield* resolveFileLinks(fs, match);
|
|
1534
|
+
return yield* loadWithFormat(fs, realname);
|
|
1535
|
+
}
|
|
1536
|
+
throw new Error("not found");
|
|
1537
|
+
}
|
|
1538
|
+
function encodeFragment(fragment) {
|
|
1539
|
+
const encodeOneCharacter = (char)=>`%${char.charCodeAt(0).toString(16)}`;
|
|
1540
|
+
const encodeOneOrMoreCharacters = (string)=>1 === string.length ? encodeOneCharacter(string) : string.replace(/[^]/g, encodeOneCharacter);
|
|
1541
|
+
return fragment.replace(/^[\x00-\x20%]+|[\r\n\t%]/g, encodeOneOrMoreCharacters);
|
|
1542
|
+
}
|
|
1543
|
+
function makeFileSystemAdapter(fs) {
|
|
1544
|
+
return {
|
|
1545
|
+
directoryExists: (url)=>fs.directoryExists(url.pathname),
|
|
1546
|
+
fileExists: (url)=>fs.fileExists(url.pathname),
|
|
1547
|
+
readFileJSON: (url)=>JSON.parse(fs.readFile(url.pathname)),
|
|
1548
|
+
readLink: ()=>void 0
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
function cjsResolve(fs, specifier, parentURL) {
|
|
1552
|
+
return cjs_resolveSync(makeFileSystemAdapter(fs), specifier, parentURL);
|
|
1553
|
+
}
|
|
1554
|
+
function esmResolve(fs, specifier, parentURL) {
|
|
1555
|
+
return resolveSync(makeFileSystemAdapter(fs), specifier, parentURL);
|
|
1556
|
+
}
|
|
1557
|
+
function getCjsModuleNamespace(fs, file, seen = new Set()) {
|
|
1558
|
+
seen.add(file.pathname);
|
|
1559
|
+
const exports = new Set();
|
|
1560
|
+
const bindings = getCjsModuleBindings(fs.readFile(file.pathname));
|
|
1561
|
+
bindings.exports.forEach((name)=>exports.add(name));
|
|
1562
|
+
if (!exports.has("default")) exports.add("default");
|
|
1563
|
+
for (const source of bindings.reexports.reverse())try {
|
|
1564
|
+
const { format, url } = cjsResolve(fs, source, file);
|
|
1565
|
+
if ("commonjs" === format && !seen.has(url.pathname)) {
|
|
1566
|
+
const reexported = getCjsModuleNamespace(fs, url, seen);
|
|
1567
|
+
reexported.forEach((name)=>exports.add(name));
|
|
1568
|
+
}
|
|
1569
|
+
} catch {}
|
|
1570
|
+
return exports;
|
|
1571
|
+
}
|
|
1572
|
+
function getEsmModuleNamespace(fs, specifier, parentURL = new URL("file:///"), seen = new Set()) {
|
|
1573
|
+
const { format, url } = esmResolve(fs, specifier, parentURL);
|
|
1574
|
+
if (seen.has(url.pathname)) return [];
|
|
1575
|
+
seen.add(url.pathname);
|
|
1576
|
+
if ("commonjs" === format) return [
|
|
1577
|
+
...getCjsModuleNamespace(fs, url)
|
|
1578
|
+
];
|
|
1579
|
+
const bindings = (null != format ? format : "module") === "module" ? getEsmModuleBindings(fs.readFile(url.pathname)) : {
|
|
1580
|
+
exports: [
|
|
1581
|
+
"default"
|
|
1582
|
+
],
|
|
1583
|
+
reexports: []
|
|
1584
|
+
};
|
|
1585
|
+
const indirect = bindings.reexports.flatMap((specifier)=>getEsmModuleNamespace(fs, specifier, url, seen)).filter((name)=>"default" !== name);
|
|
1586
|
+
return [
|
|
1587
|
+
...new Set([
|
|
1588
|
+
...bindings.exports,
|
|
1589
|
+
...indirect
|
|
1590
|
+
])
|
|
1591
|
+
];
|
|
1592
|
+
}
|
|
1593
|
+
const namedExports = defineCheck({
|
|
1594
|
+
name: "NamedExports",
|
|
1595
|
+
dependencies: ({ entrypoints, subpath, resolutionKind, programInfo })=>{
|
|
1596
|
+
var _a, _b, _c, _d;
|
|
1597
|
+
const entrypoint = entrypoints[subpath].resolutions[resolutionKind];
|
|
1598
|
+
const typesFileName = (null == (_a = entrypoint.resolution) ? void 0 : _a.isTypeScript) && entrypoint.resolution.fileName;
|
|
1599
|
+
const resolutionOption = getResolutionOption(resolutionKind);
|
|
1600
|
+
const typesModuleKind = typesFileName ? null == (_b = programInfo[resolutionOption].moduleKinds) ? void 0 : _b[typesFileName] : void 0;
|
|
1601
|
+
const implementationFileName = null == (_c = entrypoint.implementationResolution) ? void 0 : _c.fileName;
|
|
1602
|
+
const implementationModuleKind = implementationFileName ? null == (_d = programInfo[resolutionOption].moduleKinds) ? void 0 : _d[implementationFileName] : void 0;
|
|
1603
|
+
return [
|
|
1604
|
+
implementationFileName,
|
|
1605
|
+
implementationModuleKind,
|
|
1606
|
+
typesFileName,
|
|
1607
|
+
typesModuleKind,
|
|
1608
|
+
resolutionKind
|
|
1609
|
+
];
|
|
1610
|
+
},
|
|
1611
|
+
execute: ([implementationFileName, implementationModuleKind, typesFileName, typesModuleKind, resolutionKind], context)=>{
|
|
1612
|
+
if (!implementationFileName || !typesFileName || "node16-esm" !== resolutionKind || (null == typesModuleKind ? void 0 : typesModuleKind.detectedKind) !== typescript.ModuleKind.CommonJS || (null == implementationModuleKind ? void 0 : implementationModuleKind.detectedKind) !== typescript.ModuleKind.CommonJS) return;
|
|
1613
|
+
const host = context.hosts.findHostForFiles([
|
|
1614
|
+
typesFileName
|
|
1615
|
+
]);
|
|
1616
|
+
const typesSourceFile = host.getSourceFile(typesFileName);
|
|
1617
|
+
if (typesSourceFile.scriptKind === typescript.ScriptKind.JSON || !typesSourceFile.symbol) return;
|
|
1618
|
+
const typeChecker = host.createAuxiliaryProgram([
|
|
1619
|
+
typesFileName
|
|
1620
|
+
]).getTypeChecker();
|
|
1621
|
+
const moduleType = typeChecker.getTypeOfSymbol(typeChecker.resolveExternalModuleSymbol(typesSourceFile.symbol));
|
|
1622
|
+
if (typeChecker.isArrayLikeType(moduleType) || typeChecker.getPropertyOfType(moduleType, "0")) return;
|
|
1623
|
+
const expectedNames = Array.from(new Set(typeChecker.getExportsAndPropertiesOfModule(typesSourceFile.symbol).filter((symbol)=>"prototype" !== symbol.name && typeChecker.getSymbolFlags(symbol, true) & typescript.SymbolFlags.Value).map((symbol)=>symbol.name)));
|
|
1624
|
+
let exports;
|
|
1625
|
+
try {
|
|
1626
|
+
exports = getEsmModuleNamespace(context.pkg, implementationFileName);
|
|
1627
|
+
} catch {
|
|
1628
|
+
return;
|
|
1629
|
+
}
|
|
1630
|
+
const missing = expectedNames.filter((name)=>!exports.includes(name));
|
|
1631
|
+
if (missing.length > 0) {
|
|
1632
|
+
const lengthWithoutDefault = (names)=>names.length - (names.includes("default") ? 1 : 0);
|
|
1633
|
+
return {
|
|
1634
|
+
kind: "NamedExports",
|
|
1635
|
+
implementationFileName,
|
|
1636
|
+
typesFileName,
|
|
1637
|
+
isMissingAllNamed: lengthWithoutDefault(missing) === lengthWithoutDefault(expectedNames),
|
|
1638
|
+
missing
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
});
|
|
1643
|
+
const checks_entrypointResolutions = defineCheck({
|
|
1644
|
+
name: "EntrypointResolutions",
|
|
1645
|
+
dependencies: ({ subpath, resolutionKind })=>[
|
|
1646
|
+
subpath,
|
|
1647
|
+
resolutionKind
|
|
1648
|
+
],
|
|
1649
|
+
execute: ([subpath, resolutionKind], context)=>{
|
|
1650
|
+
var _a, _b;
|
|
1651
|
+
const problems = [];
|
|
1652
|
+
const entrypoint = context.entrypoints[subpath].resolutions[resolutionKind];
|
|
1653
|
+
if (entrypoint.isWildcard) return;
|
|
1654
|
+
if (entrypoint.resolution) {
|
|
1655
|
+
if (!entrypoint.resolution.isTypeScript && !entrypoint.resolution.isJson) problems.push({
|
|
1656
|
+
kind: "UntypedResolution",
|
|
1657
|
+
entrypoint: subpath,
|
|
1658
|
+
resolutionKind
|
|
1659
|
+
});
|
|
1660
|
+
} else problems.push({
|
|
1661
|
+
kind: "NoResolution",
|
|
1662
|
+
entrypoint: subpath,
|
|
1663
|
+
resolutionKind
|
|
1664
|
+
});
|
|
1665
|
+
if ("node16-cjs" === resolutionKind && (!entrypoint.implementationResolution && entrypoint.resolution && (null == (_a = context.programInfo["node16"].moduleKinds[entrypoint.resolution.fileName]) ? void 0 : _a.detectedKind) === typescript.ModuleKind.ESNext || entrypoint.implementationResolution && (null == (_b = context.programInfo["node16"].moduleKinds[entrypoint.implementationResolution.fileName]) ? void 0 : _b.detectedKind) === typescript.ModuleKind.ESNext)) problems.push({
|
|
1666
|
+
kind: "CJSResolvesToESM",
|
|
1667
|
+
entrypoint: subpath,
|
|
1668
|
+
resolutionKind
|
|
1669
|
+
});
|
|
1670
|
+
if (entrypoint.resolution && resolvedThroughFallback(entrypoint.resolution.trace)) problems.push({
|
|
1671
|
+
kind: "FallbackCondition",
|
|
1672
|
+
entrypoint: subpath,
|
|
1673
|
+
resolutionKind
|
|
1674
|
+
});
|
|
1675
|
+
return problems;
|
|
1676
|
+
}
|
|
1677
|
+
});
|
|
1678
|
+
const minifiedVariableAssignmentPattern = /[^\s];(?:var|let|const) [a-zA-Z0-9_]=[^\s]/;
|
|
1679
|
+
function getProbableExports(sourceFile) {
|
|
1680
|
+
var _a;
|
|
1681
|
+
return null != (_a = getEsbuildBabelSwcExports(sourceFile)) ? _a : [];
|
|
1682
|
+
}
|
|
1683
|
+
function getEsbuildBabelSwcExports(sourceFile) {
|
|
1684
|
+
var _a, _b;
|
|
1685
|
+
let possibleIndex = sourceFile.text.indexOf("\n__export(");
|
|
1686
|
+
if (-1 === possibleIndex) possibleIndex = sourceFile.text.indexOf("\n_export(");
|
|
1687
|
+
if (-1 === possibleIndex && !isProbablyMinified(sourceFile.text)) return;
|
|
1688
|
+
for (const statement of sourceFile.statements)if (-1 === possibleIndex || !(statement.end < possibleIndex)) {
|
|
1689
|
+
if (-1 !== possibleIndex && statement.pos > possibleIndex) break;
|
|
1690
|
+
if (typescript.isExpressionStatement(statement) && typescript.isCallExpression(statement.expression) && typescript.isIdentifier(statement.expression.expression) && 2 === statement.expression.arguments.length && typescript.isIdentifier(statement.expression.arguments[0]) && typescript.isObjectLiteralExpression(statement.expression.arguments[1])) {
|
|
1691
|
+
const callTarget = statement.expression.expression;
|
|
1692
|
+
const isExport = "__export" === typescript.unescapeLeadingUnderscores(callTarget.escapedText) || "_export" === callTarget.escapedText || isEsbuildExportFunction(null == (_b = null == (_a = sourceFile.locals) ? void 0 : _a.get(callTarget.escapedText)) ? void 0 : _b.valueDeclaration);
|
|
1693
|
+
if (isExport) return statement.expression.arguments[1].properties.flatMap((prop)=>{
|
|
1694
|
+
if (typescript.isPropertyAssignment(prop) && (typescript.isIdentifier(prop.name) || typescript.isStringOrNumericLiteralLike(prop.name))) return [
|
|
1695
|
+
{
|
|
1696
|
+
name: prop.name.text,
|
|
1697
|
+
node: prop
|
|
1698
|
+
}
|
|
1699
|
+
];
|
|
1700
|
+
if (typescript.isShorthandPropertyAssignment(prop)) return [
|
|
1701
|
+
{
|
|
1702
|
+
name: prop.name.text,
|
|
1703
|
+
node: prop
|
|
1704
|
+
}
|
|
1705
|
+
];
|
|
1706
|
+
return [];
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
function isEsbuildExportFunction(decl) {
|
|
1712
|
+
if (!decl) return false;
|
|
1713
|
+
return typescript.isVariableDeclaration(decl) && decl.initializer && typescript.isFunctionExpressionOrArrowFunction(decl.initializer) && typescript.isBlock(decl.initializer.body) && 1 == decl.initializer.body.statements.length && typescript.isForInStatement(decl.initializer.body.statements[0]);
|
|
1714
|
+
}
|
|
1715
|
+
function isProbablyMinified(text) {
|
|
1716
|
+
return minifiedVariableAssignmentPattern.test(text);
|
|
1717
|
+
}
|
|
1718
|
+
const bindOptions = {
|
|
1719
|
+
target: typescript.ScriptTarget.Latest,
|
|
1720
|
+
allowJs: true,
|
|
1721
|
+
checkJs: true
|
|
1722
|
+
};
|
|
1723
|
+
const exportDefaultDisagreement = defineCheck({
|
|
1724
|
+
name: "ExportDefaultDisagreement",
|
|
1725
|
+
dependencies: ({ entrypoints, subpath, resolutionKind, programInfo })=>{
|
|
1726
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1727
|
+
const entrypoint = entrypoints[subpath].resolutions[resolutionKind];
|
|
1728
|
+
const typesFileName = null == (_a = entrypoint.resolution) ? void 0 : _a.fileName;
|
|
1729
|
+
const implementationFileName = null == (_b = entrypoint.implementationResolution) ? void 0 : _b.fileName;
|
|
1730
|
+
if (typesFileName && (null == (_d = null == (_c = programInfo[getResolutionOption(resolutionKind)].moduleKinds) ? void 0 : _c[typesFileName]) ? void 0 : _d.detectedKind) === typescript.ModuleKind.ESNext || implementationFileName && (null == (_f = null == (_e = programInfo[getResolutionOption(resolutionKind)].moduleKinds) ? void 0 : _e[implementationFileName]) ? void 0 : _f.detectedKind) === typescript.ModuleKind.ESNext) return [];
|
|
1731
|
+
return [
|
|
1732
|
+
typesFileName,
|
|
1733
|
+
implementationFileName
|
|
1734
|
+
];
|
|
1735
|
+
},
|
|
1736
|
+
execute: ([typesFileName, implementationFileName], context)=>{
|
|
1737
|
+
var _a, _b;
|
|
1738
|
+
if (!typesFileName || !implementationFileName || !typescript.hasTSFileExtension(typesFileName)) return;
|
|
1739
|
+
const host = context.hosts.findHostForFiles([
|
|
1740
|
+
typesFileName
|
|
1741
|
+
]);
|
|
1742
|
+
const typesSourceFile = host.getSourceFile(typesFileName);
|
|
1743
|
+
typescript.bindSourceFile(typesSourceFile, bindOptions);
|
|
1744
|
+
if (!(null == (_a = typesSourceFile.symbol) ? void 0 : _a.exports)) return;
|
|
1745
|
+
const implementationSourceFile = host.getSourceFile(implementationFileName);
|
|
1746
|
+
typescript.bindSourceFile(implementationSourceFile, bindOptions);
|
|
1747
|
+
if (!(null == (_b = implementationSourceFile.symbol) ? void 0 : _b.exports) || implementationSourceFile.externalModuleIndicator) return;
|
|
1748
|
+
const typesHaveSyntacticDefault = typesSourceFile.symbol.exports.has(typescript.InternalSymbolName.Default);
|
|
1749
|
+
if (typesHaveSyntacticDefault && !getImplHasDefault() && implIsAnalyzable()) return {
|
|
1750
|
+
kind: "FalseExportDefault",
|
|
1751
|
+
typesFileName,
|
|
1752
|
+
implementationFileName
|
|
1753
|
+
};
|
|
1754
|
+
if (!getImplHasDefault() || !implIsAnalyzable()) return;
|
|
1755
|
+
if (!typesSourceFile.symbol.exports.has(typescript.InternalSymbolName.ExportEquals) && implementationSourceFile.symbol.exports.has(typescript.InternalSymbolName.ExportEquals) && getTypesDefaultSymbol() && (getImplExportEqualsIsExportDefault() && getTypesChecker().typeHasCallOrConstructSignatures(getTypesTypeOfDefault()) || getImplChecker().typeHasCallOrConstructSignatures(getImplTypeOfModuleExports()))) return {
|
|
1756
|
+
kind: "MissingExportEquals",
|
|
1757
|
+
typesFileName,
|
|
1758
|
+
implementationFileName
|
|
1759
|
+
};
|
|
1760
|
+
const typesHaveNonDefaultValueExport = Array.from(typesSourceFile.symbol.exports.values()).some((s)=>{
|
|
1761
|
+
if ("default" === s.escapedName) return false;
|
|
1762
|
+
if (s.flags & typescript.SymbolFlags.Value) return true;
|
|
1763
|
+
while(s.flags & typescript.SymbolFlags.Alias){
|
|
1764
|
+
s = getTypesChecker().getAliasedSymbol(s);
|
|
1765
|
+
if (s.flags & typescript.SymbolFlags.Value) return true;
|
|
1766
|
+
}
|
|
1767
|
+
});
|
|
1768
|
+
if (!typesHaveNonDefaultValueExport && typeIsObjecty(getTypesTypeOfDefault(), getTypesChecker()) && (Array.from(implementationSourceFile.symbol.exports.keys()).some((name)=>isNotDefaultOrEsModule(typescript.unescapeLeadingUnderscores(name))) || getImplProbableExports().some(({ name })=>isNotDefaultOrEsModule(name))) && getTypesDefaultSymbol()) return {
|
|
1769
|
+
kind: "MissingExportEquals",
|
|
1770
|
+
typesFileName,
|
|
1771
|
+
implementationFileName
|
|
1772
|
+
};
|
|
1773
|
+
var implProbableExports, implChecker, implHasDefault, implTypeOfModuleExports, implExportEqualsIsExportDefault, typesChecker, typesDefaultSymbol, typesTypeOfDefault;
|
|
1774
|
+
function getImplProbableExports() {
|
|
1775
|
+
var _a;
|
|
1776
|
+
return null != (_a = implProbableExports) ? _a : implProbableExports = getProbableExports(implementationSourceFile);
|
|
1777
|
+
}
|
|
1778
|
+
function getImplChecker() {
|
|
1779
|
+
var _a;
|
|
1780
|
+
return null != (_a = implChecker) ? _a : implChecker = host.createAuxiliaryProgram([
|
|
1781
|
+
implementationFileName
|
|
1782
|
+
]).getTypeChecker();
|
|
1783
|
+
}
|
|
1784
|
+
function getImplHasDefault() {
|
|
1785
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1786
|
+
return null != (_a = implHasDefault) ? _a : implHasDefault = (null == (_c = null == (_b = null == implementationSourceFile ? void 0 : implementationSourceFile.symbol) ? void 0 : _b.exports) ? void 0 : _c.has(typescript.InternalSymbolName.Default)) || (null == (_d = getImplProbableExports()) ? void 0 : _d.some((s)=>"default" === s.name)) || !!(null == (_f = null == (_e = implementationSourceFile.symbol) ? void 0 : _e.exports) ? void 0 : _f.size) && getImplChecker().getExportsAndPropertiesOfModule(implementationSourceFile.symbol).some((s)=>"default" === s.name);
|
|
1787
|
+
}
|
|
1788
|
+
function getTypesChecker() {
|
|
1789
|
+
var _a;
|
|
1790
|
+
return null != (_a = typesChecker) ? _a : typesChecker = host.createAuxiliaryProgram([
|
|
1791
|
+
typesFileName
|
|
1792
|
+
]).getTypeChecker();
|
|
1793
|
+
}
|
|
1794
|
+
function getTypesDefaultSymbol() {
|
|
1795
|
+
var _a, _b;
|
|
1796
|
+
return null != (_a = typesDefaultSymbol) ? _a : typesDefaultSymbol = null != (_b = typesSourceFile.symbol.exports.get(typescript.InternalSymbolName.Default)) ? _b : getTypesChecker().getExportsAndPropertiesOfModule(typesSourceFile.symbol).find((s)=>"default" === s.escapedName);
|
|
1797
|
+
}
|
|
1798
|
+
function getTypesTypeOfDefault() {
|
|
1799
|
+
var _a;
|
|
1800
|
+
const symbol = getTypesDefaultSymbol();
|
|
1801
|
+
return null != (_a = typesTypeOfDefault) ? _a : typesTypeOfDefault = symbol ? getTypesChecker().getTypeOfSymbol(symbol) : getTypesChecker().getAnyType();
|
|
1802
|
+
}
|
|
1803
|
+
function getImplTypeOfModuleExports() {
|
|
1804
|
+
if (implTypeOfModuleExports) return implTypeOfModuleExports;
|
|
1805
|
+
const type = getImplChecker().getTypeOfSymbol(getImplChecker().resolveExternalModuleSymbol(implementationSourceFile.symbol));
|
|
1806
|
+
if (type.flags & typescript.TypeFlags.Any && getImplExportEqualsIsExportDefault()) return implTypeOfModuleExports = getImplChecker().getTypeOfSymbol(implementationSourceFile.symbol.exports.get(typescript.InternalSymbolName.Default));
|
|
1807
|
+
return implTypeOfModuleExports = type;
|
|
1808
|
+
}
|
|
1809
|
+
function getImplExportEqualsIsExportDefault() {
|
|
1810
|
+
var _a;
|
|
1811
|
+
if (void 0 !== implExportEqualsIsExportDefault) return implExportEqualsIsExportDefault;
|
|
1812
|
+
const exportEquals = implementationSourceFile.symbol.exports.get(typescript.InternalSymbolName.ExportEquals);
|
|
1813
|
+
if (!exportEquals) return implExportEqualsIsExportDefault = false;
|
|
1814
|
+
const exportDefault = implementationSourceFile.symbol.exports.get(typescript.InternalSymbolName.Default);
|
|
1815
|
+
if (!exportDefault) return implExportEqualsIsExportDefault = false;
|
|
1816
|
+
for (const assignment of [
|
|
1817
|
+
exportEquals.valueDeclaration,
|
|
1818
|
+
typescript.findAncestor(null == (_a = exportDefault.declarations) ? void 0 : _a[0], typescript.isBinaryExpression)
|
|
1819
|
+
]){
|
|
1820
|
+
let seenModuleExports = false, seenExportsDefault = false;
|
|
1821
|
+
if (assignment && typescript.isBinaryExpression(assignment) && assignment.operatorToken.kind === typescript.SyntaxKind.EqualsToken) {
|
|
1822
|
+
const res = !!forEachAssignmentTarget(assignment, (target)=>{
|
|
1823
|
+
if (!seenExportsDefault && isExportsDefault(target)) seenExportsDefault = true;
|
|
1824
|
+
else if (!seenModuleExports && isModuleExports(target)) seenModuleExports = true;
|
|
1825
|
+
return seenExportsDefault && seenModuleExports;
|
|
1826
|
+
});
|
|
1827
|
+
if (res) return implExportEqualsIsExportDefault = true;
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
return implExportEqualsIsExportDefault = false;
|
|
1831
|
+
}
|
|
1832
|
+
function implIsAnalyzable() {
|
|
1833
|
+
var _a, _b, _c;
|
|
1834
|
+
if ((null == (_b = null == (_a = implementationSourceFile.symbol.exports.get(typescript.InternalSymbolName.ExportEquals)) ? void 0 : _a.declarations) ? void 0 : _b.length) > 1) {
|
|
1835
|
+
let commonContainer;
|
|
1836
|
+
for (const decl of implementationSourceFile.symbol.exports.get(typescript.InternalSymbolName.ExportEquals).declarations){
|
|
1837
|
+
const container = typescript.findAncestor(decl, (node)=>typescript.isFunctionBlock(node) || typescript.isSourceFile(node));
|
|
1838
|
+
if (void 0 === commonContainer) commonContainer = container;
|
|
1839
|
+
else if (commonContainer !== container) return false;
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
return !!(implementationSourceFile.symbol.exports.size || (null == (_c = getImplProbableExports()) ? void 0 : _c.length));
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
});
|
|
1846
|
+
function typeIsObjecty(type, checker) {
|
|
1847
|
+
return type.flags & typescript.TypeFlags.Object && !(type.flags & typescript.TypeFlags.Primitive) && !checker.typeHasCallOrConstructSignatures(type);
|
|
1848
|
+
}
|
|
1849
|
+
function isModuleExports(target) {
|
|
1850
|
+
return typescript.isAccessExpression(target) && typescript.isIdentifier(target.expression) && "module" === target.expression.text && "exports" === getNameOfAccessExpression(target) || typescript.isIdentifier(target) && "exports" === target.text;
|
|
1851
|
+
}
|
|
1852
|
+
function isExportsDefault(target) {
|
|
1853
|
+
return typescript.isAccessExpression(target) && typescript.isIdentifier(target.expression) && "exports" === target.expression.text && "default" === getNameOfAccessExpression(target) || typescript.isAccessExpression(target) && typescript.isAccessExpression(target.expression) && typescript.isIdentifier(target.expression.expression) && "module" === target.expression.expression.text && "exports" === getNameOfAccessExpression(target.expression) && "default" === getNameOfAccessExpression(target);
|
|
1854
|
+
}
|
|
1855
|
+
function isNotDefaultOrEsModule(name) {
|
|
1856
|
+
return "default" !== name && "__esModule" !== name;
|
|
1857
|
+
}
|
|
1858
|
+
function forEachAssignmentTarget(assignment, cb) {
|
|
1859
|
+
const target = typescript.skipParentheses(assignment.right);
|
|
1860
|
+
if (typescript.isBinaryExpression(target) && target.operatorToken.kind === typescript.SyntaxKind.EqualsToken) {
|
|
1861
|
+
const res = forEachAssignmentTarget(target, cb);
|
|
1862
|
+
if (res) return res;
|
|
1863
|
+
} else {
|
|
1864
|
+
const res = cb(target);
|
|
1865
|
+
if (res) return res;
|
|
1866
|
+
}
|
|
1867
|
+
return cb(typescript.skipParentheses(assignment.left));
|
|
1868
|
+
}
|
|
1869
|
+
function getNameOfAccessExpression(accessExpression) {
|
|
1870
|
+
const node = typescript.getNameOfAccessExpression(accessExpression);
|
|
1871
|
+
if (typescript.isIdentifier(node) || typescript.isStringLiteralLike(node)) return node.text;
|
|
1872
|
+
}
|
|
1873
|
+
const internalResolutionError = defineCheck({
|
|
1874
|
+
name: "InternalResolutionError",
|
|
1875
|
+
enumerateFiles: true,
|
|
1876
|
+
dependencies: ({ resolutionOption, fileName })=>[
|
|
1877
|
+
resolutionOption,
|
|
1878
|
+
fileName
|
|
1879
|
+
],
|
|
1880
|
+
execute: ([resolutionOption, fileName], context)=>{
|
|
1881
|
+
if (!typescript.hasTSFileExtension(fileName)) return;
|
|
1882
|
+
const host = context.hosts[resolutionOption];
|
|
1883
|
+
const sourceFile = host.getSourceFile(fileName);
|
|
1884
|
+
if (null == sourceFile ? void 0 : sourceFile.imports) {
|
|
1885
|
+
const problems = [];
|
|
1886
|
+
for (const moduleSpecifier of sourceFile.imports){
|
|
1887
|
+
const reference = moduleSpecifier.text;
|
|
1888
|
+
if (reference !== context.pkg.packageName && !reference.startsWith(`${context.pkg.packageName}/`) && "#" !== reference[0] && !typescript.pathIsRelative(reference)) continue;
|
|
1889
|
+
const resolutionMode = typescript.getModeForUsageLocation(sourceFile, moduleSpecifier, host.getCompilerOptions());
|
|
1890
|
+
const resolution = host.getResolvedModule(sourceFile, moduleSpecifier.text, resolutionMode);
|
|
1891
|
+
if (!resolution) throw new Error(`Expected resolution for '${moduleSpecifier.text}' in ${fileName}`);
|
|
1892
|
+
if (!resolution.resolvedModule) problems.push({
|
|
1893
|
+
kind: "InternalResolutionError",
|
|
1894
|
+
resolutionOption,
|
|
1895
|
+
fileName,
|
|
1896
|
+
moduleSpecifier: reference,
|
|
1897
|
+
pos: moduleSpecifier.pos,
|
|
1898
|
+
end: moduleSpecifier.end,
|
|
1899
|
+
resolutionMode,
|
|
1900
|
+
trace: host.getTrace(fileName, moduleSpecifier.text, resolutionMode)
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
return problems;
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
});
|
|
1907
|
+
const moduleKindDisagreement = defineCheck({
|
|
1908
|
+
name: "ModuleKindDisagreement",
|
|
1909
|
+
dependencies: ({ entrypoints, subpath, resolutionKind, resolutionOption, programInfo })=>{
|
|
1910
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1911
|
+
const entrypoint = entrypoints[subpath].resolutions[resolutionKind];
|
|
1912
|
+
const typesFileName = null == (_a = entrypoint.resolution) ? void 0 : _a.fileName;
|
|
1913
|
+
const implementationFileName = null == (_b = entrypoint.implementationResolution) ? void 0 : _b.fileName;
|
|
1914
|
+
return [
|
|
1915
|
+
typesFileName,
|
|
1916
|
+
implementationFileName,
|
|
1917
|
+
typesFileName ? null == (_d = null == (_c = programInfo[resolutionOption]) ? void 0 : _c.moduleKinds) ? void 0 : _d[typesFileName] : void 0,
|
|
1918
|
+
implementationFileName ? null == (_f = null == (_e = programInfo[resolutionOption]) ? void 0 : _e.moduleKinds) ? void 0 : _f[implementationFileName] : void 0
|
|
1919
|
+
];
|
|
1920
|
+
},
|
|
1921
|
+
execute: ([typesFileName, implementationFileName, typesModuleKind, implementationModuleKind])=>{
|
|
1922
|
+
if (typesFileName && implementationFileName && typesModuleKind && implementationModuleKind) {
|
|
1923
|
+
if (typesModuleKind.detectedKind === typescript.ModuleKind.ESNext && implementationModuleKind.detectedKind === typescript.ModuleKind.CommonJS) return {
|
|
1924
|
+
kind: "FalseESM",
|
|
1925
|
+
typesFileName,
|
|
1926
|
+
implementationFileName,
|
|
1927
|
+
typesModuleKind,
|
|
1928
|
+
implementationModuleKind
|
|
1929
|
+
};
|
|
1930
|
+
else if (typesModuleKind.detectedKind === typescript.ModuleKind.CommonJS && implementationModuleKind.detectedKind === typescript.ModuleKind.ESNext) return {
|
|
1931
|
+
kind: "FalseCJS",
|
|
1932
|
+
typesFileName,
|
|
1933
|
+
implementationFileName,
|
|
1934
|
+
typesModuleKind,
|
|
1935
|
+
implementationModuleKind
|
|
1936
|
+
};
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
});
|
|
1940
|
+
const unexpectedModuleSyntax = defineCheck({
|
|
1941
|
+
name: "UnexpectedModuleSyntax",
|
|
1942
|
+
enumerateFiles: true,
|
|
1943
|
+
dependencies: ({ fileName, resolutionOption, programInfo })=>{
|
|
1944
|
+
var _a;
|
|
1945
|
+
return [
|
|
1946
|
+
fileName,
|
|
1947
|
+
null == (_a = programInfo[resolutionOption].moduleKinds) ? void 0 : _a[fileName]
|
|
1948
|
+
];
|
|
1949
|
+
},
|
|
1950
|
+
execute: ([fileName, expectedModuleKind], context)=>{
|
|
1951
|
+
var _a, _b;
|
|
1952
|
+
if (!expectedModuleKind || !typescript.hasJSFileExtension(fileName)) return;
|
|
1953
|
+
const host = null != (_a = context.hosts.findHostForFiles([
|
|
1954
|
+
fileName
|
|
1955
|
+
])) ? _a : context.hosts.bundler;
|
|
1956
|
+
const sourceFile = host.getSourceFile(fileName);
|
|
1957
|
+
const syntaxImpliedModuleKind = sourceFile.externalModuleIndicator ? typescript.ModuleKind.ESNext : sourceFile.commonJsModuleIndicator ? typescript.ModuleKind.CommonJS : void 0;
|
|
1958
|
+
if (void 0 !== syntaxImpliedModuleKind && expectedModuleKind.detectedKind !== syntaxImpliedModuleKind) {
|
|
1959
|
+
const syntax = null != (_b = sourceFile.externalModuleIndicator) ? _b : sourceFile.commonJsModuleIndicator;
|
|
1960
|
+
return {
|
|
1961
|
+
kind: "UnexpectedModuleSyntax",
|
|
1962
|
+
fileName,
|
|
1963
|
+
moduleKind: expectedModuleKind,
|
|
1964
|
+
syntax: syntaxImpliedModuleKind,
|
|
1965
|
+
pos: syntax.getStart(sourceFile),
|
|
1966
|
+
end: syntax.end
|
|
1967
|
+
};
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
});
|
|
1971
|
+
const checks = [
|
|
1972
|
+
checks_entrypointResolutions,
|
|
1973
|
+
moduleKindDisagreement,
|
|
1974
|
+
exportDefaultDisagreement,
|
|
1975
|
+
namedExports,
|
|
1976
|
+
cjsOnlyExportsDefault,
|
|
1977
|
+
unexpectedModuleSyntax,
|
|
1978
|
+
internalResolutionError
|
|
1979
|
+
];
|
|
1980
|
+
const perf = 'object' == typeof performance && performance && 'function' == typeof performance.now ? performance : Date;
|
|
1981
|
+
const warned = new Set();
|
|
1982
|
+
const PROCESS = 'object' == typeof process && process ? process : {};
|
|
1983
|
+
const emitWarning = (msg, type, code, fn)=>{
|
|
1984
|
+
'function' == typeof PROCESS.emitWarning ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`);
|
|
1985
|
+
};
|
|
1986
|
+
let AC = globalThis.AbortController;
|
|
1987
|
+
let AS = globalThis.AbortSignal;
|
|
1988
|
+
if (void 0 === AC) {
|
|
1989
|
+
AS = class {
|
|
1990
|
+
onabort;
|
|
1991
|
+
_onabort = [];
|
|
1992
|
+
reason;
|
|
1993
|
+
aborted = false;
|
|
1994
|
+
addEventListener(_, fn) {
|
|
1995
|
+
this._onabort.push(fn);
|
|
1996
|
+
}
|
|
1997
|
+
};
|
|
1998
|
+
AC = class {
|
|
1999
|
+
constructor(){
|
|
2000
|
+
warnACPolyfill();
|
|
2001
|
+
}
|
|
2002
|
+
signal = new AS();
|
|
2003
|
+
abort(reason) {
|
|
2004
|
+
if (this.signal.aborted) return;
|
|
2005
|
+
this.signal.reason = reason;
|
|
2006
|
+
this.signal.aborted = true;
|
|
2007
|
+
for (const fn of this.signal._onabort)fn(reason);
|
|
2008
|
+
this.signal.onabort?.(reason);
|
|
2009
|
+
}
|
|
2010
|
+
};
|
|
2011
|
+
let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== '1';
|
|
2012
|
+
const warnACPolyfill = ()=>{
|
|
2013
|
+
if (!printACPolyfillWarning) return;
|
|
2014
|
+
printACPolyfillWarning = false;
|
|
2015
|
+
emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", 'NO_ABORT_CONTROLLER', 'ENOTSUP', warnACPolyfill);
|
|
2016
|
+
};
|
|
2017
|
+
}
|
|
2018
|
+
const shouldWarn = (code)=>!warned.has(code);
|
|
2019
|
+
Symbol('type');
|
|
2020
|
+
const isPosInt = (n)=>n && n === Math.floor(n) && n > 0 && isFinite(n);
|
|
2021
|
+
const getUintArray = (max)=>isPosInt(max) ? max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null : null;
|
|
2022
|
+
class ZeroArray extends Array {
|
|
2023
|
+
constructor(size){
|
|
2024
|
+
super(size);
|
|
2025
|
+
this.fill(0);
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
class Stack {
|
|
2029
|
+
heap;
|
|
2030
|
+
length;
|
|
2031
|
+
static #constructing = false;
|
|
2032
|
+
static create(max) {
|
|
2033
|
+
const HeapCls = getUintArray(max);
|
|
2034
|
+
if (!HeapCls) return [];
|
|
2035
|
+
Stack.#constructing = true;
|
|
2036
|
+
const s = new Stack(max, HeapCls);
|
|
2037
|
+
Stack.#constructing = false;
|
|
2038
|
+
return s;
|
|
2039
|
+
}
|
|
2040
|
+
constructor(max, HeapCls){
|
|
2041
|
+
if (!Stack.#constructing) throw new TypeError('instantiate Stack using Stack.create(n)');
|
|
2042
|
+
this.heap = new HeapCls(max);
|
|
2043
|
+
this.length = 0;
|
|
2044
|
+
}
|
|
2045
|
+
push(n) {
|
|
2046
|
+
this.heap[this.length++] = n;
|
|
2047
|
+
}
|
|
2048
|
+
pop() {
|
|
2049
|
+
return this.heap[--this.length];
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
class LRUCache {
|
|
2053
|
+
#max;
|
|
2054
|
+
#maxSize;
|
|
2055
|
+
#dispose;
|
|
2056
|
+
#onInsert;
|
|
2057
|
+
#disposeAfter;
|
|
2058
|
+
#fetchMethod;
|
|
2059
|
+
#memoMethod;
|
|
2060
|
+
ttl;
|
|
2061
|
+
ttlResolution;
|
|
2062
|
+
ttlAutopurge;
|
|
2063
|
+
updateAgeOnGet;
|
|
2064
|
+
updateAgeOnHas;
|
|
2065
|
+
allowStale;
|
|
2066
|
+
noDisposeOnSet;
|
|
2067
|
+
noUpdateTTL;
|
|
2068
|
+
maxEntrySize;
|
|
2069
|
+
sizeCalculation;
|
|
2070
|
+
noDeleteOnFetchRejection;
|
|
2071
|
+
noDeleteOnStaleGet;
|
|
2072
|
+
allowStaleOnFetchAbort;
|
|
2073
|
+
allowStaleOnFetchRejection;
|
|
2074
|
+
ignoreFetchAbort;
|
|
2075
|
+
#size;
|
|
2076
|
+
#calculatedSize;
|
|
2077
|
+
#keyMap;
|
|
2078
|
+
#keyList;
|
|
2079
|
+
#valList;
|
|
2080
|
+
#next;
|
|
2081
|
+
#prev;
|
|
2082
|
+
#head;
|
|
2083
|
+
#tail;
|
|
2084
|
+
#free;
|
|
2085
|
+
#disposed;
|
|
2086
|
+
#sizes;
|
|
2087
|
+
#starts;
|
|
2088
|
+
#ttls;
|
|
2089
|
+
#hasDispose;
|
|
2090
|
+
#hasFetchMethod;
|
|
2091
|
+
#hasDisposeAfter;
|
|
2092
|
+
#hasOnInsert;
|
|
2093
|
+
static unsafeExposeInternals(c) {
|
|
2094
|
+
return {
|
|
2095
|
+
starts: c.#starts,
|
|
2096
|
+
ttls: c.#ttls,
|
|
2097
|
+
sizes: c.#sizes,
|
|
2098
|
+
keyMap: c.#keyMap,
|
|
2099
|
+
keyList: c.#keyList,
|
|
2100
|
+
valList: c.#valList,
|
|
2101
|
+
next: c.#next,
|
|
2102
|
+
prev: c.#prev,
|
|
2103
|
+
get head () {
|
|
2104
|
+
return c.#head;
|
|
2105
|
+
},
|
|
2106
|
+
get tail () {
|
|
2107
|
+
return c.#tail;
|
|
2108
|
+
},
|
|
2109
|
+
free: c.#free,
|
|
2110
|
+
isBackgroundFetch: (p)=>c.#isBackgroundFetch(p),
|
|
2111
|
+
backgroundFetch: (k, index, options, context)=>c.#backgroundFetch(k, index, options, context),
|
|
2112
|
+
moveToTail: (index)=>c.#moveToTail(index),
|
|
2113
|
+
indexes: (options)=>c.#indexes(options),
|
|
2114
|
+
rindexes: (options)=>c.#rindexes(options),
|
|
2115
|
+
isStale: (index)=>c.#isStale(index)
|
|
2116
|
+
};
|
|
2117
|
+
}
|
|
2118
|
+
get max() {
|
|
2119
|
+
return this.#max;
|
|
2120
|
+
}
|
|
2121
|
+
get maxSize() {
|
|
2122
|
+
return this.#maxSize;
|
|
2123
|
+
}
|
|
2124
|
+
get calculatedSize() {
|
|
2125
|
+
return this.#calculatedSize;
|
|
2126
|
+
}
|
|
2127
|
+
get size() {
|
|
2128
|
+
return this.#size;
|
|
2129
|
+
}
|
|
2130
|
+
get fetchMethod() {
|
|
2131
|
+
return this.#fetchMethod;
|
|
2132
|
+
}
|
|
2133
|
+
get memoMethod() {
|
|
2134
|
+
return this.#memoMethod;
|
|
2135
|
+
}
|
|
2136
|
+
get dispose() {
|
|
2137
|
+
return this.#dispose;
|
|
2138
|
+
}
|
|
2139
|
+
get onInsert() {
|
|
2140
|
+
return this.#onInsert;
|
|
2141
|
+
}
|
|
2142
|
+
get disposeAfter() {
|
|
2143
|
+
return this.#disposeAfter;
|
|
2144
|
+
}
|
|
2145
|
+
constructor(options){
|
|
2146
|
+
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, onInsert, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
|
|
2147
|
+
if (0 !== max && !isPosInt(max)) throw new TypeError('max option must be a nonnegative integer');
|
|
2148
|
+
const UintArray = max ? getUintArray(max) : Array;
|
|
2149
|
+
if (!UintArray) throw new Error('invalid max value: ' + max);
|
|
2150
|
+
this.#max = max;
|
|
2151
|
+
this.#maxSize = maxSize;
|
|
2152
|
+
this.maxEntrySize = maxEntrySize || this.#maxSize;
|
|
2153
|
+
this.sizeCalculation = sizeCalculation;
|
|
2154
|
+
if (this.sizeCalculation) {
|
|
2155
|
+
if (!this.#maxSize && !this.maxEntrySize) throw new TypeError('cannot set sizeCalculation without setting maxSize or maxEntrySize');
|
|
2156
|
+
if ('function' != typeof this.sizeCalculation) throw new TypeError('sizeCalculation set to non-function');
|
|
2157
|
+
}
|
|
2158
|
+
if (void 0 !== memoMethod && 'function' != typeof memoMethod) throw new TypeError('memoMethod must be a function if defined');
|
|
2159
|
+
this.#memoMethod = memoMethod;
|
|
2160
|
+
if (void 0 !== fetchMethod && 'function' != typeof fetchMethod) throw new TypeError('fetchMethod must be a function if specified');
|
|
2161
|
+
this.#fetchMethod = fetchMethod;
|
|
2162
|
+
this.#hasFetchMethod = !!fetchMethod;
|
|
2163
|
+
this.#keyMap = new Map();
|
|
2164
|
+
this.#keyList = new Array(max).fill(void 0);
|
|
2165
|
+
this.#valList = new Array(max).fill(void 0);
|
|
2166
|
+
this.#next = new UintArray(max);
|
|
2167
|
+
this.#prev = new UintArray(max);
|
|
2168
|
+
this.#head = 0;
|
|
2169
|
+
this.#tail = 0;
|
|
2170
|
+
this.#free = Stack.create(max);
|
|
2171
|
+
this.#size = 0;
|
|
2172
|
+
this.#calculatedSize = 0;
|
|
2173
|
+
if ('function' == typeof dispose) this.#dispose = dispose;
|
|
2174
|
+
if ('function' == typeof onInsert) this.#onInsert = onInsert;
|
|
2175
|
+
if ('function' == typeof disposeAfter) {
|
|
2176
|
+
this.#disposeAfter = disposeAfter;
|
|
2177
|
+
this.#disposed = [];
|
|
2178
|
+
} else {
|
|
2179
|
+
this.#disposeAfter = void 0;
|
|
2180
|
+
this.#disposed = void 0;
|
|
2181
|
+
}
|
|
2182
|
+
this.#hasDispose = !!this.#dispose;
|
|
2183
|
+
this.#hasOnInsert = !!this.#onInsert;
|
|
2184
|
+
this.#hasDisposeAfter = !!this.#disposeAfter;
|
|
2185
|
+
this.noDisposeOnSet = !!noDisposeOnSet;
|
|
2186
|
+
this.noUpdateTTL = !!noUpdateTTL;
|
|
2187
|
+
this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
|
|
2188
|
+
this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
|
|
2189
|
+
this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
|
|
2190
|
+
this.ignoreFetchAbort = !!ignoreFetchAbort;
|
|
2191
|
+
if (0 !== this.maxEntrySize) {
|
|
2192
|
+
if (0 !== this.#maxSize) {
|
|
2193
|
+
if (!isPosInt(this.#maxSize)) throw new TypeError('maxSize must be a positive integer if specified');
|
|
2194
|
+
}
|
|
2195
|
+
if (!isPosInt(this.maxEntrySize)) throw new TypeError('maxEntrySize must be a positive integer if specified');
|
|
2196
|
+
this.#initializeSizeTracking();
|
|
2197
|
+
}
|
|
2198
|
+
this.allowStale = !!allowStale;
|
|
2199
|
+
this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
|
|
2200
|
+
this.updateAgeOnGet = !!updateAgeOnGet;
|
|
2201
|
+
this.updateAgeOnHas = !!updateAgeOnHas;
|
|
2202
|
+
this.ttlResolution = isPosInt(ttlResolution) || 0 === ttlResolution ? ttlResolution : 1;
|
|
2203
|
+
this.ttlAutopurge = !!ttlAutopurge;
|
|
2204
|
+
this.ttl = ttl || 0;
|
|
2205
|
+
if (this.ttl) {
|
|
2206
|
+
if (!isPosInt(this.ttl)) throw new TypeError('ttl must be a positive integer if specified');
|
|
2207
|
+
this.#initializeTTLTracking();
|
|
2208
|
+
}
|
|
2209
|
+
if (0 === this.#max && 0 === this.ttl && 0 === this.#maxSize) throw new TypeError('At least one of max, maxSize, or ttl is required');
|
|
2210
|
+
if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
|
|
2211
|
+
const code = 'LRU_CACHE_UNBOUNDED';
|
|
2212
|
+
if (shouldWarn(code)) {
|
|
2213
|
+
warned.add(code);
|
|
2214
|
+
const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.";
|
|
2215
|
+
emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache);
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
getRemainingTTL(key) {
|
|
2220
|
+
return this.#keyMap.has(key) ? 1 / 0 : 0;
|
|
2221
|
+
}
|
|
2222
|
+
#initializeTTLTracking() {
|
|
2223
|
+
const ttls = new ZeroArray(this.#max);
|
|
2224
|
+
const starts = new ZeroArray(this.#max);
|
|
2225
|
+
this.#ttls = ttls;
|
|
2226
|
+
this.#starts = starts;
|
|
2227
|
+
this.#setItemTTL = (index, ttl, start = perf.now())=>{
|
|
2228
|
+
starts[index] = 0 !== ttl ? start : 0;
|
|
2229
|
+
ttls[index] = ttl;
|
|
2230
|
+
if (0 !== ttl && this.ttlAutopurge) {
|
|
2231
|
+
const t = setTimeout(()=>{
|
|
2232
|
+
if (this.#isStale(index)) this.#delete(this.#keyList[index], 'expire');
|
|
2233
|
+
}, ttl + 1);
|
|
2234
|
+
if (t.unref) t.unref();
|
|
2235
|
+
}
|
|
2236
|
+
};
|
|
2237
|
+
this.#updateItemAge = (index)=>{
|
|
2238
|
+
starts[index] = 0 !== ttls[index] ? perf.now() : 0;
|
|
2239
|
+
};
|
|
2240
|
+
this.#statusTTL = (status, index)=>{
|
|
2241
|
+
if (ttls[index]) {
|
|
2242
|
+
const ttl = ttls[index];
|
|
2243
|
+
const start = starts[index];
|
|
2244
|
+
if (!ttl || !start) return;
|
|
2245
|
+
status.ttl = ttl;
|
|
2246
|
+
status.start = start;
|
|
2247
|
+
status.now = cachedNow || getNow();
|
|
2248
|
+
const age = status.now - start;
|
|
2249
|
+
status.remainingTTL = ttl - age;
|
|
2250
|
+
}
|
|
2251
|
+
};
|
|
2252
|
+
let cachedNow = 0;
|
|
2253
|
+
const getNow = ()=>{
|
|
2254
|
+
const n = perf.now();
|
|
2255
|
+
if (this.ttlResolution > 0) {
|
|
2256
|
+
cachedNow = n;
|
|
2257
|
+
const t = setTimeout(()=>cachedNow = 0, this.ttlResolution);
|
|
2258
|
+
if (t.unref) t.unref();
|
|
2259
|
+
}
|
|
2260
|
+
return n;
|
|
2261
|
+
};
|
|
2262
|
+
this.getRemainingTTL = (key)=>{
|
|
2263
|
+
const index = this.#keyMap.get(key);
|
|
2264
|
+
if (void 0 === index) return 0;
|
|
2265
|
+
const ttl = ttls[index];
|
|
2266
|
+
const start = starts[index];
|
|
2267
|
+
if (!ttl || !start) return 1 / 0;
|
|
2268
|
+
const age = (cachedNow || getNow()) - start;
|
|
2269
|
+
return ttl - age;
|
|
2270
|
+
};
|
|
2271
|
+
this.#isStale = (index)=>{
|
|
2272
|
+
const s = starts[index];
|
|
2273
|
+
const t = ttls[index];
|
|
2274
|
+
return !!t && !!s && (cachedNow || getNow()) - s > t;
|
|
2275
|
+
};
|
|
2276
|
+
}
|
|
2277
|
+
#updateItemAge = ()=>{};
|
|
2278
|
+
#statusTTL = ()=>{};
|
|
2279
|
+
#setItemTTL = ()=>{};
|
|
2280
|
+
#isStale = ()=>false;
|
|
2281
|
+
#initializeSizeTracking() {
|
|
2282
|
+
const sizes = new ZeroArray(this.#max);
|
|
2283
|
+
this.#calculatedSize = 0;
|
|
2284
|
+
this.#sizes = sizes;
|
|
2285
|
+
this.#removeItemSize = (index)=>{
|
|
2286
|
+
this.#calculatedSize -= sizes[index];
|
|
2287
|
+
sizes[index] = 0;
|
|
2288
|
+
};
|
|
2289
|
+
this.#requireSize = (k, v, size, sizeCalculation)=>{
|
|
2290
|
+
if (this.#isBackgroundFetch(v)) return 0;
|
|
2291
|
+
if (!isPosInt(size)) if (sizeCalculation) {
|
|
2292
|
+
if ('function' != typeof sizeCalculation) throw new TypeError('sizeCalculation must be a function');
|
|
2293
|
+
size = sizeCalculation(v, k);
|
|
2294
|
+
if (!isPosInt(size)) throw new TypeError('sizeCalculation return invalid (expect positive integer)');
|
|
2295
|
+
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
2296
|
+
return size;
|
|
2297
|
+
};
|
|
2298
|
+
this.#addItemSize = (index, size, status)=>{
|
|
2299
|
+
sizes[index] = size;
|
|
2300
|
+
if (this.#maxSize) {
|
|
2301
|
+
const maxSize = this.#maxSize - sizes[index];
|
|
2302
|
+
while(this.#calculatedSize > maxSize)this.#evict(true);
|
|
2303
|
+
}
|
|
2304
|
+
this.#calculatedSize += sizes[index];
|
|
2305
|
+
if (status) {
|
|
2306
|
+
status.entrySize = size;
|
|
2307
|
+
status.totalCalculatedSize = this.#calculatedSize;
|
|
2308
|
+
}
|
|
2309
|
+
};
|
|
2310
|
+
}
|
|
2311
|
+
#removeItemSize = (_i)=>{};
|
|
2312
|
+
#addItemSize = (_i, _s, _st)=>{};
|
|
2313
|
+
#requireSize = (_k, _v, size, sizeCalculation)=>{
|
|
2314
|
+
if (size || sizeCalculation) throw new TypeError('cannot set size without setting maxSize or maxEntrySize on cache');
|
|
2315
|
+
return 0;
|
|
2316
|
+
};
|
|
2317
|
+
*#indexes({ allowStale = this.allowStale } = {}) {
|
|
2318
|
+
if (this.#size) for(let i = this.#tail; true;){
|
|
2319
|
+
if (!this.#isValidIndex(i)) break;
|
|
2320
|
+
if (allowStale || !this.#isStale(i)) yield i;
|
|
2321
|
+
if (i === this.#head) break;
|
|
2322
|
+
i = this.#prev[i];
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
*#rindexes({ allowStale = this.allowStale } = {}) {
|
|
2326
|
+
if (this.#size) for(let i = this.#head; true;){
|
|
2327
|
+
if (!this.#isValidIndex(i)) break;
|
|
2328
|
+
if (allowStale || !this.#isStale(i)) yield i;
|
|
2329
|
+
if (i === this.#tail) break;
|
|
2330
|
+
i = this.#next[i];
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
#isValidIndex(index) {
|
|
2334
|
+
return void 0 !== index && this.#keyMap.get(this.#keyList[index]) === index;
|
|
2335
|
+
}
|
|
2336
|
+
*entries() {
|
|
2337
|
+
for (const i of this.#indexes())if (void 0 !== this.#valList[i] && void 0 !== this.#keyList[i] && !this.#isBackgroundFetch(this.#valList[i])) yield [
|
|
2338
|
+
this.#keyList[i],
|
|
2339
|
+
this.#valList[i]
|
|
2340
|
+
];
|
|
2341
|
+
}
|
|
2342
|
+
*rentries() {
|
|
2343
|
+
for (const i of this.#rindexes())if (void 0 !== this.#valList[i] && void 0 !== this.#keyList[i] && !this.#isBackgroundFetch(this.#valList[i])) yield [
|
|
2344
|
+
this.#keyList[i],
|
|
2345
|
+
this.#valList[i]
|
|
2346
|
+
];
|
|
2347
|
+
}
|
|
2348
|
+
*keys() {
|
|
2349
|
+
for (const i of this.#indexes()){
|
|
2350
|
+
const k = this.#keyList[i];
|
|
2351
|
+
if (void 0 !== k && !this.#isBackgroundFetch(this.#valList[i])) yield k;
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
*rkeys() {
|
|
2355
|
+
for (const i of this.#rindexes()){
|
|
2356
|
+
const k = this.#keyList[i];
|
|
2357
|
+
if (void 0 !== k && !this.#isBackgroundFetch(this.#valList[i])) yield k;
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
*values() {
|
|
2361
|
+
for (const i of this.#indexes()){
|
|
2362
|
+
const v = this.#valList[i];
|
|
2363
|
+
if (void 0 !== v && !this.#isBackgroundFetch(this.#valList[i])) yield this.#valList[i];
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
*rvalues() {
|
|
2367
|
+
for (const i of this.#rindexes()){
|
|
2368
|
+
const v = this.#valList[i];
|
|
2369
|
+
if (void 0 !== v && !this.#isBackgroundFetch(this.#valList[i])) yield this.#valList[i];
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
[Symbol.iterator]() {
|
|
2373
|
+
return this.entries();
|
|
2374
|
+
}
|
|
2375
|
+
[Symbol.toStringTag] = 'LRUCache';
|
|
2376
|
+
find(fn, getOptions = {}) {
|
|
2377
|
+
for (const i of this.#indexes()){
|
|
2378
|
+
const v = this.#valList[i];
|
|
2379
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
2380
|
+
if (void 0 !== value) {
|
|
2381
|
+
if (fn(value, this.#keyList[i], this)) return this.get(this.#keyList[i], getOptions);
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
forEach(fn, thisp = this) {
|
|
2386
|
+
for (const i of this.#indexes()){
|
|
2387
|
+
const v = this.#valList[i];
|
|
2388
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
2389
|
+
if (void 0 !== value) fn.call(thisp, value, this.#keyList[i], this);
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
rforEach(fn, thisp = this) {
|
|
2393
|
+
for (const i of this.#rindexes()){
|
|
2394
|
+
const v = this.#valList[i];
|
|
2395
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
2396
|
+
if (void 0 !== value) fn.call(thisp, value, this.#keyList[i], this);
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
purgeStale() {
|
|
2400
|
+
let deleted = false;
|
|
2401
|
+
for (const i of this.#rindexes({
|
|
2402
|
+
allowStale: true
|
|
2403
|
+
}))if (this.#isStale(i)) {
|
|
2404
|
+
this.#delete(this.#keyList[i], 'expire');
|
|
2405
|
+
deleted = true;
|
|
2406
|
+
}
|
|
2407
|
+
return deleted;
|
|
2408
|
+
}
|
|
2409
|
+
info(key) {
|
|
2410
|
+
const i = this.#keyMap.get(key);
|
|
2411
|
+
if (void 0 === i) return;
|
|
2412
|
+
const v = this.#valList[i];
|
|
2413
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
2414
|
+
if (void 0 === value) return;
|
|
2415
|
+
const entry = {
|
|
2416
|
+
value
|
|
2417
|
+
};
|
|
2418
|
+
if (this.#ttls && this.#starts) {
|
|
2419
|
+
const ttl = this.#ttls[i];
|
|
2420
|
+
const start = this.#starts[i];
|
|
2421
|
+
if (ttl && start) {
|
|
2422
|
+
const remain = ttl - (perf.now() - start);
|
|
2423
|
+
entry.ttl = remain;
|
|
2424
|
+
entry.start = Date.now();
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
if (this.#sizes) entry.size = this.#sizes[i];
|
|
2428
|
+
return entry;
|
|
2429
|
+
}
|
|
2430
|
+
dump() {
|
|
2431
|
+
const arr = [];
|
|
2432
|
+
for (const i of this.#indexes({
|
|
2433
|
+
allowStale: true
|
|
2434
|
+
})){
|
|
2435
|
+
const key = this.#keyList[i];
|
|
2436
|
+
const v = this.#valList[i];
|
|
2437
|
+
const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
2438
|
+
if (void 0 === value || void 0 === key) continue;
|
|
2439
|
+
const entry = {
|
|
2440
|
+
value
|
|
2441
|
+
};
|
|
2442
|
+
if (this.#ttls && this.#starts) {
|
|
2443
|
+
entry.ttl = this.#ttls[i];
|
|
2444
|
+
const age = perf.now() - this.#starts[i];
|
|
2445
|
+
entry.start = Math.floor(Date.now() - age);
|
|
2446
|
+
}
|
|
2447
|
+
if (this.#sizes) entry.size = this.#sizes[i];
|
|
2448
|
+
arr.unshift([
|
|
2449
|
+
key,
|
|
2450
|
+
entry
|
|
2451
|
+
]);
|
|
2452
|
+
}
|
|
2453
|
+
return arr;
|
|
2454
|
+
}
|
|
2455
|
+
load(arr) {
|
|
2456
|
+
this.clear();
|
|
2457
|
+
for (const [key, entry] of arr){
|
|
2458
|
+
if (entry.start) {
|
|
2459
|
+
const age = Date.now() - entry.start;
|
|
2460
|
+
entry.start = perf.now() - age;
|
|
2461
|
+
}
|
|
2462
|
+
this.set(key, entry.value, entry);
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
set(k, v, setOptions = {}) {
|
|
2466
|
+
if (void 0 === v) {
|
|
2467
|
+
this.delete(k);
|
|
2468
|
+
return this;
|
|
2469
|
+
}
|
|
2470
|
+
const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
|
|
2471
|
+
let { noUpdateTTL = this.noUpdateTTL } = setOptions;
|
|
2472
|
+
const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
|
|
2473
|
+
if (this.maxEntrySize && size > this.maxEntrySize) {
|
|
2474
|
+
if (status) {
|
|
2475
|
+
status.set = 'miss';
|
|
2476
|
+
status.maxEntrySizeExceeded = true;
|
|
2477
|
+
}
|
|
2478
|
+
this.#delete(k, 'set');
|
|
2479
|
+
return this;
|
|
2480
|
+
}
|
|
2481
|
+
let index = 0 === this.#size ? void 0 : this.#keyMap.get(k);
|
|
2482
|
+
if (void 0 === index) {
|
|
2483
|
+
index = 0 === this.#size ? this.#tail : 0 !== this.#free.length ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
|
|
2484
|
+
this.#keyList[index] = k;
|
|
2485
|
+
this.#valList[index] = v;
|
|
2486
|
+
this.#keyMap.set(k, index);
|
|
2487
|
+
this.#next[this.#tail] = index;
|
|
2488
|
+
this.#prev[index] = this.#tail;
|
|
2489
|
+
this.#tail = index;
|
|
2490
|
+
this.#size++;
|
|
2491
|
+
this.#addItemSize(index, size, status);
|
|
2492
|
+
if (status) status.set = 'add';
|
|
2493
|
+
noUpdateTTL = false;
|
|
2494
|
+
if (this.#hasOnInsert) this.#onInsert?.(v, k, 'add');
|
|
2495
|
+
} else {
|
|
2496
|
+
this.#moveToTail(index);
|
|
2497
|
+
const oldVal = this.#valList[index];
|
|
2498
|
+
if (v !== oldVal) {
|
|
2499
|
+
if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
|
|
2500
|
+
oldVal.__abortController.abort(new Error('replaced'));
|
|
2501
|
+
const { __staleWhileFetching: s } = oldVal;
|
|
2502
|
+
if (void 0 !== s && !noDisposeOnSet) {
|
|
2503
|
+
if (this.#hasDispose) this.#dispose?.(s, k, 'set');
|
|
2504
|
+
if (this.#hasDisposeAfter) this.#disposed?.push([
|
|
2505
|
+
s,
|
|
2506
|
+
k,
|
|
2507
|
+
'set'
|
|
2508
|
+
]);
|
|
2509
|
+
}
|
|
2510
|
+
} else if (!noDisposeOnSet) {
|
|
2511
|
+
if (this.#hasDispose) this.#dispose?.(oldVal, k, 'set');
|
|
2512
|
+
if (this.#hasDisposeAfter) this.#disposed?.push([
|
|
2513
|
+
oldVal,
|
|
2514
|
+
k,
|
|
2515
|
+
'set'
|
|
2516
|
+
]);
|
|
2517
|
+
}
|
|
2518
|
+
this.#removeItemSize(index);
|
|
2519
|
+
this.#addItemSize(index, size, status);
|
|
2520
|
+
this.#valList[index] = v;
|
|
2521
|
+
if (status) {
|
|
2522
|
+
status.set = 'replace';
|
|
2523
|
+
const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
|
|
2524
|
+
if (void 0 !== oldValue) status.oldValue = oldValue;
|
|
2525
|
+
}
|
|
2526
|
+
} else if (status) status.set = 'update';
|
|
2527
|
+
if (this.#hasOnInsert) this.onInsert?.(v, k, v === oldVal ? 'update' : 'replace');
|
|
2528
|
+
}
|
|
2529
|
+
if (0 !== ttl && !this.#ttls) this.#initializeTTLTracking();
|
|
2530
|
+
if (this.#ttls) {
|
|
2531
|
+
if (!noUpdateTTL) this.#setItemTTL(index, ttl, start);
|
|
2532
|
+
if (status) this.#statusTTL(status, index);
|
|
2533
|
+
}
|
|
2534
|
+
if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
|
|
2535
|
+
const dt = this.#disposed;
|
|
2536
|
+
let task;
|
|
2537
|
+
while(task = dt?.shift())this.#disposeAfter?.(...task);
|
|
2538
|
+
}
|
|
2539
|
+
return this;
|
|
2540
|
+
}
|
|
2541
|
+
pop() {
|
|
2542
|
+
try {
|
|
2543
|
+
while(this.#size){
|
|
2544
|
+
const val = this.#valList[this.#head];
|
|
2545
|
+
this.#evict(true);
|
|
2546
|
+
if (this.#isBackgroundFetch(val)) {
|
|
2547
|
+
if (val.__staleWhileFetching) return val.__staleWhileFetching;
|
|
2548
|
+
} else if (void 0 !== val) return val;
|
|
2549
|
+
}
|
|
2550
|
+
} finally{
|
|
2551
|
+
if (this.#hasDisposeAfter && this.#disposed) {
|
|
2552
|
+
const dt = this.#disposed;
|
|
2553
|
+
let task;
|
|
2554
|
+
while(task = dt?.shift())this.#disposeAfter?.(...task);
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
#evict(free) {
|
|
2559
|
+
const head = this.#head;
|
|
2560
|
+
const k = this.#keyList[head];
|
|
2561
|
+
const v = this.#valList[head];
|
|
2562
|
+
if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) v.__abortController.abort(new Error('evicted'));
|
|
2563
|
+
else if (this.#hasDispose || this.#hasDisposeAfter) {
|
|
2564
|
+
if (this.#hasDispose) this.#dispose?.(v, k, 'evict');
|
|
2565
|
+
if (this.#hasDisposeAfter) this.#disposed?.push([
|
|
2566
|
+
v,
|
|
2567
|
+
k,
|
|
2568
|
+
'evict'
|
|
2569
|
+
]);
|
|
2570
|
+
}
|
|
2571
|
+
this.#removeItemSize(head);
|
|
2572
|
+
if (free) {
|
|
2573
|
+
this.#keyList[head] = void 0;
|
|
2574
|
+
this.#valList[head] = void 0;
|
|
2575
|
+
this.#free.push(head);
|
|
2576
|
+
}
|
|
2577
|
+
if (1 === this.#size) {
|
|
2578
|
+
this.#head = this.#tail = 0;
|
|
2579
|
+
this.#free.length = 0;
|
|
2580
|
+
} else this.#head = this.#next[head];
|
|
2581
|
+
this.#keyMap.delete(k);
|
|
2582
|
+
this.#size--;
|
|
2583
|
+
return head;
|
|
2584
|
+
}
|
|
2585
|
+
has(k, hasOptions = {}) {
|
|
2586
|
+
const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
|
|
2587
|
+
const index = this.#keyMap.get(k);
|
|
2588
|
+
if (void 0 !== index) {
|
|
2589
|
+
const v = this.#valList[index];
|
|
2590
|
+
if (this.#isBackgroundFetch(v) && void 0 === v.__staleWhileFetching) return false;
|
|
2591
|
+
if (this.#isStale(index)) {
|
|
2592
|
+
if (status) {
|
|
2593
|
+
status.has = 'stale';
|
|
2594
|
+
this.#statusTTL(status, index);
|
|
2595
|
+
}
|
|
2596
|
+
} else {
|
|
2597
|
+
if (updateAgeOnHas) this.#updateItemAge(index);
|
|
2598
|
+
if (status) {
|
|
2599
|
+
status.has = 'hit';
|
|
2600
|
+
this.#statusTTL(status, index);
|
|
2601
|
+
}
|
|
2602
|
+
return true;
|
|
2603
|
+
}
|
|
2604
|
+
} else if (status) status.has = 'miss';
|
|
2605
|
+
return false;
|
|
2606
|
+
}
|
|
2607
|
+
peek(k, peekOptions = {}) {
|
|
2608
|
+
const { allowStale = this.allowStale } = peekOptions;
|
|
2609
|
+
const index = this.#keyMap.get(k);
|
|
2610
|
+
if (void 0 === index || !allowStale && this.#isStale(index)) return;
|
|
2611
|
+
const v = this.#valList[index];
|
|
2612
|
+
return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
|
|
2613
|
+
}
|
|
2614
|
+
#backgroundFetch(k, index, options, context) {
|
|
2615
|
+
const v = void 0 === index ? void 0 : this.#valList[index];
|
|
2616
|
+
if (this.#isBackgroundFetch(v)) return v;
|
|
2617
|
+
const ac = new AC();
|
|
2618
|
+
const { signal } = options;
|
|
2619
|
+
signal?.addEventListener('abort', ()=>ac.abort(signal.reason), {
|
|
2620
|
+
signal: ac.signal
|
|
2621
|
+
});
|
|
2622
|
+
const fetchOpts = {
|
|
2623
|
+
signal: ac.signal,
|
|
2624
|
+
options,
|
|
2625
|
+
context
|
|
2626
|
+
};
|
|
2627
|
+
const cb = (v, updateCache = false)=>{
|
|
2628
|
+
const { aborted } = ac.signal;
|
|
2629
|
+
const ignoreAbort = options.ignoreFetchAbort && void 0 !== v;
|
|
2630
|
+
if (options.status) if (aborted && !updateCache) {
|
|
2631
|
+
options.status.fetchAborted = true;
|
|
2632
|
+
options.status.fetchError = ac.signal.reason;
|
|
2633
|
+
if (ignoreAbort) options.status.fetchAbortIgnored = true;
|
|
2634
|
+
} else options.status.fetchResolved = true;
|
|
2635
|
+
if (aborted && !ignoreAbort && !updateCache) return fetchFail(ac.signal.reason);
|
|
2636
|
+
const bf = p;
|
|
2637
|
+
if (this.#valList[index] === p) if (void 0 === v) if (bf.__staleWhileFetching) this.#valList[index] = bf.__staleWhileFetching;
|
|
2638
|
+
else this.#delete(k, 'fetch');
|
|
2639
|
+
else {
|
|
2640
|
+
if (options.status) options.status.fetchUpdated = true;
|
|
2641
|
+
this.set(k, v, fetchOpts.options);
|
|
2642
|
+
}
|
|
2643
|
+
return v;
|
|
2644
|
+
};
|
|
2645
|
+
const eb = (er)=>{
|
|
2646
|
+
if (options.status) {
|
|
2647
|
+
options.status.fetchRejected = true;
|
|
2648
|
+
options.status.fetchError = er;
|
|
2649
|
+
}
|
|
2650
|
+
return fetchFail(er);
|
|
2651
|
+
};
|
|
2652
|
+
const fetchFail = (er)=>{
|
|
2653
|
+
const { aborted } = ac.signal;
|
|
2654
|
+
const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
|
|
2655
|
+
const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
|
|
2656
|
+
const noDelete = allowStale || options.noDeleteOnFetchRejection;
|
|
2657
|
+
const bf = p;
|
|
2658
|
+
if (this.#valList[index] === p) {
|
|
2659
|
+
const del = !noDelete || void 0 === bf.__staleWhileFetching;
|
|
2660
|
+
if (del) this.#delete(k, 'fetch');
|
|
2661
|
+
else if (!allowStaleAborted) this.#valList[index] = bf.__staleWhileFetching;
|
|
2662
|
+
}
|
|
2663
|
+
if (allowStale) {
|
|
2664
|
+
if (options.status && void 0 !== bf.__staleWhileFetching) options.status.returnedStale = true;
|
|
2665
|
+
return bf.__staleWhileFetching;
|
|
2666
|
+
}
|
|
2667
|
+
if (bf.__returned === bf) throw er;
|
|
2668
|
+
};
|
|
2669
|
+
const pcall = (res, rej)=>{
|
|
2670
|
+
const fmp = this.#fetchMethod?.(k, v, fetchOpts);
|
|
2671
|
+
if (fmp && fmp instanceof Promise) fmp.then((v)=>res(void 0 === v ? void 0 : v), rej);
|
|
2672
|
+
ac.signal.addEventListener('abort', ()=>{
|
|
2673
|
+
if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
|
|
2674
|
+
res(void 0);
|
|
2675
|
+
if (options.allowStaleOnFetchAbort) res = (v)=>cb(v, true);
|
|
2676
|
+
}
|
|
2677
|
+
});
|
|
2678
|
+
};
|
|
2679
|
+
if (options.status) options.status.fetchDispatched = true;
|
|
2680
|
+
const p = new Promise(pcall).then(cb, eb);
|
|
2681
|
+
const bf = Object.assign(p, {
|
|
2682
|
+
__abortController: ac,
|
|
2683
|
+
__staleWhileFetching: v,
|
|
2684
|
+
__returned: void 0
|
|
2685
|
+
});
|
|
2686
|
+
if (void 0 === index) {
|
|
2687
|
+
this.set(k, bf, {
|
|
2688
|
+
...fetchOpts.options,
|
|
2689
|
+
status: void 0
|
|
2690
|
+
});
|
|
2691
|
+
index = this.#keyMap.get(k);
|
|
2692
|
+
} else this.#valList[index] = bf;
|
|
2693
|
+
return bf;
|
|
2694
|
+
}
|
|
2695
|
+
#isBackgroundFetch(p) {
|
|
2696
|
+
if (!this.#hasFetchMethod) return false;
|
|
2697
|
+
const b = p;
|
|
2698
|
+
return !!b && b instanceof Promise && b.hasOwnProperty('__staleWhileFetching') && b.__abortController instanceof AC;
|
|
2699
|
+
}
|
|
2700
|
+
async fetch(k, fetchOptions = {}) {
|
|
2701
|
+
const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL, noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, ignoreFetchAbort = this.ignoreFetchAbort, allowStaleOnFetchAbort = this.allowStaleOnFetchAbort, context, forceRefresh = false, status, signal } = fetchOptions;
|
|
2702
|
+
if (!this.#hasFetchMethod) {
|
|
2703
|
+
if (status) status.fetch = 'get';
|
|
2704
|
+
return this.get(k, {
|
|
2705
|
+
allowStale,
|
|
2706
|
+
updateAgeOnGet,
|
|
2707
|
+
noDeleteOnStaleGet,
|
|
2708
|
+
status
|
|
2709
|
+
});
|
|
2710
|
+
}
|
|
2711
|
+
const options = {
|
|
2712
|
+
allowStale,
|
|
2713
|
+
updateAgeOnGet,
|
|
2714
|
+
noDeleteOnStaleGet,
|
|
2715
|
+
ttl,
|
|
2716
|
+
noDisposeOnSet,
|
|
2717
|
+
size,
|
|
2718
|
+
sizeCalculation,
|
|
2719
|
+
noUpdateTTL,
|
|
2720
|
+
noDeleteOnFetchRejection,
|
|
2721
|
+
allowStaleOnFetchRejection,
|
|
2722
|
+
allowStaleOnFetchAbort,
|
|
2723
|
+
ignoreFetchAbort,
|
|
2724
|
+
status,
|
|
2725
|
+
signal
|
|
2726
|
+
};
|
|
2727
|
+
let index = this.#keyMap.get(k);
|
|
2728
|
+
if (void 0 === index) {
|
|
2729
|
+
if (status) status.fetch = 'miss';
|
|
2730
|
+
const p = this.#backgroundFetch(k, index, options, context);
|
|
2731
|
+
return p.__returned = p;
|
|
2732
|
+
}
|
|
2733
|
+
{
|
|
2734
|
+
const v = this.#valList[index];
|
|
2735
|
+
if (this.#isBackgroundFetch(v)) {
|
|
2736
|
+
const stale = allowStale && void 0 !== v.__staleWhileFetching;
|
|
2737
|
+
if (status) {
|
|
2738
|
+
status.fetch = 'inflight';
|
|
2739
|
+
if (stale) status.returnedStale = true;
|
|
2740
|
+
}
|
|
2741
|
+
return stale ? v.__staleWhileFetching : v.__returned = v;
|
|
2742
|
+
}
|
|
2743
|
+
const isStale = this.#isStale(index);
|
|
2744
|
+
if (!forceRefresh && !isStale) {
|
|
2745
|
+
if (status) status.fetch = 'hit';
|
|
2746
|
+
this.#moveToTail(index);
|
|
2747
|
+
if (updateAgeOnGet) this.#updateItemAge(index);
|
|
2748
|
+
if (status) this.#statusTTL(status, index);
|
|
2749
|
+
return v;
|
|
2750
|
+
}
|
|
2751
|
+
const p = this.#backgroundFetch(k, index, options, context);
|
|
2752
|
+
const hasStale = void 0 !== p.__staleWhileFetching;
|
|
2753
|
+
const staleVal = hasStale && allowStale;
|
|
2754
|
+
if (status) {
|
|
2755
|
+
status.fetch = isStale ? 'stale' : 'refresh';
|
|
2756
|
+
if (staleVal && isStale) status.returnedStale = true;
|
|
2757
|
+
}
|
|
2758
|
+
return staleVal ? p.__staleWhileFetching : p.__returned = p;
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
async forceFetch(k, fetchOptions = {}) {
|
|
2762
|
+
const v = await this.fetch(k, fetchOptions);
|
|
2763
|
+
if (void 0 === v) throw new Error('fetch() returned undefined');
|
|
2764
|
+
return v;
|
|
2765
|
+
}
|
|
2766
|
+
memo(k, memoOptions = {}) {
|
|
2767
|
+
const memoMethod = this.#memoMethod;
|
|
2768
|
+
if (!memoMethod) throw new Error('no memoMethod provided to constructor');
|
|
2769
|
+
const { context, forceRefresh, ...options } = memoOptions;
|
|
2770
|
+
const v = this.get(k, options);
|
|
2771
|
+
if (!forceRefresh && void 0 !== v) return v;
|
|
2772
|
+
const vv = memoMethod(k, v, {
|
|
2773
|
+
options,
|
|
2774
|
+
context
|
|
2775
|
+
});
|
|
2776
|
+
this.set(k, vv, options);
|
|
2777
|
+
return vv;
|
|
2778
|
+
}
|
|
2779
|
+
get(k, getOptions = {}) {
|
|
2780
|
+
const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
|
|
2781
|
+
const index = this.#keyMap.get(k);
|
|
2782
|
+
if (void 0 !== index) {
|
|
2783
|
+
const value = this.#valList[index];
|
|
2784
|
+
const fetching = this.#isBackgroundFetch(value);
|
|
2785
|
+
if (status) this.#statusTTL(status, index);
|
|
2786
|
+
if (this.#isStale(index)) {
|
|
2787
|
+
if (status) status.get = 'stale';
|
|
2788
|
+
if (fetching) {
|
|
2789
|
+
if (status && allowStale && void 0 !== value.__staleWhileFetching) status.returnedStale = true;
|
|
2790
|
+
return allowStale ? value.__staleWhileFetching : void 0;
|
|
2791
|
+
}
|
|
2792
|
+
if (!noDeleteOnStaleGet) this.#delete(k, 'expire');
|
|
2793
|
+
if (status && allowStale) status.returnedStale = true;
|
|
2794
|
+
return allowStale ? value : void 0;
|
|
2795
|
+
}
|
|
2796
|
+
if (status) status.get = 'hit';
|
|
2797
|
+
if (fetching) return value.__staleWhileFetching;
|
|
2798
|
+
this.#moveToTail(index);
|
|
2799
|
+
if (updateAgeOnGet) this.#updateItemAge(index);
|
|
2800
|
+
return value;
|
|
2801
|
+
}
|
|
2802
|
+
if (status) status.get = 'miss';
|
|
2803
|
+
}
|
|
2804
|
+
#connect(p, n) {
|
|
2805
|
+
this.#prev[n] = p;
|
|
2806
|
+
this.#next[p] = n;
|
|
2807
|
+
}
|
|
2808
|
+
#moveToTail(index) {
|
|
2809
|
+
if (index !== this.#tail) {
|
|
2810
|
+
if (index === this.#head) this.#head = this.#next[index];
|
|
2811
|
+
else this.#connect(this.#prev[index], this.#next[index]);
|
|
2812
|
+
this.#connect(this.#tail, index);
|
|
2813
|
+
this.#tail = index;
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
delete(k) {
|
|
2817
|
+
return this.#delete(k, 'delete');
|
|
2818
|
+
}
|
|
2819
|
+
#delete(k, reason) {
|
|
2820
|
+
let deleted = false;
|
|
2821
|
+
if (0 !== this.#size) {
|
|
2822
|
+
const index = this.#keyMap.get(k);
|
|
2823
|
+
if (void 0 !== index) {
|
|
2824
|
+
deleted = true;
|
|
2825
|
+
if (1 === this.#size) this.#clear(reason);
|
|
2826
|
+
else {
|
|
2827
|
+
this.#removeItemSize(index);
|
|
2828
|
+
const v = this.#valList[index];
|
|
2829
|
+
if (this.#isBackgroundFetch(v)) v.__abortController.abort(new Error('deleted'));
|
|
2830
|
+
else if (this.#hasDispose || this.#hasDisposeAfter) {
|
|
2831
|
+
if (this.#hasDispose) this.#dispose?.(v, k, reason);
|
|
2832
|
+
if (this.#hasDisposeAfter) this.#disposed?.push([
|
|
2833
|
+
v,
|
|
2834
|
+
k,
|
|
2835
|
+
reason
|
|
2836
|
+
]);
|
|
2837
|
+
}
|
|
2838
|
+
this.#keyMap.delete(k);
|
|
2839
|
+
this.#keyList[index] = void 0;
|
|
2840
|
+
this.#valList[index] = void 0;
|
|
2841
|
+
if (index === this.#tail) this.#tail = this.#prev[index];
|
|
2842
|
+
else if (index === this.#head) this.#head = this.#next[index];
|
|
2843
|
+
else {
|
|
2844
|
+
const pi = this.#prev[index];
|
|
2845
|
+
this.#next[pi] = this.#next[index];
|
|
2846
|
+
const ni = this.#next[index];
|
|
2847
|
+
this.#prev[ni] = this.#prev[index];
|
|
2848
|
+
}
|
|
2849
|
+
this.#size--;
|
|
2850
|
+
this.#free.push(index);
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
if (this.#hasDisposeAfter && this.#disposed?.length) {
|
|
2855
|
+
const dt = this.#disposed;
|
|
2856
|
+
let task;
|
|
2857
|
+
while(task = dt?.shift())this.#disposeAfter?.(...task);
|
|
2858
|
+
}
|
|
2859
|
+
return deleted;
|
|
2860
|
+
}
|
|
2861
|
+
clear() {
|
|
2862
|
+
return this.#clear('delete');
|
|
2863
|
+
}
|
|
2864
|
+
#clear(reason) {
|
|
2865
|
+
for (const index of this.#rindexes({
|
|
2866
|
+
allowStale: true
|
|
2867
|
+
})){
|
|
2868
|
+
const v = this.#valList[index];
|
|
2869
|
+
if (this.#isBackgroundFetch(v)) v.__abortController.abort(new Error('deleted'));
|
|
2870
|
+
else {
|
|
2871
|
+
const k = this.#keyList[index];
|
|
2872
|
+
if (this.#hasDispose) this.#dispose?.(v, k, reason);
|
|
2873
|
+
if (this.#hasDisposeAfter) this.#disposed?.push([
|
|
2874
|
+
v,
|
|
2875
|
+
k,
|
|
2876
|
+
reason
|
|
2877
|
+
]);
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
this.#keyMap.clear();
|
|
2881
|
+
this.#valList.fill(void 0);
|
|
2882
|
+
this.#keyList.fill(void 0);
|
|
2883
|
+
if (this.#ttls && this.#starts) {
|
|
2884
|
+
this.#ttls.fill(0);
|
|
2885
|
+
this.#starts.fill(0);
|
|
2886
|
+
}
|
|
2887
|
+
if (this.#sizes) this.#sizes.fill(0);
|
|
2888
|
+
this.#head = 0;
|
|
2889
|
+
this.#tail = 0;
|
|
2890
|
+
this.#free.length = 0;
|
|
2891
|
+
this.#calculatedSize = 0;
|
|
2892
|
+
this.#size = 0;
|
|
2893
|
+
if (this.#hasDisposeAfter && this.#disposed) {
|
|
2894
|
+
const dt = this.#disposed;
|
|
2895
|
+
let task;
|
|
2896
|
+
while(task = dt?.shift())this.#disposeAfter?.(...task);
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
/*! *****************************************************************************
|
|
2901
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2902
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
2903
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
2904
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
2905
|
+
|
|
2906
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
2907
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
2908
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
2909
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
2910
|
+
|
|
2911
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
2912
|
+
and limitations under the License.
|
|
2913
|
+
***************************************************************************** */ const minimalLibDts = `
|
|
2914
|
+
interface ReadonlyArray<T> {
|
|
2915
|
+
readonly length: number;
|
|
2916
|
+
toString(): string;
|
|
2917
|
+
toLocaleString(): string;
|
|
2918
|
+
concat(...items: ConcatArray<T>[]): T[];
|
|
2919
|
+
concat(...items: (T | ConcatArray<T>)[]): T[];
|
|
2920
|
+
join(separator?: string): string;
|
|
2921
|
+
slice(start?: number, end?: number): T[];
|
|
2922
|
+
indexOf(searchElement: T, fromIndex?: number): number;
|
|
2923
|
+
lastIndexOf(searchElement: T, fromIndex?: number): number;
|
|
2924
|
+
every<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): this is readonly S[];
|
|
2925
|
+
every(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;
|
|
2926
|
+
some(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean;
|
|
2927
|
+
forEach(callbackfn: (value: T, index: number, array: readonly T[]) => void, thisArg?: any): void;
|
|
2928
|
+
map<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[];
|
|
2929
|
+
filter<S extends T>(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[];
|
|
2930
|
+
filter(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[];
|
|
2931
|
+
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T;
|
|
2932
|
+
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T;
|
|
2933
|
+
reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U;
|
|
2934
|
+
reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T;
|
|
2935
|
+
reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T;
|
|
2936
|
+
reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U;
|
|
2937
|
+
readonly [n: number]: T;
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
interface Array<T> {
|
|
2941
|
+
length: number;
|
|
2942
|
+
toString(): string;
|
|
2943
|
+
toLocaleString(): string;
|
|
2944
|
+
pop(): T | undefined;
|
|
2945
|
+
push(...items: T[]): number;
|
|
2946
|
+
concat(...items: ConcatArray<T>[]): T[];
|
|
2947
|
+
concat(...items: (T | ConcatArray<T>)[]): T[];
|
|
2948
|
+
join(separator?: string): string;
|
|
2949
|
+
reverse(): T[];
|
|
2950
|
+
shift(): T | undefined;
|
|
2951
|
+
slice(start?: number, end?: number): T[];
|
|
2952
|
+
sort(compareFn?: (a: T, b: T) => number): this;
|
|
2953
|
+
splice(start: number, deleteCount?: number): T[];
|
|
2954
|
+
splice(start: number, deleteCount: number, ...items: T[]): T[];
|
|
2955
|
+
unshift(...items: T[]): number;
|
|
2956
|
+
indexOf(searchElement: T, fromIndex?: number): number;
|
|
2957
|
+
lastIndexOf(searchElement: T, fromIndex?: number): number;
|
|
2958
|
+
every<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[];
|
|
2959
|
+
every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
|
|
2960
|
+
some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
|
|
2961
|
+
forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
|
|
2962
|
+
map<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
|
|
2963
|
+
filter<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[];
|
|
2964
|
+
filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];
|
|
2965
|
+
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T;
|
|
2966
|
+
reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T;
|
|
2967
|
+
reduce<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
|
|
2968
|
+
reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T;
|
|
2969
|
+
reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T;
|
|
2970
|
+
reduceRight<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
|
|
2971
|
+
[n: number]: T;
|
|
2972
|
+
}
|
|
2973
|
+
`;
|
|
2974
|
+
function createCompilerHosts(fs) {
|
|
2975
|
+
const node10 = new CompilerHostWrapper(fs, typescript.ModuleResolutionKind.Node10, typescript.ModuleKind.CommonJS);
|
|
2976
|
+
const node16 = new CompilerHostWrapper(fs, typescript.ModuleResolutionKind.Node16, typescript.ModuleKind.Node16);
|
|
2977
|
+
const bundler = new CompilerHostWrapper(fs, typescript.ModuleResolutionKind.Bundler, typescript.ModuleKind.ESNext);
|
|
2978
|
+
return {
|
|
2979
|
+
node10,
|
|
2980
|
+
node16,
|
|
2981
|
+
bundler,
|
|
2982
|
+
findHostForFiles (files) {
|
|
2983
|
+
for (const host of [
|
|
2984
|
+
node10,
|
|
2985
|
+
node16,
|
|
2986
|
+
bundler
|
|
2987
|
+
])if (files.every((f)=>void 0 !== host.getSourceFileFromCache(f))) return host;
|
|
2988
|
+
}
|
|
2989
|
+
};
|
|
2990
|
+
}
|
|
2991
|
+
const getCanonicalFileName = typescript.createGetCanonicalFileName(false);
|
|
2992
|
+
const toPath = (fileName)=>typescript.toPath(fileName, "/", getCanonicalFileName);
|
|
2993
|
+
class CompilerHostWrapper {
|
|
2994
|
+
constructor(fs, moduleResolution, moduleKind){
|
|
2995
|
+
this.programCache = new LRUCache({
|
|
2996
|
+
max: 2
|
|
2997
|
+
});
|
|
2998
|
+
this.moduleResolutionCache = {};
|
|
2999
|
+
this.traceCollector = new TraceCollector();
|
|
3000
|
+
this.sourceFileCache = new Map();
|
|
3001
|
+
this.resolvedModules = new Map();
|
|
3002
|
+
this.languageVersion = typescript.ScriptTarget.Latest;
|
|
3003
|
+
this.compilerOptions = {
|
|
3004
|
+
moduleResolution,
|
|
3005
|
+
module: moduleKind,
|
|
3006
|
+
moduleDetection: typescript.ModuleDetectionKind.Legacy,
|
|
3007
|
+
target: typescript.ScriptTarget.Latest,
|
|
3008
|
+
resolveJsonModule: true,
|
|
3009
|
+
traceResolution: true
|
|
3010
|
+
};
|
|
3011
|
+
this.normalModuleResolutionCache = typescript.createModuleResolutionCache("/", getCanonicalFileName, this.compilerOptions);
|
|
3012
|
+
this.noDtsResolutionModuleResolutionCache = typescript.createModuleResolutionCache("/", getCanonicalFileName, this.compilerOptions);
|
|
3013
|
+
this.compilerHost = this.createCompilerHost(fs, this.sourceFileCache);
|
|
3014
|
+
}
|
|
3015
|
+
getCompilerOptions() {
|
|
3016
|
+
return this.compilerOptions;
|
|
3017
|
+
}
|
|
3018
|
+
getSourceFile(fileName) {
|
|
3019
|
+
return this.compilerHost.getSourceFile(fileName, this.languageVersion);
|
|
3020
|
+
}
|
|
3021
|
+
getSourceFileFromCache(fileName) {
|
|
3022
|
+
return this.sourceFileCache.get(toPath(fileName));
|
|
3023
|
+
}
|
|
3024
|
+
getModuleKindForFile(fileName) {
|
|
3025
|
+
var _a;
|
|
3026
|
+
const kind = this.getImpliedNodeFormatForFile(fileName);
|
|
3027
|
+
if (kind) {
|
|
3028
|
+
const extension = typescript.getAnyExtensionFromPath(fileName);
|
|
3029
|
+
const isExtension = extension === typescript.Extension.Cjs || extension === typescript.Extension.Cts || extension === typescript.Extension.Dcts || extension === typescript.Extension.Mjs || extension === typescript.Extension.Mts || extension === typescript.Extension.Dmts;
|
|
3030
|
+
const reasonPackageJsonInfo = isExtension ? void 0 : this.getPackageScopeForPath(fileName);
|
|
3031
|
+
const reasonFileName = isExtension ? fileName : reasonPackageJsonInfo ? reasonPackageJsonInfo.packageDirectory + "/package.json" : fileName;
|
|
3032
|
+
const reasonPackageJsonType = null == (_a = null == reasonPackageJsonInfo ? void 0 : reasonPackageJsonInfo.contents) ? void 0 : _a.packageJsonContent.type;
|
|
3033
|
+
return {
|
|
3034
|
+
detectedKind: kind,
|
|
3035
|
+
detectedReason: isExtension ? "extension" : reasonPackageJsonType ? "type" : "no:type",
|
|
3036
|
+
reasonFileName
|
|
3037
|
+
};
|
|
3038
|
+
}
|
|
3039
|
+
}
|
|
3040
|
+
resolveModuleName(moduleName, containingFile, resolutionMode, noDtsResolution, allowJs) {
|
|
3041
|
+
var _a, _b, _c;
|
|
3042
|
+
var _d;
|
|
3043
|
+
const moduleKey = this.getModuleKey(moduleName, resolutionMode, noDtsResolution, allowJs);
|
|
3044
|
+
if (null == (_a = this.moduleResolutionCache[containingFile]) ? void 0 : _a[moduleKey]) {
|
|
3045
|
+
const { resolution, trace } = this.moduleResolutionCache[containingFile][moduleKey];
|
|
3046
|
+
return {
|
|
3047
|
+
resolution,
|
|
3048
|
+
trace
|
|
3049
|
+
};
|
|
3050
|
+
}
|
|
3051
|
+
this.traceCollector.clear();
|
|
3052
|
+
const resolution = typescript.resolveModuleName(moduleName, containingFile, noDtsResolution ? {
|
|
3053
|
+
...this.compilerOptions,
|
|
3054
|
+
noDtsResolution,
|
|
3055
|
+
allowJs
|
|
3056
|
+
} : this.compilerOptions, this.compilerHost, noDtsResolution ? this.noDtsResolutionModuleResolutionCache : this.normalModuleResolutionCache, void 0, resolutionMode);
|
|
3057
|
+
const trace = this.traceCollector.read();
|
|
3058
|
+
if (!(null == (_b = this.moduleResolutionCache[containingFile]) ? void 0 : _b[moduleKey])) (null != (_c = (_d = this.moduleResolutionCache)[containingFile]) ? _c : _d[containingFile] = {})[moduleKey] = {
|
|
3059
|
+
resolution,
|
|
3060
|
+
trace
|
|
3061
|
+
};
|
|
3062
|
+
return {
|
|
3063
|
+
resolution,
|
|
3064
|
+
trace
|
|
3065
|
+
};
|
|
3066
|
+
}
|
|
3067
|
+
getTrace(fromFileName, moduleSpecifier, resolutionMode) {
|
|
3068
|
+
var _a, _b;
|
|
3069
|
+
return null == (_b = null == (_a = this.moduleResolutionCache[fromFileName]) ? void 0 : _a[this.getModuleKey(moduleSpecifier, resolutionMode, void 0, void 0)]) ? void 0 : _b.trace;
|
|
3070
|
+
}
|
|
3071
|
+
getModuleKey(moduleSpecifier, resolutionMode, noDtsResolution, allowJs) {
|
|
3072
|
+
return `${null != resolutionMode ? resolutionMode : 1}:${+!!noDtsResolution}:${+!!allowJs}:${moduleSpecifier}`;
|
|
3073
|
+
}
|
|
3074
|
+
getProgram(rootNames, options) {
|
|
3075
|
+
const key = programKey(rootNames, options);
|
|
3076
|
+
let program = this.programCache.get(key);
|
|
3077
|
+
if (!program) this.programCache.set(key, program = typescript.createProgram({
|
|
3078
|
+
rootNames,
|
|
3079
|
+
options,
|
|
3080
|
+
host: this.compilerHost
|
|
3081
|
+
}));
|
|
3082
|
+
return program;
|
|
3083
|
+
}
|
|
3084
|
+
createPrimaryProgram(rootName) {
|
|
3085
|
+
var _a;
|
|
3086
|
+
const program = this.getProgram([
|
|
3087
|
+
rootName
|
|
3088
|
+
], this.compilerOptions);
|
|
3089
|
+
null == (_a = program.resolvedModules) || _a.forEach((cache, path)=>{
|
|
3090
|
+
let ownCache = this.resolvedModules.get(path);
|
|
3091
|
+
if (!ownCache) this.resolvedModules.set(path, ownCache = typescript.createModeAwareCache());
|
|
3092
|
+
cache.forEach((resolution, key, mode)=>{
|
|
3093
|
+
ownCache.set(key, mode, resolution);
|
|
3094
|
+
});
|
|
3095
|
+
});
|
|
3096
|
+
return program;
|
|
3097
|
+
}
|
|
3098
|
+
createAuxiliaryProgram(rootNames, extraOptions) {
|
|
3099
|
+
if (extraOptions && typescript.changesAffectModuleResolution({
|
|
3100
|
+
...this.compilerOptions,
|
|
3101
|
+
allowJs: extraOptions.allowJs,
|
|
3102
|
+
checkJs: extraOptions.checkJs,
|
|
3103
|
+
noDtsResolution: extraOptions.noDtsResolution
|
|
3104
|
+
}, {
|
|
3105
|
+
...this.compilerOptions,
|
|
3106
|
+
...extraOptions
|
|
3107
|
+
})) throw new Error("Cannot override resolution-affecting options for host due to potential cache pollution");
|
|
3108
|
+
const options = extraOptions ? {
|
|
3109
|
+
...this.compilerOptions,
|
|
3110
|
+
...extraOptions
|
|
3111
|
+
} : this.compilerOptions;
|
|
3112
|
+
return this.getProgram(rootNames, options);
|
|
3113
|
+
}
|
|
3114
|
+
getResolvedModule(sourceFile, moduleName, resolutionMode) {
|
|
3115
|
+
var _a;
|
|
3116
|
+
return null == (_a = this.resolvedModules.get(sourceFile.path)) ? void 0 : _a.get(moduleName, resolutionMode);
|
|
3117
|
+
}
|
|
3118
|
+
createCompilerHost(fs, sourceFileCache) {
|
|
3119
|
+
return {
|
|
3120
|
+
fileExists: fs.fileExists.bind(fs),
|
|
3121
|
+
readFile: fs.readFile.bind(fs),
|
|
3122
|
+
directoryExists: fs.directoryExists.bind(fs),
|
|
3123
|
+
getSourceFile: (fileName)=>{
|
|
3124
|
+
const path = toPath(fileName);
|
|
3125
|
+
const cached = sourceFileCache.get(path);
|
|
3126
|
+
if (cached) return cached;
|
|
3127
|
+
const content = "/node_modules/typescript/lib/lib.d.ts" === fileName ? minimalLibDts : fs.tryReadFile(fileName);
|
|
3128
|
+
if (void 0 === content) return;
|
|
3129
|
+
const sourceFile = typescript.createSourceFile(fileName, content, {
|
|
3130
|
+
languageVersion: this.languageVersion,
|
|
3131
|
+
impliedNodeFormat: this.getImpliedNodeFormatForFile(fileName)
|
|
3132
|
+
}, true);
|
|
3133
|
+
sourceFileCache.set(path, sourceFile);
|
|
3134
|
+
return sourceFile;
|
|
3135
|
+
},
|
|
3136
|
+
getDefaultLibFileName: ()=>"/node_modules/typescript/lib/lib.d.ts",
|
|
3137
|
+
getCurrentDirectory: ()=>"/",
|
|
3138
|
+
writeFile: ()=>{
|
|
3139
|
+
throw new Error("Not implemented");
|
|
3140
|
+
},
|
|
3141
|
+
getCanonicalFileName: getCanonicalFileName,
|
|
3142
|
+
useCaseSensitiveFileNames: ()=>false,
|
|
3143
|
+
getNewLine: ()=>"\n",
|
|
3144
|
+
trace: this.traceCollector.trace,
|
|
3145
|
+
resolveModuleNameLiterals: (moduleLiterals, containingFile, _redirectedReference, options, containingSourceFile)=>moduleLiterals.map((literal)=>this.resolveModuleName(literal.text, containingFile, typescript.getModeForUsageLocation(containingSourceFile, literal, this.compilerOptions), options.noDtsResolution).resolution)
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
3148
|
+
getImpliedNodeFormatForFile(fileName) {
|
|
3149
|
+
return typescript.getImpliedNodeFormatForFile(toPath(fileName), this.normalModuleResolutionCache.getPackageJsonInfoCache(), this.compilerHost, this.compilerOptions);
|
|
3150
|
+
}
|
|
3151
|
+
getPackageScopeForPath(fileName) {
|
|
3152
|
+
return typescript.getPackageScopeForPath(fileName, typescript.getTemporaryModuleResolutionState(this.normalModuleResolutionCache.getPackageJsonInfoCache(), this.compilerHost, this.compilerOptions));
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3155
|
+
class TraceCollector {
|
|
3156
|
+
constructor(){
|
|
3157
|
+
this.traces = [];
|
|
3158
|
+
this.trace = (message)=>{
|
|
3159
|
+
this.traces.push(message);
|
|
3160
|
+
};
|
|
3161
|
+
}
|
|
3162
|
+
read() {
|
|
3163
|
+
const result = this.traces.slice();
|
|
3164
|
+
this.clear();
|
|
3165
|
+
return result;
|
|
3166
|
+
}
|
|
3167
|
+
clear() {
|
|
3168
|
+
this.traces.length = 0;
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
function programKey(rootNames, options) {
|
|
3172
|
+
return JSON.stringify([
|
|
3173
|
+
rootNames,
|
|
3174
|
+
Object.entries(options).sort(([k1], [k2])=>k1.localeCompare(k2))
|
|
3175
|
+
]);
|
|
3176
|
+
}
|
|
3177
|
+
const getEntrypointInfo_extensions = new Set([
|
|
3178
|
+
".jsx",
|
|
3179
|
+
".tsx",
|
|
3180
|
+
".js",
|
|
3181
|
+
".ts",
|
|
3182
|
+
".mjs",
|
|
3183
|
+
".cjs",
|
|
3184
|
+
".mts",
|
|
3185
|
+
".cjs"
|
|
3186
|
+
]);
|
|
3187
|
+
function getEntrypoints(fs, exportsObject, options) {
|
|
3188
|
+
var _a, _b;
|
|
3189
|
+
if (null == options ? void 0 : options.entrypoints) return options.entrypoints.map((e)=>formatEntrypointString(e, fs.packageName));
|
|
3190
|
+
if (void 0 === exportsObject && fs) {
|
|
3191
|
+
const rootDir = `/node_modules/${fs.packageName}`;
|
|
3192
|
+
const proxies = getProxyDirectories(rootDir, fs);
|
|
3193
|
+
if (0 === proxies.length) {
|
|
3194
|
+
if (null == options ? void 0 : options.entrypointsLegacy) return fs.listFiles().filter((f)=>!typescript.isDeclarationFileName(f) && getEntrypointInfo_extensions.has(f.slice(f.lastIndexOf(".")))).map((f)=>"." + f.slice(rootDir.length));
|
|
3195
|
+
return [
|
|
3196
|
+
"."
|
|
3197
|
+
];
|
|
3198
|
+
}
|
|
3199
|
+
return proxies;
|
|
3200
|
+
}
|
|
3201
|
+
const detectedSubpaths = getSubpaths(exportsObject);
|
|
3202
|
+
if (0 === detectedSubpaths.length) detectedSubpaths.push(".");
|
|
3203
|
+
const included = unique([
|
|
3204
|
+
...detectedSubpaths,
|
|
3205
|
+
...null != (_b = null == (_a = null == options ? void 0 : options.includeEntrypoints) ? void 0 : _a.map((e)=>formatEntrypointString(e, fs.packageName))) ? _b : []
|
|
3206
|
+
]);
|
|
3207
|
+
if (!(null == options ? void 0 : options.excludeEntrypoints)) return included;
|
|
3208
|
+
return included.filter((entrypoint)=>!options.excludeEntrypoints.some((exclusion)=>{
|
|
3209
|
+
if ("string" == typeof exclusion) return formatEntrypointString(exclusion, fs.packageName) === entrypoint;
|
|
3210
|
+
return exclusion.test(entrypoint);
|
|
3211
|
+
}));
|
|
3212
|
+
}
|
|
3213
|
+
function formatEntrypointString(path, packageName) {
|
|
3214
|
+
return ("." === path || path.startsWith("./") ? path : path === packageName ? "." : path.startsWith(`${packageName}/`) ? `.${path.slice(packageName.length)}` : `./${path}`).trim();
|
|
3215
|
+
}
|
|
3216
|
+
function getSubpaths(exportsObject) {
|
|
3217
|
+
if (!exportsObject || "object" != typeof exportsObject || Array.isArray(exportsObject)) return [];
|
|
3218
|
+
const keys = Object.keys(exportsObject);
|
|
3219
|
+
if (keys[0].startsWith(".")) return keys;
|
|
3220
|
+
return keys.flatMap((key)=>getSubpaths(exportsObject[key]));
|
|
3221
|
+
}
|
|
3222
|
+
function getProxyDirectories(rootDir, fs) {
|
|
3223
|
+
const vendorDirectories = new Set();
|
|
3224
|
+
const proxyDirectories = [];
|
|
3225
|
+
const files = fs.listFiles().sort((a, b)=>a.length - b.length);
|
|
3226
|
+
for (const file of files)if (file.startsWith(rootDir) && file.endsWith("/package.json")) try {
|
|
3227
|
+
const packageJson = JSON.parse(fs.readFile(file));
|
|
3228
|
+
if (packageJson.name && !packageJson.name.startsWith(fs.packageName)) {
|
|
3229
|
+
const vendorDir = file.slice(0, file.lastIndexOf("/"));
|
|
3230
|
+
vendorDirectories.add(vendorDir);
|
|
3231
|
+
} else if ("main" in packageJson && !isInsideVendorDirectory(file)) {
|
|
3232
|
+
const proxyDir = "." + file.slice(rootDir.length, file.lastIndexOf("/"));
|
|
3233
|
+
proxyDirectories.push(proxyDir);
|
|
3234
|
+
}
|
|
3235
|
+
} catch {}
|
|
3236
|
+
return proxyDirectories.sort((a, b)=>typescript.comparePathsCaseInsensitive(a, b));
|
|
3237
|
+
function isInsideVendorDirectory(file) {
|
|
3238
|
+
return !!typescript.forEachAncestorDirectory(file, (dir)=>{
|
|
3239
|
+
if (vendorDirectories.has(dir)) return true;
|
|
3240
|
+
});
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
function getEntrypointInfo(packageName, fs, hosts, options) {
|
|
3244
|
+
const packageJson = JSON.parse(fs.readFile(`/node_modules/${packageName}/package.json`));
|
|
3245
|
+
let entrypoints = getEntrypoints(fs, packageJson.exports, options);
|
|
3246
|
+
if (fs.typesPackage) {
|
|
3247
|
+
const typesPackageJson = JSON.parse(fs.readFile(`/node_modules/${fs.typesPackage.packageName}/package.json`));
|
|
3248
|
+
const typesEntrypoints = getEntrypoints(fs, typesPackageJson.exports, options);
|
|
3249
|
+
entrypoints = unique([
|
|
3250
|
+
...entrypoints,
|
|
3251
|
+
...typesEntrypoints
|
|
3252
|
+
]);
|
|
3253
|
+
}
|
|
3254
|
+
const result = {};
|
|
3255
|
+
for (const entrypoint of entrypoints){
|
|
3256
|
+
const resolutions = {
|
|
3257
|
+
node10: getEntrypointResolution(packageName, hosts.node10, "node10", entrypoint),
|
|
3258
|
+
"node16-cjs": getEntrypointResolution(packageName, hosts.node16, "node16-cjs", entrypoint),
|
|
3259
|
+
"node16-esm": getEntrypointResolution(packageName, hosts.node16, "node16-esm", entrypoint),
|
|
3260
|
+
bundler: getEntrypointResolution(packageName, hosts.bundler, "bundler", entrypoint)
|
|
3261
|
+
};
|
|
3262
|
+
result[entrypoint] = {
|
|
3263
|
+
subpath: entrypoint,
|
|
3264
|
+
resolutions,
|
|
3265
|
+
hasTypes: Object.values(resolutions).some((r)=>{
|
|
3266
|
+
var _a;
|
|
3267
|
+
return null == (_a = r.resolution) ? void 0 : _a.isTypeScript;
|
|
3268
|
+
}),
|
|
3269
|
+
isWildcard: !!resolutions.bundler.isWildcard
|
|
3270
|
+
};
|
|
3271
|
+
}
|
|
3272
|
+
return result;
|
|
3273
|
+
}
|
|
3274
|
+
function getEntrypointResolution(packageName, host, resolutionKind, entrypoint) {
|
|
3275
|
+
if (entrypoint.includes("*")) return {
|
|
3276
|
+
name: entrypoint,
|
|
3277
|
+
resolutionKind,
|
|
3278
|
+
isWildcard: true
|
|
3279
|
+
};
|
|
3280
|
+
const moduleSpecifier = packageName + entrypoint.substring(1);
|
|
3281
|
+
const importingFileName = "node16-esm" === resolutionKind ? "/index.mts" : "/index.ts";
|
|
3282
|
+
const resolutionMode = "node16-esm" === resolutionKind ? typescript.ModuleKind.ESNext : "node16-cjs" === resolutionKind ? typescript.ModuleKind.CommonJS : void 0;
|
|
3283
|
+
const resolution = tryResolve();
|
|
3284
|
+
const implementationResolution = tryResolve(true);
|
|
3285
|
+
const files = resolution ? host.createPrimaryProgram(resolution.fileName).getSourceFiles().map((f)=>f.fileName) : void 0;
|
|
3286
|
+
return {
|
|
3287
|
+
name: entrypoint,
|
|
3288
|
+
resolutionKind,
|
|
3289
|
+
resolution,
|
|
3290
|
+
implementationResolution,
|
|
3291
|
+
files
|
|
3292
|
+
};
|
|
3293
|
+
function tryResolve(noDtsResolution) {
|
|
3294
|
+
var _a;
|
|
3295
|
+
const { resolution, trace } = host.resolveModuleName(moduleSpecifier, importingFileName, resolutionMode, noDtsResolution);
|
|
3296
|
+
const fileName = null == (_a = resolution.resolvedModule) ? void 0 : _a.resolvedFileName;
|
|
3297
|
+
if (!fileName) return;
|
|
3298
|
+
return {
|
|
3299
|
+
fileName,
|
|
3300
|
+
isJson: resolution.resolvedModule.extension === typescript.Extension.Json,
|
|
3301
|
+
isTypeScript: typescript.hasTSFileExtension(resolution.resolvedModule.resolvedFileName),
|
|
3302
|
+
trace
|
|
3303
|
+
};
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
function unique(array) {
|
|
3307
|
+
return array.filter((value, index)=>array.indexOf(value) === index);
|
|
3308
|
+
}
|
|
3309
|
+
function getBuildTools(packageJson) {
|
|
3310
|
+
if (!packageJson.devDependencies) return {};
|
|
3311
|
+
const result = {};
|
|
3312
|
+
for (const buildTool of allBuildTools)if (buildTool in packageJson.devDependencies) result[buildTool] = packageJson.devDependencies[buildTool];
|
|
3313
|
+
return result;
|
|
3314
|
+
}
|
|
3315
|
+
function getModuleKinds(entrypoints, resolutionOption, hosts) {
|
|
3316
|
+
var _a;
|
|
3317
|
+
const host = hosts[resolutionOption];
|
|
3318
|
+
const result = {};
|
|
3319
|
+
for (const resolutionKind of getResolutionKinds(resolutionOption))for (const entrypoint of Object.values(entrypoints)){
|
|
3320
|
+
const resolution = entrypoint.resolutions[resolutionKind];
|
|
3321
|
+
for (const fileName of null != (_a = resolution.files) ? _a : [])if (!result[fileName]) result[fileName] = host.getModuleKindForFile(fileName);
|
|
3322
|
+
if (resolution.implementationResolution) {
|
|
3323
|
+
const fileName = resolution.implementationResolution.fileName;
|
|
3324
|
+
if (!result[fileName]) result[fileName] = host.getModuleKindForFile(fileName);
|
|
3325
|
+
}
|
|
3326
|
+
}
|
|
3327
|
+
return result;
|
|
3328
|
+
}
|
|
3329
|
+
async function checkPackage(pkg, options) {
|
|
3330
|
+
const types = pkg.typesPackage ? {
|
|
3331
|
+
kind: "@types",
|
|
3332
|
+
...pkg.typesPackage,
|
|
3333
|
+
definitelyTypedUrl: JSON.parse(pkg.readFile(`/node_modules/${pkg.typesPackage.packageName}/package.json`)).homepage
|
|
3334
|
+
} : pkg.containsTypes() ? {
|
|
3335
|
+
kind: "included"
|
|
3336
|
+
} : false;
|
|
3337
|
+
const { packageName, packageVersion } = pkg;
|
|
3338
|
+
if (!types) return {
|
|
3339
|
+
packageName,
|
|
3340
|
+
packageVersion,
|
|
3341
|
+
types
|
|
3342
|
+
};
|
|
3343
|
+
const hosts = createCompilerHosts(pkg);
|
|
3344
|
+
const entrypointResolutions = getEntrypointInfo(packageName, pkg, hosts, options);
|
|
3345
|
+
const programInfo = {
|
|
3346
|
+
node10: {},
|
|
3347
|
+
node16: {
|
|
3348
|
+
moduleKinds: getModuleKinds(entrypointResolutions, "node16", hosts)
|
|
3349
|
+
},
|
|
3350
|
+
bundler: {}
|
|
3351
|
+
};
|
|
3352
|
+
await lexer_init();
|
|
3353
|
+
const problems = [];
|
|
3354
|
+
const problemIdsToIndices = new Map();
|
|
3355
|
+
visitResolutions(entrypointResolutions, (analysis, info)=>{
|
|
3356
|
+
var _a;
|
|
3357
|
+
for (const check of checks){
|
|
3358
|
+
const context = {
|
|
3359
|
+
pkg,
|
|
3360
|
+
hosts,
|
|
3361
|
+
entrypoints: entrypointResolutions,
|
|
3362
|
+
programInfo,
|
|
3363
|
+
subpath: info.subpath,
|
|
3364
|
+
resolutionKind: analysis.resolutionKind,
|
|
3365
|
+
resolutionOption: getResolutionOption(analysis.resolutionKind),
|
|
3366
|
+
fileName: void 0
|
|
3367
|
+
};
|
|
3368
|
+
if (check.enumerateFiles) {
|
|
3369
|
+
for (const fileName of null != (_a = analysis.files) ? _a : [])runCheck(check, {
|
|
3370
|
+
...context,
|
|
3371
|
+
fileName
|
|
3372
|
+
}, analysis);
|
|
3373
|
+
if (analysis.implementationResolution) runCheck(check, {
|
|
3374
|
+
...context,
|
|
3375
|
+
fileName: analysis.implementationResolution.fileName
|
|
3376
|
+
}, analysis);
|
|
3377
|
+
} else runCheck(check, context, analysis);
|
|
3378
|
+
}
|
|
3379
|
+
});
|
|
3380
|
+
return {
|
|
3381
|
+
packageName,
|
|
3382
|
+
packageVersion,
|
|
3383
|
+
types,
|
|
3384
|
+
buildTools: getBuildTools(JSON.parse(pkg.readFile(`/node_modules/${packageName}/package.json`))),
|
|
3385
|
+
entrypoints: entrypointResolutions,
|
|
3386
|
+
programInfo,
|
|
3387
|
+
problems
|
|
3388
|
+
};
|
|
3389
|
+
function runCheck(check, context, analysis) {
|
|
3390
|
+
var _a, _b;
|
|
3391
|
+
const dependencies = check.dependencies(context);
|
|
3392
|
+
const id = check.name + JSON.stringify(dependencies, (_, value)=>{
|
|
3393
|
+
if ("function" == typeof value) throw new Error("Encountered unexpected function in check dependencies");
|
|
3394
|
+
return value;
|
|
3395
|
+
});
|
|
3396
|
+
let indices = problemIdsToIndices.get(id);
|
|
3397
|
+
if (indices) (null != (_a = analysis.visibleProblems) ? _a : analysis.visibleProblems = []).push(...indices);
|
|
3398
|
+
else {
|
|
3399
|
+
indices = [];
|
|
3400
|
+
const checkProblems = check.execute(dependencies, context);
|
|
3401
|
+
for (const problem of Array.isArray(checkProblems) ? checkProblems : checkProblems ? [
|
|
3402
|
+
checkProblems
|
|
3403
|
+
] : []){
|
|
3404
|
+
indices.push(problems.length);
|
|
3405
|
+
problems.push(problem);
|
|
3406
|
+
}
|
|
3407
|
+
problemIdsToIndices.set(id, indices);
|
|
3408
|
+
(null != (_b = analysis.visibleProblems) ? _b : analysis.visibleProblems = []).push(...indices);
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
export { checkPackage, createPackageFromTarballData };
|