vite 8.0.11 → 8.0.13

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.
@@ -8,7 +8,7 @@ let nanoid = (size = 21) => {
8
8
  return id;
9
9
  };
10
10
  //#endregion
11
- //#region \0@oxc-project+runtime@0.128.0/helpers/typeof.js
11
+ //#region \0@oxc-project+runtime@0.130.0/helpers/typeof.js
12
12
  function _typeof(o) {
13
13
  "@babel/helpers - typeof";
14
14
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -18,7 +18,7 @@ function _typeof(o) {
18
18
  }, _typeof(o);
19
19
  }
20
20
  //#endregion
21
- //#region \0@oxc-project+runtime@0.128.0/helpers/toPrimitive.js
21
+ //#region \0@oxc-project+runtime@0.130.0/helpers/toPrimitive.js
22
22
  function toPrimitive(t, r) {
23
23
  if ("object" != _typeof(t) || !t) return t;
24
24
  var e = t[Symbol.toPrimitive];
@@ -30,13 +30,13 @@ function toPrimitive(t, r) {
30
30
  return ("string" === r ? String : Number)(t);
31
31
  }
32
32
  //#endregion
33
- //#region \0@oxc-project+runtime@0.128.0/helpers/toPropertyKey.js
33
+ //#region \0@oxc-project+runtime@0.130.0/helpers/toPropertyKey.js
34
34
  function toPropertyKey(t) {
35
35
  var i = toPrimitive(t, "string");
36
36
  return "symbol" == _typeof(i) ? i : i + "";
37
37
  }
38
38
  //#endregion
39
- //#region \0@oxc-project+runtime@0.128.0/helpers/defineProperty.js
39
+ //#region \0@oxc-project+runtime@0.130.0/helpers/defineProperty.js
40
40
  function _defineProperty(e, r, t) {
41
41
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
42
42
  value: t,
@@ -1218,20 +1218,30 @@ if (isBundleMode && typeof DevRuntime !== "undefined") {
1218
1218
  }
1219
1219
  applyUpdates(_boundaries) {}
1220
1220
  }
1221
- const wrappedSocket = { send(message) {
1221
+ const clientId = nanoid();
1222
+ transport.send({
1223
+ type: "custom",
1224
+ event: "vite:module-loaded",
1225
+ data: {
1226
+ modules: [],
1227
+ clientId
1228
+ }
1229
+ });
1230
+ (_ref = globalThis).__rolldown_runtime__ ?? (_ref.__rolldown_runtime__ = new ViteDevRuntime({ send(message) {
1222
1231
  switch (message.type) {
1223
1232
  case "hmr:module-registered":
1224
1233
  transport.send({
1225
1234
  type: "custom",
1226
1235
  event: "vite:module-loaded",
1227
- data: { modules: message.modules.slice() }
1236
+ data: {
1237
+ modules: message.modules.slice(),
1238
+ clientId
1239
+ }
1228
1240
  });
1229
1241
  break;
1230
1242
  default: throw new Error(`Unknown message type: ${JSON.stringify(message)}`);
1231
1243
  }
1232
- } };
1233
- const clientId = nanoid();
1234
- (_ref = globalThis).__rolldown_runtime__ ?? (_ref.__rolldown_runtime__ = new ViteDevRuntime(wrappedSocket, clientId));
1244
+ } }, clientId));
1235
1245
  }
1236
1246
  //#endregion
1237
1247
  export { ErrorOverlay, createHotContext, injectQuery, removeStyle, updateStyle };
@@ -1,4 +1,4 @@
1
- import { i as __require, t as __commonJSMin } from "./chunk.js";
1
+ import { H as __require, z as __commonJSMin } from "./logger.js";
2
2
  import { t as require_lib } from "./lib.js";
3
3
  //#region ../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.14/node_modules/postcss-modules/build/fs.js
4
4
  var require_fs = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -1,4 +1,4 @@
1
- import { t as __commonJSMin } from "./chunk.js";
1
+ import { z as __commonJSMin } from "./logger.js";
2
2
  //#region ../../node_modules/.pnpm/postcss-value-parser@4.2.0/node_modules/postcss-value-parser/lib/parse.js
3
3
  var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
4
  var openParentheses = "(".charCodeAt(0);
@@ -1,8 +1,43 @@
1
- import { o as __toESM, t as __commonJSMin } from "./chunk.js";
1
+ import { createRequire } from "node:module";
2
2
  import { readFileSync } from "node:fs";
3
3
  import path, { resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import readline from "node:readline";
6
+ //#region \0rolldown/runtime.js
7
+ var __create = Object.create;
8
+ var __defProp = Object.defineProperty;
9
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
+ var __getOwnPropNames = Object.getOwnPropertyNames;
11
+ var __getProtoOf = Object.getPrototypeOf;
12
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
13
+ var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
14
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
15
+ var __exportAll = (all, no_symbols) => {
16
+ let target = {};
17
+ for (var name in all) __defProp(target, name, {
18
+ get: all[name],
19
+ enumerable: true
20
+ });
21
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
22
+ return target;
23
+ };
24
+ var __copyProps = (to, from, except, desc) => {
25
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
26
+ key = keys[i];
27
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
28
+ get: ((k) => from[k]).bind(null, key),
29
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
30
+ });
31
+ }
32
+ return to;
33
+ };
34
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
35
+ value: mod,
36
+ enumerable: true
37
+ }) : target, mod));
38
+ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
39
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
40
+ //#endregion
6
41
  //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
7
42
  var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
8
43
  let p = process || {}, argv = p.argv || [], env = p.env || {};
@@ -319,4 +354,4 @@ function printServerUrls(urls, optionsHost, info) {
319
354
  if (urls.network.length === 0 && optionsHost === void 0) info(import_picocolors.default.dim(` ${import_picocolors.default.green("➜")} ${import_picocolors.default.bold("Network")}: use `) + import_picocolors.default.bold("--host") + import_picocolors.default.dim(" to expose"));
320
355
  }
321
356
  //#endregion
322
- export { OPTIMIZABLE_ENTRY_RE as A, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR as C, JS_TYPES_RE as D, FS_PREFIX as E, defaultAllowedOrigins as F, loopbackHosts as I, wildcardHosts as L, SPECIAL_QUERY_RE as M, VERSION as N, KNOWN_ASSET_TYPES as O, VITE_PACKAGE_DIR as P, require_picocolors as R, ENV_PUBLIC_PATH as S, ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET as T, DEFAULT_SERVER_CONDITIONS as _, CLIENT_ENTRY as a, DEV_PROD_CONDITION as b, DEFAULT_ASSETS_INLINE_LIMIT as c, DEFAULT_CLIENT_MAIN_FIELDS as d, DEFAULT_CONFIG_FILES as f, DEFAULT_PREVIEW_PORT as g, DEFAULT_EXTERNAL_CONDITIONS as h, CLIENT_DIR as i, ROLLUP_HOOKS as j, METADATA_FILENAME as k, DEFAULT_ASSETS_RE as l, DEFAULT_EXTENSIONS as m, createLogger as n, CLIENT_PUBLIC_PATH as o, DEFAULT_DEV_PORT as p, printServerUrls as r, CSS_LANGS_RE as s, LogLevels as t, DEFAULT_CLIENT_CONDITIONS as u, DEFAULT_SERVER_MAIN_FIELDS as v, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR as w, ENV_ENTRY as x, DEP_VERSION_RE as y };
357
+ export { OPTIMIZABLE_ENTRY_RE as A, __esmMin as B, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR as C, JS_TYPES_RE as D, FS_PREFIX as E, defaultAllowedOrigins as F, __require as H, loopbackHosts as I, wildcardHosts as L, SPECIAL_QUERY_RE as M, VERSION as N, KNOWN_ASSET_TYPES as O, VITE_PACKAGE_DIR as P, require_picocolors as R, ENV_PUBLIC_PATH as S, ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET as T, __toCommonJS as U, __exportAll as V, __toESM as W, DEFAULT_SERVER_CONDITIONS as _, CLIENT_ENTRY as a, DEV_PROD_CONDITION as b, DEFAULT_ASSETS_INLINE_LIMIT as c, DEFAULT_CLIENT_MAIN_FIELDS as d, DEFAULT_CONFIG_FILES as f, DEFAULT_PREVIEW_PORT as g, DEFAULT_EXTERNAL_CONDITIONS as h, CLIENT_DIR as i, ROLLUP_HOOKS as j, METADATA_FILENAME as k, DEFAULT_ASSETS_RE as l, DEFAULT_EXTENSIONS as m, createLogger as n, CLIENT_PUBLIC_PATH as o, DEFAULT_DEV_PORT as p, printServerUrls as r, CSS_LANGS_RE as s, LogLevels as t, DEFAULT_CLIENT_CONDITIONS as u, DEFAULT_SERVER_MAIN_FIELDS as v, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR as w, ENV_ENTRY as x, DEP_VERSION_RE as y, __commonJSMin as z };
@@ -1,5 +1,4 @@
1
- import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "./chunk.js";
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, { randomUUID } from "node: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";
@@ -3361,21 +3360,6 @@ function shouldSkipWarning(warning) {
3361
3360
  return false;
3362
3361
  }
3363
3362
  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
3363
  const { jsxInject, include, exclude, jsxRefreshInclude, jsxRefreshExclude, ...oxcTransformOptions } = config.oxc;
3380
3364
  const filter = createFilter$1(include || /\.(m?ts|[jt]sx)$/, exclude || /\.js$/);
3381
3365
  const jsxRefreshFilter = jsxRefreshInclude || jsxRefreshExclude ? createFilter$1(jsxRefreshInclude, jsxRefreshExclude) : void 0;
@@ -3400,6 +3384,24 @@ function oxcPlugin(config) {
3400
3384
  let server;
3401
3385
  return {
3402
3386
  name: "vite:oxc",
3387
+ applyToEnvironment(environment) {
3388
+ if (environment.config.isBundled) {
3389
+ const { jsxInject, include = /\.(m?ts|[jt]sx)$/, exclude = /\.js$/, jsxRefreshInclude, jsxRefreshExclude, ..._transformOptions } = environment.config.oxc;
3390
+ const transformOptions = _transformOptions;
3391
+ transformOptions.sourcemap = environment.config.mode !== "build" || !!environment.config.build.sourcemap;
3392
+ return viteTransformPlugin({
3393
+ root: environment.config.root,
3394
+ include,
3395
+ exclude,
3396
+ jsxRefreshInclude,
3397
+ jsxRefreshExclude,
3398
+ isServerConsumer: environment.config.consumer === "server",
3399
+ jsxInject,
3400
+ transformOptions
3401
+ });
3402
+ }
3403
+ return true;
3404
+ },
3403
3405
  configureServer(_server) {
3404
3406
  server = _server;
3405
3407
  },
@@ -4453,6 +4455,7 @@ function optimizedDepsPlugin() {
4453
4455
  return {
4454
4456
  name: "vite:optimized-deps",
4455
4457
  applyToEnvironment(environment) {
4458
+ if (environment.config.isBundled) return false;
4456
4459
  return !isDepOptimizationDisabled(environment.config.optimizeDeps);
4457
4460
  },
4458
4461
  resolveId(id) {
@@ -10826,6 +10829,7 @@ async function instantiateModule(url, runner, environment, fixStacktrace) {
10826
10829
  }
10827
10830
  }
10828
10831
  var SSRCompatModuleRunner = class extends ModuleRunner {
10832
+ environment;
10829
10833
  constructor(environment) {
10830
10834
  super({
10831
10835
  transport: createServerModuleRunnerTransport({ channel: environment.hot }),
@@ -11360,6 +11364,7 @@ function isRefIdentifier(id, parent, parentStack) {
11360
11364
  if (isNodeInPattern(parent) && parent.value === id) return false;
11361
11365
  if (parent.type === "ArrayPattern" && !isInDestructuringAssignment(parent, parentStack)) return false;
11362
11366
  if (parent.type === "MemberExpression" && parent.property === id && !parent.computed) return false;
11367
+ if ((parent.type === "LabeledStatement" || parent.type === "BreakStatement" || parent.type === "ContinueStatement") && parent.label === id) return false;
11363
11368
  if (parent.type === "MetaProperty") return false;
11364
11369
  if (parent.type === "ExportSpecifier" || parent.type === "ExportAllDeclaration") return false;
11365
11370
  if (id.name === "arguments") return false;
@@ -12457,6 +12462,7 @@ function convertToWatcherOptions(options) {
12457
12462
  };
12458
12463
  }
12459
12464
  var NoopWatcher = class extends EventEmitter {
12465
+ options;
12460
12466
  constructor(options) {
12461
12467
  super();
12462
12468
  this.options = options;
@@ -19163,7 +19169,7 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
19163
19169
  source: content
19164
19170
  });
19165
19171
  if (environment.config.command === "build" && noInlineRE.test(postfix)) postfix = postfix.replace(noInlineRE, "").replace(/^&/, "?");
19166
- if (environment.config.command === "serve" && environment.config.experimental.bundledDev) url = toOutputFilePathInJSForBundledDev(environment, pluginContext.getFileName(referenceId));
19172
+ if (environment.config.command === "serve" && environment.config.isBundled) url = toOutputFilePathInJSForBundledDev(environment, pluginContext.getFileName(referenceId));
19167
19173
  else url = `__VITE_ASSET__${referenceId}__${postfix ? `$_${postfix}__` : ``}`;
19168
19174
  }
19169
19175
  cache.set(id, url);
@@ -20424,8 +20430,8 @@ function cssPlugin(config) {
20424
20430
  preprocessorWorkerController = createPreprocessorWorkerController(normalizeMaxWorkers(config.css.preprocessorMaxWorkers));
20425
20431
  preprocessorWorkerControllerCache.set(config, preprocessorWorkerController);
20426
20432
  },
20427
- buildEnd() {
20428
- preprocessorWorkerController?.close();
20433
+ async buildEnd() {
20434
+ await preprocessorWorkerController?.close();
20429
20435
  },
20430
20436
  load: {
20431
20437
  filter: { id: CSS_LANGS_RE },
@@ -20496,7 +20502,9 @@ function cssPostPlugin(config) {
20496
20502
  else if (typeof assetFileNames === "string") return path.join(path.dirname(assetFileNames), cssAssetNameDir);
20497
20503
  else return path.dirname(assetFileNames({
20498
20504
  type: "asset",
20505
+ name: cssAssetName,
20499
20506
  names: [cssAssetName],
20507
+ originalFileName,
20500
20508
  originalFileNames: originalFileName ? [originalFileName] : [],
20501
20509
  source: "/* vite internal call, ignore */"
20502
20510
  }));
@@ -20553,7 +20561,7 @@ function cssPostPlugin(config) {
20553
20561
  const cssContent = await getContentWithSourcemap(css);
20554
20562
  return {
20555
20563
  code: [
20556
- 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))}`,
20564
+ 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))}`,
20557
20565
  `const __vite__id = ${JSON.stringify(id)}`,
20558
20566
  `const __vite__css = ${JSON.stringify(cssContent)}`,
20559
20567
  `__vite__updateStyle(__vite__id, __vite__css)`,
@@ -20808,6 +20816,9 @@ function injectInlinedCSS(s, ctx, code, format, injectCode) {
20808
20816
  function cssAnalysisPlugin(config) {
20809
20817
  return {
20810
20818
  name: "vite:css-analysis",
20819
+ applyToEnvironment(environment) {
20820
+ return !environment.config.isBundled;
20821
+ },
20811
20822
  transform: {
20812
20823
  filter: { id: {
20813
20824
  include: CSS_LANGS_RE,
@@ -21467,8 +21478,8 @@ const scssProcessor = (maxWorkers) => {
21467
21478
  let failedSassEmbedded;
21468
21479
  const normalizedErrors = /* @__PURE__ */ new WeakSet();
21469
21480
  return {
21470
- close() {
21471
- worker?.stop();
21481
+ async close() {
21482
+ await worker?.stop();
21472
21483
  },
21473
21484
  async process(environment, source, root, options, resolvers) {
21474
21485
  let sassPackage = loadSassPackage(root, failedSassEmbedded ?? false);
@@ -21764,10 +21775,12 @@ const createPreprocessorWorkerController = (maxWorkers) => {
21764
21775
  opts.syntax = "indented";
21765
21776
  return scss.process(environment, source, root, opts, resolvers);
21766
21777
  };
21767
- const close = () => {
21768
- less.close();
21769
- scss.close();
21770
- styl.close();
21778
+ const close = async () => {
21779
+ await Promise.all([
21780
+ less.close(),
21781
+ scss.close(),
21782
+ styl.close()
21783
+ ]);
21771
21784
  };
21772
21785
  return {
21773
21786
  ["less"]: less.process,
@@ -22065,12 +22078,13 @@ function resolveLibCssFilename(libOptions, root, packageCache) {
22065
22078
  //#region src/node/plugins/modulePreloadPolyfill.ts
22066
22079
  const modulePreloadPolyfillId = "vite/modulepreload-polyfill";
22067
22080
  const resolvedModulePreloadPolyfillId = "\0" + modulePreloadPolyfillId + ".js";
22068
- function modulePreloadPolyfillPlugin(config) {
22069
- if (config.isBundled) return perEnvironmentPlugin("native:modulepreload-polyfill", (environment) => {
22070
- return viteModulePreloadPolyfillPlugin({ isServer: environment.config.consumer !== "client" });
22071
- });
22081
+ function modulePreloadPolyfillPlugin() {
22072
22082
  return {
22073
22083
  name: "vite:modulepreload-polyfill",
22084
+ applyToEnvironment(environment) {
22085
+ if (environment.config.isBundled) return viteModulePreloadPolyfillPlugin({ isServer: environment.config.consumer !== "client" });
22086
+ return true;
22087
+ },
22074
22088
  resolveId: {
22075
22089
  filter: { id: exactRegex(modulePreloadPolyfillId) },
22076
22090
  handler(_id) {
@@ -22278,6 +22292,9 @@ function buildHtmlPlugin(config) {
22278
22292
  isAsyncScriptMap.set(config, /* @__PURE__ */ new Map());
22279
22293
  return {
22280
22294
  name: "vite:build-html",
22295
+ applyToEnvironment(environment) {
22296
+ return environment.config.isBundled;
22297
+ },
22281
22298
  transform: {
22282
22299
  filter: { id: /\.html$/ },
22283
22300
  async handler(html, id) {
@@ -22835,7 +22852,6 @@ const nonJsRe = /\.json(?:$|\?)/;
22835
22852
  const isNonJsRequest = (request) => nonJsRe.test(request);
22836
22853
  const escapedDotRE = /(?<!\\)\\./g;
22837
22854
  function definePlugin(config) {
22838
- const isBundled = config.isBundled;
22839
22855
  const isBuild = config.command === "build";
22840
22856
  const isBuildLib = isBuild && config.build.lib;
22841
22857
  const processEnv = {};
@@ -22850,21 +22866,22 @@ function definePlugin(config) {
22850
22866
  "globalThis.process.env.NODE_ENV": JSON.stringify(nodeEnv)
22851
22867
  });
22852
22868
  }
22853
- const importMetaKeys = {};
22854
- const importMetaEnvKeys = {};
22855
- const importMetaFallbackKeys = {};
22856
- if (isBuild) importMetaKeys["import.meta.hot"] = `undefined`;
22857
- if (isBundled) {
22858
- for (const key in config.env) {
22859
- const val = JSON.stringify(config.env[key]);
22860
- importMetaKeys[`import.meta.env.${key}`] = val;
22861
- importMetaEnvKeys[key] = val;
22862
- }
22863
- importMetaKeys["import.meta.env.SSR"] = `undefined`;
22864
- importMetaFallbackKeys["import.meta.env"] = `undefined`;
22865
- }
22866
22869
  function generatePattern(environment) {
22870
+ const isBundled = environment.config.isBundled;
22867
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
+ }
22868
22885
  const userDefine = {};
22869
22886
  const userDefineEnv = {};
22870
22887
  for (const key in environment.config.define) {
@@ -22902,21 +22919,24 @@ function definePlugin(config) {
22902
22919
  }
22903
22920
  return pattern;
22904
22921
  }
22905
- if (isBundled) return {
22906
- name: "vite:define",
22907
- options(option) {
22908
- const [define, _pattern, importMetaEnvVal] = getPattern(this.environment);
22909
- define["import.meta.env"] = importMetaEnvVal;
22910
- define["import.meta.env.*"] = "undefined";
22911
- option.transform ??= {};
22912
- option.transform.define = {
22913
- ...option.transform.define,
22914
- ...define
22915
- };
22916
- }
22917
- };
22918
22922
  return {
22919
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
+ },
22920
22940
  transform: { handler(code, id) {
22921
22941
  if (this.environment.config.consumer === "client") return;
22922
22942
  if (isHTMLRequest(id) || isCSSRequest(id) || isNonJsRequest(id) || config.assetsInclude(id)) return;
@@ -22982,6 +23002,9 @@ function clientInjectionsPlugin(config) {
22982
23002
  });
22983
23003
  return {
22984
23004
  name: "vite:client-inject",
23005
+ applyToEnvironment(environment) {
23006
+ return !environment.config.isBundled;
23007
+ },
22985
23008
  async buildStart() {
22986
23009
  injectConfigValues = await createClientConfigValueReplacer(config);
22987
23010
  },
@@ -24906,6 +24929,7 @@ var MemoryFiles = class {
24906
24929
  };
24907
24930
  var FullBundleDevEnvironment = class extends DevEnvironment {
24908
24931
  devEngine;
24932
+ initialBuildCompleted = false;
24909
24933
  clients = new Clients();
24910
24934
  invalidateCalledModules = /* @__PURE__ */ new Map();
24911
24935
  debouncedFullReload = debounce(20, () => {
@@ -24930,8 +24954,8 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
24930
24954
  if (Array.isArray(rollupOptions.output) && rollupOptions.output.length > 1) throw new Error("multiple output options are not supported in dev mode");
24931
24955
  const outputOptions = Array.isArray(rollupOptions.output) ? rollupOptions.output[0] : rollupOptions.output;
24932
24956
  this.hot.on("vite:module-loaded", (payload, client) => {
24933
- const clientId = this.clients.setupIfNeeded(client);
24934
- this.devEngine.registerModules(clientId, payload.modules);
24957
+ this.clients.setupIfNeeded(client, payload.clientId);
24958
+ this.devEngine.registerModules(payload.clientId, payload.modules);
24935
24959
  });
24936
24960
  this.hot.on("vite:client:disconnect", (_payload, client) => {
24937
24961
  const clientId = this.clients.delete(client);
@@ -24991,6 +25015,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
24991
25015
  type: "full-reload",
24992
25016
  path: "*"
24993
25017
  });
25018
+ this.initialBuildCompleted = true;
24994
25019
  });
24995
25020
  }
24996
25021
  async waitForInitialBuildFinish() {
@@ -25028,7 +25053,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
25028
25053
  }
25029
25054
  async triggerBundleRegenerationIfStale() {
25030
25055
  const bundleState = await this.devEngine.getBundleState();
25031
- const shouldTrigger = bundleState.hasStaleOutput && !bundleState.lastFullBuildFailed;
25056
+ const shouldTrigger = bundleState.hasStaleOutput && !bundleState.lastFullBuildFailed && this.initialBuildCompleted;
25032
25057
  if (shouldTrigger) {
25033
25058
  this.devEngine.ensureLatestBuildOutput().then(() => {
25034
25059
  this.debouncedFullReload();
@@ -25037,15 +25062,25 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
25037
25062
  }
25038
25063
  return shouldTrigger;
25039
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
+ }
25040
25070
  async close() {
25041
25071
  this.memoryFiles.clear();
25042
25072
  await Promise.all([super.close(), this.devEngine.close()]);
25073
+ this.initialBuildCompleted = false;
25043
25074
  }
25044
25075
  async getRolldownOptions() {
25045
25076
  const chunkMetadataMap = new ChunkMetadataMap();
25046
25077
  const rolldownOptions = resolveRolldownOptions(this, chunkMetadataMap);
25047
25078
  rolldownOptions.experimental ??= {};
25048
- rolldownOptions.experimental.devMode = { implement: await getHmrImplementation(this.getTopLevelConfig()) };
25079
+ rolldownOptions.experimental.devMode = {
25080
+ lazy: true,
25081
+ ...typeof rolldownOptions.experimental.devMode === "object" ? rolldownOptions.experimental.devMode : {},
25082
+ implement: await getHmrImplementation(this.getTopLevelConfig())
25083
+ };
25049
25084
  rolldownOptions.optimization ??= {};
25050
25085
  rolldownOptions.optimization.inlineConst = false;
25051
25086
  if (Array.isArray(rolldownOptions.output)) for (const output of rolldownOptions.output) {
@@ -25111,13 +25146,11 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
25111
25146
  var Clients = class {
25112
25147
  clientToId = /* @__PURE__ */ new Map();
25113
25148
  idToClient = /* @__PURE__ */ new Map();
25114
- setupIfNeeded(client) {
25149
+ setupIfNeeded(client, clientId) {
25115
25150
  const id = this.clientToId.get(client);
25116
- if (id) return id;
25117
- const newId = randomUUID();
25118
- this.clientToId.set(client, newId);
25119
- this.idToClient.set(newId, client);
25120
- 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);
25121
25154
  }
25122
25155
  get(id) {
25123
25156
  return this.idToClient.get(id);
@@ -25983,6 +26016,27 @@ function memoryFilesMiddleware(server) {
25983
26016
  };
25984
26017
  }
25985
26018
  //#endregion
26019
+ //#region src/node/server/middlewares/triggerLazyBundling.ts
26020
+ function triggerLazyBundlingMiddleware(server) {
26021
+ const environment = server.environments.client instanceof FullBundleDevEnvironment ? server.environments.client : void 0;
26022
+ if (!environment) throw new Error("triggerLazyBundlingMiddleware can only be used for fullBundleMode");
26023
+ return async function viteTriggerLazyBundlingMiddleware(req, res, next) {
26024
+ if (!req.url?.startsWith("/@vite/lazy?")) return next();
26025
+ let params;
26026
+ try {
26027
+ params = new URL(`http://localhost${req.url}`).searchParams;
26028
+ } catch {
26029
+ return next();
26030
+ }
26031
+ const moduleId = params.get("id");
26032
+ const clientId = params.get("clientId");
26033
+ const code = await environment.triggerLazyBundling(moduleId, clientId);
26034
+ if (code == null) return next();
26035
+ res.setHeader("Content-Type", "application/javascript");
26036
+ return res.end(code);
26037
+ };
26038
+ }
26039
+ //#endregion
25986
26040
  //#region src/node/server/index.ts
25987
26041
  var server_exports = /* @__PURE__ */ __exportAll({
25988
26042
  _createServer: () => _createServer,
@@ -26280,8 +26334,10 @@ async function _createServer(inlineConfig = {}, options) {
26280
26334
  else next();
26281
26335
  });
26282
26336
  if (publicDir) middlewares.use(servePublicMiddleware(server, publicFiles));
26283
- if (config.experimental.bundledDev) middlewares.use(memoryFilesMiddleware(server));
26284
- else {
26337
+ if (config.experimental.bundledDev) {
26338
+ middlewares.use(triggerLazyBundlingMiddleware(server));
26339
+ middlewares.use(memoryFilesMiddleware(server));
26340
+ } else {
26285
26341
  middlewares.use(transformMiddleware(server));
26286
26342
  middlewares.use(serveRawFsMiddleware(server));
26287
26343
  middlewares.use(serveStaticMiddleware(server));
@@ -27160,6 +27216,7 @@ async function bundleWorkerEntry(config, id) {
27160
27216
  const workerEnvironment = new BuildEnvironment("client", await plugins(newBundleChain));
27161
27217
  await workerEnvironment.init();
27162
27218
  const chunkMetadataMap = new ChunkMetadataMap();
27219
+ const workerBuildTarget = workerEnvironment.config.build.target;
27163
27220
  const bundle = await rolldown({
27164
27221
  ...rollupOptions,
27165
27222
  input,
@@ -27167,6 +27224,14 @@ async function bundleWorkerEntry(config, id) {
27167
27224
  onLog(level, log) {
27168
27225
  onRollupLog(level, log, workerEnvironment);
27169
27226
  },
27227
+ transform: {
27228
+ target: workerBuildTarget === false ? void 0 : workerBuildTarget,
27229
+ ...rollupOptions.transform,
27230
+ define: {
27231
+ ...rollupOptions.transform?.define,
27232
+ "process.env.NODE_ENV": "process.env.NODE_ENV"
27233
+ }
27234
+ },
27170
27235
  moduleTypes: {
27171
27236
  ".css": "js",
27172
27237
  ...rollupOptions.moduleTypes
@@ -27225,12 +27290,16 @@ async function workerFileToUrl(config, id) {
27225
27290
  }, config.logger);
27226
27291
  return bundle;
27227
27292
  }
27228
- function webWorkerPostPlugin(config) {
27229
- if (config.isBundled) return perEnvironmentPlugin("native:web-worker-post-plugin", (environment) => {
27230
- if (environment.config.worker.format === "iife") return viteWebWorkerPostPlugin();
27231
- });
27293
+ function webWorkerPostPlugin(_config) {
27232
27294
  return {
27233
27295
  name: "vite:worker-post",
27296
+ applyToEnvironment(environment) {
27297
+ if (environment.config.isBundled) {
27298
+ if (environment.config.worker.format === "iife") return viteWebWorkerPostPlugin();
27299
+ return false;
27300
+ }
27301
+ return true;
27302
+ },
27234
27303
  transform: {
27235
27304
  filter: { code: "import.meta" },
27236
27305
  order: "post",
@@ -27287,13 +27356,14 @@ function webWorkerPlugin(config) {
27287
27356
  if (!workerMatch) return;
27288
27357
  const { format } = config.worker;
27289
27358
  const workerConstructor = workerMatch[1] === "sharedworker" ? "SharedWorker" : "Worker";
27290
- const workerType = config.isBundled ? format === "es" ? "module" : "classic" : "module";
27359
+ const isBundled = this.environment.config.isBundled;
27360
+ const workerType = isBundled ? format === "es" ? "module" : "classic" : "module";
27291
27361
  const workerTypeOption = `{
27292
27362
  ${workerType === "module" ? `type: "module",` : ""}
27293
27363
  name: options?.name
27294
27364
  }`;
27295
27365
  let urlCode;
27296
- if (config.isBundled) if (isWorker && config.bundleChain.at(-1) === cleanUrl(id)) urlCode = "self.location.href";
27366
+ if (isBundled) if (isWorker && config.bundleChain.at(-1) === cleanUrl(id)) urlCode = "self.location.href";
27297
27367
  else if (inlineRE.test(id)) {
27298
27368
  const result = await bundleWorkerEntry(config, id);
27299
27369
  for (const file of result.watchedFiles) this.addWatchFile(file);
@@ -27330,7 +27400,7 @@ function webWorkerPlugin(config) {
27330
27400
  } else {
27331
27401
  const result = await workerFileToUrl(config, id);
27332
27402
  let url;
27333
- if (this.environment.config.command === "serve" && this.environment.config.experimental.bundledDev) url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
27403
+ if (this.environment.config.command === "serve" && this.environment.config.isBundled) url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
27334
27404
  else url = result.entryUrlPlaceholder;
27335
27405
  urlCode = JSON.stringify(url);
27336
27406
  for (const file of result.watchedFiles) this.addWatchFile(file);
@@ -27364,7 +27434,7 @@ function webWorkerPlugin(config) {
27364
27434
  let injectEnv = "";
27365
27435
  if (workerType === "classic") injectEnv = `importScripts(${JSON.stringify(path.posix.join(config.base, ENV_PUBLIC_PATH))})\n`;
27366
27436
  else if (workerType === "module") injectEnv = `import ${JSON.stringify(ENV_PUBLIC_PATH)}\n`;
27367
- else if (workerType === "ignore") if (config.isBundled) injectEnv = "";
27437
+ else if (workerType === "ignore") if (this.environment.config.isBundled) injectEnv = "";
27368
27438
  else {
27369
27439
  const environment = this.environment;
27370
27440
  injectEnv = ((environment.mode === "dev" ? environment.moduleGraph : void 0)?.getModuleById(ENV_ENTRY))?.transformResult?.code || "";
@@ -27448,6 +27518,7 @@ function preAliasPlugin(config) {
27448
27518
  return {
27449
27519
  name: "vite:pre-alias",
27450
27520
  applyToEnvironment(environment) {
27521
+ if (environment.config.isBundled) return false;
27451
27522
  return !isDepOptimizationDisabled(environment.config.optimizeDeps);
27452
27523
  },
27453
27524
  async resolveId(id, importer, options) {
@@ -27594,6 +27665,9 @@ function importAnalysisPlugin(config) {
27594
27665
  }
27595
27666
  return {
27596
27667
  name: "vite:import-analysis",
27668
+ applyToEnvironment(environment) {
27669
+ return !environment.config.isBundled;
27670
+ },
27597
27671
  async transform(source, importer) {
27598
27672
  const environment = this.environment;
27599
27673
  const ssr = environment.config.consumer === "server";
@@ -28083,7 +28157,6 @@ async function getWorkerType(raw, clean, i) {
28083
28157
  }
28084
28158
  const workerImportMetaUrlRE = /\bnew\s+(?:Worker|SharedWorker)\s*\(\s*(new\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*(?:,\s*)?\))/dg;
28085
28159
  function workerImportMetaUrlPlugin(config) {
28086
- const isBundled = config.isBundled;
28087
28160
  let workerResolver;
28088
28161
  const fsResolveOptions = {
28089
28162
  ...config.resolve,
@@ -28101,6 +28174,7 @@ function workerImportMetaUrlPlugin(config) {
28101
28174
  transform: {
28102
28175
  filter: { code: workerImportMetaUrlRE },
28103
28176
  async handler(code, id) {
28177
+ const isBundled = this.environment.config.isBundled;
28104
28178
  let s;
28105
28179
  const cleanString = stripLiteral(code);
28106
28180
  const re = new RegExp(workerImportMetaUrlRE);
@@ -28130,7 +28204,7 @@ function workerImportMetaUrlPlugin(config) {
28130
28204
  let builtUrl;
28131
28205
  if (isBundled) {
28132
28206
  const result = await workerFileToUrl(config, file);
28133
- if (this.environment.config.command === "serve" && this.environment.config.experimental.bundledDev) builtUrl = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
28207
+ if (this.environment.config.command === "serve") builtUrl = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
28134
28208
  else builtUrl = result.entryUrlPlaceholder;
28135
28209
  for (const file of result.watchedFiles) this.addWatchFile(file);
28136
28210
  } else {
@@ -28685,23 +28759,26 @@ function dynamicImportVarsPlugin(config) {
28685
28759
  tryIndex: false,
28686
28760
  extensions: []
28687
28761
  });
28688
- if (config.isBundled) return perEnvironmentPlugin("native:dynamic-import-vars", (environment) => {
28689
- const { include, exclude } = environment.config.build.dynamicImportVarsOptions;
28690
- return viteDynamicImportVarsPlugin({
28691
- include,
28692
- exclude,
28693
- resolver(id, importer) {
28694
- return resolve(environment, id, importer);
28695
- },
28696
- sourcemap: !!environment.config.build.sourcemap
28697
- });
28698
- });
28699
28762
  const getFilter = perEnvironmentState((environment) => {
28700
28763
  const { include, exclude } = environment.config.build.dynamicImportVarsOptions;
28701
28764
  return createFilter$1(include, exclude);
28702
28765
  });
28703
28766
  return {
28704
28767
  name: "vite:dynamic-import-vars",
28768
+ applyToEnvironment(environment) {
28769
+ if (environment.config.isBundled) {
28770
+ const { include, exclude } = environment.config.build.dynamicImportVarsOptions;
28771
+ return viteDynamicImportVarsPlugin({
28772
+ include,
28773
+ exclude,
28774
+ resolver(id, importer) {
28775
+ return resolve(environment, id, importer);
28776
+ },
28777
+ sourcemap: !!environment.config.build.sourcemap
28778
+ });
28779
+ }
28780
+ return true;
28781
+ },
28705
28782
  resolveId: {
28706
28783
  filter: { id: exactRegex(dynamicImportHelperId) },
28707
28784
  handler(id) {
@@ -28759,14 +28836,17 @@ function dynamicImportVarsPlugin(config) {
28759
28836
  //#endregion
28760
28837
  //#region src/node/plugins/importMetaGlob.ts
28761
28838
  function importGlobPlugin(config) {
28762
- if (config.isBundled) return viteImportGlobPlugin({
28763
- root: config.root,
28764
- sourcemap: !!config.build.sourcemap,
28765
- restoreQueryExtension: config.experimental.importGlobRestoreExtension
28766
- });
28767
28839
  const importGlobMaps = /* @__PURE__ */ new Map();
28768
28840
  return {
28769
28841
  name: "vite:import-glob",
28842
+ applyToEnvironment(environment) {
28843
+ if (environment.config.isBundled) return viteImportGlobPlugin({
28844
+ root: environment.config.root,
28845
+ sourcemap: !!environment.config.build.sourcemap,
28846
+ restoreQueryExtension: environment.config.experimental.importGlobRestoreExtension
28847
+ });
28848
+ return true;
28849
+ },
28770
28850
  buildStart() {
28771
28851
  importGlobMaps.clear();
28772
28852
  },
@@ -29734,29 +29814,34 @@ function esbuildBannerFooterCompatPlugin(config) {
29734
29814
  //#region src/node/plugins/index.ts
29735
29815
  async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
29736
29816
  const isBuild = config.command === "build";
29737
- const isBundled = config.isBundled;
29738
29817
  const isWorker = config.isWorker;
29739
- const buildPlugins = isBundled ? (await Promise.resolve().then(() => build_exports)).resolveBuildPlugins(config) : {
29818
+ const buildPlugins = isBuild || Object.values(config.environments).some((env) => env.isBundled) ? (await Promise.resolve().then(() => build_exports)).resolveBuildPlugins(config) : {
29740
29819
  pre: [],
29741
29820
  post: []
29742
29821
  };
29743
29822
  const devtoolsIntegrationPlugin = config.devtools.enabled && !isWorker ? await loadDevToolsIntegrationPlugin(config) : null;
29744
29823
  const { modulePreload } = config.build;
29745
29824
  return [
29746
- !isBundled ? optimizedDepsPlugin() : null,
29825
+ optimizedDepsPlugin(),
29747
29826
  !isWorker ? watchPackageDataPlugin(config.packageCache) : null,
29748
- !isBundled ? preAliasPlugin(config) : null,
29749
- isBundled && !config.resolve.alias.some((v) => v.customResolver) ? viteAliasPlugin({ entries: config.resolve.alias.map((item) => {
29750
- return {
29751
- find: item.find,
29752
- replacement: item.replacement
29753
- };
29754
- }) }) : alias$1({
29755
- entries: config.resolve.alias,
29756
- customResolver: viteAliasCustomResolver
29757
- }),
29827
+ preAliasPlugin(config),
29828
+ {
29829
+ ...alias$1({
29830
+ entries: config.resolve.alias,
29831
+ customResolver: viteAliasCustomResolver
29832
+ }),
29833
+ applyToEnvironment(environment) {
29834
+ if (environment.config.isBundled && !environment.config.resolve.alias.some((v) => v.customResolver)) return viteAliasPlugin({ entries: config.resolve.alias.map((item) => {
29835
+ return {
29836
+ find: item.find,
29837
+ replacement: item.replacement
29838
+ };
29839
+ }) });
29840
+ return true;
29841
+ }
29842
+ },
29758
29843
  ...prePlugins,
29759
- modulePreload !== false && modulePreload.polyfill ? modulePreloadPolyfillPlugin(config) : null,
29844
+ modulePreload !== false && modulePreload.polyfill ? modulePreloadPolyfillPlugin() : null,
29760
29845
  ...oxcResolvePlugin({
29761
29846
  root: config.root,
29762
29847
  isProduction: config.isProduction,
@@ -29769,12 +29854,18 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
29769
29854
  }, isWorker ? {
29770
29855
  ...config,
29771
29856
  consumer: "client",
29857
+ isBundled: true,
29772
29858
  optimizeDepsPluginNames: []
29773
29859
  } : void 0),
29774
29860
  htmlInlineProxyPlugin(config),
29775
29861
  cssPlugin(config),
29776
29862
  esbuildBannerFooterCompatPlugin(config),
29777
- config.oxc !== false && !isBundled ? oxcRuntimePlugin() : null,
29863
+ config.oxc !== false ? {
29864
+ ...oxcRuntimePlugin(),
29865
+ applyToEnvironment(environment) {
29866
+ return !environment.config.isBundled;
29867
+ }
29868
+ } : null,
29778
29869
  config.oxc !== false ? oxcPlugin(config) : null,
29779
29870
  viteJsonPlugin({
29780
29871
  ...config.json,
@@ -29788,7 +29879,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
29788
29879
  viteWasmFallbackPlugin(),
29789
29880
  definePlugin(config),
29790
29881
  cssPostPlugin(config),
29791
- isBundled && buildHtmlPlugin(config),
29882
+ buildHtmlPlugin(config),
29792
29883
  workerImportMetaUrlPlugin(config),
29793
29884
  assetImportMetaUrlPlugin(config),
29794
29885
  ...buildPlugins.pre,
@@ -29797,11 +29888,9 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
29797
29888
  ...postPlugins,
29798
29889
  ...buildPlugins.post,
29799
29890
  devtoolsIntegrationPlugin,
29800
- ...isBundled ? [] : [
29801
- clientInjectionsPlugin(config),
29802
- cssAnalysisPlugin(config),
29803
- importAnalysisPlugin(config)
29804
- ]
29891
+ clientInjectionsPlugin(config),
29892
+ cssAnalysisPlugin(config),
29893
+ importAnalysisPlugin(config)
29805
29894
  ].filter(Boolean);
29806
29895
  }
29807
29896
  async function loadDevToolsIntegrationPlugin(config) {
@@ -29948,6 +30037,9 @@ async function createEnvironmentPluginContainer(environment, plugins, watcher, a
29948
30037
  return container;
29949
30038
  }
29950
30039
  var EnvironmentPluginContainer = class {
30040
+ environment;
30041
+ plugins;
30042
+ watcher;
29951
30043
  _pluginContextMap = /* @__PURE__ */ new Map();
29952
30044
  _resolvedRollupOptions;
29953
30045
  _processesing = /* @__PURE__ */ new Set();
@@ -30219,6 +30311,8 @@ const basePluginContextMeta = {
30219
30311
  rolldownVersion
30220
30312
  };
30221
30313
  var BasicMinimalPluginContext = class {
30314
+ meta;
30315
+ _logger;
30222
30316
  constructor(meta, _logger) {
30223
30317
  this.meta = meta;
30224
30318
  this._logger = _logger;
@@ -30278,6 +30372,8 @@ const fsModule = {
30278
30372
  writeFile: fsp.writeFile
30279
30373
  };
30280
30374
  var PluginContext = class extends MinimalPluginContext {
30375
+ _plugin;
30376
+ _container;
30281
30377
  ssr = false;
30282
30378
  _scan = false;
30283
30379
  _activeId = null;
@@ -30547,6 +30643,7 @@ var TransformPluginContext = class extends LoadPluginContext {
30547
30643
  }
30548
30644
  };
30549
30645
  var PluginContainer = class {
30646
+ environments;
30550
30647
  constructor(environments) {
30551
30648
  this.environments = environments;
30552
30649
  }
@@ -30661,7 +30758,7 @@ function scanImports(environment) {
30661
30758
  async function scan() {
30662
30759
  const entries = await computeEntries(environment);
30663
30760
  if (!entries.length) {
30664
- if (!config.optimizeDeps.entries && !config.optimizeDeps.include) environment.logger.warn(import_picocolors.default.yellow("(!) Could not auto-determine entry point from rollupOptions or html files and there are no explicit optimizeDeps.include patterns. Skipping dependency pre-bundling."));
30761
+ if (!config.optimizeDeps.entries && !config.optimizeDeps.include) environment.logger.warn(import_picocolors.default.yellow("(!) Could not auto-determine entry point from rolldownOptions or html files and there are no explicit optimizeDeps.include patterns. Skipping dependency pre-bundling."));
30665
30762
  return;
30666
30763
  }
30667
30764
  if (scanContext.cancelled) return;
@@ -30706,13 +30803,13 @@ async function computeEntries(environment) {
30706
30803
  isEntry: true,
30707
30804
  scan: true
30708
30805
  }))?.id;
30709
- if (id === void 0) throw new Error(`failed to resolve rollupOptions.input value: ${JSON.stringify(p)}.`);
30806
+ if (id === void 0) throw new Error(`failed to resolve rolldownOptions.input value: ${JSON.stringify(p)}.`);
30710
30807
  return id;
30711
30808
  };
30712
30809
  if (typeof buildInput === "string") entries = [await resolvePath(buildInput)];
30713
30810
  else if (Array.isArray(buildInput)) entries = await Promise.all(buildInput.map(resolvePath));
30714
30811
  else if (isObject$1(buildInput)) entries = await Promise.all(Object.values(buildInput).map(resolvePath));
30715
- else throw new Error("invalid rollupOptions.input value.");
30812
+ else throw new Error("invalid rolldownOptions.input value.");
30716
30813
  } else entries = await globEntries("**/*.html", environment);
30717
30814
  entries = entries.filter((entry) => isScannable(entry, environment.config.optimizeDeps.extensions) && fs.existsSync(entry));
30718
30815
  return entries;
@@ -32039,7 +32136,7 @@ const perEnvironmentOrWorkerPlugin = (name, overrideEnvConfig, f) => {
32039
32136
  };
32040
32137
  function oxcResolvePlugin(resolveOptions, overrideEnvConfig) {
32041
32138
  return [...resolveOptions.optimizeDeps && !resolveOptions.isBuild ? [optimizerResolvePlugin(resolveOptions)] : [], ...perEnvironmentOrWorkerPlugin("vite:resolve-builtin", overrideEnvConfig, (partialEnv, getEnv) => {
32042
- const depsOptimizerEnabled = resolveOptions.optimizeDeps && !resolveOptions.isBuild && !partialEnv.config.experimental.bundledDev && !isDepOptimizationDisabled(partialEnv.config.optimizeDeps);
32139
+ const depsOptimizerEnabled = resolveOptions.optimizeDeps && !resolveOptions.isBuild && !partialEnv.config.isBundled && !isDepOptimizationDisabled(partialEnv.config.optimizeDeps);
32043
32140
  const getDepsOptimizer = () => {
32044
32141
  const env = getEnv();
32045
32142
  if (env.mode !== "dev") throw new Error("The environment mode should be dev");
@@ -32124,7 +32221,7 @@ function optimizerResolvePlugin(resolveOptions) {
32124
32221
  return {
32125
32222
  name: "vite:resolve-dev",
32126
32223
  applyToEnvironment(environment) {
32127
- return !environment.config.experimental.bundledDev && !isDepOptimizationDisabled(environment.config.optimizeDeps);
32224
+ return !environment.config.isBundled && !isDepOptimizationDisabled(environment.config.optimizeDeps);
32128
32225
  },
32129
32226
  resolveId: {
32130
32227
  filter: { id: { exclude: [
@@ -32745,9 +32842,9 @@ function prepareOutDirPlugin() {
32745
32842
  order: "pre",
32746
32843
  handler() {
32747
32844
  if (rendered.has(this.environment)) return;
32748
- rendered.add(this.environment);
32749
32845
  const { config } = this.environment;
32750
32846
  if (config.build.write) {
32847
+ rendered.add(this.environment);
32751
32848
  const { root, build: options } = config;
32752
32849
  const resolvedOutDirs = getResolvedOutDirs(root, options.outDir, options.rollupOptions.output);
32753
32850
  prepareOutDir(resolvedOutDirs, resolveEmptyOutDir(options.emptyOutDir, root, resolvedOutDirs, this.environment.logger), this.environment);
@@ -32872,12 +32969,15 @@ function resolveBuildPlugins(config) {
32872
32969
  return {
32873
32970
  pre: [
32874
32971
  ...isBuild && !config.isWorker ? [prepareOutDirPlugin()] : [],
32875
- perEnvironmentPlugin("vite:rollup-options-plugins", async (environment) => (await asyncFlatten(arraify(environment.config.build.rollupOptions.plugins))).filter(Boolean)),
32972
+ perEnvironmentPlugin("vite:rollup-options-plugins", async (environment) => {
32973
+ if (!isBuild && !environment.config.isBundled) return false;
32974
+ return (await asyncFlatten(arraify(environment.config.build.rollupOptions.plugins))).filter(Boolean);
32975
+ }),
32876
32976
  ...config.isWorker ? [webWorkerPostPlugin(config)] : []
32877
32977
  ],
32878
32978
  post: [
32879
32979
  ...isBuild ? buildImportAnalysisPlugin(config) : [],
32880
- ...config.build.minify === "esbuild" ? [buildEsbuildPlugin()] : [],
32980
+ ...isBuild && config.build.minify === "esbuild" ? [buildEsbuildPlugin()] : [],
32881
32981
  ...isBuild ? [terserPlugin(config)] : [],
32882
32982
  ...isBuild && !config.isWorker ? [
32883
32983
  licensePlugin(),
@@ -32945,9 +33045,9 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
32945
33045
  const isSsrTargetWebworkerEnvironment = environment.name === "ssr" && environment.getTopLevelConfig().ssr?.target === "webworker";
32946
33046
  if (isSsrTargetWebworkerEnvironment) plugins.push(esmExternalRequirePlugin());
32947
33047
  const buildOutputOptions = (output = {}) => {
32948
- if (output.output) logger.warn("You've set \"rollupOptions.output.output\" in your config. This is deprecated and will override all Vite.js default output options. Please use \"rollupOptions.output\" instead.");
32949
- if (output.file) throw new Error("Vite does not support \"rollupOptions.output.file\". Please use \"rollupOptions.output.dir\" and \"rollupOptions.output.entryFileNames\" instead.");
32950
- if (output.sourcemap) logger.warnOnce(import_picocolors.default.yellow("Vite does not support \"rollupOptions.output.sourcemap\". Please use \"build.sourcemap\" instead."));
33048
+ if (output.output) logger.warn("You've set \"rolldownOptions.output.output\" in your config. This is deprecated and will override all Vite.js default output options. Please use \"rolldownOptions.output\" instead.");
33049
+ if (output.file) throw new Error("Vite does not support \"rolldownOptions.output.file\". Please use \"rolldownOptions.output.dir\" and \"rolldownOptions.output.entryFileNames\" instead.");
33050
+ if (output.sourcemap) logger.warnOnce(import_picocolors.default.yellow("Vite does not support \"rolldownOptions.output.sourcemap\". Please use \"build.sourcemap\" instead."));
32951
33051
  const format = output.format || "es";
32952
33052
  const jsExt = ssr && !isSsrTargetWebworkerEnvironment || libOptions ? resolveOutputJsExtension(format, findNearestPackageData(root, packageCache)?.data.type) : "js";
32953
33053
  return {
@@ -33101,9 +33201,9 @@ function resolveBuildOutputs(outputs, libOptions, logger) {
33101
33201
  format
33102
33202
  }));
33103
33203
  }
33104
- if (libOptions.formats) logger.warn(import_picocolors.default.yellow("\"build.lib.formats\" will be ignored because \"build.rollupOptions.output\" is already an array format."));
33204
+ if (libOptions.formats) logger.warn(import_picocolors.default.yellow("\"build.lib.formats\" will be ignored because \"build.rolldownOptions.output\" is already an array format."));
33105
33205
  outputs.forEach((output) => {
33106
- if ((output.format === "umd" || output.format === "iife") && !output.name) throw new Error("Entries in \"build.rollupOptions.output\" must specify \"name\" when the format is \"umd\" or \"iife\".");
33206
+ if ((output.format === "umd" || output.format === "iife") && !output.name) throw new Error("Entries in \"build.rolldownOptions.output\" must specify \"name\" when the format is \"umd\" or \"iife\".");
33107
33207
  });
33108
33208
  }
33109
33209
  return outputs;
@@ -33123,7 +33223,7 @@ function onRollupLog(level, log, environment) {
33123
33223
  if (logging.code === "UNRESOLVED_IMPORT") {
33124
33224
  const id = logging.id;
33125
33225
  const exporter = logging.exporter;
33126
- if (!id || !id.endsWith("?commonjs-external")) throw new Error(`[vite]: Rolldown failed to resolve import "${exporter}" from "${id}".\nThis is most likely unintended because it can break your application at runtime.\nIf you do want to externalize this module explicitly add it to\n\`build.rollupOptions.external\``);
33226
+ if (!id || !id.endsWith("?commonjs-external")) throw new Error(`[vite]: Rolldown failed to resolve import "${exporter}" from "${id}".\nThis is most likely unintended because it can break your application at runtime.\nIf you do want to externalize this module explicitly add it to\n\`build.rolldownOptions.external\``);
33127
33227
  }
33128
33228
  if (logLeveling === "warn") {
33129
33229
  if (logging.plugin === "rollup-plugin-dynamic-import-variables" && dynamicImportWarningIgnoreList.some((msg) => logging.message.includes(msg))) return;
@@ -33840,9 +33940,14 @@ function convertEsbuildPluginToRolldownPlugin(esbuildPlugin) {
33840
33940
  if (!isSetupDone) await setup([{ name: "vite:dep-scan" }], inputOptions.platform ?? "node");
33841
33941
  for (const cb of onStartCallbacks) cb();
33842
33942
  },
33843
- generateBundle() {
33844
- const buildResult = new Proxy({}, { get(_target, _prop) {
33845
- throw new Error("Not implemented");
33943
+ generateBundle(_outputOpts, _bundle, isWrite) {
33944
+ const buildResult = new Proxy({
33945
+ metafile: void 0,
33946
+ mangleCache: void 0,
33947
+ ...isWrite ? { outputFiles: void 0 } : {}
33948
+ }, { get(_target, prop) {
33949
+ if (prop in _target || typeof prop === "symbol") return _target[prop];
33950
+ throw new Error("Not implemented property: " + prop);
33846
33951
  } });
33847
33952
  for (const cb of onEndCallbacks) cb(buildResult);
33848
33953
  },
@@ -34071,9 +34176,11 @@ function resolveDevEnvironmentOptions(dev, environmentName, consumer, preTransfo
34071
34176
  sourcemapIgnoreList: resolved.sourcemapIgnoreList === false ? () => false : resolved.sourcemapIgnoreList
34072
34177
  };
34073
34178
  }
34074
- function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimizeDeps, logger, environmentName, isBundledDev, isSsrTargetWebworkerSet, preTransformRequests) {
34075
- const consumer = options.consumer ?? (environmentName === "client" ? "client" : "server");
34179
+ function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimizeDeps, logger, environmentName, isBuild, isBundledDev, isSsrTargetWebworkerSet, preTransformRequests) {
34180
+ const isClientEnvironment = environmentName === "client";
34181
+ const consumer = options.consumer ?? (isClientEnvironment ? "client" : "server");
34076
34182
  const isSsrTargetWebworkerEnvironment = isSsrTargetWebworkerSet && environmentName === "ssr";
34183
+ const isBundled = options.isBundled ?? (isBuild || isClientEnvironment && isBundledDev);
34077
34184
  if (options.define?.["process.env"]) {
34078
34185
  const processEnvDefine = options.define["process.env"];
34079
34186
  if (typeof processEnvDefine === "object") {
@@ -34089,7 +34196,8 @@ function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimi
34089
34196
  consumer,
34090
34197
  optimizeDeps: resolveDepOptimizationOptions(options.optimizeDeps, resolve.preserveSymlinks, forceOptimizeDeps, consumer, logger),
34091
34198
  dev: resolveDevEnvironmentOptions(options.dev, environmentName, consumer, preTransformRequests),
34092
- build: resolveBuildEnvironmentOptions(options.build ?? {}, logger, consumer, isBundledDev, isSsrTargetWebworkerEnvironment),
34199
+ build: resolveBuildEnvironmentOptions(options.build ?? {}, logger, consumer, isBundled && !isBuild, isSsrTargetWebworkerEnvironment),
34200
+ isBundled,
34093
34201
  plugins: void 0,
34094
34202
  optimizeDepsPluginNames: void 0
34095
34203
  };
@@ -34330,7 +34438,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
34330
34438
  config.resolve.mainFields = config.environments.client.resolve?.mainFields;
34331
34439
  const resolvedDefaultResolve = resolveResolveOptions(config.resolve, logger);
34332
34440
  const resolvedEnvironments = {};
34333
- 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);
34441
+ 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);
34334
34442
  const backwardCompatibleOptimizeDeps = resolvedEnvironments.client.optimizeDeps;
34335
34443
  const resolvedDevEnvironmentOptions = resolveDevEnvironmentOptions(config.dev, void 0, void 0);
34336
34444
  const resolvedBuildOptions = resolveBuildEnvironmentOptions(config.build ?? {}, logger, void 0, isBundledDev);
@@ -34430,7 +34538,6 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
34430
34538
  cacheDir,
34431
34539
  command,
34432
34540
  mode,
34433
- isBundled: config.experimental?.bundledDev || isBuild,
34434
34541
  isWorker: false,
34435
34542
  mainConfig: null,
34436
34543
  bundleChain: [],
@@ -34539,7 +34646,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
34539
34646
  if (assetFileNamesList.length > 1) {
34540
34647
  const firstAssetFileNames = assetFileNamesList[0];
34541
34648
  if (assetFileNamesList.some((assetFileNames) => assetFileNames !== firstAssetFileNames)) resolved.logger.warn(import_picocolors.default.yellow(`
34542
- assetFileNames isn't equal for every build.rollupOptions.output. A single pattern across all outputs is supported by Vite.
34649
+ assetFileNames isn't equal for every build.rolldownOptions.output. A single pattern across all outputs is supported by Vite.
34543
34650
  `));
34544
34651
  }
34545
34652
  }
@@ -1,4 +1,4 @@
1
- import { i as __require, t as __commonJSMin } from "./chunk.js";
1
+ import { H as __require, z as __commonJSMin } from "./logger.js";
2
2
  import { t as require_lib } from "./lib.js";
3
3
  //#region ../../node_modules/.pnpm/postcss-import@16.1.1_postcss@8.5.14/node_modules/postcss-import/lib/format-import-prelude.js
4
4
  var require_format_import_prelude = /* @__PURE__ */ __commonJSMin(((exports, module) => {
package/dist/node/cli.js CHANGED
@@ -1,5 +1,4 @@
1
- import { o as __toESM } from "./chunks/chunk.js";
2
- import { N as VERSION, R as require_picocolors, n as createLogger } from "./chunks/logger.js";
1
+ import { N as VERSION, R as require_picocolors, W as __toESM, n as createLogger } from "./chunks/logger.js";
3
2
  import fs from "node:fs";
4
3
  import path from "node:path";
5
4
  import { inspect } from "node:util";
@@ -31,7 +31,7 @@ import { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownA
31
31
 
32
32
  //#region \0rolldown/runtime.js
33
33
  //#endregion
34
- //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.19_typescript@6.0.2_vite@packages+vite/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
34
+ //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.21_typescript@6.0.2_vite@packages+vite/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
35
35
  //#region src/node/cli-commands.d.ts
36
36
  interface StartOptions {
37
37
  root?: string;
@@ -41,7 +41,7 @@ interface StartOptions {
41
41
  open?: boolean;
42
42
  }
43
43
  //#endregion
44
- //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.19_typescript@6.0.2_vite@packages+vite/node_modules/@vitejs/devtools/dist/config.d.ts
44
+ //#region ../../node_modules/.pnpm/@vitejs+devtools@0.1.21_typescript@6.0.2_vite@packages+vite/node_modules/@vitejs/devtools/dist/config.d.ts
45
45
  //#region src/node/config.d.ts
46
46
  interface DevToolsConfig extends Partial<StartOptions> {
47
47
  enabled: boolean;
@@ -925,7 +925,7 @@ interface DepOptimizationConfig {
925
925
  type DepOptimizationOptions = DepOptimizationConfig & {
926
926
  /**
927
927
  * By default, Vite will crawl your `index.html` to detect dependencies that
928
- * need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
928
+ * need to be pre-bundled. If `build.rolldownOptions.input` is specified, Vite
929
929
  * will crawl those entry points instead.
930
930
  *
931
931
  * If neither of these fit your needs, you can specify custom entries using
@@ -3288,6 +3288,17 @@ interface SharedEnvironmentOptions {
3288
3288
  * Optimize deps config
3289
3289
  */
3290
3290
  optimizeDeps?: DepOptimizationOptions;
3291
+ /**
3292
+ * Whether this environment produces a bundled output.
3293
+ *
3294
+ * During `build`, this defaults to `true` for every environment.
3295
+ * During `serve`, this defaults to `true` only for the client environment
3296
+ * when `experimental.bundledDev` is enabled, and `false` otherwise.
3297
+ * Setting this explicitly on an environment always overrides the default.
3298
+ *
3299
+ * @experimental
3300
+ */
3301
+ isBundled?: boolean;
3291
3302
  }
3292
3303
  interface EnvironmentOptions extends SharedEnvironmentOptions {
3293
3304
  /**
@@ -3308,6 +3319,7 @@ type ResolvedEnvironmentOptions = {
3308
3319
  optimizeDeps: DepOptimizationOptions;
3309
3320
  dev: ResolvedDevEnvironmentOptions;
3310
3321
  build: ResolvedBuildEnvironmentOptions;
3322
+ isBundled: boolean;
3311
3323
  plugins: readonly Plugin[];
3312
3324
  };
3313
3325
  type DefaultEnvironmentOptions = Omit<EnvironmentOptions, "consumer" | "resolve" | "keepProcessEnv"> & {
@@ -3532,7 +3544,11 @@ interface ExperimentalOptions {
3532
3544
  */
3533
3545
  hmrPartialAccept?: boolean;
3534
3546
  /**
3535
- * Enable full bundle mode.
3547
+ * Enable full bundle mode during `serve`.
3548
+ *
3549
+ * This seeds the default for the client environment's `isBundled` option.
3550
+ * Other environments default to `false` during `serve`. Any environment
3551
+ * can override its `isBundled` value via `environments[name].isBundled`.
3536
3552
  *
3537
3553
  * This is highly experimental.
3538
3554
  *
@@ -3592,8 +3608,7 @@ interface ResolvedConfig extends Readonly<Omit<UserConfig, "plugins" | "css" | "
3592
3608
  publicDir: string;
3593
3609
  cacheDir: string;
3594
3610
  command: "build" | "serve";
3595
- mode: string; /** `true` when build or full-bundle mode dev */
3596
- isBundled: boolean;
3611
+ mode: string;
3597
3612
  isWorker: boolean;
3598
3613
  isProduction: boolean;
3599
3614
  envDir: string | false;
@@ -131,8 +131,7 @@ declare class ModuleRunner {
131
131
  */
132
132
  isClosed(): boolean;
133
133
  private processImport;
134
- private isCircularModule;
135
- private isCircularImport;
134
+ private isCircularRequest;
136
135
  private cachedRequest;
137
136
  private cachedModule;
138
137
  private ensureBuiltins;
@@ -225,6 +225,7 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
225
225
  //#endregion
226
226
  //#region src/module-runner/sourcemap/decoder.ts
227
227
  var DecodedMap = class {
228
+ map;
228
229
  _encoded;
229
230
  _decoded;
230
231
  _decodedMemo;
@@ -256,6 +257,8 @@ function getOriginalPosition(map, needle) {
256
257
  //#region src/module-runner/evaluatedModules.ts
257
258
  const MODULE_RUNNER_SOURCEMAPPING_REGEXP = RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`);
258
259
  var EvaluatedModuleNode = class {
260
+ id;
261
+ url;
259
262
  importers = /* @__PURE__ */ new Set();
260
263
  imports = /* @__PURE__ */ new Set();
261
264
  evaluated = !1;
@@ -349,6 +352,8 @@ function normalizeModuleId(file) {
349
352
  //#endregion
350
353
  //#region src/shared/hmr.ts
351
354
  var HMRContext = class {
355
+ hmrClient;
356
+ ownerPath;
352
357
  newListeners;
353
358
  constructor(hmrClient, ownerPath) {
354
359
  this.hmrClient = hmrClient, this.ownerPath = ownerPath, hmrClient.dataMap.has(ownerPath) || hmrClient.dataMap.set(ownerPath, {});
@@ -430,6 +435,9 @@ var HMRContext = class {
430
435
  }), this.hmrClient.hotModulesMap.set(this.ownerPath, mod);
431
436
  }
432
437
  }, HMRClient = class {
438
+ logger;
439
+ transport;
440
+ importUpdatedModule;
433
441
  hotModulesMap = /* @__PURE__ */ new Map();
434
442
  disposeMap = /* @__PURE__ */ new Map();
435
443
  pruneMap = /* @__PURE__ */ new Map();
@@ -1080,6 +1088,9 @@ function createNodeImportMeta(modulePath) {
1080
1088
  //#endregion
1081
1089
  //#region src/module-runner/runner.ts
1082
1090
  var ModuleRunner = class {
1091
+ options;
1092
+ evaluator;
1093
+ debug;
1083
1094
  evaluatedModules;
1084
1095
  hmrClient;
1085
1096
  transport;
@@ -1127,29 +1138,25 @@ var ModuleRunner = class {
1127
1138
  let { url, type } = fetchResult;
1128
1139
  return type !== "module" && type !== "commonjs" || analyzeImportedModDifference(exports, url, type, metadata), exports;
1129
1140
  }
1130
- isCircularModule(mod) {
1131
- for (let importedFile of mod.imports) if (mod.importers.has(importedFile)) return !0;
1132
- return !1;
1133
- }
1134
- isCircularImport(importers, moduleUrl, visited = /* @__PURE__ */ new Set()) {
1135
- for (let importer of importers) {
1136
- if (visited.has(importer)) continue;
1137
- if (visited.add(importer), importer === moduleUrl) return !0;
1138
- let mod = this.evaluatedModules.getModuleById(importer);
1139
- if (mod && mod.importers.size && this.isCircularImport(mod.importers, moduleUrl, visited)) return !0;
1141
+ isCircularRequest(mod, callstack, visited = /* @__PURE__ */ new Set()) {
1142
+ if (visited.has(mod.id)) return !1;
1143
+ visited.add(mod.id);
1144
+ for (let importedModuleId of mod.imports) {
1145
+ if (callstack.includes(importedModuleId)) return !0;
1146
+ let importedModule = this.evaluatedModules.getModuleById(importedModuleId);
1147
+ if (importedModule?.promise && !importedModule.evaluated && this.isCircularRequest(importedModule, callstack, visited)) return !0;
1140
1148
  }
1141
1149
  return !1;
1142
1150
  }
1143
1151
  async cachedRequest(url, mod, callstack = [], metadata) {
1144
- let meta = mod.meta, moduleId = meta.id, { importers } = mod, importee = callstack[callstack.length - 1];
1145
- if (importee && importers.add(importee), mod.evaluated && mod.promise) return this.processImport(await mod.promise, meta, metadata);
1146
- if ((callstack.includes(moduleId) || this.isCircularModule(mod) || this.isCircularImport(importers, moduleId)) && mod.exports) return this.processImport(mod.exports, meta, metadata);
1152
+ let meta = mod.meta, moduleId = meta.id, importee = callstack[callstack.length - 1];
1153
+ if (importee && mod.importers.add(importee), mod.evaluated && mod.promise) return this.processImport(await mod.promise, meta, metadata);
1154
+ if (mod.promise) return mod.exports && (callstack.includes(moduleId) || this.isCircularRequest(mod, callstack)) ? this.processImport(mod.exports, meta, metadata) : this.processImport(await mod.promise, meta, metadata);
1147
1155
  let debugTimer;
1148
1156
  this.debug && (debugTimer = setTimeout(() => {
1149
1157
  this.debug(`[module runner] module ${moduleId} takes over 2s to load.\n${`stack:\n${[...callstack, moduleId].reverse().map((p) => ` - ${p}`).join("\n")}`}`);
1150
1158
  }, 2e3));
1151
1159
  try {
1152
- if (mod.promise) return this.processImport(await mod.promise, meta, metadata);
1153
1160
  let promise = this.directRequest(url, mod, callstack);
1154
1161
  return mod.promise = promise, mod.evaluated = !1, this.processImport(await promise, meta, metadata);
1155
1162
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "8.0.11",
3
+ "version": "8.0.13",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -63,7 +63,7 @@
63
63
  "lightningcss": "^1.32.0",
64
64
  "picomatch": "^4.0.4",
65
65
  "postcss": "^8.5.14",
66
- "rolldown": "1.0.0-rc.18",
66
+ "rolldown": "1.0.1",
67
67
  "tinyglobby": "^0.2.16"
68
68
  },
69
69
  "optionalDependencies": {
@@ -81,9 +81,9 @@
81
81
  "@types/escape-html": "^1.0.4",
82
82
  "@types/pnpapi": "^0.0.5",
83
83
  "@vitest/utils": "4.1.5",
84
- "@vitejs/devtools": "^0.1.19",
84
+ "@vitejs/devtools": "^0.1.21",
85
85
  "artichokie": "^0.4.3",
86
- "baseline-browser-mapping": "^2.10.27",
86
+ "baseline-browser-mapping": "^2.10.29",
87
87
  "cac": "^7.0.0",
88
88
  "chokidar": "^3.6.0",
89
89
  "connect": "^3.7.0",
@@ -114,14 +114,14 @@
114
114
  "postcss-modules": "^6.0.1",
115
115
  "premove": "^4.0.0",
116
116
  "resolve.exports": "^2.0.3",
117
- "rolldown-plugin-dts": "^0.24.1",
117
+ "rolldown-plugin-dts": "^0.25.0",
118
118
  "rollup": "^4.59.0",
119
119
  "rollup-plugin-license": "^3.7.1",
120
120
  "sass": "^1.99.0",
121
121
  "sass-embedded": "^1.99.0",
122
122
  "sirv": "^3.0.2",
123
123
  "strip-literal": "^3.1.0",
124
- "terser": "^5.46.2",
124
+ "terser": "^5.47.1",
125
125
  "ufo": "^1.6.4",
126
126
  "ws": "^8.20.0"
127
127
  },
@@ -18,7 +18,7 @@ export interface CustomEventMap {
18
18
  /** @internal */
19
19
  'vite:forward-console': ForwardConsolePayload
20
20
  /** @internal */
21
- 'vite:module-loaded': { modules: string[] }
21
+ 'vite:module-loaded': { modules: string[]; clientId: string }
22
22
 
23
23
  // server events
24
24
  'vite:client:connect': undefined
@@ -1,37 +0,0 @@
1
- import { createRequire } from "node:module";
2
- //#region \0rolldown/runtime.js
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
10
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
11
- var __exportAll = (all, no_symbols) => {
12
- let target = {};
13
- for (var name in all) __defProp(target, name, {
14
- get: all[name],
15
- enumerable: true
16
- });
17
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
18
- return target;
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
22
- key = keys[i];
23
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
24
- get: ((k) => from[k]).bind(null, key),
25
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
26
- });
27
- }
28
- return to;
29
- };
30
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
31
- value: mod,
32
- enumerable: true
33
- }) : target, mod));
34
- var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
36
- //#endregion
37
- export { __toCommonJS as a, __require as i, __esmMin as n, __toESM as o, __exportAll as r, __commonJSMin as t };