vite 8.0.12 → 8.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/client.mjs +61 -27
- package/dist/node/chunks/build.js +20 -20
- package/dist/node/chunks/lib.js +1 -1
- package/dist/node/chunks/logger.js +37 -2
- package/dist/node/chunks/node.js +255 -163
- package/dist/node/chunks/postcss-import.js +11 -11
- package/dist/node/cli.js +1 -2
- package/dist/node/index.d.ts +28 -13
- package/dist/node/module-runner.js +9 -4
- package/package.json +8 -8
- package/types/customEvent.d.ts +1 -1
- package/dist/node/chunks/chunk.js +0 -37
package/dist/node/chunks/node.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as OPTIMIZABLE_ENTRY_RE, C as ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, D as JS_TYPES_RE, E as FS_PREFIX, F as defaultAllowedOrigins, I as loopbackHosts, L as wildcardHosts, M as SPECIAL_QUERY_RE, N as VERSION, O as KNOWN_ASSET_TYPES, P as VITE_PACKAGE_DIR, R as require_picocolors, S as ENV_PUBLIC_PATH, T as ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET, _ as DEFAULT_SERVER_CONDITIONS, a as CLIENT_ENTRY, b as DEV_PROD_CONDITION, c as DEFAULT_ASSETS_INLINE_LIMIT, d as DEFAULT_CLIENT_MAIN_FIELDS, f as DEFAULT_CONFIG_FILES, g as DEFAULT_PREVIEW_PORT, h as DEFAULT_EXTERNAL_CONDITIONS, i as CLIENT_DIR, j as ROLLUP_HOOKS, k as METADATA_FILENAME, l as DEFAULT_ASSETS_RE, m as DEFAULT_EXTENSIONS, n as createLogger, o as CLIENT_PUBLIC_PATH, p as DEFAULT_DEV_PORT, r as printServerUrls, s as CSS_LANGS_RE, t as LogLevels, u as DEFAULT_CLIENT_CONDITIONS, v as DEFAULT_SERVER_MAIN_FIELDS, w as ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, x as ENV_ENTRY, y as DEP_VERSION_RE } from "./logger.js";
|
|
1
|
+
import { A as OPTIMIZABLE_ENTRY_RE, B as __esmMin, C as ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, D as JS_TYPES_RE, E as FS_PREFIX, F as defaultAllowedOrigins, H as __require, I as loopbackHosts, L as wildcardHosts, M as SPECIAL_QUERY_RE, N as VERSION, O as KNOWN_ASSET_TYPES, P as VITE_PACKAGE_DIR, R as require_picocolors, S as ENV_PUBLIC_PATH, T as ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET, U as __toCommonJS, V as __exportAll, W as __toESM, _ as DEFAULT_SERVER_CONDITIONS, a as CLIENT_ENTRY, b as DEV_PROD_CONDITION, c as DEFAULT_ASSETS_INLINE_LIMIT, d as DEFAULT_CLIENT_MAIN_FIELDS, f as DEFAULT_CONFIG_FILES, g as DEFAULT_PREVIEW_PORT, h as DEFAULT_EXTERNAL_CONDITIONS, i as CLIENT_DIR, j as ROLLUP_HOOKS, k as METADATA_FILENAME, l as DEFAULT_ASSETS_RE, m as DEFAULT_EXTENSIONS, n as createLogger, o as CLIENT_PUBLIC_PATH, p as DEFAULT_DEV_PORT, r as printServerUrls, s as CSS_LANGS_RE, t as LogLevels, u as DEFAULT_CLIENT_CONDITIONS, v as DEFAULT_SERVER_MAIN_FIELDS, w as ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, x as ENV_ENTRY, y as DEP_VERSION_RE, z as __commonJSMin } from "./logger.js";
|
|
3
2
|
import { builtinModules, createRequire } from "node:module";
|
|
4
3
|
import { parseAst, parseAstAsync } from "rolldown/parseAst";
|
|
5
4
|
import { esmExternalRequirePlugin, esmExternalRequirePlugin as esmExternalRequirePlugin$1 } from "rolldown/plugins";
|
|
@@ -11,7 +10,7 @@ import fsp, { constants } from "node:fs/promises";
|
|
|
11
10
|
import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
|
|
12
11
|
import { format, formatWithOptions, inspect, parseEnv, promisify, stripVTControlCharacters } from "node:util";
|
|
13
12
|
import { performance as performance$1 } from "node:perf_hooks";
|
|
14
|
-
import crypto
|
|
13
|
+
import crypto from "node:crypto";
|
|
15
14
|
import picomatch from "picomatch";
|
|
16
15
|
import { VERSION as rolldownVersion, rolldown } from "rolldown";
|
|
17
16
|
import os from "node:os";
|
|
@@ -1565,11 +1564,10 @@ const replaceNestedIdRE = /\s*>\s*/g;
|
|
|
1565
1564
|
const flattenId = (id) => {
|
|
1566
1565
|
return limitFlattenIdLength(id.replaceAll(/_+/g, "$&__").replaceAll("/", "_").replaceAll(".", "__").replace(replaceNestedIdRE, "_n_").replace(invalidUrlPathCharRE, (c) => "_0" + c.charCodeAt(0).toString(16) + "_"));
|
|
1567
1566
|
};
|
|
1568
|
-
const FLATTEN_ID_HASH_LENGTH = 8;
|
|
1569
1567
|
const FLATTEN_ID_MAX_FILE_LENGTH = 170;
|
|
1570
1568
|
const limitFlattenIdLength = (id, limit = FLATTEN_ID_MAX_FILE_LENGTH) => {
|
|
1571
1569
|
if (id.length <= limit) return id;
|
|
1572
|
-
return id.slice(0, limit -
|
|
1570
|
+
return id.slice(0, limit - 9) + "_" + getHash(id);
|
|
1573
1571
|
};
|
|
1574
1572
|
const normalizeId = (id) => id.replace(replaceNestedIdRE, " > ");
|
|
1575
1573
|
const NODE_BUILTIN_NAMESPACE = "node:";
|
|
@@ -3361,21 +3359,6 @@ function shouldSkipWarning(warning) {
|
|
|
3361
3359
|
return false;
|
|
3362
3360
|
}
|
|
3363
3361
|
function oxcPlugin(config) {
|
|
3364
|
-
if (config.isBundled) return perEnvironmentPlugin("native:transform", (environment) => {
|
|
3365
|
-
const { jsxInject, include = /\.(m?ts|[jt]sx)$/, exclude = /\.js$/, jsxRefreshInclude, jsxRefreshExclude, ..._transformOptions } = config.oxc;
|
|
3366
|
-
const transformOptions = _transformOptions;
|
|
3367
|
-
transformOptions.sourcemap = environment.config.mode !== "build" || !!environment.config.build.sourcemap;
|
|
3368
|
-
return viteTransformPlugin({
|
|
3369
|
-
root: environment.config.root,
|
|
3370
|
-
include,
|
|
3371
|
-
exclude,
|
|
3372
|
-
jsxRefreshInclude,
|
|
3373
|
-
jsxRefreshExclude,
|
|
3374
|
-
isServerConsumer: environment.config.consumer === "server",
|
|
3375
|
-
jsxInject,
|
|
3376
|
-
transformOptions
|
|
3377
|
-
});
|
|
3378
|
-
});
|
|
3379
3362
|
const { jsxInject, include, exclude, jsxRefreshInclude, jsxRefreshExclude, ...oxcTransformOptions } = config.oxc;
|
|
3380
3363
|
const filter = createFilter$1(include || /\.(m?ts|[jt]sx)$/, exclude || /\.js$/);
|
|
3381
3364
|
const jsxRefreshFilter = jsxRefreshInclude || jsxRefreshExclude ? createFilter$1(jsxRefreshInclude, jsxRefreshExclude) : void 0;
|
|
@@ -3400,6 +3383,24 @@ function oxcPlugin(config) {
|
|
|
3400
3383
|
let server;
|
|
3401
3384
|
return {
|
|
3402
3385
|
name: "vite:oxc",
|
|
3386
|
+
applyToEnvironment(environment) {
|
|
3387
|
+
if (environment.config.isBundled) {
|
|
3388
|
+
const { jsxInject, include = /\.(m?ts|[jt]sx)$/, exclude = /\.js$/, jsxRefreshInclude, jsxRefreshExclude, ..._transformOptions } = environment.config.oxc;
|
|
3389
|
+
const transformOptions = _transformOptions;
|
|
3390
|
+
transformOptions.sourcemap = environment.config.mode !== "build" || !!environment.config.build.sourcemap;
|
|
3391
|
+
return viteTransformPlugin({
|
|
3392
|
+
root: environment.config.root,
|
|
3393
|
+
include,
|
|
3394
|
+
exclude,
|
|
3395
|
+
jsxRefreshInclude,
|
|
3396
|
+
jsxRefreshExclude,
|
|
3397
|
+
isServerConsumer: environment.config.consumer === "server",
|
|
3398
|
+
jsxInject,
|
|
3399
|
+
transformOptions
|
|
3400
|
+
});
|
|
3401
|
+
}
|
|
3402
|
+
return true;
|
|
3403
|
+
},
|
|
3403
3404
|
configureServer(_server) {
|
|
3404
3405
|
server = _server;
|
|
3405
3406
|
},
|
|
@@ -4453,6 +4454,7 @@ function optimizedDepsPlugin() {
|
|
|
4453
4454
|
return {
|
|
4454
4455
|
name: "vite:optimized-deps",
|
|
4455
4456
|
applyToEnvironment(environment) {
|
|
4457
|
+
if (environment.config.isBundled) return false;
|
|
4456
4458
|
return !isDepOptimizationDisabled(environment.config.optimizeDeps);
|
|
4457
4459
|
},
|
|
4458
4460
|
resolveId(id) {
|
|
@@ -11361,6 +11363,7 @@ function isRefIdentifier(id, parent, parentStack) {
|
|
|
11361
11363
|
if (isNodeInPattern(parent) && parent.value === id) return false;
|
|
11362
11364
|
if (parent.type === "ArrayPattern" && !isInDestructuringAssignment(parent, parentStack)) return false;
|
|
11363
11365
|
if (parent.type === "MemberExpression" && parent.property === id && !parent.computed) return false;
|
|
11366
|
+
if ((parent.type === "LabeledStatement" || parent.type === "BreakStatement" || parent.type === "ContinueStatement") && parent.label === id) return false;
|
|
11364
11367
|
if (parent.type === "MetaProperty") return false;
|
|
11365
11368
|
if (parent.type === "ExportSpecifier" || parent.type === "ExportAllDeclaration") return false;
|
|
11366
11369
|
if (id.name === "arguments") return false;
|
|
@@ -12512,7 +12515,7 @@ function checkPublicFile(url, config) {
|
|
|
12512
12515
|
return tryStatSync(publicFile)?.isFile() ? publicFile : void 0;
|
|
12513
12516
|
}
|
|
12514
12517
|
//#endregion
|
|
12515
|
-
//#region ../../node_modules/.pnpm/ws@8.20.
|
|
12518
|
+
//#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/constants.js
|
|
12516
12519
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12517
12520
|
const BINARY_TYPES = [
|
|
12518
12521
|
"nodebuffer",
|
|
@@ -12535,7 +12538,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
12535
12538
|
};
|
|
12536
12539
|
}));
|
|
12537
12540
|
//#endregion
|
|
12538
|
-
//#region ../../node_modules/.pnpm/ws@8.20.
|
|
12541
|
+
//#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/buffer-util.js
|
|
12539
12542
|
var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12540
12543
|
const { EMPTY_BUFFER } = require_constants();
|
|
12541
12544
|
const FastBuffer = Buffer[Symbol.species];
|
|
@@ -12635,7 +12638,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
12635
12638
|
} catch (e) {}
|
|
12636
12639
|
}));
|
|
12637
12640
|
//#endregion
|
|
12638
|
-
//#region ../../node_modules/.pnpm/ws@8.20.
|
|
12641
|
+
//#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/limiter.js
|
|
12639
12642
|
var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12640
12643
|
const kDone = Symbol("kDone");
|
|
12641
12644
|
const kRun = Symbol("kRun");
|
|
@@ -12686,7 +12689,7 @@ var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
12686
12689
|
module.exports = Limiter;
|
|
12687
12690
|
}));
|
|
12688
12691
|
//#endregion
|
|
12689
|
-
//#region ../../node_modules/.pnpm/ws@8.20.
|
|
12692
|
+
//#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/permessage-deflate.js
|
|
12690
12693
|
var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12691
12694
|
const zlib$1 = __require("zlib");
|
|
12692
12695
|
const bufferUtil = require_buffer_util();
|
|
@@ -13019,7 +13022,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
13019
13022
|
}
|
|
13020
13023
|
}));
|
|
13021
13024
|
//#endregion
|
|
13022
|
-
//#region ../../node_modules/.pnpm/ws@8.20.
|
|
13025
|
+
//#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/validation.js
|
|
13023
13026
|
var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
13024
13027
|
const { isUtf8 } = __require("buffer");
|
|
13025
13028
|
const { hasBlob } = require_constants();
|
|
@@ -13215,7 +13218,7 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13215
13218
|
} catch (e) {}
|
|
13216
13219
|
}));
|
|
13217
13220
|
//#endregion
|
|
13218
|
-
//#region ../../node_modules/.pnpm/ws@8.20.
|
|
13221
|
+
//#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/receiver.js
|
|
13219
13222
|
var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
13220
13223
|
const { Writable: Writable$1 } = __require("stream");
|
|
13221
13224
|
const PerMessageDeflate = require_permessage_deflate();
|
|
@@ -13662,10 +13665,11 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13662
13665
|
module.exports = Receiver;
|
|
13663
13666
|
}));
|
|
13664
13667
|
//#endregion
|
|
13665
|
-
//#region ../../node_modules/.pnpm/ws@8.20.
|
|
13668
|
+
//#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/sender.js
|
|
13666
13669
|
var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
13667
13670
|
const { Duplex: Duplex$3 } = __require("stream");
|
|
13668
13671
|
const { randomFillSync } = __require("crypto");
|
|
13672
|
+
const { types: { isUint8Array } } = __require("util");
|
|
13669
13673
|
const PerMessageDeflate = require_permessage_deflate();
|
|
13670
13674
|
const { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
|
|
13671
13675
|
const { isBlob, isValidStatusCode } = require_validation();
|
|
@@ -13809,7 +13813,8 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
13809
13813
|
buf = Buffer.allocUnsafe(2 + length);
|
|
13810
13814
|
buf.writeUInt16BE(code, 0);
|
|
13811
13815
|
if (typeof data === "string") buf.write(data, 2);
|
|
13812
|
-
else buf.set(data, 2);
|
|
13816
|
+
else if (isUint8Array(data)) buf.set(data, 2);
|
|
13817
|
+
else throw new TypeError("Second argument must be a string or a Uint8Array");
|
|
13813
13818
|
}
|
|
13814
13819
|
const options = {
|
|
13815
13820
|
[kByteLength]: buf.length,
|
|
@@ -14154,7 +14159,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14154
14159
|
}
|
|
14155
14160
|
}));
|
|
14156
14161
|
//#endregion
|
|
14157
|
-
//#region ../../node_modules/.pnpm/ws@8.20.
|
|
14162
|
+
//#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/event-target.js
|
|
14158
14163
|
var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14159
14164
|
const { kForOnEventAttribute, kListener } = require_constants();
|
|
14160
14165
|
const kCode = Symbol("kCode");
|
|
@@ -14385,7 +14390,7 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14385
14390
|
}
|
|
14386
14391
|
}));
|
|
14387
14392
|
//#endregion
|
|
14388
|
-
//#region ../../node_modules/.pnpm/ws@8.20.
|
|
14393
|
+
//#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/extension.js
|
|
14389
14394
|
var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14390
14395
|
const { tokenChars } = require_validation();
|
|
14391
14396
|
/**
|
|
@@ -14528,7 +14533,7 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
14528
14533
|
};
|
|
14529
14534
|
}));
|
|
14530
14535
|
//#endregion
|
|
14531
|
-
//#region ../../node_modules/.pnpm/ws@8.20.
|
|
14536
|
+
//#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket.js
|
|
14532
14537
|
var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
14533
14538
|
const EventEmitter$2 = __require("events");
|
|
14534
14539
|
const https$3 = __require("https");
|
|
@@ -15503,7 +15508,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15503
15508
|
}
|
|
15504
15509
|
}));
|
|
15505
15510
|
//#endregion
|
|
15506
|
-
//#region ../../node_modules/.pnpm/ws@8.20.
|
|
15511
|
+
//#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/stream.js
|
|
15507
15512
|
var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15508
15513
|
require_websocket();
|
|
15509
15514
|
const { Duplex: Duplex$1 } = __require("stream");
|
|
@@ -15619,7 +15624,7 @@ var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15619
15624
|
module.exports = createWebSocketStream;
|
|
15620
15625
|
}));
|
|
15621
15626
|
//#endregion
|
|
15622
|
-
//#region ../../node_modules/.pnpm/ws@8.20.
|
|
15627
|
+
//#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/subprotocol.js
|
|
15623
15628
|
var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15624
15629
|
const { tokenChars } = require_validation();
|
|
15625
15630
|
/**
|
|
@@ -15658,7 +15663,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
15658
15663
|
module.exports = { parse };
|
|
15659
15664
|
}));
|
|
15660
15665
|
//#endregion
|
|
15661
|
-
//#region ../../node_modules/.pnpm/ws@8.20.
|
|
15666
|
+
//#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket-server.js
|
|
15662
15667
|
var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
15663
15668
|
const EventEmitter$1 = __require("events");
|
|
15664
15669
|
const http$4 = __require("http");
|
|
@@ -19165,7 +19170,7 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
|
|
|
19165
19170
|
source: content
|
|
19166
19171
|
});
|
|
19167
19172
|
if (environment.config.command === "build" && noInlineRE.test(postfix)) postfix = postfix.replace(noInlineRE, "").replace(/^&/, "?");
|
|
19168
|
-
if (environment.config.command === "serve" && environment.config.
|
|
19173
|
+
if (environment.config.command === "serve" && environment.config.isBundled) url = toOutputFilePathInJSForBundledDev(environment, pluginContext.getFileName(referenceId));
|
|
19169
19174
|
else url = `__VITE_ASSET__${referenceId}__${postfix ? `$_${postfix}__` : ``}`;
|
|
19170
19175
|
}
|
|
19171
19176
|
cache.set(id, url);
|
|
@@ -19552,7 +19557,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19552
19557
|
};
|
|
19553
19558
|
}));
|
|
19554
19559
|
//#endregion
|
|
19555
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
19560
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.15_tsx@4.22.3_yaml@2.9.0/node_modules/postcss-load-config/src/req.js
|
|
19556
19561
|
var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
19557
19562
|
const { createRequire: createRequire$1 } = __require("node:module");
|
|
19558
19563
|
const { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1 } = __require("node:url");
|
|
@@ -19594,7 +19599,7 @@ var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19594
19599
|
module.exports = req;
|
|
19595
19600
|
}));
|
|
19596
19601
|
//#endregion
|
|
19597
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
19602
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.15_tsx@4.22.3_yaml@2.9.0/node_modules/postcss-load-config/src/options.js
|
|
19598
19603
|
var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
19599
19604
|
const req = require_req();
|
|
19600
19605
|
/**
|
|
@@ -19628,7 +19633,7 @@ var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19628
19633
|
module.exports = options;
|
|
19629
19634
|
}));
|
|
19630
19635
|
//#endregion
|
|
19631
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
19636
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.15_tsx@4.22.3_yaml@2.9.0/node_modules/postcss-load-config/src/plugins.js
|
|
19632
19637
|
var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
19633
19638
|
const req = require_req();
|
|
19634
19639
|
/**
|
|
@@ -19682,7 +19687,7 @@ var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
19682
19687
|
module.exports = plugins;
|
|
19683
19688
|
}));
|
|
19684
19689
|
//#endregion
|
|
19685
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.
|
|
19690
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.15_tsx@4.22.3_yaml@2.9.0/node_modules/postcss-load-config/src/index.js
|
|
19686
19691
|
var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
19687
19692
|
const { resolve: resolve$3 } = __require("node:path");
|
|
19688
19693
|
const config = require_src$1();
|
|
@@ -20426,8 +20431,8 @@ function cssPlugin(config) {
|
|
|
20426
20431
|
preprocessorWorkerController = createPreprocessorWorkerController(normalizeMaxWorkers(config.css.preprocessorMaxWorkers));
|
|
20427
20432
|
preprocessorWorkerControllerCache.set(config, preprocessorWorkerController);
|
|
20428
20433
|
},
|
|
20429
|
-
buildEnd() {
|
|
20430
|
-
preprocessorWorkerController?.close();
|
|
20434
|
+
async buildEnd() {
|
|
20435
|
+
await preprocessorWorkerController?.close();
|
|
20431
20436
|
},
|
|
20432
20437
|
load: {
|
|
20433
20438
|
filter: { id: CSS_LANGS_RE },
|
|
@@ -20498,7 +20503,9 @@ function cssPostPlugin(config) {
|
|
|
20498
20503
|
else if (typeof assetFileNames === "string") return path.join(path.dirname(assetFileNames), cssAssetNameDir);
|
|
20499
20504
|
else return path.dirname(assetFileNames({
|
|
20500
20505
|
type: "asset",
|
|
20506
|
+
name: cssAssetName,
|
|
20501
20507
|
names: [cssAssetName],
|
|
20508
|
+
originalFileName,
|
|
20502
20509
|
originalFileNames: originalFileName ? [originalFileName] : [],
|
|
20503
20510
|
source: "/* vite internal call, ignore */"
|
|
20504
20511
|
}));
|
|
@@ -20555,7 +20562,7 @@ function cssPostPlugin(config) {
|
|
|
20555
20562
|
const cssContent = await getContentWithSourcemap(css);
|
|
20556
20563
|
return {
|
|
20557
20564
|
code: [
|
|
20558
|
-
config.isBundled ? `const { updateStyle: __vite__updateStyle, removeStyle: __vite__removeStyle } = import.meta.hot._internal` : `import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from ${JSON.stringify(path.posix.join(config.base, CLIENT_PUBLIC_PATH))}`,
|
|
20565
|
+
this.environment.config.isBundled ? `const { updateStyle: __vite__updateStyle, removeStyle: __vite__removeStyle } = import.meta.hot._internal` : `import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from ${JSON.stringify(path.posix.join(config.base, CLIENT_PUBLIC_PATH))}`,
|
|
20559
20566
|
`const __vite__id = ${JSON.stringify(id)}`,
|
|
20560
20567
|
`const __vite__css = ${JSON.stringify(cssContent)}`,
|
|
20561
20568
|
`__vite__updateStyle(__vite__id, __vite__css)`,
|
|
@@ -20810,6 +20817,9 @@ function injectInlinedCSS(s, ctx, code, format, injectCode) {
|
|
|
20810
20817
|
function cssAnalysisPlugin(config) {
|
|
20811
20818
|
return {
|
|
20812
20819
|
name: "vite:css-analysis",
|
|
20820
|
+
applyToEnvironment(environment) {
|
|
20821
|
+
return !environment.config.isBundled;
|
|
20822
|
+
},
|
|
20813
20823
|
transform: {
|
|
20814
20824
|
filter: { id: {
|
|
20815
20825
|
include: CSS_LANGS_RE,
|
|
@@ -21469,8 +21479,8 @@ const scssProcessor = (maxWorkers) => {
|
|
|
21469
21479
|
let failedSassEmbedded;
|
|
21470
21480
|
const normalizedErrors = /* @__PURE__ */ new WeakSet();
|
|
21471
21481
|
return {
|
|
21472
|
-
close() {
|
|
21473
|
-
worker?.stop();
|
|
21482
|
+
async close() {
|
|
21483
|
+
await worker?.stop();
|
|
21474
21484
|
},
|
|
21475
21485
|
async process(environment, source, root, options, resolvers) {
|
|
21476
21486
|
let sassPackage = loadSassPackage(root, failedSassEmbedded ?? false);
|
|
@@ -21766,10 +21776,12 @@ const createPreprocessorWorkerController = (maxWorkers) => {
|
|
|
21766
21776
|
opts.syntax = "indented";
|
|
21767
21777
|
return scss.process(environment, source, root, opts, resolvers);
|
|
21768
21778
|
};
|
|
21769
|
-
const close = () => {
|
|
21770
|
-
|
|
21771
|
-
|
|
21772
|
-
|
|
21779
|
+
const close = async () => {
|
|
21780
|
+
await Promise.all([
|
|
21781
|
+
less.close(),
|
|
21782
|
+
scss.close(),
|
|
21783
|
+
styl.close()
|
|
21784
|
+
]);
|
|
21773
21785
|
};
|
|
21774
21786
|
return {
|
|
21775
21787
|
["less"]: less.process,
|
|
@@ -21914,9 +21926,8 @@ async function compileLightningCSS(environment, id, src, deps, workerController,
|
|
|
21914
21926
|
};
|
|
21915
21927
|
}
|
|
21916
21928
|
function getLightningCssErrorMessageForIeSyntaxes(code) {
|
|
21917
|
-
|
|
21918
|
-
if (/
|
|
21919
|
-
if (/min-width:\s*0\\0/.test(code)) return ".\nThis file contains @media zero hack (e.g. `@media (min-width: 0\\0)`)" + commonIeMessage;
|
|
21929
|
+
if (/[\s;{]\*[a-zA-Z-][\w-]+\s*:/.test(code)) return ".\nThis file contains star property hack (e.g. `*zoom`), which was used in the past to support old Internet Explorer versions. This is not a valid CSS syntax and will be ignored by modern browsers. \nWhile this is not supported by LightningCSS, you can set `css.lightningcss.errorRecovery: true` to strip these codes.";
|
|
21930
|
+
if (/min-width:\s*0\\0/.test(code)) return ".\nThis file contains @media zero hack (e.g. `@media (min-width: 0\\0)`), which was used in the past to support old Internet Explorer versions. This is not a valid CSS syntax and will be ignored by modern browsers. \nWhile this is not supported by LightningCSS, you can set `css.lightningcss.errorRecovery: true` to strip these codes.";
|
|
21920
21931
|
}
|
|
21921
21932
|
const map = {
|
|
21922
21933
|
chrome: "chrome",
|
|
@@ -22066,13 +22077,14 @@ function resolveLibCssFilename(libOptions, root, packageCache) {
|
|
|
22066
22077
|
//#endregion
|
|
22067
22078
|
//#region src/node/plugins/modulePreloadPolyfill.ts
|
|
22068
22079
|
const modulePreloadPolyfillId = "vite/modulepreload-polyfill";
|
|
22069
|
-
const resolvedModulePreloadPolyfillId = "\
|
|
22070
|
-
function modulePreloadPolyfillPlugin(
|
|
22071
|
-
if (config.isBundled) return perEnvironmentPlugin("native:modulepreload-polyfill", (environment) => {
|
|
22072
|
-
return viteModulePreloadPolyfillPlugin({ isServer: environment.config.consumer !== "client" });
|
|
22073
|
-
});
|
|
22080
|
+
const resolvedModulePreloadPolyfillId = "\0vite/modulepreload-polyfill.js";
|
|
22081
|
+
function modulePreloadPolyfillPlugin() {
|
|
22074
22082
|
return {
|
|
22075
22083
|
name: "vite:modulepreload-polyfill",
|
|
22084
|
+
applyToEnvironment(environment) {
|
|
22085
|
+
if (environment.config.isBundled) return viteModulePreloadPolyfillPlugin({ isServer: environment.config.consumer !== "client" });
|
|
22086
|
+
return true;
|
|
22087
|
+
},
|
|
22076
22088
|
resolveId: {
|
|
22077
22089
|
filter: { id: exactRegex(modulePreloadPolyfillId) },
|
|
22078
22090
|
handler(_id) {
|
|
@@ -22280,6 +22292,9 @@ function buildHtmlPlugin(config) {
|
|
|
22280
22292
|
isAsyncScriptMap.set(config, /* @__PURE__ */ new Map());
|
|
22281
22293
|
return {
|
|
22282
22294
|
name: "vite:build-html",
|
|
22295
|
+
applyToEnvironment(environment) {
|
|
22296
|
+
return environment.config.isBundled;
|
|
22297
|
+
},
|
|
22283
22298
|
transform: {
|
|
22284
22299
|
filter: { id: /\.html$/ },
|
|
22285
22300
|
async handler(html, id) {
|
|
@@ -22837,7 +22852,6 @@ const nonJsRe = /\.json(?:$|\?)/;
|
|
|
22837
22852
|
const isNonJsRequest = (request) => nonJsRe.test(request);
|
|
22838
22853
|
const escapedDotRE = /(?<!\\)\\./g;
|
|
22839
22854
|
function definePlugin(config) {
|
|
22840
|
-
const isBundled = config.isBundled;
|
|
22841
22855
|
const isBuild = config.command === "build";
|
|
22842
22856
|
const isBuildLib = isBuild && config.build.lib;
|
|
22843
22857
|
const processEnv = {};
|
|
@@ -22852,21 +22866,22 @@ function definePlugin(config) {
|
|
|
22852
22866
|
"globalThis.process.env.NODE_ENV": JSON.stringify(nodeEnv)
|
|
22853
22867
|
});
|
|
22854
22868
|
}
|
|
22855
|
-
const importMetaKeys = {};
|
|
22856
|
-
const importMetaEnvKeys = {};
|
|
22857
|
-
const importMetaFallbackKeys = {};
|
|
22858
|
-
if (isBuild) importMetaKeys["import.meta.hot"] = `undefined`;
|
|
22859
|
-
if (isBundled) {
|
|
22860
|
-
for (const key in config.env) {
|
|
22861
|
-
const val = JSON.stringify(config.env[key]);
|
|
22862
|
-
importMetaKeys[`import.meta.env.${key}`] = val;
|
|
22863
|
-
importMetaEnvKeys[key] = val;
|
|
22864
|
-
}
|
|
22865
|
-
importMetaKeys["import.meta.env.SSR"] = `undefined`;
|
|
22866
|
-
importMetaFallbackKeys["import.meta.env"] = `undefined`;
|
|
22867
|
-
}
|
|
22868
22869
|
function generatePattern(environment) {
|
|
22870
|
+
const isBundled = environment.config.isBundled;
|
|
22869
22871
|
const keepProcessEnv = environment.config.keepProcessEnv;
|
|
22872
|
+
const importMetaKeys = {};
|
|
22873
|
+
const importMetaEnvKeys = {};
|
|
22874
|
+
const importMetaFallbackKeys = {};
|
|
22875
|
+
if (isBuild) importMetaKeys["import.meta.hot"] = `undefined`;
|
|
22876
|
+
if (isBundled) {
|
|
22877
|
+
for (const key in config.env) {
|
|
22878
|
+
const val = JSON.stringify(config.env[key]);
|
|
22879
|
+
importMetaKeys[`import.meta.env.${key}`] = val;
|
|
22880
|
+
importMetaEnvKeys[key] = val;
|
|
22881
|
+
}
|
|
22882
|
+
importMetaKeys["import.meta.env.SSR"] = `undefined`;
|
|
22883
|
+
importMetaFallbackKeys["import.meta.env"] = `undefined`;
|
|
22884
|
+
}
|
|
22870
22885
|
const userDefine = {};
|
|
22871
22886
|
const userDefineEnv = {};
|
|
22872
22887
|
for (const key in environment.config.define) {
|
|
@@ -22904,21 +22919,24 @@ function definePlugin(config) {
|
|
|
22904
22919
|
}
|
|
22905
22920
|
return pattern;
|
|
22906
22921
|
}
|
|
22907
|
-
if (isBundled) return {
|
|
22908
|
-
name: "vite:define",
|
|
22909
|
-
options(option) {
|
|
22910
|
-
const [define, _pattern, importMetaEnvVal] = getPattern(this.environment);
|
|
22911
|
-
define["import.meta.env"] = importMetaEnvVal;
|
|
22912
|
-
define["import.meta.env.*"] = "undefined";
|
|
22913
|
-
option.transform ??= {};
|
|
22914
|
-
option.transform.define = {
|
|
22915
|
-
...option.transform.define,
|
|
22916
|
-
...define
|
|
22917
|
-
};
|
|
22918
|
-
}
|
|
22919
|
-
};
|
|
22920
22922
|
return {
|
|
22921
22923
|
name: "vite:define",
|
|
22924
|
+
applyToEnvironment(environment) {
|
|
22925
|
+
if (environment.config.isBundled) return {
|
|
22926
|
+
name: "vite:define",
|
|
22927
|
+
options(option) {
|
|
22928
|
+
const [define, _pattern, importMetaEnvVal] = getPattern(this.environment);
|
|
22929
|
+
define["import.meta.env"] = importMetaEnvVal;
|
|
22930
|
+
define["import.meta.env.*"] = "undefined";
|
|
22931
|
+
option.transform ??= {};
|
|
22932
|
+
option.transform.define = {
|
|
22933
|
+
...option.transform.define,
|
|
22934
|
+
...define
|
|
22935
|
+
};
|
|
22936
|
+
}
|
|
22937
|
+
};
|
|
22938
|
+
return true;
|
|
22939
|
+
},
|
|
22922
22940
|
transform: { handler(code, id) {
|
|
22923
22941
|
if (this.environment.config.consumer === "client") return;
|
|
22924
22942
|
if (isHTMLRequest(id) || isCSSRequest(id) || isNonJsRequest(id) || config.assetsInclude(id)) return;
|
|
@@ -22984,6 +23002,9 @@ function clientInjectionsPlugin(config) {
|
|
|
22984
23002
|
});
|
|
22985
23003
|
return {
|
|
22986
23004
|
name: "vite:client-inject",
|
|
23005
|
+
applyToEnvironment(environment) {
|
|
23006
|
+
return !environment.config.isBundled;
|
|
23007
|
+
},
|
|
22987
23008
|
async buildStart() {
|
|
22988
23009
|
injectConfigValues = await createClientConfigValueReplacer(config);
|
|
22989
23010
|
},
|
|
@@ -24908,6 +24929,7 @@ var MemoryFiles = class {
|
|
|
24908
24929
|
};
|
|
24909
24930
|
var FullBundleDevEnvironment = class extends DevEnvironment {
|
|
24910
24931
|
devEngine;
|
|
24932
|
+
initialBuildCompleted = false;
|
|
24911
24933
|
clients = new Clients();
|
|
24912
24934
|
invalidateCalledModules = /* @__PURE__ */ new Map();
|
|
24913
24935
|
debouncedFullReload = debounce(20, () => {
|
|
@@ -24932,8 +24954,8 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
|
|
|
24932
24954
|
if (Array.isArray(rollupOptions.output) && rollupOptions.output.length > 1) throw new Error("multiple output options are not supported in dev mode");
|
|
24933
24955
|
const outputOptions = Array.isArray(rollupOptions.output) ? rollupOptions.output[0] : rollupOptions.output;
|
|
24934
24956
|
this.hot.on("vite:module-loaded", (payload, client) => {
|
|
24935
|
-
|
|
24936
|
-
this.devEngine.registerModules(clientId, payload.modules);
|
|
24957
|
+
this.clients.setupIfNeeded(client, payload.clientId);
|
|
24958
|
+
this.devEngine.registerModules(payload.clientId, payload.modules);
|
|
24937
24959
|
});
|
|
24938
24960
|
this.hot.on("vite:client:disconnect", (_payload, client) => {
|
|
24939
24961
|
const clientId = this.clients.delete(client);
|
|
@@ -24993,6 +25015,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
|
|
|
24993
25015
|
type: "full-reload",
|
|
24994
25016
|
path: "*"
|
|
24995
25017
|
});
|
|
25018
|
+
this.initialBuildCompleted = true;
|
|
24996
25019
|
});
|
|
24997
25020
|
}
|
|
24998
25021
|
async waitForInitialBuildFinish() {
|
|
@@ -25030,7 +25053,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
|
|
|
25030
25053
|
}
|
|
25031
25054
|
async triggerBundleRegenerationIfStale() {
|
|
25032
25055
|
const bundleState = await this.devEngine.getBundleState();
|
|
25033
|
-
const shouldTrigger = bundleState.hasStaleOutput && !bundleState.lastFullBuildFailed;
|
|
25056
|
+
const shouldTrigger = bundleState.hasStaleOutput && !bundleState.lastFullBuildFailed && this.initialBuildCompleted;
|
|
25034
25057
|
if (shouldTrigger) {
|
|
25035
25058
|
this.devEngine.ensureLatestBuildOutput().then(() => {
|
|
25036
25059
|
this.debouncedFullReload();
|
|
@@ -25039,15 +25062,25 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
|
|
|
25039
25062
|
}
|
|
25040
25063
|
return shouldTrigger;
|
|
25041
25064
|
}
|
|
25065
|
+
async triggerLazyBundling(moduleId, clientId) {
|
|
25066
|
+
if (!moduleId || !clientId) return;
|
|
25067
|
+
debug$7?.(`TRIGGER-LAZY: trigger lazy bundling for module ${moduleId} for client ${clientId}`);
|
|
25068
|
+
return await this.devEngine.compileEntry(moduleId, clientId);
|
|
25069
|
+
}
|
|
25042
25070
|
async close() {
|
|
25043
25071
|
this.memoryFiles.clear();
|
|
25044
25072
|
await Promise.all([super.close(), this.devEngine.close()]);
|
|
25073
|
+
this.initialBuildCompleted = false;
|
|
25045
25074
|
}
|
|
25046
25075
|
async getRolldownOptions() {
|
|
25047
25076
|
const chunkMetadataMap = new ChunkMetadataMap();
|
|
25048
25077
|
const rolldownOptions = resolveRolldownOptions(this, chunkMetadataMap);
|
|
25049
25078
|
rolldownOptions.experimental ??= {};
|
|
25050
|
-
rolldownOptions.experimental.devMode = {
|
|
25079
|
+
rolldownOptions.experimental.devMode = {
|
|
25080
|
+
lazy: true,
|
|
25081
|
+
...typeof rolldownOptions.experimental.devMode === "object" ? rolldownOptions.experimental.devMode : {},
|
|
25082
|
+
implement: await getHmrImplementation(this.getTopLevelConfig())
|
|
25083
|
+
};
|
|
25051
25084
|
rolldownOptions.optimization ??= {};
|
|
25052
25085
|
rolldownOptions.optimization.inlineConst = false;
|
|
25053
25086
|
if (Array.isArray(rolldownOptions.output)) for (const output of rolldownOptions.output) {
|
|
@@ -25113,13 +25146,11 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
|
|
|
25113
25146
|
var Clients = class {
|
|
25114
25147
|
clientToId = /* @__PURE__ */ new Map();
|
|
25115
25148
|
idToClient = /* @__PURE__ */ new Map();
|
|
25116
|
-
setupIfNeeded(client) {
|
|
25149
|
+
setupIfNeeded(client, clientId) {
|
|
25117
25150
|
const id = this.clientToId.get(client);
|
|
25118
|
-
if (id)
|
|
25119
|
-
|
|
25120
|
-
this.
|
|
25121
|
-
this.idToClient.set(newId, client);
|
|
25122
|
-
return newId;
|
|
25151
|
+
if (id && id !== clientId) throw new Error("client ID conflict detected. Please restart the dev server.");
|
|
25152
|
+
this.clientToId.set(client, clientId);
|
|
25153
|
+
this.idToClient.set(clientId, client);
|
|
25123
25154
|
}
|
|
25124
25155
|
get(id) {
|
|
25125
25156
|
return this.idToClient.get(id);
|
|
@@ -25228,13 +25259,16 @@ const wordCharRE = /\w/;
|
|
|
25228
25259
|
function isBareRelative(url) {
|
|
25229
25260
|
return wordCharRE.test(url[0]) && !url.includes(":");
|
|
25230
25261
|
}
|
|
25262
|
+
function getHtmlDirnameForRelativeUrl(htmlPath) {
|
|
25263
|
+
return htmlPath.endsWith("/") ? htmlPath : path.posix.dirname(htmlPath);
|
|
25264
|
+
}
|
|
25231
25265
|
const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, server, isClassicScriptLink) => {
|
|
25232
25266
|
const replacer = (url) => {
|
|
25233
25267
|
if (url[0] === "/" && url[1] !== "/" || (url[0] === "." || isBareRelative(url)) && originalUrl && originalUrl !== "/" && htmlPath === "/index.html") url = path.posix.join(config.base, url);
|
|
25234
25268
|
let preTransformUrl;
|
|
25235
25269
|
if (!isClassicScriptLink && shouldPreTransform(url, config)) {
|
|
25236
25270
|
if (url[0] === "/" && url[1] !== "/") preTransformUrl = url;
|
|
25237
|
-
else if (url[0] === "." || isBareRelative(url)) preTransformUrl = path.posix.join(config.base,
|
|
25271
|
+
else if (url[0] === "." || isBareRelative(url)) preTransformUrl = path.posix.join(config.base, getHtmlDirnameForRelativeUrl(htmlPath), url);
|
|
25238
25272
|
}
|
|
25239
25273
|
if (server) {
|
|
25240
25274
|
const mod = server.environments.client.moduleGraph.urlToModuleMap.get(preTransformUrl || url);
|
|
@@ -25985,6 +26019,27 @@ function memoryFilesMiddleware(server) {
|
|
|
25985
26019
|
};
|
|
25986
26020
|
}
|
|
25987
26021
|
//#endregion
|
|
26022
|
+
//#region src/node/server/middlewares/triggerLazyBundling.ts
|
|
26023
|
+
function triggerLazyBundlingMiddleware(server) {
|
|
26024
|
+
const environment = server.environments.client instanceof FullBundleDevEnvironment ? server.environments.client : void 0;
|
|
26025
|
+
if (!environment) throw new Error("triggerLazyBundlingMiddleware can only be used for fullBundleMode");
|
|
26026
|
+
return async function viteTriggerLazyBundlingMiddleware(req, res, next) {
|
|
26027
|
+
if (!req.url?.startsWith("/@vite/lazy?")) return next();
|
|
26028
|
+
let params;
|
|
26029
|
+
try {
|
|
26030
|
+
params = new URL(`http://localhost${req.url}`).searchParams;
|
|
26031
|
+
} catch {
|
|
26032
|
+
return next();
|
|
26033
|
+
}
|
|
26034
|
+
const moduleId = params.get("id");
|
|
26035
|
+
const clientId = params.get("clientId");
|
|
26036
|
+
const code = await environment.triggerLazyBundling(moduleId, clientId);
|
|
26037
|
+
if (code == null) return next();
|
|
26038
|
+
res.setHeader("Content-Type", "application/javascript");
|
|
26039
|
+
return res.end(code);
|
|
26040
|
+
};
|
|
26041
|
+
}
|
|
26042
|
+
//#endregion
|
|
25988
26043
|
//#region src/node/server/index.ts
|
|
25989
26044
|
var server_exports = /* @__PURE__ */ __exportAll({
|
|
25990
26045
|
_createServer: () => _createServer,
|
|
@@ -26282,8 +26337,10 @@ async function _createServer(inlineConfig = {}, options) {
|
|
|
26282
26337
|
else next();
|
|
26283
26338
|
});
|
|
26284
26339
|
if (publicDir) middlewares.use(servePublicMiddleware(server, publicFiles));
|
|
26285
|
-
if (config.experimental.bundledDev)
|
|
26286
|
-
|
|
26340
|
+
if (config.experimental.bundledDev) {
|
|
26341
|
+
middlewares.use(triggerLazyBundlingMiddleware(server));
|
|
26342
|
+
middlewares.use(memoryFilesMiddleware(server));
|
|
26343
|
+
} else {
|
|
26287
26344
|
middlewares.use(transformMiddleware(server));
|
|
26288
26345
|
middlewares.use(serveRawFsMiddleware(server));
|
|
26289
26346
|
middlewares.use(serveStaticMiddleware(server));
|
|
@@ -27236,12 +27293,16 @@ async function workerFileToUrl(config, id) {
|
|
|
27236
27293
|
}, config.logger);
|
|
27237
27294
|
return bundle;
|
|
27238
27295
|
}
|
|
27239
|
-
function webWorkerPostPlugin(
|
|
27240
|
-
if (config.isBundled) return perEnvironmentPlugin("native:web-worker-post-plugin", (environment) => {
|
|
27241
|
-
if (environment.config.worker.format === "iife") return viteWebWorkerPostPlugin();
|
|
27242
|
-
});
|
|
27296
|
+
function webWorkerPostPlugin(_config) {
|
|
27243
27297
|
return {
|
|
27244
27298
|
name: "vite:worker-post",
|
|
27299
|
+
applyToEnvironment(environment) {
|
|
27300
|
+
if (environment.config.isBundled) {
|
|
27301
|
+
if (environment.config.worker.format === "iife") return viteWebWorkerPostPlugin();
|
|
27302
|
+
return false;
|
|
27303
|
+
}
|
|
27304
|
+
return true;
|
|
27305
|
+
},
|
|
27245
27306
|
transform: {
|
|
27246
27307
|
filter: { code: "import.meta" },
|
|
27247
27308
|
order: "post",
|
|
@@ -27298,13 +27359,14 @@ function webWorkerPlugin(config) {
|
|
|
27298
27359
|
if (!workerMatch) return;
|
|
27299
27360
|
const { format } = config.worker;
|
|
27300
27361
|
const workerConstructor = workerMatch[1] === "sharedworker" ? "SharedWorker" : "Worker";
|
|
27301
|
-
const
|
|
27362
|
+
const isBundled = this.environment.config.isBundled;
|
|
27363
|
+
const workerType = isBundled ? format === "es" ? "module" : "classic" : "module";
|
|
27302
27364
|
const workerTypeOption = `{
|
|
27303
27365
|
${workerType === "module" ? `type: "module",` : ""}
|
|
27304
27366
|
name: options?.name
|
|
27305
27367
|
}`;
|
|
27306
27368
|
let urlCode;
|
|
27307
|
-
if (
|
|
27369
|
+
if (isBundled) if (isWorker && config.bundleChain.at(-1) === cleanUrl(id)) urlCode = "self.location.href";
|
|
27308
27370
|
else if (inlineRE.test(id)) {
|
|
27309
27371
|
const result = await bundleWorkerEntry(config, id);
|
|
27310
27372
|
for (const file of result.watchedFiles) this.addWatchFile(file);
|
|
@@ -27341,7 +27403,7 @@ function webWorkerPlugin(config) {
|
|
|
27341
27403
|
} else {
|
|
27342
27404
|
const result = await workerFileToUrl(config, id);
|
|
27343
27405
|
let url;
|
|
27344
|
-
if (this.environment.config.command === "serve" && this.environment.config.
|
|
27406
|
+
if (this.environment.config.command === "serve" && this.environment.config.isBundled) url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
|
|
27345
27407
|
else url = result.entryUrlPlaceholder;
|
|
27346
27408
|
urlCode = JSON.stringify(url);
|
|
27347
27409
|
for (const file of result.watchedFiles) this.addWatchFile(file);
|
|
@@ -27375,7 +27437,7 @@ function webWorkerPlugin(config) {
|
|
|
27375
27437
|
let injectEnv = "";
|
|
27376
27438
|
if (workerType === "classic") injectEnv = `importScripts(${JSON.stringify(path.posix.join(config.base, ENV_PUBLIC_PATH))})\n`;
|
|
27377
27439
|
else if (workerType === "module") injectEnv = `import ${JSON.stringify(ENV_PUBLIC_PATH)}\n`;
|
|
27378
|
-
else if (workerType === "ignore") if (config.isBundled) injectEnv = "";
|
|
27440
|
+
else if (workerType === "ignore") if (this.environment.config.isBundled) injectEnv = "";
|
|
27379
27441
|
else {
|
|
27380
27442
|
const environment = this.environment;
|
|
27381
27443
|
injectEnv = ((environment.mode === "dev" ? environment.moduleGraph : void 0)?.getModuleById(ENV_ENTRY))?.transformResult?.code || "";
|
|
@@ -27459,6 +27521,7 @@ function preAliasPlugin(config) {
|
|
|
27459
27521
|
return {
|
|
27460
27522
|
name: "vite:pre-alias",
|
|
27461
27523
|
applyToEnvironment(environment) {
|
|
27524
|
+
if (environment.config.isBundled) return false;
|
|
27462
27525
|
return !isDepOptimizationDisabled(environment.config.optimizeDeps);
|
|
27463
27526
|
},
|
|
27464
27527
|
async resolveId(id, importer, options) {
|
|
@@ -27605,6 +27668,9 @@ function importAnalysisPlugin(config) {
|
|
|
27605
27668
|
}
|
|
27606
27669
|
return {
|
|
27607
27670
|
name: "vite:import-analysis",
|
|
27671
|
+
applyToEnvironment(environment) {
|
|
27672
|
+
return !environment.config.isBundled;
|
|
27673
|
+
},
|
|
27608
27674
|
async transform(source, importer) {
|
|
27609
27675
|
const environment = this.environment;
|
|
27610
27676
|
const ssr = environment.config.consumer === "server";
|
|
@@ -28094,7 +28160,6 @@ async function getWorkerType(raw, clean, i) {
|
|
|
28094
28160
|
}
|
|
28095
28161
|
const workerImportMetaUrlRE = /\bnew\s+(?:Worker|SharedWorker)\s*\(\s*(new\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*(?:,\s*)?\))/dg;
|
|
28096
28162
|
function workerImportMetaUrlPlugin(config) {
|
|
28097
|
-
const isBundled = config.isBundled;
|
|
28098
28163
|
let workerResolver;
|
|
28099
28164
|
const fsResolveOptions = {
|
|
28100
28165
|
...config.resolve,
|
|
@@ -28112,6 +28177,7 @@ function workerImportMetaUrlPlugin(config) {
|
|
|
28112
28177
|
transform: {
|
|
28113
28178
|
filter: { code: workerImportMetaUrlRE },
|
|
28114
28179
|
async handler(code, id) {
|
|
28180
|
+
const isBundled = this.environment.config.isBundled;
|
|
28115
28181
|
let s;
|
|
28116
28182
|
const cleanString = stripLiteral(code);
|
|
28117
28183
|
const re = new RegExp(workerImportMetaUrlRE);
|
|
@@ -28141,7 +28207,7 @@ function workerImportMetaUrlPlugin(config) {
|
|
|
28141
28207
|
let builtUrl;
|
|
28142
28208
|
if (isBundled) {
|
|
28143
28209
|
const result = await workerFileToUrl(config, file);
|
|
28144
|
-
if (this.environment.config.command === "serve"
|
|
28210
|
+
if (this.environment.config.command === "serve") builtUrl = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
|
|
28145
28211
|
else builtUrl = result.entryUrlPlaceholder;
|
|
28146
28212
|
for (const file of result.watchedFiles) this.addWatchFile(file);
|
|
28147
28213
|
} else {
|
|
@@ -28696,23 +28762,26 @@ function dynamicImportVarsPlugin(config) {
|
|
|
28696
28762
|
tryIndex: false,
|
|
28697
28763
|
extensions: []
|
|
28698
28764
|
});
|
|
28699
|
-
if (config.isBundled) return perEnvironmentPlugin("native:dynamic-import-vars", (environment) => {
|
|
28700
|
-
const { include, exclude } = environment.config.build.dynamicImportVarsOptions;
|
|
28701
|
-
return viteDynamicImportVarsPlugin({
|
|
28702
|
-
include,
|
|
28703
|
-
exclude,
|
|
28704
|
-
resolver(id, importer) {
|
|
28705
|
-
return resolve(environment, id, importer);
|
|
28706
|
-
},
|
|
28707
|
-
sourcemap: !!environment.config.build.sourcemap
|
|
28708
|
-
});
|
|
28709
|
-
});
|
|
28710
28765
|
const getFilter = perEnvironmentState((environment) => {
|
|
28711
28766
|
const { include, exclude } = environment.config.build.dynamicImportVarsOptions;
|
|
28712
28767
|
return createFilter$1(include, exclude);
|
|
28713
28768
|
});
|
|
28714
28769
|
return {
|
|
28715
28770
|
name: "vite:dynamic-import-vars",
|
|
28771
|
+
applyToEnvironment(environment) {
|
|
28772
|
+
if (environment.config.isBundled) {
|
|
28773
|
+
const { include, exclude } = environment.config.build.dynamicImportVarsOptions;
|
|
28774
|
+
return viteDynamicImportVarsPlugin({
|
|
28775
|
+
include,
|
|
28776
|
+
exclude,
|
|
28777
|
+
resolver(id, importer) {
|
|
28778
|
+
return resolve(environment, id, importer);
|
|
28779
|
+
},
|
|
28780
|
+
sourcemap: !!environment.config.build.sourcemap
|
|
28781
|
+
});
|
|
28782
|
+
}
|
|
28783
|
+
return true;
|
|
28784
|
+
},
|
|
28716
28785
|
resolveId: {
|
|
28717
28786
|
filter: { id: exactRegex(dynamicImportHelperId) },
|
|
28718
28787
|
handler(id) {
|
|
@@ -28770,14 +28839,17 @@ function dynamicImportVarsPlugin(config) {
|
|
|
28770
28839
|
//#endregion
|
|
28771
28840
|
//#region src/node/plugins/importMetaGlob.ts
|
|
28772
28841
|
function importGlobPlugin(config) {
|
|
28773
|
-
if (config.isBundled) return viteImportGlobPlugin({
|
|
28774
|
-
root: config.root,
|
|
28775
|
-
sourcemap: !!config.build.sourcemap,
|
|
28776
|
-
restoreQueryExtension: config.experimental.importGlobRestoreExtension
|
|
28777
|
-
});
|
|
28778
28842
|
const importGlobMaps = /* @__PURE__ */ new Map();
|
|
28779
28843
|
return {
|
|
28780
28844
|
name: "vite:import-glob",
|
|
28845
|
+
applyToEnvironment(environment) {
|
|
28846
|
+
if (environment.config.isBundled) return viteImportGlobPlugin({
|
|
28847
|
+
root: environment.config.root,
|
|
28848
|
+
sourcemap: !!environment.config.build.sourcemap,
|
|
28849
|
+
restoreQueryExtension: environment.config.experimental.importGlobRestoreExtension
|
|
28850
|
+
});
|
|
28851
|
+
return true;
|
|
28852
|
+
},
|
|
28781
28853
|
buildStart() {
|
|
28782
28854
|
importGlobMaps.clear();
|
|
28783
28855
|
},
|
|
@@ -29002,7 +29074,6 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
|
|
|
29002
29074
|
if (options.base) {
|
|
29003
29075
|
filePath = relative$1(posix.join(options.base[0] === "/" ? root : dir, options.base), file);
|
|
29004
29076
|
if (!filePath.startsWith("./") && !filePath.startsWith("../")) filePath = `./${filePath}`;
|
|
29005
|
-
if (options.base[0] === "/") importPath = `/${relative$1(root, file)}`;
|
|
29006
29077
|
} else if (isRelative) filePath = importPath;
|
|
29007
29078
|
else {
|
|
29008
29079
|
filePath = relative$1(root, file);
|
|
@@ -29187,7 +29258,7 @@ function createFilterForTransform(idFilter, codeFilter, moduleTypeFilter, cwd) {
|
|
|
29187
29258
|
};
|
|
29188
29259
|
}
|
|
29189
29260
|
//#endregion
|
|
29190
|
-
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.
|
|
29261
|
+
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.7/node_modules/@vitest/utils/dist/helpers.js
|
|
29191
29262
|
function notNullish(v) {
|
|
29192
29263
|
return v != null;
|
|
29193
29264
|
}
|
|
@@ -29195,7 +29266,7 @@ function isPrimitive(value) {
|
|
|
29195
29266
|
return value === null || typeof value !== "function" && typeof value !== "object";
|
|
29196
29267
|
}
|
|
29197
29268
|
//#endregion
|
|
29198
|
-
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.
|
|
29269
|
+
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.7/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
|
|
29199
29270
|
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
29200
29271
|
function normalizeWindowsPath(input = "") {
|
|
29201
29272
|
if (!input) return input;
|
|
@@ -29274,7 +29345,7 @@ const isAbsolute$2 = function(p) {
|
|
|
29274
29345
|
return _IS_ABSOLUTE_RE.test(p);
|
|
29275
29346
|
};
|
|
29276
29347
|
//#endregion
|
|
29277
|
-
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.
|
|
29348
|
+
//#region ../../node_modules/.pnpm/@vitest+utils@4.1.7/node_modules/@vitest/utils/dist/source-map.js
|
|
29278
29349
|
var comma = ",".charCodeAt(0);
|
|
29279
29350
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
29280
29351
|
var intToChar = new Uint8Array(64);
|
|
@@ -29745,29 +29816,34 @@ function esbuildBannerFooterCompatPlugin(config) {
|
|
|
29745
29816
|
//#region src/node/plugins/index.ts
|
|
29746
29817
|
async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
|
|
29747
29818
|
const isBuild = config.command === "build";
|
|
29748
|
-
const isBundled = config.isBundled;
|
|
29749
29819
|
const isWorker = config.isWorker;
|
|
29750
|
-
const buildPlugins = isBundled ? (await Promise.resolve().then(() => build_exports)).resolveBuildPlugins(config) : {
|
|
29820
|
+
const buildPlugins = isBuild || Object.values(config.environments).some((env) => env.isBundled) ? (await Promise.resolve().then(() => build_exports)).resolveBuildPlugins(config) : {
|
|
29751
29821
|
pre: [],
|
|
29752
29822
|
post: []
|
|
29753
29823
|
};
|
|
29754
29824
|
const devtoolsIntegrationPlugin = config.devtools.enabled && !isWorker ? await loadDevToolsIntegrationPlugin(config) : null;
|
|
29755
29825
|
const { modulePreload } = config.build;
|
|
29756
29826
|
return [
|
|
29757
|
-
|
|
29827
|
+
optimizedDepsPlugin(),
|
|
29758
29828
|
!isWorker ? watchPackageDataPlugin(config.packageCache) : null,
|
|
29759
|
-
|
|
29760
|
-
|
|
29761
|
-
|
|
29762
|
-
|
|
29763
|
-
|
|
29764
|
-
}
|
|
29765
|
-
|
|
29766
|
-
|
|
29767
|
-
|
|
29768
|
-
|
|
29829
|
+
preAliasPlugin(config),
|
|
29830
|
+
{
|
|
29831
|
+
...alias$1({
|
|
29832
|
+
entries: config.resolve.alias,
|
|
29833
|
+
customResolver: viteAliasCustomResolver
|
|
29834
|
+
}),
|
|
29835
|
+
applyToEnvironment(environment) {
|
|
29836
|
+
if (environment.config.isBundled && !environment.config.resolve.alias.some((v) => v.customResolver)) return viteAliasPlugin({ entries: config.resolve.alias.map((item) => {
|
|
29837
|
+
return {
|
|
29838
|
+
find: item.find,
|
|
29839
|
+
replacement: item.replacement
|
|
29840
|
+
};
|
|
29841
|
+
}) });
|
|
29842
|
+
return true;
|
|
29843
|
+
}
|
|
29844
|
+
},
|
|
29769
29845
|
...prePlugins,
|
|
29770
|
-
modulePreload !== false && modulePreload.polyfill ? modulePreloadPolyfillPlugin(
|
|
29846
|
+
modulePreload !== false && modulePreload.polyfill ? modulePreloadPolyfillPlugin() : null,
|
|
29771
29847
|
...oxcResolvePlugin({
|
|
29772
29848
|
root: config.root,
|
|
29773
29849
|
isProduction: config.isProduction,
|
|
@@ -29780,12 +29856,18 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
|
|
|
29780
29856
|
}, isWorker ? {
|
|
29781
29857
|
...config,
|
|
29782
29858
|
consumer: "client",
|
|
29859
|
+
isBundled: true,
|
|
29783
29860
|
optimizeDepsPluginNames: []
|
|
29784
29861
|
} : void 0),
|
|
29785
29862
|
htmlInlineProxyPlugin(config),
|
|
29786
29863
|
cssPlugin(config),
|
|
29787
29864
|
esbuildBannerFooterCompatPlugin(config),
|
|
29788
|
-
config.oxc !== false
|
|
29865
|
+
config.oxc !== false ? {
|
|
29866
|
+
...oxcRuntimePlugin(),
|
|
29867
|
+
applyToEnvironment(environment) {
|
|
29868
|
+
return !environment.config.isBundled;
|
|
29869
|
+
}
|
|
29870
|
+
} : null,
|
|
29789
29871
|
config.oxc !== false ? oxcPlugin(config) : null,
|
|
29790
29872
|
viteJsonPlugin({
|
|
29791
29873
|
...config.json,
|
|
@@ -29799,7 +29881,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
|
|
|
29799
29881
|
viteWasmFallbackPlugin(),
|
|
29800
29882
|
definePlugin(config),
|
|
29801
29883
|
cssPostPlugin(config),
|
|
29802
|
-
|
|
29884
|
+
buildHtmlPlugin(config),
|
|
29803
29885
|
workerImportMetaUrlPlugin(config),
|
|
29804
29886
|
assetImportMetaUrlPlugin(config),
|
|
29805
29887
|
...buildPlugins.pre,
|
|
@@ -29808,11 +29890,9 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
|
|
|
29808
29890
|
...postPlugins,
|
|
29809
29891
|
...buildPlugins.post,
|
|
29810
29892
|
devtoolsIntegrationPlugin,
|
|
29811
|
-
|
|
29812
|
-
|
|
29813
|
-
|
|
29814
|
-
importAnalysisPlugin(config)
|
|
29815
|
-
]
|
|
29893
|
+
clientInjectionsPlugin(config),
|
|
29894
|
+
cssAnalysisPlugin(config),
|
|
29895
|
+
importAnalysisPlugin(config)
|
|
29816
29896
|
].filter(Boolean);
|
|
29817
29897
|
}
|
|
29818
29898
|
async function loadDevToolsIntegrationPlugin(config) {
|
|
@@ -30738,12 +30818,13 @@ async function computeEntries(environment) {
|
|
|
30738
30818
|
}
|
|
30739
30819
|
async function prepareRolldownScanner(environment, entries, deps, missing) {
|
|
30740
30820
|
const { plugins: pluginsFromConfig = [], ...rolldownOptions } = environment.config.optimizeDeps.rolldownOptions ?? {};
|
|
30741
|
-
const plugins = await asyncFlatten(arraify(pluginsFromConfig));
|
|
30742
|
-
plugins.push(...rolldownScanPlugin(environment, deps, missing, entries));
|
|
30743
30821
|
const transformOptions = deepClone(rolldownOptions.transform) ?? {};
|
|
30744
30822
|
if (transformOptions.jsx === void 0) transformOptions.jsx = {};
|
|
30745
30823
|
else if (transformOptions.jsx === "react" || transformOptions.jsx === "react-jsx") transformOptions.jsx = getRollupJsxPresets(transformOptions.jsx);
|
|
30746
30824
|
if (typeof transformOptions.jsx === "object") transformOptions.jsx.development ??= !environment.config.isProduction;
|
|
30825
|
+
const transformSyncJsxOptions = transformOptions.jsx === false ? void 0 : transformOptions.jsx;
|
|
30826
|
+
const plugins = await asyncFlatten(arraify(pluginsFromConfig));
|
|
30827
|
+
plugins.push(...rolldownScanPlugin(environment, deps, missing, entries, transformSyncJsxOptions));
|
|
30747
30828
|
async function build() {
|
|
30748
30829
|
await scan({
|
|
30749
30830
|
...rolldownOptions,
|
|
@@ -30782,7 +30863,7 @@ const typeRE = /\btype\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
|
|
|
30782
30863
|
const langRE = /\blang\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
|
|
30783
30864
|
const svelteScriptModuleRE = /\bcontext\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
|
|
30784
30865
|
const svelteModuleRE = /\smodule\b/i;
|
|
30785
|
-
function rolldownScanPlugin(environment, depImports, missing, entries) {
|
|
30866
|
+
function rolldownScanPlugin(environment, depImports, missing, entries, jsxOptions) {
|
|
30786
30867
|
const seen = /* @__PURE__ */ new Map();
|
|
30787
30868
|
async function resolveId(id, importer, options) {
|
|
30788
30869
|
return environment.pluginContainer.resolveId(id, importer && normalizePath(importer), {
|
|
@@ -30816,6 +30897,7 @@ function rolldownScanPlugin(environment, depImports, missing, entries) {
|
|
|
30816
30897
|
let transpiledContents;
|
|
30817
30898
|
if (loader !== "js") {
|
|
30818
30899
|
const result = transformSync(id, contents, {
|
|
30900
|
+
...jsxOptions !== void 0 ? { jsx: jsxOptions } : {},
|
|
30819
30901
|
lang: loader,
|
|
30820
30902
|
tsconfig: false
|
|
30821
30903
|
});
|
|
@@ -32058,7 +32140,7 @@ const perEnvironmentOrWorkerPlugin = (name, overrideEnvConfig, f) => {
|
|
|
32058
32140
|
};
|
|
32059
32141
|
function oxcResolvePlugin(resolveOptions, overrideEnvConfig) {
|
|
32060
32142
|
return [...resolveOptions.optimizeDeps && !resolveOptions.isBuild ? [optimizerResolvePlugin(resolveOptions)] : [], ...perEnvironmentOrWorkerPlugin("vite:resolve-builtin", overrideEnvConfig, (partialEnv, getEnv) => {
|
|
32061
|
-
const depsOptimizerEnabled = resolveOptions.optimizeDeps && !resolveOptions.isBuild && !partialEnv.config.
|
|
32143
|
+
const depsOptimizerEnabled = resolveOptions.optimizeDeps && !resolveOptions.isBuild && !partialEnv.config.isBundled && !isDepOptimizationDisabled(partialEnv.config.optimizeDeps);
|
|
32062
32144
|
const getDepsOptimizer = () => {
|
|
32063
32145
|
const env = getEnv();
|
|
32064
32146
|
if (env.mode !== "dev") throw new Error("The environment mode should be dev");
|
|
@@ -32143,7 +32225,7 @@ function optimizerResolvePlugin(resolveOptions) {
|
|
|
32143
32225
|
return {
|
|
32144
32226
|
name: "vite:resolve-dev",
|
|
32145
32227
|
applyToEnvironment(environment) {
|
|
32146
|
-
return !environment.config.
|
|
32228
|
+
return !environment.config.isBundled && !isDepOptimizationDisabled(environment.config.optimizeDeps);
|
|
32147
32229
|
},
|
|
32148
32230
|
resolveId: {
|
|
32149
32231
|
filter: { id: { exclude: [
|
|
@@ -32764,9 +32846,9 @@ function prepareOutDirPlugin() {
|
|
|
32764
32846
|
order: "pre",
|
|
32765
32847
|
handler() {
|
|
32766
32848
|
if (rendered.has(this.environment)) return;
|
|
32767
|
-
rendered.add(this.environment);
|
|
32768
32849
|
const { config } = this.environment;
|
|
32769
32850
|
if (config.build.write) {
|
|
32851
|
+
rendered.add(this.environment);
|
|
32770
32852
|
const { root, build: options } = config;
|
|
32771
32853
|
const resolvedOutDirs = getResolvedOutDirs(root, options.outDir, options.rollupOptions.output);
|
|
32772
32854
|
prepareOutDir(resolvedOutDirs, resolveEmptyOutDir(options.emptyOutDir, root, resolvedOutDirs, this.environment.logger), this.environment);
|
|
@@ -32891,12 +32973,15 @@ function resolveBuildPlugins(config) {
|
|
|
32891
32973
|
return {
|
|
32892
32974
|
pre: [
|
|
32893
32975
|
...isBuild && !config.isWorker ? [prepareOutDirPlugin()] : [],
|
|
32894
|
-
perEnvironmentPlugin("vite:rollup-options-plugins", async (environment) =>
|
|
32976
|
+
perEnvironmentPlugin("vite:rollup-options-plugins", async (environment) => {
|
|
32977
|
+
if (!isBuild && !environment.config.isBundled) return false;
|
|
32978
|
+
return (await asyncFlatten(arraify(environment.config.build.rollupOptions.plugins))).filter(Boolean);
|
|
32979
|
+
}),
|
|
32895
32980
|
...config.isWorker ? [webWorkerPostPlugin(config)] : []
|
|
32896
32981
|
],
|
|
32897
32982
|
post: [
|
|
32898
32983
|
...isBuild ? buildImportAnalysisPlugin(config) : [],
|
|
32899
|
-
...config.build.minify === "esbuild" ? [buildEsbuildPlugin()] : [],
|
|
32984
|
+
...isBuild && config.build.minify === "esbuild" ? [buildEsbuildPlugin()] : [],
|
|
32900
32985
|
...isBuild ? [terserPlugin(config)] : [],
|
|
32901
32986
|
...isBuild && !config.isWorker ? [
|
|
32902
32987
|
licensePlugin(),
|
|
@@ -33859,9 +33944,14 @@ function convertEsbuildPluginToRolldownPlugin(esbuildPlugin) {
|
|
|
33859
33944
|
if (!isSetupDone) await setup([{ name: "vite:dep-scan" }], inputOptions.platform ?? "node");
|
|
33860
33945
|
for (const cb of onStartCallbacks) cb();
|
|
33861
33946
|
},
|
|
33862
|
-
generateBundle() {
|
|
33863
|
-
const buildResult = new Proxy({
|
|
33864
|
-
|
|
33947
|
+
generateBundle(_outputOpts, _bundle, isWrite) {
|
|
33948
|
+
const buildResult = new Proxy({
|
|
33949
|
+
metafile: void 0,
|
|
33950
|
+
mangleCache: void 0,
|
|
33951
|
+
...isWrite ? { outputFiles: void 0 } : {}
|
|
33952
|
+
}, { get(_target, prop) {
|
|
33953
|
+
if (prop in _target || typeof prop === "symbol") return _target[prop];
|
|
33954
|
+
throw new Error("Not implemented property: " + prop);
|
|
33865
33955
|
} });
|
|
33866
33956
|
for (const cb of onEndCallbacks) cb(buildResult);
|
|
33867
33957
|
},
|
|
@@ -34090,9 +34180,11 @@ function resolveDevEnvironmentOptions(dev, environmentName, consumer, preTransfo
|
|
|
34090
34180
|
sourcemapIgnoreList: resolved.sourcemapIgnoreList === false ? () => false : resolved.sourcemapIgnoreList
|
|
34091
34181
|
};
|
|
34092
34182
|
}
|
|
34093
|
-
function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimizeDeps, logger, environmentName, isBundledDev, isSsrTargetWebworkerSet, preTransformRequests) {
|
|
34094
|
-
const
|
|
34183
|
+
function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimizeDeps, logger, environmentName, isBuild, isBundledDev, isSsrTargetWebworkerSet, preTransformRequests) {
|
|
34184
|
+
const isClientEnvironment = environmentName === "client";
|
|
34185
|
+
const consumer = options.consumer ?? (isClientEnvironment ? "client" : "server");
|
|
34095
34186
|
const isSsrTargetWebworkerEnvironment = isSsrTargetWebworkerSet && environmentName === "ssr";
|
|
34187
|
+
const isBundled = options.isBundled ?? (isBuild || isClientEnvironment && isBundledDev);
|
|
34096
34188
|
if (options.define?.["process.env"]) {
|
|
34097
34189
|
const processEnvDefine = options.define["process.env"];
|
|
34098
34190
|
if (typeof processEnvDefine === "object") {
|
|
@@ -34108,7 +34200,8 @@ function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimi
|
|
|
34108
34200
|
consumer,
|
|
34109
34201
|
optimizeDeps: resolveDepOptimizationOptions(options.optimizeDeps, resolve.preserveSymlinks, forceOptimizeDeps, consumer, logger),
|
|
34110
34202
|
dev: resolveDevEnvironmentOptions(options.dev, environmentName, consumer, preTransformRequests),
|
|
34111
|
-
build: resolveBuildEnvironmentOptions(options.build ?? {}, logger, consumer,
|
|
34203
|
+
build: resolveBuildEnvironmentOptions(options.build ?? {}, logger, consumer, isBundled && !isBuild, isSsrTargetWebworkerEnvironment),
|
|
34204
|
+
isBundled,
|
|
34112
34205
|
plugins: void 0,
|
|
34113
34206
|
optimizeDepsPluginNames: void 0
|
|
34114
34207
|
};
|
|
@@ -34349,7 +34442,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
34349
34442
|
config.resolve.mainFields = config.environments.client.resolve?.mainFields;
|
|
34350
34443
|
const resolvedDefaultResolve = resolveResolveOptions(config.resolve, logger);
|
|
34351
34444
|
const resolvedEnvironments = {};
|
|
34352
|
-
for (const environmentName of Object.keys(config.environments)) resolvedEnvironments[environmentName] = resolveEnvironmentOptions(config.environments[environmentName], resolvedDefaultResolve.alias, resolvedDefaultResolve.preserveSymlinks, inlineConfig.forceOptimizeDeps, logger, environmentName, isBundledDev, config.ssr?.target === "webworker", config.server?.preTransformRequests);
|
|
34445
|
+
for (const environmentName of Object.keys(config.environments)) resolvedEnvironments[environmentName] = resolveEnvironmentOptions(config.environments[environmentName], resolvedDefaultResolve.alias, resolvedDefaultResolve.preserveSymlinks, inlineConfig.forceOptimizeDeps, logger, environmentName, isBuild, isBundledDev, config.ssr?.target === "webworker", config.server?.preTransformRequests);
|
|
34353
34446
|
const backwardCompatibleOptimizeDeps = resolvedEnvironments.client.optimizeDeps;
|
|
34354
34447
|
const resolvedDevEnvironmentOptions = resolveDevEnvironmentOptions(config.dev, void 0, void 0);
|
|
34355
34448
|
const resolvedBuildOptions = resolveBuildEnvironmentOptions(config.build ?? {}, logger, void 0, isBundledDev);
|
|
@@ -34449,7 +34542,6 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
|
|
|
34449
34542
|
cacheDir,
|
|
34450
34543
|
command,
|
|
34451
34544
|
mode,
|
|
34452
|
-
isBundled: config.experimental?.bundledDev || isBuild,
|
|
34453
34545
|
isWorker: false,
|
|
34454
34546
|
mainConfig: null,
|
|
34455
34547
|
bundleChain: [],
|