forked from colinhacks/zod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b304ae
commit 20df80e
Showing
4 changed files
with
80 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
**/.DS_Store | ||
node_modules | ||
/lib | ||
/__buildtest__ | ||
coverage | ||
.vscode | ||
.idea | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,42 @@ | ||
{ | ||
"name": "zod", | ||
"version": "3.21.0", | ||
"description": "TypeScript-first schema declaration and validation library with static type inference", | ||
"author": "Colin McDonnell <[email protected]>", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/colinhacks/zod" | ||
}, | ||
"main": "./lib/index.js", | ||
"types": "./index.d.ts", | ||
"module": "./lib/index.mjs", | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^8.2.0", | ||
"@types/benchmark": "^2.1.0", | ||
"@types/jest": "^29.2.2", | ||
"@types/node": "14", | ||
"@typescript-eslint/eslint-plugin": "^5.15.0", | ||
"@typescript-eslint/parser": "^5.15.0", | ||
"benchmark": "^2.1.4", | ||
"dependency-cruiser": "^9.19.0", | ||
"eslint": "^8.11.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-ban": "^1.6.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-simple-import-sort": "^7.0.0", | ||
"eslint-plugin-unused-imports": "^2.0.0", | ||
"husky": "^7.0.4", | ||
"jest": "^29.3.1", | ||
"lint-staged": "^12.3.7", | ||
"nodemon": "^2.0.15", | ||
"prettier": "^2.6.0", | ||
"pretty-quick": "^3.1.3", | ||
"rollup": "^2.70.1", | ||
"ts-jest": "^29.0.3", | ||
"ts-morph": "^14.0.0", | ||
"ts-node": "^10.9.1", | ||
"tslib": "^2.3.1", | ||
"tsx": "^3.8.0", | ||
"typescript": "~4.5.0" | ||
}, | ||
"exports": { | ||
".": { | ||
"require": "./lib/index.js", | ||
|
@@ -14,35 +46,30 @@ | |
"./package.json": "./package.json", | ||
"./locales/*": "./lib/locales/*" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/colinhacks/zod/issues" | ||
}, | ||
"description": "TypeScript-first schema declaration and validation library with static type inference", | ||
"files": [ | ||
"/lib", | ||
"/index.d.ts" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/colinhacks/zod" | ||
}, | ||
"author": "Colin McDonnell <[email protected]>", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"bugs": { | ||
"url": "https://github.com/colinhacks/zod/issues" | ||
}, | ||
"homepage": "https://zod.dev", | ||
"funding": "https://github.com/sponsors/colinhacks", | ||
"support": { | ||
"backing": { | ||
"npm-funding": true | ||
} | ||
}, | ||
"homepage": "https://zod.dev", | ||
"keywords": [ | ||
"typescript", | ||
"schema", | ||
"validation", | ||
"type", | ||
"inference" | ||
], | ||
"dependencies": {}, | ||
"license": "MIT", | ||
"lint-staged": { | ||
"src/*.ts": [ | ||
"eslint --cache --fix", | ||
"prettier --ignore-unknown --write" | ||
] | ||
}, | ||
"scripts": { | ||
"prettier:check": "prettier --check src/**/*.ts deno/lib/**/*.ts --no-error-on-unmatched-pattern", | ||
"prettier:fix": "prettier --write src/**/*.ts deno/lib/**/*.ts --ignore-unknown --no-error-on-unmatched-pattern", | ||
|
@@ -56,6 +83,7 @@ | |
"build:esm": "rollup --config rollup.config.js", | ||
"build:cjs": "tsc -p tsconfig.cjs.json", | ||
"build:types": "tsc -p tsconfig.types.json", | ||
"build:test": "tsc -p tsconfig.test.json", | ||
"rollup": "rollup --config rollup.config.js", | ||
"test:watch": "jest --watch", | ||
"test": "jest --coverage", | ||
|
@@ -66,39 +94,14 @@ | |
"benchmark": "tsx src/benchmarks/index.ts", | ||
"prepare": "husky install" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^8.2.0", | ||
"@types/benchmark": "^2.1.0", | ||
"@types/jest": "^29.2.2", | ||
"@types/node": "14", | ||
"@typescript-eslint/eslint-plugin": "^5.15.0", | ||
"@typescript-eslint/parser": "^5.15.0", | ||
"benchmark": "^2.1.4", | ||
"dependency-cruiser": "^9.19.0", | ||
"eslint": "^8.11.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-ban": "^1.6.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-simple-import-sort": "^7.0.0", | ||
"eslint-plugin-unused-imports": "^2.0.0", | ||
"husky": "^7.0.4", | ||
"jest": "^29.3.1", | ||
"lint-staged": "^12.3.7", | ||
"nodemon": "^2.0.15", | ||
"prettier": "^2.6.0", | ||
"pretty-quick": "^3.1.3", | ||
"rollup": "^2.70.1", | ||
"ts-jest": "^29.0.3", | ||
"ts-morph": "^14.0.0", | ||
"ts-node": "^10.9.1", | ||
"tslib": "^2.3.1", | ||
"tsx": "^3.8.0", | ||
"typescript": "~4.5.0" | ||
"sideEffects": false, | ||
"support": { | ||
"backing": { | ||
"npm-funding": true | ||
} | ||
}, | ||
"lint-staged": { | ||
"src/*.ts": [ | ||
"eslint --cache --fix", | ||
"prettier --ignore-unknown --write" | ||
] | ||
"types": "./index.d.ts", | ||
"dependencies": { | ||
"zod": "canary" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { z } from "./src"; | ||
|
||
console.time("parse"); | ||
// for (let i = 0; i < 1000000; i++) { | ||
// z.string().safeParse(123); | ||
// } | ||
const result = z.string().safeParse(123); | ||
if (result.success === false) { | ||
console.log(result.error); | ||
console.log(result.error === result.error); | ||
} | ||
console.timeEnd("parse"); | ||
const a = z.object({ a: z.string() }); | ||
const b = z.object({ a, b: z.string() }); | ||
const c = z.object({ a, b, c: z.string() }); | ||
const d = z.object({ a, b, c, d: z.string() }); | ||
const e = z.object({ a, b, c, d, e: z.string() }); | ||
const f = z.object({ a, b, c, d, e, f: z.string() }); | ||
const g = z.object({ a, b, c, d, e, f, g: z.string() }); | ||
const h = z.object({ a, b, c, d, e, f, g, h: z.string() }); | ||
const i = z.object({ a, b, c, d, e, f, g, h, i: z.string() }); | ||
const j = z.object({ a, b, c, d, e, f, g, h, i, j: z.string() }); | ||
|
||
export const arg = j.parse({}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "./tsconfig.base.json", | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"outDir": "__buildtest__", | ||
"target": "es5", | ||
"declaration": true, | ||
"declarationMap": false, | ||
"sourceMap": false | ||
}, | ||
"exclude": [] | ||
} |