@kubb/core 3.0.0-alpha.1 → 3.0.0-alpha.11
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/{FileManager-EVJig-LT.d.ts → FileManager-BbUCeEyv.d.cts} +108 -94
- package/dist/{FileManager-DSLZ6ps7.d.cts → FileManager-CpuFz6eH.d.ts} +108 -94
- package/dist/chunk-2EU7DMPM.js +96 -0
- package/dist/chunk-2EU7DMPM.js.map +1 -0
- package/dist/chunk-4X5FFJPJ.js +8 -13
- package/dist/chunk-4X5FFJPJ.js.map +1 -1
- package/dist/chunk-52WA2JF5.cjs +1536 -0
- package/dist/chunk-52WA2JF5.cjs.map +1 -0
- package/dist/chunk-ADFKVVPE.cjs +42 -0
- package/dist/chunk-ADFKVVPE.cjs.map +1 -0
- package/dist/{chunk-3OXCZ5DJ.js → chunk-E6CN2CZC.js} +63 -54
- package/dist/chunk-E6CN2CZC.js.map +1 -0
- package/dist/chunk-HBQM723K.js +1049 -0
- package/dist/chunk-HBQM723K.js.map +1 -0
- package/dist/{chunk-67C6RBGQ.cjs → chunk-HMCSWG5L.cjs} +25 -26
- package/dist/chunk-HMCSWG5L.cjs.map +1 -0
- package/dist/chunk-L6YLVCKM.js +894 -0
- package/dist/chunk-L6YLVCKM.js.map +1 -0
- package/dist/chunk-PJLUPV3P.cjs +1088 -0
- package/dist/chunk-PJLUPV3P.cjs.map +1 -0
- package/dist/chunk-TTDCUWK7.cjs +101 -0
- package/dist/chunk-TTDCUWK7.cjs.map +1 -0
- package/dist/{chunk-LM2YQC3T.cjs → chunk-YEVCYV36.cjs} +81 -51
- package/dist/chunk-YEVCYV36.cjs.map +1 -0
- package/dist/index.cjs +545 -610
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -19
- package/dist/index.d.ts +6 -19
- package/dist/index.js +438 -522
- package/dist/index.js.map +1 -1
- package/dist/{logger-DChjnJMn.d.cts → logger-DvbHXjIO.d.cts} +29 -19
- package/dist/{logger-DChjnJMn.d.ts → logger-DvbHXjIO.d.ts} +29 -19
- package/dist/logger.cjs +25 -15
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.d.cts +1 -2
- package/dist/logger.d.ts +1 -2
- package/dist/logger.js +3 -15
- package/dist/logger.js.map +1 -1
- package/dist/mocks.cjs +27 -26
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +6 -9
- package/dist/mocks.d.ts +6 -9
- package/dist/mocks.js +22 -24
- package/dist/mocks.js.map +1 -1
- package/dist/prompt-L5KFKY73.cjs +760 -0
- package/dist/prompt-L5KFKY73.cjs.map +1 -0
- package/dist/prompt-WQQUN22Z.js +749 -0
- package/dist/prompt-WQQUN22Z.js.map +1 -0
- package/dist/transformers.cjs +215 -49
- package/dist/transformers.cjs.map +1 -1
- package/dist/transformers.d.cts +1 -3
- package/dist/transformers.d.ts +1 -3
- package/dist/transformers.js +148 -35
- package/dist/transformers.js.map +1 -1
- package/dist/utils.cjs +65 -26
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +31 -3
- package/dist/utils.d.ts +31 -3
- package/dist/utils.js +3 -26
- package/dist/utils.js.map +1 -1
- package/package.json +10 -10
- package/src/BarrelManager.ts +93 -107
- package/src/{Generator.ts → BaseGenerator.ts} +1 -1
- package/src/FileManager.ts +198 -297
- package/src/PackageManager.ts +1 -1
- package/src/PluginManager.ts +152 -101
- package/src/__snapshots__/barrel.json +91 -0
- package/src/__snapshots__/grouped.json +114 -0
- package/src/__snapshots__/ordered.json +62 -0
- package/src/build.ts +86 -171
- package/src/errors.ts +0 -11
- package/src/index.ts +1 -2
- package/src/logger.ts +76 -34
- package/src/plugin.ts +3 -3
- package/src/transformers/index.ts +2 -3
- package/src/transformers/trim.ts +0 -4
- package/src/types.ts +35 -35
- package/src/utils/TreeNode.ts +132 -50
- package/src/utils/executeStrategies.ts +1 -1
- package/src/utils/index.ts +2 -1
- package/src/utils/parser.ts +157 -0
- package/dist/chunk-3OXCZ5DJ.js.map +0 -1
- package/dist/chunk-5JZNFPUP.js +0 -309
- package/dist/chunk-5JZNFPUP.js.map +0 -1
- package/dist/chunk-67C6RBGQ.cjs.map +0 -1
- package/dist/chunk-ADC5UNZ5.cjs +0 -1227
- package/dist/chunk-ADC5UNZ5.cjs.map +0 -1
- package/dist/chunk-HMLY7DHA.js +0 -16
- package/dist/chunk-HMLY7DHA.js.map +0 -1
- package/dist/chunk-JKZG2IJR.js +0 -283
- package/dist/chunk-JKZG2IJR.js.map +0 -1
- package/dist/chunk-LM2YQC3T.cjs.map +0 -1
- package/dist/chunk-PZT4CTBV.cjs +0 -299
- package/dist/chunk-PZT4CTBV.cjs.map +0 -1
- package/dist/chunk-SA2GZKXS.js +0 -596
- package/dist/chunk-SA2GZKXS.js.map +0 -1
- package/dist/chunk-XCPFG6DO.cjs +0 -66
- package/dist/chunk-XCPFG6DO.cjs.map +0 -1
- package/dist/chunk-YTSNYMHW.cjs +0 -320
- package/dist/chunk-YTSNYMHW.cjs.map +0 -1
- package/schema.json +0 -86
- package/src/utils/getParser.ts +0 -17
package/dist/chunk-XCPFG6DO.cjs
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __typeError = (msg) => {
|
|
8
|
-
throw TypeError(msg);
|
|
9
|
-
};
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __esm = (fn, res) => function __init() {
|
|
12
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
13
|
-
};
|
|
14
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
15
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
|
-
};
|
|
17
|
-
var __copyProps = (to, from, except, desc) => {
|
|
18
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
-
for (let key of __getOwnPropNames(from))
|
|
20
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
-
}
|
|
23
|
-
return to;
|
|
24
|
-
};
|
|
25
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
27
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
28
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
29
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
|
-
mod
|
|
32
|
-
));
|
|
33
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
35
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
36
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
37
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
38
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
39
|
-
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
40
|
-
set _(value) {
|
|
41
|
-
__privateSet(obj, member, value, setter);
|
|
42
|
-
},
|
|
43
|
-
get _() {
|
|
44
|
-
return __privateGet(obj, member, getter);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// ../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.47.7_@types+node@20.16.1__jiti@1.21.6_postcss@8.4.41_typescript@5.5.4_yaml@2.4.5/node_modules/tsup/assets/cjs_shims.js
|
|
49
|
-
var init_cjs_shims = __esm({
|
|
50
|
-
"../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.47.7_@types+node@20.16.1__jiti@1.21.6_postcss@8.4.41_typescript@5.5.4_yaml@2.4.5/node_modules/tsup/assets/cjs_shims.js"() {
|
|
51
|
-
"use strict";
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.__publicField = __publicField; exports.__privateGet = __privateGet; exports.__privateAdd = __privateAdd; exports.__privateSet = __privateSet; exports.__privateMethod = __privateMethod; exports.__privateWrapper = __privateWrapper; exports.init_cjs_shims = init_cjs_shims;
|
|
66
|
-
//# sourceMappingURL=chunk-XCPFG6DO.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/kubb/kubb/packages/core/dist/chunk-XCPFG6DO.cjs","../../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.47.7_@types+node@20.16.1__jiti@1.21.6_postcss@8.4.41_typescript@5.5.4_yaml@2.4.5/node_modules/tsup/assets/cjs_shims.js"],"names":[],"mappings":"AAAA,6EAAI,SAAS,EAA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AC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;AAC5C,EAAE,CAAC;AACH,EAAE,IAAI,CAAC,CAAC,EAAE;AACV,IAAI,OAAO,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC;AAC5C,EAAE;AACF,CAAC,CAAC;AACF;AACA;AC/CA,IAAA,eAAA,EAAA,KAAA,CAAA;AAAA,EAAA,uLAAA,CAAA,EAAA;AAAA,IAAA,YAAA;AAAA,EAAA;AAAA,CAAA,CAAA;ADqDA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,kVAAC","file":"/home/runner/work/kubb/kubb/packages/core/dist/chunk-XCPFG6DO.cjs","sourcesContent":[null,"// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () =>\n typeof document === 'undefined'\n ? new URL(`file:${__filename}`).href\n : (document.currentScript && document.currentScript.src) ||\n new URL('main.js', document.baseURI).href\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n"]}
|
package/dist/chunk-YTSNYMHW.cjs
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunk67C6RBGQcjs = require('./chunk-67C6RBGQ.cjs');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _chunkXCPFG6DOcjs = require('./chunk-XCPFG6DO.cjs');
|
|
11
|
-
|
|
12
|
-
// src/utils/index.ts
|
|
13
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
14
|
-
|
|
15
|
-
// src/utils/FunctionParams.ts
|
|
16
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
17
|
-
var _items, _FunctionParams_static, orderItems_fn, addParams_fn;
|
|
18
|
-
var _FunctionParams = class _FunctionParams {
|
|
19
|
-
constructor() {
|
|
20
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _items, []);
|
|
21
|
-
return this;
|
|
22
|
-
}
|
|
23
|
-
get items() {
|
|
24
|
-
return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _items).flat();
|
|
25
|
-
}
|
|
26
|
-
add(item) {
|
|
27
|
-
if (!item) {
|
|
28
|
-
return this;
|
|
29
|
-
}
|
|
30
|
-
if (Array.isArray(item)) {
|
|
31
|
-
item.filter(Boolean).forEach((it) => _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _items).push(it));
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _items).push(item);
|
|
35
|
-
return this;
|
|
36
|
-
}
|
|
37
|
-
static toObject(items) {
|
|
38
|
-
let type = [];
|
|
39
|
-
let name = [];
|
|
40
|
-
const enabled = items.every((item) => item.enabled) ? _optionalChain([items, 'access', _ => _.at, 'call', _2 => _2(0), 'optionalAccess', _3 => _3.enabled]) : true;
|
|
41
|
-
const required = _nullishCoalesce(items.every((item) => item.required), () => ( true));
|
|
42
|
-
items.forEach((item) => {
|
|
43
|
-
var _a, _b;
|
|
44
|
-
name = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, _a = _FunctionParams, _FunctionParams_static, addParams_fn).call(_a, name, { ...item, type: void 0 });
|
|
45
|
-
if (items.some((item2) => item2.type)) {
|
|
46
|
-
type = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, _b = _FunctionParams, _FunctionParams_static, addParams_fn).call(_b, type, item);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
return {
|
|
50
|
-
name: `{ ${name.join(", ")} }`,
|
|
51
|
-
type: type.length ? `{ ${type.join("; ")} }` : void 0,
|
|
52
|
-
enabled,
|
|
53
|
-
required
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
static toString(items) {
|
|
57
|
-
var _a;
|
|
58
|
-
const sortedData = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, _a = _FunctionParams, _FunctionParams_static, orderItems_fn).call(_a, items);
|
|
59
|
-
return sortedData.reduce((acc, item) => {
|
|
60
|
-
var _a2, _b, _c;
|
|
61
|
-
if (Array.isArray(item)) {
|
|
62
|
-
if (item.length <= 0) {
|
|
63
|
-
return acc;
|
|
64
|
-
}
|
|
65
|
-
const subItems = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, _a2 = _FunctionParams, _FunctionParams_static, orderItems_fn).call(_a2, item);
|
|
66
|
-
const objectItem = _FunctionParams.toObject(subItems);
|
|
67
|
-
return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, _b = _FunctionParams, _FunctionParams_static, addParams_fn).call(_b, acc, objectItem);
|
|
68
|
-
}
|
|
69
|
-
return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, _c = _FunctionParams, _FunctionParams_static, addParams_fn).call(_c, acc, item);
|
|
70
|
-
}, []).join(", ");
|
|
71
|
-
}
|
|
72
|
-
toObject() {
|
|
73
|
-
var _a;
|
|
74
|
-
const items = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, _a = _FunctionParams, _FunctionParams_static, orderItems_fn).call(_a, _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _items)).flat();
|
|
75
|
-
return _FunctionParams.toObject(items);
|
|
76
|
-
}
|
|
77
|
-
toString() {
|
|
78
|
-
var _a;
|
|
79
|
-
const items = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, _a = _FunctionParams, _FunctionParams_static, orderItems_fn).call(_a, _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _items));
|
|
80
|
-
return _FunctionParams.toString(items);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
_items = new WeakMap();
|
|
84
|
-
_FunctionParams_static = new WeakSet();
|
|
85
|
-
orderItems_fn = function(items) {
|
|
86
|
-
return _chunk67C6RBGQcjs.orderBy.call(void 0,
|
|
87
|
-
items.filter(Boolean),
|
|
88
|
-
[
|
|
89
|
-
(v) => {
|
|
90
|
-
if (Array.isArray(v)) {
|
|
91
|
-
return void 0;
|
|
92
|
-
}
|
|
93
|
-
return !v.default;
|
|
94
|
-
},
|
|
95
|
-
(v) => {
|
|
96
|
-
if (Array.isArray(v)) {
|
|
97
|
-
return void 0;
|
|
98
|
-
}
|
|
99
|
-
return _nullishCoalesce(v.required, () => ( true));
|
|
100
|
-
}
|
|
101
|
-
],
|
|
102
|
-
["desc", "desc"]
|
|
103
|
-
);
|
|
104
|
-
};
|
|
105
|
-
addParams_fn = function(acc, item) {
|
|
106
|
-
const { enabled = true, name, type, required = true, ...rest } = item;
|
|
107
|
-
if (!enabled) {
|
|
108
|
-
return acc;
|
|
109
|
-
}
|
|
110
|
-
if (!name) {
|
|
111
|
-
acc.push(`${type}${rest.default ? ` = ${rest.default}` : ""}`);
|
|
112
|
-
return acc;
|
|
113
|
-
}
|
|
114
|
-
const parameterName = name.startsWith("{") ? name : _chunk67C6RBGQcjs.camelCase.call(void 0, name);
|
|
115
|
-
if (type) {
|
|
116
|
-
if (required) {
|
|
117
|
-
acc.push(`${parameterName}: ${type}${rest.default ? ` = ${rest.default}` : ""}`);
|
|
118
|
-
} else {
|
|
119
|
-
acc.push(`${parameterName}?: ${type}`);
|
|
120
|
-
}
|
|
121
|
-
} else {
|
|
122
|
-
acc.push(`${parameterName}`);
|
|
123
|
-
}
|
|
124
|
-
return acc;
|
|
125
|
-
};
|
|
126
|
-
_chunkXCPFG6DOcjs.__privateAdd.call(void 0, _FunctionParams, _FunctionParams_static);
|
|
127
|
-
var FunctionParams = _FunctionParams;
|
|
128
|
-
|
|
129
|
-
// src/utils/promise.ts
|
|
130
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
131
|
-
function isPromise(result) {
|
|
132
|
-
return !!result && typeof _optionalChain([result, 'optionalAccess', _4 => _4.then]) === "function";
|
|
133
|
-
}
|
|
134
|
-
function isPromiseFulfilledResult(result) {
|
|
135
|
-
return result.status === "fulfilled";
|
|
136
|
-
}
|
|
137
|
-
function isPromiseRejectedResult(result) {
|
|
138
|
-
return result.status === "rejected";
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// src/utils/renderTemplate.ts
|
|
142
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
143
|
-
function renderTemplate(template, data = void 0) {
|
|
144
|
-
if (!data || !Object.keys(data).length) {
|
|
145
|
-
return template.replace(/{{(.*?)}}/g, "");
|
|
146
|
-
}
|
|
147
|
-
const matches = template.match(/{{(.*?)}}/g);
|
|
148
|
-
return _optionalChain([matches, 'optionalAccess', _5 => _5.reduce, 'call', _6 => _6((prev, curr) => {
|
|
149
|
-
const index = _optionalChain([curr, 'access', _7 => _7.split, 'call', _8 => _8(/{{|}}/), 'access', _9 => _9.filter, 'call', _10 => _10(Boolean), 'access', _11 => _11[0], 'optionalAccess', _12 => _12.trim, 'call', _13 => _13()]);
|
|
150
|
-
if (index === void 0) {
|
|
151
|
-
return prev;
|
|
152
|
-
}
|
|
153
|
-
const value = data[index];
|
|
154
|
-
if (value === void 0) {
|
|
155
|
-
return prev;
|
|
156
|
-
}
|
|
157
|
-
return prev.replace(curr, () => {
|
|
158
|
-
if (typeof value === "boolean") {
|
|
159
|
-
return `${value.toString()}` || "false";
|
|
160
|
-
}
|
|
161
|
-
return value || "";
|
|
162
|
-
}).trim();
|
|
163
|
-
}, template)]) || "";
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// src/utils/timeout.ts
|
|
167
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
168
|
-
async function timeout(ms) {
|
|
169
|
-
return new Promise((resolve) => {
|
|
170
|
-
setTimeout(() => {
|
|
171
|
-
resolve(true);
|
|
172
|
-
}, ms);
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// src/utils/uniqueName.ts
|
|
177
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
178
|
-
function getUniqueName(originalName, data) {
|
|
179
|
-
let used = data[originalName] || 0;
|
|
180
|
-
if (used) {
|
|
181
|
-
data[originalName] = ++used;
|
|
182
|
-
originalName += used;
|
|
183
|
-
}
|
|
184
|
-
data[originalName] = 1;
|
|
185
|
-
return originalName;
|
|
186
|
-
}
|
|
187
|
-
function setUniqueName(originalName, data) {
|
|
188
|
-
let used = data[originalName] || 0;
|
|
189
|
-
if (used) {
|
|
190
|
-
data[originalName] = ++used;
|
|
191
|
-
return originalName;
|
|
192
|
-
}
|
|
193
|
-
data[originalName] = 1;
|
|
194
|
-
return originalName;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// src/utils/URLPath.ts
|
|
198
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
199
|
-
var URLPath = class {
|
|
200
|
-
constructor(path) {
|
|
201
|
-
this.path = path;
|
|
202
|
-
return this;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Convert Swagger path to URLPath(syntax of Express)
|
|
206
|
-
* @example /pet/{petId} => /pet/:petId
|
|
207
|
-
*/
|
|
208
|
-
get URL() {
|
|
209
|
-
return this.toURLPath();
|
|
210
|
-
}
|
|
211
|
-
get isURL() {
|
|
212
|
-
try {
|
|
213
|
-
const url = new URL(this.path);
|
|
214
|
-
if (_optionalChain([url, 'optionalAccess', _14 => _14.href])) {
|
|
215
|
-
return true;
|
|
216
|
-
}
|
|
217
|
-
} catch (error) {
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
return false;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Convert Swagger path to template literals/ template strings(camelcase)
|
|
224
|
-
* @example /pet/{petId} => `/pet/${petId}`
|
|
225
|
-
* @example /account/monetary-accountID => `/account/${monetaryAccountId}`
|
|
226
|
-
* @example /account/userID => `/account/${userId}`
|
|
227
|
-
*/
|
|
228
|
-
get template() {
|
|
229
|
-
return this.toTemplateString();
|
|
230
|
-
}
|
|
231
|
-
get object() {
|
|
232
|
-
return this.toObject();
|
|
233
|
-
}
|
|
234
|
-
get params() {
|
|
235
|
-
return this.getParams();
|
|
236
|
-
}
|
|
237
|
-
toObject({ type = "path", replacer, stringify } = {}) {
|
|
238
|
-
const object = {
|
|
239
|
-
url: type === "path" ? this.toURLPath() : this.toTemplateString(replacer),
|
|
240
|
-
params: this.getParams()
|
|
241
|
-
};
|
|
242
|
-
if (stringify) {
|
|
243
|
-
if (type === "template") {
|
|
244
|
-
return JSON.stringify(object).replaceAll("'", "").replaceAll(`"`, "");
|
|
245
|
-
}
|
|
246
|
-
if (object.params) {
|
|
247
|
-
return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll("'", "").replaceAll(`"`, "")} }`;
|
|
248
|
-
}
|
|
249
|
-
return `{ url: '${object.url}' }`;
|
|
250
|
-
}
|
|
251
|
-
return object;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Convert Swagger path to template literals/ template strings(camelcase)
|
|
255
|
-
* @example /pet/{petId} => `/pet/${petId}`
|
|
256
|
-
* @example /account/monetary-accountID => `/account/${monetaryAccountId}`
|
|
257
|
-
* @example /account/userID => `/account/${userId}`
|
|
258
|
-
*/
|
|
259
|
-
toTemplateString(replacer) {
|
|
260
|
-
const regex = /{(\w|-)*}/g;
|
|
261
|
-
const found = this.path.match(regex);
|
|
262
|
-
let newPath = this.path.replaceAll("{", "${");
|
|
263
|
-
if (found) {
|
|
264
|
-
newPath = found.reduce((prev, curr) => {
|
|
265
|
-
const pathParam = replacer ? replacer(_chunk67C6RBGQcjs.camelCase.call(void 0, curr)) : _chunk67C6RBGQcjs.camelCase.call(void 0, curr);
|
|
266
|
-
const replacement = `\${${pathParam}}`;
|
|
267
|
-
return prev.replace(curr, replacement);
|
|
268
|
-
}, this.path);
|
|
269
|
-
}
|
|
270
|
-
return `\`${newPath}\``;
|
|
271
|
-
}
|
|
272
|
-
getParams(replacer) {
|
|
273
|
-
const regex = /{(\w|-)*}/g;
|
|
274
|
-
const found = this.path.match(regex);
|
|
275
|
-
if (!found) {
|
|
276
|
-
return void 0;
|
|
277
|
-
}
|
|
278
|
-
const params = {};
|
|
279
|
-
found.forEach((item) => {
|
|
280
|
-
item = item.replaceAll("{", "").replaceAll("}", "");
|
|
281
|
-
const pathParam = replacer ? replacer(_chunk67C6RBGQcjs.camelCase.call(void 0, item)) : _chunk67C6RBGQcjs.camelCase.call(void 0, item);
|
|
282
|
-
params[pathParam] = pathParam;
|
|
283
|
-
}, this.path);
|
|
284
|
-
return params;
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Convert Swagger path to URLPath(syntax of Express)
|
|
288
|
-
* @example /pet/{petId} => /pet/:petId
|
|
289
|
-
*/
|
|
290
|
-
toURLPath() {
|
|
291
|
-
return this.path.replaceAll("{", ":").replaceAll("}", "");
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
// src/utils/getParser.ts
|
|
296
|
-
_chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
|
|
297
|
-
async function getParser(language) {
|
|
298
|
-
let modulePromise;
|
|
299
|
-
switch (language) {
|
|
300
|
-
default:
|
|
301
|
-
modulePromise = Promise.resolve().then(() => _interopRequireWildcard(require("@kubb/parser-ts")));
|
|
302
|
-
break;
|
|
303
|
-
}
|
|
304
|
-
const module = await modulePromise;
|
|
305
|
-
return module;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
exports.FunctionParams = FunctionParams; exports.isPromise = isPromise; exports.isPromiseFulfilledResult = isPromiseFulfilledResult; exports.isPromiseRejectedResult = isPromiseRejectedResult; exports.renderTemplate = renderTemplate; exports.timeout = timeout; exports.getUniqueName = getUniqueName; exports.setUniqueName = setUniqueName; exports.URLPath = URLPath; exports.getParser = getParser;
|
|
320
|
-
//# sourceMappingURL=chunk-YTSNYMHW.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/kubb/kubb/packages/core/dist/chunk-YTSNYMHW.cjs","../src/utils/index.ts","../src/utils/FunctionParams.ts","../src/utils/promise.ts","../src/utils/renderTemplate.ts","../src/utils/timeout.ts","../src/utils/uniqueName.ts","../src/utils/URLPath.ts","../src/utils/getParser.ts"],"names":["item","_a"],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACXA,8CAAA,CAAA;ADaA;AACA;AEdA,8CAAA,CAAA;AAAA,IAAA,MAAA,EAAA,sBAAA,EAAA,aAAA,EAAA,YAAA;AAuCO,IAAM,gBAAA,EAAN,MAAM,gBAAe;AAAA,EAE1B,WAAA,CAAA,EAAc;AADd,IAAA,4CAAA,IAAA,EAAA,MAAA,EAAyD,CAAC,CAAA,CAAA;AAExD,IAAA,OAAO,IAAA;AAAA,EACT;AAAA,EAEA,IAAI,KAAA,CAA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ED,IAAA;AACI,MAAA;AACT,IAAA;AAEM,IAAA;AACA,IAAA;AACG,MAAA;AAED,MAAA;AAEC,MAAA;AACD,IAAA;AAED,IAAA;AACT,EAAA;AAAA;AAAA;AAAA;AAAA;AAMoB,EAAA;AACX,IAAA;AACT,EAAA;AACF;APqKc;AACA;AQtSd;AAIA;AACM,EAAA;AAEI,EAAA;AACN,IAAA;AACE,MAAA;AACA,MAAA;AACJ,EAAA;AAEM,EAAA;AAEC,EAAA;AACT;ARkSc;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/kubb/kubb/packages/core/dist/chunk-YTSNYMHW.cjs","sourcesContent":[null,"export type { FunctionParamsAST } from './FunctionParams.ts'\nexport { FunctionParams } from './FunctionParams.ts'\nexport {\n isPromise,\n isPromiseFulfilledResult,\n isPromiseRejectedResult,\n} from './promise.ts'\nexport { renderTemplate } from './renderTemplate.ts'\nexport { timeout } from './timeout.ts'\nexport { getUniqueName, setUniqueName } from './uniqueName.ts'\nexport type { URLObject } from './URLPath.ts'\nexport { URLPath } from './URLPath.ts'\nexport { getParser } from './getParser.ts'\n","import { orderBy } from 'natural-orderby'\n\nimport { camelCase } from '../transformers/casing.ts'\n\ntype FunctionParamsASTWithoutType = {\n name?: string\n type?: string\n /**\n * @default true\n */\n required?: boolean\n /**\n * @default true\n */\n enabled?: boolean\n default?: string\n}\n\ntype FunctionParamsASTWithType = {\n name?: never\n type: string\n /**\n * @default true\n */\n required?: boolean\n /**\n * @default true\n */\n enabled?: boolean\n default?: string\n}\n/**\n * @deprecated\n */\nexport type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType\n\n/**\n * @deprecated\n */\nexport class FunctionParams {\n #items: Array<FunctionParamsAST | FunctionParamsAST[]> = []\n constructor() {\n return this\n }\n\n get items(): FunctionParamsAST[] {\n return this.#items.flat()\n }\n\n add(item: FunctionParamsAST | Array<FunctionParamsAST | FunctionParamsAST[] | undefined> | undefined): FunctionParams {\n if (!item) {\n return this\n }\n\n if (Array.isArray(item)) {\n item.filter(Boolean).forEach((it) => this.#items.push(it))\n return this\n }\n this.#items.push(item)\n\n return this\n }\n static #orderItems(items: Array<FunctionParamsAST | FunctionParamsAST[]>) {\n return orderBy(\n items.filter(Boolean),\n [\n (v) => {\n if (Array.isArray(v)) {\n return undefined\n }\n return !v.default\n },\n (v) => {\n if (Array.isArray(v)) {\n return undefined\n }\n return v.required ?? true\n },\n ],\n ['desc', 'desc'],\n )\n }\n\n static #addParams(acc: string[], item: FunctionParamsAST) {\n const { enabled = true, name, type, required = true, ...rest } = item\n\n if (!enabled) {\n return acc\n }\n\n if (!name) {\n // when name is not se we will use TypeScript generics\n acc.push(`${type}${rest.default ? ` = ${rest.default}` : ''}`)\n\n return acc\n }\n // TODO check whey we still need the camelcase here\n const parameterName = name.startsWith('{') ? name : camelCase(name)\n\n if (type) {\n if (required) {\n acc.push(`${parameterName}: ${type}${rest.default ? ` = ${rest.default}` : ''}`)\n } else {\n acc.push(`${parameterName}?: ${type}`)\n }\n } else {\n acc.push(`${parameterName}`)\n }\n\n return acc\n }\n\n static toObject(items: FunctionParamsAST[]): FunctionParamsAST {\n let type: string[] = []\n let name: string[] = []\n\n const enabled = items.every((item) => item.enabled) ? items.at(0)?.enabled : true\n const required = items.every((item) => item.required) ?? true\n\n items.forEach((item) => {\n name = FunctionParams.#addParams(name, { ...item, type: undefined })\n if (items.some((item) => item.type)) {\n type = FunctionParams.#addParams(type, item)\n }\n })\n\n return {\n name: `{ ${name.join(', ')} }`,\n type: type.length ? `{ ${type.join('; ')} }` : undefined,\n enabled,\n required,\n }\n }\n\n static toString(items: (FunctionParamsAST | FunctionParamsAST[])[]): string {\n const sortedData = FunctionParams.#orderItems(items)\n\n return sortedData\n .reduce((acc, item) => {\n if (Array.isArray(item)) {\n if (item.length <= 0) {\n return acc\n }\n const subItems = FunctionParams.#orderItems(item) as FunctionParamsAST[]\n const objectItem = FunctionParams.toObject(subItems)\n\n return FunctionParams.#addParams(acc, objectItem)\n }\n\n return FunctionParams.#addParams(acc, item)\n }, [] as string[])\n .join(', ')\n }\n\n toObject(): FunctionParamsAST {\n const items = FunctionParams.#orderItems(this.#items).flat()\n\n return FunctionParams.toObject(items)\n }\n\n toString(): string {\n const items = FunctionParams.#orderItems(this.#items)\n\n return FunctionParams.toString(items)\n }\n}\n","import type { PossiblePromise } from '@kubb/types'\n\nexport function isPromise<T>(result: PossiblePromise<T>): result is Promise<T> {\n return !!result && typeof (result as Promise<unknown>)?.then === 'function'\n}\n\nexport function isPromiseFulfilledResult<T = unknown>(result: PromiseSettledResult<unknown>): result is PromiseFulfilledResult<T> {\n return result.status === 'fulfilled'\n}\n\nexport function isPromiseRejectedResult<T>(result: PromiseSettledResult<unknown>): result is Omit<PromiseRejectedResult, 'reason'> & { reason: T } {\n return result.status === 'rejected'\n}\n","export function renderTemplate<TData extends Record<string, unknown> = Record<string, unknown>>(template: string, data: TData | undefined = undefined): string {\n if (!data || !Object.keys(data).length) {\n return template.replace(/{{(.*?)}}/g, '')\n }\n\n const matches = template.match(/{{(.*?)}}/g)\n\n return (\n matches?.reduce((prev, curr) => {\n const index = curr.split(/{{|}}/).filter(Boolean)[0]?.trim()\n if (index === undefined) {\n return prev\n }\n const value = data[index]\n\n if (value === undefined) {\n return prev\n }\n\n return prev\n .replace(curr, () => {\n if (typeof value === 'boolean') {\n return `${value.toString()}` || 'false'\n }\n\n return (value as string) || ''\n })\n .trim()\n }, template) || ''\n )\n}\n","export async function timeout(ms: number): Promise<unknown> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(true)\n }, ms)\n })\n}\n","export function getUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n originalName += used\n }\n data[originalName] = 1\n return originalName\n}\n\nexport function setUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n\n return originalName\n }\n data[originalName] = 1\n return originalName\n}\n","import { camelCase } from '../transformers/casing.ts'\n\nexport type URLObject = {\n url: string\n params?: Record<string, string>\n}\n\ntype ObjectOptions = {\n type?: 'path' | 'template'\n replacer?: (pathParam: string) => string\n stringify?: boolean\n}\n\nexport class URLPath {\n path: string\n\n constructor(path: string) {\n this.path = path\n\n return this\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n get URL(): string {\n return this.toURLPath()\n }\n get isURL(): boolean {\n try {\n const url = new URL(this.path)\n if (url?.href) {\n return true\n }\n } catch (error) {\n return false\n }\n return false\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n get template(): string {\n return this.toTemplateString()\n }\n get object(): URLObject | string {\n return this.toObject()\n }\n get params(): Record<string, string> | undefined {\n return this.getParams()\n }\n\n toObject({ type = 'path', replacer, stringify }: ObjectOptions = {}): URLObject | string {\n const object = {\n url: type === 'path' ? this.toURLPath() : this.toTemplateString(replacer),\n params: this.getParams(),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n\n /**\n * Convert Swagger path to template literals/ template strings(camelcase)\n * @example /pet/{petId} => `/pet/${petId}`\n * @example /account/monetary-accountID => `/account/${monetaryAccountId}`\n * @example /account/userID => `/account/${userId}`\n */\n toTemplateString(replacer?: (pathParam: string) => string): string {\n const regex = /{(\\w|-)*}/g\n const found = this.path.match(regex)\n let newPath = this.path.replaceAll('{', '${')\n\n if (found) {\n newPath = found.reduce((prev, curr) => {\n const pathParam = replacer ? replacer(camelCase(curr)) : camelCase(curr)\n const replacement = `\\${${pathParam}}`\n\n return prev.replace(curr, replacement)\n }, this.path)\n }\n\n return `\\`${newPath}\\``\n }\n\n getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined {\n const regex = /{(\\w|-)*}/g\n const found = this.path.match(regex)\n\n if (!found) {\n return undefined\n }\n\n const params: Record<string, string> = {}\n found.forEach((item) => {\n item = item.replaceAll('{', '').replaceAll('}', '')\n\n const pathParam = replacer ? replacer(camelCase(item)) : camelCase(item)\n\n params[pathParam] = pathParam\n }, this.path)\n\n return params\n }\n\n /**\n * Convert Swagger path to URLPath(syntax of Express)\n * @example /pet/{petId} => /pet/:petId\n */\n toURLPath(): string {\n return this.path.replaceAll('{', ':').replaceAll('}', '')\n }\n}\n","type ParserModuleTs = typeof import('@kubb/parser-ts')\n\nexport type ParserModule = ParserModuleTs\n\nexport async function getParser(language: string | undefined) {\n let modulePromise: Promise<ParserModule>\n\n switch (language) {\n default:\n modulePromise = import('@kubb/parser-ts')\n break\n }\n\n const module = await modulePromise\n\n return module\n}\n"]}
|
package/schema.json
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "@kubb/define-config",
|
|
4
|
-
"title": "JSON schema for @kubb/core define-config",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"required": [],
|
|
7
|
-
"properties": {
|
|
8
|
-
"root": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"description": "Project root directory. Can be an absolute path, or a path relative from the location of the config file itself.",
|
|
11
|
-
"default": "process.cwd()"
|
|
12
|
-
},
|
|
13
|
-
"input": {
|
|
14
|
-
"type": "object",
|
|
15
|
-
"description": "",
|
|
16
|
-
"properties": {
|
|
17
|
-
"path": {
|
|
18
|
-
"type": "string",
|
|
19
|
-
"description": "Path to be used as the input. Can be an absolute path, or a path relative from the defined root option."
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"output": {
|
|
24
|
-
"type": "object",
|
|
25
|
-
"description": "",
|
|
26
|
-
"properties": {
|
|
27
|
-
"path": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"description": "Path to be used to export all generated files. Can be an absolute path, or a path relative based of the defined root option."
|
|
30
|
-
},
|
|
31
|
-
"clean": {
|
|
32
|
-
"type": "boolean",
|
|
33
|
-
"description": "Remove previous generated files and folders."
|
|
34
|
-
},
|
|
35
|
-
"write": {
|
|
36
|
-
"type": "boolean",
|
|
37
|
-
"description": "Enabled or disable the writing to the filesystem. This is being used for the playground.",
|
|
38
|
-
"default": "true"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
"hooks": {
|
|
43
|
-
"type": "object",
|
|
44
|
-
"description": "Hooks that can be called when a specific action is done in Kubb. ",
|
|
45
|
-
"properties": {
|
|
46
|
-
"done": {
|
|
47
|
-
"oneOf": [
|
|
48
|
-
{
|
|
49
|
-
"type": "string",
|
|
50
|
-
"description": "Hook that will be called at the end of all executions. Useful for running Prettier or ESLint to use your own linting structure."
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"type": "array",
|
|
54
|
-
"items": {
|
|
55
|
-
"type": "string"
|
|
56
|
-
},
|
|
57
|
-
"description": "Hook that will be called at the end of all executions. Useful for running Prettier or ESLint to use your own linting structure."
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
"plugins": {
|
|
64
|
-
"oneOf": [
|
|
65
|
-
{
|
|
66
|
-
"type": "array",
|
|
67
|
-
"items": {
|
|
68
|
-
"type": "array",
|
|
69
|
-
"prefixItems": [
|
|
70
|
-
{
|
|
71
|
-
"type": "string"
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
"items": {
|
|
75
|
-
"type": "object"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"type": "object"
|
|
81
|
-
}
|
|
82
|
-
],
|
|
83
|
-
"description": "Plugins"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
package/src/utils/getParser.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
type ParserModuleTs = typeof import('@kubb/parser-ts')
|
|
2
|
-
|
|
3
|
-
export type ParserModule = ParserModuleTs
|
|
4
|
-
|
|
5
|
-
export async function getParser(language: string | undefined) {
|
|
6
|
-
let modulePromise: Promise<ParserModule>
|
|
7
|
-
|
|
8
|
-
switch (language) {
|
|
9
|
-
default:
|
|
10
|
-
modulePromise = import('@kubb/parser-ts')
|
|
11
|
-
break
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const module = await modulePromise
|
|
15
|
-
|
|
16
|
-
return module
|
|
17
|
-
}
|