@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/{diagnostics-D_LOtOCv.d.ts → diagnostics-Bf2bC8lV.d.ts} +10 -159
- package/dist/index.cjs +155 -459
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +57 -94
- package/dist/index.js +157 -459
- package/dist/index.js.map +1 -1
- package/dist/{memoryStorage-Bdv42rxp.js → memoryStorage-B0W-w994.js} +14 -39
- package/dist/memoryStorage-B0W-w994.js.map +1 -0
- package/dist/{memoryStorage-CIEzDI6b.cjs → memoryStorage-skOz0dXZ.cjs} +14 -39
- package/dist/memoryStorage-skOz0dXZ.cjs.map +1 -0
- package/dist/mocks.cjs +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/mocks.js +1 -1
- package/package.json +4 -4
- package/src/KubbDriver.ts +7 -71
- package/src/createAdapter.ts +3 -3
- package/src/createKubb.ts +0 -3
- package/src/defineResolver.ts +4 -4
- package/src/index.ts +1 -3
- package/src/storages/fsStorage.ts +7 -7
- package/src/types.ts +1 -34
- package/dist/memoryStorage-Bdv42rxp.js.map +0 -1
- package/dist/memoryStorage-CIEzDI6b.cjs.map +0 -1
- package/src/Fingerprint.ts +0 -97
- package/src/caches/fsCache.ts +0 -185
- package/src/createCache.ts +0 -74
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-C0LytTxp.js";
|
|
2
|
-
import { $ as
|
|
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/
|
|
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 `
|
|
12
|
+
* Extracted path parameters as a key-value map, or `null` when the path has none.
|
|
13
13
|
*/
|
|
14
|
-
params
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
|
51
|
-
#private;
|
|
56
|
+
declare class Url {
|
|
52
57
|
/**
|
|
53
|
-
*
|
|
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
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* ```
|
|
61
|
+
* Url.canParse('https://petstore.swagger.io/v2') // true
|
|
62
|
+
* Url.canParse('/pet/{petId}') // false
|
|
63
63
|
*/
|
|
64
|
-
|
|
65
|
-
/**
|
|
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
|
-
*
|
|
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
|
-
|
|
71
|
+
static toPath(path: string): string;
|
|
74
72
|
/**
|
|
75
|
-
* Converts
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
91
|
-
|
|
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
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* new URLPath('/pet').params // undefined
|
|
97
|
-
* ```
|
|
93
|
+
* Url.toObject('/pet/{petId}')
|
|
94
|
+
* // { url: '/pet/:petId', params: { petId: 'petId' } }
|
|
98
95
|
*/
|
|
99
|
-
|
|
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
|
-
*
|
|
181
|
-
* -
|
|
182
|
-
* -
|
|
183
|
-
* -
|
|
184
|
-
* -
|
|
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,
|
|
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
|