vite 3.0.0-alpha.7 → 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +82 -3
- package/bin/vite.js +1 -1
- package/client.d.ts +12 -0
- package/dist/client/client.mjs +51 -9
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-395deadd.js → dep-3f55e00c.js} +21 -9
- package/dist/node/chunks/{dep-3a62832d.js → dep-50504393.js} +4 -4
- package/dist/node/chunks/{dep-17430d09.js → dep-58d622b1.js} +5 -5
- package/dist/node/chunks/{dep-e214e00e.js → dep-6736a7e2.js} +14878 -13115
- package/dist/node/chunks/{dep-16fa9be9.js → dep-926cae74.js} +7 -7
- package/dist/node/chunks/dep-e8ca8d40.js +3 -3
- package/dist/node/cli.js +24 -11
- package/dist/node/constants.js +22 -5
- package/dist/node/index.d.ts +188 -44
- package/dist/node/index.js +21 -8
- package/dist/node-cjs/publicUtils.cjs +2178 -29
- package/package.json +29 -28
- package/src/client/client.ts +95 -22
- package/types/chokidar.d.ts +2 -2
- package/types/connect.d.ts +1 -1
- package/types/hot.d.ts +17 -3
- package/types/http-proxy.d.ts +5 -5
- package/types/ws.d.ts +6 -6
- package/dist/node-cjs/terser.cjs +0 -32876
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import require$$0 from 'postcss';
|
|
2
|
-
import {
|
|
2
|
+
import { y as commonjsGlobal } from './dep-6736a7e2.js';
|
|
3
3
|
import path$2 from 'path';
|
|
4
4
|
import require$$1 from 'crypto';
|
|
5
|
-
import
|
|
5
|
+
import require$$0__default from 'fs';
|
|
6
6
|
import require$$0$1 from 'util';
|
|
7
7
|
import { l as lib$1 } from './dep-e8ca8d40.js';
|
|
8
8
|
|
|
9
|
-
import { fileURLToPath as __cjs_fileURLToPath } from 'url';
|
|
10
|
-
import { dirname as __cjs_dirname } from 'path';
|
|
11
|
-
import { createRequire as __cjs_createRequire } from 'module';
|
|
9
|
+
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
|
10
|
+
import { dirname as __cjs_dirname } from 'node:path';
|
|
11
|
+
import { createRequire as __cjs_createRequire } from 'node:module';
|
|
12
12
|
|
|
13
13
|
const __filename = __cjs_fileURLToPath(import.meta.url);
|
|
14
14
|
const __dirname = __cjs_dirname(__filename);
|
|
@@ -1482,7 +1482,7 @@ var _postcss$1 = require$$0;
|
|
|
1482
1482
|
|
|
1483
1483
|
var _postcss2$1 = _interopRequireDefault$5(_postcss$1);
|
|
1484
1484
|
|
|
1485
|
-
var _fs$1 =
|
|
1485
|
+
var _fs$1 = require$$0__default;
|
|
1486
1486
|
|
|
1487
1487
|
var _fs2 = _interopRequireDefault$5(_fs$1);
|
|
1488
1488
|
|
|
@@ -1638,7 +1638,7 @@ Object.defineProperty(saveJSON$1, "__esModule", {
|
|
|
1638
1638
|
});
|
|
1639
1639
|
saveJSON$1.default = saveJSON;
|
|
1640
1640
|
|
|
1641
|
-
var _fs =
|
|
1641
|
+
var _fs = require$$0__default;
|
|
1642
1642
|
|
|
1643
1643
|
function saveJSON(cssFile, json) {
|
|
1644
1644
|
return new Promise((resolve, reject) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { fileURLToPath as __cjs_fileURLToPath } from 'url';
|
|
2
|
-
import { dirname as __cjs_dirname } from 'path';
|
|
3
|
-
import { createRequire as __cjs_createRequire } from 'module';
|
|
1
|
+
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
|
2
|
+
import { dirname as __cjs_dirname } from 'node:path';
|
|
3
|
+
import { createRequire as __cjs_createRequire } from 'node:module';
|
|
4
4
|
|
|
5
5
|
const __filename = __cjs_fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __cjs_dirname(__filename);
|
package/dist/node/cli.js
CHANGED
|
@@ -1,29 +1,41 @@
|
|
|
1
|
-
import { performance } from 'perf_hooks';
|
|
1
|
+
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import {
|
|
3
|
+
import { x as colors, q as createLogger, e as resolveConfig } from './chunks/dep-6736a7e2.js';
|
|
4
4
|
import { VERSION } from './constants.js';
|
|
5
|
-
import 'fs';
|
|
6
|
-
import 'path';
|
|
7
|
-
import 'url';
|
|
8
|
-
import 'module';
|
|
5
|
+
import 'node:fs';
|
|
6
|
+
import 'node:path';
|
|
7
|
+
import 'node:url';
|
|
8
|
+
import 'node:module';
|
|
9
9
|
import 'tty';
|
|
10
10
|
import 'esbuild';
|
|
11
|
+
import 'path';
|
|
12
|
+
import 'fs';
|
|
11
13
|
import 'assert';
|
|
12
14
|
import 'resolve';
|
|
13
15
|
import 'util';
|
|
14
16
|
import 'net';
|
|
17
|
+
import 'url';
|
|
15
18
|
import 'http';
|
|
16
19
|
import 'stream';
|
|
17
20
|
import 'os';
|
|
18
21
|
import 'child_process';
|
|
22
|
+
import 'node:os';
|
|
23
|
+
import 'node:crypto';
|
|
24
|
+
import 'node:util';
|
|
25
|
+
import 'node:dns';
|
|
19
26
|
import 'crypto';
|
|
20
27
|
import 'buffer';
|
|
21
28
|
import 'querystring';
|
|
29
|
+
import 'module';
|
|
22
30
|
import 'zlib';
|
|
23
31
|
import 'https';
|
|
24
32
|
import 'tls';
|
|
33
|
+
import 'node:http';
|
|
34
|
+
import 'node:https';
|
|
25
35
|
import 'worker_threads';
|
|
26
36
|
import 'readline';
|
|
37
|
+
import 'node:child_process';
|
|
38
|
+
import 'node:zlib';
|
|
27
39
|
|
|
28
40
|
function toArr(any) {
|
|
29
41
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -682,7 +694,7 @@ cli
|
|
|
682
694
|
.action(async (root, options) => {
|
|
683
695
|
// output structure is preserved even after bundling so require()
|
|
684
696
|
// is ok here
|
|
685
|
-
const { createServer } = await import('./chunks/dep-
|
|
697
|
+
const { createServer } = await import('./chunks/dep-6736a7e2.js').then(function (n) { return n.D; });
|
|
686
698
|
try {
|
|
687
699
|
const server = await createServer({
|
|
688
700
|
root,
|
|
@@ -691,6 +703,7 @@ cli
|
|
|
691
703
|
configFile: options.config,
|
|
692
704
|
logLevel: options.logLevel,
|
|
693
705
|
clearScreen: options.clearScreen,
|
|
706
|
+
optimizeDeps: { force: options.force },
|
|
694
707
|
server: cleanOptions(options)
|
|
695
708
|
});
|
|
696
709
|
if (!server.httpServer) {
|
|
@@ -728,7 +741,7 @@ cli
|
|
|
728
741
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
729
742
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
730
743
|
.action(async (root, options) => {
|
|
731
|
-
const { build } = await import('./chunks/dep-
|
|
744
|
+
const { build } = await import('./chunks/dep-6736a7e2.js').then(function (n) { return n.C; });
|
|
732
745
|
const buildOptions = cleanOptions(options);
|
|
733
746
|
try {
|
|
734
747
|
await build({
|
|
@@ -738,7 +751,7 @@ cli
|
|
|
738
751
|
configFile: options.config,
|
|
739
752
|
logLevel: options.logLevel,
|
|
740
753
|
clearScreen: options.clearScreen,
|
|
741
|
-
force: options.force,
|
|
754
|
+
optimizeDeps: { force: options.force },
|
|
742
755
|
build: buildOptions
|
|
743
756
|
});
|
|
744
757
|
}
|
|
@@ -752,7 +765,7 @@ cli
|
|
|
752
765
|
.command('optimize [root]', 'pre-bundle dependencies')
|
|
753
766
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
754
767
|
.action(async (root, options) => {
|
|
755
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
768
|
+
const { optimizeDeps } = await import('./chunks/dep-6736a7e2.js').then(function (n) { return n.B; });
|
|
756
769
|
try {
|
|
757
770
|
const config = await resolveConfig({
|
|
758
771
|
root,
|
|
@@ -775,7 +788,7 @@ cli
|
|
|
775
788
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
776
789
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
777
790
|
.action(async (root, options) => {
|
|
778
|
-
const { preview } = await import('./chunks/dep-
|
|
791
|
+
const { preview } = await import('./chunks/dep-6736a7e2.js').then(function (n) { return n.E; });
|
|
779
792
|
try {
|
|
780
793
|
const server = await preview({
|
|
781
794
|
root,
|
package/dist/node/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import path, { resolve } from 'path';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
1
|
+
import path, { resolve } from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
3
|
|
|
4
|
-
var version = "3.0.0-
|
|
4
|
+
var version = "3.0.0-beta.0";
|
|
5
5
|
|
|
6
6
|
const VERSION = version;
|
|
7
7
|
const DEFAULT_MAIN_FIELDS = [
|
|
@@ -48,11 +48,17 @@ const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
|
|
|
48
48
|
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
|
49
49
|
// ** READ THIS ** before editing `KNOWN_ASSET_TYPES`.
|
|
50
50
|
// If you add an asset to `KNOWN_ASSET_TYPES`, make sure to also add it
|
|
51
|
-
// to the TypeScript declaration file `packages/vite/client.d.ts
|
|
51
|
+
// to the TypeScript declaration file `packages/vite/client.d.ts` and
|
|
52
|
+
// add a mime type to the `registerCustomMime` in
|
|
53
|
+
// `packages/vite/src/node/plugin/assets.ts` if mime type cannot be
|
|
54
|
+
// looked up by mrmime.
|
|
52
55
|
const KNOWN_ASSET_TYPES = [
|
|
53
56
|
// images
|
|
54
57
|
'png',
|
|
55
58
|
'jpe?g',
|
|
59
|
+
'jfif',
|
|
60
|
+
'pjpeg',
|
|
61
|
+
'pjp',
|
|
56
62
|
'gif',
|
|
57
63
|
'svg',
|
|
58
64
|
'ico',
|
|
@@ -78,5 +84,16 @@ const KNOWN_ASSET_TYPES = [
|
|
|
78
84
|
];
|
|
79
85
|
const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
|
|
80
86
|
const DEP_VERSION_RE = /[\?&](v=[\w\.-]+)\b/;
|
|
87
|
+
const loopbackHosts = new Set([
|
|
88
|
+
'localhost',
|
|
89
|
+
'127.0.0.1',
|
|
90
|
+
'::1',
|
|
91
|
+
'0000:0000:0000:0000:0000:0000:0000:0001'
|
|
92
|
+
]);
|
|
93
|
+
const wildcardHosts = new Set([
|
|
94
|
+
'0.0.0.0',
|
|
95
|
+
'::',
|
|
96
|
+
'0000:0000:0000:0000:0000:0000:0000:0000'
|
|
97
|
+
]);
|
|
81
98
|
|
|
82
|
-
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, DEFAULT_ASSETS_RE, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR };
|
|
99
|
+
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, DEFAULT_ASSETS_RE, DEFAULT_EXTENSIONS, DEFAULT_MAIN_FIELDS, DEP_VERSION_RE, ENV_ENTRY, ENV_PUBLIC_PATH, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, OPTIMIZABLE_ENTRY_RE, SPECIAL_QUERY_RE, VALID_ID_PREFIX, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
|
|
3
|
-
import type { Agent } from 'http';
|
|
3
|
+
import type { Agent } from 'node:http';
|
|
4
4
|
import type { BuildOptions as BuildOptions_2 } from 'esbuild';
|
|
5
|
-
import type { ClientRequest } from 'http';
|
|
6
|
-
import type { ClientRequestArgs } from 'http';
|
|
5
|
+
import type { ClientRequest } from 'node:http';
|
|
6
|
+
import type { ClientRequestArgs } from 'node:http';
|
|
7
7
|
import type { CustomPluginOptions } from 'rollup';
|
|
8
|
-
import type { Duplex } from 'stream';
|
|
9
|
-
import type { DuplexOptions } from 'stream';
|
|
8
|
+
import type { Duplex } from 'node:stream';
|
|
9
|
+
import type { DuplexOptions } from 'node:stream';
|
|
10
10
|
import { TransformOptions as EsbuildTransformOptions } from 'esbuild';
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
11
|
+
import { version as esbuildVersion } from 'esbuild';
|
|
12
|
+
import { EventEmitter } from 'node:events';
|
|
13
|
+
import * as events from 'node:events';
|
|
13
14
|
import type { ExistingRawSourceMap } from 'rollup';
|
|
14
|
-
import type * as fs from 'fs';
|
|
15
|
+
import type * as fs from 'node:fs';
|
|
15
16
|
import type { GetManualChunk } from 'rollup';
|
|
16
|
-
import * as http from 'http';
|
|
17
|
-
import type { IncomingMessage } from 'http';
|
|
17
|
+
import * as http from 'node:http';
|
|
18
|
+
import type { IncomingMessage } from 'node:http';
|
|
18
19
|
import type { InputOptions } from 'rollup';
|
|
19
20
|
import type { LoadResult } from 'rollup';
|
|
20
21
|
import type { ModuleFormat } from 'rollup';
|
|
21
22
|
import type { ModuleInfo } from 'rollup';
|
|
22
|
-
import type * as net from 'net';
|
|
23
|
-
import type { OutgoingHttpHeaders } from 'http';
|
|
23
|
+
import type * as net from 'node:net';
|
|
24
|
+
import type { OutgoingHttpHeaders } from 'node:http';
|
|
24
25
|
import type { OutputBundle } from 'rollup';
|
|
25
26
|
import type { OutputChunk } from 'rollup';
|
|
26
27
|
import type { PartialResolvedId } from 'rollup';
|
|
@@ -32,22 +33,23 @@ import type { ResolveIdResult } from 'rollup';
|
|
|
32
33
|
import type { RollupError } from 'rollup';
|
|
33
34
|
import type { RollupOptions } from 'rollup';
|
|
34
35
|
import type { RollupOutput } from 'rollup';
|
|
36
|
+
import { VERSION as rollupVersion } from 'rollup';
|
|
35
37
|
import type { RollupWatcher } from 'rollup';
|
|
36
38
|
import type { SecureContextOptions } from 'tls';
|
|
37
|
-
import type { Server } from 'http';
|
|
38
|
-
import type { Server as Server_2 } from 'https';
|
|
39
|
-
import type { ServerOptions as ServerOptions_2 } from 'https';
|
|
40
|
-
import type { ServerResponse } from 'http';
|
|
39
|
+
import type { Server } from 'node:http';
|
|
40
|
+
import type { Server as Server_2 } from 'node:https';
|
|
41
|
+
import type { ServerOptions as ServerOptions_2 } from 'node:https';
|
|
42
|
+
import type { ServerResponse } from 'node:http';
|
|
41
43
|
import type { SourceDescription } from 'rollup';
|
|
42
44
|
import type { SourceMap } from 'rollup';
|
|
43
|
-
import type * as stream from 'stream';
|
|
45
|
+
import type * as stream from 'node:stream';
|
|
44
46
|
import type { TransformPluginContext } from 'rollup';
|
|
45
47
|
import type { TransformResult as TransformResult_2 } from 'rollup';
|
|
46
48
|
import type { TransformResult as TransformResult_3 } from 'esbuild';
|
|
47
|
-
import type * as url from 'url';
|
|
48
|
-
import type { URL as URL_2 } from 'url';
|
|
49
|
+
import type * as url from 'node:url';
|
|
50
|
+
import type { URL as URL_2 } from 'node:url';
|
|
49
51
|
import type { WatcherOptions } from 'rollup';
|
|
50
|
-
import type { ZlibOptions } from 'zlib';
|
|
52
|
+
import type { ZlibOptions } from 'node:zlib';
|
|
51
53
|
|
|
52
54
|
export declare interface Alias {
|
|
53
55
|
find: string | RegExp
|
|
@@ -75,6 +77,15 @@ export declare type AnymatchFn = (testString: string) => boolean
|
|
|
75
77
|
|
|
76
78
|
export declare type AnymatchPattern = string | RegExp | AnymatchFn
|
|
77
79
|
|
|
80
|
+
/**
|
|
81
|
+
* spa: include SPA fallback middleware and configure sirv with `single: true` in preview
|
|
82
|
+
*
|
|
83
|
+
* mpa: only include non-SPA HTML middlewares
|
|
84
|
+
*
|
|
85
|
+
* custom: don't include HTML middlewares
|
|
86
|
+
*/
|
|
87
|
+
export declare type AppType = 'spa' | 'mpa' | 'custom';
|
|
88
|
+
|
|
78
89
|
export declare interface AwaitWriteFinishOptions {
|
|
79
90
|
/**
|
|
80
91
|
* Amount of time in milliseconds for a file size to remain constant before emitting its event.
|
|
@@ -93,6 +104,26 @@ export declare interface AwaitWriteFinishOptions {
|
|
|
93
104
|
*/
|
|
94
105
|
export declare function build(inlineConfig?: InlineConfig): Promise<RollupOutput | RollupOutput[] | RollupWatcher>;
|
|
95
106
|
|
|
107
|
+
export declare type BuildAdvancedBaseConfig = BuildAdvancedBaseOptions & {
|
|
108
|
+
/**
|
|
109
|
+
* Base for assets and public files in case they should be different
|
|
110
|
+
*/
|
|
111
|
+
assets?: string | BuildAdvancedBaseOptions;
|
|
112
|
+
public?: string | BuildAdvancedBaseOptions;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export declare interface BuildAdvancedBaseOptions {
|
|
116
|
+
/**
|
|
117
|
+
* Relative base. If true, every generated URL is relative and the dist folder
|
|
118
|
+
* can be deployed to any base or subdomain. Use this option when the base
|
|
119
|
+
* is unkown at build time
|
|
120
|
+
* @default false
|
|
121
|
+
*/
|
|
122
|
+
relative?: boolean;
|
|
123
|
+
url?: string;
|
|
124
|
+
runtime?: (filename: string) => string;
|
|
125
|
+
}
|
|
126
|
+
|
|
96
127
|
export declare interface BuildOptions {
|
|
97
128
|
/**
|
|
98
129
|
* Compatibility transform target. The transform is performed with esbuild
|
|
@@ -437,6 +468,10 @@ export declare interface CorsOptions {
|
|
|
437
468
|
|
|
438
469
|
export declare type CorsOrigin = boolean | string | RegExp | (string | RegExp)[];
|
|
439
470
|
|
|
471
|
+
export declare const createFilter: (include?: FilterPattern | undefined, exclude?: FilterPattern | undefined, options?: {
|
|
472
|
+
resolve?: string | false | null | undefined;
|
|
473
|
+
} | undefined) => (id: string | unknown) => boolean;
|
|
474
|
+
|
|
440
475
|
export declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
|
|
441
476
|
|
|
442
477
|
export declare function createServer(inlineConfig?: InlineConfig): Promise<ViteDevServer>;
|
|
@@ -533,13 +568,6 @@ export declare interface DepOptimizationOptions {
|
|
|
533
568
|
* vite project root. This will overwrite default entries inference.
|
|
534
569
|
*/
|
|
535
570
|
entries?: string | string[];
|
|
536
|
-
/**
|
|
537
|
-
* Enable esbuild based scan phase, to get back to the optimized deps discovery
|
|
538
|
-
* strategy used in Vite v2
|
|
539
|
-
* @default false
|
|
540
|
-
* @experimental
|
|
541
|
-
*/
|
|
542
|
-
devScan?: boolean;
|
|
543
571
|
/**
|
|
544
572
|
* Force optimize listed dependencies (must be resolvable import paths,
|
|
545
573
|
* cannot be globs).
|
|
@@ -586,6 +614,11 @@ export declare interface DepOptimizationOptions {
|
|
|
586
614
|
* @experimental
|
|
587
615
|
*/
|
|
588
616
|
disabled?: boolean | 'build' | 'dev';
|
|
617
|
+
/**
|
|
618
|
+
* Force dep pre-optimization regardless of whether deps have changed.
|
|
619
|
+
* @experimental
|
|
620
|
+
*/
|
|
621
|
+
force?: boolean;
|
|
589
622
|
}
|
|
590
623
|
|
|
591
624
|
export declare interface DepOptimizationProcessing {
|
|
@@ -605,13 +638,18 @@ export declare interface DepOptimizationResult {
|
|
|
605
638
|
}
|
|
606
639
|
|
|
607
640
|
export declare interface DepsOptimizer {
|
|
608
|
-
metadata:
|
|
641
|
+
metadata: (options: {
|
|
642
|
+
ssr: boolean;
|
|
643
|
+
}) => DepOptimizationMetadata;
|
|
609
644
|
scanProcessing?: Promise<void>;
|
|
610
|
-
registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
|
|
645
|
+
registerMissingImport: (id: string, resolved: string, ssr?: boolean) => OptimizedDepInfo;
|
|
611
646
|
run: () => void;
|
|
612
647
|
isOptimizedDepFile: (id: string) => boolean;
|
|
613
648
|
isOptimizedDepUrl: (url: string) => boolean;
|
|
614
649
|
getOptimizedDepId: (depInfo: OptimizedDepInfo) => string;
|
|
650
|
+
delayDepsOptimizerUntil: (id: string, done: () => Promise<any>) => void;
|
|
651
|
+
registerWorkersSource: (id: string) => void;
|
|
652
|
+
resetRegisteredIds: () => void;
|
|
615
653
|
options: DepOptimizationOptions;
|
|
616
654
|
}
|
|
617
655
|
|
|
@@ -645,6 +683,8 @@ export declare type ESBuildTransformResult = Omit<TransformResult_3, 'map'> & {
|
|
|
645
683
|
map: SourceMap;
|
|
646
684
|
};
|
|
647
685
|
|
|
686
|
+
export { esbuildVersion }
|
|
687
|
+
|
|
648
688
|
export declare interface ExperimentalOptions {
|
|
649
689
|
/**
|
|
650
690
|
* Append fake `&lang.(ext)` when queries are specified, to preseve the file extension for following plugins to process.
|
|
@@ -653,6 +693,19 @@ export declare interface ExperimentalOptions {
|
|
|
653
693
|
* @default false
|
|
654
694
|
*/
|
|
655
695
|
importGlobRestoreExtension?: boolean;
|
|
696
|
+
/**
|
|
697
|
+
* Build advanced base options. Allow finegrain contol over assets and public files base
|
|
698
|
+
*
|
|
699
|
+
* @experimental
|
|
700
|
+
*/
|
|
701
|
+
buildAdvancedBaseOptions?: BuildAdvancedBaseConfig;
|
|
702
|
+
/**
|
|
703
|
+
* Enables support of HMR partial accept via `import.meta.hot.acceptExports`.
|
|
704
|
+
*
|
|
705
|
+
* @experimental
|
|
706
|
+
* @default false
|
|
707
|
+
*/
|
|
708
|
+
hmrPartialAccept?: boolean;
|
|
656
709
|
}
|
|
657
710
|
|
|
658
711
|
export declare type ExportsData = {
|
|
@@ -690,6 +743,11 @@ export declare interface FileSystemServeOptions {
|
|
|
690
743
|
deny?: string[];
|
|
691
744
|
}
|
|
692
745
|
|
|
746
|
+
/**
|
|
747
|
+
* Inlined to keep `@rollup/pluginutils` in devDependencies
|
|
748
|
+
*/
|
|
749
|
+
export declare type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
|
750
|
+
|
|
693
751
|
export declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise<ExistingRawSourceMap>;
|
|
694
752
|
|
|
695
753
|
export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
|
@@ -1165,6 +1223,7 @@ export declare interface InternalResolveOptions extends ResolveOptions {
|
|
|
1165
1223
|
tryEsmOnly?: boolean;
|
|
1166
1224
|
scan?: boolean;
|
|
1167
1225
|
getDepsOptimizer?: () => DepsOptimizer | undefined;
|
|
1226
|
+
shouldExternalize?: (id: string) => boolean | undefined;
|
|
1168
1227
|
}
|
|
1169
1228
|
|
|
1170
1229
|
export declare function isDepsOptimizerEnabled(config: ResolvedConfig): boolean;
|
|
@@ -1189,12 +1248,55 @@ export declare interface KnownAsTypeMap {
|
|
|
1189
1248
|
worker: Worker
|
|
1190
1249
|
}
|
|
1191
1250
|
|
|
1251
|
+
export declare interface LegacyOptions {
|
|
1252
|
+
/**
|
|
1253
|
+
* Revert vite dev to the v2.9 strategy. Enable esbuild based deps scanner.
|
|
1254
|
+
*
|
|
1255
|
+
* @experimental
|
|
1256
|
+
* @deprecated
|
|
1257
|
+
* @default false
|
|
1258
|
+
*/
|
|
1259
|
+
devDepsScanner?: boolean;
|
|
1260
|
+
/**
|
|
1261
|
+
* Revert vite build to the v2.9 strategy. Disable esbuild deps optimization and adds `@rollup/plugin-commonjs`
|
|
1262
|
+
*
|
|
1263
|
+
* @experimental
|
|
1264
|
+
* @deprecated
|
|
1265
|
+
* @default false
|
|
1266
|
+
*/
|
|
1267
|
+
buildRollupPluginCommonjs?: boolean;
|
|
1268
|
+
/**
|
|
1269
|
+
* Revert vite build --ssr to the v2.9 strategy. Use CJS SSR build and v2.9 externalization heuristics
|
|
1270
|
+
*
|
|
1271
|
+
* @experimental
|
|
1272
|
+
* @deprecated
|
|
1273
|
+
* @default false
|
|
1274
|
+
*/
|
|
1275
|
+
buildSsrCjsExternalHeuristics?: boolean;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1192
1278
|
export declare type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife';
|
|
1193
1279
|
|
|
1194
1280
|
export declare interface LibraryOptions {
|
|
1281
|
+
/**
|
|
1282
|
+
* Path of library entry
|
|
1283
|
+
*/
|
|
1195
1284
|
entry: string;
|
|
1285
|
+
/**
|
|
1286
|
+
* The name of the exposed global variable. Required when the `formats` option includes
|
|
1287
|
+
* `umd` or `iife`
|
|
1288
|
+
*/
|
|
1196
1289
|
name?: string;
|
|
1290
|
+
/**
|
|
1291
|
+
* Output bundle formats
|
|
1292
|
+
* @default ['es', 'umd']
|
|
1293
|
+
*/
|
|
1197
1294
|
formats?: LibraryFormats[];
|
|
1295
|
+
/**
|
|
1296
|
+
* The name of the package file output. The default file name is the name option
|
|
1297
|
+
* of the project package.json. It can also be defined as a function taking the
|
|
1298
|
+
* format as an argument.
|
|
1299
|
+
*/
|
|
1198
1300
|
fileName?: string | ((format: ModuleFormat) => string);
|
|
1199
1301
|
}
|
|
1200
1302
|
|
|
@@ -1272,7 +1374,7 @@ export declare class ModuleGraph {
|
|
|
1272
1374
|
* If there are dependencies that no longer have any importers, they are
|
|
1273
1375
|
* returned as a Set.
|
|
1274
1376
|
*/
|
|
1275
|
-
updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, acceptedModules: Set<string | ModuleNode>, isSelfAccepting: boolean, ssr?: boolean): Promise<Set<ModuleNode> | undefined>;
|
|
1377
|
+
updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | ModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean, ssr?: boolean): Promise<Set<ModuleNode> | undefined>;
|
|
1276
1378
|
ensureEntryFromUrl(rawUrl: string, ssr?: boolean): Promise<ModuleNode>;
|
|
1277
1379
|
createFileOnlyEntry(file: string): ModuleNode;
|
|
1278
1380
|
resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
|
|
@@ -1294,6 +1396,8 @@ export declare class ModuleNode {
|
|
|
1294
1396
|
importers: Set<ModuleNode>;
|
|
1295
1397
|
importedModules: Set<ModuleNode>;
|
|
1296
1398
|
acceptedHmrDeps: Set<ModuleNode>;
|
|
1399
|
+
acceptedHmrExports: Set<string> | null;
|
|
1400
|
+
importedBindings: Map<string, Set<string>> | null;
|
|
1297
1401
|
isSelfAccepting?: boolean;
|
|
1298
1402
|
transformResult: TransformResult | null;
|
|
1299
1403
|
ssrTransformResult: TransformResult | null;
|
|
@@ -1492,7 +1596,7 @@ export declare interface PluginContainer {
|
|
|
1492
1596
|
close(): Promise<void>;
|
|
1493
1597
|
}
|
|
1494
1598
|
|
|
1495
|
-
export declare type PluginOption = Plugin_2 | false | null | undefined | PluginOption[]
|
|
1599
|
+
export declare type PluginOption = Plugin_2 | false | null | undefined | PluginOption[] | Promise<Plugin_2 | false | null | undefined | PluginOption[]>;
|
|
1496
1600
|
|
|
1497
1601
|
/**
|
|
1498
1602
|
* Starts the Vite server in preview mode, to simulate a production deployment
|
|
@@ -1514,7 +1618,7 @@ export declare interface PreviewServer {
|
|
|
1514
1618
|
/**
|
|
1515
1619
|
* Print server urls
|
|
1516
1620
|
*/
|
|
1517
|
-
printUrls: () => void
|
|
1621
|
+
printUrls: () => Promise<void>;
|
|
1518
1622
|
}
|
|
1519
1623
|
|
|
1520
1624
|
export declare type PreviewServerHook = (server: {
|
|
@@ -1542,8 +1646,19 @@ export declare interface PrunePayload {
|
|
|
1542
1646
|
paths: string[]
|
|
1543
1647
|
}
|
|
1544
1648
|
|
|
1649
|
+
/**
|
|
1650
|
+
* Resolve base url. Note that some users use Vite to build for non-web targets like
|
|
1651
|
+
* electron or expects to deploy
|
|
1652
|
+
*/
|
|
1653
|
+
export declare function resolveBaseUrl(base: string | undefined, isBuild: boolean, logger: Logger, optionName: string): string;
|
|
1654
|
+
|
|
1545
1655
|
export declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string): Promise<ResolvedConfig>;
|
|
1546
1656
|
|
|
1657
|
+
export declare type ResolvedBuildAdvancedBaseConfig = BuildAdvancedBaseOptions & {
|
|
1658
|
+
assets: BuildAdvancedBaseOptions;
|
|
1659
|
+
public: BuildAdvancedBaseOptions;
|
|
1660
|
+
};
|
|
1661
|
+
|
|
1547
1662
|
export declare type ResolvedBuildOptions = Required<BuildOptions>;
|
|
1548
1663
|
|
|
1549
1664
|
export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'assetsInclude' | 'optimizeDeps' | 'worker'> & {
|
|
@@ -1567,20 +1682,32 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
|
|
|
1567
1682
|
server: ResolvedServerOptions;
|
|
1568
1683
|
build: ResolvedBuildOptions;
|
|
1569
1684
|
preview: ResolvedPreviewOptions;
|
|
1685
|
+
ssr: ResolvedSSROptions | undefined;
|
|
1570
1686
|
assetsInclude: (file: string) => boolean;
|
|
1571
1687
|
logger: Logger;
|
|
1572
1688
|
createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
|
|
1573
1689
|
optimizeDeps: DepOptimizationOptions;
|
|
1574
1690
|
/* Excluded from this release type: packageCache */
|
|
1575
1691
|
worker: ResolveWorkerOptions;
|
|
1576
|
-
|
|
1692
|
+
appType: AppType;
|
|
1693
|
+
experimental: ResolvedExperimentalOptions;
|
|
1577
1694
|
}>;
|
|
1578
1695
|
|
|
1696
|
+
export declare type ResolvedExperimentalOptions = Required<ExperimentalOptions> & {
|
|
1697
|
+
buildAdvancedBaseOptions: ResolvedBuildAdvancedBaseConfig;
|
|
1698
|
+
};
|
|
1699
|
+
|
|
1579
1700
|
export declare interface ResolvedPreviewOptions extends PreviewOptions {
|
|
1580
1701
|
}
|
|
1581
1702
|
|
|
1582
1703
|
export declare interface ResolvedServerOptions extends ServerOptions {
|
|
1583
1704
|
fs: Required<FileSystemServeOptions>;
|
|
1705
|
+
middlewareMode: boolean;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
export declare interface ResolvedSSROptions extends SSROptions {
|
|
1709
|
+
target: SSRTarget;
|
|
1710
|
+
format: SSRFormat;
|
|
1584
1711
|
}
|
|
1585
1712
|
|
|
1586
1713
|
export declare type ResolvedUrl = [
|
|
@@ -1819,6 +1946,8 @@ export declare interface RollupDynamicImportVarsOptions {
|
|
|
1819
1946
|
warnOnError?: boolean
|
|
1820
1947
|
}
|
|
1821
1948
|
|
|
1949
|
+
export { rollupVersion }
|
|
1950
|
+
|
|
1822
1951
|
/**
|
|
1823
1952
|
* Search up for the nearest workspace root
|
|
1824
1953
|
*/
|
|
@@ -1885,6 +2014,8 @@ export declare class SplitVendorChunkCache {
|
|
|
1885
2014
|
|
|
1886
2015
|
export declare function splitVendorChunkPlugin(): Plugin_2;
|
|
1887
2016
|
|
|
2017
|
+
export declare type SSRFormat = 'esm' | 'cjs';
|
|
2018
|
+
|
|
1888
2019
|
export declare interface SSROptions {
|
|
1889
2020
|
external?: string[];
|
|
1890
2021
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
|
@@ -1894,6 +2025,14 @@ export declare interface SSROptions {
|
|
|
1894
2025
|
* Default: 'node'
|
|
1895
2026
|
*/
|
|
1896
2027
|
target?: SSRTarget;
|
|
2028
|
+
/**
|
|
2029
|
+
* Define the format for the ssr build. Since Vite v3 the SSR build generates ESM by default.
|
|
2030
|
+
* `'cjs'` can be selected to generate a CJS build, but it isn't recommended. This option is
|
|
2031
|
+
* left marked as experimental to give users more time to update to ESM. CJS builds requires
|
|
2032
|
+
* complex externalization heuristics that aren't present in the ESM format.
|
|
2033
|
+
* @experimental
|
|
2034
|
+
*/
|
|
2035
|
+
format?: SSRFormat;
|
|
1897
2036
|
}
|
|
1898
2037
|
|
|
1899
2038
|
export declare type SSRTarget = 'node' | 'webworker';
|
|
@@ -2177,11 +2316,6 @@ export declare interface UserConfig {
|
|
|
2177
2316
|
* Preview specific options, e.g. host, port, https...
|
|
2178
2317
|
*/
|
|
2179
2318
|
preview?: PreviewOptions;
|
|
2180
|
-
/**
|
|
2181
|
-
* Force dep pre-optimization regardless of whether deps have changed.
|
|
2182
|
-
* @experimental
|
|
2183
|
-
*/
|
|
2184
|
-
force?: boolean;
|
|
2185
2319
|
/**
|
|
2186
2320
|
* Dep optimization options
|
|
2187
2321
|
*/
|
|
@@ -2193,11 +2327,18 @@ export declare interface UserConfig {
|
|
|
2193
2327
|
/**
|
|
2194
2328
|
* Experimental features
|
|
2195
2329
|
*
|
|
2196
|
-
* Features under this field
|
|
2330
|
+
* Features under this field could change in the future and might NOT follow semver.
|
|
2197
2331
|
* Please be careful and always pin Vite's version when using them.
|
|
2198
2332
|
* @experimental
|
|
2199
2333
|
*/
|
|
2200
2334
|
experimental?: ExperimentalOptions;
|
|
2335
|
+
/**
|
|
2336
|
+
* Legacy options
|
|
2337
|
+
*
|
|
2338
|
+
* Features under this field only follow semver for patches, they could be removed in a
|
|
2339
|
+
* future minor version. Please always pin Vite's version to a minor when using them.
|
|
2340
|
+
*/
|
|
2341
|
+
legacy?: LegacyOptions;
|
|
2201
2342
|
/**
|
|
2202
2343
|
* Log level.
|
|
2203
2344
|
* Default: 'info'
|
|
@@ -2241,17 +2382,20 @@ export declare interface UserConfig {
|
|
|
2241
2382
|
rollupOptions?: Omit<RollupOptions, 'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures'>;
|
|
2242
2383
|
};
|
|
2243
2384
|
/**
|
|
2244
|
-
* Whether your application is a Single Page Application (SPA)
|
|
2245
|
-
*
|
|
2246
|
-
*
|
|
2385
|
+
* Whether your application is a Single Page Application (SPA),
|
|
2386
|
+
* a Multi-Page Application (MPA), or Custom Application (SSR
|
|
2387
|
+
* and frameworks with custom HTML handling)
|
|
2388
|
+
* @default 'spa'
|
|
2247
2389
|
*/
|
|
2248
|
-
|
|
2390
|
+
appType?: AppType;
|
|
2249
2391
|
}
|
|
2250
2392
|
|
|
2251
2393
|
export declare type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFn;
|
|
2252
2394
|
|
|
2253
2395
|
export declare type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
|
|
2254
2396
|
|
|
2397
|
+
export declare const version: string;
|
|
2398
|
+
|
|
2255
2399
|
export declare interface ViteDevServer {
|
|
2256
2400
|
/**
|
|
2257
2401
|
* The resolved vite config object
|
|
@@ -2327,7 +2471,7 @@ export declare interface ViteDevServer {
|
|
|
2327
2471
|
/**
|
|
2328
2472
|
* Print server urls
|
|
2329
2473
|
*/
|
|
2330
|
-
printUrls(): void
|
|
2474
|
+
printUrls(): Promise<void>;
|
|
2331
2475
|
/**
|
|
2332
2476
|
* Restart the server.
|
|
2333
2477
|
*
|