@kubb/core 5.0.0-beta.62 → 5.0.0-beta.63

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.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-D0G07LHG.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-IjkPEgAO.js";
3
3
  import * as ast from "@kubb/ast";
4
4
 
5
5
  //#region ../../internals/utils/src/url.d.ts
@@ -113,12 +113,11 @@ declare const cliReporter: Reporter;
113
113
  * The `file` reporter. Writes a config's {@link Report} to `.kubb/kubb-<name>-<timestamp>.log` as a
114
114
  * plain-text document: a `# <name> — <timestamp>` header, a `## Summary` with the same counts the
115
115
  * cli and json reporters expose, a `## Problems` section in the miette block format, and a
116
- * `## Timings` section. Selected with `--reporter file` (or `reporters: ['file']`), replacing the
117
- * old `--debug` flag.
116
+ * `## Timings` section. Selected with `--reporter file` (or `reporters: ['file']`).
118
117
  *
119
- * @note Unlike the streaming logger it replaced, it captures the collected diagnostics once a
120
- * config finishes, not the live `kubb:info`/`kubb:plugin` event stream. Color is stripped so the
121
- * file stays plain text even when the run is attached to a TTY.
118
+ * @note It captures the collected diagnostics once a config finishes, not the live
119
+ * `kubb:info`/`kubb:plugin` event stream. Color is stripped so the file stays plain text even when
120
+ * the run is attached to a TTY.
122
121
  */
123
122
  declare const fileReporter: Reporter;
124
123
  //#endregion
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./chunk-C0LytTxp.js";
2
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";
3
- import { hash } from "node:crypto";
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";
@@ -590,12 +590,12 @@ var Url = class Url {
590
590
  * options,
591
591
  * document: null,
592
592
  * async parse(_source) {
593
- * // Convert `source` (path or inline data) into an InputNode.
593
+ * // Convert the source (path or inline data) into an InputNode.
594
594
  * return ast.factory.createInput()
595
595
  * },
596
596
  * getImports: () => [],
597
597
  * async validate() {
598
- * // Throw or call ctx.error here when the spec is invalid.
598
+ * // Throw here when the spec is invalid.
599
599
  * },
600
600
  * }))
601
601
  * ```
@@ -608,7 +608,7 @@ function createAdapter(build) {
608
608
  /**
609
609
  * Docs major version, derived from the package version so the link tracks the published major.
610
610
  */
611
- const docsMajor = "5.0.0-beta.62".split(".")[0] ?? "5";
611
+ const docsMajor = "5.0.0-beta.63".split(".")[0] ?? "5";
612
612
  /**
613
613
  * Narrows a {@link Diagnostic} to the variant for `code`, or `null` when it does not match.
614
614
  *
@@ -928,8 +928,8 @@ var Diagnostics = class Diagnostics {
928
928
  return [...names];
929
929
  }
930
930
  /**
931
- * Counts `problem` diagnostics by severity for the run summary. `timing`
932
- * diagnostics are ignored.
931
+ * Counts `problem` diagnostics by severity for the run summary. `performance` and
932
+ * `update` diagnostics are ignored.
933
933
  */
934
934
  static count(diagnostics) {
935
935
  let errors = 0;
@@ -1497,7 +1497,7 @@ function defineResolver(build) {
1497
1497
  * leaves the tree untouched, so callers can detect a no-op by identity.
1498
1498
  *
1499
1499
  * Registration order matches the order setup hooks fire, which the driver has already sorted by
1500
- * `enforce` and dependency edges. The registry preserves that order; macro `enforce` only reorders
1500
+ * `enforce` and dependency edges. The registry preserves that order. Macro `enforce` only reorders
1501
1501
  * within a single plugin's list.
1502
1502
  */
1503
1503
  var Transform = class {
@@ -1630,6 +1630,12 @@ var KubbDriver = class {
1630
1630
  this.hooks.on(event, handler);
1631
1631
  this.#listeners.push([event, handler]);
1632
1632
  }
1633
+ /**
1634
+ * Normalizes every configured plugin, orders them, and registers their lifecycle handlers.
1635
+ * A plugin that another lists as a dependency runs first, then `enforce: 'pre'` before
1636
+ * `'post'`. When the config has an adapter, the adapter source is resolved from the input
1637
+ * so `run` can parse it later.
1638
+ */
1633
1639
  async setup() {
1634
1640
  const normalized = this.config.plugins.map((rawPlugin) => this.#normalizePlugin(rawPlugin));
1635
1641
  const dependenciesByName = new Map(normalized.map((plugin) => [plugin.name, new Set(plugin.dependencies ?? [])]));
@@ -1649,8 +1655,9 @@ var KubbDriver = class {
1649
1655
  return this.options.hooks;
1650
1656
  }
1651
1657
  /**
1652
- * Creates an `NormalizedPlugin` from a hook-style plugin and registers
1653
- * its lifecycle handlers on the `AsyncEventEmitter`.
1658
+ * Builds a `NormalizedPlugin` from a hook-style plugin, filling in default
1659
+ * options and copying `apply` when present. Registering its lifecycle handlers
1660
+ * on the `AsyncEventEmitter` is done separately by `#registerPlugin`.
1654
1661
  */
1655
1662
  #normalizePlugin(plugin) {
1656
1663
  const normalized = {
@@ -1755,7 +1762,7 @@ var KubbDriver = class {
1755
1762
  * Emits the `kubb:plugin:setup` event so that all registered hook-style plugin listeners
1756
1763
  * can configure generators, resolvers, macros and renderers before `buildStart` runs.
1757
1764
  *
1758
- * Call this once from `safeBuild` before the plugin execution loop begins.
1765
+ * Called once from `run` before the plugin execution loop begins.
1759
1766
  */
1760
1767
  async emitSetupHooks() {
1761
1768
  const noop = () => {};
@@ -1950,8 +1957,8 @@ var KubbDriver = class {
1950
1957
  * That ordering is what drives the CLI's `Plugins N/M` counter. Without it the bar would
1951
1958
  * sit at the initial value until the very end of the run.
1952
1959
  *
1953
- * When `entries` is empty or `this.inputNode` is `null`, every entry still gets a
1954
- * `kubb:plugin:end` so post-plugin listeners (the barrel writer and friends) complete.
1960
+ * When `this.inputNode` is `null`, every entry still gets a `kubb:plugin:end` so
1961
+ * post-plugin listeners (the barrel writer and friends) complete.
1955
1962
  */
1956
1963
  async #runGenerators(entries, flushPending) {
1957
1964
  const diagnostics = [];
@@ -2442,9 +2449,8 @@ function resolveConfig(userConfig) {
2442
2449
  * config in the constructor, so `config` is available right away, and shares `hooks`,
2443
2450
  * `storage`, and `driver` across the `setup → build` lifecycle.
2444
2451
  *
2445
- * `createKubb` takes a plain, serializable config object (the shape `defineConfig`
2446
- * produces), not a fluent builder. Config stays plain data so it can be cache
2447
- * fingerprinted and validated against the shipped JSON schema.
2452
+ * `createKubb` takes a plain config object (the shape `defineConfig` produces),
2453
+ * not a fluent builder.
2448
2454
  *
2449
2455
  * Attach event listeners to `.hooks` before calling `setup()` or `build()`.
2450
2456
  *
@@ -2753,12 +2759,11 @@ function buildTimingSection(report) {
2753
2759
  * The `file` reporter. Writes a config's {@link Report} to `.kubb/kubb-<name>-<timestamp>.log` as a
2754
2760
  * plain-text document: a `# <name> — <timestamp>` header, a `## Summary` with the same counts the
2755
2761
  * cli and json reporters expose, a `## Problems` section in the miette block format, and a
2756
- * `## Timings` section. Selected with `--reporter file` (or `reporters: ['file']`), replacing the
2757
- * old `--debug` flag.
2762
+ * `## Timings` section. Selected with `--reporter file` (or `reporters: ['file']`).
2758
2763
  *
2759
- * @note Unlike the streaming logger it replaced, it captures the collected diagnostics once a
2760
- * config finishes, not the live `kubb:info`/`kubb:plugin` event stream. Color is stripped so the
2761
- * file stays plain text even when the run is attached to a TTY.
2764
+ * @note It captures the collected diagnostics once a config finishes, not the live
2765
+ * `kubb:info`/`kubb:plugin` event stream. Color is stripped so the file stays plain text even when
2766
+ * the run is attached to a TTY.
2762
2767
  */
2763
2768
  const fileReporter = createReporter({
2764
2769
  name: "file",