{"_id":"@ata-project/valibot","_rev":"3-f5c9f37766ac5cc63f44775e396024fe","name":"@ata-project/valibot","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@ata-project/valibot","version":"0.1.0","license":"MIT","_id":"@ata-project/valibot@0.1.0","maintainers":[{"name":"mertcanaltin","email":"mertgold60@gmail.com"}],"homepage":"https://github.com/ata-core/ata-valibot#readme","bugs":{"url":"https://github.com/ata-core/ata-valibot/issues"},"dist":{"shasum":"374d058a6ef867ea851743ed969318a802a0fe93","tarball":"https://registry.npmjs.org/@ata-project/valibot/-/valibot-0.1.0.tgz","fileCount":5,"integrity":"sha512-ob2CWx76cNvQo8pOi4hIaapX1knyEVKyhFn2Al2uhRO5fsmSR7R/GDa3LfNCCjOXLSyQ/J6WD11aVYnI3Arzpg==","signatures":[{"sig":"MEQCIHimwH5yO//od6xcIliBX2lnhFC3i8di25sU5NTgGL/VAiAikYgMkTpE+GFxw/ycJ2NcTXkBdOy01EdUDgmrTYTNdw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22536},"main":"index.js","types":"index.d.ts","gitHead":"21015ea7bde6b6ab01f0dd5d44cebb1737661d06","scripts":{"test":"node test.js && node --disallow-code-generation-from-strings test.js && npm run test:types","bench":"node bench.mjs","test:types":"tsc --noEmit -p tsconfig.json"},"_npmUser":{"name":"mertcanaltin","email":"mertgold60@gmail.com"},"repository":{"url":"git+https://github.com/ata-core/ata-valibot.git","type":"git"},"_npmVersion":"11.19.0","description":"Run valibot schemas on the ata engine: same answers, verdicts in nanoseconds","directories":{},"_nodeVersion":"25.2.1","dependencies":{"ata-validator":"^1.13.2","@valibot/to-json-schema":"^1.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"valibot":"^1.0.0","typescript":"^5.6.0","@types/node":"^26.5.0"},"peerDependencies":{"valibot":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/valibot_0.1.0_1788890428670_0.4948377700833524","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@ata-project/valibot","version":"0.2.0","license":"MIT","_id":"@ata-project/valibot@0.2.0","maintainers":[{"name":"mertcanaltin","email":"mertgold60@gmail.com"}],"homepage":"https://github.com/ata-core/ata-valibot#readme","bugs":{"url":"https://github.com/ata-core/ata-valibot/issues"},"dist":{"shasum":"5531d0526412280be8dcef098fbcaef5d0486584","tarball":"https://registry.npmjs.org/@ata-project/valibot/-/valibot-0.2.0.tgz","fileCount":7,"integrity":"sha512-G4+bNh0aFK2HsDMIYdtGSgcLkCEpiNCJSAL1HazMEmDyYEpNdEbm07+j0e2miNMJkhWYovg0Ch1jB5STD4gtdA==","signatures":[{"sig":"MEUCIBv6gq/eiccV7xK1aqk9vMWT+oi6LporBGgtBLify1XlAiEAz//wXU+3YbapdUabo5RARghlGnzpVkAeQL5uB1oqeBc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29971},"main":"index.js","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./build":{"types":"./build.d.ts","default":"./build.js"},"./package.json":"./package.json"},"gitHead":"8a2a8497244423e52bce9f0303718ceb095cc059","scripts":{"test":"node test.js && node --disallow-code-generation-from-strings test.js && npm run test:types","bench":"node bench.mjs","test:types":"tsc --noEmit -p tsconfig.json"},"_npmUser":{"name":"mertcanaltin","email":"mertgold60@gmail.com"},"repository":{"url":"git+https://github.com/ata-core/ata-valibot.git","type":"git"},"_npmVersion":"11.19.0","description":"Run valibot schemas on the ata engine: same answers, verdicts in nanoseconds","directories":{},"_nodeVersion":"25.2.1","dependencies":{"ata-validator":"^1.13.2","@valibot/to-json-schema":"^1.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"valibot":"^1.0.0","typescript":"^5.6.0","@types/node":"^26.5.0"},"peerDependencies":{"valibot":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/valibot_0.2.0_1788891814630_0.09247187915142074","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@ata-project/valibot","version":"0.2.1","description":"Run valibot schemas on the ata engine: same answers, verdicts in nanoseconds","license":"MIT","main":"index.js","types":"index.d.ts","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/ata-core/ata-valibot.git"},"scripts":{"test":"node test.js && node --disallow-code-generation-from-strings test.js && npm run test:types","bench":"node bench.mjs","test:types":"tsc --noEmit -p tsconfig.json"},"dependencies":{"@valibot/to-json-schema":"^1.3.0","ata-validator":"^1.25.0"},"peerDependencies":{"valibot":"^1.0.0"},"devDependencies":{"@types/node":"^26.5.0","typescript":"^5.6.0","valibot":"^1.5.0"},"exports":{".":{"types":"./index.d.ts","default":"./index.js"},"./build":{"types":"./build.d.ts","default":"./build.js"},"./package.json":"./package.json"},"gitHead":"114b43537da33c22d5b2df0f8bdf4a14687e6e4c","_id":"@ata-project/valibot@0.2.1","bugs":{"url":"https://github.com/ata-core/ata-valibot/issues"},"homepage":"https://github.com/ata-core/ata-valibot#readme","_nodeVersion":"25.2.1","_npmVersion":"11.19.0","dist":{"integrity":"sha512-2gyzMlEyAGWRBS5rjUhtBwvo3wTpDLZKPsqfZlAGyS9vS9OjXrDlcYdQMoZZtaEF6nXQXXt7oIepNCxUyuniXQ==","shasum":"bd0eb4509ff060b45ad5170184de7be293e8d40f","tarball":"https://registry.npmjs.org/@ata-project/valibot/-/valibot-0.2.1.tgz","fileCount":7,"unpackedSize":29961,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDAh/82XCKaSGan2S+ugkOghxLuxR//xOM/yWohbwxndAiBofhdnU77GhckQvnHFE+qkIUkrKUEXOBWQGbc+wCZxQQ=="}]},"_npmUser":{"name":"mertcanaltin","email":"mertgold60@gmail.com"},"directories":{},"maintainers":[{"name":"mertcanaltin","email":"mertgold60@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/valibot_0.2.1_1789637486473_0.8583512574102103"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-08T18:00:28.538Z","modified":"2026-09-17T09:31:26.765Z","0.1.0":"2026-09-08T18:00:28.804Z","0.2.0":"2026-09-08T18:23:34.782Z","0.2.1":"2026-09-17T09:31:26.594Z"},"bugs":{"url":"https://github.com/ata-core/ata-valibot/issues"},"license":"MIT","homepage":"https://github.com/ata-core/ata-valibot#readme","repository":{"type":"git","url":"git+https://github.com/ata-core/ata-valibot.git"},"description":"Run valibot schemas on the ata engine: same answers, verdicts in nanoseconds","maintainers":[{"name":"mertcanaltin","email":"mertgold60@gmail.com"}],"readme":"# @ata-project/valibot\n\nRun a valibot schema on the [ata engine](https://github.com/ata-core/ata-validator).\nThe schema stays valibot, the answers always match valibot's own, and the\nverdicts arrive in nanoseconds.\n\n```\nnpm install @ata-project/valibot\n```\n\nvalibot and ata-validator are installed alongside; valibot is a peer.\n\n```js\nimport * as v from 'valibot'\nimport { compile } from '@ata-project/valibot'\n\nconst user = v.object({\n  id: v.pipe(v.number(), v.integer(), v.minValue(1)),\n  name: v.pipe(v.string(), v.minLength(1)),\n})\n\nconst check = compile(user)\ncheck.isValid(data)        // ata answers\ncheck.safeParse(data)      // valibot-shaped result, valibot-produced value\ncheck.parse(data)          // throws a real ValiError\ncheck.isValidBytes(bytes)  // verdict from a Buffer or JSON string\n```\n\n## How it stays correct\n\nvalibot ships an official JSON Schema conversion (`@valibot/to-json-schema`).\nThe bridge asks it for the input side with unrepresentable features ignored,\nwhich can only make the emitted schema looser than valibot, never stricter.\nThen the schema is classified by walking valibot's own tree before anything\nruns:\n\n| Mode | When | Who answers |\n|---|---|---|\n| `ata` | the conversion is exact | ata alone |\n| `hybrid` | provably looser (transforms, checks, formats, native types) | ata's rejections are final, valibot confirms acceptances |\n| `valibot` | valibot accepts what the conversion rejects (fallback, records, async) or a node is unknown | valibot |\n\nThe classification is conservative: an unrecognised node lands in `valibot`\nmode, so a new valibot feature can make the bridge slower, never wrong.\n`compiled.engine` tells you which mode you got, `compiled.reasons` says why.\n\nTwo valibot semantics survive nowhere in JSON Schema and are handled\nexplicitly rather than papered over. valibot's `number` accepts Infinity,\nwhich JSON has no word for: schemas that constrain numbers get a scan of the\nrejected value, and a rejection that might be Infinity-caused is handed to\nvalibot for the final word. And `v.record` runs on arrays too, so records stay\nvalibot's entirely.\n\nThe package is differential-tested against valibot on 11,788 generated values\nacross all three modes, including NaN and Infinity corners and the compiled\nmodules the build entry emits, and the whole suite runs a second time with\ncode generation blocked.\n\n## What it costs, measured\n\nOne representative API-boundary object schema (nine fields, nested arrays of\nobjects, picklist, nullable), interleaved medians of 7 rounds on an M-series\nMac, Node 25, valibot 1.5.0, ata-validator 1.25.0:\n\n| | valibot `safeParse` | this package |\n|---|---|---|\n| accept, verdict only | 740 ns | **21 ns** |\n| reject, verdict only | 818 ns | **82 ns** |\n| reject, `safeParse` | 818 ns | **83 ns** |\n| accept, `safeParse` | 740 ns | 763 ns |\n\nThe last row is by design, not a gap: an accepted value's output is valibot's\nto make. Plain `v.object` strips unknown keys, defaults fill, transforms\nrewrite, so `safeParse` hands every accepted value to valibot and returns\nexactly what valibot returns. What this package owns is the verdict and the\nrejection, and a rejected `safeParse` builds its issues only when somebody\nreads them, by running valibot once at that moment.\n\nThe reject rows carry the Infinity scan described above; on schemas with no\nnumber constraints they drop to the bare engine verdict.\n\nWith code generation blocked, the way a strict CSP or a locked-down edge\nruntime blocks it: valibot stays at its usual speed, and the bridge falls back\nto ata's interpreted engine at 627 ns for accepts and 184 ns for rejects,\nstill ahead on both.\n\n## Ahead of time, for the browser\n\nThe runtime bridge above carries a general engine that can validate any schema\nhanded to it. In a browser that is the wrong trade, and valibot users of all\npeople know why: a bundle is not the place for a compiler.\n\nSo compile the schema instead, at build time:\n\n```js\nimport { compileToModule } from '@ata-project/valibot/build'\nimport { writeFileSync } from 'node:fs'\n\nwriteFileSync('validate-product.js', compileToModule(productSchema))\n```\n\nThe emitted module imports nothing, not valibot and not ata. It exports\n`isValid(data)` and `validate(data)`. Measured on a four-field product schema,\nesbuild, minified and gzipped:\n\n| what ships | gz |\n|---|---|\n| valibot, tree-shaken for that schema | 1.7 KB |\n| this package's runtime bridge (the engine) | 66.2 KB |\n| **the compiled module** | **1.67 KB** |\n\nBoth the compiled module and valibot's 1.7 KB include error reporting, so\nthat is a fair pairing: the same size, no runtime dependency at all, and a\nfunction that was compiled rather than walked.\n\nOnly schemas the classifier calls exact can be compiled. Anything valibot\nchecks at runtime (transforms, custom checks, formats, native types) throws\n`NotExactError` rather than being quietly compiled without those checks; use\nthe runtime bridge for those. `canCompile(schema)` tells you which you have\nbefore you build.\n\nEmitting a module uses code generation, so run it at build time in Node. What\nit emits is plain code and runs anywhere, a strict CSP included.\n\n## Raw bytes\n\n`isValidBytes` answers from a `Buffer`, `Uint8Array` or JSON string. On an\n`engine: 'ata'` schema with no number constraints and the native engine\npresent, the verdict comes straight off the bytes with no `JSON.parse`; other\nschemas parse first so number semantics stay exact. Bytes that are not valid\nJSON return `false` rather than throwing.\n\n## Limitations, plainly\n\n- Accepted values in `hybrid` mode and every value in `valibot` mode run\n  valibot, so those paths are valibot-speed. The win is the rejection and the\n  pure-schema case.\n- `validate()` reports ata's errors for the schema-representable part, which\n  are JSON Schema errors, not valibot issues. Use `safeParse` when you need\n  valibot's issue shape.\n- The classifier reads valibot's public schema tree and the peer range is\n  pinned to valibot 1; the differential suite is the tripwire for internals\n  moving.\n- Async schemas are not supported; `safeParse` is synchronous, as in valibot.\n\n## Standard Schema\n\nThe compiled object implements Standard Schema V1, so anything that accepts a\nstandard schema runs the fast path without knowing either library.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}