@kubb/cli 3.17.1 → 3.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{generate-DAJRIO7l.js → generate-B5KogiFG.js} +64 -1
- package/dist/{generate-DAJRIO7l.js.map → generate-B5KogiFG.js.map} +1 -1
- package/dist/{generate-AG4UwoYw.cjs → generate-Cj0UETd1.cjs} +2 -2
- package/dist/generate-Cj0UETd1.cjs.map +1 -0
- package/dist/{generate-TqAvum5c.cjs → generate-Cod5_RqJ.cjs} +96 -33
- package/dist/generate-Cod5_RqJ.cjs.map +1 -0
- package/dist/{generate-6jcPLg_V.js → generate-x9u4GHvt.js} +2 -2
- package/dist/generate-x9u4GHvt.js.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/runners/generate.ts +70 -0
- package/src/utils/getCosmiConfig.ts +1 -2
- package/dist/generate-6jcPLg_V.js.map +0 -1
- package/dist/generate-AG4UwoYw.cjs.map +0 -1
- package/dist/generate-TqAvum5c.cjs.map +0 -1
|
@@ -178,7 +178,7 @@ const command = defineCommand({
|
|
|
178
178
|
if (args$1.debug) args$1.logLevel = "debug";
|
|
179
179
|
const logLevel = LogMapper[args$1.logLevel] || 3;
|
|
180
180
|
const logger = createLogger({ logLevel });
|
|
181
|
-
const { generate } = await import("./generate-
|
|
181
|
+
const { generate } = await import("./generate-B5KogiFG.js");
|
|
182
182
|
logger.emit("start", "Loading config");
|
|
183
183
|
const result = await getCosmiConfig("kubb", args$1.config);
|
|
184
184
|
logger.emit("success", `Config loaded(${pc.dim(path.relative(process$1.cwd(), result.filepath))})`);
|
|
@@ -250,4 +250,4 @@ const command = defineCommand({
|
|
|
250
250
|
|
|
251
251
|
//#endregion
|
|
252
252
|
export { command as default };
|
|
253
|
-
//# sourceMappingURL=generate-
|
|
253
|
+
//# sourceMappingURL=generate-x9u4GHvt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-x9u4GHvt.js","names":["args","results: Array<Config>","path","args","process"],"sources":["../src/utils/getPlugins.ts","../src/utils/getConfig.ts","../src/utils/getCosmiConfig.ts","../src/utils/watcher.ts","../src/commands/generate.ts"],"sourcesContent":["import type { UserConfig } from '@kubb/core'\n\nfunction isJSONPlugins(plugins: UserConfig['plugins']) {\n return !!(plugins as any)?.some((plugin: any) => {\n return Array.isArray(plugin) && typeof plugin?.at(0) === 'string'\n })\n}\n\nfunction isObjectPlugins(plugins: UserConfig['plugins']): plugins is any {\n return plugins instanceof Object && !Array.isArray(plugins)\n}\n\nexport function getPlugins(plugins: UserConfig['plugins']): Promise<UserConfig['plugins']> {\n if (isObjectPlugins(plugins)) {\n throw new Error('Object plugins are not supported anymore, best to use http://kubb.dev/getting-started/configure#json')\n }\n\n if (isJSONPlugins(plugins)) {\n throw new Error('JSON plugins are not supported anymore, best to use http://kubb.dev/getting-started/configure#json')\n }\n\n return Promise.resolve(plugins)\n}\n","import { isPromise } from '@kubb/core/utils'\n\nimport { getPlugins } from './getPlugins.ts'\n\nimport type { Config, UserConfig } from '@kubb/core'\nimport type { Args } from '../commands/generate.ts'\nimport type { CosmiconfigResult } from './getCosmiConfig.ts'\n\n/**\n * Converting UserConfig to Config without a change in the object beside the JSON convert.\n */\nexport async function getConfig(result: CosmiconfigResult, args: Args): Promise<Array<Config> | Config> {\n const config = result?.config\n let kubbUserConfig = Promise.resolve(config) as Promise<UserConfig | Array<UserConfig>>\n\n // for ts or js files\n if (typeof config === 'function') {\n const possiblePromise = config(args)\n if (isPromise(possiblePromise)) {\n kubbUserConfig = possiblePromise\n }\n kubbUserConfig = Promise.resolve(possiblePromise)\n }\n\n let JSONConfig = await kubbUserConfig\n\n if (Array.isArray(JSONConfig)) {\n const results: Array<Config> = []\n\n for (const item of JSONConfig) {\n const plugins = item.plugins ? await getPlugins(item.plugins) : undefined\n\n results.push({\n ...item,\n plugins,\n } as Config)\n }\n\n return results\n }\n\n JSONConfig = {\n ...JSONConfig,\n plugins: JSONConfig.plugins ? await getPlugins(JSONConfig.plugins) : undefined,\n }\n\n return JSONConfig as Config\n}\n","import type { defineConfig, UserConfig } from '@kubb/core'\nimport { cosmiconfig } from 'cosmiconfig'\nimport { createJiti } from 'jiti'\n\nexport type CosmiconfigResult = {\n filepath: string\n isEmpty?: boolean\n config: ReturnType<typeof defineConfig> | UserConfig\n}\n\nconst tsLoader = async (configFile: string) => {\n const jiti = createJiti(import.meta.url, {\n jsx: {\n runtime: 'automatic',\n importSource: '@kubb/react',\n },\n sourceMaps: true,\n })\n\n const mod = await jiti.import(configFile, { default: true })\n\n return mod\n}\n\nexport async function getCosmiConfig(moduleName: string, config?: string): Promise<CosmiconfigResult> {\n const searchPlaces = [\n 'package.json',\n `.${moduleName}rc`,\n `.${moduleName}rc.json`,\n `.${moduleName}rc.yaml`,\n `.${moduleName}rc.yml`,\n\n `.${moduleName}rc.ts`,\n `.${moduleName}rc.js`,\n `.${moduleName}rc.mjs`,\n `.${moduleName}rc.cjs`,\n\n `${moduleName}.config.ts`,\n `${moduleName}.config.js`,\n `${moduleName}.config.mjs`,\n `${moduleName}.config.cjs`,\n ]\n const explorer = cosmiconfig(moduleName, {\n cache: false,\n searchPlaces: [\n ...searchPlaces.map((searchPlace) => {\n return `.config/${searchPlace}`\n }),\n ...searchPlaces.map((searchPlace) => {\n return `configs/${searchPlace}`\n }),\n ...searchPlaces,\n ],\n loaders: {\n '.ts': tsLoader,\n },\n })\n\n const result = config ? await explorer.load(config) : await explorer.search()\n\n if (result?.isEmpty || !result || !result.config) {\n throw new Error('Config not defined, create a kubb.config.js or pass through your config with the option --config')\n }\n\n return result as CosmiconfigResult\n}\n","import { createLogger } from '@kubb/core/logger'\nimport pc from 'picocolors'\n\nexport async function startWatcher(path: string[], cb: (path: string[]) => Promise<void>): Promise<void> {\n const { watch } = await import('chokidar')\n const logger = createLogger()\n\n const ignored = '**/{.git,node_modules}/**'\n\n const watcher = watch(path, {\n ignorePermissionErrors: true,\n ignored,\n })\n watcher.on('all', (type, file) => {\n logger?.emit('info', pc.yellow(pc.bold(`Change detected: ${type} ${file}`)))\n\n try {\n cb(path)\n } catch (_e) {\n logger?.emit('warning', pc.red('Watcher failed'))\n }\n })\n}\n","import path from 'node:path'\nimport * as process from 'node:process'\nimport { isInputPath, PromiseManager } from '@kubb/core'\nimport { createLogger, LogMapper } from '@kubb/core/logger'\nimport type { ArgsDef, ParsedArgs } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport type { SingleBar } from 'cli-progress'\nimport open from 'open'\nimport pc from 'picocolors'\nimport { getConfig } from '../utils/getConfig.ts'\nimport { getCosmiConfig } from '../utils/getCosmiConfig.ts'\nimport { startWatcher } from '../utils/watcher.ts'\n\ndeclare global {\n var isDevtoolsEnabled: any\n}\n\nconst args = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n alias: 'c',\n },\n logLevel: {\n type: 'string',\n description: 'Info, silent or debug',\n alias: 'l',\n default: 'info',\n valueHint: 'silent|info|debug',\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n alias: 'w',\n default: false,\n },\n debug: {\n type: 'boolean',\n description: 'Override logLevel to debug',\n alias: 'd',\n default: false,\n },\n ui: {\n type: 'boolean',\n description: 'Open ui',\n alias: 'u',\n default: false,\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: 'generate',\n description: \"[input] Generate files based on a 'kubb.config.ts' file\",\n },\n args,\n async run(commandContext) {\n let name = ''\n const progressCache = new Map<string, SingleBar>()\n\n const { args } = commandContext\n\n const input = args._[0]\n\n if (args.help) {\n return showUsage(command)\n }\n\n if (args.debug) {\n args.logLevel = 'debug'\n }\n\n const logLevel = LogMapper[args.logLevel as keyof typeof LogMapper] || 3\n const logger = createLogger({\n logLevel,\n })\n const { generate } = await import('../runners/generate.ts')\n\n logger.emit('start', 'Loading config')\n\n const result = await getCosmiConfig('kubb', args.config)\n logger.emit('success', `Config loaded(${pc.dim(path.relative(process.cwd(), result.filepath))})`)\n\n const config = await getConfig(result, args)\n\n const start = async () => {\n if (Array.isArray(config)) {\n const promiseManager = new PromiseManager()\n const promises = config.map((c) => () => {\n name = c.name || ''\n progressCache.clear()\n\n return generate({\n input,\n config: c,\n args,\n progressCache,\n })\n })\n\n await promiseManager.run('seq', promises)\n return\n }\n\n progressCache.clear()\n\n await generate({\n input,\n config,\n progressCache,\n args,\n })\n\n return\n }\n\n if (args.ui) {\n const { startServer } = await import('@kubb/ui')\n\n await startServer(\n {\n stop: () => process.exit(1),\n restart: () => start(),\n getMeta: () => {\n const entries = [...progressCache.entries()]\n\n const percentages = entries.reduce(\n (acc, [key, singleBar]) => {\n acc[key] = singleBar.getProgress()\n\n return acc\n },\n {} as Record<string, number>,\n )\n\n return {\n name,\n percentages,\n }\n },\n },\n (info) => {\n const url = `${info.address}:${info.port}`.replace('::', 'http://localhost')\n logger.consola?.start(`Starting ui on ${url}`)\n\n open(url)\n },\n )\n }\n\n if (args.watch) {\n if (Array.isArray(config)) {\n throw new Error('Cannot use watcher with multiple Configs(array)')\n }\n\n if (isInputPath(config)) {\n return startWatcher([input || config.input.path], async (paths) => {\n await start()\n logger.emit('start', pc.yellow(pc.bold(`Watching for changes in ${paths.join(' and ')}`)))\n })\n }\n }\n\n await start()\n\n if (globalThis.isDevtoolsEnabled) {\n const canRestart = await logger.consola?.prompt('Restart(could be used to validate the profiler)?', {\n type: 'confirm',\n initial: false,\n })\n\n if (canRestart) {\n await start()\n } else {\n process.exit(1)\n }\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;;;;;;;AAEA,SAAS,cAAc,SAAgC;AACrD,QAAO,CAAC,CAAE,SAAiB,MAAM,WAAgB;AAC/C,SAAO,MAAM,QAAQ,WAAW,OAAO,QAAQ,G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AM;AACzD,WAAO,SAAS,MAAM,kBAAkB;AAExC,SAAK;GACN;EAEJ;AAED,MAAID,OAAK,OAAO;AACd,OAAI,MAAM,QAAQ,QAChB,OAAM,IAAI,MAAM;AAGlB,OAAI,YAAY,QACd,QAAO,aAAa,CAAC,SAAS,OAAO,MAAM,KAAK,EAAE,OAAO,UAAU;AACjE,UAAM;AACN,WAAO,KAAK,SAAS,GAAG,OAAO,GAAG,KAAK,2BAA2B,MAAM,KAAK;GAC9E;EAEJ;AAED,QAAM;AAEN,MAAI,WAAW,mBAAmB;GAChC,MAAM,aAAa,MAAM,OAAO,SAAS,OAAO,oDAAoD;IAClG,MAAM;IACN,SAAS;IACV;AAED,OAAI,WACF,OAAM;OAEN,WAAQ,KAAK;EAEhB;CACF;CACF"}
|
package/dist/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ const latest_version = require_chunk.__toESM(require("latest-version"));
|
|
|
6
6
|
const semver = require_chunk.__toESM(require("semver"));
|
|
7
7
|
|
|
8
8
|
//#region package.json
|
|
9
|
-
var version = "3.
|
|
9
|
+
var version = "3.18.1";
|
|
10
10
|
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/index.ts
|
|
@@ -42,13 +42,13 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
42
42
|
"mcp"
|
|
43
43
|
].includes(rawArgs[0])) {
|
|
44
44
|
console.log(rawArgs[0]);
|
|
45
|
-
const generateCommand = await Promise.resolve().then(() => require("./generate-
|
|
45
|
+
const generateCommand = await Promise.resolve().then(() => require("./generate-Cj0UETd1.cjs")).then((r) => r.default);
|
|
46
46
|
await (0, citty.runCommand)(generateCommand, { rawArgs });
|
|
47
47
|
process.exit(0);
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
subCommands: {
|
|
51
|
-
generate: () => Promise.resolve().then(() => require("./generate-
|
|
51
|
+
generate: () => Promise.resolve().then(() => require("./generate-Cj0UETd1.cjs")).then((r) => r.default),
|
|
52
52
|
validate: () => Promise.resolve().then(() => require("./validate-C4qulXfo.cjs")).then((r) => r.default),
|
|
53
53
|
mcp: () => Promise.resolve().then(() => require("./mcp--yznP2uc.cjs")).then((r) => r.default)
|
|
54
54
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../package.json","../src/index.ts"],"sourcesContent":["{\n \"name\": \"@kubb/cli\",\n \"version\": \"3.
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../package.json","../src/index.ts"],"sourcesContent":["{\n \"name\": \"@kubb/cli\",\n \"version\": \"3.18.1\",\n \"description\": \"Command-line interface for Kubb, enabling easy generation of TypeScript, React-Query, Zod, and other code from OpenAPI specifications.\",\n \"keywords\": [\n \"cli\",\n \"command-line\",\n \"typescript\",\n \"openapi\",\n \"swagger\",\n \"code-generator\",\n \"codegen\",\n \"plugins\",\n \"kubb\"\n ],\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/kubb-labs/kubb.git\",\n \"directory\": \"packages/cli\"\n },\n \"license\": \"MIT\",\n \"author\": \"stijnvanhulle\",\n \"sideEffects\": false,\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.cts\",\n \"bin\": {\n \"kubb\": \"bin/kubb.cjs\"\n },\n \"files\": [\n \"src\",\n \"dist\",\n \"bin\",\n \"!/**/**.test.**\",\n \"!/**/__tests__/**\"\n ],\n \"scripts\": {\n \"build\": \"tsdown\",\n \"clean\": \"npx rimraf ./dist\",\n \"lint\": \"bun biome lint .\",\n \"lint:fix\": \"bun biome lint --fix --unsafe .\",\n \"release\": \"pnpm publish --no-git-check\",\n \"release:canary\": \"bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check\",\n \"start\": \"tsdown --watch\",\n \"test\": \"vitest --passWithNoTests\",\n \"typecheck\": \"tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false\"\n },\n \"dependencies\": {\n \"@kubb/core\": \"workspace:*\",\n \"@kubb/ui\": \"workspace:*\",\n \"chokidar\": \"^4.0.3\",\n \"citty\": \"^0.1.6\",\n \"cli-progress\": \"^3.12.0\",\n \"consola\": \"^3.4.2\",\n \"cosmiconfig\": \"^9.0.0\",\n \"execa\": \"^9.6.0\",\n \"gradient-string\": \"^3.0.0\",\n \"jiti\": \"^2.5.1\",\n \"latest-version\": \"^9.0.0\",\n \"open\": \"^10.2.0\",\n \"picocolors\": \"^1.1.1\",\n \"semver\": \"^7.7.2\",\n \"string-argv\": \"^0.3.2\"\n },\n \"devDependencies\": {\n \"@kubb/config-ts\": \"workspace:*\",\n \"@kubb/mcp\": \"workspace:*\",\n \"@kubb/oas\": \"workspace:*\",\n \"@kubb/plugin-oas\": \"workspace:*\",\n \"@types/cli-progress\": \"^3.11.6\",\n \"@types/node\": \"catalog:\",\n \"@types/semver\": \"^7.7.0\",\n \"source-map-support\": \"^0.5.21\",\n \"tsdown\": \"catalog:\",\n \"typescript\": \"catalog:\"\n },\n \"engines\": {\n \"node\": \">=20\"\n },\n \"preferGlobal\": true,\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n }\n}\n","import { defineCommand, runCommand, runMain } from 'citty'\nimport consola from 'consola'\nimport { default as gradientString } from 'gradient-string'\nimport getLatestVersion from 'latest-version'\nimport { lt } from 'semver'\nimport { version } from '../package.json'\n\nconst name = 'kubb'\n\nconst main = defineCommand({\n meta: {\n name,\n version,\n description: 'Kubb generation',\n },\n async setup({ rawArgs }) {\n try {\n consola.log(gradientString(['#F58517', '#F5A217', '#F55A17'])('Kubb CLI:'))\n\n const latestVersion = await getLatestVersion('@kubb/cli')\n\n if (lt(version, latestVersion)) {\n consola.box({\n title: 'Update available for `Kubb` ',\n message: `\\`v${version}\\` → \\`v${latestVersion}\\`\nRun \\`npm install -g @kubb/cli\\` to update`,\n style: {\n padding: 2,\n borderColor: 'yellow',\n borderStyle: 'rounded',\n },\n })\n }\n } catch (_e) {}\n\n if (!['generate', 'validate', 'mcp'].includes(rawArgs[0] as string)) {\n console.log(rawArgs[0])\n // generate is not being used\n const generateCommand = await import('./commands/generate.ts').then((r) => r.default)\n\n await runCommand(generateCommand, { rawArgs })\n\n process.exit(0)\n }\n },\n subCommands: {\n generate: () => import('./commands/generate.ts').then((r) => r.default),\n validate: () => import('./commands/validate.ts').then((r) => r.default),\n mcp: () => import('./commands/mcp.ts').then((r) => r.default),\n },\n})\n\nexport async function run(_argv?: string[]): Promise<void> {\n await runMain(main)\n}\n"],"mappings":";;;;;;;;cAEa;;;;ACKb,MAAM,OAAO;AAEb,MAAM,gCAAqB;CACzB,MAAM;EACJ;EACA;EACA,aAAa;EACd;CACD,MAAM,MAAM,EAAE,SAAS,EAAE;AACvB,MAAI;AACF,mBAAQ,iCAAmB;IAAC;IAAW;IAAW;IAAU,EAAE;GAE9D,MAAM,gBAAgB,kCAAuB;AAE7C,sBAAO,SAAS,eACd,iBAAQ,IAAI;IACV,OAAO;IACP,SAAS,MAAM,QAAQ,UAAU,cAAc;;IAE/C,OAAO;KACL,SAAS;KACT,aAAa;KACb,aAAa;KACd;IACF;EAEJ,SAAQ,IAAI,CAAE;AAEf,MAAI,CAAC;GAAC;GAAY;GAAY;GAAM,CAAC,SAAS,QAAQ,KAAe;AACnE,WAAQ,IAAI,QAAQ;GAEpB,MAAM,kBAAkB,2CAAM,4BAAiC,MAAM,MAAM,EAAE;AAE7E,+BAAiB,iBAAiB,EAAE,SAAS;AAE7C,WAAQ,KAAK;EACd;CACF;CACD,aAAa;EACX,qDAAgB,4BAAiC,MAAM,MAAM,EAAE;EAC/D,qDAAgB,4BAAiC,MAAM,MAAM,EAAE;EAC/D,gDAAW,uBAA4B,MAAM,MAAM,EAAE;EACtD;CACF;AAED,eAAsB,IAAI,OAAiC;AACzD,0BAAc;AACf"}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import getLatestVersion from "latest-version";
|
|
|
5
5
|
import { lt } from "semver";
|
|
6
6
|
|
|
7
7
|
//#region package.json
|
|
8
|
-
var version = "3.
|
|
8
|
+
var version = "3.18.1";
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/index.ts
|
|
@@ -41,13 +41,13 @@ Run \`npm install -g @kubb/cli\` to update`,
|
|
|
41
41
|
"mcp"
|
|
42
42
|
].includes(rawArgs[0])) {
|
|
43
43
|
console.log(rawArgs[0]);
|
|
44
|
-
const generateCommand = await import("./generate-
|
|
44
|
+
const generateCommand = await import("./generate-x9u4GHvt.js").then((r) => r.default);
|
|
45
45
|
await runCommand(generateCommand, { rawArgs });
|
|
46
46
|
process.exit(0);
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
subCommands: {
|
|
50
|
-
generate: () => import("./generate-
|
|
50
|
+
generate: () => import("./generate-x9u4GHvt.js").then((r) => r.default),
|
|
51
51
|
validate: () => import("./validate-g2QHe0eT.js").then((r) => r.default),
|
|
52
52
|
mcp: () => import("./mcp-CxHcp4tk.js").then((r) => r.default)
|
|
53
53
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../package.json","../src/index.ts"],"sourcesContent":["{\n \"name\": \"@kubb/cli\",\n \"version\": \"3.
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../package.json","../src/index.ts"],"sourcesContent":["{\n \"name\": \"@kubb/cli\",\n \"version\": \"3.18.1\",\n \"description\": \"Command-line interface for Kubb, enabling easy generation of TypeScript, React-Query, Zod, and other code from OpenAPI specifications.\",\n \"keywords\": [\n \"cli\",\n \"command-line\",\n \"typescript\",\n \"openapi\",\n \"swagger\",\n \"code-generator\",\n \"codegen\",\n \"plugins\",\n \"kubb\"\n ],\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/kubb-labs/kubb.git\",\n \"directory\": \"packages/cli\"\n },\n \"license\": \"MIT\",\n \"author\": \"stijnvanhulle\",\n \"sideEffects\": false,\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.cts\",\n \"bin\": {\n \"kubb\": \"bin/kubb.cjs\"\n },\n \"files\": [\n \"src\",\n \"dist\",\n \"bin\",\n \"!/**/**.test.**\",\n \"!/**/__tests__/**\"\n ],\n \"scripts\": {\n \"build\": \"tsdown\",\n \"clean\": \"npx rimraf ./dist\",\n \"lint\": \"bun biome lint .\",\n \"lint:fix\": \"bun biome lint --fix --unsafe .\",\n \"release\": \"pnpm publish --no-git-check\",\n \"release:canary\": \"bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check\",\n \"start\": \"tsdown --watch\",\n \"test\": \"vitest --passWithNoTests\",\n \"typecheck\": \"tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false\"\n },\n \"dependencies\": {\n \"@kubb/core\": \"workspace:*\",\n \"@kubb/ui\": \"workspace:*\",\n \"chokidar\": \"^4.0.3\",\n \"citty\": \"^0.1.6\",\n \"cli-progress\": \"^3.12.0\",\n \"consola\": \"^3.4.2\",\n \"cosmiconfig\": \"^9.0.0\",\n \"execa\": \"^9.6.0\",\n \"gradient-string\": \"^3.0.0\",\n \"jiti\": \"^2.5.1\",\n \"latest-version\": \"^9.0.0\",\n \"open\": \"^10.2.0\",\n \"picocolors\": \"^1.1.1\",\n \"semver\": \"^7.7.2\",\n \"string-argv\": \"^0.3.2\"\n },\n \"devDependencies\": {\n \"@kubb/config-ts\": \"workspace:*\",\n \"@kubb/mcp\": \"workspace:*\",\n \"@kubb/oas\": \"workspace:*\",\n \"@kubb/plugin-oas\": \"workspace:*\",\n \"@types/cli-progress\": \"^3.11.6\",\n \"@types/node\": \"catalog:\",\n \"@types/semver\": \"^7.7.0\",\n \"source-map-support\": \"^0.5.21\",\n \"tsdown\": \"catalog:\",\n \"typescript\": \"catalog:\"\n },\n \"engines\": {\n \"node\": \">=20\"\n },\n \"preferGlobal\": true,\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n }\n}\n","import { defineCommand, runCommand, runMain } from 'citty'\nimport consola from 'consola'\nimport { default as gradientString } from 'gradient-string'\nimport getLatestVersion from 'latest-version'\nimport { lt } from 'semver'\nimport { version } from '../package.json'\n\nconst name = 'kubb'\n\nconst main = defineCommand({\n meta: {\n name,\n version,\n description: 'Kubb generation',\n },\n async setup({ rawArgs }) {\n try {\n consola.log(gradientString(['#F58517', '#F5A217', '#F55A17'])('Kubb CLI:'))\n\n const latestVersion = await getLatestVersion('@kubb/cli')\n\n if (lt(version, latestVersion)) {\n consola.box({\n title: 'Update available for `Kubb` ',\n message: `\\`v${version}\\` → \\`v${latestVersion}\\`\nRun \\`npm install -g @kubb/cli\\` to update`,\n style: {\n padding: 2,\n borderColor: 'yellow',\n borderStyle: 'rounded',\n },\n })\n }\n } catch (_e) {}\n\n if (!['generate', 'validate', 'mcp'].includes(rawArgs[0] as string)) {\n console.log(rawArgs[0])\n // generate is not being used\n const generateCommand = await import('./commands/generate.ts').then((r) => r.default)\n\n await runCommand(generateCommand, { rawArgs })\n\n process.exit(0)\n }\n },\n subCommands: {\n generate: () => import('./commands/generate.ts').then((r) => r.default),\n validate: () => import('./commands/validate.ts').then((r) => r.default),\n mcp: () => import('./commands/mcp.ts').then((r) => r.default),\n },\n})\n\nexport async function run(_argv?: string[]): Promise<void> {\n await runMain(main)\n}\n"],"mappings":";;;;;;;cAEa;;;;ACKb,MAAM,OAAO;AAEb,MAAM,OAAO,cAAc;CACzB,MAAM;EACJ;EACA;EACA,aAAa;EACd;CACD,MAAM,MAAM,EAAE,SAAS,EAAE;AACvB,MAAI;AACF,WAAQ,IAAI,eAAe;IAAC;IAAW;IAAW;IAAU,EAAE;GAE9D,MAAM,gBAAgB,MAAM,iBAAiB;AAE7C,OAAI,GAAG,SAAS,eACd,SAAQ,IAAI;IACV,OAAO;IACP,SAAS,MAAM,QAAQ,UAAU,cAAc;;IAE/C,OAAO;KACL,SAAS;KACT,aAAa;KACb,aAAa;KACd;IACF;EAEJ,SAAQ,IAAI,CAAE;AAEf,MAAI,CAAC;GAAC;GAAY;GAAY;GAAM,CAAC,SAAS,QAAQ,KAAe;AACnE,WAAQ,IAAI,QAAQ;GAEpB,MAAM,kBAAkB,MAAM,OAAO,0BAA0B,MAAM,MAAM,EAAE;AAE7E,SAAM,WAAW,iBAAiB,EAAE,SAAS;AAE7C,WAAQ,KAAK;EACd;CACF;CACD,aAAa;EACX,gBAAgB,OAAO,0BAA0B,MAAM,MAAM,EAAE;EAC/D,gBAAgB,OAAO,0BAA0B,MAAM,MAAM,EAAE;EAC/D,WAAW,OAAO,qBAAqB,MAAM,MAAM,EAAE;EACtD;CACF;AAED,eAAsB,IAAI,OAAiC;AACzD,OAAM,QAAQ;AACf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.18.1",
|
|
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",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"picocolors": "^1.1.1",
|
|
57
57
|
"semver": "^7.7.2",
|
|
58
58
|
"string-argv": "^0.3.2",
|
|
59
|
-
"@kubb/core": "3.
|
|
60
|
-
"@kubb/ui": "3.
|
|
59
|
+
"@kubb/core": "3.18.1",
|
|
60
|
+
"@kubb/ui": "3.18.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/cli-progress": "^3.11.6",
|
|
@@ -66,10 +66,10 @@
|
|
|
66
66
|
"source-map-support": "^0.5.21",
|
|
67
67
|
"tsdown": "^0.14.1",
|
|
68
68
|
"typescript": "^5.9.2",
|
|
69
|
-
"@kubb/config-ts": "3.
|
|
70
|
-
"@kubb/mcp": "3.
|
|
71
|
-
"@kubb/oas": "3.
|
|
72
|
-
"@kubb/plugin-oas": "3.
|
|
69
|
+
"@kubb/config-ts": "3.18.1",
|
|
70
|
+
"@kubb/mcp": "3.18.1",
|
|
71
|
+
"@kubb/oas": "3.18.1",
|
|
72
|
+
"@kubb/plugin-oas": "3.18.1"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": ">=20"
|
package/src/runners/generate.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
1
2
|
import process from 'node:process'
|
|
2
3
|
import { type Config, safeBuild, setup } from '@kubb/core'
|
|
3
4
|
import { createLogger, LogMapper } from '@kubb/core/logger'
|
|
4
5
|
import { Presets, SingleBar } from 'cli-progress'
|
|
6
|
+
import { execa } from 'execa'
|
|
5
7
|
import pc from 'picocolors'
|
|
6
8
|
import type { Args } from '../commands/generate.ts'
|
|
7
9
|
import { executeHooks } from '../utils/executeHooks.ts'
|
|
@@ -74,6 +76,7 @@ export async function generate({ input, config, progressCache, args }: GenerateP
|
|
|
74
76
|
extension: {
|
|
75
77
|
'.ts': '.ts',
|
|
76
78
|
},
|
|
79
|
+
format: 'prettier',
|
|
77
80
|
...userConfig.output,
|
|
78
81
|
},
|
|
79
82
|
}
|
|
@@ -133,6 +136,73 @@ export async function generate({ input, config, progressCache, args }: GenerateP
|
|
|
133
136
|
process.exit(1)
|
|
134
137
|
}
|
|
135
138
|
|
|
139
|
+
// formatting
|
|
140
|
+
if (config.output.format === 'prettier') {
|
|
141
|
+
logger?.emit('start', `Formatting with ${config.output.format}`)
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
await execa('prettier', ['--ignore-unknown', '--write', path.resolve(definedConfig.root, definedConfig.output.path)])
|
|
145
|
+
} catch (e) {
|
|
146
|
+
logger.consola?.warn('Prettier not found')
|
|
147
|
+
logger.consola?.error(e)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
logger?.emit('success', `Formatted with ${config.output.format}`)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (config.output.format === 'biome') {
|
|
154
|
+
logger?.emit('start', `Formatting with ${config.output.format}`)
|
|
155
|
+
|
|
156
|
+
try {
|
|
157
|
+
await execa('biome', ['format', '--write', path.resolve(definedConfig.root, definedConfig.output.path)])
|
|
158
|
+
} catch (e) {
|
|
159
|
+
logger.consola?.warn('Biome not found')
|
|
160
|
+
logger.consola?.error(e)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
logger?.emit('success', `Formatted with ${config.output.format}`)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// linting
|
|
167
|
+
if (config.output.lint === 'eslint') {
|
|
168
|
+
logger?.emit('start', `Linting with ${config.output.format}`)
|
|
169
|
+
|
|
170
|
+
try {
|
|
171
|
+
await execa('eslint', [path.resolve(definedConfig.root, definedConfig.output.path), '--fix'])
|
|
172
|
+
} catch (e) {
|
|
173
|
+
logger.consola?.warn('Eslint not found')
|
|
174
|
+
logger.consola?.error(e)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
logger?.emit('success', `Linted with ${config.output.format}`)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (config.output.lint === 'biome') {
|
|
181
|
+
logger?.emit('start', `Linting with ${config.output.format}`)
|
|
182
|
+
|
|
183
|
+
try {
|
|
184
|
+
await execa('biome', ['lint', '--fix', path.resolve(definedConfig.root, definedConfig.output.path)])
|
|
185
|
+
} catch (e) {
|
|
186
|
+
logger.consola?.warn('Biome not found')
|
|
187
|
+
logger.consola?.error(e)
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
logger?.emit('success', `Linted with ${config.output.format}`)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (config.output.lint === 'oxlint') {
|
|
194
|
+
logger?.emit('start', `Linting with ${config.output.format}`)
|
|
195
|
+
|
|
196
|
+
try {
|
|
197
|
+
await execa('oxlint', ['--fix', path.resolve(definedConfig.root, definedConfig.output.path)])
|
|
198
|
+
} catch (e) {
|
|
199
|
+
logger.consola?.warn('Oxlint not found')
|
|
200
|
+
logger.consola?.error(e)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
logger?.emit('success', `Linted with ${config.output.format}`)
|
|
204
|
+
}
|
|
205
|
+
|
|
136
206
|
if (config.hooks) {
|
|
137
207
|
await executeHooks({ hooks: config.hooks, logger })
|
|
138
208
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import type { defineConfig, UserConfig } from '@kubb/core'
|
|
1
2
|
import { cosmiconfig } from 'cosmiconfig'
|
|
2
3
|
import { createJiti } from 'jiti'
|
|
3
4
|
|
|
4
|
-
import type { UserConfig, defineConfig } from '@kubb/core'
|
|
5
|
-
|
|
6
5
|
export type CosmiconfigResult = {
|
|
7
6
|
filepath: string
|
|
8
7
|
isEmpty?: boolean
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-6jcPLg_V.js","names":["args","results: Array<Config>","path","args","process"],"sources":["../src/utils/getPlugins.ts","../src/utils/getConfig.ts","../src/utils/getCosmiConfig.ts","../src/utils/watcher.ts","../src/commands/generate.ts"],"sourcesContent":["import type { UserConfig } from '@kubb/core'\n\nfunction isJSONPlugins(plugins: UserConfig['plugins']) {\n return !!(plugins as any)?.some((plugin: any) => {\n return Array.isArray(plugin) && typeof plugin?.at(0) === 'string'\n })\n}\n\nfunction isObjectPlugins(plugins: UserConfig['plugins']): plugins is any {\n return plugins instanceof Object && !Array.isArray(plugins)\n}\n\nexport function getPlugins(plugins: UserConfig['plugins']): Promise<UserConfig['plugins']> {\n if (isObjectPlugins(plugins)) {\n throw new Error('Object plugins are not supported anymore, best to use http://kubb.dev/getting-started/configure#json')\n }\n\n if (isJSONPlugins(plugins)) {\n throw new Error('JSON plugins are not supported anymore, best to use http://kubb.dev/getting-started/configure#json')\n }\n\n return Promise.resolve(plugins)\n}\n","import { isPromise } from '@kubb/core/utils'\n\nimport { getPlugins } from './getPlugins.ts'\n\nimport type { Config, UserConfig } from '@kubb/core'\nimport type { Args } from '../commands/generate.ts'\nimport type { CosmiconfigResult } from './getCosmiConfig.ts'\n\n/**\n * Converting UserConfig to Config without a change in the object beside the JSON convert.\n */\nexport async function getConfig(result: CosmiconfigResult, args: Args): Promise<Array<Config> | Config> {\n const config = result?.config\n let kubbUserConfig = Promise.resolve(config) as Promise<UserConfig | Array<UserConfig>>\n\n // for ts or js files\n if (typeof config === 'function') {\n const possiblePromise = config(args)\n if (isPromise(possiblePromise)) {\n kubbUserConfig = possiblePromise\n }\n kubbUserConfig = Promise.resolve(possiblePromise)\n }\n\n let JSONConfig = await kubbUserConfig\n\n if (Array.isArray(JSONConfig)) {\n const results: Array<Config> = []\n\n for (const item of JSONConfig) {\n const plugins = item.plugins ? await getPlugins(item.plugins) : undefined\n\n results.push({\n ...item,\n plugins,\n } as Config)\n }\n\n return results\n }\n\n JSONConfig = {\n ...JSONConfig,\n plugins: JSONConfig.plugins ? await getPlugins(JSONConfig.plugins) : undefined,\n }\n\n return JSONConfig as Config\n}\n","import { cosmiconfig } from 'cosmiconfig'\nimport { createJiti } from 'jiti'\n\nimport type { UserConfig, defineConfig } from '@kubb/core'\n\nexport type CosmiconfigResult = {\n filepath: string\n isEmpty?: boolean\n config: ReturnType<typeof defineConfig> | UserConfig\n}\n\nconst tsLoader = async (configFile: string) => {\n const jiti = createJiti(import.meta.url, {\n jsx: {\n runtime: 'automatic',\n importSource: '@kubb/react',\n },\n sourceMaps: true,\n })\n\n const mod = await jiti.import(configFile, { default: true })\n\n return mod\n}\n\nexport async function getCosmiConfig(moduleName: string, config?: string): Promise<CosmiconfigResult> {\n const searchPlaces = [\n 'package.json',\n `.${moduleName}rc`,\n `.${moduleName}rc.json`,\n `.${moduleName}rc.yaml`,\n `.${moduleName}rc.yml`,\n\n `.${moduleName}rc.ts`,\n `.${moduleName}rc.js`,\n `.${moduleName}rc.mjs`,\n `.${moduleName}rc.cjs`,\n\n `${moduleName}.config.ts`,\n `${moduleName}.config.js`,\n `${moduleName}.config.mjs`,\n `${moduleName}.config.cjs`,\n ]\n const explorer = cosmiconfig(moduleName, {\n cache: false,\n searchPlaces: [\n ...searchPlaces.map((searchPlace) => {\n return `.config/${searchPlace}`\n }),\n ...searchPlaces.map((searchPlace) => {\n return `configs/${searchPlace}`\n }),\n ...searchPlaces,\n ],\n loaders: {\n '.ts': tsLoader,\n },\n })\n\n const result = config ? await explorer.load(config) : await explorer.search()\n\n if (result?.isEmpty || !result || !result.config) {\n throw new Error('Config not defined, create a kubb.config.js or pass through your config with the option --config')\n }\n\n return result as CosmiconfigResult\n}\n","import { createLogger } from '@kubb/core/logger'\nimport pc from 'picocolors'\n\nexport async function startWatcher(path: string[], cb: (path: string[]) => Promise<void>): Promise<void> {\n const { watch } = await import('chokidar')\n const logger = createLogger()\n\n const ignored = '**/{.git,node_modules}/**'\n\n const watcher = watch(path, {\n ignorePermissionErrors: true,\n ignored,\n })\n watcher.on('all', (type, file) => {\n logger?.emit('info', pc.yellow(pc.bold(`Change detected: ${type} ${file}`)))\n\n try {\n cb(path)\n } catch (_e) {\n logger?.emit('warning', pc.red('Watcher failed'))\n }\n })\n}\n","import path from 'node:path'\nimport * as process from 'node:process'\nimport { isInputPath, PromiseManager } from '@kubb/core'\nimport { createLogger, LogMapper } from '@kubb/core/logger'\nimport type { ArgsDef, ParsedArgs } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport type { SingleBar } from 'cli-progress'\nimport open from 'open'\nimport pc from 'picocolors'\nimport { getConfig } from '../utils/getConfig.ts'\nimport { getCosmiConfig } from '../utils/getCosmiConfig.ts'\nimport { startWatcher } from '../utils/watcher.ts'\n\ndeclare global {\n var isDevtoolsEnabled: any\n}\n\nconst args = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n alias: 'c',\n },\n logLevel: {\n type: 'string',\n description: 'Info, silent or debug',\n alias: 'l',\n default: 'info',\n valueHint: 'silent|info|debug',\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n alias: 'w',\n default: false,\n },\n debug: {\n type: 'boolean',\n description: 'Override logLevel to debug',\n alias: 'd',\n default: false,\n },\n ui: {\n type: 'boolean',\n description: 'Open ui',\n alias: 'u',\n default: false,\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: 'generate',\n description: \"[input] Generate files based on a 'kubb.config.ts' file\",\n },\n args,\n async run(commandContext) {\n let name = ''\n const progressCache = new Map<string, SingleBar>()\n\n const { args } = commandContext\n\n const input = args._[0]\n\n if (args.help) {\n return showUsage(command)\n }\n\n if (args.debug) {\n args.logLevel = 'debug'\n }\n\n const logLevel = LogMapper[args.logLevel as keyof typeof LogMapper] || 3\n const logger = createLogger({\n logLevel,\n })\n const { generate } = await import('../runners/generate.ts')\n\n logger.emit('start', 'Loading config')\n\n const result = await getCosmiConfig('kubb', args.config)\n logger.emit('success', `Config loaded(${pc.dim(path.relative(process.cwd(), result.filepath))})`)\n\n const config = await getConfig(result, args)\n\n const start = async () => {\n if (Array.isArray(config)) {\n const promiseManager = new PromiseManager()\n const promises = config.map((c) => () => {\n name = c.name || ''\n progressCache.clear()\n\n return generate({\n input,\n config: c,\n args,\n progressCache,\n })\n })\n\n await promiseManager.run('seq', promises)\n return\n }\n\n progressCache.clear()\n\n await generate({\n input,\n config,\n progressCache,\n args,\n })\n\n return\n }\n\n if (args.ui) {\n const { startServer } = await import('@kubb/ui')\n\n await startServer(\n {\n stop: () => process.exit(1),\n restart: () => start(),\n getMeta: () => {\n const entries = [...progressCache.entries()]\n\n const percentages = entries.reduce(\n (acc, [key, singleBar]) => {\n acc[key] = singleBar.getProgress()\n\n return acc\n },\n {} as Record<string, number>,\n )\n\n return {\n name,\n percentages,\n }\n },\n },\n (info) => {\n const url = `${info.address}:${info.port}`.replace('::', 'http://localhost')\n logger.consola?.start(`Starting ui on ${url}`)\n\n open(url)\n },\n )\n }\n\n if (args.watch) {\n if (Array.isArray(config)) {\n throw new Error('Cannot use watcher with multiple Configs(array)')\n }\n\n if (isInputPath(config)) {\n return startWatcher([input || config.input.path], async (paths) => {\n await start()\n logger.emit('start', pc.yellow(pc.bold(`Watching for changes in ${paths.join(' and ')}`)))\n })\n }\n }\n\n await start()\n\n if (globalThis.isDevtoolsEnabled) {\n const canRestart = await logger.consola?.prompt('Restart(could be used to validate the profiler)?', {\n type: 'confirm',\n initial: false,\n })\n\n if (canRestart) {\n await start()\n } else {\n process.exit(1)\n }\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;;;;;;;AAEA,SAAS,cAAc,SAAgC;AACrD,QAAO,CAAC,CAAE,SAAiB,MAAM,WAAgB;AAC/C,SAAO,MAAM,QAAQ,WAAW,OAAO,QAAQ,GAAG,OAAO;CAC1D;AACF;AAED,SAAS,gBAAgB,SAAgD;AACvE,QAAO,mBAAmB,UAAU,CAAC,MAAM,QAAQ;AACpD;AAED,SAAgB,WAAW,SAAgE;AACzF,KAAI,gBAAgB,SAClB,OAAM,IAAI,MAAM;AAGlB,KAAI,cAAc,SAChB,OAAM,IAAI,MAAM;AAGlB,QAAO,QAAQ,QAAQ;AACxB;;;;;;;ACXD,eAAsB,UAAU,QAA2B,QAA6C;CACtG,MAAM,SAAS,QAAQ;CACvB,IAAI,iBAAiB,QAAQ,QAAQ;AAGrC,KAAI,OAAO,WAAW,YAAY;EAChC,MAAM,kBAAkB,OAAOA;AAC/B,MAAI,UAAU,iBACZ,kBAAiB;AAEnB,mBAAiB,QAAQ,QAAQ;CAClC;CAED,IAAI,aAAa,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-AG4UwoYw.cjs","names":["args","results: Array<Config>","jiti","path","pc","args","LogMapper","pc","path","process","PromiseManager"],"sources":["../src/utils/getPlugins.ts","../src/utils/getConfig.ts","../src/utils/getCosmiConfig.ts","../src/utils/watcher.ts","../src/commands/generate.ts"],"sourcesContent":["import type { UserConfig } from '@kubb/core'\n\nfunction isJSONPlugins(plugins: UserConfig['plugins']) {\n return !!(plugins as any)?.some((plugin: any) => {\n return Array.isArray(plugin) && typeof plugin?.at(0) === 'string'\n })\n}\n\nfunction isObjectPlugins(plugins: UserConfig['plugins']): plugins is any {\n return plugins instanceof Object && !Array.isArray(plugins)\n}\n\nexport function getPlugins(plugins: UserConfig['plugins']): Promise<UserConfig['plugins']> {\n if (isObjectPlugins(plugins)) {\n throw new Error('Object plugins are not supported anymore, best to use http://kubb.dev/getting-started/configure#json')\n }\n\n if (isJSONPlugins(plugins)) {\n throw new Error('JSON plugins are not supported anymore, best to use http://kubb.dev/getting-started/configure#json')\n }\n\n return Promise.resolve(plugins)\n}\n","import { isPromise } from '@kubb/core/utils'\n\nimport { getPlugins } from './getPlugins.ts'\n\nimport type { Config, UserConfig } from '@kubb/core'\nimport type { Args } from '../commands/generate.ts'\nimport type { CosmiconfigResult } from './getCosmiConfig.ts'\n\n/**\n * Converting UserConfig to Config without a change in the object beside the JSON convert.\n */\nexport async function getConfig(result: CosmiconfigResult, args: Args): Promise<Array<Config> | Config> {\n const config = result?.config\n let kubbUserConfig = Promise.resolve(config) as Promise<UserConfig | Array<UserConfig>>\n\n // for ts or js files\n if (typeof config === 'function') {\n const possiblePromise = config(args)\n if (isPromise(possiblePromise)) {\n kubbUserConfig = possiblePromise\n }\n kubbUserConfig = Promise.resolve(possiblePromise)\n }\n\n let JSONConfig = await kubbUserConfig\n\n if (Array.isArray(JSONConfig)) {\n const results: Array<Config> = []\n\n for (const item of JSONConfig) {\n const plugins = item.plugins ? await getPlugins(item.plugins) : undefined\n\n results.push({\n ...item,\n plugins,\n } as Config)\n }\n\n return results\n }\n\n JSONConfig = {\n ...JSONConfig,\n plugins: JSONConfig.plugins ? await getPlugins(JSONConfig.plugins) : undefined,\n }\n\n return JSONConfig as Config\n}\n","import { cosmiconfig } from 'cosmiconfig'\nimport { createJiti } from 'jiti'\n\nimport type { UserConfig, defineConfig } from '@kubb/core'\n\nexport type CosmiconfigResult = {\n filepath: string\n isEmpty?: boolean\n config: ReturnType<typeof defineConfig> | UserConfig\n}\n\nconst tsLoader = async (configFile: string) => {\n const jiti = createJiti(import.meta.url, {\n jsx: {\n runtime: 'automatic',\n importSource: '@kubb/react',\n },\n sourceMaps: true,\n })\n\n const mod = await jiti.import(configFile, { default: true })\n\n return mod\n}\n\nexport async function getCosmiConfig(moduleName: string, config?: string): Promise<CosmiconfigResult> {\n const searchPlaces = [\n 'package.json',\n `.${moduleName}rc`,\n `.${moduleName}rc.json`,\n `.${moduleName}rc.yaml`,\n `.${moduleName}rc.yml`,\n\n `.${moduleName}rc.ts`,\n `.${moduleName}rc.js`,\n `.${moduleName}rc.mjs`,\n `.${moduleName}rc.cjs`,\n\n `${moduleName}.config.ts`,\n `${moduleName}.config.js`,\n `${moduleName}.config.mjs`,\n `${moduleName}.config.cjs`,\n ]\n const explorer = cosmiconfig(moduleName, {\n cache: false,\n searchPlaces: [\n ...searchPlaces.map((searchPlace) => {\n return `.config/${searchPlace}`\n }),\n ...searchPlaces.map((searchPlace) => {\n return `configs/${searchPlace}`\n }),\n ...searchPlaces,\n ],\n loaders: {\n '.ts': tsLoader,\n },\n })\n\n const result = config ? await explorer.load(config) : await explorer.search()\n\n if (result?.isEmpty || !result || !result.config) {\n throw new Error('Config not defined, create a kubb.config.js or pass through your config with the option --config')\n }\n\n return result as CosmiconfigResult\n}\n","import { createLogger } from '@kubb/core/logger'\nimport pc from 'picocolors'\n\nexport async function startWatcher(path: string[], cb: (path: string[]) => Promise<void>): Promise<void> {\n const { watch } = await import('chokidar')\n const logger = createLogger()\n\n const ignored = '**/{.git,node_modules}/**'\n\n const watcher = watch(path, {\n ignorePermissionErrors: true,\n ignored,\n })\n watcher.on('all', (type, file) => {\n logger?.emit('info', pc.yellow(pc.bold(`Change detected: ${type} ${file}`)))\n\n try {\n cb(path)\n } catch (_e) {\n logger?.emit('warning', pc.red('Watcher failed'))\n }\n })\n}\n","import path from 'node:path'\nimport * as process from 'node:process'\nimport { isInputPath, PromiseManager } from '@kubb/core'\nimport { createLogger, LogMapper } from '@kubb/core/logger'\nimport type { ArgsDef, ParsedArgs } from 'citty'\nimport { defineCommand, showUsage } from 'citty'\nimport type { SingleBar } from 'cli-progress'\nimport open from 'open'\nimport pc from 'picocolors'\nimport { getConfig } from '../utils/getConfig.ts'\nimport { getCosmiConfig } from '../utils/getCosmiConfig.ts'\nimport { startWatcher } from '../utils/watcher.ts'\n\ndeclare global {\n var isDevtoolsEnabled: any\n}\n\nconst args = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n alias: 'c',\n },\n logLevel: {\n type: 'string',\n description: 'Info, silent or debug',\n alias: 'l',\n default: 'info',\n valueHint: 'silent|info|debug',\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode based on the input file',\n alias: 'w',\n default: false,\n },\n debug: {\n type: 'boolean',\n description: 'Override logLevel to debug',\n alias: 'd',\n default: false,\n },\n ui: {\n type: 'boolean',\n description: 'Open ui',\n alias: 'u',\n default: false,\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: 'generate',\n description: \"[input] Generate files based on a 'kubb.config.ts' file\",\n },\n args,\n async run(commandContext) {\n let name = ''\n const progressCache = new Map<string, SingleBar>()\n\n const { args } = commandContext\n\n const input = args._[0]\n\n if (args.help) {\n return showUsage(command)\n }\n\n if (args.debug) {\n args.logLevel = 'debug'\n }\n\n const logLevel = LogMapper[args.logLevel as keyof typeof LogMapper] || 3\n const logger = createLogger({\n logLevel,\n })\n const { generate } = await import('../runners/generate.ts')\n\n logger.emit('start', 'Loading config')\n\n const result = await getCosmiConfig('kubb', args.config)\n logger.emit('success', `Config loaded(${pc.dim(path.relative(process.cwd(), result.filepath))})`)\n\n const config = await getConfig(result, args)\n\n const start = async () => {\n if (Array.isArray(config)) {\n const promiseManager = new PromiseManager()\n const promises = config.map((c) => () => {\n name = c.name || ''\n progressCache.clear()\n\n return generate({\n input,\n config: c,\n args,\n progressCache,\n })\n })\n\n await promiseManager.run('seq', promises)\n return\n }\n\n progressCache.clear()\n\n await generate({\n input,\n config,\n progressCache,\n args,\n })\n\n return\n }\n\n if (args.ui) {\n const { startServer } = await import('@kubb/ui')\n\n await startServer(\n {\n stop: () => process.exit(1),\n restart: () => start(),\n getMeta: () => {\n const entries = [...progressCache.entries()]\n\n const percentages = entries.reduce(\n (acc, [key, singleBar]) => {\n acc[key] = singleBar.getProgress()\n\n return acc\n },\n {} as Record<string, number>,\n )\n\n return {\n name,\n percentages,\n }\n },\n },\n (info) => {\n const url = `${info.address}:${info.port}`.replace('::', 'http://localhost')\n logger.consola?.start(`Starting ui on ${url}`)\n\n open(url)\n },\n )\n }\n\n if (args.watch) {\n if (Array.isArray(config)) {\n throw new Error('Cannot use watcher with multiple Configs(array)')\n }\n\n if (isInputPath(config)) {\n return startWatcher([input || config.input.path], async (paths) => {\n await start()\n logger.emit('start', pc.yellow(pc.bold(`Watching for changes in ${paths.join(' and ')}`)))\n })\n }\n }\n\n await start()\n\n if (globalThis.isDevtoolsEnabled) {\n const canRestart = await logger.consola?.prompt('Restart(could be used to validate the profiler)?', {\n type: 'confirm',\n initial: false,\n })\n\n if (canRestart) {\n await start()\n } else {\n process.exit(1)\n }\n }\n },\n})\n\nexport default command\n"],"mappings":";;;;;;;;;;;;;AAEA,SAAS,cAAc,SAAgC;AACrD,QAAO,CAAC,CAAE,SAAiB,MAAM,WAAgB;AAC/C,SAAO,MAAM,QAAQ,WAAW,OA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