vite 2.7.12 → 2.8.0-beta.3

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.

Potentially problematic release.


This version of vite might be problematic. Click here for more details.

Files changed (83) hide show
  1. package/CHANGELOG.md +2738 -0
  2. package/LICENSE.md +16 -778
  3. package/bin/vite.js +3 -1
  4. package/client.d.ts +4 -0
  5. package/dist/node/chunks/{dep-2d8e2cb1.js → dep-0ebab0df.js} +1 -2
  6. package/dist/node/chunks/{dep-ac1b4bf9.js → dep-2056ae8a.js} +20 -4
  7. package/dist/node/chunks/{dep-d7204208.js → dep-6f0b746c.js} +1 -2
  8. package/dist/node/chunks/{dep-73d734ac.js → dep-84e12b4e.js} +470 -4367
  9. package/dist/node/chunks/{dep-374a3cfd.js → dep-885d4c21.js} +12139 -21842
  10. package/dist/node/chunks/{dep-0351185a.js → dep-a5ab6d86.js} +49117 -52190
  11. package/dist/node/cli.js +13 -13
  12. package/dist/node/index.d.ts +46 -8
  13. package/dist/node/index.js +2 -3
  14. package/package.json +14 -12
  15. package/types/importMeta.d.ts +17 -2
  16. package/dist/node/build.d.ts +0 -200
  17. package/dist/node/chunks/dep-0351185a.js.map +0 -1
  18. package/dist/node/chunks/dep-2d8e2cb1.js.map +0 -1
  19. package/dist/node/chunks/dep-374a3cfd.js.map +0 -1
  20. package/dist/node/chunks/dep-73d734ac.js.map +0 -1
  21. package/dist/node/chunks/dep-ac1b4bf9.js.map +0 -1
  22. package/dist/node/chunks/dep-d7204208.js.map +0 -1
  23. package/dist/node/cli.d.ts +0 -1
  24. package/dist/node/cli.js.map +0 -1
  25. package/dist/node/config.d.ts +0 -202
  26. package/dist/node/constants.d.ts +0 -33
  27. package/dist/node/http.d.ts +0 -84
  28. package/dist/node/importGlob.d.ts +0 -9
  29. package/dist/node/index.js.map +0 -1
  30. package/dist/node/logger.d.ts +0 -35
  31. package/dist/node/optimizer/esbuildDepPlugin.d.ts +0 -4
  32. package/dist/node/optimizer/index.d.ts +0 -66
  33. package/dist/node/optimizer/registerMissing.d.ts +0 -2
  34. package/dist/node/optimizer/scan.d.ts +0 -9
  35. package/dist/node/packages.d.ts +0 -25
  36. package/dist/node/plugin.d.ts +0 -115
  37. package/dist/node/plugins/asset.d.ts +0 -40
  38. package/dist/node/plugins/assetImportMetaUrl.d.ts +0 -13
  39. package/dist/node/plugins/clientInjections.d.ts +0 -7
  40. package/dist/node/plugins/css.d.ts +0 -70
  41. package/dist/node/plugins/dataUri.d.ts +0 -5
  42. package/dist/node/plugins/define.d.ts +0 -3
  43. package/dist/node/plugins/esbuild.d.ts +0 -15
  44. package/dist/node/plugins/html.d.ts +0 -102
  45. package/dist/node/plugins/importAnalysis.d.ts +0 -46
  46. package/dist/node/plugins/importAnalysisBuild.d.ts +0 -15
  47. package/dist/node/plugins/index.d.ts +0 -3
  48. package/dist/node/plugins/json.d.ts +0 -22
  49. package/dist/node/plugins/loadFallback.d.ts +0 -5
  50. package/dist/node/plugins/manifest.d.ts +0 -14
  51. package/dist/node/plugins/modulePreloadPolyfill.d.ts +0 -4
  52. package/dist/node/plugins/preAlias.d.ts +0 -5
  53. package/dist/node/plugins/reporter.d.ts +0 -3
  54. package/dist/node/plugins/resolve.d.ts +0 -38
  55. package/dist/node/plugins/ssrRequireHook.d.ts +0 -12
  56. package/dist/node/plugins/terser.d.ts +0 -3
  57. package/dist/node/plugins/wasm.d.ts +0 -3
  58. package/dist/node/plugins/worker.d.ts +0 -3
  59. package/dist/node/preview.d.ts +0 -31
  60. package/dist/node/server/hmr.d.ts +0 -37
  61. package/dist/node/server/index.d.ts +0 -222
  62. package/dist/node/server/middlewares/base.d.ts +0 -3
  63. package/dist/node/server/middlewares/error.d.ts +0 -8
  64. package/dist/node/server/middlewares/indexHtml.d.ts +0 -4
  65. package/dist/node/server/middlewares/proxy.d.ts +0 -20
  66. package/dist/node/server/middlewares/spaFallback.d.ts +0 -2
  67. package/dist/node/server/middlewares/static.d.ts +0 -6
  68. package/dist/node/server/middlewares/time.d.ts +0 -2
  69. package/dist/node/server/middlewares/transform.d.ts +0 -3
  70. package/dist/node/server/moduleGraph.d.ts +0 -53
  71. package/dist/node/server/openBrowser.d.ts +0 -15
  72. package/dist/node/server/pluginContainer.d.ts +0 -37
  73. package/dist/node/server/searchRoot.d.ts +0 -8
  74. package/dist/node/server/send.d.ts +0 -4
  75. package/dist/node/server/sourcemap.d.ts +0 -8
  76. package/dist/node/server/transformRequest.d.ts +0 -14
  77. package/dist/node/server/ws.d.ts +0 -14
  78. package/dist/node/ssr/ssrExternal.d.ts +0 -7
  79. package/dist/node/ssr/ssrManifestPlugin.d.ts +0 -3
  80. package/dist/node/ssr/ssrModuleLoader.d.ts +0 -7
  81. package/dist/node/ssr/ssrStacktrace.d.ts +0 -3
  82. package/dist/node/ssr/ssrTransform.d.ts +0 -8
  83. package/dist/node/utils.d.ts +0 -114
@@ -1,222 +0,0 @@
1
- /// <reference types="node" />
2
- import type * as http from 'http';
3
- import type { CommonServerOptions } from '../http';
4
- import type { InlineConfig, ResolvedConfig } from '../config';
5
- import type { PluginContainer } from './pluginContainer';
6
- import type { FSWatcher, WatchOptions } from 'types/chokidar';
7
- import type { WebSocketServer } from './ws';
8
- import type { ModuleNode } from './moduleGraph';
9
- import { ModuleGraph } from './moduleGraph';
10
- import type { Connect } from 'types/connect';
11
- import type { HmrOptions } from './hmr';
12
- import type { TransformOptions, TransformResult } from './transformRequest';
13
- import type { ESBuildTransformResult } from '../plugins/esbuild';
14
- import type { TransformOptions as EsbuildTransformOptions } from 'esbuild';
15
- import type { DepOptimizationMetadata } from '../optimizer';
16
- import type { SourceMap } from 'rollup';
17
- export { searchForWorkspaceRoot } from './searchRoot';
18
- export interface ServerOptions extends CommonServerOptions {
19
- /**
20
- * Force dep pre-optimization regardless of whether deps have changed.
21
- */
22
- force?: boolean;
23
- /**
24
- * Configure HMR-specific options (port, host, path & protocol)
25
- */
26
- hmr?: HmrOptions | boolean;
27
- /**
28
- * chokidar watch options
29
- * https://github.com/paulmillr/chokidar#api
30
- */
31
- watch?: WatchOptions;
32
- /**
33
- * Create Vite dev server to be used as a middleware in an existing server
34
- */
35
- middlewareMode?: boolean | 'html' | 'ssr';
36
- /**
37
- * Prepend this folder to http requests, for use when proxying vite as a subfolder
38
- * Should start and end with the `/` character
39
- */
40
- base?: string;
41
- /**
42
- * Options for files served via '/\@fs/'.
43
- */
44
- fs?: FileSystemServeOptions;
45
- /**
46
- * Origin for the generated asset URLs.
47
- */
48
- origin?: string;
49
- /**
50
- * Pre-transform known direct imports
51
- *
52
- * @expiremental this options is expiremental and might be changed in the future
53
- * @default true
54
- */
55
- preTransformRequests?: boolean;
56
- }
57
- export interface ResolvedServerOptions extends ServerOptions {
58
- fs: Required<FileSystemServeOptions>;
59
- }
60
- export interface FileSystemServeOptions {
61
- /**
62
- * Strictly restrict file accessing outside of allowing paths.
63
- *
64
- * Set to `false` to disable the warning
65
- *
66
- * @default true
67
- */
68
- strict?: boolean;
69
- /**
70
- * Restrict accessing files outside the allowed directories.
71
- *
72
- * Accepts absolute path or a path relative to project root.
73
- * Will try to search up for workspace root by default.
74
- */
75
- allow?: string[];
76
- /**
77
- * Restrict accessing files that matches the patterns.
78
- *
79
- * This will have higher priority than `allow`.
80
- * Glob patterns are supported.
81
- *
82
- * @default ['.env', '.env.*', '*.crt', '*.pem']
83
- *
84
- * @experimental
85
- */
86
- deny?: string[];
87
- }
88
- export declare type ServerHook = (server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
89
- export interface ViteDevServer {
90
- /**
91
- * The resolved vite config object
92
- */
93
- config: ResolvedConfig;
94
- /**
95
- * A connect app instance.
96
- * - Can be used to attach custom middlewares to the dev server.
97
- * - Can also be used as the handler function of a custom http server
98
- * or as a middleware in any connect-style Node.js frameworks
99
- *
100
- * https://github.com/senchalabs/connect#use-middleware
101
- */
102
- middlewares: Connect.Server;
103
- /**
104
- * @deprecated use `server.middlewares` instead
105
- */
106
- app: Connect.Server;
107
- /**
108
- * native Node http server instance
109
- * will be null in middleware mode
110
- */
111
- httpServer: http.Server | null;
112
- /**
113
- * chokidar watcher instance
114
- * https://github.com/paulmillr/chokidar#api
115
- */
116
- watcher: FSWatcher;
117
- /**
118
- * web socket server with `send(payload)` method
119
- */
120
- ws: WebSocketServer;
121
- /**
122
- * Rollup plugin container that can run plugin hooks on a given file
123
- */
124
- pluginContainer: PluginContainer;
125
- /**
126
- * Module graph that tracks the import relationships, url to file mapping
127
- * and hmr state.
128
- */
129
- moduleGraph: ModuleGraph;
130
- /**
131
- * Programmatically resolve, load and transform a URL and get the result
132
- * without going through the http request pipeline.
133
- */
134
- transformRequest(url: string, options?: TransformOptions): Promise<TransformResult | null>;
135
- /**
136
- * Apply vite built-in HTML transforms and any plugin HTML transforms.
137
- */
138
- transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>;
139
- /**
140
- * Util for transforming a file with esbuild.
141
- * Can be useful for certain plugins.
142
- *
143
- * @deprecated import `transformWithEsbuild` from `vite` instead
144
- */
145
- transformWithEsbuild(code: string, filename: string, options?: EsbuildTransformOptions, inMap?: object): Promise<ESBuildTransformResult>;
146
- /**
147
- * Transform module code into SSR format.
148
- * @experimental
149
- */
150
- ssrTransform(code: string, inMap: SourceMap | null, url: string): Promise<TransformResult | null>;
151
- /**
152
- * Load a given URL as an instantiated module for SSR.
153
- */
154
- ssrLoadModule(url: string): Promise<Record<string, any>>;
155
- /**
156
- * Fix ssr error stacktrace
157
- */
158
- ssrFixStacktrace(e: Error): void;
159
- /**
160
- * Start the server.
161
- */
162
- listen(port?: number, isRestart?: boolean): Promise<ViteDevServer>;
163
- /**
164
- * Stop the server.
165
- */
166
- close(): Promise<void>;
167
- /**
168
- * Print server urls
169
- */
170
- printUrls(): void;
171
- /**
172
- * Restart the server.
173
- *
174
- * @param forceOptimize - force the optimizer to re-bundle, same as --force cli flag
175
- */
176
- restart(forceOptimize?: boolean): Promise<void>;
177
- /**
178
- * @internal
179
- */
180
- _optimizeDepsMetadata: DepOptimizationMetadata | null;
181
- /**
182
- * Deps that are externalized
183
- * @internal
184
- */
185
- _ssrExternals: string[] | null;
186
- /**
187
- * @internal
188
- */
189
- _globImporters: Record<string, {
190
- module: ModuleNode;
191
- importGlobs: {
192
- base: string;
193
- pattern: string;
194
- }[];
195
- }>;
196
- /**
197
- * @internal
198
- */
199
- _restartPromise: Promise<void> | null;
200
- /**
201
- * @internal
202
- */
203
- _forceOptimizeOnRestart: boolean;
204
- /**
205
- * @internal
206
- */
207
- _isRunningOptimizer: boolean;
208
- /**
209
- * @internal
210
- */
211
- _registerMissingImport: ((id: string, resolved: string, ssr: boolean | undefined) => void) | null;
212
- /**
213
- * @internal
214
- */
215
- _pendingReload: Promise<void> | null;
216
- /**
217
- * @internal
218
- */
219
- _pendingRequests: Map<string, Promise<TransformResult | null>>;
220
- }
221
- export declare function createServer(inlineConfig?: InlineConfig): Promise<ViteDevServer>;
222
- export declare function resolveServerOptions(root: string, raw?: ServerOptions): ResolvedServerOptions;
@@ -1,3 +0,0 @@
1
- import type { ViteDevServer } from '..';
2
- import type { Connect } from 'types/connect';
3
- export declare function baseMiddleware({ config }: ViteDevServer): Connect.NextHandleFunction;
@@ -1,8 +0,0 @@
1
- import type { RollupError } from 'rollup';
2
- import type { ViteDevServer } from '../..';
3
- import type { Connect } from 'types/connect';
4
- import type { ErrorPayload } from 'types/hmrPayload';
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 { 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, 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 { ViteDevServer } from '..';
2
- import type { Connect } from 'types/connect';
3
- export declare function transformMiddleware(server: ViteDevServer): Connect.NextHandleFunction;
@@ -1,53 +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
- lastHMRTimestamp: number;
24
- constructor(url: string);
25
- }
26
- export declare type ResolvedUrl = [
27
- url: string,
28
- resolvedId: string,
29
- meta: object | null | undefined
30
- ];
31
- export declare class ModuleGraph {
32
- private resolveId;
33
- urlToModuleMap: Map<string, ModuleNode>;
34
- idToModuleMap: Map<string, ModuleNode>;
35
- fileToModulesMap: Map<string, Set<ModuleNode>>;
36
- safeModulesPath: Set<string>;
37
- constructor(resolveId: (url: string) => Promise<PartialResolvedId | null>);
38
- getModuleByUrl(rawUrl: string): Promise<ModuleNode | undefined>;
39
- getModuleById(id: string): ModuleNode | undefined;
40
- getModulesByFile(file: string): Set<ModuleNode> | undefined;
41
- onFileChange(file: string): void;
42
- invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>): void;
43
- invalidateAll(): void;
44
- /**
45
- * Update the module graph based on a module's updated imports information
46
- * If there are dependencies that no longer have any importers, they are
47
- * returned as a Set.
48
- */
49
- updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, acceptedModules: Set<string | ModuleNode>, isSelfAccepting: boolean): Promise<Set<ModuleNode> | undefined>;
50
- ensureEntryFromUrl(rawUrl: string): Promise<ModuleNode>;
51
- createFileOnlyEntry(file: string): ModuleNode;
52
- resolveUrl(url: string): Promise<ResolvedUrl>;
53
- }
@@ -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,37 +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 { Plugin } from '../plugin';
6
- import type { InputOptions, OutputOptions, ModuleInfo, PartialResolvedId, LoadResult, SourceDescription } from 'rollup';
7
- import * as acorn from 'acorn';
8
- import type { FSWatcher } from 'chokidar';
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
- }): Promise<PartialResolvedId | null>;
27
- transform(code: string, id: string, options?: {
28
- inMap?: SourceDescription['map'];
29
- ssr?: boolean;
30
- }): Promise<SourceDescription | null>;
31
- load(id: string, options?: {
32
- ssr?: boolean;
33
- }): Promise<LoadResult | null>;
34
- close(): Promise<void>;
35
- }
36
- export declare let parser: typeof acorn.Parser;
37
- 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,4 +0,0 @@
1
- /// <reference types="node" />
2
- import type { IncomingMessage, ServerResponse } from 'http';
3
- import type { SourceMap } from 'rollup';
4
- export declare function send(req: IncomingMessage, res: ServerResponse, content: string | Buffer, type: string, etag?: string, cacheControl?: string, map?: SourceMap | null): void;
@@ -1,8 +0,0 @@
1
- import type { Logger } from '../logger';
2
- interface SourceMapLike {
3
- sources: string[];
4
- sourcesContent?: (string | null)[];
5
- sourceRoot?: string;
6
- }
7
- export declare function injectSourcesContent(map: SourceMapLike, file: string, logger: Logger): Promise<void>;
8
- 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,14 +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 { HMRPayload } from 'types/hmrPayload';
6
- import type { ResolvedConfig } from '..';
7
- export declare const HMR_HEADER = "vite-hmr";
8
- export interface WebSocketServer {
9
- on: WebSocketTypes.Server['on'];
10
- off: WebSocketTypes.Server['off'];
11
- send(payload: HMRPayload): void;
12
- close(): Promise<void>;
13
- }
14
- export declare function createWebSocketServer(server: Server | null, config: ResolvedConfig, httpsOptions?: HttpsServerOptions): WebSocketServer;
@@ -1,7 +0,0 @@
1
- import type { ResolvedConfig } from '..';
2
- /**
3
- * Heuristics for determining whether a dependency should be externalized for
4
- * server-side rendering.
5
- */
6
- export declare function resolveSSRExternal(config: ResolvedConfig, knownImports: string[]): string[];
7
- 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[]): 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,8 +0,0 @@
1
- import type { SourceMap } from 'rollup';
2
- import type { TransformResult } from '../server/transformRequest';
3
- export declare const ssrModuleExportsKey = "__vite_ssr_exports__";
4
- export declare const ssrImportKey = "__vite_ssr_import__";
5
- export declare const ssrDynamicImportKey = "__vite_ssr_dynamic_import__";
6
- export declare const ssrExportAllKey = "__vite_ssr_exportAll__";
7
- export declare const ssrImportMetaKey = "__vite_ssr_import_meta__";
8
- export declare function ssrTransform(code: string, inMap: SourceMap | null, url: string): Promise<TransformResult | null>;
@@ -1,114 +0,0 @@
1
- import debug from 'debug';
2
- import type { FSWatcher } from 'chokidar';
3
- import type { DecodedSourceMap, RawSourceMap } from '@ampproject/remapping/dist/types/types';
4
- export declare function slash(p: string): string;
5
- export declare function unwrapId(id: string): string;
6
- export declare const flattenId: (id: string) => string;
7
- export declare const normalizeId: (id: string) => string;
8
- export declare function isBuiltin(id: string): boolean;
9
- export declare function moduleListContains(moduleList: string[] | undefined, id: string): boolean | undefined;
10
- export declare const bareImportRE: RegExp;
11
- export declare const deepImportRE: RegExp;
12
- export declare let isRunningWithYarnPnp: boolean;
13
- export declare function resolveFrom(id: string, basedir: string, preserveSymlinks?: boolean, ssr?: boolean): string;
14
- /**
15
- * like `resolveFrom` but supports resolving `>` path in `id`,
16
- * for example: `foo > bar > baz`
17
- */
18
- export declare function nestedResolveFrom(id: string, basedir: string, preserveSymlinks?: boolean): string;
19
- interface DebuggerOptions {
20
- onlyWhenFocused?: boolean | string;
21
- }
22
- export declare type ViteDebugScope = `vite:${string}`;
23
- export declare function createDebugger(namespace: ViteDebugScope, options?: DebuggerOptions): debug.Debugger['log'];
24
- export declare const isWindows: boolean;
25
- export declare function normalizePath(id: string): string;
26
- export declare function fsPathFromId(id: string): string;
27
- export declare function ensureVolumeInPath(file: string): string;
28
- export declare const queryRE: RegExp;
29
- export declare const hashRE: RegExp;
30
- export declare const cleanUrl: (url: string) => string;
31
- export declare const externalRE: RegExp;
32
- export declare const isExternalUrl: (url: string) => boolean;
33
- export declare const dataUrlRE: RegExp;
34
- export declare const isDataUrl: (url: string) => boolean;
35
- export declare const virtualModuleRE: RegExp;
36
- export declare const virtualModulePrefix = "virtual-module:";
37
- export declare const isJSRequest: (url: string) => boolean;
38
- export declare const isTsRequest: (url: string) => boolean;
39
- export declare const isPossibleTsOutput: (url: string) => boolean;
40
- export declare const getTsSrcPath: (filename: string) => string;
41
- export declare const isImportRequest: (url: string) => boolean;
42
- export declare const isInternalRequest: (url: string) => boolean;
43
- export declare function removeImportQuery(url: string): string;
44
- export declare function injectQuery(url: string, queryToInject: string): string;
45
- export declare function removeTimestampQuery(url: string): string;
46
- export declare function asyncReplace(input: string, re: RegExp, replacer: (match: RegExpExecArray) => string | Promise<string>): Promise<string>;
47
- export declare function timeFrom(start: number, subtract?: number): string;
48
- /**
49
- * pretty url for logging.
50
- */
51
- export declare function prettifyUrl(url: string, root: string): string;
52
- export declare function isObject(value: unknown): value is Record<string, any>;
53
- export declare function isDefined<T>(value: T | undefined | null): value is T;
54
- export declare function lookupFile(dir: string, formats: string[], pathOnly?: boolean): string | undefined;
55
- export declare function pad(source: string, n?: number): string;
56
- export declare function posToNumber(source: string, pos: number | {
57
- line: number;
58
- column: number;
59
- }): number;
60
- export declare function numberToPos(source: string, offset: number | {
61
- line: number;
62
- column: number;
63
- }): {
64
- line: number;
65
- column: number;
66
- };
67
- export declare function generateCodeFrame(source: string, start?: number | {
68
- line: number;
69
- column: number;
70
- }, end?: number): string;
71
- export declare function writeFile(filename: string, content: string | Uint8Array): void;
72
- /**
73
- * Use instead of fs.existsSync(filename)
74
- * #2051 if we don't have read permission on a directory, existsSync() still
75
- * works and will result in massively slow subsequent checks (which are
76
- * unnecessary in the first place)
77
- */
78
- export declare function isFileReadable(filename: string): boolean;
79
- /**
80
- * Delete every file and subdirectory. **The given directory must exist.**
81
- * Pass an optional `skip` array to preserve files in the root directory.
82
- */
83
- export declare function emptyDir(dir: string, skip?: string[]): void;
84
- export declare function copyDir(srcDir: string, destDir: string): void;
85
- export declare function ensureLeadingSlash(path: string): string;
86
- export declare function ensureWatchedFile(watcher: FSWatcher, file: string | null, root: string): void;
87
- interface ImageCandidate {
88
- url: string;
89
- descriptor: string;
90
- }
91
- export declare function processSrcSet(srcs: string, replacer: (arg: ImageCandidate) => Promise<string>): Promise<string>;
92
- export declare function combineSourcemaps(filename: string, sourcemapList: Array<DecodedSourceMap | RawSourceMap>): RawSourceMap;
93
- export declare function unique<T>(arr: T[]): T[];
94
- export interface Hostname {
95
- host: string | undefined;
96
- name: string;
97
- }
98
- export declare function resolveHostname(optionsHost: string | boolean | undefined): Hostname;
99
- export declare function arraify<T>(target: T | T[]): T[];
100
- export declare function toUpperCaseDriveLetter(pathName: string): string;
101
- export declare const multilineCommentsRE: RegExp;
102
- export declare const singlelineCommentsRE: RegExp;
103
- export declare const usingDynamicImport: boolean;
104
- /**
105
- * Dynamically import files. It will make sure it's not being compiled away by TS/Rollup.
106
- *
107
- * As a temporary workaround for Jest's lack of stable ESM support, we fallback to require
108
- * if we're in a Jest environment.
109
- * See https://github.com/vitejs/vite/pull/5197#issuecomment-938054077
110
- *
111
- * @param file File path to import.
112
- */
113
- export declare const dynamicImport: Function;
114
- export {};