vite 6.0.0-alpha.1 → 6.0.0-alpha.3

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 { G as getDefaultExportFromCjs } from './dep-gq9_cnPm.js';
1
+ import { g as getDefaultExportFromCjs } from './dep-C7zR1Rh8.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,45 +2,11 @@ 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 { E as colors, x as createLogger, r as resolveConfig, F as Environment } from './chunks/dep-gq9_cnPm.js';
5
+ import { a as colors, c as createLogger } from './chunks/dep-C7zR1Rh8.js';
6
6
  import { VERSION } from './constants.js';
7
- import 'node:fs/promises';
8
- import 'node:url';
9
- import 'node:util';
10
- import 'node:module';
11
- import 'tty';
12
- import 'path';
13
- import 'esbuild';
14
- import 'fs';
15
- import 'assert';
16
- import 'node:child_process';
17
- import 'node:http';
18
- import 'node:https';
19
- import 'util';
20
- import 'net';
21
- import 'url';
22
- import 'http';
23
- import 'stream';
24
- import 'os';
25
- import 'child_process';
26
- import 'node:os';
27
- import 'node:crypto';
28
- import 'node:dns';
29
- import 'node:assert';
30
- import 'node:v8';
31
- import 'module';
32
- import 'node:worker_threads';
33
- import 'rollup/parseAst';
34
- import 'node:events';
35
- import 'crypto';
36
- import 'node:buffer';
37
7
  import 'node:readline';
38
- import 'zlib';
39
- import 'buffer';
40
- import 'https';
41
- import 'tls';
42
- import 'querystring';
43
- import 'node:zlib';
8
+ import 'tty';
9
+ import 'node:url';
44
10
 
45
11
  function toArr(any) {
46
12
  return any == null ? [] : Array.isArray(any) ? any : [any];
@@ -766,7 +732,7 @@ cli
766
732
  filterDuplicateOptions(options);
767
733
  // output structure is preserved even after bundling so require()
768
734
  // is ok here
769
- const { createServer } = await import('./chunks/dep-gq9_cnPm.js').then(function (n) { return n.I; });
735
+ const { createServer } = await import('./chunks/dep-DitPlFWl.js').then(function (n) { return n.C; });
770
736
  try {
771
737
  const server = await createServer({
772
738
  root,
@@ -847,7 +813,7 @@ cli
847
813
  .option('--all', `[boolean] build all environments`)
848
814
  .action(async (root, options) => {
849
815
  filterDuplicateOptions(options);
850
- const { build, createViteBuilder } = await import('./chunks/dep-gq9_cnPm.js').then(function (n) { return n.K; });
816
+ const { build, createViteBuilder } = await import('./chunks/dep-DitPlFWl.js').then(function (n) { return n.E; });
851
817
  const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
852
818
  const config = {
853
819
  root,
@@ -890,23 +856,31 @@ cli
890
856
  .command('optimize [root]', 'pre-bundle dependencies')
891
857
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
892
858
  .action(async (root, options) => {
893
- filterDuplicateOptions(options);
894
- const { optimizeDeps } = await import('./chunks/dep-gq9_cnPm.js').then(function (n) { return n.J; });
859
+ /* TODO: do we need this command?
860
+
861
+ filterDuplicateOptions(options)
862
+ const { optimizeDeps } = await import('./optimizer')
895
863
  try {
896
- const config = await resolveConfig({
897
- root,
898
- base: options.base,
899
- configFile: options.config,
900
- logLevel: options.logLevel,
901
- mode: options.mode,
902
- }, 'serve');
903
- const environment = new Environment('client', config);
904
- await optimizeDeps(environment, options.force, true);
905
- }
906
- catch (e) {
907
- createLogger(options.logLevel).error(colors.red(`error when optimizing deps:\n${e.stack}`), { error: e });
908
- process.exit(1);
909
- }
864
+ const config = await resolveConfig(
865
+ {
866
+ root,
867
+ base: options.base,
868
+ configFile: options.config,
869
+ logLevel: options.logLevel,
870
+ mode: options.mode,
871
+ },
872
+ 'serve',
873
+ )
874
+ const environment = new Environment('client', config)
875
+ await optimizeDeps(environment, options.force, true)
876
+ } catch (e) {
877
+ createLogger(options.logLevel).error(
878
+ colors.red(`error when optimizing deps:\n${e.stack}`),
879
+ { error: e },
880
+ )
881
+ process.exit(1)
882
+ }
883
+ */
910
884
  });
911
885
  // preview
912
886
  cli
@@ -918,7 +892,7 @@ cli
918
892
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
919
893
  .action(async (root, options) => {
920
894
  filterDuplicateOptions(options);
921
- const { preview } = await import('./chunks/dep-gq9_cnPm.js').then(function (n) { return n.L; });
895
+ const { preview } = await import('./chunks/dep-DitPlFWl.js').then(function (n) { return n.F; });
922
896
  try {
923
897
  const server = await preview({
924
898
  root,
@@ -632,6 +632,7 @@ interface Logger {
632
632
  interface LogOptions {
633
633
  clear?: boolean;
634
634
  timestamp?: boolean;
635
+ environment?: string;
635
636
  }
636
637
  interface LogErrorOptions extends LogOptions {
637
638
  error?: Error | RollupError | null;
@@ -787,6 +788,29 @@ type CLIShortcut<Server = ViteDevServer | PreviewServer> = {
787
788
  * https://github.com/preactjs/wmr/blob/main/packages/wmr/src/lib/rollup-plugin-container.js
788
789
  */
789
790
 
791
+ interface BoundedPluginContainer {
792
+ options: InputOptions;
793
+ buildStart(options: InputOptions): Promise<void>;
794
+ resolveId(id: string, importer: string | undefined, options?: {
795
+ attributes?: Record<string, string>;
796
+ custom?: CustomPluginOptions;
797
+ skip?: Set<Plugin>;
798
+ isEntry?: boolean;
799
+ }): Promise<PartialResolvedId | null>;
800
+ transform(code: string, id: string, options?: {
801
+ inMap?: SourceDescription['map'];
802
+ }): Promise<{
803
+ code: string;
804
+ map: SourceMap | {
805
+ mappings: '';
806
+ } | null;
807
+ }>;
808
+ load(id: string, options?: {}): Promise<LoadResult | null>;
809
+ watchChange(id: string, change: {
810
+ event: 'create' | 'update' | 'delete';
811
+ }): Promise<void>;
812
+ close(): Promise<void>;
813
+ }
790
814
  interface PluginContainer {
791
815
  options: InputOptions;
792
816
  buildStart(options: InputOptions): Promise<void>;
@@ -1353,9 +1377,11 @@ declare namespace WebSocket {
1353
1377
  }
1354
1378
 
1355
1379
  declare class Environment {
1380
+ #private;
1356
1381
  name: string;
1357
1382
  config: ResolvedConfig;
1358
1383
  options: ResolvedEnvironmentOptions;
1384
+ get plugins(): BoundedPlugin[];
1359
1385
  get logger(): Logger;
1360
1386
  constructor(name: string, config: ResolvedConfig, options?: ResolvedEnvironmentOptions);
1361
1387
  }
@@ -1370,8 +1396,14 @@ interface FetchModuleOptions {
1370
1396
  */
1371
1397
  declare function fetchModule(environment: DevEnvironment, url: string, importer?: string, options?: FetchModuleOptions): Promise<FetchResult>;
1372
1398
 
1399
+ declare class ScanEnvironment extends Environment {
1400
+ mode: "scan";
1401
+ get pluginContainer(): BoundedPluginContainer;
1402
+ init(): Promise<void>;
1403
+ }
1404
+
1373
1405
  type ExportsData = {
1374
- hasImports: boolean;
1406
+ hasModuleSyntax: boolean;
1375
1407
  exports: readonly string[];
1376
1408
  jsxLoader?: boolean;
1377
1409
  };
@@ -1531,11 +1563,6 @@ interface DepOptimizationMetadata {
1531
1563
  */
1532
1564
  depInfoList: OptimizedDepInfo[];
1533
1565
  }
1534
- /**
1535
- * Scan and optimize dependencies within a project.
1536
- * Used by Vite CLI when running `vite optimize`.
1537
- */
1538
- declare function optimizeDeps(environment: Environment, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>;
1539
1566
 
1540
1567
  declare class RemoteEnvironmentTransport {
1541
1568
  private readonly options;
@@ -1548,16 +1575,19 @@ declare class RemoteEnvironmentTransport {
1548
1575
 
1549
1576
  interface DevEnvironmentSetup {
1550
1577
  hot?: false | HMRChannel;
1578
+ watcher?: FSWatcher;
1551
1579
  options?: EnvironmentOptions;
1552
1580
  runner?: FetchModuleOptions & {
1553
1581
  transport?: RemoteEnvironmentTransport;
1554
1582
  };
1583
+ depsOptimizer?: DepsOptimizer;
1555
1584
  }
1556
1585
  declare class DevEnvironment extends Environment {
1557
1586
  mode: "dev";
1558
1587
  moduleGraph: EnvironmentModuleGraph;
1559
- server: ViteDevServer;
1588
+ watcher?: FSWatcher;
1560
1589
  depsOptimizer?: DepsOptimizer;
1590
+ get pluginContainer(): BoundedPluginContainer;
1561
1591
  /**
1562
1592
  * HMR channel for this environment. If not provided or disabled,
1563
1593
  * it will be a noop channel that does nothing.
@@ -1566,18 +1596,21 @@ declare class DevEnvironment extends Environment {
1566
1596
  * environment.hot.send({ type: 'full-reload' })
1567
1597
  */
1568
1598
  hot: HMRChannel;
1569
- constructor(server: ViteDevServer, name: string, setup?: {
1570
- hot?: false | HMRChannel;
1571
- options?: EnvironmentOptions;
1572
- runner?: FetchModuleOptions & {
1573
- transport?: RemoteEnvironmentTransport;
1574
- };
1575
- depsOptimizer?: DepsOptimizer;
1576
- });
1599
+ constructor(name: string, config: ResolvedConfig, setup?: DevEnvironmentSetup);
1600
+ init(): Promise<void>;
1577
1601
  fetchModule(id: string, importer?: string): Promise<FetchResult>;
1578
1602
  transformRequest(url: string): Promise<TransformResult | null>;
1579
1603
  warmupRequest(url: string): Promise<void>;
1580
1604
  close(): Promise<void>;
1605
+ /**
1606
+ * Calling `await environment.waitForRequestsIdle(id)` will wait until all static imports
1607
+ * are processed after the first transformRequest call. If called from a load or transform
1608
+ * plugin hook, the id needs to be passed as a parameter to avoid deadlocks.
1609
+ * Calling this function after the first static imports section of the module graph has been
1610
+ * processed will resolve immediately.
1611
+ * @experimental
1612
+ */
1613
+ waitForRequestsIdle(ignoredId?: string): Promise<void>;
1581
1614
  }
1582
1615
 
1583
1616
  interface TransformResult {
@@ -1585,6 +1618,7 @@ interface TransformResult {
1585
1618
  map: SourceMap | {
1586
1619
  mappings: '';
1587
1620
  } | null;
1621
+ ssr?: boolean;
1588
1622
  etag?: string;
1589
1623
  deps?: string[];
1590
1624
  dynamicDeps?: string[];
@@ -2023,11 +2057,12 @@ interface ViteDevServer {
2023
2057
  *
2024
2058
  * Always sends a message to at least a WebSocket client. Any third party can
2025
2059
  * add a channel to the broadcaster to process messages
2026
- * @deprecated use `environments.get(id).hot` instead
2060
+ * @deprecated use `environment.hot` instead
2027
2061
  */
2028
2062
  hot: HMRBroadcaster;
2029
2063
  /**
2030
2064
  * Rollup plugin container that can run plugin hooks on a given file
2065
+ * @deprecated use `environment.pluginContainer` instead
2031
2066
  */
2032
2067
  pluginContainer: PluginContainer;
2033
2068
  /**
@@ -2037,7 +2072,7 @@ interface ViteDevServer {
2037
2072
  /**
2038
2073
  * Module graph that tracks the import relationships, url to file mapping
2039
2074
  * and hmr state.
2040
- * @deprecated use environment module graphs instead
2075
+ * @deprecated use `environment.moduleGraph` instead
2041
2076
  */
2042
2077
  moduleGraph: ModuleGraph;
2043
2078
  /**
@@ -2064,6 +2099,7 @@ interface ViteDevServer {
2064
2099
  transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>;
2065
2100
  /**
2066
2101
  * Transform module code into SSR format.
2102
+ * TODO: expose this to any environment?
2067
2103
  */
2068
2104
  ssrTransform(code: string, inMap: SourceMap | {
2069
2105
  mappings: '';
@@ -2124,6 +2160,7 @@ interface ViteDevServer {
2124
2160
  * passed as a parameter to avoid deadlocks. Calling this function after the first
2125
2161
  * static imports section of the module graph has been processed will resolve immediately.
2126
2162
  * @experimental
2163
+ * @deprecated use environment.waitForRequestsIdle()
2127
2164
  */
2128
2165
  waitForRequestsIdle: (ignoredId?: string) => Promise<void>;
2129
2166
  }
@@ -2815,7 +2852,7 @@ interface BuildEnvironmentOptions {
2815
2852
  /**
2816
2853
  * create the Build Environment instance
2817
2854
  */
2818
- createEnvironment?: (builder: ViteBuilder, name: string) => Promise<BuildEnvironment> | BuildEnvironment;
2855
+ createEnvironment?: (name: string, config: ResolvedConfig) => Promise<BuildEnvironment> | BuildEnvironment;
2819
2856
  }
2820
2857
  interface BuildOptions extends BuildEnvironmentOptions {
2821
2858
  /**
@@ -2892,8 +2929,7 @@ type RenderBuiltAssetUrl = (filename: string, type: {
2892
2929
  } | undefined;
2893
2930
  declare class BuildEnvironment extends Environment {
2894
2931
  mode: "build";
2895
- builder: ViteBuilder;
2896
- constructor(builder: ViteBuilder, name: string, setup?: {
2932
+ constructor(name: string, config: ResolvedConfig, setup?: {
2897
2933
  options?: EnvironmentOptions;
2898
2934
  });
2899
2935
  }
@@ -3195,14 +3231,77 @@ type IndexHtmlTransform = IndexHtmlTransformHook | {
3195
3231
  * or a build environment. Plugins can use this.environment.mode === 'dev' to
3196
3232
  * check if they have access to dev specific APIs.
3197
3233
  */
3198
- type PluginEnvironment = DevEnvironment | BuildEnvironment;
3234
+ type PluginEnvironment = DevEnvironment | BuildEnvironment | ScanEnvironment;
3199
3235
  interface PluginContext extends rollup.PluginContext {
3200
3236
  environment?: PluginEnvironment;
3201
3237
  }
3238
+ interface ResolveIdPluginContext extends rollup.PluginContext {
3239
+ environment?: PluginEnvironment;
3240
+ }
3202
3241
  interface TransformPluginContext extends rollup.TransformPluginContext {
3203
3242
  environment?: PluginEnvironment;
3204
3243
  }
3205
- interface Plugin<A = any> extends rollup.Plugin<A> {
3244
+ /**
3245
+ * There are two types of plugins in Vite. App plugins and environment plugins.
3246
+ * Environment Plugins are defined by a constructor function that will be called
3247
+ * once per each environment allowing users to have completely different plugins
3248
+ * for each of them. The constructor gets the resolved environment after the server
3249
+ * and builder has already been created simplifying config access and cache
3250
+ * managementfor for environment specific plugins.
3251
+ * Environment Plugins are closer to regular rollup plugins. They can't define
3252
+ * app level hooks (like config, configResolved, configureServer, etc).
3253
+ */
3254
+ interface BasePlugin<A = any> extends rollup.Plugin<A> {
3255
+ /**
3256
+ * Perform custom handling of HMR updates.
3257
+ * The handler receives a context containing changed filename, timestamp, a
3258
+ * list of modules affected by the file change, and the dev server instance.
3259
+ *
3260
+ * - The hook can return a filtered list of modules to narrow down the update.
3261
+ * e.g. for a Vue SFC, we can narrow down the part to update by comparing
3262
+ * the descriptors.
3263
+ *
3264
+ * - The hook can also return an empty array and then perform custom updates
3265
+ * by sending a custom hmr payload via server.hot.send().
3266
+ *
3267
+ * - If the hook doesn't return a value, the hmr update will be performed as
3268
+ * normal.
3269
+ */
3270
+ hotUpdate?: ObjectHook<(this: void, ctx: HotUpdateContext) => Array<EnvironmentModuleNode> | void | Promise<Array<EnvironmentModuleNode> | void>>;
3271
+ /**
3272
+ * extend hooks with ssr flag
3273
+ */
3274
+ resolveId?: ObjectHook<(this: ResolveIdPluginContext, source: string, importer: string | undefined, options: {
3275
+ attributes: Record<string, string>;
3276
+ custom?: CustomPluginOptions;
3277
+ /**
3278
+ * @deprecated use this.environment
3279
+ */
3280
+ ssr?: boolean;
3281
+ isEntry: boolean;
3282
+ }) => Promise<ResolveIdResult> | ResolveIdResult>;
3283
+ load?: ObjectHook<(this: PluginContext, id: string, options?: {
3284
+ /**
3285
+ * @deprecated use this.environment
3286
+ */
3287
+ ssr?: boolean;
3288
+ }) => Promise<LoadResult> | LoadResult>;
3289
+ transform?: ObjectHook<(this: TransformPluginContext, code: string, id: string, options?: {
3290
+ /**
3291
+ * @deprecated use this.environment
3292
+ */
3293
+ ssr?: boolean;
3294
+ }) => Promise<rollup.TransformResult> | rollup.TransformResult>;
3295
+ }
3296
+ type BoundedPlugin<A = any> = BasePlugin<A>;
3297
+ interface Plugin<A = any> extends BasePlugin<A> {
3298
+ /**
3299
+ * Spawn the plugin into multiple plugins based on the environment.
3300
+ * This hook is called when the config has already been resolved, allowing to
3301
+ * create per environment plugin pipelines or easily inject plugins for a
3302
+ * only specific environments.
3303
+ */
3304
+ create?: (environment: PluginEnvironment) => BoundedPluginOption;
3206
3305
  /**
3207
3306
  * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering
3208
3307
  * is still subject to the `order` property in the hook object.
@@ -3287,51 +3386,15 @@ interface Plugin<A = any> extends rollup.Plugin<A> {
3287
3386
  * with the mixed client and ssr moduleGraph. Use hotUpdate instead
3288
3387
  */
3289
3388
  handleHotUpdate?: ObjectHook<(this: void, ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>;
3290
- /**
3291
- * Perform custom handling of HMR updates.
3292
- * The handler receives a context containing changed filename, timestamp, a
3293
- * list of modules affected by the file change, and the dev server instance.
3294
- *
3295
- * - The hook can return a filtered list of modules to narrow down the update.
3296
- * e.g. for a Vue SFC, we can narrow down the part to update by comparing
3297
- * the descriptors.
3298
- *
3299
- * - The hook can also return an empty array and then perform custom updates
3300
- * by sending a custom hmr payload via server.hot.send().
3301
- *
3302
- * - If the hook doesn't return a value, the hmr update will be performed as
3303
- * normal.
3304
- */
3305
- hotUpdate?: ObjectHook<(this: void, ctx: HotUpdateContext) => Array<EnvironmentModuleNode> | void | Promise<Array<EnvironmentModuleNode> | void>>;
3306
- /**
3307
- * extend hooks with ssr flag
3308
- */
3309
- resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: {
3310
- attributes: Record<string, string>;
3311
- custom?: CustomPluginOptions;
3312
- /**
3313
- * @deprecated use this.environment
3314
- */
3315
- ssr?: boolean;
3316
- isEntry: boolean;
3317
- }) => Promise<ResolveIdResult> | ResolveIdResult>;
3318
- load?: ObjectHook<(this: PluginContext, id: string, options?: {
3319
- /**
3320
- * @deprecated use this.environment
3321
- */
3322
- ssr?: boolean;
3323
- }) => Promise<LoadResult> | LoadResult>;
3324
- transform?: ObjectHook<(this: TransformPluginContext, code: string, id: string, options?: {
3325
- /**
3326
- * @deprecated use this.environment
3327
- */
3328
- ssr?: boolean;
3329
- }) => Promise<rollup.TransformResult> | rollup.TransformResult>;
3330
3389
  }
3331
3390
  type HookHandler<T> = T extends ObjectHook<infer H> ? H : T;
3332
3391
  type PluginWithRequiredHook<K extends keyof Plugin> = Plugin & {
3333
3392
  [P in K]: NonNullable<Plugin[P]>;
3334
3393
  };
3394
+ type MaybeBoundedPlugin = BoundedPlugin | false | null | undefined;
3395
+ type BoundedPluginOption = MaybeBoundedPlugin | BoundedPluginOption[] | Promise<MaybeBoundedPlugin | BoundedPluginOption[]>;
3396
+ type MaybePlugin = Plugin | false | null | undefined;
3397
+ type PluginOption = MaybePlugin | PluginOption[] | Promise<MaybePlugin | PluginOption[]>;
3335
3398
 
3336
3399
  interface JsonOptions {
3337
3400
  /**
@@ -3443,17 +3506,14 @@ declare function defineConfig(config: UserConfig): UserConfig;
3443
3506
  declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
3444
3507
  declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
3445
3508
  declare function defineConfig(config: UserConfigExport): UserConfigExport;
3446
- type PluginOption = Plugin | false | null | undefined | PluginOption[] | Promise<Plugin | false | null | undefined | PluginOption[]>;
3447
3509
  interface DevEnvironmentOptions {
3448
3510
  /**
3449
- * The files to be pre-transformed. Supports glob patterns.
3511
+ * Files tßo be pre-transformed. Supports glob patterns.
3450
3512
  */
3451
- warmup?: {
3452
- files: string[];
3453
- };
3513
+ warmup?: string[];
3454
3514
  /**
3455
3515
  * Pre-transform known direct imports
3456
- * @default true
3516
+ * defaults to true for the client environment, false for the rest
3457
3517
  */
3458
3518
  preTransformRequests?: boolean;
3459
3519
  /**
@@ -3481,7 +3541,7 @@ interface DevEnvironmentOptions {
3481
3541
  /**
3482
3542
  * create the Dev Environment instance
3483
3543
  */
3484
- createEnvironment?: (server: ViteDevServer, name: string) => Promise<DevEnvironment> | DevEnvironment;
3544
+ createEnvironment?: (name: string, config: ResolvedConfig) => Promise<DevEnvironment> | DevEnvironment;
3485
3545
  /**
3486
3546
  * For environments that support a full-reload, like the client, we can short-circuit when
3487
3547
  * restarting the server throwing early to stop processing current files. We avoided this for
@@ -3489,9 +3549,15 @@ interface DevEnvironmentOptions {
3489
3549
  * @experimental
3490
3550
  */
3491
3551
  recoverable?: boolean;
3552
+ /**
3553
+ * For environments associated with a module runner.
3554
+ * By default it is true for the client environment and false for non-client environments.
3555
+ * This option can also be used instead of the removed config.experimental.skipSsrTransform.
3556
+ */
3557
+ moduleRunnerTransform?: boolean;
3492
3558
  }
3493
3559
  type ResolvedDevEnvironmentOptions = Required<Omit<DevEnvironmentOptions, 'createEnvironment'>> & {
3494
- createEnvironment: ((server: ViteDevServer, name: string) => Promise<DevEnvironment> | DevEnvironment) | undefined;
3560
+ createEnvironment: ((name: string, config: ResolvedConfig) => Promise<DevEnvironment> | DevEnvironment) | undefined;
3495
3561
  };
3496
3562
  type EnvironmentResolveOptions = ResolveOptions & {
3497
3563
  alias?: AliasOptions;
@@ -3507,6 +3573,13 @@ interface SharedEnvironmentOptions {
3507
3573
  */
3508
3574
  nodeCompatible?: boolean;
3509
3575
  webCompatible?: boolean;
3576
+ /**
3577
+ * Should Vite inject timestamp if module is invalidated
3578
+ * Disabling this will break built-in HMR support
3579
+ * @experimental
3580
+ * @default true
3581
+ */
3582
+ injectInvalidationTimestamp?: boolean;
3510
3583
  }
3511
3584
  interface EnvironmentOptions extends SharedEnvironmentOptions {
3512
3585
  /**
@@ -3523,6 +3596,7 @@ type ResolvedEnvironmentOptions = {
3523
3596
  resolve: ResolvedEnvironmentResolveOptions;
3524
3597
  nodeCompatible: boolean;
3525
3598
  webCompatible: boolean;
3599
+ injectInvalidationTimestamp: boolean;
3526
3600
  dev: ResolvedDevEnvironmentOptions;
3527
3601
  build: ResolvedBuildEnvironmentOptions;
3528
3602
  };
@@ -3798,7 +3872,7 @@ declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, c
3798
3872
 
3799
3873
  declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
3800
3874
 
3801
- declare function createNodeDevEnvironment(server: ViteDevServer, name: string, options?: DevEnvironmentSetup): DevEnvironment;
3875
+ declare function createNodeDevEnvironment(name: string, config: ResolvedConfig, options?: DevEnvironmentSetup): DevEnvironment;
3802
3876
 
3803
3877
  /**
3804
3878
  * @experimental
@@ -3812,15 +3886,15 @@ interface ServerModuleRunnerOptions extends Omit<ModuleRunnerOptions, 'root' | '
3812
3886
  logger?: ModuleRunnerHmr['logger'];
3813
3887
  };
3814
3888
  /**
3815
- * Provide a custom module runner. This controls how the code is executed.
3889
+ * Provide a custom module evaluator. This controls how the code is executed.
3816
3890
  */
3817
- runner?: ModuleEvaluator;
3891
+ evaluator?: ModuleEvaluator;
3818
3892
  }
3819
3893
  /**
3820
3894
  * Create an instance of the Vite SSR runtime that support HMR.
3821
3895
  * @experimental
3822
3896
  */
3823
- declare function createServerModuleRunner(environment: DevEnvironment, options?: ServerModuleRunnerOptions): ModuleRunner;
3897
+ declare function createServerModuleRunner(server: ViteDevServer, environment: DevEnvironment, options?: ServerModuleRunnerOptions): ModuleRunner;
3824
3898
 
3825
3899
  /**
3826
3900
  * The connector class to establish HMR communication between the server and the Vite runtime.
@@ -3888,6 +3962,7 @@ declare function searchForWorkspaceRoot(current: string, root?: string): string;
3888
3962
 
3889
3963
  /**
3890
3964
  * Check if the url is allowed to be served, via the `server.fs` config.
3965
+ * @deprecate use isFileLoadingAllowed
3891
3966
  */
3892
3967
  declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
3893
3968
 
@@ -3907,4 +3982,4 @@ interface ManifestChunk {
3907
3982
  dynamicImports?: string[];
3908
3983
  }
3909
3984
 
3910
- export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, 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 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 ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createFilter, createLogger, createNodeDevEnvironment, createServer, createServerModuleRunner, createViteBuilder, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };
3985
+ export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentOptions, type DevEnvironmentSetup, type ESBuildOptions, type ESBuildTransformResult, EnvironmentModuleGraph, EnvironmentModuleNode, type ExperimentalOptions, type ExportsData, FSWatcher, type FetchModuleOptions, type FileSystemServeOptions, type FilterPattern, type HMRBroadcaster, type HMRBroadcasterClient, type HMRChannel, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotUpdateContext, type HtmlTagDescriptor, HttpProxy, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InlineConfig, type InternalResolveOptions, type JsonOptions, type LegacyOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, ModuleGraph, ModuleNode, type ModulePreloadOptions, type OptimizedDepInfo, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, RemoteEnvironmentTransport, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type SSROptions, type SSRTarget, type SendOptions, type ServerHMRChannel, ServerHMRConnector, type ServerHook, type ServerModuleRunnerOptions, type ServerOptions, SplitVendorChunkCache, type SsrDepOptimizationOptions, Terser, type TerserOptions, type TransformOptions, type TransformResult, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteBuilder, type ViteDevServer, type WatchOptions, WebSocket, WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, WebSocketServer, build, buildErrorMessage, createFilter, createLogger, createNodeDevEnvironment, createServer, createServerModuleRunner, createViteBuilder, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileServingAllowed, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, searchForWorkspaceRoot, send, sortUserPlugins, splitVendorChunk, splitVendorChunkPlugin, transformWithEsbuild, VERSION as version };