mirror of https://github.com/cupcakearmy/zod.git
Add tsc compilation test
This commit is contained in:
parent
5b304ae417
commit
20df80e6ce
|
@ -1,6 +1,7 @@
|
|||
**/.DS_Store
|
||||
node_modules
|
||||
/lib
|
||||
/__buildtest__
|
||||
coverage
|
||||
.vscode
|
||||
.idea
|
||||
|
|
125
package.json
125
package.json
|
@ -1,71 +1,13 @@
|
|||
{
|
||||
"name": "zod",
|
||||
"version": "3.21.0",
|
||||
"description": "TypeScript-first schema declaration and validation library with static type inference",
|
||||
"main": "./lib/index.js",
|
||||
"types": "./index.d.ts",
|
||||
"module": "./lib/index.mjs",
|
||||
"exports": {
|
||||
".": {
|
||||
"require": "./lib/index.js",
|
||||
"import": "./lib/index.mjs",
|
||||
"types": "./index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json",
|
||||
"./locales/*": "./lib/locales/*"
|
||||
},
|
||||
"files": [
|
||||
"/lib",
|
||||
"/index.d.ts"
|
||||
],
|
||||
"author": "Colin McDonnell <colin@colinhacks.com>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/colinhacks/zod"
|
||||
},
|
||||
"author": "Colin McDonnell <colin@colinhacks.com>",
|
||||
"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
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"typescript",
|
||||
"schema",
|
||||
"validation",
|
||||
"type",
|
||||
"inference"
|
||||
],
|
||||
"dependencies": {},
|
||||
"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",
|
||||
"lint:check": "eslint --cache --ext .ts ./src",
|
||||
"lint:fix": "eslint --cache --fix --ext .ts ./src",
|
||||
"check": "yarn lint:check && yarn prettier:check",
|
||||
"fix": "yarn lint:fix && yarn prettier:fix",
|
||||
"clean": "rm -rf lib/* deno/lib/*",
|
||||
"build": "yarn run clean && npm run build:cjs && npm run build:esm && npm run build:deno",
|
||||
"build:deno": "node ./deno/build.mjs && cp ./README.md ./deno/lib",
|
||||
"build:esm": "rollup --config rollup.config.js",
|
||||
"build:cjs": "tsc -p tsconfig.cjs.json",
|
||||
"build:types": "tsc -p tsconfig.types.json",
|
||||
"rollup": "rollup --config rollup.config.js",
|
||||
"test:watch": "jest --watch",
|
||||
"test": "jest --coverage",
|
||||
"test:deno": "cd deno && deno test",
|
||||
"prepublishOnly": "npm run test && npm run build && npm run build:deno",
|
||||
"play": "nodemon -e ts -w . -x tsx playground.ts",
|
||||
"depcruise": "depcruise -c .dependency-cruiser.js src",
|
||||
"benchmark": "tsx src/benchmarks/index.ts",
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"module": "./lib/index.mjs",
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-typescript": "^8.2.0",
|
||||
"@types/benchmark": "^2.1.0",
|
||||
|
@ -95,10 +37,71 @@
|
|||
"tsx": "^3.8.0",
|
||||
"typescript": "~4.5.0"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"require": "./lib/index.js",
|
||||
"import": "./lib/index.mjs",
|
||||
"types": "./index.d.ts"
|
||||
},
|
||||
"./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"
|
||||
],
|
||||
"funding": "https://github.com/sponsors/colinhacks",
|
||||
"homepage": "https://zod.dev",
|
||||
"keywords": [
|
||||
"typescript",
|
||||
"schema",
|
||||
"validation",
|
||||
"type",
|
||||
"inference"
|
||||
],
|
||||
"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",
|
||||
"lint:check": "eslint --cache --ext .ts ./src",
|
||||
"lint:fix": "eslint --cache --fix --ext .ts ./src",
|
||||
"check": "yarn lint:check && yarn prettier:check",
|
||||
"fix": "yarn lint:fix && yarn prettier:fix",
|
||||
"clean": "rm -rf lib/* deno/lib/*",
|
||||
"build": "yarn run clean && npm run build:cjs && npm run build:esm && npm run build:deno",
|
||||
"build:deno": "node ./deno/build.mjs && cp ./README.md ./deno/lib",
|
||||
"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",
|
||||
"test:deno": "cd deno && deno test",
|
||||
"prepublishOnly": "npm run test && npm run build && npm run build:deno",
|
||||
"play": "nodemon -e ts -w . -x tsx playground.ts",
|
||||
"depcruise": "depcruise -c .dependency-cruiser.js src",
|
||||
"benchmark": "tsx src/benchmarks/index.ts",
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"support": {
|
||||
"backing": {
|
||||
"npm-funding": true
|
||||
}
|
||||
},
|
||||
"types": "./index.d.ts",
|
||||
"dependencies": {
|
||||
"zod": "canary"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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({});
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"outDir": "__buildtest__",
|
||||
"target": "es5",
|
||||
"declaration": true,
|
||||
"declarationMap": false,
|
||||
"sourceMap": false
|
||||
},
|
||||
"exclude": []
|
||||
}
|
Loading…
Reference in New Issue