@ata-project/valibot 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -14
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -60,14 +60,14 @@ code generation blocked.
|
|
|
60
60
|
|
|
61
61
|
One representative API-boundary object schema (nine fields, nested arrays of
|
|
62
62
|
objects, picklist, nullable), interleaved medians of 7 rounds on an M-series
|
|
63
|
-
Mac, Node 25, valibot 1.
|
|
63
|
+
Mac, Node 25, valibot 1.5.0, ata-validator 1.36.0:
|
|
64
64
|
|
|
65
65
|
| | valibot `safeParse` | this package |
|
|
66
66
|
|---|---|---|
|
|
67
|
-
| accept, verdict only |
|
|
68
|
-
| reject, verdict only |
|
|
69
|
-
| reject, `safeParse` |
|
|
70
|
-
| accept, `safeParse` |
|
|
67
|
+
| accept, verdict only | 757 ns | **20 ns** |
|
|
68
|
+
| reject, verdict only | 833 ns | **83 ns** |
|
|
69
|
+
| reject, `safeParse` | 833 ns | **83 ns** |
|
|
70
|
+
| accept, `safeParse` | 757 ns | 777 ns |
|
|
71
71
|
|
|
72
72
|
The last row is by design, not a gap: an accepted value's output is valibot's
|
|
73
73
|
to make. Plain `v.object` strips unknown keys, defaults fill, transforms
|
|
@@ -81,7 +81,7 @@ number constraints they drop to the bare engine verdict.
|
|
|
81
81
|
|
|
82
82
|
With code generation blocked, the way a strict CSP or a locked-down edge
|
|
83
83
|
runtime blocks it: valibot stays at its usual speed, and the bridge falls back
|
|
84
|
-
to ata's interpreted engine at
|
|
84
|
+
to ata's interpreted engine at 630 ns for accepts and 191 ns for rejects,
|
|
85
85
|
still ahead on both.
|
|
86
86
|
|
|
87
87
|
## Ahead of time, for the browser
|
|
@@ -100,18 +100,20 @@ writeFileSync('validate-product.js', compileToModule(productSchema))
|
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
The emitted module imports nothing, not valibot and not ata. It exports
|
|
103
|
-
`isValid(data)` and `validate(data)`. Measured on
|
|
104
|
-
|
|
103
|
+
`isValid(data)` and `validate(data)`. Measured on the four-field product schema
|
|
104
|
+
in `test.js` (title, price, tags, images), each entry bundled with esbuild
|
|
105
|
+
`--bundle --minify` for the browser and gzipped, valibot 1.5.0 and
|
|
106
|
+
ata-validator 1.36.0:
|
|
105
107
|
|
|
106
108
|
| what ships | gz |
|
|
107
109
|
|---|---|
|
|
108
|
-
| valibot, tree-shaken for that schema | 1.
|
|
109
|
-
| this package's runtime bridge (
|
|
110
|
-
| **the compiled module** | **1.
|
|
110
|
+
| valibot, tree-shaken for that schema | 1.56 KB |
|
|
111
|
+
| this package's runtime bridge (valibot and ata's engine) | 116.3 KB |
|
|
112
|
+
| **the compiled module** | **1.40 KB** |
|
|
111
113
|
|
|
112
|
-
Both the compiled module and valibot's 1.
|
|
113
|
-
that is a fair pairing: the same size, no runtime dependency at all, and
|
|
114
|
-
function that was compiled rather than walked.
|
|
114
|
+
Both the compiled module and valibot's 1.56 KB include error reporting, so
|
|
115
|
+
that is a fair pairing: about the same size, no runtime dependency at all, and
|
|
116
|
+
a function that was compiled rather than walked.
|
|
115
117
|
|
|
116
118
|
Only schemas the classifier calls exact can be compiled. Anything valibot
|
|
117
119
|
checks at runtime (transforms, custom checks, formats, native types) throws
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ata-project/valibot",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Run valibot schemas on the ata engine: same answers, verdicts in nanoseconds",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@valibot/to-json-schema": "^1.3.0",
|
|
30
|
-
"ata-validator": "^1.
|
|
30
|
+
"ata-validator": "^1.36.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"valibot": "^1.0.0"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^26.5.0",
|
|
37
37
|
"typescript": "^5.6.0",
|
|
38
|
-
"valibot": "^1.
|
|
38
|
+
"valibot": "^1.5.0"
|
|
39
39
|
},
|
|
40
40
|
"exports": {
|
|
41
41
|
".": {
|