vite 8.0.0-beta.7 → 8.0.0-beta.9
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/dist/client/client.mjs +44 -46
- package/dist/node/chunks/build2.js +108 -108
- package/dist/node/chunks/dist.js +520 -520
- package/dist/node/chunks/logger.js +13 -13
- package/dist/node/chunks/moduleRunnerTransport.d.ts +23 -23
- package/dist/node/chunks/node.js +3788 -3766
- package/dist/node/cli.js +7 -7
- package/dist/node/index.d.ts +1494 -1546
- package/dist/node/module-runner.d.ts +75 -75
- package/dist/node/module-runner.js +20 -23
- package/package.json +12 -12
package/dist/node/index.d.ts
CHANGED
|
@@ -36,10 +36,10 @@ interface Alias {
|
|
|
36
36
|
find: string | RegExp;
|
|
37
37
|
replacement: string;
|
|
38
38
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
* Instructs the plugin to use an alternative resolving algorithm,
|
|
40
|
+
* rather than the Rollup's resolver.
|
|
41
|
+
* @default null
|
|
42
|
+
*/
|
|
43
43
|
customResolver?: ResolverFunction | ResolverObject | null;
|
|
44
44
|
}
|
|
45
45
|
type MapToFunction<T> = T extends Function ? T : never;
|
|
@@ -69,183 +69,158 @@ type AnymatchMatcher = AnymatchPattern | AnymatchPattern[];
|
|
|
69
69
|
//#region src/types/chokidar.d.ts
|
|
70
70
|
declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
|
71
71
|
options: WatchOptions;
|
|
72
|
-
|
|
73
72
|
/**
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
* Constructs a new FSWatcher instance with optional WatchOptions parameter.
|
|
74
|
+
*/
|
|
76
75
|
constructor(options?: WatchOptions);
|
|
77
|
-
|
|
78
76
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
* When called, requests that the Node.js event loop not exit so long as the fs.FSWatcher is active.
|
|
78
|
+
* Calling watcher.ref() multiple times will have no effect.
|
|
79
|
+
*/
|
|
82
80
|
ref(): this;
|
|
83
|
-
|
|
84
81
|
/**
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
* When called, the active fs.FSWatcher object will not require the Node.js event loop to remain active.
|
|
83
|
+
* If there is no other activity keeping the event loop running, the process may exit before the fs.FSWatcher object's callback is invoked.
|
|
84
|
+
* Calling watcher.unref() multiple times will have no effect.
|
|
85
|
+
*/
|
|
89
86
|
unref(): this;
|
|
90
|
-
|
|
91
87
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
88
|
+
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
|
|
89
|
+
* string.
|
|
90
|
+
*/
|
|
95
91
|
add(paths: string | ReadonlyArray<string>): this;
|
|
96
|
-
|
|
97
92
|
/**
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one
|
|
94
|
+
* string.
|
|
95
|
+
*/
|
|
101
96
|
unwatch(paths: string | ReadonlyArray<string>): this;
|
|
102
|
-
|
|
103
97
|
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
* Returns an object representing all the paths on the file system being watched by this
|
|
99
|
+
* `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless
|
|
100
|
+
* the `cwd` option was used), and the values are arrays of the names of the items contained in
|
|
101
|
+
* each directory.
|
|
102
|
+
*/
|
|
109
103
|
getWatched(): {
|
|
110
104
|
[directory: string]: string[];
|
|
111
105
|
};
|
|
112
|
-
|
|
113
106
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
* Removes all listeners from watched files.
|
|
108
|
+
*/
|
|
116
109
|
close(): Promise<void>;
|
|
117
110
|
on(event: 'add' | 'addDir' | 'change', listener: (path: string, stats?: fs.Stats) => void): this;
|
|
118
111
|
on(event: 'all', listener: (eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', path: string, stats?: fs.Stats) => void): this;
|
|
119
|
-
|
|
120
112
|
/**
|
|
121
|
-
|
|
122
|
-
|
|
113
|
+
* Error occurred
|
|
114
|
+
*/
|
|
123
115
|
on(event: 'error', listener: (error: Error) => void): this;
|
|
124
|
-
|
|
125
116
|
/**
|
|
126
|
-
|
|
127
|
-
|
|
117
|
+
* Exposes the native Node `fs.FSWatcher events`
|
|
118
|
+
*/
|
|
128
119
|
on(event: 'raw', listener: (eventName: string, path: string, details: any) => void): this;
|
|
129
|
-
|
|
130
120
|
/**
|
|
131
|
-
|
|
132
|
-
|
|
121
|
+
* Fires when the initial scan is complete
|
|
122
|
+
*/
|
|
133
123
|
on(event: 'ready', listener: () => void): this;
|
|
134
124
|
on(event: 'unlink' | 'unlinkDir', listener: (path: string) => void): this;
|
|
135
125
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
136
126
|
}
|
|
137
127
|
interface WatchOptions {
|
|
138
128
|
/**
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
129
|
+
* Indicates whether the process should continue to run as long as files are being watched. If
|
|
130
|
+
* set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`,
|
|
131
|
+
* even if the process continues to run.
|
|
132
|
+
*/
|
|
143
133
|
persistent?: boolean;
|
|
144
|
-
|
|
145
134
|
/**
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
135
|
+
* ([anymatch](https://github.com/micromatch/anymatch)-compatible definition) Defines files/paths to
|
|
136
|
+
* be ignored. The whole relative or absolute path is tested, not just filename. If a function
|
|
137
|
+
* with two arguments is provided, it gets called twice per path - once with a single argument
|
|
138
|
+
* (the path), second time with two arguments (the path and the
|
|
139
|
+
* [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path).
|
|
140
|
+
*/
|
|
152
141
|
ignored?: AnymatchMatcher;
|
|
153
|
-
|
|
154
142
|
/**
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
143
|
+
* If set to `false` then `add`/`addDir` events are also emitted for matching paths while
|
|
144
|
+
* instantiating the watching as chokidar discovers these file paths (before the `ready` event).
|
|
145
|
+
*/
|
|
158
146
|
ignoreInitial?: boolean;
|
|
159
|
-
|
|
160
147
|
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
148
|
+
* When `false`, only the symlinks themselves will be watched for changes instead of following
|
|
149
|
+
* the link references and bubbling events through the link's path.
|
|
150
|
+
*/
|
|
164
151
|
followSymlinks?: boolean;
|
|
165
|
-
|
|
166
152
|
/**
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
153
|
+
* The base directory from which watch `paths` are to be derived. Paths emitted with events will
|
|
154
|
+
* be relative to this.
|
|
155
|
+
*/
|
|
170
156
|
cwd?: string;
|
|
171
|
-
|
|
172
157
|
/**
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
158
|
+
* If set to true then the strings passed to .watch() and .add() are treated as literal path
|
|
159
|
+
* names, even if they look like globs.
|
|
160
|
+
*
|
|
161
|
+
* @default false
|
|
162
|
+
*/
|
|
178
163
|
disableGlobbing?: boolean;
|
|
179
|
-
|
|
180
164
|
/**
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
165
|
+
* Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU
|
|
166
|
+
* utilization, consider setting this to `false`. It is typically necessary to **set this to
|
|
167
|
+
* `true` to successfully watch files over a network**, and it may be necessary to successfully
|
|
168
|
+
* watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides
|
|
169
|
+
* the `useFsEvents` default.
|
|
170
|
+
*/
|
|
187
171
|
usePolling?: boolean;
|
|
188
|
-
|
|
189
172
|
/**
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
173
|
+
* Whether to use the `fsevents` watching interface if available. When set to `true` explicitly
|
|
174
|
+
* and `fsevents` is available this supersedes the `usePolling` setting. When set to `false` on
|
|
175
|
+
* OS X, `usePolling: true` becomes the default.
|
|
176
|
+
*/
|
|
194
177
|
useFsEvents?: boolean;
|
|
195
|
-
|
|
196
178
|
/**
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
179
|
+
* If relying upon the [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object that
|
|
180
|
+
* may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is
|
|
181
|
+
* provided even in cases where it wasn't already available from the underlying watch events.
|
|
182
|
+
*/
|
|
201
183
|
alwaysStat?: boolean;
|
|
202
|
-
|
|
203
184
|
/**
|
|
204
|
-
|
|
205
|
-
|
|
185
|
+
* If set, limits how many levels of subdirectories will be traversed.
|
|
186
|
+
*/
|
|
206
187
|
depth?: number;
|
|
207
|
-
|
|
208
188
|
/**
|
|
209
|
-
|
|
210
|
-
|
|
189
|
+
* Interval of file system polling.
|
|
190
|
+
*/
|
|
211
191
|
interval?: number;
|
|
212
|
-
|
|
213
192
|
/**
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
193
|
+
* Interval of file system polling for binary files. ([see list of binary extensions](https://gi
|
|
194
|
+
* thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
|
|
195
|
+
*/
|
|
217
196
|
binaryInterval?: number;
|
|
218
|
-
|
|
219
197
|
/**
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
198
|
+
* Indicates whether to watch files that don't have read permissions if possible. If watching
|
|
199
|
+
* fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed
|
|
200
|
+
* silently.
|
|
201
|
+
*/
|
|
224
202
|
ignorePermissionErrors?: boolean;
|
|
225
|
-
|
|
226
203
|
/**
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
204
|
+
* `true` if `useFsEvents` and `usePolling` are `false`. Automatically filters out artifacts
|
|
205
|
+
* that occur when using editors that use "atomic writes" instead of writing directly to the
|
|
206
|
+
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
|
|
207
|
+
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
|
|
208
|
+
* you can override it by setting `atomic` to a custom value, in milliseconds.
|
|
209
|
+
*/
|
|
233
210
|
atomic?: boolean | number;
|
|
234
|
-
|
|
235
211
|
/**
|
|
236
|
-
|
|
237
|
-
|
|
212
|
+
* can be set to an object in order to adjust timing params:
|
|
213
|
+
*/
|
|
238
214
|
awaitWriteFinish?: AwaitWriteFinishOptions | boolean;
|
|
239
215
|
}
|
|
240
216
|
interface AwaitWriteFinishOptions {
|
|
241
217
|
/**
|
|
242
|
-
|
|
243
|
-
|
|
218
|
+
* Amount of time in milliseconds for a file size to remain constant before emitting its event.
|
|
219
|
+
*/
|
|
244
220
|
stabilityThreshold?: number;
|
|
245
|
-
|
|
246
221
|
/**
|
|
247
|
-
|
|
248
|
-
|
|
222
|
+
* File size polling interval.
|
|
223
|
+
*/
|
|
249
224
|
pollInterval?: number;
|
|
250
225
|
}
|
|
251
226
|
//#endregion
|
|
@@ -268,51 +243,48 @@ declare namespace Connect {
|
|
|
268
243
|
(req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void;
|
|
269
244
|
route: string;
|
|
270
245
|
stack: ServerStackItem[];
|
|
271
|
-
|
|
272
246
|
/**
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
247
|
+
* Utilize the given middleware `handle` to the given `route`,
|
|
248
|
+
* defaulting to _/_. This "route" is the mount-point for the
|
|
249
|
+
* middleware, when given a value other than _/_ the middleware
|
|
250
|
+
* is only effective when that segment is present in the request's
|
|
251
|
+
* pathname.
|
|
252
|
+
*
|
|
253
|
+
* For example if we were to mount a function at _/admin_, it would
|
|
254
|
+
* be invoked on _/admin_, and _/admin/settings_, however it would
|
|
255
|
+
* not be invoked for _/_, or _/posts_.
|
|
256
|
+
*/
|
|
283
257
|
use(fn: NextHandleFunction): Server;
|
|
284
258
|
use(fn: HandleFunction): Server;
|
|
285
259
|
use(route: string, fn: NextHandleFunction): Server;
|
|
286
260
|
use(route: string, fn: HandleFunction): Server;
|
|
287
|
-
|
|
288
261
|
/**
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
262
|
+
* Handle server requests, punting them down
|
|
263
|
+
* the middleware stack.
|
|
264
|
+
*/
|
|
292
265
|
handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void;
|
|
293
|
-
|
|
294
266
|
/**
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
267
|
+
* Listen for connections.
|
|
268
|
+
*
|
|
269
|
+
* This method takes the same arguments
|
|
270
|
+
* as node's `http.Server#listen()`.
|
|
271
|
+
*
|
|
272
|
+
* HTTP and HTTPS:
|
|
273
|
+
*
|
|
274
|
+
* If you run your application both as HTTP
|
|
275
|
+
* and HTTPS you may wrap them individually,
|
|
276
|
+
* since your Connect "server" is really just
|
|
277
|
+
* a JavaScript `Function`.
|
|
278
|
+
*
|
|
279
|
+
* var connect = require('connect')
|
|
280
|
+
* , http = require('http')
|
|
281
|
+
* , https = require('https');
|
|
282
|
+
*
|
|
283
|
+
* var app = connect();
|
|
284
|
+
*
|
|
285
|
+
* http.createServer(app).listen(80);
|
|
286
|
+
* https.createServer(options, app).listen(443);
|
|
287
|
+
*/
|
|
316
288
|
listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server;
|
|
317
289
|
listen(port: number, hostname?: string, callback?: Function): http.Server;
|
|
318
290
|
listen(path: string, callback?: Function): http.Server;
|
|
@@ -403,17 +375,17 @@ interface ServerOptions$3 {
|
|
|
403
375
|
/** Explicitly set the method type of the ProxyReq */
|
|
404
376
|
method?: string;
|
|
405
377
|
/**
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
378
|
+
* Optionally override the trusted CA certificates.
|
|
379
|
+
* This is passed to https.request.
|
|
380
|
+
*/
|
|
409
381
|
ca?: string;
|
|
410
382
|
/** Optional fetch implementation to use instead of global fetch, use this to activate fetch-based proxying,
|
|
411
|
-
|
|
412
|
-
|
|
383
|
+
* for example to proxy HTTP/2 requests
|
|
384
|
+
*/
|
|
413
385
|
fetch?: typeof fetch;
|
|
414
386
|
/** Optional configuration object for fetch-based proxy requests.
|
|
415
|
-
|
|
416
|
-
|
|
387
|
+
* Use this to customize fetch request and response handling.
|
|
388
|
+
* For custom fetch implementations, use the `fetch` property.*/
|
|
417
389
|
fetchOptions?: FetchOptions;
|
|
418
390
|
}
|
|
419
391
|
interface FetchOptions {
|
|
@@ -450,59 +422,59 @@ type PassFunctions<TIncomingMessage extends typeof http.IncomingMessage = typeof
|
|
|
450
422
|
};
|
|
451
423
|
declare class ProxyServer<TIncomingMessage extends typeof http.IncomingMessage = typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse = typeof http.ServerResponse, TError = Error> extends EventEmitter<ProxyServerEventMap<TIncomingMessage, TServerResponse, TError>> {
|
|
452
424
|
/**
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
425
|
+
* Used for proxying WS(S) requests
|
|
426
|
+
* @param req - Client request.
|
|
427
|
+
* @param socket - Client socket.
|
|
428
|
+
* @param head - Client head.
|
|
429
|
+
* @param options - Additional options.
|
|
430
|
+
*/
|
|
459
431
|
readonly ws: (...args: ProxyMethodArgs<TIncomingMessage, TServerResponse, TError>["ws"]) => void;
|
|
460
432
|
/**
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
433
|
+
* Used for proxying regular HTTP(S) requests
|
|
434
|
+
* @param req - Client request.
|
|
435
|
+
* @param res - Client response.
|
|
436
|
+
* @param options - Additional options.
|
|
437
|
+
*/
|
|
466
438
|
readonly web: (...args: ProxyMethodArgs<TIncomingMessage, TServerResponse, TError>["web"]) => void;
|
|
467
439
|
private options;
|
|
468
440
|
private webPasses;
|
|
469
441
|
private wsPasses;
|
|
470
442
|
private _server?;
|
|
471
443
|
/**
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
444
|
+
* Creates the proxy server with specified options.
|
|
445
|
+
* @param options - Config object passed to the proxy
|
|
446
|
+
*/
|
|
475
447
|
constructor(options?: ServerOptions$3);
|
|
476
448
|
/**
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
449
|
+
* Creates the proxy server with specified options.
|
|
450
|
+
* @param options Config object passed to the proxy
|
|
451
|
+
* @returns Proxy object with handlers for `ws` and `web` requests
|
|
452
|
+
*/
|
|
481
453
|
static createProxyServer<TIncomingMessage extends typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>;
|
|
482
454
|
/**
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
455
|
+
* Creates the proxy server with specified options.
|
|
456
|
+
* @param options Config object passed to the proxy
|
|
457
|
+
* @returns Proxy object with handlers for `ws` and `web` requests
|
|
458
|
+
*/
|
|
487
459
|
static createServer<TIncomingMessage extends typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>;
|
|
488
460
|
/**
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
461
|
+
* Creates the proxy server with specified options.
|
|
462
|
+
* @param options Config object passed to the proxy
|
|
463
|
+
* @returns Proxy object with handlers for `ws` and `web` requests
|
|
464
|
+
*/
|
|
493
465
|
static createProxy<TIncomingMessage extends typeof http.IncomingMessage, TServerResponse extends typeof http.ServerResponse, TError = Error>(options?: ServerOptions$3): ProxyServer<TIncomingMessage, TServerResponse, TError>;
|
|
494
466
|
createRightProxy: <PT extends ProxyType>(type: PT) => Function;
|
|
495
467
|
onError: (err: TError) => void;
|
|
496
468
|
/**
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
469
|
+
* A function that wraps the object in a webserver, for your convenience
|
|
470
|
+
* @param port - Port to listen on
|
|
471
|
+
* @param hostname - The hostname to listen on
|
|
472
|
+
*/
|
|
501
473
|
listen: (port: number, hostname?: string) => this;
|
|
502
474
|
address: () => string | net.AddressInfo | null | undefined;
|
|
503
475
|
/**
|
|
504
|
-
|
|
505
|
-
|
|
476
|
+
* A function that closes the inner webserver and stops listening on given port
|
|
477
|
+
*/
|
|
506
478
|
close: (cb?: Function) => void;
|
|
507
479
|
before: <PT extends ProxyType>(type: PT, passName: string, cb: PassFunctions<TIncomingMessage, TServerResponse, TError>[PT]) => void;
|
|
508
480
|
after: <PT extends ProxyType>(type: PT, passName: string, cb: PassFunctions<TIncomingMessage, TServerResponse, TError>[PT]) => void;
|
|
@@ -532,22 +504,22 @@ declare function createProxyServer<TIncomingMessage extends typeof http.Incoming
|
|
|
532
504
|
//#region src/node/server/middlewares/proxy.d.ts
|
|
533
505
|
interface ProxyOptions extends ServerOptions$3 {
|
|
534
506
|
/**
|
|
535
|
-
|
|
536
|
-
|
|
507
|
+
* rewrite path
|
|
508
|
+
*/
|
|
537
509
|
rewrite?: (path: string) => string;
|
|
538
510
|
/**
|
|
539
|
-
|
|
540
|
-
|
|
511
|
+
* configure the proxy server (e.g. listen to events)
|
|
512
|
+
*/
|
|
541
513
|
configure?: (proxy: ProxyServer, options: ProxyOptions) => void;
|
|
542
514
|
/**
|
|
543
|
-
|
|
544
|
-
|
|
515
|
+
* webpack-dev-server style bypass function
|
|
516
|
+
*/
|
|
545
517
|
bypass?: (req: http.IncomingMessage, res: http.ServerResponse | undefined, options: ProxyOptions) => void | null | undefined | false | string | Promise<void | null | undefined | boolean | string>;
|
|
546
518
|
/**
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
519
|
+
* rewrite the Origin header of a WebSocket request to match the target
|
|
520
|
+
*
|
|
521
|
+
* **Exercise caution as rewriting the Origin can leave the proxying open to [CSRF attacks](https://owasp.org/www-community/attacks/csrf).**
|
|
522
|
+
*/
|
|
551
523
|
rewriteWsOrigin?: boolean | undefined;
|
|
552
524
|
}
|
|
553
525
|
//#endregion
|
|
@@ -582,80 +554,80 @@ declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger
|
|
|
582
554
|
//#region src/node/http.d.ts
|
|
583
555
|
interface CommonServerOptions {
|
|
584
556
|
/**
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
557
|
+
* Specify server port. Note if the port is already being used, Vite will
|
|
558
|
+
* automatically try the next available port so this may not be the actual
|
|
559
|
+
* port the server ends up listening on.
|
|
560
|
+
*/
|
|
589
561
|
port?: number;
|
|
590
562
|
/**
|
|
591
|
-
|
|
592
|
-
|
|
563
|
+
* If enabled, vite will exit if specified port is already in use
|
|
564
|
+
*/
|
|
593
565
|
strictPort?: boolean;
|
|
594
566
|
/**
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
567
|
+
* Specify which IP addresses the server should listen on.
|
|
568
|
+
* Set to 0.0.0.0 to listen on all addresses, including LAN and public addresses.
|
|
569
|
+
*/
|
|
598
570
|
host?: string | boolean;
|
|
599
571
|
/**
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
572
|
+
* The hostnames that Vite is allowed to respond to.
|
|
573
|
+
* `localhost` and subdomains under `.localhost` and all IP addresses are allowed by default.
|
|
574
|
+
* When using HTTPS, this check is skipped.
|
|
575
|
+
*
|
|
576
|
+
* If a string starts with `.`, it will allow that hostname without the `.` and all subdomains under the hostname.
|
|
577
|
+
* For example, `.example.com` will allow `example.com`, `foo.example.com`, and `foo.bar.example.com`.
|
|
578
|
+
*
|
|
579
|
+
* If set to `true`, the server is allowed to respond to requests for any hosts.
|
|
580
|
+
* This is not recommended as it will be vulnerable to DNS rebinding attacks.
|
|
581
|
+
*/
|
|
610
582
|
allowedHosts?: string[] | true;
|
|
611
583
|
/**
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
584
|
+
* Enable TLS + HTTP/2.
|
|
585
|
+
* Note: this downgrades to TLS only when the proxy option is also used.
|
|
586
|
+
*/
|
|
615
587
|
https?: HttpsServerOptions;
|
|
616
588
|
/**
|
|
617
|
-
|
|
618
|
-
|
|
589
|
+
* Open browser window on startup
|
|
590
|
+
*/
|
|
619
591
|
open?: boolean | string;
|
|
620
592
|
/**
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
593
|
+
* Configure custom proxy rules for the dev server. Expects an object
|
|
594
|
+
* of `{ key: options }` pairs.
|
|
595
|
+
* Uses [`http-proxy-3`](https://github.com/sagemathinc/http-proxy-3).
|
|
596
|
+
* Full options [here](https://github.com/sagemathinc/http-proxy-3#options).
|
|
597
|
+
*
|
|
598
|
+
* Example `vite.config.js`:
|
|
599
|
+
* ``` js
|
|
600
|
+
* module.exports = {
|
|
601
|
+
* proxy: {
|
|
602
|
+
* // string shorthand: /foo -> http://localhost:4567/foo
|
|
603
|
+
* '/foo': 'http://localhost:4567',
|
|
604
|
+
* // with options
|
|
605
|
+
* '/api': {
|
|
606
|
+
* target: 'http://jsonplaceholder.typicode.com',
|
|
607
|
+
* changeOrigin: true,
|
|
608
|
+
* rewrite: path => path.replace(/^\/api/, '')
|
|
609
|
+
* }
|
|
610
|
+
* }
|
|
611
|
+
* }
|
|
612
|
+
* ```
|
|
613
|
+
*/
|
|
642
614
|
proxy?: Record<string, string | ProxyOptions>;
|
|
643
615
|
/**
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
616
|
+
* Configure CORS for the dev server.
|
|
617
|
+
* Uses https://github.com/expressjs/cors.
|
|
618
|
+
*
|
|
619
|
+
* When enabling this option, **we recommend setting a specific value
|
|
620
|
+
* rather than `true`** to avoid exposing the source code to untrusted origins.
|
|
621
|
+
*
|
|
622
|
+
* Set to `true` to allow all methods from any origin, or configure separately
|
|
623
|
+
* using an object.
|
|
624
|
+
*
|
|
625
|
+
* @default false
|
|
626
|
+
*/
|
|
655
627
|
cors?: CorsOptions | boolean;
|
|
656
628
|
/**
|
|
657
|
-
|
|
658
|
-
|
|
629
|
+
* Specify server response headers.
|
|
630
|
+
*/
|
|
659
631
|
headers?: OutgoingHttpHeaders;
|
|
660
632
|
}
|
|
661
633
|
/**
|
|
@@ -663,11 +635,11 @@ interface CommonServerOptions {
|
|
|
663
635
|
*/
|
|
664
636
|
interface CorsOptions {
|
|
665
637
|
/**
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
638
|
+
* Configures the Access-Control-Allow-Origin CORS header.
|
|
639
|
+
*
|
|
640
|
+
* **We recommend setting a specific value rather than
|
|
641
|
+
* `true`** to avoid exposing the source code to untrusted origins.
|
|
642
|
+
*/
|
|
671
643
|
origin?: CorsOrigin | ((origin: string | undefined, cb: (err: Error, origins: CorsOrigin) => void) => void);
|
|
672
644
|
methods?: string | string[];
|
|
673
645
|
allowedHeaders?: string | string[];
|
|
@@ -680,45 +652,45 @@ interface CorsOptions {
|
|
|
680
652
|
type CorsOrigin = boolean | string | RegExp | (string | RegExp)[];
|
|
681
653
|
//#endregion
|
|
682
654
|
//#region src/node/typeUtils.d.ts
|
|
683
|
-
type RequiredExceptFor<T, K
|
|
655
|
+
type RequiredExceptFor<T, K extends keyof T> = Pick<T, K> & Required<Omit<T, K>>;
|
|
684
656
|
//#endregion
|
|
685
657
|
//#region src/node/preview.d.ts
|
|
686
658
|
interface PreviewOptions extends CommonServerOptions {}
|
|
687
659
|
interface ResolvedPreviewOptions extends RequiredExceptFor<PreviewOptions, "host" | "https" | "proxy"> {}
|
|
688
660
|
interface PreviewServer {
|
|
689
661
|
/**
|
|
690
|
-
|
|
691
|
-
|
|
662
|
+
* The resolved vite config object
|
|
663
|
+
*/
|
|
692
664
|
config: ResolvedConfig;
|
|
693
665
|
/**
|
|
694
|
-
|
|
695
|
-
|
|
666
|
+
* Stop the server.
|
|
667
|
+
*/
|
|
696
668
|
close(): Promise<void>;
|
|
697
669
|
/**
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
670
|
+
* A connect app instance.
|
|
671
|
+
* - Can be used to attach custom middlewares to the preview server.
|
|
672
|
+
* - Can also be used as the handler function of a custom http server
|
|
673
|
+
* or as a middleware in any connect-style Node.js frameworks
|
|
674
|
+
*
|
|
675
|
+
* https://github.com/senchalabs/connect#use-middleware
|
|
676
|
+
*/
|
|
705
677
|
middlewares: Connect.Server;
|
|
706
678
|
/**
|
|
707
|
-
|
|
708
|
-
|
|
679
|
+
* native Node http server instance
|
|
680
|
+
*/
|
|
709
681
|
httpServer: HttpServer;
|
|
710
682
|
/**
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
683
|
+
* The resolved urls Vite prints on the CLI (URL-encoded). Returns `null`
|
|
684
|
+
* if the server is not listening on any port.
|
|
685
|
+
*/
|
|
714
686
|
resolvedUrls: ResolvedServerUrls | null;
|
|
715
687
|
/**
|
|
716
|
-
|
|
717
|
-
|
|
688
|
+
* Print server urls
|
|
689
|
+
*/
|
|
718
690
|
printUrls(): void;
|
|
719
691
|
/**
|
|
720
|
-
|
|
721
|
-
|
|
692
|
+
* Bind CLI shortcuts
|
|
693
|
+
*/
|
|
722
694
|
bindCLIShortcuts(options?: BindCLIShortcutsOptions<PreviewServer>): void;
|
|
723
695
|
}
|
|
724
696
|
type PreviewServerHook = (this: MinimalPluginContextWithoutEnvironment, server: PreviewServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
@@ -728,22 +700,22 @@ type PreviewServerHook = (this: MinimalPluginContextWithoutEnvironment, server:
|
|
|
728
700
|
declare function preview(inlineConfig?: InlineConfig): Promise<PreviewServer>;
|
|
729
701
|
//#endregion
|
|
730
702
|
//#region src/node/shortcuts.d.ts
|
|
731
|
-
type BindCLIShortcutsOptions<Server
|
|
703
|
+
type BindCLIShortcutsOptions<Server = ViteDevServer | PreviewServer> = {
|
|
732
704
|
/**
|
|
733
|
-
|
|
734
|
-
|
|
705
|
+
* Print a one-line shortcuts "help" hint to the terminal
|
|
706
|
+
*/
|
|
735
707
|
print?: boolean;
|
|
736
708
|
/**
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
customShortcuts?: CLIShortcut<Server
|
|
709
|
+
* Custom shortcuts to run when a key is pressed. These shortcuts take priority
|
|
710
|
+
* over the default shortcuts if they have the same keys (except the `h` key).
|
|
711
|
+
* To disable a default shortcut, define the same key but with `action: undefined`.
|
|
712
|
+
*/
|
|
713
|
+
customShortcuts?: CLIShortcut<Server>[];
|
|
742
714
|
};
|
|
743
|
-
type CLIShortcut<Server
|
|
715
|
+
type CLIShortcut<Server = ViteDevServer | PreviewServer> = {
|
|
744
716
|
key: string;
|
|
745
717
|
description: string;
|
|
746
|
-
action?(server: Server
|
|
718
|
+
action?(server: Server): void | Promise<void>;
|
|
747
719
|
};
|
|
748
720
|
//#endregion
|
|
749
721
|
//#region src/node/baseEnvironment.d.ts
|
|
@@ -801,115 +773,115 @@ interface DepsOptimizer {
|
|
|
801
773
|
}
|
|
802
774
|
interface DepOptimizationConfig {
|
|
803
775
|
/**
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
776
|
+
* Force optimize listed dependencies (must be resolvable import paths,
|
|
777
|
+
* cannot be globs).
|
|
778
|
+
*/
|
|
807
779
|
include?: string[];
|
|
808
780
|
/**
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
781
|
+
* Do not optimize these dependencies (must be resolvable import paths,
|
|
782
|
+
* cannot be globs).
|
|
783
|
+
*/
|
|
812
784
|
exclude?: string[];
|
|
813
785
|
/**
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
786
|
+
* Forces ESM interop when importing these dependencies. Some legacy
|
|
787
|
+
* packages advertise themselves as ESM but use `require` internally
|
|
788
|
+
* @experimental
|
|
789
|
+
*/
|
|
818
790
|
needsInterop?: string[];
|
|
819
791
|
/**
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
792
|
+
* Options to pass to esbuild during the dep scanning and optimization
|
|
793
|
+
*
|
|
794
|
+
* Certain options are omitted since changing them would not be compatible
|
|
795
|
+
* with Vite's dep optimization.
|
|
796
|
+
*
|
|
797
|
+
* - `external` is also omitted, use Vite's `optimizeDeps.exclude` option
|
|
798
|
+
* - `plugins` are merged with Vite's dep plugin
|
|
799
|
+
*
|
|
800
|
+
* https://esbuild.github.io/api
|
|
801
|
+
*
|
|
802
|
+
* @deprecated Use `rolldownOptions` instead.
|
|
803
|
+
*/
|
|
832
804
|
esbuildOptions?: DepsOptimizerEsbuildOptions;
|
|
833
805
|
/**
|
|
834
|
-
|
|
835
|
-
|
|
806
|
+
* @deprecated Use `rolldownOptions` instead.
|
|
807
|
+
*/
|
|
836
808
|
rollupOptions?: Omit<RolldownOptions, "input" | "logLevel" | "output"> & {
|
|
837
809
|
output?: Omit<OutputOptions, "format" | "sourcemap" | "dir" | "banner">;
|
|
838
810
|
};
|
|
839
811
|
/**
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
812
|
+
* Options to pass to rolldown during the dep scanning and optimization
|
|
813
|
+
*
|
|
814
|
+
* Certain options are omitted since changing them would not be compatible
|
|
815
|
+
* with Vite's dep optimization.
|
|
816
|
+
*
|
|
817
|
+
* - `plugins` are merged with Vite's dep plugin
|
|
818
|
+
*/
|
|
847
819
|
rolldownOptions?: Omit<RolldownOptions, "input" | "logLevel" | "output"> & {
|
|
848
820
|
output?: Omit<OutputOptions, "format" | "sourcemap" | "dir" | "banner">;
|
|
849
821
|
};
|
|
850
822
|
/**
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
823
|
+
* List of file extensions that can be optimized. A corresponding esbuild
|
|
824
|
+
* plugin must exist to handle the specific extension.
|
|
825
|
+
*
|
|
826
|
+
* By default, Vite can optimize `.mjs`, `.js`, `.ts`, and `.mts` files. This option
|
|
827
|
+
* allows specifying additional extensions.
|
|
828
|
+
*
|
|
829
|
+
* @experimental
|
|
830
|
+
*/
|
|
859
831
|
extensions?: string[];
|
|
860
832
|
/**
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
833
|
+
* Deps optimization during build was removed in Vite 5.1. This option is
|
|
834
|
+
* now redundant and will be removed in a future version. Switch to using
|
|
835
|
+
* `optimizeDeps.noDiscovery` and an empty or undefined `optimizeDeps.include`.
|
|
836
|
+
* true or 'dev' disables the optimizer, false or 'build' leaves it enabled.
|
|
837
|
+
* @default 'build'
|
|
838
|
+
* @deprecated
|
|
839
|
+
* @experimental
|
|
840
|
+
*/
|
|
869
841
|
disabled?: boolean | "build" | "dev";
|
|
870
842
|
/**
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
843
|
+
* Automatic dependency discovery. When `noDiscovery` is true, only dependencies
|
|
844
|
+
* listed in `include` will be optimized. The scanner isn't run for cold start
|
|
845
|
+
* in this case. CJS-only dependencies must be present in `include` during dev.
|
|
846
|
+
* @default false
|
|
847
|
+
*/
|
|
876
848
|
noDiscovery?: boolean;
|
|
877
849
|
/**
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
850
|
+
* When enabled, it will hold the first optimized deps results until all static
|
|
851
|
+
* imports are crawled on cold start. This avoids the need for full-page reloads
|
|
852
|
+
* when new dependencies are discovered and they trigger the generation of new
|
|
853
|
+
* common chunks. If all dependencies are found by the scanner plus the explicitly
|
|
854
|
+
* defined ones in `include`, it is better to disable this option to let the
|
|
855
|
+
* browser process more requests in parallel.
|
|
856
|
+
* @default true
|
|
857
|
+
* @experimental
|
|
858
|
+
*/
|
|
887
859
|
holdUntilCrawlEnd?: boolean;
|
|
888
860
|
/**
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
861
|
+
* When enabled, Vite will not throw an error when an outdated optimized
|
|
862
|
+
* dependency is requested. Enabling this option may cause a single module
|
|
863
|
+
* to have a multiple reference.
|
|
864
|
+
* @default false
|
|
865
|
+
* @experimental
|
|
866
|
+
*/
|
|
895
867
|
ignoreOutdatedRequests?: boolean;
|
|
896
868
|
}
|
|
897
869
|
type DepOptimizationOptions = DepOptimizationConfig & {
|
|
898
870
|
/**
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
871
|
+
* By default, Vite will crawl your `index.html` to detect dependencies that
|
|
872
|
+
* need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
|
|
873
|
+
* will crawl those entry points instead.
|
|
874
|
+
*
|
|
875
|
+
* If neither of these fit your needs, you can specify custom entries using
|
|
876
|
+
* this option - the value should be a tinyglobby pattern or array of patterns
|
|
877
|
+
* (https://github.com/SuperchupuDev/tinyglobby) that are relative from
|
|
878
|
+
* vite project root. This will overwrite default entries inference.
|
|
879
|
+
*/
|
|
908
880
|
entries?: string | string[];
|
|
909
881
|
/**
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
882
|
+
* Force dep pre-optimization regardless of whether deps have changed.
|
|
883
|
+
* @experimental
|
|
884
|
+
*/
|
|
913
885
|
force?: boolean;
|
|
914
886
|
};
|
|
915
887
|
interface OptimizedDepInfo {
|
|
@@ -920,54 +892,54 @@ interface OptimizedDepInfo {
|
|
|
920
892
|
browserHash?: string;
|
|
921
893
|
fileHash?: string;
|
|
922
894
|
/**
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
895
|
+
* During optimization, ids can still be resolved to their final location
|
|
896
|
+
* but the bundles may not yet be saved to disk
|
|
897
|
+
*/
|
|
926
898
|
processing?: Promise<void>;
|
|
927
899
|
/**
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
900
|
+
* ExportData cache, discovered deps will parse the src entry to get exports
|
|
901
|
+
* data used both to define if interop is needed and when pre-bundling
|
|
902
|
+
*/
|
|
931
903
|
exportsData?: Promise<ExportsData>;
|
|
932
904
|
isDynamicEntry?: boolean;
|
|
933
905
|
}
|
|
934
906
|
interface DepOptimizationMetadata {
|
|
935
907
|
/**
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
908
|
+
* The main hash is determined by user config and dependency lockfiles.
|
|
909
|
+
* This is checked on server startup to avoid unnecessary re-bundles.
|
|
910
|
+
*/
|
|
939
911
|
hash: string;
|
|
940
912
|
/**
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
913
|
+
* This hash is determined by dependency lockfiles.
|
|
914
|
+
* This is checked on server startup to avoid unnecessary re-bundles.
|
|
915
|
+
*/
|
|
944
916
|
lockfileHash: string;
|
|
945
917
|
/**
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
918
|
+
* This hash is determined by user config.
|
|
919
|
+
* This is checked on server startup to avoid unnecessary re-bundles.
|
|
920
|
+
*/
|
|
949
921
|
configHash: string;
|
|
950
922
|
/**
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
923
|
+
* The browser hash is determined by the main hash plus additional dependencies
|
|
924
|
+
* discovered at runtime. This is used to invalidate browser requests to
|
|
925
|
+
* optimized deps.
|
|
926
|
+
*/
|
|
955
927
|
browserHash: string;
|
|
956
928
|
/**
|
|
957
|
-
|
|
958
|
-
|
|
929
|
+
* Metadata for each already optimized dependency
|
|
930
|
+
*/
|
|
959
931
|
optimized: Record<string, OptimizedDepInfo>;
|
|
960
932
|
/**
|
|
961
|
-
|
|
962
|
-
|
|
933
|
+
* Metadata for non-entry optimized chunks and dynamic imports
|
|
934
|
+
*/
|
|
963
935
|
chunks: Record<string, OptimizedDepInfo>;
|
|
964
936
|
/**
|
|
965
|
-
|
|
966
|
-
|
|
937
|
+
* Metadata for each newly discovered dependency after processing
|
|
938
|
+
*/
|
|
967
939
|
discovered: Record<string, OptimizedDepInfo>;
|
|
968
940
|
/**
|
|
969
|
-
|
|
970
|
-
|
|
941
|
+
* OptimizedDepInfo list
|
|
942
|
+
*/
|
|
971
943
|
depInfoList: OptimizedDepInfo[];
|
|
972
944
|
}
|
|
973
945
|
/**
|
|
@@ -991,8 +963,8 @@ interface TransformResult {
|
|
|
991
963
|
}
|
|
992
964
|
interface TransformOptions {
|
|
993
965
|
/**
|
|
994
|
-
|
|
995
|
-
|
|
966
|
+
* @deprecated inferred from environment
|
|
967
|
+
*/
|
|
996
968
|
ssr?: boolean;
|
|
997
969
|
}
|
|
998
970
|
interface TransformOptionsInternal {}
|
|
@@ -1001,12 +973,12 @@ interface TransformOptionsInternal {}
|
|
|
1001
973
|
declare class EnvironmentModuleNode {
|
|
1002
974
|
environment: string;
|
|
1003
975
|
/**
|
|
1004
|
-
|
|
1005
|
-
|
|
976
|
+
* Public served url path, starts with /
|
|
977
|
+
*/
|
|
1006
978
|
url: string;
|
|
1007
979
|
/**
|
|
1008
|
-
|
|
1009
|
-
|
|
980
|
+
* Resolved file system path + query
|
|
981
|
+
*/
|
|
1010
982
|
id: string | null;
|
|
1011
983
|
file: string | null;
|
|
1012
984
|
type: "js" | "css" | "asset";
|
|
@@ -1024,8 +996,8 @@ declare class EnvironmentModuleNode {
|
|
|
1024
996
|
lastHMRTimestamp: number;
|
|
1025
997
|
lastInvalidationTimestamp: number;
|
|
1026
998
|
/**
|
|
1027
|
-
|
|
1028
|
-
|
|
999
|
+
* @param setIsSelfAccepting - set `false` to set `isSelfAccepting` later. e.g. #7870
|
|
1000
|
+
*/
|
|
1029
1001
|
constructor(url: string, environment: string, setIsSelfAccepting?: boolean);
|
|
1030
1002
|
}
|
|
1031
1003
|
type ResolvedUrl = [url: string, resolvedId: string, meta: object | null | undefined];
|
|
@@ -1044,13 +1016,13 @@ declare class EnvironmentModuleGraph {
|
|
|
1044
1016
|
invalidateModule(mod: EnvironmentModuleNode, seen?: Set<EnvironmentModuleNode>, timestamp?: number, isHmr?: boolean, softInvalidate?: boolean): void;
|
|
1045
1017
|
invalidateAll(): void;
|
|
1046
1018
|
/**
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1019
|
+
* Update the module graph based on a module's updated imports information
|
|
1020
|
+
* If there are dependencies that no longer have any importers, they are
|
|
1021
|
+
* returned as a Set.
|
|
1022
|
+
*
|
|
1023
|
+
* @param staticImportedUrls Subset of `importedModules` where they're statically imported in code.
|
|
1024
|
+
* This is only used for soft invalidations so `undefined` is fine but may cause more runtime processing.
|
|
1025
|
+
*/
|
|
1054
1026
|
updateModuleInfo(mod: EnvironmentModuleNode, importedModules: Set<string | EnvironmentModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | EnvironmentModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean, staticImportedUrls?: Set<string>): Promise<Set<EnvironmentModuleNode> | undefined>;
|
|
1055
1027
|
ensureEntryFromUrl(rawUrl: string, setIsSelfAccepting?: boolean): Promise<EnvironmentModuleNode>;
|
|
1056
1028
|
createFileOnlyEntry(file: string): EnvironmentModuleNode;
|
|
@@ -1161,58 +1133,58 @@ interface HotChannelClient {
|
|
|
1161
1133
|
type HotChannelListener<T extends string = string> = (data: InferCustomEventPayload<T>, client: HotChannelClient) => void;
|
|
1162
1134
|
interface HotChannel<Api = any> {
|
|
1163
1135
|
/**
|
|
1164
|
-
|
|
1165
|
-
|
|
1136
|
+
* Broadcast events to all clients
|
|
1137
|
+
*/
|
|
1166
1138
|
send?(payload: hmrPayload_HotPayload): void;
|
|
1167
1139
|
/**
|
|
1168
|
-
|
|
1169
|
-
|
|
1140
|
+
* Handle custom event emitted by `import.meta.hot.send`
|
|
1141
|
+
*/
|
|
1170
1142
|
on?<T extends string>(event: T, listener: HotChannelListener<T>): void;
|
|
1171
1143
|
on?(event: "connection", listener: () => void): void;
|
|
1172
1144
|
/**
|
|
1173
|
-
|
|
1174
|
-
|
|
1145
|
+
* Unregister event listener
|
|
1146
|
+
*/
|
|
1175
1147
|
off?(event: string, listener: Function): void;
|
|
1176
1148
|
/**
|
|
1177
|
-
|
|
1178
|
-
|
|
1149
|
+
* Start listening for messages
|
|
1150
|
+
*/
|
|
1179
1151
|
listen?(): void;
|
|
1180
1152
|
/**
|
|
1181
|
-
|
|
1182
|
-
|
|
1153
|
+
* Disconnect all clients, called when server is closed or restarted.
|
|
1154
|
+
*/
|
|
1183
1155
|
close?(): Promise<unknown> | void;
|
|
1184
1156
|
api?: Api;
|
|
1185
1157
|
}
|
|
1186
1158
|
interface NormalizedHotChannelClient {
|
|
1187
1159
|
/**
|
|
1188
|
-
|
|
1189
|
-
|
|
1160
|
+
* Send event to the client
|
|
1161
|
+
*/
|
|
1190
1162
|
send(payload: hmrPayload_HotPayload): void;
|
|
1191
1163
|
/**
|
|
1192
|
-
|
|
1193
|
-
|
|
1164
|
+
* Send custom event
|
|
1165
|
+
*/
|
|
1194
1166
|
send(event: string, payload?: hmrPayload_CustomPayload["data"]): void;
|
|
1195
1167
|
}
|
|
1196
1168
|
interface NormalizedHotChannel<Api = any> {
|
|
1197
1169
|
/**
|
|
1198
|
-
|
|
1199
|
-
|
|
1170
|
+
* Broadcast events to all clients
|
|
1171
|
+
*/
|
|
1200
1172
|
send(payload: hmrPayload_HotPayload): void;
|
|
1201
1173
|
/**
|
|
1202
|
-
|
|
1203
|
-
|
|
1174
|
+
* Send custom event
|
|
1175
|
+
*/
|
|
1204
1176
|
send<T extends string>(event: T, payload?: InferCustomEventPayload<T>): void;
|
|
1205
1177
|
/**
|
|
1206
|
-
|
|
1207
|
-
|
|
1178
|
+
* Handle custom event emitted by `import.meta.hot.send`
|
|
1179
|
+
*/
|
|
1208
1180
|
on<T extends string>(event: T, listener: (data: InferCustomEventPayload<T>, client: NormalizedHotChannelClient) => void): void;
|
|
1209
1181
|
/**
|
|
1210
|
-
|
|
1211
|
-
|
|
1182
|
+
* @deprecated use `vite:client:connect` event instead
|
|
1183
|
+
*/
|
|
1212
1184
|
on(event: "connection", listener: () => void): void;
|
|
1213
1185
|
/**
|
|
1214
|
-
|
|
1215
|
-
|
|
1186
|
+
* Unregister event listener
|
|
1187
|
+
*/
|
|
1216
1188
|
off(event: string, listener: Function): void;
|
|
1217
1189
|
handleInvoke(payload: hmrPayload_HotPayload): Promise<{
|
|
1218
1190
|
result: any;
|
|
@@ -1220,12 +1192,12 @@ interface NormalizedHotChannel<Api = any> {
|
|
|
1220
1192
|
error: any;
|
|
1221
1193
|
}>;
|
|
1222
1194
|
/**
|
|
1223
|
-
|
|
1224
|
-
|
|
1195
|
+
* Start listening for messages
|
|
1196
|
+
*/
|
|
1225
1197
|
listen(): void;
|
|
1226
1198
|
/**
|
|
1227
|
-
|
|
1228
|
-
|
|
1199
|
+
* Disconnect all clients, called when server is closed or restarted.
|
|
1200
|
+
*/
|
|
1229
1201
|
close(): Promise<unknown> | void;
|
|
1230
1202
|
api?: Api;
|
|
1231
1203
|
}
|
|
@@ -1257,7 +1229,6 @@ declare class WebSocket extends EventEmitter {
|
|
|
1257
1229
|
/** The current state of the connection */
|
|
1258
1230
|
readonly readyState: typeof WebSocket.CONNECTING | typeof WebSocket.OPEN | typeof WebSocket.CLOSING | typeof WebSocket.CLOSED;
|
|
1259
1231
|
readonly url: string;
|
|
1260
|
-
|
|
1261
1232
|
/** The connection is not yet open. */
|
|
1262
1233
|
readonly CONNECTING: 0;
|
|
1263
1234
|
/** The connection is open and ready to communicate. */
|
|
@@ -1284,20 +1255,17 @@ declare class WebSocket extends EventEmitter {
|
|
|
1284
1255
|
fin?: boolean | undefined;
|
|
1285
1256
|
}, cb?: (err?: Error) => void): void;
|
|
1286
1257
|
terminate(): void;
|
|
1287
|
-
|
|
1288
1258
|
/**
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1259
|
+
* Pause the websocket causing it to stop emitting events. Some events can still be
|
|
1260
|
+
* emitted after this is called, until all buffered data is consumed. This method
|
|
1261
|
+
* is a noop if the ready state is `CONNECTING` or `CLOSED`.
|
|
1262
|
+
*/
|
|
1293
1263
|
pause(): void;
|
|
1294
1264
|
/**
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
resume(): void;
|
|
1299
|
-
|
|
1300
|
-
// HTML5 WebSocket events
|
|
1265
|
+
* Make a paused socket resume emitting events. This method is a noop if the ready
|
|
1266
|
+
* state is `CONNECTING` or `CLOSED`.
|
|
1267
|
+
*/
|
|
1268
|
+
resume(): void; // HTML5 WebSocket events
|
|
1301
1269
|
addEventListener(method: 'message', cb: (event: WebSocket.MessageEvent) => void, options?: WebSocket.EventListenerOptions): void;
|
|
1302
1270
|
addEventListener(method: 'close', cb: (event: WebSocket.CloseEvent) => void, options?: WebSocket.EventListenerOptions): void;
|
|
1303
1271
|
addEventListener(method: 'error', cb: (event: WebSocket.ErrorEvent) => void, options?: WebSocket.EventListenerOptions): void;
|
|
@@ -1305,9 +1273,7 @@ declare class WebSocket extends EventEmitter {
|
|
|
1305
1273
|
removeEventListener(method: 'message', cb: (event: WebSocket.MessageEvent) => void): void;
|
|
1306
1274
|
removeEventListener(method: 'close', cb: (event: WebSocket.CloseEvent) => void): void;
|
|
1307
1275
|
removeEventListener(method: 'error', cb: (event: WebSocket.ErrorEvent) => void): void;
|
|
1308
|
-
removeEventListener(method: 'open', cb: (event: WebSocket.Event) => void): void;
|
|
1309
|
-
|
|
1310
|
-
// Events
|
|
1276
|
+
removeEventListener(method: 'open', cb: (event: WebSocket.Event) => void): void; // Events
|
|
1311
1277
|
on(event: 'close', listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
|
|
1312
1278
|
on(event: 'error', listener: (this: WebSocket, err: Error) => void): this;
|
|
1313
1279
|
on(event: 'upgrade', listener: (this: WebSocket, request: http.IncomingMessage) => void): this;
|
|
@@ -1353,36 +1319,32 @@ declare const WebSocketAlias: typeof WebSocket;
|
|
|
1353
1319
|
interface WebSocketAlias extends WebSocket {}
|
|
1354
1320
|
declare namespace WebSocket {
|
|
1355
1321
|
/**
|
|
1356
|
-
|
|
1357
|
-
|
|
1322
|
+
* Data represents the raw message payload received over the WebSocket.
|
|
1323
|
+
*/
|
|
1358
1324
|
type RawData = Buffer | ArrayBuffer | Buffer[];
|
|
1359
|
-
|
|
1360
1325
|
/**
|
|
1361
|
-
|
|
1362
|
-
|
|
1326
|
+
* Data represents the message payload received over the WebSocket.
|
|
1327
|
+
*/
|
|
1363
1328
|
type Data = string | Buffer | ArrayBuffer | Buffer[];
|
|
1364
|
-
|
|
1365
1329
|
/**
|
|
1366
|
-
|
|
1367
|
-
|
|
1330
|
+
* CertMeta represents the accepted types for certificate & key data.
|
|
1331
|
+
*/
|
|
1368
1332
|
type CertMeta = string | string[] | Buffer | Buffer[];
|
|
1369
|
-
|
|
1370
1333
|
/**
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1334
|
+
* VerifyClientCallbackSync is a synchronous callback used to inspect the
|
|
1335
|
+
* incoming message. The return value (boolean) of the function determines
|
|
1336
|
+
* whether or not to accept the handshake.
|
|
1337
|
+
*/
|
|
1375
1338
|
type VerifyClientCallbackSync = (info: {
|
|
1376
1339
|
origin: string;
|
|
1377
1340
|
secure: boolean;
|
|
1378
1341
|
req: http.IncomingMessage;
|
|
1379
1342
|
}) => boolean;
|
|
1380
|
-
|
|
1381
1343
|
/**
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1344
|
+
* VerifyClientCallbackAsync is an asynchronous callback used to inspect the
|
|
1345
|
+
* incoming message. The return value (boolean) of the function determines
|
|
1346
|
+
* whether or not to accept the handshake.
|
|
1347
|
+
*/
|
|
1386
1348
|
type VerifyClientCallbackAsync = (info: {
|
|
1387
1349
|
origin: string;
|
|
1388
1350
|
secure: boolean;
|
|
@@ -1473,9 +1435,7 @@ declare namespace WebSocket {
|
|
|
1473
1435
|
address: string;
|
|
1474
1436
|
family: string;
|
|
1475
1437
|
port: number;
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
// WebSocket Server
|
|
1438
|
+
} // WebSocket Server
|
|
1479
1439
|
class Server<T extends WebSocket = WebSocket> extends EventEmitter {
|
|
1480
1440
|
options: ServerOptions;
|
|
1481
1441
|
path: string;
|
|
@@ -1484,9 +1444,7 @@ declare namespace WebSocket {
|
|
|
1484
1444
|
address(): AddressInfo | string;
|
|
1485
1445
|
close(cb?: (err?: Error) => void): void;
|
|
1486
1446
|
handleUpgrade(request: http.IncomingMessage, socket: Duplex, upgradeHead: Buffer, callback: (client: T, request: http.IncomingMessage) => void): void;
|
|
1487
|
-
shouldHandle(request: http.IncomingMessage): boolean | Promise<boolean>;
|
|
1488
|
-
|
|
1489
|
-
// Events
|
|
1447
|
+
shouldHandle(request: http.IncomingMessage): boolean | Promise<boolean>; // Events
|
|
1490
1448
|
on(event: 'connection', cb: (this: Server<T>, socket: T, request: http.IncomingMessage) => void): this;
|
|
1491
1449
|
on(event: 'error', cb: (this: Server<T>, error: Error) => void): this;
|
|
1492
1450
|
on(event: 'headers', cb: (this: Server<T>, headers: string[], request: http.IncomingMessage) => void): this;
|
|
@@ -1516,49 +1474,45 @@ declare namespace WebSocket {
|
|
|
1516
1474
|
const WebSocketServer: typeof Server;
|
|
1517
1475
|
interface WebSocketServer extends Server {}
|
|
1518
1476
|
const WebSocket: typeof WebSocketAlias;
|
|
1519
|
-
interface WebSocket extends WebSocketAlias {}
|
|
1520
|
-
|
|
1521
|
-
// WebSocket stream
|
|
1477
|
+
interface WebSocket extends WebSocketAlias {} // WebSocket stream
|
|
1522
1478
|
function createWebSocketStream(websocket: WebSocket, options?: DuplexOptions): Duplex;
|
|
1523
|
-
}
|
|
1524
|
-
|
|
1525
|
-
// export = WebSocket
|
|
1479
|
+
} // export = WebSocket
|
|
1526
1480
|
//#endregion
|
|
1527
1481
|
//#region src/node/server/ws.d.ts
|
|
1528
1482
|
type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
|
|
1529
1483
|
declare const isWebSocketServer: unique symbol;
|
|
1530
1484
|
interface WebSocketServer extends NormalizedHotChannel {
|
|
1531
1485
|
/**
|
|
1532
|
-
|
|
1533
|
-
|
|
1486
|
+
* Handle custom event emitted by `import.meta.hot.send`
|
|
1487
|
+
*/
|
|
1534
1488
|
on: WebSocket.Server["on"] & {
|
|
1535
1489
|
<T extends string>(event: T, listener: WebSocketCustomListener<hmrPayload_InferCustomEventPayload<T>>): void;
|
|
1536
1490
|
};
|
|
1537
1491
|
/**
|
|
1538
|
-
|
|
1539
|
-
|
|
1492
|
+
* Unregister event listener.
|
|
1493
|
+
*/
|
|
1540
1494
|
off: WebSocket.Server["off"] & {
|
|
1541
1495
|
(event: string, listener: Function): void;
|
|
1542
1496
|
};
|
|
1543
1497
|
/**
|
|
1544
|
-
|
|
1545
|
-
|
|
1498
|
+
* Listen on port and host
|
|
1499
|
+
*/
|
|
1546
1500
|
listen(): void;
|
|
1547
1501
|
/**
|
|
1548
|
-
|
|
1549
|
-
|
|
1502
|
+
* Disconnect all clients and terminate the server.
|
|
1503
|
+
*/
|
|
1550
1504
|
close(): Promise<void>;
|
|
1551
1505
|
[isWebSocketServer]: true;
|
|
1552
1506
|
/**
|
|
1553
|
-
|
|
1554
|
-
|
|
1507
|
+
* Get all connected clients.
|
|
1508
|
+
*/
|
|
1555
1509
|
clients: Set<WebSocketClient>;
|
|
1556
1510
|
}
|
|
1557
1511
|
interface WebSocketClient extends NormalizedHotChannelClient {
|
|
1558
1512
|
/**
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1513
|
+
* The raw WebSocket instance
|
|
1514
|
+
* @advanced
|
|
1515
|
+
*/
|
|
1562
1516
|
socket: WebSocket;
|
|
1563
1517
|
}
|
|
1564
1518
|
//#endregion
|
|
@@ -1578,29 +1532,29 @@ declare class DevEnvironment extends BaseEnvironment {
|
|
|
1578
1532
|
depsOptimizer?: DepsOptimizer;
|
|
1579
1533
|
get pluginContainer(): EnvironmentPluginContainer<DevEnvironment>;
|
|
1580
1534
|
/**
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1535
|
+
* Hot channel for this environment. If not provided or disabled,
|
|
1536
|
+
* it will be a noop channel that does nothing.
|
|
1537
|
+
*
|
|
1538
|
+
* @example
|
|
1539
|
+
* environment.hot.send({ type: 'full-reload' })
|
|
1540
|
+
*/
|
|
1587
1541
|
hot: NormalizedHotChannel;
|
|
1588
1542
|
constructor(name: string, config: ResolvedConfig, context: DevEnvironmentContext);
|
|
1589
1543
|
init(options?: {
|
|
1590
1544
|
watcher?: FSWatcher;
|
|
1591
1545
|
/**
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1546
|
+
* the previous instance used for the environment with the same name
|
|
1547
|
+
*
|
|
1548
|
+
* when using, the consumer should check if it's an instance generated from the same class or factory function
|
|
1549
|
+
*/
|
|
1596
1550
|
previousInstance?: DevEnvironment;
|
|
1597
1551
|
}): Promise<void>;
|
|
1598
1552
|
/**
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1553
|
+
* When the dev server is restarted, the methods are called in the following order:
|
|
1554
|
+
* - new instance `init`
|
|
1555
|
+
* - previous instance `close`
|
|
1556
|
+
* - new instance `listen`
|
|
1557
|
+
*/
|
|
1604
1558
|
listen(server: ViteDevServer): Promise<void>;
|
|
1605
1559
|
fetchModule(id: string, importer?: string, options?: FetchFunctionOptions): Promise<moduleRunner_FetchResult>;
|
|
1606
1560
|
reloadModule(module: EnvironmentModuleNode): Promise<void>;
|
|
@@ -1613,13 +1567,13 @@ declare class DevEnvironment extends BaseEnvironment {
|
|
|
1613
1567
|
}, _client: NormalizedHotChannelClient): void;
|
|
1614
1568
|
close(): Promise<void>;
|
|
1615
1569
|
/**
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1570
|
+
* Calling `await environment.waitForRequestsIdle(id)` will wait until all static imports
|
|
1571
|
+
* are processed after the first transformRequest call. If called from a load or transform
|
|
1572
|
+
* plugin hook, the id needs to be passed as a parameter to avoid deadlocks.
|
|
1573
|
+
* Calling this function after the first static imports section of the module graph has been
|
|
1574
|
+
* processed will resolve immediately.
|
|
1575
|
+
* @experimental
|
|
1576
|
+
*/
|
|
1623
1577
|
waitForRequestsIdle(ignoredId?: string): Promise<void>;
|
|
1624
1578
|
}
|
|
1625
1579
|
//#endregion
|
|
@@ -1627,292 +1581,291 @@ declare class DevEnvironment extends BaseEnvironment {
|
|
|
1627
1581
|
|
|
1628
1582
|
interface RollupCommonJSOptions {
|
|
1629
1583
|
/**
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1584
|
+
* A minimatch pattern, or array of patterns, which specifies the files in
|
|
1585
|
+
* the build the plugin should operate on. By default, all files with
|
|
1586
|
+
* extension `".cjs"` or those in `extensions` are included, but you can
|
|
1587
|
+
* narrow this list by only including specific files. These files will be
|
|
1588
|
+
* analyzed and transpiled if either the analysis does not find ES module
|
|
1589
|
+
* specific statements or `transformMixedEsModules` is `true`.
|
|
1590
|
+
* @default undefined
|
|
1591
|
+
*/
|
|
1638
1592
|
include?: string | RegExp | readonly (string | RegExp)[];
|
|
1639
1593
|
/**
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1594
|
+
* A minimatch pattern, or array of patterns, which specifies the files in
|
|
1595
|
+
* the build the plugin should _ignore_. By default, all files with
|
|
1596
|
+
* extensions other than those in `extensions` or `".cjs"` are ignored, but you
|
|
1597
|
+
* can exclude additional files. See also the `include` option.
|
|
1598
|
+
* @default undefined
|
|
1599
|
+
*/
|
|
1646
1600
|
exclude?: string | RegExp | readonly (string | RegExp)[];
|
|
1647
1601
|
/**
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1602
|
+
* For extensionless imports, search for extensions other than .js in the
|
|
1603
|
+
* order specified. Note that you need to make sure that non-JavaScript files
|
|
1604
|
+
* are transpiled by another plugin first.
|
|
1605
|
+
* @default [ '.js' ]
|
|
1606
|
+
*/
|
|
1653
1607
|
extensions?: ReadonlyArray<string>;
|
|
1654
1608
|
/**
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1609
|
+
* If true then uses of `global` won't be dealt with by this plugin
|
|
1610
|
+
* @default false
|
|
1611
|
+
*/
|
|
1658
1612
|
ignoreGlobal?: boolean;
|
|
1659
1613
|
/**
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1614
|
+
* If false, skips source map generation for CommonJS modules. This will
|
|
1615
|
+
* improve performance.
|
|
1616
|
+
* @default true
|
|
1617
|
+
*/
|
|
1664
1618
|
sourceMap?: boolean;
|
|
1665
1619
|
/**
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1620
|
+
* Some `require` calls cannot be resolved statically to be translated to
|
|
1621
|
+
* imports.
|
|
1622
|
+
* When this option is set to `false`, the generated code will either
|
|
1623
|
+
* directly throw an error when such a call is encountered or, when
|
|
1624
|
+
* `dynamicRequireTargets` is used, when such a call cannot be resolved with a
|
|
1625
|
+
* configured dynamic require target.
|
|
1626
|
+
* Setting this option to `true` will instead leave the `require` call in the
|
|
1627
|
+
* code or use it as a fallback for `dynamicRequireTargets`.
|
|
1628
|
+
* @default false
|
|
1629
|
+
*/
|
|
1676
1630
|
ignoreDynamicRequires?: boolean;
|
|
1677
1631
|
/**
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1632
|
+
* Instructs the plugin whether to enable mixed module transformations. This
|
|
1633
|
+
* is useful in scenarios with modules that contain a mix of ES `import`
|
|
1634
|
+
* statements and CommonJS `require` expressions. Set to `true` if `require`
|
|
1635
|
+
* calls should be transformed to imports in mixed modules, or `false` if the
|
|
1636
|
+
* `require` expressions should survive the transformation. The latter can be
|
|
1637
|
+
* important if the code contains environment detection, or you are coding
|
|
1638
|
+
* for an environment with special treatment for `require` calls such as
|
|
1639
|
+
* ElectronJS. See also the `ignore` option.
|
|
1640
|
+
* @default false
|
|
1641
|
+
*/
|
|
1688
1642
|
transformMixedEsModules?: boolean;
|
|
1689
1643
|
/**
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1644
|
+
* By default, this plugin will try to hoist `require` statements as imports
|
|
1645
|
+
* to the top of each file. While this works well for many code bases and
|
|
1646
|
+
* allows for very efficient ESM output, it does not perfectly capture
|
|
1647
|
+
* CommonJS semantics as the order of side effects like log statements may
|
|
1648
|
+
* change. But it is especially problematic when there are circular `require`
|
|
1649
|
+
* calls between CommonJS modules as those often rely on the lazy execution of
|
|
1650
|
+
* nested `require` calls.
|
|
1651
|
+
*
|
|
1652
|
+
* Setting this option to `true` will wrap all CommonJS files in functions
|
|
1653
|
+
* which are executed when they are required for the first time, preserving
|
|
1654
|
+
* NodeJS semantics. Note that this can have an impact on the size and
|
|
1655
|
+
* performance of the generated code.
|
|
1656
|
+
*
|
|
1657
|
+
* The default value of `"auto"` will only wrap CommonJS files when they are
|
|
1658
|
+
* part of a CommonJS dependency cycle, e.g. an index file that is required by
|
|
1659
|
+
* many of its dependencies. All other CommonJS files are hoisted. This is the
|
|
1660
|
+
* recommended setting for most code bases.
|
|
1661
|
+
*
|
|
1662
|
+
* `false` will entirely prevent wrapping and hoist all files. This may still
|
|
1663
|
+
* work depending on the nature of cyclic dependencies but will often cause
|
|
1664
|
+
* problems.
|
|
1665
|
+
*
|
|
1666
|
+
* You can also provide a minimatch pattern, or array of patterns, to only
|
|
1667
|
+
* specify a subset of files which should be wrapped in functions for proper
|
|
1668
|
+
* `require` semantics.
|
|
1669
|
+
*
|
|
1670
|
+
* `"debug"` works like `"auto"` but after bundling, it will display a warning
|
|
1671
|
+
* containing a list of ids that have been wrapped which can be used as
|
|
1672
|
+
* minimatch pattern for fine-tuning.
|
|
1673
|
+
* @default "auto"
|
|
1674
|
+
*/
|
|
1721
1675
|
strictRequires?: boolean | string | RegExp | readonly (string | RegExp)[];
|
|
1722
1676
|
/**
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1677
|
+
* Sometimes you have to leave require statements unconverted. Pass an array
|
|
1678
|
+
* containing the IDs or a `id => boolean` function.
|
|
1679
|
+
* @default []
|
|
1680
|
+
*/
|
|
1727
1681
|
ignore?: ReadonlyArray<string> | ((id: string) => boolean);
|
|
1728
1682
|
/**
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1683
|
+
* In most cases, where `require` calls are inside a `try-catch` clause,
|
|
1684
|
+
* they should be left unconverted as it requires an optional dependency
|
|
1685
|
+
* that may or may not be installed beside the rolled up package.
|
|
1686
|
+
* Due to the conversion of `require` to a static `import` - the call is
|
|
1687
|
+
* hoisted to the top of the file, outside the `try-catch` clause.
|
|
1688
|
+
*
|
|
1689
|
+
* - `true`: Default. All `require` calls inside a `try` will be left unconverted.
|
|
1690
|
+
* - `false`: All `require` calls inside a `try` will be converted as if the
|
|
1691
|
+
* `try-catch` clause is not there.
|
|
1692
|
+
* - `remove`: Remove all `require` calls from inside any `try` block.
|
|
1693
|
+
* - `string[]`: Pass an array containing the IDs to left unconverted.
|
|
1694
|
+
* - `((id: string) => boolean|'remove')`: Pass a function that controls
|
|
1695
|
+
* individual IDs.
|
|
1696
|
+
*
|
|
1697
|
+
* @default true
|
|
1698
|
+
*/
|
|
1745
1699
|
ignoreTryCatch?: boolean | 'remove' | ReadonlyArray<string> | ((id: string) => boolean | 'remove');
|
|
1746
1700
|
/**
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1701
|
+
* Controls how to render imports from external dependencies. By default,
|
|
1702
|
+
* this plugin assumes that all external dependencies are CommonJS. This
|
|
1703
|
+
* means they are rendered as default imports to be compatible with e.g.
|
|
1704
|
+
* NodeJS where ES modules can only import a default export from a CommonJS
|
|
1705
|
+
* dependency.
|
|
1706
|
+
*
|
|
1707
|
+
* If you set `esmExternals` to `true`, this plugin assumes that all
|
|
1708
|
+
* external dependencies are ES modules and respect the
|
|
1709
|
+
* `requireReturnsDefault` option. If that option is not set, they will be
|
|
1710
|
+
* rendered as namespace imports.
|
|
1711
|
+
*
|
|
1712
|
+
* You can also supply an array of ids to be treated as ES modules, or a
|
|
1713
|
+
* function that will be passed each external id to determine whether it is
|
|
1714
|
+
* an ES module.
|
|
1715
|
+
* @default false
|
|
1716
|
+
*/
|
|
1763
1717
|
esmExternals?: boolean | ReadonlyArray<string> | ((id: string) => boolean);
|
|
1764
1718
|
/**
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1719
|
+
* Controls what is returned when requiring an ES module from a CommonJS file.
|
|
1720
|
+
* When using the `esmExternals` option, this will also apply to external
|
|
1721
|
+
* modules. By default, this plugin will render those imports as namespace
|
|
1722
|
+
* imports i.e.
|
|
1723
|
+
*
|
|
1724
|
+
* ```js
|
|
1725
|
+
* // input
|
|
1726
|
+
* const foo = require('foo');
|
|
1727
|
+
*
|
|
1728
|
+
* // output
|
|
1729
|
+
* import * as foo from 'foo';
|
|
1730
|
+
* ```
|
|
1731
|
+
*
|
|
1732
|
+
* However, there are some situations where this may not be desired.
|
|
1733
|
+
* For these situations, you can change Rollup's behaviour either globally or
|
|
1734
|
+
* per module. To change it globally, set the `requireReturnsDefault` option
|
|
1735
|
+
* to one of the following values:
|
|
1736
|
+
*
|
|
1737
|
+
* - `false`: This is the default, requiring an ES module returns its
|
|
1738
|
+
* namespace. This is the only option that will also add a marker
|
|
1739
|
+
* `__esModule: true` to the namespace to support interop patterns in
|
|
1740
|
+
* CommonJS modules that are transpiled ES modules.
|
|
1741
|
+
* - `"namespace"`: Like `false`, requiring an ES module returns its
|
|
1742
|
+
* namespace, but the plugin does not add the `__esModule` marker and thus
|
|
1743
|
+
* creates more efficient code. For external dependencies when using
|
|
1744
|
+
* `esmExternals: true`, no additional interop code is generated.
|
|
1745
|
+
* - `"auto"`: This is complementary to how `output.exports: "auto"` works in
|
|
1746
|
+
* Rollup: If a module has a default export and no named exports, requiring
|
|
1747
|
+
* that module returns the default export. In all other cases, the namespace
|
|
1748
|
+
* is returned. For external dependencies when using `esmExternals: true`, a
|
|
1749
|
+
* corresponding interop helper is added.
|
|
1750
|
+
* - `"preferred"`: If a module has a default export, requiring that module
|
|
1751
|
+
* always returns the default export, no matter whether additional named
|
|
1752
|
+
* exports exist. This is similar to how previous versions of this plugin
|
|
1753
|
+
* worked. Again for external dependencies when using `esmExternals: true`,
|
|
1754
|
+
* an interop helper is added.
|
|
1755
|
+
* - `true`: This will always try to return the default export on require
|
|
1756
|
+
* without checking if it actually exists. This can throw at build time if
|
|
1757
|
+
* there is no default export. This is how external dependencies are handled
|
|
1758
|
+
* when `esmExternals` is not used. The advantage over the other options is
|
|
1759
|
+
* that, like `false`, this does not add an interop helper for external
|
|
1760
|
+
* dependencies, keeping the code lean.
|
|
1761
|
+
*
|
|
1762
|
+
* To change this for individual modules, you can supply a function for
|
|
1763
|
+
* `requireReturnsDefault` instead. This function will then be called once for
|
|
1764
|
+
* each required ES module or external dependency with the corresponding id
|
|
1765
|
+
* and allows you to return different values for different modules.
|
|
1766
|
+
* @default false
|
|
1767
|
+
*/
|
|
1814
1768
|
requireReturnsDefault?: boolean | 'auto' | 'preferred' | 'namespace' | ((id: string) => boolean | 'auto' | 'preferred' | 'namespace');
|
|
1815
|
-
|
|
1816
1769
|
/**
|
|
1817
|
-
|
|
1818
|
-
|
|
1770
|
+
* @default "auto"
|
|
1771
|
+
*/
|
|
1819
1772
|
defaultIsModuleExports?: boolean | 'auto' | ((id: string) => boolean | 'auto');
|
|
1820
1773
|
/**
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1774
|
+
* Some modules contain dynamic `require` calls, or require modules that
|
|
1775
|
+
* contain circular dependencies, which are not handled well by static
|
|
1776
|
+
* imports. Including those modules as `dynamicRequireTargets` will simulate a
|
|
1777
|
+
* CommonJS (NodeJS-like) environment for them with support for dynamic
|
|
1778
|
+
* dependencies. It also enables `strictRequires` for those modules.
|
|
1779
|
+
*
|
|
1780
|
+
* Note: In extreme cases, this feature may result in some paths being
|
|
1781
|
+
* rendered as absolute in the final bundle. The plugin tries to avoid
|
|
1782
|
+
* exposing paths from the local machine, but if you are `dynamicRequirePaths`
|
|
1783
|
+
* with paths that are far away from your project's folder, that may require
|
|
1784
|
+
* replacing strings like `"/Users/John/Desktop/foo-project/"` -\> `"/"`.
|
|
1785
|
+
*/
|
|
1833
1786
|
dynamicRequireTargets?: string | ReadonlyArray<string>;
|
|
1834
1787
|
/**
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1788
|
+
* To avoid long paths when using the `dynamicRequireTargets` option, you can use this option to specify a directory
|
|
1789
|
+
* that is a common parent for all files that use dynamic require statements. Using a directory higher up such as `/`
|
|
1790
|
+
* may lead to unnecessarily long paths in the generated code and may expose directory names on your machine like your
|
|
1791
|
+
* home directory name. By default, it uses the current working directory.
|
|
1792
|
+
*/
|
|
1840
1793
|
dynamicRequireRoot?: string;
|
|
1841
1794
|
}
|
|
1842
1795
|
//#endregion
|
|
1843
1796
|
//#region src/types/dynamicImportVars.d.ts
|
|
1844
1797
|
interface RollupDynamicImportVarsOptions {
|
|
1845
1798
|
/**
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1799
|
+
* Files to include in this plugin (default all).
|
|
1800
|
+
* @default []
|
|
1801
|
+
*/
|
|
1849
1802
|
include?: string | RegExp | (string | RegExp)[];
|
|
1850
1803
|
/**
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1804
|
+
* Files to exclude in this plugin (default none).
|
|
1805
|
+
* @default []
|
|
1806
|
+
*/
|
|
1854
1807
|
exclude?: string | RegExp | (string | RegExp)[];
|
|
1855
1808
|
/**
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1809
|
+
* By default, the plugin quits the build process when it encounters an error. If you set this option to true, it will throw a warning instead and leave the code untouched.
|
|
1810
|
+
* @default false
|
|
1811
|
+
*/
|
|
1859
1812
|
warnOnError?: boolean;
|
|
1860
1813
|
}
|
|
1861
1814
|
//#endregion
|
|
1862
1815
|
//#region src/node/plugins/terser.d.ts
|
|
1863
1816
|
interface TerserOptions extends TerserMinifyOptions {
|
|
1864
1817
|
/**
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1818
|
+
* Vite-specific option to specify the max number of workers to spawn
|
|
1819
|
+
* when minifying files with terser.
|
|
1820
|
+
*
|
|
1821
|
+
* @default number of CPUs minus 1
|
|
1822
|
+
*/
|
|
1870
1823
|
maxWorkers?: number;
|
|
1871
1824
|
}
|
|
1872
1825
|
//#endregion
|
|
1873
1826
|
//#region src/node/plugins/resolve.d.ts
|
|
1874
1827
|
interface EnvironmentResolveOptions {
|
|
1875
1828
|
/**
|
|
1876
|
-
|
|
1877
|
-
|
|
1829
|
+
* @default ['browser', 'module', 'jsnext:main', 'jsnext']
|
|
1830
|
+
*/
|
|
1878
1831
|
mainFields?: string[];
|
|
1879
1832
|
conditions?: string[];
|
|
1880
1833
|
externalConditions?: string[];
|
|
1881
1834
|
/**
|
|
1882
|
-
|
|
1883
|
-
|
|
1835
|
+
* @default ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']
|
|
1836
|
+
*/
|
|
1884
1837
|
extensions?: string[];
|
|
1885
1838
|
dedupe?: string[];
|
|
1886
1839
|
/**
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1840
|
+
* Prevent listed dependencies from being externalized and will get bundled in build.
|
|
1841
|
+
* Only works in server environments for now. Previously this was `ssr.noExternal`.
|
|
1842
|
+
* @experimental
|
|
1843
|
+
*/
|
|
1891
1844
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
|
1892
1845
|
/**
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1846
|
+
* Externalize the given dependencies and their transitive dependencies.
|
|
1847
|
+
* Only works in server environments for now. Previously this was `ssr.external`.
|
|
1848
|
+
* @experimental
|
|
1849
|
+
*/
|
|
1897
1850
|
external?: string[] | true;
|
|
1898
1851
|
/**
|
|
1899
|
-
|
|
1900
|
-
|
|
1852
|
+
* Array of strings or regular expressions that indicate what modules are builtin for the environment.
|
|
1853
|
+
*/
|
|
1901
1854
|
builtins?: (string | RegExp)[];
|
|
1902
1855
|
}
|
|
1903
1856
|
interface ResolveOptions extends EnvironmentResolveOptions {
|
|
1904
1857
|
/**
|
|
1905
|
-
|
|
1906
|
-
|
|
1858
|
+
* @default false
|
|
1859
|
+
*/
|
|
1907
1860
|
preserveSymlinks?: boolean;
|
|
1908
1861
|
/**
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1862
|
+
* Enable tsconfig paths resolution
|
|
1863
|
+
*
|
|
1864
|
+
* This option does not have any effect if `experimental.enableNativePlugin` is set to `false`.
|
|
1865
|
+
*
|
|
1866
|
+
* @default false
|
|
1867
|
+
* @experimental
|
|
1868
|
+
*/
|
|
1916
1869
|
tsconfigPaths?: boolean;
|
|
1917
1870
|
}
|
|
1918
1871
|
interface ResolvePluginOptions {
|
|
@@ -1921,10 +1874,10 @@ interface ResolvePluginOptions {
|
|
|
1921
1874
|
isProduction: boolean;
|
|
1922
1875
|
packageCache?: PackageCache;
|
|
1923
1876
|
/**
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1877
|
+
* src code mode also attempts the following:
|
|
1878
|
+
* - resolving /xxx as URLs
|
|
1879
|
+
* - resolving bare imports from optimized deps
|
|
1880
|
+
*/
|
|
1928
1881
|
asSrc?: boolean;
|
|
1929
1882
|
tryIndex?: boolean;
|
|
1930
1883
|
tryPrefix?: string;
|
|
@@ -1932,8 +1885,8 @@ interface ResolvePluginOptions {
|
|
|
1932
1885
|
isRequire?: boolean;
|
|
1933
1886
|
scan?: boolean;
|
|
1934
1887
|
/**
|
|
1935
|
-
|
|
1936
|
-
|
|
1888
|
+
* Enable when `legacy.inconsistentCjsInterop` is true. See that option for more details.
|
|
1889
|
+
*/
|
|
1937
1890
|
legacyInconsistentCjsInterop?: boolean;
|
|
1938
1891
|
}
|
|
1939
1892
|
interface InternalResolveOptions extends Required<ResolveOptions>, ResolvePluginOptions {}
|
|
@@ -1963,264 +1916,264 @@ interface PackageData {
|
|
|
1963
1916
|
//#region src/node/plugins/license.d.ts
|
|
1964
1917
|
interface LicenseOptions {
|
|
1965
1918
|
/**
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1919
|
+
* The output file name of the license file relative to the output directory.
|
|
1920
|
+
* Specify a path that ends with `.json` to output the raw JSON metadata.
|
|
1921
|
+
*
|
|
1922
|
+
* @default '.vite/license.md'
|
|
1923
|
+
*/
|
|
1971
1924
|
fileName: string;
|
|
1972
1925
|
}
|
|
1973
1926
|
//#endregion
|
|
1974
1927
|
//#region src/node/build.d.ts
|
|
1975
1928
|
interface BuildEnvironmentOptions {
|
|
1976
1929
|
/**
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1930
|
+
* Compatibility transform target. The transform is performed with esbuild
|
|
1931
|
+
* and the lowest supported target is es2015. Note this only handles
|
|
1932
|
+
* syntax transformation and does not cover polyfills
|
|
1933
|
+
*
|
|
1934
|
+
* Default: 'baseline-widely-available' - transpile targeting browsers that
|
|
1935
|
+
* are included in the Baseline Widely Available on 2026-01-01.
|
|
1936
|
+
* (Chrome 111+, Edge 111+, Firefox 114+, Safari 16.4+).
|
|
1937
|
+
*
|
|
1938
|
+
* Another special value is 'esnext' - which only performs minimal transpiling
|
|
1939
|
+
* (for minification compat).
|
|
1940
|
+
*
|
|
1941
|
+
* For custom targets, see https://esbuild.github.io/api/#target and
|
|
1942
|
+
* https://esbuild.github.io/content-types/#javascript for more details.
|
|
1943
|
+
* @default 'baseline-widely-available'
|
|
1944
|
+
*/
|
|
1992
1945
|
target?: "baseline-widely-available" | EsbuildTarget | false;
|
|
1993
1946
|
/**
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1947
|
+
* whether to inject module preload polyfill.
|
|
1948
|
+
* Note: does not apply to library mode.
|
|
1949
|
+
* @default true
|
|
1950
|
+
* @deprecated use `modulePreload.polyfill` instead
|
|
1951
|
+
*/
|
|
1999
1952
|
polyfillModulePreload?: boolean;
|
|
2000
1953
|
/**
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
1954
|
+
* Configure module preload
|
|
1955
|
+
* Note: does not apply to library mode.
|
|
1956
|
+
* @default true
|
|
1957
|
+
*/
|
|
2005
1958
|
modulePreload?: boolean | ModulePreloadOptions;
|
|
2006
1959
|
/**
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
1960
|
+
* Directory relative from `root` where build output will be placed. If the
|
|
1961
|
+
* directory exists, it will be removed before the build.
|
|
1962
|
+
* @default 'dist'
|
|
1963
|
+
*/
|
|
2011
1964
|
outDir?: string;
|
|
2012
1965
|
/**
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
1966
|
+
* Directory relative from `outDir` where the built js/css/image assets will
|
|
1967
|
+
* be placed.
|
|
1968
|
+
* @default 'assets'
|
|
1969
|
+
*/
|
|
2017
1970
|
assetsDir?: string;
|
|
2018
1971
|
/**
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
1972
|
+
* Static asset files smaller than this number (in bytes) will be inlined as
|
|
1973
|
+
* base64 strings. If a callback is passed, a boolean can be returned to opt-in
|
|
1974
|
+
* or opt-out of inlining. If nothing is returned the default logic applies.
|
|
1975
|
+
*
|
|
1976
|
+
* Default limit is `4096` (4 KiB). Set to `0` to disable.
|
|
1977
|
+
* @default 4096
|
|
1978
|
+
*/
|
|
2026
1979
|
assetsInlineLimit?: number | ((filePath: string, content: Buffer) => boolean | undefined);
|
|
2027
1980
|
/**
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
1981
|
+
* Whether to code-split CSS. When enabled, CSS in async chunks will be
|
|
1982
|
+
* inlined as strings in the chunk and inserted via dynamically created
|
|
1983
|
+
* style tags when the chunk is loaded.
|
|
1984
|
+
* @default true
|
|
1985
|
+
*/
|
|
2033
1986
|
cssCodeSplit?: boolean;
|
|
2034
1987
|
/**
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
1988
|
+
* An optional separate target for CSS minification.
|
|
1989
|
+
* As esbuild only supports configuring targets to mainstream
|
|
1990
|
+
* browsers, users may need this option when they are targeting
|
|
1991
|
+
* a niche browser that comes with most modern JavaScript features
|
|
1992
|
+
* but has poor CSS support, e.g. Android WeChat WebView, which
|
|
1993
|
+
* doesn't support the #RGBA syntax.
|
|
1994
|
+
* @default target
|
|
1995
|
+
*/
|
|
2043
1996
|
cssTarget?: EsbuildTarget | false;
|
|
2044
1997
|
/**
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
1998
|
+
* Override CSS minification specifically instead of defaulting to `build.minify`,
|
|
1999
|
+
* so you can configure minification for JS and CSS separately.
|
|
2000
|
+
* @default 'lightningcss'
|
|
2001
|
+
*/
|
|
2049
2002
|
cssMinify?: boolean | "lightningcss" | "esbuild";
|
|
2050
2003
|
/**
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2004
|
+
* If `true`, a separate sourcemap file will be created. If 'inline', the
|
|
2005
|
+
* sourcemap will be appended to the resulting output file as data URI.
|
|
2006
|
+
* 'hidden' works like `true` except that the corresponding sourcemap
|
|
2007
|
+
* comments in the bundled files are suppressed.
|
|
2008
|
+
* @default false
|
|
2009
|
+
*/
|
|
2057
2010
|
sourcemap?: boolean | "inline" | "hidden";
|
|
2058
2011
|
/**
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2012
|
+
* Set to `false` to disable minification, or specify the minifier to use.
|
|
2013
|
+
* Available options are 'oxc' or 'terser' or 'esbuild'.
|
|
2014
|
+
* @default 'oxc'
|
|
2015
|
+
*/
|
|
2063
2016
|
minify?: boolean | "oxc" | "terser" | "esbuild";
|
|
2064
2017
|
/**
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2018
|
+
* Options for terser
|
|
2019
|
+
* https://terser.org/docs/api-reference#minify-options
|
|
2020
|
+
*
|
|
2021
|
+
* In addition, you can also pass a `maxWorkers: number` option to specify the
|
|
2022
|
+
* max number of workers to spawn. Defaults to the number of CPUs minus 1.
|
|
2023
|
+
*/
|
|
2071
2024
|
terserOptions?: TerserOptions;
|
|
2072
2025
|
/**
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2026
|
+
* Alias to `rolldownOptions`
|
|
2027
|
+
* @deprecated Use `rolldownOptions` instead.
|
|
2028
|
+
*/
|
|
2076
2029
|
rollupOptions?: RolldownOptions;
|
|
2077
2030
|
/**
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2031
|
+
* Will be merged with internal rolldown options.
|
|
2032
|
+
* https://rolldown.rs/reference/config-options
|
|
2033
|
+
*/
|
|
2081
2034
|
rolldownOptions?: RolldownOptions;
|
|
2082
2035
|
/**
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2036
|
+
* Options to pass on to `@rollup/plugin-commonjs`
|
|
2037
|
+
* @deprecated This option is no-op and will be removed in future versions.
|
|
2038
|
+
*/
|
|
2086
2039
|
commonjsOptions?: RollupCommonJSOptions;
|
|
2087
2040
|
/**
|
|
2088
|
-
|
|
2089
|
-
|
|
2041
|
+
* Options to pass on to `@rollup/plugin-dynamic-import-vars`
|
|
2042
|
+
*/
|
|
2090
2043
|
dynamicImportVarsOptions?: RollupDynamicImportVarsOptions;
|
|
2091
2044
|
/**
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2045
|
+
* Whether to write bundle to disk
|
|
2046
|
+
* @default true
|
|
2047
|
+
*/
|
|
2095
2048
|
write?: boolean;
|
|
2096
2049
|
/**
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2050
|
+
* Empty outDir on write.
|
|
2051
|
+
* @default true when outDir is a sub directory of project root
|
|
2052
|
+
*/
|
|
2100
2053
|
emptyOutDir?: boolean | null;
|
|
2101
2054
|
/**
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2055
|
+
* Copy the public directory to outDir on write.
|
|
2056
|
+
* @default true
|
|
2057
|
+
*/
|
|
2105
2058
|
copyPublicDir?: boolean;
|
|
2106
2059
|
/**
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2060
|
+
* Whether to emit a `.vite/license.md` file that includes all bundled dependencies'
|
|
2061
|
+
* licenses. Pass an object to customize the output file name.
|
|
2062
|
+
* @default false
|
|
2063
|
+
*/
|
|
2111
2064
|
license?: boolean | LicenseOptions;
|
|
2112
2065
|
/**
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2066
|
+
* Whether to emit a .vite/manifest.json in the output dir to map hash-less filenames
|
|
2067
|
+
* to their hashed versions. Useful when you want to generate your own HTML
|
|
2068
|
+
* instead of using the one generated by Vite.
|
|
2069
|
+
*
|
|
2070
|
+
* Example:
|
|
2071
|
+
*
|
|
2072
|
+
* ```json
|
|
2073
|
+
* {
|
|
2074
|
+
* "main.js": {
|
|
2075
|
+
* "file": "main.68fe3fad.js",
|
|
2076
|
+
* "css": "main.e6b63442.css",
|
|
2077
|
+
* "imports": [...],
|
|
2078
|
+
* "dynamicImports": [...]
|
|
2079
|
+
* }
|
|
2080
|
+
* }
|
|
2081
|
+
* ```
|
|
2082
|
+
* @default false
|
|
2083
|
+
*/
|
|
2131
2084
|
manifest?: boolean | string;
|
|
2132
2085
|
/**
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2086
|
+
* Build in library mode. The value should be the global name of the lib in
|
|
2087
|
+
* UMD mode. This will produce esm + cjs + umd bundle formats with default
|
|
2088
|
+
* configurations that are suitable for distributing libraries.
|
|
2089
|
+
* @default false
|
|
2090
|
+
*/
|
|
2138
2091
|
lib?: LibraryOptions | false;
|
|
2139
2092
|
/**
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2093
|
+
* Produce SSR oriented build. Note this requires specifying SSR entry via
|
|
2094
|
+
* `rollupOptions.input`.
|
|
2095
|
+
* @default false
|
|
2096
|
+
*/
|
|
2144
2097
|
ssr?: boolean | string;
|
|
2145
2098
|
/**
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2099
|
+
* Generate SSR manifest for determining style links and asset preload
|
|
2100
|
+
* directives in production.
|
|
2101
|
+
* @default false
|
|
2102
|
+
*/
|
|
2150
2103
|
ssrManifest?: boolean | string;
|
|
2151
2104
|
/**
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2105
|
+
* Emit assets during SSR.
|
|
2106
|
+
* @default false
|
|
2107
|
+
*/
|
|
2155
2108
|
ssrEmitAssets?: boolean;
|
|
2156
2109
|
/**
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2110
|
+
* Emit assets during build. Frameworks can set environments.ssr.build.emitAssets
|
|
2111
|
+
* By default, it is true for the client and false for other environments.
|
|
2112
|
+
*/
|
|
2160
2113
|
emitAssets?: boolean;
|
|
2161
2114
|
/**
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2115
|
+
* Set to false to disable reporting compressed chunk sizes.
|
|
2116
|
+
* Can slightly improve build speed.
|
|
2117
|
+
* @default true
|
|
2118
|
+
*/
|
|
2166
2119
|
reportCompressedSize?: boolean;
|
|
2167
2120
|
/**
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2121
|
+
* Adjust chunk size warning limit (in kB).
|
|
2122
|
+
* @default 500
|
|
2123
|
+
*/
|
|
2171
2124
|
chunkSizeWarningLimit?: number;
|
|
2172
2125
|
/**
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2126
|
+
* Rollup watch options
|
|
2127
|
+
* https://rollupjs.org/configuration-options/#watch
|
|
2128
|
+
* @default null
|
|
2129
|
+
*/
|
|
2177
2130
|
watch?: WatcherOptions | null;
|
|
2178
2131
|
/**
|
|
2179
|
-
|
|
2180
|
-
|
|
2132
|
+
* create the Build Environment instance
|
|
2133
|
+
*/
|
|
2181
2134
|
createEnvironment?: (name: string, config: ResolvedConfig) => Promise<BuildEnvironment> | BuildEnvironment;
|
|
2182
2135
|
}
|
|
2183
2136
|
type BuildOptions = BuildEnvironmentOptions;
|
|
2184
2137
|
interface LibraryOptions {
|
|
2185
2138
|
/**
|
|
2186
|
-
|
|
2187
|
-
|
|
2139
|
+
* Path of library entry
|
|
2140
|
+
*/
|
|
2188
2141
|
entry: InputOption;
|
|
2189
2142
|
/**
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2143
|
+
* The name of the exposed global variable. Required when the `formats` option includes
|
|
2144
|
+
* `umd` or `iife`
|
|
2145
|
+
*/
|
|
2193
2146
|
name?: string;
|
|
2194
2147
|
/**
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2148
|
+
* Output bundle formats
|
|
2149
|
+
* @default ['es', 'umd']
|
|
2150
|
+
*/
|
|
2198
2151
|
formats?: LibraryFormats[];
|
|
2199
2152
|
/**
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2153
|
+
* The name of the package file output. The default file name is the name option
|
|
2154
|
+
* of the project package.json. It can also be defined as a function taking the
|
|
2155
|
+
* format as an argument.
|
|
2156
|
+
*/
|
|
2204
2157
|
fileName?: string | ((format: ModuleFormat, entryName: string) => string);
|
|
2205
2158
|
/**
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2159
|
+
* The name of the CSS file output if the library imports CSS. Defaults to the
|
|
2160
|
+
* same value as `build.lib.fileName` if it's set a string, otherwise it falls
|
|
2161
|
+
* back to the name option of the project package.json.
|
|
2162
|
+
*/
|
|
2210
2163
|
cssFileName?: string;
|
|
2211
2164
|
}
|
|
2212
2165
|
type LibraryFormats = "es" | "cjs" | "umd" | "iife";
|
|
2213
2166
|
interface ModulePreloadOptions {
|
|
2214
2167
|
/**
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2168
|
+
* Whether to inject a module preload polyfill.
|
|
2169
|
+
* Note: does not apply to library mode.
|
|
2170
|
+
* @default true
|
|
2171
|
+
*/
|
|
2219
2172
|
polyfill?: boolean;
|
|
2220
2173
|
/**
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2174
|
+
* Resolve the list of dependencies to preload for a given dynamic import
|
|
2175
|
+
* @experimental
|
|
2176
|
+
*/
|
|
2224
2177
|
resolveDependencies?: ResolveModulePreloadDependenciesFn;
|
|
2225
2178
|
}
|
|
2226
2179
|
interface ResolvedModulePreloadOptions {
|
|
@@ -2267,18 +2220,18 @@ interface ViteBuilder {
|
|
|
2267
2220
|
}
|
|
2268
2221
|
interface BuilderOptions {
|
|
2269
2222
|
/**
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2223
|
+
* Whether to share the config instance among environments to align with the behavior of dev server.
|
|
2224
|
+
*
|
|
2225
|
+
* @default false
|
|
2226
|
+
* @experimental
|
|
2227
|
+
*/
|
|
2275
2228
|
sharedConfigBuild?: boolean;
|
|
2276
2229
|
/**
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2230
|
+
* Whether to share the plugin instances among environments to align with the behavior of dev server.
|
|
2231
|
+
*
|
|
2232
|
+
* @default false
|
|
2233
|
+
* @experimental
|
|
2234
|
+
*/
|
|
2282
2235
|
sharedPlugins?: boolean;
|
|
2283
2236
|
buildApp?: (builder: ViteBuilder) => Promise<void>;
|
|
2284
2237
|
}
|
|
@@ -2334,8 +2287,7 @@ declare class EnvironmentPluginContainer<Env extends Environment = Environment>
|
|
|
2334
2287
|
resolveId(rawId: string, importer?: string | undefined, options?: {
|
|
2335
2288
|
kind?: ImportKind;
|
|
2336
2289
|
attributes?: Record<string, string>;
|
|
2337
|
-
custom?: CustomPluginOptions;
|
|
2338
|
-
/** @deprecated use `skipCalls` instead */
|
|
2290
|
+
custom?: CustomPluginOptions; /** @deprecated use `skipCalls` instead */
|
|
2339
2291
|
skip?: Set<Plugin>;
|
|
2340
2292
|
skipCalls?: readonly SkipInformation[];
|
|
2341
2293
|
|
|
@@ -2385,8 +2337,7 @@ declare class PluginContainer {
|
|
|
2385
2337
|
}): Promise<void>;
|
|
2386
2338
|
resolveId(rawId: string, importer?: string, options?: {
|
|
2387
2339
|
attributes?: Record<string, string>;
|
|
2388
|
-
custom?: CustomPluginOptions;
|
|
2389
|
-
/** @deprecated use `skipCalls` instead */
|
|
2340
|
+
custom?: CustomPluginOptions; /** @deprecated use `skipCalls` instead */
|
|
2390
2341
|
skip?: Set<Plugin>;
|
|
2391
2342
|
skipCalls?: readonly SkipInformation[];
|
|
2392
2343
|
ssr?: boolean;
|
|
@@ -2421,87 +2372,87 @@ declare class PluginContainer {
|
|
|
2421
2372
|
//#region src/node/server/index.d.ts
|
|
2422
2373
|
interface ServerOptions$1 extends CommonServerOptions {
|
|
2423
2374
|
/**
|
|
2424
|
-
|
|
2425
|
-
|
|
2375
|
+
* Configure HMR-specific options (port, host, path & protocol)
|
|
2376
|
+
*/
|
|
2426
2377
|
hmr?: HmrOptions | boolean;
|
|
2427
2378
|
/**
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2379
|
+
* Do not start the websocket connection.
|
|
2380
|
+
* @experimental
|
|
2381
|
+
*/
|
|
2431
2382
|
ws?: false;
|
|
2432
2383
|
/**
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2384
|
+
* Warm-up files to transform and cache the results in advance. This improves the
|
|
2385
|
+
* initial page load during server starts and prevents transform waterfalls.
|
|
2386
|
+
*/
|
|
2436
2387
|
warmup?: {
|
|
2437
2388
|
/**
|
|
2438
|
-
|
|
2439
|
-
|
|
2389
|
+
* The files to be transformed and used on the client-side. Supports glob patterns.
|
|
2390
|
+
*/
|
|
2440
2391
|
clientFiles?: string[];
|
|
2441
2392
|
/**
|
|
2442
|
-
|
|
2443
|
-
|
|
2393
|
+
* The files to be transformed and used in SSR. Supports glob patterns.
|
|
2394
|
+
*/
|
|
2444
2395
|
ssrFiles?: string[];
|
|
2445
2396
|
};
|
|
2446
2397
|
/**
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2398
|
+
* chokidar watch options or null to disable FS watching
|
|
2399
|
+
* https://github.com/paulmillr/chokidar/tree/3.6.0#api
|
|
2400
|
+
*/
|
|
2450
2401
|
watch?: WatchOptions | null;
|
|
2451
2402
|
/**
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2403
|
+
* Create Vite dev server to be used as a middleware in an existing server
|
|
2404
|
+
* @default false
|
|
2405
|
+
*/
|
|
2455
2406
|
middlewareMode?: boolean | {
|
|
2456
2407
|
/**
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2408
|
+
* Parent server instance to attach to
|
|
2409
|
+
*
|
|
2410
|
+
* This is needed to proxy WebSocket connections to the parent server.
|
|
2411
|
+
*/
|
|
2461
2412
|
server: HttpServer;
|
|
2462
2413
|
};
|
|
2463
2414
|
/**
|
|
2464
|
-
|
|
2465
|
-
|
|
2415
|
+
* Options for files served via '/\@fs/'.
|
|
2416
|
+
*/
|
|
2466
2417
|
fs?: FileSystemServeOptions;
|
|
2467
2418
|
/**
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2419
|
+
* Origin for the generated asset URLs.
|
|
2420
|
+
*
|
|
2421
|
+
* @example `http://127.0.0.1:8080`
|
|
2422
|
+
*/
|
|
2472
2423
|
origin?: string;
|
|
2473
2424
|
/**
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2425
|
+
* Pre-transform known direct imports
|
|
2426
|
+
* @default true
|
|
2427
|
+
*/
|
|
2477
2428
|
preTransformRequests?: boolean;
|
|
2478
2429
|
/**
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2430
|
+
* Whether or not to ignore-list source files in the dev server sourcemap, used to populate
|
|
2431
|
+
* the [`x_google_ignoreList` source map extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).
|
|
2432
|
+
*
|
|
2433
|
+
* By default, it excludes all paths containing `node_modules`. You can pass `false` to
|
|
2434
|
+
* disable this behavior, or, for full control, a function that takes the source path and
|
|
2435
|
+
* sourcemap path and returns whether to ignore the source path.
|
|
2436
|
+
*/
|
|
2486
2437
|
sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean);
|
|
2487
2438
|
/**
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2439
|
+
* Backward compatibility. The buildStart and buildEnd hooks were called only once for
|
|
2440
|
+
* the client environment. This option enables per-environment buildStart and buildEnd hooks.
|
|
2441
|
+
* @default false
|
|
2442
|
+
* @experimental
|
|
2443
|
+
*/
|
|
2493
2444
|
perEnvironmentStartEndDuringDev?: boolean;
|
|
2494
2445
|
/**
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2446
|
+
* Backward compatibility. The watchChange hook was called only once for the client environment.
|
|
2447
|
+
* This option enables per-environment watchChange hooks.
|
|
2448
|
+
* @default false
|
|
2449
|
+
* @experimental
|
|
2450
|
+
*/
|
|
2500
2451
|
perEnvironmentWatchChangeDuringDev?: boolean;
|
|
2501
2452
|
/**
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2453
|
+
* Run HMR tasks, by default the HMR propagation is done in parallel for all environments
|
|
2454
|
+
* @experimental
|
|
2455
|
+
*/
|
|
2505
2456
|
hotUpdateEnvironments?: (server: ViteDevServer, hmr: (environment: DevEnvironment) => Promise<void>) => Promise<void>;
|
|
2506
2457
|
}
|
|
2507
2458
|
interface ResolvedServerOptions extends Omit<RequiredExceptFor<ServerOptions$1, "host" | "https" | "proxy" | "hmr" | "ws" | "watch" | "origin" | "hotUpdateEnvironments">, "fs" | "middlewareMode" | "sourcemapIgnoreList"> {
|
|
@@ -2511,156 +2462,156 @@ interface ResolvedServerOptions extends Omit<RequiredExceptFor<ServerOptions$1,
|
|
|
2511
2462
|
}
|
|
2512
2463
|
interface FileSystemServeOptions {
|
|
2513
2464
|
/**
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2465
|
+
* Strictly restrict file accessing outside of allowing paths.
|
|
2466
|
+
*
|
|
2467
|
+
* Set to `false` to disable the warning
|
|
2468
|
+
*
|
|
2469
|
+
* @default true
|
|
2470
|
+
*/
|
|
2520
2471
|
strict?: boolean;
|
|
2521
2472
|
/**
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2473
|
+
* Restrict accessing files outside the allowed directories.
|
|
2474
|
+
*
|
|
2475
|
+
* Accepts absolute path or a path relative to project root.
|
|
2476
|
+
* Will try to search up for workspace root by default.
|
|
2477
|
+
*/
|
|
2527
2478
|
allow?: string[];
|
|
2528
2479
|
/**
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2480
|
+
* Restrict accessing files that matches the patterns.
|
|
2481
|
+
*
|
|
2482
|
+
* This will have higher priority than `allow`.
|
|
2483
|
+
* picomatch patterns are supported.
|
|
2484
|
+
*
|
|
2485
|
+
* @default ['.env', '.env.*', '*.{crt,pem}', '**\/.git/**']
|
|
2486
|
+
*/
|
|
2536
2487
|
deny?: string[];
|
|
2537
2488
|
}
|
|
2538
2489
|
type ServerHook = (this: MinimalPluginContextWithoutEnvironment, server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
2539
2490
|
type HttpServer = http.Server | Http2SecureServer;
|
|
2540
2491
|
interface ViteDevServer {
|
|
2541
2492
|
/**
|
|
2542
|
-
|
|
2543
|
-
|
|
2493
|
+
* The resolved vite config object
|
|
2494
|
+
*/
|
|
2544
2495
|
config: ResolvedConfig;
|
|
2545
2496
|
/**
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2497
|
+
* A connect app instance.
|
|
2498
|
+
* - Can be used to attach custom middlewares to the dev server.
|
|
2499
|
+
* - Can also be used as the handler function of a custom http server
|
|
2500
|
+
* or as a middleware in any connect-style Node.js frameworks
|
|
2501
|
+
*
|
|
2502
|
+
* https://github.com/senchalabs/connect#use-middleware
|
|
2503
|
+
*/
|
|
2553
2504
|
middlewares: Connect.Server;
|
|
2554
2505
|
/**
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2506
|
+
* native Node http server instance
|
|
2507
|
+
* will be null in middleware mode
|
|
2508
|
+
*/
|
|
2558
2509
|
httpServer: HttpServer | null;
|
|
2559
2510
|
/**
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2511
|
+
* Chokidar watcher instance. If `config.server.watch` is set to `null`,
|
|
2512
|
+
* it will not watch any files and calling `add` or `unwatch` will have no effect.
|
|
2513
|
+
* https://github.com/paulmillr/chokidar/tree/3.6.0#api
|
|
2514
|
+
*/
|
|
2564
2515
|
watcher: FSWatcher;
|
|
2565
2516
|
/**
|
|
2566
|
-
|
|
2567
|
-
|
|
2517
|
+
* WebSocket server with `send(payload)` method
|
|
2518
|
+
*/
|
|
2568
2519
|
ws: WebSocketServer;
|
|
2569
2520
|
/**
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2521
|
+
* An alias to `server.environments.client.hot`.
|
|
2522
|
+
* If you want to interact with all environments, loop over `server.environments`.
|
|
2523
|
+
*/
|
|
2573
2524
|
hot: NormalizedHotChannel;
|
|
2574
2525
|
/**
|
|
2575
|
-
|
|
2576
|
-
|
|
2526
|
+
* Rollup plugin container that can run plugin hooks on a given file
|
|
2527
|
+
*/
|
|
2577
2528
|
pluginContainer: PluginContainer;
|
|
2578
2529
|
/**
|
|
2579
|
-
|
|
2580
|
-
|
|
2530
|
+
* Module execution environments attached to the Vite server.
|
|
2531
|
+
*/
|
|
2581
2532
|
environments: Record<"client" | "ssr" | (string & {}), DevEnvironment>;
|
|
2582
2533
|
/**
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2534
|
+
* Module graph that tracks the import relationships, url to file mapping
|
|
2535
|
+
* and hmr state.
|
|
2536
|
+
*/
|
|
2586
2537
|
moduleGraph: ModuleGraph;
|
|
2587
2538
|
/**
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2539
|
+
* The resolved urls Vite prints on the CLI (URL-encoded). Returns `null`
|
|
2540
|
+
* in middleware mode or if the server is not listening on any port.
|
|
2541
|
+
*/
|
|
2591
2542
|
resolvedUrls: ResolvedServerUrls | null;
|
|
2592
2543
|
/**
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2544
|
+
* Programmatically resolve, load and transform a URL and get the result
|
|
2545
|
+
* without going through the http request pipeline.
|
|
2546
|
+
*/
|
|
2596
2547
|
transformRequest(url: string, options?: TransformOptions): Promise<TransformResult | null>;
|
|
2597
2548
|
/**
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2549
|
+
* Same as `transformRequest` but only warm up the URLs so the next request
|
|
2550
|
+
* will already be cached. The function will never throw as it handles and
|
|
2551
|
+
* reports errors internally.
|
|
2552
|
+
*/
|
|
2602
2553
|
warmupRequest(url: string, options?: TransformOptions): Promise<void>;
|
|
2603
2554
|
/**
|
|
2604
|
-
|
|
2605
|
-
|
|
2555
|
+
* Apply vite built-in HTML transforms and any plugin HTML transforms.
|
|
2556
|
+
*/
|
|
2606
2557
|
transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>;
|
|
2607
2558
|
/**
|
|
2608
|
-
|
|
2609
|
-
|
|
2559
|
+
* Transform module code into SSR format.
|
|
2560
|
+
*/
|
|
2610
2561
|
ssrTransform(code: string, inMap: SourceMap | {
|
|
2611
2562
|
mappings: "";
|
|
2612
2563
|
} | null, url: string, originalCode?: string): Promise<TransformResult | null>;
|
|
2613
2564
|
/**
|
|
2614
|
-
|
|
2615
|
-
|
|
2565
|
+
* Load a given URL as an instantiated module for SSR.
|
|
2566
|
+
*/
|
|
2616
2567
|
ssrLoadModule(url: string, opts?: {
|
|
2617
2568
|
fixStacktrace?: boolean;
|
|
2618
2569
|
}): Promise<Record<string, any>>;
|
|
2619
2570
|
/**
|
|
2620
|
-
|
|
2621
|
-
|
|
2571
|
+
* Returns a fixed version of the given stack
|
|
2572
|
+
*/
|
|
2622
2573
|
ssrRewriteStacktrace(stack: string): string;
|
|
2623
2574
|
/**
|
|
2624
|
-
|
|
2625
|
-
|
|
2575
|
+
* Mutates the given SSR error by rewriting the stacktrace
|
|
2576
|
+
*/
|
|
2626
2577
|
ssrFixStacktrace(e: Error): void;
|
|
2627
2578
|
/**
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2579
|
+
* Triggers HMR for a module in the module graph. You can use the `server.moduleGraph`
|
|
2580
|
+
* API to retrieve the module to be reloaded. If `hmr` is false, this is a no-op.
|
|
2581
|
+
*/
|
|
2631
2582
|
reloadModule(module: ModuleNode): Promise<void>;
|
|
2632
2583
|
/**
|
|
2633
|
-
|
|
2634
|
-
|
|
2584
|
+
* Start the server.
|
|
2585
|
+
*/
|
|
2635
2586
|
listen(port?: number, isRestart?: boolean): Promise<ViteDevServer>;
|
|
2636
2587
|
/**
|
|
2637
|
-
|
|
2638
|
-
|
|
2588
|
+
* Stop the server.
|
|
2589
|
+
*/
|
|
2639
2590
|
close(): Promise<void>;
|
|
2640
2591
|
/**
|
|
2641
|
-
|
|
2642
|
-
|
|
2592
|
+
* Print server urls
|
|
2593
|
+
*/
|
|
2643
2594
|
printUrls(): void;
|
|
2644
2595
|
/**
|
|
2645
|
-
|
|
2646
|
-
|
|
2596
|
+
* Bind CLI shortcuts
|
|
2597
|
+
*/
|
|
2647
2598
|
bindCLIShortcuts(options?: BindCLIShortcutsOptions<ViteDevServer>): void;
|
|
2648
2599
|
/**
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2600
|
+
* Restart the server.
|
|
2601
|
+
*
|
|
2602
|
+
* @param forceOptimize - force the optimizer to re-bundle, same as --force cli flag
|
|
2603
|
+
*/
|
|
2653
2604
|
restart(forceOptimize?: boolean): Promise<void>;
|
|
2654
2605
|
/**
|
|
2655
|
-
|
|
2656
|
-
|
|
2606
|
+
* Open browser
|
|
2607
|
+
*/
|
|
2657
2608
|
openBrowser(): void;
|
|
2658
2609
|
/**
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2610
|
+
* Calling `await server.waitForRequestsIdle(id)` will wait until all static imports
|
|
2611
|
+
* are processed. If called from a load or transform plugin hook, the id needs to be
|
|
2612
|
+
* passed as a parameter to avoid deadlocks. Calling this function after the first
|
|
2613
|
+
* static imports section of the module graph has been processed will resolve immediately.
|
|
2614
|
+
*/
|
|
2664
2615
|
waitForRequestsIdle: (ignoredId?: string) => Promise<void>;
|
|
2665
2616
|
}
|
|
2666
2617
|
interface ResolvedServerUrls {
|
|
@@ -2673,13 +2624,13 @@ declare function createServer(inlineConfig?: InlineConfig | ResolvedConfig): Pro
|
|
|
2673
2624
|
interface HtmlTagDescriptor {
|
|
2674
2625
|
tag: string;
|
|
2675
2626
|
/**
|
|
2676
|
-
|
|
2677
|
-
|
|
2627
|
+
* attribute values will be escaped automatically if needed
|
|
2628
|
+
*/
|
|
2678
2629
|
attrs?: Record<string, string | boolean | undefined>;
|
|
2679
2630
|
children?: string | HtmlTagDescriptor[];
|
|
2680
2631
|
/**
|
|
2681
|
-
|
|
2682
|
-
|
|
2632
|
+
* default: 'head-prepend'
|
|
2633
|
+
*/
|
|
2683
2634
|
injectTo?: "head" | "body" | "head-prepend" | "body-prepend";
|
|
2684
2635
|
}
|
|
2685
2636
|
type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
|
|
@@ -2688,12 +2639,12 @@ type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
|
|
|
2688
2639
|
};
|
|
2689
2640
|
interface IndexHtmlTransformContext {
|
|
2690
2641
|
/**
|
|
2691
|
-
|
|
2692
|
-
|
|
2642
|
+
* public path when served
|
|
2643
|
+
*/
|
|
2693
2644
|
path: string;
|
|
2694
2645
|
/**
|
|
2695
|
-
|
|
2696
|
-
|
|
2646
|
+
* filename on disk
|
|
2647
|
+
*/
|
|
2697
2648
|
filename: string;
|
|
2698
2649
|
server?: ViteDevServer;
|
|
2699
2650
|
bundle?: OutputBundle;
|
|
@@ -2741,8 +2692,8 @@ type StringFilter<Value = string | RegExp> = Value | Array<Value> | {
|
|
|
2741
2692
|
*/
|
|
2742
2693
|
interface PluginContextExtension {
|
|
2743
2694
|
/**
|
|
2744
|
-
|
|
2745
|
-
|
|
2695
|
+
* Vite-specific environment instance
|
|
2696
|
+
*/
|
|
2746
2697
|
environment: Environment;
|
|
2747
2698
|
}
|
|
2748
2699
|
interface PluginContextMetaExtension {
|
|
@@ -2762,32 +2713,32 @@ declare module "rolldown" {
|
|
|
2762
2713
|
* once per each environment allowing users to have completely different plugins
|
|
2763
2714
|
* for each of them. The constructor gets the resolved environment after the server
|
|
2764
2715
|
* and builder has already been created simplifying config access and cache
|
|
2765
|
-
* management for
|
|
2716
|
+
* management for environment specific plugins.
|
|
2766
2717
|
* Environment Plugins are closer to regular rollup plugins. They can't define
|
|
2767
2718
|
* app level hooks (like config, configResolved, configureServer, etc).
|
|
2768
2719
|
*/
|
|
2769
2720
|
interface Plugin<A = any> extends Rolldown.Plugin<A> {
|
|
2770
2721
|
/**
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2722
|
+
* Perform custom handling of HMR updates.
|
|
2723
|
+
* The handler receives an options containing changed filename, timestamp, a
|
|
2724
|
+
* list of modules affected by the file change, and the dev server instance.
|
|
2725
|
+
*
|
|
2726
|
+
* - The hook can return a filtered list of modules to narrow down the update.
|
|
2727
|
+
* e.g. for a Vue SFC, we can narrow down the part to update by comparing
|
|
2728
|
+
* the descriptors.
|
|
2729
|
+
*
|
|
2730
|
+
* - The hook can also return an empty array and then perform custom updates
|
|
2731
|
+
* by sending a custom hmr payload via environment.hot.send().
|
|
2732
|
+
*
|
|
2733
|
+
* - If the hook doesn't return a value, the hmr update will be performed as
|
|
2734
|
+
* normal.
|
|
2735
|
+
*/
|
|
2785
2736
|
hotUpdate?: ObjectHook<(this: MinimalPluginContext & {
|
|
2786
2737
|
environment: DevEnvironment;
|
|
2787
2738
|
}, options: HotUpdateOptions) => Array<EnvironmentModuleNode> | void | Promise<Array<EnvironmentModuleNode> | void>>;
|
|
2788
2739
|
/**
|
|
2789
|
-
|
|
2790
|
-
|
|
2740
|
+
* extend hooks with ssr flag
|
|
2741
|
+
*/
|
|
2791
2742
|
resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: {
|
|
2792
2743
|
kind?: ImportKind;
|
|
2793
2744
|
custom?: CustomPluginOptions;
|
|
@@ -2817,152 +2768,152 @@ interface Plugin<A = any> extends Rolldown.Plugin<A> {
|
|
|
2817
2768
|
};
|
|
2818
2769
|
}>;
|
|
2819
2770
|
/**
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2771
|
+
* Opt-in this plugin into the shared plugins pipeline.
|
|
2772
|
+
* For backward-compatibility, plugins are re-recreated for each environment
|
|
2773
|
+
* during `vite build --app`
|
|
2774
|
+
* We have an opt-in per plugin, and a general `builder.sharedPlugins`
|
|
2775
|
+
* In a future major, we'll flip the default to be shared by default
|
|
2776
|
+
* @experimental
|
|
2777
|
+
*/
|
|
2827
2778
|
sharedDuringBuild?: boolean;
|
|
2828
2779
|
/**
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2780
|
+
* Opt-in this plugin into per-environment buildStart and buildEnd during dev.
|
|
2781
|
+
* For backward-compatibility, the buildStart hook is called only once during
|
|
2782
|
+
* dev, for the client environment. Plugins can opt-in to be called
|
|
2783
|
+
* per-environment, aligning with the build hook behavior.
|
|
2784
|
+
* @experimental
|
|
2785
|
+
*/
|
|
2835
2786
|
perEnvironmentStartEndDuringDev?: boolean;
|
|
2836
2787
|
/**
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2788
|
+
* Opt-in this plugin into per-environment watchChange during dev.
|
|
2789
|
+
* For backward-compatibility, the watchChange hook is called only once during
|
|
2790
|
+
* dev, for the client environment. Plugins can opt-in to be called
|
|
2791
|
+
* per-environment, aligning with the watchChange hook behavior.
|
|
2792
|
+
* @experimental
|
|
2793
|
+
*/
|
|
2843
2794
|
perEnvironmentWatchChangeDuringDev?: boolean;
|
|
2844
2795
|
/**
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2796
|
+
* Enforce plugin invocation tier similar to webpack loaders. Hooks ordering
|
|
2797
|
+
* is still subject to the `order` property in the hook object.
|
|
2798
|
+
*
|
|
2799
|
+
* Plugin invocation order:
|
|
2800
|
+
* - alias resolution
|
|
2801
|
+
* - `enforce: 'pre'` plugins
|
|
2802
|
+
* - vite core plugins
|
|
2803
|
+
* - normal plugins
|
|
2804
|
+
* - vite build plugins
|
|
2805
|
+
* - `enforce: 'post'` plugins
|
|
2806
|
+
* - vite build post plugins
|
|
2807
|
+
*/
|
|
2857
2808
|
enforce?: "pre" | "post";
|
|
2858
2809
|
/**
|
|
2859
|
-
|
|
2860
|
-
|
|
2810
|
+
* Apply the plugin only for serve or build, or on certain conditions.
|
|
2811
|
+
*/
|
|
2861
2812
|
apply?: "serve" | "build" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean);
|
|
2862
2813
|
/**
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2814
|
+
* Define environments where this plugin should be active
|
|
2815
|
+
* By default, the plugin is active in all environments
|
|
2816
|
+
* @experimental
|
|
2817
|
+
*/
|
|
2867
2818
|
applyToEnvironment?: (environment: PartialEnvironment) => boolean | Promise<boolean> | PluginOption;
|
|
2868
2819
|
/**
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2820
|
+
* Modify vite config before it's resolved. The hook can either mutate the
|
|
2821
|
+
* passed-in config directly, or return a partial config object that will be
|
|
2822
|
+
* deeply merged into existing config.
|
|
2823
|
+
*
|
|
2824
|
+
* Note: User plugins are resolved before running this hook so injecting other
|
|
2825
|
+
* plugins inside the `config` hook will have no effect.
|
|
2826
|
+
*/
|
|
2876
2827
|
config?: ObjectHook<(this: ConfigPluginContext, config: UserConfig, env: ConfigEnv) => Omit<UserConfig, "plugins"> | null | void | Promise<Omit<UserConfig, "plugins"> | null | void>>;
|
|
2877
2828
|
/**
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2829
|
+
* Modify environment configs before it's resolved. The hook can either mutate the
|
|
2830
|
+
* passed-in environment config directly, or return a partial config object that will be
|
|
2831
|
+
* deeply merged into existing config.
|
|
2832
|
+
* This hook is called for each environment with a partially resolved environment config
|
|
2833
|
+
* that already accounts for the default environment config values set at the root level.
|
|
2834
|
+
* If plugins need to modify the config of a given environment, they should do it in this
|
|
2835
|
+
* hook instead of the config hook. Leaving the config hook only for modifying the root
|
|
2836
|
+
* default environment config.
|
|
2837
|
+
*/
|
|
2887
2838
|
configEnvironment?: ObjectHook<(this: ConfigPluginContext, name: string, config: EnvironmentOptions, env: ConfigEnv & {
|
|
2888
2839
|
/**
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2840
|
+
* Whether this environment is SSR environment and `ssr.target` is set to `'webworker'`.
|
|
2841
|
+
* Only intended to be used for backward compatibility.
|
|
2842
|
+
*/
|
|
2892
2843
|
isSsrTargetWebworker?: boolean;
|
|
2893
2844
|
}) => EnvironmentOptions | null | void | Promise<EnvironmentOptions | null | void>>;
|
|
2894
2845
|
/**
|
|
2895
|
-
|
|
2896
|
-
|
|
2846
|
+
* Use this hook to read and store the final resolved vite config.
|
|
2847
|
+
*/
|
|
2897
2848
|
configResolved?: ObjectHook<(this: MinimalPluginContextWithoutEnvironment, config: ResolvedConfig) => void | Promise<void>>;
|
|
2898
2849
|
/**
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2850
|
+
* Configure the vite server. The hook receives the {@link ViteDevServer}
|
|
2851
|
+
* instance. This can also be used to store a reference to the server
|
|
2852
|
+
* for use in other hooks.
|
|
2853
|
+
*
|
|
2854
|
+
* The hooks will be called before internal middlewares are applied. A hook
|
|
2855
|
+
* can return a post hook that will be called after internal middlewares
|
|
2856
|
+
* are applied. Hook can be async functions and will be called in series.
|
|
2857
|
+
*/
|
|
2907
2858
|
configureServer?: ObjectHook<ServerHook>;
|
|
2908
2859
|
/**
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2860
|
+
* Configure the preview server. The hook receives the {@link PreviewServer}
|
|
2861
|
+
* instance. This can also be used to store a reference to the server
|
|
2862
|
+
* for use in other hooks.
|
|
2863
|
+
*
|
|
2864
|
+
* The hooks are called before other middlewares are applied. A hook can
|
|
2865
|
+
* return a post hook that will be called after other middlewares are
|
|
2866
|
+
* applied. Hooks can be async functions and will be called in series.
|
|
2867
|
+
*/
|
|
2917
2868
|
configurePreviewServer?: ObjectHook<PreviewServerHook>;
|
|
2918
2869
|
/**
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2870
|
+
* Transform index.html.
|
|
2871
|
+
* The hook receives the following arguments:
|
|
2872
|
+
*
|
|
2873
|
+
* - html: string
|
|
2874
|
+
* - ctx: IndexHtmlTransformContext, which contains:
|
|
2875
|
+
* - path: public path when served
|
|
2876
|
+
* - filename: filename on disk
|
|
2877
|
+
* - server?: ViteDevServer (only present during serve)
|
|
2878
|
+
* - bundle?: rollup.OutputBundle (only present during build)
|
|
2879
|
+
* - chunk?: rollup.OutputChunk
|
|
2880
|
+
* - originalUrl?: string
|
|
2881
|
+
*
|
|
2882
|
+
* It can either return a transformed string, or a list of html tag
|
|
2883
|
+
* descriptors that will be injected into the `<head>` or `<body>`.
|
|
2884
|
+
*
|
|
2885
|
+
* By default the transform is applied **after** vite's internal html
|
|
2886
|
+
* transform. If you need to apply the transform before vite, use an object:
|
|
2887
|
+
* `{ order: 'pre', handler: hook }`
|
|
2888
|
+
*/
|
|
2938
2889
|
transformIndexHtml?: IndexHtmlTransform;
|
|
2939
2890
|
/**
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2891
|
+
* Build Environments
|
|
2892
|
+
*
|
|
2893
|
+
* @experimental
|
|
2894
|
+
*/
|
|
2944
2895
|
buildApp?: ObjectHook<BuildAppHook>;
|
|
2945
2896
|
/**
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2897
|
+
* Perform custom handling of HMR updates.
|
|
2898
|
+
* The handler receives a context containing changed filename, timestamp, a
|
|
2899
|
+
* list of modules affected by the file change, and the dev server instance.
|
|
2900
|
+
*
|
|
2901
|
+
* - The hook can return a filtered list of modules to narrow down the update.
|
|
2902
|
+
* e.g. for a Vue SFC, we can narrow down the part to update by comparing
|
|
2903
|
+
* the descriptors.
|
|
2904
|
+
*
|
|
2905
|
+
* - The hook can also return an empty array and then perform custom updates
|
|
2906
|
+
* by sending a custom hmr payload via server.ws.send().
|
|
2907
|
+
*
|
|
2908
|
+
* - If the hook doesn't return a value, the hmr update will be performed as
|
|
2909
|
+
* normal.
|
|
2910
|
+
*/
|
|
2960
2911
|
handleHotUpdate?: ObjectHook<(this: MinimalPluginContextWithoutEnvironment, ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>;
|
|
2961
2912
|
/**
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2913
|
+
* This hook is not supported by Rolldown yet. But the type is declared for compatibility.
|
|
2914
|
+
*
|
|
2915
|
+
* @deprecated This hook is **not** deprecated. It is marked as deprecated just to make it clear that this hook is currently a no-op.
|
|
2916
|
+
*/
|
|
2966
2917
|
shouldTransformCachedModule?: ObjectHook<(this: PluginContext, options: {
|
|
2967
2918
|
code: string;
|
|
2968
2919
|
id: string;
|
|
@@ -2971,7 +2922,7 @@ interface Plugin<A = any> extends Rolldown.Plugin<A> {
|
|
|
2971
2922
|
}) => boolean | null | void>;
|
|
2972
2923
|
}
|
|
2973
2924
|
type HookHandler<T> = T extends ObjectHook<infer H> ? H : T;
|
|
2974
|
-
type PluginWithRequiredHook<K
|
|
2925
|
+
type PluginWithRequiredHook<K extends keyof Plugin> = Plugin & { [P in K]: NonNullable<Plugin[P]> };
|
|
2975
2926
|
type Thenable<T> = T | Promise<T>;
|
|
2976
2927
|
type FalsyPlugin = false | null | undefined;
|
|
2977
2928
|
type PluginOption = Thenable<Plugin | {
|
|
@@ -2985,24 +2936,24 @@ declare function perEnvironmentPlugin(name: string, applyToEnvironment: (environ
|
|
|
2985
2936
|
//#region src/node/plugins/css.d.ts
|
|
2986
2937
|
interface CSSOptions {
|
|
2987
2938
|
/**
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2939
|
+
* Using lightningcss is an experimental option to handle CSS modules,
|
|
2940
|
+
* assets and imports via Lightning CSS. It requires to install it as a
|
|
2941
|
+
* peer dependency.
|
|
2942
|
+
*
|
|
2943
|
+
* @default 'postcss'
|
|
2944
|
+
* @experimental
|
|
2945
|
+
*/
|
|
2995
2946
|
transformer?: "postcss" | "lightningcss";
|
|
2996
2947
|
/**
|
|
2997
|
-
|
|
2998
|
-
|
|
2948
|
+
* https://github.com/css-modules/postcss-modules
|
|
2949
|
+
*/
|
|
2999
2950
|
modules?: CSSModulesOptions | false;
|
|
3000
2951
|
/**
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
2952
|
+
* Options for preprocessors.
|
|
2953
|
+
*
|
|
2954
|
+
* In addition to options specific to each processors, Vite supports `additionalData` option.
|
|
2955
|
+
* The `additionalData` option can be used to inject extra code for each style content.
|
|
2956
|
+
*/
|
|
3006
2957
|
preprocessorOptions?: {
|
|
3007
2958
|
scss?: SassPreprocessorOptions;
|
|
3008
2959
|
sass?: SassPreprocessorOptions;
|
|
@@ -3011,24 +2962,24 @@ interface CSSOptions {
|
|
|
3011
2962
|
stylus?: StylusPreprocessorOptions;
|
|
3012
2963
|
};
|
|
3013
2964
|
/**
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
2965
|
+
* If this option is set, preprocessors will run in workers when possible.
|
|
2966
|
+
* `true` means the number of CPUs minus 1.
|
|
2967
|
+
*
|
|
2968
|
+
* @default true
|
|
2969
|
+
*/
|
|
3019
2970
|
preprocessorMaxWorkers?: number | true;
|
|
3020
2971
|
postcss?: string | (PostCSS.ProcessOptions & {
|
|
3021
2972
|
plugins?: PostCSS.AcceptedPlugin[];
|
|
3022
2973
|
});
|
|
3023
2974
|
/**
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
2975
|
+
* Enables css sourcemaps during dev
|
|
2976
|
+
* @default false
|
|
2977
|
+
* @experimental
|
|
2978
|
+
*/
|
|
3028
2979
|
devSourcemap?: boolean;
|
|
3029
2980
|
/**
|
|
3030
|
-
|
|
3031
|
-
|
|
2981
|
+
* @experimental
|
|
2982
|
+
*/
|
|
3032
2983
|
lightningcss?: lightningcssOptions_LightningCSSOptions;
|
|
3033
2984
|
}
|
|
3034
2985
|
interface CSSModulesOptions {
|
|
@@ -3039,8 +2990,8 @@ interface CSSModulesOptions {
|
|
|
3039
2990
|
generateScopedName?: string | ((name: string, filename: string, css: string) => string);
|
|
3040
2991
|
hashPrefix?: string;
|
|
3041
2992
|
/**
|
|
3042
|
-
|
|
3043
|
-
|
|
2993
|
+
* default: undefined
|
|
2994
|
+
*/
|
|
3044
2995
|
localsConvention?: "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly" | ((originalClassName: string, generatedClassName: string, inputFile: string) => string);
|
|
3045
2996
|
}
|
|
3046
2997
|
type ResolvedCSSOptions = Omit<CSSOptions, "lightningcss"> & Required<Pick<CSSOptions, "transformer" | "devSourcemap">> & {
|
|
@@ -3078,8 +3029,8 @@ interface ESBuildOptions extends esbuildOptions_EsbuildTransformOptions {
|
|
|
3078
3029
|
exclude?: string | RegExp | ReadonlyArray<string | RegExp>;
|
|
3079
3030
|
jsxInject?: string;
|
|
3080
3031
|
/**
|
|
3081
|
-
|
|
3082
|
-
|
|
3032
|
+
* This option is not respected. Use `build.minify` instead.
|
|
3033
|
+
*/
|
|
3083
3034
|
minify?: never;
|
|
3084
3035
|
}
|
|
3085
3036
|
type ESBuildTransformResult = Omit<EsbuildTransformResult, "map"> & {
|
|
@@ -3090,16 +3041,16 @@ declare function transformWithEsbuild(code: string, filename: string, options?:
|
|
|
3090
3041
|
//#region src/node/plugins/json.d.ts
|
|
3091
3042
|
interface JsonOptions {
|
|
3092
3043
|
/**
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3044
|
+
* Generate a named export for every property of the JSON object
|
|
3045
|
+
* @default true
|
|
3046
|
+
*/
|
|
3096
3047
|
namedExports?: boolean;
|
|
3097
3048
|
/**
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3049
|
+
* Generate performant output as JSON.parse("stringified").
|
|
3050
|
+
*
|
|
3051
|
+
* When set to 'auto', the data will be stringified only if the data is bigger than 10kB.
|
|
3052
|
+
* @default 'auto'
|
|
3053
|
+
*/
|
|
3103
3054
|
stringify?: boolean | "auto";
|
|
3104
3055
|
}
|
|
3105
3056
|
//#endregion
|
|
@@ -3110,35 +3061,35 @@ interface SSROptions {
|
|
|
3110
3061
|
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
|
3111
3062
|
external?: string[] | true;
|
|
3112
3063
|
/**
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3064
|
+
* Define the target for the ssr build. The browser field in package.json
|
|
3065
|
+
* is ignored for node but used if webworker is the target
|
|
3066
|
+
* This option will be removed in a future major version
|
|
3067
|
+
* @default 'node'
|
|
3068
|
+
*/
|
|
3118
3069
|
target?: SSRTarget;
|
|
3119
3070
|
/**
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3071
|
+
* Control over which dependencies are optimized during SSR and esbuild options
|
|
3072
|
+
* During build:
|
|
3073
|
+
* no external CJS dependencies are optimized by default
|
|
3074
|
+
* During dev:
|
|
3075
|
+
* explicit no external CJS dependencies are optimized by default
|
|
3076
|
+
* @experimental
|
|
3077
|
+
*/
|
|
3127
3078
|
optimizeDeps?: SsrDepOptimizationConfig;
|
|
3128
3079
|
resolve?: {
|
|
3129
3080
|
/**
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3081
|
+
* Conditions that are used in the plugin pipeline. The default value is the root config's `resolve.conditions`.
|
|
3082
|
+
*
|
|
3083
|
+
* Use this to override the default ssr conditions for the ssr build.
|
|
3084
|
+
*
|
|
3085
|
+
* @default rootConfig.resolve.conditions
|
|
3086
|
+
*/
|
|
3136
3087
|
conditions?: string[];
|
|
3137
3088
|
/**
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3089
|
+
* Conditions that are used during ssr import (including `ssrLoadModule`) of externalized dependencies.
|
|
3090
|
+
*
|
|
3091
|
+
* @default ['node', 'module-sync']
|
|
3092
|
+
*/
|
|
3142
3093
|
externalConditions?: string[];
|
|
3143
3094
|
mainFields?: string[];
|
|
3144
3095
|
};
|
|
@@ -3163,9 +3114,9 @@ declare function transformWithOxc(code: string, filename: string, options?: roll
|
|
|
3163
3114
|
//#region src/node/config.d.ts
|
|
3164
3115
|
interface ConfigEnv {
|
|
3165
3116
|
/**
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3117
|
+
* 'serve': during dev (`vite` command)
|
|
3118
|
+
* 'build': when building for production (`vite build` command)
|
|
3119
|
+
*/
|
|
3169
3120
|
command: "build" | "serve";
|
|
3170
3121
|
mode: string;
|
|
3171
3122
|
isSsrBuild?: boolean;
|
|
@@ -3199,48 +3150,48 @@ interface CreateDevEnvironmentContext {
|
|
|
3199
3150
|
}
|
|
3200
3151
|
interface DevEnvironmentOptions {
|
|
3201
3152
|
/**
|
|
3202
|
-
|
|
3203
|
-
|
|
3153
|
+
* Files to be pre-transformed. Supports glob patterns.
|
|
3154
|
+
*/
|
|
3204
3155
|
warmup?: string[];
|
|
3205
3156
|
/**
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3157
|
+
* Pre-transform known direct imports
|
|
3158
|
+
* defaults to true for the client environment, false for the rest
|
|
3159
|
+
*/
|
|
3209
3160
|
preTransformRequests?: boolean;
|
|
3210
3161
|
/**
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3162
|
+
* Enables sourcemaps during dev
|
|
3163
|
+
* @default { js: true }
|
|
3164
|
+
* @experimental
|
|
3165
|
+
*/
|
|
3215
3166
|
sourcemap?: boolean | {
|
|
3216
3167
|
js?: boolean;
|
|
3217
3168
|
css?: boolean;
|
|
3218
3169
|
};
|
|
3219
3170
|
/**
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3171
|
+
* Whether or not to ignore-list source files in the dev server sourcemap, used to populate
|
|
3172
|
+
* the [`x_google_ignoreList` source map extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).
|
|
3173
|
+
*
|
|
3174
|
+
* By default, it excludes all paths containing `node_modules`. You can pass `false` to
|
|
3175
|
+
* disable this behavior, or, for full control, a function that takes the source path and
|
|
3176
|
+
* sourcemap path and returns whether to ignore the source path.
|
|
3177
|
+
*/
|
|
3227
3178
|
sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean);
|
|
3228
3179
|
/**
|
|
3229
|
-
|
|
3230
|
-
|
|
3180
|
+
* create the Dev Environment instance
|
|
3181
|
+
*/
|
|
3231
3182
|
createEnvironment?: (name: string, config: ResolvedConfig, context: CreateDevEnvironmentContext) => Promise<DevEnvironment> | DevEnvironment;
|
|
3232
3183
|
/**
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3184
|
+
* For environments that support a full-reload, like the client, we can short-circuit when
|
|
3185
|
+
* restarting the server throwing early to stop processing current files. We avoided this for
|
|
3186
|
+
* SSR requests. Maybe this is no longer needed.
|
|
3187
|
+
* @experimental
|
|
3188
|
+
*/
|
|
3238
3189
|
recoverable?: boolean;
|
|
3239
3190
|
/**
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3191
|
+
* For environments associated with a module runner.
|
|
3192
|
+
* By default, it is false for the client environment and true for non-client environments.
|
|
3193
|
+
* This option can also be used instead of the removed config.experimental.skipSsrTransform.
|
|
3194
|
+
*/
|
|
3244
3195
|
moduleRunnerTransform?: boolean;
|
|
3245
3196
|
}
|
|
3246
3197
|
type ResolvedDevEnvironmentOptions = Omit<Required<DevEnvironmentOptions>, "sourcemapIgnoreList"> & {
|
|
@@ -3251,37 +3202,37 @@ type AllResolveOptions = ResolveOptions & {
|
|
|
3251
3202
|
};
|
|
3252
3203
|
interface SharedEnvironmentOptions {
|
|
3253
3204
|
/**
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3205
|
+
* Define global variable replacements.
|
|
3206
|
+
* Entries will be defined on `window` during dev and replaced during build.
|
|
3207
|
+
*/
|
|
3257
3208
|
define?: Record<string, any>;
|
|
3258
3209
|
/**
|
|
3259
|
-
|
|
3260
|
-
|
|
3210
|
+
* Configure resolver
|
|
3211
|
+
*/
|
|
3261
3212
|
resolve?: EnvironmentResolveOptions;
|
|
3262
3213
|
/**
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3214
|
+
* Define if this environment is used for Server-Side Rendering
|
|
3215
|
+
* @default 'server' if it isn't the client environment
|
|
3216
|
+
*/
|
|
3266
3217
|
consumer?: "client" | "server";
|
|
3267
3218
|
/**
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3219
|
+
* If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime.
|
|
3220
|
+
* Otherwise, it is statically replaced as an empty object.
|
|
3221
|
+
*/
|
|
3271
3222
|
keepProcessEnv?: boolean;
|
|
3272
3223
|
/**
|
|
3273
|
-
|
|
3274
|
-
|
|
3224
|
+
* Optimize deps config
|
|
3225
|
+
*/
|
|
3275
3226
|
optimizeDeps?: DepOptimizationOptions;
|
|
3276
3227
|
}
|
|
3277
3228
|
interface EnvironmentOptions extends SharedEnvironmentOptions {
|
|
3278
3229
|
/**
|
|
3279
|
-
|
|
3280
|
-
|
|
3230
|
+
* Dev specific options
|
|
3231
|
+
*/
|
|
3281
3232
|
dev?: DevEnvironmentOptions;
|
|
3282
3233
|
/**
|
|
3283
|
-
|
|
3284
|
-
|
|
3234
|
+
* Build specific options
|
|
3235
|
+
*/
|
|
3285
3236
|
build?: BuildEnvironmentOptions;
|
|
3286
3237
|
}
|
|
3287
3238
|
type ResolvedResolveOptions = Required<ResolveOptions>;
|
|
@@ -3300,181 +3251,181 @@ type DefaultEnvironmentOptions = Omit<EnvironmentOptions, "consumer" | "resolve"
|
|
|
3300
3251
|
};
|
|
3301
3252
|
interface UserConfig extends DefaultEnvironmentOptions {
|
|
3302
3253
|
/**
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3254
|
+
* Project root directory. Can be an absolute path, or a path relative from
|
|
3255
|
+
* the location of the config file itself.
|
|
3256
|
+
* @default process.cwd()
|
|
3257
|
+
*/
|
|
3307
3258
|
root?: string;
|
|
3308
3259
|
/**
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3260
|
+
* Base public path when served in development or production.
|
|
3261
|
+
* @default '/'
|
|
3262
|
+
*/
|
|
3312
3263
|
base?: string;
|
|
3313
3264
|
/**
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3265
|
+
* Directory to serve as plain static assets. Files in this directory are
|
|
3266
|
+
* served and copied to build dist dir as-is without transform. The value
|
|
3267
|
+
* can be either an absolute file system path or a path relative to project root.
|
|
3268
|
+
*
|
|
3269
|
+
* Set to `false` or an empty string to disable copied static assets to build dist dir.
|
|
3270
|
+
* @default 'public'
|
|
3271
|
+
*/
|
|
3321
3272
|
publicDir?: string | false;
|
|
3322
3273
|
/**
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3274
|
+
* Directory to save cache files. Files in this directory are pre-bundled
|
|
3275
|
+
* deps or some other cache files that generated by vite, which can improve
|
|
3276
|
+
* the performance. You can use `--force` flag or manually delete the directory
|
|
3277
|
+
* to regenerate the cache files. The value can be either an absolute file
|
|
3278
|
+
* system path or a path relative to project root.
|
|
3279
|
+
* Default to `.vite` when no `package.json` is detected.
|
|
3280
|
+
* @default 'node_modules/.vite'
|
|
3281
|
+
*/
|
|
3331
3282
|
cacheDir?: string;
|
|
3332
3283
|
/**
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3284
|
+
* Explicitly set a mode to run in. This will override the default mode for
|
|
3285
|
+
* each command, and can be overridden by the command line --mode option.
|
|
3286
|
+
*/
|
|
3336
3287
|
mode?: string;
|
|
3337
3288
|
/**
|
|
3338
|
-
|
|
3339
|
-
|
|
3289
|
+
* Array of vite plugins to use.
|
|
3290
|
+
*/
|
|
3340
3291
|
plugins?: PluginOption[];
|
|
3341
3292
|
/**
|
|
3342
|
-
|
|
3343
|
-
|
|
3293
|
+
* HTML related options
|
|
3294
|
+
*/
|
|
3344
3295
|
html?: HTMLOptions;
|
|
3345
3296
|
/**
|
|
3346
|
-
|
|
3347
|
-
|
|
3297
|
+
* CSS related options (preprocessors and CSS modules)
|
|
3298
|
+
*/
|
|
3348
3299
|
css?: CSSOptions;
|
|
3349
3300
|
/**
|
|
3350
|
-
|
|
3351
|
-
|
|
3301
|
+
* JSON loading options
|
|
3302
|
+
*/
|
|
3352
3303
|
json?: JsonOptions;
|
|
3353
3304
|
/**
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3305
|
+
* Transform options to pass to esbuild.
|
|
3306
|
+
* Or set to `false` to disable esbuild.
|
|
3307
|
+
*
|
|
3308
|
+
* @deprecated Use `oxc` option instead.
|
|
3309
|
+
*/
|
|
3359
3310
|
esbuild?: ESBuildOptions | false;
|
|
3360
3311
|
/**
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3312
|
+
* Transform options to pass to Oxc.
|
|
3313
|
+
* Or set to `false` to disable Oxc.
|
|
3314
|
+
*/
|
|
3364
3315
|
oxc?: OxcOptions | false;
|
|
3365
3316
|
/**
|
|
3366
|
-
|
|
3367
|
-
|
|
3317
|
+
* Specify additional picomatch patterns to be treated as static assets.
|
|
3318
|
+
*/
|
|
3368
3319
|
assetsInclude?: string | RegExp | (string | RegExp)[];
|
|
3369
3320
|
/**
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3321
|
+
* Builder specific options
|
|
3322
|
+
* @experimental
|
|
3323
|
+
*/
|
|
3373
3324
|
builder?: BuilderOptions;
|
|
3374
3325
|
/**
|
|
3375
|
-
|
|
3376
|
-
|
|
3326
|
+
* Server specific options, e.g. host, port, https...
|
|
3327
|
+
*/
|
|
3377
3328
|
server?: ServerOptions$1;
|
|
3378
3329
|
/**
|
|
3379
|
-
|
|
3380
|
-
|
|
3330
|
+
* Preview specific options, e.g. host, port, https...
|
|
3331
|
+
*/
|
|
3381
3332
|
preview?: PreviewOptions;
|
|
3382
3333
|
/**
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3334
|
+
* Experimental features
|
|
3335
|
+
*
|
|
3336
|
+
* Features under this field could change in the future and might NOT follow semver.
|
|
3337
|
+
* Please be careful and always pin Vite's version when using them.
|
|
3338
|
+
* @experimental
|
|
3339
|
+
*/
|
|
3389
3340
|
experimental?: ExperimentalOptions;
|
|
3390
3341
|
/**
|
|
3391
|
-
|
|
3392
|
-
|
|
3342
|
+
* Options to opt-in to future behavior
|
|
3343
|
+
*/
|
|
3393
3344
|
future?: FutureOptions | "warn";
|
|
3394
3345
|
/**
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3346
|
+
* Legacy options
|
|
3347
|
+
*
|
|
3348
|
+
* Features under this field only follow semver for patches, they could be removed in a
|
|
3349
|
+
* future minor version. Please always pin Vite's version to a minor when using them.
|
|
3350
|
+
*/
|
|
3400
3351
|
legacy?: LegacyOptions;
|
|
3401
3352
|
/**
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3353
|
+
* Log level.
|
|
3354
|
+
* @default 'info'
|
|
3355
|
+
*/
|
|
3405
3356
|
logLevel?: LogLevel;
|
|
3406
3357
|
/**
|
|
3407
|
-
|
|
3408
|
-
|
|
3358
|
+
* Custom logger.
|
|
3359
|
+
*/
|
|
3409
3360
|
customLogger?: Logger;
|
|
3410
3361
|
/**
|
|
3411
|
-
|
|
3412
|
-
|
|
3362
|
+
* @default true
|
|
3363
|
+
*/
|
|
3413
3364
|
clearScreen?: boolean;
|
|
3414
3365
|
/**
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3366
|
+
* Environment files directory. Can be an absolute path, or a path relative from
|
|
3367
|
+
* root.
|
|
3368
|
+
* @default root
|
|
3369
|
+
*/
|
|
3419
3370
|
envDir?: string | false;
|
|
3420
3371
|
/**
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3372
|
+
* Env variables starts with `envPrefix` will be exposed to your client source code via import.meta.env.
|
|
3373
|
+
* @default 'VITE_'
|
|
3374
|
+
*/
|
|
3424
3375
|
envPrefix?: string | string[];
|
|
3425
3376
|
/**
|
|
3426
|
-
|
|
3427
|
-
|
|
3377
|
+
* Worker bundle options
|
|
3378
|
+
*/
|
|
3428
3379
|
worker?: {
|
|
3429
3380
|
/**
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3381
|
+
* Output format for worker bundle
|
|
3382
|
+
* @default 'iife'
|
|
3383
|
+
*/
|
|
3433
3384
|
format?: "es" | "iife";
|
|
3434
3385
|
/**
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3386
|
+
* Vite plugins that apply to worker bundle. The plugins returned by this function
|
|
3387
|
+
* should be new instances every time it is called, because they are used for each
|
|
3388
|
+
* rolldown worker bundling process.
|
|
3389
|
+
*/
|
|
3439
3390
|
plugins?: () => PluginOption[];
|
|
3440
3391
|
/**
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3392
|
+
* Alias to `rolldownOptions`.
|
|
3393
|
+
* @deprecated Use `rolldownOptions` instead.
|
|
3394
|
+
*/
|
|
3444
3395
|
rollupOptions?: Omit<RolldownOptions, "plugins" | "input" | "onwarn" | "preserveEntrySignatures">;
|
|
3445
3396
|
/**
|
|
3446
|
-
|
|
3447
|
-
|
|
3397
|
+
* Rolldown options to build worker bundle
|
|
3398
|
+
*/
|
|
3448
3399
|
rolldownOptions?: Omit<RolldownOptions, "plugins" | "input" | "onwarn" | "preserveEntrySignatures">;
|
|
3449
3400
|
};
|
|
3450
3401
|
/**
|
|
3451
|
-
|
|
3452
|
-
|
|
3402
|
+
* Dep optimization options
|
|
3403
|
+
*/
|
|
3453
3404
|
optimizeDeps?: DepOptimizationOptions;
|
|
3454
3405
|
/**
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3406
|
+
* SSR specific options
|
|
3407
|
+
* We could make SSROptions be a EnvironmentOptions if we can abstract
|
|
3408
|
+
* external/noExternal for environments in general.
|
|
3409
|
+
*/
|
|
3459
3410
|
ssr?: SSROptions;
|
|
3460
3411
|
/**
|
|
3461
|
-
|
|
3462
|
-
|
|
3412
|
+
* Environment overrides
|
|
3413
|
+
*/
|
|
3463
3414
|
environments?: Record<string, EnvironmentOptions>;
|
|
3464
3415
|
/**
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3416
|
+
* Whether your application is a Single Page Application (SPA),
|
|
3417
|
+
* a Multi-Page Application (MPA), or Custom Application (SSR
|
|
3418
|
+
* and frameworks with custom HTML handling)
|
|
3419
|
+
* @default 'spa'
|
|
3420
|
+
*/
|
|
3470
3421
|
appType?: AppType;
|
|
3471
3422
|
}
|
|
3472
3423
|
interface HTMLOptions {
|
|
3473
3424
|
/**
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3425
|
+
* A nonce value placeholder that will be used when generating script/style tags.
|
|
3426
|
+
*
|
|
3427
|
+
* Make sure that this placeholder will be replaced with a unique value for each request by the server.
|
|
3428
|
+
*/
|
|
3478
3429
|
cspNonce?: string;
|
|
3479
3430
|
}
|
|
3480
3431
|
interface FutureOptions {
|
|
@@ -3490,78 +3441,78 @@ interface FutureOptions {
|
|
|
3490
3441
|
}
|
|
3491
3442
|
interface ExperimentalOptions {
|
|
3492
3443
|
/**
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3444
|
+
* Append fake `&lang.(ext)` when queries are specified, to preserve the file extension for following plugins to process.
|
|
3445
|
+
*
|
|
3446
|
+
* @experimental
|
|
3447
|
+
* @default false
|
|
3448
|
+
*/
|
|
3498
3449
|
importGlobRestoreExtension?: boolean;
|
|
3499
3450
|
/**
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3451
|
+
* Allow finegrain control over assets and public files paths
|
|
3452
|
+
*
|
|
3453
|
+
* @experimental
|
|
3454
|
+
*/
|
|
3504
3455
|
renderBuiltUrl?: RenderBuiltAssetUrl;
|
|
3505
3456
|
/**
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3457
|
+
* Enables support of HMR partial accept via `import.meta.hot.acceptExports`.
|
|
3458
|
+
*
|
|
3459
|
+
* @experimental
|
|
3460
|
+
* @default false
|
|
3461
|
+
*/
|
|
3511
3462
|
hmrPartialAccept?: boolean;
|
|
3512
3463
|
/**
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3464
|
+
* Enable builtin plugin that written by rust, which is faster than js plugin.
|
|
3465
|
+
*
|
|
3466
|
+
* - 'resolver' (deprecated, will be removed in v8 stable): Enable only the native resolver plugin.
|
|
3467
|
+
* - 'v1' (will be deprecated, will be removed in v8 stable): Enable the first stable set of native plugins (including resolver).
|
|
3468
|
+
* - 'v2' (will be deprecated, will be removed in v8 stable): Enable the improved dynamicImportVarsPlugin and importGlobPlugin.
|
|
3469
|
+
* - true: Enable all native plugins (currently an alias of 'v2', it will map to a newer one in the future versions).
|
|
3470
|
+
*
|
|
3471
|
+
* @experimental
|
|
3472
|
+
* @default 'v2'
|
|
3473
|
+
*/
|
|
3523
3474
|
enableNativePlugin?: boolean | "resolver" | "v1" | "v2";
|
|
3524
3475
|
/**
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3476
|
+
* Enable full bundle mode.
|
|
3477
|
+
*
|
|
3478
|
+
* This is highly experimental.
|
|
3479
|
+
*
|
|
3480
|
+
* @experimental
|
|
3481
|
+
* @default false
|
|
3482
|
+
*/
|
|
3532
3483
|
bundledDev?: boolean;
|
|
3533
3484
|
}
|
|
3534
3485
|
interface LegacyOptions {
|
|
3535
3486
|
/**
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3487
|
+
* In Vite 6.0.8 and below, WebSocket server was able to connect from any web pages. However,
|
|
3488
|
+
* that could be exploited by a malicious web page.
|
|
3489
|
+
*
|
|
3490
|
+
* In Vite 6.0.9+, the WebSocket server now requires a token to connect from a web page.
|
|
3491
|
+
* But this may break some plugins and frameworks that connects to the WebSocket server
|
|
3492
|
+
* on their own. Enabling this option will make Vite skip the token check.
|
|
3493
|
+
*
|
|
3494
|
+
* **We do not recommend enabling this option unless you are sure that you are fine with
|
|
3495
|
+
* that security weakness.**
|
|
3496
|
+
*/
|
|
3546
3497
|
skipWebSocketTokenCheck?: boolean;
|
|
3547
3498
|
/**
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3499
|
+
* Opt-in to the pre-Vite 8 CJS interop behavior, which was inconsistent.
|
|
3500
|
+
*
|
|
3501
|
+
* In pre-Vite 8 versions, Vite had inconsistent CJS interop behavior. This was due to
|
|
3502
|
+
* the different behavior of esbuild and the Rollup commonjs plugin.
|
|
3503
|
+
* Vite 8+ uses Rolldown for both the dependency optimization in dev and the production build,
|
|
3504
|
+
* which aligns the behavior to esbuild.
|
|
3505
|
+
*
|
|
3506
|
+
* See the Vite 8 migration guide for more details.
|
|
3507
|
+
*/
|
|
3557
3508
|
inconsistentCjsInterop?: boolean;
|
|
3558
3509
|
}
|
|
3559
3510
|
interface ResolvedWorkerOptions {
|
|
3560
3511
|
format: "es" | "iife";
|
|
3561
3512
|
plugins: (bundleChain: string[]) => Promise<ResolvedConfig>;
|
|
3562
3513
|
/**
|
|
3563
|
-
|
|
3564
|
-
|
|
3514
|
+
* @deprecated Use `rolldownOptions` instead.
|
|
3515
|
+
*/
|
|
3565
3516
|
rollupOptions: RolldownOptions;
|
|
3566
3517
|
rolldownOptions: RolldownOptions;
|
|
3567
3518
|
}
|
|
@@ -3582,8 +3533,7 @@ interface ResolvedConfig extends Readonly<Omit<UserConfig, "plugins" | "css" | "
|
|
|
3582
3533
|
publicDir: string;
|
|
3583
3534
|
cacheDir: string;
|
|
3584
3535
|
command: "build" | "serve";
|
|
3585
|
-
mode: string;
|
|
3586
|
-
/** `true` when build or full-bundle mode dev */
|
|
3536
|
+
mode: string; /** `true` when build or full-bundle mode dev */
|
|
3587
3537
|
isBundled: boolean;
|
|
3588
3538
|
isWorker: boolean;
|
|
3589
3539
|
isProduction: boolean;
|
|
@@ -3594,13 +3544,11 @@ interface ResolvedConfig extends Readonly<Omit<UserConfig, "plugins" | "css" | "
|
|
|
3594
3544
|
};
|
|
3595
3545
|
plugins: readonly Plugin[];
|
|
3596
3546
|
css: ResolvedCSSOptions;
|
|
3597
|
-
json: Required<JsonOptions>;
|
|
3598
|
-
/** @deprecated Use `oxc` option instead. */
|
|
3547
|
+
json: Required<JsonOptions>; /** @deprecated Use `oxc` option instead. */
|
|
3599
3548
|
esbuild: ESBuildOptions | false;
|
|
3600
3549
|
oxc: OxcOptions | false;
|
|
3601
3550
|
server: ResolvedServerOptions;
|
|
3602
|
-
dev: ResolvedDevEnvironmentOptions;
|
|
3603
|
-
/** @experimental */
|
|
3551
|
+
dev: ResolvedDevEnvironmentOptions; /** @experimental */
|
|
3604
3552
|
builder: ResolvedBuilderOptions | undefined;
|
|
3605
3553
|
build: ResolvedBuildOptions;
|
|
3606
3554
|
preview: ResolvedPreviewOptions;
|
|
@@ -3609,15 +3557,15 @@ interface ResolvedConfig extends Readonly<Omit<UserConfig, "plugins" | "css" | "
|
|
|
3609
3557
|
rawAssetsInclude: (string | RegExp)[];
|
|
3610
3558
|
logger: Logger;
|
|
3611
3559
|
/**
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3560
|
+
* Create an internal resolver to be used in special scenarios, e.g.
|
|
3561
|
+
* optimizer & handling css `@imports`.
|
|
3562
|
+
*
|
|
3563
|
+
* This API is deprecated. It only works for the client and ssr
|
|
3564
|
+
* environments. The `aliasOnly` option is also not being used anymore.
|
|
3565
|
+
* Plugins should move to `createIdResolver(environment.config)` instead.
|
|
3566
|
+
*
|
|
3567
|
+
* @deprecated Use `createIdResolver` from `vite` instead.
|
|
3568
|
+
*/
|
|
3621
3569
|
createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
|
|
3622
3570
|
optimizeDeps: DepOptimizationOptions;
|
|
3623
3571
|
worker: ResolvedWorkerOptions;
|
|
@@ -3626,20 +3574,20 @@ interface ResolvedConfig extends Readonly<Omit<UserConfig, "plugins" | "css" | "
|
|
|
3626
3574
|
future: FutureOptions | undefined;
|
|
3627
3575
|
environments: Record<string, ResolvedEnvironmentOptions>;
|
|
3628
3576
|
/**
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3577
|
+
* The token to connect to the WebSocket server from browsers.
|
|
3578
|
+
*
|
|
3579
|
+
* We recommend using `import.meta.hot` rather than connecting
|
|
3580
|
+
* to the WebSocket server directly.
|
|
3581
|
+
* If you have a usecase that requires connecting to the WebSocket
|
|
3582
|
+
* server, please create an issue so that we can discuss.
|
|
3583
|
+
*
|
|
3584
|
+
* @deprecated
|
|
3585
|
+
*/
|
|
3638
3586
|
webSocketToken: string;
|
|
3639
3587
|
} & PluginHookUtils> {}
|
|
3640
3588
|
interface PluginHookUtils {
|
|
3641
|
-
getSortedPlugins: <K
|
|
3642
|
-
getSortedPluginHooks: <K
|
|
3589
|
+
getSortedPlugins: <K extends keyof Plugin>(hookName: K) => PluginWithRequiredHook<K>[];
|
|
3590
|
+
getSortedPluginHooks: <K extends keyof Plugin>(hookName: K) => NonNullable<HookHandler<Plugin[K]>>[];
|
|
3643
3591
|
}
|
|
3644
3592
|
type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
|
|
3645
3593
|
declare function resolveConfig(inlineConfig: InlineConfig, command: "build" | "serve", defaultMode?: string, defaultNodeEnv?: string, isPreview?: boolean, patchConfig?: ((config: ResolvedConfig) => void) | undefined, patchPlugins?: ((resolvedPlugins: Plugin[]) => void) | undefined): Promise<ResolvedConfig>;
|
|
@@ -3667,14 +3615,14 @@ declare function buildErrorMessage(err: RollupError, args?: string[], includeSta
|
|
|
3667
3615
|
*/
|
|
3668
3616
|
interface ServerModuleRunnerOptions extends Omit<ModuleRunnerOptions, "root" | "fetchModule" | "hmr" | "transport"> {
|
|
3669
3617
|
/**
|
|
3670
|
-
|
|
3671
|
-
|
|
3618
|
+
* Disable HMR or configure HMR logger.
|
|
3619
|
+
*/
|
|
3672
3620
|
hmr?: false | {
|
|
3673
3621
|
logger?: ModuleRunnerHmr["logger"];
|
|
3674
3622
|
};
|
|
3675
3623
|
/**
|
|
3676
|
-
|
|
3677
|
-
|
|
3624
|
+
* Provide a custom module evaluator. This controls how the code is executed.
|
|
3625
|
+
*/
|
|
3678
3626
|
evaluator?: ModuleEvaluator;
|
|
3679
3627
|
}
|
|
3680
3628
|
declare const createServerModuleRunnerTransport: (options: {
|
|
@@ -3810,50 +3758,50 @@ declare function resolveEnvPrefix({
|
|
|
3810
3758
|
type Manifest = Record<string, ManifestChunk>;
|
|
3811
3759
|
interface ManifestChunk {
|
|
3812
3760
|
/**
|
|
3813
|
-
|
|
3814
|
-
|
|
3761
|
+
* The input file name of this chunk / asset if known
|
|
3762
|
+
*/
|
|
3815
3763
|
src?: string;
|
|
3816
3764
|
/**
|
|
3817
|
-
|
|
3818
|
-
|
|
3765
|
+
* The output file name of this chunk / asset
|
|
3766
|
+
*/
|
|
3819
3767
|
file: string;
|
|
3820
3768
|
/**
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3769
|
+
* The list of CSS files imported by this chunk
|
|
3770
|
+
*
|
|
3771
|
+
* This field is only present in JS chunks.
|
|
3772
|
+
*/
|
|
3825
3773
|
css?: string[];
|
|
3826
3774
|
/**
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3775
|
+
* The list of asset files imported by this chunk, excluding CSS files
|
|
3776
|
+
*
|
|
3777
|
+
* This field is only present in JS chunks.
|
|
3778
|
+
*/
|
|
3831
3779
|
assets?: string[];
|
|
3832
3780
|
/**
|
|
3833
|
-
|
|
3834
|
-
|
|
3781
|
+
* Whether this chunk or asset is an entry point
|
|
3782
|
+
*/
|
|
3835
3783
|
isEntry?: boolean;
|
|
3836
3784
|
/**
|
|
3837
|
-
|
|
3838
|
-
|
|
3785
|
+
* The name of this chunk / asset if known
|
|
3786
|
+
*/
|
|
3839
3787
|
name?: string;
|
|
3840
3788
|
/**
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3789
|
+
* Whether this chunk is a dynamic entry point
|
|
3790
|
+
*
|
|
3791
|
+
* This field is only present in JS chunks.
|
|
3792
|
+
*/
|
|
3845
3793
|
isDynamicEntry?: boolean;
|
|
3846
3794
|
/**
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3795
|
+
* The list of statically imported chunks by this chunk
|
|
3796
|
+
*
|
|
3797
|
+
* The values are the keys of the manifest. This field is only present in JS chunks.
|
|
3798
|
+
*/
|
|
3851
3799
|
imports?: string[];
|
|
3852
3800
|
/**
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3801
|
+
* The list of dynamically imported chunks by this chunk
|
|
3802
|
+
*
|
|
3803
|
+
* The values are the keys of the manifest. This field is only present in JS chunks.
|
|
3804
|
+
*/
|
|
3857
3805
|
dynamicImports?: string[];
|
|
3858
3806
|
}
|
|
3859
3807
|
//#endregion
|