@kubb/core 5.0.0-beta.39 → 5.0.0-beta.40

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.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_memoryStorage = require("./memoryStorage-DHi1d0To.cjs");
2
+ const require_memoryStorage = require("./memoryStorage-Dkxnid2K.cjs");
3
3
  let node_util = require("node:util");
4
4
  let node_crypto = require("node:crypto");
5
5
  let node_fs_promises = require("node:fs/promises");
@@ -1046,6 +1046,7 @@ exports.AsyncEventEmitter = require_memoryStorage.AsyncEventEmitter;
1046
1046
  exports.Diagnostics = require_memoryStorage.Diagnostics;
1047
1047
  exports.KubbDriver = require_memoryStorage.KubbDriver;
1048
1048
  exports.Telemetry = Telemetry;
1049
+ exports.URLPath = require_memoryStorage.URLPath;
1049
1050
  Object.defineProperty(exports, "ast", {
1050
1051
  enumerable: true,
1051
1052
  get: function() {
package/dist/index.d.ts CHANGED
@@ -2,6 +2,142 @@ import { t as __name } from "./chunk-C0LytTxp.js";
2
2
  import { $ as Override, A as KubbHookEndContext, At as logLevel, B as createKubb, Bt as AsyncEventEmitter, C as KubbErrorContext, Ct as createReporter, D as KubbFilesProcessingUpdateContext, Dt as LoggerOptions, E as KubbFilesProcessingStartContext, Et as LoggerContext, F as KubbPluginsEndContext, Ft as createStorage, G as Exclude, H as GeneratorContext, I as KubbSuccessContext, It as Adapter, J as KubbPluginEndContext, K as Group, L as KubbWarnContext, Lt as AdapterFactoryOptions, M as KubbHooks, Mt as RendererFactory, N as KubbInfoContext, Nt as createRenderer, O as KubbGenerationEndContext, Ot as UserLogger, P as KubbLifecycleStartContext, Pt as Storage, Q as Output, R as PossibleConfig, Rt as AdapterSource, S as KubbDiagnosticContext, St as UserReporter, T as KubbFilesProcessingEndContext, Tt as Logger, U as defineGenerator, V as Generator, W as KubbDriver, X as KubbPluginStartContext, Y as KubbPluginSetupContext, Z as NormalizedPlugin, _ as InputPath, _t as defineParser, a as DiagnosticLocation, at as ResolveBannerFile, b as KubbBuildStartContext, bt as ReporterContext, c as PerformanceDiagnostic, ct as ResolverContext, d as SerializedDiagnostic, dt as defineResolver, et as Plugin, f as UpdateDiagnostic, ft as Middleware, g as InputData, gt as Parser, h as Config, ht as ParsedFile, i as DiagnosticKind, it as ResolveBannerContext, j as KubbHookStartContext, jt as Renderer, k as KubbGenerationStartContext, kt as defineLogger, l as ProblemCode, lt as ResolverFileParams, m as CLIOptions, mt as FileProcessorHooks, n as DiagnosticByCode, nt as definePlugin, o as DiagnosticSeverity, ot as ResolveOptionsContext, p as BuildOutput, pt as defineMiddleware, q as Include, r as DiagnosticDoc, rt as BannerMeta, s as Diagnostics, st as Resolver, t as Diagnostic, tt as PluginFactoryOptions, u as ProblemDiagnostic, ut as ResolverPathParams, v as Kubb, vt as GenerationResult, w as KubbFileProcessingUpdate, wt as selectReporters, x as KubbConfigEndContext, xt as ReporterName, y as KubbBuildEndContext, yt as Reporter, z as UserConfig, zt as createAdapter } from "./diagnostics-DhfW8YpT.js";
3
3
  import * as ast from "@kubb/ast";
4
4
 
5
+ //#region ../../internals/utils/src/urlPath.d.ts
6
+ type URLObject = {
7
+ /**
8
+ * The resolved URL string (Express-style or template literal, depending on context).
9
+ */
10
+ url: string;
11
+ /**
12
+ * Extracted path parameters as a key-value map, or `undefined` when the path has none.
13
+ */
14
+ params?: Record<string, string>;
15
+ };
16
+ type ObjectOptions = {
17
+ /**
18
+ * Controls whether the `url` is rendered as an Express path or a template literal.
19
+ * @default 'path'
20
+ */
21
+ type?: 'path' | 'template';
22
+ /**
23
+ * Optional transform applied to each extracted parameter name.
24
+ */
25
+ replacer?: (pathParam: string) => string;
26
+ /**
27
+ * When `true`, the result is serialized to a string expression instead of a plain object.
28
+ */
29
+ stringify?: boolean;
30
+ };
31
+ /**
32
+ * Supported identifier casing strategies for path parameters.
33
+ */
34
+ type PathCasing = 'camelcase';
35
+ type Options = {
36
+ /**
37
+ * Casing strategy applied to path parameter names.
38
+ * @default undefined (original identifier preserved)
39
+ */
40
+ casing?: PathCasing;
41
+ };
42
+ /**
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}`'
49
+ */
50
+ declare class URLPath {
51
+ #private;
52
+ /**
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
+ *
59
+ * @example
60
+ * ```ts
61
+ * new URLPath('/pet/{petId}').URL // '/pet/:petId'
62
+ * ```
63
+ */
64
+ get URL(): string;
65
+ /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true
70
+ * new URLPath('/pet/{petId}').isURL // false
71
+ * ```
72
+ */
73
+ get isURL(): boolean;
74
+ /**
75
+ * Converts the OpenAPI path to a TypeScript template literal string.
76
+ *
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.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * new URLPath('/pet/{petId}').object
87
+ * // { url: '/pet/:petId', params: { petId: 'petId' } }
88
+ * ```
89
+ */
90
+ get object(): URLObject | string;
91
+ /** Returns a map of path parameter names, or `undefined` when the path has no parameters.
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * new URLPath('/pet/{petId}').params // { petId: 'petId' }
96
+ * new URLPath('/pet').params // undefined
97
+ * ```
98
+ */
99
+ get params(): Record<string, string> | undefined;
100
+ toObject({
101
+ type,
102
+ replacer,
103
+ stringify
104
+ }?: 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
+ }
140
+ //#endregion
5
141
  //#region src/reporters/cliReporter.d.ts
6
142
  /**
7
143
  * The default `cli` reporter. Renders the {@link Report} for each config as it finishes, independent
@@ -233,5 +369,5 @@ declare const fsStorage: (options?: Record<string, never> | undefined) => Storag
233
369
  */
234
370
  declare const memoryStorage: (options?: Record<string, never> | undefined) => Storage;
235
371
  //#endregion
236
- export { type Adapter, type AdapterFactoryOptions, type AdapterSource, AsyncEventEmitter, type BannerMeta, type BuildOutput, type CLIOptions, type 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, type InputData, type InputPath, type Kubb, type KubbBuildEndContext, type KubbBuildStartContext, type KubbConfigEndContext, type KubbDiagnosticContext, KubbDriver, type KubbErrorContext, type KubbFileProcessingUpdate, type KubbFilesProcessingEndContext, type KubbFilesProcessingStartContext, type KubbFilesProcessingUpdateContext, type KubbGenerationEndContext, type KubbGenerationStartContext, type KubbHookEndContext, type KubbHookStartContext, type KubbHooks, type KubbInfoContext, type KubbLifecycleStartContext, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, type KubbPluginsEndContext, type KubbSuccessContext, type KubbWarnContext, type Logger, type LoggerContext, type LoggerOptions, type Middleware, type NormalizedPlugin, type Output, type Override, type ParsedFile, type Parser, type PerformanceDiagnostic, type Plugin, type PluginFactoryOptions, type 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, Telemetry, type UpdateDiagnostic, type UserConfig, type UserLogger, type UserReporter, ast, cliReporter, createAdapter, createKubb, createRenderer, createReporter, createStorage, defineGenerator, defineLogger, defineMiddleware, defineParser, definePlugin, defineResolver, fileReporter, fsStorage, jsonReporter, logLevel, memoryStorage, selectReporters };
372
+ export { type Adapter, type AdapterFactoryOptions, type AdapterSource, AsyncEventEmitter, type BannerMeta, type BuildOutput, type CLIOptions, type 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, type InputData, type InputPath, type Kubb, type KubbBuildEndContext, type KubbBuildStartContext, type KubbConfigEndContext, type KubbDiagnosticContext, KubbDriver, type KubbErrorContext, type KubbFileProcessingUpdate, type KubbFilesProcessingEndContext, type KubbFilesProcessingStartContext, type KubbFilesProcessingUpdateContext, type KubbGenerationEndContext, type KubbGenerationStartContext, type KubbHookEndContext, type KubbHookStartContext, type KubbHooks, type KubbInfoContext, type KubbLifecycleStartContext, type KubbPluginEndContext, type KubbPluginSetupContext, type KubbPluginStartContext, type KubbPluginsEndContext, type KubbSuccessContext, type KubbWarnContext, type Logger, type LoggerContext, type LoggerOptions, type Middleware, type NormalizedPlugin, type Output, type Override, type ParsedFile, type Parser, type PerformanceDiagnostic, type Plugin, type PluginFactoryOptions, type 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, Telemetry, URLPath, type UpdateDiagnostic, type UserConfig, type UserLogger, type UserReporter, ast, cliReporter, createAdapter, createKubb, createRenderer, createReporter, createStorage, defineGenerator, defineLogger, defineMiddleware, defineParser, definePlugin, defineResolver, fileReporter, fsStorage, jsonReporter, logLevel, memoryStorage, selectReporters };
237
373
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./chunk-C0LytTxp.js";
2
- import { c as createStorage, d as formatMs, f as getElapsedMs, h as BuildError, l as Diagnostics, m as AsyncEventEmitter, n as KubbDriver, o as defineResolver, r as _usingCtx, s as definePlugin, t as memoryStorage, u as OTLP_ENDPOINT } from "./memoryStorage-CNQTs-YG.js";
2
+ import { c as createStorage, d as URLPath, f as formatMs, g as BuildError, h as AsyncEventEmitter, l as Diagnostics, n as KubbDriver, o as defineResolver, p as getElapsedMs, r as _usingCtx, s as definePlugin, t as memoryStorage, u as OTLP_ENDPOINT } from "./memoryStorage-DTv1Kub1.js";
3
3
  import { stripVTControlCharacters, styleText } from "node:util";
4
4
  import { createHash, randomBytes } from "node:crypto";
5
5
  import { access, mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
@@ -1039,6 +1039,6 @@ function defineParser(parser) {
1039
1039
  return parser;
1040
1040
  }
1041
1041
  //#endregion
1042
- export { AsyncEventEmitter, Diagnostics, KubbDriver, Telemetry, ast, cliReporter, createAdapter, createKubb, createRenderer, createReporter, createStorage, defineGenerator, defineLogger, defineMiddleware, defineParser, definePlugin, defineResolver, fileReporter, fsStorage, jsonReporter, logLevel, memoryStorage, selectReporters };
1042
+ export { AsyncEventEmitter, Diagnostics, KubbDriver, Telemetry, URLPath, ast, cliReporter, createAdapter, createKubb, createRenderer, createReporter, createStorage, defineGenerator, defineLogger, defineMiddleware, defineParser, definePlugin, defineResolver, fileReporter, fsStorage, jsonReporter, logLevel, memoryStorage, selectReporters };
1043
1043
 
1044
1044
  //# sourceMappingURL=index.js.map
@@ -635,7 +635,7 @@ var URLPath = class {
635
635
  };
636
636
  //#endregion
637
637
  //#region package.json
638
- var version = "5.0.0-beta.39";
638
+ var version = "5.0.0-beta.40";
639
639
  //#endregion
640
640
  //#region src/constants.ts
641
641
  /**
@@ -2847,6 +2847,6 @@ const memoryStorage = createStorage(() => {
2847
2847
  };
2848
2848
  });
2849
2849
  //#endregion
2850
- export { FileManager as a, createStorage as c, formatMs as d, getElapsedMs as f, BuildError as h, FileProcessor as i, Diagnostics as l, AsyncEventEmitter as m, KubbDriver as n, defineResolver as o, camelCase as p, _usingCtx as r, definePlugin as s, memoryStorage as t, OTLP_ENDPOINT as u };
2850
+ export { FileManager as a, createStorage as c, URLPath as d, formatMs as f, BuildError as g, AsyncEventEmitter as h, FileProcessor as i, Diagnostics as l, camelCase as m, KubbDriver as n, defineResolver as o, getElapsedMs as p, _usingCtx as r, definePlugin as s, memoryStorage as t, OTLP_ENDPOINT as u };
2851
2851
 
2852
- //# sourceMappingURL=memoryStorage-CNQTs-YG.js.map
2852
+ //# sourceMappingURL=memoryStorage-DTv1Kub1.js.map