@kubb/core 3.0.0-alpha.12 → 3.0.0-alpha.13
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/README.md +13 -0
- package/dist/{chunk-JRU2D5E6.cjs → chunk-2ESEP5LA.cjs} +6 -6
- package/dist/{chunk-JRU2D5E6.cjs.map → chunk-2ESEP5LA.cjs.map} +1 -1
- package/dist/{chunk-YEVCYV36.cjs → chunk-DU3QBH4U.cjs} +10 -10
- package/dist/{chunk-YEVCYV36.cjs.map → chunk-DU3QBH4U.cjs.map} +1 -1
- package/dist/{chunk-TTDCUWK7.cjs → chunk-NDHS47GW.cjs} +4 -4
- package/dist/{chunk-TTDCUWK7.cjs.map → chunk-NDHS47GW.cjs.map} +1 -1
- package/dist/{chunk-OJRKV365.cjs → chunk-Q2VSIEFB.cjs} +43 -35
- package/dist/{chunk-OJRKV365.cjs.map → chunk-Q2VSIEFB.cjs.map} +1 -1
- package/dist/{chunk-PJLUPV3P.cjs → chunk-UTH63P4L.cjs} +8 -8
- package/dist/{chunk-PJLUPV3P.cjs.map → chunk-UTH63P4L.cjs.map} +1 -1
- package/dist/{chunk-ADFKVVPE.cjs → chunk-WG3GHGN2.cjs} +4 -4
- package/dist/{chunk-ADFKVVPE.cjs.map → chunk-WG3GHGN2.cjs.map} +1 -1
- package/dist/{chunk-WDYNXEYV.js → chunk-ZWL7JIMH.js} +12 -4
- package/dist/{chunk-WDYNXEYV.js.map → chunk-ZWL7JIMH.js.map} +1 -1
- package/dist/index.cjs +36 -36
- package/dist/index.js +2 -2
- package/dist/logger.cjs +7 -7
- package/dist/mocks.cjs +8 -8
- package/dist/mocks.js +1 -1
- package/dist/{prompt-L5KFKY73.cjs → prompt-R4OORXA5.cjs} +62 -62
- package/dist/{prompt-L5KFKY73.cjs.map → prompt-R4OORXA5.cjs.map} +1 -1
- package/dist/transformers.cjs +23 -23
- package/dist/utils.cjs +17 -17
- package/dist/utils.d.cts +1 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -1
- package/package.json +7 -7
- package/src/FileManager.ts +2 -1
- package/src/utils/parser.ts +10 -2
package/dist/transformers.cjs
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
5
|
+
var chunkNDHS47GW_cjs = require('./chunk-NDHS47GW.cjs');
|
|
6
|
+
var chunk2ESEP5LA_cjs = require('./chunk-2ESEP5LA.cjs');
|
|
7
|
+
var chunkWG3GHGN2_cjs = require('./chunk-WG3GHGN2.cjs');
|
|
8
8
|
var remeda = require('remeda');
|
|
9
9
|
|
|
10
10
|
// src/transformers/index.ts
|
|
11
|
-
|
|
11
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
12
12
|
|
|
13
13
|
// src/transformers/combineCodes.ts
|
|
14
|
-
|
|
14
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
15
15
|
function combineCodes(codes) {
|
|
16
16
|
return codes.join("\n");
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// src/transformers/createJSDocBlockText.ts
|
|
20
|
-
|
|
20
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
21
21
|
function createJSDocBlockText({ comments }) {
|
|
22
22
|
const filteredComments = comments.filter(Boolean);
|
|
23
23
|
if (!filteredComments.length) {
|
|
@@ -29,7 +29,7 @@ function createJSDocBlockText({ comments }) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// src/transformers/escape.ts
|
|
32
|
-
|
|
32
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
33
33
|
function escape(text) {
|
|
34
34
|
return text ? text.replaceAll("`", "\\`") : "";
|
|
35
35
|
}
|
|
@@ -55,13 +55,13 @@ function jsStringEscape(input) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// src/transformers/indent.ts
|
|
58
|
-
|
|
58
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
59
59
|
function createIndent(size) {
|
|
60
60
|
return Array.from({ length: size + 1 }).join(" ");
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// src/transformers/nameSorter.ts
|
|
64
|
-
|
|
64
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
65
65
|
function nameSorter(a, b) {
|
|
66
66
|
if (a.name < b.name) {
|
|
67
67
|
return -1;
|
|
@@ -73,7 +73,7 @@ function nameSorter(a, b) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// src/transformers/searchAndReplace.ts
|
|
76
|
-
|
|
76
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
77
77
|
function searchAndReplace(options) {
|
|
78
78
|
const { text, replaceBy, prefix = "", key } = options;
|
|
79
79
|
const searchValues = options.searchValues?.(prefix, key) || [
|
|
@@ -91,10 +91,10 @@ function searchAndReplace(options) {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
// src/transformers/stringify.ts
|
|
94
|
-
|
|
94
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
95
95
|
|
|
96
96
|
// src/transformers/trim.ts
|
|
97
|
-
|
|
97
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
98
98
|
function trim(text) {
|
|
99
99
|
return text.replaceAll(/\n/g, "").trim();
|
|
100
100
|
}
|
|
@@ -131,7 +131,7 @@ function stringifyObject(value) {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
// src/transformers/toRegExp.ts
|
|
134
|
-
|
|
134
|
+
chunkWG3GHGN2_cjs.init_cjs_shims();
|
|
135
135
|
function stringToRegex(text) {
|
|
136
136
|
const isStartWithSlash = text.startsWith("/");
|
|
137
137
|
const isEndWithSlash = text.endsWith("/");
|
|
@@ -155,7 +155,7 @@ var transformers_default = {
|
|
|
155
155
|
escape,
|
|
156
156
|
jsStringEscape,
|
|
157
157
|
createIndent,
|
|
158
|
-
transformReservedWord:
|
|
158
|
+
transformReservedWord: chunkNDHS47GW_cjs.transformReservedWord,
|
|
159
159
|
nameSorter,
|
|
160
160
|
searchAndReplace,
|
|
161
161
|
stringify,
|
|
@@ -167,32 +167,32 @@ var transformers_default = {
|
|
|
167
167
|
JSDoc: {
|
|
168
168
|
createJSDocBlockText
|
|
169
169
|
},
|
|
170
|
-
orderBy:
|
|
170
|
+
orderBy: chunk2ESEP5LA_cjs.orderBy,
|
|
171
171
|
merge: remeda.merge,
|
|
172
|
-
camelCase:
|
|
173
|
-
pascalCase:
|
|
174
|
-
pathCase:
|
|
172
|
+
camelCase: chunk2ESEP5LA_cjs.camelCase,
|
|
173
|
+
pascalCase: chunk2ESEP5LA_cjs.pascalCase,
|
|
174
|
+
pathCase: chunk2ESEP5LA_cjs.pathCase
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
Object.defineProperty(exports, "transformReservedWord", {
|
|
178
178
|
enumerable: true,
|
|
179
|
-
get: function () { return
|
|
179
|
+
get: function () { return chunkNDHS47GW_cjs.transformReservedWord; }
|
|
180
180
|
});
|
|
181
181
|
Object.defineProperty(exports, "camelCase", {
|
|
182
182
|
enumerable: true,
|
|
183
|
-
get: function () { return
|
|
183
|
+
get: function () { return chunk2ESEP5LA_cjs.camelCase; }
|
|
184
184
|
});
|
|
185
185
|
Object.defineProperty(exports, "orderBy", {
|
|
186
186
|
enumerable: true,
|
|
187
|
-
get: function () { return
|
|
187
|
+
get: function () { return chunk2ESEP5LA_cjs.orderBy; }
|
|
188
188
|
});
|
|
189
189
|
Object.defineProperty(exports, "pascalCase", {
|
|
190
190
|
enumerable: true,
|
|
191
|
-
get: function () { return
|
|
191
|
+
get: function () { return chunk2ESEP5LA_cjs.pascalCase; }
|
|
192
192
|
});
|
|
193
193
|
Object.defineProperty(exports, "pathCase", {
|
|
194
194
|
enumerable: true,
|
|
195
|
-
get: function () { return
|
|
195
|
+
get: function () { return chunk2ESEP5LA_cjs.pathCase; }
|
|
196
196
|
});
|
|
197
197
|
Object.defineProperty(exports, "merge", {
|
|
198
198
|
enumerable: true,
|
package/dist/utils.cjs
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunkQ2VSIEFB_cjs = require('./chunk-Q2VSIEFB.cjs');
|
|
4
|
+
require('./chunk-2ESEP5LA.cjs');
|
|
5
|
+
require('./chunk-WG3GHGN2.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "FunctionParams", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkQ2VSIEFB_cjs.FunctionParams; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "URLPath", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkQ2VSIEFB_cjs.URLPath; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "createFile", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkQ2VSIEFB_cjs.createFile; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "createFileExport", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkQ2VSIEFB_cjs.createFileExport; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "createFileImport", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkQ2VSIEFB_cjs.createFileImport; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "createFileParser", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkQ2VSIEFB_cjs.createFileParser; }
|
|
32
32
|
});
|
|
33
33
|
Object.defineProperty(exports, "getFileParser", {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkQ2VSIEFB_cjs.getFileParser; }
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "getUniqueName", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkQ2VSIEFB_cjs.getUniqueName; }
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "isPromise", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkQ2VSIEFB_cjs.isPromise; }
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "isPromiseFulfilledResult", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkQ2VSIEFB_cjs.isPromiseFulfilledResult; }
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "isPromiseRejectedResult", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkQ2VSIEFB_cjs.isPromiseRejectedResult; }
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(exports, "renderTemplate", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkQ2VSIEFB_cjs.renderTemplate; }
|
|
56
56
|
});
|
|
57
57
|
Object.defineProperty(exports, "setUniqueName", {
|
|
58
58
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkQ2VSIEFB_cjs.setUniqueName; }
|
|
60
60
|
});
|
|
61
61
|
Object.defineProperty(exports, "timeout", {
|
|
62
62
|
enumerable: true,
|
|
63
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkQ2VSIEFB_cjs.timeout; }
|
|
64
64
|
});
|
|
65
65
|
//# sourceMappingURL=utils.cjs.map
|
|
66
66
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/utils.d.cts
CHANGED
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { FunctionParams, URLPath, createFile, createFileExport, createFileImport, createFileParser, getFileParser, getUniqueName, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, renderTemplate, setUniqueName, timeout } from './chunk-
|
|
1
|
+
export { FunctionParams, URLPath, createFile, createFileExport, createFileImport, createFileParser, getFileParser, getUniqueName, isPromise, isPromiseFulfilledResult, isPromiseRejectedResult, renderTemplate, setUniqueName, timeout } from './chunk-ZWL7JIMH.js';
|
|
2
2
|
import './chunk-4X5FFJPJ.js';
|
|
3
3
|
//# sourceMappingURL=utils.js.map
|
|
4
4
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.13",
|
|
4
4
|
"description": "Generator core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
"seedrandom": "^3.0.5",
|
|
85
85
|
"semver": "^7.6.3",
|
|
86
86
|
"unraw": "^3.0.0",
|
|
87
|
-
"@kubb/fs": "3.0.0-alpha.
|
|
88
|
-
"@kubb/parser-ts": "3.0.0-alpha.
|
|
89
|
-
"@kubb/types": "3.0.0-alpha.
|
|
87
|
+
"@kubb/fs": "3.0.0-alpha.13",
|
|
88
|
+
"@kubb/parser-ts": "3.0.0-alpha.13",
|
|
89
|
+
"@kubb/types": "3.0.0-alpha.13"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@types/object-hash": "^3.0.6",
|
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
"tinyrainbow": "^1.2.0",
|
|
99
99
|
"tsup": "^8.2.4",
|
|
100
100
|
"typescript": "^5.5.4",
|
|
101
|
-
"@kubb/config-biome": "3.0.0-alpha.
|
|
102
|
-
"@kubb/config-ts": "3.0.0-alpha.
|
|
103
|
-
"@kubb/config-tsup": "3.0.0-alpha.
|
|
101
|
+
"@kubb/config-biome": "3.0.0-alpha.13",
|
|
102
|
+
"@kubb/config-ts": "3.0.0-alpha.13",
|
|
103
|
+
"@kubb/config-tsup": "3.0.0-alpha.13"
|
|
104
104
|
},
|
|
105
105
|
"engines": {
|
|
106
106
|
"node": ">=20"
|
package/src/FileManager.ts
CHANGED
|
@@ -199,8 +199,9 @@ type GetSourceOptions = {
|
|
|
199
199
|
|
|
200
200
|
export async function getSource<TMeta extends FileMetaBase = FileMetaBase>(file: ResolvedFile<TMeta>, { logger }: GetSourceOptions = {}): Promise<string> {
|
|
201
201
|
const parser = await getFileParser(file.extName)
|
|
202
|
+
const source = await parser.print(file, { logger })
|
|
202
203
|
|
|
203
|
-
return parser.
|
|
204
|
+
return parser.format(source)
|
|
204
205
|
}
|
|
205
206
|
|
|
206
207
|
export function mergeFile<TMeta extends FileMetaBase = FileMetaBase>(a: KubbFile.File<TMeta>, b: KubbFile.File<TMeta>): KubbFile.File<TMeta> {
|
package/src/utils/parser.ts
CHANGED
|
@@ -68,6 +68,7 @@ export type ParserModule<TMeta extends object = object> = {
|
|
|
68
68
|
* By default @kubb/react is used
|
|
69
69
|
*/
|
|
70
70
|
render: (item: any) => any
|
|
71
|
+
format: (source: string) => Promise<string>
|
|
71
72
|
/**
|
|
72
73
|
* Convert a file to string
|
|
73
74
|
*/
|
|
@@ -86,6 +87,11 @@ const typeScriptParser = createFileParser({
|
|
|
86
87
|
render() {
|
|
87
88
|
return undefined
|
|
88
89
|
},
|
|
90
|
+
async format(source) {
|
|
91
|
+
const module = await import('@kubb/parser-ts')
|
|
92
|
+
|
|
93
|
+
return module.format(source)
|
|
94
|
+
},
|
|
89
95
|
async print(file) {
|
|
90
96
|
const module = await import('@kubb/parser-ts')
|
|
91
97
|
|
|
@@ -114,8 +120,7 @@ const typeScriptParser = createFileParser({
|
|
|
114
120
|
})
|
|
115
121
|
.filter(Boolean)
|
|
116
122
|
|
|
117
|
-
|
|
118
|
-
return module.print([], { source: [module.print([...importNodes, ...exportNodes]), source].join('\n'), noEmitHelpers: false })
|
|
123
|
+
return [module.print([...importNodes, ...exportNodes]), source].join('\n')
|
|
119
124
|
},
|
|
120
125
|
})
|
|
121
126
|
|
|
@@ -123,6 +128,9 @@ const defaultParser = createFileParser({
|
|
|
123
128
|
render() {
|
|
124
129
|
return undefined
|
|
125
130
|
},
|
|
131
|
+
async format(source) {
|
|
132
|
+
return source
|
|
133
|
+
},
|
|
126
134
|
async print(file, { logger }) {
|
|
127
135
|
return file.sources.map((item) => item.value).join('\n\n')
|
|
128
136
|
},
|