@kubb/core 5.18.5 → 5.18.7
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/index.cjs +104 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -20
- package/dist/index.d.ts +48 -20
- package/dist/index.js +116 -46
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -2,13 +2,9 @@ import { Enforce, FileNode, HttpMethod, ImportNode, InlineLanguage, InputMeta, I
|
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
import net from "node:net";
|
|
4
4
|
type Options$1 = {
|
|
5
|
-
/**
|
|
6
|
-
* Text prepended before casing is applied.
|
|
7
|
-
*/
|
|
5
|
+
/** Text prepended before casing is applied. */
|
|
8
6
|
prefix?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Text appended before casing is applied.
|
|
11
|
-
*/
|
|
7
|
+
/** Text appended before casing is applied. */
|
|
12
8
|
suffix?: string;
|
|
13
9
|
};
|
|
14
10
|
/**
|
|
@@ -169,7 +165,7 @@ declare const diagnosticCatalog: {
|
|
|
169
165
|
readonly code: 'KUBB_INVALID_DOCUMENT';
|
|
170
166
|
readonly title: 'Invalid document';
|
|
171
167
|
readonly cause: 'The `input` cannot be read as an OpenAPI or Swagger document: its JSON or YAML has a syntax error, it declares no `openapi` or `swagger` version field, or its version cannot be upgraded to OpenAPI 3.1.';
|
|
172
|
-
readonly fix: 'Fix the syntax at the reported line, and check that `input` points at the spec and not an HTML page. Point `input` at a Swagger 2.0
|
|
168
|
+
readonly fix: 'Fix the syntax at the reported line, and check that `input` points at the spec and not an HTML page. Point `input` at a Swagger 2.0 or OpenAPI 3.0, 3.1, or 3.2 document, and check that a passed object is the spec itself rather than a wrapper around it.';
|
|
173
169
|
};
|
|
174
170
|
readonly invalidSpec: {
|
|
175
171
|
readonly code: 'KUBB_INVALID_SPEC';
|
|
@@ -294,8 +290,8 @@ declare const diagnosticCatalog: {
|
|
|
294
290
|
readonly invalidPluginOptions: {
|
|
295
291
|
readonly code: 'KUBB_INVALID_PLUGIN_OPTIONS';
|
|
296
292
|
readonly title: 'Invalid plugin options';
|
|
297
|
-
readonly cause: "A plugin was configured with options that cannot be honored, for example `output.mode: 'file'` paired with a `group` option.";
|
|
298
|
-
readonly fix: "Fix the plugin options. A single-file output has nothing to group, so remove the `group` option or
|
|
293
|
+
readonly cause: "A plugin was configured with options that cannot be honored, for example a single-file output (`output.mode: 'file'`, or an `output.path` with a file extension) paired with a `group` option.";
|
|
294
|
+
readonly fix: "Fix the plugin options. A single-file output has nothing to group, so remove the `group` option, give `output.path` a directory name, or set `output.mode: 'directory'`.";
|
|
299
295
|
};
|
|
300
296
|
readonly postGenerateFailed: {
|
|
301
297
|
readonly code: 'KUBB_POST_GENERATE_FAILED';
|
|
@@ -1721,6 +1717,10 @@ export type BuildOutput = {
|
|
|
1721
1717
|
* The plugin driver that orchestrated this build.
|
|
1722
1718
|
*/
|
|
1723
1719
|
driver: KubbDriver;
|
|
1720
|
+
/**
|
|
1721
|
+
* The parsed spec the build generated from, `null` when there was none to parse.
|
|
1722
|
+
*/
|
|
1723
|
+
input: InputNode | null;
|
|
1724
1724
|
/**
|
|
1725
1725
|
* The configured `Storage` backend, for reading back a generated file's final content.
|
|
1726
1726
|
* Use `files` to list what this build produced.
|
|
@@ -2227,7 +2227,7 @@ type Generator<TOptions extends PluginType = PluginType, TElement = unknown> = {
|
|
|
2227
2227
|
* @example Only match GET operations
|
|
2228
2228
|
* ```ts
|
|
2229
2229
|
* match(node, ctx) {
|
|
2230
|
-
* return ast.
|
|
2230
|
+
* return ast.http.isOperation(node) && node.method.toLowerCase() === 'get'
|
|
2231
2231
|
* }
|
|
2232
2232
|
* ```
|
|
2233
2233
|
*/
|
|
@@ -2326,7 +2326,7 @@ type ResolverPathParams = Omit<ResolverFileParams, 'name' | 'extname'> & {
|
|
|
2326
2326
|
*/
|
|
2327
2327
|
type ResolvePathOptions = ResolverPathParams & {
|
|
2328
2328
|
/**
|
|
2329
|
-
* Absolute
|
|
2329
|
+
* Absolute directory the plugin's `output.path` is resolved against. Generators pass `ctx.root`, the config's output directory.
|
|
2330
2330
|
*/
|
|
2331
2331
|
root: string;
|
|
2332
2332
|
/**
|
|
@@ -2621,12 +2621,12 @@ export declare class Resolver {
|
|
|
2621
2621
|
file(options: ResolveFileOptions): FileNode;
|
|
2622
2622
|
/**
|
|
2623
2623
|
* Builds one `ImportNode` per unique schema referenced in the tree, in first-occurrence
|
|
2624
|
-
* order. Each ref's target resolves through `
|
|
2624
|
+
* order. Each ref's target resolves through `ast.ref.getName`, so collision- or macro-renamed
|
|
2625
2625
|
* schemas (`targetName`) import the emitted name. Names and paths go through the top-level
|
|
2626
2626
|
* `name` and `file`, so import entries follow the plugin's conventions, and a per-call
|
|
2627
2627
|
* `name` override wins over both.
|
|
2628
2628
|
*
|
|
2629
|
-
* The subtree scan runs through `
|
|
2629
|
+
* The subtree scan runs through `ast.graph.getImportedNames`, which memoizes by node identity, so a
|
|
2630
2630
|
* schema shared across the ts, zod, and faker plugins is walked once and every plugin's resolver
|
|
2631
2631
|
* reads the same ref set instead of re-scanning it per plugin.
|
|
2632
2632
|
*/
|
|
@@ -2646,6 +2646,18 @@ export declare class Resolver {
|
|
|
2646
2646
|
* ```
|
|
2647
2647
|
*/
|
|
2648
2648
|
static merge<T extends Resolver>(base: T, ...overrides: Array<ResolverPatch<T> | Resolver>): T;
|
|
2649
|
+
/**
|
|
2650
|
+
* The folder a group puts a file in, relative to the output directory. A custom `group.name` wins; otherwise `tag`
|
|
2651
|
+
* groups use the camelCased tag, nested in the folders of its `parent` tags, and `path` groups use the first
|
|
2652
|
+
* non-traversal segment (`''` when none remain, placing the file in the output root, kept safe by the caller's
|
|
2653
|
+
* boundary check).
|
|
2654
|
+
*
|
|
2655
|
+
* @example
|
|
2656
|
+
* ```ts
|
|
2657
|
+
* resolver.groupDir({ type: 'tag' }, 'pet store') // 'petStore'
|
|
2658
|
+
* ```
|
|
2659
|
+
*/
|
|
2660
|
+
groupDir(group: Group, groupValue: string): string;
|
|
2649
2661
|
}
|
|
2650
2662
|
/** Reads key `K` from a registry interface, or `{}` when no package has augmented it. @internal */
|
|
2651
2663
|
type ExtractRegistryKey<T, K extends PropertyKey> = K extends keyof T ? T[K] : {};
|
|
@@ -2795,7 +2807,8 @@ type ByMethod = {
|
|
|
2795
2807
|
type: 'method';
|
|
2796
2808
|
/**
|
|
2797
2809
|
* HTTP method to match, as one of the `HttpMethod` values (`'GET'`, `'POST'`, `'PUT'`,
|
|
2798
|
-
* `'PATCH'`, `'DELETE'`, `'HEAD'`, `'OPTIONS'`, `'TRACE'`, `'QUERY'`) or a regex.
|
|
2810
|
+
* `'PATCH'`, `'DELETE'`, `'HEAD'`, `'OPTIONS'`, `'TRACE'`, `'QUERY'`) or a regex. Matching ignores
|
|
2811
|
+
* case, so `'get'` and `/get/` work too.
|
|
2799
2812
|
*/
|
|
2800
2813
|
pattern: HttpMethod | RegExp;
|
|
2801
2814
|
};
|
|
@@ -3232,7 +3245,7 @@ type Adapter<TOptions extends AdapterFactoryOptions = AdapterFactoryOptions> = {
|
|
|
3232
3245
|
* Parse the source into a universal `InputNode`.
|
|
3233
3246
|
*
|
|
3234
3247
|
* An adapter that renames schemas (e.g. collision handling) must stamp `targetName` on
|
|
3235
|
-
* every ref node pointing at a renamed schema, so `
|
|
3248
|
+
* every ref node pointing at a renamed schema, so `ast.ref.getName` and `resolver.imports`
|
|
3236
3249
|
* resolve a `$ref` to the file that is actually generated. Refs that keep their pointer's
|
|
3237
3250
|
* last segment need no stamp.
|
|
3238
3251
|
*/
|
|
@@ -3264,7 +3277,7 @@ type Adapter<TOptions extends AdapterFactoryOptions = AdapterFactoryOptions> = {
|
|
|
3264
3277
|
type AdapterDefinition<T extends AdapterFactoryOptions = AdapterFactoryOptions> = {
|
|
3265
3278
|
meta: ExtensionMeta<T['name']>;
|
|
3266
3279
|
/**
|
|
3267
|
-
* Takes the user's options and returns the resolved options, which `build` receives
|
|
3280
|
+
* Takes the user's options and returns the resolved options, which `build` receives. The adapter exposes the user's options as `options`.
|
|
3268
3281
|
* Without `setup`, the user's options are the resolved options.
|
|
3269
3282
|
*/
|
|
3270
3283
|
setup?(options: T['options']): T['resolvedOptions'];
|
|
@@ -3384,8 +3397,15 @@ type CreateKubbOptions = {
|
|
|
3384
3397
|
*/
|
|
3385
3398
|
signal?: AbortSignal;
|
|
3386
3399
|
};
|
|
3400
|
+
type ConfigGenerateResult = GenerateResult & {
|
|
3401
|
+
kubb: Kubb$1;
|
|
3402
|
+
/**
|
|
3403
|
+
* What the build threw outside its own diagnostics. `diagnostics` holds it too.
|
|
3404
|
+
*/
|
|
3405
|
+
error?: unknown;
|
|
3406
|
+
};
|
|
3387
3407
|
/**
|
|
3388
|
-
* Host hooks for a single {@link Kubb
|
|
3408
|
+
* Host hooks for a single {@link Kubb#generate} call. All optional. Progress narration rides the
|
|
3389
3409
|
* `kubb:*` lifecycle hooks on `.hooks`, so hosts subscribe there rather than pass a callback.
|
|
3390
3410
|
*/
|
|
3391
3411
|
type GenerateOptions = {
|
|
@@ -3397,7 +3417,7 @@ type GenerateOptions = {
|
|
|
3397
3417
|
processOutput?: (context: RunOutputPassesOptions) => Promise<Array<Diagnostic>>;
|
|
3398
3418
|
};
|
|
3399
3419
|
/**
|
|
3400
|
-
* What a {@link Kubb
|
|
3420
|
+
* What a {@link Kubb#generate} call produced, for the host to map onto its own result shape.
|
|
3401
3421
|
*/
|
|
3402
3422
|
type GenerateResult = {
|
|
3403
3423
|
/**
|
|
@@ -3412,6 +3432,10 @@ type GenerateResult = {
|
|
|
3412
3432
|
* Build diagnostics plus any collected from the output passes.
|
|
3413
3433
|
*/
|
|
3414
3434
|
diagnostics: Array<Diagnostic>;
|
|
3435
|
+
/**
|
|
3436
|
+
* The parsed spec the build generated from, `null` when the build failed before parsing.
|
|
3437
|
+
*/
|
|
3438
|
+
input: InputNode | null;
|
|
3415
3439
|
};
|
|
3416
3440
|
/**
|
|
3417
3441
|
* Kubb code-generation instance bound to a single config entry. Resolves the user
|
|
@@ -3435,6 +3459,11 @@ declare class Kubb$1 {
|
|
|
3435
3459
|
readonly hooks: Hookable<KubbHooks>;
|
|
3436
3460
|
readonly config: Config;
|
|
3437
3461
|
constructor(userConfig: UserConfig, options?: CreateKubbOptions);
|
|
3462
|
+
/**
|
|
3463
|
+
* Generates every config of a `defineConfig([...])` array in order and yields each result as its config finishes, so
|
|
3464
|
+
* memory holds one config at a time. A config that fails does not stop the others. Only an aborted `signal` rejects.
|
|
3465
|
+
*/
|
|
3466
|
+
static generate(configs: Array<UserConfig>, { hooks, signal }?: Pick<CreateKubbOptions, 'hooks' | 'signal'>): AsyncGenerator<ConfigGenerateResult, void, void>;
|
|
3438
3467
|
get storage(): Storage;
|
|
3439
3468
|
get driver(): KubbDriver;
|
|
3440
3469
|
/**
|
|
@@ -3908,5 +3937,4 @@ export declare function readInstalledPackages({ root, packages, resolveFrom }: {
|
|
|
3908
3937
|
packages?: Iterable<string>;
|
|
3909
3938
|
resolveFrom?: Array<string>;
|
|
3910
3939
|
}): Promise<Array<InstalledPackage>>;
|
|
3911
|
-
export type
|
|
3912
|
-
//# sourceMappingURL=index.d.cts.map
|
|
3940
|
+
export { type Adapter, type AdapterDefinition, type AdapterFactory, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, type ConfigGenerateResult, type CreateKubbOptions, type Diagnostic, type DiagnosticDoc, type DiagnosticFormatOptions, type DiagnosticKind, type DiagnosticLocation, type DiagnosticSeverity, type Exclude$1 as Exclude, type ExtensionDependencies, type ExtensionDependency, type ExtensionDependencyRecord, type ExtensionFactory, type ExtensionKind, type ExtensionManifest, type ExtensionManifestOption, type ExtensionMeta, type Filter, type GenerateOptions, type GenerateResult, type GenerationResult, type Generator, type GeneratorContext, type Group, type HookResult, type Include, type InputKind, type InstalledPackage, type JSONValue, Kubb$1 as Kubb, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, type Memo, type NormalizedPlugin, type Output, type OutputManifest, type OutputMode, type OutputOptions, type Override, type Parser, type ParserDefinition, type ParserFactory, type PerformanceDiagnostic, type Plugin, type PluginDefinition, type PluginFactory, type PluginName, type PluginType, type ProblemCode, type ProblemDiagnostic, type RegistryArtifact, type RegistryDetail, type RegistryEntry, type RegistryGuide, type RegistryIndex, type Renderer, type RendererFactory, type Reporter, type ReporterContext, type ReporterName, type ReporterPluginFiles, type ResolveBannerContext, type ResolveBannerFile, type ResolveFileOptions, type ResolveImportsOptions, type ResolveNameOptions, type ResolveOptionsContext, type ResolvePathOptions, type ResolvePluginOptions, type ResolverDefault, type ResolverFile, type ResolverFileParams, type ResolverFilePathParams, type ResolverPatch, type ResolverPathParams, type RunHookOptions, type RunOutputPassesOptions, type SerializedDiagnostic, type Storage, type SummaryRenderer, type UpdateDiagnostic, type UserReporter };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,9 @@ import { Enforce, FileNode, HttpMethod, ImportNode, InlineLanguage, InputMeta, I
|
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
import net from "node:net";
|
|
4
4
|
type Options$1 = {
|
|
5
|
-
/**
|
|
6
|
-
* Text prepended before casing is applied.
|
|
7
|
-
*/
|
|
5
|
+
/** Text prepended before casing is applied. */
|
|
8
6
|
prefix?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Text appended before casing is applied.
|
|
11
|
-
*/
|
|
7
|
+
/** Text appended before casing is applied. */
|
|
12
8
|
suffix?: string;
|
|
13
9
|
};
|
|
14
10
|
/**
|
|
@@ -169,7 +165,7 @@ declare const diagnosticCatalog: {
|
|
|
169
165
|
readonly code: 'KUBB_INVALID_DOCUMENT';
|
|
170
166
|
readonly title: 'Invalid document';
|
|
171
167
|
readonly cause: 'The `input` cannot be read as an OpenAPI or Swagger document: its JSON or YAML has a syntax error, it declares no `openapi` or `swagger` version field, or its version cannot be upgraded to OpenAPI 3.1.';
|
|
172
|
-
readonly fix: 'Fix the syntax at the reported line, and check that `input` points at the spec and not an HTML page. Point `input` at a Swagger 2.0
|
|
168
|
+
readonly fix: 'Fix the syntax at the reported line, and check that `input` points at the spec and not an HTML page. Point `input` at a Swagger 2.0 or OpenAPI 3.0, 3.1, or 3.2 document, and check that a passed object is the spec itself rather than a wrapper around it.';
|
|
173
169
|
};
|
|
174
170
|
readonly invalidSpec: {
|
|
175
171
|
readonly code: 'KUBB_INVALID_SPEC';
|
|
@@ -294,8 +290,8 @@ declare const diagnosticCatalog: {
|
|
|
294
290
|
readonly invalidPluginOptions: {
|
|
295
291
|
readonly code: 'KUBB_INVALID_PLUGIN_OPTIONS';
|
|
296
292
|
readonly title: 'Invalid plugin options';
|
|
297
|
-
readonly cause: "A plugin was configured with options that cannot be honored, for example `output.mode: 'file'` paired with a `group` option.";
|
|
298
|
-
readonly fix: "Fix the plugin options. A single-file output has nothing to group, so remove the `group` option or
|
|
293
|
+
readonly cause: "A plugin was configured with options that cannot be honored, for example a single-file output (`output.mode: 'file'`, or an `output.path` with a file extension) paired with a `group` option.";
|
|
294
|
+
readonly fix: "Fix the plugin options. A single-file output has nothing to group, so remove the `group` option, give `output.path` a directory name, or set `output.mode: 'directory'`.";
|
|
299
295
|
};
|
|
300
296
|
readonly postGenerateFailed: {
|
|
301
297
|
readonly code: 'KUBB_POST_GENERATE_FAILED';
|
|
@@ -1721,6 +1717,10 @@ export type BuildOutput = {
|
|
|
1721
1717
|
* The plugin driver that orchestrated this build.
|
|
1722
1718
|
*/
|
|
1723
1719
|
driver: KubbDriver;
|
|
1720
|
+
/**
|
|
1721
|
+
* The parsed spec the build generated from, `null` when there was none to parse.
|
|
1722
|
+
*/
|
|
1723
|
+
input: InputNode | null;
|
|
1724
1724
|
/**
|
|
1725
1725
|
* The configured `Storage` backend, for reading back a generated file's final content.
|
|
1726
1726
|
* Use `files` to list what this build produced.
|
|
@@ -2227,7 +2227,7 @@ type Generator<TOptions extends PluginType = PluginType, TElement = unknown> = {
|
|
|
2227
2227
|
* @example Only match GET operations
|
|
2228
2228
|
* ```ts
|
|
2229
2229
|
* match(node, ctx) {
|
|
2230
|
-
* return ast.
|
|
2230
|
+
* return ast.http.isOperation(node) && node.method.toLowerCase() === 'get'
|
|
2231
2231
|
* }
|
|
2232
2232
|
* ```
|
|
2233
2233
|
*/
|
|
@@ -2326,7 +2326,7 @@ type ResolverPathParams = Omit<ResolverFileParams, 'name' | 'extname'> & {
|
|
|
2326
2326
|
*/
|
|
2327
2327
|
type ResolvePathOptions = ResolverPathParams & {
|
|
2328
2328
|
/**
|
|
2329
|
-
* Absolute
|
|
2329
|
+
* Absolute directory the plugin's `output.path` is resolved against. Generators pass `ctx.root`, the config's output directory.
|
|
2330
2330
|
*/
|
|
2331
2331
|
root: string;
|
|
2332
2332
|
/**
|
|
@@ -2621,12 +2621,12 @@ export declare class Resolver {
|
|
|
2621
2621
|
file(options: ResolveFileOptions): FileNode;
|
|
2622
2622
|
/**
|
|
2623
2623
|
* Builds one `ImportNode` per unique schema referenced in the tree, in first-occurrence
|
|
2624
|
-
* order. Each ref's target resolves through `
|
|
2624
|
+
* order. Each ref's target resolves through `ast.ref.getName`, so collision- or macro-renamed
|
|
2625
2625
|
* schemas (`targetName`) import the emitted name. Names and paths go through the top-level
|
|
2626
2626
|
* `name` and `file`, so import entries follow the plugin's conventions, and a per-call
|
|
2627
2627
|
* `name` override wins over both.
|
|
2628
2628
|
*
|
|
2629
|
-
* The subtree scan runs through `
|
|
2629
|
+
* The subtree scan runs through `ast.graph.getImportedNames`, which memoizes by node identity, so a
|
|
2630
2630
|
* schema shared across the ts, zod, and faker plugins is walked once and every plugin's resolver
|
|
2631
2631
|
* reads the same ref set instead of re-scanning it per plugin.
|
|
2632
2632
|
*/
|
|
@@ -2646,6 +2646,18 @@ export declare class Resolver {
|
|
|
2646
2646
|
* ```
|
|
2647
2647
|
*/
|
|
2648
2648
|
static merge<T extends Resolver>(base: T, ...overrides: Array<ResolverPatch<T> | Resolver>): T;
|
|
2649
|
+
/**
|
|
2650
|
+
* The folder a group puts a file in, relative to the output directory. A custom `group.name` wins; otherwise `tag`
|
|
2651
|
+
* groups use the camelCased tag, nested in the folders of its `parent` tags, and `path` groups use the first
|
|
2652
|
+
* non-traversal segment (`''` when none remain, placing the file in the output root, kept safe by the caller's
|
|
2653
|
+
* boundary check).
|
|
2654
|
+
*
|
|
2655
|
+
* @example
|
|
2656
|
+
* ```ts
|
|
2657
|
+
* resolver.groupDir({ type: 'tag' }, 'pet store') // 'petStore'
|
|
2658
|
+
* ```
|
|
2659
|
+
*/
|
|
2660
|
+
groupDir(group: Group, groupValue: string): string;
|
|
2649
2661
|
}
|
|
2650
2662
|
/** Reads key `K` from a registry interface, or `{}` when no package has augmented it. @internal */
|
|
2651
2663
|
type ExtractRegistryKey<T, K extends PropertyKey> = K extends keyof T ? T[K] : {};
|
|
@@ -2795,7 +2807,8 @@ type ByMethod = {
|
|
|
2795
2807
|
type: 'method';
|
|
2796
2808
|
/**
|
|
2797
2809
|
* HTTP method to match, as one of the `HttpMethod` values (`'GET'`, `'POST'`, `'PUT'`,
|
|
2798
|
-
* `'PATCH'`, `'DELETE'`, `'HEAD'`, `'OPTIONS'`, `'TRACE'`, `'QUERY'`) or a regex.
|
|
2810
|
+
* `'PATCH'`, `'DELETE'`, `'HEAD'`, `'OPTIONS'`, `'TRACE'`, `'QUERY'`) or a regex. Matching ignores
|
|
2811
|
+
* case, so `'get'` and `/get/` work too.
|
|
2799
2812
|
*/
|
|
2800
2813
|
pattern: HttpMethod | RegExp;
|
|
2801
2814
|
};
|
|
@@ -3232,7 +3245,7 @@ type Adapter<TOptions extends AdapterFactoryOptions = AdapterFactoryOptions> = {
|
|
|
3232
3245
|
* Parse the source into a universal `InputNode`.
|
|
3233
3246
|
*
|
|
3234
3247
|
* An adapter that renames schemas (e.g. collision handling) must stamp `targetName` on
|
|
3235
|
-
* every ref node pointing at a renamed schema, so `
|
|
3248
|
+
* every ref node pointing at a renamed schema, so `ast.ref.getName` and `resolver.imports`
|
|
3236
3249
|
* resolve a `$ref` to the file that is actually generated. Refs that keep their pointer's
|
|
3237
3250
|
* last segment need no stamp.
|
|
3238
3251
|
*/
|
|
@@ -3264,7 +3277,7 @@ type Adapter<TOptions extends AdapterFactoryOptions = AdapterFactoryOptions> = {
|
|
|
3264
3277
|
type AdapterDefinition<T extends AdapterFactoryOptions = AdapterFactoryOptions> = {
|
|
3265
3278
|
meta: ExtensionMeta<T['name']>;
|
|
3266
3279
|
/**
|
|
3267
|
-
* Takes the user's options and returns the resolved options, which `build` receives
|
|
3280
|
+
* Takes the user's options and returns the resolved options, which `build` receives. The adapter exposes the user's options as `options`.
|
|
3268
3281
|
* Without `setup`, the user's options are the resolved options.
|
|
3269
3282
|
*/
|
|
3270
3283
|
setup?(options: T['options']): T['resolvedOptions'];
|
|
@@ -3384,8 +3397,15 @@ type CreateKubbOptions = {
|
|
|
3384
3397
|
*/
|
|
3385
3398
|
signal?: AbortSignal;
|
|
3386
3399
|
};
|
|
3400
|
+
type ConfigGenerateResult = GenerateResult & {
|
|
3401
|
+
kubb: Kubb$1;
|
|
3402
|
+
/**
|
|
3403
|
+
* What the build threw outside its own diagnostics. `diagnostics` holds it too.
|
|
3404
|
+
*/
|
|
3405
|
+
error?: unknown;
|
|
3406
|
+
};
|
|
3387
3407
|
/**
|
|
3388
|
-
* Host hooks for a single {@link Kubb
|
|
3408
|
+
* Host hooks for a single {@link Kubb#generate} call. All optional. Progress narration rides the
|
|
3389
3409
|
* `kubb:*` lifecycle hooks on `.hooks`, so hosts subscribe there rather than pass a callback.
|
|
3390
3410
|
*/
|
|
3391
3411
|
type GenerateOptions = {
|
|
@@ -3397,7 +3417,7 @@ type GenerateOptions = {
|
|
|
3397
3417
|
processOutput?: (context: RunOutputPassesOptions) => Promise<Array<Diagnostic>>;
|
|
3398
3418
|
};
|
|
3399
3419
|
/**
|
|
3400
|
-
* What a {@link Kubb
|
|
3420
|
+
* What a {@link Kubb#generate} call produced, for the host to map onto its own result shape.
|
|
3401
3421
|
*/
|
|
3402
3422
|
type GenerateResult = {
|
|
3403
3423
|
/**
|
|
@@ -3412,6 +3432,10 @@ type GenerateResult = {
|
|
|
3412
3432
|
* Build diagnostics plus any collected from the output passes.
|
|
3413
3433
|
*/
|
|
3414
3434
|
diagnostics: Array<Diagnostic>;
|
|
3435
|
+
/**
|
|
3436
|
+
* The parsed spec the build generated from, `null` when the build failed before parsing.
|
|
3437
|
+
*/
|
|
3438
|
+
input: InputNode | null;
|
|
3415
3439
|
};
|
|
3416
3440
|
/**
|
|
3417
3441
|
* Kubb code-generation instance bound to a single config entry. Resolves the user
|
|
@@ -3435,6 +3459,11 @@ declare class Kubb$1 {
|
|
|
3435
3459
|
readonly hooks: Hookable<KubbHooks>;
|
|
3436
3460
|
readonly config: Config;
|
|
3437
3461
|
constructor(userConfig: UserConfig, options?: CreateKubbOptions);
|
|
3462
|
+
/**
|
|
3463
|
+
* Generates every config of a `defineConfig([...])` array in order and yields each result as its config finishes, so
|
|
3464
|
+
* memory holds one config at a time. A config that fails does not stop the others. Only an aborted `signal` rejects.
|
|
3465
|
+
*/
|
|
3466
|
+
static generate(configs: Array<UserConfig>, { hooks, signal }?: Pick<CreateKubbOptions, 'hooks' | 'signal'>): AsyncGenerator<ConfigGenerateResult, void, void>;
|
|
3438
3467
|
get storage(): Storage;
|
|
3439
3468
|
get driver(): KubbDriver;
|
|
3440
3469
|
/**
|
|
@@ -3908,5 +3937,4 @@ export declare function readInstalledPackages({ root, packages, resolveFrom }: {
|
|
|
3908
3937
|
packages?: Iterable<string>;
|
|
3909
3938
|
resolveFrom?: Array<string>;
|
|
3910
3939
|
}): Promise<Array<InstalledPackage>>;
|
|
3911
|
-
export type
|
|
3912
|
-
//# sourceMappingURL=index.d.ts.map
|
|
3940
|
+
export { type Adapter, type AdapterDefinition, type AdapterFactory, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, type ConfigGenerateResult, type CreateKubbOptions, type Diagnostic, type DiagnosticDoc, type DiagnosticFormatOptions, type DiagnosticKind, type DiagnosticLocation, type DiagnosticSeverity, type Exclude$1 as Exclude, type ExtensionDependencies, type ExtensionDependency, type ExtensionDependencyRecord, type ExtensionFactory, type ExtensionKind, type ExtensionManifest, type ExtensionManifestOption, type ExtensionMeta, type Filter, type GenerateOptions, type GenerateResult, type GenerationResult, type Generator, type GeneratorContext, type Group, type HookResult, type Include, type InputKind, type InstalledPackage, type JSONValue, Kubb$1 as Kubb, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, type Memo, type NormalizedPlugin, type Output, type OutputManifest, type OutputMode, type OutputOptions, type Override, type Parser, type ParserDefinition, type ParserFactory, type PerformanceDiagnostic, type Plugin, type PluginDefinition, type PluginFactory, type PluginName, type PluginType, type ProblemCode, type ProblemDiagnostic, type RegistryArtifact, type RegistryDetail, type RegistryEntry, type RegistryGuide, type RegistryIndex, type Renderer, type RendererFactory, type Reporter, type ReporterContext, type ReporterName, type ReporterPluginFiles, type ResolveBannerContext, type ResolveBannerFile, type ResolveFileOptions, type ResolveImportsOptions, type ResolveNameOptions, type ResolveOptionsContext, type ResolvePathOptions, type ResolvePluginOptions, type ResolverDefault, type ResolverFile, type ResolverFileParams, type ResolverFilePathParams, type ResolverPatch, type ResolverPathParams, type RunHookOptions, type RunOutputPassesOptions, type SerializedDiagnostic, type Storage, type SummaryRenderer, type UpdateDiagnostic, type UserReporter };
|