@voidzero-dev/vite-plus-core 0.1.2 → 0.1.4
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/dist/rolldown/cli.mjs +619 -197
- package/dist/rolldown/config.d.mts +1 -1
- package/dist/rolldown/config.mjs +10 -11
- package/dist/rolldown/experimental-index.d.mts +20 -6
- package/dist/rolldown/experimental-index.mjs +24 -22
- package/dist/rolldown/filter-index.d.mts +1 -1
- package/dist/rolldown/filter-index.mjs +2 -8
- package/dist/rolldown/get-log-filter.mjs +1 -2
- package/dist/rolldown/index.d.mts +3 -3
- package/dist/rolldown/index.mjs +10 -13
- package/dist/rolldown/parallel-plugin-worker.mjs +7 -9
- package/dist/rolldown/parallel-plugin.d.mts +1 -1
- package/dist/rolldown/parallel-plugin.mjs +1 -2
- package/dist/rolldown/parse-ast-index.d.mts +1 -1
- package/dist/rolldown/parse-ast-index.mjs +4 -6
- package/dist/rolldown/plugins-index.d.mts +3 -3
- package/dist/rolldown/plugins-index.mjs +4 -6
- package/dist/rolldown/shared/{binding-Bd04_f8P.mjs → binding-BSVL02lq.mjs} +7 -16
- package/dist/rolldown/shared/{binding-C4ZlFAt6.d.mts → binding-BohGL_65.d.mts} +10 -5
- package/dist/rolldown/shared/{bindingify-input-options-ffqkmT9z.mjs → bindingify-input-options-DkwIzK4F.mjs} +36 -56
- package/dist/rolldown/shared/{constructors-cPsD1J5w.d.mts → constructors-Bnr_ApVf.d.mts} +2 -2
- package/dist/rolldown/shared/{constructors-C5a55nbY.mjs → constructors-D91FHkmz.mjs} +2 -4
- package/dist/rolldown/shared/{define-config-DX_4SBzo.d.mts → define-config-B1jccsL9.d.mts} +84 -30
- package/dist/rolldown/shared/{define-config-BMj_QknW.mjs → define-config-DJOr6Iwt.mjs} +1 -2
- package/dist/rolldown/shared/{error-BYPsvVEN.mjs → error-tpgdcGrK.mjs} +3 -8
- package/dist/rolldown/shared/{load-config-Oj1-3DPg.mjs → load-config-Dapgaecf.mjs} +2 -4
- package/dist/rolldown/shared/{logs-CCc_0vhs.mjs → logs-D80CXhvg.mjs} +5 -8
- package/dist/rolldown/shared/{misc-Xty885dB.mjs → misc-DJYbNKZX.mjs} +1 -2
- package/dist/rolldown/shared/{normalize-string-or-regex-DoNa0azR.mjs → normalize-string-or-regex-BCllTl21.mjs} +3 -6
- package/dist/rolldown/shared/{parse-Wj8OTS4w.mjs → parse-DFYpKkKl.mjs} +2 -5
- package/dist/rolldown/shared/{prompt-CmNr0AI-.mjs → prompt-DZIXsnf9.mjs} +1 -3
- package/dist/rolldown/shared/{rolldown-y9H0nYAD.mjs → rolldown-DK6iIJl8.mjs} +2 -4
- package/dist/rolldown/shared/{rolldown-build-DkOWV5Vu.mjs → rolldown-build-rw0HCMhn.mjs} +427 -473
- package/dist/rolldown/shared/{transform-D55YcCvB.mjs → transform-BSCulZAO.mjs} +3 -6
- package/dist/rolldown/shared/{transform-DoG7c5_r.d.mts → transform-BoJxrM-e.d.mts} +1 -1
- package/dist/rolldown/shared/{watch-CVufTfok.mjs → watch-D8uEZyLj.mjs} +71 -77
- package/dist/rolldown/utils-index.d.mts +2 -2
- package/dist/rolldown/utils-index.mjs +9 -18
- package/dist/tsdown/{build-TmLngPCw-I7MHSf0I.js → build-BG-XbM6V-hoyhQqI3.js} +87 -292
- package/dist/tsdown/build-DHPfiKA--CvTonTfC.js +5 -0
- package/dist/tsdown/{chunk-CdeBBKNj.js → chunk-CSNpwdVU.js} +13 -23
- package/dist/tsdown/{debug-tOJ_PtrM-DITcI9An.js → debug-C4FmgzkJ-B6m_gRpz.js} +4 -6
- package/dist/tsdown/{detect-DK-FDZQ9-CALXiuJa.js → detect-J1_Vd1yf-BWDiPZkP.js} +2 -4
- package/dist/tsdown/{dist-uzMTIu3J.js → dist-C9Oecl0H.js} +24 -56
- package/dist/tsdown/{dist-DVPyDO-_.js → dist-Dx-jtFHM.js} +5 -10
- package/dist/tsdown/{dist-kuoe97DJ.js → dist-_l70jCqI.js} +1 -2
- package/dist/tsdown/{filename-C2azOotK.js → filename-tIvGuRvQ.js} +1 -3
- package/dist/tsdown/{index-node-Djp92Gzb-fgHTblzo.js → index-node-Bpsmc0eX-jMz9gD3P.js} +2 -4
- package/dist/tsdown/index-types.d.ts +8561 -180
- package/dist/tsdown/index.js +7 -9
- package/dist/tsdown/{main-BWoReXjl.js → main-DN-_H9u2.js} +8 -23
- package/dist/tsdown/{node-Ba_UB_xO.js → node-B3Gdtau1.js} +1 -4
- package/dist/tsdown/npm_cjs_chunk_chunk.cjs +6 -8
- package/dist/tsdown/npm_cjs_chunk_lt.cjs +13 -16
- package/dist/tsdown/npm_cjs_chunk_range.cjs +16 -28
- package/dist/tsdown/npm_cjs_chunk_semver.cjs +40 -52
- package/dist/tsdown/npm_entry_picomatch.cjs +18 -30
- package/dist/tsdown/npm_entry_semver_functions_coerce.cjs +3 -7
- package/dist/tsdown/npm_entry_semver_functions_lt.cjs +3 -5
- package/dist/tsdown/npm_entry_semver_functions_satisfies.cjs +5 -8
- package/dist/tsdown/npm_entry_semver_ranges_min-version.cjs +5 -8
- package/dist/tsdown/npm_entry_tree-kill.cjs +2 -6
- package/dist/tsdown/{resolver-CdD-yT15-OWjlgV0D.js → resolver-CdD-yT15-3eaymYLw.js} +2 -4
- package/dist/tsdown/run.js +6 -12
- package/dist/tsdown/{tsc-D6YfZJBZ.js → tsc-OwK9UHsV.js} +4 -6
- package/dist/tsdown/{tsc-context-CGmk4Cps.js → tsc-context-DiIjfXAG.js} +2 -4
- package/dist/vite/client/client.mjs +116 -19
- package/dist/vite/client/env.mjs +1 -2
- package/dist/vite/node/chunks/build.js +2 -3
- package/dist/vite/node/chunks/build2.js +91 -243
- package/dist/vite/node/chunks/chunk.js +7 -13
- package/dist/vite/node/chunks/config.js +2 -3
- package/dist/vite/node/chunks/dist.js +27 -61
- package/dist/vite/node/chunks/dist2.js +11 -95
- package/dist/vite/node/chunks/lib.js +1 -7
- package/dist/vite/node/chunks/logger.js +4 -9
- package/dist/vite/node/chunks/node.js +956 -918
- package/dist/vite/node/chunks/optimizer.js +2 -3
- package/dist/vite/node/chunks/postcss-import.js +1 -13
- package/dist/vite/node/chunks/preview.js +2 -3
- package/dist/vite/node/chunks/server.js +2 -3
- package/dist/vite/node/cli.js +202 -67
- package/dist/vite/node/index.d.ts +17 -14
- package/dist/vite/node/index.js +2 -3
- package/dist/vite/node/internal.js +1 -2
- package/dist/vite/node/module-runner.d.ts +5 -1
- package/dist/vite/node/module-runner.js +44 -3
- package/dist/vite/types/customEvent.d.ts +27 -0
- package/package.json +10 -10
- package/dist/rolldown/cli-setup.d.mts +0 -1
- package/dist/rolldown/cli-setup.mjs +0 -17
- package/dist/tsdown/build-gOkJM1H9-BRI3DQle.js +0 -6
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
const require_chunk = require('./npm_cjs_chunk_chunk.cjs');
|
|
2
|
-
|
|
3
1
|
//#region ../../node_modules/.pnpm/tree-kill@1.2.2/node_modules/tree-kill/index.js
|
|
4
|
-
var require_tree_kill = /* @__PURE__ */
|
|
2
|
+
var require_tree_kill = /* @__PURE__ */ require("./npm_cjs_chunk_chunk.cjs").__commonJSMin(((exports, module) => {
|
|
5
3
|
var childProcess = require("child_process");
|
|
6
4
|
var spawn = childProcess.spawn;
|
|
7
5
|
var exec = childProcess.exec;
|
|
@@ -95,9 +93,7 @@ var require_tree_kill = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
|
|
|
95
93
|
ps.on("close", onClose);
|
|
96
94
|
}
|
|
97
95
|
}));
|
|
98
|
-
|
|
99
96
|
//#endregion
|
|
100
97
|
//#region dist/tsdown/_npm_entry_tree-kill.cjs
|
|
101
98
|
module.exports = require_tree_kill();
|
|
102
|
-
|
|
103
|
-
//#endregion
|
|
99
|
+
//#endregion
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as createDebug } from "./node-
|
|
2
|
-
|
|
1
|
+
import { t as createDebug } from "./node-B3Gdtau1.js";
|
|
3
2
|
//#region ../../node_modules/.pnpm/rolldown-plugin-dts@0.22.4_@typescript+native-preview@7.0.0-dev.20260122.2_oxc-resolver_e2c498b62da30912fd0b48bf4746dbba/node_modules/rolldown-plugin-dts/dist/resolver-CdD-yT15.mjs
|
|
4
3
|
const __cjs_require = globalThis.process.getBuiltinModule("module").createRequire(import.meta.url);
|
|
5
4
|
const path = globalThis.process.getBuiltinModule("node:path");
|
|
@@ -15,6 +14,5 @@ function tscResolve(id, importer, cwd, tsconfig, tsconfigRaw, reference) {
|
|
|
15
14
|
debug(`tsc resolving id "%s" from "%s" -> %O`, id, importer, resolved.resolvedModule);
|
|
16
15
|
return resolved.resolvedModule?.resolvedFileName;
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
//#endregion
|
|
20
|
-
export { tscResolve };
|
|
18
|
+
export { tscResolve };
|
package/dist/tsdown/run.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { c as globalLogger, f as dim, g as yellow, r as version, t as K } from "./main-
|
|
3
|
-
import "./node-
|
|
4
|
-
import { t as enableDebug } from "./debug-
|
|
2
|
+
import { c as globalLogger, f as dim, g as yellow, r as version, t as K } from "./main-DN-_H9u2.js";
|
|
3
|
+
import "./node-B3Gdtau1.js";
|
|
4
|
+
import { t as enableDebug } from "./debug-C4FmgzkJ-B6m_gRpz.js";
|
|
5
5
|
import module, { createRequire } from "node:module";
|
|
6
6
|
import process$1 from "node:process";
|
|
7
7
|
import { VERSION } from "@voidzero-dev/vite-plus-core/rolldown";
|
|
8
|
-
|
|
9
8
|
//#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
|
|
10
9
|
function toArr(any) {
|
|
11
10
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
@@ -623,11 +622,7 @@ var CAC = class extends EventTarget {
|
|
|
623
622
|
* @param name The program name to display in help and version message
|
|
624
623
|
*/
|
|
625
624
|
const cac = (name = "") => new CAC(name);
|
|
626
|
-
|
|
627
|
-
//#endregion
|
|
628
|
-
//#region ../../node_modules/.pnpm/tsdown@0.21.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.21.0_@tsdown+exe@0.21.0_@type_743816f26d68021f6369d2afb428dae9/node_modules/tsdown/dist/run.mjs
|
|
629
|
-
const __cjs_require = createRequire(import.meta.url);
|
|
630
|
-
const lt = __cjs_require("./npm_entry_semver_functions_lt.cjs");
|
|
625
|
+
const lt = createRequire(import.meta.url)("./npm_entry_semver_functions_lt.cjs");
|
|
631
626
|
const cli = cac("tsdown");
|
|
632
627
|
cli.help().version(version);
|
|
633
628
|
cli.command("[...files]", "Bundle files", {
|
|
@@ -636,7 +631,7 @@ cli.command("[...files]", "Bundle files", {
|
|
|
636
631
|
}).option("-c, --config <filename>", "Use a custom config file").option("--config-loader <loader>", "Config loader to use: auto, native, unrun", { default: "auto" }).option("--no-config", "Disable config file").option("-f, --format <format>", "Bundle format: esm, cjs, iife, umd", { default: "esm" }).option("--clean", "Clean output directory, --no-clean to disable").option("--deps.never-bundle <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--devtools", "Enable devtools integration").option("--debug [feat]", "Show debug logs").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("-l, --logLevel <level>", "Set log level: info, warn, error, silent").option("--fail-on-warn", "Fail on warnings", { default: true }).option("--no-write", "Disable writing files to disk, incompatible with watch mode").option("-d, --out-dir <dir>", "Output directory", { default: "dist" }).option("--treeshake", "Tree-shake bundle", { default: true }).option("--sourcemap", "Generate source map", { default: false }).option("--shims", "Enable cjs and esm shims ", { default: false }).option("--platform <platform>", "Target platform", { default: "node" }).option("--dts", "Generate dts files").option("--publint", "Enable publint", { default: false }).option("--attw", "Enable Are the types wrong integration", { default: false }).option("--unused", "Enable unused dependencies check", { default: false }).option("-w, --watch [path]", "Watch mode").option("--ignore-watch <path>", "Ignore custom paths in watch mode").option("--from-vite [vitest]", "Reuse config from Vite or Vitest").option("--report", "Size report", { default: true }).option("--env.* <value>", "Define compile-time env variables").option("--env-file <file>", "Load environment variables from a file, when used together with --env, variables in --env take precedence").option("--env-prefix <prefix>", "Prefix for env variables to inject into the bundle", { default: "TSDOWN_" }).option("--on-success <command>", "Command to run on success").option("--copy <dir>", "Copy files to output dir").option("--public-dir <dir>", "Alias for --copy, deprecated").option("--tsconfig <tsconfig>", "Set tsconfig path").option("--unbundle", "Unbundle mode").option("--exe", "Bundle as executable").option("-W, --workspace [dir]", "Enable workspace mode").option("-F, --filter <pattern>", "Filter configs (cwd or name), e.g. /pkg-name$/ or pkg-name").option("--exports", "Generate export-related metadata for package.json (experimental)").action(async (input, flags) => {
|
|
637
632
|
globalLogger.level = flags.logLevel || "info";
|
|
638
633
|
globalLogger.info(`tsdown ${dim`v${version}`} powered by rolldown ${dim`v${VERSION}`}`);
|
|
639
|
-
const { build } = await import("./build-
|
|
634
|
+
const { build } = await import("./build-DHPfiKA--CvTonTfC.js");
|
|
640
635
|
if (input.length > 0) flags.entry = input;
|
|
641
636
|
await build(flags);
|
|
642
637
|
});
|
|
@@ -673,6 +668,5 @@ try {
|
|
|
673
668
|
module.enableCompileCache?.();
|
|
674
669
|
} catch {}
|
|
675
670
|
runCLI();
|
|
676
|
-
|
|
677
671
|
//#endregion
|
|
678
|
-
export {
|
|
672
|
+
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { t as createDebug } from "./node-
|
|
2
|
-
import { n as RE_DTS, r as RE_DTS_MAP } from "./filename-
|
|
3
|
-
import { n as globalContext } from "./tsc-context-
|
|
4
|
-
|
|
1
|
+
import { t as createDebug } from "./node-B3Gdtau1.js";
|
|
2
|
+
import { n as RE_DTS, r as RE_DTS_MAP } from "./filename-tIvGuRvQ.js";
|
|
3
|
+
import { n as globalContext } from "./tsc-context-DiIjfXAG.js";
|
|
5
4
|
//#region ../../node_modules/.pnpm/rolldown-plugin-dts@0.22.4_@typescript+native-preview@7.0.0-dev.20260122.2_oxc-resolver_e2c498b62da30912fd0b48bf4746dbba/node_modules/rolldown-plugin-dts/dist/tsc-Bq8zpODY.mjs
|
|
6
5
|
const __cjs_require = globalThis.process.getBuiltinModule("module").createRequire(import.meta.url);
|
|
7
6
|
const { createRequire } = globalThis.process.getBuiltinModule("node:module");
|
|
@@ -413,6 +412,5 @@ function tscEmit(tscOptions) {
|
|
|
413
412
|
if (tscOptions.build) return tscEmitBuild(tscOptions);
|
|
414
413
|
else return tscEmitCompiler(tscOptions);
|
|
415
414
|
}
|
|
416
|
-
|
|
417
415
|
//#endregion
|
|
418
|
-
export { tscEmit };
|
|
416
|
+
export { tscEmit };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as createDebug } from "./node-
|
|
2
|
-
|
|
1
|
+
import { t as createDebug } from "./node-B3Gdtau1.js";
|
|
3
2
|
//#region ../../node_modules/.pnpm/rolldown-plugin-dts@0.22.4_@typescript+native-preview@7.0.0-dev.20260122.2_oxc-resolver_e2c498b62da30912fd0b48bf4746dbba/node_modules/rolldown-plugin-dts/dist/tsc-context.mjs
|
|
4
3
|
const path = globalThis.process.getBuiltinModule("node:path");
|
|
5
4
|
const debug = createDebug("rolldown-plugin-dts:tsc-context");
|
|
@@ -20,6 +19,5 @@ function invalidateContextFile(context, file) {
|
|
|
20
19
|
context.projects.clear();
|
|
21
20
|
}
|
|
22
21
|
const globalContext = createContext();
|
|
23
|
-
|
|
24
22
|
//#endregion
|
|
25
|
-
export { globalContext as n, invalidateContextFile as r, createContext as t };
|
|
23
|
+
export { globalContext as n, invalidateContextFile as r, createContext as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "@vite/env";
|
|
2
|
-
|
|
3
2
|
//#region \0@oxc-project+runtime@0.115.0/helpers/typeof.js
|
|
4
3
|
function _typeof(o) {
|
|
5
4
|
"@babel/helpers - typeof";
|
|
@@ -9,7 +8,6 @@ function _typeof(o) {
|
|
|
9
8
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
10
9
|
}, _typeof(o);
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
//#endregion
|
|
14
12
|
//#region \0@oxc-project+runtime@0.115.0/helpers/toPrimitive.js
|
|
15
13
|
function toPrimitive(t, r) {
|
|
@@ -22,14 +20,12 @@ function toPrimitive(t, r) {
|
|
|
22
20
|
}
|
|
23
21
|
return ("string" === r ? String : Number)(t);
|
|
24
22
|
}
|
|
25
|
-
|
|
26
23
|
//#endregion
|
|
27
24
|
//#region \0@oxc-project+runtime@0.115.0/helpers/toPropertyKey.js
|
|
28
25
|
function toPropertyKey(t) {
|
|
29
26
|
var i = toPrimitive(t, "string");
|
|
30
27
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
31
28
|
}
|
|
32
|
-
|
|
33
29
|
//#endregion
|
|
34
30
|
//#region \0@oxc-project+runtime@0.115.0/helpers/defineProperty.js
|
|
35
31
|
function _defineProperty(e, r, t) {
|
|
@@ -40,7 +36,6 @@ function _defineProperty(e, r, t) {
|
|
|
40
36
|
writable: !0
|
|
41
37
|
}) : e[r] = t, e;
|
|
42
38
|
}
|
|
43
|
-
|
|
44
39
|
//#endregion
|
|
45
40
|
//#region ../../rolldown-vite/packages/vite/src/shared/hmr.ts
|
|
46
41
|
var HMRContext = class {
|
|
@@ -224,7 +219,6 @@ var HMRClient = class {
|
|
|
224
219
|
};
|
|
225
220
|
}
|
|
226
221
|
};
|
|
227
|
-
|
|
228
222
|
//#endregion
|
|
229
223
|
//#region ../../node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/non-secure/index.js
|
|
230
224
|
let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
@@ -234,16 +228,12 @@ let nanoid = (size = 21) => {
|
|
|
234
228
|
while (i--) id += urlAlphabet[Math.random() * 64 | 0];
|
|
235
229
|
return id;
|
|
236
230
|
};
|
|
237
|
-
|
|
238
231
|
//#endregion
|
|
239
232
|
//#region ../../rolldown-vite/packages/vite/src/shared/constants.ts
|
|
240
233
|
let SOURCEMAPPING_URL = "sourceMa";
|
|
241
234
|
SOURCEMAPPING_URL += "ppingURL";
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
//#region ../../rolldown-vite/packages/vite/src/shared/utils.ts
|
|
245
|
-
const isWindows = typeof process !== "undefined" && process.platform === "win32";
|
|
246
|
-
const AsyncFunction = async function() {}.constructor;
|
|
235
|
+
typeof process !== "undefined" && process.platform;
|
|
236
|
+
(async function() {}).constructor;
|
|
247
237
|
function promiseWithResolvers() {
|
|
248
238
|
let resolve;
|
|
249
239
|
let reject;
|
|
@@ -256,7 +246,6 @@ function promiseWithResolvers() {
|
|
|
256
246
|
reject
|
|
257
247
|
};
|
|
258
248
|
}
|
|
259
|
-
|
|
260
249
|
//#endregion
|
|
261
250
|
//#region ../../rolldown-vite/packages/vite/src/shared/moduleRunnerTransport.ts
|
|
262
251
|
function reviveInvokeError(e) {
|
|
@@ -450,7 +439,6 @@ const createWebSocketModuleRunnerTransport = (options) => {
|
|
|
450
439
|
}
|
|
451
440
|
};
|
|
452
441
|
};
|
|
453
|
-
|
|
454
442
|
//#endregion
|
|
455
443
|
//#region ../../rolldown-vite/packages/vite/src/shared/hmrHandler.ts
|
|
456
444
|
function createHMRHandler(handler) {
|
|
@@ -484,7 +472,116 @@ var Queue = class {
|
|
|
484
472
|
return true;
|
|
485
473
|
}
|
|
486
474
|
};
|
|
487
|
-
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region ../../rolldown-vite/packages/vite/src/shared/forwardConsole.ts
|
|
477
|
+
function setupForwardConsoleHandler(transport, options) {
|
|
478
|
+
if (!options.enabled) return;
|
|
479
|
+
function sendError(type, error) {
|
|
480
|
+
transport.send({
|
|
481
|
+
type: "custom",
|
|
482
|
+
event: "vite:forward-console",
|
|
483
|
+
data: {
|
|
484
|
+
type,
|
|
485
|
+
data: {
|
|
486
|
+
name: error?.name || "Unknown Error",
|
|
487
|
+
message: error?.message || String(error),
|
|
488
|
+
stack: error?.stack
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
function sendLog(level, args) {
|
|
494
|
+
transport.send({
|
|
495
|
+
type: "custom",
|
|
496
|
+
event: "vite:forward-console",
|
|
497
|
+
data: {
|
|
498
|
+
type: "log",
|
|
499
|
+
data: {
|
|
500
|
+
level,
|
|
501
|
+
message: formatConsoleArgs(args)
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
for (const level of options.logLevels) {
|
|
507
|
+
const original = console[level];
|
|
508
|
+
if (typeof original !== "function") continue;
|
|
509
|
+
console[level] = (...args) => {
|
|
510
|
+
original(...args);
|
|
511
|
+
sendLog(level, args);
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
if (options.unhandledErrors && typeof window !== "undefined") {
|
|
515
|
+
window.addEventListener("error", (event) => {
|
|
516
|
+
sendError("error", event.error ?? (event.message ? new Error(event.message) : event));
|
|
517
|
+
});
|
|
518
|
+
window.addEventListener("unhandledrejection", (event) => {
|
|
519
|
+
sendError("unhandled-rejection", event.reason);
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
function formatConsoleArgs(args) {
|
|
524
|
+
if (args.length === 0) return "";
|
|
525
|
+
if (typeof args[0] !== "string") return args.map((arg) => stringifyConsoleArg(arg)).join(" ");
|
|
526
|
+
const len = args.length;
|
|
527
|
+
let i = 1;
|
|
528
|
+
let message = args[0].replace(/%[sdjifoOc%]/g, (specifier) => {
|
|
529
|
+
if (specifier === "%%") return "%";
|
|
530
|
+
if (i >= len) return specifier;
|
|
531
|
+
const arg = args[i++];
|
|
532
|
+
switch (specifier) {
|
|
533
|
+
case "%s":
|
|
534
|
+
if (typeof arg === "bigint") return `${arg.toString()}n`;
|
|
535
|
+
return typeof arg === "object" && arg != null ? stringifyConsoleArg(arg) : String(arg);
|
|
536
|
+
case "%d":
|
|
537
|
+
if (typeof arg === "bigint") return `${arg.toString()}n`;
|
|
538
|
+
if (typeof arg === "symbol") return "NaN";
|
|
539
|
+
return Number(arg).toString();
|
|
540
|
+
case "%i":
|
|
541
|
+
if (typeof arg === "bigint") return `${arg.toString()}n`;
|
|
542
|
+
return Number.parseInt(String(arg), 10).toString();
|
|
543
|
+
case "%f": return Number.parseFloat(String(arg)).toString();
|
|
544
|
+
case "%o":
|
|
545
|
+
case "%O": return stringifyConsoleArg(arg);
|
|
546
|
+
case "%j": try {
|
|
547
|
+
return JSON.stringify(arg) ?? "undefined";
|
|
548
|
+
} catch {
|
|
549
|
+
return "[Circular]";
|
|
550
|
+
}
|
|
551
|
+
case "%c": return "";
|
|
552
|
+
default: return specifier;
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
for (let arg = args[i]; i < len; arg = args[++i]) if (arg == null || typeof arg !== "object") message += ` ${typeof arg === "symbol" ? arg.toString() : String(arg)}`;
|
|
556
|
+
else message += ` ${stringifyConsoleArg(arg)}`;
|
|
557
|
+
return message;
|
|
558
|
+
}
|
|
559
|
+
function stringifyConsoleArg(value) {
|
|
560
|
+
if (typeof value === "string") return value;
|
|
561
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "undefined") return String(value);
|
|
562
|
+
if (typeof value === "symbol") return value.toString();
|
|
563
|
+
if (typeof value === "function") return value.name ? `[Function: ${value.name}]` : "[Function]";
|
|
564
|
+
if (value instanceof Error) return value.stack || `${value.name}: ${value.message}`;
|
|
565
|
+
if (typeof value === "bigint") return `${value}n`;
|
|
566
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
567
|
+
try {
|
|
568
|
+
return JSON.stringify(value, (_, nested) => {
|
|
569
|
+
if (typeof nested === "bigint") return `${nested}n`;
|
|
570
|
+
if (nested instanceof Error) return {
|
|
571
|
+
name: nested.name,
|
|
572
|
+
message: nested.message,
|
|
573
|
+
stack: nested.stack
|
|
574
|
+
};
|
|
575
|
+
if (nested && typeof nested === "object") {
|
|
576
|
+
if (seen.has(nested)) return "[Circular]";
|
|
577
|
+
seen.add(nested);
|
|
578
|
+
}
|
|
579
|
+
return nested;
|
|
580
|
+
}) ?? String(value);
|
|
581
|
+
} catch {
|
|
582
|
+
return String(value);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
488
585
|
//#endregion
|
|
489
586
|
//#region ../../rolldown-vite/packages/vite/src/client/overlay.ts
|
|
490
587
|
const hmrConfigName = __HMR_CONFIG_NAME__;
|
|
@@ -726,8 +823,7 @@ var ErrorOverlay = class extends HTMLElement {
|
|
|
726
823
|
};
|
|
727
824
|
const overlayId = "vite-error-overlay";
|
|
728
825
|
const { customElements } = globalThis;
|
|
729
|
-
if (customElements && !customElements.get(
|
|
730
|
-
|
|
826
|
+
if (customElements && !customElements.get("vite-error-overlay")) customElements.define(overlayId, ErrorOverlay);
|
|
731
827
|
//#endregion
|
|
732
828
|
//#region ../../rolldown-vite/packages/vite/src/client/client.ts
|
|
733
829
|
console.debug("[vite] connecting...");
|
|
@@ -741,6 +837,7 @@ const base = __BASE__ || "/";
|
|
|
741
837
|
const hmrTimeout = __HMR_TIMEOUT__;
|
|
742
838
|
const wsToken = __WS_TOKEN__;
|
|
743
839
|
const isBundleMode = __BUNDLED_DEV__;
|
|
840
|
+
const forwardConsole = __SERVER_FORWARD_CONSOLE__;
|
|
744
841
|
const transport = normalizeModuleRunnerTransport((() => {
|
|
745
842
|
let wsTransport = createWebSocketModuleRunnerTransport({
|
|
746
843
|
createConnection: () => new WebSocket(`${socketProtocol}://${socketHost}?token=${wsToken}`, "vite-hmr"),
|
|
@@ -829,6 +926,7 @@ const hmrClient = new HMRClient({
|
|
|
829
926
|
return await importPromise;
|
|
830
927
|
});
|
|
831
928
|
transport.connect(createHMRHandler(handleMessage));
|
|
929
|
+
setupForwardConsoleHandler(transport, forwardConsole);
|
|
832
930
|
async function handleMessage(payload) {
|
|
833
931
|
switch (payload.type) {
|
|
834
932
|
case "connected":
|
|
@@ -1135,6 +1233,5 @@ if (isBundleMode && typeof DevRuntime !== "undefined") {
|
|
|
1135
1233
|
}
|
|
1136
1234
|
} }));
|
|
1137
1235
|
}
|
|
1138
|
-
|
|
1139
1236
|
//#endregion
|
|
1140
|
-
export { ErrorOverlay, createHotContext, injectQuery, removeStyle, updateStyle };
|
|
1237
|
+
export { ErrorOverlay, createHotContext, injectQuery, removeStyle, updateStyle };
|
package/dist/vite/client/env.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import "./logger.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export { createBuilder, resolveBuildPlugins };
|
|
2
|
+
import { M as createBuilder, z as resolveBuildPlugins } from "./node.js";
|
|
3
|
+
export { createBuilder, resolveBuildPlugins };
|