vite 2.6.6 → 2.6.10

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 (82) hide show
  1. package/dist/node/chunks/{dep-8fc3d0a8.js → dep-8e7741a0.js} +2 -2
  2. package/dist/node/chunks/{dep-8fc3d0a8.js.map → dep-8e7741a0.js.map} +1 -1
  3. package/dist/node/chunks/{dep-6a58f2f7.js → dep-9b6b378f.js} +2 -2
  4. package/dist/node/chunks/{dep-6a58f2f7.js.map → dep-9b6b378f.js.map} +1 -1
  5. package/dist/node/chunks/{dep-da8087f5.js → dep-b502d052.js} +2 -2
  6. package/dist/node/chunks/{dep-da8087f5.js.map → dep-b502d052.js.map} +1 -1
  7. package/dist/node/chunks/{dep-713b45e1.js → dep-be032392.js} +59 -27
  8. package/dist/node/chunks/dep-be032392.js.map +1 -0
  9. package/dist/node/cli.js +4 -4
  10. package/dist/node/index.d.ts +517 -2
  11. package/dist/node/index.js +1 -1
  12. package/package.json +6 -6
  13. package/types/ws.d.ts +532 -0
  14. package/CHANGELOG.md +0 -2265
  15. package/dist/client/client.d.ts +0 -17
  16. package/dist/client/env.d.ts +0 -4
  17. package/dist/client/overlay.d.ts +0 -8
  18. package/dist/node/build.d.ts +0 -191
  19. package/dist/node/chunks/dep-1ee92c88.js +0 -10031
  20. package/dist/node/chunks/dep-1ee92c88.js.map +0 -1
  21. package/dist/node/chunks/dep-51d7aa64.js +0 -10032
  22. package/dist/node/chunks/dep-51d7aa64.js.map +0 -1
  23. package/dist/node/chunks/dep-713b45e1.js.map +0 -1
  24. package/dist/node/chunks/dep-e5804462.js +0 -10032
  25. package/dist/node/chunks/dep-e5804462.js.map +0 -1
  26. package/dist/node/cli.d.ts +0 -1
  27. package/dist/node/config.d.ts +0 -193
  28. package/dist/node/constants.d.ts +0 -27
  29. package/dist/node/importGlob.d.ts +0 -9
  30. package/dist/node/logger.d.ts +0 -28
  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/plugin.d.ts +0 -110
  36. package/dist/node/plugins/asset.d.ts +0 -40
  37. package/dist/node/plugins/assetImportMetaUrl.d.ts +0 -13
  38. package/dist/node/plugins/clientInjections.d.ts +0 -7
  39. package/dist/node/plugins/css.d.ts +0 -68
  40. package/dist/node/plugins/dataUri.d.ts +0 -5
  41. package/dist/node/plugins/define.d.ts +0 -3
  42. package/dist/node/plugins/esbuild.d.ts +0 -15
  43. package/dist/node/plugins/html.d.ts +0 -74
  44. package/dist/node/plugins/importAnalysis.d.ts +0 -32
  45. package/dist/node/plugins/importAnalysisBuild.d.ts +0 -15
  46. package/dist/node/plugins/index.d.ts +0 -3
  47. package/dist/node/plugins/json.d.ts +0 -22
  48. package/dist/node/plugins/loadFallback.d.ts +0 -5
  49. package/dist/node/plugins/manifest.d.ts +0 -14
  50. package/dist/node/plugins/modulePreloadPolyfill.d.ts +0 -4
  51. package/dist/node/plugins/preAlias.d.ts +0 -5
  52. package/dist/node/plugins/reporter.d.ts +0 -3
  53. package/dist/node/plugins/resolve.d.ts +0 -51
  54. package/dist/node/plugins/terser.d.ts +0 -3
  55. package/dist/node/plugins/wasm.d.ts +0 -3
  56. package/dist/node/plugins/worker.d.ts +0 -3
  57. package/dist/node/preview.d.ts +0 -2
  58. package/dist/node/server/hmr.d.ts +0 -37
  59. package/dist/node/server/http.d.ts +0 -14
  60. package/dist/node/server/index.d.ts +0 -235
  61. package/dist/node/server/middlewares/base.d.ts +0 -3
  62. package/dist/node/server/middlewares/error.d.ts +0 -11
  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 -7
  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 -46
  70. package/dist/node/server/openBrowser.d.ts +0 -15
  71. package/dist/node/server/pluginContainer.d.ts +0 -27
  72. package/dist/node/server/searchRoot.d.ts +0 -8
  73. package/dist/node/server/send.d.ts +0 -4
  74. package/dist/node/server/sourcemap.d.ts +0 -8
  75. package/dist/node/server/transformRequest.d.ts +0 -14
  76. package/dist/node/server/ws.d.ts +0 -11
  77. package/dist/node/ssr/ssrExternal.d.ts +0 -10
  78. package/dist/node/ssr/ssrManifestPlugin.d.ts +0 -3
  79. package/dist/node/ssr/ssrModuleLoader.d.ts +0 -8
  80. package/dist/node/ssr/ssrStacktrace.d.ts +0 -3
  81. package/dist/node/ssr/ssrTransform.d.ts +0 -8
  82. package/dist/node/utils.d.ts +0 -90
@@ -1,74 +0,0 @@
1
- import { Plugin } from '../plugin';
2
- import { ViteDevServer } from '../server';
3
- import { OutputBundle, OutputChunk } from 'rollup';
4
- import { ResolvedConfig } from '../config';
5
- import { AttributeNode, NodeTransform, ElementNode } from '@vue/compiler-dom';
6
- export declare const isHTMLProxy: (id: string) => boolean;
7
- export declare function htmlInlineScriptProxyPlugin(): Plugin;
8
- export declare const assetAttrsConfig: Record<string, string[]>;
9
- export declare const isAsyncScriptMap: WeakMap<Readonly<Omit<import("../config").UserConfig, "plugins" | "alias" | "dedupe" | "assetsInclude" | "optimizeDeps"> & {
10
- configFile: string | undefined;
11
- configFileDependencies: string[];
12
- inlineConfig: import("../config").InlineConfig;
13
- root: string;
14
- base: string;
15
- publicDir: string;
16
- command: "build" | "serve";
17
- mode: string;
18
- isProduction: boolean;
19
- env: Record<string, any>;
20
- resolve: import("./resolve").ResolveOptions & {
21
- alias: import("types/alias").Alias[];
22
- };
23
- plugins: readonly Plugin[];
24
- server: import("../server").ResolvedServerOptions;
25
- build: Required<Omit<import("..").BuildOptions, "base" | "cleanCssOptions" | "polyfillDynamicImport" | "brotliSize">>;
26
- assetsInclude: (file: string) => boolean;
27
- logger: import("..").Logger;
28
- createResolver: (options?: Partial<import("./resolve").InternalResolveOptions> | undefined) => import("../config").ResolveFn;
29
- optimizeDeps: Omit<import("..").DepOptimizationOptions, "keepNames">;
30
- }>, Map<string, boolean>>;
31
- export declare function traverseHtml(html: string, filePath: string, visitor: NodeTransform): Promise<void>;
32
- export declare function getScriptInfo(node: ElementNode): {
33
- src: AttributeNode | undefined;
34
- isModule: boolean;
35
- isAsync: boolean;
36
- };
37
- /**
38
- * Compiles index.html into an entry js module
39
- */
40
- export declare function buildHtmlPlugin(config: ResolvedConfig): Plugin;
41
- export interface HtmlTagDescriptor {
42
- tag: string;
43
- attrs?: Record<string, string | boolean | undefined>;
44
- children?: string | HtmlTagDescriptor[];
45
- /**
46
- * default: 'head-prepend'
47
- */
48
- injectTo?: 'head' | 'body' | 'head-prepend' | 'body-prepend';
49
- }
50
- export declare type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
51
- html: string;
52
- tags: HtmlTagDescriptor[];
53
- };
54
- export interface IndexHtmlTransformContext {
55
- /**
56
- * public path when served
57
- */
58
- path: string;
59
- /**
60
- * filename on disk
61
- */
62
- filename: string;
63
- server?: ViteDevServer;
64
- bundle?: OutputBundle;
65
- chunk?: OutputChunk;
66
- originalUrl?: string;
67
- }
68
- export declare type IndexHtmlTransformHook = (html: string, ctx: IndexHtmlTransformContext) => IndexHtmlTransformResult | void | Promise<IndexHtmlTransformResult | void>;
69
- export declare type IndexHtmlTransform = IndexHtmlTransformHook | {
70
- enforce?: 'pre' | 'post';
71
- transform: IndexHtmlTransformHook;
72
- };
73
- export declare function resolveHtmlTransforms(plugins: readonly Plugin[]): [IndexHtmlTransformHook[], IndexHtmlTransformHook[]];
74
- export declare function applyHtmlTransforms(html: string, hooks: IndexHtmlTransformHook[], ctx: IndexHtmlTransformContext): Promise<string>;
@@ -1,32 +0,0 @@
1
- import { Plugin } from '../plugin';
2
- import { ResolvedConfig } from '../config';
3
- /**
4
- * Server-only plugin that lexes, resolves, rewrites and analyzes url imports.
5
- *
6
- * - Imports are resolved to ensure they exist on disk
7
- *
8
- * - Lexes HMR accept calls and updates import relationships in the module graph
9
- *
10
- * - Bare module imports are resolved (by @rollup-plugin/node-resolve) to
11
- * absolute file paths, e.g.
12
- *
13
- * ```js
14
- * import 'foo'
15
- * ```
16
- * is rewritten to
17
- * ```js
18
- * import '/@fs//project/node_modules/foo/dist/foo.js'
19
- * ```
20
- *
21
- * - CSS imports are appended with `.js` since both the js module and the actual
22
- * css (referenced via <link>) may go through the transform pipeline:
23
- *
24
- * ```js
25
- * import './style.css'
26
- * ```
27
- * is rewritten to
28
- * ```js
29
- * import './style.css.js'
30
- * ```
31
- */
32
- export declare function importAnalysisPlugin(config: ResolvedConfig): Plugin;
@@ -1,15 +0,0 @@
1
- import { ResolvedConfig } from '../config';
2
- import { Plugin } from '../plugin';
3
- /**
4
- * A flag for injected helpers. This flag will be set to `false` if the output
5
- * target is not native es - so that injected helper logic can be conditionally
6
- * dropped.
7
- */
8
- export declare const isModernFlag = "__VITE_IS_MODERN__";
9
- export declare const preloadMethod = "__vitePreload";
10
- export declare const preloadMarker = "__VITE_PRELOAD__";
11
- export declare const preloadBaseMarker = "__VITE_PRELOAD_BASE__";
12
- /**
13
- * Build only. During serve this is performed as part of ./importAnalysis.
14
- */
15
- export declare function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin;
@@ -1,3 +0,0 @@
1
- import { ResolvedConfig } from '../config';
2
- import { Plugin } from '../plugin';
3
- export declare function resolvePlugins(config: ResolvedConfig, prePlugins: Plugin[], normalPlugins: Plugin[], postPlugins: Plugin[]): Promise<Plugin[]>;
@@ -1,22 +0,0 @@
1
- /**
2
- * https://github.com/rollup/plugins/blob/master/packages/json/src/index.js
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file at
6
- * https://github.com/rollup/plugins/blob/master/LICENSE
7
- */
8
- import { Plugin } from 'rollup';
9
- export interface JsonOptions {
10
- /**
11
- * Generate a named export for every property of the JSON object
12
- * @default true
13
- */
14
- namedExports?: boolean;
15
- /**
16
- * Generate performant output as JSON.parse("stringified").
17
- * Enabling this will disable namedExports.
18
- * @default false
19
- */
20
- stringify?: boolean;
21
- }
22
- export declare function jsonPlugin(options: JsonOptions | undefined, isBuild: boolean): Plugin;
@@ -1,5 +0,0 @@
1
- import { Plugin } from '..';
2
- /**
3
- * A plugin to provide build load fallback for arbitrary request with queries.
4
- */
5
- export declare function loadFallbackPlugin(): Plugin;
@@ -1,14 +0,0 @@
1
- import { ResolvedConfig } from '..';
2
- import { Plugin } from '../plugin';
3
- export declare type Manifest = Record<string, ManifestChunk>;
4
- export interface ManifestChunk {
5
- src?: string;
6
- file: string;
7
- css?: string[];
8
- assets?: string[];
9
- isEntry?: boolean;
10
- isDynamicEntry?: boolean;
11
- imports?: string[];
12
- dynamicImports?: string[];
13
- }
14
- export declare function manifestPlugin(config: ResolvedConfig): Plugin;
@@ -1,4 +0,0 @@
1
- import { ResolvedConfig } from '..';
2
- import { Plugin } from '../plugin';
3
- export declare const modulePreloadPolyfillId = "vite/modulepreload-polyfill";
4
- export declare function modulePreloadPolyfillPlugin(config: ResolvedConfig): Plugin;
@@ -1,5 +0,0 @@
1
- import { Plugin } from '../plugin';
2
- /**
3
- * A plugin to avoid an aliased AND optimized dep from being aliased in src
4
- */
5
- export declare function preAliasPlugin(): Plugin;
@@ -1,3 +0,0 @@
1
- import { Plugin } from 'rollup';
2
- import { ResolvedConfig } from '../config';
3
- export declare function buildReporterPlugin(config: ResolvedConfig): Plugin;
@@ -1,51 +0,0 @@
1
- import { Plugin } from '../plugin';
2
- import { ViteDevServer, SSROptions } from '..';
3
- import { PartialResolvedId } from 'rollup';
4
- export declare const browserExternalId = "__vite-browser-external";
5
- export interface ResolveOptions {
6
- mainFields?: string[];
7
- conditions?: string[];
8
- extensions?: string[];
9
- dedupe?: string[];
10
- preserveSymlinks?: boolean;
11
- }
12
- export interface InternalResolveOptions extends ResolveOptions {
13
- root: string;
14
- isBuild: boolean;
15
- isProduction: boolean;
16
- ssrConfig?: SSROptions;
17
- /**
18
- * src code mode also attempts the following:
19
- * - resolving /xxx as URLs
20
- * - resolving bare imports from optimized deps
21
- */
22
- asSrc?: boolean;
23
- tryIndex?: boolean;
24
- tryPrefix?: string;
25
- skipPackageJson?: boolean;
26
- preferRelative?: boolean;
27
- isRequire?: boolean;
28
- }
29
- export declare function resolvePlugin(baseOptions: InternalResolveOptions): Plugin;
30
- export declare const idToPkgMap: Map<string, PackageData>;
31
- export declare function tryNodeResolve(id: string, importer: string | undefined, options: InternalResolveOptions, targetWeb: boolean, server?: ViteDevServer, ssr?: boolean): PartialResolvedId | undefined;
32
- export declare function tryOptimizedResolve(id: string, server: ViteDevServer, importer?: string): string | undefined;
33
- export interface PackageData {
34
- dir: string;
35
- hasSideEffects: (id: string) => boolean;
36
- webResolvedImports: Record<string, string | undefined>;
37
- nodeResolvedImports: Record<string, string | undefined>;
38
- setResolvedCache: (key: string, entry: string, targetWeb: boolean) => void;
39
- getResolvedCache: (key: string, targetWeb: boolean) => string | undefined;
40
- data: {
41
- [field: string]: any;
42
- version: string;
43
- main: string;
44
- module: string;
45
- browser: string | Record<string, string | false>;
46
- exports: string | Record<string, any> | string[];
47
- dependencies: Record<string, string>;
48
- };
49
- }
50
- export declare function resolvePackageData(id: string, basedir: string, preserveSymlinks?: boolean): PackageData | undefined;
51
- export declare function resolvePackageEntry(id: string, { dir, data, setResolvedCache, getResolvedCache }: PackageData, options: InternalResolveOptions, targetWeb: boolean, preserveSymlinks?: boolean): string | undefined;
@@ -1,3 +0,0 @@
1
- import { Plugin } from '../plugin';
2
- import { Terser } from 'types/terser';
3
- export declare function terserPlugin(options: Terser.MinifyOptions): Plugin;
@@ -1,3 +0,0 @@
1
- import { ResolvedConfig } from '../config';
2
- import { Plugin } from '../plugin';
3
- export declare const wasmPlugin: (config: ResolvedConfig) => Plugin;
@@ -1,3 +0,0 @@
1
- import { ResolvedConfig } from '../config';
2
- import { Plugin } from '../plugin';
3
- export declare function webWorkerPlugin(config: ResolvedConfig): Plugin;
@@ -1,2 +0,0 @@
1
- import { ResolvedConfig, ServerOptions } from '.';
2
- export declare function preview(config: ResolvedConfig, serverOptions: Pick<ServerOptions, 'port' | 'host'>): Promise<void>;
@@ -1,37 +0,0 @@
1
- /// <reference types="node" />
2
- import { ViteDevServer } from '..';
3
- import { ModuleNode } from './moduleGraph';
4
- import { Server } from 'http';
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 handleHMRUpdate(file: string, server: ViteDevServer): Promise<any>;
24
- export declare function handleFileAddUnlink(file: string, server: ViteDevServer, isUnlink?: boolean): Promise<void>;
25
- export declare function handlePrunedModules(mods: Set<ModuleNode>, { ws }: ViteDevServer): void;
26
- /**
27
- * Lex import.meta.hot.accept() for accepted deps.
28
- * Since hot.accept() can only accept string literals or array of string
29
- * literals, we don't really need a heavy @babel/parse call on the entire source.
30
- *
31
- * @returns selfAccepts
32
- */
33
- export declare function lexAcceptedHmrDeps(code: string, start: number, urls: Set<{
34
- url: string;
35
- start: number;
36
- end: number;
37
- }>): boolean;
@@ -1,14 +0,0 @@
1
- /// <reference types="node" />
2
- import { Server as HttpServer } from 'http';
3
- import { ServerOptions as HttpsServerOptions } from 'https';
4
- import { ResolvedConfig, ServerOptions } from '..';
5
- import { Connect } from 'types/connect';
6
- import { Logger } from '../logger';
7
- export declare function resolveHttpServer({ proxy }: ServerOptions, app: Connect.Server, httpsOptions?: HttpsServerOptions): Promise<HttpServer>;
8
- export declare function resolveHttpsConfig(config: ResolvedConfig): Promise<HttpsServerOptions | undefined>;
9
- export declare function httpServerStart(httpServer: HttpServer, serverOptions: {
10
- port: number;
11
- strictPort: boolean | undefined;
12
- host: string | undefined;
13
- logger: Logger;
14
- }): Promise<number>;
@@ -1,235 +0,0 @@
1
- /// <reference types="node" />
2
- import * as http from 'http';
3
- import * as https from 'https';
4
- import { InlineConfig, ResolvedConfig } from '../config';
5
- import { PluginContainer } from './pluginContainer';
6
- import { FSWatcher, WatchOptions } from 'types/chokidar';
7
- import { WebSocketServer } from './ws';
8
- import { ProxyOptions } from './middlewares/proxy';
9
- import { ModuleGraph, ModuleNode } from './moduleGraph';
10
- import { Connect } from 'types/connect';
11
- import { HmrOptions } from './hmr';
12
- import { TransformResult } from 'rollup';
13
- import { TransformOptions } from './transformRequest';
14
- import { ESBuildTransformResult } from '../plugins/esbuild';
15
- import { TransformOptions as EsbuildTransformOptions } from 'esbuild';
16
- import { DepOptimizationMetadata } from '../optimizer';
17
- export interface ServerOptions {
18
- host?: string | boolean;
19
- port?: number;
20
- /**
21
- * Enable TLS + HTTP/2.
22
- * Note: this downgrades to TLS only when the proxy option is also used.
23
- */
24
- https?: boolean | https.ServerOptions;
25
- /**
26
- * Open browser window on startup
27
- */
28
- open?: boolean | string;
29
- /**
30
- * Force dep pre-optimization regardless of whether deps have changed.
31
- */
32
- force?: boolean;
33
- /**
34
- * Configure HMR-specific options (port, host, path & protocol)
35
- */
36
- hmr?: HmrOptions | boolean;
37
- /**
38
- * chokidar watch options
39
- * https://github.com/paulmillr/chokidar#api
40
- */
41
- watch?: WatchOptions;
42
- /**
43
- * Configure custom proxy rules for the dev server. Expects an object
44
- * of `{ key: options }` pairs.
45
- * Uses [`http-proxy`](https://github.com/http-party/node-http-proxy).
46
- * Full options [here](https://github.com/http-party/node-http-proxy#options).
47
- *
48
- * Example `vite.config.js`:
49
- * ``` js
50
- * module.exports = {
51
- * proxy: {
52
- * // string shorthand
53
- * '/foo': 'http://localhost:4567/foo',
54
- * // with options
55
- * '/api': {
56
- * target: 'http://jsonplaceholder.typicode.com',
57
- * changeOrigin: true,
58
- * rewrite: path => path.replace(/^\/api/, '')
59
- * }
60
- * }
61
- * }
62
- * ```
63
- */
64
- proxy?: Record<string, string | ProxyOptions>;
65
- /**
66
- * Configure CORS for the dev server.
67
- * Uses https://github.com/expressjs/cors.
68
- * Set to `true` to allow all methods from any origin, or configure separately
69
- * using an object.
70
- */
71
- cors?: CorsOptions | boolean;
72
- /**
73
- * If enabled, vite will exit if specified port is already in use
74
- */
75
- strictPort?: boolean;
76
- /**
77
- * Create Vite dev server to be used as a middleware in an existing server
78
- */
79
- middlewareMode?: boolean | 'html' | 'ssr';
80
- /**
81
- * Prepend this folder to http requests, for use when proxying vite as a subfolder
82
- * Should start and end with the `/` character
83
- */
84
- base?: string;
85
- /**
86
- * Options for files served via '/\@fs/'.
87
- */
88
- fs?: FileSystemServeOptions;
89
- }
90
- export interface ResolvedServerOptions extends ServerOptions {
91
- fs: Required<FileSystemServeOptions>;
92
- }
93
- export interface FileSystemServeOptions {
94
- /**
95
- * Strictly restrict file accessing outside of allowing paths.
96
- *
97
- * Set to `false` to disable the warning
98
- * Default to false at this moment, will enabled by default in the future versions.
99
- *
100
- * @expiremental
101
- * @default undefined
102
- */
103
- strict?: boolean | undefined;
104
- /**
105
- * Restrict accessing files outside the allowed directories.
106
- *
107
- * Accepts absolute path or a path relative to project root.
108
- * Will try to search up for workspace root by default.
109
- *
110
- * @expiremental
111
- */
112
- allow?: string[];
113
- }
114
- /**
115
- * https://github.com/expressjs/cors#configuration-options
116
- */
117
- export interface CorsOptions {
118
- origin?: CorsOrigin | ((origin: string, cb: (err: Error, origins: CorsOrigin) => void) => void);
119
- methods?: string | string[];
120
- allowedHeaders?: string | string[];
121
- exposedHeaders?: string | string[];
122
- credentials?: boolean;
123
- maxAge?: number;
124
- preflightContinue?: boolean;
125
- optionsSuccessStatus?: number;
126
- }
127
- export declare type CorsOrigin = boolean | string | RegExp | (string | RegExp)[];
128
- export declare type ServerHook = (server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
129
- export interface ViteDevServer {
130
- /**
131
- * The resolved vite config object
132
- */
133
- config: ResolvedConfig;
134
- /**
135
- * A connect app instance.
136
- * - Can be used to attach custom middlewares to the dev server.
137
- * - Can also be used as the handler function of a custom http server
138
- * or as a middleware in any connect-style Node.js frameworks
139
- *
140
- * https://github.com/senchalabs/connect#use-middleware
141
- */
142
- middlewares: Connect.Server;
143
- /**
144
- * @deprecated use `server.middlewares` instead
145
- */
146
- app: Connect.Server;
147
- /**
148
- * native Node http server instance
149
- * will be null in middleware mode
150
- */
151
- httpServer: http.Server | null;
152
- /**
153
- * chokidar watcher instance
154
- * https://github.com/paulmillr/chokidar#api
155
- */
156
- watcher: FSWatcher;
157
- /**
158
- * web socket server with `send(payload)` method
159
- */
160
- ws: WebSocketServer;
161
- /**
162
- * Rollup plugin container that can run plugin hooks on a given file
163
- */
164
- pluginContainer: PluginContainer;
165
- /**
166
- * Module graph that tracks the import relationships, url to file mapping
167
- * and hmr state.
168
- */
169
- moduleGraph: ModuleGraph;
170
- /**
171
- * Programmatically resolve, load and transform a URL and get the result
172
- * without going through the http request pipeline.
173
- */
174
- transformRequest(url: string, options?: TransformOptions): Promise<TransformResult | null>;
175
- /**
176
- * Apply vite built-in HTML transforms and any plugin HTML transforms.
177
- */
178
- transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>;
179
- /**
180
- * Util for transforming a file with esbuild.
181
- * Can be useful for certain plugins.
182
- *
183
- * @deprecated import `transformWithEsbuild` from `vite` instead
184
- */
185
- transformWithEsbuild(code: string, filename: string, options?: EsbuildTransformOptions, inMap?: object): Promise<ESBuildTransformResult>;
186
- /**
187
- * Load a given URL as an instantiated module for SSR.
188
- */
189
- ssrLoadModule(url: string): Promise<Record<string, any>>;
190
- /**
191
- * Fix ssr error stacktrace
192
- */
193
- ssrFixStacktrace(e: Error): void;
194
- /**
195
- * Start the server.
196
- */
197
- listen(port?: number, isRestart?: boolean): Promise<ViteDevServer>;
198
- /**
199
- * Stop the server.
200
- */
201
- close(): Promise<void>;
202
- /**
203
- * @internal
204
- */
205
- _optimizeDepsMetadata: DepOptimizationMetadata | null;
206
- /**
207
- * Deps that are externalized
208
- * @internal
209
- */
210
- _ssrExternals: string[] | null;
211
- /**
212
- * @internal
213
- */
214
- _globImporters: Record<string, {
215
- module: ModuleNode;
216
- importGlobs: {
217
- base: string;
218
- pattern: string;
219
- }[];
220
- }>;
221
- /**
222
- * @internal
223
- */
224
- _isRunningOptimizer: boolean;
225
- /**
226
- * @internal
227
- */
228
- _registerMissingImport: ((id: string, resolved: string, ssr: boolean | undefined) => void) | null;
229
- /**
230
- * @internal
231
- */
232
- _pendingReload: Promise<void> | null;
233
- }
234
- export declare function createServer(inlineConfig?: InlineConfig): Promise<ViteDevServer>;
235
- export declare function resolveServerOptions(root: string, raw?: ServerOptions): ResolvedServerOptions;
@@ -1,3 +0,0 @@
1
- import { ViteDevServer } from '..';
2
- import { Connect } from 'types/connect';
3
- export declare function baseMiddleware({ config }: ViteDevServer): Connect.NextHandleFunction;
@@ -1,11 +0,0 @@
1
- import { RollupError } from 'rollup';
2
- import { ViteDevServer } from '../..';
3
- import { Connect } from 'types/connect';
4
- import { 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 errorMiddleware(server: ViteDevServer, allowNext?: boolean): Connect.ErrorHandleFunction;
8
- export declare class AccessRestrictedError extends Error {
9
- constructor(msg: string);
10
- }
11
- export declare function renderErrorHTML(msg: string): string;
@@ -1,4 +0,0 @@
1
- import { Connect } from 'types/connect';
2
- import { 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 * as http from 'http';
3
- import { Connect } from 'types/connect';
4
- import { HttpProxy } from 'types/http-proxy';
5
- import { 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 { Connect } from 'types/connect';
2
- export declare function spaFallbackMiddleware(root: string): Connect.NextHandleFunction;
@@ -1,7 +0,0 @@
1
- import { Connect } from 'types/connect';
2
- import { ResolvedConfig, ViteDevServer } from '../..';
3
- export declare function servePublicMiddleware(dir: string): Connect.NextHandleFunction;
4
- export declare function serveStaticMiddleware(dir: string, config: ResolvedConfig): Connect.NextHandleFunction;
5
- export declare function serveRawFsMiddleware(server: ViteDevServer): Connect.NextHandleFunction;
6
- export declare function isFileServingAllowed(url: string, server: ViteDevServer): boolean;
7
- export declare function ensureServingAccess(url: string, server: ViteDevServer): void;
@@ -1,2 +0,0 @@
1
- import { Connect } from 'types/connect';
2
- export declare function timeMiddleware(root: string): Connect.NextHandleFunction;
@@ -1,3 +0,0 @@
1
- import { ViteDevServer } from '..';
2
- import { Connect } from 'types/connect';
3
- export declare function transformMiddleware(server: ViteDevServer): Connect.NextHandleFunction;
@@ -1,46 +0,0 @@
1
- import { TransformResult } from './transformRequest';
2
- import { PluginContainer } from './pluginContainer';
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
- importers: Set<ModuleNode>;
15
- importedModules: Set<ModuleNode>;
16
- acceptedHmrDeps: Set<ModuleNode>;
17
- isSelfAccepting: boolean;
18
- transformResult: TransformResult | null;
19
- ssrTransformResult: TransformResult | null;
20
- ssrModule: Record<string, any> | null;
21
- lastHMRTimestamp: number;
22
- constructor(url: string);
23
- }
24
- export declare class ModuleGraph {
25
- urlToModuleMap: Map<string, ModuleNode>;
26
- idToModuleMap: Map<string, ModuleNode>;
27
- fileToModulesMap: Map<string, Set<ModuleNode>>;
28
- safeModulesPath: Set<string>;
29
- container: PluginContainer;
30
- constructor(container: PluginContainer);
31
- getModuleByUrl(rawUrl: string): Promise<ModuleNode | undefined>;
32
- getModuleById(id: string): ModuleNode | undefined;
33
- getModulesByFile(file: string): Set<ModuleNode> | undefined;
34
- onFileChange(file: string): void;
35
- invalidateModule(mod: ModuleNode, seen?: Set<ModuleNode>): void;
36
- invalidateAll(): void;
37
- /**
38
- * Update the module graph based on a module's updated imports information
39
- * If there are dependencies that no longer have any importers, they are
40
- * returned as a Set.
41
- */
42
- updateModuleInfo(mod: ModuleNode, importedModules: Set<string | ModuleNode>, acceptedModules: Set<string | ModuleNode>, isSelfAccepting: boolean): Promise<Set<ModuleNode> | undefined>;
43
- ensureEntryFromUrl(rawUrl: string): Promise<ModuleNode>;
44
- createFileOnlyEntry(file: string): ModuleNode;
45
- resolveUrl(url: string): Promise<[string, string]>;
46
- }