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

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 (94) hide show
  1. package/LICENSE +37 -26
  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-BZshaq8i-C7uS6x65.js} +1173 -93
  43. package/dist/tsdown/{detect-DN3DXXYt-8gmDjZqp.js → detect-B97OSl92-CgjrIbmD.js} +1 -1
  44. package/dist/tsdown/{dist-DTzJRoOQ.js → dist-BHLOKn-2.js} +526 -224
  45. package/dist/tsdown/index-types.d.ts +30 -12
  46. package/dist/tsdown/index.js +3 -4
  47. package/dist/tsdown/main-nVIFtu2j.js +938 -0
  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-DtsKFXi2-QB-x8j3e.js} +1 -1
  54. package/dist/tsdown/run.js +5 -6
  55. package/dist/tsdown/{tsc-Dr9kCkDm.js → tsc-WMktM0FW.js} +3 -3
  56. package/dist/tsdown/{tsc-context-CANQEB9U.js → tsc-context-DKufFI_s.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 +490 -277
  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 +17 -23
  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/chunk-N93fKeF6.js +0 -34
  84. package/dist/tsdown/debug-CLlnG64L-BkAqwHVS.js +0 -16
  85. package/dist/tsdown/dist-Cv2Z0Bi_.js +0 -1012
  86. package/dist/tsdown/filename-DQnUJlio-D7-CzKqs.js +0 -29
  87. package/dist/tsdown/main-BNUO6D3N.js +0 -893
  88. package/dist/tsdown/node-B3Gdtau1.js +0 -268
  89. package/dist/vite/node/chunks/chunk.js +0 -35
  90. /package/dist/rolldown/shared/{define-config-DJOr6Iwt.mjs → define-config-Demdg3_4.mjs} +0 -0
  91. /package/dist/rolldown/shared/{logging-C6h4g8dA.d.mts → logging-BSNejiLS.d.mts} +0 -0
  92. /package/dist/rolldown/shared/{logs-D80CXhvg.mjs → logs-aMKUxRpj.mjs} +0 -0
  93. /package/dist/rolldown/shared/{misc-DJYbNKZX.mjs → misc-CoQm4NHO.mjs} +0 -0
  94. /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.4.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);
@@ -3160,6 +3159,7 @@ function isWellFormedString(input) {
3160
3159
  if (hasStringIsWellFormed) return input.isWellFormed();
3161
3160
  return !/\p{Surrogate}/u.test(input);
3162
3161
  }
3162
+ const identifierNameRE = /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;
3163
3163
  const dataToEsm = function dataToEsm(data, options = {}) {
3164
3164
  var _a, _b;
3165
3165
  const t = options.compact ? "" : "indent" in options ? options.indent : " ";
@@ -3185,10 +3185,13 @@ const dataToEsm = function dataToEsm(data, options = {}) {
3185
3185
  namedExportCode += `export ${declarationType} ${key}${_}=${_}${serialize(value, options.compact ? null : t, "")};${n}`;
3186
3186
  } else {
3187
3187
  defaultExportRows.push(`${stringify(key)}:${_}${serialize(value, options.compact ? null : t, "")}`);
3188
- if (options.includeArbitraryNames && isWellFormedString(key)) {
3189
- const variableName = `${arbitraryNamePrefix}${arbitraryNameExportRows.length}`;
3190
- namedExportCode += `${declarationType} ${variableName}${_}=${_}${serialize(value, options.compact ? null : t, "")};${n}`;
3191
- arbitraryNameExportRows.push(`${variableName} as ${JSON.stringify(key)}`);
3188
+ if (key !== "default") {
3189
+ const isIdentifierName = identifierNameRE.test(key);
3190
+ if (isIdentifierName || options.includeArbitraryNames && isWellFormedString(key)) {
3191
+ const variableName = `${arbitraryNamePrefix}${arbitraryNameExportRows.length}`;
3192
+ namedExportCode += `${declarationType} ${variableName}${_}=${_}${serialize(value, options.compact ? null : t, "")};${n}`;
3193
+ arbitraryNameExportRows.push(`${variableName} as ${isIdentifierName ? key : JSON.stringify(key)}`);
3194
+ }
3192
3195
  }
3193
3196
  }
3194
3197
  const arbitraryExportCode = arbitraryNameExportRows.length > 0 ? `export${_}{${n}${t}${arbitraryNameExportRows.join(`,${n}${t}`)}${n}};${n}` : "";
@@ -3420,11 +3423,10 @@ const replaceNestedIdRE = /\s*>\s*/g;
3420
3423
  const flattenId = (id) => {
3421
3424
  return limitFlattenIdLength(id.replaceAll(/_+/g, "$&__").replaceAll("/", "_").replaceAll(".", "__").replace(replaceNestedIdRE, "_n_").replace(invalidUrlPathCharRE, (c) => "_0" + c.charCodeAt(0).toString(16) + "_"));
3422
3425
  };
3423
- const FLATTEN_ID_HASH_LENGTH = 8;
3424
3426
  const FLATTEN_ID_MAX_FILE_LENGTH = 170;
3425
3427
  const limitFlattenIdLength = (id, limit = FLATTEN_ID_MAX_FILE_LENGTH) => {
3426
3428
  if (id.length <= limit) return id;
3427
- return id.slice(0, limit - (FLATTEN_ID_HASH_LENGTH + 1)) + "_" + getHash(id);
3429
+ return id.slice(0, limit - 9) + "_" + getHash(id);
3428
3430
  };
3429
3431
  const normalizeId = (id) => id.replace(replaceNestedIdRE, " > ");
3430
3432
  const NODE_BUILTIN_NAMESPACE = "node:";
@@ -3857,11 +3859,11 @@ function processSrcSetSync(srcs, replacer) {
3857
3859
  descriptor
3858
3860
  })));
3859
3861
  }
3860
- const windowsDriveRE = /^[A-Z]:/;
3862
+ const windowsDriveRE$1 = /^[A-Z]:/;
3861
3863
  const replaceWindowsDriveRE = /^([A-Z]):\//;
3862
3864
  const linuxAbsolutePathRE = /^\/[^/]/;
3863
3865
  function escapeToLinuxLikePath(path) {
3864
- if (windowsDriveRE.test(path)) return path.replace(replaceWindowsDriveRE, "/windows/$1/");
3866
+ if (windowsDriveRE$1.test(path)) return path.replace(replaceWindowsDriveRE, "/windows/$1/");
3865
3867
  if (linuxAbsolutePathRE.test(path)) return `/linux${path}`;
3866
3868
  return path;
3867
3869
  }
@@ -4063,10 +4065,12 @@ function mergeWithDefaults(defaults, values) {
4063
4065
  return mergeWithDefaultsRecursively(deepClone(defaults), values);
4064
4066
  }
4065
4067
  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
- };
4068
+ const rollupOptionsDeprecationCall = (() => {
4069
+ return () => {
4070
+ const method = process.env.VITE_DEPRECATION_TRACE ? "trace" : "warn";
4071
+ 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."));
4072
+ };
4073
+ })();
4070
4074
  function setupRollupOptionCompat(buildConfig, path) {
4071
4075
  buildConfig.rolldownOptions ??= buildConfig.rollupOptions;
4072
4076
  if (runtimeDeprecatedPath.has(path) && buildConfig.rollupOptions && buildConfig.rolldownOptions !== buildConfig.rollupOptions) rollupOptionsDeprecationCall();
@@ -5636,9 +5640,10 @@ var Builder = class {
5636
5640
  }
5637
5641
  };
5638
5642
  //#endregion
5639
- //#region ../../node_modules/.pnpm/tinyglobby@0.2.16/node_modules/tinyglobby/dist/index.mjs
5643
+ //#region ../../node_modules/.pnpm/tinyglobby@0.2.17/node_modules/tinyglobby/dist/index.mjs
5640
5644
  const isReadonlyArray = Array.isArray;
5641
5645
  const BACKSLASHES = /\\/g;
5646
+ const DRIVE_RELATIVE_PATH = /^[A-Za-z]:$/;
5642
5647
  const isWin = process.platform === "win32";
5643
5648
  const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
5644
5649
  function getPartialMatcher(patterns, options = {}) {
@@ -5705,6 +5710,9 @@ function buildRelative(cwd, root) {
5705
5710
  return p[p.length - 1] === "/" && result !== "" ? `${result}/` : result || ".";
5706
5711
  };
5707
5712
  }
5713
+ function ensureNonDriveRelativePath(path) {
5714
+ return path.replace(DRIVE_RELATIVE_PATH, (match) => `${match}/`);
5715
+ }
5708
5716
  const splitPatternOptions = { parts: true };
5709
5717
  function splitPattern(path) {
5710
5718
  var _result$parts;
@@ -5766,7 +5774,7 @@ function normalizePattern(pattern, opts, props, isIgnore) {
5766
5774
  }
5767
5775
  const potentialRoot = posix$1.join(cwd, parentDir.slice(i * 3));
5768
5776
  if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
5769
- props.root = potentialRoot;
5777
+ props.root = ensureNonDriveRelativePath(potentialRoot);
5770
5778
  props.depthOffset = -n + i;
5771
5779
  }
5772
5780
  }
@@ -5786,7 +5794,7 @@ function normalizePattern(pattern, opts, props, isIgnore) {
5786
5794
  }
5787
5795
  props.depthOffset = newCommonPath.length;
5788
5796
  props.commonPath = newCommonPath;
5789
- props.root = newCommonPath.length > 0 ? posix$1.join(cwd, ...newCommonPath) : cwd;
5797
+ props.root = ensureNonDriveRelativePath(newCommonPath.length > 0 ? posix$1.join(cwd, ...newCommonPath) : cwd);
5790
5798
  }
5791
5799
  return result;
5792
5800
  }
@@ -5875,18 +5883,15 @@ function formatPaths(paths, mapper) {
5875
5883
  }
5876
5884
  const defaultOptions = {
5877
5885
  caseSensitiveMatch: true,
5878
- cwd: process.cwd(),
5879
5886
  debug: !!process.env.TINYGLOBBY_DEBUG,
5880
5887
  expandDirectories: true,
5881
5888
  followSymbolicLinks: true,
5882
5889
  onlyFiles: true
5883
5890
  };
5884
5891
  function getOptions(options) {
5885
- const opts = {
5886
- ...defaultOptions,
5887
- ...options
5888
- };
5889
- opts.cwd = (opts.cwd instanceof URL ? fileURLToPath$1(opts.cwd) : resolve$1(opts.cwd)).replace(BACKSLASHES, "/");
5892
+ const opts = Object.assign({}, options);
5893
+ for (const key in defaultOptions) if (opts[key] === void 0) Object.assign(opts, { [key]: defaultOptions[key] });
5894
+ opts.cwd = (opts.cwd instanceof URL ? fileURLToPath$1(opts.cwd) : resolve$1(opts.cwd || process.cwd())).replace(BACKSLASHES, "/");
5890
5895
  opts.ignore = ensureStringArray(opts.ignore);
5891
5896
  opts.fs && (opts.fs = {
5892
5897
  readdir: opts.fs.readdir || readdir,
@@ -6008,21 +6013,6 @@ function shouldSkipWarning(warning) {
6008
6013
  return false;
6009
6014
  }
6010
6015
  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
6016
  const { jsxInject, include, exclude, jsxRefreshInclude, jsxRefreshExclude, ...oxcTransformOptions } = config.oxc;
6027
6017
  const filter = createFilter$1(include || /\.(m?ts|[jt]sx)$/, exclude || /\.js$/);
6028
6018
  const jsxRefreshFilter = jsxRefreshInclude || jsxRefreshExclude ? createFilter$1(jsxRefreshInclude, jsxRefreshExclude) : void 0;
@@ -6047,6 +6037,24 @@ function oxcPlugin(config) {
6047
6037
  let server;
6048
6038
  return {
6049
6039
  name: "vite:oxc",
6040
+ applyToEnvironment(environment) {
6041
+ if (environment.config.isBundled) {
6042
+ const { jsxInject, include = /\.(m?ts|[jt]sx)$/, exclude = /\.js$/, jsxRefreshInclude, jsxRefreshExclude, ..._transformOptions } = environment.config.oxc;
6043
+ const transformOptions = _transformOptions;
6044
+ transformOptions.sourcemap = environment.config.mode !== "build" || !!environment.config.build.sourcemap;
6045
+ return viteTransformPlugin({
6046
+ root: environment.config.root,
6047
+ include,
6048
+ exclude,
6049
+ jsxRefreshInclude,
6050
+ jsxRefreshExclude,
6051
+ isServerConsumer: environment.config.consumer === "server",
6052
+ jsxInject,
6053
+ transformOptions
6054
+ });
6055
+ }
6056
+ return true;
6057
+ },
6050
6058
  configureServer(_server) {
6051
6059
  server = _server;
6052
6060
  },
@@ -6244,7 +6252,7 @@ function getBtoa() {
6244
6252
  throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
6245
6253
  };
6246
6254
  }
6247
- const btoa$1 = /* @__PURE__ */ getBtoa();
6255
+ const btoa$1 = /*#__PURE__*/ getBtoa();
6248
6256
  var SourceMap = class {
6249
6257
  constructor(properties) {
6250
6258
  this.version = 3;
@@ -7034,7 +7042,7 @@ var MagicString = class MagicString {
7034
7042
  }
7035
7043
  };
7036
7044
  //#endregion
7037
- //#region ../../node_modules/.pnpm/@rollup+plugin-alias@6.0.0_rollup@4.59.0/node_modules/@rollup/plugin-alias/dist/index.js
7045
+ //#region ../../node_modules/.pnpm/@rollup+plugin-alias@6.0.0_rollup@4.60.4/node_modules/@rollup/plugin-alias/dist/index.js
7038
7046
  function matches$1(pattern, importee) {
7039
7047
  if (pattern instanceof RegExp) return pattern.test(importee);
7040
7048
  if (importee.length < pattern.length) return false;
@@ -7100,6 +7108,7 @@ function optimizedDepsPlugin() {
7100
7108
  return {
7101
7109
  name: "vite:optimized-deps",
7102
7110
  applyToEnvironment(environment) {
7111
+ if (environment.config.isBundled) return false;
7103
7112
  return !isDepOptimizationDisabled(environment.config.optimizeDeps);
7104
7113
  },
7105
7114
  resolveId(id) {
@@ -14746,12 +14755,47 @@ var require_chokidar = /* @__PURE__ */ __commonJSMin(((exports) => {
14746
14755
  exports.watch = watch;
14747
14756
  }));
14748
14757
  //#endregion
14749
- //#region ../../node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/quote.js
14758
+ //#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/quote.js
14750
14759
  var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14760
+ var OPS = [
14761
+ "||",
14762
+ "&&",
14763
+ ";;",
14764
+ "|&",
14765
+ "<(",
14766
+ "<<<",
14767
+ ">>",
14768
+ ">&",
14769
+ "<&",
14770
+ "&",
14771
+ ";",
14772
+ "(",
14773
+ ")",
14774
+ "|",
14775
+ "<",
14776
+ ">"
14777
+ ];
14778
+ var LINE_TERMINATORS = /[\n\r\u2028\u2029]/;
14779
+ var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|]/g;
14751
14780
  module.exports = function quote(xs) {
14752
14781
  return xs.map(function(s) {
14753
14782
  if (s === "") return "''";
14754
- if (s && typeof s === "object") return s.op.replace(/(.)/g, "\\$1");
14783
+ if (s && typeof s === "object") {
14784
+ if (s.op === "glob") {
14785
+ if (typeof s.pattern !== "string") throw new TypeError("glob token requires a string `pattern`");
14786
+ if (LINE_TERMINATORS.test(s.pattern)) throw new TypeError("glob `pattern` must not contain line terminators");
14787
+ return s.pattern.replace(GLOB_SHELL_SPECIAL, "\\$&");
14788
+ }
14789
+ if (typeof s.op === "string") {
14790
+ if (OPS.indexOf(s.op) < 0) throw new TypeError("invalid `op` value: " + JSON.stringify(s.op));
14791
+ return s.op.replace(/[\s\S]/g, "\\$&");
14792
+ }
14793
+ if (typeof s.comment === "string") {
14794
+ if (LINE_TERMINATORS.test(s.comment)) throw new TypeError("`comment` must not contain line terminators");
14795
+ return "#" + s.comment;
14796
+ }
14797
+ throw new TypeError("unrecognized object token shape");
14798
+ }
14755
14799
  if (/["\s\\]/.test(s) && !/'/.test(s)) return "'" + s.replace(/(['])/g, "\\$1") + "'";
14756
14800
  if (/["'\s]/.test(s)) return "\"" + s.replace(/(["\\$`!])/g, "\\$1") + "\"";
14757
14801
  return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, "$1\\$2");
@@ -14759,7 +14803,7 @@ var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14759
14803
  };
14760
14804
  }));
14761
14805
  //#endregion
14762
- //#region ../../node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/parse.js
14806
+ //#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/parse.js
14763
14807
  var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14764
14808
  var CONTROL = "(?:" + [
14765
14809
  "\\|\\|",
@@ -14898,13 +14942,13 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14898
14942
  };
14899
14943
  }));
14900
14944
  //#endregion
14901
- //#region ../../node_modules/.pnpm/shell-quote@1.8.3/node_modules/shell-quote/index.js
14945
+ //#region ../../node_modules/.pnpm/shell-quote@1.8.4/node_modules/shell-quote/index.js
14902
14946
  var require_shell_quote = /* @__PURE__ */ __commonJSMin(((exports) => {
14903
14947
  exports.quote = require_quote();
14904
14948
  exports.parse = require_parse$1();
14905
14949
  }));
14906
14950
  //#endregion
14907
- //#region ../../node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/editor-info/macos.js
14951
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/macos.js
14908
14952
  var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14909
14953
  module.exports = {
14910
14954
  "/Applications/Atom.app/Contents/MacOS/Atom": "atom",
@@ -14939,7 +14983,7 @@ var require_macos = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14939
14983
  };
14940
14984
  }));
14941
14985
  //#endregion
14942
- //#region ../../node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/editor-info/linux.js
14986
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/linux.js
14943
14987
  var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14944
14988
  module.exports = {
14945
14989
  atom: "atom",
@@ -14973,7 +15017,7 @@ var require_linux = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14973
15017
  };
14974
15018
  }));
14975
15019
  //#endregion
14976
- //#region ../../node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/editor-info/windows.js
15020
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/editor-info/windows.js
14977
15021
  var require_windows$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14978
15022
  module.exports = [
14979
15023
  "Brackets.exe",
@@ -15006,7 +15050,7 @@ var require_windows$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15006
15050
  ];
15007
15051
  }));
15008
15052
  //#endregion
15009
- //#region ../../node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/guess.js
15053
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/guess.js
15010
15054
  var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15011
15055
  const path$9 = __require$1("path");
15012
15056
  const shellQuote = require_shell_quote();
@@ -15014,60 +15058,74 @@ var require_guess = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15014
15058
  const COMMON_EDITORS_MACOS = require_macos();
15015
15059
  const COMMON_EDITORS_LINUX = require_linux();
15016
15060
  const COMMON_EDITORS_WIN = require_windows$1();
15017
- module.exports = function guessEditor(specifiedEditor) {
15061
+ function getEditorFromMacProcesses(output) {
15062
+ const processNames = Object.keys(COMMON_EDITORS_MACOS);
15063
+ const processList = output.split("\n");
15064
+ for (let i = 0; i < processNames.length; i++) {
15065
+ const processName = processNames[i];
15066
+ if (processList.includes(processName)) return COMMON_EDITORS_MACOS[processName];
15067
+ const processNameWithoutApplications = processName.replace("/Applications", "");
15068
+ if (output.indexOf(processNameWithoutApplications) !== -1) {
15069
+ if (processName !== COMMON_EDITORS_MACOS[processName]) return COMMON_EDITORS_MACOS[processName];
15070
+ const runningProcess = processList.find((procName) => procName.endsWith(processNameWithoutApplications));
15071
+ if (runningProcess !== void 0) return runningProcess;
15072
+ }
15073
+ }
15074
+ }
15075
+ function getEditorFromWindowsProcesses(output) {
15076
+ const runningProcesses = output.split("\r\n");
15077
+ for (let i = 0; i < runningProcesses.length; i++) {
15078
+ const fullProcessPath = runningProcesses[i].trim();
15079
+ const shortProcessName = path$9.win32.basename(fullProcessPath);
15080
+ if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) return fullProcessPath;
15081
+ }
15082
+ }
15083
+ function getEditorFromLinuxProcesses(output) {
15084
+ const processNames = Object.keys(COMMON_EDITORS_LINUX);
15085
+ for (let i = 0; i < processNames.length; i++) {
15086
+ const processName = processNames[i];
15087
+ if (output.indexOf(processName) !== -1) return COMMON_EDITORS_LINUX[processName];
15088
+ }
15089
+ }
15090
+ function guessEditor(specifiedEditor) {
15018
15091
  if (specifiedEditor) return shellQuote.parse(specifiedEditor);
15019
15092
  if (process.env.LAUNCH_EDITOR) return [process.env.LAUNCH_EDITOR];
15020
15093
  if (process.versions.webcontainer) return [process.env.EDITOR || "code"];
15021
15094
  try {
15022
15095
  if (process.platform === "darwin") {
15023
- const output = childProcess$2.execSync("ps x -o comm=", { stdio: [
15096
+ const editor = getEditorFromMacProcesses(childProcess$2.execSync("ps x -o comm=", { stdio: [
15024
15097
  "pipe",
15025
15098
  "pipe",
15026
15099
  "ignore"
15027
- ] }).toString();
15028
- const processNames = Object.keys(COMMON_EDITORS_MACOS);
15029
- const processList = output.split("\n");
15030
- for (let i = 0; i < processNames.length; i++) {
15031
- const processName = processNames[i];
15032
- if (processList.includes(processName)) return [COMMON_EDITORS_MACOS[processName]];
15033
- const processNameWithoutApplications = processName.replace("/Applications", "");
15034
- if (output.indexOf(processNameWithoutApplications) !== -1) {
15035
- if (processName !== COMMON_EDITORS_MACOS[processName]) return [COMMON_EDITORS_MACOS[processName]];
15036
- const runningProcess = processList.find((procName) => procName.endsWith(processNameWithoutApplications));
15037
- if (runningProcess !== void 0) return [runningProcess];
15038
- }
15039
- }
15100
+ ] }).toString());
15101
+ if (editor !== void 0) return [editor];
15040
15102
  } else if (process.platform === "win32") {
15041
- const runningProcesses = childProcess$2.execSync("powershell -NoProfile -Command \"[Console]::OutputEncoding=[Text.Encoding]::UTF8;Get-CimInstance -Query \\\"select executablepath from win32_process where executablepath is not null\\\" | % { $_.ExecutablePath }\"", { stdio: [
15103
+ const editor = getEditorFromWindowsProcesses(childProcess$2.execSync("powershell -NoProfile -Command \"[Console]::OutputEncoding=[Text.Encoding]::UTF8;Get-CimInstance -Query \\\"select executablepath from win32_process where executablepath is not null\\\" | % { $_.ExecutablePath }\"", { stdio: [
15042
15104
  "pipe",
15043
15105
  "pipe",
15044
15106
  "ignore"
15045
- ] }).toString().split("\r\n");
15046
- for (let i = 0; i < runningProcesses.length; i++) {
15047
- const fullProcessPath = runningProcesses[i].trim();
15048
- const shortProcessName = path$9.basename(fullProcessPath);
15049
- if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) return [fullProcessPath];
15050
- }
15107
+ ] }).toString());
15108
+ if (editor !== void 0) return [editor];
15051
15109
  } else if (process.platform === "linux") {
15052
- const output = childProcess$2.execSync("ps x --no-heading -o comm --sort=comm", { stdio: [
15110
+ const editor = getEditorFromLinuxProcesses(childProcess$2.execSync("ps x --no-heading -o comm --sort=comm", { stdio: [
15053
15111
  "pipe",
15054
15112
  "pipe",
15055
15113
  "ignore"
15056
- ] }).toString();
15057
- const processNames = Object.keys(COMMON_EDITORS_LINUX);
15058
- for (let i = 0; i < processNames.length; i++) {
15059
- const processName = processNames[i];
15060
- if (output.indexOf(processName) !== -1) return [COMMON_EDITORS_LINUX[processName]];
15061
- }
15114
+ ] }).toString());
15115
+ if (editor !== void 0) return [editor];
15062
15116
  }
15063
15117
  } catch (ignoreError) {}
15064
15118
  if (process.env.VISUAL) return [process.env.VISUAL];
15065
15119
  else if (process.env.EDITOR) return [process.env.EDITOR];
15066
15120
  return [null];
15067
- };
15121
+ }
15122
+ module.exports = guessEditor;
15123
+ module.exports.getEditorFromMacProcesses = getEditorFromMacProcesses;
15124
+ module.exports.getEditorFromWindowsProcesses = getEditorFromWindowsProcesses;
15125
+ module.exports.getEditorFromLinuxProcesses = getEditorFromLinuxProcesses;
15068
15126
  }));
15069
15127
  //#endregion
15070
- //#region ../../node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/get-args.js
15128
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/get-args.js
15071
15129
  var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15072
15130
  const path$8 = __require$1("path");
15073
15131
  module.exports = function getArgumentsForPosition(editor, fileName, lineNumber, columnNumber = 1) {
@@ -15146,7 +15204,7 @@ var require_get_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15146
15204
  };
15147
15205
  }));
15148
15206
  //#endregion
15149
- //#region ../../node_modules/.pnpm/launch-editor@2.13.2/node_modules/launch-editor/index.js
15207
+ //#region ../../node_modules/.pnpm/launch-editor@2.14.1/node_modules/launch-editor/index.js
15150
15208
  var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15151
15209
  /**
15152
15210
  * Copyright (c) 2015-present, Facebook, Inc.
@@ -15195,11 +15253,12 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
15195
15253
  columnNumber: match && match[3]
15196
15254
  };
15197
15255
  }
15198
- let _childProcess = null;
15256
+ let currentChildProcess = null;
15199
15257
  function launchEditor(file, specifiedEditor, onErrorCallback) {
15200
15258
  const parsed = parseFile(file);
15201
15259
  let { fileName } = parsed;
15202
15260
  const { lineNumber, columnNumber } = parsed;
15261
+ if (process.platform === "win32" && path$7.resolve(fileName).startsWith("\\\\")) return onErrorCallback(fileName, "UNC paths are not supported on Windows to avoid security issues. See https://github.com/vitejs/launch-editor/tree/main/packages/launch-editor#unc-paths-on-windows for details.");
15203
15262
  if (!fs$6.existsSync(fileName)) return;
15204
15263
  if (typeof specifiedEditor === "function") {
15205
15264
  onErrorCallback = specifiedEditor;
@@ -15216,7 +15275,7 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
15216
15275
  const extraArgs = getArgumentsForPosition(editor, fileName, lineNumber, columnNumber);
15217
15276
  args.push.apply(args, extraArgs);
15218
15277
  } else args.push(fileName);
15219
- if (_childProcess && isTerminalEditor(editor)) _childProcess.kill("SIGKILL");
15278
+ if (currentChildProcess && isTerminalEditor(editor)) currentChildProcess.kill("SIGKILL");
15220
15279
  if (process.platform === "win32") {
15221
15280
  function escapeCmdArgs(cmdArgs) {
15222
15281
  return cmdArgs.replace(/([&|<>,;=^])/g, "^$1");
@@ -15227,16 +15286,16 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
15227
15286
  return str;
15228
15287
  }
15229
15288
  const launchCommand = [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(" ");
15230
- _childProcess = childProcess$1.exec(launchCommand, {
15289
+ currentChildProcess = childProcess$1.exec(launchCommand, {
15231
15290
  stdio: "inherit",
15232
15291
  shell: true
15233
15292
  });
15234
- } else _childProcess = childProcess$1.spawn(editor, args, { stdio: "inherit" });
15235
- _childProcess.on("exit", function(errorCode) {
15236
- _childProcess = null;
15293
+ } else currentChildProcess = childProcess$1.spawn(editor, args, { stdio: "inherit" });
15294
+ currentChildProcess.on("exit", function(errorCode) {
15295
+ currentChildProcess = null;
15237
15296
  if (errorCode) onErrorCallback(fileName, "(code " + errorCode + ")");
15238
15297
  });
15239
- _childProcess.on("error", function(error) {
15298
+ currentChildProcess.on("error", function(error) {
15240
15299
  let { code, message } = error;
15241
15300
  if ("ENOENT" === code) message = `${message} ('${editor}' command does not exist in 'PATH')`;
15242
15301
  onErrorCallback(fileName, message);
@@ -15245,7 +15304,7 @@ var require_launch_editor = /* @__PURE__ */ __commonJSMin(((exports, module) =>
15245
15304
  module.exports = launchEditor;
15246
15305
  }));
15247
15306
  //#endregion
15248
- //#region ../../node_modules/.pnpm/launch-editor-middleware@2.13.2/node_modules/launch-editor-middleware/index.js
15307
+ //#region ../../node_modules/.pnpm/launch-editor-middleware@2.14.1/node_modules/launch-editor-middleware/index.js
15249
15308
  var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15250
15309
  const path$6 = __require$1("path");
15251
15310
  const launch = require_launch_editor();
@@ -15417,6 +15476,10 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15417
15476
  agent: void 0
15418
15477
  };
15419
15478
  }
15479
+ 0 && (module.exports = {
15480
+ KNOWN_AGENTS,
15481
+ determineAgent
15482
+ });
15420
15483
  }));
15421
15484
  //#endregion
15422
15485
  //#region ../../vite/packages/vite/src/node/http.ts
@@ -15515,13 +15578,24 @@ async function httpServerStart(httpServer, serverOptions) {
15515
15578
  }
15516
15579
  function setClientErrorHandler(server, logger) {
15517
15580
  server.on("clientError", (err, socket) => {
15518
- let msg = "400 Bad Request";
15519
- if (err.code === "HPE_HEADER_OVERFLOW") {
15520
- msg = "431 Request Header Fields Too Large";
15521
- logger.warn(import_picocolors.default.yellow("Server responded with status code 431. See https://vite.dev/guide/troubleshooting.html#_431-request-header-fields-too-large."));
15581
+ let msg;
15582
+ switch (err.code) {
15583
+ case "HPE_HEADER_OVERFLOW":
15584
+ msg = "431 Request Header Fields Too Large";
15585
+ logger.warn(import_picocolors.default.yellow("Server responded with status code 431. See https://vite.dev/guide/troubleshooting.html#_431-request-header-fields-too-large."));
15586
+ break;
15587
+ case "HPE_CHUNK_EXTENSIONS_OVERFLOW":
15588
+ msg = "413 Payload Too Large";
15589
+ break;
15590
+ case "ERR_HTTP_REQUEST_TIMEOUT":
15591
+ msg = "408 Request Timeout";
15592
+ break;
15593
+ default:
15594
+ msg = "400 Bad Request";
15595
+ break;
15522
15596
  }
15523
15597
  if (err.code === "ECONNRESET" || !socket.writable) return;
15524
- socket.end(`HTTP/1.1 ${msg}\r\n\r\n`);
15598
+ socket.end(`HTTP/1.1 ${msg}\r\nConnection: close\r\n\r\n`);
15525
15599
  });
15526
15600
  }
15527
15601
  //#endregion
@@ -16207,6 +16281,7 @@ function isRefIdentifier(id, parent, parentStack) {
16207
16281
  if (isNodeInPattern(parent) && parent.value === id) return false;
16208
16282
  if (parent.type === "ArrayPattern" && !isInDestructuringAssignment(parent, parentStack)) return false;
16209
16283
  if (parent.type === "MemberExpression" && parent.property === id && !parent.computed) return false;
16284
+ if ((parent.type === "LabeledStatement" || parent.type === "BreakStatement" || parent.type === "ContinueStatement") && parent.label === id) return false;
16210
16285
  if (parent.type === "MetaProperty") return false;
16211
16286
  if (parent.type === "ExportSpecifier" || parent.type === "ExportAllDeclaration") return false;
16212
16287
  if (id.name === "arguments") return false;
@@ -17353,7 +17428,7 @@ function checkPublicFile(url, config) {
17353
17428
  return tryStatSync(publicFile)?.isFile() ? publicFile : void 0;
17354
17429
  }
17355
17430
  //#endregion
17356
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/constants.js
17431
+ //#region ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/constants.js
17357
17432
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17358
17433
  const BINARY_TYPES = [
17359
17434
  "nodebuffer",
@@ -17376,7 +17451,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17376
17451
  };
17377
17452
  }));
17378
17453
  //#endregion
17379
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/buffer-util.js
17454
+ //#region ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/buffer-util.js
17380
17455
  var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17381
17456
  const { EMPTY_BUFFER } = require_constants();
17382
17457
  const FastBuffer = Buffer[Symbol.species];
@@ -17476,7 +17551,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17476
17551
  } catch (e) {}
17477
17552
  }));
17478
17553
  //#endregion
17479
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/limiter.js
17554
+ //#region ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/limiter.js
17480
17555
  var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17481
17556
  const kDone = Symbol("kDone");
17482
17557
  const kRun = Symbol("kRun");
@@ -17527,7 +17602,7 @@ var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17527
17602
  module.exports = Limiter;
17528
17603
  }));
17529
17604
  //#endregion
17530
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/permessage-deflate.js
17605
+ //#region ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/permessage-deflate.js
17531
17606
  var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17532
17607
  const zlib$1 = __require$1("zlib");
17533
17608
  const bufferUtil = require_buffer_util();
@@ -17860,7 +17935,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
17860
17935
  }
17861
17936
  }));
17862
17937
  //#endregion
17863
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/validation.js
17938
+ //#region ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/validation.js
17864
17939
  var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17865
17940
  const { isUtf8 } = __require$1("buffer");
17866
17941
  const { hasBlob } = require_constants();
@@ -18056,7 +18131,7 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18056
18131
  } catch (e) {}
18057
18132
  }));
18058
18133
  //#endregion
18059
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/receiver.js
18134
+ //#region ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/receiver.js
18060
18135
  var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18061
18136
  const { Writable: Writable$1 } = __require$1("stream");
18062
18137
  const PerMessageDeflate = require_permessage_deflate();
@@ -18089,6 +18164,10 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18089
18164
  * extensions
18090
18165
  * @param {Boolean} [options.isServer=false] Specifies whether to operate in
18091
18166
  * client or server mode
18167
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
18168
+ * buffered data chunks
18169
+ * @param {Number} [options.maxFragments=0] The maximum number of message
18170
+ * fragments
18092
18171
  * @param {Number} [options.maxPayload=0] The maximum allowed message length
18093
18172
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
18094
18173
  * not to skip UTF-8 validation for text and close messages
@@ -18099,6 +18178,8 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18099
18178
  this._binaryType = options.binaryType || BINARY_TYPES[0];
18100
18179
  this._extensions = options.extensions || {};
18101
18180
  this._isServer = !!options.isServer;
18181
+ this._maxBufferedChunks = options.maxBufferedChunks | 0;
18182
+ this._maxFragments = options.maxFragments | 0;
18102
18183
  this._maxPayload = options.maxPayload | 0;
18103
18184
  this._skipUTF8Validation = !!options.skipUTF8Validation;
18104
18185
  this[kWebSocket] = void 0;
@@ -18128,6 +18209,10 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18128
18209
  */
18129
18210
  _write(chunk, encoding, cb) {
18130
18211
  if (this._opcode === 8 && this._state == GET_INFO) return cb();
18212
+ if (this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks) {
18213
+ cb(this.createError(RangeError, "Too many buffered chunks", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS"));
18214
+ return;
18215
+ }
18131
18216
  this._bufferedBytes += chunk.length;
18132
18217
  this._buffers.push(chunk);
18133
18218
  this.startLoop(cb);
@@ -18355,6 +18440,10 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18355
18440
  return;
18356
18441
  }
18357
18442
  if (data.length) {
18443
+ if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
18444
+ cb(this.createError(RangeError, "Too many message fragments", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS"));
18445
+ return;
18446
+ }
18358
18447
  this._messageLength = this._totalPayloadLength;
18359
18448
  this._fragments.push(data);
18360
18449
  }
@@ -18376,6 +18465,10 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18376
18465
  cb(this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
18377
18466
  return;
18378
18467
  }
18468
+ if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
18469
+ cb(this.createError(RangeError, "Too many message fragments", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS"));
18470
+ return;
18471
+ }
18379
18472
  this._fragments.push(buf);
18380
18473
  }
18381
18474
  this.dataMessage(cb);
@@ -18503,10 +18596,11 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18503
18596
  module.exports = Receiver;
18504
18597
  }));
18505
18598
  //#endregion
18506
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/sender.js
18599
+ //#region ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/sender.js
18507
18600
  var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18508
18601
  const { Duplex: Duplex$3 } = __require$1("stream");
18509
18602
  const { randomFillSync } = __require$1("crypto");
18603
+ const { types: { isUint8Array } } = __require$1("util");
18510
18604
  const PerMessageDeflate = require_permessage_deflate();
18511
18605
  const { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
18512
18606
  const { isBlob, isValidStatusCode } = require_validation();
@@ -18650,7 +18744,8 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18650
18744
  buf = Buffer.allocUnsafe(2 + length);
18651
18745
  buf.writeUInt16BE(code, 0);
18652
18746
  if (typeof data === "string") buf.write(data, 2);
18653
- else buf.set(data, 2);
18747
+ else if (isUint8Array(data)) buf.set(data, 2);
18748
+ else throw new TypeError("Second argument must be a string or a Uint8Array");
18654
18749
  }
18655
18750
  const options = {
18656
18751
  [kByteLength]: buf.length,
@@ -18995,7 +19090,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18995
19090
  }
18996
19091
  }));
18997
19092
  //#endregion
18998
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/event-target.js
19093
+ //#region ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/event-target.js
18999
19094
  var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19000
19095
  const { kForOnEventAttribute, kListener } = require_constants();
19001
19096
  const kCode = Symbol("kCode");
@@ -19226,7 +19321,7 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19226
19321
  }
19227
19322
  }));
19228
19323
  //#endregion
19229
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/extension.js
19324
+ //#region ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/extension.js
19230
19325
  var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19231
19326
  const { tokenChars } = require_validation();
19232
19327
  /**
@@ -19369,7 +19464,7 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19369
19464
  };
19370
19465
  }));
19371
19466
  //#endregion
19372
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket.js
19467
+ //#region ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket.js
19373
19468
  var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19374
19469
  const EventEmitter$2 = __require$1("events");
19375
19470
  const https$3 = __require$1("https");
@@ -19531,6 +19626,10 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19531
19626
  * multiple times in the same tick
19532
19627
  * @param {Function} [options.generateMask] The function used to generate the
19533
19628
  * masking key
19629
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
19630
+ * buffered data chunks
19631
+ * @param {Number} [options.maxFragments=0] The maximum number of message
19632
+ * fragments
19534
19633
  * @param {Number} [options.maxPayload=0] The maximum allowed message size
19535
19634
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
19536
19635
  * not to skip UTF-8 validation for text and close messages
@@ -19542,6 +19641,8 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19542
19641
  binaryType: this.binaryType,
19543
19642
  extensions: this._extensions,
19544
19643
  isServer: this._isServer,
19644
+ maxBufferedChunks: options.maxBufferedChunks,
19645
+ maxFragments: options.maxFragments,
19545
19646
  maxPayload: options.maxPayload,
19546
19647
  skipUTF8Validation: options.skipUTF8Validation
19547
19648
  });
@@ -19868,6 +19969,10 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19868
19969
  * masking key
19869
19970
  * @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the
19870
19971
  * handshake request
19972
+ * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
19973
+ * buffered data chunks
19974
+ * @param {Number} [options.maxFragments=131072] The maximum number of message
19975
+ * fragments
19871
19976
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
19872
19977
  * size
19873
19978
  * @param {Number} [options.maxRedirects=10] The maximum number of redirects
@@ -19888,6 +19993,8 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19888
19993
  autoPong: true,
19889
19994
  closeTimeout: CLOSE_TIMEOUT,
19890
19995
  protocolVersion: protocolVersions[1],
19996
+ maxBufferedChunks: 1024 * 1024,
19997
+ maxFragments: 128 * 1024,
19891
19998
  maxPayload: 100 * 1024 * 1024,
19892
19999
  skipUTF8Validation: false,
19893
20000
  perMessageDeflate: true,
@@ -20077,6 +20184,8 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20077
20184
  websocket.setSocket(socket, head, {
20078
20185
  allowSynchronousEvents: opts.allowSynchronousEvents,
20079
20186
  generateMask: opts.generateMask,
20187
+ maxBufferedChunks: opts.maxBufferedChunks,
20188
+ maxFragments: opts.maxFragments,
20080
20189
  maxPayload: opts.maxPayload,
20081
20190
  skipUTF8Validation: opts.skipUTF8Validation
20082
20191
  });
@@ -20344,7 +20453,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20344
20453
  }
20345
20454
  }));
20346
20455
  //#endregion
20347
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/stream.js
20456
+ //#region ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/stream.js
20348
20457
  var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20349
20458
  require_websocket();
20350
20459
  const { Duplex: Duplex$1 } = __require$1("stream");
@@ -20460,7 +20569,7 @@ var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20460
20569
  module.exports = createWebSocketStream;
20461
20570
  }));
20462
20571
  //#endregion
20463
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/subprotocol.js
20572
+ //#region ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/subprotocol.js
20464
20573
  var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20465
20574
  const { tokenChars } = require_validation();
20466
20575
  /**
@@ -20499,7 +20608,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20499
20608
  module.exports = { parse };
20500
20609
  }));
20501
20610
  //#endregion
20502
- //#region ../../node_modules/.pnpm/ws@8.20.0/node_modules/ws/lib/websocket-server.js
20611
+ //#region ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/lib/websocket-server.js
20503
20612
  var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
20504
20613
  const EventEmitter$1 = __require$1("events");
20505
20614
  const http$4 = __require$1("http");
@@ -20538,6 +20647,10 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module)
20538
20647
  * called
20539
20648
  * @param {Function} [options.handleProtocols] A hook to handle protocols
20540
20649
  * @param {String} [options.host] The hostname where to bind the server
20650
+ * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
20651
+ * buffered data chunks
20652
+ * @param {Number} [options.maxFragments=131072] The maximum number of message
20653
+ * fragments
20541
20654
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
20542
20655
  * size
20543
20656
  * @param {Boolean} [options.noServer=false] Enable no server mode
@@ -20559,6 +20672,8 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module)
20559
20672
  options = {
20560
20673
  allowSynchronousEvents: true,
20561
20674
  autoPong: true,
20675
+ maxBufferedChunks: 1024 * 1024,
20676
+ maxFragments: 128 * 1024,
20562
20677
  maxPayload: 100 * 1024 * 1024,
20563
20678
  skipUTF8Validation: false,
20564
20679
  perMessageDeflate: false,
@@ -20788,6 +20903,8 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module)
20788
20903
  socket.removeListener("error", socketOnError);
20789
20904
  ws.setSocket(socket, head, {
20790
20905
  allowSynchronousEvents: this.options.allowSynchronousEvents,
20906
+ maxBufferedChunks: this.options.maxBufferedChunks,
20907
+ maxFragments: this.options.maxFragments,
20791
20908
  maxPayload: this.options.maxPayload,
20792
20909
  skipUTF8Validation: this.options.skipUTF8Validation
20793
20910
  });
@@ -24738,7 +24855,7 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
24738
24855
  source: content
24739
24856
  });
24740
24857
  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));
24858
+ if (environment.config.command === "serve" && environment.config.isBundled) url = toOutputFilePathInJSForBundledDev(environment, pluginContext.getFileName(referenceId));
24742
24859
  else url = `__VITE_ASSET__${referenceId}__${postfix ? `$_${postfix}__` : ``}`;
24743
24860
  }
24744
24861
  cache.set(id, url);
@@ -25125,7 +25242,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25125
25242
  };
25126
25243
  }));
25127
25244
  //#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
25245
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_yaml@2.9.0/node_modules/postcss-load-config/src/req.js
25129
25246
  var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25130
25247
  const { createRequire: createRequire$2 } = __require$1("node:module");
25131
25248
  const { fileURLToPath: fileURLToPath$2, pathToFileURL: pathToFileURL$1 } = __require$1("node:url");
@@ -25167,7 +25284,7 @@ var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25167
25284
  module.exports = req;
25168
25285
  }));
25169
25286
  //#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
25287
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_yaml@2.9.0/node_modules/postcss-load-config/src/options.js
25171
25288
  var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25172
25289
  const req = require_req();
25173
25290
  /**
@@ -25201,7 +25318,7 @@ var require_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25201
25318
  module.exports = options;
25202
25319
  }));
25203
25320
  //#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
25321
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_yaml@2.9.0/node_modules/postcss-load-config/src/plugins.js
25205
25322
  var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25206
25323
  const req = require_req();
25207
25324
  /**
@@ -25255,7 +25372,7 @@ var require_plugins = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25255
25372
  module.exports = plugins;
25256
25373
  }));
25257
25374
  //#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
25375
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15_tsx@4.22.4_yaml@2.9.0/node_modules/postcss-load-config/src/index.js
25259
25376
  var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
25260
25377
  const { resolve: resolve$3 } = __require$1("node:path");
25261
25378
  const config = require_src$1();
@@ -25686,7 +25803,7 @@ function createIdResolver(config, options) {
25686
25803
  tryIndex: true,
25687
25804
  ...options,
25688
25805
  idOnly: true
25689
- }, environment.config)], void 0, false);
25806
+ }, environment.config, true)], void 0, false);
25690
25807
  pluginContainerMap.set(environment, pluginContainer);
25691
25808
  }
25692
25809
  return await pluginContainer.resolveId(id, importer, { scan });
@@ -25999,8 +26116,8 @@ function cssPlugin(config) {
25999
26116
  preprocessorWorkerController = createPreprocessorWorkerController(normalizeMaxWorkers(config.css.preprocessorMaxWorkers));
26000
26117
  preprocessorWorkerControllerCache.set(config, preprocessorWorkerController);
26001
26118
  },
26002
- buildEnd() {
26003
- preprocessorWorkerController?.close();
26119
+ async buildEnd() {
26120
+ await preprocessorWorkerController?.close();
26004
26121
  },
26005
26122
  load: {
26006
26123
  filter: { id: CSS_LANGS_RE },
@@ -26071,7 +26188,9 @@ function cssPostPlugin(config) {
26071
26188
  else if (typeof assetFileNames === "string") return path.join(path.dirname(assetFileNames), cssAssetNameDir);
26072
26189
  else return path.dirname(assetFileNames({
26073
26190
  type: "asset",
26191
+ name: cssAssetName,
26074
26192
  names: [cssAssetName],
26193
+ originalFileName,
26075
26194
  originalFileNames: originalFileName ? [originalFileName] : [],
26076
26195
  source: "/* vite internal call, ignore */"
26077
26196
  }));
@@ -26128,7 +26247,7 @@ function cssPostPlugin(config) {
26128
26247
  const cssContent = await getContentWithSourcemap(css);
26129
26248
  return {
26130
26249
  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))}`,
26250
+ 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
26251
  `const __vite__id = ${JSON.stringify(id)}`,
26133
26252
  `const __vite__css = ${JSON.stringify(cssContent)}`,
26134
26253
  `__vite__updateStyle(__vite__id, __vite__css)`,
@@ -26383,6 +26502,9 @@ function injectInlinedCSS(s, ctx, code, format, injectCode) {
26383
26502
  function cssAnalysisPlugin(config) {
26384
26503
  return {
26385
26504
  name: "vite:css-analysis",
26505
+ applyToEnvironment(environment) {
26506
+ return !environment.config.isBundled;
26507
+ },
26386
26508
  transform: {
26387
26509
  filter: { id: {
26388
26510
  include: CSS_LANGS_RE,
@@ -27042,8 +27164,8 @@ const scssProcessor = (maxWorkers) => {
27042
27164
  let failedSassEmbedded;
27043
27165
  const normalizedErrors = /* @__PURE__ */ new WeakSet();
27044
27166
  return {
27045
- close() {
27046
- worker?.stop();
27167
+ async close() {
27168
+ await worker?.stop();
27047
27169
  },
27048
27170
  async process(environment, source, root, options, resolvers) {
27049
27171
  let sassPackage = loadSassPackage(root, failedSassEmbedded ?? false);
@@ -27339,10 +27461,12 @@ const createPreprocessorWorkerController = (maxWorkers) => {
27339
27461
  opts.syntax = "indented";
27340
27462
  return scss.process(environment, source, root, opts, resolvers);
27341
27463
  };
27342
- const close = () => {
27343
- less.close();
27344
- scss.close();
27345
- styl.close();
27464
+ const close = async () => {
27465
+ await Promise.all([
27466
+ less.close(),
27467
+ scss.close(),
27468
+ styl.close()
27469
+ ]);
27346
27470
  };
27347
27471
  return {
27348
27472
  ["less"]: less.process,
@@ -27487,9 +27611,8 @@ async function compileLightningCSS(environment, id, src, deps, workerController,
27487
27611
  };
27488
27612
  }
27489
27613
  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;
27614
+ 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.";
27615
+ 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
27616
  }
27494
27617
  const map = {
27495
27618
  chrome: "chrome",
@@ -27639,13 +27762,14 @@ function resolveLibCssFilename(libOptions, root, packageCache) {
27639
27762
  //#endregion
27640
27763
  //#region ../../vite/packages/vite/src/node/plugins/modulePreloadPolyfill.ts
27641
27764
  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
- });
27765
+ const resolvedModulePreloadPolyfillId = "\0vite/modulepreload-polyfill.js";
27766
+ function modulePreloadPolyfillPlugin() {
27647
27767
  return {
27648
27768
  name: "vite:modulepreload-polyfill",
27769
+ applyToEnvironment(environment) {
27770
+ if (environment.config.isBundled) return viteModulePreloadPolyfillPlugin({ isServer: environment.config.consumer !== "client" });
27771
+ return true;
27772
+ },
27649
27773
  resolveId: {
27650
27774
  filter: { id: exactRegex(modulePreloadPolyfillId) },
27651
27775
  handler(_id) {
@@ -27853,6 +27977,9 @@ function buildHtmlPlugin(config) {
27853
27977
  isAsyncScriptMap.set(config, /* @__PURE__ */ new Map());
27854
27978
  return {
27855
27979
  name: "vite:build-html",
27980
+ applyToEnvironment(environment) {
27981
+ return environment.config.isBundled;
27982
+ },
27856
27983
  transform: {
27857
27984
  filter: { id: /\.html$/ },
27858
27985
  async handler(html, id) {
@@ -28410,7 +28537,6 @@ const nonJsRe = /\.json(?:$|\?)/;
28410
28537
  const isNonJsRequest = (request) => nonJsRe.test(request);
28411
28538
  const escapedDotRE = /(?<!\\)\\./g;
28412
28539
  function definePlugin(config) {
28413
- const isBundled = config.isBundled;
28414
28540
  const isBuild = config.command === "build";
28415
28541
  const isBuildLib = isBuild && config.build.lib;
28416
28542
  const processEnv = {};
@@ -28425,21 +28551,22 @@ function definePlugin(config) {
28425
28551
  "globalThis.process.env.NODE_ENV": JSON.stringify(nodeEnv)
28426
28552
  });
28427
28553
  }
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
28554
  function generatePattern(environment) {
28555
+ const isBundled = environment.config.isBundled;
28442
28556
  const keepProcessEnv = environment.config.keepProcessEnv;
28557
+ const importMetaKeys = {};
28558
+ const importMetaEnvKeys = {};
28559
+ const importMetaFallbackKeys = {};
28560
+ if (isBuild) importMetaKeys["import.meta.hot"] = `undefined`;
28561
+ if (isBundled) {
28562
+ for (const key in config.env) {
28563
+ const val = JSON.stringify(config.env[key]);
28564
+ importMetaKeys[`import.meta.env.${key}`] = val;
28565
+ importMetaEnvKeys[key] = val;
28566
+ }
28567
+ importMetaKeys["import.meta.env.SSR"] = `undefined`;
28568
+ importMetaFallbackKeys["import.meta.env"] = `undefined`;
28569
+ }
28443
28570
  const userDefine = {};
28444
28571
  const userDefineEnv = {};
28445
28572
  for (const key in environment.config.define) {
@@ -28477,21 +28604,24 @@ function definePlugin(config) {
28477
28604
  }
28478
28605
  return pattern;
28479
28606
  }
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
28607
  return {
28494
28608
  name: "vite:define",
28609
+ applyToEnvironment(environment) {
28610
+ if (environment.config.isBundled) return {
28611
+ name: "vite:define",
28612
+ options(option) {
28613
+ const [define, _pattern, importMetaEnvVal] = getPattern(this.environment);
28614
+ define["import.meta.env"] = importMetaEnvVal;
28615
+ define["import.meta.env.*"] = "undefined";
28616
+ option.transform ??= {};
28617
+ option.transform.define = {
28618
+ ...option.transform.define,
28619
+ ...define
28620
+ };
28621
+ }
28622
+ };
28623
+ return true;
28624
+ },
28495
28625
  transform: { handler(code, id) {
28496
28626
  if (this.environment.config.consumer === "client") return;
28497
28627
  if (isHTMLRequest(id) || isCSSRequest(id) || isNonJsRequest(id) || config.assetsInclude(id)) return;
@@ -28557,6 +28687,9 @@ function clientInjectionsPlugin(config) {
28557
28687
  });
28558
28688
  return {
28559
28689
  name: "vite:client-inject",
28690
+ applyToEnvironment(environment) {
28691
+ return !environment.config.isBundled;
28692
+ },
28560
28693
  async buildStart() {
28561
28694
  injectConfigValues = await createClientConfigValueReplacer(config);
28562
28695
  },
@@ -29685,12 +29818,15 @@ function isFileServingAllowed(configOrUrl, urlOrServer) {
29685
29818
  function isFileInTargetPath(targetPath, filePath) {
29686
29819
  return isSameFilePath(targetPath, filePath) || isParentDirectory(targetPath, filePath);
29687
29820
  }
29821
+ const windowsDriveRE = /^[A-Z]:/i;
29688
29822
  /**
29689
29823
  * Warning: parameters are not validated, only works with normalized absolute paths
29690
29824
  */
29691
29825
  function isFileLoadingAllowed(config, filePath) {
29692
29826
  const { fs } = config.server;
29693
29827
  if (!fs.strict) return true;
29828
+ if (isWindows && filePath.includes("~")) return false;
29829
+ if ((isWindows && windowsDriveRE.test(filePath) ? filePath.slice(2) : filePath).includes(":")) return false;
29694
29830
  const filePathWithoutTrailingSlash = filePath.endsWith("/") ? filePath.slice(0, -1) : filePath;
29695
29831
  if (config.fsDenyGlob(filePathWithoutTrailingSlash)) return false;
29696
29832
  if (config.safeModulePaths.has(filePath)) return true;
@@ -30481,6 +30617,7 @@ var MemoryFiles = class {
30481
30617
  };
30482
30618
  var FullBundleDevEnvironment = class extends DevEnvironment {
30483
30619
  devEngine;
30620
+ initialBuildCompleted = false;
30484
30621
  clients = new Clients();
30485
30622
  invalidateCalledModules = /* @__PURE__ */ new Map();
30486
30623
  debouncedFullReload = debounce(20, () => {
@@ -30505,8 +30642,8 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
30505
30642
  if (Array.isArray(rollupOptions.output) && rollupOptions.output.length > 1) throw new Error("multiple output options are not supported in dev mode");
30506
30643
  const outputOptions = Array.isArray(rollupOptions.output) ? rollupOptions.output[0] : rollupOptions.output;
30507
30644
  this.hot.on("vite:module-loaded", (payload, client) => {
30508
- const clientId = this.clients.setupIfNeeded(client);
30509
- this.devEngine.registerModules(clientId, payload.modules);
30645
+ this.clients.setupIfNeeded(client, payload.clientId);
30646
+ this.devEngine.registerModules(payload.clientId, payload.modules);
30510
30647
  });
30511
30648
  this.hot.on("vite:client:disconnect", (_payload, client) => {
30512
30649
  const clientId = this.clients.delete(client);
@@ -30566,6 +30703,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
30566
30703
  type: "full-reload",
30567
30704
  path: "*"
30568
30705
  });
30706
+ this.initialBuildCompleted = true;
30569
30707
  });
30570
30708
  }
30571
30709
  async waitForInitialBuildFinish() {
@@ -30603,7 +30741,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
30603
30741
  }
30604
30742
  async triggerBundleRegenerationIfStale() {
30605
30743
  const bundleState = await this.devEngine.getBundleState();
30606
- const shouldTrigger = bundleState.hasStaleOutput && !bundleState.lastFullBuildFailed;
30744
+ const shouldTrigger = bundleState.hasStaleOutput && !bundleState.lastFullBuildFailed && this.initialBuildCompleted;
30607
30745
  if (shouldTrigger) {
30608
30746
  this.devEngine.ensureLatestBuildOutput().then(() => {
30609
30747
  this.debouncedFullReload();
@@ -30612,15 +30750,25 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
30612
30750
  }
30613
30751
  return shouldTrigger;
30614
30752
  }
30753
+ async triggerLazyBundling(moduleId, clientId) {
30754
+ if (!moduleId || !clientId) return;
30755
+ debug$7?.(`TRIGGER-LAZY: trigger lazy bundling for module ${moduleId} for client ${clientId}`);
30756
+ return await this.devEngine.compileEntry(moduleId, clientId);
30757
+ }
30615
30758
  async close() {
30616
30759
  this.memoryFiles.clear();
30617
30760
  await Promise.all([super.close(), this.devEngine.close()]);
30761
+ this.initialBuildCompleted = false;
30618
30762
  }
30619
30763
  async getRolldownOptions() {
30620
30764
  const chunkMetadataMap = new ChunkMetadataMap();
30621
30765
  const rolldownOptions = resolveRolldownOptions(this, chunkMetadataMap);
30622
30766
  rolldownOptions.experimental ??= {};
30623
- rolldownOptions.experimental.devMode = { implement: await getHmrImplementation(this.getTopLevelConfig()) };
30767
+ rolldownOptions.experimental.devMode = {
30768
+ lazy: true,
30769
+ ...typeof rolldownOptions.experimental.devMode === "object" ? rolldownOptions.experimental.devMode : {},
30770
+ implement: await getHmrImplementation(this.getTopLevelConfig())
30771
+ };
30624
30772
  rolldownOptions.optimization ??= {};
30625
30773
  rolldownOptions.optimization.inlineConst = false;
30626
30774
  if (Array.isArray(rolldownOptions.output)) for (const output of rolldownOptions.output) {
@@ -30686,13 +30834,11 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
30686
30834
  var Clients = class {
30687
30835
  clientToId = /* @__PURE__ */ new Map();
30688
30836
  idToClient = /* @__PURE__ */ new Map();
30689
- setupIfNeeded(client) {
30837
+ setupIfNeeded(client, clientId) {
30690
30838
  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;
30839
+ if (id && id !== clientId) throw new Error("client ID conflict detected. Please restart the dev server.");
30840
+ this.clientToId.set(client, clientId);
30841
+ this.idToClient.set(clientId, client);
30696
30842
  }
30697
30843
  get(id) {
30698
30844
  return this.idToClient.get(id);
@@ -30801,13 +30947,16 @@ const wordCharRE = /\w/;
30801
30947
  function isBareRelative(url) {
30802
30948
  return wordCharRE.test(url[0]) && !url.includes(":");
30803
30949
  }
30950
+ function getHtmlDirnameForRelativeUrl(htmlPath) {
30951
+ return htmlPath.endsWith("/") ? htmlPath : path.posix.dirname(htmlPath);
30952
+ }
30804
30953
  const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, server, isClassicScriptLink) => {
30805
30954
  const replacer = (url) => {
30806
30955
  if (url[0] === "/" && url[1] !== "/" || (url[0] === "." || isBareRelative(url)) && originalUrl && originalUrl !== "/" && htmlPath === "/index.html") url = path.posix.join(config.base, url);
30807
30956
  let preTransformUrl;
30808
30957
  if (!isClassicScriptLink && shouldPreTransform(url, config)) {
30809
30958
  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);
30959
+ else if (url[0] === "." || isBareRelative(url)) preTransformUrl = path.posix.join(config.base, getHtmlDirnameForRelativeUrl(htmlPath), url);
30811
30960
  }
30812
30961
  if (server) {
30813
30962
  const mod = server.environments.client.moduleGraph.urlToModuleMap.get(preTransformUrl || url);
@@ -30833,8 +30982,8 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
30833
30982
  let proxyModuleUrl;
30834
30983
  const trailingSlash = htmlPath.endsWith("/");
30835
30984
  if (!trailingSlash && fs.existsSync(filename)) {
30836
- proxyModulePath = htmlPath;
30837
- proxyModuleUrl = proxyModulePath;
30985
+ proxyModulePath = htmlPath.startsWith(FS_PREFIX) ? filename : htmlPath;
30986
+ proxyModuleUrl = htmlPath;
30838
30987
  } else {
30839
30988
  proxyModulePath = `\0${`${htmlPath}${trailingSlash ? "index.html" : ""}`}`;
30840
30989
  proxyModuleUrl = wrapId(proxyModulePath);
@@ -31558,6 +31707,27 @@ function memoryFilesMiddleware(server) {
31558
31707
  };
31559
31708
  }
31560
31709
  //#endregion
31710
+ //#region ../../vite/packages/vite/src/node/server/middlewares/triggerLazyBundling.ts
31711
+ function triggerLazyBundlingMiddleware(server) {
31712
+ const environment = server.environments.client instanceof FullBundleDevEnvironment ? server.environments.client : void 0;
31713
+ if (!environment) throw new Error("triggerLazyBundlingMiddleware can only be used for fullBundleMode");
31714
+ return async function viteTriggerLazyBundlingMiddleware(req, res, next) {
31715
+ if (!req.url?.startsWith("/@vite/lazy?")) return next();
31716
+ let params;
31717
+ try {
31718
+ params = new URL(`http://localhost${req.url}`).searchParams;
31719
+ } catch {
31720
+ return next();
31721
+ }
31722
+ const moduleId = params.get("id");
31723
+ const clientId = params.get("clientId");
31724
+ const code = await environment.triggerLazyBundling(moduleId, clientId);
31725
+ if (code == null) return next();
31726
+ res.setHeader("Content-Type", "application/javascript");
31727
+ return res.end(code);
31728
+ };
31729
+ }
31730
+ //#endregion
31561
31731
  //#region ../../vite/packages/vite/src/node/server/index.ts
31562
31732
  var server_exports = /* @__PURE__ */ __exportAll({
31563
31733
  _createServer: () => _createServer,
@@ -31746,8 +31916,8 @@ async function _createServer(inlineConfig = {}, options) {
31746
31916
  },
31747
31917
  printUrls() {
31748
31918
  if (server.resolvedUrls) printServerUrls(server.resolvedUrls, serverConfig.host, config.logger.info);
31749
- else if (middlewareMode) throw new Error("cannot print server URLs in middleware mode.");
31750
- else throw new Error("cannot print server URLs before server.listen is called.");
31919
+ else if (middlewareMode) throw new Error("Cannot print server URLs in middleware mode.");
31920
+ else throw new Error("Cannot print server URLs before server.listen is called.");
31751
31921
  },
31752
31922
  bindCLIShortcuts(options) {
31753
31923
  bindCLIShortcuts(server, options);
@@ -31855,8 +32025,10 @@ async function _createServer(inlineConfig = {}, options) {
31855
32025
  else next();
31856
32026
  });
31857
32027
  if (publicDir) middlewares.use(servePublicMiddleware(server, publicFiles));
31858
- if (config.experimental.bundledDev) middlewares.use(memoryFilesMiddleware(server));
31859
- else {
32028
+ if (config.experimental.bundledDev) {
32029
+ middlewares.use(triggerLazyBundlingMiddleware(server));
32030
+ middlewares.use(memoryFilesMiddleware(server));
32031
+ } else {
31860
32032
  middlewares.use(transformMiddleware(server));
31861
32033
  middlewares.use(serveRawFsMiddleware(server));
31862
32034
  middlewares.use(serveStaticMiddleware(server));
@@ -32735,6 +32907,7 @@ async function bundleWorkerEntry(config, id) {
32735
32907
  const workerEnvironment = new BuildEnvironment("client", await plugins(newBundleChain));
32736
32908
  await workerEnvironment.init();
32737
32909
  const chunkMetadataMap = new ChunkMetadataMap();
32910
+ const workerBuildTarget = workerEnvironment.config.build.target;
32738
32911
  const bundle = await rolldown({
32739
32912
  ...rollupOptions,
32740
32913
  input,
@@ -32742,6 +32915,14 @@ async function bundleWorkerEntry(config, id) {
32742
32915
  onLog(level, log) {
32743
32916
  onRollupLog(level, log, workerEnvironment);
32744
32917
  },
32918
+ transform: {
32919
+ target: workerBuildTarget === false ? void 0 : workerBuildTarget,
32920
+ ...rollupOptions.transform,
32921
+ define: {
32922
+ ...rollupOptions.transform?.define,
32923
+ "process.env.NODE_ENV": "process.env.NODE_ENV"
32924
+ }
32925
+ },
32745
32926
  moduleTypes: {
32746
32927
  ".css": "js",
32747
32928
  ...rollupOptions.moduleTypes
@@ -32800,12 +32981,16 @@ async function workerFileToUrl(config, id) {
32800
32981
  }, config.logger);
32801
32982
  return bundle;
32802
32983
  }
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
- });
32984
+ function webWorkerPostPlugin(_config) {
32807
32985
  return {
32808
32986
  name: "vite:worker-post",
32987
+ applyToEnvironment(environment) {
32988
+ if (environment.config.isBundled) {
32989
+ if (environment.config.worker.format === "iife") return viteWebWorkerPostPlugin();
32990
+ return false;
32991
+ }
32992
+ return true;
32993
+ },
32809
32994
  transform: {
32810
32995
  filter: { code: "import.meta" },
32811
32996
  order: "post",
@@ -32862,13 +33047,14 @@ function webWorkerPlugin(config) {
32862
33047
  if (!workerMatch) return;
32863
33048
  const { format } = config.worker;
32864
33049
  const workerConstructor = workerMatch[1] === "sharedworker" ? "SharedWorker" : "Worker";
32865
- const workerType = config.isBundled ? format === "es" ? "module" : "classic" : "module";
33050
+ const isBundled = this.environment.config.isBundled;
33051
+ const workerType = isBundled ? format === "es" ? "module" : "classic" : "module";
32866
33052
  const workerTypeOption = `{
32867
33053
  ${workerType === "module" ? `type: "module",` : ""}
32868
33054
  name: options?.name
32869
33055
  }`;
32870
33056
  let urlCode;
32871
- if (config.isBundled) if (isWorker && config.bundleChain.at(-1) === cleanUrl(id)) urlCode = "self.location.href";
33057
+ if (isBundled) if (isWorker && config.bundleChain.at(-1) === cleanUrl(id)) urlCode = "self.location.href";
32872
33058
  else if (inlineRE.test(id)) {
32873
33059
  const result = await bundleWorkerEntry(config, id);
32874
33060
  for (const file of result.watchedFiles) this.addWatchFile(file);
@@ -32905,7 +33091,7 @@ function webWorkerPlugin(config) {
32905
33091
  } else {
32906
33092
  const result = await workerFileToUrl(config, id);
32907
33093
  let url;
32908
- if (this.environment.config.command === "serve" && this.environment.config.experimental.bundledDev) url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
33094
+ if (this.environment.config.command === "serve" && this.environment.config.isBundled) url = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
32909
33095
  else url = result.entryUrlPlaceholder;
32910
33096
  urlCode = JSON.stringify(url);
32911
33097
  for (const file of result.watchedFiles) this.addWatchFile(file);
@@ -32939,7 +33125,7 @@ function webWorkerPlugin(config) {
32939
33125
  let injectEnv = "";
32940
33126
  if (workerType === "classic") injectEnv = `importScripts(${JSON.stringify(path.posix.join(config.base, ENV_PUBLIC_PATH))})\n`;
32941
33127
  else if (workerType === "module") injectEnv = `import ${JSON.stringify(ENV_PUBLIC_PATH)}\n`;
32942
- else if (workerType === "ignore") if (config.isBundled) injectEnv = "";
33128
+ else if (workerType === "ignore") if (this.environment.config.isBundled) injectEnv = "";
32943
33129
  else {
32944
33130
  const environment = this.environment;
32945
33131
  injectEnv = ((environment.mode === "dev" ? environment.moduleGraph : void 0)?.getModuleById(ENV_ENTRY))?.transformResult?.code || "";
@@ -33023,6 +33209,7 @@ function preAliasPlugin(config) {
33023
33209
  return {
33024
33210
  name: "vite:pre-alias",
33025
33211
  applyToEnvironment(environment) {
33212
+ if (environment.config.isBundled) return false;
33026
33213
  return !isDepOptimizationDisabled(environment.config.optimizeDeps);
33027
33214
  },
33028
33215
  async resolveId(id, importer, options) {
@@ -33169,6 +33356,9 @@ function importAnalysisPlugin(config) {
33169
33356
  }
33170
33357
  return {
33171
33358
  name: "vite:import-analysis",
33359
+ applyToEnvironment(environment) {
33360
+ return !environment.config.isBundled;
33361
+ },
33172
33362
  async transform(source, importer) {
33173
33363
  const environment = this.environment;
33174
33364
  const ssr = environment.config.consumer === "server";
@@ -33658,7 +33848,6 @@ async function getWorkerType(raw, clean, i) {
33658
33848
  }
33659
33849
  const workerImportMetaUrlRE = /\bnew\s+(?:Worker|SharedWorker)\s*\(\s*(new\s+URL\s*\(\s*('[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*(?:,\s*)?\))/dg;
33660
33850
  function workerImportMetaUrlPlugin(config) {
33661
- const isBundled = config.isBundled;
33662
33851
  let workerResolver;
33663
33852
  const fsResolveOptions = {
33664
33853
  ...config.resolve,
@@ -33676,6 +33865,7 @@ function workerImportMetaUrlPlugin(config) {
33676
33865
  transform: {
33677
33866
  filter: { code: workerImportMetaUrlRE },
33678
33867
  async handler(code, id) {
33868
+ const isBundled = this.environment.config.isBundled;
33679
33869
  let s;
33680
33870
  const cleanString = stripLiteral(code);
33681
33871
  const re = new RegExp(workerImportMetaUrlRE);
@@ -33705,7 +33895,7 @@ function workerImportMetaUrlPlugin(config) {
33705
33895
  let builtUrl;
33706
33896
  if (isBundled) {
33707
33897
  const result = await workerFileToUrl(config, file);
33708
- if (this.environment.config.command === "serve" && this.environment.config.experimental.bundledDev) builtUrl = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
33898
+ if (this.environment.config.command === "serve") builtUrl = toOutputFilePathInJSForBundledDev(this.environment, result.entryFilename);
33709
33899
  else builtUrl = result.entryUrlPlaceholder;
33710
33900
  for (const file of result.watchedFiles) this.addWatchFile(file);
33711
33901
  } else {
@@ -34141,7 +34331,7 @@ function getQueryDelimiterIndex(rawUrl) {
34141
34331
  return -1;
34142
34332
  }
34143
34333
  //#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
34334
+ //#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
34335
  var VariableDynamicImportError = class extends Error {};
34146
34336
  const example = "For example: import(`./foo/${bar}.js`).";
34147
34337
  function sanitizeString(str) {
@@ -34260,23 +34450,26 @@ function dynamicImportVarsPlugin(config) {
34260
34450
  tryIndex: false,
34261
34451
  extensions: []
34262
34452
  });
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
34453
  const getFilter = perEnvironmentState((environment) => {
34275
34454
  const { include, exclude } = environment.config.build.dynamicImportVarsOptions;
34276
34455
  return createFilter$1(include, exclude);
34277
34456
  });
34278
34457
  return {
34279
34458
  name: "vite:dynamic-import-vars",
34459
+ applyToEnvironment(environment) {
34460
+ if (environment.config.isBundled) {
34461
+ const { include, exclude } = environment.config.build.dynamicImportVarsOptions;
34462
+ return viteDynamicImportVarsPlugin({
34463
+ include,
34464
+ exclude,
34465
+ resolver(id, importer) {
34466
+ return resolve(environment, id, importer);
34467
+ },
34468
+ sourcemap: !!environment.config.build.sourcemap
34469
+ });
34470
+ }
34471
+ return true;
34472
+ },
34280
34473
  resolveId: {
34281
34474
  filter: { id: exactRegex(dynamicImportHelperId) },
34282
34475
  handler(id) {
@@ -34334,14 +34527,17 @@ function dynamicImportVarsPlugin(config) {
34334
34527
  //#endregion
34335
34528
  //#region ../../vite/packages/vite/src/node/plugins/importMetaGlob.ts
34336
34529
  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
34530
  const importGlobMaps = /* @__PURE__ */ new Map();
34343
34531
  return {
34344
34532
  name: "vite:import-glob",
34533
+ applyToEnvironment(environment) {
34534
+ if (environment.config.isBundled) return viteImportGlobPlugin({
34535
+ root: environment.config.root,
34536
+ sourcemap: !!environment.config.build.sourcemap,
34537
+ restoreQueryExtension: environment.config.experimental.importGlobRestoreExtension
34538
+ });
34539
+ return true;
34540
+ },
34345
34541
  buildStart() {
34346
34542
  importGlobMaps.clear();
34347
34543
  },
@@ -34539,6 +34735,7 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
34539
34735
  if (!matches.length) return null;
34540
34736
  const s = new MagicString(code);
34541
34737
  const staticImports = (await Promise.all(matches.map(async ({ globsResolved, isRelative, options, index, start, end, onlyKeys, onlyValues }) => {
34738
+ if (!dir && !options.base && isRelative) throw new Error("In virtual modules, all globs must start with '/'");
34542
34739
  const files = (await glob(globsResolved, {
34543
34740
  absolute: true,
34544
34741
  cwd: getCommonBase(globsResolved) ?? root,
@@ -34551,7 +34748,6 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
34551
34748
  const staticImports = [];
34552
34749
  const resolvePaths = (file) => {
34553
34750
  if (!dir) {
34554
- if (!options.base && isRelative) throw new Error("In virtual modules, all globs must start with '/'");
34555
34751
  const importPath = `/${relative$2(root, file)}`;
34556
34752
  let filePath = options.base ? `${relative$2(posix.join(root, options.base), file)}` : importPath;
34557
34753
  if (options.base && !filePath.startsWith("./") && !filePath.startsWith("../")) filePath = `./${filePath}`;
@@ -34566,7 +34762,6 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
34566
34762
  if (options.base) {
34567
34763
  filePath = relative$2(posix.join(options.base[0] === "/" ? root : dir, options.base), file);
34568
34764
  if (!filePath.startsWith("./") && !filePath.startsWith("../")) filePath = `./${filePath}`;
34569
- if (options.base[0] === "/") importPath = `/${relative$2(root, file)}`;
34570
34765
  } else if (isRelative) filePath = importPath;
34571
34766
  else {
34572
34767
  filePath = relative$2(root, file);
@@ -34751,7 +34946,7 @@ function createFilterForTransform(idFilter, codeFilter, moduleTypeFilter, cwd) {
34751
34946
  };
34752
34947
  }
34753
34948
  //#endregion
34754
- //#region ../../node_modules/.pnpm/@vitest+utils@4.1.5/node_modules/@vitest/utils/dist/helpers.js
34949
+ //#region ../../node_modules/.pnpm/@vitest+utils@4.1.7/node_modules/@vitest/utils/dist/helpers.js
34755
34950
  function notNullish(v) {
34756
34951
  return v != null;
34757
34952
  }
@@ -34759,7 +34954,7 @@ function isPrimitive(value) {
34759
34954
  return value === null || typeof value !== "function" && typeof value !== "object";
34760
34955
  }
34761
34956
  //#endregion
34762
- //#region ../../node_modules/.pnpm/@vitest+utils@4.1.5/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
34957
+ //#region ../../node_modules/.pnpm/@vitest+utils@4.1.7/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
34763
34958
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
34764
34959
  function normalizeWindowsPath(input = "") {
34765
34960
  if (!input) return input;
@@ -34838,7 +35033,7 @@ const isAbsolute$2 = function(p) {
34838
35033
  return _IS_ABSOLUTE_RE.test(p);
34839
35034
  };
34840
35035
  //#endregion
34841
- //#region ../../node_modules/.pnpm/@vitest+utils@4.1.5/node_modules/@vitest/utils/dist/source-map.js
35036
+ //#region ../../node_modules/.pnpm/@vitest+utils@4.1.7/node_modules/@vitest/utils/dist/source-map.js
34842
35037
  var comma = ",".charCodeAt(0);
34843
35038
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
34844
35039
  var intToChar = new Uint8Array(64);
@@ -35309,29 +35504,34 @@ function esbuildBannerFooterCompatPlugin(config) {
35309
35504
  //#region ../../vite/packages/vite/src/node/plugins/index.ts
35310
35505
  async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
35311
35506
  const isBuild = config.command === "build";
35312
- const isBundled = config.isBundled;
35313
35507
  const isWorker = config.isWorker;
35314
- const buildPlugins = isBundled ? (await Promise.resolve().then(() => build_exports)).resolveBuildPlugins(config) : {
35508
+ const buildPlugins = isBuild || Object.values(config.environments).some((env) => env.isBundled) ? (await Promise.resolve().then(() => build_exports)).resolveBuildPlugins(config) : {
35315
35509
  pre: [],
35316
35510
  post: []
35317
35511
  };
35318
35512
  const devtoolsIntegrationPlugin = config.devtools.enabled && !isWorker ? await loadDevToolsIntegrationPlugin(config) : null;
35319
35513
  const { modulePreload } = config.build;
35320
35514
  return [
35321
- !isBundled ? optimizedDepsPlugin() : null,
35515
+ optimizedDepsPlugin(),
35322
35516
  !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
- }),
35517
+ preAliasPlugin(config),
35518
+ {
35519
+ ...alias$1({
35520
+ entries: config.resolve.alias,
35521
+ customResolver: viteAliasCustomResolver
35522
+ }),
35523
+ applyToEnvironment(environment) {
35524
+ if (environment.config.isBundled && !environment.config.resolve.alias.some((v) => v.customResolver)) return viteAliasPlugin({ entries: config.resolve.alias.map((item) => {
35525
+ return {
35526
+ find: item.find,
35527
+ replacement: item.replacement
35528
+ };
35529
+ }) });
35530
+ return true;
35531
+ }
35532
+ },
35333
35533
  ...prePlugins,
35334
- modulePreload !== false && modulePreload.polyfill ? modulePreloadPolyfillPlugin(config) : null,
35534
+ modulePreload !== false && modulePreload.polyfill ? modulePreloadPolyfillPlugin() : null,
35335
35535
  ...oxcResolvePlugin({
35336
35536
  root: config.root,
35337
35537
  isProduction: config.isProduction,
@@ -35344,12 +35544,18 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
35344
35544
  }, isWorker ? {
35345
35545
  ...config,
35346
35546
  consumer: "client",
35547
+ isBundled: true,
35347
35548
  optimizeDepsPluginNames: []
35348
35549
  } : void 0),
35349
35550
  htmlInlineProxyPlugin(config),
35350
35551
  cssPlugin(config),
35351
35552
  esbuildBannerFooterCompatPlugin(config),
35352
- config.oxc !== false && !isBundled ? oxcRuntimePlugin() : null,
35553
+ config.oxc !== false ? {
35554
+ ...oxcRuntimePlugin(),
35555
+ applyToEnvironment(environment) {
35556
+ return !environment.config.isBundled;
35557
+ }
35558
+ } : null,
35353
35559
  config.oxc !== false ? oxcPlugin(config) : null,
35354
35560
  viteJsonPlugin({
35355
35561
  ...config.json,
@@ -35363,7 +35569,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
35363
35569
  viteWasmFallbackPlugin(),
35364
35570
  definePlugin(config),
35365
35571
  cssPostPlugin(config),
35366
- isBundled && buildHtmlPlugin(config),
35572
+ buildHtmlPlugin(config),
35367
35573
  workerImportMetaUrlPlugin(config),
35368
35574
  assetImportMetaUrlPlugin(config),
35369
35575
  ...buildPlugins.pre,
@@ -35372,11 +35578,9 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
35372
35578
  ...postPlugins,
35373
35579
  ...buildPlugins.post,
35374
35580
  devtoolsIntegrationPlugin,
35375
- ...isBundled ? [] : [
35376
- clientInjectionsPlugin(config),
35377
- cssAnalysisPlugin(config),
35378
- importAnalysisPlugin(config)
35379
- ]
35581
+ clientInjectionsPlugin(config),
35582
+ cssAnalysisPlugin(config),
35583
+ importAnalysisPlugin(config)
35380
35584
  ].filter(Boolean);
35381
35585
  }
35382
35586
  async function loadDevToolsIntegrationPlugin(config) {
@@ -36244,7 +36448,7 @@ function scanImports(environment) {
36244
36448
  async function scan() {
36245
36449
  const entries = await computeEntries(environment);
36246
36450
  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."));
36451
+ 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
36452
  return;
36249
36453
  }
36250
36454
  if (scanContext.cancelled) return;
@@ -36289,25 +36493,26 @@ async function computeEntries(environment) {
36289
36493
  isEntry: true,
36290
36494
  scan: true
36291
36495
  }))?.id;
36292
- if (id === void 0) throw new Error(`failed to resolve rollupOptions.input value: ${JSON.stringify(p)}.`);
36496
+ if (id === void 0) throw new Error(`failed to resolve rolldownOptions.input value: ${JSON.stringify(p)}.`);
36293
36497
  return id;
36294
36498
  };
36295
36499
  if (typeof buildInput === "string") entries = [await resolvePath(buildInput)];
36296
36500
  else if (Array.isArray(buildInput)) entries = await Promise.all(buildInput.map(resolvePath));
36297
36501
  else if (isObject$1(buildInput)) entries = await Promise.all(Object.values(buildInput).map(resolvePath));
36298
- else throw new Error("invalid rollupOptions.input value.");
36502
+ else throw new Error("invalid rolldownOptions.input value.");
36299
36503
  } else entries = await globEntries("**/*.html", environment);
36300
36504
  entries = entries.filter((entry) => isScannable(entry, environment.config.optimizeDeps.extensions) && fs.existsSync(entry));
36301
36505
  return entries;
36302
36506
  }
36303
36507
  async function prepareRolldownScanner(environment, entries, deps, missing) {
36304
36508
  const { plugins: pluginsFromConfig = [], ...rolldownOptions } = environment.config.optimizeDeps.rolldownOptions ?? {};
36305
- const plugins = await asyncFlatten(arraify(pluginsFromConfig));
36306
- plugins.push(...rolldownScanPlugin(environment, deps, missing, entries));
36307
36509
  const transformOptions = deepClone(rolldownOptions.transform) ?? {};
36308
36510
  if (transformOptions.jsx === void 0) transformOptions.jsx = {};
36309
36511
  else if (transformOptions.jsx === "react" || transformOptions.jsx === "react-jsx") transformOptions.jsx = getRollupJsxPresets(transformOptions.jsx);
36310
36512
  if (typeof transformOptions.jsx === "object") transformOptions.jsx.development ??= !environment.config.isProduction;
36513
+ const transformSyncJsxOptions = transformOptions.jsx === false ? void 0 : transformOptions.jsx;
36514
+ const plugins = await asyncFlatten(arraify(pluginsFromConfig));
36515
+ plugins.push(...rolldownScanPlugin(environment, deps, missing, entries, transformSyncJsxOptions));
36311
36516
  async function build() {
36312
36517
  await scan({
36313
36518
  ...rolldownOptions,
@@ -36346,7 +36551,7 @@ const typeRE = /\btype\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
36346
36551
  const langRE = /\blang\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
36347
36552
  const svelteScriptModuleRE = /\bcontext\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/i;
36348
36553
  const svelteModuleRE = /\smodule\b/i;
36349
- function rolldownScanPlugin(environment, depImports, missing, entries) {
36554
+ function rolldownScanPlugin(environment, depImports, missing, entries, jsxOptions) {
36350
36555
  const seen = /* @__PURE__ */ new Map();
36351
36556
  async function resolveId(id, importer, options) {
36352
36557
  return environment.pluginContainer.resolveId(id, importer && normalizePath$1(importer), {
@@ -36380,6 +36585,7 @@ function rolldownScanPlugin(environment, depImports, missing, entries) {
36380
36585
  let transpiledContents;
36381
36586
  if (loader !== "js") {
36382
36587
  const result = transformSync(id, contents, {
36588
+ ...jsxOptions !== void 0 ? { jsx: jsxOptions } : {},
36383
36589
  lang: loader,
36384
36590
  tsconfig: false
36385
36591
  });
@@ -37212,15 +37418,17 @@ async function prepareRolldownOptimizerRun(environment, depsInfo, processingCach
37212
37418
  await bundle.close();
37213
37419
  throw new Error("The build was canceled");
37214
37420
  }
37215
- const result = await bundle.write({
37216
- ...rolldownOptions.output,
37217
- format: "esm",
37218
- sourcemap: true,
37219
- dir: processingCacheDir,
37220
- entryFileNames: "[name].js"
37221
- });
37222
- await bundle.close();
37223
- return result;
37421
+ try {
37422
+ return await bundle.write({
37423
+ ...rolldownOptions.output,
37424
+ format: "esm",
37425
+ sourcemap: true,
37426
+ dir: processingCacheDir,
37427
+ entryFileNames: "[name].js"
37428
+ });
37429
+ } finally {
37430
+ await bundle.close();
37431
+ }
37224
37432
  }
37225
37433
  function cancel() {
37226
37434
  canceled = true;
@@ -37398,7 +37606,7 @@ async function extractExportsData(environment, filePath) {
37398
37606
  } catch {
37399
37607
  const lang = rolldownOptions.moduleTypes?.[path.extname(filePath)] || "jsx";
37400
37608
  debug$2?.(`Unable to parse: ${filePath}.\n Trying again with a ${lang} transform.`);
37401
- if (lang !== "jsx" && lang !== "tsx" && lang !== "ts") throw new Error(`Unable to parse : ${filePath}.`);
37609
+ if (lang !== "jsx" && lang !== "tsx" && lang !== "ts") throw new Error(`Unable to parse: ${filePath}.`);
37402
37610
  parseResult = parse$2((await transformWithOxc(entryContent, filePath, { lang }, void 0, environment.config)).code);
37403
37611
  usedJsxLoader = true;
37404
37612
  }
@@ -37620,9 +37828,9 @@ const perEnvironmentOrWorkerPlugin = (name, overrideEnvConfig, f) => {
37620
37828
  }
37621
37829
  }];
37622
37830
  };
37623
- function oxcResolvePlugin(resolveOptions, overrideEnvConfig) {
37831
+ function oxcResolvePlugin(resolveOptions, overrideEnvConfig, isJsPluginContainer = false) {
37624
37832
  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);
37833
+ const depsOptimizerEnabled = resolveOptions.optimizeDeps && !resolveOptions.isBuild && !partialEnv.config.isBundled && !isDepOptimizationDisabled(partialEnv.config.optimizeDeps);
37626
37834
  const getDepsOptimizer = () => {
37627
37835
  const env = getEnv();
37628
37836
  if (env.mode !== "dev") throw new Error("The environment mode should be dev");
@@ -37688,8 +37896,8 @@ function oxcResolvePlugin(resolveOptions, overrideEnvConfig) {
37688
37896
  scan
37689
37897
  });
37690
37898
  },
37691
- ...partialEnv.config.command === "serve" ? { async onWarn(msg) {
37692
- getEnv().logger.warn(`warning: ${msg}`, {
37899
+ ...partialEnv.config.command === "serve" || isJsPluginContainer ? { async onWarn(msg) {
37900
+ partialEnv.config.logger.warn(`warning: ${msg}`, {
37693
37901
  clear: true,
37694
37902
  timestamp: true
37695
37903
  });
@@ -37707,7 +37915,7 @@ function optimizerResolvePlugin(resolveOptions) {
37707
37915
  return {
37708
37916
  name: "vite:resolve-dev",
37709
37917
  applyToEnvironment(environment) {
37710
- return !environment.config.experimental.bundledDev && !isDepOptimizationDisabled(environment.config.optimizeDeps);
37918
+ return !environment.config.isBundled && !isDepOptimizationDisabled(environment.config.optimizeDeps);
37711
37919
  },
37712
37920
  resolveId: {
37713
37921
  filter: { id: { exclude: [
@@ -38328,9 +38536,9 @@ function prepareOutDirPlugin() {
38328
38536
  order: "pre",
38329
38537
  handler() {
38330
38538
  if (rendered.has(this.environment)) return;
38331
- rendered.add(this.environment);
38332
38539
  const { config } = this.environment;
38333
38540
  if (config.build.write) {
38541
+ rendered.add(this.environment);
38334
38542
  const { root, build: options } = config;
38335
38543
  const resolvedOutDirs = getResolvedOutDirs(root, options.outDir, options.rollupOptions.output);
38336
38544
  prepareOutDir(resolvedOutDirs, resolveEmptyOutDir(options.emptyOutDir, root, resolvedOutDirs, this.environment.logger), this.environment);
@@ -38455,12 +38663,15 @@ function resolveBuildPlugins(config) {
38455
38663
  return {
38456
38664
  pre: [
38457
38665
  ...isBuild && !config.isWorker ? [prepareOutDirPlugin()] : [],
38458
- perEnvironmentPlugin("vite:rollup-options-plugins", async (environment) => (await asyncFlatten(arraify(environment.config.build.rollupOptions.plugins))).filter(Boolean)),
38666
+ perEnvironmentPlugin("vite:rollup-options-plugins", async (environment) => {
38667
+ if (!isBuild && !environment.config.isBundled) return false;
38668
+ return (await asyncFlatten(arraify(environment.config.build.rollupOptions.plugins))).filter(Boolean);
38669
+ }),
38459
38670
  ...config.isWorker ? [webWorkerPostPlugin(config)] : []
38460
38671
  ],
38461
38672
  post: [
38462
38673
  ...isBuild ? buildImportAnalysisPlugin(config) : [],
38463
- ...config.build.minify === "esbuild" ? [buildEsbuildPlugin()] : [],
38674
+ ...isBuild && config.build.minify === "esbuild" ? [buildEsbuildPlugin()] : [],
38464
38675
  ...isBuild ? [terserPlugin(config)] : [],
38465
38676
  ...isBuild && !config.isWorker ? [
38466
38677
  licensePlugin(),
@@ -38528,9 +38739,9 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
38528
38739
  const isSsrTargetWebworkerEnvironment = environment.name === "ssr" && environment.getTopLevelConfig().ssr?.target === "webworker";
38529
38740
  if (isSsrTargetWebworkerEnvironment) plugins.push(esmExternalRequirePlugin());
38530
38741
  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."));
38742
+ 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.");
38743
+ if (output.file) throw new Error("Vite does not support \"rolldownOptions.output.file\". Please use \"rolldownOptions.output.dir\" and \"rolldownOptions.output.entryFileNames\" instead.");
38744
+ if (output.sourcemap) logger.warnOnce(import_picocolors.default.yellow("Vite does not support \"rolldownOptions.output.sourcemap\". Please use \"build.sourcemap\" instead."));
38534
38745
  const format = output.format || "es";
38535
38746
  const jsExt = ssr && !isSsrTargetWebworkerEnvironment || libOptions ? resolveOutputJsExtension(format, findNearestPackageData(root, packageCache)?.data.type) : "js";
38536
38747
  return {
@@ -38684,9 +38895,9 @@ function resolveBuildOutputs(outputs, libOptions, logger) {
38684
38895
  format
38685
38896
  }));
38686
38897
  }
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."));
38898
+ 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
38899
  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\".");
38900
+ 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
38901
  });
38691
38902
  }
38692
38903
  return outputs;
@@ -38706,7 +38917,7 @@ function onRollupLog(level, log, environment) {
38706
38917
  if (logging.code === "UNRESOLVED_IMPORT") {
38707
38918
  const id = logging.id;
38708
38919
  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\``);
38920
+ 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
38921
  }
38711
38922
  if (logLeveling === "warn") {
38712
38923
  if (logging.plugin === "rollup-plugin-dynamic-import-variables" && dynamicImportWarningIgnoreList.some((msg) => logging.message.includes(msg))) return;
@@ -39247,7 +39458,7 @@ async function preview(inlineConfig = {}) {
39247
39458
  resolvedUrls: null,
39248
39459
  printUrls() {
39249
39460
  if (server.resolvedUrls) printServerUrls(server.resolvedUrls, options.host, logger.info);
39250
- else throw new Error("cannot print server URLs before server is listening.");
39461
+ else throw new Error("Cannot print server URLs before server is listening.");
39251
39462
  },
39252
39463
  bindCLIShortcuts(options) {
39253
39464
  bindCLIShortcuts(server, options);
@@ -39423,9 +39634,14 @@ function convertEsbuildPluginToRolldownPlugin(esbuildPlugin) {
39423
39634
  if (!isSetupDone) await setup([{ name: "vite:dep-scan" }], inputOptions.platform ?? "node");
39424
39635
  for (const cb of onStartCallbacks) cb();
39425
39636
  },
39426
- generateBundle() {
39427
- const buildResult = new Proxy({}, { get(_target, _prop) {
39428
- throw new Error("Not implemented");
39637
+ generateBundle(_outputOpts, _bundle, isWrite) {
39638
+ const buildResult = new Proxy({
39639
+ metafile: void 0,
39640
+ mangleCache: void 0,
39641
+ ...isWrite ? { outputFiles: void 0 } : {}
39642
+ }, { get(_target, prop) {
39643
+ if (prop in _target || typeof prop === "symbol") return _target[prop];
39644
+ throw new Error("Not implemented property: " + prop);
39429
39645
  } });
39430
39646
  for (const cb of onEndCallbacks) cb(buildResult);
39431
39647
  },
@@ -39654,9 +39870,11 @@ function resolveDevEnvironmentOptions(dev, environmentName, consumer, preTransfo
39654
39870
  sourcemapIgnoreList: resolved.sourcemapIgnoreList === false ? () => false : resolved.sourcemapIgnoreList
39655
39871
  };
39656
39872
  }
39657
- function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimizeDeps, logger, environmentName, isBundledDev, isSsrTargetWebworkerSet, preTransformRequests) {
39658
- const consumer = options.consumer ?? (environmentName === "client" ? "client" : "server");
39873
+ function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimizeDeps, logger, environmentName, isBuild, isBundledDev, isSsrTargetWebworkerSet, preTransformRequests) {
39874
+ const isClientEnvironment = environmentName === "client";
39875
+ const consumer = options.consumer ?? (isClientEnvironment ? "client" : "server");
39659
39876
  const isSsrTargetWebworkerEnvironment = isSsrTargetWebworkerSet && environmentName === "ssr";
39877
+ const isBundled = options.isBundled ?? (isBuild || isClientEnvironment && isBundledDev);
39660
39878
  if (options.define?.["process.env"]) {
39661
39879
  const processEnvDefine = options.define["process.env"];
39662
39880
  if (typeof processEnvDefine === "object") {
@@ -39672,7 +39890,8 @@ function resolveEnvironmentOptions(options, alias, preserveSymlinks, forceOptimi
39672
39890
  consumer,
39673
39891
  optimizeDeps: resolveDepOptimizationOptions(options.optimizeDeps, resolve.preserveSymlinks, forceOptimizeDeps, consumer, logger),
39674
39892
  dev: resolveDevEnvironmentOptions(options.dev, environmentName, consumer, preTransformRequests),
39675
- build: resolveBuildEnvironmentOptions(options.build ?? {}, logger, consumer, isBundledDev, isSsrTargetWebworkerEnvironment),
39893
+ build: resolveBuildEnvironmentOptions(options.build ?? {}, logger, consumer, isBundled && !isBuild, isSsrTargetWebworkerEnvironment),
39894
+ isBundled,
39676
39895
  plugins: void 0,
39677
39896
  optimizeDepsPluginNames: void 0
39678
39897
  };
@@ -39913,7 +40132,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
39913
40132
  config.resolve.mainFields = config.environments.client.resolve?.mainFields;
39914
40133
  const resolvedDefaultResolve = resolveResolveOptions(config.resolve, logger);
39915
40134
  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);
40135
+ 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
40136
  const backwardCompatibleOptimizeDeps = resolvedEnvironments.client.optimizeDeps;
39918
40137
  const resolvedDevEnvironmentOptions = resolveDevEnvironmentOptions(config.dev, void 0, void 0);
39919
40138
  const resolvedBuildOptions = resolveBuildEnvironmentOptions(config.build ?? {}, logger, void 0, isBundledDev);
@@ -40013,7 +40232,6 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
40013
40232
  cacheDir,
40014
40233
  command,
40015
40234
  mode,
40016
- isBundled: config.experimental?.bundledDev || isBuild,
40017
40235
  isWorker: false,
40018
40236
  mainConfig: null,
40019
40237
  bundleChain: [],
@@ -40122,7 +40340,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
40122
40340
  if (assetFileNamesList.length > 1) {
40123
40341
  const firstAssetFileNames = assetFileNamesList[0];
40124
40342
  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.
40343
+ assetFileNames isn't equal for every build.rolldownOptions.output. A single pattern across all outputs is supported by Vite.
40126
40344
  `));
40127
40345
  }
40128
40346
  }
@@ -40337,15 +40555,10 @@ function collectAllModules(bundle, fileName, allModules, analyzedModules = /* @_
40337
40555
  if (analyzedModules.has(fileName)) return;
40338
40556
  analyzedModules.add(fileName);
40339
40557
  const chunk = bundle[fileName];
40558
+ if (!chunk) return;
40340
40559
  for (const mod of chunk.moduleIds) allModules.add(mod);
40341
- for (const i of chunk.imports) {
40342
- analyzedModules.add(i);
40343
- collectAllModules(bundle, i, allModules, analyzedModules);
40344
- }
40345
- for (const i of chunk.dynamicImports) {
40346
- analyzedModules.add(i);
40347
- collectAllModules(bundle, i, allModules, analyzedModules);
40348
- }
40560
+ for (const i of chunk.imports) collectAllModules(bundle, i, allModules, analyzedModules);
40561
+ for (const i of chunk.dynamicImports) collectAllModules(bundle, i, allModules, analyzedModules);
40349
40562
  }
40350
40563
  const _require = createRequire(
40351
40564
  /** #__KEEP__ */