@unocss/language-server 66.6.6 → 66.6.8
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/{chunk-C9ebiww4.mjs → chunk-CBBoxR_p.mjs} +8 -14
- package/dist/{dist-Dwf-d4OE.mjs → dist-DJp734Em.mjs} +2 -4
- package/dist/{dist-BUrt6dYo.cjs → dist-FL7p7uq2.cjs} +17 -20
- package/dist/index.d.mts +8 -3
- package/dist/index.mjs +683 -719
- package/dist/jiti-du6HSta6.cjs +4474 -0
- package/dist/{loader-CxlILAbz.mjs → loader-DsXvVy9i.mjs} +4 -19
- package/dist/{multipart-parser-s9tbX9e1.cjs → multipart-parser-DiNB_U8f.cjs} +13 -15
- package/dist/{multipart-parser-D3zGHRx2.mjs → multipart-parser-KkZpcbcp.mjs} +3 -5
- package/dist/{node-B8nS8lcG.cjs → node-3wiZdXIz.cjs} +40 -42
- package/dist/{node-CautW6cw.cjs → node-BM09n__k.cjs} +969 -967
- package/dist/{node-rKyHxxpg.mjs → node-Cd2HRubI.mjs} +930 -928
- package/dist/{node-DvibxqDE.mjs → node-D23LglTq.mjs} +32 -34
- package/dist/{node-loader-BO0uvH6Z.cjs → node-loader-BJV6yUBJ.cjs} +676 -689
- package/dist/{node-loader-DpZIWCu9.mjs → node-loader-ZSa5xzQw.mjs} +440 -453
- package/dist/{prompt-BJqhZQ-_.cjs → prompt-jldWOuck.cjs} +265 -267
- package/dist/server.cjs +14417 -14572
- package/package.json +39 -6
- package/dist/jiti-B459FbZV.cjs +0 -4477
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as isAbsolute, n as searchForIcon, r as getPossibleIconNames, t as loadIcon } from "./loader-
|
|
2
|
-
import { t as joinURL } from "./dist-
|
|
3
|
-
import { builtinModules
|
|
4
|
-
import fs, { existsSync,
|
|
1
|
+
import { i as isAbsolute, n as searchForIcon, r as getPossibleIconNames, t as loadIcon } from "./loader-DsXvVy9i.mjs";
|
|
2
|
+
import { t as joinURL } from "./dist-DJp734Em.mjs";
|
|
3
|
+
import { builtinModules } from "node:module";
|
|
4
|
+
import fs, { existsSync, realpathSync, statSync } from "node:fs";
|
|
5
5
|
import fs$1 from "node:fs/promises";
|
|
6
6
|
import path, { delimiter, dirname, normalize, resolve } from "node:path";
|
|
7
7
|
import process$1, { cwd } from "node:process";
|
|
@@ -14,7 +14,6 @@ import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
|
|
|
14
14
|
import assert from "node:assert";
|
|
15
15
|
import v8 from "node:v8";
|
|
16
16
|
import { promises as promises$1 } from "fs";
|
|
17
|
-
|
|
18
17
|
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.0/node_modules/@iconify/utils/lib/loader/warn.js
|
|
19
18
|
const warned = /* @__PURE__ */ new Set();
|
|
20
19
|
function warnOnce(msg) {
|
|
@@ -23,7 +22,6 @@ function warnOnce(msg) {
|
|
|
23
22
|
console.warn(styleText("yellow", `[@iconify-loader] ${msg}`));
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
//#endregion
|
|
28
26
|
//#region ../../node_modules/.pnpm/package-manager-detector@1.6.0/node_modules/package-manager-detector/dist/constants.mjs
|
|
29
27
|
const AGENTS = [
|
|
@@ -56,7 +54,6 @@ const INSTALL_METADATA = {
|
|
|
56
54
|
"bun.lock": "bun",
|
|
57
55
|
"bun.lockb": "bun"
|
|
58
56
|
};
|
|
59
|
-
|
|
60
57
|
//#endregion
|
|
61
58
|
//#region ../../node_modules/.pnpm/package-manager-detector@1.6.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
62
59
|
async function pathExists(path2, type) {
|
|
@@ -67,8 +64,8 @@ async function pathExists(path2, type) {
|
|
|
67
64
|
return false;
|
|
68
65
|
}
|
|
69
66
|
}
|
|
70
|
-
function* lookup(cwd
|
|
71
|
-
let directory = path.resolve(cwd
|
|
67
|
+
function* lookup(cwd = process$1.cwd()) {
|
|
68
|
+
let directory = path.resolve(cwd);
|
|
72
69
|
const { root } = path.parse(directory);
|
|
73
70
|
while (directory && directory !== root) {
|
|
74
71
|
yield directory;
|
|
@@ -80,7 +77,7 @@ async function parsePackageJson(filepath, options) {
|
|
|
80
77
|
return await handlePackageManager(filepath, options);
|
|
81
78
|
}
|
|
82
79
|
async function detect(options = {}) {
|
|
83
|
-
const { cwd
|
|
80
|
+
const { cwd, strategies = [
|
|
84
81
|
"lockfile",
|
|
85
82
|
"packageManager-field",
|
|
86
83
|
"devEngines-field"
|
|
@@ -90,7 +87,7 @@ async function detect(options = {}) {
|
|
|
90
87
|
const resolved = path.resolve(options.stopDir);
|
|
91
88
|
stopDir = (dir) => dir === resolved;
|
|
92
89
|
} else stopDir = options.stopDir;
|
|
93
|
-
for (const directory of lookup(cwd
|
|
90
|
+
for (const directory of lookup(cwd)) {
|
|
94
91
|
for (const strategy of strategies) switch (strategy) {
|
|
95
92
|
case "lockfile":
|
|
96
93
|
for (const lock of Object.keys(LOCKS)) if (await pathExists(path.join(directory, lock), "file")) {
|
|
@@ -127,7 +124,7 @@ async function detect(options = {}) {
|
|
|
127
124
|
return null;
|
|
128
125
|
}
|
|
129
126
|
function getNameAndVer(pkg) {
|
|
130
|
-
const handelVer = (version
|
|
127
|
+
const handelVer = (version) => version?.match(/\d+(\.\d+){0,2}/)?.[0] ?? version;
|
|
131
128
|
if (typeof pkg.packageManager === "string") {
|
|
132
129
|
const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
|
|
133
130
|
return {
|
|
@@ -149,28 +146,28 @@ async function handlePackageManager(filepath, options) {
|
|
|
149
146
|
if (nameAndVer) {
|
|
150
147
|
const name = nameAndVer.name;
|
|
151
148
|
const ver = nameAndVer.ver;
|
|
152
|
-
let version
|
|
149
|
+
let version = ver;
|
|
153
150
|
if (name === "yarn" && ver && Number.parseInt(ver) > 1) {
|
|
154
151
|
agent = "yarn@berry";
|
|
155
|
-
version
|
|
152
|
+
version = "berry";
|
|
156
153
|
return {
|
|
157
154
|
name,
|
|
158
155
|
agent,
|
|
159
|
-
version
|
|
156
|
+
version
|
|
160
157
|
};
|
|
161
158
|
} else if (name === "pnpm" && ver && Number.parseInt(ver) < 7) {
|
|
162
159
|
agent = "pnpm@6";
|
|
163
160
|
return {
|
|
164
161
|
name,
|
|
165
162
|
agent,
|
|
166
|
-
version
|
|
163
|
+
version
|
|
167
164
|
};
|
|
168
165
|
} else if (AGENTS.includes(name)) {
|
|
169
166
|
agent = name;
|
|
170
167
|
return {
|
|
171
168
|
name,
|
|
172
169
|
agent,
|
|
173
|
-
version
|
|
170
|
+
version
|
|
174
171
|
};
|
|
175
172
|
} else return options.onUnknown?.(pkg.packageManager) ?? null;
|
|
176
173
|
}
|
|
@@ -180,7 +177,6 @@ async function handlePackageManager(filepath, options) {
|
|
|
180
177
|
function isMetadataYarnClassic(metadataPath) {
|
|
181
178
|
return metadataPath.endsWith(".yarn_integrity");
|
|
182
179
|
}
|
|
183
|
-
|
|
184
180
|
//#endregion
|
|
185
181
|
//#region ../../node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.js
|
|
186
182
|
var l = Object.create;
|
|
@@ -191,10 +187,10 @@ var p = Object.getPrototypeOf;
|
|
|
191
187
|
var m = Object.prototype.hasOwnProperty;
|
|
192
188
|
var h = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports);
|
|
193
189
|
var g = (e, t, n, r) => {
|
|
194
|
-
if (t && typeof t === "object" || typeof t === "function") for (var i
|
|
195
|
-
s = i
|
|
190
|
+
if (t && typeof t === "object" || typeof t === "function") for (var i = f(t), a = 0, o = i.length, s; a < o; a++) {
|
|
191
|
+
s = i[a];
|
|
196
192
|
if (!m.call(e, s) && s !== n) u(e, s, {
|
|
197
|
-
get: ((e
|
|
193
|
+
get: ((e) => t[e]).bind(null, s),
|
|
198
194
|
enumerable: !(r = d(t, s)) || r.enumerable
|
|
199
195
|
});
|
|
200
196
|
}
|
|
@@ -223,17 +219,17 @@ function x(e) {
|
|
|
223
219
|
return b;
|
|
224
220
|
}
|
|
225
221
|
function S(e, t) {
|
|
226
|
-
const i
|
|
222
|
+
const i = t.value.split(delimiter);
|
|
227
223
|
let o = e;
|
|
228
224
|
let s;
|
|
229
225
|
do {
|
|
230
|
-
i
|
|
226
|
+
i.push(resolve(o, "node_modules", ".bin"));
|
|
231
227
|
s = o;
|
|
232
228
|
o = dirname(o);
|
|
233
229
|
} while (o !== s);
|
|
234
230
|
return {
|
|
235
231
|
key: t.key,
|
|
236
|
-
value: i
|
|
232
|
+
value: i.join(delimiter)
|
|
237
233
|
};
|
|
238
234
|
}
|
|
239
235
|
function C(e, t) {
|
|
@@ -251,9 +247,9 @@ const w = (e) => {
|
|
|
251
247
|
const r = () => {
|
|
252
248
|
if (--t === 0) n.emit("end");
|
|
253
249
|
};
|
|
254
|
-
for (const t
|
|
255
|
-
t
|
|
256
|
-
t
|
|
250
|
+
for (const t of e) {
|
|
251
|
+
t.pipe(n, { end: false });
|
|
252
|
+
t.on("end", r);
|
|
257
253
|
}
|
|
258
254
|
return n;
|
|
259
255
|
};
|
|
@@ -261,56 +257,56 @@ var T = h((exports, t) => {
|
|
|
261
257
|
t.exports = a;
|
|
262
258
|
a.sync = o;
|
|
263
259
|
var n = v("fs");
|
|
264
|
-
function r(e, t
|
|
265
|
-
var n
|
|
266
|
-
if (!n
|
|
267
|
-
n
|
|
268
|
-
if (n
|
|
269
|
-
for (var r
|
|
270
|
-
var i
|
|
271
|
-
if (i
|
|
260
|
+
function r(e, t) {
|
|
261
|
+
var n = t.pathExt !== void 0 ? t.pathExt : process.env.PATHEXT;
|
|
262
|
+
if (!n) return true;
|
|
263
|
+
n = n.split(";");
|
|
264
|
+
if (n.indexOf("") !== -1) return true;
|
|
265
|
+
for (var r = 0; r < n.length; r++) {
|
|
266
|
+
var i = n[r].toLowerCase();
|
|
267
|
+
if (i && e.substr(-i.length).toLowerCase() === i) return true;
|
|
272
268
|
}
|
|
273
269
|
return false;
|
|
274
270
|
}
|
|
275
|
-
function i
|
|
271
|
+
function i(e, t, n) {
|
|
276
272
|
if (!e.isSymbolicLink() && !e.isFile()) return false;
|
|
277
|
-
return r(t
|
|
273
|
+
return r(t, n);
|
|
278
274
|
}
|
|
279
|
-
function a(e, t
|
|
280
|
-
n.stat(e, function(n
|
|
281
|
-
r
|
|
275
|
+
function a(e, t, r) {
|
|
276
|
+
n.stat(e, function(n, a) {
|
|
277
|
+
r(n, n ? false : i(a, e, t));
|
|
282
278
|
});
|
|
283
279
|
}
|
|
284
|
-
function o(e, t
|
|
285
|
-
return i
|
|
280
|
+
function o(e, t) {
|
|
281
|
+
return i(n.statSync(e), e, t);
|
|
286
282
|
}
|
|
287
283
|
});
|
|
288
284
|
var E = h((exports, t) => {
|
|
289
285
|
t.exports = r;
|
|
290
|
-
r.sync = i
|
|
286
|
+
r.sync = i;
|
|
291
287
|
var n = v("fs");
|
|
292
|
-
function r(e, t
|
|
293
|
-
n.stat(e, function(e
|
|
294
|
-
r
|
|
288
|
+
function r(e, t, r) {
|
|
289
|
+
n.stat(e, function(e, n) {
|
|
290
|
+
r(e, e ? false : a(n, t));
|
|
295
291
|
});
|
|
296
292
|
}
|
|
297
|
-
function i
|
|
298
|
-
return a(n.statSync(e), t
|
|
293
|
+
function i(e, t) {
|
|
294
|
+
return a(n.statSync(e), t);
|
|
299
295
|
}
|
|
300
|
-
function a(e, t
|
|
301
|
-
return e.isFile() && o(e, t
|
|
296
|
+
function a(e, t) {
|
|
297
|
+
return e.isFile() && o(e, t);
|
|
302
298
|
}
|
|
303
|
-
function o(e, t
|
|
304
|
-
var n
|
|
305
|
-
var r
|
|
306
|
-
var i
|
|
307
|
-
var a
|
|
308
|
-
var o
|
|
299
|
+
function o(e, t) {
|
|
300
|
+
var n = e.mode;
|
|
301
|
+
var r = e.uid;
|
|
302
|
+
var i = e.gid;
|
|
303
|
+
var a = t.uid !== void 0 ? t.uid : process.getuid && process.getuid();
|
|
304
|
+
var o = t.gid !== void 0 ? t.gid : process.getgid && process.getgid();
|
|
309
305
|
var s = parseInt("100", 8);
|
|
310
|
-
var c
|
|
311
|
-
var l
|
|
312
|
-
var u
|
|
313
|
-
return n
|
|
306
|
+
var c = parseInt("010", 8);
|
|
307
|
+
var l = parseInt("001", 8);
|
|
308
|
+
var u = s | c;
|
|
309
|
+
return n & l || n & c && i === o || n & s && r === a || n & u && a === 0;
|
|
314
310
|
}
|
|
315
311
|
});
|
|
316
312
|
var D = h((exports, t) => {
|
|
@@ -318,116 +314,116 @@ var D = h((exports, t) => {
|
|
|
318
314
|
var r;
|
|
319
315
|
if (process.platform === "win32" || global.TESTING_WINDOWS) r = T();
|
|
320
316
|
else r = E();
|
|
321
|
-
t.exports = i
|
|
322
|
-
i
|
|
323
|
-
function i
|
|
324
|
-
if (typeof t
|
|
325
|
-
n = t
|
|
326
|
-
t
|
|
317
|
+
t.exports = i;
|
|
318
|
+
i.sync = a;
|
|
319
|
+
function i(e, t, n) {
|
|
320
|
+
if (typeof t === "function") {
|
|
321
|
+
n = t;
|
|
322
|
+
t = {};
|
|
327
323
|
}
|
|
328
324
|
if (!n) {
|
|
329
325
|
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
330
|
-
return new Promise(function(n
|
|
331
|
-
i
|
|
332
|
-
if (e
|
|
333
|
-
else n
|
|
326
|
+
return new Promise(function(n, r) {
|
|
327
|
+
i(e, t || {}, function(e, t) {
|
|
328
|
+
if (e) r(e);
|
|
329
|
+
else n(t);
|
|
334
330
|
});
|
|
335
331
|
});
|
|
336
332
|
}
|
|
337
|
-
r(e, t
|
|
338
|
-
if (e
|
|
339
|
-
if (e
|
|
340
|
-
e
|
|
341
|
-
r
|
|
333
|
+
r(e, t || {}, function(e, r) {
|
|
334
|
+
if (e) {
|
|
335
|
+
if (e.code === "EACCES" || t && t.ignoreErrors) {
|
|
336
|
+
e = null;
|
|
337
|
+
r = false;
|
|
342
338
|
}
|
|
343
339
|
}
|
|
344
|
-
n(e
|
|
340
|
+
n(e, r);
|
|
345
341
|
});
|
|
346
342
|
}
|
|
347
|
-
function a(e, t
|
|
343
|
+
function a(e, t) {
|
|
348
344
|
try {
|
|
349
|
-
return r.sync(e, t
|
|
350
|
-
} catch (e
|
|
351
|
-
if (t
|
|
352
|
-
else throw e
|
|
345
|
+
return r.sync(e, t || {});
|
|
346
|
+
} catch (e) {
|
|
347
|
+
if (t && t.ignoreErrors || e.code === "EACCES") return false;
|
|
348
|
+
else throw e;
|
|
353
349
|
}
|
|
354
350
|
}
|
|
355
351
|
});
|
|
356
352
|
var O = h((exports, t) => {
|
|
357
353
|
const n = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
358
354
|
const r = v("path");
|
|
359
|
-
const i
|
|
355
|
+
const i = n ? ";" : ":";
|
|
360
356
|
const a = D();
|
|
361
357
|
const o = (e) => Object.assign(/* @__PURE__ */ new Error(`not found: ${e}`), { code: "ENOENT" });
|
|
362
|
-
const s = (e, t
|
|
363
|
-
const r
|
|
364
|
-
const a
|
|
365
|
-
const o
|
|
366
|
-
const s
|
|
358
|
+
const s = (e, t) => {
|
|
359
|
+
const r = t.colon || i;
|
|
360
|
+
const a = e.match(/\//) || n && e.match(/\\/) ? [""] : [...n ? [process.cwd()] : [], ...(t.path || process.env.PATH || "").split(r)];
|
|
361
|
+
const o = n ? t.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
362
|
+
const s = n ? o.split(r) : [""];
|
|
367
363
|
if (n) {
|
|
368
|
-
if (e.indexOf(".") !== -1 && s
|
|
364
|
+
if (e.indexOf(".") !== -1 && s[0] !== "") s.unshift("");
|
|
369
365
|
}
|
|
370
366
|
return {
|
|
371
|
-
pathEnv: a
|
|
372
|
-
pathExt: s
|
|
373
|
-
pathExtExe: o
|
|
367
|
+
pathEnv: a,
|
|
368
|
+
pathExt: s,
|
|
369
|
+
pathExtExe: o
|
|
374
370
|
};
|
|
375
371
|
};
|
|
376
|
-
const c
|
|
377
|
-
if (typeof t
|
|
378
|
-
n
|
|
379
|
-
t
|
|
372
|
+
const c = (e, t, n) => {
|
|
373
|
+
if (typeof t === "function") {
|
|
374
|
+
n = t;
|
|
375
|
+
t = {};
|
|
380
376
|
}
|
|
381
|
-
if (!t
|
|
382
|
-
const { pathEnv: i
|
|
383
|
-
const u
|
|
384
|
-
const d
|
|
385
|
-
if (n
|
|
386
|
-
const c
|
|
387
|
-
const l
|
|
388
|
-
const d
|
|
389
|
-
a
|
|
377
|
+
if (!t) t = {};
|
|
378
|
+
const { pathEnv: i, pathExt: c, pathExtExe: l } = s(e, t);
|
|
379
|
+
const u = [];
|
|
380
|
+
const d = (n) => new Promise((a, s) => {
|
|
381
|
+
if (n === i.length) return t.all && u.length ? a(u) : s(o(e));
|
|
382
|
+
const c = i[n];
|
|
383
|
+
const l = /^".*"$/.test(c) ? c.slice(1, -1) : c;
|
|
384
|
+
const d = r.join(l, e);
|
|
385
|
+
a(f(!l && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d, n, 0));
|
|
390
386
|
});
|
|
391
|
-
const f
|
|
392
|
-
if (r
|
|
393
|
-
const s
|
|
394
|
-
a(e
|
|
395
|
-
if (!a
|
|
396
|
-
else return i
|
|
397
|
-
return i
|
|
387
|
+
const f = (e, n, r) => new Promise((i, o) => {
|
|
388
|
+
if (r === c.length) return i(d(n + 1));
|
|
389
|
+
const s = c[r];
|
|
390
|
+
a(e + s, { pathExt: l }, (a, o) => {
|
|
391
|
+
if (!a && o) if (t.all) u.push(e + s);
|
|
392
|
+
else return i(e + s);
|
|
393
|
+
return i(f(e, n, r + 1));
|
|
398
394
|
});
|
|
399
395
|
});
|
|
400
|
-
return n
|
|
396
|
+
return n ? d(0).then((e) => n(null, e), n) : d(0);
|
|
401
397
|
};
|
|
402
|
-
const l
|
|
403
|
-
t
|
|
404
|
-
const { pathEnv: n
|
|
405
|
-
const l
|
|
406
|
-
for (let o
|
|
407
|
-
const s
|
|
408
|
-
const u
|
|
409
|
-
const d
|
|
410
|
-
const f
|
|
411
|
-
for (let e
|
|
412
|
-
const n
|
|
398
|
+
const l = (e, t) => {
|
|
399
|
+
t = t || {};
|
|
400
|
+
const { pathEnv: n, pathExt: i, pathExtExe: c } = s(e, t);
|
|
401
|
+
const l = [];
|
|
402
|
+
for (let o = 0; o < n.length; o++) {
|
|
403
|
+
const s = n[o];
|
|
404
|
+
const u = /^".*"$/.test(s) ? s.slice(1, -1) : s;
|
|
405
|
+
const d = r.join(u, e);
|
|
406
|
+
const f = !u && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d;
|
|
407
|
+
for (let e = 0; e < i.length; e++) {
|
|
408
|
+
const n = f + i[e];
|
|
413
409
|
try {
|
|
414
|
-
if (a.sync(n
|
|
415
|
-
else return n
|
|
416
|
-
} catch (e
|
|
410
|
+
if (a.sync(n, { pathExt: c })) if (t.all) l.push(n);
|
|
411
|
+
else return n;
|
|
412
|
+
} catch (e) {}
|
|
417
413
|
}
|
|
418
414
|
}
|
|
419
|
-
if (t
|
|
420
|
-
if (t
|
|
415
|
+
if (t.all && l.length) return l;
|
|
416
|
+
if (t.nothrow) return null;
|
|
421
417
|
throw o(e);
|
|
422
418
|
};
|
|
423
|
-
t.exports = c
|
|
424
|
-
c
|
|
419
|
+
t.exports = c;
|
|
420
|
+
c.sync = l;
|
|
425
421
|
});
|
|
426
422
|
var k = h((exports, t) => {
|
|
427
423
|
const n = (e = {}) => {
|
|
428
|
-
const t
|
|
424
|
+
const t = e.env || process.env;
|
|
429
425
|
if ((e.platform || process.platform) !== "win32") return "PATH";
|
|
430
|
-
return Object.keys(t
|
|
426
|
+
return Object.keys(t).reverse().find((e) => e.toUpperCase() === "PATH") || "Path";
|
|
431
427
|
};
|
|
432
428
|
t.exports = n;
|
|
433
429
|
t.exports.default = n;
|
|
@@ -435,26 +431,26 @@ var k = h((exports, t) => {
|
|
|
435
431
|
var A = h((exports, t) => {
|
|
436
432
|
const n = v("path");
|
|
437
433
|
const r = O();
|
|
438
|
-
const i
|
|
439
|
-
function a(e, t
|
|
440
|
-
const a
|
|
441
|
-
const o
|
|
434
|
+
const i = k();
|
|
435
|
+
function a(e, t) {
|
|
436
|
+
const a = e.options.env || process.env;
|
|
437
|
+
const o = process.cwd();
|
|
442
438
|
const s = e.options.cwd != null;
|
|
443
|
-
const c
|
|
444
|
-
if (c
|
|
439
|
+
const c = s && process.chdir !== void 0 && !process.chdir.disabled;
|
|
440
|
+
if (c) try {
|
|
445
441
|
process.chdir(e.options.cwd);
|
|
446
|
-
} catch (e
|
|
447
|
-
let l
|
|
442
|
+
} catch (e) {}
|
|
443
|
+
let l;
|
|
448
444
|
try {
|
|
449
|
-
l
|
|
450
|
-
path: a
|
|
451
|
-
pathExt: t
|
|
445
|
+
l = r.sync(e.command, {
|
|
446
|
+
path: a[i({ env: a })],
|
|
447
|
+
pathExt: t ? n.delimiter : void 0
|
|
452
448
|
});
|
|
453
|
-
} catch (e
|
|
454
|
-
if (c
|
|
449
|
+
} catch (e) {} finally {
|
|
450
|
+
if (c) process.chdir(o);
|
|
455
451
|
}
|
|
456
|
-
if (l
|
|
457
|
-
return l
|
|
452
|
+
if (l) l = n.resolve(s ? e.options.cwd : "", l);
|
|
453
|
+
return l;
|
|
458
454
|
}
|
|
459
455
|
function o(e) {
|
|
460
456
|
return a(e) || a(e, true);
|
|
@@ -467,17 +463,17 @@ var j = h((exports, t) => {
|
|
|
467
463
|
e = e.replace(n, "^$1");
|
|
468
464
|
return e;
|
|
469
465
|
}
|
|
470
|
-
function i
|
|
466
|
+
function i(e, t) {
|
|
471
467
|
e = `${e}`;
|
|
472
468
|
e = e.replace(/(\\*)"/g, "$1$1\\\"");
|
|
473
469
|
e = e.replace(/(\\*)$/, "$1$1");
|
|
474
470
|
e = `"${e}"`;
|
|
475
471
|
e = e.replace(n, "^$1");
|
|
476
|
-
if (t
|
|
472
|
+
if (t) e = e.replace(n, "^$1");
|
|
477
473
|
return e;
|
|
478
474
|
}
|
|
479
475
|
t.exports.command = r;
|
|
480
|
-
t.exports.argument = i
|
|
476
|
+
t.exports.argument = i;
|
|
481
477
|
});
|
|
482
478
|
var M = h((exports, t) => {
|
|
483
479
|
t.exports = /^#!(.*)/;
|
|
@@ -485,57 +481,57 @@ var M = h((exports, t) => {
|
|
|
485
481
|
var N = h((exports, t) => {
|
|
486
482
|
const n = M();
|
|
487
483
|
t.exports = (e = "") => {
|
|
488
|
-
const t
|
|
489
|
-
if (!t
|
|
490
|
-
const [r, i
|
|
484
|
+
const t = e.match(n);
|
|
485
|
+
if (!t) return null;
|
|
486
|
+
const [r, i] = t[0].replace(/#! ?/, "").split(" ");
|
|
491
487
|
const a = r.split("/").pop();
|
|
492
|
-
if (a === "env") return i
|
|
493
|
-
return i
|
|
488
|
+
if (a === "env") return i;
|
|
489
|
+
return i ? `${a} ${i}` : a;
|
|
494
490
|
};
|
|
495
491
|
});
|
|
496
492
|
var P = h((exports, t) => {
|
|
497
493
|
const n = v("fs");
|
|
498
494
|
const r = N();
|
|
499
|
-
function i
|
|
500
|
-
const t
|
|
501
|
-
const i
|
|
495
|
+
function i(e) {
|
|
496
|
+
const t = 150;
|
|
497
|
+
const i = Buffer.alloc(t);
|
|
502
498
|
let a;
|
|
503
499
|
try {
|
|
504
500
|
a = n.openSync(e, "r");
|
|
505
|
-
n.readSync(a, i
|
|
501
|
+
n.readSync(a, i, 0, t, 0);
|
|
506
502
|
n.closeSync(a);
|
|
507
|
-
} catch (e
|
|
508
|
-
return r(i
|
|
503
|
+
} catch (e) {}
|
|
504
|
+
return r(i.toString());
|
|
509
505
|
}
|
|
510
|
-
t.exports = i
|
|
506
|
+
t.exports = i;
|
|
511
507
|
});
|
|
512
508
|
var F = h((exports, t) => {
|
|
513
509
|
const n = v("path");
|
|
514
510
|
const r = A();
|
|
515
|
-
const i
|
|
511
|
+
const i = j();
|
|
516
512
|
const a = P();
|
|
517
513
|
const o = process.platform === "win32";
|
|
518
514
|
const s = /\.(?:com|exe)$/i;
|
|
519
|
-
const c
|
|
520
|
-
function l
|
|
515
|
+
const c = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
516
|
+
function l(e) {
|
|
521
517
|
e.file = r(e);
|
|
522
|
-
const t
|
|
523
|
-
if (t
|
|
518
|
+
const t = e.file && a(e.file);
|
|
519
|
+
if (t) {
|
|
524
520
|
e.args.unshift(e.file);
|
|
525
|
-
e.command = t
|
|
521
|
+
e.command = t;
|
|
526
522
|
return r(e);
|
|
527
523
|
}
|
|
528
524
|
return e.file;
|
|
529
525
|
}
|
|
530
|
-
function u
|
|
526
|
+
function u(e) {
|
|
531
527
|
if (!o) return e;
|
|
532
|
-
const t
|
|
533
|
-
const r
|
|
534
|
-
if (e.options.forceShell || r
|
|
535
|
-
const r
|
|
528
|
+
const t = l(e);
|
|
529
|
+
const r = !s.test(t);
|
|
530
|
+
if (e.options.forceShell || r) {
|
|
531
|
+
const r = c.test(t);
|
|
536
532
|
e.command = n.normalize(e.command);
|
|
537
|
-
e.command = i
|
|
538
|
-
e.args = e.args.map((e
|
|
533
|
+
e.command = i.command(e.command);
|
|
534
|
+
e.args = e.args.map((e) => i.argument(e, r));
|
|
539
535
|
e.args = [
|
|
540
536
|
"/d",
|
|
541
537
|
"/s",
|
|
@@ -547,59 +543,59 @@ var F = h((exports, t) => {
|
|
|
547
543
|
}
|
|
548
544
|
return e;
|
|
549
545
|
}
|
|
550
|
-
function d
|
|
551
|
-
if (t
|
|
552
|
-
n
|
|
553
|
-
t
|
|
546
|
+
function d(e, t, n) {
|
|
547
|
+
if (t && !Array.isArray(t)) {
|
|
548
|
+
n = t;
|
|
549
|
+
t = null;
|
|
554
550
|
}
|
|
555
|
-
t
|
|
556
|
-
n
|
|
557
|
-
const r
|
|
551
|
+
t = t ? t.slice(0) : [];
|
|
552
|
+
n = Object.assign({}, n);
|
|
553
|
+
const r = {
|
|
558
554
|
command: e,
|
|
559
|
-
args: t
|
|
560
|
-
options: n
|
|
555
|
+
args: t,
|
|
556
|
+
options: n,
|
|
561
557
|
file: void 0,
|
|
562
558
|
original: {
|
|
563
559
|
command: e,
|
|
564
|
-
args: t
|
|
560
|
+
args: t
|
|
565
561
|
}
|
|
566
562
|
};
|
|
567
|
-
return n
|
|
563
|
+
return n.shell ? r : u(r);
|
|
568
564
|
}
|
|
569
|
-
t.exports = d
|
|
565
|
+
t.exports = d;
|
|
570
566
|
});
|
|
571
567
|
var I = h((exports, t) => {
|
|
572
568
|
const n = process.platform === "win32";
|
|
573
|
-
function r(e, t
|
|
574
|
-
return Object.assign(/* @__PURE__ */ new Error(`${t
|
|
569
|
+
function r(e, t) {
|
|
570
|
+
return Object.assign(/* @__PURE__ */ new Error(`${t} ${e.command} ENOENT`), {
|
|
575
571
|
code: "ENOENT",
|
|
576
572
|
errno: "ENOENT",
|
|
577
|
-
syscall: `${t
|
|
573
|
+
syscall: `${t} ${e.command}`,
|
|
578
574
|
path: e.command,
|
|
579
575
|
spawnargs: e.args
|
|
580
576
|
});
|
|
581
577
|
}
|
|
582
|
-
function i
|
|
578
|
+
function i(e, t) {
|
|
583
579
|
if (!n) return;
|
|
584
|
-
const r
|
|
585
|
-
e.emit = function(n
|
|
586
|
-
if (n
|
|
587
|
-
const n
|
|
588
|
-
if (n
|
|
580
|
+
const r = e.emit;
|
|
581
|
+
e.emit = function(n, i) {
|
|
582
|
+
if (n === "exit") {
|
|
583
|
+
const n = a(i, t, "spawn");
|
|
584
|
+
if (n) return r.call(e, "error", n);
|
|
589
585
|
}
|
|
590
|
-
return r
|
|
586
|
+
return r.apply(e, arguments);
|
|
591
587
|
};
|
|
592
588
|
}
|
|
593
|
-
function a(e, t
|
|
594
|
-
if (n && e === 1 && !t
|
|
589
|
+
function a(e, t) {
|
|
590
|
+
if (n && e === 1 && !t.file) return r(t.original, "spawn");
|
|
595
591
|
return null;
|
|
596
592
|
}
|
|
597
|
-
function o(e, t
|
|
598
|
-
if (n && e === 1 && !t
|
|
593
|
+
function o(e, t) {
|
|
594
|
+
if (n && e === 1 && !t.file) return r(t.original, "spawnSync");
|
|
599
595
|
return null;
|
|
600
596
|
}
|
|
601
597
|
t.exports = {
|
|
602
|
-
hookChildProcess: i
|
|
598
|
+
hookChildProcess: i,
|
|
603
599
|
verifyENOENT: a,
|
|
604
600
|
verifyENOENTSync: o,
|
|
605
601
|
notFoundError: r
|
|
@@ -608,24 +604,24 @@ var I = h((exports, t) => {
|
|
|
608
604
|
var R = _(h((exports, t) => {
|
|
609
605
|
const n = v("child_process");
|
|
610
606
|
const r = F();
|
|
611
|
-
const i
|
|
612
|
-
function a(e, t
|
|
613
|
-
const o
|
|
614
|
-
const s = n.spawn(o
|
|
615
|
-
i
|
|
607
|
+
const i = I();
|
|
608
|
+
function a(e, t, a) {
|
|
609
|
+
const o = r(e, t, a);
|
|
610
|
+
const s = n.spawn(o.command, o.args, o.options);
|
|
611
|
+
i.hookChildProcess(s, o);
|
|
616
612
|
return s;
|
|
617
613
|
}
|
|
618
|
-
function o(e, t
|
|
619
|
-
const o
|
|
620
|
-
const s = n.spawnSync(o
|
|
621
|
-
s.error = s.error || i
|
|
614
|
+
function o(e, t, a) {
|
|
615
|
+
const o = r(e, t, a);
|
|
616
|
+
const s = n.spawnSync(o.command, o.args, o.options);
|
|
617
|
+
s.error = s.error || i.verifyENOENTSync(s.status, o);
|
|
622
618
|
return s;
|
|
623
619
|
}
|
|
624
620
|
t.exports = a;
|
|
625
621
|
t.exports.spawn = a;
|
|
626
622
|
t.exports.sync = o;
|
|
627
623
|
t.exports._parse = r;
|
|
628
|
-
t.exports._enoent = i
|
|
624
|
+
t.exports._enoent = i;
|
|
629
625
|
})(), 1);
|
|
630
626
|
var z = class extends Error {
|
|
631
627
|
result;
|
|
@@ -657,10 +653,10 @@ function U(e) {
|
|
|
657
653
|
t.abort();
|
|
658
654
|
return n;
|
|
659
655
|
}
|
|
660
|
-
const e
|
|
656
|
+
const e = () => {
|
|
661
657
|
t.abort(n.reason);
|
|
662
658
|
};
|
|
663
|
-
n.addEventListener("abort", e
|
|
659
|
+
n.addEventListener("abort", e, { signal: t.signal });
|
|
664
660
|
}
|
|
665
661
|
return t.signal;
|
|
666
662
|
}
|
|
@@ -694,8 +690,8 @@ var G = class {
|
|
|
694
690
|
};
|
|
695
691
|
this._command = e;
|
|
696
692
|
this._args = t ?? [];
|
|
697
|
-
this._processClosed = new Promise((e
|
|
698
|
-
this._resolveClose = e
|
|
693
|
+
this._processClosed = new Promise((e) => {
|
|
694
|
+
this._resolveClose = e;
|
|
699
695
|
});
|
|
700
696
|
}
|
|
701
697
|
kill(e) {
|
|
@@ -721,7 +717,7 @@ var G = class {
|
|
|
721
717
|
if (this._streamOut) t.push(this._streamOut);
|
|
722
718
|
const n = w(t);
|
|
723
719
|
const r = c.createInterface({ input: n });
|
|
724
|
-
for await (const e
|
|
720
|
+
for await (const e of r) yield e.toString();
|
|
725
721
|
await this._processClosed;
|
|
726
722
|
e.removeAllListeners();
|
|
727
723
|
if (this._thrownError) throw this._thrownError;
|
|
@@ -755,24 +751,24 @@ var G = class {
|
|
|
755
751
|
...V,
|
|
756
752
|
...n.nodeOptions
|
|
757
753
|
};
|
|
758
|
-
const i
|
|
754
|
+
const i = [];
|
|
759
755
|
this._resetState();
|
|
760
|
-
if (n.timeout !== void 0) i
|
|
761
|
-
if (n.signal !== void 0) i
|
|
756
|
+
if (n.timeout !== void 0) i.push(AbortSignal.timeout(n.timeout));
|
|
757
|
+
if (n.signal !== void 0) i.push(n.signal);
|
|
762
758
|
if (n.persist === true) r.detached = true;
|
|
763
|
-
if (i
|
|
759
|
+
if (i.length > 0) r.signal = U(i);
|
|
764
760
|
r.env = C(e, r.env);
|
|
765
761
|
const { command: a, args: s } = H(this._command, this._args);
|
|
766
|
-
const c
|
|
767
|
-
const l
|
|
768
|
-
if (l
|
|
769
|
-
if (l
|
|
770
|
-
this._process = l
|
|
771
|
-
l
|
|
772
|
-
l
|
|
773
|
-
if (n.stdin !== void 0 && l
|
|
774
|
-
const { stdout: e
|
|
775
|
-
if (e
|
|
762
|
+
const c = (0, R._parse)(a, s, r);
|
|
763
|
+
const l = spawn(c.command, c.args, c.options);
|
|
764
|
+
if (l.stderr) this._streamErr = l.stderr;
|
|
765
|
+
if (l.stdout) this._streamOut = l.stdout;
|
|
766
|
+
this._process = l;
|
|
767
|
+
l.once("error", this._onError);
|
|
768
|
+
l.once("close", this._onClose);
|
|
769
|
+
if (n.stdin !== void 0 && l.stdin && n.stdin.process) {
|
|
770
|
+
const { stdout: e } = n.stdin.process;
|
|
771
|
+
if (e) e.pipe(l.stdin);
|
|
776
772
|
}
|
|
777
773
|
}
|
|
778
774
|
_resetState() {
|
|
@@ -799,12 +795,11 @@ const K = (e, t, n) => {
|
|
|
799
795
|
return r;
|
|
800
796
|
};
|
|
801
797
|
const q = K;
|
|
802
|
-
|
|
803
798
|
//#endregion
|
|
804
799
|
//#region ../../node_modules/.pnpm/@antfu+install-pkg@1.1.0/node_modules/@antfu/install-pkg/dist/index.js
|
|
805
|
-
async function detectPackageManager(cwd
|
|
800
|
+
async function detectPackageManager(cwd = process$1.cwd()) {
|
|
806
801
|
return (await detect({
|
|
807
|
-
cwd
|
|
802
|
+
cwd,
|
|
808
803
|
onUnknown(packageManager) {
|
|
809
804
|
console.warn("[@antfu/install-pkg] Unknown packageManager:", packageManager);
|
|
810
805
|
}
|
|
@@ -840,12 +835,11 @@ async function installPackage(names, options = {}) {
|
|
|
840
835
|
throwOnError: true
|
|
841
836
|
});
|
|
842
837
|
}
|
|
843
|
-
|
|
844
838
|
//#endregion
|
|
845
839
|
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.0/node_modules/@iconify/utils/lib/loader/install-pkg.js
|
|
846
840
|
let pending;
|
|
847
841
|
const tasks = {};
|
|
848
|
-
const sleep = (ms) => new Promise((resolve
|
|
842
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
849
843
|
async function tryInstallPkg(name, autoInstall) {
|
|
850
844
|
if (pending) await pending;
|
|
851
845
|
if (!tasks[name]) {
|
|
@@ -865,7 +859,6 @@ async function tryInstallPkg(name, autoInstall) {
|
|
|
865
859
|
}
|
|
866
860
|
return tasks[name];
|
|
867
861
|
}
|
|
868
|
-
|
|
869
862
|
//#endregion
|
|
870
863
|
//#region ../../node_modules/.pnpm/acorn@8.15.0/node_modules/acorn/dist/acorn.mjs
|
|
871
864
|
var astralIdentifierCodes = [
|
|
@@ -1804,14 +1797,14 @@ var keywords$1 = {
|
|
|
1804
1797
|
6: ecma5AndLessKeywords + " const class extends export import super"
|
|
1805
1798
|
};
|
|
1806
1799
|
var keywordRelationalOperator = /^in(stanceof)?$/;
|
|
1807
|
-
var nonASCIIidentifierStart =
|
|
1808
|
-
var nonASCIIidentifier =
|
|
1800
|
+
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
1801
|
+
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
1809
1802
|
function isInAstralSet(code, set) {
|
|
1810
1803
|
var pos = 65536;
|
|
1811
|
-
for (var i
|
|
1812
|
-
pos += set[i
|
|
1804
|
+
for (var i = 0; i < set.length; i += 2) {
|
|
1805
|
+
pos += set[i];
|
|
1813
1806
|
if (pos > code) return false;
|
|
1814
|
-
pos += set[i
|
|
1807
|
+
pos += set[i + 1];
|
|
1815
1808
|
if (pos >= code) return true;
|
|
1816
1809
|
}
|
|
1817
1810
|
return false;
|
|
@@ -1836,7 +1829,7 @@ function isIdentifierChar(code, astral) {
|
|
|
1836
1829
|
if (astral === false) return false;
|
|
1837
1830
|
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
|
1838
1831
|
}
|
|
1839
|
-
var TokenType = function TokenType
|
|
1832
|
+
var TokenType = function TokenType(label, conf) {
|
|
1840
1833
|
if (conf === void 0) conf = {};
|
|
1841
1834
|
this.label = label;
|
|
1842
1835
|
this.keyword = conf.keyword;
|
|
@@ -2003,9 +1996,9 @@ function isNewLine(code) {
|
|
|
2003
1996
|
}
|
|
2004
1997
|
function nextLineBreak(code, from, end) {
|
|
2005
1998
|
if (end === void 0) end = code.length;
|
|
2006
|
-
for (var i
|
|
2007
|
-
var next = code.charCodeAt(i
|
|
2008
|
-
if (isNewLine(next)) return i
|
|
1999
|
+
for (var i = from; i < end; i++) {
|
|
2000
|
+
var next = code.charCodeAt(i);
|
|
2001
|
+
if (isNewLine(next)) return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1;
|
|
2009
2002
|
}
|
|
2010
2003
|
return -1;
|
|
2011
2004
|
}
|
|
@@ -2022,7 +2015,7 @@ var isArray = Array.isArray || (function(obj) {
|
|
|
2022
2015
|
});
|
|
2023
2016
|
var regexpCache = Object.create(null);
|
|
2024
2017
|
function wordsRegexp(words) {
|
|
2025
|
-
return regexpCache[words] || (regexpCache[words] =
|
|
2018
|
+
return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
|
|
2026
2019
|
}
|
|
2027
2020
|
function codePointToString(code) {
|
|
2028
2021
|
if (code <= 65535) return String.fromCharCode(code);
|
|
@@ -2030,17 +2023,17 @@ function codePointToString(code) {
|
|
|
2030
2023
|
return String.fromCharCode((code >> 10) + 55296, (code & 1023) + 56320);
|
|
2031
2024
|
}
|
|
2032
2025
|
var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
|
|
2033
|
-
var Position = function Position
|
|
2026
|
+
var Position = function Position(line, col) {
|
|
2034
2027
|
this.line = line;
|
|
2035
2028
|
this.column = col;
|
|
2036
2029
|
};
|
|
2037
2030
|
Position.prototype.offset = function offset(n) {
|
|
2038
2031
|
return new Position(this.line, this.column + n);
|
|
2039
2032
|
};
|
|
2040
|
-
var SourceLocation = function SourceLocation
|
|
2033
|
+
var SourceLocation = function SourceLocation(p, start, end) {
|
|
2041
2034
|
this.start = start;
|
|
2042
2035
|
this.end = end;
|
|
2043
|
-
if (p
|
|
2036
|
+
if (p.sourceFile !== null) this.source = p.sourceFile;
|
|
2044
2037
|
};
|
|
2045
2038
|
function getLineInfo(input, offset) {
|
|
2046
2039
|
for (var line = 1, cur = 0;;) {
|
|
@@ -2112,7 +2105,7 @@ function functionFlags(async, generator) {
|
|
|
2112
2105
|
return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0);
|
|
2113
2106
|
}
|
|
2114
2107
|
var BIND_NONE = 0, BIND_VAR = 1, BIND_LEXICAL = 2, BIND_FUNCTION = 3, BIND_SIMPLE_CATCH = 4, BIND_OUTSIDE = 5;
|
|
2115
|
-
var Parser = function Parser
|
|
2108
|
+
var Parser = function Parser(options, input, startPos) {
|
|
2116
2109
|
this.options = options = getOptions(options);
|
|
2117
2110
|
this.sourceFile = options.sourceFile;
|
|
2118
2111
|
this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
|
|
@@ -2182,8 +2175,8 @@ prototypeAccessors.inAsync.get = function() {
|
|
|
2182
2175
|
return (this.currentVarScope().flags & SCOPE_ASYNC) > 0;
|
|
2183
2176
|
};
|
|
2184
2177
|
prototypeAccessors.canAwait.get = function() {
|
|
2185
|
-
for (var i
|
|
2186
|
-
var flags = this.scopeStack[i
|
|
2178
|
+
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
2179
|
+
var flags = this.scopeStack[i].flags;
|
|
2187
2180
|
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT)) return false;
|
|
2188
2181
|
if (flags & SCOPE_FUNCTION) return (flags & SCOPE_ASYNC) > 0;
|
|
2189
2182
|
}
|
|
@@ -2199,8 +2192,8 @@ prototypeAccessors.treatFunctionsAsVar.get = function() {
|
|
|
2199
2192
|
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
2200
2193
|
};
|
|
2201
2194
|
prototypeAccessors.allowNewDotTarget.get = function() {
|
|
2202
|
-
for (var i
|
|
2203
|
-
var flags = this.scopeStack[i
|
|
2195
|
+
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
|
|
2196
|
+
var flags = this.scopeStack[i].flags;
|
|
2204
2197
|
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) || flags & SCOPE_FUNCTION && !(flags & SCOPE_ARROW)) return true;
|
|
2205
2198
|
}
|
|
2206
2199
|
return false;
|
|
@@ -2212,7 +2205,7 @@ Parser.extend = function extend() {
|
|
|
2212
2205
|
var plugins = [], len = arguments.length;
|
|
2213
2206
|
while (len--) plugins[len] = arguments[len];
|
|
2214
2207
|
var cls = this;
|
|
2215
|
-
for (var i
|
|
2208
|
+
for (var i = 0; i < plugins.length; i++) cls = plugins[i](cls);
|
|
2216
2209
|
return cls;
|
|
2217
2210
|
};
|
|
2218
2211
|
Parser.parse = function parse(input, options) {
|
|
@@ -2290,7 +2283,7 @@ pp$9.expect = function(type) {
|
|
|
2290
2283
|
pp$9.unexpected = function(pos) {
|
|
2291
2284
|
this.raise(pos != null ? pos : this.start, "Unexpected token");
|
|
2292
2285
|
};
|
|
2293
|
-
var DestructuringErrors = function DestructuringErrors
|
|
2286
|
+
var DestructuringErrors = function DestructuringErrors() {
|
|
2294
2287
|
this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
|
|
2295
2288
|
};
|
|
2296
2289
|
pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
@@ -2323,8 +2316,8 @@ pp$8.parseTopLevel = function(node) {
|
|
|
2323
2316
|
var stmt = this.parseStatement(null, true, exports);
|
|
2324
2317
|
node.body.push(stmt);
|
|
2325
2318
|
}
|
|
2326
|
-
if (this.inModule) for (var i
|
|
2327
|
-
var name = list
|
|
2319
|
+
if (this.inModule) for (var i = 0, list = Object.keys(this.undefinedExports); i < list.length; i += 1) {
|
|
2320
|
+
var name = list[i];
|
|
2328
2321
|
this.raiseRecoverable(this.undefinedExports[name].start, "Export '" + name + "' is not defined");
|
|
2329
2322
|
}
|
|
2330
2323
|
this.adaptDirectivePrologue(node.body);
|
|
@@ -2462,15 +2455,15 @@ pp$8.parseBreakContinueStatement = function(node, keyword) {
|
|
|
2462
2455
|
node.label = this.parseIdent();
|
|
2463
2456
|
this.semicolon();
|
|
2464
2457
|
}
|
|
2465
|
-
var i
|
|
2466
|
-
for (; i
|
|
2467
|
-
var lab = this.labels[i
|
|
2458
|
+
var i = 0;
|
|
2459
|
+
for (; i < this.labels.length; ++i) {
|
|
2460
|
+
var lab = this.labels[i];
|
|
2468
2461
|
if (node.label == null || lab.name === node.label.name) {
|
|
2469
2462
|
if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
|
|
2470
2463
|
if (node.label && isBreak) break;
|
|
2471
2464
|
}
|
|
2472
2465
|
}
|
|
2473
|
-
if (i
|
|
2466
|
+
if (i === this.labels.length) this.raise(node.start, "Unsyntactic " + keyword);
|
|
2474
2467
|
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
|
|
2475
2468
|
};
|
|
2476
2469
|
pp$8.parseDebuggerStatement = function(node) {
|
|
@@ -2662,10 +2655,10 @@ pp$8.parseEmptyStatement = function(node) {
|
|
|
2662
2655
|
return this.finishNode(node, "EmptyStatement");
|
|
2663
2656
|
};
|
|
2664
2657
|
pp$8.parseLabeledStatement = function(node, maybeName, expr, context) {
|
|
2665
|
-
for (var i$1 = 0, list
|
|
2658
|
+
for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1) if (list[i$1].name === maybeName) this.raise(expr.start, "Label '" + maybeName + "' is already declared");
|
|
2666
2659
|
var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null;
|
|
2667
|
-
for (var i
|
|
2668
|
-
var label$1 = this.labels[i
|
|
2660
|
+
for (var i = this.labels.length - 1; i >= 0; i--) {
|
|
2661
|
+
var label$1 = this.labels[i];
|
|
2669
2662
|
if (label$1.statementStart === node.start) {
|
|
2670
2663
|
label$1.statementStart = this.start;
|
|
2671
2664
|
label$1.kind = kind;
|
|
@@ -2804,7 +2797,7 @@ pp$8.parseClass = function(node, isStatement) {
|
|
|
2804
2797
|
};
|
|
2805
2798
|
pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
2806
2799
|
if (this.eat(types$1.semi)) return null;
|
|
2807
|
-
var ecmaVersion
|
|
2800
|
+
var ecmaVersion = this.options.ecmaVersion;
|
|
2808
2801
|
var node = this.startNode();
|
|
2809
2802
|
var keyName = "";
|
|
2810
2803
|
var isGenerator = false;
|
|
@@ -2812,7 +2805,7 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
|
2812
2805
|
var kind = "method";
|
|
2813
2806
|
var isStatic = false;
|
|
2814
2807
|
if (this.eatContextual("static")) {
|
|
2815
|
-
if (ecmaVersion
|
|
2808
|
+
if (ecmaVersion >= 13 && this.eat(types$1.braceL)) {
|
|
2816
2809
|
this.parseClassStaticBlock(node);
|
|
2817
2810
|
return node;
|
|
2818
2811
|
}
|
|
@@ -2820,9 +2813,9 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
|
2820
2813
|
else keyName = "static";
|
|
2821
2814
|
}
|
|
2822
2815
|
node.static = isStatic;
|
|
2823
|
-
if (!keyName && ecmaVersion
|
|
2816
|
+
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) isAsync = true;
|
|
2824
2817
|
else keyName = "async";
|
|
2825
|
-
if (!keyName && (ecmaVersion
|
|
2818
|
+
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) isGenerator = true;
|
|
2826
2819
|
if (!keyName && !isAsync && !isGenerator) {
|
|
2827
2820
|
var lastValue = this.value;
|
|
2828
2821
|
if (this.eatContextual("get") || this.eatContextual("set")) if (this.isClassElementNameStart()) kind = lastValue;
|
|
@@ -2834,7 +2827,7 @@ pp$8.parseClassElement = function(constructorAllowsSuper) {
|
|
|
2834
2827
|
node.key.name = keyName;
|
|
2835
2828
|
this.finishNode(node.key, "Identifier");
|
|
2836
2829
|
} else this.parseClassElementName(node);
|
|
2837
|
-
if (ecmaVersion
|
|
2830
|
+
if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
2838
2831
|
var isConstructor = !node.static && checkKeyName(node, "constructor");
|
|
2839
2832
|
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
|
|
2840
2833
|
if (isConstructor && kind !== "method") this.raise(node.key.start, "Constructor can't have get/set modifier");
|
|
@@ -2911,14 +2904,14 @@ pp$8.enterClassBody = function() {
|
|
|
2911
2904
|
return element.declared;
|
|
2912
2905
|
};
|
|
2913
2906
|
pp$8.exitClassBody = function() {
|
|
2914
|
-
var ref
|
|
2915
|
-
var declared = ref
|
|
2916
|
-
var used = ref
|
|
2907
|
+
var ref = this.privateNameStack.pop();
|
|
2908
|
+
var declared = ref.declared;
|
|
2909
|
+
var used = ref.used;
|
|
2917
2910
|
if (!this.options.checkPrivateFields) return;
|
|
2918
2911
|
var len = this.privateNameStack.length;
|
|
2919
2912
|
var parent = len === 0 ? null : this.privateNameStack[len - 1];
|
|
2920
|
-
for (var i
|
|
2921
|
-
var id = used[i
|
|
2913
|
+
for (var i = 0; i < used.length; ++i) {
|
|
2914
|
+
var id = used[i];
|
|
2922
2915
|
if (!hasOwn(declared, id.name)) if (parent) parent.used.push(id);
|
|
2923
2916
|
else this.raiseRecoverable(id.start, "Private field '#" + id.name + "' must be declared in an enclosing class");
|
|
2924
2917
|
}
|
|
@@ -2976,8 +2969,8 @@ pp$8.parseExport = function(node, exports) {
|
|
|
2976
2969
|
node.source = this.parseExprAtom();
|
|
2977
2970
|
if (this.options.ecmaVersion >= 16) node.attributes = this.parseWithClause();
|
|
2978
2971
|
} else {
|
|
2979
|
-
for (var i
|
|
2980
|
-
var spec = list
|
|
2972
|
+
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
|
|
2973
|
+
var spec = list[i];
|
|
2981
2974
|
this.checkUnreserved(spec.local);
|
|
2982
2975
|
this.checkLocalExport(spec.local);
|
|
2983
2976
|
if (spec.local.type === "Literal") this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`.");
|
|
@@ -3017,12 +3010,12 @@ pp$8.checkExport = function(exports, name, pos) {
|
|
|
3017
3010
|
pp$8.checkPatternExport = function(exports, pat) {
|
|
3018
3011
|
var type = pat.type;
|
|
3019
3012
|
if (type === "Identifier") this.checkExport(exports, pat, pat.start);
|
|
3020
|
-
else if (type === "ObjectPattern") for (var i
|
|
3021
|
-
var prop = list
|
|
3013
|
+
else if (type === "ObjectPattern") for (var i = 0, list = pat.properties; i < list.length; i += 1) {
|
|
3014
|
+
var prop = list[i];
|
|
3022
3015
|
this.checkPatternExport(exports, prop);
|
|
3023
3016
|
}
|
|
3024
|
-
else if (type === "ArrayPattern") for (var i$1
|
|
3025
|
-
var elt = list$1
|
|
3017
|
+
else if (type === "ArrayPattern") for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
|
|
3018
|
+
var elt = list$1[i$1];
|
|
3026
3019
|
if (elt) this.checkPatternExport(exports, elt);
|
|
3027
3020
|
}
|
|
3028
3021
|
else if (type === "Property") this.checkPatternExport(exports, pat.value);
|
|
@@ -3031,8 +3024,8 @@ pp$8.checkPatternExport = function(exports, pat) {
|
|
|
3031
3024
|
};
|
|
3032
3025
|
pp$8.checkVariableExport = function(exports, decls) {
|
|
3033
3026
|
if (!exports) return;
|
|
3034
|
-
for (var i
|
|
3035
|
-
var decl = list
|
|
3027
|
+
for (var i = 0, list = decls; i < list.length; i += 1) {
|
|
3028
|
+
var decl = list[i];
|
|
3036
3029
|
this.checkPatternExport(exports, decl.id);
|
|
3037
3030
|
}
|
|
3038
3031
|
};
|
|
@@ -3153,7 +3146,7 @@ pp$8.parseModuleExportName = function() {
|
|
|
3153
3146
|
return this.parseIdent(true);
|
|
3154
3147
|
};
|
|
3155
3148
|
pp$8.adaptDirectivePrologue = function(statements) {
|
|
3156
|
-
for (var i
|
|
3149
|
+
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) statements[i].directive = statements[i].expression.raw.slice(1, -1);
|
|
3157
3150
|
};
|
|
3158
3151
|
pp$8.isDirectiveCandidate = function(statement) {
|
|
3159
3152
|
return this.options.ecmaVersion >= 5 && statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && (this.input[statement.start] === "\"" || this.input[statement.start] === "'");
|
|
@@ -3171,8 +3164,8 @@ pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
|
3171
3164
|
case "ObjectExpression":
|
|
3172
3165
|
node.type = "ObjectPattern";
|
|
3173
3166
|
if (refDestructuringErrors) this.checkPatternErrors(refDestructuringErrors, true);
|
|
3174
|
-
for (var i
|
|
3175
|
-
var prop = list
|
|
3167
|
+
for (var i = 0, list = node.properties; i < list.length; i += 1) {
|
|
3168
|
+
var prop = list[i];
|
|
3176
3169
|
this.toAssignable(prop, isBinding);
|
|
3177
3170
|
if (prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")) this.raise(prop.argument.start, "Unexpected token");
|
|
3178
3171
|
}
|
|
@@ -3211,8 +3204,8 @@ pp$7.toAssignable = function(node, isBinding, refDestructuringErrors) {
|
|
|
3211
3204
|
};
|
|
3212
3205
|
pp$7.toAssignableList = function(exprList, isBinding) {
|
|
3213
3206
|
var end = exprList.length;
|
|
3214
|
-
for (var i
|
|
3215
|
-
var elt = exprList[i
|
|
3207
|
+
for (var i = 0; i < end; i++) {
|
|
3208
|
+
var elt = exprList[i];
|
|
3216
3209
|
if (elt) this.toAssignable(elt, isBinding);
|
|
3217
3210
|
}
|
|
3218
3211
|
if (end) {
|
|
@@ -3310,14 +3303,14 @@ pp$7.checkLValPattern = function(expr, bindingType, checkClashes) {
|
|
|
3310
3303
|
if (bindingType === void 0) bindingType = BIND_NONE;
|
|
3311
3304
|
switch (expr.type) {
|
|
3312
3305
|
case "ObjectPattern":
|
|
3313
|
-
for (var i
|
|
3314
|
-
var prop = list
|
|
3306
|
+
for (var i = 0, list = expr.properties; i < list.length; i += 1) {
|
|
3307
|
+
var prop = list[i];
|
|
3315
3308
|
this.checkLValInnerPattern(prop, bindingType, checkClashes);
|
|
3316
3309
|
}
|
|
3317
3310
|
break;
|
|
3318
3311
|
case "ArrayPattern":
|
|
3319
|
-
for (var i$1
|
|
3320
|
-
var elem = list$1
|
|
3312
|
+
for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) {
|
|
3313
|
+
var elem = list$1[i$1];
|
|
3321
3314
|
if (elem) this.checkLValInnerPattern(elem, bindingType, checkClashes);
|
|
3322
3315
|
}
|
|
3323
3316
|
break;
|
|
@@ -3339,7 +3332,7 @@ pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
|
|
|
3339
3332
|
default: this.checkLValPattern(expr, bindingType, checkClashes);
|
|
3340
3333
|
}
|
|
3341
3334
|
};
|
|
3342
|
-
var TokContext = function TokContext
|
|
3335
|
+
var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
|
|
3343
3336
|
this.token = token;
|
|
3344
3337
|
this.isExpr = !!isExpr;
|
|
3345
3338
|
this.preserveSpace = !!preserveSpace;
|
|
@@ -3352,8 +3345,8 @@ var types$2 = {
|
|
|
3352
3345
|
b_tmpl: new TokContext("${", false),
|
|
3353
3346
|
p_stat: new TokContext("(", false),
|
|
3354
3347
|
p_expr: new TokContext("(", true),
|
|
3355
|
-
q_tmpl: new TokContext("`", true, true, function(p
|
|
3356
|
-
return p
|
|
3348
|
+
q_tmpl: new TokContext("`", true, true, function(p) {
|
|
3349
|
+
return p.tryReadTemplateToken();
|
|
3357
3350
|
}),
|
|
3358
3351
|
f_stat: new TokContext("function", false),
|
|
3359
3352
|
f_expr: new TokContext("function", true),
|
|
@@ -3378,8 +3371,8 @@ pp$6.braceIsBlock = function(prevType) {
|
|
|
3378
3371
|
return !this.exprAllowed;
|
|
3379
3372
|
};
|
|
3380
3373
|
pp$6.inGeneratorContext = function() {
|
|
3381
|
-
for (var i
|
|
3382
|
-
var context = this.context[i
|
|
3374
|
+
for (var i = this.context.length - 1; i >= 1; i--) {
|
|
3375
|
+
var context = this.context[i];
|
|
3383
3376
|
if (context.token === "function") return context.generator;
|
|
3384
3377
|
}
|
|
3385
3378
|
return false;
|
|
@@ -3920,8 +3913,8 @@ pp$5.parseNew = function() {
|
|
|
3920
3913
|
else node.arguments = empty;
|
|
3921
3914
|
return this.finishNode(node, "NewExpression");
|
|
3922
3915
|
};
|
|
3923
|
-
pp$5.parseTemplateElement = function(ref
|
|
3924
|
-
var isTagged = ref
|
|
3916
|
+
pp$5.parseTemplateElement = function(ref) {
|
|
3917
|
+
var isTagged = ref.isTagged;
|
|
3925
3918
|
var elem = this.startNode();
|
|
3926
3919
|
if (this.type === types$1.invalidTemplate) {
|
|
3927
3920
|
if (!isTagged) this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
|
|
@@ -3937,9 +3930,9 @@ pp$5.parseTemplateElement = function(ref$1) {
|
|
|
3937
3930
|
elem.tail = this.type === types$1.backQuote;
|
|
3938
3931
|
return this.finishNode(elem, "TemplateElement");
|
|
3939
3932
|
};
|
|
3940
|
-
pp$5.parseTemplate = function(ref
|
|
3941
|
-
if (ref
|
|
3942
|
-
var isTagged = ref
|
|
3933
|
+
pp$5.parseTemplate = function(ref) {
|
|
3934
|
+
if (ref === void 0) ref = {};
|
|
3935
|
+
var isTagged = ref.isTagged;
|
|
3943
3936
|
if (isTagged === void 0) isTagged = false;
|
|
3944
3937
|
var node = this.startNode();
|
|
3945
3938
|
this.next();
|
|
@@ -4116,13 +4109,13 @@ pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod, forInit) {
|
|
|
4116
4109
|
this.exitScope();
|
|
4117
4110
|
};
|
|
4118
4111
|
pp$5.isSimpleParamList = function(params) {
|
|
4119
|
-
for (var i
|
|
4112
|
+
for (var i = 0, list = params; i < list.length; i += 1) if (list[i].type !== "Identifier") return false;
|
|
4120
4113
|
return true;
|
|
4121
4114
|
};
|
|
4122
4115
|
pp$5.checkParams = function(node, allowDuplicates) {
|
|
4123
4116
|
var nameHash = Object.create(null);
|
|
4124
|
-
for (var i
|
|
4125
|
-
var param = list
|
|
4117
|
+
for (var i = 0, list = node.params; i < list.length; i += 1) {
|
|
4118
|
+
var param = list[i];
|
|
4126
4119
|
this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash);
|
|
4127
4120
|
}
|
|
4128
4121
|
};
|
|
@@ -4143,10 +4136,10 @@ pp$5.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestruct
|
|
|
4143
4136
|
}
|
|
4144
4137
|
return elts;
|
|
4145
4138
|
};
|
|
4146
|
-
pp$5.checkUnreserved = function(ref
|
|
4147
|
-
var start = ref
|
|
4148
|
-
var end = ref
|
|
4149
|
-
var name = ref
|
|
4139
|
+
pp$5.checkUnreserved = function(ref) {
|
|
4140
|
+
var start = ref.start;
|
|
4141
|
+
var end = ref.end;
|
|
4142
|
+
var name = ref.name;
|
|
4150
4143
|
if (this.inGenerator && name === "yield") this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator");
|
|
4151
4144
|
if (this.inAsync && name === "await") this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function");
|
|
4152
4145
|
if (!(this.currentThisScope().flags & SCOPE_VAR) && name === "arguments") this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer");
|
|
@@ -4224,7 +4217,7 @@ pp$4.curPosition = function() {
|
|
|
4224
4217
|
if (this.options.locations) return new Position(this.curLine, this.pos - this.lineStart);
|
|
4225
4218
|
};
|
|
4226
4219
|
var pp$3 = Parser.prototype;
|
|
4227
|
-
var Scope = function Scope
|
|
4220
|
+
var Scope = function Scope(flags) {
|
|
4228
4221
|
this.flags = flags;
|
|
4229
4222
|
this.var = [];
|
|
4230
4223
|
this.lexical = [];
|
|
@@ -4252,8 +4245,8 @@ pp$3.declareName = function(name, bindingType, pos) {
|
|
|
4252
4245
|
if (this.treatFunctionsAsVar) redeclared = scope$2.lexical.indexOf(name) > -1;
|
|
4253
4246
|
else redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1;
|
|
4254
4247
|
scope$2.functions.push(name);
|
|
4255
|
-
} else for (var i
|
|
4256
|
-
var scope$3 = this.scopeStack[i
|
|
4248
|
+
} else for (var i = this.scopeStack.length - 1; i >= 0; --i) {
|
|
4249
|
+
var scope$3 = this.scopeStack[i];
|
|
4257
4250
|
if (scope$3.lexical.indexOf(name) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH && scope$3.lexical[0] === name) || !this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
|
|
4258
4251
|
redeclared = true;
|
|
4259
4252
|
break;
|
|
@@ -4271,18 +4264,18 @@ pp$3.currentScope = function() {
|
|
|
4271
4264
|
return this.scopeStack[this.scopeStack.length - 1];
|
|
4272
4265
|
};
|
|
4273
4266
|
pp$3.currentVarScope = function() {
|
|
4274
|
-
for (var i
|
|
4275
|
-
var scope = this.scopeStack[i
|
|
4267
|
+
for (var i = this.scopeStack.length - 1;; i--) {
|
|
4268
|
+
var scope = this.scopeStack[i];
|
|
4276
4269
|
if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK)) return scope;
|
|
4277
4270
|
}
|
|
4278
4271
|
};
|
|
4279
4272
|
pp$3.currentThisScope = function() {
|
|
4280
|
-
for (var i
|
|
4281
|
-
var scope = this.scopeStack[i
|
|
4273
|
+
for (var i = this.scopeStack.length - 1;; i--) {
|
|
4274
|
+
var scope = this.scopeStack[i];
|
|
4282
4275
|
if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK) && !(scope.flags & SCOPE_ARROW)) return scope;
|
|
4283
4276
|
}
|
|
4284
4277
|
};
|
|
4285
|
-
var Node = function Node
|
|
4278
|
+
var Node = function Node(parser, pos, loc) {
|
|
4286
4279
|
this.type = "";
|
|
4287
4280
|
this.start = pos;
|
|
4288
4281
|
this.end = 0;
|
|
@@ -4355,19 +4348,19 @@ var unicodeScriptValues = {
|
|
|
4355
4348
|
14: ecma14ScriptValues
|
|
4356
4349
|
};
|
|
4357
4350
|
var data = {};
|
|
4358
|
-
function buildUnicodeData(ecmaVersion
|
|
4359
|
-
var d
|
|
4360
|
-
binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion
|
|
4361
|
-
binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion
|
|
4351
|
+
function buildUnicodeData(ecmaVersion) {
|
|
4352
|
+
var d = data[ecmaVersion] = {
|
|
4353
|
+
binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
|
|
4354
|
+
binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),
|
|
4362
4355
|
nonBinary: {
|
|
4363
4356
|
General_Category: wordsRegexp(unicodeGeneralCategoryValues),
|
|
4364
|
-
Script: wordsRegexp(unicodeScriptValues[ecmaVersion
|
|
4357
|
+
Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
|
|
4365
4358
|
}
|
|
4366
4359
|
};
|
|
4367
|
-
d
|
|
4368
|
-
d
|
|
4369
|
-
d
|
|
4370
|
-
d
|
|
4360
|
+
d.nonBinary.Script_Extensions = d.nonBinary.Script;
|
|
4361
|
+
d.nonBinary.gc = d.nonBinary.General_Category;
|
|
4362
|
+
d.nonBinary.sc = d.nonBinary.Script;
|
|
4363
|
+
d.nonBinary.scx = d.nonBinary.Script_Extensions;
|
|
4371
4364
|
}
|
|
4372
4365
|
for (var i = 0, list = [
|
|
4373
4366
|
9,
|
|
@@ -4381,7 +4374,7 @@ for (var i = 0, list = [
|
|
|
4381
4374
|
buildUnicodeData(ecmaVersion);
|
|
4382
4375
|
}
|
|
4383
4376
|
var pp$1 = Parser.prototype;
|
|
4384
|
-
var BranchID = function BranchID
|
|
4377
|
+
var BranchID = function BranchID(parent, base) {
|
|
4385
4378
|
this.parent = parent;
|
|
4386
4379
|
this.base = base || this;
|
|
4387
4380
|
};
|
|
@@ -4392,7 +4385,7 @@ BranchID.prototype.separatedFrom = function separatedFrom(alt) {
|
|
|
4392
4385
|
BranchID.prototype.sibling = function sibling() {
|
|
4393
4386
|
return new BranchID(this.parent, this.base);
|
|
4394
4387
|
};
|
|
4395
|
-
var RegExpValidationState = function RegExpValidationState
|
|
4388
|
+
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
4396
4389
|
this.parser = parser;
|
|
4397
4390
|
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
|
|
4398
4391
|
this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];
|
|
@@ -4431,24 +4424,24 @@ RegExpValidationState.prototype.reset = function reset(start, pattern, flags) {
|
|
|
4431
4424
|
RegExpValidationState.prototype.raise = function raise(message) {
|
|
4432
4425
|
this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + message);
|
|
4433
4426
|
};
|
|
4434
|
-
RegExpValidationState.prototype.at = function at(i
|
|
4427
|
+
RegExpValidationState.prototype.at = function at(i, forceU) {
|
|
4435
4428
|
if (forceU === void 0) forceU = false;
|
|
4436
4429
|
var s = this.source;
|
|
4437
|
-
var l
|
|
4438
|
-
if (i
|
|
4439
|
-
var c
|
|
4440
|
-
if (!(forceU || this.switchU) || c
|
|
4441
|
-
var next = s.charCodeAt(i
|
|
4442
|
-
return next >= 56320 && next <= 57343 ? (c
|
|
4443
|
-
};
|
|
4444
|
-
RegExpValidationState.prototype.nextIndex = function nextIndex(i
|
|
4430
|
+
var l = s.length;
|
|
4431
|
+
if (i >= l) return -1;
|
|
4432
|
+
var c = s.charCodeAt(i);
|
|
4433
|
+
if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i + 1 >= l) return c;
|
|
4434
|
+
var next = s.charCodeAt(i + 1);
|
|
4435
|
+
return next >= 56320 && next <= 57343 ? (c << 10) + next - 56613888 : c;
|
|
4436
|
+
};
|
|
4437
|
+
RegExpValidationState.prototype.nextIndex = function nextIndex(i, forceU) {
|
|
4445
4438
|
if (forceU === void 0) forceU = false;
|
|
4446
4439
|
var s = this.source;
|
|
4447
|
-
var l
|
|
4448
|
-
if (i
|
|
4449
|
-
var c
|
|
4450
|
-
if (!(forceU || this.switchU) || c
|
|
4451
|
-
return i
|
|
4440
|
+
var l = s.length;
|
|
4441
|
+
if (i >= l) return l;
|
|
4442
|
+
var c = s.charCodeAt(i), next;
|
|
4443
|
+
if (!(forceU || this.switchU) || c <= 55295 || c >= 57344 || i + 1 >= l || (next = s.charCodeAt(i + 1)) < 56320 || next > 57343) return i + 1;
|
|
4444
|
+
return i + 2;
|
|
4452
4445
|
};
|
|
4453
4446
|
RegExpValidationState.prototype.current = function current(forceU) {
|
|
4454
4447
|
if (forceU === void 0) forceU = false;
|
|
@@ -4473,8 +4466,8 @@ RegExpValidationState.prototype.eat = function eat(ch, forceU) {
|
|
|
4473
4466
|
RegExpValidationState.prototype.eatChars = function eatChars(chs, forceU) {
|
|
4474
4467
|
if (forceU === void 0) forceU = false;
|
|
4475
4468
|
var pos = this.pos;
|
|
4476
|
-
for (var i
|
|
4477
|
-
var ch = list
|
|
4469
|
+
for (var i = 0, list = chs; i < list.length; i += 1) {
|
|
4470
|
+
var ch = list[i];
|
|
4478
4471
|
var current = this.at(pos, forceU);
|
|
4479
4472
|
if (current === -1 || current !== ch) return false;
|
|
4480
4473
|
pos = this.nextIndex(pos, forceU);
|
|
@@ -4491,19 +4484,19 @@ RegExpValidationState.prototype.eatChars = function eatChars(chs, forceU) {
|
|
|
4491
4484
|
pp$1.validateRegExpFlags = function(state) {
|
|
4492
4485
|
var validFlags = state.validFlags;
|
|
4493
4486
|
var flags = state.flags;
|
|
4494
|
-
var u
|
|
4495
|
-
var v
|
|
4496
|
-
for (var i
|
|
4497
|
-
var flag = flags.charAt(i
|
|
4487
|
+
var u = false;
|
|
4488
|
+
var v = false;
|
|
4489
|
+
for (var i = 0; i < flags.length; i++) {
|
|
4490
|
+
var flag = flags.charAt(i);
|
|
4498
4491
|
if (validFlags.indexOf(flag) === -1) this.raise(state.start, "Invalid regular expression flag");
|
|
4499
|
-
if (flags.indexOf(flag, i
|
|
4500
|
-
if (flag === "u") u
|
|
4501
|
-
if (flag === "v") v
|
|
4492
|
+
if (flags.indexOf(flag, i + 1) > -1) this.raise(state.start, "Duplicate regular expression flag");
|
|
4493
|
+
if (flag === "u") u = true;
|
|
4494
|
+
if (flag === "v") v = true;
|
|
4502
4495
|
}
|
|
4503
|
-
if (this.options.ecmaVersion >= 15 && u
|
|
4496
|
+
if (this.options.ecmaVersion >= 15 && u && v) this.raise(state.start, "Invalid regular expression flag");
|
|
4504
4497
|
};
|
|
4505
4498
|
function hasProp(obj) {
|
|
4506
|
-
for (var _
|
|
4499
|
+
for (var _ in obj) return true;
|
|
4507
4500
|
return false;
|
|
4508
4501
|
}
|
|
4509
4502
|
/**
|
|
@@ -4535,8 +4528,8 @@ pp$1.regexp_pattern = function(state) {
|
|
|
4535
4528
|
if (state.eat(93) || state.eat(125)) state.raise("Lone quantifier brackets");
|
|
4536
4529
|
}
|
|
4537
4530
|
if (state.maxBackReference > state.numCapturingParens) state.raise("Invalid escape");
|
|
4538
|
-
for (var i
|
|
4539
|
-
var name = list
|
|
4531
|
+
for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
|
|
4532
|
+
var name = list[i];
|
|
4540
4533
|
if (!state.groupNames[name]) state.raise("Invalid named capture referenced");
|
|
4541
4534
|
}
|
|
4542
4535
|
};
|
|
@@ -4636,16 +4629,16 @@ pp$1.regexp_eatUncapturingGroup = function(state) {
|
|
|
4636
4629
|
var addModifiers = this.regexp_eatModifiers(state);
|
|
4637
4630
|
var hasHyphen = state.eat(45);
|
|
4638
4631
|
if (addModifiers || hasHyphen) {
|
|
4639
|
-
for (var i
|
|
4640
|
-
var modifier = addModifiers.charAt(i
|
|
4641
|
-
if (addModifiers.indexOf(modifier, i
|
|
4632
|
+
for (var i = 0; i < addModifiers.length; i++) {
|
|
4633
|
+
var modifier = addModifiers.charAt(i);
|
|
4634
|
+
if (addModifiers.indexOf(modifier, i + 1) > -1) state.raise("Duplicate regular expression modifiers");
|
|
4642
4635
|
}
|
|
4643
4636
|
if (hasHyphen) {
|
|
4644
4637
|
var removeModifiers = this.regexp_eatModifiers(state);
|
|
4645
4638
|
if (!addModifiers && !removeModifiers && state.current() === 58) state.raise("Invalid regular expression modifiers");
|
|
4646
|
-
for (var i$1
|
|
4647
|
-
var modifier$1 = removeModifiers.charAt(i$1
|
|
4648
|
-
if (removeModifiers.indexOf(modifier$1, i$1
|
|
4639
|
+
for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) {
|
|
4640
|
+
var modifier$1 = removeModifiers.charAt(i$1);
|
|
4641
|
+
if (removeModifiers.indexOf(modifier$1, i$1 + 1) > -1 || addModifiers.indexOf(modifier$1) > -1) state.raise("Duplicate regular expression modifiers");
|
|
4649
4642
|
}
|
|
4650
4643
|
}
|
|
4651
4644
|
}
|
|
@@ -4724,7 +4717,7 @@ pp$1.regexp_groupSpecifier = function(state) {
|
|
|
4724
4717
|
var trackDisjunction = this.options.ecmaVersion >= 16;
|
|
4725
4718
|
var known = state.groupNames[state.lastStringValue];
|
|
4726
4719
|
if (known) if (trackDisjunction) {
|
|
4727
|
-
for (var i
|
|
4720
|
+
for (var i = 0, list = known; i < list.length; i += 1) if (!list[i].separatedFrom(state.branchID)) state.raise("Duplicate capture group name");
|
|
4728
4721
|
} else state.raise("Duplicate capture group name");
|
|
4729
4722
|
if (trackDisjunction) (known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID);
|
|
4730
4723
|
else state.groupNames[state.lastStringValue] = true;
|
|
@@ -5265,7 +5258,7 @@ function isOctalDigit(ch) {
|
|
|
5265
5258
|
pp$1.regexp_eatFixedHexDigits = function(state, length) {
|
|
5266
5259
|
var start = state.pos;
|
|
5267
5260
|
state.lastIntValue = 0;
|
|
5268
|
-
for (var i
|
|
5261
|
+
for (var i = 0; i < length; ++i) {
|
|
5269
5262
|
var ch = state.current();
|
|
5270
5263
|
if (!isHexDigit(ch)) {
|
|
5271
5264
|
state.pos = start;
|
|
@@ -5276,13 +5269,13 @@ pp$1.regexp_eatFixedHexDigits = function(state, length) {
|
|
|
5276
5269
|
}
|
|
5277
5270
|
return true;
|
|
5278
5271
|
};
|
|
5279
|
-
var Token = function Token
|
|
5280
|
-
this.type = p
|
|
5281
|
-
this.value = p
|
|
5282
|
-
this.start = p
|
|
5283
|
-
this.end = p
|
|
5284
|
-
if (p
|
|
5285
|
-
if (p
|
|
5272
|
+
var Token = function Token(p) {
|
|
5273
|
+
this.type = p.type;
|
|
5274
|
+
this.value = p.value;
|
|
5275
|
+
this.start = p.start;
|
|
5276
|
+
this.end = p.end;
|
|
5277
|
+
if (p.options.locations) this.loc = new SourceLocation(p, p.startLoc, p.endLoc);
|
|
5278
|
+
if (p.options.ranges) this.range = [p.start, p.end];
|
|
5286
5279
|
};
|
|
5287
5280
|
var pp = Parser.prototype;
|
|
5288
5281
|
pp.next = function(ignoreEscapeSequenceInKeyword) {
|
|
@@ -5474,15 +5467,15 @@ pp.readToken_eq_excl = function(code) {
|
|
|
5474
5467
|
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1);
|
|
5475
5468
|
};
|
|
5476
5469
|
pp.readToken_question = function() {
|
|
5477
|
-
var ecmaVersion
|
|
5478
|
-
if (ecmaVersion
|
|
5470
|
+
var ecmaVersion = this.options.ecmaVersion;
|
|
5471
|
+
if (ecmaVersion >= 11) {
|
|
5479
5472
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
5480
5473
|
if (next === 46) {
|
|
5481
5474
|
var next2 = this.input.charCodeAt(this.pos + 2);
|
|
5482
5475
|
if (next2 < 48 || next2 > 57) return this.finishOp(types$1.questionDot, 2);
|
|
5483
5476
|
}
|
|
5484
5477
|
if (next === 63) {
|
|
5485
|
-
if (ecmaVersion
|
|
5478
|
+
if (ecmaVersion >= 12) {
|
|
5486
5479
|
if (this.input.charCodeAt(this.pos + 2) === 61) return this.finishOp(types$1.assign, 3);
|
|
5487
5480
|
}
|
|
5488
5481
|
return this.finishOp(types$1.coalesce, 2);
|
|
@@ -5491,9 +5484,9 @@ pp.readToken_question = function() {
|
|
|
5491
5484
|
return this.finishOp(types$1.question, 1);
|
|
5492
5485
|
};
|
|
5493
5486
|
pp.readToken_numberSign = function() {
|
|
5494
|
-
var ecmaVersion
|
|
5487
|
+
var ecmaVersion = this.options.ecmaVersion;
|
|
5495
5488
|
var code = 35;
|
|
5496
|
-
if (ecmaVersion
|
|
5489
|
+
if (ecmaVersion >= 13) {
|
|
5497
5490
|
++this.pos;
|
|
5498
5491
|
code = this.fullCharCodeAtPos();
|
|
5499
5492
|
if (isIdentifierStart(code, true) || code === 92) return this.finishToken(types$1.privateId, this.readWord1());
|
|
@@ -5612,12 +5605,12 @@ pp.readInt = function(radix, len, maybeLegacyOctalNumericLiteral) {
|
|
|
5612
5605
|
var allowSeparators = this.options.ecmaVersion >= 12 && len === void 0;
|
|
5613
5606
|
var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
|
|
5614
5607
|
var start = this.pos, total = 0, lastCode = 0;
|
|
5615
|
-
for (var i
|
|
5608
|
+
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {
|
|
5616
5609
|
var code = this.input.charCodeAt(this.pos), val = void 0;
|
|
5617
5610
|
if (allowSeparators && code === 95) {
|
|
5618
5611
|
if (isLegacyOctalNumericLiteral) this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals");
|
|
5619
5612
|
if (lastCode === 95) this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore");
|
|
5620
|
-
if (i
|
|
5613
|
+
if (i === 0) this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits");
|
|
5621
5614
|
lastCode = code;
|
|
5622
5615
|
continue;
|
|
5623
5616
|
}
|
|
@@ -5870,10 +5863,9 @@ pp.readWord = function() {
|
|
|
5870
5863
|
if (this.keywords.test(word)) type = keywords[word];
|
|
5871
5864
|
return this.finishToken(type, word);
|
|
5872
5865
|
};
|
|
5873
|
-
var version = "8.15.0";
|
|
5874
5866
|
Parser.acorn = {
|
|
5875
5867
|
Parser,
|
|
5876
|
-
version,
|
|
5868
|
+
version: "8.15.0",
|
|
5877
5869
|
defaultOptions,
|
|
5878
5870
|
Position,
|
|
5879
5871
|
SourceLocation,
|
|
@@ -5892,12 +5884,11 @@ Parser.acorn = {
|
|
|
5892
5884
|
lineBreakG,
|
|
5893
5885
|
nonASCIIwhitespace
|
|
5894
5886
|
};
|
|
5895
|
-
|
|
5896
5887
|
//#endregion
|
|
5897
5888
|
//#region ../../node_modules/.pnpm/mlly@1.8.0/node_modules/mlly/dist/index.mjs
|
|
5898
5889
|
const BUILTIN_MODULES = new Set(builtinModules);
|
|
5899
|
-
function normalizeSlash(path
|
|
5900
|
-
return path
|
|
5890
|
+
function normalizeSlash(path) {
|
|
5891
|
+
return path.replace(/\\/g, "/");
|
|
5901
5892
|
}
|
|
5902
5893
|
/**
|
|
5903
5894
|
* @typedef ErrnoExceptionFields
|
|
@@ -5960,28 +5951,28 @@ codes.ERR_INVALID_ARG_TYPE = createError(
|
|
|
5960
5951
|
}
|
|
5961
5952
|
message += "must be ";
|
|
5962
5953
|
/** @type {Array<string>} */
|
|
5963
|
-
const types
|
|
5954
|
+
const types = [];
|
|
5964
5955
|
/** @type {Array<string>} */
|
|
5965
5956
|
const instances = [];
|
|
5966
5957
|
/** @type {Array<string>} */
|
|
5967
5958
|
const other = [];
|
|
5968
5959
|
for (const value of expected) {
|
|
5969
5960
|
assert(typeof value === "string", "All expected entries have to be of type string");
|
|
5970
|
-
if (kTypes.has(value)) types
|
|
5961
|
+
if (kTypes.has(value)) types.push(value.toLowerCase());
|
|
5971
5962
|
else if (classRegExp.exec(value) === null) {
|
|
5972
5963
|
assert(value !== "object", "The value \"object\" should be written as \"Object\"");
|
|
5973
5964
|
other.push(value);
|
|
5974
5965
|
} else instances.push(value);
|
|
5975
5966
|
}
|
|
5976
5967
|
if (instances.length > 0) {
|
|
5977
|
-
const pos = types
|
|
5968
|
+
const pos = types.indexOf("object");
|
|
5978
5969
|
if (pos !== -1) {
|
|
5979
|
-
types
|
|
5970
|
+
types.slice(pos, 1);
|
|
5980
5971
|
instances.push("Object");
|
|
5981
5972
|
}
|
|
5982
5973
|
}
|
|
5983
|
-
if (types
|
|
5984
|
-
message += `${types
|
|
5974
|
+
if (types.length > 0) {
|
|
5975
|
+
message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(types, "or")}`;
|
|
5985
5976
|
if (instances.length > 0 || other.length > 0) message += " or ";
|
|
5986
5977
|
}
|
|
5987
5978
|
if (instances.length > 0) {
|
|
@@ -6017,8 +6008,8 @@ codes.ERR_INVALID_PACKAGE_CONFIG = createError(
|
|
|
6017
6008
|
* @param {string} [base]
|
|
6018
6009
|
* @param {string} [message]
|
|
6019
6010
|
*/
|
|
6020
|
-
(path
|
|
6021
|
-
return `Invalid package config ${path
|
|
6011
|
+
(path, base, message) => {
|
|
6012
|
+
return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
6022
6013
|
},
|
|
6023
6014
|
Error
|
|
6024
6015
|
);
|
|
@@ -6048,8 +6039,8 @@ codes.ERR_MODULE_NOT_FOUND = createError(
|
|
|
6048
6039
|
* @param {string} base
|
|
6049
6040
|
* @param {boolean} [exactUrl]
|
|
6050
6041
|
*/
|
|
6051
|
-
(path
|
|
6052
|
-
return `Cannot find ${exactUrl ? "module" : "package"} '${path
|
|
6042
|
+
(path, base, exactUrl = false) => {
|
|
6043
|
+
return `Cannot find ${exactUrl ? "module" : "package"} '${path}' imported from ${base}`;
|
|
6053
6044
|
},
|
|
6054
6045
|
Error
|
|
6055
6046
|
);
|
|
@@ -6087,8 +6078,8 @@ codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
|
|
|
6087
6078
|
* @param {string} extension
|
|
6088
6079
|
* @param {string} path
|
|
6089
6080
|
*/
|
|
6090
|
-
(extension, path
|
|
6091
|
-
return `Unknown file extension "${extension}" for ${path
|
|
6081
|
+
(extension, path) => {
|
|
6082
|
+
return `Unknown file extension "${extension}" for ${path}`;
|
|
6092
6083
|
},
|
|
6093
6084
|
TypeError
|
|
6094
6085
|
);
|
|
@@ -6394,8 +6385,8 @@ function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
|
|
|
6394
6385
|
if (packageType === "none" || packageType === "commonjs") return "commonjs";
|
|
6395
6386
|
return "module";
|
|
6396
6387
|
}
|
|
6397
|
-
const format
|
|
6398
|
-
if (format
|
|
6388
|
+
const format = extensionFormatMap[value];
|
|
6389
|
+
if (format) return format;
|
|
6399
6390
|
if (ignoreErrors) return;
|
|
6400
6391
|
throw new ERR_UNKNOWN_FILE_EXTENSION(value, fileURLToPath(url));
|
|
6401
6392
|
}
|
|
@@ -6457,9 +6448,9 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
|
|
|
6457
6448
|
* @param {string} path
|
|
6458
6449
|
* @returns {Stats | undefined}
|
|
6459
6450
|
*/
|
|
6460
|
-
function tryStatSync(path
|
|
6451
|
+
function tryStatSync(path) {
|
|
6461
6452
|
try {
|
|
6462
|
-
return statSync(path
|
|
6453
|
+
return statSync(path);
|
|
6463
6454
|
} catch {}
|
|
6464
6455
|
}
|
|
6465
6456
|
/**
|
|
@@ -6490,7 +6481,7 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
|
|
6490
6481
|
if (packageConfig.main !== void 0) {
|
|
6491
6482
|
guess = new URL$1(packageConfig.main, packageJsonUrl);
|
|
6492
6483
|
if (fileExists(guess)) return guess;
|
|
6493
|
-
const tries
|
|
6484
|
+
const tries = [
|
|
6494
6485
|
`./${packageConfig.main}.js`,
|
|
6495
6486
|
`./${packageConfig.main}.json`,
|
|
6496
6487
|
`./${packageConfig.main}.node`,
|
|
@@ -6498,9 +6489,9 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
|
|
6498
6489
|
`./${packageConfig.main}/index.json`,
|
|
6499
6490
|
`./${packageConfig.main}/index.node`
|
|
6500
6491
|
];
|
|
6501
|
-
let i
|
|
6502
|
-
while (++i
|
|
6503
|
-
guess = new URL$1(tries
|
|
6492
|
+
let i = -1;
|
|
6493
|
+
while (++i < tries.length) {
|
|
6494
|
+
guess = new URL$1(tries[i], packageJsonUrl);
|
|
6504
6495
|
if (fileExists(guess)) break;
|
|
6505
6496
|
guess = void 0;
|
|
6506
6497
|
}
|
|
@@ -6514,9 +6505,9 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
|
|
6514
6505
|
"./index.json",
|
|
6515
6506
|
"./index.node"
|
|
6516
6507
|
];
|
|
6517
|
-
let i
|
|
6518
|
-
while (++i
|
|
6519
|
-
guess = new URL$1(tries[i
|
|
6508
|
+
let i = -1;
|
|
6509
|
+
while (++i < tries.length) {
|
|
6510
|
+
guess = new URL$1(tries[i], packageJsonUrl);
|
|
6520
6511
|
if (fileExists(guess)) break;
|
|
6521
6512
|
guess = void 0;
|
|
6522
6513
|
}
|
|
@@ -6679,9 +6670,9 @@ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, b
|
|
|
6679
6670
|
if (targetList.length === 0) return null;
|
|
6680
6671
|
/** @type {ErrnoException | null | undefined} */
|
|
6681
6672
|
let lastException;
|
|
6682
|
-
let i
|
|
6683
|
-
while (++i
|
|
6684
|
-
const targetItem = targetList[i
|
|
6673
|
+
let i = -1;
|
|
6674
|
+
while (++i < targetList.length) {
|
|
6675
|
+
const targetItem = targetList[i];
|
|
6685
6676
|
/** @type {URL | null} */
|
|
6686
6677
|
let resolveResult;
|
|
6687
6678
|
try {
|
|
@@ -6704,14 +6695,14 @@ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, b
|
|
|
6704
6695
|
}
|
|
6705
6696
|
if (typeof target === "object" && target !== null) {
|
|
6706
6697
|
const keys = Object.getOwnPropertyNames(target);
|
|
6707
|
-
let i
|
|
6708
|
-
while (++i
|
|
6709
|
-
const key = keys[i
|
|
6698
|
+
let i = -1;
|
|
6699
|
+
while (++i < keys.length) {
|
|
6700
|
+
const key = keys[i];
|
|
6710
6701
|
if (isArrayIndex(key)) throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(packageJsonUrl), base, "\"exports\" cannot contain numeric property keys.");
|
|
6711
6702
|
}
|
|
6712
|
-
i
|
|
6713
|
-
while (++i
|
|
6714
|
-
const key = keys[i
|
|
6703
|
+
i = -1;
|
|
6704
|
+
while (++i < keys.length) {
|
|
6705
|
+
const key = keys[i];
|
|
6715
6706
|
if (key === "default" || conditions && conditions.has(key)) {
|
|
6716
6707
|
const conditionalTarget = target[key];
|
|
6717
6708
|
const resolveResult = resolvePackageTarget(packageJsonUrl, conditionalTarget, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions);
|
|
@@ -6735,12 +6726,12 @@ function isConditionalExportsMainSugar(exports, packageJsonUrl, base) {
|
|
|
6735
6726
|
if (typeof exports !== "object" || exports === null) return false;
|
|
6736
6727
|
const keys = Object.getOwnPropertyNames(exports);
|
|
6737
6728
|
let isConditionalSugar = false;
|
|
6738
|
-
let i
|
|
6729
|
+
let i = 0;
|
|
6739
6730
|
let keyIndex = -1;
|
|
6740
6731
|
while (++keyIndex < keys.length) {
|
|
6741
6732
|
const key = keys[keyIndex];
|
|
6742
6733
|
const currentIsConditionalSugar = key === "" || key[0] !== ".";
|
|
6743
|
-
if (i
|
|
6734
|
+
if (i++ === 0) isConditionalSugar = currentIsConditionalSugar;
|
|
6744
6735
|
else if (isConditionalSugar !== currentIsConditionalSugar) throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(packageJsonUrl), base, "\"exports\" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.");
|
|
6745
6736
|
}
|
|
6746
6737
|
return isConditionalSugar;
|
|
@@ -6777,9 +6768,9 @@ function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, ba
|
|
|
6777
6768
|
let bestMatch = "";
|
|
6778
6769
|
let bestMatchSubpath = "";
|
|
6779
6770
|
const keys = Object.getOwnPropertyNames(exports);
|
|
6780
|
-
let i
|
|
6781
|
-
while (++i
|
|
6782
|
-
const key = keys[i
|
|
6771
|
+
let i = -1;
|
|
6772
|
+
while (++i < keys.length) {
|
|
6773
|
+
const key = keys[i];
|
|
6783
6774
|
const patternIndex = key.indexOf("*");
|
|
6784
6775
|
if (patternIndex !== -1 && packageSubpath.startsWith(key.slice(0, patternIndex))) {
|
|
6785
6776
|
if (packageSubpath.endsWith("/")) emitTrailingSlashPatternDeprecation(packageSubpath, packageJsonUrl, base);
|
|
@@ -6802,17 +6793,17 @@ function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, ba
|
|
|
6802
6793
|
* @param {string} a
|
|
6803
6794
|
* @param {string} b
|
|
6804
6795
|
*/
|
|
6805
|
-
function patternKeyCompare(a, b
|
|
6796
|
+
function patternKeyCompare(a, b) {
|
|
6806
6797
|
const aPatternIndex = a.indexOf("*");
|
|
6807
|
-
const bPatternIndex = b
|
|
6798
|
+
const bPatternIndex = b.indexOf("*");
|
|
6808
6799
|
const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
|
|
6809
|
-
const baseLengthB = bPatternIndex === -1 ? b
|
|
6800
|
+
const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
|
6810
6801
|
if (baseLengthA > baseLengthB) return -1;
|
|
6811
6802
|
if (baseLengthB > baseLengthA) return 1;
|
|
6812
6803
|
if (aPatternIndex === -1) return 1;
|
|
6813
6804
|
if (bPatternIndex === -1) return -1;
|
|
6814
|
-
if (a.length > b
|
|
6815
|
-
if (b
|
|
6805
|
+
if (a.length > b.length) return -1;
|
|
6806
|
+
if (b.length > a.length) return 1;
|
|
6816
6807
|
return 0;
|
|
6817
6808
|
}
|
|
6818
6809
|
/**
|
|
@@ -6836,9 +6827,9 @@ function packageImportsResolve(name, base, conditions) {
|
|
|
6836
6827
|
let bestMatch = "";
|
|
6837
6828
|
let bestMatchSubpath = "";
|
|
6838
6829
|
const keys = Object.getOwnPropertyNames(imports);
|
|
6839
|
-
let i
|
|
6840
|
-
while (++i
|
|
6841
|
-
const key = keys[i
|
|
6830
|
+
let i = -1;
|
|
6831
|
+
while (++i < keys.length) {
|
|
6832
|
+
const key = keys[i];
|
|
6842
6833
|
const patternIndex = key.indexOf("*");
|
|
6843
6834
|
if (patternIndex !== -1 && name.startsWith(key.slice(0, -1))) {
|
|
6844
6835
|
const patternTrailer = key.slice(patternIndex + 1);
|
|
@@ -6891,8 +6882,8 @@ function packageResolve(specifier, base, conditions) {
|
|
|
6891
6882
|
const packageConfig = getPackageScopeConfig(base);
|
|
6892
6883
|
/* c8 ignore next 16 */
|
|
6893
6884
|
if (packageConfig.exists) {
|
|
6894
|
-
const packageJsonUrl
|
|
6895
|
-
if (packageConfig.name === packageName && packageConfig.exports !== void 0 && packageConfig.exports !== null) return packageExportsResolve(packageJsonUrl
|
|
6885
|
+
const packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);
|
|
6886
|
+
if (packageConfig.name === packageName && packageConfig.exports !== void 0 && packageConfig.exports !== null) return packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions);
|
|
6896
6887
|
}
|
|
6897
6888
|
let packageJsonUrl = new URL$1("./node_modules/" + packageName + "/package.json", base);
|
|
6898
6889
|
let packageJsonPath = fileURLToPath(packageJsonUrl);
|
|
@@ -6906,12 +6897,12 @@ function packageResolve(specifier, base, conditions) {
|
|
|
6906
6897
|
packageJsonPath = fileURLToPath(packageJsonUrl);
|
|
6907
6898
|
continue;
|
|
6908
6899
|
}
|
|
6909
|
-
const packageConfig
|
|
6900
|
+
const packageConfig = read(packageJsonPath, {
|
|
6910
6901
|
base,
|
|
6911
6902
|
specifier
|
|
6912
6903
|
});
|
|
6913
|
-
if (packageConfig
|
|
6914
|
-
if (packageSubpath === ".") return legacyMainResolve(packageJsonUrl, packageConfig
|
|
6904
|
+
if (packageConfig.exports !== void 0 && packageConfig.exports !== null) return packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions);
|
|
6905
|
+
if (packageSubpath === ".") return legacyMainResolve(packageJsonUrl, packageConfig, base);
|
|
6915
6906
|
return new URL$1(packageSubpath, packageJsonUrl);
|
|
6916
6907
|
} while (packageJsonPath.length !== lastPath.length);
|
|
6917
6908
|
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), false);
|
|
@@ -7060,18 +7051,16 @@ function resolvePath(id, options) {
|
|
|
7060
7051
|
return Promise.reject(error);
|
|
7061
7052
|
}
|
|
7062
7053
|
}
|
|
7063
|
-
|
|
7064
7054
|
//#endregion
|
|
7065
7055
|
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.0/node_modules/@iconify/utils/lib/loader/resolve.js
|
|
7066
7056
|
/**
|
|
7067
7057
|
* Resolve path to package
|
|
7068
7058
|
*/
|
|
7069
|
-
async function resolvePathAsync(packageName, cwd
|
|
7059
|
+
async function resolvePathAsync(packageName, cwd) {
|
|
7070
7060
|
try {
|
|
7071
|
-
return await resolvePath(packageName, { url: cwd
|
|
7061
|
+
return await resolvePath(packageName, { url: cwd });
|
|
7072
7062
|
} catch {}
|
|
7073
7063
|
}
|
|
7074
|
-
|
|
7075
7064
|
//#endregion
|
|
7076
7065
|
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.0/node_modules/@iconify/utils/lib/loader/fs.js
|
|
7077
7066
|
const _collections = Object.create(null);
|
|
@@ -7086,27 +7075,27 @@ const isLegacyExists = Object.create(null);
|
|
|
7086
7075
|
* @param cwd {string} [cwd=process.cwd()] - current working directory for caching
|
|
7087
7076
|
* @return {Promise<IconifyJSON | undefined>} the loaded IconifyJSON or undefined
|
|
7088
7077
|
*/
|
|
7089
|
-
async function loadCollectionFromFS(name, autoInstall = false, scope = "@iconify-json", cwd
|
|
7090
|
-
const cache
|
|
7091
|
-
if (!await cache
|
|
7092
|
-
return cache
|
|
7078
|
+
async function loadCollectionFromFS(name, autoInstall = false, scope = "@iconify-json", cwd = process.cwd()) {
|
|
7079
|
+
const cache = _collections[cwd] || (_collections[cwd] = Object.create(null));
|
|
7080
|
+
if (!await cache[name]) cache[name] = task();
|
|
7081
|
+
return cache[name];
|
|
7093
7082
|
async function task() {
|
|
7094
7083
|
const packageName = scope.length === 0 ? name : `${scope}/${name}`;
|
|
7095
|
-
let jsonPath = await resolvePathAsync(`${packageName}/icons.json`, cwd
|
|
7084
|
+
let jsonPath = await resolvePathAsync(`${packageName}/icons.json`, cwd);
|
|
7096
7085
|
if (scope === "@iconify-json") {
|
|
7097
|
-
if (isLegacyExists[cwd
|
|
7098
|
-
const checkLegacy = isLegacyExists[cwd
|
|
7099
|
-
if (!jsonPath && checkLegacy) jsonPath = await resolvePathAsync(`@iconify/json/json/${name}.json`, cwd
|
|
7086
|
+
if (isLegacyExists[cwd] === void 0) isLegacyExists[cwd] = !!await resolvePathAsync(`@iconify/json/collections.json`, cwd);
|
|
7087
|
+
const checkLegacy = isLegacyExists[cwd];
|
|
7088
|
+
if (!jsonPath && checkLegacy) jsonPath = await resolvePathAsync(`@iconify/json/json/${name}.json`, cwd);
|
|
7100
7089
|
if (!jsonPath && !checkLegacy && autoInstall) {
|
|
7101
7090
|
await tryInstallPkg(packageName, autoInstall);
|
|
7102
|
-
jsonPath = await resolvePathAsync(`${packageName}/icons.json`, cwd
|
|
7091
|
+
jsonPath = await resolvePathAsync(`${packageName}/icons.json`, cwd);
|
|
7103
7092
|
}
|
|
7104
7093
|
} else if (!jsonPath && autoInstall) {
|
|
7105
7094
|
await tryInstallPkg(packageName, autoInstall);
|
|
7106
|
-
jsonPath = await resolvePathAsync(`${packageName}/icons.json`, cwd
|
|
7095
|
+
jsonPath = await resolvePathAsync(`${packageName}/icons.json`, cwd);
|
|
7107
7096
|
}
|
|
7108
7097
|
if (!jsonPath) {
|
|
7109
|
-
let packagePath = await resolvePathAsync(packageName, cwd
|
|
7098
|
+
let packagePath = await resolvePathAsync(packageName, cwd);
|
|
7110
7099
|
if (packagePath?.match(/^[a-z]:/i)) packagePath = `file:///${packagePath}`.replace(/\\/g, "/");
|
|
7111
7100
|
if (packagePath) {
|
|
7112
7101
|
const { icons } = await import(packagePath);
|
|
@@ -7123,15 +7112,14 @@ async function loadCollectionFromFS(name, autoInstall = false, scope = "@iconify
|
|
|
7123
7112
|
else return;
|
|
7124
7113
|
}
|
|
7125
7114
|
}
|
|
7126
|
-
|
|
7127
7115
|
//#endregion
|
|
7128
7116
|
//#region ../../node_modules/.pnpm/@iconify+utils@3.1.0/node_modules/@iconify/utils/lib/loader/node-loader.js
|
|
7129
7117
|
const loadNodeIcon = async (collection, icon, options) => {
|
|
7130
7118
|
let result = await loadIcon(collection, icon, options);
|
|
7131
7119
|
if (result) return result;
|
|
7132
7120
|
const cwds = Array.isArray(options?.cwd) ? options.cwd : [options?.cwd];
|
|
7133
|
-
for (let i
|
|
7134
|
-
const iconSet = await loadCollectionFromFS(collection, i
|
|
7121
|
+
for (let i = 0; i < cwds.length; i++) {
|
|
7122
|
+
const iconSet = await loadCollectionFromFS(collection, i === cwds.length - 1 ? options?.autoInstall : false, void 0, cwds[i]);
|
|
7135
7123
|
if (iconSet) {
|
|
7136
7124
|
result = await searchForIcon(iconSet, collection, getPossibleIconNames(icon), options);
|
|
7137
7125
|
if (result) return result;
|
|
@@ -7139,6 +7127,5 @@ const loadNodeIcon = async (collection, icon, options) => {
|
|
|
7139
7127
|
}
|
|
7140
7128
|
if (options?.warn) warnOnce(`failed to load ${options.warn} icon`);
|
|
7141
7129
|
};
|
|
7142
|
-
|
|
7143
7130
|
//#endregion
|
|
7144
|
-
export { loadNodeIcon };
|
|
7131
|
+
export { loadNodeIcon };
|