vite 6.0.0-beta.0 → 6.0.0-beta.10
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.
- package/LICENSE.md +66 -1010
- package/README.md +4 -4
- package/bin/vite.js +5 -0
- package/client.d.ts +10 -0
- package/dist/client/client.mjs +344 -105
- package/dist/node/chunks/{dep-IQS-Za7F.js → dep-3RmXg9uo.js} +0 -8
- package/dist/node/chunks/{dep-CSD_20z-.js → dep-Ck0pJQmh.js} +4 -175
- package/dist/node/chunks/{dep-Bv1xMYNy.js → dep-DiRA7B7B.js} +15754 -30473
- package/dist/node/chunks/{dep-D-7KCb9p.js → dep-DnSxfB-q.js} +704 -443
- package/dist/node/chunks/{dep-D9t7igss.js → dep-ifLmJA8Z.js} +286 -127
- package/dist/node/cli.js +21 -37
- package/dist/node/constants.js +19 -11
- package/dist/node/index.d.ts +1649 -1602
- package/dist/node/index.js +13 -153
- package/dist/node/module-runner.d.ts +154 -141
- package/dist/node/module-runner.js +374 -221
- package/dist/node-cjs/publicUtils.cjs +363 -184
- package/index.cjs +35 -3
- package/index.d.cts +1 -1
- package/package.json +44 -33
- package/types/hmrPayload.d.ts +5 -0
- package/types/internal/cssPreprocessorOptions.d.ts +63 -0
- package/types/internal/lightningcssOptions.d.ts +18 -0
package/dist/node/cli.js
CHANGED
@@ -2,22 +2,19 @@ import path from 'node:path';
|
|
2
2
|
import fs__default from 'node:fs';
|
3
3
|
import { performance } from 'node:perf_hooks';
|
4
4
|
import { EventEmitter } from 'events';
|
5
|
-
import {
|
5
|
+
import { M as colors, G as createLogger, r as resolveConfig } from './chunks/dep-DiRA7B7B.js';
|
6
6
|
import { VERSION } from './constants.js';
|
7
7
|
import 'node:fs/promises';
|
8
8
|
import 'node:url';
|
9
9
|
import 'node:util';
|
10
10
|
import 'node:module';
|
11
|
-
import 'tty';
|
12
11
|
import 'esbuild';
|
13
12
|
import 'path';
|
14
13
|
import 'fs';
|
15
|
-
import 'node:events';
|
16
|
-
import 'node:stream';
|
17
|
-
import 'node:string_decoder';
|
18
14
|
import 'node:child_process';
|
19
15
|
import 'node:http';
|
20
16
|
import 'node:https';
|
17
|
+
import 'tty';
|
21
18
|
import 'util';
|
22
19
|
import 'net';
|
23
20
|
import 'url';
|
@@ -31,18 +28,20 @@ import 'node:dns';
|
|
31
28
|
import 'vite/module-runner';
|
32
29
|
import 'rollup/parseAst';
|
33
30
|
import 'module';
|
31
|
+
import 'node:readline';
|
32
|
+
import 'node:process';
|
33
|
+
import 'node:buffer';
|
34
|
+
import 'node:events';
|
35
|
+
import 'crypto';
|
34
36
|
import 'node:assert';
|
35
37
|
import 'node:v8';
|
36
38
|
import 'node:worker_threads';
|
37
|
-
import 'crypto';
|
38
|
-
import 'node:buffer';
|
39
|
-
import 'node:readline';
|
40
39
|
import 'zlib';
|
41
40
|
import 'buffer';
|
42
41
|
import 'https';
|
43
42
|
import 'tls';
|
44
43
|
import 'assert';
|
45
|
-
import 'querystring';
|
44
|
+
import 'node:querystring';
|
46
45
|
import 'node:zlib';
|
47
46
|
|
48
47
|
function toArr(any) {
|
@@ -705,10 +704,15 @@ function cleanGlobalCLIOptions(options) {
|
|
705
704
|
delete ret.filter;
|
706
705
|
delete ret.m;
|
707
706
|
delete ret.mode;
|
707
|
+
delete ret.w;
|
708
708
|
if ("sourcemap" in ret) {
|
709
709
|
const sourcemap = ret.sourcemap;
|
710
710
|
ret.sourcemap = sourcemap === "true" ? true : sourcemap === "false" ? false : ret.sourcemap;
|
711
711
|
}
|
712
|
+
if ("watch" in ret) {
|
713
|
+
const watch = ret.watch;
|
714
|
+
ret.watch = watch ? {} : void 0;
|
715
|
+
}
|
712
716
|
return ret;
|
713
717
|
}
|
714
718
|
function cleanBuilderCLIOptions(options) {
|
@@ -736,7 +740,7 @@ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--
|
|
736
740
|
`[boolean] force the optimizer to ignore the cache and re-bundle`
|
737
741
|
).action(async (root, options) => {
|
738
742
|
filterDuplicateOptions(options);
|
739
|
-
const { createServer } = await import('./chunks/dep-
|
743
|
+
const { createServer } = await import('./chunks/dep-DiRA7B7B.js').then(function (n) { return n.Q; });
|
740
744
|
try {
|
741
745
|
const server = await createServer({
|
742
746
|
root,
|
@@ -826,10 +830,10 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
826
830
|
).option("--manifest [name]", `[boolean | string] emit build manifest json`).option("--ssrManifest [name]", `[boolean | string] emit ssr manifest json`).option(
|
827
831
|
"--emptyOutDir",
|
828
832
|
`[boolean] force empty outDir when it's outside of root`
|
829
|
-
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as builder
|
833
|
+
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(
|
830
834
|
async (root, options) => {
|
831
835
|
filterDuplicateOptions(options);
|
832
|
-
const
|
836
|
+
const { createBuilder } = await import('./chunks/dep-DiRA7B7B.js').then(function (n) { return n.R; });
|
833
837
|
const buildOptions = cleanGlobalCLIOptions(
|
834
838
|
cleanBuilderCLIOptions(options)
|
835
839
|
);
|
@@ -842,30 +846,10 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
842
846
|
logLevel: options.logLevel,
|
843
847
|
clearScreen: options.clearScreen,
|
844
848
|
build: buildOptions,
|
845
|
-
...options.app ? { builder: {
|
846
|
-
};
|
847
|
-
const patchConfig = (resolved) => {
|
848
|
-
if (resolved.builder.entireApp) {
|
849
|
-
return;
|
850
|
-
}
|
851
|
-
const environmentName = resolved.build.ssr ? "ssr" : "client";
|
852
|
-
resolved.build = {
|
853
|
-
...resolved.environments[environmentName].build
|
854
|
-
};
|
849
|
+
...options.app ? { builder: {} } : {}
|
855
850
|
};
|
856
|
-
const
|
857
|
-
|
858
|
-
patchConfig
|
859
|
-
);
|
860
|
-
if (config.builder.entireApp) {
|
861
|
-
const builder = await build.createBuilderWithResolvedConfig(
|
862
|
-
inlineConfig,
|
863
|
-
config
|
864
|
-
);
|
865
|
-
await builder.buildApp();
|
866
|
-
} else {
|
867
|
-
await build.buildWithResolvedConfig(config);
|
868
|
-
}
|
851
|
+
const builder = await createBuilder(inlineConfig, null);
|
852
|
+
await builder.buildApp();
|
869
853
|
} catch (e) {
|
870
854
|
createLogger(options.logLevel).error(
|
871
855
|
colors.red(`error during build:
|
@@ -884,7 +868,7 @@ cli.command("optimize [root]", "pre-bundle dependencies").option(
|
|
884
868
|
).action(
|
885
869
|
async (root, options) => {
|
886
870
|
filterDuplicateOptions(options);
|
887
|
-
const { optimizeDeps } = await import('./chunks/dep-
|
871
|
+
const { optimizeDeps } = await import('./chunks/dep-DiRA7B7B.js').then(function (n) { return n.P; });
|
888
872
|
try {
|
889
873
|
const config = await resolveConfig(
|
890
874
|
{
|
@@ -910,7 +894,7 @@ ${e.stack}`),
|
|
910
894
|
cli.command("preview [root]", "locally preview production build").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--open [path]", `[boolean | string] open browser on startup`).option("--outDir <dir>", `[string] output directory (default: dist)`).action(
|
911
895
|
async (root, options) => {
|
912
896
|
filterDuplicateOptions(options);
|
913
|
-
const { preview } = await import('./chunks/dep-
|
897
|
+
const { preview } = await import('./chunks/dep-DiRA7B7B.js').then(function (n) { return n.S; });
|
914
898
|
try {
|
915
899
|
const server = await preview({
|
916
900
|
root,
|
package/dist/node/constants.js
CHANGED
@@ -6,6 +6,7 @@ const { version } = JSON.parse(
|
|
6
6
|
readFileSync(new URL("../../package.json", import.meta.url)).toString()
|
7
7
|
);
|
8
8
|
const ROLLUP_HOOKS = [
|
9
|
+
"options",
|
9
10
|
"buildStart",
|
10
11
|
"buildEnd",
|
11
12
|
"renderStart",
|
@@ -30,7 +31,8 @@ const ROLLUP_HOOKS = [
|
|
30
31
|
"resolveDynamicImport",
|
31
32
|
"resolveId",
|
32
33
|
"shouldTransformCachedModule",
|
33
|
-
"transform"
|
34
|
+
"transform",
|
35
|
+
"onLog"
|
34
36
|
];
|
35
37
|
const VERSION = version;
|
36
38
|
const DEFAULT_MAIN_FIELDS = [
|
@@ -40,6 +42,18 @@ const DEFAULT_MAIN_FIELDS = [
|
|
40
42
|
// moment still uses this...
|
41
43
|
"jsnext"
|
42
44
|
];
|
45
|
+
const DEFAULT_CLIENT_MAIN_FIELDS = Object.freeze(DEFAULT_MAIN_FIELDS);
|
46
|
+
const DEFAULT_SERVER_MAIN_FIELDS = Object.freeze(
|
47
|
+
DEFAULT_MAIN_FIELDS.filter((f) => f !== "browser")
|
48
|
+
);
|
49
|
+
const DEV_PROD_CONDITION = `development|production`;
|
50
|
+
const DEFAULT_CONDITIONS = ["module", "browser", "node", DEV_PROD_CONDITION];
|
51
|
+
const DEFAULT_CLIENT_CONDITIONS = Object.freeze(
|
52
|
+
DEFAULT_CONDITIONS.filter((c) => c !== "node")
|
53
|
+
);
|
54
|
+
const DEFAULT_SERVER_CONDITIONS = Object.freeze(
|
55
|
+
DEFAULT_CONDITIONS.filter((c) => c !== "browser")
|
56
|
+
);
|
43
57
|
const ESBUILD_MODULES_TARGET = [
|
44
58
|
"es2020",
|
45
59
|
// support import.meta.url
|
@@ -48,15 +62,6 @@ const ESBUILD_MODULES_TARGET = [
|
|
48
62
|
"chrome87",
|
49
63
|
"safari14"
|
50
64
|
];
|
51
|
-
const DEFAULT_EXTENSIONS = [
|
52
|
-
".mjs",
|
53
|
-
".js",
|
54
|
-
".mts",
|
55
|
-
".ts",
|
56
|
-
".jsx",
|
57
|
-
".tsx",
|
58
|
-
".json"
|
59
|
-
];
|
60
65
|
const DEFAULT_CONFIG_FILES = [
|
61
66
|
"vite.config.js",
|
62
67
|
"vite.config.mjs",
|
@@ -135,5 +140,8 @@ const DEFAULT_DEV_PORT = 5173;
|
|
135
140
|
const DEFAULT_PREVIEW_PORT = 4173;
|
136
141
|
const DEFAULT_ASSETS_INLINE_LIMIT = 4096;
|
137
142
|
const METADATA_FILENAME = "_metadata.json";
|
143
|
+
const ERR_OPTIMIZE_DEPS_PROCESSING_ERROR = "ERR_OPTIMIZE_DEPS_PROCESSING_ERROR";
|
144
|
+
const ERR_OUTDATED_OPTIMIZED_DEP = "ERR_OUTDATED_OPTIMIZED_DEP";
|
145
|
+
const ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR = "ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR";
|
138
146
|
|
139
|
-
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT,
|
147
|
+
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, DEFAULT_ASSETS_RE, DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_PREVIEW_PORT, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, DEP_VERSION_RE, DEV_PROD_CONDITION, ENV_ENTRY, ENV_PUBLIC_PATH, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ERR_OUTDATED_OPTIMIZED_DEP, ESBUILD_MODULES_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, ROLLUP_HOOKS, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, loopbackHosts, wildcardHosts };
|