vite 5.2.7 → 6.0.0-alpha.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.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { PluginHooks, RollupError, SourceMap, ModuleInfo, PartialResolvedId, InputOptions, CustomPluginOptions, SourceDescription, LoadResult, RollupOptions, WatcherOptions, InputOption, ModuleFormat, RollupOutput, RollupWatcher, SourceMapInput, ExistingRawSourceMap, OutputBundle, OutputChunk, ObjectHook, PluginContext, ResolveIdResult, TransformPluginContext, GetManualChunk } from 'rollup';
2
+ import { PluginHooks, RollupError, InputOptions, CustomPluginOptions, PartialResolvedId, SourceDescription, SourceMap, LoadResult, ModuleInfo, RollupOptions, WatcherOptions, InputOption, ModuleFormat, RollupOutput, RollupWatcher, 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,21 +15,19 @@ 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 { F as FetchResult, H as HMRLogger } from './types.d-aGj9QkWt.js';
19
- export { a as FetchFunction } from './types.d-aGj9QkWt.js';
20
18
  import { SecureContextOptions } from 'node:tls';
21
19
  import { ZlibOptions } from 'node:zlib';
22
20
  import { HMRPayload, CustomPayload } from '../../types/hmrPayload.js';
23
21
  export { ConnectedPayload, CustomPayload, ErrorPayload, FullReloadPayload, HMRPayload, PrunePayload, Update, UpdatePayload } from '../../types/hmrPayload.js';
24
22
  import { InferCustomEventPayload } from '../../types/customEvent.js';
25
23
  export { CustomEventMap, InferCustomEventPayload, InvalidatePayload } from '../../types/customEvent.js';
26
- import { TransformOptions as esbuild_TransformOptions, TransformResult as esbuild_TransformResult, BuildOptions as esbuild_BuildOptions } from 'esbuild';
24
+ import { FetchResult, ModuleRunnerOptions, ModuleRunnerHMRConnection, ModuleRunnerHmr, ModuleEvaluator, ModuleRunner } from 'vite/module-runner';
25
+ export { FetchFunction, FetchResult } from 'vite/module-runner';
26
+ import { BuildOptions as esbuild_BuildOptions, TransformOptions as esbuild_TransformOptions, TransformResult as esbuild_TransformResult } from 'esbuild';
27
27
  export { TransformOptions as EsbuildTransformOptions, version as esbuildVersion } from 'esbuild';
28
28
  import * as PostCSS from 'postcss';
29
- import { ViteRuntimeOptions, ViteModuleRunner, ViteRuntime, HMRRuntimeConnection } from 'vite/runtime';
30
29
  export { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownAsTypeMap } from '../../types/importGlob.js';
31
30
  export { ChunkMetadata } from '../../types/metadata.js';
32
- import '../../types/hot.js';
33
31
 
34
32
  interface Alias {
35
33
  find: string | RegExp
@@ -784,90 +782,6 @@ type CLIShortcut<Server = ViteDevServer | PreviewServer> = {
784
782
  action?(server: Server): void | Promise<void>;
785
783
  };
786
784
 
787
- interface TransformResult {
788
- code: string;
789
- map: SourceMap | {
790
- mappings: '';
791
- } | null;
792
- etag?: string;
793
- deps?: string[];
794
- dynamicDeps?: string[];
795
- }
796
- interface TransformOptions {
797
- ssr?: boolean;
798
- html?: boolean;
799
- }
800
-
801
- declare class ModuleNode {
802
- /**
803
- * Public served url path, starts with /
804
- */
805
- url: string;
806
- /**
807
- * Resolved file system path + query
808
- */
809
- id: string | null;
810
- file: string | null;
811
- type: 'js' | 'css';
812
- info?: ModuleInfo;
813
- meta?: Record<string, any>;
814
- importers: Set<ModuleNode>;
815
- clientImportedModules: Set<ModuleNode>;
816
- ssrImportedModules: Set<ModuleNode>;
817
- acceptedHmrDeps: Set<ModuleNode>;
818
- acceptedHmrExports: Set<string> | null;
819
- importedBindings: Map<string, Set<string>> | null;
820
- isSelfAccepting?: boolean;
821
- transformResult: TransformResult | null;
822
- ssrTransformResult: TransformResult | null;
823
- ssrModule: Record<string, any> | null;
824
- ssrError: Error | null;
825
- lastHMRTimestamp: number;
826
- lastInvalidationTimestamp: number;
827
- /**
828
- * @param setIsSelfAccepting - set `false` to set `isSelfAccepting` later. e.g. #7870
829
- */
830
- constructor(url: string, setIsSelfAccepting?: boolean);
831
- get importedModules(): Set<ModuleNode>;
832
- }
833
- type ResolvedUrl = [
834
- url: string,
835
- resolvedId: string,
836
- meta: object | null | undefined
837
- ];
838
- declare class ModuleGraph {
839
- private resolveId;
840
- urlToModuleMap: Map<string, ModuleNode>;
841
- idToModuleMap: Map<string, ModuleNode>;
842
- etagToModuleMap: Map<string, ModuleNode>;
843
- fileToModulesMap: Map<string, Set<ModuleNode>>;
844
- safeModulesPath: Set<string>;
845
- constructor(resolveId: (url: string, ssr: boolean) => Promise<PartialResolvedId | null>);
846
- getModuleByUrl(rawUrl: string, ssr?: boolean): Promise<ModuleNode | undefined>;
847
- getModuleById(id: string): ModuleNode | undefined;
848
- getModulesByFile(file: string): Set<ModuleNode> | undefined;
849
- onFileChange(file: string): void;
850
- onFileDelete(file: string): void;
851
- invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number, isHmr?: boolean,
852
- ): void;
853
- invalidateAll(): void;
854
- /**
855
- * Update the module graph based on a module's updated imports information
856
- * If there are dependencies that no longer have any importers, they are
857
- * returned as a Set.
858
- *
859
- * @param staticImportedUrls Subset of `importedModules` where they're statically imported in code.
860
- * This is only used for soft invalidations so `undefined` is fine but may cause more runtime processing.
861
- */
862
- updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | ModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean, ssr?: boolean,
863
- ): Promise<Set<ModuleNode> | undefined>;
864
- ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>;
865
- createFileOnlyEntry(file: string): ModuleNode;
866
- resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
867
- updateModuleTransformResult(mod: ModuleNode, result: TransformResult | null, ssr: boolean): void;
868
- getModuleByEtag(etag: string): ModuleNode | undefined;
869
- }
870
-
871
785
  /**
872
786
  * This file is refactored into TypeScript based on
873
787
  * https://github.com/preactjs/wmr/blob/main/packages/wmr/src/lib/rollup-plugin-container.js
@@ -875,18 +789,19 @@ declare class ModuleGraph {
875
789
 
876
790
  interface PluginContainer {
877
791
  options: InputOptions;
878
- getModuleInfo(id: string): ModuleInfo | null;
879
792
  buildStart(options: InputOptions): Promise<void>;
880
- resolveId(id: string, importer?: string, options?: {
793
+ resolveId(id: string, importer: string | undefined, options?: {
881
794
  attributes?: Record<string, string>;
882
795
  custom?: CustomPluginOptions;
883
796
  skip?: Set<Plugin>;
884
797
  ssr?: boolean;
798
+ environment?: PluginEnvironment;
885
799
  isEntry?: boolean;
886
800
  }): Promise<PartialResolvedId | null>;
887
801
  transform(code: string, id: string, options?: {
888
802
  inMap?: SourceDescription['map'];
889
803
  ssr?: boolean;
804
+ environment?: PluginEnvironment;
890
805
  }): Promise<{
891
806
  code: string;
892
807
  map: SourceMap | {
@@ -895,6 +810,7 @@ interface PluginContainer {
895
810
  }>;
896
811
  load(id: string, options?: {
897
812
  ssr?: boolean;
813
+ environment?: PluginEnvironment;
898
814
  }): Promise<LoadResult | null>;
899
815
  watchChange(id: string, change: {
900
816
  event: 'create' | 'update' | 'delete';
@@ -1429,12 +1345,408 @@ declare namespace WebSocket {
1429
1345
  const WebSocket: typeof WebSocketAlias
1430
1346
  interface WebSocket extends WebSocketAlias {} // tslint:disable-line no-empty-interface
1431
1347
 
1432
- // WebSocket stream
1433
- function createWebSocketStream(
1434
- websocket: WebSocket,
1435
- options?: DuplexOptions,
1436
- ): Duplex
1348
+ // WebSocket stream
1349
+ function createWebSocketStream(
1350
+ websocket: WebSocket,
1351
+ options?: DuplexOptions,
1352
+ ): Duplex
1353
+ }
1354
+
1355
+ declare class Environment {
1356
+ name: string;
1357
+ config: ResolvedConfig;
1358
+ options: ResolvedEnvironmentOptions;
1359
+ get logger(): Logger;
1360
+ constructor(name: string, config: ResolvedConfig, options?: ResolvedEnvironmentOptions);
1361
+ }
1362
+
1363
+ interface FetchModuleOptions {
1364
+ inlineSourceMap?: boolean;
1365
+ processSourceMap?<T extends NonNullable<TransformResult['map']>>(map: T): T;
1366
+ }
1367
+ /**
1368
+ * Fetch module information for Vite runner.
1369
+ * @experimental
1370
+ */
1371
+ declare function fetchModule(environment: DevEnvironment, url: string, importer?: string, options?: FetchModuleOptions): Promise<FetchResult>;
1372
+
1373
+ type ExportsData = {
1374
+ hasImports: boolean;
1375
+ exports: readonly string[];
1376
+ jsxLoader?: boolean;
1377
+ };
1378
+ interface DepsOptimizer {
1379
+ init: () => Promise<void>;
1380
+ metadata: DepOptimizationMetadata;
1381
+ scanProcessing?: Promise<void>;
1382
+ registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
1383
+ run: () => void;
1384
+ isOptimizedDepFile: (id: string) => boolean;
1385
+ isOptimizedDepUrl: (url: string) => boolean;
1386
+ getOptimizedDepId: (depInfo: OptimizedDepInfo) => string;
1387
+ close: () => Promise<void>;
1388
+ options: DepOptimizationOptions;
1389
+ }
1390
+ interface DepOptimizationConfig {
1391
+ /**
1392
+ * Force optimize listed dependencies (must be resolvable import paths,
1393
+ * cannot be globs).
1394
+ */
1395
+ include?: string[];
1396
+ /**
1397
+ * Do not optimize these dependencies (must be resolvable import paths,
1398
+ * cannot be globs).
1399
+ */
1400
+ exclude?: string[];
1401
+ /**
1402
+ * Forces ESM interop when importing these dependencies. Some legacy
1403
+ * packages advertise themselves as ESM but use `require` internally
1404
+ * @experimental
1405
+ */
1406
+ needsInterop?: string[];
1407
+ /**
1408
+ * Options to pass to esbuild during the dep scanning and optimization
1409
+ *
1410
+ * Certain options are omitted since changing them would not be compatible
1411
+ * with Vite's dep optimization.
1412
+ *
1413
+ * - `external` is also omitted, use Vite's `optimizeDeps.exclude` option
1414
+ * - `plugins` are merged with Vite's dep plugin
1415
+ *
1416
+ * https://esbuild.github.io/api
1417
+ */
1418
+ esbuildOptions?: Omit<esbuild_BuildOptions, 'bundle' | 'entryPoints' | 'external' | 'write' | 'watch' | 'outdir' | 'outfile' | 'outbase' | 'outExtension' | 'metafile'>;
1419
+ /**
1420
+ * List of file extensions that can be optimized. A corresponding esbuild
1421
+ * plugin must exist to handle the specific extension.
1422
+ *
1423
+ * By default, Vite can optimize `.mjs`, `.js`, `.ts`, and `.mts` files. This option
1424
+ * allows specifying additional extensions.
1425
+ *
1426
+ * @experimental
1427
+ */
1428
+ extensions?: string[];
1429
+ /**
1430
+ * Deps optimization during build was removed in Vite 5.1. This option is
1431
+ * now redundant and will be removed in a future version. Switch to using
1432
+ * `optimizeDeps.noDiscovery` and an empty or undefined `optimizeDeps.include`.
1433
+ * true or 'dev' disables the optimizer, false or 'build' leaves it enabled.
1434
+ * @default 'build'
1435
+ * @deprecated
1436
+ * @experimental
1437
+ */
1438
+ disabled?: boolean | 'build' | 'dev';
1439
+ /**
1440
+ * Automatic dependency discovery. When `noDiscovery` is true, only dependencies
1441
+ * listed in `include` will be optimized. The scanner isn't run for cold start
1442
+ * in this case. CJS-only dependencies must be present in `include` during dev.
1443
+ * @default false
1444
+ * @experimental
1445
+ */
1446
+ noDiscovery?: boolean;
1447
+ /**
1448
+ * When enabled, it will hold the first optimized deps results until all static
1449
+ * imports are crawled on cold start. This avoids the need for full-page reloads
1450
+ * when new dependencies are discovered and they trigger the generation of new
1451
+ * common chunks. If all dependencies are found by the scanner plus the explicitely
1452
+ * defined ones in `include`, it is better to disable this option to let the
1453
+ * browser process more requests in parallel.
1454
+ * @default true
1455
+ * @experimental
1456
+ */
1457
+ holdUntilCrawlEnd?: boolean;
1458
+ }
1459
+ type DepOptimizationOptions = DepOptimizationConfig & {
1460
+ /**
1461
+ * By default, Vite will crawl your `index.html` to detect dependencies that
1462
+ * need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
1463
+ * will crawl those entry points instead.
1464
+ *
1465
+ * If neither of these fit your needs, you can specify custom entries using
1466
+ * this option - the value should be a fast-glob pattern or array of patterns
1467
+ * (https://github.com/mrmlnc/fast-glob#basic-syntax) that are relative from
1468
+ * vite project root. This will overwrite default entries inference.
1469
+ */
1470
+ entries?: string | string[];
1471
+ /**
1472
+ * Force dep pre-optimization regardless of whether deps have changed.
1473
+ * @experimental
1474
+ */
1475
+ force?: boolean;
1476
+ };
1477
+ interface OptimizedDepInfo {
1478
+ id: string;
1479
+ file: string;
1480
+ src?: string;
1481
+ needsInterop?: boolean;
1482
+ browserHash?: string;
1483
+ fileHash?: string;
1484
+ /**
1485
+ * During optimization, ids can still be resolved to their final location
1486
+ * but the bundles may not yet be saved to disk
1487
+ */
1488
+ processing?: Promise<void>;
1489
+ /**
1490
+ * ExportData cache, discovered deps will parse the src entry to get exports
1491
+ * data used both to define if interop is needed and when pre-bundling
1492
+ */
1493
+ exportsData?: Promise<ExportsData>;
1494
+ }
1495
+ interface DepOptimizationMetadata {
1496
+ /**
1497
+ * The main hash is determined by user config and dependency lockfiles.
1498
+ * This is checked on server startup to avoid unnecessary re-bundles.
1499
+ */
1500
+ hash: string;
1501
+ /**
1502
+ * This hash is determined by dependency lockfiles.
1503
+ * This is checked on server startup to avoid unnecessary re-bundles.
1504
+ */
1505
+ lockfileHash: string;
1506
+ /**
1507
+ * This hash is determined by user config.
1508
+ * This is checked on server startup to avoid unnecessary re-bundles.
1509
+ */
1510
+ configHash: string;
1511
+ /**
1512
+ * The browser hash is determined by the main hash plus additional dependencies
1513
+ * discovered at runtime. This is used to invalidate browser requests to
1514
+ * optimized deps.
1515
+ */
1516
+ browserHash: string;
1517
+ /**
1518
+ * Metadata for each already optimized dependency
1519
+ */
1520
+ optimized: Record<string, OptimizedDepInfo>;
1521
+ /**
1522
+ * Metadata for non-entry optimized chunks and dynamic imports
1523
+ */
1524
+ chunks: Record<string, OptimizedDepInfo>;
1525
+ /**
1526
+ * Metadata for each newly discovered dependency after processing
1527
+ */
1528
+ discovered: Record<string, OptimizedDepInfo>;
1529
+ /**
1530
+ * OptimizedDepInfo list
1531
+ */
1532
+ depInfoList: OptimizedDepInfo[];
1533
+ }
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
+
1540
+ declare class RemoteEnvironmentTransport {
1541
+ private readonly options;
1542
+ constructor(options: {
1543
+ send: (data: any) => void;
1544
+ onMessage: (handler: (data: any) => void) => void;
1545
+ });
1546
+ register(environment: DevEnvironment): void;
1547
+ }
1548
+
1549
+ interface DevEnvironmentSetup {
1550
+ hot?: false | HMRChannel;
1551
+ options?: EnvironmentOptions;
1552
+ runner?: FetchModuleOptions & {
1553
+ transport?: RemoteEnvironmentTransport;
1554
+ };
1555
+ }
1556
+ declare class DevEnvironment extends Environment {
1557
+ mode: "dev";
1558
+ moduleGraph: EnvironmentModuleGraph;
1559
+ server: ViteDevServer;
1560
+ depsOptimizer?: DepsOptimizer;
1561
+ /**
1562
+ * HMR channel for this environment. If not provided or disabled,
1563
+ * it will be a noop channel that does nothing.
1564
+ *
1565
+ * @example
1566
+ * environment.hot.send({ type: 'full-reload' })
1567
+ */
1568
+ 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
+ });
1577
+ fetchModule(id: string, importer?: string): Promise<FetchResult>;
1578
+ transformRequest(url: string): Promise<TransformResult | null>;
1579
+ warmupRequest(url: string): Promise<void>;
1580
+ close(): Promise<void>;
1581
+ }
1582
+
1583
+ interface TransformResult {
1584
+ code: string;
1585
+ map: SourceMap | {
1586
+ mappings: '';
1587
+ } | null;
1588
+ etag?: string;
1589
+ deps?: string[];
1590
+ dynamicDeps?: string[];
1591
+ }
1592
+ interface TransformOptions {
1593
+ /**
1594
+ * @deprecated infered from environment
1595
+ */
1596
+ ssr?: boolean;
1597
+ /**
1598
+ * TODO: should this be internal?
1599
+ */
1600
+ html?: boolean;
1601
+ }
1602
+
1603
+ declare class EnvironmentModuleNode {
1604
+ environment: string;
1605
+ /**
1606
+ * Public served url path, starts with /
1607
+ */
1608
+ url: string;
1609
+ /**
1610
+ * Resolved file system path + query
1611
+ */
1612
+ id: string | null;
1613
+ file: string | null;
1614
+ type: 'js' | 'css';
1615
+ info?: ModuleInfo;
1616
+ meta?: Record<string, any>;
1617
+ importers: Set<EnvironmentModuleNode>;
1618
+ importedModules: Set<EnvironmentModuleNode>;
1619
+ acceptedHmrDeps: Set<EnvironmentModuleNode>;
1620
+ acceptedHmrExports: Set<string> | null;
1621
+ importedBindings: Map<string, Set<string>> | null;
1622
+ isSelfAccepting?: boolean;
1623
+ transformResult: TransformResult | null;
1624
+ ssrModule: Record<string, any> | null;
1625
+ ssrError: Error | null;
1626
+ lastHMRTimestamp: number;
1627
+ lastInvalidationTimestamp: number;
1628
+ /**
1629
+ * @param setIsSelfAccepting - set `false` to set `isSelfAccepting` later. e.g. #7870
1630
+ */
1631
+ constructor(url: string, environment: string, setIsSelfAccepting?: boolean);
1632
+ }
1633
+ type ResolvedUrl = [
1634
+ url: string,
1635
+ resolvedId: string,
1636
+ meta: object | null | undefined
1637
+ ];
1638
+ declare class EnvironmentModuleGraph {
1639
+ environment: string;
1640
+ urlToModuleMap: Map<string, EnvironmentModuleNode>;
1641
+ idToModuleMap: Map<string, EnvironmentModuleNode>;
1642
+ etagToModuleMap: Map<string, EnvironmentModuleNode>;
1643
+ fileToModulesMap: Map<string, Set<EnvironmentModuleNode>>;
1644
+ constructor(environment: string, resolveId: (url: string) => Promise<PartialResolvedId | null>);
1645
+ getModuleByUrl(rawUrl: string): Promise<EnvironmentModuleNode | undefined>;
1646
+ getModuleById(id: string): EnvironmentModuleNode | undefined;
1647
+ getModulesByFile(file: string): Set<EnvironmentModuleNode> | undefined;
1648
+ onFileChange(file: string): void;
1649
+ onFileDelete(file: string): void;
1650
+ invalidateModule(mod: EnvironmentModuleNode, seen?: Set<EnvironmentModuleNode>, timestamp?: number, isHmr?: boolean,
1651
+ ): void;
1652
+ invalidateAll(): void;
1653
+ /**
1654
+ * Update the module graph based on a module's updated imports information
1655
+ * If there are dependencies that no longer have any importers, they are
1656
+ * returned as a Set.
1657
+ *
1658
+ * @param staticImportedUrls Subset of `importedModules` where they're statically imported in code.
1659
+ * This is only used for soft invalidations so `undefined` is fine but may cause more runtime processing.
1660
+ */
1661
+ updateModuleInfo(mod: EnvironmentModuleNode, importedModules: Set<string | EnvironmentModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | EnvironmentModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean,
1662
+ ): Promise<Set<EnvironmentModuleNode> | undefined>;
1663
+ ensureEntryFromUrl(rawUrl: string, setIsSelfAccepting?: boolean): Promise<EnvironmentModuleNode>;
1664
+ createFileOnlyEntry(file: string): EnvironmentModuleNode;
1665
+ resolveUrl(url: string): Promise<ResolvedUrl>;
1666
+ updateModuleTransformResult(mod: EnvironmentModuleNode, result: TransformResult | null): void;
1667
+ getModuleByEtag(etag: string): EnvironmentModuleNode | undefined;
1668
+ }
1669
+
1670
+ /**
1671
+ * Backward compatible ModuleNode and ModuleGraph with mixed nodes from both the client and ssr enviornments
1672
+ * It would be good to take the types names for the new EnvironmentModuleNode and EnvironmentModuleGraph but we can't
1673
+ * do that at this point without breaking to much code in the ecosystem.
1674
+ * We are going to deprecate these types and we can try to use them back in the future.
1675
+ */
1676
+ declare class ModuleNode {
1677
+ _moduleGraph: ModuleGraph;
1678
+ _clientModule: EnvironmentModuleNode | undefined;
1679
+ _ssrModule: EnvironmentModuleNode | undefined;
1680
+ constructor(moduleGraph: ModuleGraph, clientModule?: EnvironmentModuleNode, ssrModule?: EnvironmentModuleNode);
1681
+ _get<T extends keyof EnvironmentModuleNode>(prop: T): EnvironmentModuleNode[T];
1682
+ _wrapModuleSet(prop: ModuleSetNames, module: EnvironmentModuleNode | undefined): Set<ModuleNode>;
1683
+ _getModuleSetUnion(prop: 'importedModules' | 'importers'): Set<ModuleNode>;
1684
+ get url(): string;
1685
+ get id(): string | null;
1686
+ get file(): string | null;
1687
+ get type(): 'js' | 'css';
1688
+ get info(): ModuleInfo | undefined;
1689
+ get meta(): Record<string, any> | undefined;
1690
+ get importers(): Set<ModuleNode>;
1691
+ get clientImportedModules(): Set<ModuleNode>;
1692
+ get ssrImportedModules(): Set<ModuleNode>;
1693
+ get importedModules(): Set<ModuleNode>;
1694
+ get acceptedHmrDeps(): Set<ModuleNode>;
1695
+ get acceptedHmrExports(): Set<string> | null;
1696
+ get importedBindings(): Map<string, Set<string>> | null;
1697
+ get isSelfAccepting(): boolean | undefined;
1698
+ get transformResult(): TransformResult | null;
1699
+ set transformResult(value: TransformResult | null);
1700
+ get ssrTransformResult(): TransformResult | null;
1701
+ set ssrTransformResult(value: TransformResult | null);
1702
+ get ssrModule(): Record<string, any> | null;
1703
+ get ssrError(): Error | null;
1704
+ get lastHMRTimestamp(): number;
1705
+ set lastHMRTimestamp(value: number);
1706
+ get lastInvalidationTimestamp(): number;
1707
+ get invalidationState(): TransformResult | 'HARD_INVALIDATED' | undefined;
1708
+ get ssrInvalidationState(): TransformResult | 'HARD_INVALIDATED' | undefined;
1709
+ }
1710
+ declare class ModuleGraph {
1711
+ urlToModuleMap: Map<string, ModuleNode>;
1712
+ idToModuleMap: Map<string, ModuleNode>;
1713
+ etagToModuleMap: Map<string, ModuleNode>;
1714
+ fileToModulesMap: Map<string, Set<ModuleNode>>;
1715
+ constructor(moduleGraphs: {
1716
+ client: () => EnvironmentModuleGraph;
1717
+ ssr: () => EnvironmentModuleGraph;
1718
+ });
1719
+ /** @deprecated */
1720
+ getModuleById(id: string): ModuleNode | undefined;
1721
+ /** @deprecated */
1722
+ getModuleByUrl(url: string, ssr?: boolean): Promise<ModuleNode | undefined>;
1723
+ /** @deprecated */
1724
+ getModulesByFile(file: string): Set<ModuleNode> | undefined;
1725
+ /** @deprecated */
1726
+ onFileChange(file: string): void;
1727
+ /** @deprecated */
1728
+ onFileDelete(file: string): void;
1729
+ /** @deprecated */
1730
+ invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number, isHmr?: boolean,
1731
+ ): void;
1732
+ /** @deprecated */
1733
+ invalidateAll(): void;
1734
+ /** @deprecated */
1735
+ ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>;
1736
+ /** @deprecated */
1737
+ createFileOnlyEntry(file: string): ModuleNode;
1738
+ /** @deprecated */
1739
+ resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
1740
+ /** @deprecated */
1741
+ updateModuleTransformResult(mod: ModuleNode, result: TransformResult | null, ssr?: boolean): void;
1742
+ /** @deprecated */
1743
+ getModuleByEtag(etag: string): ModuleNode | undefined;
1744
+ getBackwardCompatibleBrowserModuleNode(clientModule: EnvironmentModuleNode): ModuleNode;
1745
+ getBackwardCompatibleServerModuleNode(ssrModule: EnvironmentModuleNode): ModuleNode;
1746
+ getBackwardCompatibleModuleNode(mod: EnvironmentModuleNode): ModuleNode;
1747
+ getBackwardCompatibleModuleNodeDual(clientModule?: EnvironmentModuleNode, ssrModule?: EnvironmentModuleNode): ModuleNode;
1437
1748
  }
1749
+ type ModuleSetNames = 'acceptedHmrDeps' | 'importedModules';
1438
1750
 
1439
1751
  interface HmrOptions {
1440
1752
  protocol?: string;
@@ -1446,6 +1758,19 @@ interface HmrOptions {
1446
1758
  overlay?: boolean;
1447
1759
  server?: Server;
1448
1760
  }
1761
+ interface HotUpdateContext {
1762
+ type: 'create' | 'update' | 'delete';
1763
+ file: string;
1764
+ timestamp: number;
1765
+ modules: Array<EnvironmentModuleNode>;
1766
+ read: () => string | Promise<string>;
1767
+ server: ViteDevServer;
1768
+ environment: DevEnvironment;
1769
+ }
1770
+ /**
1771
+ * @deprecated
1772
+ * Used by handleHotUpdate for backward compatibility with mixed client and ssr moduleGraph
1773
+ **/
1449
1774
  interface HmrContext {
1450
1775
  file: string;
1451
1776
  timestamp: number;
@@ -1563,6 +1888,7 @@ interface ServerOptions extends CommonServerOptions {
1563
1888
  /**
1564
1889
  * Warm-up files to transform and cache the results in advance. This improves the
1565
1890
  * initial page load during server starts and prevents transform waterfalls.
1891
+ * @deprecated use dev.warmup / environment.ssr.dev.warmup
1566
1892
  */
1567
1893
  warmup?: {
1568
1894
  /**
@@ -1604,6 +1930,7 @@ interface ServerOptions extends CommonServerOptions {
1604
1930
  /**
1605
1931
  * Pre-transform known direct imports
1606
1932
  * @default true
1933
+ * @deprecated use dev.preTransformRequests
1607
1934
  */
1608
1935
  preTransformRequests?: boolean;
1609
1936
  /**
@@ -1613,8 +1940,14 @@ interface ServerOptions extends CommonServerOptions {
1613
1940
  * By default, it excludes all paths containing `node_modules`. You can pass `false` to
1614
1941
  * disable this behavior, or, for full control, a function that takes the source path and
1615
1942
  * sourcemap path and returns whether to ignore the source path.
1943
+ * @deprecated use dev.sourcemapIgnoreList
1616
1944
  */
1617
1945
  sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean);
1946
+ /**
1947
+ * Run HMR tasks, by default the HMR propagation is done in parallel for all environments
1948
+ * @experimental
1949
+ */
1950
+ hotUpdateEnvironments?: (server: ViteDevServer, hmr: (environment: DevEnvironment) => Promise<void>) => Promise<void>;
1618
1951
  }
1619
1952
  interface ResolvedServerOptions extends Omit<ServerOptions, 'fs' | 'middlewareMode' | 'sourcemapIgnoreList'> {
1620
1953
  fs: Required<FileSystemServeOptions>;
@@ -1690,15 +2023,21 @@ interface ViteDevServer {
1690
2023
  *
1691
2024
  * Always sends a message to at least a WebSocket client. Any third party can
1692
2025
  * add a channel to the broadcaster to process messages
2026
+ * @deprecated use `environments.get(id).hot` instead
1693
2027
  */
1694
2028
  hot: HMRBroadcaster;
1695
2029
  /**
1696
2030
  * Rollup plugin container that can run plugin hooks on a given file
1697
2031
  */
1698
2032
  pluginContainer: PluginContainer;
2033
+ /**
2034
+ * Module execution environments attached to the Vite server.
2035
+ */
2036
+ environments: Record<'client' | 'ssr' | (string & {}), DevEnvironment>;
1699
2037
  /**
1700
2038
  * Module graph that tracks the import relationships, url to file mapping
1701
2039
  * and hmr state.
2040
+ * @deprecated use environment module graphs instead
1702
2041
  */
1703
2042
  moduleGraph: ModuleGraph;
1704
2043
  /**
@@ -1709,12 +2048,14 @@ interface ViteDevServer {
1709
2048
  /**
1710
2049
  * Programmatically resolve, load and transform a URL and get the result
1711
2050
  * without going through the http request pipeline.
2051
+ * @deprecated use environment.transformRequest
1712
2052
  */
1713
2053
  transformRequest(url: string, options?: TransformOptions): Promise<TransformResult | null>;
1714
2054
  /**
1715
2055
  * Same as `transformRequest` but only warm up the URLs so the next request
1716
2056
  * will already be cached. The function will never throw as it handles and
1717
2057
  * reports errors internally.
2058
+ * @deprecated use environment.warmupRequest
1718
2059
  */
1719
2060
  warmupRequest(url: string, options?: TransformOptions): Promise<void>;
1720
2061
  /**
@@ -1733,11 +2074,6 @@ interface ViteDevServer {
1733
2074
  ssrLoadModule(url: string, opts?: {
1734
2075
  fixStacktrace?: boolean;
1735
2076
  }): Promise<Record<string, any>>;
1736
- /**
1737
- * Fetch information about the module for Vite SSR runtime.
1738
- * @experimental
1739
- */
1740
- ssrFetchModule(id: string, importer?: string): Promise<FetchResult>;
1741
2077
  /**
1742
2078
  * Returns a fixed version of the given stack
1743
2079
  */
@@ -1751,6 +2087,11 @@ interface ViteDevServer {
1751
2087
  * API to retrieve the module to be reloaded. If `hmr` is false, this is a no-op.
1752
2088
  */
1753
2089
  reloadModule(module: ModuleNode): Promise<void>;
2090
+ /**
2091
+ * Triggers HMR for an environment module in the module graph.
2092
+ * If `hmr` is false, this is a no-op.
2093
+ */
2094
+ reloadEnvironmentModule(module: EnvironmentModuleNode): Promise<void>;
1754
2095
  /**
1755
2096
  * Start the server.
1756
2097
  */
@@ -2451,8 +2792,16 @@ interface BuildOptions {
2451
2792
  /**
2452
2793
  * Emit assets during SSR.
2453
2794
  * @default false
2795
+ * @deprecated use emitAssets
2454
2796
  */
2455
2797
  ssrEmitAssets?: boolean;
2798
+ /**
2799
+ * Emit assets during build. Frameworks can set environments.ssr.build.emitAssets
2800
+ * By default, it is true for the client and false for other environments.
2801
+ * TODO: Should this be true for all environments by default? Or should this be
2802
+ * controlled by the builder so so we can avoid emitting duplicated assets.
2803
+ */
2804
+ emitAssets?: boolean;
2456
2805
  /**
2457
2806
  * Set to false to disable reporting compressed chunk sizes.
2458
2807
  * Can slightly improve build speed.
@@ -2470,6 +2819,10 @@ interface BuildOptions {
2470
2819
  * @default null
2471
2820
  */
2472
2821
  watch?: WatcherOptions | null;
2822
+ /**
2823
+ * create the Build Environment instance
2824
+ */
2825
+ createEnvironment?: (builder: ViteBuilder, name: string) => BuildEnvironment;
2473
2826
  }
2474
2827
  interface LibraryOptions {
2475
2828
  /**
@@ -2532,228 +2885,41 @@ type RenderBuiltAssetUrl = (filename: string, type: {
2532
2885
  relative?: boolean;
2533
2886
  runtime?: string;
2534
2887
  } | undefined;
2535
-
2536
- interface ESBuildOptions extends esbuild_TransformOptions {
2537
- include?: string | RegExp | string[] | RegExp[];
2538
- exclude?: string | RegExp | string[] | RegExp[];
2539
- jsxInject?: string;
2540
- /**
2541
- * This option is not respected. Use `build.minify` instead.
2542
- */
2543
- minify?: never;
2544
- }
2545
- type ESBuildTransformResult = Omit<esbuild_TransformResult, 'map'> & {
2546
- map: SourceMap;
2547
- };
2548
- declare function transformWithEsbuild(code: string, filename: string, options?: esbuild_TransformOptions, inMap?: object): Promise<ESBuildTransformResult>;
2549
-
2550
- type ExportsData = {
2551
- hasImports: boolean;
2552
- exports: readonly string[];
2553
- jsxLoader?: boolean;
2554
- };
2555
- interface DepsOptimizer {
2556
- metadata: DepOptimizationMetadata;
2557
- scanProcessing?: Promise<void>;
2558
- registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
2559
- run: () => void;
2560
- isOptimizedDepFile: (id: string) => boolean;
2561
- isOptimizedDepUrl: (url: string) => boolean;
2562
- getOptimizedDepId: (depInfo: OptimizedDepInfo) => string;
2563
- close: () => Promise<void>;
2564
- options: DepOptimizationOptions;
2565
- }
2566
- interface DepOptimizationConfig {
2567
- /**
2568
- * Force optimize listed dependencies (must be resolvable import paths,
2569
- * cannot be globs).
2570
- */
2571
- include?: string[];
2572
- /**
2573
- * Do not optimize these dependencies (must be resolvable import paths,
2574
- * cannot be globs).
2575
- */
2576
- exclude?: string[];
2577
- /**
2578
- * Forces ESM interop when importing these dependencies. Some legacy
2579
- * packages advertise themselves as ESM but use `require` internally
2580
- * @experimental
2581
- */
2582
- needsInterop?: string[];
2583
- /**
2584
- * Options to pass to esbuild during the dep scanning and optimization
2585
- *
2586
- * Certain options are omitted since changing them would not be compatible
2587
- * with Vite's dep optimization.
2588
- *
2589
- * - `external` is also omitted, use Vite's `optimizeDeps.exclude` option
2590
- * - `plugins` are merged with Vite's dep plugin
2591
- *
2592
- * https://esbuild.github.io/api
2593
- */
2594
- esbuildOptions?: Omit<esbuild_BuildOptions, 'bundle' | 'entryPoints' | 'external' | 'write' | 'watch' | 'outdir' | 'outfile' | 'outbase' | 'outExtension' | 'metafile'>;
2595
- /**
2596
- * List of file extensions that can be optimized. A corresponding esbuild
2597
- * plugin must exist to handle the specific extension.
2598
- *
2599
- * By default, Vite can optimize `.mjs`, `.js`, `.ts`, and `.mts` files. This option
2600
- * allows specifying additional extensions.
2601
- *
2602
- * @experimental
2603
- */
2604
- extensions?: string[];
2605
- /**
2606
- * Deps optimization during build was removed in Vite 5.1. This option is
2607
- * now redundant and will be removed in a future version. Switch to using
2608
- * `optimizeDeps.noDiscovery` and an empty or undefined `optimizeDeps.include`.
2609
- * true or 'dev' disables the optimizer, false or 'build' leaves it enabled.
2610
- * @default 'build'
2611
- * @deprecated
2612
- * @experimental
2613
- */
2614
- disabled?: boolean | 'build' | 'dev';
2615
- /**
2616
- * Automatic dependency discovery. When `noDiscovery` is true, only dependencies
2617
- * listed in `include` will be optimized. The scanner isn't run for cold start
2618
- * in this case. CJS-only dependencies must be present in `include` during dev.
2619
- * @default false
2620
- * @experimental
2621
- */
2622
- noDiscovery?: boolean;
2623
- /**
2624
- * When enabled, it will hold the first optimized deps results until all static
2625
- * imports are crawled on cold start. This avoids the need for full-page reloads
2626
- * when new dependencies are discovered and they trigger the generation of new
2627
- * common chunks. If all dependencies are found by the scanner plus the explicitely
2628
- * defined ones in `include`, it is better to disable this option to let the
2629
- * browser process more requests in parallel.
2630
- * @default true
2631
- * @experimental
2632
- */
2633
- holdUntilCrawlEnd?: boolean;
2634
- }
2635
- type DepOptimizationOptions = DepOptimizationConfig & {
2636
- /**
2637
- * By default, Vite will crawl your `index.html` to detect dependencies that
2638
- * need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
2639
- * will crawl those entry points instead.
2640
- *
2641
- * If neither of these fit your needs, you can specify custom entries using
2642
- * this option - the value should be a fast-glob pattern or array of patterns
2643
- * (https://github.com/mrmlnc/fast-glob#basic-syntax) that are relative from
2644
- * vite project root. This will overwrite default entries inference.
2645
- */
2646
- entries?: string | string[];
2647
- /**
2648
- * Force dep pre-optimization regardless of whether deps have changed.
2649
- * @experimental
2650
- */
2651
- force?: boolean;
2652
- };
2653
- interface OptimizedDepInfo {
2654
- id: string;
2655
- file: string;
2656
- src?: string;
2657
- needsInterop?: boolean;
2658
- browserHash?: string;
2659
- fileHash?: string;
2660
- /**
2661
- * During optimization, ids can still be resolved to their final location
2662
- * but the bundles may not yet be saved to disk
2663
- */
2664
- processing?: Promise<void>;
2665
- /**
2666
- * ExportData cache, discovered deps will parse the src entry to get exports
2667
- * data used both to define if interop is needed and when pre-bundling
2668
- */
2669
- exportsData?: Promise<ExportsData>;
2670
- }
2671
- interface DepOptimizationMetadata {
2672
- /**
2673
- * The main hash is determined by user config and dependency lockfiles.
2674
- * This is checked on server startup to avoid unnecessary re-bundles.
2675
- */
2676
- hash: string;
2677
- /**
2678
- * This hash is determined by dependency lockfiles.
2679
- * This is checked on server startup to avoid unnecessary re-bundles.
2680
- */
2681
- lockfileHash: string;
2682
- /**
2683
- * This hash is determined by user config.
2684
- * This is checked on server startup to avoid unnecessary re-bundles.
2685
- */
2686
- configHash: string;
2687
- /**
2688
- * The browser hash is determined by the main hash plus additional dependencies
2689
- * discovered at runtime. This is used to invalidate browser requests to
2690
- * optimized deps.
2691
- */
2692
- browserHash: string;
2693
- /**
2694
- * Metadata for each already optimized dependency
2695
- */
2696
- optimized: Record<string, OptimizedDepInfo>;
2697
- /**
2698
- * Metadata for non-entry optimized chunks and dynamic imports
2699
- */
2700
- chunks: Record<string, OptimizedDepInfo>;
2701
- /**
2702
- * Metadata for each newly discovered dependency after processing
2703
- */
2704
- discovered: Record<string, OptimizedDepInfo>;
2705
- /**
2706
- * OptimizedDepInfo list
2707
- */
2708
- depInfoList: OptimizedDepInfo[];
2888
+ declare class BuildEnvironment extends Environment {
2889
+ mode: "build";
2890
+ builder: ViteBuilder;
2891
+ constructor(builder: ViteBuilder, name: string, setup?: {
2892
+ options?: EnvironmentOptions;
2893
+ });
2709
2894
  }
2710
- /**
2711
- * Scan and optimize dependencies within a project.
2712
- * Used by Vite CLI when running `vite optimize`.
2713
- */
2714
- declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>;
2715
-
2716
- type SSRTarget = 'node' | 'webworker';
2717
- type SsrDepOptimizationOptions = DepOptimizationConfig;
2718
- interface SSROptions {
2719
- noExternal?: string | RegExp | (string | RegExp)[] | true;
2720
- external?: string[] | true;
2721
- /**
2722
- * Define the target for the ssr build. The browser field in package.json
2723
- * is ignored for node but used if webworker is the target
2724
- * @default 'node'
2725
- */
2726
- target?: SSRTarget;
2895
+ interface ViteBuilder {
2896
+ environments: Record<string, BuildEnvironment>;
2897
+ config: ResolvedConfig;
2898
+ buildEnvironments(): Promise<void>;
2899
+ build(environment: BuildEnvironment): Promise<RollupOutput | RollupOutput[] | RollupWatcher>;
2900
+ }
2901
+ interface BuilderOptions {
2902
+ buildEnvironments?: (builder: ViteBuilder, build: (environment: BuildEnvironment) => Promise<void>) => Promise<void>;
2903
+ }
2904
+ type ResolvedBuilderOptions = Required<BuilderOptions>;
2905
+ interface BuilderInlineConfig extends Omit<InlineConfig, 'plugins'> {
2906
+ plugins?: () => PluginOption[];
2907
+ }
2908
+ declare function createViteBuilder(builderOptions?: BuilderOptions, defaultBuilderInlineConfig?: BuilderInlineConfig): Promise<ViteBuilder>;
2909
+
2910
+ interface ESBuildOptions extends esbuild_TransformOptions {
2911
+ include?: string | RegExp | string[] | RegExp[];
2912
+ exclude?: string | RegExp | string[] | RegExp[];
2913
+ jsxInject?: string;
2727
2914
  /**
2728
- * Control over which dependencies are optimized during SSR and esbuild options
2729
- * During build:
2730
- * no external CJS dependencies are optimized by default
2731
- * During dev:
2732
- * explicit no external CJS dependencies are optimized by default
2733
- * @experimental
2915
+ * This option is not respected. Use `build.minify` instead.
2734
2916
  */
2735
- optimizeDeps?: SsrDepOptimizationOptions;
2736
- resolve?: {
2737
- /**
2738
- * Conditions that are used in the plugin pipeline. The default value is the root config's `resolve.conditions`.
2739
- *
2740
- * Use this to override the default ssr conditions for the ssr build.
2741
- *
2742
- * @default rootConfig.resolve.conditions
2743
- */
2744
- conditions?: string[];
2745
- /**
2746
- * Conditions that are used during ssr import (including `ssrLoadModule`) of externalized dependencies.
2747
- *
2748
- * @default []
2749
- */
2750
- externalConditions?: string[];
2751
- };
2752
- }
2753
- interface ResolvedSSROptions extends SSROptions {
2754
- target: SSRTarget;
2755
- optimizeDeps: SsrDepOptimizationOptions;
2917
+ minify?: never;
2756
2918
  }
2919
+ type ESBuildTransformResult = Omit<esbuild_TransformResult, 'map'> & {
2920
+ map: SourceMap;
2921
+ };
2922
+ declare function transformWithEsbuild(code: string, filename: string, options?: esbuild_TransformOptions, inMap?: object): Promise<ESBuildTransformResult>;
2757
2923
 
2758
2924
  interface FsUtils {
2759
2925
  existsSync: (path: string) => boolean;
@@ -2773,6 +2939,7 @@ interface ResolveOptions {
2773
2939
  */
2774
2940
  mainFields?: string[];
2775
2941
  conditions?: string[];
2942
+ externalConditions?: string[];
2776
2943
  /**
2777
2944
  * @default ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']
2778
2945
  */
@@ -2782,12 +2949,18 @@ interface ResolveOptions {
2782
2949
  * @default false
2783
2950
  */
2784
2951
  preserveSymlinks?: boolean;
2952
+ /**
2953
+ * external/noExternal logic, this only works for certain environments
2954
+ * Previously this was ssr.external/ssr.noExternal
2955
+ * TODO: better abstraction that works for the client environment too?
2956
+ */
2957
+ noExternal?: string | RegExp | (string | RegExp)[] | true;
2958
+ external?: string[] | true;
2785
2959
  }
2786
- interface InternalResolveOptions extends Required<ResolveOptions> {
2960
+ interface ResolvePluginOptions {
2787
2961
  root: string;
2788
2962
  isBuild: boolean;
2789
2963
  isProduction: boolean;
2790
- ssrConfig?: SSROptions;
2791
2964
  packageCache?: PackageCache;
2792
2965
  fsUtils?: FsUtils;
2793
2966
  /**
@@ -2800,12 +2973,18 @@ interface InternalResolveOptions extends Required<ResolveOptions> {
2800
2973
  tryPrefix?: string;
2801
2974
  preferRelative?: boolean;
2802
2975
  isRequire?: boolean;
2976
+ nodeCompatible?: boolean;
2977
+ webCompatible?: boolean;
2803
2978
  isFromTsImporter?: boolean;
2804
2979
  tryEsmOnly?: boolean;
2805
2980
  scan?: boolean;
2806
2981
  ssrOptimizeCheck?: boolean;
2807
- getDepsOptimizer?: (ssr: boolean) => DepsOptimizer | undefined;
2808
- shouldExternalize?: (id: string, importer?: string) => boolean | undefined;
2982
+ /**
2983
+ * @deprecated environment.options are used instead
2984
+ */
2985
+ ssrConfig?: SSROptions;
2986
+ }
2987
+ interface InternalResolveOptions extends Required<ResolveOptions>, ResolvePluginOptions {
2809
2988
  }
2810
2989
 
2811
2990
  // This file is autogenerated by build-prefixes.js. DO NOT EDIT!
@@ -2898,6 +3077,7 @@ interface CSSOptions {
2898
3077
  * Enables css sourcemaps during dev
2899
3078
  * @default false
2900
3079
  * @experimental
3080
+ * @deprecated use dev.sourcemap instead
2901
3081
  */
2902
3082
  devSourcemap?: boolean;
2903
3083
  /**
@@ -2931,7 +3111,7 @@ interface PreprocessCSSResult {
2931
3111
  /**
2932
3112
  * @experimental
2933
3113
  */
2934
- declare function preprocessCSS(code: string, filename: string, config: ResolvedConfig): Promise<PreprocessCSSResult>;
3114
+ declare function preprocessCSS(code: string, filename: string, config: ResolvedConfig, environment?: Environment): Promise<PreprocessCSSResult>;
2935
3115
  declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise<ExistingRawSourceMap>;
2936
3116
 
2937
3117
  interface HtmlTagDescriptor {
@@ -3001,7 +3181,22 @@ type IndexHtmlTransform = IndexHtmlTransformHook | {
3001
3181
  *
3002
3182
  * If a plugin should be applied only for server or build, a function format
3003
3183
  * config file can be used to conditional determine the plugins to use.
3184
+ *
3185
+ * The current module environment can be accessed from the context for the
3186
+ * buildStart, resolveId, transform, load, and buildEnd, hooks
3187
+ *
3188
+ * The current environment can be accessed from the context for the
3189
+ * buildStart, resolveId, transform, load, and buildEnd, hooks. It can be a dev
3190
+ * or a build environment. Plugins can use this.environment.mode === 'dev' to
3191
+ * check if they have access to dev specific APIs.
3004
3192
  */
3193
+ type PluginEnvironment = DevEnvironment | BuildEnvironment;
3194
+ interface PluginContext extends rollup.PluginContext {
3195
+ environment?: PluginEnvironment;
3196
+ }
3197
+ interface TransformPluginContext extends rollup.TransformPluginContext {
3198
+ environment?: PluginEnvironment;
3199
+ }
3005
3200
  interface Plugin<A = any> extends rollup.Plugin<A> {
3006
3201
  /**
3007
3202
  * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering
@@ -3030,6 +3225,17 @@ interface Plugin<A = any> extends rollup.Plugin<A> {
3030
3225
  * plugins inside the `config` hook will have no effect.
3031
3226
  */
3032
3227
  config?: ObjectHook<(this: void, config: UserConfig, env: ConfigEnv) => Omit<UserConfig, 'plugins'> | null | void | Promise<Omit<UserConfig, 'plugins'> | null | void>>;
3228
+ /**
3229
+ * Modify environment configs before it's resolved. The hook can either mutate the
3230
+ * passed-in environment config directly, or return a partial config object that will be
3231
+ * deeply merged into existing config.
3232
+ * This hook is called for each environment with a partially resolved environment config
3233
+ * that already accounts for the default environment config values set at the root level.
3234
+ * If plugins need to modify the config of a given environment, they should do it in this
3235
+ * hook instead of the config hook. Leaving the config hook only for modifying the root
3236
+ * default environment config.
3237
+ */
3238
+ configEnvironment?: ObjectHook<(this: void, name: string, config: EnvironmentOptions, env: ConfigEnv) => EnvironmentOptions | null | void | Promise<EnvironmentOptions | null | void>>;
3033
3239
  /**
3034
3240
  * Use this hook to read and store the final resolved vite config.
3035
3241
  */
@@ -3070,6 +3276,12 @@ interface Plugin<A = any> extends rollup.Plugin<A> {
3070
3276
  * `{ order: 'pre', handler: hook }`
3071
3277
  */
3072
3278
  transformIndexHtml?: IndexHtmlTransform;
3279
+ /**
3280
+ * @deprecated
3281
+ * Compat support, ctx.modules is a backward compatible ModuleNode array
3282
+ * with the mixed client and ssr moduleGraph. Use hotUpdate instead
3283
+ */
3284
+ handleHotUpdate?: ObjectHook<(this: void, ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>;
3073
3285
  /**
3074
3286
  * Perform custom handling of HMR updates.
3075
3287
  * The handler receives a context containing changed filename, timestamp, a
@@ -3085,20 +3297,29 @@ interface Plugin<A = any> extends rollup.Plugin<A> {
3085
3297
  * - If the hook doesn't return a value, the hmr update will be performed as
3086
3298
  * normal.
3087
3299
  */
3088
- handleHotUpdate?: ObjectHook<(this: void, ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>;
3300
+ hotUpdate?: ObjectHook<(this: void, ctx: HotUpdateContext) => Array<EnvironmentModuleNode> | void | Promise<Array<EnvironmentModuleNode> | void>>;
3089
3301
  /**
3090
3302
  * extend hooks with ssr flag
3091
3303
  */
3092
3304
  resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: {
3093
3305
  attributes: Record<string, string>;
3094
3306
  custom?: CustomPluginOptions;
3307
+ /**
3308
+ * @deprecated use this.environment
3309
+ */
3095
3310
  ssr?: boolean;
3096
3311
  isEntry: boolean;
3097
3312
  }) => Promise<ResolveIdResult> | ResolveIdResult>;
3098
3313
  load?: ObjectHook<(this: PluginContext, id: string, options?: {
3314
+ /**
3315
+ * @deprecated use this.environment
3316
+ */
3099
3317
  ssr?: boolean;
3100
3318
  }) => Promise<LoadResult> | LoadResult>;
3101
3319
  transform?: ObjectHook<(this: TransformPluginContext, code: string, id: string, options?: {
3320
+ /**
3321
+ * @deprecated use this.environment
3322
+ */
3102
3323
  ssr?: boolean;
3103
3324
  }) => Promise<rollup.TransformResult> | rollup.TransformResult>;
3104
3325
  }
@@ -3121,6 +3342,71 @@ interface JsonOptions {
3121
3342
  stringify?: boolean;
3122
3343
  }
3123
3344
 
3345
+ type SSRTarget = 'node' | 'webworker';
3346
+ type SsrDepOptimizationOptions = DepOptimizationConfig;
3347
+ /**
3348
+ * @deprecated use environments.ssr
3349
+ */
3350
+ interface SSROptions {
3351
+ /**
3352
+ * @deprecated use environment.resolve.noExternal
3353
+ */
3354
+ noExternal?: string | RegExp | (string | RegExp)[] | true;
3355
+ /**
3356
+ * @deprecated use environment.resolve.external
3357
+ */
3358
+ external?: string[] | true;
3359
+ /**
3360
+ * Define the target for the ssr build. The browser field in package.json
3361
+ * is ignored for node but used if webworker is the target
3362
+ *
3363
+ * if (ssr.target === 'webworker') {
3364
+ * build.rollupOptions.entryFileNames = '[name].js'
3365
+ * build.rollupOptions.inlineDynamicImports = (typeof input === 'string' || Object.keys(input).length === 1))
3366
+ * webCompatible = true
3367
+ * }
3368
+ *
3369
+ * @default 'node'
3370
+ * @deprecated use environment.webCompatible
3371
+ */
3372
+ target?: SSRTarget;
3373
+ /**
3374
+ * Control over which dependencies are optimized during SSR and esbuild options
3375
+ * During build:
3376
+ * no external CJS dependencies are optimized by default
3377
+ * During dev:
3378
+ * explicit no external CJS dependencies are optimized by default
3379
+ * @experimental
3380
+ * @deprecated
3381
+ */
3382
+ optimizeDeps?: SsrDepOptimizationOptions;
3383
+ /**
3384
+ * @deprecated
3385
+ */
3386
+ resolve?: {
3387
+ /**
3388
+ * Conditions that are used in the plugin pipeline. The default value is the root config's `resolve.conditions`.
3389
+ *
3390
+ * Use this to override the default ssr conditions for the ssr build.
3391
+ *
3392
+ * @default rootConfig.resolve.conditions
3393
+ * @deprecated
3394
+ */
3395
+ conditions?: string[];
3396
+ /**
3397
+ * Conditions that are used during ssr import (including `ssrLoadModule`) of externalized dependencies.
3398
+ *
3399
+ * @default []
3400
+ * @deprecated
3401
+ */
3402
+ externalConditions?: string[];
3403
+ };
3404
+ }
3405
+ interface ResolvedSSROptions extends SSROptions {
3406
+ target: SSRTarget;
3407
+ optimizeDeps: SsrDepOptimizationOptions;
3408
+ }
3409
+
3124
3410
  interface ConfigEnv {
3125
3411
  /**
3126
3412
  * 'serve': during dev (`vite` command)
@@ -3153,7 +3439,83 @@ declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
3153
3439
  declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
3154
3440
  declare function defineConfig(config: UserConfigExport): UserConfigExport;
3155
3441
  type PluginOption = Plugin | false | null | undefined | PluginOption[] | Promise<Plugin | false | null | undefined | PluginOption[]>;
3156
- interface UserConfig {
3442
+ interface DevOptions {
3443
+ /**
3444
+ * The files to be pre-transformed. Supports glob patterns.
3445
+ */
3446
+ warmup?: {
3447
+ files: string[];
3448
+ };
3449
+ /**
3450
+ * Pre-transform known direct imports
3451
+ * @default true
3452
+ */
3453
+ preTransformRequests?: boolean;
3454
+ /**
3455
+ * Enables sourcemaps during dev
3456
+ * @default { js: true }
3457
+ * @experimental
3458
+ */
3459
+ sourcemap?: boolean | {
3460
+ js?: boolean;
3461
+ css?: boolean;
3462
+ };
3463
+ /**
3464
+ * Whether or not to ignore-list source files in the dev server sourcemap, used to populate
3465
+ * the [`x_google_ignoreList` source map extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).
3466
+ *
3467
+ * By default, it excludes all paths containing `node_modules`. You can pass `false` to
3468
+ * disable this behavior, or, for full control, a function that takes the source path and
3469
+ * sourcemap path and returns whether to ignore the source path.
3470
+ */
3471
+ sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean);
3472
+ /**
3473
+ * Optimize deps config
3474
+ */
3475
+ optimizeDeps?: DepOptimizationConfig;
3476
+ /**
3477
+ * create the Dev Environment instance
3478
+ */
3479
+ createEnvironment?: (server: ViteDevServer, name: string) => DevEnvironment;
3480
+ }
3481
+ type ResolvedDevOptions = Required<Omit<DevOptions, 'createEnvironment'>> & {
3482
+ createEnvironment: ((server: ViteDevServer, name: string) => DevEnvironment) | undefined;
3483
+ };
3484
+ type EnvironmentResolveOptions = ResolveOptions & {
3485
+ alias?: AliasOptions;
3486
+ };
3487
+ interface SharedEnvironmentOptions {
3488
+ /**
3489
+ * Configure resolver
3490
+ */
3491
+ resolve?: EnvironmentResolveOptions;
3492
+ /**
3493
+ * Runtime Compatibility
3494
+ * Temporal options, we should remove these in favor of fine-grained control
3495
+ */
3496
+ nodeCompatible?: boolean;
3497
+ webCompatible?: boolean;
3498
+ }
3499
+ interface EnvironmentOptions extends SharedEnvironmentOptions {
3500
+ /**
3501
+ * Dev specific options
3502
+ */
3503
+ dev?: DevOptions;
3504
+ /**
3505
+ * Build specific options
3506
+ */
3507
+ build?: BuildOptions;
3508
+ }
3509
+ type ResolvedEnvironmentResolveOptions = Required<EnvironmentResolveOptions>;
3510
+ type ResolvedEnvironmentOptions = {
3511
+ resolve: ResolvedEnvironmentResolveOptions;
3512
+ nodeCompatible: boolean;
3513
+ webCompatible: boolean;
3514
+ dev: ResolvedDevOptions;
3515
+ build: ResolvedBuildOptions;
3516
+ };
3517
+ type DefaultEnvironmentOptions = Omit<EnvironmentOptions, 'nodeCompatible' | 'webCompatible'>;
3518
+ interface UserConfig extends DefaultEnvironmentOptions {
3157
3519
  /**
3158
3520
  * Project root directory. Can be an absolute path, or a path relative from
3159
3521
  * the location of the config file itself.
@@ -3198,12 +3560,6 @@ interface UserConfig {
3198
3560
  * Array of vite plugins to use.
3199
3561
  */
3200
3562
  plugins?: PluginOption[];
3201
- /**
3202
- * Configure resolver
3203
- */
3204
- resolve?: ResolveOptions & {
3205
- alias?: AliasOptions;
3206
- };
3207
3563
  /**
3208
3564
  * HTML related options
3209
3565
  */
@@ -3226,25 +3582,17 @@ interface UserConfig {
3226
3582
  */
3227
3583
  assetsInclude?: string | RegExp | (string | RegExp)[];
3228
3584
  /**
3229
- * Server specific options, e.g. host, port, https...
3585
+ * Builder specific options
3230
3586
  */
3231
- server?: ServerOptions;
3587
+ builder?: BuilderOptions;
3232
3588
  /**
3233
- * Build specific options
3589
+ * Server specific options, e.g. host, port, https...
3234
3590
  */
3235
- build?: BuildOptions;
3591
+ server?: ServerOptions;
3236
3592
  /**
3237
3593
  * Preview specific options, e.g. host, port, https...
3238
3594
  */
3239
3595
  preview?: PreviewOptions;
3240
- /**
3241
- * Dep optimization options
3242
- */
3243
- optimizeDeps?: DepOptimizationOptions;
3244
- /**
3245
- * SSR specific options
3246
- */
3247
- ssr?: SSROptions;
3248
3596
  /**
3249
3597
  * Experimental features
3250
3598
  *
@@ -3304,6 +3652,20 @@ interface UserConfig {
3304
3652
  */
3305
3653
  rollupOptions?: Omit<RollupOptions, 'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures'>;
3306
3654
  };
3655
+ /**
3656
+ * Dep optimization options
3657
+ */
3658
+ optimizeDeps?: DepOptimizationOptions;
3659
+ /**
3660
+ * SSR specific options
3661
+ * We could make SSROptions be a EnvironmentOptions if we can abstract
3662
+ * external/noExternal for environments in general.
3663
+ */
3664
+ ssr?: SSROptions;
3665
+ /**
3666
+ * Environment overrides
3667
+ */
3668
+ environments?: Record<string, EnvironmentOptions>;
3307
3669
  /**
3308
3670
  * Whether your application is a Single Page Application (SPA),
3309
3671
  * a Multi-Page Application (MPA), or Custom Application (SSR
@@ -3372,7 +3734,7 @@ interface InlineConfig extends UserConfig {
3372
3734
  configFile?: string | false;
3373
3735
  envFile?: false;
3374
3736
  }
3375
- type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclude' | 'optimizeDeps' | 'worker' | 'build'> & {
3737
+ type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclude' | 'optimizeDeps' | 'worker' | 'build' | 'dev' | 'environments'> & {
3376
3738
  configFile: string | undefined;
3377
3739
  configFileDependencies: string[];
3378
3740
  inlineConfig: InlineConfig;
@@ -3393,6 +3755,8 @@ type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclu
3393
3755
  css: ResolvedCSSOptions;
3394
3756
  esbuild: ESBuildOptions | false;
3395
3757
  server: ResolvedServerOptions;
3758
+ dev: ResolvedDevOptions;
3759
+ builder: ResolvedBuilderOptions;
3396
3760
  build: ResolvedBuildOptions;
3397
3761
  preview: ResolvedPreviewOptions;
3398
3762
  ssr: ResolvedSSROptions;
@@ -3403,6 +3767,7 @@ type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'css' | 'assetsInclu
3403
3767
  worker: ResolvedWorkerOptions;
3404
3768
  appType: AppType;
3405
3769
  experimental: ExperimentalOptions;
3770
+ environments: Record<string, ResolvedEnvironmentOptions>;
3406
3771
  } & PluginHookUtils>;
3407
3772
  interface PluginHookUtils {
3408
3773
  getSortedPlugins: <K extends keyof Plugin>(hookName: K) => PluginWithRequiredHook<K>[];
@@ -3419,15 +3784,44 @@ declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, c
3419
3784
 
3420
3785
  declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
3421
3786
 
3422
- interface FetchModuleOptions {
3423
- inlineSourceMap?: boolean;
3424
- processSourceMap?<T extends NonNullable<TransformResult['map']>>(map: T): T;
3787
+ declare function createNodeDevEnvironment(server: ViteDevServer, name: string, options?: DevEnvironmentSetup): DevEnvironment;
3788
+
3789
+ /**
3790
+ * @experimental
3791
+ */
3792
+ interface ServerModuleRunnerOptions extends Omit<ModuleRunnerOptions, 'root' | 'fetchModule' | 'hmr' | 'transport'> {
3793
+ /**
3794
+ * Disable HMR or configure HMR logger.
3795
+ */
3796
+ hmr?: false | {
3797
+ connection?: ModuleRunnerHMRConnection;
3798
+ logger?: ModuleRunnerHmr['logger'];
3799
+ };
3800
+ /**
3801
+ * Provide a custom module runner. This controls how the code is executed.
3802
+ */
3803
+ runner?: ModuleEvaluator;
3425
3804
  }
3426
3805
  /**
3427
- * Fetch module information for Vite runtime.
3806
+ * Create an instance of the Vite SSR runtime that support HMR.
3807
+ * @experimental
3808
+ */
3809
+ declare function createServerModuleRunner(environment: DevEnvironment, options?: ServerModuleRunnerOptions): ModuleRunner;
3810
+
3811
+ /**
3812
+ * The connector class to establish HMR communication between the server and the Vite runtime.
3428
3813
  * @experimental
3429
3814
  */
3430
- declare function fetchModule(server: ViteDevServer, url: string, importer?: string, options?: FetchModuleOptions): Promise<FetchResult>;
3815
+ declare class ServerHMRConnector implements ModuleRunnerHMRConnection {
3816
+ private handlers;
3817
+ private hmrChannel;
3818
+ private hmrClient;
3819
+ private connected;
3820
+ constructor(server: ViteDevServer);
3821
+ isReady(): boolean;
3822
+ send(message: string): void;
3823
+ onUpdate(handler: (payload: HMRPayload) => void): void;
3824
+ }
3431
3825
 
3432
3826
  declare const VERSION: string;
3433
3827
 
@@ -3499,40 +3893,4 @@ interface ManifestChunk {
3499
3893
  dynamicImports?: string[];
3500
3894
  }
3501
3895
 
3502
- /**
3503
- * @experimental
3504
- */
3505
- interface MainThreadRuntimeOptions extends Omit<ViteRuntimeOptions, 'root' | 'fetchModule' | 'hmr'> {
3506
- /**
3507
- * Disable HMR or configure HMR logger.
3508
- */
3509
- hmr?: false | {
3510
- logger?: false | HMRLogger;
3511
- };
3512
- /**
3513
- * Provide a custom module runner. This controls how the code is executed.
3514
- */
3515
- runner?: ViteModuleRunner;
3516
- }
3517
- /**
3518
- * Create an instance of the Vite SSR runtime that support HMR.
3519
- * @experimental
3520
- */
3521
- declare function createViteRuntime(server: ViteDevServer, options?: MainThreadRuntimeOptions): Promise<ViteRuntime>;
3522
-
3523
- /**
3524
- * The connector class to establish HMR communication between the server and the Vite runtime.
3525
- * @experimental
3526
- */
3527
- declare class ServerHMRConnector implements HMRRuntimeConnection {
3528
- private handlers;
3529
- private hmrChannel;
3530
- private hmrClient;
3531
- private connected;
3532
- constructor(server: ViteDevServer);
3533
- isReady(): boolean;
3534
- send(message: string): void;
3535
- onUpdate(handler: (payload: HMRPayload) => void): void;
3536
- }
3537
-
3538
- export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, type BuildOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type CommonServerOptions, type ConfigEnv, Connect, type CorsOptions, type CorsOrigin, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type ESBuildOptions, type ESBuildTransformResult, 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 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 MainThreadRuntimeOptions, 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, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, 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 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, createServer, createViteRuntime, 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 };
3896
+ export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type AwaitWriteFinishOptions, type BindCLIShortcutsOptions, BuildEnvironment, 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 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 };