@kubb/plugin-ts 5.0.6 → 5.0.8
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/OVERVIEW.md +17 -0
- package/dist/index.cjs +52 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +53 -44
- package/dist/index.js.map +1 -1
- package/kubb-extension.json +277 -0
- package/package.json +8 -5
package/dist/index.d.ts
CHANGED
|
@@ -511,7 +511,7 @@ export declare const pluginTsName = "plugin-ts";
|
|
|
511
511
|
* })
|
|
512
512
|
* ```
|
|
513
513
|
*/
|
|
514
|
-
export declare const pluginTs:
|
|
514
|
+
export declare const pluginTs: import("kubb/kit").PluginFactory<PluginTs>;
|
|
515
515
|
//#endregion
|
|
516
516
|
//#region src/printers/functionParams.d.ts
|
|
517
517
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { n as __name, t as __exportAll } from "./rolldown-runtime-CthDji9g.js";
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { parserTs } from "@kubb/parser-ts";
|
|
4
4
|
import { File, jsxRenderer } from "kubb/jsx";
|
|
5
|
-
import { Resolver, assertPluginOption, ast, createResolver, defineGenerator, definePlugin, isStringType, syncSchemaRef } from "kubb/kit";
|
|
5
|
+
import { Resolver, addGenerator, assertPluginOption, ast, createResolver, defineGenerator, definePlugin, isStringType, setMacros, setResolver, syncSchemaRef } from "kubb/kit";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "kubb/jsx/jsx-runtime";
|
|
7
7
|
//#region ../../internals/utils/src/casing.ts
|
|
8
8
|
/**
|
|
@@ -1831,6 +1831,15 @@ const typeGenerator = defineGenerator({
|
|
|
1831
1831
|
}
|
|
1832
1832
|
});
|
|
1833
1833
|
//#endregion
|
|
1834
|
+
//#region kubb-extension.json
|
|
1835
|
+
var compatibility = {
|
|
1836
|
+
"kubb": ">=5.8.0",
|
|
1837
|
+
"node": ">=22"
|
|
1838
|
+
};
|
|
1839
|
+
//#endregion
|
|
1840
|
+
//#region package.json
|
|
1841
|
+
var version = "5.0.8";
|
|
1842
|
+
//#endregion
|
|
1834
1843
|
//#region src/resolvers/resolverTs.ts
|
|
1835
1844
|
/**
|
|
1836
1845
|
* Default resolver used by `@kubb/plugin-ts`. Decides the names and file paths
|
|
@@ -1946,52 +1955,52 @@ function assertEnumLikeOptions({ prefix, options }) {
|
|
|
1946
1955
|
* })
|
|
1947
1956
|
* ```
|
|
1948
1957
|
*/
|
|
1949
|
-
const pluginTs = definePlugin(
|
|
1950
|
-
|
|
1951
|
-
path: "types",
|
|
1952
|
-
barrel: { type: "named" }
|
|
1953
|
-
}, group, exclude = [], include, override = [], enum: enumOptions = {}, optionalType = "questionToken", arrayType = "array", syntaxType = "type", printer, resolver: userResolver, macros: userMacros } = options;
|
|
1954
|
-
const groupConfig = createGroupConfig(group);
|
|
1955
|
-
const resolvedEnum = {
|
|
1956
|
-
type: enumOptions.type ?? "asConst",
|
|
1957
|
-
constCasing: enumOptions.constCasing ?? "camelCase",
|
|
1958
|
-
typeSuffix: enumOptions.typeSuffix ?? "Key",
|
|
1959
|
-
keyCasing: enumOptions.keyCasing ?? "none"
|
|
1960
|
-
};
|
|
1961
|
-
return {
|
|
1958
|
+
const pluginTs = definePlugin({
|
|
1959
|
+
meta: {
|
|
1962
1960
|
name: pluginTsName,
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
exclude,
|
|
1981
|
-
include,
|
|
1982
|
-
override,
|
|
1983
|
-
optionalType,
|
|
1984
|
-
group: groupConfig,
|
|
1985
|
-
arrayType,
|
|
1961
|
+
version,
|
|
1962
|
+
compatibility
|
|
1963
|
+
},
|
|
1964
|
+
setup(options) {
|
|
1965
|
+
const { output = {
|
|
1966
|
+
path: "types",
|
|
1967
|
+
barrel: { type: "named" }
|
|
1968
|
+
}, group, exclude = [], include, override = [], enum: enumOptions = {}, optionalType = "questionToken", arrayType = "array", syntaxType = "type", printer, resolver: userResolver, macros: userMacros } = options;
|
|
1969
|
+
const resolvedEnum = {
|
|
1970
|
+
type: enumOptions.type ?? "asConst",
|
|
1971
|
+
constCasing: enumOptions.constCasing ?? "camelCase",
|
|
1972
|
+
typeSuffix: enumOptions.typeSuffix ?? "Key",
|
|
1973
|
+
keyCasing: enumOptions.keyCasing ?? "none"
|
|
1974
|
+
};
|
|
1975
|
+
assertEnumLikeOptions({
|
|
1976
|
+
prefix: "",
|
|
1977
|
+
options: {
|
|
1986
1978
|
enum: resolvedEnum,
|
|
1987
1979
|
syntaxType,
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1980
|
+
arrayType,
|
|
1981
|
+
optionalType
|
|
1982
|
+
}
|
|
1983
|
+
});
|
|
1984
|
+
for (const [index, entry] of override.entries()) assertEnumLikeOptions({
|
|
1985
|
+
prefix: `override[${index}].options.`,
|
|
1986
|
+
options: entry.options
|
|
1987
|
+
});
|
|
1988
|
+
setResolver(userResolver ? Resolver.merge(resolverTs, userResolver) : resolverTs);
|
|
1989
|
+
if (userMacros?.length) setMacros(userMacros);
|
|
1990
|
+
addGenerator(typeGenerator);
|
|
1991
|
+
return {
|
|
1992
|
+
output,
|
|
1993
|
+
exclude,
|
|
1994
|
+
include,
|
|
1995
|
+
override,
|
|
1996
|
+
optionalType,
|
|
1997
|
+
group: createGroupConfig(group),
|
|
1998
|
+
arrayType,
|
|
1999
|
+
enum: resolvedEnum,
|
|
2000
|
+
syntaxType,
|
|
2001
|
+
printer
|
|
2002
|
+
};
|
|
2003
|
+
}
|
|
1995
2004
|
});
|
|
1996
2005
|
//#endregion
|
|
1997
2006
|
//#region src/printers/functionParams.ts
|