vite 8.1.3 → 8.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/client.mjs +5 -5
- package/dist/node/chunks/build.js +211 -98
- package/dist/node/chunks/lib.js +1 -1
- package/dist/node/chunks/moduleRunnerTransport.d.ts +25 -26
- package/dist/node/chunks/node.js +556 -109
- package/dist/node/chunks/postcss-import.js +11 -11
- package/dist/node/cli.js +3 -4
- package/dist/node/index.d.ts +1284 -1285
- package/dist/node/index.js +1 -2
- package/dist/node/module-runner.d.ts +76 -77
- package/dist/node/module-runner.js +5 -6
- package/package.json +11 -11
- package/dist/node/chunks/logger.js +0 -364
package/dist/node/index.d.ts
CHANGED
|
@@ -28,10 +28,8 @@ import { LightningCSSOptions, LightningCSSOptions as lightningcssOptions_Lightni
|
|
|
28
28
|
import { LessPreprocessorBaseOptions, SassModernPreprocessBaseOptions, StylusPreprocessorBaseOptions } from "#types/internal/cssPreprocessorOptions";
|
|
29
29
|
import { withFilter } from "rolldown/filter";
|
|
30
30
|
import { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownAsTypeMap, KnownQueryTypeMap } from "#types/importGlob";
|
|
31
|
-
|
|
32
|
-
//#region \0rolldown/runtime.js
|
|
33
31
|
//#endregion
|
|
34
|
-
//#region ../../node_modules/.pnpm/@vitejs+devtools@0.3.
|
|
32
|
+
//#region ../../node_modules/.pnpm/@vitejs+devtools@0.3.4_typescript@6.0.3_vite@packages+vite/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
|
|
35
33
|
//#region src/node/cli-commands.d.ts
|
|
36
34
|
interface StartOptions {
|
|
37
35
|
root?: string;
|
|
@@ -41,7 +39,7 @@ interface StartOptions {
|
|
|
41
39
|
open?: boolean;
|
|
42
40
|
}
|
|
43
41
|
//#endregion
|
|
44
|
-
//#region ../../node_modules/.pnpm/@vitejs+devtools@0.3.
|
|
42
|
+
//#region ../../node_modules/.pnpm/@vitejs+devtools@0.3.4_typescript@6.0.3_vite@packages+vite/node_modules/@vitejs/devtools/dist/config.d.ts
|
|
45
43
|
//#region src/node/config.d.ts
|
|
46
44
|
interface DevToolsConfig extends Partial<StartOptions> {
|
|
47
45
|
enabled: boolean;
|
|
@@ -425,7 +423,7 @@ interface ServerOptions$3 {
|
|
|
425
423
|
ca?: string;
|
|
426
424
|
/** Optional fetch implementation to use instead of global fetch, use this to activate fetch-based proxying,
|
|
427
425
|
* for example to proxy HTTP/2 requests
|
|
428
|
-
|
|
426
|
+
*/
|
|
429
427
|
fetch?: typeof fetch;
|
|
430
428
|
/** Optional configuration object for fetch-based proxy requests.
|
|
431
429
|
* Use this to customize fetch request and response handling.
|
|
@@ -548,22 +546,22 @@ declare function createProxyServer<TIncomingMessage extends typeof http.Incoming
|
|
|
548
546
|
//#region src/node/server/middlewares/proxy.d.ts
|
|
549
547
|
interface ProxyOptions extends ServerOptions$3 {
|
|
550
548
|
/**
|
|
551
|
-
|
|
552
|
-
|
|
549
|
+
* rewrite path
|
|
550
|
+
*/
|
|
553
551
|
rewrite?: (path: string) => string;
|
|
554
552
|
/**
|
|
555
|
-
|
|
556
|
-
|
|
553
|
+
* configure the proxy server (e.g. listen to events)
|
|
554
|
+
*/
|
|
557
555
|
configure?: (proxy: ProxyServer, options: ProxyOptions) => void;
|
|
558
556
|
/**
|
|
559
|
-
|
|
560
|
-
|
|
557
|
+
* webpack-dev-server style bypass function
|
|
558
|
+
*/
|
|
561
559
|
bypass?: (req: http.IncomingMessage, res: http.ServerResponse | undefined, options: ProxyOptions) => void | null | undefined | false | string | Promise<void | null | undefined | boolean | string>;
|
|
562
560
|
/**
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
561
|
+
* rewrite the Origin header of a WebSocket request to match the target
|
|
562
|
+
*
|
|
563
|
+
* **Exercise caution as rewriting the Origin can leave the proxying open to [CSRF attacks](https://owasp.org/www-community/attacks/csrf).**
|
|
564
|
+
*/
|
|
567
565
|
rewriteWsOrigin?: boolean | undefined;
|
|
568
566
|
}
|
|
569
567
|
//#endregion
|
|
@@ -598,92 +596,92 @@ declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger
|
|
|
598
596
|
//#region src/node/http.d.ts
|
|
599
597
|
interface CommonServerOptions {
|
|
600
598
|
/**
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
599
|
+
* Specify server port. Note if the port is already being used, Vite will
|
|
600
|
+
* automatically try the next available port so this may not be the actual
|
|
601
|
+
* port the server ends up listening on.
|
|
602
|
+
*/
|
|
605
603
|
port?: number;
|
|
606
604
|
/**
|
|
607
|
-
|
|
608
|
-
|
|
605
|
+
* If enabled, vite will exit if specified port is already in use
|
|
606
|
+
*/
|
|
609
607
|
strictPort?: boolean;
|
|
610
608
|
/**
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
609
|
+
* Specify which IP addresses the server should listen on.
|
|
610
|
+
* Set to 0.0.0.0 to listen on all addresses, including LAN and public addresses.
|
|
611
|
+
*/
|
|
614
612
|
host?: string | boolean;
|
|
615
613
|
/**
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
614
|
+
* The hostnames that Vite is allowed to respond to.
|
|
615
|
+
* `localhost` and subdomains under `.localhost` and all IP addresses are allowed by default.
|
|
616
|
+
* When using HTTPS, this check is skipped.
|
|
617
|
+
*
|
|
618
|
+
* If a string starts with `.`, it will allow that hostname without the `.` and all subdomains under the hostname.
|
|
619
|
+
* For example, `.example.com` will allow `example.com`, `foo.example.com`, and `foo.bar.example.com`.
|
|
620
|
+
*
|
|
621
|
+
* If set to `true`, the server is allowed to respond to requests for any hosts.
|
|
622
|
+
* This is not recommended as it will be vulnerable to DNS rebinding attacks.
|
|
623
|
+
*/
|
|
626
624
|
allowedHosts?: string[] | true;
|
|
627
625
|
/**
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
626
|
+
* Enable TLS + HTTP/2.
|
|
627
|
+
* Note: this downgrades to TLS only when the proxy option is also used.
|
|
628
|
+
*/
|
|
631
629
|
https?: HttpsServerOptions;
|
|
632
630
|
/**
|
|
633
|
-
|
|
634
|
-
|
|
631
|
+
* Open browser window on startup
|
|
632
|
+
*/
|
|
635
633
|
open?: boolean | string;
|
|
636
634
|
/**
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
635
|
+
* Configure custom proxy rules for the dev server. Expects an object
|
|
636
|
+
* of `{ key: options }` pairs.
|
|
637
|
+
* Uses [`http-proxy-3`](https://github.com/sagemathinc/http-proxy-3).
|
|
638
|
+
* Full options [here](https://github.com/sagemathinc/http-proxy-3#options).
|
|
639
|
+
*
|
|
640
|
+
* Example `vite.config.js`:
|
|
641
|
+
* ``` js
|
|
642
|
+
* module.exports = {
|
|
643
|
+
* proxy: {
|
|
644
|
+
* // string shorthand: /foo -> http://localhost:4567/foo
|
|
645
|
+
* '/foo': 'http://localhost:4567',
|
|
646
|
+
* // with options
|
|
647
|
+
* '/api': {
|
|
648
|
+
* target: 'http://jsonplaceholder.typicode.com',
|
|
649
|
+
* changeOrigin: true,
|
|
650
|
+
* rewrite: path => path.replace(/^\/api/, '')
|
|
651
|
+
* }
|
|
652
|
+
* }
|
|
653
|
+
* }
|
|
654
|
+
* ```
|
|
655
|
+
*/
|
|
658
656
|
proxy?: Record<string, string | ProxyOptions>;
|
|
659
657
|
/**
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
658
|
+
* Configure CORS for the dev server.
|
|
659
|
+
* Uses https://github.com/expressjs/cors.
|
|
660
|
+
*
|
|
661
|
+
* When enabling this option, **we recommend setting a specific value
|
|
662
|
+
* rather than `true`** to avoid exposing the source code to untrusted origins.
|
|
663
|
+
*
|
|
664
|
+
* Set to `true` to allow all methods from any origin, or configure separately
|
|
665
|
+
* using an object.
|
|
666
|
+
*
|
|
667
|
+
* @default { origin: /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/ }
|
|
668
|
+
*/
|
|
671
669
|
cors?: CorsOptions | boolean;
|
|
672
670
|
/**
|
|
673
|
-
|
|
674
|
-
|
|
671
|
+
* Specify server response headers.
|
|
672
|
+
*/
|
|
675
673
|
headers?: OutgoingHttpHeaders;
|
|
676
674
|
}
|
|
677
675
|
/**
|
|
678
|
-
* https://github.com/expressjs/cors#configuration-options
|
|
679
|
-
*/
|
|
676
|
+
* https://github.com/expressjs/cors#configuration-options
|
|
677
|
+
*/
|
|
680
678
|
interface CorsOptions {
|
|
681
679
|
/**
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
680
|
+
* Configures the Access-Control-Allow-Origin CORS header.
|
|
681
|
+
*
|
|
682
|
+
* **We recommend setting a specific value rather than
|
|
683
|
+
* `true`** to avoid exposing the source code to untrusted origins.
|
|
684
|
+
*/
|
|
687
685
|
origin?: CorsOrigin | ((origin: string | undefined, cb: (err: Error, origins: CorsOrigin) => void) => void);
|
|
688
686
|
methods?: string | string[];
|
|
689
687
|
allowedHeaders?: string | string[];
|
|
@@ -715,57 +713,57 @@ interface PreviewOptions extends CommonServerOptions {}
|
|
|
715
713
|
interface ResolvedPreviewOptions extends RequiredExceptFor<PreviewOptions, "host" | "https" | "proxy"> {}
|
|
716
714
|
interface PreviewServer {
|
|
717
715
|
/**
|
|
718
|
-
|
|
719
|
-
|
|
716
|
+
* The resolved vite config object
|
|
717
|
+
*/
|
|
720
718
|
config: ResolvedConfig;
|
|
721
719
|
/**
|
|
722
|
-
|
|
723
|
-
|
|
720
|
+
* Stop the server.
|
|
721
|
+
*/
|
|
724
722
|
close(): Promise<void>;
|
|
725
723
|
/**
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
724
|
+
* A connect app instance.
|
|
725
|
+
* - Can be used to attach custom middlewares to the preview server.
|
|
726
|
+
* - Can also be used as the handler function of a custom http server
|
|
727
|
+
* or as a middleware in any connect-style Node.js frameworks
|
|
728
|
+
*
|
|
729
|
+
* https://github.com/senchalabs/connect#use-middleware
|
|
730
|
+
*/
|
|
733
731
|
middlewares: Connect.Server;
|
|
734
732
|
/**
|
|
735
|
-
|
|
736
|
-
|
|
733
|
+
* native Node http server instance
|
|
734
|
+
*/
|
|
737
735
|
httpServer: HttpServer;
|
|
738
736
|
/**
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
737
|
+
* The resolved urls Vite prints on the CLI (URL-encoded). Returns `null`
|
|
738
|
+
* if the server is not listening on any port.
|
|
739
|
+
*/
|
|
742
740
|
resolvedUrls: ResolvedServerUrls | null;
|
|
743
741
|
/**
|
|
744
|
-
|
|
745
|
-
|
|
742
|
+
* Print server urls
|
|
743
|
+
*/
|
|
746
744
|
printUrls(): void;
|
|
747
745
|
/**
|
|
748
|
-
|
|
749
|
-
|
|
746
|
+
* Bind CLI shortcuts
|
|
747
|
+
*/
|
|
750
748
|
bindCLIShortcuts(options?: BindCLIShortcutsOptions<PreviewServer>): void;
|
|
751
749
|
}
|
|
752
750
|
type PreviewServerHook = (this: MinimalPluginContextWithoutEnvironment, server: PreviewServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
753
751
|
/**
|
|
754
|
-
* Starts the Vite server in preview mode, to simulate a production deployment
|
|
755
|
-
*/
|
|
752
|
+
* Starts the Vite server in preview mode, to simulate a production deployment
|
|
753
|
+
*/
|
|
756
754
|
declare function preview(inlineConfig?: InlineConfig): Promise<PreviewServer>;
|
|
757
755
|
//#endregion
|
|
758
756
|
//#region src/node/shortcuts.d.ts
|
|
759
757
|
type BindCLIShortcutsOptions<Server = ViteDevServer | PreviewServer> = {
|
|
760
758
|
/**
|
|
761
|
-
|
|
762
|
-
|
|
759
|
+
* Print a one-line shortcuts "help" hint to the terminal
|
|
760
|
+
*/
|
|
763
761
|
print?: boolean;
|
|
764
762
|
/**
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
763
|
+
* Custom shortcuts to run when a key is pressed. These shortcuts take priority
|
|
764
|
+
* over the default shortcuts if they have the same keys (except the `h` key).
|
|
765
|
+
* To disable a default shortcut, define the same key but with `action: undefined`.
|
|
766
|
+
*/
|
|
769
767
|
customShortcuts?: CLIShortcut<Server>[];
|
|
770
768
|
};
|
|
771
769
|
type CLIShortcut<Server = ViteDevServer | PreviewServer> = {
|
|
@@ -787,17 +785,17 @@ declare class BaseEnvironment extends PartialEnvironment {
|
|
|
787
785
|
constructor(name: string, config: ResolvedConfig, options?: ResolvedEnvironmentOptions);
|
|
788
786
|
}
|
|
789
787
|
/**
|
|
790
|
-
* This class discourages users from inversely checking the `mode`
|
|
791
|
-
* to determine the type of environment, e.g.
|
|
792
|
-
*
|
|
793
|
-
* ```js
|
|
794
|
-
* const isDev = environment.mode !== 'build' // bad
|
|
795
|
-
* const isDev = environment.mode === 'dev' // good
|
|
796
|
-
* ```
|
|
797
|
-
*
|
|
798
|
-
* You should also not check against `"unknown"` specifically. It's
|
|
799
|
-
* a placeholder for more possible environment types.
|
|
800
|
-
*/
|
|
788
|
+
* This class discourages users from inversely checking the `mode`
|
|
789
|
+
* to determine the type of environment, e.g.
|
|
790
|
+
*
|
|
791
|
+
* ```js
|
|
792
|
+
* const isDev = environment.mode !== 'build' // bad
|
|
793
|
+
* const isDev = environment.mode === 'dev' // good
|
|
794
|
+
* ```
|
|
795
|
+
*
|
|
796
|
+
* You should also not check against `"unknown"` specifically. It's
|
|
797
|
+
* a placeholder for more possible environment types.
|
|
798
|
+
*/
|
|
801
799
|
declare class UnknownEnvironment extends BaseEnvironment {
|
|
802
800
|
mode: "unknown";
|
|
803
801
|
}
|
|
@@ -829,115 +827,115 @@ interface DepsOptimizer {
|
|
|
829
827
|
}
|
|
830
828
|
interface DepOptimizationConfig {
|
|
831
829
|
/**
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
830
|
+
* Force optimize listed dependencies (must be resolvable import paths,
|
|
831
|
+
* cannot be globs).
|
|
832
|
+
*/
|
|
835
833
|
include?: string[];
|
|
836
834
|
/**
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
835
|
+
* Do not optimize these dependencies (must be resolvable import paths,
|
|
836
|
+
* cannot be globs).
|
|
837
|
+
*/
|
|
840
838
|
exclude?: string[];
|
|
841
839
|
/**
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
840
|
+
* Forces ESM interop when importing these dependencies. Some legacy
|
|
841
|
+
* packages advertise themselves as ESM but use `require` internally
|
|
842
|
+
* @experimental
|
|
843
|
+
*/
|
|
846
844
|
needsInterop?: string[];
|
|
847
845
|
/**
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
846
|
+
* Options to pass to esbuild during the dep scanning and optimization
|
|
847
|
+
*
|
|
848
|
+
* Certain options are omitted since changing them would not be compatible
|
|
849
|
+
* with Vite's dep optimization.
|
|
850
|
+
*
|
|
851
|
+
* - `external` is also omitted, use Vite's `optimizeDeps.exclude` option
|
|
852
|
+
* - `plugins` are merged with Vite's dep plugin
|
|
853
|
+
*
|
|
854
|
+
* https://esbuild.github.io/api
|
|
855
|
+
*
|
|
856
|
+
* @deprecated Use `rolldownOptions` instead.
|
|
857
|
+
*/
|
|
860
858
|
esbuildOptions?: DepsOptimizerEsbuildOptions;
|
|
861
859
|
/**
|
|
862
|
-
|
|
863
|
-
|
|
860
|
+
* @deprecated Use `rolldownOptions` instead.
|
|
861
|
+
*/
|
|
864
862
|
rollupOptions?: Omit<RolldownOptions, "input" | "logLevel" | "output"> & {
|
|
865
863
|
output?: Omit<OutputOptions, "format" | "sourcemap" | "dir" | "banner">;
|
|
866
864
|
};
|
|
867
865
|
/**
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
866
|
+
* Options to pass to rolldown during the dep scanning and optimization
|
|
867
|
+
*
|
|
868
|
+
* Certain options are omitted since changing them would not be compatible
|
|
869
|
+
* with Vite's dep optimization.
|
|
870
|
+
*
|
|
871
|
+
* - `plugins` are merged with Vite's dep plugin
|
|
872
|
+
*/
|
|
875
873
|
rolldownOptions?: Omit<RolldownOptions, "input" | "logLevel" | "output"> & {
|
|
876
874
|
output?: Omit<OutputOptions, "format" | "sourcemap" | "dir" | "banner">;
|
|
877
875
|
};
|
|
878
876
|
/**
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
877
|
+
* List of file extensions that can be optimized. A corresponding esbuild
|
|
878
|
+
* plugin must exist to handle the specific extension.
|
|
879
|
+
*
|
|
880
|
+
* By default, Vite can optimize `.mjs`, `.js`, `.ts`, and `.mts` files. This option
|
|
881
|
+
* allows specifying additional extensions.
|
|
882
|
+
*
|
|
883
|
+
* @experimental
|
|
884
|
+
*/
|
|
887
885
|
extensions?: string[];
|
|
888
886
|
/**
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
887
|
+
* Deps optimization during build was removed in Vite 5.1. This option is
|
|
888
|
+
* now redundant and will be removed in a future version. Switch to using
|
|
889
|
+
* `optimizeDeps.noDiscovery` and an empty or undefined `optimizeDeps.include`.
|
|
890
|
+
* true or 'dev' disables the optimizer, false or 'build' leaves it enabled.
|
|
891
|
+
* @default 'build'
|
|
892
|
+
* @deprecated
|
|
893
|
+
* @experimental
|
|
894
|
+
*/
|
|
897
895
|
disabled?: boolean | "build" | "dev";
|
|
898
896
|
/**
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
897
|
+
* Automatic dependency discovery. When `noDiscovery` is true, only dependencies
|
|
898
|
+
* listed in `include` will be optimized. The scanner isn't run for cold start
|
|
899
|
+
* in this case. CJS-only dependencies must be present in `include` during dev.
|
|
900
|
+
* @default false
|
|
901
|
+
*/
|
|
904
902
|
noDiscovery?: boolean;
|
|
905
903
|
/**
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
904
|
+
* When enabled, it will hold the first optimized deps results until all static
|
|
905
|
+
* imports are crawled on cold start. This avoids the need for full-page reloads
|
|
906
|
+
* when new dependencies are discovered and they trigger the generation of new
|
|
907
|
+
* common chunks. If all dependencies are found by the scanner plus the explicitly
|
|
908
|
+
* defined ones in `include`, it is better to disable this option to let the
|
|
909
|
+
* browser process more requests in parallel.
|
|
910
|
+
* @default true
|
|
911
|
+
* @experimental
|
|
912
|
+
*/
|
|
915
913
|
holdUntilCrawlEnd?: boolean;
|
|
916
914
|
/**
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
915
|
+
* When enabled, Vite will not throw an error when an outdated optimized
|
|
916
|
+
* dependency is requested. Enabling this option may cause a single module
|
|
917
|
+
* to have a multiple reference.
|
|
918
|
+
* @default false
|
|
919
|
+
* @experimental
|
|
920
|
+
*/
|
|
923
921
|
ignoreOutdatedRequests?: boolean;
|
|
924
922
|
}
|
|
925
923
|
type DepOptimizationOptions = DepOptimizationConfig & {
|
|
926
924
|
/**
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
925
|
+
* By default, Vite will crawl your `index.html` to detect dependencies that
|
|
926
|
+
* need to be pre-bundled. If `build.rolldownOptions.input` is specified, Vite
|
|
927
|
+
* will crawl those entry points instead.
|
|
928
|
+
*
|
|
929
|
+
* If neither of these fit your needs, you can specify custom entries using
|
|
930
|
+
* this option - the value should be a tinyglobby pattern or array of patterns
|
|
931
|
+
* (https://github.com/SuperchupuDev/tinyglobby) that are relative from
|
|
932
|
+
* vite project root. This will overwrite default entries inference.
|
|
933
|
+
*/
|
|
936
934
|
entries?: string | string[];
|
|
937
935
|
/**
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
936
|
+
* Force dep pre-optimization regardless of whether deps have changed.
|
|
937
|
+
* @experimental
|
|
938
|
+
*/
|
|
941
939
|
force?: boolean;
|
|
942
940
|
};
|
|
943
941
|
interface OptimizedDepInfo {
|
|
@@ -948,62 +946,62 @@ interface OptimizedDepInfo {
|
|
|
948
946
|
browserHash?: string;
|
|
949
947
|
fileHash?: string;
|
|
950
948
|
/**
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
949
|
+
* During optimization, ids can still be resolved to their final location
|
|
950
|
+
* but the bundles may not yet be saved to disk
|
|
951
|
+
*/
|
|
954
952
|
processing?: Promise<void>;
|
|
955
953
|
/**
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
954
|
+
* ExportData cache, discovered deps will parse the src entry to get exports
|
|
955
|
+
* data used both to define if interop is needed and when pre-bundling
|
|
956
|
+
*/
|
|
959
957
|
exportsData?: Promise<ExportsData>;
|
|
960
958
|
isDynamicEntry?: boolean;
|
|
961
959
|
}
|
|
962
960
|
interface DepOptimizationMetadata {
|
|
963
961
|
/**
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
962
|
+
* The main hash is determined by user config and dependency lockfiles.
|
|
963
|
+
* This is checked on server startup to avoid unnecessary re-bundles.
|
|
964
|
+
*/
|
|
967
965
|
hash: string;
|
|
968
966
|
/**
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
967
|
+
* This hash is determined by dependency lockfiles.
|
|
968
|
+
* This is checked on server startup to avoid unnecessary re-bundles.
|
|
969
|
+
*/
|
|
972
970
|
lockfileHash: string;
|
|
973
971
|
/**
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
972
|
+
* This hash is determined by user config.
|
|
973
|
+
* This is checked on server startup to avoid unnecessary re-bundles.
|
|
974
|
+
*/
|
|
977
975
|
configHash: string;
|
|
978
976
|
/**
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
977
|
+
* The browser hash is determined by the main hash plus additional dependencies
|
|
978
|
+
* discovered at runtime. This is used to invalidate browser requests to
|
|
979
|
+
* optimized deps.
|
|
980
|
+
*/
|
|
983
981
|
browserHash: string;
|
|
984
982
|
/**
|
|
985
|
-
|
|
986
|
-
|
|
983
|
+
* Metadata for each already optimized dependency
|
|
984
|
+
*/
|
|
987
985
|
optimized: Record<string, OptimizedDepInfo>;
|
|
988
986
|
/**
|
|
989
|
-
|
|
990
|
-
|
|
987
|
+
* Metadata for non-entry optimized chunks and dynamic imports
|
|
988
|
+
*/
|
|
991
989
|
chunks: Record<string, OptimizedDepInfo>;
|
|
992
990
|
/**
|
|
993
|
-
|
|
994
|
-
|
|
991
|
+
* Metadata for each newly discovered dependency after processing
|
|
992
|
+
*/
|
|
995
993
|
discovered: Record<string, OptimizedDepInfo>;
|
|
996
994
|
/**
|
|
997
|
-
|
|
998
|
-
|
|
995
|
+
* OptimizedDepInfo list
|
|
996
|
+
*/
|
|
999
997
|
depInfoList: OptimizedDepInfo[];
|
|
1000
998
|
}
|
|
1001
999
|
/**
|
|
1002
|
-
* Scan and optimize dependencies within a project.
|
|
1003
|
-
* Used by Vite CLI when running `vite optimize`.
|
|
1004
|
-
*
|
|
1005
|
-
* @deprecated the optimization process runs automatically and does not need to be called
|
|
1006
|
-
*/
|
|
1000
|
+
* Scan and optimize dependencies within a project.
|
|
1001
|
+
* Used by Vite CLI when running `vite optimize`.
|
|
1002
|
+
*
|
|
1003
|
+
* @deprecated the optimization process runs automatically and does not need to be called
|
|
1004
|
+
*/
|
|
1007
1005
|
declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>;
|
|
1008
1006
|
//#endregion
|
|
1009
1007
|
//#region src/node/server/transformRequest.d.ts
|
|
@@ -1019,8 +1017,8 @@ interface TransformResult {
|
|
|
1019
1017
|
}
|
|
1020
1018
|
interface TransformOptions {
|
|
1021
1019
|
/**
|
|
1022
|
-
|
|
1023
|
-
|
|
1020
|
+
* @deprecated inferred from environment
|
|
1021
|
+
*/
|
|
1024
1022
|
ssr?: boolean;
|
|
1025
1023
|
}
|
|
1026
1024
|
//#endregion
|
|
@@ -1028,12 +1026,12 @@ interface TransformOptions {
|
|
|
1028
1026
|
declare class EnvironmentModuleNode {
|
|
1029
1027
|
environment: string;
|
|
1030
1028
|
/**
|
|
1031
|
-
|
|
1032
|
-
|
|
1029
|
+
* Public served url path, starts with /
|
|
1030
|
+
*/
|
|
1033
1031
|
url: string;
|
|
1034
1032
|
/**
|
|
1035
|
-
|
|
1036
|
-
|
|
1033
|
+
* Resolved file system path + query
|
|
1034
|
+
*/
|
|
1037
1035
|
id: string | null;
|
|
1038
1036
|
file: string | null;
|
|
1039
1037
|
type: "js" | "css" | "asset";
|
|
@@ -1051,8 +1049,8 @@ declare class EnvironmentModuleNode {
|
|
|
1051
1049
|
lastHMRTimestamp: number;
|
|
1052
1050
|
lastInvalidationTimestamp: number;
|
|
1053
1051
|
/**
|
|
1054
|
-
|
|
1055
|
-
|
|
1052
|
+
* @param setIsSelfAccepting - set `false` to set `isSelfAccepting` later. e.g. #7870
|
|
1053
|
+
*/
|
|
1056
1054
|
constructor(url: string, environment: string, setIsSelfAccepting?: boolean);
|
|
1057
1055
|
}
|
|
1058
1056
|
type ResolvedUrl = [url: string, resolvedId: string, meta: object | null | undefined];
|
|
@@ -1071,13 +1069,13 @@ declare class EnvironmentModuleGraph {
|
|
|
1071
1069
|
invalidateModule(mod: EnvironmentModuleNode, seen?: Set<EnvironmentModuleNode>, timestamp?: number, isHmr?: boolean, softInvalidate?: boolean): void;
|
|
1072
1070
|
invalidateAll(): void;
|
|
1073
1071
|
/**
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1072
|
+
* Update the module graph based on a module's updated imports information
|
|
1073
|
+
* If there are dependencies that no longer have any importers, they are
|
|
1074
|
+
* returned as a Set.
|
|
1075
|
+
*
|
|
1076
|
+
* @param staticImportedUrls Subset of `importedModules` where they're statically imported in code.
|
|
1077
|
+
* This is only used for soft invalidations so `undefined` is fine but may cause more runtime processing.
|
|
1078
|
+
*/
|
|
1081
1079
|
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>;
|
|
1082
1080
|
ensureEntryFromUrl(rawUrl: string, setIsSelfAccepting?: boolean): Promise<EnvironmentModuleNode>;
|
|
1083
1081
|
createFileOnlyEntry(file: string): EnvironmentModuleNode;
|
|
@@ -1168,33 +1166,33 @@ interface WsOptions {
|
|
|
1168
1166
|
}
|
|
1169
1167
|
interface HmrOptions {
|
|
1170
1168
|
/**
|
|
1171
|
-
|
|
1172
|
-
|
|
1169
|
+
* @deprecated Use `server.ws.protocol` instead.
|
|
1170
|
+
*/
|
|
1173
1171
|
protocol?: string;
|
|
1174
1172
|
/**
|
|
1175
|
-
|
|
1176
|
-
|
|
1173
|
+
* @deprecated Use `server.ws.host` instead.
|
|
1174
|
+
*/
|
|
1177
1175
|
host?: string;
|
|
1178
1176
|
/**
|
|
1179
|
-
|
|
1180
|
-
|
|
1177
|
+
* @deprecated Use `server.ws.port` instead.
|
|
1178
|
+
*/
|
|
1181
1179
|
port?: number;
|
|
1182
1180
|
/**
|
|
1183
|
-
|
|
1184
|
-
|
|
1181
|
+
* @deprecated Use `server.ws.clientPort` instead.
|
|
1182
|
+
*/
|
|
1185
1183
|
clientPort?: number;
|
|
1186
1184
|
/**
|
|
1187
|
-
|
|
1188
|
-
|
|
1185
|
+
* @deprecated Use `server.ws.path` instead.
|
|
1186
|
+
*/
|
|
1189
1187
|
path?: string;
|
|
1190
1188
|
/**
|
|
1191
|
-
|
|
1192
|
-
|
|
1189
|
+
* @deprecated Use `server.ws.timeout` instead.
|
|
1190
|
+
*/
|
|
1193
1191
|
timeout?: number;
|
|
1194
1192
|
overlay?: boolean;
|
|
1195
1193
|
/**
|
|
1196
|
-
|
|
1197
|
-
|
|
1194
|
+
* @deprecated Use `server.ws.server` instead.
|
|
1195
|
+
*/
|
|
1198
1196
|
server?: HttpServer;
|
|
1199
1197
|
}
|
|
1200
1198
|
interface HotUpdateOptions {
|
|
@@ -1218,63 +1216,63 @@ interface HotChannelClient {
|
|
|
1218
1216
|
type HotChannelListener<T extends string = string> = (data: InferCustomEventPayload<T>, client: HotChannelClient) => void;
|
|
1219
1217
|
interface HotChannel<Api = any> {
|
|
1220
1218
|
/**
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1219
|
+
* When true, the fs access check is skipped in fetchModule.
|
|
1220
|
+
* Set this for transports that is not exposed over the network.
|
|
1221
|
+
*/
|
|
1224
1222
|
skipFsCheck?: boolean;
|
|
1225
1223
|
/**
|
|
1226
|
-
|
|
1227
|
-
|
|
1224
|
+
* Broadcast events to all clients
|
|
1225
|
+
*/
|
|
1228
1226
|
send?(payload: hmrPayload_HotPayload): void;
|
|
1229
1227
|
/**
|
|
1230
|
-
|
|
1231
|
-
|
|
1228
|
+
* Handle custom event emitted by `import.meta.hot.send`
|
|
1229
|
+
*/
|
|
1232
1230
|
on?<T extends string>(event: T, listener: HotChannelListener<T>): void;
|
|
1233
1231
|
on?(event: "connection", listener: () => void): void;
|
|
1234
1232
|
/**
|
|
1235
|
-
|
|
1236
|
-
|
|
1233
|
+
* Unregister event listener
|
|
1234
|
+
*/
|
|
1237
1235
|
off?(event: string, listener: Function): void;
|
|
1238
1236
|
/**
|
|
1239
|
-
|
|
1240
|
-
|
|
1237
|
+
* Start listening for messages
|
|
1238
|
+
*/
|
|
1241
1239
|
listen?(): void;
|
|
1242
1240
|
/**
|
|
1243
|
-
|
|
1244
|
-
|
|
1241
|
+
* Disconnect all clients, called when server is closed or restarted.
|
|
1242
|
+
*/
|
|
1245
1243
|
close?(): Promise<unknown> | void;
|
|
1246
1244
|
api?: Api;
|
|
1247
1245
|
}
|
|
1248
1246
|
interface NormalizedHotChannelClient {
|
|
1249
1247
|
/**
|
|
1250
|
-
|
|
1251
|
-
|
|
1248
|
+
* Send event to the client
|
|
1249
|
+
*/
|
|
1252
1250
|
send(payload: hmrPayload_HotPayload): void;
|
|
1253
1251
|
/**
|
|
1254
|
-
|
|
1255
|
-
|
|
1252
|
+
* Send custom event
|
|
1253
|
+
*/
|
|
1256
1254
|
send(event: string, payload?: hmrPayload_CustomPayload["data"]): void;
|
|
1257
1255
|
}
|
|
1258
1256
|
interface NormalizedHotChannel<Api = any> {
|
|
1259
1257
|
/**
|
|
1260
|
-
|
|
1261
|
-
|
|
1258
|
+
* Broadcast events to all clients
|
|
1259
|
+
*/
|
|
1262
1260
|
send(payload: hmrPayload_HotPayload): void;
|
|
1263
1261
|
/**
|
|
1264
|
-
|
|
1265
|
-
|
|
1262
|
+
* Send custom event
|
|
1263
|
+
*/
|
|
1266
1264
|
send<T extends string>(event: T, payload?: InferCustomEventPayload<T>): void;
|
|
1267
1265
|
/**
|
|
1268
|
-
|
|
1269
|
-
|
|
1266
|
+
* Handle custom event emitted by `import.meta.hot.send`
|
|
1267
|
+
*/
|
|
1270
1268
|
on<T extends string>(event: T, listener: (data: InferCustomEventPayload<T>, client: NormalizedHotChannelClient) => void): void;
|
|
1271
1269
|
/**
|
|
1272
|
-
|
|
1273
|
-
|
|
1270
|
+
* @deprecated use `vite:client:connect` event instead
|
|
1271
|
+
*/
|
|
1274
1272
|
on(event: "connection", listener: () => void): void;
|
|
1275
1273
|
/**
|
|
1276
|
-
|
|
1277
|
-
|
|
1274
|
+
* Unregister event listener
|
|
1275
|
+
*/
|
|
1278
1276
|
off(event: string, listener: Function): void;
|
|
1279
1277
|
handleInvoke(payload: hmrPayload_HotPayload): Promise<{
|
|
1280
1278
|
result: any;
|
|
@@ -1282,12 +1280,12 @@ interface NormalizedHotChannel<Api = any> {
|
|
|
1282
1280
|
error: any;
|
|
1283
1281
|
}>;
|
|
1284
1282
|
/**
|
|
1285
|
-
|
|
1286
|
-
|
|
1283
|
+
* Start listening for messages
|
|
1284
|
+
*/
|
|
1287
1285
|
listen(): void;
|
|
1288
1286
|
/**
|
|
1289
|
-
|
|
1290
|
-
|
|
1287
|
+
* Disconnect all clients, called when server is closed or restarted.
|
|
1288
|
+
*/
|
|
1291
1289
|
close(): Promise<unknown> | void;
|
|
1292
1290
|
api?: Api;
|
|
1293
1291
|
}
|
|
@@ -1355,7 +1353,8 @@ declare class WebSocket extends EventEmitter {
|
|
|
1355
1353
|
* Make a paused socket resume emitting events. This method is a noop if the ready
|
|
1356
1354
|
* state is `CONNECTING` or `CLOSED`.
|
|
1357
1355
|
*/
|
|
1358
|
-
resume(): void;
|
|
1356
|
+
resume(): void;
|
|
1357
|
+
// HTML5 WebSocket events
|
|
1359
1358
|
addEventListener(method: 'message', cb: (event: WebSocket.MessageEvent) => void, options?: WebSocket.EventListenerOptions): void;
|
|
1360
1359
|
addEventListener(method: 'close', cb: (event: WebSocket.CloseEvent) => void, options?: WebSocket.EventListenerOptions): void;
|
|
1361
1360
|
addEventListener(method: 'error', cb: (event: WebSocket.ErrorEvent) => void, options?: WebSocket.EventListenerOptions): void;
|
|
@@ -1363,7 +1362,8 @@ declare class WebSocket extends EventEmitter {
|
|
|
1363
1362
|
removeEventListener(method: 'message', cb: (event: WebSocket.MessageEvent) => void): void;
|
|
1364
1363
|
removeEventListener(method: 'close', cb: (event: WebSocket.CloseEvent) => void): void;
|
|
1365
1364
|
removeEventListener(method: 'error', cb: (event: WebSocket.ErrorEvent) => void): void;
|
|
1366
|
-
removeEventListener(method: 'open', cb: (event: WebSocket.Event) => void): void;
|
|
1365
|
+
removeEventListener(method: 'open', cb: (event: WebSocket.Event) => void): void;
|
|
1366
|
+
// Events
|
|
1367
1367
|
on(event: 'close', listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
|
|
1368
1368
|
on(event: 'error', listener: (this: WebSocket, err: Error) => void): this;
|
|
1369
1369
|
on(event: 'upgrade', listener: (this: WebSocket, request: http.IncomingMessage) => void): this;
|
|
@@ -1525,7 +1525,8 @@ declare namespace WebSocket {
|
|
|
1525
1525
|
address: string;
|
|
1526
1526
|
family: string;
|
|
1527
1527
|
port: number;
|
|
1528
|
-
}
|
|
1528
|
+
}
|
|
1529
|
+
// WebSocket Server
|
|
1529
1530
|
class Server<T extends WebSocket = WebSocket> extends EventEmitter {
|
|
1530
1531
|
options: ServerOptions;
|
|
1531
1532
|
path: string;
|
|
@@ -1534,7 +1535,8 @@ declare namespace WebSocket {
|
|
|
1534
1535
|
address(): AddressInfo | string;
|
|
1535
1536
|
close(cb?: (err?: Error) => void): void;
|
|
1536
1537
|
handleUpgrade(request: http.IncomingMessage, socket: Duplex, upgradeHead: Buffer, callback: (client: T, request: http.IncomingMessage) => void): void;
|
|
1537
|
-
shouldHandle(request: http.IncomingMessage): boolean | Promise<boolean>;
|
|
1538
|
+
shouldHandle(request: http.IncomingMessage): boolean | Promise<boolean>;
|
|
1539
|
+
// Events
|
|
1538
1540
|
on(event: 'connection', cb: (this: Server<T>, socket: T, request: http.IncomingMessage) => void): this;
|
|
1539
1541
|
on(event: 'error', cb: (this: Server<T>, error: Error) => void): this;
|
|
1540
1542
|
on(event: 'headers', cb: (this: Server<T>, headers: string[], request: http.IncomingMessage) => void): this;
|
|
@@ -1564,45 +1566,46 @@ declare namespace WebSocket {
|
|
|
1564
1566
|
const WebSocketServer: typeof Server;
|
|
1565
1567
|
interface WebSocketServer extends Server {}
|
|
1566
1568
|
const WebSocket: typeof WebSocketAlias;
|
|
1567
|
-
interface WebSocket extends WebSocketAlias {}
|
|
1569
|
+
interface WebSocket extends WebSocketAlias {}
|
|
1570
|
+
// WebSocket stream
|
|
1568
1571
|
function createWebSocketStream(websocket: WebSocket, options?: DuplexOptions): Duplex;
|
|
1569
|
-
}
|
|
1572
|
+
}
|
|
1570
1573
|
//#endregion
|
|
1571
1574
|
//#region src/node/server/ws.d.ts
|
|
1572
1575
|
type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
|
|
1573
1576
|
declare const isWebSocketServer: unique symbol;
|
|
1574
1577
|
interface WebSocketServer extends NormalizedHotChannel {
|
|
1575
1578
|
/**
|
|
1576
|
-
|
|
1577
|
-
|
|
1579
|
+
* Handle custom event emitted by `import.meta.hot.send`
|
|
1580
|
+
*/
|
|
1578
1581
|
on: WebSocket.Server["on"] & {
|
|
1579
1582
|
<T extends string>(event: T, listener: WebSocketCustomListener<hmrPayload_InferCustomEventPayload<T>>): void;
|
|
1580
1583
|
};
|
|
1581
1584
|
/**
|
|
1582
|
-
|
|
1583
|
-
|
|
1585
|
+
* Unregister event listener.
|
|
1586
|
+
*/
|
|
1584
1587
|
off: WebSocket.Server["off"] & {
|
|
1585
1588
|
(event: string, listener: Function): void;
|
|
1586
1589
|
};
|
|
1587
1590
|
/**
|
|
1588
|
-
|
|
1589
|
-
|
|
1591
|
+
* Listen on port and host
|
|
1592
|
+
*/
|
|
1590
1593
|
listen(): void;
|
|
1591
1594
|
/**
|
|
1592
|
-
|
|
1593
|
-
|
|
1595
|
+
* Disconnect all clients and terminate the server.
|
|
1596
|
+
*/
|
|
1594
1597
|
close(): Promise<void>;
|
|
1595
1598
|
[isWebSocketServer]: true;
|
|
1596
1599
|
/**
|
|
1597
|
-
|
|
1598
|
-
|
|
1600
|
+
* Get all connected clients.
|
|
1601
|
+
*/
|
|
1599
1602
|
clients: Set<WebSocketClient>;
|
|
1600
1603
|
}
|
|
1601
1604
|
interface WebSocketClient extends NormalizedHotChannelClient {
|
|
1602
1605
|
/**
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
+
* The raw WebSocket instance
|
|
1607
|
+
* @advanced
|
|
1608
|
+
*/
|
|
1606
1609
|
socket: WebSocket;
|
|
1607
1610
|
}
|
|
1608
1611
|
//#endregion
|
|
@@ -1623,6 +1626,7 @@ declare class BundledDev {
|
|
|
1623
1626
|
private environment;
|
|
1624
1627
|
private _devEngine;
|
|
1625
1628
|
private initialBuildCompleted;
|
|
1629
|
+
private _closed;
|
|
1626
1630
|
private clients;
|
|
1627
1631
|
private invalidateCalledModules;
|
|
1628
1632
|
private debouncedFullReload;
|
|
@@ -1662,37 +1666,37 @@ declare class DevEnvironment extends BaseEnvironment {
|
|
|
1662
1666
|
depsOptimizer?: DepsOptimizer;
|
|
1663
1667
|
get pluginContainer(): EnvironmentPluginContainer<DevEnvironment>;
|
|
1664
1668
|
/**
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1669
|
+
* Hot channel for this environment. If not provided or disabled,
|
|
1670
|
+
* it will be a noop channel that does nothing.
|
|
1671
|
+
*
|
|
1672
|
+
* @example
|
|
1673
|
+
* environment.hot.send({ type: 'full-reload' })
|
|
1674
|
+
*/
|
|
1671
1675
|
hot: NormalizedHotChannel;
|
|
1672
1676
|
bundledDev?: BundledDev;
|
|
1673
1677
|
constructor(name: string, config: ResolvedConfig, context: DevEnvironmentContext);
|
|
1674
1678
|
init(options?: {
|
|
1675
1679
|
watcher?: FSWatcher;
|
|
1676
1680
|
/**
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
+
* the previous instance used for the environment with the same name
|
|
1682
|
+
*
|
|
1683
|
+
* when using, the consumer should check if it's an instance generated from the same class or factory function
|
|
1684
|
+
*/
|
|
1681
1685
|
previousInstance?: DevEnvironment;
|
|
1682
1686
|
}): Promise<void>;
|
|
1683
1687
|
/**
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1688
|
+
* When the dev server is restarted, the methods are called in the following order:
|
|
1689
|
+
* - new instance `init`
|
|
1690
|
+
* - previous instance `close`
|
|
1691
|
+
* - new instance `listen`
|
|
1692
|
+
*/
|
|
1689
1693
|
listen(server: ViteDevServer): Promise<void>;
|
|
1690
1694
|
/**
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1695
|
+
* Called by the module runner to retrieve information about the specified
|
|
1696
|
+
* module. Internally calls `transformRequest` and wraps the result in the
|
|
1697
|
+
* format that the module runner understands.
|
|
1698
|
+
* This method is not meant to be called manually.
|
|
1699
|
+
*/
|
|
1696
1700
|
fetchModule(id: string, importer?: string, options?: FetchFunctionOptions): Promise<moduleRunner_FetchResult>;
|
|
1697
1701
|
reloadModule(module: EnvironmentModuleNode): Promise<void>;
|
|
1698
1702
|
transformRequest(url: string): Promise<TransformResult | null>;
|
|
@@ -1704,13 +1708,13 @@ declare class DevEnvironment extends BaseEnvironment {
|
|
|
1704
1708
|
}, _client: NormalizedHotChannelClient): void;
|
|
1705
1709
|
close(): Promise<void>;
|
|
1706
1710
|
/**
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1711
|
+
* Calling `await environment.waitForRequestsIdle(id)` will wait until all static imports
|
|
1712
|
+
* are processed after the first transformRequest call. If called from a load or transform
|
|
1713
|
+
* plugin hook, the id needs to be passed as a parameter to avoid deadlocks.
|
|
1714
|
+
* Calling this function after the first static imports section of the module graph has been
|
|
1715
|
+
* processed will resolve immediately.
|
|
1716
|
+
* @experimental
|
|
1717
|
+
*/
|
|
1714
1718
|
waitForRequestsIdle(ignoredId?: string): Promise<void>;
|
|
1715
1719
|
}
|
|
1716
1720
|
//#endregion
|
|
@@ -1951,55 +1955,55 @@ interface RollupDynamicImportVarsOptions {
|
|
|
1951
1955
|
//#region src/node/plugins/terser.d.ts
|
|
1952
1956
|
interface TerserOptions extends TerserMinifyOptions {
|
|
1953
1957
|
/**
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1958
|
+
* Vite-specific option to specify the max number of workers to spawn
|
|
1959
|
+
* when minifying files with terser.
|
|
1960
|
+
*
|
|
1961
|
+
* @default number of CPUs minus 1
|
|
1962
|
+
*/
|
|
1959
1963
|
maxWorkers?: number;
|
|
1960
1964
|
}
|
|
1961
1965
|
//#endregion
|
|
1962
1966
|
//#region src/node/plugins/resolve.d.ts
|
|
1963
1967
|
interface EnvironmentResolveOptions {
|
|
1964
1968
|
/**
|
|
1965
|
-
|
|
1966
|
-
|
|
1969
|
+
* @default ['browser', 'module', 'jsnext:main', 'jsnext']
|
|
1970
|
+
*/
|
|
1967
1971
|
mainFields?: string[];
|
|
1968
1972
|
conditions?: string[];
|
|
1969
1973
|
externalConditions?: string[];
|
|
1970
1974
|
/**
|
|
1971
|
-
|
|
1972
|
-
|
|
1975
|
+
* @default ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']
|
|
1976
|
+
*/
|
|
1973
1977
|
extensions?: string[];
|
|
1974
1978
|
dedupe?: string[];
|
|
1975
1979
|
/**
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
+
* Prevent listed dependencies from being externalized and will get bundled in build.
|
|
1981
|
+
* Only works in server environments for now. Previously this was `ssr.noExternal`.
|
|
1982
|
+
* @experimental
|
|
1983
|
+
*/
|
|
1980
1984
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
|
1981
1985
|
/**
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
+
* Externalize the given dependencies and their transitive dependencies.
|
|
1987
|
+
* Only works in server environments for now. Previously this was `ssr.external`.
|
|
1988
|
+
* @experimental
|
|
1989
|
+
*/
|
|
1986
1990
|
external?: string[] | true;
|
|
1987
1991
|
/**
|
|
1988
|
-
|
|
1989
|
-
|
|
1992
|
+
* Array of strings or regular expressions that indicate what modules are builtin for the environment.
|
|
1993
|
+
*/
|
|
1990
1994
|
builtins?: (string | RegExp)[];
|
|
1991
1995
|
}
|
|
1992
1996
|
interface ResolveOptions extends EnvironmentResolveOptions {
|
|
1993
1997
|
/**
|
|
1994
|
-
|
|
1995
|
-
|
|
1998
|
+
* @default false
|
|
1999
|
+
*/
|
|
1996
2000
|
preserveSymlinks?: boolean;
|
|
1997
2001
|
/**
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2002
|
+
* Enable tsconfig paths resolution
|
|
2003
|
+
*
|
|
2004
|
+
* @default false
|
|
2005
|
+
* @experimental
|
|
2006
|
+
*/
|
|
2003
2007
|
tsconfigPaths?: boolean;
|
|
2004
2008
|
}
|
|
2005
2009
|
interface ResolvePluginOptions {
|
|
@@ -2008,10 +2012,10 @@ interface ResolvePluginOptions {
|
|
|
2008
2012
|
isProduction: boolean;
|
|
2009
2013
|
packageCache?: PackageCache;
|
|
2010
2014
|
/**
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
+
* src code mode also attempts the following:
|
|
2016
|
+
* - resolving /xxx as URLs
|
|
2017
|
+
* - resolving bare imports from optimized deps
|
|
2018
|
+
*/
|
|
2015
2019
|
asSrc?: boolean;
|
|
2016
2020
|
tryIndex?: boolean;
|
|
2017
2021
|
tryPrefix?: string;
|
|
@@ -2019,8 +2023,8 @@ interface ResolvePluginOptions {
|
|
|
2019
2023
|
isRequire?: boolean;
|
|
2020
2024
|
scan?: boolean;
|
|
2021
2025
|
/**
|
|
2022
|
-
|
|
2023
|
-
|
|
2026
|
+
* Enable when `legacy.inconsistentCjsInterop` is true. See that option for more details.
|
|
2027
|
+
*/
|
|
2024
2028
|
legacyInconsistentCjsInterop?: boolean;
|
|
2025
2029
|
}
|
|
2026
2030
|
interface InternalResolveOptions extends Required<ResolveOptions>, ResolvePluginOptions {}
|
|
@@ -2050,270 +2054,272 @@ interface PackageData {
|
|
|
2050
2054
|
//#region src/node/plugins/license.d.ts
|
|
2051
2055
|
interface LicenseOptions {
|
|
2052
2056
|
/**
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2057
|
+
* The output file name of the license file relative to the output directory.
|
|
2058
|
+
* Specify a path that ends with `.json` to output the raw JSON metadata.
|
|
2059
|
+
*
|
|
2060
|
+
* @default '.vite/license.md'
|
|
2061
|
+
*/
|
|
2058
2062
|
fileName: string;
|
|
2059
2063
|
}
|
|
2060
2064
|
//#endregion
|
|
2061
2065
|
//#region src/node/build.d.ts
|
|
2062
2066
|
interface BuildEnvironmentOptions {
|
|
2063
2067
|
/**
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2068
|
+
* Compatibility transform target. The transform is performed with esbuild
|
|
2069
|
+
* and the lowest supported target is es2015. Note this only handles
|
|
2070
|
+
* syntax transformation and does not cover polyfills
|
|
2071
|
+
*
|
|
2072
|
+
* Default: 'baseline-widely-available' - transpile targeting browsers that
|
|
2073
|
+
* are included in the Baseline Widely Available on 2026-01-01.
|
|
2074
|
+
* (Chrome 111+, Edge 111+, Firefox 114+, Safari 16.4+).
|
|
2075
|
+
*
|
|
2076
|
+
* Another special value is 'esnext' - which only performs minimal transpiling
|
|
2077
|
+
* (for minification compat).
|
|
2078
|
+
*
|
|
2079
|
+
* For custom targets, see https://esbuild.github.io/api/#target and
|
|
2080
|
+
* https://esbuild.github.io/content-types/#javascript for more details.
|
|
2081
|
+
* @default 'baseline-widely-available'
|
|
2082
|
+
*/
|
|
2079
2083
|
target?: "baseline-widely-available" | EsbuildTarget | false;
|
|
2080
2084
|
/**
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2085
|
+
* whether to inject module preload polyfill.
|
|
2086
|
+
* Note: does not apply to library mode.
|
|
2087
|
+
* @default true
|
|
2088
|
+
* @deprecated use `modulePreload.polyfill` instead
|
|
2089
|
+
*/
|
|
2086
2090
|
polyfillModulePreload?: boolean;
|
|
2087
2091
|
/**
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
+
* Configure module preload
|
|
2093
|
+
* Note: does not apply to library mode.
|
|
2094
|
+
* @default true
|
|
2095
|
+
*/
|
|
2092
2096
|
modulePreload?: boolean | ModulePreloadOptions;
|
|
2093
2097
|
/**
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
+
* Directory relative from `root` where build output will be placed. If the
|
|
2099
|
+
* directory exists, it will be removed before the build.
|
|
2100
|
+
* @default 'dist'
|
|
2101
|
+
*/
|
|
2098
2102
|
outDir?: string;
|
|
2099
2103
|
/**
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
+
* Directory relative from `outDir` where the built js/css/image assets will
|
|
2105
|
+
* be placed.
|
|
2106
|
+
* @default 'assets'
|
|
2107
|
+
*/
|
|
2104
2108
|
assetsDir?: string;
|
|
2105
2109
|
/**
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2110
|
+
* Static asset files smaller than this number (in bytes) will be inlined as
|
|
2111
|
+
* base64 strings. If a callback is passed, a boolean can be returned to opt-in
|
|
2112
|
+
* or opt-out of inlining. If nothing is returned the default logic applies.
|
|
2113
|
+
*
|
|
2114
|
+
* Default limit is `4096` (4 KiB). Set to `0` to disable.
|
|
2115
|
+
* @default 4096
|
|
2116
|
+
*/
|
|
2113
2117
|
assetsInlineLimit?: number | ((filePath: string, content: Buffer) => boolean | undefined);
|
|
2114
2118
|
/**
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2119
|
+
* Whether to code-split CSS. When enabled, CSS in async chunks will be
|
|
2120
|
+
* inlined as strings in the chunk and inserted via dynamically created
|
|
2121
|
+
* style tags when the chunk is loaded.
|
|
2122
|
+
* @default true
|
|
2123
|
+
*/
|
|
2120
2124
|
cssCodeSplit?: boolean;
|
|
2121
2125
|
/**
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2126
|
+
* An optional separate target for CSS minification.
|
|
2127
|
+
* As esbuild only supports configuring targets to mainstream
|
|
2128
|
+
* browsers, users may need this option when they are targeting
|
|
2129
|
+
* a niche browser that comes with most modern JavaScript features
|
|
2130
|
+
* but has poor CSS support, e.g. Android WeChat WebView, which
|
|
2131
|
+
* doesn't support the #RGBA syntax.
|
|
2132
|
+
* @default target
|
|
2133
|
+
*/
|
|
2130
2134
|
cssTarget?: EsbuildTarget | false;
|
|
2131
2135
|
/**
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
+
* Override CSS minification specifically instead of defaulting to `build.minify`,
|
|
2137
|
+
* so you can configure minification for JS and CSS separately.
|
|
2138
|
+
* @default 'lightningcss', but false if build.minify is disabled for client build
|
|
2139
|
+
*/
|
|
2136
2140
|
cssMinify?: boolean | "lightningcss" | "esbuild";
|
|
2137
2141
|
/**
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2142
|
+
* If `true`, a separate sourcemap file will be created. If 'inline', the
|
|
2143
|
+
* sourcemap will be appended to the resulting output file as data URI.
|
|
2144
|
+
* 'hidden' works like `true` except that the corresponding sourcemap
|
|
2145
|
+
* comments in the bundled files are suppressed.
|
|
2146
|
+
* @default false
|
|
2147
|
+
*/
|
|
2144
2148
|
sourcemap?: boolean | "inline" | "hidden";
|
|
2145
2149
|
/**
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
+
* Set to `false` to disable minification, or specify the minifier to use.
|
|
2151
|
+
* Available options are 'oxc' or 'terser' or 'esbuild'.
|
|
2152
|
+
* @default 'oxc'
|
|
2153
|
+
*/
|
|
2150
2154
|
minify?: boolean | "oxc" | "terser" | "esbuild";
|
|
2151
2155
|
/**
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2156
|
+
* Options for terser
|
|
2157
|
+
* https://terser.org/docs/api-reference#minify-options
|
|
2158
|
+
*
|
|
2159
|
+
* In addition, you can also pass a `maxWorkers: number` option to specify the
|
|
2160
|
+
* max number of workers to spawn. Defaults to the number of CPUs minus 1.
|
|
2161
|
+
*/
|
|
2158
2162
|
terserOptions?: TerserOptions;
|
|
2159
2163
|
/**
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
+
* Whether to use import maps feature to optimize chunk caching efficiency.
|
|
2165
|
+
* @default false
|
|
2166
|
+
* @experimental
|
|
2167
|
+
*/
|
|
2164
2168
|
chunkImportMap?: boolean;
|
|
2165
2169
|
/**
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2170
|
+
* Alias to `rolldownOptions`
|
|
2171
|
+
* @deprecated Use `rolldownOptions` instead.
|
|
2172
|
+
*/
|
|
2169
2173
|
rollupOptions?: RolldownOptions;
|
|
2170
2174
|
/**
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2175
|
+
* Will be merged with internal rolldown options.
|
|
2176
|
+
* https://rolldown.rs/reference/Interface.RolldownOptions
|
|
2177
|
+
*/
|
|
2174
2178
|
rolldownOptions?: RolldownOptions;
|
|
2175
2179
|
/**
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2180
|
+
* Options to pass on to `@rollup/plugin-commonjs`
|
|
2181
|
+
* @deprecated This option is no-op and will be removed in future versions.
|
|
2182
|
+
*/
|
|
2179
2183
|
commonjsOptions?: RollupCommonJSOptions;
|
|
2180
2184
|
/**
|
|
2181
|
-
|
|
2182
|
-
|
|
2185
|
+
* Options to pass on to `@rollup/plugin-dynamic-import-vars`
|
|
2186
|
+
*/
|
|
2183
2187
|
dynamicImportVarsOptions?: RollupDynamicImportVarsOptions;
|
|
2184
2188
|
/**
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2189
|
+
* Whether to write bundle to disk
|
|
2190
|
+
* @default true
|
|
2191
|
+
*/
|
|
2188
2192
|
write?: boolean;
|
|
2189
2193
|
/**
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2194
|
+
* Empty outDir on write.
|
|
2195
|
+
* @default true when outDir is a sub directory of project root
|
|
2196
|
+
*/
|
|
2193
2197
|
emptyOutDir?: boolean | null;
|
|
2194
2198
|
/**
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2199
|
+
* Copy the public directory to outDir on write.
|
|
2200
|
+
* @default true
|
|
2201
|
+
*/
|
|
2198
2202
|
copyPublicDir?: boolean;
|
|
2199
2203
|
/**
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
+
* Whether to emit a `.vite/license.md` file that includes all bundled dependencies'
|
|
2205
|
+
* licenses. Pass an object to customize the output file name.
|
|
2206
|
+
* @default false
|
|
2207
|
+
*/
|
|
2204
2208
|
license?: boolean | LicenseOptions;
|
|
2205
2209
|
/**
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2210
|
+
* Whether to emit a .vite/manifest.json in the output dir to map hash-less filenames
|
|
2211
|
+
* to their hashed versions. Useful when you want to generate your own HTML
|
|
2212
|
+
* instead of using the one generated by Vite.
|
|
2213
|
+
*
|
|
2214
|
+
* Example:
|
|
2215
|
+
*
|
|
2216
|
+
* ```json
|
|
2217
|
+
* {
|
|
2218
|
+
* "main.js": {
|
|
2219
|
+
* "file": "main.68fe3fad.js",
|
|
2220
|
+
* "css": "main.e6b63442.css",
|
|
2221
|
+
* "imports": [...],
|
|
2222
|
+
* "dynamicImports": [...]
|
|
2223
|
+
* }
|
|
2224
|
+
* }
|
|
2225
|
+
* ```
|
|
2226
|
+
* @default false
|
|
2227
|
+
*/
|
|
2224
2228
|
manifest?: boolean | string;
|
|
2225
2229
|
/**
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2230
|
+
* Build in library mode. The value should be the global name of the lib in
|
|
2231
|
+
* UMD mode. This will produce esm + cjs + umd bundle formats with default
|
|
2232
|
+
* configurations that are suitable for distributing libraries.
|
|
2233
|
+
* @default false
|
|
2234
|
+
*/
|
|
2231
2235
|
lib?: LibraryOptions | false;
|
|
2232
2236
|
/**
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
+
* Produce SSR oriented build. Note this requires specifying SSR entry via
|
|
2238
|
+
* `rolldownOptions.input`.
|
|
2239
|
+
* @default false
|
|
2240
|
+
*/
|
|
2237
2241
|
ssr?: boolean | string;
|
|
2238
2242
|
/**
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
+
* Generate SSR manifest for determining style links and asset preload
|
|
2244
|
+
* directives in production.
|
|
2245
|
+
* @default false
|
|
2246
|
+
*/
|
|
2243
2247
|
ssrManifest?: boolean | string;
|
|
2244
2248
|
/**
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2249
|
+
* Emit assets during SSR.
|
|
2250
|
+
* @default false
|
|
2251
|
+
*/
|
|
2248
2252
|
ssrEmitAssets?: boolean;
|
|
2249
2253
|
/**
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2254
|
+
* Emit assets during build. Frameworks can set environments.ssr.build.emitAssets
|
|
2255
|
+
* By default, it is true for the client and false for other environments.
|
|
2256
|
+
*/
|
|
2253
2257
|
emitAssets?: boolean;
|
|
2254
2258
|
/**
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
+
* Set to false to disable reporting compressed chunk sizes.
|
|
2260
|
+
* Can slightly improve build speed.
|
|
2261
|
+
* @default true
|
|
2262
|
+
*/
|
|
2259
2263
|
reportCompressedSize?: boolean;
|
|
2260
2264
|
/**
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2265
|
+
* Adjust chunk size warning limit (in kB).
|
|
2266
|
+
* @default 500
|
|
2267
|
+
*/
|
|
2264
2268
|
chunkSizeWarningLimit?: number;
|
|
2265
2269
|
/**
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
+
* Rollup watch options
|
|
2271
|
+
* https://rollupjs.org/configuration-options/#watch
|
|
2272
|
+
* @default null
|
|
2273
|
+
*/
|
|
2270
2274
|
watch?: WatcherOptions | null;
|
|
2271
2275
|
/**
|
|
2272
|
-
|
|
2273
|
-
|
|
2276
|
+
* create the Build Environment instance
|
|
2277
|
+
*/
|
|
2274
2278
|
createEnvironment?: (name: string, config: ResolvedConfig) => Promise<BuildEnvironment> | BuildEnvironment;
|
|
2275
2279
|
}
|
|
2276
2280
|
type BuildOptions = BuildEnvironmentOptions;
|
|
2277
2281
|
interface LibraryOptions {
|
|
2278
2282
|
/**
|
|
2279
|
-
|
|
2280
|
-
|
|
2283
|
+
* Path of library entry
|
|
2284
|
+
*/
|
|
2281
2285
|
entry: InputOption;
|
|
2282
2286
|
/**
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2287
|
+
* The name of the exposed global variable. Required when the `formats` option includes
|
|
2288
|
+
* `umd` or `iife`
|
|
2289
|
+
*/
|
|
2286
2290
|
name?: string;
|
|
2287
2291
|
/**
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2292
|
+
* Output bundle formats. Defaults to `['es', 'umd']` for a single entry, or
|
|
2293
|
+
* `['es', 'cjs']` for multiple entries (`umd` and `iife` do not support
|
|
2294
|
+
* multiple entries).
|
|
2295
|
+
* @default ['es', 'umd']
|
|
2296
|
+
*/
|
|
2291
2297
|
formats?: LibraryFormats[];
|
|
2292
2298
|
/**
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2299
|
+
* The name of the package file output. The default file name is the name option
|
|
2300
|
+
* of the project package.json. It can also be defined as a function taking the
|
|
2301
|
+
* format as an argument.
|
|
2302
|
+
*/
|
|
2297
2303
|
fileName?: string | ((format: ModuleFormat, entryName: string) => string);
|
|
2298
2304
|
/**
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2305
|
+
* The name of the CSS file output if the library imports CSS. Defaults to the
|
|
2306
|
+
* same value as `build.lib.fileName` if it's set a string, otherwise it falls
|
|
2307
|
+
* back to the name option of the project package.json.
|
|
2308
|
+
*/
|
|
2303
2309
|
cssFileName?: string;
|
|
2304
2310
|
}
|
|
2305
2311
|
type LibraryFormats = "es" | "cjs" | "umd" | "iife";
|
|
2306
2312
|
interface ModulePreloadOptions {
|
|
2307
2313
|
/**
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2314
|
+
* Whether to inject a module preload polyfill.
|
|
2315
|
+
* Note: does not apply to library mode.
|
|
2316
|
+
* @default true
|
|
2317
|
+
*/
|
|
2312
2318
|
polyfill?: boolean;
|
|
2313
2319
|
/**
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2320
|
+
* Resolve the list of dependencies to preload for a given dynamic import
|
|
2321
|
+
* @experimental
|
|
2322
|
+
*/
|
|
2317
2323
|
resolveDependencies?: ResolveModulePreloadDependenciesFn;
|
|
2318
2324
|
}
|
|
2319
2325
|
interface ResolvedModulePreloadOptions {
|
|
@@ -2331,9 +2337,9 @@ interface ResolvedBuildOptions extends Required<Omit<BuildOptions, "polyfillModu
|
|
|
2331
2337
|
modulePreload: false | ResolvedModulePreloadOptions;
|
|
2332
2338
|
}
|
|
2333
2339
|
/**
|
|
2334
|
-
* Bundles a single environment for production.
|
|
2335
|
-
* Returns a Promise containing the build result.
|
|
2336
|
-
*/
|
|
2340
|
+
* Bundles a single environment for production.
|
|
2341
|
+
* Returns a Promise containing the build result.
|
|
2342
|
+
*/
|
|
2337
2343
|
declare function build(inlineConfig?: InlineConfig): Promise<RolldownOutput | RolldownOutput[] | RolldownWatcher>;
|
|
2338
2344
|
type RenderBuiltAssetUrl = (filename: string, type: {
|
|
2339
2345
|
type: "asset" | "public";
|
|
@@ -2361,38 +2367,38 @@ interface ViteBuilder {
|
|
|
2361
2367
|
}
|
|
2362
2368
|
interface BuilderOptions {
|
|
2363
2369
|
/**
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2370
|
+
* Whether to share the config instance among environments to align with the behavior of dev server.
|
|
2371
|
+
*
|
|
2372
|
+
* @default false
|
|
2373
|
+
* @experimental
|
|
2374
|
+
*/
|
|
2369
2375
|
sharedConfigBuild?: boolean;
|
|
2370
2376
|
/**
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2377
|
+
* Whether to share the plugin instances among environments to align with the behavior of dev server.
|
|
2378
|
+
*
|
|
2379
|
+
* @default false
|
|
2380
|
+
* @experimental
|
|
2381
|
+
*/
|
|
2376
2382
|
sharedPlugins?: boolean;
|
|
2377
2383
|
buildApp?: (builder: ViteBuilder) => Promise<void>;
|
|
2378
2384
|
}
|
|
2379
2385
|
type ResolvedBuilderOptions = Required<BuilderOptions>;
|
|
2380
2386
|
/**
|
|
2381
|
-
* Creates a ViteBuilder to orchestrate building multiple environments.
|
|
2382
|
-
* @experimental
|
|
2383
|
-
*/
|
|
2387
|
+
* Creates a ViteBuilder to orchestrate building multiple environments.
|
|
2388
|
+
* @experimental
|
|
2389
|
+
*/
|
|
2384
2390
|
declare function createBuilder(inlineConfig?: InlineConfig, useLegacyBuilder?: null | boolean): Promise<ViteBuilder>;
|
|
2385
2391
|
type BuildAppHook = (this: MinimalPluginContextWithoutEnvironment, builder: ViteBuilder) => Promise<void>;
|
|
2386
2392
|
//#endregion
|
|
2387
2393
|
//#region src/node/environment.d.ts
|
|
2388
2394
|
type Environment = DevEnvironment | BuildEnvironment | ScanEnvironment | UnknownEnvironment;
|
|
2389
2395
|
/**
|
|
2390
|
-
* Creates a function that hides the complexities of a WeakMap with an initial value
|
|
2391
|
-
* to implement object metadata. Used by plugins to implement cross hooks per
|
|
2392
|
-
* environment metadata
|
|
2393
|
-
*
|
|
2394
|
-
* @experimental
|
|
2395
|
-
*/
|
|
2396
|
+
* Creates a function that hides the complexities of a WeakMap with an initial value
|
|
2397
|
+
* to implement object metadata. Used by plugins to implement cross hooks per
|
|
2398
|
+
* environment metadata
|
|
2399
|
+
*
|
|
2400
|
+
* @experimental
|
|
2401
|
+
*/
|
|
2396
2402
|
declare function perEnvironmentState<State>(initial: (environment: Environment) => State): (context: PluginContext) => State;
|
|
2397
2403
|
//#endregion
|
|
2398
2404
|
//#region src/node/server/pluginContainer.d.ts
|
|
@@ -2428,7 +2434,8 @@ declare class EnvironmentPluginContainer<Env extends Environment = Environment>
|
|
|
2428
2434
|
resolveId(rawId: string, importer?: string | undefined, options?: {
|
|
2429
2435
|
kind?: ImportKind;
|
|
2430
2436
|
attributes?: Record<string, string>;
|
|
2431
|
-
custom?: CustomPluginOptions;
|
|
2437
|
+
custom?: CustomPluginOptions;
|
|
2438
|
+
/** @deprecated use `skipCalls` instead */
|
|
2432
2439
|
skip?: Set<Plugin>;
|
|
2433
2440
|
skipCalls?: readonly SkipInformation[];
|
|
2434
2441
|
|
|
@@ -2478,7 +2485,8 @@ declare class PluginContainer {
|
|
|
2478
2485
|
}): Promise<void>;
|
|
2479
2486
|
resolveId(rawId: string, importer?: string, options?: {
|
|
2480
2487
|
attributes?: Record<string, string>;
|
|
2481
|
-
custom?: CustomPluginOptions;
|
|
2488
|
+
custom?: CustomPluginOptions;
|
|
2489
|
+
/** @deprecated use `skipCalls` instead */
|
|
2482
2490
|
skip?: Set<Plugin>;
|
|
2483
2491
|
skipCalls?: readonly SkipInformation[];
|
|
2484
2492
|
ssr?: boolean;
|
|
@@ -2500,100 +2508,91 @@ declare class PluginContainer {
|
|
|
2500
2508
|
}>;
|
|
2501
2509
|
close(): Promise<void>;
|
|
2502
2510
|
}
|
|
2503
|
-
/**
|
|
2504
|
-
* server.pluginContainer compatibility
|
|
2505
|
-
*
|
|
2506
|
-
* The default environment is in buildStart, buildEnd, watchChange, and closeBundle hooks,
|
|
2507
|
-
* which are called once for all environments, or when no environment is passed in other hooks.
|
|
2508
|
-
* The ssrEnvironment is needed for backward compatibility when the ssr flag is passed without
|
|
2509
|
-
* an environment. The defaultEnvironment in the main pluginContainer in the server should be
|
|
2510
|
-
* the client environment for backward compatibility.
|
|
2511
|
-
**/
|
|
2512
2511
|
//#endregion
|
|
2513
2512
|
//#region src/node/server/index.d.ts
|
|
2514
2513
|
interface ServerOptions$1 extends CommonServerOptions {
|
|
2515
2514
|
/**
|
|
2516
|
-
|
|
2517
|
-
|
|
2515
|
+
* Configure HMR-specific options (port, host, path & protocol)
|
|
2516
|
+
*/
|
|
2518
2517
|
hmr?: HmrOptions | boolean;
|
|
2519
2518
|
/**
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2519
|
+
* Configure WebSocket connection options.
|
|
2520
|
+
* Set to `false` to disable the WebSocket server and connection.
|
|
2521
|
+
*/
|
|
2523
2522
|
ws?: WsOptions | false;
|
|
2524
2523
|
/**
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2524
|
+
* Warm-up files to transform and cache the results in advance. This improves the
|
|
2525
|
+
* initial page load during server starts and prevents transform waterfalls.
|
|
2526
|
+
*/
|
|
2528
2527
|
warmup?: {
|
|
2529
2528
|
/**
|
|
2530
|
-
|
|
2531
|
-
|
|
2529
|
+
* The files to be transformed and used on the client-side. Supports glob patterns.
|
|
2530
|
+
*/
|
|
2532
2531
|
clientFiles?: string[];
|
|
2533
2532
|
/**
|
|
2534
|
-
|
|
2535
|
-
|
|
2533
|
+
* The files to be transformed and used in SSR. Supports glob patterns.
|
|
2534
|
+
*/
|
|
2536
2535
|
ssrFiles?: string[];
|
|
2537
2536
|
};
|
|
2538
2537
|
/**
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2538
|
+
* chokidar watch options or null to disable FS watching
|
|
2539
|
+
* https://github.com/paulmillr/chokidar/tree/3.6.0#api
|
|
2540
|
+
*/
|
|
2542
2541
|
watch?: WatchOptions | null;
|
|
2543
2542
|
/**
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2543
|
+
* Create Vite dev server to be used as a middleware in an existing server
|
|
2544
|
+
* @default false
|
|
2545
|
+
*/
|
|
2547
2546
|
middlewareMode?: boolean | {
|
|
2548
2547
|
/**
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2548
|
+
* Parent server instance to attach to
|
|
2549
|
+
*
|
|
2550
|
+
* This is needed to proxy WebSocket connections to the parent server.
|
|
2551
|
+
*/
|
|
2553
2552
|
server: HttpServer;
|
|
2554
2553
|
};
|
|
2555
2554
|
/**
|
|
2556
|
-
|
|
2557
|
-
|
|
2555
|
+
* Options for files served via '/\@fs/'.
|
|
2556
|
+
*/
|
|
2558
2557
|
fs?: FileSystemServeOptions;
|
|
2559
2558
|
/**
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2559
|
+
* Origin for the generated asset URLs.
|
|
2560
|
+
*
|
|
2561
|
+
* @example `http://127.0.0.1:8080`
|
|
2562
|
+
*/
|
|
2564
2563
|
origin?: string;
|
|
2565
2564
|
/**
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2565
|
+
* Pre-transform known direct imports
|
|
2566
|
+
* @default true
|
|
2567
|
+
*/
|
|
2569
2568
|
preTransformRequests?: boolean;
|
|
2570
2569
|
/**
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2570
|
+
* Whether or not to ignore-list source files in the dev server sourcemap, used to populate
|
|
2571
|
+
* the [`x_google_ignoreList` source map extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).
|
|
2572
|
+
*
|
|
2573
|
+
* By default, it excludes all paths containing `node_modules`. You can pass `false` to
|
|
2574
|
+
* disable this behavior, or, for full control, a function that takes the source path and
|
|
2575
|
+
* sourcemap path and returns whether to ignore the source path.
|
|
2576
|
+
*/
|
|
2578
2577
|
sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean);
|
|
2579
2578
|
/**
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2579
|
+
* Backward compatibility. The buildStart and buildEnd hooks were called only once for
|
|
2580
|
+
* the client environment. This option enables per-environment buildStart and buildEnd hooks.
|
|
2581
|
+
* @default false
|
|
2582
|
+
* @experimental
|
|
2583
|
+
*/
|
|
2585
2584
|
perEnvironmentStartEndDuringDev?: boolean;
|
|
2586
2585
|
/**
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2586
|
+
* Backward compatibility. The watchChange hook was called only once for the client environment.
|
|
2587
|
+
* This option enables per-environment watchChange hooks.
|
|
2588
|
+
* @default false
|
|
2589
|
+
* @experimental
|
|
2590
|
+
*/
|
|
2592
2591
|
perEnvironmentWatchChangeDuringDev?: boolean;
|
|
2593
2592
|
/**
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2593
|
+
* Run HMR tasks, by default the HMR propagation is done in parallel for all environments
|
|
2594
|
+
* @experimental
|
|
2595
|
+
*/
|
|
2597
2596
|
hotUpdateEnvironments?: (server: ViteDevServer, hmr: (environment: DevEnvironment) => Promise<void>) => Promise<void>;
|
|
2598
2597
|
forwardConsole?: boolean | ForwardConsoleOptions;
|
|
2599
2598
|
}
|
|
@@ -2605,156 +2604,156 @@ interface ResolvedServerOptions extends Omit<RequiredExceptFor<ServerOptions$1,
|
|
|
2605
2604
|
}
|
|
2606
2605
|
interface FileSystemServeOptions {
|
|
2607
2606
|
/**
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2607
|
+
* Strictly restrict file accessing outside of allowing paths.
|
|
2608
|
+
*
|
|
2609
|
+
* Set to `false` to disable the warning
|
|
2610
|
+
*
|
|
2611
|
+
* @default true
|
|
2612
|
+
*/
|
|
2614
2613
|
strict?: boolean;
|
|
2615
2614
|
/**
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2615
|
+
* Restrict accessing files outside the allowed directories.
|
|
2616
|
+
*
|
|
2617
|
+
* Accepts absolute path or a path relative to project root.
|
|
2618
|
+
* Will try to search up for workspace root by default.
|
|
2619
|
+
*/
|
|
2621
2620
|
allow?: string[];
|
|
2622
2621
|
/**
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2622
|
+
* Restrict accessing files that matches the patterns.
|
|
2623
|
+
*
|
|
2624
|
+
* This will have higher priority than `allow`.
|
|
2625
|
+
* picomatch patterns are supported.
|
|
2626
|
+
*
|
|
2627
|
+
* @default ['.env', '.env.*', '*.{crt,pem,key,p12,pfx,cer,der}', '.npmrc', '.yarnrc.yml', '**\/.git/**']
|
|
2628
|
+
*/
|
|
2630
2629
|
deny?: string[];
|
|
2631
2630
|
}
|
|
2632
2631
|
type ServerHook = (this: MinimalPluginContextWithoutEnvironment, server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
2633
2632
|
type HttpServer = http.Server | Http2SecureServer;
|
|
2634
2633
|
interface ViteDevServer {
|
|
2635
2634
|
/**
|
|
2636
|
-
|
|
2637
|
-
|
|
2635
|
+
* The resolved vite config object
|
|
2636
|
+
*/
|
|
2638
2637
|
config: ResolvedConfig;
|
|
2639
2638
|
/**
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2639
|
+
* A connect app instance.
|
|
2640
|
+
* - Can be used to attach custom middlewares to the dev server.
|
|
2641
|
+
* - Can also be used as the handler function of a custom http server
|
|
2642
|
+
* or as a middleware in any connect-style Node.js frameworks
|
|
2643
|
+
*
|
|
2644
|
+
* https://github.com/senchalabs/connect#use-middleware
|
|
2645
|
+
*/
|
|
2647
2646
|
middlewares: Connect.Server;
|
|
2648
2647
|
/**
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2648
|
+
* native Node http server instance
|
|
2649
|
+
* will be null in middleware mode
|
|
2650
|
+
*/
|
|
2652
2651
|
httpServer: HttpServer | null;
|
|
2653
2652
|
/**
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2653
|
+
* Chokidar watcher instance. If `config.server.watch` is set to `null`,
|
|
2654
|
+
* it will not watch any files and calling `add` or `unwatch` will have no effect.
|
|
2655
|
+
* https://github.com/paulmillr/chokidar/tree/3.6.0#api
|
|
2656
|
+
*/
|
|
2658
2657
|
watcher: FSWatcher;
|
|
2659
2658
|
/**
|
|
2660
|
-
|
|
2661
|
-
|
|
2659
|
+
* WebSocket server with `send(payload)` method
|
|
2660
|
+
*/
|
|
2662
2661
|
ws: WebSocketServer;
|
|
2663
2662
|
/**
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2663
|
+
* An alias to `server.environments.client.hot`.
|
|
2664
|
+
* If you want to interact with all environments, loop over `server.environments`.
|
|
2665
|
+
*/
|
|
2667
2666
|
hot: NormalizedHotChannel;
|
|
2668
2667
|
/**
|
|
2669
|
-
|
|
2670
|
-
|
|
2668
|
+
* Rollup plugin container that can run plugin hooks on a given file
|
|
2669
|
+
*/
|
|
2671
2670
|
pluginContainer: PluginContainer;
|
|
2672
2671
|
/**
|
|
2673
|
-
|
|
2674
|
-
|
|
2672
|
+
* Module execution environments attached to the Vite server.
|
|
2673
|
+
*/
|
|
2675
2674
|
environments: Record<"client" | "ssr" | (string & {}), DevEnvironment>;
|
|
2676
2675
|
/**
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2676
|
+
* Module graph that tracks the import relationships, url to file mapping
|
|
2677
|
+
* and hmr state.
|
|
2678
|
+
*/
|
|
2680
2679
|
moduleGraph: ModuleGraph;
|
|
2681
2680
|
/**
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2681
|
+
* The resolved urls Vite prints on the CLI (URL-encoded). Returns `null`
|
|
2682
|
+
* in middleware mode or if the server is not listening on any port.
|
|
2683
|
+
*/
|
|
2685
2684
|
resolvedUrls: ResolvedServerUrls | null;
|
|
2686
2685
|
/**
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2686
|
+
* Programmatically resolve, load and transform a URL and get the result
|
|
2687
|
+
* without going through the http request pipeline.
|
|
2688
|
+
*/
|
|
2690
2689
|
transformRequest(url: string, options?: TransformOptions): Promise<TransformResult | null>;
|
|
2691
2690
|
/**
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2691
|
+
* Same as `transformRequest` but only warm up the URLs so the next request
|
|
2692
|
+
* will already be cached. The function will never throw as it handles and
|
|
2693
|
+
* reports errors internally.
|
|
2694
|
+
*/
|
|
2696
2695
|
warmupRequest(url: string, options?: TransformOptions): Promise<void>;
|
|
2697
2696
|
/**
|
|
2698
|
-
|
|
2699
|
-
|
|
2697
|
+
* Apply vite built-in HTML transforms and any plugin HTML transforms.
|
|
2698
|
+
*/
|
|
2700
2699
|
transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>;
|
|
2701
2700
|
/**
|
|
2702
|
-
|
|
2703
|
-
|
|
2701
|
+
* Transform module code into SSR format.
|
|
2702
|
+
*/
|
|
2704
2703
|
ssrTransform(code: string, inMap: SourceMap | {
|
|
2705
2704
|
mappings: "";
|
|
2706
2705
|
} | null, url: string, originalCode?: string): Promise<TransformResult | null>;
|
|
2707
2706
|
/**
|
|
2708
|
-
|
|
2709
|
-
|
|
2707
|
+
* Load a given URL as an instantiated module for SSR.
|
|
2708
|
+
*/
|
|
2710
2709
|
ssrLoadModule(url: string, opts?: {
|
|
2711
2710
|
fixStacktrace?: boolean;
|
|
2712
2711
|
}): Promise<Record<string, any>>;
|
|
2713
2712
|
/**
|
|
2714
|
-
|
|
2715
|
-
|
|
2713
|
+
* Returns a fixed version of the given stack
|
|
2714
|
+
*/
|
|
2716
2715
|
ssrRewriteStacktrace(stack: string): string;
|
|
2717
2716
|
/**
|
|
2718
|
-
|
|
2719
|
-
|
|
2717
|
+
* Mutates the given SSR error by rewriting the stacktrace
|
|
2718
|
+
*/
|
|
2720
2719
|
ssrFixStacktrace(e: Error): void;
|
|
2721
2720
|
/**
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2721
|
+
* Triggers HMR for a module in the module graph. You can use the `server.moduleGraph`
|
|
2722
|
+
* API to retrieve the module to be reloaded. If `hmr` is false, this is a no-op.
|
|
2723
|
+
*/
|
|
2725
2724
|
reloadModule(module: ModuleNode): Promise<void>;
|
|
2726
2725
|
/**
|
|
2727
|
-
|
|
2728
|
-
|
|
2726
|
+
* Start the server.
|
|
2727
|
+
*/
|
|
2729
2728
|
listen(port?: number, isRestart?: boolean): Promise<ViteDevServer>;
|
|
2730
2729
|
/**
|
|
2731
|
-
|
|
2732
|
-
|
|
2730
|
+
* Stop the server.
|
|
2731
|
+
*/
|
|
2733
2732
|
close(): Promise<void>;
|
|
2734
2733
|
/**
|
|
2735
|
-
|
|
2736
|
-
|
|
2734
|
+
* Print server urls
|
|
2735
|
+
*/
|
|
2737
2736
|
printUrls(): void;
|
|
2738
2737
|
/**
|
|
2739
|
-
|
|
2740
|
-
|
|
2738
|
+
* Bind CLI shortcuts
|
|
2739
|
+
*/
|
|
2741
2740
|
bindCLIShortcuts(options?: BindCLIShortcutsOptions<ViteDevServer>): void;
|
|
2742
2741
|
/**
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2742
|
+
* Restart the server.
|
|
2743
|
+
*
|
|
2744
|
+
* @param forceOptimize - force the optimizer to re-bundle, same as --force cli flag
|
|
2745
|
+
*/
|
|
2747
2746
|
restart(forceOptimize?: boolean): Promise<void>;
|
|
2748
2747
|
/**
|
|
2749
|
-
|
|
2750
|
-
|
|
2748
|
+
* Open browser
|
|
2749
|
+
*/
|
|
2751
2750
|
openBrowser(): void;
|
|
2752
2751
|
/**
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2752
|
+
* Calling `await server.waitForRequestsIdle(id)` will wait until all static imports
|
|
2753
|
+
* are processed. If called from a load or transform plugin hook, the id needs to be
|
|
2754
|
+
* passed as a parameter to avoid deadlocks. Calling this function after the first
|
|
2755
|
+
* static imports section of the module graph has been processed will resolve immediately.
|
|
2756
|
+
*/
|
|
2758
2757
|
waitForRequestsIdle: (ignoredId?: string) => Promise<void>;
|
|
2759
2758
|
}
|
|
2760
2759
|
interface ResolvedServerUrls {
|
|
@@ -2767,13 +2766,13 @@ declare function createServer(inlineConfig?: InlineConfig | ResolvedConfig): Pro
|
|
|
2767
2766
|
interface HtmlTagDescriptor {
|
|
2768
2767
|
tag: string;
|
|
2769
2768
|
/**
|
|
2770
|
-
|
|
2771
|
-
|
|
2769
|
+
* attribute values will be escaped automatically if needed
|
|
2770
|
+
*/
|
|
2772
2771
|
attrs?: Record<string, string | boolean | undefined>;
|
|
2773
2772
|
children?: string | HtmlTagDescriptor[];
|
|
2774
2773
|
/**
|
|
2775
|
-
|
|
2776
|
-
|
|
2774
|
+
* default: 'head-prepend'
|
|
2775
|
+
*/
|
|
2777
2776
|
injectTo?: "head" | "body" | "head-prepend" | "body-prepend";
|
|
2778
2777
|
}
|
|
2779
2778
|
type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
|
|
@@ -2782,12 +2781,12 @@ type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
|
|
|
2782
2781
|
};
|
|
2783
2782
|
interface IndexHtmlTransformContext {
|
|
2784
2783
|
/**
|
|
2785
|
-
|
|
2786
|
-
|
|
2784
|
+
* public path when served
|
|
2785
|
+
*/
|
|
2787
2786
|
path: string;
|
|
2788
2787
|
/**
|
|
2789
|
-
|
|
2790
|
-
|
|
2788
|
+
* filename on disk
|
|
2789
|
+
*/
|
|
2791
2790
|
filename: string;
|
|
2792
2791
|
server?: ViteDevServer;
|
|
2793
2792
|
bundle?: OutputBundle;
|
|
@@ -2808,35 +2807,35 @@ type StringFilter<Value = string | RegExp> = Value | Array<Value> | {
|
|
|
2808
2807
|
//#endregion
|
|
2809
2808
|
//#region src/node/plugin.d.ts
|
|
2810
2809
|
/**
|
|
2811
|
-
* Vite plugins extends the Rollup plugin interface with a few extra
|
|
2812
|
-
* vite-specific options. A valid vite plugin is also a valid Rollup plugin.
|
|
2813
|
-
* On the contrary, a Rollup plugin may or may NOT be a valid vite universal
|
|
2814
|
-
* plugin, since some Rollup features do not make sense in an unbundled
|
|
2815
|
-
* dev server context. That said, as long as a rollup plugin doesn't have strong
|
|
2816
|
-
* coupling between its bundle phase and output phase hooks then it should
|
|
2817
|
-
* just work (that means, most of them).
|
|
2818
|
-
*
|
|
2819
|
-
* By default, the plugins are run during both serve and build. When a plugin
|
|
2820
|
-
* is applied during serve, it will only run **non output plugin hooks** (see
|
|
2821
|
-
* rollup type definition of {@link rollup#PluginHooks}). You can think of the
|
|
2822
|
-
* dev server as only running `const bundle = rollup.rollup()` but never calling
|
|
2823
|
-
* `bundle.generate()`.
|
|
2824
|
-
*
|
|
2825
|
-
* A plugin that expects to have different behavior depending on serve/build can
|
|
2826
|
-
* export a factory function that receives the command being run via options.
|
|
2827
|
-
*
|
|
2828
|
-
* If a plugin should be applied only for server or build, a function format
|
|
2829
|
-
* config file can be used to conditional determine the plugins to use.
|
|
2830
|
-
*
|
|
2831
|
-
* The current environment can be accessed from the context for the all non-global
|
|
2832
|
-
* hooks (it is not available in config, configResolved, configureServer, etc).
|
|
2833
|
-
* It can be a dev, build, or scan environment.
|
|
2834
|
-
* Plugins can use this.environment.mode === 'dev' to guard for dev specific APIs.
|
|
2835
|
-
*/
|
|
2810
|
+
* Vite plugins extends the Rollup plugin interface with a few extra
|
|
2811
|
+
* vite-specific options. A valid vite plugin is also a valid Rollup plugin.
|
|
2812
|
+
* On the contrary, a Rollup plugin may or may NOT be a valid vite universal
|
|
2813
|
+
* plugin, since some Rollup features do not make sense in an unbundled
|
|
2814
|
+
* dev server context. That said, as long as a rollup plugin doesn't have strong
|
|
2815
|
+
* coupling between its bundle phase and output phase hooks then it should
|
|
2816
|
+
* just work (that means, most of them).
|
|
2817
|
+
*
|
|
2818
|
+
* By default, the plugins are run during both serve and build. When a plugin
|
|
2819
|
+
* is applied during serve, it will only run **non output plugin hooks** (see
|
|
2820
|
+
* rollup type definition of {@link rollup#PluginHooks}). You can think of the
|
|
2821
|
+
* dev server as only running `const bundle = rollup.rollup()` but never calling
|
|
2822
|
+
* `bundle.generate()`.
|
|
2823
|
+
*
|
|
2824
|
+
* A plugin that expects to have different behavior depending on serve/build can
|
|
2825
|
+
* export a factory function that receives the command being run via options.
|
|
2826
|
+
*
|
|
2827
|
+
* If a plugin should be applied only for server or build, a function format
|
|
2828
|
+
* config file can be used to conditional determine the plugins to use.
|
|
2829
|
+
*
|
|
2830
|
+
* The current environment can be accessed from the context for the all non-global
|
|
2831
|
+
* hooks (it is not available in config, configResolved, configureServer, etc).
|
|
2832
|
+
* It can be a dev, build, or scan environment.
|
|
2833
|
+
* Plugins can use this.environment.mode === 'dev' to guard for dev specific APIs.
|
|
2834
|
+
*/
|
|
2836
2835
|
interface PluginContextExtension {
|
|
2837
2836
|
/**
|
|
2838
|
-
|
|
2839
|
-
|
|
2837
|
+
* Vite-specific environment instance
|
|
2838
|
+
*/
|
|
2840
2839
|
environment: Environment;
|
|
2841
2840
|
}
|
|
2842
2841
|
interface PluginContextMetaExtension {
|
|
@@ -2851,37 +2850,37 @@ declare module "rolldown" {
|
|
|
2851
2850
|
interface PluginContextMeta extends PluginContextMetaExtension {}
|
|
2852
2851
|
}
|
|
2853
2852
|
/**
|
|
2854
|
-
* There are two types of plugins in Vite. App plugins and environment plugins.
|
|
2855
|
-
* Environment Plugins are defined by a constructor function that will be called
|
|
2856
|
-
* once per each environment allowing users to have completely different plugins
|
|
2857
|
-
* for each of them. The constructor gets the resolved environment after the server
|
|
2858
|
-
* and builder has already been created simplifying config access and cache
|
|
2859
|
-
* management for environment specific plugins.
|
|
2860
|
-
* Environment Plugins are closer to regular rollup plugins. They can't define
|
|
2861
|
-
* app level hooks (like config, configResolved, configureServer, etc).
|
|
2862
|
-
*/
|
|
2853
|
+
* There are two types of plugins in Vite. App plugins and environment plugins.
|
|
2854
|
+
* Environment Plugins are defined by a constructor function that will be called
|
|
2855
|
+
* once per each environment allowing users to have completely different plugins
|
|
2856
|
+
* for each of them. The constructor gets the resolved environment after the server
|
|
2857
|
+
* and builder has already been created simplifying config access and cache
|
|
2858
|
+
* management for environment specific plugins.
|
|
2859
|
+
* Environment Plugins are closer to regular rollup plugins. They can't define
|
|
2860
|
+
* app level hooks (like config, configResolved, configureServer, etc).
|
|
2861
|
+
*/
|
|
2863
2862
|
interface Plugin<A = any> extends Rolldown.Plugin<A> {
|
|
2864
2863
|
/**
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2864
|
+
* Perform custom handling of HMR updates.
|
|
2865
|
+
* The handler receives an options containing changed filename, timestamp, a
|
|
2866
|
+
* list of modules affected by the file change, and the dev server instance.
|
|
2867
|
+
*
|
|
2868
|
+
* - The hook can return a filtered list of modules to narrow down the update.
|
|
2869
|
+
* e.g. for a Vue SFC, we can narrow down the part to update by comparing
|
|
2870
|
+
* the descriptors.
|
|
2871
|
+
*
|
|
2872
|
+
* - The hook can also return an empty array and then perform custom updates
|
|
2873
|
+
* by sending a custom hmr payload via environment.hot.send().
|
|
2874
|
+
*
|
|
2875
|
+
* - If the hook doesn't return a value, the hmr update will be performed as
|
|
2876
|
+
* normal.
|
|
2877
|
+
*/
|
|
2879
2878
|
hotUpdate?: ObjectHook<(this: MinimalPluginContext & {
|
|
2880
2879
|
environment: DevEnvironment;
|
|
2881
2880
|
}, options: HotUpdateOptions) => Array<EnvironmentModuleNode> | void | Promise<Array<EnvironmentModuleNode> | void>>;
|
|
2882
2881
|
/**
|
|
2883
|
-
|
|
2884
|
-
|
|
2882
|
+
* extend hooks with ssr flag
|
|
2883
|
+
*/
|
|
2885
2884
|
resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: {
|
|
2886
2885
|
kind?: ImportKind;
|
|
2887
2886
|
custom?: CustomPluginOptions;
|
|
@@ -2911,152 +2910,152 @@ interface Plugin<A = any> extends Rolldown.Plugin<A> {
|
|
|
2911
2910
|
};
|
|
2912
2911
|
}>;
|
|
2913
2912
|
/**
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2913
|
+
* Opt-in this plugin into the shared plugins pipeline.
|
|
2914
|
+
* For backward-compatibility, plugins are re-recreated for each environment
|
|
2915
|
+
* during `vite build --app`
|
|
2916
|
+
* We have an opt-in per plugin, and a general `builder.sharedPlugins`
|
|
2917
|
+
* In a future major, we'll flip the default to be shared by default
|
|
2918
|
+
* @experimental
|
|
2919
|
+
*/
|
|
2921
2920
|
sharedDuringBuild?: boolean;
|
|
2922
2921
|
/**
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2922
|
+
* Opt-in this plugin into per-environment buildStart and buildEnd during dev.
|
|
2923
|
+
* For backward-compatibility, the buildStart hook is called only once during
|
|
2924
|
+
* dev, for the client environment. Plugins can opt-in to be called
|
|
2925
|
+
* per-environment, aligning with the build hook behavior.
|
|
2926
|
+
* @experimental
|
|
2927
|
+
*/
|
|
2929
2928
|
perEnvironmentStartEndDuringDev?: boolean;
|
|
2930
2929
|
/**
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2930
|
+
* Opt-in this plugin into per-environment watchChange during dev.
|
|
2931
|
+
* For backward-compatibility, the watchChange hook is called only once during
|
|
2932
|
+
* dev, for the client environment. Plugins can opt-in to be called
|
|
2933
|
+
* per-environment, aligning with the watchChange hook behavior.
|
|
2934
|
+
* @experimental
|
|
2935
|
+
*/
|
|
2937
2936
|
perEnvironmentWatchChangeDuringDev?: boolean;
|
|
2938
2937
|
/**
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2938
|
+
* Enforce plugin invocation tier similar to webpack loaders. Hooks ordering
|
|
2939
|
+
* is still subject to the `order` property in the hook object.
|
|
2940
|
+
*
|
|
2941
|
+
* Plugin invocation order:
|
|
2942
|
+
* - alias resolution
|
|
2943
|
+
* - `enforce: 'pre'` plugins
|
|
2944
|
+
* - vite core plugins
|
|
2945
|
+
* - normal plugins
|
|
2946
|
+
* - vite build plugins
|
|
2947
|
+
* - `enforce: 'post'` plugins
|
|
2948
|
+
* - vite build post plugins
|
|
2949
|
+
*/
|
|
2951
2950
|
enforce?: "pre" | "post";
|
|
2952
2951
|
/**
|
|
2953
|
-
|
|
2954
|
-
|
|
2952
|
+
* Apply the plugin only for serve or build, or on certain conditions.
|
|
2953
|
+
*/
|
|
2955
2954
|
apply?: "serve" | "build" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean);
|
|
2956
2955
|
/**
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2956
|
+
* Define environments where this plugin should be active
|
|
2957
|
+
* By default, the plugin is active in all environments
|
|
2958
|
+
* @experimental
|
|
2959
|
+
*/
|
|
2961
2960
|
applyToEnvironment?: (environment: PartialEnvironment) => boolean | Promise<boolean> | PluginOption;
|
|
2962
2961
|
/**
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2962
|
+
* Modify vite config before it's resolved. The hook can either mutate the
|
|
2963
|
+
* passed-in config directly, or return a partial config object that will be
|
|
2964
|
+
* deeply merged into existing config.
|
|
2965
|
+
*
|
|
2966
|
+
* Note: User plugins are resolved before running this hook so injecting other
|
|
2967
|
+
* plugins inside the `config` hook will have no effect.
|
|
2968
|
+
*/
|
|
2970
2969
|
config?: ObjectHook<(this: ConfigPluginContext, config: UserConfig, env: ConfigEnv) => Omit<UserConfig, "plugins"> | null | void | Promise<Omit<UserConfig, "plugins"> | null | void>>;
|
|
2971
2970
|
/**
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2971
|
+
* Modify environment configs before it's resolved. The hook can either mutate the
|
|
2972
|
+
* passed-in environment config directly, or return a partial config object that will be
|
|
2973
|
+
* deeply merged into existing config.
|
|
2974
|
+
* This hook is called for each environment with a partially resolved environment config
|
|
2975
|
+
* that already accounts for the default environment config values set at the root level.
|
|
2976
|
+
* If plugins need to modify the config of a given environment, they should do it in this
|
|
2977
|
+
* hook instead of the config hook. Leaving the config hook only for modifying the root
|
|
2978
|
+
* default environment config.
|
|
2979
|
+
*/
|
|
2981
2980
|
configEnvironment?: ObjectHook<(this: ConfigPluginContext, name: string, config: EnvironmentOptions, env: ConfigEnv & {
|
|
2982
2981
|
/**
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2982
|
+
* Whether this environment is SSR environment and `ssr.target` is set to `'webworker'`.
|
|
2983
|
+
* Only intended to be used for backward compatibility.
|
|
2984
|
+
*/
|
|
2986
2985
|
isSsrTargetWebworker?: boolean;
|
|
2987
2986
|
}) => EnvironmentOptions | null | void | Promise<EnvironmentOptions | null | void>>;
|
|
2988
2987
|
/**
|
|
2989
|
-
|
|
2990
|
-
|
|
2988
|
+
* Use this hook to read and store the final resolved vite config.
|
|
2989
|
+
*/
|
|
2991
2990
|
configResolved?: ObjectHook<(this: MinimalPluginContextWithoutEnvironment, config: ResolvedConfig) => void | Promise<void>>;
|
|
2992
2991
|
/**
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
2992
|
+
* Configure the vite server. The hook receives the {@link ViteDevServer}
|
|
2993
|
+
* instance. This can also be used to store a reference to the server
|
|
2994
|
+
* for use in other hooks.
|
|
2995
|
+
*
|
|
2996
|
+
* The hooks will be called before internal middlewares are applied. A hook
|
|
2997
|
+
* can return a post hook that will be called after internal middlewares
|
|
2998
|
+
* are applied. Hook can be async functions and will be called in series.
|
|
2999
|
+
*/
|
|
3001
3000
|
configureServer?: ObjectHook<ServerHook>;
|
|
3002
3001
|
/**
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3002
|
+
* Configure the preview server. The hook receives the {@link PreviewServer}
|
|
3003
|
+
* instance. This can also be used to store a reference to the server
|
|
3004
|
+
* for use in other hooks.
|
|
3005
|
+
*
|
|
3006
|
+
* The hooks are called before other middlewares are applied. A hook can
|
|
3007
|
+
* return a post hook that will be called after other middlewares are
|
|
3008
|
+
* applied. Hooks can be async functions and will be called in series.
|
|
3009
|
+
*/
|
|
3011
3010
|
configurePreviewServer?: ObjectHook<PreviewServerHook>;
|
|
3012
3011
|
/**
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3012
|
+
* Transform index.html.
|
|
3013
|
+
* The hook receives the following arguments:
|
|
3014
|
+
*
|
|
3015
|
+
* - html: string
|
|
3016
|
+
* - ctx: IndexHtmlTransformContext, which contains:
|
|
3017
|
+
* - path: public path when served
|
|
3018
|
+
* - filename: filename on disk
|
|
3019
|
+
* - server?: ViteDevServer (only present during serve)
|
|
3020
|
+
* - bundle?: rollup.OutputBundle (only present during build)
|
|
3021
|
+
* - chunk?: rollup.OutputChunk
|
|
3022
|
+
* - originalUrl?: string
|
|
3023
|
+
*
|
|
3024
|
+
* It can either return a transformed string, or a list of html tag
|
|
3025
|
+
* descriptors that will be injected into the `<head>` or `<body>`.
|
|
3026
|
+
*
|
|
3027
|
+
* By default the transform is applied **after** vite's internal html
|
|
3028
|
+
* transform. If you need to apply the transform before vite, use an object:
|
|
3029
|
+
* `{ order: 'pre', handler: hook }`
|
|
3030
|
+
*/
|
|
3032
3031
|
transformIndexHtml?: IndexHtmlTransform;
|
|
3033
3032
|
/**
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3033
|
+
* Build Environments
|
|
3034
|
+
*
|
|
3035
|
+
* @experimental
|
|
3036
|
+
*/
|
|
3038
3037
|
buildApp?: ObjectHook<BuildAppHook>;
|
|
3039
3038
|
/**
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3039
|
+
* Perform custom handling of HMR updates.
|
|
3040
|
+
* The handler receives a context containing changed filename, timestamp, a
|
|
3041
|
+
* list of modules affected by the file change, and the dev server instance.
|
|
3042
|
+
*
|
|
3043
|
+
* - The hook can return a filtered list of modules to narrow down the update.
|
|
3044
|
+
* e.g. for a Vue SFC, we can narrow down the part to update by comparing
|
|
3045
|
+
* the descriptors.
|
|
3046
|
+
*
|
|
3047
|
+
* - The hook can also return an empty array and then perform custom updates
|
|
3048
|
+
* by sending a custom hmr payload via server.ws.send().
|
|
3049
|
+
*
|
|
3050
|
+
* - If the hook doesn't return a value, the hmr update will be performed as
|
|
3051
|
+
* normal.
|
|
3052
|
+
*/
|
|
3054
3053
|
handleHotUpdate?: ObjectHook<(this: MinimalPluginContextWithoutEnvironment, ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>;
|
|
3055
3054
|
/**
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3055
|
+
* This hook is not supported by Rolldown yet. But the type is declared for compatibility.
|
|
3056
|
+
*
|
|
3057
|
+
* @deprecated This hook is **not** deprecated. It is marked as deprecated just to make it clear that this hook is currently a no-op.
|
|
3058
|
+
*/
|
|
3060
3059
|
shouldTransformCachedModule?: ObjectHook<(this: PluginContext, options: {
|
|
3061
3060
|
code: string;
|
|
3062
3061
|
id: string;
|
|
@@ -3065,46 +3064,46 @@ interface Plugin<A = any> extends Rolldown.Plugin<A> {
|
|
|
3065
3064
|
}) => boolean | null | void>;
|
|
3066
3065
|
}
|
|
3067
3066
|
type HookHandler<T> = T extends ObjectHook<infer H> ? H : T;
|
|
3068
|
-
type PluginWithRequiredHook<K extends keyof Plugin> = Plugin & { [P in K]: NonNullable<Plugin[P]
|
|
3067
|
+
type PluginWithRequiredHook<K extends keyof Plugin> = Plugin & { [P in K]: NonNullable<Plugin[P]>; };
|
|
3069
3068
|
type Thenable<T> = T | Promise<T>;
|
|
3070
3069
|
type FalsyPlugin = false | null | undefined;
|
|
3071
3070
|
type PluginOption = Thenable<Plugin | {
|
|
3072
3071
|
name: string;
|
|
3073
3072
|
} | FalsyPlugin | PluginOption[]>;
|
|
3074
3073
|
/**
|
|
3075
|
-
* @experimental
|
|
3076
|
-
*/
|
|
3074
|
+
* @experimental
|
|
3075
|
+
*/
|
|
3077
3076
|
declare function perEnvironmentPlugin(name: string, applyToEnvironment: (environment: PartialEnvironment) => boolean | Promise<boolean> | PluginOption): Plugin;
|
|
3078
3077
|
//#endregion
|
|
3079
3078
|
//#region src/node/idResolver.d.ts
|
|
3080
3079
|
type ResolveIdFn = (environment: PartialEnvironment, id: string, importer?: string, aliasOnly?: boolean) => Promise<string | undefined>;
|
|
3081
3080
|
/**
|
|
3082
|
-
* Create an internal resolver to be used in special scenarios, e.g.
|
|
3083
|
-
* optimizer and handling css @imports
|
|
3084
|
-
*/
|
|
3081
|
+
* Create an internal resolver to be used in special scenarios, e.g.
|
|
3082
|
+
* optimizer and handling css @imports
|
|
3083
|
+
*/
|
|
3085
3084
|
declare function createIdResolver(config: ResolvedConfig, options?: Partial<InternalResolveOptions>): ResolveIdFn;
|
|
3086
3085
|
//#endregion
|
|
3087
3086
|
//#region src/node/plugins/css.d.ts
|
|
3088
3087
|
interface CSSOptions {
|
|
3089
3088
|
/**
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3089
|
+
* Using lightningcss is an experimental option to handle CSS modules,
|
|
3090
|
+
* assets and imports via Lightning CSS. It requires to install it as a
|
|
3091
|
+
* peer dependency.
|
|
3092
|
+
*
|
|
3093
|
+
* @default 'postcss'
|
|
3094
|
+
* @experimental
|
|
3095
|
+
*/
|
|
3097
3096
|
transformer?: "postcss" | "lightningcss";
|
|
3098
3097
|
/**
|
|
3099
|
-
|
|
3100
|
-
|
|
3098
|
+
* https://github.com/css-modules/postcss-modules
|
|
3099
|
+
*/
|
|
3101
3100
|
modules?: CSSModulesOptions | false;
|
|
3102
3101
|
/**
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3102
|
+
* Options for preprocessors.
|
|
3103
|
+
*
|
|
3104
|
+
* In addition to options specific to each processors, Vite supports `additionalData` option.
|
|
3105
|
+
* The `additionalData` option can be used to inject extra code for each style content.
|
|
3106
|
+
*/
|
|
3108
3107
|
preprocessorOptions?: {
|
|
3109
3108
|
scss?: SassPreprocessorOptions;
|
|
3110
3109
|
sass?: SassPreprocessorOptions;
|
|
@@ -3113,24 +3112,24 @@ interface CSSOptions {
|
|
|
3113
3112
|
stylus?: StylusPreprocessorOptions;
|
|
3114
3113
|
};
|
|
3115
3114
|
/**
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3115
|
+
* If this option is set, preprocessors will run in workers when possible.
|
|
3116
|
+
* `true` means the number of CPUs minus 1.
|
|
3117
|
+
*
|
|
3118
|
+
* @default true
|
|
3119
|
+
*/
|
|
3121
3120
|
preprocessorMaxWorkers?: number | true;
|
|
3122
3121
|
postcss?: string | (PostCSS.ProcessOptions & {
|
|
3123
3122
|
plugins?: PostCSS.AcceptedPlugin[];
|
|
3124
3123
|
});
|
|
3125
3124
|
/**
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3125
|
+
* Enables css sourcemaps during dev
|
|
3126
|
+
* @default false
|
|
3127
|
+
* @experimental
|
|
3128
|
+
*/
|
|
3130
3129
|
devSourcemap?: boolean;
|
|
3131
3130
|
/**
|
|
3132
|
-
|
|
3133
|
-
|
|
3131
|
+
* @experimental
|
|
3132
|
+
*/
|
|
3134
3133
|
lightningcss?: lightningcssOptions_LightningCSSOptions;
|
|
3135
3134
|
}
|
|
3136
3135
|
interface CSSModulesOptions {
|
|
@@ -3141,8 +3140,8 @@ interface CSSModulesOptions {
|
|
|
3141
3140
|
generateScopedName?: string | ((name: string, filename: string, css: string) => string);
|
|
3142
3141
|
hashPrefix?: string;
|
|
3143
3142
|
/**
|
|
3144
|
-
|
|
3145
|
-
|
|
3143
|
+
* default: undefined
|
|
3144
|
+
*/
|
|
3146
3145
|
localsConvention?: "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly" | ((originalClassName: string, generatedClassName: string, inputFile: string) => string);
|
|
3147
3146
|
}
|
|
3148
3147
|
type ResolvedCSSOptions = Omit<CSSOptions, "lightningcss"> & Required<Pick<CSSOptions, "transformer" | "devSourcemap">> & {
|
|
@@ -3155,8 +3154,8 @@ interface PreprocessCSSResult {
|
|
|
3155
3154
|
deps?: Set<string>;
|
|
3156
3155
|
}
|
|
3157
3156
|
/**
|
|
3158
|
-
* @experimental
|
|
3159
|
-
*/
|
|
3157
|
+
* @experimental
|
|
3158
|
+
*/
|
|
3160
3159
|
declare function preprocessCSS(code: string, filename: string, config: ResolvedConfig): Promise<PreprocessCSSResult>;
|
|
3161
3160
|
declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise<ExistingRawSourceMap>;
|
|
3162
3161
|
type PreprocessorAdditionalDataResult = string | {
|
|
@@ -3180,8 +3179,8 @@ interface ESBuildOptions extends esbuildOptions_EsbuildTransformOptions {
|
|
|
3180
3179
|
exclude?: string | RegExp | ReadonlyArray<string | RegExp>;
|
|
3181
3180
|
jsxInject?: string;
|
|
3182
3181
|
/**
|
|
3183
|
-
|
|
3184
|
-
|
|
3182
|
+
* This option is not respected. Use `build.minify` instead.
|
|
3183
|
+
*/
|
|
3185
3184
|
minify?: never;
|
|
3186
3185
|
}
|
|
3187
3186
|
type ESBuildTransformResult = Omit<EsbuildTransformResult, "map"> & {
|
|
@@ -3192,38 +3191,38 @@ declare function transformWithEsbuild(code: string, filename: string, options?:
|
|
|
3192
3191
|
//#region src/node/plugins/json.d.ts
|
|
3193
3192
|
interface JsonOptions {
|
|
3194
3193
|
/**
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3194
|
+
* Generate a named export for every property of the JSON object
|
|
3195
|
+
* @default true
|
|
3196
|
+
*/
|
|
3198
3197
|
namedExports?: boolean;
|
|
3199
3198
|
/**
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3199
|
+
* Generate performant output as JSON.parse("stringified").
|
|
3200
|
+
*
|
|
3201
|
+
* When set to 'auto', the data will be stringified only if the data is bigger than 10kB.
|
|
3202
|
+
* @default 'auto'
|
|
3203
|
+
*/
|
|
3205
3204
|
stringify?: boolean | "auto";
|
|
3206
3205
|
}
|
|
3207
3206
|
//#endregion
|
|
3208
3207
|
//#region src/node/assetSource.d.ts
|
|
3209
3208
|
/**
|
|
3210
|
-
* Defines which attributes of an HTML element should be treated as asset sources.
|
|
3211
|
-
* Used in `html.additionalAssetSources` configuration.
|
|
3212
|
-
*/
|
|
3209
|
+
* Defines which attributes of an HTML element should be treated as asset sources.
|
|
3210
|
+
* Used in `html.additionalAssetSources` configuration.
|
|
3211
|
+
*/
|
|
3213
3212
|
interface HtmlAssetSource {
|
|
3214
3213
|
/**
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3214
|
+
* Attributes that contain a single asset URL.
|
|
3215
|
+
* @example ['src', 'data-src-dark']
|
|
3216
|
+
*/
|
|
3218
3217
|
srcAttributes?: string[];
|
|
3219
3218
|
/**
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3219
|
+
* Attributes that contain srcset-format URLs.
|
|
3220
|
+
* @example ['srcset', 'imagesrcset']
|
|
3221
|
+
*/
|
|
3223
3222
|
srcsetAttributes?: string[];
|
|
3224
3223
|
/**
|
|
3225
|
-
|
|
3226
|
-
|
|
3224
|
+
* Called before handling an attribute to determine if it should be processed.
|
|
3225
|
+
*/
|
|
3227
3226
|
filter?: (data: HtmlAssetSourceFilterData) => boolean;
|
|
3228
3227
|
}
|
|
3229
3228
|
interface HtmlAssetSourceFilterData {
|
|
@@ -3239,35 +3238,35 @@ interface SSROptions {
|
|
|
3239
3238
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
|
3240
3239
|
external?: string[] | true;
|
|
3241
3240
|
/**
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3241
|
+
* Define the target for the ssr build. The browser field in package.json
|
|
3242
|
+
* is ignored for node but used if webworker is the target
|
|
3243
|
+
* This option will be removed in a future major version
|
|
3244
|
+
* @default 'node'
|
|
3245
|
+
*/
|
|
3247
3246
|
target?: SSRTarget;
|
|
3248
3247
|
/**
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3248
|
+
* Control over which dependencies are optimized during SSR and esbuild options
|
|
3249
|
+
* During build:
|
|
3250
|
+
* no external CJS dependencies are optimized by default
|
|
3251
|
+
* During dev:
|
|
3252
|
+
* explicit no external CJS dependencies are optimized by default
|
|
3253
|
+
* @experimental
|
|
3254
|
+
*/
|
|
3256
3255
|
optimizeDeps?: SsrDepOptimizationConfig;
|
|
3257
3256
|
resolve?: {
|
|
3258
3257
|
/**
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3258
|
+
* Conditions that are used in the plugin pipeline. The default value is the root config's `resolve.conditions`.
|
|
3259
|
+
*
|
|
3260
|
+
* Use this to override the default ssr conditions for the ssr build.
|
|
3261
|
+
*
|
|
3262
|
+
* @default rootConfig.resolve.conditions
|
|
3263
|
+
*/
|
|
3265
3264
|
conditions?: string[];
|
|
3266
3265
|
/**
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3266
|
+
* Conditions that are used during ssr import (including `ssrLoadModule`) of externalized dependencies.
|
|
3267
|
+
*
|
|
3268
|
+
* @default ['node', 'module-sync']
|
|
3269
|
+
*/
|
|
3271
3270
|
externalConditions?: string[];
|
|
3272
3271
|
mainFields?: string[];
|
|
3273
3272
|
};
|
|
@@ -3290,31 +3289,31 @@ declare function transformWithOxc(code: string, filename: string, options?: roll
|
|
|
3290
3289
|
//#region src/node/config.d.ts
|
|
3291
3290
|
interface ConfigEnv {
|
|
3292
3291
|
/**
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3292
|
+
* 'serve': during dev (`vite` command)
|
|
3293
|
+
* 'build': when building for production (`vite build` command)
|
|
3294
|
+
*/
|
|
3296
3295
|
command: "build" | "serve";
|
|
3297
3296
|
mode: string;
|
|
3298
3297
|
isSsrBuild?: boolean;
|
|
3299
3298
|
isPreview?: boolean;
|
|
3300
3299
|
}
|
|
3301
3300
|
/**
|
|
3302
|
-
* spa: include SPA fallback middleware and configure sirv with `single: true` in preview
|
|
3303
|
-
*
|
|
3304
|
-
* mpa: only include non-SPA HTML middlewares
|
|
3305
|
-
*
|
|
3306
|
-
* custom: don't include HTML middlewares
|
|
3307
|
-
*/
|
|
3301
|
+
* spa: include SPA fallback middleware and configure sirv with `single: true` in preview
|
|
3302
|
+
*
|
|
3303
|
+
* mpa: only include non-SPA HTML middlewares
|
|
3304
|
+
*
|
|
3305
|
+
* custom: don't include HTML middlewares
|
|
3306
|
+
*/
|
|
3308
3307
|
type AppType = "spa" | "mpa" | "custom";
|
|
3309
3308
|
type UserConfigFnObject = (env: ConfigEnv) => UserConfig;
|
|
3310
3309
|
type UserConfigFnPromise = (env: ConfigEnv) => Promise<UserConfig>;
|
|
3311
3310
|
type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
|
|
3312
3311
|
type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFnObject | UserConfigFnPromise | UserConfigFn;
|
|
3313
3312
|
/**
|
|
3314
|
-
* Type helper to make it easier to use vite.config.ts
|
|
3315
|
-
* accepts a direct {@link UserConfig} object, or a function that returns it.
|
|
3316
|
-
* The function receives a {@link ConfigEnv} object.
|
|
3317
|
-
*/
|
|
3313
|
+
* Type helper to make it easier to use vite.config.ts
|
|
3314
|
+
* accepts a direct {@link UserConfig} object, or a function that returns it.
|
|
3315
|
+
* The function receives a {@link ConfigEnv} object.
|
|
3316
|
+
*/
|
|
3318
3317
|
declare function defineConfig(config: UserConfig): UserConfig;
|
|
3319
3318
|
declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
|
3320
3319
|
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
@@ -3326,48 +3325,48 @@ interface CreateDevEnvironmentContext {
|
|
|
3326
3325
|
}
|
|
3327
3326
|
interface DevEnvironmentOptions {
|
|
3328
3327
|
/**
|
|
3329
|
-
|
|
3330
|
-
|
|
3328
|
+
* Files to be pre-transformed. Supports glob patterns.
|
|
3329
|
+
*/
|
|
3331
3330
|
warmup?: string[];
|
|
3332
3331
|
/**
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3332
|
+
* Pre-transform known direct imports
|
|
3333
|
+
* defaults to true for the client environment, false for the rest
|
|
3334
|
+
*/
|
|
3336
3335
|
preTransformRequests?: boolean;
|
|
3337
3336
|
/**
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3337
|
+
* Enables sourcemaps during dev
|
|
3338
|
+
* @default { js: true }
|
|
3339
|
+
* @experimental
|
|
3340
|
+
*/
|
|
3342
3341
|
sourcemap?: boolean | {
|
|
3343
3342
|
js?: boolean;
|
|
3344
3343
|
css?: boolean;
|
|
3345
3344
|
};
|
|
3346
3345
|
/**
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3346
|
+
* Whether or not to ignore-list source files in the dev server sourcemap, used to populate
|
|
3347
|
+
* the [`x_google_ignoreList` source map extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).
|
|
3348
|
+
*
|
|
3349
|
+
* By default, it excludes all paths containing `node_modules`. You can pass `false` to
|
|
3350
|
+
* disable this behavior, or, for full control, a function that takes the source path and
|
|
3351
|
+
* sourcemap path and returns whether to ignore the source path.
|
|
3352
|
+
*/
|
|
3354
3353
|
sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean);
|
|
3355
3354
|
/**
|
|
3356
|
-
|
|
3357
|
-
|
|
3355
|
+
* create the Dev Environment instance
|
|
3356
|
+
*/
|
|
3358
3357
|
createEnvironment?: (name: string, config: ResolvedConfig, context: CreateDevEnvironmentContext) => Promise<DevEnvironment> | DevEnvironment;
|
|
3359
3358
|
/**
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3359
|
+
* For environments that support a full-reload, like the client, we can short-circuit when
|
|
3360
|
+
* restarting the server throwing early to stop processing current files. We avoided this for
|
|
3361
|
+
* SSR requests. Maybe this is no longer needed.
|
|
3362
|
+
* @experimental
|
|
3363
|
+
*/
|
|
3365
3364
|
recoverable?: boolean;
|
|
3366
3365
|
/**
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3366
|
+
* For environments associated with a module runner.
|
|
3367
|
+
* By default, it is false for the client environment and true for non-client environments.
|
|
3368
|
+
* This option can also be used instead of the removed config.experimental.skipSsrTransform.
|
|
3369
|
+
*/
|
|
3371
3370
|
moduleRunnerTransform?: boolean;
|
|
3372
3371
|
}
|
|
3373
3372
|
type ResolvedDevEnvironmentOptions = Omit<Required<DevEnvironmentOptions>, "sourcemapIgnoreList"> & {
|
|
@@ -3378,48 +3377,48 @@ type AllResolveOptions = ResolveOptions & {
|
|
|
3378
3377
|
};
|
|
3379
3378
|
interface SharedEnvironmentOptions {
|
|
3380
3379
|
/**
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3380
|
+
* Define global variable replacements.
|
|
3381
|
+
* Entries will be defined on `window` during dev and replaced during build.
|
|
3382
|
+
*/
|
|
3384
3383
|
define?: Record<string, any>;
|
|
3385
3384
|
/**
|
|
3386
|
-
|
|
3387
|
-
|
|
3385
|
+
* Configure resolver
|
|
3386
|
+
*/
|
|
3388
3387
|
resolve?: EnvironmentResolveOptions;
|
|
3389
3388
|
/**
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3389
|
+
* Define if this environment is used for Server-Side Rendering
|
|
3390
|
+
* @default 'server' if it isn't the client environment
|
|
3391
|
+
*/
|
|
3393
3392
|
consumer?: "client" | "server";
|
|
3394
3393
|
/**
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3394
|
+
* If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime.
|
|
3395
|
+
* Otherwise, it is statically replaced as an empty object.
|
|
3396
|
+
*/
|
|
3398
3397
|
keepProcessEnv?: boolean;
|
|
3399
3398
|
/**
|
|
3400
|
-
|
|
3401
|
-
|
|
3399
|
+
* Optimize deps config
|
|
3400
|
+
*/
|
|
3402
3401
|
optimizeDeps?: DepOptimizationOptions;
|
|
3403
3402
|
/**
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3403
|
+
* Whether this environment produces a bundled output.
|
|
3404
|
+
*
|
|
3405
|
+
* During `build`, this defaults to `true` for every environment.
|
|
3406
|
+
* During `serve`, this defaults to `true` only for the client environment
|
|
3407
|
+
* when `experimental.bundledDev` is enabled, and `false` otherwise.
|
|
3408
|
+
* Setting this explicitly on an environment always overrides the default.
|
|
3409
|
+
*
|
|
3410
|
+
* @experimental
|
|
3411
|
+
*/
|
|
3413
3412
|
isBundled?: boolean;
|
|
3414
3413
|
}
|
|
3415
3414
|
interface EnvironmentOptions extends SharedEnvironmentOptions {
|
|
3416
3415
|
/**
|
|
3417
|
-
|
|
3418
|
-
|
|
3416
|
+
* Dev specific options
|
|
3417
|
+
*/
|
|
3419
3418
|
dev?: DevEnvironmentOptions;
|
|
3420
3419
|
/**
|
|
3421
|
-
|
|
3422
|
-
|
|
3420
|
+
* Build specific options
|
|
3421
|
+
*/
|
|
3423
3422
|
build?: BuildEnvironmentOptions;
|
|
3424
3423
|
}
|
|
3425
3424
|
type ResolvedResolveOptions = Required<ResolveOptions>;
|
|
@@ -3439,205 +3438,205 @@ type DefaultEnvironmentOptions = Omit<EnvironmentOptions, "consumer" | "resolve"
|
|
|
3439
3438
|
};
|
|
3440
3439
|
interface UserConfig extends DefaultEnvironmentOptions {
|
|
3441
3440
|
/**
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3441
|
+
* Project root directory. Can be an absolute path, or a path relative from
|
|
3442
|
+
* the location of the config file itself.
|
|
3443
|
+
* @default process.cwd()
|
|
3444
|
+
*/
|
|
3446
3445
|
root?: string;
|
|
3447
3446
|
/**
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3447
|
+
* Base public path when served in development or production.
|
|
3448
|
+
* @default '/'
|
|
3449
|
+
*/
|
|
3451
3450
|
base?: string;
|
|
3452
3451
|
/**
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3452
|
+
* Directory to serve as plain static assets. Files in this directory are
|
|
3453
|
+
* served and copied to build dist dir as-is without transform. The value
|
|
3454
|
+
* can be either an absolute file system path or a path relative to project root.
|
|
3455
|
+
*
|
|
3456
|
+
* Set to `false` or an empty string to disable copied static assets to build dist dir.
|
|
3457
|
+
* @default 'public'
|
|
3458
|
+
*/
|
|
3460
3459
|
publicDir?: string | false;
|
|
3461
3460
|
/**
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3461
|
+
* Directory to save cache files. Files in this directory are pre-bundled
|
|
3462
|
+
* deps or some other cache files that generated by vite, which can improve
|
|
3463
|
+
* the performance. You can use `--force` flag or manually delete the directory
|
|
3464
|
+
* to regenerate the cache files. The value can be either an absolute file
|
|
3465
|
+
* system path or a path relative to project root.
|
|
3466
|
+
* Default to `.vite` when no `package.json` is detected.
|
|
3467
|
+
* @default 'node_modules/.vite'
|
|
3468
|
+
*/
|
|
3470
3469
|
cacheDir?: string;
|
|
3471
3470
|
/**
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3471
|
+
* Explicitly set a mode to run in. This will override the default mode for
|
|
3472
|
+
* each command, and can be overridden by the command line --mode option.
|
|
3473
|
+
*/
|
|
3475
3474
|
mode?: string;
|
|
3476
3475
|
/**
|
|
3477
|
-
|
|
3478
|
-
|
|
3476
|
+
* Array of vite plugins to use.
|
|
3477
|
+
*/
|
|
3479
3478
|
plugins?: PluginOption[];
|
|
3480
3479
|
/**
|
|
3481
|
-
|
|
3482
|
-
|
|
3480
|
+
* HTML related options
|
|
3481
|
+
*/
|
|
3483
3482
|
html?: HTMLOptions;
|
|
3484
3483
|
/**
|
|
3485
|
-
|
|
3486
|
-
|
|
3484
|
+
* CSS related options (preprocessors and CSS modules)
|
|
3485
|
+
*/
|
|
3487
3486
|
css?: CSSOptions;
|
|
3488
3487
|
/**
|
|
3489
|
-
|
|
3490
|
-
|
|
3488
|
+
* JSON loading options
|
|
3489
|
+
*/
|
|
3491
3490
|
json?: JsonOptions;
|
|
3492
3491
|
/**
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3492
|
+
* Transform options to pass to esbuild.
|
|
3493
|
+
* Or set to `false` to disable esbuild.
|
|
3494
|
+
*
|
|
3495
|
+
* @deprecated Use `oxc` option instead.
|
|
3496
|
+
*/
|
|
3498
3497
|
esbuild?: ESBuildOptions | false;
|
|
3499
3498
|
/**
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3499
|
+
* Transform options to pass to Oxc.
|
|
3500
|
+
* Or set to `false` to disable Oxc.
|
|
3501
|
+
*/
|
|
3503
3502
|
oxc?: OxcOptions | false;
|
|
3504
3503
|
/**
|
|
3505
|
-
|
|
3506
|
-
|
|
3504
|
+
* Specify additional picomatch patterns to be treated as static assets.
|
|
3505
|
+
*/
|
|
3507
3506
|
assetsInclude?: string | RegExp | (string | RegExp)[];
|
|
3508
3507
|
/**
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3508
|
+
* Builder specific options
|
|
3509
|
+
* @experimental
|
|
3510
|
+
*/
|
|
3512
3511
|
builder?: BuilderOptions;
|
|
3513
3512
|
/**
|
|
3514
|
-
|
|
3515
|
-
|
|
3513
|
+
* Server specific options, e.g. host, port, https...
|
|
3514
|
+
*/
|
|
3516
3515
|
server?: ServerOptions$1;
|
|
3517
3516
|
/**
|
|
3518
|
-
|
|
3519
|
-
|
|
3517
|
+
* Preview specific options, e.g. host, port, https...
|
|
3518
|
+
*/
|
|
3520
3519
|
preview?: PreviewOptions;
|
|
3521
3520
|
/**
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3521
|
+
* Experimental features
|
|
3522
|
+
*
|
|
3523
|
+
* Features under this field could change in the future and might NOT follow semver.
|
|
3524
|
+
* Please be careful and always pin Vite's version when using them.
|
|
3525
|
+
* @experimental
|
|
3526
|
+
*/
|
|
3528
3527
|
experimental?: ExperimentalOptions;
|
|
3529
3528
|
/**
|
|
3530
|
-
|
|
3531
|
-
|
|
3529
|
+
* Options to opt-in to future behavior
|
|
3530
|
+
*/
|
|
3532
3531
|
future?: FutureOptions | "warn";
|
|
3533
3532
|
/**
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3533
|
+
* Legacy options
|
|
3534
|
+
*
|
|
3535
|
+
* Features under this field only follow semver for patches, they could be removed in a
|
|
3536
|
+
* future minor version. Please always pin Vite's version to a minor when using them.
|
|
3537
|
+
*/
|
|
3539
3538
|
legacy?: LegacyOptions;
|
|
3540
3539
|
/**
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3540
|
+
* Log level.
|
|
3541
|
+
* @default 'info'
|
|
3542
|
+
*/
|
|
3544
3543
|
logLevel?: LogLevel;
|
|
3545
3544
|
/**
|
|
3546
|
-
|
|
3547
|
-
|
|
3545
|
+
* Custom logger.
|
|
3546
|
+
*/
|
|
3548
3547
|
customLogger?: Logger;
|
|
3549
3548
|
/**
|
|
3550
|
-
|
|
3551
|
-
|
|
3549
|
+
* @default true
|
|
3550
|
+
*/
|
|
3552
3551
|
clearScreen?: boolean;
|
|
3553
3552
|
/**
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3553
|
+
* Environment files directory. Can be an absolute path, or a path relative from
|
|
3554
|
+
* root.
|
|
3555
|
+
* @default root
|
|
3556
|
+
*/
|
|
3558
3557
|
envDir?: string | false;
|
|
3559
3558
|
/**
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3559
|
+
* Env variables starts with `envPrefix` will be exposed to your client source code via import.meta.env.
|
|
3560
|
+
* @default 'VITE_'
|
|
3561
|
+
*/
|
|
3563
3562
|
envPrefix?: string | string[];
|
|
3564
3563
|
/**
|
|
3565
|
-
|
|
3566
|
-
|
|
3564
|
+
* Worker bundle options
|
|
3565
|
+
*/
|
|
3567
3566
|
worker?: {
|
|
3568
3567
|
/**
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3568
|
+
* Output format for worker bundle
|
|
3569
|
+
* @default 'iife'
|
|
3570
|
+
*/
|
|
3572
3571
|
format?: "es" | "iife";
|
|
3573
3572
|
/**
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3573
|
+
* Vite plugins that apply to worker bundle. The plugins returned by this function
|
|
3574
|
+
* should be new instances every time it is called, because they are used for each
|
|
3575
|
+
* rolldown worker bundling process.
|
|
3576
|
+
*/
|
|
3578
3577
|
plugins?: () => PluginOption[];
|
|
3579
3578
|
/**
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3579
|
+
* Alias to `rolldownOptions`.
|
|
3580
|
+
* @deprecated Use `rolldownOptions` instead.
|
|
3581
|
+
*/
|
|
3583
3582
|
rollupOptions?: Omit<RolldownOptions, "plugins" | "input" | "onwarn" | "preserveEntrySignatures">;
|
|
3584
3583
|
/**
|
|
3585
|
-
|
|
3586
|
-
|
|
3584
|
+
* Rolldown options to build worker bundle
|
|
3585
|
+
*/
|
|
3587
3586
|
rolldownOptions?: Omit<RolldownOptions, "plugins" | "input" | "onwarn" | "preserveEntrySignatures">;
|
|
3588
3587
|
};
|
|
3589
3588
|
/**
|
|
3590
|
-
|
|
3591
|
-
|
|
3589
|
+
* Dep optimization options
|
|
3590
|
+
*/
|
|
3592
3591
|
optimizeDeps?: DepOptimizationOptions;
|
|
3593
3592
|
/**
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3593
|
+
* SSR specific options
|
|
3594
|
+
* We could make SSROptions be a EnvironmentOptions if we can abstract
|
|
3595
|
+
* external/noExternal for environments in general.
|
|
3596
|
+
*/
|
|
3598
3597
|
ssr?: SSROptions;
|
|
3599
3598
|
/**
|
|
3600
|
-
|
|
3601
|
-
|
|
3599
|
+
* Environment overrides
|
|
3600
|
+
*/
|
|
3602
3601
|
environments?: Record<string, EnvironmentOptions>;
|
|
3603
3602
|
/**
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3603
|
+
* Whether your application is a Single Page Application (SPA),
|
|
3604
|
+
* a Multi-Page Application (MPA), or Custom Application (SSR
|
|
3605
|
+
* and frameworks with custom HTML handling)
|
|
3606
|
+
* @default 'spa'
|
|
3607
|
+
*/
|
|
3609
3608
|
appType?: AppType;
|
|
3610
3609
|
/**
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3610
|
+
* Enable devtools integration. Ensure that `@vitejs/devtools` is installed as a dependency.
|
|
3611
|
+
* This feature is currently supported only in build mode.
|
|
3612
|
+
* @experimental
|
|
3613
|
+
* @default false
|
|
3614
|
+
*/
|
|
3616
3615
|
devtools?: boolean | DevToolsConfig;
|
|
3617
3616
|
}
|
|
3618
3617
|
interface HTMLOptions {
|
|
3619
3618
|
/**
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3619
|
+
* A nonce value placeholder that will be used when generating script/style tags.
|
|
3620
|
+
*
|
|
3621
|
+
* Make sure that this placeholder will be replaced with a unique value for each request by the server.
|
|
3622
|
+
*/
|
|
3624
3623
|
cspNonce?: string;
|
|
3625
3624
|
/**
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3625
|
+
* Define additional HTML elements and attributes to be treated as asset sources.
|
|
3626
|
+
* This extends the built-in list that includes standard elements like `<img src>`, `<video src>`, etc.
|
|
3627
|
+
*
|
|
3628
|
+
* @example
|
|
3629
|
+
* ```ts
|
|
3630
|
+
* html: {
|
|
3631
|
+
* additionalAssetSources: {
|
|
3632
|
+
* // Custom web component
|
|
3633
|
+
* 'html-import': { srcAttributes: ['src'] },
|
|
3634
|
+
* // Add data-* attributes to existing element
|
|
3635
|
+
* 'img': { srcAttributes: ['data-src-dark', 'data-src-light'] }
|
|
3636
|
+
* }
|
|
3637
|
+
* }
|
|
3638
|
+
* ```
|
|
3639
|
+
*/
|
|
3641
3640
|
additionalAssetSources?: Record<string, HtmlAssetSource>;
|
|
3642
3641
|
}
|
|
3643
3642
|
interface FutureOptions {
|
|
@@ -3653,70 +3652,70 @@ interface FutureOptions {
|
|
|
3653
3652
|
}
|
|
3654
3653
|
interface ExperimentalOptions {
|
|
3655
3654
|
/**
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3655
|
+
* Append fake `&lang.(ext)` when queries are specified, to preserve the file extension for following plugins to process.
|
|
3656
|
+
*
|
|
3657
|
+
* @experimental
|
|
3658
|
+
* @default false
|
|
3659
|
+
*/
|
|
3661
3660
|
importGlobRestoreExtension?: boolean;
|
|
3662
3661
|
/**
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3662
|
+
* Allow finegrain control over assets and public files paths
|
|
3663
|
+
*
|
|
3664
|
+
* @experimental
|
|
3665
|
+
*/
|
|
3667
3666
|
renderBuiltUrl?: RenderBuiltAssetUrl;
|
|
3668
3667
|
/**
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3668
|
+
* Enables support of HMR partial accept via `import.meta.hot.acceptExports`.
|
|
3669
|
+
*
|
|
3670
|
+
* @experimental
|
|
3671
|
+
* @default false
|
|
3672
|
+
*/
|
|
3674
3673
|
hmrPartialAccept?: boolean;
|
|
3675
3674
|
/**
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3675
|
+
* Enable full bundle mode during `serve`.
|
|
3676
|
+
*
|
|
3677
|
+
* This seeds the default for the client environment's `isBundled` option.
|
|
3678
|
+
* Other environments default to `false` during `serve`. Any environment
|
|
3679
|
+
* can override its `isBundled` value via `environments[name].isBundled`.
|
|
3680
|
+
*
|
|
3681
|
+
* This is highly experimental.
|
|
3682
|
+
*
|
|
3683
|
+
* @experimental
|
|
3684
|
+
* @default false
|
|
3685
|
+
*/
|
|
3687
3686
|
bundledDev?: boolean;
|
|
3688
3687
|
}
|
|
3689
3688
|
interface LegacyOptions {
|
|
3690
3689
|
/**
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3690
|
+
* In Vite 6.0.8 and below, WebSocket server was able to connect from any web pages. However,
|
|
3691
|
+
* that could be exploited by a malicious web page.
|
|
3692
|
+
*
|
|
3693
|
+
* In Vite 6.0.9+, the WebSocket server now requires a token to connect from a web page.
|
|
3694
|
+
* But this may break some plugins and frameworks that connects to the WebSocket server
|
|
3695
|
+
* on their own. Enabling this option will make Vite skip the token check.
|
|
3696
|
+
*
|
|
3697
|
+
* **We do not recommend enabling this option unless you are sure that you are fine with
|
|
3698
|
+
* that security weakness.**
|
|
3699
|
+
*/
|
|
3701
3700
|
skipWebSocketTokenCheck?: boolean;
|
|
3702
3701
|
/**
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3702
|
+
* Opt-in to the pre-Vite 8 CJS interop behavior, which was inconsistent.
|
|
3703
|
+
*
|
|
3704
|
+
* In pre-Vite 8 versions, Vite had inconsistent CJS interop behavior. This was due to
|
|
3705
|
+
* the different behavior of esbuild and the Rollup commonjs plugin.
|
|
3706
|
+
* Vite 8+ uses Rolldown for both the dependency optimization in dev and the production build,
|
|
3707
|
+
* which aligns the behavior to esbuild.
|
|
3708
|
+
*
|
|
3709
|
+
* See the Vite 8 migration guide for more details.
|
|
3710
|
+
*/
|
|
3712
3711
|
inconsistentCjsInterop?: boolean;
|
|
3713
3712
|
}
|
|
3714
3713
|
interface ResolvedWorkerOptions {
|
|
3715
3714
|
format: "es" | "iife";
|
|
3716
3715
|
plugins: (bundleChain: string[]) => Promise<ResolvedConfig>;
|
|
3717
3716
|
/**
|
|
3718
|
-
|
|
3719
|
-
|
|
3717
|
+
* @deprecated Use `rolldownOptions` instead.
|
|
3718
|
+
*/
|
|
3720
3719
|
rollupOptions: RolldownOptions;
|
|
3721
3720
|
rolldownOptions: RolldownOptions;
|
|
3722
3721
|
}
|
|
@@ -3747,11 +3746,13 @@ interface ResolvedConfig extends Readonly<Omit<UserConfig, "plugins" | "css" | "
|
|
|
3747
3746
|
};
|
|
3748
3747
|
plugins: readonly Plugin[];
|
|
3749
3748
|
css: ResolvedCSSOptions;
|
|
3750
|
-
json: Required<JsonOptions>;
|
|
3749
|
+
json: Required<JsonOptions>;
|
|
3750
|
+
/** @deprecated Use `oxc` option instead. */
|
|
3751
3751
|
esbuild: ESBuildOptions | false;
|
|
3752
3752
|
oxc: OxcOptions | false;
|
|
3753
3753
|
server: ResolvedServerOptions;
|
|
3754
|
-
dev: ResolvedDevEnvironmentOptions;
|
|
3754
|
+
dev: ResolvedDevEnvironmentOptions;
|
|
3755
|
+
/** @experimental */
|
|
3755
3756
|
builder: ResolvedBuilderOptions | undefined;
|
|
3756
3757
|
build: ResolvedBuildOptions;
|
|
3757
3758
|
devtools: ResolvedDevToolsConfig;
|
|
@@ -3761,15 +3762,15 @@ interface ResolvedConfig extends Readonly<Omit<UserConfig, "plugins" | "css" | "
|
|
|
3761
3762
|
rawAssetsInclude: (string | RegExp)[];
|
|
3762
3763
|
logger: Logger;
|
|
3763
3764
|
/**
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3765
|
+
* Create an internal resolver to be used in special scenarios, e.g.
|
|
3766
|
+
* optimizer & handling css `@imports`.
|
|
3767
|
+
*
|
|
3768
|
+
* This API is deprecated. It only works for the client and ssr
|
|
3769
|
+
* environments. The `aliasOnly` option is also not being used anymore.
|
|
3770
|
+
* Plugins should move to `createIdResolver(environment.config)` instead.
|
|
3771
|
+
*
|
|
3772
|
+
* @deprecated Use `createIdResolver` from `vite` instead.
|
|
3773
|
+
*/
|
|
3773
3774
|
createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
|
|
3774
3775
|
optimizeDeps: DepOptimizationOptions;
|
|
3775
3776
|
worker: ResolvedWorkerOptions;
|
|
@@ -3778,15 +3779,15 @@ interface ResolvedConfig extends Readonly<Omit<UserConfig, "plugins" | "css" | "
|
|
|
3778
3779
|
future: FutureOptions | undefined;
|
|
3779
3780
|
environments: Record<string, ResolvedEnvironmentOptions>;
|
|
3780
3781
|
/**
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3782
|
+
* The token to connect to the WebSocket server from browsers.
|
|
3783
|
+
*
|
|
3784
|
+
* We recommend using `import.meta.hot` rather than connecting
|
|
3785
|
+
* to the WebSocket server directly.
|
|
3786
|
+
* If you have a usecase that requires connecting to the WebSocket
|
|
3787
|
+
* server, please create an issue so that we can discuss.
|
|
3788
|
+
*
|
|
3789
|
+
* @deprecated
|
|
3790
|
+
*/
|
|
3790
3791
|
webSocketToken: string;
|
|
3791
3792
|
} & PluginHookUtils> {}
|
|
3792
3793
|
interface PluginHookUtils {
|
|
@@ -3807,27 +3808,27 @@ declare function buildErrorMessage(err: RollupError, args?: string[], includeSta
|
|
|
3807
3808
|
//#endregion
|
|
3808
3809
|
//#region src/node/ssr/runtime/serverModuleRunner.d.ts
|
|
3809
3810
|
/**
|
|
3810
|
-
* @experimental
|
|
3811
|
-
*/
|
|
3811
|
+
* @experimental
|
|
3812
|
+
*/
|
|
3812
3813
|
interface ServerModuleRunnerOptions extends Omit<ModuleRunnerOptions, "root" | "fetchModule" | "hmr" | "transport"> {
|
|
3813
3814
|
/**
|
|
3814
|
-
|
|
3815
|
-
|
|
3815
|
+
* Disable HMR or configure HMR logger.
|
|
3816
|
+
*/
|
|
3816
3817
|
hmr?: false | {
|
|
3817
3818
|
logger?: ModuleRunnerHmr["logger"];
|
|
3818
3819
|
};
|
|
3819
3820
|
/**
|
|
3820
|
-
|
|
3821
|
-
|
|
3821
|
+
* Provide a custom module evaluator. This controls how the code is executed.
|
|
3822
|
+
*/
|
|
3822
3823
|
evaluator?: ModuleEvaluator;
|
|
3823
3824
|
}
|
|
3824
3825
|
declare const createServerModuleRunnerTransport: (options: {
|
|
3825
3826
|
channel: NormalizedServerHotChannel;
|
|
3826
3827
|
}) => ModuleRunnerTransport;
|
|
3827
3828
|
/**
|
|
3828
|
-
* Create an instance of the Vite SSR runtime that support HMR.
|
|
3829
|
-
* @experimental
|
|
3830
|
-
*/
|
|
3829
|
+
* Create an instance of the Vite SSR runtime that support HMR.
|
|
3830
|
+
* @experimental
|
|
3831
|
+
*/
|
|
3831
3832
|
declare function createServerModuleRunner(environment: DevEnvironment, options?: ServerModuleRunnerOptions): ModuleRunner;
|
|
3832
3833
|
//#endregion
|
|
3833
3834
|
//#region src/node/server/environments/runnableEnvironment.d.ts
|
|
@@ -3865,9 +3866,9 @@ interface RunnerImportResult<T> {
|
|
|
3865
3866
|
dependencies: string[];
|
|
3866
3867
|
}
|
|
3867
3868
|
/**
|
|
3868
|
-
* Import any file using the default Vite environment.
|
|
3869
|
-
* @experimental
|
|
3870
|
-
*/
|
|
3869
|
+
* Import any file using the default Vite environment.
|
|
3870
|
+
* @experimental
|
|
3871
|
+
*/
|
|
3871
3872
|
declare function runnerImport<T>(moduleId: string, inlineConfig?: InlineConfig): Promise<RunnerImportResult<T>>;
|
|
3872
3873
|
//#endregion
|
|
3873
3874
|
//#region src/node/ssr/fetchModule.d.ts
|
|
@@ -3877,9 +3878,9 @@ interface FetchModuleOptions {
|
|
|
3877
3878
|
startOffset?: number;
|
|
3878
3879
|
}
|
|
3879
3880
|
/**
|
|
3880
|
-
* Fetch module information for Vite module runner.
|
|
3881
|
-
* @experimental
|
|
3882
|
-
*/
|
|
3881
|
+
* Fetch module information for Vite module runner.
|
|
3882
|
+
* @experimental
|
|
3883
|
+
*/
|
|
3883
3884
|
declare function fetchModule(environment: DevEnvironment, url: string, importer?: string, options?: FetchModuleOptions): Promise<moduleRunner_FetchResult>;
|
|
3884
3885
|
//#endregion
|
|
3885
3886
|
//#region src/node/ssr/ssrTransform.d.ts
|
|
@@ -3903,8 +3904,8 @@ declare const defaultAllowedOrigins: RegExp;
|
|
|
3903
3904
|
//#endregion
|
|
3904
3905
|
//#region src/node/utils.d.ts
|
|
3905
3906
|
/**
|
|
3906
|
-
* Inlined to keep `@rollup/pluginutils` in devDependencies
|
|
3907
|
-
*/
|
|
3907
|
+
* Inlined to keep `@rollup/pluginutils` in devDependencies
|
|
3908
|
+
*/
|
|
3908
3909
|
type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
|
3909
3910
|
declare const createFilter: (include?: FilterPattern, exclude?: FilterPattern, options?: {
|
|
3910
3911
|
resolve?: string | false | null;
|
|
@@ -3928,76 +3929,74 @@ declare function send(req: http.IncomingMessage, res: ServerResponse, content: s
|
|
|
3928
3929
|
//#endregion
|
|
3929
3930
|
//#region src/node/server/searchRoot.d.ts
|
|
3930
3931
|
/**
|
|
3931
|
-
* Search up for the nearest workspace root
|
|
3932
|
-
*/
|
|
3932
|
+
* Search up for the nearest workspace root
|
|
3933
|
+
*/
|
|
3933
3934
|
declare function searchForWorkspaceRoot(current: string, root?: string): string;
|
|
3934
3935
|
//#endregion
|
|
3935
3936
|
//#region src/node/server/middlewares/static.d.ts
|
|
3936
3937
|
/**
|
|
3937
|
-
* Check if the url is allowed to be served, via the `server.fs` config.
|
|
3938
|
-
* @deprecated Use the `isFileLoadingAllowed` function instead.
|
|
3939
|
-
*/
|
|
3938
|
+
* Check if the url is allowed to be served, via the `server.fs` config.
|
|
3939
|
+
* @deprecated Use the `isFileLoadingAllowed` function instead.
|
|
3940
|
+
*/
|
|
3940
3941
|
declare function isFileServingAllowed(config: ResolvedConfig, url: string): boolean;
|
|
3941
3942
|
declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
|
|
3942
3943
|
/**
|
|
3943
|
-
* Warning: parameters are not validated, only works with normalized absolute paths
|
|
3944
|
-
*/
|
|
3944
|
+
* Warning: parameters are not validated, only works with normalized absolute paths
|
|
3945
|
+
*/
|
|
3945
3946
|
declare function isFileLoadingAllowed(config: ResolvedConfig, filePath: string): boolean;
|
|
3946
3947
|
//#endregion
|
|
3947
3948
|
//#region src/node/env.d.ts
|
|
3948
3949
|
/**
|
|
3949
|
-
* Load `.env` files within the `envDir` and merge them with the matching
|
|
3950
|
-
* variables already present in `process.env`.
|
|
3951
|
-
*/
|
|
3950
|
+
* Load `.env` files within the `envDir` and merge them with the matching
|
|
3951
|
+
* variables already present in `process.env`.
|
|
3952
|
+
*/
|
|
3952
3953
|
declare function loadEnv(mode: string, envDir: string | false, prefixes?: string | string[]): Record<string, string>;
|
|
3953
|
-
declare function resolveEnvPrefix({
|
|
3954
|
-
envPrefix
|
|
3955
|
-
}: UserConfig): string[];
|
|
3954
|
+
declare function resolveEnvPrefix({ envPrefix }: UserConfig): string[];
|
|
3956
3955
|
//#endregion
|
|
3957
3956
|
//#region src/node/plugins/manifest.d.ts
|
|
3958
3957
|
type Manifest = Record<string, ManifestChunk>;
|
|
3959
3958
|
interface ManifestChunk {
|
|
3960
3959
|
/**
|
|
3961
|
-
|
|
3962
|
-
|
|
3960
|
+
* The input file name of this chunk / asset if known
|
|
3961
|
+
*/
|
|
3963
3962
|
src?: string;
|
|
3964
3963
|
/**
|
|
3965
|
-
|
|
3966
|
-
|
|
3964
|
+
* The output file name of this chunk / asset
|
|
3965
|
+
*/
|
|
3967
3966
|
file: string;
|
|
3968
3967
|
/**
|
|
3969
|
-
|
|
3970
|
-
|
|
3968
|
+
* The list of CSS files imported by this chunk
|
|
3969
|
+
*/
|
|
3971
3970
|
css?: string[];
|
|
3972
3971
|
/**
|
|
3973
|
-
|
|
3974
|
-
|
|
3972
|
+
* The list of asset files imported by this chunk, excluding CSS files
|
|
3973
|
+
*/
|
|
3975
3974
|
assets?: string[];
|
|
3976
3975
|
/**
|
|
3977
|
-
|
|
3978
|
-
|
|
3976
|
+
* Whether this chunk or asset is an entry point
|
|
3977
|
+
*/
|
|
3979
3978
|
isEntry?: boolean;
|
|
3980
3979
|
/**
|
|
3981
|
-
|
|
3982
|
-
|
|
3980
|
+
* The name of this chunk / asset if known
|
|
3981
|
+
*/
|
|
3983
3982
|
name?: string;
|
|
3984
3983
|
/**
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3984
|
+
* Whether this chunk is a dynamic entry point
|
|
3985
|
+
*
|
|
3986
|
+
* This field is only present in JS chunks.
|
|
3987
|
+
*/
|
|
3989
3988
|
isDynamicEntry?: boolean;
|
|
3990
3989
|
/**
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3990
|
+
* The list of statically imported chunks by this chunk
|
|
3991
|
+
*
|
|
3992
|
+
* The values are the keys of the manifest. This field is only present in JS chunks.
|
|
3993
|
+
*/
|
|
3995
3994
|
imports?: string[];
|
|
3996
3995
|
/**
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
3996
|
+
* The list of dynamically imported chunks by this chunk
|
|
3997
|
+
*
|
|
3998
|
+
* The values are the keys of the manifest. This field is only present in JS chunks.
|
|
3999
|
+
*/
|
|
4001
4000
|
dynamicImports?: string[];
|
|
4002
4001
|
}
|
|
4003
4002
|
//#endregion
|