1 |
|
2 |
|
3 | import type { Agent } from 'node:http';
|
4 | import type { BuildOptions as BuildOptions_2 } from 'esbuild';
|
5 | import type { ClientRequest } from 'node:http';
|
6 | import type { ClientRequestArgs } from 'node:http';
|
7 | import { ConnectedPayload } from "../../types/hmrPayload";
|
8 | import { CustomEventMap } from "../../types/customEvent";
|
9 | import { CustomPayload } from "../../types/hmrPayload";
|
10 | import type { CustomPluginOptions } from 'rollup';
|
11 | import type { Duplex } from 'node:stream';
|
12 | import type { DuplexOptions } from 'node:stream';
|
13 | import { ErrorPayload } from "../../types/hmrPayload";
|
14 | import { TransformOptions as EsbuildTransformOptions } from 'esbuild';
|
15 | import { version as esbuildVersion } from 'esbuild';
|
16 | import { EventEmitter } from 'node:events';
|
17 | import * as events from 'node:events';
|
18 | import type { ExistingRawSourceMap } from 'rollup';
|
19 | import type * as fs from 'node:fs';
|
20 | import { FullReloadPayload } from "../../types/hmrPayload";
|
21 | import { GeneralImportGlobOptions } from "../../types/importGlob";
|
22 | import type { GetManualChunk } from 'rollup';
|
23 | import { HMRPayload } from "../../types/hmrPayload";
|
24 | import * as http from 'node:http';
|
25 | import { ImportGlobEagerFunction } from "../../types/importGlob";
|
26 | import { ImportGlobFunction } from "../../types/importGlob";
|
27 | import { ImportGlobOptions } from "../../types/importGlob";
|
28 | import type { IncomingMessage } from 'node:http';
|
29 | import { InferCustomEventPayload } from "../../types/customEvent";
|
30 | import type { InputOption } from 'rollup';
|
31 | import type { InputOptions } from 'rollup';
|
32 | import { InvalidatePayload } from "../../types/customEvent";
|
33 | import { KnownAsTypeMap } from "../../types/importGlob";
|
34 | import type { LoadResult } from 'rollup';
|
35 |
|
36 | import type { ModuleFormat } from 'rollup';
|
37 | import type { ModuleInfo } from 'rollup';
|
38 | import type * as net from 'node:net';
|
39 | import type { ObjectHook } from 'rollup';
|
40 | import type { OutgoingHttpHeaders } from 'node:http';
|
41 | import type { OutputBundle } from 'rollup';
|
42 | import type { OutputChunk } from 'rollup';
|
43 | import type { PartialResolvedId } from 'rollup';
|
44 | import type { Plugin as Plugin_3 } from 'rollup';
|
45 | import type { PluginContext } from 'rollup';
|
46 | import type { PluginHooks } from 'rollup';
|
47 | import type * as PostCSS from 'postcss';
|
48 | import { PrunePayload } from "../../types/hmrPayload";
|
49 | import type { ResolveIdResult } from 'rollup';
|
50 | import type { RollupError } from 'rollup';
|
51 | import type { RollupOptions } from 'rollup';
|
52 | import type { RollupOutput } from 'rollup';
|
53 | import { VERSION as rollupVersion } from 'rollup';
|
54 | import type { RollupWatcher } from 'rollup';
|
55 | import type { SecureContextOptions } from 'node:tls';
|
56 | import type { Server } from 'node:http';
|
57 | import type { Server as Server_2 } from 'node:https';
|
58 | import type { ServerOptions as ServerOptions_2 } from 'node:https';
|
59 | import type { ServerResponse } from 'node:http';
|
60 | import type { SourceDescription } from 'rollup';
|
61 | import type { SourceMap } from 'rollup';
|
62 | import type { SourceMapInput } from 'rollup';
|
63 | import type * as stream from 'node:stream';
|
64 | import type { TransformPluginContext } from 'rollup';
|
65 | import type { TransformResult as TransformResult_2 } from 'rollup';
|
66 | import type { TransformResult as TransformResult_3 } from 'esbuild';
|
67 | import { Update } from "../../types/hmrPayload";
|
68 | import { UpdatePayload } from "../../types/hmrPayload";
|
69 | import type * as url from 'node:url';
|
70 | import type { URL as URL_2 } from 'node:url';
|
71 | import type { WatcherOptions } from 'rollup';
|
72 | import type { ZlibOptions } from 'node:zlib';
|
73 |
|
74 | export declare interface Alias {
|
75 | find: string | RegExp
|
76 | replacement: string
|
77 | |
78 |
|
79 |
|
80 |
|
81 |
|
82 | customResolver?: ResolverFunction | ResolverObject | null
|
83 | }
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | export declare type AliasOptions = readonly Alias[] | { [find: string]: string }
|
95 |
|
96 | export declare type AnymatchFn = (testString: string) => boolean
|
97 |
|
98 | export declare type AnymatchPattern = string | RegExp | AnymatchFn
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 | export declare type AppType = 'spa' | 'mpa' | 'custom';
|
108 |
|
109 | export declare interface AwaitWriteFinishOptions {
|
110 | |
111 |
|
112 |
|
113 | stabilityThreshold?: number
|
114 |
|
115 | |
116 |
|
117 |
|
118 | pollInterval?: number
|
119 | }
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 | export declare function build(inlineConfig?: InlineConfig): Promise<RollupOutput | RollupOutput[] | RollupWatcher>;
|
126 |
|
127 | export declare interface BuildOptions {
|
128 | |
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 | target?: 'modules' | EsbuildTransformOptions['target'] | false;
|
145 | |
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 | polyfillModulePreload?: boolean;
|
152 | |
153 |
|
154 |
|
155 |
|
156 |
|
157 | modulePreload?: boolean | ModulePreloadOptions;
|
158 | |
159 |
|
160 |
|
161 |
|
162 |
|
163 | outDir?: string;
|
164 | |
165 |
|
166 |
|
167 |
|
168 |
|
169 | assetsDir?: string;
|
170 | |
171 |
|
172 |
|
173 |
|
174 |
|
175 | assetsInlineLimit?: number;
|
176 | |
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 | cssCodeSplit?: boolean;
|
183 | |
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 | cssTarget?: EsbuildTransformOptions['target'] | false;
|
192 | |
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 | sourcemap?: boolean | 'inline' | 'hidden';
|
200 | |
201 |
|
202 |
|
203 |
|
204 |
|
205 | minify?: boolean | 'terser' | 'esbuild';
|
206 | |
207 |
|
208 |
|
209 |
|
210 | terserOptions?: Terser.MinifyOptions;
|
211 | |
212 |
|
213 |
|
214 |
|
215 | rollupOptions?: RollupOptions;
|
216 | |
217 |
|
218 |
|
219 | commonjsOptions?: RollupCommonJSOptions;
|
220 | |
221 |
|
222 |
|
223 | dynamicImportVarsOptions?: RollupDynamicImportVarsOptions;
|
224 | |
225 |
|
226 |
|
227 |
|
228 | write?: boolean;
|
229 | |
230 |
|
231 |
|
232 |
|
233 | emptyOutDir?: boolean | null;
|
234 | |
235 |
|
236 |
|
237 |
|
238 |
|
239 | copyPublicDir?: boolean;
|
240 | |
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 |
|
259 | manifest?: boolean | string;
|
260 | |
261 |
|
262 |
|
263 |
|
264 |
|
265 | lib?: LibraryOptions | false;
|
266 | |
267 |
|
268 |
|
269 |
|
270 | ssr?: boolean | string;
|
271 | |
272 |
|
273 |
|
274 |
|
275 | ssrManifest?: boolean | string;
|
276 | |
277 |
|
278 |
|
279 |
|
280 | reportCompressedSize?: boolean;
|
281 | |
282 |
|
283 |
|
284 |
|
285 | chunkSizeWarningLimit?: number;
|
286 | |
287 |
|
288 |
|
289 |
|
290 | watch?: WatcherOptions | null;
|
291 | }
|
292 |
|
293 | export declare interface ChunkMetadata {
|
294 | importedAssets: Set<string>;
|
295 | importedCss: Set<string>;
|
296 | }
|
297 |
|
298 | export declare interface CommonServerOptions {
|
299 | |
300 |
|
301 |
|
302 |
|
303 |
|
304 | port?: number;
|
305 | |
306 |
|
307 |
|
308 | strictPort?: boolean;
|
309 | |
310 |
|
311 |
|
312 |
|
313 | host?: string | boolean;
|
314 | |
315 |
|
316 |
|
317 |
|
318 | https?: boolean | ServerOptions_2;
|
319 | |
320 |
|
321 |
|
322 | open?: boolean | string;
|
323 | |
324 |
|
325 |
|
326 |
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 |
|
345 | proxy?: Record<string, string | ProxyOptions>;
|
346 | |
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 | cors?: CorsOptions | boolean;
|
353 | |
354 |
|
355 |
|
356 | headers?: OutgoingHttpHeaders;
|
357 | }
|
358 |
|
359 | export declare interface ConfigEnv {
|
360 | command: 'build' | 'serve';
|
361 | mode: string;
|
362 | |
363 |
|
364 |
|
365 | ssrBuild?: boolean;
|
366 | }
|
367 |
|
368 | export declare namespace Connect {
|
369 | export type ServerHandle = HandleFunction | http.Server
|
370 |
|
371 | export class IncomingMessage extends http.IncomingMessage {
|
372 | originalUrl?: http.IncomingMessage['url'] | undefined
|
373 | }
|
374 |
|
375 | export type NextFunction = (err?: any) => void
|
376 |
|
377 | export type SimpleHandleFunction = (
|
378 | req: IncomingMessage,
|
379 | res: http.ServerResponse
|
380 | ) => void
|
381 | export type NextHandleFunction = (
|
382 | req: IncomingMessage,
|
383 | res: http.ServerResponse,
|
384 | next: NextFunction
|
385 | ) => void
|
386 | export type ErrorHandleFunction = (
|
387 | err: any,
|
388 | req: IncomingMessage,
|
389 | res: http.ServerResponse,
|
390 | next: NextFunction
|
391 | ) => void
|
392 | export type HandleFunction =
|
393 | | SimpleHandleFunction
|
394 | | NextHandleFunction
|
395 | | ErrorHandleFunction
|
396 |
|
397 | export interface ServerStackItem {
|
398 | route: string
|
399 | handle: ServerHandle
|
400 | }
|
401 |
|
402 | export interface Server extends NodeJS.EventEmitter {
|
403 | (req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void
|
404 |
|
405 | route: string
|
406 | stack: ServerStackItem[]
|
407 |
|
408 | |
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 | use(fn: NextHandleFunction): Server
|
420 | use(fn: HandleFunction): Server
|
421 | use(route: string, fn: NextHandleFunction): Server
|
422 | use(route: string, fn: HandleFunction): Server
|
423 |
|
424 | |
425 |
|
426 |
|
427 |
|
428 | handle(
|
429 | req: http.IncomingMessage,
|
430 | res: http.ServerResponse,
|
431 | next: Function
|
432 | ): void
|
433 |
|
434 | |
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 |
|
456 | listen(
|
457 | port: number,
|
458 | hostname?: string,
|
459 | backlog?: number,
|
460 | callback?: Function
|
461 | ): http.Server
|
462 | listen(port: number, hostname?: string, callback?: Function): http.Server
|
463 | listen(path: string, callback?: Function): http.Server
|
464 | listen(handle: any, listeningListener?: Function): http.Server
|
465 | }
|
466 | }
|
467 |
|
468 | export { ConnectedPayload }
|
469 |
|
470 |
|
471 |
|
472 |
|
473 | export declare interface CorsOptions {
|
474 | origin?: CorsOrigin | ((origin: string, cb: (err: Error, origins: CorsOrigin) => void) => void);
|
475 | methods?: string | string[];
|
476 | allowedHeaders?: string | string[];
|
477 | exposedHeaders?: string | string[];
|
478 | credentials?: boolean;
|
479 | maxAge?: number;
|
480 | preflightContinue?: boolean;
|
481 | optionsSuccessStatus?: number;
|
482 | }
|
483 |
|
484 | export declare type CorsOrigin = boolean | string | RegExp | (string | RegExp)[];
|
485 |
|
486 | export declare const createFilter: (include?: FilterPattern | undefined, exclude?: FilterPattern | undefined, options?: {
|
487 | resolve?: string | false | null | undefined;
|
488 | } | undefined) => (id: string | unknown) => boolean;
|
489 |
|
490 | export declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
|
491 |
|
492 | export declare function createServer(inlineConfig?: InlineConfig): Promise<ViteDevServer>;
|
493 |
|
494 | export declare interface CSSModulesOptions {
|
495 | getJSON?: (cssFileName: string, json: Record<string, string>, outputFileName: string) => void;
|
496 | scopeBehaviour?: 'global' | 'local';
|
497 | globalModulePaths?: RegExp[];
|
498 | generateScopedName?: string | ((name: string, filename: string, css: string) => string);
|
499 | hashPrefix?: string;
|
500 | /**
|
501 | * default: null
|
502 | */
|
503 | localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | null;
|
504 | }
|
505 |
|
506 | export declare interface CSSOptions {
|
507 | /**
|
508 | * https://github.com/css-modules/postcss-modules
|
509 | */
|
510 | modules?: CSSModulesOptions | false;
|
511 | preprocessorOptions?: Record<string, any>;
|
512 | postcss?: string | (PostCSS.ProcessOptions & {
|
513 | plugins?: PostCSS.AcceptedPlugin[];
|
514 | });
|
515 | /**
|
516 | * Enables css sourcemaps during dev
|
517 | * @default false
|
518 | * @experimental
|
519 | */
|
520 | devSourcemap?: boolean;
|
521 | }
|
522 |
|
523 | export { CustomEventMap }
|
524 |
|
525 | export { CustomPayload }
|
526 |
|
527 | /**
|
528 | * Type helper to make it easier to use vite.config.ts
|
529 | * accepts a direct {@link UserConfig} object, or a function that returns it.
|
530 | * The function receives a {@link ConfigEnv} object that exposes two properties:
|
531 | * `command` (either `'build'` or `'serve'`), and `mode`.
|
532 | */
|
533 | export declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
534 |
|
535 | export declare interface DepOptimizationConfig {
|
536 | /**
|
537 | * Force optimize listed dependencies (must be resolvable import paths,
|
538 | * cannot be globs).
|
539 | */
|
540 | include?: string[];
|
541 | /**
|
542 | * Do not optimize these dependencies (must be resolvable import paths,
|
543 | * cannot be globs).
|
544 | */
|
545 | exclude?: string[];
|
546 | /**
|
547 | * Force ESM interop when importing for these dependencies. Some legacy
|
548 | * packages advertise themselves as ESM but use `require` internally
|
549 | * @experimental
|
550 | */
|
551 | needsInterop?: string[];
|
552 | /**
|
553 | * Options to pass to esbuild during the dep scanning and optimization
|
554 | *
|
555 | * Certain options are omitted since changing them would not be compatible
|
556 | * with Vite's dep optimization.
|
557 | *
|
558 | * - `external` is also omitted, use Vite's `optimizeDeps.exclude` option
|
559 | * - `plugins` are merged with Vite's dep plugin
|
560 | *
|
561 | * https://esbuild.github.io/api
|
562 | */
|
563 | esbuildOptions?: Omit<BuildOptions_2, 'bundle' | 'entryPoints' | 'external' | 'write' | 'watch' | 'outdir' | 'outfile' | 'outbase' | 'outExtension' | 'metafile'>;
|
564 | /**
|
565 | * List of file extensions that can be optimized. A corresponding esbuild
|
566 | * plugin must exist to handle the specific extension.
|
567 | *
|
568 | * By default, Vite can optimize `.mjs`, `.js`, `.ts`, and `.mts` files. This option
|
569 | * allows specifying additional extensions.
|
570 | *
|
571 | * @experimental
|
572 | */
|
573 | extensions?: string[];
|
574 | /**
|
575 | * Disables dependencies optimizations, true disables the optimizer during
|
576 | * build and dev. Pass 'build' or 'dev' to only disable the optimizer in
|
577 | * one of the modes. Deps optimization is enabled by default in dev only.
|
578 | * @default 'build'
|
579 | * @experimental
|
580 | */
|
581 | disabled?: boolean | 'build' | 'dev';
|
582 | }
|
583 |
|
584 | export declare interface DepOptimizationMetadata {
|
585 | /**
|
586 | * The main hash is determined by user config and dependency lockfiles.
|
587 | * This is checked on server startup to avoid unnecessary re-bundles.
|
588 | */
|
589 | hash: string;
|
590 | /**
|
591 | * The browser hash is determined by the main hash plus additional dependencies
|
592 | * discovered at runtime. This is used to invalidate browser requests to
|
593 | * optimized deps.
|
594 | */
|
595 | browserHash: string;
|
596 | /**
|
597 | * Metadata for each already optimized dependency
|
598 | */
|
599 | optimized: Record<string, OptimizedDepInfo>;
|
600 | /**
|
601 | * Metadata for non-entry optimized chunks and dynamic imports
|
602 | */
|
603 | chunks: Record<string, OptimizedDepInfo>;
|
604 | /**
|
605 | * Metadata for each newly discovered dependency after processing
|
606 | */
|
607 | discovered: Record<string, OptimizedDepInfo>;
|
608 | /**
|
609 | * OptimizedDepInfo list
|
610 | */
|
611 | depInfoList: OptimizedDepInfo[];
|
612 | }
|
613 |
|
614 | export declare type DepOptimizationOptions = DepOptimizationConfig & {
|
615 | /**
|
616 | * By default, Vite will crawl your `index.html` to detect dependencies that
|
617 | * need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
|
618 | * will crawl those entry points instead.
|
619 | *
|
620 | * If neither of these fit your needs, you can specify custom entries using
|
621 | * this option - the value should be a fast-glob pattern or array of patterns
|
622 | * (https:
|
623 | * vite project root. This will overwrite default entries inference.
|
624 | */
|
625 | entries?: string | string[];
|
626 | |
627 |
|
628 |
|
629 |
|
630 | force?: boolean;
|
631 | };
|
632 |
|
633 | export declare interface DepOptimizationProcessing {
|
634 | promise: Promise<void>;
|
635 | resolve: () => void;
|
636 | }
|
637 |
|
638 | export declare interface DepOptimizationResult {
|
639 | metadata: DepOptimizationMetadata;
|
640 | |
641 |
|
642 |
|
643 |
|
644 |
|
645 | commit: () => Promise<void>;
|
646 | cancel: () => void;
|
647 | }
|
648 |
|
649 | export declare interface DepsOptimizer {
|
650 | metadata: DepOptimizationMetadata;
|
651 | scanProcessing?: Promise<void>;
|
652 | registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
|
653 | run: () => void;
|
654 | isOptimizedDepFile: (id: string) => boolean;
|
655 | isOptimizedDepUrl: (url: string) => boolean;
|
656 | getOptimizedDepId: (depInfo: OptimizedDepInfo) => string;
|
657 | delayDepsOptimizerUntil: (id: string, done: () => Promise<any>) => void;
|
658 | registerWorkersSource: (id: string) => void;
|
659 | resetRegisteredIds: () => void;
|
660 | ensureFirstRun: () => void;
|
661 | close: () => Promise<void>;
|
662 | options: DepOptimizationOptions;
|
663 | }
|
664 |
|
665 | export { ErrorPayload }
|
666 |
|
667 | export declare interface ESBuildOptions extends EsbuildTransformOptions {
|
668 | include?: string | RegExp | string[] | RegExp[];
|
669 | exclude?: string | RegExp | string[] | RegExp[];
|
670 | jsxInject?: string;
|
671 | |
672 |
|
673 |
|
674 | minify?: never;
|
675 | }
|
676 |
|
677 | export { EsbuildTransformOptions }
|
678 |
|
679 | export declare type ESBuildTransformResult = Omit<TransformResult_3, 'map'> & {
|
680 | map: SourceMap;
|
681 | };
|
682 |
|
683 | export { esbuildVersion }
|
684 |
|
685 | export declare interface ExperimentalOptions {
|
686 | |
687 |
|
688 |
|
689 |
|
690 |
|
691 |
|
692 | importGlobRestoreExtension?: boolean;
|
693 | |
694 |
|
695 |
|
696 |
|
697 |
|
698 | renderBuiltUrl?: RenderBuiltAssetUrl;
|
699 | |
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 | hmrPartialAccept?: boolean;
|
706 | }
|
707 |
|
708 | export declare type ExportsData = {
|
709 | hasImports: boolean;
|
710 | exports: readonly string[];
|
711 | facade: boolean;
|
712 | hasReExports?: boolean;
|
713 | jsxLoader?: boolean;
|
714 | };
|
715 |
|
716 | export declare interface FileSystemServeOptions {
|
717 | |
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 | strict?: boolean;
|
725 | |
726 |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 | allow?: string[];
|
732 | |
733 |
|
734 |
|
735 |
|
736 |
|
737 |
|
738 |
|
739 |
|
740 | deny?: string[];
|
741 | }
|
742 |
|
743 |
|
744 |
|
745 |
|
746 | export declare type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
747 |
|
748 | export declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise<ExistingRawSourceMap>;
|
749 |
|
750 | export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
751 | options: WatchOptions
|
752 |
|
753 | |
754 |
|
755 |
|
756 | constructor(options?: WatchOptions)
|
757 |
|
758 | |
759 |
|
760 |
|
761 |
|
762 | add(paths: string | ReadonlyArray<string>): this
|
763 |
|
764 | |
765 |
|
766 |
|
767 |
|
768 | unwatch(paths: string | ReadonlyArray<string>): this
|
769 |
|
770 | |
771 |
|
772 |
|
773 |
|
774 |
|
775 |
|
776 | getWatched(): {
|
777 | [directory: string]: string[]
|
778 | }
|
779 |
|
780 | |
781 |
|
782 |
|
783 | close(): Promise<void>
|
784 |
|
785 | on(
|
786 | event: 'add' | 'addDir' | 'change',
|
787 | listener: (path: string, stats?: fs.Stats) => void
|
788 | ): this
|
789 |
|
790 | on(
|
791 | event: 'all',
|
792 | listener: (
|
793 | eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir',
|
794 | path: string,
|
795 | stats?: fs.Stats
|
796 | ) => void
|
797 | ): this
|
798 |
|
799 | |
800 |
|
801 |
|
802 | on(event: 'error', listener: (error: Error) => void): this
|
803 |
|
804 | |
805 |
|
806 |
|
807 | on(
|
808 | event: 'raw',
|
809 | listener: (eventName: string, path: string, details: any) => void
|
810 | ): this
|
811 |
|
812 | |
813 |
|
814 |
|
815 | on(event: 'ready', listener: () => void): this
|
816 |
|
817 | on(event: 'unlink' | 'unlinkDir', listener: (path: string) => void): this
|
818 |
|
819 | on(event: string, listener: (...args: any[]) => void): this
|
820 | }
|
821 |
|
822 | export { FullReloadPayload }
|
823 |
|
824 | export { GeneralImportGlobOptions }
|
825 |
|
826 | export declare function getDepOptimizationConfig(config: ResolvedConfig, ssr: boolean): DepOptimizationConfig;
|
827 |
|
828 | export declare interface HmrContext {
|
829 | file: string;
|
830 | timestamp: number;
|
831 | modules: Array<ModuleNode>;
|
832 | read: () => string | Promise<string>;
|
833 | server: ViteDevServer;
|
834 | }
|
835 |
|
836 | export declare interface HmrOptions {
|
837 | protocol?: string;
|
838 | host?: string;
|
839 | port?: number;
|
840 | clientPort?: number;
|
841 | path?: string;
|
842 | timeout?: number;
|
843 | overlay?: boolean;
|
844 | server?: Server;
|
845 | }
|
846 |
|
847 | export { HMRPayload }
|
848 |
|
849 | export declare type HookHandler<T> = T extends ObjectHook<infer H> ? H : T;
|
850 |
|
851 | export declare interface HtmlTagDescriptor {
|
852 | tag: string;
|
853 | attrs?: Record<string, string | boolean | undefined>;
|
854 | children?: string | HtmlTagDescriptor[];
|
855 | |
856 |
|
857 |
|
858 | injectTo?: 'head' | 'body' | 'head-prepend' | 'body-prepend';
|
859 | }
|
860 |
|
861 | export declare namespace HttpProxy {
|
862 | export type ProxyTarget = ProxyTargetUrl | ProxyTargetDetailed
|
863 |
|
864 | export type ProxyTargetUrl = string | Partial<url.Url>
|
865 |
|
866 | export interface ProxyTargetDetailed {
|
867 | host: string
|
868 | port: number
|
869 | protocol?: string | undefined
|
870 | hostname?: string | undefined
|
871 | socketPath?: string | undefined
|
872 | key?: string | undefined
|
873 | passphrase?: string | undefined
|
874 | pfx?: Buffer | string | undefined
|
875 | cert?: string | undefined
|
876 | ca?: string | undefined
|
877 | ciphers?: string | undefined
|
878 | secureProtocol?: string | undefined
|
879 | }
|
880 |
|
881 | export type ErrorCallback = (
|
882 | err: Error,
|
883 | req: http.IncomingMessage,
|
884 | res: http.ServerResponse,
|
885 | target?: ProxyTargetUrl
|
886 | ) => void
|
887 |
|
888 | export class Server extends events.EventEmitter {
|
889 | |
890 |
|
891 |
|
892 |
|
893 | constructor(options?: ServerOptions)
|
894 |
|
895 | |
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 | web(
|
902 | req: http.IncomingMessage,
|
903 | res: http.ServerResponse,
|
904 | options?: ServerOptions,
|
905 | callback?: ErrorCallback
|
906 | ): void
|
907 |
|
908 | |
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 | ws(
|
916 | req: http.IncomingMessage,
|
917 | socket: unknown,
|
918 | head: unknown,
|
919 | options?: ServerOptions,
|
920 | callback?: ErrorCallback
|
921 | ): void
|
922 |
|
923 | |
924 |
|
925 |
|
926 |
|
927 | listen(port: number): Server
|
928 |
|
929 | |
930 |
|
931 |
|
932 | close(callback?: () => void): void
|
933 |
|
934 | |
935 |
|
936 |
|
937 |
|
938 |
|
939 | static createProxyServer(options?: ServerOptions): Server
|
940 |
|
941 | |
942 |
|
943 |
|
944 |
|
945 |
|
946 | static createServer(options?: ServerOptions): Server
|
947 |
|
948 | |
949 |
|
950 |
|
951 |
|
952 |
|
953 | static createProxy(options?: ServerOptions): Server
|
954 |
|
955 | addListener(event: string, listener: () => void): this
|
956 | on(event: string, listener: () => void): this
|
957 | on(event: 'error', listener: ErrorCallback): this
|
958 | on(
|
959 | event: 'start',
|
960 | listener: (
|
961 | req: http.IncomingMessage,
|
962 | res: http.ServerResponse,
|
963 | target: ProxyTargetUrl
|
964 | ) => void
|
965 | ): this
|
966 | on(
|
967 | event: 'proxyReq',
|
968 | listener: (
|
969 | proxyReq: http.ClientRequest,
|
970 | req: http.IncomingMessage,
|
971 | res: http.ServerResponse,
|
972 | options: ServerOptions
|
973 | ) => void
|
974 | ): this
|
975 | on(
|
976 | event: 'proxyRes',
|
977 | listener: (
|
978 | proxyRes: http.IncomingMessage,
|
979 | req: http.IncomingMessage,
|
980 | res: http.ServerResponse
|
981 | ) => void
|
982 | ): this
|
983 | on(
|
984 | event: 'proxyReqWs',
|
985 | listener: (
|
986 | proxyReq: http.ClientRequest,
|
987 | req: http.IncomingMessage,
|
988 | socket: net.Socket,
|
989 | options: ServerOptions,
|
990 | head: any
|
991 | ) => void
|
992 | ): this
|
993 | on(
|
994 | event: 'econnreset',
|
995 | listener: (
|
996 | err: Error,
|
997 | req: http.IncomingMessage,
|
998 | res: http.ServerResponse,
|
999 | target: ProxyTargetUrl
|
1000 | ) => void
|
1001 | ): this
|
1002 | on(
|
1003 | event: 'end',
|
1004 | listener: (
|
1005 | req: http.IncomingMessage,
|
1006 | res: http.ServerResponse,
|
1007 | proxyRes: http.IncomingMessage
|
1008 | ) => void
|
1009 | ): this
|
1010 | on(
|
1011 | event: 'close',
|
1012 | listener: (
|
1013 | proxyRes: http.IncomingMessage,
|
1014 | proxySocket: net.Socket,
|
1015 | proxyHead: any
|
1016 | ) => void
|
1017 | ): this
|
1018 |
|
1019 | once(event: string, listener: () => void): this
|
1020 | removeListener(event: string, listener: () => void): this
|
1021 | removeAllListeners(event?: string): this
|
1022 | getMaxListeners(): number
|
1023 | setMaxListeners(n: number): this
|
1024 | listeners(event: string): Array<() => void>
|
1025 | emit(event: string, ...args: any[]): boolean
|
1026 | listenerCount(type: string): number
|
1027 | }
|
1028 |
|
1029 | export interface ServerOptions {
|
1030 |
|
1031 | target?: ProxyTarget | undefined
|
1032 |
|
1033 | forward?: ProxyTargetUrl | undefined
|
1034 |
|
1035 | agent?: any
|
1036 |
|
1037 | ssl?: any
|
1038 |
|
1039 | ws?: boolean | undefined
|
1040 |
|
1041 | xfwd?: boolean | undefined
|
1042 |
|
1043 | secure?: boolean | undefined
|
1044 |
|
1045 | toProxy?: boolean | undefined
|
1046 |
|
1047 | prependPath?: boolean | undefined
|
1048 |
|
1049 | ignorePath?: boolean | undefined
|
1050 |
|
1051 | localAddress?: string | undefined
|
1052 |
|
1053 | changeOrigin?: boolean | undefined
|
1054 |
|
1055 | preserveHeaderKeyCase?: boolean | undefined
|
1056 |
|
1057 | auth?: string | undefined
|
1058 |
|
1059 | hostRewrite?: string | undefined
|
1060 |
|
1061 | autoRewrite?: boolean | undefined
|
1062 |
|
1063 | protocolRewrite?: string | undefined
|
1064 |
|
1065 | cookieDomainRewrite?:
|
1066 | | false
|
1067 | | string
|
1068 | | { [oldDomain: string]: string }
|
1069 | | undefined
|
1070 |
|
1071 | cookiePathRewrite?:
|
1072 | | false
|
1073 | | string
|
1074 | | { [oldPath: string]: string }
|
1075 | | undefined
|
1076 |
|
1077 | headers?: { [header: string]: string } | undefined
|
1078 |
|
1079 | proxyTimeout?: number | undefined
|
1080 |
|
1081 | timeout?: number | undefined
|
1082 |
|
1083 | followRedirects?: boolean | undefined
|
1084 |
|
1085 | selfHandleResponse?: boolean | undefined
|
1086 |
|
1087 | buffer?: stream.Stream | undefined
|
1088 | }
|
1089 | }
|
1090 |
|
1091 | export { ImportGlobEagerFunction }
|
1092 |
|
1093 | export { ImportGlobFunction }
|
1094 |
|
1095 | export { ImportGlobOptions }
|
1096 |
|
1097 | export declare type IndexHtmlTransform = IndexHtmlTransformHook | {
|
1098 | enforce?: 'pre' | 'post';
|
1099 | transform: IndexHtmlTransformHook;
|
1100 | };
|
1101 |
|
1102 | export declare interface IndexHtmlTransformContext {
|
1103 | |
1104 |
|
1105 |
|
1106 | path: string;
|
1107 | |
1108 |
|
1109 |
|
1110 | filename: string;
|
1111 | server?: ViteDevServer;
|
1112 | bundle?: OutputBundle;
|
1113 | chunk?: OutputChunk;
|
1114 | originalUrl?: string;
|
1115 | }
|
1116 |
|
1117 | export declare type IndexHtmlTransformHook = (this: void, html: string, ctx: IndexHtmlTransformContext) => IndexHtmlTransformResult | void | Promise<IndexHtmlTransformResult | void>;
|
1118 |
|
1119 | export declare type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
|
1120 | html: string;
|
1121 | tags: HtmlTagDescriptor[];
|
1122 | };
|
1123 |
|
1124 | export { InferCustomEventPayload }
|
1125 |
|
1126 | export declare interface InlineConfig extends UserConfig {
|
1127 | configFile?: string | false;
|
1128 | envFile?: false;
|
1129 | }
|
1130 |
|
1131 | export declare interface InternalResolveOptions extends Required<ResolveOptions> {
|
1132 | root: string;
|
1133 | isBuild: boolean;
|
1134 | isProduction: boolean;
|
1135 | ssrConfig?: SSROptions;
|
1136 | packageCache?: PackageCache;
|
1137 | |
1138 |
|
1139 |
|
1140 |
|
1141 |
|
1142 | asSrc?: boolean;
|
1143 | tryIndex?: boolean;
|
1144 | tryPrefix?: string;
|
1145 | skipPackageJson?: boolean;
|
1146 | preferRelative?: boolean;
|
1147 | isRequire?: boolean;
|
1148 | isFromTsImporter?: boolean;
|
1149 | tryEsmOnly?: boolean;
|
1150 | scan?: boolean;
|
1151 | ssrOptimizeCheck?: boolean;
|
1152 | getDepsOptimizer?: (ssr: boolean) => DepsOptimizer | undefined;
|
1153 | shouldExternalize?: (id: string) => boolean | undefined;
|
1154 | isHookNodeResolve?: boolean;
|
1155 | }
|
1156 |
|
1157 | export { InvalidatePayload }
|
1158 |
|
1159 | export declare function isDepsOptimizerEnabled(config: ResolvedConfig, ssr: boolean): boolean;
|
1160 |
|
1161 | export declare interface JsonOptions {
|
1162 | |
1163 |
|
1164 |
|
1165 |
|
1166 | namedExports?: boolean;
|
1167 | |
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 | stringify?: boolean;
|
1173 | }
|
1174 |
|
1175 | export { KnownAsTypeMap }
|
1176 |
|
1177 | export declare interface LegacyOptions {
|
1178 | |
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 | buildSsrCjsExternalHeuristics?: boolean;
|
1186 | }
|
1187 |
|
1188 | export declare type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife';
|
1189 |
|
1190 | export declare interface LibraryOptions {
|
1191 | |
1192 |
|
1193 |
|
1194 | entry: InputOption;
|
1195 | |
1196 |
|
1197 |
|
1198 |
|
1199 | name?: string;
|
1200 | |
1201 |
|
1202 |
|
1203 |
|
1204 | formats?: LibraryFormats[];
|
1205 | |
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 | fileName?: string | ((format: ModuleFormat, entryName: string) => string);
|
1211 | }
|
1212 |
|
1213 | export declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel): Promise<{
|
1214 | path: string;
|
1215 | config: UserConfig;
|
1216 | dependencies: string[];
|
1217 | } | null>;
|
1218 |
|
1219 | export declare function loadEnv(mode: string, envDir: string, prefixes?: string | string[]): Record<string, string>;
|
1220 |
|
1221 | export declare interface LogErrorOptions extends LogOptions {
|
1222 | error?: Error | RollupError | null;
|
1223 | }
|
1224 |
|
1225 | export declare interface Logger {
|
1226 | info(msg: string, options?: LogOptions): void;
|
1227 | warn(msg: string, options?: LogOptions): void;
|
1228 | warnOnce(msg: string, options?: LogOptions): void;
|
1229 | error(msg: string, options?: LogErrorOptions): void;
|
1230 | clearScreen(type: LogType): void;
|
1231 | hasErrorLogged(error: Error | RollupError): boolean;
|
1232 | hasWarned: boolean;
|
1233 | }
|
1234 |
|
1235 | export declare interface LoggerOptions {
|
1236 | prefix?: string;
|
1237 | allowClearScreen?: boolean;
|
1238 | customLogger?: Logger;
|
1239 | }
|
1240 |
|
1241 | export declare type LogLevel = LogType | 'silent';
|
1242 |
|
1243 | export declare interface LogOptions {
|
1244 | clear?: boolean;
|
1245 | timestamp?: boolean;
|
1246 | }
|
1247 |
|
1248 | export declare type LogType = 'error' | 'warn' | 'info';
|
1249 |
|
1250 | export declare type Manifest = Record<string, ManifestChunk>;
|
1251 |
|
1252 | export declare interface ManifestChunk {
|
1253 | src?: string;
|
1254 | file: string;
|
1255 | css?: string[];
|
1256 | assets?: string[];
|
1257 | isEntry?: boolean;
|
1258 | isDynamicEntry?: boolean;
|
1259 | imports?: string[];
|
1260 | dynamicImports?: string[];
|
1261 | }
|
1262 |
|
1263 | export declare type MapToFunction<T> = T extends Function ? T : never
|
1264 |
|
1265 | export declare type Matcher = AnymatchPattern | AnymatchPattern[]
|
1266 |
|
1267 | export declare function mergeAlias(a?: AliasOptions, b?: AliasOptions): AliasOptions | undefined;
|
1268 |
|
1269 | export declare function mergeConfig(defaults: Record<string, any>, overrides: Record<string, any>, isRoot?: boolean): Record<string, any>;
|
1270 |
|
1271 | export declare class ModuleGraph {
|
1272 | private resolveId;
|
1273 | urlToModuleMap: Map<string, ModuleNode>;
|
1274 | idToModuleMap: Map<string, ModuleNode>;
|
1275 | fileToModulesMap: Map<string, Set<ModuleNode>>;
|
1276 | safeModulesPath: Set<string>;
|
1277 | constructor(resolveId: (url: string, ssr: boolean) => Promise<PartialResolvedId | null>);
|
1278 | getModuleByUrl(rawUrl: string, ssr?: boolean): Promise<ModuleNode | undefined>;
|
1279 | getModuleById(id: string): ModuleNode | undefined;
|
1280 | getModulesByFile(file: string): Set<ModuleNode> | undefined;
|
1281 | onFileChange(file: string): void;
|
1282 | invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number): void;
|
1283 | invalidateAll(): void;
|
1284 | |
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 | updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, importedBindings: Map<string, Set<string>> | null, acceptedModules: Set<string | ModuleNode>, acceptedExports: Set<string> | null, isSelfAccepting: boolean, ssr?: boolean): Promise<Set<ModuleNode> | undefined>;
|
1290 | ensureEntryFromUrl(rawUrl: string, ssr?: boolean, setIsSelfAccepting?: boolean): Promise<ModuleNode>;
|
1291 | createFileOnlyEntry(file: string): ModuleNode;
|
1292 | resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
|
1293 | }
|
1294 |
|
1295 | export declare class ModuleNode {
|
1296 | |
1297 |
|
1298 |
|
1299 | url: string;
|
1300 | |
1301 |
|
1302 |
|
1303 | id: string | null;
|
1304 | file: string | null;
|
1305 | type: 'js' | 'css';
|
1306 | info?: ModuleInfo;
|
1307 | meta?: Record<string, any>;
|
1308 | importers: Set<ModuleNode>;
|
1309 | importedModules: Set<ModuleNode>;
|
1310 | acceptedHmrDeps: Set<ModuleNode>;
|
1311 | acceptedHmrExports: Set<string> | null;
|
1312 | importedBindings: Map<string, Set<string>> | null;
|
1313 | isSelfAccepting?: boolean;
|
1314 | transformResult: TransformResult | null;
|
1315 | ssrTransformResult: TransformResult | null;
|
1316 | ssrModule: Record<string, any> | null;
|
1317 | ssrError: Error | null;
|
1318 | lastHMRTimestamp: number;
|
1319 | lastInvalidationTimestamp: number;
|
1320 | |
1321 |
|
1322 |
|
1323 | constructor(url: string, setIsSelfAccepting?: boolean);
|
1324 | }
|
1325 |
|
1326 | export declare interface ModulePreloadOptions {
|
1327 | |
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 | polyfill?: boolean;
|
1333 | |
1334 |
|
1335 |
|
1336 |
|
1337 | resolveDependencies?: ResolveModulePreloadDependenciesFn;
|
1338 | }
|
1339 |
|
1340 | export declare function normalizePath(id: string): string;
|
1341 |
|
1342 | export declare interface OptimizedDepInfo {
|
1343 | id: string;
|
1344 | file: string;
|
1345 | src?: string;
|
1346 | needsInterop?: boolean;
|
1347 | browserHash?: string;
|
1348 | fileHash?: string;
|
1349 | |
1350 |
|
1351 |
|
1352 |
|
1353 | processing?: Promise<void>;
|
1354 | |
1355 |
|
1356 |
|
1357 |
|
1358 | exportsData?: Promise<ExportsData>;
|
1359 | }
|
1360 |
|
1361 |
|
1362 |
|
1363 |
|
1364 |
|
1365 | export declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>;
|
1366 |
|
1367 |
|
1368 | export declare type PackageCache = Map<string, PackageData>;
|
1369 |
|
1370 | export declare interface PackageData {
|
1371 | dir: string;
|
1372 | hasSideEffects: (id: string) => boolean | 'no-treeshake';
|
1373 | webResolvedImports: Record<string, string | undefined>;
|
1374 | nodeResolvedImports: Record<string, string | undefined>;
|
1375 | setResolvedCache: (key: string, entry: string, targetWeb: boolean) => void;
|
1376 | getResolvedCache: (key: string, targetWeb: boolean) => string | undefined;
|
1377 | data: {
|
1378 | [field: string]: any;
|
1379 | name: string;
|
1380 | type: string;
|
1381 | version: string;
|
1382 | main: string;
|
1383 | module: string;
|
1384 | browser: string | Record<string, string | false>;
|
1385 | exports: string | Record<string, any> | string[];
|
1386 | dependencies: Record<string, string>;
|
1387 | };
|
1388 | }
|
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 | declare interface Plugin_2 extends Plugin_3 {
|
1412 | |
1413 |
|
1414 |
|
1415 |
|
1416 |
|
1417 |
|
1418 |
|
1419 |
|
1420 |
|
1421 |
|
1422 |
|
1423 |
|
1424 | enforce?: 'pre' | 'post';
|
1425 | |
1426 |
|
1427 |
|
1428 | apply?: 'serve' | 'build' | ((this: void, config: UserConfig, env: ConfigEnv) => boolean);
|
1429 | |
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 |
|
1437 | config?: ObjectHook<(this: void, config: UserConfig, env: ConfigEnv) => UserConfig | null | void | Promise<UserConfig | null | void>>;
|
1438 | |
1439 |
|
1440 |
|
1441 | configResolved?: ObjectHook<(this: void, config: ResolvedConfig) => void | Promise<void>>;
|
1442 | |
1443 |
|
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 |
|
1451 | configureServer?: ObjectHook<ServerHook>;
|
1452 | |
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 | configurePreviewServer?: ObjectHook<PreviewServerHook>;
|
1461 | |
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 | transformIndexHtml?: IndexHtmlTransform;
|
1477 | |
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 |
|
1492 | handleHotUpdate?: ObjectHook<(this: void, ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>>;
|
1493 | |
1494 |
|
1495 |
|
1496 | resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: {
|
1497 | custom?: CustomPluginOptions;
|
1498 | ssr?: boolean;
|
1499 |
|
1500 | isEntry: boolean;
|
1501 | }) => Promise<ResolveIdResult> | ResolveIdResult>;
|
1502 | load?: ObjectHook<(this: PluginContext, id: string, options?: {
|
1503 | ssr?: boolean;
|
1504 | }) => Promise<LoadResult> | LoadResult>;
|
1505 | transform?: ObjectHook<(this: TransformPluginContext, code: string, id: string, options?: {
|
1506 | ssr?: boolean;
|
1507 | }) => Promise<TransformResult_2> | TransformResult_2>;
|
1508 | }
|
1509 | export { Plugin_2 as Plugin }
|
1510 |
|
1511 | export declare interface PluginContainer {
|
1512 | options: InputOptions;
|
1513 | getModuleInfo(id: string): ModuleInfo | null;
|
1514 | buildStart(options: InputOptions): Promise<void>;
|
1515 | resolveId(id: string, importer?: string, options?: {
|
1516 | custom?: CustomPluginOptions;
|
1517 | skip?: Set<Plugin_2>;
|
1518 | ssr?: boolean;
|
1519 |
|
1520 | isEntry?: boolean;
|
1521 | }): Promise<PartialResolvedId | null>;
|
1522 | transform(code: string, id: string, options?: {
|
1523 | inMap?: SourceDescription['map'];
|
1524 | ssr?: boolean;
|
1525 | }): Promise<SourceDescription | null>;
|
1526 | load(id: string, options?: {
|
1527 | ssr?: boolean;
|
1528 | }): Promise<LoadResult | null>;
|
1529 | close(): Promise<void>;
|
1530 | }
|
1531 |
|
1532 | export declare interface PluginHookUtils {
|
1533 | getSortedPlugins: (hookName: keyof Plugin_2) => Plugin_2[];
|
1534 | getSortedPluginHooks: <K extends keyof Plugin_2>(hookName: K) => NonNullable<HookHandler<Plugin_2[K]>>[];
|
1535 | }
|
1536 |
|
1537 | export declare type PluginOption = Plugin_2 | false | null | undefined | PluginOption[] | Promise<Plugin_2 | false | null | undefined | PluginOption[]>;
|
1538 |
|
1539 |
|
1540 |
|
1541 |
|
1542 | export declare function preprocessCSS(code: string, filename: string, config: ResolvedConfig): Promise<PreprocessCSSResult>;
|
1543 |
|
1544 | export declare interface PreprocessCSSResult {
|
1545 | code: string;
|
1546 | map?: SourceMapInput;
|
1547 | modules?: Record<string, string>;
|
1548 | deps?: Set<string>;
|
1549 | }
|
1550 |
|
1551 |
|
1552 |
|
1553 |
|
1554 | export declare function preview(inlineConfig?: InlineConfig): Promise<PreviewServer>;
|
1555 |
|
1556 | export declare interface PreviewOptions extends CommonServerOptions {
|
1557 | }
|
1558 |
|
1559 | export declare interface PreviewServer {
|
1560 | |
1561 |
|
1562 |
|
1563 | config: ResolvedConfig;
|
1564 | |
1565 |
|
1566 |
|
1567 | httpServer: http.Server;
|
1568 | |
1569 |
|
1570 |
|
1571 | resolvedUrls: ResolvedServerUrls;
|
1572 | |
1573 |
|
1574 |
|
1575 | printUrls(): void;
|
1576 | }
|
1577 |
|
1578 | export declare type PreviewServerHook = (this: void, server: {
|
1579 | middlewares: Connect.Server;
|
1580 | httpServer: http.Server;
|
1581 | }) => (() => void) | void | Promise<(() => void) | void>;
|
1582 |
|
1583 | export declare interface ProxyOptions extends HttpProxy.ServerOptions {
|
1584 | |
1585 |
|
1586 |
|
1587 | rewrite?: (path: string) => string;
|
1588 | |
1589 |
|
1590 |
|
1591 | configure?: (proxy: HttpProxy.Server, options: ProxyOptions) => void;
|
1592 | |
1593 |
|
1594 |
|
1595 | bypass?: (req: http.IncomingMessage, res: http.ServerResponse, options: ProxyOptions) => void | null | undefined | false | string;
|
1596 | }
|
1597 |
|
1598 | export { PrunePayload }
|
1599 |
|
1600 | export declare type RenderBuiltAssetUrl = (filename: string, type: {
|
1601 | type: 'asset' | 'public';
|
1602 | hostId: string;
|
1603 | hostType: 'js' | 'css' | 'html';
|
1604 | ssr: boolean;
|
1605 | }) => string | {
|
1606 | relative?: boolean;
|
1607 | runtime?: string;
|
1608 | } | undefined;
|
1609 |
|
1610 |
|
1611 |
|
1612 |
|
1613 |
|
1614 | export declare function resolveBaseUrl(base: string | undefined, isBuild: boolean, logger: Logger): string;
|
1615 |
|
1616 | export declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string): Promise<ResolvedConfig>;
|
1617 |
|
1618 | export declare interface ResolvedBuildOptions extends Required<Omit<BuildOptions, 'polyfillModulePreload'>> {
|
1619 | modulePreload: false | ResolvedModulePreloadOptions;
|
1620 | }
|
1621 |
|
1622 | export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'assetsInclude' | 'optimizeDeps' | 'worker'> & {
|
1623 | configFile: string | undefined;
|
1624 | configFileDependencies: string[];
|
1625 | inlineConfig: InlineConfig;
|
1626 | root: string;
|
1627 | base: string;
|
1628 | publicDir: string;
|
1629 | cacheDir: string;
|
1630 | command: 'build' | 'serve';
|
1631 | mode: string;
|
1632 | isWorker: boolean;
|
1633 |
|
1634 | isProduction: boolean;
|
1635 | env: Record<string, any>;
|
1636 | resolve: Required<ResolveOptions> & {
|
1637 | alias: Alias[];
|
1638 | };
|
1639 | plugins: readonly Plugin_2[];
|
1640 | server: ResolvedServerOptions;
|
1641 | build: ResolvedBuildOptions;
|
1642 | preview: ResolvedPreviewOptions;
|
1643 | ssr: ResolvedSSROptions;
|
1644 | assetsInclude: (file: string) => boolean;
|
1645 | logger: Logger;
|
1646 | createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
|
1647 | optimizeDeps: DepOptimizationOptions;
|
1648 |
|
1649 | worker: ResolveWorkerOptions;
|
1650 | appType: AppType;
|
1651 | experimental: ExperimentalOptions;
|
1652 | } & PluginHookUtils>;
|
1653 |
|
1654 | export declare interface ResolvedModulePreloadOptions {
|
1655 | polyfill: boolean;
|
1656 | resolveDependencies?: ResolveModulePreloadDependenciesFn;
|
1657 | }
|
1658 |
|
1659 | export declare interface ResolvedPreviewOptions extends PreviewOptions {
|
1660 | }
|
1661 |
|
1662 | export declare interface ResolvedServerOptions extends ServerOptions {
|
1663 | fs: Required<FileSystemServeOptions>;
|
1664 | middlewareMode: boolean;
|
1665 | }
|
1666 |
|
1667 | export declare interface ResolvedServerUrls {
|
1668 | local: string[];
|
1669 | network: string[];
|
1670 | }
|
1671 |
|
1672 | export declare interface ResolvedSSROptions extends SSROptions {
|
1673 | target: SSRTarget;
|
1674 | format: SSRFormat;
|
1675 | optimizeDeps: SsrDepOptimizationOptions;
|
1676 | }
|
1677 |
|
1678 | export declare type ResolvedUrl = [
|
1679 | url: string,
|
1680 | resolvedId: string,
|
1681 | meta: object | null | undefined
|
1682 | ];
|
1683 |
|
1684 | export declare function resolveEnvPrefix({ envPrefix }: UserConfig): string[];
|
1685 |
|
1686 | export declare type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
|
1687 |
|
1688 | export declare type ResolveModulePreloadDependenciesFn = (filename: string, deps: string[], context: {
|
1689 | hostId: string;
|
1690 | hostType: 'html' | 'js';
|
1691 | }) => string[];
|
1692 |
|
1693 | export declare interface ResolveOptions {
|
1694 | mainFields?: string[];
|
1695 | |
1696 |
|
1697 |
|
1698 |
|
1699 | browserField?: boolean;
|
1700 | conditions?: string[];
|
1701 | extensions?: string[];
|
1702 | dedupe?: string[];
|
1703 | preserveSymlinks?: boolean;
|
1704 | }
|
1705 |
|
1706 | export declare function resolvePackageData(id: string, basedir: string, preserveSymlinks?: boolean, packageCache?: PackageCache): PackageData | null;
|
1707 |
|
1708 | export declare function resolvePackageEntry(id: string, { dir, data, setResolvedCache, getResolvedCache }: PackageData, targetWeb: boolean, options: InternalResolveOptions): string | undefined;
|
1709 |
|
1710 | export declare type ResolverFunction = MapToFunction<PluginHooks['resolveId']>
|
1711 |
|
1712 | export declare interface ResolverObject {
|
1713 | buildStart?: PluginHooks['buildStart']
|
1714 | resolveId: ResolverFunction
|
1715 | }
|
1716 |
|
1717 | export declare interface ResolveWorkerOptions extends PluginHookUtils {
|
1718 | format: 'es' | 'iife';
|
1719 | plugins: Plugin_2[];
|
1720 | rollupOptions: RollupOptions;
|
1721 | }
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 |
|
1727 |
|
1728 |
|
1729 |
|
1730 | export declare interface RollupCommonJSOptions {
|
1731 | |
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 |
|
1740 | include?: string | RegExp | readonly (string | RegExp)[]
|
1741 | |
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 | exclude?: string | RegExp | readonly (string | RegExp)[]
|
1749 | |
1750 |
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 | extensions?: ReadonlyArray<string>
|
1756 | |
1757 |
|
1758 |
|
1759 |
|
1760 | ignoreGlobal?: boolean
|
1761 | |
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 | sourceMap?: boolean
|
1767 | |
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 |
|
1773 |
|
1774 |
|
1775 |
|
1776 |
|
1777 |
|
1778 | ignoreDynamicRequires?: boolean
|
1779 | |
1780 |
|
1781 |
|
1782 |
|
1783 |
|
1784 |
|
1785 |
|
1786 |
|
1787 |
|
1788 |
|
1789 |
|
1790 | transformMixedEsModules?: boolean
|
1791 | |
1792 |
|
1793 |
|
1794 |
|
1795 |
|
1796 |
|
1797 |
|
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 |
|
1803 |
|
1804 |
|
1805 |
|
1806 |
|
1807 |
|
1808 |
|
1809 |
|
1810 |
|
1811 |
|
1812 |
|
1813 |
|
1814 |
|
1815 |
|
1816 |
|
1817 |
|
1818 |
|
1819 |
|
1820 |
|
1821 |
|
1822 |
|
1823 | strictRequires?: boolean | string | RegExp | readonly (string | RegExp)[]
|
1824 | |
1825 |
|
1826 |
|
1827 |
|
1828 |
|
1829 | ignore?: ReadonlyArray<string> | ((id: string) => boolean)
|
1830 | |
1831 |
|
1832 |
|
1833 |
|
1834 |
|
1835 |
|
1836 |
|
1837 |
|
1838 |
|
1839 |
|
1840 |
|
1841 |
|
1842 |
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 | ignoreTryCatch?:
|
1848 | | boolean
|
1849 | | 'remove'
|
1850 | | ReadonlyArray<string>
|
1851 | | ((id: string) => boolean | 'remove')
|
1852 | |
1853 |
|
1854 |
|
1855 |
|
1856 |
|
1857 |
|
1858 |
|
1859 |
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 | esmExternals?: boolean | ReadonlyArray<string> | ((id: string) => boolean)
|
1870 | |
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 |
|
1876 |
|
1877 |
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 | requireReturnsDefault?:
|
1921 | | boolean
|
1922 | | 'auto'
|
1923 | | 'preferred'
|
1924 | | 'namespace'
|
1925 | | ((id: string) => boolean | 'auto' | 'preferred' | 'namespace')
|
1926 |
|
1927 | |
1928 |
|
1929 |
|
1930 | defaultIsModuleExports?: boolean | 'auto' | ((id: string) => boolean | 'auto')
|
1931 | |
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 | dynamicRequireTargets?: string | ReadonlyArray<string>
|
1945 | |
1946 |
|
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 | dynamicRequireRoot?: string
|
1952 | }
|
1953 |
|
1954 | export declare interface RollupDynamicImportVarsOptions {
|
1955 | |
1956 |
|
1957 |
|
1958 |
|
1959 | include?: string | RegExp | (string | RegExp)[]
|
1960 | |
1961 |
|
1962 |
|
1963 |
|
1964 | exclude?: string | RegExp | (string | RegExp)[]
|
1965 | |
1966 |
|
1967 |
|
1968 |
|
1969 | warnOnError?: boolean
|
1970 | }
|
1971 |
|
1972 | export { rollupVersion }
|
1973 |
|
1974 |
|
1975 |
|
1976 |
|
1977 | export declare function searchForWorkspaceRoot(current: string, root?: string): string;
|
1978 |
|
1979 | export declare function send(req: IncomingMessage, res: ServerResponse, content: string | Buffer, type: string, options: SendOptions): void;
|
1980 |
|
1981 | export declare interface SendOptions {
|
1982 | etag?: string;
|
1983 | cacheControl?: string;
|
1984 | headers?: OutgoingHttpHeaders;
|
1985 | map?: SourceMap | null;
|
1986 | }
|
1987 |
|
1988 | export declare type ServerHook = (this: void, server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
|
1989 |
|
1990 | export declare interface ServerOptions extends CommonServerOptions {
|
1991 | |
1992 |
|
1993 |
|
1994 | hmr?: HmrOptions | boolean;
|
1995 | |
1996 |
|
1997 |
|
1998 |
|
1999 | watch?: WatchOptions;
|
2000 | |
2001 |
|
2002 |
|
2003 | middlewareMode?: boolean | 'html' | 'ssr';
|
2004 | |
2005 |
|
2006 |
|
2007 |
|
2008 | base?: string;
|
2009 | |
2010 |
|
2011 |
|
2012 | fs?: FileSystemServeOptions;
|
2013 | |
2014 |
|
2015 |
|
2016 |
|
2017 |
|
2018 | origin?: string;
|
2019 | |
2020 |
|
2021 |
|
2022 |
|
2023 | preTransformRequests?: boolean;
|
2024 | |
2025 |
|
2026 |
|
2027 |
|
2028 |
|
2029 |
|
2030 | force?: boolean;
|
2031 | }
|
2032 |
|
2033 | export declare function sortUserPlugins(plugins: (Plugin_2 | Plugin_2[])[] | undefined): [Plugin_2[], Plugin_2[], Plugin_2[]];
|
2034 |
|
2035 | export declare function splitVendorChunk(options?: {
|
2036 | cache?: SplitVendorChunkCache;
|
2037 | }): GetManualChunk;
|
2038 |
|
2039 | export declare class SplitVendorChunkCache {
|
2040 | cache: Map<string, boolean>;
|
2041 | constructor();
|
2042 | reset(): void;
|
2043 | }
|
2044 |
|
2045 | export declare function splitVendorChunkPlugin(): Plugin_2;
|
2046 |
|
2047 | export declare type SsrDepOptimizationOptions = DepOptimizationConfig;
|
2048 |
|
2049 | export declare type SSRFormat = 'esm' | 'cjs';
|
2050 |
|
2051 | export declare interface SSROptions {
|
2052 | noExternal?: string | RegExp | (string | RegExp)[] | true;
|
2053 | external?: string[];
|
2054 | |
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 | target?: SSRTarget;
|
2060 | |
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 | format?: SSRFormat;
|
2068 | |
2069 |
|
2070 |
|
2071 |
|
2072 |
|
2073 |
|
2074 |
|
2075 |
|
2076 | optimizeDeps?: SsrDepOptimizationOptions;
|
2077 | }
|
2078 |
|
2079 | export declare type SSRTarget = 'node' | 'webworker';
|
2080 |
|
2081 | export declare namespace Terser {
|
2082 | export type ECMA = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020
|
2083 |
|
2084 | export interface ParseOptions {
|
2085 | bare_returns?: boolean
|
2086 |
|
2087 | ecma?: ECMA
|
2088 | html5_comments?: boolean
|
2089 | shebang?: boolean
|
2090 | }
|
2091 |
|
2092 | export interface CompressOptions {
|
2093 | arguments?: boolean
|
2094 | arrows?: boolean
|
2095 | booleans_as_integers?: boolean
|
2096 | booleans?: boolean
|
2097 | collapse_vars?: boolean
|
2098 | comparisons?: boolean
|
2099 | computed_props?: boolean
|
2100 | conditionals?: boolean
|
2101 | dead_code?: boolean
|
2102 | defaults?: boolean
|
2103 | directives?: boolean
|
2104 | drop_console?: boolean
|
2105 | drop_debugger?: boolean
|
2106 | ecma?: ECMA
|
2107 | evaluate?: boolean
|
2108 | expression?: boolean
|
2109 | global_defs?: object
|
2110 | hoist_funs?: boolean
|
2111 | hoist_props?: boolean
|
2112 | hoist_vars?: boolean
|
2113 | ie8?: boolean
|
2114 | if_return?: boolean
|
2115 | inline?: boolean | InlineFunctions
|
2116 | join_vars?: boolean
|
2117 | keep_classnames?: boolean | RegExp
|
2118 | keep_fargs?: boolean
|
2119 | keep_fnames?: boolean | RegExp
|
2120 | keep_infinity?: boolean
|
2121 | loops?: boolean
|
2122 | module?: boolean
|
2123 | negate_iife?: boolean
|
2124 | passes?: number
|
2125 | properties?: boolean
|
2126 | pure_funcs?: string[]
|
2127 | pure_getters?: boolean | 'strict'
|
2128 | reduce_funcs?: boolean
|
2129 | reduce_vars?: boolean
|
2130 | sequences?: boolean | number
|
2131 | side_effects?: boolean
|
2132 | switches?: boolean
|
2133 | toplevel?: boolean
|
2134 | top_retain?: null | string | string[] | RegExp
|
2135 | typeofs?: boolean
|
2136 | unsafe_arrows?: boolean
|
2137 | unsafe?: boolean
|
2138 | unsafe_comps?: boolean
|
2139 | unsafe_Function?: boolean
|
2140 | unsafe_math?: boolean
|
2141 | unsafe_symbols?: boolean
|
2142 | unsafe_methods?: boolean
|
2143 | unsafe_proto?: boolean
|
2144 | unsafe_regexp?: boolean
|
2145 | unsafe_undefined?: boolean
|
2146 | unused?: boolean
|
2147 | }
|
2148 |
|
2149 | export enum InlineFunctions {
|
2150 | Disabled = 0,
|
2151 | SimpleFunctions = 1,
|
2152 | WithArguments = 2,
|
2153 | WithArgumentsAndVariables = 3
|
2154 | }
|
2155 |
|
2156 | export interface MangleOptions {
|
2157 | eval?: boolean
|
2158 | keep_classnames?: boolean | RegExp
|
2159 | keep_fnames?: boolean | RegExp
|
2160 | module?: boolean
|
2161 | nth_identifier?: SimpleIdentifierMangler | WeightedIdentifierMangler
|
2162 | properties?: boolean | ManglePropertiesOptions
|
2163 | reserved?: string[]
|
2164 | safari10?: boolean
|
2165 | toplevel?: boolean
|
2166 | }
|
2167 |
|
2168 | |
2169 |
|
2170 |
|
2171 | export interface SimpleIdentifierMangler {
|
2172 | |
2173 |
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 | get(n: number): string
|
2179 | }
|
2180 |
|
2181 | |
2182 |
|
2183 |
|
2184 | export interface WeightedIdentifierMangler extends SimpleIdentifierMangler {
|
2185 | |
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 | consider(chars: string, delta: number): number
|
2192 | |
2193 |
|
2194 |
|
2195 | reset(): void
|
2196 | |
2197 |
|
2198 |
|
2199 | sort(): void
|
2200 | }
|
2201 |
|
2202 | export interface ManglePropertiesOptions {
|
2203 | builtins?: boolean
|
2204 | debug?: boolean
|
2205 | keep_quoted?: boolean | 'strict'
|
2206 | nth_identifier?: SimpleIdentifierMangler | WeightedIdentifierMangler
|
2207 | regex?: RegExp | string
|
2208 | reserved?: string[]
|
2209 | }
|
2210 |
|
2211 | export interface FormatOptions {
|
2212 | ascii_only?: boolean
|
2213 |
|
2214 | beautify?: boolean
|
2215 | braces?: boolean
|
2216 | comments?:
|
2217 | | boolean
|
2218 | | 'all'
|
2219 | | 'some'
|
2220 | | RegExp
|
2221 | | ((
|
2222 | node: any,
|
2223 | comment: {
|
2224 | value: string
|
2225 | type: 'comment1' | 'comment2' | 'comment3' | 'comment4'
|
2226 | pos: number
|
2227 | line: number
|
2228 | col: number
|
2229 | }
|
2230 | ) => boolean)
|
2231 | ecma?: ECMA
|
2232 | ie8?: boolean
|
2233 | keep_numbers?: boolean
|
2234 | indent_level?: number
|
2235 | indent_start?: number
|
2236 | inline_script?: boolean
|
2237 | keep_quoted_props?: boolean
|
2238 | max_line_len?: number | false
|
2239 | preamble?: string
|
2240 | preserve_annotations?: boolean
|
2241 | quote_keys?: boolean
|
2242 | quote_style?: OutputQuoteStyle
|
2243 | safari10?: boolean
|
2244 | semicolons?: boolean
|
2245 | shebang?: boolean
|
2246 | shorthand?: boolean
|
2247 | source_map?: SourceMapOptions
|
2248 | webkit?: boolean
|
2249 | width?: number
|
2250 | wrap_iife?: boolean
|
2251 | wrap_func_args?: boolean
|
2252 | }
|
2253 |
|
2254 | export enum OutputQuoteStyle {
|
2255 | PreferDouble = 0,
|
2256 | AlwaysSingle = 1,
|
2257 | AlwaysDouble = 2,
|
2258 | AlwaysOriginal = 3
|
2259 | }
|
2260 |
|
2261 | export interface MinifyOptions {
|
2262 | compress?: boolean | CompressOptions
|
2263 | ecma?: ECMA
|
2264 | enclose?: boolean | string
|
2265 | ie8?: boolean
|
2266 | keep_classnames?: boolean | RegExp
|
2267 | keep_fnames?: boolean | RegExp
|
2268 | mangle?: boolean | MangleOptions
|
2269 | module?: boolean
|
2270 | nameCache?: object
|
2271 | format?: FormatOptions
|
2272 |
|
2273 | output?: FormatOptions
|
2274 | parse?: ParseOptions
|
2275 | safari10?: boolean
|
2276 | sourceMap?: boolean | SourceMapOptions
|
2277 | toplevel?: boolean
|
2278 | }
|
2279 |
|
2280 | export interface MinifyOutput {
|
2281 | code?: string
|
2282 | map?: object | string
|
2283 | decoded_map?: object | null
|
2284 | }
|
2285 |
|
2286 | export interface SourceMapOptions {
|
2287 |
|
2288 | content?: object | string
|
2289 | includeSources?: boolean
|
2290 | filename?: string
|
2291 | root?: string
|
2292 | url?: string | 'inline'
|
2293 | }
|
2294 | }
|
2295 |
|
2296 | export declare interface TransformOptions {
|
2297 | ssr?: boolean;
|
2298 | html?: boolean;
|
2299 | }
|
2300 |
|
2301 | export declare interface TransformResult {
|
2302 | code: string;
|
2303 | map: SourceMap | null;
|
2304 | etag?: string;
|
2305 | deps?: string[];
|
2306 | dynamicDeps?: string[];
|
2307 | }
|
2308 |
|
2309 | export declare function transformWithEsbuild(code: string, filename: string, options?: EsbuildTransformOptions, inMap?: object): Promise<ESBuildTransformResult>;
|
2310 |
|
2311 | export { Update }
|
2312 |
|
2313 | export { UpdatePayload }
|
2314 |
|
2315 | export declare interface UserConfig {
|
2316 | |
2317 |
|
2318 |
|
2319 |
|
2320 |
|
2321 | root?: string;
|
2322 | |
2323 |
|
2324 |
|
2325 |
|
2326 | base?: string;
|
2327 | |
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 | publicDir?: string | false;
|
2336 | |
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 | cacheDir?: string;
|
2346 | |
2347 |
|
2348 |
|
2349 |
|
2350 | mode?: string;
|
2351 | |
2352 |
|
2353 |
|
2354 |
|
2355 | define?: Record<string, any>;
|
2356 | |
2357 |
|
2358 |
|
2359 | plugins?: PluginOption[];
|
2360 | |
2361 |
|
2362 |
|
2363 | resolve?: ResolveOptions & {
|
2364 | alias?: AliasOptions;
|
2365 | };
|
2366 | |
2367 |
|
2368 |
|
2369 | css?: CSSOptions;
|
2370 | |
2371 |
|
2372 |
|
2373 | json?: JsonOptions;
|
2374 | |
2375 |
|
2376 |
|
2377 |
|
2378 | esbuild?: ESBuildOptions | false;
|
2379 | |
2380 |
|
2381 |
|
2382 | assetsInclude?: string | RegExp | (string | RegExp)[];
|
2383 | |
2384 |
|
2385 |
|
2386 | server?: ServerOptions;
|
2387 | |
2388 |
|
2389 |
|
2390 | build?: BuildOptions;
|
2391 | |
2392 |
|
2393 |
|
2394 | preview?: PreviewOptions;
|
2395 | |
2396 |
|
2397 |
|
2398 | optimizeDeps?: DepOptimizationOptions;
|
2399 | |
2400 |
|
2401 |
|
2402 | ssr?: SSROptions;
|
2403 | |
2404 |
|
2405 |
|
2406 |
|
2407 |
|
2408 |
|
2409 |
|
2410 | experimental?: ExperimentalOptions;
|
2411 | |
2412 |
|
2413 |
|
2414 |
|
2415 |
|
2416 |
|
2417 | legacy?: LegacyOptions;
|
2418 | |
2419 |
|
2420 |
|
2421 |
|
2422 | logLevel?: LogLevel;
|
2423 | |
2424 |
|
2425 |
|
2426 | customLogger?: Logger;
|
2427 | |
2428 |
|
2429 |
|
2430 | clearScreen?: boolean;
|
2431 | |
2432 |
|
2433 |
|
2434 |
|
2435 |
|
2436 | envDir?: string;
|
2437 | |
2438 |
|
2439 |
|
2440 |
|
2441 | envPrefix?: string | string[];
|
2442 | |
2443 |
|
2444 |
|
2445 | worker?: {
|
2446 | |
2447 |
|
2448 |
|
2449 |
|
2450 | format?: 'es' | 'iife';
|
2451 | |
2452 |
|
2453 |
|
2454 | plugins?: PluginOption[];
|
2455 | |
2456 |
|
2457 |
|
2458 | rollupOptions?: Omit<RollupOptions, 'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures'>;
|
2459 | };
|
2460 | |
2461 |
|
2462 |
|
2463 |
|
2464 |
|
2465 |
|
2466 | appType?: AppType;
|
2467 | }
|
2468 |
|
2469 | export declare type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFn;
|
2470 |
|
2471 | export declare type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
|
2472 |
|
2473 | export declare const version: string;
|
2474 |
|
2475 | export declare interface ViteDevServer {
|
2476 | |
2477 |
|
2478 |
|
2479 | config: ResolvedConfig;
|
2480 | |
2481 |
|
2482 |
|
2483 |
|
2484 |
|
2485 |
|
2486 |
|
2487 |
|
2488 | middlewares: Connect.Server;
|
2489 | |
2490 |
|
2491 |
|
2492 |
|
2493 | httpServer: http.Server | null;
|
2494 | |
2495 |
|
2496 |
|
2497 |
|
2498 | watcher: FSWatcher;
|
2499 | |
2500 |
|
2501 |
|
2502 | ws: WebSocketServer;
|
2503 | |
2504 |
|
2505 |
|
2506 | pluginContainer: PluginContainer;
|
2507 | |
2508 |
|
2509 |
|
2510 |
|
2511 | moduleGraph: ModuleGraph;
|
2512 | |
2513 |
|
2514 |
|
2515 |
|
2516 | resolvedUrls: ResolvedServerUrls | null;
|
2517 | |
2518 |
|
2519 |
|
2520 |
|
2521 | transformRequest(url: string, options?: TransformOptions): Promise<TransformResult | null>;
|
2522 | |
2523 |
|
2524 |
|
2525 | transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>;
|
2526 | |
2527 |
|
2528 |
|
2529 | ssrTransform(code: string, inMap: SourceMap | null, url: string, originalCode?: string): Promise<TransformResult | null>;
|
2530 | |
2531 |
|
2532 |
|
2533 | ssrLoadModule(url: string, opts?: {
|
2534 | fixStacktrace?: boolean;
|
2535 | }): Promise<Record<string, any>>;
|
2536 | |
2537 |
|
2538 |
|
2539 | ssrRewriteStacktrace(stack: string): string;
|
2540 | |
2541 |
|
2542 |
|
2543 | ssrFixStacktrace(e: Error): void;
|
2544 | |
2545 |
|
2546 |
|
2547 |
|
2548 | reloadModule(module: ModuleNode): Promise<void>;
|
2549 | |
2550 |
|
2551 |
|
2552 | listen(port?: number, isRestart?: boolean): Promise<ViteDevServer>;
|
2553 | |
2554 |
|
2555 |
|
2556 | close(): Promise<void>;
|
2557 | |
2558 |
|
2559 |
|
2560 | printUrls(): void;
|
2561 | |
2562 |
|
2563 |
|
2564 |
|
2565 |
|
2566 | restart(forceOptimize?: boolean): Promise<void>;
|
2567 |
|
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 |
|
2573 | }
|
2574 |
|
2575 | export declare interface WatchOptions {
|
2576 | |
2577 |
|
2578 |
|
2579 |
|
2580 |
|
2581 | persistent?: boolean
|
2582 |
|
2583 | |
2584 |
|
2585 |
|
2586 |
|
2587 |
|
2588 |
|
2589 |
|
2590 | ignored?: Matcher
|
2591 |
|
2592 | |
2593 |
|
2594 |
|
2595 |
|
2596 | ignoreInitial?: boolean
|
2597 |
|
2598 | |
2599 |
|
2600 |
|
2601 |
|
2602 | followSymlinks?: boolean
|
2603 |
|
2604 | |
2605 |
|
2606 |
|
2607 |
|
2608 | cwd?: string
|
2609 |
|
2610 | |
2611 |
|
2612 |
|
2613 |
|
2614 |
|
2615 |
|
2616 | disableGlobbing?: boolean
|
2617 |
|
2618 | |
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 |
|
2624 |
|
2625 | usePolling?: boolean
|
2626 |
|
2627 | |
2628 |
|
2629 |
|
2630 |
|
2631 |
|
2632 | useFsEvents?: boolean
|
2633 |
|
2634 | |
2635 |
|
2636 |
|
2637 |
|
2638 |
|
2639 | alwaysStat?: boolean
|
2640 |
|
2641 | |
2642 |
|
2643 |
|
2644 | depth?: number
|
2645 |
|
2646 | |
2647 |
|
2648 |
|
2649 | interval?: number
|
2650 |
|
2651 | |
2652 |
|
2653 |
|
2654 |
|
2655 | binaryInterval?: number
|
2656 |
|
2657 | |
2658 |
|
2659 |
|
2660 |
|
2661 |
|
2662 | ignorePermissionErrors?: boolean
|
2663 |
|
2664 | |
2665 |
|
2666 |
|
2667 |
|
2668 |
|
2669 |
|
2670 |
|
2671 | atomic?: boolean | number
|
2672 |
|
2673 | |
2674 |
|
2675 |
|
2676 | awaitWriteFinish?: AwaitWriteFinishOptions | boolean
|
2677 | }
|
2678 |
|
2679 | declare class WebSocket_2 extends EventEmitter {
|
2680 |
|
2681 | static readonly CONNECTING: 0
|
2682 |
|
2683 | static readonly OPEN: 1
|
2684 |
|
2685 | static readonly CLOSING: 2
|
2686 |
|
2687 | static readonly CLOSED: 3
|
2688 |
|
2689 | binaryType: 'nodebuffer' | 'arraybuffer' | 'fragments'
|
2690 | readonly bufferedAmount: number
|
2691 | readonly extensions: string
|
2692 |
|
2693 | readonly isPaused: boolean
|
2694 | readonly protocol: string
|
2695 |
|
2696 | readonly readyState:
|
2697 | | typeof WebSocket_2.CONNECTING
|
2698 | | typeof WebSocket_2.OPEN
|
2699 | | typeof WebSocket_2.CLOSING
|
2700 | | typeof WebSocket_2.CLOSED
|
2701 | readonly url: string
|
2702 |
|
2703 |
|
2704 | readonly CONNECTING: 0
|
2705 |
|
2706 | readonly OPEN: 1
|
2707 |
|
2708 | readonly CLOSING: 2
|
2709 |
|
2710 | readonly CLOSED: 3
|
2711 |
|
2712 | onopen: ((event: WebSocket_2.Event) => void) | null
|
2713 | onerror: ((event: WebSocket_2.ErrorEvent) => void) | null
|
2714 | onclose: ((event: WebSocket_2.CloseEvent) => void) | null
|
2715 | onmessage: ((event: WebSocket_2.MessageEvent) => void) | null
|
2716 |
|
2717 | constructor(address: null)
|
2718 | constructor(
|
2719 | address: string | URL_2,
|
2720 | options?: WebSocket_2.ClientOptions | ClientRequestArgs
|
2721 | )
|
2722 | constructor(
|
2723 | address: string | URL_2,
|
2724 | protocols?: string | string[],
|
2725 | options?: WebSocket_2.ClientOptions | ClientRequestArgs
|
2726 | )
|
2727 |
|
2728 | close(code?: number, data?: string | Buffer): void
|
2729 | ping(data?: any, mask?: boolean, cb?: (err: Error) => void): void
|
2730 | pong(data?: any, mask?: boolean, cb?: (err: Error) => void): void
|
2731 | send(data: any, cb?: (err?: Error) => void): void
|
2732 | send(
|
2733 | data: any,
|
2734 | options: {
|
2735 | mask?: boolean | undefined
|
2736 | binary?: boolean | undefined
|
2737 | compress?: boolean | undefined
|
2738 | fin?: boolean | undefined
|
2739 | },
|
2740 | cb?: (err?: Error) => void
|
2741 | ): void
|
2742 | terminate(): void
|
2743 |
|
2744 | |
2745 |
|
2746 |
|
2747 |
|
2748 |
|
2749 | pause(): void
|
2750 | |
2751 |
|
2752 |
|
2753 |
|
2754 | resume(): void
|
2755 |
|
2756 |
|
2757 | addEventListener(
|
2758 | method: 'message',
|
2759 | cb: (event: WebSocket_2.MessageEvent) => void,
|
2760 | options?: WebSocket_2.EventListenerOptions
|
2761 | ): void
|
2762 | addEventListener(
|
2763 | method: 'close',
|
2764 | cb: (event: WebSocket_2.CloseEvent) => void,
|
2765 | options?: WebSocket_2.EventListenerOptions
|
2766 | ): void
|
2767 | addEventListener(
|
2768 | method: 'error',
|
2769 | cb: (event: WebSocket_2.ErrorEvent) => void,
|
2770 | options?: WebSocket_2.EventListenerOptions
|
2771 | ): void
|
2772 | addEventListener(
|
2773 | method: 'open',
|
2774 | cb: (event: WebSocket_2.Event) => void,
|
2775 | options?: WebSocket_2.EventListenerOptions
|
2776 | ): void
|
2777 |
|
2778 | removeEventListener(
|
2779 | method: 'message',
|
2780 | cb: (event: WebSocket_2.MessageEvent) => void
|
2781 | ): void
|
2782 | removeEventListener(
|
2783 | method: 'close',
|
2784 | cb: (event: WebSocket_2.CloseEvent) => void
|
2785 | ): void
|
2786 | removeEventListener(
|
2787 | method: 'error',
|
2788 | cb: (event: WebSocket_2.ErrorEvent) => void
|
2789 | ): void
|
2790 | removeEventListener(
|
2791 | method: 'open',
|
2792 | cb: (event: WebSocket_2.Event) => void
|
2793 | ): void
|
2794 |
|
2795 |
|
2796 | on(
|
2797 | event: 'close',
|
2798 | listener: (this: WebSocket_2, code: number, reason: Buffer) => void
|
2799 | ): this
|
2800 | on(event: 'error', listener: (this: WebSocket_2, err: Error) => void): this
|
2801 | on(
|
2802 | event: 'upgrade',
|
2803 | listener: (this: WebSocket_2, request: IncomingMessage) => void
|
2804 | ): this
|
2805 | on(
|
2806 | event: 'message',
|
2807 | listener: (
|
2808 | this: WebSocket_2,
|
2809 | data: WebSocket_2.RawData,
|
2810 | isBinary: boolean
|
2811 | ) => void
|
2812 | ): this
|
2813 | on(event: 'open', listener: (this: WebSocket_2) => void): this
|
2814 | on(
|
2815 | event: 'ping' | 'pong',
|
2816 | listener: (this: WebSocket_2, data: Buffer) => void
|
2817 | ): this
|
2818 | on(
|
2819 | event: 'unexpected-response',
|
2820 | listener: (
|
2821 | this: WebSocket_2,
|
2822 | request: ClientRequest,
|
2823 | response: IncomingMessage
|
2824 | ) => void
|
2825 | ): this
|
2826 | on(
|
2827 | event: string | symbol,
|
2828 | listener: (this: WebSocket_2, ...args: any[]) => void
|
2829 | ): this
|
2830 |
|
2831 | once(
|
2832 | event: 'close',
|
2833 | listener: (this: WebSocket_2, code: number, reason: Buffer) => void
|
2834 | ): this
|
2835 | once(event: 'error', listener: (this: WebSocket_2, err: Error) => void): this
|
2836 | once(
|
2837 | event: 'upgrade',
|
2838 | listener: (this: WebSocket_2, request: IncomingMessage) => void
|
2839 | ): this
|
2840 | once(
|
2841 | event: 'message',
|
2842 | listener: (
|
2843 | this: WebSocket_2,
|
2844 | data: WebSocket_2.RawData,
|
2845 | isBinary: boolean
|
2846 | ) => void
|
2847 | ): this
|
2848 | once(event: 'open', listener: (this: WebSocket_2) => void): this
|
2849 | once(
|
2850 | event: 'ping' | 'pong',
|
2851 | listener: (this: WebSocket_2, data: Buffer) => void
|
2852 | ): this
|
2853 | once(
|
2854 | event: 'unexpected-response',
|
2855 | listener: (
|
2856 | this: WebSocket_2,
|
2857 | request: ClientRequest,
|
2858 | response: IncomingMessage
|
2859 | ) => void
|
2860 | ): this
|
2861 | once(
|
2862 | event: string | symbol,
|
2863 | listener: (this: WebSocket_2, ...args: any[]) => void
|
2864 | ): this
|
2865 |
|
2866 | off(
|
2867 | event: 'close',
|
2868 | listener: (this: WebSocket_2, code: number, reason: Buffer) => void
|
2869 | ): this
|
2870 | off(event: 'error', listener: (this: WebSocket_2, err: Error) => void): this
|
2871 | off(
|
2872 | event: 'upgrade',
|
2873 | listener: (this: WebSocket_2, request: IncomingMessage) => void
|
2874 | ): this
|
2875 | off(
|
2876 | event: 'message',
|
2877 | listener: (
|
2878 | this: WebSocket_2,
|
2879 | data: WebSocket_2.RawData,
|
2880 | isBinary: boolean
|
2881 | ) => void
|
2882 | ): this
|
2883 | off(event: 'open', listener: (this: WebSocket_2) => void): this
|
2884 | off(
|
2885 | event: 'ping' | 'pong',
|
2886 | listener: (this: WebSocket_2, data: Buffer) => void
|
2887 | ): this
|
2888 | off(
|
2889 | event: 'unexpected-response',
|
2890 | listener: (
|
2891 | this: WebSocket_2,
|
2892 | request: ClientRequest,
|
2893 | response: IncomingMessage
|
2894 | ) => void
|
2895 | ): this
|
2896 | off(
|
2897 | event: string | symbol,
|
2898 | listener: (this: WebSocket_2, ...args: any[]) => void
|
2899 | ): this
|
2900 |
|
2901 | addListener(
|
2902 | event: 'close',
|
2903 | listener: (code: number, reason: Buffer) => void
|
2904 | ): this
|
2905 | addListener(event: 'error', listener: (err: Error) => void): this
|
2906 | addListener(
|
2907 | event: 'upgrade',
|
2908 | listener: (request: IncomingMessage) => void
|
2909 | ): this
|
2910 | addListener(
|
2911 | event: 'message',
|
2912 | listener: (data: WebSocket_2.RawData, isBinary: boolean) => void
|
2913 | ): this
|
2914 | addListener(event: 'open', listener: () => void): this
|
2915 | addListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this
|
2916 | addListener(
|
2917 | event: 'unexpected-response',
|
2918 | listener: (request: ClientRequest, response: IncomingMessage) => void
|
2919 | ): this
|
2920 | addListener(event: string | symbol, listener: (...args: any[]) => void): this
|
2921 |
|
2922 | removeListener(
|
2923 | event: 'close',
|
2924 | listener: (code: number, reason: Buffer) => void
|
2925 | ): this
|
2926 | removeListener(event: 'error', listener: (err: Error) => void): this
|
2927 | removeListener(
|
2928 | event: 'upgrade',
|
2929 | listener: (request: IncomingMessage) => void
|
2930 | ): this
|
2931 | removeListener(
|
2932 | event: 'message',
|
2933 | listener: (data: WebSocket_2.RawData, isBinary: boolean) => void
|
2934 | ): this
|
2935 | removeListener(event: 'open', listener: () => void): this
|
2936 | removeListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this
|
2937 | removeListener(
|
2938 | event: 'unexpected-response',
|
2939 | listener: (request: ClientRequest, response: IncomingMessage) => void
|
2940 | ): this
|
2941 | removeListener(
|
2942 | event: string | symbol,
|
2943 | listener: (...args: any[]) => void
|
2944 | ): this
|
2945 | }
|
2946 |
|
2947 | declare namespace WebSocket_2 {
|
2948 | |
2949 |
|
2950 |
|
2951 | type RawData = Buffer | ArrayBuffer | Buffer[]
|
2952 |
|
2953 | |
2954 |
|
2955 |
|
2956 | type Data = string | Buffer | ArrayBuffer | Buffer[]
|
2957 |
|
2958 | |
2959 |
|
2960 |
|
2961 | type CertMeta = string | string[] | Buffer | Buffer[]
|
2962 |
|
2963 | |
2964 |
|
2965 |
|
2966 |
|
2967 |
|
2968 | type VerifyClientCallbackSync = (info: {
|
2969 | origin: string
|
2970 | secure: boolean
|
2971 | req: IncomingMessage
|
2972 | }) => boolean
|
2973 |
|
2974 | |
2975 |
|
2976 |
|
2977 |
|
2978 |
|
2979 | type VerifyClientCallbackAsync = (
|
2980 | info: { origin: string; secure: boolean; req: IncomingMessage },
|
2981 | callback: (
|
2982 | res: boolean,
|
2983 | code?: number,
|
2984 | message?: string,
|
2985 | headers?: OutgoingHttpHeaders
|
2986 | ) => void
|
2987 | ) => void
|
2988 |
|
2989 | interface ClientOptions extends SecureContextOptions {
|
2990 | protocol?: string | undefined
|
2991 | followRedirects?: boolean | undefined
|
2992 | generateMask?(mask: Buffer): void
|
2993 | handshakeTimeout?: number | undefined
|
2994 | maxRedirects?: number | undefined
|
2995 | perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined
|
2996 | localAddress?: string | undefined
|
2997 | protocolVersion?: number | undefined
|
2998 | headers?: { [key: string]: string } | undefined
|
2999 | origin?: string | undefined
|
3000 | agent?: Agent | undefined
|
3001 | host?: string | undefined
|
3002 | family?: number | undefined
|
3003 | checkServerIdentity?(servername: string, cert: CertMeta): boolean
|
3004 | rejectUnauthorized?: boolean | undefined
|
3005 | maxPayload?: number | undefined
|
3006 | skipUTF8Validation?: boolean | undefined
|
3007 | }
|
3008 |
|
3009 | interface PerMessageDeflateOptions {
|
3010 | serverNoContextTakeover?: boolean | undefined
|
3011 | clientNoContextTakeover?: boolean | undefined
|
3012 | serverMaxWindowBits?: number | undefined
|
3013 | clientMaxWindowBits?: number | undefined
|
3014 | zlibDeflateOptions?:
|
3015 | | {
|
3016 | flush?: number | undefined
|
3017 | finishFlush?: number | undefined
|
3018 | chunkSize?: number | undefined
|
3019 | windowBits?: number | undefined
|
3020 | level?: number | undefined
|
3021 | memLevel?: number | undefined
|
3022 | strategy?: number | undefined
|
3023 | dictionary?: Buffer | Buffer[] | DataView | undefined
|
3024 | info?: boolean | undefined
|
3025 | }
|
3026 | | undefined
|
3027 | zlibInflateOptions?: ZlibOptions | undefined
|
3028 | threshold?: number | undefined
|
3029 | concurrencyLimit?: number | undefined
|
3030 | }
|
3031 |
|
3032 | interface Event {
|
3033 | type: string
|
3034 | target: WebSocket
|
3035 | }
|
3036 |
|
3037 | interface ErrorEvent {
|
3038 | error: any
|
3039 | message: string
|
3040 | type: string
|
3041 | target: WebSocket
|
3042 | }
|
3043 |
|
3044 | interface CloseEvent {
|
3045 | wasClean: boolean
|
3046 | code: number
|
3047 | reason: string
|
3048 | type: string
|
3049 | target: WebSocket
|
3050 | }
|
3051 |
|
3052 | interface MessageEvent {
|
3053 | data: Data
|
3054 | type: string
|
3055 | target: WebSocket
|
3056 | }
|
3057 |
|
3058 | interface EventListenerOptions {
|
3059 | once?: boolean | undefined
|
3060 | }
|
3061 |
|
3062 | interface ServerOptions {
|
3063 | host?: string | undefined
|
3064 | port?: number | undefined
|
3065 | backlog?: number | undefined
|
3066 | server?: Server | Server_2 | undefined
|
3067 | verifyClient?:
|
3068 | | VerifyClientCallbackAsync
|
3069 | | VerifyClientCallbackSync
|
3070 | | undefined
|
3071 | handleProtocols?: (
|
3072 | protocols: Set<string>,
|
3073 | request: IncomingMessage
|
3074 | ) => string | false
|
3075 | path?: string | undefined
|
3076 | noServer?: boolean | undefined
|
3077 | clientTracking?: boolean | undefined
|
3078 | perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined
|
3079 | maxPayload?: number | undefined
|
3080 | skipUTF8Validation?: boolean | undefined
|
3081 | WebSocket?: typeof WebSocket.WebSocket | undefined
|
3082 | }
|
3083 |
|
3084 | interface AddressInfo {
|
3085 | address: string
|
3086 | family: string
|
3087 | port: number
|
3088 | }
|
3089 |
|
3090 |
|
3091 | class Server<T extends WebSocket = WebSocket> extends EventEmitter {
|
3092 | options: ServerOptions
|
3093 | path: string
|
3094 | clients: Set<T>
|
3095 |
|
3096 | constructor(options?: ServerOptions, callback?: () => void)
|
3097 |
|
3098 | address(): AddressInfo | string
|
3099 | close(cb?: (err?: Error) => void): void
|
3100 | handleUpgrade(
|
3101 | request: IncomingMessage,
|
3102 | socket: Duplex,
|
3103 | upgradeHead: Buffer,
|
3104 | callback: (client: T, request: IncomingMessage) => void
|
3105 | ): void
|
3106 | shouldHandle(request: IncomingMessage): boolean | Promise<boolean>
|
3107 |
|
3108 |
|
3109 | on(
|
3110 | event: 'connection',
|
3111 | cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
|
3112 | ): this
|
3113 | on(event: 'error', cb: (this: Server<T>, error: Error) => void): this
|
3114 | on(
|
3115 | event: 'headers',
|
3116 | cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
|
3117 | ): this
|
3118 | on(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
|
3119 | on(
|
3120 | event: string | symbol,
|
3121 | listener: (this: Server<T>, ...args: any[]) => void
|
3122 | ): this
|
3123 |
|
3124 | once(
|
3125 | event: 'connection',
|
3126 | cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
|
3127 | ): this
|
3128 | once(event: 'error', cb: (this: Server<T>, error: Error) => void): this
|
3129 | once(
|
3130 | event: 'headers',
|
3131 | cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
|
3132 | ): this
|
3133 | once(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
|
3134 | once(
|
3135 | event: string | symbol,
|
3136 | listener: (this: Server<T>, ...args: any[]) => void
|
3137 | ): this
|
3138 |
|
3139 | off(
|
3140 | event: 'connection',
|
3141 | cb: (this: Server<T>, socket: T, request: IncomingMessage) => void
|
3142 | ): this
|
3143 | off(event: 'error', cb: (this: Server<T>, error: Error) => void): this
|
3144 | off(
|
3145 | event: 'headers',
|
3146 | cb: (this: Server<T>, headers: string[], request: IncomingMessage) => void
|
3147 | ): this
|
3148 | off(event: 'close' | 'listening', cb: (this: Server<T>) => void): this
|
3149 | off(
|
3150 | event: string | symbol,
|
3151 | listener: (this: Server<T>, ...args: any[]) => void
|
3152 | ): this
|
3153 |
|
3154 | addListener(
|
3155 | event: 'connection',
|
3156 | cb: (client: T, request: IncomingMessage) => void
|
3157 | ): this
|
3158 | addListener(event: 'error', cb: (err: Error) => void): this
|
3159 | addListener(
|
3160 | event: 'headers',
|
3161 | cb: (headers: string[], request: IncomingMessage) => void
|
3162 | ): this
|
3163 | addListener(event: 'close' | 'listening', cb: () => void): this
|
3164 | addListener(
|
3165 | event: string | symbol,
|
3166 | listener: (...args: any[]) => void
|
3167 | ): this
|
3168 |
|
3169 | removeListener(event: 'connection', cb: (client: T) => void): this
|
3170 | removeListener(event: 'error', cb: (err: Error) => void): this
|
3171 | removeListener(
|
3172 | event: 'headers',
|
3173 | cb: (headers: string[], request: IncomingMessage) => void
|
3174 | ): this
|
3175 | removeListener(event: 'close' | 'listening', cb: () => void): this
|
3176 | removeListener(
|
3177 | event: string | symbol,
|
3178 | listener: (...args: any[]) => void
|
3179 | ): this
|
3180 | }
|
3181 |
|
3182 | const WebSocketServer: typeof Server
|
3183 | interface WebSocketServer extends Server {}
|
3184 | const WebSocket: typeof WebSocketAlias
|
3185 | interface WebSocket extends WebSocketAlias {}
|
3186 |
|
3187 |
|
3188 | function createWebSocketStream(
|
3189 | websocket: WebSocket,
|
3190 | options?: DuplexOptions
|
3191 | ): Duplex
|
3192 | }
|
3193 | export { WebSocket_2 as WebSocket }
|
3194 |
|
3195 | export declare const WebSocketAlias: typeof WebSocket_2;
|
3196 |
|
3197 | export declare interface WebSocketAlias extends WebSocket_2 {}
|
3198 |
|
3199 | export declare interface WebSocketClient {
|
3200 | |
3201 |
|
3202 |
|
3203 | send(payload: HMRPayload): void;
|
3204 | |
3205 |
|
3206 |
|
3207 | send(event: string, payload?: CustomPayload['data']): void;
|
3208 | |
3209 |
|
3210 |
|
3211 |
|
3212 | socket: WebSocket_2;
|
3213 | }
|
3214 |
|
3215 | export declare type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
|
3216 |
|
3217 | export declare interface WebSocketServer {
|
3218 | |
3219 |
|
3220 |
|
3221 | clients: Set<WebSocketClient>;
|
3222 | |
3223 |
|
3224 |
|
3225 | send(payload: HMRPayload): void;
|
3226 | |
3227 |
|
3228 |
|
3229 | send<T extends string>(event: T, payload?: InferCustomEventPayload<T>): void;
|
3230 | |
3231 |
|
3232 |
|
3233 | close(): Promise<void>;
|
3234 | |
3235 |
|
3236 |
|
3237 | on: WebSocket_2.Server['on'] & {
|
3238 | <T extends string>(event: T, listener: WebSocketCustomListener<InferCustomEventPayload<T>>): void;
|
3239 | };
|
3240 | |
3241 |
|
3242 |
|
3243 | off: WebSocket_2.Server['off'] & {
|
3244 | (event: string, listener: Function): void;
|
3245 | };
|
3246 | }
|
3247 |
|
3248 | export { }
|
3249 |
|
\ | No newline at end of file |