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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "3.0.0-alpha.5",
3
+ "version": "3.0.0-alpha.8",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -49,10 +49,11 @@
49
49
  "dev": "rimraf dist && pnpm run build-bundle -w",
50
50
  "build": "rimraf dist && run-s build-bundle build-types",
51
51
  "build-bundle": "rollup --config rollup.config.ts --configPlugin typescript",
52
- "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",
53
53
  "build-temp-types": "tsc --emitDeclarationOnly --outDir temp/node -p src/node",
54
54
  "patch-types": "esno scripts/patchTypes.ts",
55
55
  "roll-types": "api-extractor run && rimraf temp",
56
+ "check-dist-types": "tsc --project tsconfig.check.json",
56
57
  "lint": "eslint --ext .ts src/**",
57
58
  "format": "prettier --write --parser typescript \"src/**/*.ts\"",
58
59
  "prepublishOnly": "npm run build"
@@ -69,8 +70,8 @@
69
70
  },
70
71
  "devDependencies": {
71
72
  "@ampproject/remapping": "^2.2.0",
72
- "@babel/parser": "^7.18.0",
73
- "@babel/types": "^7.18.0",
73
+ "@babel/parser": "^7.18.4",
74
+ "@babel/types": "^7.18.4",
74
75
  "@jridgewell/trace-mapping": "^0.3.13",
75
76
  "@rollup/plugin-alias": "^3.1.9",
76
77
  "@rollup/plugin-commonjs": "^21.1.0",
@@ -79,7 +80,7 @@
79
80
  "@rollup/plugin-node-resolve": "13.3.0",
80
81
  "@rollup/plugin-typescript": "^8.3.2",
81
82
  "@rollup/pluginutils": "^4.2.1",
82
- "@vue/compiler-dom": "^3.2.35",
83
+ "@vue/compiler-dom": "^3.2.36",
83
84
  "acorn": "^8.7.1",
84
85
  "cac": "6.7.9",
85
86
  "chokidar": "^3.5.3",
@@ -98,7 +99,7 @@
98
99
  "fast-glob": "^3.2.11",
99
100
  "http-proxy": "^1.18.1",
100
101
  "json5": "^2.2.1",
101
- "launch-editor-middleware": "^2.3.0",
102
+ "launch-editor-middleware": "^2.4.0",
102
103
  "magic-string": "^0.26.2",
103
104
  "micromatch": "^4.0.5",
104
105
  "mrmime": "^1.0.0",
@@ -111,18 +112,18 @@
111
112
  "postcss-load-config": "^3.1.4",
112
113
  "postcss-modules": "^4.3.1",
113
114
  "resolve.exports": "^1.1.0",
114
- "rollup-plugin-license": "^2.7.0",
115
+ "rollup-plugin-license": "^2.8.0",
115
116
  "sirv": "^2.0.2",
116
117
  "source-map-js": "^1.0.2",
117
118
  "source-map-support": "^0.5.21",
118
119
  "strip-ansi": "^6.0.1",
119
120
  "strip-literal": "^0.3.0",
120
- "terser": "^5.13.1",
121
- "tsconfck": "^2.0.0",
121
+ "terser": "^5.14.0",
122
+ "tsconfck": "^2.0.1",
122
123
  "tslib": "^2.4.0",
123
124
  "types": "link:./types",
124
125
  "ufo": "^0.8.4",
125
- "ws": "^8.6.0"
126
+ "ws": "^8.7.0"
126
127
  },
127
128
  "peerDependencies": {
128
129
  "less": "*",
@@ -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,246 +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
- * Force dep pre-optimization regardless of whether deps have changed.
110
- * @experimental
111
- */
112
- force?: boolean;
113
- /**
114
- * Dep optimization options
115
- */
116
- optimizeDeps?: DepOptimizationOptions;
117
- /**
118
- * SSR specific options
119
- */
120
- ssr?: SSROptions;
121
- /**
122
- * Experimental features
123
- *
124
- * Features under this field are addressed to be changed that might NOT follow semver.
125
- * Please be careful and always pin Vite's version when using them.
126
- * @experimental
127
- */
128
- experimental?: ExperimentalOptions;
129
- /**
130
- * Log level.
131
- * Default: 'info'
132
- */
133
- logLevel?: LogLevel;
134
- /**
135
- * Custom logger.
136
- */
137
- customLogger?: Logger;
138
- /**
139
- * Default: true
140
- */
141
- clearScreen?: boolean;
142
- /**
143
- * Environment files directory. Can be an absolute path, or a path relative from
144
- * the location of the config file itself.
145
- * @default root
146
- */
147
- envDir?: string;
148
- /**
149
- * Env variables starts with `envPrefix` will be exposed to your client source code via import.meta.env.
150
- * @default 'VITE_'
151
- */
152
- envPrefix?: string | string[];
153
- /**
154
- * Worker bundle options
155
- */
156
- worker?: {
157
- /**
158
- * Output format for worker bundle
159
- * @default 'iife'
160
- */
161
- format?: 'es' | 'iife';
162
- /**
163
- * Vite plugins that apply to worker bundle
164
- */
165
- plugins?: PluginOption[];
166
- /**
167
- * Rollup options to build worker bundle
168
- */
169
- rollupOptions?: Omit<RollupOptions, 'plugins' | 'input' | 'onwarn' | 'preserveEntrySignatures'>;
170
- };
171
- /**
172
- * Whether your application is a Single Page Application (SPA). Set to `false`
173
- * for other kinds of apps like MPAs.
174
- * @default true
175
- */
176
- spa?: boolean;
177
- }
178
- export interface ExperimentalOptions {
179
- /**
180
- * Append fake `&lang.(ext)` when queries are specified, to preseve the file extension for following plugins to process.
181
- *
182
- * @experimental
183
- * @default false
184
- */
185
- importGlobRestoreExtension?: boolean;
186
- }
187
- export declare type SSRTarget = 'node' | 'webworker';
188
- export interface SSROptions {
189
- external?: string[];
190
- noExternal?: string | RegExp | (string | RegExp)[] | true;
191
- /**
192
- * Define the target for the ssr build. The browser field in package.json
193
- * is ignored for node but used if webworker is the target
194
- * Default: 'node'
195
- */
196
- target?: SSRTarget;
197
- }
198
- export interface ResolveWorkerOptions {
199
- format: 'es' | 'iife';
200
- plugins: Plugin[];
201
- rollupOptions: RollupOptions;
202
- }
203
- export interface InlineConfig extends UserConfig {
204
- configFile?: string | false;
205
- envFile?: false;
206
- }
207
- export declare type ResolvedConfig = Readonly<Omit<UserConfig, 'plugins' | 'assetsInclude' | 'optimizeDeps' | 'worker'> & {
208
- configFile: string | undefined;
209
- configFileDependencies: string[];
210
- inlineConfig: InlineConfig;
211
- root: string;
212
- base: string;
213
- publicDir: string;
214
- cacheDir: string;
215
- command: 'build' | 'serve';
216
- mode: string;
217
- isWorker: boolean;
218
- /** @internal */
219
- mainConfig: ResolvedConfig | null;
220
- isProduction: boolean;
221
- env: Record<string, any>;
222
- resolve: ResolveOptions & {
223
- alias: Alias[];
224
- };
225
- plugins: readonly Plugin[];
226
- server: ResolvedServerOptions;
227
- build: ResolvedBuildOptions;
228
- preview: ResolvedPreviewOptions;
229
- assetsInclude: (file: string) => boolean;
230
- logger: Logger;
231
- createResolver: (options?: Partial<InternalResolveOptions>) => ResolveFn;
232
- optimizeDeps: DepOptimizationOptions;
233
- /** @internal */
234
- packageCache: PackageCache;
235
- worker: ResolveWorkerOptions;
236
- spa: boolean;
237
- }>;
238
- export declare type ResolveFn = (id: string, importer?: string, aliasOnly?: boolean, ssr?: boolean) => Promise<string | undefined>;
239
- export declare function resolveConfig(inlineConfig: InlineConfig, command: 'build' | 'serve', defaultMode?: string): Promise<ResolvedConfig>;
240
- export declare function sortUserPlugins(plugins: (Plugin | Plugin[])[] | undefined): [Plugin[], Plugin[], Plugin[]];
241
- export declare function loadConfigFromFile(configEnv: ConfigEnv, configFile?: string, configRoot?: string, logLevel?: LogLevel): Promise<{
242
- path: string;
243
- config: UserConfig;
244
- dependencies: string[];
245
- } | null>;
246
- export declare function isDepsOptimizerEnabled(config: ResolvedConfig): boolean;
@@ -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[];
@@ -1,88 +0,0 @@
1
- /// <reference types="node" />
2
- import type { Server as HttpServer, OutgoingHttpHeaders as HttpServerHeaders } from 'http';
3
- import type { ServerOptions as HttpsServerOptions } from 'https';
4
- import type { Connect } from 'types/connect';
5
- import type { ProxyOptions } from './server/middlewares/proxy';
6
- import type { Logger } from './logger';
7
- export interface CommonServerOptions {
8
- /**
9
- * Specify server port. Note if the port is already being used, Vite will
10
- * automatically try the next available port so this may not be the actual
11
- * port the server ends up listening on.
12
- */
13
- port?: number;
14
- /**
15
- * If enabled, vite will exit if specified port is already in use
16
- */
17
- strictPort?: boolean;
18
- /**
19
- * Specify which IP addresses the server should listen on.
20
- * Set to 0.0.0.0 to listen on all addresses, including LAN and public addresses.
21
- */
22
- host?: string | boolean;
23
- /**
24
- * Enable TLS + HTTP/2.
25
- * Note: this downgrades to TLS only when the proxy option is also used.
26
- */
27
- https?: boolean | HttpsServerOptions;
28
- /**
29
- * Open browser window on startup
30
- */
31
- open?: boolean | string;
32
- /**
33
- * Configure custom proxy rules for the dev server. Expects an object
34
- * of `{ key: options }` pairs.
35
- * Uses [`http-proxy`](https://github.com/http-party/node-http-proxy).
36
- * Full options [here](https://github.com/http-party/node-http-proxy#options).
37
- *
38
- * Example `vite.config.js`:
39
- * ``` js
40
- * module.exports = {
41
- * proxy: {
42
- * // string shorthand
43
- * '/foo': 'http://localhost:4567/foo',
44
- * // with options
45
- * '/api': {
46
- * target: 'http://jsonplaceholder.typicode.com',
47
- * changeOrigin: true,
48
- * rewrite: path => path.replace(/^\/api/, '')
49
- * }
50
- * }
51
- * }
52
- * ```
53
- */
54
- proxy?: Record<string, string | ProxyOptions>;
55
- /**
56
- * Configure CORS for the dev server.
57
- * Uses https://github.com/expressjs/cors.
58
- * Set to `true` to allow all methods from any origin, or configure separately
59
- * using an object.
60
- */
61
- cors?: CorsOptions | boolean;
62
- /**
63
- * Specify server response headers.
64
- */
65
- headers?: HttpServerHeaders;
66
- }
67
- /**
68
- * https://github.com/expressjs/cors#configuration-options
69
- */
70
- export interface CorsOptions {
71
- origin?: CorsOrigin | ((origin: string, cb: (err: Error, origins: CorsOrigin) => void) => void);
72
- methods?: string | string[];
73
- allowedHeaders?: string | string[];
74
- exposedHeaders?: string | string[];
75
- credentials?: boolean;
76
- maxAge?: number;
77
- preflightContinue?: boolean;
78
- optionsSuccessStatus?: number;
79
- }
80
- export declare type CorsOrigin = boolean | string | RegExp | (string | RegExp)[];
81
- export declare function resolveHttpServer({ proxy }: CommonServerOptions, app: Connect.Server, httpsOptions?: HttpsServerOptions): Promise<HttpServer>;
82
- export declare function resolveHttpsConfig(https: boolean | HttpsServerOptions | undefined, cacheDir: string): Promise<HttpsServerOptions | undefined>;
83
- export declare function httpServerStart(httpServer: HttpServer, serverOptions: {
84
- port: number;
85
- strictPort: boolean | undefined;
86
- host: string | undefined;
87
- logger: Logger;
88
- }): Promise<number>;
@@ -1,31 +0,0 @@
1
- /// <reference types="node" />
2
- import type { Server } from 'net';
3
- import type { RollupError } from 'rollup';
4
- import type { CommonServerOptions } from './http';
5
- import type { ResolvedConfig } from '.';
6
- export declare type LogType = 'error' | 'warn' | 'info';
7
- export declare type LogLevel = LogType | 'silent';
8
- export interface Logger {
9
- info(msg: string, options?: LogOptions): void;
10
- warn(msg: string, options?: LogOptions): void;
11
- warnOnce(msg: string, options?: LogOptions): void;
12
- error(msg: string, options?: LogErrorOptions): void;
13
- clearScreen(type: LogType): void;
14
- hasErrorLogged(error: Error | RollupError): boolean;
15
- hasWarned: boolean;
16
- }
17
- export interface LogOptions {
18
- clear?: boolean;
19
- timestamp?: boolean;
20
- }
21
- export interface LogErrorOptions extends LogOptions {
22
- error?: Error | RollupError | null;
23
- }
24
- export declare const LogLevels: Record<LogLevel, number>;
25
- export interface LoggerOptions {
26
- prefix?: string;
27
- allowClearScreen?: boolean;
28
- customLogger?: Logger;
29
- }
30
- export declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
31
- export declare function printCommonServerUrls(server: Server, options: CommonServerOptions, config: ResolvedConfig): void;
@@ -1,4 +0,0 @@
1
- import type { Plugin } from 'esbuild';
2
- import type { ResolvedConfig } from '..';
3
- import type { ExportsData } from '.';
4
- export declare function esbuildDepPlugin(qualified: Record<string, string>, exportsData: Record<string, ExportsData>, config: ResolvedConfig): Plugin;