kubb 5.11.5 → 5.12.0

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/config.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_defineConfig = require("./defineConfig-CAlKKmP5.cjs");
2
+ const require_defineConfig = require("./defineConfig-DtKDtaUR.cjs");
3
3
  exports.defineConfig = require_defineConfig.defineConfig;
package/dist/config.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- import { t as defineConfig } from "./defineConfig-Dw_FP2Nv.cjs";
1
+ import { t as defineConfig } from "./defineConfig-DbD-Nz8V.cjs";
2
2
  import { BarrelType } from "@kubb/plugin-barrel";
3
3
  export { type BarrelType, defineConfig };
package/dist/config.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { t as defineConfig } from "./defineConfig-Dw_FP2Nv.js";
1
+ import { t as defineConfig } from "./defineConfig-DbD-Nz8V.js";
2
2
  import { BarrelType } from "@kubb/plugin-barrel";
3
3
  export { type BarrelType, defineConfig };
package/dist/config.js CHANGED
@@ -1 +1 @@
1
- export { t as defineConfig } from "./defineConfig-EWSTl_g4.js";
1
+ export { t as defineConfig } from "./defineConfig-CpyWWFBM.js";
@@ -0,0 +1,22 @@
1
+ import { applyDefaults } from "unplugin-kubb";
2
+ //#region \0rolldown/runtime.js
3
+ var __defProp = Object.defineProperty;
4
+ var __name = (target, value) => __defProp(target, "name", {
5
+ value,
6
+ configurable: true
7
+ });
8
+ //#endregion
9
+ //#region src/defineConfig.ts
10
+ function normalizeConfig(config) {
11
+ if (Array.isArray(config)) return config.map(applyDefaults);
12
+ return applyDefaults(config);
13
+ }
14
+ function defineConfig(config) {
15
+ if (typeof config === "function") return async (cli) => normalizeConfig(await config(cli));
16
+ if (config instanceof Promise) return config.then(normalizeConfig);
17
+ return normalizeConfig(config);
18
+ }
19
+ //#endregion
20
+ export { __name as n, defineConfig as t };
21
+
22
+ //# sourceMappingURL=defineConfig-CpyWWFBM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineConfig-CpyWWFBM.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\ntype ConfigResult<TInput> = UserConfig<TInput> | Array<UserConfig<TInput>>\ntype 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"}
@@ -12,10 +12,8 @@ import { CLIOptions, UserConfig } from "@kubb/core";
12
12
  type PossiblePromise<T> = Promise<T> | T;
13
13
  //#endregion
14
14
  //#region src/defineConfig.d.ts
15
- type AnyConfigResult = UserConfig<unknown> | Array<UserConfig<unknown>>;
16
- type ConfigInput = AnyConfigResult | Promise<AnyConfigResult> | ((cli: CLIOptions) => PossiblePromise<AnyConfigResult>);
17
- type NormalizeConfig<TConfig> = TConfig extends Array<UserConfig<infer TInput>> ? Array<UserConfig<TInput>> : TConfig extends UserConfig<infer TInput> ? UserConfig<TInput> : never;
18
- type DefinedConfig<TConfig extends ConfigInput> = TConfig extends ((cli: CLIOptions) => PossiblePromise<infer TResult>) ? (cli: CLIOptions) => Promise<NormalizeConfig<TResult>> : TConfig extends Promise<infer TResult> ? Promise<NormalizeConfig<TResult>> : NormalizeConfig<TConfig>;
15
+ type ConfigResult<TInput> = UserConfig<TInput> | Array<UserConfig<TInput>>;
16
+ type ConfigFunction<TInput, TResult extends ConfigResult<TInput>> = (cli: CLIOptions) => PossiblePromise<TResult>;
19
17
  /**
20
18
  * Defines a Kubb build configuration and fills in defaults for any omitted fields.
21
19
  *
@@ -31,6 +29,12 @@ type DefinedConfig<TConfig extends ConfigInput> = TConfig extends ((cli: CLIOpti
31
29
  * or a function that receives the parsed CLI options and returns any of the
32
30
  * above. The return type is preserved so async/array variants stay typed.
33
31
  *
32
+ * Each shape has its own overload so TypeScript checks the config against
33
+ * `UserConfig` directly and reports unknown keys such as a misspelled `output.clean`.
34
+ * The function overloads come first: TypeScript caches the callback's return type after
35
+ * the first overload it tries, so an object overload before them would widen literals
36
+ * such as `barrel: { type: 'named' }` to `string`.
37
+ *
34
38
  * @example
35
39
  * ```ts
36
40
  * import { defineConfig } from 'kubb'
@@ -54,7 +58,12 @@ type DefinedConfig<TConfig extends ConfigInput> = TConfig extends ((cli: CLIOpti
54
58
  * }))
55
59
  * ```
56
60
  */
57
- declare function defineConfig<TConfig extends ConfigInput>(config: TConfig): DefinedConfig<TConfig>;
61
+ declare function defineConfig<TInput>(config: ConfigFunction<TInput, UserConfig<TInput>>): (cli: CLIOptions) => Promise<UserConfig<TInput>>;
62
+ declare function defineConfig<TInput>(config: ConfigFunction<TInput, Array<UserConfig<TInput>>>): (cli: CLIOptions) => Promise<Array<UserConfig<TInput>>>;
63
+ declare function defineConfig<TInput>(config: Promise<UserConfig<TInput>>): Promise<UserConfig<TInput>>;
64
+ declare function defineConfig<TInput>(config: Promise<Array<UserConfig<TInput>>>): Promise<Array<UserConfig<TInput>>>;
65
+ declare function defineConfig<TInput>(config: Array<UserConfig<TInput>>): Array<UserConfig<TInput>>;
66
+ declare function defineConfig<TInput>(config: UserConfig<TInput>): UserConfig<TInput>;
58
67
  //#endregion
59
68
  export { defineConfig as t };
60
- //# sourceMappingURL=defineConfig-Dw_FP2Nv.d.ts.map
69
+ //# sourceMappingURL=defineConfig-DbD-Nz8V.d.cts.map
@@ -12,10 +12,8 @@ import { CLIOptions, UserConfig } from "@kubb/core";
12
12
  type PossiblePromise<T> = Promise<T> | T;
13
13
  //#endregion
14
14
  //#region src/defineConfig.d.ts
15
- type AnyConfigResult = UserConfig<unknown> | Array<UserConfig<unknown>>;
16
- type ConfigInput = AnyConfigResult | Promise<AnyConfigResult> | ((cli: CLIOptions) => PossiblePromise<AnyConfigResult>);
17
- type NormalizeConfig<TConfig> = TConfig extends Array<UserConfig<infer TInput>> ? Array<UserConfig<TInput>> : TConfig extends UserConfig<infer TInput> ? UserConfig<TInput> : never;
18
- type DefinedConfig<TConfig extends ConfigInput> = TConfig extends ((cli: CLIOptions) => PossiblePromise<infer TResult>) ? (cli: CLIOptions) => Promise<NormalizeConfig<TResult>> : TConfig extends Promise<infer TResult> ? Promise<NormalizeConfig<TResult>> : NormalizeConfig<TConfig>;
15
+ type ConfigResult<TInput> = UserConfig<TInput> | Array<UserConfig<TInput>>;
16
+ type ConfigFunction<TInput, TResult extends ConfigResult<TInput>> = (cli: CLIOptions) => PossiblePromise<TResult>;
19
17
  /**
20
18
  * Defines a Kubb build configuration and fills in defaults for any omitted fields.
21
19
  *
@@ -31,6 +29,12 @@ type DefinedConfig<TConfig extends ConfigInput> = TConfig extends ((cli: CLIOpti
31
29
  * or a function that receives the parsed CLI options and returns any of the
32
30
  * above. The return type is preserved so async/array variants stay typed.
33
31
  *
32
+ * Each shape has its own overload so TypeScript checks the config against
33
+ * `UserConfig` directly and reports unknown keys such as a misspelled `output.clean`.
34
+ * The function overloads come first: TypeScript caches the callback's return type after
35
+ * the first overload it tries, so an object overload before them would widen literals
36
+ * such as `barrel: { type: 'named' }` to `string`.
37
+ *
34
38
  * @example
35
39
  * ```ts
36
40
  * import { defineConfig } from 'kubb'
@@ -54,7 +58,12 @@ type DefinedConfig<TConfig extends ConfigInput> = TConfig extends ((cli: CLIOpti
54
58
  * }))
55
59
  * ```
56
60
  */
57
- declare function defineConfig<TConfig extends ConfigInput>(config: TConfig): DefinedConfig<TConfig>;
61
+ declare function defineConfig<TInput>(config: ConfigFunction<TInput, UserConfig<TInput>>): (cli: CLIOptions) => Promise<UserConfig<TInput>>;
62
+ declare function defineConfig<TInput>(config: ConfigFunction<TInput, Array<UserConfig<TInput>>>): (cli: CLIOptions) => Promise<Array<UserConfig<TInput>>>;
63
+ declare function defineConfig<TInput>(config: Promise<UserConfig<TInput>>): Promise<UserConfig<TInput>>;
64
+ declare function defineConfig<TInput>(config: Promise<Array<UserConfig<TInput>>>): Promise<Array<UserConfig<TInput>>>;
65
+ declare function defineConfig<TInput>(config: Array<UserConfig<TInput>>): Array<UserConfig<TInput>>;
66
+ declare function defineConfig<TInput>(config: UserConfig<TInput>): UserConfig<TInput>;
58
67
  //#endregion
59
68
  export { defineConfig as t };
60
- //# sourceMappingURL=defineConfig-Dw_FP2Nv.d.cts.map
69
+ //# sourceMappingURL=defineConfig-DbD-Nz8V.d.ts.map
@@ -0,0 +1,33 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", {
4
+ value,
5
+ configurable: true
6
+ });
7
+ //#endregion
8
+ let unplugin_kubb = require("unplugin-kubb");
9
+ //#region src/defineConfig.ts
10
+ function normalizeConfig(config) {
11
+ if (Array.isArray(config)) return config.map(unplugin_kubb.applyDefaults);
12
+ return (0, unplugin_kubb.applyDefaults)(config);
13
+ }
14
+ function defineConfig(config) {
15
+ if (typeof config === "function") return async (cli) => normalizeConfig(await config(cli));
16
+ if (config instanceof Promise) return config.then(normalizeConfig);
17
+ return normalizeConfig(config);
18
+ }
19
+ //#endregion
20
+ Object.defineProperty(exports, "__name", {
21
+ enumerable: true,
22
+ get: function() {
23
+ return __name;
24
+ }
25
+ });
26
+ Object.defineProperty(exports, "defineConfig", {
27
+ enumerable: true,
28
+ get: function() {
29
+ return defineConfig;
30
+ }
31
+ });
32
+
33
+ //# sourceMappingURL=defineConfig-DtKDtaUR.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineConfig-DtKDtaUR.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\ntype ConfigResult<TInput> = UserConfig<TInput> | Array<UserConfig<TInput>>\ntype 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"}
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_defineConfig = require("./defineConfig-CAlKKmP5.cjs");
2
+ const require_defineConfig = require("./defineConfig-DtKDtaUR.cjs");
3
3
  let _kubb_core = require("@kubb/core");
4
4
  //#region src/createKubb.ts
5
5
  /**
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as defineConfig } from "./defineConfig-Dw_FP2Nv.cjs";
1
+ import { t as defineConfig } from "./defineConfig-DbD-Nz8V.cjs";
2
2
  import { BuildOutput, Config, CreateKubbOptions, CreateKubbOptions as CreateKubbOptions$1, Kubb, Kubb as Kubb$1, UserConfig, UserConfig as UserConfig$1 } from "@kubb/core";
3
3
  import { BarrelType } from "@kubb/plugin-barrel";
4
4
  //#region src/createKubb.d.ts
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as defineConfig } from "./defineConfig-Dw_FP2Nv.js";
1
+ import { t as defineConfig } from "./defineConfig-DbD-Nz8V.js";
2
2
  import { BuildOutput, Config, CreateKubbOptions, CreateKubbOptions as CreateKubbOptions$1, Kubb, Kubb as Kubb$1, UserConfig, UserConfig as UserConfig$1 } from "@kubb/core";
3
3
  import { BarrelType } from "@kubb/plugin-barrel";
4
4
  //#region src/createKubb.d.ts
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as defineConfig } from "./defineConfig-EWSTl_g4.js";
1
+ import { t as defineConfig } from "./defineConfig-CpyWWFBM.js";
2
2
  import { createKubb as createKubb$1 } from "@kubb/core";
3
3
  //#region src/createKubb.ts
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kubb",
3
- "version": "5.11.5",
3
+ "version": "5.12.0",
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",
@@ -168,17 +168,17 @@
168
168
  "registry": "https://registry.npmjs.org/"
169
169
  },
170
170
  "dependencies": {
171
- "@kubb/adapter-oas": "5.11.5",
172
- "@kubb/cli": "5.11.5",
173
- "@kubb/core": "5.11.5",
174
- "@kubb/kit": "5.11.5",
175
- "@kubb/mcp": "5.11.5",
176
- "@kubb/parser-md": "5.11.5",
177
- "@kubb/parser-ts": "5.11.5",
178
- "@kubb/plugin-barrel": "5.11.5",
179
- "@kubb/renderer-jsx": "5.11.5",
180
- "@kubb/studio": "5.11.5",
181
- "unplugin-kubb": "5.11.5"
171
+ "@kubb/adapter-oas": "5.12.0",
172
+ "@kubb/cli": "5.12.0",
173
+ "@kubb/core": "5.12.0",
174
+ "@kubb/kit": "5.12.0",
175
+ "@kubb/mcp": "5.12.0",
176
+ "@kubb/parser-md": "5.12.0",
177
+ "@kubb/parser-ts": "5.12.0",
178
+ "@kubb/plugin-barrel": "5.12.0",
179
+ "@kubb/renderer-jsx": "5.12.0",
180
+ "@kubb/studio": "5.12.0",
181
+ "unplugin-kubb": "5.12.0"
182
182
  },
183
183
  "devDependencies": {
184
184
  "@farmfe/core": "^1.7.11",
@@ -187,8 +187,8 @@
187
187
  "@nuxt/schema": "^4.6.2",
188
188
  "esbuild": "^0.28.2",
189
189
  "rolldown": "^1.2.14",
190
- "rollup": "^4.64.7",
191
- "typescript": "^6.0.3",
190
+ "rollup": "^4.64.10",
191
+ "typescript": "^7.0.2",
192
192
  "vite": "^8.3.4",
193
193
  "webpack": "^5.112.0"
194
194
  },
@@ -1,73 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __defProp = Object.defineProperty;
3
- var __name = (target, value) => __defProp(target, "name", {
4
- value,
5
- configurable: true
6
- });
7
- //#endregion
8
- let unplugin_kubb = require("unplugin-kubb");
9
- //#region src/defineConfig.ts
10
- function normalizeConfig(config) {
11
- if (Array.isArray(config)) return config.map(unplugin_kubb.applyDefaults);
12
- return (0, unplugin_kubb.applyDefaults)(config);
13
- }
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`.
24
- *
25
- * Accepts a config object, an array of configs, a Promise resolving to one,
26
- * or a function that receives the parsed CLI options and returns any of the
27
- * above. The return type is preserved so async/array variants stay typed.
28
- *
29
- * @example
30
- * ```ts
31
- * import { defineConfig } from 'kubb'
32
- * import { pluginTs } from '@kubb/plugin-ts'
33
- *
34
- * export default defineConfig({
35
- * input: './petStore.yaml',
36
- * output: { path: './src/gen' },
37
- * plugins: [pluginTs()],
38
- * })
39
- * ```
40
- *
41
- * @example Function form with CLI options
42
- * ```ts
43
- * import { defineConfig } from 'kubb'
44
- *
45
- * export default defineConfig(({ input }) => ({
46
- * input: input ?? './petStore.yaml',
47
- * output: { path: './src/gen' },
48
- * plugins: [],
49
- * }))
50
- * ```
51
- */
52
- function defineConfig(config) {
53
- if (typeof config === "function") return (async (cli) => {
54
- return normalizeConfig(await config(cli));
55
- });
56
- if (config instanceof Promise) return config.then(normalizeConfig);
57
- return normalizeConfig(config);
58
- }
59
- //#endregion
60
- Object.defineProperty(exports, "__name", {
61
- enumerable: true,
62
- get: function() {
63
- return __name;
64
- }
65
- });
66
- Object.defineProperty(exports, "defineConfig", {
67
- enumerable: true,
68
- get: function() {
69
- return defineConfig;
70
- }
71
- });
72
-
73
- //# sourceMappingURL=defineConfig-CAlKKmP5.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defineConfig-CAlKKmP5.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\ntype AnyConfigResult = UserConfig<unknown> | Array<UserConfig<unknown>>\ntype ConfigInput = AnyConfigResult | Promise<AnyConfigResult> | ((cli: CLIOptions) => PossiblePromise<AnyConfigResult>)\ntype NormalizeConfig<TConfig> =\n TConfig extends Array<UserConfig<infer TInput>> ? Array<UserConfig<TInput>> : TConfig extends UserConfig<infer TInput> ? UserConfig<TInput> : never\ntype DefinedConfig<TConfig extends ConfigInput> = TConfig extends (cli: CLIOptions) => PossiblePromise<infer TResult>\n ? (cli: CLIOptions) => Promise<NormalizeConfig<TResult>>\n : TConfig extends Promise<infer TResult>\n ? Promise<NormalizeConfig<TResult>>\n : NormalizeConfig<TConfig>\n\nfunction normalizeConfig<TInput>(config: UserConfig<TInput> | Array<UserConfig<TInput>>): UserConfig<TInput> | Array<UserConfig<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 * @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<TConfig extends ConfigInput>(config: TConfig): DefinedConfig<TConfig> {\n if (typeof config === 'function') {\n return (async (cli: CLIOptions) => {\n return normalizeConfig(await config(cli))\n }) as DefinedConfig<TConfig>\n }\n\n if (config instanceof Promise) {\n return config.then(normalizeConfig) as DefinedConfig<TConfig>\n }\n\n return normalizeConfig(config) as DefinedConfig<TConfig>\n}\n"],"mappings":";;;;;;;;;AAcA,SAAS,gBAAwB,QAAwG;CACvI,IAAI,MAAM,QAAQ,MAAM,GACtB,OAAO,OAAO,IAAIA,cAAAA,aAAa;CAGjC,QAAA,GAAOA,cAAAA,cAAAA,CAAc,MAAM;AAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,aAA0C,QAAyC;CACjG,IAAI,OAAO,WAAW,YACpB,QAAQ,OAAO,QAAoB;EACjC,OAAO,gBAAgB,MAAM,OAAO,GAAG,CAAC;CAC1C;CAGF,IAAI,kBAAkB,SACpB,OAAO,OAAO,KAAK,eAAe;CAGpC,OAAO,gBAAgB,MAAM;AAC/B"}
@@ -1,62 +0,0 @@
1
- import { applyDefaults } from "unplugin-kubb";
2
- //#region \0rolldown/runtime.js
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", {
5
- value,
6
- configurable: true
7
- });
8
- //#endregion
9
- //#region src/defineConfig.ts
10
- function normalizeConfig(config) {
11
- if (Array.isArray(config)) return config.map(applyDefaults);
12
- return applyDefaults(config);
13
- }
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`.
24
- *
25
- * Accepts a config object, an array of configs, a Promise resolving to one,
26
- * or a function that receives the parsed CLI options and returns any of the
27
- * above. The return type is preserved so async/array variants stay typed.
28
- *
29
- * @example
30
- * ```ts
31
- * import { defineConfig } from 'kubb'
32
- * import { pluginTs } from '@kubb/plugin-ts'
33
- *
34
- * export default defineConfig({
35
- * input: './petStore.yaml',
36
- * output: { path: './src/gen' },
37
- * plugins: [pluginTs()],
38
- * })
39
- * ```
40
- *
41
- * @example Function form with CLI options
42
- * ```ts
43
- * import { defineConfig } from 'kubb'
44
- *
45
- * export default defineConfig(({ input }) => ({
46
- * input: input ?? './petStore.yaml',
47
- * output: { path: './src/gen' },
48
- * plugins: [],
49
- * }))
50
- * ```
51
- */
52
- function defineConfig(config) {
53
- if (typeof config === "function") return (async (cli) => {
54
- return normalizeConfig(await config(cli));
55
- });
56
- if (config instanceof Promise) return config.then(normalizeConfig);
57
- return normalizeConfig(config);
58
- }
59
- //#endregion
60
- export { __name as n, defineConfig as t };
61
-
62
- //# sourceMappingURL=defineConfig-EWSTl_g4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defineConfig-EWSTl_g4.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\ntype AnyConfigResult = UserConfig<unknown> | Array<UserConfig<unknown>>\ntype ConfigInput = AnyConfigResult | Promise<AnyConfigResult> | ((cli: CLIOptions) => PossiblePromise<AnyConfigResult>)\ntype NormalizeConfig<TConfig> =\n TConfig extends Array<UserConfig<infer TInput>> ? Array<UserConfig<TInput>> : TConfig extends UserConfig<infer TInput> ? UserConfig<TInput> : never\ntype DefinedConfig<TConfig extends ConfigInput> = TConfig extends (cli: CLIOptions) => PossiblePromise<infer TResult>\n ? (cli: CLIOptions) => Promise<NormalizeConfig<TResult>>\n : TConfig extends Promise<infer TResult>\n ? Promise<NormalizeConfig<TResult>>\n : NormalizeConfig<TConfig>\n\nfunction normalizeConfig<TInput>(config: UserConfig<TInput> | Array<UserConfig<TInput>>): UserConfig<TInput> | Array<UserConfig<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 * @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<TConfig extends ConfigInput>(config: TConfig): DefinedConfig<TConfig> {\n if (typeof config === 'function') {\n return (async (cli: CLIOptions) => {\n return normalizeConfig(await config(cli))\n }) as DefinedConfig<TConfig>\n }\n\n if (config instanceof Promise) {\n return config.then(normalizeConfig) as DefinedConfig<TConfig>\n }\n\n return normalizeConfig(config) as DefinedConfig<TConfig>\n}\n"],"mappings":";;;;;;;;;AAcA,SAAS,gBAAwB,QAAwG;CACvI,IAAI,MAAM,QAAQ,MAAM,GACtB,OAAO,OAAO,IAAI,aAAa;CAGjC,OAAO,cAAc,MAAM;AAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,aAA0C,QAAyC;CACjG,IAAI,OAAO,WAAW,YACpB,QAAQ,OAAO,QAAoB;EACjC,OAAO,gBAAgB,MAAM,OAAO,GAAG,CAAC;CAC1C;CAGF,IAAI,kBAAkB,SACpB,OAAO,OAAO,KAAK,eAAe;CAGpC,OAAO,gBAAgB,MAAM;AAC/B"}