@kubb/core 5.0.0-alpha.31 → 5.0.0-alpha.32
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/{PluginDriver-D0dY_hpJ.d.ts → PluginDriver-nm7tvGs9.d.ts} +105 -196
- package/dist/chunk--u3MIqq1.js +8 -0
- package/dist/{chunk-MlS0t1Af.cjs → chunk-ByKO4r7w.cjs} +0 -15
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.ts +3 -3
- package/dist/hooks.js +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +339 -197
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +19 -21
- package/dist/index.js +342 -194
- package/dist/index.js.map +1 -1
- package/package.json +2 -4
- package/src/FileManager.ts +131 -0
- package/src/FileProcessor.ts +83 -0
- package/src/Kubb.ts +5 -5
- package/src/PluginDriver.ts +29 -24
- package/src/build.ts +89 -107
- package/src/constants.ts +7 -2
- package/src/defineGenerator.ts +12 -13
- package/src/defineParser.ts +4 -4
- package/src/defineResolver.ts +18 -19
- package/src/devtools.ts +14 -14
- package/src/hooks/useMode.ts +2 -3
- package/src/index.ts +0 -1
- package/src/renderNode.tsx +8 -7
- package/src/types.ts +42 -45
- package/src/utils/TreeNode.ts +7 -7
- package/src/utils/getBarrelFiles.ts +30 -25
- package/dist/chunk-O_arW02_.js +0 -17
- package/src/KubbFile.ts +0 -143
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as FunctionParams, A as Preset, B as Resolver, C as Plugin, D as PluginLifecycleHooks, E as PluginLifecycle, F as ResolveBannerContext, G as UserConfig, H as ResolverFileParams, I as ResolveNameParams, J as UserPlugin, K as UserGroup, L as ResolveOptionsContext, M as Printer, N as PrinterFactoryOptions, O as PluginParameter, P as PrinterPartial, Q as getBarrelFiles, R as ResolvePathOptions, S as Override, T as PluginFactoryOptions, U as ResolverPathParams, V as ResolverContext, W as SchemaHook, X as UserResolver, Y as UserPluginWithLifeCycle, Z as FileMetaBase, _ as LoggerContext,
|
|
1
|
+
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
+
import { $ as FunctionParams, A as Preset, B as Resolver, C as Plugin, D as PluginLifecycleHooks, E as PluginLifecycle, F as ResolveBannerContext, G as UserConfig, H as ResolverFileParams, I as ResolveNameParams, J as UserPlugin, K as UserGroup, L as ResolveOptionsContext, M as Printer, N as PrinterFactoryOptions, O as PluginParameter, P as PrinterPartial, Q as getBarrelFiles, R as ResolvePathOptions, S as Override, T as PluginFactoryOptions, U as ResolverPathParams, V as ResolverContext, W as SchemaHook, X as UserResolver, Y as UserPluginWithLifeCycle, Z as FileMetaBase, _ as LoggerContext, a as AdapterSource, at as Parser, b as OperationsHook, c as Config, ct as Generator, d as GeneratorContext, dt as Storage, et as FunctionParamsAST, f as Group, ft as createStorage, g as Logger, gt as AsyncEventEmitter, h as InputPath, ht as logLevel, i as AdapterFactoryOptions, it as KubbEvents, j as Presets, k as PluginWithLifeCycle, l as DevtoolsOptions, lt as defineGenerator, m as InputData, mt as linters, n as getMode, nt as ConfigInput, o as BarrelType, ot as UserParser, p as Include, pt as formatters, q as UserLogger, r as Adapter, rt as defineConfig, s as CompatibilityPreset, st as defineParser, t as PluginDriver, tt as CLIOptions, u as Exclude, ut as mergeGenerators, v as LoggerOptions, w as PluginContext, x as Output, y as OperationHook, z as ResolvePathParams } from "./PluginDriver-nm7tvGs9.js";
|
|
3
3
|
import { composeTransformers, definePrinter } from "@kubb/ast";
|
|
4
|
-
import {
|
|
5
|
-
import { Fabric } from "@kubb/fabric-core/types";
|
|
4
|
+
import { FileNode, InputNode, Node, Visitor } from "@kubb/ast/types";
|
|
6
5
|
|
|
7
6
|
//#region ../../internals/utils/src/urlPath.d.ts
|
|
8
7
|
type URLObject = {
|
|
@@ -156,8 +155,7 @@ type BuildOutput = {
|
|
|
156
155
|
plugin: Plugin;
|
|
157
156
|
error: Error;
|
|
158
157
|
}>;
|
|
159
|
-
|
|
160
|
-
files: Array<ResolvedFile>;
|
|
158
|
+
files: Array<FileNode>;
|
|
161
159
|
driver: PluginDriver;
|
|
162
160
|
/**
|
|
163
161
|
* Elapsed time in milliseconds for each plugin, keyed by plugin name.
|
|
@@ -167,17 +165,17 @@ type BuildOutput = {
|
|
|
167
165
|
/**
|
|
168
166
|
* Raw generated source, keyed by absolute file path.
|
|
169
167
|
*/
|
|
170
|
-
sources: Map<
|
|
168
|
+
sources: Map<string, string>;
|
|
171
169
|
};
|
|
172
170
|
/**
|
|
173
171
|
* Intermediate result returned by {@link setup} and accepted by {@link safeBuild}.
|
|
174
172
|
*/
|
|
175
173
|
type SetupResult = {
|
|
176
174
|
events: AsyncEventEmitter<KubbEvents>;
|
|
177
|
-
fabric: Fabric;
|
|
178
175
|
driver: PluginDriver;
|
|
179
|
-
sources: Map<
|
|
176
|
+
sources: Map<string, string>;
|
|
180
177
|
config: Config;
|
|
178
|
+
storage: Storage | null;
|
|
181
179
|
};
|
|
182
180
|
/**
|
|
183
181
|
* Initializes all Kubb infrastructure for a build without executing any plugins.
|
|
@@ -185,7 +183,7 @@ type SetupResult = {
|
|
|
185
183
|
* - Validates the input path (when applicable).
|
|
186
184
|
* - Applies config defaults (`root`, `output.*`, `devtools`).
|
|
187
185
|
* - Creates the Fabric instance and wires storage, format, and lint hooks.
|
|
188
|
-
* - Runs the adapter (if configured) to produce the universal `
|
|
186
|
+
* - Runs the adapter (if configured) to produce the universal `InputNode`.
|
|
189
187
|
* When no adapter is supplied and `@kubb/adapter-oas` is installed as an
|
|
190
188
|
*
|
|
191
189
|
* Pass the returned {@link SetupResult} directly to {@link safeBuild} or {@link build}
|
|
@@ -204,7 +202,7 @@ declare function build(options: BuildOptions, overrides?: SetupResult): Promise<
|
|
|
204
202
|
*
|
|
205
203
|
* - Installs each plugin in order, recording failures in `failedPlugins`.
|
|
206
204
|
* - Generates the root barrel file when `output.barrelType` is set.
|
|
207
|
-
* - Writes all files through
|
|
205
|
+
* - Writes all files through the driver's FileManager and FileProcessor.
|
|
208
206
|
*
|
|
209
207
|
* Returns a {@link BuildOutput} even on failure — inspect `error` and
|
|
210
208
|
* `failedPlugins` to determine whether the build succeeded.
|
|
@@ -380,11 +378,11 @@ declare function defaultResolvePath({
|
|
|
380
378
|
root,
|
|
381
379
|
output,
|
|
382
380
|
group
|
|
383
|
-
}: ResolverContext):
|
|
381
|
+
}: ResolverContext): string;
|
|
384
382
|
/**
|
|
385
383
|
* Default file resolver used by `defineResolver`.
|
|
386
384
|
*
|
|
387
|
-
* Resolves a `
|
|
385
|
+
* Resolves a `FileNode` by combining name resolution (`resolver.default`) with
|
|
388
386
|
* path resolution (`resolver.resolvePath`). The resolved file always has empty
|
|
389
387
|
* `sources`, `imports`, and `exports` arrays — consumers populate those separately.
|
|
390
388
|
*
|
|
@@ -413,7 +411,7 @@ declare function defaultResolveFile(this: Resolver, {
|
|
|
413
411
|
extname,
|
|
414
412
|
tag,
|
|
415
413
|
path: groupPath
|
|
416
|
-
}: ResolverFileParams, context: ResolverContext):
|
|
414
|
+
}: ResolverFileParams, context: ResolverContext): FileNode;
|
|
417
415
|
/**
|
|
418
416
|
* Generates the default "Generated by Kubb" banner from config and optional node metadata.
|
|
419
417
|
*/
|
|
@@ -449,13 +447,13 @@ declare function buildDefaultBanner({
|
|
|
449
447
|
*
|
|
450
448
|
* @example Function banner with node
|
|
451
449
|
* ```ts
|
|
452
|
-
* defaultResolveBanner(
|
|
450
|
+
* defaultResolveBanner(inputNode, { output: { banner: (node) => `// v${node.version}` }, config })
|
|
453
451
|
* // → '// v3.0.0'
|
|
454
452
|
* ```
|
|
455
453
|
*
|
|
456
454
|
* @example No user banner — Kubb notice with OAS metadata
|
|
457
455
|
* ```ts
|
|
458
|
-
* defaultResolveBanner(
|
|
456
|
+
* defaultResolveBanner(inputNode, { config })
|
|
459
457
|
* // → '/** Generated by Kubb ... Title: Pet Store ... *\/'
|
|
460
458
|
* ```
|
|
461
459
|
*
|
|
@@ -465,7 +463,7 @@ declare function buildDefaultBanner({
|
|
|
465
463
|
* // → undefined
|
|
466
464
|
* ```
|
|
467
465
|
*/
|
|
468
|
-
declare function defaultResolveBanner(node:
|
|
466
|
+
declare function defaultResolveBanner(node: InputNode | undefined, {
|
|
469
467
|
output,
|
|
470
468
|
config
|
|
471
469
|
}: ResolveBannerContext): string | undefined;
|
|
@@ -485,11 +483,11 @@ declare function defaultResolveBanner(node: RootNode | undefined, {
|
|
|
485
483
|
*
|
|
486
484
|
* @example Function footer with node
|
|
487
485
|
* ```ts
|
|
488
|
-
* defaultResolveFooter(
|
|
486
|
+
* defaultResolveFooter(inputNode, { output: { footer: (node) => `// ${node.title}` }, config })
|
|
489
487
|
* // → '// Pet Store'
|
|
490
488
|
* ```
|
|
491
489
|
*/
|
|
492
|
-
declare function defaultResolveFooter(node:
|
|
490
|
+
declare function defaultResolveFooter(node: InputNode | undefined, {
|
|
493
491
|
output
|
|
494
492
|
}: ResolveBannerContext): string | undefined;
|
|
495
493
|
/**
|
|
@@ -500,7 +498,7 @@ declare function defaultResolveFooter(node: RootNode | undefined, {
|
|
|
500
498
|
* - `default` — name casing strategy (camelCase / PascalCase)
|
|
501
499
|
* - `resolveOptions` — include/exclude/override filtering
|
|
502
500
|
* - `resolvePath` — output path computation
|
|
503
|
-
* - `resolveFile` — full `
|
|
501
|
+
* - `resolveFile` — full `FileNode` construction
|
|
504
502
|
*
|
|
505
503
|
* Methods in the builder have access to `this` (the full resolver object), so they
|
|
506
504
|
* can call other resolver methods without circular imports.
|
|
@@ -692,5 +690,5 @@ type DependencyVersion = string;
|
|
|
692
690
|
*/
|
|
693
691
|
declare function satisfiesDependency(dependency: DependencyName | RegExp, version: DependencyVersion, cwd?: string): boolean;
|
|
694
692
|
//#endregion
|
|
695
|
-
export { Adapter, AdapterFactoryOptions, AdapterSource, AsyncEventEmitter, BarrelType, CLIOptions, CompatibilityPreset, Config, ConfigInput, DevtoolsOptions, Exclude, FileMetaBase, FunctionParams, FunctionParamsAST, Generator, GeneratorContext, Group, Include, InputData, InputPath, KubbEvents,
|
|
693
|
+
export { Adapter, AdapterFactoryOptions, AdapterSource, AsyncEventEmitter, BarrelType, CLIOptions, CompatibilityPreset, Config, ConfigInput, DevtoolsOptions, Exclude, FileMetaBase, FunctionParams, FunctionParamsAST, Generator, GeneratorContext, Group, Include, InputData, InputPath, KubbEvents, Logger, LoggerContext, LoggerOptions, OperationHook, OperationsHook, Output, Override, Parser, Plugin, PluginContext, PluginDriver, PluginFactoryOptions, PluginLifecycle, PluginLifecycleHooks, PluginParameter, PluginWithLifeCycle, Preset, Presets, Printer, PrinterFactoryOptions, PrinterPartial, ResolveBannerContext, ResolveNameParams, ResolveOptionsContext, ResolvePathOptions, ResolvePathParams, Resolver, ResolverContext, ResolverFileParams, ResolverPathParams, SchemaHook, Storage, URLPath, UserConfig, UserGroup, UserLogger, UserParser, UserPlugin, UserPluginWithLifeCycle, UserResolver, build, build as default, buildDefaultBanner, composeTransformers, createAdapter, createPlugin, createStorage, defaultResolveBanner, defaultResolveFile, defaultResolveFooter, defaultResolveOptions, defaultResolvePath, defineConfig, defineGenerator, defineLogger, defineParser, definePresets, definePrinter, defineResolver, detectFormatter, detectLinter, formatters, fsStorage, getBarrelFiles, getConfigs, getMode, getPreset, isInputPath, linters, logLevel, memoryStorage, mergeGenerators, safeBuild, satisfiesDependency, setup };
|
|
696
694
|
//# sourceMappingURL=index.d.ts.map
|