vite 2.9.9 → 3.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +29 -1
- package/bin/vite.js +5 -5
- package/client.d.ts +4 -3
- package/dist/client/client.mjs +28 -30
- package/dist/client/client.mjs.map +1 -1
- package/dist/client/env.mjs.map +1 -1
- package/dist/node/build.d.ts +178 -0
- package/dist/node/certificate.d.ts +2 -0
- package/dist/node/chunks/{dep-ac1ae66b.js → dep-205b15fe.js} +40 -37
- package/dist/node/chunks/{dep-a9015192.js → dep-24157481.js} +20 -20
- package/dist/node/chunks/{dep-59dc6e00.js → dep-c15b7842.js} +42425 -44710
- package/dist/node/chunks/{dep-d2c728c0.js → dep-c6d28e94.js} +28 -30
- package/dist/node/chunks/{dep-739cc694.js → dep-df464a73.js} +12 -6
- package/dist/node/chunks/{dep-2056ae8a.js → dep-e8ca8d40.js} +9 -3
- package/dist/node/cli.d.ts +1 -0
- package/dist/node/cli.js +41 -42
- package/dist/node/config.d.ts +243 -0
- package/dist/node/constants.d.ts +35 -0
- package/dist/node/constants.js +82 -0
- package/dist/node/http.d.ts +88 -0
- package/dist/node/index.d.ts +234 -160
- package/dist/node/index.js +37 -61
- package/dist/node/logger.d.ts +31 -0
- package/dist/node/optimizer/esbuildDepPlugin.d.ts +4 -0
- package/dist/node/optimizer/index.d.ts +154 -0
- package/dist/node/optimizer/registerMissing.d.ts +3 -0
- package/dist/node/optimizer/scan.d.ts +8 -0
- package/dist/node/packages.d.ts +27 -0
- package/dist/node/plugin.d.ts +129 -0
- package/dist/node/plugins/asset.d.ts +68 -0
- package/dist/node/plugins/assetImportMetaUrl.d.ts +13 -0
- package/dist/node/plugins/clientInjections.d.ts +7 -0
- package/dist/node/plugins/css.d.ts +86 -0
- package/dist/node/plugins/dataUri.d.ts +5 -0
- package/dist/node/plugins/define.d.ts +3 -0
- package/dist/node/plugins/dynamicImportVars.d.ts +9 -0
- package/dist/node/plugins/ensureWatch.d.ts +5 -0
- package/dist/node/plugins/esbuild.d.ts +15 -0
- package/dist/node/plugins/html.d.ts +120 -0
- package/dist/node/plugins/importAnalysis.d.ts +47 -0
- package/dist/node/plugins/importAnalysisBuild.d.ts +16 -0
- package/dist/node/plugins/importMetaGlob.d.ts +34 -0
- package/dist/node/plugins/index.d.ts +3 -0
- package/dist/node/plugins/json.d.ts +23 -0
- package/dist/node/plugins/loadFallback.d.ts +5 -0
- package/dist/node/plugins/manifest.d.ts +14 -0
- package/dist/node/plugins/metadata.d.ts +9 -0
- package/dist/node/plugins/modulePreloadPolyfill.d.ts +4 -0
- package/dist/node/plugins/optimizedDeps.d.ts +4 -0
- package/dist/node/plugins/preAlias.d.ts +5 -0
- package/dist/node/plugins/reporter.d.ts +3 -0
- package/dist/node/plugins/resolve.d.ts +39 -0
- package/dist/node/plugins/splitVendorChunk.d.ts +12 -0
- package/dist/node/plugins/ssrRequireHook.d.ts +12 -0
- package/dist/node/plugins/terser.d.ts +3 -0
- package/dist/node/plugins/wasm.d.ts +4 -0
- package/dist/node/plugins/worker.d.ts +9 -0
- package/dist/node/plugins/workerImportMetaUrl.d.ts +3 -0
- package/dist/node/preview.d.ts +33 -0
- package/dist/node/publicUtils.d.ts +10 -0
- package/dist/node/server/hmr.d.ts +39 -0
- package/dist/node/server/index.d.ts +198 -0
- package/dist/node/server/middlewares/base.d.ts +3 -0
- package/dist/node/server/middlewares/compression.d.ts +1 -0
- package/dist/node/server/middlewares/error.d.ts +8 -0
- package/dist/node/server/middlewares/indexHtml.d.ts +4 -0
- package/dist/node/server/middlewares/proxy.d.ts +20 -0
- package/dist/node/server/middlewares/spaFallback.d.ts +2 -0
- package/dist/node/server/middlewares/static.d.ts +6 -0
- package/dist/node/server/middlewares/time.d.ts +2 -0
- package/dist/node/server/middlewares/transform.d.ts +3 -0
- package/dist/node/server/moduleGraph.d.ts +55 -0
- package/dist/node/server/openBrowser.d.ts +15 -0
- package/dist/node/server/pluginContainer.d.ts +41 -0
- package/dist/node/server/searchRoot.d.ts +8 -0
- package/dist/node/server/send.d.ts +10 -0
- package/dist/node/server/sourcemap.d.ts +11 -0
- package/dist/node/server/transformRequest.d.ts +14 -0
- package/dist/node/server/ws.d.ts +55 -0
- package/dist/node/ssr/ssrExternal.d.ts +11 -0
- package/dist/node/ssr/ssrManifestPlugin.d.ts +3 -0
- package/dist/node/ssr/ssrModuleLoader.d.ts +7 -0
- package/dist/node/ssr/ssrStacktrace.d.ts +3 -0
- package/dist/node/ssr/ssrTransform.d.ts +14 -0
- package/dist/node/utils.d.ts +145 -0
- package/dist/node-cjs/publicUtils.cjs +1788 -0
- package/dist/{node/terser.js → node-cjs/terser.cjs} +0 -0
- package/index.cjs +33 -0
- package/package.json +31 -27
- package/src/client/client.ts +27 -29
- package/src/client/tsconfig.json +1 -1
- package/types/chokidar.d.ts +4 -2
- package/types/hot.d.ts +0 -6
- package/types/importGlob.d.ts +87 -0
- package/types/importMeta.d.ts +5 -15
- package/types/shims.d.ts +6 -9
- package/types/terser.d.ts +0 -2
- package/types/ws.d.ts +2 -2
package/dist/node/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ import type { OutgoingHttpHeaders } from 'http';
|
|
|
24
24
|
import type { OutputBundle } from 'rollup';
|
|
25
25
|
import type { OutputChunk } from 'rollup';
|
|
26
26
|
import type { PartialResolvedId } from 'rollup';
|
|
27
|
-
import type { Plugin as
|
|
27
|
+
import type { Plugin as Plugin_3 } from 'rollup';
|
|
28
28
|
import type { PluginContext } from 'rollup';
|
|
29
29
|
import type { PluginHooks } from 'rollup';
|
|
30
30
|
import type * as PostCSS from 'postcss';
|
|
@@ -36,15 +36,14 @@ import type { RollupWatcher } from 'rollup';
|
|
|
36
36
|
import type { SecureContextOptions } from 'tls';
|
|
37
37
|
import type { Server } from 'http';
|
|
38
38
|
import type { Server as Server_2 } from 'https';
|
|
39
|
-
import type { Server as Server_3 } from 'net';
|
|
40
39
|
import type { ServerOptions as ServerOptions_2 } from 'https';
|
|
41
40
|
import type { ServerResponse } from 'http';
|
|
42
41
|
import type { SourceDescription } from 'rollup';
|
|
43
42
|
import type { SourceMap } from 'rollup';
|
|
44
43
|
import type * as stream from 'stream';
|
|
45
44
|
import type { TransformPluginContext } from 'rollup';
|
|
46
|
-
import type { TransformResult as TransformResult_2 } from '
|
|
47
|
-
import type { TransformResult as TransformResult_3 } from '
|
|
45
|
+
import type { TransformResult as TransformResult_2 } from 'rollup';
|
|
46
|
+
import type { TransformResult as TransformResult_3 } from 'esbuild';
|
|
48
47
|
import type * as url from 'url';
|
|
49
48
|
import type { URL as URL_2 } from 'url';
|
|
50
49
|
import type { WatcherOptions } from 'rollup';
|
|
@@ -95,11 +94,6 @@ export declare interface AwaitWriteFinishOptions {
|
|
|
95
94
|
export declare function build(inlineConfig?: InlineConfig): Promise<RollupOutput | RollupOutput[] | RollupWatcher>;
|
|
96
95
|
|
|
97
96
|
export declare interface BuildOptions {
|
|
98
|
-
/**
|
|
99
|
-
* Base public path when served in production.
|
|
100
|
-
* @deprecated `base` is now a root-level config option.
|
|
101
|
-
*/
|
|
102
|
-
base?: string;
|
|
103
97
|
/**
|
|
104
98
|
* Compatibility transform target. The transform is performed with esbuild
|
|
105
99
|
* and the lowest supported target is es2015/es6. Note this only handles
|
|
@@ -123,13 +117,6 @@ export declare interface BuildOptions {
|
|
|
123
117
|
* @default true
|
|
124
118
|
*/
|
|
125
119
|
polyfillModulePreload?: boolean;
|
|
126
|
-
/**
|
|
127
|
-
* whether to inject dynamic import polyfill.
|
|
128
|
-
* Note: does not apply to library mode.
|
|
129
|
-
* @default false
|
|
130
|
-
* @deprecated use plugin-legacy for browsers that don't support dynamic import
|
|
131
|
-
*/
|
|
132
|
-
polyfillDynamicImport?: boolean;
|
|
133
120
|
/**
|
|
134
121
|
* Directory relative from `root` where build output will be placed. If the
|
|
135
122
|
* directory exists, it will be removed before the build.
|
|
@@ -183,10 +170,6 @@ export declare interface BuildOptions {
|
|
|
183
170
|
* https://terser.org/docs/api-reference#minify-options
|
|
184
171
|
*/
|
|
185
172
|
terserOptions?: Terser.MinifyOptions;
|
|
186
|
-
/**
|
|
187
|
-
* @deprecated Vite now uses esbuild for CSS minification.
|
|
188
|
-
*/
|
|
189
|
-
cleanCssOptions?: any;
|
|
190
173
|
/**
|
|
191
174
|
* Will be merged with internal rollup options.
|
|
192
175
|
* https://rollupjs.org/guide/en/#big-list-of-options
|
|
@@ -251,12 +234,6 @@ export declare interface BuildOptions {
|
|
|
251
234
|
* Can slightly improve build speed.
|
|
252
235
|
*/
|
|
253
236
|
reportCompressedSize?: boolean;
|
|
254
|
-
/**
|
|
255
|
-
* Set to false to disable brotli compressed size reporting for build.
|
|
256
|
-
* Can slightly improve build speed.
|
|
257
|
-
* @deprecated use `build.reportCompressedSize` instead.
|
|
258
|
-
*/
|
|
259
|
-
brotliSize?: boolean;
|
|
260
237
|
/**
|
|
261
238
|
* Adjust chunk size warning limit (in kbs).
|
|
262
239
|
* @default 500
|
|
@@ -574,15 +551,10 @@ export declare interface DepOptimizationOptions {
|
|
|
574
551
|
*
|
|
575
552
|
* - `external` is also omitted, use Vite's `optimizeDeps.exclude` option
|
|
576
553
|
* - `plugins` are merged with Vite's dep plugin
|
|
577
|
-
* - `keepNames` takes precedence over the deprecated `optimizeDeps.keepNames`
|
|
578
554
|
*
|
|
579
555
|
* https://esbuild.github.io/api
|
|
580
556
|
*/
|
|
581
557
|
esbuildOptions?: Omit<BuildOptions_2, 'bundle' | 'entryPoints' | 'external' | 'write' | 'watch' | 'outdir' | 'outfile' | 'outbase' | 'outExtension' | 'metafile'>;
|
|
582
|
-
/**
|
|
583
|
-
* @deprecated use `esbuildOptions.keepNames`
|
|
584
|
-
*/
|
|
585
|
-
keepNames?: boolean;
|
|
586
558
|
/**
|
|
587
559
|
* List of file extensions that can be optimized. A corresponding esbuild
|
|
588
560
|
* plugin must exist to handle the specific extension.
|
|
@@ -643,10 +615,20 @@ export declare interface ESBuildOptions extends EsbuildTransformOptions {
|
|
|
643
615
|
|
|
644
616
|
export { EsbuildTransformOptions }
|
|
645
617
|
|
|
646
|
-
export declare type ESBuildTransformResult = Omit<
|
|
618
|
+
export declare type ESBuildTransformResult = Omit<TransformResult_3, 'map'> & {
|
|
647
619
|
map: SourceMap;
|
|
648
620
|
};
|
|
649
621
|
|
|
622
|
+
export declare interface ExperimentalOptions {
|
|
623
|
+
/**
|
|
624
|
+
* Append fake `&lang.(ext)` when queries are specified, to preseve the file extension for following plugins to process.
|
|
625
|
+
*
|
|
626
|
+
* @experimental
|
|
627
|
+
* @default false
|
|
628
|
+
*/
|
|
629
|
+
importGlobRestoreExtension?: boolean;
|
|
630
|
+
}
|
|
631
|
+
|
|
650
632
|
export declare interface FileSystemServeOptions {
|
|
651
633
|
/**
|
|
652
634
|
* Strictly restrict file accessing outside of allowing paths.
|
|
@@ -670,13 +652,11 @@ export declare interface FileSystemServeOptions {
|
|
|
670
652
|
* Glob patterns are supported.
|
|
671
653
|
*
|
|
672
654
|
* @default ['.env', '.env.*', '*.crt', '*.pem']
|
|
673
|
-
*
|
|
674
|
-
* @experimental
|
|
675
655
|
*/
|
|
676
656
|
deny?: string[];
|
|
677
657
|
}
|
|
678
658
|
|
|
679
|
-
export declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): ExistingRawSourceMap
|
|
659
|
+
export declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise<ExistingRawSourceMap>;
|
|
680
660
|
|
|
681
661
|
export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
|
|
682
662
|
options: WatchOptions
|
|
@@ -1014,6 +994,86 @@ export declare namespace HttpProxy {
|
|
|
1014
994
|
}
|
|
1015
995
|
}
|
|
1016
996
|
|
|
997
|
+
export declare interface ImportGlobEagerFunction {
|
|
998
|
+
/**
|
|
999
|
+
* 1. No generic provided, infer the type from `as`
|
|
1000
|
+
*/
|
|
1001
|
+
<
|
|
1002
|
+
As extends string,
|
|
1003
|
+
T = As extends keyof KnownAsTypeMap ? KnownAsTypeMap[As] : unknown
|
|
1004
|
+
>(
|
|
1005
|
+
glob: string | string[],
|
|
1006
|
+
options?: Omit<ImportGlobOptions<boolean, As>, 'eager'>
|
|
1007
|
+
): Record<string, T>
|
|
1008
|
+
/**
|
|
1009
|
+
* 2. Module generic provided
|
|
1010
|
+
*/
|
|
1011
|
+
<M>(
|
|
1012
|
+
glob: string | string[],
|
|
1013
|
+
options?: Omit<ImportGlobOptions<boolean, string>, 'eager'>
|
|
1014
|
+
): Record<string, M>
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
export declare interface ImportGlobFunction {
|
|
1018
|
+
/**
|
|
1019
|
+
* 1. No generic provided, infer the type from `eager` and `as`
|
|
1020
|
+
*/
|
|
1021
|
+
<
|
|
1022
|
+
Eager extends boolean,
|
|
1023
|
+
As extends string,
|
|
1024
|
+
T = As extends keyof KnownAsTypeMap ? KnownAsTypeMap[As] : unknown
|
|
1025
|
+
>(
|
|
1026
|
+
glob: string | string[],
|
|
1027
|
+
options?: ImportGlobOptions<Eager, As>
|
|
1028
|
+
): (Eager extends true ? true : false) extends true
|
|
1029
|
+
? Record<string, T>
|
|
1030
|
+
: Record<string, () => Promise<T>>
|
|
1031
|
+
/**
|
|
1032
|
+
* 2. Module generic provided, infer the type from `eager: false`
|
|
1033
|
+
*/
|
|
1034
|
+
<M>(
|
|
1035
|
+
glob: string | string[],
|
|
1036
|
+
options?: ImportGlobOptions<false, string>
|
|
1037
|
+
): Record<string, () => Promise<M>>
|
|
1038
|
+
/**
|
|
1039
|
+
* 3. Module generic provided, infer the type from `eager: true`
|
|
1040
|
+
*/
|
|
1041
|
+
<M>(
|
|
1042
|
+
glob: string | string[],
|
|
1043
|
+
options: ImportGlobOptions<true, string>
|
|
1044
|
+
): Record<string, M>
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
export declare interface ImportGlobOptions<
|
|
1048
|
+
Eager extends boolean,
|
|
1049
|
+
AsType extends string
|
|
1050
|
+
> {
|
|
1051
|
+
/**
|
|
1052
|
+
* Import type for the import url.
|
|
1053
|
+
*/
|
|
1054
|
+
as?: AsType
|
|
1055
|
+
/**
|
|
1056
|
+
* Import as static or dynamic
|
|
1057
|
+
*
|
|
1058
|
+
* @default false
|
|
1059
|
+
*/
|
|
1060
|
+
eager?: Eager
|
|
1061
|
+
/**
|
|
1062
|
+
* Import only the specific named export. Set to `default` to import the default export.
|
|
1063
|
+
*/
|
|
1064
|
+
import?: string
|
|
1065
|
+
/**
|
|
1066
|
+
* Custom queries
|
|
1067
|
+
*/
|
|
1068
|
+
query?: string | Record<string, string | number | boolean>
|
|
1069
|
+
/**
|
|
1070
|
+
* Search files also inside `node_modules/` and hidden directories (e.g. `.git/`). This might have impact on performance.
|
|
1071
|
+
*
|
|
1072
|
+
* @default false
|
|
1073
|
+
*/
|
|
1074
|
+
exhaustive?: boolean
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1017
1077
|
export declare type IndexHtmlTransform = IndexHtmlTransformHook | {
|
|
1018
1078
|
enforce?: 'pre' | 'post';
|
|
1019
1079
|
transform: IndexHtmlTransformHook;
|
|
@@ -1086,6 +1146,12 @@ export declare interface JsonOptions {
|
|
|
1086
1146
|
stringify?: boolean;
|
|
1087
1147
|
}
|
|
1088
1148
|
|
|
1149
|
+
export declare interface KnownAsTypeMap {
|
|
1150
|
+
raw: string
|
|
1151
|
+
url: string
|
|
1152
|
+
worker: Worker
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1089
1155
|
export declare type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife';
|
|
1090
1156
|
|
|
1091
1157
|
export declare interface LibraryOptions {
|
|
@@ -1147,6 +1213,8 @@ export declare interface ManifestChunk {
|
|
|
1147
1213
|
|
|
1148
1214
|
export declare type Matcher = AnymatchPattern | AnymatchPattern[]
|
|
1149
1215
|
|
|
1216
|
+
export declare function mergeAlias(a?: AliasOptions, b?: AliasOptions): AliasOptions | undefined;
|
|
1217
|
+
|
|
1150
1218
|
export declare function mergeConfig(defaults: Record<string, any>, overrides: Record<string, any>, isRoot?: boolean): Record<string, any>;
|
|
1151
1219
|
|
|
1152
1220
|
export declare class ModuleGraph {
|
|
@@ -1238,6 +1306,8 @@ export declare interface PackageData {
|
|
|
1238
1306
|
getResolvedCache: (key: string, targetWeb: boolean) => string | undefined;
|
|
1239
1307
|
data: {
|
|
1240
1308
|
[field: string]: any;
|
|
1309
|
+
name: string;
|
|
1310
|
+
type: string;
|
|
1241
1311
|
version: string;
|
|
1242
1312
|
main: string;
|
|
1243
1313
|
module: string;
|
|
@@ -1268,7 +1338,7 @@ export declare interface PackageData {
|
|
|
1268
1338
|
* If a plugin should be applied only for server or build, a function format
|
|
1269
1339
|
* config file can be used to conditional determine the plugins to use.
|
|
1270
1340
|
*/
|
|
1271
|
-
|
|
1341
|
+
declare interface Plugin_2 extends Plugin_3 {
|
|
1272
1342
|
/**
|
|
1273
1343
|
* Enforce plugin invocation tier similar to webpack loaders.
|
|
1274
1344
|
*
|
|
@@ -1309,6 +1379,15 @@ export declare interface Plugin extends Plugin_2 {
|
|
|
1309
1379
|
* are applied. Hook can be async functions and will be called in series.
|
|
1310
1380
|
*/
|
|
1311
1381
|
configureServer?: ServerHook;
|
|
1382
|
+
/**
|
|
1383
|
+
* Configure the preview server. The hook receives the connect server and
|
|
1384
|
+
* its underlying http server.
|
|
1385
|
+
*
|
|
1386
|
+
* The hooks are called before other middlewares are applied. A hook can
|
|
1387
|
+
* return a post hook that will be called after other middlewares are
|
|
1388
|
+
* applied. Hooks can be async functions and will be called in series.
|
|
1389
|
+
*/
|
|
1390
|
+
configurePreviewServer?: PreviewServerHook;
|
|
1312
1391
|
/**
|
|
1313
1392
|
* Transform index.html.
|
|
1314
1393
|
* The hook receives the following arguments:
|
|
@@ -1354,15 +1433,16 @@ export declare interface Plugin extends Plugin_2 {
|
|
|
1354
1433
|
}): Promise<LoadResult> | LoadResult;
|
|
1355
1434
|
transform?(this: TransformPluginContext, code: string, id: string, options?: {
|
|
1356
1435
|
ssr?: boolean;
|
|
1357
|
-
}): Promise<
|
|
1436
|
+
}): Promise<TransformResult_2> | TransformResult_2;
|
|
1358
1437
|
}
|
|
1438
|
+
export { Plugin_2 as Plugin }
|
|
1359
1439
|
|
|
1360
1440
|
export declare interface PluginContainer {
|
|
1361
1441
|
options: InputOptions;
|
|
1362
1442
|
getModuleInfo(id: string): ModuleInfo | null;
|
|
1363
1443
|
buildStart(options: InputOptions): Promise<void>;
|
|
1364
1444
|
resolveId(id: string, importer?: string, options?: {
|
|
1365
|
-
skip?: Set<
|
|
1445
|
+
skip?: Set<Plugin_2>;
|
|
1366
1446
|
ssr?: boolean;
|
|
1367
1447
|
/* Excluded from this release type: scan */
|
|
1368
1448
|
}): Promise<PartialResolvedId | null>;
|
|
@@ -1376,13 +1456,12 @@ export declare interface PluginContainer {
|
|
|
1376
1456
|
close(): Promise<void>;
|
|
1377
1457
|
}
|
|
1378
1458
|
|
|
1379
|
-
export declare type PluginOption =
|
|
1459
|
+
export declare type PluginOption = Plugin_2 | false | null | undefined | PluginOption[];
|
|
1380
1460
|
|
|
1381
1461
|
/**
|
|
1382
1462
|
* Starts the Vite server in preview mode, to simulate a production deployment
|
|
1383
|
-
* @experimental
|
|
1384
1463
|
*/
|
|
1385
|
-
export declare function preview(inlineConfig
|
|
1464
|
+
export declare function preview(inlineConfig?: InlineConfig): Promise<PreviewServer>;
|
|
1386
1465
|
|
|
1387
1466
|
export declare interface PreviewOptions extends CommonServerOptions {
|
|
1388
1467
|
}
|
|
@@ -1395,17 +1474,17 @@ export declare interface PreviewServer {
|
|
|
1395
1474
|
/**
|
|
1396
1475
|
* native Node http server instance
|
|
1397
1476
|
*/
|
|
1398
|
-
httpServer: Server;
|
|
1477
|
+
httpServer: http.Server;
|
|
1399
1478
|
/**
|
|
1400
1479
|
* Print server urls
|
|
1401
1480
|
*/
|
|
1402
1481
|
printUrls: () => void;
|
|
1403
1482
|
}
|
|
1404
1483
|
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1484
|
+
export declare type PreviewServerHook = (server: {
|
|
1485
|
+
middlewares: Connect.Server;
|
|
1486
|
+
httpServer: http.Server;
|
|
1487
|
+
}) => (() => void) | void | Promise<(() => void) | void>;
|
|
1409
1488
|
|
|
1410
1489
|
export declare interface ProxyOptions extends HttpProxy.ServerOptions {
|
|
1411
1490
|
/**
|
|
@@ -1429,9 +1508,9 @@ export declare interface PrunePayload {
|
|
|
1429
1508
|
|
|
1430
1509
|
export declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string): Promise<ResolvedConfig>;
|
|
1431
1510
|
|
|
1432
|
-
export declare type ResolvedBuildOptions = Required<
|
|
1511
|
+
export declare type ResolvedBuildOptions = Required<BuildOptions>;
|
|
1433
1512
|
|
|
1434
|
-
export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | '
|
|
1513
|
+
export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'assetsInclude' | 'optimizeDeps' | 'worker'> & {
|
|
1435
1514
|
configFile: string | undefined;
|
|
1436
1515
|
configFileDependencies: string[];
|
|
1437
1516
|
inlineConfig: InlineConfig;
|
|
@@ -1442,21 +1521,23 @@ export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'alia
|
|
|
1442
1521
|
command: 'build' | 'serve';
|
|
1443
1522
|
mode: string;
|
|
1444
1523
|
isWorker: boolean;
|
|
1524
|
+
/* Excluded from this release type: mainConfig */
|
|
1445
1525
|
isProduction: boolean;
|
|
1446
1526
|
env: Record<string, any>;
|
|
1447
1527
|
resolve: ResolveOptions & {
|
|
1448
1528
|
alias: Alias[];
|
|
1449
1529
|
};
|
|
1450
|
-
plugins: readonly
|
|
1530
|
+
plugins: readonly Plugin_2[];
|
|
1451
1531
|
server: ResolvedServerOptions;
|
|
1452
1532
|
build: ResolvedBuildOptions;
|
|
1453
1533
|
preview: ResolvedPreviewOptions;
|
|
1454
1534
|
assetsInclude: (file: string) => boolean;
|
|
1455
1535
|
logger: Logger;
|
|
1456
1536
|
createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
|
|
1457
|
-
optimizeDeps:
|
|
1537
|
+
optimizeDeps: DepOptimizationOptions;
|
|
1458
1538
|
/* Excluded from this release type: packageCache */
|
|
1459
1539
|
worker: ResolveWorkerOptions;
|
|
1540
|
+
spa: boolean;
|
|
1460
1541
|
}>;
|
|
1461
1542
|
|
|
1462
1543
|
export declare interface ResolvedPreviewOptions extends PreviewOptions {
|
|
@@ -1497,7 +1578,7 @@ export declare interface ResolverObject {
|
|
|
1497
1578
|
|
|
1498
1579
|
export declare interface ResolveWorkerOptions {
|
|
1499
1580
|
format: 'es' | 'iife';
|
|
1500
|
-
plugins:
|
|
1581
|
+
plugins: Plugin_2[];
|
|
1501
1582
|
rollupOptions: RollupOptions;
|
|
1502
1583
|
}
|
|
1503
1584
|
|
|
@@ -1753,14 +1834,12 @@ export declare interface ServerOptions extends CommonServerOptions {
|
|
|
1753
1834
|
origin?: string;
|
|
1754
1835
|
/**
|
|
1755
1836
|
* Pre-transform known direct imports
|
|
1756
|
-
*
|
|
1757
|
-
* @experimental this option is experimental and might be changed in the future
|
|
1758
1837
|
* @default true
|
|
1759
1838
|
*/
|
|
1760
1839
|
preTransformRequests?: boolean;
|
|
1761
1840
|
}
|
|
1762
1841
|
|
|
1763
|
-
export declare function sortUserPlugins(plugins: (
|
|
1842
|
+
export declare function sortUserPlugins(plugins: (Plugin_2 | Plugin_2[])[] | undefined): [Plugin_2[], Plugin_2[], Plugin_2[]];
|
|
1764
1843
|
|
|
1765
1844
|
export declare function splitVendorChunk(options?: {
|
|
1766
1845
|
cache?: SplitVendorChunkCache;
|
|
@@ -1772,7 +1851,7 @@ export declare class SplitVendorChunkCache {
|
|
|
1772
1851
|
reset(): void;
|
|
1773
1852
|
}
|
|
1774
1853
|
|
|
1775
|
-
export declare function splitVendorChunkPlugin():
|
|
1854
|
+
export declare function splitVendorChunkPlugin(): Plugin_2;
|
|
1776
1855
|
|
|
1777
1856
|
export declare interface SSROptions {
|
|
1778
1857
|
external?: string[];
|
|
@@ -1938,8 +2017,6 @@ export declare namespace Terser {
|
|
|
1938
2017
|
module?: boolean
|
|
1939
2018
|
nameCache?: object
|
|
1940
2019
|
format?: FormatOptions
|
|
1941
|
-
/** @deprecated use format instead */
|
|
1942
|
-
output?: FormatOptions
|
|
1943
2020
|
parse?: ParseOptions
|
|
1944
2021
|
safari10?: boolean
|
|
1945
2022
|
sourceMap?: boolean | SourceMapOptions
|
|
@@ -2072,7 +2149,18 @@ export declare interface UserConfig {
|
|
|
2072
2149
|
* Dep optimization options
|
|
2073
2150
|
*/
|
|
2074
2151
|
optimizeDeps?: DepOptimizationOptions;
|
|
2075
|
-
|
|
2152
|
+
/**
|
|
2153
|
+
* SSR specific options
|
|
2154
|
+
*/
|
|
2155
|
+
ssr?: SSROptions;
|
|
2156
|
+
/**
|
|
2157
|
+
* Experimental features
|
|
2158
|
+
*
|
|
2159
|
+
* Features under this field are addressed to be changed that might NOT follow semver.
|
|
2160
|
+
* Please be careful and always pin Vite's version when using them.
|
|
2161
|
+
* @experimental
|
|
2162
|
+
*/
|
|
2163
|
+
experimental?: ExperimentalOptions;
|
|
2076
2164
|
/**
|
|
2077
2165
|
* Log level.
|
|
2078
2166
|
* Default: 'info'
|
|
@@ -2097,17 +2185,6 @@ export declare interface UserConfig {
|
|
|
2097
2185
|
* @default 'VITE_'
|
|
2098
2186
|
*/
|
|
2099
2187
|
envPrefix?: string | string[];
|
|
2100
|
-
/**
|
|
2101
|
-
* Import aliases
|
|
2102
|
-
* @deprecated use `resolve.alias` instead
|
|
2103
|
-
*/
|
|
2104
|
-
alias?: AliasOptions;
|
|
2105
|
-
/**
|
|
2106
|
-
* Force Vite to always resolve listed dependencies to the same copy (from
|
|
2107
|
-
* project root).
|
|
2108
|
-
* @deprecated use `resolve.dedupe` instead
|
|
2109
|
-
*/
|
|
2110
|
-
dedupe?: string[];
|
|
2111
2188
|
/**
|
|
2112
2189
|
* Worker bundle options
|
|
2113
2190
|
*/
|
|
@@ -2126,6 +2203,12 @@ export declare interface UserConfig {
|
|
|
2126
2203
|
*/
|
|
2127
2204
|
rollupOptions?: Omit<RollupOptions, 'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures'>;
|
|
2128
2205
|
};
|
|
2206
|
+
/**
|
|
2207
|
+
* Whether your application is a Single Page Application (SPA). Set to `false`
|
|
2208
|
+
* for other kinds of apps like MPAs.
|
|
2209
|
+
* @default true
|
|
2210
|
+
*/
|
|
2211
|
+
spa?: boolean;
|
|
2129
2212
|
}
|
|
2130
2213
|
|
|
2131
2214
|
export declare type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFn;
|
|
@@ -2146,10 +2229,6 @@ export declare interface ViteDevServer {
|
|
|
2146
2229
|
* https://github.com/senchalabs/connect#use-middleware
|
|
2147
2230
|
*/
|
|
2148
2231
|
middlewares: Connect.Server;
|
|
2149
|
-
/**
|
|
2150
|
-
* @deprecated use `server.middlewares` instead
|
|
2151
|
-
*/
|
|
2152
|
-
app: Connect.Server;
|
|
2153
2232
|
/**
|
|
2154
2233
|
* native Node http server instance
|
|
2155
2234
|
* will be null in middleware mode
|
|
@@ -2182,16 +2261,8 @@ export declare interface ViteDevServer {
|
|
|
2182
2261
|
* Apply vite built-in HTML transforms and any plugin HTML transforms.
|
|
2183
2262
|
*/
|
|
2184
2263
|
transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>;
|
|
2185
|
-
/**
|
|
2186
|
-
* Util for transforming a file with esbuild.
|
|
2187
|
-
* Can be useful for certain plugins.
|
|
2188
|
-
*
|
|
2189
|
-
* @deprecated import `transformWithEsbuild` from `vite` instead
|
|
2190
|
-
*/
|
|
2191
|
-
transformWithEsbuild(code: string, filename: string, options?: EsbuildTransformOptions, inMap?: object): Promise<ESBuildTransformResult>;
|
|
2192
2264
|
/**
|
|
2193
2265
|
* Transform module code into SSR format.
|
|
2194
|
-
* @experimental
|
|
2195
2266
|
*/
|
|
2196
2267
|
ssrTransform(code: string, inMap: SourceMap | null, url: string): Promise<TransformResult | null>;
|
|
2197
2268
|
/**
|
|
@@ -2227,8 +2298,8 @@ export declare interface ViteDevServer {
|
|
|
2227
2298
|
*/
|
|
2228
2299
|
restart(forceOptimize?: boolean): Promise<void>;
|
|
2229
2300
|
/* Excluded from this release type: _optimizedDeps */
|
|
2301
|
+
/* Excluded from this release type: _importGlobMap */
|
|
2230
2302
|
/* Excluded from this release type: _ssrExternals */
|
|
2231
|
-
/* Excluded from this release type: _globImporters */
|
|
2232
2303
|
/* Excluded from this release type: _restartPromise */
|
|
2233
2304
|
/* Excluded from this release type: _forceOptimizeOnRestart */
|
|
2234
2305
|
/* Excluded from this release type: _pendingRequests */
|
|
@@ -2270,8 +2341,10 @@ export declare interface WatchOptions {
|
|
|
2270
2341
|
cwd?: string
|
|
2271
2342
|
|
|
2272
2343
|
/**
|
|
2273
|
-
*
|
|
2274
|
-
*
|
|
2344
|
+
* If set to true then the strings passed to .watch() and .add() are treated as literal path
|
|
2345
|
+
* names, even if they look like globs.
|
|
2346
|
+
*
|
|
2347
|
+
* @default false
|
|
2275
2348
|
*/
|
|
2276
2349
|
disableGlobbing?: boolean
|
|
2277
2350
|
|
|
@@ -2336,7 +2409,7 @@ export declare interface WatchOptions {
|
|
|
2336
2409
|
awaitWriteFinish?: AwaitWriteFinishOptions | boolean
|
|
2337
2410
|
}
|
|
2338
2411
|
|
|
2339
|
-
|
|
2412
|
+
declare class WebSocket_2 extends EventEmitter {
|
|
2340
2413
|
/** The connection is not yet open. */
|
|
2341
2414
|
static readonly CONNECTING: 0
|
|
2342
2415
|
/** The connection is open and ready to communicate. */
|
|
@@ -2354,10 +2427,10 @@ export declare class WebSocket extends EventEmitter {
|
|
|
2354
2427
|
readonly protocol: string
|
|
2355
2428
|
/** The current state of the connection */
|
|
2356
2429
|
readonly readyState:
|
|
2357
|
-
| typeof
|
|
2358
|
-
| typeof
|
|
2359
|
-
| typeof
|
|
2360
|
-
| typeof
|
|
2430
|
+
| typeof WebSocket_2.CONNECTING
|
|
2431
|
+
| typeof WebSocket_2.OPEN
|
|
2432
|
+
| typeof WebSocket_2.CLOSING
|
|
2433
|
+
| typeof WebSocket_2.CLOSED
|
|
2361
2434
|
readonly url: string
|
|
2362
2435
|
|
|
2363
2436
|
/** The connection is not yet open. */
|
|
@@ -2369,20 +2442,20 @@ export declare class WebSocket extends EventEmitter {
|
|
|
2369
2442
|
/** The connection is closed. */
|
|
2370
2443
|
readonly CLOSED: 3
|
|
2371
2444
|
|
|
2372
|
-
onopen: ((event:
|
|
2373
|
-
onerror: ((event:
|
|
2374
|
-
onclose: ((event:
|
|
2375
|
-
onmessage: ((event:
|
|
2445
|
+
onopen: ((event: WebSocket_2.Event) => void) | null
|
|
2446
|
+
onerror: ((event: WebSocket_2.ErrorEvent) => void) | null
|
|
2447
|
+
onclose: ((event: WebSocket_2.CloseEvent) => void) | null
|
|
2448
|
+
onmessage: ((event: WebSocket_2.MessageEvent) => void) | null
|
|
2376
2449
|
|
|
2377
2450
|
constructor(address: null)
|
|
2378
2451
|
constructor(
|
|
2379
2452
|
address: string | URL_2,
|
|
2380
|
-
options?:
|
|
2453
|
+
options?: WebSocket_2.ClientOptions | ClientRequestArgs
|
|
2381
2454
|
)
|
|
2382
2455
|
constructor(
|
|
2383
2456
|
address: string | URL_2,
|
|
2384
2457
|
protocols?: string | string[],
|
|
2385
|
-
options?:
|
|
2458
|
+
options?: WebSocket_2.ClientOptions | ClientRequestArgs
|
|
2386
2459
|
)
|
|
2387
2460
|
|
|
2388
2461
|
close(code?: number, data?: string | Buffer): void
|
|
@@ -2416,146 +2489,146 @@ export declare class WebSocket extends EventEmitter {
|
|
|
2416
2489
|
// HTML5 WebSocket events
|
|
2417
2490
|
addEventListener(
|
|
2418
2491
|
method: 'message',
|
|
2419
|
-
cb: (event:
|
|
2420
|
-
options?:
|
|
2492
|
+
cb: (event: WebSocket_2.MessageEvent) => void,
|
|
2493
|
+
options?: WebSocket_2.EventListenerOptions
|
|
2421
2494
|
): void
|
|
2422
2495
|
addEventListener(
|
|
2423
2496
|
method: 'close',
|
|
2424
|
-
cb: (event:
|
|
2425
|
-
options?:
|
|
2497
|
+
cb: (event: WebSocket_2.CloseEvent) => void,
|
|
2498
|
+
options?: WebSocket_2.EventListenerOptions
|
|
2426
2499
|
): void
|
|
2427
2500
|
addEventListener(
|
|
2428
2501
|
method: 'error',
|
|
2429
|
-
cb: (event:
|
|
2430
|
-
options?:
|
|
2502
|
+
cb: (event: WebSocket_2.ErrorEvent) => void,
|
|
2503
|
+
options?: WebSocket_2.EventListenerOptions
|
|
2431
2504
|
): void
|
|
2432
2505
|
addEventListener(
|
|
2433
2506
|
method: 'open',
|
|
2434
|
-
cb: (event:
|
|
2435
|
-
options?:
|
|
2507
|
+
cb: (event: WebSocket_2.Event) => void,
|
|
2508
|
+
options?: WebSocket_2.EventListenerOptions
|
|
2436
2509
|
): void
|
|
2437
2510
|
|
|
2438
2511
|
removeEventListener(
|
|
2439
2512
|
method: 'message',
|
|
2440
|
-
cb: (event:
|
|
2513
|
+
cb: (event: WebSocket_2.MessageEvent) => void
|
|
2441
2514
|
): void
|
|
2442
2515
|
removeEventListener(
|
|
2443
2516
|
method: 'close',
|
|
2444
|
-
cb: (event:
|
|
2517
|
+
cb: (event: WebSocket_2.CloseEvent) => void
|
|
2445
2518
|
): void
|
|
2446
2519
|
removeEventListener(
|
|
2447
2520
|
method: 'error',
|
|
2448
|
-
cb: (event:
|
|
2521
|
+
cb: (event: WebSocket_2.ErrorEvent) => void
|
|
2449
2522
|
): void
|
|
2450
2523
|
removeEventListener(
|
|
2451
2524
|
method: 'open',
|
|
2452
|
-
cb: (event:
|
|
2525
|
+
cb: (event: WebSocket_2.Event) => void
|
|
2453
2526
|
): void
|
|
2454
2527
|
|
|
2455
2528
|
// Events
|
|
2456
2529
|
on(
|
|
2457
2530
|
event: 'close',
|
|
2458
|
-
listener: (this:
|
|
2531
|
+
listener: (this: WebSocket_2, code: number, reason: Buffer) => void
|
|
2459
2532
|
): this
|
|
2460
|
-
on(event: 'error', listener: (this:
|
|
2533
|
+
on(event: 'error', listener: (this: WebSocket_2, err: Error) => void): this
|
|
2461
2534
|
on(
|
|
2462
2535
|
event: 'upgrade',
|
|
2463
|
-
listener: (this:
|
|
2536
|
+
listener: (this: WebSocket_2, request: IncomingMessage) => void
|
|
2464
2537
|
): this
|
|
2465
2538
|
on(
|
|
2466
2539
|
event: 'message',
|
|
2467
2540
|
listener: (
|
|
2468
|
-
this:
|
|
2469
|
-
data:
|
|
2541
|
+
this: WebSocket_2,
|
|
2542
|
+
data: WebSocket_2.RawData,
|
|
2470
2543
|
isBinary: boolean
|
|
2471
2544
|
) => void
|
|
2472
2545
|
): this
|
|
2473
|
-
on(event: 'open', listener: (this:
|
|
2546
|
+
on(event: 'open', listener: (this: WebSocket_2) => void): this
|
|
2474
2547
|
on(
|
|
2475
2548
|
event: 'ping' | 'pong',
|
|
2476
|
-
listener: (this:
|
|
2549
|
+
listener: (this: WebSocket_2, data: Buffer) => void
|
|
2477
2550
|
): this
|
|
2478
2551
|
on(
|
|
2479
2552
|
event: 'unexpected-response',
|
|
2480
2553
|
listener: (
|
|
2481
|
-
this:
|
|
2554
|
+
this: WebSocket_2,
|
|
2482
2555
|
request: ClientRequest,
|
|
2483
2556
|
response: IncomingMessage
|
|
2484
2557
|
) => void
|
|
2485
2558
|
): this
|
|
2486
2559
|
on(
|
|
2487
2560
|
event: string | symbol,
|
|
2488
|
-
listener: (this:
|
|
2561
|
+
listener: (this: WebSocket_2, ...args: any[]) => void
|
|
2489
2562
|
): this
|
|
2490
2563
|
|
|
2491
2564
|
once(
|
|
2492
2565
|
event: 'close',
|
|
2493
|
-
listener: (this:
|
|
2566
|
+
listener: (this: WebSocket_2, code: number, reason: Buffer) => void
|
|
2494
2567
|
): this
|
|
2495
|
-
once(event: 'error', listener: (this:
|
|
2568
|
+
once(event: 'error', listener: (this: WebSocket_2, err: Error) => void): this
|
|
2496
2569
|
once(
|
|
2497
2570
|
event: 'upgrade',
|
|
2498
|
-
listener: (this:
|
|
2571
|
+
listener: (this: WebSocket_2, request: IncomingMessage) => void
|
|
2499
2572
|
): this
|
|
2500
2573
|
once(
|
|
2501
2574
|
event: 'message',
|
|
2502
2575
|
listener: (
|
|
2503
|
-
this:
|
|
2504
|
-
data:
|
|
2576
|
+
this: WebSocket_2,
|
|
2577
|
+
data: WebSocket_2.RawData,
|
|
2505
2578
|
isBinary: boolean
|
|
2506
2579
|
) => void
|
|
2507
2580
|
): this
|
|
2508
|
-
once(event: 'open', listener: (this:
|
|
2581
|
+
once(event: 'open', listener: (this: WebSocket_2) => void): this
|
|
2509
2582
|
once(
|
|
2510
2583
|
event: 'ping' | 'pong',
|
|
2511
|
-
listener: (this:
|
|
2584
|
+
listener: (this: WebSocket_2, data: Buffer) => void
|
|
2512
2585
|
): this
|
|
2513
2586
|
once(
|
|
2514
2587
|
event: 'unexpected-response',
|
|
2515
2588
|
listener: (
|
|
2516
|
-
this:
|
|
2589
|
+
this: WebSocket_2,
|
|
2517
2590
|
request: ClientRequest,
|
|
2518
2591
|
response: IncomingMessage
|
|
2519
2592
|
) => void
|
|
2520
2593
|
): this
|
|
2521
2594
|
once(
|
|
2522
2595
|
event: string | symbol,
|
|
2523
|
-
listener: (this:
|
|
2596
|
+
listener: (this: WebSocket_2, ...args: any[]) => void
|
|
2524
2597
|
): this
|
|
2525
2598
|
|
|
2526
2599
|
off(
|
|
2527
2600
|
event: 'close',
|
|
2528
|
-
listener: (this:
|
|
2601
|
+
listener: (this: WebSocket_2, code: number, reason: Buffer) => void
|
|
2529
2602
|
): this
|
|
2530
|
-
off(event: 'error', listener: (this:
|
|
2603
|
+
off(event: 'error', listener: (this: WebSocket_2, err: Error) => void): this
|
|
2531
2604
|
off(
|
|
2532
2605
|
event: 'upgrade',
|
|
2533
|
-
listener: (this:
|
|
2606
|
+
listener: (this: WebSocket_2, request: IncomingMessage) => void
|
|
2534
2607
|
): this
|
|
2535
2608
|
off(
|
|
2536
2609
|
event: 'message',
|
|
2537
2610
|
listener: (
|
|
2538
|
-
this:
|
|
2539
|
-
data:
|
|
2611
|
+
this: WebSocket_2,
|
|
2612
|
+
data: WebSocket_2.RawData,
|
|
2540
2613
|
isBinary: boolean
|
|
2541
2614
|
) => void
|
|
2542
2615
|
): this
|
|
2543
|
-
off(event: 'open', listener: (this:
|
|
2616
|
+
off(event: 'open', listener: (this: WebSocket_2) => void): this
|
|
2544
2617
|
off(
|
|
2545
2618
|
event: 'ping' | 'pong',
|
|
2546
|
-
listener: (this:
|
|
2619
|
+
listener: (this: WebSocket_2, data: Buffer) => void
|
|
2547
2620
|
): this
|
|
2548
2621
|
off(
|
|
2549
2622
|
event: 'unexpected-response',
|
|
2550
2623
|
listener: (
|
|
2551
|
-
this:
|
|
2624
|
+
this: WebSocket_2,
|
|
2552
2625
|
request: ClientRequest,
|
|
2553
2626
|
response: IncomingMessage
|
|
2554
2627
|
) => void
|
|
2555
2628
|
): this
|
|
2556
2629
|
off(
|
|
2557
2630
|
event: string | symbol,
|
|
2558
|
-
listener: (this:
|
|
2631
|
+
listener: (this: WebSocket_2, ...args: any[]) => void
|
|
2559
2632
|
): this
|
|
2560
2633
|
|
|
2561
2634
|
addListener(
|
|
@@ -2569,7 +2642,7 @@ export declare class WebSocket extends EventEmitter {
|
|
|
2569
2642
|
): this
|
|
2570
2643
|
addListener(
|
|
2571
2644
|
event: 'message',
|
|
2572
|
-
listener: (data:
|
|
2645
|
+
listener: (data: WebSocket_2.RawData, isBinary: boolean) => void
|
|
2573
2646
|
): this
|
|
2574
2647
|
addListener(event: 'open', listener: () => void): this
|
|
2575
2648
|
addListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this
|
|
@@ -2590,7 +2663,7 @@ export declare class WebSocket extends EventEmitter {
|
|
|
2590
2663
|
): this
|
|
2591
2664
|
removeListener(
|
|
2592
2665
|
event: 'message',
|
|
2593
|
-
listener: (data:
|
|
2666
|
+
listener: (data: WebSocket_2.RawData, isBinary: boolean) => void
|
|
2594
2667
|
): this
|
|
2595
2668
|
removeListener(event: 'open', listener: () => void): this
|
|
2596
2669
|
removeListener(event: 'ping' | 'pong', listener: (data: Buffer) => void): this
|
|
@@ -2604,28 +2677,28 @@ export declare class WebSocket extends EventEmitter {
|
|
|
2604
2677
|
): this
|
|
2605
2678
|
}
|
|
2606
2679
|
|
|
2607
|
-
|
|
2680
|
+
declare namespace WebSocket_2 {
|
|
2608
2681
|
/**
|
|
2609
2682
|
* Data represents the raw message payload received over the WebSocket.
|
|
2610
2683
|
*/
|
|
2611
|
-
|
|
2684
|
+
type RawData = Buffer | ArrayBuffer | Buffer[]
|
|
2612
2685
|
|
|
2613
2686
|
/**
|
|
2614
2687
|
* Data represents the message payload received over the WebSocket.
|
|
2615
2688
|
*/
|
|
2616
|
-
|
|
2689
|
+
type Data = string | Buffer | ArrayBuffer | Buffer[]
|
|
2617
2690
|
|
|
2618
2691
|
/**
|
|
2619
2692
|
* CertMeta represents the accepted types for certificate & key data.
|
|
2620
2693
|
*/
|
|
2621
|
-
|
|
2694
|
+
type CertMeta = string | string[] | Buffer | Buffer[]
|
|
2622
2695
|
|
|
2623
2696
|
/**
|
|
2624
2697
|
* VerifyClientCallbackSync is a synchronous callback used to inspect the
|
|
2625
2698
|
* incoming message. The return value (boolean) of the function determines
|
|
2626
2699
|
* whether or not to accept the handshake.
|
|
2627
2700
|
*/
|
|
2628
|
-
|
|
2701
|
+
type VerifyClientCallbackSync = (info: {
|
|
2629
2702
|
origin: string
|
|
2630
2703
|
secure: boolean
|
|
2631
2704
|
req: IncomingMessage
|
|
@@ -2636,7 +2709,7 @@ export declare namespace WebSocket {
|
|
|
2636
2709
|
* incoming message. The return value (boolean) of the function determines
|
|
2637
2710
|
* whether or not to accept the handshake.
|
|
2638
2711
|
*/
|
|
2639
|
-
|
|
2712
|
+
type VerifyClientCallbackAsync = (
|
|
2640
2713
|
info: { origin: string; secure: boolean; req: IncomingMessage },
|
|
2641
2714
|
callback: (
|
|
2642
2715
|
res: boolean,
|
|
@@ -2646,7 +2719,7 @@ export declare namespace WebSocket {
|
|
|
2646
2719
|
) => void
|
|
2647
2720
|
) => void
|
|
2648
2721
|
|
|
2649
|
-
|
|
2722
|
+
interface ClientOptions extends SecureContextOptions {
|
|
2650
2723
|
protocol?: string | undefined
|
|
2651
2724
|
followRedirects?: boolean | undefined
|
|
2652
2725
|
generateMask?(mask: Buffer): void
|
|
@@ -2666,7 +2739,7 @@ export declare namespace WebSocket {
|
|
|
2666
2739
|
skipUTF8Validation?: boolean | undefined
|
|
2667
2740
|
}
|
|
2668
2741
|
|
|
2669
|
-
|
|
2742
|
+
interface PerMessageDeflateOptions {
|
|
2670
2743
|
serverNoContextTakeover?: boolean | undefined
|
|
2671
2744
|
clientNoContextTakeover?: boolean | undefined
|
|
2672
2745
|
serverMaxWindowBits?: number | undefined
|
|
@@ -2689,19 +2762,19 @@ export declare namespace WebSocket {
|
|
|
2689
2762
|
concurrencyLimit?: number | undefined
|
|
2690
2763
|
}
|
|
2691
2764
|
|
|
2692
|
-
|
|
2765
|
+
interface Event {
|
|
2693
2766
|
type: string
|
|
2694
2767
|
target: WebSocket
|
|
2695
2768
|
}
|
|
2696
2769
|
|
|
2697
|
-
|
|
2770
|
+
interface ErrorEvent {
|
|
2698
2771
|
error: any
|
|
2699
2772
|
message: string
|
|
2700
2773
|
type: string
|
|
2701
2774
|
target: WebSocket
|
|
2702
2775
|
}
|
|
2703
2776
|
|
|
2704
|
-
|
|
2777
|
+
interface CloseEvent {
|
|
2705
2778
|
wasClean: boolean
|
|
2706
2779
|
code: number
|
|
2707
2780
|
reason: string
|
|
@@ -2709,17 +2782,17 @@ export declare namespace WebSocket {
|
|
|
2709
2782
|
target: WebSocket
|
|
2710
2783
|
}
|
|
2711
2784
|
|
|
2712
|
-
|
|
2785
|
+
interface MessageEvent {
|
|
2713
2786
|
data: Data
|
|
2714
2787
|
type: string
|
|
2715
2788
|
target: WebSocket
|
|
2716
2789
|
}
|
|
2717
2790
|
|
|
2718
|
-
|
|
2791
|
+
interface EventListenerOptions {
|
|
2719
2792
|
once?: boolean | undefined
|
|
2720
2793
|
}
|
|
2721
2794
|
|
|
2722
|
-
|
|
2795
|
+
interface ServerOptions {
|
|
2723
2796
|
host?: string | undefined
|
|
2724
2797
|
port?: number | undefined
|
|
2725
2798
|
backlog?: number | undefined
|
|
@@ -2741,14 +2814,14 @@ export declare namespace WebSocket {
|
|
|
2741
2814
|
WebSocket?: typeof WebSocket.WebSocket | undefined
|
|
2742
2815
|
}
|
|
2743
2816
|
|
|
2744
|
-
|
|
2817
|
+
interface AddressInfo {
|
|
2745
2818
|
address: string
|
|
2746
2819
|
family: string
|
|
2747
2820
|
port: number
|
|
2748
2821
|
}
|
|
2749
2822
|
|
|
2750
2823
|
// WebSocket Server
|
|
2751
|
-
|
|
2824
|
+
class Server<T extends WebSocket = WebSocket> extends EventEmitter {
|
|
2752
2825
|
options: ServerOptions
|
|
2753
2826
|
path: string
|
|
2754
2827
|
clients: Set<T>
|
|
@@ -2840,20 +2913,21 @@ export declare namespace WebSocket {
|
|
|
2840
2913
|
}
|
|
2841
2914
|
|
|
2842
2915
|
const WebSocketServer: typeof Server
|
|
2843
|
-
|
|
2916
|
+
interface WebSocketServer extends Server {} // tslint:disable-line no-empty-interface
|
|
2844
2917
|
const WebSocket: typeof WebSocketAlias
|
|
2845
|
-
|
|
2918
|
+
interface WebSocket extends WebSocketAlias {} // tslint:disable-line no-empty-interface
|
|
2846
2919
|
|
|
2847
2920
|
// WebSocket stream
|
|
2848
|
-
|
|
2921
|
+
function createWebSocketStream(
|
|
2849
2922
|
websocket: WebSocket,
|
|
2850
2923
|
options?: DuplexOptions
|
|
2851
2924
|
): Duplex
|
|
2852
2925
|
}
|
|
2926
|
+
export { WebSocket_2 as WebSocket }
|
|
2853
2927
|
|
|
2854
|
-
export declare const WebSocketAlias: typeof
|
|
2928
|
+
export declare const WebSocketAlias: typeof WebSocket_2;
|
|
2855
2929
|
|
|
2856
|
-
export declare interface WebSocketAlias extends
|
|
2930
|
+
export declare interface WebSocketAlias extends WebSocket_2 {}
|
|
2857
2931
|
|
|
2858
2932
|
export declare interface WebSocketClient {
|
|
2859
2933
|
/**
|
|
@@ -2868,7 +2942,7 @@ export declare interface WebSocketClient {
|
|
|
2868
2942
|
* The raw WebSocket instance
|
|
2869
2943
|
* @advanced
|
|
2870
2944
|
*/
|
|
2871
|
-
socket:
|
|
2945
|
+
socket: WebSocket_2;
|
|
2872
2946
|
}
|
|
2873
2947
|
|
|
2874
2948
|
export declare type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
|
|
@@ -2893,13 +2967,13 @@ export declare interface WebSocketServer {
|
|
|
2893
2967
|
/**
|
|
2894
2968
|
* Handle custom event emitted by `import.meta.hot.send`
|
|
2895
2969
|
*/
|
|
2896
|
-
on:
|
|
2970
|
+
on: WebSocket_2.Server['on'] & {
|
|
2897
2971
|
<T extends string>(event: T, listener: WebSocketCustomListener<InferCustomEventPayload<T>>): void;
|
|
2898
2972
|
};
|
|
2899
2973
|
/**
|
|
2900
2974
|
* Unregister event listener.
|
|
2901
2975
|
*/
|
|
2902
|
-
off:
|
|
2976
|
+
off: WebSocket_2.Server['off'] & {
|
|
2903
2977
|
(event: string, listener: Function): void;
|
|
2904
2978
|
};
|
|
2905
2979
|
}
|