@kubb/core 5.0.0-beta.1 → 5.0.0-beta.100

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.
Files changed (49) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +25 -158
  3. package/dist/index.cjs +2262 -1130
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.ts +107 -295
  6. package/dist/index.js +2253 -1122
  7. package/dist/index.js.map +1 -1
  8. package/dist/mocks.cjs +81 -32
  9. package/dist/mocks.cjs.map +1 -1
  10. package/dist/mocks.d.ts +37 -14
  11. package/dist/mocks.js +83 -36
  12. package/dist/mocks.js.map +1 -1
  13. package/dist/types-DM7-MGjZ.d.ts +2838 -0
  14. package/dist/usingCtx-BNggxUEL.js +597 -0
  15. package/dist/usingCtx-BNggxUEL.js.map +1 -0
  16. package/dist/usingCtx-CZyLSqds.cjs +705 -0
  17. package/dist/usingCtx-CZyLSqds.cjs.map +1 -0
  18. package/package.json +7 -35
  19. package/dist/PluginDriver-BXibeQk-.cjs +0 -1036
  20. package/dist/PluginDriver-BXibeQk-.cjs.map +0 -1
  21. package/dist/PluginDriver-DV3p2Hky.js +0 -945
  22. package/dist/PluginDriver-DV3p2Hky.js.map +0 -1
  23. package/dist/types-CuNocrbJ.d.ts +0 -2148
  24. package/src/FileManager.ts +0 -115
  25. package/src/FileProcessor.ts +0 -86
  26. package/src/Kubb.ts +0 -300
  27. package/src/PluginDriver.ts +0 -424
  28. package/src/constants.ts +0 -35
  29. package/src/createAdapter.ts +0 -32
  30. package/src/createKubb.ts +0 -548
  31. package/src/createRenderer.ts +0 -57
  32. package/src/createStorage.ts +0 -70
  33. package/src/defineGenerator.ts +0 -87
  34. package/src/defineLogger.ts +0 -19
  35. package/src/defineMiddleware.ts +0 -62
  36. package/src/defineParser.ts +0 -44
  37. package/src/definePlugin.ts +0 -83
  38. package/src/defineResolver.ts +0 -521
  39. package/src/devtools.ts +0 -59
  40. package/src/index.ts +0 -20
  41. package/src/mocks.ts +0 -178
  42. package/src/renderNode.ts +0 -35
  43. package/src/storages/fsStorage.ts +0 -114
  44. package/src/storages/memoryStorage.ts +0 -55
  45. package/src/types.ts +0 -1296
  46. package/src/utils/diagnostics.ts +0 -18
  47. package/src/utils/isInputPath.ts +0 -10
  48. package/src/utils/packageJSON.ts +0 -99
  49. /package/dist/{chunk--u3MIqq1.js → rolldown-runtime-C0LytTxp.js} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,318 +1,135 @@
1
- import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { $ as defineParser, A as KubbPluginStartContext, B as Override, C as KubbGenerationSummaryContext, D as KubbLifecycleStartContext, E as KubbInfoContext, F as Logger, G as ResolveOptionsContext, H as PossibleConfig, I as LoggerContext, J as ResolverFileParams, K as Resolver, L as LoggerOptions, M as KubbSuccessContext, N as KubbVersionNewContext, O as KubbPluginEndContext, P as KubbWarnContext, Q as Parser, R as NormalizedPlugin, S as KubbGenerationStartContext, T as KubbHookStartContext, U as ResolveBannerContext, V as PluginFactoryOptions, W as ResolveNameParams, X as UserConfig, Y as ResolverPathParams, Z as UserLogger, _ as KubbErrorContext, _t as logLevel, a as Config, at as createKubb, b as KubbFilesProcessingStartContext, c as GeneratorContext, ct as Plugin, d as InputData, dt as defineGenerator, et as Middleware, f as InputPath, ft as Storage, g as KubbDebugContext, gt as createRenderer, h as KubbConfigEndContext, ht as RendererFactory, i as CLIOptions, it as BuildOutput, j as KubbPluginsEndContext, k as KubbPluginSetupContext, l as Group, lt as definePlugin, m as KubbBuildStartContext, mt as Renderer, n as AdapterFactoryOptions, nt as Kubb, o as DevtoolsOptions, ot as PluginDriver, p as KubbBuildEndContext, pt as createStorage, q as ResolverContext, r as AdapterSource, rt as KubbHooks, s as Exclude, st as FileManager, t as Adapter, tt as defineMiddleware, u as Include, ut as Generator, v as KubbFileProcessingUpdateContext, vt as AsyncEventEmitter, w as KubbHookEndContext, x as KubbGenerationEndContext, y as KubbFilesProcessingEndContext, z as Output } from "./types-CuNocrbJ.js";
3
- import * as ast from "@kubb/ast";
4
- import { FileNode, InputNode, Node } from "@kubb/ast";
5
-
6
- //#region ../../internals/utils/src/urlPath.d.ts
7
- type URLObject = {
8
- /**
9
- * The resolved URL string (Express-style or template literal, depending on context).
10
- */
11
- url: string;
12
- /**
13
- * Extracted path parameters as a key-value map, or `undefined` when the path has none.
14
- */
15
- params?: Record<string, string>;
16
- };
17
- type ObjectOptions = {
18
- /**
19
- * Controls whether the `url` is rendered as an Express path or a template literal.
20
- * @default 'path'
21
- */
22
- type?: 'path' | 'template';
23
- /**
24
- * Optional transform applied to each extracted parameter name.
25
- */
26
- replacer?: (pathParam: string) => string;
27
- /**
28
- * When `true`, the result is serialized to a string expression instead of a plain object.
29
- */
30
- stringify?: boolean;
1
+ import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
2
+ import { $ as definePlugin, A as Generator, At as DiagnosticSeverity, B as Include, Bt as AdapterSource, C as KubbWarnContext, Ct as UserReporter, D as CreateKubbOptions, Dt as DiagnosticDoc, E as UserConfig, Et as Diagnostic, F as Parser, Ft as SerializedDiagnostic, G as Output, H as KubbPluginSetupContext, I as defineParser, It as UpdateDiagnostic, J as Override, K as OutputMode, L as Exclude, Lt as Hookable, M as defineGenerator, Mt as PerformanceDiagnostic, N as KubbDriver, Nt as ProblemCode, O as Kubb, Ot as DiagnosticKind, P as FileManagerHooks, Pt as ProblemDiagnostic, Q as ResolvePluginOptions, R as Filter, Rt as Adapter, S as KubbSuccessContext, St as ReporterName, T as PostGenerateCommand, Tt as logLevel, U as KubbPluginStartContext, V as KubbPluginEndContext, Vt as createAdapter, W as NormalizedPlugin, X as PluginFactoryOptions, Y as Plugin, Z as PluginName, _ as KubbHookStartContext, _t as Storage, a as KubbBuildEndContext, at as ResolveOptionsContext, b as KubbLifecycleStartContext, bt as Reporter, c as KubbErrorContext, ct as ResolverDefault, d as KubbFilesProcessingStartContext, dt as ResolverFilePathParams, et as BannerMeta, f as KubbFilesProcessingUpdateContext, ft as ResolverPatch, g as KubbHookLineContext, gt as createRenderer, h as KubbHookEndContext, ht as RendererFactory, i as Input, it as ResolveImportsOptions, j as GeneratorContext, jt as Diagnostics, k as createKubb, kt as DiagnosticLocation, l as KubbFileProcessingUpdate, lt as ResolverFile, m as KubbGenerationStartContext, mt as Renderer, n as CLIOptions, nt as ResolveBannerFile, o as KubbBuildStartContext, ot as ResolvePathOptions, p as KubbGenerationEndContext, pt as ResolverPathParams, q as OutputOptions, r as Config, rt as ResolveFileOptions, s as KubbDiagnosticContext, st as Resolver, t as BuildOutput, tt as ResolveBannerContext, u as KubbFilesProcessingEndContext, ut as ResolverFileParams, v as KubbHooks, vt as createStorage, w as PossibleConfig, wt as createReporter, x as KubbPluginsEndContext, xt as ReporterContext, y as KubbInfoContext, yt as GenerationResult, z as Group, zt as AdapterFactoryOptions } from "./types-DM7-MGjZ.js";
3
+ //#region src/applyConfigDefaults.d.ts
4
+ type ApplyConfigDefaultsOptions<TOutput> = {
5
+ defaultAdapter: Adapter;
6
+ barrelPlugin: Plugin;
7
+ barrelPluginName: string;
8
+ /** Output fields to fill in when the user's config leaves them unset. */
9
+ defaultOutput: Partial<TOutput>;
31
10
  };
32
11
  /**
33
- * Supported identifier casing strategies for path parameters.
12
+ * Fills in the config defaults shared by `defineConfig` and the unplugin factory: the fallback
13
+ * adapter, `defaultOutput`'s fields, and appending the barrel plugin when it's not already
14
+ * registered. Both entry points construct their own adapter, barrel plugin, and output defaults
15
+ * (`barrel` is a `@kubb/plugin-barrel` extension field core doesn't know about) and pass them in,
16
+ * so `@kubb/core` doesn't need to depend on `@kubb/adapter-oas` or `@kubb/plugin-barrel`.
34
17
  */
35
- type PathCasing = 'camelcase';
36
- type Options = {
37
- /**
38
- * Casing strategy applied to path parameter names.
39
- * @default undefined (original identifier preserved)
40
- */
41
- casing?: PathCasing;
18
+ declare function applyConfigDefaults<TOutput extends Config['output'] = Config['output']>(config: {
19
+ adapter?: Adapter;
20
+ output: TOutput;
21
+ plugins?: Array<Plugin>;
22
+ }, { defaultAdapter, barrelPlugin, barrelPluginName, defaultOutput }: ApplyConfigDefaultsOptions<TOutput>): {
23
+ adapter: Adapter;
24
+ output: TOutput;
25
+ plugins: Array<Plugin>;
42
26
  };
27
+ //#endregion
28
+ //#region src/reporters/cliReporter.d.ts
43
29
  /**
44
- * Parses and transforms an OpenAPI/Swagger path string into various URL formats.
45
- *
46
- * @example
47
- * const p = new URLPath('/pet/{petId}')
48
- * p.URL // '/pet/:petId'
49
- * p.template // '`/pet/${petId}`'
30
+ * The default `cli` reporter. Renders the {@link Report} for each config as it finishes, independent
31
+ * of the live logger view. Suppressed at `silent`. The `verbose` level adds the per-plugin timings.
50
32
  */
51
- declare class URLPath {
52
- #private;
53
- /**
54
- * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.
55
- */
56
- path: string;
57
- constructor(path: string, options?: Options);
58
- /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
59
- *
60
- * @example
61
- * ```ts
62
- * new URLPath('/pet/{petId}').URL // '/pet/:petId'
63
- * ```
64
- */
65
- get URL(): string;
66
- /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).
67
- *
68
- * @example
69
- * ```ts
70
- * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true
71
- * new URLPath('/pet/{petId}').isURL // false
72
- * ```
73
- */
74
- get isURL(): boolean;
75
- /**
76
- * Converts the OpenAPI path to a TypeScript template literal string.
77
- *
78
- * @example
79
- * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'
80
- * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'
81
- */
82
- get template(): string;
83
- /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.
84
- *
85
- * @example
86
- * ```ts
87
- * new URLPath('/pet/{petId}').object
88
- * // { url: '/pet/:petId', params: { petId: 'petId' } }
89
- * ```
90
- */
91
- get object(): URLObject | string;
92
- /** Returns a map of path parameter names, or `undefined` when the path has no parameters.
93
- *
94
- * @example
95
- * ```ts
96
- * new URLPath('/pet/{petId}').params // { petId: 'petId' }
97
- * new URLPath('/pet').params // undefined
98
- * ```
99
- */
100
- get params(): Record<string, string> | undefined;
101
- toObject({
102
- type,
103
- replacer,
104
- stringify
105
- }?: ObjectOptions): URLObject | string;
106
- /**
107
- * Converts the OpenAPI path to a TypeScript template literal string.
108
- * An optional `replacer` can transform each extracted parameter name before interpolation.
109
- *
110
- * @example
111
- * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
112
- */
113
- toTemplateString({
114
- prefix,
115
- replacer
116
- }?: {
117
- prefix?: string;
118
- replacer?: (pathParam: string) => string;
119
- }): string;
120
- /**
121
- * Extracts all `{param}` segments from the path and returns them as a key-value map.
122
- * An optional `replacer` transforms each parameter name in both key and value positions.
123
- * Returns `undefined` when no path parameters are found.
124
- *
125
- * @example
126
- * ```ts
127
- * new URLPath('/pet/{petId}/tag/{tagId}').getParams()
128
- * // { petId: 'petId', tagId: 'tagId' }
129
- * ```
130
- */
131
- getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined;
132
- /** Converts the OpenAPI path to Express-style colon syntax.
133
- *
134
- * @example
135
- * ```ts
136
- * new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'
137
- * ```
138
- */
139
- toURLPath(): string;
140
- }
33
+ declare const cliReporter: Reporter;
141
34
  //#endregion
142
- //#region src/createAdapter.d.ts
143
- type AdapterBuilder<T extends AdapterFactoryOptions> = (options: T['options']) => Adapter<T>;
35
+ //#region src/reporters/fileReporter.d.ts
144
36
  /**
145
- * Factory for implementing custom adapters that translate non-OpenAPI specs into Kubb's AST.
146
- *
147
- * Use this to support GraphQL schemas, gRPC definitions, AsyncAPI, or custom domain-specific languages.
148
- * Built-in adapters include `@kubb/adapter-oas` for OpenAPI and Swagger documents.
149
- *
150
- * @note Adapters must parse their input format to Kubb's `InputNode` structure.
151
- *
152
- * @example
153
- * ```ts
154
- * export const myAdapter = createAdapter<MyAdapter>((options) => {
155
- * return {
156
- * name: 'my-adapter',
157
- * options,
158
- * async parse(source) {
159
- * // Transform source format to InputNode
160
- * return { ... }
161
- * },
162
- * }
163
- * })
164
- *
165
- * // Instantiate:
166
- * const adapter = myAdapter({ validate: true })
167
- * ```
37
+ * The `file` reporter. Writes a config's {@link Report} to `.kubb/kubb-<name>-<timestamp>.log` as a
38
+ * plain-text document: a `# <name> — <timestamp>` header, a `## Summary` with the same counts the
39
+ * cli and json reporters expose, a `## Problems` section in the miette block format, and a
40
+ * `## Timings` section. Selected with `--reporter file` (or `reporters: ['file']`).
41
+ *
42
+ * @note It captures the collected diagnostics once a config finishes, not the live
43
+ * `kubb:info`/`kubb:plugin` hook stream. Color is stripped so the file stays plain text even when
44
+ * the run is attached to a TTY.
168
45
  */
169
- declare function createAdapter<T extends AdapterFactoryOptions = AdapterFactoryOptions>(build: AdapterBuilder<T>): (options?: T['options']) => Adapter<T>;
46
+ declare const fileReporter: Reporter;
170
47
  //#endregion
171
- //#region src/defineLogger.d.ts
48
+ //#region src/reporters/jsonReporter.d.ts
172
49
  /**
173
- * Wraps a logger definition into a typed {@link Logger}.
174
- *
175
- * @example
176
- * ```ts
177
- * export const myLogger = defineLogger({
178
- * name: 'my-logger',
179
- * install(context, options) {
180
- * context.on('kubb:info', (message) => console.log('ℹ', message))
181
- * context.on('kubb:error', (error) => console.error('✗', error.message))
182
- * },
183
- * })
184
- * ```
50
+ * The `json` reporter. `report` returns one config's {@link Report}, which {@link createReporter}
51
+ * buffers, and `drain` writes them as a single pretty-printed JSON array on `kubb:lifecycle:end`.
52
+ * Buffering keeps a multi-config run one valid JSON document on stdout instead of concatenated
53
+ * objects that would break `jq .`. The terminal reporter is suppressed while `json` is active so
54
+ * stdout stays valid JSON.
185
55
  */
186
- declare function defineLogger<Options extends LoggerOptions = LoggerOptions>(logger: UserLogger<Options>): Logger<Options>;
56
+ declare const jsonReporter: Reporter;
187
57
  //#endregion
188
- //#region src/defineResolver.d.ts
58
+ //#region src/createResolver.d.ts
189
59
  /**
190
- * Builder type for the plugin-specific resolver fields.
191
- *
192
- * `default`, `resolveOptions`, `resolvePath`, `resolveFile`, `resolveBanner`, and `resolveFooter`
193
- * are optional — built-in fallbacks are injected when omitted.
194
- *
195
- * The builder receives `ctx` — a reference to the fully assembled resolver — so methods can
196
- * call sibling resolver methods without using `this`. Because `ctx` is captured by the closure
197
- * and the resolver is populated after the builder runs, `ctx` correctly reflects any overrides
198
- * that were applied by the builder itself.
60
+ * The plugin-specific resolver fields handed to `createResolver`. `name` and `file` fall
61
+ * back to the built-ins when omitted. Every method reaches sibling helpers through `this`,
62
+ * which `ThisType` types as the full resolver.
199
63
  */
200
- type ResolverBuilder<T extends PluginFactoryOptions> = (ctx: T['resolver']) => Omit<T['resolver'], 'default' | 'resolveOptions' | 'resolvePath' | 'resolveFile' | 'resolveBanner' | 'resolveFooter' | 'name' | 'pluginName'> & Partial<Pick<T['resolver'], 'default' | 'resolveOptions' | 'resolvePath' | 'resolveFile' | 'resolveBanner' | 'resolveFooter'>> & {
201
- name: string;
64
+ type ResolverOptions<T extends PluginFactoryOptions> = Omit<T['resolver'], keyof Resolver> & {
202
65
  pluginName: T['name'];
203
- };
66
+ name?: T['resolver']['name'];
67
+ file?: ResolverFile;
68
+ } & ThisType<T['resolver']>;
204
69
  /**
205
- * Default option resolver applies include/exclude filters and merges matching override options.
206
- *
207
- * Returns `null` when the node is filtered out by an `exclude` rule or not matched by any `include` rule.
208
- *
209
- * @example Include/exclude filtering
210
- * ```ts
211
- * const options = defaultResolveOptions(operationNode, {
212
- * options: { output: 'types' },
213
- * exclude: [{ type: 'tag', pattern: 'internal' }],
214
- * })
215
- * // → null when node has tag 'internal'
216
- * ```
70
+ * Defines a plugin resolver, the object that decides what every generated symbol and file
71
+ * path is called. Override the top-level `name` and `file` to set the plugin's conventions,
72
+ * and add your own naming helpers, top-level (`typeName`, …) or grouped in namespaces
73
+ * (`query`, `schema`, …). Every method reaches sibling helpers and the built-in machinery
74
+ * through `this.name`, `this.file`, and `this.default`.
217
75
  *
218
- * @example Override merging
76
+ * @example Custom identifier casing
219
77
  * ```ts
220
- * const options = defaultResolveOptions(operationNode, {
221
- * options: { enumType: 'asConst' },
222
- * override: [{ type: 'operationId', pattern: 'listPets', options: { enumType: 'enum' } }],
78
+ * export const resolverTs = createResolver<PluginTs>({
79
+ * pluginName: 'plugin-ts',
80
+ * name(name) {
81
+ * return ensureValidVarName(pascalCase(name))
82
+ * },
223
83
  * })
224
- * // → { enumType: 'enum' } when operationId matches
225
84
  * ```
226
- */
227
- /**
228
- * Defines a resolver for a plugin, injecting built-in defaults for name casing,
229
- * include/exclude/override filtering, path resolution, and file construction.
230
85
  *
231
- * All four defaults can be overridden by providing them in the builder function:
232
- * - `default` — name casing strategy (camelCase / PascalCase)
233
- * - `resolveOptions` — include/exclude/override filtering
234
- * - `resolvePath` — output path computation
235
- * - `resolveFile` — full `FileNode` construction
236
- *
237
- * The builder receives `ctx` — a reference to the assembled resolver — so methods can
238
- * call sibling resolver methods using `ctx` instead of `this`.
239
- *
240
- * @example Basic resolver with naming helpers
86
+ * @example Rename generated files with `file.baseName`
241
87
  * ```ts
242
- * export const resolver = defineResolver<PluginTs>((ctx) => ({
243
- * name: 'default',
244
- * resolveName(node) {
245
- * return ctx.default(node.name, 'function')
246
- * },
247
- * resolveTypedName(node) {
248
- * return ctx.default(node.name, 'type')
88
+ * export const resolverFaker = createResolver<PluginFaker>({
89
+ * pluginName: 'plugin-faker',
90
+ * name(name) {
91
+ * return camelCase(name, { prefix: 'create' })
249
92
  * },
250
- * }))
251
- * ```
252
- *
253
- * @example Override resolvePath for a custom output structure
254
- * ```ts
255
- * export const resolver = defineResolver<PluginTs>((_ctx) => ({
256
- * name: 'custom',
257
- * resolvePath({ baseName }, { root, output }) {
258
- * return path.resolve(root, output.path, 'generated', baseName)
93
+ * file: {
94
+ * baseName({ name, extname }) {
95
+ * return `${camelCase(name, { prefix: 'create' })}${extname}`
96
+ * },
259
97
  * },
260
- * }))
98
+ * })
261
99
  * ```
262
100
  *
263
- * @example Use ctx.default inside a helper
101
+ * @example Own the full path with `file.path`
264
102
  * ```ts
265
- * export const resolver = defineResolver<PluginTs>((ctx) => ({
266
- * name: 'default',
267
- * resolveParamName(node, param) {
268
- * return ctx.default(`${node.operationId} ${param.in} ${param.name}`, 'type')
103
+ * export const resolverFaker = createResolver<PluginFaker>({
104
+ * pluginName: 'plugin-faker',
105
+ * file: {
106
+ * path({ baseName, output }) {
107
+ * return `${output.path}/mocks/${baseName}`
108
+ * },
269
109
  * },
270
- * }))
110
+ * })
271
111
  * ```
272
112
  */
273
- declare function defineResolver<T extends PluginFactoryOptions>(build: ResolverBuilder<T>): T['resolver'];
113
+ declare function createResolver<T extends PluginFactoryOptions>(options: ResolverOptions<T>): T['resolver'];
274
114
  //#endregion
275
- //#region src/FileProcessor.d.ts
276
- type ParseOptions = {
277
- parsers?: Map<FileNode['extname'], Parser>;
278
- extension?: Record<FileNode['extname'], FileNode['extname'] | ''>;
279
- };
280
- type RunOptions = ParseOptions & {
281
- /**
282
- * @default 'sequential'
283
- */
284
- mode?: 'sequential' | 'parallel';
285
- onStart?: (files: Array<FileNode>) => Promise<void> | void;
286
- onEnd?: (files: Array<FileNode>) => Promise<void> | void;
287
- onUpdate?: (params: {
288
- file: FileNode;
289
- source?: string;
290
- processed: number;
291
- total: number;
292
- percentage: number;
293
- }) => Promise<void> | void;
294
- };
115
+ //#region src/input.d.ts
295
116
  /**
296
- * Converts a single file to a string using the registered parsers.
297
- * Falls back to joining source values when no matching parser is found.
117
+ * What an `input` value points at, once Kubb has looked at it.
298
118
  *
299
- * @internal
119
+ * - `file` is a local file path, absolute or relative to the config file.
120
+ * - `url` is a remote document to fetch.
121
+ * - `inline` is OpenAPI content held in the string itself (JSON or YAML).
122
+ * - `object` is an already-parsed spec.
300
123
  */
301
- declare class FileProcessor {
302
- #private;
303
- parse(file: FileNode, {
304
- parsers,
305
- extension
306
- }?: ParseOptions): Promise<string>;
307
- run(files: Array<FileNode>, {
308
- parsers,
309
- mode,
310
- extension,
311
- onStart,
312
- onEnd,
313
- onUpdate
314
- }?: RunOptions): Promise<Array<FileNode>>;
315
- }
124
+ type InputKind = 'file' | 'url' | 'inline' | 'object';
125
+ /**
126
+ * Classifies an `input` value so callers branch on it once instead of repeating the checks.
127
+ *
128
+ * A non-string is a parsed spec (`object`). A string is `inline` when it holds OpenAPI content,
129
+ * meaning it starts with `{` or `[`, spans multiple lines, or opens with a YAML `openapi:` or
130
+ * `swagger:` key. Otherwise a string is a `url` when it parses as one, or a `file` path.
131
+ */
132
+ declare function getInputKind(input: NonNullable<Input>): InputKind;
316
133
  //#endregion
317
134
  //#region src/storages/fsStorage.d.ts
318
135
  /**
@@ -322,11 +139,13 @@ declare class FileProcessor {
322
139
  * Keys are resolved against `process.cwd()`, so root-relative paths such as
323
140
  * `src/gen/api/getPets.ts` are written to the correct location without extra configuration.
324
141
  *
325
- * Internally uses the `write` utility from `@internals/utils`, which:
326
- * - trims leading/trailing whitespace before writing
327
- * - skips the write when file content is already identical (deduplication)
328
- * - creates missing parent directories automatically
329
- * - supports Bun's native file API when running under Bun
142
+ * Writes are deduplicated and directory-safe:
143
+ * - leading and trailing whitespace is trimmed before writing
144
+ * - the write is skipped when the file content is already identical
145
+ * - missing parent directories are created automatically
146
+ * - Bun's native file API is used when running under Bun
147
+ * - concurrent `setItem` calls are capped at {@link WRITE_CONCURRENCY} in flight, so a caller
148
+ * can fire every file's write without pacing itself
330
149
  *
331
150
  * @example
332
151
  * ```ts
@@ -334,7 +153,7 @@ declare class FileProcessor {
334
153
  * import { defineConfig } from 'kubb'
335
154
  *
336
155
  * export default defineConfig({
337
- * input: { path: './petStore.yaml' },
156
+ * input: './petStore.yaml',
338
157
  * output: { path: './src/gen' },
339
158
  * storage: fsStorage(),
340
159
  * })
@@ -356,7 +175,7 @@ declare const fsStorage: (options?: Record<string, never> | undefined) => Storag
356
175
  * import { defineConfig } from 'kubb'
357
176
  *
358
177
  * export default defineConfig({
359
- * input: { path: './petStore.yaml' },
178
+ * input: './petStore.yaml',
360
179
  * output: { path: './src/gen' },
361
180
  * storage: memoryStorage(),
362
181
  * })
@@ -364,12 +183,5 @@ declare const fsStorage: (options?: Record<string, never> | undefined) => Storag
364
183
  */
365
184
  declare const memoryStorage: (options?: Record<string, never> | undefined) => Storage;
366
185
  //#endregion
367
- //#region src/utils/isInputPath.d.ts
368
- /**
369
- * Type guard to check if a given config has an `input.path`.
370
- */
371
- declare function isInputPath(config: UserConfig | undefined): config is UserConfig<InputPath>;
372
- declare function isInputPath(config: Config | undefined): config is Config<InputPath>;
373
- //#endregion
374
- export { Adapter, AdapterFactoryOptions, AdapterSource, AsyncEventEmitter, BuildOutput, CLIOptions, Config, DevtoolsOptions, Exclude, FileManager, FileProcessor, Generator, GeneratorContext, Group, Include, InputData, InputPath, Kubb, KubbBuildEndContext, KubbBuildStartContext, KubbConfigEndContext, KubbDebugContext, KubbErrorContext, KubbFileProcessingUpdateContext, KubbFilesProcessingEndContext, KubbFilesProcessingStartContext, KubbGenerationEndContext, KubbGenerationStartContext, KubbGenerationSummaryContext, KubbHookEndContext, KubbHookStartContext, KubbHooks, KubbInfoContext, KubbLifecycleStartContext, KubbPluginEndContext, KubbPluginSetupContext, KubbPluginStartContext, KubbPluginsEndContext, KubbSuccessContext, KubbVersionNewContext, KubbWarnContext, Logger, LoggerContext, LoggerOptions, Middleware, NormalizedPlugin, Output, Override, Parser, Plugin, PluginDriver, PluginFactoryOptions, PossibleConfig, Renderer, RendererFactory, ResolveBannerContext, ResolveNameParams, ResolveOptionsContext, Resolver, ResolverContext, ResolverFileParams, ResolverPathParams, Storage, URLPath, UserConfig, UserLogger, ast, createAdapter, createKubb, createRenderer, createStorage, defineGenerator, defineLogger, defineMiddleware, defineParser, definePlugin, defineResolver, fsStorage, isInputPath, logLevel, memoryStorage };
186
+ export { type Adapter, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, BuildOutput, CLIOptions, Config, type CreateKubbOptions, type Diagnostic, type DiagnosticDoc, type DiagnosticKind, type DiagnosticLocation, type DiagnosticSeverity, Diagnostics, type Exclude, type FileManagerHooks, type Filter, type GenerationResult, type Generator, type GeneratorContext, type Group, Hookable, type Include, Input, type InputKind, type Kubb, KubbBuildEndContext, KubbBuildStartContext, KubbDiagnosticContext, KubbDriver, KubbErrorContext, KubbFileProcessingUpdate, KubbFilesProcessingEndContext, KubbFilesProcessingStartContext, KubbFilesProcessingUpdateContext, KubbGenerationEndContext, KubbGenerationStartContext, KubbHookEndContext, KubbHookLineContext, KubbHookStartContext, KubbHooks, KubbInfoContext, KubbLifecycleStartContext, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, KubbPluginsEndContext, KubbSuccessContext, KubbWarnContext, type NormalizedPlugin, type Output, type OutputMode, type OutputOptions, type Override, type Parser, type PerformanceDiagnostic, type Plugin, type PluginFactoryOptions, type PluginName, PossibleConfig, PostGenerateCommand, type ProblemCode, type ProblemDiagnostic, type Renderer, type RendererFactory, type Reporter, type ReporterContext, type ReporterName, type ResolveBannerContext, type ResolveBannerFile, type ResolveFileOptions, type ResolveImportsOptions, type ResolveOptionsContext, type ResolvePathOptions, type ResolvePluginOptions, Resolver, type ResolverDefault, type ResolverFile, type ResolverFileParams, type ResolverFilePathParams, type ResolverPatch, type ResolverPathParams, type SerializedDiagnostic, type Storage, type UpdateDiagnostic, UserConfig, type UserReporter, applyConfigDefaults, cliReporter, createAdapter, createKubb, createRenderer, createReporter, createResolver, createStorage, defineGenerator, defineParser, definePlugin, fileReporter, fsStorage, getInputKind, jsonReporter, logLevel, memoryStorage };
375
187
  //# sourceMappingURL=index.d.ts.map