@kubb/cli 4.12.4 → 4.12.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"validate-Dn6hZ7Z4.cjs","names":["jiti","mod: any"],"sources":["../src/commands/validate.ts"],"sourcesContent":["import process from 'node:process'\nimport type { ArgsDef, ParsedArgs } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport { createJiti } from 'jiti'\n\nconst jiti = createJiti(import.meta.url, {\n sourceMaps: true,\n})\n\nconst args = {\n input: {\n type: 'string',\n description: 'Path to Swagger/OpenAPI file',\n alias: 'i',\n },\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nexport type Args = ParsedArgs<typeof args>\n\nconst command = defineCommand({\n meta: {\n name: 'validate',\n description: 'Validate a Swagger/OpenAPI file',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n if (args.help) {\n return showUsage(command)\n }\n\n if (args.input) {\n let mod: any\n try {\n mod = await jiti.import('@kubb/oas', { default: true })\n } catch (_e) {\n console.error(`Import of '@kubb/oas' is required to do validation`)\n }\n\n const { parse } = mod\n try {\n const oas = await parse(args.input)\n await oas.valdiate()\n\n console.log('✅ Validation success')\n } catch (e) {\n console.error('❌ Validation failed')\n console.log((e as Error)?.message)\n process.exit(1)\n }\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;;AAKA,MAAMA,6EAAmC,EACvC,YAAY,MACb,CAAC;AAkBF,MAAM,mCAAwB;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MArBW;EACX,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACF;CAUC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,6BAAiB,QAAQ;AAG3B,MAAI,KAAK,OAAO;GACd,IAAIC;AACJ,OAAI;AACF,UAAM,MAAMD,OAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;YAChD,IAAI;AACX,YAAQ,MAAM,qDAAqD;;GAGrE,MAAM,EAAE,UAAU;AAClB,OAAI;AAEF,WADY,MAAM,MAAM,KAAK,MAAM,EACzB,UAAU;AAEpB,YAAQ,IAAI,uBAAuB;YAC5B,GAAG;AACV,YAAQ,MAAM,sBAAsB;AACpC,YAAQ,IAAK,GAAa,QAAQ;AAClC,yBAAQ,KAAK,EAAE;;;;CAItB,CAAC;AAEF,uBAAe"}
1
+ {"version":3,"file":"validate-D9LPzg3-.cjs","names":["jiti","mod: any"],"sources":["../src/commands/validate.ts"],"sourcesContent":["import process from 'node:process'\nimport type { ArgsDef, ParsedArgs } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport { createJiti } from 'jiti'\n\nconst jiti = createJiti(import.meta.url, {\n sourceMaps: true,\n})\n\nconst args = {\n input: {\n type: 'string',\n description: 'Path to Swagger/OpenAPI file',\n alias: 'i',\n },\n help: {\n type: 'boolean',\n description: 'Show help',\n alias: 'h',\n default: false,\n },\n} as const satisfies ArgsDef\n\nexport type Args = ParsedArgs<typeof args>\n\nconst command = defineCommand({\n meta: {\n name: 'validate',\n description: 'Validate a Swagger/OpenAPI file',\n },\n args,\n async run(commandContext) {\n const { args } = commandContext\n\n if (args.help) {\n return showUsage(command)\n }\n\n if (args.input) {\n let mod: any\n try {\n mod = await jiti.import('@kubb/oas', { default: true })\n } catch (_e) {\n console.error(`Import of '@kubb/oas' is required to do validation`)\n }\n\n const { parse } = mod\n try {\n const oas = await parse(args.input)\n await oas.valdiate()\n\n console.log('✅ Validation success')\n } catch (error) {\n console.error('❌ Validation failed')\n console.log((error as Error)?.message)\n process.exit(1)\n }\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;;AAKA,MAAMA,6EAAmC,EACvC,YAAY,MACb,CAAC;AAkBF,MAAM,mCAAwB;CAC5B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MArBW;EACX,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;GACV;EACF;CAUC,MAAM,IAAI,gBAAgB;EACxB,MAAM,EAAE,SAAS;AAEjB,MAAI,KAAK,KACP,6BAAiB,QAAQ;AAG3B,MAAI,KAAK,OAAO;GACd,IAAIC;AACJ,OAAI;AACF,UAAM,MAAMD,OAAK,OAAO,aAAa,EAAE,SAAS,MAAM,CAAC;YAChD,IAAI;AACX,YAAQ,MAAM,qDAAqD;;GAGrE,MAAM,EAAE,UAAU;AAClB,OAAI;AAEF,WADY,MAAM,MAAM,KAAK,MAAM,EACzB,UAAU;AAEpB,YAAQ,IAAI,uBAAuB;YAC5B,OAAO;AACd,YAAQ,MAAM,sBAAsB;AACpC,YAAQ,IAAK,OAAiB,QAAQ;AACtC,yBAAQ,KAAK,EAAE;;;;CAItB,CAAC;AAEF,uBAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/cli",
3
- "version": "4.12.4",
3
+ "version": "4.12.6",
4
4
  "description": "Command-line interface for Kubb, enabling easy generation of TypeScript, React-Query, Zod, and other code from OpenAPI specifications.",
5
5
  "keywords": [
6
6
  "cli",
@@ -62,14 +62,14 @@
62
62
  "seedrandom": "^3.0.5",
63
63
  "semver": "^7.7.3",
64
64
  "string-argv": "^0.3.2",
65
- "@kubb/core": "4.12.4"
65
+ "@kubb/core": "4.12.6"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/seedrandom": "^3.0.8",
69
69
  "@types/semver": "^7.7.1",
70
70
  "source-map-support": "^0.5.21",
71
- "@kubb/mcp": "4.12.4",
72
- "@kubb/oas": "4.12.4"
71
+ "@kubb/mcp": "4.12.6",
72
+ "@kubb/oas": "4.12.6"
73
73
  },
74
74
  "engines": {
75
75
  "node": ">=20"
@@ -134,8 +134,8 @@ const command = defineCommand({
134
134
  await promiseManager.run('seq', promises)
135
135
 
136
136
  await events.emit('lifecycle:end')
137
- } catch (e) {
138
- await events.emit('error', e as Error)
137
+ } catch (error) {
138
+ await events.emit('error', error as Error)
139
139
  }
140
140
  },
141
141
  })
@@ -43,8 +43,8 @@ const command = defineCommand({
43
43
  console.log('⏳ Starting MCP server...')
44
44
  console.warn(pc.yellow('This feature is still under development — use with caution'))
45
45
  await startServer()
46
- } catch (e) {
47
- console.error((e as Error)?.message)
46
+ } catch (error) {
47
+ console.error((error as Error)?.message)
48
48
  }
49
49
  },
50
50
  })
@@ -50,9 +50,9 @@ const command = defineCommand({
50
50
  await oas.valdiate()
51
51
 
52
52
  console.log('✅ Validation success')
53
- } catch (e) {
53
+ } catch (error) {
54
54
  console.error('❌ Validation failed')
55
- console.log((e as Error)?.message)
55
+ console.log((error as Error)?.message)
56
56
  process.exit(1)
57
57
  }
58
58
  }
@@ -125,8 +125,8 @@ export async function generate({ input, config, events, logLevel }: GenerateProp
125
125
  )
126
126
  },
127
127
  )
128
- } catch (e) {
129
- await events.emit('error', e as Error)
128
+ } catch (caughtError) {
129
+ await events.emit('error', caughtError as Error)
130
130
  }
131
131
 
132
132
  await events.emit('success', `Formatted with ${config.output.format}`)
@@ -153,9 +153,9 @@ export async function generate({ input, config, events, logLevel }: GenerateProp
153
153
  )
154
154
  },
155
155
  )
156
- } catch (e) {
156
+ } catch (caughtError) {
157
157
  const error = new Error('Biome not found')
158
- error.cause = e
158
+ error.cause = caughtError
159
159
  await events.emit('error', error)
160
160
  }
161
161
  }
@@ -198,9 +198,9 @@ export async function generate({ input, config, events, logLevel }: GenerateProp
198
198
  )
199
199
  },
200
200
  )
201
- } catch (e) {
201
+ } catch (caughtError) {
202
202
  const error = new Error('Eslint not found')
203
- error.cause = e
203
+ error.cause = caughtError
204
204
  await events.emit('error', error)
205
205
  }
206
206
  }
@@ -226,9 +226,9 @@ export async function generate({ input, config, events, logLevel }: GenerateProp
226
226
  )
227
227
  },
228
228
  )
229
- } catch (e) {
229
+ } catch (caughtError) {
230
230
  const error = new Error('Biome not found')
231
- error.cause = e
231
+ error.cause = caughtError
232
232
  await events.emit('error', error)
233
233
  }
234
234
  }
@@ -254,9 +254,9 @@ export async function generate({ input, config, events, logLevel }: GenerateProp
254
254
  )
255
255
  },
256
256
  )
257
- } catch (e) {
257
+ } catch (caughtError) {
258
258
  const error = new Error('Oxlint not found')
259
- error.cause = e
259
+ error.cause = caughtError
260
260
  await events.emit('error', error)
261
261
  }
262
262
  }
@@ -59,8 +59,8 @@ export async function getCosmiConfig(moduleName: string, config?: string): Promi
59
59
 
60
60
  try {
61
61
  result = config ? ((await explorer.load(config)) as CosmiconfigResult) : ((await explorer.search()) as CosmiconfigResult)
62
- } catch (e) {
63
- throw new Error('Config failed loading', { cause: e })
62
+ } catch (error) {
63
+ throw new Error('Config failed loading', { cause: error })
64
64
  }
65
65
 
66
66
  if (result?.isEmpty || !result || !result.config) {
@@ -1 +0,0 @@
1
- {"version":3,"file":"package-DI-gizpt.cjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1,6 +0,0 @@
1
- //#region package.json
2
- var version = "4.12.4";
3
-
4
- //#endregion
5
- export { version as t };
6
- //# sourceMappingURL=package-GRapUKbG.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package-GRapUKbG.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}