@kubb/core 5.0.0-beta.22 → 5.0.0-beta.24
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/{KubbDriver-l31wllgN.js → KubbDriver-BkwOamHp.js} +35 -34
- package/dist/KubbDriver-BkwOamHp.js.map +1 -0
- package/dist/{KubbDriver-DLha_xyo.cjs → KubbDriver-BmIbZ4YM.cjs} +35 -34
- package/dist/KubbDriver-BmIbZ4YM.cjs.map +1 -0
- package/dist/{createKubb-CYrw_xaR.d.ts → createKubb-C4zvIUKX.d.ts} +321 -188
- package/dist/index.cjs +150 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +150 -71
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +1 -1
- package/package.json +4 -4
- package/src/KubbDriver.ts +1 -1
- package/src/createAdapter.ts +44 -31
- package/src/createKubb.ts +37 -13
- package/src/createRenderer.ts +28 -8
- package/src/createStorage.ts +36 -23
- package/src/defineGenerator.ts +31 -8
- package/src/defineLogger.ts +33 -13
- package/src/defineMiddleware.ts +18 -16
- package/src/defineParser.ts +29 -12
- package/src/definePlugin.ts +52 -40
- package/src/defineResolver.ts +20 -25
- package/dist/KubbDriver-DLha_xyo.cjs.map +0 -1
- package/dist/KubbDriver-l31wllgN.js.map +0 -1
|
@@ -115,8 +115,12 @@ declare const logLevel: {
|
|
|
115
115
|
//#endregion
|
|
116
116
|
//#region src/createAdapter.d.ts
|
|
117
117
|
/**
|
|
118
|
-
* Source data
|
|
119
|
-
*
|
|
118
|
+
* Source data handed to an adapter's `parse` function. Mirrors the config
|
|
119
|
+
* input shape with paths resolved to absolute.
|
|
120
|
+
*
|
|
121
|
+
* - `{ type: 'path' }`: single file on disk.
|
|
122
|
+
* - `{ type: 'paths' }`: multiple files (e.g. split spec).
|
|
123
|
+
* - `{ type: 'data' }`: raw string or parsed object provided inline.
|
|
120
124
|
*/
|
|
121
125
|
type AdapterSource = {
|
|
122
126
|
type: 'path';
|
|
@@ -129,12 +133,12 @@ type AdapterSource = {
|
|
|
129
133
|
paths: Array<string>;
|
|
130
134
|
};
|
|
131
135
|
/**
|
|
132
|
-
* Generic
|
|
136
|
+
* Generic parameters used by `createAdapter` and the resulting `Adapter` type.
|
|
133
137
|
*
|
|
134
|
-
* - `TName
|
|
135
|
-
* - `TOptions
|
|
136
|
-
* - `TResolvedOptions
|
|
137
|
-
* - `TDocument
|
|
138
|
+
* - `TName`: unique adapter identifier (`'oas'`, `'asyncapi'`, ...).
|
|
139
|
+
* - `TOptions`: user-facing options accepted by the adapter factory.
|
|
140
|
+
* - `TResolvedOptions`: options after defaults are applied.
|
|
141
|
+
* - `TDocument`: type of the parsed source document.
|
|
138
142
|
*/
|
|
139
143
|
type AdapterFactoryOptions<TName extends string = string, TOptions extends object = object, TResolvedOptions extends object = TOptions, TDocument = unknown> = {
|
|
140
144
|
name: TName;
|
|
@@ -143,19 +147,23 @@ type AdapterFactoryOptions<TName extends string = string, TOptions extends objec
|
|
|
143
147
|
document: TDocument;
|
|
144
148
|
};
|
|
145
149
|
/**
|
|
146
|
-
*
|
|
150
|
+
* Converts input files or inline data into Kubb's universal AST `InputNode`.
|
|
147
151
|
*
|
|
148
|
-
* Adapters
|
|
149
|
-
*
|
|
152
|
+
* Adapters live between the spec format and the plugins. The built-in
|
|
153
|
+
* `@kubb/adapter-oas` handles OpenAPI 2.0, 3.0, and 3.1; custom adapters can
|
|
154
|
+
* support GraphQL, gRPC, AsyncAPI, or any domain-specific schema language.
|
|
150
155
|
*
|
|
151
156
|
* @example
|
|
152
157
|
* ```ts
|
|
158
|
+
* import { defineConfig } from 'kubb'
|
|
153
159
|
* import { adapterOas } from '@kubb/adapter-oas'
|
|
160
|
+
* import { pluginTs } from '@kubb/plugin-ts'
|
|
154
161
|
*
|
|
155
162
|
* export default defineConfig({
|
|
163
|
+
* input: { path: './petStore.yaml' },
|
|
164
|
+
* output: { path: './src/gen' },
|
|
156
165
|
* adapter: adapterOas(),
|
|
157
|
-
*
|
|
158
|
-
* plugins: [pluginTs(), pluginZod()],
|
|
166
|
+
* plugins: [pluginTs()],
|
|
159
167
|
* })
|
|
160
168
|
* ```
|
|
161
169
|
*/
|
|
@@ -197,35 +205,40 @@ type Adapter<TOptions extends AdapterFactoryOptions = AdapterFactoryOptions> = {
|
|
|
197
205
|
* Memory-efficient streaming variant of `parse()`.
|
|
198
206
|
*
|
|
199
207
|
* Returns an `InputStreamNode` whose `schemas` and `operations` are `AsyncIterable`.
|
|
200
|
-
* Each `for await` loop creates a fresh parse pass over the cached in-memory document
|
|
201
|
-
*
|
|
208
|
+
* Each `for await` loop creates a fresh parse pass over the cached in-memory document.
|
|
209
|
+
* No pre-built arrays are held in memory.
|
|
202
210
|
*/
|
|
203
211
|
stream?: (source: AdapterSource) => Promise<InputStreamNode>;
|
|
204
212
|
};
|
|
205
213
|
type AdapterBuilder<T extends AdapterFactoryOptions> = (options: T['options']) => Adapter<T>;
|
|
206
214
|
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
215
|
+
* Defines a custom adapter that translates a spec format into Kubb's universal
|
|
216
|
+
* AST. Use this when you need to consume GraphQL, gRPC, AsyncAPI, or another
|
|
217
|
+
* domain-specific schema. Built-in adapters: `@kubb/adapter-oas` for
|
|
218
|
+
* OpenAPI/Swagger documents.
|
|
211
219
|
*
|
|
212
|
-
*
|
|
220
|
+
* Adapters must return an `InputNode` from `parse`. That node is what every
|
|
221
|
+
* plugin in the build consumes.
|
|
213
222
|
*
|
|
214
223
|
* @example
|
|
215
224
|
* ```ts
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
* options,
|
|
220
|
-
* async parse(source) {
|
|
221
|
-
* // Transform source format to InputNode
|
|
222
|
-
* return { ... }
|
|
223
|
-
* },
|
|
224
|
-
* }
|
|
225
|
-
* })
|
|
225
|
+
* import { createAdapter, ast, type AdapterFactoryOptions } from '@kubb/core'
|
|
226
|
+
*
|
|
227
|
+
* type MyAdapter = AdapterFactoryOptions<'my-adapter', { validate?: boolean }>
|
|
226
228
|
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
+
* export const myAdapter = createAdapter<MyAdapter>((options) => ({
|
|
230
|
+
* name: 'my-adapter',
|
|
231
|
+
* options,
|
|
232
|
+
* document: null,
|
|
233
|
+
* async parse(_source) {
|
|
234
|
+
* // Convert `source` (path or inline data) into an InputNode.
|
|
235
|
+
* return ast.createInput()
|
|
236
|
+
* },
|
|
237
|
+
* getImports: () => [],
|
|
238
|
+
* async validate() {
|
|
239
|
+
* // Throw or call ctx.error here when the spec is invalid.
|
|
240
|
+
* },
|
|
241
|
+
* }))
|
|
229
242
|
* ```
|
|
230
243
|
*/
|
|
231
244
|
declare function createAdapter<T extends AdapterFactoryOptions = AdapterFactoryOptions>(build: AdapterBuilder<T>): (options?: T['options']) => Adapter<T>;
|
|
@@ -277,17 +290,37 @@ type Renderer<TElement = unknown> = {
|
|
|
277
290
|
*/
|
|
278
291
|
type RendererFactory<TElement = unknown> = () => Renderer<TElement>;
|
|
279
292
|
/**
|
|
280
|
-
*
|
|
293
|
+
* Defines a renderer factory. Renderers turn the generator's return value
|
|
294
|
+
* (JSX, a template string, a tree of any shape) into `FileNode`s that get
|
|
295
|
+
* written to disk.
|
|
281
296
|
*
|
|
282
|
-
*
|
|
297
|
+
* Use this to support output formats beyond JSX — for instance, a Handlebars
|
|
298
|
+
* renderer, a string-template renderer, or a renderer that writes binary
|
|
299
|
+
* files. Plugins and generators pick the renderer to use via the `renderer`
|
|
300
|
+
* field on `defineGenerator`.
|
|
301
|
+
*
|
|
302
|
+
* @example A minimal renderer that wraps a custom runtime
|
|
283
303
|
* ```ts
|
|
284
|
-
*
|
|
285
|
-
*
|
|
304
|
+
* import { createRenderer } from '@kubb/core'
|
|
305
|
+
*
|
|
306
|
+
* export const myRenderer = createRenderer(() => {
|
|
307
|
+
* const runtime = new MyRuntime()
|
|
286
308
|
* return {
|
|
287
|
-
* async render(element) {
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
309
|
+
* async render(element) {
|
|
310
|
+
* await runtime.render(element)
|
|
311
|
+
* },
|
|
312
|
+
* get files() {
|
|
313
|
+
* return runtime.files
|
|
314
|
+
* },
|
|
315
|
+
* dispose() {
|
|
316
|
+
* runtime.dispose()
|
|
317
|
+
* },
|
|
318
|
+
* unmount(error) {
|
|
319
|
+
* runtime.dispose(error)
|
|
320
|
+
* },
|
|
321
|
+
* [Symbol.dispose]() {
|
|
322
|
+
* this.dispose()
|
|
323
|
+
* },
|
|
291
324
|
* }
|
|
292
325
|
* })
|
|
293
326
|
* ```
|
|
@@ -295,70 +328,83 @@ type RendererFactory<TElement = unknown> = () => Renderer<TElement>;
|
|
|
295
328
|
declare function createRenderer<TElement = unknown>(factory: RendererFactory<TElement>): RendererFactory<TElement>;
|
|
296
329
|
//#endregion
|
|
297
330
|
//#region src/createStorage.d.ts
|
|
331
|
+
/**
|
|
332
|
+
* Backend that persists generated files. Kubb ships with `fsStorage` (writes
|
|
333
|
+
* to disk) and `memoryStorage` (keeps everything in RAM). Implement this
|
|
334
|
+
* interface to write to S3, a database, or any other target.
|
|
335
|
+
*/
|
|
298
336
|
type Storage = {
|
|
299
337
|
/**
|
|
300
|
-
* Identifier used
|
|
338
|
+
* Identifier used in logs and diagnostics (`'fs'`, `'memory'`, `'s3'`).
|
|
301
339
|
*/
|
|
302
340
|
readonly name: string;
|
|
303
341
|
/**
|
|
304
|
-
* Returns `true` when an entry for `key` exists
|
|
342
|
+
* Returns `true` when an entry for `key` exists.
|
|
305
343
|
*/
|
|
306
344
|
hasItem(key: string): Promise<boolean>;
|
|
307
345
|
/**
|
|
308
|
-
*
|
|
346
|
+
* Reads the stored string. Returns `null` when the key is missing.
|
|
309
347
|
*/
|
|
310
348
|
getItem(key: string): Promise<string | null>;
|
|
311
349
|
/**
|
|
312
|
-
*
|
|
350
|
+
* Stores `value` under `key`, creating any required structure (directories,
|
|
351
|
+
* buckets, ...).
|
|
313
352
|
*/
|
|
314
353
|
setItem(key: string, value: string): Promise<void>;
|
|
315
354
|
/**
|
|
316
|
-
*
|
|
355
|
+
* Deletes the entry for `key`. No-op when the key does not exist.
|
|
317
356
|
*/
|
|
318
357
|
removeItem(key: string): Promise<void>;
|
|
319
358
|
/**
|
|
320
|
-
* Returns
|
|
359
|
+
* Returns every key. Pass `base` to filter to keys starting with that prefix.
|
|
321
360
|
*/
|
|
322
361
|
getKeys(base?: string): Promise<Array<string>>;
|
|
323
362
|
/**
|
|
324
|
-
* Removes
|
|
363
|
+
* Removes every entry. Pass `base` to scope the wipe to a key prefix.
|
|
325
364
|
*/
|
|
326
365
|
clear(base?: string): Promise<void>;
|
|
327
366
|
/**
|
|
328
|
-
* Optional teardown hook called after the build completes.
|
|
367
|
+
* Optional teardown hook called after the build completes. Use to flush
|
|
368
|
+
* buffers, close connections, or release file locks.
|
|
329
369
|
*/
|
|
330
370
|
dispose?(): Promise<void>;
|
|
331
371
|
};
|
|
332
372
|
/**
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
373
|
+
* Defines a custom storage backend. The builder receives user options and
|
|
374
|
+
* returns a `Storage` implementation. Kubb ships with filesystem and
|
|
375
|
+
* in-memory storages — reach for this when you need to write generated files
|
|
376
|
+
* elsewhere (cloud storage, a database, a remote API).
|
|
337
377
|
*
|
|
338
|
-
* @
|
|
339
|
-
*
|
|
340
|
-
* @example
|
|
378
|
+
* @example In-memory storage (the built-in implementation)
|
|
341
379
|
* ```ts
|
|
342
380
|
* import { createStorage } from '@kubb/core'
|
|
343
381
|
*
|
|
344
382
|
* export const memoryStorage = createStorage(() => {
|
|
345
383
|
* const store = new Map<string, string>()
|
|
384
|
+
*
|
|
346
385
|
* return {
|
|
347
386
|
* name: 'memory',
|
|
348
|
-
* async hasItem(key) {
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
* async
|
|
387
|
+
* async hasItem(key) {
|
|
388
|
+
* return store.has(key)
|
|
389
|
+
* },
|
|
390
|
+
* async getItem(key) {
|
|
391
|
+
* return store.get(key) ?? null
|
|
392
|
+
* },
|
|
393
|
+
* async setItem(key, value) {
|
|
394
|
+
* store.set(key, value)
|
|
395
|
+
* },
|
|
396
|
+
* async removeItem(key) {
|
|
397
|
+
* store.delete(key)
|
|
398
|
+
* },
|
|
352
399
|
* async getKeys(base) {
|
|
353
400
|
* const keys = [...store.keys()]
|
|
354
401
|
* return base ? keys.filter((k) => k.startsWith(base)) : keys
|
|
355
402
|
* },
|
|
356
|
-
* async clear(base) {
|
|
403
|
+
* async clear(base) {
|
|
404
|
+
* if (!base) store.clear()
|
|
405
|
+
* },
|
|
357
406
|
* }
|
|
358
407
|
* })
|
|
359
|
-
*
|
|
360
|
-
* // Instantiate:
|
|
361
|
-
* const storage = memoryStorage()
|
|
362
408
|
* ```
|
|
363
409
|
*/
|
|
364
410
|
declare function createStorage<TOptions = Record<string, never>>(build: (options: TOptions) => Storage): (options?: TOptions) => Storage;
|
|
@@ -376,41 +422,58 @@ type DevtoolsOptions = {
|
|
|
376
422
|
type PrintOptions = {
|
|
377
423
|
extname?: FileNode['extname'];
|
|
378
424
|
};
|
|
379
|
-
|
|
425
|
+
/**
|
|
426
|
+
* Converts a resolved {@link FileNode} into the final source string that gets
|
|
427
|
+
* written to disk. Kubb ships with TypeScript and TSX parsers; add your own
|
|
428
|
+
* for new file types (JSON, Markdown, ...).
|
|
429
|
+
*/
|
|
430
|
+
type Parser<TMeta extends object = any, TNode = unknown> = {
|
|
431
|
+
/**
|
|
432
|
+
* Display name used in diagnostics and the parser registry.
|
|
433
|
+
*/
|
|
380
434
|
name: string;
|
|
381
435
|
/**
|
|
382
|
-
* File extensions this parser handles.
|
|
383
|
-
*
|
|
436
|
+
* File extensions this parser handles. Set to `undefined` to define a
|
|
437
|
+
* catch-all fallback used when no other parser claims the extension.
|
|
384
438
|
*
|
|
385
|
-
* @example
|
|
439
|
+
* @example
|
|
386
440
|
* `['.ts', '.js']`
|
|
387
441
|
*/
|
|
388
442
|
extNames: Array<FileNode['extname']> | undefined;
|
|
389
443
|
/**
|
|
390
|
-
*
|
|
444
|
+
* Serialise the file's AST into source code.
|
|
391
445
|
*/
|
|
392
446
|
parse(file: FileNode<TMeta>, options?: PrintOptions): string;
|
|
447
|
+
/**
|
|
448
|
+
* Render compiler AST nodes for this parser's language into source text.
|
|
449
|
+
* Plugins call this to format the nodes they assemble before handing them
|
|
450
|
+
* back to the parser as `FileNode.sources`.
|
|
451
|
+
*/
|
|
452
|
+
print(...nodes: TNode[]): string;
|
|
393
453
|
};
|
|
394
454
|
/**
|
|
395
|
-
* Defines a parser with type
|
|
396
|
-
*
|
|
397
|
-
* @note Call the returned factory with optional options to instantiate the parser.
|
|
455
|
+
* Defines a parser with type-safe `this`. Used to register handlers for new
|
|
456
|
+
* file extensions or to plug a non-TypeScript output into the build.
|
|
398
457
|
*
|
|
399
458
|
* @example
|
|
400
459
|
* ```ts
|
|
401
|
-
* import { defineParser } from '@kubb/core'
|
|
460
|
+
* import { defineParser, ast } from '@kubb/core'
|
|
402
461
|
*
|
|
403
462
|
* export const jsonParser = defineParser({
|
|
404
463
|
* name: 'json',
|
|
405
464
|
* extNames: ['.json'],
|
|
406
465
|
* parse(file) {
|
|
407
|
-
*
|
|
408
|
-
*
|
|
466
|
+
* return file.sources
|
|
467
|
+
* .map((source) => ast.extractStringsFromNodes(source.nodes ?? []))
|
|
468
|
+
* .join('\n')
|
|
469
|
+
* },
|
|
470
|
+
* print(...nodes) {
|
|
471
|
+
* return nodes.map(String).join('\n')
|
|
409
472
|
* },
|
|
410
473
|
* })
|
|
411
474
|
* ```
|
|
412
475
|
*/
|
|
413
|
-
declare function defineParser<
|
|
476
|
+
declare function defineParser<T extends Parser>(parser: T): T;
|
|
414
477
|
//#endregion
|
|
415
478
|
//#region src/FileProcessor.d.ts
|
|
416
479
|
type ParseOptions = {
|
|
@@ -457,47 +520,67 @@ declare class FileProcessor {
|
|
|
457
520
|
}
|
|
458
521
|
//#endregion
|
|
459
522
|
//#region src/defineLogger.d.ts
|
|
523
|
+
/**
|
|
524
|
+
* Options accepted by a logger's `install` callback.
|
|
525
|
+
*/
|
|
460
526
|
type LoggerOptions = {
|
|
461
527
|
/**
|
|
462
|
-
*
|
|
463
|
-
*
|
|
528
|
+
* Output verbosity. Use the `logLevel` constants exported from `@kubb/core`
|
|
529
|
+
* (`silent`, `error`, `warn`, `info`, `verbose`, `debug`).
|
|
464
530
|
*/
|
|
465
531
|
logLevel: (typeof logLevel)[keyof typeof logLevel];
|
|
466
532
|
};
|
|
467
533
|
/**
|
|
468
|
-
*
|
|
534
|
+
* Event emitter handed to `Logger.install`. Use `.on('kubb:info', ...)` and
|
|
535
|
+
* friends to subscribe to build events.
|
|
469
536
|
*/
|
|
470
537
|
type LoggerContext = AsyncEventEmitter<KubbHooks>;
|
|
538
|
+
/**
|
|
539
|
+
* Logger contract. A logger receives the build's event emitter and subscribes
|
|
540
|
+
* to whichever lifecycle events it wants to forward to its destination
|
|
541
|
+
* (console, file, remote sink).
|
|
542
|
+
*/
|
|
471
543
|
type Logger<TOptions extends LoggerOptions = LoggerOptions, TInstallReturn = void> = {
|
|
544
|
+
/**
|
|
545
|
+
* Display name used in diagnostics.
|
|
546
|
+
*/
|
|
472
547
|
name: string;
|
|
548
|
+
/**
|
|
549
|
+
* Called once per build with the shared event emitter. Subscribe to events
|
|
550
|
+
* here. The return value (if any) is forwarded to whoever installed the
|
|
551
|
+
* logger, which is handy for sink factories.
|
|
552
|
+
*/
|
|
473
553
|
install: (context: LoggerContext, options?: TOptions) => TInstallReturn | Promise<TInstallReturn>;
|
|
474
554
|
};
|
|
475
555
|
type UserLogger<TOptions extends LoggerOptions = LoggerOptions, TInstallReturn = void> = Logger<TOptions, TInstallReturn>;
|
|
476
556
|
/**
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
*
|
|
480
|
-
* a value from `install` — for example, a sink factory that the caller can
|
|
481
|
-
* forward to hook execution.
|
|
557
|
+
* Defines a typed logger. Use the second type parameter to declare a return
|
|
558
|
+
* value from `install`, which is handy when the logger exposes a sink factory
|
|
559
|
+
* or cleanup callback to the caller.
|
|
482
560
|
*
|
|
483
561
|
* @example Basic logger
|
|
484
562
|
* ```ts
|
|
563
|
+
* import { defineLogger } from '@kubb/core'
|
|
564
|
+
*
|
|
485
565
|
* export const myLogger = defineLogger({
|
|
486
566
|
* name: 'my-logger',
|
|
487
|
-
* install(context
|
|
488
|
-
* context.on('kubb:info', (message) => console.log('ℹ', message))
|
|
489
|
-
* context.on('kubb:error', (error) => console.error('✗', error.message))
|
|
567
|
+
* install(context) {
|
|
568
|
+
* context.on('kubb:info', ({ message }) => console.log('ℹ', message))
|
|
569
|
+
* context.on('kubb:error', ({ error }) => console.error('✗', error.message))
|
|
490
570
|
* },
|
|
491
571
|
* })
|
|
492
572
|
* ```
|
|
493
573
|
*
|
|
494
574
|
* @example Logger that returns a hook sink factory
|
|
495
575
|
* ```ts
|
|
576
|
+
* import { defineLogger, type LoggerOptions } from '@kubb/core'
|
|
577
|
+
* import type { HookSinkFactory } from './sinks'
|
|
578
|
+
*
|
|
496
579
|
* export const myLogger = defineLogger<LoggerOptions, HookSinkFactory>({
|
|
497
580
|
* name: 'my-logger',
|
|
498
|
-
* install(context
|
|
581
|
+
* install(context) {
|
|
499
582
|
* // … register event handlers …
|
|
500
|
-
* return (
|
|
583
|
+
* return () => ({ onStdout: console.log })
|
|
501
584
|
* },
|
|
502
585
|
* })
|
|
503
586
|
* ```
|
|
@@ -506,36 +589,34 @@ declare function defineLogger<Options extends LoggerOptions = LoggerOptions, TIn
|
|
|
506
589
|
//#endregion
|
|
507
590
|
//#region src/defineMiddleware.d.ts
|
|
508
591
|
/**
|
|
509
|
-
* A middleware instance
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
* always fire last.
|
|
592
|
+
* A middleware instance. Subscribes to lifecycle events via `hooks`. Middleware
|
|
593
|
+
* handlers always fire after every plugin handler for the same event, so they
|
|
594
|
+
* see the full set of generated files.
|
|
513
595
|
*/
|
|
514
596
|
type Middleware = {
|
|
515
597
|
/**
|
|
516
|
-
* Unique
|
|
598
|
+
* Unique name. Use a `middleware-<feature>` convention (e.g.
|
|
599
|
+
* `middleware-barrel`).
|
|
517
600
|
*/
|
|
518
601
|
name: string;
|
|
519
602
|
/**
|
|
520
|
-
* Lifecycle event handlers
|
|
521
|
-
*
|
|
522
|
-
* Handlers are registered after all plugin handlers, so they always fire last.
|
|
603
|
+
* Lifecycle event handlers. Any event from the global `KubbHooks` map can be
|
|
604
|
+
* subscribed to here. Handlers run after all plugin handlers for that event.
|
|
523
605
|
*/
|
|
524
606
|
hooks: { [K in keyof KubbHooks]?: (...args: KubbHooks[K]) => void | Promise<void> };
|
|
525
607
|
};
|
|
526
608
|
/**
|
|
527
|
-
* Creates a middleware factory
|
|
609
|
+
* Creates a middleware factory. Middleware fires after every plugin handler
|
|
610
|
+
* for the same event, which makes it the natural place for post-processing
|
|
611
|
+
* (barrel files, lint runs, audit logs).
|
|
528
612
|
*
|
|
529
|
-
*
|
|
530
|
-
*
|
|
613
|
+
* Per-build state belongs inside the factory closure so each `createKubb`
|
|
614
|
+
* invocation gets its own isolated instance.
|
|
531
615
|
*
|
|
532
|
-
* @
|
|
533
|
-
*
|
|
534
|
-
* @example
|
|
616
|
+
* @example Stateless middleware
|
|
535
617
|
* ```ts
|
|
536
618
|
* import { defineMiddleware } from '@kubb/core'
|
|
537
619
|
*
|
|
538
|
-
* // Stateless middleware
|
|
539
620
|
* export const logMiddleware = defineMiddleware(() => ({
|
|
540
621
|
* name: 'log-middleware',
|
|
541
622
|
* hooks: {
|
|
@@ -544,8 +625,12 @@ type Middleware = {
|
|
|
544
625
|
* },
|
|
545
626
|
* },
|
|
546
627
|
* }))
|
|
628
|
+
* ```
|
|
629
|
+
*
|
|
630
|
+
* @example Middleware with options and per-build state
|
|
631
|
+
* ```ts
|
|
632
|
+
* import { defineMiddleware } from '@kubb/core'
|
|
547
633
|
*
|
|
548
|
-
* // Middleware with options and per-build state
|
|
549
634
|
* export const prefixMiddleware = defineMiddleware((options: { prefix: string } = { prefix: '' }) => {
|
|
550
635
|
* const seen = new Set<string>()
|
|
551
636
|
* return {
|
|
@@ -717,49 +802,44 @@ type ResolverBuilder<T extends PluginFactoryOptions> = () => Omit<T['resolver'],
|
|
|
717
802
|
pluginName: T['name'];
|
|
718
803
|
} & ThisType<T['resolver']>;
|
|
719
804
|
/**
|
|
720
|
-
* Defines a resolver
|
|
721
|
-
*
|
|
805
|
+
* Defines a plugin resolver. The resolver is the object that decides what
|
|
806
|
+
* every generated symbol and file path is called. Built-in defaults handle
|
|
807
|
+
* name casing, include/exclude/override filtering, output path computation,
|
|
808
|
+
* and file construction. Supply your own to override any of them:
|
|
722
809
|
*
|
|
723
|
-
*
|
|
724
|
-
* - `
|
|
725
|
-
* - `
|
|
726
|
-
* - `
|
|
727
|
-
* - `
|
|
810
|
+
* - `default` — name casing strategy (camelCase / PascalCase).
|
|
811
|
+
* - `resolveOptions` — include/exclude/override filtering.
|
|
812
|
+
* - `resolvePath` — output path computation.
|
|
813
|
+
* - `resolveFile` — full `FileNode` construction.
|
|
814
|
+
* - `resolveBanner` / `resolveFooter` — top/bottom-of-file text.
|
|
728
815
|
*
|
|
729
|
-
* Methods in the returned object can call sibling resolver methods via `this
|
|
816
|
+
* Methods in the returned object can call sibling resolver methods via `this`,
|
|
817
|
+
* which keeps custom rules small (`this.default(name, 'type')` to delegate).
|
|
730
818
|
*
|
|
731
819
|
* @example Basic resolver with naming helpers
|
|
732
820
|
* ```ts
|
|
733
|
-
* export const
|
|
821
|
+
* export const resolverTs = defineResolver<PluginTs>(() => ({
|
|
734
822
|
* name: 'default',
|
|
735
|
-
* resolveName(
|
|
736
|
-
* return this.default(
|
|
823
|
+
* resolveName(name) {
|
|
824
|
+
* return this.default(name, 'function')
|
|
737
825
|
* },
|
|
738
|
-
*
|
|
739
|
-
* return this.default(
|
|
826
|
+
* resolveTypeName(name) {
|
|
827
|
+
* return this.default(name, 'type')
|
|
740
828
|
* },
|
|
741
829
|
* }))
|
|
742
830
|
* ```
|
|
743
831
|
*
|
|
744
|
-
* @example
|
|
832
|
+
* @example Custom output path
|
|
745
833
|
* ```ts
|
|
746
|
-
*
|
|
834
|
+
* import path from 'node:path'
|
|
835
|
+
*
|
|
836
|
+
* export const resolverTs = defineResolver<PluginTs>(() => ({
|
|
747
837
|
* name: 'custom',
|
|
748
838
|
* resolvePath({ baseName }, { root, output }) {
|
|
749
839
|
* return path.resolve(root, output.path, 'generated', baseName)
|
|
750
840
|
* },
|
|
751
841
|
* }))
|
|
752
842
|
* ```
|
|
753
|
-
*
|
|
754
|
-
* @example Use this.default inside a helper
|
|
755
|
-
* ```ts
|
|
756
|
-
* export const resolver = defineResolver<PluginTs>(() => ({
|
|
757
|
-
* name: 'default',
|
|
758
|
-
* resolveParamName(node, param) {
|
|
759
|
-
* return this.default(`${node.operationId} ${param.in} ${param.name}`, 'type')
|
|
760
|
-
* },
|
|
761
|
-
* }))
|
|
762
|
-
* ```
|
|
763
843
|
*/
|
|
764
844
|
declare function defineResolver<T extends PluginFactoryOptions>(build: ResolverBuilder<T>): T['resolver'];
|
|
765
845
|
//#endregion
|
|
@@ -773,39 +853,48 @@ declare function defineResolver<T extends PluginFactoryOptions>(build: ResolverB
|
|
|
773
853
|
*/
|
|
774
854
|
type ExtractRegistryKey$1<T, K extends PropertyKey> = K extends keyof T ? T[K] : {};
|
|
775
855
|
/**
|
|
776
|
-
* Output configuration
|
|
856
|
+
* Output configuration shared by every plugin. Each plugin extends this with
|
|
857
|
+
* its own keys via the `Kubb.PluginOptionsRegistry.output` interface merge.
|
|
777
858
|
*/
|
|
778
859
|
type Output<_TOptions = unknown> = {
|
|
779
860
|
/**
|
|
780
|
-
*
|
|
861
|
+
* Folder (or single file) where the plugin writes its generated code.
|
|
862
|
+
* Resolved against the global `output.path` set on `defineConfig`.
|
|
781
863
|
*/
|
|
782
864
|
path: string;
|
|
783
865
|
/**
|
|
784
|
-
* Text
|
|
785
|
-
*
|
|
866
|
+
* Text prepended to every generated file. Useful for license headers,
|
|
867
|
+
* lint disables, or `@ts-nocheck` directives. Pass a function to compute
|
|
868
|
+
* the banner from the file's `InputMeta`.
|
|
786
869
|
*/
|
|
787
870
|
banner?: string | ((meta?: InputMeta) => string);
|
|
788
871
|
/**
|
|
789
|
-
* Text
|
|
790
|
-
*
|
|
872
|
+
* Text appended at the end of every generated file. Mirror of `banner`.
|
|
873
|
+
* Pass a function to compute the footer from the file's `InputMeta`.
|
|
791
874
|
*/
|
|
792
875
|
footer?: string | ((meta?: InputMeta) => string);
|
|
793
876
|
/**
|
|
794
|
-
*
|
|
877
|
+
* Allows the plugin to overwrite hand-written files at the same path.
|
|
878
|
+
* Defaults to `false` to protect manual edits.
|
|
879
|
+
*
|
|
795
880
|
* @default false
|
|
796
881
|
*/
|
|
797
882
|
override?: boolean;
|
|
798
883
|
} & ExtractRegistryKey$1<Kubb.PluginOptionsRegistry, 'output'>;
|
|
884
|
+
/**
|
|
885
|
+
* Groups generated files into subdirectories based on an OpenAPI tag or path
|
|
886
|
+
* segment.
|
|
887
|
+
*/
|
|
799
888
|
type Group = {
|
|
800
889
|
/**
|
|
801
|
-
*
|
|
802
|
-
* - `'tag'` —
|
|
803
|
-
* - `'path'` —
|
|
890
|
+
* Property used to assign each operation to a group.
|
|
891
|
+
* - `'tag'` — uses the first tag (`operation.getTags().at(0)?.name`).
|
|
892
|
+
* - `'path'` — uses the first segment of the operation's URL.
|
|
804
893
|
*/
|
|
805
894
|
type: 'tag' | 'path';
|
|
806
895
|
/**
|
|
807
|
-
*
|
|
808
|
-
*
|
|
896
|
+
* Returns the subdirectory name from the group key. Defaults to
|
|
897
|
+
* `${camelCase(group)}Controller` for tags, or the first path segment.
|
|
809
898
|
*/
|
|
810
899
|
name?: (context: {
|
|
811
900
|
group: string;
|
|
@@ -872,42 +961,39 @@ type ByContentType = {
|
|
|
872
961
|
pattern: string | RegExp;
|
|
873
962
|
};
|
|
874
963
|
/**
|
|
875
|
-
*
|
|
876
|
-
*
|
|
877
|
-
*
|
|
878
|
-
* or internal-only schemas. Can filter by tag, operationId, path, HTTP method, content type, or schema name.
|
|
964
|
+
* Filter that skips matching operations or schemas during generation. Use it
|
|
965
|
+
* to drop deprecated endpoints, internal-only schemas, or anything you do
|
|
966
|
+
* not want code generated for.
|
|
879
967
|
*
|
|
880
968
|
* @example
|
|
881
969
|
* ```ts
|
|
882
970
|
* exclude: [
|
|
883
|
-
* { type: 'tag', pattern: 'internal' },
|
|
884
|
-
* { type: 'path', pattern: /^\/admin/ },
|
|
885
|
-
* { type: 'operationId', pattern:
|
|
971
|
+
* { type: 'tag', pattern: 'internal' },
|
|
972
|
+
* { type: 'path', pattern: /^\/admin/ },
|
|
973
|
+
* { type: 'operationId', pattern: /^deprecated_/ },
|
|
886
974
|
* ]
|
|
887
975
|
* ```
|
|
888
976
|
*/
|
|
889
977
|
type Exclude = ByTag | ByOperationId | ByPath | ByMethod | ByContentType | BySchemaName;
|
|
890
978
|
/**
|
|
891
|
-
*
|
|
892
|
-
*
|
|
893
|
-
* Use to generate code for a subset of operations or schemas. For example, only generate for a specific service
|
|
894
|
-
* tag or only for "production" endpoints. Can filter by tag, operationId, path, HTTP method, content type, or schema name.
|
|
979
|
+
* Filter that restricts generation to operations or schemas matching at least
|
|
980
|
+
* one entry. Useful for partial builds (one tag, one API version).
|
|
895
981
|
*
|
|
896
982
|
* @example
|
|
897
983
|
* ```ts
|
|
898
984
|
* include: [
|
|
899
|
-
* { type: 'tag', pattern: 'public' },
|
|
900
|
-
* { type: 'path', pattern: /^\/api\/v1/ },
|
|
985
|
+
* { type: 'tag', pattern: 'public' },
|
|
986
|
+
* { type: 'path', pattern: /^\/api\/v1/ },
|
|
901
987
|
* ]
|
|
902
988
|
* ```
|
|
903
989
|
*/
|
|
904
990
|
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType | BySchemaName;
|
|
905
991
|
/**
|
|
906
|
-
*
|
|
992
|
+
* Filter paired with a partial options object. When the filter matches, the
|
|
993
|
+
* options are merged on top of the plugin defaults for that operation only.
|
|
994
|
+
* Useful for "this one tag goes to a different folder" rules.
|
|
907
995
|
*
|
|
908
|
-
*
|
|
909
|
-
* for different tags, or use custom resolver functions per operation. Can filter by tag, operationId, path,
|
|
910
|
-
* HTTP method, schema name, or content type.
|
|
996
|
+
* Entries are evaluated top to bottom; the first matching entry wins.
|
|
911
997
|
*
|
|
912
998
|
* @example
|
|
913
999
|
* ```ts
|
|
@@ -915,13 +1001,13 @@ type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType | BySch
|
|
|
915
1001
|
* {
|
|
916
1002
|
* type: 'tag',
|
|
917
1003
|
* pattern: 'admin',
|
|
918
|
-
* options: { output: { path: './src/gen/admin' } }
|
|
1004
|
+
* options: { output: { path: './src/gen/admin' } },
|
|
919
1005
|
* },
|
|
920
1006
|
* {
|
|
921
1007
|
* type: 'operationId',
|
|
922
1008
|
* pattern: 'listPets',
|
|
923
|
-
* options: {
|
|
924
|
-
* }
|
|
1009
|
+
* options: { enumType: 'literal' },
|
|
1010
|
+
* },
|
|
925
1011
|
* ]
|
|
926
1012
|
* ```
|
|
927
1013
|
*/
|
|
@@ -1075,13 +1161,13 @@ type KubbPluginEndContext = {
|
|
|
1075
1161
|
upsertFile: (...files: Array<FileNode>) => void;
|
|
1076
1162
|
};
|
|
1077
1163
|
/**
|
|
1078
|
-
* Wraps a factory
|
|
1164
|
+
* Wraps a plugin factory and returns a function that accepts user options and
|
|
1165
|
+
* yields a fully typed `Plugin`. Lifecycle handlers go inside a single
|
|
1166
|
+
* `hooks` object (inspired by Astro integrations).
|
|
1079
1167
|
*
|
|
1080
|
-
*
|
|
1081
|
-
*
|
|
1082
|
-
*
|
|
1083
|
-
* @note For real plugins, use a `PluginFactoryOptions` type parameter to get type-safe context in `kubb:plugin:setup`.
|
|
1084
|
-
* Plugin names should follow the convention `plugin-<feature>` (e.g., `plugin-react-query`, `plugin-zod`).
|
|
1168
|
+
* Pass a `PluginFactoryOptions` type parameter to get a typed `ctx` inside
|
|
1169
|
+
* `kubb:plugin:setup`. Plugin names should follow the `plugin-<feature>`
|
|
1170
|
+
* convention (`plugin-react-query`, `plugin-zod`, ...).
|
|
1085
1171
|
*
|
|
1086
1172
|
* @example
|
|
1087
1173
|
* ```ts
|
|
@@ -1343,8 +1429,8 @@ type GeneratorContext<TOptions extends PluginFactoryOptions = PluginFactoryOptio
|
|
|
1343
1429
|
* Declares a named generator unit that walks the AST and emits files.
|
|
1344
1430
|
*
|
|
1345
1431
|
* Each method (`schema`, `operation`, `operations`) is called for the matching node type.
|
|
1346
|
-
* Each method returns `TElement | Array<FileNode> |
|
|
1347
|
-
* Return `Array<FileNode>` directly or call `ctx.upsertFile()` manually and return `
|
|
1432
|
+
* Each method returns `TElement | Array<FileNode> | undefined | null`. JSX-based generators require a `renderer` factory.
|
|
1433
|
+
* Return `Array<FileNode>` directly or call `ctx.upsertFile()` manually and return `undefined` or `null` to bypass rendering.
|
|
1348
1434
|
*
|
|
1349
1435
|
* @note Generators are consumed by plugins and registered via `ctx.addGenerator()` in `kubb:plugin:setup`.
|
|
1350
1436
|
*
|
|
@@ -1394,24 +1480,47 @@ type Generator$1<TOptions extends PluginFactoryOptions = PluginFactoryOptions, T
|
|
|
1394
1480
|
* `ctx` carries the plugin context with `adapter` and `meta` (document metadata),
|
|
1395
1481
|
* plus `ctx.options` with the per-node resolved options (after exclude/include/override).
|
|
1396
1482
|
*/
|
|
1397
|
-
schema?: (node: SchemaNode, ctx: GeneratorContext<TOptions>) => PossiblePromise<TElement | Array<FileNode> |
|
|
1483
|
+
schema?: (node: SchemaNode, ctx: GeneratorContext<TOptions>) => PossiblePromise<TElement | Array<FileNode> | undefined | null>;
|
|
1398
1484
|
/**
|
|
1399
1485
|
* Called for each operation node in the AST walk.
|
|
1400
1486
|
* `ctx` carries the plugin context with `adapter` and `meta` (document metadata),
|
|
1401
1487
|
* plus `ctx.options` with the per-node resolved options (after exclude/include/override).
|
|
1402
1488
|
*/
|
|
1403
|
-
operation?: (node: OperationNode, ctx: GeneratorContext<TOptions>) => PossiblePromise<TElement | Array<FileNode> |
|
|
1489
|
+
operation?: (node: OperationNode, ctx: GeneratorContext<TOptions>) => PossiblePromise<TElement | Array<FileNode> | undefined | null>;
|
|
1404
1490
|
/**
|
|
1405
1491
|
* Called once after all operations have been walked.
|
|
1406
1492
|
* `ctx` carries the plugin context with `adapter` and `meta` (document metadata),
|
|
1407
1493
|
* plus `ctx.options` with the plugin-level options for the batch call.
|
|
1408
1494
|
*/
|
|
1409
|
-
operations?: (nodes: Array<OperationNode>, ctx: GeneratorContext<TOptions>) => PossiblePromise<TElement | Array<FileNode> |
|
|
1495
|
+
operations?: (nodes: Array<OperationNode>, ctx: GeneratorContext<TOptions>) => PossiblePromise<TElement | Array<FileNode> | undefined | null>;
|
|
1410
1496
|
};
|
|
1411
1497
|
/**
|
|
1412
|
-
* Defines a generator
|
|
1413
|
-
*
|
|
1414
|
-
*
|
|
1498
|
+
* Defines a generator: a unit of work that runs during the plugin's AST walk
|
|
1499
|
+
* and produces files. Plugins register generators via `ctx.addGenerator()`
|
|
1500
|
+
* inside `kubb:plugin:setup`.
|
|
1501
|
+
*
|
|
1502
|
+
* The returned object is the input as-is, but with `this` types preserved so
|
|
1503
|
+
* `schema`/`operation`/`operations` methods are correctly typed against the
|
|
1504
|
+
* plugin's `PluginFactoryOptions`. Renderer elements and `FileNode[]` returns
|
|
1505
|
+
* are both handled by the runtime — pick whichever style fits.
|
|
1506
|
+
*
|
|
1507
|
+
* @example JSX-based schema generator
|
|
1508
|
+
* ```tsx
|
|
1509
|
+
* import { defineGenerator } from '@kubb/core'
|
|
1510
|
+
* import { jsxRenderer } from '@kubb/renderer-jsx'
|
|
1511
|
+
*
|
|
1512
|
+
* export const typeGenerator = defineGenerator({
|
|
1513
|
+
* name: 'typescript',
|
|
1514
|
+
* renderer: jsxRenderer,
|
|
1515
|
+
* schema(node, ctx) {
|
|
1516
|
+
* return (
|
|
1517
|
+
* <File path={`${ctx.root}/${node.name}.ts`}>
|
|
1518
|
+
* <Type node={node} resolver={ctx.resolver} />
|
|
1519
|
+
* </File>
|
|
1520
|
+
* )
|
|
1521
|
+
* },
|
|
1522
|
+
* })
|
|
1523
|
+
* ```
|
|
1415
1524
|
*/
|
|
1416
1525
|
declare function defineGenerator<TOptions extends PluginFactoryOptions = PluginFactoryOptions, TElement = unknown>(generator: Generator$1<TOptions, TElement>): Generator$1<TOptions, TElement>;
|
|
1417
1526
|
//#endregion
|
|
@@ -1486,22 +1595,25 @@ type Config<TInput = Input> = {
|
|
|
1486
1595
|
*/
|
|
1487
1596
|
name?: string;
|
|
1488
1597
|
/**
|
|
1489
|
-
* Project root directory, absolute or relative to the config file.
|
|
1490
|
-
*
|
|
1598
|
+
* Project root directory, absolute or relative to the config file. Already
|
|
1599
|
+
* resolved on the `Config` instance — see `UserConfig` for the optional
|
|
1600
|
+
* form that defaults to `process.cwd()`.
|
|
1491
1601
|
*/
|
|
1492
1602
|
root: string;
|
|
1493
1603
|
/**
|
|
1494
|
-
* Parsers that convert generated files
|
|
1495
|
-
*
|
|
1496
|
-
*
|
|
1497
|
-
*
|
|
1604
|
+
* Parsers that convert generated files into strings. Each parser handles a
|
|
1605
|
+
* set of file extensions; a fallback parser handles anything else.
|
|
1606
|
+
*
|
|
1607
|
+
* Already resolved on the `Config` instance — see `UserConfig` for the
|
|
1608
|
+
* optional form that defaults to `[parserTs, parserTsx]`.
|
|
1498
1609
|
*
|
|
1499
|
-
* @default [parserTs] from `@kubb/parser-ts`
|
|
1500
1610
|
* @example
|
|
1501
1611
|
* ```ts
|
|
1502
|
-
* import {
|
|
1612
|
+
* import { defineConfig } from 'kubb'
|
|
1613
|
+
* import { parserTs, parserTsx } from '@kubb/parser-ts'
|
|
1614
|
+
*
|
|
1503
1615
|
* export default defineConfig({
|
|
1504
|
-
* parsers: [parserTs,
|
|
1616
|
+
* parsers: [parserTs, parserTsx],
|
|
1505
1617
|
* })
|
|
1506
1618
|
* ```
|
|
1507
1619
|
*/
|
|
@@ -2192,6 +2304,11 @@ type CLIOptions = {
|
|
|
2192
2304
|
* Path to the Kubb config file.
|
|
2193
2305
|
*/
|
|
2194
2306
|
config?: string;
|
|
2307
|
+
/**
|
|
2308
|
+
* OpenAPI input path passed as the positional argument to `kubb generate`.
|
|
2309
|
+
* Overrides `config.input.path` when set.
|
|
2310
|
+
*/
|
|
2311
|
+
input?: string;
|
|
2195
2312
|
/**
|
|
2196
2313
|
* Re-run generation whenever input files change.
|
|
2197
2314
|
*/
|
|
@@ -2199,9 +2316,9 @@ type CLIOptions = {
|
|
|
2199
2316
|
/**
|
|
2200
2317
|
* Controls how much output the CLI prints.
|
|
2201
2318
|
*
|
|
2202
|
-
* @default '
|
|
2319
|
+
* @default 'info'
|
|
2203
2320
|
*/
|
|
2204
|
-
logLevel?: 'silent' | 'info' | 'debug';
|
|
2321
|
+
logLevel?: 'silent' | 'info' | 'verbose' | 'debug';
|
|
2205
2322
|
};
|
|
2206
2323
|
/**
|
|
2207
2324
|
* All accepted forms of a Kubb configuration.
|
|
@@ -2298,10 +2415,26 @@ declare class Kubb$1 {
|
|
|
2298
2415
|
[Symbol.dispose](): void;
|
|
2299
2416
|
}
|
|
2300
2417
|
/**
|
|
2301
|
-
*
|
|
2302
|
-
*
|
|
2418
|
+
* Constructs a {@link Kubb} build orchestrator from a user config. Equivalent
|
|
2419
|
+
* to `new Kubb(userConfig, options)` and the canonical public entry point.
|
|
2420
|
+
*
|
|
2421
|
+
* @example
|
|
2422
|
+
* ```ts
|
|
2423
|
+
* import { createKubb } from '@kubb/core'
|
|
2424
|
+
* import { adapterOas } from '@kubb/adapter-oas'
|
|
2425
|
+
* import { pluginTs } from '@kubb/plugin-ts'
|
|
2426
|
+
*
|
|
2427
|
+
* const kubb = createKubb({
|
|
2428
|
+
* input: { path: './petStore.yaml' },
|
|
2429
|
+
* output: { path: './src/gen' },
|
|
2430
|
+
* adapter: adapterOas(),
|
|
2431
|
+
* plugins: [pluginTs()],
|
|
2432
|
+
* })
|
|
2433
|
+
*
|
|
2434
|
+
* await kubb.build()
|
|
2435
|
+
* ```
|
|
2303
2436
|
*/
|
|
2304
2437
|
declare function createKubb(userConfig: UserConfig, options?: CreateKubbOptions): Kubb$1;
|
|
2305
2438
|
//#endregion
|
|
2306
2439
|
export { ResolverFileParams as $, createKubb as A, KubbPluginEndContext as B, KubbLifecycleStartContext as C, createAdapter as Ct, KubbWarnContext as D, KubbVersionNewContext as E, KubbDriver as F, Override as G, KubbPluginStartContext as H, FileManager as I, definePlugin as J, Plugin as K, Exclude as L, Generator$1 as M, GeneratorContext as N, PossibleConfig as O, defineGenerator as P, ResolverContext as Q, Group as R, KubbInfoContext as S, AdapterSource as St, KubbSuccessContext as T, AsyncEventEmitter as Tt, NormalizedPlugin as U, KubbPluginSetupContext as V, Output as W, ResolveOptionsContext as X, ResolveBannerContext as Y, Resolver as Z, KubbGenerationStartContext as _, Renderer as _t, InputPath as a, LoggerContext as at, KubbHookStartContext as b, Adapter as bt, KubbBuildStartContext as c, defineLogger as ct, KubbErrorContext as d, ParsedFile as dt, ResolverPathParams as et, KubbFileProcessingUpdate as f, Parser as ft, KubbGenerationEndContext as g, createStorage as gt, KubbFilesProcessingUpdateContext as h, Storage as ht, InputData as i, Logger as it, isInputPath as j, UserConfig as k, KubbConfigEndContext as l, FileProcessor as lt, KubbFilesProcessingStartContext as m, DevtoolsOptions as mt, CLIOptions as n, Middleware as nt, Kubb$1 as o, LoggerOptions as ot, KubbFilesProcessingEndContext as p, defineParser as pt, PluginFactoryOptions as q, Config as r, defineMiddleware as rt, KubbBuildEndContext as s, UserLogger as st, BuildOutput as t, defineResolver as tt, KubbDebugContext as u, FileProcessorEvents as ut, KubbGenerationSummaryContext as v, RendererFactory as vt, KubbPluginsEndContext as w, logLevel as wt, KubbHooks as x, AdapterFactoryOptions as xt, KubbHookEndContext as y, createRenderer as yt, Include as z };
|
|
2307
|
-
//# sourceMappingURL=createKubb-
|
|
2440
|
+
//# sourceMappingURL=createKubb-C4zvIUKX.d.ts.map
|