@kubb/core 5.0.0-alpha.9 → 5.0.0-beta.10
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 +13 -40
- package/dist/PluginDriver-Cu1Kj9S-.cjs +1075 -0
- package/dist/PluginDriver-Cu1Kj9S-.cjs.map +1 -0
- package/dist/PluginDriver-D8Z0Htid.js +978 -0
- package/dist/PluginDriver-D8Z0Htid.js.map +1 -0
- package/dist/createKubb-ALdb8lmq.d.ts +2082 -0
- package/dist/index.cjs +747 -1667
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +175 -269
- package/dist/index.js +734 -1638
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +145 -0
- package/dist/mocks.cjs.map +1 -0
- package/dist/mocks.d.ts +80 -0
- package/dist/mocks.js +140 -0
- package/dist/mocks.js.map +1 -0
- package/package.json +47 -60
- package/src/FileManager.ts +115 -0
- package/src/FileProcessor.ts +86 -0
- package/src/PluginDriver.ts +355 -561
- package/src/constants.ts +21 -48
- package/src/createAdapter.ts +88 -5
- package/src/createKubb.ts +1266 -0
- package/src/createRenderer.ts +57 -0
- package/src/createStorage.ts +13 -1
- package/src/defineGenerator.ts +160 -119
- package/src/defineLogger.ts +46 -5
- package/src/defineMiddleware.ts +62 -0
- package/src/defineParser.ts +44 -0
- package/src/definePlugin.ts +379 -0
- package/src/defineResolver.ts +548 -25
- package/src/devtools.ts +22 -15
- package/src/index.ts +13 -15
- package/src/mocks.ts +177 -0
- package/src/storages/fsStorage.ts +13 -8
- package/src/storages/memoryStorage.ts +4 -2
- package/src/types.ts +40 -547
- package/dist/PluginDriver-BkFepPdm.d.ts +0 -1054
- package/dist/chunk-ByKO4r7w.cjs +0 -38
- package/dist/hooks.cjs +0 -103
- package/dist/hooks.cjs.map +0 -1
- package/dist/hooks.d.ts +0 -77
- package/dist/hooks.js +0 -98
- package/dist/hooks.js.map +0 -1
- package/src/Kubb.ts +0 -224
- package/src/build.ts +0 -418
- package/src/config.ts +0 -56
- package/src/createPlugin.ts +0 -28
- package/src/hooks/index.ts +0 -4
- package/src/hooks/useKubb.ts +0 -143
- package/src/hooks/useMode.ts +0 -11
- package/src/hooks/usePlugin.ts +0 -11
- package/src/hooks/usePluginDriver.ts +0 -11
- package/src/utils/FunctionParams.ts +0 -155
- package/src/utils/TreeNode.ts +0 -215
- package/src/utils/diagnostics.ts +0 -15
- package/src/utils/executeStrategies.ts +0 -81
- package/src/utils/formatters.ts +0 -56
- package/src/utils/getBarrelFiles.ts +0 -141
- package/src/utils/getConfigs.ts +0 -12
- package/src/utils/linters.ts +0 -25
- package/src/utils/packageJSON.ts +0 -61
package/dist/index.d.ts
CHANGED
|
@@ -1,177 +1,191 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import { A as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { Fabric, KubbFile } from "@kubb/fabric-core/types";
|
|
2
|
+
import { $ as ResolverPathParams, A as isInputPath, B as KubbPluginSetupContext, C as KubbPluginsEndContext, D as PossibleConfig, E as KubbWarnContext, F as FileManager, G as Plugin, H as NormalizedPlugin, I as Exclude, J as ResolveBannerContext, K as PluginFactoryOptions, L as Group, M as GeneratorContext, N as defineGenerator, O as UserConfig, P as PluginDriver, Q as ResolverFileParams, R as Include, S as KubbLifecycleStartContext, T as KubbVersionNewContext, U as Output, V as KubbPluginStartContext, W as Override, X as Resolver, Y as ResolveOptionsContext, Z as ResolverContext, _ as KubbGenerationSummaryContext, _t as AdapterFactoryOptions, a as InputPath, at as Logger, b as KubbHooks, bt as logLevel, c as KubbBuildStartContext, ct as UserLogger, d as KubbErrorContext, dt as Storage, et as defineResolver, f as KubbFileProcessingUpdateContext, ft as createStorage, g as KubbGenerationStartContext, gt as Adapter, h as KubbGenerationEndContext, ht as createRenderer, i as InputData, it as defineMiddleware, j as Generator, k as createKubb, l as KubbConfigEndContext, lt as defineLogger, m as KubbFilesProcessingStartContext, mt as RendererFactory, n as CLIOptions, nt as defineParser, o as Kubb, ot as LoggerContext, p as KubbFilesProcessingEndContext, pt as Renderer, q as definePlugin, r as Config, rt as Middleware, s as KubbBuildEndContext, st as LoggerOptions, t as BuildOutput, tt as Parser, u as KubbDebugContext, ut as DevtoolsOptions, v as KubbHookEndContext, vt as AdapterSource, w as KubbSuccessContext, x as KubbInfoContext, xt as AsyncEventEmitter, y as KubbHookStartContext, yt as createAdapter, z as KubbPluginEndContext } from "./createKubb-ALdb8lmq.js";
|
|
3
|
+
import * as ast from "@kubb/ast";
|
|
4
|
+
import { FileNode } from "@kubb/ast";
|
|
6
5
|
|
|
7
|
-
//#region src/
|
|
8
|
-
type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
fabric: Fabric;
|
|
18
|
-
files: Array<KubbFile.ResolvedFile>;
|
|
19
|
-
driver: PluginDriver;
|
|
20
|
-
pluginTimings: Map<string, number>;
|
|
21
|
-
error?: Error;
|
|
22
|
-
sources: Map<KubbFile.Path, string>;
|
|
6
|
+
//#region ../../internals/utils/src/urlPath.d.ts
|
|
7
|
+
type URLObject = {
|
|
8
|
+
/**
|
|
9
|
+
* The resolved URL string (Express-style or template literal, depending on context).
|
|
10
|
+
*/
|
|
11
|
+
url: string;
|
|
12
|
+
/**
|
|
13
|
+
* Extracted path parameters as a key-value map, or `undefined` when the path has none.
|
|
14
|
+
*/
|
|
15
|
+
params?: Record<string, string>;
|
|
23
16
|
};
|
|
24
|
-
type
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
type ObjectOptions = {
|
|
18
|
+
/**
|
|
19
|
+
* Controls whether the `url` is rendered as an Express path or a template literal.
|
|
20
|
+
* @default 'path'
|
|
21
|
+
*/
|
|
22
|
+
type?: 'path' | 'template';
|
|
23
|
+
/**
|
|
24
|
+
* Optional transform applied to each extracted parameter name.
|
|
25
|
+
*/
|
|
26
|
+
replacer?: (pathParam: string) => string;
|
|
27
|
+
/**
|
|
28
|
+
* When `true`, the result is serialized to a string expression instead of a plain object.
|
|
29
|
+
*/
|
|
30
|
+
stringify?: boolean;
|
|
29
31
|
};
|
|
30
|
-
declare function setup(options: BuildOptions): Promise<SetupResult>;
|
|
31
|
-
declare function build(options: BuildOptions, overrides?: SetupResult): Promise<BuildOutput>;
|
|
32
|
-
declare function safeBuild(options: BuildOptions, overrides?: SetupResult): Promise<BuildOutput>;
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/config.d.ts
|
|
35
32
|
/**
|
|
36
|
-
*
|
|
33
|
+
* Supported identifier casing strategies for path parameters.
|
|
37
34
|
*/
|
|
38
|
-
type
|
|
39
|
-
|
|
40
|
-
watch?: boolean;
|
|
35
|
+
type PathCasing = 'camelcase';
|
|
36
|
+
type Options = {
|
|
41
37
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* - `silent`: hide non-essential logs
|
|
45
|
-
* - `info`: show general logs (non-plugin-related)
|
|
46
|
-
* - `debug`: include detailed plugin lifecycle logs
|
|
47
|
-
* @default 'silent'
|
|
38
|
+
* Casing strategy applied to path parameter names.
|
|
39
|
+
* @default undefined (original identifier preserved)
|
|
48
40
|
*/
|
|
49
|
-
|
|
50
|
-
bun?: boolean;
|
|
41
|
+
casing?: PathCasing;
|
|
51
42
|
};
|
|
52
|
-
/** All accepted forms of a Kubb configuration. */
|
|
53
|
-
type ConfigInput = PossiblePromise<UserConfig | UserConfig[]> | ((cli: CLIOptions) => PossiblePromise<UserConfig | UserConfig[]>);
|
|
54
|
-
/**
|
|
55
|
-
* Helper for defining a Kubb configuration.
|
|
56
|
-
*
|
|
57
|
-
* Accepts either:
|
|
58
|
-
* - A config object or array of configs
|
|
59
|
-
* - A function returning the config(s), optionally async,
|
|
60
|
-
* receiving the CLI options as argument
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* export default defineConfig(({ logLevel }) => ({
|
|
64
|
-
* root: 'src',
|
|
65
|
-
* plugins: [myPlugin()],
|
|
66
|
-
* }))
|
|
67
|
-
*/
|
|
68
|
-
declare function defineConfig(config: (cli: CLIOptions) => PossiblePromise<UserConfig | UserConfig[]>): typeof config;
|
|
69
|
-
declare function defineConfig(config: PossiblePromise<UserConfig | UserConfig[]>): typeof config;
|
|
70
|
-
/**
|
|
71
|
-
* Type guard to check if a given config has an `input.path`.
|
|
72
|
-
*/
|
|
73
|
-
declare function isInputPath(config: UserConfig | undefined): config is UserConfig<InputPath>;
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region src/createAdapter.d.ts
|
|
76
|
-
/**
|
|
77
|
-
* Builder type for an {@link Adapter} — takes options and returns the adapter instance.
|
|
78
|
-
*/
|
|
79
|
-
type AdapterBuilder<T extends AdapterFactoryOptions> = (options: T['options']) => Adapter<T>;
|
|
80
|
-
/**
|
|
81
|
-
* Creates an adapter factory. Call the returned function with optional options to get the adapter instance.
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* export const myAdapter = createAdapter<MyAdapter>((options) => {
|
|
85
|
-
* return {
|
|
86
|
-
* name: 'my-adapter',
|
|
87
|
-
* options,
|
|
88
|
-
* async parse(source) { ... },
|
|
89
|
-
* }
|
|
90
|
-
* })
|
|
91
|
-
*
|
|
92
|
-
* // instantiate
|
|
93
|
-
* const adapter = myAdapter({ validate: true })
|
|
94
|
-
*/
|
|
95
|
-
declare function createAdapter<T extends AdapterFactoryOptions = AdapterFactoryOptions>(build: AdapterBuilder<T>): (options?: T['options']) => Adapter<T>;
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region src/createPlugin.d.ts
|
|
98
|
-
/**
|
|
99
|
-
* Builder type for a {@link UserPluginWithLifeCycle} — takes options and returns the plugin instance.
|
|
100
|
-
*/
|
|
101
|
-
type PluginBuilder<T extends PluginFactoryOptions = PluginFactoryOptions> = (options: T['options']) => UserPluginWithLifeCycle<T>;
|
|
102
|
-
/**
|
|
103
|
-
* Creates a plugin factory. Call the returned function with optional options to get the plugin instance.
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* export const myPlugin = createPlugin<MyPlugin>((options) => {
|
|
107
|
-
* return {
|
|
108
|
-
* name: 'my-plugin',
|
|
109
|
-
* options,
|
|
110
|
-
* resolvePath(baseName) { ... },
|
|
111
|
-
* resolveName(name, type) { ... },
|
|
112
|
-
* }
|
|
113
|
-
* })
|
|
114
|
-
*
|
|
115
|
-
* // instantiate
|
|
116
|
-
* const plugin = myPlugin({ output: { path: 'src/gen' } })
|
|
117
|
-
*/
|
|
118
|
-
declare function createPlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(build: PluginBuilder<T>): (options?: T['options']) => UserPluginWithLifeCycle<T>;
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region src/defineLogger.d.ts
|
|
121
43
|
/**
|
|
122
|
-
*
|
|
44
|
+
* Parses and transforms an OpenAPI/Swagger path string into various URL formats.
|
|
123
45
|
*
|
|
124
46
|
* @example
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* context.on('info', (message) => console.log('ℹ', message))
|
|
129
|
-
* context.on('error', (error) => console.error('✗', error.message))
|
|
130
|
-
* },
|
|
131
|
-
* })
|
|
47
|
+
* const p = new URLPath('/pet/{petId}')
|
|
48
|
+
* p.URL // '/pet/:petId'
|
|
49
|
+
* p.template // '`/pet/${petId}`'
|
|
132
50
|
*/
|
|
133
|
-
declare
|
|
51
|
+
declare class URLPath {
|
|
52
|
+
#private;
|
|
53
|
+
/**
|
|
54
|
+
* The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.
|
|
55
|
+
*/
|
|
56
|
+
path: string;
|
|
57
|
+
constructor(path: string, options?: Options);
|
|
58
|
+
/** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* new URLPath('/pet/{petId}').URL // '/pet/:petId'
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
get URL(): string;
|
|
66
|
+
/** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* new URLPath('https://petstore.swagger.io/v2/pet').isURL // true
|
|
71
|
+
* new URLPath('/pet/{petId}').isURL // false
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
get isURL(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Converts the OpenAPI path to a TypeScript template literal string.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* new URLPath('/pet/{petId}').template // '`/pet/${petId}`'
|
|
80
|
+
* new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'
|
|
81
|
+
*/
|
|
82
|
+
get template(): string;
|
|
83
|
+
/** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* new URLPath('/pet/{petId}').object
|
|
88
|
+
* // { url: '/pet/:petId', params: { petId: 'petId' } }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
get object(): URLObject | string;
|
|
92
|
+
/** Returns a map of path parameter names, or `undefined` when the path has no parameters.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* new URLPath('/pet/{petId}').params // { petId: 'petId' }
|
|
97
|
+
* new URLPath('/pet').params // undefined
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
get params(): Record<string, string> | undefined;
|
|
101
|
+
toObject({
|
|
102
|
+
type,
|
|
103
|
+
replacer,
|
|
104
|
+
stringify
|
|
105
|
+
}?: ObjectOptions): URLObject | string;
|
|
106
|
+
/**
|
|
107
|
+
* Converts the OpenAPI path to a TypeScript template literal string.
|
|
108
|
+
* An optional `replacer` can transform each extracted parameter name before interpolation.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
|
|
112
|
+
*/
|
|
113
|
+
toTemplateString({
|
|
114
|
+
prefix,
|
|
115
|
+
replacer
|
|
116
|
+
}?: {
|
|
117
|
+
prefix?: string;
|
|
118
|
+
replacer?: (pathParam: string) => string;
|
|
119
|
+
}): string;
|
|
120
|
+
/**
|
|
121
|
+
* Extracts all `{param}` segments from the path and returns them as a key-value map.
|
|
122
|
+
* An optional `replacer` transforms each parameter name in both key and value positions.
|
|
123
|
+
* Returns `undefined` when no path parameters are found.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```ts
|
|
127
|
+
* new URLPath('/pet/{petId}/tag/{tagId}').getParams()
|
|
128
|
+
* // { petId: 'petId', tagId: 'tagId' }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined;
|
|
132
|
+
/** Converts the OpenAPI path to Express-style colon syntax.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
toURLPath(): string;
|
|
140
|
+
}
|
|
134
141
|
//#endregion
|
|
135
|
-
//#region src/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
type
|
|
141
|
-
/**
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
142
|
+
//#region src/FileProcessor.d.ts
|
|
143
|
+
type ParseOptions = {
|
|
144
|
+
parsers?: Map<FileNode['extname'], Parser>;
|
|
145
|
+
extension?: Record<FileNode['extname'], FileNode['extname'] | ''>;
|
|
146
|
+
};
|
|
147
|
+
type RunOptions = ParseOptions & {
|
|
148
|
+
/**
|
|
149
|
+
* @default 'sequential'
|
|
150
|
+
*/
|
|
151
|
+
mode?: 'sequential' | 'parallel';
|
|
152
|
+
onStart?: (files: Array<FileNode>) => Promise<void> | void;
|
|
153
|
+
onEnd?: (files: Array<FileNode>) => Promise<void> | void;
|
|
154
|
+
onUpdate?: (params: {
|
|
155
|
+
file: FileNode;
|
|
156
|
+
source?: string;
|
|
157
|
+
processed: number;
|
|
158
|
+
total: number;
|
|
159
|
+
percentage: number;
|
|
160
|
+
}) => Promise<void> | void;
|
|
161
|
+
};
|
|
151
162
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
163
|
+
* Converts a single file to a string using the registered parsers.
|
|
164
|
+
* Falls back to joining source values when no matching parser is found.
|
|
154
165
|
*
|
|
155
|
-
* @
|
|
156
|
-
* export const resolver = defineResolver<PluginTs>(() => ({
|
|
157
|
-
* resolveName(name) {
|
|
158
|
-
* return this.default(name, 'function')
|
|
159
|
-
* },
|
|
160
|
-
* resolveTypedName(name) {
|
|
161
|
-
* return this.default(name, 'type')
|
|
162
|
-
* },
|
|
163
|
-
* resolveParamName(node, param) {
|
|
164
|
-
* return this.resolveName(`${node.operationId} ${param.in} ${param.name}`)
|
|
165
|
-
* },
|
|
166
|
-
* }))
|
|
166
|
+
* @internal
|
|
167
167
|
*/
|
|
168
|
-
declare
|
|
168
|
+
declare class FileProcessor {
|
|
169
|
+
#private;
|
|
170
|
+
parse(file: FileNode, {
|
|
171
|
+
parsers,
|
|
172
|
+
extension
|
|
173
|
+
}?: ParseOptions): Promise<string>;
|
|
174
|
+
run(files: Array<FileNode>, {
|
|
175
|
+
parsers,
|
|
176
|
+
mode,
|
|
177
|
+
extension,
|
|
178
|
+
onStart,
|
|
179
|
+
onEnd,
|
|
180
|
+
onUpdate
|
|
181
|
+
}?: RunOptions): Promise<Array<FileNode>>;
|
|
182
|
+
}
|
|
169
183
|
//#endregion
|
|
170
184
|
//#region src/storages/fsStorage.d.ts
|
|
171
185
|
/**
|
|
172
186
|
* Built-in filesystem storage driver.
|
|
173
187
|
*
|
|
174
|
-
* This is the default storage when no `storage` option is configured in
|
|
188
|
+
* This is the default storage when no `storage` option is configured in the root config.
|
|
175
189
|
* Keys are resolved against `process.cwd()`, so root-relative paths such as
|
|
176
190
|
* `src/gen/api/getPets.ts` are written to the correct location without extra configuration.
|
|
177
191
|
*
|
|
@@ -183,11 +197,13 @@ declare function defineResolver<T extends PluginFactoryOptions>(build: ResolverB
|
|
|
183
197
|
*
|
|
184
198
|
* @example
|
|
185
199
|
* ```ts
|
|
186
|
-
* import {
|
|
200
|
+
* import { fsStorage } from '@kubb/core'
|
|
201
|
+
* import { defineConfig } from 'kubb'
|
|
187
202
|
*
|
|
188
203
|
* export default defineConfig({
|
|
189
204
|
* input: { path: './petStore.yaml' },
|
|
190
|
-
* output: { path: './src/gen'
|
|
205
|
+
* output: { path: './src/gen' },
|
|
206
|
+
* storage: fsStorage(),
|
|
191
207
|
* })
|
|
192
208
|
* ```
|
|
193
209
|
*/
|
|
@@ -203,127 +219,17 @@ declare const fsStorage: (options?: Record<string, never> | undefined) => Storag
|
|
|
203
219
|
*
|
|
204
220
|
* @example
|
|
205
221
|
* ```ts
|
|
206
|
-
* import {
|
|
222
|
+
* import { memoryStorage } from '@kubb/core'
|
|
223
|
+
* import { defineConfig } from 'kubb'
|
|
207
224
|
*
|
|
208
225
|
* export default defineConfig({
|
|
209
226
|
* input: { path: './petStore.yaml' },
|
|
210
|
-
* output: { path: './src/gen'
|
|
227
|
+
* output: { path: './src/gen' },
|
|
228
|
+
* storage: memoryStorage(),
|
|
211
229
|
* })
|
|
212
230
|
* ```
|
|
213
231
|
*/
|
|
214
232
|
declare const memoryStorage: (options?: Record<string, never> | undefined) => Storage;
|
|
215
233
|
//#endregion
|
|
216
|
-
|
|
217
|
-
type FunctionParamsASTWithoutType = {
|
|
218
|
-
name?: string;
|
|
219
|
-
type?: string;
|
|
220
|
-
/**
|
|
221
|
-
* @default true
|
|
222
|
-
*/
|
|
223
|
-
required?: boolean;
|
|
224
|
-
/**
|
|
225
|
-
* @default true
|
|
226
|
-
*/
|
|
227
|
-
enabled?: boolean;
|
|
228
|
-
default?: string;
|
|
229
|
-
};
|
|
230
|
-
type FunctionParamsASTWithType = {
|
|
231
|
-
name?: never;
|
|
232
|
-
type: string;
|
|
233
|
-
/**
|
|
234
|
-
* @default true
|
|
235
|
-
*/
|
|
236
|
-
required?: boolean;
|
|
237
|
-
/**
|
|
238
|
-
* @default true
|
|
239
|
-
*/
|
|
240
|
-
enabled?: boolean;
|
|
241
|
-
default?: string;
|
|
242
|
-
};
|
|
243
|
-
/**
|
|
244
|
-
* @deprecated
|
|
245
|
-
*/
|
|
246
|
-
type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType;
|
|
247
|
-
/**
|
|
248
|
-
* @deprecated
|
|
249
|
-
*/
|
|
250
|
-
declare class FunctionParams {
|
|
251
|
-
#private;
|
|
252
|
-
get items(): FunctionParamsAST[];
|
|
253
|
-
add(item: FunctionParamsAST | Array<FunctionParamsAST | FunctionParamsAST[] | undefined> | undefined): FunctionParams;
|
|
254
|
-
static toObject(items: FunctionParamsAST[]): FunctionParamsAST;
|
|
255
|
-
toObject(): FunctionParamsAST;
|
|
256
|
-
static toString(items: (FunctionParamsAST | FunctionParamsAST[])[]): string;
|
|
257
|
-
toString(): string;
|
|
258
|
-
}
|
|
259
|
-
//#endregion
|
|
260
|
-
//#region src/utils/formatters.d.ts
|
|
261
|
-
type Formatter = keyof typeof formatters;
|
|
262
|
-
/**
|
|
263
|
-
* Detect which formatter is available in the system.
|
|
264
|
-
*
|
|
265
|
-
* @returns Promise that resolves to the first available formatter or undefined if none are found
|
|
266
|
-
*
|
|
267
|
-
* @remarks
|
|
268
|
-
* Checks in order of preference: biome, oxfmt, prettier.
|
|
269
|
-
* Uses the `--version` flag to detect if each formatter command is available.
|
|
270
|
-
* This is a reliable method as all supported formatters implement this flag.
|
|
271
|
-
*
|
|
272
|
-
* @example
|
|
273
|
-
* ```typescript
|
|
274
|
-
* const formatter = await detectFormatter()
|
|
275
|
-
* if (formatter) {
|
|
276
|
-
* console.log(`Using ${formatter} for formatting`)
|
|
277
|
-
* } else {
|
|
278
|
-
* console.log('No formatter found')
|
|
279
|
-
* }
|
|
280
|
-
* ```
|
|
281
|
-
*/
|
|
282
|
-
declare function detectFormatter(): Promise<Formatter | undefined>;
|
|
283
|
-
//#endregion
|
|
284
|
-
//#region src/utils/getBarrelFiles.d.ts
|
|
285
|
-
type FileMetaBase = {
|
|
286
|
-
pluginName?: string;
|
|
287
|
-
};
|
|
288
|
-
type AddIndexesProps = {
|
|
289
|
-
type: BarrelType | false | undefined;
|
|
290
|
-
/**
|
|
291
|
-
* Root based on root and output.path specified in the config
|
|
292
|
-
*/
|
|
293
|
-
root: string;
|
|
294
|
-
/**
|
|
295
|
-
* Output for plugin
|
|
296
|
-
*/
|
|
297
|
-
output: {
|
|
298
|
-
path: string;
|
|
299
|
-
};
|
|
300
|
-
group?: {
|
|
301
|
-
output: string;
|
|
302
|
-
exportAs: string;
|
|
303
|
-
};
|
|
304
|
-
meta?: FileMetaBase;
|
|
305
|
-
};
|
|
306
|
-
declare function getBarrelFiles(files: Array<KubbFile.ResolvedFile>, {
|
|
307
|
-
type,
|
|
308
|
-
meta,
|
|
309
|
-
root,
|
|
310
|
-
output
|
|
311
|
-
}: AddIndexesProps): Promise<Array<KubbFile.File>>;
|
|
312
|
-
//#endregion
|
|
313
|
-
//#region src/utils/getConfigs.d.ts
|
|
314
|
-
/**
|
|
315
|
-
* Converting UserConfig to Config Array without a change in the object beside the JSON convert.
|
|
316
|
-
*/
|
|
317
|
-
declare function getConfigs(config: ConfigInput | UserConfig, args: CLIOptions): Promise<Array<Config>>;
|
|
318
|
-
//#endregion
|
|
319
|
-
//#region src/utils/linters.d.ts
|
|
320
|
-
type Linter = keyof typeof linters;
|
|
321
|
-
declare function detectLinter(): Promise<Linter | undefined>;
|
|
322
|
-
//#endregion
|
|
323
|
-
//#region src/utils/packageJSON.d.ts
|
|
324
|
-
type DependencyName = string;
|
|
325
|
-
type DependencyVersion = string;
|
|
326
|
-
declare function satisfiesDependency(dependency: DependencyName | RegExp, version: DependencyVersion, cwd?: string): boolean;
|
|
327
|
-
//#endregion
|
|
328
|
-
export { Adapter, AdapterFactoryOptions, AdapterSource, BarrelType, type CLIOptions, Config, type ConfigInput, CoreGeneratorV2, DevtoolsOptions, type FileMetaBase, FunctionParams, type FunctionParamsAST, Generator, Group, InputData, InputPath, KubbEvents, Logger, LoggerContext, LoggerOptions, Output, Plugin, PluginContext, PluginDriver, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginParameter, PluginWithLifeCycle, Printer, PrinterFactoryOptions, ReactGeneratorV2, ResolveNameParams, ResolveOptionsContext, ResolvePathParams, Resolver, Storage, UserConfig, UserLogger, UserPlugin, UserPluginWithLifeCycle, UserResolver, build, build as default, createAdapter, createPlugin, createStorage, defaultResolveOptions, defineConfig, defineGenerator, defineLogger, definePrinter, defineResolver, detectFormatter, detectLinter, formatters, fsStorage, getBarrelFiles, getConfigs, getMode, isInputPath, linters, logLevel, memoryStorage, safeBuild, satisfiesDependency, setup };
|
|
234
|
+
export { Adapter, AdapterFactoryOptions, AdapterSource, AsyncEventEmitter, BuildOutput, CLIOptions, Config, DevtoolsOptions, Exclude, FileManager, FileProcessor, Generator, GeneratorContext, Group, Include, InputData, InputPath, Kubb, KubbBuildEndContext, KubbBuildStartContext, KubbConfigEndContext, KubbDebugContext, KubbErrorContext, KubbFileProcessingUpdateContext, KubbFilesProcessingEndContext, KubbFilesProcessingStartContext, KubbGenerationEndContext, KubbGenerationStartContext, KubbGenerationSummaryContext, KubbHookEndContext, KubbHookStartContext, KubbHooks, KubbInfoContext, KubbLifecycleStartContext, KubbPluginEndContext, KubbPluginSetupContext, KubbPluginStartContext, KubbPluginsEndContext, KubbSuccessContext, KubbVersionNewContext, KubbWarnContext, Logger, LoggerContext, LoggerOptions, Middleware, NormalizedPlugin, Output, Override, Parser, Plugin, PluginDriver, PluginFactoryOptions, PossibleConfig, Renderer, RendererFactory, ResolveBannerContext, ResolveOptionsContext, Resolver, ResolverContext, ResolverFileParams, ResolverPathParams, Storage, URLPath, UserConfig, UserLogger, ast, createAdapter, createKubb, createRenderer, createStorage, defineGenerator, defineLogger, defineMiddleware, defineParser, definePlugin, defineResolver, fsStorage, isInputPath, logLevel, memoryStorage };
|
|
329
235
|
//# sourceMappingURL=index.d.ts.map
|