vite 8.2.1 → 8.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/vite.js +17 -6
- package/dist/client/bundledDevClient.mjs +149 -65
- package/dist/client/client.mjs +426 -392
- package/dist/node/chunks/build.js +70 -64
- package/dist/node/chunks/dist.js +36 -29
- package/dist/node/chunks/node.js +29216 -28843
- package/dist/node/chunks/postcss-import.js +23 -25
- package/dist/node/cli.js +11 -7
- package/dist/node/index.d.ts +1601 -1555
- package/dist/node/index.js +1 -1
- package/dist/node/module-runner.d.ts +14 -14
- package/dist/node/module-runner.js +200 -198
- package/package.json +18 -18
- package/types/customEvent.d.ts +8 -0
- package/types/hmrPayload.d.ts +8 -0
- package/types/internal/cssPreprocessorOptions.d.ts +2 -2
package/dist/node/index.d.ts
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { t as ModuleRunnerTransport } from "./chunks/moduleRunnerTransport.js";
|
|
3
|
-
import { ConnectedPayload, CustomPayload, CustomPayload as hmrPayload_CustomPayload, ErrorPayload, FullReloadPayload, HMRPayload, HotPayload, HotPayload as hmrPayload_HotPayload, PrunePayload, Update, UpdatePayload } from "#types/hmrPayload";
|
|
4
3
|
import { CustomEventMap, InferCustomEventPayload, InferCustomEventPayload as hmrPayload_InferCustomEventPayload, InvalidatePayload } from "#types/customEvent";
|
|
4
|
+
import { ConnectedPayload, CustomPayload, CustomPayload as hmrPayload_CustomPayload, ErrorPayload, FullReloadPayload, HMRPayload, HotPayload, HotPayload as hmrPayload_HotPayload, PrunePayload, Update, UpdatePayload } from "#types/hmrPayload";
|
|
5
5
|
import * as Rolldown from "rolldown";
|
|
6
6
|
import { CustomPluginOptions, ExistingRawSourceMap, FunctionPluginHooks, ImportKind, InputOption, InputOptions, LoadResult, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleType, ModuleTypeFilter, ObjectHook, OutputBundle, OutputChunk, OutputOptions, PartialResolvedId, PluginContext, PluginContextMeta, ResolveIdResult, RolldownOptions, RolldownOutput, RolldownWatcher, RollupError, RollupLog, SourceDescription, SourceMap, SourceMapInput, TransformPluginContext, VERSION as rolldownVersion, WatcherOptions } from "rolldown";
|
|
7
7
|
import { parseAst as parseAst$1, parseAstAsync as parseAstAsync$1 } from "rolldown/parseAst";
|
|
8
8
|
import * as Rollup from "#types/internal/rollupTypeCompat";
|
|
9
9
|
import { esmExternalRequirePlugin } from "rolldown/plugins";
|
|
10
10
|
import { ESTree, MinifyOptions, MinifyResult, ParseResult, ParserOptions, TransformOptions as rolldown_utils_TransformOptions, TransformResult as rolldown_utils_TransformResult, Visitor, VisitorObject, minify, minifySync, parse, parseSync } from "rolldown/utils";
|
|
11
|
+
import { DepsOptimizerEsbuildOptions, EsbuildTarget, EsbuildTransformOptions, EsbuildTransformOptions as esbuildOptions_EsbuildTransformOptions, EsbuildTransformResult } from "#types/internal/esbuildOptions";
|
|
12
|
+
import { ChunkMetadata, CustomPluginOptionsVite } from "#types/metadata";
|
|
11
13
|
import * as http from "node:http";
|
|
12
14
|
import { Agent, ClientRequest, ClientRequestArgs, OutgoingHttpHeaders, ServerResponse } from "node:http";
|
|
13
15
|
import { Http2SecureServer } from "node:http2";
|
|
14
|
-
import * as fs from "node:fs";
|
|
15
16
|
import { EventEmitter } from "node:events";
|
|
17
|
+
import * as fs from "node:fs";
|
|
16
18
|
import { Server as HttpsServer, ServerOptions as HttpsServerOptions } from "node:https";
|
|
17
19
|
import * as net from "node:net";
|
|
18
20
|
import { Duplex, DuplexOptions, Stream } from "node:stream";
|
|
19
21
|
import { FetchFunction, FetchFunctionOptions, FetchResult, FetchResult as moduleRunner_FetchResult, ModuleEvaluator, ModuleRunner, ModuleRunnerHmr, ModuleRunnerOptions } from "vite/module-runner";
|
|
20
|
-
import { DepsOptimizerEsbuildOptions, EsbuildTarget, EsbuildTransformOptions, EsbuildTransformOptions as esbuildOptions_EsbuildTransformOptions, EsbuildTransformResult } from "#types/internal/esbuildOptions";
|
|
21
22
|
import { SecureContextOptions } from "node:tls";
|
|
22
23
|
import { URL as url_URL } from "node:url";
|
|
23
24
|
import { ZlibOptions } from "node:zlib";
|
|
24
|
-
import {
|
|
25
|
+
import { DevWatchOptions } from "rolldown/experimental";
|
|
25
26
|
import { Terser, TerserMinifyOptions } from "#types/internal/terserOptions";
|
|
26
27
|
import * as PostCSS from "postcss";
|
|
27
28
|
import { ProcessOptions, Processor, Transformer } from "postcss";
|
|
28
|
-
import { LightningCSSOptions, LightningCSSOptions as lightningcssOptions_LightningCSSOptions } from "#types/internal/lightningcssOptions";
|
|
29
29
|
import { LessPreprocessorBaseOptions, SassModernPreprocessBaseOptions, StylusPreprocessorBaseOptions } from "#types/internal/cssPreprocessorOptions";
|
|
30
|
+
import { LightningCSSOptions, LightningCSSOptions as lightningcssOptions_LightningCSSOptions } from "#types/internal/lightningcssOptions";
|
|
30
31
|
import { withFilter } from "rolldown/filter";
|
|
31
32
|
import { GeneralImportGlobOptions, ImportGlobFunction, ImportGlobOptions, KnownAsTypeMap, KnownQueryTypeMap } from "#types/importGlob";
|
|
32
33
|
//#endregion
|
|
33
|
-
//#region ../../node_modules/.pnpm/@vitejs+devtools@0.
|
|
34
|
+
//#region ../../node_modules/.pnpm/@vitejs+devtools@0.5.1_@devframes+json-render@0.9.7_srvx@0.12.7_vite@packages+vite/node_modules/@vitejs/devtools/dist/cli-commands.d.ts
|
|
34
35
|
//#region src/node/cli-commands.d.ts
|
|
35
36
|
interface StartOptions {
|
|
36
37
|
root?: string;
|
|
@@ -40,7 +41,7 @@ interface StartOptions {
|
|
|
40
41
|
open?: boolean;
|
|
41
42
|
}
|
|
42
43
|
//#endregion
|
|
43
|
-
//#region ../../node_modules/.pnpm/@vitejs+devtools@0.
|
|
44
|
+
//#region ../../node_modules/.pnpm/@vitejs+devtools@0.5.1_@devframes+json-render@0.9.7_srvx@0.12.7_vite@packages+vite/node_modules/@vitejs/devtools/dist/config.d.ts
|
|
44
45
|
//#region src/node/config.d.ts
|
|
45
46
|
interface DevToolsConfig extends Partial<StartOptions> {
|
|
46
47
|
enabled: boolean;
|
|
@@ -114,148 +115,409 @@ type AliasOptions = readonly Alias[] | {
|
|
|
114
115
|
[find: string]: string;
|
|
115
116
|
};
|
|
116
117
|
//#endregion
|
|
117
|
-
//#region src/
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
|
124
|
-
options: WatchOptions;
|
|
125
|
-
/**
|
|
126
|
-
* Constructs a new FSWatcher instance with optional WatchOptions parameter.
|
|
127
|
-
*/
|
|
128
|
-
constructor(options?: WatchOptions);
|
|
129
|
-
/**
|
|
130
|
-
* When called, requests that the Node.js event loop not exit so long as the fs.FSWatcher is active.
|
|
131
|
-
* Calling watcher.ref() multiple times will have no effect.
|
|
132
|
-
*/
|
|
133
|
-
ref(): this;
|
|
134
|
-
/**
|
|
135
|
-
* When called, the active fs.FSWatcher object will not require the Node.js event loop to remain active.
|
|
136
|
-
* If there is no other activity keeping the event loop running, the process may exit before the fs.FSWatcher object's callback is invoked.
|
|
137
|
-
* Calling watcher.unref() multiple times will have no effect.
|
|
138
|
-
*/
|
|
139
|
-
unref(): this;
|
|
140
|
-
/**
|
|
141
|
-
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
|
|
142
|
-
* string.
|
|
143
|
-
*/
|
|
144
|
-
add(paths: string | ReadonlyArray<string>): this;
|
|
145
|
-
/**
|
|
146
|
-
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one
|
|
147
|
-
* string.
|
|
148
|
-
*/
|
|
149
|
-
unwatch(paths: string | ReadonlyArray<string>): this;
|
|
150
|
-
/**
|
|
151
|
-
* Returns an object representing all the paths on the file system being watched by this
|
|
152
|
-
* `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless
|
|
153
|
-
* the `cwd` option was used), and the values are arrays of the names of the items contained in
|
|
154
|
-
* each directory.
|
|
155
|
-
*/
|
|
156
|
-
getWatched(): {
|
|
157
|
-
[directory: string]: string[];
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* Removes all listeners from watched files.
|
|
161
|
-
*/
|
|
162
|
-
close(): Promise<void>;
|
|
163
|
-
on(event: 'add' | 'addDir' | 'change', listener: (path: string, stats?: fs.Stats) => void): this;
|
|
164
|
-
on(event: 'all', listener: (eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', path: string, stats?: fs.Stats) => void): this;
|
|
118
|
+
//#region src/node/assetSource.d.ts
|
|
119
|
+
/**
|
|
120
|
+
* Defines which attributes of an HTML element should be treated as asset sources.
|
|
121
|
+
* Used in `html.additionalAssetSources` configuration.
|
|
122
|
+
*/
|
|
123
|
+
interface HtmlAssetSource {
|
|
165
124
|
/**
|
|
166
|
-
*
|
|
125
|
+
* Attributes that contain a single asset URL.
|
|
126
|
+
* @example ['src', 'data-src-dark']
|
|
167
127
|
*/
|
|
168
|
-
|
|
128
|
+
srcAttributes?: string[];
|
|
169
129
|
/**
|
|
170
|
-
*
|
|
130
|
+
* Attributes that contain srcset-format URLs.
|
|
131
|
+
* @example ['srcset', 'imagesrcset']
|
|
171
132
|
*/
|
|
172
|
-
|
|
133
|
+
srcsetAttributes?: string[];
|
|
173
134
|
/**
|
|
174
|
-
*
|
|
135
|
+
* Called before handling an attribute to determine if it should be processed.
|
|
175
136
|
*/
|
|
176
|
-
|
|
177
|
-
on(event: 'unlink' | 'unlinkDir', listener: (path: string) => void): this;
|
|
178
|
-
on(event: string, listener: (...args: any[]) => void): this;
|
|
137
|
+
filter?: (data: HtmlAssetSourceFilterData) => boolean;
|
|
179
138
|
}
|
|
180
|
-
interface
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
* be ignored. The whole relative or absolute path is tested, not just filename. If a function
|
|
190
|
-
* with two arguments is provided, it gets called twice per path - once with a single argument
|
|
191
|
-
* (the path), second time with two arguments (the path and the
|
|
192
|
-
* [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path).
|
|
193
|
-
*/
|
|
194
|
-
ignored?: AnymatchMatcher;
|
|
139
|
+
interface HtmlAssetSourceFilterData {
|
|
140
|
+
key: string;
|
|
141
|
+
value: string;
|
|
142
|
+
attributes: Record<string, string>;
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/types/commonjs.d.ts
|
|
146
|
+
|
|
147
|
+
interface RollupCommonJSOptions {
|
|
195
148
|
/**
|
|
196
|
-
*
|
|
197
|
-
*
|
|
149
|
+
* A minimatch pattern, or array of patterns, which specifies the files in
|
|
150
|
+
* the build the plugin should operate on. By default, all files with
|
|
151
|
+
* extension `".cjs"` or those in `extensions` are included, but you can
|
|
152
|
+
* narrow this list by only including specific files. These files will be
|
|
153
|
+
* analyzed and transpiled if either the analysis does not find ES module
|
|
154
|
+
* specific statements or `transformMixedEsModules` is `true`.
|
|
155
|
+
* @default undefined
|
|
198
156
|
*/
|
|
199
|
-
|
|
157
|
+
include?: string | RegExp | readonly (string | RegExp)[];
|
|
200
158
|
/**
|
|
201
|
-
*
|
|
202
|
-
* the
|
|
159
|
+
* A minimatch pattern, or array of patterns, which specifies the files in
|
|
160
|
+
* the build the plugin should _ignore_. By default, all files with
|
|
161
|
+
* extensions other than those in `extensions` or `".cjs"` are ignored, but you
|
|
162
|
+
* can exclude additional files. See also the `include` option.
|
|
163
|
+
* @default undefined
|
|
203
164
|
*/
|
|
204
|
-
|
|
165
|
+
exclude?: string | RegExp | readonly (string | RegExp)[];
|
|
205
166
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
167
|
+
* For extensionless imports, search for extensions other than .js in the
|
|
168
|
+
* order specified. Note that you need to make sure that non-JavaScript files
|
|
169
|
+
* are transpiled by another plugin first.
|
|
170
|
+
* @default [ '.js' ]
|
|
208
171
|
*/
|
|
209
|
-
|
|
172
|
+
extensions?: ReadonlyArray<string>;
|
|
210
173
|
/**
|
|
211
|
-
* If
|
|
212
|
-
* names, even if they look like globs.
|
|
213
|
-
*
|
|
174
|
+
* If true then uses of `global` won't be dealt with by this plugin
|
|
214
175
|
* @default false
|
|
215
176
|
*/
|
|
216
|
-
|
|
177
|
+
ignoreGlobal?: boolean;
|
|
217
178
|
/**
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
* watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides
|
|
222
|
-
* the `useFsEvents` default.
|
|
179
|
+
* If false, skips source map generation for CommonJS modules. This will
|
|
180
|
+
* improve performance.
|
|
181
|
+
* @default true
|
|
223
182
|
*/
|
|
224
|
-
|
|
183
|
+
sourceMap?: boolean;
|
|
225
184
|
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
185
|
+
* Some `require` calls cannot be resolved statically to be translated to
|
|
186
|
+
* imports.
|
|
187
|
+
* When this option is set to `false`, the generated code will either
|
|
188
|
+
* directly throw an error when such a call is encountered or, when
|
|
189
|
+
* `dynamicRequireTargets` is used, when such a call cannot be resolved with a
|
|
190
|
+
* configured dynamic require target.
|
|
191
|
+
* Setting this option to `true` will instead leave the `require` call in the
|
|
192
|
+
* code or use it as a fallback for `dynamicRequireTargets`.
|
|
193
|
+
* @default false
|
|
229
194
|
*/
|
|
230
|
-
|
|
195
|
+
ignoreDynamicRequires?: boolean;
|
|
231
196
|
/**
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
197
|
+
* Instructs the plugin whether to enable mixed module transformations. This
|
|
198
|
+
* is useful in scenarios with modules that contain a mix of ES `import`
|
|
199
|
+
* statements and CommonJS `require` expressions. Set to `true` if `require`
|
|
200
|
+
* calls should be transformed to imports in mixed modules, or `false` if the
|
|
201
|
+
* `require` expressions should survive the transformation. The latter can be
|
|
202
|
+
* important if the code contains environment detection, or you are coding
|
|
203
|
+
* for an environment with special treatment for `require` calls such as
|
|
204
|
+
* ElectronJS. See also the `ignore` option.
|
|
205
|
+
* @default false
|
|
235
206
|
*/
|
|
236
|
-
|
|
207
|
+
transformMixedEsModules?: boolean;
|
|
237
208
|
/**
|
|
238
|
-
*
|
|
209
|
+
* By default, this plugin will try to hoist `require` statements as imports
|
|
210
|
+
* to the top of each file. While this works well for many code bases and
|
|
211
|
+
* allows for very efficient ESM output, it does not perfectly capture
|
|
212
|
+
* CommonJS semantics as the order of side effects like log statements may
|
|
213
|
+
* change. But it is especially problematic when there are circular `require`
|
|
214
|
+
* calls between CommonJS modules as those often rely on the lazy execution of
|
|
215
|
+
* nested `require` calls.
|
|
216
|
+
*
|
|
217
|
+
* Setting this option to `true` will wrap all CommonJS files in functions
|
|
218
|
+
* which are executed when they are required for the first time, preserving
|
|
219
|
+
* NodeJS semantics. Note that this can have an impact on the size and
|
|
220
|
+
* performance of the generated code.
|
|
221
|
+
*
|
|
222
|
+
* The default value of `"auto"` will only wrap CommonJS files when they are
|
|
223
|
+
* part of a CommonJS dependency cycle, e.g. an index file that is required by
|
|
224
|
+
* many of its dependencies. All other CommonJS files are hoisted. This is the
|
|
225
|
+
* recommended setting for most code bases.
|
|
226
|
+
*
|
|
227
|
+
* `false` will entirely prevent wrapping and hoist all files. This may still
|
|
228
|
+
* work depending on the nature of cyclic dependencies but will often cause
|
|
229
|
+
* problems.
|
|
230
|
+
*
|
|
231
|
+
* You can also provide a minimatch pattern, or array of patterns, to only
|
|
232
|
+
* specify a subset of files which should be wrapped in functions for proper
|
|
233
|
+
* `require` semantics.
|
|
234
|
+
*
|
|
235
|
+
* `"debug"` works like `"auto"` but after bundling, it will display a warning
|
|
236
|
+
* containing a list of ids that have been wrapped which can be used as
|
|
237
|
+
* minimatch pattern for fine-tuning.
|
|
238
|
+
* @default "auto"
|
|
239
239
|
*/
|
|
240
|
-
|
|
240
|
+
strictRequires?: boolean | string | RegExp | readonly (string | RegExp)[];
|
|
241
241
|
/**
|
|
242
|
-
*
|
|
242
|
+
* Sometimes you have to leave require statements unconverted. Pass an array
|
|
243
|
+
* containing the IDs or a `id => boolean` function.
|
|
244
|
+
* @default []
|
|
243
245
|
*/
|
|
244
|
-
|
|
246
|
+
ignore?: ReadonlyArray<string> | ((id: string) => boolean);
|
|
245
247
|
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
+
* In most cases, where `require` calls are inside a `try-catch` clause,
|
|
249
|
+
* they should be left unconverted as it requires an optional dependency
|
|
250
|
+
* that may or may not be installed beside the rolled up package.
|
|
251
|
+
* Due to the conversion of `require` to a static `import` - the call is
|
|
252
|
+
* hoisted to the top of the file, outside the `try-catch` clause.
|
|
253
|
+
*
|
|
254
|
+
* - `true`: Default. All `require` calls inside a `try` will be left unconverted.
|
|
255
|
+
* - `false`: All `require` calls inside a `try` will be converted as if the
|
|
256
|
+
* `try-catch` clause is not there.
|
|
257
|
+
* - `remove`: Remove all `require` calls from inside any `try` block.
|
|
258
|
+
* - `string[]`: Pass an array containing the IDs to left unconverted.
|
|
259
|
+
* - `((id: string) => boolean|'remove')`: Pass a function that controls
|
|
260
|
+
* individual IDs.
|
|
261
|
+
*
|
|
262
|
+
* @default true
|
|
248
263
|
*/
|
|
249
|
-
|
|
264
|
+
ignoreTryCatch?: boolean | 'remove' | ReadonlyArray<string> | ((id: string) => boolean | 'remove');
|
|
250
265
|
/**
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
266
|
+
* Controls how to render imports from external dependencies. By default,
|
|
267
|
+
* this plugin assumes that all external dependencies are CommonJS. This
|
|
268
|
+
* means they are rendered as default imports to be compatible with e.g.
|
|
269
|
+
* NodeJS where ES modules can only import a default export from a CommonJS
|
|
270
|
+
* dependency.
|
|
271
|
+
*
|
|
272
|
+
* If you set `esmExternals` to `true`, this plugin assumes that all
|
|
273
|
+
* external dependencies are ES modules and respect the
|
|
274
|
+
* `requireReturnsDefault` option. If that option is not set, they will be
|
|
275
|
+
* rendered as namespace imports.
|
|
276
|
+
*
|
|
277
|
+
* You can also supply an array of ids to be treated as ES modules, or a
|
|
278
|
+
* function that will be passed each external id to determine whether it is
|
|
279
|
+
* an ES module.
|
|
280
|
+
* @default false
|
|
254
281
|
*/
|
|
255
|
-
|
|
282
|
+
esmExternals?: boolean | ReadonlyArray<string> | ((id: string) => boolean);
|
|
256
283
|
/**
|
|
257
|
-
*
|
|
258
|
-
*
|
|
284
|
+
* Controls what is returned when requiring an ES module from a CommonJS file.
|
|
285
|
+
* When using the `esmExternals` option, this will also apply to external
|
|
286
|
+
* modules. By default, this plugin will render those imports as namespace
|
|
287
|
+
* imports i.e.
|
|
288
|
+
*
|
|
289
|
+
* ```js
|
|
290
|
+
* // input
|
|
291
|
+
* const foo = require('foo');
|
|
292
|
+
*
|
|
293
|
+
* // output
|
|
294
|
+
* import * as foo from 'foo';
|
|
295
|
+
* ```
|
|
296
|
+
*
|
|
297
|
+
* However, there are some situations where this may not be desired.
|
|
298
|
+
* For these situations, you can change Rollup's behaviour either globally or
|
|
299
|
+
* per module. To change it globally, set the `requireReturnsDefault` option
|
|
300
|
+
* to one of the following values:
|
|
301
|
+
*
|
|
302
|
+
* - `false`: This is the default, requiring an ES module returns its
|
|
303
|
+
* namespace. This is the only option that will also add a marker
|
|
304
|
+
* `__esModule: true` to the namespace to support interop patterns in
|
|
305
|
+
* CommonJS modules that are transpiled ES modules.
|
|
306
|
+
* - `"namespace"`: Like `false`, requiring an ES module returns its
|
|
307
|
+
* namespace, but the plugin does not add the `__esModule` marker and thus
|
|
308
|
+
* creates more efficient code. For external dependencies when using
|
|
309
|
+
* `esmExternals: true`, no additional interop code is generated.
|
|
310
|
+
* - `"auto"`: This is complementary to how `output.exports: "auto"` works in
|
|
311
|
+
* Rollup: If a module has a default export and no named exports, requiring
|
|
312
|
+
* that module returns the default export. In all other cases, the namespace
|
|
313
|
+
* is returned. For external dependencies when using `esmExternals: true`, a
|
|
314
|
+
* corresponding interop helper is added.
|
|
315
|
+
* - `"preferred"`: If a module has a default export, requiring that module
|
|
316
|
+
* always returns the default export, no matter whether additional named
|
|
317
|
+
* exports exist. This is similar to how previous versions of this plugin
|
|
318
|
+
* worked. Again for external dependencies when using `esmExternals: true`,
|
|
319
|
+
* an interop helper is added.
|
|
320
|
+
* - `true`: This will always try to return the default export on require
|
|
321
|
+
* without checking if it actually exists. This can throw at build time if
|
|
322
|
+
* there is no default export. This is how external dependencies are handled
|
|
323
|
+
* when `esmExternals` is not used. The advantage over the other options is
|
|
324
|
+
* that, like `false`, this does not add an interop helper for external
|
|
325
|
+
* dependencies, keeping the code lean.
|
|
326
|
+
*
|
|
327
|
+
* To change this for individual modules, you can supply a function for
|
|
328
|
+
* `requireReturnsDefault` instead. This function will then be called once for
|
|
329
|
+
* each required ES module or external dependency with the corresponding id
|
|
330
|
+
* and allows you to return different values for different modules.
|
|
331
|
+
* @default false
|
|
332
|
+
*/
|
|
333
|
+
requireReturnsDefault?: boolean | 'auto' | 'preferred' | 'namespace' | ((id: string) => boolean | 'auto' | 'preferred' | 'namespace');
|
|
334
|
+
/**
|
|
335
|
+
* @default "auto"
|
|
336
|
+
*/
|
|
337
|
+
defaultIsModuleExports?: boolean | 'auto' | ((id: string) => boolean | 'auto');
|
|
338
|
+
/**
|
|
339
|
+
* Some modules contain dynamic `require` calls, or require modules that
|
|
340
|
+
* contain circular dependencies, which are not handled well by static
|
|
341
|
+
* imports. Including those modules as `dynamicRequireTargets` will simulate a
|
|
342
|
+
* CommonJS (NodeJS-like) environment for them with support for dynamic
|
|
343
|
+
* dependencies. It also enables `strictRequires` for those modules.
|
|
344
|
+
*
|
|
345
|
+
* Note: In extreme cases, this feature may result in some paths being
|
|
346
|
+
* rendered as absolute in the final bundle. The plugin tries to avoid
|
|
347
|
+
* exposing paths from the local machine, but if you are `dynamicRequirePaths`
|
|
348
|
+
* with paths that are far away from your project's folder, that may require
|
|
349
|
+
* replacing strings like `"/Users/John/Desktop/foo-project/"` -\> `"/"`.
|
|
350
|
+
*/
|
|
351
|
+
dynamicRequireTargets?: string | ReadonlyArray<string>;
|
|
352
|
+
/**
|
|
353
|
+
* To avoid long paths when using the `dynamicRequireTargets` option, you can use this option to specify a directory
|
|
354
|
+
* that is a common parent for all files that use dynamic require statements. Using a directory higher up such as `/`
|
|
355
|
+
* may lead to unnecessarily long paths in the generated code and may expose directory names on your machine like your
|
|
356
|
+
* home directory name. By default, it uses the current working directory.
|
|
357
|
+
*/
|
|
358
|
+
dynamicRequireRoot?: string;
|
|
359
|
+
}
|
|
360
|
+
//#endregion
|
|
361
|
+
//#region src/types/dynamicImportVars.d.ts
|
|
362
|
+
interface RollupDynamicImportVarsOptions {
|
|
363
|
+
/**
|
|
364
|
+
* Files to include in this plugin (default all).
|
|
365
|
+
* @default []
|
|
366
|
+
*/
|
|
367
|
+
include?: string | RegExp | (string | RegExp)[];
|
|
368
|
+
/**
|
|
369
|
+
* Files to exclude in this plugin (default none).
|
|
370
|
+
* @default []
|
|
371
|
+
*/
|
|
372
|
+
exclude?: string | RegExp | (string | RegExp)[];
|
|
373
|
+
/**
|
|
374
|
+
* @deprecated This option is no-op and will be removed in future versions.
|
|
375
|
+
*/
|
|
376
|
+
warnOnError?: boolean;
|
|
377
|
+
}
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/types/anymatch.d.ts
|
|
380
|
+
type AnymatchFn = (testString: string) => boolean;
|
|
381
|
+
type AnymatchPattern = string | RegExp | AnymatchFn;
|
|
382
|
+
type AnymatchMatcher = AnymatchPattern | AnymatchPattern[];
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region src/types/chokidar.d.ts
|
|
385
|
+
declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
|
386
|
+
options: WatchOptions;
|
|
387
|
+
/**
|
|
388
|
+
* Constructs a new FSWatcher instance with optional WatchOptions parameter.
|
|
389
|
+
*/
|
|
390
|
+
constructor(options?: WatchOptions);
|
|
391
|
+
/**
|
|
392
|
+
* When called, requests that the Node.js event loop not exit so long as the fs.FSWatcher is active.
|
|
393
|
+
* Calling watcher.ref() multiple times will have no effect.
|
|
394
|
+
*/
|
|
395
|
+
ref(): this;
|
|
396
|
+
/**
|
|
397
|
+
* When called, the active fs.FSWatcher object will not require the Node.js event loop to remain active.
|
|
398
|
+
* If there is no other activity keeping the event loop running, the process may exit before the fs.FSWatcher object's callback is invoked.
|
|
399
|
+
* Calling watcher.unref() multiple times will have no effect.
|
|
400
|
+
*/
|
|
401
|
+
unref(): this;
|
|
402
|
+
/**
|
|
403
|
+
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
|
|
404
|
+
* string.
|
|
405
|
+
*/
|
|
406
|
+
add(paths: string | ReadonlyArray<string>): this;
|
|
407
|
+
/**
|
|
408
|
+
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one
|
|
409
|
+
* string.
|
|
410
|
+
*/
|
|
411
|
+
unwatch(paths: string | ReadonlyArray<string>): this;
|
|
412
|
+
/**
|
|
413
|
+
* Returns an object representing all the paths on the file system being watched by this
|
|
414
|
+
* `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless
|
|
415
|
+
* the `cwd` option was used), and the values are arrays of the names of the items contained in
|
|
416
|
+
* each directory.
|
|
417
|
+
*/
|
|
418
|
+
getWatched(): {
|
|
419
|
+
[directory: string]: string[];
|
|
420
|
+
};
|
|
421
|
+
/**
|
|
422
|
+
* Removes all listeners from watched files.
|
|
423
|
+
*/
|
|
424
|
+
close(): Promise<void>;
|
|
425
|
+
on(event: 'add' | 'addDir' | 'change', listener: (path: string, stats?: fs.Stats) => void): this;
|
|
426
|
+
on(event: 'all', listener: (eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', path: string, stats?: fs.Stats) => void): this;
|
|
427
|
+
/**
|
|
428
|
+
* Error occurred
|
|
429
|
+
*/
|
|
430
|
+
on(event: 'error', listener: (error: Error) => void): this;
|
|
431
|
+
/**
|
|
432
|
+
* Exposes the native Node `fs.FSWatcher events`
|
|
433
|
+
*/
|
|
434
|
+
on(event: 'raw', listener: (eventName: string, path: string, details: any) => void): this;
|
|
435
|
+
/**
|
|
436
|
+
* Fires when the initial scan is complete
|
|
437
|
+
*/
|
|
438
|
+
on(event: 'ready', listener: () => void): this;
|
|
439
|
+
on(event: 'unlink' | 'unlinkDir', listener: (path: string) => void): this;
|
|
440
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
441
|
+
}
|
|
442
|
+
interface WatchOptions {
|
|
443
|
+
/**
|
|
444
|
+
* Indicates whether the process should continue to run as long as files are being watched. If
|
|
445
|
+
* set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`,
|
|
446
|
+
* even if the process continues to run.
|
|
447
|
+
*/
|
|
448
|
+
persistent?: boolean;
|
|
449
|
+
/**
|
|
450
|
+
* ([anymatch](https://github.com/micromatch/anymatch)-compatible definition) Defines files/paths to
|
|
451
|
+
* be ignored. The whole relative or absolute path is tested, not just filename. If a function
|
|
452
|
+
* with two arguments is provided, it gets called twice per path - once with a single argument
|
|
453
|
+
* (the path), second time with two arguments (the path and the
|
|
454
|
+
* [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path).
|
|
455
|
+
*/
|
|
456
|
+
ignored?: AnymatchMatcher;
|
|
457
|
+
/**
|
|
458
|
+
* If set to `false` then `add`/`addDir` events are also emitted for matching paths while
|
|
459
|
+
* instantiating the watching as chokidar discovers these file paths (before the `ready` event).
|
|
460
|
+
*/
|
|
461
|
+
ignoreInitial?: boolean;
|
|
462
|
+
/**
|
|
463
|
+
* When `false`, only the symlinks themselves will be watched for changes instead of following
|
|
464
|
+
* the link references and bubbling events through the link's path.
|
|
465
|
+
*/
|
|
466
|
+
followSymlinks?: boolean;
|
|
467
|
+
/**
|
|
468
|
+
* The base directory from which watch `paths` are to be derived. Paths emitted with events will
|
|
469
|
+
* be relative to this.
|
|
470
|
+
*/
|
|
471
|
+
cwd?: string;
|
|
472
|
+
/**
|
|
473
|
+
* If set to true then the strings passed to .watch() and .add() are treated as literal path
|
|
474
|
+
* names, even if they look like globs.
|
|
475
|
+
*
|
|
476
|
+
* @default false
|
|
477
|
+
*/
|
|
478
|
+
disableGlobbing?: boolean;
|
|
479
|
+
/**
|
|
480
|
+
* Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU
|
|
481
|
+
* utilization, consider setting this to `false`. It is typically necessary to **set this to
|
|
482
|
+
* `true` to successfully watch files over a network**, and it may be necessary to successfully
|
|
483
|
+
* watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides
|
|
484
|
+
* the `useFsEvents` default.
|
|
485
|
+
*/
|
|
486
|
+
usePolling?: boolean;
|
|
487
|
+
/**
|
|
488
|
+
* Whether to use the `fsevents` watching interface if available. When set to `true` explicitly
|
|
489
|
+
* and `fsevents` is available this supersedes the `usePolling` setting. When set to `false` on
|
|
490
|
+
* OS X, `usePolling: true` becomes the default.
|
|
491
|
+
*/
|
|
492
|
+
useFsEvents?: boolean;
|
|
493
|
+
/**
|
|
494
|
+
* If relying upon the [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object that
|
|
495
|
+
* may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is
|
|
496
|
+
* provided even in cases where it wasn't already available from the underlying watch events.
|
|
497
|
+
*/
|
|
498
|
+
alwaysStat?: boolean;
|
|
499
|
+
/**
|
|
500
|
+
* If set, limits how many levels of subdirectories will be traversed.
|
|
501
|
+
*/
|
|
502
|
+
depth?: number;
|
|
503
|
+
/**
|
|
504
|
+
* Interval of file system polling.
|
|
505
|
+
*/
|
|
506
|
+
interval?: number;
|
|
507
|
+
/**
|
|
508
|
+
* Interval of file system polling for binary files. ([see list of binary extensions](https://gi
|
|
509
|
+
* thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
|
|
510
|
+
*/
|
|
511
|
+
binaryInterval?: number;
|
|
512
|
+
/**
|
|
513
|
+
* Indicates whether to watch files that don't have read permissions if possible. If watching
|
|
514
|
+
* fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed
|
|
515
|
+
* silently.
|
|
516
|
+
*/
|
|
517
|
+
ignorePermissionErrors?: boolean;
|
|
518
|
+
/**
|
|
519
|
+
* `true` if `useFsEvents` and `usePolling` are `false`. Automatically filters out artifacts
|
|
520
|
+
* that occur when using editors that use "atomic writes" instead of writing directly to the
|
|
259
521
|
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
|
|
260
522
|
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
|
|
261
523
|
* you can override it by setting `atomic` to a custom value, in milliseconds.
|
|
@@ -345,6 +607,18 @@ declare namespace Connect {
|
|
|
345
607
|
}
|
|
346
608
|
}
|
|
347
609
|
//#endregion
|
|
610
|
+
//#region src/shared/forwardConsole.d.ts
|
|
611
|
+
type ForwardConsoleLogLevel = "error" | "warn" | "info" | "log" | "debug" | (string & {});
|
|
612
|
+
interface ForwardConsoleOptions {
|
|
613
|
+
unhandledErrors?: boolean;
|
|
614
|
+
logLevels?: ForwardConsoleLogLevel[];
|
|
615
|
+
}
|
|
616
|
+
interface ResolvedForwardConsoleOptions {
|
|
617
|
+
enabled: boolean;
|
|
618
|
+
unhandledErrors: boolean;
|
|
619
|
+
logLevels: ForwardConsoleLogLevel[];
|
|
620
|
+
}
|
|
621
|
+
//#endregion
|
|
348
622
|
//#region ../../node_modules/.pnpm/http-proxy-3@1.23.3_ms@2.1.3/node_modules/http-proxy-3/dist/lib/http-proxy/index.d.ts
|
|
349
623
|
interface ProxyTargetDetailed {
|
|
350
624
|
host: string;
|
|
@@ -576,34 +850,6 @@ interface ProxyOptions extends ServerOptions$3 {
|
|
|
576
850
|
rewriteWsOrigin?: boolean | undefined;
|
|
577
851
|
}
|
|
578
852
|
//#endregion
|
|
579
|
-
//#region src/node/logger.d.ts
|
|
580
|
-
type LogType = "error" | "warn" | "info";
|
|
581
|
-
type LogLevel = LogType | "silent";
|
|
582
|
-
interface Logger {
|
|
583
|
-
info(msg: string, options?: LogOptions): void;
|
|
584
|
-
warn(msg: string, options?: LogOptions): void;
|
|
585
|
-
warnOnce(msg: string, options?: LogOptions): void;
|
|
586
|
-
error(msg: string, options?: LogErrorOptions): void;
|
|
587
|
-
clearScreen(type: LogType): void;
|
|
588
|
-
hasErrorLogged(error: Error | RollupError): boolean;
|
|
589
|
-
hasWarned: boolean;
|
|
590
|
-
}
|
|
591
|
-
interface LogOptions {
|
|
592
|
-
clear?: boolean;
|
|
593
|
-
timestamp?: boolean;
|
|
594
|
-
environment?: string;
|
|
595
|
-
}
|
|
596
|
-
interface LogErrorOptions extends LogOptions {
|
|
597
|
-
error?: Error | RollupError | null;
|
|
598
|
-
}
|
|
599
|
-
interface LoggerOptions {
|
|
600
|
-
prefix?: string;
|
|
601
|
-
allowClearScreen?: boolean;
|
|
602
|
-
customLogger?: Logger;
|
|
603
|
-
console?: Console;
|
|
604
|
-
}
|
|
605
|
-
declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
|
|
606
|
-
//#endregion
|
|
607
853
|
//#region src/node/http.d.ts
|
|
608
854
|
interface CommonServerOptions {
|
|
609
855
|
/**
|
|
@@ -704,120 +950,6 @@ interface CorsOptions {
|
|
|
704
950
|
}
|
|
705
951
|
type CorsOrigin = boolean | string | RegExp | (string | RegExp)[];
|
|
706
952
|
//#endregion
|
|
707
|
-
//#region src/shared/forwardConsole.d.ts
|
|
708
|
-
type ForwardConsoleLogLevel = "error" | "warn" | "info" | "log" | "debug" | (string & {});
|
|
709
|
-
interface ForwardConsoleOptions {
|
|
710
|
-
unhandledErrors?: boolean;
|
|
711
|
-
logLevels?: ForwardConsoleLogLevel[];
|
|
712
|
-
}
|
|
713
|
-
interface ResolvedForwardConsoleOptions {
|
|
714
|
-
enabled: boolean;
|
|
715
|
-
unhandledErrors: boolean;
|
|
716
|
-
logLevels: ForwardConsoleLogLevel[];
|
|
717
|
-
}
|
|
718
|
-
//#endregion
|
|
719
|
-
//#region src/node/typeUtils.d.ts
|
|
720
|
-
type RequiredExceptFor<T, K extends keyof T> = Pick<T, K> & Required<Omit<T, K>>;
|
|
721
|
-
//#endregion
|
|
722
|
-
//#region src/node/preview.d.ts
|
|
723
|
-
interface PreviewOptions extends CommonServerOptions {}
|
|
724
|
-
interface ResolvedPreviewOptions extends RequiredExceptFor<PreviewOptions, "host" | "https" | "proxy"> {}
|
|
725
|
-
interface PreviewServer {
|
|
726
|
-
/**
|
|
727
|
-
* The resolved vite config object
|
|
728
|
-
*/
|
|
729
|
-
config: ResolvedConfig;
|
|
730
|
-
/**
|
|
731
|
-
* Stop the server.
|
|
732
|
-
*/
|
|
733
|
-
close(): Promise<void>;
|
|
734
|
-
/**
|
|
735
|
-
* A connect app instance.
|
|
736
|
-
* - Can be used to attach custom middlewares to the preview server.
|
|
737
|
-
* - Can also be used as the handler function of a custom http server
|
|
738
|
-
* or as a middleware in any connect-style Node.js frameworks
|
|
739
|
-
*
|
|
740
|
-
* https://github.com/senchalabs/connect#use-middleware
|
|
741
|
-
*/
|
|
742
|
-
middlewares: Connect.Server;
|
|
743
|
-
/**
|
|
744
|
-
* native Node http server instance
|
|
745
|
-
*/
|
|
746
|
-
httpServer: HttpServer;
|
|
747
|
-
/**
|
|
748
|
-
* The resolved urls Vite prints on the CLI (URL-encoded). Returns `null`
|
|
749
|
-
* if the server is not listening on any port.
|
|
750
|
-
*/
|
|
751
|
-
resolvedUrls: ResolvedServerUrls | null;
|
|
752
|
-
/**
|
|
753
|
-
* Print server urls
|
|
754
|
-
*/
|
|
755
|
-
printUrls(): void;
|
|
756
|
-
/**
|
|
757
|
-
* Bind CLI shortcuts
|
|
758
|
-
*/
|
|
759
|
-
bindCLIShortcuts(options?: BindCLIShortcutsOptions<PreviewServer>): void;
|
|
760
|
-
}
|
|
761
|
-
type PreviewServerHook = (this: MinimalPluginContextWithoutEnvironment, server: PreviewServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
762
|
-
/**
|
|
763
|
-
* Starts the Vite server in preview mode, to simulate a production deployment
|
|
764
|
-
*/
|
|
765
|
-
declare function preview(inlineConfig?: InlineConfig): Promise<PreviewServer>;
|
|
766
|
-
//#endregion
|
|
767
|
-
//#region src/node/shortcuts.d.ts
|
|
768
|
-
type BindCLIShortcutsOptions<Server = ViteDevServer | PreviewServer> = {
|
|
769
|
-
/**
|
|
770
|
-
* Print a one-line shortcuts "help" hint to the terminal
|
|
771
|
-
*/
|
|
772
|
-
print?: boolean;
|
|
773
|
-
/**
|
|
774
|
-
* Custom shortcuts to run when a key is pressed. These shortcuts take priority
|
|
775
|
-
* over the default shortcuts if they have the same keys (except the `h` key).
|
|
776
|
-
* To disable a default shortcut, define the same key but with `action: undefined`.
|
|
777
|
-
*/
|
|
778
|
-
customShortcuts?: CLIShortcut<Server>[];
|
|
779
|
-
};
|
|
780
|
-
type CLIShortcut<Server = ViteDevServer | PreviewServer> = {
|
|
781
|
-
key: string;
|
|
782
|
-
description: string;
|
|
783
|
-
action?(server: Server): void | Promise<void>;
|
|
784
|
-
};
|
|
785
|
-
//#endregion
|
|
786
|
-
//#region src/node/baseEnvironment.d.ts
|
|
787
|
-
declare class PartialEnvironment {
|
|
788
|
-
name: string;
|
|
789
|
-
getTopLevelConfig(): ResolvedConfig;
|
|
790
|
-
config: ResolvedConfig & ResolvedEnvironmentOptions;
|
|
791
|
-
logger: Logger;
|
|
792
|
-
constructor(name: string, topLevelConfig: ResolvedConfig, options?: ResolvedEnvironmentOptions);
|
|
793
|
-
}
|
|
794
|
-
declare class BaseEnvironment extends PartialEnvironment {
|
|
795
|
-
get plugins(): readonly Plugin[];
|
|
796
|
-
constructor(name: string, config: ResolvedConfig, options?: ResolvedEnvironmentOptions);
|
|
797
|
-
}
|
|
798
|
-
/**
|
|
799
|
-
* This class discourages users from inversely checking the `mode`
|
|
800
|
-
* to determine the type of environment, e.g.
|
|
801
|
-
*
|
|
802
|
-
* ```js
|
|
803
|
-
* const isDev = environment.mode !== 'build' // bad
|
|
804
|
-
* const isDev = environment.mode === 'dev' // good
|
|
805
|
-
* ```
|
|
806
|
-
*
|
|
807
|
-
* You should also not check against `"unknown"` specifically. It's
|
|
808
|
-
* a placeholder for more possible environment types.
|
|
809
|
-
*/
|
|
810
|
-
declare class UnknownEnvironment extends BaseEnvironment {
|
|
811
|
-
mode: "unknown";
|
|
812
|
-
}
|
|
813
|
-
//#endregion
|
|
814
|
-
//#region src/node/optimizer/scan.d.ts
|
|
815
|
-
declare class ScanEnvironment extends BaseEnvironment {
|
|
816
|
-
mode: "scan";
|
|
817
|
-
get pluginContainer(): EnvironmentPluginContainer;
|
|
818
|
-
init(): Promise<void>;
|
|
819
|
-
}
|
|
820
|
-
//#endregion
|
|
821
953
|
//#region src/node/optimizer/index.d.ts
|
|
822
954
|
type ExportsData = {
|
|
823
955
|
hasModuleSyntax: boolean;
|
|
@@ -1013,7 +1145,59 @@ interface DepOptimizationMetadata {
|
|
|
1013
1145
|
*
|
|
1014
1146
|
* @deprecated the optimization process runs automatically and does not need to be called
|
|
1015
1147
|
*/
|
|
1016
|
-
declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>;
|
|
1148
|
+
export declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>;
|
|
1149
|
+
//#endregion
|
|
1150
|
+
//#region src/node/server/bundledDev.d.ts
|
|
1151
|
+
type MemoryFile = {
|
|
1152
|
+
source: string | Uint8Array;
|
|
1153
|
+
etag?: string;
|
|
1154
|
+
};
|
|
1155
|
+
declare class MemoryFiles {
|
|
1156
|
+
private files;
|
|
1157
|
+
get size(): number;
|
|
1158
|
+
get(file: string): MemoryFile | undefined;
|
|
1159
|
+
set(file: string, content: MemoryFile | (() => MemoryFile)): void;
|
|
1160
|
+
has(file: string): boolean;
|
|
1161
|
+
clear(): void;
|
|
1162
|
+
}
|
|
1163
|
+
declare class BundledDev {
|
|
1164
|
+
private environment;
|
|
1165
|
+
private _devEngine;
|
|
1166
|
+
private viteRuntime?;
|
|
1167
|
+
private initialBuildCompleted;
|
|
1168
|
+
private _closed;
|
|
1169
|
+
private clients;
|
|
1170
|
+
private debouncedFullReload;
|
|
1171
|
+
private fullReloadPending;
|
|
1172
|
+
private reloadNeededClientIds;
|
|
1173
|
+
private debouncedReloadNeededFlush;
|
|
1174
|
+
private lastBuildError;
|
|
1175
|
+
memoryFiles: MemoryFiles;
|
|
1176
|
+
constructor(environment: DevEnvironment);
|
|
1177
|
+
private get devEngine();
|
|
1178
|
+
private pendingPayloadFilenames;
|
|
1179
|
+
get hasBuildOutput(): boolean;
|
|
1180
|
+
listen(): Promise<void>;
|
|
1181
|
+
private waitForInitialBuildFinish;
|
|
1182
|
+
private ensureOutputAndFlushReloadNeeded;
|
|
1183
|
+
triggerBundleRegenerationIfStale(): Promise<boolean>;
|
|
1184
|
+
triggerLazyBundling(moduleId: string | null, clientId: string | null): Promise<{
|
|
1185
|
+
code: string;
|
|
1186
|
+
filename: string;
|
|
1187
|
+
} | undefined>;
|
|
1188
|
+
/**
|
|
1189
|
+
* Called by the serving middlewares when the response for a payload completed.
|
|
1190
|
+
* Only delivered payloads are recorded on the server's per-client ship map, so
|
|
1191
|
+
* later chunks may omit a module only if the payload carrying it was delivered.
|
|
1192
|
+
*
|
|
1193
|
+
* Note: the payload filename is unique across all clients.
|
|
1194
|
+
*/
|
|
1195
|
+
markPayloadDelivered(filename: string): void;
|
|
1196
|
+
close(): Promise<void>;
|
|
1197
|
+
private storeOutputFiles;
|
|
1198
|
+
private getRolldownOptions;
|
|
1199
|
+
private handleHmrOutput;
|
|
1200
|
+
}
|
|
1017
1201
|
//#endregion
|
|
1018
1202
|
//#region src/node/server/transformRequest.d.ts
|
|
1019
1203
|
interface TransformResult {
|
|
@@ -1306,79 +1490,187 @@ type ServerHotChannelApi = {
|
|
|
1306
1490
|
};
|
|
1307
1491
|
type ServerHotChannel = HotChannel<ServerHotChannelApi>;
|
|
1308
1492
|
type NormalizedServerHotChannel = NormalizedHotChannel<ServerHotChannelApi>;
|
|
1309
|
-
declare function createServerHotChannel(): ServerHotChannel;
|
|
1493
|
+
export declare function createServerHotChannel(): ServerHotChannel;
|
|
1310
1494
|
//#endregion
|
|
1311
|
-
//#region src/
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1495
|
+
//#region src/node/server/pluginContainer.d.ts
|
|
1496
|
+
type SkipInformation = {
|
|
1497
|
+
id: string;
|
|
1498
|
+
importer: string | undefined;
|
|
1499
|
+
plugin: Plugin;
|
|
1500
|
+
called?: boolean;
|
|
1501
|
+
};
|
|
1502
|
+
declare class EnvironmentPluginContainer<Env extends Environment = Environment> {
|
|
1503
|
+
private _pluginContextMap;
|
|
1504
|
+
private _resolvedRolldownOptions?;
|
|
1505
|
+
private _processesing;
|
|
1506
|
+
private _seenResolves;
|
|
1507
|
+
private _moduleNodeToLoadAddedImports;
|
|
1508
|
+
getSortedPluginHooks: PluginHookUtils["getSortedPluginHooks"];
|
|
1509
|
+
getSortedPlugins: PluginHookUtils["getSortedPlugins"];
|
|
1510
|
+
moduleGraph: EnvironmentModuleGraph | undefined;
|
|
1511
|
+
watchFiles: Set<string>;
|
|
1512
|
+
minimalContext: MinimalPluginContext$1<Env>;
|
|
1513
|
+
private _started;
|
|
1514
|
+
private _buildStartPromise;
|
|
1515
|
+
private _closed;
|
|
1516
|
+
private _updateModuleLoadAddedImports;
|
|
1517
|
+
private _getAddedImports;
|
|
1518
|
+
getModuleInfo(id: string): ModuleInfo | null;
|
|
1519
|
+
private handleHookPromise;
|
|
1520
|
+
get options(): InputOptions;
|
|
1521
|
+
resolveRolldownOptions(): Promise<InputOptions>;
|
|
1522
|
+
private _getPluginContext;
|
|
1523
|
+
private hookParallel;
|
|
1524
|
+
buildStart(_options?: InputOptions): Promise<void>;
|
|
1525
|
+
resolveId(rawId: string, importer?: string | undefined, options?: {
|
|
1526
|
+
kind?: ImportKind;
|
|
1527
|
+
attributes?: Record<string, string>;
|
|
1528
|
+
custom?: CustomPluginOptions;
|
|
1529
|
+
/** @deprecated use `skipCalls` instead */
|
|
1530
|
+
skip?: Set<Plugin>;
|
|
1531
|
+
skipCalls?: readonly SkipInformation[];
|
|
1532
|
+
|
|
1533
|
+
isEntry?: boolean;
|
|
1534
|
+
}): Promise<PartialResolvedId | null>;
|
|
1535
|
+
load(id: string): Promise<LoadResult | null>;
|
|
1536
|
+
transform(code: string, id: string, options?: {
|
|
1537
|
+
inMap?: SourceDescription["map"];
|
|
1538
|
+
moduleType?: string;
|
|
1539
|
+
}): Promise<{
|
|
1540
|
+
code: string;
|
|
1541
|
+
map: SourceMap | {
|
|
1542
|
+
mappings: "";
|
|
1543
|
+
} | null;
|
|
1544
|
+
moduleType?: ModuleType;
|
|
1545
|
+
}>;
|
|
1546
|
+
watchChange(id: string, change: {
|
|
1547
|
+
event: "create" | "update" | "delete";
|
|
1548
|
+
}): Promise<void>;
|
|
1549
|
+
close(): Promise<void>;
|
|
1550
|
+
}
|
|
1551
|
+
declare class BasicMinimalPluginContext<Meta = PluginContextMeta> {
|
|
1552
|
+
meta: Meta;
|
|
1553
|
+
private _logger;
|
|
1554
|
+
constructor(meta: Meta, _logger: Logger);
|
|
1555
|
+
get pluginName(): string;
|
|
1556
|
+
debug(rawLog: string | RollupLog | (() => string | RollupLog)): void;
|
|
1557
|
+
info(rawLog: string | RollupLog | (() => string | RollupLog)): void;
|
|
1558
|
+
warn(rawLog: string | RollupLog | (() => string | RollupLog)): void;
|
|
1559
|
+
error(e: string | RollupError): never;
|
|
1560
|
+
private _normalizeRawLog;
|
|
1561
|
+
}
|
|
1562
|
+
declare class MinimalPluginContext$1<T extends Environment = Environment> extends BasicMinimalPluginContext implements MinimalPluginContext {
|
|
1563
|
+
environment: T;
|
|
1564
|
+
constructor(meta: PluginContextMeta, environment: T);
|
|
1565
|
+
}
|
|
1566
|
+
declare class PluginContainer {
|
|
1567
|
+
private environments;
|
|
1568
|
+
constructor(environments: Record<string, Environment>);
|
|
1569
|
+
private _getEnvironment;
|
|
1570
|
+
private _getPluginContainer;
|
|
1571
|
+
getModuleInfo(id: string): ModuleInfo | null;
|
|
1572
|
+
get options(): InputOptions;
|
|
1573
|
+
buildStart(_options?: InputOptions): Promise<void>;
|
|
1574
|
+
watchChange(id: string, change: {
|
|
1575
|
+
event: "create" | "update" | "delete";
|
|
1576
|
+
}): Promise<void>;
|
|
1577
|
+
resolveId(rawId: string, importer?: string, options?: {
|
|
1578
|
+
attributes?: Record<string, string>;
|
|
1579
|
+
custom?: CustomPluginOptions;
|
|
1580
|
+
/** @deprecated use `skipCalls` instead */
|
|
1581
|
+
skip?: Set<Plugin>;
|
|
1582
|
+
skipCalls?: readonly SkipInformation[];
|
|
1583
|
+
ssr?: boolean;
|
|
1584
|
+
|
|
1585
|
+
isEntry?: boolean;
|
|
1586
|
+
}): Promise<PartialResolvedId | null>;
|
|
1587
|
+
load(id: string, options?: {
|
|
1588
|
+
ssr?: boolean;
|
|
1589
|
+
}): Promise<LoadResult | null>;
|
|
1590
|
+
transform(code: string, id: string, options?: {
|
|
1591
|
+
ssr?: boolean;
|
|
1592
|
+
environment?: Environment;
|
|
1593
|
+
inMap?: SourceDescription["map"];
|
|
1594
|
+
}): Promise<{
|
|
1595
|
+
code: string;
|
|
1596
|
+
map: SourceMap | {
|
|
1597
|
+
mappings: "";
|
|
1598
|
+
} | null;
|
|
1599
|
+
}>;
|
|
1600
|
+
close(): Promise<void>;
|
|
1601
|
+
}
|
|
1602
|
+
//#endregion
|
|
1603
|
+
//#region src/types/ws.d.ts
|
|
1604
|
+
// WebSocket socket.
|
|
1605
|
+
declare class WebSocket extends EventEmitter {
|
|
1606
|
+
/** The connection is not yet open. */
|
|
1607
|
+
static readonly CONNECTING: 0;
|
|
1608
|
+
/** The connection is open and ready to communicate. */
|
|
1609
|
+
static readonly OPEN: 1;
|
|
1610
|
+
/** The connection is in the process of closing. */
|
|
1611
|
+
static readonly CLOSING: 2;
|
|
1612
|
+
/** The connection is closed. */
|
|
1613
|
+
static readonly CLOSED: 3;
|
|
1614
|
+
binaryType: 'nodebuffer' | 'arraybuffer' | 'fragments';
|
|
1615
|
+
readonly bufferedAmount: number;
|
|
1616
|
+
readonly extensions: string;
|
|
1617
|
+
/** Indicates whether the websocket is paused */
|
|
1618
|
+
readonly isPaused: boolean;
|
|
1619
|
+
readonly protocol: string;
|
|
1620
|
+
/** The current state of the connection */
|
|
1621
|
+
readonly readyState: typeof WebSocket.CONNECTING | typeof WebSocket.OPEN | typeof WebSocket.CLOSING | typeof WebSocket.CLOSED;
|
|
1622
|
+
readonly url: string;
|
|
1623
|
+
/** The connection is not yet open. */
|
|
1624
|
+
readonly CONNECTING: 0;
|
|
1625
|
+
/** The connection is open and ready to communicate. */
|
|
1626
|
+
readonly OPEN: 1;
|
|
1627
|
+
/** The connection is in the process of closing. */
|
|
1628
|
+
readonly CLOSING: 2;
|
|
1629
|
+
/** The connection is closed. */
|
|
1630
|
+
readonly CLOSED: 3;
|
|
1631
|
+
onopen: ((event: WebSocket.Event) => void) | null;
|
|
1632
|
+
onerror: ((event: WebSocket.ErrorEvent) => void) | null;
|
|
1633
|
+
onclose: ((event: WebSocket.CloseEvent) => void) | null;
|
|
1634
|
+
onmessage: ((event: WebSocket.MessageEvent) => void) | null;
|
|
1635
|
+
constructor(address: null);
|
|
1636
|
+
constructor(address: string | url_URL, options?: WebSocket.ClientOptions | ClientRequestArgs);
|
|
1637
|
+
constructor(address: string | url_URL, protocols?: string | string[], options?: WebSocket.ClientOptions | ClientRequestArgs);
|
|
1638
|
+
close(code?: number, data?: string | Buffer): void;
|
|
1639
|
+
ping(data?: any, mask?: boolean, cb?: (err: Error) => void): void;
|
|
1640
|
+
pong(data?: any, mask?: boolean, cb?: (err: Error) => void): void;
|
|
1641
|
+
send(data: any, cb?: (err?: Error) => void): void;
|
|
1642
|
+
send(data: any, options: {
|
|
1643
|
+
mask?: boolean | undefined;
|
|
1644
|
+
binary?: boolean | undefined;
|
|
1645
|
+
compress?: boolean | undefined;
|
|
1646
|
+
fin?: boolean | undefined;
|
|
1647
|
+
}, cb?: (err?: Error) => void): void;
|
|
1648
|
+
terminate(): void;
|
|
1649
|
+
/**
|
|
1650
|
+
* Pause the websocket causing it to stop emitting events. Some events can still be
|
|
1651
|
+
* emitted after this is called, until all buffered data is consumed. This method
|
|
1652
|
+
* is a noop if the ready state is `CONNECTING` or `CLOSED`.
|
|
1653
|
+
*/
|
|
1654
|
+
pause(): void;
|
|
1655
|
+
/**
|
|
1656
|
+
* Make a paused socket resume emitting events. This method is a noop if the ready
|
|
1657
|
+
* state is `CONNECTING` or `CLOSED`.
|
|
1658
|
+
*/
|
|
1659
|
+
resume(): void;
|
|
1660
|
+
// HTML5 WebSocket events
|
|
1661
|
+
addEventListener(method: 'message', cb: (event: WebSocket.MessageEvent) => void, options?: WebSocket.EventListenerOptions): void;
|
|
1662
|
+
addEventListener(method: 'close', cb: (event: WebSocket.CloseEvent) => void, options?: WebSocket.EventListenerOptions): void;
|
|
1663
|
+
addEventListener(method: 'error', cb: (event: WebSocket.ErrorEvent) => void, options?: WebSocket.EventListenerOptions): void;
|
|
1664
|
+
addEventListener(method: 'open', cb: (event: WebSocket.Event) => void, options?: WebSocket.EventListenerOptions): void;
|
|
1665
|
+
removeEventListener(method: 'message', cb: (event: WebSocket.MessageEvent) => void): void;
|
|
1666
|
+
removeEventListener(method: 'close', cb: (event: WebSocket.CloseEvent) => void): void;
|
|
1667
|
+
removeEventListener(method: 'error', cb: (event: WebSocket.ErrorEvent) => void): void;
|
|
1668
|
+
removeEventListener(method: 'open', cb: (event: WebSocket.Event) => void): void;
|
|
1669
|
+
// Events
|
|
1670
|
+
on(event: 'close', listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
|
|
1671
|
+
on(event: 'error', listener: (this: WebSocket, err: Error) => void): this;
|
|
1672
|
+
on(event: 'upgrade', listener: (this: WebSocket, request: http.IncomingMessage) => void): this;
|
|
1673
|
+
on(event: 'message', listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this;
|
|
1382
1674
|
on(event: 'open', listener: (this: WebSocket) => void): this;
|
|
1383
1675
|
on(event: 'ping' | 'pong', listener: (this: WebSocket, data: Buffer) => void): this;
|
|
1384
1676
|
on(event: 'unexpected-response', listener: (this: WebSocket, request: ClientRequest, response: http.IncomingMessage) => void): this;
|
|
@@ -1620,58 +1912,6 @@ interface WebSocketClient extends NormalizedHotChannelClient {
|
|
|
1620
1912
|
socket: WebSocket;
|
|
1621
1913
|
}
|
|
1622
1914
|
//#endregion
|
|
1623
|
-
//#region src/node/server/bundledDev.d.ts
|
|
1624
|
-
type MemoryFile = {
|
|
1625
|
-
source: string | Uint8Array;
|
|
1626
|
-
etag?: string;
|
|
1627
|
-
};
|
|
1628
|
-
declare class MemoryFiles {
|
|
1629
|
-
private files;
|
|
1630
|
-
get size(): number;
|
|
1631
|
-
get(file: string): MemoryFile | undefined;
|
|
1632
|
-
set(file: string, content: MemoryFile | (() => MemoryFile)): void;
|
|
1633
|
-
has(file: string): boolean;
|
|
1634
|
-
clear(): void;
|
|
1635
|
-
}
|
|
1636
|
-
declare class BundledDev {
|
|
1637
|
-
private environment;
|
|
1638
|
-
private _devEngine;
|
|
1639
|
-
private viteRuntime?;
|
|
1640
|
-
private initialBuildCompleted;
|
|
1641
|
-
private _closed;
|
|
1642
|
-
private clients;
|
|
1643
|
-
private debouncedFullReload;
|
|
1644
|
-
private fullReloadPending;
|
|
1645
|
-
private reloadNeededClientIds;
|
|
1646
|
-
private debouncedReloadNeededFlush;
|
|
1647
|
-
private lastBuildError;
|
|
1648
|
-
memoryFiles: MemoryFiles;
|
|
1649
|
-
constructor(environment: DevEnvironment);
|
|
1650
|
-
private get devEngine();
|
|
1651
|
-
private pendingPayloadFilenames;
|
|
1652
|
-
get hasBuildOutput(): boolean;
|
|
1653
|
-
listen(): Promise<void>;
|
|
1654
|
-
private waitForInitialBuildFinish;
|
|
1655
|
-
private ensureOutputAndFlushReloadNeeded;
|
|
1656
|
-
triggerBundleRegenerationIfStale(): Promise<boolean>;
|
|
1657
|
-
triggerLazyBundling(moduleId: string | null, clientId: string | null): Promise<{
|
|
1658
|
-
code: string;
|
|
1659
|
-
filename: string;
|
|
1660
|
-
} | undefined>;
|
|
1661
|
-
/**
|
|
1662
|
-
* Called by the serving middlewares when the response for a payload completed.
|
|
1663
|
-
* Only delivered payloads are recorded on the server's per-client ship map, so
|
|
1664
|
-
* later chunks may omit a module only if the payload carrying it was delivered.
|
|
1665
|
-
*
|
|
1666
|
-
* Note: the payload filename is unique across all clients.
|
|
1667
|
-
*/
|
|
1668
|
-
markPayloadDelivered(filename: string): void;
|
|
1669
|
-
close(): Promise<void>;
|
|
1670
|
-
private storeOutputFiles;
|
|
1671
|
-
private getRolldownOptions;
|
|
1672
|
-
private handleHmrOutput;
|
|
1673
|
-
}
|
|
1674
|
-
//#endregion
|
|
1675
1915
|
//#region src/node/server/environment.d.ts
|
|
1676
1916
|
interface DevEnvironmentContext {
|
|
1677
1917
|
hot: boolean;
|
|
@@ -1682,7 +1922,7 @@ interface DevEnvironmentContext {
|
|
|
1682
1922
|
};
|
|
1683
1923
|
depsOptimizer?: DepsOptimizer;
|
|
1684
1924
|
}
|
|
1685
|
-
declare class DevEnvironment extends BaseEnvironment {
|
|
1925
|
+
export declare class DevEnvironment extends BaseEnvironment {
|
|
1686
1926
|
mode: "dev";
|
|
1687
1927
|
moduleGraph: EnvironmentModuleGraph;
|
|
1688
1928
|
depsOptimizer?: DepsOptimizer;
|
|
@@ -1740,1369 +1980,1197 @@ declare class DevEnvironment extends BaseEnvironment {
|
|
|
1740
1980
|
waitForRequestsIdle(ignoredId?: string): Promise<void>;
|
|
1741
1981
|
}
|
|
1742
1982
|
//#endregion
|
|
1743
|
-
//#region src/
|
|
1744
|
-
|
|
1745
|
-
|
|
1983
|
+
//#region src/node/optimizer/scan.d.ts
|
|
1984
|
+
declare class ScanEnvironment extends BaseEnvironment {
|
|
1985
|
+
mode: "scan";
|
|
1986
|
+
get pluginContainer(): EnvironmentPluginContainer;
|
|
1987
|
+
init(): Promise<void>;
|
|
1988
|
+
}
|
|
1989
|
+
//#endregion
|
|
1990
|
+
//#region src/node/environment.d.ts
|
|
1991
|
+
type Environment = DevEnvironment | BuildEnvironment | ScanEnvironment | UnknownEnvironment;
|
|
1992
|
+
/**
|
|
1993
|
+
* Creates a function that hides the complexities of a WeakMap with an initial value
|
|
1994
|
+
* to implement object metadata. Used by plugins to implement cross hooks per
|
|
1995
|
+
* environment metadata
|
|
1996
|
+
*
|
|
1997
|
+
* @experimental
|
|
1998
|
+
*/
|
|
1999
|
+
export declare function perEnvironmentState<State>(initial: (environment: Environment) => State): (context: PluginContext) => State;
|
|
2000
|
+
//#endregion
|
|
2001
|
+
//#region src/node/plugins/html.d.ts
|
|
2002
|
+
interface HtmlTagDescriptor {
|
|
2003
|
+
tag: string;
|
|
1746
2004
|
/**
|
|
1747
|
-
*
|
|
1748
|
-
* the build the plugin should operate on. By default, all files with
|
|
1749
|
-
* extension `".cjs"` or those in `extensions` are included, but you can
|
|
1750
|
-
* narrow this list by only including specific files. These files will be
|
|
1751
|
-
* analyzed and transpiled if either the analysis does not find ES module
|
|
1752
|
-
* specific statements or `transformMixedEsModules` is `true`.
|
|
1753
|
-
* @default undefined
|
|
1754
|
-
*/
|
|
1755
|
-
include?: string | RegExp | readonly (string | RegExp)[];
|
|
1756
|
-
/**
|
|
1757
|
-
* A minimatch pattern, or array of patterns, which specifies the files in
|
|
1758
|
-
* the build the plugin should _ignore_. By default, all files with
|
|
1759
|
-
* extensions other than those in `extensions` or `".cjs"` are ignored, but you
|
|
1760
|
-
* can exclude additional files. See also the `include` option.
|
|
1761
|
-
* @default undefined
|
|
1762
|
-
*/
|
|
1763
|
-
exclude?: string | RegExp | readonly (string | RegExp)[];
|
|
1764
|
-
/**
|
|
1765
|
-
* For extensionless imports, search for extensions other than .js in the
|
|
1766
|
-
* order specified. Note that you need to make sure that non-JavaScript files
|
|
1767
|
-
* are transpiled by another plugin first.
|
|
1768
|
-
* @default [ '.js' ]
|
|
2005
|
+
* attribute values will be escaped automatically if needed
|
|
1769
2006
|
*/
|
|
1770
|
-
|
|
2007
|
+
attrs?: Record<string, string | boolean | undefined>;
|
|
2008
|
+
children?: string | HtmlTagDescriptor[];
|
|
1771
2009
|
/**
|
|
1772
|
-
*
|
|
1773
|
-
* @default false
|
|
2010
|
+
* default: 'head-prepend'
|
|
1774
2011
|
*/
|
|
1775
|
-
|
|
2012
|
+
injectTo?: "head" | "body" | "head-prepend" | "body-prepend";
|
|
2013
|
+
}
|
|
2014
|
+
type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
|
|
2015
|
+
html: string;
|
|
2016
|
+
tags: HtmlTagDescriptor[];
|
|
2017
|
+
};
|
|
2018
|
+
interface IndexHtmlTransformContext {
|
|
1776
2019
|
/**
|
|
1777
|
-
*
|
|
1778
|
-
* improve performance.
|
|
1779
|
-
* @default true
|
|
2020
|
+
* public path when served
|
|
1780
2021
|
*/
|
|
1781
|
-
|
|
2022
|
+
path: string;
|
|
1782
2023
|
/**
|
|
1783
|
-
*
|
|
1784
|
-
* imports.
|
|
1785
|
-
* When this option is set to `false`, the generated code will either
|
|
1786
|
-
* directly throw an error when such a call is encountered or, when
|
|
1787
|
-
* `dynamicRequireTargets` is used, when such a call cannot be resolved with a
|
|
1788
|
-
* configured dynamic require target.
|
|
1789
|
-
* Setting this option to `true` will instead leave the `require` call in the
|
|
1790
|
-
* code or use it as a fallback for `dynamicRequireTargets`.
|
|
1791
|
-
* @default false
|
|
2024
|
+
* filename on disk
|
|
1792
2025
|
*/
|
|
1793
|
-
|
|
2026
|
+
filename: string;
|
|
2027
|
+
server?: ViteDevServer;
|
|
2028
|
+
bundle?: OutputBundle;
|
|
2029
|
+
chunk?: OutputChunk;
|
|
2030
|
+
originalUrl?: string;
|
|
2031
|
+
}
|
|
2032
|
+
type IndexHtmlTransformHook = (this: MinimalPluginContextWithoutEnvironment, html: string, ctx: IndexHtmlTransformContext) => IndexHtmlTransformResult | void | Promise<IndexHtmlTransformResult | void>;
|
|
2033
|
+
type IndexHtmlTransform = IndexHtmlTransformHook | {
|
|
2034
|
+
order?: "pre" | "post" | null;
|
|
2035
|
+
handler: IndexHtmlTransformHook;
|
|
2036
|
+
};
|
|
2037
|
+
//#endregion
|
|
2038
|
+
//#region src/node/plugins/pluginFilter.d.ts
|
|
2039
|
+
type StringFilter<Value = string | RegExp> = Value | Array<Value> | {
|
|
2040
|
+
include?: Value | Array<Value>;
|
|
2041
|
+
exclude?: Value | Array<Value>;
|
|
2042
|
+
};
|
|
2043
|
+
//#endregion
|
|
2044
|
+
//#region src/node/shortcuts.d.ts
|
|
2045
|
+
type BindCLIShortcutsOptions<Server = ViteDevServer | PreviewServer> = {
|
|
1794
2046
|
/**
|
|
1795
|
-
*
|
|
1796
|
-
* is useful in scenarios with modules that contain a mix of ES `import`
|
|
1797
|
-
* statements and CommonJS `require` expressions. Set to `true` if `require`
|
|
1798
|
-
* calls should be transformed to imports in mixed modules, or `false` if the
|
|
1799
|
-
* `require` expressions should survive the transformation. The latter can be
|
|
1800
|
-
* important if the code contains environment detection, or you are coding
|
|
1801
|
-
* for an environment with special treatment for `require` calls such as
|
|
1802
|
-
* ElectronJS. See also the `ignore` option.
|
|
1803
|
-
* @default false
|
|
2047
|
+
* Print a one-line shortcuts "help" hint to the terminal
|
|
1804
2048
|
*/
|
|
1805
|
-
|
|
2049
|
+
print?: boolean;
|
|
1806
2050
|
/**
|
|
1807
|
-
*
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
1810
|
-
* CommonJS semantics as the order of side effects like log statements may
|
|
1811
|
-
* change. But it is especially problematic when there are circular `require`
|
|
1812
|
-
* calls between CommonJS modules as those often rely on the lazy execution of
|
|
1813
|
-
* nested `require` calls.
|
|
1814
|
-
*
|
|
1815
|
-
* Setting this option to `true` will wrap all CommonJS files in functions
|
|
1816
|
-
* which are executed when they are required for the first time, preserving
|
|
1817
|
-
* NodeJS semantics. Note that this can have an impact on the size and
|
|
1818
|
-
* performance of the generated code.
|
|
1819
|
-
*
|
|
1820
|
-
* The default value of `"auto"` will only wrap CommonJS files when they are
|
|
1821
|
-
* part of a CommonJS dependency cycle, e.g. an index file that is required by
|
|
1822
|
-
* many of its dependencies. All other CommonJS files are hoisted. This is the
|
|
1823
|
-
* recommended setting for most code bases.
|
|
1824
|
-
*
|
|
1825
|
-
* `false` will entirely prevent wrapping and hoist all files. This may still
|
|
1826
|
-
* work depending on the nature of cyclic dependencies but will often cause
|
|
1827
|
-
* problems.
|
|
1828
|
-
*
|
|
1829
|
-
* You can also provide a minimatch pattern, or array of patterns, to only
|
|
1830
|
-
* specify a subset of files which should be wrapped in functions for proper
|
|
1831
|
-
* `require` semantics.
|
|
1832
|
-
*
|
|
1833
|
-
* `"debug"` works like `"auto"` but after bundling, it will display a warning
|
|
1834
|
-
* containing a list of ids that have been wrapped which can be used as
|
|
1835
|
-
* minimatch pattern for fine-tuning.
|
|
1836
|
-
* @default "auto"
|
|
2051
|
+
* Custom shortcuts to run when a key is pressed. These shortcuts take priority
|
|
2052
|
+
* over the default shortcuts if they have the same keys (except the `h` key).
|
|
2053
|
+
* To disable a default shortcut, define the same key but with `action: undefined`.
|
|
1837
2054
|
*/
|
|
1838
|
-
|
|
2055
|
+
customShortcuts?: CLIShortcut<Server>[];
|
|
2056
|
+
};
|
|
2057
|
+
type CLIShortcut<Server = ViteDevServer | PreviewServer> = {
|
|
2058
|
+
key: string;
|
|
2059
|
+
description: string;
|
|
2060
|
+
action?(server: Server): void | Promise<void>;
|
|
2061
|
+
};
|
|
2062
|
+
//#endregion
|
|
2063
|
+
//#region src/node/typeUtils.d.ts
|
|
2064
|
+
type RequiredExceptFor<T, K extends keyof T> = Pick<T, K> & Required<Omit<T, K>>;
|
|
2065
|
+
//#endregion
|
|
2066
|
+
//#region src/node/preview.d.ts
|
|
2067
|
+
interface PreviewOptions extends CommonServerOptions {}
|
|
2068
|
+
interface ResolvedPreviewOptions extends RequiredExceptFor<PreviewOptions, "host" | "https" | "proxy"> {}
|
|
2069
|
+
interface PreviewServer {
|
|
1839
2070
|
/**
|
|
1840
|
-
*
|
|
1841
|
-
* containing the IDs or a `id => boolean` function.
|
|
1842
|
-
* @default []
|
|
2071
|
+
* The resolved vite config object
|
|
1843
2072
|
*/
|
|
1844
|
-
|
|
2073
|
+
config: ResolvedConfig;
|
|
1845
2074
|
/**
|
|
1846
|
-
*
|
|
1847
|
-
* they should be left unconverted as it requires an optional dependency
|
|
1848
|
-
* that may or may not be installed beside the rolled up package.
|
|
1849
|
-
* Due to the conversion of `require` to a static `import` - the call is
|
|
1850
|
-
* hoisted to the top of the file, outside the `try-catch` clause.
|
|
1851
|
-
*
|
|
1852
|
-
* - `true`: Default. All `require` calls inside a `try` will be left unconverted.
|
|
1853
|
-
* - `false`: All `require` calls inside a `try` will be converted as if the
|
|
1854
|
-
* `try-catch` clause is not there.
|
|
1855
|
-
* - `remove`: Remove all `require` calls from inside any `try` block.
|
|
1856
|
-
* - `string[]`: Pass an array containing the IDs to left unconverted.
|
|
1857
|
-
* - `((id: string) => boolean|'remove')`: Pass a function that controls
|
|
1858
|
-
* individual IDs.
|
|
1859
|
-
*
|
|
1860
|
-
* @default true
|
|
2075
|
+
* Stop the server.
|
|
1861
2076
|
*/
|
|
1862
|
-
|
|
2077
|
+
close(): Promise<void>;
|
|
1863
2078
|
/**
|
|
1864
|
-
*
|
|
1865
|
-
*
|
|
1866
|
-
*
|
|
1867
|
-
*
|
|
1868
|
-
* dependency.
|
|
1869
|
-
*
|
|
1870
|
-
* If you set `esmExternals` to `true`, this plugin assumes that all
|
|
1871
|
-
* external dependencies are ES modules and respect the
|
|
1872
|
-
* `requireReturnsDefault` option. If that option is not set, they will be
|
|
1873
|
-
* rendered as namespace imports.
|
|
2079
|
+
* A connect app instance.
|
|
2080
|
+
* - Can be used to attach custom middlewares to the preview server.
|
|
2081
|
+
* - Can also be used as the handler function of a custom http server
|
|
2082
|
+
* or as a middleware in any connect-style Node.js frameworks
|
|
1874
2083
|
*
|
|
1875
|
-
*
|
|
1876
|
-
* function that will be passed each external id to determine whether it is
|
|
1877
|
-
* an ES module.
|
|
1878
|
-
* @default false
|
|
2084
|
+
* https://github.com/senchalabs/connect#use-middleware
|
|
1879
2085
|
*/
|
|
1880
|
-
|
|
2086
|
+
middlewares: Connect.Server;
|
|
1881
2087
|
/**
|
|
1882
|
-
*
|
|
1883
|
-
* When using the `esmExternals` option, this will also apply to external
|
|
1884
|
-
* modules. By default, this plugin will render those imports as namespace
|
|
1885
|
-
* imports i.e.
|
|
1886
|
-
*
|
|
1887
|
-
* ```js
|
|
1888
|
-
* // input
|
|
1889
|
-
* const foo = require('foo');
|
|
1890
|
-
*
|
|
1891
|
-
* // output
|
|
1892
|
-
* import * as foo from 'foo';
|
|
1893
|
-
* ```
|
|
1894
|
-
*
|
|
1895
|
-
* However, there are some situations where this may not be desired.
|
|
1896
|
-
* For these situations, you can change Rollup's behaviour either globally or
|
|
1897
|
-
* per module. To change it globally, set the `requireReturnsDefault` option
|
|
1898
|
-
* to one of the following values:
|
|
1899
|
-
*
|
|
1900
|
-
* - `false`: This is the default, requiring an ES module returns its
|
|
1901
|
-
* namespace. This is the only option that will also add a marker
|
|
1902
|
-
* `__esModule: true` to the namespace to support interop patterns in
|
|
1903
|
-
* CommonJS modules that are transpiled ES modules.
|
|
1904
|
-
* - `"namespace"`: Like `false`, requiring an ES module returns its
|
|
1905
|
-
* namespace, but the plugin does not add the `__esModule` marker and thus
|
|
1906
|
-
* creates more efficient code. For external dependencies when using
|
|
1907
|
-
* `esmExternals: true`, no additional interop code is generated.
|
|
1908
|
-
* - `"auto"`: This is complementary to how `output.exports: "auto"` works in
|
|
1909
|
-
* Rollup: If a module has a default export and no named exports, requiring
|
|
1910
|
-
* that module returns the default export. In all other cases, the namespace
|
|
1911
|
-
* is returned. For external dependencies when using `esmExternals: true`, a
|
|
1912
|
-
* corresponding interop helper is added.
|
|
1913
|
-
* - `"preferred"`: If a module has a default export, requiring that module
|
|
1914
|
-
* always returns the default export, no matter whether additional named
|
|
1915
|
-
* exports exist. This is similar to how previous versions of this plugin
|
|
1916
|
-
* worked. Again for external dependencies when using `esmExternals: true`,
|
|
1917
|
-
* an interop helper is added.
|
|
1918
|
-
* - `true`: This will always try to return the default export on require
|
|
1919
|
-
* without checking if it actually exists. This can throw at build time if
|
|
1920
|
-
* there is no default export. This is how external dependencies are handled
|
|
1921
|
-
* when `esmExternals` is not used. The advantage over the other options is
|
|
1922
|
-
* that, like `false`, this does not add an interop helper for external
|
|
1923
|
-
* dependencies, keeping the code lean.
|
|
1924
|
-
*
|
|
1925
|
-
* To change this for individual modules, you can supply a function for
|
|
1926
|
-
* `requireReturnsDefault` instead. This function will then be called once for
|
|
1927
|
-
* each required ES module or external dependency with the corresponding id
|
|
1928
|
-
* and allows you to return different values for different modules.
|
|
1929
|
-
* @default false
|
|
2088
|
+
* native Node http server instance
|
|
1930
2089
|
*/
|
|
1931
|
-
|
|
2090
|
+
httpServer: HttpServer;
|
|
1932
2091
|
/**
|
|
1933
|
-
*
|
|
2092
|
+
* The resolved urls Vite prints on the CLI (URL-encoded). Returns `null`
|
|
2093
|
+
* if the server is not listening on any port.
|
|
1934
2094
|
*/
|
|
1935
|
-
|
|
2095
|
+
resolvedUrls: ResolvedServerUrls | null;
|
|
1936
2096
|
/**
|
|
1937
|
-
*
|
|
1938
|
-
* contain circular dependencies, which are not handled well by static
|
|
1939
|
-
* imports. Including those modules as `dynamicRequireTargets` will simulate a
|
|
1940
|
-
* CommonJS (NodeJS-like) environment for them with support for dynamic
|
|
1941
|
-
* dependencies. It also enables `strictRequires` for those modules.
|
|
1942
|
-
*
|
|
1943
|
-
* Note: In extreme cases, this feature may result in some paths being
|
|
1944
|
-
* rendered as absolute in the final bundle. The plugin tries to avoid
|
|
1945
|
-
* exposing paths from the local machine, but if you are `dynamicRequirePaths`
|
|
1946
|
-
* with paths that are far away from your project's folder, that may require
|
|
1947
|
-
* replacing strings like `"/Users/John/Desktop/foo-project/"` -\> `"/"`.
|
|
2097
|
+
* Print server urls
|
|
1948
2098
|
*/
|
|
1949
|
-
|
|
2099
|
+
printUrls(): void;
|
|
1950
2100
|
/**
|
|
1951
|
-
*
|
|
1952
|
-
* that is a common parent for all files that use dynamic require statements. Using a directory higher up such as `/`
|
|
1953
|
-
* may lead to unnecessarily long paths in the generated code and may expose directory names on your machine like your
|
|
1954
|
-
* home directory name. By default, it uses the current working directory.
|
|
2101
|
+
* Bind CLI shortcuts
|
|
1955
2102
|
*/
|
|
1956
|
-
|
|
2103
|
+
bindCLIShortcuts(options?: BindCLIShortcutsOptions<PreviewServer>): void;
|
|
1957
2104
|
}
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
2105
|
+
type PreviewServerHook = (this: MinimalPluginContextWithoutEnvironment, server: PreviewServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
2106
|
+
type ClosePreviewServerHook = (this: MinimalPluginContextWithoutEnvironment) => void | Promise<void>;
|
|
2107
|
+
/**
|
|
2108
|
+
* Starts the Vite server in preview mode, to simulate a production deployment
|
|
2109
|
+
*/
|
|
2110
|
+
export declare function preview(inlineConfig?: InlineConfig): Promise<PreviewServer>;
|
|
2111
|
+
//#endregion
|
|
2112
|
+
//#region src/node/plugin.d.ts
|
|
2113
|
+
/**
|
|
2114
|
+
* Vite plugins extends the Rollup plugin interface with a few extra
|
|
2115
|
+
* vite-specific options. A valid vite plugin is also a valid Rollup plugin.
|
|
2116
|
+
* On the contrary, a Rollup plugin may or may NOT be a valid vite universal
|
|
2117
|
+
* plugin, since some Rollup features do not make sense in an unbundled
|
|
2118
|
+
* dev server context. That said, as long as a rollup plugin doesn't have strong
|
|
2119
|
+
* coupling between its bundle phase and output phase hooks then it should
|
|
2120
|
+
* just work (that means, most of them).
|
|
2121
|
+
*
|
|
2122
|
+
* By default, the plugins are run during both serve and build. When a plugin
|
|
2123
|
+
* is applied during serve, it will only run **non output plugin hooks** (see
|
|
2124
|
+
* rollup type definition of {@link rollup#PluginHooks}). You can think of the
|
|
2125
|
+
* dev server as only running `const bundle = rollup.rollup()` but never calling
|
|
2126
|
+
* `bundle.generate()`.
|
|
2127
|
+
*
|
|
2128
|
+
* A plugin that expects to have different behavior depending on serve/build can
|
|
2129
|
+
* export a factory function that receives the command being run via options.
|
|
2130
|
+
*
|
|
2131
|
+
* If a plugin should be applied only for server or build, a function format
|
|
2132
|
+
* config file can be used to conditional determine the plugins to use.
|
|
2133
|
+
*
|
|
2134
|
+
* The current environment can be accessed from the context for the all non-global
|
|
2135
|
+
* hooks (it is not available in config, configResolved, configureServer, etc).
|
|
2136
|
+
* It can be a dev, build, or scan environment.
|
|
2137
|
+
* Plugins can use this.environment.mode === 'dev' to guard for dev specific APIs.
|
|
2138
|
+
*/
|
|
2139
|
+
interface PluginContextExtension {
|
|
1971
2140
|
/**
|
|
1972
|
-
*
|
|
2141
|
+
* Vite-specific environment instance
|
|
1973
2142
|
*/
|
|
1974
|
-
|
|
2143
|
+
environment: Environment;
|
|
1975
2144
|
}
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
2145
|
+
interface PluginContextMetaExtension {
|
|
2146
|
+
viteVersion: string;
|
|
2147
|
+
}
|
|
2148
|
+
interface ConfigPluginContext extends Omit<MinimalPluginContext, "meta" | "environment"> {
|
|
2149
|
+
meta: Omit<PluginContextMeta, "watchMode">;
|
|
2150
|
+
}
|
|
2151
|
+
interface MinimalPluginContextWithoutEnvironment extends Omit<MinimalPluginContext, "environment"> {}
|
|
2152
|
+
declare module "rolldown" {
|
|
2153
|
+
interface MinimalPluginContext extends PluginContextExtension {}
|
|
2154
|
+
interface PluginContextMeta extends PluginContextMetaExtension {}
|
|
2155
|
+
}
|
|
2156
|
+
/**
|
|
2157
|
+
* There are two types of plugins in Vite. App plugins and environment plugins.
|
|
2158
|
+
* Environment Plugins are defined by a constructor function that will be called
|
|
2159
|
+
* once per each environment allowing users to have completely different plugins
|
|
2160
|
+
* for each of them. The constructor gets the resolved environment after the server
|
|
2161
|
+
* and builder has already been created simplifying config access and cache
|
|
2162
|
+
* management for environment specific plugins.
|
|
2163
|
+
* Environment Plugins are closer to regular rollup plugins. They can't define
|
|
2164
|
+
* app level hooks (like config, configResolved, configureServer, etc).
|
|
2165
|
+
*/
|
|
2166
|
+
interface Plugin<A = any> extends Rolldown.Plugin<A> {
|
|
1979
2167
|
/**
|
|
1980
|
-
*
|
|
1981
|
-
*
|
|
2168
|
+
* Perform custom handling of HMR updates.
|
|
2169
|
+
* The handler receives an options containing changed filename, timestamp, a
|
|
2170
|
+
* list of modules affected by the file change, and the dev server instance.
|
|
1982
2171
|
*
|
|
1983
|
-
*
|
|
2172
|
+
* - The hook can return a filtered list of modules to narrow down the update.
|
|
2173
|
+
* e.g. for a Vue SFC, we can narrow down the part to update by comparing
|
|
2174
|
+
* the descriptors.
|
|
2175
|
+
*
|
|
2176
|
+
* - The hook can also return an empty array and then perform custom updates
|
|
2177
|
+
* by sending a custom hmr payload via environment.hot.send().
|
|
2178
|
+
*
|
|
2179
|
+
* - If the hook doesn't return a value, the hmr update will be performed as
|
|
2180
|
+
* normal.
|
|
1984
2181
|
*/
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
//#region src/node/plugins/resolve.d.ts
|
|
1989
|
-
interface EnvironmentResolveOptions {
|
|
2182
|
+
hotUpdate?: ObjectHook<(this: MinimalPluginContext & {
|
|
2183
|
+
environment: DevEnvironment;
|
|
2184
|
+
}, options: HotUpdateOptions) => Array<EnvironmentModuleNode> | void | Promise<Array<EnvironmentModuleNode> | void>>;
|
|
1990
2185
|
/**
|
|
1991
|
-
*
|
|
2186
|
+
* extend hooks with ssr flag
|
|
1992
2187
|
*/
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
2188
|
+
resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: {
|
|
2189
|
+
kind?: ImportKind;
|
|
2190
|
+
custom?: CustomPluginOptions;
|
|
2191
|
+
ssr?: boolean | undefined;
|
|
2192
|
+
|
|
2193
|
+
isEntry: boolean;
|
|
2194
|
+
}) => Promise<ResolveIdResult> | ResolveIdResult, {
|
|
2195
|
+
filter?: {
|
|
2196
|
+
id?: StringFilter<RegExp>;
|
|
2197
|
+
};
|
|
2198
|
+
}>;
|
|
2199
|
+
load?: ObjectHook<(this: PluginContext, id: string, options?: {
|
|
2200
|
+
ssr?: boolean | undefined;
|
|
2201
|
+
}) => Promise<LoadResult> | LoadResult, {
|
|
2202
|
+
filter?: {
|
|
2203
|
+
id?: StringFilter;
|
|
2204
|
+
};
|
|
2205
|
+
}>;
|
|
2206
|
+
transform?: ObjectHook<(this: TransformPluginContext, code: string, id: string, options?: {
|
|
2207
|
+
moduleType: ModuleType;
|
|
2208
|
+
ssr?: boolean | undefined;
|
|
2209
|
+
}) => Promise<Rolldown.TransformResult> | Rolldown.TransformResult, {
|
|
2210
|
+
filter?: {
|
|
2211
|
+
id?: StringFilter;
|
|
2212
|
+
code?: StringFilter;
|
|
2213
|
+
moduleType?: ModuleTypeFilter;
|
|
2214
|
+
};
|
|
2215
|
+
}>;
|
|
1996
2216
|
/**
|
|
1997
|
-
*
|
|
2217
|
+
* Opt-in this plugin into the shared plugins pipeline.
|
|
2218
|
+
* For backward-compatibility, plugins are re-recreated for each environment
|
|
2219
|
+
* during `vite build --app`
|
|
2220
|
+
* We have an opt-in per plugin, and a general `builder.sharedPlugins`
|
|
2221
|
+
* In a future major, we'll flip the default to be shared by default
|
|
2222
|
+
* @experimental
|
|
1998
2223
|
*/
|
|
1999
|
-
|
|
2000
|
-
dedupe?: string[];
|
|
2224
|
+
sharedDuringBuild?: boolean;
|
|
2001
2225
|
/**
|
|
2002
|
-
*
|
|
2003
|
-
*
|
|
2226
|
+
* Opt-in this plugin into per-environment buildStart and buildEnd during dev.
|
|
2227
|
+
* For backward-compatibility, the buildStart hook is called only once during
|
|
2228
|
+
* dev, for the client environment. Plugins can opt-in to be called
|
|
2229
|
+
* per-environment, aligning with the build hook behavior.
|
|
2004
2230
|
* @experimental
|
|
2005
2231
|
*/
|
|
2006
|
-
|
|
2232
|
+
perEnvironmentStartEndDuringDev?: boolean;
|
|
2007
2233
|
/**
|
|
2008
|
-
*
|
|
2009
|
-
*
|
|
2234
|
+
* Opt-in this plugin into per-environment watchChange during dev.
|
|
2235
|
+
* For backward-compatibility, the watchChange hook is called only once during
|
|
2236
|
+
* dev, for the client environment. Plugins can opt-in to be called
|
|
2237
|
+
* per-environment, aligning with the watchChange hook behavior.
|
|
2010
2238
|
* @experimental
|
|
2011
2239
|
*/
|
|
2012
|
-
|
|
2240
|
+
perEnvironmentWatchChangeDuringDev?: boolean;
|
|
2013
2241
|
/**
|
|
2014
|
-
*
|
|
2242
|
+
* Enforce plugin invocation tier similar to webpack loaders. Hooks ordering
|
|
2243
|
+
* is still subject to the `order` property in the hook object.
|
|
2244
|
+
*
|
|
2245
|
+
* Plugin invocation order:
|
|
2246
|
+
* - alias resolution
|
|
2247
|
+
* - `enforce: 'pre'` plugins
|
|
2248
|
+
* - vite core plugins
|
|
2249
|
+
* - normal plugins
|
|
2250
|
+
* - vite build plugins
|
|
2251
|
+
* - `enforce: 'post'` plugins
|
|
2252
|
+
* - vite build post plugins
|
|
2015
2253
|
*/
|
|
2016
|
-
|
|
2017
|
-
}
|
|
2018
|
-
interface ResolveOptions extends EnvironmentResolveOptions {
|
|
2254
|
+
enforce?: "pre" | "post";
|
|
2019
2255
|
/**
|
|
2020
|
-
*
|
|
2256
|
+
* Apply the plugin only for serve or build, or on certain conditions.
|
|
2021
2257
|
*/
|
|
2022
|
-
|
|
2258
|
+
apply?: "serve" | "build" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean);
|
|
2023
2259
|
/**
|
|
2024
|
-
*
|
|
2025
|
-
*
|
|
2026
|
-
* @
|
|
2260
|
+
* Define environments where this plugin should be active
|
|
2261
|
+
* By default, the plugin is active in all environments
|
|
2262
|
+
* @experimental
|
|
2027
2263
|
*/
|
|
2028
|
-
|
|
2029
|
-
}
|
|
2030
|
-
interface ResolvePluginOptions {
|
|
2031
|
-
root: string;
|
|
2032
|
-
isBuild: boolean;
|
|
2033
|
-
isProduction: boolean;
|
|
2034
|
-
packageCache?: PackageCache;
|
|
2264
|
+
applyToEnvironment?: (environment: PartialEnvironment) => boolean | Promise<boolean> | PluginOption;
|
|
2035
2265
|
/**
|
|
2036
|
-
*
|
|
2037
|
-
* -
|
|
2038
|
-
*
|
|
2266
|
+
* Modify vite config before it's resolved. The hook can either mutate the
|
|
2267
|
+
* passed-in config directly, or return a partial config object that will be
|
|
2268
|
+
* deeply merged into existing config.
|
|
2269
|
+
*
|
|
2270
|
+
* Note: User plugins are resolved before running this hook so injecting other
|
|
2271
|
+
* plugins inside the `config` hook will have no effect.
|
|
2039
2272
|
*/
|
|
2040
|
-
|
|
2041
|
-
tryIndex?: boolean;
|
|
2042
|
-
tryPrefix?: string;
|
|
2043
|
-
preferRelative?: boolean;
|
|
2044
|
-
isRequire?: boolean;
|
|
2045
|
-
scan?: boolean;
|
|
2273
|
+
config?: ObjectHook<(this: ConfigPluginContext, config: UserConfig, env: ConfigEnv) => Omit<UserConfig, "plugins"> | null | void | Promise<Omit<UserConfig, "plugins"> | null | void>>;
|
|
2046
2274
|
/**
|
|
2047
|
-
*
|
|
2275
|
+
* Modify environment configs before it's resolved. The hook can either mutate the
|
|
2276
|
+
* passed-in environment config directly, or return a partial config object that will be
|
|
2277
|
+
* deeply merged into existing config.
|
|
2278
|
+
* This hook is called for each environment with a partially resolved environment config
|
|
2279
|
+
* that already accounts for the default environment config values set at the root level.
|
|
2280
|
+
* If plugins need to modify the config of a given environment, they should do it in this
|
|
2281
|
+
* hook instead of the config hook. Leaving the config hook only for modifying the root
|
|
2282
|
+
* default environment config.
|
|
2048
2283
|
*/
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
interface PackageData {
|
|
2057
|
-
dir: string;
|
|
2058
|
-
hasSideEffects: (id: string) => boolean | "no-treeshake" | null;
|
|
2059
|
-
setResolvedCache: (key: string, entry: string, options: InternalResolveOptions) => void;
|
|
2060
|
-
getResolvedCache: (key: string, options: InternalResolveOptions) => string | undefined;
|
|
2061
|
-
data: {
|
|
2062
|
-
[field: string]: any;
|
|
2063
|
-
name: string;
|
|
2064
|
-
type: string;
|
|
2065
|
-
version: string;
|
|
2066
|
-
main: string;
|
|
2067
|
-
module: string;
|
|
2068
|
-
browser: string | Record<string, string | false>;
|
|
2069
|
-
exports: string | Record<string, any> | string[];
|
|
2070
|
-
imports: Record<string, any>;
|
|
2071
|
-
dependencies: Record<string, string>;
|
|
2072
|
-
};
|
|
2073
|
-
}
|
|
2074
|
-
//#endregion
|
|
2075
|
-
//#region src/node/plugins/license.d.ts
|
|
2076
|
-
interface LicenseOptions {
|
|
2284
|
+
configEnvironment?: ObjectHook<(this: ConfigPluginContext, name: string, config: EnvironmentOptions, env: ConfigEnv & {
|
|
2285
|
+
/**
|
|
2286
|
+
* Whether this environment is SSR environment and `ssr.target` is set to `'webworker'`.
|
|
2287
|
+
* Only intended to be used for backward compatibility.
|
|
2288
|
+
*/
|
|
2289
|
+
isSsrTargetWebworker?: boolean;
|
|
2290
|
+
}) => EnvironmentOptions | null | void | Promise<EnvironmentOptions | null | void>>;
|
|
2077
2291
|
/**
|
|
2078
|
-
*
|
|
2079
|
-
* Specify a path that ends with `.json` to output the raw JSON metadata.
|
|
2080
|
-
*
|
|
2081
|
-
* @default '.vite/license.md'
|
|
2292
|
+
* Use this hook to read and store the final resolved vite config.
|
|
2082
2293
|
*/
|
|
2083
|
-
|
|
2084
|
-
}
|
|
2085
|
-
//#endregion
|
|
2086
|
-
//#region src/node/build.d.ts
|
|
2087
|
-
interface BuildEnvironmentOptions {
|
|
2294
|
+
configResolved?: ObjectHook<(this: MinimalPluginContextWithoutEnvironment, config: ResolvedConfig) => void | Promise<void>>;
|
|
2088
2295
|
/**
|
|
2089
|
-
*
|
|
2090
|
-
*
|
|
2091
|
-
*
|
|
2092
|
-
*
|
|
2093
|
-
* Default: 'baseline-widely-available' - transpile targeting browsers that
|
|
2094
|
-
* are included in the Baseline Widely Available on 2026-01-01.
|
|
2095
|
-
* (Chrome 111+, Edge 111+, Firefox 114+, Safari 16.4+).
|
|
2096
|
-
*
|
|
2097
|
-
* Another special value is 'esnext' - which only performs minimal transpiling
|
|
2098
|
-
* (for minification compat).
|
|
2296
|
+
* Configure the vite server. The hook receives the {@link ViteDevServer}
|
|
2297
|
+
* instance. This can also be used to store a reference to the server
|
|
2298
|
+
* for use in other hooks.
|
|
2099
2299
|
*
|
|
2100
|
-
*
|
|
2101
|
-
*
|
|
2102
|
-
*
|
|
2300
|
+
* The hooks will be called before internal middlewares are applied. A hook
|
|
2301
|
+
* can return a post hook that will be called after internal middlewares
|
|
2302
|
+
* are applied. Hook can be async functions and will be called in series.
|
|
2103
2303
|
*/
|
|
2104
|
-
|
|
2304
|
+
configureServer?: ObjectHook<ServerHook>;
|
|
2105
2305
|
/**
|
|
2106
|
-
*
|
|
2107
|
-
*
|
|
2108
|
-
*
|
|
2109
|
-
*
|
|
2306
|
+
* Configure the preview server. The hook receives the {@link PreviewServer}
|
|
2307
|
+
* instance. This can also be used to store a reference to the server
|
|
2308
|
+
* for use in other hooks.
|
|
2309
|
+
*
|
|
2310
|
+
* The hooks are called before other middlewares are applied. A hook can
|
|
2311
|
+
* return a post hook that will be called after other middlewares are
|
|
2312
|
+
* applied. Hooks can be async functions and will be called in series.
|
|
2110
2313
|
*/
|
|
2111
|
-
|
|
2314
|
+
configurePreviewServer?: ObjectHook<PreviewServerHook>;
|
|
2112
2315
|
/**
|
|
2113
|
-
*
|
|
2114
|
-
*
|
|
2115
|
-
*
|
|
2316
|
+
* Run logic when the server is restarted or closed. The hook receives a
|
|
2317
|
+
* `reason` that is `'restart'` when the server is restarting and `'close'`
|
|
2318
|
+
* when it is closing.
|
|
2319
|
+
*
|
|
2320
|
+
* The hooks are called after the server is torn down. Hooks can be async
|
|
2321
|
+
* functions and will be called in parallel.
|
|
2116
2322
|
*/
|
|
2117
|
-
|
|
2323
|
+
closeServer?: ObjectHook<CloseServerHook>;
|
|
2118
2324
|
/**
|
|
2119
|
-
*
|
|
2120
|
-
*
|
|
2121
|
-
* @default 'dist'
|
|
2325
|
+
* Same as `closeServer` but for the preview server. The preview server never
|
|
2326
|
+
* restarts, so no `reason` is provided.
|
|
2122
2327
|
*/
|
|
2123
|
-
|
|
2328
|
+
closePreviewServer?: ObjectHook<ClosePreviewServerHook>;
|
|
2124
2329
|
/**
|
|
2125
|
-
*
|
|
2126
|
-
*
|
|
2127
|
-
*
|
|
2330
|
+
* Transform index.html.
|
|
2331
|
+
* The hook receives the following arguments:
|
|
2332
|
+
*
|
|
2333
|
+
* - html: string
|
|
2334
|
+
* - ctx: IndexHtmlTransformContext, which contains:
|
|
2335
|
+
* - path: public path when served
|
|
2336
|
+
* - filename: filename on disk
|
|
2337
|
+
* - server?: ViteDevServer (only present during serve)
|
|
2338
|
+
* - bundle?: rollup.OutputBundle (only present during build)
|
|
2339
|
+
* - chunk?: rollup.OutputChunk
|
|
2340
|
+
* - originalUrl?: string
|
|
2341
|
+
*
|
|
2342
|
+
* It can either return a transformed string, or a list of html tag
|
|
2343
|
+
* descriptors that will be injected into the `<head>` or `<body>`.
|
|
2344
|
+
*
|
|
2345
|
+
* By default the transform is applied **after** vite's internal html
|
|
2346
|
+
* transform. If you need to apply the transform before vite, use an object:
|
|
2347
|
+
* `{ order: 'pre', handler: hook }`
|
|
2128
2348
|
*/
|
|
2129
|
-
|
|
2349
|
+
transformIndexHtml?: IndexHtmlTransform;
|
|
2130
2350
|
/**
|
|
2131
|
-
*
|
|
2132
|
-
* base64 strings. If a callback is passed, a boolean can be returned to opt-in
|
|
2133
|
-
* or opt-out of inlining. If nothing is returned the default logic applies.
|
|
2351
|
+
* Build Environments
|
|
2134
2352
|
*
|
|
2135
|
-
*
|
|
2136
|
-
* @default 4096
|
|
2353
|
+
* @experimental
|
|
2137
2354
|
*/
|
|
2138
|
-
|
|
2355
|
+
buildApp?: ObjectHook<BuildAppHook>;
|
|
2139
2356
|
/**
|
|
2140
|
-
*
|
|
2141
|
-
*
|
|
2142
|
-
*
|
|
2143
|
-
*
|
|
2357
|
+
* Perform custom handling of HMR updates.
|
|
2358
|
+
* The handler receives a context containing changed filename, timestamp, a
|
|
2359
|
+
* list of modules affected by the file change, and the dev server instance.
|
|
2360
|
+
*
|
|
2361
|
+
* - The hook can return a filtered list of modules to narrow down the update.
|
|
2362
|
+
* e.g. for a Vue SFC, we can narrow down the part to update by comparing
|
|
2363
|
+
* the descriptors.
|
|
2364
|
+
*
|
|
2365
|
+
* - The hook can also return an empty array and then perform custom updates
|
|
2366
|
+
* by sending a custom hmr payload via server.ws.send().
|
|
2367
|
+
*
|
|
2368
|
+
* - If the hook doesn't return a value, the hmr update will be performed as
|
|
2369
|
+
* normal.
|
|
2144
2370
|
*/
|
|
2145
|
-
|
|
2371
|
+
handleHotUpdate?: ObjectHook<(this: MinimalPluginContextWithoutEnvironment, ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>;
|
|
2146
2372
|
/**
|
|
2147
|
-
*
|
|
2148
|
-
*
|
|
2149
|
-
*
|
|
2150
|
-
* a niche browser that comes with most modern JavaScript features
|
|
2151
|
-
* but has poor CSS support, e.g. Android WeChat WebView, which
|
|
2152
|
-
* doesn't support the #RGBA syntax.
|
|
2153
|
-
* @default target
|
|
2373
|
+
* This hook is not supported by Rolldown yet. But the type is declared for compatibility.
|
|
2374
|
+
*
|
|
2375
|
+
* @deprecated This hook is **not** deprecated. It is marked as deprecated just to make it clear that this hook is currently a no-op.
|
|
2154
2376
|
*/
|
|
2155
|
-
|
|
2377
|
+
shouldTransformCachedModule?: ObjectHook<(this: PluginContext, options: {
|
|
2378
|
+
code: string;
|
|
2379
|
+
id: string;
|
|
2380
|
+
meta: CustomPluginOptions;
|
|
2381
|
+
moduleSideEffects: boolean | "no-treeshake";
|
|
2382
|
+
}) => boolean | null | void>;
|
|
2383
|
+
}
|
|
2384
|
+
type HookHandler<T> = T extends ObjectHook<infer H> ? H : T;
|
|
2385
|
+
type PluginWithRequiredHook<K extends keyof Plugin> = Plugin & { [P in K]: NonNullable<Plugin[P]>; };
|
|
2386
|
+
type Thenable<T> = T | Promise<T>;
|
|
2387
|
+
type FalsyPlugin = false | null | undefined;
|
|
2388
|
+
type PluginOption = Thenable<Plugin | {
|
|
2389
|
+
name: string;
|
|
2390
|
+
} | FalsyPlugin | PluginOption[]>;
|
|
2391
|
+
/**
|
|
2392
|
+
* @experimental
|
|
2393
|
+
*/
|
|
2394
|
+
export declare function perEnvironmentPlugin(name: string, applyToEnvironment: (environment: PartialEnvironment) => boolean | Promise<boolean> | PluginOption): Plugin;
|
|
2395
|
+
//#endregion
|
|
2396
|
+
//#region src/node/watch.d.ts
|
|
2397
|
+
/**
|
|
2398
|
+
* Watch options for the dev server. Accepts both chokidar options and Rolldown
|
|
2399
|
+
* watch options. The chokidar options are used by the chokidar watcher, while
|
|
2400
|
+
* the Rolldown options are used by the Rolldown file watcher when bundled dev
|
|
2401
|
+
* mode is enabled.
|
|
2402
|
+
*/
|
|
2403
|
+
type ServerWatchOptions = WatchOptions & Omit<DevWatchOptions, "enabled" | "skipWrite">;
|
|
2404
|
+
//#endregion
|
|
2405
|
+
//#region src/node/server/index.d.ts
|
|
2406
|
+
interface ServerOptions$1 extends CommonServerOptions {
|
|
2156
2407
|
/**
|
|
2157
|
-
*
|
|
2158
|
-
* so you can configure minification for JS and CSS separately.
|
|
2159
|
-
* @default 'lightningcss', but false if build.minify is disabled for client build
|
|
2408
|
+
* Configure HMR-specific options (port, host, path & protocol)
|
|
2160
2409
|
*/
|
|
2161
|
-
|
|
2410
|
+
hmr?: HmrOptions | boolean;
|
|
2162
2411
|
/**
|
|
2163
|
-
*
|
|
2164
|
-
*
|
|
2165
|
-
* 'hidden' works like `true` except that the corresponding sourcemap
|
|
2166
|
-
* comments in the bundled files are suppressed.
|
|
2167
|
-
* @default false
|
|
2412
|
+
* Configure WebSocket connection options.
|
|
2413
|
+
* Set to `false` to disable the WebSocket server and connection.
|
|
2168
2414
|
*/
|
|
2169
|
-
|
|
2415
|
+
ws?: WsOptions | false;
|
|
2170
2416
|
/**
|
|
2171
|
-
*
|
|
2172
|
-
*
|
|
2173
|
-
* @default 'oxc' for client build, false for SSR build
|
|
2417
|
+
* Warm-up files to transform and cache the results in advance. This improves the
|
|
2418
|
+
* initial page load during server starts and prevents transform waterfalls.
|
|
2174
2419
|
*/
|
|
2175
|
-
|
|
2420
|
+
warmup?: {
|
|
2421
|
+
/**
|
|
2422
|
+
* The files to be transformed and used on the client-side. Supports glob patterns.
|
|
2423
|
+
*/
|
|
2424
|
+
clientFiles?: string[];
|
|
2425
|
+
/**
|
|
2426
|
+
* The files to be transformed and used in SSR. Supports glob patterns.
|
|
2427
|
+
*/
|
|
2428
|
+
ssrFiles?: string[];
|
|
2429
|
+
};
|
|
2176
2430
|
/**
|
|
2177
|
-
*
|
|
2178
|
-
* https://terser.org/docs/api-reference#minify-options
|
|
2431
|
+
* File system watcher options, or null to disable FS watching.
|
|
2179
2432
|
*
|
|
2180
|
-
*
|
|
2181
|
-
*
|
|
2433
|
+
* Accepts chokidar options
|
|
2434
|
+
* (https://github.com/paulmillr/chokidar/tree/3.6.0#api), which are used by
|
|
2435
|
+
* the chokidar watcher, and Rolldown watch options, which are used by the
|
|
2436
|
+
* Rolldown file watcher when bundled dev mode is enabled.
|
|
2182
2437
|
*/
|
|
2183
|
-
|
|
2438
|
+
watch?: ServerWatchOptions | null;
|
|
2184
2439
|
/**
|
|
2185
|
-
*
|
|
2440
|
+
* Create Vite dev server to be used as a middleware in an existing server
|
|
2186
2441
|
* @default false
|
|
2187
|
-
* @experimental
|
|
2188
2442
|
*/
|
|
2189
|
-
|
|
2443
|
+
middlewareMode?: boolean | {
|
|
2444
|
+
/**
|
|
2445
|
+
* Parent server instance to attach to
|
|
2446
|
+
*
|
|
2447
|
+
* This is needed to proxy WebSocket connections to the parent server.
|
|
2448
|
+
*/
|
|
2449
|
+
server: HttpServer;
|
|
2450
|
+
};
|
|
2190
2451
|
/**
|
|
2191
|
-
*
|
|
2192
|
-
* @deprecated Use `rolldownOptions` instead.
|
|
2452
|
+
* Options for files served via '/\@fs/'.
|
|
2193
2453
|
*/
|
|
2194
|
-
|
|
2454
|
+
fs?: FileSystemServeOptions;
|
|
2195
2455
|
/**
|
|
2196
|
-
*
|
|
2197
|
-
*
|
|
2456
|
+
* Origin for the generated asset URLs.
|
|
2457
|
+
*
|
|
2458
|
+
* @example `http://127.0.0.1:8080`
|
|
2198
2459
|
*/
|
|
2199
|
-
|
|
2460
|
+
origin?: string;
|
|
2200
2461
|
/**
|
|
2201
|
-
*
|
|
2202
|
-
* @
|
|
2462
|
+
* Pre-transform known direct imports
|
|
2463
|
+
* @default true
|
|
2203
2464
|
*/
|
|
2204
|
-
|
|
2465
|
+
preTransformRequests?: boolean;
|
|
2205
2466
|
/**
|
|
2206
|
-
*
|
|
2467
|
+
* Whether or not to ignore-list source files in the dev server sourcemap, used to populate
|
|
2468
|
+
* the [`x_google_ignoreList` source map extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).
|
|
2469
|
+
*
|
|
2470
|
+
* By default, it excludes all paths containing `node_modules`. You can pass `false` to
|
|
2471
|
+
* disable this behavior, or, for full control, a function that takes the source path and
|
|
2472
|
+
* sourcemap path and returns whether to ignore the source path.
|
|
2207
2473
|
*/
|
|
2208
|
-
|
|
2474
|
+
sourcemapIgnoreList?: false | ((sourcePath: string, sourcemapPath: string) => boolean);
|
|
2209
2475
|
/**
|
|
2210
|
-
*
|
|
2211
|
-
*
|
|
2476
|
+
* Backward compatibility. The buildStart and buildEnd hooks were called only once for
|
|
2477
|
+
* the client environment. This option enables per-environment buildStart and buildEnd hooks.
|
|
2478
|
+
* @default false
|
|
2479
|
+
* @experimental
|
|
2212
2480
|
*/
|
|
2213
|
-
|
|
2481
|
+
perEnvironmentStartEndDuringDev?: boolean;
|
|
2214
2482
|
/**
|
|
2215
|
-
*
|
|
2216
|
-
*
|
|
2483
|
+
* Backward compatibility. The watchChange hook was called only once for the client environment.
|
|
2484
|
+
* This option enables per-environment watchChange hooks.
|
|
2485
|
+
* @default false
|
|
2486
|
+
* @experimental
|
|
2217
2487
|
*/
|
|
2218
|
-
|
|
2488
|
+
perEnvironmentWatchChangeDuringDev?: boolean;
|
|
2219
2489
|
/**
|
|
2220
|
-
*
|
|
2221
|
-
* @
|
|
2490
|
+
* Run HMR tasks, by default the HMR propagation is done in parallel for all environments
|
|
2491
|
+
* @experimental
|
|
2222
2492
|
*/
|
|
2223
|
-
|
|
2493
|
+
hotUpdateEnvironments?: (server: ViteDevServer, hmr: (environment: DevEnvironment) => Promise<void>) => Promise<void>;
|
|
2494
|
+
forwardConsole?: boolean | ForwardConsoleOptions;
|
|
2495
|
+
}
|
|
2496
|
+
interface ResolvedServerOptions extends Omit<RequiredExceptFor<ServerOptions$1, "host" | "https" | "proxy" | "hmr" | "ws" | "watch" | "origin" | "hotUpdateEnvironments">, "fs" | "middlewareMode" | "sourcemapIgnoreList" | "forwardConsole"> {
|
|
2497
|
+
fs: Required<FileSystemServeOptions>;
|
|
2498
|
+
middlewareMode: NonNullable<ServerOptions$1["middlewareMode"]>;
|
|
2499
|
+
sourcemapIgnoreList: Exclude<ServerOptions$1["sourcemapIgnoreList"], false | undefined>;
|
|
2500
|
+
forwardConsole: ResolvedForwardConsoleOptions;
|
|
2501
|
+
}
|
|
2502
|
+
interface FileSystemServeOptions {
|
|
2224
2503
|
/**
|
|
2225
|
-
*
|
|
2226
|
-
*
|
|
2227
|
-
*
|
|
2504
|
+
* Strictly restrict file accessing outside of allowing paths.
|
|
2505
|
+
*
|
|
2506
|
+
* Set to `false` to disable the warning
|
|
2507
|
+
*
|
|
2508
|
+
* @default true
|
|
2228
2509
|
*/
|
|
2229
|
-
|
|
2510
|
+
strict?: boolean;
|
|
2230
2511
|
/**
|
|
2231
|
-
*
|
|
2232
|
-
* to their hashed versions. Useful when you want to generate your own HTML
|
|
2233
|
-
* instead of using the one generated by Vite.
|
|
2234
|
-
*
|
|
2235
|
-
* Example:
|
|
2512
|
+
* Restrict accessing files outside the allowed directories.
|
|
2236
2513
|
*
|
|
2237
|
-
*
|
|
2238
|
-
*
|
|
2239
|
-
* "main.js": {
|
|
2240
|
-
* "file": "main.68fe3fad.js",
|
|
2241
|
-
* "css": "main.e6b63442.css",
|
|
2242
|
-
* "imports": [...],
|
|
2243
|
-
* "dynamicImports": [...]
|
|
2244
|
-
* }
|
|
2245
|
-
* }
|
|
2246
|
-
* ```
|
|
2247
|
-
* @default false
|
|
2514
|
+
* Accepts absolute path or a path relative to project root.
|
|
2515
|
+
* Will try to search up for workspace root by default.
|
|
2248
2516
|
*/
|
|
2249
|
-
|
|
2517
|
+
allow?: string[];
|
|
2250
2518
|
/**
|
|
2251
|
-
*
|
|
2252
|
-
*
|
|
2253
|
-
*
|
|
2254
|
-
*
|
|
2519
|
+
* Restrict accessing files that matches the patterns.
|
|
2520
|
+
*
|
|
2521
|
+
* This will have higher priority than `allow`.
|
|
2522
|
+
* picomatch patterns are supported.
|
|
2523
|
+
*
|
|
2524
|
+
* @default ['.env', '.env.*', '*.{crt,pem,key,p12,pfx,cer,der}', '.npmrc', '.yarnrc.yml', '**\/.git/**']
|
|
2255
2525
|
*/
|
|
2256
|
-
|
|
2526
|
+
deny?: string[];
|
|
2527
|
+
}
|
|
2528
|
+
type ServerHook = (this: MinimalPluginContextWithoutEnvironment, server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
2529
|
+
interface CloseServerHookContext {
|
|
2257
2530
|
/**
|
|
2258
|
-
*
|
|
2259
|
-
* `
|
|
2260
|
-
*
|
|
2531
|
+
* Whether the server is being restarted (e.g. a config change or
|
|
2532
|
+
* `server.restart()`) or closed (e.g. the `q` shortcut, SIGTERM, stdin
|
|
2533
|
+
* ending, or `server.close()`).
|
|
2261
2534
|
*/
|
|
2262
|
-
|
|
2535
|
+
reason: "restart" | "close";
|
|
2536
|
+
}
|
|
2537
|
+
type CloseServerHook = (this: MinimalPluginContextWithoutEnvironment, context: CloseServerHookContext) => void | Promise<void>;
|
|
2538
|
+
type HttpServer = http.Server | Http2SecureServer;
|
|
2539
|
+
interface ViteDevServer {
|
|
2263
2540
|
/**
|
|
2264
|
-
*
|
|
2265
|
-
* directives in production.
|
|
2266
|
-
* @default false
|
|
2541
|
+
* The resolved vite config object
|
|
2267
2542
|
*/
|
|
2268
|
-
|
|
2543
|
+
config: ResolvedConfig;
|
|
2269
2544
|
/**
|
|
2270
|
-
*
|
|
2271
|
-
*
|
|
2545
|
+
* A connect app instance.
|
|
2546
|
+
* - Can be used to attach custom middlewares to the dev server.
|
|
2547
|
+
* - Can also be used as the handler function of a custom http server
|
|
2548
|
+
* or as a middleware in any connect-style Node.js frameworks
|
|
2549
|
+
*
|
|
2550
|
+
* https://github.com/senchalabs/connect#use-middleware
|
|
2272
2551
|
*/
|
|
2273
|
-
|
|
2552
|
+
middlewares: Connect.Server;
|
|
2274
2553
|
/**
|
|
2275
|
-
*
|
|
2276
|
-
*
|
|
2554
|
+
* native Node http server instance
|
|
2555
|
+
* will be null in middleware mode
|
|
2277
2556
|
*/
|
|
2278
|
-
|
|
2557
|
+
httpServer: HttpServer | null;
|
|
2279
2558
|
/**
|
|
2280
|
-
*
|
|
2281
|
-
*
|
|
2282
|
-
*
|
|
2559
|
+
* Chokidar watcher instance. If `config.server.watch` is set to `null`,
|
|
2560
|
+
* it will not watch any files and calling `add` or `unwatch` will have no effect.
|
|
2561
|
+
* https://github.com/paulmillr/chokidar/tree/3.6.0#api
|
|
2283
2562
|
*/
|
|
2284
|
-
|
|
2563
|
+
watcher: FSWatcher;
|
|
2285
2564
|
/**
|
|
2286
|
-
*
|
|
2287
|
-
* @default 500
|
|
2565
|
+
* WebSocket server with `send(payload)` method
|
|
2288
2566
|
*/
|
|
2289
|
-
|
|
2567
|
+
ws: WebSocketServer;
|
|
2290
2568
|
/**
|
|
2291
|
-
*
|
|
2292
|
-
*
|
|
2293
|
-
* @default null
|
|
2569
|
+
* An alias to `server.environments.client.hot`.
|
|
2570
|
+
* If you want to interact with all environments, loop over `server.environments`.
|
|
2294
2571
|
*/
|
|
2295
|
-
|
|
2572
|
+
hot: NormalizedHotChannel;
|
|
2296
2573
|
/**
|
|
2297
|
-
*
|
|
2574
|
+
* Rollup plugin container that can run plugin hooks on a given file
|
|
2298
2575
|
*/
|
|
2299
|
-
|
|
2300
|
-
}
|
|
2301
|
-
type BuildOptions = BuildEnvironmentOptions;
|
|
2302
|
-
interface LibraryOptions {
|
|
2576
|
+
pluginContainer: PluginContainer;
|
|
2303
2577
|
/**
|
|
2304
|
-
*
|
|
2305
|
-
* Defaults to the top-level `input` option when omitted.
|
|
2578
|
+
* Module execution environments attached to the Vite server.
|
|
2306
2579
|
*/
|
|
2307
|
-
|
|
2580
|
+
environments: Record<"client" | "ssr" | (string & {}), DevEnvironment>;
|
|
2308
2581
|
/**
|
|
2309
|
-
*
|
|
2310
|
-
*
|
|
2582
|
+
* Module graph that tracks the import relationships, url to file mapping
|
|
2583
|
+
* and hmr state.
|
|
2311
2584
|
*/
|
|
2312
|
-
|
|
2585
|
+
moduleGraph: ModuleGraph;
|
|
2313
2586
|
/**
|
|
2314
|
-
*
|
|
2315
|
-
*
|
|
2316
|
-
* multiple entries).
|
|
2317
|
-
* @default ['es', 'umd']
|
|
2587
|
+
* The resolved urls Vite prints on the CLI (URL-encoded). Returns `null`
|
|
2588
|
+
* in middleware mode or if the server is not listening on any port.
|
|
2318
2589
|
*/
|
|
2319
|
-
|
|
2590
|
+
resolvedUrls: ResolvedServerUrls | null;
|
|
2320
2591
|
/**
|
|
2321
|
-
*
|
|
2322
|
-
*
|
|
2323
|
-
* format as an argument.
|
|
2592
|
+
* Programmatically resolve, load and transform a URL and get the result
|
|
2593
|
+
* without going through the http request pipeline.
|
|
2324
2594
|
*/
|
|
2325
|
-
|
|
2595
|
+
transformRequest(url: string, options?: TransformOptions): Promise<TransformResult | null>;
|
|
2326
2596
|
/**
|
|
2327
|
-
*
|
|
2328
|
-
*
|
|
2329
|
-
*
|
|
2597
|
+
* Same as `transformRequest` but only warm up the URLs so the next request
|
|
2598
|
+
* will already be cached. The function will never throw as it handles and
|
|
2599
|
+
* reports errors internally.
|
|
2330
2600
|
*/
|
|
2331
|
-
|
|
2332
|
-
}
|
|
2333
|
-
type LibraryFormats = "es" | "cjs" | "umd" | "iife";
|
|
2334
|
-
interface ModulePreloadOptions {
|
|
2601
|
+
warmupRequest(url: string, options?: TransformOptions): Promise<void>;
|
|
2335
2602
|
/**
|
|
2336
|
-
*
|
|
2337
|
-
* Note: does not apply to library mode.
|
|
2338
|
-
* @default true
|
|
2603
|
+
* Apply vite built-in HTML transforms and any plugin HTML transforms.
|
|
2339
2604
|
*/
|
|
2340
|
-
|
|
2605
|
+
transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>;
|
|
2341
2606
|
/**
|
|
2342
|
-
*
|
|
2343
|
-
* @experimental
|
|
2607
|
+
* Transform module code into SSR format.
|
|
2344
2608
|
*/
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
polyfill: boolean;
|
|
2349
|
-
resolveDependencies?: ResolveModulePreloadDependenciesFn;
|
|
2350
|
-
}
|
|
2351
|
-
type ResolveModulePreloadDependenciesFn = (filename: string, deps: string[], context: {
|
|
2352
|
-
hostId: string;
|
|
2353
|
-
hostType: "html" | "js";
|
|
2354
|
-
}) => string[];
|
|
2355
|
-
interface ResolvedBuildEnvironmentOptions extends Required<Omit<BuildEnvironmentOptions, "polyfillModulePreload">> {
|
|
2356
|
-
modulePreload: false | ResolvedModulePreloadOptions;
|
|
2357
|
-
}
|
|
2358
|
-
interface ResolvedBuildOptions extends Required<Omit<BuildOptions, "polyfillModulePreload">> {
|
|
2359
|
-
modulePreload: false | ResolvedModulePreloadOptions;
|
|
2360
|
-
}
|
|
2361
|
-
/**
|
|
2362
|
-
* Bundles a single environment for production.
|
|
2363
|
-
* Returns a Promise containing the build result.
|
|
2364
|
-
*/
|
|
2365
|
-
declare function build(inlineConfig?: InlineConfig): Promise<RolldownOutput | RolldownOutput[] | RolldownWatcher>;
|
|
2366
|
-
type RenderBuiltAssetUrl = (filename: string, type: {
|
|
2367
|
-
type: "asset" | "public";
|
|
2368
|
-
hostId: string;
|
|
2369
|
-
hostType: "js" | "css" | "html";
|
|
2370
|
-
ssr: boolean;
|
|
2371
|
-
}) => string | {
|
|
2372
|
-
relative?: boolean;
|
|
2373
|
-
runtime?: string;
|
|
2374
|
-
} | undefined;
|
|
2375
|
-
declare class BuildEnvironment extends BaseEnvironment {
|
|
2376
|
-
mode: "build";
|
|
2377
|
-
isBuilt: boolean;
|
|
2378
|
-
constructor(name: string, config: ResolvedConfig, setup?: {
|
|
2379
|
-
options?: EnvironmentOptions;
|
|
2380
|
-
});
|
|
2381
|
-
init(): Promise<void>;
|
|
2382
|
-
}
|
|
2383
|
-
interface ViteBuilder {
|
|
2384
|
-
environments: Record<string, BuildEnvironment>;
|
|
2385
|
-
config: ResolvedConfig;
|
|
2386
|
-
buildApp(): Promise<void>;
|
|
2387
|
-
build(environment: BuildEnvironment): Promise<RolldownOutput | RolldownOutput[] | RolldownWatcher>;
|
|
2388
|
-
runDevTools(): Promise<void>;
|
|
2389
|
-
}
|
|
2390
|
-
interface BuilderOptions {
|
|
2609
|
+
ssrTransform(code: string, inMap: SourceMap | {
|
|
2610
|
+
mappings: "";
|
|
2611
|
+
} | null, url: string, originalCode?: string): Promise<TransformResult | null>;
|
|
2391
2612
|
/**
|
|
2392
|
-
*
|
|
2393
|
-
*
|
|
2394
|
-
* @default false
|
|
2395
|
-
* @experimental
|
|
2613
|
+
* Load a given URL as an instantiated module for SSR.
|
|
2396
2614
|
*/
|
|
2397
|
-
|
|
2615
|
+
ssrLoadModule(url: string, opts?: {
|
|
2616
|
+
fixStacktrace?: boolean;
|
|
2617
|
+
}): Promise<Record<string, any>>;
|
|
2398
2618
|
/**
|
|
2399
|
-
*
|
|
2400
|
-
*
|
|
2401
|
-
* @default false
|
|
2402
|
-
* @experimental
|
|
2619
|
+
* Returns a fixed version of the given stack
|
|
2403
2620
|
*/
|
|
2404
|
-
|
|
2405
|
-
buildApp?: (builder: ViteBuilder) => Promise<void>;
|
|
2406
|
-
}
|
|
2407
|
-
type ResolvedBuilderOptions = Required<BuilderOptions>;
|
|
2408
|
-
/**
|
|
2409
|
-
* Creates a ViteBuilder to orchestrate building multiple environments.
|
|
2410
|
-
* @experimental
|
|
2411
|
-
*/
|
|
2412
|
-
declare function createBuilder(inlineConfig?: InlineConfig, useLegacyBuilder?: null | boolean): Promise<ViteBuilder>;
|
|
2413
|
-
type BuildAppHook = (this: MinimalPluginContextWithoutEnvironment, builder: ViteBuilder) => Promise<void>;
|
|
2414
|
-
//#endregion
|
|
2415
|
-
//#region src/node/environment.d.ts
|
|
2416
|
-
type Environment = DevEnvironment | BuildEnvironment | ScanEnvironment | UnknownEnvironment;
|
|
2417
|
-
/**
|
|
2418
|
-
* Creates a function that hides the complexities of a WeakMap with an initial value
|
|
2419
|
-
* to implement object metadata. Used by plugins to implement cross hooks per
|
|
2420
|
-
* environment metadata
|
|
2421
|
-
*
|
|
2422
|
-
* @experimental
|
|
2423
|
-
*/
|
|
2424
|
-
declare function perEnvironmentState<State>(initial: (environment: Environment) => State): (context: PluginContext) => State;
|
|
2425
|
-
//#endregion
|
|
2426
|
-
//#region src/node/server/pluginContainer.d.ts
|
|
2427
|
-
type SkipInformation = {
|
|
2428
|
-
id: string;
|
|
2429
|
-
importer: string | undefined;
|
|
2430
|
-
plugin: Plugin;
|
|
2431
|
-
called?: boolean;
|
|
2432
|
-
};
|
|
2433
|
-
declare class EnvironmentPluginContainer<Env extends Environment = Environment> {
|
|
2434
|
-
private _pluginContextMap;
|
|
2435
|
-
private _resolvedRolldownOptions?;
|
|
2436
|
-
private _processesing;
|
|
2437
|
-
private _seenResolves;
|
|
2438
|
-
private _moduleNodeToLoadAddedImports;
|
|
2439
|
-
getSortedPluginHooks: PluginHookUtils["getSortedPluginHooks"];
|
|
2440
|
-
getSortedPlugins: PluginHookUtils["getSortedPlugins"];
|
|
2441
|
-
moduleGraph: EnvironmentModuleGraph | undefined;
|
|
2442
|
-
watchFiles: Set<string>;
|
|
2443
|
-
minimalContext: MinimalPluginContext$1<Env>;
|
|
2444
|
-
private _started;
|
|
2445
|
-
private _buildStartPromise;
|
|
2446
|
-
private _closed;
|
|
2447
|
-
private _updateModuleLoadAddedImports;
|
|
2448
|
-
private _getAddedImports;
|
|
2449
|
-
getModuleInfo(id: string): ModuleInfo | null;
|
|
2450
|
-
private handleHookPromise;
|
|
2451
|
-
get options(): InputOptions;
|
|
2452
|
-
resolveRolldownOptions(): Promise<InputOptions>;
|
|
2453
|
-
private _getPluginContext;
|
|
2454
|
-
private hookParallel;
|
|
2455
|
-
buildStart(_options?: InputOptions): Promise<void>;
|
|
2456
|
-
resolveId(rawId: string, importer?: string | undefined, options?: {
|
|
2457
|
-
kind?: ImportKind;
|
|
2458
|
-
attributes?: Record<string, string>;
|
|
2459
|
-
custom?: CustomPluginOptions;
|
|
2460
|
-
/** @deprecated use `skipCalls` instead */
|
|
2461
|
-
skip?: Set<Plugin>;
|
|
2462
|
-
skipCalls?: readonly SkipInformation[];
|
|
2463
|
-
|
|
2464
|
-
isEntry?: boolean;
|
|
2465
|
-
}): Promise<PartialResolvedId | null>;
|
|
2466
|
-
load(id: string): Promise<LoadResult | null>;
|
|
2467
|
-
transform(code: string, id: string, options?: {
|
|
2468
|
-
inMap?: SourceDescription["map"];
|
|
2469
|
-
moduleType?: string;
|
|
2470
|
-
}): Promise<{
|
|
2471
|
-
code: string;
|
|
2472
|
-
map: SourceMap | {
|
|
2473
|
-
mappings: "";
|
|
2474
|
-
} | null;
|
|
2475
|
-
moduleType?: ModuleType;
|
|
2476
|
-
}>;
|
|
2477
|
-
watchChange(id: string, change: {
|
|
2478
|
-
event: "create" | "update" | "delete";
|
|
2479
|
-
}): Promise<void>;
|
|
2480
|
-
close(): Promise<void>;
|
|
2481
|
-
}
|
|
2482
|
-
declare class BasicMinimalPluginContext<Meta = PluginContextMeta> {
|
|
2483
|
-
meta: Meta;
|
|
2484
|
-
private _logger;
|
|
2485
|
-
constructor(meta: Meta, _logger: Logger);
|
|
2486
|
-
get pluginName(): string;
|
|
2487
|
-
debug(rawLog: string | RollupLog | (() => string | RollupLog)): void;
|
|
2488
|
-
info(rawLog: string | RollupLog | (() => string | RollupLog)): void;
|
|
2489
|
-
warn(rawLog: string | RollupLog | (() => string | RollupLog)): void;
|
|
2490
|
-
error(e: string | RollupError): never;
|
|
2491
|
-
private _normalizeRawLog;
|
|
2492
|
-
}
|
|
2493
|
-
declare class MinimalPluginContext$1<T extends Environment = Environment> extends BasicMinimalPluginContext implements MinimalPluginContext {
|
|
2494
|
-
environment: T;
|
|
2495
|
-
constructor(meta: PluginContextMeta, environment: T);
|
|
2496
|
-
}
|
|
2497
|
-
declare class PluginContainer {
|
|
2498
|
-
private environments;
|
|
2499
|
-
constructor(environments: Record<string, Environment>);
|
|
2500
|
-
private _getEnvironment;
|
|
2501
|
-
private _getPluginContainer;
|
|
2502
|
-
getModuleInfo(id: string): ModuleInfo | null;
|
|
2503
|
-
get options(): InputOptions;
|
|
2504
|
-
buildStart(_options?: InputOptions): Promise<void>;
|
|
2505
|
-
watchChange(id: string, change: {
|
|
2506
|
-
event: "create" | "update" | "delete";
|
|
2507
|
-
}): Promise<void>;
|
|
2508
|
-
resolveId(rawId: string, importer?: string, options?: {
|
|
2509
|
-
attributes?: Record<string, string>;
|
|
2510
|
-
custom?: CustomPluginOptions;
|
|
2511
|
-
/** @deprecated use `skipCalls` instead */
|
|
2512
|
-
skip?: Set<Plugin>;
|
|
2513
|
-
skipCalls?: readonly SkipInformation[];
|
|
2514
|
-
ssr?: boolean;
|
|
2515
|
-
|
|
2516
|
-
isEntry?: boolean;
|
|
2517
|
-
}): Promise<PartialResolvedId | null>;
|
|
2518
|
-
load(id: string, options?: {
|
|
2519
|
-
ssr?: boolean;
|
|
2520
|
-
}): Promise<LoadResult | null>;
|
|
2521
|
-
transform(code: string, id: string, options?: {
|
|
2522
|
-
ssr?: boolean;
|
|
2523
|
-
environment?: Environment;
|
|
2524
|
-
inMap?: SourceDescription["map"];
|
|
2525
|
-
}): Promise<{
|
|
2526
|
-
code: string;
|
|
2527
|
-
map: SourceMap | {
|
|
2528
|
-
mappings: "";
|
|
2529
|
-
} | null;
|
|
2530
|
-
}>;
|
|
2531
|
-
close(): Promise<void>;
|
|
2532
|
-
}
|
|
2533
|
-
//#endregion
|
|
2534
|
-
//#region src/node/server/index.d.ts
|
|
2535
|
-
interface ServerOptions$1 extends CommonServerOptions {
|
|
2621
|
+
ssrRewriteStacktrace(stack: string): string;
|
|
2536
2622
|
/**
|
|
2537
|
-
*
|
|
2623
|
+
* Mutates the given SSR error by rewriting the stacktrace
|
|
2538
2624
|
*/
|
|
2539
|
-
|
|
2625
|
+
ssrFixStacktrace(e: Error): void;
|
|
2540
2626
|
/**
|
|
2541
|
-
*
|
|
2542
|
-
*
|
|
2627
|
+
* Triggers HMR for a module in the module graph. You can use the `server.moduleGraph`
|
|
2628
|
+
* API to retrieve the module to be reloaded. If `hmr` is false, this is a no-op.
|
|
2543
2629
|
*/
|
|
2544
|
-
|
|
2630
|
+
reloadModule(module: ModuleNode): Promise<void>;
|
|
2545
2631
|
/**
|
|
2546
|
-
*
|
|
2547
|
-
* initial page load during server starts and prevents transform waterfalls.
|
|
2632
|
+
* Start the server.
|
|
2548
2633
|
*/
|
|
2549
|
-
|
|
2550
|
-
/**
|
|
2551
|
-
* The files to be transformed and used on the client-side. Supports glob patterns.
|
|
2552
|
-
*/
|
|
2553
|
-
clientFiles?: string[];
|
|
2554
|
-
/**
|
|
2555
|
-
* The files to be transformed and used in SSR. Supports glob patterns.
|
|
2556
|
-
*/
|
|
2557
|
-
ssrFiles?: string[];
|
|
2558
|
-
};
|
|
2634
|
+
listen(port?: number, isRestart?: boolean): Promise<ViteDevServer>;
|
|
2559
2635
|
/**
|
|
2560
|
-
*
|
|
2561
|
-
* https://github.com/paulmillr/chokidar/tree/3.6.0#api
|
|
2636
|
+
* Stop the server.
|
|
2562
2637
|
*/
|
|
2563
|
-
|
|
2638
|
+
close(): Promise<void>;
|
|
2564
2639
|
/**
|
|
2565
|
-
*
|
|
2566
|
-
* @default false
|
|
2640
|
+
* Print server urls
|
|
2567
2641
|
*/
|
|
2568
|
-
|
|
2569
|
-
/**
|
|
2570
|
-
* Parent server instance to attach to
|
|
2571
|
-
*
|
|
2572
|
-
* This is needed to proxy WebSocket connections to the parent server.
|
|
2573
|
-
*/
|
|
2574
|
-
server: HttpServer;
|
|
2575
|
-
};
|
|
2642
|
+
printUrls(): void;
|
|
2576
2643
|
/**
|
|
2577
|
-
*
|
|
2644
|
+
* Bind CLI shortcuts
|
|
2578
2645
|
*/
|
|
2579
|
-
|
|
2646
|
+
bindCLIShortcuts(options?: BindCLIShortcutsOptions<ViteDevServer>): void;
|
|
2580
2647
|
/**
|
|
2581
|
-
*
|
|
2648
|
+
* Restart the server.
|
|
2582
2649
|
*
|
|
2583
|
-
* @
|
|
2650
|
+
* @param forceOptimize - force the optimizer to re-bundle, same as --force cli flag
|
|
2584
2651
|
*/
|
|
2585
|
-
|
|
2652
|
+
restart(forceOptimize?: boolean): Promise<void>;
|
|
2653
|
+
/**
|
|
2654
|
+
* Open browser
|
|
2655
|
+
*/
|
|
2656
|
+
openBrowser(): void;
|
|
2657
|
+
/**
|
|
2658
|
+
* Calling `await server.waitForRequestsIdle(id)` will wait until all static imports
|
|
2659
|
+
* are processed. If called from a load or transform plugin hook, the id needs to be
|
|
2660
|
+
* passed as a parameter to avoid deadlocks. Calling this function after the first
|
|
2661
|
+
* static imports section of the module graph has been processed will resolve immediately.
|
|
2662
|
+
*/
|
|
2663
|
+
waitForRequestsIdle: (ignoredId?: string) => Promise<void>;
|
|
2664
|
+
}
|
|
2665
|
+
interface ResolvedServerUrls {
|
|
2666
|
+
local: string[];
|
|
2667
|
+
network: string[];
|
|
2668
|
+
/**
|
|
2669
|
+
* Names of the network interface that each {@link ResolvedServerUrls.network}
|
|
2670
|
+
* URL is bound to, in the same order as `network`. An entry is `undefined`
|
|
2671
|
+
* when the interface name is not known, for example when an explicit `host`
|
|
2672
|
+
* is set.
|
|
2673
|
+
*/
|
|
2674
|
+
networkInterfaceNames?: (string | undefined)[];
|
|
2675
|
+
}
|
|
2676
|
+
export declare function createServer(inlineConfig?: InlineConfig | ResolvedConfig): Promise<ViteDevServer>;
|
|
2677
|
+
//#endregion
|
|
2678
|
+
//#region src/node/logger.d.ts
|
|
2679
|
+
type LogType = "error" | "warn" | "info";
|
|
2680
|
+
type LogLevel = LogType | "silent";
|
|
2681
|
+
interface Logger {
|
|
2682
|
+
info(msg: string, options?: LogOptions): void;
|
|
2683
|
+
warn(msg: string, options?: LogOptions): void;
|
|
2684
|
+
warnOnce(msg: string, options?: LogOptions): void;
|
|
2685
|
+
error(msg: string, options?: LogErrorOptions): void;
|
|
2686
|
+
clearScreen(type: LogType): void;
|
|
2687
|
+
hasErrorLogged(error: Error | RollupError): boolean;
|
|
2688
|
+
hasWarned: boolean;
|
|
2689
|
+
}
|
|
2690
|
+
interface LogOptions {
|
|
2691
|
+
clear?: boolean;
|
|
2692
|
+
timestamp?: boolean;
|
|
2693
|
+
environment?: string;
|
|
2694
|
+
}
|
|
2695
|
+
interface LogErrorOptions extends LogOptions {
|
|
2696
|
+
error?: Error | RollupError | null;
|
|
2697
|
+
}
|
|
2698
|
+
interface LoggerOptions {
|
|
2699
|
+
prefix?: string;
|
|
2700
|
+
allowClearScreen?: boolean;
|
|
2701
|
+
customLogger?: Logger;
|
|
2702
|
+
console?: Console;
|
|
2703
|
+
}
|
|
2704
|
+
export declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
|
|
2705
|
+
//#endregion
|
|
2706
|
+
//#region src/node/baseEnvironment.d.ts
|
|
2707
|
+
declare class PartialEnvironment {
|
|
2708
|
+
name: string;
|
|
2709
|
+
getTopLevelConfig(): ResolvedConfig;
|
|
2710
|
+
config: ResolvedConfig & ResolvedEnvironmentOptions;
|
|
2711
|
+
logger: Logger;
|
|
2712
|
+
constructor(name: string, topLevelConfig: ResolvedConfig, options?: ResolvedEnvironmentOptions);
|
|
2713
|
+
}
|
|
2714
|
+
declare class BaseEnvironment extends PartialEnvironment {
|
|
2715
|
+
get plugins(): readonly Plugin[];
|
|
2716
|
+
constructor(name: string, config: ResolvedConfig, options?: ResolvedEnvironmentOptions);
|
|
2717
|
+
}
|
|
2718
|
+
/**
|
|
2719
|
+
* This class discourages users from inversely checking the `mode`
|
|
2720
|
+
* to determine the type of environment, e.g.
|
|
2721
|
+
*
|
|
2722
|
+
* ```js
|
|
2723
|
+
* const isDev = environment.mode !== 'build' // bad
|
|
2724
|
+
* const isDev = environment.mode === 'dev' // good
|
|
2725
|
+
* ```
|
|
2726
|
+
*
|
|
2727
|
+
* You should also not check against `"unknown"` specifically. It's
|
|
2728
|
+
* a placeholder for more possible environment types.
|
|
2729
|
+
*/
|
|
2730
|
+
declare class UnknownEnvironment extends BaseEnvironment {
|
|
2731
|
+
mode: "unknown";
|
|
2732
|
+
}
|
|
2733
|
+
//#endregion
|
|
2734
|
+
//#region src/node/plugins/resolve.d.ts
|
|
2735
|
+
interface EnvironmentResolveOptions {
|
|
2586
2736
|
/**
|
|
2587
|
-
*
|
|
2588
|
-
* @default true
|
|
2737
|
+
* @default ['browser', 'module', 'jsnext:main', 'jsnext']
|
|
2589
2738
|
*/
|
|
2590
|
-
|
|
2739
|
+
mainFields?: string[];
|
|
2740
|
+
conditions?: string[];
|
|
2741
|
+
externalConditions?: string[];
|
|
2591
2742
|
/**
|
|
2592
|
-
*
|
|
2593
|
-
* the [`x_google_ignoreList` source map extension](https://developer.chrome.com/blog/devtools-better-angular-debugging/#the-x_google_ignorelist-source-map-extension).
|
|
2594
|
-
*
|
|
2595
|
-
* By default, it excludes all paths containing `node_modules`. You can pass `false` to
|
|
2596
|
-
* disable this behavior, or, for full control, a function that takes the source path and
|
|
2597
|
-
* sourcemap path and returns whether to ignore the source path.
|
|
2743
|
+
* @default ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']
|
|
2598
2744
|
*/
|
|
2599
|
-
|
|
2745
|
+
extensions?: string[];
|
|
2746
|
+
dedupe?: string[];
|
|
2600
2747
|
/**
|
|
2601
|
-
*
|
|
2602
|
-
*
|
|
2603
|
-
* @default false
|
|
2748
|
+
* Prevent listed dependencies from being externalized and will get bundled in build.
|
|
2749
|
+
* Only works in server environments for now. Previously this was `ssr.noExternal`.
|
|
2604
2750
|
* @experimental
|
|
2605
2751
|
*/
|
|
2606
|
-
|
|
2752
|
+
noExternal?: string | RegExp | (string | RegExp)[] | true;
|
|
2607
2753
|
/**
|
|
2608
|
-
*
|
|
2609
|
-
*
|
|
2610
|
-
* @default false
|
|
2754
|
+
* Externalize the given dependencies and their transitive dependencies.
|
|
2755
|
+
* Only works in server environments for now. Previously this was `ssr.external`.
|
|
2611
2756
|
* @experimental
|
|
2612
2757
|
*/
|
|
2613
|
-
|
|
2758
|
+
external?: string[] | true;
|
|
2614
2759
|
/**
|
|
2615
|
-
*
|
|
2616
|
-
* @experimental
|
|
2760
|
+
* Array of strings or regular expressions that indicate what modules are builtin for the environment.
|
|
2617
2761
|
*/
|
|
2618
|
-
|
|
2619
|
-
forwardConsole?: boolean | ForwardConsoleOptions;
|
|
2620
|
-
}
|
|
2621
|
-
interface ResolvedServerOptions extends Omit<RequiredExceptFor<ServerOptions$1, "host" | "https" | "proxy" | "hmr" | "ws" | "watch" | "origin" | "hotUpdateEnvironments">, "fs" | "middlewareMode" | "sourcemapIgnoreList" | "forwardConsole"> {
|
|
2622
|
-
fs: Required<FileSystemServeOptions>;
|
|
2623
|
-
middlewareMode: NonNullable<ServerOptions$1["middlewareMode"]>;
|
|
2624
|
-
sourcemapIgnoreList: Exclude<ServerOptions$1["sourcemapIgnoreList"], false | undefined>;
|
|
2625
|
-
forwardConsole: ResolvedForwardConsoleOptions;
|
|
2762
|
+
builtins?: (string | RegExp)[];
|
|
2626
2763
|
}
|
|
2627
|
-
interface
|
|
2628
|
-
/**
|
|
2629
|
-
* Strictly restrict file accessing outside of allowing paths.
|
|
2630
|
-
*
|
|
2631
|
-
* Set to `false` to disable the warning
|
|
2632
|
-
*
|
|
2633
|
-
* @default true
|
|
2634
|
-
*/
|
|
2635
|
-
strict?: boolean;
|
|
2764
|
+
interface ResolveOptions extends EnvironmentResolveOptions {
|
|
2636
2765
|
/**
|
|
2637
|
-
*
|
|
2638
|
-
*
|
|
2639
|
-
* Accepts absolute path or a path relative to project root.
|
|
2640
|
-
* Will try to search up for workspace root by default.
|
|
2766
|
+
* @default false
|
|
2641
2767
|
*/
|
|
2642
|
-
|
|
2768
|
+
preserveSymlinks?: boolean;
|
|
2643
2769
|
/**
|
|
2644
|
-
*
|
|
2645
|
-
*
|
|
2646
|
-
* This will have higher priority than `allow`.
|
|
2647
|
-
* picomatch patterns are supported.
|
|
2770
|
+
* Enable tsconfig paths resolution
|
|
2648
2771
|
*
|
|
2649
|
-
* @default
|
|
2772
|
+
* @default false
|
|
2650
2773
|
*/
|
|
2651
|
-
|
|
2774
|
+
tsconfigPaths?: boolean;
|
|
2652
2775
|
}
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
*/
|
|
2659
|
-
config: ResolvedConfig;
|
|
2660
|
-
/**
|
|
2661
|
-
* A connect app instance.
|
|
2662
|
-
* - Can be used to attach custom middlewares to the dev server.
|
|
2663
|
-
* - Can also be used as the handler function of a custom http server
|
|
2664
|
-
* or as a middleware in any connect-style Node.js frameworks
|
|
2665
|
-
*
|
|
2666
|
-
* https://github.com/senchalabs/connect#use-middleware
|
|
2667
|
-
*/
|
|
2668
|
-
middlewares: Connect.Server;
|
|
2669
|
-
/**
|
|
2670
|
-
* native Node http server instance
|
|
2671
|
-
* will be null in middleware mode
|
|
2672
|
-
*/
|
|
2673
|
-
httpServer: HttpServer | null;
|
|
2674
|
-
/**
|
|
2675
|
-
* Chokidar watcher instance. If `config.server.watch` is set to `null`,
|
|
2676
|
-
* it will not watch any files and calling `add` or `unwatch` will have no effect.
|
|
2677
|
-
* https://github.com/paulmillr/chokidar/tree/3.6.0#api
|
|
2678
|
-
*/
|
|
2679
|
-
watcher: FSWatcher;
|
|
2776
|
+
interface ResolvePluginOptions {
|
|
2777
|
+
root: string;
|
|
2778
|
+
isBuild: boolean;
|
|
2779
|
+
isProduction: boolean;
|
|
2780
|
+
packageCache?: PackageCache;
|
|
2680
2781
|
/**
|
|
2681
|
-
*
|
|
2782
|
+
* src code mode also attempts the following:
|
|
2783
|
+
* - resolving /xxx as URLs
|
|
2784
|
+
* - resolving bare imports from optimized deps
|
|
2682
2785
|
*/
|
|
2683
|
-
|
|
2786
|
+
asSrc?: boolean;
|
|
2787
|
+
tryIndex?: boolean;
|
|
2788
|
+
tryPrefix?: string;
|
|
2789
|
+
preferRelative?: boolean;
|
|
2790
|
+
isRequire?: boolean;
|
|
2791
|
+
scan?: boolean;
|
|
2684
2792
|
/**
|
|
2685
|
-
*
|
|
2686
|
-
* If you want to interact with all environments, loop over `server.environments`.
|
|
2793
|
+
* Enable when `legacy.inconsistentCjsInterop` is true. See that option for more details.
|
|
2687
2794
|
*/
|
|
2688
|
-
|
|
2795
|
+
legacyInconsistentCjsInterop?: boolean;
|
|
2796
|
+
}
|
|
2797
|
+
interface InternalResolveOptions extends Required<ResolveOptions>, ResolvePluginOptions {}
|
|
2798
|
+
//#endregion
|
|
2799
|
+
//#region src/node/packages.d.ts
|
|
2800
|
+
/** Cache for package.json resolution and package.json contents */
|
|
2801
|
+
type PackageCache = Map<string, PackageData>;
|
|
2802
|
+
interface PackageData {
|
|
2803
|
+
dir: string;
|
|
2804
|
+
hasSideEffects: (id: string) => boolean | "no-treeshake" | null;
|
|
2805
|
+
setResolvedCache: (key: string, entry: string, options: InternalResolveOptions) => void;
|
|
2806
|
+
getResolvedCache: (key: string, options: InternalResolveOptions) => string | undefined;
|
|
2807
|
+
data: {
|
|
2808
|
+
[field: string]: any;
|
|
2809
|
+
name: string;
|
|
2810
|
+
type: string;
|
|
2811
|
+
version: string;
|
|
2812
|
+
main: string;
|
|
2813
|
+
module: string;
|
|
2814
|
+
browser: string | Record<string, string | false>;
|
|
2815
|
+
exports: string | Record<string, any> | string[];
|
|
2816
|
+
imports: Record<string, any>;
|
|
2817
|
+
dependencies: Record<string, string>;
|
|
2818
|
+
};
|
|
2819
|
+
}
|
|
2820
|
+
//#endregion
|
|
2821
|
+
//#region src/node/plugins/license.d.ts
|
|
2822
|
+
interface LicenseOptions {
|
|
2689
2823
|
/**
|
|
2690
|
-
*
|
|
2824
|
+
* The output file name of the license file relative to the output directory.
|
|
2825
|
+
* Specify a path that ends with `.json` to output the raw JSON metadata.
|
|
2826
|
+
*
|
|
2827
|
+
* @default '.vite/license.md'
|
|
2691
2828
|
*/
|
|
2692
|
-
|
|
2829
|
+
fileName: string;
|
|
2830
|
+
}
|
|
2831
|
+
//#endregion
|
|
2832
|
+
//#region src/node/plugins/terser.d.ts
|
|
2833
|
+
interface TerserOptions extends TerserMinifyOptions {
|
|
2693
2834
|
/**
|
|
2694
|
-
*
|
|
2835
|
+
* Vite-specific option to specify the max number of workers to spawn
|
|
2836
|
+
* when minifying files with terser.
|
|
2837
|
+
*
|
|
2838
|
+
* @default number of CPUs minus 1
|
|
2695
2839
|
*/
|
|
2696
|
-
|
|
2840
|
+
maxWorkers?: number;
|
|
2841
|
+
}
|
|
2842
|
+
//#endregion
|
|
2843
|
+
//#region src/node/build.d.ts
|
|
2844
|
+
interface BuildEnvironmentOptions {
|
|
2697
2845
|
/**
|
|
2698
|
-
*
|
|
2699
|
-
* and
|
|
2846
|
+
* Compatibility transform target. The transform is performed with esbuild
|
|
2847
|
+
* and the lowest supported target is es2015. Note this only handles
|
|
2848
|
+
* syntax transformation and does not cover polyfills
|
|
2849
|
+
*
|
|
2850
|
+
* Default: 'baseline-widely-available' - transpile targeting browsers that
|
|
2851
|
+
* are included in the Baseline Widely Available on 2026-01-01.
|
|
2852
|
+
* (Chrome 111+, Edge 111+, Firefox 114+, Safari 16.4+).
|
|
2853
|
+
*
|
|
2854
|
+
* Another special value is 'esnext' - which only performs minimal transpiling
|
|
2855
|
+
* (for minification compat).
|
|
2856
|
+
*
|
|
2857
|
+
* For custom targets, see https://esbuild.github.io/api/#target and
|
|
2858
|
+
* https://esbuild.github.io/content-types/#javascript for more details.
|
|
2859
|
+
* @default 'baseline-widely-available'
|
|
2700
2860
|
*/
|
|
2701
|
-
|
|
2861
|
+
target?: "baseline-widely-available" | EsbuildTarget | false;
|
|
2702
2862
|
/**
|
|
2703
|
-
*
|
|
2704
|
-
*
|
|
2863
|
+
* whether to inject module preload polyfill.
|
|
2864
|
+
* Note: does not apply to library mode.
|
|
2865
|
+
* @default true
|
|
2866
|
+
* @deprecated use `modulePreload.polyfill` instead
|
|
2705
2867
|
*/
|
|
2706
|
-
|
|
2868
|
+
polyfillModulePreload?: boolean;
|
|
2707
2869
|
/**
|
|
2708
|
-
*
|
|
2709
|
-
*
|
|
2870
|
+
* Configure module preload
|
|
2871
|
+
* Note: does not apply to library mode.
|
|
2872
|
+
* @default true
|
|
2710
2873
|
*/
|
|
2711
|
-
|
|
2874
|
+
modulePreload?: boolean | ModulePreloadOptions;
|
|
2712
2875
|
/**
|
|
2713
|
-
*
|
|
2714
|
-
*
|
|
2715
|
-
*
|
|
2876
|
+
* Directory relative from `root` where build output will be placed. If the
|
|
2877
|
+
* directory exists, it will be removed before the build.
|
|
2878
|
+
* @default 'dist'
|
|
2716
2879
|
*/
|
|
2717
|
-
|
|
2880
|
+
outDir?: string;
|
|
2718
2881
|
/**
|
|
2719
|
-
*
|
|
2882
|
+
* Directory relative from `outDir` where the built js/css/image assets will
|
|
2883
|
+
* be placed.
|
|
2884
|
+
* @default 'assets'
|
|
2720
2885
|
*/
|
|
2721
|
-
|
|
2886
|
+
assetsDir?: string;
|
|
2722
2887
|
/**
|
|
2723
|
-
*
|
|
2888
|
+
* Static asset files smaller than this number (in bytes) will be inlined as
|
|
2889
|
+
* base64 strings. If a callback is passed, a boolean can be returned to opt-in
|
|
2890
|
+
* or opt-out of inlining. If nothing is returned the default logic applies.
|
|
2891
|
+
*
|
|
2892
|
+
* Default limit is `4096` (4 KiB). Set to `0` to disable.
|
|
2893
|
+
* @default 4096
|
|
2724
2894
|
*/
|
|
2725
|
-
|
|
2726
|
-
mappings: "";
|
|
2727
|
-
} | null, url: string, originalCode?: string): Promise<TransformResult | null>;
|
|
2895
|
+
assetsInlineLimit?: number | ((filePath: string, content: Buffer) => boolean | undefined);
|
|
2728
2896
|
/**
|
|
2729
|
-
*
|
|
2897
|
+
* Whether to code-split CSS. When enabled, CSS in async chunks will be
|
|
2898
|
+
* inlined as strings in the chunk and inserted via dynamically created
|
|
2899
|
+
* style tags when the chunk is loaded.
|
|
2900
|
+
* @default true
|
|
2730
2901
|
*/
|
|
2731
|
-
|
|
2732
|
-
fixStacktrace?: boolean;
|
|
2733
|
-
}): Promise<Record<string, any>>;
|
|
2902
|
+
cssCodeSplit?: boolean;
|
|
2734
2903
|
/**
|
|
2735
|
-
*
|
|
2904
|
+
* An optional separate target for CSS minification.
|
|
2905
|
+
* As esbuild only supports configuring targets to mainstream
|
|
2906
|
+
* browsers, users may need this option when they are targeting
|
|
2907
|
+
* a niche browser that comes with most modern JavaScript features
|
|
2908
|
+
* but has poor CSS support, e.g. Android WeChat WebView, which
|
|
2909
|
+
* doesn't support the #RGBA syntax.
|
|
2910
|
+
* When `build.cssMinify` is `lightningcss` (the default), this
|
|
2911
|
+
* option takes precedence over `css.lightningcss.targets` for the
|
|
2912
|
+
* minification step.
|
|
2913
|
+
* @default target
|
|
2736
2914
|
*/
|
|
2737
|
-
|
|
2915
|
+
cssTarget?: EsbuildTarget | false;
|
|
2738
2916
|
/**
|
|
2739
|
-
*
|
|
2917
|
+
* Override CSS minification specifically instead of defaulting to `build.minify`,
|
|
2918
|
+
* so you can configure minification for JS and CSS separately.
|
|
2919
|
+
* @default 'lightningcss', but false if build.minify is disabled for client build
|
|
2740
2920
|
*/
|
|
2741
|
-
|
|
2921
|
+
cssMinify?: boolean | "lightningcss" | "esbuild";
|
|
2742
2922
|
/**
|
|
2743
|
-
*
|
|
2744
|
-
*
|
|
2923
|
+
* If `true`, a separate sourcemap file will be created. If 'inline', the
|
|
2924
|
+
* sourcemap will be appended to the resulting output file as data URI.
|
|
2925
|
+
* 'hidden' works like `true` except that the corresponding sourcemap
|
|
2926
|
+
* comments in the bundled files are suppressed.
|
|
2927
|
+
* @default false
|
|
2745
2928
|
*/
|
|
2746
|
-
|
|
2929
|
+
sourcemap?: boolean | "inline" | "hidden";
|
|
2747
2930
|
/**
|
|
2748
|
-
*
|
|
2931
|
+
* Set to `false` to disable minification, or specify the minifier to use.
|
|
2932
|
+
* Available options are 'oxc' or 'terser' or 'esbuild'.
|
|
2933
|
+
* @default 'oxc' for client build, false for SSR build
|
|
2749
2934
|
*/
|
|
2750
|
-
|
|
2935
|
+
minify?: boolean | "oxc" | "terser" | "esbuild";
|
|
2751
2936
|
/**
|
|
2752
|
-
*
|
|
2937
|
+
* Options for terser
|
|
2938
|
+
* https://terser.org/docs/api-reference#minify-options
|
|
2939
|
+
*
|
|
2940
|
+
* In addition, you can also pass a `maxWorkers: number` option to specify the
|
|
2941
|
+
* max number of workers to spawn. Defaults to the number of CPUs minus 1.
|
|
2753
2942
|
*/
|
|
2754
|
-
|
|
2943
|
+
terserOptions?: TerserOptions;
|
|
2755
2944
|
/**
|
|
2756
|
-
*
|
|
2945
|
+
* Whether to use import maps feature to optimize chunk caching efficiency.
|
|
2946
|
+
* @default false
|
|
2947
|
+
* @experimental
|
|
2757
2948
|
*/
|
|
2758
|
-
|
|
2949
|
+
chunkImportMap?: boolean;
|
|
2759
2950
|
/**
|
|
2760
|
-
*
|
|
2951
|
+
* Alias to `rolldownOptions`
|
|
2952
|
+
* @deprecated Use `rolldownOptions` instead.
|
|
2761
2953
|
*/
|
|
2762
|
-
|
|
2954
|
+
rollupOptions?: RolldownOptions;
|
|
2763
2955
|
/**
|
|
2764
|
-
*
|
|
2765
|
-
*
|
|
2766
|
-
* @param forceOptimize - force the optimizer to re-bundle, same as --force cli flag
|
|
2956
|
+
* Will be merged with internal rolldown options.
|
|
2957
|
+
* https://rolldown.rs/reference/Interface.RolldownOptions
|
|
2767
2958
|
*/
|
|
2768
|
-
|
|
2959
|
+
rolldownOptions?: RolldownOptions;
|
|
2769
2960
|
/**
|
|
2770
|
-
*
|
|
2961
|
+
* Options to pass on to `@rollup/plugin-commonjs`
|
|
2962
|
+
* @deprecated This option is no-op and will be removed in future versions.
|
|
2771
2963
|
*/
|
|
2772
|
-
|
|
2964
|
+
commonjsOptions?: RollupCommonJSOptions;
|
|
2773
2965
|
/**
|
|
2774
|
-
*
|
|
2775
|
-
* are processed. If called from a load or transform plugin hook, the id needs to be
|
|
2776
|
-
* passed as a parameter to avoid deadlocks. Calling this function after the first
|
|
2777
|
-
* static imports section of the module graph has been processed will resolve immediately.
|
|
2966
|
+
* Options to pass on to `@rollup/plugin-dynamic-import-vars`
|
|
2778
2967
|
*/
|
|
2779
|
-
|
|
2780
|
-
}
|
|
2781
|
-
interface ResolvedServerUrls {
|
|
2782
|
-
local: string[];
|
|
2783
|
-
network: string[];
|
|
2968
|
+
dynamicImportVarsOptions?: RollupDynamicImportVarsOptions;
|
|
2784
2969
|
/**
|
|
2785
|
-
*
|
|
2786
|
-
*
|
|
2787
|
-
* when the interface name is not known, for example when an explicit `host`
|
|
2788
|
-
* is set.
|
|
2970
|
+
* Whether to write bundle to disk
|
|
2971
|
+
* @default true
|
|
2789
2972
|
*/
|
|
2790
|
-
|
|
2791
|
-
}
|
|
2792
|
-
declare function createServer(inlineConfig?: InlineConfig | ResolvedConfig): Promise<ViteDevServer>;
|
|
2793
|
-
//#endregion
|
|
2794
|
-
//#region src/node/plugins/html.d.ts
|
|
2795
|
-
interface HtmlTagDescriptor {
|
|
2796
|
-
tag: string;
|
|
2973
|
+
write?: boolean;
|
|
2797
2974
|
/**
|
|
2798
|
-
*
|
|
2975
|
+
* Empty outDir on write.
|
|
2976
|
+
* @default true when outDir is a sub directory of project root
|
|
2799
2977
|
*/
|
|
2800
|
-
|
|
2801
|
-
children?: string | HtmlTagDescriptor[];
|
|
2978
|
+
emptyOutDir?: boolean | null;
|
|
2802
2979
|
/**
|
|
2803
|
-
*
|
|
2980
|
+
* Copy the public directory to outDir on write.
|
|
2981
|
+
* @default true
|
|
2804
2982
|
*/
|
|
2805
|
-
|
|
2806
|
-
}
|
|
2807
|
-
type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
|
|
2808
|
-
html: string;
|
|
2809
|
-
tags: HtmlTagDescriptor[];
|
|
2810
|
-
};
|
|
2811
|
-
interface IndexHtmlTransformContext {
|
|
2983
|
+
copyPublicDir?: boolean;
|
|
2812
2984
|
/**
|
|
2813
|
-
*
|
|
2985
|
+
* Whether to emit a `.vite/license.md` file that includes all bundled dependencies'
|
|
2986
|
+
* licenses. Pass an object to customize the output file name.
|
|
2987
|
+
* @default false
|
|
2814
2988
|
*/
|
|
2815
|
-
|
|
2989
|
+
license?: boolean | LicenseOptions;
|
|
2816
2990
|
/**
|
|
2817
|
-
*
|
|
2991
|
+
* Whether to emit a .vite/manifest.json in the output dir to map hash-less filenames
|
|
2992
|
+
* to their hashed versions. Useful when you want to generate your own HTML
|
|
2993
|
+
* instead of using the one generated by Vite.
|
|
2994
|
+
*
|
|
2995
|
+
* Example:
|
|
2996
|
+
*
|
|
2997
|
+
* ```json
|
|
2998
|
+
* {
|
|
2999
|
+
* "main.js": {
|
|
3000
|
+
* "file": "main.68fe3fad.js",
|
|
3001
|
+
* "css": "main.e6b63442.css",
|
|
3002
|
+
* "imports": [...],
|
|
3003
|
+
* "dynamicImports": [...]
|
|
3004
|
+
* }
|
|
3005
|
+
* }
|
|
3006
|
+
* ```
|
|
3007
|
+
* @default false
|
|
2818
3008
|
*/
|
|
2819
|
-
|
|
2820
|
-
server?: ViteDevServer;
|
|
2821
|
-
bundle?: OutputBundle;
|
|
2822
|
-
chunk?: OutputChunk;
|
|
2823
|
-
originalUrl?: string;
|
|
2824
|
-
}
|
|
2825
|
-
type IndexHtmlTransformHook = (this: MinimalPluginContextWithoutEnvironment, html: string, ctx: IndexHtmlTransformContext) => IndexHtmlTransformResult | void | Promise<IndexHtmlTransformResult | void>;
|
|
2826
|
-
type IndexHtmlTransform = IndexHtmlTransformHook | {
|
|
2827
|
-
order?: "pre" | "post" | null;
|
|
2828
|
-
handler: IndexHtmlTransformHook;
|
|
2829
|
-
};
|
|
2830
|
-
//#endregion
|
|
2831
|
-
//#region src/node/plugins/pluginFilter.d.ts
|
|
2832
|
-
type StringFilter<Value = string | RegExp> = Value | Array<Value> | {
|
|
2833
|
-
include?: Value | Array<Value>;
|
|
2834
|
-
exclude?: Value | Array<Value>;
|
|
2835
|
-
};
|
|
2836
|
-
//#endregion
|
|
2837
|
-
//#region src/node/plugin.d.ts
|
|
2838
|
-
/**
|
|
2839
|
-
* Vite plugins extends the Rollup plugin interface with a few extra
|
|
2840
|
-
* vite-specific options. A valid vite plugin is also a valid Rollup plugin.
|
|
2841
|
-
* On the contrary, a Rollup plugin may or may NOT be a valid vite universal
|
|
2842
|
-
* plugin, since some Rollup features do not make sense in an unbundled
|
|
2843
|
-
* dev server context. That said, as long as a rollup plugin doesn't have strong
|
|
2844
|
-
* coupling between its bundle phase and output phase hooks then it should
|
|
2845
|
-
* just work (that means, most of them).
|
|
2846
|
-
*
|
|
2847
|
-
* By default, the plugins are run during both serve and build. When a plugin
|
|
2848
|
-
* is applied during serve, it will only run **non output plugin hooks** (see
|
|
2849
|
-
* rollup type definition of {@link rollup#PluginHooks}). You can think of the
|
|
2850
|
-
* dev server as only running `const bundle = rollup.rollup()` but never calling
|
|
2851
|
-
* `bundle.generate()`.
|
|
2852
|
-
*
|
|
2853
|
-
* A plugin that expects to have different behavior depending on serve/build can
|
|
2854
|
-
* export a factory function that receives the command being run via options.
|
|
2855
|
-
*
|
|
2856
|
-
* If a plugin should be applied only for server or build, a function format
|
|
2857
|
-
* config file can be used to conditional determine the plugins to use.
|
|
2858
|
-
*
|
|
2859
|
-
* The current environment can be accessed from the context for the all non-global
|
|
2860
|
-
* hooks (it is not available in config, configResolved, configureServer, etc).
|
|
2861
|
-
* It can be a dev, build, or scan environment.
|
|
2862
|
-
* Plugins can use this.environment.mode === 'dev' to guard for dev specific APIs.
|
|
2863
|
-
*/
|
|
2864
|
-
interface PluginContextExtension {
|
|
3009
|
+
manifest?: boolean | string;
|
|
2865
3010
|
/**
|
|
2866
|
-
*
|
|
3011
|
+
* Build in library mode. The value should be the global name of the lib in
|
|
3012
|
+
* UMD mode. This will produce esm + cjs + umd bundle formats with default
|
|
3013
|
+
* configurations that are suitable for distributing libraries.
|
|
3014
|
+
* @default false
|
|
2867
3015
|
*/
|
|
2868
|
-
|
|
2869
|
-
}
|
|
2870
|
-
interface PluginContextMetaExtension {
|
|
2871
|
-
viteVersion: string;
|
|
2872
|
-
}
|
|
2873
|
-
interface ConfigPluginContext extends Omit<MinimalPluginContext, "meta" | "environment"> {
|
|
2874
|
-
meta: Omit<PluginContextMeta, "watchMode">;
|
|
2875
|
-
}
|
|
2876
|
-
interface MinimalPluginContextWithoutEnvironment extends Omit<MinimalPluginContext, "environment"> {}
|
|
2877
|
-
declare module "rolldown" {
|
|
2878
|
-
interface MinimalPluginContext extends PluginContextExtension {}
|
|
2879
|
-
interface PluginContextMeta extends PluginContextMetaExtension {}
|
|
2880
|
-
}
|
|
2881
|
-
/**
|
|
2882
|
-
* There are two types of plugins in Vite. App plugins and environment plugins.
|
|
2883
|
-
* Environment Plugins are defined by a constructor function that will be called
|
|
2884
|
-
* once per each environment allowing users to have completely different plugins
|
|
2885
|
-
* for each of them. The constructor gets the resolved environment after the server
|
|
2886
|
-
* and builder has already been created simplifying config access and cache
|
|
2887
|
-
* management for environment specific plugins.
|
|
2888
|
-
* Environment Plugins are closer to regular rollup plugins. They can't define
|
|
2889
|
-
* app level hooks (like config, configResolved, configureServer, etc).
|
|
2890
|
-
*/
|
|
2891
|
-
interface Plugin<A = any> extends Rolldown.Plugin<A> {
|
|
3016
|
+
lib?: LibraryOptions | false;
|
|
2892
3017
|
/**
|
|
2893
|
-
*
|
|
2894
|
-
*
|
|
2895
|
-
*
|
|
2896
|
-
*
|
|
2897
|
-
* - The hook can return a filtered list of modules to narrow down the update.
|
|
2898
|
-
* e.g. for a Vue SFC, we can narrow down the part to update by comparing
|
|
2899
|
-
* the descriptors.
|
|
2900
|
-
*
|
|
2901
|
-
* - The hook can also return an empty array and then perform custom updates
|
|
2902
|
-
* by sending a custom hmr payload via environment.hot.send().
|
|
2903
|
-
*
|
|
2904
|
-
* - If the hook doesn't return a value, the hmr update will be performed as
|
|
2905
|
-
* normal.
|
|
3018
|
+
* Produce SSR oriented build. Note this requires specifying SSR entry via
|
|
3019
|
+
* `rolldownOptions.input`.
|
|
3020
|
+
* @default false
|
|
2906
3021
|
*/
|
|
2907
|
-
|
|
2908
|
-
environment: DevEnvironment;
|
|
2909
|
-
}, options: HotUpdateOptions) => Array<EnvironmentModuleNode> | void | Promise<Array<EnvironmentModuleNode> | void>>;
|
|
3022
|
+
ssr?: boolean | string;
|
|
2910
3023
|
/**
|
|
2911
|
-
*
|
|
3024
|
+
* Generate SSR manifest for determining style links and asset preload
|
|
3025
|
+
* directives in production.
|
|
3026
|
+
* @default false
|
|
2912
3027
|
*/
|
|
2913
|
-
|
|
2914
|
-
kind?: ImportKind;
|
|
2915
|
-
custom?: CustomPluginOptions;
|
|
2916
|
-
ssr?: boolean | undefined;
|
|
2917
|
-
|
|
2918
|
-
isEntry: boolean;
|
|
2919
|
-
}) => Promise<ResolveIdResult> | ResolveIdResult, {
|
|
2920
|
-
filter?: {
|
|
2921
|
-
id?: StringFilter<RegExp>;
|
|
2922
|
-
};
|
|
2923
|
-
}>;
|
|
2924
|
-
load?: ObjectHook<(this: PluginContext, id: string, options?: {
|
|
2925
|
-
ssr?: boolean | undefined;
|
|
2926
|
-
}) => Promise<LoadResult> | LoadResult, {
|
|
2927
|
-
filter?: {
|
|
2928
|
-
id?: StringFilter;
|
|
2929
|
-
};
|
|
2930
|
-
}>;
|
|
2931
|
-
transform?: ObjectHook<(this: TransformPluginContext, code: string, id: string, options?: {
|
|
2932
|
-
moduleType: ModuleType;
|
|
2933
|
-
ssr?: boolean | undefined;
|
|
2934
|
-
}) => Promise<Rolldown.TransformResult> | Rolldown.TransformResult, {
|
|
2935
|
-
filter?: {
|
|
2936
|
-
id?: StringFilter;
|
|
2937
|
-
code?: StringFilter;
|
|
2938
|
-
moduleType?: ModuleTypeFilter;
|
|
2939
|
-
};
|
|
2940
|
-
}>;
|
|
3028
|
+
ssrManifest?: boolean | string;
|
|
2941
3029
|
/**
|
|
2942
|
-
*
|
|
2943
|
-
*
|
|
2944
|
-
* during `vite build --app`
|
|
2945
|
-
* We have an opt-in per plugin, and a general `builder.sharedPlugins`
|
|
2946
|
-
* In a future major, we'll flip the default to be shared by default
|
|
2947
|
-
* @experimental
|
|
3030
|
+
* Emit assets during SSR.
|
|
3031
|
+
* @default false
|
|
2948
3032
|
*/
|
|
2949
|
-
|
|
3033
|
+
ssrEmitAssets?: boolean;
|
|
2950
3034
|
/**
|
|
2951
|
-
*
|
|
2952
|
-
*
|
|
2953
|
-
* dev, for the client environment. Plugins can opt-in to be called
|
|
2954
|
-
* per-environment, aligning with the build hook behavior.
|
|
2955
|
-
* @experimental
|
|
3035
|
+
* Emit assets during build. Frameworks can set environments.ssr.build.emitAssets
|
|
3036
|
+
* By default, it is true for the client and false for other environments.
|
|
2956
3037
|
*/
|
|
2957
|
-
|
|
3038
|
+
emitAssets?: boolean;
|
|
2958
3039
|
/**
|
|
2959
|
-
*
|
|
2960
|
-
*
|
|
2961
|
-
*
|
|
2962
|
-
* per-environment, aligning with the watchChange hook behavior.
|
|
2963
|
-
* @experimental
|
|
3040
|
+
* Set to false to disable reporting compressed chunk sizes.
|
|
3041
|
+
* Can slightly improve build speed.
|
|
3042
|
+
* @default true
|
|
2964
3043
|
*/
|
|
2965
|
-
|
|
3044
|
+
reportCompressedSize?: boolean;
|
|
2966
3045
|
/**
|
|
2967
|
-
*
|
|
2968
|
-
*
|
|
2969
|
-
*
|
|
2970
|
-
* Plugin invocation order:
|
|
2971
|
-
* - alias resolution
|
|
2972
|
-
* - `enforce: 'pre'` plugins
|
|
2973
|
-
* - vite core plugins
|
|
2974
|
-
* - normal plugins
|
|
2975
|
-
* - vite build plugins
|
|
2976
|
-
* - `enforce: 'post'` plugins
|
|
2977
|
-
* - vite build post plugins
|
|
3046
|
+
* Adjust chunk size warning limit (in kB).
|
|
3047
|
+
* @default 500
|
|
2978
3048
|
*/
|
|
2979
|
-
|
|
3049
|
+
chunkSizeWarningLimit?: number;
|
|
2980
3050
|
/**
|
|
2981
|
-
*
|
|
3051
|
+
* Rollup watch options
|
|
3052
|
+
* https://rollupjs.org/configuration-options/#watch
|
|
3053
|
+
* @default null
|
|
2982
3054
|
*/
|
|
2983
|
-
|
|
3055
|
+
watch?: WatcherOptions | null;
|
|
2984
3056
|
/**
|
|
2985
|
-
*
|
|
2986
|
-
* By default, the plugin is active in all environments
|
|
2987
|
-
* @experimental
|
|
3057
|
+
* create the Build Environment instance
|
|
2988
3058
|
*/
|
|
2989
|
-
|
|
3059
|
+
createEnvironment?: (name: string, config: ResolvedConfig) => Promise<BuildEnvironment> | BuildEnvironment;
|
|
3060
|
+
}
|
|
3061
|
+
type BuildOptions = BuildEnvironmentOptions;
|
|
3062
|
+
interface LibraryOptions {
|
|
2990
3063
|
/**
|
|
2991
|
-
*
|
|
2992
|
-
*
|
|
2993
|
-
* deeply merged into existing config.
|
|
2994
|
-
*
|
|
2995
|
-
* Note: User plugins are resolved before running this hook so injecting other
|
|
2996
|
-
* plugins inside the `config` hook will have no effect.
|
|
3064
|
+
* Path of library entry.
|
|
3065
|
+
* Defaults to the top-level `input` option when omitted.
|
|
2997
3066
|
*/
|
|
2998
|
-
|
|
3067
|
+
entry?: InputOption;
|
|
2999
3068
|
/**
|
|
3000
|
-
*
|
|
3001
|
-
*
|
|
3002
|
-
* deeply merged into existing config.
|
|
3003
|
-
* This hook is called for each environment with a partially resolved environment config
|
|
3004
|
-
* that already accounts for the default environment config values set at the root level.
|
|
3005
|
-
* If plugins need to modify the config of a given environment, they should do it in this
|
|
3006
|
-
* hook instead of the config hook. Leaving the config hook only for modifying the root
|
|
3007
|
-
* default environment config.
|
|
3069
|
+
* The name of the exposed global variable. Required when the `formats` option includes
|
|
3070
|
+
* `umd` or `iife`
|
|
3008
3071
|
*/
|
|
3009
|
-
|
|
3010
|
-
/**
|
|
3011
|
-
* Whether this environment is SSR environment and `ssr.target` is set to `'webworker'`.
|
|
3012
|
-
* Only intended to be used for backward compatibility.
|
|
3013
|
-
*/
|
|
3014
|
-
isSsrTargetWebworker?: boolean;
|
|
3015
|
-
}) => EnvironmentOptions | null | void | Promise<EnvironmentOptions | null | void>>;
|
|
3072
|
+
name?: string;
|
|
3016
3073
|
/**
|
|
3017
|
-
*
|
|
3074
|
+
* Output bundle formats. Defaults to `['es', 'umd']` for a single entry, or
|
|
3075
|
+
* `['es', 'cjs']` for multiple entries (`umd` and `iife` do not support
|
|
3076
|
+
* multiple entries).
|
|
3077
|
+
* @default ['es', 'umd']
|
|
3018
3078
|
*/
|
|
3019
|
-
|
|
3079
|
+
formats?: LibraryFormats[];
|
|
3020
3080
|
/**
|
|
3021
|
-
*
|
|
3022
|
-
*
|
|
3023
|
-
*
|
|
3024
|
-
*
|
|
3025
|
-
* The hooks will be called before internal middlewares are applied. A hook
|
|
3026
|
-
* can return a post hook that will be called after internal middlewares
|
|
3027
|
-
* are applied. Hook can be async functions and will be called in series.
|
|
3081
|
+
* The name of the package file output. The default file name is the name option
|
|
3082
|
+
* of the project package.json. It can also be defined as a function taking the
|
|
3083
|
+
* format as an argument.
|
|
3028
3084
|
*/
|
|
3029
|
-
|
|
3085
|
+
fileName?: string | ((format: ModuleFormat, entryName: string) => string);
|
|
3030
3086
|
/**
|
|
3031
|
-
*
|
|
3032
|
-
*
|
|
3033
|
-
*
|
|
3034
|
-
*
|
|
3035
|
-
* The hooks are called before other middlewares are applied. A hook can
|
|
3036
|
-
* return a post hook that will be called after other middlewares are
|
|
3037
|
-
* applied. Hooks can be async functions and will be called in series.
|
|
3087
|
+
* The name of the CSS file output if the library imports CSS. Defaults to the
|
|
3088
|
+
* same value as `build.lib.fileName` if it's set a string, otherwise it falls
|
|
3089
|
+
* back to the name option of the project package.json.
|
|
3038
3090
|
*/
|
|
3039
|
-
|
|
3091
|
+
cssFileName?: string;
|
|
3092
|
+
}
|
|
3093
|
+
type LibraryFormats = "es" | "cjs" | "umd" | "iife";
|
|
3094
|
+
interface ModulePreloadOptions {
|
|
3040
3095
|
/**
|
|
3041
|
-
*
|
|
3042
|
-
*
|
|
3043
|
-
*
|
|
3044
|
-
* - html: string
|
|
3045
|
-
* - ctx: IndexHtmlTransformContext, which contains:
|
|
3046
|
-
* - path: public path when served
|
|
3047
|
-
* - filename: filename on disk
|
|
3048
|
-
* - server?: ViteDevServer (only present during serve)
|
|
3049
|
-
* - bundle?: rollup.OutputBundle (only present during build)
|
|
3050
|
-
* - chunk?: rollup.OutputChunk
|
|
3051
|
-
* - originalUrl?: string
|
|
3052
|
-
*
|
|
3053
|
-
* It can either return a transformed string, or a list of html tag
|
|
3054
|
-
* descriptors that will be injected into the `<head>` or `<body>`.
|
|
3055
|
-
*
|
|
3056
|
-
* By default the transform is applied **after** vite's internal html
|
|
3057
|
-
* transform. If you need to apply the transform before vite, use an object:
|
|
3058
|
-
* `{ order: 'pre', handler: hook }`
|
|
3096
|
+
* Whether to inject a module preload polyfill.
|
|
3097
|
+
* Note: does not apply to library mode.
|
|
3098
|
+
* @default true
|
|
3059
3099
|
*/
|
|
3060
|
-
|
|
3100
|
+
polyfill?: boolean;
|
|
3061
3101
|
/**
|
|
3062
|
-
*
|
|
3063
|
-
*
|
|
3102
|
+
* Resolve the list of dependencies to preload for a given dynamic import
|
|
3064
3103
|
* @experimental
|
|
3065
3104
|
*/
|
|
3066
|
-
|
|
3105
|
+
resolveDependencies?: ResolveModulePreloadDependenciesFn;
|
|
3106
|
+
}
|
|
3107
|
+
interface ResolvedModulePreloadOptions {
|
|
3108
|
+
polyfill: boolean;
|
|
3109
|
+
resolveDependencies?: ResolveModulePreloadDependenciesFn;
|
|
3110
|
+
}
|
|
3111
|
+
type ResolveModulePreloadDependenciesFn = (filename: string, deps: string[], context: {
|
|
3112
|
+
hostId: string;
|
|
3113
|
+
hostType: "html" | "js";
|
|
3114
|
+
}) => string[];
|
|
3115
|
+
interface ResolvedBuildEnvironmentOptions extends Required<Omit<BuildEnvironmentOptions, "polyfillModulePreload">> {
|
|
3116
|
+
modulePreload: false | ResolvedModulePreloadOptions;
|
|
3117
|
+
}
|
|
3118
|
+
interface ResolvedBuildOptions extends Required<Omit<BuildOptions, "polyfillModulePreload">> {
|
|
3119
|
+
modulePreload: false | ResolvedModulePreloadOptions;
|
|
3120
|
+
}
|
|
3121
|
+
/**
|
|
3122
|
+
* Bundles a single environment for production.
|
|
3123
|
+
* Returns a Promise containing the build result.
|
|
3124
|
+
*/
|
|
3125
|
+
export declare function build(inlineConfig?: InlineConfig): Promise<RolldownOutput | RolldownOutput[] | RolldownWatcher>;
|
|
3126
|
+
type RenderBuiltAssetUrl = (filename: string, type: {
|
|
3127
|
+
type: "asset" | "public";
|
|
3128
|
+
hostId: string;
|
|
3129
|
+
hostType: "js" | "css" | "html";
|
|
3130
|
+
ssr: boolean;
|
|
3131
|
+
}) => string | {
|
|
3132
|
+
relative?: boolean;
|
|
3133
|
+
runtime?: string;
|
|
3134
|
+
} | undefined;
|
|
3135
|
+
export declare class BuildEnvironment extends BaseEnvironment {
|
|
3136
|
+
mode: "build";
|
|
3137
|
+
isBuilt: boolean;
|
|
3138
|
+
constructor(name: string, config: ResolvedConfig, setup?: {
|
|
3139
|
+
options?: EnvironmentOptions;
|
|
3140
|
+
});
|
|
3141
|
+
init(): Promise<void>;
|
|
3142
|
+
}
|
|
3143
|
+
interface ViteBuilder {
|
|
3144
|
+
environments: Record<string, BuildEnvironment>;
|
|
3145
|
+
config: ResolvedConfig;
|
|
3146
|
+
buildApp(): Promise<void>;
|
|
3147
|
+
build(environment: BuildEnvironment): Promise<RolldownOutput | RolldownOutput[] | RolldownWatcher>;
|
|
3148
|
+
runDevTools(): Promise<void>;
|
|
3149
|
+
}
|
|
3150
|
+
interface BuilderOptions {
|
|
3067
3151
|
/**
|
|
3068
|
-
*
|
|
3069
|
-
* The handler receives a context containing changed filename, timestamp, a
|
|
3070
|
-
* list of modules affected by the file change, and the dev server instance.
|
|
3071
|
-
*
|
|
3072
|
-
* - The hook can return a filtered list of modules to narrow down the update.
|
|
3073
|
-
* e.g. for a Vue SFC, we can narrow down the part to update by comparing
|
|
3074
|
-
* the descriptors.
|
|
3075
|
-
*
|
|
3076
|
-
* - The hook can also return an empty array and then perform custom updates
|
|
3077
|
-
* by sending a custom hmr payload via server.ws.send().
|
|
3152
|
+
* Whether to share the config instance among environments to align with the behavior of dev server.
|
|
3078
3153
|
*
|
|
3079
|
-
*
|
|
3080
|
-
*
|
|
3154
|
+
* @default false
|
|
3155
|
+
* @experimental
|
|
3081
3156
|
*/
|
|
3082
|
-
|
|
3157
|
+
sharedConfigBuild?: boolean;
|
|
3083
3158
|
/**
|
|
3084
|
-
*
|
|
3159
|
+
* Whether to share the plugin instances among environments to align with the behavior of dev server.
|
|
3085
3160
|
*
|
|
3086
|
-
* @
|
|
3161
|
+
* @default false
|
|
3162
|
+
* @experimental
|
|
3087
3163
|
*/
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
id: string;
|
|
3091
|
-
meta: CustomPluginOptions;
|
|
3092
|
-
moduleSideEffects: boolean | "no-treeshake";
|
|
3093
|
-
}) => boolean | null | void>;
|
|
3164
|
+
sharedPlugins?: boolean;
|
|
3165
|
+
buildApp?: (builder: ViteBuilder) => Promise<void>;
|
|
3094
3166
|
}
|
|
3095
|
-
type
|
|
3096
|
-
type PluginWithRequiredHook<K extends keyof Plugin> = Plugin & { [P in K]: NonNullable<Plugin[P]>; };
|
|
3097
|
-
type Thenable<T> = T | Promise<T>;
|
|
3098
|
-
type FalsyPlugin = false | null | undefined;
|
|
3099
|
-
type PluginOption = Thenable<Plugin | {
|
|
3100
|
-
name: string;
|
|
3101
|
-
} | FalsyPlugin | PluginOption[]>;
|
|
3167
|
+
type ResolvedBuilderOptions = Required<BuilderOptions>;
|
|
3102
3168
|
/**
|
|
3169
|
+
* Creates a ViteBuilder to orchestrate building multiple environments.
|
|
3103
3170
|
* @experimental
|
|
3104
3171
|
*/
|
|
3105
|
-
declare function
|
|
3172
|
+
export declare function createBuilder(inlineConfig?: InlineConfig, useLegacyBuilder?: null | boolean): Promise<ViteBuilder>;
|
|
3173
|
+
type BuildAppHook = (this: MinimalPluginContextWithoutEnvironment, builder: ViteBuilder) => Promise<void>;
|
|
3106
3174
|
//#endregion
|
|
3107
3175
|
//#region src/node/idResolver.d.ts
|
|
3108
3176
|
type ResolveIdFn = (environment: PartialEnvironment, id: string, importer?: string, aliasOnly?: boolean) => Promise<string | undefined>;
|
|
@@ -3110,9 +3178,9 @@ type ResolveIdFn = (environment: PartialEnvironment, id: string, importer?: stri
|
|
|
3110
3178
|
* Create an internal resolver to be used in special scenarios, e.g.
|
|
3111
3179
|
* optimizer and handling css @imports
|
|
3112
3180
|
*/
|
|
3113
|
-
declare function createIdResolver(config: ResolvedConfig, options?: Partial<InternalResolveOptions>): ResolveIdFn;
|
|
3181
|
+
export declare function createIdResolver(config: ResolvedConfig, options?: Partial<InternalResolveOptions>): ResolveIdFn;
|
|
3114
3182
|
//#endregion
|
|
3115
|
-
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.
|
|
3183
|
+
//#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.26_tsx@4.23.13_yaml@2.9.0/node_modules/postcss-load-config/src/index.d.ts
|
|
3116
3184
|
type ConfigPlugin = Transformer | PostCSS.Plugin | Processor;
|
|
3117
3185
|
interface Config {
|
|
3118
3186
|
parser?: string | ProcessOptions['parser'] | false;
|
|
@@ -3197,8 +3265,8 @@ interface PreprocessCSSResult {
|
|
|
3197
3265
|
/**
|
|
3198
3266
|
* @experimental
|
|
3199
3267
|
*/
|
|
3200
|
-
declare function preprocessCSS(code: string, filename: string, config: ResolvedConfig): Promise<PreprocessCSSResult>;
|
|
3201
|
-
declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise<ExistingRawSourceMap>;
|
|
3268
|
+
export declare function preprocessCSS(code: string, filename: string, config: ResolvedConfig): Promise<PreprocessCSSResult>;
|
|
3269
|
+
export declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise<ExistingRawSourceMap>;
|
|
3202
3270
|
type PreprocessorAdditionalDataResult = string | {
|
|
3203
3271
|
content: string;
|
|
3204
3272
|
map?: ExistingRawSourceMap;
|
|
@@ -3227,7 +3295,7 @@ interface ESBuildOptions extends esbuildOptions_EsbuildTransformOptions {
|
|
|
3227
3295
|
type ESBuildTransformResult = Omit<EsbuildTransformResult, "map"> & {
|
|
3228
3296
|
map: SourceMap;
|
|
3229
3297
|
};
|
|
3230
|
-
declare function transformWithEsbuild(code: string, filename: string, options?: esbuildOptions_EsbuildTransformOptions, inMap?: object, config?: ResolvedConfig, watcher?: FSWatcher, ignoreEsbuildWarning?: boolean): Promise<ESBuildTransformResult>;
|
|
3298
|
+
export declare function transformWithEsbuild(code: string, filename: string, options?: esbuildOptions_EsbuildTransformOptions, inMap?: object, config?: ResolvedConfig, watcher?: FSWatcher, ignoreEsbuildWarning?: boolean): Promise<ESBuildTransformResult>;
|
|
3231
3299
|
//#endregion
|
|
3232
3300
|
//#region src/node/plugins/json.d.ts
|
|
3233
3301
|
interface JsonOptions {
|
|
@@ -3245,32 +3313,15 @@ interface JsonOptions {
|
|
|
3245
3313
|
stringify?: boolean | "auto";
|
|
3246
3314
|
}
|
|
3247
3315
|
//#endregion
|
|
3248
|
-
//#region src/node/
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
* Attributes that contain a single asset URL.
|
|
3256
|
-
* @example ['src', 'data-src-dark']
|
|
3257
|
-
*/
|
|
3258
|
-
srcAttributes?: string[];
|
|
3259
|
-
/**
|
|
3260
|
-
* Attributes that contain srcset-format URLs.
|
|
3261
|
-
* @example ['srcset', 'imagesrcset']
|
|
3262
|
-
*/
|
|
3263
|
-
srcsetAttributes?: string[];
|
|
3264
|
-
/**
|
|
3265
|
-
* Called before handling an attribute to determine if it should be processed.
|
|
3266
|
-
*/
|
|
3267
|
-
filter?: (data: HtmlAssetSourceFilterData) => boolean;
|
|
3268
|
-
}
|
|
3269
|
-
interface HtmlAssetSourceFilterData {
|
|
3270
|
-
key: string;
|
|
3271
|
-
value: string;
|
|
3272
|
-
attributes: Record<string, string>;
|
|
3316
|
+
//#region src/node/plugins/oxc.d.ts
|
|
3317
|
+
interface OxcOptions extends Omit<rolldown_utils_TransformOptions, "cwd" | "sourceType" | "lang" | "sourcemap" | "helpers" | "inject" | "tsconfig" | "inputMap"> {
|
|
3318
|
+
include?: string | RegExp | ReadonlyArray<string | RegExp>;
|
|
3319
|
+
exclude?: string | RegExp | ReadonlyArray<string | RegExp>;
|
|
3320
|
+
jsxInject?: string;
|
|
3321
|
+
jsxRefreshInclude?: string | RegExp | ReadonlyArray<string | RegExp>;
|
|
3322
|
+
jsxRefreshExclude?: string | RegExp | ReadonlyArray<string | RegExp>;
|
|
3273
3323
|
}
|
|
3324
|
+
export declare function transformWithOxc(code: string, filename: string, options?: rolldown_utils_TransformOptions, inMap?: object, config?: ResolvedConfig, watcher?: FSWatcher): Promise<Omit<rolldown_utils_TransformResult, "errors">>;
|
|
3274
3325
|
//#endregion
|
|
3275
3326
|
//#region src/node/ssr/index.d.ts
|
|
3276
3327
|
type SSRTarget = "node" | "webworker";
|
|
@@ -3317,16 +3368,6 @@ interface ResolvedSSROptions extends SSROptions {
|
|
|
3317
3368
|
optimizeDeps: SsrDepOptimizationConfig;
|
|
3318
3369
|
}
|
|
3319
3370
|
//#endregion
|
|
3320
|
-
//#region src/node/plugins/oxc.d.ts
|
|
3321
|
-
interface OxcOptions extends Omit<rolldown_utils_TransformOptions, "cwd" | "sourceType" | "lang" | "sourcemap" | "helpers" | "inject" | "tsconfig" | "inputMap"> {
|
|
3322
|
-
include?: string | RegExp | ReadonlyArray<string | RegExp>;
|
|
3323
|
-
exclude?: string | RegExp | ReadonlyArray<string | RegExp>;
|
|
3324
|
-
jsxInject?: string;
|
|
3325
|
-
jsxRefreshInclude?: string | RegExp | ReadonlyArray<string | RegExp>;
|
|
3326
|
-
jsxRefreshExclude?: string | RegExp | ReadonlyArray<string | RegExp>;
|
|
3327
|
-
}
|
|
3328
|
-
declare function transformWithOxc(code: string, filename: string, options?: rolldown_utils_TransformOptions, inMap?: object, config?: ResolvedConfig, watcher?: FSWatcher): Promise<Omit<rolldown_utils_TransformResult, "errors">>;
|
|
3329
|
-
//#endregion
|
|
3330
3371
|
//#region src/node/config.d.ts
|
|
3331
3372
|
interface ConfigEnv {
|
|
3332
3373
|
/**
|
|
@@ -3355,12 +3396,12 @@ type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFnObject |
|
|
|
3355
3396
|
* accepts a direct {@link UserConfig} object, or a function that returns it.
|
|
3356
3397
|
* The function receives a {@link ConfigEnv} object.
|
|
3357
3398
|
*/
|
|
3358
|
-
declare function defineConfig(config: UserConfig): UserConfig;
|
|
3359
|
-
declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
|
3360
|
-
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
3361
|
-
declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
|
3362
|
-
declare function defineConfig(config: UserConfigFn): UserConfigFn;
|
|
3363
|
-
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
3399
|
+
export declare function defineConfig(config: UserConfig): UserConfig;
|
|
3400
|
+
export declare function defineConfig(config: Promise<UserConfig>): Promise<UserConfig>;
|
|
3401
|
+
export declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
3402
|
+
export declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
|
3403
|
+
export declare function defineConfig(config: UserConfigFn): UserConfigFn;
|
|
3404
|
+
export declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
3364
3405
|
interface CreateDevEnvironmentContext {
|
|
3365
3406
|
ws: WebSocketServer;
|
|
3366
3407
|
}
|
|
@@ -3491,6 +3532,11 @@ interface UserConfig extends DefaultEnvironmentOptions {
|
|
|
3491
3532
|
* @default process.cwd()
|
|
3492
3533
|
*/
|
|
3493
3534
|
root?: string;
|
|
3535
|
+
/**
|
|
3536
|
+
* Path to the TypeScript configuration file. Relative paths are resolved
|
|
3537
|
+
* from the project root.
|
|
3538
|
+
*/
|
|
3539
|
+
tsconfig?: string;
|
|
3494
3540
|
/**
|
|
3495
3541
|
* Base public path when served in development or production.
|
|
3496
3542
|
* @default '/'
|
|
@@ -3851,16 +3897,16 @@ interface PluginHookUtils {
|
|
|
3851
3897
|
getSortedPluginHooks: <K extends keyof Plugin>(hookName: K) => NonNullable<HookHandler<Plugin[K]>>[];
|
|
3852
3898
|
}
|
|
3853
3899
|
type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
|
|
3854
|
-
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>;
|
|
3855
|
-
declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
|
|
3856
|
-
declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger, configLoader?: "bundle" | "runner" | "native"): Promise<{
|
|
3900
|
+
export 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>;
|
|
3901
|
+
export declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
|
|
3902
|
+
export declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel, customLogger?: Logger, configLoader?: "bundle" | "runner" | "native"): Promise<{
|
|
3857
3903
|
path: string;
|
|
3858
3904
|
config: UserConfig;
|
|
3859
3905
|
dependencies: string[];
|
|
3860
3906
|
} | null>;
|
|
3861
3907
|
//#endregion
|
|
3862
3908
|
//#region src/node/server/middlewares/error.d.ts
|
|
3863
|
-
declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
|
|
3909
|
+
export declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
|
|
3864
3910
|
//#endregion
|
|
3865
3911
|
//#region src/node/ssr/runtime/serverModuleRunner.d.ts
|
|
3866
3912
|
/**
|
|
@@ -3878,23 +3924,23 @@ interface ServerModuleRunnerOptions extends Omit<ModuleRunnerOptions, "root" | "
|
|
|
3878
3924
|
*/
|
|
3879
3925
|
evaluator?: ModuleEvaluator;
|
|
3880
3926
|
}
|
|
3881
|
-
declare const createServerModuleRunnerTransport: (options: {
|
|
3927
|
+
export declare const createServerModuleRunnerTransport: (options: {
|
|
3882
3928
|
channel: NormalizedServerHotChannel;
|
|
3883
3929
|
}) => ModuleRunnerTransport;
|
|
3884
3930
|
/**
|
|
3885
3931
|
* Create an instance of the Vite SSR runtime that support HMR.
|
|
3886
3932
|
* @experimental
|
|
3887
3933
|
*/
|
|
3888
|
-
declare function createServerModuleRunner(environment: DevEnvironment, options?: ServerModuleRunnerOptions): ModuleRunner;
|
|
3934
|
+
export declare function createServerModuleRunner(environment: DevEnvironment, options?: ServerModuleRunnerOptions): ModuleRunner;
|
|
3889
3935
|
//#endregion
|
|
3890
3936
|
//#region src/node/server/environments/runnableEnvironment.d.ts
|
|
3891
|
-
declare function createRunnableDevEnvironment(name: string, config: ResolvedConfig, context?: RunnableDevEnvironmentContext): RunnableDevEnvironment;
|
|
3937
|
+
export declare function createRunnableDevEnvironment(name: string, config: ResolvedConfig, context?: RunnableDevEnvironmentContext): RunnableDevEnvironment;
|
|
3892
3938
|
interface RunnableDevEnvironmentContext extends Omit<DevEnvironmentContext, "hot"> {
|
|
3893
3939
|
runner?: (environment: RunnableDevEnvironment, options?: ServerModuleRunnerOptions) => ModuleRunner;
|
|
3894
3940
|
runnerOptions?: ServerModuleRunnerOptions;
|
|
3895
3941
|
hot?: boolean;
|
|
3896
3942
|
}
|
|
3897
|
-
declare function isRunnableDevEnvironment(environment: Environment): environment is RunnableDevEnvironment;
|
|
3943
|
+
export declare function isRunnableDevEnvironment(environment: Environment): environment is RunnableDevEnvironment;
|
|
3898
3944
|
declare class RunnableDevEnvironment extends DevEnvironment {
|
|
3899
3945
|
private _runner;
|
|
3900
3946
|
private _runnerFactory;
|
|
@@ -3908,8 +3954,8 @@ declare class RunnableDevEnvironment extends DevEnvironment {
|
|
|
3908
3954
|
interface FetchableDevEnvironmentContext extends DevEnvironmentContext {
|
|
3909
3955
|
handleRequest(request: Request): Promise<Response> | Response;
|
|
3910
3956
|
}
|
|
3911
|
-
declare function createFetchableDevEnvironment(name: string, config: ResolvedConfig, context: FetchableDevEnvironmentContext): FetchableDevEnvironment;
|
|
3912
|
-
declare function isFetchableDevEnvironment(environment: Environment): environment is FetchableDevEnvironment;
|
|
3957
|
+
export declare function createFetchableDevEnvironment(name: string, config: ResolvedConfig, context: FetchableDevEnvironmentContext): FetchableDevEnvironment;
|
|
3958
|
+
export declare function isFetchableDevEnvironment(environment: Environment): environment is FetchableDevEnvironment;
|
|
3913
3959
|
declare class FetchableDevEnvironment extends DevEnvironment {
|
|
3914
3960
|
private _handleRequest;
|
|
3915
3961
|
constructor(name: string, config: ResolvedConfig, context: FetchableDevEnvironmentContext);
|
|
@@ -3925,7 +3971,7 @@ interface RunnerImportResult<T> {
|
|
|
3925
3971
|
* Import any file using the default Vite environment.
|
|
3926
3972
|
* @experimental
|
|
3927
3973
|
*/
|
|
3928
|
-
declare function runnerImport<T>(moduleId: string, inlineConfig?: InlineConfig): Promise<RunnerImportResult<T>>;
|
|
3974
|
+
export declare function runnerImport<T>(moduleId: string, inlineConfig?: InlineConfig): Promise<RunnerImportResult<T>>;
|
|
3929
3975
|
//#endregion
|
|
3930
3976
|
//#region src/node/ssr/fetchModule.d.ts
|
|
3931
3977
|
interface FetchModuleOptions {
|
|
@@ -3937,7 +3983,7 @@ interface FetchModuleOptions {
|
|
|
3937
3983
|
* Fetch module information for Vite module runner.
|
|
3938
3984
|
* @experimental
|
|
3939
3985
|
*/
|
|
3940
|
-
declare function fetchModule(environment: DevEnvironment, url: string, importer?: string, options?: FetchModuleOptions): Promise<moduleRunner_FetchResult>;
|
|
3986
|
+
export declare function fetchModule(environment: DevEnvironment, url: string, importer?: string, options?: FetchModuleOptions): Promise<moduleRunner_FetchResult>;
|
|
3941
3987
|
//#endregion
|
|
3942
3988
|
//#region src/node/ssr/ssrTransform.d.ts
|
|
3943
3989
|
interface ModuleRunnerTransformOptions {
|
|
@@ -3956,21 +4002,21 @@ declare const DEFAULT_SERVER_MAIN_FIELDS: readonly string[];
|
|
|
3956
4002
|
declare const DEFAULT_CLIENT_CONDITIONS: readonly string[];
|
|
3957
4003
|
declare const DEFAULT_SERVER_CONDITIONS: readonly string[];
|
|
3958
4004
|
declare const DEFAULT_EXTERNAL_CONDITIONS: readonly string[];
|
|
3959
|
-
declare const defaultAllowedOrigins: RegExp;
|
|
4005
|
+
export declare const defaultAllowedOrigins: RegExp;
|
|
3960
4006
|
//#endregion
|
|
3961
4007
|
//#region src/node/utils.d.ts
|
|
3962
4008
|
/**
|
|
3963
4009
|
* Inlined to keep `@rollup/pluginutils` in devDependencies
|
|
3964
4010
|
*/
|
|
3965
4011
|
type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
|
3966
|
-
declare const createFilter: (include?: FilterPattern, exclude?: FilterPattern, options?: {
|
|
4012
|
+
export declare const createFilter: (include?: FilterPattern, exclude?: FilterPattern, options?: {
|
|
3967
4013
|
resolve?: string | false | null;
|
|
3968
4014
|
}) => (id: unknown) => boolean;
|
|
3969
|
-
declare const rollupVersion = "4.23.0";
|
|
3970
|
-
declare function normalizePath(id: string): string;
|
|
3971
|
-
declare const isCSSRequest: (request: string) => boolean;
|
|
3972
|
-
declare function mergeConfig<D extends Record<string, any>, O extends Record<string, any>>(defaults: D extends Function ? never : D, overrides: O extends Function ? never : O, isRoot?: boolean): Record<string, any>;
|
|
3973
|
-
declare function mergeAlias(a?: AliasOptions, b?: AliasOptions): AliasOptions | undefined;
|
|
4015
|
+
export declare const rollupVersion = "4.23.0";
|
|
4016
|
+
export declare function normalizePath(id: string): string;
|
|
4017
|
+
export declare const isCSSRequest: (request: string) => boolean;
|
|
4018
|
+
export declare function mergeConfig<D extends Record<string, any>, O extends Record<string, any>>(defaults: D extends Function ? never : D, overrides: O extends Function ? never : O, isRoot?: boolean): Record<string, any>;
|
|
4019
|
+
export declare function mergeAlias(a?: AliasOptions, b?: AliasOptions): AliasOptions | undefined;
|
|
3974
4020
|
//#endregion
|
|
3975
4021
|
//#region src/node/server/send.d.ts
|
|
3976
4022
|
interface SendOptions {
|
|
@@ -3981,33 +4027,33 @@ interface SendOptions {
|
|
|
3981
4027
|
mappings: "";
|
|
3982
4028
|
} | null;
|
|
3983
4029
|
}
|
|
3984
|
-
declare function send(req: http.IncomingMessage, res: ServerResponse, content: string | Buffer, type: string, options: SendOptions): void;
|
|
4030
|
+
export declare function send(req: http.IncomingMessage, res: ServerResponse, content: string | Buffer, type: string, options: SendOptions): void;
|
|
3985
4031
|
//#endregion
|
|
3986
4032
|
//#region src/node/server/searchRoot.d.ts
|
|
3987
4033
|
/**
|
|
3988
4034
|
* Search up for the nearest workspace root
|
|
3989
4035
|
*/
|
|
3990
|
-
declare function searchForWorkspaceRoot(current: string, root?: string): string;
|
|
4036
|
+
export declare function searchForWorkspaceRoot(current: string, root?: string): string;
|
|
3991
4037
|
//#endregion
|
|
3992
4038
|
//#region src/node/server/middlewares/static.d.ts
|
|
3993
4039
|
/**
|
|
3994
4040
|
* Check if the url is allowed to be served, via the `server.fs` config.
|
|
3995
4041
|
* @deprecated Use the `isFileLoadingAllowed` function instead.
|
|
3996
4042
|
*/
|
|
3997
|
-
declare function isFileServingAllowed(config: ResolvedConfig, url: string): boolean;
|
|
3998
|
-
declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
|
|
4043
|
+
export declare function isFileServingAllowed(config: ResolvedConfig, url: string): boolean;
|
|
4044
|
+
export declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
|
|
3999
4045
|
/**
|
|
4000
4046
|
* Warning: parameters are not validated, only works with normalized absolute paths
|
|
4001
4047
|
*/
|
|
4002
|
-
declare function isFileLoadingAllowed(config: ResolvedConfig, filePath: string): boolean;
|
|
4048
|
+
export declare function isFileLoadingAllowed(config: ResolvedConfig, filePath: string): boolean;
|
|
4003
4049
|
//#endregion
|
|
4004
4050
|
//#region src/node/env.d.ts
|
|
4005
4051
|
/**
|
|
4006
4052
|
* Load `.env` files within the `envDir` and merge them with the matching
|
|
4007
4053
|
* variables already present in `process.env`.
|
|
4008
4054
|
*/
|
|
4009
|
-
declare function loadEnv(mode: string, envDir: string | false, prefixes?: string | string[]): Record<string, string>;
|
|
4010
|
-
declare function resolveEnvPrefix({ envPrefix }: UserConfig): string[];
|
|
4055
|
+
export declare function loadEnv(mode: string, envDir: string | false, prefixes?: string | string[]): Record<string, string>;
|
|
4056
|
+
export declare function resolveEnvPrefix({ envPrefix }: UserConfig): string[];
|
|
4011
4057
|
//#endregion
|
|
4012
4058
|
//#region src/node/plugins/manifest.d.ts
|
|
4013
4059
|
type Manifest = Record<string, ManifestChunk>;
|
|
@@ -4058,9 +4104,9 @@ interface ManifestChunk {
|
|
|
4058
4104
|
//#endregion
|
|
4059
4105
|
//#region src/node/index.d.ts
|
|
4060
4106
|
/** @deprecated - use `parseSync` instead */
|
|
4061
|
-
declare const parseAst: typeof parseAst$1;
|
|
4107
|
+
export declare const parseAst: typeof parseAst$1;
|
|
4062
4108
|
/** @deprecated - use `parse` instead */
|
|
4063
|
-
declare const parseAstAsync: typeof parseAstAsync$1;
|
|
4064
|
-
declare const esbuildVersion = "0.25.0";
|
|
4109
|
+
export declare const parseAstAsync: typeof parseAstAsync$1;
|
|
4110
|
+
export declare const esbuildVersion = "0.25.0";
|
|
4065
4111
|
//#endregion
|
|
4066
|
-
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type BindCLIShortcutsOptions, type BuildAppHook,
|
|
4112
|
+
export { type Alias, type AliasOptions, type AnymatchFn, type AnymatchPattern, type AppType, type BindCLIShortcutsOptions, type BuildAppHook, type BuildEnvironmentOptions, type BuildOptions, type BuilderOptions, type CLIShortcut, type CSSModulesOptions, type CSSOptions, type ChunkMetadata, type CommonServerOptions, type ConfigEnv, type ConfigPluginContext, type Connect, type ConnectedPayload, type CorsOptions, type CorsOrigin, type CustomEventMap, type CustomPayload, type CustomPluginOptionsVite, type DepOptimizationConfig, type DepOptimizationMetadata, type DepOptimizationOptions, type DevEnvironmentContext, type DevEnvironmentOptions, type ESBuildOptions, type ESTree, type Environment, type EnvironmentModuleGraph, type EnvironmentModuleNode, type EnvironmentOptions, type ErrorPayload, type EsbuildTransformOptions, type ExperimentalOptions, type ExportsData, type FSWatcher, type FetchFunction, type FetchModuleOptions, type FetchResult, type FetchableDevEnvironment, type FetchableDevEnvironmentContext, type FileSystemServeOptions, type FilterPattern, type FullReloadPayload, type GeneralImportGlobOptions, type HMRPayload, type HTMLOptions, type HmrContext, type HmrOptions, type HookHandler, type HotChannel, type HotChannelClient, type HotChannelListener, type HotPayload, type HotUpdateOptions, type HtmlAssetSource, type HtmlTagDescriptor, type index_d_exports as HttpProxy, type HttpServer, type ImportGlobFunction, type ImportGlobOptions, type IndexHtmlTransform, type IndexHtmlTransformContext, type IndexHtmlTransformHook, type IndexHtmlTransformResult, type InferCustomEventPayload, type InlineConfig, type InternalResolveOptions, type InvalidatePayload, type JsonOptions, type KnownAsTypeMap, type KnownQueryTypeMap, type LegacyOptions, type LessPreprocessorOptions, type LibraryFormats, type LibraryOptions, type LightningCSSOptions, type LogErrorOptions, type LogLevel, type LogOptions, type LogType, type Logger, type LoggerOptions, type Manifest, type ManifestChunk, type MapToFunction, type AnymatchMatcher as Matcher, type MinifyOptions, type MinifyResult, type MinimalPluginContextWithoutEnvironment, type ModuleGraph, type ModuleNode, type ModulePreloadOptions, type ModuleRunnerTransformOptions, type NormalizedHotChannel, type NormalizedHotChannelClient, type NormalizedServerHotChannel, type OptimizedDepInfo, type OxcOptions, type ParseResult, type ParserOptions, type Plugin, type PluginContainer, type PluginHookUtils, type PluginOption, type Config as PostcssUserConfig, type PreprocessCSSResult, type PreviewOptions, type PreviewServer, type PreviewServerHook, type ProxyOptions, type PrunePayload, type RenderBuiltAssetUrl, type ResolveFn, type ResolveModulePreloadDependenciesFn, type ResolveOptions, type ResolvedBuildEnvironmentOptions, type ResolvedBuildOptions, type ResolvedCSSOptions, type ResolvedConfig, type ResolvedDevEnvironmentOptions, type ResolvedModulePreloadOptions, type ResolvedPreviewOptions, type ResolvedSSROptions, type ResolvedServerOptions, type ResolvedServerUrls, type ResolvedUrl, type ResolvedWorkerOptions, type ResolverFunction, type ResolverObject, type Rolldown, type Rollup, type RollupCommonJSOptions, type RollupDynamicImportVarsOptions, type RunnableDevEnvironment, type RunnableDevEnvironmentContext, type SSROptions, type SSRTarget, type SassPreprocessorOptions, type SendOptions, type ServerHook, type ServerHotChannel, type ServerModuleRunnerOptions, type ServerOptions$1 as ServerOptions, type ServerWatchOptions, type SkipInformation, type SsrDepOptimizationConfig, type StylusPreprocessorOptions, type Terser, type TerserOptions, type TransformOptions, type TransformResult, type Update, type UpdatePayload, type UserConfig, type UserConfigExport, type UserConfigFn, type UserConfigFnObject, type UserConfigFnPromise, Visitor, type VisitorObject, type ViteBuilder, type ViteDevServer, type WatchOptions, type WebSocket, type WebSocketAlias, type WebSocketClient, type WebSocketCustomListener, type WebSocketServer, type WsOptions, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, esmExternalRequirePlugin, minify, minifySync, ssrTransform as moduleRunnerTransform, parse, parseSync, rolldownVersion, VERSION as version, withFilter };
|