vite 8.2.1 → 8.3.0-beta.0
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/bin/vite.js +17 -6
- package/dist/client/bundledDevClient.mjs +149 -65
- package/dist/client/client.mjs +426 -392
- package/dist/node/chunks/build.js +70 -64
- package/dist/node/chunks/dist.js +36 -29
- package/dist/node/chunks/node.js +29216 -28843
- package/dist/node/chunks/postcss-import.js +23 -25
- package/dist/node/cli.js +11 -7
- package/dist/node/index.d.ts +1601 -1555
- package/dist/node/index.js +1 -1
- package/dist/node/module-runner.d.ts +14 -14
- package/dist/node/module-runner.js +200 -198
- package/package.json +18 -18
- package/types/customEvent.d.ts +8 -0
- package/types/hmrPayload.d.ts +8 -0
- package/types/internal/cssPreprocessorOptions.d.ts +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ft as __commonJSMin, pt as __require } from "./node.js";
|
|
2
2
|
import { t as require_lib } from "./lib.js";
|
|
3
|
-
//#region ../../node_modules/.pnpm/postcss-import@16.
|
|
3
|
+
//#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/format-import-prelude.js
|
|
4
4
|
var require_format_import_prelude = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
5
|
module.exports = function formatImportPrelude(layer, media, supports) {
|
|
6
6
|
const parts = [];
|
|
@@ -15,7 +15,7 @@ var require_format_import_prelude = /* @__PURE__ */ __commonJSMin(((exports, mod
|
|
|
15
15
|
};
|
|
16
16
|
}));
|
|
17
17
|
//#endregion
|
|
18
|
-
//#region ../../node_modules/.pnpm/postcss-import@16.
|
|
18
|
+
//#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/base64-encoded-import.js
|
|
19
19
|
var require_base64_encoded_import = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20
20
|
const formatImportPrelude = require_format_import_prelude();
|
|
21
21
|
module.exports = function base64EncodedConditionalImport(prelude, conditions) {
|
|
@@ -28,7 +28,7 @@ var require_base64_encoded_import = /* @__PURE__ */ __commonJSMin(((exports, mod
|
|
|
28
28
|
};
|
|
29
29
|
}));
|
|
30
30
|
//#endregion
|
|
31
|
-
//#region ../../node_modules/.pnpm/postcss-import@16.
|
|
31
|
+
//#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/apply-conditions.js
|
|
32
32
|
var require_apply_conditions = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
33
33
|
const base64EncodedConditionalImport = require_base64_encoded_import();
|
|
34
34
|
module.exports = function applyConditions(bundle, atRule) {
|
|
@@ -103,21 +103,18 @@ var require_apply_conditions = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
103
103
|
};
|
|
104
104
|
}));
|
|
105
105
|
//#endregion
|
|
106
|
-
//#region ../../node_modules/.pnpm/postcss-import@16.
|
|
106
|
+
//#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/apply-raws.js
|
|
107
107
|
var require_apply_raws = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
108
108
|
module.exports = function applyRaws(bundle) {
|
|
109
109
|
bundle.forEach((stmt, index) => {
|
|
110
110
|
if (index === 0) return;
|
|
111
|
-
if (stmt.
|
|
112
|
-
|
|
113
|
-
if (stmt.type === "nodes") stmt.nodes[0].raws.before = before;
|
|
114
|
-
else stmt.node.raws.before = before;
|
|
115
|
-
} else if (stmt.type === "nodes") stmt.nodes[0].raws.before = stmt.nodes[0].raws.before || "\n";
|
|
111
|
+
if (stmt.type === "nodes") delete stmt.nodes[0].raws.before;
|
|
112
|
+
else if (stmt.parent) delete stmt.node.raws.before;
|
|
116
113
|
});
|
|
117
114
|
};
|
|
118
115
|
}));
|
|
119
116
|
//#endregion
|
|
120
|
-
//#region ../../node_modules/.pnpm/postcss-import@16.
|
|
117
|
+
//#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/apply-styles.js
|
|
121
118
|
var require_apply_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
122
119
|
module.exports = function applyStyles(bundle, styles) {
|
|
123
120
|
styles.nodes = [];
|
|
@@ -137,7 +134,7 @@ var require_apply_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
137
134
|
};
|
|
138
135
|
}));
|
|
139
136
|
//#endregion
|
|
140
|
-
//#region ../../node_modules/.pnpm/postcss-import@16.
|
|
137
|
+
//#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/data-url.js
|
|
141
138
|
var require_data_url = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
142
139
|
const anyDataURLRegexp = /^data:text\/css(?:;(base64|plain))?,/i;
|
|
143
140
|
const base64DataURLRegexp = /^data:text\/css;base64,/i;
|
|
@@ -156,7 +153,7 @@ var require_data_url = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
156
153
|
};
|
|
157
154
|
}));
|
|
158
155
|
//#endregion
|
|
159
|
-
//#region ../../node_modules/.pnpm/postcss-import@16.
|
|
156
|
+
//#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/parse-statements.js
|
|
160
157
|
var require_parse_statements = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
161
158
|
const valueParser = require_lib();
|
|
162
159
|
const { stringify } = valueParser;
|
|
@@ -215,7 +212,7 @@ var require_parse_statements = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
215
212
|
prev = prev.prev();
|
|
216
213
|
continue;
|
|
217
214
|
}
|
|
218
|
-
return result.warn("@import must precede all other statements (besides @charset or empty @layer)", { node: atRule });
|
|
215
|
+
return result.warn("@import statements must precede all other statements (besides @charset or empty @layer) and be consecutive", { node: atRule });
|
|
219
216
|
} while (prev);
|
|
220
217
|
if (atRule.nodes) return result.warn("It looks like you didn't end your @import statement correctly. Child nodes are attached to it.", { node: atRule });
|
|
221
218
|
const params = valueParser(atRule.params).nodes;
|
|
@@ -281,7 +278,7 @@ var require_parse_statements = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
281
278
|
}
|
|
282
279
|
}));
|
|
283
280
|
//#endregion
|
|
284
|
-
//#region ../../node_modules/.pnpm/postcss-import@16.
|
|
281
|
+
//#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/process-content.js
|
|
285
282
|
var require_process_content = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
286
283
|
const path$2 = __require("path");
|
|
287
284
|
let sugarss;
|
|
@@ -315,7 +312,7 @@ var require_process_content = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
315
312
|
}
|
|
316
313
|
}));
|
|
317
314
|
//#endregion
|
|
318
|
-
//#region ../../node_modules/.pnpm/postcss-import@16.
|
|
315
|
+
//#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/lib/parse-styles.js
|
|
319
316
|
var require_parse_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
320
317
|
const path$1 = __require("path");
|
|
321
318
|
const dataURL = require_data_url();
|
|
@@ -341,15 +338,16 @@ var require_parse_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
341
338
|
}
|
|
342
339
|
statements.forEach((stmt) => {
|
|
343
340
|
if (stmt.type === "charset") handleCharset(stmt);
|
|
344
|
-
else if (stmt.type === "import")
|
|
345
|
-
if (
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
341
|
+
else if (stmt.type === "import") {
|
|
342
|
+
if (stmt.children) stmt.children.forEach((child, index) => {
|
|
343
|
+
if (child.type === "import") beforeBundle.push(child);
|
|
344
|
+
else if (child.type === "layer") beforeBundle.push(child);
|
|
345
|
+
else if (child.type === "charset") handleCharset(child);
|
|
346
|
+
else bundle.push(child);
|
|
347
|
+
if (index === 0) child.parent = stmt;
|
|
348
|
+
});
|
|
349
|
+
else beforeBundle.push(stmt);
|
|
350
|
+
} else if (stmt.type === "layer") beforeBundle.push(stmt);
|
|
353
351
|
else if (stmt.type === "nodes") bundle.push(stmt);
|
|
354
352
|
});
|
|
355
353
|
return charset ? [charset, ...beforeBundle.concat(bundle)] : beforeBundle.concat(bundle);
|
|
@@ -418,7 +416,7 @@ var require_parse_styles = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
418
416
|
module.exports = parseStyles;
|
|
419
417
|
}));
|
|
420
418
|
//#endregion
|
|
421
|
-
//#region ../../node_modules/.pnpm/postcss-import@16.
|
|
419
|
+
//#region ../../node_modules/.pnpm/postcss-import@16.2.0_postcss@8.5.26/node_modules/postcss-import/index.js
|
|
422
420
|
var require_postcss_import = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
423
421
|
const path = __require("path");
|
|
424
422
|
const applyConditions = require_apply_conditions();
|
package/dist/node/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { E as createBuilder,
|
|
1
|
+
import { E as createBuilder, H as createLogger, dt as require_picocolors, lt as VERSION, mt as __toESM } from "./chunks/node.js";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { inspect } from "node:util";
|
|
5
4
|
import { performance } from "node:perf_hooks";
|
|
5
|
+
import { inspect } from "node:util";
|
|
6
6
|
//#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
|
|
7
7
|
function toArr(any) {
|
|
8
8
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -638,7 +638,10 @@ const stopProfiler = (log) => {
|
|
|
638
638
|
return new Promise((res, rej) => {
|
|
639
639
|
profileSession.post("Profiler.stop", (err, { profile }) => {
|
|
640
640
|
if (!err) {
|
|
641
|
-
const
|
|
641
|
+
const name = global.__vite_profile_name;
|
|
642
|
+
const count = profileCount++;
|
|
643
|
+
const fileName = name ? count === 0 ? name : `${name}-${count}` : `vite-profile-${count}`;
|
|
644
|
+
const outPath = path.resolve(`./${fileName}.cpuprofile`);
|
|
642
645
|
fs.writeFileSync(outPath, JSON.stringify(profile));
|
|
643
646
|
log(import_picocolors.default.yellow(`CPU profile written to ${import_picocolors.default.white(import_picocolors.default.dim(outPath))}`));
|
|
644
647
|
profileSession = void 0;
|
|
@@ -663,6 +666,7 @@ function cleanGlobalCLIOptions(options) {
|
|
|
663
666
|
delete ret.logLevel;
|
|
664
667
|
delete ret.clearScreen;
|
|
665
668
|
delete ret.configLoader;
|
|
669
|
+
delete ret.profile;
|
|
666
670
|
delete ret.d;
|
|
667
671
|
delete ret.debug;
|
|
668
672
|
delete ret.f;
|
|
@@ -700,10 +704,10 @@ const convertBase = (v) => {
|
|
|
700
704
|
if (v === 0) return "";
|
|
701
705
|
return v;
|
|
702
706
|
};
|
|
703
|
-
cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, { type: [convertBase] }).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option("--configLoader <loader>", `[string] use 'bundle' to bundle the config with Rolldown, or 'runner' (experimental) to process it on the fly, or 'native' (experimental) to load using the native runtime (default: bundle)`).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
|
|
707
|
+
cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, { type: [convertBase] }).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option("--configLoader <loader>", `[string] use 'bundle' to bundle the config with Rolldown, or 'runner' (experimental) to process it on the fly, or 'native' (experimental) to load using the native runtime (default: bundle)`).option("--profile [name]", `[boolean | string] start built-in Node.js inspector`).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
|
|
704
708
|
cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--open [path]", `[boolean | string] open browser on startup`).option("--cors", `[boolean] enable CORS`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--force", `[boolean] force the optimizer to ignore the cache and re-bundle`).option("--experimentalBundle", `[boolean] use experimental full bundle mode (this is highly experimental)`).action(async (root, options) => {
|
|
705
709
|
filterDuplicateOptions(options);
|
|
706
|
-
const { createServer } = await import("./chunks/node.js").then((n) => n.
|
|
710
|
+
const { createServer } = await import("./chunks/node.js").then((n) => n.P);
|
|
707
711
|
try {
|
|
708
712
|
const server = await createServer({
|
|
709
713
|
root,
|
|
@@ -785,7 +789,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
|
785
789
|
cli.command("optimize [root]", "pre-bundle dependencies (deprecated, the pre-bundle process runs automatically and does not need to be called)").option("--force", `[boolean] force the optimizer to ignore the cache and re-bundle`).action(async (root, options) => {
|
|
786
790
|
filterDuplicateOptions(options);
|
|
787
791
|
const { resolveConfig } = await import("./chunks/node.js").then((n) => n.f);
|
|
788
|
-
const { optimizeDeps } = await import("./chunks/node.js").then((n) => n.
|
|
792
|
+
const { optimizeDeps } = await import("./chunks/node.js").then((n) => n.j);
|
|
789
793
|
try {
|
|
790
794
|
await optimizeDeps(await resolveConfig({
|
|
791
795
|
root,
|
|
@@ -802,7 +806,7 @@ cli.command("optimize [root]", "pre-bundle dependencies (deprecated, the pre-bun
|
|
|
802
806
|
});
|
|
803
807
|
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(async (root, options) => {
|
|
804
808
|
filterDuplicateOptions(options);
|
|
805
|
-
const { preview } = await import("./chunks/node.js").then((n) => n.
|
|
809
|
+
const { preview } = await import("./chunks/node.js").then((n) => n.C);
|
|
806
810
|
try {
|
|
807
811
|
const server = await preview({
|
|
808
812
|
root,
|