vite 3.0.0-alpha.9 → 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-08f2a2be.js → dep-3f55e00c.js} +21 -9
- package/dist/node/chunks/{dep-523c8a1b.js → dep-50504393.js} +4 -4
- package/dist/node/chunks/{dep-17430d09.js → dep-58d622b1.js} +5 -5
- package/dist/node/chunks/{dep-8df7bfd6.js → dep-6736a7e2.js} +14626 -13056
- package/dist/node/chunks/{dep-3165073f.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 +161 -44
- 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,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 {
|
|
@@ -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;
|
|
@@ -1509,7 +1596,7 @@ export declare interface PluginContainer {
|
|
|
1509
1596
|
close(): Promise<void>;
|
|
1510
1597
|
}
|
|
1511
1598
|
|
|
1512
|
-
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[]>;
|
|
1513
1600
|
|
|
1514
1601
|
/**
|
|
1515
1602
|
* Starts the Vite server in preview mode, to simulate a production deployment
|
|
@@ -1531,7 +1618,7 @@ export declare interface PreviewServer {
|
|
|
1531
1618
|
/**
|
|
1532
1619
|
* Print server urls
|
|
1533
1620
|
*/
|
|
1534
|
-
printUrls: () => void
|
|
1621
|
+
printUrls: () => Promise<void>;
|
|
1535
1622
|
}
|
|
1536
1623
|
|
|
1537
1624
|
export declare type PreviewServerHook = (server: {
|
|
@@ -1559,8 +1646,19 @@ export declare interface PrunePayload {
|
|
|
1559
1646
|
paths: string[]
|
|
1560
1647
|
}
|
|
1561
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
|
+
|
|
1562
1655
|
export declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string): Promise<ResolvedConfig>;
|
|
1563
1656
|
|
|
1657
|
+
export declare type ResolvedBuildAdvancedBaseConfig = BuildAdvancedBaseOptions & {
|
|
1658
|
+
assets: BuildAdvancedBaseOptions;
|
|
1659
|
+
public: BuildAdvancedBaseOptions;
|
|
1660
|
+
};
|
|
1661
|
+
|
|
1564
1662
|
export declare type ResolvedBuildOptions = Required<BuildOptions>;
|
|
1565
1663
|
|
|
1566
1664
|
export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'assetsInclude' | 'optimizeDeps' | 'worker'> & {
|
|
@@ -1584,20 +1682,32 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
|
|
|
1584
1682
|
server: ResolvedServerOptions;
|
|
1585
1683
|
build: ResolvedBuildOptions;
|
|
1586
1684
|
preview: ResolvedPreviewOptions;
|
|
1685
|
+
ssr: ResolvedSSROptions | undefined;
|
|
1587
1686
|
assetsInclude: (file: string) => boolean;
|
|
1588
1687
|
logger: Logger;
|
|
1589
1688
|
createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
|
|
1590
1689
|
optimizeDeps: DepOptimizationOptions;
|
|
1591
1690
|
/* Excluded from this release type: packageCache */
|
|
1592
1691
|
worker: ResolveWorkerOptions;
|
|
1593
|
-
|
|
1692
|
+
appType: AppType;
|
|
1693
|
+
experimental: ResolvedExperimentalOptions;
|
|
1594
1694
|
}>;
|
|
1595
1695
|
|
|
1696
|
+
export declare type ResolvedExperimentalOptions = Required<ExperimentalOptions> & {
|
|
1697
|
+
buildAdvancedBaseOptions: ResolvedBuildAdvancedBaseConfig;
|
|
1698
|
+
};
|
|
1699
|
+
|
|
1596
1700
|
export declare interface ResolvedPreviewOptions extends PreviewOptions {
|
|
1597
1701
|
}
|
|
1598
1702
|
|
|
1599
1703
|
export declare interface ResolvedServerOptions extends ServerOptions {
|
|
1600
1704
|
fs: Required<FileSystemServeOptions>;
|
|
1705
|
+
middlewareMode: boolean;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
export declare interface ResolvedSSROptions extends SSROptions {
|
|
1709
|
+
target: SSRTarget;
|
|
1710
|
+
format: SSRFormat;
|
|
1601
1711
|
}
|
|
1602
1712
|
|
|
1603
1713
|
export declare type ResolvedUrl = [
|
|
@@ -1836,6 +1946,8 @@ export declare interface RollupDynamicImportVarsOptions {
|
|
|
1836
1946
|
warnOnError?: boolean
|
|
1837
1947
|
}
|
|
1838
1948
|
|
|
1949
|
+
export { rollupVersion }
|
|
1950
|
+
|
|
1839
1951
|
/**
|
|
1840
1952
|
* Search up for the nearest workspace root
|
|
1841
1953
|
*/
|
|
@@ -2204,11 +2316,6 @@ export declare interface UserConfig {
|
|
|
2204
2316
|
* Preview specific options, e.g. host, port, https...
|
|
2205
2317
|
*/
|
|
2206
2318
|
preview?: PreviewOptions;
|
|
2207
|
-
/**
|
|
2208
|
-
* Force dep pre-optimization regardless of whether deps have changed.
|
|
2209
|
-
* @experimental
|
|
2210
|
-
*/
|
|
2211
|
-
force?: boolean;
|
|
2212
2319
|
/**
|
|
2213
2320
|
* Dep optimization options
|
|
2214
2321
|
*/
|
|
@@ -2220,11 +2327,18 @@ export declare interface UserConfig {
|
|
|
2220
2327
|
/**
|
|
2221
2328
|
* Experimental features
|
|
2222
2329
|
*
|
|
2223
|
-
* Features under this field
|
|
2330
|
+
* Features under this field could change in the future and might NOT follow semver.
|
|
2224
2331
|
* Please be careful and always pin Vite's version when using them.
|
|
2225
2332
|
* @experimental
|
|
2226
2333
|
*/
|
|
2227
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;
|
|
2228
2342
|
/**
|
|
2229
2343
|
* Log level.
|
|
2230
2344
|
* Default: 'info'
|
|
@@ -2268,17 +2382,20 @@ export declare interface UserConfig {
|
|
|
2268
2382
|
rollupOptions?: Omit<RollupOptions, 'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures'>;
|
|
2269
2383
|
};
|
|
2270
2384
|
/**
|
|
2271
|
-
* Whether your application is a Single Page Application (SPA)
|
|
2272
|
-
*
|
|
2273
|
-
*
|
|
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'
|
|
2274
2389
|
*/
|
|
2275
|
-
|
|
2390
|
+
appType?: AppType;
|
|
2276
2391
|
}
|
|
2277
2392
|
|
|
2278
2393
|
export declare type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFn;
|
|
2279
2394
|
|
|
2280
2395
|
export declare type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
|
|
2281
2396
|
|
|
2397
|
+
export declare const version: string;
|
|
2398
|
+
|
|
2282
2399
|
export declare interface ViteDevServer {
|
|
2283
2400
|
/**
|
|
2284
2401
|
* The resolved vite config object
|
|
@@ -2354,7 +2471,7 @@ export declare interface ViteDevServer {
|
|
|
2354
2471
|
/**
|
|
2355
2472
|
* Print server urls
|
|
2356
2473
|
*/
|
|
2357
|
-
printUrls(): void
|
|
2474
|
+
printUrls(): Promise<void>;
|
|
2358
2475
|
/**
|
|
2359
2476
|
* Restart the server.
|
|
2360
2477
|
*
|
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-6736a7e2.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)($|\\?)`;
|