@kubb/cli 5.0.0-alpha.2 → 5.0.0-alpha.21

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.
Files changed (98) hide show
  1. package/dist/{agent-L50VNhXv.js → agent-DTyw-mt7.js} +4 -4
  2. package/dist/{agent-L50VNhXv.js.map → agent-DTyw-mt7.js.map} +1 -1
  3. package/dist/{agent-B2TK-4x7.cjs → agent-Dd7uQlD3.cjs} +5 -5
  4. package/dist/{agent-B2TK-4x7.cjs.map → agent-Dd7uQlD3.cjs.map} +1 -1
  5. package/dist/{agent-C6o_6GSJ.cjs → agent-DpzeyN1s.cjs} +4 -4
  6. package/dist/{agent-C6o_6GSJ.cjs.map → agent-DpzeyN1s.cjs.map} +1 -1
  7. package/dist/{agent-CxaBPZgN.js → agent-TvIyrWHH.js} +5 -5
  8. package/dist/{agent-CxaBPZgN.js.map → agent-TvIyrWHH.js.map} +1 -1
  9. package/dist/{constants-BTUap0zs.cjs → constants-D0XHAHeZ.cjs} +78 -8
  10. package/dist/constants-D0XHAHeZ.cjs.map +1 -0
  11. package/dist/{constants-CM3dJzjK.js → constants-DJM9zCXm.js} +73 -9
  12. package/dist/constants-DJM9zCXm.js.map +1 -0
  13. package/dist/define-Bdn8j5VM.cjs +54 -0
  14. package/dist/define-Bdn8j5VM.cjs.map +1 -0
  15. package/dist/define-Ctii4bel.js +43 -0
  16. package/dist/define-Ctii4bel.js.map +1 -0
  17. package/dist/{errors-DBW0N9w4.cjs → errors-CLCjoSg0.cjs} +22 -6
  18. package/dist/errors-CLCjoSg0.cjs.map +1 -0
  19. package/dist/errors-CjPmyZHy.js +43 -0
  20. package/dist/errors-CjPmyZHy.js.map +1 -0
  21. package/dist/{generate-C52-Gwzu.cjs → generate-8gBYPkBI.cjs} +3 -3
  22. package/dist/{generate-C52-Gwzu.cjs.map → generate-8gBYPkBI.cjs.map} +1 -1
  23. package/dist/{generate-8xxZmvqZ.js → generate-BjYMvMXy.js} +178 -77
  24. package/dist/generate-BjYMvMXy.js.map +1 -0
  25. package/dist/{generate-D8p6X0le.cjs → generate-C1x42EUt.cjs} +177 -76
  26. package/dist/generate-C1x42EUt.cjs.map +1 -0
  27. package/dist/{generate-DYZYA7O1.js → generate-CCKyB7yS.js} +3 -3
  28. package/dist/{generate-DYZYA7O1.js.map → generate-CCKyB7yS.js.map} +1 -1
  29. package/dist/index.cjs +49 -19
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.js +49 -19
  33. package/dist/index.js.map +1 -1
  34. package/dist/{init-hmolV6B4.cjs → init-BlriFVH6.cjs} +19 -4
  35. package/dist/init-BlriFVH6.cjs.map +1 -0
  36. package/dist/{init-BH6q17OX.js → init-C71oxvYR.js} +4 -4
  37. package/dist/{init-BH6q17OX.js.map → init-C71oxvYR.js.map} +1 -1
  38. package/dist/{init-BiutNzDD.cjs → init-DnUVdLjN.cjs} +4 -4
  39. package/dist/{init-BiutNzDD.cjs.map → init-DnUVdLjN.cjs.map} +1 -1
  40. package/dist/{init-C-InrmSY.js → init-Y1TNCdzh.js} +19 -4
  41. package/dist/init-Y1TNCdzh.js.map +1 -0
  42. package/dist/{mcp-Bc7xyp4a.js → mcp-9R8F1uQc.js} +4 -4
  43. package/dist/{mcp-Bc7xyp4a.js.map → mcp-9R8F1uQc.js.map} +1 -1
  44. package/dist/{mcp-D2SHEg_d.js → mcp-CxuctqmK.js} +3 -3
  45. package/dist/{mcp-D2SHEg_d.js.map → mcp-CxuctqmK.js.map} +1 -1
  46. package/dist/{mcp-B9iqBWaU.cjs → mcp-DDX2VL5b.cjs} +4 -4
  47. package/dist/{mcp-B9iqBWaU.cjs.map → mcp-DDX2VL5b.cjs.map} +1 -1
  48. package/dist/{mcp-ChHFPRzD.cjs → mcp-jMZ56bqT.cjs} +3 -3
  49. package/dist/{mcp-ChHFPRzD.cjs.map → mcp-jMZ56bqT.cjs.map} +1 -1
  50. package/dist/{package-lo3R7SUU.cjs → package-CH6AW-ko.cjs} +2 -2
  51. package/dist/package-CH6AW-ko.cjs.map +1 -0
  52. package/dist/package-DTEuw2ZR.js +6 -0
  53. package/dist/package-DTEuw2ZR.js.map +1 -0
  54. package/dist/{shell-7HPrTCJ5.cjs → shell-475fQKaX.cjs} +8 -3
  55. package/dist/shell-475fQKaX.cjs.map +1 -0
  56. package/dist/{shell-DqqWsHCD.js → shell-DLzN4fRo.js} +8 -3
  57. package/dist/shell-DLzN4fRo.js.map +1 -0
  58. package/dist/{telemetry-DxiR7clS.js → telemetry-CBISr5w4.js} +48 -6
  59. package/dist/telemetry-CBISr5w4.js.map +1 -0
  60. package/dist/{telemetry-Cn9X1I5B.cjs → telemetry-YO-uwAbf.cjs} +48 -6
  61. package/dist/telemetry-YO-uwAbf.cjs.map +1 -0
  62. package/dist/{validate-Bbrn3Q-A.cjs → validate-B-LfVNlS.cjs} +3 -3
  63. package/dist/{validate-Bbrn3Q-A.cjs.map → validate-B-LfVNlS.cjs.map} +1 -1
  64. package/dist/{validate-l8vLmwKA.js → validate-CIS8nJdd.js} +3 -3
  65. package/dist/{validate-l8vLmwKA.js.map → validate-CIS8nJdd.js.map} +1 -1
  66. package/dist/{validate-DCeW2b2k.js → validate-CT9EjxW0.js} +4 -4
  67. package/dist/{validate-DCeW2b2k.js.map → validate-CT9EjxW0.js.map} +1 -1
  68. package/dist/{validate-B_O2agAB.cjs → validate-D-Jv1vcb.cjs} +4 -4
  69. package/dist/{validate-B_O2agAB.cjs.map → validate-D-Jv1vcb.cjs.map} +1 -1
  70. package/package.json +5 -5
  71. package/src/constants.ts +57 -10
  72. package/src/index.ts +5 -4
  73. package/src/loggers/clackLogger.ts +30 -22
  74. package/src/runners/generate.ts +22 -23
  75. package/src/types.ts +11 -0
  76. package/src/utils/flags.ts +10 -0
  77. package/src/utils/getCosmiConfig.ts +6 -0
  78. package/dist/constants-BTUap0zs.cjs.map +0 -1
  79. package/dist/constants-CM3dJzjK.js.map +0 -1
  80. package/dist/define--M_JMcDC.js +0 -25
  81. package/dist/define--M_JMcDC.js.map +0 -1
  82. package/dist/define-D6Kfm7-Z.cjs +0 -36
  83. package/dist/define-D6Kfm7-Z.cjs.map +0 -1
  84. package/dist/errors-6mF_WKxg.js +0 -27
  85. package/dist/errors-6mF_WKxg.js.map +0 -1
  86. package/dist/errors-DBW0N9w4.cjs.map +0 -1
  87. package/dist/generate-8xxZmvqZ.js.map +0 -1
  88. package/dist/generate-D8p6X0le.cjs.map +0 -1
  89. package/dist/init-C-InrmSY.js.map +0 -1
  90. package/dist/init-hmolV6B4.cjs.map +0 -1
  91. package/dist/package-B4LgzOaR.js +0 -6
  92. package/dist/package-B4LgzOaR.js.map +0 -1
  93. package/dist/package-lo3R7SUU.cjs.map +0 -1
  94. package/dist/shell-7HPrTCJ5.cjs.map +0 -1
  95. package/dist/shell-DqqWsHCD.js.map +0 -1
  96. package/dist/telemetry-Cn9X1I5B.cjs.map +0 -1
  97. package/dist/telemetry-DxiR7clS.js.map +0 -1
  98. package/src/utils/getIntro.ts +0 -1
@@ -2,9 +2,8 @@ import { relative } from 'node:path'
2
2
  import process from 'node:process'
3
3
  import { styleText } from 'node:util'
4
4
  import * as clack from '@clack/prompts'
5
- import { formatMs, formatMsWithColor, toCause } from '@internals/utils'
5
+ import { formatMs, formatMsWithColor, getIntro, toCause } from '@internals/utils'
6
6
  import { defineLogger, logLevel as logLevelMap } from '@kubb/core'
7
- import { getIntro } from '../utils/getIntro.ts'
8
7
  import { getSummary } from '../utils/getSummary.ts'
9
8
  import { runHook } from '../utils/runHook.ts'
10
9
  import { ClackWritable } from '../utils/Writables.ts'
@@ -148,19 +147,24 @@ export const clackLogger = defineLogger({
148
147
  return
149
148
  }
150
149
 
151
- clack.box(
152
- `\`v${version}\` → \`v${latestVersion}\`
150
+ try {
151
+ clack.box(
152
+ `\`v${version}\` → \`v${latestVersion}\`
153
153
  Run \`npm install -g @kubb/cli\` to update`,
154
- 'Update available for `Kubb`',
155
- {
156
- width: 'auto',
157
- formatBorder: (s: string) => styleText('yellow', s),
158
- rounded: true,
159
- withGuide: false,
160
- contentAlign: 'center',
161
- titleAlign: 'center',
162
- },
163
- )
154
+ 'Update available for `Kubb`',
155
+ {
156
+ width: 'auto',
157
+ formatBorder: (s: string) => styleText('yellow', s),
158
+ rounded: true,
159
+ withGuide: false,
160
+ contentAlign: 'center',
161
+ titleAlign: 'center',
162
+ },
163
+ )
164
+ } catch {
165
+ console.log(`Update available for Kubb: v${version} → v${latestVersion}`)
166
+ console.log('Run `npm install -g @kubb/cli` to update')
167
+ }
164
168
  })
165
169
 
166
170
  context.on('lifecycle:start', async (version) => {
@@ -434,14 +438,18 @@ Run \`npm install -g @kubb/cli\` to update`,
434
438
  summary.push('\n')
435
439
 
436
440
  const borderColor = status === 'success' ? 'green' : 'red'
437
- clack.box(summary.join('\n'), getMessage(title), {
438
- width: 'auto',
439
- formatBorder: (s: string) => styleText(borderColor, s),
440
- rounded: true,
441
- withGuide: false,
442
- contentAlign: 'left',
443
- titleAlign: 'center',
444
- })
441
+ try {
442
+ clack.box(summary.join('\n'), getMessage(title), {
443
+ width: 'auto',
444
+ formatBorder: (s: string) => styleText(borderColor, s),
445
+ rounded: true,
446
+ withGuide: false,
447
+ contentAlign: 'left',
448
+ titleAlign: 'center',
449
+ })
450
+ } catch {
451
+ console.log(summary.join('\n'))
452
+ }
445
453
  })
446
454
 
447
455
  context.on('lifecycle:end', () => {
@@ -16,7 +16,6 @@ import {
16
16
  type KubbEvents,
17
17
  linters,
18
18
  logLevel as logLevelMap,
19
- PromiseManager,
20
19
  safeBuild,
21
20
  setup,
22
21
  } from '@kubb/core'
@@ -39,7 +38,7 @@ type ToolMap = typeof formatters | typeof linters
39
38
 
40
39
  type RunToolPassOptions = {
41
40
  toolValue: string
42
- detect: () => Promise<string | undefined>
41
+ detect: () => Promise<string | null>
43
42
  toolMap: ToolMap
44
43
  /** Short noun used in "Auto-detected <toolLabel>:" message, e.g. "formatter" or "linter". */
45
44
  toolLabel: string
@@ -81,6 +80,8 @@ async function runToolPass({
81
80
  }
82
81
  }
83
82
 
83
+ let toolError: Error | undefined
84
+
84
85
  if (resolvedTool && resolvedTool !== 'auto' && resolvedTool in toolMap) {
85
86
  const toolConfig = toolMap[resolvedTool as keyof ToolMap]
86
87
 
@@ -125,10 +126,15 @@ async function runToolPass({
125
126
  const err = new Error(toolConfig.errorMessage)
126
127
  err.cause = caughtError
127
128
  await events.emit('error', err)
129
+ toolError = err
128
130
  }
129
131
  }
130
132
 
131
133
  await onEnd()
134
+
135
+ if (toolError) {
136
+ throw toolError
137
+ }
132
138
  }
133
139
 
134
140
  async function generate({ input, config: userConfig, events, logLevel }: GenerateProps): Promise<void> {
@@ -159,7 +165,7 @@ async function generate({ input, config: userConfig, events, logLevel }: Generat
159
165
 
160
166
  await events.emit('info', config.name ? `Setup generation ${styleText('bold', config.name)}` : 'Setup generation', inputPath)
161
167
 
162
- const { sources, fabric, pluginManager } = await setup({
168
+ const { sources, fabric, driver } = await setup({
163
169
  config,
164
170
  events,
165
171
  })
@@ -171,7 +177,7 @@ async function generate({ input, config: userConfig, events, logLevel }: Generat
171
177
  config,
172
178
  events,
173
179
  },
174
- { pluginManager, fabric, events, sources },
180
+ { driver, fabric, events, sources },
175
181
  )
176
182
 
177
183
  await events.emit('info', 'Load summary')
@@ -206,7 +212,7 @@ async function generate({ input, config: userConfig, events, logLevel }: Generat
206
212
  buildTelemetryEvent({
207
213
  command: 'generate',
208
214
  kubbVersion: version,
209
- plugins: pluginManager.plugins.map((p) => ({ name: p.name, options: p.options as Record<string, unknown> })),
215
+ plugins: driver.plugins.map((p) => ({ name: p.name, options: p.options as Record<string, unknown> })),
210
216
  hrStart,
211
217
  filesCreated: files.length,
212
218
  status: 'failed',
@@ -274,7 +280,7 @@ async function generate({ input, config: userConfig, events, logLevel }: Generat
274
280
  const telemetryEvent = buildTelemetryEvent({
275
281
  command: 'generate',
276
282
  kubbVersion: version,
277
- plugins: pluginManager.plugins.map((p) => ({ name: p.name, options: p.options as Record<string, unknown> })),
283
+ plugins: driver.plugins.map((p) => ({ name: p.name, options: p.options as Record<string, unknown> })),
278
284
  hrStart,
279
285
  filesCreated: files.length,
280
286
  status: 'success',
@@ -293,7 +299,6 @@ type GenerateCommandOptions = {
293
299
  export async function runGenerateCommand({ input, configPath, logLevel: logLevelKey, watch }: GenerateCommandOptions): Promise<void> {
294
300
  const logLevel = logLevelMap[logLevelKey as keyof typeof logLevelMap] ?? logLevelMap.info
295
301
  const events = new AsyncEventEmitterClass<KubbEvents>()
296
- const promiseManager = new PromiseManager()
297
302
 
298
303
  await setupLogger(events, { logLevel })
299
304
 
@@ -322,26 +327,20 @@ export async function runGenerateCommand({ input, configPath, logLevel: logLevel
322
327
 
323
328
  await events.emit('lifecycle:start', version)
324
329
 
325
- const promises = configs.map((config) => {
326
- return async () => {
327
- if (isInputPath(config) && watch) {
328
- await startWatcher([input || config.input.path], async (paths) => {
329
- // remove to avoid duplicate listeners after each change
330
- events.removeAll()
330
+ for (const config of configs) {
331
+ if (isInputPath(config) && watch) {
332
+ await startWatcher([input || config.input.path], async (paths) => {
333
+ // remove to avoid duplicate listeners after each change
334
+ events.removeAll()
331
335
 
332
- await generate({ input, config, logLevel, events })
333
-
334
- clack.log.step(styleText('yellow', `Watching for changes in ${paths.join(' and ')}`))
335
- })
336
-
337
- return
338
- }
336
+ await generate({ input, config, logLevel, events })
339
337
 
338
+ clack.log.step(styleText('yellow', `Watching for changes in ${paths.join(' and ')}`))
339
+ })
340
+ } else {
340
341
  await generate({ input, config, logLevel, events })
341
342
  }
342
- })
343
-
344
- await promiseManager.run('seq', promises)
343
+ }
345
344
 
346
345
  await events.emit('lifecycle:end')
347
346
  } catch (error) {
package/src/types.ts ADDED
@@ -0,0 +1,11 @@
1
+ export type QuiteFlag = '--help' | '-h' | '--version' | '-v'
2
+
3
+ export type GenerateFlag = '--config' | '-c' | '--log-level' | '-l' | '--watch' | '-w' | '--debug' | '-d' | '--verbose' | '-v' | '--silent' | '-s'
4
+
5
+ export type ValidateFlag = '--input' | '-i'
6
+
7
+ export type InitFlag = '--yes' | '-y'
8
+
9
+ export type AgentStartFlag = '--config' | '-c' | '--port' | '-p' | '--host' | '--allow-write' | '--allow-all'
10
+
11
+ export type Arg = QuiteFlag | GenerateFlag | ValidateFlag | InitFlag | AgentStartFlag
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Type guard that checks whether a raw string is a member of a typed flag set.
3
+ * Avoids the need for type assertions when working with `Set<T extends string>`.
4
+ */
5
+ export function isFlag<T extends string>(set: ReadonlySet<T>, value: string): value is T {
6
+ for (const flag of set) {
7
+ if (flag === value) return true
8
+ }
9
+ return false
10
+ }
@@ -32,11 +32,15 @@ export async function getCosmiConfig(moduleName: string, config?: string): Promi
32
32
  `.${moduleName}rc.yml`,
33
33
 
34
34
  `.${moduleName}rc.ts`,
35
+ `.${moduleName}rc.mts`,
36
+ `.${moduleName}rc.cts`,
35
37
  `.${moduleName}rc.js`,
36
38
  `.${moduleName}rc.mjs`,
37
39
  `.${moduleName}rc.cjs`,
38
40
 
39
41
  `${moduleName}.config.ts`,
42
+ `${moduleName}.config.mts`,
43
+ `${moduleName}.config.cts`,
40
44
  `${moduleName}.config.js`,
41
45
  `${moduleName}.config.mjs`,
42
46
  `${moduleName}.config.cjs`,
@@ -54,6 +58,8 @@ export async function getCosmiConfig(moduleName: string, config?: string): Promi
54
58
  ],
55
59
  loaders: {
56
60
  '.ts': tsLoader,
61
+ '.mts': tsLoader,
62
+ '.cts': tsLoader,
57
63
  },
58
64
  })
59
65
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants-BTUap0zs.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/** NPM registry endpoint used to check for @kubb/cli updates. */\nexport const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/** OpenTelemetry ingestion endpoint for anonymous usage telemetry. */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/** Horizontal rule rendered above/below the plain-logger generation summary. */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\n\n/** Maximum number of █ characters in a plugin timing bar. */\nexport const SUMMARY_MAX_BAR_LENGTH = 10 as const\n\n/** Divides elapsed milliseconds into bar-length units (1 block per 100 ms). */\nexport const SUMMARY_TIME_SCALE_DIVISOR = 100 as const\n\n/** Glob pattern for paths the file watcher ignores. */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/** Default runtime values for the `agent start` command. */\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: 'kubb.config.ts',\n retryTimeout: '30000',\n studioUrl: 'https://studio.kubb.dev',\n /** Relative path from the @kubb/agent package root to the server entry. */\n serverEntryPath: '.output/server/index.mjs',\n} as const\n\n/** Default values used during interactive `init` scaffolding. */\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-oas', 'plugin-ts'],\n} as const\n\n/**\n * Maps each plugin value to the default config snippet inserted by `init`.\n * The `satisfies` constraint ensures all values remain plain strings while\n * `as const` keeps the object deeply immutable.\n */\nexport const pluginDefaultConfigs = {\n 'plugin-oas': 'pluginOas()',\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-solid-query': `pluginSolidQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-svelte-query': `pluginSvelteQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-swr': `pluginSwr({\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} as const satisfies Record<string, string>\n\n/** Color palette used by randomCliColor() for deterministic plugin name coloring. */\n"],"mappings":";;AACA,MAAa,uBAAuB;;AAGpC,MAAa,gBAAgB;;AAG7B,MAAa,oBAAoB,IAAI,OAAO,GAAG;;AAS/C,MAAa,wBAAwB;;AAGrC,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAY;CACZ,cAAc;CACd,WAAW;CAEX,iBAAiB;CAClB;;AAGD,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,cAAc,YAAY;CACrC;;;;;;AAOD,MAAa,uBAAuB;CAClC,cAAc;CACd,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,sBAAsB;;;CAGtB,uBAAuB;;;CAGvB,oBAAoB;;;CAGpB,cAAc;;;CAGd,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGf"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants-CM3dJzjK.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["/** NPM registry endpoint used to check for @kubb/cli updates. */\nexport const KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/** OpenTelemetry ingestion endpoint for anonymous usage telemetry. */\nexport const OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\n/** Horizontal rule rendered above/below the plain-logger generation summary. */\nexport const SUMMARY_SEPARATOR = '─'.repeat(27)\n\n/** Maximum number of █ characters in a plugin timing bar. */\nexport const SUMMARY_MAX_BAR_LENGTH = 10 as const\n\n/** Divides elapsed milliseconds into bar-length units (1 block per 100 ms). */\nexport const SUMMARY_TIME_SCALE_DIVISOR = 100 as const\n\n/** Glob pattern for paths the file watcher ignores. */\nexport const WATCHER_IGNORED_PATHS = '**/{.git,node_modules}/**' as const\n\n/** Default runtime values for the `agent start` command. */\nexport const agentDefaults = {\n port: '3000',\n host: 'localhost',\n configFile: 'kubb.config.ts',\n retryTimeout: '30000',\n studioUrl: 'https://studio.kubb.dev',\n /** Relative path from the @kubb/agent package root to the server entry. */\n serverEntryPath: '.output/server/index.mjs',\n} as const\n\n/** Default values used during interactive `init` scaffolding. */\nexport const initDefaults = {\n inputPath: './openapi.yaml',\n outputPath: './src/gen',\n plugins: ['plugin-oas', 'plugin-ts'],\n} as const\n\n/**\n * Maps each plugin value to the default config snippet inserted by `init`.\n * The `satisfies` constraint ensures all values remain plain strings while\n * `as const` keeps the object deeply immutable.\n */\nexport const pluginDefaultConfigs = {\n 'plugin-oas': 'pluginOas()',\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-solid-query': `pluginSolidQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-svelte-query': `pluginSvelteQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-vue-query': `pluginVueQuery({\n output: { path: 'hooks' },\n })`,\n 'plugin-swr': `pluginSwr({\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} as const satisfies Record<string, string>\n\n/** Color palette used by randomCliColor() for deterministic plugin name coloring. */\n"],"mappings":";;AACA,MAAa,uBAAuB;;AAGpC,MAAa,gBAAgB;;AAG7B,MAAa,oBAAoB,IAAI,OAAO,GAAG;;AAS/C,MAAa,wBAAwB;;AAGrC,MAAa,gBAAgB;CAC3B,MAAM;CACN,MAAM;CACN,YAAY;CACZ,cAAc;CACd,WAAW;CAEX,iBAAiB;CAClB;;AAGD,MAAa,eAAe;CAC1B,WAAW;CACX,YAAY;CACZ,SAAS,CAAC,cAAc,YAAY;CACrC;;;;;;AAOD,MAAa,uBAAuB;CAClC,cAAc;CACd,aAAa;;;CAGb,iBAAiB;;;CAGjB,sBAAsB;;;CAGtB,sBAAsB;;;CAGtB,uBAAuB;;;CAGvB,oBAAoB;;;CAGpB,cAAc;;;CAGd,cAAc;;;CAGd,gBAAgB;;;CAGhB,cAAc;;;CAGf"}
@@ -1,25 +0,0 @@
1
- import "./chunk--u3MIqq1.js";
2
- //#region ../../internals/utils/src/cli/define.ts
3
- /** Returns a `CLIAdapter` with type inference. Pass a different adapter to `createCLI` to swap the CLI engine. */
4
- function defineCLIAdapter(adapter) {
5
- return adapter;
6
- }
7
- /**
8
- * Returns a `CommandDefinition` with typed `values` in `run()`.
9
- * The callback receives `values` typed from the declared options — no casts needed.
10
- */
11
- function defineCommand(def) {
12
- const { run, ...rest } = def;
13
- if (!run) return rest;
14
- return {
15
- ...rest,
16
- run: (args) => run({
17
- values: args.values,
18
- positionals: args.positionals
19
- })
20
- };
21
- }
22
- //#endregion
23
- export { defineCommand as n, defineCLIAdapter as t };
24
-
25
- //# sourceMappingURL=define--M_JMcDC.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define--M_JMcDC.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/** Infers typed values from an options record. Options with a `default` or `required: true` are always defined. */\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/** Returns a `CLIAdapter` with type inference. Pass a different adapter to `createCLI` to swap the CLI engine. */\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` typed from the declared options — no casts needed.\n */\nexport function defineCommand<O extends Record<string, OptionDefinition>>(def: {\n name: string\n description: string\n arguments?: 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) => run({ values: args.values as InferValues<O>, positionals: args.positionals }),\n }\n}\n"],"mappings":";;;AAcA,SAAgB,iBAAiB,SAAiC;AAChE,QAAO;;;;;;AAOT,SAAgB,cAA0D,KAOpD;CACpB,MAAM,EAAE,KAAK,GAAG,SAAS;AACzB,KAAI,CAAC,IAAK,QAAO;AACjB,QAAO;EACL,GAAG;EACH,MAAM,SAAS,IAAI;GAAE,QAAQ,KAAK;GAA0B,aAAa,KAAK;GAAa,CAAC;EAC7F"}
@@ -1,36 +0,0 @@
1
- require("./chunk-ByKO4r7w.cjs");
2
- //#region ../../internals/utils/src/cli/define.ts
3
- /** Returns a `CLIAdapter` with type inference. Pass a different adapter to `createCLI` to swap the CLI engine. */
4
- function defineCLIAdapter(adapter) {
5
- return adapter;
6
- }
7
- /**
8
- * Returns a `CommandDefinition` with typed `values` in `run()`.
9
- * The callback receives `values` typed from the declared options — no casts needed.
10
- */
11
- function defineCommand(def) {
12
- const { run, ...rest } = def;
13
- if (!run) return rest;
14
- return {
15
- ...rest,
16
- run: (args) => run({
17
- values: args.values,
18
- positionals: args.positionals
19
- })
20
- };
21
- }
22
- //#endregion
23
- Object.defineProperty(exports, "defineCLIAdapter", {
24
- enumerable: true,
25
- get: function() {
26
- return defineCLIAdapter;
27
- }
28
- });
29
- Object.defineProperty(exports, "defineCommand", {
30
- enumerable: true,
31
- get: function() {
32
- return defineCommand;
33
- }
34
- });
35
-
36
- //# sourceMappingURL=define-D6Kfm7-Z.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"define-D6Kfm7-Z.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/** Infers typed values from an options record. Options with a `default` or `required: true` are always defined. */\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/** Returns a `CLIAdapter` with type inference. Pass a different adapter to `createCLI` to swap the CLI engine. */\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` typed from the declared options — no casts needed.\n */\nexport function defineCommand<O extends Record<string, OptionDefinition>>(def: {\n name: string\n description: string\n arguments?: 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) => run({ values: args.values as InferValues<O>, positionals: args.positionals }),\n }\n}\n"],"mappings":";;;AAcA,SAAgB,iBAAiB,SAAiC;AAChE,QAAO;;;;;;AAOT,SAAgB,cAA0D,KAOpD;CACpB,MAAM,EAAE,KAAK,GAAG,SAAS;AACzB,KAAI,CAAC,IAAK,QAAO;AACjB,QAAO;EACL,GAAG;EACH,MAAM,SAAS,IAAI;GAAE,QAAQ,KAAK;GAA0B,aAAa,KAAK;GAAa,CAAC;EAC7F"}
@@ -1,27 +0,0 @@
1
- import "./chunk--u3MIqq1.js";
2
- //#region ../../internals/utils/src/errors.ts
3
- /**
4
- * Coerces an unknown thrown value to an `Error` instance.
5
- * When the value is already an `Error` it is returned as-is;
6
- * otherwise a new `Error` is created whose message is `String(value)`.
7
- */
8
- function toError(value) {
9
- return value instanceof Error ? value : new Error(String(value));
10
- }
11
- /**
12
- * Safely extracts a human-readable message from any thrown value.
13
- */
14
- function getErrorMessage(value) {
15
- return value instanceof Error ? value.message : String(value);
16
- }
17
- /**
18
- * Extracts the `.cause` of an `Error` as an `Error | undefined`.
19
- * Returns `undefined` when the cause is absent or is not an `Error`.
20
- */
21
- function toCause(error) {
22
- return error.cause instanceof Error ? error.cause : void 0;
23
- }
24
- //#endregion
25
- export { toCause as n, toError as r, getErrorMessage as t };
26
-
27
- //# sourceMappingURL=errors-6mF_WKxg.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors-6mF_WKxg.js","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/** Thrown when a plugin's configuration or input fails validation. */\nexport class ValidationPluginError extends Error {}\n\n/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\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 * When the value is already an `Error` it is returned as-is;\n * otherwise a new `Error` is created whose message is `String(value)`.\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Safely extracts a human-readable message from any thrown value.\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 | undefined`.\n * Returns `undefined` when the cause is absent or is not an `Error`.\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;AAsBA,SAAgB,QAAQ,OAAuB;AAC7C,QAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;AAMlE,SAAgB,gBAAgB,OAAwB;AACtD,QAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;AAO/D,SAAgB,QAAQ,OAAiC;AACvD,QAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors-DBW0N9w4.cjs","names":[],"sources":["../../../internals/utils/src/errors.ts"],"sourcesContent":["/** Thrown when a plugin's configuration or input fails validation. */\nexport class ValidationPluginError extends Error {}\n\n/**\n * Thrown when one or more errors occur during a Kubb build.\n * Carries the full list of underlying errors on `errors`.\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 * When the value is already an `Error` it is returned as-is;\n * otherwise a new `Error` is created whose message is `String(value)`.\n */\nexport function toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value))\n}\n\n/**\n * Safely extracts a human-readable message from any thrown value.\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 | undefined`.\n * Returns `undefined` when the cause is absent or is not an `Error`.\n */\nexport function toCause(error: Error): Error | undefined {\n return error.cause instanceof Error ? error.cause : undefined\n}\n"],"mappings":";;;;;;;AAsBA,SAAgB,QAAQ,OAAuB;AAC7C,QAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;AAMlE,SAAgB,gBAAgB,OAAwB;AACtD,QAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;AAO/D,SAAgB,QAAQ,OAAiC;AACvD,QAAO,MAAM,iBAAiB,QAAQ,MAAM,QAAQ,KAAA"}