kubb 5.0.0-alpha.32 → 5.0.0-alpha.33
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/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/defineConfig.ts +4 -4
package/dist/index.cjs
CHANGED
|
@@ -20,13 +20,13 @@ function isPromise(result) {
|
|
|
20
20
|
* Applies default adapter and parsers to a single user config when not set.
|
|
21
21
|
*
|
|
22
22
|
* - `adapter` defaults to `adapterOas()`
|
|
23
|
-
* - `parsers` defaults to `[parserTs]`
|
|
23
|
+
* - `parsers` defaults to `[parserTs, parserTsx]`
|
|
24
24
|
*/
|
|
25
25
|
function applyDefaults(config) {
|
|
26
26
|
return {
|
|
27
27
|
...config,
|
|
28
28
|
adapter: config.adapter ?? (0, _kubb_adapter_oas.adapterOas)(),
|
|
29
|
-
parsers: config.parsers?.length ? config.parsers : [_kubb_parser_ts.parserTs]
|
|
29
|
+
parsers: config.parsers?.length ? config.parsers : [_kubb_parser_ts.parserTs, _kubb_parser_ts.parserTsx]
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
function defineConfig(config) {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["parserTs"],"sources":["../../../internals/utils/src/promise.ts","../src/defineConfig.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\n/** Returns `true` when `result` is a thenable `Promise`.\n *\n * @example\n * ```ts\n * isPromise(Promise.resolve(1)) // true\n * isPromise(42) // false\n * ```\n */\nexport function isPromise<T>(result: PossiblePromise<T>): result is Promise<T> {\n return result !== null && result !== undefined && typeof (result as Record<string, unknown>)['then'] === 'function'\n}\n\n/** Returns `true` when `result` is a fulfilled `Promise.allSettled` result.\n *\n * @example\n * ```ts\n * const results = await Promise.allSettled([p1, p2])\n * results.filter(isPromiseFulfilledResult).map((r) => r.value)\n * ```\n */\nexport function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T> {\n return result.status === 'fulfilled'\n}\n\n/** Returns `true` when `result` is a rejected `Promise.allSettled` result with a typed `reason`.\n *\n * @example\n * ```ts\n * const results = await Promise.allSettled([p1, p2])\n * results.filter(isPromiseRejectedResult<Error>).map((r) => r.reason.message)\n * ```\n */\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","import { isPromise, type PossiblePromise } from '@internals/utils'\nimport { adapterOas } from '@kubb/adapter-oas'\nimport type { UserConfig } from '@kubb/core'\nimport { parserTs } from '@kubb/parser-ts'\n\n/**\n * CLI options derived from command-line flags.\n */\nexport type CLIOptions = {\n /**\n * Path to `kubb.config.js`.\n */\n config?: string\n /**\n * Enable watch mode for input files.\n */\n watch?: boolean\n /**\n * Logging verbosity for CLI usage.\n *\n * - `silent`: hide non-essential logs\n * - `info`: show general logs (non-plugin-related)\n * - `debug`: include detailed plugin lifecycle logs\n * @default 'silent'\n */\n logLevel?: 'silent' | 'info' | 'debug'\n}\n\n/**\n * All accepted forms of a Kubb configuration.\n */\nexport type ConfigInput = PossiblePromise<UserConfig | UserConfig[]> | ((cli: CLIOptions) => PossiblePromise<UserConfig | UserConfig[]>)\n\n/**\n * Applies default adapter and parsers to a single user config when not set.\n *\n * - `adapter` defaults to `adapterOas()`\n * - `parsers` defaults to `[parserTs]`\n */\nfunction applyDefaults(config: UserConfig): UserConfig {\n return {\n ...config,\n adapter: config.adapter ?? adapterOas(),\n parsers: config.parsers?.length ? config.parsers : [parserTs],\n }\n}\n\n/**\n * Helper for defining a Kubb configuration with built-in defaults.\n *\n * When no `adapter` is provided, `adapterOas()` is used automatically.\n * When no `parsers` are provided, `[
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["parserTs","parserTsx"],"sources":["../../../internals/utils/src/promise.ts","../src/defineConfig.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\n/** Returns `true` when `result` is a thenable `Promise`.\n *\n * @example\n * ```ts\n * isPromise(Promise.resolve(1)) // true\n * isPromise(42) // false\n * ```\n */\nexport function isPromise<T>(result: PossiblePromise<T>): result is Promise<T> {\n return result !== null && result !== undefined && typeof (result as Record<string, unknown>)['then'] === 'function'\n}\n\n/** Returns `true` when `result` is a fulfilled `Promise.allSettled` result.\n *\n * @example\n * ```ts\n * const results = await Promise.allSettled([p1, p2])\n * results.filter(isPromiseFulfilledResult).map((r) => r.value)\n * ```\n */\nexport function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T> {\n return result.status === 'fulfilled'\n}\n\n/** Returns `true` when `result` is a rejected `Promise.allSettled` result with a typed `reason`.\n *\n * @example\n * ```ts\n * const results = await Promise.allSettled([p1, p2])\n * results.filter(isPromiseRejectedResult<Error>).map((r) => r.reason.message)\n * ```\n */\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","import { isPromise, type PossiblePromise } from '@internals/utils'\nimport { adapterOas } from '@kubb/adapter-oas'\nimport type { UserConfig } from '@kubb/core'\nimport { parserTs, parserTsx } from '@kubb/parser-ts'\n\n/**\n * CLI options derived from command-line flags.\n */\nexport type CLIOptions = {\n /**\n * Path to `kubb.config.js`.\n */\n config?: string\n /**\n * Enable watch mode for input files.\n */\n watch?: boolean\n /**\n * Logging verbosity for CLI usage.\n *\n * - `silent`: hide non-essential logs\n * - `info`: show general logs (non-plugin-related)\n * - `debug`: include detailed plugin lifecycle logs\n * @default 'silent'\n */\n logLevel?: 'silent' | 'info' | 'debug'\n}\n\n/**\n * All accepted forms of a Kubb configuration.\n */\nexport type ConfigInput = PossiblePromise<UserConfig | UserConfig[]> | ((cli: CLIOptions) => PossiblePromise<UserConfig | UserConfig[]>)\n\n/**\n * Applies default adapter and parsers to a single user config when not set.\n *\n * - `adapter` defaults to `adapterOas()`\n * - `parsers` defaults to `[parserTs, parserTsx]`\n */\nfunction applyDefaults(config: UserConfig): UserConfig {\n return {\n ...config,\n adapter: config.adapter ?? adapterOas(),\n parsers: config.parsers?.length ? config.parsers : [parserTs, parserTsx],\n }\n}\n\n/**\n * Helper for defining a Kubb configuration with built-in defaults.\n *\n * When no `adapter` is provided, `adapterOas()` is used automatically.\n * When no `parsers` are provided, `[parserTsx]` is used automatically.\n *\n * Accepts either:\n * - A config object or array of configs\n * - A function returning the config(s), optionally async,\n * receiving the CLI options as argument\n *\n * @example\n * export default defineConfig(({ logLevel }) => ({\n * root: 'src',\n * plugins: [myPlugin()],\n * }))\n */\nexport function defineConfig(config: (cli: CLIOptions) => PossiblePromise<UserConfig | UserConfig[]>): (cli: CLIOptions) => Promise<UserConfig | UserConfig[]>\nexport function defineConfig(config: Promise<UserConfig | UserConfig[]>): Promise<UserConfig | UserConfig[]>\nexport function defineConfig(config: UserConfig | UserConfig[]): UserConfig | UserConfig[]\nexport function defineConfig(config: ConfigInput): ConfigInput {\n if (typeof config === 'function') {\n return async (cli: CLIOptions) => {\n const resolved = await config(cli)\n const configs = Array.isArray(resolved) ? resolved : [resolved]\n const result = configs.map(applyDefaults)\n\n return result.length === 1 ? result[0]! : result\n }\n }\n\n if (isPromise(config)) {\n return config.then((resolved) => {\n const configs = Array.isArray(resolved) ? resolved : [resolved]\n const result = configs.map(applyDefaults)\n\n return result.length === 1 ? result[0]! : result\n })\n }\n\n const configs = Array.isArray(config) ? config : [config]\n const result = configs.map(applyDefaults)\n\n return result.length === 1 ? result[0]! : result\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA,SAAgB,UAAa,QAAkD;AAC7E,QAAO,WAAW,QAAQ,WAAW,KAAA,KAAa,OAAQ,OAAmC,YAAY;;;;;;;;;;ACmB3G,SAAS,cAAc,QAAgC;AACrD,QAAO;EACL,GAAG;EACH,SAAS,OAAO,YAAA,GAAA,kBAAA,aAAuB;EACvC,SAAS,OAAO,SAAS,SAAS,OAAO,UAAU,CAACA,gBAAAA,UAAUC,gBAAAA,UAAU;EACzE;;AAuBH,SAAgB,aAAa,QAAkC;AAC7D,KAAI,OAAO,WAAW,WACpB,QAAO,OAAO,QAAoB;EAChC,MAAM,WAAW,MAAM,OAAO,IAAI;EAElC,MAAM,UADU,MAAM,QAAQ,SAAS,GAAG,WAAW,CAAC,SAAS,EACxC,IAAI,cAAc;AAEzC,SAAO,OAAO,WAAW,IAAI,OAAO,KAAM;;AAI9C,KAAI,UAAU,OAAO,CACnB,QAAO,OAAO,MAAM,aAAa;EAE/B,MAAM,UADU,MAAM,QAAQ,SAAS,GAAG,WAAW,CAAC,SAAS,EACxC,IAAI,cAAc;AAEzC,SAAO,OAAO,WAAW,IAAI,OAAO,KAAM;GAC1C;CAIJ,MAAM,UADU,MAAM,QAAQ,OAAO,GAAG,SAAS,CAAC,OAAO,EAClC,IAAI,cAAc;AAEzC,QAAO,OAAO,WAAW,IAAI,OAAO,KAAM"}
|
package/dist/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ type CLIOptions = {
|
|
|
40
40
|
* Helper for defining a Kubb configuration with built-in defaults.
|
|
41
41
|
*
|
|
42
42
|
* When no `adapter` is provided, `adapterOas()` is used automatically.
|
|
43
|
-
* When no `parsers` are provided, `[
|
|
43
|
+
* When no `parsers` are provided, `[parserTsx]` is used automatically.
|
|
44
44
|
*
|
|
45
45
|
* Accepts either:
|
|
46
46
|
* - A config object or array of configs
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./chunk--u3MIqq1.js";
|
|
2
2
|
import { adapterOas } from "@kubb/adapter-oas";
|
|
3
|
-
import { parserTs } from "@kubb/parser-ts";
|
|
3
|
+
import { parserTs, parserTsx } from "@kubb/parser-ts";
|
|
4
4
|
//#region ../../internals/utils/src/promise.ts
|
|
5
5
|
/** Returns `true` when `result` is a thenable `Promise`.
|
|
6
6
|
*
|
|
@@ -19,13 +19,13 @@ function isPromise(result) {
|
|
|
19
19
|
* Applies default adapter and parsers to a single user config when not set.
|
|
20
20
|
*
|
|
21
21
|
* - `adapter` defaults to `adapterOas()`
|
|
22
|
-
* - `parsers` defaults to `[parserTs]`
|
|
22
|
+
* - `parsers` defaults to `[parserTs, parserTsx]`
|
|
23
23
|
*/
|
|
24
24
|
function applyDefaults(config) {
|
|
25
25
|
return {
|
|
26
26
|
...config,
|
|
27
27
|
adapter: config.adapter ?? adapterOas(),
|
|
28
|
-
parsers: config.parsers?.length ? config.parsers : [parserTs]
|
|
28
|
+
parsers: config.parsers?.length ? config.parsers : [parserTs, parserTsx]
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
function defineConfig(config) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../internals/utils/src/promise.ts","../src/defineConfig.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\n/** Returns `true` when `result` is a thenable `Promise`.\n *\n * @example\n * ```ts\n * isPromise(Promise.resolve(1)) // true\n * isPromise(42) // false\n * ```\n */\nexport function isPromise<T>(result: PossiblePromise<T>): result is Promise<T> {\n return result !== null && result !== undefined && typeof (result as Record<string, unknown>)['then'] === 'function'\n}\n\n/** Returns `true` when `result` is a fulfilled `Promise.allSettled` result.\n *\n * @example\n * ```ts\n * const results = await Promise.allSettled([p1, p2])\n * results.filter(isPromiseFulfilledResult).map((r) => r.value)\n * ```\n */\nexport function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T> {\n return result.status === 'fulfilled'\n}\n\n/** Returns `true` when `result` is a rejected `Promise.allSettled` result with a typed `reason`.\n *\n * @example\n * ```ts\n * const results = await Promise.allSettled([p1, p2])\n * results.filter(isPromiseRejectedResult<Error>).map((r) => r.reason.message)\n * ```\n */\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","import { isPromise, type PossiblePromise } from '@internals/utils'\nimport { adapterOas } from '@kubb/adapter-oas'\nimport type { UserConfig } from '@kubb/core'\nimport { parserTs } from '@kubb/parser-ts'\n\n/**\n * CLI options derived from command-line flags.\n */\nexport type CLIOptions = {\n /**\n * Path to `kubb.config.js`.\n */\n config?: string\n /**\n * Enable watch mode for input files.\n */\n watch?: boolean\n /**\n * Logging verbosity for CLI usage.\n *\n * - `silent`: hide non-essential logs\n * - `info`: show general logs (non-plugin-related)\n * - `debug`: include detailed plugin lifecycle logs\n * @default 'silent'\n */\n logLevel?: 'silent' | 'info' | 'debug'\n}\n\n/**\n * All accepted forms of a Kubb configuration.\n */\nexport type ConfigInput = PossiblePromise<UserConfig | UserConfig[]> | ((cli: CLIOptions) => PossiblePromise<UserConfig | UserConfig[]>)\n\n/**\n * Applies default adapter and parsers to a single user config when not set.\n *\n * - `adapter` defaults to `adapterOas()`\n * - `parsers` defaults to `[parserTs]`\n */\nfunction applyDefaults(config: UserConfig): UserConfig {\n return {\n ...config,\n adapter: config.adapter ?? adapterOas(),\n parsers: config.parsers?.length ? config.parsers : [parserTs],\n }\n}\n\n/**\n * Helper for defining a Kubb configuration with built-in defaults.\n *\n * When no `adapter` is provided, `adapterOas()` is used automatically.\n * When no `parsers` are provided, `[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../internals/utils/src/promise.ts","../src/defineConfig.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\n/** Returns `true` when `result` is a thenable `Promise`.\n *\n * @example\n * ```ts\n * isPromise(Promise.resolve(1)) // true\n * isPromise(42) // false\n * ```\n */\nexport function isPromise<T>(result: PossiblePromise<T>): result is Promise<T> {\n return result !== null && result !== undefined && typeof (result as Record<string, unknown>)['then'] === 'function'\n}\n\n/** Returns `true` when `result` is a fulfilled `Promise.allSettled` result.\n *\n * @example\n * ```ts\n * const results = await Promise.allSettled([p1, p2])\n * results.filter(isPromiseFulfilledResult).map((r) => r.value)\n * ```\n */\nexport function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T> {\n return result.status === 'fulfilled'\n}\n\n/** Returns `true` when `result` is a rejected `Promise.allSettled` result with a typed `reason`.\n *\n * @example\n * ```ts\n * const results = await Promise.allSettled([p1, p2])\n * results.filter(isPromiseRejectedResult<Error>).map((r) => r.reason.message)\n * ```\n */\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","import { isPromise, type PossiblePromise } from '@internals/utils'\nimport { adapterOas } from '@kubb/adapter-oas'\nimport type { UserConfig } from '@kubb/core'\nimport { parserTs, parserTsx } from '@kubb/parser-ts'\n\n/**\n * CLI options derived from command-line flags.\n */\nexport type CLIOptions = {\n /**\n * Path to `kubb.config.js`.\n */\n config?: string\n /**\n * Enable watch mode for input files.\n */\n watch?: boolean\n /**\n * Logging verbosity for CLI usage.\n *\n * - `silent`: hide non-essential logs\n * - `info`: show general logs (non-plugin-related)\n * - `debug`: include detailed plugin lifecycle logs\n * @default 'silent'\n */\n logLevel?: 'silent' | 'info' | 'debug'\n}\n\n/**\n * All accepted forms of a Kubb configuration.\n */\nexport type ConfigInput = PossiblePromise<UserConfig | UserConfig[]> | ((cli: CLIOptions) => PossiblePromise<UserConfig | UserConfig[]>)\n\n/**\n * Applies default adapter and parsers to a single user config when not set.\n *\n * - `adapter` defaults to `adapterOas()`\n * - `parsers` defaults to `[parserTs, parserTsx]`\n */\nfunction applyDefaults(config: UserConfig): UserConfig {\n return {\n ...config,\n adapter: config.adapter ?? adapterOas(),\n parsers: config.parsers?.length ? config.parsers : [parserTs, parserTsx],\n }\n}\n\n/**\n * Helper for defining a Kubb configuration with built-in defaults.\n *\n * When no `adapter` is provided, `adapterOas()` is used automatically.\n * When no `parsers` are provided, `[parserTsx]` is used automatically.\n *\n * Accepts either:\n * - A config object or array of configs\n * - A function returning the config(s), optionally async,\n * receiving the CLI options as argument\n *\n * @example\n * export default defineConfig(({ logLevel }) => ({\n * root: 'src',\n * plugins: [myPlugin()],\n * }))\n */\nexport function defineConfig(config: (cli: CLIOptions) => PossiblePromise<UserConfig | UserConfig[]>): (cli: CLIOptions) => Promise<UserConfig | UserConfig[]>\nexport function defineConfig(config: Promise<UserConfig | UserConfig[]>): Promise<UserConfig | UserConfig[]>\nexport function defineConfig(config: UserConfig | UserConfig[]): UserConfig | UserConfig[]\nexport function defineConfig(config: ConfigInput): ConfigInput {\n if (typeof config === 'function') {\n return async (cli: CLIOptions) => {\n const resolved = await config(cli)\n const configs = Array.isArray(resolved) ? resolved : [resolved]\n const result = configs.map(applyDefaults)\n\n return result.length === 1 ? result[0]! : result\n }\n }\n\n if (isPromise(config)) {\n return config.then((resolved) => {\n const configs = Array.isArray(resolved) ? resolved : [resolved]\n const result = configs.map(applyDefaults)\n\n return result.length === 1 ? result[0]! : result\n })\n }\n\n const configs = Array.isArray(config) ? config : [config]\n const result = configs.map(applyDefaults)\n\n return result.length === 1 ? result[0]! : result\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,SAAgB,UAAa,QAAkD;AAC7E,QAAO,WAAW,QAAQ,WAAW,KAAA,KAAa,OAAQ,OAAmC,YAAY;;;;;;;;;;ACmB3G,SAAS,cAAc,QAAgC;AACrD,QAAO;EACL,GAAG;EACH,SAAS,OAAO,WAAW,YAAY;EACvC,SAAS,OAAO,SAAS,SAAS,OAAO,UAAU,CAAC,UAAU,UAAU;EACzE;;AAuBH,SAAgB,aAAa,QAAkC;AAC7D,KAAI,OAAO,WAAW,WACpB,QAAO,OAAO,QAAoB;EAChC,MAAM,WAAW,MAAM,OAAO,IAAI;EAElC,MAAM,UADU,MAAM,QAAQ,SAAS,GAAG,WAAW,CAAC,SAAS,EACxC,IAAI,cAAc;AAEzC,SAAO,OAAO,WAAW,IAAI,OAAO,KAAM;;AAI9C,KAAI,UAAU,OAAO,CACnB,QAAO,OAAO,MAAM,aAAa;EAE/B,MAAM,UADU,MAAM,QAAQ,SAAS,GAAG,WAAW,CAAC,SAAS,EACxC,IAAI,cAAc;AAEzC,SAAO,OAAO,WAAW,IAAI,OAAO,KAAM;GAC1C;CAIJ,MAAM,UADU,MAAM,QAAQ,OAAO,GAAG,SAAS,CAAC,OAAO,EAClC,IAAI,cAAc;AAEzC,QAAO,OAAO,WAAW,IAAI,OAAO,KAAM"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kubb",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.33",
|
|
4
4
|
"description": "Transform OpenAPI specifications into TypeScript, React-Query, Zod, Faker.js, MSW and more with a plugin-based code generation tool.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
}
|
|
52
52
|
],
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@kubb/adapter-oas": "5.0.0-alpha.
|
|
55
|
-
"@kubb/agent": "5.0.0-alpha.
|
|
56
|
-
"@kubb/cli": "5.0.0-alpha.
|
|
57
|
-
"@kubb/core": "5.0.0-alpha.
|
|
58
|
-
"@kubb/mcp": "5.0.0-alpha.
|
|
59
|
-
"@kubb/parser-ts": "5.0.0-alpha.
|
|
54
|
+
"@kubb/adapter-oas": "5.0.0-alpha.33",
|
|
55
|
+
"@kubb/agent": "5.0.0-alpha.33",
|
|
56
|
+
"@kubb/cli": "5.0.0-alpha.33",
|
|
57
|
+
"@kubb/core": "5.0.0-alpha.33",
|
|
58
|
+
"@kubb/mcp": "5.0.0-alpha.33",
|
|
59
|
+
"@kubb/parser-ts": "5.0.0-alpha.33"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@internals/utils": "0.0.0"
|
package/src/defineConfig.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isPromise, type PossiblePromise } from '@internals/utils'
|
|
2
2
|
import { adapterOas } from '@kubb/adapter-oas'
|
|
3
3
|
import type { UserConfig } from '@kubb/core'
|
|
4
|
-
import { parserTs } from '@kubb/parser-ts'
|
|
4
|
+
import { parserTs, parserTsx } from '@kubb/parser-ts'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* CLI options derived from command-line flags.
|
|
@@ -35,13 +35,13 @@ export type ConfigInput = PossiblePromise<UserConfig | UserConfig[]> | ((cli: CL
|
|
|
35
35
|
* Applies default adapter and parsers to a single user config when not set.
|
|
36
36
|
*
|
|
37
37
|
* - `adapter` defaults to `adapterOas()`
|
|
38
|
-
* - `parsers` defaults to `[parserTs]`
|
|
38
|
+
* - `parsers` defaults to `[parserTs, parserTsx]`
|
|
39
39
|
*/
|
|
40
40
|
function applyDefaults(config: UserConfig): UserConfig {
|
|
41
41
|
return {
|
|
42
42
|
...config,
|
|
43
43
|
adapter: config.adapter ?? adapterOas(),
|
|
44
|
-
parsers: config.parsers?.length ? config.parsers : [parserTs],
|
|
44
|
+
parsers: config.parsers?.length ? config.parsers : [parserTs, parserTsx],
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -49,7 +49,7 @@ function applyDefaults(config: UserConfig): UserConfig {
|
|
|
49
49
|
* Helper for defining a Kubb configuration with built-in defaults.
|
|
50
50
|
*
|
|
51
51
|
* When no `adapter` is provided, `adapterOas()` is used automatically.
|
|
52
|
-
* When no `parsers` are provided, `[
|
|
52
|
+
* When no `parsers` are provided, `[parserTsx]` is used automatically.
|
|
53
53
|
*
|
|
54
54
|
* Accepts either:
|
|
55
55
|
* - A config object or array of configs
|