@kubb/cli 5.0.0-alpha.3 → 5.0.0-alpha.31

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 (99) hide show
  1. package/dist/{agent-EkZmkNy6.cjs → agent-BB0QeA15.cjs} +5 -5
  2. package/dist/{agent-EkZmkNy6.cjs.map → agent-BB0QeA15.cjs.map} +1 -1
  3. package/dist/{agent-C0bAlvWn.js → agent-BVZM_vFr.js} +5 -5
  4. package/dist/{agent-C0bAlvWn.js.map → agent-BVZM_vFr.js.map} +1 -1
  5. package/dist/{agent-L50VNhXv.js → agent-DTyw-mt7.js} +4 -4
  6. package/dist/{agent-L50VNhXv.js.map → agent-DTyw-mt7.js.map} +1 -1
  7. package/dist/{agent-C6o_6GSJ.cjs → agent-DpzeyN1s.cjs} +4 -4
  8. package/dist/{agent-C6o_6GSJ.cjs.map → agent-DpzeyN1s.cjs.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-vf3X_h_u.js → generate-BG0VC_Ui.js} +203 -110
  22. package/dist/generate-BG0VC_Ui.js.map +1 -0
  23. package/dist/{generate-C0Lnz3VU.cjs → generate-Bsie7eRa.cjs} +202 -109
  24. package/dist/generate-Bsie7eRa.cjs.map +1 -0
  25. package/dist/{generate-B1et6yyL.cjs → generate-CJimoNEf.cjs} +3 -3
  26. package/dist/{generate-B1et6yyL.cjs.map → generate-CJimoNEf.cjs.map} +1 -1
  27. package/dist/{generate-DnmnwWSE.js → generate-CUi9CASV.js} +3 -3
  28. package/dist/{generate-DnmnwWSE.js.map → generate-CUi9CASV.js.map} +1 -1
  29. package/dist/index.cjs +49 -21
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.js +49 -21
  33. package/dist/index.js.map +1 -1
  34. package/dist/{init-CMu6JTPI.js → init-BR3GdRMJ.js} +4 -4
  35. package/dist/{init-CMu6JTPI.js.map → init-BR3GdRMJ.js.map} +1 -1
  36. package/dist/{init-hmolV6B4.cjs → init-BlriFVH6.cjs} +19 -4
  37. package/dist/init-BlriFVH6.cjs.map +1 -0
  38. package/dist/{init-BvVLmKcJ.cjs → init-CgARwpTl.cjs} +4 -4
  39. package/dist/{init-BvVLmKcJ.cjs.map → init-CgARwpTl.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-DPU081OK.cjs → mcp-ChTFDc4I.cjs} +4 -4
  43. package/dist/{mcp-DPU081OK.cjs.map → mcp-ChTFDc4I.cjs.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-ChHFPRzD.cjs → mcp-jMZ56bqT.cjs} +3 -3
  47. package/dist/{mcp-ChHFPRzD.cjs.map → mcp-jMZ56bqT.cjs.map} +1 -1
  48. package/dist/{mcp-BwXRVY1N.js → mcp-r-ZJNccL.js} +4 -4
  49. package/dist/{mcp-BwXRVY1N.js.map → mcp-r-ZJNccL.js.map} +1 -1
  50. package/dist/package-A_drmC2H.js +6 -0
  51. package/dist/package-A_drmC2H.js.map +1 -0
  52. package/dist/{package-BsZ_vsP1.cjs → package-NYSJaof-.cjs} +2 -2
  53. package/dist/package-NYSJaof-.cjs.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-BSaNWrhu.cjs → validate-BTUmWQOM.cjs} +4 -4
  65. package/dist/{validate-BSaNWrhu.cjs.map → validate-BTUmWQOM.cjs.map} +1 -1
  66. package/dist/{validate-l8vLmwKA.js → validate-CIS8nJdd.js} +3 -3
  67. package/dist/{validate-l8vLmwKA.js.map → validate-CIS8nJdd.js.map} +1 -1
  68. package/dist/{validate--6d6ZZTO.js → validate-CyJP7vy1.js} +4 -4
  69. package/dist/{validate--6d6ZZTO.js.map → validate-CyJP7vy1.js.map} +1 -1
  70. package/package.json +6 -6
  71. package/src/constants.ts +57 -10
  72. package/src/index.ts +10 -12
  73. package/src/loggers/clackLogger.ts +30 -22
  74. package/src/loggers/fileSystemLogger.ts +3 -1
  75. package/src/runners/generate.ts +37 -44
  76. package/src/types.ts +11 -0
  77. package/src/utils/flags.ts +10 -0
  78. package/src/utils/getCosmiConfig.ts +6 -0
  79. package/dist/constants-BTUap0zs.cjs.map +0 -1
  80. package/dist/constants-CM3dJzjK.js.map +0 -1
  81. package/dist/define--M_JMcDC.js +0 -25
  82. package/dist/define--M_JMcDC.js.map +0 -1
  83. package/dist/define-D6Kfm7-Z.cjs +0 -36
  84. package/dist/define-D6Kfm7-Z.cjs.map +0 -1
  85. package/dist/errors-6mF_WKxg.js +0 -27
  86. package/dist/errors-6mF_WKxg.js.map +0 -1
  87. package/dist/errors-DBW0N9w4.cjs.map +0 -1
  88. package/dist/generate-C0Lnz3VU.cjs.map +0 -1
  89. package/dist/generate-vf3X_h_u.js.map +0 -1
  90. package/dist/init-C-InrmSY.js.map +0 -1
  91. package/dist/init-hmolV6B4.cjs.map +0 -1
  92. package/dist/package-BsZ_vsP1.cjs.map +0 -1
  93. package/dist/package-iZbDdtad.js +0 -6
  94. package/dist/package-iZbDdtad.js.map +0 -1
  95. package/dist/shell-7HPrTCJ5.cjs.map +0 -1
  96. package/dist/shell-DqqWsHCD.js.map +0 -1
  97. package/dist/telemetry-Cn9X1I5B.cjs.map +0 -1
  98. package/dist/telemetry-DxiR7clS.js.map +0 -1
  99. 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', () => {
@@ -50,7 +50,9 @@ export const fileSystemLogger = defineLogger({
50
50
  }
51
51
  }
52
52
 
53
- await Promise.all(Object.entries(files).map(([fileName, logs]) => write(fileName, logs.join('\n\n'))))
53
+ for (const [fileName, logs] of Object.entries(files)) {
54
+ await write(fileName, logs.join('\n\n'))
55
+ }
54
56
 
55
57
  return Object.keys(files)
56
58
  }
@@ -16,9 +16,9 @@ import {
16
16
  type KubbEvents,
17
17
  linters,
18
18
  logLevel as logLevelMap,
19
- PromiseManager,
20
19
  safeBuild,
21
20
  setup,
21
+ type UserConfig,
22
22
  } from '@kubb/core'
23
23
  import { version } from '../../package.json'
24
24
  import { KUBB_NPM_PACKAGE_URL } from '../constants.ts'
@@ -39,7 +39,7 @@ type ToolMap = typeof formatters | typeof linters
39
39
 
40
40
  type RunToolPassOptions = {
41
41
  toolValue: string
42
- detect: () => Promise<string | undefined>
42
+ detect: () => Promise<string | null>
43
43
  toolMap: ToolMap
44
44
  /** Short noun used in "Auto-detected <toolLabel>:" message, e.g. "formatter" or "linter". */
45
45
  toolLabel: string
@@ -81,6 +81,8 @@ async function runToolPass({
81
81
  }
82
82
  }
83
83
 
84
+ let toolError: Error | undefined
85
+
84
86
  if (resolvedTool && resolvedTool !== 'auto' && resolvedTool in toolMap) {
85
87
  const toolConfig = toolMap[resolvedTool as keyof ToolMap]
86
88
 
@@ -125,45 +127,43 @@ async function runToolPass({
125
127
  const err = new Error(toolConfig.errorMessage)
126
128
  err.cause = caughtError
127
129
  await events.emit('error', err)
130
+ toolError = err
128
131
  }
129
132
  }
130
133
 
131
134
  await onEnd()
135
+
136
+ if (toolError) {
137
+ throw toolError
138
+ }
132
139
  }
133
140
 
134
- async function generate({ input, config: userConfig, events, logLevel }: GenerateProps): Promise<void> {
135
- const inputPath = input ?? ('path' in userConfig.input ? userConfig.input.path : undefined)
141
+ async function generate(options: GenerateProps): Promise<void> {
142
+ const { input, events, logLevel } = options
143
+
136
144
  const hrStart = process.hrtime()
145
+ const inputPath = input ?? ('path' in options.config.input ? options.config.input.path : undefined)
137
146
 
138
- const config: Config = {
139
- ...userConfig,
140
- root: userConfig.root || process.cwd(),
147
+ const userConfig: UserConfig = {
148
+ ...options.config,
141
149
  input: inputPath
142
150
  ? {
143
- ...userConfig.input,
151
+ ...options.config.input,
144
152
  path: inputPath,
145
153
  }
146
- : userConfig.input,
147
- output: {
148
- write: true,
149
- barrelType: 'named',
150
- extension: {
151
- '.ts': '.ts',
152
- },
153
- format: 'prettier',
154
- ...userConfig.output,
155
- },
156
- }
154
+ : options.config.input,
155
+ ...options.config.output,
156
+ } satisfies UserConfig
157
+
158
+ const { sources, fabric, driver, config } = await setup({
159
+ config: userConfig,
160
+ events,
161
+ })
157
162
 
158
163
  await events.emit('generation:start', config)
159
164
 
160
165
  await events.emit('info', config.name ? `Setup generation ${styleText('bold', config.name)}` : 'Setup generation', inputPath)
161
166
 
162
- const { sources, fabric, pluginManager } = await setup({
163
- config,
164
- events,
165
- })
166
-
167
167
  await events.emit('info', config.name ? `Build generation ${styleText('bold', config.name)}` : 'Build generation', inputPath)
168
168
 
169
169
  const { files, failedPlugins, pluginTimings, error } = await safeBuild(
@@ -171,7 +171,7 @@ async function generate({ input, config: userConfig, events, logLevel }: Generat
171
171
  config,
172
172
  events,
173
173
  },
174
- { pluginManager, fabric, events, sources },
174
+ { driver, fabric, events, sources, config },
175
175
  )
176
176
 
177
177
  await events.emit('info', 'Load summary')
@@ -206,7 +206,7 @@ async function generate({ input, config: userConfig, events, logLevel }: Generat
206
206
  buildTelemetryEvent({
207
207
  command: 'generate',
208
208
  kubbVersion: version,
209
- plugins: pluginManager.plugins.map((p) => ({ name: p.name, options: p.options as Record<string, unknown> })),
209
+ plugins: Array.from(driver.plugins.values(), (p) => ({ name: p.name, options: p.options as Record<string, unknown> })),
210
210
  hrStart,
211
211
  filesCreated: files.length,
212
212
  status: 'failed',
@@ -274,7 +274,7 @@ async function generate({ input, config: userConfig, events, logLevel }: Generat
274
274
  const telemetryEvent = buildTelemetryEvent({
275
275
  command: 'generate',
276
276
  kubbVersion: version,
277
- plugins: pluginManager.plugins.map((p) => ({ name: p.name, options: p.options as Record<string, unknown> })),
277
+ plugins: Array.from(driver.plugins.values(), (p) => ({ name: p.name, options: p.options as Record<string, unknown> })),
278
278
  hrStart,
279
279
  filesCreated: files.length,
280
280
  status: 'success',
@@ -293,7 +293,6 @@ type GenerateCommandOptions = {
293
293
  export async function runGenerateCommand({ input, configPath, logLevel: logLevelKey, watch }: GenerateCommandOptions): Promise<void> {
294
294
  const logLevel = logLevelMap[logLevelKey as keyof typeof logLevelMap] ?? logLevelMap.info
295
295
  const events = new AsyncEventEmitterClass<KubbEvents>()
296
- const promiseManager = new PromiseManager()
297
296
 
298
297
  await setupLogger(events, { logLevel })
299
298
 
@@ -322,26 +321,20 @@ export async function runGenerateCommand({ input, configPath, logLevel: logLevel
322
321
 
323
322
  await events.emit('lifecycle:start', version)
324
323
 
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()
324
+ for (const config of configs) {
325
+ if (isInputPath(config) && watch) {
326
+ await startWatcher([input || config.input.path], async (paths) => {
327
+ // remove to avoid duplicate listeners after each change
328
+ events.removeAll()
331
329
 
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
- }
330
+ await generate({ input, config, logLevel, events })
339
331
 
332
+ clack.log.step(styleText('yellow', `Watching for changes in ${paths.join(' and ')}`))
333
+ })
334
+ } else {
340
335
  await generate({ input, config, logLevel, events })
341
336
  }
342
- })
343
-
344
- await promiseManager.run('seq', promises)
337
+ }
345
338
 
346
339
  await events.emit('lifecycle:end')
347
340
  } 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"}