@voidzero-dev/vite-plus-core 0.2.8 → 0.2.9
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 +30 -1
- package/dist/rolldown/cli.mjs +14 -10
- package/dist/rolldown/config.d.mts +1 -1
- package/dist/rolldown/config.mjs +2 -2
- package/dist/rolldown/experimental-index.d.mts +2 -2
- package/dist/rolldown/experimental-index.mjs +8 -8
- package/dist/rolldown/filter-index.d.mts +1 -1
- package/dist/rolldown/index.d.mts +1 -1
- package/dist/rolldown/index.mjs +4 -4
- package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
- package/dist/rolldown/parallel-plugin.d.mts +1 -1
- package/dist/rolldown/parse-ast-index.mjs +1 -1
- package/dist/rolldown/plugins-index.d.mts +2 -2
- package/dist/rolldown/plugins-index.mjs +2 -2
- package/dist/rolldown/shared/binding-CKyeQZen.mjs +673 -0
- package/dist/rolldown/shared/{bindingify-input-options-B03y7DfJ.mjs → bindingify-input-options-44iPAymO.mjs} +6 -10
- package/dist/rolldown/shared/{constructors-COwFYQna.mjs → constructors-6Zc-JFd7.mjs} +1 -1
- package/dist/rolldown/shared/{constructors-ALilxAii.d.mts → constructors-XaIbWpwJ.d.mts} +1 -1
- package/dist/rolldown/shared/{create-bundler-option-B-tSTZRt.mjs → create-bundler-option-e1FU0w0P.mjs} +3 -3
- package/dist/rolldown/shared/{define-config-DSMNXceb.d.mts → define-config-DVsXPNaU.d.mts} +0 -4
- package/dist/rolldown/shared/{error-nLggAzpQ.mjs → error-BzLGqhSQ.mjs} +1 -1
- package/dist/rolldown/shared/{load-config-O4G7NVNA.mjs → load-config-C6QXSnoS.mjs} +1 -1
- package/dist/rolldown/shared/{normalize-string-or-regex-Cj-DgIV1.mjs → normalize-string-or-regex-DYjJ67tj.mjs} +1 -1
- package/dist/rolldown/shared/{parse-CQfUbVuN.mjs → parse-uDDyc1el.mjs} +2 -2
- package/dist/rolldown/shared/{resolve-tsconfig-CE3HNSOK.mjs → resolve-tsconfig-Bcd82vVT.mjs} +2 -2
- package/dist/rolldown/shared/{rolldown-qV_fUwyM.mjs → rolldown-CCbQNGZt.mjs} +4 -4
- package/dist/rolldown/shared/{watch-BNIsji74.mjs → watch-vuOCmvFs.mjs} +5 -5
- package/dist/rolldown/utils-index.d.mts +1 -1
- package/dist/rolldown/utils-index.mjs +15 -13
- package/dist/tsdown/{build-D_enfyvD-X5SFXZZc.js → build-D_enfyvD-Dg1eKRD4.js} +20 -16
- package/dist/tsdown/{debug-CKcBYQLP-avlAPNcV.js → debug-CKcBYQLP-C3NhYhrk.js} +3 -3
- package/dist/tsdown/{detect-DGhJGEqb-CGd2brAW.js → detect-DGhJGEqb-6CTf16BW.js} +1 -1
- package/dist/tsdown/{dist-BZO8q3c0.js → dist-DyXLnzyh.js} +4 -4
- package/dist/tsdown/index-types.d.ts +3 -3
- package/dist/tsdown/index.js +4 -4
- package/dist/tsdown/internal-DKworeK4.js +3 -0
- package/dist/tsdown/{main-Jz_9T-KA.js → main-DiierkER.js} +210 -196
- package/dist/tsdown/npm_entry_picomatch.cjs +10 -6
- package/dist/tsdown/npm_entry_tree-kill.cjs +4 -2
- package/dist/tsdown/{resolver-cwLsPb2o-BqQjnCbF.js → resolver-cwLsPb2o-Dk4xdAGE.js} +2 -2
- package/dist/tsdown/run.js +6 -6
- package/dist/tsdown/{src-D5keKqGd.js → src-drVPfX63.js} +1 -1
- package/dist/tsdown/{target-Bab3CUeB-CERZYTwS.js → target-Bab3CUeB-DQ0pKhCv.js} +5 -5
- package/dist/tsdown/{tsc-DmzrnJwy.js → tsc-JnMl2z7d.js} +3 -3
- package/dist/tsdown/tsdown-css.js +4 -4
- package/dist/tsdown/tsdown-exe.js +4 -4
- package/dist/vite/client/bundledDevClient.mjs +330 -14
- package/dist/vite/client/client.mjs +20 -14
- package/dist/vite/node/chunks/build.js +51 -45
- package/dist/vite/node/chunks/dist.js +36 -29
- package/dist/vite/node/chunks/dist2.js +193 -149
- package/dist/vite/node/chunks/node.js +931 -793
- package/dist/vite/node/chunks/postcss-import.js +10 -9
- package/dist/vite/node/index.d.ts +7 -5
- package/dist/vite/node/module-runner.js +23 -17
- package/package.json +26 -20
- package/dist/rolldown/shared/binding-DwUQWZOo.mjs +0 -662
- package/dist/tsdown/internal-DyaNxVWW.js +0 -3
|
@@ -1180,10 +1180,12 @@ var require_parse$4 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1180
1180
|
}
|
|
1181
1181
|
return esc ? m : `\\${m}`;
|
|
1182
1182
|
});
|
|
1183
|
-
if (backslashes === true)
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1183
|
+
if (backslashes === true) {
|
|
1184
|
+
if (opts.unescape === true) output = output.replace(/\\/g, "");
|
|
1185
|
+
else output = output.replace(/\\+/g, (m) => {
|
|
1186
|
+
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1187
1189
|
if (output === input && opts.contains === true) {
|
|
1188
1190
|
state.output = input;
|
|
1189
1191
|
return state;
|
|
@@ -1949,8 +1951,10 @@ var require_picomatch$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1949
1951
|
output = format ? format(input) : input;
|
|
1950
1952
|
match = output === glob;
|
|
1951
1953
|
}
|
|
1952
|
-
if (match === false || opts.capture === true)
|
|
1953
|
-
|
|
1954
|
+
if (match === false || opts.capture === true) {
|
|
1955
|
+
if (opts.matchBase === true || opts.basename === true) match = picomatch.matchBase(input, regex, options, posix);
|
|
1956
|
+
else match = regex.exec(output);
|
|
1957
|
+
}
|
|
1954
1958
|
return {
|
|
1955
1959
|
isMatch: Boolean(match),
|
|
1956
1960
|
match,
|
|
@@ -3220,7 +3224,7 @@ const importMetaResolveWithCustomHookString = `
|
|
|
3220
3224
|
`;
|
|
3221
3225
|
//#endregion
|
|
3222
3226
|
//#region ../../vite/packages/vite/package.json
|
|
3223
|
-
var version = "8.2.
|
|
3227
|
+
var version = "8.2.1";
|
|
3224
3228
|
//#endregion
|
|
3225
3229
|
//#region ../../vite/packages/vite/src/node/constants.ts
|
|
3226
3230
|
const ROLLUP_HOOKS = [
|
|
@@ -3318,7 +3322,9 @@ const VITE_PACKAGE_DIR = path.join(fileURLToPath(
|
|
|
3318
3322
|
import.meta.url
|
|
3319
3323
|
), "..", "..", "..", "..", "..");
|
|
3320
3324
|
const CLIENT_ENTRY = path.join(VITE_PACKAGE_DIR, "dist/vite/client/client.mjs");
|
|
3321
|
-
const BUNDLED_DEV_CLIENT_ENTRY =
|
|
3325
|
+
const BUNDLED_DEV_CLIENT_ENTRY = path.join(VITE_PACKAGE_DIR, "dist/vite/client/bundledDevClient.mjs");
|
|
3326
|
+
/** URL filename the bundled-dev server serves the vite client under */
|
|
3327
|
+
const BUNDLED_DEV_CLIENT_FILENAME = "bundledDevClient.mjs";
|
|
3322
3328
|
const ENV_ENTRY = path.join(VITE_PACKAGE_DIR, "dist/vite/client/env.mjs");
|
|
3323
3329
|
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
|
3324
3330
|
const KNOWN_ASSET_TYPES = [
|
|
@@ -4621,15 +4627,16 @@ function loadPackageData(pkgPath) {
|
|
|
4621
4627
|
const { sideEffects } = data;
|
|
4622
4628
|
let hasSideEffects;
|
|
4623
4629
|
if (typeof sideEffects === "boolean") hasSideEffects = () => sideEffects;
|
|
4624
|
-
else if (Array.isArray(sideEffects))
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4630
|
+
else if (Array.isArray(sideEffects)) {
|
|
4631
|
+
if (sideEffects.length <= 0) hasSideEffects = () => false;
|
|
4632
|
+
else {
|
|
4633
|
+
const finalPackageSideEffects = sideEffects.map((sideEffect) => {
|
|
4634
|
+
if (sideEffect.includes("/")) return sideEffect;
|
|
4635
|
+
return `**/${sideEffect}`;
|
|
4636
|
+
});
|
|
4637
|
+
hasSideEffects = createFilter$1(finalPackageSideEffects, null, { resolve: pkgDir });
|
|
4638
|
+
}
|
|
4639
|
+
} else hasSideEffects = () => null;
|
|
4633
4640
|
const resolvedCache = {};
|
|
4634
4641
|
return {
|
|
4635
4642
|
dir: pkgDir,
|
|
@@ -5839,7 +5846,8 @@ function formatAndTruncateFileList(files) {
|
|
|
5839
5846
|
truncated
|
|
5840
5847
|
};
|
|
5841
5848
|
}
|
|
5842
|
-
const
|
|
5849
|
+
const lineTerminatorRE = /[\r\n\u2028\u2029]$/;
|
|
5850
|
+
const hashbangRE = /^#![^\r\n\u2028\u2029]*(?:\r\n|[\r\n\u2028\u2029])?/;
|
|
5843
5851
|
function getFileStartIndex(code) {
|
|
5844
5852
|
return hashbangRE.exec(code)?.[0].length ?? 0;
|
|
5845
5853
|
}
|
|
@@ -5917,18 +5925,19 @@ function createLogger(level = "info", options = {}) {
|
|
|
5917
5925
|
if (thresh >= LogLevels[type]) {
|
|
5918
5926
|
const method = type === "info" ? "log" : type;
|
|
5919
5927
|
if (options.error) loggedErrors.add(options.error);
|
|
5920
|
-
if (canClearScreen)
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5928
|
+
if (canClearScreen) {
|
|
5929
|
+
if (type === lastType && msg === lastMsg) {
|
|
5930
|
+
sameCount++;
|
|
5931
|
+
clear();
|
|
5932
|
+
console[method](format(type, msg, options), import_picocolors.default.yellow(`(x${sameCount + 1})`));
|
|
5933
|
+
} else {
|
|
5934
|
+
sameCount = 0;
|
|
5935
|
+
lastMsg = msg;
|
|
5936
|
+
lastType = type;
|
|
5937
|
+
if (options.clear) clear();
|
|
5938
|
+
console[method](format(type, msg, options));
|
|
5939
|
+
}
|
|
5940
|
+
} else console[method](format(type, msg, options));
|
|
5932
5941
|
}
|
|
5933
5942
|
}
|
|
5934
5943
|
const warnedMessages = /* @__PURE__ */ new Set();
|
|
@@ -6164,22 +6173,24 @@ function resolveEsbuildTranspileOptions(config, format) {
|
|
|
6164
6173
|
minifyWhitespace: false,
|
|
6165
6174
|
treeShaking: false
|
|
6166
6175
|
};
|
|
6167
|
-
if (options.minifyIdentifiers != null || options.minifySyntax != null || options.minifyWhitespace != null)
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6176
|
+
if (options.minifyIdentifiers != null || options.minifySyntax != null || options.minifyWhitespace != null) {
|
|
6177
|
+
if (isEsLibBuild) return {
|
|
6178
|
+
...options,
|
|
6179
|
+
minify: false,
|
|
6180
|
+
minifyIdentifiers: options.minifyIdentifiers ?? true,
|
|
6181
|
+
minifySyntax: options.minifySyntax ?? true,
|
|
6182
|
+
minifyWhitespace: false,
|
|
6183
|
+
treeShaking: true
|
|
6184
|
+
};
|
|
6185
|
+
else return {
|
|
6186
|
+
...options,
|
|
6187
|
+
minify: false,
|
|
6188
|
+
minifyIdentifiers: options.minifyIdentifiers ?? true,
|
|
6189
|
+
minifySyntax: options.minifySyntax ?? true,
|
|
6190
|
+
minifyWhitespace: options.minifyWhitespace ?? true,
|
|
6191
|
+
treeShaking: true
|
|
6192
|
+
};
|
|
6193
|
+
}
|
|
6183
6194
|
if (isEsLibBuild) return {
|
|
6184
6195
|
...options,
|
|
6185
6196
|
minify: false,
|
|
@@ -8218,10 +8229,12 @@ codes.ERR_INVALID_ARG_TYPE = createError(
|
|
|
8218
8229
|
message += `an instance of ${formatList(instances, "or")}`;
|
|
8219
8230
|
if (other.length > 0) message += " or ";
|
|
8220
8231
|
}
|
|
8221
|
-
if (other.length > 0)
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8232
|
+
if (other.length > 0) {
|
|
8233
|
+
if (other.length > 1) message += `one of ${formatList(other, "or")}`;
|
|
8234
|
+
else {
|
|
8235
|
+
if (other[0].toLowerCase() !== other[0]) message += "an ";
|
|
8236
|
+
message += `${other[0]}`;
|
|
8237
|
+
}
|
|
8225
8238
|
}
|
|
8226
8239
|
message += `. Received ${determineSpecificType(actual)}`;
|
|
8227
8240
|
return message;
|
|
@@ -8515,9 +8528,10 @@ var import_main = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8515
8528
|
defaultValue = r.join(splitter);
|
|
8516
8529
|
value = env[key];
|
|
8517
8530
|
}
|
|
8518
|
-
if (value)
|
|
8519
|
-
|
|
8520
|
-
|
|
8531
|
+
if (value) {
|
|
8532
|
+
if (seen.has(value)) result = result.replace(template, defaultValue);
|
|
8533
|
+
else result = result.replace(template, value);
|
|
8534
|
+
} else result = result.replace(template, defaultValue);
|
|
8521
8535
|
if (result === runningParsed[key]) break;
|
|
8522
8536
|
regex.lastIndex = 0;
|
|
8523
8537
|
}
|
|
@@ -8826,7 +8840,7 @@ var require_ms$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8826
8840
|
}
|
|
8827
8841
|
}));
|
|
8828
8842
|
//#endregion
|
|
8829
|
-
//#region ../../node_modules/.pnpm/debug@2.6.
|
|
8843
|
+
//#region ../../node_modules/.pnpm/debug@2.6.9_supports-color@8.1.1/node_modules/debug/src/debug.js
|
|
8830
8844
|
var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
8831
8845
|
/**
|
|
8832
8846
|
* This is the common logic for both the Node.js and web browser
|
|
@@ -8965,7 +8979,7 @@ var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8965
8979
|
}
|
|
8966
8980
|
}));
|
|
8967
8981
|
//#endregion
|
|
8968
|
-
//#region ../../node_modules/.pnpm/debug@2.6.
|
|
8982
|
+
//#region ../../node_modules/.pnpm/debug@2.6.9_supports-color@8.1.1/node_modules/debug/src/browser.js
|
|
8969
8983
|
var require_browser$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
8970
8984
|
/**
|
|
8971
8985
|
* This is the web browser implementation of `debug()`.
|
|
@@ -9087,7 +9101,7 @@ var require_browser$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9087
9101
|
}
|
|
9088
9102
|
}));
|
|
9089
9103
|
//#endregion
|
|
9090
|
-
//#region ../../node_modules/.pnpm/debug@2.6.
|
|
9104
|
+
//#region ../../node_modules/.pnpm/debug@2.6.9_supports-color@8.1.1/node_modules/debug/src/node.js
|
|
9091
9105
|
var require_node$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9092
9106
|
/**
|
|
9093
9107
|
* Module dependencies.
|
|
@@ -9259,7 +9273,7 @@ var require_node$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9259
9273
|
exports.enable(load());
|
|
9260
9274
|
}));
|
|
9261
9275
|
//#endregion
|
|
9262
|
-
//#region ../../node_modules/.pnpm/debug@2.6.
|
|
9276
|
+
//#region ../../node_modules/.pnpm/debug@2.6.9_supports-color@8.1.1/node_modules/debug/src/index.js
|
|
9263
9277
|
var require_src$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
9264
9278
|
/**
|
|
9265
9279
|
* Detect Electron renderer process, which is node, but we should
|
|
@@ -9898,7 +9912,7 @@ var require_unpipe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9898
9912
|
}
|
|
9899
9913
|
}));
|
|
9900
9914
|
//#endregion
|
|
9901
|
-
//#region ../../node_modules/.pnpm/finalhandler@1.1.
|
|
9915
|
+
//#region ../../node_modules/.pnpm/finalhandler@1.1.2_supports-color@8.1.1/node_modules/finalhandler/index.js
|
|
9902
9916
|
/*!
|
|
9903
9917
|
* finalhandler
|
|
9904
9918
|
* Copyright(c) 2014-2017 Douglas Christopher Wilson
|
|
@@ -10138,7 +10152,7 @@ var require_utils_merge = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
10138
10152
|
};
|
|
10139
10153
|
}));
|
|
10140
10154
|
//#endregion
|
|
10141
|
-
//#region ../../node_modules/.pnpm/connect@3.7.
|
|
10155
|
+
//#region ../../node_modules/.pnpm/connect@3.7.0_supports-color@8.1.1/node_modules/connect/index.js
|
|
10142
10156
|
/*!
|
|
10143
10157
|
* connect
|
|
10144
10158
|
* Copyright(c) 2010 Sencha Inc.
|
|
@@ -11363,10 +11377,12 @@ var require_parse$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11363
11377
|
}
|
|
11364
11378
|
return esc ? m : `\\${m}`;
|
|
11365
11379
|
});
|
|
11366
|
-
if (backslashes === true)
|
|
11367
|
-
|
|
11368
|
-
|
|
11369
|
-
|
|
11380
|
+
if (backslashes === true) {
|
|
11381
|
+
if (opts.unescape === true) output = output.replace(/\\/g, "");
|
|
11382
|
+
else output = output.replace(/\\+/g, (m) => {
|
|
11383
|
+
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
11384
|
+
});
|
|
11385
|
+
}
|
|
11370
11386
|
if (output === input && opts.contains === true) {
|
|
11371
11387
|
state.output = input;
|
|
11372
11388
|
return state;
|
|
@@ -12123,8 +12139,10 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
12123
12139
|
output = format ? format(input) : input;
|
|
12124
12140
|
match = output === glob;
|
|
12125
12141
|
}
|
|
12126
|
-
if (match === false || opts.capture === true)
|
|
12127
|
-
|
|
12142
|
+
if (match === false || opts.capture === true) {
|
|
12143
|
+
if (opts.matchBase === true || opts.basename === true) match = picomatch.matchBase(input, regex, options, posix);
|
|
12144
|
+
else match = regex.exec(output);
|
|
12145
|
+
}
|
|
12128
12146
|
return {
|
|
12129
12147
|
isMatch: Boolean(match),
|
|
12130
12148
|
match,
|
|
@@ -14875,17 +14893,18 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
14875
14893
|
const parent = sysPath$1.dirname(path);
|
|
14876
14894
|
const item = sysPath$1.basename(path);
|
|
14877
14895
|
const watchedDir = this.fsw._getWatchedDir(info.type === FSEVENT_TYPE_DIRECTORY ? path : parent);
|
|
14878
|
-
if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN)
|
|
14879
|
-
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
|
|
14887
|
-
|
|
14888
|
-
|
|
14896
|
+
if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN) {
|
|
14897
|
+
if (typeof opts.ignored === FUNCTION_TYPE) {
|
|
14898
|
+
let stats;
|
|
14899
|
+
try {
|
|
14900
|
+
stats = await stat(path);
|
|
14901
|
+
} catch (error) {}
|
|
14902
|
+
if (this.fsw.closed) return;
|
|
14903
|
+
if (this.checkIgnored(path, stats)) return;
|
|
14904
|
+
if (sameTypes(info, stats)) this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
14905
|
+
else this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
14906
|
+
} else this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
14907
|
+
} else switch (info.event) {
|
|
14889
14908
|
case FSEVENT_CREATED:
|
|
14890
14909
|
case FSEVENT_MODIFIED: return this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts);
|
|
14891
14910
|
case FSEVENT_DELETED:
|
|
@@ -14989,13 +15008,15 @@ var require_fsevents_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
14989
15008
|
this.fsw._emitReady();
|
|
14990
15009
|
}
|
|
14991
15010
|
}
|
|
14992
|
-
if (opts.persistent && forceAdd !== true)
|
|
14993
|
-
|
|
14994
|
-
|
|
14995
|
-
|
|
14996
|
-
|
|
14997
|
-
|
|
14998
|
-
|
|
15011
|
+
if (opts.persistent && forceAdd !== true) {
|
|
15012
|
+
if (typeof transform === FUNCTION_TYPE) this.initWatch(void 0, path, wh, processPath);
|
|
15013
|
+
else {
|
|
15014
|
+
let realPath;
|
|
15015
|
+
try {
|
|
15016
|
+
realPath = await realpath(wh.watchPath);
|
|
15017
|
+
} catch (e) {}
|
|
15018
|
+
this.initWatch(realPath, path, wh, processPath);
|
|
15019
|
+
}
|
|
14999
15020
|
}
|
|
15000
15021
|
}
|
|
15001
15022
|
};
|
|
@@ -15833,16 +15854,17 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15833
15854
|
if (esc) {
|
|
15834
15855
|
out += c;
|
|
15835
15856
|
esc = false;
|
|
15836
|
-
} else if (quote)
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15840
|
-
|
|
15841
|
-
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15857
|
+
} else if (quote) {
|
|
15858
|
+
if (c === quote) quote = false;
|
|
15859
|
+
else if (quote == SQ) out += c;
|
|
15860
|
+
else if (c === BS) {
|
|
15861
|
+
i += 1;
|
|
15862
|
+
c = s.charAt(i);
|
|
15863
|
+
if (c === DQ || c === BS || c === DS) out += c;
|
|
15864
|
+
else out += BS + c;
|
|
15865
|
+
} else if (c === DS) out += parseEnvVar();
|
|
15866
|
+
else out += c;
|
|
15867
|
+
} else if (c === DQ || c === SQ) quote = c;
|
|
15846
15868
|
else if (controlRE.test(c)) return { op: s };
|
|
15847
15869
|
else if (hash.test(c)) {
|
|
15848
15870
|
commented = true;
|
|
@@ -16453,6 +16475,22 @@ async function readFileIfExists(value) {
|
|
|
16453
16475
|
if (typeof value === "string") return fsp.readFile(path.resolve(value)).catch(() => value);
|
|
16454
16476
|
return value;
|
|
16455
16477
|
}
|
|
16478
|
+
async function getAvailableEphemeralPort(specifiedHost) {
|
|
16479
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
16480
|
+
let port = 0;
|
|
16481
|
+
let available = true;
|
|
16482
|
+
for (const host of [...wildcardHosts, specifiedHost]) {
|
|
16483
|
+
const availablePort = await tryListen(port, host).catch(() => port);
|
|
16484
|
+
if (availablePort == null) {
|
|
16485
|
+
available = false;
|
|
16486
|
+
break;
|
|
16487
|
+
}
|
|
16488
|
+
port = availablePort;
|
|
16489
|
+
}
|
|
16490
|
+
if (available) return port;
|
|
16491
|
+
}
|
|
16492
|
+
return null;
|
|
16493
|
+
}
|
|
16456
16494
|
async function isPortAvailable(port) {
|
|
16457
16495
|
for (const host of wildcardHosts) if (!await tryListen(port, host).catch(() => true)) return false;
|
|
16458
16496
|
return true;
|
|
@@ -16461,10 +16499,11 @@ function tryListen(port, host) {
|
|
|
16461
16499
|
return new Promise((resolve) => {
|
|
16462
16500
|
const server = net.createServer();
|
|
16463
16501
|
server.once("error", (e) => {
|
|
16464
|
-
server.close(() => resolve(e.code
|
|
16502
|
+
server.close(() => resolve(e.code === "EADDRINUSE" ? null : port));
|
|
16465
16503
|
});
|
|
16466
16504
|
server.once("listening", () => {
|
|
16467
|
-
server.
|
|
16505
|
+
const address = server.address();
|
|
16506
|
+
server.close(() => resolve(typeof address === "object" && address ? address.port : port));
|
|
16468
16507
|
});
|
|
16469
16508
|
server.listen(port, host);
|
|
16470
16509
|
});
|
|
@@ -16492,6 +16531,14 @@ async function tryBindServer(httpServer, port, host) {
|
|
|
16492
16531
|
const MAX_PORT = 65535;
|
|
16493
16532
|
async function httpServerStart(httpServer, serverOptions) {
|
|
16494
16533
|
const { port: startPort, strictPort, host, logger } = serverOptions;
|
|
16534
|
+
if (startPort === 0) {
|
|
16535
|
+
const port = await getAvailableEphemeralPort(host);
|
|
16536
|
+
if (port == null) throw new Error("No available ephemeral port found");
|
|
16537
|
+
const result = await tryBindServer(httpServer, port, host);
|
|
16538
|
+
if (result.success) return port;
|
|
16539
|
+
if (result.error.code !== "EADDRINUSE") throw result.error;
|
|
16540
|
+
throw new Error(`Port ${port} is already in use`);
|
|
16541
|
+
}
|
|
16495
16542
|
for (let port = startPort; port <= MAX_PORT; port++) {
|
|
16496
16543
|
const portAvailableOnWildcard = await isPortAvailable(port);
|
|
16497
16544
|
if (strictPort) {
|
|
@@ -16776,10 +16823,12 @@ var WalkerBase = class {
|
|
|
16776
16823
|
* @param {Node} node
|
|
16777
16824
|
*/
|
|
16778
16825
|
replace(parent, prop, index, node) {
|
|
16779
|
-
if (parent && prop)
|
|
16826
|
+
if (parent && prop) {
|
|
16827
|
+
if (index != null)
|
|
16780
16828
|
/** @type {Array<Node>} */ parent[prop][index] = node;
|
|
16781
|
-
|
|
16829
|
+
else
|
|
16782
16830
|
/** @type {Node} */ parent[prop] = node;
|
|
16831
|
+
}
|
|
16783
16832
|
}
|
|
16784
16833
|
/**
|
|
16785
16834
|
* @template {Node} Parent
|
|
@@ -16788,9 +16837,11 @@ var WalkerBase = class {
|
|
|
16788
16837
|
* @param {number | null | undefined} index
|
|
16789
16838
|
*/
|
|
16790
16839
|
remove(parent, prop, index) {
|
|
16791
|
-
if (parent && prop)
|
|
16840
|
+
if (parent && prop) {
|
|
16841
|
+
if (index !== null && index !== void 0)
|
|
16792
16842
|
/** @type {Array<Node>} */ parent[prop].splice(index, 1);
|
|
16793
|
-
|
|
16843
|
+
else delete parent[prop];
|
|
16844
|
+
}
|
|
16794
16845
|
}
|
|
16795
16846
|
};
|
|
16796
16847
|
//#endregion
|
|
@@ -17018,45 +17069,50 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
17018
17069
|
if (s.type === "ImportSpecifier") return getIdentifierNameOrLiteralValue$1(s.imported);
|
|
17019
17070
|
else if (s.type === "ImportDefaultSpecifier") return "default";
|
|
17020
17071
|
}).filter(isDefined) });
|
|
17021
|
-
for (const spec of node.specifiers) if (spec.type === "ImportSpecifier")
|
|
17022
|
-
|
|
17023
|
-
|
|
17072
|
+
for (const spec of node.specifiers) if (spec.type === "ImportSpecifier") {
|
|
17073
|
+
if (spec.imported.type === "Identifier") idToImportMap.set(spec.local.name, `${importId}.${spec.imported.name}`);
|
|
17074
|
+
else idToImportMap.set(spec.local.name, `${importId}[${JSON.stringify(spec.imported.value)}]`);
|
|
17075
|
+
} else if (spec.type === "ImportDefaultSpecifier") idToImportMap.set(spec.local.name, `${importId}.default`);
|
|
17024
17076
|
else idToImportMap.set(spec.local.name, importId);
|
|
17025
17077
|
}
|
|
17026
17078
|
for (const node of exports) {
|
|
17027
|
-
if (node.type === "ExportNamedDeclaration")
|
|
17028
|
-
if (node.declaration
|
|
17029
|
-
|
|
17030
|
-
|
|
17031
|
-
|
|
17032
|
-
const
|
|
17033
|
-
|
|
17079
|
+
if (node.type === "ExportNamedDeclaration") {
|
|
17080
|
+
if (node.declaration) {
|
|
17081
|
+
if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") defineExport(node.declaration.id.name);
|
|
17082
|
+
else {
|
|
17083
|
+
const declaration = node.declaration;
|
|
17084
|
+
for (const decl of declaration.declarations) {
|
|
17085
|
+
const names = extract_names(decl.id);
|
|
17086
|
+
for (const name of names) defineExport(name);
|
|
17087
|
+
}
|
|
17088
|
+
}
|
|
17089
|
+
s.remove(node.start, node.declaration.start);
|
|
17090
|
+
} else if (node.source) {
|
|
17091
|
+
const importId = reExportImportIdMap.get(node);
|
|
17092
|
+
for (const spec of node.specifiers) {
|
|
17093
|
+
const exportedAs = getIdentifierNameOrLiteralValue$1(spec.exported);
|
|
17094
|
+
if (spec.local.type === "Identifier") defineExport(exportedAs, `${importId}.${spec.local.name}`);
|
|
17095
|
+
else defineExport(exportedAs, `${importId}[${JSON.stringify(spec.local.value)}]`);
|
|
17096
|
+
}
|
|
17097
|
+
} else {
|
|
17098
|
+
s.remove(node.start, node.end);
|
|
17099
|
+
for (const spec of node.specifiers) {
|
|
17100
|
+
const local = spec.local.name;
|
|
17101
|
+
const binding = idToImportMap.get(local);
|
|
17102
|
+
defineExport(getIdentifierNameOrLiteralValue$1(spec.exported), binding || local);
|
|
17034
17103
|
}
|
|
17035
|
-
}
|
|
17036
|
-
s.remove(node.start, node.declaration.start);
|
|
17037
|
-
} else if (node.source) {
|
|
17038
|
-
const importId = reExportImportIdMap.get(node);
|
|
17039
|
-
for (const spec of node.specifiers) {
|
|
17040
|
-
const exportedAs = getIdentifierNameOrLiteralValue$1(spec.exported);
|
|
17041
|
-
if (spec.local.type === "Identifier") defineExport(exportedAs, `${importId}.${spec.local.name}`);
|
|
17042
|
-
else defineExport(exportedAs, `${importId}[${JSON.stringify(spec.local.value)}]`);
|
|
17043
|
-
}
|
|
17044
|
-
} else {
|
|
17045
|
-
s.remove(node.start, node.end);
|
|
17046
|
-
for (const spec of node.specifiers) {
|
|
17047
|
-
const local = spec.local.name;
|
|
17048
|
-
const binding = idToImportMap.get(local);
|
|
17049
|
-
defineExport(getIdentifierNameOrLiteralValue$1(spec.exported), binding || local);
|
|
17050
17104
|
}
|
|
17051
17105
|
}
|
|
17052
|
-
if (node.type === "ExportDefaultDeclaration")
|
|
17053
|
-
|
|
17054
|
-
|
|
17055
|
-
|
|
17056
|
-
|
|
17057
|
-
|
|
17058
|
-
|
|
17059
|
-
|
|
17106
|
+
if (node.type === "ExportDefaultDeclaration") {
|
|
17107
|
+
if ("id" in node.declaration && node.declaration.id && !["FunctionExpression", "ClassExpression"].includes(node.declaration.type)) {
|
|
17108
|
+
const { name } = node.declaration.id;
|
|
17109
|
+
s.remove(node.start, node.start + 15);
|
|
17110
|
+
defineExport("default", name);
|
|
17111
|
+
} else {
|
|
17112
|
+
const name = `__vite_ssr_export_default__`;
|
|
17113
|
+
s.update(node.start, node.start + 14, `const ${name} =`);
|
|
17114
|
+
defineExport("default", name);
|
|
17115
|
+
}
|
|
17060
17116
|
}
|
|
17061
17117
|
if (node.type === "ExportAllDeclaration") {
|
|
17062
17118
|
const importId = reExportImportIdMap.get(node);
|
|
@@ -17082,15 +17138,16 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
|
|
|
17082
17138
|
const topNode = parentStack[parentStack.length - 2];
|
|
17083
17139
|
s.prependRight(topNode.start, `const ${id.name} = ${binding};\n`);
|
|
17084
17140
|
}
|
|
17085
|
-
} else if (parent.type === "CallExpression")
|
|
17086
|
-
|
|
17087
|
-
|
|
17088
|
-
|
|
17089
|
-
|
|
17090
|
-
|
|
17091
|
-
|
|
17092
|
-
|
|
17093
|
-
|
|
17141
|
+
} else if (parent.type === "CallExpression") {
|
|
17142
|
+
if (id === parent.callee && !parent.optional) {
|
|
17143
|
+
const argsStart = parent.arguments.length ? parent.arguments[0].start : parent.end;
|
|
17144
|
+
s.update(id.start, argsStart, `(0,${binding})${code.slice(id.end, argsStart)}`);
|
|
17145
|
+
} else {
|
|
17146
|
+
s.update(id.start, id.end, binding);
|
|
17147
|
+
s.prependRight(id.start, `(0,`);
|
|
17148
|
+
s.appendLeft(id.end, `)`);
|
|
17149
|
+
}
|
|
17150
|
+
} else if (!(parent.type === "ClassExpression" && id === parent.id)) s.update(id.start, id.end, binding);
|
|
17094
17151
|
},
|
|
17095
17152
|
onImportMeta(node) {
|
|
17096
17153
|
s.update(node.start, node.end, ssrImportMetaKey);
|
|
@@ -17846,8 +17903,10 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
17846
17903
|
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
17847
17904
|
const ext = pathExt[ii];
|
|
17848
17905
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
17849
|
-
if (!er && is)
|
|
17850
|
-
|
|
17906
|
+
if (!er && is) {
|
|
17907
|
+
if (opt.all) found.push(p + ext);
|
|
17908
|
+
else return resolve(p + ext);
|
|
17909
|
+
}
|
|
17851
17910
|
return resolve(subStep(p, i, ii + 1));
|
|
17852
17911
|
});
|
|
17853
17912
|
});
|
|
@@ -17865,8 +17924,10 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
17865
17924
|
for (let j = 0; j < pathExt.length; j++) {
|
|
17866
17925
|
const cur = p + pathExt[j];
|
|
17867
17926
|
try {
|
|
17868
|
-
if (isexe.sync(cur, { pathExt: pathExtExe }))
|
|
17869
|
-
|
|
17927
|
+
if (isexe.sync(cur, { pathExt: pathExtExe })) {
|
|
17928
|
+
if (opt.all) found.push(cur);
|
|
17929
|
+
else return cur;
|
|
17930
|
+
}
|
|
17870
17931
|
} catch (ex) {}
|
|
17871
17932
|
}
|
|
17872
17933
|
}
|
|
@@ -19632,12 +19693,13 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19632
19693
|
offset = 6;
|
|
19633
19694
|
}
|
|
19634
19695
|
let dataLength;
|
|
19635
|
-
if (typeof data === "string")
|
|
19636
|
-
|
|
19637
|
-
|
|
19638
|
-
|
|
19639
|
-
|
|
19640
|
-
|
|
19696
|
+
if (typeof data === "string") {
|
|
19697
|
+
if ((!options.mask || skipMasking) && options[kByteLength] !== void 0) dataLength = options[kByteLength];
|
|
19698
|
+
else {
|
|
19699
|
+
data = Buffer.from(data);
|
|
19700
|
+
dataLength = data.length;
|
|
19701
|
+
}
|
|
19702
|
+
} else {
|
|
19641
19703
|
dataLength = data.length;
|
|
19642
19704
|
merge = options.mask && options.readOnly && !skipMasking;
|
|
19643
19705
|
}
|
|
@@ -19749,15 +19811,16 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19749
19811
|
readOnly,
|
|
19750
19812
|
rsv1: false
|
|
19751
19813
|
};
|
|
19752
|
-
if (isBlob(data))
|
|
19753
|
-
this.
|
|
19754
|
-
|
|
19755
|
-
|
|
19756
|
-
|
|
19757
|
-
|
|
19758
|
-
|
|
19759
|
-
|
|
19760
|
-
|
|
19814
|
+
if (isBlob(data)) {
|
|
19815
|
+
if (this._state !== DEFAULT) this.enqueue([
|
|
19816
|
+
this.getBlobData,
|
|
19817
|
+
data,
|
|
19818
|
+
false,
|
|
19819
|
+
options,
|
|
19820
|
+
cb
|
|
19821
|
+
]);
|
|
19822
|
+
else this.getBlobData(data, false, options, cb);
|
|
19823
|
+
} else if (this._state !== DEFAULT) this.enqueue([
|
|
19761
19824
|
this.dispatch,
|
|
19762
19825
|
data,
|
|
19763
19826
|
false,
|
|
@@ -19799,15 +19862,16 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19799
19862
|
readOnly,
|
|
19800
19863
|
rsv1: false
|
|
19801
19864
|
};
|
|
19802
|
-
if (isBlob(data))
|
|
19803
|
-
this.
|
|
19804
|
-
|
|
19805
|
-
|
|
19806
|
-
|
|
19807
|
-
|
|
19808
|
-
|
|
19809
|
-
|
|
19810
|
-
|
|
19865
|
+
if (isBlob(data)) {
|
|
19866
|
+
if (this._state !== DEFAULT) this.enqueue([
|
|
19867
|
+
this.getBlobData,
|
|
19868
|
+
data,
|
|
19869
|
+
false,
|
|
19870
|
+
options,
|
|
19871
|
+
cb
|
|
19872
|
+
]);
|
|
19873
|
+
else this.getBlobData(data, false, options, cb);
|
|
19874
|
+
} else if (this._state !== DEFAULT) this.enqueue([
|
|
19811
19875
|
this.dispatch,
|
|
19812
19876
|
data,
|
|
19813
19877
|
false,
|
|
@@ -19868,15 +19932,16 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19868
19932
|
readOnly,
|
|
19869
19933
|
rsv1
|
|
19870
19934
|
};
|
|
19871
|
-
if (isBlob(data))
|
|
19872
|
-
this.
|
|
19873
|
-
|
|
19874
|
-
|
|
19875
|
-
|
|
19876
|
-
|
|
19877
|
-
|
|
19878
|
-
|
|
19879
|
-
|
|
19935
|
+
if (isBlob(data)) {
|
|
19936
|
+
if (this._state !== DEFAULT) this.enqueue([
|
|
19937
|
+
this.getBlobData,
|
|
19938
|
+
data,
|
|
19939
|
+
this._compress,
|
|
19940
|
+
opts,
|
|
19941
|
+
cb
|
|
19942
|
+
]);
|
|
19943
|
+
else this.getBlobData(data, this._compress, opts, cb);
|
|
19944
|
+
} else if (this._state !== DEFAULT) this.enqueue([
|
|
19880
19945
|
this.dispatch,
|
|
19881
19946
|
data,
|
|
19882
19947
|
this._compress,
|
|
@@ -20309,51 +20374,54 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20309
20374
|
let i = 0;
|
|
20310
20375
|
for (; i < header.length; i++) {
|
|
20311
20376
|
code = header.charCodeAt(i);
|
|
20312
|
-
if (extensionName === void 0)
|
|
20313
|
-
if (
|
|
20314
|
-
|
|
20315
|
-
if (
|
|
20316
|
-
|
|
20317
|
-
if (
|
|
20318
|
-
|
|
20319
|
-
|
|
20320
|
-
|
|
20321
|
-
|
|
20322
|
-
|
|
20323
|
-
|
|
20324
|
-
|
|
20325
|
-
|
|
20326
|
-
|
|
20327
|
-
|
|
20328
|
-
|
|
20329
|
-
|
|
20330
|
-
|
|
20331
|
-
|
|
20332
|
-
if (
|
|
20333
|
-
|
|
20334
|
-
|
|
20335
|
-
push(
|
|
20336
|
-
|
|
20337
|
-
|
|
20338
|
-
|
|
20339
|
-
|
|
20340
|
-
|
|
20341
|
-
|
|
20342
|
-
start
|
|
20343
|
-
|
|
20344
|
-
|
|
20377
|
+
if (extensionName === void 0) {
|
|
20378
|
+
if (end === -1 && tokenChars[code] === 1) {
|
|
20379
|
+
if (start === -1) start = i;
|
|
20380
|
+
} else if (i !== 0 && (code === 32 || code === 9)) {
|
|
20381
|
+
if (end === -1 && start !== -1) end = i;
|
|
20382
|
+
} else if (code === 59 || code === 44) {
|
|
20383
|
+
if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
20384
|
+
if (end === -1) end = i;
|
|
20385
|
+
const name = header.slice(start, end);
|
|
20386
|
+
if (code === 44) {
|
|
20387
|
+
push(offers, name, params);
|
|
20388
|
+
params = Object.create(null);
|
|
20389
|
+
} else extensionName = name;
|
|
20390
|
+
start = end = -1;
|
|
20391
|
+
} else throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
20392
|
+
} else if (paramName === void 0) {
|
|
20393
|
+
if (end === -1 && tokenChars[code] === 1) {
|
|
20394
|
+
if (start === -1) start = i;
|
|
20395
|
+
} else if (code === 32 || code === 9) {
|
|
20396
|
+
if (end === -1 && start !== -1) end = i;
|
|
20397
|
+
} else if (code === 59 || code === 44) {
|
|
20398
|
+
if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
20399
|
+
if (end === -1) end = i;
|
|
20400
|
+
push(params, header.slice(start, end), true);
|
|
20401
|
+
if (code === 44) {
|
|
20402
|
+
push(offers, extensionName, params);
|
|
20403
|
+
params = Object.create(null);
|
|
20404
|
+
extensionName = void 0;
|
|
20405
|
+
}
|
|
20406
|
+
start = end = -1;
|
|
20407
|
+
} else if (code === 61 && start !== -1 && end === -1) {
|
|
20408
|
+
paramName = header.slice(start, i);
|
|
20409
|
+
start = end = -1;
|
|
20410
|
+
} else throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
20411
|
+
} else if (isEscaping) {
|
|
20345
20412
|
if (tokenChars[code] !== 1) throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
20346
20413
|
if (start === -1) start = i;
|
|
20347
20414
|
else if (!mustUnescape) mustUnescape = true;
|
|
20348
20415
|
isEscaping = false;
|
|
20349
|
-
} else if (inQuotes)
|
|
20350
|
-
if (
|
|
20351
|
-
|
|
20352
|
-
|
|
20353
|
-
|
|
20354
|
-
|
|
20355
|
-
|
|
20356
|
-
|
|
20416
|
+
} else if (inQuotes) {
|
|
20417
|
+
if (tokenChars[code] === 1) {
|
|
20418
|
+
if (start === -1) start = i;
|
|
20419
|
+
} else if (code === 34 && start !== -1) {
|
|
20420
|
+
inQuotes = false;
|
|
20421
|
+
end = i;
|
|
20422
|
+
} else if (code === 92) isEscaping = true;
|
|
20423
|
+
else throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
20424
|
+
} else if (code === 34 && header.charCodeAt(i - 1) === 61) inQuotes = true;
|
|
20357
20425
|
else if (end === -1 && tokenChars[code] === 1) {
|
|
20358
20426
|
if (start === -1) start = i;
|
|
20359
20427
|
} else if (start !== -1 && (code === 32 || code === 9)) {
|
|
@@ -20475,10 +20543,12 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20475
20543
|
this._isServer = false;
|
|
20476
20544
|
this._redirects = 0;
|
|
20477
20545
|
if (protocols === void 0) protocols = [];
|
|
20478
|
-
else if (!Array.isArray(protocols))
|
|
20479
|
-
|
|
20480
|
-
|
|
20481
|
-
|
|
20546
|
+
else if (!Array.isArray(protocols)) {
|
|
20547
|
+
if (typeof protocols === "object" && protocols !== null) {
|
|
20548
|
+
options = protocols;
|
|
20549
|
+
protocols = [];
|
|
20550
|
+
} else protocols = [protocols];
|
|
20551
|
+
}
|
|
20482
20552
|
initAsClient(this, address, protocols, options);
|
|
20483
20553
|
} else {
|
|
20484
20554
|
this._autoPong = options.autoPong;
|
|
@@ -21020,8 +21090,10 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21020
21090
|
}
|
|
21021
21091
|
opts.headers["Sec-WebSocket-Protocol"] = protocols.join(",");
|
|
21022
21092
|
}
|
|
21023
|
-
if (opts.origin)
|
|
21024
|
-
|
|
21093
|
+
if (opts.origin) {
|
|
21094
|
+
if (opts.protocolVersion < 13) opts.headers["Sec-WebSocket-Origin"] = opts.origin;
|
|
21095
|
+
else opts.headers.Origin = opts.origin;
|
|
21096
|
+
}
|
|
21025
21097
|
if (parsedUrl.username || parsedUrl.password) opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
|
|
21026
21098
|
if (isIpcUrl) {
|
|
21027
21099
|
const parts = opts.path.split(":");
|
|
@@ -21707,9 +21779,10 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
21707
21779
|
this._removeListeners();
|
|
21708
21780
|
this._removeListeners = this._server = null;
|
|
21709
21781
|
}
|
|
21710
|
-
if (this.clients)
|
|
21711
|
-
|
|
21712
|
-
|
|
21782
|
+
if (this.clients) {
|
|
21783
|
+
if (!this.clients.size) process.nextTick(emitClose, this);
|
|
21784
|
+
else this._shouldEmitClose = true;
|
|
21785
|
+
} else process.nextTick(emitClose, this);
|
|
21713
21786
|
} else {
|
|
21714
21787
|
const server = this._server;
|
|
21715
21788
|
this._removeListeners();
|
|
@@ -22397,7 +22470,7 @@ var require_ms = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
22397
22470
|
}
|
|
22398
22471
|
}));
|
|
22399
22472
|
//#endregion
|
|
22400
|
-
//#region ../../node_modules/.pnpm/debug@4.4.
|
|
22473
|
+
//#region ../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/common.js
|
|
22401
22474
|
var require_common$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
22402
22475
|
/**
|
|
22403
22476
|
* This is the common logic for both the Node.js and web browser
|
|
@@ -22535,15 +22608,16 @@ var require_common$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
22535
22608
|
let templateIndex = 0;
|
|
22536
22609
|
let starIndex = -1;
|
|
22537
22610
|
let matchIndex = 0;
|
|
22538
|
-
while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*"))
|
|
22539
|
-
|
|
22540
|
-
|
|
22541
|
-
|
|
22542
|
-
|
|
22543
|
-
|
|
22544
|
-
|
|
22545
|
-
|
|
22546
|
-
|
|
22611
|
+
while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
22612
|
+
if (template[templateIndex] === "*") {
|
|
22613
|
+
starIndex = templateIndex;
|
|
22614
|
+
matchIndex = searchIndex;
|
|
22615
|
+
templateIndex++;
|
|
22616
|
+
} else {
|
|
22617
|
+
searchIndex++;
|
|
22618
|
+
templateIndex++;
|
|
22619
|
+
}
|
|
22620
|
+
} else if (starIndex !== -1) {
|
|
22547
22621
|
templateIndex = starIndex + 1;
|
|
22548
22622
|
matchIndex++;
|
|
22549
22623
|
searchIndex = matchIndex;
|
|
@@ -22598,7 +22672,7 @@ var require_common$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
22598
22672
|
module.exports = setup;
|
|
22599
22673
|
}));
|
|
22600
22674
|
//#endregion
|
|
22601
|
-
//#region ../../node_modules/.pnpm/debug@4.4.
|
|
22675
|
+
//#region ../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/browser.js
|
|
22602
22676
|
var require_browser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
22603
22677
|
/**
|
|
22604
22678
|
* This is the web browser implementation of `debug()`.
|
|
@@ -22794,7 +22868,7 @@ var require_browser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
22794
22868
|
};
|
|
22795
22869
|
}));
|
|
22796
22870
|
//#endregion
|
|
22797
|
-
//#region ../../node_modules/.pnpm/debug@4.4.
|
|
22871
|
+
//#region ../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/node.js
|
|
22798
22872
|
var require_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
22799
22873
|
/**
|
|
22800
22874
|
* Module dependencies.
|
|
@@ -23001,7 +23075,7 @@ var require_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
23001
23075
|
};
|
|
23002
23076
|
}));
|
|
23003
23077
|
//#endregion
|
|
23004
|
-
//#region ../../node_modules/.pnpm/debug@4.4.
|
|
23078
|
+
//#region ../../node_modules/.pnpm/debug@4.4.3_supports-color@8.1.1/node_modules/debug/src/index.js
|
|
23005
23079
|
var require_src$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
23006
23080
|
/**
|
|
23007
23081
|
* Detect Electron renderer / nwjs process, which is node, but we should
|
|
@@ -23011,7 +23085,7 @@ var require_src$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
23011
23085
|
else module.exports = require_node();
|
|
23012
23086
|
}));
|
|
23013
23087
|
//#endregion
|
|
23014
|
-
//#region ../../node_modules/.pnpm/follow-redirects@1.16.0_debug@4.4.
|
|
23088
|
+
//#region ../../node_modules/.pnpm/follow-redirects@1.16.0_debug@4.4.3_supports-color@8.1.1_/node_modules/follow-redirects/debug.js
|
|
23015
23089
|
var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
23016
23090
|
var debug;
|
|
23017
23091
|
module.exports = function() {
|
|
@@ -23025,7 +23099,7 @@ var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
23025
23099
|
};
|
|
23026
23100
|
}));
|
|
23027
23101
|
//#endregion
|
|
23028
|
-
//#region ../../node_modules/.pnpm/follow-redirects@1.16.0_debug@4.4.
|
|
23102
|
+
//#region ../../node_modules/.pnpm/follow-redirects@1.16.0_debug@4.4.3_supports-color@8.1.1_/node_modules/follow-redirects/index.js
|
|
23029
23103
|
var require_follow_redirects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
23030
23104
|
var url$1 = __require$1("url");
|
|
23031
23105
|
var URL = url$1.URL;
|
|
@@ -23470,7 +23544,7 @@ var require_follow_redirects = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
23470
23544
|
module.exports.wrap = wrap;
|
|
23471
23545
|
}));
|
|
23472
23546
|
//#endregion
|
|
23473
|
-
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.
|
|
23547
|
+
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.3_supports-color@8.1.1/node_modules/http-proxy-3/dist/lib/http-proxy/common.js
|
|
23474
23548
|
var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
23475
23549
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23476
23550
|
exports.isSSL = void 0;
|
|
@@ -23571,9 +23645,10 @@ var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23571
23645
|
let retSegs = "";
|
|
23572
23646
|
for (const seg of args) {
|
|
23573
23647
|
if (!seg) continue;
|
|
23574
|
-
if (retSegs.endsWith("/"))
|
|
23575
|
-
|
|
23576
|
-
|
|
23648
|
+
if (retSegs.endsWith("/")) {
|
|
23649
|
+
if (seg.startsWith("/")) retSegs += seg.slice(1);
|
|
23650
|
+
else retSegs += seg;
|
|
23651
|
+
} else if (seg.startsWith("/")) retSegs += seg;
|
|
23577
23652
|
else retSegs += "/" + seg;
|
|
23578
23653
|
}
|
|
23579
23654
|
return queryParamRaw ? retSegs + "?" + queryParamRaw : retSegs;
|
|
@@ -23625,7 +23700,7 @@ var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23625
23700
|
}
|
|
23626
23701
|
}));
|
|
23627
23702
|
//#endregion
|
|
23628
|
-
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.
|
|
23703
|
+
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.3_supports-color@8.1.1/node_modules/http-proxy-3/dist/lib/http-proxy/passes/web-outgoing.js
|
|
23629
23704
|
var require_web_outgoing = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
23630
23705
|
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
23631
23706
|
if (k2 === void 0) k2 = k;
|
|
@@ -23736,7 +23811,7 @@ var require_web_outgoing = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23736
23811
|
};
|
|
23737
23812
|
}));
|
|
23738
23813
|
//#endregion
|
|
23739
|
-
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.
|
|
23814
|
+
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.3_supports-color@8.1.1/node_modules/http-proxy-3/dist/lib/http-proxy/passes/web-incoming.js
|
|
23740
23815
|
var require_web_incoming = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
23741
23816
|
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
23742
23817
|
if (k2 === void 0) k2 = k;
|
|
@@ -23991,7 +24066,7 @@ var require_web_incoming = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
23991
24066
|
};
|
|
23992
24067
|
}));
|
|
23993
24068
|
//#endregion
|
|
23994
|
-
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.
|
|
24069
|
+
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.3_supports-color@8.1.1/node_modules/http-proxy-3/dist/lib/http-proxy/passes/ws-incoming.js
|
|
23995
24070
|
var require_ws_incoming = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
23996
24071
|
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
23997
24072
|
if (k2 === void 0) k2 = k;
|
|
@@ -24200,7 +24275,7 @@ var require_ws_incoming = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24200
24275
|
};
|
|
24201
24276
|
}));
|
|
24202
24277
|
//#endregion
|
|
24203
|
-
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.
|
|
24278
|
+
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.3_supports-color@8.1.1/node_modules/http-proxy-3/dist/lib/http-proxy/index.js
|
|
24204
24279
|
var require_http_proxy = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
24205
24280
|
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
24206
24281
|
if (k2 === void 0) k2 = k;
|
|
@@ -24614,9 +24689,10 @@ var require_convert_source_map = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24614
24689
|
return /(?:\/\/[@#][ \t]+?sourceMappingURL=([^\s'"`]+?)[ \t]*?$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*?(?:\*\/){1}[ \t]*?$)/gm;
|
|
24615
24690
|
} });
|
|
24616
24691
|
var decodeBase64;
|
|
24617
|
-
if (typeof Buffer !== "undefined")
|
|
24618
|
-
|
|
24619
|
-
|
|
24692
|
+
if (typeof Buffer !== "undefined") {
|
|
24693
|
+
if (typeof Buffer.from === "function") decodeBase64 = decodeBase64WithBufferFrom;
|
|
24694
|
+
else decodeBase64 = decodeBase64WithNewBuffer;
|
|
24695
|
+
} else decodeBase64 = decodeBase64WithAtob;
|
|
24620
24696
|
function decodeBase64WithBufferFrom(base64) {
|
|
24621
24697
|
return Buffer.from(base64, "base64").toString();
|
|
24622
24698
|
}
|
|
@@ -24655,9 +24731,10 @@ var require_convert_source_map = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24655
24731
|
Converter.prototype.toJSON = function(space) {
|
|
24656
24732
|
return JSON.stringify(this.sourcemap, null, space);
|
|
24657
24733
|
};
|
|
24658
|
-
if (typeof Buffer !== "undefined")
|
|
24659
|
-
|
|
24660
|
-
|
|
24734
|
+
if (typeof Buffer !== "undefined") {
|
|
24735
|
+
if (typeof Buffer.from === "function") Converter.prototype.toBase64 = encodeBase64WithBufferFrom;
|
|
24736
|
+
else Converter.prototype.toBase64 = encodeBase64WithNewBuffer;
|
|
24737
|
+
} else Converter.prototype.toBase64 = encodeBase64WithBtoa;
|
|
24661
24738
|
function encodeBase64WithBufferFrom() {
|
|
24662
24739
|
var json = this.toJSON();
|
|
24663
24740
|
return Buffer.from(json, "utf8").toString("base64");
|
|
@@ -26035,402 +26112,404 @@ function getModuleTypeFromId(id) {
|
|
|
26035
26112
|
}
|
|
26036
26113
|
}
|
|
26037
26114
|
//#endregion
|
|
26038
|
-
//#region ../../node_modules/.pnpm/
|
|
26039
|
-
var
|
|
26040
|
-
|
|
26041
|
-
|
|
26042
|
-
|
|
26043
|
-
|
|
26044
|
-
|
|
26045
|
-
|
|
26046
|
-
|
|
26047
|
-
|
|
26048
|
-
|
|
26049
|
-
|
|
26050
|
-
|
|
26051
|
-
|
|
26052
|
-
|
|
26053
|
-
|
|
26054
|
-
|
|
26055
|
-
|
|
26056
|
-
|
|
26057
|
-
|
|
26058
|
-
|
|
26059
|
-
|
|
26060
|
-
|
|
26061
|
-
|
|
26062
|
-
|
|
26063
|
-
|
|
26064
|
-
|
|
26065
|
-
|
|
26066
|
-
|
|
26067
|
-
|
|
26068
|
-
|
|
26069
|
-
|
|
26070
|
-
|
|
26071
|
-
|
|
26072
|
-
|
|
26073
|
-
|
|
26074
|
-
|
|
26075
|
-
|
|
26076
|
-
|
|
26077
|
-
|
|
26078
|
-
|
|
26079
|
-
|
|
26080
|
-
|
|
26081
|
-
|
|
26082
|
-
|
|
26083
|
-
|
|
26084
|
-
|
|
26085
|
-
|
|
26086
|
-
|
|
26087
|
-
|
|
26088
|
-
|
|
26089
|
-
|
|
26090
|
-
|
|
26091
|
-
|
|
26092
|
-
|
|
26093
|
-
|
|
26094
|
-
|
|
26095
|
-
|
|
26096
|
-
|
|
26097
|
-
|
|
26098
|
-
|
|
26099
|
-
|
|
26100
|
-
|
|
26101
|
-
|
|
26102
|
-
|
|
26103
|
-
|
|
26104
|
-
|
|
26105
|
-
|
|
26106
|
-
|
|
26107
|
-
|
|
26108
|
-
|
|
26109
|
-
|
|
26110
|
-
|
|
26111
|
-
|
|
26112
|
-
|
|
26113
|
-
|
|
26114
|
-
}
|
|
26115
|
+
//#region ../../node_modules/.pnpm/js-tokens@10.0.0/node_modules/js-tokens/index.js
|
|
26116
|
+
var HashbangComment;
|
|
26117
|
+
var Identifier;
|
|
26118
|
+
var JSXIdentifier;
|
|
26119
|
+
var JSXPunctuator;
|
|
26120
|
+
var JSXString;
|
|
26121
|
+
var JSXText;
|
|
26122
|
+
var KeywordsWithExpressionAfter;
|
|
26123
|
+
var KeywordsWithNoLineTerminatorAfter;
|
|
26124
|
+
var LineTerminatorSequence;
|
|
26125
|
+
var MultiLineComment;
|
|
26126
|
+
var Newline;
|
|
26127
|
+
var NumericLiteral;
|
|
26128
|
+
var Punctuator;
|
|
26129
|
+
var RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:[^\]\\\n\r\u2028\u2029]+|\\.)*\]?|[^\/[\\\n\r\u2028\u2029]+|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/uy;
|
|
26130
|
+
var SingleLineComment;
|
|
26131
|
+
var StringLiteral;
|
|
26132
|
+
var Template;
|
|
26133
|
+
var TokensNotPrecedingObjectLiteral;
|
|
26134
|
+
var TokensPrecedingExpression;
|
|
26135
|
+
var WhiteSpace;
|
|
26136
|
+
var jsTokens;
|
|
26137
|
+
Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y;
|
|
26138
|
+
Identifier = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]+|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/uy;
|
|
26139
|
+
StringLiteral = /(['"])(?:[^'"\\\n\r]+|(?!\1)['"]|\\(?:\r\n|[^]))*(\1)?/y;
|
|
26140
|
+
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;
|
|
26141
|
+
Template = /[`}](?:[^`\\$]+|\\[^]|\$(?!\{))*(`|\$\{)?/y;
|
|
26142
|
+
WhiteSpace = /[\t\v\f\ufeff\p{Zs}]+/uy;
|
|
26143
|
+
LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y;
|
|
26144
|
+
MultiLineComment = /\/\*(?:[^*]+|\*(?!\/))*(\*\/)?/y;
|
|
26145
|
+
SingleLineComment = /\/\/.*/y;
|
|
26146
|
+
HashbangComment = /^#!.*/;
|
|
26147
|
+
JSXPunctuator = /[<>.:={}]|\/(?![\/*])/y;
|
|
26148
|
+
JSXIdentifier = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/uy;
|
|
26149
|
+
JSXString = /(['"])(?:[^'"]+|(?!\1)['"])*(\1)?/y;
|
|
26150
|
+
JSXText = /[^<>{}]+/y;
|
|
26151
|
+
TokensPrecedingExpression = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/;
|
|
26152
|
+
TokensNotPrecedingObjectLiteral = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/;
|
|
26153
|
+
KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
|
|
26154
|
+
KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
|
|
26155
|
+
Newline = RegExp(LineTerminatorSequence.source);
|
|
26156
|
+
jsTokens = function* (input, { jsx = false } = {}) {
|
|
26157
|
+
var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
|
|
26158
|
+
({length} = input);
|
|
26159
|
+
lastIndex = 0;
|
|
26160
|
+
lastSignificantToken = "";
|
|
26161
|
+
stack = [{ tag: "JS" }];
|
|
26162
|
+
braces = [];
|
|
26163
|
+
parenNesting = 0;
|
|
26164
|
+
postfixIncDec = false;
|
|
26165
|
+
if (match = HashbangComment.exec(input)) {
|
|
26166
|
+
yield {
|
|
26167
|
+
type: "HashbangComment",
|
|
26168
|
+
value: match[0]
|
|
26169
|
+
};
|
|
26170
|
+
lastIndex = match[0].length;
|
|
26171
|
+
}
|
|
26172
|
+
while (lastIndex < length) {
|
|
26173
|
+
mode = stack[stack.length - 1];
|
|
26174
|
+
switch (mode.tag) {
|
|
26175
|
+
case "JS":
|
|
26176
|
+
case "JSNonExpressionParen":
|
|
26177
|
+
case "InterpolationInTemplate":
|
|
26178
|
+
case "InterpolationInJSX":
|
|
26179
|
+
if (input[lastIndex] === "/" && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
26180
|
+
RegularExpressionLiteral.lastIndex = lastIndex;
|
|
26181
|
+
if (match = RegularExpressionLiteral.exec(input)) {
|
|
26182
|
+
lastIndex = RegularExpressionLiteral.lastIndex;
|
|
26183
|
+
lastSignificantToken = match[0];
|
|
26184
|
+
postfixIncDec = true;
|
|
26185
|
+
yield {
|
|
26186
|
+
type: "RegularExpressionLiteral",
|
|
26187
|
+
value: match[0],
|
|
26188
|
+
closed: match[1] !== void 0 && match[1] !== "\\"
|
|
26189
|
+
};
|
|
26190
|
+
continue;
|
|
26115
26191
|
}
|
|
26116
|
-
|
|
26117
|
-
|
|
26118
|
-
|
|
26119
|
-
|
|
26120
|
-
|
|
26121
|
-
|
|
26122
|
-
|
|
26123
|
-
|
|
26124
|
-
|
|
26125
|
-
|
|
26126
|
-
|
|
26127
|
-
|
|
26128
|
-
|
|
26129
|
-
|
|
26130
|
-
|
|
26131
|
-
|
|
26132
|
-
|
|
26133
|
-
|
|
26134
|
-
|
|
26135
|
-
|
|
26136
|
-
|
|
26137
|
-
}
|
|
26138
|
-
break;
|
|
26139
|
-
case "{":
|
|
26140
|
-
Punctuator.lastIndex = 0;
|
|
26141
|
-
isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken));
|
|
26142
|
-
braces.push(isExpression);
|
|
26192
|
+
}
|
|
26193
|
+
Punctuator.lastIndex = lastIndex;
|
|
26194
|
+
if (match = Punctuator.exec(input)) {
|
|
26195
|
+
punctuator = match[0];
|
|
26196
|
+
nextLastIndex = Punctuator.lastIndex;
|
|
26197
|
+
nextLastSignificantToken = punctuator;
|
|
26198
|
+
switch (punctuator) {
|
|
26199
|
+
case "(":
|
|
26200
|
+
if (lastSignificantToken === "?NonExpressionParenKeyword") stack.push({
|
|
26201
|
+
tag: "JSNonExpressionParen",
|
|
26202
|
+
nesting: parenNesting
|
|
26203
|
+
});
|
|
26204
|
+
parenNesting++;
|
|
26205
|
+
postfixIncDec = false;
|
|
26206
|
+
break;
|
|
26207
|
+
case ")":
|
|
26208
|
+
parenNesting--;
|
|
26209
|
+
postfixIncDec = true;
|
|
26210
|
+
if (mode.tag === "JSNonExpressionParen" && parenNesting === mode.nesting) {
|
|
26211
|
+
stack.pop();
|
|
26212
|
+
nextLastSignificantToken = "?NonExpressionParenEnd";
|
|
26143
26213
|
postfixIncDec = false;
|
|
26144
|
-
|
|
26145
|
-
|
|
26146
|
-
|
|
26147
|
-
|
|
26148
|
-
|
|
26149
|
-
|
|
26150
|
-
|
|
26151
|
-
|
|
26152
|
-
|
|
26153
|
-
|
|
26154
|
-
|
|
26155
|
-
|
|
26156
|
-
|
|
26157
|
-
|
|
26158
|
-
|
|
26159
|
-
|
|
26160
|
-
|
|
26161
|
-
|
|
26162
|
-
|
|
26163
|
-
|
|
26164
|
-
|
|
26165
|
-
|
|
26166
|
-
|
|
26167
|
-
|
|
26168
|
-
|
|
26169
|
-
|
|
26214
|
+
}
|
|
26215
|
+
break;
|
|
26216
|
+
case "{":
|
|
26217
|
+
Punctuator.lastIndex = 0;
|
|
26218
|
+
isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken));
|
|
26219
|
+
braces.push(isExpression);
|
|
26220
|
+
postfixIncDec = false;
|
|
26221
|
+
break;
|
|
26222
|
+
case "}":
|
|
26223
|
+
switch (mode.tag) {
|
|
26224
|
+
case "InterpolationInTemplate":
|
|
26225
|
+
if (braces.length === mode.nesting) {
|
|
26226
|
+
Template.lastIndex = lastIndex;
|
|
26227
|
+
match = Template.exec(input);
|
|
26228
|
+
lastIndex = Template.lastIndex;
|
|
26229
|
+
lastSignificantToken = match[0];
|
|
26230
|
+
if (match[1] === "${") {
|
|
26231
|
+
lastSignificantToken = "?InterpolationInTemplate";
|
|
26232
|
+
postfixIncDec = false;
|
|
26233
|
+
yield {
|
|
26234
|
+
type: "TemplateMiddle",
|
|
26235
|
+
value: match[0]
|
|
26236
|
+
};
|
|
26237
|
+
} else {
|
|
26238
|
+
stack.pop();
|
|
26239
|
+
postfixIncDec = true;
|
|
26240
|
+
yield {
|
|
26241
|
+
type: "TemplateTail",
|
|
26242
|
+
value: match[0],
|
|
26243
|
+
closed: match[1] === "`"
|
|
26244
|
+
};
|
|
26170
26245
|
}
|
|
26171
|
-
break;
|
|
26172
|
-
case "InterpolationInJSX": if (braces.length === mode.nesting) {
|
|
26173
|
-
stack.pop();
|
|
26174
|
-
lastIndex += 1;
|
|
26175
|
-
lastSignificantToken = "}";
|
|
26176
|
-
yield {
|
|
26177
|
-
type: "JSXPunctuator",
|
|
26178
|
-
value: "}"
|
|
26179
|
-
};
|
|
26180
26246
|
continue;
|
|
26181
26247
|
}
|
|
26182
|
-
|
|
26183
|
-
|
|
26184
|
-
|
|
26185
|
-
break;
|
|
26186
|
-
case "]":
|
|
26187
|
-
postfixIncDec = true;
|
|
26188
|
-
break;
|
|
26189
|
-
case "++":
|
|
26190
|
-
case "--":
|
|
26191
|
-
nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
|
|
26192
|
-
break;
|
|
26193
|
-
case "<":
|
|
26194
|
-
if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
26195
|
-
stack.push({ tag: "JSXTag" });
|
|
26248
|
+
break;
|
|
26249
|
+
case "InterpolationInJSX": if (braces.length === mode.nesting) {
|
|
26250
|
+
stack.pop();
|
|
26196
26251
|
lastIndex += 1;
|
|
26197
|
-
lastSignificantToken = "
|
|
26252
|
+
lastSignificantToken = "}";
|
|
26198
26253
|
yield {
|
|
26199
26254
|
type: "JSXPunctuator",
|
|
26200
|
-
value:
|
|
26255
|
+
value: "}"
|
|
26201
26256
|
};
|
|
26202
26257
|
continue;
|
|
26203
26258
|
}
|
|
26204
|
-
|
|
26205
|
-
|
|
26206
|
-
|
|
26207
|
-
|
|
26208
|
-
|
|
26209
|
-
|
|
26210
|
-
|
|
26211
|
-
|
|
26212
|
-
|
|
26213
|
-
|
|
26214
|
-
|
|
26259
|
+
}
|
|
26260
|
+
postfixIncDec = braces.pop();
|
|
26261
|
+
nextLastSignificantToken = postfixIncDec ? "?ExpressionBraceEnd" : "}";
|
|
26262
|
+
break;
|
|
26263
|
+
case "]":
|
|
26264
|
+
postfixIncDec = true;
|
|
26265
|
+
break;
|
|
26266
|
+
case "++":
|
|
26267
|
+
case "--":
|
|
26268
|
+
nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
|
|
26269
|
+
break;
|
|
26270
|
+
case "<":
|
|
26271
|
+
if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
26272
|
+
stack.push({ tag: "JSXTag" });
|
|
26273
|
+
lastIndex += 1;
|
|
26274
|
+
lastSignificantToken = "<";
|
|
26275
|
+
yield {
|
|
26276
|
+
type: "JSXPunctuator",
|
|
26277
|
+
value: punctuator
|
|
26278
|
+
};
|
|
26279
|
+
continue;
|
|
26280
|
+
}
|
|
26281
|
+
postfixIncDec = false;
|
|
26282
|
+
break;
|
|
26283
|
+
default: postfixIncDec = false;
|
|
26215
26284
|
}
|
|
26216
|
-
|
|
26217
|
-
|
|
26218
|
-
|
|
26219
|
-
|
|
26220
|
-
|
|
26221
|
-
|
|
26222
|
-
|
|
26223
|
-
|
|
26224
|
-
|
|
26225
|
-
|
|
26226
|
-
|
|
26227
|
-
|
|
26285
|
+
lastIndex = nextLastIndex;
|
|
26286
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
26287
|
+
yield {
|
|
26288
|
+
type: "Punctuator",
|
|
26289
|
+
value: punctuator
|
|
26290
|
+
};
|
|
26291
|
+
continue;
|
|
26292
|
+
}
|
|
26293
|
+
Identifier.lastIndex = lastIndex;
|
|
26294
|
+
if (match = Identifier.exec(input)) {
|
|
26295
|
+
lastIndex = Identifier.lastIndex;
|
|
26296
|
+
nextLastSignificantToken = match[0];
|
|
26297
|
+
switch (match[0]) {
|
|
26298
|
+
case "for":
|
|
26299
|
+
case "if":
|
|
26300
|
+
case "while":
|
|
26301
|
+
case "with": if (lastSignificantToken !== "." && lastSignificantToken !== "?.") nextLastSignificantToken = "?NonExpressionParenKeyword";
|
|
26302
|
+
}
|
|
26303
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
26304
|
+
postfixIncDec = !KeywordsWithExpressionAfter.test(match[0]);
|
|
26305
|
+
yield {
|
|
26306
|
+
type: match[1] === "#" ? "PrivateIdentifier" : "IdentifierName",
|
|
26307
|
+
value: match[0]
|
|
26308
|
+
};
|
|
26309
|
+
continue;
|
|
26310
|
+
}
|
|
26311
|
+
StringLiteral.lastIndex = lastIndex;
|
|
26312
|
+
if (match = StringLiteral.exec(input)) {
|
|
26313
|
+
lastIndex = StringLiteral.lastIndex;
|
|
26314
|
+
lastSignificantToken = match[0];
|
|
26315
|
+
postfixIncDec = true;
|
|
26316
|
+
yield {
|
|
26317
|
+
type: "StringLiteral",
|
|
26318
|
+
value: match[0],
|
|
26319
|
+
closed: match[2] !== void 0
|
|
26320
|
+
};
|
|
26321
|
+
continue;
|
|
26322
|
+
}
|
|
26323
|
+
NumericLiteral.lastIndex = lastIndex;
|
|
26324
|
+
if (match = NumericLiteral.exec(input)) {
|
|
26325
|
+
lastIndex = NumericLiteral.lastIndex;
|
|
26326
|
+
lastSignificantToken = match[0];
|
|
26327
|
+
postfixIncDec = true;
|
|
26328
|
+
yield {
|
|
26329
|
+
type: "NumericLiteral",
|
|
26330
|
+
value: match[0]
|
|
26331
|
+
};
|
|
26332
|
+
continue;
|
|
26333
|
+
}
|
|
26334
|
+
Template.lastIndex = lastIndex;
|
|
26335
|
+
if (match = Template.exec(input)) {
|
|
26336
|
+
lastIndex = Template.lastIndex;
|
|
26337
|
+
lastSignificantToken = match[0];
|
|
26338
|
+
if (match[1] === "${") {
|
|
26339
|
+
lastSignificantToken = "?InterpolationInTemplate";
|
|
26340
|
+
stack.push({
|
|
26341
|
+
tag: "InterpolationInTemplate",
|
|
26342
|
+
nesting: braces.length
|
|
26343
|
+
});
|
|
26344
|
+
postfixIncDec = false;
|
|
26228
26345
|
yield {
|
|
26229
|
-
type:
|
|
26346
|
+
type: "TemplateHead",
|
|
26230
26347
|
value: match[0]
|
|
26231
26348
|
};
|
|
26232
|
-
|
|
26233
|
-
}
|
|
26234
|
-
StringLiteral.lastIndex = lastIndex;
|
|
26235
|
-
if (match = StringLiteral.exec(input)) {
|
|
26236
|
-
lastIndex = StringLiteral.lastIndex;
|
|
26237
|
-
lastSignificantToken = match[0];
|
|
26349
|
+
} else {
|
|
26238
26350
|
postfixIncDec = true;
|
|
26239
26351
|
yield {
|
|
26240
|
-
type: "
|
|
26352
|
+
type: "NoSubstitutionTemplate",
|
|
26241
26353
|
value: match[0],
|
|
26242
|
-
closed: match[
|
|
26243
|
-
};
|
|
26244
|
-
continue;
|
|
26245
|
-
}
|
|
26246
|
-
NumericLiteral.lastIndex = lastIndex;
|
|
26247
|
-
if (match = NumericLiteral.exec(input)) {
|
|
26248
|
-
lastIndex = NumericLiteral.lastIndex;
|
|
26249
|
-
lastSignificantToken = match[0];
|
|
26250
|
-
postfixIncDec = true;
|
|
26251
|
-
yield {
|
|
26252
|
-
type: "NumericLiteral",
|
|
26253
|
-
value: match[0]
|
|
26354
|
+
closed: match[1] === "`"
|
|
26254
26355
|
};
|
|
26255
|
-
continue;
|
|
26256
26356
|
}
|
|
26257
|
-
|
|
26258
|
-
|
|
26259
|
-
|
|
26260
|
-
|
|
26261
|
-
|
|
26262
|
-
|
|
26357
|
+
continue;
|
|
26358
|
+
}
|
|
26359
|
+
break;
|
|
26360
|
+
case "JSXTag":
|
|
26361
|
+
case "JSXTagEnd":
|
|
26362
|
+
JSXPunctuator.lastIndex = lastIndex;
|
|
26363
|
+
if (match = JSXPunctuator.exec(input)) {
|
|
26364
|
+
lastIndex = JSXPunctuator.lastIndex;
|
|
26365
|
+
nextLastSignificantToken = match[0];
|
|
26366
|
+
switch (match[0]) {
|
|
26367
|
+
case "<":
|
|
26368
|
+
stack.push({ tag: "JSXTag" });
|
|
26369
|
+
break;
|
|
26370
|
+
case ">":
|
|
26371
|
+
stack.pop();
|
|
26372
|
+
if (lastSignificantToken === "/" || mode.tag === "JSXTagEnd") {
|
|
26373
|
+
nextLastSignificantToken = "?JSX";
|
|
26374
|
+
postfixIncDec = true;
|
|
26375
|
+
} else stack.push({ tag: "JSXChildren" });
|
|
26376
|
+
break;
|
|
26377
|
+
case "{":
|
|
26263
26378
|
stack.push({
|
|
26264
|
-
tag: "
|
|
26379
|
+
tag: "InterpolationInJSX",
|
|
26265
26380
|
nesting: braces.length
|
|
26266
26381
|
});
|
|
26382
|
+
nextLastSignificantToken = "?InterpolationInJSX";
|
|
26267
26383
|
postfixIncDec = false;
|
|
26268
|
-
|
|
26269
|
-
|
|
26270
|
-
|
|
26271
|
-
|
|
26272
|
-
|
|
26273
|
-
postfixIncDec = true;
|
|
26274
|
-
yield {
|
|
26275
|
-
type: "NoSubstitutionTemplate",
|
|
26276
|
-
value: match[0],
|
|
26277
|
-
closed: match[1] === "`"
|
|
26278
|
-
};
|
|
26384
|
+
break;
|
|
26385
|
+
case "/": if (lastSignificantToken === "<") {
|
|
26386
|
+
stack.pop();
|
|
26387
|
+
if (stack[stack.length - 1].tag === "JSXChildren") stack.pop();
|
|
26388
|
+
stack.push({ tag: "JSXTagEnd" });
|
|
26279
26389
|
}
|
|
26280
|
-
continue;
|
|
26281
26390
|
}
|
|
26282
|
-
|
|
26283
|
-
|
|
26284
|
-
|
|
26285
|
-
|
|
26286
|
-
|
|
26287
|
-
|
|
26288
|
-
|
|
26289
|
-
|
|
26290
|
-
|
|
26291
|
-
|
|
26292
|
-
|
|
26293
|
-
|
|
26294
|
-
|
|
26295
|
-
|
|
26296
|
-
|
|
26297
|
-
|
|
26298
|
-
|
|
26299
|
-
|
|
26300
|
-
|
|
26301
|
-
|
|
26302
|
-
|
|
26303
|
-
|
|
26304
|
-
|
|
26305
|
-
|
|
26306
|
-
|
|
26307
|
-
|
|
26308
|
-
|
|
26309
|
-
|
|
26310
|
-
|
|
26311
|
-
|
|
26312
|
-
|
|
26313
|
-
|
|
26314
|
-
|
|
26391
|
+
lastSignificantToken = nextLastSignificantToken;
|
|
26392
|
+
yield {
|
|
26393
|
+
type: "JSXPunctuator",
|
|
26394
|
+
value: match[0]
|
|
26395
|
+
};
|
|
26396
|
+
continue;
|
|
26397
|
+
}
|
|
26398
|
+
JSXIdentifier.lastIndex = lastIndex;
|
|
26399
|
+
if (match = JSXIdentifier.exec(input)) {
|
|
26400
|
+
lastIndex = JSXIdentifier.lastIndex;
|
|
26401
|
+
lastSignificantToken = match[0];
|
|
26402
|
+
yield {
|
|
26403
|
+
type: "JSXIdentifier",
|
|
26404
|
+
value: match[0]
|
|
26405
|
+
};
|
|
26406
|
+
continue;
|
|
26407
|
+
}
|
|
26408
|
+
JSXString.lastIndex = lastIndex;
|
|
26409
|
+
if (match = JSXString.exec(input)) {
|
|
26410
|
+
lastIndex = JSXString.lastIndex;
|
|
26411
|
+
lastSignificantToken = match[0];
|
|
26412
|
+
yield {
|
|
26413
|
+
type: "JSXString",
|
|
26414
|
+
value: match[0],
|
|
26415
|
+
closed: match[2] !== void 0
|
|
26416
|
+
};
|
|
26417
|
+
continue;
|
|
26418
|
+
}
|
|
26419
|
+
break;
|
|
26420
|
+
case "JSXChildren":
|
|
26421
|
+
JSXText.lastIndex = lastIndex;
|
|
26422
|
+
if (match = JSXText.exec(input)) {
|
|
26423
|
+
lastIndex = JSXText.lastIndex;
|
|
26424
|
+
lastSignificantToken = match[0];
|
|
26425
|
+
yield {
|
|
26426
|
+
type: "JSXText",
|
|
26427
|
+
value: match[0]
|
|
26428
|
+
};
|
|
26429
|
+
continue;
|
|
26430
|
+
}
|
|
26431
|
+
switch (input[lastIndex]) {
|
|
26432
|
+
case "<":
|
|
26433
|
+
stack.push({ tag: "JSXTag" });
|
|
26434
|
+
lastIndex++;
|
|
26435
|
+
lastSignificantToken = "<";
|
|
26315
26436
|
yield {
|
|
26316
26437
|
type: "JSXPunctuator",
|
|
26317
|
-
value:
|
|
26438
|
+
value: "<"
|
|
26318
26439
|
};
|
|
26319
26440
|
continue;
|
|
26320
|
-
|
|
26321
|
-
|
|
26322
|
-
|
|
26323
|
-
|
|
26324
|
-
|
|
26325
|
-
|
|
26326
|
-
|
|
26327
|
-
|
|
26328
|
-
};
|
|
26329
|
-
continue;
|
|
26330
|
-
}
|
|
26331
|
-
JSXString.lastIndex = lastIndex;
|
|
26332
|
-
if (match = JSXString.exec(input)) {
|
|
26333
|
-
lastIndex = JSXString.lastIndex;
|
|
26334
|
-
lastSignificantToken = match[0];
|
|
26335
|
-
yield {
|
|
26336
|
-
type: "JSXString",
|
|
26337
|
-
value: match[0],
|
|
26338
|
-
closed: match[2] !== void 0
|
|
26339
|
-
};
|
|
26340
|
-
continue;
|
|
26341
|
-
}
|
|
26342
|
-
break;
|
|
26343
|
-
case "JSXChildren":
|
|
26344
|
-
JSXText.lastIndex = lastIndex;
|
|
26345
|
-
if (match = JSXText.exec(input)) {
|
|
26346
|
-
lastIndex = JSXText.lastIndex;
|
|
26347
|
-
lastSignificantToken = match[0];
|
|
26441
|
+
case "{":
|
|
26442
|
+
stack.push({
|
|
26443
|
+
tag: "InterpolationInJSX",
|
|
26444
|
+
nesting: braces.length
|
|
26445
|
+
});
|
|
26446
|
+
lastIndex++;
|
|
26447
|
+
lastSignificantToken = "?InterpolationInJSX";
|
|
26448
|
+
postfixIncDec = false;
|
|
26348
26449
|
yield {
|
|
26349
|
-
type: "
|
|
26350
|
-
value:
|
|
26450
|
+
type: "JSXPunctuator",
|
|
26451
|
+
value: "{"
|
|
26351
26452
|
};
|
|
26352
26453
|
continue;
|
|
26353
|
-
|
|
26354
|
-
|
|
26355
|
-
|
|
26356
|
-
|
|
26357
|
-
|
|
26358
|
-
|
|
26359
|
-
|
|
26360
|
-
|
|
26361
|
-
|
|
26362
|
-
|
|
26363
|
-
|
|
26364
|
-
|
|
26365
|
-
|
|
26366
|
-
|
|
26367
|
-
|
|
26368
|
-
|
|
26369
|
-
|
|
26370
|
-
|
|
26371
|
-
|
|
26372
|
-
|
|
26373
|
-
|
|
26374
|
-
|
|
26375
|
-
|
|
26376
|
-
|
|
26377
|
-
|
|
26378
|
-
|
|
26379
|
-
WhiteSpace.lastIndex = lastIndex;
|
|
26380
|
-
if (match = WhiteSpace.exec(input)) {
|
|
26381
|
-
lastIndex = WhiteSpace.lastIndex;
|
|
26382
|
-
yield {
|
|
26383
|
-
type: "WhiteSpace",
|
|
26384
|
-
value: match[0]
|
|
26385
|
-
};
|
|
26386
|
-
continue;
|
|
26387
|
-
}
|
|
26388
|
-
LineTerminatorSequence.lastIndex = lastIndex;
|
|
26389
|
-
if (match = LineTerminatorSequence.exec(input)) {
|
|
26390
|
-
lastIndex = LineTerminatorSequence.lastIndex;
|
|
26454
|
+
}
|
|
26455
|
+
}
|
|
26456
|
+
WhiteSpace.lastIndex = lastIndex;
|
|
26457
|
+
if (match = WhiteSpace.exec(input)) {
|
|
26458
|
+
lastIndex = WhiteSpace.lastIndex;
|
|
26459
|
+
yield {
|
|
26460
|
+
type: "WhiteSpace",
|
|
26461
|
+
value: match[0]
|
|
26462
|
+
};
|
|
26463
|
+
continue;
|
|
26464
|
+
}
|
|
26465
|
+
LineTerminatorSequence.lastIndex = lastIndex;
|
|
26466
|
+
if (match = LineTerminatorSequence.exec(input)) {
|
|
26467
|
+
lastIndex = LineTerminatorSequence.lastIndex;
|
|
26468
|
+
postfixIncDec = false;
|
|
26469
|
+
if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere";
|
|
26470
|
+
yield {
|
|
26471
|
+
type: "LineTerminatorSequence",
|
|
26472
|
+
value: match[0]
|
|
26473
|
+
};
|
|
26474
|
+
continue;
|
|
26475
|
+
}
|
|
26476
|
+
MultiLineComment.lastIndex = lastIndex;
|
|
26477
|
+
if (match = MultiLineComment.exec(input)) {
|
|
26478
|
+
lastIndex = MultiLineComment.lastIndex;
|
|
26479
|
+
if (Newline.test(match[0])) {
|
|
26391
26480
|
postfixIncDec = false;
|
|
26392
26481
|
if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere";
|
|
26393
|
-
yield {
|
|
26394
|
-
type: "LineTerminatorSequence",
|
|
26395
|
-
value: match[0]
|
|
26396
|
-
};
|
|
26397
|
-
continue;
|
|
26398
|
-
}
|
|
26399
|
-
MultiLineComment.lastIndex = lastIndex;
|
|
26400
|
-
if (match = MultiLineComment.exec(input)) {
|
|
26401
|
-
lastIndex = MultiLineComment.lastIndex;
|
|
26402
|
-
if (Newline.test(match[0])) {
|
|
26403
|
-
postfixIncDec = false;
|
|
26404
|
-
if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere";
|
|
26405
|
-
}
|
|
26406
|
-
yield {
|
|
26407
|
-
type: "MultiLineComment",
|
|
26408
|
-
value: match[0],
|
|
26409
|
-
closed: match[1] !== void 0
|
|
26410
|
-
};
|
|
26411
|
-
continue;
|
|
26412
26482
|
}
|
|
26413
|
-
|
|
26414
|
-
|
|
26415
|
-
|
|
26416
|
-
|
|
26417
|
-
|
|
26418
|
-
|
|
26419
|
-
|
|
26420
|
-
|
|
26421
|
-
|
|
26422
|
-
|
|
26423
|
-
firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex));
|
|
26424
|
-
lastIndex += firstCodePoint.length;
|
|
26425
|
-
lastSignificantToken = firstCodePoint;
|
|
26483
|
+
yield {
|
|
26484
|
+
type: "MultiLineComment",
|
|
26485
|
+
value: match[0],
|
|
26486
|
+
closed: match[1] !== void 0
|
|
26487
|
+
};
|
|
26488
|
+
continue;
|
|
26489
|
+
}
|
|
26490
|
+
SingleLineComment.lastIndex = lastIndex;
|
|
26491
|
+
if (match = SingleLineComment.exec(input)) {
|
|
26492
|
+
lastIndex = SingleLineComment.lastIndex;
|
|
26426
26493
|
postfixIncDec = false;
|
|
26427
26494
|
yield {
|
|
26428
|
-
type:
|
|
26429
|
-
value:
|
|
26495
|
+
type: "SingleLineComment",
|
|
26496
|
+
value: match[0]
|
|
26430
26497
|
};
|
|
26498
|
+
continue;
|
|
26431
26499
|
}
|
|
26432
|
-
|
|
26433
|
-
|
|
26500
|
+
firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex));
|
|
26501
|
+
lastIndex += firstCodePoint.length;
|
|
26502
|
+
lastSignificantToken = firstCodePoint;
|
|
26503
|
+
postfixIncDec = false;
|
|
26504
|
+
yield {
|
|
26505
|
+
type: mode.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid",
|
|
26506
|
+
value: firstCodePoint
|
|
26507
|
+
};
|
|
26508
|
+
}
|
|
26509
|
+
};
|
|
26510
|
+
var js_tokens_default = jsTokens;
|
|
26511
|
+
//#endregion
|
|
26512
|
+
//#region ../../node_modules/.pnpm/strip-literal@4.0.0/node_modules/strip-literal/dist/index.mjs
|
|
26434
26513
|
const FILL_COMMENT = " ";
|
|
26435
26514
|
function stripLiteralFromToken(token, fillChar, filter) {
|
|
26436
26515
|
if (token.type === "SingleLineComment") return FILL_COMMENT.repeat(token.value.length);
|
|
@@ -26468,10 +26547,13 @@ function optionsWithDefaults(options) {
|
|
|
26468
26547
|
filter: options?.filter ?? (() => true)
|
|
26469
26548
|
};
|
|
26470
26549
|
}
|
|
26550
|
+
/**
|
|
26551
|
+
* Strip literal from code.
|
|
26552
|
+
*/
|
|
26471
26553
|
function stripLiteral(code, options) {
|
|
26472
26554
|
let result = "";
|
|
26473
26555
|
const _options = optionsWithDefaults(options);
|
|
26474
|
-
for (const token of (
|
|
26556
|
+
for (const token of js_tokens_default(code, { jsx: false })) result += stripLiteralFromToken(token, _options.fillChar, _options.filter);
|
|
26475
26557
|
return result;
|
|
26476
26558
|
}
|
|
26477
26559
|
//#endregion
|
|
@@ -26713,7 +26795,8 @@ function assetPlugin(config) {
|
|
|
26713
26795
|
}
|
|
26714
26796
|
}
|
|
26715
26797
|
if (config.command === "build" && !this.environment.config.build.emitAssets) {
|
|
26716
|
-
|
|
26798
|
+
const chunkImportMapEnabled = this.environment.config.build.chunkImportMap;
|
|
26799
|
+
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];
|
|
26717
26800
|
}
|
|
26718
26801
|
},
|
|
26719
26802
|
watchChange(id) {
|
|
@@ -26776,8 +26859,10 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
|
|
|
26776
26859
|
const topLevelConfig = environment.getTopLevelConfig();
|
|
26777
26860
|
if (!skipPublicCheck) {
|
|
26778
26861
|
const publicFile = checkPublicFile(id, topLevelConfig);
|
|
26779
|
-
if (publicFile)
|
|
26780
|
-
|
|
26862
|
+
if (publicFile) {
|
|
26863
|
+
if (inlineRE$3.test(id)) id = publicFile;
|
|
26864
|
+
else return publicFileToBuiltUrl(id, topLevelConfig);
|
|
26865
|
+
}
|
|
26781
26866
|
}
|
|
26782
26867
|
const cache = assetCache.get(environment);
|
|
26783
26868
|
const cached = cache.get(id);
|
|
@@ -27836,8 +27921,10 @@ function cssPlugin(config) {
|
|
|
27836
27921
|
const resolveUrl = (url, importer) => idResolver(environment, url, importer);
|
|
27837
27922
|
const urlResolver = async (url, importer) => {
|
|
27838
27923
|
const decodedUrl = decodeURI(url);
|
|
27839
|
-
if (checkPublicFile(decodedUrl, config))
|
|
27840
|
-
|
|
27924
|
+
if (checkPublicFile(decodedUrl, config)) {
|
|
27925
|
+
if (encodePublicUrlsInCSS(config)) return [publicFileToBuiltUrl(decodedUrl, config), void 0];
|
|
27926
|
+
else return [joinUrlSegments(joinUrlSegments(config.server.origin ?? "", config.base), decodedUrl), void 0];
|
|
27927
|
+
}
|
|
27841
27928
|
const [id, fragment] = decodedUrl.split("#");
|
|
27842
27929
|
let resolved = await resolveUrl(id, importer);
|
|
27843
27930
|
if (resolved) {
|
|
@@ -28102,11 +28189,13 @@ function cssPostPlugin(config) {
|
|
|
28102
28189
|
chunkCSSMap.set(chunk.fileName, chunkCSS);
|
|
28103
28190
|
}
|
|
28104
28191
|
}
|
|
28105
|
-
if (s)
|
|
28106
|
-
|
|
28107
|
-
|
|
28108
|
-
|
|
28109
|
-
|
|
28192
|
+
if (s) {
|
|
28193
|
+
if (config.build.sourcemap) return {
|
|
28194
|
+
code: s.toString(),
|
|
28195
|
+
map: s.generateMap({ hires: "boundary" })
|
|
28196
|
+
};
|
|
28197
|
+
else return { code: s.toString() };
|
|
28198
|
+
}
|
|
28110
28199
|
return null;
|
|
28111
28200
|
},
|
|
28112
28201
|
augmentChunkHash(chunk) {
|
|
@@ -28143,8 +28232,8 @@ function cssPostPlugin(config) {
|
|
|
28143
28232
|
});
|
|
28144
28233
|
}
|
|
28145
28234
|
}
|
|
28146
|
-
if (config.build.chunkImportMap && chunkCssReferences.size) {
|
|
28147
|
-
const importMap = getImportMap(bundle, config);
|
|
28235
|
+
if (this.environment.config.build.chunkImportMap && chunkCssReferences.size) {
|
|
28236
|
+
const importMap = getImportMap(bundle, this.environment.config);
|
|
28148
28237
|
const importMapReverseMapping = Object.fromEntries(Object.entries(importMap.mapping).map(([k, v]) => [v, k]));
|
|
28149
28238
|
const chunksByPreliminaryFileName = new Map(Object.values(bundle).filter((output) => output.type === "chunk").map((chunk) => [chunk.preliminaryFileName, chunk]));
|
|
28150
28239
|
for (const [chunkFileName, referenceId] of chunkCssReferences) {
|
|
@@ -28160,9 +28249,10 @@ function cssPostPlugin(config) {
|
|
|
28160
28249
|
if (pureCssChunks.size) {
|
|
28161
28250
|
const prelimaryNameToChunkMap = Object.fromEntries(Object.values(bundle).filter((chunk) => chunk.type === "chunk").map((chunk) => [chunk.preliminaryFileName, chunk.fileName]));
|
|
28162
28251
|
const pureCssChunkNames = [...pureCssChunks].map((pureCssChunk) => prelimaryNameToChunkMap[pureCssChunk.fileName]).filter(Boolean);
|
|
28252
|
+
const pureCssChunkNameSet = new Set(pureCssChunkNames);
|
|
28163
28253
|
let importMapReverseMapping;
|
|
28164
|
-
if (config.build.chunkImportMap) {
|
|
28165
|
-
const importMap = getImportMap(bundle, config);
|
|
28254
|
+
if (this.environment.config.build.chunkImportMap) {
|
|
28255
|
+
const importMap = getImportMap(bundle, this.environment.config);
|
|
28166
28256
|
importMapReverseMapping = Object.fromEntries(Object.entries(importMap.mapping).map(([k, v]) => [v, k]));
|
|
28167
28257
|
}
|
|
28168
28258
|
const replaceEmptyChunk = getEmptyChunkReplacer(importMapReverseMapping ? pureCssChunkNames.map((name) => importMapReverseMapping[name] ?? name) : pureCssChunkNames, opts.format);
|
|
@@ -28171,7 +28261,7 @@ function cssPostPlugin(config) {
|
|
|
28171
28261
|
if (chunk.type === "chunk") {
|
|
28172
28262
|
let chunkImportsPureCssChunk = false;
|
|
28173
28263
|
chunk.imports = chunk.imports.filter((file) => {
|
|
28174
|
-
if (
|
|
28264
|
+
if (pureCssChunkNameSet.has(file)) {
|
|
28175
28265
|
const { importedCss, importedAssets } = bundle[file].viteMetadata;
|
|
28176
28266
|
importedCss.forEach((file) => chunk.viteMetadata.importedCss.add(file));
|
|
28177
28267
|
importedAssets.forEach((file) => chunk.viteMetadata.importedAssets.add(file));
|
|
@@ -28211,15 +28301,17 @@ function injectInlinedCSS(s, ctx, code, format, injectCode) {
|
|
|
28211
28301
|
const m = (format === "iife" ? IIFE_BEGIN_RE : UMD_BEGIN_RE).exec(code);
|
|
28212
28302
|
if (!m) ctx.error("Injection point for inlined CSS not found");
|
|
28213
28303
|
injectionPoint = m.index + m[0].length;
|
|
28214
|
-
} else if (format === "es")
|
|
28215
|
-
|
|
28216
|
-
|
|
28217
|
-
|
|
28218
|
-
|
|
28219
|
-
|
|
28220
|
-
|
|
28221
|
-
|
|
28222
|
-
|
|
28304
|
+
} else if (format === "es") {
|
|
28305
|
+
if (code.startsWith("#!")) {
|
|
28306
|
+
const fileStartIndex = getFileStartIndex(code);
|
|
28307
|
+
const hashbang = code.slice(0, fileStartIndex);
|
|
28308
|
+
if (!lineTerminatorRE.test(hashbang)) {
|
|
28309
|
+
s.append(`\n${injectCode}`);
|
|
28310
|
+
return;
|
|
28311
|
+
}
|
|
28312
|
+
injectionPoint = fileStartIndex;
|
|
28313
|
+
} else injectionPoint = 0;
|
|
28314
|
+
} else ctx.error("Non supported format");
|
|
28223
28315
|
s.appendRight(injectionPoint, injectCode);
|
|
28224
28316
|
}
|
|
28225
28317
|
function cssAnalysisPlugin(config) {
|
|
@@ -28582,13 +28674,15 @@ async function resolvePostcssConfig(config) {
|
|
|
28582
28674
|
const searchPath = typeof inlineOptions === "string" ? inlineOptions : config.root;
|
|
28583
28675
|
const stopDir = searchForWorkspaceRoot(config.root);
|
|
28584
28676
|
result = (0, import_src.default)({}, searchPath, { stopDir }).catch((e) => {
|
|
28585
|
-
if (!e.message.includes("No PostCSS Config found"))
|
|
28586
|
-
|
|
28587
|
-
|
|
28588
|
-
|
|
28589
|
-
|
|
28590
|
-
|
|
28591
|
-
|
|
28677
|
+
if (!e.message.includes("No PostCSS Config found")) {
|
|
28678
|
+
if (e instanceof Error) {
|
|
28679
|
+
const { name, message, stack } = e;
|
|
28680
|
+
e.name = "Failed to load PostCSS config";
|
|
28681
|
+
e.message = `Failed to load PostCSS config (searchPath: ${searchPath}): [${name}] ${message}\n${stack}`;
|
|
28682
|
+
e.stack = "";
|
|
28683
|
+
throw e;
|
|
28684
|
+
} else throw new Error(`Failed to load PostCSS config: ${e}`);
|
|
28685
|
+
}
|
|
28592
28686
|
return null;
|
|
28593
28687
|
});
|
|
28594
28688
|
result.then((resolved) => {
|
|
@@ -28722,10 +28816,12 @@ async function minifyCSS(css, config, inlined, filename = defaultCssBundleName)
|
|
|
28722
28816
|
const { code, warnings } = (await importLightningCSS()).transform({
|
|
28723
28817
|
...config.css.lightningcss,
|
|
28724
28818
|
targets: convertTargets(config.build.cssTarget),
|
|
28725
|
-
cssModules: void 0,
|
|
28726
28819
|
filename,
|
|
28727
28820
|
code: Buffer.from(css),
|
|
28728
|
-
minify: true
|
|
28821
|
+
minify: true,
|
|
28822
|
+
cssModules: void 0,
|
|
28823
|
+
visitor: void 0,
|
|
28824
|
+
customAtRules: void 0
|
|
28729
28825
|
});
|
|
28730
28826
|
for (const warning of warnings) {
|
|
28731
28827
|
let msg = `[lightningcss minify] ${warning.message}`;
|
|
@@ -29823,20 +29919,22 @@ function buildHtmlPlugin(config) {
|
|
|
29823
29919
|
else if (attr.type === "src") {
|
|
29824
29920
|
const url = decodeURIIfPossible(attr.value);
|
|
29825
29921
|
if (url === void 0) {} else if (checkPublicFile(url, config)) overwriteAttrValue(s, attr.location, partialEncodeURIPath(toOutputPublicFilePath(url)));
|
|
29826
|
-
else if (!isExcludedUrl(url))
|
|
29827
|
-
|
|
29828
|
-
|
|
29829
|
-
|
|
29830
|
-
|
|
29831
|
-
|
|
29832
|
-
|
|
29833
|
-
|
|
29834
|
-
|
|
29835
|
-
|
|
29836
|
-
|
|
29837
|
-
|
|
29838
|
-
|
|
29839
|
-
|
|
29922
|
+
else if (!isExcludedUrl(url)) {
|
|
29923
|
+
if (node.nodeName === "link" && isCSSRequest(url) && !("media" in attr.attributes || "disabled" in attr.attributes)) {
|
|
29924
|
+
const importExpression = `\nimport ${JSON.stringify(url)}`;
|
|
29925
|
+
styleUrls.push({
|
|
29926
|
+
url,
|
|
29927
|
+
start: nodeStartWithLeadingWhitespace(node),
|
|
29928
|
+
end: node.sourceCodeLocation.endOffset
|
|
29929
|
+
});
|
|
29930
|
+
js += importExpression;
|
|
29931
|
+
} else {
|
|
29932
|
+
const shouldInline = node.nodeName === "link" && attr.attributes.rel && parseRelAttr(attr.attributes.rel).some((v) => noInlineLinkRels.has(v)) ? false : void 0;
|
|
29933
|
+
assetUrlsPromises.push((async () => {
|
|
29934
|
+
const processedUrl = await processAssetUrl(url, shouldInline);
|
|
29935
|
+
if (processedUrl !== url) overwriteAttrValue(s, attr.location, partialEncodeURIPath(processedUrl));
|
|
29936
|
+
})());
|
|
29937
|
+
}
|
|
29840
29938
|
}
|
|
29841
29939
|
}
|
|
29842
29940
|
const inlineStyle = findNeedTransformStyleAttribute(node);
|
|
@@ -29961,6 +30059,13 @@ function buildHtmlPlugin(config) {
|
|
|
29961
30059
|
assetTags.push(...getCssTagsForChunk(chunk, toOutputAssetFilePath));
|
|
29962
30060
|
result = injectToHead(result, assetTags);
|
|
29963
30061
|
}
|
|
30062
|
+
if (config.command === "serve" && this.environment.config.consumer === "client" && this.environment.config.isBundled) result = injectToHead(result, [{
|
|
30063
|
+
tag: "script",
|
|
30064
|
+
attrs: {
|
|
30065
|
+
type: "module",
|
|
30066
|
+
src: path.posix.join(config.base, BUNDLED_DEV_CLIENT_FILENAME)
|
|
30067
|
+
}
|
|
30068
|
+
}], true);
|
|
29964
30069
|
if (!this.environment.config.build.cssCodeSplit) {
|
|
29965
30070
|
const cssBundleName = cssBundleNameCache.get(config);
|
|
29966
30071
|
const cssChunk = cssBundleName && Object.values(bundle).find((chunk) => chunk.type === "asset" && chunk.names.includes(cssBundleName));
|
|
@@ -30058,7 +30163,7 @@ function preImportMapHook(config) {
|
|
|
30058
30163
|
function postImportMapHook(config) {
|
|
30059
30164
|
const decoder = new TextDecoder();
|
|
30060
30165
|
return function(html, { bundle }) {
|
|
30061
|
-
const chunkImportMapEnabled = config.command === "build" && config.build.chunkImportMap;
|
|
30166
|
+
const chunkImportMapEnabled = config.command === "build" && config.environments.client.build.chunkImportMap;
|
|
30062
30167
|
if (importMapAppendRE.test(html)) {
|
|
30063
30168
|
let importMap;
|
|
30064
30169
|
html = html.replace(importMapRE, (match) => {
|
|
@@ -30072,7 +30177,7 @@ function postImportMapHook(config) {
|
|
|
30072
30177
|
}
|
|
30073
30178
|
if (chunkImportMapEnabled) {
|
|
30074
30179
|
const nonce = config.html?.cspNonce;
|
|
30075
|
-
const importMap = bundle[getImportMapFilename(config)];
|
|
30180
|
+
const importMap = bundle[getImportMapFilename(config.environments.client)];
|
|
30076
30181
|
const importMapHtml = serializeTag({
|
|
30077
30182
|
tag: "script",
|
|
30078
30183
|
attrs: {
|
|
@@ -30296,23 +30401,29 @@ function serializeAttrs(attrs) {
|
|
|
30296
30401
|
function incrementIndent(indent = "") {
|
|
30297
30402
|
return `${indent}${indent[0] === " " ? " " : " "}`;
|
|
30298
30403
|
}
|
|
30299
|
-
function getImportMapFilename(
|
|
30300
|
-
const chunkImportMap =
|
|
30404
|
+
function getImportMapFilename(options) {
|
|
30405
|
+
const chunkImportMap = options.build.rolldownOptions.experimental?.chunkImportMap;
|
|
30301
30406
|
if (typeof chunkImportMap === "object" && chunkImportMap.fileName) return chunkImportMap.fileName;
|
|
30302
30407
|
return "importmap.json";
|
|
30303
30408
|
}
|
|
30409
|
+
function getImportMapBaseUrl(options) {
|
|
30410
|
+
const chunkImportMap = options.build.rolldownOptions.experimental?.chunkImportMap;
|
|
30411
|
+
if (typeof chunkImportMap === "object" && chunkImportMap.baseUrl) return chunkImportMap.baseUrl;
|
|
30412
|
+
return "/";
|
|
30413
|
+
}
|
|
30304
30414
|
/**
|
|
30305
30415
|
* Read and parse the chunk import map asset from the bundle.
|
|
30306
30416
|
* Returns `undefined` when the import map is not present in the bundle.
|
|
30307
30417
|
*/
|
|
30308
|
-
function getImportMap(bundle,
|
|
30309
|
-
const asset = bundle[getImportMapFilename(
|
|
30418
|
+
function getImportMap(bundle, options) {
|
|
30419
|
+
const asset = bundle[getImportMapFilename(options)];
|
|
30310
30420
|
if (!asset) return void 0;
|
|
30311
30421
|
const content = JSON.parse(typeof asset.source === "string" ? asset.source : new TextDecoder().decode(asset.source));
|
|
30422
|
+
const baseUrl = getImportMapBaseUrl(options);
|
|
30312
30423
|
return {
|
|
30313
30424
|
asset,
|
|
30314
30425
|
content,
|
|
30315
|
-
mapping: Object.fromEntries(Object.entries(content.imports).map(([k, v]) => [k.slice(
|
|
30426
|
+
mapping: Object.fromEntries(Object.entries(content.imports).map(([k, v]) => [k.slice(baseUrl.length), v.slice(baseUrl.length)]))
|
|
30316
30427
|
};
|
|
30317
30428
|
}
|
|
30318
30429
|
//#endregion
|
|
@@ -30921,7 +31032,7 @@ function indexHtmlMiddleware(root, server) {
|
|
|
30921
31032
|
}
|
|
30922
31033
|
const filePath = pathname.slice(1);
|
|
30923
31034
|
let file = fullBundle.memoryFiles.get(filePath);
|
|
30924
|
-
if (!file && fullBundle.
|
|
31035
|
+
if (!file && fullBundle.hasBuildOutput) return next();
|
|
30925
31036
|
if ([
|
|
30926
31037
|
"document",
|
|
30927
31038
|
"iframe",
|
|
@@ -31904,7 +32015,7 @@ async function startServer(server, hostname, inlinePort) {
|
|
|
31904
32015
|
if (!httpServer) throw new Error("Cannot call server.listen in middleware mode.");
|
|
31905
32016
|
const options = server.config.server;
|
|
31906
32017
|
const configPort = inlinePort ?? options.port;
|
|
31907
|
-
const port =
|
|
32018
|
+
const port = configPort === server._configServerPort ? server._currentServerPort ?? configPort : configPort;
|
|
31908
32019
|
server._configServerPort = configPort;
|
|
31909
32020
|
server._currentServerPort = await httpServerStart(httpServer, {
|
|
31910
32021
|
port,
|
|
@@ -32535,9 +32646,10 @@ function lexAcceptedHmrDeps(code, start, urls) {
|
|
|
32535
32646
|
prevState = state;
|
|
32536
32647
|
state = 3;
|
|
32537
32648
|
} else if (whitespaceRE.test(char)) continue;
|
|
32538
|
-
else if (state === 0)
|
|
32539
|
-
|
|
32540
|
-
|
|
32649
|
+
else if (state === 0) {
|
|
32650
|
+
if (char === `[`) state = 4;
|
|
32651
|
+
else return true;
|
|
32652
|
+
} else if (char === `]`) return false;
|
|
32541
32653
|
else if (char === ",") continue;
|
|
32542
32654
|
else error(i);
|
|
32543
32655
|
break;
|
|
@@ -32879,16 +32991,18 @@ function webWorkerPostPlugin(_config) {
|
|
|
32879
32991
|
}
|
|
32880
32992
|
let injectedImportMeta = false;
|
|
32881
32993
|
let s;
|
|
32882
|
-
for (const { s: start, e: end, d: dynamicIndex } of imports) if (dynamicIndex === -2)
|
|
32883
|
-
|
|
32884
|
-
|
|
32885
|
-
|
|
32886
|
-
|
|
32887
|
-
|
|
32888
|
-
|
|
32889
|
-
|
|
32994
|
+
for (const { s: start, e: end, d: dynamicIndex } of imports) if (dynamicIndex === -2) {
|
|
32995
|
+
if (code.slice(end, end + 4) === ".url") {
|
|
32996
|
+
s ||= new MagicString(code);
|
|
32997
|
+
s.overwrite(start, end + 4, "self.location.href");
|
|
32998
|
+
} else {
|
|
32999
|
+
s ||= new MagicString(code);
|
|
33000
|
+
if (!injectedImportMeta) {
|
|
33001
|
+
s.prepend("const _vite_importMeta = { url: self.location.href };\n");
|
|
33002
|
+
injectedImportMeta = true;
|
|
33003
|
+
}
|
|
33004
|
+
s.overwrite(start, end, "_vite_importMeta");
|
|
32890
33005
|
}
|
|
32891
|
-
s.overwrite(start, end, "_vite_importMeta");
|
|
32892
33006
|
}
|
|
32893
33007
|
if (!s) return;
|
|
32894
33008
|
return {
|
|
@@ -32928,13 +33042,14 @@ function webWorkerPlugin(config) {
|
|
|
32928
33042
|
name: options?.name
|
|
32929
33043
|
}`;
|
|
32930
33044
|
let urlCode;
|
|
32931
|
-
if (isBundled)
|
|
32932
|
-
|
|
32933
|
-
|
|
32934
|
-
|
|
32935
|
-
|
|
32936
|
-
|
|
32937
|
-
|
|
33045
|
+
if (isBundled) {
|
|
33046
|
+
if (isWorker && config.bundleChain.at(-1) === cleanUrl(id)) urlCode = "self.location.href";
|
|
33047
|
+
else if (inlineRE.test(id)) {
|
|
33048
|
+
const result = await bundleWorkerEntry(config, id);
|
|
33049
|
+
for (const file of result.watchedFiles) this.addWatchFile(file);
|
|
33050
|
+
const jsContent = `const jsContent = ${JSON.stringify(result.entryCode)};`;
|
|
33051
|
+
return {
|
|
33052
|
+
code: workerConstructor === "Worker" ? `${jsContent}
|
|
32938
33053
|
const blob = typeof self !== "undefined" && self.Blob && new Blob([${workerType === "classic" ? `'(self.URL || self.webkitURL).revokeObjectURL(self.location.href);',` : `'URL.revokeObjectURL(import.meta.url);',`}jsContent], { type: "text/javascript;charset=utf-8" });
|
|
32939
33054
|
export default function WorkerWrapper(options) {
|
|
32940
33055
|
let objURL;
|
|
@@ -32960,19 +33075,19 @@ function webWorkerPlugin(config) {
|
|
|
32960
33075
|
);
|
|
32961
33076
|
}
|
|
32962
33077
|
`,
|
|
32963
|
-
|
|
32964
|
-
|
|
33078
|
+
map: { mappings: "" }
|
|
33079
|
+
};
|
|
33080
|
+
} else {
|
|
33081
|
+
const result = await workerFileToUrl(config, id);
|
|
33082
|
+
let url;
|
|
33083
|
+
if (this.environment.config.command === "serve" && this.environment.config.isBundled) {
|
|
33084
|
+
emitWorkerAssetsForBundledDev(this, config);
|
|
33085
|
+
url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
|
|
33086
|
+
} else url = result.entryUrlPlaceholder;
|
|
33087
|
+
urlCode = JSON.stringify(url);
|
|
33088
|
+
for (const file of result.watchedFiles) this.addWatchFile(file);
|
|
33089
|
+
}
|
|
32965
33090
|
} else {
|
|
32966
|
-
const result = await workerFileToUrl(config, id);
|
|
32967
|
-
let url;
|
|
32968
|
-
if (this.environment.config.command === "serve" && this.environment.config.isBundled) {
|
|
32969
|
-
emitWorkerAssetsForBundledDev(this, config);
|
|
32970
|
-
url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
|
|
32971
|
-
} else url = result.entryUrlPlaceholder;
|
|
32972
|
-
urlCode = JSON.stringify(url);
|
|
32973
|
-
for (const file of result.watchedFiles) this.addWatchFile(file);
|
|
32974
|
-
}
|
|
32975
|
-
else {
|
|
32976
33091
|
let url = await fileToUrl$1(this, cleanUrl(id));
|
|
32977
33092
|
url = injectQuery(url, `${WORKER_FILE_ID}&type=${workerType}`);
|
|
32978
33093
|
urlCode = JSON.stringify(url);
|
|
@@ -33001,10 +33116,12 @@ function webWorkerPlugin(config) {
|
|
|
33001
33116
|
let injectEnv = "";
|
|
33002
33117
|
if (workerType === "classic") injectEnv = `importScripts(${JSON.stringify(path.posix.join(config.base, ENV_PUBLIC_PATH))})\n`;
|
|
33003
33118
|
else if (workerType === "module") injectEnv = `import ${JSON.stringify(ENV_PUBLIC_PATH)}\n`;
|
|
33004
|
-
else if (workerType === "ignore")
|
|
33005
|
-
|
|
33006
|
-
|
|
33007
|
-
|
|
33119
|
+
else if (workerType === "ignore") {
|
|
33120
|
+
if (this.environment.config.isBundled) injectEnv = "";
|
|
33121
|
+
else {
|
|
33122
|
+
const environment = this.environment;
|
|
33123
|
+
injectEnv = ((environment.mode === "dev" ? environment.moduleGraph : void 0)?.getModuleById(ENV_ENTRY))?.transformResult?.code || "";
|
|
33124
|
+
}
|
|
33008
33125
|
}
|
|
33009
33126
|
if (injectEnv) {
|
|
33010
33127
|
const s = new MagicString(raw);
|
|
@@ -33334,13 +33451,15 @@ function importAnalysisPlugin(config) {
|
|
|
33334
33451
|
if (prop === ".hot") {
|
|
33335
33452
|
hasHMR = true;
|
|
33336
33453
|
const endHot = end + 4 + (source[end + 4] === "?" ? 1 : 0);
|
|
33337
|
-
if (source.slice(endHot, endHot + 7) === ".accept")
|
|
33338
|
-
|
|
33339
|
-
|
|
33340
|
-
|
|
33341
|
-
|
|
33342
|
-
|
|
33343
|
-
|
|
33454
|
+
if (source.slice(endHot, endHot + 7) === ".accept") {
|
|
33455
|
+
if (source.slice(endHot, endHot + 14) === ".acceptExports") {
|
|
33456
|
+
const importAcceptedExports = orderedAcceptedExports[index] = /* @__PURE__ */ new Set();
|
|
33457
|
+
lexAcceptedHmrExports(source, source.indexOf("(", endHot + 14) + 1, importAcceptedExports);
|
|
33458
|
+
isPartiallySelfAccepting = true;
|
|
33459
|
+
} else {
|
|
33460
|
+
const importAcceptedUrls = orderedAcceptedUrls[index] = /* @__PURE__ */ new Set();
|
|
33461
|
+
if (lexAcceptedHmrDeps(source, source.indexOf("(", endHot + 7) + 1, importAcceptedUrls)) isSelfAccepting = true;
|
|
33462
|
+
}
|
|
33344
33463
|
}
|
|
33345
33464
|
} else if (prop === ".env") hasEnv = true;
|
|
33346
33465
|
return;
|
|
@@ -33415,8 +33534,10 @@ function importAnalysisPlugin(config) {
|
|
|
33415
33534
|
debugHmr?.(`${isSelfAccepting ? `[self-accepts]` : isPartiallySelfAccepting ? `[accepts-exports]` : acceptedUrls.size ? `[accepts-deps]` : `[detected api usage]`} ${prettifyUrl(importer, root)}`);
|
|
33416
33535
|
str().prepend(`import { createHotContext as __vite__createHotContext } from "${clientPublicPath}";import.meta.hot = __vite__createHotContext(${JSON.stringify(normalizeHmrUrl(importerModule.url))});`);
|
|
33417
33536
|
}
|
|
33418
|
-
if (needQueryInjectHelper)
|
|
33419
|
-
|
|
33537
|
+
if (needQueryInjectHelper) {
|
|
33538
|
+
if (isClassicWorker) str().append("\n" + __vite__injectQuery.toString());
|
|
33539
|
+
else str().prepend(`import { injectQuery as __vite__injectQuery } from "${clientPublicPath}";`);
|
|
33540
|
+
}
|
|
33420
33541
|
const normalizedAcceptedUrls = /* @__PURE__ */ new Set();
|
|
33421
33542
|
for (const { url, start, end } of acceptedUrls) {
|
|
33422
33543
|
let [normalized, resolvedId] = await normalizeUrl(url, start).catch(() => []);
|
|
@@ -33546,9 +33667,10 @@ function transformCjsImport(importExp, url, rawUrl, importIndex, importer, isNod
|
|
|
33546
33667
|
const lines = [];
|
|
33547
33668
|
importNames.forEach(({ importedName, localName }) => {
|
|
33548
33669
|
if (importedName === "*") lines.push(`const ${localName} = (${interopHelperStr})(${cjsModuleName}, ${+isNodeMode})`);
|
|
33549
|
-
else if (importedName === "default")
|
|
33550
|
-
|
|
33551
|
-
|
|
33670
|
+
else if (importedName === "default") {
|
|
33671
|
+
if (isNodeMode) lines.push(`const ${localName} = ${cjsModuleName}`);
|
|
33672
|
+
else lines.push(`const ${localName} = !${cjsModuleName}.__esModule ? ${cjsModuleName} : ${cjsModuleName}.default`);
|
|
33673
|
+
} else lines.push(`const ${localName} = ${cjsModuleName}["${importedName}"]`);
|
|
33552
33674
|
});
|
|
33553
33675
|
if (defaultExports) lines.push(`export default ${defaultExports}`);
|
|
33554
33676
|
if (exportNames.length) lines.push(`export { ${exportNames.join(", ")} }`);
|
|
@@ -34206,8 +34328,8 @@ function buildImportAnalysisPlugin(config) {
|
|
|
34206
34328
|
const { modulePreload } = this.environment.config.build;
|
|
34207
34329
|
let importMapMapping;
|
|
34208
34330
|
let importMapReverseMapping;
|
|
34209
|
-
if (config.build.chunkImportMap) {
|
|
34210
|
-
const importMap = getImportMap(bundle, config);
|
|
34331
|
+
if (this.environment.config.build.chunkImportMap) {
|
|
34332
|
+
const importMap = getImportMap(bundle, this.environment.config);
|
|
34211
34333
|
importMapMapping = importMap.mapping;
|
|
34212
34334
|
importMapReverseMapping = Object.fromEntries(Object.entries(importMapMapping).map(([k, v]) => [v, k]));
|
|
34213
34335
|
if (config.isOutputOptionsForLegacyChunks?.(opts)) {
|
|
@@ -34216,7 +34338,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
34216
34338
|
fileName: "importmap.legacy.json",
|
|
34217
34339
|
source: importMap.asset.source
|
|
34218
34340
|
});
|
|
34219
|
-
delete bundle[getImportMapFilename(config)];
|
|
34341
|
+
delete bundle[getImportMapFilename(this.environment.config)];
|
|
34220
34342
|
}
|
|
34221
34343
|
}
|
|
34222
34344
|
for (const file in bundle) {
|
|
@@ -34325,7 +34447,7 @@ function buildImportAnalysisPlugin(config) {
|
|
|
34325
34447
|
}
|
|
34326
34448
|
if (fileDeps.length > 0) {
|
|
34327
34449
|
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`;
|
|
34328
|
-
if (code.startsWith("#!")) s.prependLeft(code
|
|
34450
|
+
if (code.startsWith("#!")) s.prependLeft(getFileStartIndex(code), mapDepsCode);
|
|
34329
34451
|
else s.prepend(mapDepsCode);
|
|
34330
34452
|
}
|
|
34331
34453
|
let markerStartPos = findPreloadMarker(code);
|
|
@@ -35006,9 +35128,10 @@ async function toAbsoluteGlob(glob, root, importer, resolveId, base) {
|
|
|
35006
35128
|
}
|
|
35007
35129
|
root = globSafePath(root);
|
|
35008
35130
|
let dir;
|
|
35009
|
-
if (base)
|
|
35010
|
-
|
|
35011
|
-
|
|
35131
|
+
if (base) {
|
|
35132
|
+
if (base[0] === "/") dir = posix.join(root, base);
|
|
35133
|
+
else dir = posix.resolve(importer ? globSafePath(dirname$2(importer)) : root, base);
|
|
35134
|
+
} else dir = importer ? globSafePath(dirname$2(importer)) : root;
|
|
35012
35135
|
if (glob[0] === "/") return pre + posix.join(root, glob.slice(1));
|
|
35013
35136
|
if (glob.startsWith("./")) return pre + posix.join(dir, glob.slice(2));
|
|
35014
35137
|
if (glob.startsWith("../")) return pre + posix.join(dir, glob);
|
|
@@ -36995,34 +37118,36 @@ function expandGlobIds(id, config) {
|
|
|
36995
37118
|
if (exports) {
|
|
36996
37119
|
if (typeof exports === "string" || Array.isArray(exports)) return [pkgName];
|
|
36997
37120
|
const possibleExportPaths = [];
|
|
36998
|
-
for (const key in exports) if (key[0] === ".")
|
|
36999
|
-
|
|
37000
|
-
|
|
37001
|
-
|
|
37002
|
-
|
|
37003
|
-
|
|
37004
|
-
|
|
37005
|
-
|
|
37006
|
-
|
|
37007
|
-
|
|
37008
|
-
|
|
37009
|
-
|
|
37010
|
-
|
|
37011
|
-
|
|
37012
|
-
|
|
37013
|
-
allGlobSame
|
|
37014
|
-
|
|
37015
|
-
|
|
37016
|
-
|
|
37121
|
+
for (const key in exports) if (key[0] === ".") {
|
|
37122
|
+
if (key.includes("*")) {
|
|
37123
|
+
const exportsValue = getFirstExportStringValue(exports[key]);
|
|
37124
|
+
if (!exportsValue) continue;
|
|
37125
|
+
const exportValuePattern = exportsValue.replace(/\*/g, "**/*");
|
|
37126
|
+
const exportsValueGlobRe = new RegExp(exportsValue.split("*").map(escapeRegex).join("(.*)"));
|
|
37127
|
+
possibleExportPaths.push(...globSync(exportValuePattern, {
|
|
37128
|
+
cwd: pkgData.dir,
|
|
37129
|
+
expandDirectories: false,
|
|
37130
|
+
ignore: ["node_modules"]
|
|
37131
|
+
}).map((filePath) => {
|
|
37132
|
+
if (exportsValue.startsWith("./")) filePath = "./" + filePath;
|
|
37133
|
+
const matched = exportsValueGlobRe.exec(slash(filePath));
|
|
37134
|
+
if (matched) {
|
|
37135
|
+
let allGlobSame = matched.length === 2;
|
|
37136
|
+
if (!allGlobSame) {
|
|
37137
|
+
allGlobSame = true;
|
|
37138
|
+
for (let i = 2; i < matched.length; i++) if (matched[i] !== matched[i - 1]) {
|
|
37139
|
+
allGlobSame = false;
|
|
37140
|
+
break;
|
|
37141
|
+
}
|
|
37017
37142
|
}
|
|
37143
|
+
if (allGlobSame) return key.replace("*", matched[1]).slice(2);
|
|
37018
37144
|
}
|
|
37019
|
-
|
|
37020
|
-
}
|
|
37021
|
-
|
|
37022
|
-
|
|
37023
|
-
|
|
37024
|
-
|
|
37025
|
-
possibleExportPaths.push(key.slice(2));
|
|
37145
|
+
return "";
|
|
37146
|
+
}).filter(Boolean));
|
|
37147
|
+
} else {
|
|
37148
|
+
if (exports[key] == null) continue;
|
|
37149
|
+
possibleExportPaths.push(key.slice(2));
|
|
37150
|
+
}
|
|
37026
37151
|
}
|
|
37027
37152
|
const isMatch = (0, import_picomatch.default)(pattern);
|
|
37028
37153
|
const matched = possibleExportPaths.filter((p) => isMatch(p)).map((match) => path.posix.join(pkgName, match));
|
|
@@ -37359,11 +37484,13 @@ async function loadCachedDepOptimizationMetadata(environment, force = environmen
|
|
|
37359
37484
|
const cachedMetadataPath = path.join(depsCacheDir, METADATA_FILENAME);
|
|
37360
37485
|
cachedMetadata = parseDepsOptimizerMetadata(await fsp.readFile(cachedMetadataPath, "utf-8"), depsCacheDir);
|
|
37361
37486
|
} catch {}
|
|
37362
|
-
if (cachedMetadata)
|
|
37363
|
-
|
|
37364
|
-
|
|
37365
|
-
|
|
37366
|
-
|
|
37487
|
+
if (cachedMetadata) {
|
|
37488
|
+
if (cachedMetadata.lockfileHash !== getLockfileHash(environment)) environment.logger.info("Re-optimizing dependencies because lockfile has changed", { timestamp: true });
|
|
37489
|
+
else if (cachedMetadata.configHash !== getConfigHash(environment)) environment.logger.info("Re-optimizing dependencies because vite config has changed", { timestamp: true });
|
|
37490
|
+
else {
|
|
37491
|
+
log?.(`(${environment.name}) Hash is consistent. Skipping. Use --force to override.`);
|
|
37492
|
+
return cachedMetadata;
|
|
37493
|
+
}
|
|
37367
37494
|
}
|
|
37368
37495
|
} else environment.logger.info("Forced re-optimization of dependencies", { timestamp: true });
|
|
37369
37496
|
debug$4?.(`(${environment.name}) ${import_picocolors.default.green(`removing old cache dir ${depsCacheDir}`)}`);
|
|
@@ -37646,9 +37773,10 @@ async function addManuallyIncludedOptimizeDeps(environment, deps) {
|
|
|
37646
37773
|
const normalizedId = normalizeId(id);
|
|
37647
37774
|
if (!deps[normalizedId]) {
|
|
37648
37775
|
const entry = await resolve(id);
|
|
37649
|
-
if (entry)
|
|
37650
|
-
|
|
37651
|
-
|
|
37776
|
+
if (entry) {
|
|
37777
|
+
if (isOptimizable(entry, optimizeDeps)) deps[normalizedId] = entry;
|
|
37778
|
+
else unableToOptimize(id, "Cannot optimize dependency");
|
|
37779
|
+
} else unableToOptimize(id, "Failed to resolve dependency");
|
|
37652
37780
|
}
|
|
37653
37781
|
}
|
|
37654
37782
|
}
|
|
@@ -38817,7 +38945,10 @@ function resolveBuildEnvironmentOptions(raw, logger, consumer, isBundledDev, inp
|
|
|
38817
38945
|
platform: consumer === "client" || isSsrTargetWebworkerEnvironment ? "browser" : "node",
|
|
38818
38946
|
...merged.rolldownOptions
|
|
38819
38947
|
};
|
|
38820
|
-
if (merged.lib && merged.lib.entry == null && input != null) merged.lib
|
|
38948
|
+
if (merged.lib && merged.lib.entry == null && input != null) merged.lib = {
|
|
38949
|
+
...merged.lib,
|
|
38950
|
+
entry: input
|
|
38951
|
+
};
|
|
38821
38952
|
if (merged.target === "baseline-widely-available") merged.target = ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET;
|
|
38822
38953
|
if (Array.isArray(merged.target)) merged.target = unique(merged.target);
|
|
38823
38954
|
if (merged.minify === "false") merged.minify = false;
|
|
@@ -38913,7 +39044,10 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
|
|
|
38913
39044
|
experimental: {
|
|
38914
39045
|
...options.rolldownOptions.experimental,
|
|
38915
39046
|
viteMode: true,
|
|
38916
|
-
chunkImportMap: options.chunkImportMap ? {
|
|
39047
|
+
chunkImportMap: options.chunkImportMap ? {
|
|
39048
|
+
...typeof options.rolldownOptions.experimental?.chunkImportMap === "object" ? options.rolldownOptions.experimental?.chunkImportMap : {},
|
|
39049
|
+
baseUrl: base
|
|
39050
|
+
} : options.rolldownOptions.experimental?.chunkImportMap
|
|
38917
39051
|
}
|
|
38918
39052
|
};
|
|
38919
39053
|
const isSsrTargetWebworkerEnvironment = environment.name === "ssr" && environment.getTopLevelConfig().ssr?.target === "webworker";
|
|
@@ -39125,9 +39259,10 @@ function onRollupLog(level, log, environment) {
|
|
|
39125
39259
|
clearLine();
|
|
39126
39260
|
const userOnLog = environment.config.build.rolldownOptions?.onLog;
|
|
39127
39261
|
const userOnWarn = environment.config.build.rolldownOptions?.onwarn;
|
|
39128
|
-
if (userOnLog)
|
|
39129
|
-
|
|
39130
|
-
|
|
39262
|
+
if (userOnLog) {
|
|
39263
|
+
if (userOnWarn) userOnLog(level, log, normalizeUserOnWarn(userOnWarn, viteLog));
|
|
39264
|
+
else userOnLog(level, log, viteLog);
|
|
39265
|
+
} else if (userOnWarn) normalizeUserOnWarn(userOnWarn, viteLog)(level, log);
|
|
39131
39266
|
else viteLog(level, log);
|
|
39132
39267
|
}
|
|
39133
39268
|
function normalizeUserOnWarn(userOnWarn, defaultHandler) {
|
|
@@ -40293,6 +40428,7 @@ var MemoryFiles = class {
|
|
|
40293
40428
|
var BundledDev = class {
|
|
40294
40429
|
environment;
|
|
40295
40430
|
_devEngine;
|
|
40431
|
+
viteRuntime;
|
|
40296
40432
|
initialBuildCompleted = false;
|
|
40297
40433
|
_closed = false;
|
|
40298
40434
|
clients = new Clients();
|
|
@@ -40325,6 +40461,9 @@ var BundledDev = class {
|
|
|
40325
40461
|
return this._devEngine;
|
|
40326
40462
|
}
|
|
40327
40463
|
pendingPayloadFilenames = /* @__PURE__ */ new Set();
|
|
40464
|
+
get hasBuildOutput() {
|
|
40465
|
+
return this.memoryFiles.size > 1 || this.memoryFiles.size === 1 && !this.memoryFiles.has("bundledDevClient.mjs");
|
|
40466
|
+
}
|
|
40328
40467
|
async listen() {
|
|
40329
40468
|
this._closed = false;
|
|
40330
40469
|
debug$1?.("INITIAL: setup bundle options");
|
|
@@ -40414,6 +40553,8 @@ var BundledDev = class {
|
|
|
40414
40553
|
}, (e) => {
|
|
40415
40554
|
debug$1?.("INITIAL: run error", e);
|
|
40416
40555
|
});
|
|
40556
|
+
this.viteRuntime = await getHmrImplementation(this.environment.getTopLevelConfig());
|
|
40557
|
+
this.storeOutputFiles([]);
|
|
40417
40558
|
this.waitForInitialBuildFinish().then(() => {
|
|
40418
40559
|
if (this._closed) return;
|
|
40419
40560
|
debug$1?.("INITIAL: build done");
|
|
@@ -40430,7 +40571,7 @@ var BundledDev = class {
|
|
|
40430
40571
|
await this.devEngine.ensureCurrentBuildFinish();
|
|
40431
40572
|
if (this._closed) return;
|
|
40432
40573
|
let state = await this.devEngine.getBundleState();
|
|
40433
|
-
while (this.
|
|
40574
|
+
while (!this.hasBuildOutput && !state.lastBuildErrored) {
|
|
40434
40575
|
await setTimeout$1(10);
|
|
40435
40576
|
if (this._closed) return;
|
|
40436
40577
|
await this.devEngine.ensureCurrentBuildFinish();
|
|
@@ -40484,6 +40625,10 @@ var BundledDev = class {
|
|
|
40484
40625
|
this.initialBuildCompleted = false;
|
|
40485
40626
|
}
|
|
40486
40627
|
storeOutputFiles(output) {
|
|
40628
|
+
if (this.viteRuntime) this.memoryFiles.set(BUNDLED_DEV_CLIENT_FILENAME, {
|
|
40629
|
+
source: this.viteRuntime,
|
|
40630
|
+
etag: (0, import_etag.default)(Buffer.from(this.viteRuntime), { weak: true })
|
|
40631
|
+
});
|
|
40487
40632
|
for (const outputFile of output) this.memoryFiles.set(outputFile.fileName, () => {
|
|
40488
40633
|
const source = outputFile.type === "chunk" ? outputFile.code : outputFile.source;
|
|
40489
40634
|
return {
|
|
@@ -40499,23 +40644,11 @@ var BundledDev = class {
|
|
|
40499
40644
|
rolldownOptions.experimental.devMode = {
|
|
40500
40645
|
lazy: true,
|
|
40501
40646
|
...typeof rolldownOptions.experimental.devMode === "object" ? rolldownOptions.experimental.devMode : {},
|
|
40502
|
-
implement:
|
|
40647
|
+
implement: "",
|
|
40648
|
+
skipCommonRuntimeInjection: true
|
|
40503
40649
|
};
|
|
40504
40650
|
rolldownOptions.optimization ??= {};
|
|
40505
40651
|
rolldownOptions.optimization.inlineConst = false;
|
|
40506
|
-
const plugins = await asyncFlatten([rolldownOptions.plugins]);
|
|
40507
|
-
for (const plugin of plugins) {
|
|
40508
|
-
const transform = plugin && "transform" in plugin ? plugin.transform : void 0;
|
|
40509
|
-
if (!transform) continue;
|
|
40510
|
-
const handler = typeof transform === "function" ? transform : transform.handler;
|
|
40511
|
-
const wrappedHandler = function(code, id, opts) {
|
|
40512
|
-
if (id.includes("?rolldown-lazy=")) return null;
|
|
40513
|
-
return handler.call(this, code, id, opts);
|
|
40514
|
-
};
|
|
40515
|
-
if (typeof transform === "function") plugin.transform = wrappedHandler;
|
|
40516
|
-
else transform.handler = wrappedHandler;
|
|
40517
|
-
}
|
|
40518
|
-
rolldownOptions.plugins = plugins;
|
|
40519
40652
|
if (Array.isArray(rolldownOptions.output)) for (const output of rolldownOptions.output) {
|
|
40520
40653
|
output.entryFileNames = "assets/[name].js";
|
|
40521
40654
|
output.chunkFileNames = "assets/[name]-[hash].js";
|
|
@@ -41739,8 +41872,10 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
41739
41872
|
if (envDir !== false) envDir = config.envDir ? normalizePath(path.resolve(resolvedRoot, config.envDir)) : resolvedRoot;
|
|
41740
41873
|
const userEnv = loadEnv(mode, envDir, resolveEnvPrefix(config));
|
|
41741
41874
|
const userNodeEnv = process.env.VITE_USER_NODE_ENV;
|
|
41742
|
-
if (!isNodeEnvSet && userNodeEnv)
|
|
41743
|
-
|
|
41875
|
+
if (!isNodeEnvSet && userNodeEnv) {
|
|
41876
|
+
if (userNodeEnv === "development") process.env.NODE_ENV = "development";
|
|
41877
|
+
else logger.warn(`NODE_ENV=${userNodeEnv} is not supported in the .env file. Only NODE_ENV=development is supported to create a development build of your project. If you need to set process.env.NODE_ENV, you can set it in the Vite config instead.`);
|
|
41878
|
+
}
|
|
41744
41879
|
const isProduction = process.env.NODE_ENV === "production";
|
|
41745
41880
|
const resolvedBase = config.base === "" || config.base === "./" ? !isBuild || config.build?.ssr ? "/" : "./" : resolveBaseUrl(config.base, isBuild, logger);
|
|
41746
41881
|
const pkgDir = findNearestPackageData(resolvedRoot, packageCache)?.dir;
|
|
@@ -41810,9 +41945,10 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
41810
41945
|
if (Array.isArray(server.allowedHosts)) server.allowedHosts.push(...additionalAllowedHosts);
|
|
41811
41946
|
if (Array.isArray(preview.allowedHosts)) preview.allowedHosts.push(...additionalAllowedHosts);
|
|
41812
41947
|
let oxc = config.oxc;
|
|
41813
|
-
if (config.esbuild)
|
|
41814
|
-
|
|
41815
|
-
|
|
41948
|
+
if (config.esbuild) {
|
|
41949
|
+
if (config.oxc) logger.warn(import_picocolors.default.yellow(`Both esbuild and oxc options were set. oxc options will be used and esbuild options will be ignored.`) + ` The following esbuild options were set: \`${inspect(config.esbuild)}\``);
|
|
41950
|
+
else oxc = convertEsbuildConfigToOxcConfig(config.esbuild, logger);
|
|
41951
|
+
} else if (config.esbuild === false && config.oxc !== false) logger.warn(import_picocolors.default.yellow("`esbuild` option is set to false, but `oxc` option was not set to false. `esbuild: false` does not have effect any more. If you want to disable the default transformation, which is now handled by Oxc, please set `oxc: false` instead."));
|
|
41816
41952
|
const experimental = mergeWithDefaults(configDefaults.experimental, config.experimental ?? {});
|
|
41817
41953
|
if (command === "serve" && experimental.bundledDev) experimental.renderBuiltUrl = void 0;
|
|
41818
41954
|
const resolvedDevToolsConfig = await resolveDevToolsConfig(config.devtools, server.host, logger);
|
|
@@ -42124,18 +42260,20 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
42124
42260
|
filter: { id: /\.[cm]?[jt]s$/ },
|
|
42125
42261
|
handler(code, id) {
|
|
42126
42262
|
let injectValues = `const ${dirnameVarName} = ${JSON.stringify(path.dirname(id))};const ${filenameVarName} = ${JSON.stringify(id)};const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL(id).href)};`;
|
|
42127
|
-
if (importMetaResolveRegex.test(code))
|
|
42128
|
-
if (
|
|
42129
|
-
importMetaResolverRegistered
|
|
42130
|
-
|
|
42131
|
-
|
|
42132
|
-
|
|
42133
|
-
|
|
42263
|
+
if (importMetaResolveRegex.test(code)) {
|
|
42264
|
+
if (isESM) {
|
|
42265
|
+
if (!importMetaResolverRegistered) {
|
|
42266
|
+
importMetaResolverRegistered = true;
|
|
42267
|
+
createImportMetaResolver();
|
|
42268
|
+
}
|
|
42269
|
+
injectValues += `const ${importMetaResolveVarName} = (specifier, importer = ${importMetaUrlVarName}) => (${importMetaResolveWithCustomHookString})(specifier, importer);`;
|
|
42270
|
+
} else injectValues += `const ${importMetaResolveVarName} = (specifier, importer = ${importMetaUrlVarName}) => { throw new Error('import.meta.resolve is not supported in CJS config files') };`;
|
|
42271
|
+
}
|
|
42134
42272
|
let injectedContents;
|
|
42135
42273
|
if (code.startsWith("#!")) {
|
|
42136
|
-
|
|
42137
|
-
|
|
42138
|
-
injectedContents =
|
|
42274
|
+
const fileStartIndex = getFileStartIndex(code);
|
|
42275
|
+
const hashbang = code.slice(0, fileStartIndex);
|
|
42276
|
+
injectedContents = hashbang + (lineTerminatorRE.test(hashbang) ? "" : "\n") + injectValues + code.slice(fileStartIndex);
|
|
42139
42277
|
} else injectedContents = injectValues + code;
|
|
42140
42278
|
return {
|
|
42141
42279
|
code: injectedContents,
|