vite 3.0.0-alpha.4 → 3.0.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/node/chunks/{dep-28f8c91c.js → dep-16fa9be9.js} +1 -1
  2. package/dist/node/chunks/{dep-24157481.js → dep-17430d09.js} +0 -0
  3. package/dist/node/chunks/{dep-ce833324.js → dep-395deadd.js} +1 -1
  4. package/dist/node/chunks/{dep-35b61ee3.js → dep-3a62832d.js} +100 -47
  5. package/dist/node/chunks/{dep-aea1d487.js → dep-e214e00e.js} +33673 -33367
  6. package/dist/node/cli.js +7 -5
  7. package/dist/node/constants.js +1 -1
  8. package/dist/node/index.d.ts +36 -17
  9. package/dist/node/index.js +1 -1
  10. package/dist/node-cjs/publicUtils.cjs +0 -11
  11. package/package.json +10 -9
  12. package/dist/node/build.d.ts +0 -178
  13. package/dist/node/certificate.d.ts +0 -2
  14. package/dist/node/cli.d.ts +0 -1
  15. package/dist/node/config.d.ts +0 -240
  16. package/dist/node/constants.d.ts +0 -35
  17. package/dist/node/env.d.ts +0 -3
  18. package/dist/node/http.d.ts +0 -88
  19. package/dist/node/logger.d.ts +0 -31
  20. package/dist/node/optimizer/esbuildDepPlugin.d.ts +0 -4
  21. package/dist/node/optimizer/index.d.ts +0 -167
  22. package/dist/node/optimizer/registerMissing.d.ts +0 -3
  23. package/dist/node/optimizer/scan.d.ts +0 -8
  24. package/dist/node/packages.d.ts +0 -27
  25. package/dist/node/plugin.d.ts +0 -129
  26. package/dist/node/plugins/asset.d.ts +0 -68
  27. package/dist/node/plugins/assetImportMetaUrl.d.ts +0 -13
  28. package/dist/node/plugins/clientInjections.d.ts +0 -7
  29. package/dist/node/plugins/css.d.ts +0 -86
  30. package/dist/node/plugins/dataUri.d.ts +0 -5
  31. package/dist/node/plugins/define.d.ts +0 -3
  32. package/dist/node/plugins/dynamicImportVars.d.ts +0 -9
  33. package/dist/node/plugins/ensureWatch.d.ts +0 -5
  34. package/dist/node/plugins/esbuild.d.ts +0 -15
  35. package/dist/node/plugins/html.d.ts +0 -120
  36. package/dist/node/plugins/importAnalysis.d.ts +0 -47
  37. package/dist/node/plugins/importAnalysisBuild.d.ts +0 -16
  38. package/dist/node/plugins/importMetaGlob.d.ts +0 -34
  39. package/dist/node/plugins/index.d.ts +0 -3
  40. package/dist/node/plugins/json.d.ts +0 -23
  41. package/dist/node/plugins/loadFallback.d.ts +0 -5
  42. package/dist/node/plugins/manifest.d.ts +0 -14
  43. package/dist/node/plugins/metadata.d.ts +0 -9
  44. package/dist/node/plugins/modulePreloadPolyfill.d.ts +0 -4
  45. package/dist/node/plugins/optimizedDeps.d.ts +0 -4
  46. package/dist/node/plugins/preAlias.d.ts +0 -5
  47. package/dist/node/plugins/reporter.d.ts +0 -3
  48. package/dist/node/plugins/resolve.d.ts +0 -39
  49. package/dist/node/plugins/splitVendorChunk.d.ts +0 -12
  50. package/dist/node/plugins/ssrRequireHook.d.ts +0 -12
  51. package/dist/node/plugins/terser.d.ts +0 -3
  52. package/dist/node/plugins/wasm.d.ts +0 -4
  53. package/dist/node/plugins/worker.d.ts +0 -9
  54. package/dist/node/plugins/workerImportMetaUrl.d.ts +0 -3
  55. package/dist/node/preview.d.ts +0 -33
  56. package/dist/node/publicUtils.d.ts +0 -11
  57. package/dist/node/server/hmr.d.ts +0 -39
  58. package/dist/node/server/index.d.ts +0 -198
  59. package/dist/node/server/middlewares/base.d.ts +0 -3
  60. package/dist/node/server/middlewares/compression.d.ts +0 -1
  61. package/dist/node/server/middlewares/error.d.ts +0 -8
  62. package/dist/node/server/middlewares/indexHtml.d.ts +0 -4
  63. package/dist/node/server/middlewares/proxy.d.ts +0 -20
  64. package/dist/node/server/middlewares/spaFallback.d.ts +0 -2
  65. package/dist/node/server/middlewares/static.d.ts +0 -6
  66. package/dist/node/server/middlewares/time.d.ts +0 -2
  67. package/dist/node/server/middlewares/transform.d.ts +0 -3
  68. package/dist/node/server/moduleGraph.d.ts +0 -55
  69. package/dist/node/server/openBrowser.d.ts +0 -15
  70. package/dist/node/server/pluginContainer.d.ts +0 -41
  71. package/dist/node/server/searchRoot.d.ts +0 -8
  72. package/dist/node/server/send.d.ts +0 -10
  73. package/dist/node/server/sourcemap.d.ts +0 -11
  74. package/dist/node/server/transformRequest.d.ts +0 -14
  75. package/dist/node/server/ws.d.ts +0 -55
  76. package/dist/node/ssr/ssrExternal.d.ts +0 -11
  77. package/dist/node/ssr/ssrManifestPlugin.d.ts +0 -3
  78. package/dist/node/ssr/ssrModuleLoader.d.ts +0 -7
  79. package/dist/node/ssr/ssrStacktrace.d.ts +0 -3
  80. package/dist/node/ssr/ssrTransform.d.ts +0 -14
  81. package/dist/node/utils.d.ts +0 -144
@@ -1,129 +0,0 @@
1
- import type { CustomPluginOptions, LoadResult, PluginContext, ResolveIdResult, Plugin as RollupPlugin, TransformPluginContext, TransformResult } from 'rollup';
2
- import type { UserConfig } from './config';
3
- import type { ServerHook } from './server';
4
- import type { IndexHtmlTransform } from './plugins/html';
5
- import type { ModuleNode } from './server/moduleGraph';
6
- import type { HmrContext } from './server/hmr';
7
- import type { PreviewServerHook } from './preview';
8
- import type { ConfigEnv, ResolvedConfig } from './';
9
- /**
10
- * Vite plugins extends the Rollup plugin interface with a few extra
11
- * vite-specific options. A valid vite plugin is also a valid Rollup plugin.
12
- * On the contrary, a Rollup plugin may or may NOT be a valid vite universal
13
- * plugin, since some Rollup features do not make sense in an unbundled
14
- * dev server context. That said, as long as a rollup plugin doesn't have strong
15
- * coupling between its bundle phase and output phase hooks then it should
16
- * just work (that means, most of them).
17
- *
18
- * By default, the plugins are run during both serve and build. When a plugin
19
- * is applied during serve, it will only run **non output plugin hooks** (see
20
- * rollup type definition of {@link rollup#PluginHooks}). You can think of the
21
- * dev server as only running `const bundle = rollup.rollup()` but never calling
22
- * `bundle.generate()`.
23
- *
24
- * A plugin that expects to have different behavior depending on serve/build can
25
- * export a factory function that receives the command being run via options.
26
- *
27
- * If a plugin should be applied only for server or build, a function format
28
- * config file can be used to conditional determine the plugins to use.
29
- */
30
- export interface Plugin extends RollupPlugin {
31
- /**
32
- * Enforce plugin invocation tier similar to webpack loaders.
33
- *
34
- * Plugin invocation order:
35
- * - alias resolution
36
- * - `enforce: 'pre'` plugins
37
- * - vite core plugins
38
- * - normal plugins
39
- * - vite build plugins
40
- * - `enforce: 'post'` plugins
41
- * - vite build post plugins
42
- */
43
- enforce?: 'pre' | 'post';
44
- /**
45
- * Apply the plugin only for serve or build, or on certain conditions.
46
- */
47
- apply?: 'serve' | 'build' | ((config: UserConfig, env: ConfigEnv) => boolean);
48
- /**
49
- * Modify vite config before it's resolved. The hook can either mutate the
50
- * passed-in config directly, or return a partial config object that will be
51
- * deeply merged into existing config.
52
- *
53
- * Note: User plugins are resolved before running this hook so injecting other
54
- * plugins inside the `config` hook will have no effect.
55
- */
56
- config?: (config: UserConfig, env: ConfigEnv) => UserConfig | null | void | Promise<UserConfig | null | void>;
57
- /**
58
- * Use this hook to read and store the final resolved vite config.
59
- */
60
- configResolved?: (config: ResolvedConfig) => void | Promise<void>;
61
- /**
62
- * Configure the vite server. The hook receives the {@link ViteDevServer}
63
- * instance. This can also be used to store a reference to the server
64
- * for use in other hooks.
65
- *
66
- * The hooks will be called before internal middlewares are applied. A hook
67
- * can return a post hook that will be called after internal middlewares
68
- * are applied. Hook can be async functions and will be called in series.
69
- */
70
- configureServer?: ServerHook;
71
- /**
72
- * Configure the preview server. The hook receives the connect server and
73
- * its underlying http server.
74
- *
75
- * The hooks are called before other middlewares are applied. A hook can
76
- * return a post hook that will be called after other middlewares are
77
- * applied. Hooks can be async functions and will be called in series.
78
- */
79
- configurePreviewServer?: PreviewServerHook;
80
- /**
81
- * Transform index.html.
82
- * The hook receives the following arguments:
83
- *
84
- * - html: string
85
- * - ctx?: vite.ServerContext (only present during serve)
86
- * - bundle?: rollup.OutputBundle (only present during build)
87
- *
88
- * It can either return a transformed string, or a list of html tag
89
- * descriptors that will be injected into the <head> or <body>.
90
- *
91
- * By default the transform is applied **after** vite's internal html
92
- * transform. If you need to apply the transform before vite, use an object:
93
- * `{ enforce: 'pre', transform: hook }`
94
- */
95
- transformIndexHtml?: IndexHtmlTransform;
96
- /**
97
- * Perform custom handling of HMR updates.
98
- * The handler receives a context containing changed filename, timestamp, a
99
- * list of modules affected by the file change, and the dev server instance.
100
- *
101
- * - The hook can return a filtered list of modules to narrow down the update.
102
- * e.g. for a Vue SFC, we can narrow down the part to update by comparing
103
- * the descriptors.
104
- *
105
- * - The hook can also return an empty array and then perform custom updates
106
- * by sending a custom hmr payload via server.ws.send().
107
- *
108
- * - If the hook doesn't return a value, the hmr update will be performed as
109
- * normal.
110
- */
111
- handleHotUpdate?(ctx: HmrContext): Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>;
112
- /**
113
- * extend hooks with ssr flag
114
- */
115
- resolveId?(this: PluginContext, source: string, importer: string | undefined, options: {
116
- custom?: CustomPluginOptions;
117
- ssr?: boolean;
118
- /**
119
- * @internal
120
- */
121
- scan?: boolean;
122
- }): Promise<ResolveIdResult> | ResolveIdResult;
123
- load?(this: PluginContext, id: string, options?: {
124
- ssr?: boolean;
125
- }): Promise<LoadResult> | LoadResult;
126
- transform?(this: TransformPluginContext, code: string, id: string, options?: {
127
- ssr?: boolean;
128
- }): Promise<TransformResult> | TransformResult;
129
- }
@@ -1,68 +0,0 @@
1
- /// <reference types="node" />
2
- import type { OutputOptions, PluginContext } from 'rollup';
3
- import type { Plugin } from '../plugin';
4
- import type { ResolvedConfig } from '../config';
5
- export declare const assetUrlRE: RegExp;
6
- /**
7
- * Also supports loading plain strings with import text from './foo.txt?raw'
8
- */
9
- export declare function assetPlugin(config: ResolvedConfig): Plugin;
10
- export declare function checkPublicFile(url: string, { publicDir }: ResolvedConfig): string | undefined;
11
- export declare function fileToUrl(id: string, config: ResolvedConfig, ctx: PluginContext): Promise<string>;
12
- export declare function getAssetFilename(hash: string, config: ResolvedConfig): string | undefined;
13
- /**
14
- * converts the source filepath of the asset to the output filename based on the assetFileNames option. \
15
- * this function imitates the behavior of rollup.js. \
16
- * https://rollupjs.org/guide/en/#outputassetfilenames
17
- *
18
- * @example
19
- * ```ts
20
- * const content = Buffer.from('text');
21
- * const fileName = assetFileNamesToFileName(
22
- * 'assets/[name].[hash][extname]',
23
- * '/path/to/file.txt',
24
- * getHash(content),
25
- * content
26
- * )
27
- * // fileName: 'assets/file.982d9e3e.txt'
28
- * ```
29
- *
30
- * @param assetFileNames filename pattern. e.g. `'assets/[name].[hash][extname]'`
31
- * @param file filepath of the asset
32
- * @param contentHash hash of the asset. used for `'[hash]'` placeholder
33
- * @param content content of the asset. passed to `assetFileNames` if `assetFileNames` is a function
34
- * @returns output filename
35
- */
36
- export declare function assetFileNamesToFileName(assetFileNames: Exclude<OutputOptions['assetFileNames'], undefined>, file: string, contentHash: string, content: string | Buffer): string;
37
- export declare const publicAssetUrlCache: WeakMap<Readonly<Omit<import("../config").UserConfig, "assetsInclude" | "plugins" | "optimizeDeps" | "worker"> & {
38
- configFile: string | undefined;
39
- configFileDependencies: string[];
40
- inlineConfig: import("../config").InlineConfig;
41
- root: string;
42
- base: string;
43
- publicDir: string;
44
- cacheDir: string;
45
- command: "build" | "serve";
46
- mode: string;
47
- isWorker: boolean;
48
- mainConfig: Readonly<Omit<import("../config").UserConfig, "assetsInclude" | "plugins" | "optimizeDeps" | "worker"> & any> | null;
49
- isProduction: boolean;
50
- env: Record<string, any>;
51
- resolve: import("./resolve").ResolveOptions & {
52
- alias: import("types/alias").Alias[];
53
- };
54
- plugins: readonly Plugin[];
55
- server: import("..").ResolvedServerOptions;
56
- build: Required<import("..").BuildOptions>;
57
- preview: import("..").ResolvedPreviewOptions;
58
- assetsInclude: (file: string) => boolean;
59
- logger: import("..").Logger;
60
- createResolver: (options?: Partial<import("./resolve").InternalResolveOptions> | undefined) => import("../config").ResolveFn;
61
- optimizeDeps: import("..").DepOptimizationOptions;
62
- packageCache: import("..").PackageCache;
63
- worker: import("../config").ResolveWorkerOptions;
64
- spa: boolean;
65
- }>, Map<string, string>>;
66
- export declare const publicAssetUrlRE: RegExp;
67
- export declare function publicFileToBuiltUrl(url: string, config: ResolvedConfig): string;
68
- 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.glob('./dir/**.png', { eager: true, import: 'default' })[`./dir/${name}.png`]
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,86 +0,0 @@
1
- import type { ExistingRawSourceMap, RenderedChunk, RollupError } from 'rollup';
2
- import type * as PostCSS from 'postcss';
3
- import type { Alias } from 'types/alias';
4
- import type { ResolveFn } from '../';
5
- import type { ResolvedConfig } from '../config';
6
- import type { Plugin } from '../plugin';
7
- import type { Logger } from '../logger';
8
- export interface CSSOptions {
9
- /**
10
- * https://github.com/css-modules/postcss-modules
11
- */
12
- modules?: CSSModulesOptions | false;
13
- preprocessorOptions?: Record<string, any>;
14
- postcss?: string | (PostCSS.ProcessOptions & {
15
- plugins?: PostCSS.Plugin[];
16
- });
17
- /**
18
- * Enables css sourcemaps during dev
19
- * @default false
20
- * @experimental
21
- */
22
- devSourcemap?: boolean;
23
- }
24
- export interface CSSModulesOptions {
25
- getJSON?: (cssFileName: string, json: Record<string, string>, outputFileName: string) => void;
26
- scopeBehaviour?: 'global' | 'local';
27
- globalModulePaths?: RegExp[];
28
- generateScopedName?: string | ((name: string, filename: string, css: string) => string);
29
- hashPrefix?: string;
30
- /**
31
- * default: null
32
- */
33
- localsConvention?: 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly' | null;
34
- }
35
- export declare const isCSSRequest: (request: string) => boolean;
36
- export declare const isDirectCSSRequest: (request: string) => boolean;
37
- export declare const isDirectRequest: (request: string) => boolean;
38
- export declare const removedPureCssFilesCache: WeakMap<Readonly<Omit<import("../config").UserConfig, "assetsInclude" | "plugins" | "optimizeDeps" | "worker"> & {
39
- configFile: string | undefined;
40
- configFileDependencies: string[];
41
- inlineConfig: import("../config").InlineConfig;
42
- root: string;
43
- base: string;
44
- publicDir: string;
45
- cacheDir: string;
46
- command: "build" | "serve";
47
- mode: string;
48
- isWorker: boolean;
49
- mainConfig: Readonly<Omit<import("../config").UserConfig, "assetsInclude" | "plugins" | "optimizeDeps" | "worker"> & any> | null;
50
- isProduction: boolean;
51
- env: Record<string, any>;
52
- resolve: import("./resolve").ResolveOptions & {
53
- alias: Alias[];
54
- };
55
- plugins: readonly Plugin[];
56
- server: import("../server").ResolvedServerOptions;
57
- build: Required<import("../build").BuildOptions>;
58
- preview: import("../preview").ResolvedPreviewOptions;
59
- assetsInclude: (file: string) => boolean;
60
- logger: Logger;
61
- createResolver: (options?: Partial<import("./resolve").InternalResolveOptions> | undefined) => ResolveFn;
62
- optimizeDeps: import("../optimizer").DepOptimizationOptions;
63
- packageCache: import("../packages").PackageCache;
64
- worker: import("../config").ResolveWorkerOptions;
65
- spa: boolean;
66
- }>, Map<string, RenderedChunk>>;
67
- /**
68
- * Plugin applied before user plugins
69
- */
70
- export declare function cssPlugin(config: ResolvedConfig): Plugin;
71
- /**
72
- * Plugin applied after user plugins
73
- */
74
- export declare function cssPostPlugin(config: ResolvedConfig): Plugin;
75
- export declare function formatPostcssSourceMap(rawMap: ExistingRawSourceMap, file: string): Promise<ExistingRawSourceMap>;
76
- export declare const cssUrlRE: RegExp;
77
- export declare const cssDataUriRE: RegExp;
78
- export declare const importCssRE: RegExp;
79
- export declare function hoistAtRules(css: string): Promise<string>;
80
- export interface StylePreprocessorResults {
81
- code: string;
82
- map?: ExistingRawSourceMap | undefined;
83
- additionalMap?: ExistingRawSourceMap | undefined;
84
- errors: RollupError[];
85
- deps: string[];
86
- }
@@ -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,9 +0,0 @@
1
- import type { Plugin } from '../plugin';
2
- import type { ResolvedConfig } from '../config';
3
- export declare const dynamicImportHelperId = "/@vite/dynamic-import-helper";
4
- export declare function transformDynamicImport(importSource: string, importer: string, resolve: (url: string, importer?: string) => Promise<string | undefined> | string | undefined): Promise<{
5
- glob: string;
6
- pattern: string;
7
- rawPattern: string;
8
- } | null>;
9
- export declare function dynamicImportVarsPlugin(config: ResolvedConfig): Plugin;
@@ -1,5 +0,0 @@
1
- import type { Plugin } from '../plugin';
2
- /**
3
- * plugin to ensure rollup can watch correctly.
4
- */
5
- export declare function ensureWatchPlugin(): Plugin;
@@ -1,15 +0,0 @@
1
- import type { TransformOptions, TransformResult } from 'esbuild';
2
- import type { SourceMap } from 'rollup';
3
- import type { ResolvedConfig } from '..';
4
- import type { Plugin } from '../plugin';
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,120 +0,0 @@
1
- import type { OutputBundle, OutputChunk, SourceMapInput } from 'rollup';
2
- import type { AttributeNode, ElementNode, NodeTransform } from '@vue/compiler-dom';
3
- import type { Plugin } from '../plugin';
4
- import type { ViteDevServer } from '../server';
5
- import type { ResolvedConfig } from '../config';
6
- export declare const isHTMLProxy: (id: string) => boolean;
7
- export declare const isHTMLRequest: (request: string) => boolean;
8
- export declare const htmlProxyMap: WeakMap<Readonly<Omit<import("../config").UserConfig, "assetsInclude" | "plugins" | "optimizeDeps" | "worker"> & {
9
- configFile: string | undefined;
10
- configFileDependencies: string[];
11
- inlineConfig: import("../config").InlineConfig;
12
- root: string;
13
- base: string;
14
- publicDir: string;
15
- cacheDir: string;
16
- command: "build" | "serve";
17
- mode: string;
18
- isWorker: boolean;
19
- mainConfig: Readonly<Omit<import("../config").UserConfig, "assetsInclude" | "plugins" | "optimizeDeps" | "worker"> & any> | null;
20
- isProduction: boolean;
21
- env: Record<string, any>;
22
- resolve: import("./resolve").ResolveOptions & {
23
- alias: import("types/alias").Alias[];
24
- };
25
- plugins: readonly Plugin[];
26
- server: import("../server").ResolvedServerOptions;
27
- build: Required<import("..").BuildOptions>;
28
- preview: import("..").ResolvedPreviewOptions;
29
- assetsInclude: (file: string) => boolean;
30
- logger: import("..").Logger;
31
- createResolver: (options?: Partial<import("./resolve").InternalResolveOptions> | undefined) => import("../config").ResolveFn;
32
- optimizeDeps: import("..").DepOptimizationOptions;
33
- packageCache: import("..").PackageCache;
34
- worker: import("../config").ResolveWorkerOptions;
35
- spa: boolean;
36
- }>, Map<string, {
37
- code: string;
38
- map?: SourceMapInput | undefined;
39
- }[]>>;
40
- export declare const htmlProxyResult: Map<string, string>;
41
- export declare function htmlInlineProxyPlugin(config: ResolvedConfig): Plugin;
42
- export declare function addToHTMLProxyCache(config: ResolvedConfig, filePath: string, index: number, result: {
43
- code: string;
44
- map?: SourceMapInput;
45
- }): void;
46
- export declare function addToHTMLProxyTransformResult(hash: string, code: string): void;
47
- export declare const assetAttrsConfig: Record<string, string[]>;
48
- export declare const isAsyncScriptMap: WeakMap<Readonly<Omit<import("../config").UserConfig, "assetsInclude" | "plugins" | "optimizeDeps" | "worker"> & {
49
- configFile: string | undefined;
50
- configFileDependencies: string[];
51
- inlineConfig: import("../config").InlineConfig;
52
- root: string;
53
- base: string;
54
- publicDir: string;
55
- cacheDir: string;
56
- command: "build" | "serve";
57
- mode: string;
58
- isWorker: boolean;
59
- mainConfig: Readonly<Omit<import("../config").UserConfig, "assetsInclude" | "plugins" | "optimizeDeps" | "worker"> & any> | null;
60
- isProduction: boolean;
61
- env: Record<string, any>;
62
- resolve: import("./resolve").ResolveOptions & {
63
- alias: import("types/alias").Alias[];
64
- };
65
- plugins: readonly Plugin[];
66
- server: import("../server").ResolvedServerOptions;
67
- build: Required<import("..").BuildOptions>;
68
- preview: import("..").ResolvedPreviewOptions;
69
- assetsInclude: (file: string) => boolean;
70
- logger: import("..").Logger;
71
- createResolver: (options?: Partial<import("./resolve").InternalResolveOptions> | undefined) => import("../config").ResolveFn;
72
- optimizeDeps: import("..").DepOptimizationOptions;
73
- packageCache: import("..").PackageCache;
74
- worker: import("../config").ResolveWorkerOptions;
75
- spa: boolean;
76
- }>, Map<string, boolean>>;
77
- export declare function traverseHtml(html: string, filePath: string, visitor: NodeTransform): Promise<void>;
78
- export declare function getScriptInfo(node: ElementNode): {
79
- src: AttributeNode | undefined;
80
- isModule: boolean;
81
- isAsync: boolean;
82
- };
83
- /**
84
- * Compiles index.html into an entry js module
85
- */
86
- export declare function buildHtmlPlugin(config: ResolvedConfig): Plugin;
87
- export interface HtmlTagDescriptor {
88
- tag: string;
89
- attrs?: Record<string, string | boolean | undefined>;
90
- children?: string | HtmlTagDescriptor[];
91
- /**
92
- * default: 'head-prepend'
93
- */
94
- injectTo?: 'head' | 'body' | 'head-prepend' | 'body-prepend';
95
- }
96
- export declare type IndexHtmlTransformResult = string | HtmlTagDescriptor[] | {
97
- html: string;
98
- tags: HtmlTagDescriptor[];
99
- };
100
- export interface IndexHtmlTransformContext {
101
- /**
102
- * public path when served
103
- */
104
- path: string;
105
- /**
106
- * filename on disk
107
- */
108
- filename: string;
109
- server?: ViteDevServer;
110
- bundle?: OutputBundle;
111
- chunk?: OutputChunk;
112
- originalUrl?: string;
113
- }
114
- export declare type IndexHtmlTransformHook = (html: string, ctx: IndexHtmlTransformContext) => IndexHtmlTransformResult | void | Promise<IndexHtmlTransformResult | void>;
115
- export declare type IndexHtmlTransform = IndexHtmlTransformHook | {
116
- enforce?: 'pre' | 'post';
117
- transform: IndexHtmlTransformHook;
118
- };
119
- export declare function resolveHtmlTransforms(plugins: readonly Plugin[]): [IndexHtmlTransformHook[], IndexHtmlTransformHook[]];
120
- export declare function applyHtmlTransforms(html: string, hooks: IndexHtmlTransformHook[], ctx: IndexHtmlTransformContext): Promise<string>;
@@ -1,47 +0,0 @@
1
- import type { ResolvedConfig } from '../config';
2
- import type { Plugin } from '../plugin';
3
- export declare const canSkipImportAnalysis: (id: string) => boolean;
4
- /**
5
- * Server-only plugin that lexes, resolves, rewrites and analyzes url imports.
6
- *
7
- * - Imports are resolved to ensure they exist on disk
8
- *
9
- * - Lexes HMR accept calls and updates import relationships in the module graph
10
- *
11
- * - Bare module imports are resolved (by @rollup-plugin/node-resolve) to
12
- * absolute file paths, e.g.
13
- *
14
- * ```js
15
- * import 'foo'
16
- * ```
17
- * is rewritten to
18
- * ```js
19
- * import '/@fs//project/node_modules/foo/dist/foo.js'
20
- * ```
21
- *
22
- * - CSS imports are appended with `.js` since both the js module and the actual
23
- * css (referenced via <link>) may go through the transform pipeline:
24
- *
25
- * ```js
26
- * import './style.css'
27
- * ```
28
- * is rewritten to
29
- * ```js
30
- * import './style.css.js'
31
- * ```
32
- */
33
- export declare function importAnalysisPlugin(config: ResolvedConfig): Plugin;
34
- /**
35
- * Detect import statements to a known optimized CJS dependency and provide
36
- * ES named imports interop. We do this by rewriting named imports to a variable
37
- * assignment to the corresponding property on the `module.exports` of the cjs
38
- * module. Note this doesn't support dynamic re-assignments from within the cjs
39
- * module.
40
- *
41
- * Note that es-module-lexer treats `export * from '...'` as an import as well,
42
- * so, we may encounter ExportAllDeclaration here, in which case `undefined`
43
- * will be returned.
44
- *
45
- * Credits \@csr632 via #837
46
- */
47
- export declare function transformCjsImport(importExp: string, url: string, rawUrl: string, importIndex: number): string | undefined;
@@ -1,16 +0,0 @@
1
- import type { Plugin } from '../plugin';
2
- import type { ResolvedConfig } from '../config';
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
- export declare const preloadHelperId = "\0vite/preload-helper";
13
- /**
14
- * Build only. During serve this is performed as part of ./importAnalysis.
15
- */
16
- export declare function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin;
@@ -1,34 +0,0 @@
1
- import MagicString from 'magic-string';
2
- import type { GeneralImportGlobOptions } from 'types/importGlob';
3
- import type { Plugin } from '../plugin';
4
- import type { ViteDevServer } from '../server';
5
- import type { ModuleNode } from '../server/moduleGraph';
6
- import type { ResolvedConfig } from '../config';
7
- export interface ParsedImportGlob {
8
- match: RegExpMatchArray;
9
- index: number;
10
- globs: string[];
11
- globsResolved: string[];
12
- isRelative: boolean;
13
- options: GeneralImportGlobOptions;
14
- type: string;
15
- start: number;
16
- end: number;
17
- }
18
- export declare function getAffectedGlobModules(file: string, server: ViteDevServer): ModuleNode[];
19
- export declare function importGlobPlugin(config: ResolvedConfig): Plugin;
20
- export declare function parseImportGlob(code: string, importer: string | undefined, root: string, resolveId: IdResolver): Promise<ParsedImportGlob[]>;
21
- export interface TransformGlobImportResult {
22
- s: MagicString;
23
- matches: ParsedImportGlob[];
24
- files: Set<string>;
25
- }
26
- /**
27
- * @param optimizeExport for dynamicImportVar plugin don't need to optimize export.
28
- */
29
- export declare function transformGlobImport(code: string, id: string, root: string, resolveId: IdResolver, restoreQueryExtension?: boolean): Promise<TransformGlobImportResult | null>;
30
- declare type IdResolver = (id: string, importer?: string) => Promise<string | undefined> | string | undefined;
31
- export declare function toAbsoluteGlob(glob: string, root: string, importer: string | undefined, resolveId: IdResolver): Promise<string>;
32
- export declare function getCommonBase(globsResolved: string[]): null | string;
33
- export declare function isVirtualModule(id: string): boolean;
34
- export {};
@@ -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,23 +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 '../plugin';
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 const isJSONRequest: (request: string) => boolean;
23
- 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,9 +0,0 @@
1
- import type { Plugin } from '../plugin';
2
- export interface ChunkMetadata {
3
- importedAssets: Set<string>;
4
- importedCss: Set<string>;
5
- }
6
- /**
7
- * Prepares the rendered chunks to contain additional metadata during build.
8
- */
9
- export declare function metadataPlugin(): 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,4 +0,0 @@
1
- import type { Plugin } from '../plugin';
2
- export declare const ERR_OPTIMIZE_DEPS_PROCESSING_ERROR = "ERR_OPTIMIZE_DEPS_PROCESSING_ERROR";
3
- export declare const ERR_OUTDATED_OPTIMIZED_DEP = "ERR_OUTDATED_OPTIMIZED_DEP";
4
- export declare function optimizedDepsPlugin(): 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;