vite 6.0.0-alpha.5 → 6.0.0-alpha.6

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.
@@ -68015,8 +68015,8 @@ async function build(inlineConfig = {}) {
68015
68015
  return builder.build(environment);
68016
68016
  }
68017
68017
  }
68018
- function resolveConfigToBuild(inlineConfig = {}, patchConfig) {
68019
- return resolveConfig(inlineConfig, 'build', 'production', 'production', false, patchConfig);
68018
+ function resolveConfigToBuild(inlineConfig = {}, patchConfig, patchPlugins) {
68019
+ return resolveConfig(inlineConfig, 'build', 'production', 'production', false, patchConfig, patchPlugins);
68020
68020
  }
68021
68021
  /**
68022
68022
  * Build an App environment, or a App library (if librayOptions is provided)
@@ -68409,9 +68409,7 @@ function wrapEnvironmentLoad(hook, environment) {
68409
68409
  return;
68410
68410
  const fn = getHookHandler(hook);
68411
68411
  const handler = function (id, ...args) {
68412
- return fn.call(injectEnvironmentInContext(this, environment), id,
68413
- // @ts-expect-error: Receiving options param to be future-proof if Rollup adds it
68414
- injectSsrFlag(args[0], environment));
68412
+ return fn.call(injectEnvironmentInContext(this, environment), id, injectSsrFlag(args[0], environment));
68415
68413
  };
68416
68414
  if ('handler' in hook) {
68417
68415
  return {
@@ -68428,9 +68426,7 @@ function wrapEnvironmentTransform(hook, environment) {
68428
68426
  return;
68429
68427
  const fn = getHookHandler(hook);
68430
68428
  const handler = function (code, importer, ...args) {
68431
- return fn.call(injectEnvironmentInContext(this, environment), code, importer,
68432
- // @ts-expect-error: Receiving options param to be future-proof if Rollup adds it
68433
- injectSsrFlag(args[0], environment));
68429
+ return fn.call(injectEnvironmentInContext(this, environment), code, importer, injectSsrFlag(args[0], environment));
68434
68430
  };
68435
68431
  if ('handler' in hook) {
68436
68432
  return {
@@ -68628,8 +68624,14 @@ async function createBuilder(inlineConfig = {}) {
68628
68624
  let environmentConfig = config;
68629
68625
  if (!config.builder.sharedConfigBuild) {
68630
68626
  const patchConfig = (resolved) => {
68627
+ resolved.build = {
68628
+ ...resolved.environments[name].build,
68629
+ lib: false,
68630
+ };
68631
+ };
68632
+ const patchPlugins = (resolvedPlugins) => {
68631
68633
  // Force opt-in shared plugins
68632
- const environmentPlugins = [...resolved.plugins];
68634
+ const environmentPlugins = [...resolvedPlugins];
68633
68635
  let validMixedPlugins = true;
68634
68636
  for (let i = 0; i < environmentPlugins.length; i++) {
68635
68637
  const environmentPlugin = environmentPlugins[i];
@@ -68644,14 +68646,12 @@ async function createBuilder(inlineConfig = {}) {
68644
68646
  }
68645
68647
  }
68646
68648
  if (validMixedPlugins) {
68647
- resolved.plugins = environmentPlugins;
68649
+ for (let i = 0; i < environmentPlugins.length; i++) {
68650
+ resolvedPlugins[i] = environmentPlugins[i];
68651
+ }
68648
68652
  }
68649
- resolved.build = {
68650
- ...resolved.environments[name].build,
68651
- lib: false,
68652
- };
68653
68653
  };
68654
- environmentConfig = await resolveConfigToBuild(inlineConfig, patchConfig);
68654
+ environmentConfig = await resolveConfigToBuild(inlineConfig, patchConfig, patchPlugins);
68655
68655
  }
68656
68656
  const environment = await createEnvironment(name, environmentConfig);
68657
68657
  await environment.init();
@@ -69068,7 +69068,7 @@ function resolveOptimizeDepsConfig(optimizeDeps, preserveSymlinks) {
69068
69068
  disabled: optimizeDeps.disabled,
69069
69069
  };
69070
69070
  }
69071
- async function resolveConfig(inlineConfig, command, defaultMode = 'development', defaultNodeEnv = 'development', isPreview = false, patchConfig = undefined) {
69071
+ async function resolveConfig(inlineConfig, command, defaultMode = 'development', defaultNodeEnv = 'development', isPreview = false, patchConfig = undefined, patchPlugins = undefined) {
69072
69072
  let config = inlineConfig;
69073
69073
  let configFileDependencies = [];
69074
69074
  let mode = inlineConfig.mode || defaultMode;
@@ -69435,9 +69435,16 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
69435
69435
  ...config,
69436
69436
  ...resolved,
69437
69437
  };
69438
- resolved.plugins = await resolvePlugins(resolved, prePlugins, normalPlugins, postPlugins);
69439
- // Backward compatibility hook used in builder
69438
+ // Backward compatibility hook, modify the resolved config before it is used
69439
+ // to create inernal plugins. For example, `config.build.ssr`. Once we rework
69440
+ // internal plugins to use environment.options, we can remove the dual
69441
+ // patchConfig/patchPlugins and have a single patchConfig before configResolved
69442
+ // gets called
69440
69443
  patchConfig?.(resolved);
69444
+ const resolvedPlugins = await resolvePlugins(resolved, prePlugins, normalPlugins, postPlugins);
69445
+ // Backward compatibility hook used in builder
69446
+ patchPlugins?.(resolvedPlugins);
69447
+ resolved.plugins = resolvedPlugins;
69441
69448
  Object.assign(resolved, createPluginHookUtils(resolved.plugins));
69442
69449
  // call configResolved hooks
69443
69450
  await Promise.all(resolved
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-yyboeDiN.js').then(function (n) { return n.C; });
734
+ const { createServer } = await import('./chunks/dep-CM9bEhFZ.js').then(function (n) { return n.C; });
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-yyboeDiN.js').then(function (n) { return n.E; });
815
+ const { createBuilder, buildEnvironment } = await import('./chunks/dep-CM9bEhFZ.js').then(function (n) { return n.E; });
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-yyboeDiN.js').then(function (n) { return n.F; });
891
+ const { preview } = await import('./chunks/dep-CM9bEhFZ.js').then(function (n) { return n.F; });
892
892
  try {
893
893
  const server = await preview({
894
894
  root,
@@ -3872,7 +3872,7 @@ interface PluginHookUtils {
3872
3872
  getSortedPluginHooks: <K extends keyof Plugin>(hookName: K) => NonNullable<HookHandler<Plugin[K]>>[];
3873
3873
  }
3874
3874
  type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
3875
- declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean, patchConfig?: ((config: ResolvedConfig) => void) | undefined): Promise<ResolvedConfig>;
3875
+ declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean, patchConfig?: ((config: ResolvedConfig) => void) | undefined, patchPlugins?: ((plugins: Plugin[]) => void) | undefined): Promise<ResolvedConfig>;
3876
3876
  declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
3877
3877
  declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger): Promise<{
3878
3878
  path: string;
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
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';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-CM9bEhFZ.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-CM9bEhFZ.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.5",
3
+ "version": "6.0.0-alpha.6",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",