vite 3.0.0-alpha.3 → 3.0.0-alpha.6

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 (82) hide show
  1. package/dist/node/chunks/{dep-24157481.js → dep-17430d09.js} +0 -0
  2. package/dist/node/chunks/{dep-6f5ac69c.js → dep-52974b5a.js} +33902 -33579
  3. package/dist/node/chunks/{dep-b1fc04c1.js → dep-8bed6f50.js} +1 -1
  4. package/dist/node/chunks/{dep-5eede05c.js → dep-a4f17494.js} +1 -1
  5. package/dist/node/chunks/{dep-da8244f4.js → dep-b4474709.js} +100 -47
  6. package/dist/node/cli.js +7 -5
  7. package/dist/node/constants.js +1 -1
  8. package/dist/node/index.d.ts +117 -13
  9. package/dist/node/index.js +1 -1
  10. package/dist/node-cjs/publicUtils.cjs +0 -11
  11. package/package.json +11 -9
  12. package/types/es-module-lexer.d.ts +90 -0
  13. package/dist/node/build.d.ts +0 -178
  14. package/dist/node/certificate.d.ts +0 -2
  15. package/dist/node/cli.d.ts +0 -1
  16. package/dist/node/config.d.ts +0 -240
  17. package/dist/node/constants.d.ts +0 -35
  18. package/dist/node/env.d.ts +0 -3
  19. package/dist/node/http.d.ts +0 -88
  20. package/dist/node/logger.d.ts +0 -31
  21. package/dist/node/optimizer/esbuildDepPlugin.d.ts +0 -4
  22. package/dist/node/optimizer/index.d.ts +0 -154
  23. package/dist/node/optimizer/registerMissing.d.ts +0 -3
  24. package/dist/node/optimizer/scan.d.ts +0 -8
  25. package/dist/node/packages.d.ts +0 -27
  26. package/dist/node/plugin.d.ts +0 -129
  27. package/dist/node/plugins/asset.d.ts +0 -68
  28. package/dist/node/plugins/assetImportMetaUrl.d.ts +0 -13
  29. package/dist/node/plugins/clientInjections.d.ts +0 -7
  30. package/dist/node/plugins/css.d.ts +0 -86
  31. package/dist/node/plugins/dataUri.d.ts +0 -5
  32. package/dist/node/plugins/define.d.ts +0 -3
  33. package/dist/node/plugins/dynamicImportVars.d.ts +0 -9
  34. package/dist/node/plugins/ensureWatch.d.ts +0 -5
  35. package/dist/node/plugins/esbuild.d.ts +0 -15
  36. package/dist/node/plugins/html.d.ts +0 -120
  37. package/dist/node/plugins/importAnalysis.d.ts +0 -47
  38. package/dist/node/plugins/importAnalysisBuild.d.ts +0 -16
  39. package/dist/node/plugins/importMetaGlob.d.ts +0 -34
  40. package/dist/node/plugins/index.d.ts +0 -3
  41. package/dist/node/plugins/json.d.ts +0 -23
  42. package/dist/node/plugins/loadFallback.d.ts +0 -5
  43. package/dist/node/plugins/manifest.d.ts +0 -14
  44. package/dist/node/plugins/metadata.d.ts +0 -9
  45. package/dist/node/plugins/modulePreloadPolyfill.d.ts +0 -4
  46. package/dist/node/plugins/optimizedDeps.d.ts +0 -4
  47. package/dist/node/plugins/preAlias.d.ts +0 -5
  48. package/dist/node/plugins/reporter.d.ts +0 -3
  49. package/dist/node/plugins/resolve.d.ts +0 -39
  50. package/dist/node/plugins/splitVendorChunk.d.ts +0 -12
  51. package/dist/node/plugins/ssrRequireHook.d.ts +0 -12
  52. package/dist/node/plugins/terser.d.ts +0 -3
  53. package/dist/node/plugins/wasm.d.ts +0 -4
  54. package/dist/node/plugins/worker.d.ts +0 -9
  55. package/dist/node/plugins/workerImportMetaUrl.d.ts +0 -3
  56. package/dist/node/preview.d.ts +0 -33
  57. package/dist/node/publicUtils.d.ts +0 -11
  58. package/dist/node/server/hmr.d.ts +0 -39
  59. package/dist/node/server/index.d.ts +0 -198
  60. package/dist/node/server/middlewares/base.d.ts +0 -3
  61. package/dist/node/server/middlewares/compression.d.ts +0 -1
  62. package/dist/node/server/middlewares/error.d.ts +0 -8
  63. package/dist/node/server/middlewares/indexHtml.d.ts +0 -4
  64. package/dist/node/server/middlewares/proxy.d.ts +0 -20
  65. package/dist/node/server/middlewares/spaFallback.d.ts +0 -2
  66. package/dist/node/server/middlewares/static.d.ts +0 -6
  67. package/dist/node/server/middlewares/time.d.ts +0 -2
  68. package/dist/node/server/middlewares/transform.d.ts +0 -3
  69. package/dist/node/server/moduleGraph.d.ts +0 -55
  70. package/dist/node/server/openBrowser.d.ts +0 -15
  71. package/dist/node/server/pluginContainer.d.ts +0 -41
  72. package/dist/node/server/searchRoot.d.ts +0 -8
  73. package/dist/node/server/send.d.ts +0 -10
  74. package/dist/node/server/sourcemap.d.ts +0 -11
  75. package/dist/node/server/transformRequest.d.ts +0 -14
  76. package/dist/node/server/ws.d.ts +0 -55
  77. package/dist/node/ssr/ssrExternal.d.ts +0 -11
  78. package/dist/node/ssr/ssrManifestPlugin.d.ts +0 -3
  79. package/dist/node/ssr/ssrModuleLoader.d.ts +0 -7
  80. package/dist/node/ssr/ssrStacktrace.d.ts +0 -3
  81. package/dist/node/ssr/ssrTransform.d.ts +0 -14
  82. package/dist/node/utils.d.ts +0 -144
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "3.0.0-alpha.3",
3
+ "version": "3.0.0-alpha.6",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -20,6 +20,7 @@
20
20
  "./client": {
21
21
  "types": "./client.d.ts"
22
22
  },
23
+ "./dist/client/*": "./dist/client/*",
23
24
  "./terser": {
24
25
  "require": "./dist/node-cjs/terser.cjs"
25
26
  }
@@ -48,10 +49,11 @@
48
49
  "dev": "rimraf dist && pnpm run build-bundle -w",
49
50
  "build": "rimraf dist && run-s build-bundle build-types",
50
51
  "build-bundle": "rollup --config rollup.config.ts --configPlugin typescript",
51
- "build-types": "run-s build-temp-types patch-types roll-types",
52
+ "build-types": "run-s build-temp-types patch-types roll-types check-dist-types",
52
53
  "build-temp-types": "tsc --emitDeclarationOnly --outDir temp/node -p src/node",
53
54
  "patch-types": "esno scripts/patchTypes.ts",
54
55
  "roll-types": "api-extractor run && rimraf temp",
56
+ "check-dist-types": "tsc --project tsconfig.check.json",
55
57
  "lint": "eslint --ext .ts src/**",
56
58
  "format": "prettier --write --parser typescript \"src/**/*.ts\"",
57
59
  "prepublishOnly": "npm run build"
@@ -59,7 +61,7 @@
59
61
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
60
62
  "dependencies": {
61
63
  "esbuild": "^0.14.38",
62
- "postcss": "^8.4.13",
64
+ "postcss": "^8.4.14",
63
65
  "resolve": "^1.22.0",
64
66
  "rollup": "^2.72.1"
65
67
  },
@@ -68,17 +70,17 @@
68
70
  },
69
71
  "devDependencies": {
70
72
  "@ampproject/remapping": "^2.2.0",
71
- "@babel/parser": "^7.17.10",
72
- "@babel/types": "^7.17.10",
73
- "@jridgewell/trace-mapping": "^0.3.10",
73
+ "@babel/parser": "^7.18.0",
74
+ "@babel/types": "^7.18.0",
75
+ "@jridgewell/trace-mapping": "^0.3.13",
74
76
  "@rollup/plugin-alias": "^3.1.9",
75
77
  "@rollup/plugin-commonjs": "^21.1.0",
76
78
  "@rollup/plugin-dynamic-import-vars": "^1.4.3",
77
79
  "@rollup/plugin-json": "^4.1.0",
78
- "@rollup/plugin-node-resolve": "13.2.1",
80
+ "@rollup/plugin-node-resolve": "13.3.0",
79
81
  "@rollup/plugin-typescript": "^8.3.2",
80
82
  "@rollup/pluginutils": "^4.2.1",
81
- "@vue/compiler-dom": "^3.2.33",
83
+ "@vue/compiler-dom": "^3.2.35",
82
84
  "acorn": "^8.7.1",
83
85
  "cac": "6.7.9",
84
86
  "chokidar": "^3.5.3",
@@ -98,7 +100,7 @@
98
100
  "http-proxy": "^1.18.1",
99
101
  "json5": "^2.2.1",
100
102
  "launch-editor-middleware": "^2.3.0",
101
- "magic-string": "^0.26.1",
103
+ "magic-string": "^0.26.2",
102
104
  "micromatch": "^4.0.5",
103
105
  "mrmime": "^1.0.0",
104
106
  "node-forge": "^1.3.1",
@@ -0,0 +1,90 @@
1
+ // Modified and inlined to avoid extra dependency
2
+ // Source: https://github.com/guybedford/es-module-lexer/blob/main/types/lexer.d.ts
3
+ // MIT Licensed https://github.com/guybedford/es-module-lexer/blob/main/LICENSE
4
+
5
+ export interface ImportSpecifier {
6
+ /**
7
+ * Module name
8
+ *
9
+ * To handle escape sequences in specifier strings, the .n field of imported specifiers will be provided where possible.
10
+ *
11
+ * For dynamic import expressions, this field will be empty if not a valid JS string.
12
+ *
13
+ * @example
14
+ * const [imports1, exports1] = parse(String.raw`import './\u0061\u0062.js'`);
15
+ * imports1[0].n;
16
+ * // Returns "./ab.js"
17
+ *
18
+ * const [imports2, exports2] = parse(`import("./ab.js")`);
19
+ * imports2[0].n;
20
+ * // Returns "./ab.js"
21
+ *
22
+ * const [imports3, exports3] = parse(`import("./" + "ab.js")`);
23
+ * imports3[0].n;
24
+ * // Returns undefined
25
+ */
26
+ readonly n: string | undefined
27
+ /**
28
+ * Start of module specifier
29
+ *
30
+ * @example
31
+ * const source = `import { a } from 'asdf'`;
32
+ * const [imports, exports] = parse(source);
33
+ * source.substring(imports[0].s, imports[0].e);
34
+ * // Returns "asdf"
35
+ */
36
+ readonly s: number
37
+ /**
38
+ * End of module specifier
39
+ */
40
+ readonly e: number
41
+
42
+ /**
43
+ * Start of import statement
44
+ *
45
+ * @example
46
+ * const source = `import { a } from 'asdf'`;
47
+ * const [imports, exports] = parse(source);
48
+ * source.substring(imports[0].ss, imports[0].se);
49
+ * // Returns `"import { a } from 'asdf';"`
50
+ */
51
+ readonly ss: number
52
+ /**
53
+ * End of import statement
54
+ */
55
+ readonly se: number
56
+
57
+ /**
58
+ * If this import statement is a dynamic import, this is the start value.
59
+ * Otherwise this is `-1`.
60
+ */
61
+ readonly d: number
62
+
63
+ /**
64
+ * If this import has an import assertion, this is the start value.
65
+ * Otherwise this is `-1`.
66
+ */
67
+ readonly a: number
68
+ }
69
+
70
+ /**
71
+ * Wait for init to resolve before calling `parse`.
72
+ */
73
+ export const init: Promise<void>
74
+
75
+ /**
76
+ * Outputs the list of exports and locations of import specifiers,
77
+ * including dynamic import and import meta handling.
78
+ *
79
+ * @param source - Source code to parser
80
+ * @param name - Optional sourcename
81
+ * @returns Tuple contaning imports list and exports list.
82
+ */
83
+ export function parse(
84
+ source: string,
85
+ name?: string
86
+ ): readonly [
87
+ imports: ReadonlyArray<ImportSpecifier>,
88
+ exports: ReadonlyArray<string>,
89
+ facade: boolean
90
+ ]
@@ -1,178 +0,0 @@
1
- import type { ModuleFormat, Plugin, RollupOptions, RollupOutput, RollupWarning, RollupWatcher, WarningHandler, WatcherOptions } from 'rollup';
2
- import type { Terser } from 'types/terser';
3
- import type { RollupCommonJSOptions } from 'types/commonjs';
4
- import type { RollupDynamicImportVarsOptions } from 'types/dynamicImportVars';
5
- import type { TransformOptions } from 'esbuild';
6
- import type { InlineConfig, ResolvedConfig } from './config';
7
- export interface BuildOptions {
8
- /**
9
- * Compatibility transform target. The transform is performed with esbuild
10
- * and the lowest supported target is es2015/es6. Note this only handles
11
- * syntax transformation and does not cover polyfills (except for dynamic
12
- * import)
13
- *
14
- * Default: 'modules' - Similar to `@babel/preset-env`'s targets.esmodules,
15
- * transpile targeting browsers that natively support dynamic es module imports.
16
- * https://caniuse.com/es6-module-dynamic-import
17
- *
18
- * Another special value is 'esnext' - which only performs minimal transpiling
19
- * (for minification compat) and assumes native dynamic imports support.
20
- *
21
- * For custom targets, see https://esbuild.github.io/api/#target and
22
- * https://esbuild.github.io/content-types/#javascript for more details.
23
- */
24
- target?: 'modules' | TransformOptions['target'] | false;
25
- /**
26
- * whether to inject module preload polyfill.
27
- * Note: does not apply to library mode.
28
- * @default true
29
- */
30
- polyfillModulePreload?: boolean;
31
- /**
32
- * Directory relative from `root` where build output will be placed. If the
33
- * directory exists, it will be removed before the build.
34
- * @default 'dist'
35
- */
36
- outDir?: string;
37
- /**
38
- * Directory relative from `outDir` where the built js/css/image assets will
39
- * be placed.
40
- * @default 'assets'
41
- */
42
- assetsDir?: string;
43
- /**
44
- * Static asset files smaller than this number (in bytes) will be inlined as
45
- * base64 strings. Default limit is `4096` (4kb). Set to `0` to disable.
46
- * @default 4096
47
- */
48
- assetsInlineLimit?: number;
49
- /**
50
- * Whether to code-split CSS. When enabled, CSS in async chunks will be
51
- * inlined as strings in the chunk and inserted via dynamically created
52
- * style tags when the chunk is loaded.
53
- * @default true
54
- */
55
- cssCodeSplit?: boolean;
56
- /**
57
- * An optional separate target for CSS minification.
58
- * As esbuild only supports configuring targets to mainstream
59
- * browsers, users may need this option when they are targeting
60
- * a niche browser that comes with most modern JavaScript features
61
- * but has poor CSS support, e.g. Android WeChat WebView, which
62
- * doesn't support the #RGBA syntax.
63
- */
64
- cssTarget?: TransformOptions['target'] | false;
65
- /**
66
- * If `true`, a separate sourcemap file will be created. If 'inline', the
67
- * sourcemap will be appended to the resulting output file as data URI.
68
- * 'hidden' works like `true` except that the corresponding sourcemap
69
- * comments in the bundled files are suppressed.
70
- * @default false
71
- */
72
- sourcemap?: boolean | 'inline' | 'hidden';
73
- /**
74
- * Set to `false` to disable minification, or specify the minifier to use.
75
- * Available options are 'terser' or 'esbuild'.
76
- * @default 'esbuild'
77
- */
78
- minify?: boolean | 'terser' | 'esbuild';
79
- /**
80
- * Options for terser
81
- * https://terser.org/docs/api-reference#minify-options
82
- */
83
- terserOptions?: Terser.MinifyOptions;
84
- /**
85
- * Will be merged with internal rollup options.
86
- * https://rollupjs.org/guide/en/#big-list-of-options
87
- */
88
- rollupOptions?: RollupOptions;
89
- /**
90
- * Options to pass on to `@rollup/plugin-commonjs`
91
- */
92
- commonjsOptions?: RollupCommonJSOptions;
93
- /**
94
- * Options to pass on to `@rollup/plugin-dynamic-import-vars`
95
- */
96
- dynamicImportVarsOptions?: RollupDynamicImportVarsOptions;
97
- /**
98
- * Whether to write bundle to disk
99
- * @default true
100
- */
101
- write?: boolean;
102
- /**
103
- * Empty outDir on write.
104
- * @default true when outDir is a sub directory of project root
105
- */
106
- emptyOutDir?: boolean | null;
107
- /**
108
- * Whether to emit a manifest.json under assets dir to map hash-less filenames
109
- * to their hashed versions. Useful when you want to generate your own HTML
110
- * instead of using the one generated by Vite.
111
- *
112
- * Example:
113
- *
114
- * ```json
115
- * {
116
- * "main.js": {
117
- * "file": "main.68fe3fad.js",
118
- * "css": "main.e6b63442.css",
119
- * "imports": [...],
120
- * "dynamicImports": [...]
121
- * }
122
- * }
123
- * ```
124
- * @default false
125
- */
126
- manifest?: boolean | string;
127
- /**
128
- * Build in library mode. The value should be the global name of the lib in
129
- * UMD mode. This will produce esm + cjs + umd bundle formats with default
130
- * configurations that are suitable for distributing libraries.
131
- */
132
- lib?: LibraryOptions | false;
133
- /**
134
- * Produce SSR oriented build. Note this requires specifying SSR entry via
135
- * `rollupOptions.input`.
136
- */
137
- ssr?: boolean | string;
138
- /**
139
- * Generate SSR manifest for determining style links and asset preload
140
- * directives in production.
141
- */
142
- ssrManifest?: boolean | string;
143
- /**
144
- * Set to false to disable reporting compressed chunk sizes.
145
- * Can slightly improve build speed.
146
- */
147
- reportCompressedSize?: boolean;
148
- /**
149
- * Adjust chunk size warning limit (in kbs).
150
- * @default 500
151
- */
152
- chunkSizeWarningLimit?: number;
153
- /**
154
- * Rollup watch options
155
- * https://rollupjs.org/guide/en/#watchoptions
156
- */
157
- watch?: WatcherOptions | null;
158
- }
159
- export interface LibraryOptions {
160
- entry: string;
161
- name?: string;
162
- formats?: LibraryFormats[];
163
- fileName?: string | ((format: ModuleFormat) => string);
164
- }
165
- export declare type LibraryFormats = 'es' | 'cjs' | 'umd' | 'iife';
166
- export declare type ResolvedBuildOptions = Required<BuildOptions>;
167
- export declare function resolveBuildOptions(raw?: BuildOptions): ResolvedBuildOptions;
168
- export declare function resolveBuildPlugins(config: ResolvedConfig): {
169
- pre: Plugin[];
170
- post: Plugin[];
171
- };
172
- /**
173
- * Bundles the app for production.
174
- * Returns a Promise containing the build result.
175
- */
176
- export declare function build(inlineConfig?: InlineConfig): Promise<RollupOutput | RollupOutput[] | RollupWatcher>;
177
- export declare function resolveLibFilename(libOptions: LibraryOptions, format: ModuleFormat, root: string): string;
178
- export declare function onRollupWarning(warning: RollupWarning, warn: WarningHandler, config: ResolvedConfig): void;
@@ -1,2 +0,0 @@
1
- import 'node-forge/lib/pki';
2
- export declare function createCertificate(): string;
@@ -1 +0,0 @@
1
- export {};
@@ -1,240 +0,0 @@
1
- import type { Alias, AliasOptions } from 'types/alias';
2
- import type { RollupOptions } from 'rollup';
3
- import type { Plugin } from './plugin';
4
- import type { BuildOptions, ResolvedBuildOptions } from './build';
5
- import type { ResolvedServerOptions, ServerOptions } from './server';
6
- import type { PreviewOptions, ResolvedPreviewOptions } from './preview';
7
- import type { CSSOptions } from './plugins/css';
8
- import type { ESBuildOptions } from './plugins/esbuild';
9
- import type { InternalResolveOptions, ResolveOptions } from './plugins/resolve';
10
- import type { LogLevel, Logger } from './logger';
11
- import type { DepOptimizationOptions } from './optimizer';
12
- import type { JsonOptions } from './plugins/json';
13
- import type { PackageCache } from './packages';
14
- export interface ConfigEnv {
15
- command: 'build' | 'serve';
16
- mode: string;
17
- }
18
- export declare type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise<UserConfig>;
19
- export declare type UserConfigExport = UserConfig | Promise<UserConfig> | UserConfigFn;
20
- /**
21
- * Type helper to make it easier to use vite.config.ts
22
- * accepts a direct {@link UserConfig} object, or a function that returns it.
23
- * The function receives a {@link ConfigEnv} object that exposes two properties:
24
- * `command` (either `'build'` or `'serve'`), and `mode`.
25
- */
26
- export declare function defineConfig(config: UserConfigExport): UserConfigExport;
27
- export declare type PluginOption = Plugin | false | null | undefined | PluginOption[];
28
- export interface UserConfig {
29
- /**
30
- * Project root directory. Can be an absolute path, or a path relative from
31
- * the location of the config file itself.
32
- * @default process.cwd()
33
- */
34
- root?: string;
35
- /**
36
- * Base public path when served in development or production.
37
- * @default '/'
38
- */
39
- base?: string;
40
- /**
41
- * Directory to serve as plain static assets. Files in this directory are
42
- * served and copied to build dist dir as-is without transform. The value
43
- * can be either an absolute file system path or a path relative to <root>.
44
- *
45
- * Set to `false` or an empty string to disable copied static assets to build dist dir.
46
- * @default 'public'
47
- */
48
- publicDir?: string | false;
49
- /**
50
- * Directory to save cache files. Files in this directory are pre-bundled
51
- * deps or some other cache files that generated by vite, which can improve
52
- * the performance. You can use `--force` flag or manually delete the directory
53
- * to regenerate the cache files. The value can be either an absolute file
54
- * system path or a path relative to <root>.
55
- * Default to `.vite` when no `package.json` is detected.
56
- * @default 'node_modules/.vite'
57
- */
58
- cacheDir?: string;
59
- /**
60
- * Explicitly set a mode to run in. This will override the default mode for
61
- * each command, and can be overridden by the command line --mode option.
62
- */
63
- mode?: string;
64
- /**
65
- * Define global variable replacements.
66
- * Entries will be defined on `window` during dev and replaced during build.
67
- */
68
- define?: Record<string, any>;
69
- /**
70
- * Array of vite plugins to use.
71
- */
72
- plugins?: PluginOption[];
73
- /**
74
- * Configure resolver
75
- */
76
- resolve?: ResolveOptions & {
77
- alias?: AliasOptions;
78
- };
79
- /**
80
- * CSS related options (preprocessors and CSS modules)
81
- */
82
- css?: CSSOptions;
83
- /**
84
- * JSON loading options
85
- */
86
- json?: JsonOptions;
87
- /**
88
- * Transform options to pass to esbuild.
89
- * Or set to `false` to disable esbuild.
90
- */
91
- esbuild?: ESBuildOptions | false;
92
- /**
93
- * Specify additional picomatch patterns to be treated as static assets.
94
- */
95
- assetsInclude?: string | RegExp | (string | RegExp)[];
96
- /**
97
- * Server specific options, e.g. host, port, https...
98
- */
99
- server?: ServerOptions;
100
- /**
101
- * Build specific options
102
- */
103
- build?: BuildOptions;
104
- /**
105
- * Preview specific options, e.g. host, port, https...
106
- */
107
- preview?: PreviewOptions;
108
- /**
109
- * Dep optimization options
110
- */
111
- optimizeDeps?: DepOptimizationOptions;
112
- /**
113
- * SSR specific options
114
- */
115
- ssr?: SSROptions;
116
- /**
117
- * Experimental features
118
- *
119
- * Features under this field are addressed to be changed that might NOT follow semver.
120
- * Please be careful and always pin Vite's version when using them.
121
- * @experimental
122
- */
123
- experimental?: ExperimentalOptions;
124
- /**
125
- * Log level.
126
- * Default: 'info'
127
- */
128
- logLevel?: LogLevel;
129
- /**
130
- * Custom logger.
131
- */
132
- customLogger?: Logger;
133
- /**
134
- * Default: true
135
- */
136
- clearScreen?: boolean;
137
- /**
138
- * Environment files directory. Can be an absolute path, or a path relative from
139
- * the location of the config file itself.
140
- * @default root
141
- */
142
- envDir?: string;
143
- /**
144
- * Env variables starts with `envPrefix` will be exposed to your client source code via import.meta.env.
145
- * @default 'VITE_'
146
- */
147
- envPrefix?: string | string[];
148
- /**
149
- * Worker bundle options
150
- */
151
- worker?: {
152
- /**
153
- * Output format for worker bundle
154
- * @default 'iife'
155
- */
156
- format?: 'es' | 'iife';
157
- /**
158
- * Vite plugins that apply to worker bundle
159
- */
160
- plugins?: PluginOption[];
161
- /**
162
- * Rollup options to build worker bundle
163
- */
164
- rollupOptions?: Omit<RollupOptions, 'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures'>;
165
- };
166
- /**
167
- * Whether your application is a Single Page Application (SPA). Set to `false`
168
- * for other kinds of apps like MPAs.
169
- * @default true
170
- */
171
- spa?: boolean;
172
- }
173
- export interface ExperimentalOptions {
174
- /**
175
- * Append fake `&lang.(ext)` when queries are specified, to preseve the file extension for following plugins to process.
176
- *
177
- * @experimental
178
- * @default false
179
- */
180
- importGlobRestoreExtension?: boolean;
181
- }
182
- export declare type SSRTarget = 'node' | 'webworker';
183
- export interface SSROptions {
184
- external?: string[];
185
- noExternal?: string | RegExp | (string | RegExp)[] | true;
186
- /**
187
- * Define the target for the ssr build. The browser field in package.json
188
- * is ignored for node but used if webworker is the target
189
- * Default: 'node'
190
- */
191
- target?: SSRTarget;
192
- }
193
- export interface ResolveWorkerOptions {
194
- format: 'es' | 'iife';
195
- plugins: Plugin[];
196
- rollupOptions: RollupOptions;
197
- }
198
- export interface InlineConfig extends UserConfig {
199
- configFile?: string | false;
200
- envFile?: false;
201
- }
202
- export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'assetsInclude' | 'optimizeDeps' | 'worker'> & {
203
- configFile: string | undefined;
204
- configFileDependencies: string[];
205
- inlineConfig: InlineConfig;
206
- root: string;
207
- base: string;
208
- publicDir: string;
209
- cacheDir: string;
210
- command: 'build' | 'serve';
211
- mode: string;
212
- isWorker: boolean;
213
- /** @internal */
214
- mainConfig: ResolvedConfig | null;
215
- isProduction: boolean;
216
- env: Record<string, any>;
217
- resolve: ResolveOptions & {
218
- alias: Alias[];
219
- };
220
- plugins: readonly Plugin[];
221
- server: ResolvedServerOptions;
222
- build: ResolvedBuildOptions;
223
- preview: ResolvedPreviewOptions;
224
- assetsInclude: (file: string) => boolean;
225
- logger: Logger;
226
- createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
227
- optimizeDeps: DepOptimizationOptions;
228
- /** @internal */
229
- packageCache: PackageCache;
230
- worker: ResolveWorkerOptions;
231
- spa: boolean;
232
- }>;
233
- export declare type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
234
- export declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string): Promise<ResolvedConfig>;
235
- export declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
236
- export declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel): Promise<{
237
- path: string;
238
- config: UserConfig;
239
- dependencies: string[];
240
- } | null>;
@@ -1,35 +0,0 @@
1
- export declare const VERSION: string;
2
- export declare const DEFAULT_MAIN_FIELDS: string[];
3
- export declare const DEFAULT_EXTENSIONS: string[];
4
- export declare const JS_TYPES_RE: RegExp;
5
- export declare const OPTIMIZABLE_ENTRY_RE: RegExp;
6
- export declare const SPECIAL_QUERY_RE: RegExp;
7
- /**
8
- * Prefix for resolved fs paths, since windows paths may not be valid as URLs.
9
- */
10
- export declare const FS_PREFIX = "/@fs/";
11
- /**
12
- * Prefix for resolved Ids that are not valid browser import specifiers
13
- */
14
- export declare const VALID_ID_PREFIX = "/@id/";
15
- /**
16
- * Plugins that use 'virtual modules' (e.g. for helper functions), prefix the
17
- * module ID with `\0`, a convention from the rollup ecosystem.
18
- * This prevents other plugins from trying to process the id (like node resolution),
19
- * and core features like sourcemaps can use this info to differentiate between
20
- * virtual modules and regular files.
21
- * `\0` is not a permitted char in import URLs so we have to replace them during
22
- * import analysis. The id will be decoded back before entering the plugins pipeline.
23
- * These encoded virtual ids are also prefixed by the VALID_ID_PREFIX, so virtual
24
- * modules in the browser end up encoded as `/@id/__x00__{id}`
25
- */
26
- export declare const NULL_BYTE_PLACEHOLDER = "__x00__";
27
- export declare const CLIENT_PUBLIC_PATH = "/@vite/client";
28
- export declare const ENV_PUBLIC_PATH = "/@vite/env";
29
- export declare const VITE_PACKAGE_DIR: string;
30
- export declare const CLIENT_ENTRY: string;
31
- export declare const ENV_ENTRY: string;
32
- export declare const CLIENT_DIR: string;
33
- export declare const KNOWN_ASSET_TYPES: string[];
34
- export declare const DEFAULT_ASSETS_RE: RegExp;
35
- export declare const DEP_VERSION_RE: RegExp;
@@ -1,3 +0,0 @@
1
- import type { UserConfig } from './config';
2
- export declare function loadEnv(mode: string, envDir: string, prefixes?: string | string[]): Record<string, string>;
3
- export declare function resolveEnvPrefix({ envPrefix }: UserConfig): string[];