@kubb/core 5.6.3 → 5.7.0
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/{KubbDriver-CVFm4dwb.cjs → KubbDriver-BcoHguLM.cjs} +365 -59
- package/dist/KubbDriver-BcoHguLM.cjs.map +1 -0
- package/dist/{KubbDriver-BZBnKODj.js → KubbDriver-DRobnIcp.js} +282 -60
- package/dist/KubbDriver-DRobnIcp.js.map +1 -0
- package/dist/index.cjs +35 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +58 -3
- package/dist/index.js +23 -31
- 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/dist/{types-BjZ8hdyZ.d.ts → types-Cd91JYuu.d.ts} +178 -59
- package/package.json +4 -3
- package/dist/KubbDriver-BZBnKODj.js.map +0 -1
- package/dist/KubbDriver-CVFm4dwb.cjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import { $ as
|
|
3
|
-
import {
|
|
2
|
+
import { $ as OutputOptions, $t as SerializedDiagnostic, A as HookResult, At as resolveMeta, B as ParserDefinition, Bt as ReporterPluginFiles, C as KubbMessageContext, Ct as ResolverPathParams, D as PossibleConfig, Dt as ExtensionFactory, E as KubbWarnContext, Et as ExtensionDependencyRecord, F as defineGenerator, Ft as createStorage, G as Group, Gt as DiagnosticDoc, H as defineParser, Ht as createReporter, I as NodeCache, It as GenerationResult, J as KubbPluginSetupContext, Jt as DiagnosticSeverity, K as Include, Kt as DiagnosticKind, L as KubbDriver, Lt as Reporter, M as runHook, Mt as RendererFactory, N as Generator, Nt as createRenderer, O as PostGenerateCommand, Ot as ExtensionKind, P as GeneratorContext, Pt as Storage, Q as OutputMode, Qt as ProblemDiagnostic, R as FileManagerHooks, Rt as ReporterContext, S as KubbLifecycleStartContext, St as ResolverPatch, T as KubbSuccessContext, Tt as ExtensionDependency, U as Exclude, Ut as logLevel, V as ParserFactory, Vt as UserReporter, W as Filter, Wt as Diagnostic, X as NormalizedPlugin, Xt as PerformanceDiagnostic, Y as KubbPluginStartContext, Yt as Diagnostics, Z as Output, Zt as ProblemCode, _ as KubbHookEndContext, _t as Resolver, a as Input, an as createAdapter, at as PluginName, b as KubbHooks, bt as ResolverFileParams, c as KubbDiagnosticContext, ct as assertPluginOption, d as KubbFilesProcessingEndContext, dt as ResolveBannerContext, en as UpdateDiagnostic, et as Override, f as KubbFilesProcessingStartContext, ft as ResolveBannerFile, g as KubbGenerationSummaryContext, gt as ResolvePathOptions, h as KubbGenerationStartContext, ht as ResolveOptionsContext, i as FilesContext, in as AdapterSource, it as PluginFactoryOptions, j as RunHookOptions, jt as Renderer, k as UserConfig, kt as ExtensionMeta, l as KubbErrorContext, lt as definePlugin, m as KubbGenerationEndContext, mt as ResolveImportsOptions, n as CLIOptions, nn as Adapter, nt as PluginDefinition, o as KubbBuildEndContext, ot as PluginType, p as KubbFilesProcessingUpdateContext, pt as ResolveFileOptions, q as KubbPluginEndContext, qt as DiagnosticLocation, r as Config, rn as AdapterFactoryOptions, rt as PluginFactory, s as KubbBuildStartContext, st as ResolvePluginOptions, t as BuildOutput, tn as Hookable, tt as Plugin, u as KubbFileProcessingUpdate, ut as BannerMeta, v as KubbHookLineContext, vt as ResolverDefault, w as KubbPluginsEndContext, wt as ExtensionDependencies, x as KubbInfoContext, xt as ResolverFilePathParams, y as KubbHookStartContext, yt as ResolverFile, z as Parser, zt as ReporterName } from "./types-Cd91JYuu.js";
|
|
3
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
|
+
import { FileNode, Macro, UserFileNode } from "@kubb/ast";
|
|
4
5
|
//#region src/applyConfigDefaults.d.ts
|
|
5
6
|
type ApplyConfigDefaultsOptions<TOutput> = {
|
|
6
7
|
defaultAdapter: Adapter;
|
|
@@ -26,6 +27,60 @@ export declare function applyConfigDefaults<TOutput extends Config['output'] = C
|
|
|
26
27
|
plugins: Array<Plugin>;
|
|
27
28
|
};
|
|
28
29
|
//#endregion
|
|
30
|
+
//#region src/composables.d.ts
|
|
31
|
+
/**
|
|
32
|
+
* Holds the setup context of the plugin whose `setup` or `kubb:plugin:setup` is running. `KubbDriver` sets it for each plugin.
|
|
33
|
+
*/
|
|
34
|
+
export declare const kubbContext: AsyncLocalStorage<KubbPluginSetupContext>;
|
|
35
|
+
/**
|
|
36
|
+
* Returns the context of the plugin whose `kubb:plugin:setup` is running. It stays available after an `await`.
|
|
37
|
+
* Throws `KUBB_NO_CONTEXT` outside setup.
|
|
38
|
+
*/
|
|
39
|
+
export declare function useKubb<TFactory extends PluginFactoryOptions = PluginFactoryOptions>(): KubbPluginSetupContext<TFactory>;
|
|
40
|
+
/**
|
|
41
|
+
* Returns the same context as {@link useKubb}, or `undefined` outside `setup` and `kubb:plugin:setup`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function tryUseKubb<TFactory extends PluginFactoryOptions = PluginFactoryOptions>(): KubbPluginSetupContext<TFactory> | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Registers generators on the plugin being set up, like `ctx.addGenerator`.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* `addGenerator(typeGenerator, enumGenerator)`
|
|
49
|
+
*/
|
|
50
|
+
export declare function addGenerator<TFactory extends PluginFactoryOptions = PluginFactoryOptions, TElement = unknown>(...generators: Array<Generator<TFactory, TElement>>): void;
|
|
51
|
+
/**
|
|
52
|
+
* Sets the resolver of the plugin being set up, like `ctx.setResolver`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function setResolver<TResolver extends Resolver = Resolver>(resolver: ResolverPatch<TResolver> | TResolver): void;
|
|
55
|
+
/**
|
|
56
|
+
* Adds a macro to the plugin being set up, like `ctx.addMacro`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function addMacro(macro: Macro): void;
|
|
59
|
+
/**
|
|
60
|
+
* Replaces the macros of the plugin being set up, like `ctx.setMacros`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function setMacros(macros: ReadonlyArray<Macro>): void;
|
|
63
|
+
/**
|
|
64
|
+
* Adds a raw file to the build output, like `ctx.injectFile`.
|
|
65
|
+
*/
|
|
66
|
+
export declare function injectFile(file: UserFileNode): void;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the options the user passed to the plugin being set up, like `ctx.options`.
|
|
69
|
+
*/
|
|
70
|
+
export declare function useOptions<TFactory extends PluginFactoryOptions = PluginFactoryOptions>(): TFactory['options'];
|
|
71
|
+
/**
|
|
72
|
+
* Sets the resolved options of the plugin being set up, like `ctx.setOptions`.
|
|
73
|
+
*/
|
|
74
|
+
export declare function setOptions<TFactory extends PluginFactoryOptions = PluginFactoryOptions>(options: TFactory['resolvedOptions']): void;
|
|
75
|
+
/**
|
|
76
|
+
* Returns the resolved build configuration, like `ctx.config`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function useConfig(): Config;
|
|
79
|
+
/**
|
|
80
|
+
* Returns another plugin from the config, typed through `Kubb.PluginRegistry`, like `ctx.requirePlugin`.
|
|
81
|
+
*/
|
|
82
|
+
export declare function requirePlugin<TName extends PluginName>(name: TName): NormalizedPlugin<ResolvePluginOptions<TName>>;
|
|
83
|
+
//#endregion
|
|
29
84
|
//#region src/output/runOutputPasses.d.ts
|
|
30
85
|
type RunOutputPassesOptions = {
|
|
31
86
|
config: Config;
|
|
@@ -416,5 +471,5 @@ export declare function kubbStorage({ base }?: KubbStorageOptions): import("unst
|
|
|
416
471
|
*/
|
|
417
472
|
export declare const memoryStorage: (options?: Record<string, never> | undefined) => Storage;
|
|
418
473
|
//#endregion
|
|
419
|
-
export { type Adapter, 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 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 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 PerformanceDiagnostic, type Plugin, type PluginFactoryOptions, type PluginName, PossibleConfig, PostGenerateCommand, type ProblemCode, type ProblemDiagnostic, 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, createAdapter, createRenderer, createReporter, createStorage, defineGenerator, defineParser, definePlugin, logLevel, runHook };
|
|
474
|
+
export { type Adapter, 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 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 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 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, createAdapter, createRenderer, createReporter, createStorage, defineGenerator, defineParser, definePlugin, logLevel, resolveMeta, runHook };
|
|
420
475
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import {
|
|
2
|
+
import { A as clean, C as useConfig, D as formatMs, E as Diagnostics, F as write, I as toError, M as isPathInside, N as read, O as getElapsedMs, P as toPosixPath, S as tryUseKubb, T as useOptions, _ as kubbContext, a as _usingCtx, b as setOptions, c as Resolver, d as definePlugin, f as defineExtension, g as injectFile, h as addMacro, j as exists, k as inParallel, l as getInputKind, m as addGenerator, o as Hookable, p as resolveMeta, s as createResolver, t as KubbDriver, u as assertPluginOption, v as requirePlugin, w as useKubb, x as setResolver, y as setMacros } from "./KubbDriver-DRobnIcp.js";
|
|
3
3
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
4
4
|
import process$1 from "node:process";
|
|
5
5
|
import { x } from "tinyexec";
|
|
@@ -1295,35 +1295,27 @@ function defineGenerator(generator) {
|
|
|
1295
1295
|
}
|
|
1296
1296
|
//#endregion
|
|
1297
1297
|
//#region src/defineParser.ts
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
* print(...nodes) {
|
|
1320
|
-
* return nodes.map(String).join('\n')
|
|
1321
|
-
* },
|
|
1322
|
-
* }))
|
|
1323
|
-
* ```
|
|
1324
|
-
*/
|
|
1325
|
-
function defineParser(factory) {
|
|
1326
|
-
return (options) => factory(options ?? {});
|
|
1298
|
+
function defineParser(input) {
|
|
1299
|
+
if (typeof input === "function") return defineExtension({
|
|
1300
|
+
kind: "parser",
|
|
1301
|
+
build: (options) => {
|
|
1302
|
+
const parser = input(options);
|
|
1303
|
+
return {
|
|
1304
|
+
...parser,
|
|
1305
|
+
meta: resolveMeta(parser)
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
const { meta, setup } = input;
|
|
1310
|
+
return defineExtension({
|
|
1311
|
+
kind: "parser",
|
|
1312
|
+
meta,
|
|
1313
|
+
build: (options) => ({
|
|
1314
|
+
...setup(options),
|
|
1315
|
+
name: meta.name,
|
|
1316
|
+
meta
|
|
1317
|
+
})
|
|
1318
|
+
});
|
|
1327
1319
|
}
|
|
1328
1320
|
//#endregion
|
|
1329
1321
|
//#region src/storages/memoryStorage.ts
|
|
@@ -1376,6 +1368,6 @@ const memoryStorage = createStorage(() => {
|
|
|
1376
1368
|
};
|
|
1377
1369
|
});
|
|
1378
1370
|
//#endregion
|
|
1379
|
-
export { Diagnostics, Hookable, KubbDriver, Resolver, applyConfigDefaults, assertPluginOption, cacheStorage, cliReporter, createAdapter, createCliReporter, createKubb, createRenderer, createReporter, createResolver, createStorage, defineGenerator, defineParser, definePlugin, fileReporter, fsStorage, getInputKind, htmlReporter, jsonReporter, kubbStorage, logLevel, memoryStorage, resolveCacheDir, resolveKubbDir, runHook, runOutputPasses };
|
|
1371
|
+
export { Diagnostics, Hookable, KubbDriver, Resolver, addGenerator, addMacro, applyConfigDefaults, assertPluginOption, cacheStorage, cliReporter, createAdapter, createCliReporter, createKubb, createRenderer, createReporter, createResolver, createStorage, defineGenerator, defineParser, definePlugin, fileReporter, fsStorage, getInputKind, htmlReporter, injectFile, jsonReporter, kubbContext, kubbStorage, logLevel, memoryStorage, requirePlugin, resolveCacheDir, resolveKubbDir, resolveMeta, runHook, runOutputPasses, setMacros, setOptions, setResolver, tryUseKubb, useConfig, useKubb, useOptions };
|
|
1380
1372
|
|
|
1381
1373
|
//# sourceMappingURL=index.js.map
|