vite 3.1.4 → 3.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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-42c2c4e4.js → dep-39e6741e.js} +0 -0
- package/dist/node/chunks/{dep-55b95cd5.js → dep-553f6a62.js} +1 -1
- package/dist/node/chunks/{dep-6b3a5aff.js → dep-92763d7a.js} +1072 -655
- package/dist/node/cli.js +5 -5
- package/dist/node/constants.js +1 -1
- package/dist/node/index.d.ts +85 -164
- package/dist/node/index.js +1 -1
- package/dist/node-cjs/publicUtils.cjs +30 -28
- package/package.json +23 -16
- 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/terser.d.ts +1 -250
- package/types/ws.d.ts +1 -553
- package/types/package.json +0 -3
- package/types/shims.d.ts +0 -96
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-92763d7a.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-92763d7a.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-92763d7a.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-92763d7a.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-92763d7a.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<{
|
|
@@ -1409,6 +1313,20 @@ export declare class ModuleNode {
|
|
|
1409
1313
|
constructor(url: string, setIsSelfAccepting?: boolean);
|
|
1410
1314
|
}
|
|
1411
1315
|
|
|
1316
|
+
export declare interface ModulePreloadOptions {
|
|
1317
|
+
/**
|
|
1318
|
+
* Whether to inject a module preload polyfill.
|
|
1319
|
+
* Note: does not apply to library mode.
|
|
1320
|
+
* @default true
|
|
1321
|
+
*/
|
|
1322
|
+
polyfill?: boolean;
|
|
1323
|
+
/**
|
|
1324
|
+
* Resolve the list of dependencies to preload for a given dynamic import
|
|
1325
|
+
* @experimental
|
|
1326
|
+
*/
|
|
1327
|
+
resolveDependencies?: ResolveModulePreloadDependenciesFn;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1412
1330
|
export declare function normalizePath(id: string): string;
|
|
1413
1331
|
|
|
1414
1332
|
export declare interface OptimizedDepInfo {
|
|
@@ -1539,7 +1457,7 @@ declare interface Plugin_2 extends Plugin_3 {
|
|
|
1539
1457
|
* - bundle?: rollup.OutputBundle (only present during build)
|
|
1540
1458
|
*
|
|
1541
1459
|
* It can either return a transformed string, or a list of html tag
|
|
1542
|
-
* descriptors that will be injected into the
|
|
1460
|
+
* descriptors that will be injected into the `<head>` or `<body>`.
|
|
1543
1461
|
*
|
|
1544
1462
|
* By default the transform is applied **after** vite's internal html
|
|
1545
1463
|
* transform. If you need to apply the transform before vite, use an object:
|
|
@@ -1655,10 +1573,7 @@ export declare interface ProxyOptions extends HttpProxy.ServerOptions {
|
|
|
1655
1573
|
bypass?: (req: http.IncomingMessage, res: http.ServerResponse, options: ProxyOptions) => void | null | undefined | false | string;
|
|
1656
1574
|
}
|
|
1657
1575
|
|
|
1658
|
-
export
|
|
1659
|
-
type: 'prune'
|
|
1660
|
-
paths: string[]
|
|
1661
|
-
}
|
|
1576
|
+
export { PrunePayload }
|
|
1662
1577
|
|
|
1663
1578
|
export declare type RenderBuiltAssetUrl = (filename: string, type: {
|
|
1664
1579
|
type: 'asset' | 'public';
|
|
@@ -1678,7 +1593,9 @@ export declare function resolveBaseUrl(base: string | undefined, isBuild: boolea
|
|
|
1678
1593
|
|
|
1679
1594
|
export declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string): Promise<ResolvedConfig>;
|
|
1680
1595
|
|
|
1681
|
-
export declare
|
|
1596
|
+
export declare interface ResolvedBuildOptions extends Required<Omit<BuildOptions, 'polyfillModulePreload'>> {
|
|
1597
|
+
modulePreload: false | ResolvedModulePreloadOptions;
|
|
1598
|
+
}
|
|
1682
1599
|
|
|
1683
1600
|
export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'assetsInclude' | 'optimizeDeps' | 'worker'> & {
|
|
1684
1601
|
configFile: string | undefined;
|
|
@@ -1694,7 +1611,7 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
|
|
|
1694
1611
|
/* Excluded from this release type: mainConfig */
|
|
1695
1612
|
isProduction: boolean;
|
|
1696
1613
|
env: Record<string, any>;
|
|
1697
|
-
resolve: ResolveOptions & {
|
|
1614
|
+
resolve: Required<ResolveOptions> & {
|
|
1698
1615
|
alias: Alias[];
|
|
1699
1616
|
};
|
|
1700
1617
|
plugins: readonly Plugin_2[];
|
|
@@ -1712,6 +1629,11 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'asse
|
|
|
1712
1629
|
experimental: ExperimentalOptions;
|
|
1713
1630
|
} & PluginHookUtils>;
|
|
1714
1631
|
|
|
1632
|
+
export declare interface ResolvedModulePreloadOptions {
|
|
1633
|
+
polyfill: boolean;
|
|
1634
|
+
resolveDependencies?: ResolveModulePreloadDependenciesFn;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1715
1637
|
export declare interface ResolvedPreviewOptions extends PreviewOptions {
|
|
1716
1638
|
}
|
|
1717
1639
|
|
|
@@ -1741,8 +1663,18 @@ export declare function resolveEnvPrefix({ envPrefix }: UserConfig): string[];
|
|
|
1741
1663
|
|
|
1742
1664
|
export declare type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
|
|
1743
1665
|
|
|
1666
|
+
export declare type ResolveModulePreloadDependenciesFn = (filename: string, deps: string[], context: {
|
|
1667
|
+
hostId: string;
|
|
1668
|
+
hostType: 'html' | 'js';
|
|
1669
|
+
}) => string[];
|
|
1670
|
+
|
|
1744
1671
|
export declare interface ResolveOptions {
|
|
1745
1672
|
mainFields?: string[];
|
|
1673
|
+
/**
|
|
1674
|
+
* @deprecated In future, `mainFields` should be used instead.
|
|
1675
|
+
* @default true
|
|
1676
|
+
*/
|
|
1677
|
+
browserField?: boolean;
|
|
1746
1678
|
conditions?: string[];
|
|
1747
1679
|
extensions?: string[];
|
|
1748
1680
|
dedupe?: string[];
|
|
@@ -2354,21 +2286,9 @@ export declare interface TransformResult {
|
|
|
2354
2286
|
|
|
2355
2287
|
export declare function transformWithEsbuild(code: string, filename: string, options?: EsbuildTransformOptions, inMap?: object): Promise<ESBuildTransformResult>;
|
|
2356
2288
|
|
|
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
|
-
}
|
|
2289
|
+
export { Update }
|
|
2367
2290
|
|
|
2368
|
-
export
|
|
2369
|
-
type: 'update'
|
|
2370
|
-
updates: Update[]
|
|
2371
|
-
}
|
|
2291
|
+
export { UpdatePayload }
|
|
2372
2292
|
|
|
2373
2293
|
export declare interface UserConfig {
|
|
2374
2294
|
/**
|
|
@@ -2385,7 +2305,7 @@ export declare interface UserConfig {
|
|
|
2385
2305
|
/**
|
|
2386
2306
|
* Directory to serve as plain static assets. Files in this directory are
|
|
2387
2307
|
* 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
|
|
2308
|
+
* can be either an absolute file system path or a path relative to project root.
|
|
2389
2309
|
*
|
|
2390
2310
|
* Set to `false` or an empty string to disable copied static assets to build dist dir.
|
|
2391
2311
|
* @default 'public'
|
|
@@ -2396,7 +2316,7 @@ export declare interface UserConfig {
|
|
|
2396
2316
|
* deps or some other cache files that generated by vite, which can improve
|
|
2397
2317
|
* the performance. You can use `--force` flag or manually delete the directory
|
|
2398
2318
|
* to regenerate the cache files. The value can be either an absolute file
|
|
2399
|
-
* system path or a path relative to
|
|
2319
|
+
* system path or a path relative to project root.
|
|
2400
2320
|
* Default to `.vite` when no `package.json` is detected.
|
|
2401
2321
|
* @default 'node_modules/.vite'
|
|
2402
2322
|
*/
|
|
@@ -2622,6 +2542,7 @@ export declare interface ViteDevServer {
|
|
|
2622
2542
|
/* Excluded from this release type: _restartPromise */
|
|
2623
2543
|
/* Excluded from this release type: _forceOptimizeOnRestart */
|
|
2624
2544
|
/* Excluded from this release type: _pendingRequests */
|
|
2545
|
+
/* Excluded from this release type: _fsDenyGlob */
|
|
2625
2546
|
}
|
|
2626
2547
|
|
|
2627
2548
|
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-92763d7a.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.
|
|
34
|
+
var version = "3.2.0-beta.0";
|
|
35
35
|
|
|
36
36
|
const VERSION = version;
|
|
37
37
|
const VITE_PACKAGE_DIR = path$3.resolve(
|
|
@@ -4166,10 +4166,10 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
|
4166
4166
|
prefixes = arraify(prefixes);
|
|
4167
4167
|
const env = {};
|
|
4168
4168
|
const envFiles = [
|
|
4169
|
-
/**
|
|
4170
|
-
/** mode file */ `.env.${mode}`,
|
|
4169
|
+
/** default file */ `.env`,
|
|
4171
4170
|
/** local file */ `.env.local`,
|
|
4172
|
-
/**
|
|
4171
|
+
/** mode file */ `.env.${mode}`,
|
|
4172
|
+
/** mode local file */ `.env.${mode}.local`
|
|
4173
4173
|
];
|
|
4174
4174
|
// check if there are actual env variables starting with VITE_*
|
|
4175
4175
|
// these are typically provided inline and should be prioritized
|
|
@@ -4179,30 +4179,32 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
|
4179
4179
|
env[key] = process.env[key];
|
|
4180
4180
|
}
|
|
4181
4181
|
}
|
|
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
|
-
|
|
4182
|
+
const parsed = Object.fromEntries(envFiles.flatMap((file) => {
|
|
4183
|
+
const path = lookupFile(envDir, [file], {
|
|
4184
|
+
pathOnly: true,
|
|
4185
|
+
rootDir: envDir
|
|
4186
|
+
});
|
|
4187
|
+
if (!path)
|
|
4188
|
+
return [];
|
|
4189
|
+
return Object.entries(main$1.exports.parse(fs__default.readFileSync(path), {
|
|
4190
|
+
debug: process.env.DEBUG?.includes('vite:dotenv')
|
|
4191
|
+
}));
|
|
4192
|
+
}));
|
|
4193
|
+
// let environment variables use each other
|
|
4194
|
+
main({
|
|
4195
|
+
parsed,
|
|
4196
|
+
// prevent process.env mutation
|
|
4197
|
+
ignoreProcessEnv: true
|
|
4198
|
+
});
|
|
4199
|
+
// only keys that start with prefix are exposed to client
|
|
4200
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
4201
|
+
if (prefixes.some((prefix) => key.startsWith(prefix))) {
|
|
4202
|
+
env[key] = value;
|
|
4203
|
+
}
|
|
4204
|
+
else if (key === 'NODE_ENV' &&
|
|
4205
|
+
process.env.VITE_USER_NODE_ENV === undefined) {
|
|
4206
|
+
// NODE_ENV override in .env file
|
|
4207
|
+
process.env.VITE_USER_NODE_ENV = value;
|
|
4206
4208
|
}
|
|
4207
4209
|
}
|
|
4208
4210
|
return env;
|