@kubb/core 3.16.1 → 3.16.3

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 (106) hide show
  1. package/dist/FileManager-Dk759iZ3.js +918 -0
  2. package/dist/FileManager-Dk759iZ3.js.map +1 -0
  3. package/dist/FileManager-DsRjYJa_.cjs +1031 -0
  4. package/dist/FileManager-DsRjYJa_.cjs.map +1 -0
  5. package/dist/PluginManager-1jPxuyQK.d.ts +511 -0
  6. package/dist/PluginManager-Cvj5AlsU.d.cts +511 -0
  7. package/dist/chunk-DWy1uDak.cjs +39 -0
  8. package/dist/chunk-DbvY3SJr.js +33 -0
  9. package/dist/fs-BacxV1CO.js +87 -0
  10. package/dist/fs-BacxV1CO.js.map +1 -0
  11. package/dist/fs-BazSaf2y.cjs +129 -0
  12. package/dist/fs-BazSaf2y.cjs.map +1 -0
  13. package/dist/fs.cjs +15 -39
  14. package/dist/fs.d.cts +2 -19
  15. package/dist/fs.d.ts +2 -19
  16. package/dist/fs.js +4 -3
  17. package/dist/index-BKHQGQVq.d.ts +140 -0
  18. package/dist/index-BfD6z1P5.d.cts +141 -0
  19. package/dist/index-Cb4pChs8.d.ts +180 -0
  20. package/dist/index-D2ptHzfn.d.cts +180 -0
  21. package/dist/index.cjs +1000 -1028
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +107 -89
  24. package/dist/index.d.ts +107 -89
  25. package/dist/index.js +1020 -864
  26. package/dist/index.js.map +1 -1
  27. package/dist/logger-BxvJpQMX.cjs +1115 -0
  28. package/dist/logger-BxvJpQMX.cjs.map +1 -0
  29. package/dist/logger-Cs45J4yy.js +1085 -0
  30. package/dist/logger-Cs45J4yy.js.map +1 -0
  31. package/dist/logger-OWS6fqk0.d.cts +69 -0
  32. package/dist/logger-xcdTETKy.d.ts +69 -0
  33. package/dist/logger.cjs +6 -24
  34. package/dist/logger.d.cts +2 -3
  35. package/dist/logger.d.ts +2 -3
  36. package/dist/logger.js +4 -4
  37. package/dist/mocks.cjs +49 -65
  38. package/dist/mocks.cjs.map +1 -1
  39. package/dist/mocks.d.cts +6 -6
  40. package/dist/mocks.d.ts +6 -6
  41. package/dist/mocks.js +48 -59
  42. package/dist/mocks.js.map +1 -1
  43. package/dist/prompt-DwEAzq0q.js +853 -0
  44. package/dist/prompt-DwEAzq0q.js.map +1 -0
  45. package/dist/prompt-qiwl6Be9.cjs +855 -0
  46. package/dist/prompt-qiwl6Be9.cjs.map +1 -0
  47. package/dist/transformers-B3CHtwuB.cjs +948 -0
  48. package/dist/transformers-B3CHtwuB.cjs.map +1 -0
  49. package/dist/transformers-CJqBQFIl.js +829 -0
  50. package/dist/transformers-CJqBQFIl.js.map +1 -0
  51. package/dist/transformers.cjs +33 -88
  52. package/dist/transformers.d.cts +75 -54
  53. package/dist/transformers.d.ts +75 -54
  54. package/dist/transformers.js +4 -3
  55. package/dist/utils.cjs +20 -73
  56. package/dist/utils.d.cts +5 -126
  57. package/dist/utils.d.ts +5 -126
  58. package/dist/utils.js +6 -5
  59. package/dist/write-CLTPlucv.js +42 -0
  60. package/dist/write-CLTPlucv.js.map +1 -0
  61. package/dist/write-l_NzIqyy.cjs +48 -0
  62. package/dist/write-l_NzIqyy.cjs.map +1 -0
  63. package/package.json +28 -35
  64. package/src/BarrelManager.ts +1 -0
  65. package/src/PromiseManager.ts +1 -7
  66. package/src/build.ts +9 -11
  67. package/src/index.ts +5 -5
  68. package/src/logger.ts +10 -10
  69. package/src/utils/FunctionParams.ts +3 -1
  70. package/src/utils/TreeNode.ts +3 -1
  71. package/dist/PluginManager-E3SghPP9.d.cts +0 -458
  72. package/dist/PluginManager-PDmRCu9k.d.ts +0 -458
  73. package/dist/chunk-4V7HK7PT.js +0 -1199
  74. package/dist/chunk-4V7HK7PT.js.map +0 -1
  75. package/dist/chunk-BHSTNFNQ.cjs +0 -701
  76. package/dist/chunk-BHSTNFNQ.cjs.map +0 -1
  77. package/dist/chunk-CAZ37TGB.js +0 -918
  78. package/dist/chunk-CAZ37TGB.js.map +0 -1
  79. package/dist/chunk-E4XLCCPK.cjs +0 -170
  80. package/dist/chunk-E4XLCCPK.cjs.map +0 -1
  81. package/dist/chunk-GBYHPDPK.js +0 -595
  82. package/dist/chunk-GBYHPDPK.js.map +0 -1
  83. package/dist/chunk-MCNA6SYG.cjs +0 -1231
  84. package/dist/chunk-MCNA6SYG.cjs.map +0 -1
  85. package/dist/chunk-QR7CQIA3.cjs +0 -943
  86. package/dist/chunk-QR7CQIA3.cjs.map +0 -1
  87. package/dist/chunk-YRPOID7E.js +0 -157
  88. package/dist/chunk-YRPOID7E.js.map +0 -1
  89. package/dist/fs.cjs.map +0 -1
  90. package/dist/fs.js.map +0 -1
  91. package/dist/logger-BWq-oJU_.d.cts +0 -63
  92. package/dist/logger-BWq-oJU_.d.ts +0 -63
  93. package/dist/logger.cjs.map +0 -1
  94. package/dist/logger.js.map +0 -1
  95. package/dist/parser-C1vOjVEd.d.ts +0 -41
  96. package/dist/parser-D6vU1kA9.d.cts +0 -41
  97. package/dist/prompt-ELTHGQK6.js +0 -753
  98. package/dist/prompt-ELTHGQK6.js.map +0 -1
  99. package/dist/prompt-U7M5G25C.cjs +0 -761
  100. package/dist/prompt-U7M5G25C.cjs.map +0 -1
  101. package/dist/transformers.cjs.map +0 -1
  102. package/dist/transformers.js.map +0 -1
  103. package/dist/types-CA8nQKwM.d.cts +0 -132
  104. package/dist/types-CA8nQKwM.d.ts +0 -132
  105. package/dist/utils.cjs.map +0 -1
  106. package/dist/utils.js.map +0 -1
@@ -0,0 +1,180 @@
1
+ import { Export, Extname, File, Import, ResolvedExport, ResolvedFile, ResolvedImport } from "./index-BKHQGQVq.js";
2
+ import { Logger } from "./logger-xcdTETKy.js";
3
+ import { Config, PossiblePromise } from "./PluginManager-1jPxuyQK.js";
4
+
5
+ //#region src/utils/FunctionParams.d.ts
6
+ type FunctionParamsASTWithoutType = {
7
+ name?: string;
8
+ type?: string;
9
+ /**
10
+ * @default true
11
+ */
12
+ required?: boolean;
13
+ /**
14
+ * @default true
15
+ */
16
+ enabled?: boolean;
17
+ default?: string;
18
+ };
19
+ type FunctionParamsASTWithType = {
20
+ name?: never;
21
+ type: string;
22
+ /**
23
+ * @default true
24
+ */
25
+ required?: boolean;
26
+ /**
27
+ * @default true
28
+ */
29
+ enabled?: boolean;
30
+ default?: string;
31
+ };
32
+ /**
33
+ * @deprecated
34
+ */
35
+ type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType;
36
+ /**
37
+ * @deprecated
38
+ */
39
+ declare class FunctionParams {
40
+ #private;
41
+ constructor();
42
+ get items(): FunctionParamsAST[];
43
+ add(item: FunctionParamsAST | Array<FunctionParamsAST | FunctionParamsAST[] | undefined> | undefined): FunctionParams;
44
+ static toObject(items: FunctionParamsAST[]): FunctionParamsAST;
45
+ static toString(items: (FunctionParamsAST | FunctionParamsAST[])[]): string;
46
+ toObject(): FunctionParamsAST;
47
+ toString(): string;
48
+ }
49
+ //#endregion
50
+ //#region src/utils/promise.d.ts
51
+ declare function isPromise<T>(result: PossiblePromise<T>): result is Promise<T>;
52
+ declare function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T>;
53
+ declare function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & {
54
+ reason: T;
55
+ };
56
+ //#endregion
57
+ //#region src/utils/renderTemplate.d.ts
58
+ declare function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data?: TData | undefined): string;
59
+ //#endregion
60
+ //#region src/utils/timeout.d.ts
61
+ declare function timeout(ms: number): Promise<unknown>;
62
+ //#endregion
63
+ //#region src/utils/uniqueName.d.ts
64
+ declare function getUniqueName(originalName: string, data: Record<string, number>): string;
65
+ declare function setUniqueName(originalName: string, data: Record<string, number>): string;
66
+ //#endregion
67
+ //#region src/utils/URLPath.d.ts
68
+ type URLObject = {
69
+ url: string;
70
+ params?: Record<string, string>;
71
+ };
72
+ type ObjectOptions = {
73
+ type?: 'path' | 'template';
74
+ replacer?: (pathParam: string) => string;
75
+ stringify?: boolean;
76
+ };
77
+ type Options = {
78
+ casing?: 'camelcase';
79
+ };
80
+ declare class URLPath {
81
+ #private;
82
+ path: string;
83
+ constructor(path: string, options?: Options);
84
+ /**
85
+ * Convert Swagger path to URLPath(syntax of Express)
86
+ * @example /pet/{petId} => /pet/:petId
87
+ */
88
+ get URL(): string;
89
+ get isURL(): boolean;
90
+ /**
91
+ * Convert Swagger path to template literals/ template strings(camelcase)
92
+ * @example /pet/{petId} => `/pet/${petId}`
93
+ * @example /account/monetary-accountID => `/account/${monetaryAccountId}`
94
+ * @example /account/userID => `/account/${userId}`
95
+ */
96
+ get template(): string;
97
+ get object(): URLObject | string;
98
+ get params(): Record<string, string> | undefined;
99
+ toObject({
100
+ type,
101
+ replacer,
102
+ stringify
103
+ }?: ObjectOptions): URLObject | string;
104
+ /**
105
+ * Convert Swagger path to template literals/ template strings(camelcase)
106
+ * @example /pet/{petId} => `/pet/${petId}`
107
+ * @example /account/monetary-accountID => `/account/${monetaryAccountId}`
108
+ * @example /account/userID => `/account/${userId}`
109
+ */
110
+ toTemplateString({
111
+ prefix,
112
+ replacer
113
+ }?: {
114
+ prefix?: string;
115
+ replacer?: (pathParam: string) => string;
116
+ }): string;
117
+ getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined;
118
+ /**
119
+ * Convert Swagger path to URLPath(syntax of Express)
120
+ * @example /pet/{petId} => /pet/:petId
121
+ */
122
+ toURLPath(): string;
123
+ }
124
+ //#endregion
125
+ //#region src/utils/parser.d.ts
126
+ /**
127
+ * Generate a default banner for files created by Kubb
128
+ * @returns A string with the default banner
129
+ */
130
+ declare function getDefaultBanner({
131
+ title,
132
+ description,
133
+ version,
134
+ config
135
+ }: {
136
+ title?: string;
137
+ description?: string;
138
+ version?: string;
139
+ config: Config;
140
+ }): string;
141
+ /**
142
+ * Helper to create a file with name and id set
143
+ */
144
+ declare function createFile<TMeta extends object = object>(file: File<TMeta>): ResolvedFile<TMeta>;
145
+ /**
146
+ * Helper to create a fileImport with extname set
147
+ */
148
+ declare function createFileImport(imp: Import): ResolvedImport;
149
+ /**
150
+ * Helper to create a fileExport with extname set
151
+ */
152
+ declare function createFileExport(exp: Export): ResolvedExport;
153
+ type ParserModule<TMeta extends object = object> = {
154
+ format: (source: string) => Promise<string>;
155
+ /**
156
+ * Convert a file to string
157
+ */
158
+ print: (file: ResolvedFile<TMeta>, options: PrintOptions) => Promise<string>;
159
+ };
160
+ declare function createFileParser<TMeta extends object = object>(parser: ParserModule<TMeta>): ParserModule<TMeta>;
161
+ type PrintOptions = {
162
+ extname?: Extname;
163
+ logger?: Logger;
164
+ };
165
+ declare function getFileParser<TMeta extends object = object>(extname: Extname | undefined): Promise<ParserModule<TMeta>>;
166
+ //#endregion
167
+ //#region src/utils/Cache.d.ts
168
+ declare class Cache<T> {
169
+ #private;
170
+ get(key: string): Promise<T | null>;
171
+ set(key: string, value: T): Promise<void>;
172
+ delete(key: string): Promise<void>;
173
+ clear(): Promise<void>;
174
+ keys(): Promise<string[]>;
175
+ values(): Promise<T[]>;
176
+ flush(): Promise<void>;
177
+ }
178
+ //#endregion
179
+ export { Cache, FunctionParams, type FunctionParamsAST, type ParserModule, type URLObject, URLPath, createFile, createFileExport, createFileImport, createFileParser, getDefaultBanner, getFileParser, getUniqueName, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, renderTemplate, setUniqueName, timeout };
180
+ //# sourceMappingURL=index-Cb4pChs8.d.ts.map
@@ -0,0 +1,180 @@
1
+ import { Export, Extname, File, Import, ResolvedExport, ResolvedFile, ResolvedImport } from "./index-BfD6z1P5.cjs";
2
+ import { Logger } from "./logger-OWS6fqk0.cjs";
3
+ import { Config, PossiblePromise } from "./PluginManager-Cvj5AlsU.cjs";
4
+
5
+ //#region src/utils/FunctionParams.d.ts
6
+ type FunctionParamsASTWithoutType = {
7
+ name?: string;
8
+ type?: string;
9
+ /**
10
+ * @default true
11
+ */
12
+ required?: boolean;
13
+ /**
14
+ * @default true
15
+ */
16
+ enabled?: boolean;
17
+ default?: string;
18
+ };
19
+ type FunctionParamsASTWithType = {
20
+ name?: never;
21
+ type: string;
22
+ /**
23
+ * @default true
24
+ */
25
+ required?: boolean;
26
+ /**
27
+ * @default true
28
+ */
29
+ enabled?: boolean;
30
+ default?: string;
31
+ };
32
+ /**
33
+ * @deprecated
34
+ */
35
+ type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType;
36
+ /**
37
+ * @deprecated
38
+ */
39
+ declare class FunctionParams {
40
+ #private;
41
+ constructor();
42
+ get items(): FunctionParamsAST[];
43
+ add(item: FunctionParamsAST | Array<FunctionParamsAST | FunctionParamsAST[] | undefined> | undefined): FunctionParams;
44
+ static toObject(items: FunctionParamsAST[]): FunctionParamsAST;
45
+ static toString(items: (FunctionParamsAST | FunctionParamsAST[])[]): string;
46
+ toObject(): FunctionParamsAST;
47
+ toString(): string;
48
+ }
49
+ //#endregion
50
+ //#region src/utils/promise.d.ts
51
+ declare function isPromise<T>(result: PossiblePromise<T>): result is Promise<T>;
52
+ declare function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T>;
53
+ declare function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & {
54
+ reason: T;
55
+ };
56
+ //#endregion
57
+ //#region src/utils/renderTemplate.d.ts
58
+ declare function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data?: TData | undefined): string;
59
+ //#endregion
60
+ //#region src/utils/timeout.d.ts
61
+ declare function timeout(ms: number): Promise<unknown>;
62
+ //#endregion
63
+ //#region src/utils/uniqueName.d.ts
64
+ declare function getUniqueName(originalName: string, data: Record<string, number>): string;
65
+ declare function setUniqueName(originalName: string, data: Record<string, number>): string;
66
+ //#endregion
67
+ //#region src/utils/URLPath.d.ts
68
+ type URLObject = {
69
+ url: string;
70
+ params?: Record<string, string>;
71
+ };
72
+ type ObjectOptions = {
73
+ type?: 'path' | 'template';
74
+ replacer?: (pathParam: string) => string;
75
+ stringify?: boolean;
76
+ };
77
+ type Options = {
78
+ casing?: 'camelcase';
79
+ };
80
+ declare class URLPath {
81
+ #private;
82
+ path: string;
83
+ constructor(path: string, options?: Options);
84
+ /**
85
+ * Convert Swagger path to URLPath(syntax of Express)
86
+ * @example /pet/{petId} => /pet/:petId
87
+ */
88
+ get URL(): string;
89
+ get isURL(): boolean;
90
+ /**
91
+ * Convert Swagger path to template literals/ template strings(camelcase)
92
+ * @example /pet/{petId} => `/pet/${petId}`
93
+ * @example /account/monetary-accountID => `/account/${monetaryAccountId}`
94
+ * @example /account/userID => `/account/${userId}`
95
+ */
96
+ get template(): string;
97
+ get object(): URLObject | string;
98
+ get params(): Record<string, string> | undefined;
99
+ toObject({
100
+ type,
101
+ replacer,
102
+ stringify
103
+ }?: ObjectOptions): URLObject | string;
104
+ /**
105
+ * Convert Swagger path to template literals/ template strings(camelcase)
106
+ * @example /pet/{petId} => `/pet/${petId}`
107
+ * @example /account/monetary-accountID => `/account/${monetaryAccountId}`
108
+ * @example /account/userID => `/account/${userId}`
109
+ */
110
+ toTemplateString({
111
+ prefix,
112
+ replacer
113
+ }?: {
114
+ prefix?: string;
115
+ replacer?: (pathParam: string) => string;
116
+ }): string;
117
+ getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined;
118
+ /**
119
+ * Convert Swagger path to URLPath(syntax of Express)
120
+ * @example /pet/{petId} => /pet/:petId
121
+ */
122
+ toURLPath(): string;
123
+ }
124
+ //#endregion
125
+ //#region src/utils/parser.d.ts
126
+ /**
127
+ * Generate a default banner for files created by Kubb
128
+ * @returns A string with the default banner
129
+ */
130
+ declare function getDefaultBanner({
131
+ title,
132
+ description,
133
+ version,
134
+ config
135
+ }: {
136
+ title?: string;
137
+ description?: string;
138
+ version?: string;
139
+ config: Config;
140
+ }): string;
141
+ /**
142
+ * Helper to create a file with name and id set
143
+ */
144
+ declare function createFile<TMeta extends object = object>(file: File<TMeta>): ResolvedFile<TMeta>;
145
+ /**
146
+ * Helper to create a fileImport with extname set
147
+ */
148
+ declare function createFileImport(imp: Import): ResolvedImport;
149
+ /**
150
+ * Helper to create a fileExport with extname set
151
+ */
152
+ declare function createFileExport(exp: Export): ResolvedExport;
153
+ type ParserModule<TMeta extends object = object> = {
154
+ format: (source: string) => Promise<string>;
155
+ /**
156
+ * Convert a file to string
157
+ */
158
+ print: (file: ResolvedFile<TMeta>, options: PrintOptions) => Promise<string>;
159
+ };
160
+ declare function createFileParser<TMeta extends object = object>(parser: ParserModule<TMeta>): ParserModule<TMeta>;
161
+ type PrintOptions = {
162
+ extname?: Extname;
163
+ logger?: Logger;
164
+ };
165
+ declare function getFileParser<TMeta extends object = object>(extname: Extname | undefined): Promise<ParserModule<TMeta>>;
166
+ //#endregion
167
+ //#region src/utils/Cache.d.ts
168
+ declare class Cache<T> {
169
+ #private;
170
+ get(key: string): Promise<T | null>;
171
+ set(key: string, value: T): Promise<void>;
172
+ delete(key: string): Promise<void>;
173
+ clear(): Promise<void>;
174
+ keys(): Promise<string[]>;
175
+ values(): Promise<T[]>;
176
+ flush(): Promise<void>;
177
+ }
178
+ //#endregion
179
+ export { Cache, FunctionParams, type FunctionParamsAST, type ParserModule, type URLObject, URLPath, createFile, createFileExport, createFileImport, createFileParser, getDefaultBanner, getFileParser, getUniqueName, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, renderTemplate, setUniqueName, timeout };
180
+ //# sourceMappingURL=index-D2ptHzfn.d.cts.map