@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 CHANGED
@@ -1850,6 +1850,9 @@ const typeGenerator = (0, kubb_kit.defineGenerator)({
1850
1850
  }
1851
1851
  });
1852
1852
  //#endregion
1853
+ //#region package.json
1854
+ var version = "5.0.7";
1855
+ //#endregion
1853
1856
  //#region src/resolvers/resolverTs.ts
1854
1857
  /**
1855
1858
  * Default resolver used by `@kubb/plugin-ts`. Decides the names and file paths
@@ -1965,52 +1968,52 @@ function assertEnumLikeOptions({ prefix, options }) {
1965
1968
  * })
1966
1969
  * ```
1967
1970
  */
1968
- const pluginTs = (0, kubb_kit.definePlugin)((options) => {
1969
- const { output = {
1970
- path: "types",
1971
- barrel: { type: "named" }
1972
- }, group, exclude = [], include, override = [], enum: enumOptions = {}, optionalType = "questionToken", arrayType = "array", syntaxType = "type", printer, resolver: userResolver, macros: userMacros } = options;
1973
- const groupConfig = createGroupConfig(group);
1974
- const resolvedEnum = {
1975
- type: enumOptions.type ?? "asConst",
1976
- constCasing: enumOptions.constCasing ?? "camelCase",
1977
- typeSuffix: enumOptions.typeSuffix ?? "Key",
1978
- keyCasing: enumOptions.keyCasing ?? "none"
1979
- };
1980
- return {
1971
+ const pluginTs = (0, kubb_kit.definePlugin)({
1972
+ meta: {
1981
1973
  name: pluginTsName,
1982
- options,
1983
- hooks: { "kubb:plugin:setup"(ctx) {
1984
- assertEnumLikeOptions({
1985
- prefix: "",
1986
- options: {
1987
- enum: resolvedEnum,
1988
- syntaxType,
1989
- arrayType,
1990
- optionalType
1991
- }
1992
- });
1993
- for (const [index, entry] of override.entries()) assertEnumLikeOptions({
1994
- prefix: `override[${index}].options.`,
1995
- options: entry.options
1996
- });
1997
- ctx.setOptions({
1998
- output,
1999
- exclude,
2000
- include,
2001
- override,
2002
- optionalType,
2003
- group: groupConfig,
2004
- arrayType,
1974
+ version,
1975
+ compatibility: { kubb: ">=5.8.0" }
1976
+ },
1977
+ setup(options) {
1978
+ const { output = {
1979
+ path: "types",
1980
+ barrel: { type: "named" }
1981
+ }, group, exclude = [], include, override = [], enum: enumOptions = {}, optionalType = "questionToken", arrayType = "array", syntaxType = "type", printer, resolver: userResolver, macros: userMacros } = options;
1982
+ const resolvedEnum = {
1983
+ type: enumOptions.type ?? "asConst",
1984
+ constCasing: enumOptions.constCasing ?? "camelCase",
1985
+ typeSuffix: enumOptions.typeSuffix ?? "Key",
1986
+ keyCasing: enumOptions.keyCasing ?? "none"
1987
+ };
1988
+ assertEnumLikeOptions({
1989
+ prefix: "",
1990
+ options: {
2005
1991
  enum: resolvedEnum,
2006
1992
  syntaxType,
2007
- printer
2008
- });
2009
- ctx.setResolver(userResolver ? kubb_kit.Resolver.merge(resolverTs, userResolver) : resolverTs);
2010
- if (userMacros?.length) ctx.setMacros(userMacros);
2011
- ctx.addGenerator(typeGenerator);
2012
- } }
2013
- };
1993
+ arrayType,
1994
+ optionalType
1995
+ }
1996
+ });
1997
+ for (const [index, entry] of override.entries()) assertEnumLikeOptions({
1998
+ prefix: `override[${index}].options.`,
1999
+ options: entry.options
2000
+ });
2001
+ (0, kubb_kit.setResolver)(userResolver ? kubb_kit.Resolver.merge(resolverTs, userResolver) : resolverTs);
2002
+ if (userMacros?.length) (0, kubb_kit.setMacros)(userMacros);
2003
+ (0, kubb_kit.addGenerator)(typeGenerator);
2004
+ return {
2005
+ output,
2006
+ exclude,
2007
+ include,
2008
+ override,
2009
+ optionalType,
2010
+ group: createGroupConfig(group),
2011
+ arrayType,
2012
+ enum: resolvedEnum,
2013
+ syntaxType,
2014
+ printer
2015
+ };
2016
+ }
2014
2017
  });
2015
2018
  //#endregion
2016
2019
  //#region src/printers/functionParams.ts