@kubb/core 5.0.0-beta.6 → 5.0.0-beta.61
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/LICENSE +17 -10
- package/README.md +25 -158
- package/dist/diagnostics-DiaUv_iK.d.ts +2904 -0
- package/dist/index.cjs +2523 -1071
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +80 -273
- package/dist/index.js +2513 -1067
- package/dist/index.js.map +1 -1
- package/dist/memoryStorage-CUj1hrxa.cjs +823 -0
- package/dist/memoryStorage-CUj1hrxa.cjs.map +1 -0
- package/dist/memoryStorage-CWFzAz4o.js +714 -0
- package/dist/memoryStorage-CWFzAz4o.js.map +1 -0
- package/dist/mocks.cjs +83 -23
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.ts +36 -10
- package/dist/mocks.js +85 -27
- package/dist/mocks.js.map +1 -1
- package/package.json +8 -28
- package/src/FileManager.ts +86 -64
- package/src/FileProcessor.ts +170 -44
- package/src/KubbDriver.ts +909 -0
- package/src/Transform.ts +105 -0
- package/src/constants.ts +111 -20
- package/src/createAdapter.ts +112 -17
- package/src/createKubb.ts +140 -517
- package/src/createRenderer.ts +43 -28
- package/src/createReporter.ts +134 -0
- package/src/createStorage.ts +36 -23
- package/src/defineGenerator.ts +140 -17
- package/src/defineParser.ts +30 -12
- package/src/definePlugin.ts +375 -21
- package/src/defineResolver.ts +402 -212
- package/src/diagnostics.ts +662 -0
- package/src/index.ts +8 -8
- package/src/mocks.ts +97 -26
- package/src/reporters/cliReporter.ts +89 -0
- package/src/reporters/fileReporter.ts +103 -0
- package/src/reporters/jsonReporter.ts +20 -0
- package/src/reporters/report.ts +85 -0
- package/src/storages/fsStorage.ts +23 -55
- package/src/types.ts +411 -887
- package/dist/PluginDriver-BkTRD2H2.js +0 -946
- package/dist/PluginDriver-BkTRD2H2.js.map +0 -1
- package/dist/PluginDriver-Cadu4ORh.cjs +0 -1037
- package/dist/PluginDriver-Cadu4ORh.cjs.map +0 -1
- package/dist/types-DVPKmzw_.d.ts +0 -2159
- package/src/Kubb.ts +0 -300
- package/src/PluginDriver.ts +0 -426
- package/src/defineLogger.ts +0 -19
- package/src/defineMiddleware.ts +0 -62
- package/src/devtools.ts +0 -59
- package/src/renderNode.ts +0 -35
- package/src/utils/diagnostics.ts +0 -18
- package/src/utils/isInputPath.ts +0 -10
- package/src/utils/packageJSON.ts +0 -99
- /package/dist/{chunk--u3MIqq1.js → chunk-C0LytTxp.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,35 @@
|
|
|
1
|
-
import { t as __name } from "./chunk
|
|
2
|
-
import { $ as
|
|
1
|
+
import { t as __name } from "./chunk-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-DiaUv_iK.js";
|
|
3
3
|
import * as ast from "@kubb/ast";
|
|
4
|
-
import { FileNode, InputNode, Node } from "@kubb/ast";
|
|
5
4
|
|
|
6
|
-
//#region ../../internals/utils/src/
|
|
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 `
|
|
12
|
+
* Extracted path parameters as a key-value map, or `null` when the path has none.
|
|
14
13
|
*/
|
|
15
|
-
params
|
|
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,298 +38,99 @@ type ObjectOptions = {
|
|
|
21
38
|
*/
|
|
22
39
|
type?: 'path' | 'template';
|
|
23
40
|
/**
|
|
24
|
-
*
|
|
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
|
-
*
|
|
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
|
|
52
|
-
#private;
|
|
56
|
+
declare class Url {
|
|
53
57
|
/**
|
|
54
|
-
*
|
|
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
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* ```
|
|
61
|
+
* Url.canParse('https://petstore.swagger.io/v2') // true
|
|
62
|
+
* Url.canParse('/pet/{petId}') // false
|
|
64
63
|
*/
|
|
65
|
-
|
|
66
|
-
/**
|
|
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
|
-
*
|
|
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
|
-
|
|
71
|
+
static toPath(path: string): string;
|
|
75
72
|
/**
|
|
76
|
-
* Converts
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
92
|
-
|
|
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
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* new URLPath('/pet').params // undefined
|
|
98
|
-
* ```
|
|
93
|
+
* Url.toObject('/pet/{petId}')
|
|
94
|
+
* // { url: '/pet/:petId', params: { petId: 'petId' } }
|
|
99
95
|
*/
|
|
100
|
-
|
|
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/
|
|
143
|
-
type AdapterBuilder<T extends AdapterFactoryOptions> = (options: T['options']) => Adapter<T>;
|
|
104
|
+
//#region src/reporters/cliReporter.d.ts
|
|
144
105
|
/**
|
|
145
|
-
*
|
|
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
|
|
109
|
+
declare const cliReporter: Reporter;
|
|
170
110
|
//#endregion
|
|
171
|
-
//#region src/
|
|
111
|
+
//#region src/reporters/fileReporter.d.ts
|
|
172
112
|
/**
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* },
|
|
183
|
-
* })
|
|
184
|
-
* ```
|
|
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']`), replacing the
|
|
117
|
+
* old `--debug` flag.
|
|
118
|
+
*
|
|
119
|
+
* @note Unlike the streaming logger it replaced, it captures the collected diagnostics once a
|
|
120
|
+
* config finishes, not the live `kubb:info`/`kubb:plugin` event stream. Color is stripped so the
|
|
121
|
+
* file stays plain text even when the run is attached to a TTY.
|
|
185
122
|
*/
|
|
186
|
-
declare
|
|
123
|
+
declare const fileReporter: Reporter;
|
|
187
124
|
//#endregion
|
|
188
|
-
//#region src/
|
|
125
|
+
//#region src/reporters/jsonReporter.d.ts
|
|
189
126
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
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.
|
|
199
|
-
*/
|
|
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;
|
|
202
|
-
pluginName: T['name'];
|
|
203
|
-
};
|
|
204
|
-
/**
|
|
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
|
-
* ```
|
|
217
|
-
*
|
|
218
|
-
* @example Override merging
|
|
219
|
-
* ```ts
|
|
220
|
-
* const options = defaultResolveOptions(operationNode, {
|
|
221
|
-
* options: { enumType: 'asConst' },
|
|
222
|
-
* override: [{ type: 'operationId', pattern: 'listPets', options: { enumType: 'enum' } }],
|
|
223
|
-
* })
|
|
224
|
-
* // → { enumType: 'enum' } when operationId matches
|
|
225
|
-
* ```
|
|
127
|
+
* The `json` reporter. `report` returns one config's {@link Report}, which {@link createReporter}
|
|
128
|
+
* buffers, and `drain` writes them as a single pretty-printed JSON array on `kubb:lifecycle:end`.
|
|
129
|
+
* Buffering keeps a multi-config run one valid JSON document on stdout instead of concatenated
|
|
130
|
+
* objects that would break `jq .`. The terminal reporter is suppressed while `json` is active so
|
|
131
|
+
* stdout stays valid JSON.
|
|
226
132
|
*/
|
|
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
|
-
*
|
|
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
|
|
241
|
-
* ```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')
|
|
249
|
-
* },
|
|
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)
|
|
259
|
-
* },
|
|
260
|
-
* }))
|
|
261
|
-
* ```
|
|
262
|
-
*
|
|
263
|
-
* @example Use ctx.default inside a helper
|
|
264
|
-
* ```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')
|
|
269
|
-
* },
|
|
270
|
-
* }))
|
|
271
|
-
* ```
|
|
272
|
-
*/
|
|
273
|
-
declare function defineResolver<T extends PluginFactoryOptions>(build: ResolverBuilder<T>): T['resolver'];
|
|
274
|
-
//#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
|
-
};
|
|
295
|
-
/**
|
|
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.
|
|
298
|
-
*
|
|
299
|
-
* @internal
|
|
300
|
-
*/
|
|
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
|
-
}
|
|
133
|
+
declare const jsonReporter: Reporter;
|
|
316
134
|
//#endregion
|
|
317
135
|
//#region src/storages/fsStorage.d.ts
|
|
318
136
|
/**
|
|
@@ -322,11 +140,11 @@ declare class FileProcessor {
|
|
|
322
140
|
* Keys are resolved against `process.cwd()`, so root-relative paths such as
|
|
323
141
|
* `src/gen/api/getPets.ts` are written to the correct location without extra configuration.
|
|
324
142
|
*
|
|
325
|
-
*
|
|
326
|
-
* -
|
|
327
|
-
* -
|
|
328
|
-
* -
|
|
329
|
-
* -
|
|
143
|
+
* Writes are deduplicated and directory-safe:
|
|
144
|
+
* - leading and trailing whitespace is trimmed before writing
|
|
145
|
+
* - the write is skipped when the file content is already identical
|
|
146
|
+
* - missing parent directories are created automatically
|
|
147
|
+
* - Bun's native file API is used when running under Bun
|
|
330
148
|
*
|
|
331
149
|
* @example
|
|
332
150
|
* ```ts
|
|
@@ -364,16 +182,5 @@ declare const fsStorage: (options?: Record<string, never> | undefined) => Storag
|
|
|
364
182
|
*/
|
|
365
183
|
declare const memoryStorage: (options?: Record<string, never> | undefined) => Storage;
|
|
366
184
|
//#endregion
|
|
367
|
-
|
|
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
|
-
input: InputPath;
|
|
373
|
-
};
|
|
374
|
-
declare function isInputPath(config: Config | undefined): config is Config<InputPath> & {
|
|
375
|
-
input: InputPath;
|
|
376
|
-
};
|
|
377
|
-
//#endregion
|
|
378
|
-
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 };
|
|
185
|
+
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 };
|
|
379
186
|
//# sourceMappingURL=index.d.ts.map
|