vite 8.0.15 → 8.1.0-beta.0

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.
package/dist/node/cli.js CHANGED
@@ -703,7 +703,7 @@ const convertBase = (v) => {
703
703
  cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, { type: [convertBase] }).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option("--configLoader <loader>", `[string] use 'bundle' to bundle the config with Rolldown, or 'runner' (experimental) to process it on the fly, or 'native' (experimental) to load using the native runtime (default: bundle)`).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
704
704
  cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--open [path]", `[boolean | string] open browser on startup`).option("--cors", `[boolean] enable CORS`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--force", `[boolean] force the optimizer to ignore the cache and re-bundle`).option("--experimentalBundle", `[boolean] use experimental full bundle mode (this is highly experimental)`).action(async (root, options) => {
705
705
  filterDuplicateOptions(options);
706
- const { createServer } = await import("./chunks/node.js").then((n) => n.A);
706
+ const { createServer } = await import("./chunks/node.js").then((n) => n.M);
707
707
  try {
708
708
  const server = await createServer({
709
709
  root,
@@ -760,7 +760,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
760
760
  });
761
761
  cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'baseline-widely-available')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option("--assetsDir <dir>", `[string] directory under outDir to place assets in (default: assets)`).option("--assetsInlineLimit <number>", `[number] static asset base64 inline threshold in bytes (default: 4096)`).option("--ssr [entry]", `[string] build specified entry for server-side rendering`).option("--sourcemap [output]", `[boolean | "inline" | "hidden"] output source maps for build (default: false)`).option("--minify [minifier]", "[boolean | \"oxc\" | \"terser\" | \"esbuild\"] enable/disable minification, or specify minifier to use (default: oxc)").option("--manifest [name]", `[boolean | string] emit build manifest json`).option("--ssrManifest [name]", `[boolean | string] emit ssr manifest json`).option("--emptyOutDir", `[boolean] force empty outDir when it's outside of root`).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(async (root, options) => {
762
762
  filterDuplicateOptions(options);
763
- const { createBuilder } = await import("./chunks/node.js").then((n) => n.w);
763
+ const { createBuilder } = await import("./chunks/node.js").then((n) => n.E);
764
764
  const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
765
765
  try {
766
766
  const builder = await createBuilder({
@@ -786,7 +786,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
786
786
  cli.command("optimize [root]", "pre-bundle dependencies (deprecated, the pre-bundle process runs automatically and does not need to be called)").option("--force", `[boolean] force the optimizer to ignore the cache and re-bundle`).action(async (root, options) => {
787
787
  filterDuplicateOptions(options);
788
788
  const { resolveConfig } = await import("./chunks/node.js").then((n) => n.f);
789
- const { optimizeDeps } = await import("./chunks/node.js").then((n) => n.D);
789
+ const { optimizeDeps } = await import("./chunks/node.js").then((n) => n.k);
790
790
  try {
791
791
  await optimizeDeps(await resolveConfig({
792
792
  root,
@@ -27,11 +27,11 @@ import * as PostCSS from "postcss";
27
27
  import { LightningCSSOptions, LightningCSSOptions as lightningcssOptions_LightningCSSOptions } from "#types/internal/lightningcssOptions";
28
28
  import { LessPreprocessorBaseOptions, SassModernPreprocessBaseOptions, StylusPreprocessorBaseOptions } from "#types/internal/cssPreprocessorOptions";
29
29
  import { withFilter } from "rolldown/filter";
30
- import { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownAsTypeMap } from "#types/importGlob";
30
+ import { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownAsTypeMap, KnownQueryTypeMap } from "#types/importGlob";
31
31
 
32
32
  //#region \0rolldown/runtime.js
33
33
  //#endregion
34
- //#region ../../node_modules/.pnpm/@vitejs+devtools@0.3.1_typescript@6.0.3_vite@packages+vite/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
34
+ //#region ../../node_modules/.pnpm/@vitejs+devtools@0.3.3_typescript@6.0.3_vite@packages+vite/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
35
35
  //#region src/node/cli-commands.d.ts
36
36
  interface StartOptions {
37
37
  root?: string;
@@ -41,7 +41,7 @@ interface StartOptions {
41
41
  open?: boolean;
42
42
  }
43
43
  //#endregion
44
- //#region ../../node_modules/.pnpm/@vitejs+devtools@0.3.1_typescript@6.0.3_vite@packages+vite/node_modules/@vitejs/devtools/dist/config.d.ts
44
+ //#region ../../node_modules/.pnpm/@vitejs+devtools@0.3.3_typescript@6.0.3_vite@packages+vite/node_modules/@vitejs/devtools/dist/config.d.ts
45
45
  //#region src/node/config.d.ts
46
46
  interface DevToolsConfig extends Partial<StartOptions> {
47
47
  enabled: boolean;
@@ -336,7 +336,7 @@ declare namespace Connect {
336
336
  }
337
337
  }
338
338
  //#endregion
339
- //#region ../../node_modules/.pnpm/http-proxy-3@1.23.2_ms@2.1.3/node_modules/http-proxy-3/dist/lib/http-proxy/index.d.ts
339
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.23.3_ms@2.1.3/node_modules/http-proxy-3/dist/lib/http-proxy/index.d.ts
340
340
  interface ProxyTargetDetailed {
341
341
  host: string;
342
342
  port: number;
@@ -524,7 +524,7 @@ declare class ProxyServer<TIncomingMessage extends typeof http.IncomingMessage =
524
524
  after: <PT extends ProxyType>(type: PT, passName: string, cb: PassFunctions<TIncomingMessage, TServerResponse, TError>[PT]) => void;
525
525
  }
526
526
  //#endregion
527
- //#region ../../node_modules/.pnpm/http-proxy-3@1.23.2_ms@2.1.3/node_modules/http-proxy-3/dist/lib/http-proxy/passes/ws-incoming.d.ts
527
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.23.3_ms@2.1.3/node_modules/http-proxy-3/dist/lib/http-proxy/passes/ws-incoming.d.ts
528
528
  declare function numOpenSockets(): number;
529
529
  declare namespace index_d_exports {
530
530
  export { ErrorCallback, ProxyServer, ProxyTarget, ProxyTargetUrl, ServerOptions$3 as ServerOptions, createProxyServer as createProxy, createProxyServer, createProxyServer as createServer, ProxyServer as default, numOpenSockets };
@@ -1157,14 +1157,44 @@ declare class ModuleGraph {
1157
1157
  type ModuleSetNames = "acceptedHmrDeps" | "importedModules";
1158
1158
  //#endregion
1159
1159
  //#region src/node/server/hmr.d.ts
1160
+ interface WsOptions {
1161
+ protocol?: string;
1162
+ host?: string;
1163
+ port?: number;
1164
+ clientPort?: number;
1165
+ path?: string;
1166
+ timeout?: number;
1167
+ server?: HttpServer;
1168
+ }
1160
1169
  interface HmrOptions {
1170
+ /**
1171
+ * @deprecated Use `server.ws.protocol` instead.
1172
+ */
1161
1173
  protocol?: string;
1174
+ /**
1175
+ * @deprecated Use `server.ws.host` instead.
1176
+ */
1162
1177
  host?: string;
1178
+ /**
1179
+ * @deprecated Use `server.ws.port` instead.
1180
+ */
1163
1181
  port?: number;
1182
+ /**
1183
+ * @deprecated Use `server.ws.clientPort` instead.
1184
+ */
1164
1185
  clientPort?: number;
1186
+ /**
1187
+ * @deprecated Use `server.ws.path` instead.
1188
+ */
1165
1189
  path?: string;
1190
+ /**
1191
+ * @deprecated Use `server.ws.timeout` instead.
1192
+ */
1166
1193
  timeout?: number;
1167
1194
  overlay?: boolean;
1195
+ /**
1196
+ * @deprecated Use `server.ws.server` instead.
1197
+ */
1168
1198
  server?: HttpServer;
1169
1199
  }
1170
1200
  interface HotUpdateOptions {
@@ -1576,6 +1606,43 @@ interface WebSocketClient extends NormalizedHotChannelClient {
1576
1606
  socket: WebSocket;
1577
1607
  }
1578
1608
  //#endregion
1609
+ //#region src/node/server/bundledDev.d.ts
1610
+ type MemoryFile = {
1611
+ source: string | Uint8Array;
1612
+ etag?: string;
1613
+ };
1614
+ declare class MemoryFiles {
1615
+ private files;
1616
+ get size(): number;
1617
+ get(file: string): MemoryFile | undefined;
1618
+ set(file: string, content: MemoryFile | (() => MemoryFile)): void;
1619
+ has(file: string): boolean;
1620
+ clear(): void;
1621
+ }
1622
+ declare class BundledDev {
1623
+ private environment;
1624
+ private _devEngine;
1625
+ private initialBuildCompleted;
1626
+ private clients;
1627
+ private invalidateCalledModules;
1628
+ private debouncedFullReload;
1629
+ memoryFiles: MemoryFiles;
1630
+ constructor(environment: DevEnvironment);
1631
+ private get devEngine();
1632
+ listen(): Promise<void>;
1633
+ private waitForInitialBuildFinish;
1634
+ invalidateModule(m: {
1635
+ path: string;
1636
+ message?: string;
1637
+ firstInvalidatedBy: string;
1638
+ }, client: NormalizedHotChannelClient): Promise<void>;
1639
+ triggerBundleRegenerationIfStale(): Promise<boolean>;
1640
+ triggerLazyBundling(moduleId: string | null, clientId: string | null): Promise<string | undefined>;
1641
+ close(): Promise<void>;
1642
+ private getRolldownOptions;
1643
+ private handleHmrOutput;
1644
+ }
1645
+ //#endregion
1579
1646
  //#region src/node/server/environment.d.ts
1580
1647
  interface DevEnvironmentContext {
1581
1648
  hot: boolean;
@@ -1599,6 +1666,7 @@ declare class DevEnvironment extends BaseEnvironment {
1599
1666
  * environment.hot.send({ type: 'full-reload' })
1600
1667
  */
1601
1668
  hot: NormalizedHotChannel;
1669
+ bundledDev?: BundledDev;
1602
1670
  constructor(name: string, config: ResolvedConfig, context: DevEnvironmentContext);
1603
1671
  init(options?: {
1604
1672
  watcher?: FSWatcher;
@@ -2086,13 +2154,19 @@ interface BuildEnvironmentOptions {
2086
2154
  */
2087
2155
  terserOptions?: TerserOptions;
2088
2156
  /**
2157
+ * Whether to use import maps feature to optimize chunk caching efficiency.
2158
+ * @default false
2159
+ * @experimental
2160
+ */
2161
+ chunkImportMap?: boolean;
2162
+ /**
2089
2163
  * Alias to `rolldownOptions`
2090
2164
  * @deprecated Use `rolldownOptions` instead.
2091
2165
  */
2092
2166
  rollupOptions?: RolldownOptions;
2093
2167
  /**
2094
2168
  * Will be merged with internal rolldown options.
2095
- * https://rolldown.rs/reference/config-options
2169
+ * https://rolldown.rs/reference/Interface.RolldownOptions
2096
2170
  */
2097
2171
  rolldownOptions?: RolldownOptions;
2098
2172
  /**
@@ -2154,7 +2228,7 @@ interface BuildEnvironmentOptions {
2154
2228
  lib?: LibraryOptions | false;
2155
2229
  /**
2156
2230
  * Produce SSR oriented build. Note this requires specifying SSR entry via
2157
- * `rollupOptions.input`.
2231
+ * `rolldownOptions.input`.
2158
2232
  * @default false
2159
2233
  */
2160
2234
  ssr?: boolean | string;
@@ -2327,7 +2401,7 @@ type SkipInformation = {
2327
2401
  };
2328
2402
  declare class EnvironmentPluginContainer<Env extends Environment = Environment> {
2329
2403
  private _pluginContextMap;
2330
- private _resolvedRollupOptions?;
2404
+ private _resolvedRolldownOptions?;
2331
2405
  private _processesing;
2332
2406
  private _seenResolves;
2333
2407
  private _moduleNodeToLoadAddedImports;
@@ -2344,7 +2418,7 @@ declare class EnvironmentPluginContainer<Env extends Environment = Environment>
2344
2418
  getModuleInfo(id: string): ModuleInfo | null;
2345
2419
  private handleHookPromise;
2346
2420
  get options(): InputOptions;
2347
- resolveRollupOptions(): Promise<InputOptions>;
2421
+ resolveRolldownOptions(): Promise<InputOptions>;
2348
2422
  private _getPluginContext;
2349
2423
  private hookParallel;
2350
2424
  buildStart(_options?: InputOptions): Promise<void>;
@@ -2440,10 +2514,10 @@ interface ServerOptions$1 extends CommonServerOptions {
2440
2514
  */
2441
2515
  hmr?: HmrOptions | boolean;
2442
2516
  /**
2443
- * Do not start the websocket connection.
2444
- * @experimental
2517
+ * Configure WebSocket connection options.
2518
+ * Set to `false` to disable the WebSocket server and connection.
2445
2519
  */
2446
- ws?: false;
2520
+ ws?: WsOptions | false;
2447
2521
  /**
2448
2522
  * Warm-up files to transform and cache the results in advance. This improves the
2449
2523
  * initial page load during server starts and prevents transform waterfalls.
@@ -3128,6 +3202,33 @@ interface JsonOptions {
3128
3202
  stringify?: boolean | "auto";
3129
3203
  }
3130
3204
  //#endregion
3205
+ //#region src/node/assetSource.d.ts
3206
+ /**
3207
+ * Defines which attributes of an HTML element should be treated as asset sources.
3208
+ * Used in `html.additionalAssetSources` configuration.
3209
+ */
3210
+ interface HtmlAssetSource {
3211
+ /**
3212
+ * Attributes that contain a single asset URL.
3213
+ * @example ['src', 'data-src-dark']
3214
+ */
3215
+ srcAttributes?: string[];
3216
+ /**
3217
+ * Attributes that contain srcset-format URLs.
3218
+ * @example ['srcset', 'imagesrcset']
3219
+ */
3220
+ srcsetAttributes?: string[];
3221
+ /**
3222
+ * Called before handling an attribute to determine if it should be processed.
3223
+ */
3224
+ filter?: (data: HtmlAssetSourceFilterData) => boolean;
3225
+ }
3226
+ interface HtmlAssetSourceFilterData {
3227
+ key: string;
3228
+ value: string;
3229
+ attributes: Record<string, string>;
3230
+ }
3231
+ //#endregion
3131
3232
  //#region src/node/ssr/index.d.ts
3132
3233
  type SSRTarget = "node" | "webworker";
3133
3234
  type SsrDepOptimizationConfig = DepOptimizationConfig;
@@ -3518,6 +3619,23 @@ interface HTMLOptions {
3518
3619
  * Make sure that this placeholder will be replaced with a unique value for each request by the server.
3519
3620
  */
3520
3621
  cspNonce?: string;
3622
+ /**
3623
+ * Define additional HTML elements and attributes to be treated as asset sources.
3624
+ * This extends the built-in list that includes standard elements like `<img src>`, `<video src>`, etc.
3625
+ *
3626
+ * @example
3627
+ * ```ts
3628
+ * html: {
3629
+ * additionalAssetSources: {
3630
+ * // Custom web component
3631
+ * 'html-import': { srcAttributes: ['src'] },
3632
+ * // Add data-* attributes to existing element
3633
+ * 'img': { srcAttributes: ['data-src-dark', 'data-src-light'] }
3634
+ * }
3635
+ * }
3636
+ * ```
3637
+ */
3638
+ additionalAssetSources?: Record<string, HtmlAssetSource>;
3521
3639
  }
3522
3640
  interface FutureOptions {
3523
3641
  removePluginHookHandleHotUpdate?: "warn";
@@ -3824,6 +3942,10 @@ declare function isFileServingAllowed(url: string, server: ViteDevServer): boole
3824
3942
  declare function isFileLoadingAllowed(config: ResolvedConfig, filePath: string): boolean;
3825
3943
  //#endregion
3826
3944
  //#region src/node/env.d.ts
3945
+ /**
3946
+ * Load `.env` files within the `envDir` and merge them with the matching
3947
+ * variables already present in `process.env`.
3948
+ */
3827
3949
  declare function loadEnv(mode: string, envDir: string | false, prefixes?: string | string[]): Record<string, string>;
3828
3950
  declare function resolveEnvPrefix({
3829
3951
  envPrefix
@@ -3877,10 +3999,10 @@ interface ManifestChunk {
3877
3999
  }
3878
4000
  //#endregion
3879
4001
  //#region src/node/index.d.ts
3880
- /** @deprecated - use `parse` instead */
4002
+ /** @deprecated - use `parseSync` instead */
3881
4003
  declare const parseAst: typeof parseAst$1;
3882
- /** @deprecated - use `parseAsync` instead */
4004
+ /** @deprecated - use `parse` instead */
3883
4005
  declare const parseAstAsync: typeof parseAstAsync$1;
3884
4006
  declare const esbuildVersion = "0.25.0";
3885
4007
  //#endregion
3886
- export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type BindCLIShortcutsOptions, type BuildAppHook, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type ChunkMetadata, type CommonServerOptions, type ConfigEnv, type ConfigPluginContext, type Connect, type ConnectedPayload, type CorsOptions, type CorsOrigin, type CustomEventMap, type CustomPayload, type CustomPluginOptionsVite, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESTree, type Environment, type EnvironmentModuleGraph, type EnvironmentModuleNode, type EnvironmentOptions, type ErrorPayload, type EsbuildTransformOptions, type ExperimentalOptions, type ExportsData, type FSWatcher, type FetchFunction, type FetchModuleOptions, type FetchResult, type FetchableDevEnvironment, type FetchableDevEnvironmentContext, type FileSystemServeOptions, type FilterPattern, type FullReloadPayload, type GeneralImportGlobOptions, type HMRPayload, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotChannelListener, type HotPayload, type HotUpdateOptions, type HtmlTagDescriptor, type index_d_exports as HttpProxy, type HttpServer, type ImportGlobFunction, type ImportGlobOptions, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InferCustomEventPayload, type InlineConfig, type InternalResolveOptions, type InvalidatePayload, type JsonOptions, type KnownAsTypeMap, type LegacyOptions, type LessPreprocessorOptions, 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, type MinifyOptions, type MinifyResult, type MinimalPluginContextWithoutEnvironment, type ModuleGraph, type ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type NormalizedHotChannel, type NormalizedHotChannelClient, type NormalizedServerHotChannel, type OptimizedDepInfo, type OxcOptions, type ParseResult, type ParserOptions, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type PrunePayload, 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 Rolldown, type Rollup, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type RunnableDevEnvironment, type RunnableDevEnvironmentContext, type SSROptions, type SSRTarget, type SassPreprocessorOptions, type SendOptions, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions$1 as ServerOptions, type SkipInformation, type SsrDepOptimizationConfig, type StylusPreprocessorOptions, type Terser, type TerserOptions, type TransformOptions, type TransformResult, type Update, type UpdatePayload, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, Visitor, type VisitorObject, type ViteBuilder, type ViteDevServer, type WatchOptions, type WebSocket, type WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, type WebSocketServer, build, buildErrorMessage, createBuilder, createFetchableDevEnvironment, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, esmExternalRequirePlugin, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, minify, minifySync, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parse, parseAst, parseAstAsync, parseSync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rolldownVersion, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, transformWithOxc, VERSION as version, withFilter };
4008
+ export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type BindCLIShortcutsOptions, type BuildAppHook, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type ChunkMetadata, type CommonServerOptions, type ConfigEnv, type ConfigPluginContext, type Connect, type ConnectedPayload, type CorsOptions, type CorsOrigin, type CustomEventMap, type CustomPayload, type CustomPluginOptionsVite, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESTree, type Environment, type EnvironmentModuleGraph, type EnvironmentModuleNode, type EnvironmentOptions, type ErrorPayload, type EsbuildTransformOptions, type ExperimentalOptions, type ExportsData, type FSWatcher, type FetchFunction, type FetchModuleOptions, type FetchResult, type FetchableDevEnvironment, type FetchableDevEnvironmentContext, type FileSystemServeOptions, type FilterPattern, type FullReloadPayload, type GeneralImportGlobOptions, type HMRPayload, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotChannelListener, type HotPayload, type HotUpdateOptions, type HtmlAssetSource, type HtmlTagDescriptor, type index_d_exports as HttpProxy, type HttpServer, type ImportGlobFunction, type ImportGlobOptions, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InferCustomEventPayload, type InlineConfig, type InternalResolveOptions, type InvalidatePayload, type JsonOptions, type KnownAsTypeMap, type KnownQueryTypeMap, type LegacyOptions, type LessPreprocessorOptions, 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, type MinifyOptions, type MinifyResult, type MinimalPluginContextWithoutEnvironment, type ModuleGraph, type ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type NormalizedHotChannel, type NormalizedHotChannelClient, type NormalizedServerHotChannel, type OptimizedDepInfo, type OxcOptions, type ParseResult, type ParserOptions, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type PrunePayload, 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 Rolldown, type Rollup, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type RunnableDevEnvironment, type RunnableDevEnvironmentContext, type SSROptions, type SSRTarget, type SassPreprocessorOptions, type SendOptions, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions$1 as ServerOptions, type SkipInformation, type SsrDepOptimizationConfig, type StylusPreprocessorOptions, type Terser, type TerserOptions, type TransformOptions, type TransformResult, type Update, type UpdatePayload, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, Visitor, type VisitorObject, type ViteBuilder, type ViteDevServer, type WatchOptions, type WebSocket, type WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, type WebSocketServer, type WsOptions, build, buildErrorMessage, createBuilder, createFetchableDevEnvironment, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, esmExternalRequirePlugin, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, minify, minifySync, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parse, parseAst, parseAstAsync, parseSync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rolldownVersion, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, transformWithOxc, VERSION as version, withFilter };
@@ -1,3 +1,3 @@
1
1
  import { F as defaultAllowedOrigins, N as VERSION, _ as DEFAULT_SERVER_CONDITIONS, d as DEFAULT_CLIENT_MAIN_FIELDS, h as DEFAULT_EXTERNAL_CONDITIONS, n as createLogger, u as DEFAULT_CLIENT_CONDITIONS, v as DEFAULT_SERVER_MAIN_FIELDS } from "./chunks/logger.js";
2
- import { $ as mergeConfig, B as perEnvironmentState, C as build, E as optimizeDeps, F as fetchModule, G as loadEnv, H as createServerModuleRunner, I as formatPostcssSourceMap, J as transformWithEsbuild, K as resolveEnvPrefix, L as preprocessCSS, M as send, N as isFileLoadingAllowed, O as createServerHotChannel, P as isFileServingAllowed, Q as mergeAlias, R as searchForWorkspaceRoot, S as BuildEnvironment, T as createBuilder, U as createServerModuleRunnerTransport, V as ssrTransform, W as buildErrorMessage, X as createFilter, Y as perEnvironmentPlugin, Z as isCSSRequest, _ as runnerImport, a as minifySync, b as createRunnableDevEnvironment, c as parseAstAsync, d as isFetchableDevEnvironment, et as normalizePath, g as sortUserPlugins, h as resolveConfig, i as minify, j as DevEnvironment, k as createServer, l as parseSync, m as loadConfigFromFile, n as esbuildVersion, nt as rollupVersion, o as parse, p as defineConfig, q as transformWithOxc, r as esmExternalRequirePlugin, rt as withFilter, s as parseAst, t as Visitor, tt as rolldownVersion, u as createFetchableDevEnvironment, v as preview, x as isRunnableDevEnvironment, z as createIdResolver } from "./chunks/node.js";
2
+ import { $ as mergeConfig, A as createServerHotChannel, B as send, C as fetchModule, D as createBuilder, F as searchForWorkspaceRoot, G as loadEnv, H as createServerModuleRunner, I as createIdResolver, J as transformWithEsbuild, K as resolveEnvPrefix, L as perEnvironmentState, N as formatPostcssSourceMap, O as optimizeDeps, P as preprocessCSS, Q as mergeAlias, R as isFileLoadingAllowed, S as DevEnvironment, T as build, U as createServerModuleRunnerTransport, V as ssrTransform, W as buildErrorMessage, X as createFilter, Y as perEnvironmentPlugin, Z as isCSSRequest, _ as runnerImport, a as minifySync, b as createRunnableDevEnvironment, c as parseAstAsync, d as isFetchableDevEnvironment, et as normalizePath, g as sortUserPlugins, h as resolveConfig, i as minify, j as createServer, l as parseSync, m as loadConfigFromFile, n as esbuildVersion, nt as rollupVersion, o as parse, p as defineConfig, q as transformWithOxc, r as esmExternalRequirePlugin, rt as withFilter, s as parseAst, t as Visitor, tt as rolldownVersion, u as createFetchableDevEnvironment, v as preview, w as BuildEnvironment, x as isRunnableDevEnvironment, z as isFileServingAllowed } from "./chunks/node.js";
3
3
  export { BuildEnvironment, DevEnvironment, Visitor, build, buildErrorMessage, createBuilder, createFetchableDevEnvironment, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, esmExternalRequirePlugin, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, minify, minifySync, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parse, parseAst, parseAstAsync, parseSync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rolldownVersion, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, transformWithOxc, VERSION as version, withFilter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "8.0.15",
3
+ "version": "8.1.0-beta.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -63,7 +63,7 @@
63
63
  "lightningcss": "^1.32.0",
64
64
  "picomatch": "^4.0.4",
65
65
  "postcss": "^8.5.15",
66
- "rolldown": "1.0.3",
66
+ "rolldown": "1.1.1",
67
67
  "tinyglobby": "^0.2.17"
68
68
  },
69
69
  "optionalDependencies": {
@@ -77,13 +77,14 @@
77
77
  "@rollup/plugin-alias": "^6.0.0",
78
78
  "@rollup/plugin-dynamic-import-vars": "2.1.4",
79
79
  "@rollup/pluginutils": "^5.4.0",
80
- "@vercel/detect-agent": "^1.2.3",
81
80
  "@types/escape-html": "^1.0.4",
82
81
  "@types/pnpapi": "^0.0.5",
83
- "@vitest/utils": "4.1.7",
84
- "@vitejs/devtools": "^0.3.1",
82
+ "@vercel/detect-agent": "^1.2.3",
83
+ "@vitejs/devtools": "^0.3.3",
84
+ "@vitest/utils": "4.1.8",
85
+ "@voidzero-dev/vite-task-client": "^0.1.1",
85
86
  "artichokie": "^0.4.3",
86
- "baseline-browser-mapping": "^2.10.33",
87
+ "baseline-browser-mapping": "^2.10.37",
87
88
  "cac": "^7.0.0",
88
89
  "chokidar": "^3.6.0",
89
90
  "connect": "^3.7.0",
@@ -91,14 +92,15 @@
91
92
  "cors": "^2.8.6",
92
93
  "cross-spawn": "^7.0.6",
93
94
  "dotenv-expand": "^13.0.0",
94
- "es-module-lexer": "^1.7.0",
95
- "esbuild": "^0.28.0",
95
+ "es-module-lexer": "^2.1.0",
96
+ "esbuild": "^0.28.1",
96
97
  "escape-html": "^1.0.3",
97
98
  "estree-walker": "^3.0.3",
98
99
  "etag": "^1.8.1",
100
+ "fresh-import": "^0.2.1",
99
101
  "host-validation-middleware": "^0.1.4",
100
- "http-proxy-3": "^1.23.2",
101
- "launch-editor-middleware": "^2.14.0",
102
+ "http-proxy-3": "^1.23.3",
103
+ "launch-editor-middleware": "^2.14.1",
102
104
  "magic-string": "^0.30.21",
103
105
  "mlly": "^1.8.2",
104
106
  "mrmime": "^2.0.1",
@@ -117,7 +119,7 @@
117
119
  "rolldown-plugin-dts": "^0.25.2",
118
120
  "rollup": "^4.59.0",
119
121
  "rollup-plugin-license": "^3.7.1",
120
- "sass": "^1.100.0",
122
+ "sass": "^1.101.0",
121
123
  "sass-embedded": "^1.100.0",
122
124
  "sirv": "^3.0.2",
123
125
  "strip-literal": "^3.1.0",
@@ -127,7 +129,7 @@
127
129
  },
128
130
  "peerDependencies": {
129
131
  "@types/node": "^20.19.0 || >=22.12.0",
130
- "@vitejs/devtools": "^0.1.18",
132
+ "@vitejs/devtools": "^0.3.0",
131
133
  "esbuild": "^0.27.0 || ^0.28.0",
132
134
  "jiti": ">=1.21.0",
133
135
  "less": "^4.0.0",
@@ -1,6 +1,11 @@
1
+ // make input suggestions work
2
+ type StringQueryType = `?${keyof KnownAsTypeMap}` | (string & {})
3
+ type BaseQueryType = StringQueryType | Record<string, string | number | boolean>
4
+
1
5
  export interface ImportGlobOptions<
2
6
  Eager extends boolean,
3
7
  AsType extends string,
8
+ QueryType extends BaseQueryType,
4
9
  > {
5
10
  /**
6
11
  * Import type for the import url.
@@ -21,7 +26,7 @@ export interface ImportGlobOptions<
21
26
  /**
22
27
  * Custom queries
23
28
  */
24
- query?: string | Record<string, string | number | boolean>
29
+ query?: QueryType
25
30
  /**
26
31
  * Search files also inside `node_modules/` and hidden directories (e.g. `.git/`). This might have impact on performance.
27
32
  *
@@ -32,9 +37,24 @@ export interface ImportGlobOptions<
32
37
  * Base path to resolve relative paths.
33
38
  */
34
39
  base?: string
40
+ /**
41
+ * Whether the glob pattern matching should be case-sensitive. Defaults to `true`.
42
+ */
43
+ caseSensitive?: boolean
44
+ }
45
+
46
+ export type ImportGlobOptionsWithoutAs<
47
+ Eager extends boolean,
48
+ QueryType extends BaseQueryType,
49
+ > = Omit<ImportGlobOptions<Eager, string, QueryType>, 'as'> & {
50
+ as?: never
35
51
  }
36
52
 
37
- export type GeneralImportGlobOptions = ImportGlobOptions<boolean, string>
53
+ export type GeneralImportGlobOptions = ImportGlobOptions<
54
+ boolean,
55
+ string,
56
+ BaseQueryType
57
+ >
38
58
 
39
59
  /**
40
60
  * Declare Worker in case DOM is not added to the tsconfig lib causing
@@ -52,11 +72,33 @@ export interface KnownAsTypeMap {
52
72
  worker: Worker
53
73
  }
54
74
 
75
+ type KnownQueryTypeMap = {
76
+ [K in keyof KnownAsTypeMap as `?${K}`]: KnownAsTypeMap[K]
77
+ }
78
+
55
79
  export interface ImportGlobFunction {
56
80
  /**
57
81
  * Import a list of files with a glob pattern.
58
82
  *
59
- * Overload 1: No generic provided, infer the type from `eager` and `as`
83
+ * Overload 1A: No generic provided, infer the type from `eager` and `query`
84
+ */
85
+ <
86
+ Eager extends boolean,
87
+ Query extends BaseQueryType,
88
+ T = Query extends keyof KnownQueryTypeMap
89
+ ? KnownQueryTypeMap[Query]
90
+ : unknown,
91
+ >(
92
+ glob: string | string[],
93
+ options?: ImportGlobOptionsWithoutAs<Eager, Query>,
94
+ ): (Eager extends true ? true : false) extends true
95
+ ? Record<string, T>
96
+ : Record<string, () => Promise<T>>
97
+ /**
98
+ * Import a list of files with a glob pattern.
99
+ *
100
+ * Overload 1B: No generic provided, infer the type from `eager` and `as`
101
+ * (deprecated, use `query` instead)
60
102
  */
61
103
  <
62
104
  Eager extends boolean,
@@ -64,7 +106,7 @@ export interface ImportGlobFunction {
64
106
  T = As extends keyof KnownAsTypeMap ? KnownAsTypeMap[As] : unknown,
65
107
  >(
66
108
  glob: string | string[],
67
- options?: ImportGlobOptions<Eager, As>,
109
+ options?: ImportGlobOptions<Eager, As, BaseQueryType>,
68
110
  ): (Eager extends true ? true : false) extends true
69
111
  ? Record<string, T>
70
112
  : Record<string, () => Promise<T>>
@@ -75,7 +117,7 @@ export interface ImportGlobFunction {
75
117
  */
76
118
  <M>(
77
119
  glob: string | string[],
78
- options?: ImportGlobOptions<false, string>,
120
+ options?: ImportGlobOptions<false, string, BaseQueryType>,
79
121
  ): Record<string, () => Promise<M>>
80
122
  /**
81
123
  * Import a list of files with a glob pattern.
@@ -84,6 +126,6 @@ export interface ImportGlobFunction {
84
126
  */
85
127
  <M>(
86
128
  glob: string | string[],
87
- options: ImportGlobOptions<true, string>,
129
+ options: ImportGlobOptions<true, string, BaseQueryType>,
88
130
  ): Record<string, M>
89
131
  }