@kubb/core 5.8.1 → 5.8.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/README.md +1 -1
- package/dist/{KubbDriver-Dz36Klt9.js → KubbDriver-DBm4hRKA.js} +54 -16
- package/dist/KubbDriver-DBm4hRKA.js.map +1 -0
- package/dist/{KubbDriver-DQ7pt93q.cjs → KubbDriver-DxWuvJWV.cjs} +59 -15
- package/dist/KubbDriver-DxWuvJWV.cjs.map +1 -0
- package/dist/{createAdapter-BO_AxI05.d.ts → createAdapter-BpJYvJTw.d.ts} +110 -112
- package/dist/index.cjs +7 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -23
- 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/KubbDriver-DQ7pt93q.cjs.map +0 -1
- package/dist/KubbDriver-Dz36Klt9.js.map +0 -1
|
@@ -26,6 +26,78 @@ type PossiblePromise<T> = Promise<T> | T;
|
|
|
26
26
|
*/
|
|
27
27
|
type LiteralUnion<T extends Base, Base = string> = T | (Base & {});
|
|
28
28
|
//#endregion
|
|
29
|
+
//#region src/defineParser.d.ts
|
|
30
|
+
/**
|
|
31
|
+
* Converts a resolved {@link FileNode} into the final source string that gets
|
|
32
|
+
* written to disk. Kubb ships with TypeScript and TSX parsers. Add your own
|
|
33
|
+
* for new file types (JSON, Markdown, ...).
|
|
34
|
+
*/
|
|
35
|
+
type Parser<TMeta extends object = object, TNode = unknown, TOptions extends object = object> = ExtensionNamed & {
|
|
36
|
+
/**
|
|
37
|
+
* The options passed to the parser factory.
|
|
38
|
+
*/
|
|
39
|
+
options?: TOptions;
|
|
40
|
+
/**
|
|
41
|
+
* File extensions this parser handles. The driver registers the parser for each
|
|
42
|
+
* extension in this list. A parser with `undefined` here is not registered, so
|
|
43
|
+
* files of an unclaimed extension fall back to joining their sources verbatim.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* `['.ts', '.js']`
|
|
47
|
+
*/
|
|
48
|
+
extNames: Array<FileNode['extname']> | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Serialize the file's AST into source code.
|
|
51
|
+
*/
|
|
52
|
+
parse(file: FileNode<TMeta>): string;
|
|
53
|
+
/**
|
|
54
|
+
* Turn the content of a `copy` file into a file node that `parse` prints. Omit to copy the file verbatim.
|
|
55
|
+
*/
|
|
56
|
+
copy?(file: FileNode<TMeta>, source: string): UserFileNode<TMeta>;
|
|
57
|
+
/**
|
|
58
|
+
* Render compiler AST nodes for this parser's language into source text.
|
|
59
|
+
* Plugins call this to format the nodes they assemble before handing them
|
|
60
|
+
* back to the parser as `FileNode.sources`.
|
|
61
|
+
*/
|
|
62
|
+
print(...nodes: Array<TNode>): string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Takes the user's options and returns the parser methods.
|
|
66
|
+
*/
|
|
67
|
+
type ParserBuild<TOptions extends object, TMeta extends object, TNode> = (options: TOptions) => Omit<Parser<TMeta, TNode>, 'name' | 'meta' | 'options'>;
|
|
68
|
+
/**
|
|
69
|
+
* The object passed to `defineExtension` with `kind: 'parser'`. `build` receives the user's options and returns the parser methods.
|
|
70
|
+
*/
|
|
71
|
+
type ParserDefinition<TOptions extends object = object, TMeta extends object = object, TNode = unknown> = {
|
|
72
|
+
meta: ExtensionMeta;
|
|
73
|
+
} & ({
|
|
74
|
+
build: ParserBuild<TOptions, TMeta, TNode>;
|
|
75
|
+
} | {
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Renamed to `build`.
|
|
78
|
+
*/
|
|
79
|
+
setup: ParserBuild<TOptions, TMeta, TNode>;
|
|
80
|
+
});
|
|
81
|
+
/**
|
|
82
|
+
* The function `defineExtension` returns for a parser. Call it with user options to get a `Parser`.
|
|
83
|
+
*/
|
|
84
|
+
type ParserFactory<TOptions extends object = object, TMeta extends object = object, TNode = unknown> = ExtensionFactory<'parser', TOptions, Parser<TMeta, TNode, TOptions>>;
|
|
85
|
+
/**
|
|
86
|
+
* Defines a parser from one object and returns a factory that takes the user's options.
|
|
87
|
+
* Register the result in the `parsers` array on `defineConfig`.
|
|
88
|
+
*
|
|
89
|
+
* @deprecated Use `defineExtension` with `kind: 'parser'` instead.
|
|
90
|
+
*/
|
|
91
|
+
declare function defineParser<TOptions extends object = object, TMeta extends object = object, TNode = unknown>(definition: ParserDefinition<TOptions, TMeta, TNode>): ParserFactory<TOptions, TMeta, TNode>;
|
|
92
|
+
/**
|
|
93
|
+
* Wraps a factory function that returns a `Parser`. Without `meta`, the parser gets `{ name }`.
|
|
94
|
+
*
|
|
95
|
+
* @deprecated Pass a definition object with `kind: 'parser'`, `meta`, and `build` to `defineExtension` instead. The factory form is removed in the next major.
|
|
96
|
+
*/
|
|
97
|
+
declare function defineParser<TOptions extends object = object, TMeta extends object = object, TNode = unknown>(factory: (options: TOptions) => Parser<TMeta, TNode>): ((options?: TOptions) => Parser<TMeta, TNode>) & {
|
|
98
|
+
kind: 'parser';
|
|
99
|
+
};
|
|
100
|
+
//#endregion
|
|
29
101
|
//#region src/createRenderer.d.ts
|
|
30
102
|
/**
|
|
31
103
|
* Minimal interface any Kubb renderer must satisfy.
|
|
@@ -875,73 +947,6 @@ type Storage = {
|
|
|
875
947
|
*/
|
|
876
948
|
declare function createStorage<TOptions = Record<string, never>>(build: (options: TOptions) => Storage): (options?: TOptions) => Storage;
|
|
877
949
|
//#endregion
|
|
878
|
-
//#region src/defineParser.d.ts
|
|
879
|
-
/**
|
|
880
|
-
* Converts a resolved {@link FileNode} into the final source string that gets
|
|
881
|
-
* written to disk. Kubb ships with TypeScript and TSX parsers. Add your own
|
|
882
|
-
* for new file types (JSON, Markdown, ...).
|
|
883
|
-
*/
|
|
884
|
-
type Parser<TMeta extends object = object, TNode = unknown, TOptions extends object = object> = ExtensionNamed & {
|
|
885
|
-
/**
|
|
886
|
-
* The options passed to the parser factory.
|
|
887
|
-
*/
|
|
888
|
-
options?: TOptions;
|
|
889
|
-
/**
|
|
890
|
-
* File extensions this parser handles. The driver registers the parser for each
|
|
891
|
-
* extension in this list. A parser with `undefined` here is not registered, so
|
|
892
|
-
* files of an unclaimed extension fall back to joining their sources verbatim.
|
|
893
|
-
*
|
|
894
|
-
* @example
|
|
895
|
-
* `['.ts', '.js']`
|
|
896
|
-
*/
|
|
897
|
-
extNames: Array<FileNode['extname']> | undefined;
|
|
898
|
-
/**
|
|
899
|
-
* Serialize the file's AST into source code.
|
|
900
|
-
*/
|
|
901
|
-
parse(file: FileNode<TMeta>): string;
|
|
902
|
-
/**
|
|
903
|
-
* Turn the content of a `copy` file into a file node that `parse` prints. Omit to copy the file verbatim.
|
|
904
|
-
*/
|
|
905
|
-
copy?(file: FileNode<TMeta>, source: string): UserFileNode<TMeta>;
|
|
906
|
-
/**
|
|
907
|
-
* Render compiler AST nodes for this parser's language into source text.
|
|
908
|
-
* Plugins call this to format the nodes they assemble before handing them
|
|
909
|
-
* back to the parser as `FileNode.sources`.
|
|
910
|
-
*/
|
|
911
|
-
print(...nodes: Array<TNode>): string;
|
|
912
|
-
};
|
|
913
|
-
type ParserBuild<TOptions extends object, TMeta extends object, TNode> = (options: TOptions) => Omit<Parser<TMeta, TNode>, 'name' | 'meta' | 'options'>;
|
|
914
|
-
/**
|
|
915
|
-
* The object passed to `defineParser`. `build` receives the user's options and returns the parser methods.
|
|
916
|
-
*/
|
|
917
|
-
type ParserDefinition<TOptions extends object = object, TMeta extends object = object, TNode = unknown> = {
|
|
918
|
-
meta: ExtensionMeta;
|
|
919
|
-
} & ({
|
|
920
|
-
build: ParserBuild<TOptions, TMeta, TNode>;
|
|
921
|
-
} | {
|
|
922
|
-
/**
|
|
923
|
-
* @deprecated Renamed to `build`.
|
|
924
|
-
*/
|
|
925
|
-
setup: ParserBuild<TOptions, TMeta, TNode>;
|
|
926
|
-
});
|
|
927
|
-
/**
|
|
928
|
-
* The function `defineParser` returns. Call it with user options to get a `Parser`.
|
|
929
|
-
*/
|
|
930
|
-
type ParserFactory<TOptions extends object = object, TMeta extends object = object, TNode = unknown> = ExtensionFactory<'parser', TOptions, Parser<TMeta, TNode, TOptions>>;
|
|
931
|
-
/**
|
|
932
|
-
* Defines a parser from one object and returns a factory that takes the user's options.
|
|
933
|
-
* Register the result in the `parsers` array on `defineConfig`.
|
|
934
|
-
*/
|
|
935
|
-
declare function defineParser<TOptions extends object = object, TMeta extends object = object, TNode = unknown>(definition: ParserDefinition<TOptions, TMeta, TNode>): ParserFactory<TOptions, TMeta, TNode>;
|
|
936
|
-
/**
|
|
937
|
-
* Wraps a factory function that returns a `Parser`. Without `meta`, the parser gets `{ name }`.
|
|
938
|
-
*
|
|
939
|
-
* @deprecated Pass a definition object with `meta` and `build` instead. The factory form is removed in the next major.
|
|
940
|
-
*/
|
|
941
|
-
declare function defineParser<TOptions extends object = object, TMeta extends object = object, TNode = unknown>(factory: (options: TOptions) => Parser<TMeta, TNode>): ((options?: TOptions) => Parser<TMeta, TNode>) & {
|
|
942
|
-
kind: 'parser';
|
|
943
|
-
};
|
|
944
|
-
//#endregion
|
|
945
950
|
//#region src/outputManifest.d.ts
|
|
946
951
|
/**
|
|
947
952
|
* Remembers what the output passes did to each generated file, so the next run can tell "the
|
|
@@ -2680,7 +2685,7 @@ TResolver extends Resolver = Resolver> = {
|
|
|
2680
2685
|
resolver: TResolver;
|
|
2681
2686
|
};
|
|
2682
2687
|
/**
|
|
2683
|
-
* Type parameter for the object form of `
|
|
2688
|
+
* Type parameter for the object form of `defineExtension` with `kind: 'plugin'`. Same shape as `PluginFactoryOptions`.
|
|
2684
2689
|
*/
|
|
2685
2690
|
type PluginType<TName extends string = string, TOptions extends object = object, TResolvedOptions extends object = TOptions, TResolver extends Resolver = Resolver> = PluginFactoryOptions<TName, TOptions, TResolvedOptions, TResolver>;
|
|
2686
2691
|
/**
|
|
@@ -2741,7 +2746,7 @@ type KubbPluginSetupContext<TFactory extends PluginFactoryOptions = PluginFactor
|
|
|
2741
2746
|
options: TFactory['options'];
|
|
2742
2747
|
};
|
|
2743
2748
|
/**
|
|
2744
|
-
* A plugin object produced by `
|
|
2749
|
+
* A plugin object produced by `defineExtension`. Its lifecycle handlers live under a single
|
|
2745
2750
|
* `hooks` property rather than flat methods.
|
|
2746
2751
|
*/
|
|
2747
2752
|
type Plugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = ExtensionNamed & {
|
|
@@ -2777,14 +2782,14 @@ type Plugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = Exte
|
|
|
2777
2782
|
setup?(options: TFactory['options'], kubb: KubbPluginSetupContext<TFactory>): TFactory['resolvedOptions'] | Promise<TFactory['resolvedOptions']>;
|
|
2778
2783
|
};
|
|
2779
2784
|
/**
|
|
2780
|
-
* The object passed to `
|
|
2785
|
+
* The object passed to `defineExtension` with `kind: 'plugin'`.
|
|
2781
2786
|
*/
|
|
2782
2787
|
type PluginDefinition<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = Pick<Plugin<TFactory>, 'dependencies' | 'enforce' | 'setup'> & {
|
|
2783
2788
|
meta: ExtensionMeta<TFactory['name']>;
|
|
2784
2789
|
hooks?: Plugin<TFactory>['hooks'];
|
|
2785
2790
|
};
|
|
2786
2791
|
/**
|
|
2787
|
-
* The function `
|
|
2792
|
+
* The function `defineExtension` returns for a plugin. Call it with user options to get a `Plugin`.
|
|
2788
2793
|
*/
|
|
2789
2794
|
type PluginFactory<TFactory extends PluginFactoryOptions = PluginFactoryOptions> = ExtensionFactory<'plugin', TFactory['options'], Plugin<TFactory>, TFactory['name']>;
|
|
2790
2795
|
/**
|
|
@@ -2819,25 +2824,14 @@ type KubbPluginEndContext = FilesContext & {
|
|
|
2819
2824
|
};
|
|
2820
2825
|
/**
|
|
2821
2826
|
* Defines a plugin from one object and returns a factory that takes the user's options.
|
|
2822
|
-
* Name plugins `plugin-<feature>`.
|
|
2823
2827
|
*
|
|
2824
|
-
* @
|
|
2825
|
-
* ```ts
|
|
2826
|
-
* export const pluginZod = definePlugin<PluginZod>({
|
|
2827
|
-
* meta: { name: 'plugin-zod', compatibility: { kubb: '>=5.7.0' } },
|
|
2828
|
-
* dependencies: { 'plugin-ts': { optional: true } },
|
|
2829
|
-
* setup(options, kubb) {
|
|
2830
|
-
* kubb.addGenerator(zodGenerator)
|
|
2831
|
-
* return { ...options, inferred: options.inferred ?? false }
|
|
2832
|
-
* },
|
|
2833
|
-
* })
|
|
2834
|
-
* ```
|
|
2828
|
+
* @deprecated Use `defineExtension` with `kind: 'plugin'` instead.
|
|
2835
2829
|
*/
|
|
2836
2830
|
declare function definePlugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions>(definition: PluginDefinition<TFactory>): PluginFactory<TFactory>;
|
|
2837
2831
|
/**
|
|
2838
2832
|
* Wraps a factory function that returns a `Plugin`. Without `meta`, the plugin gets `{ name }`.
|
|
2839
2833
|
*
|
|
2840
|
-
* @deprecated Pass a definition object with `meta
|
|
2834
|
+
* @deprecated Pass a definition object with `kind: 'plugin'`, `meta`, and `setup` to `defineExtension` instead. The factory form is removed in the next major.
|
|
2841
2835
|
*/
|
|
2842
2836
|
declare function definePlugin<TFactory extends PluginFactoryOptions = PluginFactoryOptions>(factory: (options: TFactory['options']) => Plugin<TFactory>): ((options?: TFactory['options']) => Plugin<TFactory>) & {
|
|
2843
2837
|
kind: 'plugin';
|
|
@@ -2932,6 +2926,31 @@ type ExtensionFactory<TKind extends ExtensionKind, TOptions, TExtension, TName e
|
|
|
2932
2926
|
kind: TKind;
|
|
2933
2927
|
meta: ExtensionMeta<TName>;
|
|
2934
2928
|
};
|
|
2929
|
+
/**
|
|
2930
|
+
* Defines a parser and returns a factory that takes the user's options. `build` returns the parser methods.
|
|
2931
|
+
*/
|
|
2932
|
+
declare function defineExtension<TOptions extends object = object, TMeta extends object = object, TNode = unknown>(definition: {
|
|
2933
|
+
kind: 'parser';
|
|
2934
|
+
meta: ExtensionMeta;
|
|
2935
|
+
build: ParserBuild<TOptions, TMeta, TNode>;
|
|
2936
|
+
}): ParserFactory<TOptions, TMeta, TNode>;
|
|
2937
|
+
/**
|
|
2938
|
+
* Defines an adapter and returns a factory that takes the user's options. `parse` must return an `InputNode`.
|
|
2939
|
+
*/
|
|
2940
|
+
declare function defineExtension<T extends AdapterFactoryOptions = AdapterFactoryOptions>(definition: {
|
|
2941
|
+
kind: 'adapter';
|
|
2942
|
+
} & AdapterDefinition<T>): AdapterFactory<T>;
|
|
2943
|
+
/**
|
|
2944
|
+
* Defines a plugin and returns a factory that takes the user's options. Name plugins `plugin-<feature>`.
|
|
2945
|
+
*
|
|
2946
|
+
* @example
|
|
2947
|
+
* ```ts
|
|
2948
|
+
* defineExtension<PluginZod>({ kind: 'plugin', meta: { name: 'plugin-zod' }, setup: (options) => options })
|
|
2949
|
+
* ```
|
|
2950
|
+
*/
|
|
2951
|
+
declare function defineExtension<TFactory extends PluginFactoryOptions = PluginFactoryOptions>(definition: {
|
|
2952
|
+
kind: 'plugin';
|
|
2953
|
+
} & PluginDefinition<TFactory>): PluginFactory<TFactory>;
|
|
2935
2954
|
//#endregion
|
|
2936
2955
|
//#region src/createAdapter.d.ts
|
|
2937
2956
|
/**
|
|
@@ -2949,7 +2968,7 @@ type AdapterSource = {
|
|
|
2949
2968
|
data: string | unknown;
|
|
2950
2969
|
};
|
|
2951
2970
|
/**
|
|
2952
|
-
* Generic parameters used by `
|
|
2971
|
+
* Generic parameters used by `defineExtension` with `kind: 'adapter'` and the resulting `Adapter` type.
|
|
2953
2972
|
*
|
|
2954
2973
|
* - `TName`: unique adapter identifier (`'oas'`, `'asyncapi'`, ...).
|
|
2955
2974
|
* - `TOptions`: user-facing options accepted by the adapter factory.
|
|
@@ -3017,7 +3036,7 @@ type Adapter<TOptions extends AdapterFactoryOptions = AdapterFactoryOptions> = {
|
|
|
3017
3036
|
};
|
|
3018
3037
|
type AdapterBuilder<T extends AdapterFactoryOptions> = (options: T['options']) => Adapter<T>;
|
|
3019
3038
|
/**
|
|
3020
|
-
* The object passed to `
|
|
3039
|
+
* The object passed to `defineExtension` with `kind: 'adapter'`.
|
|
3021
3040
|
*/
|
|
3022
3041
|
type AdapterDefinition<T extends AdapterFactoryOptions = AdapterFactoryOptions> = {
|
|
3023
3042
|
meta: ExtensionMeta<T['name']>;
|
|
@@ -3032,7 +3051,7 @@ type AdapterDefinition<T extends AdapterFactoryOptions = AdapterFactoryOptions>
|
|
|
3032
3051
|
build(options: T['resolvedOptions']): Omit<Adapter<T>, 'name' | 'meta' | 'options'>;
|
|
3033
3052
|
};
|
|
3034
3053
|
/**
|
|
3035
|
-
* The function `
|
|
3054
|
+
* The function `defineExtension` returns for an adapter. Call it with user options to get an `Adapter`.
|
|
3036
3055
|
*/
|
|
3037
3056
|
type AdapterFactory<T extends AdapterFactoryOptions = AdapterFactoryOptions> = ExtensionFactory<'adapter', T['options'], Adapter<T>, T['name']>;
|
|
3038
3057
|
/**
|
|
@@ -3043,38 +3062,17 @@ type AdapterFactory<T extends AdapterFactoryOptions = AdapterFactoryOptions> = E
|
|
|
3043
3062
|
* Adapters must return an `InputNode` from `parse`. That node is what every
|
|
3044
3063
|
* plugin in the build consumes.
|
|
3045
3064
|
*
|
|
3046
|
-
* @
|
|
3047
|
-
* ```ts
|
|
3048
|
-
* import { createAdapter, type AdapterFactoryOptions } from '@kubb/core'
|
|
3049
|
-
* import { ast } from '@kubb/ast'
|
|
3050
|
-
*
|
|
3051
|
-
* type MyAdapter = AdapterFactoryOptions<'my-adapter', { validate?: boolean }, { validate: boolean }>
|
|
3052
|
-
*
|
|
3053
|
-
* export const myAdapter = createAdapter<MyAdapter>({
|
|
3054
|
-
* meta: { name: 'my-adapter', compatibility: { kubb: '>=5.7.0' } },
|
|
3055
|
-
* setup: (options) => ({ validate: options.validate ?? true }),
|
|
3056
|
-
* build: (options) => ({
|
|
3057
|
-
* document: null,
|
|
3058
|
-
* async parse(_source) {
|
|
3059
|
-
* // Convert the source (path or inline data) into an InputNode.
|
|
3060
|
-
* return ast.factory.createInput()
|
|
3061
|
-
* },
|
|
3062
|
-
* async validate() {
|
|
3063
|
-
* // Throw here when `options.validate` is set and the spec is invalid.
|
|
3064
|
-
* },
|
|
3065
|
-
* }),
|
|
3066
|
-
* })
|
|
3067
|
-
* ```
|
|
3065
|
+
* @deprecated Use `defineExtension` with `kind: 'adapter'` instead.
|
|
3068
3066
|
*/
|
|
3069
3067
|
declare function createAdapter<T extends AdapterFactoryOptions = AdapterFactoryOptions>(definition: AdapterDefinition<T>): AdapterFactory<T>;
|
|
3070
3068
|
/**
|
|
3071
3069
|
* Wraps a factory function that returns an `Adapter`.
|
|
3072
3070
|
*
|
|
3073
|
-
* @deprecated Pass a definition object with `meta
|
|
3071
|
+
* @deprecated Pass a definition object with `kind: 'adapter'`, `meta`, and `build` to `defineExtension` instead. The factory form is removed in the next major.
|
|
3074
3072
|
*/
|
|
3075
3073
|
declare function createAdapter<T extends AdapterFactoryOptions = AdapterFactoryOptions>(build: AdapterBuilder<T>): ((options?: T['options']) => Adapter<T>) & {
|
|
3076
3074
|
kind: 'adapter';
|
|
3077
3075
|
};
|
|
3078
3076
|
//#endregion
|
|
3079
|
-
export {
|
|
3080
|
-
//# sourceMappingURL=createAdapter-
|
|
3077
|
+
export { defineGenerator as $, ProblemDiagnostic as $t, PluginFactory as A, HookResult as At, ResolveFileOptions as B, ReporterName as Bt, NormalizedPlugin as C, KubbMessageContext as Ct, Override as D, PossibleConfig as Dt, OutputOptions as E, KubbWarnContext as Et, assertPluginOption as F, Storage as Ft, ResolverDefault as G, Diagnostic as Gt, ResolveOptionsContext as H, UserReporter as Ht, definePlugin as I, createStorage as It, ResolverFilePathParams as J, DiagnosticLocation as Jt, ResolverFile as K, DiagnosticDoc as Kt, BannerMeta as L, GenerationResult as Lt, PluginName as M, runHook as Mt, PluginType as N, KubbDriver as Nt, Plugin as O, PostGenerateCommand as Ot, ResolvePluginOptions as P, FileManagerHooks as Pt, GeneratorContext as Q, ProblemCode as Qt, ResolveBannerContext as R, Reporter as Rt, KubbPluginStartContext as S, KubbLifecycleStartContext as St, OutputMode as T, KubbSuccessContext as Tt, ResolvePathOptions as U, createReporter as Ut, ResolveImportsOptions as V, ReporterPluginFiles as Vt, Resolver as W, logLevel as Wt, ResolverPathParams as X, Diagnostics as Xt, ResolverPatch as Y, DiagnosticSeverity as Yt, Generator as Z, PerformanceDiagnostic as Zt, Filter as _, KubbHookEndContext as _t, AdapterSource as a, createRenderer as an, Input as at, KubbPluginEndContext as b, KubbHooks as bt, ExtensionDependency as c, ParserFactory as cn, KubbDiagnosticContext as ct, ExtensionKind as d, KubbFilesProcessingEndContext as dt, SerializedDiagnostic as en, NodeCache as et, ExtensionMeta as f, KubbFilesProcessingStartContext as ft, Exclude$1 as g, KubbGenerationSummaryContext as gt, resolveMeta as h, KubbGenerationStartContext as ht, AdapterFactoryOptions as i, RendererFactory as in, FilesContext as it, PluginFactoryOptions as j, RunHookOptions as jt, PluginDefinition as k, UserConfig as kt, ExtensionDependencyRecord as l, defineParser as ln, KubbErrorContext as lt, defineExtension as m, KubbGenerationEndContext as mt, AdapterDefinition as n, Hookable as nn, CLIOptions as nt, createAdapter as o, Parser as on, KubbBuildEndContext as ot, checkCompatibility as p, KubbFilesProcessingUpdateContext as pt, ResolverFileParams as q, DiagnosticKind as qt, AdapterFactory as r, Renderer as rn, Config as rt, ExtensionDependencies as s, ParserDefinition as sn, KubbBuildStartContext as st, Adapter as t, UpdateDiagnostic as tn, BuildOutput as tt, ExtensionFactory as u, KubbFileProcessingUpdate as ut, Group as v, KubbHookLineContext as vt, Output as w, KubbPluginsEndContext as wt, KubbPluginSetupContext as x, KubbInfoContext as xt, Include as y, KubbHookStartContext as yt, ResolveBannerFile as z, ReporterContext as zt };
|
|
3078
|
+
//# sourceMappingURL=createAdapter-BpJYvJTw.d.ts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_KubbDriver = require("./KubbDriver-
|
|
2
|
+
const require_KubbDriver = require("./KubbDriver-DxWuvJWV.cjs");
|
|
3
3
|
let verkit = require("verkit");
|
|
4
4
|
let node_util = require("node:util");
|
|
5
5
|
let node_process = require("node:process");
|
|
@@ -157,22 +157,13 @@ function tokenize(command) {
|
|
|
157
157
|
//#endregion
|
|
158
158
|
//#region src/createAdapter.ts
|
|
159
159
|
function createAdapter(input) {
|
|
160
|
-
if (typeof input === "function") return require_KubbDriver.
|
|
160
|
+
if (typeof input === "function") return require_KubbDriver.createExtensionFactory({
|
|
161
161
|
kind: "adapter",
|
|
162
162
|
build: (options) => input(options)
|
|
163
163
|
});
|
|
164
|
-
const { meta, setup, build } = input;
|
|
165
164
|
return require_KubbDriver.defineExtension({
|
|
166
165
|
kind: "adapter",
|
|
167
|
-
|
|
168
|
-
build: (raw) => {
|
|
169
|
-
const options = setup ? setup(raw) : raw;
|
|
170
|
-
return Object.assign(build(options), {
|
|
171
|
-
name: meta.name,
|
|
172
|
-
meta,
|
|
173
|
-
options
|
|
174
|
-
});
|
|
175
|
-
}
|
|
166
|
+
...input
|
|
176
167
|
});
|
|
177
168
|
}
|
|
178
169
|
//#endregion
|
|
@@ -1288,7 +1279,7 @@ function defineGenerator(generator) {
|
|
|
1288
1279
|
//#endregion
|
|
1289
1280
|
//#region src/defineParser.ts
|
|
1290
1281
|
function defineParser(input) {
|
|
1291
|
-
if (typeof input === "function") return require_KubbDriver.
|
|
1282
|
+
if (typeof input === "function") return require_KubbDriver.createExtensionFactory({
|
|
1292
1283
|
kind: "parser",
|
|
1293
1284
|
build: (options) => {
|
|
1294
1285
|
const parser = input(options);
|
|
@@ -1298,17 +1289,10 @@ function defineParser(input) {
|
|
|
1298
1289
|
};
|
|
1299
1290
|
}
|
|
1300
1291
|
});
|
|
1301
|
-
const { meta } = input;
|
|
1302
|
-
const build = "build" in input ? input.build : input.setup;
|
|
1303
1292
|
return require_KubbDriver.defineExtension({
|
|
1304
1293
|
kind: "parser",
|
|
1305
|
-
meta,
|
|
1306
|
-
build:
|
|
1307
|
-
...build(options),
|
|
1308
|
-
name: meta.name,
|
|
1309
|
-
meta,
|
|
1310
|
-
options
|
|
1311
|
-
})
|
|
1294
|
+
meta: input.meta,
|
|
1295
|
+
build: "build" in input ? input.build : input.setup
|
|
1312
1296
|
});
|
|
1313
1297
|
}
|
|
1314
1298
|
//#endregion
|
|
@@ -1492,6 +1476,7 @@ exports.createRenderer = createRenderer;
|
|
|
1492
1476
|
exports.createReporter = createReporter;
|
|
1493
1477
|
exports.createResolver = require_KubbDriver.createResolver;
|
|
1494
1478
|
exports.createStorage = createStorage;
|
|
1479
|
+
exports.defineExtension = require_KubbDriver.defineExtension;
|
|
1495
1480
|
exports.defineGenerator = defineGenerator;
|
|
1496
1481
|
exports.defineParser = defineParser;
|
|
1497
1482
|
exports.definePlugin = require_KubbDriver.definePlugin;
|