vite 8.2.0 → 8.2.2
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/LICENSE.md +1 -1
- package/dist/client/bundledDevClient.mjs +393 -27
- package/dist/client/client.mjs +20 -14
- package/dist/node/chunks/build.js +98 -88
- package/dist/node/chunks/dist.js +62 -114
- package/dist/node/chunks/node.js +1053 -898
- package/dist/node/chunks/postcss-import.js +23 -25
- package/dist/node/index.d.ts +71 -56
- package/dist/node/module-runner.d.ts +13 -13
- package/dist/node/module-runner.js +30 -20
- package/package.json +16 -16
package/dist/node/chunks/node.js
CHANGED
|
@@ -71,7 +71,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
71
71
|
}
|
|
72
72
|
return to;
|
|
73
73
|
};
|
|
74
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
74
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
75
75
|
value: mod,
|
|
76
76
|
enumerable: true
|
|
77
77
|
}) : target, mod));
|
|
@@ -541,8 +541,10 @@ const importMetaResolveWithCustomHookString = `
|
|
|
541
541
|
|
|
542
542
|
`;
|
|
543
543
|
//#endregion
|
|
544
|
+
//#region package.json
|
|
545
|
+
var version = "8.2.2";
|
|
546
|
+
//#endregion
|
|
544
547
|
//#region src/node/constants.ts
|
|
545
|
-
const { version } = JSON.parse(readFileSync(new URL("../../package.json", new URL("../../../src/node/constants.ts", import.meta.url))).toString());
|
|
546
548
|
const ROLLUP_HOOKS = [
|
|
547
549
|
"options",
|
|
548
550
|
"buildStart",
|
|
@@ -635,6 +637,8 @@ const ENV_PUBLIC_PATH = `/@vite/env`;
|
|
|
635
637
|
const VITE_PACKAGE_DIR = resolve(fileURLToPath(new URL("../../../src/node/constants.ts", import.meta.url)), "../../..");
|
|
636
638
|
const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/client.mjs");
|
|
637
639
|
const BUNDLED_DEV_CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/bundledDevClient.mjs");
|
|
640
|
+
/** URL filename the bundled-dev server serves the vite client under */
|
|
641
|
+
const BUNDLED_DEV_CLIENT_FILENAME = "bundledDevClient.mjs";
|
|
638
642
|
const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/env.mjs");
|
|
639
643
|
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
|
640
644
|
const KNOWN_ASSET_TYPES = [
|
|
@@ -732,7 +736,7 @@ function hasMoreVlq$1(reader, max) {
|
|
|
732
736
|
if (reader.pos >= max) return false;
|
|
733
737
|
return reader.peek() !== comma$1;
|
|
734
738
|
}
|
|
735
|
-
var bufLength =
|
|
739
|
+
var bufLength = 16384;
|
|
736
740
|
var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) {
|
|
737
741
|
return Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength).toString();
|
|
738
742
|
} } : { decode(buf) {
|
|
@@ -1746,7 +1750,8 @@ function getMatcherString$1(id, resolutionBase) {
|
|
|
1746
1750
|
const createFilter$2 = function createFilter(include, exclude, options) {
|
|
1747
1751
|
const resolutionBase = options && options.resolve;
|
|
1748
1752
|
const getMatcher = (id) => id instanceof RegExp ? id : { test: (what) => {
|
|
1749
|
-
|
|
1753
|
+
const pattern = getMatcherString$1(id, resolutionBase);
|
|
1754
|
+
return pm(pattern, { dot: true })(what);
|
|
1750
1755
|
} };
|
|
1751
1756
|
const includeMatchers = ensureArray(include).map(getMatcher);
|
|
1752
1757
|
const excludeMatchers = ensureArray(exclude).map(getMatcher);
|
|
@@ -1947,12 +1952,16 @@ function loadPackageData(pkgPath) {
|
|
|
1947
1952
|
const { sideEffects } = data;
|
|
1948
1953
|
let hasSideEffects;
|
|
1949
1954
|
if (typeof sideEffects === "boolean") hasSideEffects = () => sideEffects;
|
|
1950
|
-
else if (Array.isArray(sideEffects))
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1955
|
+
else if (Array.isArray(sideEffects)) {
|
|
1956
|
+
if (sideEffects.length <= 0) hasSideEffects = () => false;
|
|
1957
|
+
else {
|
|
1958
|
+
const finalPackageSideEffects = sideEffects.map((sideEffect) => {
|
|
1959
|
+
if (sideEffect.includes("/")) return sideEffect;
|
|
1960
|
+
return `**/${sideEffect}`;
|
|
1961
|
+
});
|
|
1962
|
+
hasSideEffects = createFilter$1(finalPackageSideEffects, null, { resolve: pkgDir });
|
|
1963
|
+
}
|
|
1964
|
+
} else hasSideEffects = () => null;
|
|
1956
1965
|
const resolvedCache = {};
|
|
1957
1966
|
return {
|
|
1958
1967
|
dir: pkgDir,
|
|
@@ -3163,7 +3172,8 @@ function formatAndTruncateFileList(files) {
|
|
|
3163
3172
|
truncated
|
|
3164
3173
|
};
|
|
3165
3174
|
}
|
|
3166
|
-
const
|
|
3175
|
+
const lineTerminatorRE = /[\r\n\u2028\u2029]$/;
|
|
3176
|
+
const hashbangRE = /^#![^\r\n\u2028\u2029]*(?:\r\n|[\r\n\u2028\u2029])?/;
|
|
3167
3177
|
function getFileStartIndex(code) {
|
|
3168
3178
|
return hashbangRE.exec(code)?.[0].length ?? 0;
|
|
3169
3179
|
}
|
|
@@ -3241,18 +3251,19 @@ function createLogger(level = "info", options = {}) {
|
|
|
3241
3251
|
if (thresh >= LogLevels[type]) {
|
|
3242
3252
|
const method = type === "info" ? "log" : type;
|
|
3243
3253
|
if (options.error) loggedErrors.add(options.error);
|
|
3244
|
-
if (canClearScreen)
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3254
|
+
if (canClearScreen) {
|
|
3255
|
+
if (type === lastType && msg === lastMsg) {
|
|
3256
|
+
sameCount++;
|
|
3257
|
+
clear();
|
|
3258
|
+
console[method](format(type, msg, options), import_picocolors.default.yellow(`(x${sameCount + 1})`));
|
|
3259
|
+
} else {
|
|
3260
|
+
sameCount = 0;
|
|
3261
|
+
lastMsg = msg;
|
|
3262
|
+
lastType = type;
|
|
3263
|
+
if (options.clear) clear();
|
|
3264
|
+
console[method](format(type, msg, options));
|
|
3265
|
+
}
|
|
3266
|
+
} else console[method](format(type, msg, options));
|
|
3256
3267
|
}
|
|
3257
3268
|
}
|
|
3258
3269
|
const warnedMessages = /* @__PURE__ */ new Set();
|
|
@@ -3293,7 +3304,7 @@ function printServerUrls(urls, optionsHost, info) {
|
|
|
3293
3304
|
const interfaceName = urls.networkInterfaceNames?.[index];
|
|
3294
3305
|
let suffix = "";
|
|
3295
3306
|
if (interfaceName) {
|
|
3296
|
-
const label = interfaceName.length > maxNetworkInterfaceNameLength ? `${interfaceName.slice(0,
|
|
3307
|
+
const label = interfaceName.length > maxNetworkInterfaceNameLength ? `${interfaceName.slice(0, 19)}…` : interfaceName;
|
|
3297
3308
|
suffix = " ".repeat(networkUrlMaxLength - url.length + 2) + import_picocolors.default.dim(label);
|
|
3298
3309
|
}
|
|
3299
3310
|
info(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Network")}: ${colorUrl(url)}${suffix}`);
|
|
@@ -3484,22 +3495,24 @@ function resolveEsbuildTranspileOptions(config, format) {
|
|
|
3484
3495
|
minifyWhitespace: false,
|
|
3485
3496
|
treeShaking: false
|
|
3486
3497
|
};
|
|
3487
|
-
if (options.minifyIdentifiers != null || options.minifySyntax != null || options.minifyWhitespace != null)
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3498
|
+
if (options.minifyIdentifiers != null || options.minifySyntax != null || options.minifyWhitespace != null) {
|
|
3499
|
+
if (isEsLibBuild) return {
|
|
3500
|
+
...options,
|
|
3501
|
+
minify: false,
|
|
3502
|
+
minifyIdentifiers: options.minifyIdentifiers ?? true,
|
|
3503
|
+
minifySyntax: options.minifySyntax ?? true,
|
|
3504
|
+
minifyWhitespace: false,
|
|
3505
|
+
treeShaking: true
|
|
3506
|
+
};
|
|
3507
|
+
else return {
|
|
3508
|
+
...options,
|
|
3509
|
+
minify: false,
|
|
3510
|
+
minifyIdentifiers: options.minifyIdentifiers ?? true,
|
|
3511
|
+
minifySyntax: options.minifySyntax ?? true,
|
|
3512
|
+
minifyWhitespace: options.minifyWhitespace ?? true,
|
|
3513
|
+
treeShaking: true
|
|
3514
|
+
};
|
|
3515
|
+
}
|
|
3503
3516
|
if (isEsLibBuild) return {
|
|
3504
3517
|
...options,
|
|
3505
3518
|
minify: false,
|
|
@@ -3570,7 +3583,7 @@ var Worker$1 = class {
|
|
|
3570
3583
|
_queue;
|
|
3571
3584
|
constructor(fn, options = {}) {
|
|
3572
3585
|
this._isModule = options.type === "module";
|
|
3573
|
-
this._code = genWorkerCode(fn, this._isModule,
|
|
3586
|
+
this._code = genWorkerCode(fn, this._isModule, 5e3, options.parentFunctions ?? {});
|
|
3574
3587
|
this._parentFunctions = options.parentFunctions ?? {};
|
|
3575
3588
|
const defaultMax = Math.max(1, (os.availableParallelism?.() ?? os.cpus().length) - 1);
|
|
3576
3589
|
this._max = options.max || defaultMax;
|
|
@@ -4189,8 +4202,6 @@ function convertEsbuildConfigToOxcConfig(esbuildConfig, logger) {
|
|
|
4189
4202
|
jsxOptions.runtime = "classic";
|
|
4190
4203
|
if (esbuildTransformOptions.jsxFactory) jsxOptions.pragma = esbuildTransformOptions.jsxFactory;
|
|
4191
4204
|
if (esbuildTransformOptions.jsxFragment) jsxOptions.pragmaFrag = esbuildTransformOptions.jsxFragment;
|
|
4192
|
-
break;
|
|
4193
|
-
default: break;
|
|
4194
4205
|
}
|
|
4195
4206
|
if (esbuildTransformOptions.jsxDev !== void 0) jsxOptions.development = esbuildTransformOptions.jsxDev;
|
|
4196
4207
|
if (esbuildTransformOptions.jsxSideEffects !== void 0) jsxOptions.pure = !esbuildTransformOptions.jsxSideEffects;
|
|
@@ -4205,7 +4216,7 @@ function warnDeprecatedShouldBeConvertedToPluginOptions(logger, name) {
|
|
|
4205
4216
|
logger.warn(import_picocolors.default.yellow(`\`esbuild.${name}\` option was specified. But this option is deprecated and will be removed in future versions. This option can be achieved by using a plugin with transform hook, please use that instead.`));
|
|
4206
4217
|
}
|
|
4207
4218
|
//#endregion
|
|
4208
|
-
//#region ../../node_modules/.pnpm/magic-string@1.
|
|
4219
|
+
//#region ../../node_modules/.pnpm/magic-string@1.2.0/node_modules/magic-string/dist/index.mjs
|
|
4209
4220
|
var BitSet = class BitSet {
|
|
4210
4221
|
constructor(arg) {
|
|
4211
4222
|
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
@@ -4343,12 +4354,24 @@ var Chunk = class Chunk {
|
|
|
4343
4354
|
}
|
|
4344
4355
|
}
|
|
4345
4356
|
};
|
|
4357
|
+
/**
|
|
4358
|
+
* The single error type thrown by MagicString.
|
|
4359
|
+
*
|
|
4360
|
+
* Every message is prefixed with `[MagicString]` so its source is obvious at a
|
|
4361
|
+
* glance, and is kept short and consistent in tone.
|
|
4362
|
+
*/
|
|
4363
|
+
var MagicStringError = class extends Error {
|
|
4364
|
+
name = "MagicStringError";
|
|
4365
|
+
constructor(message, options) {
|
|
4366
|
+
super(`[MagicString] ${message}`, options);
|
|
4367
|
+
}
|
|
4368
|
+
};
|
|
4346
4369
|
function getBtoa() {
|
|
4347
4370
|
if (typeof globalThis !== "undefined" && typeof globalThis.btoa === "function") return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
|
|
4348
4371
|
const buffer = globalThis["Buffer"];
|
|
4349
4372
|
if (buffer) return (str) => buffer.from(str, "utf-8").toString("base64");
|
|
4350
4373
|
return () => {
|
|
4351
|
-
throw new
|
|
4374
|
+
throw new MagicStringError("unsupported environment: `btoa` or `Buffer` is required");
|
|
4352
4375
|
};
|
|
4353
4376
|
}
|
|
4354
4377
|
const btoa$1 = /* #__PURE__ */ getBtoa();
|
|
@@ -4565,11 +4588,11 @@ var MagicString = class MagicString {
|
|
|
4565
4588
|
},
|
|
4566
4589
|
byStart: {
|
|
4567
4590
|
writable: true,
|
|
4568
|
-
value:
|
|
4591
|
+
value: /* @__PURE__ */ new Map([[0, chunk]])
|
|
4569
4592
|
},
|
|
4570
4593
|
byEnd: {
|
|
4571
4594
|
writable: true,
|
|
4572
|
-
value:
|
|
4595
|
+
value: /* @__PURE__ */ new Map([[string.length, chunk]])
|
|
4573
4596
|
},
|
|
4574
4597
|
filename: {
|
|
4575
4598
|
writable: true,
|
|
@@ -4600,8 +4623,6 @@ var MagicString = class MagicString {
|
|
|
4600
4623
|
value: options.offset || 0
|
|
4601
4624
|
}
|
|
4602
4625
|
});
|
|
4603
|
-
this.byStart = /* @__PURE__ */ new Map([[0, chunk]]);
|
|
4604
|
-
this.byEnd = /* @__PURE__ */ new Map([[string.length, chunk]]);
|
|
4605
4626
|
}
|
|
4606
4627
|
/**
|
|
4607
4628
|
* Adds the specified character index (with respect to the original string) to sourcemap mappings, if `hires` is false.
|
|
@@ -4613,7 +4634,7 @@ var MagicString = class MagicString {
|
|
|
4613
4634
|
* Appends the specified content to the end of the string.
|
|
4614
4635
|
*/
|
|
4615
4636
|
append(content) {
|
|
4616
|
-
if (typeof content !== "string") throw new
|
|
4637
|
+
if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
|
|
4617
4638
|
this.outro += content;
|
|
4618
4639
|
return this;
|
|
4619
4640
|
}
|
|
@@ -4624,7 +4645,7 @@ var MagicString = class MagicString {
|
|
|
4624
4645
|
*/
|
|
4625
4646
|
appendLeft(index, content) {
|
|
4626
4647
|
index = index + this.offset;
|
|
4627
|
-
if (typeof content !== "string") throw new
|
|
4648
|
+
if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
|
|
4628
4649
|
this._split(index);
|
|
4629
4650
|
const chunk = this.byEnd.get(index);
|
|
4630
4651
|
if (chunk) chunk.appendLeft(content);
|
|
@@ -4638,7 +4659,7 @@ var MagicString = class MagicString {
|
|
|
4638
4659
|
*/
|
|
4639
4660
|
appendRight(index, content) {
|
|
4640
4661
|
index = index + this.offset;
|
|
4641
|
-
if (typeof content !== "string") throw new
|
|
4662
|
+
if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
|
|
4642
4663
|
this._split(index);
|
|
4643
4664
|
const chunk = this.byStart.get(index);
|
|
4644
4665
|
if (chunk) chunk.appendRight(content);
|
|
@@ -4800,7 +4821,7 @@ var MagicString = class MagicString {
|
|
|
4800
4821
|
}
|
|
4801
4822
|
/** @internal */
|
|
4802
4823
|
insert() {
|
|
4803
|
-
throw new
|
|
4824
|
+
throw new MagicStringError("insert() is deprecated, use appendLeft() or prependRight()");
|
|
4804
4825
|
}
|
|
4805
4826
|
/** @internal */
|
|
4806
4827
|
insertLeft(index, content) {
|
|
@@ -4826,7 +4847,7 @@ var MagicString = class MagicString {
|
|
|
4826
4847
|
end = end + this.offset;
|
|
4827
4848
|
index = index + this.offset;
|
|
4828
4849
|
if (start === end) return this;
|
|
4829
|
-
if (index >= start && index <= end) throw new
|
|
4850
|
+
if (index >= start && index <= end) throw new MagicStringError("cannot move a selection inside itself");
|
|
4830
4851
|
this._split(start);
|
|
4831
4852
|
this._split(end);
|
|
4832
4853
|
this._split(index);
|
|
@@ -4879,13 +4900,15 @@ var MagicString = class MagicString {
|
|
|
4879
4900
|
update(start, end, content, options) {
|
|
4880
4901
|
start = start + this.offset;
|
|
4881
4902
|
end = end + this.offset;
|
|
4882
|
-
if (typeof content !== "string") throw new
|
|
4903
|
+
if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
|
|
4883
4904
|
if (this.original.length !== 0) {
|
|
4884
4905
|
while (start < 0) start += this.original.length;
|
|
4885
4906
|
while (end < 0) end += this.original.length;
|
|
4886
4907
|
}
|
|
4887
|
-
if (
|
|
4888
|
-
if (
|
|
4908
|
+
if (start < 0) throw new MagicStringError(`start ${start} is out of bounds`);
|
|
4909
|
+
if (end > this.original.length) throw new MagicStringError(`end ${end} is out of bounds`);
|
|
4910
|
+
if (start === end) throw new MagicStringError(`cannot overwrite a zero-length range at ${start}, use appendLeft() or prependRight()`);
|
|
4911
|
+
if (start > end) throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);
|
|
4889
4912
|
this._split(start);
|
|
4890
4913
|
this._split(end);
|
|
4891
4914
|
if (options === true) {
|
|
@@ -4911,7 +4934,7 @@ var MagicString = class MagicString {
|
|
|
4911
4934
|
if (first) {
|
|
4912
4935
|
let chunk = first;
|
|
4913
4936
|
while (chunk !== last) {
|
|
4914
|
-
if (chunk.next !== this.byStart.get(chunk.end)) throw new
|
|
4937
|
+
if (chunk.next !== this.byStart.get(chunk.end)) throw new MagicStringError("cannot overwrite across a split point");
|
|
4915
4938
|
chunk = chunk.next;
|
|
4916
4939
|
chunk.edit("", false);
|
|
4917
4940
|
}
|
|
@@ -4927,7 +4950,7 @@ var MagicString = class MagicString {
|
|
|
4927
4950
|
* Prepends the string with the specified content.
|
|
4928
4951
|
*/
|
|
4929
4952
|
prepend(content) {
|
|
4930
|
-
if (typeof content !== "string") throw new
|
|
4953
|
+
if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
|
|
4931
4954
|
this.intro = content + this.intro;
|
|
4932
4955
|
return this;
|
|
4933
4956
|
}
|
|
@@ -4936,7 +4959,7 @@ var MagicString = class MagicString {
|
|
|
4936
4959
|
*/
|
|
4937
4960
|
prependLeft(index, content) {
|
|
4938
4961
|
index = index + this.offset;
|
|
4939
|
-
if (typeof content !== "string") throw new
|
|
4962
|
+
if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
|
|
4940
4963
|
this._split(index);
|
|
4941
4964
|
const chunk = this.byEnd.get(index);
|
|
4942
4965
|
if (chunk) chunk.prependLeft(content);
|
|
@@ -4948,7 +4971,7 @@ var MagicString = class MagicString {
|
|
|
4948
4971
|
*/
|
|
4949
4972
|
prependRight(index, content) {
|
|
4950
4973
|
index = index + this.offset;
|
|
4951
|
-
if (typeof content !== "string") throw new
|
|
4974
|
+
if (typeof content !== "string") throw new MagicStringError(`content must be a string, got ${typeof content}`);
|
|
4952
4975
|
this._split(index);
|
|
4953
4976
|
const chunk = this.byStart.get(index);
|
|
4954
4977
|
if (chunk) chunk.prependRight(content);
|
|
@@ -4967,8 +4990,8 @@ var MagicString = class MagicString {
|
|
|
4967
4990
|
while (end < 0) end += this.original.length;
|
|
4968
4991
|
}
|
|
4969
4992
|
if (start === end) return this;
|
|
4970
|
-
if (start < 0 || end > this.original.length) throw new
|
|
4971
|
-
if (start > end) throw new
|
|
4993
|
+
if (start < 0 || end > this.original.length) throw new MagicStringError(`range ${start}–${end} is out of bounds`);
|
|
4994
|
+
if (start > end) throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);
|
|
4972
4995
|
this._split(start);
|
|
4973
4996
|
this._split(end);
|
|
4974
4997
|
let chunk = this.byStart.get(start);
|
|
@@ -4991,8 +5014,8 @@ var MagicString = class MagicString {
|
|
|
4991
5014
|
while (end < 0) end += this.original.length;
|
|
4992
5015
|
}
|
|
4993
5016
|
if (start === end) return this;
|
|
4994
|
-
if (start < 0 || end > this.original.length) throw new
|
|
4995
|
-
if (start > end) throw new
|
|
5017
|
+
if (start < 0 || end > this.original.length) throw new MagicStringError(`range ${start}–${end} is out of bounds`);
|
|
5018
|
+
if (start > end) throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);
|
|
4996
5019
|
this._split(start);
|
|
4997
5020
|
this._split(end);
|
|
4998
5021
|
let chunk = this.byStart.get(start);
|
|
@@ -5058,12 +5081,12 @@ var MagicString = class MagicString {
|
|
|
5058
5081
|
if (chunk.start < end && chunk.end >= end) return result;
|
|
5059
5082
|
chunk = chunk.next;
|
|
5060
5083
|
}
|
|
5061
|
-
if (chunk && chunk.edited && chunk.start !== start) throw new
|
|
5084
|
+
if (chunk && chunk.edited && chunk.start !== start) throw new MagicStringError(`cannot use edited character ${start} as slice start anchor`);
|
|
5062
5085
|
const startChunk = chunk;
|
|
5063
5086
|
while (chunk) {
|
|
5064
5087
|
if (chunk.intro && (startChunk !== chunk || chunk.start === start)) result += chunk.intro;
|
|
5065
5088
|
const containsEnd = chunk.start < end && chunk.end >= end;
|
|
5066
|
-
if (containsEnd && chunk.edited && chunk.end !== end) throw new
|
|
5089
|
+
if (containsEnd && chunk.edited && chunk.end !== end) throw new MagicStringError(`cannot use edited character ${end} as slice end anchor`);
|
|
5067
5090
|
const sliceStart = startChunk === chunk ? start - chunk.start : 0;
|
|
5068
5091
|
const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
|
|
5069
5092
|
result += chunk.content.slice(sliceStart, sliceEnd);
|
|
@@ -5099,7 +5122,7 @@ var MagicString = class MagicString {
|
|
|
5099
5122
|
_splitChunk(chunk, index) {
|
|
5100
5123
|
if (chunk.edited && chunk.content.length) {
|
|
5101
5124
|
const loc = getLocator(this.original)(index);
|
|
5102
|
-
throw new
|
|
5125
|
+
throw new MagicStringError(`cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`);
|
|
5103
5126
|
}
|
|
5104
5127
|
const newChunk = chunk.split(index);
|
|
5105
5128
|
this.byEnd.set(index, chunk);
|
|
@@ -5281,7 +5304,7 @@ var MagicString = class MagicString {
|
|
|
5281
5304
|
*/
|
|
5282
5305
|
replaceAll(searchValue, replacement) {
|
|
5283
5306
|
if (typeof searchValue === "string") return this._replaceAllString(searchValue, replacement);
|
|
5284
|
-
if (!searchValue.global) throw new
|
|
5307
|
+
if (!searchValue.global) throw new MagicStringError("replaceAll() requires a global RegExp");
|
|
5285
5308
|
return this._replaceRegexp(searchValue, replacement);
|
|
5286
5309
|
}
|
|
5287
5310
|
};
|
|
@@ -5540,10 +5563,12 @@ codes.ERR_INVALID_ARG_TYPE = createError(
|
|
|
5540
5563
|
message += `an instance of ${formatList(instances, "or")}`;
|
|
5541
5564
|
if (other.length > 0) message += " or ";
|
|
5542
5565
|
}
|
|
5543
|
-
if (other.length > 0)
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5566
|
+
if (other.length > 0) {
|
|
5567
|
+
if (other.length > 1) message += `one of ${formatList(other, "or")}`;
|
|
5568
|
+
else {
|
|
5569
|
+
if (other[0].toLowerCase() !== other[0]) message += "an ";
|
|
5570
|
+
message += `${other[0]}`;
|
|
5571
|
+
}
|
|
5547
5572
|
}
|
|
5548
5573
|
message += `. Received ${determineSpecificType(actual)}`;
|
|
5549
5574
|
return message;
|
|
@@ -5837,9 +5862,10 @@ var import_main = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
5837
5862
|
defaultValue = r.join(splitter);
|
|
5838
5863
|
value = env[key];
|
|
5839
5864
|
}
|
|
5840
|
-
if (value)
|
|
5841
|
-
|
|
5842
|
-
|
|
5865
|
+
if (value) {
|
|
5866
|
+
if (seen.has(value)) result = result.replace(template, defaultValue);
|
|
5867
|
+
else result = result.replace(template, value);
|
|
5868
|
+
} else result = result.replace(template, defaultValue);
|
|
5843
5869
|
if (result === runningParsed[key]) break;
|
|
5844
5870
|
regex.lastIndex = 0;
|
|
5845
5871
|
}
|
|
@@ -5891,9 +5917,10 @@ function loadEnv(mode, envDir, prefixes = "VITE_") {
|
|
|
5891
5917
|
if (parsed.NODE_ENV && process.env.VITE_USER_NODE_ENV === void 0) process.env.VITE_USER_NODE_ENV = parsed.NODE_ENV;
|
|
5892
5918
|
if (parsed.BROWSER && process.env.BROWSER === void 0) process.env.BROWSER = parsed.BROWSER;
|
|
5893
5919
|
if (parsed.BROWSER_ARGS && process.env.BROWSER_ARGS === void 0) process.env.BROWSER_ARGS = parsed.BROWSER_ARGS;
|
|
5920
|
+
const processEnv = { ...process.env };
|
|
5894
5921
|
(0, import_main.expand)({
|
|
5895
5922
|
parsed,
|
|
5896
|
-
processEnv
|
|
5923
|
+
processEnv
|
|
5897
5924
|
});
|
|
5898
5925
|
for (const [key, value] of Object.entries(parsed)) if (prefixes.some((prefix) => key.startsWith(prefix))) env[key] = value;
|
|
5899
5926
|
for (const prefix of prefixes) Object.assign(env, getEnvs({ prefix }));
|
|
@@ -7236,9 +7263,7 @@ var require_vary = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7236
7263
|
list.push(header.substring(start, end));
|
|
7237
7264
|
start = end = i + 1;
|
|
7238
7265
|
break;
|
|
7239
|
-
default:
|
|
7240
|
-
end = i + 1;
|
|
7241
|
-
break;
|
|
7266
|
+
default: end = i + 1;
|
|
7242
7267
|
}
|
|
7243
7268
|
list.push(header.substring(start, end));
|
|
7244
7269
|
return list;
|
|
@@ -9998,17 +10023,18 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
9998
10023
|
const parent = sysPath$1.dirname(path);
|
|
9999
10024
|
const item = sysPath$1.basename(path);
|
|
10000
10025
|
const watchedDir = this.fsw._getWatchedDir(info.type === FSEVENT_TYPE_DIRECTORY ? path : parent);
|
|
10001
|
-
if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN)
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10026
|
+
if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN) {
|
|
10027
|
+
if (typeof opts.ignored === FUNCTION_TYPE) {
|
|
10028
|
+
let stats;
|
|
10029
|
+
try {
|
|
10030
|
+
stats = await stat(path);
|
|
10031
|
+
} catch (error) {}
|
|
10032
|
+
if (this.fsw.closed) return;
|
|
10033
|
+
if (this.checkIgnored(path, stats)) return;
|
|
10034
|
+
if (sameTypes(info, stats)) this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
10035
|
+
else this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
10036
|
+
} else this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
10037
|
+
} else switch (info.event) {
|
|
10012
10038
|
case FSEVENT_CREATED:
|
|
10013
10039
|
case FSEVENT_MODIFIED: return this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
10014
10040
|
case FSEVENT_DELETED:
|
|
@@ -10112,13 +10138,15 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
10112
10138
|
this.fsw._emitReady();
|
|
10113
10139
|
}
|
|
10114
10140
|
}
|
|
10115
|
-
if (opts.persistent && forceAdd !== true)
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10141
|
+
if (opts.persistent && forceAdd !== true) {
|
|
10142
|
+
if (typeof transform === FUNCTION_TYPE) this.initWatch(void 0, path, wh, processPath);
|
|
10143
|
+
else {
|
|
10144
|
+
let realPath;
|
|
10145
|
+
try {
|
|
10146
|
+
realPath = await realpath(wh.watchPath);
|
|
10147
|
+
} catch (e) {}
|
|
10148
|
+
this.initWatch(realPath, path, wh, processPath);
|
|
10149
|
+
}
|
|
10122
10150
|
}
|
|
10123
10151
|
}
|
|
10124
10152
|
};
|
|
@@ -10956,16 +10984,17 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
10956
10984
|
if (esc) {
|
|
10957
10985
|
out += c;
|
|
10958
10986
|
esc = false;
|
|
10959
|
-
} else if (quote)
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
10963
|
-
|
|
10964
|
-
|
|
10965
|
-
|
|
10966
|
-
|
|
10967
|
-
|
|
10968
|
-
|
|
10987
|
+
} else if (quote) {
|
|
10988
|
+
if (c === quote) quote = false;
|
|
10989
|
+
else if (quote == SQ) out += c;
|
|
10990
|
+
else if (c === BS) {
|
|
10991
|
+
i += 1;
|
|
10992
|
+
c = s.charAt(i);
|
|
10993
|
+
if (c === DQ || c === BS || c === DS) out += c;
|
|
10994
|
+
else out += BS + c;
|
|
10995
|
+
} else if (c === DS) out += parseEnvVar();
|
|
10996
|
+
else out += c;
|
|
10997
|
+
} else if (c === DQ || c === SQ) quote = c;
|
|
10969
10998
|
else if (controlRE.test(c)) return { op: s };
|
|
10970
10999
|
else if (hash.test(c)) {
|
|
10971
11000
|
commented = true;
|
|
@@ -11399,7 +11428,7 @@ var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports,
|
|
|
11399
11428
|
};
|
|
11400
11429
|
}));
|
|
11401
11430
|
//#endregion
|
|
11402
|
-
//#region ../../node_modules/.pnpm/@vercel+detect-agent@1.2.
|
|
11431
|
+
//#region ../../node_modules/.pnpm/@vercel+detect-agent@1.2.5/node_modules/@vercel/detect-agent/dist/index.js
|
|
11403
11432
|
var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
11404
11433
|
var __defProp = Object.defineProperty;
|
|
11405
11434
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -11576,6 +11605,22 @@ async function readFileIfExists(value) {
|
|
|
11576
11605
|
if (typeof value === "string") return fsp.readFile(path.resolve(value)).catch(() => value);
|
|
11577
11606
|
return value;
|
|
11578
11607
|
}
|
|
11608
|
+
async function getAvailableEphemeralPort(specifiedHost) {
|
|
11609
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
11610
|
+
let port = 0;
|
|
11611
|
+
let available = true;
|
|
11612
|
+
for (const host of [...wildcardHosts, specifiedHost]) {
|
|
11613
|
+
const availablePort = await tryListen(port, host).catch(() => port);
|
|
11614
|
+
if (availablePort == null) {
|
|
11615
|
+
available = false;
|
|
11616
|
+
break;
|
|
11617
|
+
}
|
|
11618
|
+
port = availablePort;
|
|
11619
|
+
}
|
|
11620
|
+
if (available) return port;
|
|
11621
|
+
}
|
|
11622
|
+
return null;
|
|
11623
|
+
}
|
|
11579
11624
|
async function isPortAvailable(port) {
|
|
11580
11625
|
for (const host of wildcardHosts) if (!await tryListen(port, host).catch(() => true)) return false;
|
|
11581
11626
|
return true;
|
|
@@ -11584,10 +11629,11 @@ function tryListen(port, host) {
|
|
|
11584
11629
|
return new Promise((resolve) => {
|
|
11585
11630
|
const server = net.createServer();
|
|
11586
11631
|
server.once("error", (e) => {
|
|
11587
|
-
server.close(() => resolve(e.code
|
|
11632
|
+
server.close(() => resolve(e.code === "EADDRINUSE" ? null : port));
|
|
11588
11633
|
});
|
|
11589
11634
|
server.once("listening", () => {
|
|
11590
|
-
server.
|
|
11635
|
+
const address = server.address();
|
|
11636
|
+
server.close(() => resolve(typeof address === "object" && address ? address.port : port));
|
|
11591
11637
|
});
|
|
11592
11638
|
server.listen(port, host);
|
|
11593
11639
|
});
|
|
@@ -11615,6 +11661,14 @@ async function tryBindServer(httpServer, port, host) {
|
|
|
11615
11661
|
const MAX_PORT = 65535;
|
|
11616
11662
|
async function httpServerStart(httpServer, serverOptions) {
|
|
11617
11663
|
const { port: startPort, strictPort, host, logger } = serverOptions;
|
|
11664
|
+
if (startPort === 0) {
|
|
11665
|
+
const port = await getAvailableEphemeralPort(host);
|
|
11666
|
+
if (port == null) throw new Error("No available ephemeral port found");
|
|
11667
|
+
const result = await tryBindServer(httpServer, port, host);
|
|
11668
|
+
if (result.success) return port;
|
|
11669
|
+
if (result.error.code !== "EADDRINUSE") throw result.error;
|
|
11670
|
+
throw new Error(`Port ${port} is already in use`);
|
|
11671
|
+
}
|
|
11618
11672
|
for (let port = startPort; port <= MAX_PORT; port++) {
|
|
11619
11673
|
const portAvailableOnWildcard = await isPortAvailable(port);
|
|
11620
11674
|
if (strictPort) {
|
|
@@ -11649,9 +11703,7 @@ function setClientErrorHandler(server, logger) {
|
|
|
11649
11703
|
case "ERR_HTTP_REQUEST_TIMEOUT":
|
|
11650
11704
|
msg = "408 Request Timeout";
|
|
11651
11705
|
break;
|
|
11652
|
-
default:
|
|
11653
|
-
msg = "400 Bad Request";
|
|
11654
|
-
break;
|
|
11706
|
+
default: msg = "400 Bad Request";
|
|
11655
11707
|
}
|
|
11656
11708
|
if (err.code === "ECONNRESET" || !socket.writable) return;
|
|
11657
11709
|
socket.end(`HTTP/1.1 ${msg}\r\nConnection: close\r\n\r\n`);
|
|
@@ -11869,25 +11921,27 @@ function walk$2(node, state, visitors) {
|
|
|
11869
11921
|
for (const key in node) {
|
|
11870
11922
|
if (key === "type") continue;
|
|
11871
11923
|
const child_node = node[key];
|
|
11872
|
-
if (child_node && typeof child_node === "object")
|
|
11873
|
-
|
|
11874
|
-
|
|
11875
|
-
|
|
11876
|
-
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
|
|
11924
|
+
if (child_node && typeof child_node === "object") {
|
|
11925
|
+
if (Array.isArray(child_node)) {
|
|
11926
|
+
/** @type {Record<number, T>} */
|
|
11927
|
+
const array_mutations = {};
|
|
11928
|
+
const len = child_node.length;
|
|
11929
|
+
let mutated = false;
|
|
11930
|
+
for (let i = 0; i < len; i++) {
|
|
11931
|
+
const node = child_node[i];
|
|
11932
|
+
if (node && typeof node === "object") {
|
|
11933
|
+
const result = visit(node, path, next_state);
|
|
11934
|
+
if (result) {
|
|
11935
|
+
array_mutations[i] = result;
|
|
11936
|
+
mutated = true;
|
|
11937
|
+
}
|
|
11884
11938
|
}
|
|
11885
11939
|
}
|
|
11940
|
+
if (mutated) mutations[key] = child_node.map((node, i) => array_mutations[i] ?? node);
|
|
11941
|
+
} else {
|
|
11942
|
+
const result = visit(child_node, path, next_state);
|
|
11943
|
+
if (result) mutations[key] = result;
|
|
11886
11944
|
}
|
|
11887
|
-
if (mutated) mutations[key] = child_node.map((node, i) => array_mutations[i] ?? node);
|
|
11888
|
-
} else {
|
|
11889
|
-
const result = visit(child_node, path, next_state);
|
|
11890
|
-
if (result) mutations[key] = result;
|
|
11891
11945
|
}
|
|
11892
11946
|
}
|
|
11893
11947
|
path.pop();
|
|
@@ -12033,7 +12087,6 @@ function analyze(expression) {
|
|
|
12033
12087
|
if (node.param) {
|
|
12034
12088
|
for (const name of extract_names(node.param)) if (node.param) current_scope.declarations.set(name, node.param);
|
|
12035
12089
|
}
|
|
12036
|
-
break;
|
|
12037
12090
|
}
|
|
12038
12091
|
context.next();
|
|
12039
12092
|
if (map.has(node) && current_scope !== null && current_scope.parent) current_scope = current_scope.parent;
|
|
@@ -12078,12 +12131,13 @@ var Scope = class {
|
|
|
12078
12131
|
* @param {import('estree').VariableDeclaration | import('estree').ClassDeclaration} node
|
|
12079
12132
|
*/
|
|
12080
12133
|
add_declaration(node) {
|
|
12081
|
-
if (node.type === "VariableDeclaration")
|
|
12082
|
-
|
|
12083
|
-
|
|
12084
|
-
|
|
12085
|
-
|
|
12086
|
-
|
|
12134
|
+
if (node.type === "VariableDeclaration") {
|
|
12135
|
+
if (node.kind === "var" && this.block && this.parent) this.parent.add_declaration(node);
|
|
12136
|
+
else for (const declarator of node.declarations) for (const name of extract_names(declarator.id)) {
|
|
12137
|
+
this.declarations.set(name, node);
|
|
12138
|
+
if (declarator.init) this.initialised_declarations.add(name);
|
|
12139
|
+
}
|
|
12140
|
+
} else if (node.id) this.declarations.set(node.id.name, node);
|
|
12087
12141
|
}
|
|
12088
12142
|
/**
|
|
12089
12143
|
* @param {string} name
|
|
@@ -12133,9 +12187,7 @@ function extract_identifiers(param, nodes = []) {
|
|
|
12133
12187
|
case "RestElement":
|
|
12134
12188
|
extract_identifiers(param.argument, nodes);
|
|
12135
12189
|
break;
|
|
12136
|
-
case "AssignmentPattern":
|
|
12137
|
-
extract_identifiers(param.left, nodes);
|
|
12138
|
-
break;
|
|
12190
|
+
case "AssignmentPattern": extract_identifiers(param.left, nodes);
|
|
12139
12191
|
}
|
|
12140
12192
|
return nodes;
|
|
12141
12193
|
}
|
|
@@ -12172,10 +12224,12 @@ var WalkerBase = class {
|
|
|
12172
12224
|
* @param {Node} node
|
|
12173
12225
|
*/
|
|
12174
12226
|
replace(parent, prop, index, node) {
|
|
12175
|
-
if (parent && prop)
|
|
12227
|
+
if (parent && prop) {
|
|
12228
|
+
if (index != null)
|
|
12176
12229
|
/** @type {Array<Node>} */ parent[prop][index] = node;
|
|
12177
|
-
|
|
12230
|
+
else
|
|
12178
12231
|
/** @type {Node} */ parent[prop] = node;
|
|
12232
|
+
}
|
|
12179
12233
|
}
|
|
12180
12234
|
/**
|
|
12181
12235
|
* @template {Node} Parent
|
|
@@ -12184,9 +12238,11 @@ var WalkerBase = class {
|
|
|
12184
12238
|
* @param {number | null | undefined} index
|
|
12185
12239
|
*/
|
|
12186
12240
|
remove(parent, prop, index) {
|
|
12187
|
-
if (parent && prop)
|
|
12241
|
+
if (parent && prop) {
|
|
12242
|
+
if (index !== null && index !== void 0)
|
|
12188
12243
|
/** @type {Array<Node>} */ parent[prop].splice(index, 1);
|
|
12189
|
-
|
|
12244
|
+
else delete parent[prop];
|
|
12245
|
+
}
|
|
12190
12246
|
}
|
|
12191
12247
|
};
|
|
12192
12248
|
//#endregion
|
|
@@ -12414,45 +12470,50 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
12414
12470
|
if (s.type === "ImportSpecifier") return getIdentifierNameOrLiteralValue$1(s.imported);
|
|
12415
12471
|
else if (s.type === "ImportDefaultSpecifier") return "default";
|
|
12416
12472
|
}).filter(isDefined) });
|
|
12417
|
-
for (const spec of node.specifiers) if (spec.type === "ImportSpecifier")
|
|
12418
|
-
|
|
12419
|
-
|
|
12473
|
+
for (const spec of node.specifiers) if (spec.type === "ImportSpecifier") {
|
|
12474
|
+
if (spec.imported.type === "Identifier") idToImportMap.set(spec.local.name, `${importId}.${spec.imported.name}`);
|
|
12475
|
+
else idToImportMap.set(spec.local.name, `${importId}[${JSON.stringify(spec.imported.value)}]`);
|
|
12476
|
+
} else if (spec.type === "ImportDefaultSpecifier") idToImportMap.set(spec.local.name, `${importId}.default`);
|
|
12420
12477
|
else idToImportMap.set(spec.local.name, importId);
|
|
12421
12478
|
}
|
|
12422
12479
|
for (const node of exports) {
|
|
12423
|
-
if (node.type === "ExportNamedDeclaration")
|
|
12424
|
-
if (node.declaration
|
|
12425
|
-
|
|
12426
|
-
|
|
12427
|
-
|
|
12428
|
-
const
|
|
12429
|
-
|
|
12480
|
+
if (node.type === "ExportNamedDeclaration") {
|
|
12481
|
+
if (node.declaration) {
|
|
12482
|
+
if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") defineExport(node.declaration.id.name);
|
|
12483
|
+
else {
|
|
12484
|
+
const declaration = node.declaration;
|
|
12485
|
+
for (const decl of declaration.declarations) {
|
|
12486
|
+
const names = extract_names(decl.id);
|
|
12487
|
+
for (const name of names) defineExport(name);
|
|
12488
|
+
}
|
|
12489
|
+
}
|
|
12490
|
+
s.remove(node.start, node.declaration.start);
|
|
12491
|
+
} else if (node.source) {
|
|
12492
|
+
const importId = reExportImportIdMap.get(node);
|
|
12493
|
+
for (const spec of node.specifiers) {
|
|
12494
|
+
const exportedAs = getIdentifierNameOrLiteralValue$1(spec.exported);
|
|
12495
|
+
if (spec.local.type === "Identifier") defineExport(exportedAs, `${importId}.${spec.local.name}`);
|
|
12496
|
+
else defineExport(exportedAs, `${importId}[${JSON.stringify(spec.local.value)}]`);
|
|
12497
|
+
}
|
|
12498
|
+
} else {
|
|
12499
|
+
s.remove(node.start, node.end);
|
|
12500
|
+
for (const spec of node.specifiers) {
|
|
12501
|
+
const local = spec.local.name;
|
|
12502
|
+
const binding = idToImportMap.get(local);
|
|
12503
|
+
defineExport(getIdentifierNameOrLiteralValue$1(spec.exported), binding || local);
|
|
12430
12504
|
}
|
|
12431
|
-
}
|
|
12432
|
-
s.remove(node.start, node.declaration.start);
|
|
12433
|
-
} else if (node.source) {
|
|
12434
|
-
const importId = reExportImportIdMap.get(node);
|
|
12435
|
-
for (const spec of node.specifiers) {
|
|
12436
|
-
const exportedAs = getIdentifierNameOrLiteralValue$1(spec.exported);
|
|
12437
|
-
if (spec.local.type === "Identifier") defineExport(exportedAs, `${importId}.${spec.local.name}`);
|
|
12438
|
-
else defineExport(exportedAs, `${importId}[${JSON.stringify(spec.local.value)}]`);
|
|
12439
|
-
}
|
|
12440
|
-
} else {
|
|
12441
|
-
s.remove(node.start, node.end);
|
|
12442
|
-
for (const spec of node.specifiers) {
|
|
12443
|
-
const local = spec.local.name;
|
|
12444
|
-
const binding = idToImportMap.get(local);
|
|
12445
|
-
defineExport(getIdentifierNameOrLiteralValue$1(spec.exported), binding || local);
|
|
12446
12505
|
}
|
|
12447
12506
|
}
|
|
12448
|
-
if (node.type === "ExportDefaultDeclaration")
|
|
12449
|
-
|
|
12450
|
-
|
|
12451
|
-
|
|
12452
|
-
|
|
12453
|
-
|
|
12454
|
-
|
|
12455
|
-
|
|
12507
|
+
if (node.type === "ExportDefaultDeclaration") {
|
|
12508
|
+
if ("id" in node.declaration && node.declaration.id && !["FunctionExpression", "ClassExpression"].includes(node.declaration.type)) {
|
|
12509
|
+
const { name } = node.declaration.id;
|
|
12510
|
+
s.remove(node.start, node.start + 15);
|
|
12511
|
+
defineExport("default", name);
|
|
12512
|
+
} else {
|
|
12513
|
+
const name = `__vite_ssr_export_default__`;
|
|
12514
|
+
s.update(node.start, node.start + 14, `const ${name} =`);
|
|
12515
|
+
defineExport("default", name);
|
|
12516
|
+
}
|
|
12456
12517
|
}
|
|
12457
12518
|
if (node.type === "ExportAllDeclaration") {
|
|
12458
12519
|
const importId = reExportImportIdMap.get(node);
|
|
@@ -12478,15 +12539,16 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
12478
12539
|
const topNode = parentStack[parentStack.length - 2];
|
|
12479
12540
|
s.prependRight(topNode.start, `const ${id.name} = ${binding};\n`);
|
|
12480
12541
|
}
|
|
12481
|
-
} else if (parent.type === "CallExpression")
|
|
12482
|
-
|
|
12483
|
-
|
|
12484
|
-
|
|
12485
|
-
|
|
12486
|
-
|
|
12487
|
-
|
|
12488
|
-
|
|
12489
|
-
|
|
12542
|
+
} else if (parent.type === "CallExpression") {
|
|
12543
|
+
if (id === parent.callee && !parent.optional) {
|
|
12544
|
+
const argsStart = parent.arguments.length ? parent.arguments[0].start : parent.end;
|
|
12545
|
+
s.update(id.start, argsStart, `(0,${binding})${code.slice(id.end, argsStart)}`);
|
|
12546
|
+
} else {
|
|
12547
|
+
s.update(id.start, id.end, binding);
|
|
12548
|
+
s.prependRight(id.start, `(0,`);
|
|
12549
|
+
s.appendLeft(id.end, `)`);
|
|
12550
|
+
}
|
|
12551
|
+
} else if (!(parent.type === "ClassExpression" && id === parent.id)) s.update(id.start, id.end, binding);
|
|
12490
12552
|
},
|
|
12491
12553
|
onImportMeta(node) {
|
|
12492
12554
|
s.update(node.start, node.end, ssrImportMetaKey);
|
|
@@ -12569,19 +12631,7 @@ function walk(root, { onIdentifier, onImportMeta, onDynamicImport, onStatements
|
|
|
12569
12631
|
if (parentScope) setScope(parentScope, node.id.name);
|
|
12570
12632
|
}
|
|
12571
12633
|
if (node.type === "FunctionExpression" && node.id) setScope(node, node.id.name);
|
|
12572
|
-
node.params.forEach((p) =>
|
|
12573
|
-
if (p.type === "ObjectPattern" || p.type === "ArrayPattern") {
|
|
12574
|
-
handlePattern(p, node);
|
|
12575
|
-
return;
|
|
12576
|
-
}
|
|
12577
|
-
walk$1(p.type === "AssignmentPattern" ? p.left : p, { enter(child, parent) {
|
|
12578
|
-
if (parent?.type === "AssignmentPattern" && parent.right === child) return this.skip();
|
|
12579
|
-
if (child.type !== "Identifier") return;
|
|
12580
|
-
if (isStaticPropertyKey(child, parent)) return;
|
|
12581
|
-
if (parent?.type === "TemplateLiteral" && parent.expressions.includes(child) || parent?.type === "CallExpression" && parent.callee === child) return;
|
|
12582
|
-
setScope(node, child.name);
|
|
12583
|
-
} });
|
|
12584
|
-
});
|
|
12634
|
+
node.params.forEach((p) => handlePattern(p, node));
|
|
12585
12635
|
} else if (node.type === "ClassDeclaration") {
|
|
12586
12636
|
const parentScope = findParentScope(parentStack);
|
|
12587
12637
|
if (parentScope) setScope(parentScope, node.id.name);
|
|
@@ -13214,7 +13264,8 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13214
13264
|
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
13215
13265
|
const getPathInfo = (cmd, opt) => {
|
|
13216
13266
|
const colon = opt.colon || COLON;
|
|
13217
|
-
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
13267
|
+
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
13268
|
+
/* istanbul ignore next: very unusual */ "").split(colon)];
|
|
13218
13269
|
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
13219
13270
|
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
13220
13271
|
if (isWindows) {
|
|
@@ -13246,8 +13297,10 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13246
13297
|
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
13247
13298
|
const ext = pathExt[ii];
|
|
13248
13299
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
13249
|
-
if (!er && is)
|
|
13250
|
-
|
|
13300
|
+
if (!er && is) {
|
|
13301
|
+
if (opt.all) found.push(p + ext);
|
|
13302
|
+
else return resolve(p + ext);
|
|
13303
|
+
}
|
|
13251
13304
|
return resolve(subStep(p, i, ii + 1));
|
|
13252
13305
|
});
|
|
13253
13306
|
});
|
|
@@ -13265,8 +13318,10 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13265
13318
|
for (let j = 0; j < pathExt.length; j++) {
|
|
13266
13319
|
const cur = p + pathExt[j];
|
|
13267
13320
|
try {
|
|
13268
|
-
if (isexe.sync(cur, { pathExt: pathExtExe }))
|
|
13269
|
-
|
|
13321
|
+
if (isexe.sync(cur, { pathExt: pathExtExe })) {
|
|
13322
|
+
if (opt.all) found.push(cur);
|
|
13323
|
+
else return cur;
|
|
13324
|
+
}
|
|
13270
13325
|
} catch (ex) {}
|
|
13271
13326
|
}
|
|
13272
13327
|
}
|
|
@@ -13777,7 +13832,7 @@ function checkPublicFile(url, config) {
|
|
|
13777
13832
|
return tryStatSync(publicFile)?.isFile() ? publicFile : void 0;
|
|
13778
13833
|
}
|
|
13779
13834
|
//#endregion
|
|
13780
|
-
//#region ../../node_modules/.pnpm/ws@8.21.
|
|
13835
|
+
//#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js
|
|
13781
13836
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
13782
13837
|
const BINARY_TYPES = [
|
|
13783
13838
|
"nodebuffer",
|
|
@@ -13800,7 +13855,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13800
13855
|
};
|
|
13801
13856
|
}));
|
|
13802
13857
|
//#endregion
|
|
13803
|
-
//#region ../../node_modules/.pnpm/ws@8.21.
|
|
13858
|
+
//#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/buffer-util.js
|
|
13804
13859
|
var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
13805
13860
|
const { EMPTY_BUFFER } = require_constants();
|
|
13806
13861
|
const FastBuffer = Buffer[Symbol.species];
|
|
@@ -13900,7 +13955,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13900
13955
|
} catch (e) {}
|
|
13901
13956
|
}));
|
|
13902
13957
|
//#endregion
|
|
13903
|
-
//#region ../../node_modules/.pnpm/ws@8.21.
|
|
13958
|
+
//#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/limiter.js
|
|
13904
13959
|
var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
13905
13960
|
const kDone = Symbol("kDone");
|
|
13906
13961
|
const kRun = Symbol("kRun");
|
|
@@ -13951,7 +14006,7 @@ var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13951
14006
|
module.exports = Limiter;
|
|
13952
14007
|
}));
|
|
13953
14008
|
//#endregion
|
|
13954
|
-
//#region ../../node_modules/.pnpm/ws@8.21.
|
|
14009
|
+
//#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/permessage-deflate.js
|
|
13955
14010
|
var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
13956
14011
|
const zlib$1 = __require("zlib");
|
|
13957
14012
|
const bufferUtil = require_buffer_util();
|
|
@@ -14071,7 +14126,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
14071
14126
|
acceptAsServer(offers) {
|
|
14072
14127
|
const opts = this._options;
|
|
14073
14128
|
const accepted = offers.find((params) => {
|
|
14074
|
-
if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && !params.client_max_window_bits) return false;
|
|
14129
|
+
if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && (typeof params.client_max_window_bits === "number" ? opts.clientMaxWindowBits > params.client_max_window_bits : !params.client_max_window_bits)) return false;
|
|
14075
14130
|
return true;
|
|
14076
14131
|
});
|
|
14077
14132
|
if (!accepted) throw new Error("None of the extension offers can be accepted");
|
|
@@ -14287,7 +14342,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
14287
14342
|
}
|
|
14288
14343
|
}));
|
|
14289
14344
|
//#endregion
|
|
14290
|
-
//#region ../../node_modules/.pnpm/ws@8.21.
|
|
14345
|
+
//#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/validation.js
|
|
14291
14346
|
var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14292
14347
|
const { isUtf8 } = __require("buffer");
|
|
14293
14348
|
const { hasBlob } = require_constants();
|
|
@@ -14483,7 +14538,7 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14483
14538
|
} catch (e) {}
|
|
14484
14539
|
}));
|
|
14485
14540
|
//#endregion
|
|
14486
|
-
//#region ../../node_modules/.pnpm/ws@8.21.
|
|
14541
|
+
//#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/receiver.js
|
|
14487
14542
|
var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14488
14543
|
const { Writable: Writable$1 } = __require("stream");
|
|
14489
14544
|
const PerMessageDeflate = require_permessage_deflate();
|
|
@@ -14946,7 +15001,7 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14946
15001
|
module.exports = Receiver;
|
|
14947
15002
|
}));
|
|
14948
15003
|
//#endregion
|
|
14949
|
-
//#region ../../node_modules/.pnpm/ws@8.21.
|
|
15004
|
+
//#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/sender.js
|
|
14950
15005
|
var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14951
15006
|
const { Duplex: Duplex$3 } = __require("stream");
|
|
14952
15007
|
const { randomFillSync } = __require("crypto");
|
|
@@ -14957,7 +15012,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14957
15012
|
const { mask: applyMask, toBuffer } = require_buffer_util();
|
|
14958
15013
|
const kByteLength = Symbol("kByteLength");
|
|
14959
15014
|
const maskBuffer = Buffer.alloc(4);
|
|
14960
|
-
const RANDOM_POOL_SIZE =
|
|
15015
|
+
const RANDOM_POOL_SIZE = 8192;
|
|
14961
15016
|
let randomPool;
|
|
14962
15017
|
let randomPoolPointer = RANDOM_POOL_SIZE;
|
|
14963
15018
|
const DEFAULT = 0;
|
|
@@ -15032,12 +15087,13 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15032
15087
|
offset = 6;
|
|
15033
15088
|
}
|
|
15034
15089
|
let dataLength;
|
|
15035
|
-
if (typeof data === "string")
|
|
15036
|
-
|
|
15037
|
-
|
|
15038
|
-
|
|
15039
|
-
|
|
15040
|
-
|
|
15090
|
+
if (typeof data === "string") {
|
|
15091
|
+
if ((!options.mask || skipMasking) && options[kByteLength] !== void 0) dataLength = options[kByteLength];
|
|
15092
|
+
else {
|
|
15093
|
+
data = Buffer.from(data);
|
|
15094
|
+
dataLength = data.length;
|
|
15095
|
+
}
|
|
15096
|
+
} else {
|
|
15041
15097
|
dataLength = data.length;
|
|
15042
15098
|
merge = options.mask && options.readOnly && !skipMasking;
|
|
15043
15099
|
}
|
|
@@ -15149,15 +15205,16 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15149
15205
|
readOnly,
|
|
15150
15206
|
rsv1: false
|
|
15151
15207
|
};
|
|
15152
|
-
if (isBlob(data))
|
|
15153
|
-
this.
|
|
15154
|
-
|
|
15155
|
-
|
|
15156
|
-
|
|
15157
|
-
|
|
15158
|
-
|
|
15159
|
-
|
|
15160
|
-
|
|
15208
|
+
if (isBlob(data)) {
|
|
15209
|
+
if (this._state !== DEFAULT) this.enqueue([
|
|
15210
|
+
this.getBlobData,
|
|
15211
|
+
data,
|
|
15212
|
+
false,
|
|
15213
|
+
options,
|
|
15214
|
+
cb
|
|
15215
|
+
]);
|
|
15216
|
+
else this.getBlobData(data, false, options, cb);
|
|
15217
|
+
} else if (this._state !== DEFAULT) this.enqueue([
|
|
15161
15218
|
this.dispatch,
|
|
15162
15219
|
data,
|
|
15163
15220
|
false,
|
|
@@ -15199,15 +15256,16 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15199
15256
|
readOnly,
|
|
15200
15257
|
rsv1: false
|
|
15201
15258
|
};
|
|
15202
|
-
if (isBlob(data))
|
|
15203
|
-
this.
|
|
15204
|
-
|
|
15205
|
-
|
|
15206
|
-
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
|
|
15210
|
-
|
|
15259
|
+
if (isBlob(data)) {
|
|
15260
|
+
if (this._state !== DEFAULT) this.enqueue([
|
|
15261
|
+
this.getBlobData,
|
|
15262
|
+
data,
|
|
15263
|
+
false,
|
|
15264
|
+
options,
|
|
15265
|
+
cb
|
|
15266
|
+
]);
|
|
15267
|
+
else this.getBlobData(data, false, options, cb);
|
|
15268
|
+
} else if (this._state !== DEFAULT) this.enqueue([
|
|
15211
15269
|
this.dispatch,
|
|
15212
15270
|
data,
|
|
15213
15271
|
false,
|
|
@@ -15268,15 +15326,16 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15268
15326
|
readOnly,
|
|
15269
15327
|
rsv1
|
|
15270
15328
|
};
|
|
15271
|
-
if (isBlob(data))
|
|
15272
|
-
this.
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
|
|
15278
|
-
|
|
15279
|
-
|
|
15329
|
+
if (isBlob(data)) {
|
|
15330
|
+
if (this._state !== DEFAULT) this.enqueue([
|
|
15331
|
+
this.getBlobData,
|
|
15332
|
+
data,
|
|
15333
|
+
this._compress,
|
|
15334
|
+
opts,
|
|
15335
|
+
cb
|
|
15336
|
+
]);
|
|
15337
|
+
else this.getBlobData(data, this._compress, opts, cb);
|
|
15338
|
+
} else if (this._state !== DEFAULT) this.enqueue([
|
|
15280
15339
|
this.dispatch,
|
|
15281
15340
|
data,
|
|
15282
15341
|
this._compress,
|
|
@@ -15440,7 +15499,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15440
15499
|
}
|
|
15441
15500
|
}));
|
|
15442
15501
|
//#endregion
|
|
15443
|
-
//#region ../../node_modules/.pnpm/ws@8.21.
|
|
15502
|
+
//#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/event-target.js
|
|
15444
15503
|
var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15445
15504
|
const { kForOnEventAttribute, kListener } = require_constants();
|
|
15446
15505
|
const kCode = Symbol("kCode");
|
|
@@ -15671,7 +15730,7 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15671
15730
|
}
|
|
15672
15731
|
}));
|
|
15673
15732
|
//#endregion
|
|
15674
|
-
//#region ../../node_modules/.pnpm/ws@8.21.
|
|
15733
|
+
//#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/extension.js
|
|
15675
15734
|
var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15676
15735
|
const { tokenChars } = require_validation();
|
|
15677
15736
|
/**
|
|
@@ -15709,51 +15768,54 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15709
15768
|
let i = 0;
|
|
15710
15769
|
for (; i < header.length; i++) {
|
|
15711
15770
|
code = header.charCodeAt(i);
|
|
15712
|
-
if (extensionName === void 0)
|
|
15713
|
-
if (
|
|
15714
|
-
|
|
15715
|
-
if (
|
|
15716
|
-
|
|
15717
|
-
if (
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
|
|
15729
|
-
|
|
15730
|
-
|
|
15731
|
-
|
|
15732
|
-
if (
|
|
15733
|
-
|
|
15734
|
-
|
|
15735
|
-
push(
|
|
15736
|
-
|
|
15737
|
-
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
|
|
15741
|
-
|
|
15742
|
-
start
|
|
15743
|
-
|
|
15744
|
-
|
|
15771
|
+
if (extensionName === void 0) {
|
|
15772
|
+
if (end === -1 && tokenChars[code] === 1) {
|
|
15773
|
+
if (start === -1) start = i;
|
|
15774
|
+
} else if (i !== 0 && (code === 32 || code === 9)) {
|
|
15775
|
+
if (end === -1 && start !== -1) end = i;
|
|
15776
|
+
} else if (code === 59 || code === 44) {
|
|
15777
|
+
if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
15778
|
+
if (end === -1) end = i;
|
|
15779
|
+
const name = header.slice(start, end);
|
|
15780
|
+
if (code === 44) {
|
|
15781
|
+
push(offers, name, params);
|
|
15782
|
+
params = Object.create(null);
|
|
15783
|
+
} else extensionName = name;
|
|
15784
|
+
start = end = -1;
|
|
15785
|
+
} else throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
15786
|
+
} else if (paramName === void 0) {
|
|
15787
|
+
if (end === -1 && tokenChars[code] === 1) {
|
|
15788
|
+
if (start === -1) start = i;
|
|
15789
|
+
} else if (code === 32 || code === 9) {
|
|
15790
|
+
if (end === -1 && start !== -1) end = i;
|
|
15791
|
+
} else if (code === 59 || code === 44) {
|
|
15792
|
+
if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
15793
|
+
if (end === -1) end = i;
|
|
15794
|
+
push(params, header.slice(start, end), true);
|
|
15795
|
+
if (code === 44) {
|
|
15796
|
+
push(offers, extensionName, params);
|
|
15797
|
+
params = Object.create(null);
|
|
15798
|
+
extensionName = void 0;
|
|
15799
|
+
}
|
|
15800
|
+
start = end = -1;
|
|
15801
|
+
} else if (code === 61 && start !== -1 && end === -1) {
|
|
15802
|
+
paramName = header.slice(start, i);
|
|
15803
|
+
start = end = -1;
|
|
15804
|
+
} else throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
15805
|
+
} else if (isEscaping) {
|
|
15745
15806
|
if (tokenChars[code] !== 1) throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
15746
15807
|
if (start === -1) start = i;
|
|
15747
15808
|
else if (!mustUnescape) mustUnescape = true;
|
|
15748
15809
|
isEscaping = false;
|
|
15749
|
-
} else if (inQuotes)
|
|
15750
|
-
if (
|
|
15751
|
-
|
|
15752
|
-
|
|
15753
|
-
|
|
15754
|
-
|
|
15755
|
-
|
|
15756
|
-
|
|
15810
|
+
} else if (inQuotes) {
|
|
15811
|
+
if (tokenChars[code] === 1) {
|
|
15812
|
+
if (start === -1) start = i;
|
|
15813
|
+
} else if (code === 34 && start !== -1) {
|
|
15814
|
+
inQuotes = false;
|
|
15815
|
+
end = i;
|
|
15816
|
+
} else if (code === 92) isEscaping = true;
|
|
15817
|
+
else throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
15818
|
+
} else if (code === 34 && header.charCodeAt(i - 1) === 61) inQuotes = true;
|
|
15757
15819
|
else if (end === -1 && tokenChars[code] === 1) {
|
|
15758
15820
|
if (start === -1) start = i;
|
|
15759
15821
|
} else if (start !== -1 && (code === 32 || code === 9)) {
|
|
@@ -15814,7 +15876,7 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15814
15876
|
};
|
|
15815
15877
|
}));
|
|
15816
15878
|
//#endregion
|
|
15817
|
-
//#region ../../node_modules/.pnpm/ws@8.21.
|
|
15879
|
+
//#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket.js
|
|
15818
15880
|
var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15819
15881
|
const EventEmitter$2 = __require("events");
|
|
15820
15882
|
const https$3 = __require("https");
|
|
@@ -15875,10 +15937,12 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15875
15937
|
this._isServer = false;
|
|
15876
15938
|
this._redirects = 0;
|
|
15877
15939
|
if (protocols === void 0) protocols = [];
|
|
15878
|
-
else if (!Array.isArray(protocols))
|
|
15879
|
-
|
|
15880
|
-
|
|
15881
|
-
|
|
15940
|
+
else if (!Array.isArray(protocols)) {
|
|
15941
|
+
if (typeof protocols === "object" && protocols !== null) {
|
|
15942
|
+
options = protocols;
|
|
15943
|
+
protocols = [];
|
|
15944
|
+
} else protocols = [protocols];
|
|
15945
|
+
}
|
|
15882
15946
|
initAsClient(this, address, protocols, options);
|
|
15883
15947
|
} else {
|
|
15884
15948
|
this._autoPong = options.autoPong;
|
|
@@ -16343,9 +16407,9 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
16343
16407
|
autoPong: true,
|
|
16344
16408
|
closeTimeout: CLOSE_TIMEOUT,
|
|
16345
16409
|
protocolVersion: protocolVersions[1],
|
|
16346
|
-
maxBufferedChunks:
|
|
16347
|
-
maxFragments:
|
|
16348
|
-
maxPayload:
|
|
16410
|
+
maxBufferedChunks: 262144,
|
|
16411
|
+
maxFragments: 16384,
|
|
16412
|
+
maxPayload: 104857600,
|
|
16349
16413
|
skipUTF8Validation: false,
|
|
16350
16414
|
perMessageDeflate: true,
|
|
16351
16415
|
followRedirects: false,
|
|
@@ -16420,8 +16484,10 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
16420
16484
|
}
|
|
16421
16485
|
opts.headers["Sec-WebSocket-Protocol"] = protocols.join(",");
|
|
16422
16486
|
}
|
|
16423
|
-
if (opts.origin)
|
|
16424
|
-
|
|
16487
|
+
if (opts.origin) {
|
|
16488
|
+
if (opts.protocolVersion < 13) opts.headers["Sec-WebSocket-Origin"] = opts.origin;
|
|
16489
|
+
else opts.headers.Origin = opts.origin;
|
|
16490
|
+
}
|
|
16425
16491
|
if (parsedUrl.username || parsedUrl.password) opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
|
|
16426
16492
|
if (isIpcUrl) {
|
|
16427
16493
|
const parts = opts.path.split(":");
|
|
@@ -16803,7 +16869,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
16803
16869
|
}
|
|
16804
16870
|
}));
|
|
16805
16871
|
//#endregion
|
|
16806
|
-
//#region ../../node_modules/.pnpm/ws@8.21.
|
|
16872
|
+
//#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/stream.js
|
|
16807
16873
|
var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16808
16874
|
require_websocket();
|
|
16809
16875
|
const { Duplex: Duplex$1 } = __require("stream");
|
|
@@ -16919,7 +16985,7 @@ var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
16919
16985
|
module.exports = createWebSocketStream;
|
|
16920
16986
|
}));
|
|
16921
16987
|
//#endregion
|
|
16922
|
-
//#region ../../node_modules/.pnpm/ws@8.21.
|
|
16988
|
+
//#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/subprotocol.js
|
|
16923
16989
|
var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16924
16990
|
const { tokenChars } = require_validation();
|
|
16925
16991
|
/**
|
|
@@ -16958,7 +17024,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
16958
17024
|
module.exports = { parse };
|
|
16959
17025
|
}));
|
|
16960
17026
|
//#endregion
|
|
16961
|
-
//#region ../../node_modules/.pnpm/ws@8.21.
|
|
17027
|
+
//#region ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket-server.js
|
|
16962
17028
|
var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
16963
17029
|
const EventEmitter$1 = __require("events");
|
|
16964
17030
|
const http$4 = __require("http");
|
|
@@ -17022,9 +17088,9 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
17022
17088
|
options = {
|
|
17023
17089
|
allowSynchronousEvents: true,
|
|
17024
17090
|
autoPong: true,
|
|
17025
|
-
maxBufferedChunks:
|
|
17026
|
-
maxFragments:
|
|
17027
|
-
maxPayload:
|
|
17091
|
+
maxBufferedChunks: 262144,
|
|
17092
|
+
maxFragments: 16384,
|
|
17093
|
+
maxPayload: 104857600,
|
|
17028
17094
|
skipUTF8Validation: false,
|
|
17029
17095
|
perMessageDeflate: false,
|
|
17030
17096
|
handleProtocols: null,
|
|
@@ -17107,9 +17173,10 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
17107
17173
|
this._removeListeners();
|
|
17108
17174
|
this._removeListeners = this._server = null;
|
|
17109
17175
|
}
|
|
17110
|
-
if (this.clients)
|
|
17111
|
-
|
|
17112
|
-
|
|
17176
|
+
if (this.clients) {
|
|
17177
|
+
if (!this.clients.size) process.nextTick(emitClose, this);
|
|
17178
|
+
else this._shouldEmitClose = true;
|
|
17179
|
+
} else process.nextTick(emitClose, this);
|
|
17113
17180
|
} else {
|
|
17114
17181
|
const server = this._server;
|
|
17115
17182
|
this._removeListeners();
|
|
@@ -17995,7 +18062,7 @@ var require_follow_redirects = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
17995
18062
|
function wrap(protocols) {
|
|
17996
18063
|
var exports$1 = {
|
|
17997
18064
|
maxRedirects: 21,
|
|
17998
|
-
maxBodyLength:
|
|
18065
|
+
maxBodyLength: 10485760
|
|
17999
18066
|
};
|
|
18000
18067
|
var nativeProtocols = {};
|
|
18001
18068
|
Object.keys(protocols).forEach(function(scheme) {
|
|
@@ -18239,9 +18306,10 @@ var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18239
18306
|
let retSegs = "";
|
|
18240
18307
|
for (const seg of args) {
|
|
18241
18308
|
if (!seg) continue;
|
|
18242
|
-
if (retSegs.endsWith("/"))
|
|
18243
|
-
|
|
18244
|
-
|
|
18309
|
+
if (retSegs.endsWith("/")) {
|
|
18310
|
+
if (seg.startsWith("/")) retSegs += seg.slice(1);
|
|
18311
|
+
else retSegs += seg;
|
|
18312
|
+
} else if (seg.startsWith("/")) retSegs += seg;
|
|
18245
18313
|
else retSegs += "/" + seg;
|
|
18246
18314
|
}
|
|
18247
18315
|
return queryParamRaw ? retSegs + "?" + queryParamRaw : retSegs;
|
|
@@ -19282,9 +19350,10 @@ var require_convert_source_map = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19282
19350
|
return /(?:\/\/[@#][ \t]+?sourceMappingURL=([^\s'"`]+?)[ \t]*?$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*?(?:\*\/){1}[ \t]*?$)/gm;
|
|
19283
19351
|
} });
|
|
19284
19352
|
var decodeBase64;
|
|
19285
|
-
if (typeof Buffer !== "undefined")
|
|
19286
|
-
|
|
19287
|
-
|
|
19353
|
+
if (typeof Buffer !== "undefined") {
|
|
19354
|
+
if (typeof Buffer.from === "function") decodeBase64 = decodeBase64WithBufferFrom;
|
|
19355
|
+
else decodeBase64 = decodeBase64WithNewBuffer;
|
|
19356
|
+
} else decodeBase64 = decodeBase64WithAtob;
|
|
19288
19357
|
function decodeBase64WithBufferFrom(base64) {
|
|
19289
19358
|
return Buffer.from(base64, "base64").toString();
|
|
19290
19359
|
}
|
|
@@ -19323,9 +19392,10 @@ var require_convert_source_map = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19323
19392
|
Converter.prototype.toJSON = function(space) {
|
|
19324
19393
|
return JSON.stringify(this.sourcemap, null, space);
|
|
19325
19394
|
};
|
|
19326
|
-
if (typeof Buffer !== "undefined")
|
|
19327
|
-
|
|
19328
|
-
|
|
19395
|
+
if (typeof Buffer !== "undefined") {
|
|
19396
|
+
if (typeof Buffer.from === "function") Converter.prototype.toBase64 = encodeBase64WithBufferFrom;
|
|
19397
|
+
else Converter.prototype.toBase64 = encodeBase64WithNewBuffer;
|
|
19398
|
+
} else Converter.prototype.toBase64 = encodeBase64WithBtoa;
|
|
19329
19399
|
function encodeBase64WithBufferFrom() {
|
|
19330
19400
|
var json = this.toJSON();
|
|
19331
19401
|
return Buffer.from(json, "utf8").toString("base64");
|
|
@@ -20418,13 +20488,20 @@ function isFileInTargetPath(targetPath, filePath) {
|
|
|
20418
20488
|
return isSameFilePath(targetPath, filePath) || isParentDirectory(targetPath, filePath);
|
|
20419
20489
|
}
|
|
20420
20490
|
const windowsDriveRE = /^[A-Z]:/i;
|
|
20491
|
+
const windowsShortNameSegmentRE = /^[^~.]{1,6}~\d+(?:\.[^~.]{0,3})?$/;
|
|
20492
|
+
/**
|
|
20493
|
+
* Warning: parameters are not validated, only works with normalized absolute paths
|
|
20494
|
+
*/
|
|
20495
|
+
function looksLikeWindowsShortNamePath(filePath) {
|
|
20496
|
+
return filePath.includes("~") && filePath.split("/").some((segment) => windowsShortNameSegmentRE.test(segment));
|
|
20497
|
+
}
|
|
20421
20498
|
/**
|
|
20422
20499
|
* Warning: parameters are not validated, only works with normalized absolute paths
|
|
20423
20500
|
*/
|
|
20424
20501
|
function isFileLoadingAllowed(config, filePath) {
|
|
20425
20502
|
const { fs } = config.server;
|
|
20426
20503
|
if (!fs.strict) return true;
|
|
20427
|
-
if (isWindows && filePath
|
|
20504
|
+
if (isWindows && looksLikeWindowsShortNamePath(filePath)) return false;
|
|
20428
20505
|
if ((isWindows && windowsDriveRE.test(filePath) ? filePath.slice(2) : filePath).includes(":")) return false;
|
|
20429
20506
|
const filePathWithoutTrailingSlash = filePath.endsWith("/") ? filePath.slice(0, -1) : filePath;
|
|
20430
20507
|
if (config.fsDenyGlob(filePathWithoutTrailingSlash)) return false;
|
|
@@ -20703,402 +20780,404 @@ function getModuleTypeFromId(id) {
|
|
|
20703
20780
|
}
|
|
20704
20781
|
}
|
|
20705
20782
|
//#endregion
|
|
20706
|
-
//#region ../../node_modules/.pnpm/
|
|
20707
|
-
var
|
|
20708
|
-
|
|
20709
|
-
|
|
20710
|
-
|
|
20711
|
-
|
|
20712
|
-
|
|
20713
|
-
|
|
20714
|
-
|
|
20715
|
-
|
|
20716
|
-
|
|
20717
|
-
|
|
20718
|
-
|
|
20719
|
-
|
|
20720
|
-
|
|
20721
|
-
|
|
20722
|
-
|
|
20723
|
-
|
|
20724
|
-
|
|
20725
|
-
|
|
20726
|
-
|
|
20727
|
-
|
|
20728
|
-
|
|
20729
|
-
|
|
20730
|
-
|
|
20731
|
-
|
|
20732
|
-
|
|
20733
|
-
|
|
20734
|
-
|
|
20735
|
-
|
|
20736
|
-
|
|
20737
|
-
|
|
20738
|
-
|
|
20739
|
-
|
|
20740
|
-
|
|
20741
|
-
|
|
20742
|
-
|
|
20743
|
-
|
|
20744
|
-
|
|
20745
|
-
|
|
20746
|
-
|
|
20747
|
-
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20754
|
-
|
|
20755
|
-
|
|
20756
|
-
|
|
20757
|
-
|
|
20758
|
-
|
|
20759
|
-
|
|
20760
|
-
|
|
20761
|
-
|
|
20762
|
-
|
|
20763
|
-
|
|
20764
|
-
|
|
20765
|
-
|
|
20766
|
-
|
|
20767
|
-
|
|
20768
|
-
|
|
20769
|
-
|
|
20770
|
-
|
|
20771
|
-
|
|
20772
|
-
|
|
20773
|
-
|
|
20774
|
-
|
|
20775
|
-
|
|
20776
|
-
|
|
20777
|
-
|
|
20778
|
-
|
|
20779
|
-
|
|
20780
|
-
|
|
20781
|
-
|
|
20782
|
-
}
|
|
20783
|
+
//#region ../../node_modules/.pnpm/js-tokens@10.0.0/node_modules/js-tokens/index.js
|
|
20784
|
+
var HashbangComment;
|
|
20785
|
+
var Identifier;
|
|
20786
|
+
var JSXIdentifier;
|
|
20787
|
+
var JSXPunctuator;
|
|
20788
|
+
var JSXString;
|
|
20789
|
+
var JSXText;
|
|
20790
|
+
var KeywordsWithExpressionAfter;
|
|
20791
|
+
var KeywordsWithNoLineTerminatorAfter;
|
|
20792
|
+
var LineTerminatorSequence;
|
|
20793
|
+
var MultiLineComment;
|
|
20794
|
+
var Newline;
|
|
20795
|
+
var NumericLiteral;
|
|
20796
|
+
var Punctuator;
|
|
20797
|
+
var RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:[^\]\\\n\r\u2028\u2029]+|\\.)*\]?|[^\/[\\\n\r\u2028\u2029]+|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/uy;
|
|
20798
|
+
var SingleLineComment;
|
|
20799
|
+
var StringLiteral;
|
|
20800
|
+
var Template;
|
|
20801
|
+
var TokensNotPrecedingObjectLiteral;
|
|
20802
|
+
var TokensPrecedingExpression;
|
|
20803
|
+
var WhiteSpace;
|
|
20804
|
+
var jsTokens;
|
|
20805
|
+
Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y;
|
|
20806
|
+
Identifier = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]+|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/uy;
|
|
20807
|
+
StringLiteral = /(['"])(?:[^'"\\\n\r]+|(?!\1)['"]|\\(?:\r\n|[^]))*(\1)?/y;
|
|
20808
|
+
NumericLiteral = /(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y;
|
|
20809
|
+
Template = /[`}](?:[^`\\$]+|\\[^]|\$(?!\{))*(`|\$\{)?/y;
|
|
20810
|
+
WhiteSpace = /[\t\v\f\ufeff\p{Zs}]+/uy;
|
|
20811
|
+
LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y;
|
|
20812
|
+
MultiLineComment = /\/\*(?:[^*]+|\*(?!\/))*(\*\/)?/y;
|
|
20813
|
+
SingleLineComment = /\/\/.*/y;
|
|
20814
|
+
HashbangComment = /^#!.*/;
|
|
20815
|
+
JSXPunctuator = /[<>.:={}]|\/(?![\/*])/y;
|
|
20816
|
+
JSXIdentifier = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/uy;
|
|
20817
|
+
JSXString = /(['"])(?:[^'"]+|(?!\1)['"])*(\1)?/y;
|
|
20818
|
+
JSXText = /[^<>{}]+/y;
|
|
20819
|
+
TokensPrecedingExpression = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/;
|
|
20820
|
+
TokensNotPrecedingObjectLiteral = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/;
|
|
20821
|
+
KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
|
|
20822
|
+
KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
|
|
20823
|
+
Newline = RegExp(LineTerminatorSequence.source);
|
|
20824
|
+
jsTokens = function* (input, { jsx = false } = {}) {
|
|
20825
|
+
var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
|
|
20826
|
+
({length} = input);
|
|
20827
|
+
lastIndex = 0;
|
|
20828
|
+
lastSignificantToken = "";
|
|
20829
|
+
stack = [{ tag: "JS" }];
|
|
20830
|
+
braces = [];
|
|
20831
|
+
parenNesting = 0;
|
|
20832
|
+
postfixIncDec = false;
|
|
20833
|
+
if (match = HashbangComment.exec(input)) {
|
|
20834
|
+
yield {
|
|
20835
|
+
type: "HashbangComment",
|
|
20836
|
+
value: match[0]
|
|
20837
|
+
};
|
|
20838
|
+
lastIndex = match[0].length;
|
|
20839
|
+
}
|
|
20840
|
+
while (lastIndex < length) {
|
|
20841
|
+
mode = stack[stack.length - 1];
|
|
20842
|
+
switch (mode.tag) {
|
|
20843
|
+
case "JS":
|
|
20844
|
+
case "JSNonExpressionParen":
|
|
20845
|
+
case "InterpolationInTemplate":
|
|
20846
|
+
case "InterpolationInJSX":
|
|
20847
|
+
if (input[lastIndex] === "/" && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
20848
|
+
RegularExpressionLiteral.lastIndex = lastIndex;
|
|
20849
|
+
if (match = RegularExpressionLiteral.exec(input)) {
|
|
20850
|
+
lastIndex = RegularExpressionLiteral.lastIndex;
|
|
20851
|
+
lastSignificantToken = match[0];
|
|
20852
|
+
postfixIncDec = true;
|
|
20853
|
+
yield {
|
|
20854
|
+
type: "RegularExpressionLiteral",
|
|
20855
|
+
value: match[0],
|
|
20856
|
+
closed: match[1] !== void 0 && match[1] !== "\\"
|
|
20857
|
+
};
|
|
20858
|
+
continue;
|
|
20783
20859
|
}
|
|
20784
|
-
|
|
20785
|
-
|
|
20786
|
-
|
|
20787
|
-
|
|
20788
|
-
|
|
20789
|
-
|
|
20790
|
-
|
|
20791
|
-
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
|
|
20795
|
-
|
|
20796
|
-
|
|
20797
|
-
|
|
20798
|
-
|
|
20799
|
-
|
|
20800
|
-
|
|
20801
|
-
|
|
20802
|
-
|
|
20803
|
-
|
|
20804
|
-
|
|
20805
|
-
}
|
|
20806
|
-
break;
|
|
20807
|
-
case "{":
|
|
20808
|
-
Punctuator.lastIndex = 0;
|
|
20809
|
-
isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken));
|
|
20810
|
-
braces.push(isExpression);
|
|
20860
|
+
}
|
|
20861
|
+
Punctuator.lastIndex = lastIndex;
|
|
20862
|
+
if (match = Punctuator.exec(input)) {
|
|
20863
|
+
punctuator = match[0];
|
|
20864
|
+
nextLastIndex = Punctuator.lastIndex;
|
|
20865
|
+
nextLastSignificantToken = punctuator;
|
|
20866
|
+
switch (punctuator) {
|
|
20867
|
+
case "(":
|
|
20868
|
+
if (lastSignificantToken === "?NonExpressionParenKeyword") stack.push({
|
|
20869
|
+
tag: "JSNonExpressionParen",
|
|
20870
|
+
nesting: parenNesting
|
|
20871
|
+
});
|
|
20872
|
+
parenNesting++;
|
|
20873
|
+
postfixIncDec = false;
|
|
20874
|
+
break;
|
|
20875
|
+
case ")":
|
|
20876
|
+
parenNesting--;
|
|
20877
|
+
postfixIncDec = true;
|
|
20878
|
+
if (mode.tag === "JSNonExpressionParen" && parenNesting === mode.nesting) {
|
|
20879
|
+
stack.pop();
|
|
20880
|
+
nextLastSignificantToken = "?NonExpressionParenEnd";
|
|
20811
20881
|
postfixIncDec = false;
|
|
20812
|
-
|
|
20813
|
-
|
|
20814
|
-
|
|
20815
|
-
|
|
20816
|
-
|
|
20817
|
-
|
|
20818
|
-
|
|
20819
|
-
|
|
20820
|
-
|
|
20821
|
-
|
|
20822
|
-
|
|
20823
|
-
|
|
20824
|
-
|
|
20825
|
-
|
|
20826
|
-
|
|
20827
|
-
|
|
20828
|
-
|
|
20829
|
-
|
|
20830
|
-
|
|
20831
|
-
|
|
20832
|
-
|
|
20833
|
-
|
|
20834
|
-
|
|
20835
|
-
|
|
20836
|
-
|
|
20837
|
-
|
|
20882
|
+
}
|
|
20883
|
+
break;
|
|
20884
|
+
case "{":
|
|
20885
|
+
Punctuator.lastIndex = 0;
|
|
20886
|
+
isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken));
|
|
20887
|
+
braces.push(isExpression);
|
|
20888
|
+
postfixIncDec = false;
|
|
20889
|
+
break;
|
|
20890
|
+
case "}":
|
|
20891
|
+
switch (mode.tag) {
|
|
20892
|
+
case "InterpolationInTemplate":
|
|
20893
|
+
if (braces.length === mode.nesting) {
|
|
20894
|
+
Template.lastIndex = lastIndex;
|
|
20895
|
+
match = Template.exec(input);
|
|
20896
|
+
lastIndex = Template.lastIndex;
|
|
20897
|
+
lastSignificantToken = match[0];
|
|
20898
|
+
if (match[1] === "${") {
|
|
20899
|
+
lastSignificantToken = "?InterpolationInTemplate";
|
|
20900
|
+
postfixIncDec = false;
|
|
20901
|
+
yield {
|
|
20902
|
+
type: "TemplateMiddle",
|
|
20903
|
+
value: match[0]
|
|
20904
|
+
};
|
|
20905
|
+
} else {
|
|
20906
|
+
stack.pop();
|
|
20907
|
+
postfixIncDec = true;
|
|
20908
|
+
yield {
|
|
20909
|
+
type: "TemplateTail",
|
|
20910
|
+
value: match[0],
|
|
20911
|
+
closed: match[1] === "`"
|
|
20912
|
+
};
|
|
20838
20913
|
}
|
|
20839
|
-
break;
|
|
20840
|
-
case "InterpolationInJSX": if (braces.length === mode.nesting) {
|
|
20841
|
-
stack.pop();
|
|
20842
|
-
lastIndex += 1;
|
|
20843
|
-
lastSignificantToken = "}";
|
|
20844
|
-
yield {
|
|
20845
|
-
type: "JSXPunctuator",
|
|
20846
|
-
value: "}"
|
|
20847
|
-
};
|
|
20848
20914
|
continue;
|
|
20849
20915
|
}
|
|
20850
|
-
|
|
20851
|
-
|
|
20852
|
-
|
|
20853
|
-
break;
|
|
20854
|
-
case "]":
|
|
20855
|
-
postfixIncDec = true;
|
|
20856
|
-
break;
|
|
20857
|
-
case "++":
|
|
20858
|
-
case "--":
|
|
20859
|
-
nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
|
|
20860
|
-
break;
|
|
20861
|
-
case "<":
|
|
20862
|
-
if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
20863
|
-
stack.push({ tag: "JSXTag" });
|
|
20916
|
+
break;
|
|
20917
|
+
case "InterpolationInJSX": if (braces.length === mode.nesting) {
|
|
20918
|
+
stack.pop();
|
|
20864
20919
|
lastIndex += 1;
|
|
20865
|
-
lastSignificantToken = "
|
|
20920
|
+
lastSignificantToken = "}";
|
|
20866
20921
|
yield {
|
|
20867
20922
|
type: "JSXPunctuator",
|
|
20868
|
-
value:
|
|
20923
|
+
value: "}"
|
|
20869
20924
|
};
|
|
20870
20925
|
continue;
|
|
20871
20926
|
}
|
|
20872
|
-
|
|
20873
|
-
|
|
20874
|
-
|
|
20875
|
-
|
|
20876
|
-
|
|
20877
|
-
|
|
20878
|
-
|
|
20879
|
-
|
|
20880
|
-
|
|
20881
|
-
|
|
20882
|
-
|
|
20927
|
+
}
|
|
20928
|
+
postfixIncDec = braces.pop();
|
|
20929
|
+
nextLastSignificantToken = postfixIncDec ? "?ExpressionBraceEnd" : "}";
|
|
20930
|
+
break;
|
|
20931
|
+
case "]":
|
|
20932
|
+
postfixIncDec = true;
|
|
20933
|
+
break;
|
|
20934
|
+
case "++":
|
|
20935
|
+
case "--":
|
|
20936
|
+
nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
|
|
20937
|
+
break;
|
|
20938
|
+
case "<":
|
|
20939
|
+
if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
20940
|
+
stack.push({ tag: "JSXTag" });
|
|
20941
|
+
lastIndex += 1;
|
|
20942
|
+
lastSignificantToken = "<";
|
|
20943
|
+
yield {
|
|
20944
|
+
type: "JSXPunctuator",
|
|
20945
|
+
value: punctuator
|
|
20946
|
+
};
|
|
20947
|
+
continue;
|
|
20948
|
+
}
|
|
20949
|
+
postfixIncDec = false;
|
|
20950
|
+
break;
|
|
20951
|
+
default: postfixIncDec = false;
|
|
20883
20952
|
}
|
|
20884
|
-
|
|
20885
|
-
|
|
20886
|
-
|
|
20887
|
-
|
|
20888
|
-
|
|
20889
|
-
|
|
20890
|
-
|
|
20891
|
-
|
|
20892
|
-
|
|
20893
|
-
|
|
20894
|
-
|
|
20895
|
-
|
|
20953
|
+
lastIndex = nextLastIndex;
|
|
20954
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
20955
|
+
yield {
|
|
20956
|
+
type: "Punctuator",
|
|
20957
|
+
value: punctuator
|
|
20958
|
+
};
|
|
20959
|
+
continue;
|
|
20960
|
+
}
|
|
20961
|
+
Identifier.lastIndex = lastIndex;
|
|
20962
|
+
if (match = Identifier.exec(input)) {
|
|
20963
|
+
lastIndex = Identifier.lastIndex;
|
|
20964
|
+
nextLastSignificantToken = match[0];
|
|
20965
|
+
switch (match[0]) {
|
|
20966
|
+
case "for":
|
|
20967
|
+
case "if":
|
|
20968
|
+
case "while":
|
|
20969
|
+
case "with": if (lastSignificantToken !== "." && lastSignificantToken !== "?.") nextLastSignificantToken = "?NonExpressionParenKeyword";
|
|
20970
|
+
}
|
|
20971
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
20972
|
+
postfixIncDec = !KeywordsWithExpressionAfter.test(match[0]);
|
|
20973
|
+
yield {
|
|
20974
|
+
type: match[1] === "#" ? "PrivateIdentifier" : "IdentifierName",
|
|
20975
|
+
value: match[0]
|
|
20976
|
+
};
|
|
20977
|
+
continue;
|
|
20978
|
+
}
|
|
20979
|
+
StringLiteral.lastIndex = lastIndex;
|
|
20980
|
+
if (match = StringLiteral.exec(input)) {
|
|
20981
|
+
lastIndex = StringLiteral.lastIndex;
|
|
20982
|
+
lastSignificantToken = match[0];
|
|
20983
|
+
postfixIncDec = true;
|
|
20984
|
+
yield {
|
|
20985
|
+
type: "StringLiteral",
|
|
20986
|
+
value: match[0],
|
|
20987
|
+
closed: match[2] !== void 0
|
|
20988
|
+
};
|
|
20989
|
+
continue;
|
|
20990
|
+
}
|
|
20991
|
+
NumericLiteral.lastIndex = lastIndex;
|
|
20992
|
+
if (match = NumericLiteral.exec(input)) {
|
|
20993
|
+
lastIndex = NumericLiteral.lastIndex;
|
|
20994
|
+
lastSignificantToken = match[0];
|
|
20995
|
+
postfixIncDec = true;
|
|
20996
|
+
yield {
|
|
20997
|
+
type: "NumericLiteral",
|
|
20998
|
+
value: match[0]
|
|
20999
|
+
};
|
|
21000
|
+
continue;
|
|
21001
|
+
}
|
|
21002
|
+
Template.lastIndex = lastIndex;
|
|
21003
|
+
if (match = Template.exec(input)) {
|
|
21004
|
+
lastIndex = Template.lastIndex;
|
|
21005
|
+
lastSignificantToken = match[0];
|
|
21006
|
+
if (match[1] === "${") {
|
|
21007
|
+
lastSignificantToken = "?InterpolationInTemplate";
|
|
21008
|
+
stack.push({
|
|
21009
|
+
tag: "InterpolationInTemplate",
|
|
21010
|
+
nesting: braces.length
|
|
21011
|
+
});
|
|
21012
|
+
postfixIncDec = false;
|
|
20896
21013
|
yield {
|
|
20897
|
-
type:
|
|
21014
|
+
type: "TemplateHead",
|
|
20898
21015
|
value: match[0]
|
|
20899
21016
|
};
|
|
20900
|
-
|
|
20901
|
-
}
|
|
20902
|
-
StringLiteral.lastIndex = lastIndex;
|
|
20903
|
-
if (match = StringLiteral.exec(input)) {
|
|
20904
|
-
lastIndex = StringLiteral.lastIndex;
|
|
20905
|
-
lastSignificantToken = match[0];
|
|
21017
|
+
} else {
|
|
20906
21018
|
postfixIncDec = true;
|
|
20907
21019
|
yield {
|
|
20908
|
-
type: "
|
|
21020
|
+
type: "NoSubstitutionTemplate",
|
|
20909
21021
|
value: match[0],
|
|
20910
|
-
closed: match[
|
|
20911
|
-
};
|
|
20912
|
-
continue;
|
|
20913
|
-
}
|
|
20914
|
-
NumericLiteral.lastIndex = lastIndex;
|
|
20915
|
-
if (match = NumericLiteral.exec(input)) {
|
|
20916
|
-
lastIndex = NumericLiteral.lastIndex;
|
|
20917
|
-
lastSignificantToken = match[0];
|
|
20918
|
-
postfixIncDec = true;
|
|
20919
|
-
yield {
|
|
20920
|
-
type: "NumericLiteral",
|
|
20921
|
-
value: match[0]
|
|
21022
|
+
closed: match[1] === "`"
|
|
20922
21023
|
};
|
|
20923
|
-
continue;
|
|
20924
21024
|
}
|
|
20925
|
-
|
|
20926
|
-
|
|
20927
|
-
|
|
20928
|
-
|
|
20929
|
-
|
|
20930
|
-
|
|
21025
|
+
continue;
|
|
21026
|
+
}
|
|
21027
|
+
break;
|
|
21028
|
+
case "JSXTag":
|
|
21029
|
+
case "JSXTagEnd":
|
|
21030
|
+
JSXPunctuator.lastIndex = lastIndex;
|
|
21031
|
+
if (match = JSXPunctuator.exec(input)) {
|
|
21032
|
+
lastIndex = JSXPunctuator.lastIndex;
|
|
21033
|
+
nextLastSignificantToken = match[0];
|
|
21034
|
+
switch (match[0]) {
|
|
21035
|
+
case "<":
|
|
21036
|
+
stack.push({ tag: "JSXTag" });
|
|
21037
|
+
break;
|
|
21038
|
+
case ">":
|
|
21039
|
+
stack.pop();
|
|
21040
|
+
if (lastSignificantToken === "/" || mode.tag === "JSXTagEnd") {
|
|
21041
|
+
nextLastSignificantToken = "?JSX";
|
|
21042
|
+
postfixIncDec = true;
|
|
21043
|
+
} else stack.push({ tag: "JSXChildren" });
|
|
21044
|
+
break;
|
|
21045
|
+
case "{":
|
|
20931
21046
|
stack.push({
|
|
20932
|
-
tag: "
|
|
21047
|
+
tag: "InterpolationInJSX",
|
|
20933
21048
|
nesting: braces.length
|
|
20934
21049
|
});
|
|
21050
|
+
nextLastSignificantToken = "?InterpolationInJSX";
|
|
20935
21051
|
postfixIncDec = false;
|
|
20936
|
-
|
|
20937
|
-
|
|
20938
|
-
|
|
20939
|
-
|
|
20940
|
-
|
|
20941
|
-
postfixIncDec = true;
|
|
20942
|
-
yield {
|
|
20943
|
-
type: "NoSubstitutionTemplate",
|
|
20944
|
-
value: match[0],
|
|
20945
|
-
closed: match[1] === "`"
|
|
20946
|
-
};
|
|
21052
|
+
break;
|
|
21053
|
+
case "/": if (lastSignificantToken === "<") {
|
|
21054
|
+
stack.pop();
|
|
21055
|
+
if (stack[stack.length - 1].tag === "JSXChildren") stack.pop();
|
|
21056
|
+
stack.push({ tag: "JSXTagEnd" });
|
|
20947
21057
|
}
|
|
20948
|
-
continue;
|
|
20949
21058
|
}
|
|
20950
|
-
|
|
20951
|
-
|
|
20952
|
-
|
|
20953
|
-
|
|
20954
|
-
|
|
20955
|
-
|
|
20956
|
-
|
|
20957
|
-
|
|
20958
|
-
|
|
20959
|
-
|
|
20960
|
-
|
|
20961
|
-
|
|
20962
|
-
|
|
20963
|
-
|
|
20964
|
-
|
|
20965
|
-
|
|
20966
|
-
|
|
20967
|
-
|
|
20968
|
-
|
|
20969
|
-
|
|
20970
|
-
|
|
20971
|
-
|
|
20972
|
-
|
|
20973
|
-
|
|
20974
|
-
|
|
20975
|
-
|
|
20976
|
-
|
|
20977
|
-
|
|
20978
|
-
|
|
20979
|
-
|
|
20980
|
-
|
|
20981
|
-
|
|
20982
|
-
|
|
21059
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
21060
|
+
yield {
|
|
21061
|
+
type: "JSXPunctuator",
|
|
21062
|
+
value: match[0]
|
|
21063
|
+
};
|
|
21064
|
+
continue;
|
|
21065
|
+
}
|
|
21066
|
+
JSXIdentifier.lastIndex = lastIndex;
|
|
21067
|
+
if (match = JSXIdentifier.exec(input)) {
|
|
21068
|
+
lastIndex = JSXIdentifier.lastIndex;
|
|
21069
|
+
lastSignificantToken = match[0];
|
|
21070
|
+
yield {
|
|
21071
|
+
type: "JSXIdentifier",
|
|
21072
|
+
value: match[0]
|
|
21073
|
+
};
|
|
21074
|
+
continue;
|
|
21075
|
+
}
|
|
21076
|
+
JSXString.lastIndex = lastIndex;
|
|
21077
|
+
if (match = JSXString.exec(input)) {
|
|
21078
|
+
lastIndex = JSXString.lastIndex;
|
|
21079
|
+
lastSignificantToken = match[0];
|
|
21080
|
+
yield {
|
|
21081
|
+
type: "JSXString",
|
|
21082
|
+
value: match[0],
|
|
21083
|
+
closed: match[2] !== void 0
|
|
21084
|
+
};
|
|
21085
|
+
continue;
|
|
21086
|
+
}
|
|
21087
|
+
break;
|
|
21088
|
+
case "JSXChildren":
|
|
21089
|
+
JSXText.lastIndex = lastIndex;
|
|
21090
|
+
if (match = JSXText.exec(input)) {
|
|
21091
|
+
lastIndex = JSXText.lastIndex;
|
|
21092
|
+
lastSignificantToken = match[0];
|
|
21093
|
+
yield {
|
|
21094
|
+
type: "JSXText",
|
|
21095
|
+
value: match[0]
|
|
21096
|
+
};
|
|
21097
|
+
continue;
|
|
21098
|
+
}
|
|
21099
|
+
switch (input[lastIndex]) {
|
|
21100
|
+
case "<":
|
|
21101
|
+
stack.push({ tag: "JSXTag" });
|
|
21102
|
+
lastIndex++;
|
|
21103
|
+
lastSignificantToken = "<";
|
|
20983
21104
|
yield {
|
|
20984
21105
|
type: "JSXPunctuator",
|
|
20985
|
-
value:
|
|
21106
|
+
value: "<"
|
|
20986
21107
|
};
|
|
20987
21108
|
continue;
|
|
20988
|
-
|
|
20989
|
-
|
|
20990
|
-
|
|
20991
|
-
|
|
20992
|
-
|
|
20993
|
-
|
|
20994
|
-
|
|
20995
|
-
|
|
20996
|
-
};
|
|
20997
|
-
continue;
|
|
20998
|
-
}
|
|
20999
|
-
JSXString.lastIndex = lastIndex;
|
|
21000
|
-
if (match = JSXString.exec(input)) {
|
|
21001
|
-
lastIndex = JSXString.lastIndex;
|
|
21002
|
-
lastSignificantToken = match[0];
|
|
21003
|
-
yield {
|
|
21004
|
-
type: "JSXString",
|
|
21005
|
-
value: match[0],
|
|
21006
|
-
closed: match[2] !== void 0
|
|
21007
|
-
};
|
|
21008
|
-
continue;
|
|
21009
|
-
}
|
|
21010
|
-
break;
|
|
21011
|
-
case "JSXChildren":
|
|
21012
|
-
JSXText.lastIndex = lastIndex;
|
|
21013
|
-
if (match = JSXText.exec(input)) {
|
|
21014
|
-
lastIndex = JSXText.lastIndex;
|
|
21015
|
-
lastSignificantToken = match[0];
|
|
21109
|
+
case "{":
|
|
21110
|
+
stack.push({
|
|
21111
|
+
tag: "InterpolationInJSX",
|
|
21112
|
+
nesting: braces.length
|
|
21113
|
+
});
|
|
21114
|
+
lastIndex++;
|
|
21115
|
+
lastSignificantToken = "?InterpolationInJSX";
|
|
21116
|
+
postfixIncDec = false;
|
|
21016
21117
|
yield {
|
|
21017
|
-
type: "
|
|
21018
|
-
value:
|
|
21118
|
+
type: "JSXPunctuator",
|
|
21119
|
+
value: "{"
|
|
21019
21120
|
};
|
|
21020
21121
|
continue;
|
|
21021
|
-
|
|
21022
|
-
|
|
21023
|
-
|
|
21024
|
-
|
|
21025
|
-
|
|
21026
|
-
|
|
21027
|
-
|
|
21028
|
-
|
|
21029
|
-
|
|
21030
|
-
|
|
21031
|
-
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21035
|
-
|
|
21036
|
-
|
|
21037
|
-
|
|
21038
|
-
|
|
21039
|
-
|
|
21040
|
-
|
|
21041
|
-
|
|
21042
|
-
|
|
21043
|
-
|
|
21044
|
-
|
|
21045
|
-
|
|
21046
|
-
|
|
21047
|
-
WhiteSpace.lastIndex = lastIndex;
|
|
21048
|
-
if (match = WhiteSpace.exec(input)) {
|
|
21049
|
-
lastIndex = WhiteSpace.lastIndex;
|
|
21050
|
-
yield {
|
|
21051
|
-
type: "WhiteSpace",
|
|
21052
|
-
value: match[0]
|
|
21053
|
-
};
|
|
21054
|
-
continue;
|
|
21055
|
-
}
|
|
21056
|
-
LineTerminatorSequence.lastIndex = lastIndex;
|
|
21057
|
-
if (match = LineTerminatorSequence.exec(input)) {
|
|
21058
|
-
lastIndex = LineTerminatorSequence.lastIndex;
|
|
21122
|
+
}
|
|
21123
|
+
}
|
|
21124
|
+
WhiteSpace.lastIndex = lastIndex;
|
|
21125
|
+
if (match = WhiteSpace.exec(input)) {
|
|
21126
|
+
lastIndex = WhiteSpace.lastIndex;
|
|
21127
|
+
yield {
|
|
21128
|
+
type: "WhiteSpace",
|
|
21129
|
+
value: match[0]
|
|
21130
|
+
};
|
|
21131
|
+
continue;
|
|
21132
|
+
}
|
|
21133
|
+
LineTerminatorSequence.lastIndex = lastIndex;
|
|
21134
|
+
if (match = LineTerminatorSequence.exec(input)) {
|
|
21135
|
+
lastIndex = LineTerminatorSequence.lastIndex;
|
|
21136
|
+
postfixIncDec = false;
|
|
21137
|
+
if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere";
|
|
21138
|
+
yield {
|
|
21139
|
+
type: "LineTerminatorSequence",
|
|
21140
|
+
value: match[0]
|
|
21141
|
+
};
|
|
21142
|
+
continue;
|
|
21143
|
+
}
|
|
21144
|
+
MultiLineComment.lastIndex = lastIndex;
|
|
21145
|
+
if (match = MultiLineComment.exec(input)) {
|
|
21146
|
+
lastIndex = MultiLineComment.lastIndex;
|
|
21147
|
+
if (Newline.test(match[0])) {
|
|
21059
21148
|
postfixIncDec = false;
|
|
21060
21149
|
if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere";
|
|
21061
|
-
yield {
|
|
21062
|
-
type: "LineTerminatorSequence",
|
|
21063
|
-
value: match[0]
|
|
21064
|
-
};
|
|
21065
|
-
continue;
|
|
21066
|
-
}
|
|
21067
|
-
MultiLineComment.lastIndex = lastIndex;
|
|
21068
|
-
if (match = MultiLineComment.exec(input)) {
|
|
21069
|
-
lastIndex = MultiLineComment.lastIndex;
|
|
21070
|
-
if (Newline.test(match[0])) {
|
|
21071
|
-
postfixIncDec = false;
|
|
21072
|
-
if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere";
|
|
21073
|
-
}
|
|
21074
|
-
yield {
|
|
21075
|
-
type: "MultiLineComment",
|
|
21076
|
-
value: match[0],
|
|
21077
|
-
closed: match[1] !== void 0
|
|
21078
|
-
};
|
|
21079
|
-
continue;
|
|
21080
21150
|
}
|
|
21081
|
-
|
|
21082
|
-
|
|
21083
|
-
|
|
21084
|
-
|
|
21085
|
-
|
|
21086
|
-
|
|
21087
|
-
|
|
21088
|
-
|
|
21089
|
-
|
|
21090
|
-
|
|
21091
|
-
firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex));
|
|
21092
|
-
lastIndex += firstCodePoint.length;
|
|
21093
|
-
lastSignificantToken = firstCodePoint;
|
|
21151
|
+
yield {
|
|
21152
|
+
type: "MultiLineComment",
|
|
21153
|
+
value: match[0],
|
|
21154
|
+
closed: match[1] !== void 0
|
|
21155
|
+
};
|
|
21156
|
+
continue;
|
|
21157
|
+
}
|
|
21158
|
+
SingleLineComment.lastIndex = lastIndex;
|
|
21159
|
+
if (match = SingleLineComment.exec(input)) {
|
|
21160
|
+
lastIndex = SingleLineComment.lastIndex;
|
|
21094
21161
|
postfixIncDec = false;
|
|
21095
21162
|
yield {
|
|
21096
|
-
type:
|
|
21097
|
-
value:
|
|
21163
|
+
type: "SingleLineComment",
|
|
21164
|
+
value: match[0]
|
|
21098
21165
|
};
|
|
21166
|
+
continue;
|
|
21099
21167
|
}
|
|
21100
|
-
|
|
21101
|
-
|
|
21168
|
+
firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex));
|
|
21169
|
+
lastIndex += firstCodePoint.length;
|
|
21170
|
+
lastSignificantToken = firstCodePoint;
|
|
21171
|
+
postfixIncDec = false;
|
|
21172
|
+
yield {
|
|
21173
|
+
type: mode.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid",
|
|
21174
|
+
value: firstCodePoint
|
|
21175
|
+
};
|
|
21176
|
+
}
|
|
21177
|
+
};
|
|
21178
|
+
var js_tokens_default = jsTokens;
|
|
21179
|
+
//#endregion
|
|
21180
|
+
//#region ../../node_modules/.pnpm/strip-literal@4.0.0/node_modules/strip-literal/dist/index.mjs
|
|
21102
21181
|
const FILL_COMMENT = " ";
|
|
21103
21182
|
function stripLiteralFromToken(token, fillChar, filter) {
|
|
21104
21183
|
if (token.type === "SingleLineComment") return FILL_COMMENT.repeat(token.value.length);
|
|
@@ -21136,10 +21215,13 @@ function optionsWithDefaults(options) {
|
|
|
21136
21215
|
filter: options?.filter ?? (() => true)
|
|
21137
21216
|
};
|
|
21138
21217
|
}
|
|
21218
|
+
/**
|
|
21219
|
+
* Strip literal from code.
|
|
21220
|
+
*/
|
|
21139
21221
|
function stripLiteral(code, options) {
|
|
21140
21222
|
let result = "";
|
|
21141
21223
|
const _options = optionsWithDefaults(options);
|
|
21142
|
-
for (const token of (
|
|
21224
|
+
for (const token of js_tokens_default(code, { jsx: false })) result += stripLiteralFromToken(token, _options.fillChar, _options.filter);
|
|
21143
21225
|
return result;
|
|
21144
21226
|
}
|
|
21145
21227
|
//#endregion
|
|
@@ -21381,7 +21463,8 @@ function assetPlugin(config) {
|
|
|
21381
21463
|
}
|
|
21382
21464
|
}
|
|
21383
21465
|
if (config.command === "build" && !this.environment.config.build.emitAssets) {
|
|
21384
|
-
|
|
21466
|
+
const chunkImportMapEnabled = this.environment.config.build.chunkImportMap;
|
|
21467
|
+
for (const file in bundle) if (bundle[file].type === "asset" && !file.endsWith("ssr-manifest.json") && !jsSourceMapRE.test(file) && !(chunkImportMapEnabled && file === getImportMapFilename(this.environment.config))) delete bundle[file];
|
|
21385
21468
|
}
|
|
21386
21469
|
},
|
|
21387
21470
|
watchChange(id) {
|
|
@@ -21444,8 +21527,10 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
|
|
|
21444
21527
|
const topLevelConfig = environment.getTopLevelConfig();
|
|
21445
21528
|
if (!skipPublicCheck) {
|
|
21446
21529
|
const publicFile = checkPublicFile(id, topLevelConfig);
|
|
21447
|
-
if (publicFile)
|
|
21448
|
-
|
|
21530
|
+
if (publicFile) {
|
|
21531
|
+
if (inlineRE$3.test(id)) id = publicFile;
|
|
21532
|
+
else return publicFileToBuiltUrl(id, topLevelConfig);
|
|
21533
|
+
}
|
|
21449
21534
|
}
|
|
21450
21535
|
const cache = assetCache.get(environment);
|
|
21451
21536
|
const cached = cache.get(id);
|
|
@@ -21858,7 +21943,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21858
21943
|
};
|
|
21859
21944
|
}));
|
|
21860
21945
|
//#endregion
|
|
21861
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
21946
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.26_tsx@4.23.12_yaml@2.9.0/node_modules/postcss-load-config/src/req.js
|
|
21862
21947
|
var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21863
21948
|
const { createRequire: createRequire$1 } = __require("node:module");
|
|
21864
21949
|
const { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1 } = __require("node:url");
|
|
@@ -21900,7 +21985,7 @@ var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21900
21985
|
module.exports = req;
|
|
21901
21986
|
}));
|
|
21902
21987
|
//#endregion
|
|
21903
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
21988
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.26_tsx@4.23.12_yaml@2.9.0/node_modules/postcss-load-config/src/options.js
|
|
21904
21989
|
var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21905
21990
|
const req = require_req();
|
|
21906
21991
|
/**
|
|
@@ -21934,7 +22019,7 @@ var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21934
22019
|
module.exports = options;
|
|
21935
22020
|
}));
|
|
21936
22021
|
//#endregion
|
|
21937
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
22022
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.26_tsx@4.23.12_yaml@2.9.0/node_modules/postcss-load-config/src/plugins.js
|
|
21938
22023
|
var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21939
22024
|
const req = require_req();
|
|
21940
22025
|
/**
|
|
@@ -21988,7 +22073,7 @@ var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21988
22073
|
module.exports = plugins;
|
|
21989
22074
|
}));
|
|
21990
22075
|
//#endregion
|
|
21991
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
22076
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.26_tsx@4.23.12_yaml@2.9.0/node_modules/postcss-load-config/src/index.js
|
|
21992
22077
|
var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21993
22078
|
const { resolve: resolve$3 } = __require("node:path");
|
|
21994
22079
|
const config = require_src$1();
|
|
@@ -22504,8 +22589,10 @@ function cssPlugin(config) {
|
|
|
22504
22589
|
const resolveUrl = (url, importer) => idResolver(environment, url, importer);
|
|
22505
22590
|
const urlResolver = async (url, importer) => {
|
|
22506
22591
|
const decodedUrl = decodeURI(url);
|
|
22507
|
-
if (checkPublicFile(decodedUrl, config))
|
|
22508
|
-
|
|
22592
|
+
if (checkPublicFile(decodedUrl, config)) {
|
|
22593
|
+
if (encodePublicUrlsInCSS(config)) return [publicFileToBuiltUrl(decodedUrl, config), void 0];
|
|
22594
|
+
else return [joinUrlSegments(joinUrlSegments(config.server.origin ?? "", config.base), decodedUrl), void 0];
|
|
22595
|
+
}
|
|
22509
22596
|
const [id, fragment] = decodedUrl.split("#");
|
|
22510
22597
|
let resolved = await resolveUrl(id, importer);
|
|
22511
22598
|
if (resolved) {
|
|
@@ -22770,11 +22857,13 @@ function cssPostPlugin(config) {
|
|
|
22770
22857
|
chunkCSSMap.set(chunk.fileName, chunkCSS);
|
|
22771
22858
|
}
|
|
22772
22859
|
}
|
|
22773
|
-
if (s)
|
|
22774
|
-
|
|
22775
|
-
|
|
22776
|
-
|
|
22777
|
-
|
|
22860
|
+
if (s) {
|
|
22861
|
+
if (config.build.sourcemap) return {
|
|
22862
|
+
code: s.toString(),
|
|
22863
|
+
map: s.generateMap({ hires: "boundary" })
|
|
22864
|
+
};
|
|
22865
|
+
else return { code: s.toString() };
|
|
22866
|
+
}
|
|
22778
22867
|
return null;
|
|
22779
22868
|
},
|
|
22780
22869
|
augmentChunkHash(chunk) {
|
|
@@ -22811,8 +22900,8 @@ function cssPostPlugin(config) {
|
|
|
22811
22900
|
});
|
|
22812
22901
|
}
|
|
22813
22902
|
}
|
|
22814
|
-
if (config.build.chunkImportMap && chunkCssReferences.size) {
|
|
22815
|
-
const importMap = getImportMap(bundle, config);
|
|
22903
|
+
if (this.environment.config.build.chunkImportMap && chunkCssReferences.size) {
|
|
22904
|
+
const importMap = getImportMap(bundle, this.environment.config);
|
|
22816
22905
|
const importMapReverseMapping = Object.fromEntries(Object.entries(importMap.mapping).map(([k, v]) => [v, k]));
|
|
22817
22906
|
const chunksByPreliminaryFileName = new Map(Object.values(bundle).filter((output) => output.type === "chunk").map((chunk) => [chunk.preliminaryFileName, chunk]));
|
|
22818
22907
|
for (const [chunkFileName, referenceId] of chunkCssReferences) {
|
|
@@ -22828,9 +22917,10 @@ function cssPostPlugin(config) {
|
|
|
22828
22917
|
if (pureCssChunks.size) {
|
|
22829
22918
|
const prelimaryNameToChunkMap = Object.fromEntries(Object.values(bundle).filter((chunk) => chunk.type === "chunk").map((chunk) => [chunk.preliminaryFileName, chunk.fileName]));
|
|
22830
22919
|
const pureCssChunkNames = [...pureCssChunks].map((pureCssChunk) => prelimaryNameToChunkMap[pureCssChunk.fileName]).filter(Boolean);
|
|
22920
|
+
const pureCssChunkNameSet = new Set(pureCssChunkNames);
|
|
22831
22921
|
let importMapReverseMapping;
|
|
22832
|
-
if (config.build.chunkImportMap) {
|
|
22833
|
-
const importMap = getImportMap(bundle, config);
|
|
22922
|
+
if (this.environment.config.build.chunkImportMap) {
|
|
22923
|
+
const importMap = getImportMap(bundle, this.environment.config);
|
|
22834
22924
|
importMapReverseMapping = Object.fromEntries(Object.entries(importMap.mapping).map(([k, v]) => [v, k]));
|
|
22835
22925
|
}
|
|
22836
22926
|
const replaceEmptyChunk = getEmptyChunkReplacer(importMapReverseMapping ? pureCssChunkNames.map((name) => importMapReverseMapping[name] ?? name) : pureCssChunkNames, opts.format);
|
|
@@ -22839,7 +22929,7 @@ function cssPostPlugin(config) {
|
|
|
22839
22929
|
if (chunk.type === "chunk") {
|
|
22840
22930
|
let chunkImportsPureCssChunk = false;
|
|
22841
22931
|
chunk.imports = chunk.imports.filter((file) => {
|
|
22842
|
-
if (
|
|
22932
|
+
if (pureCssChunkNameSet.has(file)) {
|
|
22843
22933
|
const { importedCss, importedAssets } = bundle[file].viteMetadata;
|
|
22844
22934
|
importedCss.forEach((file) => chunk.viteMetadata.importedCss.add(file));
|
|
22845
22935
|
importedAssets.forEach((file) => chunk.viteMetadata.importedAssets.add(file));
|
|
@@ -22879,15 +22969,17 @@ function injectInlinedCSS(s, ctx, code, format, injectCode) {
|
|
|
22879
22969
|
const m = (format === "iife" ? IIFE_BEGIN_RE : UMD_BEGIN_RE).exec(code);
|
|
22880
22970
|
if (!m) ctx.error("Injection point for inlined CSS not found");
|
|
22881
22971
|
injectionPoint = m.index + m[0].length;
|
|
22882
|
-
} else if (format === "es")
|
|
22883
|
-
|
|
22884
|
-
|
|
22885
|
-
|
|
22886
|
-
|
|
22887
|
-
|
|
22888
|
-
|
|
22889
|
-
|
|
22890
|
-
|
|
22972
|
+
} else if (format === "es") {
|
|
22973
|
+
if (code.startsWith("#!")) {
|
|
22974
|
+
const fileStartIndex = getFileStartIndex(code);
|
|
22975
|
+
const hashbang = code.slice(0, fileStartIndex);
|
|
22976
|
+
if (!lineTerminatorRE.test(hashbang)) {
|
|
22977
|
+
s.append(`\n${injectCode}`);
|
|
22978
|
+
return;
|
|
22979
|
+
}
|
|
22980
|
+
injectionPoint = fileStartIndex;
|
|
22981
|
+
} else injectionPoint = 0;
|
|
22982
|
+
} else ctx.error("Non supported format");
|
|
22891
22983
|
s.appendRight(injectionPoint, injectCode);
|
|
22892
22984
|
}
|
|
22893
22985
|
function cssAnalysisPlugin(config) {
|
|
@@ -23248,14 +23340,17 @@ async function resolvePostcssConfig(config) {
|
|
|
23248
23340
|
};
|
|
23249
23341
|
} else {
|
|
23250
23342
|
const searchPath = typeof inlineOptions === "string" ? inlineOptions : config.root;
|
|
23251
|
-
|
|
23252
|
-
|
|
23253
|
-
|
|
23254
|
-
e
|
|
23255
|
-
|
|
23256
|
-
|
|
23257
|
-
|
|
23258
|
-
|
|
23343
|
+
const stopDir = searchForWorkspaceRoot(config.root);
|
|
23344
|
+
result = (0, import_src.default)({}, searchPath, { stopDir }).catch((e) => {
|
|
23345
|
+
if (!e.message.includes("No PostCSS Config found")) {
|
|
23346
|
+
if (e instanceof Error) {
|
|
23347
|
+
const { name, message, stack } = e;
|
|
23348
|
+
e.name = "Failed to load PostCSS config";
|
|
23349
|
+
e.message = `Failed to load PostCSS config (searchPath: ${searchPath}): [${name}] ${message}\n${stack}`;
|
|
23350
|
+
e.stack = "";
|
|
23351
|
+
throw e;
|
|
23352
|
+
} else throw new Error(`Failed to load PostCSS config: ${e}`);
|
|
23353
|
+
}
|
|
23259
23354
|
return null;
|
|
23260
23355
|
});
|
|
23261
23356
|
result.then((resolved) => {
|
|
@@ -23389,10 +23484,12 @@ async function minifyCSS(css, config, inlined, filename = defaultCssBundleName)
|
|
|
23389
23484
|
const { code, warnings } = (await importLightningCSS()).transform({
|
|
23390
23485
|
...config.css.lightningcss,
|
|
23391
23486
|
targets: convertTargets(config.build.cssTarget),
|
|
23392
|
-
cssModules: void 0,
|
|
23393
23487
|
filename,
|
|
23394
23488
|
code: Buffer.from(css),
|
|
23395
|
-
minify: true
|
|
23489
|
+
minify: true,
|
|
23490
|
+
cssModules: void 0,
|
|
23491
|
+
visitor: void 0,
|
|
23492
|
+
customAtRules: void 0
|
|
23396
23493
|
});
|
|
23397
23494
|
for (const warning of warnings) {
|
|
23398
23495
|
let msg = `[lightningcss minify] ${warning.message}`;
|
|
@@ -23491,7 +23588,8 @@ function loadSassPackage(root, skipEmbedded = false) {
|
|
|
23491
23588
|
let cachedSss;
|
|
23492
23589
|
async function loadSss(root) {
|
|
23493
23590
|
if (!cachedSss) cachedSss = (async () => {
|
|
23494
|
-
|
|
23591
|
+
const sssPath = loadPreprocessorPath("sugarss", root);
|
|
23592
|
+
return cachedSss = (await import(pathToFileURL(sssPath).href)).default;
|
|
23495
23593
|
})();
|
|
23496
23594
|
return cachedSss;
|
|
23497
23595
|
}
|
|
@@ -24129,9 +24227,8 @@ const esRE = /es(6|\d{4})/;
|
|
|
24129
24227
|
const versionRE = /\d/;
|
|
24130
24228
|
const convertTargetsCache = /* @__PURE__ */ new Map();
|
|
24131
24229
|
const convertTargets = (esbuildTarget) => {
|
|
24132
|
-
if (!esbuildTarget) return
|
|
24133
|
-
|
|
24134
|
-
if (cached) return cached;
|
|
24230
|
+
if (!esbuildTarget) return void 0;
|
|
24231
|
+
if (convertTargetsCache.has(esbuildTarget)) return convertTargetsCache.get(esbuildTarget);
|
|
24135
24232
|
const targets = {};
|
|
24136
24233
|
const entriesWithoutES = arraify(esbuildTarget).flatMap((e) => {
|
|
24137
24234
|
const match = esRE.exec(e);
|
|
@@ -24157,8 +24254,9 @@ const convertTargets = (esbuildTarget) => {
|
|
|
24157
24254
|
}
|
|
24158
24255
|
throw new Error(`Unsupported target "${entry}"`);
|
|
24159
24256
|
}
|
|
24160
|
-
|
|
24161
|
-
|
|
24257
|
+
const result = Object.keys(targets).length > 0 ? targets : void 0;
|
|
24258
|
+
convertTargetsCache.set(esbuildTarget, result);
|
|
24259
|
+
return result;
|
|
24162
24260
|
};
|
|
24163
24261
|
function resolveLibCssFilename(libOptions, root, packageCache) {
|
|
24164
24262
|
if (typeof libOptions.cssFileName === "string") return `${libOptions.cssFileName}.css`;
|
|
@@ -24489,20 +24587,22 @@ function buildHtmlPlugin(config) {
|
|
|
24489
24587
|
else if (attr.type === "src") {
|
|
24490
24588
|
const url = decodeURIIfPossible(attr.value);
|
|
24491
24589
|
if (url === void 0) {} else if (checkPublicFile(url, config)) overwriteAttrValue(s, attr.location, partialEncodeURIPath(toOutputPublicFilePath(url)));
|
|
24492
|
-
else if (!isExcludedUrl(url))
|
|
24493
|
-
|
|
24494
|
-
|
|
24495
|
-
|
|
24496
|
-
|
|
24497
|
-
|
|
24498
|
-
|
|
24499
|
-
|
|
24500
|
-
|
|
24501
|
-
|
|
24502
|
-
|
|
24503
|
-
|
|
24504
|
-
|
|
24505
|
-
|
|
24590
|
+
else if (!isExcludedUrl(url)) {
|
|
24591
|
+
if (node.nodeName === "link" && isCSSRequest(url) && !("media" in attr.attributes || "disabled" in attr.attributes)) {
|
|
24592
|
+
const importExpression = `\nimport ${JSON.stringify(url)}`;
|
|
24593
|
+
styleUrls.push({
|
|
24594
|
+
url,
|
|
24595
|
+
start: nodeStartWithLeadingWhitespace(node),
|
|
24596
|
+
end: node.sourceCodeLocation.endOffset
|
|
24597
|
+
});
|
|
24598
|
+
js += importExpression;
|
|
24599
|
+
} else {
|
|
24600
|
+
const shouldInline = node.nodeName === "link" && attr.attributes.rel && parseRelAttr(attr.attributes.rel).some((v) => noInlineLinkRels.has(v)) ? false : void 0;
|
|
24601
|
+
assetUrlsPromises.push((async () => {
|
|
24602
|
+
const processedUrl = await processAssetUrl(url, shouldInline);
|
|
24603
|
+
if (processedUrl !== url) overwriteAttrValue(s, attr.location, partialEncodeURIPath(processedUrl));
|
|
24604
|
+
})());
|
|
24605
|
+
}
|
|
24506
24606
|
}
|
|
24507
24607
|
}
|
|
24508
24608
|
const inlineStyle = findNeedTransformStyleAttribute(node);
|
|
@@ -24627,6 +24727,13 @@ function buildHtmlPlugin(config) {
|
|
|
24627
24727
|
assetTags.push(...getCssTagsForChunk(chunk, toOutputAssetFilePath));
|
|
24628
24728
|
result = injectToHead(result, assetTags);
|
|
24629
24729
|
}
|
|
24730
|
+
if (config.command === "serve" && this.environment.config.consumer === "client" && this.environment.config.isBundled) result = injectToHead(result, [{
|
|
24731
|
+
tag: "script",
|
|
24732
|
+
attrs: {
|
|
24733
|
+
type: "module",
|
|
24734
|
+
src: path.posix.join(config.base, BUNDLED_DEV_CLIENT_FILENAME)
|
|
24735
|
+
}
|
|
24736
|
+
}], true);
|
|
24630
24737
|
if (!this.environment.config.build.cssCodeSplit) {
|
|
24631
24738
|
const cssBundleName = cssBundleNameCache.get(config);
|
|
24632
24739
|
const cssChunk = cssBundleName && Object.values(bundle).find((chunk) => chunk.type === "asset" && chunk.names.includes(cssBundleName));
|
|
@@ -24724,7 +24831,7 @@ function preImportMapHook(config) {
|
|
|
24724
24831
|
function postImportMapHook(config) {
|
|
24725
24832
|
const decoder = new TextDecoder();
|
|
24726
24833
|
return function(html, { bundle }) {
|
|
24727
|
-
const chunkImportMapEnabled = config.command === "build" && config.build.chunkImportMap;
|
|
24834
|
+
const chunkImportMapEnabled = config.command === "build" && config.environments.client.build.chunkImportMap;
|
|
24728
24835
|
if (importMapAppendRE.test(html)) {
|
|
24729
24836
|
let importMap;
|
|
24730
24837
|
html = html.replace(importMapRE, (match) => {
|
|
@@ -24738,7 +24845,7 @@ function postImportMapHook(config) {
|
|
|
24738
24845
|
}
|
|
24739
24846
|
if (chunkImportMapEnabled) {
|
|
24740
24847
|
const nonce = config.html?.cspNonce;
|
|
24741
|
-
const importMap = bundle[getImportMapFilename(config)];
|
|
24848
|
+
const importMap = bundle[getImportMapFilename(config.environments.client)];
|
|
24742
24849
|
const importMapHtml = serializeTag({
|
|
24743
24850
|
tag: "script",
|
|
24744
24851
|
attrs: {
|
|
@@ -24962,23 +25069,29 @@ function serializeAttrs(attrs) {
|
|
|
24962
25069
|
function incrementIndent(indent = "") {
|
|
24963
25070
|
return `${indent}${indent[0] === " " ? " " : " "}`;
|
|
24964
25071
|
}
|
|
24965
|
-
function getImportMapFilename(
|
|
24966
|
-
const chunkImportMap =
|
|
25072
|
+
function getImportMapFilename(options) {
|
|
25073
|
+
const chunkImportMap = options.build.rolldownOptions.experimental?.chunkImportMap;
|
|
24967
25074
|
if (typeof chunkImportMap === "object" && chunkImportMap.fileName) return chunkImportMap.fileName;
|
|
24968
25075
|
return "importmap.json";
|
|
24969
25076
|
}
|
|
25077
|
+
function getImportMapBaseUrl(options) {
|
|
25078
|
+
const chunkImportMap = options.build.rolldownOptions.experimental?.chunkImportMap;
|
|
25079
|
+
if (typeof chunkImportMap === "object" && chunkImportMap.baseUrl) return chunkImportMap.baseUrl;
|
|
25080
|
+
return "/";
|
|
25081
|
+
}
|
|
24970
25082
|
/**
|
|
24971
25083
|
* Read and parse the chunk import map asset from the bundle.
|
|
24972
25084
|
* Returns `undefined` when the import map is not present in the bundle.
|
|
24973
25085
|
*/
|
|
24974
|
-
function getImportMap(bundle,
|
|
24975
|
-
const asset = bundle[getImportMapFilename(
|
|
25086
|
+
function getImportMap(bundle, options) {
|
|
25087
|
+
const asset = bundle[getImportMapFilename(options)];
|
|
24976
25088
|
if (!asset) return void 0;
|
|
24977
25089
|
const content = JSON.parse(typeof asset.source === "string" ? asset.source : new TextDecoder().decode(asset.source));
|
|
25090
|
+
const baseUrl = getImportMapBaseUrl(options);
|
|
24978
25091
|
return {
|
|
24979
25092
|
asset,
|
|
24980
25093
|
content,
|
|
24981
|
-
mapping: Object.fromEntries(Object.entries(content.imports).map(([k, v]) => [k.slice(
|
|
25094
|
+
mapping: Object.fromEntries(Object.entries(content.imports).map(([k, v]) => [k.slice(baseUrl.length), v.slice(baseUrl.length)]))
|
|
24982
25095
|
};
|
|
24983
25096
|
}
|
|
24984
25097
|
//#endregion
|
|
@@ -25170,7 +25283,7 @@ If you intend to import that asset, put the file in the src directory, and use $
|
|
|
25170
25283
|
//#region src/node/plugins/define.ts
|
|
25171
25284
|
const nonJsRe = /\.json(?:$|\?)/;
|
|
25172
25285
|
const isNonJsRequest = (request) => nonJsRe.test(request);
|
|
25173
|
-
const escapedDotRE = /(?<!\\)
|
|
25286
|
+
const escapedDotRE = /(?<!\\)\\\./g;
|
|
25174
25287
|
function definePlugin(config) {
|
|
25175
25288
|
const isBuild = config.command === "build";
|
|
25176
25289
|
const isBuildLib = isBuild && config.build.lib;
|
|
@@ -25587,7 +25700,7 @@ function indexHtmlMiddleware(root, server) {
|
|
|
25587
25700
|
}
|
|
25588
25701
|
const filePath = pathname.slice(1);
|
|
25589
25702
|
let file = fullBundle.memoryFiles.get(filePath);
|
|
25590
|
-
if (!file && fullBundle.
|
|
25703
|
+
if (!file && fullBundle.hasBuildOutput) return next();
|
|
25591
25704
|
if ([
|
|
25592
25705
|
"document",
|
|
25593
25706
|
"iframe",
|
|
@@ -26217,7 +26330,13 @@ function triggerLazyBundlingMiddleware(server) {
|
|
|
26217
26330
|
}
|
|
26218
26331
|
const moduleId = params.get("id");
|
|
26219
26332
|
const clientId = params.get("clientId");
|
|
26220
|
-
|
|
26333
|
+
let result;
|
|
26334
|
+
try {
|
|
26335
|
+
result = await bundledDev.triggerLazyBundling(moduleId, clientId);
|
|
26336
|
+
} catch (e) {
|
|
26337
|
+
server.config.logger.error(`Failed to trigger lazy bundling for ${moduleId} (clientId: ${clientId}):` + e, { error: e });
|
|
26338
|
+
return next(/* @__PURE__ */ new Error(`Failed to trigger lazy bundling`));
|
|
26339
|
+
}
|
|
26221
26340
|
if (result == null) return next();
|
|
26222
26341
|
res.setHeader("Content-Type", "application/javascript");
|
|
26223
26342
|
res.on("finish", () => bundledDev.markPayloadDelivered(result.filename));
|
|
@@ -26570,7 +26689,7 @@ async function startServer(server, hostname, inlinePort) {
|
|
|
26570
26689
|
if (!httpServer) throw new Error("Cannot call server.listen in middleware mode.");
|
|
26571
26690
|
const options = server.config.server;
|
|
26572
26691
|
const configPort = inlinePort ?? options.port;
|
|
26573
|
-
const port =
|
|
26692
|
+
const port = configPort === server._configServerPort ? server._currentServerPort ?? configPort : configPort;
|
|
26574
26693
|
server._configServerPort = configPort;
|
|
26575
26694
|
server._currentServerPort = await httpServerStart(httpServer, {
|
|
26576
26695
|
port,
|
|
@@ -26657,7 +26776,8 @@ async function resolveServerOptions(root, raw, logger) {
|
|
|
26657
26776
|
let allowDirs = server.fs.allow;
|
|
26658
26777
|
const cwd = searchForPackageRoot(root);
|
|
26659
26778
|
if (process.versions.pnp) try {
|
|
26660
|
-
const
|
|
26779
|
+
const enableGlobalCache = execSync("yarn config get enableGlobalCache", { cwd }).toString().trim() === "true";
|
|
26780
|
+
const yarnCacheDir = execSync(`yarn config get ${enableGlobalCache ? "globalFolder" : "cacheFolder"}`, { cwd }).toString().trim();
|
|
26661
26781
|
allowDirs.push(yarnCacheDir);
|
|
26662
26782
|
} catch (e) {
|
|
26663
26783
|
logger.warn(`Get yarn cache dir error: ${e.message}`, { timestamp: true });
|
|
@@ -27200,9 +27320,10 @@ function lexAcceptedHmrDeps(code, start, urls) {
|
|
|
27200
27320
|
prevState = state;
|
|
27201
27321
|
state = 3;
|
|
27202
27322
|
} else if (whitespaceRE.test(char)) continue;
|
|
27203
|
-
else if (state === 0)
|
|
27204
|
-
|
|
27205
|
-
|
|
27323
|
+
else if (state === 0) {
|
|
27324
|
+
if (char === `[`) state = 4;
|
|
27325
|
+
else return true;
|
|
27326
|
+
} else if (char === `]`) return false;
|
|
27206
27327
|
else if (char === ",") continue;
|
|
27207
27328
|
else error(i);
|
|
27208
27329
|
break;
|
|
@@ -27544,16 +27665,18 @@ function webWorkerPostPlugin(_config) {
|
|
|
27544
27665
|
}
|
|
27545
27666
|
let injectedImportMeta = false;
|
|
27546
27667
|
let s;
|
|
27547
|
-
for (const { s: start, e: end, d: dynamicIndex } of imports) if (dynamicIndex === -2)
|
|
27548
|
-
|
|
27549
|
-
|
|
27550
|
-
|
|
27551
|
-
|
|
27552
|
-
|
|
27553
|
-
|
|
27554
|
-
|
|
27668
|
+
for (const { s: start, e: end, d: dynamicIndex } of imports) if (dynamicIndex === -2) {
|
|
27669
|
+
if (code.slice(end, end + 4) === ".url") {
|
|
27670
|
+
s ||= new MagicString(code);
|
|
27671
|
+
s.overwrite(start, end + 4, "self.location.href");
|
|
27672
|
+
} else {
|
|
27673
|
+
s ||= new MagicString(code);
|
|
27674
|
+
if (!injectedImportMeta) {
|
|
27675
|
+
s.prepend("const _vite_importMeta = { url: self.location.href };\n");
|
|
27676
|
+
injectedImportMeta = true;
|
|
27677
|
+
}
|
|
27678
|
+
s.overwrite(start, end, "_vite_importMeta");
|
|
27555
27679
|
}
|
|
27556
|
-
s.overwrite(start, end, "_vite_importMeta");
|
|
27557
27680
|
}
|
|
27558
27681
|
if (!s) return;
|
|
27559
27682
|
return {
|
|
@@ -27593,13 +27716,14 @@ function webWorkerPlugin(config) {
|
|
|
27593
27716
|
name: options?.name
|
|
27594
27717
|
}`;
|
|
27595
27718
|
let urlCode;
|
|
27596
|
-
if (isBundled)
|
|
27597
|
-
|
|
27598
|
-
|
|
27599
|
-
|
|
27600
|
-
|
|
27601
|
-
|
|
27602
|
-
|
|
27719
|
+
if (isBundled) {
|
|
27720
|
+
if (isWorker && config.bundleChain.at(-1) === cleanUrl(id)) urlCode = "self.location.href";
|
|
27721
|
+
else if (inlineRE.test(id)) {
|
|
27722
|
+
const result = await bundleWorkerEntry(config, id);
|
|
27723
|
+
for (const file of result.watchedFiles) this.addWatchFile(file);
|
|
27724
|
+
const jsContent = `const jsContent = ${JSON.stringify(result.entryCode)};`;
|
|
27725
|
+
return {
|
|
27726
|
+
code: workerConstructor === "Worker" ? `${jsContent}
|
|
27603
27727
|
const blob = typeof self !== "undefined" && self.Blob && new Blob([${workerType === "classic" ? `'(self.URL || self.webkitURL).revokeObjectURL(self.location.href);',` : `'URL.revokeObjectURL(import.meta.url);',`}jsContent], { type: "text/javascript;charset=utf-8" });
|
|
27604
27728
|
export default function WorkerWrapper(options) {
|
|
27605
27729
|
let objURL;
|
|
@@ -27625,19 +27749,19 @@ function webWorkerPlugin(config) {
|
|
|
27625
27749
|
);
|
|
27626
27750
|
}
|
|
27627
27751
|
`,
|
|
27628
|
-
|
|
27629
|
-
|
|
27752
|
+
map: { mappings: "" }
|
|
27753
|
+
};
|
|
27754
|
+
} else {
|
|
27755
|
+
const result = await workerFileToUrl(config, id);
|
|
27756
|
+
let url;
|
|
27757
|
+
if (this.environment.config.command === "serve" && this.environment.config.isBundled) {
|
|
27758
|
+
emitWorkerAssetsForBundledDev(this, config);
|
|
27759
|
+
url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
|
|
27760
|
+
} else url = result.entryUrlPlaceholder;
|
|
27761
|
+
urlCode = JSON.stringify(url);
|
|
27762
|
+
for (const file of result.watchedFiles) this.addWatchFile(file);
|
|
27763
|
+
}
|
|
27630
27764
|
} else {
|
|
27631
|
-
const result = await workerFileToUrl(config, id);
|
|
27632
|
-
let url;
|
|
27633
|
-
if (this.environment.config.command === "serve" && this.environment.config.isBundled) {
|
|
27634
|
-
emitWorkerAssetsForBundledDev(this, config);
|
|
27635
|
-
url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
|
|
27636
|
-
} else url = result.entryUrlPlaceholder;
|
|
27637
|
-
urlCode = JSON.stringify(url);
|
|
27638
|
-
for (const file of result.watchedFiles) this.addWatchFile(file);
|
|
27639
|
-
}
|
|
27640
|
-
else {
|
|
27641
27765
|
let url = await fileToUrl$1(this, cleanUrl(id));
|
|
27642
27766
|
url = injectQuery(url, `${WORKER_FILE_ID}&type=${workerType}`);
|
|
27643
27767
|
urlCode = JSON.stringify(url);
|
|
@@ -27666,10 +27790,12 @@ function webWorkerPlugin(config) {
|
|
|
27666
27790
|
let injectEnv = "";
|
|
27667
27791
|
if (workerType === "classic") injectEnv = `importScripts(${JSON.stringify(path.posix.join(config.base, ENV_PUBLIC_PATH))})\n`;
|
|
27668
27792
|
else if (workerType === "module") injectEnv = `import ${JSON.stringify(ENV_PUBLIC_PATH)}\n`;
|
|
27669
|
-
else if (workerType === "ignore")
|
|
27670
|
-
|
|
27671
|
-
|
|
27672
|
-
|
|
27793
|
+
else if (workerType === "ignore") {
|
|
27794
|
+
if (this.environment.config.isBundled) injectEnv = "";
|
|
27795
|
+
else {
|
|
27796
|
+
const environment = this.environment;
|
|
27797
|
+
injectEnv = ((environment.mode === "dev" ? environment.moduleGraph : void 0)?.getModuleById(ENV_ENTRY))?.transformResult?.code || "";
|
|
27798
|
+
}
|
|
27673
27799
|
}
|
|
27674
27800
|
if (injectEnv) {
|
|
27675
27801
|
const s = new MagicString(raw);
|
|
@@ -27999,13 +28125,15 @@ function importAnalysisPlugin(config) {
|
|
|
27999
28125
|
if (prop === ".hot") {
|
|
28000
28126
|
hasHMR = true;
|
|
28001
28127
|
const endHot = end + 4 + (source[end + 4] === "?" ? 1 : 0);
|
|
28002
|
-
if (source.slice(endHot, endHot + 7) === ".accept")
|
|
28003
|
-
|
|
28004
|
-
|
|
28005
|
-
|
|
28006
|
-
|
|
28007
|
-
|
|
28008
|
-
|
|
28128
|
+
if (source.slice(endHot, endHot + 7) === ".accept") {
|
|
28129
|
+
if (source.slice(endHot, endHot + 14) === ".acceptExports") {
|
|
28130
|
+
const importAcceptedExports = orderedAcceptedExports[index] = /* @__PURE__ */ new Set();
|
|
28131
|
+
lexAcceptedHmrExports(source, source.indexOf("(", endHot + 14) + 1, importAcceptedExports);
|
|
28132
|
+
isPartiallySelfAccepting = true;
|
|
28133
|
+
} else {
|
|
28134
|
+
const importAcceptedUrls = orderedAcceptedUrls[index] = /* @__PURE__ */ new Set();
|
|
28135
|
+
if (lexAcceptedHmrDeps(source, source.indexOf("(", endHot + 7) + 1, importAcceptedUrls)) isSelfAccepting = true;
|
|
28136
|
+
}
|
|
28009
28137
|
}
|
|
28010
28138
|
} else if (prop === ".env") hasEnv = true;
|
|
28011
28139
|
return;
|
|
@@ -28080,8 +28208,10 @@ function importAnalysisPlugin(config) {
|
|
|
28080
28208
|
debugHmr?.(`${isSelfAccepting ? `[self-accepts]` : isPartiallySelfAccepting ? `[accepts-exports]` : acceptedUrls.size ? `[accepts-deps]` : `[detected api usage]`} ${prettifyUrl(importer, root)}`);
|
|
28081
28209
|
str().prepend(`import { createHotContext as __vite__createHotContext } from "${clientPublicPath}";import.meta.hot = __vite__createHotContext(${JSON.stringify(normalizeHmrUrl(importerModule.url))});`);
|
|
28082
28210
|
}
|
|
28083
|
-
if (needQueryInjectHelper)
|
|
28084
|
-
|
|
28211
|
+
if (needQueryInjectHelper) {
|
|
28212
|
+
if (isClassicWorker) str().append("\n" + __vite__injectQuery.toString());
|
|
28213
|
+
else str().prepend(`import { injectQuery as __vite__injectQuery } from "${clientPublicPath}";`);
|
|
28214
|
+
}
|
|
28085
28215
|
const normalizedAcceptedUrls = /* @__PURE__ */ new Set();
|
|
28086
28216
|
for (const { url, start, end } of acceptedUrls) {
|
|
28087
28217
|
let [normalized, resolvedId] = await normalizeUrl(url, start).catch(() => []);
|
|
@@ -28211,9 +28341,10 @@ function transformCjsImport(importExp, url, rawUrl, importIndex, importer, isNod
|
|
|
28211
28341
|
const lines = [];
|
|
28212
28342
|
importNames.forEach(({ importedName, localName }) => {
|
|
28213
28343
|
if (importedName === "*") lines.push(`const ${localName} = (${interopHelperStr})(${cjsModuleName}, ${+isNodeMode})`);
|
|
28214
|
-
else if (importedName === "default")
|
|
28215
|
-
|
|
28216
|
-
|
|
28344
|
+
else if (importedName === "default") {
|
|
28345
|
+
if (isNodeMode) lines.push(`const ${localName} = ${cjsModuleName}`);
|
|
28346
|
+
else lines.push(`const ${localName} = !${cjsModuleName}.__esModule ? ${cjsModuleName} : ${cjsModuleName}.default`);
|
|
28347
|
+
} else lines.push(`const ${localName} = ${cjsModuleName}["${importedName}"]`);
|
|
28217
28348
|
});
|
|
28218
28349
|
if (defaultExports) lines.push(`export default ${defaultExports}`);
|
|
28219
28350
|
if (exportNames.length) lines.push(`export { ${exportNames.join(", ")} }`);
|
|
@@ -28871,8 +29002,8 @@ function buildImportAnalysisPlugin(config) {
|
|
|
28871
29002
|
const { modulePreload } = this.environment.config.build;
|
|
28872
29003
|
let importMapMapping;
|
|
28873
29004
|
let importMapReverseMapping;
|
|
28874
|
-
if (config.build.chunkImportMap) {
|
|
28875
|
-
const importMap = getImportMap(bundle, config);
|
|
29005
|
+
if (this.environment.config.build.chunkImportMap) {
|
|
29006
|
+
const importMap = getImportMap(bundle, this.environment.config);
|
|
28876
29007
|
importMapMapping = importMap.mapping;
|
|
28877
29008
|
importMapReverseMapping = Object.fromEntries(Object.entries(importMapMapping).map(([k, v]) => [v, k]));
|
|
28878
29009
|
if (config.isOutputOptionsForLegacyChunks?.(opts)) {
|
|
@@ -28881,7 +29012,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
28881
29012
|
fileName: "importmap.legacy.json",
|
|
28882
29013
|
source: importMap.asset.source
|
|
28883
29014
|
});
|
|
28884
|
-
delete bundle[getImportMapFilename(config)];
|
|
29015
|
+
delete bundle[getImportMapFilename(this.environment.config)];
|
|
28885
29016
|
}
|
|
28886
29017
|
}
|
|
28887
29018
|
for (const file in bundle) {
|
|
@@ -28990,7 +29121,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
28990
29121
|
}
|
|
28991
29122
|
if (fileDeps.length > 0) {
|
|
28992
29123
|
const mapDepsCode = `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=${`[${fileDeps.map((fileDep) => fileDep.runtime ? fileDep.url : JSON.stringify(fileDep.url)).join(",")}]`})))=>i.map(i=>d[i]);\n`;
|
|
28993
|
-
if (code.startsWith("#!")) s.prependLeft(code
|
|
29124
|
+
if (code.startsWith("#!")) s.prependLeft(getFileStartIndex(code), mapDepsCode);
|
|
28994
29125
|
else s.prepend(mapDepsCode);
|
|
28995
29126
|
}
|
|
28996
29127
|
let markerStartPos = findPreloadMarker(code);
|
|
@@ -29025,8 +29156,9 @@ function buildImportAnalysisPlugin(config) {
|
|
|
29025
29156
|
}
|
|
29026
29157
|
}
|
|
29027
29158
|
}, perEnvironmentPlugin("native:import-analysis-build", (environment) => {
|
|
29159
|
+
const preloadCode = getPreloadCode(environment, !!renderBuiltUrl, isRelativeBase);
|
|
29028
29160
|
return viteBuildImportAnalysisPlugin({
|
|
29029
|
-
preloadCode
|
|
29161
|
+
preloadCode,
|
|
29030
29162
|
insertPreload: getInsertPreload(environment),
|
|
29031
29163
|
optimizeModulePreloadRelativePaths: false,
|
|
29032
29164
|
renderBuiltUrl: !!renderBuiltUrl,
|
|
@@ -29489,7 +29621,8 @@ async function parseImportGlob(code, importer, root, resolveId, logger) {
|
|
|
29489
29621
|
};
|
|
29490
29622
|
const end = findCorrespondingCloseParenthesisPosition(cleanCode, start + match[0].length) + 1;
|
|
29491
29623
|
if (end <= 0) throw err("Close parenthesis not found");
|
|
29492
|
-
const
|
|
29624
|
+
const statementCode = code.slice(start, end);
|
|
29625
|
+
const rootAst = (await parseAstAsync(statementCode)).body[0];
|
|
29493
29626
|
if (rootAst.type !== "ExpressionStatement") throw err(`Expect CallExpression, got ${rootAst.type}`);
|
|
29494
29627
|
const ast = rootAst.expression;
|
|
29495
29628
|
if (ast.type !== "CallExpression") throw err(`Expect CallExpression, got ${ast.type}`);
|
|
@@ -29566,9 +29699,10 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
|
|
|
29566
29699
|
const s = new MagicString(code);
|
|
29567
29700
|
const staticImports = (await Promise.all(matches.map(async ({ globsResolved, isRelative, options, index, start, end, onlyKeys, onlyValues }) => {
|
|
29568
29701
|
if (!dir && !options.base && isRelative) throw new Error("In virtual modules, all globs must start with '/'");
|
|
29702
|
+
const cwd = getCommonBase(globsResolved) ?? root;
|
|
29569
29703
|
const files = (await glob(globsResolved, {
|
|
29570
29704
|
absolute: true,
|
|
29571
|
-
cwd
|
|
29705
|
+
cwd,
|
|
29572
29706
|
dot: !!options.exhaustive,
|
|
29573
29707
|
expandDirectories: false,
|
|
29574
29708
|
caseSensitiveMatch: options.caseSensitive ?? true,
|
|
@@ -29669,9 +29803,10 @@ async function toAbsoluteGlob(glob, root, importer, resolveId, base) {
|
|
|
29669
29803
|
}
|
|
29670
29804
|
root = globSafePath(root);
|
|
29671
29805
|
let dir;
|
|
29672
|
-
if (base)
|
|
29673
|
-
|
|
29674
|
-
|
|
29806
|
+
if (base) {
|
|
29807
|
+
if (base[0] === "/") dir = posix.join(root, base);
|
|
29808
|
+
else dir = posix.resolve(importer ? globSafePath(dirname$1(importer)) : root, base);
|
|
29809
|
+
} else dir = importer ? globSafePath(dirname$1(importer)) : root;
|
|
29675
29810
|
if (glob[0] === "/") return pre + posix.join(root, glob.slice(1));
|
|
29676
29811
|
if (glob.startsWith("./")) return pre + posix.join(dir, glob.slice(2));
|
|
29677
29812
|
if (glob.startsWith("../")) return pre + posix.join(dir, glob);
|
|
@@ -29714,7 +29849,8 @@ function patternToIdFilter(pattern, cwd) {
|
|
|
29714
29849
|
pattern.lastIndex = 0;
|
|
29715
29850
|
return result;
|
|
29716
29851
|
};
|
|
29717
|
-
const
|
|
29852
|
+
const glob = getMatcherString(pattern, cwd);
|
|
29853
|
+
const matcher = pm(glob, { dot: true });
|
|
29718
29854
|
return (id) => {
|
|
29719
29855
|
const normalizedId = slash(id);
|
|
29720
29856
|
return matcher(normalizedId);
|
|
@@ -31657,34 +31793,36 @@ function expandGlobIds(id, config) {
|
|
|
31657
31793
|
if (exports) {
|
|
31658
31794
|
if (typeof exports === "string" || Array.isArray(exports)) return [pkgName];
|
|
31659
31795
|
const possibleExportPaths = [];
|
|
31660
|
-
for (const key in exports) if (key[0] === ".")
|
|
31661
|
-
|
|
31662
|
-
|
|
31663
|
-
|
|
31664
|
-
|
|
31665
|
-
|
|
31666
|
-
|
|
31667
|
-
|
|
31668
|
-
|
|
31669
|
-
|
|
31670
|
-
|
|
31671
|
-
|
|
31672
|
-
|
|
31673
|
-
|
|
31674
|
-
|
|
31675
|
-
allGlobSame
|
|
31676
|
-
|
|
31677
|
-
|
|
31678
|
-
|
|
31796
|
+
for (const key in exports) if (key[0] === ".") {
|
|
31797
|
+
if (key.includes("*")) {
|
|
31798
|
+
const exportsValue = getFirstExportStringValue(exports[key]);
|
|
31799
|
+
if (!exportsValue) continue;
|
|
31800
|
+
const exportValuePattern = exportsValue.replace(/\*/g, "**/*");
|
|
31801
|
+
const exportsValueGlobRe = new RegExp(exportsValue.split("*").map(escapeRegex).join("(.*)"));
|
|
31802
|
+
possibleExportPaths.push(...globSync(exportValuePattern, {
|
|
31803
|
+
cwd: pkgData.dir,
|
|
31804
|
+
expandDirectories: false,
|
|
31805
|
+
ignore: ["node_modules"]
|
|
31806
|
+
}).map((filePath) => {
|
|
31807
|
+
if (exportsValue.startsWith("./")) filePath = "./" + filePath;
|
|
31808
|
+
const matched = exportsValueGlobRe.exec(slash(filePath));
|
|
31809
|
+
if (matched) {
|
|
31810
|
+
let allGlobSame = matched.length === 2;
|
|
31811
|
+
if (!allGlobSame) {
|
|
31812
|
+
allGlobSame = true;
|
|
31813
|
+
for (let i = 2; i < matched.length; i++) if (matched[i] !== matched[i - 1]) {
|
|
31814
|
+
allGlobSame = false;
|
|
31815
|
+
break;
|
|
31816
|
+
}
|
|
31679
31817
|
}
|
|
31818
|
+
if (allGlobSame) return key.replace("*", matched[1]).slice(2);
|
|
31680
31819
|
}
|
|
31681
|
-
|
|
31682
|
-
}
|
|
31683
|
-
|
|
31684
|
-
|
|
31685
|
-
|
|
31686
|
-
|
|
31687
|
-
possibleExportPaths.push(key.slice(2));
|
|
31820
|
+
return "";
|
|
31821
|
+
}).filter(Boolean));
|
|
31822
|
+
} else {
|
|
31823
|
+
if (exports[key] == null) continue;
|
|
31824
|
+
possibleExportPaths.push(key.slice(2));
|
|
31825
|
+
}
|
|
31688
31826
|
}
|
|
31689
31827
|
const isMatch = pm(pattern);
|
|
31690
31828
|
const matched = possibleExportPaths.filter((p) => isMatch(p)).map((match) => path.posix.join(pkgName, match));
|
|
@@ -32021,11 +32159,13 @@ async function loadCachedDepOptimizationMetadata(environment, force = environmen
|
|
|
32021
32159
|
const cachedMetadataPath = path.join(depsCacheDir, METADATA_FILENAME);
|
|
32022
32160
|
cachedMetadata = parseDepsOptimizerMetadata(await fsp.readFile(cachedMetadataPath, "utf-8"), depsCacheDir);
|
|
32023
32161
|
} catch {}
|
|
32024
|
-
if (cachedMetadata)
|
|
32025
|
-
|
|
32026
|
-
|
|
32027
|
-
|
|
32028
|
-
|
|
32162
|
+
if (cachedMetadata) {
|
|
32163
|
+
if (cachedMetadata.lockfileHash !== getLockfileHash(environment)) environment.logger.info("Re-optimizing dependencies because lockfile has changed", { timestamp: true });
|
|
32164
|
+
else if (cachedMetadata.configHash !== getConfigHash(environment)) environment.logger.info("Re-optimizing dependencies because vite config has changed", { timestamp: true });
|
|
32165
|
+
else {
|
|
32166
|
+
log?.(`(${environment.name}) Hash is consistent. Skipping. Use --force to override.`);
|
|
32167
|
+
return cachedMetadata;
|
|
32168
|
+
}
|
|
32029
32169
|
}
|
|
32030
32170
|
} else environment.logger.info("Forced re-optimization of dependencies", { timestamp: true });
|
|
32031
32171
|
debug$4?.(`(${environment.name}) ${import_picocolors.default.green(`removing old cache dir ${depsCacheDir}`)}`);
|
|
@@ -32308,9 +32448,10 @@ async function addManuallyIncludedOptimizeDeps(environment, deps) {
|
|
|
32308
32448
|
const normalizedId = normalizeId(id);
|
|
32309
32449
|
if (!deps[normalizedId]) {
|
|
32310
32450
|
const entry = await resolve(id);
|
|
32311
|
-
if (entry)
|
|
32312
|
-
|
|
32313
|
-
|
|
32451
|
+
if (entry) {
|
|
32452
|
+
if (isOptimizable(entry, optimizeDeps)) deps[normalizedId] = entry;
|
|
32453
|
+
else unableToOptimize(id, "Cannot optimize dependency");
|
|
32454
|
+
} else unableToOptimize(id, "Failed to resolve dependency");
|
|
32314
32455
|
}
|
|
32315
32456
|
}
|
|
32316
32457
|
}
|
|
@@ -32425,7 +32566,7 @@ async function extractExportsData(environment, filePath) {
|
|
|
32425
32566
|
};
|
|
32426
32567
|
}
|
|
32427
32568
|
});
|
|
32428
|
-
const
|
|
32569
|
+
const build = await rolldown({
|
|
32429
32570
|
...remainingRolldownOptions,
|
|
32430
32571
|
plugins,
|
|
32431
32572
|
input: [filePath],
|
|
@@ -32433,15 +32574,20 @@ async function extractExportsData(environment, filePath) {
|
|
|
32433
32574
|
".css": "js",
|
|
32434
32575
|
...remainingRolldownOptions.moduleTypes
|
|
32435
32576
|
}
|
|
32436
|
-
})
|
|
32437
|
-
|
|
32438
|
-
|
|
32439
|
-
|
|
32440
|
-
|
|
32441
|
-
|
|
32442
|
-
|
|
32443
|
-
|
|
32444
|
-
|
|
32577
|
+
});
|
|
32578
|
+
try {
|
|
32579
|
+
const [, exports, , hasModuleSyntax] = parse$2((await build.generate({
|
|
32580
|
+
...rolldownOptions.output,
|
|
32581
|
+
format: "esm",
|
|
32582
|
+
sourcemap: false
|
|
32583
|
+
})).output[0].code);
|
|
32584
|
+
return {
|
|
32585
|
+
hasModuleSyntax,
|
|
32586
|
+
exports: exports.map((e) => e.n)
|
|
32587
|
+
};
|
|
32588
|
+
} finally {
|
|
32589
|
+
await build.close();
|
|
32590
|
+
}
|
|
32445
32591
|
}
|
|
32446
32592
|
let parseResult;
|
|
32447
32593
|
let usedJsxLoader = false;
|
|
@@ -32611,7 +32757,7 @@ async function optimizedDepNeedsInterop(environment, metadata, file) {
|
|
|
32611
32757
|
}
|
|
32612
32758
|
return depInfo?.needsInterop;
|
|
32613
32759
|
}
|
|
32614
|
-
const MAX_TEMP_DIR_AGE_MS =
|
|
32760
|
+
const MAX_TEMP_DIR_AGE_MS = 864e5;
|
|
32615
32761
|
async function cleanupDepsCacheStaleDirs(config) {
|
|
32616
32762
|
try {
|
|
32617
32763
|
const cacheDir = path.resolve(config.cacheDir);
|
|
@@ -33479,7 +33625,10 @@ function resolveBuildEnvironmentOptions(raw, logger, consumer, isBundledDev, inp
|
|
|
33479
33625
|
platform: consumer === "client" || isSsrTargetWebworkerEnvironment ? "browser" : "node",
|
|
33480
33626
|
...merged.rolldownOptions
|
|
33481
33627
|
};
|
|
33482
|
-
if (merged.lib && merged.lib.entry == null && input != null) merged.lib
|
|
33628
|
+
if (merged.lib && merged.lib.entry == null && input != null) merged.lib = {
|
|
33629
|
+
...merged.lib,
|
|
33630
|
+
entry: input
|
|
33631
|
+
};
|
|
33483
33632
|
if (merged.target === "baseline-widely-available") merged.target = ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET;
|
|
33484
33633
|
if (Array.isArray(merged.target)) merged.target = unique(merged.target);
|
|
33485
33634
|
if (merged.minify === "false") merged.minify = false;
|
|
@@ -33575,7 +33724,10 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
|
|
|
33575
33724
|
experimental: {
|
|
33576
33725
|
...options.rolldownOptions.experimental,
|
|
33577
33726
|
viteMode: true,
|
|
33578
|
-
chunkImportMap: options.chunkImportMap ? {
|
|
33727
|
+
chunkImportMap: options.chunkImportMap ? {
|
|
33728
|
+
...typeof options.rolldownOptions.experimental?.chunkImportMap === "object" ? options.rolldownOptions.experimental?.chunkImportMap : {},
|
|
33729
|
+
baseUrl: base
|
|
33730
|
+
} : options.rolldownOptions.experimental?.chunkImportMap
|
|
33579
33731
|
}
|
|
33580
33732
|
};
|
|
33581
33733
|
const isSsrTargetWebworkerEnvironment = environment.name === "ssr" && environment.getTopLevelConfig().ssr?.target === "webworker";
|
|
@@ -33788,9 +33940,10 @@ function onRollupLog(level, log, environment) {
|
|
|
33788
33940
|
clearLine();
|
|
33789
33941
|
const userOnLog = environment.config.build.rolldownOptions?.onLog;
|
|
33790
33942
|
const userOnWarn = environment.config.build.rolldownOptions?.onwarn;
|
|
33791
|
-
if (userOnLog)
|
|
33792
|
-
|
|
33793
|
-
|
|
33943
|
+
if (userOnLog) {
|
|
33944
|
+
if (userOnWarn) userOnLog(level, log, normalizeUserOnWarn(userOnWarn, viteLog));
|
|
33945
|
+
else userOnLog(level, log, viteLog);
|
|
33946
|
+
} else if (userOnWarn) normalizeUserOnWarn(userOnWarn, viteLog)(level, log);
|
|
33794
33947
|
else viteLog(level, log);
|
|
33795
33948
|
}
|
|
33796
33949
|
function normalizeUserOnWarn(userOnWarn, defaultHandler) {
|
|
@@ -33853,9 +34006,7 @@ function injectEnvironmentToHooks(environment, chunkMetadataMap, plugin) {
|
|
|
33853
34006
|
case "transform":
|
|
33854
34007
|
clone[hook] = wrapEnvironmentTransform(environment, transform, plugin.name);
|
|
33855
34008
|
break;
|
|
33856
|
-
default:
|
|
33857
|
-
if (ROLLUP_HOOKS.includes(hook)) clone[hook] = wrapEnvironmentHook(environment, chunkMetadataMap, plugin, hook);
|
|
33858
|
-
break;
|
|
34009
|
+
default: if (ROLLUP_HOOKS.includes(hook)) clone[hook] = wrapEnvironmentHook(environment, chunkMetadataMap, plugin, hook);
|
|
33859
34010
|
}
|
|
33860
34011
|
return clone;
|
|
33861
34012
|
}
|
|
@@ -34419,7 +34570,7 @@ function createDepsOptimizer(environment) {
|
|
|
34419
34570
|
logOptimizeDepsIncludeSuggestion("speed up cold start");
|
|
34420
34571
|
warnAboutMissedDependencies = false;
|
|
34421
34572
|
}
|
|
34422
|
-
},
|
|
34573
|
+
}, 200);
|
|
34423
34574
|
} else debug$2(import_picocolors.default.green(!isRerun ? `dependencies optimized` : `optimized dependencies unchanged`));
|
|
34424
34575
|
} else if (newDepsDiscovered) {
|
|
34425
34576
|
processingResult.cancel();
|
|
@@ -34958,6 +35109,7 @@ var MemoryFiles = class {
|
|
|
34958
35109
|
var BundledDev = class {
|
|
34959
35110
|
environment;
|
|
34960
35111
|
_devEngine;
|
|
35112
|
+
viteRuntime;
|
|
34961
35113
|
initialBuildCompleted = false;
|
|
34962
35114
|
_closed = false;
|
|
34963
35115
|
clients = new Clients();
|
|
@@ -34990,6 +35142,9 @@ var BundledDev = class {
|
|
|
34990
35142
|
return this._devEngine;
|
|
34991
35143
|
}
|
|
34992
35144
|
pendingPayloadFilenames = /* @__PURE__ */ new Set();
|
|
35145
|
+
get hasBuildOutput() {
|
|
35146
|
+
return this.memoryFiles.size > 1 || this.memoryFiles.size === 1 && !this.memoryFiles.has("bundledDevClient.mjs");
|
|
35147
|
+
}
|
|
34993
35148
|
async listen() {
|
|
34994
35149
|
this._closed = false;
|
|
34995
35150
|
debug$1?.("INITIAL: setup bundle options");
|
|
@@ -35079,6 +35234,8 @@ var BundledDev = class {
|
|
|
35079
35234
|
}, (e) => {
|
|
35080
35235
|
debug$1?.("INITIAL: run error", e);
|
|
35081
35236
|
});
|
|
35237
|
+
this.viteRuntime = await getHmrImplementation(this.environment.getTopLevelConfig());
|
|
35238
|
+
this.storeOutputFiles([]);
|
|
35082
35239
|
this.waitForInitialBuildFinish().then(() => {
|
|
35083
35240
|
if (this._closed) return;
|
|
35084
35241
|
debug$1?.("INITIAL: build done");
|
|
@@ -35095,7 +35252,7 @@ var BundledDev = class {
|
|
|
35095
35252
|
await this.devEngine.ensureCurrentBuildFinish();
|
|
35096
35253
|
if (this._closed) return;
|
|
35097
35254
|
let state = await this.devEngine.getBundleState();
|
|
35098
|
-
while (this.
|
|
35255
|
+
while (!this.hasBuildOutput && !state.lastBuildErrored) {
|
|
35099
35256
|
await setTimeout$1(10);
|
|
35100
35257
|
if (this._closed) return;
|
|
35101
35258
|
await this.devEngine.ensureCurrentBuildFinish();
|
|
@@ -35149,6 +35306,10 @@ var BundledDev = class {
|
|
|
35149
35306
|
this.initialBuildCompleted = false;
|
|
35150
35307
|
}
|
|
35151
35308
|
storeOutputFiles(output) {
|
|
35309
|
+
if (this.viteRuntime) this.memoryFiles.set(BUNDLED_DEV_CLIENT_FILENAME, {
|
|
35310
|
+
source: this.viteRuntime,
|
|
35311
|
+
etag: (0, import_etag.default)(Buffer.from(this.viteRuntime), { weak: true })
|
|
35312
|
+
});
|
|
35152
35313
|
for (const outputFile of output) this.memoryFiles.set(outputFile.fileName, () => {
|
|
35153
35314
|
const source = outputFile.type === "chunk" ? outputFile.code : outputFile.source;
|
|
35154
35315
|
return {
|
|
@@ -35164,23 +35325,11 @@ var BundledDev = class {
|
|
|
35164
35325
|
rolldownOptions.experimental.devMode = {
|
|
35165
35326
|
lazy: true,
|
|
35166
35327
|
...typeof rolldownOptions.experimental.devMode === "object" ? rolldownOptions.experimental.devMode : {},
|
|
35167
|
-
implement:
|
|
35328
|
+
implement: "",
|
|
35329
|
+
skipCommonRuntimeInjection: true
|
|
35168
35330
|
};
|
|
35169
35331
|
rolldownOptions.optimization ??= {};
|
|
35170
35332
|
rolldownOptions.optimization.inlineConst = false;
|
|
35171
|
-
const plugins = await asyncFlatten([rolldownOptions.plugins]);
|
|
35172
|
-
for (const plugin of plugins) {
|
|
35173
|
-
const transform = plugin && "transform" in plugin ? plugin.transform : void 0;
|
|
35174
|
-
if (!transform) continue;
|
|
35175
|
-
const handler = typeof transform === "function" ? transform : transform.handler;
|
|
35176
|
-
const wrappedHandler = function(code, id, opts) {
|
|
35177
|
-
if (id.includes("?rolldown-lazy=")) return null;
|
|
35178
|
-
return handler.call(this, code, id, opts);
|
|
35179
|
-
};
|
|
35180
|
-
if (typeof transform === "function") plugin.transform = wrappedHandler;
|
|
35181
|
-
else transform.handler = wrappedHandler;
|
|
35182
|
-
}
|
|
35183
|
-
rolldownOptions.plugins = plugins;
|
|
35184
35333
|
if (Array.isArray(rolldownOptions.output)) for (const output of rolldownOptions.output) {
|
|
35185
35334
|
output.entryFileNames = "assets/[name].js";
|
|
35186
35335
|
output.chunkFileNames = "assets/[name]-[hash].js";
|
|
@@ -35803,9 +35952,7 @@ function analyzeConfigModuleReferences(code, ast, file) {
|
|
|
35803
35952
|
case "ExportAllDeclaration":
|
|
35804
35953
|
if (node.source) addImportRef(node.source, hasTypeJson(node.attributes));
|
|
35805
35954
|
break;
|
|
35806
|
-
case "ImportExpression":
|
|
35807
|
-
if (node.source.type === "Literal" && typeof node.source.value === "string") addImportRef(node.source, node.options != null);
|
|
35808
|
-
break;
|
|
35955
|
+
case "ImportExpression": if (node.source.type === "Literal" && typeof node.source.value === "string") addImportRef(node.source, node.options != null);
|
|
35809
35956
|
}
|
|
35810
35957
|
} });
|
|
35811
35958
|
const globals = [];
|
|
@@ -35871,7 +36018,7 @@ function createNativeConfigCompatPlugin(collector) {
|
|
|
35871
36018
|
name: "vite:native-config-compat-check",
|
|
35872
36019
|
transform: {
|
|
35873
36020
|
filter: { id: {
|
|
35874
|
-
include:
|
|
36021
|
+
include: jsTsExtRE,
|
|
35875
36022
|
exclude: /^\0/
|
|
35876
36023
|
} },
|
|
35877
36024
|
async handler(code, id) {
|
|
@@ -36110,6 +36257,7 @@ function idToPathAndNamespace(id) {
|
|
|
36110
36257
|
//#endregion
|
|
36111
36258
|
//#region src/node/config.ts
|
|
36112
36259
|
var config_exports = /* @__PURE__ */ __exportAll({
|
|
36260
|
+
bundleConfigFile: () => bundleConfigFile,
|
|
36113
36261
|
defineConfig: () => defineConfig,
|
|
36114
36262
|
getDefaultEnvironmentOptions: () => getDefaultEnvironmentOptions,
|
|
36115
36263
|
isResolvedConfig: () => isResolvedConfig,
|
|
@@ -36473,7 +36621,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
36473
36621
|
if (tsconfigPathsPlugin) logger.warnOnce(import_picocolors.default.yellow(`The plugin ${JSON.stringify(tsconfigPathsPlugin.name)} is detected. Vite now supports tsconfig paths resolution natively via the ${import_picocolors.default.bold("resolve.tsconfigPaths")} option. You can remove the plugin and set ${import_picocolors.default.bold("resolve.tsconfigPaths: true")} in your Vite config instead.`));
|
|
36474
36622
|
if (process.versions.pnp) logger.warnOnce(import_picocolors.default.yellow(`Using Yarn PnP with Vite is discouraged and PnP-specific bugs will no longer be actively worked on. Please switch to a different ${import_picocolors.default.bold("nodeLinker")} mode or to a different package manager.`));
|
|
36475
36623
|
let nonNormalizedResolvedRoot = config.root ? path.resolve(config.root) : process.cwd();
|
|
36476
|
-
try {
|
|
36624
|
+
if (!config.resolve?.preserveSymlinks) try {
|
|
36477
36625
|
nonNormalizedResolvedRoot = safeRealpathSync(nonNormalizedResolvedRoot);
|
|
36478
36626
|
} catch {}
|
|
36479
36627
|
const resolvedRoot = normalizePath(nonNormalizedResolvedRoot);
|
|
@@ -36552,8 +36700,10 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
36552
36700
|
if (envDir !== false) envDir = config.envDir ? normalizePath(path.resolve(resolvedRoot, config.envDir)) : resolvedRoot;
|
|
36553
36701
|
const userEnv = loadEnv(mode, envDir, resolveEnvPrefix(config));
|
|
36554
36702
|
const userNodeEnv = process.env.VITE_USER_NODE_ENV;
|
|
36555
|
-
if (!isNodeEnvSet && userNodeEnv)
|
|
36556
|
-
|
|
36703
|
+
if (!isNodeEnvSet && userNodeEnv) {
|
|
36704
|
+
if (userNodeEnv === "development") process.env.NODE_ENV = "development";
|
|
36705
|
+
else logger.warn(`NODE_ENV=${userNodeEnv} is not supported in the .env file. Only NODE_ENV=development is supported to create a development build of your project. If you need to set process.env.NODE_ENV, you can set it in the Vite config instead.`);
|
|
36706
|
+
}
|
|
36557
36707
|
const isProduction = process.env.NODE_ENV === "production";
|
|
36558
36708
|
const resolvedBase = config.base === "" || config.base === "./" ? !isBuild || config.build?.ssr ? "/" : "./" : resolveBaseUrl(config.base, isBuild, logger);
|
|
36559
36709
|
const pkgDir = findNearestPackageData(resolvedRoot, packageCache)?.dir;
|
|
@@ -36623,9 +36773,10 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
36623
36773
|
if (Array.isArray(server.allowedHosts)) server.allowedHosts.push(...additionalAllowedHosts);
|
|
36624
36774
|
if (Array.isArray(preview.allowedHosts)) preview.allowedHosts.push(...additionalAllowedHosts);
|
|
36625
36775
|
let oxc = config.oxc;
|
|
36626
|
-
if (config.esbuild)
|
|
36627
|
-
|
|
36628
|
-
|
|
36776
|
+
if (config.esbuild) {
|
|
36777
|
+
if (config.oxc) logger.warn(import_picocolors.default.yellow(`Both esbuild and oxc options were set. oxc options will be used and esbuild options will be ignored.`) + ` The following esbuild options were set: \`${inspect(config.esbuild)}\``);
|
|
36778
|
+
else oxc = convertEsbuildConfigToOxcConfig(config.esbuild, logger);
|
|
36779
|
+
} else if (config.esbuild === false && config.oxc !== false) logger.warn(import_picocolors.default.yellow("`esbuild` option is set to false, but `oxc` option was not set to false. `esbuild: false` does not have effect any more. If you want to disable the default transformation, which is now handled by Oxc, please set `oxc: false` instead."));
|
|
36629
36780
|
const experimental = mergeWithDefaults(configDefaults.experimental, config.experimental ?? {});
|
|
36630
36781
|
if (command === "serve" && experimental.bundledDev) experimental.renderBuiltUrl = void 0;
|
|
36631
36782
|
const resolvedDevToolsConfig = await resolveDevToolsConfig(config.devtools, server.host, logger);
|
|
@@ -36876,6 +37027,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
36876
37027
|
const importMetaUrlVarName = "__vite_injected_original_import_meta_url";
|
|
36877
37028
|
const importMetaResolveVarName = "__vite_injected_original_import_meta_resolve";
|
|
36878
37029
|
const importMetaResolveRegex = /import\.meta\s*\.\s*resolve/;
|
|
37030
|
+
const configFileRegex = /\.[cm]?[jt]s$/;
|
|
36879
37031
|
const nativeIncompatibilities = [];
|
|
36880
37032
|
const bundle = await rolldown({
|
|
36881
37033
|
input: fileName,
|
|
@@ -36934,21 +37086,23 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
36934
37086
|
{
|
|
36935
37087
|
name: "inject-file-scope-variables",
|
|
36936
37088
|
transform: {
|
|
36937
|
-
filter: { id:
|
|
37089
|
+
filter: { id: configFileRegex },
|
|
36938
37090
|
handler(code, id) {
|
|
36939
37091
|
let injectValues = `const ${dirnameVarName} = ${JSON.stringify(path.dirname(id))};const ${filenameVarName} = ${JSON.stringify(id)};const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL(id).href)};`;
|
|
36940
|
-
if (importMetaResolveRegex.test(code))
|
|
36941
|
-
if (
|
|
36942
|
-
importMetaResolverRegistered
|
|
36943
|
-
|
|
36944
|
-
|
|
36945
|
-
|
|
36946
|
-
|
|
37092
|
+
if (importMetaResolveRegex.test(code)) {
|
|
37093
|
+
if (isESM) {
|
|
37094
|
+
if (!importMetaResolverRegistered) {
|
|
37095
|
+
importMetaResolverRegistered = true;
|
|
37096
|
+
createImportMetaResolver();
|
|
37097
|
+
}
|
|
37098
|
+
injectValues += `const ${importMetaResolveVarName} = (specifier, importer = ${importMetaUrlVarName}) => (${importMetaResolveWithCustomHookString})(specifier, importer);`;
|
|
37099
|
+
} else injectValues += `const ${importMetaResolveVarName} = (specifier, importer = ${importMetaUrlVarName}) => { throw new Error('import.meta.resolve is not supported in CJS config files') };`;
|
|
37100
|
+
}
|
|
36947
37101
|
let injectedContents;
|
|
36948
37102
|
if (code.startsWith("#!")) {
|
|
36949
|
-
|
|
36950
|
-
|
|
36951
|
-
injectedContents =
|
|
37103
|
+
const fileStartIndex = getFileStartIndex(code);
|
|
37104
|
+
const hashbang = code.slice(0, fileStartIndex);
|
|
37105
|
+
injectedContents = hashbang + (lineTerminatorRE.test(hashbang) ? "" : "\n") + injectValues + code.slice(fileStartIndex);
|
|
36952
37106
|
} else injectedContents = injectValues + code;
|
|
36953
37107
|
return {
|
|
36954
37108
|
code: injectedContents,
|
|
@@ -36962,8 +37116,8 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
36962
37116
|
const result = await bundle.generate({
|
|
36963
37117
|
format: isESM ? "esm" : "cjs",
|
|
36964
37118
|
sourcemap: "inline",
|
|
36965
|
-
sourcemapPathTransform(relative) {
|
|
36966
|
-
return path.resolve(
|
|
37119
|
+
sourcemapPathTransform(relative, sourcemapPath) {
|
|
37120
|
+
return path.resolve(path.dirname(sourcemapPath), relative);
|
|
36967
37121
|
},
|
|
36968
37122
|
codeSplitting: false
|
|
36969
37123
|
});
|
|
@@ -37029,10 +37183,11 @@ async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
|
|
|
37029
37183
|
}
|
|
37030
37184
|
async function runConfigHook(config, plugins, configEnv) {
|
|
37031
37185
|
let conf = config;
|
|
37032
|
-
const
|
|
37186
|
+
const tempLogger = createLogger(config.logLevel, {
|
|
37033
37187
|
allowClearScreen: config.clearScreen,
|
|
37034
37188
|
customLogger: config.customLogger
|
|
37035
|
-
})
|
|
37189
|
+
});
|
|
37190
|
+
const context = new BasicMinimalPluginContext(basePluginContextMeta, tempLogger);
|
|
37036
37191
|
for (const p of getSortedPluginsByHook("config", plugins)) {
|
|
37037
37192
|
const hook = p.config;
|
|
37038
37193
|
const res = await getHookHandler(hook).call(context, conf, configEnv);
|