vite 3.0.0-beta.1 → 3.0.0-beta.10
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 +2 -340
- package/dist/client/client.mjs +11 -1
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-e8ca8d40.js → dep-07a79996.js} +121 -113
- package/dist/node/chunks/{dep-58d622b1.js → dep-41eb528c.js} +7 -7
- package/dist/node/chunks/{dep-077259ad.js → dep-7c75cb17.js} +33049 -32213
- package/dist/node/chunks/{dep-d0efd013.js → dep-af860ceb.js} +3119 -3119
- package/dist/node/chunks/dep-bc80f1d6.js +7545 -0
- package/dist/node/cli.js +13 -13
- package/dist/node/constants.js +23 -4
- package/dist/node/index.d.ts +134 -112
- package/dist/node/index.js +3 -3
- package/dist/node-cjs/publicUtils.cjs +1004 -963
- package/package.json +12 -13
- package/src/client/client.ts +16 -2
- package/src/client/tsconfig.json +0 -2
- package/dist/node/chunks/dep-35befe4f.js +0 -19615
- package/dist/node/chunks/dep-cd58a191.js +0 -7505
package/dist/node/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import {
|
|
3
|
+
import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-7c75cb17.js';
|
|
4
4
|
import { VERSION } from './constants.js';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:path';
|
|
@@ -11,7 +11,6 @@ import 'esbuild';
|
|
|
11
11
|
import 'path';
|
|
12
12
|
import 'fs';
|
|
13
13
|
import 'assert';
|
|
14
|
-
import 'resolve';
|
|
15
14
|
import 'util';
|
|
16
15
|
import 'net';
|
|
17
16
|
import 'url';
|
|
@@ -23,9 +22,9 @@ import 'node:os';
|
|
|
23
22
|
import 'node:crypto';
|
|
24
23
|
import 'node:util';
|
|
25
24
|
import 'node:dns';
|
|
25
|
+
import 'resolve';
|
|
26
26
|
import 'crypto';
|
|
27
27
|
import 'buffer';
|
|
28
|
-
import 'querystring';
|
|
29
28
|
import 'module';
|
|
30
29
|
import 'zlib';
|
|
31
30
|
import 'https';
|
|
@@ -33,6 +32,7 @@ import 'tls';
|
|
|
33
32
|
import 'node:http';
|
|
34
33
|
import 'node:https';
|
|
35
34
|
import 'worker_threads';
|
|
35
|
+
import 'querystring';
|
|
36
36
|
import 'readline';
|
|
37
37
|
import 'node:child_process';
|
|
38
38
|
import 'node:zlib';
|
|
@@ -694,7 +694,7 @@ cli
|
|
|
694
694
|
.action(async (root, options) => {
|
|
695
695
|
// output structure is preserved even after bundling so require()
|
|
696
696
|
// is ok here
|
|
697
|
-
const { createServer } = await import('./chunks/dep-
|
|
697
|
+
const { createServer } = await import('./chunks/dep-7c75cb17.js').then(function (n) { return n.E; });
|
|
698
698
|
try {
|
|
699
699
|
const server = await createServer({
|
|
700
700
|
root,
|
|
@@ -714,13 +714,13 @@ cli
|
|
|
714
714
|
// @ts-ignore
|
|
715
715
|
const viteStartTime = global.__vite_start_time ?? false;
|
|
716
716
|
const startupDurationString = viteStartTime
|
|
717
|
-
?
|
|
717
|
+
? picocolors.exports.dim(`ready in ${picocolors.exports.white(picocolors.exports.bold(Math.ceil(performance.now() - viteStartTime)))} ms`)
|
|
718
718
|
: '';
|
|
719
|
-
info(`\n ${
|
|
719
|
+
info(`\n ${picocolors.exports.green(`${picocolors.exports.bold('VITE')} v${VERSION}`)} ${startupDurationString}\n`, { clear: !server.config.logger.hasWarned });
|
|
720
720
|
server.printUrls();
|
|
721
721
|
}
|
|
722
722
|
catch (e) {
|
|
723
|
-
createLogger(options.logLevel).error(
|
|
723
|
+
createLogger(options.logLevel).error(picocolors.exports.red(`error when starting dev server:\n${e.stack}`), { error: e });
|
|
724
724
|
process.exit(1);
|
|
725
725
|
}
|
|
726
726
|
});
|
|
@@ -741,7 +741,7 @@ cli
|
|
|
741
741
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
742
742
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
743
743
|
.action(async (root, options) => {
|
|
744
|
-
const { build } = await import('./chunks/dep-
|
|
744
|
+
const { build } = await import('./chunks/dep-7c75cb17.js').then(function (n) { return n.D; });
|
|
745
745
|
const buildOptions = cleanOptions(options);
|
|
746
746
|
try {
|
|
747
747
|
await build({
|
|
@@ -756,7 +756,7 @@ cli
|
|
|
756
756
|
});
|
|
757
757
|
}
|
|
758
758
|
catch (e) {
|
|
759
|
-
createLogger(options.logLevel).error(
|
|
759
|
+
createLogger(options.logLevel).error(picocolors.exports.red(`error during build:\n${e.stack}`), { error: e });
|
|
760
760
|
process.exit(1);
|
|
761
761
|
}
|
|
762
762
|
});
|
|
@@ -765,7 +765,7 @@ cli
|
|
|
765
765
|
.command('optimize [root]', 'pre-bundle dependencies')
|
|
766
766
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
767
767
|
.action(async (root, options) => {
|
|
768
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
768
|
+
const { optimizeDeps } = await import('./chunks/dep-7c75cb17.js').then(function (n) { return n.C; });
|
|
769
769
|
try {
|
|
770
770
|
const config = await resolveConfig({
|
|
771
771
|
root,
|
|
@@ -776,7 +776,7 @@ cli
|
|
|
776
776
|
await optimizeDeps(config, options.force, true);
|
|
777
777
|
}
|
|
778
778
|
catch (e) {
|
|
779
|
-
createLogger(options.logLevel).error(
|
|
779
|
+
createLogger(options.logLevel).error(picocolors.exports.red(`error when optimizing deps:\n${e.stack}`), { error: e });
|
|
780
780
|
process.exit(1);
|
|
781
781
|
}
|
|
782
782
|
});
|
|
@@ -788,7 +788,7 @@ cli
|
|
|
788
788
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
789
789
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
790
790
|
.action(async (root, options) => {
|
|
791
|
-
const { preview } = await import('./chunks/dep-
|
|
791
|
+
const { preview } = await import('./chunks/dep-7c75cb17.js').then(function (n) { return n.F; });
|
|
792
792
|
try {
|
|
793
793
|
const server = await preview({
|
|
794
794
|
root,
|
|
@@ -807,7 +807,7 @@ cli
|
|
|
807
807
|
server.printUrls();
|
|
808
808
|
}
|
|
809
809
|
catch (e) {
|
|
810
|
-
createLogger(options.logLevel).error(
|
|
810
|
+
createLogger(options.logLevel).error(picocolors.exports.red(`error when starting preview server:\n${e.stack}`), { error: e });
|
|
811
811
|
process.exit(1);
|
|
812
812
|
}
|
|
813
813
|
});
|
package/dist/node/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path, { resolve } from 'node:path';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
|
|
4
|
-
var version = "3.0.0-beta.
|
|
4
|
+
var version = "3.0.0-beta.10";
|
|
5
5
|
|
|
6
6
|
const VERSION = version;
|
|
7
7
|
const DEFAULT_MAIN_FIELDS = [
|
|
@@ -9,6 +9,15 @@ const DEFAULT_MAIN_FIELDS = [
|
|
|
9
9
|
'jsnext:main',
|
|
10
10
|
'jsnext'
|
|
11
11
|
];
|
|
12
|
+
// Support browserslist
|
|
13
|
+
// "defaults and supports es6-module and supports es6-module-dynamic-import",
|
|
14
|
+
const ESBUILD_MODULES_TARGET = [
|
|
15
|
+
'es2020',
|
|
16
|
+
'edge88',
|
|
17
|
+
'firefox78',
|
|
18
|
+
'chrome87',
|
|
19
|
+
'safari13' // transpile nullish coalescing
|
|
20
|
+
];
|
|
12
21
|
const DEFAULT_EXTENSIONS = [
|
|
13
22
|
'.mjs',
|
|
14
23
|
'.js',
|
|
@@ -17,8 +26,16 @@ const DEFAULT_EXTENSIONS = [
|
|
|
17
26
|
'.tsx',
|
|
18
27
|
'.json'
|
|
19
28
|
];
|
|
29
|
+
const DEFAULT_CONFIG_FILES = [
|
|
30
|
+
'vite.config.js',
|
|
31
|
+
'vite.config.mjs',
|
|
32
|
+
'vite.config.ts',
|
|
33
|
+
'vite.config.cjs',
|
|
34
|
+
'vite.config.mts',
|
|
35
|
+
'vite.config.cts'
|
|
36
|
+
];
|
|
20
37
|
const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/;
|
|
21
|
-
const OPTIMIZABLE_ENTRY_RE = /\.(?:m?js|ts)$/;
|
|
38
|
+
const OPTIMIZABLE_ENTRY_RE = /\.(?:(m|c)?js|ts)$/;
|
|
22
39
|
const SPECIAL_QUERY_RE = /[\?&](?:worker|sharedworker|raw|url)\b/;
|
|
23
40
|
/**
|
|
24
41
|
* Prefix for resolved fs paths, since windows paths may not be valid as URLs.
|
|
@@ -42,7 +59,9 @@ const VALID_ID_PREFIX = `/@id/`;
|
|
|
42
59
|
const NULL_BYTE_PLACEHOLDER = `__x00__`;
|
|
43
60
|
const CLIENT_PUBLIC_PATH = `/@vite/client`;
|
|
44
61
|
const ENV_PUBLIC_PATH = `/@vite/env`;
|
|
45
|
-
const VITE_PACKAGE_DIR = resolve(
|
|
62
|
+
const VITE_PACKAGE_DIR = resolve(
|
|
63
|
+
// import.meta.url is `dist/node/constants.js` after bundle
|
|
64
|
+
fileURLToPath(import.meta.url), '../../..');
|
|
46
65
|
const CLIENT_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
|
|
47
66
|
const ENV_ENTRY = resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
|
|
48
67
|
const CLIENT_DIR = path.dirname(CLIENT_ENTRY);
|
|
@@ -96,4 +115,4 @@ const wildcardHosts = new Set([
|
|
|
96
115
|
'0000:0000:0000:0000:0000:0000:0000:0000'
|
|
97
116
|
]);
|
|
98
117
|
|
|
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 };
|
|
118
|
+
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, ESBUILD_MODULES_TARGET, 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
|
@@ -104,26 +104,6 @@ export declare interface AwaitWriteFinishOptions {
|
|
|
104
104
|
*/
|
|
105
105
|
export declare function build(inlineConfig?: InlineConfig): Promise<RollupOutput | RollupOutput[] | RollupWatcher>;
|
|
106
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
|
-
|
|
127
107
|
export declare interface BuildOptions {
|
|
128
108
|
/**
|
|
129
109
|
* Compatibility transform target. The transform is performed with esbuild
|
|
@@ -346,6 +326,10 @@ export declare interface CommonServerOptions {
|
|
|
346
326
|
export declare interface ConfigEnv {
|
|
347
327
|
command: 'build' | 'serve';
|
|
348
328
|
mode: string;
|
|
329
|
+
/**
|
|
330
|
+
* @experimental
|
|
331
|
+
*/
|
|
332
|
+
ssrBuild?: boolean;
|
|
349
333
|
}
|
|
350
334
|
|
|
351
335
|
export declare namespace Connect {
|
|
@@ -495,7 +479,7 @@ export declare interface CSSOptions {
|
|
|
495
479
|
modules?: CSSModulesOptions | false;
|
|
496
480
|
preprocessorOptions?: Record<string, any>;
|
|
497
481
|
postcss?: string | (PostCSS.ProcessOptions & {
|
|
498
|
-
plugins?: PostCSS.
|
|
482
|
+
plugins?: PostCSS.AcceptedPlugin[];
|
|
499
483
|
});
|
|
500
484
|
/**
|
|
501
485
|
* Enables css sourcemaps during dev
|
|
@@ -526,48 +510,7 @@ export declare interface CustomPayload {
|
|
|
526
510
|
*/
|
|
527
511
|
export declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
528
512
|
|
|
529
|
-
export declare interface
|
|
530
|
-
/**
|
|
531
|
-
* The main hash is determined by user config and dependency lockfiles.
|
|
532
|
-
* This is checked on server startup to avoid unnecessary re-bundles.
|
|
533
|
-
*/
|
|
534
|
-
hash: string;
|
|
535
|
-
/**
|
|
536
|
-
* The browser hash is determined by the main hash plus additional dependencies
|
|
537
|
-
* discovered at runtime. This is used to invalidate browser requests to
|
|
538
|
-
* optimized deps.
|
|
539
|
-
*/
|
|
540
|
-
browserHash: string;
|
|
541
|
-
/**
|
|
542
|
-
* Metadata for each already optimized dependency
|
|
543
|
-
*/
|
|
544
|
-
optimized: Record<string, OptimizedDepInfo>;
|
|
545
|
-
/**
|
|
546
|
-
* Metadata for non-entry optimized chunks and dynamic imports
|
|
547
|
-
*/
|
|
548
|
-
chunks: Record<string, OptimizedDepInfo>;
|
|
549
|
-
/**
|
|
550
|
-
* Metadata for each newly discovered dependency after processing
|
|
551
|
-
*/
|
|
552
|
-
discovered: Record<string, OptimizedDepInfo>;
|
|
553
|
-
/**
|
|
554
|
-
* OptimizedDepInfo list
|
|
555
|
-
*/
|
|
556
|
-
depInfoList: OptimizedDepInfo[];
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
export declare interface DepOptimizationOptions {
|
|
560
|
-
/**
|
|
561
|
-
* By default, Vite will crawl your `index.html` to detect dependencies that
|
|
562
|
-
* need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
|
|
563
|
-
* will crawl those entry points instead.
|
|
564
|
-
*
|
|
565
|
-
* If neither of these fit your needs, you can specify custom entries using
|
|
566
|
-
* this option - the value should be a fast-glob pattern or array of patterns
|
|
567
|
-
* (https://github.com/mrmlnc/fast-glob#basic-syntax) that are relative from
|
|
568
|
-
* vite project root. This will overwrite default entries inference.
|
|
569
|
-
*/
|
|
570
|
-
entries?: string | string[];
|
|
513
|
+
export declare interface DepOptimizationConfig {
|
|
571
514
|
/**
|
|
572
515
|
* Force optimize listed dependencies (must be resolvable import paths,
|
|
573
516
|
* cannot be globs).
|
|
@@ -614,12 +557,56 @@ export declare interface DepOptimizationOptions {
|
|
|
614
557
|
* @experimental
|
|
615
558
|
*/
|
|
616
559
|
disabled?: boolean | 'build' | 'dev';
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
export declare interface DepOptimizationMetadata {
|
|
563
|
+
/**
|
|
564
|
+
* The main hash is determined by user config and dependency lockfiles.
|
|
565
|
+
* This is checked on server startup to avoid unnecessary re-bundles.
|
|
566
|
+
*/
|
|
567
|
+
hash: string;
|
|
568
|
+
/**
|
|
569
|
+
* The browser hash is determined by the main hash plus additional dependencies
|
|
570
|
+
* discovered at runtime. This is used to invalidate browser requests to
|
|
571
|
+
* optimized deps.
|
|
572
|
+
*/
|
|
573
|
+
browserHash: string;
|
|
574
|
+
/**
|
|
575
|
+
* Metadata for each already optimized dependency
|
|
576
|
+
*/
|
|
577
|
+
optimized: Record<string, OptimizedDepInfo>;
|
|
578
|
+
/**
|
|
579
|
+
* Metadata for non-entry optimized chunks and dynamic imports
|
|
580
|
+
*/
|
|
581
|
+
chunks: Record<string, OptimizedDepInfo>;
|
|
582
|
+
/**
|
|
583
|
+
* Metadata for each newly discovered dependency after processing
|
|
584
|
+
*/
|
|
585
|
+
discovered: Record<string, OptimizedDepInfo>;
|
|
586
|
+
/**
|
|
587
|
+
* OptimizedDepInfo list
|
|
588
|
+
*/
|
|
589
|
+
depInfoList: OptimizedDepInfo[];
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
export declare type DepOptimizationOptions = DepOptimizationConfig & {
|
|
593
|
+
/**
|
|
594
|
+
* By default, Vite will crawl your `index.html` to detect dependencies that
|
|
595
|
+
* need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
|
|
596
|
+
* will crawl those entry points instead.
|
|
597
|
+
*
|
|
598
|
+
* If neither of these fit your needs, you can specify custom entries using
|
|
599
|
+
* this option - the value should be a fast-glob pattern or array of patterns
|
|
600
|
+
* (https://github.com/mrmlnc/fast-glob#basic-syntax) that are relative from
|
|
601
|
+
* vite project root. This will overwrite default entries inference.
|
|
602
|
+
*/
|
|
603
|
+
entries?: string | string[];
|
|
617
604
|
/**
|
|
618
605
|
* Force dep pre-optimization regardless of whether deps have changed.
|
|
619
606
|
* @experimental
|
|
620
607
|
*/
|
|
621
608
|
force?: boolean;
|
|
622
|
-
}
|
|
609
|
+
};
|
|
623
610
|
|
|
624
611
|
export declare interface DepOptimizationProcessing {
|
|
625
612
|
promise: Promise<void>;
|
|
@@ -638,11 +625,9 @@ export declare interface DepOptimizationResult {
|
|
|
638
625
|
}
|
|
639
626
|
|
|
640
627
|
export declare interface DepsOptimizer {
|
|
641
|
-
metadata:
|
|
642
|
-
ssr: boolean;
|
|
643
|
-
}) => DepOptimizationMetadata;
|
|
628
|
+
metadata: DepOptimizationMetadata;
|
|
644
629
|
scanProcessing?: Promise<void>;
|
|
645
|
-
registerMissingImport: (id: string, resolved: string
|
|
630
|
+
registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
|
|
646
631
|
run: () => void;
|
|
647
632
|
isOptimizedDepFile: (id: string) => boolean;
|
|
648
633
|
isOptimizedDepUrl: (url: string) => boolean;
|
|
@@ -650,6 +635,7 @@ export declare interface DepsOptimizer {
|
|
|
650
635
|
delayDepsOptimizerUntil: (id: string, done: () => Promise<any>) => void;
|
|
651
636
|
registerWorkersSource: (id: string) => void;
|
|
652
637
|
resetRegisteredIds: () => void;
|
|
638
|
+
ensureFirstRun: () => void;
|
|
653
639
|
options: DepOptimizationOptions;
|
|
654
640
|
}
|
|
655
641
|
|
|
@@ -675,6 +661,10 @@ export declare interface ESBuildOptions extends EsbuildTransformOptions {
|
|
|
675
661
|
include?: string | RegExp | string[] | RegExp[];
|
|
676
662
|
exclude?: string | RegExp | string[] | RegExp[];
|
|
677
663
|
jsxInject?: string;
|
|
664
|
+
/**
|
|
665
|
+
* This option is not respected. Use `build.minify` instead.
|
|
666
|
+
*/
|
|
667
|
+
minify?: never;
|
|
678
668
|
}
|
|
679
669
|
|
|
680
670
|
export { EsbuildTransformOptions }
|
|
@@ -694,11 +684,11 @@ export declare interface ExperimentalOptions {
|
|
|
694
684
|
*/
|
|
695
685
|
importGlobRestoreExtension?: boolean;
|
|
696
686
|
/**
|
|
697
|
-
*
|
|
687
|
+
* Allow finegrain contol over assets and public files paths
|
|
698
688
|
*
|
|
699
689
|
* @experimental
|
|
700
690
|
*/
|
|
701
|
-
|
|
691
|
+
renderBuiltUrl?: RenderBuiltAssetUrl;
|
|
702
692
|
/**
|
|
703
693
|
* Enables support of HMR partial accept via `import.meta.hot.acceptExports`.
|
|
704
694
|
*
|
|
@@ -827,6 +817,8 @@ export declare interface FullReloadPayload {
|
|
|
827
817
|
path?: string
|
|
828
818
|
}
|
|
829
819
|
|
|
820
|
+
export declare function getDepOptimizationConfig(config: ResolvedConfig, ssr: boolean): DepOptimizationConfig;
|
|
821
|
+
|
|
830
822
|
export declare interface HmrContext {
|
|
831
823
|
file: string;
|
|
832
824
|
timestamp: number;
|
|
@@ -1222,11 +1214,12 @@ export declare interface InternalResolveOptions extends ResolveOptions {
|
|
|
1222
1214
|
isFromTsImporter?: boolean;
|
|
1223
1215
|
tryEsmOnly?: boolean;
|
|
1224
1216
|
scan?: boolean;
|
|
1225
|
-
|
|
1217
|
+
ssrOptimizeCheck?: boolean;
|
|
1218
|
+
getDepsOptimizer?: (ssr: boolean) => DepsOptimizer | undefined;
|
|
1226
1219
|
shouldExternalize?: (id: string) => boolean | undefined;
|
|
1227
1220
|
}
|
|
1228
1221
|
|
|
1229
|
-
export declare function isDepsOptimizerEnabled(config: ResolvedConfig): boolean;
|
|
1222
|
+
export declare function isDepsOptimizerEnabled(config: ResolvedConfig, ssr: boolean): boolean;
|
|
1230
1223
|
|
|
1231
1224
|
export declare interface JsonOptions {
|
|
1232
1225
|
/**
|
|
@@ -1249,22 +1242,6 @@ export declare interface KnownAsTypeMap {
|
|
|
1249
1242
|
}
|
|
1250
1243
|
|
|
1251
1244
|
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
1245
|
/**
|
|
1269
1246
|
* Revert vite build --ssr to the v2.9 strategy. Use CJS SSR build and v2.9 externalization heuristics
|
|
1270
1247
|
*
|
|
@@ -1375,7 +1352,7 @@ export declare class ModuleGraph {
|
|
|
1375
1352
|
* returned as a Set.
|
|
1376
1353
|
*/
|
|
1377
1354
|
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>;
|
|
1378
|
-
ensureEntryFromUrl(rawUrl: string, ssr?: boolean): Promise<ModuleNode>;
|
|
1355
|
+
ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>;
|
|
1379
1356
|
createFileOnlyEntry(file: string): ModuleNode;
|
|
1380
1357
|
resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
|
|
1381
1358
|
}
|
|
@@ -1405,7 +1382,10 @@ export declare class ModuleNode {
|
|
|
1405
1382
|
ssrError: Error | null;
|
|
1406
1383
|
lastHMRTimestamp: number;
|
|
1407
1384
|
lastInvalidationTimestamp: number;
|
|
1408
|
-
|
|
1385
|
+
/**
|
|
1386
|
+
* @param setIsSelfAccepting - set `false` to set `isSelfAccepting` later. e.g. #7870
|
|
1387
|
+
*/
|
|
1388
|
+
constructor(url: string, setIsSelfAccepting?: boolean);
|
|
1409
1389
|
}
|
|
1410
1390
|
|
|
1411
1391
|
export declare function normalizePath(id: string): string;
|
|
@@ -1430,7 +1410,8 @@ export declare interface OptimizedDepInfo {
|
|
|
1430
1410
|
}
|
|
1431
1411
|
|
|
1432
1412
|
/**
|
|
1433
|
-
*
|
|
1413
|
+
* Scan and optimize dependencies within a project.
|
|
1414
|
+
* Used by Vite CLI when running `vite optimize`.
|
|
1434
1415
|
*/
|
|
1435
1416
|
export declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>;
|
|
1436
1417
|
|
|
@@ -1563,17 +1544,18 @@ declare interface Plugin_2 extends Plugin_3 {
|
|
|
1563
1544
|
/**
|
|
1564
1545
|
* extend hooks with ssr flag
|
|
1565
1546
|
*/
|
|
1566
|
-
resolveId
|
|
1547
|
+
resolveId?: (this: PluginContext, source: string, importer: string | undefined, options: {
|
|
1567
1548
|
custom?: CustomPluginOptions;
|
|
1568
1549
|
ssr?: boolean;
|
|
1569
1550
|
/* Excluded from this release type: scan */
|
|
1570
|
-
|
|
1571
|
-
|
|
1551
|
+
isEntry: boolean;
|
|
1552
|
+
}) => Promise<ResolveIdResult> | ResolveIdResult;
|
|
1553
|
+
load?: (this: PluginContext, id: string, options?: {
|
|
1572
1554
|
ssr?: boolean;
|
|
1573
|
-
})
|
|
1574
|
-
transform
|
|
1555
|
+
}) => Promise<LoadResult> | LoadResult;
|
|
1556
|
+
transform?: (this: TransformPluginContext, code: string, id: string, options?: {
|
|
1575
1557
|
ssr?: boolean;
|
|
1576
|
-
})
|
|
1558
|
+
}) => Promise<TransformResult_2> | TransformResult_2;
|
|
1577
1559
|
}
|
|
1578
1560
|
export { Plugin_2 as Plugin }
|
|
1579
1561
|
|
|
@@ -1582,9 +1564,11 @@ export declare interface PluginContainer {
|
|
|
1582
1564
|
getModuleInfo(id: string): ModuleInfo | null;
|
|
1583
1565
|
buildStart(options: InputOptions): Promise<void>;
|
|
1584
1566
|
resolveId(id: string, importer?: string, options?: {
|
|
1567
|
+
custom?: CustomPluginOptions;
|
|
1585
1568
|
skip?: Set<Plugin_2>;
|
|
1586
1569
|
ssr?: boolean;
|
|
1587
1570
|
/* Excluded from this release type: scan */
|
|
1571
|
+
isEntry?: boolean;
|
|
1588
1572
|
}): Promise<PartialResolvedId | null>;
|
|
1589
1573
|
transform(code: string, id: string, options?: {
|
|
1590
1574
|
inMap?: SourceDescription['map'];
|
|
@@ -1615,10 +1599,16 @@ export declare interface PreviewServer {
|
|
|
1615
1599
|
* native Node http server instance
|
|
1616
1600
|
*/
|
|
1617
1601
|
httpServer: http.Server;
|
|
1602
|
+
/**
|
|
1603
|
+
* The resolved urls Vite prints on the
|
|
1604
|
+
*
|
|
1605
|
+
* @experimental
|
|
1606
|
+
*/
|
|
1607
|
+
resolvedUrls: ResolvedServerUrls;
|
|
1618
1608
|
/**
|
|
1619
1609
|
* Print server urls
|
|
1620
1610
|
*/
|
|
1621
|
-
printUrls
|
|
1611
|
+
printUrls(): void;
|
|
1622
1612
|
}
|
|
1623
1613
|
|
|
1624
1614
|
export declare type PreviewServerHook = (server: {
|
|
@@ -1646,19 +1636,24 @@ export declare interface PrunePayload {
|
|
|
1646
1636
|
paths: string[]
|
|
1647
1637
|
}
|
|
1648
1638
|
|
|
1639
|
+
export declare type RenderBuiltAssetUrl = (filename: string, type: {
|
|
1640
|
+
type: 'asset' | 'public';
|
|
1641
|
+
hostId: string;
|
|
1642
|
+
hostType: 'js' | 'css' | 'html';
|
|
1643
|
+
ssr: boolean;
|
|
1644
|
+
}) => string | {
|
|
1645
|
+
relative?: boolean;
|
|
1646
|
+
runtime?: string;
|
|
1647
|
+
} | undefined;
|
|
1648
|
+
|
|
1649
1649
|
/**
|
|
1650
1650
|
* Resolve base url. Note that some users use Vite to build for non-web targets like
|
|
1651
1651
|
* electron or expects to deploy
|
|
1652
1652
|
*/
|
|
1653
|
-
export declare function resolveBaseUrl(base: string | undefined, isBuild: boolean, logger: Logger
|
|
1653
|
+
export declare function resolveBaseUrl(base: string | undefined, isBuild: boolean, logger: Logger): string;
|
|
1654
1654
|
|
|
1655
1655
|
export declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string): Promise<ResolvedConfig>;
|
|
1656
1656
|
|
|
1657
|
-
export declare type ResolvedBuildAdvancedBaseConfig = BuildAdvancedBaseOptions & {
|
|
1658
|
-
assets: BuildAdvancedBaseOptions;
|
|
1659
|
-
public: BuildAdvancedBaseOptions;
|
|
1660
|
-
};
|
|
1661
|
-
|
|
1662
1657
|
export declare type ResolvedBuildOptions = Required<BuildOptions>;
|
|
1663
1658
|
|
|
1664
1659
|
export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'assetsInclude' | 'optimizeDeps' | 'worker'> & {
|
|
@@ -1682,7 +1677,7 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
|
|
|
1682
1677
|
server: ResolvedServerOptions;
|
|
1683
1678
|
build: ResolvedBuildOptions;
|
|
1684
1679
|
preview: ResolvedPreviewOptions;
|
|
1685
|
-
ssr: ResolvedSSROptions
|
|
1680
|
+
ssr: ResolvedSSROptions;
|
|
1686
1681
|
assetsInclude: (file: string) => boolean;
|
|
1687
1682
|
logger: Logger;
|
|
1688
1683
|
createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
|
|
@@ -1690,13 +1685,9 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
|
|
|
1690
1685
|
/* Excluded from this release type: packageCache */
|
|
1691
1686
|
worker: ResolveWorkerOptions;
|
|
1692
1687
|
appType: AppType;
|
|
1693
|
-
experimental:
|
|
1688
|
+
experimental: ExperimentalOptions;
|
|
1694
1689
|
}>;
|
|
1695
1690
|
|
|
1696
|
-
export declare type ResolvedExperimentalOptions = Required<ExperimentalOptions> & {
|
|
1697
|
-
buildAdvancedBaseOptions: ResolvedBuildAdvancedBaseConfig;
|
|
1698
|
-
};
|
|
1699
|
-
|
|
1700
1691
|
export declare interface ResolvedPreviewOptions extends PreviewOptions {
|
|
1701
1692
|
}
|
|
1702
1693
|
|
|
@@ -1705,9 +1696,15 @@ export declare interface ResolvedServerOptions extends ServerOptions {
|
|
|
1705
1696
|
middlewareMode: boolean;
|
|
1706
1697
|
}
|
|
1707
1698
|
|
|
1699
|
+
export declare interface ResolvedServerUrls {
|
|
1700
|
+
local: string[];
|
|
1701
|
+
network: string[];
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1708
1704
|
export declare interface ResolvedSSROptions extends SSROptions {
|
|
1709
1705
|
target: SSRTarget;
|
|
1710
1706
|
format: SSRFormat;
|
|
1707
|
+
optimizeDeps: SsrDepOptimizationOptions;
|
|
1711
1708
|
}
|
|
1712
1709
|
|
|
1713
1710
|
export declare type ResolvedUrl = [
|
|
@@ -1998,6 +1995,13 @@ export declare interface ServerOptions extends CommonServerOptions {
|
|
|
1998
1995
|
* @default true
|
|
1999
1996
|
*/
|
|
2000
1997
|
preTransformRequests?: boolean;
|
|
1998
|
+
/**
|
|
1999
|
+
* Force dep pre-optimization regardless of whether deps have changed.
|
|
2000
|
+
*
|
|
2001
|
+
* @deprecated Use optimizeDeps.force instead, this option may be removed
|
|
2002
|
+
* in a future minor version without following semver
|
|
2003
|
+
*/
|
|
2004
|
+
force?: boolean;
|
|
2001
2005
|
}
|
|
2002
2006
|
|
|
2003
2007
|
export declare function sortUserPlugins(plugins: (Plugin_2 | Plugin_2[])[] | undefined): [Plugin_2[], Plugin_2[], Plugin_2[]];
|
|
@@ -2014,11 +2018,13 @@ export declare class SplitVendorChunkCache {
|
|
|
2014
2018
|
|
|
2015
2019
|
export declare function splitVendorChunkPlugin(): Plugin_2;
|
|
2016
2020
|
|
|
2021
|
+
export declare type SsrDepOptimizationOptions = DepOptimizationConfig;
|
|
2022
|
+
|
|
2017
2023
|
export declare type SSRFormat = 'esm' | 'cjs';
|
|
2018
2024
|
|
|
2019
2025
|
export declare interface SSROptions {
|
|
2020
|
-
external?: string[];
|
|
2021
2026
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
|
2027
|
+
external?: string[];
|
|
2022
2028
|
/**
|
|
2023
2029
|
* Define the target for the ssr build. The browser field in package.json
|
|
2024
2030
|
* is ignored for node but used if webworker is the target
|
|
@@ -2033,6 +2039,15 @@ export declare interface SSROptions {
|
|
|
2033
2039
|
* @experimental
|
|
2034
2040
|
*/
|
|
2035
2041
|
format?: SSRFormat;
|
|
2042
|
+
/**
|
|
2043
|
+
* Control over which dependencies are optimized during SSR and esbuild options
|
|
2044
|
+
* During build:
|
|
2045
|
+
* no external CJS dependencies are optimized by default
|
|
2046
|
+
* During dev:
|
|
2047
|
+
* explicit no external CJS dependencies are optimized by default
|
|
2048
|
+
* @experimental
|
|
2049
|
+
*/
|
|
2050
|
+
optimizeDeps?: SsrDepOptimizationOptions;
|
|
2036
2051
|
}
|
|
2037
2052
|
|
|
2038
2053
|
export declare type SSRTarget = 'node' | 'webworker';
|
|
@@ -2433,6 +2448,13 @@ export declare interface ViteDevServer {
|
|
|
2433
2448
|
* and hmr state.
|
|
2434
2449
|
*/
|
|
2435
2450
|
moduleGraph: ModuleGraph;
|
|
2451
|
+
/**
|
|
2452
|
+
* The resolved urls Vite prints on the CLI. null in middleware mode or
|
|
2453
|
+
* before `server.listen` is called.
|
|
2454
|
+
*
|
|
2455
|
+
* @experimental
|
|
2456
|
+
*/
|
|
2457
|
+
resolvedUrls: ResolvedServerUrls | null;
|
|
2436
2458
|
/**
|
|
2437
2459
|
* Programmatically resolve, load and transform a URL and get the result
|
|
2438
2460
|
* without going through the http request pipeline.
|
|
@@ -2471,7 +2493,7 @@ export declare interface ViteDevServer {
|
|
|
2471
2493
|
/**
|
|
2472
2494
|
* Print server urls
|
|
2473
2495
|
*/
|
|
2474
|
-
printUrls():
|
|
2496
|
+
printUrls(): void;
|
|
2475
2497
|
/**
|
|
2476
2498
|
* Restart the server.
|
|
2477
2499
|
*
|
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as build,
|
|
1
|
+
export { b as build, k as createFilter, u as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, h as getDepOptimizationConfig, i as isDepsOptimizerEnabled, l as loadConfigFromFile, w as loadEnv, j as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, p as preview, g as resolveBaseUrl, e as resolveConfig, x as resolveEnvPrefix, a as resolvePackageData, r as resolvePackageEntry, v as searchForWorkspaceRoot, q as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-7c75cb17.js';
|
|
2
2
|
export { VERSION as version } from './constants.js';
|
|
3
3
|
export { version as esbuildVersion } from 'esbuild';
|
|
4
4
|
export { VERSION as rollupVersion } from 'rollup';
|
|
@@ -12,7 +12,6 @@ import 'path';
|
|
|
12
12
|
import 'fs';
|
|
13
13
|
import 'events';
|
|
14
14
|
import 'assert';
|
|
15
|
-
import 'resolve';
|
|
16
15
|
import 'util';
|
|
17
16
|
import 'net';
|
|
18
17
|
import 'url';
|
|
@@ -24,9 +23,9 @@ import 'node:os';
|
|
|
24
23
|
import 'node:crypto';
|
|
25
24
|
import 'node:util';
|
|
26
25
|
import 'node:dns';
|
|
26
|
+
import 'resolve';
|
|
27
27
|
import 'crypto';
|
|
28
28
|
import 'buffer';
|
|
29
|
-
import 'querystring';
|
|
30
29
|
import 'module';
|
|
31
30
|
import 'zlib';
|
|
32
31
|
import 'https';
|
|
@@ -34,6 +33,7 @@ import 'tls';
|
|
|
34
33
|
import 'node:http';
|
|
35
34
|
import 'node:https';
|
|
36
35
|
import 'worker_threads';
|
|
36
|
+
import 'querystring';
|
|
37
37
|
import 'readline';
|
|
38
38
|
import 'node:child_process';
|
|
39
39
|
import 'node:zlib';
|