@kubb/core 4.28.1 → 4.29.1

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.
Files changed (66) hide show
  1. package/dist/{chunk-C1_xRkKa.cjs → chunk-CNbaEX1y.cjs} +1 -1
  2. package/dist/{chunk-iVr_oF3V.js → chunk-DKWOrOAv.js} +1 -1
  3. package/dist/fs.cjs +8 -7
  4. package/dist/fs.d.ts +1 -1
  5. package/dist/fs.js +1 -1
  6. package/dist/{getBarrelFiles-gRyVPFBP.js → getBarrelFiles-BBDOJ2lV.js} +20 -20
  7. package/dist/getBarrelFiles-BBDOJ2lV.js.map +1 -0
  8. package/dist/{getBarrelFiles-DCNjiX2W.cjs → getBarrelFiles-BttXy8Sp.cjs} +22 -28
  9. package/dist/getBarrelFiles-BttXy8Sp.cjs.map +1 -0
  10. package/dist/{getBarrelFiles-CHL9_Obd.d.ts → getBarrelFiles-C7gz90HF.d.ts} +5 -8
  11. package/dist/{getBarrelFiles-CmpI3rrq.d.cts → getBarrelFiles-DAhlPFXC.d.ts} +5 -8
  12. package/dist/hooks.cjs +2 -1
  13. package/dist/hooks.cjs.map +1 -1
  14. package/dist/hooks.d.ts +2 -2
  15. package/dist/hooks.js +1 -1
  16. package/dist/index.cjs +33 -211
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +4 -7
  19. package/dist/index.js +26 -202
  20. package/dist/index.js.map +1 -1
  21. package/dist/{transformers-B8kXgG3q.cjs → toRegExp-DGgAWZ_m.cjs} +15 -117
  22. package/dist/toRegExp-DGgAWZ_m.cjs.map +1 -0
  23. package/dist/{transformers-8ju9ixkG.js → toRegExp-DdJ1Kgbf.js} +16 -112
  24. package/dist/toRegExp-DdJ1Kgbf.js.map +1 -0
  25. package/dist/transformers.cjs +45 -36
  26. package/dist/transformers.cjs.map +1 -0
  27. package/dist/transformers.d.ts +2 -6
  28. package/dist/transformers.js +26 -2
  29. package/dist/transformers.js.map +1 -0
  30. package/dist/{types-Cn3Gwsf3.d.ts → types-CiePC9Y3.d.ts} +6 -11
  31. package/dist/{types-ulibr7zw.d.cts → types-Ciz0gIX7.d.ts} +6 -11
  32. package/dist/utils.cjs +36 -20
  33. package/dist/utils.cjs.map +1 -1
  34. package/dist/utils.d.ts +8 -5
  35. package/dist/utils.js +34 -20
  36. package/dist/utils.js.map +1 -1
  37. package/dist/write-CwpeNfTd.cjs +108 -0
  38. package/dist/write-CwpeNfTd.cjs.map +1 -0
  39. package/dist/write-DiGboRXI.js +72 -0
  40. package/dist/write-DiGboRXI.js.map +1 -0
  41. package/package.json +22 -27
  42. package/src/PackageManager.ts +3 -3
  43. package/src/fs/clean.ts +2 -2
  44. package/src/fs/exists.ts +10 -30
  45. package/src/fs/read.ts +7 -30
  46. package/src/fs/write.ts +38 -55
  47. package/src/transformers/casing.ts +22 -4
  48. package/src/transformers/index.ts +0 -7
  49. package/src/utils/FunctionParams.ts +5 -18
  50. package/src/utils/formatters.ts +2 -2
  51. package/src/utils/index.ts +1 -0
  52. package/src/utils/linters.ts +2 -2
  53. package/src/utils/tokenize.ts +23 -0
  54. package/dist/fs-Parec-wn.js +0 -105
  55. package/dist/fs-Parec-wn.js.map +0 -1
  56. package/dist/fs-jxNCXQUq.cjs +0 -141
  57. package/dist/fs-jxNCXQUq.cjs.map +0 -1
  58. package/dist/fs.d.cts +0 -23
  59. package/dist/getBarrelFiles-DCNjiX2W.cjs.map +0 -1
  60. package/dist/getBarrelFiles-gRyVPFBP.js.map +0 -1
  61. package/dist/hooks.d.cts +0 -15
  62. package/dist/index.d.cts +0 -119
  63. package/dist/transformers-8ju9ixkG.js.map +0 -1
  64. package/dist/transformers-B8kXgG3q.cjs.map +0 -1
  65. package/dist/transformers.d.cts +0 -112
  66. package/dist/utils.d.cts +0 -287
package/dist/utils.d.cts DELETED
@@ -1,287 +0,0 @@
1
- import { t as __name } from "./chunk-DlpkT3g-.cjs";
2
- import { A as AsyncEventEmitter, E as PossiblePromise, S as UserConfig, n as Config } from "./types-ulibr7zw.cjs";
3
- import { i as defineConfig, n as getBarrelFiles, r as CLIOptions } from "./getBarrelFiles-CmpI3rrq.cjs";
4
-
5
- //#region src/utils/buildJSDoc.d.ts
6
-
7
- /**
8
- * Builds a JSDoc comment block with custom indentation.
9
- * @param comments - Array of comment strings to include in the JSDoc block
10
- * @param options - Configuration options for formatting
11
- * @returns Formatted JSDoc string or fallback string if no comments
12
- */
13
- declare function buildJSDoc(comments: Array<string>, options?: {
14
- /**
15
- * String to use for indenting each line of the JSDoc comment
16
- * @default ' * ' (3 spaces + asterisk + space)
17
- */
18
- indent?: string;
19
- /**
20
- * String to append after the closing JSDoc tag
21
- * @default '\n ' (newline + 2 spaces)
22
- */
23
- suffix?: string;
24
- /**
25
- * String to return when there are no comments
26
- * @default ' ' (2 spaces)
27
- */
28
- fallback?: string;
29
- }): string;
30
- //#endregion
31
- //#region src/utils/Cache.d.ts
32
- declare class Cache<T> {
33
- #private;
34
- get(key: string): Promise<T | null>;
35
- set(key: string, value: T): Promise<void>;
36
- delete(key: string): Promise<void>;
37
- clear(): Promise<void>;
38
- keys(): Promise<string[]>;
39
- values(): Promise<T[]>;
40
- flush(): Promise<void>;
41
- }
42
- //#endregion
43
- //#region src/utils/checkOnlineStatus.d.ts
44
- /**
45
- * Check if the system has internet connectivity
46
- * Uses DNS lookup to well-known stable domains as a lightweight connectivity test
47
- */
48
- declare function isOnline(): Promise<boolean>;
49
- /**
50
- * Execute a function only if online, otherwise silently skip
51
- */
52
- declare function executeIfOnline<T>(fn: () => Promise<T>): Promise<T | null>;
53
- //#endregion
54
- //#region src/utils/FunctionParams.d.ts
55
- type FunctionParamsASTWithoutType = {
56
- name?: string;
57
- type?: string;
58
- /**
59
- * @default true
60
- */
61
- required?: boolean;
62
- /**
63
- * @default true
64
- */
65
- enabled?: boolean;
66
- default?: string;
67
- };
68
- type FunctionParamsASTWithType = {
69
- name?: never;
70
- type: string;
71
- /**
72
- * @default true
73
- */
74
- required?: boolean;
75
- /**
76
- * @default true
77
- */
78
- enabled?: boolean;
79
- default?: string;
80
- };
81
- /**
82
- * @deprecated
83
- */
84
- type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType;
85
- /**
86
- * @deprecated
87
- */
88
- declare class FunctionParams {
89
- #private;
90
- constructor();
91
- get items(): FunctionParamsAST[];
92
- add(item: FunctionParamsAST | Array<FunctionParamsAST | FunctionParamsAST[] | undefined> | undefined): FunctionParams;
93
- static toObject(items: FunctionParamsAST[]): FunctionParamsAST;
94
- toObject(): FunctionParamsAST;
95
- static toString(items: (FunctionParamsAST | FunctionParamsAST[])[]): string;
96
- toString(): string;
97
- }
98
- //#endregion
99
- //#region src/utils/formatHrtime.d.ts
100
- /**
101
- * Calculates elapsed time in milliseconds from a high-resolution start time.
102
- * Rounds to 2 decimal places to provide sub-millisecond precision without noise.
103
- */
104
- declare function getElapsedMs(hrStart: [number, number]): number;
105
- /**
106
- * Converts a millisecond duration into a human-readable string.
107
- * Adjusts units (ms, s, m s) based on the magnitude of the duration.
108
- */
109
- declare function formatMs(ms: number): string;
110
- /**
111
- * Convenience helper to get and format elapsed time in one step.
112
- */
113
- declare function formatHrtime(hrStart: [number, number]): string;
114
- //#endregion
115
- //#region src/utils/formatters.d.ts
116
- declare const formatters: {
117
- readonly prettier: {
118
- readonly command: "prettier";
119
- readonly args: (outputPath: string) => string[];
120
- readonly errorMessage: "Prettier not found";
121
- };
122
- readonly biome: {
123
- readonly command: "biome";
124
- readonly args: (outputPath: string) => string[];
125
- readonly errorMessage: "Biome not found";
126
- };
127
- readonly oxfmt: {
128
- readonly command: "oxfmt";
129
- readonly args: (outputPath: string) => string[];
130
- readonly errorMessage: "Oxfmt not found";
131
- };
132
- };
133
- type Formatter = keyof typeof formatters;
134
- /**
135
- * Detect which formatter is available in the system.
136
- *
137
- * @returns Promise that resolves to the first available formatter or undefined if none are found
138
- *
139
- * @remarks
140
- * Checks in order of preference: biome, oxfmt, prettier.
141
- * Uses the `--version` flag to detect if each formatter command is available.
142
- * This is a reliable method as all supported formatters implement this flag.
143
- *
144
- * @example
145
- * ```typescript
146
- * const formatter = await detectFormatter()
147
- * if (formatter) {
148
- * console.log(`Using ${formatter} for formatting`)
149
- * } else {
150
- * console.log('No formatter found')
151
- * }
152
- * ```
153
- */
154
- declare function detectFormatter(): Promise<Formatter | undefined>;
155
- //#endregion
156
- //#region src/utils/getConfigs.d.ts
157
- /**
158
- * Converting UserConfig to Config Array without a change in the object beside the JSON convert.
159
- */
160
- declare function getConfigs(config: ReturnType<typeof defineConfig> | UserConfig, args: CLIOptions): Promise<Array<Config>>;
161
- //#endregion
162
- //#region src/utils/getNestedAccessor.d.ts
163
- /**
164
- * Converts a param path (string with dot notation or array of strings) to a JavaScript accessor expression.
165
- * @param param - The param path, e.g., 'pagination.next.id' or ['pagination', 'next', 'id']
166
- * @param accessor - The base accessor, e.g., 'lastPage' or 'firstPage'
167
- * @returns A JavaScript accessor expression, e.g., "lastPage?.['pagination']?.['next']?.['id']", or undefined if param is empty
168
- *
169
- * @example
170
- * ```ts
171
- * getNestedAccessor('pagination.next.id', 'lastPage')
172
- * // returns: "lastPage?.['pagination']?.['next']?.['id']"
173
- *
174
- * getNestedAccessor(['pagination', 'next', 'id'], 'lastPage')
175
- * // returns: "lastPage?.['pagination']?.['next']?.['id']"
176
- *
177
- * getNestedAccessor('', 'lastPage')
178
- * // returns: undefined
179
- * ```
180
- */
181
- declare function getNestedAccessor(param: string | string[], accessor: string): string | undefined;
182
- //#endregion
183
- //#region src/utils/linters.d.ts
184
- declare const linters: {
185
- readonly eslint: {
186
- readonly command: "eslint";
187
- readonly args: (outputPath: string) => string[];
188
- readonly errorMessage: "Eslint not found";
189
- };
190
- readonly biome: {
191
- readonly command: "biome";
192
- readonly args: (outputPath: string) => string[];
193
- readonly errorMessage: "Biome not found";
194
- };
195
- readonly oxlint: {
196
- readonly command: "oxlint";
197
- readonly args: (outputPath: string) => string[];
198
- readonly errorMessage: "Oxlint not found";
199
- };
200
- };
201
- type Linter = keyof typeof linters;
202
- declare function detectLinter(): Promise<Linter | undefined>;
203
- //#endregion
204
- //#region src/utils/promise.d.ts
205
- declare function isPromise<T>(result: PossiblePromise<T>): result is Promise<T>;
206
- declare function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T>;
207
- declare function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & {
208
- reason: T;
209
- };
210
- //#endregion
211
- //#region src/utils/renderTemplate.d.ts
212
- declare function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data?: TData | undefined): string;
213
- //#endregion
214
- //#region src/utils/serializePluginOptions.d.ts
215
- /**
216
- * Serialize plugin options for safe JSON transport.
217
- * Strips functions, symbols, and undefined values recursively.
218
- */
219
- declare function serializePluginOptions(options: unknown): unknown;
220
- //#endregion
221
- //#region src/utils/timeout.d.ts
222
- declare function timeout(ms: number): Promise<unknown>;
223
- //#endregion
224
- //#region src/utils/URLPath.d.ts
225
- type URLObject = {
226
- url: string;
227
- params?: Record<string, string>;
228
- };
229
- type ObjectOptions = {
230
- type?: 'path' | 'template';
231
- replacer?: (pathParam: string) => string;
232
- stringify?: boolean;
233
- };
234
- type Options = {
235
- casing?: 'camelcase';
236
- };
237
- declare class URLPath {
238
- #private;
239
- path: string;
240
- constructor(path: string, options?: Options);
241
- /**
242
- * Convert Swagger path to URLPath(syntax of Express)
243
- * @example /pet/{petId} => /pet/:petId
244
- */
245
- get URL(): string;
246
- get isURL(): boolean;
247
- /**
248
- * Convert Swagger path to template literals/ template strings(camelcase)
249
- * @example /pet/{petId} => `/pet/${petId}`
250
- * @example /account/monetary-accountID => `/account/${monetaryAccountId}`
251
- * @example /account/userID => `/account/${userId}`
252
- */
253
- get template(): string;
254
- get object(): URLObject | string;
255
- get params(): Record<string, string> | undefined;
256
- toObject({
257
- type,
258
- replacer,
259
- stringify
260
- }?: ObjectOptions): URLObject | string;
261
- /**
262
- * Convert Swagger path to template literals/ template strings(camelcase)
263
- * @example /pet/{petId} => `/pet/${petId}`
264
- * @example /account/monetary-accountID => `/account/${monetaryAccountId}`
265
- * @example /account/userID => `/account/${userId}`
266
- */
267
- toTemplateString({
268
- prefix,
269
- replacer
270
- }?: {
271
- prefix?: string;
272
- replacer?: (pathParam: string) => string;
273
- }): string;
274
- getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined;
275
- /**
276
- * Convert Swagger path to URLPath(syntax of Express)
277
- * @example /pet/{petId} => /pet/:petId
278
- */
279
- toURLPath(): string;
280
- }
281
- //#endregion
282
- //#region src/utils/uniqueName.d.ts
283
- declare function getUniqueName(originalName: string, data: Record<string, number>): string;
284
- declare function setUniqueName(originalName: string, data: Record<string, number>): string;
285
- //#endregion
286
- export { AsyncEventEmitter, Cache, FunctionParams, type FunctionParamsAST, type URLObject, URLPath, buildJSDoc, detectFormatter, detectLinter, executeIfOnline, formatHrtime, formatMs, formatters, getBarrelFiles, getConfigs, getElapsedMs, getNestedAccessor, getUniqueName, isOnline, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, linters, renderTemplate, serializePluginOptions, setUniqueName, timeout };
287
- //# sourceMappingURL=utils.d.cts.map