vite 3.0.0-alpha.5 → 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.
- package/dist/node/chunks/{dep-0232e200.js → dep-52974b5a.js} +42 -11
- package/dist/node/chunks/{dep-21067347.js → dep-8bed6f50.js} +1 -1
- package/dist/node/chunks/{dep-cd161504.js → dep-a4f17494.js} +1 -1
- package/dist/node/chunks/{dep-13a14c32.js → dep-b4474709.js} +1 -1
- package/dist/node/cli.js +5 -5
- package/dist/node/constants.js +1 -1
- package/dist/node/index.d.ts +79 -2
- package/dist/node/index.js +1 -1
- package/package.json +3 -2
- package/types/es-module-lexer.d.ts +90 -0
- package/dist/node/build.d.ts +0 -178
- package/dist/node/certificate.d.ts +0 -2
- package/dist/node/cli.d.ts +0 -1
- package/dist/node/config.d.ts +0 -246
- package/dist/node/constants.d.ts +0 -35
- package/dist/node/env.d.ts +0 -3
- package/dist/node/http.d.ts +0 -88
- package/dist/node/logger.d.ts +0 -31
- package/dist/node/optimizer/esbuildDepPlugin.d.ts +0 -4
- package/dist/node/optimizer/index.d.ts +0 -181
- package/dist/node/optimizer/optimizer.d.ts +0 -4
- package/dist/node/optimizer/scan.d.ts +0 -8
- package/dist/node/packages.d.ts +0 -27
- package/dist/node/plugin.d.ts +0 -130
- package/dist/node/plugins/asset.d.ts +0 -68
- package/dist/node/plugins/assetImportMetaUrl.d.ts +0 -13
- package/dist/node/plugins/clientInjections.d.ts +0 -7
- package/dist/node/plugins/css.d.ts +0 -86
- package/dist/node/plugins/dataUri.d.ts +0 -5
- package/dist/node/plugins/define.d.ts +0 -3
- package/dist/node/plugins/dynamicImportVars.d.ts +0 -9
- package/dist/node/plugins/ensureWatch.d.ts +0 -5
- package/dist/node/plugins/esbuild.d.ts +0 -15
- package/dist/node/plugins/html.d.ts +0 -120
- package/dist/node/plugins/importAnalysis.d.ts +0 -47
- package/dist/node/plugins/importAnalysisBuild.d.ts +0 -16
- package/dist/node/plugins/importMetaGlob.d.ts +0 -34
- package/dist/node/plugins/index.d.ts +0 -3
- package/dist/node/plugins/json.d.ts +0 -23
- package/dist/node/plugins/loadFallback.d.ts +0 -5
- package/dist/node/plugins/manifest.d.ts +0 -14
- package/dist/node/plugins/metadata.d.ts +0 -9
- package/dist/node/plugins/modulePreloadPolyfill.d.ts +0 -4
- package/dist/node/plugins/optimizedDeps.d.ts +0 -7
- package/dist/node/plugins/preAlias.d.ts +0 -6
- package/dist/node/plugins/reporter.d.ts +0 -3
- package/dist/node/plugins/resolve.d.ts +0 -41
- package/dist/node/plugins/splitVendorChunk.d.ts +0 -12
- package/dist/node/plugins/ssrRequireHook.d.ts +0 -12
- package/dist/node/plugins/terser.d.ts +0 -3
- package/dist/node/plugins/wasm.d.ts +0 -4
- package/dist/node/plugins/worker.d.ts +0 -9
- package/dist/node/plugins/workerImportMetaUrl.d.ts +0 -3
- package/dist/node/preview.d.ts +0 -33
- package/dist/node/publicUtils.d.ts +0 -11
- package/dist/node/server/hmr.d.ts +0 -39
- package/dist/node/server/index.d.ts +0 -189
- package/dist/node/server/middlewares/base.d.ts +0 -3
- package/dist/node/server/middlewares/compression.d.ts +0 -1
- package/dist/node/server/middlewares/error.d.ts +0 -8
- package/dist/node/server/middlewares/indexHtml.d.ts +0 -4
- package/dist/node/server/middlewares/proxy.d.ts +0 -20
- package/dist/node/server/middlewares/spaFallback.d.ts +0 -2
- package/dist/node/server/middlewares/static.d.ts +0 -6
- package/dist/node/server/middlewares/time.d.ts +0 -2
- package/dist/node/server/middlewares/transform.d.ts +0 -3
- package/dist/node/server/moduleGraph.d.ts +0 -55
- package/dist/node/server/openBrowser.d.ts +0 -15
- package/dist/node/server/pluginContainer.d.ts +0 -41
- package/dist/node/server/searchRoot.d.ts +0 -8
- package/dist/node/server/send.d.ts +0 -10
- package/dist/node/server/sourcemap.d.ts +0 -11
- package/dist/node/server/transformRequest.d.ts +0 -14
- package/dist/node/server/ws.d.ts +0 -55
- package/dist/node/ssr/ssrExternal.d.ts +0 -11
- package/dist/node/ssr/ssrManifestPlugin.d.ts +0 -3
- package/dist/node/ssr/ssrModuleLoader.d.ts +0 -7
- package/dist/node/ssr/ssrStacktrace.d.ts +0 -3
- package/dist/node/ssr/ssrTransform.d.ts +0 -14
- package/dist/node/utils.d.ts +0 -144
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { PartialResolvedId } from 'rollup';
|
|
2
|
-
import type { Plugin } from '../plugin';
|
|
3
|
-
import type { DepsOptimizer } from '../optimizer';
|
|
4
|
-
import type { SSROptions } from '..';
|
|
5
|
-
import type { PackageCache, PackageData } from '../packages';
|
|
6
|
-
export declare const browserExternalId = "__vite-browser-external";
|
|
7
|
-
export interface ResolveOptions {
|
|
8
|
-
mainFields?: string[];
|
|
9
|
-
conditions?: string[];
|
|
10
|
-
extensions?: string[];
|
|
11
|
-
dedupe?: string[];
|
|
12
|
-
preserveSymlinks?: boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface InternalResolveOptions extends ResolveOptions {
|
|
15
|
-
root: string;
|
|
16
|
-
isBuild: boolean;
|
|
17
|
-
isProduction: boolean;
|
|
18
|
-
ssrConfig?: SSROptions;
|
|
19
|
-
packageCache?: PackageCache;
|
|
20
|
-
/**
|
|
21
|
-
* src code mode also attempts the following:
|
|
22
|
-
* - resolving /xxx as URLs
|
|
23
|
-
* - resolving bare imports from optimized deps
|
|
24
|
-
*/
|
|
25
|
-
asSrc?: boolean;
|
|
26
|
-
tryIndex?: boolean;
|
|
27
|
-
tryPrefix?: string;
|
|
28
|
-
skipPackageJson?: boolean;
|
|
29
|
-
preferRelative?: boolean;
|
|
30
|
-
preserveSymlinks?: boolean;
|
|
31
|
-
isRequire?: boolean;
|
|
32
|
-
isFromTsImporter?: boolean;
|
|
33
|
-
tryEsmOnly?: boolean;
|
|
34
|
-
scan?: boolean;
|
|
35
|
-
getDepsOptimizer?: () => DepsOptimizer | undefined;
|
|
36
|
-
}
|
|
37
|
-
export declare function resolvePlugin(baseOptions: InternalResolveOptions): Plugin;
|
|
38
|
-
export declare const idToPkgMap: Map<string, PackageData>;
|
|
39
|
-
export declare function tryNodeResolve(id: string, importer: string | null | undefined, options: InternalResolveOptions, targetWeb: boolean, depsOptimizer?: DepsOptimizer, ssr?: boolean): PartialResolvedId | undefined;
|
|
40
|
-
export declare function tryOptimizedResolve(depsOptimizer: DepsOptimizer, id: string, importer?: string): Promise<string | undefined>;
|
|
41
|
-
export declare function resolvePackageEntry(id: string, { dir, data, setResolvedCache, getResolvedCache }: PackageData, targetWeb: boolean, options: InternalResolveOptions): string | undefined;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { GetManualChunk } from 'rollup';
|
|
2
|
-
import type { Plugin } from '../plugin';
|
|
3
|
-
export declare const isCSSRequest: (request: string) => boolean;
|
|
4
|
-
export declare class SplitVendorChunkCache {
|
|
5
|
-
cache: Map<string, boolean>;
|
|
6
|
-
constructor();
|
|
7
|
-
reset(): void;
|
|
8
|
-
}
|
|
9
|
-
export declare function splitVendorChunk(options?: {
|
|
10
|
-
cache?: SplitVendorChunkCache;
|
|
11
|
-
}): GetManualChunk;
|
|
12
|
-
export declare function splitVendorChunkPlugin(): Plugin;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { ResolvedConfig } from '..';
|
|
3
|
-
import type { Plugin } from '../plugin';
|
|
4
|
-
/**
|
|
5
|
-
* This plugin hooks into Node's module resolution algorithm at runtime,
|
|
6
|
-
* so that SSR builds can benefit from `resolve.dedupe` like they do
|
|
7
|
-
* in development.
|
|
8
|
-
*/
|
|
9
|
-
export declare function ssrRequireHookPlugin(config: ResolvedConfig): Plugin | null;
|
|
10
|
-
declare type NodeResolveFilename = (request: string, parent: NodeModule, isMain: boolean, options?: Record<string, any>) => string;
|
|
11
|
-
export declare function hookNodeResolve(getResolver: (resolveFilename: NodeResolveFilename) => NodeResolveFilename): () => void;
|
|
12
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { OutputChunk } from 'rollup';
|
|
2
|
-
import type { ResolvedConfig } from '../config';
|
|
3
|
-
import type { Plugin } from '../plugin';
|
|
4
|
-
export declare type WorkerType = 'classic' | 'module' | 'ignore';
|
|
5
|
-
export declare const WORKER_FILE_ID = "worker_file";
|
|
6
|
-
export declare function bundleWorkerEntry(config: ResolvedConfig, id: string, query: Record<string, string> | null): Promise<OutputChunk>;
|
|
7
|
-
export declare const workerAssetUrlRE: RegExp;
|
|
8
|
-
export declare function workerFileToUrl(config: ResolvedConfig, id: string, query: Record<string, string> | null): Promise<string>;
|
|
9
|
-
export declare function webWorkerPlugin(config: ResolvedConfig): Plugin;
|
package/dist/node/preview.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type * as http from 'http';
|
|
3
|
-
import type { Connect } from 'types/connect';
|
|
4
|
-
import type { ResolvedServerOptions } from './server';
|
|
5
|
-
import type { CommonServerOptions } from './http';
|
|
6
|
-
import type { InlineConfig, ResolvedConfig } from '.';
|
|
7
|
-
export interface PreviewOptions extends CommonServerOptions {
|
|
8
|
-
}
|
|
9
|
-
export interface ResolvedPreviewOptions extends PreviewOptions {
|
|
10
|
-
}
|
|
11
|
-
export declare function resolvePreviewOptions(preview: PreviewOptions | undefined, server: ResolvedServerOptions): ResolvedPreviewOptions;
|
|
12
|
-
export interface PreviewServer {
|
|
13
|
-
/**
|
|
14
|
-
* The resolved vite config object
|
|
15
|
-
*/
|
|
16
|
-
config: ResolvedConfig;
|
|
17
|
-
/**
|
|
18
|
-
* native Node http server instance
|
|
19
|
-
*/
|
|
20
|
-
httpServer: http.Server;
|
|
21
|
-
/**
|
|
22
|
-
* Print server urls
|
|
23
|
-
*/
|
|
24
|
-
printUrls: () => void;
|
|
25
|
-
}
|
|
26
|
-
export declare type PreviewServerHook = (server: {
|
|
27
|
-
middlewares: Connect.Server;
|
|
28
|
-
httpServer: http.Server;
|
|
29
|
-
}) => (() => void) | void | Promise<(() => void) | void>;
|
|
30
|
-
/**
|
|
31
|
-
* Starts the Vite server in preview mode, to simulate a production deployment
|
|
32
|
-
*/
|
|
33
|
-
export declare function preview(inlineConfig?: InlineConfig): Promise<PreviewServer>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Exported sync utils should go here.
|
|
3
|
-
* This file will be bundled to ESM and CJS and redirected by ../index.cjs
|
|
4
|
-
* Please control the side-effects by checking the ./dist/node-cjs/publicUtils.cjs bundle
|
|
5
|
-
*/
|
|
6
|
-
export { splitVendorChunkPlugin, splitVendorChunk } from './plugins/splitVendorChunk';
|
|
7
|
-
export { normalizePath, mergeConfig, mergeAlias } from './utils';
|
|
8
|
-
export { send } from './server/send';
|
|
9
|
-
export { createLogger } from './logger';
|
|
10
|
-
export { searchForWorkspaceRoot } from './server/searchRoot';
|
|
11
|
-
export { loadEnv, resolveEnvPrefix } from './env';
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { Server } from 'http';
|
|
3
|
-
import type { ViteDevServer } from '..';
|
|
4
|
-
import type { ModuleNode } from './moduleGraph';
|
|
5
|
-
export declare const debugHmr: (...args: any[]) => any;
|
|
6
|
-
export interface HmrOptions {
|
|
7
|
-
protocol?: string;
|
|
8
|
-
host?: string;
|
|
9
|
-
port?: number;
|
|
10
|
-
clientPort?: number;
|
|
11
|
-
path?: string;
|
|
12
|
-
timeout?: number;
|
|
13
|
-
overlay?: boolean;
|
|
14
|
-
server?: Server;
|
|
15
|
-
}
|
|
16
|
-
export interface HmrContext {
|
|
17
|
-
file: string;
|
|
18
|
-
timestamp: number;
|
|
19
|
-
modules: Array<ModuleNode>;
|
|
20
|
-
read: () => string | Promise<string>;
|
|
21
|
-
server: ViteDevServer;
|
|
22
|
-
}
|
|
23
|
-
export declare function getShortName(file: string, root: string): string;
|
|
24
|
-
export declare function handleHMRUpdate(file: string, server: ViteDevServer): Promise<any>;
|
|
25
|
-
export declare function updateModules(file: string, modules: ModuleNode[], timestamp: number, { config, ws }: ViteDevServer): void;
|
|
26
|
-
export declare function handleFileAddUnlink(file: string, server: ViteDevServer): Promise<void>;
|
|
27
|
-
export declare function handlePrunedModules(mods: Set<ModuleNode>, { ws }: ViteDevServer): void;
|
|
28
|
-
/**
|
|
29
|
-
* Lex import.meta.hot.accept() for accepted deps.
|
|
30
|
-
* Since hot.accept() can only accept string literals or array of string
|
|
31
|
-
* literals, we don't really need a heavy @babel/parse call on the entire source.
|
|
32
|
-
*
|
|
33
|
-
* @returns selfAccepts
|
|
34
|
-
*/
|
|
35
|
-
export declare function lexAcceptedHmrDeps(code: string, start: number, urls: Set<{
|
|
36
|
-
url: string;
|
|
37
|
-
start: number;
|
|
38
|
-
end: number;
|
|
39
|
-
}>): boolean;
|
|
@@ -1,189 +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 { Logger } from '../logger';
|
|
9
|
-
import type { PluginContainer } from './pluginContainer';
|
|
10
|
-
import type { WebSocketServer } from './ws';
|
|
11
|
-
import { ModuleGraph } from './moduleGraph';
|
|
12
|
-
import type { HmrOptions } from './hmr';
|
|
13
|
-
import type { TransformOptions, TransformResult } from './transformRequest';
|
|
14
|
-
export { searchForWorkspaceRoot } from './searchRoot';
|
|
15
|
-
export interface ServerOptions extends CommonServerOptions {
|
|
16
|
-
/**
|
|
17
|
-
* Configure HMR-specific options (port, host, path & protocol)
|
|
18
|
-
*/
|
|
19
|
-
hmr?: HmrOptions | boolean;
|
|
20
|
-
/**
|
|
21
|
-
* chokidar watch options
|
|
22
|
-
* https://github.com/paulmillr/chokidar#api
|
|
23
|
-
*/
|
|
24
|
-
watch?: WatchOptions;
|
|
25
|
-
/**
|
|
26
|
-
* Create Vite dev server to be used as a middleware in an existing server
|
|
27
|
-
*/
|
|
28
|
-
middlewareMode?: boolean | 'html' | 'ssr';
|
|
29
|
-
/**
|
|
30
|
-
* Prepend this folder to http requests, for use when proxying vite as a subfolder
|
|
31
|
-
* Should start and end with the `/` character
|
|
32
|
-
*/
|
|
33
|
-
base?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Options for files served via '/\@fs/'.
|
|
36
|
-
*/
|
|
37
|
-
fs?: FileSystemServeOptions;
|
|
38
|
-
/**
|
|
39
|
-
* Origin for the generated asset URLs.
|
|
40
|
-
*
|
|
41
|
-
* @example `http://127.0.0.1:8080`
|
|
42
|
-
*/
|
|
43
|
-
origin?: string;
|
|
44
|
-
/**
|
|
45
|
-
* Pre-transform known direct imports
|
|
46
|
-
* @default true
|
|
47
|
-
*/
|
|
48
|
-
preTransformRequests?: boolean;
|
|
49
|
-
}
|
|
50
|
-
export interface ResolvedServerOptions extends ServerOptions {
|
|
51
|
-
fs: Required<FileSystemServeOptions>;
|
|
52
|
-
}
|
|
53
|
-
export interface FileSystemServeOptions {
|
|
54
|
-
/**
|
|
55
|
-
* Strictly restrict file accessing outside of allowing paths.
|
|
56
|
-
*
|
|
57
|
-
* Set to `false` to disable the warning
|
|
58
|
-
*
|
|
59
|
-
* @default true
|
|
60
|
-
*/
|
|
61
|
-
strict?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Restrict accessing files outside the allowed directories.
|
|
64
|
-
*
|
|
65
|
-
* Accepts absolute path or a path relative to project root.
|
|
66
|
-
* Will try to search up for workspace root by default.
|
|
67
|
-
*/
|
|
68
|
-
allow?: string[];
|
|
69
|
-
/**
|
|
70
|
-
* Restrict accessing files that matches the patterns.
|
|
71
|
-
*
|
|
72
|
-
* This will have higher priority than `allow`.
|
|
73
|
-
* Glob patterns are supported.
|
|
74
|
-
*
|
|
75
|
-
* @default ['.env', '.env.*', '*.crt', '*.pem']
|
|
76
|
-
*/
|
|
77
|
-
deny?: string[];
|
|
78
|
-
}
|
|
79
|
-
export declare type ServerHook = (server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
|
|
80
|
-
export interface ViteDevServer {
|
|
81
|
-
/**
|
|
82
|
-
* The resolved vite config object
|
|
83
|
-
*/
|
|
84
|
-
config: ResolvedConfig;
|
|
85
|
-
/**
|
|
86
|
-
* A connect app instance.
|
|
87
|
-
* - Can be used to attach custom middlewares to the dev server.
|
|
88
|
-
* - Can also be used as the handler function of a custom http server
|
|
89
|
-
* or as a middleware in any connect-style Node.js frameworks
|
|
90
|
-
*
|
|
91
|
-
* https://github.com/senchalabs/connect#use-middleware
|
|
92
|
-
*/
|
|
93
|
-
middlewares: Connect.Server;
|
|
94
|
-
/**
|
|
95
|
-
* native Node http server instance
|
|
96
|
-
* will be null in middleware mode
|
|
97
|
-
*/
|
|
98
|
-
httpServer: http.Server | null;
|
|
99
|
-
/**
|
|
100
|
-
* chokidar watcher instance
|
|
101
|
-
* https://github.com/paulmillr/chokidar#api
|
|
102
|
-
*/
|
|
103
|
-
watcher: FSWatcher;
|
|
104
|
-
/**
|
|
105
|
-
* web socket server with `send(payload)` method
|
|
106
|
-
*/
|
|
107
|
-
ws: WebSocketServer;
|
|
108
|
-
/**
|
|
109
|
-
* Rollup plugin container that can run plugin hooks on a given file
|
|
110
|
-
*/
|
|
111
|
-
pluginContainer: PluginContainer;
|
|
112
|
-
/**
|
|
113
|
-
* Module graph that tracks the import relationships, url to file mapping
|
|
114
|
-
* and hmr state.
|
|
115
|
-
*/
|
|
116
|
-
moduleGraph: ModuleGraph;
|
|
117
|
-
/**
|
|
118
|
-
* Programmatically resolve, load and transform a URL and get the result
|
|
119
|
-
* without going through the http request pipeline.
|
|
120
|
-
*/
|
|
121
|
-
transformRequest(url: string, options?: TransformOptions): Promise<TransformResult | null>;
|
|
122
|
-
/**
|
|
123
|
-
* Apply vite built-in HTML transforms and any plugin HTML transforms.
|
|
124
|
-
*/
|
|
125
|
-
transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>;
|
|
126
|
-
/**
|
|
127
|
-
* Transform module code into SSR format.
|
|
128
|
-
*/
|
|
129
|
-
ssrTransform(code: string, inMap: SourceMap | null, url: string): Promise<TransformResult | null>;
|
|
130
|
-
/**
|
|
131
|
-
* Load a given URL as an instantiated module for SSR.
|
|
132
|
-
*/
|
|
133
|
-
ssrLoadModule(url: string, opts?: {
|
|
134
|
-
fixStacktrace?: boolean;
|
|
135
|
-
}): Promise<Record<string, any>>;
|
|
136
|
-
/**
|
|
137
|
-
* Returns a fixed version of the given stack
|
|
138
|
-
*/
|
|
139
|
-
ssrRewriteStacktrace(stack: string): string;
|
|
140
|
-
/**
|
|
141
|
-
* Mutates the given SSR error by rewriting the stacktrace
|
|
142
|
-
*/
|
|
143
|
-
ssrFixStacktrace(e: Error): void;
|
|
144
|
-
/**
|
|
145
|
-
* Start the server.
|
|
146
|
-
*/
|
|
147
|
-
listen(port?: number, isRestart?: boolean): Promise<ViteDevServer>;
|
|
148
|
-
/**
|
|
149
|
-
* Stop the server.
|
|
150
|
-
*/
|
|
151
|
-
close(): Promise<void>;
|
|
152
|
-
/**
|
|
153
|
-
* Print server urls
|
|
154
|
-
*/
|
|
155
|
-
printUrls(): void;
|
|
156
|
-
/**
|
|
157
|
-
* Restart the server.
|
|
158
|
-
*
|
|
159
|
-
* @param forceOptimize - force the optimizer to re-bundle, same as --force cli flag
|
|
160
|
-
*/
|
|
161
|
-
restart(forceOptimize?: boolean): Promise<void>;
|
|
162
|
-
/**
|
|
163
|
-
* @internal
|
|
164
|
-
*/
|
|
165
|
-
_importGlobMap: Map<string, string[][]>;
|
|
166
|
-
/**
|
|
167
|
-
* Deps that are externalized
|
|
168
|
-
* @internal
|
|
169
|
-
*/
|
|
170
|
-
_ssrExternals: string[] | null;
|
|
171
|
-
/**
|
|
172
|
-
* @internal
|
|
173
|
-
*/
|
|
174
|
-
_restartPromise: Promise<void> | null;
|
|
175
|
-
/**
|
|
176
|
-
* @internal
|
|
177
|
-
*/
|
|
178
|
-
_forceOptimizeOnRestart: boolean;
|
|
179
|
-
/**
|
|
180
|
-
* @internal
|
|
181
|
-
*/
|
|
182
|
-
_pendingRequests: Map<string, {
|
|
183
|
-
request: Promise<TransformResult | null>;
|
|
184
|
-
timestamp: number;
|
|
185
|
-
abort: () => void;
|
|
186
|
-
}>;
|
|
187
|
-
}
|
|
188
|
-
export declare function createServer(inlineConfig?: InlineConfig): Promise<ViteDevServer>;
|
|
189
|
-
export declare function resolveServerOptions(root: string, raw: ServerOptions | undefined, logger: Logger): ResolvedServerOptions;
|
|
@@ -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,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,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>;
|
package/dist/node/server/ws.d.ts
DELETED
|
@@ -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;
|