@kubb/plugin-ts 5.0.6 → 5.0.7
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 +46 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +47 -44
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
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,9 @@ const typeGenerator = defineGenerator({
|
|
|
1831
1831
|
}
|
|
1832
1832
|
});
|
|
1833
1833
|
//#endregion
|
|
1834
|
+
//#region package.json
|
|
1835
|
+
var version = "5.0.7";
|
|
1836
|
+
//#endregion
|
|
1834
1837
|
//#region src/resolvers/resolverTs.ts
|
|
1835
1838
|
/**
|
|
1836
1839
|
* Default resolver used by `@kubb/plugin-ts`. Decides the names and file paths
|
|
@@ -1946,52 +1949,52 @@ function assertEnumLikeOptions({ prefix, options }) {
|
|
|
1946
1949
|
* })
|
|
1947
1950
|
* ```
|
|
1948
1951
|
*/
|
|
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 {
|
|
1952
|
+
const pluginTs = definePlugin({
|
|
1953
|
+
meta: {
|
|
1962
1954
|
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,
|
|
1955
|
+
version,
|
|
1956
|
+
compatibility: { kubb: ">=5.8.0" }
|
|
1957
|
+
},
|
|
1958
|
+
setup(options) {
|
|
1959
|
+
const { output = {
|
|
1960
|
+
path: "types",
|
|
1961
|
+
barrel: { type: "named" }
|
|
1962
|
+
}, group, exclude = [], include, override = [], enum: enumOptions = {}, optionalType = "questionToken", arrayType = "array", syntaxType = "type", printer, resolver: userResolver, macros: userMacros } = options;
|
|
1963
|
+
const resolvedEnum = {
|
|
1964
|
+
type: enumOptions.type ?? "asConst",
|
|
1965
|
+
constCasing: enumOptions.constCasing ?? "camelCase",
|
|
1966
|
+
typeSuffix: enumOptions.typeSuffix ?? "Key",
|
|
1967
|
+
keyCasing: enumOptions.keyCasing ?? "none"
|
|
1968
|
+
};
|
|
1969
|
+
assertEnumLikeOptions({
|
|
1970
|
+
prefix: "",
|
|
1971
|
+
options: {
|
|
1986
1972
|
enum: resolvedEnum,
|
|
1987
1973
|
syntaxType,
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1974
|
+
arrayType,
|
|
1975
|
+
optionalType
|
|
1976
|
+
}
|
|
1977
|
+
});
|
|
1978
|
+
for (const [index, entry] of override.entries()) assertEnumLikeOptions({
|
|
1979
|
+
prefix: `override[${index}].options.`,
|
|
1980
|
+
options: entry.options
|
|
1981
|
+
});
|
|
1982
|
+
setResolver(userResolver ? Resolver.merge(resolverTs, userResolver) : resolverTs);
|
|
1983
|
+
if (userMacros?.length) setMacros(userMacros);
|
|
1984
|
+
addGenerator(typeGenerator);
|
|
1985
|
+
return {
|
|
1986
|
+
output,
|
|
1987
|
+
exclude,
|
|
1988
|
+
include,
|
|
1989
|
+
override,
|
|
1990
|
+
optionalType,
|
|
1991
|
+
group: createGroupConfig(group),
|
|
1992
|
+
arrayType,
|
|
1993
|
+
enum: resolvedEnum,
|
|
1994
|
+
syntaxType,
|
|
1995
|
+
printer
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1995
1998
|
});
|
|
1996
1999
|
//#endregion
|
|
1997
2000
|
//#region src/printers/functionParams.ts
|