vite 8.2.0-beta.0 → 8.2.1
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 +326 -8
- package/dist/client/client.mjs +4 -4
- package/dist/node/chunks/build.js +47 -43
- package/dist/node/chunks/dist.js +26 -85
- package/dist/node/chunks/node.js +666 -530
- package/dist/node/chunks/postcss-import.js +10 -10
- package/dist/node/index.d.ts +20 -5
- package/dist/node/module-runner.js +9 -4
- package/package.json +10 -10
- package/types/customEvent.d.ts +2 -0
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));
|
|
@@ -635,6 +635,8 @@ const ENV_PUBLIC_PATH = `/@vite/env`;
|
|
|
635
635
|
const VITE_PACKAGE_DIR = resolve(fileURLToPath(new URL("../../../src/node/constants.ts", import.meta.url)), "../../..");
|
|
636
636
|
const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/client.mjs");
|
|
637
637
|
const BUNDLED_DEV_CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/bundledDevClient.mjs");
|
|
638
|
+
/** URL filename the bundled-dev server serves the vite client under */
|
|
639
|
+
const BUNDLED_DEV_CLIENT_FILENAME = "bundledDevClient.mjs";
|
|
638
640
|
const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, "dist/client/env.mjs");
|
|
639
641
|
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
|
640
642
|
const KNOWN_ASSET_TYPES = [
|
|
@@ -732,7 +734,7 @@ function hasMoreVlq$1(reader, max) {
|
|
|
732
734
|
if (reader.pos >= max) return false;
|
|
733
735
|
return reader.peek() !== comma$1;
|
|
734
736
|
}
|
|
735
|
-
var bufLength =
|
|
737
|
+
var bufLength = 16384;
|
|
736
738
|
var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) {
|
|
737
739
|
return Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength).toString();
|
|
738
740
|
} } : { decode(buf) {
|
|
@@ -1746,7 +1748,8 @@ function getMatcherString$1(id, resolutionBase) {
|
|
|
1746
1748
|
const createFilter$2 = function createFilter(include, exclude, options) {
|
|
1747
1749
|
const resolutionBase = options && options.resolve;
|
|
1748
1750
|
const getMatcher = (id) => id instanceof RegExp ? id : { test: (what) => {
|
|
1749
|
-
|
|
1751
|
+
const pattern = getMatcherString$1(id, resolutionBase);
|
|
1752
|
+
return pm(pattern, { dot: true })(what);
|
|
1750
1753
|
} };
|
|
1751
1754
|
const includeMatchers = ensureArray(include).map(getMatcher);
|
|
1752
1755
|
const excludeMatchers = ensureArray(exclude).map(getMatcher);
|
|
@@ -1948,10 +1951,13 @@ function loadPackageData(pkgPath) {
|
|
|
1948
1951
|
let hasSideEffects;
|
|
1949
1952
|
if (typeof sideEffects === "boolean") hasSideEffects = () => sideEffects;
|
|
1950
1953
|
else if (Array.isArray(sideEffects)) if (sideEffects.length <= 0) hasSideEffects = () => false;
|
|
1951
|
-
else
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1954
|
+
else {
|
|
1955
|
+
const finalPackageSideEffects = sideEffects.map((sideEffect) => {
|
|
1956
|
+
if (sideEffect.includes("/")) return sideEffect;
|
|
1957
|
+
return `**/${sideEffect}`;
|
|
1958
|
+
});
|
|
1959
|
+
hasSideEffects = createFilter$1(finalPackageSideEffects, null, { resolve: pkgDir });
|
|
1960
|
+
}
|
|
1955
1961
|
else hasSideEffects = () => null;
|
|
1956
1962
|
const resolvedCache = {};
|
|
1957
1963
|
return {
|
|
@@ -2653,7 +2659,15 @@ function resolveServerUrls(server, options, hostname, httpsOptions, config) {
|
|
|
2653
2659
|
if (loopbackHosts.has(hostname.host)) local.push(address);
|
|
2654
2660
|
else {
|
|
2655
2661
|
network.push(address);
|
|
2656
|
-
|
|
2662
|
+
let interfaceName;
|
|
2663
|
+
if (hostname.host) {
|
|
2664
|
+
const interfaces = os.networkInterfaces();
|
|
2665
|
+
outer: for (const [name, nInterface] of Object.entries(interfaces)) for (const detail of nInterface ?? []) if (detail.address === hostname.host) {
|
|
2666
|
+
interfaceName = name;
|
|
2667
|
+
break outer;
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
networkInterfaceNames.push(interfaceName);
|
|
2657
2671
|
}
|
|
2658
2672
|
} else Object.entries(os.networkInterfaces()).forEach(([name, nInterface]) => {
|
|
2659
2673
|
(nInterface ?? []).filter((detail) => detail.address && detail.family === "IPv4").forEach((detail) => {
|
|
@@ -3155,7 +3169,8 @@ function formatAndTruncateFileList(files) {
|
|
|
3155
3169
|
truncated
|
|
3156
3170
|
};
|
|
3157
3171
|
}
|
|
3158
|
-
const
|
|
3172
|
+
const lineTerminatorRE = /[\r\n\u2028\u2029]$/;
|
|
3173
|
+
const hashbangRE = /^#![^\r\n\u2028\u2029]*(?:\r\n|[\r\n\u2028\u2029])?/;
|
|
3159
3174
|
function getFileStartIndex(code) {
|
|
3160
3175
|
return hashbangRE.exec(code)?.[0].length ?? 0;
|
|
3161
3176
|
}
|
|
@@ -3285,7 +3300,7 @@ function printServerUrls(urls, optionsHost, info) {
|
|
|
3285
3300
|
const interfaceName = urls.networkInterfaceNames?.[index];
|
|
3286
3301
|
let suffix = "";
|
|
3287
3302
|
if (interfaceName) {
|
|
3288
|
-
const label = interfaceName.length > maxNetworkInterfaceNameLength ? `${interfaceName.slice(0,
|
|
3303
|
+
const label = interfaceName.length > maxNetworkInterfaceNameLength ? `${interfaceName.slice(0, 19)}…` : interfaceName;
|
|
3289
3304
|
suffix = " ".repeat(networkUrlMaxLength - url.length + 2) + import_picocolors.default.dim(label);
|
|
3290
3305
|
}
|
|
3291
3306
|
info(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Network")}: ${colorUrl(url)}${suffix}`);
|
|
@@ -3562,7 +3577,7 @@ var Worker$1 = class {
|
|
|
3562
3577
|
_queue;
|
|
3563
3578
|
constructor(fn, options = {}) {
|
|
3564
3579
|
this._isModule = options.type === "module";
|
|
3565
|
-
this._code = genWorkerCode(fn, this._isModule,
|
|
3580
|
+
this._code = genWorkerCode(fn, this._isModule, 5e3, options.parentFunctions ?? {});
|
|
3566
3581
|
this._parentFunctions = options.parentFunctions ?? {};
|
|
3567
3582
|
const defaultMax = Math.max(1, (os.availableParallelism?.() ?? os.cpus().length) - 1);
|
|
3568
3583
|
this._max = options.max || defaultMax;
|
|
@@ -4181,8 +4196,6 @@ function convertEsbuildConfigToOxcConfig(esbuildConfig, logger) {
|
|
|
4181
4196
|
jsxOptions.runtime = "classic";
|
|
4182
4197
|
if (esbuildTransformOptions.jsxFactory) jsxOptions.pragma = esbuildTransformOptions.jsxFactory;
|
|
4183
4198
|
if (esbuildTransformOptions.jsxFragment) jsxOptions.pragmaFrag = esbuildTransformOptions.jsxFragment;
|
|
4184
|
-
break;
|
|
4185
|
-
default: break;
|
|
4186
4199
|
}
|
|
4187
4200
|
if (esbuildTransformOptions.jsxDev !== void 0) jsxOptions.development = esbuildTransformOptions.jsxDev;
|
|
4188
4201
|
if (esbuildTransformOptions.jsxSideEffects !== void 0) jsxOptions.pure = !esbuildTransformOptions.jsxSideEffects;
|
|
@@ -4197,7 +4210,7 @@ function warnDeprecatedShouldBeConvertedToPluginOptions(logger, name) {
|
|
|
4197
4210
|
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.`));
|
|
4198
4211
|
}
|
|
4199
4212
|
//#endregion
|
|
4200
|
-
//#region ../../node_modules/.pnpm/magic-string@1.
|
|
4213
|
+
//#region ../../node_modules/.pnpm/magic-string@1.1.0/node_modules/magic-string/dist/index.mjs
|
|
4201
4214
|
var BitSet = class BitSet {
|
|
4202
4215
|
constructor(arg) {
|
|
4203
4216
|
this.bits = arg instanceof BitSet ? arg.bits.slice() : [];
|
|
@@ -4308,10 +4321,8 @@ var Chunk = class Chunk {
|
|
|
4308
4321
|
if (this.outro.length) return true;
|
|
4309
4322
|
const trimmed = this.content.replace(rx, "");
|
|
4310
4323
|
if (trimmed.length) {
|
|
4311
|
-
if (trimmed !== this.content)
|
|
4312
|
-
|
|
4313
|
-
if (this.edited) this.edit(trimmed, this.storeName, true);
|
|
4314
|
-
}
|
|
4324
|
+
if (trimmed !== this.content) if (this.edited) this.edit(trimmed, this.storeName, true);
|
|
4325
|
+
else this.split(this.start + trimmed.length).edit("", void 0, true);
|
|
4315
4326
|
return true;
|
|
4316
4327
|
} else {
|
|
4317
4328
|
this.edit("", void 0, true);
|
|
@@ -4324,9 +4335,9 @@ var Chunk = class Chunk {
|
|
|
4324
4335
|
if (this.intro.length) return true;
|
|
4325
4336
|
const trimmed = this.content.replace(rx, "");
|
|
4326
4337
|
if (trimmed.length) {
|
|
4327
|
-
if (trimmed !== this.content)
|
|
4328
|
-
|
|
4329
|
-
|
|
4338
|
+
if (trimmed !== this.content) if (this.edited) this.edit(trimmed, this.storeName, true);
|
|
4339
|
+
else {
|
|
4340
|
+
this.split(this.end - trimmed.length);
|
|
4330
4341
|
this.edit("", void 0, true);
|
|
4331
4342
|
}
|
|
4332
4343
|
return true;
|
|
@@ -4594,8 +4605,8 @@ var MagicString = class MagicString {
|
|
|
4594
4605
|
value: options.offset || 0
|
|
4595
4606
|
}
|
|
4596
4607
|
});
|
|
4597
|
-
this.byStart[0
|
|
4598
|
-
this.byEnd[string.length
|
|
4608
|
+
this.byStart = /* @__PURE__ */ new Map([[0, chunk]]);
|
|
4609
|
+
this.byEnd = /* @__PURE__ */ new Map([[string.length, chunk]]);
|
|
4599
4610
|
}
|
|
4600
4611
|
/**
|
|
4601
4612
|
* Adds the specified character index (with respect to the original string) to sourcemap mappings, if `hires` is false.
|
|
@@ -4620,7 +4631,7 @@ var MagicString = class MagicString {
|
|
|
4620
4631
|
index = index + this.offset;
|
|
4621
4632
|
if (typeof content !== "string") throw new TypeError("inserted content must be a string");
|
|
4622
4633
|
this._split(index);
|
|
4623
|
-
const chunk = this.byEnd
|
|
4634
|
+
const chunk = this.byEnd.get(index);
|
|
4624
4635
|
if (chunk) chunk.appendLeft(content);
|
|
4625
4636
|
else this.intro += content;
|
|
4626
4637
|
return this;
|
|
@@ -4634,7 +4645,7 @@ var MagicString = class MagicString {
|
|
|
4634
4645
|
index = index + this.offset;
|
|
4635
4646
|
if (typeof content !== "string") throw new TypeError("inserted content must be a string");
|
|
4636
4647
|
this._split(index);
|
|
4637
|
-
const chunk = this.byStart
|
|
4648
|
+
const chunk = this.byStart.get(index);
|
|
4638
4649
|
if (chunk) chunk.appendRight(content);
|
|
4639
4650
|
else this.outro += content;
|
|
4640
4651
|
return this;
|
|
@@ -4650,8 +4661,8 @@ var MagicString = class MagicString {
|
|
|
4650
4661
|
let originalChunk = this.firstChunk;
|
|
4651
4662
|
let clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();
|
|
4652
4663
|
while (originalChunk) {
|
|
4653
|
-
cloned.byStart
|
|
4654
|
-
cloned.byEnd
|
|
4664
|
+
cloned.byStart.set(clonedChunk.start, clonedChunk);
|
|
4665
|
+
cloned.byEnd.set(clonedChunk.end, clonedChunk);
|
|
4655
4666
|
const nextOriginalChunk = originalChunk.next;
|
|
4656
4667
|
const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
|
|
4657
4668
|
if (nextClonedChunk) {
|
|
@@ -4824,11 +4835,11 @@ var MagicString = class MagicString {
|
|
|
4824
4835
|
this._split(start);
|
|
4825
4836
|
this._split(end);
|
|
4826
4837
|
this._split(index);
|
|
4827
|
-
const first = this.byStart
|
|
4828
|
-
const last = this.byEnd
|
|
4838
|
+
const first = this.byStart.get(start);
|
|
4839
|
+
const last = this.byEnd.get(end);
|
|
4829
4840
|
const oldLeft = first.previous;
|
|
4830
4841
|
const oldRight = last.next;
|
|
4831
|
-
const newRight = this.byStart
|
|
4842
|
+
const newRight = this.byStart.get(index);
|
|
4832
4843
|
if (!newRight && last === this.lastChunk) return this;
|
|
4833
4844
|
const newLeft = newRight ? newRight.previous : this.lastChunk;
|
|
4834
4845
|
if (oldLeft) oldLeft.next = oldRight;
|
|
@@ -4900,12 +4911,12 @@ var MagicString = class MagicString {
|
|
|
4900
4911
|
enumerable: true
|
|
4901
4912
|
});
|
|
4902
4913
|
}
|
|
4903
|
-
const first = this.byStart
|
|
4904
|
-
const last = this.byEnd
|
|
4914
|
+
const first = this.byStart.get(start);
|
|
4915
|
+
const last = this.byEnd.get(end);
|
|
4905
4916
|
if (first) {
|
|
4906
4917
|
let chunk = first;
|
|
4907
4918
|
while (chunk !== last) {
|
|
4908
|
-
if (chunk.next !== this.byStart
|
|
4919
|
+
if (chunk.next !== this.byStart.get(chunk.end)) throw new Error("Cannot overwrite across a split point");
|
|
4909
4920
|
chunk = chunk.next;
|
|
4910
4921
|
chunk.edit("", false);
|
|
4911
4922
|
}
|
|
@@ -4932,7 +4943,7 @@ var MagicString = class MagicString {
|
|
|
4932
4943
|
index = index + this.offset;
|
|
4933
4944
|
if (typeof content !== "string") throw new TypeError("inserted content must be a string");
|
|
4934
4945
|
this._split(index);
|
|
4935
|
-
const chunk = this.byEnd
|
|
4946
|
+
const chunk = this.byEnd.get(index);
|
|
4936
4947
|
if (chunk) chunk.prependLeft(content);
|
|
4937
4948
|
else this.intro = content + this.intro;
|
|
4938
4949
|
return this;
|
|
@@ -4944,7 +4955,7 @@ var MagicString = class MagicString {
|
|
|
4944
4955
|
index = index + this.offset;
|
|
4945
4956
|
if (typeof content !== "string") throw new TypeError("inserted content must be a string");
|
|
4946
4957
|
this._split(index);
|
|
4947
|
-
const chunk = this.byStart
|
|
4958
|
+
const chunk = this.byStart.get(index);
|
|
4948
4959
|
if (chunk) chunk.prependRight(content);
|
|
4949
4960
|
else this.outro = content + this.outro;
|
|
4950
4961
|
return this;
|
|
@@ -4965,12 +4976,12 @@ var MagicString = class MagicString {
|
|
|
4965
4976
|
if (start > end) throw new Error("end must be greater than start");
|
|
4966
4977
|
this._split(start);
|
|
4967
4978
|
this._split(end);
|
|
4968
|
-
let chunk = this.byStart
|
|
4979
|
+
let chunk = this.byStart.get(start);
|
|
4969
4980
|
while (chunk) {
|
|
4970
4981
|
chunk.intro = "";
|
|
4971
4982
|
chunk.outro = "";
|
|
4972
4983
|
chunk.edit("");
|
|
4973
|
-
chunk = end > chunk.end ? this.byStart
|
|
4984
|
+
chunk = end > chunk.end ? this.byStart.get(chunk.end) : null;
|
|
4974
4985
|
}
|
|
4975
4986
|
return this;
|
|
4976
4987
|
}
|
|
@@ -4989,10 +5000,10 @@ var MagicString = class MagicString {
|
|
|
4989
5000
|
if (start > end) throw new Error("end must be greater than start");
|
|
4990
5001
|
this._split(start);
|
|
4991
5002
|
this._split(end);
|
|
4992
|
-
let chunk = this.byStart
|
|
5003
|
+
let chunk = this.byStart.get(start);
|
|
4993
5004
|
while (chunk) {
|
|
4994
5005
|
chunk.reset();
|
|
4995
|
-
chunk = end > chunk.end ? this.byStart
|
|
5006
|
+
chunk = end > chunk.end ? this.byStart.get(chunk.end) : null;
|
|
4996
5007
|
}
|
|
4997
5008
|
return this;
|
|
4998
5009
|
}
|
|
@@ -5078,13 +5089,13 @@ var MagicString = class MagicString {
|
|
|
5078
5089
|
}
|
|
5079
5090
|
/** @internal */
|
|
5080
5091
|
_split(index) {
|
|
5081
|
-
if (this.byStart
|
|
5092
|
+
if (this.byStart.get(index) || this.byEnd.get(index)) return;
|
|
5082
5093
|
let chunk = this.lastSearchedChunk;
|
|
5083
5094
|
let previousChunk = chunk;
|
|
5084
5095
|
const searchForward = index > chunk.end;
|
|
5085
5096
|
while (chunk) {
|
|
5086
5097
|
if (chunk.contains(index)) return this._splitChunk(chunk, index);
|
|
5087
|
-
chunk = searchForward ? this.byStart
|
|
5098
|
+
chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start);
|
|
5088
5099
|
if (chunk === previousChunk) return;
|
|
5089
5100
|
previousChunk = chunk;
|
|
5090
5101
|
}
|
|
@@ -5096,9 +5107,9 @@ var MagicString = class MagicString {
|
|
|
5096
5107
|
throw new Error(`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`);
|
|
5097
5108
|
}
|
|
5098
5109
|
const newChunk = chunk.split(index);
|
|
5099
|
-
this.byEnd
|
|
5100
|
-
this.byStart
|
|
5101
|
-
this.byEnd
|
|
5110
|
+
this.byEnd.set(index, chunk);
|
|
5111
|
+
this.byStart.set(index, newChunk);
|
|
5112
|
+
this.byEnd.set(newChunk.end, newChunk);
|
|
5102
5113
|
if (chunk === this.lastChunk) this.lastChunk = newChunk;
|
|
5103
5114
|
this.lastSearchedChunk = chunk;
|
|
5104
5115
|
return true;
|
|
@@ -5158,9 +5169,9 @@ var MagicString = class MagicString {
|
|
|
5158
5169
|
const aborted = chunk.trimEnd(rx);
|
|
5159
5170
|
if (chunk.end !== end) {
|
|
5160
5171
|
if (this.lastChunk === chunk) this.lastChunk = chunk.next;
|
|
5161
|
-
this.byEnd
|
|
5162
|
-
this.byStart
|
|
5163
|
-
this.byEnd
|
|
5172
|
+
this.byEnd.set(chunk.end, chunk);
|
|
5173
|
+
this.byStart.set(chunk.next.start, chunk.next);
|
|
5174
|
+
this.byEnd.set(chunk.next.end, chunk.next);
|
|
5164
5175
|
}
|
|
5165
5176
|
if (aborted) return true;
|
|
5166
5177
|
chunk = chunk.previous;
|
|
@@ -5185,9 +5196,9 @@ var MagicString = class MagicString {
|
|
|
5185
5196
|
const aborted = chunk.trimStart(rx);
|
|
5186
5197
|
if (chunk.end !== end) {
|
|
5187
5198
|
if (chunk === this.lastChunk) this.lastChunk = chunk.next;
|
|
5188
|
-
this.byEnd
|
|
5189
|
-
this.byStart
|
|
5190
|
-
this.byEnd
|
|
5199
|
+
this.byEnd.set(chunk.end, chunk);
|
|
5200
|
+
this.byStart.set(chunk.next.start, chunk.next);
|
|
5201
|
+
this.byEnd.set(chunk.next.end, chunk.next);
|
|
5191
5202
|
}
|
|
5192
5203
|
if (aborted) return true;
|
|
5193
5204
|
chunk = chunk.next;
|
|
@@ -5885,9 +5896,10 @@ function loadEnv(mode, envDir, prefixes = "VITE_") {
|
|
|
5885
5896
|
if (parsed.NODE_ENV && process.env.VITE_USER_NODE_ENV === void 0) process.env.VITE_USER_NODE_ENV = parsed.NODE_ENV;
|
|
5886
5897
|
if (parsed.BROWSER && process.env.BROWSER === void 0) process.env.BROWSER = parsed.BROWSER;
|
|
5887
5898
|
if (parsed.BROWSER_ARGS && process.env.BROWSER_ARGS === void 0) process.env.BROWSER_ARGS = parsed.BROWSER_ARGS;
|
|
5899
|
+
const processEnv = { ...process.env };
|
|
5888
5900
|
(0, import_main.expand)({
|
|
5889
5901
|
parsed,
|
|
5890
|
-
processEnv
|
|
5902
|
+
processEnv
|
|
5891
5903
|
});
|
|
5892
5904
|
for (const [key, value] of Object.entries(parsed)) if (prefixes.some((prefix) => key.startsWith(prefix))) env[key] = value;
|
|
5893
5905
|
for (const prefix of prefixes) Object.assign(env, getEnvs({ prefix }));
|
|
@@ -7230,9 +7242,7 @@ var require_vary = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7230
7242
|
list.push(header.substring(start, end));
|
|
7231
7243
|
start = end = i + 1;
|
|
7232
7244
|
break;
|
|
7233
|
-
default:
|
|
7234
|
-
end = i + 1;
|
|
7235
|
-
break;
|
|
7245
|
+
default: end = i + 1;
|
|
7236
7246
|
}
|
|
7237
7247
|
list.push(header.substring(start, end));
|
|
7238
7248
|
return list;
|
|
@@ -11570,6 +11580,22 @@ async function readFileIfExists(value) {
|
|
|
11570
11580
|
if (typeof value === "string") return fsp.readFile(path.resolve(value)).catch(() => value);
|
|
11571
11581
|
return value;
|
|
11572
11582
|
}
|
|
11583
|
+
async function getAvailableEphemeralPort(specifiedHost) {
|
|
11584
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
11585
|
+
let port = 0;
|
|
11586
|
+
let available = true;
|
|
11587
|
+
for (const host of [...wildcardHosts, specifiedHost]) {
|
|
11588
|
+
const availablePort = await tryListen(port, host).catch(() => port);
|
|
11589
|
+
if (availablePort == null) {
|
|
11590
|
+
available = false;
|
|
11591
|
+
break;
|
|
11592
|
+
}
|
|
11593
|
+
port = availablePort;
|
|
11594
|
+
}
|
|
11595
|
+
if (available) return port;
|
|
11596
|
+
}
|
|
11597
|
+
return null;
|
|
11598
|
+
}
|
|
11573
11599
|
async function isPortAvailable(port) {
|
|
11574
11600
|
for (const host of wildcardHosts) if (!await tryListen(port, host).catch(() => true)) return false;
|
|
11575
11601
|
return true;
|
|
@@ -11578,10 +11604,11 @@ function tryListen(port, host) {
|
|
|
11578
11604
|
return new Promise((resolve) => {
|
|
11579
11605
|
const server = net.createServer();
|
|
11580
11606
|
server.once("error", (e) => {
|
|
11581
|
-
server.close(() => resolve(e.code
|
|
11607
|
+
server.close(() => resolve(e.code === "EADDRINUSE" ? null : port));
|
|
11582
11608
|
});
|
|
11583
11609
|
server.once("listening", () => {
|
|
11584
|
-
server.
|
|
11610
|
+
const address = server.address();
|
|
11611
|
+
server.close(() => resolve(typeof address === "object" && address ? address.port : port));
|
|
11585
11612
|
});
|
|
11586
11613
|
server.listen(port, host);
|
|
11587
11614
|
});
|
|
@@ -11609,6 +11636,14 @@ async function tryBindServer(httpServer, port, host) {
|
|
|
11609
11636
|
const MAX_PORT = 65535;
|
|
11610
11637
|
async function httpServerStart(httpServer, serverOptions) {
|
|
11611
11638
|
const { port: startPort, strictPort, host, logger } = serverOptions;
|
|
11639
|
+
if (startPort === 0) {
|
|
11640
|
+
const port = await getAvailableEphemeralPort(host);
|
|
11641
|
+
if (port == null) throw new Error("No available ephemeral port found");
|
|
11642
|
+
const result = await tryBindServer(httpServer, port, host);
|
|
11643
|
+
if (result.success) return port;
|
|
11644
|
+
if (result.error.code !== "EADDRINUSE") throw result.error;
|
|
11645
|
+
throw new Error(`Port ${port} is already in use`);
|
|
11646
|
+
}
|
|
11612
11647
|
for (let port = startPort; port <= MAX_PORT; port++) {
|
|
11613
11648
|
const portAvailableOnWildcard = await isPortAvailable(port);
|
|
11614
11649
|
if (strictPort) {
|
|
@@ -11643,9 +11678,7 @@ function setClientErrorHandler(server, logger) {
|
|
|
11643
11678
|
case "ERR_HTTP_REQUEST_TIMEOUT":
|
|
11644
11679
|
msg = "408 Request Timeout";
|
|
11645
11680
|
break;
|
|
11646
|
-
default:
|
|
11647
|
-
msg = "400 Bad Request";
|
|
11648
|
-
break;
|
|
11681
|
+
default: msg = "400 Bad Request";
|
|
11649
11682
|
}
|
|
11650
11683
|
if (err.code === "ECONNRESET" || !socket.writable) return;
|
|
11651
11684
|
socket.end(`HTTP/1.1 ${msg}\r\nConnection: close\r\n\r\n`);
|
|
@@ -12027,7 +12060,6 @@ function analyze(expression) {
|
|
|
12027
12060
|
if (node.param) {
|
|
12028
12061
|
for (const name of extract_names(node.param)) if (node.param) current_scope.declarations.set(name, node.param);
|
|
12029
12062
|
}
|
|
12030
|
-
break;
|
|
12031
12063
|
}
|
|
12032
12064
|
context.next();
|
|
12033
12065
|
if (map.has(node) && current_scope !== null && current_scope.parent) current_scope = current_scope.parent;
|
|
@@ -12127,9 +12159,7 @@ function extract_identifiers(param, nodes = []) {
|
|
|
12127
12159
|
case "RestElement":
|
|
12128
12160
|
extract_identifiers(param.argument, nodes);
|
|
12129
12161
|
break;
|
|
12130
|
-
case "AssignmentPattern":
|
|
12131
|
-
extract_identifiers(param.left, nodes);
|
|
12132
|
-
break;
|
|
12162
|
+
case "AssignmentPattern": extract_identifiers(param.left, nodes);
|
|
12133
12163
|
}
|
|
12134
12164
|
return nodes;
|
|
12135
12165
|
}
|
|
@@ -13208,7 +13238,8 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13208
13238
|
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
13209
13239
|
const getPathInfo = (cmd, opt) => {
|
|
13210
13240
|
const colon = opt.colon || COLON;
|
|
13211
|
-
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
13241
|
+
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
13242
|
+
/* istanbul ignore next: very unusual */ "").split(colon)];
|
|
13212
13243
|
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
13213
13244
|
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
13214
13245
|
if (isWindows) {
|
|
@@ -14951,7 +14982,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14951
14982
|
const { mask: applyMask, toBuffer } = require_buffer_util();
|
|
14952
14983
|
const kByteLength = Symbol("kByteLength");
|
|
14953
14984
|
const maskBuffer = Buffer.alloc(4);
|
|
14954
|
-
const RANDOM_POOL_SIZE =
|
|
14985
|
+
const RANDOM_POOL_SIZE = 8192;
|
|
14955
14986
|
let randomPool;
|
|
14956
14987
|
let randomPoolPointer = RANDOM_POOL_SIZE;
|
|
14957
14988
|
const DEFAULT = 0;
|
|
@@ -16337,9 +16368,9 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
16337
16368
|
autoPong: true,
|
|
16338
16369
|
closeTimeout: CLOSE_TIMEOUT,
|
|
16339
16370
|
protocolVersion: protocolVersions[1],
|
|
16340
|
-
maxBufferedChunks:
|
|
16341
|
-
maxFragments:
|
|
16342
|
-
maxPayload:
|
|
16371
|
+
maxBufferedChunks: 262144,
|
|
16372
|
+
maxFragments: 16384,
|
|
16373
|
+
maxPayload: 104857600,
|
|
16343
16374
|
skipUTF8Validation: false,
|
|
16344
16375
|
perMessageDeflate: true,
|
|
16345
16376
|
followRedirects: false,
|
|
@@ -17016,9 +17047,9 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
17016
17047
|
options = {
|
|
17017
17048
|
allowSynchronousEvents: true,
|
|
17018
17049
|
autoPong: true,
|
|
17019
|
-
maxBufferedChunks:
|
|
17020
|
-
maxFragments:
|
|
17021
|
-
maxPayload:
|
|
17050
|
+
maxBufferedChunks: 262144,
|
|
17051
|
+
maxFragments: 16384,
|
|
17052
|
+
maxPayload: 104857600,
|
|
17022
17053
|
skipUTF8Validation: false,
|
|
17023
17054
|
perMessageDeflate: false,
|
|
17024
17055
|
handleProtocols: null,
|
|
@@ -17989,7 +18020,7 @@ var require_follow_redirects = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
17989
18020
|
function wrap(protocols) {
|
|
17990
18021
|
var exports$1 = {
|
|
17991
18022
|
maxRedirects: 21,
|
|
17992
|
-
maxBodyLength:
|
|
18023
|
+
maxBodyLength: 10485760
|
|
17993
18024
|
};
|
|
17994
18025
|
var nativeProtocols = {};
|
|
17995
18026
|
Object.keys(protocols).forEach(function(scheme) {
|
|
@@ -20697,402 +20728,404 @@ function getModuleTypeFromId(id) {
|
|
|
20697
20728
|
}
|
|
20698
20729
|
}
|
|
20699
20730
|
//#endregion
|
|
20700
|
-
//#region ../../node_modules/.pnpm/
|
|
20701
|
-
var
|
|
20702
|
-
|
|
20703
|
-
|
|
20704
|
-
|
|
20705
|
-
|
|
20706
|
-
|
|
20707
|
-
|
|
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
|
-
}
|
|
20731
|
+
//#region ../../node_modules/.pnpm/js-tokens@10.0.0/node_modules/js-tokens/index.js
|
|
20732
|
+
var HashbangComment;
|
|
20733
|
+
var Identifier;
|
|
20734
|
+
var JSXIdentifier;
|
|
20735
|
+
var JSXPunctuator;
|
|
20736
|
+
var JSXString;
|
|
20737
|
+
var JSXText;
|
|
20738
|
+
var KeywordsWithExpressionAfter;
|
|
20739
|
+
var KeywordsWithNoLineTerminatorAfter;
|
|
20740
|
+
var LineTerminatorSequence;
|
|
20741
|
+
var MultiLineComment;
|
|
20742
|
+
var Newline;
|
|
20743
|
+
var NumericLiteral;
|
|
20744
|
+
var Punctuator;
|
|
20745
|
+
var RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:[^\]\\\n\r\u2028\u2029]+|\\.)*\]?|[^\/[\\\n\r\u2028\u2029]+|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/uy;
|
|
20746
|
+
var SingleLineComment;
|
|
20747
|
+
var StringLiteral;
|
|
20748
|
+
var Template;
|
|
20749
|
+
var TokensNotPrecedingObjectLiteral;
|
|
20750
|
+
var TokensPrecedingExpression;
|
|
20751
|
+
var WhiteSpace;
|
|
20752
|
+
var jsTokens;
|
|
20753
|
+
Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y;
|
|
20754
|
+
Identifier = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]+|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/uy;
|
|
20755
|
+
StringLiteral = /(['"])(?:[^'"\\\n\r]+|(?!\1)['"]|\\(?:\r\n|[^]))*(\1)?/y;
|
|
20756
|
+
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;
|
|
20757
|
+
Template = /[`}](?:[^`\\$]+|\\[^]|\$(?!\{))*(`|\$\{)?/y;
|
|
20758
|
+
WhiteSpace = /[\t\v\f\ufeff\p{Zs}]+/uy;
|
|
20759
|
+
LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y;
|
|
20760
|
+
MultiLineComment = /\/\*(?:[^*]+|\*(?!\/))*(\*\/)?/y;
|
|
20761
|
+
SingleLineComment = /\/\/.*/y;
|
|
20762
|
+
HashbangComment = /^#!.*/;
|
|
20763
|
+
JSXPunctuator = /[<>.:={}]|\/(?![\/*])/y;
|
|
20764
|
+
JSXIdentifier = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/uy;
|
|
20765
|
+
JSXString = /(['"])(?:[^'"]+|(?!\1)['"])*(\1)?/y;
|
|
20766
|
+
JSXText = /[^<>{}]+/y;
|
|
20767
|
+
TokensPrecedingExpression = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/;
|
|
20768
|
+
TokensNotPrecedingObjectLiteral = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/;
|
|
20769
|
+
KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
|
|
20770
|
+
KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
|
|
20771
|
+
Newline = RegExp(LineTerminatorSequence.source);
|
|
20772
|
+
jsTokens = function* (input, { jsx = false } = {}) {
|
|
20773
|
+
var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
|
|
20774
|
+
({length} = input);
|
|
20775
|
+
lastIndex = 0;
|
|
20776
|
+
lastSignificantToken = "";
|
|
20777
|
+
stack = [{ tag: "JS" }];
|
|
20778
|
+
braces = [];
|
|
20779
|
+
parenNesting = 0;
|
|
20780
|
+
postfixIncDec = false;
|
|
20781
|
+
if (match = HashbangComment.exec(input)) {
|
|
20782
|
+
yield {
|
|
20783
|
+
type: "HashbangComment",
|
|
20784
|
+
value: match[0]
|
|
20785
|
+
};
|
|
20786
|
+
lastIndex = match[0].length;
|
|
20787
|
+
}
|
|
20788
|
+
while (lastIndex < length) {
|
|
20789
|
+
mode = stack[stack.length - 1];
|
|
20790
|
+
switch (mode.tag) {
|
|
20791
|
+
case "JS":
|
|
20792
|
+
case "JSNonExpressionParen":
|
|
20793
|
+
case "InterpolationInTemplate":
|
|
20794
|
+
case "InterpolationInJSX":
|
|
20795
|
+
if (input[lastIndex] === "/" && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
20796
|
+
RegularExpressionLiteral.lastIndex = lastIndex;
|
|
20797
|
+
if (match = RegularExpressionLiteral.exec(input)) {
|
|
20798
|
+
lastIndex = RegularExpressionLiteral.lastIndex;
|
|
20799
|
+
lastSignificantToken = match[0];
|
|
20800
|
+
postfixIncDec = true;
|
|
20801
|
+
yield {
|
|
20802
|
+
type: "RegularExpressionLiteral",
|
|
20803
|
+
value: match[0],
|
|
20804
|
+
closed: match[1] !== void 0 && match[1] !== "\\"
|
|
20805
|
+
};
|
|
20806
|
+
continue;
|
|
20777
20807
|
}
|
|
20778
|
-
|
|
20779
|
-
|
|
20780
|
-
|
|
20781
|
-
|
|
20782
|
-
|
|
20783
|
-
|
|
20784
|
-
|
|
20785
|
-
|
|
20786
|
-
|
|
20787
|
-
|
|
20788
|
-
|
|
20789
|
-
|
|
20790
|
-
|
|
20791
|
-
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
|
|
20795
|
-
|
|
20796
|
-
|
|
20797
|
-
|
|
20798
|
-
|
|
20799
|
-
}
|
|
20800
|
-
break;
|
|
20801
|
-
case "{":
|
|
20802
|
-
Punctuator.lastIndex = 0;
|
|
20803
|
-
isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken));
|
|
20804
|
-
braces.push(isExpression);
|
|
20808
|
+
}
|
|
20809
|
+
Punctuator.lastIndex = lastIndex;
|
|
20810
|
+
if (match = Punctuator.exec(input)) {
|
|
20811
|
+
punctuator = match[0];
|
|
20812
|
+
nextLastIndex = Punctuator.lastIndex;
|
|
20813
|
+
nextLastSignificantToken = punctuator;
|
|
20814
|
+
switch (punctuator) {
|
|
20815
|
+
case "(":
|
|
20816
|
+
if (lastSignificantToken === "?NonExpressionParenKeyword") stack.push({
|
|
20817
|
+
tag: "JSNonExpressionParen",
|
|
20818
|
+
nesting: parenNesting
|
|
20819
|
+
});
|
|
20820
|
+
parenNesting++;
|
|
20821
|
+
postfixIncDec = false;
|
|
20822
|
+
break;
|
|
20823
|
+
case ")":
|
|
20824
|
+
parenNesting--;
|
|
20825
|
+
postfixIncDec = true;
|
|
20826
|
+
if (mode.tag === "JSNonExpressionParen" && parenNesting === mode.nesting) {
|
|
20827
|
+
stack.pop();
|
|
20828
|
+
nextLastSignificantToken = "?NonExpressionParenEnd";
|
|
20805
20829
|
postfixIncDec = false;
|
|
20806
|
-
|
|
20807
|
-
|
|
20808
|
-
|
|
20809
|
-
|
|
20810
|
-
|
|
20811
|
-
|
|
20812
|
-
|
|
20813
|
-
|
|
20814
|
-
|
|
20815
|
-
|
|
20816
|
-
|
|
20817
|
-
|
|
20818
|
-
|
|
20819
|
-
|
|
20820
|
-
|
|
20821
|
-
|
|
20822
|
-
|
|
20823
|
-
|
|
20824
|
-
|
|
20825
|
-
|
|
20826
|
-
|
|
20827
|
-
|
|
20828
|
-
|
|
20829
|
-
|
|
20830
|
-
|
|
20831
|
-
|
|
20830
|
+
}
|
|
20831
|
+
break;
|
|
20832
|
+
case "{":
|
|
20833
|
+
Punctuator.lastIndex = 0;
|
|
20834
|
+
isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken));
|
|
20835
|
+
braces.push(isExpression);
|
|
20836
|
+
postfixIncDec = false;
|
|
20837
|
+
break;
|
|
20838
|
+
case "}":
|
|
20839
|
+
switch (mode.tag) {
|
|
20840
|
+
case "InterpolationInTemplate":
|
|
20841
|
+
if (braces.length === mode.nesting) {
|
|
20842
|
+
Template.lastIndex = lastIndex;
|
|
20843
|
+
match = Template.exec(input);
|
|
20844
|
+
lastIndex = Template.lastIndex;
|
|
20845
|
+
lastSignificantToken = match[0];
|
|
20846
|
+
if (match[1] === "${") {
|
|
20847
|
+
lastSignificantToken = "?InterpolationInTemplate";
|
|
20848
|
+
postfixIncDec = false;
|
|
20849
|
+
yield {
|
|
20850
|
+
type: "TemplateMiddle",
|
|
20851
|
+
value: match[0]
|
|
20852
|
+
};
|
|
20853
|
+
} else {
|
|
20854
|
+
stack.pop();
|
|
20855
|
+
postfixIncDec = true;
|
|
20856
|
+
yield {
|
|
20857
|
+
type: "TemplateTail",
|
|
20858
|
+
value: match[0],
|
|
20859
|
+
closed: match[1] === "`"
|
|
20860
|
+
};
|
|
20832
20861
|
}
|
|
20833
|
-
break;
|
|
20834
|
-
case "InterpolationInJSX": if (braces.length === mode.nesting) {
|
|
20835
|
-
stack.pop();
|
|
20836
|
-
lastIndex += 1;
|
|
20837
|
-
lastSignificantToken = "}";
|
|
20838
|
-
yield {
|
|
20839
|
-
type: "JSXPunctuator",
|
|
20840
|
-
value: "}"
|
|
20841
|
-
};
|
|
20842
20862
|
continue;
|
|
20843
20863
|
}
|
|
20844
|
-
|
|
20845
|
-
|
|
20846
|
-
|
|
20847
|
-
break;
|
|
20848
|
-
case "]":
|
|
20849
|
-
postfixIncDec = true;
|
|
20850
|
-
break;
|
|
20851
|
-
case "++":
|
|
20852
|
-
case "--":
|
|
20853
|
-
nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
|
|
20854
|
-
break;
|
|
20855
|
-
case "<":
|
|
20856
|
-
if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
20857
|
-
stack.push({ tag: "JSXTag" });
|
|
20864
|
+
break;
|
|
20865
|
+
case "InterpolationInJSX": if (braces.length === mode.nesting) {
|
|
20866
|
+
stack.pop();
|
|
20858
20867
|
lastIndex += 1;
|
|
20859
|
-
lastSignificantToken = "
|
|
20868
|
+
lastSignificantToken = "}";
|
|
20860
20869
|
yield {
|
|
20861
20870
|
type: "JSXPunctuator",
|
|
20862
|
-
value:
|
|
20871
|
+
value: "}"
|
|
20863
20872
|
};
|
|
20864
20873
|
continue;
|
|
20865
20874
|
}
|
|
20866
|
-
|
|
20867
|
-
|
|
20868
|
-
|
|
20869
|
-
|
|
20870
|
-
|
|
20871
|
-
|
|
20872
|
-
|
|
20873
|
-
|
|
20874
|
-
|
|
20875
|
-
|
|
20876
|
-
|
|
20875
|
+
}
|
|
20876
|
+
postfixIncDec = braces.pop();
|
|
20877
|
+
nextLastSignificantToken = postfixIncDec ? "?ExpressionBraceEnd" : "}";
|
|
20878
|
+
break;
|
|
20879
|
+
case "]":
|
|
20880
|
+
postfixIncDec = true;
|
|
20881
|
+
break;
|
|
20882
|
+
case "++":
|
|
20883
|
+
case "--":
|
|
20884
|
+
nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
|
|
20885
|
+
break;
|
|
20886
|
+
case "<":
|
|
20887
|
+
if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
20888
|
+
stack.push({ tag: "JSXTag" });
|
|
20889
|
+
lastIndex += 1;
|
|
20890
|
+
lastSignificantToken = "<";
|
|
20891
|
+
yield {
|
|
20892
|
+
type: "JSXPunctuator",
|
|
20893
|
+
value: punctuator
|
|
20894
|
+
};
|
|
20895
|
+
continue;
|
|
20896
|
+
}
|
|
20897
|
+
postfixIncDec = false;
|
|
20898
|
+
break;
|
|
20899
|
+
default: postfixIncDec = false;
|
|
20877
20900
|
}
|
|
20878
|
-
|
|
20879
|
-
|
|
20880
|
-
|
|
20881
|
-
|
|
20882
|
-
|
|
20883
|
-
|
|
20884
|
-
|
|
20885
|
-
|
|
20886
|
-
|
|
20887
|
-
|
|
20888
|
-
|
|
20889
|
-
|
|
20901
|
+
lastIndex = nextLastIndex;
|
|
20902
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
20903
|
+
yield {
|
|
20904
|
+
type: "Punctuator",
|
|
20905
|
+
value: punctuator
|
|
20906
|
+
};
|
|
20907
|
+
continue;
|
|
20908
|
+
}
|
|
20909
|
+
Identifier.lastIndex = lastIndex;
|
|
20910
|
+
if (match = Identifier.exec(input)) {
|
|
20911
|
+
lastIndex = Identifier.lastIndex;
|
|
20912
|
+
nextLastSignificantToken = match[0];
|
|
20913
|
+
switch (match[0]) {
|
|
20914
|
+
case "for":
|
|
20915
|
+
case "if":
|
|
20916
|
+
case "while":
|
|
20917
|
+
case "with": if (lastSignificantToken !== "." && lastSignificantToken !== "?.") nextLastSignificantToken = "?NonExpressionParenKeyword";
|
|
20918
|
+
}
|
|
20919
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
20920
|
+
postfixIncDec = !KeywordsWithExpressionAfter.test(match[0]);
|
|
20921
|
+
yield {
|
|
20922
|
+
type: match[1] === "#" ? "PrivateIdentifier" : "IdentifierName",
|
|
20923
|
+
value: match[0]
|
|
20924
|
+
};
|
|
20925
|
+
continue;
|
|
20926
|
+
}
|
|
20927
|
+
StringLiteral.lastIndex = lastIndex;
|
|
20928
|
+
if (match = StringLiteral.exec(input)) {
|
|
20929
|
+
lastIndex = StringLiteral.lastIndex;
|
|
20930
|
+
lastSignificantToken = match[0];
|
|
20931
|
+
postfixIncDec = true;
|
|
20932
|
+
yield {
|
|
20933
|
+
type: "StringLiteral",
|
|
20934
|
+
value: match[0],
|
|
20935
|
+
closed: match[2] !== void 0
|
|
20936
|
+
};
|
|
20937
|
+
continue;
|
|
20938
|
+
}
|
|
20939
|
+
NumericLiteral.lastIndex = lastIndex;
|
|
20940
|
+
if (match = NumericLiteral.exec(input)) {
|
|
20941
|
+
lastIndex = NumericLiteral.lastIndex;
|
|
20942
|
+
lastSignificantToken = match[0];
|
|
20943
|
+
postfixIncDec = true;
|
|
20944
|
+
yield {
|
|
20945
|
+
type: "NumericLiteral",
|
|
20946
|
+
value: match[0]
|
|
20947
|
+
};
|
|
20948
|
+
continue;
|
|
20949
|
+
}
|
|
20950
|
+
Template.lastIndex = lastIndex;
|
|
20951
|
+
if (match = Template.exec(input)) {
|
|
20952
|
+
lastIndex = Template.lastIndex;
|
|
20953
|
+
lastSignificantToken = match[0];
|
|
20954
|
+
if (match[1] === "${") {
|
|
20955
|
+
lastSignificantToken = "?InterpolationInTemplate";
|
|
20956
|
+
stack.push({
|
|
20957
|
+
tag: "InterpolationInTemplate",
|
|
20958
|
+
nesting: braces.length
|
|
20959
|
+
});
|
|
20960
|
+
postfixIncDec = false;
|
|
20890
20961
|
yield {
|
|
20891
|
-
type:
|
|
20962
|
+
type: "TemplateHead",
|
|
20892
20963
|
value: match[0]
|
|
20893
20964
|
};
|
|
20894
|
-
|
|
20895
|
-
}
|
|
20896
|
-
StringLiteral.lastIndex = lastIndex;
|
|
20897
|
-
if (match = StringLiteral.exec(input)) {
|
|
20898
|
-
lastIndex = StringLiteral.lastIndex;
|
|
20899
|
-
lastSignificantToken = match[0];
|
|
20965
|
+
} else {
|
|
20900
20966
|
postfixIncDec = true;
|
|
20901
20967
|
yield {
|
|
20902
|
-
type: "
|
|
20968
|
+
type: "NoSubstitutionTemplate",
|
|
20903
20969
|
value: match[0],
|
|
20904
|
-
closed: match[
|
|
20905
|
-
};
|
|
20906
|
-
continue;
|
|
20907
|
-
}
|
|
20908
|
-
NumericLiteral.lastIndex = lastIndex;
|
|
20909
|
-
if (match = NumericLiteral.exec(input)) {
|
|
20910
|
-
lastIndex = NumericLiteral.lastIndex;
|
|
20911
|
-
lastSignificantToken = match[0];
|
|
20912
|
-
postfixIncDec = true;
|
|
20913
|
-
yield {
|
|
20914
|
-
type: "NumericLiteral",
|
|
20915
|
-
value: match[0]
|
|
20970
|
+
closed: match[1] === "`"
|
|
20916
20971
|
};
|
|
20917
|
-
continue;
|
|
20918
20972
|
}
|
|
20919
|
-
|
|
20920
|
-
|
|
20921
|
-
|
|
20922
|
-
|
|
20923
|
-
|
|
20924
|
-
|
|
20973
|
+
continue;
|
|
20974
|
+
}
|
|
20975
|
+
break;
|
|
20976
|
+
case "JSXTag":
|
|
20977
|
+
case "JSXTagEnd":
|
|
20978
|
+
JSXPunctuator.lastIndex = lastIndex;
|
|
20979
|
+
if (match = JSXPunctuator.exec(input)) {
|
|
20980
|
+
lastIndex = JSXPunctuator.lastIndex;
|
|
20981
|
+
nextLastSignificantToken = match[0];
|
|
20982
|
+
switch (match[0]) {
|
|
20983
|
+
case "<":
|
|
20984
|
+
stack.push({ tag: "JSXTag" });
|
|
20985
|
+
break;
|
|
20986
|
+
case ">":
|
|
20987
|
+
stack.pop();
|
|
20988
|
+
if (lastSignificantToken === "/" || mode.tag === "JSXTagEnd") {
|
|
20989
|
+
nextLastSignificantToken = "?JSX";
|
|
20990
|
+
postfixIncDec = true;
|
|
20991
|
+
} else stack.push({ tag: "JSXChildren" });
|
|
20992
|
+
break;
|
|
20993
|
+
case "{":
|
|
20925
20994
|
stack.push({
|
|
20926
|
-
tag: "
|
|
20995
|
+
tag: "InterpolationInJSX",
|
|
20927
20996
|
nesting: braces.length
|
|
20928
20997
|
});
|
|
20998
|
+
nextLastSignificantToken = "?InterpolationInJSX";
|
|
20929
20999
|
postfixIncDec = false;
|
|
20930
|
-
|
|
20931
|
-
|
|
20932
|
-
|
|
20933
|
-
|
|
20934
|
-
|
|
20935
|
-
postfixIncDec = true;
|
|
20936
|
-
yield {
|
|
20937
|
-
type: "NoSubstitutionTemplate",
|
|
20938
|
-
value: match[0],
|
|
20939
|
-
closed: match[1] === "`"
|
|
20940
|
-
};
|
|
21000
|
+
break;
|
|
21001
|
+
case "/": if (lastSignificantToken === "<") {
|
|
21002
|
+
stack.pop();
|
|
21003
|
+
if (stack[stack.length - 1].tag === "JSXChildren") stack.pop();
|
|
21004
|
+
stack.push({ tag: "JSXTagEnd" });
|
|
20941
21005
|
}
|
|
20942
|
-
continue;
|
|
20943
21006
|
}
|
|
20944
|
-
|
|
20945
|
-
|
|
20946
|
-
|
|
20947
|
-
|
|
20948
|
-
|
|
20949
|
-
|
|
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
|
-
|
|
21007
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
21008
|
+
yield {
|
|
21009
|
+
type: "JSXPunctuator",
|
|
21010
|
+
value: match[0]
|
|
21011
|
+
};
|
|
21012
|
+
continue;
|
|
21013
|
+
}
|
|
21014
|
+
JSXIdentifier.lastIndex = lastIndex;
|
|
21015
|
+
if (match = JSXIdentifier.exec(input)) {
|
|
21016
|
+
lastIndex = JSXIdentifier.lastIndex;
|
|
21017
|
+
lastSignificantToken = match[0];
|
|
21018
|
+
yield {
|
|
21019
|
+
type: "JSXIdentifier",
|
|
21020
|
+
value: match[0]
|
|
21021
|
+
};
|
|
21022
|
+
continue;
|
|
21023
|
+
}
|
|
21024
|
+
JSXString.lastIndex = lastIndex;
|
|
21025
|
+
if (match = JSXString.exec(input)) {
|
|
21026
|
+
lastIndex = JSXString.lastIndex;
|
|
21027
|
+
lastSignificantToken = match[0];
|
|
21028
|
+
yield {
|
|
21029
|
+
type: "JSXString",
|
|
21030
|
+
value: match[0],
|
|
21031
|
+
closed: match[2] !== void 0
|
|
21032
|
+
};
|
|
21033
|
+
continue;
|
|
21034
|
+
}
|
|
21035
|
+
break;
|
|
21036
|
+
case "JSXChildren":
|
|
21037
|
+
JSXText.lastIndex = lastIndex;
|
|
21038
|
+
if (match = JSXText.exec(input)) {
|
|
21039
|
+
lastIndex = JSXText.lastIndex;
|
|
21040
|
+
lastSignificantToken = match[0];
|
|
21041
|
+
yield {
|
|
21042
|
+
type: "JSXText",
|
|
21043
|
+
value: match[0]
|
|
21044
|
+
};
|
|
21045
|
+
continue;
|
|
21046
|
+
}
|
|
21047
|
+
switch (input[lastIndex]) {
|
|
21048
|
+
case "<":
|
|
21049
|
+
stack.push({ tag: "JSXTag" });
|
|
21050
|
+
lastIndex++;
|
|
21051
|
+
lastSignificantToken = "<";
|
|
20977
21052
|
yield {
|
|
20978
21053
|
type: "JSXPunctuator",
|
|
20979
|
-
value:
|
|
21054
|
+
value: "<"
|
|
20980
21055
|
};
|
|
20981
21056
|
continue;
|
|
20982
|
-
|
|
20983
|
-
|
|
20984
|
-
|
|
20985
|
-
|
|
20986
|
-
|
|
20987
|
-
|
|
20988
|
-
|
|
20989
|
-
|
|
20990
|
-
};
|
|
20991
|
-
continue;
|
|
20992
|
-
}
|
|
20993
|
-
JSXString.lastIndex = lastIndex;
|
|
20994
|
-
if (match = JSXString.exec(input)) {
|
|
20995
|
-
lastIndex = JSXString.lastIndex;
|
|
20996
|
-
lastSignificantToken = match[0];
|
|
20997
|
-
yield {
|
|
20998
|
-
type: "JSXString",
|
|
20999
|
-
value: match[0],
|
|
21000
|
-
closed: match[2] !== void 0
|
|
21001
|
-
};
|
|
21002
|
-
continue;
|
|
21003
|
-
}
|
|
21004
|
-
break;
|
|
21005
|
-
case "JSXChildren":
|
|
21006
|
-
JSXText.lastIndex = lastIndex;
|
|
21007
|
-
if (match = JSXText.exec(input)) {
|
|
21008
|
-
lastIndex = JSXText.lastIndex;
|
|
21009
|
-
lastSignificantToken = match[0];
|
|
21057
|
+
case "{":
|
|
21058
|
+
stack.push({
|
|
21059
|
+
tag: "InterpolationInJSX",
|
|
21060
|
+
nesting: braces.length
|
|
21061
|
+
});
|
|
21062
|
+
lastIndex++;
|
|
21063
|
+
lastSignificantToken = "?InterpolationInJSX";
|
|
21064
|
+
postfixIncDec = false;
|
|
21010
21065
|
yield {
|
|
21011
|
-
type: "
|
|
21012
|
-
value:
|
|
21066
|
+
type: "JSXPunctuator",
|
|
21067
|
+
value: "{"
|
|
21013
21068
|
};
|
|
21014
21069
|
continue;
|
|
21015
|
-
|
|
21016
|
-
|
|
21017
|
-
|
|
21018
|
-
|
|
21019
|
-
|
|
21020
|
-
|
|
21021
|
-
|
|
21022
|
-
|
|
21023
|
-
|
|
21024
|
-
|
|
21025
|
-
|
|
21026
|
-
|
|
21027
|
-
|
|
21028
|
-
|
|
21029
|
-
|
|
21030
|
-
|
|
21031
|
-
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21035
|
-
|
|
21036
|
-
|
|
21037
|
-
|
|
21038
|
-
|
|
21039
|
-
|
|
21040
|
-
|
|
21041
|
-
WhiteSpace.lastIndex = lastIndex;
|
|
21042
|
-
if (match = WhiteSpace.exec(input)) {
|
|
21043
|
-
lastIndex = WhiteSpace.lastIndex;
|
|
21044
|
-
yield {
|
|
21045
|
-
type: "WhiteSpace",
|
|
21046
|
-
value: match[0]
|
|
21047
|
-
};
|
|
21048
|
-
continue;
|
|
21049
|
-
}
|
|
21050
|
-
LineTerminatorSequence.lastIndex = lastIndex;
|
|
21051
|
-
if (match = LineTerminatorSequence.exec(input)) {
|
|
21052
|
-
lastIndex = LineTerminatorSequence.lastIndex;
|
|
21070
|
+
}
|
|
21071
|
+
}
|
|
21072
|
+
WhiteSpace.lastIndex = lastIndex;
|
|
21073
|
+
if (match = WhiteSpace.exec(input)) {
|
|
21074
|
+
lastIndex = WhiteSpace.lastIndex;
|
|
21075
|
+
yield {
|
|
21076
|
+
type: "WhiteSpace",
|
|
21077
|
+
value: match[0]
|
|
21078
|
+
};
|
|
21079
|
+
continue;
|
|
21080
|
+
}
|
|
21081
|
+
LineTerminatorSequence.lastIndex = lastIndex;
|
|
21082
|
+
if (match = LineTerminatorSequence.exec(input)) {
|
|
21083
|
+
lastIndex = LineTerminatorSequence.lastIndex;
|
|
21084
|
+
postfixIncDec = false;
|
|
21085
|
+
if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere";
|
|
21086
|
+
yield {
|
|
21087
|
+
type: "LineTerminatorSequence",
|
|
21088
|
+
value: match[0]
|
|
21089
|
+
};
|
|
21090
|
+
continue;
|
|
21091
|
+
}
|
|
21092
|
+
MultiLineComment.lastIndex = lastIndex;
|
|
21093
|
+
if (match = MultiLineComment.exec(input)) {
|
|
21094
|
+
lastIndex = MultiLineComment.lastIndex;
|
|
21095
|
+
if (Newline.test(match[0])) {
|
|
21053
21096
|
postfixIncDec = false;
|
|
21054
21097
|
if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere";
|
|
21055
|
-
yield {
|
|
21056
|
-
type: "LineTerminatorSequence",
|
|
21057
|
-
value: match[0]
|
|
21058
|
-
};
|
|
21059
|
-
continue;
|
|
21060
21098
|
}
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
|
|
21064
|
-
|
|
21065
|
-
|
|
21066
|
-
|
|
21067
|
-
|
|
21068
|
-
|
|
21069
|
-
|
|
21070
|
-
|
|
21071
|
-
closed: match[1] !== void 0
|
|
21072
|
-
};
|
|
21073
|
-
continue;
|
|
21074
|
-
}
|
|
21075
|
-
SingleLineComment.lastIndex = lastIndex;
|
|
21076
|
-
if (match = SingleLineComment.exec(input)) {
|
|
21077
|
-
lastIndex = SingleLineComment.lastIndex;
|
|
21078
|
-
postfixIncDec = false;
|
|
21079
|
-
yield {
|
|
21080
|
-
type: "SingleLineComment",
|
|
21081
|
-
value: match[0]
|
|
21082
|
-
};
|
|
21083
|
-
continue;
|
|
21084
|
-
}
|
|
21085
|
-
firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex));
|
|
21086
|
-
lastIndex += firstCodePoint.length;
|
|
21087
|
-
lastSignificantToken = firstCodePoint;
|
|
21099
|
+
yield {
|
|
21100
|
+
type: "MultiLineComment",
|
|
21101
|
+
value: match[0],
|
|
21102
|
+
closed: match[1] !== void 0
|
|
21103
|
+
};
|
|
21104
|
+
continue;
|
|
21105
|
+
}
|
|
21106
|
+
SingleLineComment.lastIndex = lastIndex;
|
|
21107
|
+
if (match = SingleLineComment.exec(input)) {
|
|
21108
|
+
lastIndex = SingleLineComment.lastIndex;
|
|
21088
21109
|
postfixIncDec = false;
|
|
21089
21110
|
yield {
|
|
21090
|
-
type:
|
|
21091
|
-
value:
|
|
21111
|
+
type: "SingleLineComment",
|
|
21112
|
+
value: match[0]
|
|
21092
21113
|
};
|
|
21114
|
+
continue;
|
|
21093
21115
|
}
|
|
21094
|
-
|
|
21095
|
-
|
|
21116
|
+
firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex));
|
|
21117
|
+
lastIndex += firstCodePoint.length;
|
|
21118
|
+
lastSignificantToken = firstCodePoint;
|
|
21119
|
+
postfixIncDec = false;
|
|
21120
|
+
yield {
|
|
21121
|
+
type: mode.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid",
|
|
21122
|
+
value: firstCodePoint
|
|
21123
|
+
};
|
|
21124
|
+
}
|
|
21125
|
+
};
|
|
21126
|
+
var js_tokens_default = jsTokens;
|
|
21127
|
+
//#endregion
|
|
21128
|
+
//#region ../../node_modules/.pnpm/strip-literal@4.0.0/node_modules/strip-literal/dist/index.mjs
|
|
21096
21129
|
const FILL_COMMENT = " ";
|
|
21097
21130
|
function stripLiteralFromToken(token, fillChar, filter) {
|
|
21098
21131
|
if (token.type === "SingleLineComment") return FILL_COMMENT.repeat(token.value.length);
|
|
@@ -21130,10 +21163,13 @@ function optionsWithDefaults(options) {
|
|
|
21130
21163
|
filter: options?.filter ?? (() => true)
|
|
21131
21164
|
};
|
|
21132
21165
|
}
|
|
21166
|
+
/**
|
|
21167
|
+
* Strip literal from code.
|
|
21168
|
+
*/
|
|
21133
21169
|
function stripLiteral(code, options) {
|
|
21134
21170
|
let result = "";
|
|
21135
21171
|
const _options = optionsWithDefaults(options);
|
|
21136
|
-
for (const token of (
|
|
21172
|
+
for (const token of js_tokens_default(code, { jsx: false })) result += stripLiteralFromToken(token, _options.fillChar, _options.filter);
|
|
21137
21173
|
return result;
|
|
21138
21174
|
}
|
|
21139
21175
|
//#endregion
|
|
@@ -21375,7 +21411,8 @@ function assetPlugin(config) {
|
|
|
21375
21411
|
}
|
|
21376
21412
|
}
|
|
21377
21413
|
if (config.command === "build" && !this.environment.config.build.emitAssets) {
|
|
21378
|
-
|
|
21414
|
+
const chunkImportMapEnabled = this.environment.config.build.chunkImportMap;
|
|
21415
|
+
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];
|
|
21379
21416
|
}
|
|
21380
21417
|
},
|
|
21381
21418
|
watchChange(id) {
|
|
@@ -21852,7 +21889,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21852
21889
|
};
|
|
21853
21890
|
}));
|
|
21854
21891
|
//#endregion
|
|
21855
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
21892
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.25_tsx@4.23.1_yaml@2.9.0/node_modules/postcss-load-config/src/req.js
|
|
21856
21893
|
var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21857
21894
|
const { createRequire: createRequire$1 } = __require("node:module");
|
|
21858
21895
|
const { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1 } = __require("node:url");
|
|
@@ -21894,7 +21931,7 @@ var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21894
21931
|
module.exports = req;
|
|
21895
21932
|
}));
|
|
21896
21933
|
//#endregion
|
|
21897
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
21934
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.25_tsx@4.23.1_yaml@2.9.0/node_modules/postcss-load-config/src/options.js
|
|
21898
21935
|
var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21899
21936
|
const req = require_req();
|
|
21900
21937
|
/**
|
|
@@ -21928,7 +21965,7 @@ var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21928
21965
|
module.exports = options;
|
|
21929
21966
|
}));
|
|
21930
21967
|
//#endregion
|
|
21931
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
21968
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.25_tsx@4.23.1_yaml@2.9.0/node_modules/postcss-load-config/src/plugins.js
|
|
21932
21969
|
var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21933
21970
|
const req = require_req();
|
|
21934
21971
|
/**
|
|
@@ -21982,7 +22019,7 @@ var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21982
22019
|
module.exports = plugins;
|
|
21983
22020
|
}));
|
|
21984
22021
|
//#endregion
|
|
21985
|
-
//#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.25_tsx@4.23.1_yaml@2.9.0/node_modules/postcss-load-config/src/index.js
|
|
21986
22023
|
var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
21987
22024
|
const { resolve: resolve$3 } = __require("node:path");
|
|
21988
22025
|
const config = require_src$1();
|
|
@@ -22805,8 +22842,8 @@ function cssPostPlugin(config) {
|
|
|
22805
22842
|
});
|
|
22806
22843
|
}
|
|
22807
22844
|
}
|
|
22808
|
-
if (config.build.chunkImportMap && chunkCssReferences.size) {
|
|
22809
|
-
const importMap = getImportMap(bundle, config);
|
|
22845
|
+
if (this.environment.config.build.chunkImportMap && chunkCssReferences.size) {
|
|
22846
|
+
const importMap = getImportMap(bundle, this.environment.config);
|
|
22810
22847
|
const importMapReverseMapping = Object.fromEntries(Object.entries(importMap.mapping).map(([k, v]) => [v, k]));
|
|
22811
22848
|
const chunksByPreliminaryFileName = new Map(Object.values(bundle).filter((output) => output.type === "chunk").map((chunk) => [chunk.preliminaryFileName, chunk]));
|
|
22812
22849
|
for (const [chunkFileName, referenceId] of chunkCssReferences) {
|
|
@@ -22822,9 +22859,10 @@ function cssPostPlugin(config) {
|
|
|
22822
22859
|
if (pureCssChunks.size) {
|
|
22823
22860
|
const prelimaryNameToChunkMap = Object.fromEntries(Object.values(bundle).filter((chunk) => chunk.type === "chunk").map((chunk) => [chunk.preliminaryFileName, chunk.fileName]));
|
|
22824
22861
|
const pureCssChunkNames = [...pureCssChunks].map((pureCssChunk) => prelimaryNameToChunkMap[pureCssChunk.fileName]).filter(Boolean);
|
|
22862
|
+
const pureCssChunkNameSet = new Set(pureCssChunkNames);
|
|
22825
22863
|
let importMapReverseMapping;
|
|
22826
|
-
if (config.build.chunkImportMap) {
|
|
22827
|
-
const importMap = getImportMap(bundle, config);
|
|
22864
|
+
if (this.environment.config.build.chunkImportMap) {
|
|
22865
|
+
const importMap = getImportMap(bundle, this.environment.config);
|
|
22828
22866
|
importMapReverseMapping = Object.fromEntries(Object.entries(importMap.mapping).map(([k, v]) => [v, k]));
|
|
22829
22867
|
}
|
|
22830
22868
|
const replaceEmptyChunk = getEmptyChunkReplacer(importMapReverseMapping ? pureCssChunkNames.map((name) => importMapReverseMapping[name] ?? name) : pureCssChunkNames, opts.format);
|
|
@@ -22833,7 +22871,7 @@ function cssPostPlugin(config) {
|
|
|
22833
22871
|
if (chunk.type === "chunk") {
|
|
22834
22872
|
let chunkImportsPureCssChunk = false;
|
|
22835
22873
|
chunk.imports = chunk.imports.filter((file) => {
|
|
22836
|
-
if (
|
|
22874
|
+
if (pureCssChunkNameSet.has(file)) {
|
|
22837
22875
|
const { importedCss, importedAssets } = bundle[file].viteMetadata;
|
|
22838
22876
|
importedCss.forEach((file) => chunk.viteMetadata.importedCss.add(file));
|
|
22839
22877
|
importedAssets.forEach((file) => chunk.viteMetadata.importedAssets.add(file));
|
|
@@ -22874,12 +22912,13 @@ function injectInlinedCSS(s, ctx, code, format, injectCode) {
|
|
|
22874
22912
|
if (!m) ctx.error("Injection point for inlined CSS not found");
|
|
22875
22913
|
injectionPoint = m.index + m[0].length;
|
|
22876
22914
|
} else if (format === "es") if (code.startsWith("#!")) {
|
|
22877
|
-
const
|
|
22878
|
-
|
|
22915
|
+
const fileStartIndex = getFileStartIndex(code);
|
|
22916
|
+
const hashbang = code.slice(0, fileStartIndex);
|
|
22917
|
+
if (!lineTerminatorRE.test(hashbang)) {
|
|
22879
22918
|
s.append(`\n${injectCode}`);
|
|
22880
22919
|
return;
|
|
22881
22920
|
}
|
|
22882
|
-
injectionPoint =
|
|
22921
|
+
injectionPoint = fileStartIndex;
|
|
22883
22922
|
} else injectionPoint = 0;
|
|
22884
22923
|
else ctx.error("Non supported format");
|
|
22885
22924
|
s.appendRight(injectionPoint, injectCode);
|
|
@@ -23242,7 +23281,8 @@ async function resolvePostcssConfig(config) {
|
|
|
23242
23281
|
};
|
|
23243
23282
|
} else {
|
|
23244
23283
|
const searchPath = typeof inlineOptions === "string" ? inlineOptions : config.root;
|
|
23245
|
-
|
|
23284
|
+
const stopDir = searchForWorkspaceRoot(config.root);
|
|
23285
|
+
result = (0, import_src.default)({}, searchPath, { stopDir }).catch((e) => {
|
|
23246
23286
|
if (!e.message.includes("No PostCSS Config found")) if (e instanceof Error) {
|
|
23247
23287
|
const { name, message, stack } = e;
|
|
23248
23288
|
e.name = "Failed to load PostCSS config";
|
|
@@ -23383,10 +23423,12 @@ async function minifyCSS(css, config, inlined, filename = defaultCssBundleName)
|
|
|
23383
23423
|
const { code, warnings } = (await importLightningCSS()).transform({
|
|
23384
23424
|
...config.css.lightningcss,
|
|
23385
23425
|
targets: convertTargets(config.build.cssTarget),
|
|
23386
|
-
cssModules: void 0,
|
|
23387
23426
|
filename,
|
|
23388
23427
|
code: Buffer.from(css),
|
|
23389
|
-
minify: true
|
|
23428
|
+
minify: true,
|
|
23429
|
+
cssModules: void 0,
|
|
23430
|
+
visitor: void 0,
|
|
23431
|
+
customAtRules: void 0
|
|
23390
23432
|
});
|
|
23391
23433
|
for (const warning of warnings) {
|
|
23392
23434
|
let msg = `[lightningcss minify] ${warning.message}`;
|
|
@@ -23485,7 +23527,8 @@ function loadSassPackage(root, skipEmbedded = false) {
|
|
|
23485
23527
|
let cachedSss;
|
|
23486
23528
|
async function loadSss(root) {
|
|
23487
23529
|
if (!cachedSss) cachedSss = (async () => {
|
|
23488
|
-
|
|
23530
|
+
const sssPath = loadPreprocessorPath("sugarss", root);
|
|
23531
|
+
return cachedSss = (await import(pathToFileURL(sssPath).href)).default;
|
|
23489
23532
|
})();
|
|
23490
23533
|
return cachedSss;
|
|
23491
23534
|
}
|
|
@@ -24621,6 +24664,13 @@ function buildHtmlPlugin(config) {
|
|
|
24621
24664
|
assetTags.push(...getCssTagsForChunk(chunk, toOutputAssetFilePath));
|
|
24622
24665
|
result = injectToHead(result, assetTags);
|
|
24623
24666
|
}
|
|
24667
|
+
if (config.command === "serve" && this.environment.config.consumer === "client" && this.environment.config.isBundled) result = injectToHead(result, [{
|
|
24668
|
+
tag: "script",
|
|
24669
|
+
attrs: {
|
|
24670
|
+
type: "module",
|
|
24671
|
+
src: path.posix.join(config.base, BUNDLED_DEV_CLIENT_FILENAME)
|
|
24672
|
+
}
|
|
24673
|
+
}], true);
|
|
24624
24674
|
if (!this.environment.config.build.cssCodeSplit) {
|
|
24625
24675
|
const cssBundleName = cssBundleNameCache.get(config);
|
|
24626
24676
|
const cssChunk = cssBundleName && Object.values(bundle).find((chunk) => chunk.type === "asset" && chunk.names.includes(cssBundleName));
|
|
@@ -24718,7 +24768,7 @@ function preImportMapHook(config) {
|
|
|
24718
24768
|
function postImportMapHook(config) {
|
|
24719
24769
|
const decoder = new TextDecoder();
|
|
24720
24770
|
return function(html, { bundle }) {
|
|
24721
|
-
const chunkImportMapEnabled = config.command === "build" && config.build.chunkImportMap;
|
|
24771
|
+
const chunkImportMapEnabled = config.command === "build" && config.environments.client.build.chunkImportMap;
|
|
24722
24772
|
if (importMapAppendRE.test(html)) {
|
|
24723
24773
|
let importMap;
|
|
24724
24774
|
html = html.replace(importMapRE, (match) => {
|
|
@@ -24732,7 +24782,7 @@ function postImportMapHook(config) {
|
|
|
24732
24782
|
}
|
|
24733
24783
|
if (chunkImportMapEnabled) {
|
|
24734
24784
|
const nonce = config.html?.cspNonce;
|
|
24735
|
-
const importMap = bundle[getImportMapFilename(config)];
|
|
24785
|
+
const importMap = bundle[getImportMapFilename(config.environments.client)];
|
|
24736
24786
|
const importMapHtml = serializeTag({
|
|
24737
24787
|
tag: "script",
|
|
24738
24788
|
attrs: {
|
|
@@ -24956,23 +25006,29 @@ function serializeAttrs(attrs) {
|
|
|
24956
25006
|
function incrementIndent(indent = "") {
|
|
24957
25007
|
return `${indent}${indent[0] === " " ? " " : " "}`;
|
|
24958
25008
|
}
|
|
24959
|
-
function getImportMapFilename(
|
|
24960
|
-
const chunkImportMap =
|
|
25009
|
+
function getImportMapFilename(options) {
|
|
25010
|
+
const chunkImportMap = options.build.rolldownOptions.experimental?.chunkImportMap;
|
|
24961
25011
|
if (typeof chunkImportMap === "object" && chunkImportMap.fileName) return chunkImportMap.fileName;
|
|
24962
25012
|
return "importmap.json";
|
|
24963
25013
|
}
|
|
25014
|
+
function getImportMapBaseUrl(options) {
|
|
25015
|
+
const chunkImportMap = options.build.rolldownOptions.experimental?.chunkImportMap;
|
|
25016
|
+
if (typeof chunkImportMap === "object" && chunkImportMap.baseUrl) return chunkImportMap.baseUrl;
|
|
25017
|
+
return "/";
|
|
25018
|
+
}
|
|
24964
25019
|
/**
|
|
24965
25020
|
* Read and parse the chunk import map asset from the bundle.
|
|
24966
25021
|
* Returns `undefined` when the import map is not present in the bundle.
|
|
24967
25022
|
*/
|
|
24968
|
-
function getImportMap(bundle,
|
|
24969
|
-
const asset = bundle[getImportMapFilename(
|
|
25023
|
+
function getImportMap(bundle, options) {
|
|
25024
|
+
const asset = bundle[getImportMapFilename(options)];
|
|
24970
25025
|
if (!asset) return void 0;
|
|
24971
25026
|
const content = JSON.parse(typeof asset.source === "string" ? asset.source : new TextDecoder().decode(asset.source));
|
|
25027
|
+
const baseUrl = getImportMapBaseUrl(options);
|
|
24972
25028
|
return {
|
|
24973
25029
|
asset,
|
|
24974
25030
|
content,
|
|
24975
|
-
mapping: Object.fromEntries(Object.entries(content.imports).map(([k, v]) => [k.slice(
|
|
25031
|
+
mapping: Object.fromEntries(Object.entries(content.imports).map(([k, v]) => [k.slice(baseUrl.length), v.slice(baseUrl.length)]))
|
|
24976
25032
|
};
|
|
24977
25033
|
}
|
|
24978
25034
|
//#endregion
|
|
@@ -25431,7 +25487,7 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
|
|
|
25431
25487
|
else if (url[0] === "." || isBareRelative(url)) preTransformUrl = path.posix.join(config.base, getHtmlDirnameForRelativeUrl(htmlPath), url);
|
|
25432
25488
|
}
|
|
25433
25489
|
if (server) {
|
|
25434
|
-
const mod = server.environments.client.moduleGraph.urlToModuleMap.get(preTransformUrl || url);
|
|
25490
|
+
const mod = server.environments.client.moduleGraph.urlToModuleMap.get(stripBase(preTransformUrl || url, config.decodedBase));
|
|
25435
25491
|
if (mod && mod.lastHMRTimestamp > 0) url = injectQuery(url, `t=${mod.lastHMRTimestamp}`);
|
|
25436
25492
|
}
|
|
25437
25493
|
if (server && preTransformUrl) {
|
|
@@ -25581,7 +25637,7 @@ function indexHtmlMiddleware(root, server) {
|
|
|
25581
25637
|
}
|
|
25582
25638
|
const filePath = pathname.slice(1);
|
|
25583
25639
|
let file = fullBundle.memoryFiles.get(filePath);
|
|
25584
|
-
if (!file && fullBundle.
|
|
25640
|
+
if (!file && fullBundle.hasBuildOutput) return next();
|
|
25585
25641
|
if ([
|
|
25586
25642
|
"document",
|
|
25587
25643
|
"iframe",
|
|
@@ -26564,7 +26620,7 @@ async function startServer(server, hostname, inlinePort) {
|
|
|
26564
26620
|
if (!httpServer) throw new Error("Cannot call server.listen in middleware mode.");
|
|
26565
26621
|
const options = server.config.server;
|
|
26566
26622
|
const configPort = inlinePort ?? options.port;
|
|
26567
|
-
const port =
|
|
26623
|
+
const port = configPort === server._configServerPort ? server._currentServerPort ?? configPort : configPort;
|
|
26568
26624
|
server._configServerPort = configPort;
|
|
26569
26625
|
server._currentServerPort = await httpServerStart(httpServer, {
|
|
26570
26626
|
port,
|
|
@@ -26651,7 +26707,8 @@ async function resolveServerOptions(root, raw, logger) {
|
|
|
26651
26707
|
let allowDirs = server.fs.allow;
|
|
26652
26708
|
const cwd = searchForPackageRoot(root);
|
|
26653
26709
|
if (process.versions.pnp) try {
|
|
26654
|
-
const
|
|
26710
|
+
const enableGlobalCache = execSync("yarn config get enableGlobalCache", { cwd }).toString().trim() === "true";
|
|
26711
|
+
const yarnCacheDir = execSync(`yarn config get ${enableGlobalCache ? "globalFolder" : "cacheFolder"}`, { cwd }).toString().trim();
|
|
26655
26712
|
allowDirs.push(yarnCacheDir);
|
|
26656
26713
|
} catch (e) {
|
|
26657
26714
|
logger.warn(`Get yarn cache dir error: ${e.message}`, { timestamp: true });
|
|
@@ -26874,7 +26931,9 @@ function getSortedHotUpdatePlugins(environment) {
|
|
|
26874
26931
|
async function handleHMRUpdate(type, file, server) {
|
|
26875
26932
|
const { config } = server;
|
|
26876
26933
|
const mixedModuleGraph = ignoreDeprecationWarnings(() => server.moduleGraph);
|
|
26877
|
-
const
|
|
26934
|
+
const environmentSnapshot = server.environments;
|
|
26935
|
+
const environments = Object.values(environmentSnapshot);
|
|
26936
|
+
const isStale = () => server.environments !== environmentSnapshot;
|
|
26878
26937
|
const shortFile = getShortName(file, config.root);
|
|
26879
26938
|
const isConfig = file === config.configFile;
|
|
26880
26939
|
const isConfigDependency = config.configFileDependencies.some((name) => file === name);
|
|
@@ -26935,8 +26994,9 @@ async function handleHMRUpdate(type, file, server) {
|
|
|
26935
26994
|
const clientHotUpdateOptions = hotMap.get(clientEnvironment).options;
|
|
26936
26995
|
const ssrHotUpdateOptions = hotMap.get(ssrEnvironment)?.options;
|
|
26937
26996
|
try {
|
|
26938
|
-
for (const plugin of getSortedHotUpdatePlugins(
|
|
26997
|
+
for (const plugin of getSortedHotUpdatePlugins(clientEnvironment)) if (plugin.hotUpdate) {
|
|
26939
26998
|
const filteredModules = await getHookHandler(plugin.hotUpdate).call(clientContext, clientHotUpdateOptions);
|
|
26999
|
+
if (isStale()) return;
|
|
26940
27000
|
if (filteredModules) {
|
|
26941
27001
|
clientHotUpdateOptions.modules = filteredModules;
|
|
26942
27002
|
mixedHmrContext.modules = mixedHmrContext.modules.filter((mixedMod) => filteredModules.some((mod) => mixedMod.id === mod.id) || ssrHotUpdateOptions?.modules.some((ssrMod) => ssrMod.id === mixedMod.id));
|
|
@@ -26945,6 +27005,7 @@ async function handleHMRUpdate(type, file, server) {
|
|
|
26945
27005
|
} else if (type === "update") {
|
|
26946
27006
|
warnFutureDeprecation(config, "removePluginHookHandleHotUpdate", `Used in plugin "${plugin.name}".`, false);
|
|
26947
27007
|
const filteredModules = await getHookHandler(plugin.handleHotUpdate).call(contextForHandleHotUpdate, mixedHmrContext);
|
|
27008
|
+
if (isStale()) return;
|
|
26948
27009
|
if (filteredModules) {
|
|
26949
27010
|
mixedHmrContext.modules = filteredModules;
|
|
26950
27011
|
clientHotUpdateOptions.modules = clientHotUpdateOptions.modules.filter((mod) => filteredModules.some((mixedMod) => mod.id === mixedMod.id));
|
|
@@ -26956,7 +27017,8 @@ async function handleHMRUpdate(type, file, server) {
|
|
|
26956
27017
|
}
|
|
26957
27018
|
}
|
|
26958
27019
|
} catch (error) {
|
|
26959
|
-
|
|
27020
|
+
if (isStale()) return;
|
|
27021
|
+
hotMap.get(clientEnvironment).error = error;
|
|
26960
27022
|
}
|
|
26961
27023
|
for (const environment of environments) {
|
|
26962
27024
|
if (environment.name === "client") continue;
|
|
@@ -26965,13 +27027,16 @@ async function handleHMRUpdate(type, file, server) {
|
|
|
26965
27027
|
try {
|
|
26966
27028
|
for (const plugin of getSortedHotUpdatePlugins(environment)) if (plugin.hotUpdate) {
|
|
26967
27029
|
const filteredModules = await getHookHandler(plugin.hotUpdate).call(context, hot.options);
|
|
27030
|
+
if (isStale()) return;
|
|
26968
27031
|
if (filteredModules) hot.options.modules = filteredModules;
|
|
26969
27032
|
}
|
|
26970
27033
|
} catch (error) {
|
|
27034
|
+
if (isStale()) return;
|
|
26971
27035
|
hot.error = error;
|
|
26972
27036
|
}
|
|
26973
27037
|
}
|
|
26974
27038
|
async function hmr(environment) {
|
|
27039
|
+
if (isStale()) return;
|
|
26975
27040
|
try {
|
|
26976
27041
|
const { options, error } = hotMap.get(environment);
|
|
26977
27042
|
if (error) throw error;
|
|
@@ -26996,6 +27061,7 @@ async function handleHMRUpdate(type, file, server) {
|
|
|
26996
27061
|
});
|
|
26997
27062
|
}
|
|
26998
27063
|
}
|
|
27064
|
+
if (isStale()) return;
|
|
26999
27065
|
await (server.config.server.hotUpdateEnvironments ?? ((server, hmr) => {
|
|
27000
27066
|
return Promise.all(Object.values(server.environments).map((environment) => hmr(environment)));
|
|
27001
27067
|
}))(server, hmr);
|
|
@@ -27489,6 +27555,22 @@ async function workerFileToUrl(config, id) {
|
|
|
27489
27555
|
}, config.logger);
|
|
27490
27556
|
return bundle;
|
|
27491
27557
|
}
|
|
27558
|
+
/**
|
|
27559
|
+
* Emit the bundled worker files during `load` / `transform`.
|
|
27560
|
+
*
|
|
27561
|
+
* They normally reach the output through `generateBundle`, which an HMR patch
|
|
27562
|
+
* skips, so without this a patched worker points at a file that was never
|
|
27563
|
+
* emitted.
|
|
27564
|
+
*/
|
|
27565
|
+
function emitWorkerAssetsForBundledDev(pluginContext, config) {
|
|
27566
|
+
if (config.isWorker) return;
|
|
27567
|
+
const workerOutput = workerOutputCaches.get(config.mainConfig || config);
|
|
27568
|
+
for (const asset of workerOutput.getAssets()) pluginContext.emitFile({
|
|
27569
|
+
type: "asset",
|
|
27570
|
+
fileName: asset.fileName,
|
|
27571
|
+
source: asset.source
|
|
27572
|
+
});
|
|
27573
|
+
}
|
|
27492
27574
|
function webWorkerPostPlugin(_config) {
|
|
27493
27575
|
return {
|
|
27494
27576
|
name: "vite:worker-post",
|
|
@@ -27599,8 +27681,10 @@ function webWorkerPlugin(config) {
|
|
|
27599
27681
|
} else {
|
|
27600
27682
|
const result = await workerFileToUrl(config, id);
|
|
27601
27683
|
let url;
|
|
27602
|
-
if (this.environment.config.command === "serve" && this.environment.config.isBundled)
|
|
27603
|
-
|
|
27684
|
+
if (this.environment.config.command === "serve" && this.environment.config.isBundled) {
|
|
27685
|
+
emitWorkerAssetsForBundledDev(this, config);
|
|
27686
|
+
url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
|
|
27687
|
+
} else url = result.entryUrlPlaceholder;
|
|
27604
27688
|
urlCode = JSON.stringify(url);
|
|
27605
27689
|
for (const file of result.watchedFiles) this.addWatchFile(file);
|
|
27606
27690
|
}
|
|
@@ -27994,7 +28078,7 @@ function importAnalysisPlugin(config) {
|
|
|
27994
28078
|
config.safeModulePaths.add(fsPathFromUrl(stripBase(url, base)));
|
|
27995
28079
|
if (url !== specifier) {
|
|
27996
28080
|
let rewriteDone = false;
|
|
27997
|
-
if (!depsOptimizer?.isOptimizedDepFile(importer) && depsOptimizer?.isOptimizedDepFile(resolvedId) && !optimizedDepChunkRE.test(resolvedId)) {
|
|
28081
|
+
if (!(depsOptimizer?.isOptimizedDepFile(importer) && specifier[0] === ".") && depsOptimizer?.isOptimizedDepFile(resolvedId) && !optimizedDepChunkRE.test(resolvedId)) {
|
|
27998
28082
|
const file = cleanUrl(resolvedId);
|
|
27999
28083
|
const depInfo = optimizedDepInfoFromFile(depsOptimizer.metadata, file);
|
|
28000
28084
|
const needsInterop = await optimizedDepNeedsInterop(environment, depsOptimizer.metadata, file);
|
|
@@ -28631,8 +28715,10 @@ function workerImportMetaUrlPlugin(config) {
|
|
|
28631
28715
|
let builtUrl;
|
|
28632
28716
|
if (isBundled) {
|
|
28633
28717
|
const result = await workerFileToUrl(config, file);
|
|
28634
|
-
if (this.environment.config.command === "serve")
|
|
28635
|
-
|
|
28718
|
+
if (this.environment.config.command === "serve") {
|
|
28719
|
+
emitWorkerAssetsForBundledDev(this, config);
|
|
28720
|
+
builtUrl = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
|
|
28721
|
+
} else builtUrl = result.entryUrlPlaceholder;
|
|
28636
28722
|
for (const file of result.watchedFiles) this.addWatchFile(file);
|
|
28637
28723
|
} else {
|
|
28638
28724
|
builtUrl = await fileToUrl$1(this, cleanUrl(file));
|
|
@@ -28836,8 +28922,8 @@ function buildImportAnalysisPlugin(config) {
|
|
|
28836
28922
|
const { modulePreload } = this.environment.config.build;
|
|
28837
28923
|
let importMapMapping;
|
|
28838
28924
|
let importMapReverseMapping;
|
|
28839
|
-
if (config.build.chunkImportMap) {
|
|
28840
|
-
const importMap = getImportMap(bundle, config);
|
|
28925
|
+
if (this.environment.config.build.chunkImportMap) {
|
|
28926
|
+
const importMap = getImportMap(bundle, this.environment.config);
|
|
28841
28927
|
importMapMapping = importMap.mapping;
|
|
28842
28928
|
importMapReverseMapping = Object.fromEntries(Object.entries(importMapMapping).map(([k, v]) => [v, k]));
|
|
28843
28929
|
if (config.isOutputOptionsForLegacyChunks?.(opts)) {
|
|
@@ -28846,7 +28932,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
28846
28932
|
fileName: "importmap.legacy.json",
|
|
28847
28933
|
source: importMap.asset.source
|
|
28848
28934
|
});
|
|
28849
|
-
delete bundle[getImportMapFilename(config)];
|
|
28935
|
+
delete bundle[getImportMapFilename(this.environment.config)];
|
|
28850
28936
|
}
|
|
28851
28937
|
}
|
|
28852
28938
|
for (const file in bundle) {
|
|
@@ -28955,7 +29041,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
28955
29041
|
}
|
|
28956
29042
|
if (fileDeps.length > 0) {
|
|
28957
29043
|
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`;
|
|
28958
|
-
if (code.startsWith("#!")) s.prependLeft(code
|
|
29044
|
+
if (code.startsWith("#!")) s.prependLeft(getFileStartIndex(code), mapDepsCode);
|
|
28959
29045
|
else s.prepend(mapDepsCode);
|
|
28960
29046
|
}
|
|
28961
29047
|
let markerStartPos = findPreloadMarker(code);
|
|
@@ -28990,8 +29076,9 @@ function buildImportAnalysisPlugin(config) {
|
|
|
28990
29076
|
}
|
|
28991
29077
|
}
|
|
28992
29078
|
}, perEnvironmentPlugin("native:import-analysis-build", (environment) => {
|
|
29079
|
+
const preloadCode = getPreloadCode(environment, !!renderBuiltUrl, isRelativeBase);
|
|
28993
29080
|
return viteBuildImportAnalysisPlugin({
|
|
28994
|
-
preloadCode
|
|
29081
|
+
preloadCode,
|
|
28995
29082
|
insertPreload: getInsertPreload(environment),
|
|
28996
29083
|
optimizeModulePreloadRelativePaths: false,
|
|
28997
29084
|
renderBuiltUrl: !!renderBuiltUrl,
|
|
@@ -29454,7 +29541,8 @@ async function parseImportGlob(code, importer, root, resolveId, logger) {
|
|
|
29454
29541
|
};
|
|
29455
29542
|
const end = findCorrespondingCloseParenthesisPosition(cleanCode, start + match[0].length) + 1;
|
|
29456
29543
|
if (end <= 0) throw err("Close parenthesis not found");
|
|
29457
|
-
const
|
|
29544
|
+
const statementCode = code.slice(start, end);
|
|
29545
|
+
const rootAst = (await parseAstAsync(statementCode)).body[0];
|
|
29458
29546
|
if (rootAst.type !== "ExpressionStatement") throw err(`Expect CallExpression, got ${rootAst.type}`);
|
|
29459
29547
|
const ast = rootAst.expression;
|
|
29460
29548
|
if (ast.type !== "CallExpression") throw err(`Expect CallExpression, got ${ast.type}`);
|
|
@@ -29531,9 +29619,10 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
|
|
|
29531
29619
|
const s = new MagicString(code);
|
|
29532
29620
|
const staticImports = (await Promise.all(matches.map(async ({ globsResolved, isRelative, options, index, start, end, onlyKeys, onlyValues }) => {
|
|
29533
29621
|
if (!dir && !options.base && isRelative) throw new Error("In virtual modules, all globs must start with '/'");
|
|
29622
|
+
const cwd = getCommonBase(globsResolved) ?? root;
|
|
29534
29623
|
const files = (await glob(globsResolved, {
|
|
29535
29624
|
absolute: true,
|
|
29536
|
-
cwd
|
|
29625
|
+
cwd,
|
|
29537
29626
|
dot: !!options.exhaustive,
|
|
29538
29627
|
expandDirectories: false,
|
|
29539
29628
|
caseSensitiveMatch: options.caseSensitive ?? true,
|
|
@@ -29679,7 +29768,8 @@ function patternToIdFilter(pattern, cwd) {
|
|
|
29679
29768
|
pattern.lastIndex = 0;
|
|
29680
29769
|
return result;
|
|
29681
29770
|
};
|
|
29682
|
-
const
|
|
29771
|
+
const glob = getMatcherString(pattern, cwd);
|
|
29772
|
+
const matcher = pm(glob, { dot: true });
|
|
29683
29773
|
return (id) => {
|
|
29684
29774
|
const normalizedId = slash(id);
|
|
29685
29775
|
return matcher(normalizedId);
|
|
@@ -30622,7 +30712,11 @@ var EnvironmentPluginContainer = class {
|
|
|
30622
30712
|
}
|
|
30623
30713
|
this._started = true;
|
|
30624
30714
|
const config = this.environment.getTopLevelConfig();
|
|
30625
|
-
|
|
30715
|
+
const hookPromise = this.handleHookPromise(this.hookParallel("buildStart", (plugin) => this._getPluginContext(plugin), () => [this.options], (plugin) => this.environment.name === "client" || config.server.perEnvironmentStartEndDuringDev || plugin.perEnvironmentStartEndDuringDev));
|
|
30716
|
+
this._buildStartPromise = (async () => {
|
|
30717
|
+
await hookPromise;
|
|
30718
|
+
if (this.environment.mode === "dev") await this.environment._registerInputsAsSafeModules();
|
|
30719
|
+
})();
|
|
30626
30720
|
await this._buildStartPromise;
|
|
30627
30721
|
this._buildStartPromise = void 0;
|
|
30628
30722
|
}
|
|
@@ -31286,11 +31380,10 @@ function scanImports(environment) {
|
|
|
31286
31380
|
async function computeEntries(environment) {
|
|
31287
31381
|
let entries = [];
|
|
31288
31382
|
const explicitEntryPatterns = environment.config.optimizeDeps.entries;
|
|
31289
|
-
const
|
|
31383
|
+
const input = environment.config.input ?? environment.config.build.rolldownOptions.input;
|
|
31290
31384
|
if (explicitEntryPatterns) entries = await globEntries(explicitEntryPatterns, environment);
|
|
31291
|
-
else if (
|
|
31385
|
+
else if (input) {
|
|
31292
31386
|
const resolvePath = async (p) => {
|
|
31293
|
-
if (environment.config.input) return p;
|
|
31294
31387
|
const id = (await environment.pluginContainer.resolveId(p, void 0, {
|
|
31295
31388
|
isEntry: true,
|
|
31296
31389
|
scan: true
|
|
@@ -31298,9 +31391,9 @@ async function computeEntries(environment) {
|
|
|
31298
31391
|
if (id === void 0) throw new Error(`failed to resolve rolldownOptions.input value: ${JSON.stringify(p)}.`);
|
|
31299
31392
|
return id;
|
|
31300
31393
|
};
|
|
31301
|
-
if (typeof
|
|
31302
|
-
else if (Array.isArray(
|
|
31303
|
-
else if (isObject$1(
|
|
31394
|
+
if (typeof input === "string") entries = [await resolvePath(input)];
|
|
31395
|
+
else if (Array.isArray(input)) entries = await Promise.all(input.map(resolvePath));
|
|
31396
|
+
else if (isObject$1(input)) entries = await Promise.all(Object.values(input).map(resolvePath));
|
|
31304
31397
|
else throw new Error("invalid rolldownOptions.input value.");
|
|
31305
31398
|
} else entries = await globEntries("**/*.html", environment);
|
|
31306
31399
|
entries = entries.filter((entry) => isScannable(entry, environment.config.optimizeDeps.extensions) && fs.existsSync(entry));
|
|
@@ -32573,7 +32666,7 @@ async function optimizedDepNeedsInterop(environment, metadata, file) {
|
|
|
32573
32666
|
}
|
|
32574
32667
|
return depInfo?.needsInterop;
|
|
32575
32668
|
}
|
|
32576
|
-
const MAX_TEMP_DIR_AGE_MS =
|
|
32669
|
+
const MAX_TEMP_DIR_AGE_MS = 864e5;
|
|
32577
32670
|
async function cleanupDepsCacheStaleDirs(config) {
|
|
32578
32671
|
try {
|
|
32579
32672
|
const cacheDir = path.resolve(config.cacheDir);
|
|
@@ -33441,7 +33534,10 @@ function resolveBuildEnvironmentOptions(raw, logger, consumer, isBundledDev, inp
|
|
|
33441
33534
|
platform: consumer === "client" || isSsrTargetWebworkerEnvironment ? "browser" : "node",
|
|
33442
33535
|
...merged.rolldownOptions
|
|
33443
33536
|
};
|
|
33444
|
-
if (merged.lib && merged.lib.entry == null && input != null) merged.lib
|
|
33537
|
+
if (merged.lib && merged.lib.entry == null && input != null) merged.lib = {
|
|
33538
|
+
...merged.lib,
|
|
33539
|
+
entry: input
|
|
33540
|
+
};
|
|
33445
33541
|
if (merged.target === "baseline-widely-available") merged.target = ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET;
|
|
33446
33542
|
if (Array.isArray(merged.target)) merged.target = unique(merged.target);
|
|
33447
33543
|
if (merged.minify === "false") merged.minify = false;
|
|
@@ -33505,7 +33601,7 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
|
|
|
33505
33601
|
const resolve = (p) => path.resolve(root, p);
|
|
33506
33602
|
const topLevelInput = environment.config.input;
|
|
33507
33603
|
if (libOptions && libOptions.entry == null) throw new Error(`Either "build.lib.entry" or the top-level "input" option is required when "build.lib" is set.`);
|
|
33508
|
-
const input = libOptions ? options.rolldownOptions.input || (typeof libOptions.entry === "string" ? resolve(libOptions.entry) : Array.isArray(libOptions.entry) ? libOptions.entry.map(resolve) : Object.fromEntries(Object.entries(libOptions.entry).map(([alias, file]) => [alias, resolve(file)]))) : typeof options.ssr === "string" ? resolve(options.ssr) : options.rolldownOptions.input || (topLevelInput
|
|
33604
|
+
const input = libOptions ? options.rolldownOptions.input || (typeof libOptions.entry === "string" ? resolve(libOptions.entry) : Array.isArray(libOptions.entry) ? libOptions.entry.map(resolve) : Object.fromEntries(Object.entries(libOptions.entry).map(([alias, file]) => [alias, resolve(file)]))) : typeof options.ssr === "string" ? resolve(options.ssr) : options.rolldownOptions.input || (topLevelInput ?? resolve("index.html"));
|
|
33509
33605
|
if (ssr && typeof input === "string" && input.endsWith(".html")) throw new Error("rolldownOptions.input should not be an html file when building for SSR. Please specify a dedicated SSR entry.");
|
|
33510
33606
|
if (options.cssCodeSplit === false) {
|
|
33511
33607
|
if ((typeof input === "string" ? [input] : Array.isArray(input) ? input : Object.values(input)).some((input) => input.endsWith(".css"))) throw new Error(`When "build.cssCodeSplit: false" is set, "rolldownOptions.input" should not include CSS files.`);
|
|
@@ -33537,7 +33633,10 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
|
|
|
33537
33633
|
experimental: {
|
|
33538
33634
|
...options.rolldownOptions.experimental,
|
|
33539
33635
|
viteMode: true,
|
|
33540
|
-
chunkImportMap: options.chunkImportMap ? {
|
|
33636
|
+
chunkImportMap: options.chunkImportMap ? {
|
|
33637
|
+
...typeof options.rolldownOptions.experimental?.chunkImportMap === "object" ? options.rolldownOptions.experimental?.chunkImportMap : {},
|
|
33638
|
+
baseUrl: base
|
|
33639
|
+
} : options.rolldownOptions.experimental?.chunkImportMap
|
|
33541
33640
|
}
|
|
33542
33641
|
};
|
|
33543
33642
|
const isSsrTargetWebworkerEnvironment = environment.name === "ssr" && environment.getTopLevelConfig().ssr?.target === "webworker";
|
|
@@ -33815,9 +33914,7 @@ function injectEnvironmentToHooks(environment, chunkMetadataMap, plugin) {
|
|
|
33815
33914
|
case "transform":
|
|
33816
33915
|
clone[hook] = wrapEnvironmentTransform(environment, transform, plugin.name);
|
|
33817
33916
|
break;
|
|
33818
|
-
default:
|
|
33819
|
-
if (ROLLUP_HOOKS.includes(hook)) clone[hook] = wrapEnvironmentHook(environment, chunkMetadataMap, plugin, hook);
|
|
33820
|
-
break;
|
|
33917
|
+
default: if (ROLLUP_HOOKS.includes(hook)) clone[hook] = wrapEnvironmentHook(environment, chunkMetadataMap, plugin, hook);
|
|
33821
33918
|
}
|
|
33822
33919
|
return clone;
|
|
33823
33920
|
}
|
|
@@ -34381,7 +34478,7 @@ function createDepsOptimizer(environment) {
|
|
|
34381
34478
|
logOptimizeDepsIncludeSuggestion("speed up cold start");
|
|
34382
34479
|
warnAboutMissedDependencies = false;
|
|
34383
34480
|
}
|
|
34384
|
-
},
|
|
34481
|
+
}, 200);
|
|
34385
34482
|
} else debug$2(import_picocolors.default.green(!isRerun ? `dependencies optimized` : `optimized dependencies unchanged`));
|
|
34386
34483
|
} else if (newDepsDiscovered) {
|
|
34387
34484
|
processingResult.cancel();
|
|
@@ -34920,6 +35017,7 @@ var MemoryFiles = class {
|
|
|
34920
35017
|
var BundledDev = class {
|
|
34921
35018
|
environment;
|
|
34922
35019
|
_devEngine;
|
|
35020
|
+
viteRuntime;
|
|
34923
35021
|
initialBuildCompleted = false;
|
|
34924
35022
|
_closed = false;
|
|
34925
35023
|
clients = new Clients();
|
|
@@ -34931,6 +35029,16 @@ var BundledDev = class {
|
|
|
34931
35029
|
this.environment.logger.info(import_picocolors.default.green(`page reload`), { timestamp: true });
|
|
34932
35030
|
});
|
|
34933
35031
|
fullReloadPending = false;
|
|
35032
|
+
reloadNeededClientIds = /* @__PURE__ */ new Set();
|
|
35033
|
+
debouncedReloadNeededFlush = debounce(20, () => {
|
|
35034
|
+
if (this.lastBuildError || this.reloadNeededClientIds.size === 0) return;
|
|
35035
|
+
for (const clientId of this.reloadNeededClientIds) this.clients.get(clientId)?.send({
|
|
35036
|
+
type: "full-reload",
|
|
35037
|
+
path: "*"
|
|
35038
|
+
});
|
|
35039
|
+
this.reloadNeededClientIds.clear();
|
|
35040
|
+
this.environment.logger.info(import_picocolors.default.green(`page reload`), { timestamp: true });
|
|
35041
|
+
});
|
|
34934
35042
|
lastBuildError = null;
|
|
34935
35043
|
memoryFiles = new MemoryFiles();
|
|
34936
35044
|
constructor(environment) {
|
|
@@ -34942,6 +35050,9 @@ var BundledDev = class {
|
|
|
34942
35050
|
return this._devEngine;
|
|
34943
35051
|
}
|
|
34944
35052
|
pendingPayloadFilenames = /* @__PURE__ */ new Set();
|
|
35053
|
+
get hasBuildOutput() {
|
|
35054
|
+
return this.memoryFiles.size > 1 || this.memoryFiles.size === 1 && !this.memoryFiles.has("bundledDevClient.mjs");
|
|
35055
|
+
}
|
|
34945
35056
|
async listen() {
|
|
34946
35057
|
this._closed = false;
|
|
34947
35058
|
debug$1?.("INITIAL: setup bundle options");
|
|
@@ -34963,11 +35074,26 @@ var BundledDev = class {
|
|
|
34963
35074
|
});
|
|
34964
35075
|
this.environment.hot.on("vite:client:disconnect", (_payload, client) => {
|
|
34965
35076
|
const clientId = this.clients.delete(client);
|
|
34966
|
-
if (clientId)
|
|
35077
|
+
if (clientId) {
|
|
35078
|
+
this.devEngine.removeClient(clientId);
|
|
35079
|
+
this.reloadNeededClientIds.delete(clientId);
|
|
35080
|
+
}
|
|
35081
|
+
});
|
|
35082
|
+
this.environment.hot.on("vite:bundled-dev:reload-needed", (payload, client) => {
|
|
35083
|
+
const clientId = this.clients.getId(client);
|
|
35084
|
+
if (!clientId) return;
|
|
35085
|
+
debug$1?.(`TRIGGER: client ${clientId} requested a page reload (${payload.reason})`);
|
|
35086
|
+
this.environment.logger.info(import_picocolors.default.green(`bundling for page reload `) + import_picocolors.default.dim(payload.reason), {
|
|
35087
|
+
clear: true,
|
|
35088
|
+
timestamp: true
|
|
35089
|
+
});
|
|
35090
|
+
this.reloadNeededClientIds.add(clientId);
|
|
35091
|
+
this.ensureOutputAndFlushReloadNeeded();
|
|
34967
35092
|
});
|
|
34968
35093
|
this._devEngine = await dev(rolldownOptions, outputOptions, {
|
|
34969
35094
|
onHmrUpdates: (result) => {
|
|
34970
35095
|
if (result instanceof Error) {
|
|
35096
|
+
this.environment.logger.error(import_picocolors.default.red(`✘ Build error: ${result.message}`), { error: result });
|
|
34971
35097
|
for (const client of this.clients.getAll()) client.send({
|
|
34972
35098
|
type: "error",
|
|
34973
35099
|
err: prepareError(result)
|
|
@@ -34984,6 +35110,7 @@ var BundledDev = class {
|
|
|
34984
35110
|
const client = this.clients.get(clientId);
|
|
34985
35111
|
if (client) this.handleHmrOutput(client, changedFiles, update);
|
|
34986
35112
|
}
|
|
35113
|
+
if (this.reloadNeededClientIds.size) this.ensureOutputAndFlushReloadNeeded();
|
|
34987
35114
|
},
|
|
34988
35115
|
onOutput: (result) => {
|
|
34989
35116
|
if (result instanceof Error) {
|
|
@@ -35002,6 +35129,7 @@ var BundledDev = class {
|
|
|
35002
35129
|
this.fullReloadPending = false;
|
|
35003
35130
|
this.debouncedFullReload();
|
|
35004
35131
|
}
|
|
35132
|
+
if (this.reloadNeededClientIds.size) this.debouncedReloadNeededFlush();
|
|
35005
35133
|
},
|
|
35006
35134
|
onAdditionalAssets: (result) => {
|
|
35007
35135
|
this.storeOutputFiles(result.output);
|
|
@@ -35014,6 +35142,8 @@ var BundledDev = class {
|
|
|
35014
35142
|
}, (e) => {
|
|
35015
35143
|
debug$1?.("INITIAL: run error", e);
|
|
35016
35144
|
});
|
|
35145
|
+
this.viteRuntime = await getHmrImplementation(this.environment.getTopLevelConfig());
|
|
35146
|
+
this.storeOutputFiles([]);
|
|
35017
35147
|
this.waitForInitialBuildFinish().then(() => {
|
|
35018
35148
|
if (this._closed) return;
|
|
35019
35149
|
debug$1?.("INITIAL: build done");
|
|
@@ -35030,7 +35160,7 @@ var BundledDev = class {
|
|
|
35030
35160
|
await this.devEngine.ensureCurrentBuildFinish();
|
|
35031
35161
|
if (this._closed) return;
|
|
35032
35162
|
let state = await this.devEngine.getBundleState();
|
|
35033
|
-
while (this.
|
|
35163
|
+
while (!this.hasBuildOutput && !state.lastBuildErrored) {
|
|
35034
35164
|
await setTimeout$1(10);
|
|
35035
35165
|
if (this._closed) return;
|
|
35036
35166
|
await this.devEngine.ensureCurrentBuildFinish();
|
|
@@ -35038,6 +35168,9 @@ var BundledDev = class {
|
|
|
35038
35168
|
state = await this.devEngine.getBundleState();
|
|
35039
35169
|
}
|
|
35040
35170
|
}
|
|
35171
|
+
ensureOutputAndFlushReloadNeeded() {
|
|
35172
|
+
this.devEngine.ensureLatestBuildOutput().then(() => this.debouncedReloadNeededFlush(), () => {});
|
|
35173
|
+
}
|
|
35041
35174
|
async triggerBundleRegenerationIfStale() {
|
|
35042
35175
|
const bundleState = await this.devEngine.getBundleState();
|
|
35043
35176
|
if (this.initialBuildCompleted && bundleState.lastBuildErrored && bundleState.lastErrorStage === "Hmr") {
|
|
@@ -35081,6 +35214,10 @@ var BundledDev = class {
|
|
|
35081
35214
|
this.initialBuildCompleted = false;
|
|
35082
35215
|
}
|
|
35083
35216
|
storeOutputFiles(output) {
|
|
35217
|
+
if (this.viteRuntime) this.memoryFiles.set(BUNDLED_DEV_CLIENT_FILENAME, {
|
|
35218
|
+
source: this.viteRuntime,
|
|
35219
|
+
etag: (0, import_etag.default)(Buffer.from(this.viteRuntime), { weak: true })
|
|
35220
|
+
});
|
|
35084
35221
|
for (const outputFile of output) this.memoryFiles.set(outputFile.fileName, () => {
|
|
35085
35222
|
const source = outputFile.type === "chunk" ? outputFile.code : outputFile.source;
|
|
35086
35223
|
return {
|
|
@@ -35096,23 +35233,11 @@ var BundledDev = class {
|
|
|
35096
35233
|
rolldownOptions.experimental.devMode = {
|
|
35097
35234
|
lazy: true,
|
|
35098
35235
|
...typeof rolldownOptions.experimental.devMode === "object" ? rolldownOptions.experimental.devMode : {},
|
|
35099
|
-
implement:
|
|
35236
|
+
implement: "",
|
|
35237
|
+
skipCommonRuntimeInjection: true
|
|
35100
35238
|
};
|
|
35101
35239
|
rolldownOptions.optimization ??= {};
|
|
35102
35240
|
rolldownOptions.optimization.inlineConst = false;
|
|
35103
|
-
const plugins = await asyncFlatten([rolldownOptions.plugins]);
|
|
35104
|
-
for (const plugin of plugins) {
|
|
35105
|
-
const transform = plugin && "transform" in plugin ? plugin.transform : void 0;
|
|
35106
|
-
if (!transform) continue;
|
|
35107
|
-
const handler = typeof transform === "function" ? transform : transform.handler;
|
|
35108
|
-
const wrappedHandler = function(code, id, opts) {
|
|
35109
|
-
if (id.includes("?rolldown-lazy=")) return null;
|
|
35110
|
-
return handler.call(this, code, id, opts);
|
|
35111
|
-
};
|
|
35112
|
-
if (typeof transform === "function") plugin.transform = wrappedHandler;
|
|
35113
|
-
else transform.handler = wrappedHandler;
|
|
35114
|
-
}
|
|
35115
|
-
rolldownOptions.plugins = plugins;
|
|
35116
35241
|
if (Array.isArray(rolldownOptions.output)) for (const output of rolldownOptions.output) {
|
|
35117
35242
|
output.entryFileNames = "assets/[name].js";
|
|
35118
35243
|
output.chunkFileNames = "assets/[name]-[hash].js";
|
|
@@ -35175,6 +35300,9 @@ var Clients = class {
|
|
|
35175
35300
|
get(id) {
|
|
35176
35301
|
return this.idToClient.get(id);
|
|
35177
35302
|
}
|
|
35303
|
+
getId(client) {
|
|
35304
|
+
return this.clientToId.get(client);
|
|
35305
|
+
}
|
|
35178
35306
|
getAll() {
|
|
35179
35307
|
return Array.from(this.idToClient.values());
|
|
35180
35308
|
}
|
|
@@ -35290,6 +35418,23 @@ var DevEnvironment = class extends BaseEnvironment {
|
|
|
35290
35418
|
this._initiated = true;
|
|
35291
35419
|
this._pluginContainer = await createEnvironmentPluginContainer(this, this.config.plugins, options?.watcher);
|
|
35292
35420
|
}
|
|
35421
|
+
/** @internal */
|
|
35422
|
+
async _registerInputsAsSafeModules() {
|
|
35423
|
+
const input = this.config.input;
|
|
35424
|
+
const entries = input == null ? ["index.html"] : typeof input === "string" ? [input] : Array.isArray(input) ? input : Object.values(input);
|
|
35425
|
+
const resolveEntries = async () => {
|
|
35426
|
+
const resolvedEntries = await Promise.all(entries.map((entry) => this.pluginContainer.resolveId(entry, void 0, {
|
|
35427
|
+
isEntry: true,
|
|
35428
|
+
scan: true
|
|
35429
|
+
})));
|
|
35430
|
+
for (const resolved of resolvedEntries) if (resolved && !resolved.external) {
|
|
35431
|
+
const resolvedId = cleanUrl(resolved.id);
|
|
35432
|
+
if (path.isAbsolute(resolvedId)) this.getTopLevelConfig().safeModulePaths.add(resolvedId);
|
|
35433
|
+
}
|
|
35434
|
+
};
|
|
35435
|
+
if (input == null) await resolveEntries().catch(() => {});
|
|
35436
|
+
else await resolveEntries();
|
|
35437
|
+
}
|
|
35293
35438
|
/**
|
|
35294
35439
|
* When the dev server is restarted, the methods are called in the following order:
|
|
35295
35440
|
* - new instance `init`
|
|
@@ -35715,9 +35860,7 @@ function analyzeConfigModuleReferences(code, ast, file) {
|
|
|
35715
35860
|
case "ExportAllDeclaration":
|
|
35716
35861
|
if (node.source) addImportRef(node.source, hasTypeJson(node.attributes));
|
|
35717
35862
|
break;
|
|
35718
|
-
case "ImportExpression":
|
|
35719
|
-
if (node.source.type === "Literal" && typeof node.source.value === "string") addImportRef(node.source, node.options != null);
|
|
35720
|
-
break;
|
|
35863
|
+
case "ImportExpression": if (node.source.type === "Literal" && typeof node.source.value === "string") addImportRef(node.source, node.options != null);
|
|
35721
35864
|
}
|
|
35722
35865
|
} });
|
|
35723
35866
|
const globals = [];
|
|
@@ -35758,7 +35901,7 @@ function findEsmSyntaxInCjs(code, ast, file) {
|
|
|
35758
35901
|
}
|
|
35759
35902
|
}
|
|
35760
35903
|
function describeIncompatibility(item, root) {
|
|
35761
|
-
const loc = `${normalizePath(path.relative(root, item.file))}:${item.line}`;
|
|
35904
|
+
const loc = `${normalizePath(path.relative(root, item.file))}:${item.line}:${item.column + 1}`;
|
|
35762
35905
|
switch (item.type) {
|
|
35763
35906
|
case "dirname": return `\`__dirname\` (${loc}). Use \`import.meta.dirname\` instead`;
|
|
35764
35907
|
case "filename": return `\`__filename\` (${loc}). Use \`import.meta.filename\` instead`;
|
|
@@ -36144,21 +36287,12 @@ const configDefaults = Object.freeze({
|
|
|
36144
36287
|
environments: {},
|
|
36145
36288
|
appType: "spa"
|
|
36146
36289
|
});
|
|
36147
|
-
function
|
|
36290
|
+
function normalizeInput(input) {
|
|
36148
36291
|
if (input === void 0) return;
|
|
36149
|
-
if (typeof input === "string")
|
|
36150
|
-
|
|
36151
|
-
return normalizePath(path.resolve(root, unescapedInput));
|
|
36152
|
-
}
|
|
36153
|
-
if (Array.isArray(input)) return input.map((inp) => {
|
|
36154
|
-
const unescapedInput = unescapeGlobCharacters(inp);
|
|
36155
|
-
return normalizePath(path.resolve(root, unescapedInput));
|
|
36156
|
-
});
|
|
36292
|
+
if (typeof input === "string") return unescapeGlobCharacters(input);
|
|
36293
|
+
if (Array.isArray(input)) return input.map(unescapeGlobCharacters);
|
|
36157
36294
|
const resolved = {};
|
|
36158
|
-
for (const key in input)
|
|
36159
|
-
const unescapedInput = unescapeGlobCharacters(input[key]);
|
|
36160
|
-
resolved[key] = normalizePath(path.resolve(root, unescapedInput));
|
|
36161
|
-
}
|
|
36295
|
+
for (const key in input) resolved[key] = unescapeGlobCharacters(input[key]);
|
|
36162
36296
|
return resolved;
|
|
36163
36297
|
}
|
|
36164
36298
|
const escapedGlobCharactersRE = /\\([*?[\]{}()!+@|])/g;
|
|
@@ -36180,7 +36314,7 @@ function resolveDevEnvironmentOptions(dev, environmentName, consumer, preTransfo
|
|
|
36180
36314
|
sourcemapIgnoreList: resolved.sourcemapIgnoreList === false ? () => false : resolved.sourcemapIgnoreList
|
|
36181
36315
|
};
|
|
36182
36316
|
}
|
|
36183
|
-
function resolveEnvironmentOptions(options, alias, preserveSymlinks,
|
|
36317
|
+
function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimizeDeps, logger, environmentName, isBuild, isBundledDev, isSsrTargetWebworkerSet, preTransformRequests) {
|
|
36184
36318
|
const isClientEnvironment = environmentName === "client";
|
|
36185
36319
|
const consumer = options.consumer ?? (isClientEnvironment ? "client" : "server");
|
|
36186
36320
|
const isSsrTargetWebworkerEnvironment = isSsrTargetWebworkerSet && environmentName === "ssr";
|
|
@@ -36194,7 +36328,7 @@ function resolveEnvironmentOptions(options, alias, preserveSymlinks, root, force
|
|
|
36194
36328
|
}
|
|
36195
36329
|
const resolve = resolveEnvironmentResolveOptions(options.resolve, alias, preserveSymlinks, logger, consumer, isSsrTargetWebworkerEnvironment);
|
|
36196
36330
|
return {
|
|
36197
|
-
input:
|
|
36331
|
+
input: normalizeInput(options.input),
|
|
36198
36332
|
define: options.define,
|
|
36199
36333
|
resolve,
|
|
36200
36334
|
keepProcessEnv: options.keepProcessEnv ?? (isSsrTargetWebworkerEnvironment ? false : consumer === "server"),
|
|
@@ -36453,7 +36587,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
36453
36587
|
config.resolve.mainFields = config.environments.client.resolve?.mainFields;
|
|
36454
36588
|
const resolvedDefaultResolve = resolveResolveOptions(config.resolve, logger);
|
|
36455
36589
|
const resolvedEnvironments = {};
|
|
36456
|
-
for (const environmentName of Object.keys(config.environments)) resolvedEnvironments[environmentName] = resolveEnvironmentOptions(config.environments[environmentName], resolvedDefaultResolve.alias, resolvedDefaultResolve.preserveSymlinks,
|
|
36590
|
+
for (const environmentName of Object.keys(config.environments)) resolvedEnvironments[environmentName] = resolveEnvironmentOptions(config.environments[environmentName], resolvedDefaultResolve.alias, resolvedDefaultResolve.preserveSymlinks, inlineConfig.forceOptimizeDeps, logger, environmentName, isBuild, isBundledDev, config.ssr?.target === "webworker", config.server?.preTransformRequests);
|
|
36457
36591
|
const backwardCompatibleOptimizeDeps = resolvedEnvironments.client.optimizeDeps;
|
|
36458
36592
|
const resolvedDevEnvironmentOptions = resolveDevEnvironmentOptions(config.dev, void 0, void 0);
|
|
36459
36593
|
const resolvedBuildOptions = resolveBuildEnvironmentOptions(config.build ?? {}, logger, void 0, isBundledDev, config.input);
|
|
@@ -36489,6 +36623,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
36489
36623
|
const assetsFilter = config.assetsInclude && (!Array.isArray(config.assetsInclude) || config.assetsInclude.length) ? createFilter$1(config.assetsInclude) : () => false;
|
|
36490
36624
|
const { publicDir } = config;
|
|
36491
36625
|
const resolvedPublicDir = publicDir !== false && publicDir !== "" ? normalizePath(path.resolve(resolvedRoot, typeof publicDir === "string" ? publicDir : configDefaults.publicDir)) : "";
|
|
36626
|
+
const input = normalizeInput(config.input);
|
|
36492
36627
|
const server = await resolveServerOptions(resolvedRoot, config.server, logger);
|
|
36493
36628
|
const builder = resolveBuilderOptions(config.builder);
|
|
36494
36629
|
const BASE_URL = resolvedBase;
|
|
@@ -36613,7 +36748,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
36613
36748
|
removeSsrLoadModule: "warn"
|
|
36614
36749
|
} : config.future,
|
|
36615
36750
|
ssr,
|
|
36616
|
-
input
|
|
36751
|
+
input,
|
|
36617
36752
|
optimizeDeps: backwardCompatibleOptimizeDeps,
|
|
36618
36753
|
resolve: resolvedDefaultResolve,
|
|
36619
36754
|
dev: resolvedDevEnvironmentOptions,
|
|
@@ -36866,9 +37001,9 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
36866
37001
|
} else injectValues += `const ${importMetaResolveVarName} = (specifier, importer = ${importMetaUrlVarName}) => { throw new Error('import.meta.resolve is not supported in CJS config files') };`;
|
|
36867
37002
|
let injectedContents;
|
|
36868
37003
|
if (code.startsWith("#!")) {
|
|
36869
|
-
|
|
36870
|
-
|
|
36871
|
-
injectedContents =
|
|
37004
|
+
const fileStartIndex = getFileStartIndex(code);
|
|
37005
|
+
const hashbang = code.slice(0, fileStartIndex);
|
|
37006
|
+
injectedContents = hashbang + (lineTerminatorRE.test(hashbang) ? "" : "\n") + injectValues + code.slice(fileStartIndex);
|
|
36872
37007
|
} else injectedContents = injectValues + code;
|
|
36873
37008
|
return {
|
|
36874
37009
|
code: injectedContents,
|
|
@@ -36949,10 +37084,11 @@ async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
|
|
|
36949
37084
|
}
|
|
36950
37085
|
async function runConfigHook(config, plugins, configEnv) {
|
|
36951
37086
|
let conf = config;
|
|
36952
|
-
const
|
|
37087
|
+
const tempLogger = createLogger(config.logLevel, {
|
|
36953
37088
|
allowClearScreen: config.clearScreen,
|
|
36954
37089
|
customLogger: config.customLogger
|
|
36955
|
-
})
|
|
37090
|
+
});
|
|
37091
|
+
const context = new BasicMinimalPluginContext(basePluginContextMeta, tempLogger);
|
|
36956
37092
|
for (const p of getSortedPluginsByHook("config", plugins)) {
|
|
36957
37093
|
const hook = p.config;
|
|
36958
37094
|
const res = await getHookHandler(hook).call(context, conf, configEnv);
|