@kubb/plugin-zod 3.0.0-alpha.18 → 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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkG5M2ERLS_cjs = require('./chunk-G5M2ERLS.cjs');
3
+ var chunkIFCC7VQX_cjs = require('./chunk-IFCC7VQX.cjs');
4
4
  var pluginOas = require('@kubb/plugin-oas');
5
5
  var components = require('@kubb/plugin-oas/components');
6
6
  var hooks = require('@kubb/plugin-oas/hooks');
@@ -8,10 +8,10 @@ var path = require('path');
8
8
  var core = require('@kubb/core');
9
9
  var transformers2 = require('@kubb/core/transformers');
10
10
  var utils = require('@kubb/core/utils');
11
- var react = require('@kubb/react');
12
- var jsxRuntime = require('@kubb/react/jsx-runtime');
13
11
  var parserTs = require('@kubb/parser-ts');
14
12
  var factory = require('@kubb/parser-ts/factory');
13
+ var react = require('@kubb/react');
14
+ var jsxRuntime = require('@kubb/react/jsx-runtime');
15
15
 
16
16
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
17
 
@@ -38,9 +38,9 @@ var transformers2__default = /*#__PURE__*/_interopDefault(transformers2);
38
38
  var factory__namespace = /*#__PURE__*/_interopNamespace(factory);
39
39
 
40
40
  // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
41
- var require_react_production_min = chunkG5M2ERLS_cjs.__commonJS({
41
+ var require_react_production_min = chunkIFCC7VQX_cjs.__commonJS({
42
42
  "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js"(exports) {
43
- chunkG5M2ERLS_cjs.init_cjs_shims();
43
+ chunkIFCC7VQX_cjs.init_cjs_shims();
44
44
  var l = Symbol.for("react.element");
45
45
  var n = Symbol.for("react.portal");
46
46
  var p = Symbol.for("react.fragment");
@@ -311,9 +311,9 @@ var require_react_production_min = chunkG5M2ERLS_cjs.__commonJS({
311
311
  });
312
312
 
313
313
  // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js
314
- var require_react_development = chunkG5M2ERLS_cjs.__commonJS({
314
+ var require_react_development = chunkIFCC7VQX_cjs.__commonJS({
315
315
  "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.development.js"(exports, module) {
316
- chunkG5M2ERLS_cjs.init_cjs_shims();
316
+ chunkIFCC7VQX_cjs.init_cjs_shims();
317
317
  if (process.env.NODE_ENV !== "production") {
318
318
  (function() {
319
319
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
@@ -2184,9 +2184,9 @@ var require_react_development = chunkG5M2ERLS_cjs.__commonJS({
2184
2184
  });
2185
2185
 
2186
2186
  // ../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
2187
- var require_react = chunkG5M2ERLS_cjs.__commonJS({
2187
+ var require_react = chunkIFCC7VQX_cjs.__commonJS({
2188
2188
  "../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"(exports, module) {
2189
- chunkG5M2ERLS_cjs.init_cjs_shims();
2189
+ chunkIFCC7VQX_cjs.init_cjs_shims();
2190
2190
  if (process.env.NODE_ENV === "production") {
2191
2191
  module.exports = require_react_production_min();
2192
2192
  } else {
@@ -2196,28 +2196,28 @@ var require_react = chunkG5M2ERLS_cjs.__commonJS({
2196
2196
  });
2197
2197
 
2198
2198
  // src/generators/index.ts
2199
- chunkG5M2ERLS_cjs.init_cjs_shims();
2199
+ chunkIFCC7VQX_cjs.init_cjs_shims();
2200
2200
 
2201
2201
  // src/generators/zodGenerator.tsx
2202
- chunkG5M2ERLS_cjs.init_cjs_shims();
2202
+ chunkIFCC7VQX_cjs.init_cjs_shims();
2203
2203
 
2204
2204
  // ../plugin-ts/src/index.ts
2205
- chunkG5M2ERLS_cjs.init_cjs_shims();
2205
+ chunkIFCC7VQX_cjs.init_cjs_shims();
2206
2206
 
2207
2207
  // ../plugin-ts/src/plugin.ts
2208
- chunkG5M2ERLS_cjs.init_cjs_shims();
2208
+ chunkIFCC7VQX_cjs.init_cjs_shims();
2209
2209
 
2210
2210
  // ../plugin-ts/src/generators/index.ts
2211
- chunkG5M2ERLS_cjs.init_cjs_shims();
2211
+ chunkIFCC7VQX_cjs.init_cjs_shims();
2212
2212
 
2213
2213
  // ../plugin-ts/src/generators/typeGenerator.tsx
2214
- chunkG5M2ERLS_cjs.init_cjs_shims();
2214
+ chunkIFCC7VQX_cjs.init_cjs_shims();
2215
2215
 
2216
2216
  // ../plugin-ts/src/components/index.ts
2217
- chunkG5M2ERLS_cjs.init_cjs_shims();
2217
+ chunkIFCC7VQX_cjs.init_cjs_shims();
2218
2218
 
2219
2219
  // ../plugin-ts/src/components/OasType.tsx
2220
- chunkG5M2ERLS_cjs.init_cjs_shims();
2220
+ chunkIFCC7VQX_cjs.init_cjs_shims();
2221
2221
  function OasType({ name, typeName, api }) {
2222
2222
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2223
2223
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: `export const ${name} = ${JSON.stringify(api, void 0, 2)} as const` }),
@@ -2227,11 +2227,11 @@ function OasType({ name, typeName, api }) {
2227
2227
  }
2228
2228
 
2229
2229
  // ../plugin-ts/src/components/Type.tsx
2230
- chunkG5M2ERLS_cjs.init_cjs_shims();
2231
- var import_react3 = chunkG5M2ERLS_cjs.__toESM(require_react(), 1);
2230
+ chunkIFCC7VQX_cjs.init_cjs_shims();
2231
+ var import_react3 = chunkIFCC7VQX_cjs.__toESM(require_react(), 1);
2232
2232
 
2233
2233
  // ../plugin-ts/src/parser/index.ts
2234
- chunkG5M2ERLS_cjs.init_cjs_shims();
2234
+ chunkIFCC7VQX_cjs.init_cjs_shims();
2235
2235
  var typeKeywordMapper = {
2236
2236
  any: () => factory__namespace.keywordTypeNodes.any,
2237
2237
  unknown: () => factory__namespace.keywordTypeNodes.unknown,
@@ -2616,14 +2616,17 @@ var typeGenerator = pluginOas.createReactGenerator({
2616
2616
  )
2617
2617
  ] }, i);
2618
2618
  };
2619
- return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
2619
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: plugin.output?.banner, footer: plugin.output?.footer, children: [
2620
2620
  operationSchemas.map(mapOperationSchema),
2621
2621
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name: combinedSchemaName, isExportable: true, isIndexable: true, isTypeOnly: true, children: printCombinedSchema({ name: combinedSchemaName, schemas, pluginManager }) })
2622
2622
  ] });
2623
2623
  },
2624
2624
  Schema({ schema, options }) {
2625
2625
  const { mapper, enumType, optionalType } = options;
2626
- const { mode } = react.useApp();
2626
+ const {
2627
+ mode,
2628
+ plugin: { output }
2629
+ } = react.useApp();
2627
2630
  const { getName, getImports, getFile } = hooks.useSchemaManager();
2628
2631
  const imports = getImports(schema.tree);
2629
2632
  if (enumType === "asPascalConst") {
@@ -2634,7 +2637,7 @@ var typeGenerator = pluginOas.createReactGenerator({
2634
2637
  typedName: getName(schema.name, { type: "type" }),
2635
2638
  file: getFile(schema.name)
2636
2639
  };
2637
- return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: type.file.baseName, path: type.file.path, meta: type.file.meta, children: [
2640
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: type.file.baseName, path: type.file.path, meta: type.file.meta, banner: output?.banner, footer: output?.footer, children: [
2638
2641
  mode === "split" && imports.map((imp, index) => /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { root: type.file.path, path: imp.path, name: imp.name, isTypeOnly: true }, index)),
2639
2642
  /* @__PURE__ */ jsxRuntime.jsx(
2640
2643
  Type2,
@@ -2653,14 +2656,17 @@ var typeGenerator = pluginOas.createReactGenerator({
2653
2656
  });
2654
2657
 
2655
2658
  // ../plugin-ts/src/generators/oasGenerator.tsx
2656
- chunkG5M2ERLS_cjs.init_cjs_shims();
2659
+ chunkIFCC7VQX_cjs.init_cjs_shims();
2657
2660
  var oasGenerator = pluginOas.createReactGenerator({
2658
2661
  name: "oas",
2659
2662
  Operations() {
2660
- const { pluginManager, plugin } = react.useApp();
2663
+ const {
2664
+ pluginManager,
2665
+ plugin: { output, key: pluginKey }
2666
+ } = react.useApp();
2661
2667
  const oas = hooks.useOas();
2662
- const file = pluginManager.getFile({ name: "oas", extName: ".ts", pluginKey: plugin.key });
2663
- return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
2668
+ const file = pluginManager.getFile({ name: "oas", extName: ".ts", pluginKey });
2669
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: output?.banner, footer: output?.footer, children: [
2664
2670
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["Infer"], path: "@kubb/oas", isTypeOnly: true }),
2665
2671
  /* @__PURE__ */ jsxRuntime.jsx(OasType, { name: "oas", typeName: "Oas", api: oas.api })
2666
2672
  ] });
@@ -2805,7 +2811,7 @@ var zodGenerator = pluginOas.createReactGenerator({
2805
2811
  typed && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { isTypeOnly: true, root: file.path, path: type.file.path, name: [type.name] }),
2806
2812
  imports.map((imp, index) => /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { root: file.path, path: imp.path, name: imp.name }, index)),
2807
2813
  /* @__PURE__ */ jsxRuntime.jsx(
2808
- chunkG5M2ERLS_cjs.Zod,
2814
+ chunkIFCC7VQX_cjs.Zod,
2809
2815
  {
2810
2816
  name: zod.name,
2811
2817
  typeName: typed ? type.name : void 0,
@@ -2819,7 +2825,7 @@ var zodGenerator = pluginOas.createReactGenerator({
2819
2825
  )
2820
2826
  ] }, i);
2821
2827
  };
2822
- return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
2828
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: plugin.output?.banner, footer: plugin.output?.footer, children: [
2823
2829
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["z"], path: plugin.options.importPath }),
2824
2830
  operationSchemas.map(mapOperationSchema)
2825
2831
  ] });
@@ -2827,6 +2833,9 @@ var zodGenerator = pluginOas.createReactGenerator({
2827
2833
  Schema({ schema, options }) {
2828
2834
  const { coercion, inferred, typed, mapper, importPath } = options;
2829
2835
  const { getName, getFile, getImports } = hooks.useSchemaManager();
2836
+ const {
2837
+ plugin: { output }
2838
+ } = react.useApp();
2830
2839
  const imports = getImports(schema.tree);
2831
2840
  const zod = {
2832
2841
  name: getName(schema.name, { type: "function" }),
@@ -2837,12 +2846,12 @@ var zodGenerator = pluginOas.createReactGenerator({
2837
2846
  name: getName(schema.name, { type: "type", pluginKey: [pluginTsName] }),
2838
2847
  file: getFile(schema.name, { pluginKey: [pluginTsName] })
2839
2848
  };
2840
- return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: zod.file.baseName, path: zod.file.path, meta: zod.file.meta, children: [
2849
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: zod.file.baseName, path: zod.file.path, meta: zod.file.meta, banner: output?.banner, footer: output?.footer, children: [
2841
2850
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["z"], path: importPath }),
2842
2851
  typed && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { isTypeOnly: true, root: zod.file.path, path: type.file.path, name: [type.name] }),
2843
2852
  imports.map((imp, index) => /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { root: zod.file.path, path: imp.path, name: imp.name }, index)),
2844
2853
  /* @__PURE__ */ jsxRuntime.jsx(
2845
- chunkG5M2ERLS_cjs.Zod,
2854
+ chunkIFCC7VQX_cjs.Zod,
2846
2855
  {
2847
2856
  name: zod.name,
2848
2857
  typeName: typed ? type.name : void 0,
@@ -2858,10 +2867,10 @@ var zodGenerator = pluginOas.createReactGenerator({
2858
2867
  });
2859
2868
 
2860
2869
  // src/generators/operationsGenerator.tsx
2861
- chunkG5M2ERLS_cjs.init_cjs_shims();
2870
+ chunkIFCC7VQX_cjs.init_cjs_shims();
2862
2871
 
2863
2872
  // src/plugin.ts
2864
- chunkG5M2ERLS_cjs.init_cjs_shims();
2873
+ chunkIFCC7VQX_cjs.init_cjs_shims();
2865
2874
  var pluginZodName = "plugin-zod";
2866
2875
  var pluginZod = core.createPlugin((options) => {
2867
2876
  const {
@@ -2974,8 +2983,11 @@ var pluginZod = core.createPlugin((options) => {
2974
2983
  });
2975
2984
  var operationsGenerator = pluginOas.createReactGenerator({
2976
2985
  name: "operations",
2977
- Operations({ operations, options }) {
2978
- const { pluginManager } = react.useApp();
2986
+ Operations({ operations }) {
2987
+ const {
2988
+ pluginManager,
2989
+ plugin: { output }
2990
+ } = react.useApp();
2979
2991
  const { getFile, groupSchemasByName } = hooks.useOperationManager();
2980
2992
  const name = "operations";
2981
2993
  const file = pluginManager.getFile({ name, extName: ".ts", pluginKey: [pluginZodName] });
@@ -2984,9 +2996,9 @@ var operationsGenerator = pluginOas.createReactGenerator({
2984
2996
  const names = [data.request, ...Object.values(data.responses), ...Object.values(data.parameters)].filter(Boolean);
2985
2997
  return /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: names, root: file.path, path: getFile(operation).path }, key);
2986
2998
  }).filter(Boolean);
2987
- return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
2999
+ return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: output?.banner, footer: output?.footer, children: [
2988
3000
  imports,
2989
- /* @__PURE__ */ jsxRuntime.jsx(chunkG5M2ERLS_cjs.Operations, { name, operations: transformedOperations })
3001
+ /* @__PURE__ */ jsxRuntime.jsx(chunkIFCC7VQX_cjs.Operations, { name, operations: transformedOperations })
2990
3002
  ] });
2991
3003
  }
2992
3004
  });
@@ -3019,5 +3031,5 @@ exports.operationsGenerator = operationsGenerator;
3019
3031
  exports.pluginZod = pluginZod;
3020
3032
  exports.pluginZodName = pluginZodName;
3021
3033
  exports.zodGenerator = zodGenerator;
3022
- //# sourceMappingURL=chunk-ZVLPHBJB.cjs.map
3023
- //# sourceMappingURL=chunk-ZVLPHBJB.cjs.map
3034
+ //# sourceMappingURL=chunk-EZIBUHZO.cjs.map
3035
+ //# sourceMappingURL=chunk-EZIBUHZO.cjs.map