@kubb/core 5.10.1 → 5.10.2
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/{Hookable-ZX2OqaPh.js → Hookable-Bjfoua7Y.js} +418 -321
- package/dist/Hookable-Bjfoua7Y.js.map +1 -0
- package/dist/{Hookable-BnYDebfN.cjs → Hookable-RTuEiBd9.cjs} +418 -321
- package/dist/Hookable-RTuEiBd9.cjs.map +1 -0
- package/dist/{createAdapter-D55JE9lX.d.ts → createAdapter-CMnLz31B.d.ts} +851 -731
- package/dist/index.cjs +31 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +31 -18
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +1 -1
- package/package.json +2 -2
- package/dist/Hookable-BnYDebfN.cjs.map +0 -1
- package/dist/Hookable-ZX2OqaPh.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./rolldown-runtime-CRm0XQPb.js";
|
|
2
|
-
import { $ as NodeCache, $t as
|
|
2
|
+
import { $ as NodeCache, $t as ReporterPluginFiles, A as PluginFactory, At as KubbInfoContext, B as ResolveImportsOptions, Bt as RunHookOptions, C as NormalizedPlugin, Ct as KubbGenerationEndContext, D as Override, Dt as KubbHookLineContext, E as OutputOptions, Et as KubbHookEndContext, F as definePlugin, Ft as KubbWarnContext, G as ResolverFile, Gt as RendererFactory, H as ResolvePathOptions, Ht as KubbDriver, I as BannerMeta, It as PossibleConfig, J as ResolverPatch, Jt as createStorage, K as ResolverFileParams, Kt as createRenderer, L as ResolveBannerContext, Lt as PostGenerateCommand, M as PluginType, Mt as KubbMessageContext, N as ResolvePluginOptions, Nt as KubbPluginsEndContext, O as Plugin, Ot as KubbHookStartContext, P as assertPluginOption, Pt as KubbSuccessContext, Q as defineGenerator, Qt as ReporterName, R as ResolveBannerFile, Rt as UserConfig, S as KubbPluginStartContext, St as KubbFilesProcessingUpdateContext, T as OutputMode, Tt as KubbGenerationSummaryContext, U as Resolver, Ut as Hookable, V as ResolveOptionsContext, Vt as runHook, W as ResolverDefault, Wt as Renderer, X as Generator, Xt as Reporter, Y as ResolverPathParams, Yt as GenerationResult, Z as GeneratorContext, Zt as ReporterContext, _ as Filter, _t as KubbDiagnosticContext, a as AdapterSource, an as Parser, at as Diagnostics, b as KubbPluginEndContext, bt as KubbFilesProcessingEndContext, c as ExtensionDependency, cn as defineParser, ct as ProblemDiagnostic, d as ExtensionKind, dt as CLIOptions, en as UserReporter, et as Diagnostic, f as ExtensionMeta, ft as Config, g as Exclude, gt as KubbBuildStartContext, h as resolveMeta, ht as KubbBuildEndContext, i as AdapterFactoryOptions, in as SerializedDiagnostic, it as DiagnosticSeverity, j as PluginName, jt as KubbLifecycleStartContext, k as PluginDefinition, kt as KubbHooks, l as ExtensionDependencyRecord, lt as UpdateDiagnostic, m as defineExtension, mt as Input, n as AdapterDefinition, nn as logLevel, nt as DiagnosticKind, o as createAdapter, on as ParserDefinition, ot as PerformanceDiagnostic, p as checkCompatibility, pt as FilesContext, q as ResolverFilePathParams, qt as Storage, r as AdapterFactory, rn as DiagnosticFormatOptions, rt as DiagnosticLocation, s as ExtensionDependencies, sn as ParserFactory, st as ProblemCode, t as Adapter, tn as createReporter, tt as DiagnosticDoc, u as ExtensionFactory, ut as BuildOutput, v as Group, vt as KubbErrorContext, w as Output, wt as KubbGenerationStartContext, x as KubbPluginSetupContext, xt as KubbFilesProcessingStartContext, y as Include, yt as KubbFileProcessingUpdate, z as ResolveFileOptions, zt as HookResult } from "./createAdapter-CMnLz31B.js";
|
|
3
3
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
4
|
import { FileNode, Macro, UserFileNode } from "@kubb/ast";
|
|
5
5
|
//#region src/composables.d.ts
|
|
@@ -617,5 +617,5 @@ export declare function readInstalledPackages({ root, packages, resolveFrom }: {
|
|
|
617
617
|
resolveFrom?: Array<string>;
|
|
618
618
|
}): Promise<Array<InstalledPackage>>;
|
|
619
619
|
//#endregion
|
|
620
|
-
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, 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 };
|
|
620
|
+
export { type Adapter, type AdapterDefinition, type AdapterFactory, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, BuildOutput, CLIOptions, Config, type CreateKubbOptions, type Diagnostic, type DiagnosticDoc, type DiagnosticFormatOptions, 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, 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 };
|
|
621
621
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "./rolldown-runtime-CRm0XQPb.js";
|
|
2
|
-
import { A as inParallel, C as useOptions, D as Diagnostics, E as resolveMeta, F as toError, M as read, N as toPosixPath, O as formatMs, P as write, S as useKubb, T as defineExtension, _ as setMacros, b as tryUseKubb, c as Resolver, d as definePlugin, f as addGenerator, g as requirePlugin, h as kubbContext, j as isPathInside, k as getElapsedMs, l as getInputKind, m as injectFile, n as KubbDriver, o as _usingCtx, p as addMacro, s as createResolver, t as Hookable, u as assertPluginOption, v as setOptions, w as checkCompatibility, x as useConfig, y as setResolver } from "./Hookable-
|
|
2
|
+
import { A as inParallel, C as useOptions, D as Diagnostics, E as resolveMeta, F as toError, M as read, N as toPosixPath, O as formatMs, P as write, S as useKubb, T as defineExtension, _ as setMacros, b as tryUseKubb, c as Resolver, d as definePlugin, f as addGenerator, g as requirePlugin, h as kubbContext, j as isPathInside, k as getElapsedMs, l as getInputKind, m as injectFile, n as KubbDriver, o as _usingCtx, p as addMacro, s as createResolver, t as Hookable, u as assertPluginOption, v as setOptions, w as checkCompatibility, x as useConfig, y as setResolver } from "./Hookable-Bjfoua7Y.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { isValid } from "verkit";
|
|
5
|
-
import { stripVTControlCharacters, styleText } from "node:util";
|
|
6
5
|
import process$1 from "node:process";
|
|
7
6
|
import { x } from "tinyexec";
|
|
8
7
|
import { glob, readFile, rm } from "node:fs/promises";
|
|
9
8
|
import path, { join, relative, resolve } from "node:path";
|
|
9
|
+
import { stripVTControlCharacters, styleText } from "node:util";
|
|
10
10
|
import { hash, randomUUID } from "node:crypto";
|
|
11
11
|
import { chmodSync, existsSync, mkdirSync } from "node:fs";
|
|
12
12
|
import { homedir, tmpdir } from "node:os";
|
|
@@ -632,7 +632,11 @@ var Kubb = class {
|
|
|
632
632
|
return this.config.storage;
|
|
633
633
|
}
|
|
634
634
|
get driver() {
|
|
635
|
-
if (!this.#driver) throw new Error(
|
|
635
|
+
if (!this.#driver) throw new Diagnostics.Error({
|
|
636
|
+
code: Diagnostics.code.internalError,
|
|
637
|
+
severity: "error",
|
|
638
|
+
message: "[kubb] setup() must be called before accessing driver"
|
|
639
|
+
});
|
|
636
640
|
return this.#driver;
|
|
637
641
|
}
|
|
638
642
|
/**
|
|
@@ -720,19 +724,23 @@ var Kubb = class {
|
|
|
720
724
|
const { hooks, config } = this;
|
|
721
725
|
const hrStart = process.hrtime();
|
|
722
726
|
await hooks.callHook("kubb:generation:start", { config });
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
if (
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
727
|
+
let output;
|
|
728
|
+
try {
|
|
729
|
+
await hooks.callHook("kubb:setup:start");
|
|
730
|
+
await this.setup();
|
|
731
|
+
await hooks.callHook("kubb:setup:end");
|
|
732
|
+
output = await this.safeBuild();
|
|
733
|
+
} catch (caughtError) {
|
|
734
|
+
if (signal?.aborted) throw caughtError;
|
|
735
|
+
output = {
|
|
736
|
+
files: [],
|
|
737
|
+
diagnostics: [Diagnostics.from(caughtError)]
|
|
738
|
+
};
|
|
735
739
|
}
|
|
740
|
+
const { files, diagnostics } = output;
|
|
741
|
+
const storage = this.storage;
|
|
742
|
+
signal?.throwIfAborted();
|
|
743
|
+
for (const diagnostic of diagnostics) if (Diagnostics.isProblem(diagnostic)) await Diagnostics.emit(hooks, diagnostic);
|
|
736
744
|
if (Diagnostics.hasError(diagnostics)) {
|
|
737
745
|
await hooks.callHook("kubb:generation:end", {
|
|
738
746
|
config,
|
|
@@ -873,7 +881,7 @@ function buildReport(result) {
|
|
|
873
881
|
name: config.name ?? "",
|
|
874
882
|
status,
|
|
875
883
|
plugins: {
|
|
876
|
-
passed: total - failed.length,
|
|
884
|
+
passed: status === "failed" && timings.length === 0 ? 0 : total - failed.length,
|
|
877
885
|
failed,
|
|
878
886
|
total
|
|
879
887
|
},
|
|
@@ -895,7 +903,12 @@ function buildReport(result) {
|
|
|
895
903
|
function formatSummary(report, { showTimings }) {
|
|
896
904
|
const { status, plugins, counts, filesCreated, durationMs, output, timings } = report;
|
|
897
905
|
const rows = [];
|
|
898
|
-
|
|
906
|
+
const notRun = plugins.total - plugins.passed - plugins.failed.length;
|
|
907
|
+
rows.push(["Plugins", status === "success" ? `${styleText("green", `${plugins.passed} passed`)} (${plugins.total})` : [
|
|
908
|
+
styleText("green", `${plugins.passed} passed`),
|
|
909
|
+
styleText("red", `${plugins.failed.length} failed`),
|
|
910
|
+
notRun > 0 ? styleText("dim", `${notRun} not run`) : void 0
|
|
911
|
+
].filter(Boolean).join(" | ") + ` (${plugins.total})`]);
|
|
899
912
|
if (status === "failed" && plugins.failed.length > 0) rows.push(["Failed", plugins.failed.map((name) => styleText("red", name)).join(", ")]);
|
|
900
913
|
if (counts.errors > 0 || counts.warnings > 0) {
|
|
901
914
|
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(" | ");
|
|
@@ -1011,7 +1024,7 @@ function buildProblemSection(diagnostics) {
|
|
|
1011
1024
|
return [
|
|
1012
1025
|
"## Problems",
|
|
1013
1026
|
"",
|
|
1014
|
-
problems.map((diagnostic) => Diagnostics.
|
|
1027
|
+
problems.map((diagnostic) => Diagnostics.format(diagnostic, { verbose: true }).join("\n")).join("\n\n")
|
|
1015
1028
|
];
|
|
1016
1029
|
}
|
|
1017
1030
|
/**
|