@kubb/plugin-zod 5.4.0 → 5.4.2
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 +14 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -747,6 +747,7 @@ function mapSchemaItems(node, transform) {
|
|
|
747
747
|
//#region src/components/Zod.tsx
|
|
748
748
|
function Zod({ name, node, printer, inferTypeName, typeGuards, isName, assertName, mini, cyclic, compile }) {
|
|
749
749
|
const output = printer.print(node);
|
|
750
|
+
const printerImports = printer.drainImports();
|
|
750
751
|
if (!output) return;
|
|
751
752
|
const needsAnnotation = cyclic && node.type !== "object";
|
|
752
753
|
const isBare = kubb_kit.ast.isBareRef(node, printer.options.keysToOmit);
|
|
@@ -756,6 +757,17 @@ function Zod({ name, node, printer, inferTypeName, typeGuards, isName, assertNam
|
|
|
756
757
|
const shouldGenerateIs = isName && (typeof typeGuards === "object" ? typeGuards.is ?? true : Boolean(typeGuards));
|
|
757
758
|
const shouldGenerateAssert = assertName && (typeof typeGuards === "object" ? typeGuards.assert ?? true : Boolean(typeGuards));
|
|
758
759
|
return /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsxs)(kubb_jsx_jsx_runtime.Fragment, { children: [
|
|
760
|
+
printerImports.map((imp) => /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.File.Import, {
|
|
761
|
+
name: imp.name,
|
|
762
|
+
path: imp.path,
|
|
763
|
+
root: imp.root,
|
|
764
|
+
isTypeOnly: imp.isTypeOnly,
|
|
765
|
+
isNameSpace: imp.isNameSpace
|
|
766
|
+
}, [
|
|
767
|
+
name,
|
|
768
|
+
imp.path,
|
|
769
|
+
imp.name
|
|
770
|
+
].join("-"))),
|
|
759
771
|
/* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.File.Source, {
|
|
760
772
|
name,
|
|
761
773
|
isExportable: true,
|
|
@@ -1205,7 +1217,8 @@ function variesByDirection({ node, printerOptions }) {
|
|
|
1205
1217
|
direction
|
|
1206
1218
|
},
|
|
1207
1219
|
transform: () => null,
|
|
1208
|
-
base: () => null
|
|
1220
|
+
base: () => null,
|
|
1221
|
+
import: () => {}
|
|
1209
1222
|
};
|
|
1210
1223
|
return handler.call(context, node);
|
|
1211
1224
|
};
|