Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@conform-to/zod

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@conform-to/zod - npm Package Compare versions

Comparing version 0.7.0-pre.0 to 0.7.0-pre.1

_virtual/_rollupPluginBabelHelpers.mjs

9

_virtual/_rollupPluginBabelHelpers.js

@@ -0,1 +1,5 @@

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function ownKeys(object, enumerableOnly) {

@@ -51,2 +55,5 @@ var keys = Object.keys(object);

export { _defineProperty as defineProperty, _objectSpread2 as objectSpread2, _toPrimitive as toPrimitive, _toPropertyKey as toPropertyKey };
exports.defineProperty = _defineProperty;
exports.objectSpread2 = _objectSpread2;
exports.toPrimitive = _toPrimitive;
exports.toPropertyKey = _toPropertyKey;

70

index.js

@@ -1,15 +0,39 @@

import { objectSpread2 as _objectSpread2 } from './_virtual/_rollupPluginBabelHelpers.js';
import { parse as parse$1, getName } from '@conform-to/dom';
import * as z from 'zod';
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.js');
var dom = require('@conform-to/dom');
var z = require('zod');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var z__namespace = /*#__PURE__*/_interopNamespace(z);
function getFieldsetConstraint(source) {
function getSchemaShape(schema) {
if (schema instanceof z.ZodObject) {
if (schema instanceof z__namespace.ZodObject) {
return schema.shape;
} else if (schema instanceof z.ZodEffects) {
} else if (schema instanceof z__namespace.ZodEffects) {
return getSchemaShape(schema.innerType());
} else if (schema instanceof z.ZodOptional) {
} else if (schema instanceof z__namespace.ZodOptional) {
return getSchemaShape(schema.unwrap());
} else if (schema instanceof z.ZodIntersection) {
return _objectSpread2(_objectSpread2({}, getSchemaShape(schema._def.left)), getSchemaShape(schema._def.right));
} else if (schema instanceof z__namespace.ZodIntersection) {
return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, getSchemaShape(schema._def.left)), getSchemaShape(schema._def.right));
}

@@ -20,17 +44,17 @@ return null;

var constraint = {};
if (schema instanceof z.ZodEffects) {
constraint = _objectSpread2({}, inferConstraint(schema.innerType()));
} else if (schema instanceof z.ZodOptional) {
constraint = _objectSpread2(_objectSpread2({}, inferConstraint(schema.unwrap())), {}, {
if (schema instanceof z__namespace.ZodEffects) {
constraint = _rollupPluginBabelHelpers.objectSpread2({}, inferConstraint(schema.innerType()));
} else if (schema instanceof z__namespace.ZodOptional) {
constraint = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, inferConstraint(schema.unwrap())), {}, {
required: false
});
} else if (schema instanceof z.ZodDefault) {
constraint = _objectSpread2(_objectSpread2({}, inferConstraint(schema.removeDefault())), {}, {
} else if (schema instanceof z__namespace.ZodDefault) {
constraint = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, inferConstraint(schema.removeDefault())), {}, {
required: false
});
} else if (schema instanceof z.ZodArray) {
constraint = _objectSpread2(_objectSpread2({}, inferConstraint(schema.element)), {}, {
} else if (schema instanceof z__namespace.ZodArray) {
constraint = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, inferConstraint(schema.element)), {}, {
multiple: true
});
} else if (schema instanceof z.ZodString) {
} else if (schema instanceof z__namespace.ZodString) {
for (var check of schema._def.checks) {

@@ -55,3 +79,3 @@ switch (check.kind) {

}
} else if (schema instanceof z.ZodNumber) {
} else if (schema instanceof z__namespace.ZodNumber) {
for (var _check of schema._def.checks) {

@@ -71,3 +95,3 @@ switch (_check.kind) {

}
} else if (schema instanceof z.ZodEnum) {
} else if (schema instanceof z__namespace.ZodEnum) {
constraint.pattern = schema.options.map(option =>

@@ -93,3 +117,3 @@ // To escape unsafe characters on regex

function parse(payload, config) {
return parse$1(payload, {
return dom.parse(payload, {
resolve(payload, intent) {

@@ -106,3 +130,3 @@ var schema = typeof config.schema === 'function' ? config.schema(intent) : config.schema;

var _config$acceptMultipl;
var name = getName(e.path);
var name = dom.getName(e.path);
if (typeof result[name] === 'undefined') {

@@ -137,2 +161,4 @@ result[name] = e.message;

export { getFieldsetConstraint, ifNonEmptyString, parse };
exports.getFieldsetConstraint = getFieldsetConstraint;
exports.ifNonEmptyString = ifNonEmptyString;
exports.parse = parse;

@@ -6,6 +6,5 @@ {

"license": "MIT",
"version": "0.7.0-pre.0",
"type": "module",
"main": "index.cjs",
"module": "index.js",
"version": "0.7.0-pre.1",
"main": "index.js",
"module": "index.mjs",
"types": "index.d.ts",

@@ -15,6 +14,6 @@ "exports": {

"types": "./index.d.ts",
"module": "./index.js",
"import": "./index.js",
"require": "./index.cjs",
"default": "./index.js"
"module": "./index.mjs",
"import": "./index.mjs",
"require": "./index.js",
"default": "./index.mjs"
}

@@ -31,3 +30,3 @@ },

"peerDependencies": {
"@conform-to/dom": "0.7.0-pre.0",
"@conform-to/dom": "0.7.0-pre.1",
"zod": "^3.21.0"

@@ -34,0 +33,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc