@kubb/core 5.8.1 → 5.8.3

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 NodeCache, $t as Diagnostics, A as PluginFactoryOptions, At as RunHookOptions, B as ResolveImportsOptions, Bt as GenerationResult, C as Output, Ct as KubbPluginsEndContext, D as Plugin, Dt as PostGenerateCommand, E as Override, Et as PossibleConfig, F as definePlugin, Ft as ParserDefinition, G as ResolverFile, Gt as UserReporter, H as ResolvePathOptions, Ht as ReporterContext, I as BannerMeta, It as ParserFactory, J as ResolverPatch, Jt as Diagnostic, K as ResolverFileParams, Kt as createReporter, L as ResolveBannerContext, Lt as defineParser, M as PluginType, Mt as KubbDriver, N as ResolvePluginOptions, Nt as FileManagerHooks, O as PluginDefinition, Ot as UserConfig, P as assertPluginOption, Pt as Parser, Q as defineGenerator, Qt as DiagnosticSeverity, R as ResolveBannerFile, Rt as Storage, S as NormalizedPlugin, St as KubbMessageContext, T as OutputOptions, Tt as KubbWarnContext, U as Resolver, Ut as ReporterName, V as ResolveOptionsContext, Vt as Reporter, W as ResolverDefault, Wt as ReporterPluginFiles, X as Generator, Xt as DiagnosticKind, Y as ResolverPathParams, Yt as DiagnosticDoc, Z as GeneratorContext, Zt as DiagnosticLocation, _ as Group, _t as KubbHookLineContext, a as AdapterSource, an as Hookable, at as KubbBuildEndContext, b as KubbPluginSetupContext, bt as KubbInfoContext, c as ExtensionDependency, cn as createRenderer, ct as KubbErrorContext, d as ExtensionKind, dt as KubbFilesProcessingStartContext, en as PerformanceDiagnostic, et as BuildOutput, f as ExtensionMeta, ft as KubbFilesProcessingUpdateContext, g as Filter, gt as KubbHookEndContext, h as Exclude, ht as KubbGenerationSummaryContext, i as AdapterFactoryOptions, in as UpdateDiagnostic, it as Input, j as PluginName, jt as runHook, k as PluginFactory, kt as HookResult, l as ExtensionDependencyRecord, lt as KubbFileProcessingUpdate, m as resolveMeta, mt as KubbGenerationStartContext, n as AdapterDefinition, nn as ProblemDiagnostic, nt as Config, o as createAdapter, on as Renderer, ot as KubbBuildStartContext, p as checkCompatibility, pt as KubbGenerationEndContext, q as ResolverFilePathParams, qt as logLevel, r as AdapterFactory, rn as SerializedDiagnostic, rt as FilesContext, s as ExtensionDependencies, sn as RendererFactory, st as KubbDiagnosticContext, t as Adapter, tn as ProblemCode, tt as CLIOptions, u as ExtensionFactory, ut as KubbFilesProcessingEndContext, v as Include, vt as KubbHookStartContext, w as OutputMode, wt as KubbSuccessContext, x as KubbPluginStartContext, xt as KubbLifecycleStartContext, y as KubbPluginEndContext, yt as KubbHooks, z as ResolveFileOptions, zt as createStorage } from "./createAdapter-BO_AxI05.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";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { FileNode, Macro, UserFileNode } from "@kubb/ast";
5
5
  //#region src/applyConfigDefaults.d.ts
@@ -529,6 +529,13 @@ type ExtensionManifest = {
529
529
  media?: Array<string>;
530
530
  tags?: Array<string>;
531
531
  docs?: string;
532
+ /** People who maintain the extension, shown on its kubb.dev page. */
533
+ maintainers?: Array<{
534
+ name: string;
535
+ github?: string;
536
+ }>;
537
+ /** Names of the extensions that must be in the same config, such as `['plugin-ts']`. */
538
+ dependencies?: Array<string>;
532
539
  compatibility?: {
533
540
  kubb?: string;
534
541
  node?: string;
@@ -568,9 +575,18 @@ type RegistryIndex = {
568
575
  generatedAt: string;
569
576
  extensions: Array<RegistryEntry>;
570
577
  };
571
- /** The registry's `<owner>/<slug>.json`: an entry plus its `OVERVIEW.md`. */
578
+ /** One `docs/guides/<id>.md`: `id` is the file name, `title` its `#` heading, `description` the first paragraph. */
579
+ type RegistryGuide = {
580
+ id: string;
581
+ title: string;
582
+ description: string;
583
+ content: string;
584
+ };
585
+ /** The registry's `<owner>/<slug>.json`: an entry plus the Markdown docs its pinned version ships. */
572
586
  type RegistryDetail = RegistryEntry & {
573
587
  overview: string | null;
588
+ options?: string | null;
589
+ guides?: Array<RegistryGuide>;
574
590
  };
575
591
  /**
576
592
  * Whether `name` is a valid npm package name, such as `@kubb/plugin-ts`. Rejects paths, URLs,
@@ -613,5 +629,5 @@ export declare function readInstalledPackages({ root, packages, resolveFrom }: {
613
629
  resolveFrom?: Array<string>;
614
630
  }): Promise<Array<InstalledPackage>>;
615
631
  //#endregion
616
- 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 RegistryDetail, type RegistryEntry, 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, defineGenerator, defineParser, definePlugin, logLevel, resolveMeta, runHook };
632
+ 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 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 };
617
633
  //# 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 inParallel, C as useOptions, D as Diagnostics, E as resolveMeta, F as toPosixPath, I as write, L as toError, M as exists, N as isPathInside, O as formatMs, P as read, S as useKubb, T as defineExtension, _ 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 clean, k as getElapsedMs, 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-Dz36Klt9.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-BX8mbluL.js";
3
3
  import { createRequire } from "node:module";
4
4
  import { isValid } from "verkit";
5
5
  import { stripVTControlCharacters, styleText } from "node:util";
@@ -154,22 +154,13 @@ function tokenize(command) {
154
154
  //#endregion
155
155
  //#region src/createAdapter.ts
156
156
  function createAdapter(input) {
157
- if (typeof input === "function") return defineExtension({
157
+ if (typeof input === "function") return createExtensionFactory({
158
158
  kind: "adapter",
159
159
  build: (options) => input(options)
160
160
  });
161
- const { meta, setup, build } = input;
162
161
  return defineExtension({
163
162
  kind: "adapter",
164
- meta,
165
- build: (raw) => {
166
- const options = setup ? setup(raw) : raw;
167
- return Object.assign(build(options), {
168
- name: meta.name,
169
- meta,
170
- options
171
- });
172
- }
163
+ ...input
173
164
  });
174
165
  }
175
166
  //#endregion
@@ -1285,7 +1276,7 @@ function defineGenerator(generator) {
1285
1276
  //#endregion
1286
1277
  //#region src/defineParser.ts
1287
1278
  function defineParser(input) {
1288
- if (typeof input === "function") return defineExtension({
1279
+ if (typeof input === "function") return createExtensionFactory({
1289
1280
  kind: "parser",
1290
1281
  build: (options) => {
1291
1282
  const parser = input(options);
@@ -1295,17 +1286,10 @@ function defineParser(input) {
1295
1286
  };
1296
1287
  }
1297
1288
  });
1298
- const { meta } = input;
1299
- const build = "build" in input ? input.build : input.setup;
1300
1289
  return defineExtension({
1301
1290
  kind: "parser",
1302
- meta,
1303
- build: (options) => ({
1304
- ...build(options),
1305
- name: meta.name,
1306
- meta,
1307
- options
1308
- })
1291
+ meta: input.meta,
1292
+ build: "build" in input ? input.build : input.setup
1309
1293
  });
1310
1294
  }
1311
1295
  //#endregion
@@ -1394,6 +1378,9 @@ const canonicalJSON = (value) => JSON.stringify(value, (_key, item) => isObject(
1394
1378
  function isPackageName(name) {
1395
1379
  return typeof name === "string" && name.length <= 214 && PACKAGE_NAME.test(name);
1396
1380
  }
1381
+ function isMaintainer(value) {
1382
+ return isObject(value) && Object.keys(value).every((key) => key === "name" || key === "github") && isFilledString(value.name) && (value.github === void 0 || isFilledString(value.github));
1383
+ }
1397
1384
  /** Checks the shape of one manifest option, including that its path cannot reach a prototype. */
1398
1385
  function isOption(value) {
1399
1386
  if (!isObject(value)) return false;
@@ -1421,8 +1408,8 @@ function manifestProblems({ options = [] }) {
1421
1408
  */
1422
1409
  function isExtensionManifest(value) {
1423
1410
  if (!isObject(value)) return false;
1424
- const { kind, name, export: exportName, displayName, description, compatibility, options } = value;
1425
- return EXTENSION_KINDS.has(kind) && isPackageName(name) && typeof exportName === "string" && IDENTIFIER.test(exportName) && typeof displayName === "string" && typeof description === "string" && (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;
1411
+ const { kind, name, export: exportName, displayName, description, maintainers, dependencies, compatibility, options } = value;
1412
+ 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;
1426
1413
  }
1427
1414
  /**
1428
1415
  * Checks one entry of a registry's `index.json` or `<owner>/<slug>.json`: a full `<owner>/<slug>` id,
@@ -1471,6 +1458,6 @@ async function readInstalledPackages({ root, packages = [], resolveFrom = [] })
1471
1458
  }));
1472
1459
  }
1473
1460
  //#endregion
1474
- export { Diagnostics, Hookable, KubbDriver, Resolver, addGenerator, addMacro, applyConfigDefaults, assertPluginOption, cacheStorage, checkCompatibility, cliReporter, createAdapter, createCliReporter, createKubb, createRenderer, createReporter, createResolver, createStorage, defineGenerator, defineParser, definePlugin, fileReporter, fsStorage, getInputKind, htmlReporter, injectFile, isExtensionManifest, isPackageName, isRegistryEntry, jsonReporter, kubbContext, kubbStorage, logLevel, manifestProblems, memoryStorage, readInstalledPackages, requirePlugin, resolveCacheDir, resolveKubbDir, resolveMeta, runHook, runOutputPasses, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions };
1461
+ export { Diagnostics, Hookable, KubbDriver, Resolver, addGenerator, addMacro, applyConfigDefaults, assertPluginOption, cacheStorage, checkCompatibility, cliReporter, createAdapter, createCliReporter, createKubb, createRenderer, createReporter, createResolver, createStorage, defineExtension, defineGenerator, defineParser, definePlugin, fileReporter, fsStorage, getInputKind, htmlReporter, injectFile, isExtensionManifest, isPackageName, isRegistryEntry, jsonReporter, kubbContext, kubbStorage, logLevel, manifestProblems, memoryStorage, readInstalledPackages, requirePlugin, resolveCacheDir, resolveKubbDir, resolveMeta, runHook, runOutputPasses, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions };
1475
1462
 
1476
1463
  //# sourceMappingURL=index.js.map