@kubb/core 5.10.1 → 5.10.3
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/{Hookable-ZX2OqaPh.js → Hookable-BsWZ8pHO.js} +427 -323
- package/dist/Hookable-BsWZ8pHO.js.map +1 -0
- package/dist/Hookable-C4S0gBso.cjs +3030 -0
- package/dist/Hookable-C4S0gBso.cjs.map +1 -0
- package/dist/{Hookable-BnYDebfN.cjs → Hookable-pvEb-nN9.cjs} +418 -321
- package/dist/Hookable-pvEb-nN9.cjs.map +1 -0
- package/dist/{createAdapter-D55JE9lX.d.ts → createAdapter-B5kKMsWV.d.cts} +851 -732
- package/dist/createAdapter-B5kKMsWV.d.ts +3147 -0
- package/dist/index.cjs +31 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +620 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.js +31 -19
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +1 -1
- package/dist/mocks.d.cts +107 -0
- package/dist/mocks.d.ts +1 -2
- package/dist/mocks.js +1 -2
- package/dist/mocks.js.map +1 -1
- package/package.json +26 -8
- package/dist/Hookable-BnYDebfN.cjs.map +0 -1
- package/dist/Hookable-ZX2OqaPh.js.map +0 -1
- package/dist/rolldown-runtime-CRm0XQPb.js +0 -9
package/dist/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { A as inParallel, C as useOptions, D as Diagnostics, E as resolveMeta, F as toError, M as read, N as toPosixPath, O as formatMs, P as write, S as useKubb, T as defineExtension, _ as setMacros, b as tryUseKubb, c as Resolver, d as definePlugin, f as addGenerator, g as requirePlugin, h as kubbContext, j as isPathInside, k as getElapsedMs, l as getInputKind, m as injectFile, n as KubbDriver, o as _usingCtx, p as addMacro, s as createResolver, t as Hookable, u as assertPluginOption, v as setOptions, w as checkCompatibility, x as useConfig, y as setResolver } from "./Hookable-ZX2OqaPh.js";
|
|
1
|
+
import { A as inParallel, C as useOptions, D as Diagnostics, E as resolveMeta, F as toError, M as read, N as toPosixPath, O as formatMs, P as write, S as useKubb, T as defineExtension, _ as setMacros, b as tryUseKubb, c as Resolver, d as definePlugin, f as addGenerator, g as requirePlugin, h as kubbContext, j as isPathInside, k as getElapsedMs, l as getInputKind, m as injectFile, n as KubbDriver, o as _usingCtx, p as addMacro, s as createResolver, t as Hookable, u as assertPluginOption, v as setOptions, w as checkCompatibility, x as useConfig, y as setResolver } from "./Hookable-BsWZ8pHO.js";
|
|
3
2
|
import { createRequire } from "node:module";
|
|
4
3
|
import { isValid } from "verkit";
|
|
5
|
-
import { stripVTControlCharacters, styleText } from "node:util";
|
|
6
4
|
import process$1 from "node:process";
|
|
7
5
|
import { x } from "tinyexec";
|
|
8
6
|
import { glob, readFile, rm } from "node:fs/promises";
|
|
9
7
|
import path, { join, relative, resolve } from "node:path";
|
|
8
|
+
import { stripVTControlCharacters, styleText } from "node:util";
|
|
10
9
|
import { hash, randomUUID } from "node:crypto";
|
|
11
10
|
import { chmodSync, existsSync, mkdirSync } from "node:fs";
|
|
12
11
|
import { homedir, tmpdir } from "node:os";
|
|
@@ -632,7 +631,11 @@ var Kubb = class {
|
|
|
632
631
|
return this.config.storage;
|
|
633
632
|
}
|
|
634
633
|
get driver() {
|
|
635
|
-
if (!this.#driver) throw new Error(
|
|
634
|
+
if (!this.#driver) throw new Diagnostics.Error({
|
|
635
|
+
code: Diagnostics.code.internalError,
|
|
636
|
+
severity: "error",
|
|
637
|
+
message: "[kubb] setup() must be called before accessing driver"
|
|
638
|
+
});
|
|
636
639
|
return this.#driver;
|
|
637
640
|
}
|
|
638
641
|
/**
|
|
@@ -720,19 +723,23 @@ var Kubb = class {
|
|
|
720
723
|
const { hooks, config } = this;
|
|
721
724
|
const hrStart = process.hrtime();
|
|
722
725
|
await hooks.callHook("kubb:generation:start", { config });
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
if (
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
726
|
+
let output;
|
|
727
|
+
try {
|
|
728
|
+
await hooks.callHook("kubb:setup:start");
|
|
729
|
+
await this.setup();
|
|
730
|
+
await hooks.callHook("kubb:setup:end");
|
|
731
|
+
output = await this.safeBuild();
|
|
732
|
+
} catch (caughtError) {
|
|
733
|
+
if (signal?.aborted) throw caughtError;
|
|
734
|
+
output = {
|
|
735
|
+
files: [],
|
|
736
|
+
diagnostics: [Diagnostics.from(caughtError)]
|
|
737
|
+
};
|
|
735
738
|
}
|
|
739
|
+
const { files, diagnostics } = output;
|
|
740
|
+
const storage = this.storage;
|
|
741
|
+
signal?.throwIfAborted();
|
|
742
|
+
for (const diagnostic of diagnostics) if (Diagnostics.isProblem(diagnostic)) await Diagnostics.emit(hooks, diagnostic);
|
|
736
743
|
if (Diagnostics.hasError(diagnostics)) {
|
|
737
744
|
await hooks.callHook("kubb:generation:end", {
|
|
738
745
|
config,
|
|
@@ -873,7 +880,7 @@ function buildReport(result) {
|
|
|
873
880
|
name: config.name ?? "",
|
|
874
881
|
status,
|
|
875
882
|
plugins: {
|
|
876
|
-
passed: total - failed.length,
|
|
883
|
+
passed: status === "failed" && timings.length === 0 ? 0 : total - failed.length,
|
|
877
884
|
failed,
|
|
878
885
|
total
|
|
879
886
|
},
|
|
@@ -895,7 +902,12 @@ function buildReport(result) {
|
|
|
895
902
|
function formatSummary(report, { showTimings }) {
|
|
896
903
|
const { status, plugins, counts, filesCreated, durationMs, output, timings } = report;
|
|
897
904
|
const rows = [];
|
|
898
|
-
|
|
905
|
+
const notRun = plugins.total - plugins.passed - plugins.failed.length;
|
|
906
|
+
rows.push(["Plugins", status === "success" ? `${styleText("green", `${plugins.passed} passed`)} (${plugins.total})` : [
|
|
907
|
+
styleText("green", `${plugins.passed} passed`),
|
|
908
|
+
styleText("red", `${plugins.failed.length} failed`),
|
|
909
|
+
notRun > 0 ? styleText("dim", `${notRun} not run`) : void 0
|
|
910
|
+
].filter(Boolean).join(" | ") + ` (${plugins.total})`]);
|
|
899
911
|
if (status === "failed" && plugins.failed.length > 0) rows.push(["Failed", plugins.failed.map((name) => styleText("red", name)).join(", ")]);
|
|
900
912
|
if (counts.errors > 0 || counts.warnings > 0) {
|
|
901
913
|
const issues = [counts.errors > 0 ? styleText("red", `${counts.errors} ${counts.errors === 1 ? "error" : "errors"}`) : void 0, counts.warnings > 0 ? styleText("yellow", `${counts.warnings} ${counts.warnings === 1 ? "warning" : "warnings"}`) : void 0].filter(Boolean).join(" | ");
|
|
@@ -1011,7 +1023,7 @@ function buildProblemSection(diagnostics) {
|
|
|
1011
1023
|
return [
|
|
1012
1024
|
"## Problems",
|
|
1013
1025
|
"",
|
|
1014
|
-
problems.map((diagnostic) => Diagnostics.
|
|
1026
|
+
problems.map((diagnostic) => Diagnostics.format(diagnostic, { verbose: true }).join("\n")).join("\n\n")
|
|
1015
1027
|
];
|
|
1016
1028
|
}
|
|
1017
1029
|
/**
|