@kubb/plugin-ts 5.0.15 → 5.0.16
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 +1 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -62
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1642,7 +1642,7 @@ var compatibility = {
|
|
|
1642
1642
|
};
|
|
1643
1643
|
//#endregion
|
|
1644
1644
|
//#region package.json
|
|
1645
|
-
var version = "5.0.
|
|
1645
|
+
var version = "5.0.16";
|
|
1646
1646
|
//#endregion
|
|
1647
1647
|
//#region src/resolvers/resolverTs.ts
|
|
1648
1648
|
/**
|
|
@@ -1688,53 +1688,6 @@ const resolverTs = (0, kubb_kit.createResolver)({
|
|
|
1688
1688
|
* cross-plugin dependency references.
|
|
1689
1689
|
*/
|
|
1690
1690
|
const pluginTsName = "plugin-ts";
|
|
1691
|
-
const allowedEnumTypes = [
|
|
1692
|
-
"asConst",
|
|
1693
|
-
"enum",
|
|
1694
|
-
"constEnum",
|
|
1695
|
-
"literal",
|
|
1696
|
-
"inlineLiteral"
|
|
1697
|
-
];
|
|
1698
|
-
const allowedSyntaxTypes = ["type", "interface"];
|
|
1699
|
-
const allowedArrayTypes = ["array", "generic"];
|
|
1700
|
-
const allowedOptionalTypes = [
|
|
1701
|
-
"questionToken",
|
|
1702
|
-
"undefined",
|
|
1703
|
-
"questionTokenAndUndefined"
|
|
1704
|
-
];
|
|
1705
|
-
/**
|
|
1706
|
-
* Throws when an enum-like option holds a value outside its allowed set. Options left out are skipped.
|
|
1707
|
-
*/
|
|
1708
|
-
function assertEnumLikeOptions({ prefix, options }) {
|
|
1709
|
-
const checks = [
|
|
1710
|
-
{
|
|
1711
|
-
option: "enum.type",
|
|
1712
|
-
value: options.enum?.type,
|
|
1713
|
-
allowed: allowedEnumTypes
|
|
1714
|
-
},
|
|
1715
|
-
{
|
|
1716
|
-
option: "syntaxType",
|
|
1717
|
-
value: options.syntaxType,
|
|
1718
|
-
allowed: allowedSyntaxTypes
|
|
1719
|
-
},
|
|
1720
|
-
{
|
|
1721
|
-
option: "arrayType",
|
|
1722
|
-
value: options.arrayType,
|
|
1723
|
-
allowed: allowedArrayTypes
|
|
1724
|
-
},
|
|
1725
|
-
{
|
|
1726
|
-
option: "optionalType",
|
|
1727
|
-
value: options.optionalType,
|
|
1728
|
-
allowed: allowedOptionalTypes
|
|
1729
|
-
}
|
|
1730
|
-
];
|
|
1731
|
-
for (const { option, value, allowed } of checks) if (value !== void 0) (0, kubb_kit.assertPluginOption)({
|
|
1732
|
-
plugin: pluginTsName,
|
|
1733
|
-
option: `${prefix}${option}`,
|
|
1734
|
-
value,
|
|
1735
|
-
allowed
|
|
1736
|
-
});
|
|
1737
|
-
}
|
|
1738
1691
|
/**
|
|
1739
1692
|
* Generates TypeScript `type` aliases and `interface` declarations from an
|
|
1740
1693
|
* OpenAPI spec. The foundation that every other Kubb plugin builds on:
|
|
@@ -1777,19 +1730,6 @@ const pluginTs = (0, kubb_kit.defineExtension)({
|
|
|
1777
1730
|
typeSuffix: enumOptions.typeSuffix ?? "Key",
|
|
1778
1731
|
keyCasing: enumOptions.keyCasing ?? "none"
|
|
1779
1732
|
};
|
|
1780
|
-
assertEnumLikeOptions({
|
|
1781
|
-
prefix: "",
|
|
1782
|
-
options: {
|
|
1783
|
-
enum: resolvedEnum,
|
|
1784
|
-
syntaxType,
|
|
1785
|
-
arrayType,
|
|
1786
|
-
optionalType
|
|
1787
|
-
}
|
|
1788
|
-
});
|
|
1789
|
-
for (const [index, entry] of override.entries()) assertEnumLikeOptions({
|
|
1790
|
-
prefix: `override[${index}].options.`,
|
|
1791
|
-
options: entry.options
|
|
1792
|
-
});
|
|
1793
1733
|
(0, kubb_kit.setResolver)(userResolver ? kubb_kit.Resolver.merge(resolverTs, userResolver) : resolverTs);
|
|
1794
1734
|
if (userMacros?.length) (0, kubb_kit.setMacros)(userMacros);
|
|
1795
1735
|
(0, kubb_kit.addGenerator)(typeGenerator);
|