@kubb/core 5.0.0-beta.7 → 5.0.0-beta.70

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 +20 -123
  3. package/dist/diagnostics-CJtO1uSM.d.ts +2892 -0
  4. package/dist/index.cjs +2340 -1129
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.ts +80 -289
  7. package/dist/index.js +2330 -1124
  8. package/dist/index.js.map +1 -1
  9. package/dist/memoryStorage-B4VTTIpQ.js +905 -0
  10. package/dist/memoryStorage-B4VTTIpQ.js.map +1 -0
  11. package/dist/memoryStorage-CfycFGzX.cjs +1043 -0
  12. package/dist/memoryStorage-CfycFGzX.cjs.map +1 -0
  13. package/dist/mocks.cjs +84 -24
  14. package/dist/mocks.cjs.map +1 -1
  15. package/dist/mocks.d.ts +37 -11
  16. package/dist/mocks.js +86 -28
  17. package/dist/mocks.js.map +1 -1
  18. package/package.json +9 -23
  19. package/dist/PluginDriver-BkTRD2H2.js +0 -946
  20. package/dist/PluginDriver-BkTRD2H2.js.map +0 -1
  21. package/dist/PluginDriver-Cadu4ORh.cjs +0 -1037
  22. package/dist/PluginDriver-Cadu4ORh.cjs.map +0 -1
  23. package/dist/types-ChyWgIgi.d.ts +0 -2159
  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 -426
  28. package/src/constants.ts +0 -35
  29. package/src/createAdapter.ts +0 -32
  30. package/src/createKubb.ts +0 -573
  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 -36
  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 -1305
  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,18 +1,35 @@
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-ChyWgIgi.js";
3
- import * as ast from "@kubb/ast";
4
- import { FileNode, InputNode, Node } from "@kubb/ast";
1
+ import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
2
+ import { $ as KubbPluginSetupContext, A as KubbHookStartContext, At as Adapter, B as ParsedFile, C as KubbFilesProcessingEndContext, Ct as GenerationResult, D as KubbGenerationStartContext, Dt as UserReporter, E as KubbGenerationEndContext, Et as ReporterName, F as KubbSuccessContext, G as Generator, H as createKubb, I as KubbWarnContext, J as KubbDriver, K as GeneratorContext, L as PossibleConfig, M as KubbInfoContext, Mt as AdapterSource, N as KubbLifecycleStartContext, Nt as createAdapter, O as KubbHookEndContext, Ot as createReporter, P as KubbPluginsEndContext, Pt as AsyncEventEmitter, Q as KubbPluginEndContext, R as UserConfig, S as KubbFileProcessingUpdate, St as createStorage, T as KubbFilesProcessingUpdateContext, Tt as ReporterContext, U as Parser, V as Kubb, W as defineParser, X as Group, Y as Exclude, Z as Include, _ as InputPath, _t as defineResolver, a as DiagnosticLocation, at as Override, b as KubbDiagnosticContext, bt as createRenderer, c as PerformanceDiagnostic, ct as definePlugin, d as SerializedDiagnostic, dt as ResolveBannerFile, et as KubbPluginStartContext, f as UpdateDiagnostic, ft as ResolveOptionsContext, g as InputData, gt as ResolverPathParams, h as Config, ht as ResolverFileParams, i as DiagnosticKind, it as OutputOptions, j as KubbHooks, jt as AdapterFactoryOptions, k as KubbHookLineContext, kt as logLevel, l as ProblemCode, lt as BannerMeta, m as CLIOptions, mt as ResolverContext, n as DiagnosticByCode, nt as Output, o as DiagnosticSeverity, ot as Plugin, p as BuildOutput, pt as Resolver, q as defineGenerator, r as DiagnosticDoc, rt as OutputMode, s as Diagnostics, st as PluginFactoryOptions, t as Diagnostic, tt as NormalizedPlugin, u as ProblemDiagnostic, ut as ResolveBannerContext, v as KubbBuildEndContext, vt as Renderer, w as KubbFilesProcessingStartContext, wt as Reporter, x as KubbErrorContext, xt as Storage, y as KubbBuildStartContext, yt as RendererFactory, z as FileProcessorHooks } from "./diagnostics-CJtO1uSM.js";
3
+ import { ast } from "@kubb/ast";
5
4
 
6
- //#region ../../internals/utils/src/urlPath.d.ts
5
+ //#region ../../internals/utils/src/url.d.ts
7
6
  type URLObject = {
8
7
  /**
9
8
  * The resolved URL string (Express-style or template literal, depending on context).
10
9
  */
11
10
  url: string;
12
11
  /**
13
- * Extracted path parameters as a key-value map, or `undefined` when the path has none.
12
+ * Extracted path parameters as a key-value map, or `null` when the path has none.
14
13
  */
15
- params?: Record<string, string>;
14
+ params: Record<string, string> | null;
15
+ };
16
+ /**
17
+ * Supported identifier casing strategies for path parameters.
18
+ */
19
+ type PathCasing = 'camelcase';
20
+ type TemplateOptions = {
21
+ /**
22
+ * Literal text prepended inside the template literal, e.g. a base URL.
23
+ */
24
+ prefix?: string | null;
25
+ /**
26
+ * Transform applied to each extracted parameter name before interpolation.
27
+ */
28
+ replacer?: (pathParam: string) => string;
29
+ /**
30
+ * Casing strategy applied to path parameter names.
31
+ */
32
+ casing?: PathCasing;
16
33
  };
17
34
  type ObjectOptions = {
18
35
  /**
@@ -21,313 +38,98 @@ type ObjectOptions = {
21
38
  */
22
39
  type?: 'path' | 'template';
23
40
  /**
24
- * Optional transform applied to each extracted parameter name.
41
+ * Transform applied to each extracted parameter name.
25
42
  */
26
43
  replacer?: (pathParam: string) => string;
27
44
  /**
28
45
  * When `true`, the result is serialized to a string expression instead of a plain object.
29
46
  */
30
47
  stringify?: boolean;
31
- };
32
- /**
33
- * Supported identifier casing strategies for path parameters.
34
- */
35
- type PathCasing = 'camelcase';
36
- type Options = {
37
48
  /**
38
49
  * Casing strategy applied to path parameter names.
39
- * @default undefined (original identifier preserved)
40
50
  */
41
51
  casing?: PathCasing;
42
52
  };
43
53
  /**
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}`'
54
+ * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.
50
55
  */
51
- declare class URLPath {
52
- #private;
56
+ declare class Url {
53
57
  /**
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`.
58
+ * Reports whether `url` is a parseable absolute URL. Delegates to the native `URL.canParse`.
59
59
  *
60
60
  * @example
61
- * ```ts
62
- * new URLPath('/pet/{petId}').URL // '/pet/:petId'
63
- * ```
61
+ * Url.canParse('https://petstore.swagger.io/v2') // true
62
+ * Url.canParse('/pet/{petId}') // false
64
63
  */
65
- get URL(): string;
66
- /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).
64
+ static canParse(url: string, base?: string | URL): boolean;
65
+ /**
66
+ * Converts an OpenAPI/Swagger path to Express-style colon syntax.
67
67
  *
68
68
  * @example
69
- * ```ts
70
- * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true
71
- * new URLPath('/pet/{petId}').isURL // false
72
- * ```
69
+ * Url.toPath('/pet/{petId}') // '/pet/:petId'
73
70
  */
74
- get isURL(): boolean;
71
+ static toPath(path: string): string;
75
72
  /**
76
- * Converts the OpenAPI path to a TypeScript template literal string.
73
+ * Converts an OpenAPI/Swagger path to a TypeScript template literal string.
74
+ * `prefix` is prepended inside the literal, `replacer` transforms each parameter name,
75
+ * and `casing` controls parameter identifier casing.
77
76
  *
78
77
  * @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.
78
+ * Url.toTemplateString('/pet/{petId}') // '`/pet/${petId}`'
84
79
  *
85
80
  * @example
86
- * ```ts
87
- * new URLPath('/pet/{petId}').object
88
- * // { url: '/pet/:petId', params: { petId: 'petId' } }
89
- * ```
81
+ * Url.toTemplateString('/pet/{petId}', { prefix: 'https://api' }) // '`https://api/pet/${petId}`'
90
82
  */
91
- get object(): URLObject | string;
92
- /** Returns a map of path parameter names, or `undefined` when the path has no parameters.
83
+ static toTemplateString(path: string, {
84
+ prefix,
85
+ replacer,
86
+ casing
87
+ }?: TemplateOptions): string;
88
+ /**
89
+ * Returns the path and its extracted params as a structured `URLObject`, or as a stringified
90
+ * expression when `stringify` is set.
93
91
  *
94
92
  * @example
95
- * ```ts
96
- * new URLPath('/pet/{petId}').params // { petId: 'petId' }
97
- * new URLPath('/pet').params // undefined
98
- * ```
93
+ * Url.toObject('/pet/{petId}')
94
+ * // { url: '/pet/:petId', params: { petId: 'petId' } }
99
95
  */
100
- get params(): Record<string, string> | undefined;
101
- toObject({
96
+ static toObject(path: string, {
102
97
  type,
103
98
  replacer,
104
- stringify
99
+ stringify,
100
+ casing
105
101
  }?: 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
102
  }
141
103
  //#endregion
142
- //#region src/createAdapter.d.ts
143
- type AdapterBuilder<T extends AdapterFactoryOptions> = (options: T['options']) => Adapter<T>;
104
+ //#region src/reporters/cliReporter.d.ts
144
105
  /**
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
- * ```
106
+ * The default `cli` reporter. Renders the {@link Report} for each config as it finishes, independent
107
+ * of the live logger view. Suppressed at `silent`. The `verbose` level adds the per-plugin timings.
168
108
  */
169
- declare function createAdapter<T extends AdapterFactoryOptions = AdapterFactoryOptions>(build: AdapterBuilder<T>): (options?: T['options']) => Adapter<T>;
109
+ declare const cliReporter: Reporter;
170
110
  //#endregion
171
- //#region src/defineLogger.d.ts
111
+ //#region src/reporters/fileReporter.d.ts
172
112
  /**
173
- * Wraps a logger definition into a typed {@link Logger}.
174
- *
175
- * The optional second type parameter `TInstallReturn` allows loggers to return
176
- * a value from `install` for example, a sink factory that the caller can
177
- * forward to hook execution.
178
- *
179
- * @example Basic logger
180
- * ```ts
181
- * export const myLogger = defineLogger({
182
- * name: 'my-logger',
183
- * install(context, options) {
184
- * context.on('kubb:info', (message) => console.log('ℹ', message))
185
- * context.on('kubb:error', (error) => console.error('✗', error.message))
186
- * },
187
- * })
188
- * ```
189
- *
190
- * @example Logger that returns a hook sink factory
191
- * ```ts
192
- * export const myLogger = defineLogger<LoggerOptions, HookSinkFactory>({
193
- * name: 'my-logger',
194
- * install(context, options) {
195
- * // … register event handlers …
196
- * return (commandWithArgs) => ({ onStdout: console.log })
197
- * },
198
- * })
199
- * ```
113
+ * The `file` reporter. Writes a config's {@link Report} to `.kubb/kubb-<name>-<timestamp>.log` as a
114
+ * plain-text document: a `# <name> — <timestamp>` header, a `## Summary` with the same counts the
115
+ * cli and json reporters expose, a `## Problems` section in the miette block format, and a
116
+ * `## Timings` section. Selected with `--reporter file` (or `reporters: ['file']`).
117
+ *
118
+ * @note It captures the collected diagnostics once a config finishes, not the live
119
+ * `kubb:info`/`kubb:plugin` event stream. Color is stripped so the file stays plain text even when
120
+ * the run is attached to a TTY.
200
121
  */
201
- declare function defineLogger<Options extends LoggerOptions = LoggerOptions, TInstallReturn = void>(logger: UserLogger<Options, TInstallReturn>): Logger<Options, TInstallReturn>;
122
+ declare const fileReporter: Reporter;
202
123
  //#endregion
203
- //#region src/defineResolver.d.ts
124
+ //#region src/reporters/jsonReporter.d.ts
204
125
  /**
205
- * Builder type for the plugin-specific resolver fields.
206
- *
207
- * `default`, `resolveOptions`, `resolvePath`, `resolveFile`, `resolveBanner`, and `resolveFooter`
208
- * are optional built-in fallbacks are injected when omitted.
209
- *
210
- * The builder receives `ctx` — a reference to the fully assembled resolver — so methods can
211
- * call sibling resolver methods without using `this`. Because `ctx` is captured by the closure
212
- * and the resolver is populated after the builder runs, `ctx` correctly reflects any overrides
213
- * that were applied by the builder itself.
126
+ * The `json` reporter. `report` returns one config's {@link Report}, which {@link createReporter}
127
+ * buffers, and `drain` writes them as a single pretty-printed JSON array on `kubb:lifecycle:end`.
128
+ * Buffering keeps a multi-config run one valid JSON document on stdout instead of concatenated
129
+ * objects that would break `jq .`. The terminal reporter is suppressed while `json` is active so
130
+ * stdout stays valid JSON.
214
131
  */
215
- 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'>> & {
216
- name: string;
217
- pluginName: T['name'];
218
- };
219
- /**
220
- * Default option resolver — applies include/exclude filters and merges matching override options.
221
- *
222
- * Returns `null` when the node is filtered out by an `exclude` rule or not matched by any `include` rule.
223
- *
224
- * @example Include/exclude filtering
225
- * ```ts
226
- * const options = defaultResolveOptions(operationNode, {
227
- * options: { output: 'types' },
228
- * exclude: [{ type: 'tag', pattern: 'internal' }],
229
- * })
230
- * // → null when node has tag 'internal'
231
- * ```
232
- *
233
- * @example Override merging
234
- * ```ts
235
- * const options = defaultResolveOptions(operationNode, {
236
- * options: { enumType: 'asConst' },
237
- * override: [{ type: 'operationId', pattern: 'listPets', options: { enumType: 'enum' } }],
238
- * })
239
- * // → { enumType: 'enum' } when operationId matches
240
- * ```
241
- */
242
- /**
243
- * Defines a resolver for a plugin, injecting built-in defaults for name casing,
244
- * include/exclude/override filtering, path resolution, and file construction.
245
- *
246
- * All four defaults can be overridden by providing them in the builder function:
247
- * - `default` — name casing strategy (camelCase / PascalCase)
248
- * - `resolveOptions` — include/exclude/override filtering
249
- * - `resolvePath` — output path computation
250
- * - `resolveFile` — full `FileNode` construction
251
- *
252
- * The builder receives `ctx` — a reference to the assembled resolver — so methods can
253
- * call sibling resolver methods using `ctx` instead of `this`.
254
- *
255
- * @example Basic resolver with naming helpers
256
- * ```ts
257
- * export const resolver = defineResolver<PluginTs>((ctx) => ({
258
- * name: 'default',
259
- * resolveName(node) {
260
- * return ctx.default(node.name, 'function')
261
- * },
262
- * resolveTypedName(node) {
263
- * return ctx.default(node.name, 'type')
264
- * },
265
- * }))
266
- * ```
267
- *
268
- * @example Override resolvePath for a custom output structure
269
- * ```ts
270
- * export const resolver = defineResolver<PluginTs>((_ctx) => ({
271
- * name: 'custom',
272
- * resolvePath({ baseName }, { root, output }) {
273
- * return path.resolve(root, output.path, 'generated', baseName)
274
- * },
275
- * }))
276
- * ```
277
- *
278
- * @example Use ctx.default inside a helper
279
- * ```ts
280
- * export const resolver = defineResolver<PluginTs>((ctx) => ({
281
- * name: 'default',
282
- * resolveParamName(node, param) {
283
- * return ctx.default(`${node.operationId} ${param.in} ${param.name}`, 'type')
284
- * },
285
- * }))
286
- * ```
287
- */
288
- declare function defineResolver<T extends PluginFactoryOptions>(build: ResolverBuilder<T>): T['resolver'];
289
- //#endregion
290
- //#region src/FileProcessor.d.ts
291
- type ParseOptions = {
292
- parsers?: Map<FileNode['extname'], Parser>;
293
- extension?: Record<FileNode['extname'], FileNode['extname'] | ''>;
294
- };
295
- type RunOptions = ParseOptions & {
296
- /**
297
- * @default 'sequential'
298
- */
299
- mode?: 'sequential' | 'parallel';
300
- onStart?: (files: Array<FileNode>) => Promise<void> | void;
301
- onEnd?: (files: Array<FileNode>) => Promise<void> | void;
302
- onUpdate?: (params: {
303
- file: FileNode;
304
- source?: string;
305
- processed: number;
306
- total: number;
307
- percentage: number;
308
- }) => Promise<void> | void;
309
- };
310
- /**
311
- * Converts a single file to a string using the registered parsers.
312
- * Falls back to joining source values when no matching parser is found.
313
- *
314
- * @internal
315
- */
316
- declare class FileProcessor {
317
- #private;
318
- parse(file: FileNode, {
319
- parsers,
320
- extension
321
- }?: ParseOptions): Promise<string>;
322
- run(files: Array<FileNode>, {
323
- parsers,
324
- mode,
325
- extension,
326
- onStart,
327
- onEnd,
328
- onUpdate
329
- }?: RunOptions): Promise<Array<FileNode>>;
330
- }
132
+ declare const jsonReporter: Reporter;
331
133
  //#endregion
332
134
  //#region src/storages/fsStorage.d.ts
333
135
  /**
@@ -337,11 +139,11 @@ declare class FileProcessor {
337
139
  * Keys are resolved against `process.cwd()`, so root-relative paths such as
338
140
  * `src/gen/api/getPets.ts` are written to the correct location without extra configuration.
339
141
  *
340
- * Internally uses the `write` utility from `@internals/utils`, which:
341
- * - trims leading/trailing whitespace before writing
342
- * - skips the write when file content is already identical (deduplication)
343
- * - creates missing parent directories automatically
344
- * - 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
345
147
  *
346
148
  * @example
347
149
  * ```ts
@@ -379,16 +181,5 @@ declare const fsStorage: (options?: Record<string, never> | undefined) => Storag
379
181
  */
380
182
  declare const memoryStorage: (options?: Record<string, never> | undefined) => Storage;
381
183
  //#endregion
382
- //#region src/utils/isInputPath.d.ts
383
- /**
384
- * Type guard to check if a given config has an `input.path`.
385
- */
386
- declare function isInputPath(config: UserConfig | undefined): config is UserConfig<InputPath> & {
387
- input: InputPath;
388
- };
389
- declare function isInputPath(config: Config | undefined): config is Config<InputPath> & {
390
- input: InputPath;
391
- };
392
- //#endregion
393
- 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 };
184
+ export { type Adapter, type AdapterFactoryOptions, type AdapterSource, AsyncEventEmitter, type BannerMeta, BuildOutput, CLIOptions, Config, type Diagnostic, type DiagnosticByCode, type DiagnosticDoc, type DiagnosticKind, type DiagnosticLocation, type DiagnosticSeverity, Diagnostics, type Exclude, type FileProcessorHooks, type GenerationResult, type Generator, type GeneratorContext, type Group, type Include, InputData, InputPath, 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 ParsedFile, type Parser, type PerformanceDiagnostic, type Plugin, type PluginFactoryOptions, PossibleConfig, type ProblemCode, type ProblemDiagnostic, type Renderer, type RendererFactory, type Reporter, type ReporterContext, type ReporterName, type ResolveBannerContext, type ResolveBannerFile, type ResolveOptionsContext, type Resolver, type ResolverContext, type ResolverFileParams, type ResolverPathParams, type SerializedDiagnostic, type Storage, type UpdateDiagnostic, Url, UserConfig, type UserReporter, ast, cliReporter, createAdapter, createKubb, createRenderer, createReporter, createStorage, defineGenerator, defineParser, definePlugin, defineResolver, fileReporter, fsStorage, jsonReporter, logLevel, memoryStorage };
394
185
  //# sourceMappingURL=index.d.ts.map