@voidzero-dev/vite-plus-core 0.0.0-0bfcc90f.20260209-0731

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