vite 3.1.7 → 3.2.0-beta.1
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/client.d.ts +38 -11
- package/dist/client/client.mjs +27 -22
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-0ebb5606.js → dep-34b5a6bf.js} +1160 -702
- package/dist/node/chunks/{dep-42c2c4e4.js → dep-39e6741e.js} +0 -0
- package/dist/node/chunks/{dep-77359784.js → dep-46ac452b.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/constants.js +1 -1
- package/dist/node/index.d.ts +88 -165
- package/dist/node/index.js +1 -1
- package/dist/node-cjs/publicUtils.cjs +42 -28
- package/package.json +24 -17
- package/src/client/client.ts +4 -3
- package/src/client/overlay.ts +23 -19
- package/src/client/tsconfig.json +1 -1
- package/types/alias.d.ts +6 -59
- package/types/anymatch.d.ts +1 -5
- package/types/chokidar.d.ts +6 -224
- package/types/commonjs.d.ts +1 -230
- package/types/connect.d.ts +1 -111
- package/types/customEvent.d.ts +5 -0
- package/types/dynamicImportVars.d.ts +1 -17
- package/types/http-proxy.d.ts +1 -250
- package/types/importMeta.d.ts +7 -14
- package/types/package.json +1 -1
- package/types/terser.d.ts +1 -250
- package/types/ws.d.ts +1 -553
- package/types/shims.d.ts +0 -96
|
File without changes
|
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 { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-
|
|
3
|
+
import { y as picocolors, u as createLogger, e as resolveConfig } from './chunks/dep-34b5a6bf.js';
|
|
4
4
|
import { VERSION } from './constants.js';
|
|
5
5
|
import 'node:fs';
|
|
6
6
|
import 'node:path';
|
|
@@ -695,7 +695,7 @@ cli
|
|
|
695
695
|
.action(async (root, options) => {
|
|
696
696
|
// output structure is preserved even after bundling so require()
|
|
697
697
|
// is ok here
|
|
698
|
-
const { createServer } = await import('./chunks/dep-
|
|
698
|
+
const { createServer } = await import('./chunks/dep-34b5a6bf.js').then(function (n) { return n.C; });
|
|
699
699
|
try {
|
|
700
700
|
const server = await createServer({
|
|
701
701
|
root,
|
|
@@ -742,7 +742,7 @@ cli
|
|
|
742
742
|
.option('--emptyOutDir', `[boolean] force empty outDir when it's outside of root`)
|
|
743
743
|
.option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
|
|
744
744
|
.action(async (root, options) => {
|
|
745
|
-
const { build } = await import('./chunks/dep-
|
|
745
|
+
const { build } = await import('./chunks/dep-34b5a6bf.js').then(function (n) { return n.B; });
|
|
746
746
|
const buildOptions = cleanOptions(options);
|
|
747
747
|
try {
|
|
748
748
|
await build({
|
|
@@ -766,7 +766,7 @@ cli
|
|
|
766
766
|
.command('optimize [root]', 'pre-bundle dependencies')
|
|
767
767
|
.option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
|
|
768
768
|
.action(async (root, options) => {
|
|
769
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
|
769
|
+
const { optimizeDeps } = await import('./chunks/dep-34b5a6bf.js').then(function (n) { return n.A; });
|
|
770
770
|
try {
|
|
771
771
|
const config = await resolveConfig({
|
|
772
772
|
root,
|
|
@@ -789,7 +789,7 @@ cli
|
|
|
789
789
|
.option('--https', `[boolean] use TLS + HTTP/2`)
|
|
790
790
|
.option('--open [path]', `[boolean | string] open browser on startup`)
|
|
791
791
|
.action(async (root, options) => {
|
|
792
|
-
const { preview } = await import('./chunks/dep-
|
|
792
|
+
const { preview } = await import('./chunks/dep-34b5a6bf.js').then(function (n) { return n.D; });
|
|
793
793
|
try {
|
|
794
794
|
const server = await preview({
|
|
795
795
|
root,
|
package/dist/node/constants.js
CHANGED
package/dist/node/index.d.ts
CHANGED
|
@@ -4,20 +4,35 @@ import type { Agent } from 'node:http';
|
|
|
4
4
|
import type { BuildOptions as BuildOptions_2 } from 'esbuild';
|
|
5
5
|
import type { ClientRequest } from 'node:http';
|
|
6
6
|
import type { ClientRequestArgs } from 'node:http';
|
|
7
|
+
import { ConnectedPayload } from "../../types/hmrPayload";
|
|
8
|
+
import { CustomEventMap } from "../../types/customEvent";
|
|
9
|
+
import { CustomPayload } from "../../types/hmrPayload";
|
|
7
10
|
import type { CustomPluginOptions } from 'rollup';
|
|
8
11
|
import type { Duplex } from 'node:stream';
|
|
9
12
|
import type { DuplexOptions } from 'node:stream';
|
|
13
|
+
import { ErrorPayload } from "../../types/hmrPayload";
|
|
10
14
|
import { TransformOptions as EsbuildTransformOptions } from 'esbuild';
|
|
11
15
|
import { version as esbuildVersion } from 'esbuild';
|
|
12
16
|
import { EventEmitter } from 'node:events';
|
|
13
17
|
import * as events from 'node:events';
|
|
14
18
|
import type { ExistingRawSourceMap } from 'rollup';
|
|
15
19
|
import type * as fs from 'node:fs';
|
|
20
|
+
import { FullReloadPayload } from "../../types/hmrPayload";
|
|
21
|
+
import { GeneralImportGlobOptions } from "../../types/importGlob";
|
|
16
22
|
import type { GetManualChunk } from 'rollup';
|
|
23
|
+
import { HMRPayload } from "../../types/hmrPayload";
|
|
17
24
|
import * as http from 'node:http';
|
|
25
|
+
import { ImportGlobEagerFunction } from "../../types/importGlob";
|
|
26
|
+
import { ImportGlobFunction } from "../../types/importGlob";
|
|
27
|
+
import { ImportGlobOptions } from "../../types/importGlob";
|
|
18
28
|
import type { IncomingMessage } from 'node:http';
|
|
29
|
+
import { InferCustomEventPayload } from "../../types/customEvent";
|
|
30
|
+
import type { InputOption } from 'rollup';
|
|
19
31
|
import type { InputOptions } from 'rollup';
|
|
32
|
+
import { InvalidatePayload } from "../../types/customEvent";
|
|
33
|
+
import { KnownAsTypeMap } from "../../types/importGlob";
|
|
20
34
|
import type { LoadResult } from 'rollup';
|
|
35
|
+
import type { Matcher as Matcher_2 } from 'picomatch';
|
|
21
36
|
import type { ModuleFormat } from 'rollup';
|
|
22
37
|
import type { ModuleInfo } from 'rollup';
|
|
23
38
|
import type * as net from 'node:net';
|
|
@@ -30,6 +45,7 @@ import type { Plugin as Plugin_3 } from 'rollup';
|
|
|
30
45
|
import type { PluginContext } from 'rollup';
|
|
31
46
|
import type { PluginHooks } from 'rollup';
|
|
32
47
|
import type * as PostCSS from 'postcss';
|
|
48
|
+
import { PrunePayload } from "../../types/hmrPayload";
|
|
33
49
|
import type { ResolveIdResult } from 'rollup';
|
|
34
50
|
import type { RollupError } from 'rollup';
|
|
35
51
|
import type { RollupOptions } from 'rollup';
|
|
@@ -47,6 +63,8 @@ import type * as stream from 'node:stream';
|
|
|
47
63
|
import type { TransformPluginContext } from 'rollup';
|
|
48
64
|
import type { TransformResult as TransformResult_2 } from 'rollup';
|
|
49
65
|
import type { TransformResult as TransformResult_3 } from 'esbuild';
|
|
66
|
+
import { Update } from "../../types/hmrPayload";
|
|
67
|
+
import { UpdatePayload } from "../../types/hmrPayload";
|
|
50
68
|
import type * as url from 'node:url';
|
|
51
69
|
import type { URL as URL_2 } from 'node:url';
|
|
52
70
|
import type { WatcherOptions } from 'rollup';
|
|
@@ -127,8 +145,15 @@ export declare interface BuildOptions {
|
|
|
127
145
|
* whether to inject module preload polyfill.
|
|
128
146
|
* Note: does not apply to library mode.
|
|
129
147
|
* @default true
|
|
148
|
+
* @deprecated use `modulePreload.polyfill` instead
|
|
130
149
|
*/
|
|
131
150
|
polyfillModulePreload?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Configure module preload
|
|
153
|
+
* Note: does not apply to library mode.
|
|
154
|
+
* @default true
|
|
155
|
+
*/
|
|
156
|
+
modulePreload?: boolean | ModulePreloadOptions;
|
|
132
157
|
/**
|
|
133
158
|
* Directory relative from `root` where build output will be placed. If the
|
|
134
159
|
* directory exists, it will be removed before the build.
|
|
@@ -433,9 +458,7 @@ export declare namespace Connect {
|
|
|
433
458
|
}
|
|
434
459
|
}
|
|
435
460
|
|
|
436
|
-
export
|
|
437
|
-
type: 'connected'
|
|
438
|
-
}
|
|
461
|
+
export { ConnectedPayload }
|
|
439
462
|
|
|
440
463
|
/**
|
|
441
464
|
* https://github.com/expressjs/cors#configuration-options
|
|
@@ -490,18 +513,9 @@ export declare interface CSSOptions {
|
|
|
490
513
|
devSourcemap?: boolean;
|
|
491
514
|
}
|
|
492
515
|
|
|
493
|
-
export
|
|
494
|
-
'vite:beforeUpdate': UpdatePayload
|
|
495
|
-
'vite:beforePrune': PrunePayload
|
|
496
|
-
'vite:beforeFullReload': FullReloadPayload
|
|
497
|
-
'vite:error': ErrorPayload
|
|
498
|
-
}
|
|
516
|
+
export { CustomEventMap }
|
|
499
517
|
|
|
500
|
-
export
|
|
501
|
-
type: 'custom'
|
|
502
|
-
event: string
|
|
503
|
-
data?: any
|
|
504
|
-
}
|
|
518
|
+
export { CustomPayload }
|
|
505
519
|
|
|
506
520
|
/**
|
|
507
521
|
* Type helper to make it easier to use vite.config.ts
|
|
@@ -637,26 +651,11 @@ export declare interface DepsOptimizer {
|
|
|
637
651
|
registerWorkersSource: (id: string) => void;
|
|
638
652
|
resetRegisteredIds: () => void;
|
|
639
653
|
ensureFirstRun: () => void;
|
|
654
|
+
close: () => Promise<void>;
|
|
640
655
|
options: DepOptimizationOptions;
|
|
641
656
|
}
|
|
642
657
|
|
|
643
|
-
export
|
|
644
|
-
type: 'error'
|
|
645
|
-
err: {
|
|
646
|
-
[name: string]: any
|
|
647
|
-
message: string
|
|
648
|
-
stack: string
|
|
649
|
-
id?: string
|
|
650
|
-
frame?: string
|
|
651
|
-
plugin?: string
|
|
652
|
-
pluginCode?: string
|
|
653
|
-
loc?: {
|
|
654
|
-
file?: string
|
|
655
|
-
line: number
|
|
656
|
-
column: number
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
}
|
|
658
|
+
export { ErrorPayload }
|
|
660
659
|
|
|
661
660
|
export declare interface ESBuildOptions extends EsbuildTransformOptions {
|
|
662
661
|
include?: string | RegExp | string[] | RegExp[];
|
|
@@ -727,7 +726,7 @@ export declare interface FileSystemServeOptions {
|
|
|
727
726
|
* Restrict accessing files that matches the patterns.
|
|
728
727
|
*
|
|
729
728
|
* This will have higher priority than `allow`.
|
|
730
|
-
*
|
|
729
|
+
* picomatch patterns are supported.
|
|
731
730
|
*
|
|
732
731
|
* @default ['.env', '.env.*', '*.crt', '*.pem']
|
|
733
732
|
*/
|
|
@@ -813,10 +812,9 @@ export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
|
|
813
812
|
on(event: string, listener: (...args: any[]) => void): this
|
|
814
813
|
}
|
|
815
814
|
|
|
816
|
-
export
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
}
|
|
815
|
+
export { FullReloadPayload }
|
|
816
|
+
|
|
817
|
+
export { GeneralImportGlobOptions }
|
|
820
818
|
|
|
821
819
|
export declare function getDepOptimizationConfig(config: ResolvedConfig, ssr: boolean): DepOptimizationConfig;
|
|
822
820
|
|
|
@@ -839,13 +837,7 @@ export declare interface HmrOptions {
|
|
|
839
837
|
server?: Server;
|
|
840
838
|
}
|
|
841
839
|
|
|
842
|
-
export
|
|
843
|
-
| ConnectedPayload
|
|
844
|
-
| UpdatePayload
|
|
845
|
-
| FullReloadPayload
|
|
846
|
-
| CustomPayload
|
|
847
|
-
| ErrorPayload
|
|
848
|
-
| PrunePayload
|
|
840
|
+
export { HMRPayload }
|
|
849
841
|
|
|
850
842
|
export declare type HookHandler<T> = T extends ObjectHook<infer H> ? H : T;
|
|
851
843
|
|
|
@@ -1089,95 +1081,11 @@ export declare namespace HttpProxy {
|
|
|
1089
1081
|
}
|
|
1090
1082
|
}
|
|
1091
1083
|
|
|
1092
|
-
export
|
|
1093
|
-
/**
|
|
1094
|
-
* Eagerly import a list of files with a glob pattern.
|
|
1095
|
-
*
|
|
1096
|
-
* Overload 1: No generic provided, infer the type from `as`
|
|
1097
|
-
*/
|
|
1098
|
-
<
|
|
1099
|
-
As extends string,
|
|
1100
|
-
T = As extends keyof KnownAsTypeMap ? KnownAsTypeMap[As] : unknown
|
|
1101
|
-
>(
|
|
1102
|
-
glob: string | string[],
|
|
1103
|
-
options?: Omit<ImportGlobOptions<boolean, As>, 'eager'>
|
|
1104
|
-
): Record<string, T>
|
|
1105
|
-
/**
|
|
1106
|
-
* Eagerly import a list of files with a glob pattern.
|
|
1107
|
-
*
|
|
1108
|
-
* Overload 2: Module generic provided
|
|
1109
|
-
*/
|
|
1110
|
-
<M>(
|
|
1111
|
-
glob: string | string[],
|
|
1112
|
-
options?: Omit<ImportGlobOptions<boolean, string>, 'eager'>
|
|
1113
|
-
): Record<string, M>
|
|
1114
|
-
}
|
|
1084
|
+
export { ImportGlobEagerFunction }
|
|
1115
1085
|
|
|
1116
|
-
export
|
|
1117
|
-
/**
|
|
1118
|
-
* Import a list of files with a glob pattern.
|
|
1119
|
-
*
|
|
1120
|
-
* Overload 1: No generic provided, infer the type from `eager` and `as`
|
|
1121
|
-
*/
|
|
1122
|
-
<
|
|
1123
|
-
Eager extends boolean,
|
|
1124
|
-
As extends string,
|
|
1125
|
-
T = As extends keyof KnownAsTypeMap ? KnownAsTypeMap[As] : unknown
|
|
1126
|
-
>(
|
|
1127
|
-
glob: string | string[],
|
|
1128
|
-
options?: ImportGlobOptions<Eager, As>
|
|
1129
|
-
): (Eager extends true ? true : false) extends true
|
|
1130
|
-
? Record<string, T>
|
|
1131
|
-
: Record<string, () => Promise<T>>
|
|
1132
|
-
/**
|
|
1133
|
-
* Import a list of files with a glob pattern.
|
|
1134
|
-
*
|
|
1135
|
-
* Overload 2: Module generic provided, infer the type from `eager: false`
|
|
1136
|
-
*/
|
|
1137
|
-
<M>(
|
|
1138
|
-
glob: string | string[],
|
|
1139
|
-
options?: ImportGlobOptions<false, string>
|
|
1140
|
-
): Record<string, () => Promise<M>>
|
|
1141
|
-
/**
|
|
1142
|
-
* Import a list of files with a glob pattern.
|
|
1143
|
-
*
|
|
1144
|
-
* Overload 3: Module generic provided, infer the type from `eager: true`
|
|
1145
|
-
*/
|
|
1146
|
-
<M>(
|
|
1147
|
-
glob: string | string[],
|
|
1148
|
-
options: ImportGlobOptions<true, string>
|
|
1149
|
-
): Record<string, M>
|
|
1150
|
-
}
|
|
1086
|
+
export { ImportGlobFunction }
|
|
1151
1087
|
|
|
1152
|
-
export
|
|
1153
|
-
Eager extends boolean,
|
|
1154
|
-
AsType extends string
|
|
1155
|
-
> {
|
|
1156
|
-
/**
|
|
1157
|
-
* Import type for the import url.
|
|
1158
|
-
*/
|
|
1159
|
-
as?: AsType
|
|
1160
|
-
/**
|
|
1161
|
-
* Import as static or dynamic
|
|
1162
|
-
*
|
|
1163
|
-
* @default false
|
|
1164
|
-
*/
|
|
1165
|
-
eager?: Eager
|
|
1166
|
-
/**
|
|
1167
|
-
* Import only the specific named export. Set to `default` to import the default export.
|
|
1168
|
-
*/
|
|
1169
|
-
import?: string
|
|
1170
|
-
/**
|
|
1171
|
-
* Custom queries
|
|
1172
|
-
*/
|
|
1173
|
-
query?: string | Record<string, string | number | boolean>
|
|
1174
|
-
/**
|
|
1175
|
-
* Search files also inside `node_modules/` and hidden directories (e.g. `.git/`). This might have impact on performance.
|
|
1176
|
-
*
|
|
1177
|
-
* @default false
|
|
1178
|
-
*/
|
|
1179
|
-
exhaustive?: boolean
|
|
1180
|
-
}
|
|
1088
|
+
export { ImportGlobOptions }
|
|
1181
1089
|
|
|
1182
1090
|
export declare type IndexHtmlTransform = IndexHtmlTransformHook | {
|
|
1183
1091
|
enforce?: 'pre' | 'post';
|
|
@@ -1206,15 +1114,14 @@ export declare type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
|
|
|
1206
1114
|
tags: HtmlTagDescriptor[];
|
|
1207
1115
|
};
|
|
1208
1116
|
|
|
1209
|
-
export
|
|
1210
|
-
T extends keyof CustomEventMap ? CustomEventMap[T] : any
|
|
1117
|
+
export { InferCustomEventPayload }
|
|
1211
1118
|
|
|
1212
1119
|
export declare interface InlineConfig extends UserConfig {
|
|
1213
1120
|
configFile?: string | false;
|
|
1214
1121
|
envFile?: false;
|
|
1215
1122
|
}
|
|
1216
1123
|
|
|
1217
|
-
export declare interface InternalResolveOptions extends ResolveOptions {
|
|
1124
|
+
export declare interface InternalResolveOptions extends Required<ResolveOptions> {
|
|
1218
1125
|
root: string;
|
|
1219
1126
|
isBuild: boolean;
|
|
1220
1127
|
isProduction: boolean;
|
|
@@ -1230,7 +1137,6 @@ export declare interface InternalResolveOptions extends ResolveOptions {
|
|
|
1230
1137
|
tryPrefix?: string;
|
|
1231
1138
|
skipPackageJson?: boolean;
|
|
1232
1139
|
preferRelative?: boolean;
|
|
1233
|
-
preserveSymlinks?: boolean;
|
|
1234
1140
|
isRequire?: boolean;
|
|
1235
1141
|
isFromTsImporter?: boolean;
|
|
1236
1142
|
tryEsmOnly?: boolean;
|
|
@@ -1240,6 +1146,8 @@ export declare interface InternalResolveOptions extends ResolveOptions {
|
|
|
1240
1146
|
shouldExternalize?: (id: string) => boolean | undefined;
|
|
1241
1147
|
}
|
|
1242
1148
|
|
|
1149
|
+
export { InvalidatePayload }
|
|
1150
|
+
|
|
1243
1151
|
export declare function isDepsOptimizerEnabled(config: ResolvedConfig, ssr: boolean): boolean;
|
|
1244
1152
|
|
|
1245
1153
|
export declare interface JsonOptions {
|
|
@@ -1256,11 +1164,7 @@ export declare interface JsonOptions {
|
|
|
1256
1164
|
stringify?: boolean;
|
|
1257
1165
|
}
|
|
1258
1166
|
|
|
1259
|
-
export
|
|
1260
|
-
raw: string
|
|
1261
|
-
url: string
|
|
1262
|
-
worker: Worker
|
|
1263
|
-
}
|
|
1167
|
+
export { KnownAsTypeMap }
|
|
1264
1168
|
|
|
1265
1169
|
export declare interface LegacyOptions {
|
|
1266
1170
|
/**
|
|
@@ -1279,7 +1183,7 @@ export declare interface LibraryOptions {
|
|
|
1279
1183
|
/**
|
|
1280
1184
|
* Path of library entry
|
|
1281
1185
|
*/
|
|
1282
|
-
entry:
|
|
1186
|
+
entry: InputOption;
|
|
1283
1187
|
/**
|
|
1284
1188
|
* The name of the exposed global variable. Required when the `formats` option includes
|
|
1285
1189
|
* `umd` or `iife`
|
|
@@ -1295,7 +1199,7 @@ export declare interface LibraryOptions {
|
|
|
1295
1199
|
* of the project package.json. It can also be defined as a function taking the
|
|
1296
1200
|
* format as an argument.
|
|
1297
1201
|
*/
|
|
1298
|
-
fileName?: string | ((format: ModuleFormat) => string);
|
|
1202
|
+
fileName?: string | ((format: ModuleFormat, entryName: string) => string);
|
|
1299
1203
|
}
|
|
1300
1204
|
|
|
1301
1205
|
export declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel): Promise<{
|
|
@@ -1348,6 +1252,8 @@ export declare interface ManifestChunk {
|
|
|
1348
1252
|
dynamicImports?: string[];
|
|
1349
1253
|
}
|
|
1350
1254
|
|
|
1255
|
+
export declare type MapToFunction<T> = T extends Function ? T : never
|
|
1256
|
+
|
|
1351
1257
|
export declare type Matcher = AnymatchPattern | AnymatchPattern[]
|
|
1352
1258
|
|
|
1353
1259
|
export declare function mergeAlias(a?: AliasOptions, b?: AliasOptions): AliasOptions | undefined;
|
|
@@ -1409,6 +1315,20 @@ export declare class ModuleNode {
|
|
|
1409
1315
|
constructor(url: string, setIsSelfAccepting?: boolean);
|
|
1410
1316
|
}
|
|
1411
1317
|
|
|
1318
|
+
export declare interface ModulePreloadOptions {
|
|
1319
|
+
/**
|
|
1320
|
+
* Whether to inject a module preload polyfill.
|
|
1321
|
+
* Note: does not apply to library mode.
|
|
1322
|
+
* @default true
|
|
1323
|
+
*/
|
|
1324
|
+
polyfill?: boolean;
|
|
1325
|
+
/**
|
|
1326
|
+
* Resolve the list of dependencies to preload for a given dynamic import
|
|
1327
|
+
* @experimental
|
|
1328
|
+
*/
|
|
1329
|
+
resolveDependencies?: ResolveModulePreloadDependenciesFn;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1412
1332
|
export declare function normalizePath(id: string): string;
|
|
1413
1333
|
|
|
1414
1334
|
export declare interface OptimizedDepInfo {
|
|
@@ -1539,7 +1459,7 @@ declare interface Plugin_2 extends Plugin_3 {
|
|
|
1539
1459
|
* - bundle?: rollup.OutputBundle (only present during build)
|
|
1540
1460
|
*
|
|
1541
1461
|
* It can either return a transformed string, or a list of html tag
|
|
1542
|
-
* descriptors that will be injected into the
|
|
1462
|
+
* descriptors that will be injected into the `<head>` or `<body>`.
|
|
1543
1463
|
*
|
|
1544
1464
|
* By default the transform is applied **after** vite's internal html
|
|
1545
1465
|
* transform. If you need to apply the transform before vite, use an object:
|
|
@@ -1655,10 +1575,7 @@ export declare interface ProxyOptions extends HttpProxy.ServerOptions {
|
|
|
1655
1575
|
bypass?: (req: http.IncomingMessage, res: http.ServerResponse, options: ProxyOptions) => void | null | undefined | false | string;
|
|
1656
1576
|
}
|
|
1657
1577
|
|
|
1658
|
-
export
|
|
1659
|
-
type: 'prune'
|
|
1660
|
-
paths: string[]
|
|
1661
|
-
}
|
|
1578
|
+
export { PrunePayload }
|
|
1662
1579
|
|
|
1663
1580
|
export declare type RenderBuiltAssetUrl = (filename: string, type: {
|
|
1664
1581
|
type: 'asset' | 'public';
|
|
@@ -1678,7 +1595,9 @@ export declare function resolveBaseUrl(base: string | undefined, isBuild: boolea
|
|
|
1678
1595
|
|
|
1679
1596
|
export declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string): Promise<ResolvedConfig>;
|
|
1680
1597
|
|
|
1681
|
-
export declare
|
|
1598
|
+
export declare interface ResolvedBuildOptions extends Required<Omit<BuildOptions, 'polyfillModulePreload'>> {
|
|
1599
|
+
modulePreload: false | ResolvedModulePreloadOptions;
|
|
1600
|
+
}
|
|
1682
1601
|
|
|
1683
1602
|
export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'assetsInclude' | 'optimizeDeps' | 'worker'> & {
|
|
1684
1603
|
configFile: string | undefined;
|
|
@@ -1694,7 +1613,7 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
|
|
|
1694
1613
|
/* Excluded from this release type: mainConfig */
|
|
1695
1614
|
isProduction: boolean;
|
|
1696
1615
|
env: Record<string, any>;
|
|
1697
|
-
resolve: ResolveOptions & {
|
|
1616
|
+
resolve: Required<ResolveOptions> & {
|
|
1698
1617
|
alias: Alias[];
|
|
1699
1618
|
};
|
|
1700
1619
|
plugins: readonly Plugin_2[];
|
|
@@ -1712,6 +1631,11 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
|
|
|
1712
1631
|
experimental: ExperimentalOptions;
|
|
1713
1632
|
} & PluginHookUtils>;
|
|
1714
1633
|
|
|
1634
|
+
export declare interface ResolvedModulePreloadOptions {
|
|
1635
|
+
polyfill: boolean;
|
|
1636
|
+
resolveDependencies?: ResolveModulePreloadDependenciesFn;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1715
1639
|
export declare interface ResolvedPreviewOptions extends PreviewOptions {
|
|
1716
1640
|
}
|
|
1717
1641
|
|
|
@@ -1741,8 +1665,18 @@ export declare function resolveEnvPrefix({ envPrefix }: UserConfig): string[];
|
|
|
1741
1665
|
|
|
1742
1666
|
export declare type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
|
|
1743
1667
|
|
|
1668
|
+
export declare type ResolveModulePreloadDependenciesFn = (filename: string, deps: string[], context: {
|
|
1669
|
+
hostId: string;
|
|
1670
|
+
hostType: 'html' | 'js';
|
|
1671
|
+
}) => string[];
|
|
1672
|
+
|
|
1744
1673
|
export declare interface ResolveOptions {
|
|
1745
1674
|
mainFields?: string[];
|
|
1675
|
+
/**
|
|
1676
|
+
* @deprecated In future, `mainFields` should be used instead.
|
|
1677
|
+
* @default true
|
|
1678
|
+
*/
|
|
1679
|
+
browserField?: boolean;
|
|
1746
1680
|
conditions?: string[];
|
|
1747
1681
|
extensions?: string[];
|
|
1748
1682
|
dedupe?: string[];
|
|
@@ -1753,7 +1687,7 @@ export declare function resolvePackageData(id: string, basedir: string, preserve
|
|
|
1753
1687
|
|
|
1754
1688
|
export declare function resolvePackageEntry(id: string, { dir, data, setResolvedCache, getResolvedCache }: PackageData, targetWeb: boolean, options: InternalResolveOptions): string | undefined;
|
|
1755
1689
|
|
|
1756
|
-
export declare type ResolverFunction = PluginHooks['resolveId']
|
|
1690
|
+
export declare type ResolverFunction = MapToFunction<PluginHooks['resolveId']>
|
|
1757
1691
|
|
|
1758
1692
|
export declare interface ResolverObject {
|
|
1759
1693
|
buildStart?: PluginHooks['buildStart']
|
|
@@ -2354,21 +2288,9 @@ export declare interface TransformResult {
|
|
|
2354
2288
|
|
|
2355
2289
|
export declare function transformWithEsbuild(code: string, filename: string, options?: EsbuildTransformOptions, inMap?: object): Promise<ESBuildTransformResult>;
|
|
2356
2290
|
|
|
2357
|
-
export
|
|
2358
|
-
type: 'js-update' | 'css-update'
|
|
2359
|
-
path: string
|
|
2360
|
-
acceptedPath: string
|
|
2361
|
-
timestamp: number
|
|
2362
|
-
/**
|
|
2363
|
-
* @experimental internal
|
|
2364
|
-
*/
|
|
2365
|
-
explicitImportRequired?: boolean | undefined
|
|
2366
|
-
}
|
|
2291
|
+
export { Update }
|
|
2367
2292
|
|
|
2368
|
-
export
|
|
2369
|
-
type: 'update'
|
|
2370
|
-
updates: Update[]
|
|
2371
|
-
}
|
|
2293
|
+
export { UpdatePayload }
|
|
2372
2294
|
|
|
2373
2295
|
export declare interface UserConfig {
|
|
2374
2296
|
/**
|
|
@@ -2385,7 +2307,7 @@ export declare interface UserConfig {
|
|
|
2385
2307
|
/**
|
|
2386
2308
|
* Directory to serve as plain static assets. Files in this directory are
|
|
2387
2309
|
* served and copied to build dist dir as-is without transform. The value
|
|
2388
|
-
* can be either an absolute file system path or a path relative to
|
|
2310
|
+
* can be either an absolute file system path or a path relative to project root.
|
|
2389
2311
|
*
|
|
2390
2312
|
* Set to `false` or an empty string to disable copied static assets to build dist dir.
|
|
2391
2313
|
* @default 'public'
|
|
@@ -2396,7 +2318,7 @@ export declare interface UserConfig {
|
|
|
2396
2318
|
* deps or some other cache files that generated by vite, which can improve
|
|
2397
2319
|
* the performance. You can use `--force` flag or manually delete the directory
|
|
2398
2320
|
* to regenerate the cache files. The value can be either an absolute file
|
|
2399
|
-
* system path or a path relative to
|
|
2321
|
+
* system path or a path relative to project root.
|
|
2400
2322
|
* Default to `.vite` when no `package.json` is detected.
|
|
2401
2323
|
* @default 'node_modules/.vite'
|
|
2402
2324
|
*/
|
|
@@ -2622,6 +2544,7 @@ export declare interface ViteDevServer {
|
|
|
2622
2544
|
/* Excluded from this release type: _restartPromise */
|
|
2623
2545
|
/* Excluded from this release type: _forceOptimizeOnRestart */
|
|
2624
2546
|
/* Excluded from this release type: _pendingRequests */
|
|
2547
|
+
/* Excluded from this release type: _fsDenyGlob */
|
|
2625
2548
|
}
|
|
2626
2549
|
|
|
2627
2550
|
export declare interface WatchOptions {
|
package/dist/node/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-34b5a6bf.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';
|
|
@@ -31,7 +31,7 @@ var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
|
|
|
31
31
|
var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
|
|
32
32
|
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
|
|
33
33
|
|
|
34
|
-
var version = "3.1
|
|
34
|
+
var version = "3.2.0-beta.1";
|
|
35
35
|
|
|
36
36
|
const VERSION = version;
|
|
37
37
|
const VITE_PACKAGE_DIR = path$3.resolve(
|
|
@@ -155,6 +155,18 @@ for (let i = 0; i < chars.length; i++) {
|
|
|
155
155
|
charToInt[c] = i;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
// Matches the scheme of a URL, eg "http://"
|
|
159
|
+
var UrlType;
|
|
160
|
+
(function (UrlType) {
|
|
161
|
+
UrlType[UrlType["Empty"] = 1] = "Empty";
|
|
162
|
+
UrlType[UrlType["Hash"] = 2] = "Hash";
|
|
163
|
+
UrlType[UrlType["Query"] = 3] = "Query";
|
|
164
|
+
UrlType[UrlType["RelativePath"] = 4] = "RelativePath";
|
|
165
|
+
UrlType[UrlType["AbsolutePath"] = 5] = "AbsolutePath";
|
|
166
|
+
UrlType[UrlType["SchemeRelative"] = 6] = "SchemeRelative";
|
|
167
|
+
UrlType[UrlType["Absolute"] = 7] = "Absolute";
|
|
168
|
+
})(UrlType || (UrlType = {}));
|
|
169
|
+
|
|
158
170
|
function getDefaultExportFromCjs (x) {
|
|
159
171
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
160
172
|
}
|
|
@@ -4166,10 +4178,10 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
|
4166
4178
|
prefixes = arraify(prefixes);
|
|
4167
4179
|
const env = {};
|
|
4168
4180
|
const envFiles = [
|
|
4169
|
-
/**
|
|
4170
|
-
/** mode file */ `.env.${mode}`,
|
|
4181
|
+
/** default file */ `.env`,
|
|
4171
4182
|
/** local file */ `.env.local`,
|
|
4172
|
-
/**
|
|
4183
|
+
/** mode file */ `.env.${mode}`,
|
|
4184
|
+
/** mode local file */ `.env.${mode}.local`
|
|
4173
4185
|
];
|
|
4174
4186
|
// check if there are actual env variables starting with VITE_*
|
|
4175
4187
|
// these are typically provided inline and should be prioritized
|
|
@@ -4179,30 +4191,32 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
|
4179
4191
|
env[key] = process.env[key];
|
|
4180
4192
|
}
|
|
4181
4193
|
}
|
|
4182
|
-
|
|
4183
|
-
const path = lookupFile(envDir, [file], {
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4194
|
+
const parsed = Object.fromEntries(envFiles.flatMap((file) => {
|
|
4195
|
+
const path = lookupFile(envDir, [file], {
|
|
4196
|
+
pathOnly: true,
|
|
4197
|
+
rootDir: envDir
|
|
4198
|
+
});
|
|
4199
|
+
if (!path)
|
|
4200
|
+
return [];
|
|
4201
|
+
return Object.entries(main$1.exports.parse(fs__default.readFileSync(path), {
|
|
4202
|
+
debug: process.env.DEBUG?.includes('vite:dotenv')
|
|
4203
|
+
}));
|
|
4204
|
+
}));
|
|
4205
|
+
// let environment variables use each other
|
|
4206
|
+
main({
|
|
4207
|
+
parsed,
|
|
4208
|
+
// prevent process.env mutation
|
|
4209
|
+
ignoreProcessEnv: true
|
|
4210
|
+
});
|
|
4211
|
+
// only keys that start with prefix are exposed to client
|
|
4212
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
4213
|
+
if (prefixes.some((prefix) => key.startsWith(prefix))) {
|
|
4214
|
+
env[key] = value;
|
|
4215
|
+
}
|
|
4216
|
+
else if (key === 'NODE_ENV' &&
|
|
4217
|
+
process.env.VITE_USER_NODE_ENV === undefined) {
|
|
4218
|
+
// NODE_ENV override in .env file
|
|
4219
|
+
process.env.VITE_USER_NODE_ENV = value;
|
|
4206
4220
|
}
|
|
4207
4221
|
}
|
|
4208
4222
|
return env;
|