@kubb/core 5.0.0-beta.54 → 5.0.0-beta.56

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,17 +1,35 @@
1
1
  import { t as __name } from "./chunk-C0LytTxp.js";
2
- import { $ as Include, A as KubbHookStartContext, At as createReporter, B as ParsedFile, C as KubbFilesProcessingEndContext, Ct as Storage, D as KubbGenerationStartContext, Dt as ReporterContext, E as KubbGenerationEndContext, Et as Reporter, F as KubbSuccessContext, Ft as Adapter, G as Parser, H as createKubb, I as KubbWarnContext, It as AdapterFactoryOptions, J as GeneratorContext, K as defineParser, L as PossibleConfig, Lt as AdapterSource, M as KubbInfoContext, Mt as Cache, N as KubbLifecycleStartContext, Nt as CachedSnapshot, O as KubbHookEndContext, Ot as ReporterName, P as KubbPluginsEndContext, Pt as createCache, Q as Group, R as UserConfig, Rt as createAdapter, S as KubbFileProcessingUpdate, St as createRenderer, T as KubbFilesProcessingUpdateContext, Tt as GenerationResult, U as FsCacheOptions, V as Kubb, W as fsCache, X as KubbDriver, Y as defineGenerator, Z as Exclude, _ as InputPath, _t as ResolverFileParams, a as DiagnosticLocation, at as OutputMode, b as KubbDiagnosticContext, bt as Renderer, 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 logLevel, k as KubbHookLineContext, kt as UserReporter, 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 Generator, 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 ResolverPathParams, w as KubbFilesProcessingStartContext, wt as createStorage, x as KubbErrorContext, xt as RendererFactory, y as KubbBuildStartContext, yt as defineResolver, z as FileProcessorHooks, zt as AsyncEventEmitter } from "./diagnostics-D_LOtOCv.js";
2
+ import { $ as KubbPluginSetupContext, A as KubbHookStartContext, At as Adapter, B as ParsedFile, C as KubbFilesProcessingEndContext, Ct as GenerationResult, D as KubbGenerationStartContext, Dt as UserReporter, E as KubbGenerationEndContext, Et as ReporterName, F as KubbSuccessContext, G as Generator, H as createKubb, I as KubbWarnContext, J as KubbDriver, K as GeneratorContext, L as PossibleConfig, M as KubbInfoContext, Mt as AdapterSource, N as KubbLifecycleStartContext, Nt as createAdapter, O as KubbHookEndContext, Ot as createReporter, P as KubbPluginsEndContext, Pt as AsyncEventEmitter, Q as KubbPluginEndContext, R as UserConfig, S as KubbFileProcessingUpdate, St as createStorage, T as KubbFilesProcessingUpdateContext, Tt as ReporterContext, U as Parser, V as Kubb, W as defineParser, X as Group, Y as Exclude, Z as Include, _ as InputPath, _t as defineResolver, a as DiagnosticLocation, at as Override, b as KubbDiagnosticContext, bt as createRenderer, c as PerformanceDiagnostic, ct as definePlugin, d as SerializedDiagnostic, dt as ResolveBannerFile, et as KubbPluginStartContext, f as UpdateDiagnostic, ft as ResolveOptionsContext, g as InputData, gt as ResolverPathParams, h as Config, ht as ResolverFileParams, i as DiagnosticKind, it as OutputOptions, j as KubbHooks, jt as AdapterFactoryOptions, k as KubbHookLineContext, kt as logLevel, l as ProblemCode, lt as BannerMeta, m as CLIOptions, mt as ResolverContext, n as DiagnosticByCode, nt as Output, o as DiagnosticSeverity, ot as Plugin, p as BuildOutput, pt as Resolver, q as defineGenerator, r as DiagnosticDoc, rt as OutputMode, s as Diagnostics, st as PluginFactoryOptions, t as Diagnostic, tt as NormalizedPlugin, u as ProblemDiagnostic, ut as ResolveBannerContext, v as KubbBuildEndContext, vt as Renderer, w as KubbFilesProcessingStartContext, wt as Reporter, x as KubbErrorContext, xt as Storage, y as KubbBuildStartContext, yt as RendererFactory, z as FileProcessorHooks } from "./diagnostics-Bf2bC8lV.js";
3
3
  import * as ast from "@kubb/ast";
4
4
 
5
- //#region ../../internals/utils/src/urlPath.d.ts
5
+ //#region ../../internals/utils/src/url.d.ts
6
6
  type URLObject = {
7
7
  /**
8
8
  * The resolved URL string (Express-style or template literal, depending on context).
9
9
  */
10
10
  url: string;
11
11
  /**
12
- * Extracted path parameters as a key-value map, or `undefined` when the path has none.
12
+ * Extracted path parameters as a key-value map, or `null` when the path has none.
13
13
  */
14
- params?: Record<string, string>;
14
+ params: Record<string, string> | null;
15
+ };
16
+ /**
17
+ * Supported identifier casing strategies for path parameters.
18
+ */
19
+ type PathCasing = 'camelcase';
20
+ type TemplateOptions = {
21
+ /**
22
+ * Literal text prepended inside the template literal, e.g. a base URL.
23
+ */
24
+ prefix?: string | null;
25
+ /**
26
+ * Transform applied to each extracted parameter name before interpolation.
27
+ */
28
+ replacer?: (pathParam: string) => string;
29
+ /**
30
+ * Casing strategy applied to path parameter names.
31
+ */
32
+ casing?: PathCasing;
15
33
  };
16
34
  type ObjectOptions = {
17
35
  /**
@@ -20,122 +38,67 @@ type ObjectOptions = {
20
38
  */
21
39
  type?: 'path' | 'template';
22
40
  /**
23
- * Optional transform applied to each extracted parameter name.
41
+ * Transform applied to each extracted parameter name.
24
42
  */
25
43
  replacer?: (pathParam: string) => string;
26
44
  /**
27
45
  * When `true`, the result is serialized to a string expression instead of a plain object.
28
46
  */
29
47
  stringify?: boolean;
30
- };
31
- /**
32
- * Supported identifier casing strategies for path parameters.
33
- */
34
- type PathCasing = 'camelcase';
35
- type Options = {
36
48
  /**
37
49
  * Casing strategy applied to path parameter names.
38
- * @default undefined (original identifier preserved)
39
50
  */
40
51
  casing?: PathCasing;
41
52
  };
42
53
  /**
43
- * Parses and transforms an OpenAPI/Swagger path string into various URL formats.
44
- *
45
- * @example
46
- * const p = new URLPath('/pet/{petId}')
47
- * p.URL // '/pet/:petId'
48
- * p.template // '`/pet/${petId}`'
54
+ * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.
49
55
  */
50
- declare class URLPath {
51
- #private;
56
+ declare class Url {
52
57
  /**
53
- * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.
54
- */
55
- path: string;
56
- constructor(path: string, options?: Options);
57
- /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
58
+ * Reports whether `url` is a parseable absolute URL. Delegates to the native `URL.canParse`.
58
59
  *
59
60
  * @example
60
- * ```ts
61
- * new URLPath('/pet/{petId}').URL // '/pet/:petId'
62
- * ```
61
+ * Url.canParse('https://petstore.swagger.io/v2') // true
62
+ * Url.canParse('/pet/{petId}') // false
63
63
  */
64
- get URL(): string;
65
- /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).
64
+ static canParse(url: string, base?: string | URL): boolean;
65
+ /**
66
+ * Converts an OpenAPI/Swagger path to Express-style colon syntax.
66
67
  *
67
68
  * @example
68
- * ```ts
69
- * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true
70
- * new URLPath('/pet/{petId}').isURL // false
71
- * ```
69
+ * Url.toPath('/pet/{petId}') // '/pet/:petId'
72
70
  */
73
- get isURL(): boolean;
71
+ static toPath(path: string): string;
74
72
  /**
75
- * Converts the OpenAPI path to a TypeScript template literal string.
73
+ * Converts an OpenAPI/Swagger path to a TypeScript template literal string.
74
+ * `prefix` is prepended inside the literal, `replacer` transforms each parameter name,
75
+ * and `casing` controls parameter identifier casing.
76
76
  *
77
77
  * @example
78
- * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'
79
- * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'
80
- */
81
- get template(): string;
82
- /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.
78
+ * Url.toTemplateString('/pet/{petId}') // '`/pet/${petId}`'
83
79
  *
84
80
  * @example
85
- * ```ts
86
- * new URLPath('/pet/{petId}').object
87
- * // { url: '/pet/:petId', params: { petId: 'petId' } }
88
- * ```
81
+ * Url.toTemplateString('/pet/{petId}', { prefix: 'https://api' }) // '`https://api/pet/${petId}`'
89
82
  */
90
- get object(): URLObject | string;
91
- /** Returns a map of path parameter names, or `undefined` when the path has no parameters.
83
+ static toTemplateString(path: string, {
84
+ prefix,
85
+ replacer,
86
+ casing
87
+ }?: TemplateOptions): string;
88
+ /**
89
+ * Returns the path and its extracted params as a structured `URLObject`, or as a stringified
90
+ * expression when `stringify` is set.
92
91
  *
93
92
  * @example
94
- * ```ts
95
- * new URLPath('/pet/{petId}').params // { petId: 'petId' }
96
- * new URLPath('/pet').params // undefined
97
- * ```
93
+ * Url.toObject('/pet/{petId}')
94
+ * // { url: '/pet/:petId', params: { petId: 'petId' } }
98
95
  */
99
- get params(): Record<string, string> | undefined;
100
- toObject({
96
+ static toObject(path: string, {
101
97
  type,
102
98
  replacer,
103
- stringify
99
+ stringify,
100
+ casing
104
101
  }?: ObjectOptions): URLObject | string;
105
- /**
106
- * Converts the OpenAPI path to a TypeScript template literal string.
107
- * An optional `replacer` can transform each extracted parameter name before interpolation.
108
- *
109
- * @example
110
- * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
111
- */
112
- toTemplateString({
113
- prefix,
114
- replacer
115
- }?: {
116
- prefix?: string | null;
117
- replacer?: (pathParam: string) => string;
118
- }): string;
119
- /**
120
- * Extracts all `{param}` segments from the path and returns them as a key-value map.
121
- * An optional `replacer` transforms each parameter name in both key and value positions.
122
- * Returns `undefined` when no path parameters are found.
123
- *
124
- * @example
125
- * ```ts
126
- * new URLPath('/pet/{petId}/tag/{tagId}').getParams()
127
- * // { petId: 'petId', tagId: 'tagId' }
128
- * ```
129
- */
130
- getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined;
131
- /** Converts the OpenAPI path to Express-style colon syntax.
132
- *
133
- * @example
134
- * ```ts
135
- * new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'
136
- * ```
137
- */
138
- toURLPath(): string;
139
102
  }
140
103
  //#endregion
141
104
  //#region src/reporters/cliReporter.d.ts
@@ -177,11 +140,11 @@ declare const jsonReporter: Reporter;
177
140
  * Keys are resolved against `process.cwd()`, so root-relative paths such as
178
141
  * `src/gen/api/getPets.ts` are written to the correct location without extra configuration.
179
142
  *
180
- * Internally uses the `write` utility from `@internals/utils`, which:
181
- * - trims leading/trailing whitespace before writing
182
- * - skips the write when file content is already identical (deduplication)
183
- * - creates missing parent directories automatically
184
- * - supports Bun's native file API when running under Bun
143
+ * Writes are deduplicated and directory-safe:
144
+ * - leading and trailing whitespace is trimmed before writing
145
+ * - the write is skipped when the file content is already identical
146
+ * - missing parent directories are created automatically
147
+ * - Bun's native file API is used when running under Bun
185
148
  *
186
149
  * @example
187
150
  * ```ts
@@ -219,5 +182,5 @@ declare const fsStorage: (options?: Record<string, never> | undefined) => Storag
219
182
  */
220
183
  declare const memoryStorage: (options?: Record<string, never> | undefined) => Storage;
221
184
  //#endregion
222
- export { type Adapter, type AdapterFactoryOptions, type AdapterSource, AsyncEventEmitter, type BannerMeta, BuildOutput, CLIOptions, type Cache, type CachedSnapshot, Config, type Diagnostic, type DiagnosticByCode, type DiagnosticDoc, type DiagnosticKind, type DiagnosticLocation, type DiagnosticSeverity, Diagnostics, type Exclude, type FileProcessorHooks, type FsCacheOptions, 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, URLPath, type UpdateDiagnostic, UserConfig, type UserReporter, ast, cliReporter, createAdapter, createCache, createKubb, createRenderer, createReporter, createStorage, defineGenerator, defineParser, definePlugin, defineResolver, fileReporter, fsCache, fsStorage, jsonReporter, logLevel, memoryStorage };
185
+ export { type Adapter, type AdapterFactoryOptions, type AdapterSource, AsyncEventEmitter, type BannerMeta, BuildOutput, CLIOptions, Config, 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, ast, cliReporter, createAdapter, createKubb, createRenderer, createReporter, createStorage, defineGenerator, defineParser, definePlugin, defineResolver, fileReporter, fsStorage, jsonReporter, logLevel, memoryStorage };
223
186
  //# sourceMappingURL=index.d.ts.map