@kubb/core 5.8.4 → 5.9.1

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 "./rolldown-runtime-CRm0XQPb.js";
2
- import { $ as defineGenerator, $t as ProblemDiagnostic, A as PluginFactory, At as HookResult, B as ResolveFileOptions, Bt as ReporterName, C as NormalizedPlugin, Ct as KubbMessageContext, D as Override, Dt as PossibleConfig, E as OutputOptions, Et as KubbWarnContext, F as assertPluginOption, Ft as Storage, G as ResolverDefault, Gt as Diagnostic, H as ResolveOptionsContext, Ht as UserReporter, I as definePlugin, It as createStorage, J as ResolverFilePathParams, Jt as DiagnosticLocation, K as ResolverFile, Kt as DiagnosticDoc, L as BannerMeta, Lt as GenerationResult, M as PluginName, Mt as runHook, N as PluginType, Nt as KubbDriver, O as Plugin, Ot as PostGenerateCommand, P as ResolvePluginOptions, Pt as FileManagerHooks, Q as GeneratorContext, Qt as ProblemCode, R as ResolveBannerContext, Rt as Reporter, S as KubbPluginStartContext, St as KubbLifecycleStartContext, T as OutputMode, Tt as KubbSuccessContext, U as ResolvePathOptions, Ut as createReporter, V as ResolveImportsOptions, Vt as ReporterPluginFiles, W as Resolver, Wt as logLevel, X as ResolverPathParams, Xt as Diagnostics, Y as ResolverPatch, Yt as DiagnosticSeverity, Z as Generator, Zt as PerformanceDiagnostic, _ as Filter, _t as KubbHookEndContext, a as AdapterSource, an as createRenderer, at as Input, b as KubbPluginEndContext, bt as KubbHooks, c as ExtensionDependency, cn as ParserFactory, ct as KubbDiagnosticContext, d as ExtensionKind, dt as KubbFilesProcessingEndContext, en as SerializedDiagnostic, et as NodeCache, f as ExtensionMeta, ft as KubbFilesProcessingStartContext, g as Exclude, gt as KubbGenerationSummaryContext, h as resolveMeta, ht as KubbGenerationStartContext, i as AdapterFactoryOptions, in as RendererFactory, it as FilesContext, j as PluginFactoryOptions, jt as RunHookOptions, k as PluginDefinition, kt as UserConfig, l as ExtensionDependencyRecord, ln as defineParser, lt as KubbErrorContext, m as defineExtension, mt as KubbGenerationEndContext, n as AdapterDefinition, nn as Hookable, nt as CLIOptions, o as createAdapter, on as Parser, ot as KubbBuildEndContext, p as checkCompatibility, pt as KubbFilesProcessingUpdateContext, q as ResolverFileParams, qt as DiagnosticKind, r as AdapterFactory, rn as Renderer, rt as Config, s as ExtensionDependencies, sn as ParserDefinition, st as KubbBuildStartContext, t as Adapter, tn as UpdateDiagnostic, tt as BuildOutput, u as ExtensionFactory, ut as KubbFileProcessingUpdate, v as Group, vt as KubbHookLineContext, w as Output, wt as KubbPluginsEndContext, x as KubbPluginSetupContext, xt as KubbInfoContext, y as Include, yt as KubbHookStartContext, z as ResolveBannerFile, zt as ReporterContext } from "./createAdapter-BpJYvJTw.js";
2
+ import { $ as NodeCache, $t as SerializedDiagnostic, A as PluginFactory, At as RunHookOptions, B as ResolveImportsOptions, Bt as ReporterPluginFiles, C as NormalizedPlugin, Ct as KubbPluginsEndContext, D as Override, Dt as PostGenerateCommand, E as OutputOptions, Et as PossibleConfig, F as definePlugin, Ft as createStorage, G as ResolverFile, Gt as DiagnosticDoc, H as ResolvePathOptions, Ht as createReporter, I as BannerMeta, It as GenerationResult, J as ResolverPatch, Jt as DiagnosticSeverity, K as ResolverFileParams, Kt as DiagnosticKind, L as ResolveBannerContext, Lt as Reporter, M as PluginType, Mt as KubbDriver, N as ResolvePluginOptions, Nt as FileManagerHooks, O as Plugin, Ot as UserConfig, P as assertPluginOption, Pt as Storage, Q as defineGenerator, Qt as ProblemDiagnostic, R as ResolveBannerFile, Rt as ReporterContext, S as KubbPluginStartContext, St as KubbMessageContext, T as OutputMode, Tt as KubbWarnContext, U as Resolver, Ut as logLevel, V as ResolveOptionsContext, Vt as UserReporter, W as ResolverDefault, Wt as Diagnostic, X as Generator, Xt as PerformanceDiagnostic, Y as ResolverPathParams, Yt as Diagnostics, Z as GeneratorContext, Zt as ProblemCode, _ as Filter, _t as KubbHookLineContext, a as AdapterSource, an as Parser, at as KubbBuildEndContext, b as KubbPluginEndContext, bt as KubbInfoContext, c as ExtensionDependency, cn as defineParser, ct as KubbErrorContext, d as ExtensionKind, dt as KubbFilesProcessingStartContext, en as UpdateDiagnostic, et as BuildOutput, f as ExtensionMeta, ft as KubbFilesProcessingUpdateContext, g as Exclude, gt as KubbHookEndContext, h as resolveMeta, ht as KubbGenerationSummaryContext, i as AdapterFactoryOptions, in as createRenderer, it as Input, j as PluginName, jt as runHook, k as PluginDefinition, kt as HookResult, l as ExtensionDependencyRecord, lt as KubbFileProcessingUpdate, m as defineExtension, mt as KubbGenerationStartContext, n as AdapterDefinition, nn as Renderer, nt as Config, o as createAdapter, on as ParserDefinition, ot as KubbBuildStartContext, p as checkCompatibility, pt as KubbGenerationEndContext, q as ResolverFilePathParams, qt as DiagnosticLocation, r as AdapterFactory, rn as RendererFactory, rt as FilesContext, s as ExtensionDependencies, sn as ParserFactory, st as KubbDiagnosticContext, t as Adapter, tn as Hookable, tt as CLIOptions, u as ExtensionFactory, ut as KubbFilesProcessingEndContext, v as Group, vt as KubbHookStartContext, w as Output, wt as KubbSuccessContext, x as KubbPluginSetupContext, xt as KubbLifecycleStartContext, y as Include, yt as KubbHooks, z as ResolveFileOptions, zt as ReporterName } from "./createAdapter-DfbfcqcJ.js";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { FileNode, Macro, UserFileNode } from "@kubb/ast";
5
5
  //#region src/applyConfigDefaults.d.ts
@@ -39,18 +39,18 @@ export declare const kubbContext: AsyncLocalStorage<KubbPluginSetupContext>;
39
39
  * Returns the context of the plugin whose `kubb:plugin:setup` is running. It stays available after an `await`.
40
40
  * Throws `KUBB_NO_CONTEXT` outside setup.
41
41
  */
42
- export declare function useKubb<TFactory extends PluginFactoryOptions = PluginFactoryOptions>(): KubbPluginSetupContext<TFactory>;
42
+ export declare function useKubb<TFactory extends PluginType = PluginType>(): KubbPluginSetupContext<TFactory>;
43
43
  /**
44
44
  * Returns the same context as {@link useKubb}, or `undefined` outside `setup` and `kubb:plugin:setup`.
45
45
  */
46
- export declare function tryUseKubb<TFactory extends PluginFactoryOptions = PluginFactoryOptions>(): KubbPluginSetupContext<TFactory> | undefined;
46
+ export declare function tryUseKubb<TFactory extends PluginType = PluginType>(): KubbPluginSetupContext<TFactory> | undefined;
47
47
  /**
48
48
  * Registers generators on the plugin being set up, like `ctx.addGenerator`.
49
49
  *
50
50
  * @example
51
51
  * `addGenerator(typeGenerator, enumGenerator)`
52
52
  */
53
- export declare function addGenerator<TFactory extends PluginFactoryOptions = PluginFactoryOptions, TElement = unknown>(...generators: Array<Generator<TFactory, TElement>>): void;
53
+ export declare function addGenerator<TFactory extends PluginType = PluginType, TElement = unknown>(...generators: Array<Generator<TFactory, TElement>>): void;
54
54
  /**
55
55
  * Sets the resolver of the plugin being set up, like `ctx.setResolver`.
56
56
  */
@@ -70,11 +70,11 @@ export declare function injectFile(file: UserFileNode): void;
70
70
  /**
71
71
  * Returns the options the user passed to the plugin being set up, like `ctx.options`.
72
72
  */
73
- export declare function useOptions<TFactory extends PluginFactoryOptions = PluginFactoryOptions>(): TFactory['options'];
73
+ export declare function useOptions<TFactory extends PluginType = PluginType>(): TFactory['options'];
74
74
  /**
75
75
  * Sets the resolved options of the plugin being set up, like `ctx.setOptions`.
76
76
  */
77
- export declare function setOptions<TFactory extends PluginFactoryOptions = PluginFactoryOptions>(options: TFactory['resolvedOptions']): void;
77
+ export declare function setOptions<TFactory extends PluginType = PluginType>(options: TFactory['resolvedOptions']): void;
78
78
  /**
79
79
  * Returns the resolved build configuration, like `ctx.config`.
80
80
  */
@@ -261,9 +261,9 @@ export declare const cliReporter: Reporter;
261
261
  //#region src/reporters/fileReporter.d.ts
262
262
  /**
263
263
  * The `file` reporter. Writes a config's {@link Report} to `.kubb/kubb-<name>-<timestamp>.log` as a
264
- * plain-text document: a `# <name> — <timestamp>` header, a `## Summary` with the same counts the
265
- * cli and json reporters expose, a `## Problems` section in the miette block format, and a
266
- * `## Timings` section. Selected with `--reporter file` (or `reporters: ['file']`).
264
+ * plain-text document: a `# <name> — <timestamp>` header, a `## Summary` with the same lines the
265
+ * cli reporter prints (timings included), and a `## Problems` section in the miette block format.
266
+ * Selected with `--reporter file` (or `reporters: ['file']`).
267
267
  *
268
268
  * @note It captures the collected diagnostics once a config finishes, not the live
269
269
  * `kubb:info`/`kubb:plugin` hook stream. Color is stripped so the file stays plain text even when
@@ -293,7 +293,7 @@ export declare const htmlReporter: Reporter;
293
293
  * back to the built-ins when omitted. Every method reaches sibling helpers through `this`,
294
294
  * which `ThisType` types as the full resolver.
295
295
  */
296
- type ResolverOptions<T extends PluginFactoryOptions> = Omit<T['resolver'], keyof Resolver> & {
296
+ type ResolverOptions<T extends PluginType> = Omit<T['resolver'], keyof Resolver> & {
297
297
  pluginName: T['name'];
298
298
  name?: T['resolver']['name'];
299
299
  file?: ResolverFile;
@@ -342,7 +342,7 @@ type ResolverOptions<T extends PluginFactoryOptions> = Omit<T['resolver'], keyof
342
342
  * })
343
343
  * ```
344
344
  */
345
- export declare function createResolver<T extends PluginFactoryOptions>(options: ResolverOptions<T>): T['resolver'];
345
+ export declare function createResolver<T extends PluginType>(options: ResolverOptions<T>): T['resolver'];
346
346
  //#endregion
347
347
  //#region src/input.d.ts
348
348
  /**
@@ -536,6 +536,8 @@ type ExtensionManifest = {
536
536
  }>;
537
537
  /** Names of the extensions that must be in the same config, such as `['plugin-ts']`. */
538
538
  dependencies?: Array<string>;
539
+ /** Names of the extensions used when they are in the config, or needed only for some option values, such as `['plugin-faker']`. */
540
+ optionalDependencies?: Array<string>;
539
541
  compatibility?: {
540
542
  kubb?: string;
541
543
  node?: string;
@@ -641,5 +643,5 @@ export declare function readInstalledPackages({ root, packages, resolveFrom }: {
641
643
  resolveFrom?: Array<string>;
642
644
  }): Promise<Array<InstalledPackage>>;
643
645
  //#endregion
644
- export { type Adapter, type AdapterDefinition, type AdapterFactory, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, BuildOutput, CLIOptions, Config, type CreateKubbOptions, type Diagnostic, type DiagnosticDoc, type DiagnosticKind, type DiagnosticLocation, type DiagnosticSeverity, Diagnostics, type Exclude, type ExtensionDependencies, type ExtensionDependency, type ExtensionDependencyRecord, type ExtensionFactory, type ExtensionKind, type ExtensionManifest, type ExtensionManifestOption, type ExtensionMeta, type FileManagerHooks, FilesContext, type Filter, type GenerateOptions, type GenerateResult, type GenerationResult, type Generator, type GeneratorContext, type Group, type HookResult, Hookable, type Include, Input, type InputKind, type InstalledPackage, type JSONValue, type Kubb, KubbBuildEndContext, KubbBuildStartContext, KubbDiagnosticContext, KubbDriver, KubbErrorContext, KubbFileProcessingUpdate, KubbFilesProcessingEndContext, KubbFilesProcessingStartContext, KubbFilesProcessingUpdateContext, KubbGenerationEndContext, KubbGenerationStartContext, KubbGenerationSummaryContext, KubbHookEndContext, KubbHookLineContext, KubbHookStartContext, KubbHooks, KubbInfoContext, KubbLifecycleStartContext, KubbMessageContext, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, KubbPluginsEndContext, KubbSuccessContext, KubbWarnContext, type NodeCache, type NormalizedPlugin, type Output, type OutputMode, type OutputOptions, type Override, type Parser, type ParserDefinition, type ParserFactory, type PerformanceDiagnostic, type Plugin, type PluginDefinition, type PluginFactory, type PluginFactoryOptions, type PluginName, type PluginType, PossibleConfig, PostGenerateCommand, 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 ResolveOptionsContext, type ResolvePathOptions, type ResolvePluginOptions, Resolver, type ResolverDefault, type ResolverFile, type ResolverFileParams, type ResolverFilePathParams, type ResolverPatch, type ResolverPathParams, type RunHookOptions, type RunOutputPassesOptions, type SerializedDiagnostic, type Storage, type SummaryRenderer, type UpdateDiagnostic, UserConfig, type UserReporter, assertPluginOption, checkCompatibility, createAdapter, createRenderer, createReporter, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, logLevel, resolveMeta, runHook };
646
+ export { type Adapter, type AdapterDefinition, type AdapterFactory, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, BuildOutput, CLIOptions, Config, type CreateKubbOptions, type Diagnostic, type DiagnosticDoc, type DiagnosticKind, type DiagnosticLocation, type DiagnosticSeverity, Diagnostics, type Exclude, type ExtensionDependencies, type ExtensionDependency, type ExtensionDependencyRecord, type ExtensionFactory, type ExtensionKind, type ExtensionManifest, type ExtensionManifestOption, type ExtensionMeta, type FileManagerHooks, FilesContext, type Filter, type GenerateOptions, type GenerateResult, type GenerationResult, type Generator, type GeneratorContext, type Group, type HookResult, Hookable, type Include, Input, type InputKind, type InstalledPackage, type JSONValue, type Kubb, KubbBuildEndContext, KubbBuildStartContext, KubbDiagnosticContext, KubbDriver, KubbErrorContext, KubbFileProcessingUpdate, KubbFilesProcessingEndContext, KubbFilesProcessingStartContext, KubbFilesProcessingUpdateContext, KubbGenerationEndContext, KubbGenerationStartContext, KubbGenerationSummaryContext, KubbHookEndContext, KubbHookLineContext, KubbHookStartContext, KubbHooks, KubbInfoContext, KubbLifecycleStartContext, KubbMessageContext, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, KubbPluginsEndContext, KubbSuccessContext, KubbWarnContext, type NodeCache, type NormalizedPlugin, type Output, type OutputMode, type OutputOptions, type Override, type Parser, type ParserDefinition, type ParserFactory, type PerformanceDiagnostic, type Plugin, type PluginDefinition, type PluginFactory, type PluginName, type PluginType, PossibleConfig, PostGenerateCommand, 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 ResolveOptionsContext, type ResolvePathOptions, type ResolvePluginOptions, Resolver, type ResolverDefault, type ResolverFile, type ResolverFileParams, type ResolverFilePathParams, type ResolverPatch, type ResolverPathParams, type RunHookOptions, type RunOutputPassesOptions, type SerializedDiagnostic, type Storage, type SummaryRenderer, type UpdateDiagnostic, UserConfig, type UserReporter, assertPluginOption, checkCompatibility, createAdapter, createRenderer, createReporter, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, logLevel, resolveMeta, runHook };
645
647
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./rolldown-runtime-CRm0XQPb.js";
2
- import { A as getElapsedMs, C as useOptions, D as resolveMeta, E as defineExtension, F as read, I as toPosixPath, L as write, M as clean, N as exists, O as Diagnostics, P as isPathInside, R as toError, S as useKubb, T as createExtensionFactory, _ as setMacros, a as _usingCtx, b as tryUseKubb, c as Resolver, d as definePlugin, f as addGenerator, g as requirePlugin, h as kubbContext, j as inParallel, k as formatMs, l as getInputKind, m as injectFile, o as Hookable, p as addMacro, s as createResolver, t as KubbDriver, u as assertPluginOption, v as setOptions, w as checkCompatibility, x as useConfig, y as setResolver } from "./KubbDriver-DbOEJvzz.js";
2
+ import { A as getElapsedMs, C as useOptions, D as resolveMeta, E as defineExtension, F as read, I as toPosixPath, L as write, M as clean, N as exists, O as Diagnostics, P as isPathInside, R as toError, S as useKubb, T as createExtensionFactory, _ as setMacros, a as _usingCtx, b as tryUseKubb, c as Resolver, d as definePlugin, f as addGenerator, g as requirePlugin, h as kubbContext, j as inParallel, k as formatMs, l as getInputKind, m as injectFile, o as Hookable, p as addMacro, s as createResolver, t as KubbDriver, u as assertPluginOption, v as setOptions, w as checkCompatibility, x as useConfig, y as setResolver } from "./KubbDriver-GBBjs4Pb.js";
3
3
  import { createRequire } from "node:module";
4
4
  import { isValid } from "verkit";
5
5
  import { stripVTControlCharacters, styleText } from "node:util";
@@ -926,36 +926,6 @@ function buildReport(result) {
926
926
  };
927
927
  }
928
928
  //#endregion
929
- //#region src/reporters/colors.ts
930
- /**
931
- * ANSI color names used by {@link randomCliColor} for deterministic terminal coloring.
932
- */
933
- const randomColors = [
934
- "black",
935
- "red",
936
- "green",
937
- "yellow",
938
- "blue",
939
- "white",
940
- "magenta",
941
- "cyan",
942
- "gray"
943
- ];
944
- /**
945
- * Wraps `text` in a deterministic ANSI color derived from the text's SHA-256 hash.
946
- *
947
- * @example
948
- * ```ts
949
- * randomCliColor('petstore') // '\x1b[33m' + 'petstore' + '\x1b[39m' (always the same color for 'petstore')
950
- * ```
951
- */
952
- function randomCliColor(text) {
953
- if (!text) return "";
954
- const index = hash("sha256", text, "buffer").readUInt32BE(0) % randomColors.length;
955
- const color = randomColors[index] ?? "white";
956
- return styleText(color, text);
957
- }
958
- //#endregion
959
929
  //#region src/reporters/summary.ts
960
930
  /**
961
931
  * Formats the vitest/jest-style summary for one {@link Report}: right-aligned dim labels with
@@ -966,7 +936,7 @@ function formatSummary(report, { showTimings }) {
966
936
  const { status, plugins, counts, filesCreated, durationMs, output, timings } = report;
967
937
  const rows = [];
968
938
  rows.push(["Plugins", status === "success" ? `${styleText("green", `${plugins.passed} passed`)} (${plugins.total})` : `${styleText("green", `${plugins.passed} passed`)} | ${styleText("red", `${plugins.failed.length} failed`)} (${plugins.total})`]);
969
- if (status === "failed" && plugins.failed.length > 0) rows.push(["Failed", plugins.failed.map((name) => randomCliColor(name)).join(", ")]);
939
+ if (status === "failed" && plugins.failed.length > 0) rows.push(["Failed", plugins.failed.map((name) => styleText("red", name)).join(", ")]);
970
940
  if (counts.errors > 0 || counts.warnings > 0) {
971
941
  const issues = [counts.errors > 0 ? styleText("red", `${counts.errors} ${counts.errors === 1 ? "error" : "errors"}`) : void 0, counts.warnings > 0 ? styleText("yellow", `${counts.warnings} ${counts.warnings === 1 ? "warning" : "warnings"}`) : void 0].filter(Boolean).join(" | ");
972
942
  rows.push(["Issues", issues]);
@@ -1071,25 +1041,6 @@ function kubbStorage({ base } = {}) {
1071
1041
  //#endregion
1072
1042
  //#region src/reporters/fileReporter.ts
1073
1043
  /**
1074
- * Builds the `## Summary` section: the same counts the cli and json reporters expose, as a list of
1075
- * `label value` rows with the labels padded to a common width.
1076
- */
1077
- function buildSummarySection(report) {
1078
- const { status, plugins, counts, filesCreated, durationMs, output } = report;
1079
- const rows = [["Status", status], ["Plugins", status === "success" ? `${plugins.passed} passed (${plugins.total})` : `${plugins.passed} passed | ${plugins.failed.length} failed (${plugins.total})`]];
1080
- if (plugins.failed.length > 0) rows.push(["Failed", plugins.failed.join(", ")]);
1081
- rows.push(["Issues", `${counts.errors} errors | ${counts.warnings} warnings | ${counts.infos} infos`]);
1082
- rows.push(["Files", `${filesCreated} generated`]);
1083
- rows.push(["Duration", formatMs(durationMs)]);
1084
- rows.push(["Output", output]);
1085
- const labelWidth = Math.max(...rows.map(([label]) => label.length));
1086
- return [
1087
- "## Summary",
1088
- "",
1089
- ...rows.map(([label, value]) => ` ${label.padEnd(labelWidth)} ${value}`)
1090
- ];
1091
- }
1092
- /**
1093
1044
  * Builds the `## Problems` section: each problem rendered in the miette block format, blocks
1094
1045
  * separated by a blank line. Returns an empty array when there are no problems, so the caller
1095
1046
  * can drop the heading.
@@ -1104,27 +1055,10 @@ function buildProblemSection(diagnostics) {
1104
1055
  ];
1105
1056
  }
1106
1057
  /**
1107
- * Builds the `## Timings` section from a {@link Report}: one `plugin duration` row per record,
1108
- * slowest first with the plugin names left-aligned and the durations right-aligned. Returns an
1109
- * empty array when there are no timings.
1110
- */
1111
- function buildTimingSection(report) {
1112
- const { timings } = report;
1113
- if (timings.length === 0) return [];
1114
- const nameWidth = Math.max(...timings.map((timing) => timing.plugin.length));
1115
- const durations = timings.map((timing) => formatMs(timing.durationMs));
1116
- const durationWidth = Math.max(...durations.map((duration) => duration.length));
1117
- return [
1118
- "## Timings",
1119
- "",
1120
- ...timings.map((timing, index) => ` ${timing.plugin.padEnd(nameWidth)} ${durations[index].padStart(durationWidth)}`)
1121
- ];
1122
- }
1123
- /**
1124
1058
  * The `file` reporter. Writes a config's {@link Report} to `.kubb/kubb-<name>-<timestamp>.log` as a
1125
- * plain-text document: a `# <name> — <timestamp>` header, a `## Summary` with the same counts the
1126
- * cli and json reporters expose, a `## Problems` section in the miette block format, and a
1127
- * `## Timings` section. Selected with `--reporter file` (or `reporters: ['file']`).
1059
+ * plain-text document: a `# <name> — <timestamp>` header, a `## Summary` with the same lines the
1060
+ * cli reporter prints (timings included), and a `## Problems` section in the miette block format.
1061
+ * Selected with `--reporter file` (or `reporters: ['file']`).
1128
1062
  *
1129
1063
  * @note It captures the collected diagnostics once a config finishes, not the live
1130
1064
  * `kubb:info`/`kubb:plugin` hook stream. Color is stripped so the file stays plain text even when
@@ -1137,11 +1071,11 @@ const fileReporter = createReporter({
1137
1071
  if (diagnostics.length === 0) return;
1138
1072
  const report = buildReport(result);
1139
1073
  const header = config.name ? `# ${config.name} — ${(/* @__PURE__ */ new Date()).toISOString()}` : `# ${(/* @__PURE__ */ new Date()).toISOString()}`;
1140
- const sections = [
1141
- buildSummarySection(report),
1142
- buildProblemSection(diagnostics),
1143
- buildTimingSection(report)
1144
- ].filter((section) => section.length > 0);
1074
+ const sections = [[
1075
+ "## Summary",
1076
+ "",
1077
+ ...formatSummary(report, { showTimings: true })
1078
+ ], buildProblemSection(diagnostics)].filter((section) => section.length > 0);
1145
1079
  const content = stripVTControlCharacters([header, ...sections.map((section) => section.join("\n"))].join("\n\n"));
1146
1080
  const baseName = `${[
1147
1081
  "kubb",
@@ -1249,7 +1183,7 @@ function createRenderer(factory) {
1249
1183
  *
1250
1184
  * The returned object is the input as-is, but with `this` types preserved so
1251
1185
  * `schema`/`operation`/`operations` methods are correctly typed against the
1252
- * plugin's `PluginFactoryOptions`. Renderer elements and `FileNode[]` returns
1186
+ * plugin's `PluginType`. Renderer elements and `FileNode[]` returns
1253
1187
  * are both handled by the runtime, so pick whichever style fits.
1254
1188
  *
1255
1189
  * @example JSX-based schema generator
@@ -1412,8 +1346,8 @@ function manifestProblems({ options = [] }) {
1412
1346
  */
1413
1347
  function isExtensionManifest(value) {
1414
1348
  if (!isObject(value)) return false;
1415
- const { kind, name, export: exportName, displayName, description, maintainers, dependencies, compatibility, options } = value;
1416
- return EXTENSION_KINDS.has(kind) && isPackageName(name) && typeof exportName === "string" && IDENTIFIER.test(exportName) && typeof displayName === "string" && typeof description === "string" && (maintainers === void 0 || Array.isArray(maintainers) && maintainers.every(isMaintainer)) && (dependencies === void 0 || Array.isArray(dependencies) && dependencies.every(isPackageName)) && (compatibility === void 0 || isObject(compatibility) && Object.entries(compatibility).every(([key, range]) => (key === "kubb" || key === "node") && typeof range === "string")) && (options === void 0 || Array.isArray(options) && options.every(isOption)) && manifestProblems(value).length === 0;
1349
+ const { kind, name, export: exportName, displayName, description, maintainers, dependencies, optionalDependencies, compatibility, role, options } = value;
1350
+ return EXTENSION_KINDS.has(kind) && isPackageName(name) && typeof exportName === "string" && IDENTIFIER.test(exportName) && typeof displayName === "string" && typeof description === "string" && (maintainers === void 0 || Array.isArray(maintainers) && maintainers.every(isMaintainer)) && (dependencies === void 0 || Array.isArray(dependencies) && dependencies.every(isPackageName)) && (optionalDependencies === void 0 || Array.isArray(optionalDependencies) && optionalDependencies.every(isPackageName)) && (compatibility === void 0 || isObject(compatibility) && Object.entries(compatibility).every(([key, range]) => (key === "kubb" || key === "node") && typeof range === "string")) && (role === void 0 || role === "client" || role === "consumer") && (options === void 0 || Array.isArray(options) && options.every(isOption)) && manifestProblems(value).length === 0;
1417
1351
  }
1418
1352
  /** Checks that no artifact field can reach a package manager as a flag or path, and that a GitHub tag names the version. */
1419
1353
  function isRegistryArtifact(value) {