@kubb/plugin-zod 3.0.0-alpha.17 → 3.0.0-alpha.19

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.
Files changed (61) hide show
  1. package/README.md +0 -4
  2. package/dist/{chunk-HH7DZZUF.cjs → chunk-EZIBUHZO.cjs} +51 -39
  3. package/dist/chunk-EZIBUHZO.cjs.map +1 -0
  4. package/dist/{chunk-ORFIAMY6.js → chunk-GZX3ETVC.js} +28 -16
  5. package/dist/chunk-GZX3ETVC.js.map +1 -0
  6. package/dist/{chunk-Q7F7N57F.cjs → chunk-IFCC7VQX.cjs} +4 -4
  7. package/dist/{chunk-Q7F7N57F.cjs.map → chunk-IFCC7VQX.cjs.map} +1 -1
  8. package/dist/{chunk-35K4FTRK.js → chunk-LOZEOT4J.js} +4 -4
  9. package/dist/{chunk-35K4FTRK.js.map → chunk-LOZEOT4J.js.map} +1 -1
  10. package/dist/components.cjs +3 -3
  11. package/dist/components.d.cts +1 -2
  12. package/dist/components.d.ts +1 -2
  13. package/dist/components.js +1 -1
  14. package/dist/generators.cjs +4 -4
  15. package/dist/generators.d.cts +1 -2
  16. package/dist/generators.d.ts +1 -2
  17. package/dist/generators.js +2 -2
  18. package/dist/index.cjs +5 -5
  19. package/dist/index.d.cts +1 -2
  20. package/dist/index.d.ts +1 -2
  21. package/dist/index.js +2 -2
  22. package/dist/{types-29VBUXHk.d.cts → types-D7_wds1i.d.cts} +5 -23
  23. package/dist/{types-29VBUXHk.d.ts → types-D7_wds1i.d.ts} +5 -23
  24. package/package.json +10 -15
  25. package/src/generators/__snapshots__/anyof.ts +2 -2
  26. package/src/generators/__snapshots__/createPet.ts +7 -7
  27. package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown.ts +7 -7
  28. package/src/generators/__snapshots__/deletePet.ts +2 -2
  29. package/src/generators/__snapshots__/enumNamesType.ts +2 -2
  30. package/src/generators/__snapshots__/enumNullable.ts +2 -2
  31. package/src/generators/__snapshots__/enumVarNamesType.ts +2 -2
  32. package/src/generators/__snapshots__/example.ts +2 -2
  33. package/src/generators/__snapshots__/getPets.ts +8 -8
  34. package/src/generators/__snapshots__/mixedValueTypeConst.ts +3 -3
  35. package/src/generators/__snapshots__/nullableString.ts +2 -2
  36. package/src/generators/__snapshots__/nullableStringUuid.ts +2 -2
  37. package/src/generators/__snapshots__/nullableStringWithAnyOf.ts +2 -2
  38. package/src/generators/__snapshots__/numberValueConst.ts +3 -3
  39. package/src/generators/__snapshots__/oneof.ts +2 -2
  40. package/src/generators/__snapshots__/operations.ts +44 -58
  41. package/src/generators/__snapshots__/optionalPetInfer.ts +3 -3
  42. package/src/generators/__snapshots__/optionalPetTyped.ts +2 -2
  43. package/src/generators/__snapshots__/order.ts +2 -9
  44. package/src/generators/__snapshots__/orderDateTypeFalse.ts +2 -9
  45. package/src/generators/__snapshots__/orderDateTypeString.ts +2 -9
  46. package/src/generators/__snapshots__/pet.ts +2 -2
  47. package/src/generators/__snapshots__/petArray.ts +3 -7
  48. package/src/generators/__snapshots__/petCoercion.ts +2 -7
  49. package/src/generators/__snapshots__/petTupleObject.ts +3 -3
  50. package/src/generators/__snapshots__/petWithMapper.ts +2 -2
  51. package/src/generators/__snapshots__/pets.ts +2 -2
  52. package/src/generators/__snapshots__/recursive.ts +2 -2
  53. package/src/generators/__snapshots__/showPetById.ts +8 -11
  54. package/src/generators/__snapshots__/stringValueConst.ts +3 -3
  55. package/src/generators/__snapshots__/uuidSchema.ts +2 -2
  56. package/src/generators/operationsGenerator.tsx +6 -3
  57. package/src/generators/zodGenerator.tsx +7 -2
  58. package/src/parser/index.ts +1 -1
  59. package/src/types.ts +5 -28
  60. package/dist/chunk-HH7DZZUF.cjs.map +0 -1
  61. package/dist/chunk-ORFIAMY6.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { __commonJS, init_esm_shims, __toESM, Zod, Operations } from './chunk-35K4FTRK.js';
1
+ import { __commonJS, init_esm_shims, __toESM, Zod, Operations } from './chunk-LOZEOT4J.js';
2
2
  import { createReactGenerator, SchemaGenerator, pluginOasName, OperationGenerator, schemaKeywords, isKeyword } from '@kubb/plugin-oas';
3
3
  import { Oas } from '@kubb/plugin-oas/components';
4
4
  import { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks';
@@ -6,10 +6,10 @@ import path from 'node:path';
6
6
  import { createPlugin, FileManager, PluginManager } from '@kubb/core';
7
7
  import transformers2, { camelCase, pascalCase } from '@kubb/core/transformers';
8
8
  import { renderTemplate } from '@kubb/core/utils';
9
- import { useApp, File, Type } from '@kubb/react';
10
- import { jsxs, jsx, Fragment } from '@kubb/react/jsx-runtime';
11
9
  import { print } from '@kubb/parser-ts';
12
10
  import * as factory from '@kubb/parser-ts/factory';
11
+ import { useApp, File, Type } from '@kubb/react';
12
+ import { jsxs, jsx, Fragment } from '@kubb/react/jsx-runtime';
13
13
 
14
14
  // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
15
15
  var require_react_production_min = __commonJS({
@@ -2590,14 +2590,17 @@ var typeGenerator = createReactGenerator({
2590
2590
  )
2591
2591
  ] }, i);
2592
2592
  };
2593
- return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
2593
+ return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: plugin.output?.banner, footer: plugin.output?.footer, children: [
2594
2594
  operationSchemas.map(mapOperationSchema),
2595
2595
  /* @__PURE__ */ jsx(File.Source, { name: combinedSchemaName, isExportable: true, isIndexable: true, isTypeOnly: true, children: printCombinedSchema({ name: combinedSchemaName, schemas, pluginManager }) })
2596
2596
  ] });
2597
2597
  },
2598
2598
  Schema({ schema, options }) {
2599
2599
  const { mapper, enumType, optionalType } = options;
2600
- const { mode } = useApp();
2600
+ const {
2601
+ mode,
2602
+ plugin: { output }
2603
+ } = useApp();
2601
2604
  const { getName, getImports, getFile } = useSchemaManager();
2602
2605
  const imports = getImports(schema.tree);
2603
2606
  if (enumType === "asPascalConst") {
@@ -2608,7 +2611,7 @@ var typeGenerator = createReactGenerator({
2608
2611
  typedName: getName(schema.name, { type: "type" }),
2609
2612
  file: getFile(schema.name)
2610
2613
  };
2611
- return /* @__PURE__ */ jsxs(File, { baseName: type.file.baseName, path: type.file.path, meta: type.file.meta, children: [
2614
+ return /* @__PURE__ */ jsxs(File, { baseName: type.file.baseName, path: type.file.path, meta: type.file.meta, banner: output?.banner, footer: output?.footer, children: [
2612
2615
  mode === "split" && imports.map((imp, index) => /* @__PURE__ */ jsx(File.Import, { root: type.file.path, path: imp.path, name: imp.name, isTypeOnly: true }, index)),
2613
2616
  /* @__PURE__ */ jsx(
2614
2617
  Type2,
@@ -2631,10 +2634,13 @@ init_esm_shims();
2631
2634
  var oasGenerator = createReactGenerator({
2632
2635
  name: "oas",
2633
2636
  Operations() {
2634
- const { pluginManager, plugin } = useApp();
2637
+ const {
2638
+ pluginManager,
2639
+ plugin: { output, key: pluginKey }
2640
+ } = useApp();
2635
2641
  const oas = useOas();
2636
- const file = pluginManager.getFile({ name: "oas", extName: ".ts", pluginKey: plugin.key });
2637
- return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
2642
+ const file = pluginManager.getFile({ name: "oas", extName: ".ts", pluginKey });
2643
+ return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: output?.banner, footer: output?.footer, children: [
2638
2644
  /* @__PURE__ */ jsx(File.Import, { name: ["Infer"], path: "@kubb/oas", isTypeOnly: true }),
2639
2645
  /* @__PURE__ */ jsx(OasType, { name: "oas", typeName: "Oas", api: oas.api })
2640
2646
  ] });
@@ -2793,7 +2799,7 @@ var zodGenerator = createReactGenerator({
2793
2799
  )
2794
2800
  ] }, i);
2795
2801
  };
2796
- return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
2802
+ return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: plugin.output?.banner, footer: plugin.output?.footer, children: [
2797
2803
  /* @__PURE__ */ jsx(File.Import, { name: ["z"], path: plugin.options.importPath }),
2798
2804
  operationSchemas.map(mapOperationSchema)
2799
2805
  ] });
@@ -2801,6 +2807,9 @@ var zodGenerator = createReactGenerator({
2801
2807
  Schema({ schema, options }) {
2802
2808
  const { coercion, inferred, typed, mapper, importPath } = options;
2803
2809
  const { getName, getFile, getImports } = useSchemaManager();
2810
+ const {
2811
+ plugin: { output }
2812
+ } = useApp();
2804
2813
  const imports = getImports(schema.tree);
2805
2814
  const zod = {
2806
2815
  name: getName(schema.name, { type: "function" }),
@@ -2811,7 +2820,7 @@ var zodGenerator = createReactGenerator({
2811
2820
  name: getName(schema.name, { type: "type", pluginKey: [pluginTsName] }),
2812
2821
  file: getFile(schema.name, { pluginKey: [pluginTsName] })
2813
2822
  };
2814
- return /* @__PURE__ */ jsxs(File, { baseName: zod.file.baseName, path: zod.file.path, meta: zod.file.meta, children: [
2823
+ return /* @__PURE__ */ jsxs(File, { baseName: zod.file.baseName, path: zod.file.path, meta: zod.file.meta, banner: output?.banner, footer: output?.footer, children: [
2815
2824
  /* @__PURE__ */ jsx(File.Import, { name: ["z"], path: importPath }),
2816
2825
  typed && /* @__PURE__ */ jsx(File.Import, { isTypeOnly: true, root: zod.file.path, path: type.file.path, name: [type.name] }),
2817
2826
  imports.map((imp, index) => /* @__PURE__ */ jsx(File.Import, { root: zod.file.path, path: imp.path, name: imp.name }, index)),
@@ -2948,8 +2957,11 @@ var pluginZod = createPlugin((options) => {
2948
2957
  });
2949
2958
  var operationsGenerator = createReactGenerator({
2950
2959
  name: "operations",
2951
- Operations({ operations, options }) {
2952
- const { pluginManager } = useApp();
2960
+ Operations({ operations }) {
2961
+ const {
2962
+ pluginManager,
2963
+ plugin: { output }
2964
+ } = useApp();
2953
2965
  const { getFile, groupSchemasByName } = useOperationManager();
2954
2966
  const name = "operations";
2955
2967
  const file = pluginManager.getFile({ name, extName: ".ts", pluginKey: [pluginZodName] });
@@ -2958,7 +2970,7 @@ var operationsGenerator = createReactGenerator({
2958
2970
  const names = [data.request, ...Object.values(data.responses), ...Object.values(data.parameters)].filter(Boolean);
2959
2971
  return /* @__PURE__ */ jsx(File.Import, { name: names, root: file.path, path: getFile(operation).path }, key);
2960
2972
  }).filter(Boolean);
2961
- return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
2973
+ return /* @__PURE__ */ jsxs(File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: output?.banner, footer: output?.footer, children: [
2962
2974
  imports,
2963
2975
  /* @__PURE__ */ jsx(Operations, { name, operations: transformedOperations })
2964
2976
  ] });
@@ -2990,5 +3002,5 @@ react/cjs/react.development.js:
2990
3002
  */
2991
3003
 
2992
3004
  export { operationsGenerator, pluginZod, pluginZodName, zodGenerator };
2993
- //# sourceMappingURL=chunk-ORFIAMY6.js.map
2994
- //# sourceMappingURL=chunk-ORFIAMY6.js.map
3005
+ //# sourceMappingURL=chunk-GZX3ETVC.js.map
3006
+ //# sourceMappingURL=chunk-GZX3ETVC.js.map