@kubb/cli 5.11.4 → 5.11.6
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/{Telemetry-Be1nltUh.cjs → Telemetry-Be3hIy6_.cjs} +2 -42
- package/dist/Telemetry-Be3hIy6_.cjs.map +1 -0
- package/dist/{Telemetry-CwaVQsvD.js → Telemetry-CfJAUDnh.js} +3 -31
- package/dist/Telemetry-CfJAUDnh.js.map +1 -0
- package/dist/{background-CQPyCSn0.js → background-BBpH2jmk.js} +7 -5
- package/dist/background-BBpH2jmk.js.map +1 -0
- package/dist/{background-mKdZ5HRx.cjs → background-BW-e9FCX.cjs} +5 -4
- package/dist/background-BW-e9FCX.cjs.map +1 -0
- package/dist/{background-aTbwrgui.js → background-DS2zOde-.js} +1 -1
- package/dist/config-Bh00Hwpw.js +132 -0
- package/dist/config-Bh00Hwpw.js.map +1 -0
- package/dist/config-D63Gum4F.cjs +169 -0
- package/dist/config-D63Gum4F.cjs.map +1 -0
- package/dist/config-iVdOcpro.js +1 -0
- package/dist/credentials-CZK6zPLv.js.map +1 -1
- package/dist/credentials-DDaKqtJn.cjs.map +1 -1
- package/dist/errors-Cl69p_vI.cjs +43 -0
- package/dist/errors-Cl69p_vI.cjs.map +1 -0
- package/dist/errors-DmC83ALX.js +32 -0
- package/dist/errors-DmC83ALX.js.map +1 -0
- package/dist/index.cjs +872 -307
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +863 -298
- package/dist/index.js.map +1 -1
- package/dist/registry-BlKLO4ft.cjs +272 -0
- package/dist/registry-BlKLO4ft.cjs.map +1 -0
- package/dist/registry-CgQYxUju.js +200 -0
- package/dist/registry-CgQYxUju.js.map +1 -0
- package/dist/reporters-Dl8lrJZG.js +817 -0
- package/dist/reporters-Dl8lrJZG.js.map +1 -0
- package/dist/reporters-TkCgd4dS.cjs +829 -0
- package/dist/reporters-TkCgd4dS.cjs.map +1 -0
- package/dist/{run-YHth5Afz.js → run-BJn0RSW2.js} +170 -76
- package/dist/run-BJn0RSW2.js.map +1 -0
- package/dist/{run-BWRmQxtE.cjs → run-BszyZwY3.cjs} +176 -82
- package/dist/run-BszyZwY3.cjs.map +1 -0
- package/dist/{run-Bczs5vbI.cjs → run-BtVKUjdK.cjs} +4 -3
- package/dist/{run-Bczs5vbI.cjs.map → run-BtVKUjdK.cjs.map} +1 -1
- package/dist/run-CFf0yxyY.cjs +94 -0
- package/dist/run-CFf0yxyY.cjs.map +1 -0
- package/dist/run-D_dD7xHp.js +93 -0
- package/dist/run-D_dD7xHp.js.map +1 -0
- package/dist/run-DsJJCzQD.js +1 -0
- package/dist/{run-B6VxJ_VM.js → run-KuzAqsjg.js} +3 -2
- package/dist/{run-B6VxJ_VM.js.map → run-KuzAqsjg.js.map} +1 -1
- package/dist/run-TrjCNL8e.cjs +227 -0
- package/dist/run-TrjCNL8e.cjs.map +1 -0
- package/dist/run-wkN1irUo.js +224 -0
- package/dist/run-wkN1irUo.js.map +1 -0
- package/dist/{snapshot-Cilp10vE.js → snapshot-CdGwHH15.js} +49 -62
- package/dist/snapshot-CdGwHH15.js.map +1 -0
- package/dist/{snapshot-D_rXnnMH.cjs → snapshot-u4L8mh4Y.cjs} +51 -64
- package/dist/snapshot-u4L8mh4Y.cjs.map +1 -0
- package/dist/status-DHPeR3bq.js +77 -0
- package/dist/status-DHPeR3bq.js.map +1 -0
- package/dist/status-dpSvxxtN.cjs +78 -0
- package/dist/status-dpSvxxtN.cjs.map +1 -0
- package/dist/studioWorker.js +2 -2
- package/dist/summary-6-rotl2L.cjs +46 -0
- package/dist/summary-6-rotl2L.cjs.map +1 -0
- package/dist/summary-DkSLti6f.js +41 -0
- package/dist/summary-DkSLti6f.js.map +1 -0
- package/dist/text-CMP4M19Z.js +239 -0
- package/dist/text-CMP4M19Z.js.map +1 -0
- package/dist/text-CknhKMvM.cjs +341 -0
- package/dist/text-CknhKMvM.cjs.map +1 -0
- package/dist/utils-CnjEJIdZ.js +612 -0
- package/dist/utils-CnjEJIdZ.js.map +1 -0
- package/dist/utils-DpKrXR2t.cjs +727 -0
- package/dist/utils-DpKrXR2t.cjs.map +1 -0
- package/package.json +7 -7
- package/dist/Telemetry-Be1nltUh.cjs.map +0 -1
- package/dist/Telemetry-CwaVQsvD.js.map +0 -1
- package/dist/background-CQPyCSn0.js.map +0 -1
- package/dist/background-mKdZ5HRx.cjs.map +0 -1
- package/dist/config-B56ZuVhi.js +0 -95
- package/dist/config-B56ZuVhi.js.map +0 -1
- package/dist/config-Cs4N79Fm.cjs +0 -113
- package/dist/config-Cs4N79Fm.cjs.map +0 -1
- package/dist/output-HgzJqkSF.cjs +0 -1076
- package/dist/output-HgzJqkSF.cjs.map +0 -1
- package/dist/output-PhkPtNP7.js +0 -937
- package/dist/output-PhkPtNP7.js.map +0 -1
- package/dist/registry-DYUhC7rH.js +0 -115
- package/dist/registry-DYUhC7rH.js.map +0 -1
- package/dist/registry-tk-v78fd.cjs +0 -157
- package/dist/registry-tk-v78fd.cjs.map +0 -1
- package/dist/run-AfjIBtiL.js +0 -39
- package/dist/run-AfjIBtiL.js.map +0 -1
- package/dist/run-BWRmQxtE.cjs.map +0 -1
- package/dist/run-B_Gr9TJ4.cjs +0 -345
- package/dist/run-B_Gr9TJ4.cjs.map +0 -1
- package/dist/run-CwrI0wRy.js +0 -1
- package/dist/run-DDoJGjWT.cjs +0 -40
- package/dist/run-DDoJGjWT.cjs.map +0 -1
- package/dist/run-SYKj8-Q5.js +0 -343
- package/dist/run-SYKj8-Q5.js.map +0 -1
- package/dist/run-YHth5Afz.js.map +0 -1
- package/dist/snapshot-Cilp10vE.js.map +0 -1
- package/dist/snapshot-D_rXnnMH.cjs.map +0 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-CPE0t6oh.cjs");
|
|
2
|
+
const require_errors = require("./errors-Cl69p_vI.cjs");
|
|
3
|
+
const require_Telemetry = require("./Telemetry-Be3hIy6_.cjs");
|
|
4
|
+
const require_text = require("./text-CknhKMvM.cjs");
|
|
5
|
+
const require_config = require("./config-D63Gum4F.cjs");
|
|
6
|
+
const require_summary = require("./summary-6-rotl2L.cjs");
|
|
7
|
+
let node_util = require("node:util");
|
|
8
|
+
let node_process = require("node:process");
|
|
9
|
+
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
10
|
+
let node_path = require("node:path");
|
|
11
|
+
//#region src/runners/validate/run.ts
|
|
12
|
+
/**
|
|
13
|
+
* Validates `input` with the configured adapters, falling back to OpenAPI when no config exists.
|
|
14
|
+
* Exits the process with code 1 on validation failure or missing dependency.
|
|
15
|
+
*/
|
|
16
|
+
async function run({ input, configPath }) {
|
|
17
|
+
const hrStart = node_process.default.hrtime();
|
|
18
|
+
const report = require_Telemetry.trackRun({
|
|
19
|
+
command: "validate",
|
|
20
|
+
hrStart
|
|
21
|
+
});
|
|
22
|
+
let adapterName;
|
|
23
|
+
try {
|
|
24
|
+
const configFile = configPath ?? require_config.findConfigFile();
|
|
25
|
+
const loaded = configFile ? await require_config.getConfigs({
|
|
26
|
+
configPath: configFile,
|
|
27
|
+
input
|
|
28
|
+
}).catch((error) => {
|
|
29
|
+
if (configPath) throw error;
|
|
30
|
+
}) : void 0;
|
|
31
|
+
const fallback = async () => {
|
|
32
|
+
adapterName = "@kubb/adapter-oas";
|
|
33
|
+
const { adapterOas } = await import("@kubb/adapter-oas");
|
|
34
|
+
return [{
|
|
35
|
+
adapter: adapterOas(),
|
|
36
|
+
input
|
|
37
|
+
}];
|
|
38
|
+
};
|
|
39
|
+
const unique = new Map((loaded?.configs ?? []).map((config) => {
|
|
40
|
+
const resolved = URL.canParse(input) ? input : (0, node_path.resolve)(config.root || node_process.default.cwd(), input);
|
|
41
|
+
return [`${config.adapter?.name}\0${resolved}`, {
|
|
42
|
+
adapter: config.adapter,
|
|
43
|
+
input: resolved
|
|
44
|
+
}];
|
|
45
|
+
}));
|
|
46
|
+
const targets = loaded ? [...unique.values()] : await fallback();
|
|
47
|
+
if (!targets.length) throw new Error("The Kubb config contains no configurations to validate.");
|
|
48
|
+
for (const target of targets) {
|
|
49
|
+
adapterName = target.adapter?.name;
|
|
50
|
+
if (!target.adapter) throw new Error("No adapter is configured. Set adapter in your Kubb config to validate this specification.");
|
|
51
|
+
await target.adapter.validate(target.input, { throwOnError: true });
|
|
52
|
+
}
|
|
53
|
+
const specifications = new Set(targets.map((target) => target.input)).size;
|
|
54
|
+
const adapterNames = [...new Set(targets.flatMap((target) => target.adapter?.name ?? []))];
|
|
55
|
+
await report({ status: "success" });
|
|
56
|
+
require_summary.logCommandSummary({
|
|
57
|
+
title: "Validation passed",
|
|
58
|
+
status: "success",
|
|
59
|
+
hrStart,
|
|
60
|
+
lines: [
|
|
61
|
+
` ${(0, node_util.styleText)("bold", `${require_text.pluralize(specifications, "specification")} validated`)}`,
|
|
62
|
+
` ${(0, node_util.styleText)("dim", "Input")} ${(0, node_util.styleText)("cyan", input)}`,
|
|
63
|
+
` ${(0, node_util.styleText)("dim", adapterNames.length === 1 ? "Adapter" : "Adapters")} ${adapterNames.join(", ")}`
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
} catch (error) {
|
|
67
|
+
await report({ status: "failed" });
|
|
68
|
+
const message = require_errors.toError(error).message;
|
|
69
|
+
const missingAdapter = adapterName === "@kubb/adapter-oas" && /(?:Cannot find|Cannot resolve|not found)[\s\S]*@kubb\/adapter-oas/.test(message);
|
|
70
|
+
require_summary.logCommandSummary({
|
|
71
|
+
title: missingAdapter ? "Could not validate" : "Validation failed",
|
|
72
|
+
status: "failed",
|
|
73
|
+
hrStart,
|
|
74
|
+
lines: [
|
|
75
|
+
` ${(0, node_util.styleText)("dim", "Input")} ${(0, node_util.styleText)("cyan", input)}`,
|
|
76
|
+
` ${(0, node_util.styleText)("dim", "Adapter")} ${adapterName ?? "not configured"}${missingAdapter ? " · not installed" : ""}`,
|
|
77
|
+
"",
|
|
78
|
+
(0, node_util.styleText)("bold", missingAdapter ? "Required package" : "Validation error"),
|
|
79
|
+
` ${(0, node_util.styleText)("red", message)}`,
|
|
80
|
+
...missingAdapter ? [
|
|
81
|
+
"",
|
|
82
|
+
"Install it with:",
|
|
83
|
+
(0, node_util.styleText)("cyan", " npm install @kubb/adapter-oas"),
|
|
84
|
+
(0, node_util.styleText)("cyan", " pnpm add @kubb/adapter-oas")
|
|
85
|
+
] : []
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
node_process.default.exit(1);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
exports.run = run;
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=run-CFf0yxyY.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-CFf0yxyY.cjs","names":["process","trackRun","findConfigFile","getConfigs","resolve","styleText","pluralize","toError"],"sources":["../src/runners/validate/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { resolve } from 'node:path'\nimport { styleText } from 'node:util'\nimport { findConfigFile } from '@internals/shared'\nimport { toError } from '@internals/utils'\nimport type { Config } from '@kubb/core'\nimport { trackRun } from '../../Telemetry.ts'\nimport { getConfigs } from '../../config.ts'\nimport { pluralize } from '../../ui/text.ts'\nimport { logCommandSummary } from '../../ui/summary.ts'\n\ntype ValidateOptions = {\n /**\n * Path or URL to the specification to validate.\n */\n input: string\n configPath?: string\n}\n\n/**\n * Validates `input` with the configured adapters, falling back to OpenAPI when no config exists.\n * Exits the process with code 1 on validation failure or missing dependency.\n */\nexport async function run({ input, configPath }: ValidateOptions): Promise<void> {\n const hrStart = process.hrtime()\n const report = trackRun({ command: 'validate', hrStart })\n let adapterName: string | undefined\n\n try {\n const configFile = configPath ?? findConfigFile()\n // A config found by search that does not load must not block validating a file; an explicit `--config` still fails.\n const loaded = configFile\n ? await getConfigs({ configPath: configFile, input }).catch((error) => {\n if (configPath) throw error\n })\n : undefined\n const fallback = async () => {\n adapterName = '@kubb/adapter-oas'\n const { adapterOas } = await import('@kubb/adapter-oas')\n return [{ adapter: adapterOas(), input }]\n }\n // An array config often repeats one adapter, so each adapter and input pair is validated once.\n const unique = new Map(\n (loaded?.configs ?? []).map((config) => {\n const resolved = URL.canParse(input) ? input : resolve(config.root || process.cwd(), input)\n return [`${config.adapter?.name}\\0${resolved}`, { adapter: config.adapter, input: resolved }] as const\n }),\n )\n const targets: Array<{ adapter: Config['adapter']; input: string }> = loaded ? [...unique.values()] : await fallback()\n if (!targets.length) throw new Error('The Kubb config contains no configurations to validate.')\n for (const target of targets) {\n adapterName = target.adapter?.name\n if (!target.adapter) throw new Error('No adapter is configured. Set adapter in your Kubb config to validate this specification.')\n await target.adapter.validate(target.input, { throwOnError: true })\n }\n const specifications = new Set(targets.map((target) => target.input)).size\n const adapterNames = [...new Set(targets.flatMap((target) => target.adapter?.name ?? []))]\n await report({ status: 'success' })\n\n logCommandSummary({\n title: 'Validation passed',\n status: 'success',\n hrStart,\n lines: [\n ` ${styleText('bold', `${pluralize(specifications, 'specification')} validated`)}`,\n ` ${styleText('dim', 'Input')} ${styleText('cyan', input)}`,\n ` ${styleText('dim', adapterNames.length === 1 ? 'Adapter' : 'Adapters')} ${adapterNames.join(', ')}`,\n ],\n })\n } catch (error) {\n await report({ status: 'failed' })\n const message = toError(error).message\n const missingAdapter = adapterName === '@kubb/adapter-oas' && /(?:Cannot find|Cannot resolve|not found)[\\s\\S]*@kubb\\/adapter-oas/.test(message)\n logCommandSummary({\n title: missingAdapter ? 'Could not validate' : 'Validation failed',\n status: 'failed',\n hrStart,\n lines: [\n ` ${styleText('dim', 'Input')} ${styleText('cyan', input)}`,\n ` ${styleText('dim', 'Adapter')} ${adapterName ?? 'not configured'}${missingAdapter ? ' · not installed' : ''}`,\n '',\n styleText('bold', missingAdapter ? 'Required package' : 'Validation error'),\n ` ${styleText('red', message)}`,\n ...(missingAdapter\n ? ['', 'Install it with:', styleText('cyan', ' npm install @kubb/adapter-oas'), styleText('cyan', ' pnpm add @kubb/ad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AAGA,GAAAA,UAAAA,UAAAA,CAAU,QAAQ,8BAA8B;IAAC,IAChI,CAAC;GACP;EACF,CAAC;EAED,aAAA,QAAQ,KAAK,CAAC;CAChB;AACF"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import "./rolldown-runtime-CRm0XQPb.js";
|
|
2
|
+
import { n as toError } from "./errors-DmC83ALX.js";
|
|
3
|
+
import { n as trackRun } from "./Telemetry-CfJAUDnh.js";
|
|
4
|
+
import { t as pluralize } from "./text-CMP4M19Z.js";
|
|
5
|
+
import { n as findConfigFile, t as getConfigs } from "./config-Bh00Hwpw.js";
|
|
6
|
+
import { t as logCommandSummary } from "./summary-DkSLti6f.js";
|
|
7
|
+
import { styleText } from "node:util";
|
|
8
|
+
import process from "node:process";
|
|
9
|
+
import { resolve } from "node:path";
|
|
10
|
+
//#region src/runners/validate/run.ts
|
|
11
|
+
/**
|
|
12
|
+
* Validates `input` with the configured adapters, falling back to OpenAPI when no config exists.
|
|
13
|
+
* Exits the process with code 1 on validation failure or missing dependency.
|
|
14
|
+
*/
|
|
15
|
+
async function run({ input, configPath }) {
|
|
16
|
+
const hrStart = process.hrtime();
|
|
17
|
+
const report = trackRun({
|
|
18
|
+
command: "validate",
|
|
19
|
+
hrStart
|
|
20
|
+
});
|
|
21
|
+
let adapterName;
|
|
22
|
+
try {
|
|
23
|
+
const configFile = configPath ?? findConfigFile();
|
|
24
|
+
const loaded = configFile ? await getConfigs({
|
|
25
|
+
configPath: configFile,
|
|
26
|
+
input
|
|
27
|
+
}).catch((error) => {
|
|
28
|
+
if (configPath) throw error;
|
|
29
|
+
}) : void 0;
|
|
30
|
+
const fallback = async () => {
|
|
31
|
+
adapterName = "@kubb/adapter-oas";
|
|
32
|
+
const { adapterOas } = await import("@kubb/adapter-oas");
|
|
33
|
+
return [{
|
|
34
|
+
adapter: adapterOas(),
|
|
35
|
+
input
|
|
36
|
+
}];
|
|
37
|
+
};
|
|
38
|
+
const unique = new Map((loaded?.configs ?? []).map((config) => {
|
|
39
|
+
const resolved = URL.canParse(input) ? input : resolve(config.root || process.cwd(), input);
|
|
40
|
+
return [`${config.adapter?.name}\0${resolved}`, {
|
|
41
|
+
adapter: config.adapter,
|
|
42
|
+
input: resolved
|
|
43
|
+
}];
|
|
44
|
+
}));
|
|
45
|
+
const targets = loaded ? [...unique.values()] : await fallback();
|
|
46
|
+
if (!targets.length) throw new Error("The Kubb config contains no configurations to validate.");
|
|
47
|
+
for (const target of targets) {
|
|
48
|
+
adapterName = target.adapter?.name;
|
|
49
|
+
if (!target.adapter) throw new Error("No adapter is configured. Set adapter in your Kubb config to validate this specification.");
|
|
50
|
+
await target.adapter.validate(target.input, { throwOnError: true });
|
|
51
|
+
}
|
|
52
|
+
const specifications = new Set(targets.map((target) => target.input)).size;
|
|
53
|
+
const adapterNames = [...new Set(targets.flatMap((target) => target.adapter?.name ?? []))];
|
|
54
|
+
await report({ status: "success" });
|
|
55
|
+
logCommandSummary({
|
|
56
|
+
title: "Validation passed",
|
|
57
|
+
status: "success",
|
|
58
|
+
hrStart,
|
|
59
|
+
lines: [
|
|
60
|
+
` ${styleText("bold", `${pluralize(specifications, "specification")} validated`)}`,
|
|
61
|
+
` ${styleText("dim", "Input")} ${styleText("cyan", input)}`,
|
|
62
|
+
` ${styleText("dim", adapterNames.length === 1 ? "Adapter" : "Adapters")} ${adapterNames.join(", ")}`
|
|
63
|
+
]
|
|
64
|
+
});
|
|
65
|
+
} catch (error) {
|
|
66
|
+
await report({ status: "failed" });
|
|
67
|
+
const message = toError(error).message;
|
|
68
|
+
const missingAdapter = adapterName === "@kubb/adapter-oas" && /(?:Cannot find|Cannot resolve|not found)[\s\S]*@kubb\/adapter-oas/.test(message);
|
|
69
|
+
logCommandSummary({
|
|
70
|
+
title: missingAdapter ? "Could not validate" : "Validation failed",
|
|
71
|
+
status: "failed",
|
|
72
|
+
hrStart,
|
|
73
|
+
lines: [
|
|
74
|
+
` ${styleText("dim", "Input")} ${styleText("cyan", input)}`,
|
|
75
|
+
` ${styleText("dim", "Adapter")} ${adapterName ?? "not configured"}${missingAdapter ? " · not installed" : ""}`,
|
|
76
|
+
"",
|
|
77
|
+
styleText("bold", missingAdapter ? "Required package" : "Validation error"),
|
|
78
|
+
` ${styleText("red", message)}`,
|
|
79
|
+
...missingAdapter ? [
|
|
80
|
+
"",
|
|
81
|
+
"Install it with:",
|
|
82
|
+
styleText("cyan", " npm install @kubb/adapter-oas"),
|
|
83
|
+
styleText("cyan", " pnpm add @kubb/adapter-oas")
|
|
84
|
+
] : []
|
|
85
|
+
]
|
|
86
|
+
});
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { run };
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=run-D_dD7xHp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-D_dD7xHp.js","names":[],"sources":["../src/runners/validate/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { resolve } from 'node:path'\nimport { styleText } from 'node:util'\nimport { findConfigFile } from '@internals/shared'\nimport { toError } from '@internals/utils'\nimport type { Config } from '@kubb/core'\nimport { trackRun } from '../../Telemetry.ts'\nimport { getConfigs } from '../../config.ts'\nimport { pluralize } from '../../ui/text.ts'\nimport { logCommandSummary } from '../../ui/summary.ts'\n\ntype ValidateOptions = {\n /**\n * Path or URL to the specification to validate.\n */\n input: string\n configPath?: string\n}\n\n/**\n * Validates `input` with the configured adapters, falling back to OpenAPI when no config exists.\n * Exits the process with code 1 on validation failure or missing dependency.\n */\nexport async function run({ input, configPath }: ValidateOptions): Promise<void> {\n const hrStart = process.hrtime()\n const report = trackRun({ command: 'validate', hrStart })\n let adapterName: string | undefined\n\n try {\n const configFile = configPath ?? findConfigFile()\n // A config found by search that does not load must not block validating a file; an explicit `--config` still fails.\n const loaded = configFile\n ? await getConfigs({ configPath: configFile, input }).catch((error) => {\n if (configPath) throw error\n })\n : undefined\n const fallback = async () => {\n adapterName = '@kubb/adapter-oas'\n const { adapterOas } = await import('@kubb/adapter-oas')\n return [{ adapter: adapterOas(), input }]\n }\n // An array config often repeats one adapter, so each adapter and input pair is validated once.\n const unique = new Map(\n (loaded?.configs ?? []).map((config) => {\n const resolved = URL.canParse(input) ? input : resolve(config.root || process.cwd(), input)\n return [`${config.adapter?.name}\\0${resolved}`, { adapter: config.adapter, input: resolved }] as const\n }),\n )\n const targets: Array<{ adapter: Config['adapter']; input: string }> = loaded ? [...unique.values()] : await fallback()\n if (!targets.length) throw new Error('The Kubb config contains no configurations to validate.')\n for (const target of targets) {\n adapterName = target.adapter?.name\n if (!target.adapter) throw new Error('No adapter is configured. Set adapter in your Kubb config to validate this specification.')\n await target.adapter.validate(target.input, { throwOnError: true })\n }\n const specifications = new Set(targets.map((target) => target.input)).size\n const adapterNames = [...new Set(targets.flatMap((target) => target.adapter?.name ?? []))]\n await report({ status: 'success' })\n\n logCommandSummary({\n title: 'Validation passed',\n status: 'success',\n hrStart,\n lines: [\n ` ${styleText('bold', `${pluralize(specifications, 'specification')} validated`)}`,\n ` ${styleText('dim', 'Input')} ${styleText('cyan', input)}`,\n ` ${styleText('dim', adapterNames.length === 1 ? 'Adapter' : 'Adapters')} ${adapterNames.join(', ')}`,\n ],\n })\n } catch (error) {\n await report({ status: 'failed' })\n const message = toError(error).message\n const missingAdapter = adapterName === '@kubb/adapter-oas' && /(?:Cannot find|Cannot resolve|not found)[\\s\\S]*@kubb\\/adapter-oas/.test(message)\n logCommandSummary({\n title: missingAdapter ? 'Could not validate' : 'Validation failed',\n status: 'failed',\n hrStart,\n lines: [\n ` ${styleText('dim', 'Input')} ${styleText('cyan', input)}`,\n ` ${styleText('dim', 'Adapter')} ${adapterName ?? 'not configured'}${missingAdapter ? ' · not installed' : ''}`,\n '',\n styleText('bold', missingAdapter ? 'Required package' : 'Validation error'),\n ` ${styleText('red', message)}`,\n ...(missingAdapter\n ? ['', 'Install it with:', styleText('cyan', ' npm install @kubb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} from "./errors-DmC83ALX.js";
|
|
3
|
+
import { n as trackRun } from "./Telemetry-CfJAUDnh.js";
|
|
3
4
|
import { styleText } from "node:util";
|
|
4
5
|
import process from "node:process";
|
|
5
6
|
//#region src/runners/mcp/run.ts
|
|
@@ -28,4 +29,4 @@ async function run() {
|
|
|
28
29
|
//#endregion
|
|
29
30
|
export { run };
|
|
30
31
|
|
|
31
|
-
//# sourceMappingURL=run-
|
|
32
|
+
//# sourceMappingURL=run-KuzAqsjg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-
|
|
1
|
+
{"version":3,"file":"run-KuzAqsjg.js","names":[],"sources":["../src/runners/mcp/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport { toError } from '@internals/utils'\nimport type * as McpModule from '@kubb/mcp'\nimport { trackRun } from '../../Telemetry.ts'\n\n/**\n * Starts the `@kubb/mcp` server over stdio and reports the outcome to telemetry.\n */\nexport async function run(): Promise<void> {\n const { run: startMcpServer } = (await import('@kubb/mcp')) as typeof McpModule\n\n const report = trackRun({ command: 'mcp', hrStart: process.hrtime() })\n\n try {\n // The MCP stdio transport owns stdout: anything else written there corrupts the JSON-RPC stream.\n console.error(styleText('cyan', '⏳ Starting MCP server...'))\n console.warn(styleText('yellow', 'This feature is still under development, use with caution'))\n const server = startMcpServer()\n // Report once the client introduces itself, so the event names the client (e.g. `claude-code`, `cursor-vscode`).\n server.on('initialize', ({ clientInfo }) => void report({ status: 'success', mcpClient: clientInfo.name }), { once: true })\n } catch (error) {\n await report({ status: 'failed' })\n console.error(toError(error).message)\n process.exitCode = 1\n }\n}\n"],"mappings":";;;;;;;;;AASA,eAAsB,MAAqB;CACzC,MAAM,EAAE,KAAK,mBAAoB,MAAM,OAAO;CAE9C,MAAM,SAAS,SAAS;EAAE,SAAS;EAAO,SAAS,QAAQ,OAAO;CAAE,CAAC;CAErE,IAAI;EAEF,QAAQ,MAAM,UAAU,QAAQ,0BAA0B,CAAC;EAC3D,QAAQ,KAAK,UAAU,UAAU,2DAA2D,CAAC;EAG7F,eAAK,CAAC,CAAC,GAAG,eAAe,EAAE,iBAAiB,KAAK,OAAO;GAAE,QAAQ;GAAW,WAAW,WAAW;EAAK,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC;CAC5H,SAAS,OAAO;EACd,MAAM,OAAO,EAAE,QAAQ,SAAS,CAAC;EACjC,QAAQ,MAAM,QAAQ,KAAK,CAAC,CAAC,OAAO;EACpC,QAAQ,WAAW;CACrB;AACF"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-CPE0t6oh.cjs");
|
|
2
|
+
const require_Telemetry = require("./Telemetry-Be3hIy6_.cjs");
|
|
3
|
+
const require_utils = require("./utils-DpKrXR2t.cjs");
|
|
4
|
+
const require_text = require("./text-CknhKMvM.cjs");
|
|
5
|
+
const require_registry = require("./registry-BlKLO4ft.cjs");
|
|
6
|
+
const require_config = require("./config-D63Gum4F.cjs");
|
|
7
|
+
const require_reporters = require("./reporters-TkCgd4dS.cjs");
|
|
8
|
+
let node_util = require("node:util");
|
|
9
|
+
let node_process = require("node:process");
|
|
10
|
+
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
11
|
+
let node_path = require("node:path");
|
|
12
|
+
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
13
|
+
let _kubb_core = require("@kubb/core");
|
|
14
|
+
//#region src/runners/generate/run.ts
|
|
15
|
+
/** NPM registry endpoint used to check for @kubb/cli updates. */
|
|
16
|
+
const KUBB_NPM_PACKAGE_URL = "https://registry.npmjs.org/@kubb/cli/latest";
|
|
17
|
+
/** Upper bound in milliseconds for the npm update check, so a slow registry never stalls a run. */
|
|
18
|
+
const UPDATE_CHECK_TIMEOUT_MS = 3e3;
|
|
19
|
+
async function generate(options) {
|
|
20
|
+
const { input, hooks, dryRun = false } = options;
|
|
21
|
+
const report = require_Telemetry.trackRun({
|
|
22
|
+
command: "generate",
|
|
23
|
+
hrStart: node_process.default.hrtime()
|
|
24
|
+
});
|
|
25
|
+
const config = {
|
|
26
|
+
...options.config,
|
|
27
|
+
input: input ?? options.config.input,
|
|
28
|
+
storage: dryRun ? (0, _kubb_core.memoryStorage)() : options.config.storage,
|
|
29
|
+
output: dryRun ? {
|
|
30
|
+
...options.config.output,
|
|
31
|
+
format: false,
|
|
32
|
+
lint: false,
|
|
33
|
+
postGenerate: []
|
|
34
|
+
} : options.config.output
|
|
35
|
+
};
|
|
36
|
+
const kubb = (0, _kubb_core.createKubb)(config, { hooks });
|
|
37
|
+
const result = await kubb.generate();
|
|
38
|
+
await report({
|
|
39
|
+
plugins: kubb.config.plugins.flatMap((p) => p && typeof p === "object" ? [{
|
|
40
|
+
name: p.meta?.name ?? p.name ?? "",
|
|
41
|
+
options: p.options ?? {}
|
|
42
|
+
}] : []),
|
|
43
|
+
filesCreated: result.files.length,
|
|
44
|
+
status: result.success ? "success" : "failed"
|
|
45
|
+
});
|
|
46
|
+
return result.success;
|
|
47
|
+
}
|
|
48
|
+
/** The latest published version, `undefined` when the registry does not answer in time. Never rejects. */
|
|
49
|
+
async function fetchLatestVersion() {
|
|
50
|
+
try {
|
|
51
|
+
return (await (await fetch(KUBB_NPM_PACKAGE_URL, { signal: AbortSignal.timeout(UPDATE_CHECK_TIMEOUT_MS) })).json()).version;
|
|
52
|
+
} catch {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async function checkForUpdate({ hooks, latest }) {
|
|
57
|
+
const latestVersion = await latest;
|
|
58
|
+
if (latestVersion && require_registry.isOutdated({
|
|
59
|
+
installed: require_Telemetry.version,
|
|
60
|
+
latest: latestVersion
|
|
61
|
+
})) await _kubb_core.Diagnostics.emit(hooks, _kubb_core.Diagnostics.update({
|
|
62
|
+
currentVersion: require_Telemetry.version,
|
|
63
|
+
latestVersion
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
/** Prints `Rebuilt in 1.2s · +1 schema -2 operations`, without the names part when the spec kept the same names. */
|
|
67
|
+
function logRebuild({ diff: { schemas, operations }, durationMs }) {
|
|
68
|
+
const specChange = [
|
|
69
|
+
schemas.added && (0, node_util.styleText)("green", `+${require_text.pluralize(schemas.added, "schema")}`),
|
|
70
|
+
schemas.removed && (0, node_util.styleText)("red", `-${require_text.pluralize(schemas.removed, "schema")}`),
|
|
71
|
+
operations.added && (0, node_util.styleText)("green", `+${require_text.pluralize(operations.added, "operation")}`),
|
|
72
|
+
operations.removed && (0, node_util.styleText)("red", `-${require_text.pluralize(operations.removed, "operation")}`)
|
|
73
|
+
].filter(Boolean).join(" ");
|
|
74
|
+
require_text.logStep([`Rebuilt in ${require_Telemetry.formatMs(durationMs)}`, specChange].filter(Boolean).join((0, node_util.styleText)("dim", " · ")));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Runs the full Kubb generation lifecycle for the given CLI options.
|
|
78
|
+
* Loads configs, sets up the reporters (CLI `--reporter` picks which of `config.reporters` to trigger),
|
|
79
|
+
* checks for a newer version, and calls `generate` for each config entry.
|
|
80
|
+
*/
|
|
81
|
+
async function run({ input, configPath, logLevel: logLevelKey, watch, reporters: cliReporters, dryRun }) {
|
|
82
|
+
const latest = fetchLatestVersion();
|
|
83
|
+
const logLevel = _kubb_core.logLevel[logLevelKey] ?? _kubb_core.logLevel.info;
|
|
84
|
+
const hooks = new _kubb_core.Hookable();
|
|
85
|
+
const requestedNames = cliReporters?.length ? cliReporters : ["cli"];
|
|
86
|
+
const json = requestedNames.includes("json");
|
|
87
|
+
const quiet = logLevel <= _kubb_core.logLevel.silent || json;
|
|
88
|
+
const errorHooks = json ? new _kubb_core.Hookable() : hooks;
|
|
89
|
+
if (json) require_reporters.setupReporters(errorHooks, {
|
|
90
|
+
logLevel,
|
|
91
|
+
reporters: [_kubb_core.cliReporter],
|
|
92
|
+
writer: require_text.createPlainWriter(console.error)
|
|
93
|
+
});
|
|
94
|
+
const banner = quiet ? void 0 : require_registry.logBanner(require_Telemetry.version);
|
|
95
|
+
const loading = require_config.getConfigs({
|
|
96
|
+
configPath,
|
|
97
|
+
input,
|
|
98
|
+
watch,
|
|
99
|
+
logLevel: logLevelKey
|
|
100
|
+
});
|
|
101
|
+
loading.catch(() => void 0);
|
|
102
|
+
await banner;
|
|
103
|
+
if (!quiet) require_text.logIntro({ title: "Configuration" });
|
|
104
|
+
const configSpinner = require_utils.createSpinner();
|
|
105
|
+
let configs;
|
|
106
|
+
let resolvedConfigPath;
|
|
107
|
+
try {
|
|
108
|
+
if (!quiet) configSpinner.start("Loading config");
|
|
109
|
+
const loaded = await loading;
|
|
110
|
+
configs = loaded.configs;
|
|
111
|
+
resolvedConfigPath = loaded.configPath;
|
|
112
|
+
if (!quiet) configSpinner.stop(`Loaded ${(0, node_util.styleText)("dim", node_path.default.relative(node_process.default.cwd(), resolvedConfigPath))}`);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
if (!quiet) configSpinner.error("Config failed loading");
|
|
115
|
+
if (!json) require_reporters.setupReporters(hooks, {
|
|
116
|
+
logLevel,
|
|
117
|
+
reporters: [_kubb_core.cliReporter]
|
|
118
|
+
});
|
|
119
|
+
await _kubb_core.Diagnostics.emit(errorHooks, error);
|
|
120
|
+
if (!quiet) require_text.logOutro((0, node_util.styleText)("red", "✗ Configuration failed"));
|
|
121
|
+
node_process.default.exit(1);
|
|
122
|
+
}
|
|
123
|
+
const available = configs[0]?.reporters?.length ? configs[0].reporters : [
|
|
124
|
+
_kubb_core.cliReporter,
|
|
125
|
+
_kubb_core.jsonReporter,
|
|
126
|
+
_kubb_core.fileReporter,
|
|
127
|
+
_kubb_core.htmlReporter
|
|
128
|
+
];
|
|
129
|
+
const reporters = require_reporters.selectReporters(available, requestedNames);
|
|
130
|
+
require_reporters.setupReporters(hooks, {
|
|
131
|
+
logLevel,
|
|
132
|
+
reporters,
|
|
133
|
+
dryRun
|
|
134
|
+
});
|
|
135
|
+
await hooks.callHook("kubb:lifecycle:start", { version: require_Telemetry.version });
|
|
136
|
+
await checkForUpdate({
|
|
137
|
+
hooks,
|
|
138
|
+
latest
|
|
139
|
+
});
|
|
140
|
+
if (!quiet) require_text.logOutro(`${require_text.pluralize(configs.length, "config")} ready`);
|
|
141
|
+
try {
|
|
142
|
+
let anyFailed = false;
|
|
143
|
+
const tracker = watch ? require_utils.trackBuild(hooks) : void 0;
|
|
144
|
+
const rebuilds = [];
|
|
145
|
+
let armKeys;
|
|
146
|
+
let queue = Promise.resolve();
|
|
147
|
+
for (const config of configs) {
|
|
148
|
+
const effectiveInput = input ?? config.input;
|
|
149
|
+
const inputKind = typeof effectiveInput === "string" ? (0, _kubb_core.getInputKind)(effectiveInput) : void 0;
|
|
150
|
+
const watchPath = inputKind === "file" || inputKind === "url" ? effectiveInput : void 0;
|
|
151
|
+
if (watchPath && tracker) {
|
|
152
|
+
const label = (0, node_util.styleText)("yellow", `Watching ${inputKind === "url" ? watchPath : node_path.default.relative(node_process.default.cwd(), watchPath)}`);
|
|
153
|
+
let previous;
|
|
154
|
+
const build = async () => {
|
|
155
|
+
const hrStart = node_process.default.hrtime();
|
|
156
|
+
const succeeded = await generate({
|
|
157
|
+
input,
|
|
158
|
+
config,
|
|
159
|
+
hooks,
|
|
160
|
+
dryRun
|
|
161
|
+
});
|
|
162
|
+
const snapshot = tracker.take();
|
|
163
|
+
if (previous) logRebuild({
|
|
164
|
+
diff: require_utils.diffBuilds(previous, snapshot),
|
|
165
|
+
durationMs: require_Telemetry.getElapsedMs(hrStart)
|
|
166
|
+
});
|
|
167
|
+
previous = snapshot;
|
|
168
|
+
require_text.logStep(armKeys ? `${label} ${(0, node_util.styleText)("dim", "r rebuild · q quit")}` : label);
|
|
169
|
+
armKeys?.();
|
|
170
|
+
if (succeeded) {
|
|
171
|
+
require_text.logSpacer();
|
|
172
|
+
require_text.logTip();
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
let pending = false;
|
|
176
|
+
const rebuild = () => {
|
|
177
|
+
if (pending) return queue;
|
|
178
|
+
pending = true;
|
|
179
|
+
queue = queue.then(() => {
|
|
180
|
+
pending = false;
|
|
181
|
+
return build();
|
|
182
|
+
}).catch((error) => void _kubb_core.Diagnostics.emit(errorHooks, error));
|
|
183
|
+
return queue;
|
|
184
|
+
};
|
|
185
|
+
rebuilds.push(rebuild);
|
|
186
|
+
if (!quiet) armKeys ??= require_utils.listenForKeys({
|
|
187
|
+
rebuild: () => rebuilds.forEach((trigger) => void trigger()),
|
|
188
|
+
quit: (code) => void Promise.resolve(hooks.callHook("kubb:lifecycle:end")).finally(() => node_process.default.exit(code))
|
|
189
|
+
});
|
|
190
|
+
const initialBody = inputKind === "url" ? await require_utils.fetchUrlBody(watchPath) : void 0;
|
|
191
|
+
await rebuild();
|
|
192
|
+
if (inputKind === "url") require_utils.startUrlWatcher(watchPath, rebuild, {
|
|
193
|
+
log: {
|
|
194
|
+
info: require_text.logInfo,
|
|
195
|
+
error: require_text.logError
|
|
196
|
+
},
|
|
197
|
+
initialBody
|
|
198
|
+
});
|
|
199
|
+
else await require_utils.startWatcher([watchPath], rebuild, {
|
|
200
|
+
info: require_text.logInfo,
|
|
201
|
+
error: require_text.logError
|
|
202
|
+
});
|
|
203
|
+
} else try {
|
|
204
|
+
if (!await generate({
|
|
205
|
+
input,
|
|
206
|
+
config,
|
|
207
|
+
hooks,
|
|
208
|
+
dryRun
|
|
209
|
+
})) anyFailed = true;
|
|
210
|
+
} catch (configError) {
|
|
211
|
+
await _kubb_core.Diagnostics.emit(errorHooks, configError);
|
|
212
|
+
anyFailed = true;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
await hooks.callHook("kubb:lifecycle:end");
|
|
216
|
+
if (!quiet && !watch && !anyFailed) require_text.logTip();
|
|
217
|
+
if (anyFailed) node_process.default.exit(1);
|
|
218
|
+
} catch (error) {
|
|
219
|
+
await _kubb_core.Diagnostics.emit(errorHooks, error);
|
|
220
|
+
node_process.default.exit(1);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
//#endregion
|
|
224
|
+
exports.generate = generate;
|
|
225
|
+
exports.run = run;
|
|
226
|
+
|
|
227
|
+
//# sourceMappingURL=run-TrjCNL8e.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-TrjCNL8e.cjs","names":["trackRun","process","memoryStorage","createKubb","isOutdated","version","Diagnostics","styleText","pluralize","formatMs","logLevelMap","Hookable","cliReporter","createPlainWriter","logBanner","getConfigs","createSpinner","path","jsonReporter","fileReporter","htmlReporter","selectReporters","trackBuild","getInputKind","diffBuilds","getElapsedMs","listenForKeys","fetchUrlBody","logInfo","logError","startWatcher"],"sources":["../src/runners/generate/run.ts"],"sourcesContent":["import path from 'node:path'\nimport process from 'node:process'\nimport { styleText } from 'node:util'\nimport { formatMs, formatters, getElapsedMs, linters } from '@internals/utils'\nimport {\n Hookable,\n type CLIOptions,\n cliReporter,\n type Config,\n createKubb,\n Diagnostics,\n fileReporter,\n getInputKind,\n htmlReporter,\n jsonReporter,\n type KubbHooks,\n logLevel as logLevelMap,\n memoryStorage,\n type ReporterName,\n} from '@kubb/core'\nimport { version } from '../../../package.json'\nimport { trackRun } from '../../Telemetry.ts'\nimport { pluralize } from '../../ui/text.ts'\nimport setupReporters, { selectReporters } from '../../loggers/reporters.ts'\nimport { createPlainWriter } from '../../loggers/plainWriter.ts'\nimport { logIntro, logOutro, logSpacer, logTip } from '../../ui/intro.ts'\nimport { logError, logInfo, logStep } from '../../ui/log.ts'\nimport { logBanner } from '../../ui/mascot.ts'\nimport { createSpinner } from '../../ui/spinner.ts'\nimport { getConfigs } from '../../config.ts'\nimport { isOutdated } from '../../utils/registry.ts'\nimport { type BuildDiff, type BuildSnapshot, diffBuilds, fetchUrlBody, listenForKeys, startUrlWatcher, startWatcher, trackBuild } from './utils.ts'\n\n/** NPM registry endpoint used to check for @kubb/cli updates. */\nconst KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/** Upper bound in milliseconds for the npm update check, so a slow registry never stalls a run. */\nconst UPDATE_CHECK_TIMEOUT_MS = 3_000\n\n/** The formatter names from `Config['output'].format`, without `'auto'` (detection, not a tool) and `false` (skip). */\ntype FormatterName = Exclude<NonNullable<Config['output']['format']>, 'auto' | false>\ntype LinterName = Exclude<NonNullable<Config['output']['lint']>, 'auto' | false>\n\n// Pinned here, not in `@internals/utils` (which must not import `@kubb/core`): a tool added to the union without a descriptor fails to compile.\nformatters satisfies Record<FormatterName, unknown>\nlinters satisfies Record<LinterName, unknown>\n\ntype GenerateProps = {\n input?: string\n config: Config\n hooks: Hookable<KubbHooks>\n /**\n * When `true`, generates in memory instead of writing to disk, skips formatting, linting, and\n * post-generate commands, and prints what would change on disk.\n */\n dryRun?: boolean\n}\n\nexport async function generate(options: GenerateProps): Promise<boolean> {\n const { input, hooks, dryRun = false } = options\n\n const report = trackRun({ command: 'generate', hrStart: process.hrtime() })\n\n const config: Config = {\n ...options.config,\n input: input ?? options.config.input,\n // Dry-run never touches disk, regardless of the config's own storage driver.\n storage: dryRun ? memoryStorage() : options.config.storage,\n // Also keeps core's `hasOutputPasses` false, so dry-run skips the output manifest write too.\n output: dryRun ? { ...options.config.output, format: false, lint: false, postGenerate: [] } : options.config.output,\n }\n\n // Core formats, lints and runs `output.postGenerate` after an error-free build, and reports\n // their failures as coded diagnostics that reach the summary, the json report and the exit code.\n const kubb = createKubb(config, { hooks })\n const result = await kubb.generate()\n\n await report({\n // A setup that threw leaves no driver, so read the configured plugins instead.\n plugins: kubb.config.plugins.flatMap((p) =>\n p && typeof p === 'object' ? [{ name: p.meta?.name ?? p.name ?? '', options: (p.options ?? {}) as Record<string, unknown> }] : [],\n ),\n filesCreated: result.files.length,\n status: result.success ? 'success' : 'failed',\n })\n\n return result.success\n}\n\ntype GenerateCommandOptions = {\n input?: string\n configPath?: string\n logLevel: string\n watch: boolean\n reporters?: Array<ReporterName>\n dryRun?: boolean\n}\n\n/** The latest published version, `undefined` when the registry does not answer in time. Never rejects. */\nasync function fetchLatestVersion(): Promise<string | undefined> {\n try {\n const res = await fetch(KUBB_NPM_PACKAGE_URL, { signal: AbortSignal.timeout(UPDATE_CHECK_TIMEOUT_MS) })\n const data = (await res.json()) as { version: string }\n return data.version\n } catch {\n // Ignore network errors\n return undefined\n }\n}\n\nasync function checkForUpdate({ hooks, latest }: { hooks: Hookable<KubbHooks>; latest: Promise<string | undefined> }): Promise<void> {\n const latestVersion = await latest\n if (latestVersion && isOutdated({ installed: version, latest: latestVersion })) {\n await Diagnostics.emit(hooks, Diagnostics.update({ currentVersion: version, latestVersion }))\n }\n}\n\n/** Prints `Rebuilt in 1.2s · +1 schema -2 operations`, without the names part when the spec kept the same names. */\nfunction logRebuild({ diff: { schemas, operations }, durationMs }: { diff: BuildDiff; durationMs: number }): void {\n const specChange = [\n schemas.added && styleText('green', `+${pluralize(schemas.added, 'schema')}`),\n schemas.removed && styleText('red', `-${pluralize(schemas.removed, 'schema')}`),\n operations.added && styleText('green', `+${pluralize(operations.added, 'operation')}`),\n operations.removed && styleText('red', `-${pluralize(operations.removed, 'operation')}`),\n ]\n .filter(Boolean)\n .join(' ')\n logStep([`Rebuilt in ${formatMs(durationMs)}`, specChange].filter(Boolean).join(styleText('dim', ' · ')))\n}\n\n/**\n * Runs the full Kubb generation lifecycle for the given CLI options.\n * Loads configs, sets up the reporters (CLI `--reporter` picks which of `config.reporters` to trigger),\n * checks for a newer version, and calls `generate` for each config entry.\n */\nexport async function run({ input, configPath, logLevel: logLevelKey, watch, reporters: cliReporters, dryRun }: GenerateCommandOptions): Promise<void> {\n // Started first so the registry request overlaps the banner and the config load.\n const latest = fetchLatestVersion()\n const logLevel = logLevelMap[logLevelKey as keyof typeof logLevelMap] ?? logLevelMap.info\n const hooks = new Hookable<KubbHooks>()\n\n // CLI `--reporter` selects which reporters to trigger by name, defaulting to `cli`. `defineConfig`\n // registers the built-in reporters on the config; a config exported without it falls back to them below.\n const requestedNames: Array<ReporterName> = cliReporters?.length ? cliReporters : ['cli']\n\n // The `json` reporter owns stdout, so the command writes nothing of its own around it.\n const json = requestedNames.includes('json')\n const quiet = logLevel <= logLevelMap.silent || json\n\n // Errors raised outside a build have no report entry. In `json` mode they go to a stderr logger,\n // so they are never silent and stdout stays one JSON document.\n const errorHooks = json ? new Hookable<KubbHooks>() : hooks\n if (json) setupReporters(errorHooks, { logLevel, reporters: [cliReporter], writer: createPlainWriter(console.error) })\n\n // The config loads while the banner plays; the output still prints in order once the banner is done.\n const banner = quiet ? undefined : logBanner(version)\n const loading = getConfigs({\n configPath,\n input,\n watch,\n logLevel: logLevelKey as CLIOptions['logLevel'],\n })\n // Handled below; this keeps a rejection during the banner from counting as unhandled.\n loading.catch(() => undefined)\n await banner\n\n if (!quiet) {\n logIntro({ title: 'Configuration' })\n }\n\n // Load the config first so `config.reporters` can pick the reporters. A failure here has no\n // reporter installed yet, so fall back to the default `cli` reporter to surface it.\n const configSpinner = createSpinner()\n let configs: Array<Config>\n let resolvedConfigPath: string\n try {\n if (!quiet) configSpinner.start('Loading config')\n\n const loaded = await loading\n configs = loaded.configs\n resolvedConfigPath = loaded.configPath\n\n if (!quiet) configSpinner.stop(`Loaded ${styleText('dim', path.relative(process.cwd(), resolvedConfigPath))}`)\n } catch (error) {\n if (!quiet) configSpinner.error('Config failed loading')\n\n if (!json) setupReporters(hooks, { logLevel, reporters: [cliReporter] })\n // A diagnostic thrown while the config file runs, such as invalid extension options, sits in the cause chain.\n await Diagnostics.emit(errorHooks, error)\n\n if (!quiet) logOutro(styleText('red', '✗ Configuration failed'))\n process.exit(1)\n }\n\n // Without a reporter nothing is printed, not even an error, so a config written without\n // `defineConfig` gets the same built-ins it would have registered.\n const available = configs[0]?.reporters?.length ? configs[0].reporters : [cliReporter, jsonReporter, fileReporter, htmlReporter]\n const reporters = selectReporters(available, requestedNames)\n setupReporters(hooks, { logLevel, reporters, dryRun })\n\n await hooks.callHook('kubb:lifecycle:start', { version })\n\n // Inside the bootstrap group, so an update notice reads as part of the setup rather than as part\n // of the first config's generation.\n await checkForUpdate({ hooks, latest })\n\n if (!quiet) logOutro(`${pluralize(configs.length, 'config')} ready`)\n\n try {\n let anyFailed = false\n // One tracker, one key listener and one build queue serve every watched config, so several configs never mix diffs or answer `r` twice.\n const tracker = watch ? trackBuild(hooks) : undefined\n const rebuilds: Array<() => Promise<void>> = []\n let armKeys: (() => void) | undefined\n // Configs share the hooks emitter, so every build, from any watcher or the `r` key, waits for the one before it.\n let queue = Promise.resolve()\n for (const config of configs) {\n const effectiveInput = input ?? config.input\n const inputKind = typeof effectiveInput === 'string' ? getInputKind(effectiveInput) : undefined\n const watchPath = inputKind === 'file' || inputKind === 'url' ? (effectiveInput as string) : undefined\n if (watchPath && tracker) {\n const label = styleText('yellow', `Watching ${inputKind === 'url' ? watchPath : path.relative(process.cwd(), watchPath)}`)\n let previous: BuildSnapshot | undefined\n // Don't removeAll() between builds, that would also drop logger and lifecycle\n // listeners. Plugin listeners are already disposed by safeBuild's dispose()\n // in its finally block, so re-running generate() on the same hooks emitter is safe.\n const build = async () => {\n const hrStart = process.hrtime()\n const succeeded = await generate({ input, config, hooks, dryRun })\n const snapshot = tracker.take()\n if (previous) logRebuild({ diff: diffBuilds(previous, snapshot), durationMs: getElapsedMs(hrStart) })\n previous = snapshot\n\n logStep(armKeys ? `${label} ${styleText('dim', 'r rebuild · q quit')}` : label)\n armKeys?.()\n if (succeeded) {\n logSpacer()\n logTip()\n }\n }\n // A trigger that lands while this config's build is queued joins it; one that lands during the build queues one more. Never rejects.\n let pending = false\n const rebuild = (): Promise<void> => {\n if (pending) return queue\n pending = true\n queue = queue\n .then(() => {\n pending = false\n return build()\n })\n .catch((error) => void Diagnostics.emit(errorHooks, error))\n return queue\n }\n rebuilds.push(rebuild)\n if (!quiet) {\n armKeys ??= listenForKeys({\n rebuild: () => rebuilds.forEach((trigger) => void trigger()),\n quit: (code) => void Promise.resolve(hooks.callHook('kubb:lifecycle:end')).finally(() => process.exit(code)),\n })\n }\n\n // For a URL input, capture the document before the build: it becomes the watcher's\n // change-detection baseline, so an edit landing before the first poll still rebuilds.\n // When the server is down the baseline stays undefined and the watcher rebuilds on its\n // first successful poll, so recovery with an unchanged document still generates output.\n const initialBody = inputKind === 'url' ? await fetchUrlBody(watchPath) : undefined\n\n // The watchers ignore their startup state, so run the first build here; a failing one keeps watching so the user can fix the input.\n await rebuild()\n\n if (inputKind === 'url') {\n startUrlWatcher(watchPath, rebuild, { log: { info: logInfo, error: logError }, initialBody })\n } else {\n await startWatcher([watchPath], rebuild, { info: logInfo, error: logError })\n }\n } else {\n try {\n const succeeded = await generate({ input, config, hooks, dryRun })\n if (!succeeded) anyFailed = true\n } catch (configError) {\n await Diagnostics.emit(errorHooks, configError)\n anyFailed = true\n }\n }\n }\n\n await hooks.callHook('kubb:lifecycle:end')\n\n // Watch mode prints a tip after each successful build. Regular generate commands need to\n // print one explicitly after the lifecycle group has closed so it stays outside the group.\n if (!quiet && !watch && !anyFailed) {\n logTip()\n }\n\n if (anyFailed) {\n process.exit(1)\n }\n } catch (error) {\n await Diagnostics.emit(errorHooks, error)\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkCA,MAAM,uBAAuB;;AAG7B,MAAM,0BAA0B;AAqBhC,eAAsB,SAAS,SAA0C;CACvE,MAAM,EAAE,OAAO,OAAO,SAAS,UAAU;CAEzC,MAAM,SAASA,kBAAAA,SAAS;EAAE,SAAS;EAAY,SAASC,aAAAA,QAAQ,OAAO;CAAE,CAAC;CAE1E,MAAM,SAAiB;EACrB,GAAG,QAAQ;EACX,OAAO,SAAS,QAAQ,OAAO;EAE/B,SAAS,UAAA,GAASC,WAAAA,cAAAA,CAAc,IAAI,QAAQ,OAAO;EAEnD,QAAQ,SAAS;GAAE,GAAG,QAAQ,OAAO;GAAQ,QAAQ;GAAO,MAAM;GAAO,cAAc,CAAC;EAAE,IAAI,QAAQ,OAAO;CAC/G;CAIA,MAAM,QAAA,GAAOC,WAAAA,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