vite 3.0.0-alpha.5 → 3.0.0-alpha.8

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-21067347.js → dep-6b269949.js} +1 -1
  2. package/dist/node/chunks/{dep-0232e200.js → dep-8250f392.js} +422 -200
  3. package/dist/node/chunks/{dep-cd161504.js → dep-8259d5f4.js} +1 -1
  4. package/dist/node/chunks/{dep-13a14c32.js → dep-cfa39351.js} +1 -1
  5. package/dist/node/cli.js +5 -5
  6. package/dist/node/constants.js +1 -1
  7. package/dist/node/index.d.ts +40 -4
  8. package/dist/node/index.js +1 -1
  9. package/dist/node-cjs/publicUtils.cjs +1 -1
  10. package/dist/node-cjs/terser.cjs +1023 -2876
  11. package/package.json +11 -10
  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 -246
  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 -181
  22. package/dist/node/optimizer/optimizer.d.ts +0 -4
  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 -130
  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 -7
  46. package/dist/node/plugins/preAlias.d.ts +0 -6
  47. package/dist/node/plugins/reporter.d.ts +0 -3
  48. package/dist/node/plugins/resolve.d.ts +0 -41
  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 -189
  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,181 +0,0 @@
1
- import type { BuildOptions as EsbuildBuildOptions } from 'esbuild';
2
- import { parse } from 'es-module-lexer';
3
- import type { ResolvedConfig } from '../config';
4
- export { initDepsOptimizer, getDepsOptimizer } from './optimizer';
5
- export declare const debuggerViteDeps: (...args: any[]) => any;
6
- export declare type ExportsData = ReturnType<typeof parse> & {
7
- hasReExports?: true;
8
- jsxLoader?: true;
9
- };
10
- export interface DepsOptimizer {
11
- metadata: DepOptimizationMetadata;
12
- scanProcessing?: Promise<void>;
13
- registerMissingImport: (id: string, resolved: string) => OptimizedDepInfo;
14
- run: () => void;
15
- isOptimizedDepFile: (id: string) => boolean;
16
- isOptimizedDepUrl: (url: string) => boolean;
17
- getOptimizedDepId: (depInfo: OptimizedDepInfo) => string;
18
- options: DepOptimizationOptions;
19
- }
20
- export interface DepOptimizationOptions {
21
- /**
22
- * By default, Vite will crawl your `index.html` to detect dependencies that
23
- * need to be pre-bundled. If `build.rollupOptions.input` is specified, Vite
24
- * will crawl those entry points instead.
25
- *
26
- * If neither of these fit your needs, you can specify custom entries using
27
- * this option - the value should be a fast-glob pattern or array of patterns
28
- * (https://github.com/mrmlnc/fast-glob#basic-syntax) that are relative from
29
- * vite project root. This will overwrite default entries inference.
30
- */
31
- entries?: string | string[];
32
- /**
33
- * Force optimize listed dependencies (must be resolvable import paths,
34
- * cannot be globs).
35
- */
36
- include?: string[];
37
- /**
38
- * Do not optimize these dependencies (must be resolvable import paths,
39
- * cannot be globs).
40
- */
41
- exclude?: string[];
42
- /**
43
- * Force ESM interop when importing for these dependencies. Some legacy
44
- * packages advertise themselves as ESM but use `require` internally
45
- * @experimental
46
- */
47
- needsInterop?: string[];
48
- /**
49
- * Options to pass to esbuild during the dep scanning and optimization
50
- *
51
- * Certain options are omitted since changing them would not be compatible
52
- * with Vite's dep optimization.
53
- *
54
- * - `external` is also omitted, use Vite's `optimizeDeps.exclude` option
55
- * - `plugins` are merged with Vite's dep plugin
56
- *
57
- * https://esbuild.github.io/api
58
- */
59
- esbuildOptions?: Omit<EsbuildBuildOptions, 'bundle' | 'entryPoints' | 'external' | 'write' | 'watch' | 'outdir' | 'outfile' | 'outbase' | 'outExtension' | 'metafile'>;
60
- /**
61
- * List of file extensions that can be optimized. A corresponding esbuild
62
- * plugin must exist to handle the specific extension.
63
- *
64
- * By default, Vite can optimize `.mjs`, `.js`, and `.ts` files. This option
65
- * allows specifying additional extensions.
66
- *
67
- * @experimental
68
- */
69
- extensions?: string[];
70
- /**
71
- * Disables dependencies optimizations, true disables the optimizer during
72
- * build and dev. Pass 'build' or 'dev' to only disable the optimizer in
73
- * one of the modes. Deps optimization is enabled by default in both
74
- * @default false
75
- * @experimental
76
- */
77
- disabled?: boolean | 'build' | 'dev';
78
- }
79
- export interface DepOptimizationResult {
80
- metadata: DepOptimizationMetadata;
81
- /**
82
- * When doing a re-run, if there are newly discovered dependendencies
83
- * the page reload will be delayed until the next rerun so we need
84
- * to be able to discard the result
85
- */
86
- commit: () => Promise<void>;
87
- cancel: () => void;
88
- }
89
- export interface DepOptimizationProcessing {
90
- promise: Promise<void>;
91
- resolve: () => void;
92
- }
93
- export interface OptimizedDepInfo {
94
- id: string;
95
- file: string;
96
- src?: string;
97
- needsInterop?: boolean;
98
- browserHash?: string;
99
- fileHash?: string;
100
- /**
101
- * During optimization, ids can still be resolved to their final location
102
- * but the bundles may not yet be saved to disk
103
- */
104
- processing?: Promise<void>;
105
- /**
106
- * ExportData cache, discovered deps will parse the src entry to get exports
107
- * data used both to define if interop is needed and when pre-bundling
108
- */
109
- exportsData?: Promise<ExportsData>;
110
- }
111
- export interface DepOptimizationMetadata {
112
- /**
113
- * The main hash is determined by user config and dependency lockfiles.
114
- * This is checked on server startup to avoid unnecessary re-bundles.
115
- */
116
- hash: string;
117
- /**
118
- * The browser hash is determined by the main hash plus additional dependencies
119
- * discovered at runtime. This is used to invalidate browser requests to
120
- * optimized deps.
121
- */
122
- browserHash: string;
123
- /**
124
- * Metadata for each already optimized dependency
125
- */
126
- optimized: Record<string, OptimizedDepInfo>;
127
- /**
128
- * Metadata for non-entry optimized chunks and dynamic imports
129
- */
130
- chunks: Record<string, OptimizedDepInfo>;
131
- /**
132
- * Metadata for each newly discovered dependency after processing
133
- */
134
- discovered: Record<string, OptimizedDepInfo>;
135
- /**
136
- * OptimizedDepInfo list
137
- */
138
- depInfoList: OptimizedDepInfo[];
139
- }
140
- /**
141
- * Used by Vite CLI when running `vite optimize`
142
- */
143
- export declare function optimizeDeps(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): Promise<DepOptimizationMetadata>;
144
- export declare function initDepsOptimizerMetadata(config: ResolvedConfig, timestamp?: string): DepOptimizationMetadata;
145
- export declare function addOptimizedDepInfo(metadata: DepOptimizationMetadata, type: 'optimized' | 'discovered' | 'chunks', depInfo: OptimizedDepInfo): OptimizedDepInfo;
146
- /**
147
- * Creates the initial dep optimization metadata, loading it from the deps cache
148
- * if it exists and pre-bundling isn't forced
149
- */
150
- export declare function loadCachedDepOptimizationMetadata(config: ResolvedConfig, force?: boolean | undefined, asCommand?: boolean): DepOptimizationMetadata | undefined;
151
- /**
152
- * Initial optimizeDeps at server start. Perform a fast scan using esbuild to
153
- * find deps to pre-bundle and include user hard-coded dependencies
154
- */
155
- export declare function discoverProjectDependencies(config: ResolvedConfig, timestamp?: string): Promise<Record<string, OptimizedDepInfo>>;
156
- /**
157
- * Create the initial discovered deps list. At build time we only
158
- * have the manually included deps. During dev, a scan phase is
159
- * performed and knownDeps is the list of discovered deps
160
- */
161
- export declare function initialProjectDependencies(config: ResolvedConfig, timestamp?: string, knownDeps?: Record<string, string>): Promise<Record<string, OptimizedDepInfo>>;
162
- export declare function depsLogString(qualifiedIds: string[]): string;
163
- /**
164
- * Internally, Vite uses this function to prepare a optimizeDeps run. When Vite starts, we can get
165
- * the metadata and start the server without waiting for the optimizeDeps processing to be completed
166
- */
167
- export declare function runOptimizeDeps(resolvedConfig: ResolvedConfig, depsInfo: Record<string, OptimizedDepInfo>): Promise<DepOptimizationResult>;
168
- export declare function findKnownImports(config: ResolvedConfig): Promise<string[]>;
169
- export declare function newDepOptimizationProcessing(): DepOptimizationProcessing;
170
- export declare function depsFromOptimizedDepInfo(depsInfo: Record<string, OptimizedDepInfo>): {
171
- [k: string]: string;
172
- };
173
- export declare function getOptimizedDepPath(id: string, config: ResolvedConfig): string;
174
- export declare function getDepsCacheDir(config: ResolvedConfig): string;
175
- export declare function isOptimizedDepFile(id: string, config: ResolvedConfig): boolean;
176
- export declare function createIsOptimizedDepUrl(config: ResolvedConfig): (url: string) => boolean;
177
- export declare function extractExportsData(filePath: string, config: ResolvedConfig): Promise<ExportsData>;
178
- export declare function getDepHash(config: ResolvedConfig): string;
179
- export declare function optimizedDepInfoFromId(metadata: DepOptimizationMetadata, id: string): OptimizedDepInfo | undefined;
180
- export declare function optimizedDepInfoFromFile(metadata: DepOptimizationMetadata, file: string): OptimizedDepInfo | undefined;
181
- export declare function optimizedDepNeedsInterop(metadata: DepOptimizationMetadata, file: string, config: ResolvedConfig): Promise<boolean | undefined>;
@@ -1,4 +0,0 @@
1
- import type { ResolvedConfig, ViteDevServer } from '..';
2
- import type { DepsOptimizer } from '.';
3
- export declare function getDepsOptimizer(config: ResolvedConfig): DepsOptimizer | undefined;
4
- export declare function initDepsOptimizer(config: ResolvedConfig, server?: ViteDevServer): Promise<DepsOptimizer>;
@@ -1,8 +0,0 @@
1
- import type { ResolvedConfig } from '..';
2
- export declare const importsRE: RegExp;
3
- export declare function scanImports(config: ResolvedConfig): Promise<{
4
- deps: Record<string, string>;
5
- missing: Record<string, string>;
6
- }>;
7
- export declare const scriptRE: RegExp;
8
- export declare const commentRE: RegExp;
@@ -1,27 +0,0 @@
1
- import type { ResolvedConfig } from './config';
2
- import type { Plugin } from './plugin';
3
- /** Cache for package.json resolution and package.json contents */
4
- export declare type PackageCache = Map<string, PackageData>;
5
- export interface PackageData {
6
- dir: string;
7
- hasSideEffects: (id: string) => boolean | 'no-treeshake';
8
- webResolvedImports: Record<string, string | undefined>;
9
- nodeResolvedImports: Record<string, string | undefined>;
10
- setResolvedCache: (key: string, entry: string, targetWeb: boolean) => void;
11
- getResolvedCache: (key: string, targetWeb: boolean) => string | undefined;
12
- data: {
13
- [field: string]: any;
14
- name: string;
15
- type: string;
16
- version: string;
17
- main: string;
18
- module: string;
19
- browser: string | Record<string, string | false>;
20
- exports: string | Record<string, any> | string[];
21
- dependencies: Record<string, string>;
22
- };
23
- }
24
- export declare function invalidatePackageData(packageCache: PackageCache, pkgPath: string): void;
25
- export declare function resolvePackageData(id: string, basedir: string, preserveSymlinks?: boolean, packageCache?: PackageCache): PackageData | null;
26
- export declare function loadPackageData(pkgPath: string, preserveSymlinks?: boolean, packageCache?: PackageCache): PackageData;
27
- export declare function watchPackageDataPlugin(config: ResolvedConfig): Plugin;
@@ -1,130 +0,0 @@
1
- import type { CustomPluginOptions, LoadResult, PluginContext, ResolveIdResult, Plugin as RollupPlugin, TransformPluginContext, TransformResult } from 'rollup';
2
- export type { PluginContext } from 'rollup';
3
- import type { UserConfig } from './config';
4
- import type { ServerHook } from './server';
5
- import type { IndexHtmlTransform } from './plugins/html';
6
- import type { ModuleNode } from './server/moduleGraph';
7
- import type { HmrContext } from './server/hmr';
8
- import type { PreviewServerHook } from './preview';
9
- import type { ConfigEnv, ResolvedConfig } from './';
10
- /**
11
- * Vite plugins extends the Rollup plugin interface with a few extra
12
- * vite-specific options. A valid vite plugin is also a valid Rollup plugin.
13
- * On the contrary, a Rollup plugin may or may NOT be a valid vite universal
14
- * plugin, since some Rollup features do not make sense in an unbundled
15
- * dev server context. That said, as long as a rollup plugin doesn't have strong
16
- * coupling between its bundle phase and output phase hooks then it should
17
- * just work (that means, most of them).
18
- *
19
- * By default, the plugins are run during both serve and build. When a plugin
20
- * is applied during serve, it will only run **non output plugin hooks** (see
21
- * rollup type definition of {@link rollup#PluginHooks}). You can think of the
22
- * dev server as only running `const bundle = rollup.rollup()` but never calling
23
- * `bundle.generate()`.
24
- *
25
- * A plugin that expects to have different behavior depending on serve/build can
26
- * export a factory function that receives the command being run via options.
27
- *
28
- * If a plugin should be applied only for server or build, a function format
29
- * config file can be used to conditional determine the plugins to use.
30
- */
31
- export interface Plugin extends RollupPlugin {
32
- /**
33
- * Enforce plugin invocation tier similar to webpack loaders.
34
- *
35
- * Plugin invocation order:
36
- * - alias resolution
37
- * - `enforce: 'pre'` plugins
38
- * - vite core plugins
39
- * - normal plugins
40
- * - vite build plugins
41
- * - `enforce: 'post'` plugins
42
- * - vite build post plugins
43
- */
44
- enforce?: 'pre' | 'post';
45
- /**
46
- * Apply the plugin only for serve or build, or on certain conditions.
47
- */
48
- apply?: 'serve' | 'build' | ((config: UserConfig, env: ConfigEnv) => boolean);
49
- /**
50
- * Modify vite config before it's resolved. The hook can either mutate the
51
- * passed-in config directly, or return a partial config object that will be
52
- * deeply merged into existing config.
53
- *
54
- * Note: User plugins are resolved before running this hook so injecting other
55
- * plugins inside the `config` hook will have no effect.
56
- */
57
- config?: (config: UserConfig, env: ConfigEnv) => UserConfig | null | void | Promise<UserConfig | null | void>;
58
- /**
59
- * Use this hook to read and store the final resolved vite config.
60
- */
61
- configResolved?: (config: ResolvedConfig) => void | Promise<void>;
62
- /**
63
- * Configure the vite server. The hook receives the {@link ViteDevServer}
64
- * instance. This can also be used to store a reference to the server
65
- * for use in other hooks.
66
- *
67
- * The hooks will be called before internal middlewares are applied. A hook
68
- * can return a post hook that will be called after internal middlewares
69
- * are applied. Hook can be async functions and will be called in series.
70
- */
71
- configureServer?: ServerHook;
72
- /**
73
- * Configure the preview server. The hook receives the connect server and
74
- * its underlying http server.
75
- *
76
- * The hooks are called before other middlewares are applied. A hook can
77
- * return a post hook that will be called after other middlewares are
78
- * applied. Hooks can be async functions and will be called in series.
79
- */
80
- configurePreviewServer?: PreviewServerHook;
81
- /**
82
- * Transform index.html.
83
- * The hook receives the following arguments:
84
- *
85
- * - html: string
86
- * - ctx?: vite.ServerContext (only present during serve)
87
- * - bundle?: rollup.OutputBundle (only present during build)
88
- *
89
- * It can either return a transformed string, or a list of html tag
90
- * descriptors that will be injected into the <head> or <body>.
91
- *
92
- * By default the transform is applied **after** vite's internal html
93
- * transform. If you need to apply the transform before vite, use an object:
94
- * `{ enforce: 'pre', transform: hook }`
95
- */
96
- transformIndexHtml?: IndexHtmlTransform;
97
- /**
98
- * Perform custom handling of HMR updates.
99
- * The handler receives a context containing changed filename, timestamp, a
100
- * list of modules affected by the file change, and the dev server instance.
101
- *
102
- * - The hook can return a filtered list of modules to narrow down the update.
103
- * e.g. for a Vue SFC, we can narrow down the part to update by comparing
104
- * the descriptors.
105
- *
106
- * - The hook can also return an empty array and then perform custom updates
107
- * by sending a custom hmr payload via server.ws.send().
108
- *
109
- * - If the hook doesn't return a value, the hmr update will be performed as
110
- * normal.
111
- */
112
- handleHotUpdate?(ctx: HmrContext): Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>;
113
- /**
114
- * extend hooks with ssr flag
115
- */
116
- resolveId?(this: PluginContext, source: string, importer: string | undefined, options: {
117
- custom?: CustomPluginOptions;
118
- ssr?: boolean;
119
- /**
120
- * @internal
121
- */
122
- scan?: boolean;
123
- }): Promise<ResolveIdResult> | ResolveIdResult;
124
- load?(this: PluginContext, id: string, options?: {
125
- ssr?: boolean;
126
- }): Promise<LoadResult> | LoadResult;
127
- transform?(this: TransformPluginContext, code: string, id: string, options?: {
128
- ssr?: boolean;
129
- }): Promise<TransformResult> | TransformResult;
130
- }
@@ -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;