vite 3.0.0-alpha.9 → 3.0.0-beta.2
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-3165073f.js → dep-42600871.js} +7 -7
- package/dist/node/chunks/{dep-08f2a2be.js → dep-48fd67df.js} +21 -9
- package/dist/node/chunks/{dep-17430d09.js → dep-58d622b1.js} +5 -5
- package/dist/node/chunks/{dep-8df7bfd6.js → dep-7c996900.js} +14729 -13093
- package/dist/node/chunks/{dep-523c8a1b.js → dep-ce359b6c.js} +4 -4
- package/dist/node/chunks/dep-e8ca8d40.js +3 -3
- package/dist/node/cli.js +24 -11
- package/dist/node/constants.js +30 -5
- package/dist/node/index.d.ts +169 -50
- package/dist/node/index.js +21 -8
- package/dist/node-cjs/publicUtils.cjs +2177 -28
- package/package.json +26 -25
- 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 -31023
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z as getAugmentedNamespace, A as getDefaultExportFromCjs } from './dep-7c996900.js';
|
|
2
2
|
|
|
3
|
-
import { fileURLToPath as __cjs_fileURLToPath } from 'url';
|
|
4
|
-
import { dirname as __cjs_dirname } from 'path';
|
|
5
|
-
import { createRequire as __cjs_createRequire } from 'module';
|
|
3
|
+
import { fileURLToPath as __cjs_fileURLToPath } from 'node:url';
|
|
4
|
+
import { dirname as __cjs_dirname } from 'node:path';
|
|
5
|
+
import { createRequire as __cjs_createRequire } from 'node:module';
|
|
6
6
|
|
|
7
7
|
const __filename = __cjs_fileURLToPath(import.meta.url);
|
|
8
8
|
const __dirname = __cjs_dirname(__filename);
|
|
@@ -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-7c996900.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-7c996900.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-7c996900.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-7c996900.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-7c996900.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.2";
|
|
5
5
|
|
|
6
6
|
const VERSION = version;
|
|
7
7
|
const DEFAULT_MAIN_FIELDS = [
|
|
@@ -17,6 +17,14 @@ const DEFAULT_EXTENSIONS = [
|
|
|
17
17
|
'.tsx',
|
|
18
18
|
'.json'
|
|
19
19
|
];
|
|
20
|
+
const DEFAULT_CONFIG_FILES = [
|
|
21
|
+
'vite.config.js',
|
|
22
|
+
'vite.config.mjs',
|
|
23
|
+
'vite.config.ts',
|
|
24
|
+
'vite.config.cjs',
|
|
25
|
+
'vite.config.mts',
|
|
26
|
+
'vite.config.cts'
|
|
27
|
+
];
|
|
20
28
|
const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
|
|
21
29
|
const OPTIMIZABLE_ENTRY_RE = /\.(?:m?js|ts)$/;
|
|
22
30
|
const SPECIAL_QUERY_RE = /[\?&](?:worker|sharedworker|raw|url)\b/;
|
|
@@ -48,11 +56,17 @@ const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
|
|
|
48
56
|
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
|
49
57
|
// ** READ THIS ** before editing `KNOWN_ASSET_TYPES`.
|
|
50
58
|
// 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
|
|
59
|
+
// to the TypeScript declaration file `packages/vite/client.d.ts` and
|
|
60
|
+
// add a mime type to the `registerCustomMime` in
|
|
61
|
+
// `packages/vite/src/node/plugin/assets.ts` if mime type cannot be
|
|
62
|
+
// looked up by mrmime.
|
|
52
63
|
const KNOWN_ASSET_TYPES = [
|
|
53
64
|
// images
|
|
54
65
|
'png',
|
|
55
66
|
'jpe?g',
|
|
67
|
+
'jfif',
|
|
68
|
+
'pjpeg',
|
|
69
|
+
'pjp',
|
|
56
70
|
'gif',
|
|
57
71
|
'svg',
|
|
58
72
|
'ico',
|
|
@@ -78,5 +92,16 @@ const KNOWN_ASSET_TYPES = [
|
|
|
78
92
|
];
|
|
79
93
|
const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
|
|
80
94
|
const DEP_VERSION_RE = /[\?&](v=[\w\.-]+)\b/;
|
|
95
|
+
const loopbackHosts = new Set([
|
|
96
|
+
'localhost',
|
|
97
|
+
'127.0.0.1',
|
|
98
|
+
'::1',
|
|
99
|
+
'0000:0000:0000:0000:0000:0000:0000:0001'
|
|
100
|
+
]);
|
|
101
|
+
const wildcardHosts = new Set([
|
|
102
|
+
'0.0.0.0',
|
|
103
|
+
'::',
|
|
104
|
+
'0000:0000:0000:0000:0000:0000:0000:0000'
|
|
105
|
+
]);
|
|
81
106
|
|
|
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 };
|
|
107
|
+
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, 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 {
|
|
@@ -1190,6 +1248,33 @@ export declare interface KnownAsTypeMap {
|
|
|
1190
1248
|
worker: Worker
|
|
1191
1249
|
}
|
|
1192
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
|
+
|
|
1193
1278
|
export declare type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife';
|
|
1194
1279
|
|
|
1195
1280
|
export declare interface LibraryOptions {
|
|
@@ -1289,7 +1374,7 @@ export declare class ModuleGraph {
|
|
|
1289
1374
|
* If there are dependencies that no longer have any importers, they are
|
|
1290
1375
|
* returned as a Set.
|
|
1291
1376
|
*/
|
|
1292
|
-
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>;
|
|
1293
1378
|
ensureEntryFromUrl(rawUrl: string, ssr?: boolean): Promise<ModuleNode>;
|
|
1294
1379
|
createFileOnlyEntry(file: string): ModuleNode;
|
|
1295
1380
|
resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
|
|
@@ -1311,6 +1396,8 @@ export declare class ModuleNode {
|
|
|
1311
1396
|
importers: Set<ModuleNode>;
|
|
1312
1397
|
importedModules: Set<ModuleNode>;
|
|
1313
1398
|
acceptedHmrDeps: Set<ModuleNode>;
|
|
1399
|
+
acceptedHmrExports: Set<string> | null;
|
|
1400
|
+
importedBindings: Map<string, Set<string>> | null;
|
|
1314
1401
|
isSelfAccepting?: boolean;
|
|
1315
1402
|
transformResult: TransformResult | null;
|
|
1316
1403
|
ssrTransformResult: TransformResult | null;
|
|
@@ -1476,17 +1563,18 @@ declare interface Plugin_2 extends Plugin_3 {
|
|
|
1476
1563
|
/**
|
|
1477
1564
|
* extend hooks with ssr flag
|
|
1478
1565
|
*/
|
|
1479
|
-
resolveId
|
|
1566
|
+
resolveId?: (this: PluginContext, source: string, importer: string | undefined, options: {
|
|
1480
1567
|
custom?: CustomPluginOptions;
|
|
1481
1568
|
ssr?: boolean;
|
|
1482
1569
|
/* Excluded from this release type: scan */
|
|
1483
|
-
|
|
1484
|
-
|
|
1570
|
+
isEntry: boolean;
|
|
1571
|
+
}) => Promise<ResolveIdResult> | ResolveIdResult;
|
|
1572
|
+
load?: (this: PluginContext, id: string, options?: {
|
|
1485
1573
|
ssr?: boolean;
|
|
1486
|
-
})
|
|
1487
|
-
transform
|
|
1574
|
+
}) => Promise<LoadResult> | LoadResult;
|
|
1575
|
+
transform?: (this: TransformPluginContext, code: string, id: string, options?: {
|
|
1488
1576
|
ssr?: boolean;
|
|
1489
|
-
})
|
|
1577
|
+
}) => Promise<TransformResult_2> | TransformResult_2;
|
|
1490
1578
|
}
|
|
1491
1579
|
export { Plugin_2 as Plugin }
|
|
1492
1580
|
|
|
@@ -1498,6 +1586,7 @@ export declare interface PluginContainer {
|
|
|
1498
1586
|
skip?: Set<Plugin_2>;
|
|
1499
1587
|
ssr?: boolean;
|
|
1500
1588
|
/* Excluded from this release type: scan */
|
|
1589
|
+
isEntry?: boolean;
|
|
1501
1590
|
}): Promise<PartialResolvedId | null>;
|
|
1502
1591
|
transform(code: string, id: string, options?: {
|
|
1503
1592
|
inMap?: SourceDescription['map'];
|
|
@@ -1509,7 +1598,7 @@ export declare interface PluginContainer {
|
|
|
1509
1598
|
close(): Promise<void>;
|
|
1510
1599
|
}
|
|
1511
1600
|
|
|
1512
|
-
export declare type PluginOption = Plugin_2 | false | null | undefined | PluginOption[]
|
|
1601
|
+
export declare type PluginOption = Plugin_2 | false | null | undefined | PluginOption[] | Promise<Plugin_2 | false | null | undefined | PluginOption[]>;
|
|
1513
1602
|
|
|
1514
1603
|
/**
|
|
1515
1604
|
* Starts the Vite server in preview mode, to simulate a production deployment
|
|
@@ -1531,7 +1620,7 @@ export declare interface PreviewServer {
|
|
|
1531
1620
|
/**
|
|
1532
1621
|
* Print server urls
|
|
1533
1622
|
*/
|
|
1534
|
-
printUrls: () => void
|
|
1623
|
+
printUrls: () => Promise<void>;
|
|
1535
1624
|
}
|
|
1536
1625
|
|
|
1537
1626
|
export declare type PreviewServerHook = (server: {
|
|
@@ -1559,8 +1648,19 @@ export declare interface PrunePayload {
|
|
|
1559
1648
|
paths: string[]
|
|
1560
1649
|
}
|
|
1561
1650
|
|
|
1651
|
+
/**
|
|
1652
|
+
* Resolve base url. Note that some users use Vite to build for non-web targets like
|
|
1653
|
+
* electron or expects to deploy
|
|
1654
|
+
*/
|
|
1655
|
+
export declare function resolveBaseUrl(base: string | undefined, isBuild: boolean, logger: Logger, optionName: string): string;
|
|
1656
|
+
|
|
1562
1657
|
export declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string): Promise<ResolvedConfig>;
|
|
1563
1658
|
|
|
1659
|
+
export declare type ResolvedBuildAdvancedBaseConfig = BuildAdvancedBaseOptions & {
|
|
1660
|
+
assets: BuildAdvancedBaseOptions;
|
|
1661
|
+
public: BuildAdvancedBaseOptions;
|
|
1662
|
+
};
|
|
1663
|
+
|
|
1564
1664
|
export declare type ResolvedBuildOptions = Required<BuildOptions>;
|
|
1565
1665
|
|
|
1566
1666
|
export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'assetsInclude' | 'optimizeDeps' | 'worker'> & {
|
|
@@ -1584,20 +1684,32 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
|
|
|
1584
1684
|
server: ResolvedServerOptions;
|
|
1585
1685
|
build: ResolvedBuildOptions;
|
|
1586
1686
|
preview: ResolvedPreviewOptions;
|
|
1687
|
+
ssr: ResolvedSSROptions | undefined;
|
|
1587
1688
|
assetsInclude: (file: string) => boolean;
|
|
1588
1689
|
logger: Logger;
|
|
1589
1690
|
createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
|
|
1590
1691
|
optimizeDeps: DepOptimizationOptions;
|
|
1591
1692
|
/* Excluded from this release type: packageCache */
|
|
1592
1693
|
worker: ResolveWorkerOptions;
|
|
1593
|
-
|
|
1694
|
+
appType: AppType;
|
|
1695
|
+
experimental: ResolvedExperimentalOptions;
|
|
1594
1696
|
}>;
|
|
1595
1697
|
|
|
1698
|
+
export declare type ResolvedExperimentalOptions = Required<ExperimentalOptions> & {
|
|
1699
|
+
buildAdvancedBaseOptions: ResolvedBuildAdvancedBaseConfig;
|
|
1700
|
+
};
|
|
1701
|
+
|
|
1596
1702
|
export declare interface ResolvedPreviewOptions extends PreviewOptions {
|
|
1597
1703
|
}
|
|
1598
1704
|
|
|
1599
1705
|
export declare interface ResolvedServerOptions extends ServerOptions {
|
|
1600
1706
|
fs: Required<FileSystemServeOptions>;
|
|
1707
|
+
middlewareMode: boolean;
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
export declare interface ResolvedSSROptions extends SSROptions {
|
|
1711
|
+
target: SSRTarget;
|
|
1712
|
+
format: SSRFormat;
|
|
1601
1713
|
}
|
|
1602
1714
|
|
|
1603
1715
|
export declare type ResolvedUrl = [
|
|
@@ -1836,6 +1948,8 @@ export declare interface RollupDynamicImportVarsOptions {
|
|
|
1836
1948
|
warnOnError?: boolean
|
|
1837
1949
|
}
|
|
1838
1950
|
|
|
1951
|
+
export { rollupVersion }
|
|
1952
|
+
|
|
1839
1953
|
/**
|
|
1840
1954
|
* Search up for the nearest workspace root
|
|
1841
1955
|
*/
|
|
@@ -2204,11 +2318,6 @@ export declare interface UserConfig {
|
|
|
2204
2318
|
* Preview specific options, e.g. host, port, https...
|
|
2205
2319
|
*/
|
|
2206
2320
|
preview?: PreviewOptions;
|
|
2207
|
-
/**
|
|
2208
|
-
* Force dep pre-optimization regardless of whether deps have changed.
|
|
2209
|
-
* @experimental
|
|
2210
|
-
*/
|
|
2211
|
-
force?: boolean;
|
|
2212
2321
|
/**
|
|
2213
2322
|
* Dep optimization options
|
|
2214
2323
|
*/
|
|
@@ -2220,11 +2329,18 @@ export declare interface UserConfig {
|
|
|
2220
2329
|
/**
|
|
2221
2330
|
* Experimental features
|
|
2222
2331
|
*
|
|
2223
|
-
* Features under this field
|
|
2332
|
+
* Features under this field could change in the future and might NOT follow semver.
|
|
2224
2333
|
* Please be careful and always pin Vite's version when using them.
|
|
2225
2334
|
* @experimental
|
|
2226
2335
|
*/
|
|
2227
2336
|
experimental?: ExperimentalOptions;
|
|
2337
|
+
/**
|
|
2338
|
+
* Legacy options
|
|
2339
|
+
*
|
|
2340
|
+
* Features under this field only follow semver for patches, they could be removed in a
|
|
2341
|
+
* future minor version. Please always pin Vite's version to a minor when using them.
|
|
2342
|
+
*/
|
|
2343
|
+
legacy?: LegacyOptions;
|
|
2228
2344
|
/**
|
|
2229
2345
|
* Log level.
|
|
2230
2346
|
* Default: 'info'
|
|
@@ -2268,17 +2384,20 @@ export declare interface UserConfig {
|
|
|
2268
2384
|
rollupOptions?: Omit<RollupOptions, 'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures'>;
|
|
2269
2385
|
};
|
|
2270
2386
|
/**
|
|
2271
|
-
* Whether your application is a Single Page Application (SPA)
|
|
2272
|
-
*
|
|
2273
|
-
*
|
|
2387
|
+
* Whether your application is a Single Page Application (SPA),
|
|
2388
|
+
* a Multi-Page Application (MPA), or Custom Application (SSR
|
|
2389
|
+
* and frameworks with custom HTML handling)
|
|
2390
|
+
* @default 'spa'
|
|
2274
2391
|
*/
|
|
2275
|
-
|
|
2392
|
+
appType?: AppType;
|
|
2276
2393
|
}
|
|
2277
2394
|
|
|
2278
2395
|
export declare type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFn;
|
|
2279
2396
|
|
|
2280
2397
|
export declare type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
|
|
2281
2398
|
|
|
2399
|
+
export declare const version: string;
|
|
2400
|
+
|
|
2282
2401
|
export declare interface ViteDevServer {
|
|
2283
2402
|
/**
|
|
2284
2403
|
* The resolved vite config object
|
|
@@ -2354,7 +2473,7 @@ export declare interface ViteDevServer {
|
|
|
2354
2473
|
/**
|
|
2355
2474
|
* Print server urls
|
|
2356
2475
|
*/
|
|
2357
|
-
printUrls(): void
|
|
2476
|
+
printUrls(): Promise<void>;
|
|
2358
2477
|
/**
|
|
2359
2478
|
* Restart the server.
|
|
2360
2479
|
*
|
package/dist/node/index.js
CHANGED
|
@@ -1,29 +1,42 @@
|
|
|
1
|
-
export { b as build, j as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, i as isDepsOptimizerEnabled, l as loadConfigFromFile,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
1
|
+
export { b as build, j as createFilter, q as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, i as isDepsOptimizerEnabled, l as loadConfigFromFile, v as loadEnv, h as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, w as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, u as searchForWorkspaceRoot, k as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-7c996900.js';
|
|
2
|
+
export { VERSION as version } from './constants.js';
|
|
3
|
+
export { version as esbuildVersion } from 'esbuild';
|
|
4
|
+
export { VERSION as rollupVersion } from 'rollup';
|
|
5
|
+
import 'node:fs';
|
|
6
|
+
import 'node:path';
|
|
7
|
+
import 'node:url';
|
|
8
|
+
import 'node:perf_hooks';
|
|
9
|
+
import 'node:module';
|
|
7
10
|
import 'tty';
|
|
8
|
-
import '
|
|
11
|
+
import 'path';
|
|
12
|
+
import 'fs';
|
|
9
13
|
import 'events';
|
|
10
14
|
import 'assert';
|
|
11
15
|
import 'resolve';
|
|
12
16
|
import 'util';
|
|
13
17
|
import 'net';
|
|
18
|
+
import 'url';
|
|
14
19
|
import 'http';
|
|
15
20
|
import 'stream';
|
|
16
21
|
import 'os';
|
|
17
22
|
import 'child_process';
|
|
23
|
+
import 'node:os';
|
|
24
|
+
import 'node:crypto';
|
|
25
|
+
import 'node:util';
|
|
26
|
+
import 'node:dns';
|
|
18
27
|
import 'crypto';
|
|
19
|
-
import './constants.js';
|
|
20
28
|
import 'buffer';
|
|
21
29
|
import 'querystring';
|
|
30
|
+
import 'module';
|
|
22
31
|
import 'zlib';
|
|
23
32
|
import 'https';
|
|
24
33
|
import 'tls';
|
|
34
|
+
import 'node:http';
|
|
35
|
+
import 'node:https';
|
|
25
36
|
import 'worker_threads';
|
|
26
37
|
import 'readline';
|
|
38
|
+
import 'node:child_process';
|
|
39
|
+
import 'node:zlib';
|
|
27
40
|
|
|
28
41
|
// This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
|
|
29
42
|
const cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`;
|