vite 3.0.0-alpha.9 → 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 +84 -343
- package/bin/vite.js +1 -1
- package/client.d.ts +12 -0
- package/dist/client/client.mjs +61 -9
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-e8ca8d40.js → dep-07a79996.js} +124 -116
- package/dist/node/chunks/{dep-17430d09.js → dep-41eb528c.js} +12 -12
- package/dist/node/chunks/{dep-8df7bfd6.js → dep-7c75cb17.js} +33378 -30892
- package/dist/node/chunks/{dep-523c8a1b.js → dep-af860ceb.js} +3122 -3122
- package/dist/node/chunks/dep-bc80f1d6.js +7545 -0
- package/dist/node/cli.js +32 -19
- package/dist/node/constants.js +43 -7
- package/dist/node/index.d.ts +235 -96
- package/dist/node/index.js +23 -10
- package/dist/node-cjs/publicUtils.cjs +3058 -868
- package/package.json +32 -32
- package/src/client/client.ts +109 -22
- package/src/client/tsconfig.json +0 -2
- 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/chunks/dep-08f2a2be.js +0 -19603
- package/dist/node/chunks/dep-3165073f.js +0 -7505
- package/dist/node-cjs/terser.cjs +0 -31023
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.
|
|
@@ -315,6 +326,10 @@ export declare interface CommonServerOptions {
|
|
|
315
326
|
export declare interface ConfigEnv {
|
|
316
327
|
command: 'build' | 'serve';
|
|
317
328
|
mode: string;
|
|
329
|
+
/**
|
|
330
|
+
* @experimental
|
|
331
|
+
*/
|
|
332
|
+
ssrBuild?: boolean;
|
|
318
333
|
}
|
|
319
334
|
|
|
320
335
|
export declare namespace Connect {
|
|
@@ -437,6 +452,10 @@ export declare interface CorsOptions {
|
|
|
437
452
|
|
|
438
453
|
export declare type CorsOrigin = boolean | string | RegExp | (string | RegExp)[];
|
|
439
454
|
|
|
455
|
+
export declare const createFilter: (include?: FilterPattern | undefined, exclude?: FilterPattern | undefined, options?: {
|
|
456
|
+
resolve?: string | false | null | undefined;
|
|
457
|
+
} | undefined) => (id: string | unknown) => boolean;
|
|
458
|
+
|
|
440
459
|
export declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
|
|
441
460
|
|
|
442
461
|
export declare function createServer(inlineConfig?: InlineConfig): Promise<ViteDevServer>;
|
|
@@ -460,7 +479,7 @@ export declare interface CSSOptions {
|
|
|
460
479
|
modules?: CSSModulesOptions | false;
|
|
461
480
|
preprocessorOptions?: Record<string, any>;
|
|
462
481
|
postcss?: string | (PostCSS.ProcessOptions & {
|
|
463
|
-
plugins?: PostCSS.
|
|
482
|
+
plugins?: PostCSS.AcceptedPlugin[];
|
|
464
483
|
});
|
|
465
484
|
/**
|
|
466
485
|
* Enables css sourcemaps during dev
|
|
@@ -491,55 +510,7 @@ export declare interface CustomPayload {
|
|
|
491
510
|
*/
|
|
492
511
|
export declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
493
512
|
|
|
494
|
-
export declare interface
|
|
495
|
-
/**
|
|
496
|
-
* The main hash is determined by user config and dependency lockfiles.
|
|
497
|
-
* This is checked on server startup to avoid unnecessary re-bundles.
|
|
498
|
-
*/
|
|
499
|
-
hash: string;
|
|
500
|
-
/**
|
|
501
|
-
* The browser hash is determined by the main hash plus additional dependencies
|
|
502
|
-
* discovered at runtime. This is used to invalidate browser requests to
|
|
503
|
-
* optimized deps.
|
|
504
|
-
*/
|
|
505
|
-
browserHash: string;
|
|
506
|
-
/**
|
|
507
|
-
* Metadata for each already optimized dependency
|
|
508
|
-
*/
|
|
509
|
-
optimized: Record<string, OptimizedDepInfo>;
|
|
510
|
-
/**
|
|
511
|
-
* Metadata for non-entry optimized chunks and dynamic imports
|
|
512
|
-
*/
|
|
513
|
-
chunks: Record<string, OptimizedDepInfo>;
|
|
514
|
-
/**
|
|
515
|
-
* Metadata for each newly discovered dependency after processing
|
|
516
|
-
*/
|
|
517
|
-
discovered: Record<string, OptimizedDepInfo>;
|
|
518
|
-
/**
|
|
519
|
-
* OptimizedDepInfo list
|
|
520
|
-
*/
|
|
521
|
-
depInfoList: OptimizedDepInfo[];
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
export declare interface DepOptimizationOptions {
|
|
525
|
-
/**
|
|
526
|
-
* By default, Vite will crawl your `index.html` to detect dependencies that
|
|
527
|
-
* need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
|
|
528
|
-
* will crawl those entry points instead.
|
|
529
|
-
*
|
|
530
|
-
* If neither of these fit your needs, you can specify custom entries using
|
|
531
|
-
* this option - the value should be a fast-glob pattern or array of patterns
|
|
532
|
-
* (https://github.com/mrmlnc/fast-glob#basic-syntax) that are relative from
|
|
533
|
-
* vite project root. This will overwrite default entries inference.
|
|
534
|
-
*/
|
|
535
|
-
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;
|
|
513
|
+
export declare interface DepOptimizationConfig {
|
|
543
514
|
/**
|
|
544
515
|
* Force optimize listed dependencies (must be resolvable import paths,
|
|
545
516
|
* cannot be globs).
|
|
@@ -588,6 +559,55 @@ export declare interface DepOptimizationOptions {
|
|
|
588
559
|
disabled?: boolean | 'build' | 'dev';
|
|
589
560
|
}
|
|
590
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[];
|
|
604
|
+
/**
|
|
605
|
+
* Force dep pre-optimization regardless of whether deps have changed.
|
|
606
|
+
* @experimental
|
|
607
|
+
*/
|
|
608
|
+
force?: boolean;
|
|
609
|
+
};
|
|
610
|
+
|
|
591
611
|
export declare interface DepOptimizationProcessing {
|
|
592
612
|
promise: Promise<void>;
|
|
593
613
|
resolve: () => void;
|
|
@@ -612,6 +632,10 @@ export declare interface DepsOptimizer {
|
|
|
612
632
|
isOptimizedDepFile: (id: string) => boolean;
|
|
613
633
|
isOptimizedDepUrl: (url: string) => boolean;
|
|
614
634
|
getOptimizedDepId: (depInfo: OptimizedDepInfo) => string;
|
|
635
|
+
delayDepsOptimizerUntil: (id: string, done: () => Promise<any>) => void;
|
|
636
|
+
registerWorkersSource: (id: string) => void;
|
|
637
|
+
resetRegisteredIds: () => void;
|
|
638
|
+
ensureFirstRun: () => void;
|
|
615
639
|
options: DepOptimizationOptions;
|
|
616
640
|
}
|
|
617
641
|
|
|
@@ -637,6 +661,10 @@ export declare interface ESBuildOptions extends EsbuildTransformOptions {
|
|
|
637
661
|
include?: string | RegExp | string[] | RegExp[];
|
|
638
662
|
exclude?: string | RegExp | string[] | RegExp[];
|
|
639
663
|
jsxInject?: string;
|
|
664
|
+
/**
|
|
665
|
+
* This option is not respected. Use `build.minify` instead.
|
|
666
|
+
*/
|
|
667
|
+
minify?: never;
|
|
640
668
|
}
|
|
641
669
|
|
|
642
670
|
export { EsbuildTransformOptions }
|
|
@@ -645,6 +673,8 @@ export declare type ESBuildTransformResult = Omit<TransformResult_3, 'map'> & {
|
|
|
645
673
|
map: SourceMap;
|
|
646
674
|
};
|
|
647
675
|
|
|
676
|
+
export { esbuildVersion }
|
|
677
|
+
|
|
648
678
|
export declare interface ExperimentalOptions {
|
|
649
679
|
/**
|
|
650
680
|
* Append fake `&lang.(ext)` when queries are specified, to preseve the file extension for following plugins to process.
|
|
@@ -653,6 +683,19 @@ export declare interface ExperimentalOptions {
|
|
|
653
683
|
* @default false
|
|
654
684
|
*/
|
|
655
685
|
importGlobRestoreExtension?: boolean;
|
|
686
|
+
/**
|
|
687
|
+
* Allow finegrain contol over assets and public files paths
|
|
688
|
+
*
|
|
689
|
+
* @experimental
|
|
690
|
+
*/
|
|
691
|
+
renderBuiltUrl?: RenderBuiltAssetUrl;
|
|
692
|
+
/**
|
|
693
|
+
* Enables support of HMR partial accept via `import.meta.hot.acceptExports`.
|
|
694
|
+
*
|
|
695
|
+
* @experimental
|
|
696
|
+
* @default false
|
|
697
|
+
*/
|
|
698
|
+
hmrPartialAccept?: boolean;
|
|
656
699
|
}
|
|
657
700
|
|
|
658
701
|
export declare type ExportsData = {
|
|
@@ -690,6 +733,11 @@ export declare interface FileSystemServeOptions {
|
|
|
690
733
|
deny?: string[];
|
|
691
734
|
}
|
|
692
735
|
|
|
736
|
+
/**
|
|
737
|
+
* Inlined to keep `@rollup/pluginutils` in devDependencies
|
|
738
|
+
*/
|
|
739
|
+
export declare type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
|
740
|
+
|
|
693
741
|
export declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise<ExistingRawSourceMap>;
|
|
694
742
|
|
|
695
743
|
export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
|
@@ -769,6 +817,8 @@ export declare interface FullReloadPayload {
|
|
|
769
817
|
path?: string
|
|
770
818
|
}
|
|
771
819
|
|
|
820
|
+
export declare function getDepOptimizationConfig(config: ResolvedConfig, ssr: boolean): DepOptimizationConfig;
|
|
821
|
+
|
|
772
822
|
export declare interface HmrContext {
|
|
773
823
|
file: string;
|
|
774
824
|
timestamp: number;
|
|
@@ -1164,11 +1214,12 @@ export declare interface InternalResolveOptions extends ResolveOptions {
|
|
|
1164
1214
|
isFromTsImporter?: boolean;
|
|
1165
1215
|
tryEsmOnly?: boolean;
|
|
1166
1216
|
scan?: boolean;
|
|
1167
|
-
|
|
1217
|
+
ssrOptimizeCheck?: boolean;
|
|
1218
|
+
getDepsOptimizer?: (ssr: boolean) => DepsOptimizer | undefined;
|
|
1168
1219
|
shouldExternalize?: (id: string) => boolean | undefined;
|
|
1169
1220
|
}
|
|
1170
1221
|
|
|
1171
|
-
export declare function isDepsOptimizerEnabled(config: ResolvedConfig): boolean;
|
|
1222
|
+
export declare function isDepsOptimizerEnabled(config: ResolvedConfig, ssr: boolean): boolean;
|
|
1172
1223
|
|
|
1173
1224
|
export declare interface JsonOptions {
|
|
1174
1225
|
/**
|
|
@@ -1190,6 +1241,17 @@ export declare interface KnownAsTypeMap {
|
|
|
1190
1241
|
worker: Worker
|
|
1191
1242
|
}
|
|
1192
1243
|
|
|
1244
|
+
export declare interface LegacyOptions {
|
|
1245
|
+
/**
|
|
1246
|
+
* Revert vite build --ssr to the v2.9 strategy. Use CJS SSR build and v2.9 externalization heuristics
|
|
1247
|
+
*
|
|
1248
|
+
* @experimental
|
|
1249
|
+
* @deprecated
|
|
1250
|
+
* @default false
|
|
1251
|
+
*/
|
|
1252
|
+
buildSsrCjsExternalHeuristics?: boolean;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1193
1255
|
export declare type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife';
|
|
1194
1256
|
|
|
1195
1257
|
export declare interface LibraryOptions {
|
|
@@ -1289,8 +1351,8 @@ export declare class ModuleGraph {
|
|
|
1289
1351
|
* If there are dependencies that no longer have any importers, they are
|
|
1290
1352
|
* returned as a Set.
|
|
1291
1353
|
*/
|
|
1292
|
-
updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, acceptedModules: Set<string | ModuleNode>, isSelfAccepting: boolean, ssr?: boolean): Promise<Set<ModuleNode> | undefined>;
|
|
1293
|
-
ensureEntryFromUrl(rawUrl: string, ssr?: boolean): Promise<ModuleNode>;
|
|
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>;
|
|
1355
|
+
ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>;
|
|
1294
1356
|
createFileOnlyEntry(file: string): ModuleNode;
|
|
1295
1357
|
resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
|
|
1296
1358
|
}
|
|
@@ -1311,6 +1373,8 @@ export declare class ModuleNode {
|
|
|
1311
1373
|
importers: Set<ModuleNode>;
|
|
1312
1374
|
importedModules: Set<ModuleNode>;
|
|
1313
1375
|
acceptedHmrDeps: Set<ModuleNode>;
|
|
1376
|
+
acceptedHmrExports: Set<string> | null;
|
|
1377
|
+
importedBindings: Map<string, Set<string>> | null;
|
|
1314
1378
|
isSelfAccepting?: boolean;
|
|
1315
1379
|
transformResult: TransformResult | null;
|
|
1316
1380
|
ssrTransformResult: TransformResult | null;
|
|
@@ -1318,7 +1382,10 @@ export declare class ModuleNode {
|
|
|
1318
1382
|
ssrError: Error | null;
|
|
1319
1383
|
lastHMRTimestamp: number;
|
|
1320
1384
|
lastInvalidationTimestamp: number;
|
|
1321
|
-
|
|
1385
|
+
/**
|
|
1386
|
+
* @param setIsSelfAccepting - set `false` to set `isSelfAccepting` later. e.g. #7870
|
|
1387
|
+
*/
|
|
1388
|
+
constructor(url: string, setIsSelfAccepting?: boolean);
|
|
1322
1389
|
}
|
|
1323
1390
|
|
|
1324
1391
|
export declare function normalizePath(id: string): string;
|
|
@@ -1343,7 +1410,8 @@ export declare interface OptimizedDepInfo {
|
|
|
1343
1410
|
}
|
|
1344
1411
|
|
|
1345
1412
|
/**
|
|
1346
|
-
*
|
|
1413
|
+
* Scan and optimize dependencies within a project.
|
|
1414
|
+
* Used by Vite CLI when running `vite optimize`.
|
|
1347
1415
|
*/
|
|
1348
1416
|
export declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>;
|
|
1349
1417
|
|
|
@@ -1476,17 +1544,18 @@ declare interface Plugin_2 extends Plugin_3 {
|
|
|
1476
1544
|
/**
|
|
1477
1545
|
* extend hooks with ssr flag
|
|
1478
1546
|
*/
|
|
1479
|
-
resolveId
|
|
1547
|
+
resolveId?: (this: PluginContext, source: string, importer: string | undefined, options: {
|
|
1480
1548
|
custom?: CustomPluginOptions;
|
|
1481
1549
|
ssr?: boolean;
|
|
1482
1550
|
/* Excluded from this release type: scan */
|
|
1483
|
-
|
|
1484
|
-
|
|
1551
|
+
isEntry: boolean;
|
|
1552
|
+
}) => Promise<ResolveIdResult> | ResolveIdResult;
|
|
1553
|
+
load?: (this: PluginContext, id: string, options?: {
|
|
1485
1554
|
ssr?: boolean;
|
|
1486
|
-
})
|
|
1487
|
-
transform
|
|
1555
|
+
}) => Promise<LoadResult> | LoadResult;
|
|
1556
|
+
transform?: (this: TransformPluginContext, code: string, id: string, options?: {
|
|
1488
1557
|
ssr?: boolean;
|
|
1489
|
-
})
|
|
1558
|
+
}) => Promise<TransformResult_2> | TransformResult_2;
|
|
1490
1559
|
}
|
|
1491
1560
|
export { Plugin_2 as Plugin }
|
|
1492
1561
|
|
|
@@ -1495,9 +1564,11 @@ export declare interface PluginContainer {
|
|
|
1495
1564
|
getModuleInfo(id: string): ModuleInfo | null;
|
|
1496
1565
|
buildStart(options: InputOptions): Promise<void>;
|
|
1497
1566
|
resolveId(id: string, importer?: string, options?: {
|
|
1567
|
+
custom?: CustomPluginOptions;
|
|
1498
1568
|
skip?: Set<Plugin_2>;
|
|
1499
1569
|
ssr?: boolean;
|
|
1500
1570
|
/* Excluded from this release type: scan */
|
|
1571
|
+
isEntry?: boolean;
|
|
1501
1572
|
}): Promise<PartialResolvedId | null>;
|
|
1502
1573
|
transform(code: string, id: string, options?: {
|
|
1503
1574
|
inMap?: SourceDescription['map'];
|
|
@@ -1509,7 +1580,7 @@ export declare interface PluginContainer {
|
|
|
1509
1580
|
close(): Promise<void>;
|
|
1510
1581
|
}
|
|
1511
1582
|
|
|
1512
|
-
export declare type PluginOption = Plugin_2 | false | null | undefined | PluginOption[]
|
|
1583
|
+
export declare type PluginOption = Plugin_2 | false | null | undefined | PluginOption[] | Promise<Plugin_2 | false | null | undefined | PluginOption[]>;
|
|
1513
1584
|
|
|
1514
1585
|
/**
|
|
1515
1586
|
* Starts the Vite server in preview mode, to simulate a production deployment
|
|
@@ -1528,10 +1599,16 @@ export declare interface PreviewServer {
|
|
|
1528
1599
|
* native Node http server instance
|
|
1529
1600
|
*/
|
|
1530
1601
|
httpServer: http.Server;
|
|
1602
|
+
/**
|
|
1603
|
+
* The resolved urls Vite prints on the
|
|
1604
|
+
*
|
|
1605
|
+
* @experimental
|
|
1606
|
+
*/
|
|
1607
|
+
resolvedUrls: ResolvedServerUrls;
|
|
1531
1608
|
/**
|
|
1532
1609
|
* Print server urls
|
|
1533
1610
|
*/
|
|
1534
|
-
printUrls
|
|
1611
|
+
printUrls(): void;
|
|
1535
1612
|
}
|
|
1536
1613
|
|
|
1537
1614
|
export declare type PreviewServerHook = (server: {
|
|
@@ -1559,6 +1636,22 @@ export declare interface PrunePayload {
|
|
|
1559
1636
|
paths: string[]
|
|
1560
1637
|
}
|
|
1561
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
|
+
/**
|
|
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): string;
|
|
1654
|
+
|
|
1562
1655
|
export declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string): Promise<ResolvedConfig>;
|
|
1563
1656
|
|
|
1564
1657
|
export declare type ResolvedBuildOptions = Required<BuildOptions>;
|
|
@@ -1584,13 +1677,15 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
|
|
|
1584
1677
|
server: ResolvedServerOptions;
|
|
1585
1678
|
build: ResolvedBuildOptions;
|
|
1586
1679
|
preview: ResolvedPreviewOptions;
|
|
1680
|
+
ssr: ResolvedSSROptions;
|
|
1587
1681
|
assetsInclude: (file: string) => boolean;
|
|
1588
1682
|
logger: Logger;
|
|
1589
1683
|
createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
|
|
1590
1684
|
optimizeDeps: DepOptimizationOptions;
|
|
1591
1685
|
/* Excluded from this release type: packageCache */
|
|
1592
1686
|
worker: ResolveWorkerOptions;
|
|
1593
|
-
|
|
1687
|
+
appType: AppType;
|
|
1688
|
+
experimental: ExperimentalOptions;
|
|
1594
1689
|
}>;
|
|
1595
1690
|
|
|
1596
1691
|
export declare interface ResolvedPreviewOptions extends PreviewOptions {
|
|
@@ -1598,6 +1693,18 @@ export declare interface ResolvedPreviewOptions extends PreviewOptions {
|
|
|
1598
1693
|
|
|
1599
1694
|
export declare interface ResolvedServerOptions extends ServerOptions {
|
|
1600
1695
|
fs: Required<FileSystemServeOptions>;
|
|
1696
|
+
middlewareMode: boolean;
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
export declare interface ResolvedServerUrls {
|
|
1700
|
+
local: string[];
|
|
1701
|
+
network: string[];
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
export declare interface ResolvedSSROptions extends SSROptions {
|
|
1705
|
+
target: SSRTarget;
|
|
1706
|
+
format: SSRFormat;
|
|
1707
|
+
optimizeDeps: SsrDepOptimizationOptions;
|
|
1601
1708
|
}
|
|
1602
1709
|
|
|
1603
1710
|
export declare type ResolvedUrl = [
|
|
@@ -1836,6 +1943,8 @@ export declare interface RollupDynamicImportVarsOptions {
|
|
|
1836
1943
|
warnOnError?: boolean
|
|
1837
1944
|
}
|
|
1838
1945
|
|
|
1946
|
+
export { rollupVersion }
|
|
1947
|
+
|
|
1839
1948
|
/**
|
|
1840
1949
|
* Search up for the nearest workspace root
|
|
1841
1950
|
*/
|
|
@@ -1886,6 +1995,13 @@ export declare interface ServerOptions extends CommonServerOptions {
|
|
|
1886
1995
|
* @default true
|
|
1887
1996
|
*/
|
|
1888
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;
|
|
1889
2005
|
}
|
|
1890
2006
|
|
|
1891
2007
|
export declare function sortUserPlugins(plugins: (Plugin_2 | Plugin_2[])[] | undefined): [Plugin_2[], Plugin_2[], Plugin_2[]];
|
|
@@ -1902,11 +2018,13 @@ export declare class SplitVendorChunkCache {
|
|
|
1902
2018
|
|
|
1903
2019
|
export declare function splitVendorChunkPlugin(): Plugin_2;
|
|
1904
2020
|
|
|
2021
|
+
export declare type SsrDepOptimizationOptions = DepOptimizationConfig;
|
|
2022
|
+
|
|
1905
2023
|
export declare type SSRFormat = 'esm' | 'cjs';
|
|
1906
2024
|
|
|
1907
2025
|
export declare interface SSROptions {
|
|
1908
|
-
external?: string[];
|
|
1909
2026
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
|
2027
|
+
external?: string[];
|
|
1910
2028
|
/**
|
|
1911
2029
|
* Define the target for the ssr build. The browser field in package.json
|
|
1912
2030
|
* is ignored for node but used if webworker is the target
|
|
@@ -1921,6 +2039,15 @@ export declare interface SSROptions {
|
|
|
1921
2039
|
* @experimental
|
|
1922
2040
|
*/
|
|
1923
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;
|
|
1924
2051
|
}
|
|
1925
2052
|
|
|
1926
2053
|
export declare type SSRTarget = 'node' | 'webworker';
|
|
@@ -2204,11 +2331,6 @@ export declare interface UserConfig {
|
|
|
2204
2331
|
* Preview specific options, e.g. host, port, https...
|
|
2205
2332
|
*/
|
|
2206
2333
|
preview?: PreviewOptions;
|
|
2207
|
-
/**
|
|
2208
|
-
* Force dep pre-optimization regardless of whether deps have changed.
|
|
2209
|
-
* @experimental
|
|
2210
|
-
*/
|
|
2211
|
-
force?: boolean;
|
|
2212
2334
|
/**
|
|
2213
2335
|
* Dep optimization options
|
|
2214
2336
|
*/
|
|
@@ -2220,11 +2342,18 @@ export declare interface UserConfig {
|
|
|
2220
2342
|
/**
|
|
2221
2343
|
* Experimental features
|
|
2222
2344
|
*
|
|
2223
|
-
* Features under this field
|
|
2345
|
+
* Features under this field could change in the future and might NOT follow semver.
|
|
2224
2346
|
* Please be careful and always pin Vite's version when using them.
|
|
2225
2347
|
* @experimental
|
|
2226
2348
|
*/
|
|
2227
2349
|
experimental?: ExperimentalOptions;
|
|
2350
|
+
/**
|
|
2351
|
+
* Legacy options
|
|
2352
|
+
*
|
|
2353
|
+
* Features under this field only follow semver for patches, they could be removed in a
|
|
2354
|
+
* future minor version. Please always pin Vite's version to a minor when using them.
|
|
2355
|
+
*/
|
|
2356
|
+
legacy?: LegacyOptions;
|
|
2228
2357
|
/**
|
|
2229
2358
|
* Log level.
|
|
2230
2359
|
* Default: 'info'
|
|
@@ -2268,17 +2397,20 @@ export declare interface UserConfig {
|
|
|
2268
2397
|
rollupOptions?: Omit<RollupOptions, 'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures'>;
|
|
2269
2398
|
};
|
|
2270
2399
|
/**
|
|
2271
|
-
* Whether your application is a Single Page Application (SPA)
|
|
2272
|
-
*
|
|
2273
|
-
*
|
|
2400
|
+
* Whether your application is a Single Page Application (SPA),
|
|
2401
|
+
* a Multi-Page Application (MPA), or Custom Application (SSR
|
|
2402
|
+
* and frameworks with custom HTML handling)
|
|
2403
|
+
* @default 'spa'
|
|
2274
2404
|
*/
|
|
2275
|
-
|
|
2405
|
+
appType?: AppType;
|
|
2276
2406
|
}
|
|
2277
2407
|
|
|
2278
2408
|
export declare type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFn;
|
|
2279
2409
|
|
|
2280
2410
|
export declare type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
|
|
2281
2411
|
|
|
2412
|
+
export declare const version: string;
|
|
2413
|
+
|
|
2282
2414
|
export declare interface ViteDevServer {
|
|
2283
2415
|
/**
|
|
2284
2416
|
* The resolved vite config object
|
|
@@ -2316,6 +2448,13 @@ export declare interface ViteDevServer {
|
|
|
2316
2448
|
* and hmr state.
|
|
2317
2449
|
*/
|
|
2318
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;
|
|
2319
2458
|
/**
|
|
2320
2459
|
* Programmatically resolve, load and transform a URL and get the result
|
|
2321
2460
|
* without going through the http request pipeline.
|
package/dist/node/index.js
CHANGED
|
@@ -1,29 +1,42 @@
|
|
|
1
|
-
export { b as build,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
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
|
+
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
|
-
import 'resolve';
|
|
12
15
|
import 'util';
|
|
13
16
|
import 'net';
|
|
17
|
+
import 'url';
|
|
14
18
|
import 'http';
|
|
15
19
|
import 'stream';
|
|
16
20
|
import 'os';
|
|
17
21
|
import 'child_process';
|
|
22
|
+
import 'node:os';
|
|
23
|
+
import 'node:crypto';
|
|
24
|
+
import 'node:util';
|
|
25
|
+
import 'node:dns';
|
|
26
|
+
import 'resolve';
|
|
18
27
|
import 'crypto';
|
|
19
|
-
import './constants.js';
|
|
20
28
|
import 'buffer';
|
|
21
|
-
import '
|
|
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';
|
|
36
|
+
import 'querystring';
|
|
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)($|\\?)`;
|