@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
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-C0LytTxp.js";
|
|
2
|
-
import { $ as KubbPluginSetupContext, A as KubbHookStartContext, At as Adapter, B as ParsedFile, C as KubbFilesProcessingEndContext, Ct as GenerationResult, D as KubbGenerationStartContext, Dt as UserReporter, E as KubbGenerationEndContext, Et as ReporterName, F as KubbSuccessContext, G as Generator, H as createKubb, I as KubbWarnContext, J as KubbDriver, K as GeneratorContext, L as PossibleConfig, M as KubbInfoContext, Mt as AdapterSource, N as KubbLifecycleStartContext, Nt as createAdapter, O as KubbHookEndContext, Ot as createReporter, P as KubbPluginsEndContext, Pt as AsyncEventEmitter, Q as KubbPluginEndContext, R as UserConfig, S as KubbFileProcessingUpdate, St as createStorage, T as KubbFilesProcessingUpdateContext, Tt as ReporterContext, U as Parser, V as Kubb, W as defineParser, X as Group, Y as Exclude, Z as Include, _ as InputPath, _t as defineResolver, a as DiagnosticLocation, at as Override, b as KubbDiagnosticContext, bt as createRenderer, c as PerformanceDiagnostic, ct as definePlugin, d as SerializedDiagnostic, dt as ResolveBannerFile, et as KubbPluginStartContext, f as UpdateDiagnostic, ft as ResolveOptionsContext, g as InputData, gt as ResolverPathParams, h as Config, ht as ResolverFileParams, i as DiagnosticKind, it as OutputOptions, j as KubbHooks, jt as AdapterFactoryOptions, k as KubbHookLineContext, kt as logLevel, l as ProblemCode, lt as BannerMeta, m as CLIOptions, mt as ResolverContext, n as DiagnosticByCode, nt as Output, o as DiagnosticSeverity, ot as Plugin, p as BuildOutput, pt as Resolver, q as defineGenerator, r as DiagnosticDoc, rt as OutputMode, s as Diagnostics, st as PluginFactoryOptions, t as Diagnostic, tt as NormalizedPlugin, u as ProblemDiagnostic, ut as ResolveBannerContext, v as KubbBuildEndContext, vt as Renderer, w as KubbFilesProcessingStartContext, wt as Reporter, x as KubbErrorContext, xt as Storage, y as KubbBuildStartContext, yt as RendererFactory, z as FileProcessorHooks } from "./diagnostics-
|
|
2
|
+
import { $ as KubbPluginSetupContext, A as KubbHookStartContext, At as Adapter, B as ParsedFile, C as KubbFilesProcessingEndContext, Ct as GenerationResult, D as KubbGenerationStartContext, Dt as UserReporter, E as KubbGenerationEndContext, Et as ReporterName, F as KubbSuccessContext, G as Generator, H as createKubb, I as KubbWarnContext, J as KubbDriver, K as GeneratorContext, L as PossibleConfig, M as KubbInfoContext, Mt as AdapterSource, N as KubbLifecycleStartContext, Nt as createAdapter, O as KubbHookEndContext, Ot as createReporter, P as KubbPluginsEndContext, Pt as AsyncEventEmitter, Q as KubbPluginEndContext, R as UserConfig, S as KubbFileProcessingUpdate, St as createStorage, T as KubbFilesProcessingUpdateContext, Tt as ReporterContext, U as Parser, V as Kubb, W as defineParser, X as Group, Y as Exclude, Z as Include, _ as InputPath, _t as defineResolver, a as DiagnosticLocation, at as Override, b as KubbDiagnosticContext, bt as createRenderer, c as PerformanceDiagnostic, ct as definePlugin, d as SerializedDiagnostic, dt as ResolveBannerFile, et as KubbPluginStartContext, f as UpdateDiagnostic, ft as ResolveOptionsContext, g as InputData, gt as ResolverPathParams, h as Config, ht as ResolverFileParams, i as DiagnosticKind, it as OutputOptions, j as KubbHooks, jt as AdapterFactoryOptions, k as KubbHookLineContext, kt as logLevel, l as ProblemCode, lt as BannerMeta, m as CLIOptions, mt as ResolverContext, n as DiagnosticByCode, nt as Output, o as DiagnosticSeverity, ot as Plugin, p as BuildOutput, pt as Resolver, q as defineGenerator, r as DiagnosticDoc, rt as OutputMode, s as Diagnostics, st as PluginFactoryOptions, t as Diagnostic, tt as NormalizedPlugin, u as ProblemDiagnostic, ut as ResolveBannerContext, v as KubbBuildEndContext, vt as Renderer, w as KubbFilesProcessingStartContext, wt as Reporter, x as KubbErrorContext, xt as Storage, y as KubbBuildStartContext, yt as RendererFactory, z as FileProcessorHooks } from "./diagnostics-B-UZnFqP.js";
|
|
3
3
|
import * as ast from "@kubb/ast";
|
|
4
4
|
|
|
5
5
|
//#region ../../internals/utils/src/url.d.ts
|
|
@@ -104,7 +104,7 @@ declare class Url {
|
|
|
104
104
|
//#region src/reporters/cliReporter.d.ts
|
|
105
105
|
/**
|
|
106
106
|
* The default `cli` reporter. Renders the {@link Report} for each config as it finishes, independent
|
|
107
|
-
* of the live logger view. Suppressed at `silent
|
|
107
|
+
* of the live logger view. Suppressed at `silent`. The `verbose` level adds the per-plugin timings.
|
|
108
108
|
*/
|
|
109
109
|
declare const cliReporter: Reporter;
|
|
110
110
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./chunk-C0LytTxp.js";
|
|
2
|
-
import { a as createStorage, c as camelCase, d as BuildError, f as getErrorMessage, i as FileManager, l as pascalCase, n as _usingCtx, o as OPERATION_FILTER_TYPES, r as FileProcessor, s as diagnosticCode, t as memoryStorage, u as AsyncEventEmitter } from "./memoryStorage-
|
|
3
|
-
import { hash } from "node:crypto";
|
|
2
|
+
import { a as createStorage, c as camelCase, d as BuildError, f as getErrorMessage, i as FileManager, l as pascalCase, n as _usingCtx, o as OPERATION_FILTER_TYPES, r as FileProcessor, s as diagnosticCode, t as memoryStorage, u as AsyncEventEmitter } from "./memoryStorage-CWFzAz4o.js";
|
|
4
3
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
4
|
+
import { hash } from "node:crypto";
|
|
5
5
|
import { access, glob, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
6
6
|
import path, { dirname, join, relative, resolve } from "node:path";
|
|
7
7
|
import * as ast from "@kubb/ast";
|
|
@@ -573,9 +573,8 @@ var Url = class Url {
|
|
|
573
573
|
//#region src/createAdapter.ts
|
|
574
574
|
/**
|
|
575
575
|
* Defines a custom adapter that translates a spec format into Kubb's universal
|
|
576
|
-
* AST
|
|
577
|
-
*
|
|
578
|
-
* OpenAPI/Swagger documents.
|
|
576
|
+
* AST, for example GraphQL, gRPC, or AsyncAPI. The built-in `@kubb/adapter-oas`
|
|
577
|
+
* handles OpenAPI/Swagger documents.
|
|
579
578
|
*
|
|
580
579
|
* Adapters must return an `InputNode` from `parse`. That node is what every
|
|
581
580
|
* plugin in the build consumes.
|
|
@@ -607,9 +606,9 @@ function createAdapter(build) {
|
|
|
607
606
|
//#endregion
|
|
608
607
|
//#region src/diagnostics.ts
|
|
609
608
|
/**
|
|
610
|
-
* Docs major, derived from the package version so the link tracks the published major.
|
|
609
|
+
* Docs major version, derived from the package version so the link tracks the published major.
|
|
611
610
|
*/
|
|
612
|
-
const docsMajor = "5.0.0-beta.
|
|
611
|
+
const docsMajor = "5.0.0-beta.59".split(".")[0] ?? "5";
|
|
613
612
|
/**
|
|
614
613
|
* Narrows a {@link Diagnostic} to the variant for `code`, or `null` when it does not match.
|
|
615
614
|
*
|
|
@@ -1056,8 +1055,7 @@ function normalizeOutput({ output, group, pluginName }) {
|
|
|
1056
1055
|
}
|
|
1057
1056
|
/**
|
|
1058
1057
|
* Wraps a plugin factory and returns a function that accepts user options and
|
|
1059
|
-
* yields a
|
|
1060
|
-
* `hooks` object (inspired by Astro integrations).
|
|
1058
|
+
* yields a typed `Plugin`. Lifecycle handlers go inside a single `hooks` object.
|
|
1061
1059
|
*
|
|
1062
1060
|
* Pass a `PluginFactoryOptions` type parameter to get a typed `ctx` inside
|
|
1063
1061
|
* `kubb:plugin:setup`. Plugin names should follow the `plugin-<feature>`
|
|
@@ -1209,8 +1207,8 @@ function defaultResolveOptions(node, { options, exclude = [], include, override
|
|
|
1209
1207
|
/**
|
|
1210
1208
|
* Default path resolver used by `defineResolver`.
|
|
1211
1209
|
*
|
|
1212
|
-
* - `mode: 'file'`
|
|
1213
|
-
* - `mode: 'directory'` (default)
|
|
1210
|
+
* - `mode: 'file'` resolves directly to `output.path` (the full file path, extension included).
|
|
1211
|
+
* - `mode: 'directory'` (default) resolves to `output.path/{baseName}`, or into a
|
|
1214
1212
|
* subdirectory when `group` and a `tag`/`path` value are provided.
|
|
1215
1213
|
*
|
|
1216
1214
|
* A custom `group.name` function overrides the default subdirectory naming.
|
|
@@ -1447,8 +1445,8 @@ function defaultResolveFooter(meta, { output, file }) {
|
|
|
1447
1445
|
* - `resolveFile` builds the full `FileNode`.
|
|
1448
1446
|
* - `resolveBanner` and `resolveFooter` produce the top and bottom of file text.
|
|
1449
1447
|
*
|
|
1450
|
-
* Methods in the returned object can call sibling resolver methods via `this
|
|
1451
|
-
*
|
|
1448
|
+
* Methods in the returned object can call sibling resolver methods via `this`.
|
|
1449
|
+
* A custom rule can delegate to a default, for example `this.default(name, 'type')`.
|
|
1452
1450
|
*
|
|
1453
1451
|
* @example Basic resolver with naming helpers
|
|
1454
1452
|
* ```ts
|
|
@@ -1560,7 +1558,8 @@ var KubbDriver = class {
|
|
|
1560
1558
|
config;
|
|
1561
1559
|
options;
|
|
1562
1560
|
/**
|
|
1563
|
-
* The streaming `InputNode<true>` produced by the adapter.
|
|
1561
|
+
* The streaming `InputNode<true>` produced by the adapter. Set after adapter setup.
|
|
1562
|
+
* Parse-only adapters are wrapped automatically.
|
|
1564
1563
|
*/
|
|
1565
1564
|
inputNode = null;
|
|
1566
1565
|
adapter = null;
|
|
@@ -1937,7 +1936,7 @@ var KubbDriver = class {
|
|
|
1937
1936
|
*
|
|
1938
1937
|
* Plugins run sequentially so `kubb:plugin:end` fires as each plugin completes, instead
|
|
1939
1938
|
* of all at once after every plugin has marched through the parallel batches together.
|
|
1940
|
-
* That ordering is what drives the CLI's `Plugins N/M` counter
|
|
1939
|
+
* That ordering is what drives the CLI's `Plugins N/M` counter. Without it the bar would
|
|
1941
1940
|
* sit at the initial value until the very end of the run.
|
|
1942
1941
|
*
|
|
1943
1942
|
* When `entries` is empty or `this.inputNode` is `null`, every entry still gets a
|
|
@@ -2677,7 +2676,7 @@ function renderSummary(lines, { title, status }) {
|
|
|
2677
2676
|
}
|
|
2678
2677
|
/**
|
|
2679
2678
|
* The default `cli` reporter. Renders the {@link Report} for each config as it finishes, independent
|
|
2680
|
-
* of the live logger view. Suppressed at `silent
|
|
2679
|
+
* of the live logger view. Suppressed at `silent`. The `verbose` level adds the per-plugin timings.
|
|
2681
2680
|
*/
|
|
2682
2681
|
const cliReporter = createReporter({
|
|
2683
2682
|
name: "cli",
|
|
@@ -2799,10 +2798,9 @@ const jsonReporter = createReporter({
|
|
|
2799
2798
|
* (JSX, a template string, a tree of any shape) into `FileNode`s that get
|
|
2800
2799
|
* written to disk.
|
|
2801
2800
|
*
|
|
2802
|
-
*
|
|
2803
|
-
* renderer
|
|
2804
|
-
*
|
|
2805
|
-
* field on `defineGenerator`.
|
|
2801
|
+
* A renderer can target output formats beyond JSX, for instance a Handlebars
|
|
2802
|
+
* renderer or one that writes binary files. Plugins and generators pick the
|
|
2803
|
+
* renderer to use via the `renderer` field on `defineGenerator`.
|
|
2806
2804
|
*
|
|
2807
2805
|
* @example A minimal renderer that wraps a custom runtime
|
|
2808
2806
|
* ```ts
|