vite 7.1.11 → 7.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +81 -81
- package/dist/client/client.mjs +4 -4
- package/dist/node/chunks/build.js +2 -2
- package/dist/node/chunks/build2.js +2 -2
- package/dist/node/chunks/chunk.js +1 -1
- package/dist/node/chunks/config.js +20612 -20393
- package/dist/node/chunks/config2.js +2 -2
- package/dist/node/chunks/dist.js +1 -1
- package/dist/node/chunks/lib.js +2 -2
- package/dist/node/chunks/logger.js +11 -2
- package/dist/node/chunks/moduleRunnerTransport.d.ts +28 -27
- package/dist/node/chunks/optimizer.js +2 -2
- package/dist/node/chunks/postcss-import.js +2 -2
- package/dist/node/chunks/preview.js +2 -2
- package/dist/node/chunks/server.js +2 -2
- package/dist/node/cli.js +2 -2
- package/dist/node/index.d.ts +1292 -1259
- package/dist/node/index.js +2 -2
- package/dist/node/module-runner.d.ts +82 -78
- package/dist/node/module-runner.js +47 -13
- package/package.json +10 -10
- package/types/customEvent.d.ts +5 -0
package/dist/node/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { ModuleRunnerTransport } from "./chunks/moduleRunnerTransport.js";
|
|
2
|
+
import { t as ModuleRunnerTransport } from "./chunks/moduleRunnerTransport.js";
|
|
3
3
|
import { ConnectedPayload, CustomPayload, CustomPayload as hmrPayload_CustomPayload, ErrorPayload, FullReloadPayload, HMRPayload, HotPayload, HotPayload as hmrPayload_HotPayload, PrunePayload, Update, UpdatePayload } from "#types/hmrPayload";
|
|
4
4
|
import { CustomEventMap, InferCustomEventPayload, InferCustomEventPayload as hmrPayload_InferCustomEventPayload, InvalidatePayload } from "#types/customEvent";
|
|
5
5
|
import * as Rollup from "rollup";
|
|
@@ -39,7 +39,7 @@ interface Alias {
|
|
|
39
39
|
*/
|
|
40
40
|
customResolver?: ResolverFunction | ResolverObject | null;
|
|
41
41
|
}
|
|
42
|
-
type MapToFunction<T> = T extends Function ? T : never;
|
|
42
|
+
type MapToFunction<T$1> = T$1 extends Function ? T$1 : never;
|
|
43
43
|
type ResolverFunction = MapToFunction<PluginHooks['resolveId']>;
|
|
44
44
|
interface ResolverObject {
|
|
45
45
|
buildStart?: PluginHooks['buildStart'];
|
|
@@ -339,7 +339,7 @@ type ProxyTargetUrl = URL | string | {
|
|
|
339
339
|
host: string;
|
|
340
340
|
protocol?: string;
|
|
341
341
|
};
|
|
342
|
-
type NormalizeProxyTarget<T extends ProxyTargetUrl> = Exclude<T, string> | URL;
|
|
342
|
+
type NormalizeProxyTarget<T$1 extends ProxyTargetUrl> = Exclude<T$1, string> | URL;
|
|
343
343
|
interface ServerOptions$3 {
|
|
344
344
|
/** URL string to be parsed with the url module. */
|
|
345
345
|
target?: ProxyTarget;
|
|
@@ -513,29 +513,28 @@ declare function createProxyServer<TIncomingMessage extends typeof http.Incoming
|
|
|
513
513
|
//#region src/node/server/middlewares/proxy.d.ts
|
|
514
514
|
interface ProxyOptions extends ServerOptions$3 {
|
|
515
515
|
/**
|
|
516
|
-
|
|
517
|
-
|
|
516
|
+
* rewrite path
|
|
517
|
+
*/
|
|
518
518
|
rewrite?: (path: string) => string;
|
|
519
519
|
/**
|
|
520
|
-
|
|
521
|
-
|
|
520
|
+
* configure the proxy server (e.g. listen to events)
|
|
521
|
+
*/
|
|
522
522
|
configure?: (proxy: ProxyServer, options: ProxyOptions) => void;
|
|
523
523
|
/**
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
bypass?: (req: http.IncomingMessage,
|
|
527
|
-
res: http.ServerResponse | undefined, options: ProxyOptions) => void | null | undefined | false | string | Promise<void | null | undefined | boolean | string>;
|
|
524
|
+
* webpack-dev-server style bypass function
|
|
525
|
+
*/
|
|
526
|
+
bypass?: (req: http.IncomingMessage, res: http.ServerResponse | undefined, options: ProxyOptions) => void | null | undefined | false | string | Promise<void | null | undefined | boolean | string>;
|
|
528
527
|
/**
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
528
|
+
* rewrite the Origin header of a WebSocket request to match the target
|
|
529
|
+
*
|
|
530
|
+
* **Exercise caution as rewriting the Origin can leave the proxying open to [CSRF attacks](https://owasp.org/www-community/attacks/csrf).**
|
|
531
|
+
*/
|
|
533
532
|
rewriteWsOrigin?: boolean | undefined;
|
|
534
533
|
}
|
|
535
534
|
//#endregion
|
|
536
535
|
//#region src/node/logger.d.ts
|
|
537
|
-
type LogType =
|
|
538
|
-
type LogLevel = LogType |
|
|
536
|
+
type LogType = "error" | "warn" | "info";
|
|
537
|
+
type LogLevel = LogType | "silent";
|
|
539
538
|
interface Logger {
|
|
540
539
|
info(msg: string, options?: LogOptions): void;
|
|
541
540
|
warn(msg: string, options?: LogOptions): void;
|
|
@@ -564,92 +563,92 @@ declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger
|
|
|
564
563
|
//#region src/node/http.d.ts
|
|
565
564
|
interface CommonServerOptions {
|
|
566
565
|
/**
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
566
|
+
* Specify server port. Note if the port is already being used, Vite will
|
|
567
|
+
* automatically try the next available port so this may not be the actual
|
|
568
|
+
* port the server ends up listening on.
|
|
569
|
+
*/
|
|
571
570
|
port?: number;
|
|
572
571
|
/**
|
|
573
|
-
|
|
574
|
-
|
|
572
|
+
* If enabled, vite will exit if specified port is already in use
|
|
573
|
+
*/
|
|
575
574
|
strictPort?: boolean;
|
|
576
575
|
/**
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
576
|
+
* Specify which IP addresses the server should listen on.
|
|
577
|
+
* Set to 0.0.0.0 to listen on all addresses, including LAN and public addresses.
|
|
578
|
+
*/
|
|
580
579
|
host?: string | boolean;
|
|
581
580
|
/**
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
581
|
+
* The hostnames that Vite is allowed to respond to.
|
|
582
|
+
* `localhost` and subdomains under `.localhost` and all IP addresses are allowed by default.
|
|
583
|
+
* When using HTTPS, this check is skipped.
|
|
584
|
+
*
|
|
585
|
+
* If a string starts with `.`, it will allow that hostname without the `.` and all subdomains under the hostname.
|
|
586
|
+
* For example, `.example.com` will allow `example.com`, `foo.example.com`, and `foo.bar.example.com`.
|
|
587
|
+
*
|
|
588
|
+
* If set to `true`, the server is allowed to respond to requests for any hosts.
|
|
589
|
+
* This is not recommended as it will be vulnerable to DNS rebinding attacks.
|
|
590
|
+
*/
|
|
592
591
|
allowedHosts?: string[] | true;
|
|
593
592
|
/**
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
593
|
+
* Enable TLS + HTTP/2.
|
|
594
|
+
* Note: this downgrades to TLS only when the proxy option is also used.
|
|
595
|
+
*/
|
|
597
596
|
https?: HttpsServerOptions;
|
|
598
597
|
/**
|
|
599
|
-
|
|
600
|
-
|
|
598
|
+
* Open browser window on startup
|
|
599
|
+
*/
|
|
601
600
|
open?: boolean | string;
|
|
602
601
|
/**
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
602
|
+
* Configure custom proxy rules for the dev server. Expects an object
|
|
603
|
+
* of `{ key: options }` pairs.
|
|
604
|
+
* Uses [`http-proxy-3`](https://github.com/sagemathinc/http-proxy-3).
|
|
605
|
+
* Full options [here](https://github.com/sagemathinc/http-proxy-3#options).
|
|
606
|
+
*
|
|
607
|
+
* Example `vite.config.js`:
|
|
608
|
+
* ``` js
|
|
609
|
+
* module.exports = {
|
|
610
|
+
* proxy: {
|
|
611
|
+
* // string shorthand: /foo -> http://localhost:4567/foo
|
|
612
|
+
* '/foo': 'http://localhost:4567',
|
|
613
|
+
* // with options
|
|
614
|
+
* '/api': {
|
|
615
|
+
* target: 'http://jsonplaceholder.typicode.com',
|
|
616
|
+
* changeOrigin: true,
|
|
617
|
+
* rewrite: path => path.replace(/^\/api/, '')
|
|
618
|
+
* }
|
|
619
|
+
* }
|
|
620
|
+
* }
|
|
621
|
+
* ```
|
|
622
|
+
*/
|
|
624
623
|
proxy?: Record<string, string | ProxyOptions>;
|
|
625
624
|
/**
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
625
|
+
* Configure CORS for the dev server.
|
|
626
|
+
* Uses https://github.com/expressjs/cors.
|
|
627
|
+
*
|
|
628
|
+
* When enabling this option, **we recommend setting a specific value
|
|
629
|
+
* rather than `true`** to avoid exposing the source code to untrusted origins.
|
|
630
|
+
*
|
|
631
|
+
* Set to `true` to allow all methods from any origin, or configure separately
|
|
632
|
+
* using an object.
|
|
633
|
+
*
|
|
634
|
+
* @default false
|
|
635
|
+
*/
|
|
637
636
|
cors?: CorsOptions | boolean;
|
|
638
637
|
/**
|
|
639
|
-
|
|
640
|
-
|
|
638
|
+
* Specify server response headers.
|
|
639
|
+
*/
|
|
641
640
|
headers?: OutgoingHttpHeaders;
|
|
642
641
|
}
|
|
643
642
|
/**
|
|
644
|
-
|
|
645
|
-
|
|
643
|
+
* https://github.com/expressjs/cors#configuration-options
|
|
644
|
+
*/
|
|
646
645
|
interface CorsOptions {
|
|
647
646
|
/**
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
647
|
+
* Configures the Access-Control-Allow-Origin CORS header.
|
|
648
|
+
*
|
|
649
|
+
* **We recommend setting a specific value rather than
|
|
650
|
+
* `true`** to avoid exposing the source code to untrusted origins.
|
|
651
|
+
*/
|
|
653
652
|
origin?: CorsOrigin | ((origin: string | undefined, cb: (err: Error, origins: CorsOrigin) => void) => void);
|
|
654
653
|
methods?: string | string[];
|
|
655
654
|
allowedHeaders?: string | string[];
|
|
@@ -662,70 +661,70 @@ interface CorsOptions {
|
|
|
662
661
|
type CorsOrigin = boolean | string | RegExp | (string | RegExp)[];
|
|
663
662
|
//#endregion
|
|
664
663
|
//#region src/node/typeUtils.d.ts
|
|
665
|
-
type RequiredExceptFor<T, K extends keyof T> = Pick<T, K> & Required<Omit<T, K>>;
|
|
664
|
+
type RequiredExceptFor<T$1, K$1 extends keyof T$1> = Pick<T$1, K$1> & Required<Omit<T$1, K$1>>;
|
|
666
665
|
//#endregion
|
|
667
666
|
//#region src/node/preview.d.ts
|
|
668
667
|
interface PreviewOptions extends CommonServerOptions {}
|
|
669
|
-
interface ResolvedPreviewOptions extends RequiredExceptFor<PreviewOptions,
|
|
668
|
+
interface ResolvedPreviewOptions extends RequiredExceptFor<PreviewOptions, "host" | "https" | "proxy"> {}
|
|
670
669
|
interface PreviewServer {
|
|
671
670
|
/**
|
|
672
|
-
|
|
673
|
-
|
|
671
|
+
* The resolved vite config object
|
|
672
|
+
*/
|
|
674
673
|
config: ResolvedConfig;
|
|
675
674
|
/**
|
|
676
|
-
|
|
677
|
-
|
|
675
|
+
* Stop the server.
|
|
676
|
+
*/
|
|
678
677
|
close(): Promise<void>;
|
|
679
678
|
/**
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
679
|
+
* A connect app instance.
|
|
680
|
+
* - Can be used to attach custom middlewares to the preview server.
|
|
681
|
+
* - Can also be used as the handler function of a custom http server
|
|
682
|
+
* or as a middleware in any connect-style Node.js frameworks
|
|
683
|
+
*
|
|
684
|
+
* https://github.com/senchalabs/connect#use-middleware
|
|
685
|
+
*/
|
|
687
686
|
middlewares: Connect.Server;
|
|
688
687
|
/**
|
|
689
|
-
|
|
690
|
-
|
|
688
|
+
* native Node http server instance
|
|
689
|
+
*/
|
|
691
690
|
httpServer: HttpServer;
|
|
692
691
|
/**
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
692
|
+
* The resolved urls Vite prints on the CLI (URL-encoded). Returns `null`
|
|
693
|
+
* if the server is not listening on any port.
|
|
694
|
+
*/
|
|
696
695
|
resolvedUrls: ResolvedServerUrls | null;
|
|
697
696
|
/**
|
|
698
|
-
|
|
699
|
-
|
|
697
|
+
* Print server urls
|
|
698
|
+
*/
|
|
700
699
|
printUrls(): void;
|
|
701
700
|
/**
|
|
702
|
-
|
|
703
|
-
|
|
701
|
+
* Bind CLI shortcuts
|
|
702
|
+
*/
|
|
704
703
|
bindCLIShortcuts(options?: BindCLIShortcutsOptions<PreviewServer>): void;
|
|
705
704
|
}
|
|
706
705
|
type PreviewServerHook = (this: MinimalPluginContextWithoutEnvironment, server: PreviewServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
707
706
|
/**
|
|
708
|
-
|
|
709
|
-
|
|
707
|
+
* Starts the Vite server in preview mode, to simulate a production deployment
|
|
708
|
+
*/
|
|
710
709
|
declare function preview(inlineConfig?: InlineConfig): Promise<PreviewServer>;
|
|
711
710
|
//#endregion
|
|
712
711
|
//#region src/node/shortcuts.d.ts
|
|
713
|
-
type BindCLIShortcutsOptions<Server = ViteDevServer | PreviewServer> = {
|
|
712
|
+
type BindCLIShortcutsOptions<Server$3 = ViteDevServer | PreviewServer> = {
|
|
714
713
|
/**
|
|
715
|
-
|
|
716
|
-
|
|
714
|
+
* Print a one-line shortcuts "help" hint to the terminal
|
|
715
|
+
*/
|
|
717
716
|
print?: boolean;
|
|
718
717
|
/**
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
customShortcuts?: CLIShortcut<Server>[];
|
|
718
|
+
* Custom shortcuts to run when a key is pressed. These shortcuts take priority
|
|
719
|
+
* over the default shortcuts if they have the same keys (except the `h` key).
|
|
720
|
+
* To disable a default shortcut, define the same key but with `action: undefined`.
|
|
721
|
+
*/
|
|
722
|
+
customShortcuts?: CLIShortcut<Server$3>[];
|
|
724
723
|
};
|
|
725
|
-
type CLIShortcut<Server = ViteDevServer | PreviewServer> = {
|
|
724
|
+
type CLIShortcut<Server$3 = ViteDevServer | PreviewServer> = {
|
|
726
725
|
key: string;
|
|
727
726
|
description: string;
|
|
728
|
-
action?(server: Server): void | Promise<void>;
|
|
727
|
+
action?(server: Server$3): void | Promise<void>;
|
|
729
728
|
};
|
|
730
729
|
//#endregion
|
|
731
730
|
//#region src/node/baseEnvironment.d.ts
|
|
@@ -737,21 +736,21 @@ declare class PartialEnvironment {
|
|
|
737
736
|
constructor(name: string, topLevelConfig: ResolvedConfig, options?: ResolvedEnvironmentOptions);
|
|
738
737
|
}
|
|
739
738
|
declare class BaseEnvironment extends PartialEnvironment {
|
|
740
|
-
get plugins(): readonly Plugin
|
|
739
|
+
get plugins(): readonly Plugin[];
|
|
741
740
|
constructor(name: string, config: ResolvedConfig, options?: ResolvedEnvironmentOptions);
|
|
742
741
|
}
|
|
743
742
|
/**
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
743
|
+
* This class discourages users from inversely checking the `mode`
|
|
744
|
+
* to determine the type of environment, e.g.
|
|
745
|
+
*
|
|
746
|
+
* ```js
|
|
747
|
+
* const isDev = environment.mode !== 'build' // bad
|
|
748
|
+
* const isDev = environment.mode === 'dev' // good
|
|
749
|
+
* ```
|
|
750
|
+
*
|
|
751
|
+
* You should also not check against `"unknown"` specifically. It's
|
|
752
|
+
* a placeholder for more possible environment types.
|
|
753
|
+
*/
|
|
755
754
|
declare class UnknownEnvironment extends BaseEnvironment {
|
|
756
755
|
mode: "unknown";
|
|
757
756
|
}
|
|
@@ -783,88 +782,88 @@ interface DepsOptimizer {
|
|
|
783
782
|
}
|
|
784
783
|
interface DepOptimizationConfig {
|
|
785
784
|
/**
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
785
|
+
* Force optimize listed dependencies (must be resolvable import paths,
|
|
786
|
+
* cannot be globs).
|
|
787
|
+
*/
|
|
789
788
|
include?: string[];
|
|
790
789
|
/**
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
790
|
+
* Do not optimize these dependencies (must be resolvable import paths,
|
|
791
|
+
* cannot be globs).
|
|
792
|
+
*/
|
|
794
793
|
exclude?: string[];
|
|
795
794
|
/**
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
795
|
+
* Forces ESM interop when importing these dependencies. Some legacy
|
|
796
|
+
* packages advertise themselves as ESM but use `require` internally
|
|
797
|
+
* @experimental
|
|
798
|
+
*/
|
|
800
799
|
needsInterop?: string[];
|
|
801
800
|
/**
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
esbuildOptions?: Omit<esbuild_BuildOptions,
|
|
813
|
-
/**
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
801
|
+
* Options to pass to esbuild during the dep scanning and optimization
|
|
802
|
+
*
|
|
803
|
+
* Certain options are omitted since changing them would not be compatible
|
|
804
|
+
* with Vite's dep optimization.
|
|
805
|
+
*
|
|
806
|
+
* - `external` is also omitted, use Vite's `optimizeDeps.exclude` option
|
|
807
|
+
* - `plugins` are merged with Vite's dep plugin
|
|
808
|
+
*
|
|
809
|
+
* https://esbuild.github.io/api
|
|
810
|
+
*/
|
|
811
|
+
esbuildOptions?: Omit<esbuild_BuildOptions, "bundle" | "entryPoints" | "external" | "write" | "watch" | "outdir" | "outfile" | "outbase" | "outExtension" | "metafile">;
|
|
812
|
+
/**
|
|
813
|
+
* List of file extensions that can be optimized. A corresponding esbuild
|
|
814
|
+
* plugin must exist to handle the specific extension.
|
|
815
|
+
*
|
|
816
|
+
* By default, Vite can optimize `.mjs`, `.js`, `.ts`, and `.mts` files. This option
|
|
817
|
+
* allows specifying additional extensions.
|
|
818
|
+
*
|
|
819
|
+
* @experimental
|
|
820
|
+
*/
|
|
822
821
|
extensions?: string[];
|
|
823
822
|
/**
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
disabled?: boolean |
|
|
833
|
-
/**
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
823
|
+
* Deps optimization during build was removed in Vite 5.1. This option is
|
|
824
|
+
* now redundant and will be removed in a future version. Switch to using
|
|
825
|
+
* `optimizeDeps.noDiscovery` and an empty or undefined `optimizeDeps.include`.
|
|
826
|
+
* true or 'dev' disables the optimizer, false or 'build' leaves it enabled.
|
|
827
|
+
* @default 'build'
|
|
828
|
+
* @deprecated
|
|
829
|
+
* @experimental
|
|
830
|
+
*/
|
|
831
|
+
disabled?: boolean | "build" | "dev";
|
|
832
|
+
/**
|
|
833
|
+
* Automatic dependency discovery. When `noDiscovery` is true, only dependencies
|
|
834
|
+
* listed in `include` will be optimized. The scanner isn't run for cold start
|
|
835
|
+
* in this case. CJS-only dependencies must be present in `include` during dev.
|
|
836
|
+
* @default false
|
|
837
|
+
*/
|
|
839
838
|
noDiscovery?: boolean;
|
|
840
839
|
/**
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
840
|
+
* When enabled, it will hold the first optimized deps results until all static
|
|
841
|
+
* imports are crawled on cold start. This avoids the need for full-page reloads
|
|
842
|
+
* when new dependencies are discovered and they trigger the generation of new
|
|
843
|
+
* common chunks. If all dependencies are found by the scanner plus the explicitly
|
|
844
|
+
* defined ones in `include`, it is better to disable this option to let the
|
|
845
|
+
* browser process more requests in parallel.
|
|
846
|
+
* @default true
|
|
847
|
+
* @experimental
|
|
848
|
+
*/
|
|
850
849
|
holdUntilCrawlEnd?: boolean;
|
|
851
850
|
}
|
|
852
851
|
type DepOptimizationOptions = DepOptimizationConfig & {
|
|
853
852
|
/**
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
853
|
+
* By default, Vite will crawl your `index.html` to detect dependencies that
|
|
854
|
+
* need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
|
|
855
|
+
* will crawl those entry points instead.
|
|
856
|
+
*
|
|
857
|
+
* If neither of these fit your needs, you can specify custom entries using
|
|
858
|
+
* this option - the value should be a tinyglobby pattern or array of patterns
|
|
859
|
+
* (https://github.com/SuperchupuDev/tinyglobby) that are relative from
|
|
860
|
+
* vite project root. This will overwrite default entries inference.
|
|
861
|
+
*/
|
|
863
862
|
entries?: string | string[];
|
|
864
863
|
/**
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
864
|
+
* Force dep pre-optimization regardless of whether deps have changed.
|
|
865
|
+
* @experimental
|
|
866
|
+
*/
|
|
868
867
|
force?: boolean;
|
|
869
868
|
};
|
|
870
869
|
interface OptimizedDepInfo {
|
|
@@ -875,68 +874,68 @@ interface OptimizedDepInfo {
|
|
|
875
874
|
browserHash?: string;
|
|
876
875
|
fileHash?: string;
|
|
877
876
|
/**
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
877
|
+
* During optimization, ids can still be resolved to their final location
|
|
878
|
+
* but the bundles may not yet be saved to disk
|
|
879
|
+
*/
|
|
881
880
|
processing?: Promise<void>;
|
|
882
881
|
/**
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
882
|
+
* ExportData cache, discovered deps will parse the src entry to get exports
|
|
883
|
+
* data used both to define if interop is needed and when pre-bundling
|
|
884
|
+
*/
|
|
886
885
|
exportsData?: Promise<ExportsData>;
|
|
887
886
|
}
|
|
888
887
|
interface DepOptimizationMetadata {
|
|
889
888
|
/**
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
889
|
+
* The main hash is determined by user config and dependency lockfiles.
|
|
890
|
+
* This is checked on server startup to avoid unnecessary re-bundles.
|
|
891
|
+
*/
|
|
893
892
|
hash: string;
|
|
894
893
|
/**
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
894
|
+
* This hash is determined by dependency lockfiles.
|
|
895
|
+
* This is checked on server startup to avoid unnecessary re-bundles.
|
|
896
|
+
*/
|
|
898
897
|
lockfileHash: string;
|
|
899
898
|
/**
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
899
|
+
* This hash is determined by user config.
|
|
900
|
+
* This is checked on server startup to avoid unnecessary re-bundles.
|
|
901
|
+
*/
|
|
903
902
|
configHash: string;
|
|
904
903
|
/**
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
904
|
+
* The browser hash is determined by the main hash plus additional dependencies
|
|
905
|
+
* discovered at runtime. This is used to invalidate browser requests to
|
|
906
|
+
* optimized deps.
|
|
907
|
+
*/
|
|
909
908
|
browserHash: string;
|
|
910
909
|
/**
|
|
911
|
-
|
|
912
|
-
|
|
910
|
+
* Metadata for each already optimized dependency
|
|
911
|
+
*/
|
|
913
912
|
optimized: Record<string, OptimizedDepInfo>;
|
|
914
913
|
/**
|
|
915
|
-
|
|
916
|
-
|
|
914
|
+
* Metadata for non-entry optimized chunks and dynamic imports
|
|
915
|
+
*/
|
|
917
916
|
chunks: Record<string, OptimizedDepInfo>;
|
|
918
917
|
/**
|
|
919
|
-
|
|
920
|
-
|
|
918
|
+
* Metadata for each newly discovered dependency after processing
|
|
919
|
+
*/
|
|
921
920
|
discovered: Record<string, OptimizedDepInfo>;
|
|
922
921
|
/**
|
|
923
|
-
|
|
924
|
-
|
|
922
|
+
* OptimizedDepInfo list
|
|
923
|
+
*/
|
|
925
924
|
depInfoList: OptimizedDepInfo[];
|
|
926
925
|
}
|
|
927
926
|
/**
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
927
|
+
* Scan and optimize dependencies within a project.
|
|
928
|
+
* Used by Vite CLI when running `vite optimize`.
|
|
929
|
+
*
|
|
930
|
+
* @deprecated the optimization process runs automatically and does not need to be called
|
|
931
|
+
*/
|
|
933
932
|
declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>;
|
|
934
933
|
//#endregion
|
|
935
934
|
//#region src/node/server/transformRequest.d.ts
|
|
936
935
|
interface TransformResult {
|
|
937
936
|
code: string;
|
|
938
937
|
map: SourceMap | {
|
|
939
|
-
mappings:
|
|
938
|
+
mappings: "";
|
|
940
939
|
} | null;
|
|
941
940
|
ssr?: boolean;
|
|
942
941
|
etag?: string;
|
|
@@ -945,8 +944,8 @@ interface TransformResult {
|
|
|
945
944
|
}
|
|
946
945
|
interface TransformOptions {
|
|
947
946
|
/**
|
|
948
|
-
|
|
949
|
-
|
|
947
|
+
* @deprecated inferred from environment
|
|
948
|
+
*/
|
|
950
949
|
ssr?: boolean;
|
|
951
950
|
}
|
|
952
951
|
interface TransformOptionsInternal {}
|
|
@@ -955,15 +954,15 @@ interface TransformOptionsInternal {}
|
|
|
955
954
|
declare class EnvironmentModuleNode {
|
|
956
955
|
environment: string;
|
|
957
956
|
/**
|
|
958
|
-
|
|
959
|
-
|
|
957
|
+
* Public served url path, starts with /
|
|
958
|
+
*/
|
|
960
959
|
url: string;
|
|
961
960
|
/**
|
|
962
|
-
|
|
963
|
-
|
|
961
|
+
* Resolved file system path + query
|
|
962
|
+
*/
|
|
964
963
|
id: string | null;
|
|
965
964
|
file: string | null;
|
|
966
|
-
type:
|
|
965
|
+
type: "js" | "css" | "asset";
|
|
967
966
|
info?: ModuleInfo;
|
|
968
967
|
meta?: Record<string, any>;
|
|
969
968
|
importers: Set<EnvironmentModuleNode>;
|
|
@@ -978,8 +977,8 @@ declare class EnvironmentModuleNode {
|
|
|
978
977
|
lastHMRTimestamp: number;
|
|
979
978
|
lastInvalidationTimestamp: number;
|
|
980
979
|
/**
|
|
981
|
-
|
|
982
|
-
|
|
980
|
+
* @param setIsSelfAccepting - set `false` to set `isSelfAccepting` later. e.g. #7870
|
|
981
|
+
*/
|
|
983
982
|
constructor(url: string, environment: string, setIsSelfAccepting?: boolean);
|
|
984
983
|
}
|
|
985
984
|
type ResolvedUrl = [url: string, resolvedId: string, meta: object | null | undefined];
|
|
@@ -995,17 +994,17 @@ declare class EnvironmentModuleGraph {
|
|
|
995
994
|
getModulesByFile(file: string): Set<EnvironmentModuleNode> | undefined;
|
|
996
995
|
onFileChange(file: string): void;
|
|
997
996
|
onFileDelete(file: string): void;
|
|
998
|
-
invalidateModule(mod: EnvironmentModuleNode, seen?: Set<EnvironmentModuleNode>, timestamp?: number, isHmr?: boolean, ): void;
|
|
997
|
+
invalidateModule(mod: EnvironmentModuleNode, seen?: Set<EnvironmentModuleNode>, timestamp?: number, isHmr?: boolean, softInvalidate?: boolean): void;
|
|
999
998
|
invalidateAll(): void;
|
|
1000
999
|
/**
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
updateModuleInfo(mod: EnvironmentModuleNode, importedModules: Set<string | EnvironmentModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | EnvironmentModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean, ): Promise<Set<EnvironmentModuleNode> | undefined>;
|
|
1000
|
+
* Update the module graph based on a module's updated imports information
|
|
1001
|
+
* If there are dependencies that no longer have any importers, they are
|
|
1002
|
+
* returned as a Set.
|
|
1003
|
+
*
|
|
1004
|
+
* @param staticImportedUrls Subset of `importedModules` where they're statically imported in code.
|
|
1005
|
+
* This is only used for soft invalidations so `undefined` is fine but may cause more runtime processing.
|
|
1006
|
+
*/
|
|
1007
|
+
updateModuleInfo(mod: EnvironmentModuleNode, importedModules: Set<string | EnvironmentModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | EnvironmentModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean, staticImportedUrls?: Set<string>): Promise<Set<EnvironmentModuleNode> | undefined>;
|
|
1009
1008
|
ensureEntryFromUrl(rawUrl: string, setIsSelfAccepting?: boolean): Promise<EnvironmentModuleNode>;
|
|
1010
1009
|
createFileOnlyEntry(file: string): EnvironmentModuleNode;
|
|
1011
1010
|
resolveUrl(url: string): Promise<ResolvedUrl>;
|
|
@@ -1019,19 +1018,19 @@ declare class ModuleNode {
|
|
|
1019
1018
|
_clientModule: EnvironmentModuleNode | undefined;
|
|
1020
1019
|
_ssrModule: EnvironmentModuleNode | undefined;
|
|
1021
1020
|
constructor(moduleGraph: ModuleGraph, clientModule?: EnvironmentModuleNode, ssrModule?: EnvironmentModuleNode);
|
|
1022
|
-
_get<T extends keyof EnvironmentModuleNode>(prop: T): EnvironmentModuleNode[T];
|
|
1023
|
-
_set<T extends keyof EnvironmentModuleNode>(prop: T, value: EnvironmentModuleNode[T]): void;
|
|
1021
|
+
_get<T$1 extends keyof EnvironmentModuleNode>(prop: T$1): EnvironmentModuleNode[T$1];
|
|
1022
|
+
_set<T$1 extends keyof EnvironmentModuleNode>(prop: T$1, value: EnvironmentModuleNode[T$1]): void;
|
|
1024
1023
|
_wrapModuleSet(prop: ModuleSetNames, module: EnvironmentModuleNode | undefined): Set<ModuleNode>;
|
|
1025
|
-
_getModuleSetUnion(prop:
|
|
1026
|
-
_getModuleInfoUnion(prop:
|
|
1027
|
-
_getModuleObjectUnion(prop:
|
|
1024
|
+
_getModuleSetUnion(prop: "importedModules" | "importers"): Set<ModuleNode>;
|
|
1025
|
+
_getModuleInfoUnion(prop: "info"): ModuleInfo | undefined;
|
|
1026
|
+
_getModuleObjectUnion(prop: "meta"): Record<string, any> | undefined;
|
|
1028
1027
|
get url(): string;
|
|
1029
1028
|
set url(value: string);
|
|
1030
1029
|
get id(): string | null;
|
|
1031
1030
|
set id(value: string | null);
|
|
1032
1031
|
get file(): string | null;
|
|
1033
1032
|
set file(value: string | null);
|
|
1034
|
-
get type():
|
|
1033
|
+
get type(): "js" | "css" | "asset";
|
|
1035
1034
|
get info(): ModuleInfo | undefined;
|
|
1036
1035
|
get meta(): Record<string, any> | undefined;
|
|
1037
1036
|
get importers(): Set<ModuleNode>;
|
|
@@ -1051,8 +1050,8 @@ declare class ModuleNode {
|
|
|
1051
1050
|
get lastHMRTimestamp(): number;
|
|
1052
1051
|
set lastHMRTimestamp(value: number);
|
|
1053
1052
|
get lastInvalidationTimestamp(): number;
|
|
1054
|
-
get invalidationState(): TransformResult |
|
|
1055
|
-
get ssrInvalidationState(): TransformResult |
|
|
1053
|
+
get invalidationState(): TransformResult | "HARD_INVALIDATED" | undefined;
|
|
1054
|
+
get ssrInvalidationState(): TransformResult | "HARD_INVALIDATED" | undefined;
|
|
1056
1055
|
}
|
|
1057
1056
|
declare class ModuleGraph {
|
|
1058
1057
|
urlToModuleMap: Map<string, ModuleNode>;
|
|
@@ -1069,7 +1068,7 @@ declare class ModuleGraph {
|
|
|
1069
1068
|
getModulesByFile(file: string): Set<ModuleNode> | undefined;
|
|
1070
1069
|
onFileChange(file: string): void;
|
|
1071
1070
|
onFileDelete(file: string): void;
|
|
1072
|
-
invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number, isHmr?: boolean, ): void;
|
|
1071
|
+
invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number, isHmr?: boolean, softInvalidate?: boolean): void;
|
|
1073
1072
|
invalidateAll(): void;
|
|
1074
1073
|
ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>;
|
|
1075
1074
|
createFileOnlyEntry(file: string): ModuleNode;
|
|
@@ -1081,7 +1080,7 @@ declare class ModuleGraph {
|
|
|
1081
1080
|
getBackwardCompatibleModuleNode(mod: EnvironmentModuleNode): ModuleNode;
|
|
1082
1081
|
getBackwardCompatibleModuleNodeDual(clientModule?: EnvironmentModuleNode, ssrModule?: EnvironmentModuleNode): ModuleNode;
|
|
1083
1082
|
}
|
|
1084
|
-
type ModuleSetNames =
|
|
1083
|
+
type ModuleSetNames = "acceptedHmrDeps" | "importedModules";
|
|
1085
1084
|
//#endregion
|
|
1086
1085
|
//#region src/node/server/hmr.d.ts
|
|
1087
1086
|
interface HmrOptions {
|
|
@@ -1095,7 +1094,7 @@ interface HmrOptions {
|
|
|
1095
1094
|
server?: HttpServer;
|
|
1096
1095
|
}
|
|
1097
1096
|
interface HotUpdateOptions {
|
|
1098
|
-
type:
|
|
1097
|
+
type: "create" | "update" | "delete";
|
|
1099
1098
|
file: string;
|
|
1100
1099
|
timestamp: number;
|
|
1101
1100
|
modules: Array<EnvironmentModuleNode>;
|
|
@@ -1112,58 +1111,61 @@ interface HmrContext {
|
|
|
1112
1111
|
interface HotChannelClient {
|
|
1113
1112
|
send(payload: hmrPayload_HotPayload): void;
|
|
1114
1113
|
}
|
|
1115
|
-
type HotChannelListener<T extends string = string> = (data: InferCustomEventPayload<T>, client: HotChannelClient) => void;
|
|
1114
|
+
type HotChannelListener<T$1 extends string = string> = (data: InferCustomEventPayload<T$1>, client: HotChannelClient) => void;
|
|
1116
1115
|
interface HotChannel<Api = any> {
|
|
1117
1116
|
/**
|
|
1118
|
-
|
|
1119
|
-
|
|
1117
|
+
* Broadcast events to all clients
|
|
1118
|
+
*/
|
|
1120
1119
|
send?(payload: hmrPayload_HotPayload): void;
|
|
1121
1120
|
/**
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
on?<T extends string>(event: T, listener: HotChannelListener<T>): void;
|
|
1125
|
-
on?(event:
|
|
1121
|
+
* Handle custom event emitted by `import.meta.hot.send`
|
|
1122
|
+
*/
|
|
1123
|
+
on?<T$1 extends string>(event: T$1, listener: HotChannelListener<T$1>): void;
|
|
1124
|
+
on?(event: "connection", listener: () => void): void;
|
|
1126
1125
|
/**
|
|
1127
|
-
|
|
1128
|
-
|
|
1126
|
+
* Unregister event listener
|
|
1127
|
+
*/
|
|
1129
1128
|
off?(event: string, listener: Function): void;
|
|
1130
1129
|
/**
|
|
1131
|
-
|
|
1132
|
-
|
|
1130
|
+
* Start listening for messages
|
|
1131
|
+
*/
|
|
1133
1132
|
listen?(): void;
|
|
1134
1133
|
/**
|
|
1135
|
-
|
|
1136
|
-
|
|
1134
|
+
* Disconnect all clients, called when server is closed or restarted.
|
|
1135
|
+
*/
|
|
1137
1136
|
close?(): Promise<unknown> | void;
|
|
1138
1137
|
api?: Api;
|
|
1139
1138
|
}
|
|
1140
1139
|
interface NormalizedHotChannelClient {
|
|
1141
1140
|
/**
|
|
1142
|
-
|
|
1143
|
-
|
|
1141
|
+
* Send event to the client
|
|
1142
|
+
*/
|
|
1144
1143
|
send(payload: hmrPayload_HotPayload): void;
|
|
1145
1144
|
/**
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
send(event: string, payload?: hmrPayload_CustomPayload[
|
|
1145
|
+
* Send custom event
|
|
1146
|
+
*/
|
|
1147
|
+
send(event: string, payload?: hmrPayload_CustomPayload["data"]): void;
|
|
1149
1148
|
}
|
|
1150
1149
|
interface NormalizedHotChannel<Api = any> {
|
|
1151
1150
|
/**
|
|
1152
|
-
|
|
1153
|
-
|
|
1151
|
+
* Broadcast events to all clients
|
|
1152
|
+
*/
|
|
1154
1153
|
send(payload: hmrPayload_HotPayload): void;
|
|
1155
1154
|
/**
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
send<T extends string>(event: T, payload?: InferCustomEventPayload<T>): void;
|
|
1155
|
+
* Send custom event
|
|
1156
|
+
*/
|
|
1157
|
+
send<T$1 extends string>(event: T$1, payload?: InferCustomEventPayload<T$1>): void;
|
|
1159
1158
|
/**
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
on<T extends string>(event: T, listener: (data: InferCustomEventPayload<T>, client: NormalizedHotChannelClient) => void): void;
|
|
1163
|
-
on(event: 'connection', listener: () => void): void;
|
|
1159
|
+
* Handle custom event emitted by `import.meta.hot.send`
|
|
1160
|
+
*/
|
|
1161
|
+
on<T$1 extends string>(event: T$1, listener: (data: InferCustomEventPayload<T$1>, client: NormalizedHotChannelClient) => void): void;
|
|
1164
1162
|
/**
|
|
1165
|
-
|
|
1166
|
-
|
|
1163
|
+
* @deprecated use `vite:client:connect` event instead
|
|
1164
|
+
*/
|
|
1165
|
+
on(event: "connection", listener: () => void): void;
|
|
1166
|
+
/**
|
|
1167
|
+
* Unregister event listener
|
|
1168
|
+
*/
|
|
1167
1169
|
off(event: string, listener: Function): void;
|
|
1168
1170
|
handleInvoke(payload: hmrPayload_HotPayload): Promise<{
|
|
1169
1171
|
result: any;
|
|
@@ -1171,12 +1173,12 @@ interface NormalizedHotChannel<Api = any> {
|
|
|
1171
1173
|
error: any;
|
|
1172
1174
|
}>;
|
|
1173
1175
|
/**
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
+
* Start listening for messages
|
|
1177
|
+
*/
|
|
1176
1178
|
listen(): void;
|
|
1177
1179
|
/**
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
+
* Disconnect all clients, called when server is closed or restarted.
|
|
1181
|
+
*/
|
|
1180
1182
|
close(): Promise<unknown> | void;
|
|
1181
1183
|
api?: Api;
|
|
1182
1184
|
}
|
|
@@ -1427,38 +1429,38 @@ declare namespace WebSocket {
|
|
|
1427
1429
|
}
|
|
1428
1430
|
|
|
1429
1431
|
// WebSocket Server
|
|
1430
|
-
class Server<T extends WebSocket = WebSocket> extends EventEmitter {
|
|
1432
|
+
class Server<T$1 extends WebSocket = WebSocket> extends EventEmitter {
|
|
1431
1433
|
options: ServerOptions;
|
|
1432
1434
|
path: string;
|
|
1433
|
-
clients: Set<T>;
|
|
1435
|
+
clients: Set<T$1>;
|
|
1434
1436
|
constructor(options?: ServerOptions, callback?: () => void);
|
|
1435
1437
|
address(): AddressInfo | string;
|
|
1436
1438
|
close(cb?: (err?: Error) => void): void;
|
|
1437
|
-
handleUpgrade(request: http.IncomingMessage, socket: Duplex, upgradeHead: Buffer, callback: (client: T, request: http.IncomingMessage) => void): void;
|
|
1439
|
+
handleUpgrade(request: http.IncomingMessage, socket: Duplex, upgradeHead: Buffer, callback: (client: T$1, request: http.IncomingMessage) => void): void;
|
|
1438
1440
|
shouldHandle(request: http.IncomingMessage): boolean | Promise<boolean>;
|
|
1439
1441
|
|
|
1440
1442
|
// Events
|
|
1441
|
-
on(event: 'connection', cb: (this: Server<T>, socket: T, request: http.IncomingMessage) => void): this;
|
|
1442
|
-
on(event: 'error', cb: (this: Server<T>, error: Error) => void): this;
|
|
1443
|
-
on(event: 'headers', cb: (this: Server<T>, headers: string[], request: http.IncomingMessage) => void): this;
|
|
1444
|
-
on(event: 'close' | 'listening', cb: (this: Server<T>) => void): this;
|
|
1445
|
-
on(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;
|
|
1446
|
-
once(event: 'connection', cb: (this: Server<T>, socket: T, request: http.IncomingMessage) => void): this;
|
|
1447
|
-
once(event: 'error', cb: (this: Server<T>, error: Error) => void): this;
|
|
1448
|
-
once(event: 'headers', cb: (this: Server<T>, headers: string[], request: http.IncomingMessage) => void): this;
|
|
1449
|
-
once(event: 'close' | 'listening', cb: (this: Server<T>) => void): this;
|
|
1450
|
-
once(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;
|
|
1451
|
-
off(event: 'connection', cb: (this: Server<T>, socket: T, request: http.IncomingMessage) => void): this;
|
|
1452
|
-
off(event: 'error', cb: (this: Server<T>, error: Error) => void): this;
|
|
1453
|
-
off(event: 'headers', cb: (this: Server<T>, headers: string[], request: http.IncomingMessage) => void): this;
|
|
1454
|
-
off(event: 'close' | 'listening', cb: (this: Server<T>) => void): this;
|
|
1455
|
-
off(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;
|
|
1456
|
-
addListener(event: 'connection', cb: (client: T, request: http.IncomingMessage) => void): this;
|
|
1443
|
+
on(event: 'connection', cb: (this: Server<T$1>, socket: T$1, request: http.IncomingMessage) => void): this;
|
|
1444
|
+
on(event: 'error', cb: (this: Server<T$1>, error: Error) => void): this;
|
|
1445
|
+
on(event: 'headers', cb: (this: Server<T$1>, headers: string[], request: http.IncomingMessage) => void): this;
|
|
1446
|
+
on(event: 'close' | 'listening', cb: (this: Server<T$1>) => void): this;
|
|
1447
|
+
on(event: string | symbol, listener: (this: Server<T$1>, ...args: any[]) => void): this;
|
|
1448
|
+
once(event: 'connection', cb: (this: Server<T$1>, socket: T$1, request: http.IncomingMessage) => void): this;
|
|
1449
|
+
once(event: 'error', cb: (this: Server<T$1>, error: Error) => void): this;
|
|
1450
|
+
once(event: 'headers', cb: (this: Server<T$1>, headers: string[], request: http.IncomingMessage) => void): this;
|
|
1451
|
+
once(event: 'close' | 'listening', cb: (this: Server<T$1>) => void): this;
|
|
1452
|
+
once(event: string | symbol, listener: (this: Server<T$1>, ...args: any[]) => void): this;
|
|
1453
|
+
off(event: 'connection', cb: (this: Server<T$1>, socket: T$1, request: http.IncomingMessage) => void): this;
|
|
1454
|
+
off(event: 'error', cb: (this: Server<T$1>, error: Error) => void): this;
|
|
1455
|
+
off(event: 'headers', cb: (this: Server<T$1>, headers: string[], request: http.IncomingMessage) => void): this;
|
|
1456
|
+
off(event: 'close' | 'listening', cb: (this: Server<T$1>) => void): this;
|
|
1457
|
+
off(event: string | symbol, listener: (this: Server<T$1>, ...args: any[]) => void): this;
|
|
1458
|
+
addListener(event: 'connection', cb: (client: T$1, request: http.IncomingMessage) => void): this;
|
|
1457
1459
|
addListener(event: 'error', cb: (err: Error) => void): this;
|
|
1458
1460
|
addListener(event: 'headers', cb: (headers: string[], request: http.IncomingMessage) => void): this;
|
|
1459
1461
|
addListener(event: 'close' | 'listening', cb: () => void): this;
|
|
1460
1462
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1461
|
-
removeListener(event: 'connection', cb: (client: T) => void): this;
|
|
1463
|
+
removeListener(event: 'connection', cb: (client: T$1) => void): this;
|
|
1462
1464
|
removeListener(event: 'error', cb: (err: Error) => void): this;
|
|
1463
1465
|
removeListener(event: 'headers', cb: (headers: string[], request: http.IncomingMessage) => void): this;
|
|
1464
1466
|
removeListener(event: 'close' | 'listening', cb: () => void): this;
|
|
@@ -1476,40 +1478,40 @@ declare namespace WebSocket {
|
|
|
1476
1478
|
// export = WebSocket
|
|
1477
1479
|
//#endregion
|
|
1478
1480
|
//#region src/node/server/ws.d.ts
|
|
1479
|
-
type WebSocketCustomListener<T> = (data: T, client: WebSocketClient
|
|
1481
|
+
type WebSocketCustomListener<T$1> = (data: T$1, client: WebSocketClient) => void;
|
|
1480
1482
|
declare const isWebSocketServer: unique symbol;
|
|
1481
1483
|
interface WebSocketServer extends NormalizedHotChannel {
|
|
1482
1484
|
/**
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
on: WebSocket.Server[
|
|
1486
|
-
<T extends string>(event: T, listener: WebSocketCustomListener<hmrPayload_InferCustomEventPayload<T>>): void;
|
|
1485
|
+
* Handle custom event emitted by `import.meta.hot.send`
|
|
1486
|
+
*/
|
|
1487
|
+
on: WebSocket.Server["on"] & {
|
|
1488
|
+
<T$1 extends string>(event: T$1, listener: WebSocketCustomListener<hmrPayload_InferCustomEventPayload<T$1>>): void;
|
|
1487
1489
|
};
|
|
1488
1490
|
/**
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
off: WebSocket.Server[
|
|
1491
|
+
* Unregister event listener.
|
|
1492
|
+
*/
|
|
1493
|
+
off: WebSocket.Server["off"] & {
|
|
1492
1494
|
(event: string, listener: Function): void;
|
|
1493
1495
|
};
|
|
1494
1496
|
/**
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
+
* Listen on port and host
|
|
1498
|
+
*/
|
|
1497
1499
|
listen(): void;
|
|
1498
1500
|
/**
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
+
* Disconnect all clients and terminate the server.
|
|
1502
|
+
*/
|
|
1501
1503
|
close(): Promise<void>;
|
|
1502
1504
|
[isWebSocketServer]: true;
|
|
1503
1505
|
/**
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
+
* Get all connected clients.
|
|
1507
|
+
*/
|
|
1506
1508
|
clients: Set<WebSocketClient>;
|
|
1507
1509
|
}
|
|
1508
1510
|
interface WebSocketClient extends NormalizedHotChannelClient {
|
|
1509
1511
|
/**
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1512
|
+
* The raw WebSocket instance
|
|
1513
|
+
* @advanced
|
|
1514
|
+
*/
|
|
1513
1515
|
socket: WebSocket;
|
|
1514
1516
|
}
|
|
1515
1517
|
//#endregion
|
|
@@ -1529,43 +1531,43 @@ declare class DevEnvironment extends BaseEnvironment {
|
|
|
1529
1531
|
depsOptimizer?: DepsOptimizer;
|
|
1530
1532
|
get pluginContainer(): EnvironmentPluginContainer<DevEnvironment>;
|
|
1531
1533
|
/**
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1534
|
+
* Hot channel for this environment. If not provided or disabled,
|
|
1535
|
+
* it will be a noop channel that does nothing.
|
|
1536
|
+
*
|
|
1537
|
+
* @example
|
|
1538
|
+
* environment.hot.send({ type: 'full-reload' })
|
|
1539
|
+
*/
|
|
1538
1540
|
hot: NormalizedHotChannel;
|
|
1539
1541
|
constructor(name: string, config: ResolvedConfig, context: DevEnvironmentContext);
|
|
1540
1542
|
init(options?: {
|
|
1541
1543
|
watcher?: FSWatcher;
|
|
1542
1544
|
/**
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1545
|
+
* the previous instance used for the environment with the same name
|
|
1546
|
+
*
|
|
1547
|
+
* when using, the consumer should check if it's an instance generated from the same class or factory function
|
|
1548
|
+
*/
|
|
1547
1549
|
previousInstance?: DevEnvironment;
|
|
1548
1550
|
}): Promise<void>;
|
|
1549
1551
|
/**
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1552
|
+
* When the dev server is restarted, the methods are called in the following order:
|
|
1553
|
+
* - new instance `init`
|
|
1554
|
+
* - previous instance `close`
|
|
1555
|
+
* - new instance `listen`
|
|
1556
|
+
*/
|
|
1555
1557
|
listen(server: ViteDevServer): Promise<void>;
|
|
1556
1558
|
fetchModule(id: string, importer?: string, options?: FetchFunctionOptions): Promise<moduleRunner_FetchResult>;
|
|
1557
1559
|
reloadModule(module: EnvironmentModuleNode): Promise<void>;
|
|
1558
|
-
transformRequest(url: string, ): Promise<TransformResult | null>;
|
|
1560
|
+
transformRequest(url: string, options?: TransformOptionsInternal): Promise<TransformResult | null>;
|
|
1559
1561
|
warmupRequest(url: string): Promise<void>;
|
|
1560
1562
|
close(): Promise<void>;
|
|
1561
1563
|
/**
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1564
|
+
* Calling `await environment.waitForRequestsIdle(id)` will wait until all static imports
|
|
1565
|
+
* are processed after the first transformRequest call. If called from a load or transform
|
|
1566
|
+
* plugin hook, the id needs to be passed as a parameter to avoid deadlocks.
|
|
1567
|
+
* Calling this function after the first static imports section of the module graph has been
|
|
1568
|
+
* processed will resolve immediately.
|
|
1569
|
+
* @experimental
|
|
1570
|
+
*/
|
|
1569
1571
|
waitForRequestsIdle(ignoredId?: string): Promise<void>;
|
|
1570
1572
|
}
|
|
1571
1573
|
//#endregion
|
|
@@ -1808,48 +1810,48 @@ interface RollupDynamicImportVarsOptions {
|
|
|
1808
1810
|
//#region src/node/plugins/terser.d.ts
|
|
1809
1811
|
interface TerserOptions extends TerserMinifyOptions {
|
|
1810
1812
|
/**
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1813
|
+
* Vite-specific option to specify the max number of workers to spawn
|
|
1814
|
+
* when minifying files with terser.
|
|
1815
|
+
*
|
|
1816
|
+
* @default number of CPUs minus 1
|
|
1817
|
+
*/
|
|
1816
1818
|
maxWorkers?: number;
|
|
1817
1819
|
}
|
|
1818
1820
|
//#endregion
|
|
1819
1821
|
//#region src/node/plugins/resolve.d.ts
|
|
1820
1822
|
interface EnvironmentResolveOptions {
|
|
1821
1823
|
/**
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
+
* @default ['browser', 'module', 'jsnext:main', 'jsnext']
|
|
1825
|
+
*/
|
|
1824
1826
|
mainFields?: string[];
|
|
1825
1827
|
conditions?: string[];
|
|
1826
1828
|
externalConditions?: string[];
|
|
1827
1829
|
/**
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
+
* @default ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']
|
|
1831
|
+
*/
|
|
1830
1832
|
extensions?: string[];
|
|
1831
1833
|
dedupe?: string[];
|
|
1832
1834
|
/**
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1835
|
+
* Prevent listed dependencies from being externalized and will get bundled in build.
|
|
1836
|
+
* Only works in server environments for now. Previously this was `ssr.noExternal`.
|
|
1837
|
+
* @experimental
|
|
1838
|
+
*/
|
|
1837
1839
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
|
1838
1840
|
/**
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1841
|
+
* Externalize the given dependencies and their transitive dependencies.
|
|
1842
|
+
* Only works in server environments for now. Previously this was `ssr.external`.
|
|
1843
|
+
* @experimental
|
|
1844
|
+
*/
|
|
1843
1845
|
external?: string[] | true;
|
|
1844
1846
|
/**
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
+
* Array of strings or regular expressions that indicate what modules are builtin for the environment.
|
|
1848
|
+
*/
|
|
1847
1849
|
builtins?: (string | RegExp)[];
|
|
1848
1850
|
}
|
|
1849
1851
|
interface ResolveOptions extends EnvironmentResolveOptions {
|
|
1850
1852
|
/**
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
+
* @default false
|
|
1854
|
+
*/
|
|
1853
1855
|
preserveSymlinks?: boolean;
|
|
1854
1856
|
}
|
|
1855
1857
|
interface ResolvePluginOptions {
|
|
@@ -1858,10 +1860,10 @@ interface ResolvePluginOptions {
|
|
|
1858
1860
|
isProduction: boolean;
|
|
1859
1861
|
packageCache?: PackageCache;
|
|
1860
1862
|
/**
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1863
|
+
* src code mode also attempts the following:
|
|
1864
|
+
* - resolving /xxx as URLs
|
|
1865
|
+
* - resolving bare imports from optimized deps
|
|
1866
|
+
*/
|
|
1865
1867
|
asSrc?: boolean;
|
|
1866
1868
|
tryIndex?: boolean;
|
|
1867
1869
|
tryPrefix?: string;
|
|
@@ -1876,7 +1878,7 @@ interface InternalResolveOptions extends Required<ResolveOptions>, ResolvePlugin
|
|
|
1876
1878
|
type PackageCache = Map<string, PackageData>;
|
|
1877
1879
|
interface PackageData {
|
|
1878
1880
|
dir: string;
|
|
1879
|
-
hasSideEffects: (id: string) => boolean |
|
|
1881
|
+
hasSideEffects: (id: string) => boolean | "no-treeshake" | null;
|
|
1880
1882
|
setResolvedCache: (key: string, entry: string, options: InternalResolveOptions) => void;
|
|
1881
1883
|
getResolvedCache: (key: string, options: InternalResolveOptions) => string | undefined;
|
|
1882
1884
|
data: {
|
|
@@ -1893,244 +1895,261 @@ interface PackageData {
|
|
|
1893
1895
|
};
|
|
1894
1896
|
}
|
|
1895
1897
|
//#endregion
|
|
1898
|
+
//#region src/node/plugins/license.d.ts
|
|
1899
|
+
interface LicenseOptions {
|
|
1900
|
+
/**
|
|
1901
|
+
* The output file name of the license file relative to the output directory.
|
|
1902
|
+
* Specify a path that ends with `.json` to output the raw JSON metadata.
|
|
1903
|
+
*
|
|
1904
|
+
* @default '.vite/license.md'
|
|
1905
|
+
*/
|
|
1906
|
+
fileName: string;
|
|
1907
|
+
}
|
|
1908
|
+
//#endregion
|
|
1896
1909
|
//#region src/node/build.d.ts
|
|
1897
1910
|
interface BuildEnvironmentOptions {
|
|
1898
1911
|
/**
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
target?:
|
|
1915
|
-
/**
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1912
|
+
* Compatibility transform target. The transform is performed with esbuild
|
|
1913
|
+
* and the lowest supported target is es2015. Note this only handles
|
|
1914
|
+
* syntax transformation and does not cover polyfills
|
|
1915
|
+
*
|
|
1916
|
+
* Default: 'baseline-widely-available' - transpile targeting browsers that
|
|
1917
|
+
* are included in the Baseline Widely Available on 2025-05-01.
|
|
1918
|
+
* (Chrome 107+, Edge 107+, Firefox 104+, Safari 16+).
|
|
1919
|
+
*
|
|
1920
|
+
* Another special value is 'esnext' - which only performs minimal transpiling
|
|
1921
|
+
* (for minification compat).
|
|
1922
|
+
*
|
|
1923
|
+
* For custom targets, see https://esbuild.github.io/api/#target and
|
|
1924
|
+
* https://esbuild.github.io/content-types/#javascript for more details.
|
|
1925
|
+
* @default 'baseline-widely-available'
|
|
1926
|
+
*/
|
|
1927
|
+
target?: "baseline-widely-available" | esbuild_TransformOptions["target"] | false;
|
|
1928
|
+
/**
|
|
1929
|
+
* whether to inject module preload polyfill.
|
|
1930
|
+
* Note: does not apply to library mode.
|
|
1931
|
+
* @default true
|
|
1932
|
+
* @deprecated use `modulePreload.polyfill` instead
|
|
1933
|
+
*/
|
|
1921
1934
|
polyfillModulePreload?: boolean;
|
|
1922
1935
|
/**
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1936
|
+
* Configure module preload
|
|
1937
|
+
* Note: does not apply to library mode.
|
|
1938
|
+
* @default true
|
|
1939
|
+
*/
|
|
1927
1940
|
modulePreload?: boolean | ModulePreloadOptions;
|
|
1928
1941
|
/**
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1942
|
+
* Directory relative from `root` where build output will be placed. If the
|
|
1943
|
+
* directory exists, it will be removed before the build.
|
|
1944
|
+
* @default 'dist'
|
|
1945
|
+
*/
|
|
1933
1946
|
outDir?: string;
|
|
1934
1947
|
/**
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1948
|
+
* Directory relative from `outDir` where the built js/css/image assets will
|
|
1949
|
+
* be placed.
|
|
1950
|
+
* @default 'assets'
|
|
1951
|
+
*/
|
|
1939
1952
|
assetsDir?: string;
|
|
1940
1953
|
/**
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1954
|
+
* Static asset files smaller than this number (in bytes) will be inlined as
|
|
1955
|
+
* base64 strings. If a callback is passed, a boolean can be returned to opt-in
|
|
1956
|
+
* or opt-out of inlining. If nothing is returned the default logic applies.
|
|
1957
|
+
*
|
|
1958
|
+
* Default limit is `4096` (4 KiB). Set to `0` to disable.
|
|
1959
|
+
* @default 4096
|
|
1960
|
+
*/
|
|
1948
1961
|
assetsInlineLimit?: number | ((filePath: string, content: Buffer) => boolean | undefined);
|
|
1949
1962
|
/**
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1963
|
+
* Whether to code-split CSS. When enabled, CSS in async chunks will be
|
|
1964
|
+
* inlined as strings in the chunk and inserted via dynamically created
|
|
1965
|
+
* style tags when the chunk is loaded.
|
|
1966
|
+
* @default true
|
|
1967
|
+
*/
|
|
1955
1968
|
cssCodeSplit?: boolean;
|
|
1956
1969
|
/**
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
cssTarget?: esbuild_TransformOptions[
|
|
1966
|
-
/**
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
cssMinify?: boolean |
|
|
1972
|
-
/**
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
sourcemap?: boolean |
|
|
1980
|
-
/**
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
minify?: boolean |
|
|
1986
|
-
/**
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1970
|
+
* An optional separate target for CSS minification.
|
|
1971
|
+
* As esbuild only supports configuring targets to mainstream
|
|
1972
|
+
* browsers, users may need this option when they are targeting
|
|
1973
|
+
* a niche browser that comes with most modern JavaScript features
|
|
1974
|
+
* but has poor CSS support, e.g. Android WeChat WebView, which
|
|
1975
|
+
* doesn't support the #RGBA syntax.
|
|
1976
|
+
* @default target
|
|
1977
|
+
*/
|
|
1978
|
+
cssTarget?: esbuild_TransformOptions["target"] | false;
|
|
1979
|
+
/**
|
|
1980
|
+
* Override CSS minification specifically instead of defaulting to `build.minify`,
|
|
1981
|
+
* so you can configure minification for JS and CSS separately.
|
|
1982
|
+
* @default 'esbuild'
|
|
1983
|
+
*/
|
|
1984
|
+
cssMinify?: boolean | "esbuild" | "lightningcss";
|
|
1985
|
+
/**
|
|
1986
|
+
* If `true`, a separate sourcemap file will be created. If 'inline', the
|
|
1987
|
+
* sourcemap will be appended to the resulting output file as data URI.
|
|
1988
|
+
* 'hidden' works like `true` except that the corresponding sourcemap
|
|
1989
|
+
* comments in the bundled files are suppressed.
|
|
1990
|
+
* @default false
|
|
1991
|
+
*/
|
|
1992
|
+
sourcemap?: boolean | "inline" | "hidden";
|
|
1993
|
+
/**
|
|
1994
|
+
* Set to `false` to disable minification, or specify the minifier to use.
|
|
1995
|
+
* Available options are 'terser' or 'esbuild'.
|
|
1996
|
+
* @default 'esbuild'
|
|
1997
|
+
*/
|
|
1998
|
+
minify?: boolean | "terser" | "esbuild";
|
|
1999
|
+
/**
|
|
2000
|
+
* Options for terser
|
|
2001
|
+
* https://terser.org/docs/api-reference#minify-options
|
|
2002
|
+
*
|
|
2003
|
+
* In addition, you can also pass a `maxWorkers: number` option to specify the
|
|
2004
|
+
* max number of workers to spawn. Defaults to the number of CPUs minus 1.
|
|
2005
|
+
*/
|
|
1993
2006
|
terserOptions?: TerserOptions;
|
|
1994
2007
|
/**
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2008
|
+
* Will be merged with internal rollup options.
|
|
2009
|
+
* https://rollupjs.org/configuration-options/
|
|
2010
|
+
*/
|
|
1998
2011
|
rollupOptions?: RollupOptions;
|
|
1999
2012
|
/**
|
|
2000
|
-
|
|
2001
|
-
|
|
2013
|
+
* Options to pass on to `@rollup/plugin-commonjs`
|
|
2014
|
+
*/
|
|
2002
2015
|
commonjsOptions?: RollupCommonJSOptions;
|
|
2003
2016
|
/**
|
|
2004
|
-
|
|
2005
|
-
|
|
2017
|
+
* Options to pass on to `@rollup/plugin-dynamic-import-vars`
|
|
2018
|
+
*/
|
|
2006
2019
|
dynamicImportVarsOptions?: RollupDynamicImportVarsOptions;
|
|
2007
2020
|
/**
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2021
|
+
* Whether to write bundle to disk
|
|
2022
|
+
* @default true
|
|
2023
|
+
*/
|
|
2011
2024
|
write?: boolean;
|
|
2012
2025
|
/**
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2026
|
+
* Empty outDir on write.
|
|
2027
|
+
* @default true when outDir is a sub directory of project root
|
|
2028
|
+
*/
|
|
2016
2029
|
emptyOutDir?: boolean | null;
|
|
2017
2030
|
/**
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2031
|
+
* Copy the public directory to outDir on write.
|
|
2032
|
+
* @default true
|
|
2033
|
+
*/
|
|
2021
2034
|
copyPublicDir?: boolean;
|
|
2022
2035
|
/**
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2036
|
+
* Whether to emit a `.vite/license.md` file that includes all bundled dependencies'
|
|
2037
|
+
* licenses. Pass an object to customize the output file name.
|
|
2038
|
+
* @default false
|
|
2039
|
+
*/
|
|
2040
|
+
license?: boolean | LicenseOptions;
|
|
2041
|
+
/**
|
|
2042
|
+
* Whether to emit a .vite/manifest.json in the output dir to map hash-less filenames
|
|
2043
|
+
* to their hashed versions. Useful when you want to generate your own HTML
|
|
2044
|
+
* instead of using the one generated by Vite.
|
|
2045
|
+
*
|
|
2046
|
+
* Example:
|
|
2047
|
+
*
|
|
2048
|
+
* ```json
|
|
2049
|
+
* {
|
|
2050
|
+
* "main.js": {
|
|
2051
|
+
* "file": "main.68fe3fad.js",
|
|
2052
|
+
* "css": "main.e6b63442.css",
|
|
2053
|
+
* "imports": [...],
|
|
2054
|
+
* "dynamicImports": [...]
|
|
2055
|
+
* }
|
|
2056
|
+
* }
|
|
2057
|
+
* ```
|
|
2058
|
+
* @default false
|
|
2059
|
+
*/
|
|
2041
2060
|
manifest?: boolean | string;
|
|
2042
2061
|
/**
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2062
|
+
* Build in library mode. The value should be the global name of the lib in
|
|
2063
|
+
* UMD mode. This will produce esm + cjs + umd bundle formats with default
|
|
2064
|
+
* configurations that are suitable for distributing libraries.
|
|
2065
|
+
* @default false
|
|
2066
|
+
*/
|
|
2048
2067
|
lib?: LibraryOptions | false;
|
|
2049
2068
|
/**
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2069
|
+
* Produce SSR oriented build. Note this requires specifying SSR entry via
|
|
2070
|
+
* `rollupOptions.input`.
|
|
2071
|
+
* @default false
|
|
2072
|
+
*/
|
|
2054
2073
|
ssr?: boolean | string;
|
|
2055
2074
|
/**
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2075
|
+
* Generate SSR manifest for determining style links and asset preload
|
|
2076
|
+
* directives in production.
|
|
2077
|
+
* @default false
|
|
2078
|
+
*/
|
|
2060
2079
|
ssrManifest?: boolean | string;
|
|
2061
2080
|
/**
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2081
|
+
* Emit assets during SSR.
|
|
2082
|
+
* @default false
|
|
2083
|
+
*/
|
|
2065
2084
|
ssrEmitAssets?: boolean;
|
|
2066
2085
|
/**
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2086
|
+
* Emit assets during build. Frameworks can set environments.ssr.build.emitAssets
|
|
2087
|
+
* By default, it is true for the client and false for other environments.
|
|
2088
|
+
*/
|
|
2070
2089
|
emitAssets?: boolean;
|
|
2071
2090
|
/**
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2091
|
+
* Set to false to disable reporting compressed chunk sizes.
|
|
2092
|
+
* Can slightly improve build speed.
|
|
2093
|
+
* @default true
|
|
2094
|
+
*/
|
|
2076
2095
|
reportCompressedSize?: boolean;
|
|
2077
2096
|
/**
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2097
|
+
* Adjust chunk size warning limit (in kB).
|
|
2098
|
+
* @default 500
|
|
2099
|
+
*/
|
|
2081
2100
|
chunkSizeWarningLimit?: number;
|
|
2082
2101
|
/**
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2102
|
+
* Rollup watch options
|
|
2103
|
+
* https://rollupjs.org/configuration-options/#watch
|
|
2104
|
+
* @default null
|
|
2105
|
+
*/
|
|
2087
2106
|
watch?: WatcherOptions | null;
|
|
2088
2107
|
/**
|
|
2089
|
-
|
|
2090
|
-
|
|
2108
|
+
* create the Build Environment instance
|
|
2109
|
+
*/
|
|
2091
2110
|
createEnvironment?: (name: string, config: ResolvedConfig) => Promise<BuildEnvironment> | BuildEnvironment;
|
|
2092
2111
|
}
|
|
2093
2112
|
type BuildOptions = BuildEnvironmentOptions;
|
|
2094
2113
|
interface LibraryOptions {
|
|
2095
2114
|
/**
|
|
2096
|
-
|
|
2097
|
-
|
|
2115
|
+
* Path of library entry
|
|
2116
|
+
*/
|
|
2098
2117
|
entry: InputOption;
|
|
2099
2118
|
/**
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2119
|
+
* The name of the exposed global variable. Required when the `formats` option includes
|
|
2120
|
+
* `umd` or `iife`
|
|
2121
|
+
*/
|
|
2103
2122
|
name?: string;
|
|
2104
2123
|
/**
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2124
|
+
* Output bundle formats
|
|
2125
|
+
* @default ['es', 'umd']
|
|
2126
|
+
*/
|
|
2108
2127
|
formats?: LibraryFormats[];
|
|
2109
2128
|
/**
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2129
|
+
* The name of the package file output. The default file name is the name option
|
|
2130
|
+
* of the project package.json. It can also be defined as a function taking the
|
|
2131
|
+
* format as an argument.
|
|
2132
|
+
*/
|
|
2114
2133
|
fileName?: string | ((format: ModuleFormat, entryName: string) => string);
|
|
2115
2134
|
/**
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2135
|
+
* The name of the CSS file output if the library imports CSS. Defaults to the
|
|
2136
|
+
* same value as `build.lib.fileName` if it's set a string, otherwise it falls
|
|
2137
|
+
* back to the name option of the project package.json.
|
|
2138
|
+
*/
|
|
2120
2139
|
cssFileName?: string;
|
|
2121
2140
|
}
|
|
2122
|
-
type LibraryFormats =
|
|
2141
|
+
type LibraryFormats = "es" | "cjs" | "umd" | "iife" | "system";
|
|
2123
2142
|
interface ModulePreloadOptions {
|
|
2124
2143
|
/**
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2144
|
+
* Whether to inject a module preload polyfill.
|
|
2145
|
+
* Note: does not apply to library mode.
|
|
2146
|
+
* @default true
|
|
2147
|
+
*/
|
|
2129
2148
|
polyfill?: boolean;
|
|
2130
2149
|
/**
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2150
|
+
* Resolve the list of dependencies to preload for a given dynamic import
|
|
2151
|
+
* @experimental
|
|
2152
|
+
*/
|
|
2134
2153
|
resolveDependencies?: ResolveModulePreloadDependenciesFn;
|
|
2135
2154
|
}
|
|
2136
2155
|
interface ResolvedModulePreloadOptions {
|
|
@@ -2139,23 +2158,23 @@ interface ResolvedModulePreloadOptions {
|
|
|
2139
2158
|
}
|
|
2140
2159
|
type ResolveModulePreloadDependenciesFn = (filename: string, deps: string[], context: {
|
|
2141
2160
|
hostId: string;
|
|
2142
|
-
hostType:
|
|
2161
|
+
hostType: "html" | "js";
|
|
2143
2162
|
}) => string[];
|
|
2144
|
-
interface ResolvedBuildEnvironmentOptions extends Required<Omit<BuildEnvironmentOptions,
|
|
2163
|
+
interface ResolvedBuildEnvironmentOptions extends Required<Omit<BuildEnvironmentOptions, "polyfillModulePreload">> {
|
|
2145
2164
|
modulePreload: false | ResolvedModulePreloadOptions;
|
|
2146
2165
|
}
|
|
2147
|
-
interface ResolvedBuildOptions extends Required<Omit<BuildOptions,
|
|
2166
|
+
interface ResolvedBuildOptions extends Required<Omit<BuildOptions, "polyfillModulePreload">> {
|
|
2148
2167
|
modulePreload: false | ResolvedModulePreloadOptions;
|
|
2149
2168
|
}
|
|
2150
2169
|
/**
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2170
|
+
* Bundles a single environment for production.
|
|
2171
|
+
* Returns a Promise containing the build result.
|
|
2172
|
+
*/
|
|
2154
2173
|
declare function build(inlineConfig?: InlineConfig): Promise<RollupOutput | RollupOutput[] | RollupWatcher>;
|
|
2155
2174
|
type RenderBuiltAssetUrl = (filename: string, type: {
|
|
2156
|
-
type:
|
|
2175
|
+
type: "asset" | "public";
|
|
2157
2176
|
hostId: string;
|
|
2158
|
-
hostType:
|
|
2177
|
+
hostType: "js" | "css" | "html";
|
|
2159
2178
|
ssr: boolean;
|
|
2160
2179
|
}) => string | {
|
|
2161
2180
|
relative?: boolean;
|
|
@@ -2177,58 +2196,55 @@ interface ViteBuilder {
|
|
|
2177
2196
|
}
|
|
2178
2197
|
interface BuilderOptions {
|
|
2179
2198
|
/**
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2199
|
+
* Whether to share the config instance among environments to align with the behavior of dev server.
|
|
2200
|
+
*
|
|
2201
|
+
* @default false
|
|
2202
|
+
* @experimental
|
|
2203
|
+
*/
|
|
2185
2204
|
sharedConfigBuild?: boolean;
|
|
2186
2205
|
/**
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2206
|
+
* Whether to share the plugin instances among environments to align with the behavior of dev server.
|
|
2207
|
+
*
|
|
2208
|
+
* @default false
|
|
2209
|
+
* @experimental
|
|
2210
|
+
*/
|
|
2192
2211
|
sharedPlugins?: boolean;
|
|
2193
2212
|
buildApp?: (builder: ViteBuilder) => Promise<void>;
|
|
2194
2213
|
}
|
|
2195
2214
|
type ResolvedBuilderOptions = Required<BuilderOptions>;
|
|
2196
2215
|
/**
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2216
|
+
* Creates a ViteBuilder to orchestrate building multiple environments.
|
|
2217
|
+
* @experimental
|
|
2218
|
+
*/
|
|
2200
2219
|
declare function createBuilder(inlineConfig?: InlineConfig, useLegacyBuilder?: null | boolean): Promise<ViteBuilder>;
|
|
2201
2220
|
type BuildAppHook = (this: MinimalPluginContextWithoutEnvironment, builder: ViteBuilder) => Promise<void>;
|
|
2202
2221
|
//#endregion
|
|
2203
2222
|
//#region src/node/environment.d.ts
|
|
2204
|
-
type Environment = DevEnvironment | BuildEnvironment |
|
|
2223
|
+
type Environment = DevEnvironment | BuildEnvironment | ScanEnvironment | UnknownEnvironment;
|
|
2205
2224
|
/**
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2225
|
+
* Creates a function that hides the complexities of a WeakMap with an initial value
|
|
2226
|
+
* to implement object metadata. Used by plugins to implement cross hooks per
|
|
2227
|
+
* environment metadata
|
|
2228
|
+
*
|
|
2229
|
+
* @experimental
|
|
2230
|
+
*/
|
|
2212
2231
|
declare function perEnvironmentState<State>(initial: (environment: Environment) => State): (context: PluginContext) => State;
|
|
2213
2232
|
//#endregion
|
|
2214
2233
|
//#region src/node/server/pluginContainer.d.ts
|
|
2215
2234
|
type SkipInformation = {
|
|
2216
2235
|
id: string;
|
|
2217
2236
|
importer: string | undefined;
|
|
2218
|
-
plugin: Plugin
|
|
2237
|
+
plugin: Plugin;
|
|
2219
2238
|
called?: boolean;
|
|
2220
2239
|
};
|
|
2221
2240
|
declare class EnvironmentPluginContainer<Env extends Environment = Environment> {
|
|
2222
|
-
environment: Env;
|
|
2223
|
-
plugins: readonly Plugin$1[];
|
|
2224
|
-
watcher?: FSWatcher | undefined;
|
|
2225
2241
|
private _pluginContextMap;
|
|
2226
2242
|
private _resolvedRollupOptions?;
|
|
2227
2243
|
private _processesing;
|
|
2228
2244
|
private _seenResolves;
|
|
2229
2245
|
private _moduleNodeToLoadAddedImports;
|
|
2230
|
-
getSortedPluginHooks: PluginHookUtils[
|
|
2231
|
-
getSortedPlugins: PluginHookUtils[
|
|
2246
|
+
getSortedPluginHooks: PluginHookUtils["getSortedPluginHooks"];
|
|
2247
|
+
getSortedPlugins: PluginHookUtils["getSortedPlugins"];
|
|
2232
2248
|
moduleGraph: EnvironmentModuleGraph | undefined;
|
|
2233
2249
|
watchFiles: Set<string>;
|
|
2234
2250
|
minimalContext: MinimalPluginContext$1<Env>;
|
|
@@ -2248,21 +2264,22 @@ declare class EnvironmentPluginContainer<Env extends Environment = Environment>
|
|
|
2248
2264
|
attributes?: Record<string, string>;
|
|
2249
2265
|
custom?: CustomPluginOptions;
|
|
2250
2266
|
/** @deprecated use `skipCalls` instead */
|
|
2251
|
-
skip?: Set<Plugin
|
|
2267
|
+
skip?: Set<Plugin>;
|
|
2252
2268
|
skipCalls?: readonly SkipInformation[];
|
|
2269
|
+
|
|
2253
2270
|
isEntry?: boolean;
|
|
2254
2271
|
}): Promise<PartialResolvedId | null>;
|
|
2255
2272
|
load(id: string): Promise<LoadResult | null>;
|
|
2256
2273
|
transform(code: string, id: string, options?: {
|
|
2257
|
-
inMap?: SourceDescription[
|
|
2274
|
+
inMap?: SourceDescription["map"];
|
|
2258
2275
|
}): Promise<{
|
|
2259
2276
|
code: string;
|
|
2260
2277
|
map: SourceMap | {
|
|
2261
|
-
mappings:
|
|
2278
|
+
mappings: "";
|
|
2262
2279
|
} | null;
|
|
2263
2280
|
}>;
|
|
2264
2281
|
watchChange(id: string, change: {
|
|
2265
|
-
event:
|
|
2282
|
+
event: "create" | "update" | "delete";
|
|
2266
2283
|
}): Promise<void>;
|
|
2267
2284
|
close(): Promise<void>;
|
|
2268
2285
|
}
|
|
@@ -2276,9 +2293,9 @@ declare class BasicMinimalPluginContext<Meta = PluginContextMeta> {
|
|
|
2276
2293
|
error(e: string | RollupError): never;
|
|
2277
2294
|
private _normalizeRawLog;
|
|
2278
2295
|
}
|
|
2279
|
-
declare class MinimalPluginContext$1<T extends Environment = Environment> extends BasicMinimalPluginContext implements MinimalPluginContext {
|
|
2280
|
-
environment: T;
|
|
2281
|
-
constructor(meta: PluginContextMeta, environment: T);
|
|
2296
|
+
declare class MinimalPluginContext$1<T$1 extends Environment = Environment> extends BasicMinimalPluginContext implements MinimalPluginContext {
|
|
2297
|
+
environment: T$1;
|
|
2298
|
+
constructor(meta: PluginContextMeta, environment: T$1);
|
|
2282
2299
|
}
|
|
2283
2300
|
declare class PluginContainer {
|
|
2284
2301
|
private environments;
|
|
@@ -2289,15 +2306,16 @@ declare class PluginContainer {
|
|
|
2289
2306
|
get options(): InputOptions;
|
|
2290
2307
|
buildStart(_options?: InputOptions): Promise<void>;
|
|
2291
2308
|
watchChange(id: string, change: {
|
|
2292
|
-
event:
|
|
2309
|
+
event: "create" | "update" | "delete";
|
|
2293
2310
|
}): Promise<void>;
|
|
2294
2311
|
resolveId(rawId: string, importer?: string, options?: {
|
|
2295
2312
|
attributes?: Record<string, string>;
|
|
2296
2313
|
custom?: CustomPluginOptions;
|
|
2297
2314
|
/** @deprecated use `skipCalls` instead */
|
|
2298
|
-
skip?: Set<Plugin
|
|
2315
|
+
skip?: Set<Plugin>;
|
|
2299
2316
|
skipCalls?: readonly SkipInformation[];
|
|
2300
2317
|
ssr?: boolean;
|
|
2318
|
+
|
|
2301
2319
|
isEntry?: boolean;
|
|
2302
2320
|
}): Promise<PartialResolvedId | null>;
|
|
2303
2321
|
load(id: string, options?: {
|
|
@@ -2306,261 +2324,268 @@ declare class PluginContainer {
|
|
|
2306
2324
|
transform(code: string, id: string, options?: {
|
|
2307
2325
|
ssr?: boolean;
|
|
2308
2326
|
environment?: Environment;
|
|
2309
|
-
inMap?: SourceDescription[
|
|
2327
|
+
inMap?: SourceDescription["map"];
|
|
2310
2328
|
}): Promise<{
|
|
2311
2329
|
code: string;
|
|
2312
2330
|
map: SourceMap | {
|
|
2313
|
-
mappings:
|
|
2331
|
+
mappings: "";
|
|
2314
2332
|
} | null;
|
|
2315
2333
|
}>;
|
|
2316
2334
|
close(): Promise<void>;
|
|
2317
2335
|
}
|
|
2318
2336
|
/**
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2337
|
+
* server.pluginContainer compatibility
|
|
2338
|
+
*
|
|
2339
|
+
* The default environment is in buildStart, buildEnd, watchChange, and closeBundle hooks,
|
|
2340
|
+
* which are called once for all environments, or when no environment is passed in other hooks.
|
|
2341
|
+
* The ssrEnvironment is needed for backward compatibility when the ssr flag is passed without
|
|
2342
|
+
* an environment. The defaultEnvironment in the main pluginContainer in the server should be
|
|
2343
|
+
* the client environment for backward compatibility.
|
|
2344
|
+
**/
|
|
2327
2345
|
//#endregion
|
|
2328
2346
|
//#region src/node/server/index.d.ts
|
|
2329
2347
|
interface ServerOptions$1 extends CommonServerOptions {
|
|
2330
2348
|
/**
|
|
2331
|
-
|
|
2332
|
-
|
|
2349
|
+
* Configure HMR-specific options (port, host, path & protocol)
|
|
2350
|
+
*/
|
|
2333
2351
|
hmr?: HmrOptions | boolean;
|
|
2334
2352
|
/**
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2353
|
+
* Do not start the websocket connection.
|
|
2354
|
+
* @experimental
|
|
2355
|
+
*/
|
|
2338
2356
|
ws?: false;
|
|
2339
2357
|
/**
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2358
|
+
* Warm-up files to transform and cache the results in advance. This improves the
|
|
2359
|
+
* initial page load during server starts and prevents transform waterfalls.
|
|
2360
|
+
*/
|
|
2343
2361
|
warmup?: {
|
|
2344
2362
|
/**
|
|
2345
|
-
|
|
2346
|
-
|
|
2363
|
+
* The files to be transformed and used on the client-side. Supports glob patterns.
|
|
2364
|
+
*/
|
|
2347
2365
|
clientFiles?: string[];
|
|
2348
2366
|
/**
|
|
2349
|
-
|
|
2350
|
-
|
|
2367
|
+
* The files to be transformed and used in SSR. Supports glob patterns.
|
|
2368
|
+
*/
|
|
2351
2369
|
ssrFiles?: string[];
|
|
2352
2370
|
};
|
|
2353
2371
|
/**
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2372
|
+
* chokidar watch options or null to disable FS watching
|
|
2373
|
+
* https://github.com/paulmillr/chokidar/tree/3.6.0#api
|
|
2374
|
+
*/
|
|
2357
2375
|
watch?: WatchOptions | null;
|
|
2358
2376
|
/**
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2377
|
+
* Create Vite dev server to be used as a middleware in an existing server
|
|
2378
|
+
* @default false
|
|
2379
|
+
*/
|
|
2362
2380
|
middlewareMode?: boolean | {
|
|
2363
2381
|
/**
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2382
|
+
* Parent server instance to attach to
|
|
2383
|
+
*
|
|
2384
|
+
* This is needed to proxy WebSocket connections to the parent server.
|
|
2385
|
+
*/
|
|
2368
2386
|
server: HttpServer;
|
|
2369
2387
|
};
|
|
2370
2388
|
/**
|
|
2371
|
-
|
|
2372
|
-
|
|
2389
|
+
* Options for files served via '/\@fs/'.
|
|
2390
|
+
*/
|
|
2373
2391
|
fs?: FileSystemServeOptions;
|
|
2374
2392
|
/**
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2393
|
+
* Origin for the generated asset URLs.
|
|
2394
|
+
*
|
|
2395
|
+
* @example `http://127.0.0.1:8080`
|
|
2396
|
+
*/
|
|
2379
2397
|
origin?: string;
|
|
2380
2398
|
/**
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2399
|
+
* Pre-transform known direct imports
|
|
2400
|
+
* @default true
|
|
2401
|
+
*/
|
|
2384
2402
|
preTransformRequests?: boolean;
|
|
2385
2403
|
/**
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2404
|
+
* Whether or not to ignore-list source files in the dev server sourcemap, used to populate
|
|
2405
|
+
* the [`x_google_ignoreList` source map extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).
|
|
2406
|
+
*
|
|
2407
|
+
* By default, it excludes all paths containing `node_modules`. You can pass `false` to
|
|
2408
|
+
* disable this behavior, or, for full control, a function that takes the source path and
|
|
2409
|
+
* sourcemap path and returns whether to ignore the source path.
|
|
2410
|
+
*/
|
|
2393
2411
|
sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean);
|
|
2394
2412
|
/**
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2413
|
+
* Backward compatibility. The buildStart and buildEnd hooks were called only once for
|
|
2414
|
+
* the client environment. This option enables per-environment buildStart and buildEnd hooks.
|
|
2415
|
+
* @default false
|
|
2416
|
+
* @experimental
|
|
2417
|
+
*/
|
|
2400
2418
|
perEnvironmentStartEndDuringDev?: boolean;
|
|
2401
2419
|
/**
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2420
|
+
* Backward compatibility. The watchChange hook was called only once for the client environment.
|
|
2421
|
+
* This option enables per-environment watchChange hooks.
|
|
2422
|
+
* @default false
|
|
2423
|
+
* @experimental
|
|
2424
|
+
*/
|
|
2425
|
+
perEnvironmentWatchChangeDuringDev?: boolean;
|
|
2426
|
+
/**
|
|
2427
|
+
* Run HMR tasks, by default the HMR propagation is done in parallel for all environments
|
|
2428
|
+
* @experimental
|
|
2429
|
+
*/
|
|
2405
2430
|
hotUpdateEnvironments?: (server: ViteDevServer, hmr: (environment: DevEnvironment) => Promise<void>) => Promise<void>;
|
|
2406
2431
|
}
|
|
2407
|
-
interface ResolvedServerOptions extends Omit<RequiredExceptFor<ServerOptions$1,
|
|
2432
|
+
interface ResolvedServerOptions extends Omit<RequiredExceptFor<ServerOptions$1, "host" | "https" | "proxy" | "hmr" | "ws" | "watch" | "origin" | "hotUpdateEnvironments">, "fs" | "middlewareMode" | "sourcemapIgnoreList"> {
|
|
2408
2433
|
fs: Required<FileSystemServeOptions>;
|
|
2409
|
-
middlewareMode: NonNullable<ServerOptions$1[
|
|
2410
|
-
sourcemapIgnoreList: Exclude<ServerOptions$1[
|
|
2434
|
+
middlewareMode: NonNullable<ServerOptions$1["middlewareMode"]>;
|
|
2435
|
+
sourcemapIgnoreList: Exclude<ServerOptions$1["sourcemapIgnoreList"], false | undefined>;
|
|
2411
2436
|
}
|
|
2412
2437
|
interface FileSystemServeOptions {
|
|
2413
2438
|
/**
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2439
|
+
* Strictly restrict file accessing outside of allowing paths.
|
|
2440
|
+
*
|
|
2441
|
+
* Set to `false` to disable the warning
|
|
2442
|
+
*
|
|
2443
|
+
* @default true
|
|
2444
|
+
*/
|
|
2420
2445
|
strict?: boolean;
|
|
2421
2446
|
/**
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2447
|
+
* Restrict accessing files outside the allowed directories.
|
|
2448
|
+
*
|
|
2449
|
+
* Accepts absolute path or a path relative to project root.
|
|
2450
|
+
* Will try to search up for workspace root by default.
|
|
2451
|
+
*/
|
|
2427
2452
|
allow?: string[];
|
|
2428
2453
|
/**
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2454
|
+
* Restrict accessing files that matches the patterns.
|
|
2455
|
+
*
|
|
2456
|
+
* This will have higher priority than `allow`.
|
|
2457
|
+
* picomatch patterns are supported.
|
|
2458
|
+
*
|
|
2459
|
+
* @default ['.env', '.env.*', '*.{crt,pem}', '**\/.git/**']
|
|
2460
|
+
*/
|
|
2436
2461
|
deny?: string[];
|
|
2437
2462
|
}
|
|
2438
2463
|
type ServerHook = (this: MinimalPluginContextWithoutEnvironment, server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
2439
2464
|
type HttpServer = http.Server | Http2SecureServer;
|
|
2440
2465
|
interface ViteDevServer {
|
|
2441
2466
|
/**
|
|
2442
|
-
|
|
2443
|
-
|
|
2467
|
+
* The resolved vite config object
|
|
2468
|
+
*/
|
|
2444
2469
|
config: ResolvedConfig;
|
|
2445
2470
|
/**
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2471
|
+
* A connect app instance.
|
|
2472
|
+
* - Can be used to attach custom middlewares to the dev server.
|
|
2473
|
+
* - Can also be used as the handler function of a custom http server
|
|
2474
|
+
* or as a middleware in any connect-style Node.js frameworks
|
|
2475
|
+
*
|
|
2476
|
+
* https://github.com/senchalabs/connect#use-middleware
|
|
2477
|
+
*/
|
|
2453
2478
|
middlewares: Connect.Server;
|
|
2454
2479
|
/**
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2480
|
+
* native Node http server instance
|
|
2481
|
+
* will be null in middleware mode
|
|
2482
|
+
*/
|
|
2458
2483
|
httpServer: HttpServer | null;
|
|
2459
2484
|
/**
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2485
|
+
* Chokidar watcher instance. If `config.server.watch` is set to `null`,
|
|
2486
|
+
* it will not watch any files and calling `add` or `unwatch` will have no effect.
|
|
2487
|
+
* https://github.com/paulmillr/chokidar/tree/3.6.0#api
|
|
2488
|
+
*/
|
|
2464
2489
|
watcher: FSWatcher;
|
|
2465
2490
|
/**
|
|
2466
|
-
|
|
2467
|
-
|
|
2491
|
+
* WebSocket server with `send(payload)` method
|
|
2492
|
+
*/
|
|
2468
2493
|
ws: WebSocketServer;
|
|
2469
2494
|
/**
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2495
|
+
* An alias to `server.environments.client.hot`.
|
|
2496
|
+
* If you want to interact with all environments, loop over `server.environments`.
|
|
2497
|
+
*/
|
|
2473
2498
|
hot: NormalizedHotChannel;
|
|
2474
2499
|
/**
|
|
2475
|
-
|
|
2476
|
-
|
|
2500
|
+
* Rollup plugin container that can run plugin hooks on a given file
|
|
2501
|
+
*/
|
|
2477
2502
|
pluginContainer: PluginContainer;
|
|
2478
2503
|
/**
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
environments: Record<
|
|
2504
|
+
* Module execution environments attached to the Vite server.
|
|
2505
|
+
*/
|
|
2506
|
+
environments: Record<"client" | "ssr" | (string & {}), DevEnvironment>;
|
|
2482
2507
|
/**
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2508
|
+
* Module graph that tracks the import relationships, url to file mapping
|
|
2509
|
+
* and hmr state.
|
|
2510
|
+
*/
|
|
2486
2511
|
moduleGraph: ModuleGraph;
|
|
2487
2512
|
/**
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2513
|
+
* The resolved urls Vite prints on the CLI (URL-encoded). Returns `null`
|
|
2514
|
+
* in middleware mode or if the server is not listening on any port.
|
|
2515
|
+
*/
|
|
2491
2516
|
resolvedUrls: ResolvedServerUrls | null;
|
|
2492
2517
|
/**
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2518
|
+
* Programmatically resolve, load and transform a URL and get the result
|
|
2519
|
+
* without going through the http request pipeline.
|
|
2520
|
+
*/
|
|
2496
2521
|
transformRequest(url: string, options?: TransformOptions): Promise<TransformResult | null>;
|
|
2497
2522
|
/**
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2523
|
+
* Same as `transformRequest` but only warm up the URLs so the next request
|
|
2524
|
+
* will already be cached. The function will never throw as it handles and
|
|
2525
|
+
* reports errors internally.
|
|
2526
|
+
*/
|
|
2502
2527
|
warmupRequest(url: string, options?: TransformOptions): Promise<void>;
|
|
2503
2528
|
/**
|
|
2504
|
-
|
|
2505
|
-
|
|
2529
|
+
* Apply vite built-in HTML transforms and any plugin HTML transforms.
|
|
2530
|
+
*/
|
|
2506
2531
|
transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>;
|
|
2507
2532
|
/**
|
|
2508
|
-
|
|
2509
|
-
|
|
2533
|
+
* Transform module code into SSR format.
|
|
2534
|
+
*/
|
|
2510
2535
|
ssrTransform(code: string, inMap: SourceMap | {
|
|
2511
|
-
mappings:
|
|
2536
|
+
mappings: "";
|
|
2512
2537
|
} | null, url: string, originalCode?: string): Promise<TransformResult | null>;
|
|
2513
2538
|
/**
|
|
2514
|
-
|
|
2515
|
-
|
|
2539
|
+
* Load a given URL as an instantiated module for SSR.
|
|
2540
|
+
*/
|
|
2516
2541
|
ssrLoadModule(url: string, opts?: {
|
|
2517
2542
|
fixStacktrace?: boolean;
|
|
2518
2543
|
}): Promise<Record<string, any>>;
|
|
2519
2544
|
/**
|
|
2520
|
-
|
|
2521
|
-
|
|
2545
|
+
* Returns a fixed version of the given stack
|
|
2546
|
+
*/
|
|
2522
2547
|
ssrRewriteStacktrace(stack: string): string;
|
|
2523
2548
|
/**
|
|
2524
|
-
|
|
2525
|
-
|
|
2549
|
+
* Mutates the given SSR error by rewriting the stacktrace
|
|
2550
|
+
*/
|
|
2526
2551
|
ssrFixStacktrace(e: Error): void;
|
|
2527
2552
|
/**
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2553
|
+
* Triggers HMR for a module in the module graph. You can use the `server.moduleGraph`
|
|
2554
|
+
* API to retrieve the module to be reloaded. If `hmr` is false, this is a no-op.
|
|
2555
|
+
*/
|
|
2531
2556
|
reloadModule(module: ModuleNode): Promise<void>;
|
|
2532
2557
|
/**
|
|
2533
|
-
|
|
2534
|
-
|
|
2558
|
+
* Start the server.
|
|
2559
|
+
*/
|
|
2535
2560
|
listen(port?: number, isRestart?: boolean): Promise<ViteDevServer>;
|
|
2536
2561
|
/**
|
|
2537
|
-
|
|
2538
|
-
|
|
2562
|
+
* Stop the server.
|
|
2563
|
+
*/
|
|
2539
2564
|
close(): Promise<void>;
|
|
2540
2565
|
/**
|
|
2541
|
-
|
|
2542
|
-
|
|
2566
|
+
* Print server urls
|
|
2567
|
+
*/
|
|
2543
2568
|
printUrls(): void;
|
|
2544
2569
|
/**
|
|
2545
|
-
|
|
2546
|
-
|
|
2570
|
+
* Bind CLI shortcuts
|
|
2571
|
+
*/
|
|
2547
2572
|
bindCLIShortcuts(options?: BindCLIShortcutsOptions<ViteDevServer>): void;
|
|
2548
2573
|
/**
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2574
|
+
* Restart the server.
|
|
2575
|
+
*
|
|
2576
|
+
* @param forceOptimize - force the optimizer to re-bundle, same as --force cli flag
|
|
2577
|
+
*/
|
|
2553
2578
|
restart(forceOptimize?: boolean): Promise<void>;
|
|
2554
2579
|
/**
|
|
2555
|
-
|
|
2556
|
-
|
|
2580
|
+
* Open browser
|
|
2581
|
+
*/
|
|
2557
2582
|
openBrowser(): void;
|
|
2558
2583
|
/**
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2584
|
+
* Calling `await server.waitForRequestsIdle(id)` will wait until all static imports
|
|
2585
|
+
* are processed. If called from a load or transform plugin hook, the id needs to be
|
|
2586
|
+
* passed as a parameter to avoid deadlocks. Calling this function after the first
|
|
2587
|
+
* static imports section of the module graph has been processed will resolve immediately.
|
|
2588
|
+
*/
|
|
2564
2589
|
waitForRequestsIdle: (ignoredId?: string) => Promise<void>;
|
|
2565
2590
|
}
|
|
2566
2591
|
interface ResolvedServerUrls {
|
|
@@ -2575,9 +2600,9 @@ interface HtmlTagDescriptor {
|
|
|
2575
2600
|
attrs?: Record<string, string | boolean | undefined>;
|
|
2576
2601
|
children?: string | HtmlTagDescriptor[];
|
|
2577
2602
|
/**
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
injectTo?:
|
|
2603
|
+
* default: 'head-prepend'
|
|
2604
|
+
*/
|
|
2605
|
+
injectTo?: "head" | "body" | "head-prepend" | "body-prepend";
|
|
2581
2606
|
}
|
|
2582
2607
|
type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
|
|
2583
2608
|
html: string;
|
|
@@ -2585,12 +2610,12 @@ type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
|
|
|
2585
2610
|
};
|
|
2586
2611
|
interface IndexHtmlTransformContext {
|
|
2587
2612
|
/**
|
|
2588
|
-
|
|
2589
|
-
|
|
2613
|
+
* public path when served
|
|
2614
|
+
*/
|
|
2590
2615
|
path: string;
|
|
2591
2616
|
/**
|
|
2592
|
-
|
|
2593
|
-
|
|
2617
|
+
* filename on disk
|
|
2618
|
+
*/
|
|
2594
2619
|
filename: string;
|
|
2595
2620
|
server?: ViteDevServer;
|
|
2596
2621
|
bundle?: OutputBundle;
|
|
@@ -2599,7 +2624,7 @@ interface IndexHtmlTransformContext {
|
|
|
2599
2624
|
}
|
|
2600
2625
|
type IndexHtmlTransformHook = (this: MinimalPluginContextWithoutEnvironment, html: string, ctx: IndexHtmlTransformContext) => IndexHtmlTransformResult | void | Promise<IndexHtmlTransformResult | void>;
|
|
2601
2626
|
type IndexHtmlTransform = IndexHtmlTransformHook | {
|
|
2602
|
-
order?:
|
|
2627
|
+
order?: "pre" | "post" | null;
|
|
2603
2628
|
handler: IndexHtmlTransformHook;
|
|
2604
2629
|
};
|
|
2605
2630
|
//#endregion
|
|
@@ -2611,84 +2636,85 @@ type StringFilter<Value = string | RegExp> = Value | Array<Value> | {
|
|
|
2611
2636
|
//#endregion
|
|
2612
2637
|
//#region src/node/plugin.d.ts
|
|
2613
2638
|
/**
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
+
* Vite plugins extends the Rollup plugin interface with a few extra
|
|
2640
|
+
* vite-specific options. A valid vite plugin is also a valid Rollup plugin.
|
|
2641
|
+
* On the contrary, a Rollup plugin may or may NOT be a valid vite universal
|
|
2642
|
+
* plugin, since some Rollup features do not make sense in an unbundled
|
|
2643
|
+
* dev server context. That said, as long as a rollup plugin doesn't have strong
|
|
2644
|
+
* coupling between its bundle phase and output phase hooks then it should
|
|
2645
|
+
* just work (that means, most of them).
|
|
2646
|
+
*
|
|
2647
|
+
* By default, the plugins are run during both serve and build. When a plugin
|
|
2648
|
+
* is applied during serve, it will only run **non output plugin hooks** (see
|
|
2649
|
+
* rollup type definition of {@link rollup#PluginHooks}). You can think of the
|
|
2650
|
+
* dev server as only running `const bundle = rollup.rollup()` but never calling
|
|
2651
|
+
* `bundle.generate()`.
|
|
2652
|
+
*
|
|
2653
|
+
* A plugin that expects to have different behavior depending on serve/build can
|
|
2654
|
+
* export a factory function that receives the command being run via options.
|
|
2655
|
+
*
|
|
2656
|
+
* If a plugin should be applied only for server or build, a function format
|
|
2657
|
+
* config file can be used to conditional determine the plugins to use.
|
|
2658
|
+
*
|
|
2659
|
+
* The current environment can be accessed from the context for the all non-global
|
|
2660
|
+
* hooks (it is not available in config, configResolved, configureServer, etc).
|
|
2661
|
+
* It can be a dev, build, or scan environment.
|
|
2662
|
+
* Plugins can use this.environment.mode === 'dev' to guard for dev specific APIs.
|
|
2663
|
+
*/
|
|
2639
2664
|
interface PluginContextExtension {
|
|
2640
2665
|
/**
|
|
2641
|
-
|
|
2642
|
-
|
|
2666
|
+
* Vite-specific environment instance
|
|
2667
|
+
*/
|
|
2643
2668
|
environment: Environment;
|
|
2644
2669
|
}
|
|
2645
2670
|
interface PluginContextMetaExtension {
|
|
2646
2671
|
viteVersion: string;
|
|
2647
2672
|
}
|
|
2648
|
-
interface ConfigPluginContext extends Omit<MinimalPluginContext,
|
|
2649
|
-
meta: Omit<PluginContextMeta,
|
|
2673
|
+
interface ConfigPluginContext extends Omit<MinimalPluginContext, "meta" | "environment"> {
|
|
2674
|
+
meta: Omit<PluginContextMeta, "watchMode">;
|
|
2650
2675
|
}
|
|
2651
|
-
interface MinimalPluginContextWithoutEnvironment extends Omit<MinimalPluginContext,
|
|
2652
|
-
declare module
|
|
2676
|
+
interface MinimalPluginContextWithoutEnvironment extends Omit<MinimalPluginContext, "environment"> {}
|
|
2677
|
+
declare module "rollup" {
|
|
2653
2678
|
interface MinimalPluginContext extends PluginContextExtension {}
|
|
2654
2679
|
interface PluginContextMeta extends PluginContextMetaExtension {}
|
|
2655
2680
|
}
|
|
2656
2681
|
/**
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
interface Plugin
|
|
2667
|
-
/**
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
+
* There are two types of plugins in Vite. App plugins and environment plugins.
|
|
2683
|
+
* Environment Plugins are defined by a constructor function that will be called
|
|
2684
|
+
* once per each environment allowing users to have completely different plugins
|
|
2685
|
+
* for each of them. The constructor gets the resolved environment after the server
|
|
2686
|
+
* and builder has already been created simplifying config access and cache
|
|
2687
|
+
* management for for environment specific plugins.
|
|
2688
|
+
* Environment Plugins are closer to regular rollup plugins. They can't define
|
|
2689
|
+
* app level hooks (like config, configResolved, configureServer, etc).
|
|
2690
|
+
*/
|
|
2691
|
+
interface Plugin<A = any> extends Rollup.Plugin<A> {
|
|
2692
|
+
/**
|
|
2693
|
+
* Perform custom handling of HMR updates.
|
|
2694
|
+
* The handler receives an options containing changed filename, timestamp, a
|
|
2695
|
+
* list of modules affected by the file change, and the dev server instance.
|
|
2696
|
+
*
|
|
2697
|
+
* - The hook can return a filtered list of modules to narrow down the update.
|
|
2698
|
+
* e.g. for a Vue SFC, we can narrow down the part to update by comparing
|
|
2699
|
+
* the descriptors.
|
|
2700
|
+
*
|
|
2701
|
+
* - The hook can also return an empty array and then perform custom updates
|
|
2702
|
+
* by sending a custom hmr payload via environment.hot.send().
|
|
2703
|
+
*
|
|
2704
|
+
* - If the hook doesn't return a value, the hmr update will be performed as
|
|
2705
|
+
* normal.
|
|
2706
|
+
*/
|
|
2682
2707
|
hotUpdate?: ObjectHook<(this: MinimalPluginContext & {
|
|
2683
2708
|
environment: DevEnvironment;
|
|
2684
2709
|
}, options: HotUpdateOptions) => Array<EnvironmentModuleNode> | void | Promise<Array<EnvironmentModuleNode> | void>>;
|
|
2685
2710
|
/**
|
|
2686
|
-
|
|
2687
|
-
|
|
2711
|
+
* extend hooks with ssr flag
|
|
2712
|
+
*/
|
|
2688
2713
|
resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: {
|
|
2689
2714
|
attributes: Record<string, string>;
|
|
2690
2715
|
custom?: CustomPluginOptions;
|
|
2691
2716
|
ssr?: boolean;
|
|
2717
|
+
|
|
2692
2718
|
isEntry: boolean;
|
|
2693
2719
|
}) => Promise<ResolveIdResult> | ResolveIdResult, {
|
|
2694
2720
|
filter?: {
|
|
@@ -2711,171 +2737,179 @@ interface Plugin$1<A = any> extends Rollup.Plugin<A> {
|
|
|
2711
2737
|
};
|
|
2712
2738
|
}>;
|
|
2713
2739
|
/**
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2740
|
+
* Opt-in this plugin into the shared plugins pipeline.
|
|
2741
|
+
* For backward-compatibility, plugins are re-recreated for each environment
|
|
2742
|
+
* during `vite build --app`
|
|
2743
|
+
* We have an opt-in per plugin, and a general `builder.sharedPlugins`
|
|
2744
|
+
* In a future major, we'll flip the default to be shared by default
|
|
2745
|
+
* @experimental
|
|
2746
|
+
*/
|
|
2721
2747
|
sharedDuringBuild?: boolean;
|
|
2722
2748
|
/**
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2749
|
+
* Opt-in this plugin into per-environment buildStart and buildEnd during dev.
|
|
2750
|
+
* For backward-compatibility, the buildStart hook is called only once during
|
|
2751
|
+
* dev, for the client environment. Plugins can opt-in to be called
|
|
2752
|
+
* per-environment, aligning with the build hook behavior.
|
|
2753
|
+
* @experimental
|
|
2754
|
+
*/
|
|
2729
2755
|
perEnvironmentStartEndDuringDev?: boolean;
|
|
2730
2756
|
/**
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2757
|
+
* Opt-in this plugin into per-environment watchChange during dev.
|
|
2758
|
+
* For backward-compatibility, the watchChange hook is called only once during
|
|
2759
|
+
* dev, for the client environment. Plugins can opt-in to be called
|
|
2760
|
+
* per-environment, aligning with the watchChange hook behavior.
|
|
2761
|
+
* @experimental
|
|
2762
|
+
*/
|
|
2763
|
+
perEnvironmentWatchChangeDuringDev?: boolean;
|
|
2764
|
+
/**
|
|
2765
|
+
* Enforce plugin invocation tier similar to webpack loaders. Hooks ordering
|
|
2766
|
+
* is still subject to the `order` property in the hook object.
|
|
2767
|
+
*
|
|
2768
|
+
* Plugin invocation order:
|
|
2769
|
+
* - alias resolution
|
|
2770
|
+
* - `enforce: 'pre'` plugins
|
|
2771
|
+
* - vite core plugins
|
|
2772
|
+
* - normal plugins
|
|
2773
|
+
* - vite build plugins
|
|
2774
|
+
* - `enforce: 'post'` plugins
|
|
2775
|
+
* - vite build post plugins
|
|
2776
|
+
*/
|
|
2777
|
+
enforce?: "pre" | "post";
|
|
2778
|
+
/**
|
|
2779
|
+
* Apply the plugin only for serve or build, or on certain conditions.
|
|
2780
|
+
*/
|
|
2781
|
+
apply?: "serve" | "build" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean);
|
|
2782
|
+
/**
|
|
2783
|
+
* Define environments where this plugin should be active
|
|
2784
|
+
* By default, the plugin is active in all environments
|
|
2785
|
+
* @experimental
|
|
2786
|
+
*/
|
|
2753
2787
|
applyToEnvironment?: (environment: PartialEnvironment) => boolean | Promise<boolean> | PluginOption;
|
|
2754
2788
|
/**
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
config?: ObjectHook<(this: ConfigPluginContext, config: UserConfig, env: ConfigEnv) => Omit<UserConfig,
|
|
2763
|
-
/**
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2789
|
+
* Modify vite config before it's resolved. The hook can either mutate the
|
|
2790
|
+
* passed-in config directly, or return a partial config object that will be
|
|
2791
|
+
* deeply merged into existing config.
|
|
2792
|
+
*
|
|
2793
|
+
* Note: User plugins are resolved before running this hook so injecting other
|
|
2794
|
+
* plugins inside the `config` hook will have no effect.
|
|
2795
|
+
*/
|
|
2796
|
+
config?: ObjectHook<(this: ConfigPluginContext, config: UserConfig, env: ConfigEnv) => Omit<UserConfig, "plugins"> | null | void | Promise<Omit<UserConfig, "plugins"> | null | void>>;
|
|
2797
|
+
/**
|
|
2798
|
+
* Modify environment configs before it's resolved. The hook can either mutate the
|
|
2799
|
+
* passed-in environment config directly, or return a partial config object that will be
|
|
2800
|
+
* deeply merged into existing config.
|
|
2801
|
+
* This hook is called for each environment with a partially resolved environment config
|
|
2802
|
+
* that already accounts for the default environment config values set at the root level.
|
|
2803
|
+
* If plugins need to modify the config of a given environment, they should do it in this
|
|
2804
|
+
* hook instead of the config hook. Leaving the config hook only for modifying the root
|
|
2805
|
+
* default environment config.
|
|
2806
|
+
*/
|
|
2773
2807
|
configEnvironment?: ObjectHook<(this: ConfigPluginContext, name: string, config: EnvironmentOptions, env: ConfigEnv & {
|
|
2774
2808
|
/**
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2809
|
+
* Whether this environment is SSR environment and `ssr.target` is set to `'webworker'`.
|
|
2810
|
+
* Only intended to be used for backward compatibility.
|
|
2811
|
+
*/
|
|
2778
2812
|
isSsrTargetWebworker?: boolean;
|
|
2779
2813
|
}) => EnvironmentOptions | null | void | Promise<EnvironmentOptions | null | void>>;
|
|
2780
2814
|
/**
|
|
2781
|
-
|
|
2782
|
-
|
|
2815
|
+
* Use this hook to read and store the final resolved vite config.
|
|
2816
|
+
*/
|
|
2783
2817
|
configResolved?: ObjectHook<(this: MinimalPluginContextWithoutEnvironment, config: ResolvedConfig) => void | Promise<void>>;
|
|
2784
2818
|
/**
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2819
|
+
* Configure the vite server. The hook receives the {@link ViteDevServer}
|
|
2820
|
+
* instance. This can also be used to store a reference to the server
|
|
2821
|
+
* for use in other hooks.
|
|
2822
|
+
*
|
|
2823
|
+
* The hooks will be called before internal middlewares are applied. A hook
|
|
2824
|
+
* can return a post hook that will be called after internal middlewares
|
|
2825
|
+
* are applied. Hook can be async functions and will be called in series.
|
|
2826
|
+
*/
|
|
2793
2827
|
configureServer?: ObjectHook<ServerHook>;
|
|
2794
2828
|
/**
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2829
|
+
* Configure the preview server. The hook receives the {@link PreviewServer}
|
|
2830
|
+
* instance. This can also be used to store a reference to the server
|
|
2831
|
+
* for use in other hooks.
|
|
2832
|
+
*
|
|
2833
|
+
* The hooks are called before other middlewares are applied. A hook can
|
|
2834
|
+
* return a post hook that will be called after other middlewares are
|
|
2835
|
+
* applied. Hooks can be async functions and will be called in series.
|
|
2836
|
+
*/
|
|
2803
2837
|
configurePreviewServer?: ObjectHook<PreviewServerHook>;
|
|
2804
2838
|
/**
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2839
|
+
* Transform index.html.
|
|
2840
|
+
* The hook receives the following arguments:
|
|
2841
|
+
*
|
|
2842
|
+
* - html: string
|
|
2843
|
+
* - ctx: IndexHtmlTransformContext, which contains:
|
|
2844
|
+
* - path: public path when served
|
|
2845
|
+
* - filename: filename on disk
|
|
2846
|
+
* - server?: ViteDevServer (only present during serve)
|
|
2847
|
+
* - bundle?: rollup.OutputBundle (only present during build)
|
|
2848
|
+
* - chunk?: rollup.OutputChunk
|
|
2849
|
+
* - originalUrl?: string
|
|
2850
|
+
*
|
|
2851
|
+
* It can either return a transformed string, or a list of html tag
|
|
2852
|
+
* descriptors that will be injected into the `<head>` or `<body>`.
|
|
2853
|
+
*
|
|
2854
|
+
* By default the transform is applied **after** vite's internal html
|
|
2855
|
+
* transform. If you need to apply the transform before vite, use an object:
|
|
2856
|
+
* `{ order: 'pre', handler: hook }`
|
|
2857
|
+
*/
|
|
2824
2858
|
transformIndexHtml?: IndexHtmlTransform;
|
|
2825
2859
|
/**
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2860
|
+
* Build Environments
|
|
2861
|
+
*
|
|
2862
|
+
* @experimental
|
|
2863
|
+
*/
|
|
2830
2864
|
buildApp?: ObjectHook<BuildAppHook>;
|
|
2831
2865
|
/**
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2866
|
+
* Perform custom handling of HMR updates.
|
|
2867
|
+
* The handler receives a context containing changed filename, timestamp, a
|
|
2868
|
+
* list of modules affected by the file change, and the dev server instance.
|
|
2869
|
+
*
|
|
2870
|
+
* - The hook can return a filtered list of modules to narrow down the update.
|
|
2871
|
+
* e.g. for a Vue SFC, we can narrow down the part to update by comparing
|
|
2872
|
+
* the descriptors.
|
|
2873
|
+
*
|
|
2874
|
+
* - The hook can also return an empty array and then perform custom updates
|
|
2875
|
+
* by sending a custom hmr payload via server.ws.send().
|
|
2876
|
+
*
|
|
2877
|
+
* - If the hook doesn't return a value, the hmr update will be performed as
|
|
2878
|
+
* normal.
|
|
2879
|
+
*/
|
|
2846
2880
|
handleHotUpdate?: ObjectHook<(this: MinimalPluginContextWithoutEnvironment, ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>;
|
|
2847
2881
|
}
|
|
2848
|
-
type HookHandler<T> = T extends ObjectHook<infer H> ? H : T;
|
|
2849
|
-
type PluginWithRequiredHook<K extends keyof Plugin
|
|
2850
|
-
type Thenable<T> = T | Promise<T>;
|
|
2882
|
+
type HookHandler<T$1> = T$1 extends ObjectHook<infer H> ? H : T$1;
|
|
2883
|
+
type PluginWithRequiredHook<K$1 extends keyof Plugin> = Plugin & { [P in K$1]: NonNullable<Plugin[P]> };
|
|
2884
|
+
type Thenable<T$1> = T$1 | Promise<T$1>;
|
|
2851
2885
|
type FalsyPlugin = false | null | undefined;
|
|
2852
|
-
type PluginOption = Thenable<Plugin
|
|
2886
|
+
type PluginOption = Thenable<Plugin | FalsyPlugin | PluginOption[]>;
|
|
2853
2887
|
/**
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
declare function perEnvironmentPlugin(name: string, applyToEnvironment: (environment: PartialEnvironment) => boolean | Promise<boolean> | PluginOption): Plugin
|
|
2888
|
+
* @experimental
|
|
2889
|
+
*/
|
|
2890
|
+
declare function perEnvironmentPlugin(name: string, applyToEnvironment: (environment: PartialEnvironment) => boolean | Promise<boolean> | PluginOption): Plugin;
|
|
2857
2891
|
//#endregion
|
|
2858
2892
|
//#region src/node/plugins/css.d.ts
|
|
2859
2893
|
interface CSSOptions {
|
|
2860
2894
|
/**
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
transformer?:
|
|
2869
|
-
/**
|
|
2870
|
-
|
|
2871
|
-
|
|
2895
|
+
* Using lightningcss is an experimental option to handle CSS modules,
|
|
2896
|
+
* assets and imports via Lightning CSS. It requires to install it as a
|
|
2897
|
+
* peer dependency.
|
|
2898
|
+
*
|
|
2899
|
+
* @default 'postcss'
|
|
2900
|
+
* @experimental
|
|
2901
|
+
*/
|
|
2902
|
+
transformer?: "postcss" | "lightningcss";
|
|
2903
|
+
/**
|
|
2904
|
+
* https://github.com/css-modules/postcss-modules
|
|
2905
|
+
*/
|
|
2872
2906
|
modules?: CSSModulesOptions | false;
|
|
2873
2907
|
/**
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2908
|
+
* Options for preprocessors.
|
|
2909
|
+
*
|
|
2910
|
+
* In addition to options specific to each processors, Vite supports `additionalData` option.
|
|
2911
|
+
* The `additionalData` option can be used to inject extra code for each style content.
|
|
2912
|
+
*/
|
|
2879
2913
|
preprocessorOptions?: {
|
|
2880
2914
|
scss?: SassPreprocessorOptions;
|
|
2881
2915
|
sass?: SassPreprocessorOptions;
|
|
@@ -2884,39 +2918,39 @@ interface CSSOptions {
|
|
|
2884
2918
|
stylus?: StylusPreprocessorOptions;
|
|
2885
2919
|
};
|
|
2886
2920
|
/**
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2921
|
+
* If this option is set, preprocessors will run in workers when possible.
|
|
2922
|
+
* `true` means the number of CPUs minus 1.
|
|
2923
|
+
*
|
|
2924
|
+
* @default true
|
|
2925
|
+
*/
|
|
2892
2926
|
preprocessorMaxWorkers?: number | true;
|
|
2893
2927
|
postcss?: string | (PostCSS.ProcessOptions & {
|
|
2894
2928
|
plugins?: PostCSS.AcceptedPlugin[];
|
|
2895
2929
|
});
|
|
2896
2930
|
/**
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2931
|
+
* Enables css sourcemaps during dev
|
|
2932
|
+
* @default false
|
|
2933
|
+
* @experimental
|
|
2934
|
+
*/
|
|
2901
2935
|
devSourcemap?: boolean;
|
|
2902
2936
|
/**
|
|
2903
|
-
|
|
2904
|
-
|
|
2937
|
+
* @experimental
|
|
2938
|
+
*/
|
|
2905
2939
|
lightningcss?: lightningcssOptions_LightningCSSOptions;
|
|
2906
2940
|
}
|
|
2907
2941
|
interface CSSModulesOptions {
|
|
2908
2942
|
getJSON?: (cssFileName: string, json: Record<string, string>, outputFileName: string) => void;
|
|
2909
|
-
scopeBehaviour?:
|
|
2943
|
+
scopeBehaviour?: "global" | "local";
|
|
2910
2944
|
globalModulePaths?: RegExp[];
|
|
2911
2945
|
exportGlobals?: boolean;
|
|
2912
2946
|
generateScopedName?: string | ((name: string, filename: string, css: string) => string);
|
|
2913
2947
|
hashPrefix?: string;
|
|
2914
2948
|
/**
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
localsConvention?:
|
|
2949
|
+
* default: undefined
|
|
2950
|
+
*/
|
|
2951
|
+
localsConvention?: "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly" | ((originalClassName: string, generatedClassName: string, inputFile: string) => string);
|
|
2918
2952
|
}
|
|
2919
|
-
type ResolvedCSSOptions = Omit<CSSOptions,
|
|
2953
|
+
type ResolvedCSSOptions = Omit<CSSOptions, "lightningcss"> & Required<Pick<CSSOptions, "transformer" | "devSourcemap">> & {
|
|
2920
2954
|
lightningcss?: lightningcssOptions_LightningCSSOptions;
|
|
2921
2955
|
};
|
|
2922
2956
|
interface PreprocessCSSResult {
|
|
@@ -2926,8 +2960,8 @@ interface PreprocessCSSResult {
|
|
|
2926
2960
|
deps?: Set<string>;
|
|
2927
2961
|
}
|
|
2928
2962
|
/**
|
|
2929
|
-
|
|
2930
|
-
|
|
2963
|
+
* @experimental
|
|
2964
|
+
*/
|
|
2931
2965
|
declare function preprocessCSS(code: string, filename: string, config: ResolvedConfig): Promise<PreprocessCSSResult>;
|
|
2932
2966
|
declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise<ExistingRawSourceMap>;
|
|
2933
2967
|
type PreprocessorAdditionalDataResult = string | {
|
|
@@ -2951,11 +2985,11 @@ interface ESBuildOptions extends esbuild_TransformOptions {
|
|
|
2951
2985
|
exclude?: string | RegExp | ReadonlyArray<string | RegExp>;
|
|
2952
2986
|
jsxInject?: string;
|
|
2953
2987
|
/**
|
|
2954
|
-
|
|
2955
|
-
|
|
2988
|
+
* This option is not respected. Use `build.minify` instead.
|
|
2989
|
+
*/
|
|
2956
2990
|
minify?: never;
|
|
2957
2991
|
}
|
|
2958
|
-
type ESBuildTransformResult = Omit<esbuild_TransformResult,
|
|
2992
|
+
type ESBuildTransformResult = Omit<esbuild_TransformResult, "map"> & {
|
|
2959
2993
|
map: SourceMap;
|
|
2960
2994
|
};
|
|
2961
2995
|
declare function transformWithEsbuild(code: string, filename: string, options?: esbuild_TransformOptions, inMap?: object, config?: ResolvedConfig, watcher?: FSWatcher): Promise<ESBuildTransformResult>;
|
|
@@ -2963,55 +2997,55 @@ declare function transformWithEsbuild(code: string, filename: string, options?:
|
|
|
2963
2997
|
//#region src/node/plugins/json.d.ts
|
|
2964
2998
|
interface JsonOptions {
|
|
2965
2999
|
/**
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
3000
|
+
* Generate a named export for every property of the JSON object
|
|
3001
|
+
* @default true
|
|
3002
|
+
*/
|
|
2969
3003
|
namedExports?: boolean;
|
|
2970
3004
|
/**
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
stringify?: boolean |
|
|
3005
|
+
* Generate performant output as JSON.parse("stringified").
|
|
3006
|
+
*
|
|
3007
|
+
* When set to 'auto', the data will be stringified only if the data is bigger than 10kB.
|
|
3008
|
+
* @default 'auto'
|
|
3009
|
+
*/
|
|
3010
|
+
stringify?: boolean | "auto";
|
|
2977
3011
|
}
|
|
2978
3012
|
//#endregion
|
|
2979
3013
|
//#region src/node/ssr/index.d.ts
|
|
2980
|
-
type SSRTarget =
|
|
3014
|
+
type SSRTarget = "node" | "webworker";
|
|
2981
3015
|
type SsrDepOptimizationConfig = DepOptimizationConfig;
|
|
2982
3016
|
interface SSROptions {
|
|
2983
3017
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
|
2984
3018
|
external?: string[] | true;
|
|
2985
3019
|
/**
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
3020
|
+
* Define the target for the ssr build. The browser field in package.json
|
|
3021
|
+
* is ignored for node but used if webworker is the target
|
|
3022
|
+
* This option will be removed in a future major version
|
|
3023
|
+
* @default 'node'
|
|
3024
|
+
*/
|
|
2991
3025
|
target?: SSRTarget;
|
|
2992
3026
|
/**
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3027
|
+
* Control over which dependencies are optimized during SSR and esbuild options
|
|
3028
|
+
* During build:
|
|
3029
|
+
* no external CJS dependencies are optimized by default
|
|
3030
|
+
* During dev:
|
|
3031
|
+
* explicit no external CJS dependencies are optimized by default
|
|
3032
|
+
* @experimental
|
|
3033
|
+
*/
|
|
3000
3034
|
optimizeDeps?: SsrDepOptimizationConfig;
|
|
3001
3035
|
resolve?: {
|
|
3002
3036
|
/**
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3037
|
+
* Conditions that are used in the plugin pipeline. The default value is the root config's `resolve.conditions`.
|
|
3038
|
+
*
|
|
3039
|
+
* Use this to override the default ssr conditions for the ssr build.
|
|
3040
|
+
*
|
|
3041
|
+
* @default rootConfig.resolve.conditions
|
|
3042
|
+
*/
|
|
3009
3043
|
conditions?: string[];
|
|
3010
3044
|
/**
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3045
|
+
* Conditions that are used during ssr import (including `ssrLoadModule`) of externalized dependencies.
|
|
3046
|
+
*
|
|
3047
|
+
* @default ['node', 'module-sync']
|
|
3048
|
+
*/
|
|
3015
3049
|
externalConditions?: string[];
|
|
3016
3050
|
mainFields?: string[];
|
|
3017
3051
|
};
|
|
@@ -3024,31 +3058,31 @@ interface ResolvedSSROptions extends SSROptions {
|
|
|
3024
3058
|
//#region src/node/config.d.ts
|
|
3025
3059
|
interface ConfigEnv {
|
|
3026
3060
|
/**
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
command:
|
|
3061
|
+
* 'serve': during dev (`vite` command)
|
|
3062
|
+
* 'build': when building for production (`vite build` command)
|
|
3063
|
+
*/
|
|
3064
|
+
command: "build" | "serve";
|
|
3031
3065
|
mode: string;
|
|
3032
3066
|
isSsrBuild?: boolean;
|
|
3033
3067
|
isPreview?: boolean;
|
|
3034
3068
|
}
|
|
3035
3069
|
/**
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
type AppType =
|
|
3070
|
+
* spa: include SPA fallback middleware and configure sirv with `single: true` in preview
|
|
3071
|
+
*
|
|
3072
|
+
* mpa: only include non-SPA HTML middlewares
|
|
3073
|
+
*
|
|
3074
|
+
* custom: don't include HTML middlewares
|
|
3075
|
+
*/
|
|
3076
|
+
type AppType = "spa" | "mpa" | "custom";
|
|
3043
3077
|
type UserConfigFnObject = (env: ConfigEnv) => UserConfig;
|
|
3044
3078
|
type UserConfigFnPromise = (env: ConfigEnv) => Promise<UserConfig>;
|
|
3045
3079
|
type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
|
|
3046
3080
|
type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn;
|
|
3047
3081
|
/**
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3082
|
+
* Type helper to make it easier to use vite.config.ts
|
|
3083
|
+
* accepts a direct {@link UserConfig} object, or a function that returns it.
|
|
3084
|
+
* The function receives a {@link ConfigEnv} object.
|
|
3085
|
+
*/
|
|
3052
3086
|
declare function defineConfig(config: UserConfig): UserConfig;
|
|
3053
3087
|
declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
|
3054
3088
|
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
@@ -3060,333 +3094,333 @@ interface CreateDevEnvironmentContext {
|
|
|
3060
3094
|
}
|
|
3061
3095
|
interface DevEnvironmentOptions {
|
|
3062
3096
|
/**
|
|
3063
|
-
|
|
3064
|
-
|
|
3097
|
+
* Files to be pre-transformed. Supports glob patterns.
|
|
3098
|
+
*/
|
|
3065
3099
|
warmup?: string[];
|
|
3066
3100
|
/**
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3101
|
+
* Pre-transform known direct imports
|
|
3102
|
+
* defaults to true for the client environment, false for the rest
|
|
3103
|
+
*/
|
|
3070
3104
|
preTransformRequests?: boolean;
|
|
3071
3105
|
/**
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3106
|
+
* Enables sourcemaps during dev
|
|
3107
|
+
* @default { js: true }
|
|
3108
|
+
* @experimental
|
|
3109
|
+
*/
|
|
3076
3110
|
sourcemap?: boolean | {
|
|
3077
3111
|
js?: boolean;
|
|
3078
3112
|
css?: boolean;
|
|
3079
3113
|
};
|
|
3080
3114
|
/**
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3115
|
+
* Whether or not to ignore-list source files in the dev server sourcemap, used to populate
|
|
3116
|
+
* the [`x_google_ignoreList` source map extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).
|
|
3117
|
+
*
|
|
3118
|
+
* By default, it excludes all paths containing `node_modules`. You can pass `false` to
|
|
3119
|
+
* disable this behavior, or, for full control, a function that takes the source path and
|
|
3120
|
+
* sourcemap path and returns whether to ignore the source path.
|
|
3121
|
+
*/
|
|
3088
3122
|
sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean);
|
|
3089
3123
|
/**
|
|
3090
|
-
|
|
3091
|
-
|
|
3124
|
+
* create the Dev Environment instance
|
|
3125
|
+
*/
|
|
3092
3126
|
createEnvironment?: (name: string, config: ResolvedConfig, context: CreateDevEnvironmentContext) => Promise<DevEnvironment> | DevEnvironment;
|
|
3093
3127
|
/**
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3128
|
+
* For environments that support a full-reload, like the client, we can short-circuit when
|
|
3129
|
+
* restarting the server throwing early to stop processing current files. We avoided this for
|
|
3130
|
+
* SSR requests. Maybe this is no longer needed.
|
|
3131
|
+
* @experimental
|
|
3132
|
+
*/
|
|
3099
3133
|
recoverable?: boolean;
|
|
3100
3134
|
/**
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3135
|
+
* For environments associated with a module runner.
|
|
3136
|
+
* By default, it is false for the client environment and true for non-client environments.
|
|
3137
|
+
* This option can also be used instead of the removed config.experimental.skipSsrTransform.
|
|
3138
|
+
*/
|
|
3105
3139
|
moduleRunnerTransform?: boolean;
|
|
3106
3140
|
}
|
|
3107
|
-
type ResolvedDevEnvironmentOptions = Omit<Required<DevEnvironmentOptions>,
|
|
3108
|
-
sourcemapIgnoreList: Exclude<DevEnvironmentOptions[
|
|
3141
|
+
type ResolvedDevEnvironmentOptions = Omit<Required<DevEnvironmentOptions>, "sourcemapIgnoreList"> & {
|
|
3142
|
+
sourcemapIgnoreList: Exclude<DevEnvironmentOptions["sourcemapIgnoreList"], false | undefined>;
|
|
3109
3143
|
};
|
|
3110
3144
|
type AllResolveOptions = ResolveOptions & {
|
|
3111
3145
|
alias?: AliasOptions;
|
|
3112
3146
|
};
|
|
3113
3147
|
interface SharedEnvironmentOptions {
|
|
3114
3148
|
/**
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3149
|
+
* Define global variable replacements.
|
|
3150
|
+
* Entries will be defined on `window` during dev and replaced during build.
|
|
3151
|
+
*/
|
|
3118
3152
|
define?: Record<string, any>;
|
|
3119
3153
|
/**
|
|
3120
|
-
|
|
3121
|
-
|
|
3154
|
+
* Configure resolver
|
|
3155
|
+
*/
|
|
3122
3156
|
resolve?: EnvironmentResolveOptions;
|
|
3123
3157
|
/**
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
consumer?:
|
|
3158
|
+
* Define if this environment is used for Server-Side Rendering
|
|
3159
|
+
* @default 'server' if it isn't the client environment
|
|
3160
|
+
*/
|
|
3161
|
+
consumer?: "client" | "server";
|
|
3128
3162
|
/**
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3163
|
+
* If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime.
|
|
3164
|
+
* Otherwise, it is statically replaced as an empty object.
|
|
3165
|
+
*/
|
|
3132
3166
|
keepProcessEnv?: boolean;
|
|
3133
3167
|
/**
|
|
3134
|
-
|
|
3135
|
-
|
|
3168
|
+
* Optimize deps config
|
|
3169
|
+
*/
|
|
3136
3170
|
optimizeDeps?: DepOptimizationOptions;
|
|
3137
3171
|
}
|
|
3138
3172
|
interface EnvironmentOptions extends SharedEnvironmentOptions {
|
|
3139
3173
|
/**
|
|
3140
|
-
|
|
3141
|
-
|
|
3174
|
+
* Dev specific options
|
|
3175
|
+
*/
|
|
3142
3176
|
dev?: DevEnvironmentOptions;
|
|
3143
3177
|
/**
|
|
3144
|
-
|
|
3145
|
-
|
|
3178
|
+
* Build specific options
|
|
3179
|
+
*/
|
|
3146
3180
|
build?: BuildEnvironmentOptions;
|
|
3147
3181
|
}
|
|
3148
3182
|
type ResolvedResolveOptions = Required<ResolveOptions>;
|
|
3149
3183
|
type ResolvedEnvironmentOptions = {
|
|
3150
3184
|
define?: Record<string, any>;
|
|
3151
3185
|
resolve: ResolvedResolveOptions;
|
|
3152
|
-
consumer:
|
|
3186
|
+
consumer: "client" | "server";
|
|
3153
3187
|
keepProcessEnv?: boolean;
|
|
3154
3188
|
optimizeDeps: DepOptimizationOptions;
|
|
3155
3189
|
dev: ResolvedDevEnvironmentOptions;
|
|
3156
3190
|
build: ResolvedBuildEnvironmentOptions;
|
|
3157
|
-
plugins: readonly Plugin
|
|
3191
|
+
plugins: readonly Plugin[];
|
|
3158
3192
|
};
|
|
3159
|
-
type DefaultEnvironmentOptions = Omit<EnvironmentOptions,
|
|
3193
|
+
type DefaultEnvironmentOptions = Omit<EnvironmentOptions, "consumer" | "resolve" | "keepProcessEnv"> & {
|
|
3160
3194
|
resolve?: AllResolveOptions;
|
|
3161
3195
|
};
|
|
3162
3196
|
interface UserConfig extends DefaultEnvironmentOptions {
|
|
3163
3197
|
/**
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3198
|
+
* Project root directory. Can be an absolute path, or a path relative from
|
|
3199
|
+
* the location of the config file itself.
|
|
3200
|
+
* @default process.cwd()
|
|
3201
|
+
*/
|
|
3168
3202
|
root?: string;
|
|
3169
3203
|
/**
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3204
|
+
* Base public path when served in development or production.
|
|
3205
|
+
* @default '/'
|
|
3206
|
+
*/
|
|
3173
3207
|
base?: string;
|
|
3174
3208
|
/**
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3209
|
+
* Directory to serve as plain static assets. Files in this directory are
|
|
3210
|
+
* served and copied to build dist dir as-is without transform. The value
|
|
3211
|
+
* can be either an absolute file system path or a path relative to project root.
|
|
3212
|
+
*
|
|
3213
|
+
* Set to `false` or an empty string to disable copied static assets to build dist dir.
|
|
3214
|
+
* @default 'public'
|
|
3215
|
+
*/
|
|
3182
3216
|
publicDir?: string | false;
|
|
3183
3217
|
/**
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3218
|
+
* Directory to save cache files. Files in this directory are pre-bundled
|
|
3219
|
+
* deps or some other cache files that generated by vite, which can improve
|
|
3220
|
+
* the performance. You can use `--force` flag or manually delete the directory
|
|
3221
|
+
* to regenerate the cache files. The value can be either an absolute file
|
|
3222
|
+
* system path or a path relative to project root.
|
|
3223
|
+
* Default to `.vite` when no `package.json` is detected.
|
|
3224
|
+
* @default 'node_modules/.vite'
|
|
3225
|
+
*/
|
|
3192
3226
|
cacheDir?: string;
|
|
3193
3227
|
/**
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3228
|
+
* Explicitly set a mode to run in. This will override the default mode for
|
|
3229
|
+
* each command, and can be overridden by the command line --mode option.
|
|
3230
|
+
*/
|
|
3197
3231
|
mode?: string;
|
|
3198
3232
|
/**
|
|
3199
|
-
|
|
3200
|
-
|
|
3233
|
+
* Array of vite plugins to use.
|
|
3234
|
+
*/
|
|
3201
3235
|
plugins?: PluginOption[];
|
|
3202
3236
|
/**
|
|
3203
|
-
|
|
3204
|
-
|
|
3237
|
+
* HTML related options
|
|
3238
|
+
*/
|
|
3205
3239
|
html?: HTMLOptions;
|
|
3206
3240
|
/**
|
|
3207
|
-
|
|
3208
|
-
|
|
3241
|
+
* CSS related options (preprocessors and CSS modules)
|
|
3242
|
+
*/
|
|
3209
3243
|
css?: CSSOptions;
|
|
3210
3244
|
/**
|
|
3211
|
-
|
|
3212
|
-
|
|
3245
|
+
* JSON loading options
|
|
3246
|
+
*/
|
|
3213
3247
|
json?: JsonOptions;
|
|
3214
3248
|
/**
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3249
|
+
* Transform options to pass to esbuild.
|
|
3250
|
+
* Or set to `false` to disable esbuild.
|
|
3251
|
+
*/
|
|
3218
3252
|
esbuild?: ESBuildOptions | false;
|
|
3219
3253
|
/**
|
|
3220
|
-
|
|
3221
|
-
|
|
3254
|
+
* Specify additional picomatch patterns to be treated as static assets.
|
|
3255
|
+
*/
|
|
3222
3256
|
assetsInclude?: string | RegExp | (string | RegExp)[];
|
|
3223
3257
|
/**
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3258
|
+
* Builder specific options
|
|
3259
|
+
* @experimental
|
|
3260
|
+
*/
|
|
3227
3261
|
builder?: BuilderOptions;
|
|
3228
3262
|
/**
|
|
3229
|
-
|
|
3230
|
-
|
|
3263
|
+
* Server specific options, e.g. host, port, https...
|
|
3264
|
+
*/
|
|
3231
3265
|
server?: ServerOptions$1;
|
|
3232
3266
|
/**
|
|
3233
|
-
|
|
3234
|
-
|
|
3267
|
+
* Preview specific options, e.g. host, port, https...
|
|
3268
|
+
*/
|
|
3235
3269
|
preview?: PreviewOptions;
|
|
3236
3270
|
/**
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3271
|
+
* Experimental features
|
|
3272
|
+
*
|
|
3273
|
+
* Features under this field could change in the future and might NOT follow semver.
|
|
3274
|
+
* Please be careful and always pin Vite's version when using them.
|
|
3275
|
+
* @experimental
|
|
3276
|
+
*/
|
|
3243
3277
|
experimental?: ExperimentalOptions;
|
|
3244
3278
|
/**
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
future?: FutureOptions |
|
|
3279
|
+
* Options to opt-in to future behavior
|
|
3280
|
+
*/
|
|
3281
|
+
future?: FutureOptions | "warn";
|
|
3248
3282
|
/**
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3283
|
+
* Legacy options
|
|
3284
|
+
*
|
|
3285
|
+
* Features under this field only follow semver for patches, they could be removed in a
|
|
3286
|
+
* future minor version. Please always pin Vite's version to a minor when using them.
|
|
3287
|
+
*/
|
|
3254
3288
|
legacy?: LegacyOptions;
|
|
3255
3289
|
/**
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3290
|
+
* Log level.
|
|
3291
|
+
* @default 'info'
|
|
3292
|
+
*/
|
|
3259
3293
|
logLevel?: LogLevel;
|
|
3260
3294
|
/**
|
|
3261
|
-
|
|
3262
|
-
|
|
3295
|
+
* Custom logger.
|
|
3296
|
+
*/
|
|
3263
3297
|
customLogger?: Logger;
|
|
3264
3298
|
/**
|
|
3265
|
-
|
|
3266
|
-
|
|
3299
|
+
* @default true
|
|
3300
|
+
*/
|
|
3267
3301
|
clearScreen?: boolean;
|
|
3268
3302
|
/**
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3303
|
+
* Environment files directory. Can be an absolute path, or a path relative from
|
|
3304
|
+
* root.
|
|
3305
|
+
* @default root
|
|
3306
|
+
*/
|
|
3273
3307
|
envDir?: string | false;
|
|
3274
3308
|
/**
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3309
|
+
* Env variables starts with `envPrefix` will be exposed to your client source code via import.meta.env.
|
|
3310
|
+
* @default 'VITE_'
|
|
3311
|
+
*/
|
|
3278
3312
|
envPrefix?: string | string[];
|
|
3279
3313
|
/**
|
|
3280
|
-
|
|
3281
|
-
|
|
3314
|
+
* Worker bundle options
|
|
3315
|
+
*/
|
|
3282
3316
|
worker?: {
|
|
3283
3317
|
/**
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
format?:
|
|
3318
|
+
* Output format for worker bundle
|
|
3319
|
+
* @default 'iife'
|
|
3320
|
+
*/
|
|
3321
|
+
format?: "es" | "iife";
|
|
3288
3322
|
/**
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3323
|
+
* Vite plugins that apply to worker bundle. The plugins returned by this function
|
|
3324
|
+
* should be new instances every time it is called, because they are used for each
|
|
3325
|
+
* rollup worker bundling process.
|
|
3326
|
+
*/
|
|
3293
3327
|
plugins?: () => PluginOption[];
|
|
3294
3328
|
/**
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
rollupOptions?: Omit<RollupOptions,
|
|
3329
|
+
* Rollup options to build worker bundle
|
|
3330
|
+
*/
|
|
3331
|
+
rollupOptions?: Omit<RollupOptions, "plugins" | "input" | "onwarn" | "preserveEntrySignatures">;
|
|
3298
3332
|
};
|
|
3299
3333
|
/**
|
|
3300
|
-
|
|
3301
|
-
|
|
3334
|
+
* Dep optimization options
|
|
3335
|
+
*/
|
|
3302
3336
|
optimizeDeps?: DepOptimizationOptions;
|
|
3303
3337
|
/**
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3338
|
+
* SSR specific options
|
|
3339
|
+
* We could make SSROptions be a EnvironmentOptions if we can abstract
|
|
3340
|
+
* external/noExternal for environments in general.
|
|
3341
|
+
*/
|
|
3308
3342
|
ssr?: SSROptions;
|
|
3309
3343
|
/**
|
|
3310
|
-
|
|
3311
|
-
|
|
3344
|
+
* Environment overrides
|
|
3345
|
+
*/
|
|
3312
3346
|
environments?: Record<string, EnvironmentOptions>;
|
|
3313
3347
|
/**
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3348
|
+
* Whether your application is a Single Page Application (SPA),
|
|
3349
|
+
* a Multi-Page Application (MPA), or Custom Application (SSR
|
|
3350
|
+
* and frameworks with custom HTML handling)
|
|
3351
|
+
* @default 'spa'
|
|
3352
|
+
*/
|
|
3319
3353
|
appType?: AppType;
|
|
3320
3354
|
}
|
|
3321
3355
|
interface HTMLOptions {
|
|
3322
3356
|
/**
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3357
|
+
* A nonce value placeholder that will be used when generating script/style tags.
|
|
3358
|
+
*
|
|
3359
|
+
* Make sure that this placeholder will be replaced with a unique value for each request by the server.
|
|
3360
|
+
*/
|
|
3327
3361
|
cspNonce?: string;
|
|
3328
3362
|
}
|
|
3329
3363
|
interface FutureOptions {
|
|
3330
|
-
removePluginHookHandleHotUpdate?:
|
|
3331
|
-
removePluginHookSsrArgument?:
|
|
3332
|
-
removeServerModuleGraph?:
|
|
3333
|
-
removeServerReloadModule?:
|
|
3334
|
-
removeServerPluginContainer?:
|
|
3335
|
-
removeServerHot?:
|
|
3336
|
-
removeServerTransformRequest?:
|
|
3337
|
-
removeServerWarmupRequest?:
|
|
3338
|
-
removeSsrLoadModule?:
|
|
3364
|
+
removePluginHookHandleHotUpdate?: "warn";
|
|
3365
|
+
removePluginHookSsrArgument?: "warn";
|
|
3366
|
+
removeServerModuleGraph?: "warn";
|
|
3367
|
+
removeServerReloadModule?: "warn";
|
|
3368
|
+
removeServerPluginContainer?: "warn";
|
|
3369
|
+
removeServerHot?: "warn";
|
|
3370
|
+
removeServerTransformRequest?: "warn";
|
|
3371
|
+
removeServerWarmupRequest?: "warn";
|
|
3372
|
+
removeSsrLoadModule?: "warn";
|
|
3339
3373
|
}
|
|
3340
3374
|
interface ExperimentalOptions {
|
|
3341
3375
|
/**
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3376
|
+
* Append fake `&lang.(ext)` when queries are specified, to preserve the file extension for following plugins to process.
|
|
3377
|
+
*
|
|
3378
|
+
* @experimental
|
|
3379
|
+
* @default false
|
|
3380
|
+
*/
|
|
3347
3381
|
importGlobRestoreExtension?: boolean;
|
|
3348
3382
|
/**
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3383
|
+
* Allow finegrain control over assets and public files paths
|
|
3384
|
+
*
|
|
3385
|
+
* @experimental
|
|
3386
|
+
*/
|
|
3353
3387
|
renderBuiltUrl?: RenderBuiltAssetUrl;
|
|
3354
3388
|
/**
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3389
|
+
* Enables support of HMR partial accept via `import.meta.hot.acceptExports`.
|
|
3390
|
+
*
|
|
3391
|
+
* @experimental
|
|
3392
|
+
* @default false
|
|
3393
|
+
*/
|
|
3360
3394
|
hmrPartialAccept?: boolean;
|
|
3361
3395
|
}
|
|
3362
3396
|
interface LegacyOptions {
|
|
3363
3397
|
/**
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3398
|
+
* In Vite 6.0.8 and below, WebSocket server was able to connect from any web pages. However,
|
|
3399
|
+
* that could be exploited by a malicious web page.
|
|
3400
|
+
*
|
|
3401
|
+
* In Vite 6.0.9+, the WebSocket server now requires a token to connect from a web page.
|
|
3402
|
+
* But this may break some plugins and frameworks that connects to the WebSocket server
|
|
3403
|
+
* on their own. Enabling this option will make Vite skip the token check.
|
|
3404
|
+
*
|
|
3405
|
+
* **We do not recommend enabling this option unless you are sure that you are fine with
|
|
3406
|
+
* that security weakness.**
|
|
3407
|
+
*/
|
|
3374
3408
|
skipWebSocketTokenCheck?: boolean;
|
|
3375
3409
|
}
|
|
3376
3410
|
interface ResolvedWorkerOptions {
|
|
3377
|
-
format:
|
|
3411
|
+
format: "es" | "iife";
|
|
3378
3412
|
plugins: (bundleChain: string[]) => Promise<ResolvedConfig>;
|
|
3379
3413
|
rollupOptions: RollupOptions;
|
|
3380
3414
|
}
|
|
3381
3415
|
interface InlineConfig extends UserConfig {
|
|
3382
3416
|
configFile?: string | false;
|
|
3383
3417
|
/** @experimental */
|
|
3384
|
-
configLoader?:
|
|
3418
|
+
configLoader?: "bundle" | "runner" | "native";
|
|
3385
3419
|
/** @deprecated */
|
|
3386
3420
|
envFile?: false;
|
|
3387
3421
|
forceOptimizeDeps?: boolean;
|
|
3388
3422
|
}
|
|
3389
|
-
interface ResolvedConfig extends Readonly<Omit<UserConfig,
|
|
3423
|
+
interface ResolvedConfig extends Readonly<Omit<UserConfig, "plugins" | "css" | "json" | "assetsInclude" | "optimizeDeps" | "worker" | "build" | "dev" | "environments" | "experimental" | "future" | "server" | "preview"> & {
|
|
3390
3424
|
configFile: string | undefined;
|
|
3391
3425
|
configFileDependencies: string[];
|
|
3392
3426
|
inlineConfig: InlineConfig;
|
|
@@ -3394,7 +3428,7 @@ interface ResolvedConfig extends Readonly<Omit<UserConfig, 'plugins' | 'css' | '
|
|
|
3394
3428
|
base: string;
|
|
3395
3429
|
publicDir: string;
|
|
3396
3430
|
cacheDir: string;
|
|
3397
|
-
command:
|
|
3431
|
+
command: "build" | "serve";
|
|
3398
3432
|
mode: string;
|
|
3399
3433
|
isWorker: boolean;
|
|
3400
3434
|
isProduction: boolean;
|
|
@@ -3403,7 +3437,7 @@ interface ResolvedConfig extends Readonly<Omit<UserConfig, 'plugins' | 'css' | '
|
|
|
3403
3437
|
resolve: Required<ResolveOptions> & {
|
|
3404
3438
|
alias: Alias[];
|
|
3405
3439
|
};
|
|
3406
|
-
plugins: readonly Plugin
|
|
3440
|
+
plugins: readonly Plugin[];
|
|
3407
3441
|
css: ResolvedCSSOptions;
|
|
3408
3442
|
json: Required<JsonOptions>;
|
|
3409
3443
|
esbuild: ESBuildOptions | false;
|
|
@@ -3417,42 +3451,42 @@ interface ResolvedConfig extends Readonly<Omit<UserConfig, 'plugins' | 'css' | '
|
|
|
3417
3451
|
assetsInclude: (file: string) => boolean;
|
|
3418
3452
|
logger: Logger;
|
|
3419
3453
|
/**
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3454
|
+
* Create an internal resolver to be used in special scenarios, e.g.
|
|
3455
|
+
* optimizer & handling css `@imports`.
|
|
3456
|
+
*
|
|
3457
|
+
* This API is deprecated. It only works for the client and ssr
|
|
3458
|
+
* environments. The `aliasOnly` option is also not being used anymore.
|
|
3459
|
+
* Plugins should move to `createIdResolver(environment.config)` instead.
|
|
3460
|
+
*
|
|
3461
|
+
* @deprecated Use `createIdResolver` from `vite` instead.
|
|
3462
|
+
*/
|
|
3429
3463
|
createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
|
|
3430
3464
|
optimizeDeps: DepOptimizationOptions;
|
|
3431
3465
|
worker: ResolvedWorkerOptions;
|
|
3432
3466
|
appType: AppType;
|
|
3433
|
-
experimental: RequiredExceptFor<ExperimentalOptions,
|
|
3467
|
+
experimental: RequiredExceptFor<ExperimentalOptions, "renderBuiltUrl">;
|
|
3434
3468
|
future: FutureOptions | undefined;
|
|
3435
3469
|
environments: Record<string, ResolvedEnvironmentOptions>;
|
|
3436
3470
|
/**
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3471
|
+
* The token to connect to the WebSocket server from browsers.
|
|
3472
|
+
*
|
|
3473
|
+
* We recommend using `import.meta.hot` rather than connecting
|
|
3474
|
+
* to the WebSocket server directly.
|
|
3475
|
+
* If you have a usecase that requires connecting to the WebSocket
|
|
3476
|
+
* server, please create an issue so that we can discuss.
|
|
3477
|
+
*
|
|
3478
|
+
* @deprecated
|
|
3479
|
+
*/
|
|
3446
3480
|
webSocketToken: string;
|
|
3447
3481
|
} & PluginHookUtils> {}
|
|
3448
3482
|
interface PluginHookUtils {
|
|
3449
|
-
getSortedPlugins: <K extends keyof Plugin
|
|
3450
|
-
getSortedPluginHooks: <K extends keyof Plugin
|
|
3483
|
+
getSortedPlugins: <K$1 extends keyof Plugin>(hookName: K$1) => PluginWithRequiredHook<K$1>[];
|
|
3484
|
+
getSortedPluginHooks: <K$1 extends keyof Plugin>(hookName: K$1) => NonNullable<HookHandler<Plugin[K$1]>>[];
|
|
3451
3485
|
}
|
|
3452
3486
|
type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
|
|
3453
|
-
declare function resolveConfig(inlineConfig: InlineConfig, command:
|
|
3454
|
-
declare function sortUserPlugins(plugins: (Plugin
|
|
3455
|
-
declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger, configLoader?:
|
|
3487
|
+
declare function resolveConfig(inlineConfig: InlineConfig, command: "build" | "serve", defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean, patchConfig?: ((config: ResolvedConfig) => void) | undefined, patchPlugins?: ((resolvedPlugins: Plugin[]) => void) | undefined): Promise<ResolvedConfig>;
|
|
3488
|
+
declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
|
|
3489
|
+
declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger, configLoader?: "bundle" | "runner" | "native"): Promise<{
|
|
3456
3490
|
path: string;
|
|
3457
3491
|
config: UserConfig;
|
|
3458
3492
|
dependencies: string[];
|
|
@@ -3461,9 +3495,9 @@ declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, c
|
|
|
3461
3495
|
//#region src/node/idResolver.d.ts
|
|
3462
3496
|
type ResolveIdFn = (environment: PartialEnvironment, id: string, importer?: string, aliasOnly?: boolean) => Promise<string | undefined>;
|
|
3463
3497
|
/**
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3498
|
+
* Create an internal resolver to be used in special scenarios, e.g.
|
|
3499
|
+
* optimizer and handling css @imports
|
|
3500
|
+
*/
|
|
3467
3501
|
declare function createIdResolver(config: ResolvedConfig, options?: Partial<InternalResolveOptions>): ResolveIdFn;
|
|
3468
3502
|
//#endregion
|
|
3469
3503
|
//#region src/node/server/middlewares/error.d.ts
|
|
@@ -3471,32 +3505,32 @@ declare function buildErrorMessage(err: RollupError, args?: string[], includeSta
|
|
|
3471
3505
|
//#endregion
|
|
3472
3506
|
//#region src/node/ssr/runtime/serverModuleRunner.d.ts
|
|
3473
3507
|
/**
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
interface ServerModuleRunnerOptions extends Omit<ModuleRunnerOptions,
|
|
3508
|
+
* @experimental
|
|
3509
|
+
*/
|
|
3510
|
+
interface ServerModuleRunnerOptions extends Omit<ModuleRunnerOptions, "root" | "fetchModule" | "hmr" | "transport"> {
|
|
3477
3511
|
/**
|
|
3478
|
-
|
|
3479
|
-
|
|
3512
|
+
* Disable HMR or configure HMR logger.
|
|
3513
|
+
*/
|
|
3480
3514
|
hmr?: false | {
|
|
3481
|
-
logger?: ModuleRunnerHmr[
|
|
3515
|
+
logger?: ModuleRunnerHmr["logger"];
|
|
3482
3516
|
};
|
|
3483
3517
|
/**
|
|
3484
|
-
|
|
3485
|
-
|
|
3518
|
+
* Provide a custom module evaluator. This controls how the code is executed.
|
|
3519
|
+
*/
|
|
3486
3520
|
evaluator?: ModuleEvaluator;
|
|
3487
3521
|
}
|
|
3488
3522
|
declare const createServerModuleRunnerTransport: (options: {
|
|
3489
3523
|
channel: NormalizedServerHotChannel;
|
|
3490
3524
|
}) => ModuleRunnerTransport;
|
|
3491
3525
|
/**
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3526
|
+
* Create an instance of the Vite SSR runtime that support HMR.
|
|
3527
|
+
* @experimental
|
|
3528
|
+
*/
|
|
3495
3529
|
declare function createServerModuleRunner(environment: DevEnvironment, options?: ServerModuleRunnerOptions): ModuleRunner;
|
|
3496
3530
|
//#endregion
|
|
3497
3531
|
//#region src/node/server/environments/runnableEnvironment.d.ts
|
|
3498
3532
|
declare function createRunnableDevEnvironment(name: string, config: ResolvedConfig, context?: RunnableDevEnvironmentContext): RunnableDevEnvironment;
|
|
3499
|
-
interface RunnableDevEnvironmentContext extends Omit<DevEnvironmentContext,
|
|
3533
|
+
interface RunnableDevEnvironmentContext extends Omit<DevEnvironmentContext, "hot"> {
|
|
3500
3534
|
runner?: (environment: RunnableDevEnvironment, options?: ServerModuleRunnerOptions) => ModuleRunner;
|
|
3501
3535
|
runnerOptions?: ServerModuleRunnerOptions;
|
|
3502
3536
|
hot?: boolean;
|
|
@@ -3524,15 +3558,15 @@ declare class FetchableDevEnvironment extends DevEnvironment {
|
|
|
3524
3558
|
}
|
|
3525
3559
|
//#endregion
|
|
3526
3560
|
//#region src/node/ssr/runnerImport.d.ts
|
|
3527
|
-
interface RunnerImportResult<T> {
|
|
3528
|
-
module: T;
|
|
3561
|
+
interface RunnerImportResult<T$1> {
|
|
3562
|
+
module: T$1;
|
|
3529
3563
|
dependencies: string[];
|
|
3530
3564
|
}
|
|
3531
3565
|
/**
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
declare function runnerImport<T>(moduleId: string, inlineConfig?: InlineConfig): Promise<RunnerImportResult<T>>;
|
|
3566
|
+
* Import any file using the default Vite environment.
|
|
3567
|
+
* @experimental
|
|
3568
|
+
*/
|
|
3569
|
+
declare function runnerImport<T$1>(moduleId: string, inlineConfig?: InlineConfig): Promise<RunnerImportResult<T$1>>;
|
|
3536
3570
|
//#endregion
|
|
3537
3571
|
//#region src/node/ssr/fetchModule.d.ts
|
|
3538
3572
|
interface FetchModuleOptions {
|
|
@@ -3541,9 +3575,9 @@ interface FetchModuleOptions {
|
|
|
3541
3575
|
startOffset?: number;
|
|
3542
3576
|
}
|
|
3543
3577
|
/**
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3578
|
+
* Fetch module information for Vite runner.
|
|
3579
|
+
* @experimental
|
|
3580
|
+
*/
|
|
3547
3581
|
declare function fetchModule(environment: DevEnvironment, url: string, importer?: string, options?: FetchModuleOptions): Promise<moduleRunner_FetchResult>;
|
|
3548
3582
|
//#endregion
|
|
3549
3583
|
//#region src/node/ssr/ssrTransform.d.ts
|
|
@@ -3553,7 +3587,7 @@ interface ModuleRunnerTransformOptions {
|
|
|
3553
3587
|
};
|
|
3554
3588
|
}
|
|
3555
3589
|
declare function ssrTransform(code: string, inMap: SourceMap | {
|
|
3556
|
-
mappings:
|
|
3590
|
+
mappings: "";
|
|
3557
3591
|
} | null, url: string, originalCode: string, options?: ModuleRunnerTransformOptions): Promise<TransformResult | null>;
|
|
3558
3592
|
//#endregion
|
|
3559
3593
|
//#region src/node/constants.d.ts
|
|
@@ -3567,8 +3601,8 @@ declare const defaultAllowedOrigins: RegExp;
|
|
|
3567
3601
|
//#endregion
|
|
3568
3602
|
//#region src/node/utils.d.ts
|
|
3569
3603
|
/**
|
|
3570
|
-
|
|
3571
|
-
|
|
3604
|
+
* Inlined to keep `@rollup/pluginutils` in devDependencies
|
|
3605
|
+
*/
|
|
3572
3606
|
type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
|
3573
3607
|
declare const createFilter: (include?: FilterPattern, exclude?: FilterPattern, options?: {
|
|
3574
3608
|
resolve?: string | false | null;
|
|
@@ -3585,27 +3619,27 @@ interface SendOptions {
|
|
|
3585
3619
|
cacheControl?: string;
|
|
3586
3620
|
headers?: OutgoingHttpHeaders;
|
|
3587
3621
|
map?: SourceMap | {
|
|
3588
|
-
mappings:
|
|
3622
|
+
mappings: "";
|
|
3589
3623
|
} | null;
|
|
3590
3624
|
}
|
|
3591
3625
|
declare function send(req: http.IncomingMessage, res: ServerResponse, content: string | Buffer, type: string, options: SendOptions): void;
|
|
3592
3626
|
//#endregion
|
|
3593
3627
|
//#region src/node/server/searchRoot.d.ts
|
|
3594
3628
|
/**
|
|
3595
|
-
|
|
3596
|
-
|
|
3629
|
+
* Search up for the nearest workspace root
|
|
3630
|
+
*/
|
|
3597
3631
|
declare function searchForWorkspaceRoot(current: string, root?: string): string;
|
|
3598
3632
|
//#endregion
|
|
3599
3633
|
//#region src/node/server/middlewares/static.d.ts
|
|
3600
3634
|
/**
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3635
|
+
* Check if the url is allowed to be served, via the `server.fs` config.
|
|
3636
|
+
* @deprecated Use the `isFileLoadingAllowed` function instead.
|
|
3637
|
+
*/
|
|
3604
3638
|
declare function isFileServingAllowed(config: ResolvedConfig, url: string): boolean;
|
|
3605
3639
|
declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
|
|
3606
3640
|
/**
|
|
3607
|
-
|
|
3608
|
-
|
|
3641
|
+
* Warning: parameters are not validated, only works with normalized absolute paths
|
|
3642
|
+
*/
|
|
3609
3643
|
declare function isFileLoadingAllowed(config: ResolvedConfig, filePath: string): boolean;
|
|
3610
3644
|
//#endregion
|
|
3611
3645
|
//#region src/node/env.d.ts
|
|
@@ -3623,10 +3657,9 @@ interface ManifestChunk {
|
|
|
3623
3657
|
assets?: string[];
|
|
3624
3658
|
isEntry?: boolean;
|
|
3625
3659
|
name?: string;
|
|
3626
|
-
names?: string[];
|
|
3627
3660
|
isDynamicEntry?: boolean;
|
|
3628
3661
|
imports?: string[];
|
|
3629
3662
|
dynamicImports?: string[];
|
|
3630
3663
|
}
|
|
3631
3664
|
//#endregion
|
|
3632
|
-
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type BindCLIShortcutsOptions, type BuildAppHook, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type ChunkMetadata, type CommonServerOptions, type ConfigEnv, type ConfigPluginContext, type Connect, type ConnectedPayload, type CorsOptions, type CorsOrigin, type CustomEventMap, type CustomPayload, type CustomPluginOptionsVite, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESBuildTransformResult, type Environment, type EnvironmentModuleGraph, type EnvironmentModuleNode, type EnvironmentOptions, type ErrorPayload, type EsbuildTransformOptions, type ExperimentalOptions, type ExportsData, type FSWatcher, type FetchFunction, type FetchModuleOptions, type FetchResult, type FetchableDevEnvironment, type FetchableDevEnvironmentContext, type FileSystemServeOptions, type FilterPattern, type FullReloadPayload, type GeneralImportGlobOptions, type HMRPayload, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotChannelListener, type HotPayload, type HotUpdateOptions, type HtmlTagDescriptor, type index_d_exports as HttpProxy, type HttpServer, type ImportGlobFunction, type ImportGlobOptions, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InferCustomEventPayload, type InlineConfig, type InternalResolveOptions, type InvalidatePayload, type JsonOptions, type KnownAsTypeMap, type LegacyOptions, type LessPreprocessorOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, type MinimalPluginContextWithoutEnvironment, type ModuleGraph, type ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type NormalizedHotChannel, type NormalizedHotChannelClient, type NormalizedServerHotChannel, type OptimizedDepInfo, type Plugin
|
|
3665
|
+
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type BindCLIShortcutsOptions, type BuildAppHook, BuildEnvironment, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type ChunkMetadata, type CommonServerOptions, type ConfigEnv, type ConfigPluginContext, type Connect, type ConnectedPayload, type CorsOptions, type CorsOrigin, type CustomEventMap, type CustomPayload, type CustomPluginOptionsVite, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, DevEnvironment, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESBuildTransformResult, type Environment, type EnvironmentModuleGraph, type EnvironmentModuleNode, type EnvironmentOptions, type ErrorPayload, type EsbuildTransformOptions, type ExperimentalOptions, type ExportsData, type FSWatcher, type FetchFunction, type FetchModuleOptions, type FetchResult, type FetchableDevEnvironment, type FetchableDevEnvironmentContext, type FileSystemServeOptions, type FilterPattern, type FullReloadPayload, type GeneralImportGlobOptions, type HMRPayload, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotChannelListener, type HotPayload, type HotUpdateOptions, type HtmlTagDescriptor, type index_d_exports as HttpProxy, type HttpServer, type ImportGlobFunction, type ImportGlobOptions, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InferCustomEventPayload, type InlineConfig, type InternalResolveOptions, type InvalidatePayload, type JsonOptions, type KnownAsTypeMap, type LegacyOptions, type LessPreprocessorOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, type MinimalPluginContextWithoutEnvironment, type ModuleGraph, type ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type NormalizedHotChannel, type NormalizedHotChannelClient, type NormalizedServerHotChannel, type OptimizedDepInfo, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type PrunePayload, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type Rollup, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type RunnableDevEnvironment, type RunnableDevEnvironmentContext, type SSROptions, type SSRTarget, type SassPreprocessorOptions, type SendOptions, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions$1 as ServerOptions, type SkipInformation, type SsrDepOptimizationConfig, type StylusPreprocessorOptions, type Terser, type TerserOptions, type TransformOptions, type TransformResult, type Update, type UpdatePayload, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, type ViteBuilder, type ViteDevServer, type WatchOptions, type WebSocket, type WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, type WebSocketServer, build, buildErrorMessage, createBuilder, createFetchableDevEnvironment, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parseAst, parseAstAsync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, VERSION as version };
|