vite 6.0.0-alpha.3 → 6.0.0-alpha.5

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.
@@ -1,6 +1,6 @@
1
1
  import fs$l, { promises as promises$1, existsSync as existsSync$1, readFileSync as readFileSync$1 } from 'node:fs';
2
2
  import fsp from 'node:fs/promises';
3
- import path$o, { dirname as dirname$2, join as join$2, posix as posix$1, isAbsolute as isAbsolute$2, extname as extname$1, relative as relative$2, basename as basename$2 } from 'node:path';
3
+ import path$o, { posix as posix$1, isAbsolute as isAbsolute$2, join as join$2, dirname as dirname$2, extname as extname$1, relative as relative$2, basename as basename$2 } from 'node:path';
4
4
  import { fileURLToPath, URL as URL$3, parse as parse$i, pathToFileURL } from 'node:url';
5
5
  import { promisify as promisify$4, format as format$2, inspect } from 'node:util';
6
6
  import { performance } from 'node:perf_hooks';
@@ -15158,6 +15158,34 @@ function terserPlugin(config) {
15158
15158
  };
15159
15159
  }
15160
15160
 
15161
+ async function resolveBoundedPlugins(environment) {
15162
+ const resolvedPlugins = [];
15163
+ for (const plugin of environment.config.plugins) {
15164
+ if (plugin.create) {
15165
+ const boundedPlugin = await plugin.create(environment);
15166
+ if (boundedPlugin) {
15167
+ const flatPlugins = await asyncFlattenBoundedPlugin(environment, boundedPlugin);
15168
+ resolvedPlugins.push(...flatPlugins);
15169
+ }
15170
+ }
15171
+ else {
15172
+ resolvedPlugins.push(plugin);
15173
+ }
15174
+ }
15175
+ return resolvedPlugins;
15176
+ }
15177
+ async function asyncFlattenBoundedPlugin(environment, plugins) {
15178
+ if (!Array.isArray(plugins)) {
15179
+ plugins = [plugins];
15180
+ }
15181
+ do {
15182
+ plugins = (await Promise.all(plugins.map((p) => (p && p.split ? p.split(environment) : p))))
15183
+ .flat(Infinity)
15184
+ .filter(Boolean);
15185
+ } while (plugins.some((v) => v?.then || v?.split));
15186
+ return plugins;
15187
+ }
15188
+
15161
15189
  const mimes = {
15162
15190
  "3g2": "video/3gpp2",
15163
15191
  "3gp": "video/3gpp",
@@ -29195,68 +29223,6 @@ const environmentColors = [
29195
29223
  colors$1.gray,
29196
29224
  ];
29197
29225
 
29198
- // https://github.com/vitejs/vite/issues/2820#issuecomment-812495079
29199
- const ROOT_FILES = [
29200
- // '.git',
29201
- // https://pnpm.io/workspaces/
29202
- 'pnpm-workspace.yaml',
29203
- // https://rushjs.io/pages/advanced/config_files/
29204
- // 'rush.json',
29205
- // https://nx.dev/latest/react/getting-started/nx-setup
29206
- // 'workspace.json',
29207
- // 'nx.json',
29208
- // https://github.com/lerna/lerna#lernajson
29209
- 'lerna.json',
29210
- ];
29211
- // npm: https://docs.npmjs.com/cli/v7/using-npm/workspaces#installing-workspaces
29212
- // yarn: https://classic.yarnpkg.com/en/docs/workspaces/#toc-how-to-use-it
29213
- function hasWorkspacePackageJSON(root) {
29214
- const path = join$2(root, 'package.json');
29215
- if (!isFileReadable(path)) {
29216
- return false;
29217
- }
29218
- try {
29219
- const content = JSON.parse(fs$l.readFileSync(path, 'utf-8')) || {};
29220
- return !!content.workspaces;
29221
- }
29222
- catch {
29223
- return false;
29224
- }
29225
- }
29226
- function hasRootFile(root) {
29227
- return ROOT_FILES.some((file) => fs$l.existsSync(join$2(root, file)));
29228
- }
29229
- function hasPackageJSON(root) {
29230
- const path = join$2(root, 'package.json');
29231
- return fs$l.existsSync(path);
29232
- }
29233
- /**
29234
- * Search up for the nearest `package.json`
29235
- */
29236
- function searchForPackageRoot(current, root = current) {
29237
- if (hasPackageJSON(current))
29238
- return current;
29239
- const dir = dirname$2(current);
29240
- // reach the fs root
29241
- if (!dir || dir === current)
29242
- return root;
29243
- return searchForPackageRoot(dir, root);
29244
- }
29245
- /**
29246
- * Search up for the nearest workspace root
29247
- */
29248
- function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
29249
- if (hasRootFile(current))
29250
- return current;
29251
- if (hasWorkspacePackageJSON(current))
29252
- return current;
29253
- const dir = dirname$2(current);
29254
- // reach the fs root
29255
- if (!dir || dir === current)
29256
- return root;
29257
- return searchForWorkspaceRoot(dir, root);
29258
- }
29259
-
29260
29226
  // An implementation of fsUtils without caching
29261
29227
  const commonFsUtils = {
29262
29228
  existsSync: fs$l.existsSync,
@@ -29332,7 +29298,7 @@ function pathUntilPart(root, parts, i) {
29332
29298
  return p;
29333
29299
  }
29334
29300
  function createCachedFsUtils(config) {
29335
- const root = normalizePath$3(searchForWorkspaceRoot(config.root));
29301
+ const root = config.root; // root is resolved and normalized, so it doesn't have a trailing slash
29336
29302
  const rootDirPath = `${root}/`;
29337
29303
  const rootCache = { type: 'directory' }; // dirents will be computed lazily
29338
29304
  const getDirentCacheSync = (parts) => {
@@ -36491,34 +36457,6 @@ function esbuildCjsExternalPlugin(externals, platform) {
36491
36457
  };
36492
36458
  }
36493
36459
 
36494
- async function resolveBoundedPlugins(environment) {
36495
- const resolvedPlugins = [];
36496
- for (const plugin of environment.config.plugins) {
36497
- if (plugin.create) {
36498
- const boundedPlugin = await plugin.create(environment);
36499
- if (boundedPlugin) {
36500
- const flatPlugins = await asyncFlattenBoundedPlugin(environment, boundedPlugin);
36501
- resolvedPlugins.push(...flatPlugins);
36502
- }
36503
- }
36504
- else {
36505
- resolvedPlugins.push(plugin);
36506
- }
36507
- }
36508
- return resolvedPlugins;
36509
- }
36510
- async function asyncFlattenBoundedPlugin(environment, plugins) {
36511
- if (!Array.isArray(plugins)) {
36512
- plugins = [plugins];
36513
- }
36514
- do {
36515
- plugins = (await Promise.all(plugins.map((p) => (p && p.split ? p.split(environment) : p))))
36516
- .flat(Infinity)
36517
- .filter(Boolean);
36518
- } while (plugins.some((v) => v?.then || v?.split));
36519
- return plugins;
36520
- }
36521
-
36522
36460
  // Copyright 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Simon Lydell
36523
36461
  // License: MIT.
36524
36462
  var HashbangComment, Identifier, JSXIdentifier, JSXPunctuator, JSXString, JSXText, KeywordsWithExpressionAfter, KeywordsWithNoLineTerminatorAfter, LineTerminatorSequence, MultiLineComment, Newline, NumericLiteral, Punctuator, RegularExpressionLiteral, SingleLineComment, StringLiteral, Template, TokensNotPrecedingObjectLiteral, TokensPrecedingExpression, WhiteSpace;
@@ -47518,15 +47456,12 @@ class ServerHMRBroadcasterClient {
47518
47456
  * @experimental
47519
47457
  */
47520
47458
  class ServerHMRConnector {
47521
- handlers = [];
47522
47459
  hmrChannel;
47460
+ handlers = [];
47523
47461
  hmrClient;
47524
47462
  connected = false;
47525
- constructor(server) {
47526
- const hmrChannel = server.hot?.channels.find((c) => c.name === 'ssr');
47527
- if (!hmrChannel) {
47528
- throw new Error("Your version of Vite doesn't support HMR during SSR. Please, use Vite 5.1 or higher.");
47529
- }
47463
+ constructor(hmrChannel) {
47464
+ this.hmrChannel = hmrChannel;
47530
47465
  this.hmrClient = new ServerHMRBroadcasterClient(hmrChannel);
47531
47466
  hmrChannel.api.outsideEmitter.on('send', (payload) => {
47532
47467
  this.handlers.forEach((listener) => listener(payload));
@@ -47547,8 +47482,8 @@ class ServerHMRConnector {
47547
47482
  }
47548
47483
  }
47549
47484
 
47550
- function createHMROptions(server, options) {
47551
- if (server.config.server.hmr === false || options.hmr === false) {
47485
+ function createHMROptions(environment, options) {
47486
+ if (environment.config.server.hmr === false || options.hmr === false) {
47552
47487
  return false;
47553
47488
  }
47554
47489
  if (options.hmr?.connection) {
@@ -47557,7 +47492,9 @@ function createHMROptions(server, options) {
47557
47492
  logger: options.hmr.logger,
47558
47493
  };
47559
47494
  }
47560
- const connection = new ServerHMRConnector(server);
47495
+ if (!('api' in environment.hot))
47496
+ return false;
47497
+ const connection = new ServerHMRConnector(environment.hot);
47561
47498
  return {
47562
47499
  connection,
47563
47500
  logger: options.hmr?.logger,
@@ -47589,8 +47526,8 @@ function resolveSourceMapOptions(options) {
47589
47526
  * Create an instance of the Vite SSR runtime that support HMR.
47590
47527
  * @experimental
47591
47528
  */
47592
- function createServerModuleRunner(server, environment, options = {}) {
47593
- const hmr = createHMROptions(server, options);
47529
+ function createServerModuleRunner(environment, options = {}) {
47530
+ const hmr = createHMROptions(environment, options);
47594
47531
  return new ModuleRunner({
47595
47532
  ...options,
47596
47533
  root: environment.config.root,
@@ -47603,12 +47540,10 @@ function createServerModuleRunner(server, environment, options = {}) {
47603
47540
  }
47604
47541
 
47605
47542
  async function ssrLoadModule(url, server, _context = { global }, _urlStack = [], fixStacktrace) {
47606
- server.config.logger.warnOnce(colors$1.yellow('`ssrLoadModule` is deprecated and will be removed in the next major version. ' +
47607
- 'Use `createServerModuleRunner(environment).import(url)` from "vite/module-runner" ' +
47608
- 'to load modules instead.'));
47609
47543
  const runner = server._ssrCompatModuleRunner ||
47610
- (server._ssrCompatModuleRunner = createServerModuleRunner(server, server.environments.ssr, {
47544
+ (server._ssrCompatModuleRunner = createServerModuleRunner(server.environments.ssr, {
47611
47545
  sourcemapInterceptor: false,
47546
+ hmr: false,
47612
47547
  }));
47613
47548
  url = unwrapId$1(url);
47614
47549
  return instantiateModule(url, runner, server, fixStacktrace);
@@ -59910,6 +59845,68 @@ function notFoundMiddleware() {
59910
59845
  };
59911
59846
  }
59912
59847
 
59848
+ // https://github.com/vitejs/vite/issues/2820#issuecomment-812495079
59849
+ const ROOT_FILES = [
59850
+ // '.git',
59851
+ // https://pnpm.io/workspaces/
59852
+ 'pnpm-workspace.yaml',
59853
+ // https://rushjs.io/pages/advanced/config_files/
59854
+ // 'rush.json',
59855
+ // https://nx.dev/latest/react/getting-started/nx-setup
59856
+ // 'workspace.json',
59857
+ // 'nx.json',
59858
+ // https://github.com/lerna/lerna#lernajson
59859
+ 'lerna.json',
59860
+ ];
59861
+ // npm: https://docs.npmjs.com/cli/v7/using-npm/workspaces#installing-workspaces
59862
+ // yarn: https://classic.yarnpkg.com/en/docs/workspaces/#toc-how-to-use-it
59863
+ function hasWorkspacePackageJSON(root) {
59864
+ const path = join$2(root, 'package.json');
59865
+ if (!isFileReadable(path)) {
59866
+ return false;
59867
+ }
59868
+ try {
59869
+ const content = JSON.parse(fs$l.readFileSync(path, 'utf-8')) || {};
59870
+ return !!content.workspaces;
59871
+ }
59872
+ catch {
59873
+ return false;
59874
+ }
59875
+ }
59876
+ function hasRootFile(root) {
59877
+ return ROOT_FILES.some((file) => fs$l.existsSync(join$2(root, file)));
59878
+ }
59879
+ function hasPackageJSON(root) {
59880
+ const path = join$2(root, 'package.json');
59881
+ return fs$l.existsSync(path);
59882
+ }
59883
+ /**
59884
+ * Search up for the nearest `package.json`
59885
+ */
59886
+ function searchForPackageRoot(current, root = current) {
59887
+ if (hasPackageJSON(current))
59888
+ return current;
59889
+ const dir = dirname$2(current);
59890
+ // reach the fs root
59891
+ if (!dir || dir === current)
59892
+ return root;
59893
+ return searchForPackageRoot(dir, root);
59894
+ }
59895
+ /**
59896
+ * Search up for the nearest workspace root
59897
+ */
59898
+ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
59899
+ if (hasRootFile(current))
59900
+ return current;
59901
+ if (hasWorkspacePackageJSON(current))
59902
+ return current;
59903
+ const dir = dirname$2(current);
59904
+ // reach the fs root
59905
+ if (!dir || dir === current)
59906
+ return root;
59907
+ return searchForWorkspaceRoot(dir, root);
59908
+ }
59909
+
59913
59910
  function warmupFiles(server) {
59914
59911
  const { root } = server.config;
59915
59912
  for (const environment of Object.values(server.environments)) {
@@ -61245,6 +61242,8 @@ async function _createServer(inlineConfig = {}, options) {
61245
61242
  if (typeof config.server.hmr === 'object' && config.server.hmr.channels) {
61246
61243
  config.server.hmr.channels.forEach((channel) => hot.addChannel(channel));
61247
61244
  }
61245
+ const publicFiles = await initPublicFilesPromise;
61246
+ const { publicDir } = config;
61248
61247
  if (httpServer) {
61249
61248
  setClientErrorHandler(httpServer, config.logger);
61250
61249
  }
@@ -61257,6 +61256,9 @@ async function _createServer(inlineConfig = {}, options) {
61257
61256
  root,
61258
61257
  ...config.configFileDependencies,
61259
61258
  ...getEnvFilesForMode(config.mode, config.envDir),
61259
+ // Watch the public directory explicitly because it might be outside
61260
+ // of the root directory.
61261
+ ...(publicDir && publicFiles ? [publicDir] : []),
61260
61262
  ], resolvedWatchOptions)
61261
61263
  : createNoopWatcher(resolvedWatchOptions);
61262
61264
  const environments = {};
@@ -61475,13 +61477,11 @@ async function _createServer(inlineConfig = {}, options) {
61475
61477
  process.stdin.on('end', exitProcess);
61476
61478
  }
61477
61479
  }
61478
- const publicFiles = await initPublicFilesPromise;
61479
61480
  const onHMRUpdate = async (type, file) => {
61480
61481
  if (serverConfig.hmr !== false) {
61481
61482
  await handleHMRUpdate(type, file, server);
61482
61483
  }
61483
61484
  };
61484
- const { publicDir } = config;
61485
61485
  const onFileAddUnlink = async (file, isUnlink) => {
61486
61486
  file = normalizePath$3(file);
61487
61487
  await pluginContainer.watchChange(file, {
@@ -64504,8 +64504,9 @@ async function transformDynamicImport(importSource, importer, resolve, root) {
64504
64504
  if (!resolvedFileName) {
64505
64505
  return null;
64506
64506
  }
64507
- const relativeFileName = posix$1.relative(posix$1.dirname(normalizePath$3(importer)), normalizePath$3(resolvedFileName));
64508
- importSource = normalizePath$3('`' + (relativeFileName[0] === '.' ? '' : './') + relativeFileName + '`');
64507
+ const relativeFileName = normalizePath$3(posix$1.relative(posix$1.dirname(normalizePath$3(importer)), normalizePath$3(resolvedFileName)));
64508
+ importSource =
64509
+ '`' + (relativeFileName[0] === '.' ? '' : './') + relativeFileName + '`';
64509
64510
  }
64510
64511
  const dynamicImportPattern = parseDynamicImportPattern(importSource);
64511
64512
  if (!dynamicImportPattern) {
@@ -68001,7 +68002,7 @@ async function resolveBuildPlugins(config) {
68001
68002
  * Returns a Promise containing the build result.
68002
68003
  */
68003
68004
  async function build(inlineConfig = {}) {
68004
- const builder = await createViteBuilder({}, { ...inlineConfig, plugins: () => inlineConfig.plugins ?? [] });
68005
+ const builder = await createBuilder(inlineConfig);
68005
68006
  if (builder.config.build.lib) {
68006
68007
  // TODO: temporal workaround. Should we support `libraries: Record<string, LibraryOptions & EnvironmentOptions>`
68007
68008
  // to build multiple libraries and be able to target different environments (for example for a Svelte components
@@ -68014,16 +68015,17 @@ async function build(inlineConfig = {}) {
68014
68015
  return builder.build(environment);
68015
68016
  }
68016
68017
  }
68017
- function resolveConfigToBuild(inlineConfig = {}) {
68018
- return resolveConfig(inlineConfig, 'build', 'production', 'production');
68018
+ function resolveConfigToBuild(inlineConfig = {}, patchConfig) {
68019
+ return resolveConfig(inlineConfig, 'build', 'production', 'production', false, patchConfig);
68019
68020
  }
68020
68021
  /**
68021
68022
  * Build an App environment, or a App library (if librayOptions is provided)
68022
68023
  **/
68023
68024
  async function buildEnvironment(config, environment, libOptions = false) {
68024
68025
  const options = config.build;
68026
+ const { logger } = environment;
68025
68027
  const ssr = environment.name !== 'client';
68026
- config.logger.info(colors$1.cyan(`vite v${VERSION} ${colors$1.green(`building ${ssr ? `SSR bundle ` : ``}for ${config.mode}...`)}`));
68028
+ logger.info(colors$1.cyan(`vite v${VERSION} ${colors$1.green(`building ${ssr ? `SSR bundle ` : ``}for ${config.mode}...`)}`));
68027
68029
  const resolve = (p) => path$o.resolve(config.root, p);
68028
68030
  const input = libOptions
68029
68031
  ? options.rollupOptions?.input ||
@@ -68054,9 +68056,8 @@ async function buildEnvironment(config, environment, libOptions = false) {
68054
68056
  }
68055
68057
  const outDir = resolve(options.outDir);
68056
68058
  // inject environment and ssr arg to plugin load/transform hooks
68057
- const plugins = (environment || ssr
68058
- ? config.plugins.map((p) => injectEnvironmentToHooks(p, environment))
68059
- : config.plugins);
68059
+ // TODO: rework lib mode
68060
+ const plugins = (libOptions ? config : environment).plugins.map((p) => injectEnvironmentToHooks(p, environment));
68060
68061
  const rollupOptions = {
68061
68062
  preserveEntrySignatures: ssr
68062
68063
  ? 'allow-extension'
@@ -68085,7 +68086,7 @@ async function buildEnvironment(config, environment, libOptions = false) {
68085
68086
  const outputBuildError = (e) => {
68086
68087
  const msg = mergeRollupError(e);
68087
68088
  clearLine();
68088
- config.logger.error(msg, { error: e });
68089
+ logger.error(msg, { error: e });
68089
68090
  };
68090
68091
  let bundle;
68091
68092
  let startTime;
@@ -68093,7 +68094,7 @@ async function buildEnvironment(config, environment, libOptions = false) {
68093
68094
  const buildOutputOptions = (output = {}) => {
68094
68095
  // @ts-expect-error See https://github.com/vitejs/vite/issues/5812#issuecomment-984345618
68095
68096
  if (output.output) {
68096
- config.logger.warn(`You've set "rollupOptions.output.output" in your config. ` +
68097
+ logger.warn(`You've set "rollupOptions.output.output" in your config. ` +
68097
68098
  `This is deprecated and will override all Vite.js default output options. ` +
68098
68099
  `Please use "rollupOptions.output" instead.`);
68099
68100
  }
@@ -68102,7 +68103,7 @@ async function buildEnvironment(config, environment, libOptions = false) {
68102
68103
  `Please use "rollupOptions.output.dir" and "rollupOptions.output.entryFileNames" instead.`);
68103
68104
  }
68104
68105
  if (output.sourcemap) {
68105
- config.logger.warnOnce(colors$1.yellow(`Vite does not support "rollupOptions.output.sourcemap". ` +
68106
+ logger.warnOnce(colors$1.yellow(`Vite does not support "rollupOptions.output.sourcemap". ` +
68106
68107
  `Please use "build.sourcemap" instead.`));
68107
68108
  }
68108
68109
  const format = output.format || 'es';
@@ -68145,7 +68146,7 @@ async function buildEnvironment(config, environment, libOptions = false) {
68145
68146
  };
68146
68147
  };
68147
68148
  // resolve lib mode outputs
68148
- const outputs = resolveBuildOutputs(options.rollupOptions?.output, libOptions, config.logger);
68149
+ const outputs = resolveBuildOutputs(options.rollupOptions?.output, libOptions, logger);
68149
68150
  const normalizedOutputs = [];
68150
68151
  if (Array.isArray(outputs)) {
68151
68152
  for (const resolvedOutput of outputs) {
@@ -68156,10 +68157,10 @@ async function buildEnvironment(config, environment, libOptions = false) {
68156
68157
  normalizedOutputs.push(buildOutputOptions(outputs));
68157
68158
  }
68158
68159
  const resolvedOutDirs = getResolvedOutDirs(config.root, options.outDir, options.rollupOptions?.output);
68159
- const emptyOutDir = resolveEmptyOutDir(options.emptyOutDir, config.root, resolvedOutDirs, config.logger);
68160
+ const emptyOutDir = resolveEmptyOutDir(options.emptyOutDir, config.root, resolvedOutDirs, logger);
68160
68161
  // watch file changes with rollup
68161
68162
  if (config.build.watch) {
68162
- config.logger.info(colors$1.cyan(`\nwatching for file changes...`));
68163
+ logger.info(colors$1.cyan(`\nwatching for file changes...`));
68163
68164
  const resolvedChokidarOptions = resolveChokidarOptions(config, config.build.watch.chokidar, resolvedOutDirs, emptyOutDir);
68164
68165
  const { watch } = await import('rollup');
68165
68166
  const watcher = watch({
@@ -68172,14 +68173,14 @@ async function buildEnvironment(config, environment, libOptions = false) {
68172
68173
  });
68173
68174
  watcher.on('event', (event) => {
68174
68175
  if (event.code === 'BUNDLE_START') {
68175
- config.logger.info(colors$1.cyan(`\nbuild started...`));
68176
+ logger.info(colors$1.cyan(`\nbuild started...`));
68176
68177
  if (options.write) {
68177
68178
  prepareOutDir(resolvedOutDirs, emptyOutDir, config);
68178
68179
  }
68179
68180
  }
68180
68181
  else if (event.code === 'BUNDLE_END') {
68181
68182
  event.result.close();
68182
- config.logger.info(colors$1.cyan(`built in ${event.duration}ms.`));
68183
+ logger.info(colors$1.cyan(`built in ${event.duration}ms.`));
68183
68184
  }
68184
68185
  else if (event.code === 'ERROR') {
68185
68186
  outputBuildError(event.error);
@@ -68198,14 +68199,14 @@ async function buildEnvironment(config, environment, libOptions = false) {
68198
68199
  for (const output of normalizedOutputs) {
68199
68200
  res.push(await bundle[options.write ? 'write' : 'generate'](output));
68200
68201
  }
68201
- config.logger.info(`${colors$1.green(`✓ built in ${displayTime(Date.now() - startTime)}`)}`);
68202
+ logger.info(`${colors$1.green(`✓ built in ${displayTime(Date.now() - startTime)}`)}`);
68202
68203
  return Array.isArray(outputs) ? res : res[0];
68203
68204
  }
68204
68205
  catch (e) {
68205
68206
  e.message = mergeRollupError(e);
68206
68207
  clearLine();
68207
68208
  if (startTime) {
68208
- config.logger.error(`${colors$1.red('x')} Build failed in ${displayTime(Date.now() - startTime)}`);
68209
+ logger.error(`${colors$1.red('x')} Build failed in ${displayTime(Date.now() - startTime)}`);
68209
68210
  startTime = undefined;
68210
68211
  }
68211
68212
  throw e;
@@ -68578,54 +68579,45 @@ class BuildEnvironment extends Environment {
68578
68579
  }
68579
68580
  super(name, config, options);
68580
68581
  }
68582
+ async init() {
68583
+ if (this._inited) {
68584
+ return;
68585
+ }
68586
+ this._inited = true;
68587
+ this._plugins = await resolveBoundedPlugins(this);
68588
+ }
68581
68589
  }
68582
- async function defaultBuildEnvironments(builder, build) {
68590
+ async function defaultBuildApp(builder) {
68583
68591
  for (const environment of Object.values(builder.environments)) {
68584
- await build(environment);
68592
+ await builder.build(environment);
68585
68593
  }
68586
68594
  }
68587
68595
  function resolveBuilderOptions(options = {}) {
68588
68596
  return {
68589
- buildEnvironments: options.buildEnvironments ?? defaultBuildEnvironments,
68597
+ sharedConfigBuild: options.sharedConfigBuild ?? false,
68598
+ sharedPlugins: options.sharedPlugins ?? false,
68599
+ entireApp: options.entireApp ?? false,
68600
+ buildApp: options.buildApp ?? defaultBuildApp,
68590
68601
  };
68591
68602
  }
68592
- async function createViteBuilder(builderOptions = {}, defaultBuilderInlineConfig = {}) {
68593
- // Plugins passed to the Builder inline config needs to be created
68594
- // from a factory to ensure each build has their own instances
68595
- const resolveConfig = (environmentOptions) => {
68596
- const { plugins } = defaultBuilderInlineConfig;
68597
- let defaultInlineConfig = plugins
68598
- ? {
68599
- ...defaultBuilderInlineConfig,
68600
- plugins: plugins(),
68601
- }
68602
- : defaultBuilderInlineConfig;
68603
- if (environmentOptions) {
68604
- defaultInlineConfig = mergeConfig(defaultInlineConfig, environmentOptions);
68605
- }
68606
- // We resolve the whole config including plugins here but later on we
68607
- // need to refactor resolveConfig to only resolve the environments config
68608
- return resolveConfigToBuild(defaultInlineConfig);
68609
- };
68610
- const defaultConfig = await resolveConfig();
68603
+ async function createBuilder(inlineConfig = {}) {
68604
+ const config = await resolveConfigToBuild(inlineConfig);
68611
68605
  const environments = {};
68612
68606
  const builder = {
68613
68607
  environments,
68614
- config: defaultConfig,
68615
- async buildEnvironments() {
68616
- if (defaultConfig.build.watch) {
68617
- throw new Error('Watch mode is not yet supported in viteBuilder.buildEnvironments()');
68608
+ config,
68609
+ async buildApp() {
68610
+ if (config.build.watch) {
68611
+ throw new Error('Watch mode is not yet supported in viteBuilder.buildApp()');
68618
68612
  }
68619
- return defaultConfig.builder.buildEnvironments(builder, async (environment) => {
68620
- await this.build(environment);
68621
- });
68613
+ return config.builder.buildApp(builder);
68622
68614
  },
68623
68615
  async build(environment) {
68624
68616
  return buildEnvironment(environment.config, environment);
68625
68617
  },
68626
68618
  };
68627
- for (const name of Object.keys(defaultConfig.environments)) {
68628
- const environmentOptions = defaultConfig.environments[name];
68619
+ for (const name of Object.keys(config.environments)) {
68620
+ const environmentOptions = config.environments[name];
68629
68621
  const createEnvironment = environmentOptions.build?.createEnvironment ??
68630
68622
  ((name, config) => new BuildEnvironment(name, config));
68631
68623
  // We need to resolve the config again so we can properly merge options
@@ -68633,8 +68625,36 @@ async function createViteBuilder(builderOptions = {}, defaultBuilderInlineConfig
68633
68625
  // expects plugins to be run for the same environment once they are created
68634
68626
  // and to process a single bundle at a time (contrary to dev mode where
68635
68627
  // plugins are built to handle multiple environments concurrently).
68636
- const environmentConfig = await resolveConfig(environmentOptions);
68628
+ let environmentConfig = config;
68629
+ if (!config.builder.sharedConfigBuild) {
68630
+ const patchConfig = (resolved) => {
68631
+ // Force opt-in shared plugins
68632
+ const environmentPlugins = [...resolved.plugins];
68633
+ let validMixedPlugins = true;
68634
+ for (let i = 0; i < environmentPlugins.length; i++) {
68635
+ const environmentPlugin = environmentPlugins[i];
68636
+ const sharedPlugin = config.plugins[i];
68637
+ if (config.builder.sharedPlugins ||
68638
+ environmentPlugin.sharedDuringBuild) {
68639
+ if (environmentPlugin.name !== sharedPlugin.name) {
68640
+ validMixedPlugins = false;
68641
+ break;
68642
+ }
68643
+ environmentPlugins[i] = sharedPlugin;
68644
+ }
68645
+ }
68646
+ if (validMixedPlugins) {
68647
+ resolved.plugins = environmentPlugins;
68648
+ }
68649
+ resolved.build = {
68650
+ ...resolved.environments[name].build,
68651
+ lib: false,
68652
+ };
68653
+ };
68654
+ environmentConfig = await resolveConfigToBuild(inlineConfig, patchConfig);
68655
+ }
68637
68656
  const environment = await createEnvironment(name, environmentConfig);
68657
+ await environment.init();
68638
68658
  environments[name] = environment;
68639
68659
  }
68640
68660
  return builder;
@@ -68645,8 +68665,8 @@ var build$1 = {
68645
68665
  BuildEnvironment: BuildEnvironment,
68646
68666
  build: build,
68647
68667
  buildEnvironment: buildEnvironment,
68668
+ createBuilder: createBuilder,
68648
68669
  createToImportMetaURLBasedRelativeRuntime: createToImportMetaURLBasedRelativeRuntime,
68649
- createViteBuilder: createViteBuilder,
68650
68670
  injectEnvironmentToHooks: injectEnvironmentToHooks,
68651
68671
  onRollupWarning: onRollupWarning,
68652
68672
  resolveBuildEnvironmentOptions: resolveBuildEnvironmentOptions,
@@ -69048,7 +69068,7 @@ function resolveOptimizeDepsConfig(optimizeDeps, preserveSymlinks) {
69048
69068
  disabled: optimizeDeps.disabled,
69049
69069
  };
69050
69070
  }
69051
- async function resolveConfig(inlineConfig, command, defaultMode = 'development', defaultNodeEnv = 'development', isPreview = false) {
69071
+ async function resolveConfig(inlineConfig, command, defaultMode = 'development', defaultNodeEnv = 'development', isPreview = false, patchConfig = undefined) {
69052
69072
  let config = inlineConfig;
69053
69073
  let configFileDependencies = [];
69054
69074
  let mode = inlineConfig.mode || defaultMode;
@@ -69125,9 +69145,9 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
69125
69145
  // Backward compatibility: merge optimizeDeps into environments.client.dev.optimizeDeps as defaults
69126
69146
  // TODO: should entries and force be in EnvironmentOptions?
69127
69147
  const { entries, force, ...deprecatedClientOptimizeDepsConfig } = config.optimizeDeps ?? {};
69128
- let configEnvironmentsClient = config.environments.client;
69148
+ const configEnvironmentsClient = config.environments.client;
69129
69149
  configEnvironmentsClient.dev ??= {};
69130
- configEnvironmentsClient.dev.optimizeDeps = mergeConfig(configEnvironmentsClient.dev.optimizeDeps ?? {}, deprecatedClientOptimizeDepsConfig);
69150
+ configEnvironmentsClient.dev.optimizeDeps = mergeConfig(deprecatedClientOptimizeDepsConfig, configEnvironmentsClient.dev.optimizeDeps ?? {});
69131
69151
  const deprecatedSsrOptimizeDepsConfig = config.ssr?.optimizeDeps ?? {};
69132
69152
  let configEnvironmentsSsr = config.environments.ssr;
69133
69153
  // Backward compatibility: server.warmup.clientFiles/ssrFiles -> environment.dev.warmup
@@ -69143,7 +69163,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
69143
69163
  // Backward compatibility: merge ssr into environments.ssr.config as defaults
69144
69164
  if (configEnvironmentsSsr) {
69145
69165
  configEnvironmentsSsr.dev ??= {};
69146
- configEnvironmentsSsr.dev.optimizeDeps = mergeConfig(configEnvironmentsSsr.dev.optimizeDeps ?? {}, deprecatedSsrOptimizeDepsConfig);
69166
+ configEnvironmentsSsr.dev.optimizeDeps = mergeConfig(deprecatedSsrOptimizeDepsConfig, configEnvironmentsSsr.dev.optimizeDeps ?? {});
69147
69167
  // TODO: should we merge here?
69148
69168
  configEnvironmentsSsr.resolve ??= {};
69149
69169
  configEnvironmentsSsr.resolve.conditions ??= config.ssr?.resolve?.conditions;
@@ -69155,6 +69175,11 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
69155
69175
  configEnvironmentsSsr.webCompatible = true;
69156
69176
  }
69157
69177
  }
69178
+ if (config.build?.ssrEmitAssets !== undefined) {
69179
+ configEnvironmentsSsr ??= {};
69180
+ configEnvironmentsSsr.build ??= {};
69181
+ configEnvironmentsSsr.build.emitAssets = config.build.ssrEmitAssets;
69182
+ }
69158
69183
  // The client and ssr environment configs can't be removed by the user in the config hook
69159
69184
  if (!config.environments ||
69160
69185
  !config.environments.client ||
@@ -69173,8 +69198,8 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
69173
69198
  }
69174
69199
  const resolvedDefaultEnvironmentResolve = resolveEnvironmentResolveOptions(config.resolve, logger);
69175
69200
  // Backward compatibility: merge environments.client.dev.optimizeDeps back into optimizeDeps
69176
- configEnvironmentsClient = resolvedEnvironments.client;
69177
- const patchedOptimizeDeps = mergeConfig(configEnvironmentsClient.dev?.optimizeDeps ?? {}, config.optimizeDeps ?? {});
69201
+ const resolvedConfigEnvironmentsClient = resolvedEnvironments.client;
69202
+ const patchedOptimizeDeps = mergeConfig(config.optimizeDeps ?? {}, resolvedConfigEnvironmentsClient.dev?.optimizeDeps ?? {});
69178
69203
  const backwardCompatibleOptimizeDeps = {
69179
69204
  holdUntilCrawlEnd: true,
69180
69205
  ...patchedOptimizeDeps,
@@ -69411,6 +69436,8 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
69411
69436
  ...resolved,
69412
69437
  };
69413
69438
  resolved.plugins = await resolvePlugins(resolved, prePlugins, normalPlugins, postPlugins);
69439
+ // Backward compatibility hook used in builder
69440
+ patchConfig?.(resolved);
69414
69441
  Object.assign(resolved, createPluginHookUtils(resolved.plugins));
69415
69442
  // call configResolved hooks
69416
69443
  await Promise.all(resolved
@@ -69780,4 +69807,4 @@ function optimizeDepsDisabledBackwardCompatibility(resolved, optimizeDeps, optim
69780
69807
  }
69781
69808
  }
69782
69809
 
69783
- 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, createViteBuilder 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 };
69810
+ 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 };
package/dist/node/cli.js CHANGED
@@ -685,8 +685,7 @@ function cleanGlobalCLIOptions(options) {
685
685
  */
686
686
  function cleanBuilderCLIOptions(options) {
687
687
  const ret = { ...options };
688
- delete ret.environment;
689
- delete ret.all;
688
+ delete ret.app;
690
689
  return ret;
691
690
  }
692
691
  /**
@@ -732,7 +731,7 @@ cli
732
731
  filterDuplicateOptions(options);
733
732
  // output structure is preserved even after bundling so require()
734
733
  // is ok here
735
- const { createServer } = await import('./chunks/dep-DitPlFWl.js').then(function (n) { return n.C; });
734
+ const { createServer } = await import('./chunks/dep-yyboeDiN.js').then(function (n) { return n.C; });
736
735
  try {
737
736
  const server = await createServer({
738
737
  root,
@@ -810,10 +809,10 @@ cli
810
809
  .option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
811
810
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
812
811
  .option('--environment [name]', `[string] build a single environment`)
813
- .option('--all', `[boolean] build all environments`)
812
+ .option('--app', `[boolean] same as builder.entireApp`)
814
813
  .action(async (root, options) => {
815
814
  filterDuplicateOptions(options);
816
- const { build, createViteBuilder } = await import('./chunks/dep-DitPlFWl.js').then(function (n) { return n.E; });
815
+ const { createBuilder, buildEnvironment } = await import('./chunks/dep-yyboeDiN.js').then(function (n) { return n.E; });
817
816
  const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
818
817
  const config = {
819
818
  root,
@@ -825,22 +824,19 @@ cli
825
824
  build: buildOptions,
826
825
  };
827
826
  try {
828
- if (options.all || options.environment) {
829
- const builder = await createViteBuilder({}, config);
830
- if (options.environment) {
831
- const environment = builder.environments[options.environment];
832
- if (!environment) {
833
- throw new Error(`The environment ${options.environment} isn't configured.`);
834
- }
835
- await builder.build(environment);
836
- }
837
- else {
838
- // --all: build all environments
839
- await builder.buildEnvironments();
840
- }
827
+ const builder = await createBuilder(config);
828
+ // TODO: Backward compatibility with lib and single environment build
829
+ // Ideally we would move to only building the entire app with this command
830
+ if (builder.config.build.lib) {
831
+ await buildEnvironment(builder.config, builder.environments.client, builder.config.build.lib);
832
+ }
833
+ else if (builder.config.builder.entireApp || options.app) {
834
+ await builder.buildApp();
841
835
  }
842
836
  else {
843
- await build(config);
837
+ const ssr = !!builder.config.build.ssr;
838
+ const environment = builder.environments[ssr ? 'ssr' : 'client'];
839
+ await builder.build(environment);
844
840
  }
845
841
  }
846
842
  catch (e) {
@@ -892,7 +888,7 @@ cli
892
888
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
893
889
  .action(async (root, options) => {
894
890
  filterDuplicateOptions(options);
895
- const { preview } = await import('./chunks/dep-DitPlFWl.js').then(function (n) { return n.F; });
891
+ const { preview } = await import('./chunks/dep-yyboeDiN.js').then(function (n) { return n.F; });
896
892
  try {
897
893
  const server = await preview({
898
894
  root,
@@ -2932,21 +2932,22 @@ declare class BuildEnvironment extends Environment {
2932
2932
  constructor(name: string, config: ResolvedConfig, setup?: {
2933
2933
  options?: EnvironmentOptions;
2934
2934
  });
2935
+ init(): Promise<void>;
2935
2936
  }
2936
2937
  interface ViteBuilder {
2937
2938
  environments: Record<string, BuildEnvironment>;
2938
2939
  config: ResolvedConfig;
2939
- buildEnvironments(): Promise<void>;
2940
+ buildApp(): Promise<void>;
2940
2941
  build(environment: BuildEnvironment): Promise<RollupOutput | RollupOutput[] | RollupWatcher>;
2941
2942
  }
2942
2943
  interface BuilderOptions {
2943
- buildEnvironments?: (builder: ViteBuilder, build: (environment: BuildEnvironment) => Promise<void>) => Promise<void>;
2944
+ sharedConfigBuild?: boolean;
2945
+ sharedPlugins?: boolean;
2946
+ entireApp?: boolean;
2947
+ buildApp?: (builder: ViteBuilder) => Promise<void>;
2944
2948
  }
2945
2949
  type ResolvedBuilderOptions = Required<BuilderOptions>;
2946
- interface BuilderInlineConfig extends Omit<InlineConfig, 'plugins'> {
2947
- plugins?: () => PluginOption[];
2948
- }
2949
- declare function createViteBuilder(builderOptions?: BuilderOptions, defaultBuilderInlineConfig?: BuilderInlineConfig): Promise<ViteBuilder>;
2950
+ declare function createBuilder(inlineConfig?: InlineConfig): Promise<ViteBuilder>;
2950
2951
 
2951
2952
  interface ESBuildOptions extends esbuild_TransformOptions {
2952
2953
  include?: string | RegExp | string[] | RegExp[];
@@ -3295,6 +3296,15 @@ interface BasePlugin<A = any> extends rollup.Plugin<A> {
3295
3296
  }
3296
3297
  type BoundedPlugin<A = any> = BasePlugin<A>;
3297
3298
  interface Plugin<A = any> extends BasePlugin<A> {
3299
+ /**
3300
+ * Opt-in this plugin into the shared plugins pipeline.
3301
+ * For backward-compatibility, plugins are re-recreated for each environment
3302
+ * during `vite build --app`
3303
+ * We have an opt-in per plugin, and a general `builder.sharedPlugins`
3304
+ * In a future major, we'll flip the default to be shared by default
3305
+ * @experimental
3306
+ */
3307
+ sharedDuringBuild?: boolean;
3298
3308
  /**
3299
3309
  * Spawn the plugin into multiple plugins based on the environment.
3300
3310
  * This hook is called when the config has already been resolved, allowing to
@@ -3862,7 +3872,7 @@ interface PluginHookUtils {
3862
3872
  getSortedPluginHooks: <K extends keyof Plugin>(hookName: K) => NonNullable<HookHandler<Plugin[K]>>[];
3863
3873
  }
3864
3874
  type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
3865
- declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean): Promise<ResolvedConfig>;
3875
+ declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean, patchConfig?: ((config: ResolvedConfig) => void) | undefined): Promise<ResolvedConfig>;
3866
3876
  declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
3867
3877
  declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger): Promise<{
3868
3878
  path: string;
@@ -3894,18 +3904,18 @@ interface ServerModuleRunnerOptions extends Omit<ModuleRunnerOptions, 'root' | '
3894
3904
  * Create an instance of the Vite SSR runtime that support HMR.
3895
3905
  * @experimental
3896
3906
  */
3897
- declare function createServerModuleRunner(server: ViteDevServer, environment: DevEnvironment, options?: ServerModuleRunnerOptions): ModuleRunner;
3907
+ declare function createServerModuleRunner(environment: DevEnvironment, options?: ServerModuleRunnerOptions): ModuleRunner;
3898
3908
 
3899
3909
  /**
3900
3910
  * The connector class to establish HMR communication between the server and the Vite runtime.
3901
3911
  * @experimental
3902
3912
  */
3903
3913
  declare class ServerHMRConnector implements ModuleRunnerHMRConnection {
3904
- private handlers;
3905
3914
  private hmrChannel;
3915
+ private handlers;
3906
3916
  private hmrClient;
3907
3917
  private connected;
3908
- constructor(server: ViteDevServer);
3918
+ constructor(hmrChannel: ServerHMRChannel);
3909
3919
  isReady(): boolean;
3910
3920
  send(message: string): void;
3911
3921
  onUpdate(handler: (payload: HMRPayload) => void): void;
@@ -3982,4 +3992,4 @@ interface ManifestChunk {
3982
3992
  dynamicImports?: string[];
3983
3993
  }
3984
3994
 
3985
- 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 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, createFilter, createLogger, createNodeDevEnvironment, createServer, createServerModuleRunner, createViteBuilder, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
3995
+ 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 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 };
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules, a as arraify } from './chunks/dep-DitPlFWl.js';
3
- export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, h as buildErrorMessage, u as createFilter, j as createNodeDevEnvironment, c as createServer, m as createServerModuleRunner, e as createViteBuilder, 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-DitPlFWl.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-yyboeDiN.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-yyboeDiN.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.3",
3
+ "version": "6.0.0-alpha.5",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -114,7 +114,7 @@
114
114
  "http-proxy": "^1.18.1",
115
115
  "launch-editor-middleware": "^2.6.1",
116
116
  "lightningcss": "^1.24.1",
117
- "magic-string": "^0.30.9",
117
+ "magic-string": "^0.30.10",
118
118
  "micromatch": "^4.0.5",
119
119
  "mlly": "^1.6.1",
120
120
  "mrmime": "^2.0.0",
@@ -131,7 +131,7 @@
131
131
  "rollup-plugin-dts": "^6.1.0",
132
132
  "rollup-plugin-esbuild": "^6.1.1",
133
133
  "rollup-plugin-license": "^3.3.1",
134
- "sass": "^1.74.1",
134
+ "sass": "^1.75.0",
135
135
  "sirv": "^2.0.4",
136
136
  "source-map-support": "^0.5.21",
137
137
  "strip-ansi": "^7.1.0",