vite 3.0.0-alpha.3 → 3.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/node/chunks/{dep-24157481.js → dep-17430d09.js} +0 -0
  2. package/dist/node/chunks/{dep-6f5ac69c.js → dep-52974b5a.js} +33902 -33579
  3. package/dist/node/chunks/{dep-b1fc04c1.js → dep-8bed6f50.js} +1 -1
  4. package/dist/node/chunks/{dep-5eede05c.js → dep-a4f17494.js} +1 -1
  5. package/dist/node/chunks/{dep-da8244f4.js → dep-b4474709.js} +100 -47
  6. package/dist/node/cli.js +7 -5
  7. package/dist/node/constants.js +1 -1
  8. package/dist/node/index.d.ts +117 -13
  9. package/dist/node/index.js +1 -1
  10. package/dist/node-cjs/publicUtils.cjs +0 -11
  11. package/package.json +11 -9
  12. package/types/es-module-lexer.d.ts +90 -0
  13. package/dist/node/build.d.ts +0 -178
  14. package/dist/node/certificate.d.ts +0 -2
  15. package/dist/node/cli.d.ts +0 -1
  16. package/dist/node/config.d.ts +0 -240
  17. package/dist/node/constants.d.ts +0 -35
  18. package/dist/node/env.d.ts +0 -3
  19. package/dist/node/http.d.ts +0 -88
  20. package/dist/node/logger.d.ts +0 -31
  21. package/dist/node/optimizer/esbuildDepPlugin.d.ts +0 -4
  22. package/dist/node/optimizer/index.d.ts +0 -154
  23. package/dist/node/optimizer/registerMissing.d.ts +0 -3
  24. package/dist/node/optimizer/scan.d.ts +0 -8
  25. package/dist/node/packages.d.ts +0 -27
  26. package/dist/node/plugin.d.ts +0 -129
  27. package/dist/node/plugins/asset.d.ts +0 -68
  28. package/dist/node/plugins/assetImportMetaUrl.d.ts +0 -13
  29. package/dist/node/plugins/clientInjections.d.ts +0 -7
  30. package/dist/node/plugins/css.d.ts +0 -86
  31. package/dist/node/plugins/dataUri.d.ts +0 -5
  32. package/dist/node/plugins/define.d.ts +0 -3
  33. package/dist/node/plugins/dynamicImportVars.d.ts +0 -9
  34. package/dist/node/plugins/ensureWatch.d.ts +0 -5
  35. package/dist/node/plugins/esbuild.d.ts +0 -15
  36. package/dist/node/plugins/html.d.ts +0 -120
  37. package/dist/node/plugins/importAnalysis.d.ts +0 -47
  38. package/dist/node/plugins/importAnalysisBuild.d.ts +0 -16
  39. package/dist/node/plugins/importMetaGlob.d.ts +0 -34
  40. package/dist/node/plugins/index.d.ts +0 -3
  41. package/dist/node/plugins/json.d.ts +0 -23
  42. package/dist/node/plugins/loadFallback.d.ts +0 -5
  43. package/dist/node/plugins/manifest.d.ts +0 -14
  44. package/dist/node/plugins/metadata.d.ts +0 -9
  45. package/dist/node/plugins/modulePreloadPolyfill.d.ts +0 -4
  46. package/dist/node/plugins/optimizedDeps.d.ts +0 -4
  47. package/dist/node/plugins/preAlias.d.ts +0 -5
  48. package/dist/node/plugins/reporter.d.ts +0 -3
  49. package/dist/node/plugins/resolve.d.ts +0 -39
  50. package/dist/node/plugins/splitVendorChunk.d.ts +0 -12
  51. package/dist/node/plugins/ssrRequireHook.d.ts +0 -12
  52. package/dist/node/plugins/terser.d.ts +0 -3
  53. package/dist/node/plugins/wasm.d.ts +0 -4
  54. package/dist/node/plugins/worker.d.ts +0 -9
  55. package/dist/node/plugins/workerImportMetaUrl.d.ts +0 -3
  56. package/dist/node/preview.d.ts +0 -33
  57. package/dist/node/publicUtils.d.ts +0 -11
  58. package/dist/node/server/hmr.d.ts +0 -39
  59. package/dist/node/server/index.d.ts +0 -198
  60. package/dist/node/server/middlewares/base.d.ts +0 -3
  61. package/dist/node/server/middlewares/compression.d.ts +0 -1
  62. package/dist/node/server/middlewares/error.d.ts +0 -8
  63. package/dist/node/server/middlewares/indexHtml.d.ts +0 -4
  64. package/dist/node/server/middlewares/proxy.d.ts +0 -20
  65. package/dist/node/server/middlewares/spaFallback.d.ts +0 -2
  66. package/dist/node/server/middlewares/static.d.ts +0 -6
  67. package/dist/node/server/middlewares/time.d.ts +0 -2
  68. package/dist/node/server/middlewares/transform.d.ts +0 -3
  69. package/dist/node/server/moduleGraph.d.ts +0 -55
  70. package/dist/node/server/openBrowser.d.ts +0 -15
  71. package/dist/node/server/pluginContainer.d.ts +0 -41
  72. package/dist/node/server/searchRoot.d.ts +0 -8
  73. package/dist/node/server/send.d.ts +0 -10
  74. package/dist/node/server/sourcemap.d.ts +0 -11
  75. package/dist/node/server/transformRequest.d.ts +0 -14
  76. package/dist/node/server/ws.d.ts +0 -55
  77. package/dist/node/ssr/ssrExternal.d.ts +0 -11
  78. package/dist/node/ssr/ssrManifestPlugin.d.ts +0 -3
  79. package/dist/node/ssr/ssrModuleLoader.d.ts +0 -7
  80. package/dist/node/ssr/ssrStacktrace.d.ts +0 -3
  81. package/dist/node/ssr/ssrTransform.d.ts +0 -14
  82. package/dist/node/utils.d.ts +0 -144
@@ -1,198 +0,0 @@
1
- /// <reference types="node" />
2
- import type * as http from 'http';
3
- import type { FSWatcher, WatchOptions } from 'types/chokidar';
4
- import type { Connect } from 'types/connect';
5
- import type { SourceMap } from 'rollup';
6
- import type { CommonServerOptions } from '../http';
7
- import type { InlineConfig, ResolvedConfig } from '../config';
8
- import type { OptimizedDeps } from '../optimizer';
9
- import type { Logger } from '../logger';
10
- import type { PluginContainer } from './pluginContainer';
11
- import type { WebSocketServer } from './ws';
12
- import { ModuleGraph } from './moduleGraph';
13
- import type { HmrOptions } from './hmr';
14
- import type { TransformOptions, TransformResult } from './transformRequest';
15
- export { searchForWorkspaceRoot } from './searchRoot';
16
- export interface ServerOptions extends CommonServerOptions {
17
- /**
18
- * Force dep pre-optimization regardless of whether deps have changed.
19
- */
20
- force?: boolean;
21
- /**
22
- * Configure HMR-specific options (port, host, path & protocol)
23
- */
24
- hmr?: HmrOptions | boolean;
25
- /**
26
- * chokidar watch options
27
- * https://github.com/paulmillr/chokidar#api
28
- */
29
- watch?: WatchOptions;
30
- /**
31
- * Create Vite dev server to be used as a middleware in an existing server
32
- */
33
- middlewareMode?: boolean | 'html' | 'ssr';
34
- /**
35
- * Prepend this folder to http requests, for use when proxying vite as a subfolder
36
- * Should start and end with the `/` character
37
- */
38
- base?: string;
39
- /**
40
- * Options for files served via '/\@fs/'.
41
- */
42
- fs?: FileSystemServeOptions;
43
- /**
44
- * Origin for the generated asset URLs.
45
- *
46
- * @example `http://127.0.0.1:8080`
47
- */
48
- origin?: string;
49
- /**
50
- * Pre-transform known direct imports
51
- * @default true
52
- */
53
- preTransformRequests?: boolean;
54
- }
55
- export interface ResolvedServerOptions extends ServerOptions {
56
- fs: Required<FileSystemServeOptions>;
57
- }
58
- export interface FileSystemServeOptions {
59
- /**
60
- * Strictly restrict file accessing outside of allowing paths.
61
- *
62
- * Set to `false` to disable the warning
63
- *
64
- * @default true
65
- */
66
- strict?: boolean;
67
- /**
68
- * Restrict accessing files outside the allowed directories.
69
- *
70
- * Accepts absolute path or a path relative to project root.
71
- * Will try to search up for workspace root by default.
72
- */
73
- allow?: string[];
74
- /**
75
- * Restrict accessing files that matches the patterns.
76
- *
77
- * This will have higher priority than `allow`.
78
- * Glob patterns are supported.
79
- *
80
- * @default ['.env', '.env.*', '*.crt', '*.pem']
81
- */
82
- deny?: string[];
83
- }
84
- export declare type ServerHook = (server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
85
- export interface ViteDevServer {
86
- /**
87
- * The resolved vite config object
88
- */
89
- config: ResolvedConfig;
90
- /**
91
- * A connect app instance.
92
- * - Can be used to attach custom middlewares to the dev server.
93
- * - Can also be used as the handler function of a custom http server
94
- * or as a middleware in any connect-style Node.js frameworks
95
- *
96
- * https://github.com/senchalabs/connect#use-middleware
97
- */
98
- middlewares: Connect.Server;
99
- /**
100
- * native Node http server instance
101
- * will be null in middleware mode
102
- */
103
- httpServer: http.Server | null;
104
- /**
105
- * chokidar watcher instance
106
- * https://github.com/paulmillr/chokidar#api
107
- */
108
- watcher: FSWatcher;
109
- /**
110
- * web socket server with `send(payload)` method
111
- */
112
- ws: WebSocketServer;
113
- /**
114
- * Rollup plugin container that can run plugin hooks on a given file
115
- */
116
- pluginContainer: PluginContainer;
117
- /**
118
- * Module graph that tracks the import relationships, url to file mapping
119
- * and hmr state.
120
- */
121
- moduleGraph: ModuleGraph;
122
- /**
123
- * Programmatically resolve, load and transform a URL and get the result
124
- * without going through the http request pipeline.
125
- */
126
- transformRequest(url: string, options?: TransformOptions): Promise<TransformResult | null>;
127
- /**
128
- * Apply vite built-in HTML transforms and any plugin HTML transforms.
129
- */
130
- transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>;
131
- /**
132
- * Transform module code into SSR format.
133
- */
134
- ssrTransform(code: string, inMap: SourceMap | null, url: string): Promise<TransformResult | null>;
135
- /**
136
- * Load a given URL as an instantiated module for SSR.
137
- */
138
- ssrLoadModule(url: string, opts?: {
139
- fixStacktrace?: boolean;
140
- }): Promise<Record<string, any>>;
141
- /**
142
- * Returns a fixed version of the given stack
143
- */
144
- ssrRewriteStacktrace(stack: string): string;
145
- /**
146
- * Mutates the given SSR error by rewriting the stacktrace
147
- */
148
- ssrFixStacktrace(e: Error): void;
149
- /**
150
- * Start the server.
151
- */
152
- listen(port?: number, isRestart?: boolean): Promise<ViteDevServer>;
153
- /**
154
- * Stop the server.
155
- */
156
- close(): Promise<void>;
157
- /**
158
- * Print server urls
159
- */
160
- printUrls(): void;
161
- /**
162
- * Restart the server.
163
- *
164
- * @param forceOptimize - force the optimizer to re-bundle, same as --force cli flag
165
- */
166
- restart(forceOptimize?: boolean): Promise<void>;
167
- /**
168
- * @internal
169
- */
170
- _optimizedDeps: OptimizedDeps | null;
171
- /**
172
- * @internal
173
- */
174
- _importGlobMap: Map<string, string[][]>;
175
- /**
176
- * Deps that are externalized
177
- * @internal
178
- */
179
- _ssrExternals: string[] | null;
180
- /**
181
- * @internal
182
- */
183
- _restartPromise: Promise<void> | null;
184
- /**
185
- * @internal
186
- */
187
- _forceOptimizeOnRestart: boolean;
188
- /**
189
- * @internal
190
- */
191
- _pendingRequests: Map<string, {
192
- request: Promise<TransformResult | null>;
193
- timestamp: number;
194
- abort: () => void;
195
- }>;
196
- }
197
- export declare function createServer(inlineConfig?: InlineConfig): Promise<ViteDevServer>;
198
- export declare function resolveServerOptions(root: string, raw: ServerOptions | undefined, logger: Logger): ResolvedServerOptions;
@@ -1,3 +0,0 @@
1
- import type { Connect } from 'types/connect';
2
- import type { ViteDevServer } from '..';
3
- export declare function baseMiddleware({ config }: ViteDevServer): Connect.NextHandleFunction;
@@ -1 +0,0 @@
1
- export default function compression(): (req: any, res: any, next?: () => void) => void;
@@ -1,8 +0,0 @@
1
- import type { RollupError } from 'rollup';
2
- import type { Connect } from 'types/connect';
3
- import type { ErrorPayload } from 'types/hmrPayload';
4
- import type { ViteDevServer } from '../..';
5
- export declare function prepareError(err: Error | RollupError): ErrorPayload['err'];
6
- export declare function buildErrorMessage(err: RollupError, args?: string[], includeStack?: boolean): string;
7
- export declare function logError(server: ViteDevServer, err: RollupError): void;
8
- export declare function errorMiddleware(server: ViteDevServer, allowNext?: boolean): Connect.ErrorHandleFunction;
@@ -1,4 +0,0 @@
1
- import type { Connect } from 'types/connect';
2
- import type { ViteDevServer } from '../..';
3
- export declare function createDevHtmlTransformFn(server: ViteDevServer): (url: string, html: string, originalUrl: string) => Promise<string>;
4
- export declare function indexHtmlMiddleware(server: ViteDevServer): Connect.NextHandleFunction;
@@ -1,20 +0,0 @@
1
- /// <reference types="node" />
2
- import type * as http from 'http';
3
- import type { Connect } from 'types/connect';
4
- import type { HttpProxy } from 'types/http-proxy';
5
- import type { CommonServerOptions, ResolvedConfig } from '../..';
6
- export interface ProxyOptions extends HttpProxy.ServerOptions {
7
- /**
8
- * rewrite path
9
- */
10
- rewrite?: (path: string) => string;
11
- /**
12
- * configure the proxy server (e.g. listen to events)
13
- */
14
- configure?: (proxy: HttpProxy.Server, options: ProxyOptions) => void;
15
- /**
16
- * webpack-dev-server style bypass function
17
- */
18
- bypass?: (req: http.IncomingMessage, res: http.ServerResponse, options: ProxyOptions) => void | null | undefined | false | string;
19
- }
20
- export declare function proxyMiddleware(httpServer: http.Server | null, options: NonNullable<CommonServerOptions['proxy']>, config: ResolvedConfig): Connect.NextHandleFunction;
@@ -1,2 +0,0 @@
1
- import type { Connect } from 'types/connect';
2
- export declare function spaFallbackMiddleware(root: string): Connect.NextHandleFunction;
@@ -1,6 +0,0 @@
1
- import type { Connect } from 'types/connect';
2
- import type { ViteDevServer } from '../..';
3
- export declare function servePublicMiddleware(dir: string): Connect.NextHandleFunction;
4
- export declare function serveStaticMiddleware(dir: string, server: ViteDevServer): Connect.NextHandleFunction;
5
- export declare function serveRawFsMiddleware(server: ViteDevServer): Connect.NextHandleFunction;
6
- export declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
@@ -1,2 +0,0 @@
1
- import type { Connect } from 'types/connect';
2
- export declare function timeMiddleware(root: string): Connect.NextHandleFunction;
@@ -1,3 +0,0 @@
1
- import type { Connect } from 'types/connect';
2
- import type { ViteDevServer } from '..';
3
- export declare function transformMiddleware(server: ViteDevServer): Connect.NextHandleFunction;
@@ -1,55 +0,0 @@
1
- import type { ModuleInfo, PartialResolvedId } from 'rollup';
2
- import type { TransformResult } from './transformRequest';
3
- export declare class ModuleNode {
4
- /**
5
- * Public served url path, starts with /
6
- */
7
- url: string;
8
- /**
9
- * Resolved file system path + query
10
- */
11
- id: string | null;
12
- file: string | null;
13
- type: 'js' | 'css';
14
- info?: ModuleInfo;
15
- meta?: Record<string, any>;
16
- importers: Set<ModuleNode>;
17
- importedModules: Set<ModuleNode>;
18
- acceptedHmrDeps: Set<ModuleNode>;
19
- isSelfAccepting?: boolean;
20
- transformResult: TransformResult | null;
21
- ssrTransformResult: TransformResult | null;
22
- ssrModule: Record<string, any> | null;
23
- ssrError: Error | null;
24
- lastHMRTimestamp: number;
25
- lastInvalidationTimestamp: number;
26
- constructor(url: string);
27
- }
28
- export declare type ResolvedUrl = [
29
- url: string,
30
- resolvedId: string,
31
- meta: object | null | undefined
32
- ];
33
- export declare class ModuleGraph {
34
- private resolveId;
35
- urlToModuleMap: Map<string, ModuleNode>;
36
- idToModuleMap: Map<string, ModuleNode>;
37
- fileToModulesMap: Map<string, Set<ModuleNode>>;
38
- safeModulesPath: Set<string>;
39
- constructor(resolveId: (url: string, ssr: boolean) => Promise<PartialResolvedId | null>);
40
- getModuleByUrl(rawUrl: string, ssr?: boolean): Promise<ModuleNode | undefined>;
41
- getModuleById(id: string): ModuleNode | undefined;
42
- getModulesByFile(file: string): Set<ModuleNode> | undefined;
43
- onFileChange(file: string): void;
44
- invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>, timestamp?: number): void;
45
- invalidateAll(): void;
46
- /**
47
- * Update the module graph based on a module's updated imports information
48
- * If there are dependencies that no longer have any importers, they are
49
- * returned as a Set.
50
- */
51
- updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, acceptedModules: Set<string | ModuleNode>, isSelfAccepting: boolean, ssr?: boolean): Promise<Set<ModuleNode> | undefined>;
52
- ensureEntryFromUrl(rawUrl: string, ssr?: boolean): Promise<ModuleNode>;
53
- createFileOnlyEntry(file: string): ModuleNode;
54
- resolveUrl(url: string, ssr?: boolean): Promise<ResolvedUrl>;
55
- }
@@ -1,15 +0,0 @@
1
- /**
2
- * The following is modified based on source found in
3
- * https://github.com/facebook/create-react-app
4
- *
5
- * MIT Licensed
6
- * Copyright (c) 2015-present, Facebook, Inc.
7
- * https://github.com/facebook/create-react-app/blob/master/LICENSE
8
- *
9
- */
10
- import type { Logger } from '../logger';
11
- /**
12
- * Reads the BROWSER environment variable and decides what to do with it.
13
- * Returns true if it opened a browser or ran a node.js script, otherwise false.
14
- */
15
- export declare function openBrowser(url: string, opt: string | true, logger: Logger): boolean;
@@ -1,41 +0,0 @@
1
- /**
2
- * This file is refactored into TypeScript based on
3
- * https://github.com/preactjs/wmr/blob/main/packages/wmr/src/lib/rollup-plugin-container.js
4
- */
5
- import type { InputOptions, LoadResult, ModuleInfo, OutputOptions, PartialResolvedId, SourceDescription } from 'rollup';
6
- import * as acorn from 'acorn';
7
- import type { FSWatcher } from 'chokidar';
8
- import type { Plugin } from '../plugin';
9
- import type { ResolvedConfig } from '../config';
10
- import type { ModuleGraph } from './moduleGraph';
11
- export interface PluginContainerOptions {
12
- cwd?: string;
13
- output?: OutputOptions;
14
- modules?: Map<string, {
15
- info: ModuleInfo;
16
- }>;
17
- writeFile?: (name: string, source: string | Uint8Array) => void;
18
- }
19
- export interface PluginContainer {
20
- options: InputOptions;
21
- getModuleInfo(id: string): ModuleInfo | null;
22
- buildStart(options: InputOptions): Promise<void>;
23
- resolveId(id: string, importer?: string, options?: {
24
- skip?: Set<Plugin>;
25
- ssr?: boolean;
26
- /**
27
- * @internal
28
- */
29
- scan?: boolean;
30
- }): Promise<PartialResolvedId | null>;
31
- transform(code: string, id: string, options?: {
32
- inMap?: SourceDescription['map'];
33
- ssr?: boolean;
34
- }): Promise<SourceDescription | null>;
35
- load(id: string, options?: {
36
- ssr?: boolean;
37
- }): Promise<LoadResult | null>;
38
- close(): Promise<void>;
39
- }
40
- export declare let parser: typeof acorn.Parser;
41
- export declare function createPluginContainer({ plugins, logger, root, build: { rollupOptions } }: ResolvedConfig, moduleGraph?: ModuleGraph, watcher?: FSWatcher): Promise<PluginContainer>;
@@ -1,8 +0,0 @@
1
- /**
2
- * Search up for the nearest `package.json`
3
- */
4
- export declare function searchForPackageRoot(current: string, root?: string): string;
5
- /**
6
- * Search up for the nearest workspace root
7
- */
8
- export declare function searchForWorkspaceRoot(current: string, root?: string): string;
@@ -1,10 +0,0 @@
1
- /// <reference types="node" />
2
- import type { IncomingMessage, OutgoingHttpHeaders, ServerResponse } from 'http';
3
- import type { SourceMap } from 'rollup';
4
- export interface SendOptions {
5
- etag?: string;
6
- cacheControl?: string;
7
- headers?: OutgoingHttpHeaders;
8
- map?: SourceMap | null;
9
- }
10
- export declare function send(req: IncomingMessage, res: ServerResponse, content: string | Buffer, type: string, options: SendOptions): void;
@@ -1,11 +0,0 @@
1
- import type { SourceMap } from 'rollup';
2
- import type { Logger } from '../logger';
3
- interface SourceMapLike {
4
- sources: string[];
5
- sourcesContent?: (string | null)[];
6
- sourceRoot?: string;
7
- }
8
- export declare function injectSourcesContent(map: SourceMapLike, file: string, logger: Logger): Promise<void>;
9
- export declare function genSourceMapUrl(map: SourceMap | string | undefined): string;
10
- export declare function getCodeWithSourcemap(type: 'js' | 'css', code: string, map: SourceMap | null): string;
11
- export {};
@@ -1,14 +0,0 @@
1
- import type { SourceMap } from 'rollup';
2
- import type { ViteDevServer } from '..';
3
- export interface TransformResult {
4
- code: string;
5
- map: SourceMap | null;
6
- etag?: string;
7
- deps?: string[];
8
- dynamicDeps?: string[];
9
- }
10
- export interface TransformOptions {
11
- ssr?: boolean;
12
- html?: boolean;
13
- }
14
- export declare function transformRequest(url: string, server: ViteDevServer, options?: TransformOptions): Promise<TransformResult | null>;
@@ -1,55 +0,0 @@
1
- /// <reference types="node" />
2
- import type { Server } from 'http';
3
- import type { ServerOptions as HttpsServerOptions } from 'https';
4
- import type { WebSocket as WebSocketTypes } from 'types/ws';
5
- import type { CustomPayload, HMRPayload } from 'types/hmrPayload';
6
- import type { InferCustomEventPayload } from 'types/customEvent';
7
- import type { ResolvedConfig } from '..';
8
- export declare const HMR_HEADER = "vite-hmr";
9
- export declare type WebSocketCustomListener<T> = (data: T, client: WebSocketClient) => void;
10
- export interface WebSocketServer {
11
- /**
12
- * Get all connected clients.
13
- */
14
- clients: Set<WebSocketClient>;
15
- /**
16
- * Boardcast events to all clients
17
- */
18
- send(payload: HMRPayload): void;
19
- /**
20
- * Send custom event
21
- */
22
- send<T extends string>(event: T, payload?: InferCustomEventPayload<T>): void;
23
- /**
24
- * Disconnect all clients and terminate the server.
25
- */
26
- close(): Promise<void>;
27
- /**
28
- * Handle custom event emitted by `import.meta.hot.send`
29
- */
30
- on: WebSocketTypes.Server['on'] & {
31
- <T extends string>(event: T, listener: WebSocketCustomListener<InferCustomEventPayload<T>>): void;
32
- };
33
- /**
34
- * Unregister event listener.
35
- */
36
- off: WebSocketTypes.Server['off'] & {
37
- (event: string, listener: Function): void;
38
- };
39
- }
40
- export interface WebSocketClient {
41
- /**
42
- * Send event to the client
43
- */
44
- send(payload: HMRPayload): void;
45
- /**
46
- * Send custom event
47
- */
48
- send(event: string, payload?: CustomPayload['data']): void;
49
- /**
50
- * The raw WebSocket instance
51
- * @advanced
52
- */
53
- socket: WebSocketTypes;
54
- }
55
- export declare function createWebSocketServer(server: Server | null, config: ResolvedConfig, httpsOptions?: HttpsServerOptions): WebSocketServer;
@@ -1,11 +0,0 @@
1
- import type { ResolvedConfig } from '..';
2
- /**
3
- * Converts "parent > child" syntax to just "child"
4
- */
5
- export declare function stripNesting(packages: string[]): string[];
6
- /**
7
- * Heuristics for determining whether a dependency should be externalized for
8
- * server-side rendering.
9
- */
10
- export declare function resolveSSRExternal(config: ResolvedConfig, knownImports: string[]): string[];
11
- export declare function shouldExternalizeForSSR(id: string, externals: string[]): boolean;
@@ -1,3 +0,0 @@
1
- import type { ResolvedConfig } from '..';
2
- import type { Plugin } from '../plugin';
3
- export declare function ssrManifestPlugin(config: ResolvedConfig): Plugin;
@@ -1,7 +0,0 @@
1
- import type { ViteDevServer } from '../server';
2
- interface SSRContext {
3
- global: typeof globalThis;
4
- }
5
- declare type SSRModule = Record<string, any>;
6
- export declare function ssrLoadModule(url: string, server: ViteDevServer, context?: SSRContext, urlStack?: string[], fixStacktrace?: boolean): Promise<SSRModule>;
7
- export {};
@@ -1,3 +0,0 @@
1
- import type { ModuleGraph } from '../server/moduleGraph';
2
- export declare function ssrRewriteStacktrace(stack: string, moduleGraph: ModuleGraph): string;
3
- export declare function rebindErrorStacktrace(e: Error, stacktrace: string): void;
@@ -1,14 +0,0 @@
1
- import type { SourceMap } from 'rollup';
2
- import type { TransformResult } from '../server/transformRequest';
3
- interface TransformOptions {
4
- json?: {
5
- stringify?: boolean;
6
- };
7
- }
8
- export declare const ssrModuleExportsKey = "__vite_ssr_exports__";
9
- export declare const ssrImportKey = "__vite_ssr_import__";
10
- export declare const ssrDynamicImportKey = "__vite_ssr_dynamic_import__";
11
- export declare const ssrExportAllKey = "__vite_ssr_exportAll__";
12
- export declare const ssrImportMetaKey = "__vite_ssr_import_meta__";
13
- export declare function ssrTransform(code: string, inMap: SourceMap | null, url: string, options?: TransformOptions): Promise<TransformResult | null>;
14
- export {};