vite 2.8.0-beta.1 → 2.8.0-beta.5

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 (89) hide show
  1. package/CHANGELOG.md +79 -1
  2. package/LICENSE.md +65 -57
  3. package/bin/vite.js +3 -1
  4. package/client.d.ts +4 -0
  5. package/dist/client/client.mjs +10 -5
  6. package/dist/client/client.mjs.map +1 -1
  7. package/dist/node/chunks/dep-0ebab0df.js +0 -1
  8. package/dist/node/chunks/dep-2056ae8a.js +0 -1
  9. package/dist/node/chunks/{dep-fccf00e1.js → dep-6c133e83.js} +147 -482
  10. package/dist/node/chunks/{dep-e4a9e288.js → dep-ae5bfd1c.js} +1 -2
  11. package/dist/node/chunks/{dep-e4dc9ea2.js → dep-aff09a4c.js} +3423 -2774
  12. package/dist/node/chunks/{dep-51191982.js → dep-ba706304.js} +16 -5
  13. package/dist/node/cli.js +4 -6
  14. package/dist/node/index.d.ts +20 -18
  15. package/dist/node/index.js +1 -3
  16. package/package.json +22 -22
  17. package/src/client/client.ts +12 -6
  18. package/types/chokidar.d.ts +27 -18
  19. package/types/importMeta.d.ts +17 -2
  20. package/dist/node/build.d.ts +0 -200
  21. package/dist/node/certificate.d.ts +0 -2
  22. package/dist/node/chunks/dep-0ebab0df.js.map +0 -1
  23. package/dist/node/chunks/dep-2056ae8a.js.map +0 -1
  24. package/dist/node/chunks/dep-51191982.js.map +0 -1
  25. package/dist/node/chunks/dep-e4a9e288.js.map +0 -1
  26. package/dist/node/chunks/dep-e4dc9ea2.js.map +0 -1
  27. package/dist/node/chunks/dep-fccf00e1.js.map +0 -1
  28. package/dist/node/cli.d.ts +0 -1
  29. package/dist/node/cli.js.map +0 -1
  30. package/dist/node/config.d.ts +0 -227
  31. package/dist/node/constants.d.ts +0 -33
  32. package/dist/node/http.d.ts +0 -88
  33. package/dist/node/importGlob.d.ts +0 -14
  34. package/dist/node/index.js.map +0 -1
  35. package/dist/node/logger.d.ts +0 -35
  36. package/dist/node/optimizer/esbuildDepPlugin.d.ts +0 -4
  37. package/dist/node/optimizer/index.d.ts +0 -66
  38. package/dist/node/optimizer/registerMissing.d.ts +0 -2
  39. package/dist/node/optimizer/scan.d.ts +0 -9
  40. package/dist/node/packages.d.ts +0 -25
  41. package/dist/node/plugin.d.ts +0 -115
  42. package/dist/node/plugins/asset.d.ts +0 -40
  43. package/dist/node/plugins/assetImportMetaUrl.d.ts +0 -13
  44. package/dist/node/plugins/clientInjections.d.ts +0 -7
  45. package/dist/node/plugins/css.d.ts +0 -71
  46. package/dist/node/plugins/dataUri.d.ts +0 -5
  47. package/dist/node/plugins/define.d.ts +0 -3
  48. package/dist/node/plugins/esbuild.d.ts +0 -15
  49. package/dist/node/plugins/html.d.ts +0 -105
  50. package/dist/node/plugins/importAnalysis.d.ts +0 -46
  51. package/dist/node/plugins/importAnalysisBuild.d.ts +0 -15
  52. package/dist/node/plugins/index.d.ts +0 -3
  53. package/dist/node/plugins/json.d.ts +0 -22
  54. package/dist/node/plugins/loadFallback.d.ts +0 -5
  55. package/dist/node/plugins/manifest.d.ts +0 -14
  56. package/dist/node/plugins/modulePreloadPolyfill.d.ts +0 -4
  57. package/dist/node/plugins/preAlias.d.ts +0 -5
  58. package/dist/node/plugins/reporter.d.ts +0 -3
  59. package/dist/node/plugins/resolve.d.ts +0 -38
  60. package/dist/node/plugins/ssrRequireHook.d.ts +0 -12
  61. package/dist/node/plugins/terser.d.ts +0 -3
  62. package/dist/node/plugins/wasm.d.ts +0 -3
  63. package/dist/node/plugins/worker.d.ts +0 -5
  64. package/dist/node/plugins/workerImportMetaUrl.d.ts +0 -3
  65. package/dist/node/preview.d.ts +0 -31
  66. package/dist/node/server/hmr.d.ts +0 -37
  67. package/dist/node/server/index.d.ts +0 -222
  68. package/dist/node/server/middlewares/base.d.ts +0 -3
  69. package/dist/node/server/middlewares/error.d.ts +0 -8
  70. package/dist/node/server/middlewares/indexHtml.d.ts +0 -4
  71. package/dist/node/server/middlewares/proxy.d.ts +0 -20
  72. package/dist/node/server/middlewares/spaFallback.d.ts +0 -2
  73. package/dist/node/server/middlewares/static.d.ts +0 -6
  74. package/dist/node/server/middlewares/time.d.ts +0 -2
  75. package/dist/node/server/middlewares/transform.d.ts +0 -3
  76. package/dist/node/server/moduleGraph.d.ts +0 -53
  77. package/dist/node/server/openBrowser.d.ts +0 -15
  78. package/dist/node/server/pluginContainer.d.ts +0 -37
  79. package/dist/node/server/searchRoot.d.ts +0 -8
  80. package/dist/node/server/send.d.ts +0 -10
  81. package/dist/node/server/sourcemap.d.ts +0 -8
  82. package/dist/node/server/transformRequest.d.ts +0 -14
  83. package/dist/node/server/ws.d.ts +0 -14
  84. package/dist/node/ssr/ssrExternal.d.ts +0 -7
  85. package/dist/node/ssr/ssrManifestPlugin.d.ts +0 -3
  86. package/dist/node/ssr/ssrModuleLoader.d.ts +0 -7
  87. package/dist/node/ssr/ssrStacktrace.d.ts +0 -3
  88. package/dist/node/ssr/ssrTransform.d.ts +0 -8
  89. package/dist/node/utils.d.ts +0 -115
@@ -1,115 +0,0 @@
1
- import type { UserConfig } from './config';
2
- import type { CustomPluginOptions, LoadResult, Plugin as RollupPlugin, PluginContext, ResolveIdResult, TransformPluginContext, TransformResult } from 'rollup';
3
- import type { ServerHook } from './server';
4
- import type { IndexHtmlTransform } from './plugins/html';
5
- import type { ModuleNode } from './server/moduleGraph';
6
- import type { ConfigEnv, ResolvedConfig } from './';
7
- import type { HmrContext } from './server/hmr';
8
- /**
9
- * Vite plugins extends the Rollup plugin interface with a few extra
10
- * vite-specific options. A valid vite plugin is also a valid Rollup plugin.
11
- * On the contrary, a Rollup plugin may or may NOT be a valid vite universal
12
- * plugin, since some Rollup features do not make sense in an unbundled
13
- * dev server context. That said, as long as a rollup plugin doesn't have strong
14
- * coupling between its bundle phase and output phase hooks then it should
15
- * just work (that means, most of them).
16
- *
17
- * By default, the plugins are run during both serve and build. When a plugin
18
- * is applied during serve, it will only run **non output plugin hooks** (see
19
- * rollup type definition of {@link rollup#PluginHooks}). You can think of the
20
- * dev server as only running `const bundle = rollup.rollup()` but never calling
21
- * `bundle.generate()`.
22
- *
23
- * A plugin that expects to have different behavior depending on serve/build can
24
- * export a factory function that receives the command being run via options.
25
- *
26
- * If a plugin should be applied only for server or build, a function format
27
- * config file can be used to conditional determine the plugins to use.
28
- */
29
- export interface Plugin extends RollupPlugin {
30
- /**
31
- * Enforce plugin invocation tier similar to webpack loaders.
32
- *
33
- * Plugin invocation order:
34
- * - alias resolution
35
- * - `enforce: 'pre'` plugins
36
- * - vite core plugins
37
- * - normal plugins
38
- * - vite build plugins
39
- * - `enforce: 'post'` plugins
40
- * - vite build post plugins
41
- */
42
- enforce?: 'pre' | 'post';
43
- /**
44
- * Apply the plugin only for serve or build, or on certain conditions.
45
- */
46
- apply?: 'serve' | 'build' | ((config: UserConfig, env: ConfigEnv) => boolean);
47
- /**
48
- * Modify vite config before it's resolved. The hook can either mutate the
49
- * passed-in config directly, or return a partial config object that will be
50
- * deeply merged into existing config.
51
- *
52
- * Note: User plugins are resolved before running this hook so injecting other
53
- * plugins inside the `config` hook will have no effect.
54
- */
55
- config?: (config: UserConfig, env: ConfigEnv) => UserConfig | null | void | Promise<UserConfig | null | void>;
56
- /**
57
- * Use this hook to read and store the final resolved vite config.
58
- */
59
- configResolved?: (config: ResolvedConfig) => void | Promise<void>;
60
- /**
61
- * Configure the vite server. The hook receives the {@link ViteDevServer}
62
- * instance. This can also be used to store a reference to the server
63
- * for use in other hooks.
64
- *
65
- * The hooks will be called before internal middlewares are applied. A hook
66
- * can return a post hook that will be called after internal middlewares
67
- * are applied. Hook can be async functions and will be called in series.
68
- */
69
- configureServer?: ServerHook;
70
- /**
71
- * Transform index.html.
72
- * The hook receives the following arguments:
73
- *
74
- * - html: string
75
- * - ctx?: vite.ServerContext (only present during serve)
76
- * - bundle?: rollup.OutputBundle (only present during build)
77
- *
78
- * It can either return a transformed string, or a list of html tag
79
- * descriptors that will be injected into the <head> or <body>.
80
- *
81
- * By default the transform is applied **after** vite's internal html
82
- * transform. If you need to apply the transform before vite, use an object:
83
- * `{ enforce: 'pre', transform: hook }`
84
- */
85
- transformIndexHtml?: IndexHtmlTransform;
86
- /**
87
- * Perform custom handling of HMR updates.
88
- * The handler receives a context containing changed filename, timestamp, a
89
- * list of modules affected by the file change, and the dev server instance.
90
- *
91
- * - The hook can return a filtered list of modules to narrow down the update.
92
- * e.g. for a Vue SFC, we can narrow down the part to update by comparing
93
- * the descriptors.
94
- *
95
- * - The hook can also return an empty array and then perform custom updates
96
- * by sending a custom hmr payload via server.ws.send().
97
- *
98
- * - If the hook doesn't return a value, the hmr update will be performed as
99
- * normal.
100
- */
101
- handleHotUpdate?(ctx: HmrContext): Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>;
102
- /**
103
- * extend hooks with ssr flag
104
- */
105
- resolveId?(this: PluginContext, source: string, importer: string | undefined, options: {
106
- custom?: CustomPluginOptions;
107
- ssr?: boolean;
108
- }): Promise<ResolveIdResult> | ResolveIdResult;
109
- load?(this: PluginContext, id: string, options?: {
110
- ssr?: boolean;
111
- }): Promise<LoadResult> | LoadResult;
112
- transform?(this: TransformPluginContext, code: string, id: string, options?: {
113
- ssr?: boolean;
114
- }): Promise<TransformResult> | TransformResult;
115
- }
@@ -1,40 +0,0 @@
1
- /// <reference types="node" />
2
- import type { Plugin } from '../plugin';
3
- import type { ResolvedConfig } from '../config';
4
- import type { OutputOptions, PluginContext, RenderedChunk } from 'rollup';
5
- export declare const assetUrlRE: RegExp;
6
- export declare const chunkToEmittedAssetsMap: WeakMap<RenderedChunk, Set<string>>;
7
- /**
8
- * Also supports loading plain strings with import text from './foo.txt?raw'
9
- */
10
- export declare function assetPlugin(config: ResolvedConfig): Plugin;
11
- export declare function registerAssetToChunk(chunk: RenderedChunk, file: string): void;
12
- export declare function checkPublicFile(url: string, { publicDir }: ResolvedConfig): string | undefined;
13
- export declare function fileToUrl(id: string, config: ResolvedConfig, ctx: PluginContext): string | Promise<string>;
14
- export declare function getAssetFilename(hash: string, config: ResolvedConfig): string | undefined;
15
- /**
16
- * converts the source filepath of the asset to the output filename based on the assetFileNames option. \
17
- * this function imitates the behavior of rollup.js. \
18
- * https://rollupjs.org/guide/en/#outputassetfilenames
19
- *
20
- * @example
21
- * ```ts
22
- * const content = Buffer.from('text');
23
- * const fileName = assetFileNamesToFileName(
24
- * 'assets/[name].[hash][extname]',
25
- * '/path/to/file.txt',
26
- * getAssetHash(content),
27
- * content
28
- * )
29
- * // fileName: 'assets/file.982d9e3e.txt'
30
- * ```
31
- *
32
- * @param assetFileNames filename pattern. e.g. `'assets/[name].[hash][extname]'`
33
- * @param file filepath of the asset
34
- * @param contentHash hash of the asset. used for `'[hash]'` placeholder
35
- * @param content content of the asset. passed to `assetFileNames` if `assetFileNames` is a function
36
- * @returns output filename
37
- */
38
- export declare function assetFileNamesToFileName(assetFileNames: Exclude<OutputOptions['assetFileNames'], undefined>, file: string, contentHash: string, content: string | Buffer): string;
39
- export declare function getAssetHash(content: Buffer): string;
40
- export declare function urlToBuiltUrl(url: string, importer: string, config: ResolvedConfig, pluginContext: PluginContext): Promise<string>;
@@ -1,13 +0,0 @@
1
- import type { Plugin } from '../plugin';
2
- import type { ResolvedConfig } from '../config';
3
- /**
4
- * Convert `new URL('./foo.png', import.meta.url)` to its resolved built URL
5
- *
6
- * Supports template string with dynamic segments:
7
- * ```
8
- * new URL(`./dir/${name}.png`, import.meta.url)
9
- * // transformed to
10
- * import.meta.globEager('./dir/**.png')[`./dir/${name}.png`].default
11
- * ```
12
- */
13
- export declare function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin;
@@ -1,7 +0,0 @@
1
- import type { Plugin } from '../plugin';
2
- import type { ResolvedConfig } from '../config';
3
- /**
4
- * some values used by the client needs to be dynamically injected by the server
5
- * @server-only
6
- */
7
- export declare function clientInjectionsPlugin(config: ResolvedConfig): Plugin;
@@ -1,71 +0,0 @@
1
- import type { Plugin } from '../plugin';
2
- import type { ResolvedConfig } from '../config';
3
- import type { RenderedChunk, RollupError } from 'rollup';
4
- import type { ResolveFn } from '../';
5
- import type * as Postcss from 'postcss';
6
- import type { Alias } from 'types/alias';
7
- export interface CSSOptions {
8
- /**
9
- * https://github.com/css-modules/postcss-modules
10
- */
11
- modules?: CSSModulesOptions | false;
12
- preprocessorOptions?: Record<string, any>;
13
- postcss?: string | (Postcss.ProcessOptions & {
14
- plugins?: Postcss.Plugin[];
15
- });
16
- }
17
- export interface CSSModulesOptions {
18
- getJSON?: (cssFileName: string, json: Record<string, string>, outputFileName: string) => void;
19
- scopeBehaviour?: 'global' | 'local';
20
- globalModulePaths?: RegExp[];
21
- generateScopedName?: string | ((name: string, filename: string, css: string) => string);
22
- hashPrefix?: string;
23
- /**
24
- * default: null
25
- */
26
- localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | null;
27
- }
28
- export declare const isCSSRequest: (request: string) => boolean;
29
- export declare const isDirectCSSRequest: (request: string) => boolean;
30
- export declare const isDirectRequest: (request: string) => boolean;
31
- export declare const chunkToEmittedCssFileMap: WeakMap<RenderedChunk, Set<string>>;
32
- export declare const removedPureCssFilesCache: WeakMap<Readonly<Omit<import("../config").UserConfig, "plugins" | "alias" | "dedupe" | "assetsInclude" | "optimizeDeps" | "worker"> & {
33
- configFile: string | undefined;
34
- configFileDependencies: string[];
35
- inlineConfig: import("../config").InlineConfig;
36
- root: string;
37
- base: string;
38
- publicDir: string;
39
- command: "build" | "serve";
40
- mode: string;
41
- isProduction: boolean;
42
- env: Record<string, any>;
43
- resolve: import("./resolve").ResolveOptions & {
44
- alias: Alias[];
45
- };
46
- plugins: readonly Plugin[];
47
- server: import("../server").ResolvedServerOptions;
48
- build: Required<Omit<import("../build").BuildOptions, "base" | "cleanCssOptions" | "polyfillDynamicImport" | "brotliSize">>;
49
- preview: import("../preview").ResolvedPreviewOptions;
50
- assetsInclude: (file: string) => boolean;
51
- logger: import("../logger").Logger;
52
- createResolver: (options?: Partial<import("./resolve").InternalResolveOptions> | undefined) => ResolveFn;
53
- optimizeDeps: Omit<import("../optimizer").DepOptimizationOptions, "keepNames">;
54
- packageCache: import("../packages").PackageCache;
55
- worker: import("../config").ResolveWorkerOptions;
56
- }>, Map<string, RenderedChunk>>;
57
- /**
58
- * Plugin applied before user plugins
59
- */
60
- export declare function cssPlugin(config: ResolvedConfig): Plugin;
61
- /**
62
- * Plugin applied after user plugins
63
- */
64
- export declare function cssPostPlugin(config: ResolvedConfig): Plugin;
65
- export declare const cssUrlRE: RegExp;
66
- export interface StylePreprocessorResults {
67
- code: string;
68
- map?: object;
69
- errors: RollupError[];
70
- deps: string[];
71
- }
@@ -1,5 +0,0 @@
1
- import type { Plugin } from '../plugin';
2
- /**
3
- * Build only, since importing from a data URI works natively.
4
- */
5
- export declare function dataURIPlugin(): Plugin;
@@ -1,3 +0,0 @@
1
- import type { ResolvedConfig } from '../config';
2
- import type { Plugin } from '../plugin';
3
- export declare function definePlugin(config: ResolvedConfig): Plugin;
@@ -1,15 +0,0 @@
1
- import type { Plugin } from '../plugin';
2
- import type { TransformOptions, TransformResult } from 'esbuild';
3
- import type { SourceMap } from 'rollup';
4
- import type { ResolvedConfig } from '..';
5
- export interface ESBuildOptions extends TransformOptions {
6
- include?: string | RegExp | string[] | RegExp[];
7
- exclude?: string | RegExp | string[] | RegExp[];
8
- jsxInject?: string;
9
- }
10
- export declare type ESBuildTransformResult = Omit<TransformResult, 'map'> & {
11
- map: SourceMap;
12
- };
13
- export declare function transformWithEsbuild(code: string, filename: string, options?: TransformOptions, inMap?: object): Promise<ESBuildTransformResult>;
14
- export declare function esbuildPlugin(options?: ESBuildOptions): Plugin;
15
- export declare const buildEsbuildPlugin: (config: ResolvedConfig) => Plugin;
@@ -1,105 +0,0 @@
1
- import type { Plugin } from '../plugin';
2
- import type { ViteDevServer } from '../server';
3
- import type { OutputBundle, OutputChunk } from 'rollup';
4
- import type { ResolvedConfig } from '../config';
5
- import type { AttributeNode, NodeTransform, ElementNode } from '@vue/compiler-dom';
6
- export declare const isHTMLProxy: (id: string) => boolean;
7
- export declare const htmlProxyMap: WeakMap<Readonly<Omit<import("../config").UserConfig, "plugins" | "alias" | "dedupe" | "assetsInclude" | "optimizeDeps" | "worker"> & {
8
- configFile: string | undefined;
9
- configFileDependencies: string[];
10
- inlineConfig: import("../config").InlineConfig;
11
- root: string;
12
- base: string;
13
- publicDir: string;
14
- command: "build" | "serve";
15
- mode: string;
16
- isProduction: boolean;
17
- env: Record<string, any>;
18
- resolve: import("./resolve").ResolveOptions & {
19
- alias: import("types/alias").Alias[];
20
- };
21
- plugins: readonly Plugin[];
22
- server: import("../server").ResolvedServerOptions;
23
- build: Required<Omit<import("..").BuildOptions, "base" | "cleanCssOptions" | "polyfillDynamicImport" | "brotliSize">>;
24
- preview: import("..").ResolvedPreviewOptions;
25
- assetsInclude: (file: string) => boolean;
26
- logger: import("..").Logger;
27
- createResolver: (options?: Partial<import("./resolve").InternalResolveOptions> | undefined) => import("../config").ResolveFn;
28
- optimizeDeps: Omit<import("..").DepOptimizationOptions, "keepNames">;
29
- packageCache: import("..").PackageCache;
30
- worker: import("../config").ResolveWorkerOptions;
31
- }>, Map<string, string[]>>;
32
- export declare const htmlProxyResult: Map<string, string>;
33
- export declare function htmlInlineProxyPlugin(config: ResolvedConfig): Plugin;
34
- export declare function addToHTMLProxyCache(config: ResolvedConfig, filePath: string, index: number, code: string): void;
35
- export declare function addToHTMLProxyTransformResult(hash: string, code: string): void;
36
- export declare const assetAttrsConfig: Record<string, string[]>;
37
- export declare const isAsyncScriptMap: WeakMap<Readonly<Omit<import("../config").UserConfig, "plugins" | "alias" | "dedupe" | "assetsInclude" | "optimizeDeps" | "worker"> & {
38
- configFile: string | undefined;
39
- configFileDependencies: string[];
40
- inlineConfig: import("../config").InlineConfig;
41
- root: string;
42
- base: string;
43
- publicDir: string;
44
- command: "build" | "serve";
45
- mode: string;
46
- isProduction: boolean;
47
- env: Record<string, any>;
48
- resolve: import("./resolve").ResolveOptions & {
49
- alias: import("types/alias").Alias[];
50
- };
51
- plugins: readonly Plugin[];
52
- server: import("../server").ResolvedServerOptions;
53
- build: Required<Omit<import("..").BuildOptions, "base" | "cleanCssOptions" | "polyfillDynamicImport" | "brotliSize">>;
54
- preview: import("..").ResolvedPreviewOptions;
55
- assetsInclude: (file: string) => boolean;
56
- logger: import("..").Logger;
57
- createResolver: (options?: Partial<import("./resolve").InternalResolveOptions> | undefined) => import("../config").ResolveFn;
58
- optimizeDeps: Omit<import("..").DepOptimizationOptions, "keepNames">;
59
- packageCache: import("..").PackageCache;
60
- worker: import("../config").ResolveWorkerOptions;
61
- }>, Map<string, boolean>>;
62
- export declare function traverseHtml(html: string, filePath: string, visitor: NodeTransform): Promise<void>;
63
- export declare function getScriptInfo(node: ElementNode): {
64
- src: AttributeNode | undefined;
65
- isModule: boolean;
66
- isAsync: boolean;
67
- };
68
- /**
69
- * Compiles index.html into an entry js module
70
- */
71
- export declare function buildHtmlPlugin(config: ResolvedConfig): Plugin;
72
- export interface HtmlTagDescriptor {
73
- tag: string;
74
- attrs?: Record<string, string | boolean | undefined>;
75
- children?: string | HtmlTagDescriptor[];
76
- /**
77
- * default: 'head-prepend'
78
- */
79
- injectTo?: 'head' | 'body' | 'head-prepend' | 'body-prepend';
80
- }
81
- export declare type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
82
- html: string;
83
- tags: HtmlTagDescriptor[];
84
- };
85
- export interface IndexHtmlTransformContext {
86
- /**
87
- * public path when served
88
- */
89
- path: string;
90
- /**
91
- * filename on disk
92
- */
93
- filename: string;
94
- server?: ViteDevServer;
95
- bundle?: OutputBundle;
96
- chunk?: OutputChunk;
97
- originalUrl?: string;
98
- }
99
- export declare type IndexHtmlTransformHook = (html: string, ctx: IndexHtmlTransformContext) => IndexHtmlTransformResult | void | Promise<IndexHtmlTransformResult | void>;
100
- export declare type IndexHtmlTransform = IndexHtmlTransformHook | {
101
- enforce?: 'pre' | 'post';
102
- transform: IndexHtmlTransformHook;
103
- };
104
- export declare function resolveHtmlTransforms(plugins: readonly Plugin[]): [IndexHtmlTransformHook[], IndexHtmlTransformHook[]];
105
- export declare function applyHtmlTransforms(html: string, hooks: IndexHtmlTransformHook[], ctx: IndexHtmlTransformContext): Promise<string>;
@@ -1,46 +0,0 @@
1
- import type { Plugin } from '../plugin';
2
- import type { 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;
33
- /**
34
- * Detect import statements to a known optimized CJS dependency and provide
35
- * ES named imports interop. We do this by rewriting named imports to a variable
36
- * assignment to the corresponding property on the `module.exports` of the cjs
37
- * module. Note this doesn't support dynamic re-assignments from within the cjs
38
- * module.
39
- *
40
- * Note that es-module-lexer treats `export * from '...'` as an import as well,
41
- * so, we may encounter ExportAllDeclaration here, in which case `undefined`
42
- * will be returned.
43
- *
44
- * Credits \@csr632 via #837
45
- */
46
- export declare function transformCjsImport(importExp: string, url: string, rawUrl: string, importIndex: number): string | undefined;
@@ -1,15 +0,0 @@
1
- import type { ResolvedConfig } from '../config';
2
- import type { 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 type { ResolvedConfig } from '../config';
2
- import type { 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 type { 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 type { 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 type { ResolvedConfig } from '..';
2
- import type { 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 type { ResolvedConfig } from '..';
2
- import type { 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 type { 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 type { Plugin } from 'rollup';
2
- import type { ResolvedConfig } from '../config';
3
- export declare function buildReporterPlugin(config: ResolvedConfig): Plugin;
@@ -1,38 +0,0 @@
1
- import type { Plugin } from '../plugin';
2
- import type { ViteDevServer, SSROptions } from '..';
3
- import type { PartialResolvedId } from 'rollup';
4
- import type { PackageCache, PackageData } from '../packages';
5
- export declare const browserExternalId = "__vite-browser-external";
6
- export interface ResolveOptions {
7
- mainFields?: string[];
8
- conditions?: string[];
9
- extensions?: string[];
10
- dedupe?: string[];
11
- preserveSymlinks?: boolean;
12
- }
13
- export interface InternalResolveOptions extends ResolveOptions {
14
- root: string;
15
- isBuild: boolean;
16
- isProduction: boolean;
17
- ssrConfig?: SSROptions;
18
- packageCache?: PackageCache;
19
- /**
20
- * src code mode also attempts the following:
21
- * - resolving /xxx as URLs
22
- * - resolving bare imports from optimized deps
23
- */
24
- asSrc?: boolean;
25
- tryIndex?: boolean;
26
- tryPrefix?: string;
27
- skipPackageJson?: boolean;
28
- preferRelative?: boolean;
29
- preserveSymlinks?: boolean;
30
- isRequire?: boolean;
31
- isFromTsImporter?: boolean;
32
- tryEsmOnly?: boolean;
33
- }
34
- export declare function resolvePlugin(baseOptions: InternalResolveOptions): Plugin;
35
- export declare const idToPkgMap: Map<string, PackageData>;
36
- export declare function tryNodeResolve(id: string, importer: string | null | undefined, options: InternalResolveOptions, targetWeb: boolean, server?: ViteDevServer, ssr?: boolean): PartialResolvedId | undefined;
37
- export declare function tryOptimizedResolve(id: string, server: ViteDevServer, importer?: string): string | undefined;
38
- export declare function resolvePackageEntry(id: string, { dir, data, setResolvedCache, getResolvedCache }: PackageData, targetWeb: boolean, options: InternalResolveOptions): string | undefined;
@@ -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,3 +0,0 @@
1
- import type { Plugin } from '../plugin';
2
- import type { ResolvedConfig } from '..';
3
- export declare function terserPlugin(config: ResolvedConfig): Plugin;
@@ -1,3 +0,0 @@
1
- import type { ResolvedConfig } from '../config';
2
- import type { Plugin } from '../plugin';
3
- export declare const wasmPlugin: (config: ResolvedConfig) => Plugin;
@@ -1,5 +0,0 @@
1
- /// <reference types="node" />
2
- import type { ResolvedConfig } from '../config';
3
- import type { Plugin } from '../plugin';
4
- export declare function bundleWorkerEntry(config: ResolvedConfig, id: string): Promise<Buffer>;
5
- export declare function webWorkerPlugin(config: ResolvedConfig): Plugin;
@@ -1,3 +0,0 @@
1
- import type { ResolvedConfig } from '../config';
2
- import type { Plugin } from '../plugin';
3
- export declare function workerImportMetaUrlPlugin(config: ResolvedConfig): Plugin;
@@ -1,31 +0,0 @@
1
- /// <reference types="node" />
2
- import type { Server } from 'http';
3
- import type { InlineConfig, ResolvedConfig } from '.';
4
- import type { ResolvedServerOptions } from './server';
5
- import type { CommonServerOptions } from './http';
6
- export interface PreviewOptions extends CommonServerOptions {
7
- }
8
- export interface ResolvedPreviewOptions extends PreviewOptions {
9
- }
10
- export declare function resolvePreviewOptions(preview: PreviewOptions | undefined, server: ResolvedServerOptions): ResolvedPreviewOptions;
11
- export interface PreviewServer {
12
- /**
13
- * The resolved vite config object
14
- */
15
- config: ResolvedConfig;
16
- /**
17
- * native Node http server instance
18
- */
19
- httpServer: Server;
20
- /**
21
- * Print server urls
22
- */
23
- printUrls: () => void;
24
- }
25
- /**
26
- * Starts the Vite server in preview mode, to simulate a production deployment
27
- * @param config - the resolved Vite config
28
- * @param serverOptions - what host and port to use
29
- * @experimental
30
- */
31
- export declare function preview(inlineConfig: InlineConfig): Promise<PreviewServer>;