vite 6.0.0-alpha.10 → 6.0.0-alpha.11

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,13 +15142,13 @@ function terserPlugin(config) {
15142
15142
  };
15143
15143
  }
15144
15144
 
15145
- async function resolveBoundedPlugins(environment) {
15145
+ async function resolveIsolatedPlugins(environment) {
15146
15146
  const userPlugins = [];
15147
15147
  for (const plugin of environment.config.rawPlugins) {
15148
15148
  if (typeof plugin === 'function') {
15149
- const boundedPlugin = await plugin(environment);
15150
- if (boundedPlugin) {
15151
- const flatPlugins = await asyncFlattenBoundedPlugin(environment, boundedPlugin);
15149
+ const isolatedPlugin = await plugin(environment);
15150
+ if (isolatedPlugin) {
15151
+ const flatPlugins = await asyncFlattenIsolatedPlugin(environment, isolatedPlugin);
15152
15152
  userPlugins.push(...flatPlugins);
15153
15153
  }
15154
15154
  }
@@ -15158,7 +15158,7 @@ async function resolveBoundedPlugins(environment) {
15158
15158
  }
15159
15159
  return environment.config.resolvePlugins(...sortUserPlugins(userPlugins));
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
  }
@@ -61057,8 +61057,8 @@ class DevEnvironment extends Environment {
61057
61057
  return;
61058
61058
  }
61059
61059
  this._inited = true;
61060
- this._plugins = await resolveBoundedPlugins(this);
61061
- this._pluginContainer = await createBoundedPluginContainer(this, this._plugins);
61060
+ this._plugins = await resolveIsolatedPlugins(this);
61061
+ this._pluginContainer = await createIsolatedPluginContainer(this, this._plugins);
61062
61062
  // TODO: Should buildStart be called here? It break backward compatibility if we do,
61063
61063
  // and it may be better to delay it for performance
61064
61064
  // The deps optimizer init is delayed. TODO: add internal option?
@@ -64450,13 +64450,17 @@ const relativePathRE = /^\.{1,2}\//;
64450
64450
  // trailing slash too as a dynamic import statement can have comments between
64451
64451
  // the `import` and the `(`.
64452
64452
  const hasDynamicImportRE = /\bimport\s*[(/]/;
64453
- const dynamicImportHelper = (glob, path) => {
64453
+ const dynamicImportHelper = (glob, path, segs) => {
64454
64454
  const v = glob[path];
64455
64455
  if (v) {
64456
64456
  return typeof v === 'function' ? v() : Promise.resolve(v);
64457
64457
  }
64458
64458
  return new Promise((_, reject) => {
64459
- (typeof queueMicrotask === 'function' ? queueMicrotask : setTimeout)(reject.bind(null, new Error('Unknown variable dynamic import: ' + path)));
64459
+ (typeof queueMicrotask === 'function' ? queueMicrotask : setTimeout)(reject.bind(null, new Error('Unknown variable dynamic import: ' +
64460
+ path +
64461
+ (path.split('/').length !== segs
64462
+ ? '. Note that variables only represent file names one level deep.'
64463
+ : ''))));
64460
64464
  });
64461
64465
  };
64462
64466
  function parseDynamicImportPattern(strings) {
@@ -64593,7 +64597,7 @@ function dynamicImportVarsPlugin(config) {
64593
64597
  }
64594
64598
  const { rawPattern, glob } = result;
64595
64599
  needDynamicImportHelper = true;
64596
- s.overwrite(expStart, expEnd, `__variableDynamicImportRuntimeHelper(${glob}, \`${rawPattern}\`)`);
64600
+ s.overwrite(expStart, expEnd, `__variableDynamicImportRuntimeHelper(${glob}, \`${rawPattern}\`, ${rawPattern.split('/').length})`);
64597
64601
  }
64598
64602
  if (s) {
64599
64603
  if (needDynamicImportHelper) {
@@ -64784,7 +64788,7 @@ function throwClosedServerError() {
64784
64788
  * instead of using environment.plugins to allow the creation of different
64785
64789
  * pipelines working with the same environment (used for createIdResolver).
64786
64790
  */
64787
- async function createBoundedPluginContainer(environment, plugins, watcher) {
64791
+ async function createIsolatedPluginContainer(environment, plugins, watcher) {
64788
64792
  const { config, logger, options: { build: { rollupOptions }, }, } = environment;
64789
64793
  const { root } = config;
64790
64794
  // Backward compatibility
@@ -65383,7 +65387,7 @@ function createIdResolver(config, options) {
65383
65387
  async function resolve(environment, id, importer) {
65384
65388
  let pluginContainer = pluginContainerMap.get(environment);
65385
65389
  if (!pluginContainer) {
65386
- pluginContainer = await createBoundedPluginContainer(environment, [
65390
+ pluginContainer = await createIsolatedPluginContainer(environment, [
65387
65391
  alias$1({ entries: config.resolve.alias }),
65388
65392
  resolvePlugin({
65389
65393
  root: config.root,
@@ -65406,7 +65410,7 @@ function createIdResolver(config, options) {
65406
65410
  async function resolveAlias(environment, id, importer) {
65407
65411
  let pluginContainer = aliasOnlyPluginContainerMap.get(environment);
65408
65412
  if (!pluginContainer) {
65409
- pluginContainer = await createBoundedPluginContainer(environment, [
65413
+ pluginContainer = await createIsolatedPluginContainer(environment, [
65410
65414
  alias$1({ entries: config.resolve.alias }), // TODO: resolve.alias per environment?
65411
65415
  ]);
65412
65416
  aliasOnlyPluginContainerMap.set(environment, pluginContainer);
@@ -68649,7 +68653,7 @@ class BuildEnvironment extends Environment {
68649
68653
  return;
68650
68654
  }
68651
68655
  this._inited = true;
68652
- this._plugins = await resolveBoundedPlugins(this);
68656
+ this._plugins = await resolveIsolatedPlugins(this);
68653
68657
  }
68654
68658
  }
68655
68659
  async function defaultBuildApp(builder) {
@@ -69463,7 +69467,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
69463
69467
  // environment so we can safely cast to a base Environment instance to a
69464
69468
  // PluginEnvironment here
69465
69469
  const environment = new Environment(environmentName, this);
69466
- const pluginContainer = await createBoundedPluginContainer(environment, plugins);
69470
+ const pluginContainer = await createIsolatedPluginContainer(environment, plugins);
69467
69471
  await pluginContainer.buildStart({});
69468
69472
  return pluginContainer;
69469
69473
  };
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-CjFMk8-F.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-DhoCcTbV.js').then(function (n) { return n.E; });
815
+ const { createBuilder, buildEnvironment } = await import('./chunks/dep-CjFMk8-F.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-DhoCcTbV.js').then(function (n) { return n.F; });
891
+ const { preview } = await import('./chunks/dep-CjFMk8-F.js').then(function (n) { return n.F; });
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 {
@@ -3862,7 +3862,7 @@ type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclu
3862
3862
  alias: Alias[];
3863
3863
  };
3864
3864
  plugins: readonly Plugin[];
3865
- rawPlugins: readonly (Plugin | BoundedPluginConstructor)[];
3865
+ rawPlugins: readonly (Plugin | IsolatedPluginConstructor)[];
3866
3866
  css: ResolvedCSSOptions;
3867
3867
  esbuild: ESBuildOptions | false;
3868
3868
  server: ResolvedServerOptions;
@@ -3885,7 +3885,7 @@ interface PluginHookUtils {
3885
3885
  getSortedPluginHooks: <K extends keyof Plugin>(hookName: K) => NonNullable<HookHandler<Plugin[K]>>[];
3886
3886
  }
3887
3887
  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>;
3888
+ declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean, patchConfig?: ((config: ResolvedConfig) => void) | undefined, patchPlugins?: ((plugins: (Plugin | IsolatedPluginConstructor)[]) => void) | undefined): Promise<ResolvedConfig>;
3889
3889
  declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
3890
3890
  declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger): Promise<{
3891
3891
  path: string;
@@ -4005,4 +4005,4 @@ interface ManifestChunk {
4005
4005
  dynamicImports?: string[];
4006
4006
  }
4007
4007
 
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 };
4008
+ 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 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-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-CjFMk8-F.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-CjFMk8-F.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.11",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",