vite 6.0.0-alpha.16 → 6.0.0-alpha.18

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,4 +1,4 @@
1
- import { J as getDefaultExportFromCjs } from './dep-5iBxKK6m.js';
1
+ import { J as getDefaultExportFromCjs } from './dep-DXWVQosX.js';
2
2
  import require$$0 from 'path';
3
3
  import require$$0__default from 'fs';
4
4
  import { l as lib } from './dep-IQS-Za7F.js';
package/dist/node/cli.js CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import fs from 'node:fs';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { EventEmitter } from 'events';
5
- import { I as colors, A as createLogger, r as resolveConfig } from './chunks/dep-5iBxKK6m.js';
5
+ import { I as colors, A as createLogger, r as resolveConfig } from './chunks/dep-DXWVQosX.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -766,7 +766,7 @@ cli
766
766
  filterDuplicateOptions(options);
767
767
  // output structure is preserved even after bundling so require()
768
768
  // is ok here
769
- const { createServer } = await import('./chunks/dep-5iBxKK6m.js').then(function (n) { return n.M; });
769
+ const { createServer } = await import('./chunks/dep-DXWVQosX.js').then(function (n) { return n.M; });
770
770
  try {
771
771
  const server = await createServer({
772
772
  root,
@@ -847,7 +847,7 @@ cli
847
847
  .option('--app', `[boolean] same as builder.entireApp`)
848
848
  .action(async (root, options) => {
849
849
  filterDuplicateOptions(options);
850
- const { createBuilder, buildEnvironment } = await import('./chunks/dep-5iBxKK6m.js').then(function (n) { return n.N; });
850
+ const { createBuilder, buildEnvironment } = await import('./chunks/dep-DXWVQosX.js').then(function (n) { return n.N; });
851
851
  const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
852
852
  const config = {
853
853
  root,
@@ -888,7 +888,7 @@ cli
888
888
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
889
889
  .action(async (root, options) => {
890
890
  filterDuplicateOptions(options);
891
- const { optimizeDeps } = await import('./chunks/dep-5iBxKK6m.js').then(function (n) { return n.L; });
891
+ const { optimizeDeps } = await import('./chunks/dep-DXWVQosX.js').then(function (n) { return n.L; });
892
892
  try {
893
893
  const config = await resolveConfig({
894
894
  root,
@@ -914,7 +914,7 @@ cli
914
914
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
915
915
  .action(async (root, options) => {
916
916
  filterDuplicateOptions(options);
917
- const { preview } = await import('./chunks/dep-5iBxKK6m.js').then(function (n) { return n.O; });
917
+ const { preview } = await import('./chunks/dep-DXWVQosX.js').then(function (n) { return n.O; });
918
918
  try {
919
919
  const server = await preview({
920
920
  root,
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { PluginHooks, RollupError, SourceMap, ModuleInfo, PartialResolvedId, RollupOptions, WatcherOptions, InputOption, ModuleFormat, RollupOutput, RollupWatcher, InputOptions, CustomPluginOptions, SourceDescription, LoadResult, SourceMapInput, ExistingRawSourceMap, OutputBundle, OutputChunk, ObjectHook, ResolveIdResult, GetManualChunk } from 'rollup';
2
+ import { PluginHooks, RollupError, SourceMap, ModuleInfo, PartialResolvedId, RollupOptions, WatcherOptions, InputOption, ModuleFormat, RollupOutput, RollupWatcher, MinimalPluginContext, InputOptions, CustomPluginOptions, LoadResult, SourceDescription, SourceMapInput, ExistingRawSourceMap, OutputBundle, OutputChunk, ObjectHook, ResolveIdResult, GetManualChunk } from 'rollup';
3
3
  import * as rollup from 'rollup';
4
4
  export { rollup as Rollup };
5
5
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
@@ -15,12 +15,12 @@ import * as url from 'node:url';
15
15
  import { URL } from 'node:url';
16
16
  import * as stream from 'node:stream';
17
17
  import { Duplex, DuplexOptions } from 'node:stream';
18
- import { FetchResult, ModuleRunnerOptions, ModuleRunnerHMRConnection, ModuleRunnerHmr, ModuleEvaluator, ModuleRunner } from 'vite/module-runner';
18
+ import { FetchResult, FetchFunctionOptions, ModuleRunnerOptions, ModuleRunnerHMRConnection, ModuleRunnerHmr, ModuleEvaluator, ModuleRunner } from 'vite/module-runner';
19
19
  export { FetchFunction, FetchResult } from 'vite/module-runner';
20
20
  import { BuildOptions as esbuild_BuildOptions, TransformOptions as esbuild_TransformOptions, TransformResult as esbuild_TransformResult } from 'esbuild';
21
21
  export { TransformOptions as EsbuildTransformOptions, version as esbuildVersion } from 'esbuild';
22
- import { HMRPayload, CustomPayload } from '../../types/hmrPayload.js';
23
- export { ConnectedPayload, CustomPayload, ErrorPayload, FullReloadPayload, HMRPayload, PrunePayload, Update, UpdatePayload } from '../../types/hmrPayload.js';
22
+ import { HotPayload, CustomPayload } from '../../types/hotPayload.js';
23
+ export { ConnectedPayload, CustomPayload, ErrorPayload, FullReloadPayload, HMRPayload, HotPayload, PrunePayload, Update, UpdatePayload } from '../../types/hotPayload.js';
24
24
  import { InferCustomEventPayload } from '../../types/customEvent.js';
25
25
  export { CustomEventMap, InferCustomEventPayload, InvalidatePayload } from '../../types/customEvent.js';
26
26
  import { SecureContextOptions } from 'node:tls';
@@ -803,6 +803,7 @@ declare class FutureCompatEnvironment extends BaseEnvironment {
803
803
  }
804
804
 
805
805
  interface FetchModuleOptions {
806
+ cached?: boolean;
806
807
  inlineSourceMap?: boolean;
807
808
  processSourceMap?<T extends NonNullable<TransformResult['map']>>(map: T): T;
808
809
  }
@@ -896,7 +897,7 @@ interface DepOptimizationConfig {
896
897
  * When enabled, it will hold the first optimized deps results until all static
897
898
  * imports are crawled on cold start. This avoids the need for full-page reloads
898
899
  * when new dependencies are discovered and they trigger the generation of new
899
- * common chunks. If all dependencies are found by the scanner plus the explicitely
900
+ * common chunks. If all dependencies are found by the scanner plus the explicitly
900
901
  * defined ones in `include`, it is better to disable this option to let the
901
902
  * browser process more requests in parallel.
902
903
  * @default true
@@ -1074,7 +1075,7 @@ declare class EnvironmentModuleGraph {
1074
1075
  }
1075
1076
 
1076
1077
  /**
1077
- * Backward compatible ModuleNode and ModuleGraph with mixed nodes from both the client and ssr enviornments
1078
+ * Backward compatible ModuleNode and ModuleGraph with mixed nodes from both the client and ssr environments
1078
1079
  * It would be good to take the types names for the new EnvironmentModuleNode and EnvironmentModuleGraph but we can't
1079
1080
  * do that at this point without breaking to much code in the ecosystem.
1080
1081
  * We are going to deprecate these types and we can try to use them back in the future.
@@ -1184,25 +1185,21 @@ interface HmrContext {
1184
1185
  read: () => string | Promise<string>;
1185
1186
  server: ViteDevServer;
1186
1187
  }
1187
- interface HMRBroadcasterClient {
1188
+ interface HotChannelClient {
1188
1189
  /**
1189
1190
  * Send event to the client
1190
1191
  */
1191
- send(payload: HMRPayload): void;
1192
+ send(payload: HotPayload): void;
1192
1193
  /**
1193
1194
  * Send custom event
1194
1195
  */
1195
1196
  send(event: string, payload?: CustomPayload['data']): void;
1196
1197
  }
1197
- interface HMRChannel {
1198
- /**
1199
- * Unique channel name
1200
- */
1201
- name: string;
1198
+ interface HotChannel {
1202
1199
  /**
1203
1200
  * Broadcast events to all clients
1204
1201
  */
1205
- send(payload: HMRPayload): void;
1202
+ send(payload: HotPayload): void;
1206
1203
  /**
1207
1204
  * Send custom event
1208
1205
  */
@@ -1210,7 +1207,7 @@ interface HMRChannel {
1210
1207
  /**
1211
1208
  * Handle custom event emitted by `import.meta.hot.send`
1212
1209
  */
1213
- on<T extends string>(event: T, listener: (data: InferCustomEventPayload<T>, client: HMRBroadcasterClient, ...args: any[]) => void): void;
1210
+ on<T extends string>(event: T, listener: (data: InferCustomEventPayload<T>, client: HotChannelClient, ...args: any[]) => void): void;
1214
1211
  on(event: 'connection', listener: () => void): void;
1215
1212
  /**
1216
1213
  * Unregister event listener
@@ -1225,18 +1222,7 @@ interface HMRChannel {
1225
1222
  */
1226
1223
  close(): void;
1227
1224
  }
1228
- interface HMRBroadcaster extends Omit<HMRChannel, 'close' | 'name'> {
1229
- /**
1230
- * All registered channels. Always has websocket channel.
1231
- */
1232
- readonly channels: HMRChannel[];
1233
- /**
1234
- * Add a new third-party channel.
1235
- */
1236
- addChannel(connection: HMRChannel): HMRBroadcaster;
1237
- close(): Promise<unknown[]>;
1238
- }
1239
- interface ServerHMRChannel extends HMRChannel {
1225
+ interface ServerHotChannel extends HotChannel {
1240
1226
  api: {
1241
1227
  innerEmitter: EventEmitter;
1242
1228
  outsideEmitter: EventEmitter;
@@ -1253,7 +1239,7 @@ declare class RemoteEnvironmentTransport {
1253
1239
  }
1254
1240
 
1255
1241
  interface DevEnvironmentSetup {
1256
- hot?: false | HMRChannel;
1242
+ hot: false | HotChannel;
1257
1243
  watcher?: FSWatcher;
1258
1244
  options?: EnvironmentOptions;
1259
1245
  runner?: FetchModuleOptions & {
@@ -1268,16 +1254,16 @@ declare class DevEnvironment extends BaseEnvironment {
1268
1254
  depsOptimizer?: DepsOptimizer;
1269
1255
  get pluginContainer(): EnvironmentPluginContainer;
1270
1256
  /**
1271
- * HMR channel for this environment. If not provided or disabled,
1257
+ * Hot channel for this environment. If not provided or disabled,
1272
1258
  * it will be a noop channel that does nothing.
1273
1259
  *
1274
1260
  * @example
1275
1261
  * environment.hot.send({ type: 'full-reload' })
1276
1262
  */
1277
- hot: HMRChannel;
1278
- constructor(name: string, config: ResolvedConfig, setup?: DevEnvironmentSetup);
1263
+ hot: HotChannel;
1264
+ constructor(name: string, config: ResolvedConfig, setup: DevEnvironmentSetup);
1279
1265
  init(): Promise<void>;
1280
- fetchModule(id: string, importer?: string): Promise<FetchResult>;
1266
+ fetchModule(id: string, importer?: string, options?: FetchFunctionOptions): Promise<FetchResult>;
1281
1267
  transformRequest(url: string): Promise<TransformResult | null>;
1282
1268
  warmupRequest(url: string): Promise<void>;
1283
1269
  close(): Promise<void>;
@@ -2007,7 +1993,7 @@ interface LibraryOptions {
2007
1993
  */
2008
1994
  fileName?: string | ((format: ModuleFormat, entryName: string) => string);
2009
1995
  }
2010
- type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife';
1996
+ type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife' | 'system';
2011
1997
  interface ModulePreloadOptions {
2012
1998
  /**
2013
1999
  * Whether to inject a module preload polyfill.
@@ -2073,20 +2059,36 @@ declare function createBuilder(inlineConfig?: InlineConfig): Promise<ViteBuilder
2073
2059
 
2074
2060
  type Environment = DevEnvironment | BuildEnvironment | ScanEnvironment | FutureCompatEnvironment;
2075
2061
 
2076
- /**
2077
- * This file is refactored into TypeScript based on
2078
- * https://github.com/preactjs/wmr/blob/main/packages/wmr/src/lib/rollup-plugin-container.js
2079
- */
2080
-
2081
- interface EnvironmentPluginContainer {
2082
- options: InputOptions;
2083
- buildStart(options: InputOptions): Promise<void>;
2084
- resolveId(id: string, importer: string | undefined, options?: {
2062
+ declare class EnvironmentPluginContainer {
2063
+ environment: Environment;
2064
+ plugins: Plugin[];
2065
+ watcher?: FSWatcher | undefined;
2066
+ private _pluginContextMap;
2067
+ private _resolvedRollupOptions?;
2068
+ private _processesing;
2069
+ private _seenResolves;
2070
+ private _moduleNodeToLoadAddedImports;
2071
+ getSortedPluginHooks: PluginHookUtils['getSortedPluginHooks'];
2072
+ getSortedPlugins: PluginHookUtils['getSortedPlugins'];
2073
+ moduleGraph: EnvironmentModuleGraph | undefined;
2074
+ watchFiles: Set<string>;
2075
+ minimalContext: MinimalPluginContext;
2076
+ private _closed;
2077
+ private _updateModuleLoadAddedImports;
2078
+ private _getAddedImports;
2079
+ private handleHookPromise;
2080
+ get options(): InputOptions;
2081
+ resolveRollupOptions(): Promise<InputOptions>;
2082
+ private _getPluginContext;
2083
+ private hookParallel;
2084
+ buildStart(_options?: InputOptions): Promise<void>;
2085
+ resolveId(rawId: string, importer?: string | undefined, options?: {
2085
2086
  attributes?: Record<string, string>;
2086
2087
  custom?: CustomPluginOptions;
2087
2088
  skip?: Set<Plugin>;
2088
2089
  isEntry?: boolean;
2089
2090
  }): Promise<PartialResolvedId | null>;
2091
+ load(id: string, options?: {}): Promise<LoadResult | null>;
2090
2092
  transform(code: string, id: string, options?: {
2091
2093
  inMap?: SourceDescription['map'];
2092
2094
  }): Promise<{
@@ -2095,38 +2097,39 @@ interface EnvironmentPluginContainer {
2095
2097
  mappings: '';
2096
2098
  } | null;
2097
2099
  }>;
2098
- load(id: string, options?: {}): Promise<LoadResult | null>;
2099
2100
  watchChange(id: string, change: {
2100
2101
  event: 'create' | 'update' | 'delete';
2101
2102
  }): Promise<void>;
2102
2103
  close(): Promise<void>;
2103
2104
  }
2104
- interface PluginContainer {
2105
- options: InputOptions;
2106
- buildStart(options: InputOptions): Promise<void>;
2107
- resolveId(id: string, importer?: string, options?: {
2105
+ declare class PluginContainer {
2106
+ private environments;
2107
+ constructor(environments: Record<string, Environment>);
2108
+ private _getEnvironment;
2109
+ private _getPluginContainer;
2110
+ get options(): InputOptions;
2111
+ buildStart(_options?: InputOptions): Promise<void>;
2112
+ resolveId(rawId: string, importer?: string, options?: {
2108
2113
  attributes?: Record<string, string>;
2109
2114
  custom?: CustomPluginOptions;
2110
2115
  skip?: Set<Plugin>;
2111
2116
  ssr?: boolean;
2112
- environment?: Environment;
2113
2117
  isEntry?: boolean;
2114
2118
  }): Promise<PartialResolvedId | null>;
2119
+ load(id: string, options?: {
2120
+ ssr?: boolean;
2121
+ }): Promise<LoadResult | null>;
2115
2122
  transform(code: string, id: string, options?: {
2116
- inMap?: SourceDescription['map'];
2117
2123
  ssr?: boolean;
2118
2124
  environment?: Environment;
2125
+ inMap?: SourceDescription['map'];
2119
2126
  }): Promise<{
2120
2127
  code: string;
2121
2128
  map: SourceMap | {
2122
2129
  mappings: '';
2123
2130
  } | null;
2124
2131
  }>;
2125
- load(id: string, options?: {
2126
- ssr?: boolean;
2127
- environment?: Environment;
2128
- }): Promise<LoadResult | null>;
2129
- watchChange(id: string, change: {
2132
+ watchChange(_id: string, _change: {
2130
2133
  event: 'create' | 'update' | 'delete';
2131
2134
  }): Promise<void>;
2132
2135
  close(): Promise<void>;
@@ -2667,7 +2670,7 @@ declare namespace WebSocket {
2667
2670
  }
2668
2671
 
2669
2672
  type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
2670
- interface WebSocketServer extends HMRChannel {
2673
+ interface WebSocketServer extends HotChannel {
2671
2674
  /**
2672
2675
  * Listen on port and host
2673
2676
  */
@@ -2693,15 +2696,7 @@ interface WebSocketServer extends HMRChannel {
2693
2696
  (event: string, listener: Function): void;
2694
2697
  };
2695
2698
  }
2696
- interface WebSocketClient {
2697
- /**
2698
- * Send event to the client
2699
- */
2700
- send(payload: HMRPayload): void;
2701
- /**
2702
- * Send custom event
2703
- */
2704
- send(event: string, payload?: CustomPayload['data']): void;
2699
+ interface WebSocketClient extends HotChannelClient {
2705
2700
  /**
2706
2701
  * The raw WebSocket instance
2707
2702
  * @advanced
@@ -2714,6 +2709,11 @@ interface ServerOptions extends CommonServerOptions {
2714
2709
  * Configure HMR-specific options (port, host, path & protocol)
2715
2710
  */
2716
2711
  hmr?: HmrOptions | boolean;
2712
+ /**
2713
+ * Do not start the websocket connection.
2714
+ * @experimental
2715
+ */
2716
+ ws?: false;
2717
2717
  /**
2718
2718
  * Warm-up files to transform and cache the results in advance. This improves the
2719
2719
  * initial page load during server starts and prevents transform waterfalls.
@@ -2844,17 +2844,9 @@ interface ViteDevServer {
2844
2844
  watcher: FSWatcher;
2845
2845
  /**
2846
2846
  * web socket server with `send(payload)` method
2847
- * @deprecated use `hot` instead
2848
- */
2849
- ws: WebSocketServer;
2850
- /**
2851
- * HMR broadcaster that can be used to send custom HMR messages to the client
2852
- *
2853
- * Always sends a message to at least a WebSocket client. Any third party can
2854
- * add a channel to the broadcaster to process messages
2855
2847
  * @deprecated use `environment.hot` instead
2856
2848
  */
2857
- hot: HMRBroadcaster;
2849
+ ws: WebSocketServer;
2858
2850
  /**
2859
2851
  * Rollup plugin container that can run plugin hooks on a given file
2860
2852
  * @deprecated use `environment.pluginContainer` instead
@@ -3249,7 +3241,10 @@ type IndexHtmlTransform = IndexHtmlTransformHook | {
3249
3241
  * check if they have access to dev specific APIs.
3250
3242
  */
3251
3243
  interface PluginContextExtension {
3252
- environment?: Environment;
3244
+ /**
3245
+ * Vite-specific environment instance
3246
+ */
3247
+ environment: Environment;
3253
3248
  }
3254
3249
  interface PluginContext extends rollup.PluginContext, PluginContextExtension {
3255
3250
  }
@@ -3406,8 +3401,19 @@ interface Plugin<A = any> extends rollup.Plugin<A> {
3406
3401
  transformIndexHtml?: IndexHtmlTransform;
3407
3402
  /**
3408
3403
  * @deprecated
3409
- * Compat support, ctx.modules is a backward compatible ModuleNode array
3410
- * with the mixed client and ssr moduleGraph. Use hotUpdate instead
3404
+ * Perform custom handling of HMR updates.
3405
+ * The handler receives a context containing changed filename, timestamp, a
3406
+ * list of modules affected by the file change, and the dev server instance.
3407
+ *
3408
+ * - The hook can return a filtered list of modules to narrow down the update.
3409
+ * e.g. for a Vue SFC, we can narrow down the part to update by comparing
3410
+ * the descriptors.
3411
+ *
3412
+ * - The hook can also return an empty array and then perform custom updates
3413
+ * by sending a custom hmr payload via server.ws.send().
3414
+ *
3415
+ * - If the hook doesn't return a value, the hmr update will be performed as
3416
+ * normal.
3411
3417
  */
3412
3418
  handleHotUpdate?: ObjectHook<(this: void, ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>;
3413
3419
  }
@@ -3434,7 +3440,7 @@ interface JsonOptions {
3434
3440
  }
3435
3441
 
3436
3442
  type SSRTarget = 'node' | 'webworker';
3437
- type SsrDepOptimizationOptions = DepOptimizationConfig;
3443
+ type SsrDepOptimizationConfig = DepOptimizationConfig;
3438
3444
  /**
3439
3445
  * @deprecated use environments.ssr
3440
3446
  */
@@ -3470,7 +3476,7 @@ interface SSROptions {
3470
3476
  * @experimental
3471
3477
  * @deprecated
3472
3478
  */
3473
- optimizeDeps?: SsrDepOptimizationOptions;
3479
+ optimizeDeps?: SsrDepOptimizationConfig;
3474
3480
  /**
3475
3481
  * @deprecated
3476
3482
  */
@@ -3495,7 +3501,16 @@ interface SSROptions {
3495
3501
  }
3496
3502
  interface ResolvedSSROptions extends SSROptions {
3497
3503
  target: SSRTarget;
3498
- optimizeDeps: SsrDepOptimizationOptions;
3504
+ optimizeDeps: SsrDepOptimizationConfig;
3505
+ }
3506
+
3507
+ interface FutureDeprecationWarningsOptions {
3508
+ pluginHookHandleHotUpdate?: boolean;
3509
+ pluginHookSsrArgument?: boolean;
3510
+ serverModuleGraph?: boolean;
3511
+ serverHot?: boolean;
3512
+ serverTransformRequest?: boolean;
3513
+ ssrLoadModule?: boolean;
3499
3514
  }
3500
3515
 
3501
3516
  interface ConfigEnv {
@@ -3560,7 +3575,7 @@ interface DevEnvironmentOptions {
3560
3575
  /**
3561
3576
  * Optimize deps config
3562
3577
  */
3563
- optimizeDeps?: DepOptimizationConfig;
3578
+ optimizeDeps?: DepOptimizationOptions;
3564
3579
  /**
3565
3580
  * create the Dev Environment instance
3566
3581
  */
@@ -3712,6 +3727,10 @@ interface UserConfig extends DefaultEnvironmentOptions {
3712
3727
  * @experimental
3713
3728
  */
3714
3729
  experimental?: ExperimentalOptions;
3730
+ /**
3731
+ * Options to opt-in to future behavior
3732
+ */
3733
+ future?: FutureOptions;
3715
3734
  /**
3716
3735
  * Legacy options
3717
3736
  *
@@ -3793,6 +3812,14 @@ interface HTMLOptions {
3793
3812
  */
3794
3813
  cspNonce?: string;
3795
3814
  }
3815
+ interface FutureOptions {
3816
+ /**
3817
+ * Emit warning messages for deprecated/will-deprecated features at runtime.
3818
+ *
3819
+ * Setting to `true` to enable all warnings
3820
+ */
3821
+ deprecationWarnings?: boolean | FutureDeprecationWarningsOptions;
3822
+ }
3796
3823
  interface ExperimentalOptions {
3797
3824
  /**
3798
3825
  * Append fake `&lang.(ext)` when queries are specified, to preserve the file extension for following plugins to process.
@@ -3896,9 +3923,16 @@ declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, c
3896
3923
  dependencies: string[];
3897
3924
  } | null>;
3898
3925
 
3926
+ type ResolveIdFn = (environment: PartialEnvironment, id: string, importer?: string, aliasOnly?: boolean) => Promise<string | undefined>;
3927
+ /**
3928
+ * Create an internal resolver to be used in special scenarios, e.g.
3929
+ * optimizer and handling css @imports
3930
+ */
3931
+ declare function createIdResolver(config: ResolvedConfig, options: Partial<InternalResolveOptions>): ResolveIdFn;
3932
+
3899
3933
  declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
3900
3934
 
3901
- declare function createNodeDevEnvironment(name: string, config: ResolvedConfig, options?: DevEnvironmentSetup): DevEnvironment;
3935
+ declare function createNodeDevEnvironment(name: string, config: ResolvedConfig, options: DevEnvironmentSetup): DevEnvironment;
3902
3936
 
3903
3937
  /**
3904
3938
  * @experimental
@@ -3927,14 +3961,14 @@ declare function createServerModuleRunner(environment: DevEnvironment, options?:
3927
3961
  * @experimental
3928
3962
  */
3929
3963
  declare class ServerHMRConnector implements ModuleRunnerHMRConnection {
3930
- private hmrChannel;
3964
+ private hotChannel;
3931
3965
  private handlers;
3932
3966
  private hmrClient;
3933
3967
  private connected;
3934
- constructor(hmrChannel: ServerHMRChannel);
3968
+ constructor(hotChannel: ServerHotChannel);
3935
3969
  isReady(): boolean;
3936
3970
  send(message: string): void;
3937
- onUpdate(handler: (payload: HMRPayload) => void): void;
3971
+ onUpdate(handler: (payload: HotPayload) => void): void;
3938
3972
  }
3939
3973
 
3940
3974
  interface ModuleRunnerTransformOptions {
@@ -3979,12 +4013,6 @@ declare const rollupVersion: string;
3979
4013
  declare function normalizePath(id: string): string;
3980
4014
  declare function mergeConfig<D extends Record<string, any>, O extends Record<string, any>>(defaults: D extends Function ? never : D, overrides: O extends Function ? never : O, isRoot?: boolean): Record<string, any>;
3981
4015
  declare function mergeAlias(a?: AliasOptions, b?: AliasOptions): AliasOptions | undefined;
3982
- /**
3983
- * Creates a function that hides the complexities of a WeakMap with an initial value
3984
- * to implement object metadata. Used by plugins to implement cross hooks per
3985
- * environment metadata
3986
- */
3987
- declare function createWeakData<Key extends WeakKey, Data>(initial: (key: Key) => Data): (key: Key) => Data;
3988
4016
 
3989
4017
  interface SendOptions {
3990
4018
  etag?: string;
@@ -4024,4 +4052,4 @@ interface ManifestChunk {
4024
4052
  dynamicImports?: string[];
4025
4053
  }
4026
4054
 
4027
- 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, type Environment, 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 ModuleRunnerTransformOptions, type OptimizedDepInfo, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, RemoteEnvironmentTransport, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerModuleRunnerOptions, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteBuilder, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createBuilder, createFilter, createLogger, createNodeDevEnvironment, createServer, createServerModuleRunner, createWeakData, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
4055
+ 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, type Environment, EnvironmentModuleGraph, EnvironmentModuleNode, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, 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 ModuleRunnerTransformOptions, type OptimizedDepInfo, type Plugin, 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, ServerHMRConnector, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationConfig, 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, createIdResolver, createLogger, createNodeDevEnvironment, createServer, createServerModuleRunner, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, 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-5iBxKK6m.js';
3
- export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, h as buildErrorMessage, e as createBuilder, w as createFilter, A as createLogger, j as createNodeDevEnvironment, c as createServer, m as createServerModuleRunner, x as createWeakData, d as defineConfig, k as fetchModule, f as formatPostcssSourceMap, F as isFileLoadingAllowed, E as isFileServingAllowed, l as loadConfigFromFile, G as loadEnv, v as mergeAlias, u as mergeConfig, n as moduleRunnerTransform, q as normalizePath, o as optimizeDeps, g as preprocessCSS, p as preview, r as resolveConfig, H as resolveEnvPrefix, y as rollupVersion, C as searchForWorkspaceRoot, z as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-5iBxKK6m.js';
2
+ import { i as isInNodeModules, a as arraify } from './chunks/dep-DXWVQosX.js';
3
+ export { B as BuildEnvironment, D as DevEnvironment, S as ServerHMRConnector, b as build, j as buildErrorMessage, e as createBuilder, x as createFilter, f as createIdResolver, A as createLogger, k as createNodeDevEnvironment, c as createServer, n as createServerModuleRunner, d as defineConfig, m as fetchModule, g as formatPostcssSourceMap, F as isFileLoadingAllowed, E as isFileServingAllowed, l as loadConfigFromFile, G as loadEnv, w as mergeAlias, v as mergeConfig, q as moduleRunnerTransform, u as normalizePath, o as optimizeDeps, h as preprocessCSS, p as preview, r as resolveConfig, H as resolveEnvPrefix, y as rollupVersion, C as searchForWorkspaceRoot, z as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-DXWVQosX.js';
4
4
  export { VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  import 'node:fs';
@@ -1,5 +1,5 @@
1
1
  import { ModuleNamespace, ViteHotContext } from '../../types/hot.js';
2
- import { Update, HMRPayload } from '../../types/hmrPayload.js';
2
+ import { Update, HotPayload } from '../../types/hotPayload.js';
3
3
  import { InferCustomEventPayload } from '../../types/customEvent.js';
4
4
 
5
5
  interface SourceMapLike {
@@ -182,7 +182,7 @@ interface ModuleRunnerHMRConnection extends HMRConnection {
182
182
  * Configure how HMR is handled when this connection triggers an update.
183
183
  * This method expects that connection will start listening for HMR updates and call this callback when it's received.
184
184
  */
185
- onUpdate(callback: (payload: HMRPayload) => void): void;
185
+ onUpdate(callback: (payload: HotPayload) => void): void;
186
186
  }
187
187
  interface ModuleRunnerImportMeta extends ImportMeta {
188
188
  url: string;
@@ -217,14 +217,20 @@ interface ModuleCache {
217
217
  evaluated?: boolean;
218
218
  map?: DecodedMap;
219
219
  meta?: ResolvedResult;
220
- timestamp?: number;
221
220
  /**
222
221
  * Module ids that imports this module
223
222
  */
224
223
  importers?: Set<string>;
225
224
  imports?: Set<string>;
226
225
  }
227
- type FetchResult = ExternalFetchResult | ViteFetchResult;
226
+ type FetchResult = CachedFetchResult | ExternalFetchResult | ViteFetchResult;
227
+ interface CachedFetchResult {
228
+ /**
229
+ * If module cached in the runner, we can just confirm
230
+ * it wasn't invalidated on the server side.
231
+ */
232
+ cache: true;
233
+ }
228
234
  interface ExternalFetchResult {
229
235
  /**
230
236
  * The path to the externalized module starting with file://,
@@ -247,16 +253,21 @@ interface ViteFetchResult {
247
253
  /**
248
254
  * File path of the module on disk.
249
255
  * This will be resolved as import.meta.url/filename
256
+ * Will be equal to `null` for virtual modules
250
257
  */
251
258
  file: string | null;
259
+ /**
260
+ * Invalidate module on the client side.
261
+ */
262
+ invalidate: boolean;
252
263
  }
253
264
  type ResolvedResult = (ExternalFetchResult | ViteFetchResult) & {
254
265
  id: string;
255
266
  };
256
- /**
257
- * @experimental
258
- */
259
- type FetchFunction = (id: string, importer?: string) => Promise<FetchResult>;
267
+ type FetchFunction = (id: string, importer?: string, options?: FetchFunctionOptions) => Promise<FetchResult>;
268
+ interface FetchFunctionOptions {
269
+ cached?: boolean;
270
+ }
260
271
  interface ModuleRunnerHmr {
261
272
  /**
262
273
  * Configure how HMR communicates between the client and the server.
@@ -332,4 +343,4 @@ declare class ESModulesEvaluator implements ModuleEvaluator {
332
343
  runExternalModule(filepath: string): Promise<any>;
333
344
  }
334
345
 
335
- export { ESModulesEvaluator, type FetchFunction, type FetchResult, type HMRConnection, type HMRLogger, type ModuleCache, ModuleCacheMap, type ModuleEvaluator, ModuleRunner, type ModuleRunnerContext, type ModuleRunnerHMRConnection, type ModuleRunnerHmr, type ModuleRunnerImportMeta, type ModuleRunnerOptions, RemoteRunnerTransport, type ResolvedResult, type RunnerTransport, type SSRImportBaseMetadata as SSRImportMetadata, ssrDynamicImportKey, ssrExportAllKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
346
+ export { ESModulesEvaluator, type FetchFunction, type FetchFunctionOptions, type FetchResult, type HMRConnection, type HMRLogger, type ModuleCache, ModuleCacheMap, type ModuleEvaluator, ModuleRunner, type ModuleRunnerContext, type ModuleRunnerHMRConnection, type ModuleRunnerHmr, type ModuleRunnerImportMeta, type ModuleRunnerOptions, RemoteRunnerTransport, type ResolvedResult, type RunnerTransport, type SSRImportBaseMetadata as SSRImportMetadata, ssrDynamicImportKey, ssrExportAllKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };