vite 3.0.0-alpha.0 → 3.0.0-alpha.11
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 +26 -4
- package/bin/vite.js +5 -5
- package/client.d.ts +16 -2
- package/dist/client/client.mjs +34 -20
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-a9015192.js → dep-17430d09.js} +20 -20
- package/dist/node/chunks/{dep-fafc4143.js → dep-46501b7a.js} +38000 -36456
- package/dist/node/chunks/{dep-2d9eaf08.js → dep-4e458630.js} +27 -29
- package/dist/node/chunks/{dep-63fe0f22.js → dep-d6e255b8.js} +111 -52
- package/dist/node/chunks/{dep-2056ae8a.js → dep-e8ca8d40.js} +9 -3
- package/dist/node/chunks/{dep-dfbd0b0c.js → dep-fb927717.js} +41 -37
- package/dist/node/cli.js +46 -48
- package/dist/node/constants.js +99 -0
- package/dist/node/index.d.ts +108 -17
- package/dist/node/index.js +38 -60
- package/dist/node-cjs/publicUtils.cjs +4174 -0
- package/index.cjs +33 -0
- package/package.json +48 -29
- package/src/client/client.ts +34 -17
- package/src/client/tsconfig.json +1 -1
- package/types/importGlob.d.ts +1 -3
- package/dist/node/terser.js +0 -32876
package/dist/node/cli.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { performance } from 'perf_hooks';
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { w as colors, k as createLogger, e as resolveConfig } from './chunks/dep-46501b7a.js';
|
|
4
|
+
import { VERSION } from './constants.js';
|
|
5
|
+
import 'fs';
|
|
6
|
+
import 'path';
|
|
7
|
+
import 'url';
|
|
8
|
+
import 'module';
|
|
9
|
+
import 'tty';
|
|
10
|
+
import 'esbuild';
|
|
11
|
+
import 'assert';
|
|
12
|
+
import 'resolve';
|
|
13
|
+
import 'util';
|
|
14
|
+
import 'net';
|
|
15
|
+
import 'http';
|
|
16
|
+
import 'stream';
|
|
17
|
+
import 'os';
|
|
18
|
+
import 'child_process';
|
|
19
|
+
import 'dns';
|
|
20
|
+
import 'crypto';
|
|
21
|
+
import 'buffer';
|
|
22
|
+
import 'querystring';
|
|
23
|
+
import 'zlib';
|
|
24
|
+
import 'https';
|
|
25
|
+
import 'tls';
|
|
26
|
+
import 'worker_threads';
|
|
27
|
+
import 'readline';
|
|
28
28
|
|
|
29
29
|
function toArr(any) {
|
|
30
30
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -449,7 +449,7 @@ class GlobalCommand extends Command {
|
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
var __assign = Object.assign;
|
|
452
|
-
class CAC extends
|
|
452
|
+
class CAC extends EventEmitter {
|
|
453
453
|
constructor(name = "") {
|
|
454
454
|
super();
|
|
455
455
|
this.name = name;
|
|
@@ -683,7 +683,7 @@ cli
|
|
|
683
683
|
.action(async (root, options) => {
|
|
684
684
|
// output structure is preserved even after bundling so require()
|
|
685
685
|
// is ok here
|
|
686
|
-
const { createServer } = await
|
|
686
|
+
const { createServer } = await import('./chunks/dep-46501b7a.js').then(function (n) { return n.C; });
|
|
687
687
|
try {
|
|
688
688
|
const server = await createServer({
|
|
689
689
|
root,
|
|
@@ -699,20 +699,16 @@ cli
|
|
|
699
699
|
}
|
|
700
700
|
await server.listen();
|
|
701
701
|
const info = server.config.logger.info;
|
|
702
|
-
info(index.colors.cyan(`\n vite v${require('vite/package.json').version}`) +
|
|
703
|
-
index.colors.green(` dev server running at:\n`), {
|
|
704
|
-
clear: !server.config.logger.hasWarned
|
|
705
|
-
});
|
|
706
|
-
server.printUrls();
|
|
707
702
|
// @ts-ignore
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
}
|
|
703
|
+
const viteStartTime = global.__vite_start_time ?? false;
|
|
704
|
+
const startupDurationString = viteStartTime
|
|
705
|
+
? colors.dim(`ready in ${colors.white(colors.bold(Math.ceil(performance.now() - viteStartTime)))} ms`)
|
|
706
|
+
: '';
|
|
707
|
+
info(`\n ${colors.green(`${colors.bold('VITE')} v${VERSION}`)} ${startupDurationString}\n`, { clear: !server.config.logger.hasWarned });
|
|
708
|
+
server.printUrls();
|
|
713
709
|
}
|
|
714
710
|
catch (e) {
|
|
715
|
-
|
|
711
|
+
createLogger(options.logLevel).error(colors.red(`error when starting dev server:\n${e.stack}`), { error: e });
|
|
716
712
|
process.exit(1);
|
|
717
713
|
}
|
|
718
714
|
});
|
|
@@ -729,10 +725,11 @@ cli
|
|
|
729
725
|
`or specify minifier to use (default: esbuild)`)
|
|
730
726
|
.option('--manifest [name]', `[boolean | string] emit build manifest json`)
|
|
731
727
|
.option('--ssrManifest [name]', `[boolean | string] emit ssr manifest json`)
|
|
728
|
+
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle (experimental)`)
|
|
732
729
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
733
730
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
734
731
|
.action(async (root, options) => {
|
|
735
|
-
const { build } = await
|
|
732
|
+
const { build } = await import('./chunks/dep-46501b7a.js').then(function (n) { return n.B; });
|
|
736
733
|
const buildOptions = cleanOptions(options);
|
|
737
734
|
try {
|
|
738
735
|
await build({
|
|
@@ -742,11 +739,12 @@ cli
|
|
|
742
739
|
configFile: options.config,
|
|
743
740
|
logLevel: options.logLevel,
|
|
744
741
|
clearScreen: options.clearScreen,
|
|
742
|
+
force: options.force,
|
|
745
743
|
build: buildOptions
|
|
746
744
|
});
|
|
747
745
|
}
|
|
748
746
|
catch (e) {
|
|
749
|
-
|
|
747
|
+
createLogger(options.logLevel).error(colors.red(`error during build:\n${e.stack}`), { error: e });
|
|
750
748
|
process.exit(1);
|
|
751
749
|
}
|
|
752
750
|
});
|
|
@@ -755,9 +753,9 @@ cli
|
|
|
755
753
|
.command('optimize [root]', 'pre-bundle dependencies')
|
|
756
754
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
757
755
|
.action(async (root, options) => {
|
|
758
|
-
const { optimizeDeps } = await
|
|
756
|
+
const { optimizeDeps } = await import('./chunks/dep-46501b7a.js').then(function (n) { return n.A; });
|
|
759
757
|
try {
|
|
760
|
-
const config = await
|
|
758
|
+
const config = await resolveConfig({
|
|
761
759
|
root,
|
|
762
760
|
base: options.base,
|
|
763
761
|
configFile: options.config,
|
|
@@ -766,7 +764,7 @@ cli
|
|
|
766
764
|
await optimizeDeps(config, options.force, true);
|
|
767
765
|
}
|
|
768
766
|
catch (e) {
|
|
769
|
-
|
|
767
|
+
createLogger(options.logLevel).error(colors.red(`error when optimizing deps:\n${e.stack}`), { error: e });
|
|
770
768
|
process.exit(1);
|
|
771
769
|
}
|
|
772
770
|
});
|
|
@@ -778,7 +776,7 @@ cli
|
|
|
778
776
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
779
777
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
780
778
|
.action(async (root, options) => {
|
|
781
|
-
const { preview } = await
|
|
779
|
+
const { preview } = await import('./chunks/dep-46501b7a.js').then(function (n) { return n.D; });
|
|
782
780
|
try {
|
|
783
781
|
const server = await preview({
|
|
784
782
|
root,
|
|
@@ -797,10 +795,10 @@ cli
|
|
|
797
795
|
server.printUrls();
|
|
798
796
|
}
|
|
799
797
|
catch (e) {
|
|
800
|
-
|
|
798
|
+
createLogger(options.logLevel).error(colors.red(`error when starting preview server:\n${e.stack}`), { error: e });
|
|
801
799
|
process.exit(1);
|
|
802
800
|
}
|
|
803
801
|
});
|
|
804
802
|
cli.help();
|
|
805
|
-
cli.version(
|
|
803
|
+
cli.version(VERSION);
|
|
806
804
|
cli.parse();
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import path, { resolve } from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
|
|
4
|
+
var version = "3.0.0-alpha.11";
|
|
5
|
+
|
|
6
|
+
const VERSION = version;
|
|
7
|
+
const DEFAULT_MAIN_FIELDS = [
|
|
8
|
+
'module',
|
|
9
|
+
'jsnext:main',
|
|
10
|
+
'jsnext'
|
|
11
|
+
];
|
|
12
|
+
const DEFAULT_EXTENSIONS = [
|
|
13
|
+
'.mjs',
|
|
14
|
+
'.js',
|
|
15
|
+
'.ts',
|
|
16
|
+
'.jsx',
|
|
17
|
+
'.tsx',
|
|
18
|
+
'.json'
|
|
19
|
+
];
|
|
20
|
+
const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
|
|
21
|
+
const OPTIMIZABLE_ENTRY_RE = /\.(?:m?js|ts)$/;
|
|
22
|
+
const SPECIAL_QUERY_RE = /[\?&](?:worker|sharedworker|raw|url)\b/;
|
|
23
|
+
/**
|
|
24
|
+
* Prefix for resolved fs paths, since windows paths may not be valid as URLs.
|
|
25
|
+
*/
|
|
26
|
+
const FS_PREFIX = `/@fs/`;
|
|
27
|
+
/**
|
|
28
|
+
* Prefix for resolved Ids that are not valid browser import specifiers
|
|
29
|
+
*/
|
|
30
|
+
const VALID_ID_PREFIX = `/@id/`;
|
|
31
|
+
/**
|
|
32
|
+
* Plugins that use 'virtual modules' (e.g. for helper functions), prefix the
|
|
33
|
+
* module ID with `\0`, a convention from the rollup ecosystem.
|
|
34
|
+
* This prevents other plugins from trying to process the id (like node resolution),
|
|
35
|
+
* and core features like sourcemaps can use this info to differentiate between
|
|
36
|
+
* virtual modules and regular files.
|
|
37
|
+
* `\0` is not a permitted char in import URLs so we have to replace them during
|
|
38
|
+
* import analysis. The id will be decoded back before entering the plugins pipeline.
|
|
39
|
+
* These encoded virtual ids are also prefixed by the VALID_ID_PREFIX, so virtual
|
|
40
|
+
* modules in the browser end up encoded as `/@id/__x00__{id}`
|
|
41
|
+
*/
|
|
42
|
+
const NULL_BYTE_PLACEHOLDER = `__x00__`;
|
|
43
|
+
const CLIENT_PUBLIC_PATH = `/@vite/client`;
|
|
44
|
+
const ENV_PUBLIC_PATH = `/@vite/env`;
|
|
45
|
+
const VITE_PACKAGE_DIR = resolve(fileURLToPath(import.meta.url), '../../..');
|
|
46
|
+
const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
|
|
47
|
+
const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
|
|
48
|
+
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
|
49
|
+
// ** READ THIS ** before editing `KNOWN_ASSET_TYPES`.
|
|
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` 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.
|
|
55
|
+
const KNOWN_ASSET_TYPES = [
|
|
56
|
+
// images
|
|
57
|
+
'png',
|
|
58
|
+
'jpe?g',
|
|
59
|
+
'jfif',
|
|
60
|
+
'pjpeg',
|
|
61
|
+
'pjp',
|
|
62
|
+
'gif',
|
|
63
|
+
'svg',
|
|
64
|
+
'ico',
|
|
65
|
+
'webp',
|
|
66
|
+
'avif',
|
|
67
|
+
// media
|
|
68
|
+
'mp4',
|
|
69
|
+
'webm',
|
|
70
|
+
'ogg',
|
|
71
|
+
'mp3',
|
|
72
|
+
'wav',
|
|
73
|
+
'flac',
|
|
74
|
+
'aac',
|
|
75
|
+
// fonts
|
|
76
|
+
'woff2?',
|
|
77
|
+
'eot',
|
|
78
|
+
'ttf',
|
|
79
|
+
'otf',
|
|
80
|
+
// other
|
|
81
|
+
'webmanifest',
|
|
82
|
+
'pdf',
|
|
83
|
+
'txt'
|
|
84
|
+
];
|
|
85
|
+
const DEFAULT_ASSETS_RE = new RegExp(`\\.(` + KNOWN_ASSET_TYPES.join('|') + `)(\\?.*)?$`);
|
|
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
|
+
]);
|
|
98
|
+
|
|
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
|
@@ -47,7 +47,6 @@ import type { TransformResult as TransformResult_3 } from 'esbuild';
|
|
|
47
47
|
import type * as url from 'url';
|
|
48
48
|
import type { URL as URL_2 } from 'url';
|
|
49
49
|
import type { WatcherOptions } from 'rollup';
|
|
50
|
-
import type { Worker as Worker_2 } from 'okie';
|
|
51
50
|
import type { ZlibOptions } from 'zlib';
|
|
52
51
|
|
|
53
52
|
export declare interface Alias {
|
|
@@ -438,6 +437,10 @@ export declare interface CorsOptions {
|
|
|
438
437
|
|
|
439
438
|
export declare type CorsOrigin = boolean | string | RegExp | (string | RegExp)[];
|
|
440
439
|
|
|
440
|
+
export declare const createFilter: (include?: FilterPattern | undefined, exclude?: FilterPattern | undefined, options?: {
|
|
441
|
+
resolve?: string | false | null | undefined;
|
|
442
|
+
} | undefined) => (id: string | unknown) => boolean;
|
|
443
|
+
|
|
441
444
|
export declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
|
|
442
445
|
|
|
443
446
|
export declare function createServer(inlineConfig?: InlineConfig): Promise<ViteDevServer>;
|
|
@@ -534,6 +537,13 @@ export declare interface DepOptimizationOptions {
|
|
|
534
537
|
* vite project root. This will overwrite default entries inference.
|
|
535
538
|
*/
|
|
536
539
|
entries?: string | string[];
|
|
540
|
+
/**
|
|
541
|
+
* Enable esbuild based scan phase, to get back to the optimized deps discovery
|
|
542
|
+
* strategy used in Vite v2
|
|
543
|
+
* @default false
|
|
544
|
+
* @experimental
|
|
545
|
+
*/
|
|
546
|
+
devScan?: boolean;
|
|
537
547
|
/**
|
|
538
548
|
* Force optimize listed dependencies (must be resolvable import paths,
|
|
539
549
|
* cannot be globs).
|
|
@@ -544,6 +554,12 @@ export declare interface DepOptimizationOptions {
|
|
|
544
554
|
* cannot be globs).
|
|
545
555
|
*/
|
|
546
556
|
exclude?: string[];
|
|
557
|
+
/**
|
|
558
|
+
* Force ESM interop when importing for these dependencies. Some legacy
|
|
559
|
+
* packages advertise themselves as ESM but use `require` internally
|
|
560
|
+
* @experimental
|
|
561
|
+
*/
|
|
562
|
+
needsInterop?: string[];
|
|
547
563
|
/**
|
|
548
564
|
* Options to pass to esbuild during the dep scanning and optimization
|
|
549
565
|
*
|
|
@@ -567,11 +583,13 @@ export declare interface DepOptimizationOptions {
|
|
|
567
583
|
*/
|
|
568
584
|
extensions?: string[];
|
|
569
585
|
/**
|
|
570
|
-
* Disables dependencies optimizations
|
|
586
|
+
* Disables dependencies optimizations, true disables the optimizer during
|
|
587
|
+
* build and dev. Pass 'build' or 'dev' to only disable the optimizer in
|
|
588
|
+
* one of the modes. Deps optimization is enabled by default in both
|
|
571
589
|
* @default false
|
|
572
590
|
* @experimental
|
|
573
591
|
*/
|
|
574
|
-
disabled?: boolean;
|
|
592
|
+
disabled?: boolean | 'build' | 'dev';
|
|
575
593
|
}
|
|
576
594
|
|
|
577
595
|
export declare interface DepOptimizationProcessing {
|
|
@@ -590,6 +608,20 @@ export declare interface DepOptimizationResult {
|
|
|
590
608
|
cancel: () => void;
|
|
591
609
|
}
|
|
592
610
|
|
|
611
|
+
export declare interface DepsOptimizer {
|
|
612
|
+
metadata: DepOptimizationMetadata;
|
|
613
|
+
scanProcessing?: Promise<void>;
|
|
614
|
+
registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
|
|
615
|
+
run: () => void;
|
|
616
|
+
isOptimizedDepFile: (id: string) => boolean;
|
|
617
|
+
isOptimizedDepUrl: (url: string) => boolean;
|
|
618
|
+
getOptimizedDepId: (depInfo: OptimizedDepInfo) => string;
|
|
619
|
+
delayDepsOptimizerUntil: (id: string, done: () => Promise<any>) => void;
|
|
620
|
+
registerWorkersSource: (id: string) => void;
|
|
621
|
+
resetRegisteredIds: () => void;
|
|
622
|
+
options: DepOptimizationOptions;
|
|
623
|
+
}
|
|
624
|
+
|
|
593
625
|
export declare interface ErrorPayload {
|
|
594
626
|
type: 'error'
|
|
595
627
|
err: {
|
|
@@ -630,6 +662,14 @@ export declare interface ExperimentalOptions {
|
|
|
630
662
|
importGlobRestoreExtension?: boolean;
|
|
631
663
|
}
|
|
632
664
|
|
|
665
|
+
export declare type ExportsData = {
|
|
666
|
+
hasImports: boolean;
|
|
667
|
+
exports: readonly string[];
|
|
668
|
+
facade: boolean;
|
|
669
|
+
hasReExports?: boolean;
|
|
670
|
+
jsxLoader?: boolean;
|
|
671
|
+
};
|
|
672
|
+
|
|
633
673
|
export declare interface FileSystemServeOptions {
|
|
634
674
|
/**
|
|
635
675
|
* Strictly restrict file accessing outside of allowing paths.
|
|
@@ -657,7 +697,12 @@ export declare interface FileSystemServeOptions {
|
|
|
657
697
|
deny?: string[];
|
|
658
698
|
}
|
|
659
699
|
|
|
660
|
-
|
|
700
|
+
/**
|
|
701
|
+
* Inlined to keep `@rollup/pluginutils` in devDependencies
|
|
702
|
+
*/
|
|
703
|
+
export declare type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
|
704
|
+
|
|
705
|
+
export declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise<ExistingRawSourceMap>;
|
|
661
706
|
|
|
662
707
|
export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
|
663
708
|
options: WatchOptions
|
|
@@ -1131,8 +1176,12 @@ export declare interface InternalResolveOptions extends ResolveOptions {
|
|
|
1131
1176
|
isFromTsImporter?: boolean;
|
|
1132
1177
|
tryEsmOnly?: boolean;
|
|
1133
1178
|
scan?: boolean;
|
|
1179
|
+
getDepsOptimizer?: () => DepsOptimizer | undefined;
|
|
1180
|
+
shouldExternalize?: (id: string) => boolean | undefined;
|
|
1134
1181
|
}
|
|
1135
1182
|
|
|
1183
|
+
export declare function isDepsOptimizerEnabled(config: ResolvedConfig): boolean;
|
|
1184
|
+
|
|
1136
1185
|
export declare interface JsonOptions {
|
|
1137
1186
|
/**
|
|
1138
1187
|
* Generate a named export for every property of the JSON object
|
|
@@ -1150,15 +1199,31 @@ export declare interface JsonOptions {
|
|
|
1150
1199
|
export declare interface KnownAsTypeMap {
|
|
1151
1200
|
raw: string
|
|
1152
1201
|
url: string
|
|
1153
|
-
worker:
|
|
1202
|
+
worker: Worker
|
|
1154
1203
|
}
|
|
1155
1204
|
|
|
1156
1205
|
export declare type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife';
|
|
1157
1206
|
|
|
1158
1207
|
export declare interface LibraryOptions {
|
|
1208
|
+
/**
|
|
1209
|
+
* Path of library entry
|
|
1210
|
+
*/
|
|
1159
1211
|
entry: string;
|
|
1212
|
+
/**
|
|
1213
|
+
* The name of the exposed global variable. Required when the `formats` option includes
|
|
1214
|
+
* `umd` or `iife`
|
|
1215
|
+
*/
|
|
1160
1216
|
name?: string;
|
|
1217
|
+
/**
|
|
1218
|
+
* Output bundle formats
|
|
1219
|
+
* @default ['es', 'umd']
|
|
1220
|
+
*/
|
|
1161
1221
|
formats?: LibraryFormats[];
|
|
1222
|
+
/**
|
|
1223
|
+
* The name of the package file output. The default file name is the name option
|
|
1224
|
+
* of the project package.json. It can also be defined as a function taking the
|
|
1225
|
+
* format as an argument.
|
|
1226
|
+
*/
|
|
1162
1227
|
fileName?: string | ((format: ModuleFormat) => string);
|
|
1163
1228
|
}
|
|
1164
1229
|
|
|
@@ -1214,6 +1279,8 @@ export declare interface ManifestChunk {
|
|
|
1214
1279
|
|
|
1215
1280
|
export declare type Matcher = AnymatchPattern | AnymatchPattern[]
|
|
1216
1281
|
|
|
1282
|
+
export declare function mergeAlias(a?: AliasOptions, b?: AliasOptions): AliasOptions | undefined;
|
|
1283
|
+
|
|
1217
1284
|
export declare function mergeConfig(defaults: Record<string, any>, overrides: Record<string, any>, isRoot?: boolean): Record<string, any>;
|
|
1218
1285
|
|
|
1219
1286
|
export declare class ModuleGraph {
|
|
@@ -1280,12 +1347,11 @@ export declare interface OptimizedDepInfo {
|
|
|
1280
1347
|
* but the bundles may not yet be saved to disk
|
|
1281
1348
|
*/
|
|
1282
1349
|
processing?: Promise<void>;
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
|
|
1350
|
+
/**
|
|
1351
|
+
* ExportData cache, discovered deps will parse the src entry to get exports
|
|
1352
|
+
* data used both to define if interop is needed and when pre-bundling
|
|
1353
|
+
*/
|
|
1354
|
+
exportsData?: Promise<ExportsData>;
|
|
1289
1355
|
}
|
|
1290
1356
|
|
|
1291
1357
|
/**
|
|
@@ -1473,7 +1539,7 @@ export declare interface PreviewServer {
|
|
|
1473
1539
|
/**
|
|
1474
1540
|
* native Node http server instance
|
|
1475
1541
|
*/
|
|
1476
|
-
httpServer: Server;
|
|
1542
|
+
httpServer: http.Server;
|
|
1477
1543
|
/**
|
|
1478
1544
|
* Print server urls
|
|
1479
1545
|
*/
|
|
@@ -1530,12 +1596,14 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
|
|
|
1530
1596
|
server: ResolvedServerOptions;
|
|
1531
1597
|
build: ResolvedBuildOptions;
|
|
1532
1598
|
preview: ResolvedPreviewOptions;
|
|
1599
|
+
ssr: ResolvedSSROptions | undefined;
|
|
1533
1600
|
assetsInclude: (file: string) => boolean;
|
|
1534
1601
|
logger: Logger;
|
|
1535
1602
|
createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
|
|
1536
1603
|
optimizeDeps: DepOptimizationOptions;
|
|
1537
1604
|
/* Excluded from this release type: packageCache */
|
|
1538
1605
|
worker: ResolveWorkerOptions;
|
|
1606
|
+
spa: boolean;
|
|
1539
1607
|
}>;
|
|
1540
1608
|
|
|
1541
1609
|
export declare interface ResolvedPreviewOptions extends PreviewOptions {
|
|
@@ -1545,6 +1613,11 @@ export declare interface ResolvedServerOptions extends ServerOptions {
|
|
|
1545
1613
|
fs: Required<FileSystemServeOptions>;
|
|
1546
1614
|
}
|
|
1547
1615
|
|
|
1616
|
+
export declare interface ResolvedSSROptions extends SSROptions {
|
|
1617
|
+
target: SSRTarget;
|
|
1618
|
+
format: SSRFormat;
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1548
1621
|
export declare type ResolvedUrl = [
|
|
1549
1622
|
url: string,
|
|
1550
1623
|
resolvedId: string,
|
|
@@ -1798,10 +1871,6 @@ export declare interface SendOptions {
|
|
|
1798
1871
|
export declare type ServerHook = (server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
1799
1872
|
|
|
1800
1873
|
export declare interface ServerOptions extends CommonServerOptions {
|
|
1801
|
-
/**
|
|
1802
|
-
* Force dep pre-optimization regardless of whether deps have changed.
|
|
1803
|
-
*/
|
|
1804
|
-
force?: boolean;
|
|
1805
1874
|
/**
|
|
1806
1875
|
* Configure HMR-specific options (port, host, path & protocol)
|
|
1807
1876
|
*/
|
|
@@ -1851,6 +1920,8 @@ export declare class SplitVendorChunkCache {
|
|
|
1851
1920
|
|
|
1852
1921
|
export declare function splitVendorChunkPlugin(): Plugin_2;
|
|
1853
1922
|
|
|
1923
|
+
export declare type SSRFormat = 'esm' | 'cjs';
|
|
1924
|
+
|
|
1854
1925
|
export declare interface SSROptions {
|
|
1855
1926
|
external?: string[];
|
|
1856
1927
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
|
@@ -1860,6 +1931,14 @@ export declare interface SSROptions {
|
|
|
1860
1931
|
* Default: 'node'
|
|
1861
1932
|
*/
|
|
1862
1933
|
target?: SSRTarget;
|
|
1934
|
+
/**
|
|
1935
|
+
* Define the format for the ssr build. Since Vite v3 the SSR build generates ESM by default.
|
|
1936
|
+
* `'cjs'` can be selected to generate a CJS build, but it isn't recommended. This option is
|
|
1937
|
+
* left marked as experimental to give users more time to update to ESM. CJS builds requires
|
|
1938
|
+
* complex externalization heuristics that aren't present in the ESM format.
|
|
1939
|
+
* @experimental
|
|
1940
|
+
*/
|
|
1941
|
+
format?: SSRFormat;
|
|
1863
1942
|
}
|
|
1864
1943
|
|
|
1865
1944
|
export declare type SSRTarget = 'node' | 'webworker';
|
|
@@ -2143,6 +2222,11 @@ export declare interface UserConfig {
|
|
|
2143
2222
|
* Preview specific options, e.g. host, port, https...
|
|
2144
2223
|
*/
|
|
2145
2224
|
preview?: PreviewOptions;
|
|
2225
|
+
/**
|
|
2226
|
+
* Force dep pre-optimization regardless of whether deps have changed.
|
|
2227
|
+
* @experimental
|
|
2228
|
+
*/
|
|
2229
|
+
force?: boolean;
|
|
2146
2230
|
/**
|
|
2147
2231
|
* Dep optimization options
|
|
2148
2232
|
*/
|
|
@@ -2201,12 +2285,20 @@ export declare interface UserConfig {
|
|
|
2201
2285
|
*/
|
|
2202
2286
|
rollupOptions?: Omit<RollupOptions, 'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures'>;
|
|
2203
2287
|
};
|
|
2288
|
+
/**
|
|
2289
|
+
* Whether your application is a Single Page Application (SPA). Set to `false`
|
|
2290
|
+
* for other kinds of apps like MPAs.
|
|
2291
|
+
* @default true
|
|
2292
|
+
*/
|
|
2293
|
+
spa?: boolean;
|
|
2204
2294
|
}
|
|
2205
2295
|
|
|
2206
2296
|
export declare type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFn;
|
|
2207
2297
|
|
|
2208
2298
|
export declare type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
|
|
2209
2299
|
|
|
2300
|
+
export declare const version: string;
|
|
2301
|
+
|
|
2210
2302
|
export declare interface ViteDevServer {
|
|
2211
2303
|
/**
|
|
2212
2304
|
* The resolved vite config object
|
|
@@ -2289,7 +2381,6 @@ export declare interface ViteDevServer {
|
|
|
2289
2381
|
* @param forceOptimize - force the optimizer to re-bundle, same as --force cli flag
|
|
2290
2382
|
*/
|
|
2291
2383
|
restart(forceOptimize?: boolean): Promise<void>;
|
|
2292
|
-
/* Excluded from this release type: _optimizedDeps */
|
|
2293
2384
|
/* Excluded from this release type: _importGlobMap */
|
|
2294
2385
|
/* Excluded from this release type: _ssrExternals */
|
|
2295
2386
|
/* Excluded from this release type: _restartPromise */
|