@kubb/core 5.0.0-beta.84 → 5.0.0-beta.86

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/index.d.ts CHANGED
@@ -1,97 +1,6 @@
1
1
  import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
2
- import { $ as KubbPluginEndContext, A as KubbHookStartContext, At as logLevel, B as ParsedFile, C as KubbFilesProcessingEndContext, Ct as createStorage, D as KubbGenerationStartContext, Dt as ReporterName, E as KubbGenerationEndContext, Et as ReporterContext, F as KubbSuccessContext, Ft as AsyncEventEmitter, G as defineParser, H as Kubb, I as KubbWarnContext, J as defineGenerator, K as Generator, L as PossibleConfig, M as KubbInfoContext, Mt as AdapterFactoryOptions, N as KubbLifecycleStartContext, Nt as AdapterSource, O as KubbHookEndContext, Ot as UserReporter, P as KubbPluginsEndContext, Pt as createAdapter, Q as Include, R as UserConfig, S as KubbFileProcessingUpdate, St as Storage, T as KubbFilesProcessingUpdateContext, Tt as Reporter, U as createKubb, V as CreateKubbOptions, W as Parser, X as Exclude, Y as KubbDriver, Z as Group, _ as InputPath, _t as ResolverPathParams, a as DiagnosticLocation, at as OutputOptions, b as KubbDiagnosticContext, bt as RendererFactory, c as PerformanceDiagnostic, ct as PluginFactoryOptions, d as SerializedDiagnostic, dt as ResolveBannerContext, et as KubbPluginSetupContext, f as UpdateDiagnostic, ft as ResolveBannerFile, g as InputData, gt as ResolverFileParams, h as Config, ht as ResolverContext, i as DiagnosticKind, it as OutputMode, j as KubbHooks, jt as Adapter, k as KubbHookLineContext, kt as createReporter, l as ProblemCode, lt as definePlugin, m as CLIOptions, mt as Resolver, n as DiagnosticByCode, nt as NormalizedPlugin, o as DiagnosticSeverity, ot as Override, p as BuildOutput, pt as ResolveOptionsContext, q as GeneratorContext, r as DiagnosticDoc, rt as Output, s as Diagnostics, st as Plugin, t as Diagnostic, tt as KubbPluginStartContext, u as ProblemDiagnostic, ut as BannerMeta, v as KubbBuildEndContext, vt as defineResolver, w as KubbFilesProcessingStartContext, wt as GenerationResult, x as KubbErrorContext, xt as createRenderer, y as KubbBuildStartContext, yt as Renderer, z as FileProcessorHooks } from "./diagnostics-DuaXn2bT.js";
2
+ import { $ as Include, A as KubbHookStartContext, At as UserReporter, B as Kubb, C as KubbFilesProcessingEndContext, Ct as createRenderer, D as KubbGenerationStartContext, Dt as Reporter, E as KubbGenerationEndContext, Et as GenerationResult, F as KubbSuccessContext, Ft as AdapterSource, G as KubbDriver, H as Generator, I as KubbWarnContext, It as createAdapter, J as Parser, K as FileManagerHooks, L as PossibleConfig, M as KubbInfoContext, Mt as logLevel, N as KubbLifecycleStartContext, Nt as Adapter, O as KubbHookEndContext, Ot as ReporterContext, P as KubbPluginsEndContext, Pt as AdapterFactoryOptions, Q as Group, R as UserConfig, S as KubbFileProcessingUpdate, St as RendererFactory, T as KubbFilesProcessingUpdateContext, Tt as createStorage, U as GeneratorContext, V as createKubb, W as defineGenerator, X as Exclude, Y as defineParser, Z as Filter, _ as InputPath, _t as ResolverDefault, a as DiagnosticLocation, at as OutputMode, b as KubbDiagnosticContext, bt as ResolverPathParams, c as PerformanceDiagnostic, ct as Plugin, d as SerializedDiagnostic, dt as BannerMeta, et as KubbPluginEndContext, f as UpdateDiagnostic, ft as ResolveBannerContext, g as InputData, gt as ResolverContext, h as Config, ht as Resolver, i as DiagnosticKind, it as Output, j as KubbHooks, jt as createReporter, k as KubbHookLineContext, kt as ReporterName, l as ProblemCode, lt as PluginFactoryOptions, m as CLIOptions, mt as ResolveOptionsContext, n as DiagnosticByCode, nt as KubbPluginStartContext, o as DiagnosticSeverity, ot as OutputOptions, p as BuildOutput, pt as ResolveBannerFile, q as Hookable, r as DiagnosticDoc, rt as NormalizedPlugin, s as Diagnostics, st as Override, t as Diagnostic, tt as KubbPluginSetupContext, u as ProblemDiagnostic, ut as definePlugin, v as KubbBuildEndContext, vt as ResolverFileParams, w as KubbFilesProcessingStartContext, wt as Storage, x as KubbErrorContext, xt as Renderer, y as KubbBuildStartContext, yt as ResolverPatch, z as CreateKubbOptions } from "./Diagnostics-aWJg-H2d.js";
3
3
 
4
- //#region ../../internals/utils/src/url.d.ts
5
- type URLObject = {
6
- /**
7
- * The resolved URL string (Express-style or template literal, depending on context).
8
- */
9
- url: string;
10
- /**
11
- * Extracted path parameters as a key-value map, or `null` when the path has none.
12
- */
13
- params: Record<string, string> | null;
14
- };
15
- /**
16
- * Supported identifier casing strategies for path parameters.
17
- */
18
- type PathCasing = 'camelcase';
19
- type TemplateOptions = {
20
- /**
21
- * Literal text prepended inside the template literal, e.g. a base URL.
22
- */
23
- prefix?: string | null;
24
- /**
25
- * Transform applied to each extracted parameter name before interpolation.
26
- */
27
- replacer?: (pathParam: string) => string;
28
- /**
29
- * Casing strategy applied to path parameter names.
30
- */
31
- casing?: PathCasing;
32
- };
33
- type ObjectOptions = {
34
- /**
35
- * Controls whether the `url` is rendered as an Express path or a template literal.
36
- * @default 'path'
37
- */
38
- type?: 'path' | 'template';
39
- /**
40
- * Transform applied to each extracted parameter name.
41
- */
42
- replacer?: (pathParam: string) => string;
43
- /**
44
- * When `true`, the result is serialized to a string expression instead of a plain object.
45
- */
46
- stringify?: boolean;
47
- /**
48
- * Casing strategy applied to path parameter names.
49
- */
50
- casing?: PathCasing;
51
- };
52
- /**
53
- * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.
54
- */
55
- declare class Url {
56
- /**
57
- * Converts an OpenAPI/Swagger path to Express-style colon syntax.
58
- *
59
- * @example
60
- * Url.toPath('/pet/{petId}') // '/pet/:petId'
61
- */
62
- static toPath(path: string): string;
63
- /**
64
- * Converts an OpenAPI/Swagger path to a TypeScript template literal string.
65
- * `prefix` is prepended inside the literal, `replacer` transforms each parameter name,
66
- * and `casing` controls parameter identifier casing.
67
- *
68
- * @example
69
- * Url.toTemplateString('/pet/{petId}') // '`/pet/${petId}`'
70
- *
71
- * @example
72
- * Url.toTemplateString('/pet/{petId}', { prefix: 'https://api' }) // '`https://api/pet/${petId}`'
73
- */
74
- static toTemplateString(path: string, {
75
- prefix,
76
- replacer,
77
- casing
78
- }?: TemplateOptions): string;
79
- /**
80
- * Returns the path and its extracted params as a structured `URLObject`, or as a stringified
81
- * expression when `stringify` is set.
82
- *
83
- * @example
84
- * Url.toObject('/pet/{petId}')
85
- * // { url: '/pet/:petId', params: { petId: 'petId' } }
86
- */
87
- static toObject(path: string, {
88
- type,
89
- replacer,
90
- stringify,
91
- casing
92
- }?: ObjectOptions): URLObject | string;
93
- }
94
- //#endregion
95
4
  //#region src/reporters/cliReporter.d.ts
96
5
  /**
97
6
  * The default `cli` reporter. Renders the {@link Report} for each config as it finishes, independent
@@ -107,7 +16,7 @@ declare const cliReporter: Reporter;
107
16
  * `## Timings` section. Selected with `--reporter file` (or `reporters: ['file']`).
108
17
  *
109
18
  * @note It captures the collected diagnostics once a config finishes, not the live
110
- * `kubb:info`/`kubb:plugin` event stream. Color is stripped so the file stays plain text even when
19
+ * `kubb:info`/`kubb:plugin` hook stream. Color is stripped so the file stays plain text even when
111
20
  * the run is attached to a TTY.
112
21
  */
113
22
  declare const fileReporter: Reporter;
@@ -122,6 +31,39 @@ declare const fileReporter: Reporter;
122
31
  */
123
32
  declare const jsonReporter: Reporter;
124
33
  //#endregion
34
+ //#region src/createResolver.d.ts
35
+ /**
36
+ * The plugin-specific resolver fields handed to `createResolver`. `name` and `file` fall
37
+ * back to the built-ins when omitted. Every method reaches sibling helpers through `this`,
38
+ * which `ThisType` types as the full resolver.
39
+ */
40
+ type ResolverOptions<T extends PluginFactoryOptions> = Omit<T['resolver'], keyof Resolver> & {
41
+ pluginName: T['name'];
42
+ name?: T['resolver']['name'];
43
+ file?: T['resolver']['file'];
44
+ } & ThisType<T['resolver']>;
45
+ /**
46
+ * Defines a plugin resolver, the object that decides what every generated symbol and file
47
+ * path is called. Override the top-level `name` and `file` to set the plugin's conventions,
48
+ * and add your own naming helpers, top-level (`typeName`, …) or grouped in namespaces
49
+ * (`query`, `schema`, …). Every method reaches sibling helpers and the built-in machinery
50
+ * through `this.name`, `this.file`, and `this.default`.
51
+ *
52
+ * @example Custom identifier and file casing
53
+ * ```ts
54
+ * export const resolverTs = createResolver<PluginTs>({
55
+ * pluginName: 'plugin-ts',
56
+ * name(name) {
57
+ * return ensureValidVarName(pascalCase(name))
58
+ * },
59
+ * file(params, context) {
60
+ * return this.default.file({ ...params, resolveName: (name) => toFilePath(name, pascalCase) }, context)
61
+ * },
62
+ * })
63
+ * ```
64
+ */
65
+ declare function createResolver<T extends PluginFactoryOptions>(options: ResolverOptions<T>): T['resolver'];
66
+ //#endregion
125
67
  //#region src/storages/fsStorage.d.ts
126
68
  /**
127
69
  * Built-in filesystem storage driver.
@@ -135,6 +77,8 @@ declare const jsonReporter: Reporter;
135
77
  * - the write is skipped when the file content is already identical
136
78
  * - missing parent directories are created automatically
137
79
  * - Bun's native file API is used when running under Bun
80
+ * - concurrent `setItem` calls are capped at {@link WRITE_CONCURRENCY} in flight, so a caller
81
+ * can fire every file's write without pacing itself
138
82
  *
139
83
  * @example
140
84
  * ```ts
@@ -172,5 +116,5 @@ declare const fsStorage: (options?: Record<string, never> | undefined) => Storag
172
116
  */
173
117
  declare const memoryStorage: (options?: Record<string, never> | undefined) => Storage;
174
118
  //#endregion
175
- export { type Adapter, type AdapterFactoryOptions, type AdapterSource, AsyncEventEmitter, type BannerMeta, BuildOutput, CLIOptions, Config, type CreateKubbOptions, type Diagnostic, type DiagnosticByCode, type DiagnosticDoc, type DiagnosticKind, type DiagnosticLocation, type DiagnosticSeverity, Diagnostics, type Exclude, type FileProcessorHooks, type GenerationResult, type Generator, type GeneratorContext, type Group, type Include, InputData, InputPath, type Kubb, KubbBuildEndContext, KubbBuildStartContext, KubbDiagnosticContext, KubbDriver, KubbErrorContext, KubbFileProcessingUpdate, KubbFilesProcessingEndContext, KubbFilesProcessingStartContext, KubbFilesProcessingUpdateContext, KubbGenerationEndContext, KubbGenerationStartContext, KubbHookEndContext, KubbHookLineContext, KubbHookStartContext, KubbHooks, KubbInfoContext, KubbLifecycleStartContext, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, KubbPluginsEndContext, KubbSuccessContext, KubbWarnContext, type NormalizedPlugin, type Output, type OutputMode, type OutputOptions, type Override, type ParsedFile, type Parser, type PerformanceDiagnostic, type Plugin, type PluginFactoryOptions, PossibleConfig, type ProblemCode, type ProblemDiagnostic, type Renderer, type RendererFactory, type Reporter, type ReporterContext, type ReporterName, type ResolveBannerContext, type ResolveBannerFile, type ResolveOptionsContext, type Resolver, type ResolverContext, type ResolverFileParams, type ResolverPathParams, type SerializedDiagnostic, type Storage, type UpdateDiagnostic, Url, UserConfig, type UserReporter, cliReporter, createAdapter, createKubb, createRenderer, createReporter, createStorage, defineGenerator, defineParser, definePlugin, defineResolver, fileReporter, fsStorage, jsonReporter, logLevel, memoryStorage };
119
+ export { type Adapter, type AdapterFactoryOptions, type AdapterSource, type BannerMeta, BuildOutput, CLIOptions, Config, type CreateKubbOptions, type Diagnostic, type DiagnosticByCode, type DiagnosticDoc, type DiagnosticKind, type DiagnosticLocation, type DiagnosticSeverity, Diagnostics, type Exclude, type FileManagerHooks, type Filter, type GenerationResult, type Generator, type GeneratorContext, type Group, Hookable, type Include, InputData, InputPath, type Kubb, KubbBuildEndContext, KubbBuildStartContext, KubbDiagnosticContext, KubbDriver, KubbErrorContext, KubbFileProcessingUpdate, KubbFilesProcessingEndContext, KubbFilesProcessingStartContext, KubbFilesProcessingUpdateContext, KubbGenerationEndContext, KubbGenerationStartContext, KubbHookEndContext, KubbHookLineContext, KubbHookStartContext, KubbHooks, KubbInfoContext, KubbLifecycleStartContext, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, KubbPluginsEndContext, KubbSuccessContext, KubbWarnContext, type NormalizedPlugin, type Output, type OutputMode, type OutputOptions, type Override, type Parser, type PerformanceDiagnostic, type Plugin, type PluginFactoryOptions, PossibleConfig, type ProblemCode, type ProblemDiagnostic, type Renderer, type RendererFactory, type Reporter, type ReporterContext, type ReporterName, type ResolveBannerContext, type ResolveBannerFile, type ResolveOptionsContext, Resolver, type ResolverContext, type ResolverDefault, type ResolverFileParams, type ResolverPatch, type ResolverPathParams, type SerializedDiagnostic, type Storage, type UpdateDiagnostic, UserConfig, type UserReporter, cliReporter, createAdapter, createKubb, createRenderer, createReporter, createResolver, createStorage, defineGenerator, defineParser, definePlugin, fileReporter, fsStorage, jsonReporter, logLevel, memoryStorage };
176
120
  //# sourceMappingURL=index.d.ts.map