@voidzero-dev/vite-plus-core 0.1.22 → 0.1.23

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.
Files changed (93) hide show
  1. package/LICENSE +35 -24
  2. package/dist/pluginutils/filter/index.d.mts +194 -0
  3. package/dist/pluginutils/filter/index.mjs +2 -0
  4. package/dist/pluginutils/filter-B_mD-HGz.mjs +323 -0
  5. package/dist/pluginutils/index.d.mts +2 -0
  6. package/dist/pluginutils/index.mjs +2 -0
  7. package/dist/rolldown/cli.mjs +7 -7
  8. package/dist/rolldown/config.d.mts +1 -1
  9. package/dist/rolldown/config.mjs +3 -3
  10. package/dist/rolldown/experimental-index.d.mts +21 -4
  11. package/dist/rolldown/experimental-index.mjs +14 -9
  12. package/dist/rolldown/filter-index.d.mts +8 -9
  13. package/dist/rolldown/filter-index.mjs +2 -8
  14. package/dist/rolldown/get-log-filter.d.mts +3 -3
  15. package/dist/rolldown/index.d.mts +4 -4
  16. package/dist/rolldown/index.mjs +5 -5
  17. package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
  18. package/dist/rolldown/parallel-plugin.d.mts +1 -1
  19. package/dist/rolldown/parse-ast-index.d.mts +1 -1
  20. package/dist/rolldown/parse-ast-index.mjs +2 -2
  21. package/dist/rolldown/plugins-index.d.mts +3 -3
  22. package/dist/rolldown/plugins-index.mjs +2 -2
  23. package/dist/rolldown/shared/{binding-zH1vcmbM.d.mts → binding-BaCZTfMx.d.mts} +32 -3
  24. package/dist/rolldown/shared/{binding-ESkOU1xr.mjs → binding-CXquf8ay.mjs} +27 -26
  25. package/dist/rolldown/shared/{bindingify-input-options-wZdDRbfo.mjs → bindingify-input-options-D2ORek5s.mjs} +14 -14
  26. package/dist/rolldown/shared/{constructors-D6i2Tbyl.mjs → constructors-BiPdtLBB.mjs} +1 -1
  27. package/dist/rolldown/shared/{constructors-D0W3rNfA.d.mts → constructors-CbNaT434.d.mts} +2 -2
  28. package/dist/rolldown/shared/{define-config-5HJ1b9vG.d.mts → define-config-3BX_X2Am.d.mts} +70 -16
  29. package/dist/rolldown/shared/{error-BrnLyQ-g.mjs → error-BuvQYXuZ.mjs} +1 -1
  30. package/dist/rolldown/shared/{get-log-filter-semyr3Lj.d.mts → get-log-filter-BpNVNJ5-.d.mts} +1 -1
  31. package/dist/rolldown/shared/{load-config-BZFgt8GH.mjs → load-config-uvbpmLwO.mjs} +1 -1
  32. package/dist/rolldown/shared/{normalize-string-or-regex-dAjLOSbp.mjs → normalize-string-or-regex-CNPF6PU9.mjs} +2 -2
  33. package/dist/rolldown/shared/{parse-DFts7Hyl.mjs → parse-1VOPJ1Lj.mjs} +2 -2
  34. package/dist/rolldown/shared/{prompt-Bm9aMQjm.mjs → prompt-DV1XbtjC.mjs} +1 -1
  35. package/dist/rolldown/shared/{resolve-tsconfig-DCdBlPeK.mjs → resolve-tsconfig-CcfxWrib.mjs} +15 -4
  36. package/dist/rolldown/shared/{rolldown-Cs2eRf4R.mjs → rolldown-BZYLlfsv.mjs} +1 -1
  37. package/dist/rolldown/shared/{rolldown-build-CNhzgsn2.mjs → rolldown-build-CgMNHFY3.mjs} +54 -65
  38. package/dist/rolldown/shared/{transform-DgZ3paSD.d.mts → transform-7xCUVrpL.d.mts} +2 -2
  39. package/dist/rolldown/shared/{watch-De_8Tgeq.mjs → watch-BX_aH1Oh.mjs} +6 -6
  40. package/dist/rolldown/utils-index.d.mts +3 -3
  41. package/dist/rolldown/utils-index.mjs +5 -5
  42. package/dist/tsdown/{build-5FURNVr0-D2dbyiC6.js → build-5FURNVr0-CsM6vj3e.js} +1046 -17
  43. package/dist/tsdown/{detect-DN3DXXYt-8gmDjZqp.js → detect-DN3DXXYt-TsZBbdhI.js} +1 -1
  44. package/dist/tsdown/{dist-DTzJRoOQ.js → dist-wWM45aJq.js} +2185 -1087
  45. package/dist/tsdown/index-types.d.ts +7 -5
  46. package/dist/tsdown/index.js +3 -4
  47. package/dist/tsdown/{main-BNUO6D3N.js → main-Cq8Is40L.js} +288 -8
  48. package/dist/tsdown/npm_cjs_chunk_range.cjs +11 -11
  49. package/dist/tsdown/npm_cjs_chunk_semver.cjs +6 -6
  50. package/dist/tsdown/npm_entry_semver_functions_coerce.cjs +2 -2
  51. package/dist/tsdown/npm_entry_semver_functions_satisfies.cjs +1 -1
  52. package/dist/tsdown/npm_entry_semver_ranges_min-version.cjs +1 -1
  53. package/dist/tsdown/{resolver-DkvdaW3s-BeVUoOo-.js → resolver-DkvdaW3s-Dz1U-gxd.js} +1 -1
  54. package/dist/tsdown/run.js +3 -4
  55. package/dist/tsdown/{tsc-Dr9kCkDm.js → tsc-Dp9emiKb.js} +3 -3
  56. package/dist/tsdown/{tsc-context-CANQEB9U.js → tsc-context-DXovbMXp.js} +2 -2
  57. package/dist/vite/client/client.mjs +61 -27
  58. package/dist/vite/node/chunks/build.js +21 -21
  59. package/dist/vite/node/chunks/dist.js +1 -1
  60. package/dist/vite/node/chunks/dist2.js +136 -110
  61. package/dist/vite/node/chunks/lib.js +1 -1
  62. package/dist/vite/node/chunks/logger.js +36 -3
  63. package/dist/vite/node/chunks/node.js +288 -181
  64. package/dist/vite/node/chunks/postcss-import.js +11 -11
  65. package/dist/vite/node/cli.js +1 -2
  66. package/dist/vite/node/index.d.ts +29 -14
  67. package/dist/vite/node/module-runner.d.ts +1 -2
  68. package/dist/vite/node/module-runner.js +19 -18
  69. package/dist/vite/types/customEvent.d.ts +1 -1
  70. package/package.json +13 -19
  71. package/dist/pluginutils/filter/composable-filters.d.ts +0 -90
  72. package/dist/pluginutils/filter/composable-filters.js +0 -256
  73. package/dist/pluginutils/filter/filter-vite-plugins.d.ts +0 -28
  74. package/dist/pluginutils/filter/filter-vite-plugins.js +0 -75
  75. package/dist/pluginutils/filter/index.d.ts +0 -3
  76. package/dist/pluginutils/filter/index.js +0 -3
  77. package/dist/pluginutils/filter/simple-filters.d.ts +0 -71
  78. package/dist/pluginutils/filter/simple-filters.js +0 -70
  79. package/dist/pluginutils/index.d.ts +0 -1
  80. package/dist/pluginutils/index.js +0 -1
  81. package/dist/pluginutils/utils.d.ts +0 -2
  82. package/dist/pluginutils/utils.js +0 -17
  83. package/dist/tsdown/debug-CLlnG64L-BkAqwHVS.js +0 -16
  84. package/dist/tsdown/dist-Cv2Z0Bi_.js +0 -1012
  85. package/dist/tsdown/filename-DQnUJlio-D7-CzKqs.js +0 -29
  86. package/dist/tsdown/node-B3Gdtau1.js +0 -268
  87. package/dist/vite/node/chunks/chunk.js +0 -35
  88. /package/dist/rolldown/shared/{define-config-DJOr6Iwt.mjs → define-config-Demdg3_4.mjs} +0 -0
  89. /package/dist/rolldown/shared/{logging-C6h4g8dA.d.mts → logging-BSNejiLS.d.mts} +0 -0
  90. /package/dist/rolldown/shared/{logs-D80CXhvg.mjs → logs-aMKUxRpj.mjs} +0 -0
  91. /package/dist/rolldown/shared/{misc-DJYbNKZX.mjs → misc-CoQm4NHO.mjs} +0 -0
  92. /package/dist/tsdown/{chunk-N93fKeF6.js → chunk-DJK8HYOj.js} +0 -0
  93. /package/dist/tsdown/{dist-JaOach5K.js → dist-CZtGyfn3.js} +0 -0
@@ -1,5 +1,4 @@
1
- import { i as __toESM, n as __exportAll, r as __require$1, 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, I as defaultAllowedOrigins, L as loopbackHosts, M as SPECIAL_QUERY_RE, N as VERSION, O as KNOWN_ASSET_TYPES, P as VITE_PACKAGE_DIR, R as wildcardHosts, 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, z as require_picocolors } from "./logger.js";
1
+ import { A as OPTIMIZABLE_ENTRY_RE, B as __commonJSMin, C as ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, D as JS_TYPES_RE, E as FS_PREFIX, H as __require$1, I as defaultAllowedOrigins, L as loopbackHosts, M as SPECIAL_QUERY_RE, N as VERSION, O as KNOWN_ASSET_TYPES, P as VITE_PACKAGE_DIR, R as wildcardHosts, S as ENV_PUBLIC_PATH, T as ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET, U as __toESM, V as __exportAll, _ 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 require_picocolors } from "./logger.js";
3
2
  import { builtinModules, createRequire } from "node:module";
4
3
  import { parseAst, parseAstAsync } from "@voidzero-dev/vite-plus-core/rolldown/parseAst";
5
4
  import { esmExternalRequirePlugin, esmExternalRequirePlugin as esmExternalRequirePlugin$1 } from "@voidzero-dev/vite-plus-core/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 { VERSION as rolldownVersion, rolldown } from "@voidzero-dev/vite-plus-core/rolldown";
16
15
  import os from "node:os";
17
16
  import net from "node:net";
@@ -3061,7 +3060,7 @@ var node_default = createDebug;
3061
3060
  createDebug.default = createDebug;
3062
3061
  createDebug.debug = createDebug;
3063
3062
  //#endregion
3064
- //#region ../../node_modules/.pnpm/@rollup+pluginutils@5.3.0_rollup@4.59.0/node_modules/@rollup/pluginutils/dist/es/index.js
3063
+ //#region ../../node_modules/.pnpm/@rollup+pluginutils@5.3.0_rollup@4.60.4/node_modules/@rollup/pluginutils/dist/es/index.js
3065
3064
  var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch$2(), 1);
3066
3065
  function isArray(arg) {
3067
3066
  return Array.isArray(arg);
@@ -3420,11 +3419,10 @@ const replaceNestedIdRE = /\s*>\s*/g;
3420
3419
  const flattenId = (id) => {
3421
3420
  return limitFlattenIdLength(id.replaceAll(/_+/g, "$&__").replaceAll("/", "_").replaceAll(".", "__").replace(replaceNestedIdRE, "_n_").replace(invalidUrlPathCharRE, (c) => "_0" + c.charCodeAt(0).toString(16) + "_"));
3422
3421
  };
3423
- const FLATTEN_ID_HASH_LENGTH = 8;
3424
3422
  const FLATTEN_ID_MAX_FILE_LENGTH = 170;
3425
3423
  const limitFlattenIdLength = (id, limit = FLATTEN_ID_MAX_FILE_LENGTH) => {
3426
3424
  if (id.length <= limit) return id;
3427
- return id.slice(0, limit - (FLATTEN_ID_HASH_LENGTH + 1)) + "_" + getHash(id);
3425
+ return id.slice(0, limit - 9) + "_" + getHash(id);
3428
3426
  };
3429
3427
  const normalizeId = (id) => id.replace(replaceNestedIdRE, " > ");
3430
3428
  const NODE_BUILTIN_NAMESPACE = "node:";
@@ -4063,10 +4061,12 @@ function mergeWithDefaults(defaults, values) {
4063
4061
  return mergeWithDefaultsRecursively(deepClone(defaults), values);
4064
4062
  }
4065
4063
  const runtimeDeprecatedPath = new Set(["optimizeDeps", "ssr.optimizeDeps"]);
4066
- const rollupOptionsDeprecationCall = () => {
4067
- const method = process.env.VITE_DEPRECATION_TRACE ? "trace" : "warn";
4068
- console[method]("`optimizeDeps.rollupOptions` / `ssr.optimizeDeps.rollupOptions` is deprecated. Use `optimizeDeps.rolldownOptions` instead. Note that this option may be set by a plugin. " + (method === "trace" ? "Showing trace because VITE_DEPRECATION_TRACE is set." : "Set VITE_DEPRECATION_TRACE=1 to see where it is called."));
4069
- };
4064
+ const rollupOptionsDeprecationCall = (() => {
4065
+ return () => {
4066
+ const method = process.env.VITE_DEPRECATION_TRACE ? "trace" : "warn";
4067
+ console[method]("`optimizeDeps.rollupOptions` / `ssr.optimizeDeps.rollupOptions` is deprecated. Use `optimizeDeps.rolldownOptions` instead. Note that this option may be set by a plugin. " + (method === "trace" ? "Showing trace because VITE_DEPRECATION_TRACE is set." : "Set VITE_DEPRECATION_TRACE=1 to see where it is called."));
4068
+ };
4069
+ })();
4070
4070
  function setupRollupOptionCompat(buildConfig, path) {
4071
4071
  buildConfig.rolldownOptions ??= buildConfig.rollupOptions;
4072
4072
  if (runtimeDeprecatedPath.has(path) && buildConfig.rollupOptions && buildConfig.rolldownOptions !== buildConfig.rollupOptions) rollupOptionsDeprecationCall();
@@ -6008,21 +6008,6 @@ function shouldSkipWarning(warning) {
6008
6008
  return false;
6009
6009
  }
6010
6010
  function oxcPlugin(config) {
6011
- if (config.isBundled) return perEnvironmentPlugin("native:transform", (environment) => {
6012
- const { jsxInject, include = /\.(m?ts|[jt]sx)$/, exclude = /\.js$/, jsxRefreshInclude, jsxRefreshExclude, ..._transformOptions } = config.oxc;
6013
- const transformOptions = _transformOptions;
6014
- transformOptions.sourcemap = environment.config.mode !== "build" || !!environment.config.build.sourcemap;
6015
- return viteTransformPlugin({
6016
- root: environment.config.root,
6017
- include,
6018
- exclude,
6019
- jsxRefreshInclude,
6020
- jsxRefreshExclude,
6021
- isServerConsumer: environment.config.consumer === "server",
6022
- jsxInject,
6023
- transformOptions
6024
- });
6025
- });
6026
6011
  const { jsxInject, include, exclude, jsxRefreshInclude, jsxRefreshExclude, ...oxcTransformOptions } = config.oxc;
6027
6012
  const filter = createFilter$1(include || /\.(m?ts|[jt]sx)$/, exclude || /\.js$/);
6028
6013
  const jsxRefreshFilter = jsxRefreshInclude || jsxRefreshExclude ? createFilter$1(jsxRefreshInclude, jsxRefreshExclude) : void 0;
@@ -6047,6 +6032,24 @@ function oxcPlugin(config) {
6047
6032
  let server;
6048
6033
  return {
6049
6034
  name: "vite:oxc",
6035
+ applyToEnvironment(environment) {
6036
+ if (environment.config.isBundled) {
6037
+ const { jsxInject, include = /\.(m?ts|[jt]sx)$/, exclude = /\.js$/, jsxRefreshInclude, jsxRefreshExclude, ..._transformOptions } = environment.config.oxc;
6038
+ const transformOptions = _transformOptions;
6039
+ transformOptions.sourcemap = environment.config.mode !== "build" || !!environment.config.build.sourcemap;
6040
+ return viteTransformPlugin({
6041
+ root: environment.config.root,
6042
+ include,
6043
+ exclude,
6044
+ jsxRefreshInclude,
6045
+ jsxRefreshExclude,
6046
+ isServerConsumer: environment.config.consumer === "server",
6047
+ jsxInject,
6048
+ transformOptions
6049
+ });
6050
+ }
6051
+ return true;
6052
+ },
6050
6053
  configureServer(_server) {
6051
6054
  server = _server;
6052
6055
  },
@@ -6244,7 +6247,7 @@ function getBtoa() {
6244
6247
  throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
6245
6248
  };
6246
6249
  }
6247
- const btoa$1 = /* @__PURE__ */ getBtoa();
6250
+ const btoa$1 = /*#__PURE__*/ getBtoa();
6248
6251
  var SourceMap = class {
6249
6252
  constructor(properties) {
6250
6253
  this.version = 3;
@@ -7034,7 +7037,7 @@ var MagicString = class MagicString {
7034
7037
  }
7035
7038
  };
7036
7039
  //#endregion
7037
- //#region ../../node_modules/.pnpm/@rollup+plugin-alias@6.0.0_rollup@4.59.0/node_modules/@rollup/plugin-alias/dist/index.js
7040
+ //#region ../../node_modules/.pnpm/@rollup+plugin-alias@6.0.0_rollup@4.60.4/node_modules/@rollup/plugin-alias/dist/index.js
7038
7041
  function matches$1(pattern, importee) {
7039
7042
  if (pattern instanceof RegExp) return pattern.test(importee);
7040
7043
  if (importee.length < pattern.length) return false;
@@ -7100,6 +7103,7 @@ function optimizedDepsPlugin() {
7100
7103
  return {
7101
7104
  name: "vite:optimized-deps",
7102
7105
  applyToEnvironment(environment) {
7106
+ if (environment.config.isBundled) return false;
7103
7107
  return !isDepOptimizationDisabled(environment.config.optimizeDeps);
7104
7108
  },
7105
7109
  resolveId(id) {
@@ -15417,6 +15421,10 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15417
15421
  agent: void 0
15418
15422
  };
15419
15423
  }
15424
+ 0 && (module.exports = {
15425
+ KNOWN_AGENTS,
15426
+ determineAgent
15427
+ });
15420
15428
  }));
15421
15429
  //#endregion
15422
15430
  //#region ../../vite/packages/vite/src/node/http.ts
@@ -16207,6 +16215,7 @@ function isRefIdentifier(id, parent, parentStack) {
16207
16215
  if (isNodeInPattern(parent) && parent.value === id) return false;
16208
16216
  if (parent.type === "ArrayPattern" && !isInDestructuringAssignment(parent, parentStack)) return false;
16209
16217
  if (parent.type === "MemberExpression" && parent.property === id && !parent.computed) return false;
16218
+ if ((parent.type === "LabeledStatement" || parent.type === "BreakStatement" || parent.type === "ContinueStatement") && parent.label === id) return false;
16210
16219
  if (parent.type === "MetaProperty") return false;
16211
16220
  if (parent.type === "ExportSpecifier" || parent.type === "ExportAllDeclaration") return false;
16212
16221
  if (id.name === "arguments") return false;
@@ -17353,7 +17362,7 @@ function checkPublicFile(url, config) {
17353
17362
  return tryStatSync(publicFile)?.isFile() ? publicFile : void 0;
17354
17363
  }
17355
17364
  //#endregion
17356
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/constants.js
17365
+ //#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/constants.js
17357
17366
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17358
17367
  const BINARY_TYPES = [
17359
17368
  "nodebuffer",
@@ -17376,7 +17385,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17376
17385
  };
17377
17386
  }));
17378
17387
  //#endregion
17379
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/buffer-util.js
17388
+ //#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/buffer-util.js
17380
17389
  var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17381
17390
  const { EMPTY_BUFFER } = require_constants();
17382
17391
  const FastBuffer = Buffer[Symbol.species];
@@ -17476,7 +17485,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17476
17485
  } catch (e) {}
17477
17486
  }));
17478
17487
  //#endregion
17479
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/limiter.js
17488
+ //#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/limiter.js
17480
17489
  var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17481
17490
  const kDone = Symbol("kDone");
17482
17491
  const kRun = Symbol("kRun");
@@ -17527,7 +17536,7 @@ var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17527
17536
  module.exports = Limiter;
17528
17537
  }));
17529
17538
  //#endregion
17530
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/permessage-deflate.js
17539
+ //#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/permessage-deflate.js
17531
17540
  var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17532
17541
  const zlib$1 = __require$1("zlib");
17533
17542
  const bufferUtil = require_buffer_util();
@@ -17860,7 +17869,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
17860
17869
  }
17861
17870
  }));
17862
17871
  //#endregion
17863
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/validation.js
17872
+ //#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/validation.js
17864
17873
  var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17865
17874
  const { isUtf8 } = __require$1("buffer");
17866
17875
  const { hasBlob } = require_constants();
@@ -18056,7 +18065,7 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18056
18065
  } catch (e) {}
18057
18066
  }));
18058
18067
  //#endregion
18059
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/receiver.js
18068
+ //#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/receiver.js
18060
18069
  var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18061
18070
  const { Writable: Writable$1 } = __require$1("stream");
18062
18071
  const PerMessageDeflate = require_permessage_deflate();
@@ -18503,10 +18512,11 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18503
18512
  module.exports = Receiver;
18504
18513
  }));
18505
18514
  //#endregion
18506
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/sender.js
18515
+ //#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/sender.js
18507
18516
  var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18508
18517
  const { Duplex: Duplex$3 } = __require$1("stream");
18509
18518
  const { randomFillSync } = __require$1("crypto");
18519
+ const { types: { isUint8Array } } = __require$1("util");
18510
18520
  const PerMessageDeflate = require_permessage_deflate();
18511
18521
  const { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
18512
18522
  const { isBlob, isValidStatusCode } = require_validation();
@@ -18650,7 +18660,8 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18650
18660
  buf = Buffer.allocUnsafe(2 + length);
18651
18661
  buf.writeUInt16BE(code, 0);
18652
18662
  if (typeof data === "string") buf.write(data, 2);
18653
- else buf.set(data, 2);
18663
+ else if (isUint8Array(data)) buf.set(data, 2);
18664
+ else throw new TypeError("Second argument must be a string or a Uint8Array");
18654
18665
  }
18655
18666
  const options = {
18656
18667
  [kByteLength]: buf.length,
@@ -18995,7 +19006,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18995
19006
  }
18996
19007
  }));
18997
19008
  //#endregion
18998
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/event-target.js
19009
+ //#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/event-target.js
18999
19010
  var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19000
19011
  const { kForOnEventAttribute, kListener } = require_constants();
19001
19012
  const kCode = Symbol("kCode");
@@ -19226,7 +19237,7 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19226
19237
  }
19227
19238
  }));
19228
19239
  //#endregion
19229
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/extension.js
19240
+ //#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/extension.js
19230
19241
  var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19231
19242
  const { tokenChars } = require_validation();
19232
19243
  /**
@@ -19369,7 +19380,7 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19369
19380
  };
19370
19381
  }));
19371
19382
  //#endregion
19372
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket.js
19383
+ //#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket.js
19373
19384
  var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19374
19385
  const EventEmitter$2 = __require$1("events");
19375
19386
  const https$3 = __require$1("https");
@@ -20344,7 +20355,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20344
20355
  }
20345
20356
  }));
20346
20357
  //#endregion
20347
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/stream.js
20358
+ //#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/stream.js
20348
20359
  var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20349
20360
  require_websocket();
20350
20361
  const { Duplex: Duplex$1 } = __require$1("stream");
@@ -20460,7 +20471,7 @@ var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20460
20471
  module.exports = createWebSocketStream;
20461
20472
  }));
20462
20473
  //#endregion
20463
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/subprotocol.js
20474
+ //#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/subprotocol.js
20464
20475
  var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20465
20476
  const { tokenChars } = require_validation();
20466
20477
  /**
@@ -20499,7 +20510,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20499
20510
  module.exports = { parse };
20500
20511
  }));
20501
20512
  //#endregion
20502
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket-server.js
20513
+ //#region ../../node_modules/.pnpm/ws@8.20.1/node_modules/ws/lib/websocket-server.js
20503
20514
  var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20504
20515
  const EventEmitter$1 = __require$1("events");
20505
20516
  const http$4 = __require$1("http");
@@ -24738,7 +24749,7 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
24738
24749
  source: content
24739
24750
  });
24740
24751
  if (environment.config.command === "build" && noInlineRE.test(postfix)) postfix = postfix.replace(noInlineRE, "").replace(/^&/, "?");
24741
- if (environment.config.command === "serve" && environment.config.experimental.bundledDev) url = toOutputFilePathInJSForBundledDev(environment, pluginContext.getFileName(referenceId));
24752
+ if (environment.config.command === "serve" && environment.config.isBundled) url = toOutputFilePathInJSForBundledDev(environment, pluginContext.getFileName(referenceId));
24742
24753
  else url = `__VITE_ASSET__${referenceId}__${postfix ? `$_${postfix}__` : ``}`;
24743
24754
  }
24744
24755
  cache.set(id, url);
@@ -25125,7 +25136,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25125
25136
  };
25126
25137
  }));
25127
25138
  //#endregion
25128
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.14_tsx@4.21.0_yaml@2.8.2/node_modules/postcss-load-config/src/req.js
25139
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15_tsx@4.22.3_yaml@2.9.0/node_modules/postcss-load-config/src/req.js
25129
25140
  var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25130
25141
  const { createRequire: createRequire$2 } = __require$1("node:module");
25131
25142
  const { fileURLToPath: fileURLToPath$2, pathToFileURL: pathToFileURL$1 } = __require$1("node:url");
@@ -25167,7 +25178,7 @@ var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25167
25178
  module.exports = req;
25168
25179
  }));
25169
25180
  //#endregion
25170
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.14_tsx@4.21.0_yaml@2.8.2/node_modules/postcss-load-config/src/options.js
25181
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15_tsx@4.22.3_yaml@2.9.0/node_modules/postcss-load-config/src/options.js
25171
25182
  var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25172
25183
  const req = require_req();
25173
25184
  /**
@@ -25201,7 +25212,7 @@ var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25201
25212
  module.exports = options;
25202
25213
  }));
25203
25214
  //#endregion
25204
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.14_tsx@4.21.0_yaml@2.8.2/node_modules/postcss-load-config/src/plugins.js
25215
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15_tsx@4.22.3_yaml@2.9.0/node_modules/postcss-load-config/src/plugins.js
25205
25216
  var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25206
25217
  const req = require_req();
25207
25218
  /**
@@ -25255,7 +25266,7 @@ var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25255
25266
  module.exports = plugins;
25256
25267
  }));
25257
25268
  //#endregion
25258
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.14_tsx@4.21.0_yaml@2.8.2/node_modules/postcss-load-config/src/index.js
25269
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15_tsx@4.22.3_yaml@2.9.0/node_modules/postcss-load-config/src/index.js
25259
25270
  var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25260
25271
  const { resolve: resolve$3 } = __require$1("node:path");
25261
25272
  const config = require_src$1();
@@ -25999,8 +26010,8 @@ function cssPlugin(config) {
25999
26010
  preprocessorWorkerController = createPreprocessorWorkerController(normalizeMaxWorkers(config.css.preprocessorMaxWorkers));
26000
26011
  preprocessorWorkerControllerCache.set(config, preprocessorWorkerController);
26001
26012
  },
26002
- buildEnd() {
26003
- preprocessorWorkerController?.close();
26013
+ async buildEnd() {
26014
+ await preprocessorWorkerController?.close();
26004
26015
  },
26005
26016
  load: {
26006
26017
  filter: { id: CSS_LANGS_RE },
@@ -26071,7 +26082,9 @@ function cssPostPlugin(config) {
26071
26082
  else if (typeof assetFileNames === "string") return path.join(path.dirname(assetFileNames), cssAssetNameDir);
26072
26083
  else return path.dirname(assetFileNames({
26073
26084
  type: "asset",
26085
+ name: cssAssetName,
26074
26086
  names: [cssAssetName],
26087
+ originalFileName,
26075
26088
  originalFileNames: originalFileName ? [originalFileName] : [],
26076
26089
  source: "/* vite internal call, ignore */"
26077
26090
  }));
@@ -26128,7 +26141,7 @@ function cssPostPlugin(config) {
26128
26141
  const cssContent = await getContentWithSourcemap(css);
26129
26142
  return {
26130
26143
  code: [
26131
- 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))}`,
26144
+ 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))}`,
26132
26145
  `const __vite__id = ${JSON.stringify(id)}`,
26133
26146
  `const __vite__css = ${JSON.stringify(cssContent)}`,
26134
26147
  `__vite__updateStyle(__vite__id, __vite__css)`,
@@ -26383,6 +26396,9 @@ function injectInlinedCSS(s, ctx, code, format, injectCode) {
26383
26396
  function cssAnalysisPlugin(config) {
26384
26397
  return {
26385
26398
  name: "vite:css-analysis",
26399
+ applyToEnvironment(environment) {
26400
+ return !environment.config.isBundled;
26401
+ },
26386
26402
  transform: {
26387
26403
  filter: { id: {
26388
26404
  include: CSS_LANGS_RE,
@@ -27042,8 +27058,8 @@ const scssProcessor = (maxWorkers) => {
27042
27058
  let failedSassEmbedded;
27043
27059
  const normalizedErrors = /* @__PURE__ */ new WeakSet();
27044
27060
  return {
27045
- close() {
27046
- worker?.stop();
27061
+ async close() {
27062
+ await worker?.stop();
27047
27063
  },
27048
27064
  async process(environment, source, root, options, resolvers) {
27049
27065
  let sassPackage = loadSassPackage(root, failedSassEmbedded ?? false);
@@ -27339,10 +27355,12 @@ const createPreprocessorWorkerController = (maxWorkers) => {
27339
27355
  opts.syntax = "indented";
27340
27356
  return scss.process(environment, source, root, opts, resolvers);
27341
27357
  };
27342
- const close = () => {
27343
- less.close();
27344
- scss.close();
27345
- styl.close();
27358
+ const close = async () => {
27359
+ await Promise.all([
27360
+ less.close(),
27361
+ scss.close(),
27362
+ styl.close()
27363
+ ]);
27346
27364
  };
27347
27365
  return {
27348
27366
  ["less"]: less.process,
@@ -27487,9 +27505,8 @@ async function compileLightningCSS(environment, id, src, deps, workerController,
27487
27505
  };
27488
27506
  }
27489
27507
  function getLightningCssErrorMessageForIeSyntaxes(code) {
27490
- const commonIeMessage = ", 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.";
27491
- if (/[\s;{]\*[a-zA-Z-][\w-]+\s*:/.test(code)) return ".\nThis file contains star property hack (e.g. `*zoom`)" + commonIeMessage;
27492
- if (/min-width:\s*0\\0/.test(code)) return ".\nThis file contains @media zero hack (e.g. `@media (min-width: 0\\0)`)" + commonIeMessage;
27508
+ 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.";
27509
+ 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.";
27493
27510
  }
27494
27511
  const map = {
27495
27512
  chrome: "chrome",
@@ -27639,13 +27656,14 @@ function resolveLibCssFilename(libOptions, root, packageCache) {
27639
27656
  //#endregion
27640
27657
  //#region ../../vite/packages/vite/src/node/plugins/modulePreloadPolyfill.ts
27641
27658
  const modulePreloadPolyfillId = "vite/modulepreload-polyfill";
27642
- const resolvedModulePreloadPolyfillId = "\0" + modulePreloadPolyfillId + ".js";
27643
- function modulePreloadPolyfillPlugin(config) {
27644
- if (config.isBundled) return perEnvironmentPlugin("native:modulepreload-polyfill", (environment) => {
27645
- return viteModulePreloadPolyfillPlugin({ isServer: environment.config.consumer !== "client" });
27646
- });
27659
+ const resolvedModulePreloadPolyfillId = "\0vite/modulepreload-polyfill.js";
27660
+ function modulePreloadPolyfillPlugin() {
27647
27661
  return {
27648
27662
  name: "vite:modulepreload-polyfill",
27663
+ applyToEnvironment(environment) {
27664
+ if (environment.config.isBundled) return viteModulePreloadPolyfillPlugin({ isServer: environment.config.consumer !== "client" });
27665
+ return true;
27666
+ },
27649
27667
  resolveId: {
27650
27668
  filter: { id: exactRegex(modulePreloadPolyfillId) },
27651
27669
  handler(_id) {
@@ -27853,6 +27871,9 @@ function buildHtmlPlugin(config) {
27853
27871
  isAsyncScriptMap.set(config, /* @__PURE__ */ new Map());
27854
27872
  return {
27855
27873
  name: "vite:build-html",
27874
+ applyToEnvironment(environment) {
27875
+ return environment.config.isBundled;
27876
+ },
27856
27877
  transform: {
27857
27878
  filter: { id: /\.html$/ },
27858
27879
  async handler(html, id) {
@@ -28410,7 +28431,6 @@ const nonJsRe = /\.json(?:$|\?)/;
28410
28431
  const isNonJsRequest = (request) => nonJsRe.test(request);
28411
28432
  const escapedDotRE = /(?<!\\)\\./g;
28412
28433
  function definePlugin(config) {
28413
- const isBundled = config.isBundled;
28414
28434
  const isBuild = config.command === "build";
28415
28435
  const isBuildLib = isBuild && config.build.lib;
28416
28436
  const processEnv = {};
@@ -28425,21 +28445,22 @@ function definePlugin(config) {
28425
28445
  "globalThis.process.env.NODE_ENV": JSON.stringify(nodeEnv)
28426
28446
  });
28427
28447
  }
28428
- const importMetaKeys = {};
28429
- const importMetaEnvKeys = {};
28430
- const importMetaFallbackKeys = {};
28431
- if (isBuild) importMetaKeys["import.meta.hot"] = `undefined`;
28432
- if (isBundled) {
28433
- for (const key in config.env) {
28434
- const val = JSON.stringify(config.env[key]);
28435
- importMetaKeys[`import.meta.env.${key}`] = val;
28436
- importMetaEnvKeys[key] = val;
28437
- }
28438
- importMetaKeys["import.meta.env.SSR"] = `undefined`;
28439
- importMetaFallbackKeys["import.meta.env"] = `undefined`;
28440
- }
28441
28448
  function generatePattern(environment) {
28449
+ const isBundled = environment.config.isBundled;
28442
28450
  const keepProcessEnv = environment.config.keepProcessEnv;
28451
+ const importMetaKeys = {};
28452
+ const importMetaEnvKeys = {};
28453
+ const importMetaFallbackKeys = {};
28454
+ if (isBuild) importMetaKeys["import.meta.hot"] = `undefined`;
28455
+ if (isBundled) {
28456
+ for (const key in config.env) {
28457
+ const val = JSON.stringify(config.env[key]);
28458
+ importMetaKeys[`import.meta.env.${key}`] = val;
28459
+ importMetaEnvKeys[key] = val;
28460
+ }
28461
+ importMetaKeys["import.meta.env.SSR"] = `undefined`;
28462
+ importMetaFallbackKeys["import.meta.env"] = `undefined`;
28463
+ }
28443
28464
  const userDefine = {};
28444
28465
  const userDefineEnv = {};
28445
28466
  for (const key in environment.config.define) {
@@ -28477,21 +28498,24 @@ function definePlugin(config) {
28477
28498
  }
28478
28499
  return pattern;
28479
28500
  }
28480
- if (isBundled) return {
28481
- name: "vite:define",
28482
- options(option) {
28483
- const [define, _pattern, importMetaEnvVal] = getPattern(this.environment);
28484
- define["import.meta.env"] = importMetaEnvVal;
28485
- define["import.meta.env.*"] = "undefined";
28486
- option.transform ??= {};
28487
- option.transform.define = {
28488
- ...option.transform.define,
28489
- ...define
28490
- };
28491
- }
28492
- };
28493
28501
  return {
28494
28502
  name: "vite:define",
28503
+ applyToEnvironment(environment) {
28504
+ if (environment.config.isBundled) return {
28505
+ name: "vite:define",
28506
+ options(option) {
28507
+ const [define, _pattern, importMetaEnvVal] = getPattern(this.environment);
28508
+ define["import.meta.env"] = importMetaEnvVal;
28509
+ define["import.meta.env.*"] = "undefined";
28510
+ option.transform ??= {};
28511
+ option.transform.define = {
28512
+ ...option.transform.define,
28513
+ ...define
28514
+ };
28515
+ }
28516
+ };
28517
+ return true;
28518
+ },
28495
28519
  transform: { handler(code, id) {
28496
28520
  if (this.environment.config.consumer === "client") return;
28497
28521
  if (isHTMLRequest(id) || isCSSRequest(id) || isNonJsRequest(id) || config.assetsInclude(id)) return;
@@ -28557,6 +28581,9 @@ function clientInjectionsPlugin(config) {
28557
28581
  });
28558
28582
  return {
28559
28583
  name: "vite:client-inject",
28584
+ applyToEnvironment(environment) {
28585
+ return !environment.config.isBundled;
28586
+ },
28560
28587
  async buildStart() {
28561
28588
  injectConfigValues = await createClientConfigValueReplacer(config);
28562
28589
  },
@@ -30481,6 +30508,7 @@ var MemoryFiles = class {
30481
30508
  };
30482
30509
  var FullBundleDevEnvironment = class extends DevEnvironment {
30483
30510
  devEngine;
30511
+ initialBuildCompleted = false;
30484
30512
  clients = new Clients();
30485
30513
  invalidateCalledModules = /* @__PURE__ */ new Map();
30486
30514
  debouncedFullReload = debounce(20, () => {
@@ -30505,8 +30533,8 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
30505
30533
  if (Array.isArray(rollupOptions.output) && rollupOptions.output.length > 1) throw new Error("multiple output options are not supported in dev mode");
30506
30534
  const outputOptions = Array.isArray(rollupOptions.output) ? rollupOptions.output[0] : rollupOptions.output;
30507
30535
  this.hot.on("vite:module-loaded", (payload, client) => {
30508
- const clientId = this.clients.setupIfNeeded(client);
30509
- this.devEngine.registerModules(clientId, payload.modules);
30536
+ this.clients.setupIfNeeded(client, payload.clientId);
30537
+ this.devEngine.registerModules(payload.clientId, payload.modules);
30510
30538
  });
30511
30539
  this.hot.on("vite:client:disconnect", (_payload, client) => {
30512
30540
  const clientId = this.clients.delete(client);
@@ -30566,6 +30594,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
30566
30594
  type: "full-reload",
30567
30595
  path: "*"
30568
30596
  });
30597
+ this.initialBuildCompleted = true;
30569
30598
  });
30570
30599
  }
30571
30600
  async waitForInitialBuildFinish() {
@@ -30603,7 +30632,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
30603
30632
  }
30604
30633
  async triggerBundleRegenerationIfStale() {
30605
30634
  const bundleState = await this.devEngine.getBundleState();
30606
- const shouldTrigger = bundleState.hasStaleOutput && !bundleState.lastFullBuildFailed;
30635
+ const shouldTrigger = bundleState.hasStaleOutput && !bundleState.lastFullBuildFailed && this.initialBuildCompleted;
30607
30636
  if (shouldTrigger) {
30608
30637
  this.devEngine.ensureLatestBuildOutput().then(() => {
30609
30638
  this.debouncedFullReload();
@@ -30612,15 +30641,25 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
30612
30641
  }
30613
30642
  return shouldTrigger;
30614
30643
  }
30644
+ async triggerLazyBundling(moduleId, clientId) {
30645
+ if (!moduleId || !clientId) return;
30646
+ debug$7?.(`TRIGGER-LAZY: trigger lazy bundling for module ${moduleId} for client ${clientId}`);
30647
+ return await this.devEngine.compileEntry(moduleId, clientId);
30648
+ }
30615
30649
  async close() {
30616
30650
  this.memoryFiles.clear();
30617
30651
  await Promise.all([super.close(), this.devEngine.close()]);
30652
+ this.initialBuildCompleted = false;
30618
30653
  }
30619
30654
  async getRolldownOptions() {
30620
30655
  const chunkMetadataMap = new ChunkMetadataMap();
30621
30656
  const rolldownOptions = resolveRolldownOptions(this, chunkMetadataMap);
30622
30657
  rolldownOptions.experimental ??= {};
30623
- rolldownOptions.experimental.devMode = { implement: await getHmrImplementation(this.getTopLevelConfig()) };
30658
+ rolldownOptions.experimental.devMode = {
30659
+ lazy: true,
30660
+ ...typeof rolldownOptions.experimental.devMode === "object" ? rolldownOptions.experimental.devMode : {},
30661
+ implement: await getHmrImplementation(this.getTopLevelConfig())
30662
+ };
30624
30663
  rolldownOptions.optimization ??= {};
30625
30664
  rolldownOptions.optimization.inlineConst = false;
30626
30665
  if (Array.isArray(rolldownOptions.output)) for (const output of rolldownOptions.output) {
@@ -30686,13 +30725,11 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
30686
30725
  var Clients = class {
30687
30726
  clientToId = /* @__PURE__ */ new Map();
30688
30727
  idToClient = /* @__PURE__ */ new Map();
30689
- setupIfNeeded(client) {
30728
+ setupIfNeeded(client, clientId) {
30690
30729
  const id = this.clientToId.get(client);
30691
- if (id) return id;
30692
- const newId = randomUUID();
30693
- this.clientToId.set(client, newId);
30694
- this.idToClient.set(newId, client);
30695
- return newId;
30730
+ if (id && id !== clientId) throw new Error("client ID conflict detected. Please restart the dev server.");
30731
+ this.clientToId.set(client, clientId);
30732
+ this.idToClient.set(clientId, client);
30696
30733
  }
30697
30734
  get(id) {
30698
30735
  return this.idToClient.get(id);
@@ -30801,13 +30838,16 @@ const wordCharRE = /\w/;
30801
30838
  function isBareRelative(url) {
30802
30839
  return wordCharRE.test(url[0]) && !url.includes(":");
30803
30840
  }
30841
+ function getHtmlDirnameForRelativeUrl(htmlPath) {
30842
+ return htmlPath.endsWith("/") ? htmlPath : path.posix.dirname(htmlPath);
30843
+ }
30804
30844
  const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, server, isClassicScriptLink) => {
30805
30845
  const replacer = (url) => {
30806
30846
  if (url[0] === "/" && url[1] !== "/" || (url[0] === "." || isBareRelative(url)) && originalUrl && originalUrl !== "/" && htmlPath === "/index.html") url = path.posix.join(config.base, url);
30807
30847
  let preTransformUrl;
30808
30848
  if (!isClassicScriptLink && shouldPreTransform(url, config)) {
30809
30849
  if (url[0] === "/" && url[1] !== "/") preTransformUrl = url;
30810
- else if (url[0] === "." || isBareRelative(url)) preTransformUrl = path.posix.join(config.base, path.posix.dirname(htmlPath), url);
30850
+ else if (url[0] === "." || isBareRelative(url)) preTransformUrl = path.posix.join(config.base, getHtmlDirnameForRelativeUrl(htmlPath), url);
30811
30851
  }
30812
30852
  if (server) {
30813
30853
  const mod = server.environments.client.moduleGraph.urlToModuleMap.get(preTransformUrl || url);
@@ -31558,6 +31598,27 @@ function memoryFilesMiddleware(server) {
31558
31598
  };
31559
31599
  }
31560
31600
  //#endregion
31601
+ //#region ../../vite/packages/vite/src/node/server/middlewares/triggerLazyBundling.ts
31602
+ function triggerLazyBundlingMiddleware(server) {
31603
+ const environment = server.environments.client instanceof FullBundleDevEnvironment ? server.environments.client : void 0;
31604
+ if (!environment) throw new Error("triggerLazyBundlingMiddleware can only be used for fullBundleMode");
31605
+ return async function viteTriggerLazyBundlingMiddleware(req, res, next) {
31606
+ if (!req.url?.startsWith("/@vite/lazy?")) return next();
31607
+ let params;
31608
+ try {
31609
+ params = new URL(`http://localhost${req.url}`).searchParams;
31610
+ } catch {
31611
+ return next();
31612
+ }
31613
+ const moduleId = params.get("id");
31614
+ const clientId = params.get("clientId");
31615
+ const code = await environment.triggerLazyBundling(moduleId, clientId);
31616
+ if (code == null) return next();
31617
+ res.setHeader("Content-Type", "application/javascript");
31618
+ return res.end(code);
31619
+ };
31620
+ }
31621
+ //#endregion
31561
31622
  //#region ../../vite/packages/vite/src/node/server/index.ts
31562
31623
  var server_exports = /* @__PURE__ */ __exportAll({
31563
31624
  _createServer: () => _createServer,
@@ -31855,8 +31916,10 @@ async function _createServer(inlineConfig = {}, options) {
31855
31916
  else next();
31856
31917
  });
31857
31918
  if (publicDir) middlewares.use(servePublicMiddleware(server, publicFiles));
31858
- if (config.experimental.bundledDev) middlewares.use(memoryFilesMiddleware(server));
31859
- else {
31919
+ if (config.experimental.bundledDev) {
31920
+ middlewares.use(triggerLazyBundlingMiddleware(server));
31921
+ middlewares.use(memoryFilesMiddleware(server));
31922
+ } else {
31860
31923
  middlewares.use(transformMiddleware(server));
31861
31924
  middlewares.use(serveRawFsMiddleware(server));
31862
31925
  middlewares.use(serveStaticMiddleware(server));
@@ -32735,6 +32798,7 @@ async function bundleWorkerEntry(config, id) {
32735
32798
  const workerEnvironment = new BuildEnvironment("client", await plugins(newBundleChain));
32736
32799
  await workerEnvironment.init();
32737
32800
  const chunkMetadataMap = new ChunkMetadataMap();
32801
+ const workerBuildTarget = workerEnvironment.config.build.target;
32738
32802
  const bundle = await rolldown({
32739
32803
  ...rollupOptions,
32740
32804
  input,
@@ -32742,6 +32806,14 @@ async function bundleWorkerEntry(config, id) {
32742
32806
  onLog(level, log) {
32743
32807
  onRollupLog(level, log, workerEnvironment);
32744
32808
  },
32809
+ transform: {
32810
+ target: workerBuildTarget === false ? void 0 : workerBuildTarget,
32811
+ ...rollupOptions.transform,
32812
+ define: {
32813
+ ...rollupOptions.transform?.define,
32814
+ "process.env.NODE_ENV": "process.env.NODE_ENV"
32815
+ }
32816
+ },
32745
32817
  moduleTypes: {
32746
32818
  ".css": "js",
32747
32819
  ...rollupOptions.moduleTypes
@@ -32800,12 +32872,16 @@ async function workerFileToUrl(config, id) {
32800
32872
  }, config.logger);
32801
32873
  return bundle;
32802
32874
  }
32803
- function webWorkerPostPlugin(config) {
32804
- if (config.isBundled) return perEnvironmentPlugin("native:web-worker-post-plugin", (environment) => {
32805
- if (environment.config.worker.format === "iife") return viteWebWorkerPostPlugin();
32806
- });
32875
+ function webWorkerPostPlugin(_config) {
32807
32876
  return {
32808
32877
  name: "vite:worker-post",
32878
+ applyToEnvironment(environment) {
32879
+ if (environment.config.isBundled) {
32880
+ if (environment.config.worker.format === "iife") return viteWebWorkerPostPlugin();
32881
+ return false;
32882
+ }
32883
+ return true;
32884
+ },
32809
32885
  transform: {
32810
32886
  filter: { code: "import.meta" },
32811
32887
  order: "post",
@@ -32862,13 +32938,14 @@ function webWorkerPlugin(config) {
32862
32938
  if (!workerMatch) return;
32863
32939
  const { format } = config.worker;
32864
32940
  const workerConstructor = workerMatch[1] === "sharedworker" ? "SharedWorker" : "Worker";
32865
- const workerType = config.isBundled ? format === "es" ? "module" : "classic" : "module";
32941
+ const isBundled = this.environment.config.isBundled;
32942
+ const workerType = isBundled ? format === "es" ? "module" : "classic" : "module";
32866
32943
  const workerTypeOption = `{
32867
32944
  ${workerType === "module" ? `type: "module",` : ""}
32868
32945
  name: options?.name
32869
32946
  }`;
32870
32947
  let urlCode;
32871
- if (config.isBundled) if (isWorker && config.bundleChain.at(-1) === cleanUrl(id)) urlCode = "self.location.href";
32948
+ if (isBundled) if (isWorker && config.bundleChain.at(-1) === cleanUrl(id)) urlCode = "self.location.href";
32872
32949
  else if (inlineRE.test(id)) {
32873
32950
  const result = await bundleWorkerEntry(config, id);
32874
32951
  for (const file of result.watchedFiles) this.addWatchFile(file);
@@ -32905,7 +32982,7 @@ function webWorkerPlugin(config) {
32905
32982
  } else {
32906
32983
  const result = await workerFileToUrl(config, id);
32907
32984
  let url;
32908
- if (this.environment.config.command === "serve" && this.environment.config.experimental.bundledDev) url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
32985
+ if (this.environment.config.command === "serve" && this.environment.config.isBundled) url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
32909
32986
  else url = result.entryUrlPlaceholder;
32910
32987
  urlCode = JSON.stringify(url);
32911
32988
  for (const file of result.watchedFiles) this.addWatchFile(file);
@@ -32939,7 +33016,7 @@ function webWorkerPlugin(config) {
32939
33016
  let injectEnv = "";
32940
33017
  if (workerType === "classic") injectEnv = `importScripts(${JSON.stringify(path.posix.join(config.base, ENV_PUBLIC_PATH))})\n`;
32941
33018
  else if (workerType === "module") injectEnv = `import ${JSON.stringify(ENV_PUBLIC_PATH)}\n`;
32942
- else if (workerType === "ignore") if (config.isBundled) injectEnv = "";
33019
+ else if (workerType === "ignore") if (this.environment.config.isBundled) injectEnv = "";
32943
33020
  else {
32944
33021
  const environment = this.environment;
32945
33022
  injectEnv = ((environment.mode === "dev" ? environment.moduleGraph : void 0)?.getModuleById(ENV_ENTRY))?.transformResult?.code || "";
@@ -33023,6 +33100,7 @@ function preAliasPlugin(config) {
33023
33100
  return {
33024
33101
  name: "vite:pre-alias",
33025
33102
  applyToEnvironment(environment) {
33103
+ if (environment.config.isBundled) return false;
33026
33104
  return !isDepOptimizationDisabled(environment.config.optimizeDeps);
33027
33105
  },
33028
33106
  async resolveId(id, importer, options) {
@@ -33169,6 +33247,9 @@ function importAnalysisPlugin(config) {
33169
33247
  }
33170
33248
  return {
33171
33249
  name: "vite:import-analysis",
33250
+ applyToEnvironment(environment) {
33251
+ return !environment.config.isBundled;
33252
+ },
33172
33253
  async transform(source, importer) {
33173
33254
  const environment = this.environment;
33174
33255
  const ssr = environment.config.consumer === "server";
@@ -33658,7 +33739,6 @@ async function getWorkerType(raw, clean, i) {
33658
33739
  }
33659
33740
  const workerImportMetaUrlRE = /\bnew\s+(?:Worker|SharedWorker)\s*\(\s*(new\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*(?:,\s*)?\))/dg;
33660
33741
  function workerImportMetaUrlPlugin(config) {
33661
- const isBundled = config.isBundled;
33662
33742
  let workerResolver;
33663
33743
  const fsResolveOptions = {
33664
33744
  ...config.resolve,
@@ -33676,6 +33756,7 @@ function workerImportMetaUrlPlugin(config) {
33676
33756
  transform: {
33677
33757
  filter: { code: workerImportMetaUrlRE },
33678
33758
  async handler(code, id) {
33759
+ const isBundled = this.environment.config.isBundled;
33679
33760
  let s;
33680
33761
  const cleanString = stripLiteral(code);
33681
33762
  const re = new RegExp(workerImportMetaUrlRE);
@@ -33705,7 +33786,7 @@ function workerImportMetaUrlPlugin(config) {
33705
33786
  let builtUrl;
33706
33787
  if (isBundled) {
33707
33788
  const result = await workerFileToUrl(config, file);
33708
- if (this.environment.config.command === "serve" && this.environment.config.experimental.bundledDev) builtUrl = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
33789
+ if (this.environment.config.command === "serve") builtUrl = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
33709
33790
  else builtUrl = result.entryUrlPlaceholder;
33710
33791
  for (const file of result.watchedFiles) this.addWatchFile(file);
33711
33792
  } else {
@@ -34141,7 +34222,7 @@ function getQueryDelimiterIndex(rawUrl) {
34141
34222
  return -1;
34142
34223
  }
34143
34224
  //#endregion
34144
- //#region ../../node_modules/.pnpm/@rollup+plugin-dynamic-import-vars@2.1.4_rollup@4.59.0/node_modules/@rollup/plugin-dynamic-import-vars/dist/es/index.js
34225
+ //#region ../../node_modules/.pnpm/@rollup+plugin-dynamic-import-vars@2.1.4_rollup@4.60.4/node_modules/@rollup/plugin-dynamic-import-vars/dist/es/index.js
34145
34226
  var VariableDynamicImportError = class extends Error {};
34146
34227
  const example = "For example: import(`./foo/${bar}.js`).";
34147
34228
  function sanitizeString(str) {
@@ -34260,23 +34341,26 @@ function dynamicImportVarsPlugin(config) {
34260
34341
  tryIndex: false,
34261
34342
  extensions: []
34262
34343
  });
34263
- if (config.isBundled) return perEnvironmentPlugin("native:dynamic-import-vars", (environment) => {
34264
- const { include, exclude } = environment.config.build.dynamicImportVarsOptions;
34265
- return viteDynamicImportVarsPlugin({
34266
- include,
34267
- exclude,
34268
- resolver(id, importer) {
34269
- return resolve(environment, id, importer);
34270
- },
34271
- sourcemap: !!environment.config.build.sourcemap
34272
- });
34273
- });
34274
34344
  const getFilter = perEnvironmentState((environment) => {
34275
34345
  const { include, exclude } = environment.config.build.dynamicImportVarsOptions;
34276
34346
  return createFilter$1(include, exclude);
34277
34347
  });
34278
34348
  return {
34279
34349
  name: "vite:dynamic-import-vars",
34350
+ applyToEnvironment(environment) {
34351
+ if (environment.config.isBundled) {
34352
+ const { include, exclude } = environment.config.build.dynamicImportVarsOptions;
34353
+ return viteDynamicImportVarsPlugin({
34354
+ include,
34355
+ exclude,
34356
+ resolver(id, importer) {
34357
+ return resolve(environment, id, importer);
34358
+ },
34359
+ sourcemap: !!environment.config.build.sourcemap
34360
+ });
34361
+ }
34362
+ return true;
34363
+ },
34280
34364
  resolveId: {
34281
34365
  filter: { id: exactRegex(dynamicImportHelperId) },
34282
34366
  handler(id) {
@@ -34334,14 +34418,17 @@ function dynamicImportVarsPlugin(config) {
34334
34418
  //#endregion
34335
34419
  //#region ../../vite/packages/vite/src/node/plugins/importMetaGlob.ts
34336
34420
  function importGlobPlugin(config) {
34337
- if (config.isBundled) return viteImportGlobPlugin({
34338
- root: config.root,
34339
- sourcemap: !!config.build.sourcemap,
34340
- restoreQueryExtension: config.experimental.importGlobRestoreExtension
34341
- });
34342
34421
  const importGlobMaps = /* @__PURE__ */ new Map();
34343
34422
  return {
34344
34423
  name: "vite:import-glob",
34424
+ applyToEnvironment(environment) {
34425
+ if (environment.config.isBundled) return viteImportGlobPlugin({
34426
+ root: environment.config.root,
34427
+ sourcemap: !!environment.config.build.sourcemap,
34428
+ restoreQueryExtension: environment.config.experimental.importGlobRestoreExtension
34429
+ });
34430
+ return true;
34431
+ },
34345
34432
  buildStart() {
34346
34433
  importGlobMaps.clear();
34347
34434
  },
@@ -34566,7 +34653,6 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
34566
34653
  if (options.base) {
34567
34654
  filePath = relative$2(posix.join(options.base[0] === "/" ? root : dir, options.base), file);
34568
34655
  if (!filePath.startsWith("./") && !filePath.startsWith("../")) filePath = `./${filePath}`;
34569
- if (options.base[0] === "/") importPath = `/${relative$2(root, file)}`;
34570
34656
  } else if (isRelative) filePath = importPath;
34571
34657
  else {
34572
34658
  filePath = relative$2(root, file);
@@ -34751,7 +34837,7 @@ function createFilterForTransform(idFilter, codeFilter, moduleTypeFilter, cwd) {
34751
34837
  };
34752
34838
  }
34753
34839
  //#endregion
34754
- //#region ../../node_modules/.pnpm/@vitest+utils@4.1.5/node_modules/@vitest/utils/dist/helpers.js
34840
+ //#region ../../node_modules/.pnpm/@vitest+utils@4.1.7/node_modules/@vitest/utils/dist/helpers.js
34755
34841
  function notNullish(v) {
34756
34842
  return v != null;
34757
34843
  }
@@ -34759,7 +34845,7 @@ function isPrimitive(value) {
34759
34845
  return value === null || typeof value !== "function" && typeof value !== "object";
34760
34846
  }
34761
34847
  //#endregion
34762
- //#region ../../node_modules/.pnpm/@vitest+utils@4.1.5/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
34848
+ //#region ../../node_modules/.pnpm/@vitest+utils@4.1.7/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
34763
34849
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
34764
34850
  function normalizeWindowsPath(input = "") {
34765
34851
  if (!input) return input;
@@ -34838,7 +34924,7 @@ const isAbsolute$2 = function(p) {
34838
34924
  return _IS_ABSOLUTE_RE.test(p);
34839
34925
  };
34840
34926
  //#endregion
34841
- //#region ../../node_modules/.pnpm/@vitest+utils@4.1.5/node_modules/@vitest/utils/dist/source-map.js
34927
+ //#region ../../node_modules/.pnpm/@vitest+utils@4.1.7/node_modules/@vitest/utils/dist/source-map.js
34842
34928
  var comma = ",".charCodeAt(0);
34843
34929
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
34844
34930
  var intToChar = new Uint8Array(64);
@@ -35309,29 +35395,34 @@ function esbuildBannerFooterCompatPlugin(config) {
35309
35395
  //#region ../../vite/packages/vite/src/node/plugins/index.ts
35310
35396
  async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
35311
35397
  const isBuild = config.command === "build";
35312
- const isBundled = config.isBundled;
35313
35398
  const isWorker = config.isWorker;
35314
- const buildPlugins = isBundled ? (await Promise.resolve().then(() => build_exports)).resolveBuildPlugins(config) : {
35399
+ const buildPlugins = isBuild || Object.values(config.environments).some((env) => env.isBundled) ? (await Promise.resolve().then(() => build_exports)).resolveBuildPlugins(config) : {
35315
35400
  pre: [],
35316
35401
  post: []
35317
35402
  };
35318
35403
  const devtoolsIntegrationPlugin = config.devtools.enabled && !isWorker ? await loadDevToolsIntegrationPlugin(config) : null;
35319
35404
  const { modulePreload } = config.build;
35320
35405
  return [
35321
- !isBundled ? optimizedDepsPlugin() : null,
35406
+ optimizedDepsPlugin(),
35322
35407
  !isWorker ? watchPackageDataPlugin(config.packageCache) : null,
35323
- !isBundled ? preAliasPlugin(config) : null,
35324
- isBundled && !config.resolve.alias.some((v) => v.customResolver) ? viteAliasPlugin({ entries: config.resolve.alias.map((item) => {
35325
- return {
35326
- find: item.find,
35327
- replacement: item.replacement
35328
- };
35329
- }) }) : alias$1({
35330
- entries: config.resolve.alias,
35331
- customResolver: viteAliasCustomResolver
35332
- }),
35408
+ preAliasPlugin(config),
35409
+ {
35410
+ ...alias$1({
35411
+ entries: config.resolve.alias,
35412
+ customResolver: viteAliasCustomResolver
35413
+ }),
35414
+ applyToEnvironment(environment) {
35415
+ if (environment.config.isBundled && !environment.config.resolve.alias.some((v) => v.customResolver)) return viteAliasPlugin({ entries: config.resolve.alias.map((item) => {
35416
+ return {
35417
+ find: item.find,
35418
+ replacement: item.replacement
35419
+ };
35420
+ }) });
35421
+ return true;
35422
+ }
35423
+ },
35333
35424
  ...prePlugins,
35334
- modulePreload !== false && modulePreload.polyfill ? modulePreloadPolyfillPlugin(config) : null,
35425
+ modulePreload !== false && modulePreload.polyfill ? modulePreloadPolyfillPlugin() : null,
35335
35426
  ...oxcResolvePlugin({
35336
35427
  root: config.root,
35337
35428
  isProduction: config.isProduction,
@@ -35344,12 +35435,18 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
35344
35435
  }, isWorker ? {
35345
35436
  ...config,
35346
35437
  consumer: "client",
35438
+ isBundled: true,
35347
35439
  optimizeDepsPluginNames: []
35348
35440
  } : void 0),
35349
35441
  htmlInlineProxyPlugin(config),
35350
35442
  cssPlugin(config),
35351
35443
  esbuildBannerFooterCompatPlugin(config),
35352
- config.oxc !== false && !isBundled ? oxcRuntimePlugin() : null,
35444
+ config.oxc !== false ? {
35445
+ ...oxcRuntimePlugin(),
35446
+ applyToEnvironment(environment) {
35447
+ return !environment.config.isBundled;
35448
+ }
35449
+ } : null,
35353
35450
  config.oxc !== false ? oxcPlugin(config) : null,
35354
35451
  viteJsonPlugin({
35355
35452
  ...config.json,
@@ -35363,7 +35460,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
35363
35460
  viteWasmFallbackPlugin(),
35364
35461
  definePlugin(config),
35365
35462
  cssPostPlugin(config),
35366
- isBundled && buildHtmlPlugin(config),
35463
+ buildHtmlPlugin(config),
35367
35464
  workerImportMetaUrlPlugin(config),
35368
35465
  assetImportMetaUrlPlugin(config),
35369
35466
  ...buildPlugins.pre,
@@ -35372,11 +35469,9 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
35372
35469
  ...postPlugins,
35373
35470
  ...buildPlugins.post,
35374
35471
  devtoolsIntegrationPlugin,
35375
- ...isBundled ? [] : [
35376
- clientInjectionsPlugin(config),
35377
- cssAnalysisPlugin(config),
35378
- importAnalysisPlugin(config)
35379
- ]
35472
+ clientInjectionsPlugin(config),
35473
+ cssAnalysisPlugin(config),
35474
+ importAnalysisPlugin(config)
35380
35475
  ].filter(Boolean);
35381
35476
  }
35382
35477
  async function loadDevToolsIntegrationPlugin(config) {
@@ -36244,7 +36339,7 @@ function scanImports(environment) {
36244
36339
  async function scan() {
36245
36340
  const entries = await computeEntries(environment);
36246
36341
  if (!entries.length) {
36247
- 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."));
36342
+ 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."));
36248
36343
  return;
36249
36344
  }
36250
36345
  if (scanContext.cancelled) return;
@@ -36289,25 +36384,26 @@ async function computeEntries(environment) {
36289
36384
  isEntry: true,
36290
36385
  scan: true
36291
36386
  }))?.id;
36292
- if (id === void 0) throw new Error(`failed to resolve rollupOptions.input value: ${JSON.stringify(p)}.`);
36387
+ if (id === void 0) throw new Error(`failed to resolve rolldownOptions.input value: ${JSON.stringify(p)}.`);
36293
36388
  return id;
36294
36389
  };
36295
36390
  if (typeof buildInput === "string") entries = [await resolvePath(buildInput)];
36296
36391
  else if (Array.isArray(buildInput)) entries = await Promise.all(buildInput.map(resolvePath));
36297
36392
  else if (isObject$1(buildInput)) entries = await Promise.all(Object.values(buildInput).map(resolvePath));
36298
- else throw new Error("invalid rollupOptions.input value.");
36393
+ else throw new Error("invalid rolldownOptions.input value.");
36299
36394
  } else entries = await globEntries("**/*.html", environment);
36300
36395
  entries = entries.filter((entry) => isScannable(entry, environment.config.optimizeDeps.extensions) && fs.existsSync(entry));
36301
36396
  return entries;
36302
36397
  }
36303
36398
  async function prepareRolldownScanner(environment, entries, deps, missing) {
36304
36399
  const { plugins: pluginsFromConfig = [], ...rolldownOptions } = environment.config.optimizeDeps.rolldownOptions ?? {};
36305
- const plugins = await asyncFlatten(arraify(pluginsFromConfig));
36306
- plugins.push(...rolldownScanPlugin(environment, deps, missing, entries));
36307
36400
  const transformOptions = deepClone(rolldownOptions.transform) ?? {};
36308
36401
  if (transformOptions.jsx === void 0) transformOptions.jsx = {};
36309
36402
  else if (transformOptions.jsx === "react" || transformOptions.jsx === "react-jsx") transformOptions.jsx = getRollupJsxPresets(transformOptions.jsx);
36310
36403
  if (typeof transformOptions.jsx === "object") transformOptions.jsx.development ??= !environment.config.isProduction;
36404
+ const transformSyncJsxOptions = transformOptions.jsx === false ? void 0 : transformOptions.jsx;
36405
+ const plugins = await asyncFlatten(arraify(pluginsFromConfig));
36406
+ plugins.push(...rolldownScanPlugin(environment, deps, missing, entries, transformSyncJsxOptions));
36311
36407
  async function build() {
36312
36408
  await scan({
36313
36409
  ...rolldownOptions,
@@ -36346,7 +36442,7 @@ const typeRE = /\btype\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
36346
36442
  const langRE = /\blang\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
36347
36443
  const svelteScriptModuleRE = /\bcontext\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
36348
36444
  const svelteModuleRE = /\smodule\b/i;
36349
- function rolldownScanPlugin(environment, depImports, missing, entries) {
36445
+ function rolldownScanPlugin(environment, depImports, missing, entries, jsxOptions) {
36350
36446
  const seen = /* @__PURE__ */ new Map();
36351
36447
  async function resolveId(id, importer, options) {
36352
36448
  return environment.pluginContainer.resolveId(id, importer && normalizePath$1(importer), {
@@ -36380,6 +36476,7 @@ function rolldownScanPlugin(environment, depImports, missing, entries) {
36380
36476
  let transpiledContents;
36381
36477
  if (loader !== "js") {
36382
36478
  const result = transformSync(id, contents, {
36479
+ ...jsxOptions !== void 0 ? { jsx: jsxOptions } : {},
36383
36480
  lang: loader,
36384
36481
  tsconfig: false
36385
36482
  });
@@ -37622,7 +37719,7 @@ const perEnvironmentOrWorkerPlugin = (name, overrideEnvConfig, f) => {
37622
37719
  };
37623
37720
  function oxcResolvePlugin(resolveOptions, overrideEnvConfig) {
37624
37721
  return [...resolveOptions.optimizeDeps && !resolveOptions.isBuild ? [optimizerResolvePlugin(resolveOptions)] : [], ...perEnvironmentOrWorkerPlugin("vite:resolve-builtin", overrideEnvConfig, (partialEnv, getEnv) => {
37625
- const depsOptimizerEnabled = resolveOptions.optimizeDeps && !resolveOptions.isBuild && !partialEnv.config.experimental.bundledDev && !isDepOptimizationDisabled(partialEnv.config.optimizeDeps);
37722
+ const depsOptimizerEnabled = resolveOptions.optimizeDeps && !resolveOptions.isBuild && !partialEnv.config.isBundled && !isDepOptimizationDisabled(partialEnv.config.optimizeDeps);
37626
37723
  const getDepsOptimizer = () => {
37627
37724
  const env = getEnv();
37628
37725
  if (env.mode !== "dev") throw new Error("The environment mode should be dev");
@@ -37707,7 +37804,7 @@ function optimizerResolvePlugin(resolveOptions) {
37707
37804
  return {
37708
37805
  name: "vite:resolve-dev",
37709
37806
  applyToEnvironment(environment) {
37710
- return !environment.config.experimental.bundledDev && !isDepOptimizationDisabled(environment.config.optimizeDeps);
37807
+ return !environment.config.isBundled && !isDepOptimizationDisabled(environment.config.optimizeDeps);
37711
37808
  },
37712
37809
  resolveId: {
37713
37810
  filter: { id: { exclude: [
@@ -38328,9 +38425,9 @@ function prepareOutDirPlugin() {
38328
38425
  order: "pre",
38329
38426
  handler() {
38330
38427
  if (rendered.has(this.environment)) return;
38331
- rendered.add(this.environment);
38332
38428
  const { config } = this.environment;
38333
38429
  if (config.build.write) {
38430
+ rendered.add(this.environment);
38334
38431
  const { root, build: options } = config;
38335
38432
  const resolvedOutDirs = getResolvedOutDirs(root, options.outDir, options.rollupOptions.output);
38336
38433
  prepareOutDir(resolvedOutDirs, resolveEmptyOutDir(options.emptyOutDir, root, resolvedOutDirs, this.environment.logger), this.environment);
@@ -38455,12 +38552,15 @@ function resolveBuildPlugins(config) {
38455
38552
  return {
38456
38553
  pre: [
38457
38554
  ...isBuild && !config.isWorker ? [prepareOutDirPlugin()] : [],
38458
- perEnvironmentPlugin("vite:rollup-options-plugins", async (environment) => (await asyncFlatten(arraify(environment.config.build.rollupOptions.plugins))).filter(Boolean)),
38555
+ perEnvironmentPlugin("vite:rollup-options-plugins", async (environment) => {
38556
+ if (!isBuild && !environment.config.isBundled) return false;
38557
+ return (await asyncFlatten(arraify(environment.config.build.rollupOptions.plugins))).filter(Boolean);
38558
+ }),
38459
38559
  ...config.isWorker ? [webWorkerPostPlugin(config)] : []
38460
38560
  ],
38461
38561
  post: [
38462
38562
  ...isBuild ? buildImportAnalysisPlugin(config) : [],
38463
- ...config.build.minify === "esbuild" ? [buildEsbuildPlugin()] : [],
38563
+ ...isBuild && config.build.minify === "esbuild" ? [buildEsbuildPlugin()] : [],
38464
38564
  ...isBuild ? [terserPlugin(config)] : [],
38465
38565
  ...isBuild && !config.isWorker ? [
38466
38566
  licensePlugin(),
@@ -38528,9 +38628,9 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
38528
38628
  const isSsrTargetWebworkerEnvironment = environment.name === "ssr" && environment.getTopLevelConfig().ssr?.target === "webworker";
38529
38629
  if (isSsrTargetWebworkerEnvironment) plugins.push(esmExternalRequirePlugin());
38530
38630
  const buildOutputOptions = (output = {}) => {
38531
- 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.");
38532
- if (output.file) throw new Error("Vite does not support \"rollupOptions.output.file\". Please use \"rollupOptions.output.dir\" and \"rollupOptions.output.entryFileNames\" instead.");
38533
- if (output.sourcemap) logger.warnOnce(import_picocolors.default.yellow("Vite does not support \"rollupOptions.output.sourcemap\". Please use \"build.sourcemap\" instead."));
38631
+ 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.");
38632
+ if (output.file) throw new Error("Vite does not support \"rolldownOptions.output.file\". Please use \"rolldownOptions.output.dir\" and \"rolldownOptions.output.entryFileNames\" instead.");
38633
+ if (output.sourcemap) logger.warnOnce(import_picocolors.default.yellow("Vite does not support \"rolldownOptions.output.sourcemap\". Please use \"build.sourcemap\" instead."));
38534
38634
  const format = output.format || "es";
38535
38635
  const jsExt = ssr && !isSsrTargetWebworkerEnvironment || libOptions ? resolveOutputJsExtension(format, findNearestPackageData(root, packageCache)?.data.type) : "js";
38536
38636
  return {
@@ -38684,9 +38784,9 @@ function resolveBuildOutputs(outputs, libOptions, logger) {
38684
38784
  format
38685
38785
  }));
38686
38786
  }
38687
- if (libOptions.formats) logger.warn(import_picocolors.default.yellow("\"build.lib.formats\" will be ignored because \"build.rollupOptions.output\" is already an array format."));
38787
+ if (libOptions.formats) logger.warn(import_picocolors.default.yellow("\"build.lib.formats\" will be ignored because \"build.rolldownOptions.output\" is already an array format."));
38688
38788
  outputs.forEach((output) => {
38689
- 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\".");
38789
+ 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\".");
38690
38790
  });
38691
38791
  }
38692
38792
  return outputs;
@@ -38706,7 +38806,7 @@ function onRollupLog(level, log, environment) {
38706
38806
  if (logging.code === "UNRESOLVED_IMPORT") {
38707
38807
  const id = logging.id;
38708
38808
  const exporter = logging.exporter;
38709
- 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\``);
38809
+ 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\``);
38710
38810
  }
38711
38811
  if (logLeveling === "warn") {
38712
38812
  if (logging.plugin === "rollup-plugin-dynamic-import-variables" && dynamicImportWarningIgnoreList.some((msg) => logging.message.includes(msg))) return;
@@ -39423,9 +39523,14 @@ function convertEsbuildPluginToRolldownPlugin(esbuildPlugin) {
39423
39523
  if (!isSetupDone) await setup([{ name: "vite:dep-scan" }], inputOptions.platform ?? "node");
39424
39524
  for (const cb of onStartCallbacks) cb();
39425
39525
  },
39426
- generateBundle() {
39427
- const buildResult = new Proxy({}, { get(_target, _prop) {
39428
- throw new Error("Not implemented");
39526
+ generateBundle(_outputOpts, _bundle, isWrite) {
39527
+ const buildResult = new Proxy({
39528
+ metafile: void 0,
39529
+ mangleCache: void 0,
39530
+ ...isWrite ? { outputFiles: void 0 } : {}
39531
+ }, { get(_target, prop) {
39532
+ if (prop in _target || typeof prop === "symbol") return _target[prop];
39533
+ throw new Error("Not implemented property: " + prop);
39429
39534
  } });
39430
39535
  for (const cb of onEndCallbacks) cb(buildResult);
39431
39536
  },
@@ -39654,9 +39759,11 @@ function resolveDevEnvironmentOptions(dev, environmentName, consumer, preTransfo
39654
39759
  sourcemapIgnoreList: resolved.sourcemapIgnoreList === false ? () => false : resolved.sourcemapIgnoreList
39655
39760
  };
39656
39761
  }
39657
- function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimizeDeps, logger, environmentName, isBundledDev, isSsrTargetWebworkerSet, preTransformRequests) {
39658
- const consumer = options.consumer ?? (environmentName === "client" ? "client" : "server");
39762
+ function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimizeDeps, logger, environmentName, isBuild, isBundledDev, isSsrTargetWebworkerSet, preTransformRequests) {
39763
+ const isClientEnvironment = environmentName === "client";
39764
+ const consumer = options.consumer ?? (isClientEnvironment ? "client" : "server");
39659
39765
  const isSsrTargetWebworkerEnvironment = isSsrTargetWebworkerSet && environmentName === "ssr";
39766
+ const isBundled = options.isBundled ?? (isBuild || isClientEnvironment && isBundledDev);
39660
39767
  if (options.define?.["process.env"]) {
39661
39768
  const processEnvDefine = options.define["process.env"];
39662
39769
  if (typeof processEnvDefine === "object") {
@@ -39672,7 +39779,8 @@ function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimi
39672
39779
  consumer,
39673
39780
  optimizeDeps: resolveDepOptimizationOptions(options.optimizeDeps, resolve.preserveSymlinks, forceOptimizeDeps, consumer, logger),
39674
39781
  dev: resolveDevEnvironmentOptions(options.dev, environmentName, consumer, preTransformRequests),
39675
- build: resolveBuildEnvironmentOptions(options.build ?? {}, logger, consumer, isBundledDev, isSsrTargetWebworkerEnvironment),
39782
+ build: resolveBuildEnvironmentOptions(options.build ?? {}, logger, consumer, isBundled && !isBuild, isSsrTargetWebworkerEnvironment),
39783
+ isBundled,
39676
39784
  plugins: void 0,
39677
39785
  optimizeDepsPluginNames: void 0
39678
39786
  };
@@ -39913,7 +40021,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
39913
40021
  config.resolve.mainFields = config.environments.client.resolve?.mainFields;
39914
40022
  const resolvedDefaultResolve = resolveResolveOptions(config.resolve, logger);
39915
40023
  const resolvedEnvironments = {};
39916
- 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);
40024
+ 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);
39917
40025
  const backwardCompatibleOptimizeDeps = resolvedEnvironments.client.optimizeDeps;
39918
40026
  const resolvedDevEnvironmentOptions = resolveDevEnvironmentOptions(config.dev, void 0, void 0);
39919
40027
  const resolvedBuildOptions = resolveBuildEnvironmentOptions(config.build ?? {}, logger, void 0, isBundledDev);
@@ -40013,7 +40121,6 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
40013
40121
  cacheDir,
40014
40122
  command,
40015
40123
  mode,
40016
- isBundled: config.experimental?.bundledDev || isBuild,
40017
40124
  isWorker: false,
40018
40125
  mainConfig: null,
40019
40126
  bundleChain: [],
@@ -40122,7 +40229,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
40122
40229
  if (assetFileNamesList.length > 1) {
40123
40230
  const firstAssetFileNames = assetFileNamesList[0];
40124
40231
  if (assetFileNamesList.some((assetFileNames) => assetFileNames !== firstAssetFileNames)) resolved.logger.warn(import_picocolors.default.yellow(`
40125
- assetFileNames isn't equal for every build.rollupOptions.output. A single pattern across all outputs is supported by Vite.
40232
+ assetFileNames isn't equal for every build.rolldownOptions.output. A single pattern across all outputs is supported by Vite.
40126
40233
  `));
40127
40234
  }
40128
40235
  }