@kubb/core 5.6.2 → 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-BcoHguLM.cjs +3043 -0
- package/dist/KubbDriver-BcoHguLM.cjs.map +1 -0
- package/dist/KubbDriver-DRobnIcp.js +2784 -0
- package/dist/KubbDriver-DRobnIcp.js.map +1 -0
- package/dist/index.cjs +89 -1932
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +58 -3
- package/dist/index.js +35 -1891
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +35 -7
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.ts +6 -1
- package/dist/mocks.js +30 -3
- package/dist/mocks.js.map +1 -1
- package/dist/{types-B-w6zShf.d.ts → types-Cd91JYuu.d.ts} +192 -59
- package/package.json +4 -3
- package/dist/nodeCache-CllHsCcy.cjs +0 -805
- package/dist/nodeCache-CllHsCcy.cjs.map +0 -1
- package/dist/nodeCache-CumrOPh-.js +0 -685
- package/dist/nodeCache-CumrOPh-.js.map +0 -1
|
@@ -192,6 +192,18 @@ declare const diagnosticCode: {
|
|
|
192
192
|
* A required plugin is missing from the config.
|
|
193
193
|
*/
|
|
194
194
|
readonly pluginNotFound: "KUBB_PLUGIN_NOT_FOUND";
|
|
195
|
+
/**
|
|
196
|
+
* The running Kubb or Node.js version is outside a plugin's `meta.compatibility`.
|
|
197
|
+
*/
|
|
198
|
+
readonly incompatibleExtension: "KUBB_INCOMPATIBLE_EXTENSION";
|
|
199
|
+
/**
|
|
200
|
+
* A required entry in a plugin's `dependencies` record is missing from the config.
|
|
201
|
+
*/
|
|
202
|
+
readonly missingDependency: "KUBB_MISSING_DEPENDENCY";
|
|
203
|
+
/**
|
|
204
|
+
* A dependency's `meta.version` is outside the range a plugin's `dependencies` record declares.
|
|
205
|
+
*/
|
|
206
|
+
readonly incompatibleDependency: "KUBB_INCOMPATIBLE_DEPENDENCY";
|
|
195
207
|
/**
|
|
196
208
|
* A plugin threw while generating.
|
|
197
209
|
*/
|
|
@@ -204,6 +216,10 @@ declare const diagnosticCode: {
|
|
|
204
216
|
* A plugin reported an informational message through `ctx.info`.
|
|
205
217
|
*/
|
|
206
218
|
readonly pluginInfo: "KUBB_PLUGIN_INFO";
|
|
219
|
+
/**
|
|
220
|
+
* A `kubb/kit` composable was called outside a plugin's `setup` and `kubb:plugin:setup`.
|
|
221
|
+
*/
|
|
222
|
+
readonly noContext: "KUBB_NO_CONTEXT";
|
|
207
223
|
/**
|
|
208
224
|
* A schema uses a `format` Kubb does not map to a specific type. Reserved for
|
|
209
225
|
* adapters to emit as a `warning`.
|
|
@@ -535,9 +551,13 @@ declare class Diagnostics {
|
|
|
535
551
|
readonly refNotFound: "KUBB_REF_NOT_FOUND";
|
|
536
552
|
readonly invalidServerVariable: "KUBB_INVALID_SERVER_VARIABLE";
|
|
537
553
|
readonly pluginNotFound: "KUBB_PLUGIN_NOT_FOUND";
|
|
554
|
+
readonly incompatibleExtension: "KUBB_INCOMPATIBLE_EXTENSION";
|
|
555
|
+
readonly missingDependency: "KUBB_MISSING_DEPENDENCY";
|
|
556
|
+
readonly incompatibleDependency: "KUBB_INCOMPATIBLE_DEPENDENCY";
|
|
538
557
|
readonly pluginFailed: "KUBB_PLUGIN_FAILED";
|
|
539
558
|
readonly pluginWarning: "KUBB_PLUGIN_WARNING";
|
|
540
559
|
readonly pluginInfo: "KUBB_PLUGIN_INFO";
|
|
560
|
+
readonly noContext: "KUBB_NO_CONTEXT";
|
|
541
561
|
readonly unsupportedFormat: "KUBB_UNSUPPORTED_FORMAT";
|
|
542
562
|
readonly deprecated: "KUBB_DEPRECATED";
|
|
543
563
|
readonly adapterRequired: "KUBB_ADAPTER_REQUIRED";
|
|
@@ -968,6 +988,90 @@ type RendererFactory<TElement = unknown> = () => Renderer<TElement>;
|
|
|
968
988
|
*/
|
|
969
989
|
declare function createRenderer<TElement = unknown>(factory: RendererFactory<TElement>): RendererFactory<TElement>;
|
|
970
990
|
//#endregion
|
|
991
|
+
//#region src/defineExtension.d.ts
|
|
992
|
+
/**
|
|
993
|
+
* What an extension extends: a plugin generates code, an adapter reads the input, a parser prints files.
|
|
994
|
+
*/
|
|
995
|
+
type ExtensionKind = 'plugin' | 'adapter' | 'parser';
|
|
996
|
+
/**
|
|
997
|
+
* Identity and registry data for an extension. Kubb reads `name` and `compatibility` at runtime.
|
|
998
|
+
* Studio, the kubb.dev registry, and the docs read the rest.
|
|
999
|
+
*/
|
|
1000
|
+
type ExtensionMeta<TName extends string = string> = {
|
|
1001
|
+
/**
|
|
1002
|
+
* Unique name, such as `'plugin-ts'`. Becomes the plugin's `name`.
|
|
1003
|
+
*/
|
|
1004
|
+
name: TName;
|
|
1005
|
+
/**
|
|
1006
|
+
* Package version. Dependents check their `version` range against it.
|
|
1007
|
+
*/
|
|
1008
|
+
version?: string;
|
|
1009
|
+
displayName?: string;
|
|
1010
|
+
/**
|
|
1011
|
+
* One-sentence summary of what the extension generates or does.
|
|
1012
|
+
*/
|
|
1013
|
+
description?: string;
|
|
1014
|
+
category?: string;
|
|
1015
|
+
icon?: {
|
|
1016
|
+
light: string;
|
|
1017
|
+
dark?: string;
|
|
1018
|
+
};
|
|
1019
|
+
tags?: Array<string>;
|
|
1020
|
+
/**
|
|
1021
|
+
* Semver ranges the extension supports. A mismatch fails the run with `KUBB_INCOMPATIBLE_EXTENSION`.
|
|
1022
|
+
*/
|
|
1023
|
+
compatibility?: {
|
|
1024
|
+
kubb?: string;
|
|
1025
|
+
node?: string;
|
|
1026
|
+
};
|
|
1027
|
+
docs?: string;
|
|
1028
|
+
};
|
|
1029
|
+
/**
|
|
1030
|
+
* An extension's identity: `meta`, a `name`, or both. `name` is deprecated in favor of `meta.name`.
|
|
1031
|
+
*/
|
|
1032
|
+
type ExtensionNamed = {
|
|
1033
|
+
name?: string;
|
|
1034
|
+
meta?: ExtensionMeta;
|
|
1035
|
+
};
|
|
1036
|
+
/**
|
|
1037
|
+
* Returns `meta`, or `{ name }` for an extension that only sets the deprecated `name`. Throws `KUBB_INVALID_PLUGIN_OPTIONS` when it has neither.
|
|
1038
|
+
*/
|
|
1039
|
+
declare function resolveMeta({ name, meta }: ExtensionNamed): ExtensionMeta;
|
|
1040
|
+
/**
|
|
1041
|
+
* Sets how Kubb checks one entry in a `dependencies` record.
|
|
1042
|
+
*/
|
|
1043
|
+
type ExtensionDependency = {
|
|
1044
|
+
/**
|
|
1045
|
+
* Semver range the dependency's `meta.version` must satisfy. Skipped when the dependency has no `meta.version`.
|
|
1046
|
+
*/
|
|
1047
|
+
version?: string;
|
|
1048
|
+
/**
|
|
1049
|
+
* When `true`, Kubb skips the entry if the plugin is missing, but still checks `version` on an installed one.
|
|
1050
|
+
* Otherwise a missing plugin fails the run with `KUBB_MISSING_DEPENDENCY`.
|
|
1051
|
+
*/
|
|
1052
|
+
optional?: boolean;
|
|
1053
|
+
};
|
|
1054
|
+
/**
|
|
1055
|
+
* Plugins an extension builds on, keyed by name, or a function that picks them from the user's options.
|
|
1056
|
+
*/
|
|
1057
|
+
type ExtensionDependencies<TOptions = object> = ExtensionDependencyRecord | {
|
|
1058
|
+
resolve(options: TOptions, kubb: {
|
|
1059
|
+
config: Config;
|
|
1060
|
+
}): ExtensionDependencyRecord;
|
|
1061
|
+
}['resolve'];
|
|
1062
|
+
/**
|
|
1063
|
+
* Maps each dependency's plugin name to how Kubb checks it.
|
|
1064
|
+
*/
|
|
1065
|
+
type ExtensionDependencyRecord = Partial<Record<PluginName, ExtensionDependency>>;
|
|
1066
|
+
/**
|
|
1067
|
+
* The function an extension definition returns. Call it with user options to get the extension.
|
|
1068
|
+
*/
|
|
1069
|
+
type ExtensionFactory<TKind extends ExtensionKind, TOptions, TExtension, TName extends string = string> = {
|
|
1070
|
+
(options?: TOptions): TExtension;
|
|
1071
|
+
kind: TKind;
|
|
1072
|
+
meta: ExtensionMeta<TName>;
|
|
1073
|
+
};
|
|
1074
|
+
//#endregion
|
|
971
1075
|
//#region src/Resolver.d.ts
|
|
972
1076
|
/**
|
|
973
1077
|
* Context for resolving filtered options for a given operation or schema node.
|
|
@@ -1392,6 +1496,13 @@ type OutputOptions<TOutput extends Output = Output> = {
|
|
|
1392
1496
|
};
|
|
1393
1497
|
group?: never;
|
|
1394
1498
|
};
|
|
1499
|
+
/** Throws `KUBB_INVALID_PLUGIN_OPTIONS`, listing the allowed values, when `value` is not one of `allowed`. */
|
|
1500
|
+
declare function assertPluginOption({ plugin, option, value, allowed }: {
|
|
1501
|
+
plugin: string;
|
|
1502
|
+
option: string;
|
|
1503
|
+
value: unknown;
|
|
1504
|
+
allowed: ReadonlyArray<unknown>;
|
|
1505
|
+
}): void;
|
|
1395
1506
|
type ByTag = {
|
|
1396
1507
|
/**
|
|
1397
1508
|
* Filter by OpenAPI `tags` field. Matches one or more tags assigned to operations.
|
|
@@ -1534,6 +1645,10 @@ TResolver extends Resolver = Resolver> = {
|
|
|
1534
1645
|
resolvedOptions: TResolvedOptions;
|
|
1535
1646
|
resolver: TResolver;
|
|
1536
1647
|
};
|
|
1648
|
+
/**
|
|
1649
|
+
* Type parameter for the object form of `definePlugin`. Same shape as `PluginFactoryOptions`.
|
|
1650
|
+
*/
|
|
1651
|
+
type PluginType<TName extends string = string, TOptions extends object = object, TResolvedOptions extends object = TOptions, TResolver extends Resolver = Resolver> = PluginFactoryOptions<TName, TOptions, TResolvedOptions, TResolver>;
|
|
1537
1652
|
/**
|
|
1538
1653
|
* Context passed to a plugin's `kubb:plugin:setup` handler, where it registers generators and
|
|
1539
1654
|
* sets its resolver, transformer, and options.
|
|
@@ -1580,6 +1695,8 @@ type KubbPluginSetupContext<TFactory extends PluginFactoryOptions = PluginFactor
|
|
|
1580
1695
|
* generated folder, instead of building its content from `sources`.
|
|
1581
1696
|
*/
|
|
1582
1697
|
injectFile(userFileNode: UserFileNode): void;
|
|
1698
|
+
/** Returns a plugin this one needs, or fails the run with `KUBB_PLUGIN_NOT_FOUND` when the config lacks it. */
|
|
1699
|
+
requirePlugin<TName extends PluginName>(name: TName): Plugin<ResolvePluginOptions<TName>>;
|
|
1583
1700
|
/**
|
|
1584
1701
|
* The resolved build configuration at setup time.
|
|
1585
1702
|
*/
|
|
@@ -1593,16 +1710,12 @@ type KubbPluginSetupContext<TFactory extends PluginFactoryOptions = PluginFactor
|
|
|
1593
1710
|
* A plugin object produced by `definePlugin`. Its lifecycle handlers live under a single
|
|
1594
1711
|
* `hooks` property rather than flat methods.
|
|
1595
1712
|
*/
|
|
1596
|
-
type Plugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
1597
|
-
/**
|
|
1598
|
-
* Unique name for the plugin, following the same naming convention as `createPlugin`.
|
|
1599
|
-
*/
|
|
1600
|
-
name: string;
|
|
1713
|
+
type Plugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = ExtensionNamed & {
|
|
1601
1714
|
/**
|
|
1602
|
-
* Plugins
|
|
1603
|
-
*
|
|
1715
|
+
* Plugins this one builds on. They run first when the config has them. An array only orders
|
|
1716
|
+
* plugins. A record also fails the run when a required entry is missing or out of range.
|
|
1604
1717
|
*/
|
|
1605
|
-
dependencies?: Array<PluginName>;
|
|
1718
|
+
dependencies?: Array<PluginName> | ExtensionDependencies<TFactory['options']>;
|
|
1606
1719
|
/**
|
|
1607
1720
|
* Controls the execution order of this plugin relative to others.
|
|
1608
1721
|
*
|
|
@@ -1624,7 +1737,22 @@ type Plugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
1624
1737
|
hooks: { [K in keyof KubbHooks as K extends 'kubb:plugin:setup' ? never : K]?: (...args: KubbHooks[K]) => void | Promise<void>; } & {
|
|
1625
1738
|
'kubb:plugin:setup'?(ctx: KubbPluginSetupContext<TFactory>): void | Promise<void>;
|
|
1626
1739
|
};
|
|
1740
|
+
/**
|
|
1741
|
+
* Runs before `kubb:plugin:setup`. Takes the user's options and returns the resolved options.
|
|
1742
|
+
*/
|
|
1743
|
+
setup?(options: TFactory['options'], kubb: KubbPluginSetupContext<TFactory>): TFactory['resolvedOptions'] | Promise<TFactory['resolvedOptions']>;
|
|
1744
|
+
};
|
|
1745
|
+
/**
|
|
1746
|
+
* The object passed to `definePlugin`.
|
|
1747
|
+
*/
|
|
1748
|
+
type PluginDefinition<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = Pick<Plugin<TFactory>, 'dependencies' | 'enforce' | 'setup'> & {
|
|
1749
|
+
meta: ExtensionMeta<TFactory['name']>;
|
|
1750
|
+
hooks?: Plugin<TFactory>['hooks'];
|
|
1627
1751
|
};
|
|
1752
|
+
/**
|
|
1753
|
+
* The function `definePlugin` returns. Call it with user options to get a `Plugin`.
|
|
1754
|
+
*/
|
|
1755
|
+
type PluginFactory<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = ExtensionFactory<'plugin', TFactory['options'], Plugin<TFactory>, TFactory['name']>;
|
|
1628
1756
|
/**
|
|
1629
1757
|
* Normalized plugin after setup, with runtime fields populated. Internal only. Plugins use the
|
|
1630
1758
|
* public `Plugin` type.
|
|
@@ -1632,6 +1760,9 @@ type Plugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
1632
1760
|
* @internal
|
|
1633
1761
|
*/
|
|
1634
1762
|
type NormalizedPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & {
|
|
1763
|
+
name: string;
|
|
1764
|
+
meta: ExtensionMeta;
|
|
1765
|
+
dependencies?: Array<PluginName> | ExtensionDependencyRecord;
|
|
1635
1766
|
options: TOptions['resolvedOptions'] & {
|
|
1636
1767
|
output: Output;
|
|
1637
1768
|
include?: Array<Include>;
|
|
@@ -1653,28 +1784,30 @@ type KubbPluginEndContext = FilesContext & {
|
|
|
1653
1784
|
config: Config;
|
|
1654
1785
|
};
|
|
1655
1786
|
/**
|
|
1656
|
-
*
|
|
1657
|
-
*
|
|
1658
|
-
*
|
|
1659
|
-
* Pass a `PluginFactoryOptions` type parameter to get a typed `ctx` inside
|
|
1660
|
-
* `kubb:plugin:setup`. Plugin names should follow the `plugin-<feature>`
|
|
1661
|
-
* convention (`plugin-react-query`, `plugin-zod`, ...).
|
|
1787
|
+
* Defines a plugin from one object and returns a factory that takes the user's options.
|
|
1788
|
+
* Name plugins `plugin-<feature>`.
|
|
1662
1789
|
*
|
|
1663
1790
|
* @example
|
|
1664
1791
|
* ```ts
|
|
1665
|
-
*
|
|
1666
|
-
*
|
|
1667
|
-
*
|
|
1668
|
-
*
|
|
1669
|
-
*
|
|
1670
|
-
*
|
|
1671
|
-
* ctx.setResolver(resolverTs)
|
|
1672
|
-
* },
|
|
1792
|
+
* export const pluginZod = definePlugin<PluginZod>({
|
|
1793
|
+
* meta: { name: 'plugin-zod', compatibility: { kubb: '>=5.7.0' } },
|
|
1794
|
+
* dependencies: { 'plugin-ts': { optional: true } },
|
|
1795
|
+
* setup(options, kubb) {
|
|
1796
|
+
* kubb.addGenerator(zodGenerator)
|
|
1797
|
+
* return { ...options, inferred: options.inferred ?? false }
|
|
1673
1798
|
* },
|
|
1674
|
-
* })
|
|
1799
|
+
* })
|
|
1675
1800
|
* ```
|
|
1676
1801
|
*/
|
|
1677
|
-
declare function definePlugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions>(
|
|
1802
|
+
declare function definePlugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions>(definition: PluginDefinition<TFactory>): PluginFactory<TFactory>;
|
|
1803
|
+
/**
|
|
1804
|
+
* Wraps a factory function that returns a `Plugin`. Without `meta`, the plugin gets `{ name }`.
|
|
1805
|
+
*
|
|
1806
|
+
* @deprecated Pass a definition object with `meta` and `setup` instead. The factory form is removed in the next major.
|
|
1807
|
+
*/
|
|
1808
|
+
declare function definePlugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions>(factory: (options: TFactory['options']) => Plugin<TFactory>): ((options?: TFactory['options']) => Plugin<TFactory>) & {
|
|
1809
|
+
kind: 'plugin';
|
|
1810
|
+
};
|
|
1678
1811
|
//#endregion
|
|
1679
1812
|
//#region src/defineParser.d.ts
|
|
1680
1813
|
/**
|
|
@@ -1682,11 +1815,7 @@ declare function definePlugin<TFactory extends PluginFactoryOptions = PluginFact
|
|
|
1682
1815
|
* written to disk. Kubb ships with TypeScript and TSX parsers. Add your own
|
|
1683
1816
|
* for new file types (JSON, Markdown, ...).
|
|
1684
1817
|
*/
|
|
1685
|
-
type Parser<TMeta extends object = object, TNode = unknown> = {
|
|
1686
|
-
/**
|
|
1687
|
-
* Display name used in diagnostics and the parser registry.
|
|
1688
|
-
*/
|
|
1689
|
-
name: string;
|
|
1818
|
+
type Parser<TMeta extends object = object, TNode = unknown> = ExtensionNamed & {
|
|
1690
1819
|
/**
|
|
1691
1820
|
* File extensions this parser handles. The driver registers the parser for each
|
|
1692
1821
|
* extension in this list. A parser with `undefined` here is not registered, so
|
|
@@ -1712,33 +1841,29 @@ type Parser<TMeta extends object = object, TNode = unknown> = {
|
|
|
1712
1841
|
print(...nodes: Array<TNode>): string;
|
|
1713
1842
|
};
|
|
1714
1843
|
/**
|
|
1715
|
-
*
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
*
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
*
|
|
1844
|
+
* The object passed to `defineParser`. `setup` receives the user's options and returns the parser methods.
|
|
1845
|
+
*/
|
|
1846
|
+
type ParserDefinition<TOptions extends object = object, TMeta extends object = object, TNode = unknown> = {
|
|
1847
|
+
meta: ExtensionMeta;
|
|
1848
|
+
setup(options: TOptions): Omit<Parser<TMeta, TNode>, 'name' | 'meta'>;
|
|
1849
|
+
};
|
|
1850
|
+
/**
|
|
1851
|
+
* The function `defineParser` returns. Call it with user options to get a `Parser`.
|
|
1852
|
+
*/
|
|
1853
|
+
type ParserFactory<TOptions extends object = object, TMeta extends object = object, TNode = unknown> = ExtensionFactory<'parser', TOptions, Parser<TMeta, TNode>>;
|
|
1854
|
+
/**
|
|
1855
|
+
* Defines a parser from one object and returns a factory that takes the user's options.
|
|
1856
|
+
* Register the result in the `parsers` array on `defineConfig`.
|
|
1857
|
+
*/
|
|
1858
|
+
declare function defineParser<TOptions extends object = object, TMeta extends object = object, TNode = unknown>(definition: ParserDefinition<TOptions, TMeta, TNode>): ParserFactory<TOptions, TMeta, TNode>;
|
|
1859
|
+
/**
|
|
1860
|
+
* Wraps a factory function that returns a `Parser`. Without `meta`, the parser gets `{ name }`.
|
|
1727
1861
|
*
|
|
1728
|
-
*
|
|
1729
|
-
* name: 'json',
|
|
1730
|
-
* extNames: ['.json'],
|
|
1731
|
-
* parse(file) {
|
|
1732
|
-
* const source = file.sources.map((source) => extractStringsFromNodes(source.nodes ?? [])).join('\n')
|
|
1733
|
-
* return options.pretty ? JSON.stringify(JSON.parse(source), null, 2) : source
|
|
1734
|
-
* },
|
|
1735
|
-
* print(...nodes) {
|
|
1736
|
-
* return nodes.map(String).join('\n')
|
|
1737
|
-
* },
|
|
1738
|
-
* }))
|
|
1739
|
-
* ```
|
|
1862
|
+
* @deprecated Pass a definition object with `meta` and `setup` instead. The factory form is removed in the next major.
|
|
1740
1863
|
*/
|
|
1741
|
-
declare function defineParser<TOptions extends object = object, TMeta extends object = object, TNode = unknown>(factory: (options: TOptions) => Parser<TMeta, TNode>): (options?: TOptions) => Parser<TMeta, TNode
|
|
1864
|
+
declare function defineParser<TOptions extends object = object, TMeta extends object = object, TNode = unknown>(factory: (options: TOptions) => Parser<TMeta, TNode>): ((options?: TOptions) => Parser<TMeta, TNode>) & {
|
|
1865
|
+
kind: 'parser';
|
|
1866
|
+
};
|
|
1742
1867
|
//#endregion
|
|
1743
1868
|
//#region src/outputManifest.d.ts
|
|
1744
1869
|
/**
|
|
@@ -1859,6 +1984,11 @@ type Options = {
|
|
|
1859
1984
|
* Passed to `fileManager.write` so files the output passes already normalized are left alone.
|
|
1860
1985
|
*/
|
|
1861
1986
|
manifest?: OutputManifest;
|
|
1987
|
+
/**
|
|
1988
|
+
* The output directory `output.clean` empties. Emptied right before the files are written, so a
|
|
1989
|
+
* run that fails earlier leaves the previous output in place.
|
|
1990
|
+
*/
|
|
1991
|
+
cleanPath?: string;
|
|
1862
1992
|
};
|
|
1863
1993
|
type RequirePluginContext = {
|
|
1864
1994
|
/**
|
|
@@ -1885,7 +2015,7 @@ declare class KubbDriver {
|
|
|
1885
2015
|
readonly plugins: Map<string, NormalizedPlugin>;
|
|
1886
2016
|
constructor(config: Config, options: Options);
|
|
1887
2017
|
/**
|
|
1888
|
-
* Normalizes every configured plugin, orders them, and registers their lifecycle handlers.
|
|
2018
|
+
* Normalizes and checks every configured plugin, orders them, and registers their lifecycle handlers.
|
|
1889
2019
|
* A plugin that another lists as a dependency runs first, then `enforce: 'pre'` before
|
|
1890
2020
|
* `'post'`. When the config has an adapter, the adapter source is resolved from the input
|
|
1891
2021
|
* so `run` can parse it later.
|
|
@@ -1893,7 +2023,7 @@ declare class KubbDriver {
|
|
|
1893
2023
|
setup(): Promise<void>;
|
|
1894
2024
|
get hooks(): Hookable<Kubb.KubbHooksRegistry>;
|
|
1895
2025
|
/**
|
|
1896
|
-
* Runs each plugin's `kubb:plugin:setup` handler, in plugin order, with a context scoped to that
|
|
2026
|
+
* Runs each plugin's `setup` and `kubb:plugin:setup` handler, in plugin order, with a context scoped to that
|
|
1897
2027
|
* plugin so `addGenerator`, `setResolver`, `addMacro`, `setMacros`, and `setOptions` target its
|
|
1898
2028
|
* `NormalizedPlugin` entry. Called once from `run` before the plugin execution loop begins, so
|
|
1899
2029
|
* plugins can configure generators, resolvers, macros, and options before `buildStart`.
|
|
@@ -2020,7 +2150,10 @@ type GeneratorContext<TOptions extends PluginFactoryOptions = PluginFactoryOptio
|
|
|
2020
2150
|
/**
|
|
2021
2151
|
* The current plugin instance.
|
|
2022
2152
|
*/
|
|
2023
|
-
plugin: Plugin<TOptions
|
|
2153
|
+
plugin: Plugin<TOptions> & {
|
|
2154
|
+
name: string;
|
|
2155
|
+
meta: ExtensionMeta;
|
|
2156
|
+
};
|
|
2024
2157
|
/**
|
|
2025
2158
|
* The current plugin's resolver. It decides what every generated symbol and file path is
|
|
2026
2159
|
* called. Kubb picks a `setResolver` registration first, then the plugin's static
|
|
@@ -2896,5 +3029,5 @@ type BuildOutput = {
|
|
|
2896
3029
|
storage: Storage;
|
|
2897
3030
|
};
|
|
2898
3031
|
//#endregion
|
|
2899
|
-
export {
|
|
2900
|
-
//# sourceMappingURL=types-
|
|
3032
|
+
export { OutputOptions as $, SerializedDiagnostic as $t, HookResult as A, resolveMeta as At, ParserDefinition as B, ReporterPluginFiles as Bt, KubbMessageContext as C, ResolverPathParams as Ct, PossibleConfig as D, ExtensionFactory as Dt, KubbWarnContext as E, ExtensionDependencyRecord as Et, defineGenerator as F, createStorage as Ft, Group as G, DiagnosticDoc as Gt, defineParser as H, createReporter as Ht, NodeCache as I, GenerationResult as It, KubbPluginSetupContext as J, DiagnosticSeverity as Jt, Include as K, DiagnosticKind as Kt, KubbDriver as L, Reporter as Lt, runHook as M, RendererFactory as Mt, Generator as N, createRenderer as Nt, PostGenerateCommand as O, ExtensionKind as Ot, GeneratorContext as P, Storage as Pt, OutputMode as Q, ProblemDiagnostic as Qt, FileManagerHooks as R, ReporterContext as Rt, KubbLifecycleStartContext as S, ResolverPatch as St, KubbSuccessContext as T, ExtensionDependency as Tt, Exclude$1 as U, logLevel as Ut, ParserFactory as V, UserReporter as Vt, Filter as W, Diagnostic as Wt, NormalizedPlugin as X, PerformanceDiagnostic as Xt, KubbPluginStartContext as Y, Diagnostics as Yt, Output as Z, ProblemCode as Zt, KubbHookEndContext as _, Resolver as _t, Input as a, createAdapter as an, PluginName as at, KubbHooks as b, ResolverFileParams as bt, KubbDiagnosticContext as c, assertPluginOption as ct, KubbFilesProcessingEndContext as d, ResolveBannerContext as dt, UpdateDiagnostic as en, Override as et, KubbFilesProcessingStartContext as f, ResolveBannerFile as ft, KubbGenerationSummaryContext as g, ResolvePathOptions as gt, KubbGenerationStartContext as h, ResolveOptionsContext as ht, FilesContext as i, AdapterSource as in, PluginFactoryOptions as it, RunHookOptions as j, Renderer as jt, UserConfig as k, ExtensionMeta as kt, KubbErrorContext as l, definePlugin as lt, KubbGenerationEndContext as m, ResolveImportsOptions as mt, CLIOptions as n, Adapter as nn, PluginDefinition as nt, KubbBuildEndContext as o, PluginType as ot, KubbFilesProcessingUpdateContext as p, ResolveFileOptions as pt, KubbPluginEndContext as q, DiagnosticLocation as qt, Config as r, AdapterFactoryOptions as rn, PluginFactory as rt, KubbBuildStartContext as s, ResolvePluginOptions as st, BuildOutput as t, Hookable as tn, Plugin as tt, KubbFileProcessingUpdate as u, BannerMeta as ut, KubbHookLineContext as v, ResolverDefault as vt, KubbPluginsEndContext as w, ExtensionDependencies as wt, KubbInfoContext as x, ResolverFilePathParams as xt, KubbHookStartContext as y, ResolverFile as yt, Parser as z, ReporterName as zt };
|
|
3033
|
+
//# sourceMappingURL=types-Cd91JYuu.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.0",
|
|
4
4
|
"description": "Core engine for Kubb. Provides the plugin driver, file manager and build orchestration used by every Kubb plugin.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"code-generator",
|
|
@@ -72,9 +72,10 @@
|
|
|
72
72
|
"registry": "https://registry.npmjs.org/"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@kubb/ast": "5.
|
|
75
|
+
"@kubb/ast": "5.7.0",
|
|
76
76
|
"tinyexec": "^1.3.1",
|
|
77
|
-
"unstorage": "^1.17.5"
|
|
77
|
+
"unstorage": "^1.17.5",
|
|
78
|
+
"verkit": "^0.5.0"
|
|
78
79
|
},
|
|
79
80
|
"devDependencies": {
|
|
80
81
|
"@internals/utils": "0.0.1",
|