kubb 5.28.6 → 5.29.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/README.md CHANGED
@@ -34,11 +34,11 @@ Kubb turns an API spec, such as OpenAPI, into TypeScript types, API clients, hoo
34
34
  ## Installation
35
35
 
36
36
  ```bash
37
- bun add kubb
37
+ bun add -D kubb
38
38
  # or
39
- pnpm add kubb
39
+ pnpm add -D kubb
40
40
  # or
41
- npm install kubb
41
+ npm install -D kubb
42
42
  ```
43
43
 
44
44
  ## Quick start
package/dist/config.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_defineConfig = require("./defineConfig-tpUKTeYn.cjs");
2
+ const require_defineConfig = require("./defineConfig-xAM0up_v.cjs");
3
3
  exports.defineConfig = require_defineConfig.defineConfig;
package/dist/config.d.cts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { BarrelType } from "@kubb/plugin-barrel";
2
- import { t as defineConfig } from "./defineConfig-BaD4Rwdn.cjs";
2
+ import { t as defineConfig } from "./defineConfig-ChY_4BJ5.cjs";
3
3
  export { type BarrelType, defineConfig };
package/dist/config.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { BarrelType } from "@kubb/plugin-barrel";
2
- import { t as defineConfig } from "./defineConfig-BaE5GaMK.js";
2
+ import { t as defineConfig } from "./defineConfig-B61LZ50T.js";
3
3
  export { type BarrelType, defineConfig };
package/dist/config.js CHANGED
@@ -1 +1 @@
1
- export { t as defineConfig } from "./defineConfig-C6FXk_hU.js";
1
+ export { t as defineConfig } from "./defineConfig-PEzMQys7.js";
@@ -12,15 +12,9 @@ type PossiblePromise<T> = Promise<T> | T;
12
12
  type ConfigResult<TInput> = UserConfig<TInput> | Array<UserConfig<TInput>>;
13
13
  type ConfigFunction<TInput, TResult extends ConfigResult<TInput>> = (cli: CLIOptions) => PossiblePromise<TResult>;
14
14
  /**
15
- * Defines a Kubb build configuration and fills in defaults for any omitted fields.
16
- *
17
- * Defaults applied when omitted:
18
- * - `adapter` → `adapterOas()` (OpenAPI 2.0/3.0/3.1).
19
- * - `parsers` → `[parserTs(), parserTsx(), parserMd()]`.
20
- * - `reporters` → `[cliReporter, jsonReporter, fileReporter, htmlReporter]`.
21
- * - `plugins` → `pluginBarrel()` is appended when not already present.
22
- * - `output.barrel` → `false` when not set.
23
- * - `output.format` and `output.lint` → `false`.
15
+ * Defines a Kubb build configuration and fills in defaults for any omitted fields: the OpenAPI adapter,
16
+ * the TypeScript, TSX and Markdown parsers, the reporters, `pluginBarrel()`, and `output.barrel`,
17
+ * `output.format` and `output.lint` set to `false`.
24
18
  *
25
19
  * Accepts a config object, an array of configs, a Promise resolving to one,
26
20
  * or a function that receives the parsed CLI options and returns any of the
@@ -12,15 +12,9 @@ type PossiblePromise<T> = Promise<T> | T;
12
12
  type ConfigResult<TInput> = UserConfig<TInput> | Array<UserConfig<TInput>>;
13
13
  type ConfigFunction<TInput, TResult extends ConfigResult<TInput>> = (cli: CLIOptions) => PossiblePromise<TResult>;
14
14
  /**
15
- * Defines a Kubb build configuration and fills in defaults for any omitted fields.
16
- *
17
- * Defaults applied when omitted:
18
- * - `adapter` → `adapterOas()` (OpenAPI 2.0/3.0/3.1).
19
- * - `parsers` → `[parserTs(), parserTsx(), parserMd()]`.
20
- * - `reporters` → `[cliReporter, jsonReporter, fileReporter, htmlReporter]`.
21
- * - `plugins` → `pluginBarrel()` is appended when not already present.
22
- * - `output.barrel` → `false` when not set.
23
- * - `output.format` and `output.lint` → `false`.
15
+ * Defines a Kubb build configuration and fills in defaults for any omitted fields: the OpenAPI adapter,
16
+ * the TypeScript, TSX and Markdown parsers, the reporters, `pluginBarrel()`, and `output.barrel`,
17
+ * `output.format` and `output.lint` set to `false`.
24
18
  *
25
19
  * Accepts a config object, an array of configs, a Promise resolving to one,
26
20
  * or a function that receives the parsed CLI options and returns any of the
@@ -0,0 +1,54 @@
1
+ import { adapterOas } from "@kubb/adapter-oas";
2
+ import { cliReporter, fileReporter, htmlReporter, jsonReporter } from "@kubb/core";
3
+ import { parserMd } from "@kubb/parser-md";
4
+ import { parserTs, parserTsx } from "@kubb/parser-ts";
5
+ import { pluginBarrel, pluginBarrelName } from "@kubb/plugin-barrel";
6
+ // \0rolldown/runtime.js
7
+ var __defProp = Object.defineProperty;
8
+ var __name = (target, value) => __defProp(target, "name", {
9
+ value,
10
+ configurable: true
11
+ });
12
+ // ../../internals/shared/src/defaults.ts
13
+ /**
14
+ * Fills what a user config leaves out: `adapterOas()`, the TypeScript, TSX and Markdown parsers, the reporters,
15
+ * `pluginBarrel()`, and `false` for `output.barrel`, `output.format` and `output.lint`.
16
+ */
17
+ function applyDefaults(config) {
18
+ const plugins = config.plugins ?? [];
19
+ return {
20
+ ...config,
21
+ adapter: config.adapter ?? adapterOas(),
22
+ parsers: config.parsers?.length ? config.parsers : [
23
+ parserTs(),
24
+ parserTsx(),
25
+ parserMd()
26
+ ],
27
+ reporters: config.reporters?.length ? config.reporters : [
28
+ cliReporter,
29
+ jsonReporter,
30
+ fileReporter,
31
+ htmlReporter
32
+ ],
33
+ plugins: plugins.some((plugin) => plugin.name === pluginBarrelName) ? plugins : [...plugins, pluginBarrel()],
34
+ output: {
35
+ barrel: false,
36
+ format: false,
37
+ lint: false,
38
+ ...config.output
39
+ }
40
+ };
41
+ }
42
+ // src/defineConfig.ts
43
+ function normalizeConfig(config) {
44
+ if (Array.isArray(config)) return config.map(applyDefaults);
45
+ return applyDefaults(config);
46
+ }
47
+ function defineConfig(config) {
48
+ if (typeof config === "function") return async (cli) => normalizeConfig(await config(cli));
49
+ if (config instanceof Promise) return config.then(normalizeConfig);
50
+ return normalizeConfig(config);
51
+ }
52
+ export { __name as n, defineConfig as t };
53
+
54
+ //# sourceMappingURL=defineConfig-PEzMQys7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineConfig-PEzMQys7.js","names":[],"sources":["../../../internals/shared/src/defaults.ts","../src/defineConfig.ts"],"sourcesContent":["import { adapterOas } from '@kubb/adapter-oas'\nimport { cliReporter, fileReporter, htmlReporter, jsonReporter, type UserConfig } from '@kubb/core'\nimport { parserMd } from '@kubb/parser-md'\nimport { parserTs, parserTsx } from '@kubb/parser-ts'\nimport { pluginBarrel, pluginBarrelName } from '@kubb/plugin-barrel'\n\n/**\n * Fills what a user config leaves out: `adapterOas()`, the TypeScript, TSX and Markdown parsers, the reporters,\n * `pluginBarrel()`, and `false` for `output.barrel`, `output.format` and `output.lint`.\n */\nexport function applyDefaults<TInput>(config: UserConfig<TInput>): UserConfig<TInput> {\n const plugins = config.plugins ?? []\n\n return {\n ...config,\n adapter: config.adapter ?? adapterOas(),\n parsers: config.parsers?.length ? config.parsers : [parserTs(), parserTsx(), parserMd()],\n reporters: config.reporters?.length ? config.reporters : [cliReporter, jsonReporter, fileReporter, htmlReporter],\n plugins: plugins.some((plugin) => plugin.name === pluginBarrelName) ? plugins : [...plugins, pluginBarrel()],\n output: { barrel: false, format: false, lint: false, ...config.output },\n }\n}\n","import type { PossiblePromise } from '@internals/utils'\nimport type { CLIOptions, UserConfig } from '@kubb/core'\nimport { applyDefaults } from '@internals/shared/defaults'\n\nexport type ConfigResult<TInput> = UserConfig<TInput> | Array<UserConfig<TInput>>\nexport type ConfigFunction<TInput, TResult extends ConfigResult<TInput>> = (cli: CLIOptions) => PossiblePromise<TResult>\n\nfunction normalizeConfig<TInput>(config: ConfigResult<TInput>): ConfigResult<TInput> {\n if (Array.isArray(config)) {\n return config.map(applyDefaults)\n }\n\n return applyDefaults(config)\n}\n\n/**\n * Defines a Kubb build configuration and fills in defaults for any omitted fields: the OpenAPI adapter,\n * the TypeScript, TSX and Markdown parsers, the reporters, `pluginBarrel()`, and `output.barrel`,\n * `output.format` and `output.lint` set to `false`.\n *\n * Accepts a config object, an array of configs, a Promise resolving to one,\n * or a function that receives the parsed CLI options and returns any of the\n * above. The return type is preserved so async/array variants stay typed.\n *\n * Each shape has its own overload so TypeScript checks the config against\n * `UserConfig` directly and reports unknown keys such as a misspelled `output.clean`.\n * The function overloads come first: TypeScript caches the callback's return type after\n * the first overload it tries, so an object overload before them would widen literals\n * such as `barrel: { type: 'named' }` to `string`.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n *\n * export default defineConfig({\n * input: './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [pluginTs()],\n * })\n * ```\n *\n * @example Function form with CLI options\n * ```ts\n * import { defineConfig } from 'kubb'\n *\n * export default defineConfig(({ input }) => ({\n * input: input ?? './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [],\n * }))\n * ```\n */\nexport function defineConfig<TInput>(config: ConfigFunction<TInput, UserConfig<TInput>>): (cli: CLIOptions) => Promise<UserConfig<TInput>>\nexport function defineConfig<TInput>(config: ConfigFunction<TInput, Array<UserConfig<TInput>>>): (cli: CLIOptions) => Promise<Array<UserConfig<TInput>>>\nexport function defineConfig<TInput>(config: Promise<UserConfig<TInput>>): Promise<UserConfig<TInput>>\nexport function defineConfig<TInput>(config: Promise<Array<UserConfig<TInput>>>): Promise<Array<UserConfig<TInput>>>\nexport function defineConfig<TInput>(config: Array<UserConfig<TInput>>): Array<UserConfig<TInput>>\nexport function defineConfig<TInput>(config: UserConfig<TInput>): UserConfig<TInput>\nexport function defineConfig<TInput>(\n config: ConfigResult<TInput> | Promise<ConfigResult<TInput>> | ConfigFunction<TInput, ConfigResult<TInput>>,\n): ConfigResult<TInput> | Promise<ConfigResult<TInput>> | ((cli: CLIOptions) => Promise<ConfigResult<TInput>>) {\n if (typeof config === 'function') {\n return async (cli: CLIOptions) => normalizeConfig(await config(cli))\n }\n\n if (config instanceof Promise) {\n return config.then(normalizeConfig)\n }\n\n return normalizeConfig(config)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAUA,SAAgB,cAAsB,QAAgD;CACpF,MAAM,UAAU,OAAO,WAAW,CAAC;CAEnC,OAAO;EACL,GAAG;EACH,SAAS,OAAO,WAAW,WAAW;EACtC,SAAS,OAAO,SAAS,SAAS,OAAO,UAAU;GAAC,SAAS;GAAG,UAAU;GAAG,SAAS;EAAC;EACvF,WAAW,OAAO,WAAW,SAAS,OAAO,YAAY;GAAC;GAAa;GAAc;GAAc;EAAY;EAC/G,SAAS,QAAQ,MAAM,WAAW,OAAO,SAAS,gBAAgB,IAAI,UAAU,CAAC,GAAG,SAAS,aAAa,CAAC;EAC3G,QAAQ;GAAE,QAAQ;GAAO,QAAQ;GAAO,MAAM;GAAO,GAAG,OAAO;EAAO;CACxE;AACF;;ACdA,SAAS,gBAAwB,QAAoD;CACnF,IAAI,MAAM,QAAQ,MAAM,GACtB,OAAO,OAAO,IAAI,aAAa;CAGjC,OAAO,cAAc,MAAM;AAC7B;AA8CA,SAAgB,aACd,QAC6G;CAC7G,IAAI,OAAO,WAAW,YACpB,OAAO,OAAO,QAAoB,gBAAgB,MAAM,OAAO,GAAG,CAAC;CAGrE,IAAI,kBAAkB,SACpB,OAAO,OAAO,KAAK,eAAe;CAGpC,OAAO,gBAAgB,MAAM;AAC/B"}
@@ -0,0 +1,65 @@
1
+ // \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", {
4
+ value,
5
+ configurable: true
6
+ });
7
+ let _kubb_adapter_oas = require("@kubb/adapter-oas");
8
+ let _kubb_core = require("@kubb/core");
9
+ let _kubb_parser_md = require("@kubb/parser-md");
10
+ let _kubb_parser_ts = require("@kubb/parser-ts");
11
+ let _kubb_plugin_barrel = require("@kubb/plugin-barrel");
12
+ // ../../internals/shared/src/defaults.ts
13
+ /**
14
+ * Fills what a user config leaves out: `adapterOas()`, the TypeScript, TSX and Markdown parsers, the reporters,
15
+ * `pluginBarrel()`, and `false` for `output.barrel`, `output.format` and `output.lint`.
16
+ */
17
+ function applyDefaults(config) {
18
+ const plugins = config.plugins ?? [];
19
+ return {
20
+ ...config,
21
+ adapter: config.adapter ?? (0, _kubb_adapter_oas.adapterOas)(),
22
+ parsers: config.parsers?.length ? config.parsers : [
23
+ (0, _kubb_parser_ts.parserTs)(),
24
+ (0, _kubb_parser_ts.parserTsx)(),
25
+ (0, _kubb_parser_md.parserMd)()
26
+ ],
27
+ reporters: config.reporters?.length ? config.reporters : [
28
+ _kubb_core.cliReporter,
29
+ _kubb_core.jsonReporter,
30
+ _kubb_core.fileReporter,
31
+ _kubb_core.htmlReporter
32
+ ],
33
+ plugins: plugins.some((plugin) => plugin.name === _kubb_plugin_barrel.pluginBarrelName) ? plugins : [...plugins, (0, _kubb_plugin_barrel.pluginBarrel)()],
34
+ output: {
35
+ barrel: false,
36
+ format: false,
37
+ lint: false,
38
+ ...config.output
39
+ }
40
+ };
41
+ }
42
+ // src/defineConfig.ts
43
+ function normalizeConfig(config) {
44
+ if (Array.isArray(config)) return config.map(applyDefaults);
45
+ return applyDefaults(config);
46
+ }
47
+ function defineConfig(config) {
48
+ if (typeof config === "function") return async (cli) => normalizeConfig(await config(cli));
49
+ if (config instanceof Promise) return config.then(normalizeConfig);
50
+ return normalizeConfig(config);
51
+ }
52
+ Object.defineProperty(exports, "__name", {
53
+ enumerable: true,
54
+ get: function() {
55
+ return __name;
56
+ }
57
+ });
58
+ Object.defineProperty(exports, "defineConfig", {
59
+ enumerable: true,
60
+ get: function() {
61
+ return defineConfig;
62
+ }
63
+ });
64
+
65
+ //# sourceMappingURL=defineConfig-xAM0up_v.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineConfig-xAM0up_v.cjs","names":["adapterOas","parserTs","parserTsx","parserMd","cliReporter","jsonReporter","fileReporter","htmlReporter","pluginBarrelName","pluginBarrel"],"sources":["../../../internals/shared/src/defaults.ts","../src/defineConfig.ts"],"sourcesContent":["import { adapterOas } from '@kubb/adapter-oas'\nimport { cliReporter, fileReporter, htmlReporter, jsonReporter, type UserConfig } from '@kubb/core'\nimport { parserMd } from '@kubb/parser-md'\nimport { parserTs, parserTsx } from '@kubb/parser-ts'\nimport { pluginBarrel, pluginBarrelName } from '@kubb/plugin-barrel'\n\n/**\n * Fills what a user config leaves out: `adapterOas()`, the TypeScript, TSX and Markdown parsers, the reporters,\n * `pluginBarrel()`, and `false` for `output.barrel`, `output.format` and `output.lint`.\n */\nexport function applyDefaults<TInput>(config: UserConfig<TInput>): UserConfig<TInput> {\n const plugins = config.plugins ?? []\n\n return {\n ...config,\n adapter: config.adapter ?? adapterOas(),\n parsers: config.parsers?.length ? config.parsers : [parserTs(), parserTsx(), parserMd()],\n reporters: config.reporters?.length ? config.reporters : [cliReporter, jsonReporter, fileReporter, htmlReporter],\n plugins: plugins.some((plugin) => plugin.name === pluginBarrelName) ? plugins : [...plugins, pluginBarrel()],\n output: { barrel: false, format: false, lint: false, ...config.output },\n }\n}\n","import type { PossiblePromise } from '@internals/utils'\nimport type { CLIOptions, UserConfig } from '@kubb/core'\nimport { applyDefaults } from '@internals/shared/defaults'\n\nexport type ConfigResult<TInput> = UserConfig<TInput> | Array<UserConfig<TInput>>\nexport type ConfigFunction<TInput, TResult extends ConfigResult<TInput>> = (cli: CLIOptions) => PossiblePromise<TResult>\n\nfunction normalizeConfig<TInput>(config: ConfigResult<TInput>): ConfigResult<TInput> {\n if (Array.isArray(config)) {\n return config.map(applyDefaults)\n }\n\n return applyDefaults(config)\n}\n\n/**\n * Defines a Kubb build configuration and fills in defaults for any omitted fields: the OpenAPI adapter,\n * the TypeScript, TSX and Markdown parsers, the reporters, `pluginBarrel()`, and `output.barrel`,\n * `output.format` and `output.lint` set to `false`.\n *\n * Accepts a config object, an array of configs, a Promise resolving to one,\n * or a function that receives the parsed CLI options and returns any of the\n * above. The return type is preserved so async/array variants stay typed.\n *\n * Each shape has its own overload so TypeScript checks the config against\n * `UserConfig` directly and reports unknown keys such as a misspelled `output.clean`.\n * The function overloads come first: TypeScript caches the callback's return type after\n * the first overload it tries, so an object overload before them would widen literals\n * such as `barrel: { type: 'named' }` to `string`.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n *\n * export default defineConfig({\n * input: './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [pluginTs()],\n * })\n * ```\n *\n * @example Function form with CLI options\n * ```ts\n * import { defineConfig } from 'kubb'\n *\n * export default defineConfig(({ input }) => ({\n * input: input ?? './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [],\n * }))\n * ```\n */\nexport function defineConfig<TInput>(config: ConfigFunction<TInput, UserConfig<TInput>>): (cli: CLIOptions) => Promise<UserConfig<TInput>>\nexport function defineConfig<TInput>(config: ConfigFunction<TInput, Array<UserConfig<TInput>>>): (cli: CLIOptions) => Promise<Array<UserConfig<TInput>>>\nexport function defineConfig<TInput>(config: Promise<UserConfig<TInput>>): Promise<UserConfig<TInput>>\nexport function defineConfig<TInput>(config: Promise<Array<UserConfig<TInput>>>): Promise<Array<UserConfig<TInput>>>\nexport function defineConfig<TInput>(config: Array<UserConfig<TInput>>): Array<UserConfig<TInput>>\nexport function defineConfig<TInput>(config: UserConfig<TInput>): UserConfig<TInput>\nexport function defineConfig<TInput>(\n config: ConfigResult<TInput> | Promise<ConfigResult<TInput>> | ConfigFunction<TInput, ConfigResult<TInput>>,\n): ConfigResult<TInput> | Promise<ConfigResult<TInput>> | ((cli: CLIOptions) => Promise<ConfigResult<TInput>>) {\n if (typeof config === 'function') {\n return async (cli: CLIOptions) => normalizeConfig(await config(cli))\n }\n\n if (config instanceof Promise) {\n return config.then(normalizeConfig)\n }\n\n return normalizeConfig(config)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAUA,SAAgB,cAAsB,QAAgD;CACpF,MAAM,UAAU,OAAO,WAAW,CAAC;CAEnC,OAAO;EACL,GAAG;EACH,SAAS,OAAO,YAAA,GAAWA,kBAAAA,WAAAA,CAAW;EACtC,SAAS,OAAO,SAAS,SAAS,OAAO,UAAU;IAACC,GAAAA,gBAAAA,SAAAA,CAAS;IAAGC,GAAAA,gBAAAA,UAAAA,CAAU;IAAGC,GAAAA,gBAAAA,SAAAA,CAAS;EAAC;EACvF,WAAW,OAAO,WAAW,SAAS,OAAO,YAAY;GAACC,WAAAA;GAAaC,WAAAA;GAAcC,WAAAA;GAAcC,WAAAA;EAAY;EAC/G,SAAS,QAAQ,MAAM,WAAW,OAAO,SAASC,oBAAAA,gBAAgB,IAAI,UAAU,CAAC,GAAG,UAAA,GAASC,oBAAAA,aAAAA,CAAa,CAAC;EAC3G,QAAQ;GAAE,QAAQ;GAAO,QAAQ;GAAO,MAAM;GAAO,GAAG,OAAO;EAAO;CACxE;AACF;;ACdA,SAAS,gBAAwB,QAAoD;CACnF,IAAI,MAAM,QAAQ,MAAM,GACtB,OAAO,OAAO,IAAI,aAAa;CAGjC,OAAO,cAAc,MAAM;AAC7B;AA8CA,SAAgB,aACd,QAC6G;CAC7G,IAAI,OAAO,WAAW,YACpB,OAAO,OAAO,QAAoB,gBAAgB,MAAM,OAAO,GAAG,CAAC;CAGrE,IAAI,kBAAkB,SACpB,OAAO,OAAO,KAAK,eAAe;CAGpC,OAAO,gBAAgB,MAAM;AAC/B"}
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let _kubb_core = require("@kubb/core");
3
- const require_defineConfig = require("./defineConfig-tpUKTeYn.cjs");
3
+ const require_defineConfig = require("./defineConfig-xAM0up_v.cjs");
4
4
  // src/createKubb.ts
5
5
  /**
6
6
  * Creates a Kubb instance with the same defaults as `defineConfig`.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BuildOutput, Config, CreateKubbOptions, Kubb, Kubb as Kubb$1, KubbOptions, KubbOptions as KubbOptions$1, UserConfig, UserConfig as UserConfig$1 } from "@kubb/core";
2
2
  import { BarrelType } from "@kubb/plugin-barrel";
3
- import { t as defineConfig } from "./defineConfig-BaD4Rwdn.cjs";
3
+ import { t as defineConfig } from "./defineConfig-ChY_4BJ5.cjs";
4
4
  /**
5
5
  * Creates a Kubb instance with the same defaults as `defineConfig`.
6
6
  */
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BuildOutput, Config, CreateKubbOptions, Kubb, Kubb as Kubb$1, KubbOptions, KubbOptions as KubbOptions$1, UserConfig, UserConfig as UserConfig$1 } from "@kubb/core";
2
2
  import { BarrelType } from "@kubb/plugin-barrel";
3
- import { t as defineConfig } from "./defineConfig-BaE5GaMK.js";
3
+ import { t as defineConfig } from "./defineConfig-B61LZ50T.js";
4
4
  /**
5
5
  * Creates a Kubb instance with the same defaults as `defineConfig`.
6
6
  */
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createKubb as createKubb$1 } from "@kubb/core";
2
- import { t as defineConfig } from "./defineConfig-C6FXk_hU.js";
2
+ import { t as defineConfig } from "./defineConfig-PEzMQys7.js";
3
3
  // src/createKubb.ts
4
4
  /**
5
5
  * Creates a Kubb instance with the same defaults as `defineConfig`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kubb",
3
- "version": "5.28.6",
3
+ "version": "5.29.1",
4
4
  "description": "Turn your API spec into type-safe code. Generate TypeScript types, API clients, hooks, validators and mocks from a spec such as OpenAPI.",
5
5
  "keywords": [
6
6
  "api-client",
@@ -164,29 +164,30 @@
164
164
  "registry": "https://registry.npmjs.org/"
165
165
  },
166
166
  "dependencies": {
167
- "@kubb/adapter-oas": "5.28.6",
168
- "@kubb/ast": "5.28.6",
169
- "@kubb/cli": "5.28.6",
170
- "@kubb/core": "5.28.6",
171
- "@kubb/kit": "5.28.6",
172
- "@kubb/mcp": "5.28.6",
173
- "@kubb/parser-md": "5.28.6",
174
- "@kubb/parser-ts": "5.28.6",
175
- "@kubb/plugin-barrel": "5.28.6",
176
- "@kubb/renderer-jsx": "5.28.6",
177
- "@kubb/studio": "5.28.6",
178
- "unplugin-kubb": "5.28.6"
167
+ "@kubb/adapter-oas": "5.29.1",
168
+ "@kubb/ast": "5.29.1",
169
+ "@kubb/cli": "5.29.1",
170
+ "@kubb/core": "5.29.1",
171
+ "@kubb/kit": "5.29.1",
172
+ "@kubb/mcp": "5.29.1",
173
+ "@kubb/parser-md": "5.29.1",
174
+ "@kubb/parser-ts": "5.29.1",
175
+ "@kubb/plugin-barrel": "5.29.1",
176
+ "@kubb/renderer-jsx": "5.29.1",
177
+ "@kubb/studio": "5.29.1",
178
+ "unplugin-kubb": "5.29.1"
179
179
  },
180
180
  "devDependencies": {
181
181
  "@farmfe/core": "^2.0.1",
182
+ "@internals/shared": "0.0.1",
182
183
  "@internals/utils": "0.0.1",
183
184
  "@nuxt/kit": "^4.7.0",
184
185
  "@nuxt/schema": "^4.7.0",
185
186
  "esbuild": "^0.28.2",
186
- "rolldown": "^1.3.3",
187
+ "rolldown": "^1.3.4",
187
188
  "rollup": "^4.68.8",
188
189
  "typescript": "^7.0.2",
189
- "vite": "^8.3.8",
190
+ "vite": "^8.4.0",
190
191
  "webpack": "^5.113.0"
191
192
  },
192
193
  "preferGlobal": true,
@@ -1,20 +0,0 @@
1
- import { applyDefaults } from "unplugin-kubb";
2
- // \0rolldown/runtime.js
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", {
5
- value,
6
- configurable: true
7
- });
8
- // src/defineConfig.ts
9
- function normalizeConfig(config) {
10
- if (Array.isArray(config)) return config.map(applyDefaults);
11
- return applyDefaults(config);
12
- }
13
- function defineConfig(config) {
14
- if (typeof config === "function") return async (cli) => normalizeConfig(await config(cli));
15
- if (config instanceof Promise) return config.then(normalizeConfig);
16
- return normalizeConfig(config);
17
- }
18
- export { __name as n, defineConfig as t };
19
-
20
- //# sourceMappingURL=defineConfig-C6FXk_hU.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defineConfig-C6FXk_hU.js","names":[],"sources":["../src/defineConfig.ts"],"sourcesContent":["import type { PossiblePromise } from '@internals/utils'\nimport type { CLIOptions, UserConfig } from '@kubb/core'\nimport { applyDefaults } from 'unplugin-kubb'\n\nexport type ConfigResult<TInput> = UserConfig<TInput> | Array<UserConfig<TInput>>\nexport type ConfigFunction<TInput, TResult extends ConfigResult<TInput>> = (cli: CLIOptions) => PossiblePromise<TResult>\n\nfunction normalizeConfig<TInput>(config: ConfigResult<TInput>): ConfigResult<TInput> {\n if (Array.isArray(config)) {\n return config.map(applyDefaults)\n }\n\n return applyDefaults(config)\n}\n\n/**\n * Defines a Kubb build configuration and fills in defaults for any omitted fields.\n *\n * Defaults applied when omitted:\n * - `adapter` → `adapterOas()` (OpenAPI 2.0/3.0/3.1).\n * - `parsers` → `[parserTs(), parserTsx(), parserMd()]`.\n * - `reporters` → `[cliReporter, jsonReporter, fileReporter, htmlReporter]`.\n * - `plugins` → `pluginBarrel()` is appended when not already present.\n * - `output.barrel` → `false` when not set.\n * - `output.format` and `output.lint` → `false`.\n *\n * Accepts a config object, an array of configs, a Promise resolving to one,\n * or a function that receives the parsed CLI options and returns any of the\n * above. The return type is preserved so async/array variants stay typed.\n *\n * Each shape has its own overload so TypeScript checks the config against\n * `UserConfig` directly and reports unknown keys such as a misspelled `output.clean`.\n * The function overloads come first: TypeScript caches the callback's return type after\n * the first overload it tries, so an object overload before them would widen literals\n * such as `barrel: { type: 'named' }` to `string`.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n *\n * export default defineConfig({\n * input: './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [pluginTs()],\n * })\n * ```\n *\n * @example Function form with CLI options\n * ```ts\n * import { defineConfig } from 'kubb'\n *\n * export default defineConfig(({ input }) => ({\n * input: input ?? './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [],\n * }))\n * ```\n */\nexport function defineConfig<TInput>(config: ConfigFunction<TInput, UserConfig<TInput>>): (cli: CLIOptions) => Promise<UserConfig<TInput>>\nexport function defineConfig<TInput>(config: ConfigFunction<TInput, Array<UserConfig<TInput>>>): (cli: CLIOptions) => Promise<Array<UserConfig<TInput>>>\nexport function defineConfig<TInput>(config: Promise<UserConfig<TInput>>): Promise<UserConfig<TInput>>\nexport function defineConfig<TInput>(config: Promise<Array<UserConfig<TInput>>>): Promise<Array<UserConfig<TInput>>>\nexport function defineConfig<TInput>(config: Array<UserConfig<TInput>>): Array<UserConfig<TInput>>\nexport function defineConfig<TInput>(config: UserConfig<TInput>): UserConfig<TInput>\nexport function defineConfig<TInput>(\n config: ConfigResult<TInput> | Promise<ConfigResult<TInput>> | ConfigFunction<TInput, ConfigResult<TInput>>,\n): ConfigResult<TInput> | Promise<ConfigResult<TInput>> | ((cli: CLIOptions) => Promise<ConfigResult<TInput>>) {\n if (typeof config === 'function') {\n return async (cli: CLIOptions) => normalizeConfig(await config(cli))\n }\n\n if (config instanceof Promise) {\n return config.then(normalizeConfig)\n }\n\n return normalizeConfig(config)\n}\n"],"mappings":";;;;;;;;AAOA,SAAS,gBAAwB,QAAoD;CACnF,IAAI,MAAM,QAAQ,MAAM,GACtB,OAAO,OAAO,IAAI,aAAa;CAGjC,OAAO,cAAc,MAAM;AAC7B;AAoDA,SAAgB,aACd,QAC6G;CAC7G,IAAI,OAAO,WAAW,YACpB,OAAO,OAAO,QAAoB,gBAAgB,MAAM,OAAO,GAAG,CAAC;CAGrE,IAAI,kBAAkB,SACpB,OAAO,OAAO,KAAK,eAAe;CAGpC,OAAO,gBAAgB,MAAM;AAC/B"}
@@ -1,31 +0,0 @@
1
- // \0rolldown/runtime.js
2
- var __defProp = Object.defineProperty;
3
- var __name = (target, value) => __defProp(target, "name", {
4
- value,
5
- configurable: true
6
- });
7
- let unplugin_kubb = require("unplugin-kubb");
8
- // src/defineConfig.ts
9
- function normalizeConfig(config) {
10
- if (Array.isArray(config)) return config.map(unplugin_kubb.applyDefaults);
11
- return (0, unplugin_kubb.applyDefaults)(config);
12
- }
13
- function defineConfig(config) {
14
- if (typeof config === "function") return async (cli) => normalizeConfig(await config(cli));
15
- if (config instanceof Promise) return config.then(normalizeConfig);
16
- return normalizeConfig(config);
17
- }
18
- Object.defineProperty(exports, "__name", {
19
- enumerable: true,
20
- get: function() {
21
- return __name;
22
- }
23
- });
24
- Object.defineProperty(exports, "defineConfig", {
25
- enumerable: true,
26
- get: function() {
27
- return defineConfig;
28
- }
29
- });
30
-
31
- //# sourceMappingURL=defineConfig-tpUKTeYn.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defineConfig-tpUKTeYn.cjs","names":["applyDefaults"],"sources":["../src/defineConfig.ts"],"sourcesContent":["import type { PossiblePromise } from '@internals/utils'\nimport type { CLIOptions, UserConfig } from '@kubb/core'\nimport { applyDefaults } from 'unplugin-kubb'\n\nexport type ConfigResult<TInput> = UserConfig<TInput> | Array<UserConfig<TInput>>\nexport type ConfigFunction<TInput, TResult extends ConfigResult<TInput>> = (cli: CLIOptions) => PossiblePromise<TResult>\n\nfunction normalizeConfig<TInput>(config: ConfigResult<TInput>): ConfigResult<TInput> {\n if (Array.isArray(config)) {\n return config.map(applyDefaults)\n }\n\n return applyDefaults(config)\n}\n\n/**\n * Defines a Kubb build configuration and fills in defaults for any omitted fields.\n *\n * Defaults applied when omitted:\n * - `adapter` → `adapterOas()` (OpenAPI 2.0/3.0/3.1).\n * - `parsers` → `[parserTs(), parserTsx(), parserMd()]`.\n * - `reporters` → `[cliReporter, jsonReporter, fileReporter, htmlReporter]`.\n * - `plugins` → `pluginBarrel()` is appended when not already present.\n * - `output.barrel` → `false` when not set.\n * - `output.format` and `output.lint` → `false`.\n *\n * Accepts a config object, an array of configs, a Promise resolving to one,\n * or a function that receives the parsed CLI options and returns any of the\n * above. The return type is preserved so async/array variants stay typed.\n *\n * Each shape has its own overload so TypeScript checks the config against\n * `UserConfig` directly and reports unknown keys such as a misspelled `output.clean`.\n * The function overloads come first: TypeScript caches the callback's return type after\n * the first overload it tries, so an object overload before them would widen literals\n * such as `barrel: { type: 'named' }` to `string`.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n *\n * export default defineConfig({\n * input: './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [pluginTs()],\n * })\n * ```\n *\n * @example Function form with CLI options\n * ```ts\n * import { defineConfig } from 'kubb'\n *\n * export default defineConfig(({ input }) => ({\n * input: input ?? './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [],\n * }))\n * ```\n */\nexport function defineConfig<TInput>(config: ConfigFunction<TInput, UserConfig<TInput>>): (cli: CLIOptions) => Promise<UserConfig<TInput>>\nexport function defineConfig<TInput>(config: ConfigFunction<TInput, Array<UserConfig<TInput>>>): (cli: CLIOptions) => Promise<Array<UserConfig<TInput>>>\nexport function defineConfig<TInput>(config: Promise<UserConfig<TInput>>): Promise<UserConfig<TInput>>\nexport function defineConfig<TInput>(config: Promise<Array<UserConfig<TInput>>>): Promise<Array<UserConfig<TInput>>>\nexport function defineConfig<TInput>(config: Array<UserConfig<TInput>>): Array<UserConfig<TInput>>\nexport function defineConfig<TInput>(config: UserConfig<TInput>): UserConfig<TInput>\nexport function defineConfig<TInput>(\n config: ConfigResult<TInput> | Promise<ConfigResult<TInput>> | ConfigFunction<TInput, ConfigResult<TInput>>,\n): ConfigResult<TInput> | Promise<ConfigResult<TInput>> | ((cli: CLIOptions) => Promise<ConfigResult<TInput>>) {\n if (typeof config === 'function') {\n return async (cli: CLIOptions) => normalizeConfig(await config(cli))\n }\n\n if (config instanceof Promise) {\n return config.then(normalizeConfig)\n }\n\n return normalizeConfig(config)\n}\n"],"mappings":";;;;;;;;AAOA,SAAS,gBAAwB,QAAoD;CACnF,IAAI,MAAM,QAAQ,MAAM,GACtB,OAAO,OAAO,IAAIA,cAAAA,aAAa;CAGjC,QAAA,GAAOA,cAAAA,cAAAA,CAAc,MAAM;AAC7B;AAoDA,SAAgB,aACd,QAC6G;CAC7G,IAAI,OAAO,WAAW,YACpB,OAAO,OAAO,QAAoB,gBAAgB,MAAM,OAAO,GAAG,CAAC;CAGrE,IAAI,kBAAkB,SACpB,OAAO,OAAO,KAAK,eAAe;CAGpC,OAAO,gBAAgB,MAAM;AAC/B"}