@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/README.md +1 -1
- package/dist/{KubbDriver-Dz36Klt9.js → KubbDriver-BX8mbluL.js} +54 -16
- package/dist/KubbDriver-BX8mbluL.js.map +1 -0
- package/dist/{KubbDriver-DQ7pt93q.cjs → KubbDriver-iAEw2oH5.cjs} +59 -15
- package/dist/KubbDriver-iAEw2oH5.cjs.map +1 -0
- package/dist/{createAdapter-BO_AxI05.d.ts → createAdapter-BpJYvJTw.d.ts} +110 -112
- package/dist/index.cjs +12 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +19 -3
- package/dist/index.js +12 -25
- 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/schemas/kubb-extension.json +18 -0
- package/dist/KubbDriver-DQ7pt93q.cjs.map +0 -1
- package/dist/KubbDriver-Dz36Klt9.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
|
|
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
|
-
/**
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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:
|
|
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
|