@kubb/core 5.0.0-beta.58 → 5.0.0-beta.59
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/{diagnostics-BNcDERWL.d.ts → diagnostics-B-UZnFqP.d.ts} +50 -65
- package/dist/index.cjs +17 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +18 -20
- package/dist/index.js.map +1 -1
- package/dist/{memoryStorage-Bz4ZDIZz.cjs → memoryStorage-CUj1hrxa.cjs} +4 -4
- package/dist/memoryStorage-CUj1hrxa.cjs.map +1 -0
- package/dist/{memoryStorage-DZYKdzI6.js → memoryStorage-CWFzAz4o.js} +4 -4
- package/dist/memoryStorage-CWFzAz4o.js.map +1 -0
- package/dist/mocks.cjs +1 -2
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.ts +1 -2
- package/dist/mocks.js +1 -2
- package/dist/mocks.js.map +1 -1
- package/package.json +4 -4
- package/src/KubbDriver.ts +3 -2
- package/src/createAdapter.ts +4 -5
- package/src/createRenderer.ts +3 -4
- package/src/createReporter.ts +1 -1
- package/src/createStorage.ts +4 -4
- package/src/defineGenerator.ts +2 -2
- package/src/definePlugin.ts +13 -18
- package/src/defineResolver.ts +4 -4
- package/src/diagnostics.ts +8 -11
- package/src/mocks.ts +0 -1
- package/src/reporters/cliReporter.ts +1 -1
- package/src/types.ts +9 -15
- package/dist/memoryStorage-Bz4ZDIZz.cjs.map +0 -1
- package/dist/memoryStorage-DZYKdzI6.js.map +0 -1
|
@@ -145,8 +145,8 @@ type AdapterFactoryOptions<TName extends string = string, TOptions extends objec
|
|
|
145
145
|
* Converts input files or inline data into Kubb's universal AST `InputNode`.
|
|
146
146
|
*
|
|
147
147
|
* Adapters live between the spec format and the plugins. The built-in
|
|
148
|
-
* `@kubb/adapter-oas` handles OpenAPI 2.0, 3.0, and 3.1
|
|
149
|
-
* support GraphQL, gRPC,
|
|
148
|
+
* `@kubb/adapter-oas` handles OpenAPI 2.0, 3.0, and 3.1. A custom adapter can
|
|
149
|
+
* support GraphQL, gRPC, or another schema language.
|
|
150
150
|
*
|
|
151
151
|
* @example
|
|
152
152
|
* ```ts
|
|
@@ -208,9 +208,8 @@ type Adapter<TOptions extends AdapterFactoryOptions = AdapterFactoryOptions> = {
|
|
|
208
208
|
type AdapterBuilder<T extends AdapterFactoryOptions> = (options: T['options']) => Adapter<T>;
|
|
209
209
|
/**
|
|
210
210
|
* Defines a custom adapter that translates a spec format into Kubb's universal
|
|
211
|
-
* AST
|
|
212
|
-
*
|
|
213
|
-
* OpenAPI/Swagger documents.
|
|
211
|
+
* AST, for example GraphQL, gRPC, or AsyncAPI. The built-in `@kubb/adapter-oas`
|
|
212
|
+
* handles OpenAPI/Swagger documents.
|
|
214
213
|
*
|
|
215
214
|
* Adapters must return an `InputNode` from `parse`. That node is what every
|
|
216
215
|
* plugin in the build consumes.
|
|
@@ -384,7 +383,7 @@ type ReporterContext = {
|
|
|
384
383
|
};
|
|
385
384
|
/**
|
|
386
385
|
* Host-facing reporter, as installed onto a run. Unlike a Logger (the live TUI view), a reporter
|
|
387
|
-
* never sees the event emitter. `report` runs once per config
|
|
386
|
+
* never sees the event emitter. `report` runs once per config. `drain`, when present, runs once
|
|
388
387
|
* after the last config.
|
|
389
388
|
*/
|
|
390
389
|
type Reporter = {
|
|
@@ -439,7 +438,7 @@ declare function createReporter<T = void>(reporter: UserReporter<T>): Reporter;
|
|
|
439
438
|
/**
|
|
440
439
|
* Backend that persists generated files. Kubb ships with `fsStorage` (writes
|
|
441
440
|
* to disk) and `memoryStorage` (keeps everything in RAM). Implement this
|
|
442
|
-
* interface to write
|
|
441
|
+
* interface to write somewhere else, such as S3 or a database.
|
|
443
442
|
*/
|
|
444
443
|
type Storage = {
|
|
445
444
|
/**
|
|
@@ -479,9 +478,9 @@ type Storage = {
|
|
|
479
478
|
};
|
|
480
479
|
/**
|
|
481
480
|
* Defines a custom storage backend. The builder receives user options and
|
|
482
|
-
* returns a `Storage` implementation. Kubb ships with filesystem and
|
|
483
|
-
*
|
|
484
|
-
*
|
|
481
|
+
* returns a `Storage` implementation. Kubb ships with filesystem and in-memory
|
|
482
|
+
* storages. A custom backend writes generated files elsewhere, such as cloud
|
|
483
|
+
* storage or a database.
|
|
485
484
|
*
|
|
486
485
|
* @example In-memory storage (the built-in implementation)
|
|
487
486
|
* ```ts
|
|
@@ -559,10 +558,9 @@ type RendererFactory<TElement = unknown> = () => Renderer<TElement>;
|
|
|
559
558
|
* (JSX, a template string, a tree of any shape) into `FileNode`s that get
|
|
560
559
|
* written to disk.
|
|
561
560
|
*
|
|
562
|
-
*
|
|
563
|
-
* renderer
|
|
564
|
-
*
|
|
565
|
-
* field on `defineGenerator`.
|
|
561
|
+
* A renderer can target output formats beyond JSX, for instance a Handlebars
|
|
562
|
+
* renderer or one that writes binary files. Plugins and generators pick the
|
|
563
|
+
* renderer to use via the `renderer` field on `defineGenerator`.
|
|
566
564
|
*
|
|
567
565
|
* @example A minimal renderer that wraps a custom runtime
|
|
568
566
|
* ```ts
|
|
@@ -797,8 +795,8 @@ type ResolverBuilder<T extends PluginFactoryOptions> = () => Omit<T['resolver'],
|
|
|
797
795
|
/**
|
|
798
796
|
* Default path resolver used by `defineResolver`.
|
|
799
797
|
*
|
|
800
|
-
* - `mode: 'file'`
|
|
801
|
-
* - `mode: 'directory'` (default)
|
|
798
|
+
* - `mode: 'file'` resolves directly to `output.path` (the full file path, extension included).
|
|
799
|
+
* - `mode: 'directory'` (default) resolves to `output.path/{baseName}`, or into a
|
|
802
800
|
* subdirectory when `group` and a `tag`/`path` value are provided.
|
|
803
801
|
*
|
|
804
802
|
* A custom `group.name` function overrides the default subdirectory naming.
|
|
@@ -850,8 +848,8 @@ type ResolverBuilder<T extends PluginFactoryOptions> = () => Omit<T['resolver'],
|
|
|
850
848
|
* - `resolveFile` builds the full `FileNode`.
|
|
851
849
|
* - `resolveBanner` and `resolveFooter` produce the top and bottom of file text.
|
|
852
850
|
*
|
|
853
|
-
* Methods in the returned object can call sibling resolver methods via `this
|
|
854
|
-
*
|
|
851
|
+
* Methods in the returned object can call sibling resolver methods via `this`.
|
|
852
|
+
* A custom rule can delegate to a default, for example `this.default(name, 'type')`.
|
|
855
853
|
*
|
|
856
854
|
* @example Basic resolver with naming helpers
|
|
857
855
|
* ```ts
|
|
@@ -882,9 +880,9 @@ declare function defineResolver<T extends PluginFactoryOptions>(build: ResolverB
|
|
|
882
880
|
//#endregion
|
|
883
881
|
//#region src/definePlugin.d.ts
|
|
884
882
|
/**
|
|
885
|
-
*
|
|
886
|
-
*
|
|
887
|
-
*
|
|
883
|
+
* Reads a type from a registry, falling back to `{}` when the key is absent. Lets
|
|
884
|
+
* `Kubb.ConfigOptionsRegistry` and `Kubb.PluginOptionsRegistry` be augmented without
|
|
885
|
+
* touching core.
|
|
888
886
|
*
|
|
889
887
|
* @internal
|
|
890
888
|
*/
|
|
@@ -966,7 +964,7 @@ type Group = {
|
|
|
966
964
|
* files into per-group subdirectories.
|
|
967
965
|
*
|
|
968
966
|
* Intersect into a plugin's `Options` type instead of declaring `output` and
|
|
969
|
-
* `group` directly
|
|
967
|
+
* `group` directly, since `mode` lives inside `output` while `group` is its sibling.
|
|
970
968
|
* The generic keeps a plugin's extended `Output` shape intact.
|
|
971
969
|
*
|
|
972
970
|
* @example
|
|
@@ -1048,9 +1046,8 @@ type ByContentType = {
|
|
|
1048
1046
|
pattern: string | RegExp;
|
|
1049
1047
|
};
|
|
1050
1048
|
/**
|
|
1051
|
-
* Filter that skips matching operations or schemas during generation
|
|
1052
|
-
*
|
|
1053
|
-
* not want code generated for.
|
|
1049
|
+
* Filter that skips matching operations or schemas during generation, for example
|
|
1050
|
+
* deprecated endpoints or internal-only schemas.
|
|
1054
1051
|
*
|
|
1055
1052
|
* @example
|
|
1056
1053
|
* ```ts
|
|
@@ -1125,8 +1122,8 @@ TResolver extends Resolver = Resolver> = {
|
|
|
1125
1122
|
resolver: TResolver;
|
|
1126
1123
|
};
|
|
1127
1124
|
/**
|
|
1128
|
-
* Context
|
|
1129
|
-
*
|
|
1125
|
+
* Context passed to a plugin's `kubb:plugin:setup` handler, where it registers generators and
|
|
1126
|
+
* sets its resolver, transformer, and options.
|
|
1130
1127
|
*/
|
|
1131
1128
|
type KubbPluginSetupContext<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
1132
1129
|
/**
|
|
@@ -1166,11 +1163,8 @@ type KubbPluginSetupContext<TFactory extends PluginFactoryOptions = PluginFactor
|
|
|
1166
1163
|
options: TFactory['options'];
|
|
1167
1164
|
};
|
|
1168
1165
|
/**
|
|
1169
|
-
* A plugin object produced by `definePlugin`.
|
|
1170
|
-
*
|
|
1171
|
-
* (matching Astro's integration naming convention).
|
|
1172
|
-
*
|
|
1173
|
-
* @template TFactory - The plugin's `PluginFactoryOptions` type.
|
|
1166
|
+
* A plugin object produced by `definePlugin`. Its lifecycle handlers live under a single
|
|
1167
|
+
* `hooks` property rather than flat methods.
|
|
1174
1168
|
*/
|
|
1175
1169
|
type Plugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
1176
1170
|
/**
|
|
@@ -1205,8 +1199,8 @@ type Plugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
1205
1199
|
};
|
|
1206
1200
|
};
|
|
1207
1201
|
/**
|
|
1208
|
-
* Normalized plugin after setup, with runtime fields populated.
|
|
1209
|
-
*
|
|
1202
|
+
* Normalized plugin after setup, with runtime fields populated. Internal only. Plugins use the
|
|
1203
|
+
* public `Plugin` type.
|
|
1210
1204
|
*
|
|
1211
1205
|
* @internal
|
|
1212
1206
|
*/
|
|
@@ -1244,8 +1238,7 @@ type KubbPluginEndContext = {
|
|
|
1244
1238
|
};
|
|
1245
1239
|
/**
|
|
1246
1240
|
* Wraps a plugin factory and returns a function that accepts user options and
|
|
1247
|
-
* yields a
|
|
1248
|
-
* `hooks` object (inspired by Astro integrations).
|
|
1241
|
+
* yields a typed `Plugin`. Lifecycle handlers go inside a single `hooks` object.
|
|
1249
1242
|
*
|
|
1250
1243
|
* Pass a `PluginFactoryOptions` type parameter to get a typed `ctx` inside
|
|
1251
1244
|
* `kubb:plugin:setup`. Plugin names should follow the `plugin-<feature>`
|
|
@@ -1329,7 +1322,8 @@ declare class KubbDriver {
|
|
|
1329
1322
|
readonly config: Config;
|
|
1330
1323
|
readonly options: Options;
|
|
1331
1324
|
/**
|
|
1332
|
-
* The streaming `InputNode<true>` produced by the adapter.
|
|
1325
|
+
* The streaming `InputNode<true>` produced by the adapter. Set after adapter setup.
|
|
1326
|
+
* Parse-only adapters are wrapped automatically.
|
|
1333
1327
|
*/
|
|
1334
1328
|
inputNode: InputNode<true> | null;
|
|
1335
1329
|
adapter: Adapter | null;
|
|
@@ -1545,8 +1539,8 @@ type GeneratorContext<TOptions extends PluginFactoryOptions = PluginFactoryOptio
|
|
|
1545
1539
|
* Declares a named generator unit that walks the AST and emits files.
|
|
1546
1540
|
*
|
|
1547
1541
|
* Each method (`schema`, `operation`, `operations`) is called for the matching node type.
|
|
1548
|
-
*
|
|
1549
|
-
*
|
|
1542
|
+
* JSX-based generators require a `renderer` factory. Return `Array<FileNode>` directly, or call
|
|
1543
|
+
* `ctx.upsertFile()` manually and return `null` to bypass rendering.
|
|
1550
1544
|
*
|
|
1551
1545
|
* @note Generators are consumed by plugins and registered via `ctx.addGenerator()` in `kubb:plugin:setup`.
|
|
1552
1546
|
*
|
|
@@ -1802,9 +1796,9 @@ type ParsedFile = {
|
|
|
1802
1796
|
//#endregion
|
|
1803
1797
|
//#region src/types.d.ts
|
|
1804
1798
|
/**
|
|
1805
|
-
*
|
|
1806
|
-
*
|
|
1807
|
-
* without
|
|
1799
|
+
* Extracts a type from a registry, falling back to `{}` when the key doesn't exist.
|
|
1800
|
+
* Lets plugins augment `Kubb.ConfigOptionsRegistry` and `Kubb.PluginOptionsRegistry`
|
|
1801
|
+
* without changing core.
|
|
1808
1802
|
*
|
|
1809
1803
|
* @internal
|
|
1810
1804
|
*/
|
|
@@ -1925,7 +1919,6 @@ type Config<TInput = Input> = {
|
|
|
1925
1919
|
* Remove every file in the output directory before the build, so stale output isn't mixed
|
|
1926
1920
|
* with new files. Leave `false` to preserve manual edits in the output directory.
|
|
1927
1921
|
*
|
|
1928
|
-
* @default false
|
|
1929
1922
|
* @example
|
|
1930
1923
|
* ```ts
|
|
1931
1924
|
* clean: true // wipes ./src/gen/* before generating
|
|
@@ -1936,7 +1929,6 @@ type Config<TInput = Input> = {
|
|
|
1936
1929
|
* Format the generated files after generation. `'auto'` runs the first formatter it finds
|
|
1937
1930
|
* (oxfmt, biome, or prettier), a named tool forces that one, and `false` skips formatting.
|
|
1938
1931
|
*
|
|
1939
|
-
* @default false
|
|
1940
1932
|
* @example
|
|
1941
1933
|
* ```ts
|
|
1942
1934
|
* format: 'auto' // auto-detect prettier, biome, or oxfmt
|
|
@@ -1949,7 +1941,6 @@ type Config<TInput = Input> = {
|
|
|
1949
1941
|
* Lint the generated files after generation. `'auto'` runs the first linter it finds
|
|
1950
1942
|
* (oxlint, biome, or eslint), a named tool forces that one, and `false` skips linting.
|
|
1951
1943
|
*
|
|
1952
|
-
* @default false
|
|
1953
1944
|
* @example
|
|
1954
1945
|
* ```ts
|
|
1955
1946
|
* lint: 'auto' // auto-detect oxlint, biome, or eslint
|
|
@@ -1987,7 +1978,6 @@ type Config<TInput = Input> = {
|
|
|
1987
1978
|
* Overwrite existing files when `true`, skip files that already exist when `false`. Individual
|
|
1988
1979
|
* plugins can override it. Keep `false` to avoid clobbering local edits in the output folder.
|
|
1989
1980
|
*
|
|
1990
|
-
* @default false
|
|
1991
1981
|
* @example
|
|
1992
1982
|
* ```ts
|
|
1993
1983
|
* override: true // regenerate everything, even existing files
|
|
@@ -2033,10 +2023,9 @@ type Config<TInput = Input> = {
|
|
|
2033
2023
|
*/
|
|
2034
2024
|
plugins: Array<Plugin>;
|
|
2035
2025
|
/**
|
|
2036
|
-
* Lifecycle hooks that
|
|
2026
|
+
* Lifecycle hooks that run external tools (prettier, eslint, a custom script) on build events.
|
|
2037
2027
|
*
|
|
2038
|
-
*
|
|
2039
|
-
* Currently supports the `done` hook which fires after all plugins complete.
|
|
2028
|
+
* Currently supports the `done` hook, which fires after all plugins complete.
|
|
2040
2029
|
*
|
|
2041
2030
|
* @example
|
|
2042
2031
|
* ```ts
|
|
@@ -2049,11 +2038,10 @@ type Config<TInput = Input> = {
|
|
|
2049
2038
|
*/
|
|
2050
2039
|
hooks?: {
|
|
2051
2040
|
/**
|
|
2052
|
-
* Command(s) to run after all plugins
|
|
2041
|
+
* Command(s) to run after all plugins finish generating, for post-processing the output.
|
|
2053
2042
|
*
|
|
2054
|
-
*
|
|
2055
|
-
*
|
|
2056
|
-
* Commands are executed relative to the `root` directory.
|
|
2043
|
+
* Pass a single command string, or an array to run them in sequence.
|
|
2044
|
+
* Commands run relative to the `root` directory.
|
|
2057
2045
|
*
|
|
2058
2046
|
* @example
|
|
2059
2047
|
* ```ts
|
|
@@ -2525,7 +2513,7 @@ type CLIOptions = {
|
|
|
2525
2513
|
};
|
|
2526
2514
|
/**
|
|
2527
2515
|
* All accepted forms of a Kubb configuration.
|
|
2528
|
-
* Accepts `Config`/`Config[]`/promise or a factory (optionally receiving `TCliOptions
|
|
2516
|
+
* Accepts `Config`/`Config[]`/promise or a factory (optionally receiving `TCliOptions`).
|
|
2529
2517
|
*/
|
|
2530
2518
|
type PossibleConfig<TCliOptions = undefined> = PossiblePromise<Config | Array<Config>> | ((...args: [TCliOptions] extends [undefined] ? [] : [TCliOptions]) => PossiblePromise<Config | Array<Config>>);
|
|
2531
2519
|
/**
|
|
@@ -2568,9 +2556,8 @@ type BuildOutput = {
|
|
|
2568
2556
|
type DiagnosticSeverity = 'error' | 'warning' | 'info';
|
|
2569
2557
|
/**
|
|
2570
2558
|
* A human-readable explanation of a diagnostic code: a short title, what triggers it, and how
|
|
2571
|
-
* to resolve it. This is the
|
|
2572
|
-
*
|
|
2573
|
-
* {@link DiagnosticCode}, so adding a code without documenting it fails the build.
|
|
2559
|
+
* to resolve it. This is the source of truth the kubb.dev `/diagnostics/<slug>` pages mirror, so
|
|
2560
|
+
* every code stays documented in one place. Adding a code without documenting it fails the build.
|
|
2574
2561
|
*/
|
|
2575
2562
|
type DiagnosticDoc = {
|
|
2576
2563
|
/**
|
|
@@ -2625,9 +2612,7 @@ type DiagnosticKind = 'problem' | 'performance' | 'update';
|
|
|
2625
2612
|
type ProblemCode = Exclude<DiagnosticCode, typeof diagnosticCode.performance | typeof diagnosticCode.updateAvailable>;
|
|
2626
2613
|
/**
|
|
2627
2614
|
* A build problem collected during a run, gathered into the result instead of
|
|
2628
|
-
* aborting on the first failure.
|
|
2629
|
-
* `severity`, a `message`, and optionally a `location` into the source document,
|
|
2630
|
-
* a `help`, the `plugin` that produced it, and the `cause` it wraps.
|
|
2615
|
+
* aborting on the first failure.
|
|
2631
2616
|
*/
|
|
2632
2617
|
type ProblemDiagnostic = {
|
|
2633
2618
|
/**
|
|
@@ -2655,9 +2640,9 @@ type ProblemDiagnostic = {
|
|
|
2655
2640
|
cause?: Error;
|
|
2656
2641
|
};
|
|
2657
2642
|
/**
|
|
2658
|
-
* A per-plugin performance record, built with {@link Diagnostics.performance}.
|
|
2659
|
-
*
|
|
2660
|
-
*
|
|
2643
|
+
* A per-plugin performance record, built with {@link Diagnostics.performance}. The `performance`
|
|
2644
|
+
* kind keeps it out of the problem list. It feeds the per-plugin timing bars, and reporters sum
|
|
2645
|
+
* these into the run total.
|
|
2661
2646
|
*/
|
|
2662
2647
|
type PerformanceDiagnostic = {
|
|
2663
2648
|
kind: 'performance';
|
|
@@ -2675,7 +2660,7 @@ type PerformanceDiagnostic = {
|
|
|
2675
2660
|
};
|
|
2676
2661
|
/**
|
|
2677
2662
|
* A notice that a newer Kubb version is available on npm, built with {@link Diagnostics.update}.
|
|
2678
|
-
* It
|
|
2663
|
+
* It renders like any info diagnostic.
|
|
2679
2664
|
*/
|
|
2680
2665
|
type UpdateDiagnostic = {
|
|
2681
2666
|
kind: 'update';
|
|
@@ -2918,4 +2903,4 @@ declare class Diagnostics {
|
|
|
2918
2903
|
}
|
|
2919
2904
|
//#endregion
|
|
2920
2905
|
export { KubbPluginSetupContext as $, KubbHookStartContext as A, Adapter as At, ParsedFile as B, KubbFilesProcessingEndContext as C, GenerationResult as Ct, KubbGenerationStartContext as D, UserReporter as Dt, KubbGenerationEndContext as E, ReporterName as Et, KubbSuccessContext as F, Generator$1 as G, createKubb as H, KubbWarnContext as I, KubbDriver as J, GeneratorContext as K, PossibleConfig as L, KubbInfoContext as M, AdapterSource as Mt, KubbLifecycleStartContext as N, createAdapter as Nt, KubbHookEndContext as O, createReporter as Ot, KubbPluginsEndContext as P, AsyncEventEmitter as Pt, KubbPluginEndContext as Q, UserConfig as R, KubbFileProcessingUpdate as S, createStorage as St, KubbFilesProcessingUpdateContext as T, ReporterContext as Tt, Parser as U, Kubb$1 as V, defineParser as W, Group as X, Exclude$1 as Y, Include as Z, InputPath as _, defineResolver as _t, DiagnosticLocation as a, Override as at, KubbDiagnosticContext as b, createRenderer as bt, PerformanceDiagnostic as c, definePlugin as ct, SerializedDiagnostic as d, ResolveBannerFile as dt, KubbPluginStartContext as et, UpdateDiagnostic as f, ResolveOptionsContext as ft, InputData as g, ResolverPathParams as gt, Config as h, ResolverFileParams as ht, DiagnosticKind as i, OutputOptions as it, KubbHooks as j, AdapterFactoryOptions as jt, KubbHookLineContext as k, logLevel as kt, ProblemCode as l, BannerMeta as lt, CLIOptions as m, ResolverContext as mt, DiagnosticByCode as n, Output as nt, DiagnosticSeverity as o, Plugin as ot, BuildOutput as p, Resolver as pt, defineGenerator as q, DiagnosticDoc as r, OutputMode as rt, Diagnostics as s, PluginFactoryOptions as st, Diagnostic as t, NormalizedPlugin as tt, ProblemDiagnostic as u, ResolveBannerContext as ut, KubbBuildEndContext as v, Renderer as vt, KubbFilesProcessingStartContext as w, Reporter as wt, KubbErrorContext as x, Storage as xt, KubbBuildStartContext as y, RendererFactory as yt, FileProcessorHooks as z };
|
|
2921
|
-
//# sourceMappingURL=diagnostics-
|
|
2906
|
+
//# sourceMappingURL=diagnostics-B-UZnFqP.d.ts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_memoryStorage = require("./memoryStorage-
|
|
2
|
+
const require_memoryStorage = require("./memoryStorage-CUj1hrxa.cjs");
|
|
3
3
|
let node_crypto = require("node:crypto");
|
|
4
4
|
let node_util = require("node:util");
|
|
5
5
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -576,9 +576,8 @@ var Url = class Url {
|
|
|
576
576
|
//#region src/createAdapter.ts
|
|
577
577
|
/**
|
|
578
578
|
* Defines a custom adapter that translates a spec format into Kubb's universal
|
|
579
|
-
* AST
|
|
580
|
-
*
|
|
581
|
-
* OpenAPI/Swagger documents.
|
|
579
|
+
* AST, for example GraphQL, gRPC, or AsyncAPI. The built-in `@kubb/adapter-oas`
|
|
580
|
+
* handles OpenAPI/Swagger documents.
|
|
582
581
|
*
|
|
583
582
|
* Adapters must return an `InputNode` from `parse`. That node is what every
|
|
584
583
|
* plugin in the build consumes.
|
|
@@ -610,9 +609,9 @@ function createAdapter(build) {
|
|
|
610
609
|
//#endregion
|
|
611
610
|
//#region src/diagnostics.ts
|
|
612
611
|
/**
|
|
613
|
-
* Docs major, derived from the package version so the link tracks the published major.
|
|
612
|
+
* Docs major version, derived from the package version so the link tracks the published major.
|
|
614
613
|
*/
|
|
615
|
-
const docsMajor = "5.0.0-beta.
|
|
614
|
+
const docsMajor = "5.0.0-beta.59".split(".")[0] ?? "5";
|
|
616
615
|
/**
|
|
617
616
|
* Narrows a {@link Diagnostic} to the variant for `code`, or `null` when it does not match.
|
|
618
617
|
*
|
|
@@ -1059,8 +1058,7 @@ function normalizeOutput({ output, group, pluginName }) {
|
|
|
1059
1058
|
}
|
|
1060
1059
|
/**
|
|
1061
1060
|
* Wraps a plugin factory and returns a function that accepts user options and
|
|
1062
|
-
* yields a
|
|
1063
|
-
* `hooks` object (inspired by Astro integrations).
|
|
1061
|
+
* yields a typed `Plugin`. Lifecycle handlers go inside a single `hooks` object.
|
|
1064
1062
|
*
|
|
1065
1063
|
* Pass a `PluginFactoryOptions` type parameter to get a typed `ctx` inside
|
|
1066
1064
|
* `kubb:plugin:setup`. Plugin names should follow the `plugin-<feature>`
|
|
@@ -1212,8 +1210,8 @@ function defaultResolveOptions(node, { options, exclude = [], include, override
|
|
|
1212
1210
|
/**
|
|
1213
1211
|
* Default path resolver used by `defineResolver`.
|
|
1214
1212
|
*
|
|
1215
|
-
* - `mode: 'file'`
|
|
1216
|
-
* - `mode: 'directory'` (default)
|
|
1213
|
+
* - `mode: 'file'` resolves directly to `output.path` (the full file path, extension included).
|
|
1214
|
+
* - `mode: 'directory'` (default) resolves to `output.path/{baseName}`, or into a
|
|
1217
1215
|
* subdirectory when `group` and a `tag`/`path` value are provided.
|
|
1218
1216
|
*
|
|
1219
1217
|
* A custom `group.name` function overrides the default subdirectory naming.
|
|
@@ -1450,8 +1448,8 @@ function defaultResolveFooter(meta, { output, file }) {
|
|
|
1450
1448
|
* - `resolveFile` builds the full `FileNode`.
|
|
1451
1449
|
* - `resolveBanner` and `resolveFooter` produce the top and bottom of file text.
|
|
1452
1450
|
*
|
|
1453
|
-
* Methods in the returned object can call sibling resolver methods via `this
|
|
1454
|
-
*
|
|
1451
|
+
* Methods in the returned object can call sibling resolver methods via `this`.
|
|
1452
|
+
* A custom rule can delegate to a default, for example `this.default(name, 'type')`.
|
|
1455
1453
|
*
|
|
1456
1454
|
* @example Basic resolver with naming helpers
|
|
1457
1455
|
* ```ts
|
|
@@ -1563,7 +1561,8 @@ var KubbDriver = class {
|
|
|
1563
1561
|
config;
|
|
1564
1562
|
options;
|
|
1565
1563
|
/**
|
|
1566
|
-
* The streaming `InputNode<true>` produced by the adapter.
|
|
1564
|
+
* The streaming `InputNode<true>` produced by the adapter. Set after adapter setup.
|
|
1565
|
+
* Parse-only adapters are wrapped automatically.
|
|
1567
1566
|
*/
|
|
1568
1567
|
inputNode = null;
|
|
1569
1568
|
adapter = null;
|
|
@@ -1940,7 +1939,7 @@ var KubbDriver = class {
|
|
|
1940
1939
|
*
|
|
1941
1940
|
* Plugins run sequentially so `kubb:plugin:end` fires as each plugin completes, instead
|
|
1942
1941
|
* of all at once after every plugin has marched through the parallel batches together.
|
|
1943
|
-
* That ordering is what drives the CLI's `Plugins N/M` counter
|
|
1942
|
+
* That ordering is what drives the CLI's `Plugins N/M` counter. Without it the bar would
|
|
1944
1943
|
* sit at the initial value until the very end of the run.
|
|
1945
1944
|
*
|
|
1946
1945
|
* When `entries` is empty or `this.inputNode` is `null`, every entry still gets a
|
|
@@ -2680,7 +2679,7 @@ function renderSummary(lines, { title, status }) {
|
|
|
2680
2679
|
}
|
|
2681
2680
|
/**
|
|
2682
2681
|
* The default `cli` reporter. Renders the {@link Report} for each config as it finishes, independent
|
|
2683
|
-
* of the live logger view. Suppressed at `silent
|
|
2682
|
+
* of the live logger view. Suppressed at `silent`. The `verbose` level adds the per-plugin timings.
|
|
2684
2683
|
*/
|
|
2685
2684
|
const cliReporter = createReporter({
|
|
2686
2685
|
name: "cli",
|
|
@@ -2802,10 +2801,9 @@ const jsonReporter = createReporter({
|
|
|
2802
2801
|
* (JSX, a template string, a tree of any shape) into `FileNode`s that get
|
|
2803
2802
|
* written to disk.
|
|
2804
2803
|
*
|
|
2805
|
-
*
|
|
2806
|
-
* renderer
|
|
2807
|
-
*
|
|
2808
|
-
* field on `defineGenerator`.
|
|
2804
|
+
* A renderer can target output formats beyond JSX, for instance a Handlebars
|
|
2805
|
+
* renderer or one that writes binary files. Plugins and generators pick the
|
|
2806
|
+
* renderer to use via the `renderer` field on `defineGenerator`.
|
|
2809
2807
|
*
|
|
2810
2808
|
* @example A minimal renderer that wraps a custom runtime
|
|
2811
2809
|
* ```ts
|