@kubb/cli 5.0.0-alpha.9 → 5.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +180 -27
- package/bin/kubb.js +6 -0
- package/dist/agent-Bx2yllmS.js +68 -0
- package/dist/agent-Bx2yllmS.js.map +1 -0
- package/dist/agent-CeLwj5im.cjs +70 -0
- package/dist/agent-CeLwj5im.cjs.map +1 -0
- package/dist/{chunk--u3MIqq1.js → chunk-BvFE5Tac.js} +1 -0
- package/dist/constants-B2JTeRBb.js +42 -0
- package/dist/constants-B2JTeRBb.js.map +1 -0
- package/dist/constants-BINTA5VZ.cjs +77 -0
- package/dist/constants-BINTA5VZ.cjs.map +1 -0
- package/dist/constants-BYGmiFs0.cjs +139 -0
- package/dist/constants-BYGmiFs0.cjs.map +1 -0
- package/dist/constants-DSJ-Xrbv.js +116 -0
- package/dist/constants-DSJ-Xrbv.js.map +1 -0
- package/dist/define-Bdn8j5VM.cjs +54 -0
- package/dist/define-Bdn8j5VM.cjs.map +1 -0
- package/dist/define-m_fp-Aqm.js +43 -0
- package/dist/define-m_fp-Aqm.js.map +1 -0
- package/dist/errors-CINO1EIv.js +43 -0
- package/dist/errors-CINO1EIv.js.map +1 -0
- package/dist/{errors-DBW0N9w4.cjs → errors-CLCjoSg0.cjs} +22 -6
- package/dist/errors-CLCjoSg0.cjs.map +1 -0
- package/dist/{generate-Rly1EXBN.js → generate-BLvcvoIj.js} +12 -6
- package/dist/generate-BLvcvoIj.js.map +1 -0
- package/dist/{generate-DU5zzc54.cjs → generate-drLxTAnz.cjs} +11 -5
- package/dist/generate-drLxTAnz.cjs.map +1 -0
- package/dist/index.cjs +52 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +53 -22
- package/dist/index.js.map +1 -1
- package/dist/init-CGu7JZEF.js +53 -0
- package/dist/init-CGu7JZEF.js.map +1 -0
- package/dist/init-CyCjvIEF.cjs +53 -0
- package/dist/init-CyCjvIEF.cjs.map +1 -0
- package/dist/mcp-Cq2sylQC.js +39 -0
- package/dist/mcp-Cq2sylQC.js.map +1 -0
- package/dist/mcp-DSF5gpI-.cjs +39 -0
- package/dist/mcp-DSF5gpI-.cjs.map +1 -0
- package/dist/{package-BJ6ionm6.cjs → package-DZ-6zAIO.cjs} +2 -2
- package/dist/package-DZ-6zAIO.cjs.map +1 -0
- package/dist/package-OLYIpjqw.js +6 -0
- package/dist/package-OLYIpjqw.js.map +1 -0
- package/dist/{generate-BHNyeQXl.js → run-Bfbr3RaM.js} +781 -502
- package/dist/run-Bfbr3RaM.js.map +1 -0
- package/dist/run-BzpYYOQs.js +121 -0
- package/dist/run-BzpYYOQs.js.map +1 -0
- package/dist/run-CCZ24VKk.js +51 -0
- package/dist/run-CCZ24VKk.js.map +1 -0
- package/dist/run-CF97BWVa.js +244 -0
- package/dist/run-CF97BWVa.js.map +1 -0
- package/dist/run-CQbj3ley.cjs +52 -0
- package/dist/run-CQbj3ley.cjs.map +1 -0
- package/dist/{generate-Cq5RDTBL.cjs → run-CVlrIZoW.cjs} +786 -507
- package/dist/run-CVlrIZoW.cjs.map +1 -0
- package/dist/run-D0hmRpHy.js +49 -0
- package/dist/run-D0hmRpHy.js.map +1 -0
- package/dist/run-DwdAwnLG.cjs +125 -0
- package/dist/run-DwdAwnLG.cjs.map +1 -0
- package/dist/run-Lr0Ctnu0.cjs +50 -0
- package/dist/run-Lr0Ctnu0.cjs.map +1 -0
- package/dist/run-YsoCk5we.cjs +248 -0
- package/dist/run-YsoCk5we.cjs.map +1 -0
- package/dist/{shell-7HPrTCJ5.cjs → shell-475fQKaX.cjs} +8 -3
- package/dist/shell-475fQKaX.cjs.map +1 -0
- package/dist/{shell-DqqWsHCD.js → shell-CN6DNqeC.js} +9 -4
- package/dist/shell-CN6DNqeC.js.map +1 -0
- package/dist/{telemetry-DZ7IrLAU.cjs → telemetry-B2iWkY5e.cjs} +53 -13
- package/dist/telemetry-B2iWkY5e.cjs.map +1 -0
- package/dist/{telemetry-BF3SMlH6.js → telemetry-BkektVz6.js} +52 -12
- package/dist/telemetry-BkektVz6.js.map +1 -0
- package/dist/validate-CAUqLaGt.js +26 -0
- package/dist/validate-CAUqLaGt.js.map +1 -0
- package/dist/validate-J6AEd5zK.cjs +26 -0
- package/dist/validate-J6AEd5zK.cjs.map +1 -0
- package/package.json +57 -48
- package/src/commands/agent/start.ts +27 -8
- package/src/commands/agent.ts +3 -1
- package/src/commands/generate.ts +39 -8
- package/src/commands/init.ts +40 -4
- package/src/commands/mcp.ts +28 -4
- package/src/commands/validate.ts +11 -4
- package/src/constants.ts +5 -80
- package/src/index.ts +12 -13
- package/src/loggers/clackLogger.ts +98 -88
- package/src/loggers/fileSystemLogger.ts +37 -25
- package/src/loggers/githubActionsLogger.ts +35 -48
- package/src/loggers/plainLogger.ts +33 -45
- package/src/loggers/types.ts +6 -0
- package/src/loggers/utils.ts +155 -9
- package/src/runners/agent/run.ts +113 -0
- package/src/runners/agent/utils.ts +98 -0
- package/src/runners/generate/run.ts +276 -0
- package/src/runners/generate/utils.ts +209 -0
- package/src/runners/init/run.ts +211 -0
- package/src/{utils/packageManager.ts → runners/init/utils.ts} +10 -0
- package/src/runners/mcp/run.ts +55 -0
- package/src/runners/validate/run.ts +63 -0
- package/src/{utils/telemetry.ts → telemetry.ts} +28 -8
- package/bin/kubb.cjs +0 -18
- package/dist/agent-5mmp7QzF.js +0 -56
- package/dist/agent-5mmp7QzF.js.map +0 -1
- package/dist/agent-BKphjOIF.cjs +0 -58
- package/dist/agent-BKphjOIF.cjs.map +0 -1
- package/dist/agent-BapvKB4r.cjs +0 -92
- package/dist/agent-BapvKB4r.cjs.map +0 -1
- package/dist/agent-CBrpIMMU.js +0 -88
- package/dist/agent-CBrpIMMU.js.map +0 -1
- package/dist/constants-D0XHAHeZ.cjs +0 -178
- package/dist/constants-D0XHAHeZ.cjs.map +0 -1
- package/dist/constants-DJM9zCXm.js +0 -131
- package/dist/constants-DJM9zCXm.js.map +0 -1
- package/dist/define--M_JMcDC.js +0 -25
- package/dist/define--M_JMcDC.js.map +0 -1
- package/dist/define-D6Kfm7-Z.cjs +0 -36
- package/dist/define-D6Kfm7-Z.cjs.map +0 -1
- package/dist/errors-6mF_WKxg.js +0 -27
- package/dist/errors-6mF_WKxg.js.map +0 -1
- package/dist/errors-DBW0N9w4.cjs.map +0 -1
- package/dist/generate-BHNyeQXl.js.map +0 -1
- package/dist/generate-Cq5RDTBL.cjs.map +0 -1
- package/dist/generate-DU5zzc54.cjs.map +0 -1
- package/dist/generate-Rly1EXBN.js.map +0 -1
- package/dist/init-BK6inBTR.cjs +0 -306
- package/dist/init-BK6inBTR.cjs.map +0 -1
- package/dist/init-BQ6zfsnw.js +0 -302
- package/dist/init-BQ6zfsnw.js.map +0 -1
- package/dist/init-CN1JFyGX.cjs +0 -25
- package/dist/init-CN1JFyGX.cjs.map +0 -1
- package/dist/init-iN7e1XwI.js +0 -25
- package/dist/init-iN7e1XwI.js.map +0 -1
- package/dist/jiti-Cd3S0xwr.cjs +0 -16
- package/dist/jiti-Cd3S0xwr.cjs.map +0 -1
- package/dist/jiti-e08mD2Ph.js +0 -11
- package/dist/jiti-e08mD2Ph.js.map +0 -1
- package/dist/mcp-BiGUvbWP.js +0 -41
- package/dist/mcp-BiGUvbWP.js.map +0 -1
- package/dist/mcp-CONmm_xT.cjs +0 -42
- package/dist/mcp-CONmm_xT.cjs.map +0 -1
- package/dist/mcp-T7Q4nWbT.cjs +0 -16
- package/dist/mcp-T7Q4nWbT.cjs.map +0 -1
- package/dist/mcp-eP1S40LZ.js +0 -16
- package/dist/mcp-eP1S40LZ.js.map +0 -1
- package/dist/package-BJ6ionm6.cjs.map +0 -1
- package/dist/package-BKZ0H3Zf.js +0 -6
- package/dist/package-BKZ0H3Zf.js.map +0 -1
- package/dist/shell-7HPrTCJ5.cjs.map +0 -1
- package/dist/shell-DqqWsHCD.js.map +0 -1
- package/dist/telemetry-BF3SMlH6.js.map +0 -1
- package/dist/telemetry-DZ7IrLAU.cjs.map +0 -1
- package/dist/validate-BImbbx1t.js +0 -41
- package/dist/validate-BImbbx1t.js.map +0 -1
- package/dist/validate-DAZdX_0i.js +0 -25
- package/dist/validate-DAZdX_0i.js.map +0 -1
- package/dist/validate-DucFMytl.cjs +0 -25
- package/dist/validate-DucFMytl.cjs.map +0 -1
- package/dist/validate-ujLCYSWU.cjs +0 -42
- package/dist/validate-ujLCYSWU.cjs.map +0 -1
- package/src/runners/agent.ts +0 -102
- package/src/runners/generate.ts +0 -343
- package/src/runners/init.ts +0 -323
- package/src/runners/mcp.ts +0 -32
- package/src/runners/validate.ts +0 -35
- package/src/types.ts +0 -11
- package/src/utils/Writables.ts +0 -17
- package/src/utils/executeHooks.ts +0 -45
- package/src/utils/flags.ts +0 -10
- package/src/utils/getCosmiConfig.ts +0 -71
- package/src/utils/getSummary.ts +0 -68
- package/src/utils/jiti.ts +0 -9
- package/src/utils/runHook.ts +0 -75
- package/src/utils/watcher.ts +0 -19
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
//#region ../../internals/shared/src/constants.ts
|
|
2
|
+
const KUBB_CONFIG_FILENAME = "kubb.config.ts";
|
|
3
|
+
const initDefaults = {
|
|
4
|
+
inputPath: "./openapi.yaml",
|
|
5
|
+
outputPath: "./src/gen",
|
|
6
|
+
plugins: ["plugin-ts"]
|
|
7
|
+
};
|
|
8
|
+
const availablePlugins = [
|
|
9
|
+
{
|
|
10
|
+
value: "plugin-ts",
|
|
11
|
+
label: "TypeScript",
|
|
12
|
+
hint: "Recommended",
|
|
13
|
+
packageName: "@kubb/plugin-ts",
|
|
14
|
+
importName: "pluginTs",
|
|
15
|
+
category: "types"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: "plugin-client",
|
|
19
|
+
label: "Client (Fetch/Axios)",
|
|
20
|
+
packageName: "@kubb/plugin-client",
|
|
21
|
+
importName: "pluginClient",
|
|
22
|
+
category: "client"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "plugin-react-query",
|
|
26
|
+
label: "React Query / TanStack Query",
|
|
27
|
+
packageName: "@kubb/plugin-react-query",
|
|
28
|
+
importName: "pluginReactQuery",
|
|
29
|
+
category: "framework"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
value: "plugin-vue-query",
|
|
33
|
+
label: "Vue Query",
|
|
34
|
+
packageName: "@kubb/plugin-vue-query",
|
|
35
|
+
importName: "pluginVueQuery",
|
|
36
|
+
category: "framework"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: "plugin-zod",
|
|
40
|
+
label: "Zod Schemas",
|
|
41
|
+
packageName: "@kubb/plugin-zod",
|
|
42
|
+
importName: "pluginZod",
|
|
43
|
+
category: "validation"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
value: "plugin-faker",
|
|
47
|
+
label: "Faker.js Mocks",
|
|
48
|
+
packageName: "@kubb/plugin-faker",
|
|
49
|
+
importName: "pluginFaker",
|
|
50
|
+
category: "mocks"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
value: "plugin-msw",
|
|
54
|
+
label: "MSW Handlers",
|
|
55
|
+
packageName: "@kubb/plugin-msw",
|
|
56
|
+
importName: "pluginMsw",
|
|
57
|
+
category: "mocks"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
value: "plugin-cypress",
|
|
61
|
+
label: "Cypress Tests",
|
|
62
|
+
packageName: "@kubb/plugin-cypress",
|
|
63
|
+
importName: "pluginCypress",
|
|
64
|
+
category: "testing"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
value: "plugin-mcp",
|
|
68
|
+
label: "MCP Server (AI / Model Context Protocol)",
|
|
69
|
+
packageName: "@kubb/plugin-mcp",
|
|
70
|
+
importName: "pluginMcp",
|
|
71
|
+
category: "ai"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
value: "plugin-redoc",
|
|
75
|
+
label: "ReDoc Documentation",
|
|
76
|
+
packageName: "@kubb/plugin-redoc",
|
|
77
|
+
importName: "pluginRedoc",
|
|
78
|
+
category: "documentation"
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
const pluginDefaultConfigs = {
|
|
82
|
+
"plugin-ts": `pluginTs({
|
|
83
|
+
output: { path: 'models' },
|
|
84
|
+
})`,
|
|
85
|
+
"plugin-client": `pluginClient({
|
|
86
|
+
output: { path: 'clients' },
|
|
87
|
+
})`,
|
|
88
|
+
"plugin-react-query": `pluginReactQuery({
|
|
89
|
+
output: { path: 'hooks' },
|
|
90
|
+
})`,
|
|
91
|
+
"plugin-vue-query": `pluginVueQuery({
|
|
92
|
+
output: { path: 'hooks' },
|
|
93
|
+
})`,
|
|
94
|
+
"plugin-zod": `pluginZod({
|
|
95
|
+
output: { path: 'zod' },
|
|
96
|
+
})`,
|
|
97
|
+
"plugin-faker": `pluginFaker({
|
|
98
|
+
output: { path: 'mocks' },
|
|
99
|
+
})`,
|
|
100
|
+
"plugin-msw": `pluginMsw({
|
|
101
|
+
output: { path: 'msw' },
|
|
102
|
+
})`,
|
|
103
|
+
"plugin-cypress": `pluginCypress({
|
|
104
|
+
output: { path: 'cypress' },
|
|
105
|
+
})`,
|
|
106
|
+
"plugin-mcp": `pluginMcp({
|
|
107
|
+
output: { path: 'mcp' },
|
|
108
|
+
})`,
|
|
109
|
+
"plugin-redoc": `pluginRedoc({
|
|
110
|
+
output: { path: 'redoc' },
|
|
111
|
+
})`
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
114
|
+
Object.defineProperty(exports, "KUBB_CONFIG_FILENAME", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function() {
|
|
117
|
+
return KUBB_CONFIG_FILENAME;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "availablePlugins", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function() {
|
|
123
|
+
return availablePlugins;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, "initDefaults", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function() {
|
|
129
|
+
return initDefaults;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "pluginDefaultConfigs", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function() {
|
|
135
|
+
return pluginDefaultConfigs;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
//# sourceMappingURL=constants-BYGmiFs0.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-BYGmiFs0.cjs","names":[],"sources":["../../../internals/shared/src/constants.ts"],"sourcesContent":["import type { PluginOption } from './types.ts'\n\nexport const KUBB_CONFIG_FILENAME = 'kubb.config.ts' as const\n\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-ts'],\n} as const\n\nexport const availablePlugins: PluginOption[] = [\n {\n value: 'plugin-ts',\n label: 'TypeScript',\n hint: 'Recommended',\n packageName: '@kubb/plugin-ts',\n importName: 'pluginTs',\n category: 'types',\n },\n {\n value: 'plugin-client',\n label: 'Client (Fetch/Axios)',\n packageName: '@kubb/plugin-client',\n importName: 'pluginClient',\n category: 'client',\n },\n {\n value: 'plugin-react-query',\n label: 'React Query / TanStack Query',\n packageName: '@kubb/plugin-react-query',\n importName: 'pluginReactQuery',\n category: 'framework',\n },\n {\n value: 'plugin-vue-query',\n label: 'Vue Query',\n packageName: '@kubb/plugin-vue-query',\n importName: 'pluginVueQuery',\n category: 'framework',\n },\n {\n value: 'plugin-zod',\n label: 'Zod Schemas',\n packageName: '@kubb/plugin-zod',\n importName: 'pluginZod',\n category: 'validation',\n },\n {\n value: 'plugin-faker',\n label: 'Faker.js Mocks',\n packageName: '@kubb/plugin-faker',\n importName: 'pluginFaker',\n category: 'mocks',\n },\n {\n value: 'plugin-msw',\n label: 'MSW Handlers',\n packageName: '@kubb/plugin-msw',\n importName: 'pluginMsw',\n category: 'mocks',\n },\n {\n value: 'plugin-cypress',\n label: 'Cypress Tests',\n packageName: '@kubb/plugin-cypress',\n importName: 'pluginCypress',\n category: 'testing',\n },\n {\n value: 'plugin-mcp',\n label: 'MCP Server (AI / Model Context Protocol)',\n packageName: '@kubb/plugin-mcp',\n importName: 'pluginMcp',\n category: 'ai',\n },\n {\n value: 'plugin-redoc',\n label: 'ReDoc Documentation',\n packageName: '@kubb/plugin-redoc',\n importName: 'pluginRedoc',\n category: 'documentation',\n },\n]\n\nexport const pluginDefaultConfigs = {\n 'plugin-ts': `pluginTs({\n output: { path: 'models' },\n })`,\n 'plugin-client': `pluginClient({\n output: { path: 'clients' },\n })`,\n 'plugin-react-query': `pluginReactQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-zod': `pluginZod({\n output: { path: 'zod' },\n })`,\n 'plugin-faker': `pluginFaker({\n output: { path: 'mocks' },\n })`,\n 'plugin-msw': `pluginMsw({\n output: { path: 'msw' },\n })`,\n 'plugin-cypress': `pluginCypress({\n output: { path: 'cypress' },\n })`,\n 'plugin-mcp': `pluginMcp({\n output: { path: 'mcp' },\n })`,\n 'plugin-redoc': `pluginRedoc({\n output: { path: 'redoc' },\n })`,\n} as const satisfies Record<string, string>\n"],"mappings":";AAEA,MAAa,uBAAuB;AAEpC,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,YAAY;CACvB;AAED,MAAa,mBAAmC;CAC9C;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACF;AAED,MAAa,uBAAuB;CAClC,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,oBAAoB;;;CAGpB,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGd,kBAAkB;;;CAGlB,cAAc;;;CAGd,gBAAgB;;;CAGjB"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
//#region ../../internals/shared/src/constants.ts
|
|
2
|
+
const KUBB_CONFIG_FILENAME = "kubb.config.ts";
|
|
3
|
+
const initDefaults = {
|
|
4
|
+
inputPath: "./openapi.yaml",
|
|
5
|
+
outputPath: "./src/gen",
|
|
6
|
+
plugins: ["plugin-ts"]
|
|
7
|
+
};
|
|
8
|
+
const availablePlugins = [
|
|
9
|
+
{
|
|
10
|
+
value: "plugin-ts",
|
|
11
|
+
label: "TypeScript",
|
|
12
|
+
hint: "Recommended",
|
|
13
|
+
packageName: "@kubb/plugin-ts",
|
|
14
|
+
importName: "pluginTs",
|
|
15
|
+
category: "types"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: "plugin-client",
|
|
19
|
+
label: "Client (Fetch/Axios)",
|
|
20
|
+
packageName: "@kubb/plugin-client",
|
|
21
|
+
importName: "pluginClient",
|
|
22
|
+
category: "client"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "plugin-react-query",
|
|
26
|
+
label: "React Query / TanStack Query",
|
|
27
|
+
packageName: "@kubb/plugin-react-query",
|
|
28
|
+
importName: "pluginReactQuery",
|
|
29
|
+
category: "framework"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
value: "plugin-vue-query",
|
|
33
|
+
label: "Vue Query",
|
|
34
|
+
packageName: "@kubb/plugin-vue-query",
|
|
35
|
+
importName: "pluginVueQuery",
|
|
36
|
+
category: "framework"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: "plugin-zod",
|
|
40
|
+
label: "Zod Schemas",
|
|
41
|
+
packageName: "@kubb/plugin-zod",
|
|
42
|
+
importName: "pluginZod",
|
|
43
|
+
category: "validation"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
value: "plugin-faker",
|
|
47
|
+
label: "Faker.js Mocks",
|
|
48
|
+
packageName: "@kubb/plugin-faker",
|
|
49
|
+
importName: "pluginFaker",
|
|
50
|
+
category: "mocks"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
value: "plugin-msw",
|
|
54
|
+
label: "MSW Handlers",
|
|
55
|
+
packageName: "@kubb/plugin-msw",
|
|
56
|
+
importName: "pluginMsw",
|
|
57
|
+
category: "mocks"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
value: "plugin-cypress",
|
|
61
|
+
label: "Cypress Tests",
|
|
62
|
+
packageName: "@kubb/plugin-cypress",
|
|
63
|
+
importName: "pluginCypress",
|
|
64
|
+
category: "testing"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
value: "plugin-mcp",
|
|
68
|
+
label: "MCP Server (AI / Model Context Protocol)",
|
|
69
|
+
packageName: "@kubb/plugin-mcp",
|
|
70
|
+
importName: "pluginMcp",
|
|
71
|
+
category: "ai"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
value: "plugin-redoc",
|
|
75
|
+
label: "ReDoc Documentation",
|
|
76
|
+
packageName: "@kubb/plugin-redoc",
|
|
77
|
+
importName: "pluginRedoc",
|
|
78
|
+
category: "documentation"
|
|
79
|
+
}
|
|
80
|
+
];
|
|
81
|
+
const pluginDefaultConfigs = {
|
|
82
|
+
"plugin-ts": `pluginTs({
|
|
83
|
+
output: { path: 'models' },
|
|
84
|
+
})`,
|
|
85
|
+
"plugin-client": `pluginClient({
|
|
86
|
+
output: { path: 'clients' },
|
|
87
|
+
})`,
|
|
88
|
+
"plugin-react-query": `pluginReactQuery({
|
|
89
|
+
output: { path: 'hooks' },
|
|
90
|
+
})`,
|
|
91
|
+
"plugin-vue-query": `pluginVueQuery({
|
|
92
|
+
output: { path: 'hooks' },
|
|
93
|
+
})`,
|
|
94
|
+
"plugin-zod": `pluginZod({
|
|
95
|
+
output: { path: 'zod' },
|
|
96
|
+
})`,
|
|
97
|
+
"plugin-faker": `pluginFaker({
|
|
98
|
+
output: { path: 'mocks' },
|
|
99
|
+
})`,
|
|
100
|
+
"plugin-msw": `pluginMsw({
|
|
101
|
+
output: { path: 'msw' },
|
|
102
|
+
})`,
|
|
103
|
+
"plugin-cypress": `pluginCypress({
|
|
104
|
+
output: { path: 'cypress' },
|
|
105
|
+
})`,
|
|
106
|
+
"plugin-mcp": `pluginMcp({
|
|
107
|
+
output: { path: 'mcp' },
|
|
108
|
+
})`,
|
|
109
|
+
"plugin-redoc": `pluginRedoc({
|
|
110
|
+
output: { path: 'redoc' },
|
|
111
|
+
})`
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
114
|
+
export { pluginDefaultConfigs as i, availablePlugins as n, initDefaults as r, KUBB_CONFIG_FILENAME as t };
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=constants-DSJ-Xrbv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-DSJ-Xrbv.js","names":[],"sources":["../../../internals/shared/src/constants.ts"],"sourcesContent":["import type { PluginOption } from './types.ts'\n\nexport const KUBB_CONFIG_FILENAME = 'kubb.config.ts' as const\n\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-ts'],\n} as const\n\nexport const availablePlugins: PluginOption[] = [\n {\n value: 'plugin-ts',\n label: 'TypeScript',\n hint: 'Recommended',\n packageName: '@kubb/plugin-ts',\n importName: 'pluginTs',\n category: 'types',\n },\n {\n value: 'plugin-client',\n label: 'Client (Fetch/Axios)',\n packageName: '@kubb/plugin-client',\n importName: 'pluginClient',\n category: 'client',\n },\n {\n value: 'plugin-react-query',\n label: 'React Query / TanStack Query',\n packageName: '@kubb/plugin-react-query',\n importName: 'pluginReactQuery',\n category: 'framework',\n },\n {\n value: 'plugin-vue-query',\n label: 'Vue Query',\n packageName: '@kubb/plugin-vue-query',\n importName: 'pluginVueQuery',\n category: 'framework',\n },\n {\n value: 'plugin-zod',\n label: 'Zod Schemas',\n packageName: '@kubb/plugin-zod',\n importName: 'pluginZod',\n category: 'validation',\n },\n {\n value: 'plugin-faker',\n label: 'Faker.js Mocks',\n packageName: '@kubb/plugin-faker',\n importName: 'pluginFaker',\n category: 'mocks',\n },\n {\n value: 'plugin-msw',\n label: 'MSW Handlers',\n packageName: '@kubb/plugin-msw',\n importName: 'pluginMsw',\n category: 'mocks',\n },\n {\n value: 'plugin-cypress',\n label: 'Cypress Tests',\n packageName: '@kubb/plugin-cypress',\n importName: 'pluginCypress',\n category: 'testing',\n },\n {\n value: 'plugin-mcp',\n label: 'MCP Server (AI / Model Context Protocol)',\n packageName: '@kubb/plugin-mcp',\n importName: 'pluginMcp',\n category: 'ai',\n },\n {\n value: 'plugin-redoc',\n label: 'ReDoc Documentation',\n packageName: '@kubb/plugin-redoc',\n importName: 'pluginRedoc',\n category: 'documentation',\n },\n]\n\nexport const pluginDefaultConfigs = {\n 'plugin-ts': `pluginTs({\n output: { path: 'models' },\n })`,\n 'plugin-client': `pluginClient({\n output: { path: 'clients' },\n })`,\n 'plugin-react-query': `pluginReactQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-zod': `pluginZod({\n output: { path: 'zod' },\n })`,\n 'plugin-faker': `pluginFaker({\n output: { path: 'mocks' },\n })`,\n 'plugin-msw': `pluginMsw({\n output: { path: 'msw' },\n })`,\n 'plugin-cypress': `pluginCypress({\n output: { path: 'cypress' },\n })`,\n 'plugin-mcp': `pluginMcp({\n output: { path: 'mcp' },\n })`,\n 'plugin-redoc': `pluginRedoc({\n output: { path: 'redoc' },\n })`,\n} as const satisfies Record<string, string>\n"],"mappings":";AAEA,MAAa,uBAAuB;AAEpC,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,YAAY;CACvB;AAED,MAAa,mBAAmC;CAC9C;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACD;EACE,OAAO;EACP,OAAO;EACP,aAAa;EACb,YAAY;EACZ,UAAU;EACX;CACF;AAED,MAAa,uBAAuB;CAClC,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,oBAAoB;;;CAGpB,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGd,kBAAkB;;;CAGlB,cAAc;;;CAGd,gBAAgB;;;CAGjB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require("./chunk-ByKO4r7w.cjs");
|
|
2
|
+
//#region ../../internals/utils/src/cli/define.ts
|
|
3
|
+
/**
|
|
4
|
+
* Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const adapter = defineCLIAdapter({ run: myRun, renderHelp: myHelp })
|
|
9
|
+
* createCLI({ adapter }).run(commands, argv, opts)
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
function defineCLIAdapter(adapter) {
|
|
13
|
+
return adapter;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns a `CommandDefinition` with typed `values` in `run()`.
|
|
17
|
+
* The callback receives `values` inferred from the declared options — no casts needed.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const generate = defineCommand({
|
|
22
|
+
* name: 'generate',
|
|
23
|
+
* description: 'Generate client code',
|
|
24
|
+
* options: { config: { type: 'string', description: 'Config path' } },
|
|
25
|
+
* async run({ values }) { console.log(values.config) },
|
|
26
|
+
* })
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
function defineCommand(def) {
|
|
30
|
+
const { run, ...rest } = def;
|
|
31
|
+
if (!run) return rest;
|
|
32
|
+
return {
|
|
33
|
+
...rest,
|
|
34
|
+
run: (args) => run({
|
|
35
|
+
values: args.values,
|
|
36
|
+
positionals: args.positionals
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
Object.defineProperty(exports, "defineCLIAdapter", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function() {
|
|
44
|
+
return defineCLIAdapter;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, "defineCommand", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function() {
|
|
50
|
+
return defineCommand;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=define-Bdn8j5VM.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-Bdn8j5VM.cjs","names":[],"sources":["../../../internals/utils/src/cli/define.ts"],"sourcesContent":["import type { CLIAdapter, CommandDefinition, OptionDefinition } from './types.ts'\n\ntype OptionTypeMap = { string: string; boolean: boolean }\n\ntype IsRequired<O extends OptionDefinition> = O['default'] extends string | boolean ? true : O['required'] extends true ? true : false\n\n/**\n * Infers typed values from an options record. Options with a `default` or `required: true` are always defined.\n */\ntype InferValues<O extends Record<string, OptionDefinition>> = {\n [K in keyof O as IsRequired<O[K]> extends true ? K : never]: OptionTypeMap[O[K]['type']]\n} & {\n [K in keyof O as IsRequired<O[K]> extends true ? never : K]?: OptionTypeMap[O[K]['type']]\n}\n\n/**\n * Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.\n *\n * @example\n * ```ts\n * const adapter = defineCLIAdapter({ run: myRun, renderHelp: myHelp })\n * createCLI({ adapter }).run(commands, argv, opts)\n * ```\n */\nexport function defineCLIAdapter(adapter: CLIAdapter): CLIAdapter {\n return adapter\n}\n\n/**\n * Returns a `CommandDefinition` with typed `values` in `run()`.\n * The callback receives `values` inferred from the declared options — no casts needed.\n *\n * @example\n * ```ts\n * const generate = defineCommand({\n * name: 'generate',\n * description: 'Generate client code',\n * options: { config: { type: 'string', description: 'Config path' } },\n * async run({ values }) { console.log(values.config) },\n * })\n * ```\n */\nexport function defineCommand<O extends Record<string, OptionDefinition>>(def: {\n name: string\n description: string\n arguments?: string[]\n examples?: string[]\n options?: O\n subCommands?: CommandDefinition[]\n run?: (args: { values: InferValues<O>; positionals: string[] }) => Promise<void>\n}): CommandDefinition {\n const { run, ...rest } = def\n if (!run) return rest\n return {\n ...rest,\n run: (args) =>\n run({\n values: args.values as InferValues<O>,\n positionals: args.positionals,\n }),\n }\n}\n"],"mappings":";;;;;;;;;;;AAwBA,SAAgB,iBAAiB,SAAiC;CAChE,OAAO;;;;;;;;;;;;;;;;AAiBT,SAAgB,cAA0D,KAQpD;CACpB,MAAM,EAAE,KAAK,GAAG,SAAS;CACzB,IAAI,CAAC,KAAK,OAAO;CACjB,OAAO;EACL,GAAG;EACH,MAAM,SACJ,IAAI;GACF,QAAQ,KAAK;GACb,aAAa,KAAK;GACnB,CAAC;EACL"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import "./chunk-BvFE5Tac.js";
|
|
2
|
+
//#region ../../internals/utils/src/cli/define.ts
|
|
3
|
+
/**
|
|
4
|
+
* Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const adapter = defineCLIAdapter({ run: myRun, renderHelp: myHelp })
|
|
9
|
+
* createCLI({ adapter }).run(commands, argv, opts)
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
function defineCLIAdapter(adapter) {
|
|
13
|
+
return adapter;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns a `CommandDefinition` with typed `values` in `run()`.
|
|
17
|
+
* The callback receives `values` inferred from the declared options — no casts needed.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const generate = defineCommand({
|
|
22
|
+
* name: 'generate',
|
|
23
|
+
* description: 'Generate client code',
|
|
24
|
+
* options: { config: { type: 'string', description: 'Config path' } },
|
|
25
|
+
* async run({ values }) { console.log(values.config) },
|
|
26
|
+
* })
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
function defineCommand(def) {
|
|
30
|
+
const { run, ...rest } = def;
|
|
31
|
+
if (!run) return rest;
|
|
32
|
+
return {
|
|
33
|
+
...rest,
|
|
34
|
+
run: (args) => run({
|
|
35
|
+
values: args.values,
|
|
36
|
+
positionals: args.positionals
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { defineCommand as n, defineCLIAdapter as t };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=define-m_fp-Aqm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-m_fp-Aqm.js","names":[],"sources":["../../../internals/utils/src/cli/define.ts"],"sourcesContent":["import type { CLIAdapter, CommandDefinition, OptionDefinition } from './types.ts'\n\ntype OptionTypeMap = { string: string; boolean: boolean }\n\ntype IsRequired<O extends OptionDefinition> = O['default'] extends string | boolean ? true : O['required'] extends true ? true : false\n\n/**\n * Infers typed values from an options record. Options with a `default` or `required: true` are always defined.\n */\ntype InferValues<O extends Record<string, OptionDefinition>> = {\n [K in keyof O as IsRequired<O[K]> extends true ? K : never]: OptionTypeMap[O[K]['type']]\n} & {\n [K in keyof O as IsRequired<O[K]> extends true ? never : K]?: OptionTypeMap[O[K]['type']]\n}\n\n/**\n * Returns a `CLIAdapter` as-is with full type inference. Pass a custom adapter to `createCLI` to swap the CLI engine.\n *\n * @example\n * ```ts\n * const adapter = defineCLIAdapter({ run: myRun, renderHelp: myHelp })\n * createCLI({ adapter }).run(commands, argv, opts)\n * ```\n */\nexport function defineCLIAdapter(adapter: CLIAdapter): CLIAdapter {\n return adapter\n}\n\n/**\n * Returns a `CommandDefinition` with typed `values` in `run()`.\n * The callback receives `values` inferred from the declared options — no casts needed.\n *\n * @example\n * ```ts\n * const generate = defineCommand({\n * name: 'generate',\n * description: 'Generate client code',\n * options: { config: { type: 'string', description: 'Config path' } },\n * async run({ values }) { console.log(values.config) },\n * })\n * ```\n */\nexport function defineCommand<O extends Record<string, OptionDefinition>>(def: {\n name: string\n description: string\n arguments?: string[]\n examples?: string[]\n options?: O\n subCommands?: CommandDefinition[]\n run?: (args: { values: InferValues<O>; positionals: string[] }) => Promise<void>\n}): CommandDefinition {\n const { run, ...rest } = def\n if (!run) return rest\n return {\n ...rest,\n run: (args) =>\n run({\n values: args.values as InferValues<O>,\n positionals: args.positionals,\n }),\n }\n}\n"],"mappings":";;;;;;;;;;;AAwBA,SAAgB,iBAAiB,SAAiC;CAChE,OAAO;;;;;;;;;;;;;;;;AAiBT,SAAgB,cAA0D,KAQpD;CACpB,MAAM,EAAE,KAAK,GAAG,SAAS;CACzB,IAAI,CAAC,KAAK,OAAO;CACjB,OAAO;EACL,GAAG;EACH,MAAM,SACJ,IAAI;GACF,QAAQ,KAAK;GACb,aAAa,KAAK;GACnB,CAAC;EACL"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import "./chunk-BvFE5Tac.js";
|
|
2
|
+
//#region ../../internals/utils/src/errors.ts
|
|
3
|
+
/**
|
|
4
|
+
* Coerces an unknown thrown value to an `Error` instance.
|
|
5
|
+
* Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* try { ... } catch(err) {
|
|
10
|
+
* throw new BuildError('Build failed', { cause: toError(err), errors: [] })
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
function toError(value) {
|
|
15
|
+
return value instanceof Error ? value : new Error(String(value));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Extracts a human-readable message from any thrown value.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* getErrorMessage(new Error('oops')) // 'oops'
|
|
23
|
+
* getErrorMessage('plain string') // 'plain string'
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
function getErrorMessage(value) {
|
|
27
|
+
return value instanceof Error ? value.message : String(value);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const cause = toCause(buildError) // Error | undefined
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
function toCause(error) {
|
|
38
|
+
return error.cause instanceof Error ? error.cause : void 0;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { toCause as n, toError as r, getErrorMessage as t };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=errors-CINO1EIv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-CINO1EIv.js","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n *\n * @example\n * ```ts\n * throw new BuildError('Build failed', { errors: [err1, err2] })\n * ```\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new BuildError('Build failed', { cause: toError(err), errors: [] })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.\n *\n * @example\n * ```ts\n * const cause = toCause(buildError) // Error | undefined\n * ```\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;;;;;;;AAYlE,SAAgB,gBAAgB,OAAwB;CACtD,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;;;;;AAW/D,SAAgB,QAAQ,OAAiC;CACvD,OAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA"}
|
|
@@ -2,21 +2,37 @@ require("./chunk-ByKO4r7w.cjs");
|
|
|
2
2
|
//#region ../../internals/utils/src/errors.ts
|
|
3
3
|
/**
|
|
4
4
|
* Coerces an unknown thrown value to an `Error` instance.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* try { ... } catch(err) {
|
|
10
|
+
* throw new BuildError('Build failed', { cause: toError(err), errors: [] })
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
7
13
|
*/
|
|
8
14
|
function toError(value) {
|
|
9
15
|
return value instanceof Error ? value : new Error(String(value));
|
|
10
16
|
}
|
|
11
17
|
/**
|
|
12
|
-
*
|
|
18
|
+
* Extracts a human-readable message from any thrown value.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* getErrorMessage(new Error('oops')) // 'oops'
|
|
23
|
+
* getErrorMessage('plain string') // 'plain string'
|
|
24
|
+
* ```
|
|
13
25
|
*/
|
|
14
26
|
function getErrorMessage(value) {
|
|
15
27
|
return value instanceof Error ? value.message : String(value);
|
|
16
28
|
}
|
|
17
29
|
/**
|
|
18
|
-
* Extracts the `.cause` of an `Error` as an `Error
|
|
19
|
-
*
|
|
30
|
+
* Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const cause = toCause(buildError) // Error | undefined
|
|
35
|
+
* ```
|
|
20
36
|
*/
|
|
21
37
|
function toCause(error) {
|
|
22
38
|
return error.cause instanceof Error ? error.cause : void 0;
|
|
@@ -41,4 +57,4 @@ Object.defineProperty(exports, "toError", {
|
|
|
41
57
|
}
|
|
42
58
|
});
|
|
43
59
|
|
|
44
|
-
//# sourceMappingURL=errors-
|
|
60
|
+
//# sourceMappingURL=errors-CLCjoSg0.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-CLCjoSg0.cjs","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\n *\n * @example\n * ```ts\n * throw new BuildError('Build failed', { errors: [err1, err2] })\n * ```\n */\nexport class BuildError extends Error {\n errors: Array<Error>\n\n constructor(message: string, options: { cause?: Error; errors: Array<Error> }) {\n super(message, { cause: options.cause })\n this.name = 'BuildError'\n this.errors = options.errors\n }\n}\n\n/**\n * Coerces an unknown thrown value to an `Error` instance.\n * Returns the value as-is when it is already an `Error`; otherwise wraps it with `String(value)`.\n *\n * @example\n * ```ts\n * try { ... } catch(err) {\n * throw new BuildError('Build failed', { cause: toError(err), errors: [] })\n * }\n * ```\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Extracts a human-readable message from any thrown value.\n *\n * @example\n * ```ts\n * getErrorMessage(new Error('oops')) // 'oops'\n * getErrorMessage('plain string') // 'plain string'\n * ```\n */\nexport function getErrorMessage(value: unknown): string {\n return value instanceof Error ? value.message : String(value)\n}\n\n/**\n * Extracts the `.cause` of an `Error` as an `Error`, or `undefined` when absent or not an `Error`.\n *\n * @example\n * ```ts\n * const cause = toCause(buildError) // Error | undefined\n * ```\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,QAAQ,OAAuB;CAC7C,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;;;;;;;AAYlE,SAAgB,gBAAgB,OAAwB;CACtD,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;;;;;AAW/D,SAAgB,QAAQ,OAAiC;CACvD,OAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import "./chunk
|
|
2
|
-
import { n as defineCommand } from "./define
|
|
1
|
+
import "./chunk-BvFE5Tac.js";
|
|
2
|
+
import { n as defineCommand } from "./define-m_fp-Aqm.js";
|
|
3
3
|
//#region src/commands/generate.ts
|
|
4
4
|
const command = defineCommand({
|
|
5
5
|
name: "generate",
|
|
6
|
-
description: "
|
|
6
|
+
description: "Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.",
|
|
7
7
|
arguments: ["[input]"],
|
|
8
|
+
examples: [
|
|
9
|
+
"kubb generate",
|
|
10
|
+
"kubb generate ./openapi.yaml",
|
|
11
|
+
"kubb generate --config kubb.config.ts",
|
|
12
|
+
"kubb generate --watch"
|
|
13
|
+
],
|
|
8
14
|
options: {
|
|
9
15
|
config: {
|
|
10
16
|
type: "string",
|
|
@@ -51,8 +57,8 @@ const command = defineCommand({
|
|
|
51
57
|
},
|
|
52
58
|
async run({ values, positionals }) {
|
|
53
59
|
const logLevel = values.debug ? "debug" : values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
|
|
54
|
-
const {
|
|
55
|
-
await
|
|
60
|
+
const { run } = await import("./run-Bfbr3RaM.js");
|
|
61
|
+
await run({
|
|
56
62
|
input: positionals[0],
|
|
57
63
|
configPath: values.config,
|
|
58
64
|
logLevel,
|
|
@@ -63,4 +69,4 @@ const command = defineCommand({
|
|
|
63
69
|
//#endregion
|
|
64
70
|
export { command };
|
|
65
71
|
|
|
66
|
-
//# sourceMappingURL=generate-
|
|
72
|
+
//# sourceMappingURL=generate-BLvcvoIj.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-BLvcvoIj.js","names":[],"sources":["../src/commands/generate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\n\nexport const command = defineCommand({\n name: 'generate',\n description:\n 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',\n arguments: ['[input]'],\n examples: ['kubb generate', 'kubb generate ./openapi.yaml', 'kubb generate --config kubb.config.ts', 'kubb generate --watch'],\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n logLevel: {\n type: 'string',\n description: 'Info, silent, verbose or debug',\n short: 'l',\n default: 'info',\n hint: 'silent|info|verbose|debug',\n enum: ['silent', 'info', 'verbose', 'debug'],\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n short: 'w',\n default: false,\n },\n debug: {\n type: 'boolean',\n description: 'Override logLevel to debug',\n short: 'd',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n short: 'v',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n },\n async run({ values, positionals }) {\n const logLevel = values.debug ? 'debug' : values.verbose ? 'verbose' : values.silent ? 'silent' : values.logLevel\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: positionals[0],\n configPath: values.config,\n logLevel,\n watch: values.watch,\n })\n },\n})\n"],"mappings":";;;AAEA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aACE;CACF,WAAW,CAAC,UAAU;CACtB,UAAU;EAAC;EAAiB;EAAgC;EAAyC;EAAwB;CAC7H,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,UAAU;GACR,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACT,MAAM;GACN,MAAM;IAAC;IAAU;IAAQ;IAAW;IAAQ;GAC7C;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,SAAS;GACP,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,QAAQ,eAAe;EACjC,MAAM,WAAW,OAAO,QAAQ,UAAU,OAAO,UAAU,YAAY,OAAO,SAAS,WAAW,OAAO;EACzG,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR,OAAO,YAAY;GACnB,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACf,CAAC;;CAEL,CAAC"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
require("./chunk-ByKO4r7w.cjs");
|
|
2
2
|
//#region src/commands/generate.ts
|
|
3
|
-
const command = require("./define-
|
|
3
|
+
const command = require("./define-Bdn8j5VM.cjs").defineCommand({
|
|
4
4
|
name: "generate",
|
|
5
|
-
description: "
|
|
5
|
+
description: "Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.",
|
|
6
6
|
arguments: ["[input]"],
|
|
7
|
+
examples: [
|
|
8
|
+
"kubb generate",
|
|
9
|
+
"kubb generate ./openapi.yaml",
|
|
10
|
+
"kubb generate --config kubb.config.ts",
|
|
11
|
+
"kubb generate --watch"
|
|
12
|
+
],
|
|
7
13
|
options: {
|
|
8
14
|
config: {
|
|
9
15
|
type: "string",
|
|
@@ -50,8 +56,8 @@ const command = require("./define-D6Kfm7-Z.cjs").defineCommand({
|
|
|
50
56
|
},
|
|
51
57
|
async run({ values, positionals }) {
|
|
52
58
|
const logLevel = values.debug ? "debug" : values.verbose ? "verbose" : values.silent ? "silent" : values.logLevel;
|
|
53
|
-
const {
|
|
54
|
-
await
|
|
59
|
+
const { run } = await Promise.resolve().then(() => require("./run-CVlrIZoW.cjs"));
|
|
60
|
+
await run({
|
|
55
61
|
input: positionals[0],
|
|
56
62
|
configPath: values.config,
|
|
57
63
|
logLevel,
|
|
@@ -62,4 +68,4 @@ const command = require("./define-D6Kfm7-Z.cjs").defineCommand({
|
|
|
62
68
|
//#endregion
|
|
63
69
|
exports.command = command;
|
|
64
70
|
|
|
65
|
-
//# sourceMappingURL=generate-
|
|
71
|
+
//# sourceMappingURL=generate-drLxTAnz.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-drLxTAnz.cjs","names":["defineCommand"],"sources":["../src/commands/generate.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\n\nexport const command = defineCommand({\n name: 'generate',\n description:\n 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',\n arguments: ['[input]'],\n examples: ['kubb generate', 'kubb generate ./openapi.yaml', 'kubb generate --config kubb.config.ts', 'kubb generate --watch'],\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n logLevel: {\n type: 'string',\n description: 'Info, silent, verbose or debug',\n short: 'l',\n default: 'info',\n hint: 'silent|info|verbose|debug',\n enum: ['silent', 'info', 'verbose', 'debug'],\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n short: 'w',\n default: false,\n },\n debug: {\n type: 'boolean',\n description: 'Override logLevel to debug',\n short: 'd',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n short: 'v',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n },\n async run({ values, positionals }) {\n const logLevel = values.debug ? 'debug' : values.verbose ? 'verbose' : values.silent ? 'silent' : values.logLevel\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: positionals[0],\n configPath: values.config,\n logLevel,\n watch: values.watch,\n })\n },\n})\n"],"mappings":";;AAEA,MAAa,0CAAUA,CAAAA,cAAc;CACnC,MAAM;CACN,aACE;CACF,WAAW,CAAC,UAAU;CACtB,UAAU;EAAC;EAAiB;EAAgC;EAAyC;EAAwB;CAC7H,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,UAAU;GACR,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACT,MAAM;GACN,MAAM;IAAC;IAAU;IAAQ;IAAW;IAAQ;GAC7C;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,SAAS;GACP,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACD,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,QAAQ,eAAe;EACjC,MAAM,WAAW,OAAO,QAAQ,UAAU,OAAO,UAAU,YAAY,OAAO,SAAS,WAAW,OAAO;EACzG,MAAM,EAAE,QAAQ,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,qBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,OAAO,YAAY;GACnB,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACf,CAAC;;CAEL,CAAC"}
|