diff --git a/benchmarks/benchUtil.ts b/benchmarks/benchUtil.ts index 808420633..915725800 100644 --- a/benchmarks/benchUtil.ts +++ b/benchmarks/benchUtil.ts @@ -1,5 +1,5 @@ -import * as zNew from "../packages/zod/dist/commonjs/index.js"; -import * as zOld from "./node_modules/zod/dist/commonjs/index.js"; +import * as zOld from "zod"; +import * as zNew from "../packages/zod/src/index.js"; export function makeSchema(factory: (z: typeof zNew) => T) { return { diff --git a/benchmarks/boolean.ts b/benchmarks/boolean.ts index 379b869f6..536cf12ca 100644 --- a/benchmarks/boolean.ts +++ b/benchmarks/boolean.ts @@ -13,10 +13,4 @@ const bench = metabench("z.boolean().parse", { }, }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) { - run(); -} +await bench.run(); diff --git a/benchmarks/datetime-regex.ts b/benchmarks/datetime-regex.ts index 8050dd605..8bb96f9d1 100644 --- a/benchmarks/datetime-regex.ts +++ b/benchmarks/datetime-regex.ts @@ -49,10 +49,4 @@ bench return false; }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) { - run(); -} +await bench.run(); diff --git a/benchmarks/datetime.ts b/benchmarks/datetime.ts index 5f00023c8..d03972f86 100644 --- a/benchmarks/datetime.ts +++ b/benchmarks/datetime.ts @@ -13,10 +13,4 @@ const bench = metabench("z.string().datetime().parse", { }, }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) { - run(); -} +await bench.run(); diff --git a/benchmarks/discriminated-union.ts b/benchmarks/discriminated-union.ts index ba339325c..4a4d0739f 100644 --- a/benchmarks/discriminated-union.ts +++ b/benchmarks/discriminated-union.ts @@ -26,10 +26,4 @@ const bench = metabench("z.disriminatedUnion().parse") zod4.parse(DATA); }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) { - run(); -} +await bench.run(); diff --git a/benchmarks/index.ts b/benchmarks/index.ts index 9532e3f5e..b30fcef8d 100644 --- a/benchmarks/index.ts +++ b/benchmarks/index.ts @@ -3,11 +3,13 @@ import { execa } from "execa"; const $ = execa({ stdout: "inherit", stderr: "inherit" }); async function run() { + console.log(process.argv[2].split(",")); const files = process.argv[2] .split(",") - .map((file) => require.resolve(`./${file}`)); + .map((file) => import.meta.resolve(`./${file}`).replace("file://", "")); for (const file of files) { + console.log(`Running ${file}`); await $`pnpm tsx ${file}`; } } diff --git a/benchmarks/instanceof.ts b/benchmarks/instanceof.ts index c3bf43128..14007ffbf 100644 --- a/benchmarks/instanceof.ts +++ b/benchmarks/instanceof.ts @@ -75,10 +75,4 @@ const bench = metabench("instanceof") for (const _ of DATA) nullChainCheckTag(_); }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) { - run(); -} +await bench.run(); diff --git a/benchmarks/ipv4-regex.ts b/benchmarks/ipv4-regex.ts index 43d2443ee..6d6db0630 100644 --- a/benchmarks/ipv4-regex.ts +++ b/benchmarks/ipv4-regex.ts @@ -46,10 +46,4 @@ const bench = metabench("ipv4 regex") return ipv4RegexI.test(DATA); }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) { - run(); -} +await bench.run(); diff --git a/benchmarks/number.ts b/benchmarks/number.ts index 39c9e6a5b..ce8fd2af7 100644 --- a/benchmarks/number.ts +++ b/benchmarks/number.ts @@ -13,10 +13,4 @@ const bench = metabench("z.number().parse", { }, }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) { - run(); -} +await bench.run(); diff --git a/benchmarks/object-async.ts b/benchmarks/object-async.ts index ca46ecb96..740ff7f77 100644 --- a/benchmarks/object-async.ts +++ b/benchmarks/object-async.ts @@ -1,5 +1,5 @@ import { metabench } from "./metabench.js"; -import { DATA, zod3, zod4 } from "./object-old.js"; +import { DATA, zod3, zod4 } from "./object-setup.js"; const bench = metabench("small: z.object().parseAsync", { async zod3() { @@ -10,8 +10,4 @@ const bench = metabench("small: z.object().parseAsync", { }, }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) run(); +await bench.run(); diff --git a/benchmarks/object-creation.ts b/benchmarks/object-creation.ts index c9bff2400..5fa32a33f 100644 --- a/benchmarks/object-creation.ts +++ b/benchmarks/object-creation.ts @@ -15,10 +15,4 @@ const bench = metabench("object creation") obj.value; }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) { - run(); -} +await bench.run(); diff --git a/benchmarks/object-fail.ts b/benchmarks/object-fail.ts index c8c8610dd..fc3859d78 100644 --- a/benchmarks/object-fail.ts +++ b/benchmarks/object-fail.ts @@ -1,5 +1,5 @@ import { metabench } from "./metabench.js"; -import { DATA, zod3, zod4 } from "./object-old.js"; +import { DATA, zod3, zod4 } from "./object-setup.js"; const bench = metabench("small: z.object().safeParseAsync", { zod3() { @@ -10,8 +10,4 @@ const bench = metabench("small: z.object().safeParseAsync", { }, }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) run(); +await bench.run(); diff --git a/benchmarks/object-moltar.ts b/benchmarks/object-moltar.ts index 23704a5c9..2f42d4640 100644 --- a/benchmarks/object-moltar.ts +++ b/benchmarks/object-moltar.ts @@ -43,8 +43,4 @@ const bench = metabench("small: z.object().safeParseAsync", { }, }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) run(); +await bench.run(); diff --git a/benchmarks/object-safe.ts b/benchmarks/object-safe.ts index 506fc8df8..b0dd977c4 100644 --- a/benchmarks/object-safe.ts +++ b/benchmarks/object-safe.ts @@ -1,5 +1,5 @@ import { metabench } from "./metabench.js"; -import { DATA, zod3, zod4 } from "./object-old.js"; +import { DATA, zod3, zod4 } from "./object-setup.js"; const bench = metabench("small: z.object().safeParse", { zod3() { @@ -10,8 +10,4 @@ const bench = metabench("small: z.object().safeParse", { }, }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) run(); +await bench.run(); diff --git a/benchmarks/object-safeasync.ts b/benchmarks/object-safeasync.ts index 9fc54f98e..6f1a852e8 100644 --- a/benchmarks/object-safeasync.ts +++ b/benchmarks/object-safeasync.ts @@ -1,5 +1,5 @@ import { metabench } from "./metabench.js"; -import { DATA, zod3, zod4 } from "./object-old.js"; +import { DATA, zod3, zod4 } from "./object-setup.js"; const bench = metabench("small: z.object().safeParseAsync", { async zod3() { @@ -10,8 +10,4 @@ const bench = metabench("small: z.object().safeParseAsync", { }, }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) run(); +await bench.run(); diff --git a/benchmarks/object-old.ts b/benchmarks/object-setup.ts similarity index 58% rename from benchmarks/object-old.ts rename to benchmarks/object-setup.ts index 84d314655..05e4c51bd 100644 --- a/benchmarks/object-old.ts +++ b/benchmarks/object-setup.ts @@ -1,5 +1,5 @@ import { makeData, makeSchema } from "./benchUtil.js"; -import { metabench } from "./metabench.js"; +// import { metabench } from "./metabench.js"; export const { zod3, zod4 } = makeSchema((z) => z.object({ @@ -19,23 +19,17 @@ export var DATA: any[] = makeData(1000, () => { }); }); -const bench = metabench("small: z.object().parse", { - zod3() { - for (const d of DATA) { - zod3.parse(d); - } - }, - zod4() { - for (const d of DATA) { - zod4.parse(d); - } - }, -}); - -export default async function run() { - await bench.run(); -} +// const bench = metabench("small: z.object().parse", { +// zod3() { +// for (const d of DATA) { +// zod3.parse(d); +// } +// }, +// zod4() { +// for (const d of DATA) { +// zod4.parse(d); +// } +// }, +// }); -if (require.main === module) { - run(); -} +// await bench.run(); diff --git a/benchmarks/object.ts b/benchmarks/object.ts index f285ed19a..d6d8cb96f 100644 --- a/benchmarks/object.ts +++ b/benchmarks/object.ts @@ -22,8 +22,4 @@ const bench = zodbench({ }, }); -export default bench.run; - -if (require.main === module) { - bench.run(); -} +await bench.run(); diff --git a/benchmarks/package.json b/benchmarks/package.json index 131eaaddc..6a7e78795 100644 --- a/benchmarks/package.json +++ b/benchmarks/package.json @@ -3,6 +3,6 @@ "type": "module", "name": "zod-benchmarks", "devDependencies": { - "zod": "3.23.8" + "zod": "3.23.7" } } diff --git a/benchmarks/string-old.ts b/benchmarks/string-old.ts index 896ba0d0c..df757d2a2 100644 --- a/benchmarks/string-old.ts +++ b/benchmarks/string-old.ts @@ -14,10 +14,4 @@ const bench = metabench("z.string().parse", { }, }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) { - run(); -} +await bench.run(); diff --git a/benchmarks/string.ts b/benchmarks/string.ts index 8ac32441e..b203d9561 100644 --- a/benchmarks/string.ts +++ b/benchmarks/string.ts @@ -15,10 +15,4 @@ const bench = zodbench({ }, }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) { - run(); -} +await bench.run(); diff --git a/benchmarks/union.ts b/benchmarks/union.ts index 934aac2b1..3ff7d166d 100644 --- a/benchmarks/union.ts +++ b/benchmarks/union.ts @@ -26,10 +26,4 @@ const bench = metabench("z.union().parse") zod4.parse(DATA); }); -export default async function run() { - await bench.run(); -} - -if (require.main === module) { - run(); -} +await bench.run(); diff --git a/benchmarks/zodbench.ts b/benchmarks/zodbench.ts index 2685c3b5f..ceab753b9 100644 --- a/benchmarks/zodbench.ts +++ b/benchmarks/zodbench.ts @@ -1,4 +1,4 @@ -import type z from "../packages/zod/dist/commonjs/index.js"; +import type z from "../packages/zod/src/index.js"; import { makeSchema } from "./benchUtil.js"; import { metabench } from "./metabench.js"; diff --git a/packages/effect-plugin/package.json b/packages/effect-plugin/package.json index 110e770a5..29d2ecd18 100644 --- a/packages/effect-plugin/package.json +++ b/packages/effect-plugin/package.json @@ -3,10 +3,19 @@ "type": "module", "version": "0.1.0", "author": "Colin McDonnell ", - "files": ["src", "dist"], + "files": [ + "src", + "dist" + ], "funding": "https://github.com/sponsors/colinhacks", "homepage": "https://zod.dev", - "keywords": ["typescript", "schema", "validation", "type", "inference"], + "keywords": [ + "typescript", + "schema", + "validation", + "type", + "inference" + ], "license": "MIT", "sideEffects": false, "main": "./dist/commonjs/index.js", @@ -16,7 +25,6 @@ "./package.json": "./package.json", ".": { "import": { - "@zod/source": "./src/index.ts", "types": "./dist/esm/index.d.ts", "default": "./dist/esm/index.js" }, diff --git a/packages/zod/package.json b/packages/zod/package.json index 053f7c037..8214da82c 100644 --- a/packages/zod/package.json +++ b/packages/zod/package.json @@ -4,10 +4,19 @@ "version": "3.23.8", "author": "Colin McDonnell ", "description": "TypeScript-first schema declaration and validation library with static type inference", - "files": ["src", "dist"], + "files": [ + "src", + "dist" + ], "funding": "https://github.com/sponsors/colinhacks", "homepage": "https://zod.dev", - "keywords": ["typescript", "schema", "validation", "type", "inference"], + "keywords": [ + "typescript", + "schema", + "validation", + "type", + "inference" + ], "license": "MIT", "sideEffects": false, "main": "./dist/commonjs/index.js", @@ -17,7 +26,6 @@ "./package.json": "./package.json", ".": { "import": { - "@zod/source": "./src/index.ts", "types": "./dist/esm/index.d.ts", "default": "./dist/esm/index.js" }, @@ -28,7 +36,6 @@ }, "./locales/*": { "import": { - "@zod/source": "./src/locales/*", "types": "./dist/esm/locales/*", "default": "./dist/esm/locales/*" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b51e309d5..49f228887 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -88,8 +88,8 @@ importers: benchmarks: devDependencies: zod: - specifier: 3.23.8 - version: link:../packages/zod + specifier: 3.23.7 + version: 3.23.7 packages/effect-plugin: dependencies: @@ -1402,6 +1402,9 @@ packages: resolution: {integrity: sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==} engines: {node: '>=18'} + zod@3.23.7: + resolution: {integrity: sha512-NBeIoqbtOiUMomACV/y+V3Qfs9+Okr18vR5c/5pHClPpufWOrsx8TENboDPe265lFdfewX2yBtNTLPvnmCxwog==} + snapshots: '@ampproject/remapping@2.3.0': @@ -2603,3 +2606,5 @@ snapshots: yaml@1.10.2: {} yoctocolors@2.1.1: {} + + zod@3.23.7: {}