vite 6.0.0-alpha.10 → 6.0.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15142,23 +15142,23 @@ function terserPlugin(config) {
15142
15142
  };
15143
15143
  }
15144
15144
 
15145
- async function resolveBoundedPlugins(environment) {
15146
- const userPlugins = [];
15147
- for (const plugin of environment.config.rawPlugins) {
15145
+ async function resolveIsolatedPlugins(environment) {
15146
+ const resolvedPlugins = [];
15147
+ for (const plugin of environment.config.plugins) {
15148
15148
  if (typeof plugin === 'function') {
15149
- const boundedPlugin = await plugin(environment);
15150
- if (boundedPlugin) {
15151
- const flatPlugins = await asyncFlattenBoundedPlugin(environment, boundedPlugin);
15152
- userPlugins.push(...flatPlugins);
15149
+ const isolatedPlugin = await plugin(environment);
15150
+ if (isolatedPlugin) {
15151
+ const flatPlugins = await asyncFlattenIsolatedPlugin(environment, isolatedPlugin);
15152
+ resolvedPlugins.push(...flatPlugins);
15153
15153
  }
15154
15154
  }
15155
15155
  else {
15156
- userPlugins.push(plugin);
15156
+ resolvedPlugins.push(plugin);
15157
15157
  }
15158
15158
  }
15159
- return environment.config.resolvePlugins(...sortUserPlugins(userPlugins));
15159
+ return resolvedPlugins;
15160
15160
  }
15161
- async function asyncFlattenBoundedPlugin(environment, plugins) {
15161
+ async function asyncFlattenIsolatedPlugin(environment, plugins) {
15162
15162
  if (!Array.isArray(plugins)) {
15163
15163
  plugins = [plugins];
15164
15164
  }
@@ -57996,7 +57996,7 @@ function handleParseError(parserError, html, filePath) {
57996
57996
  * Compiles index.html into an entry js module
57997
57997
  */
57998
57998
  function buildHtmlPlugin(config) {
57999
- const [preHooks, normalHooks, postHooks] = resolveHtmlTransforms(config.plugins, config.logger);
57999
+ const [preHooks, normalHooks, postHooks] = resolveHtmlTransforms(config.plugins.filter((plugin) => typeof plugin !== 'function'), config.logger);
58000
58000
  preHooks.unshift(injectCspNonceMetaTagHook(config));
58001
58001
  preHooks.unshift(preImportMapHook(config));
58002
58002
  preHooks.push(htmlEnvHook(config));
@@ -59046,7 +59046,9 @@ function transformMiddleware(server) {
59046
59046
  }
59047
59047
 
59048
59048
  function createDevHtmlTransformFn(config) {
59049
- const [preHooks, normalHooks, postHooks] = resolveHtmlTransforms(config.plugins, config.logger);
59049
+ const [preHooks, normalHooks, postHooks] = resolveHtmlTransforms(
59050
+ // TODO: interaction between transformIndexHtml and plugin constructors
59051
+ config.plugins.filter((plugin) => typeof plugin !== 'function'), config.logger);
59050
59052
  const transformHooks = [
59051
59053
  preImportMapHook(config),
59052
59054
  injectCspNonceMetaTagHook(config),
@@ -61057,8 +61059,8 @@ class DevEnvironment extends Environment {
61057
61059
  return;
61058
61060
  }
61059
61061
  this._inited = true;
61060
- this._plugins = await resolveBoundedPlugins(this);
61061
- this._pluginContainer = await createBoundedPluginContainer(this, this._plugins);
61062
+ this._plugins = await resolveIsolatedPlugins(this);
61063
+ this._pluginContainer = await createIsolatedPluginContainer(this, this._plugins);
61062
61064
  // TODO: Should buildStart be called here? It break backward compatibility if we do,
61063
61065
  // and it may be better to delay it for performance
61064
61066
  // The deps optimizer init is delayed. TODO: add internal option?
@@ -61863,11 +61865,11 @@ function getSortedPluginsByHotUpdateHook(plugins) {
61863
61865
  return sortedPlugins;
61864
61866
  }
61865
61867
  const sortedHotUpdatePluginsCache = new WeakMap();
61866
- function getSortedHotUpdatePlugins(config) {
61867
- let sortedPlugins = sortedHotUpdatePluginsCache.get(config);
61868
+ function getSortedHotUpdatePlugins(environment) {
61869
+ let sortedPlugins = sortedHotUpdatePluginsCache.get(environment);
61868
61870
  if (!sortedPlugins) {
61869
- sortedPlugins = getSortedPluginsByHotUpdateHook(config.plugins);
61870
- sortedHotUpdatePluginsCache.set(config, sortedPlugins);
61871
+ sortedPlugins = getSortedPluginsByHotUpdateHook(environment.plugins);
61872
+ sortedHotUpdatePluginsCache.set(environment, sortedPlugins);
61871
61873
  }
61872
61874
  return sortedPlugins;
61873
61875
  }
@@ -61929,7 +61931,7 @@ async function handleHMRUpdate(type, file, server) {
61929
61931
  environment,
61930
61932
  };
61931
61933
  let hmrContext;
61932
- for (const plugin of getSortedHotUpdatePlugins(config)) {
61934
+ for (const plugin of getSortedHotUpdatePlugins(environment)) {
61933
61935
  if (plugin.hotUpdate) {
61934
61936
  const filteredModules = await getHookHandler(plugin.hotUpdate)(hotContext);
61935
61937
  if (filteredModules) {
@@ -63873,11 +63875,12 @@ function clientInjectionsPlugin(config) {
63873
63875
  .replace(`__HMR_CONFIG_NAME__`, hmrConfigNameReplacement);
63874
63876
  };
63875
63877
  },
63876
- async transform(code, id) {
63878
+ async transform(code, id, options) {
63877
63879
  if (!this.environment)
63878
63880
  return;
63879
63881
  // TODO: !environment.options.nodeCompatible ?
63880
- const ssr = this.environment.name !== 'client';
63882
+ // TODO: Remove options?.ssr, Vitest currently hijacks this plugin
63883
+ const ssr = options?.ssr ?? this.environment.name !== 'client';
63881
63884
  if (id === normalizedClientEntry || id === normalizedEnvEntry) {
63882
63885
  return injectConfigValues(code);
63883
63886
  }
@@ -64450,13 +64453,17 @@ const relativePathRE = /^\.{1,2}\//;
64450
64453
  // trailing slash too as a dynamic import statement can have comments between
64451
64454
  // the `import` and the `(`.
64452
64455
  const hasDynamicImportRE = /\bimport\s*[(/]/;
64453
- const dynamicImportHelper = (glob, path) => {
64456
+ const dynamicImportHelper = (glob, path, segs) => {
64454
64457
  const v = glob[path];
64455
64458
  if (v) {
64456
64459
  return typeof v === 'function' ? v() : Promise.resolve(v);
64457
64460
  }
64458
64461
  return new Promise((_, reject) => {
64459
- (typeof queueMicrotask === 'function' ? queueMicrotask : setTimeout)(reject.bind(null, new Error('Unknown variable dynamic import: ' + path)));
64462
+ (typeof queueMicrotask === 'function' ? queueMicrotask : setTimeout)(reject.bind(null, new Error('Unknown variable dynamic import: ' +
64463
+ path +
64464
+ (path.split('/').length !== segs
64465
+ ? '. Note that variables only represent file names one level deep.'
64466
+ : ''))));
64460
64467
  });
64461
64468
  };
64462
64469
  function parseDynamicImportPattern(strings) {
@@ -64593,7 +64600,7 @@ function dynamicImportVarsPlugin(config) {
64593
64600
  }
64594
64601
  const { rawPattern, glob } = result;
64595
64602
  needDynamicImportHelper = true;
64596
- s.overwrite(expStart, expEnd, `__variableDynamicImportRuntimeHelper(${glob}, \`${rawPattern}\`)`);
64603
+ s.overwrite(expStart, expEnd, `__variableDynamicImportRuntimeHelper(${glob}, \`${rawPattern}\`, ${rawPattern.split('/').length})`);
64597
64604
  }
64598
64605
  if (s) {
64599
64606
  if (needDynamicImportHelper) {
@@ -64606,7 +64613,7 @@ function dynamicImportVarsPlugin(config) {
64606
64613
  }
64607
64614
 
64608
64615
  // TODO: import { loadFallbackPlugin } from './loadFallback'
64609
- async function createResolvePlugins(config) {
64616
+ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
64610
64617
  const isBuild = config.command === 'build';
64611
64618
  const isWorker = config.isWorker;
64612
64619
  const buildPlugins = isBuild
@@ -64616,7 +64623,7 @@ async function createResolvePlugins(config) {
64616
64623
  const depsOptimizerEnabled = !isBuild &&
64617
64624
  (isDepsOptimizerEnabled(config, false) ||
64618
64625
  isDepsOptimizerEnabled(config, true));
64619
- const preVitePlugins = [
64626
+ return [
64620
64627
  depsOptimizerEnabled ? optimizedDepsPlugin() : null,
64621
64628
  isBuild ? metadataPlugin() : null,
64622
64629
  !isWorker ? watchPackageDataPlugin(config.packageCache) : null,
@@ -64625,9 +64632,7 @@ async function createResolvePlugins(config) {
64625
64632
  entries: config.resolve.alias,
64626
64633
  customResolver: viteAliasCustomResolver,
64627
64634
  }),
64628
- ];
64629
- // then ...prePlugins
64630
- const normalVitePlugins = [
64635
+ ...prePlugins,
64631
64636
  modulePreload !== false && modulePreload.polyfill
64632
64637
  ? modulePreloadPolyfillPlugin(config)
64633
64638
  : null,
@@ -64651,9 +64656,7 @@ async function createResolvePlugins(config) {
64651
64656
  wasmHelperPlugin(),
64652
64657
  webWorkerPlugin(config),
64653
64658
  assetPlugin(config),
64654
- ];
64655
- // then ...normalPlugins
64656
- const postVitePlugins = [
64659
+ ...normalPlugins,
64657
64660
  wasmFallbackPlugin(),
64658
64661
  definePlugin(config),
64659
64662
  cssPostPlugin(config),
@@ -64663,9 +64666,7 @@ async function createResolvePlugins(config) {
64663
64666
  ...buildPlugins.pre,
64664
64667
  dynamicImportVarsPlugin(config),
64665
64668
  importGlobPlugin(config),
64666
- ];
64667
- // then ...postVitePlugins
64668
- const finalVitePlugins = [
64669
+ ...postPlugins,
64669
64670
  ...buildPlugins.post,
64670
64671
  // internal server-only plugins are always applied after everything else
64671
64672
  ...(isBuild
@@ -64676,18 +64677,7 @@ async function createResolvePlugins(config) {
64676
64677
  importAnalysisPlugin(config),
64677
64678
  // TODO: loadFallbackPlugin(config),
64678
64679
  ]),
64679
- ];
64680
- return (prePlugins, normalPlugins, postPlugins) => {
64681
- return [
64682
- ...preVitePlugins,
64683
- ...prePlugins,
64684
- ...normalVitePlugins,
64685
- ...normalPlugins,
64686
- ...postVitePlugins,
64687
- ...postPlugins,
64688
- ...finalVitePlugins,
64689
- ].filter(Boolean);
64690
- };
64680
+ ].filter(Boolean);
64691
64681
  }
64692
64682
  function createPluginHookUtils(plugins) {
64693
64683
  // sort plugins per hook
@@ -64784,7 +64774,7 @@ function throwClosedServerError() {
64784
64774
  * instead of using environment.plugins to allow the creation of different
64785
64775
  * pipelines working with the same environment (used for createIdResolver).
64786
64776
  */
64787
- async function createBoundedPluginContainer(environment, plugins, watcher) {
64777
+ async function createIsolatedPluginContainer(environment, plugins, watcher) {
64788
64778
  const { config, logger, options: { build: { rollupOptions }, }, } = environment;
64789
64779
  const { root } = config;
64790
64780
  // Backward compatibility
@@ -65383,7 +65373,7 @@ function createIdResolver(config, options) {
65383
65373
  async function resolve(environment, id, importer) {
65384
65374
  let pluginContainer = pluginContainerMap.get(environment);
65385
65375
  if (!pluginContainer) {
65386
- pluginContainer = await createBoundedPluginContainer(environment, [
65376
+ pluginContainer = await createIsolatedPluginContainer(environment, [
65387
65377
  alias$1({ entries: config.resolve.alias }),
65388
65378
  resolvePlugin({
65389
65379
  root: config.root,
@@ -65406,7 +65396,7 @@ function createIdResolver(config, options) {
65406
65396
  async function resolveAlias(environment, id, importer) {
65407
65397
  let pluginContainer = aliasOnlyPluginContainerMap.get(environment);
65408
65398
  if (!pluginContainer) {
65409
- pluginContainer = await createBoundedPluginContainer(environment, [
65399
+ pluginContainer = await createIsolatedPluginContainer(environment, [
65410
65400
  alias$1({ entries: config.resolve.alias }), // TODO: resolve.alias per environment?
65411
65401
  ]);
65412
65402
  aliasOnlyPluginContainerMap.set(environment, pluginContainer);
@@ -68064,7 +68054,7 @@ function resolveConfigToBuild(inlineConfig = {}, patchConfig, patchPlugins) {
68064
68054
  return resolveConfig(inlineConfig, 'build', 'production', 'production', false, patchConfig, patchPlugins);
68065
68055
  }
68066
68056
  /**
68067
- * Build an App environment, or a App library (if librayOptions is provided)
68057
+ * Build an App environment, or a App library (if libraryOptions is provided)
68068
68058
  **/
68069
68059
  async function buildEnvironment(config, environment, libOptions = false) {
68070
68060
  const options = config.build;
@@ -68102,7 +68092,9 @@ async function buildEnvironment(config, environment, libOptions = false) {
68102
68092
  const outDir = resolve(options.outDir);
68103
68093
  // inject environment and ssr arg to plugin load/transform hooks
68104
68094
  // TODO: rework lib mode
68105
- const plugins = (libOptions ? config : environment).plugins.map((p) => injectEnvironmentToHooks(p, environment));
68095
+ const plugins = (libOptions
68096
+ ? config.plugins.filter((p) => typeof p !== 'function')
68097
+ : environment.plugins).map((p) => injectEnvironmentToHooks(p, environment));
68106
68098
  const rollupOptions = {
68107
68099
  preserveEntrySignatures: ssr
68108
68100
  ? 'allow-extension'
@@ -68649,7 +68641,7 @@ class BuildEnvironment extends Environment {
68649
68641
  return;
68650
68642
  }
68651
68643
  this._inited = true;
68652
- this._plugins = await resolveBoundedPlugins(this);
68644
+ this._plugins = await resolveIsolatedPlugins(this);
68653
68645
  }
68654
68646
  }
68655
68647
  async function defaultBuildApp(builder) {
@@ -68698,13 +68690,13 @@ async function createBuilder(inlineConfig = {}) {
68698
68690
  lib: false,
68699
68691
  };
68700
68692
  };
68701
- const patchPlugins = (rawPlugins) => {
68693
+ const patchPlugins = (resolvedPlugins) => {
68702
68694
  // Force opt-in shared plugins
68703
- const environmentPlugins = [...rawPlugins];
68695
+ const environmentPlugins = [...resolvedPlugins];
68704
68696
  let validMixedPlugins = true;
68705
68697
  for (let i = 0; i < environmentPlugins.length; i++) {
68706
68698
  const environmentPlugin = environmentPlugins[i];
68707
- const sharedPlugin = config.rawPlugins[i];
68699
+ const sharedPlugin = config.plugins[i];
68708
68700
  if (config.builder.sharedPlugins ||
68709
68701
  environmentPlugin.sharedDuringBuild) {
68710
68702
  if (environmentPlugin.name !== sharedPlugin.name) {
@@ -68716,7 +68708,7 @@ async function createBuilder(inlineConfig = {}) {
68716
68708
  }
68717
68709
  if (validMixedPlugins) {
68718
68710
  for (let i = 0; i < environmentPlugins.length; i++) {
68719
- rawPlugins[i] = environmentPlugins[i];
68711
+ resolvedPlugins[i] = environmentPlugins[i];
68720
68712
  }
68721
68713
  }
68722
68714
  };
@@ -68888,9 +68880,10 @@ async function preview(inlineConfig = {}) {
68888
68880
  const config = await resolveConfig(inlineConfig, 'serve', 'production', 'production', true);
68889
68881
  const clientOutDir = config.environments.client.build.outDir ?? config.build.outDir;
68890
68882
  const distDir = path$o.resolve(config.root, clientOutDir);
68883
+ const plugins = config.plugins.filter((plugin) => typeof plugin !== 'function');
68891
68884
  if (!fs$l.existsSync(distDir) &&
68892
68885
  // error if no plugins implement `configurePreviewServer`
68893
- config.plugins.every((plugin) => !plugin.configurePreviewServer) &&
68886
+ plugins.every((plugin) => !plugin.configurePreviewServer) &&
68894
68887
  // error if called in CLI only. programmatic usage could access `httpServer`
68895
68888
  // and affect file serving
68896
68889
  process.argv[1]?.endsWith(path$o.normalize('bin/vite.js')) &&
@@ -69182,8 +69175,6 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
69182
69175
  };
69183
69176
  // resolve plugins
69184
69177
  const rawPlugins = (await asyncFlatten(config.plugins || [])).filter(filterPlugin);
69185
- // Backward compatibility hook used in builder, opt-in to shared plugins during build
69186
- patchPlugins?.(rawPlugins);
69187
69178
  const sharedPlugins = rawPlugins.filter((plugin) => typeof plugin !== 'function');
69188
69179
  const [prePlugins, normalPlugins, postPlugins] = sortUserPlugins(sharedPlugins);
69189
69180
  const isBuild = command === 'build';
@@ -69196,7 +69187,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
69196
69187
  // There is no perf hit, because the optimizer is initialized only if ssrLoadModule
69197
69188
  // is called.
69198
69189
  // During build, we only build the ssr environment if it is configured
69199
- // through the deprecated ssr top level options or if it is explicitely defined
69190
+ // through the deprecated ssr top level options or if it is explicitly defined
69200
69191
  // in the environments config
69201
69192
  config.environments = { ssr: {}, ...config.environments };
69202
69193
  }
@@ -69378,8 +69369,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
69378
69369
  mainConfig: resolved,
69379
69370
  bundleChain,
69380
69371
  };
69381
- const resolveWorkerPlugins = await createResolvePlugins(workerResolved);
69382
- const resolvedWorkerPlugins = resolveWorkerPlugins(workerPrePlugins, workerNormalPlugins, workerPostPlugins);
69372
+ const resolvedWorkerPlugins = (await resolvePlugins(workerResolved, workerPrePlugins, workerNormalPlugins, workerPostPlugins)); // TODO: worker plugins and isolated constructor
69383
69373
  // run configResolved hooks
69384
69374
  await Promise.all(createPluginHookUtils(resolvedWorkerPlugins)
69385
69375
  .getSortedPluginHooks('configResolved')
@@ -69407,8 +69397,6 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
69407
69397
  bundleChain: [],
69408
69398
  isProduction,
69409
69399
  plugins: userPlugins,
69410
- rawPlugins,
69411
- resolvePlugins: null,
69412
69400
  css: resolveCSSOptions(config.css),
69413
69401
  esbuild: config.esbuild === false
69414
69402
  ? false
@@ -69463,7 +69451,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
69463
69451
  // environment so we can safely cast to a base Environment instance to a
69464
69452
  // PluginEnvironment here
69465
69453
  const environment = new Environment(environmentName, this);
69466
- const pluginContainer = await createBoundedPluginContainer(environment, plugins);
69454
+ const pluginContainer = await createIsolatedPluginContainer(environment, plugins);
69467
69455
  await pluginContainer.buildStart({});
69468
69456
  return pluginContainer;
69469
69457
  };
@@ -69512,16 +69500,18 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
69512
69500
  ...resolved,
69513
69501
  };
69514
69502
  // Backward compatibility hook, modify the resolved config before it is used
69515
- // to create inernal plugins. For example, `config.build.ssr`. Once we rework
69503
+ // to create internal plugins. For example, `config.build.ssr`. Once we rework
69516
69504
  // internal plugins to use environment.options, we can remove the dual
69517
69505
  // patchConfig/patchPlugins and have a single patchConfig before configResolved
69518
69506
  // gets called
69519
69507
  patchConfig?.(resolved);
69520
- const resolvePlugins = await createResolvePlugins(resolved);
69521
- resolved.resolvePlugins = resolvePlugins;
69522
- const resolvedPlugins = resolvePlugins(prePlugins, normalPlugins, postPlugins);
69523
- resolved.plugins = resolvedPlugins;
69524
- Object.assign(resolved, createPluginHookUtils(resolved.plugins));
69508
+ const resolvedPlugins = await resolvePlugins(resolved, prePlugins, normalPlugins, postPlugins);
69509
+ // Backward compatibility hook used in builder, opt-in to shared plugins during build
69510
+ patchPlugins?.(resolvedPlugins);
69511
+ resolved.plugins =
69512
+ resolvedPlugins;
69513
+ // TODO: Deprecate config.getSortedPlugins and config.getSortedPluginHooks
69514
+ Object.assign(resolved, createPluginHookUtils(resolved.plugins.filter((plugin) => typeof plugin !== 'function')));
69525
69515
  // call configResolved hooks
69526
69516
  await Promise.all(resolved
69527
69517
  .getSortedPluginHooks('configResolved')
@@ -69890,4 +69880,4 @@ function optimizeDepsDisabledBackwardCompatibility(resolved, optimizeDeps, optim
69890
69880
  }
69891
69881
  }
69892
69882
 
69893
- export { resolveEnvPrefix as A, BuildEnvironment as B, index as C, DevEnvironment as D, build$1 as E, preview$1 as F, ServerHMRConnector as S, arraify as a, build as b, createServer as c, defineConfig as d, createBuilder as e, formatPostcssSourceMap as f, preprocessCSS as g, buildErrorMessage as h, isInNodeModules$1 as i, createNodeDevEnvironment as j, fetchModule as k, loadConfigFromFile as l, createServerModuleRunner as m, normalizePath$3 as n, mergeConfig as o, preview as p, mergeAlias as q, resolveConfig as r, sortUserPlugins as s, transformWithEsbuild as t, createFilter as u, rollupVersion as v, send$1 as w, searchForWorkspaceRoot as x, isFileServingAllowed as y, loadEnv as z };
69883
+ export { loadEnv as A, BuildEnvironment as B, resolveEnvPrefix as C, DevEnvironment as D, index as E, build$1 as F, preview$1 as G, ServerHMRConnector as S, arraify as a, build as b, createServer as c, defineConfig as d, createBuilder as e, formatPostcssSourceMap as f, preprocessCSS as g, buildErrorMessage as h, isInNodeModules$1 as i, createNodeDevEnvironment as j, fetchModule as k, loadConfigFromFile as l, createServerModuleRunner as m, ssrTransform as n, normalizePath$3 as o, preview as p, mergeConfig as q, resolveConfig as r, sortUserPlugins as s, transformWithEsbuild as t, mergeAlias as u, createFilter as v, rollupVersion as w, send$1 as x, searchForWorkspaceRoot as y, isFileServingAllowed as z };
package/dist/node/cli.js CHANGED
@@ -731,7 +731,7 @@ cli
731
731
  filterDuplicateOptions(options);
732
732
  // output structure is preserved even after bundling so require()
733
733
  // is ok here
734
- const { createServer } = await import('./chunks/dep-DhoCcTbV.js').then(function (n) { return n.C; });
734
+ const { createServer } = await import('./chunks/dep-XbxO4NmM.js').then(function (n) { return n.E; });
735
735
  try {
736
736
  const server = await createServer({
737
737
  root,
@@ -812,7 +812,7 @@ cli
812
812
  .option('--app', `[boolean] same as builder.entireApp`)
813
813
  .action(async (root, options) => {
814
814
  filterDuplicateOptions(options);
815
- const { createBuilder, buildEnvironment } = await import('./chunks/dep-DhoCcTbV.js').then(function (n) { return n.E; });
815
+ const { createBuilder, buildEnvironment } = await import('./chunks/dep-XbxO4NmM.js').then(function (n) { return n.F; });
816
816
  const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
817
817
  const config = {
818
818
  root,
@@ -888,7 +888,7 @@ cli
888
888
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
889
889
  .action(async (root, options) => {
890
890
  filterDuplicateOptions(options);
891
- const { preview } = await import('./chunks/dep-DhoCcTbV.js').then(function (n) { return n.F; });
891
+ const { preview } = await import('./chunks/dep-XbxO4NmM.js').then(function (n) { return n.G; });
892
892
  try {
893
893
  const server = await preview({
894
894
  root,
@@ -788,7 +788,7 @@ type CLIShortcut<Server = ViteDevServer | PreviewServer> = {
788
788
  * https://github.com/preactjs/wmr/blob/main/packages/wmr/src/lib/rollup-plugin-container.js
789
789
  */
790
790
 
791
- interface BoundedPluginContainer {
791
+ interface IsolatedPluginContainer {
792
792
  options: InputOptions;
793
793
  buildStart(options: InputOptions): Promise<void>;
794
794
  resolveId(id: string, importer: string | undefined, options?: {
@@ -1381,7 +1381,7 @@ declare class Environment {
1381
1381
  name: string;
1382
1382
  config: ResolvedConfig;
1383
1383
  options: ResolvedEnvironmentOptions;
1384
- get plugins(): BoundedPlugin[];
1384
+ get plugins(): IsolatedPlugin[];
1385
1385
  get logger(): Logger;
1386
1386
  constructor(name: string, config: ResolvedConfig, options?: ResolvedEnvironmentOptions);
1387
1387
  }
@@ -1398,7 +1398,7 @@ declare function fetchModule(environment: DevEnvironment, url: string, importer?
1398
1398
 
1399
1399
  declare class ScanEnvironment extends Environment {
1400
1400
  mode: "scan";
1401
- get pluginContainer(): BoundedPluginContainer;
1401
+ get pluginContainer(): IsolatedPluginContainer;
1402
1402
  init(): Promise<void>;
1403
1403
  }
1404
1404
 
@@ -1587,7 +1587,7 @@ declare class DevEnvironment extends Environment {
1587
1587
  moduleGraph: EnvironmentModuleGraph;
1588
1588
  watcher?: FSWatcher;
1589
1589
  depsOptimizer?: DepsOptimizer;
1590
- get pluginContainer(): BoundedPluginContainer;
1590
+ get pluginContainer(): IsolatedPluginContainer;
1591
1591
  /**
1592
1592
  * HMR channel for this environment. If not provided or disabled,
1593
1593
  * it will be a noop channel that does nothing.
@@ -3320,7 +3320,7 @@ interface BasePlugin<A = any> extends rollup.Plugin<A> {
3320
3320
  generateBundle?: ModifyHookContext<rollup.Plugin<A>['generateBundle'], PluginContext>;
3321
3321
  renderChunk?: ModifyHookContext<rollup.Plugin<A>['renderChunk'], PluginContext>;
3322
3322
  }
3323
- type BoundedPlugin<A = any> = BasePlugin<A>;
3323
+ type IsolatedPlugin<A = any> = BasePlugin<A>;
3324
3324
  interface Plugin<A = any> extends BasePlugin<A> {
3325
3325
  /**
3326
3326
  * Opt-in this plugin into the shared plugins pipeline.
@@ -3406,13 +3406,13 @@ type HookHandler<T> = T extends ObjectHook<infer H> ? H : T;
3406
3406
  type PluginWithRequiredHook<K extends keyof Plugin> = Plugin & {
3407
3407
  [P in K]: NonNullable<Plugin[P]>;
3408
3408
  };
3409
- type BoundedPluginConstructor = {
3410
- (environment: PluginEnvironment): BoundedPluginOption;
3409
+ type IsolatedPluginConstructor = {
3410
+ (environment: PluginEnvironment): IsolatedPluginOption;
3411
3411
  sharedDuringBuild?: boolean;
3412
3412
  };
3413
- type MaybeBoundedPlugin = BoundedPlugin | false | null | undefined;
3414
- type BoundedPluginOption = MaybeBoundedPlugin | BoundedPluginOption[] | Promise<MaybeBoundedPlugin | BoundedPluginOption[]>;
3415
- type MaybePlugin = Plugin | BoundedPluginConstructor | false | null | undefined;
3413
+ type MaybeIsolatedPlugin = IsolatedPlugin | false | null | undefined;
3414
+ type IsolatedPluginOption = MaybeIsolatedPlugin | IsolatedPluginOption[] | Promise<MaybeIsolatedPlugin | IsolatedPluginOption[]>;
3415
+ type MaybePlugin = Plugin | IsolatedPluginConstructor | false | null | undefined;
3416
3416
  type PluginOption = MaybePlugin | PluginOption[] | Promise<MaybePlugin | PluginOption[]>;
3417
3417
 
3418
3418
  interface JsonOptions {
@@ -3861,8 +3861,7 @@ type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclu
3861
3861
  resolve: Required<ResolveOptions> & {
3862
3862
  alias: Alias[];
3863
3863
  };
3864
- plugins: readonly Plugin[];
3865
- rawPlugins: readonly (Plugin | BoundedPluginConstructor)[];
3864
+ plugins: readonly (Plugin | IsolatedPluginConstructor)[];
3866
3865
  css: ResolvedCSSOptions;
3867
3866
  esbuild: ESBuildOptions | false;
3868
3867
  server: ResolvedServerOptions;
@@ -3885,7 +3884,7 @@ interface PluginHookUtils {
3885
3884
  getSortedPluginHooks: <K extends keyof Plugin>(hookName: K) => NonNullable<HookHandler<Plugin[K]>>[];
3886
3885
  }
3887
3886
  type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
3888
- declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean, patchConfig?: ((config: ResolvedConfig) => void) | undefined, patchPlugins?: ((plugins: (Plugin | BoundedPluginConstructor)[]) => void) | undefined): Promise<ResolvedConfig>;
3887
+ declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean, patchConfig?: ((config: ResolvedConfig) => void) | undefined, patchPlugins?: ((resolvedPlugins: (Plugin | IsolatedPluginConstructor)[]) => void) | undefined): Promise<ResolvedConfig>;
3889
3888
  declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
3890
3889
  declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger): Promise<{
3891
3890
  path: string;
@@ -3934,6 +3933,15 @@ declare class ServerHMRConnector implements ModuleRunnerHMRConnection {
3934
3933
  onUpdate(handler: (payload: HMRPayload) => void): void;
3935
3934
  }
3936
3935
 
3936
+ interface ModuleRunnerTransformOptions {
3937
+ json?: {
3938
+ stringify?: boolean;
3939
+ };
3940
+ }
3941
+ declare function ssrTransform(code: string, inMap: SourceMap | {
3942
+ mappings: '';
3943
+ } | null, url: string, originalCode: string, options?: ModuleRunnerTransformOptions): Promise<TransformResult | null>;
3944
+
3937
3945
  declare const VERSION: string;
3938
3946
 
3939
3947
  declare const isCSSRequest: (request: string) => boolean;
@@ -4005,4 +4013,4 @@ interface ManifestChunk {
4005
4013
  dynamicImports?: string[];
4006
4014
  }
4007
4015
 
4008
- export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, type BoundedPlugin, type BoundedPluginConstructor, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentOptions, type DevEnvironmentSetup, type ESBuildOptions, type ESBuildTransformResult, EnvironmentModuleGraph, EnvironmentModuleNode, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotUpdateContext, type HtmlTagDescriptor, HttpProxy, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type OptimizedDepInfo, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, RemoteEnvironmentTransport, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerModuleRunnerOptions, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteBuilder, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createBuilder, createFilter, createLogger, createNodeDevEnvironment, createServer, createServerModuleRunner, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
4016
+ export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentOptions, type DevEnvironmentSetup, type ESBuildOptions, type ESBuildTransformResult, EnvironmentModuleGraph, EnvironmentModuleNode, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotUpdateContext, type HtmlTagDescriptor, HttpProxy, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type IsolatedPlugin, type IsolatedPluginConstructor, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type OptimizedDepInfo, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, RemoteEnvironmentTransport, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerModuleRunnerOptions, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteBuilder, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createBuilder, createFilter, createLogger, createNodeDevEnvironment, createServer, createServerModuleRunner, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-DhoCcTbV.js';
3
- export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, h as buildErrorMessage, e as createBuilder, u as createFilter, j as createNodeDevEnvironment, c as createServer, m as createServerModuleRunner, d as defineConfig, k as fetchModule, f as formatPostcssSourceMap, y as isFileServingAllowed, l as loadConfigFromFile, z as loadEnv, q as mergeAlias, o as mergeConfig, n as normalizePath, g as preprocessCSS, p as preview, r as resolveConfig, A as resolveEnvPrefix, v as rollupVersion, x as searchForWorkspaceRoot, w as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-DhoCcTbV.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-XbxO4NmM.js';
3
+ export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, h as buildErrorMessage, e as createBuilder, v as createFilter, j as createNodeDevEnvironment, c as createServer, m as createServerModuleRunner, d as defineConfig, k as fetchModule, f as formatPostcssSourceMap, z as isFileServingAllowed, l as loadConfigFromFile, A as loadEnv, u as mergeAlias, q as mergeConfig, n as moduleRunnerTransform, o as normalizePath, g as preprocessCSS, p as preview, r as resolveConfig, C as resolveEnvPrefix, w as rollupVersion, y as searchForWorkspaceRoot, x as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-XbxO4NmM.js';
4
4
  export { VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  export { c as createLogger } from './chunks/dep-C7zR1Rh8.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "6.0.0-alpha.10",
3
+ "version": "6.0.0-alpha.13",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",