@oxog/vld 1.0.0
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/CHANGELOG.md +113 -0
- package/LICENSE +21 -0
- package/README.md +776 -0
- package/dist/errors.d.ts +49 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +144 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +275 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1170 -0
- package/dist/index.js.map +1 -0
- package/dist/locales/af.d.ts +3 -0
- package/dist/locales/af.d.ts.map +1 -0
- package/dist/locales/af.js +74 -0
- package/dist/locales/af.js.map +1 -0
- package/dist/locales/ar.d.ts +3 -0
- package/dist/locales/ar.d.ts.map +1 -0
- package/dist/locales/ar.js +74 -0
- package/dist/locales/ar.js.map +1 -0
- package/dist/locales/bn.d.ts +3 -0
- package/dist/locales/bn.d.ts.map +1 -0
- package/dist/locales/bn.js +74 -0
- package/dist/locales/bn.js.map +1 -0
- package/dist/locales/da.d.ts +3 -0
- package/dist/locales/da.d.ts.map +1 -0
- package/dist/locales/da.js +74 -0
- package/dist/locales/da.js.map +1 -0
- package/dist/locales/de.d.ts +3 -0
- package/dist/locales/de.d.ts.map +1 -0
- package/dist/locales/de.js +74 -0
- package/dist/locales/de.js.map +1 -0
- package/dist/locales/en.d.ts +3 -0
- package/dist/locales/en.d.ts.map +1 -0
- package/dist/locales/en.js +74 -0
- package/dist/locales/en.js.map +1 -0
- package/dist/locales/es-MX.d.ts +3 -0
- package/dist/locales/es-MX.d.ts.map +1 -0
- package/dist/locales/es-MX.js +74 -0
- package/dist/locales/es-MX.js.map +1 -0
- package/dist/locales/es.d.ts +3 -0
- package/dist/locales/es.d.ts.map +1 -0
- package/dist/locales/es.js +62 -0
- package/dist/locales/es.js.map +1 -0
- package/dist/locales/fi.d.ts +3 -0
- package/dist/locales/fi.d.ts.map +1 -0
- package/dist/locales/fi.js +74 -0
- package/dist/locales/fi.js.map +1 -0
- package/dist/locales/fr.d.ts +3 -0
- package/dist/locales/fr.d.ts.map +1 -0
- package/dist/locales/fr.js +62 -0
- package/dist/locales/fr.js.map +1 -0
- package/dist/locales/hi.d.ts +3 -0
- package/dist/locales/hi.d.ts.map +1 -0
- package/dist/locales/hi.js +74 -0
- package/dist/locales/hi.js.map +1 -0
- package/dist/locales/id.d.ts +3 -0
- package/dist/locales/id.d.ts.map +1 -0
- package/dist/locales/id.js +74 -0
- package/dist/locales/id.js.map +1 -0
- package/dist/locales/index.d.ts +19 -0
- package/dist/locales/index.d.ts.map +1 -0
- package/dist/locales/index.js +91 -0
- package/dist/locales/index.js.map +1 -0
- package/dist/locales/it.d.ts +3 -0
- package/dist/locales/it.d.ts.map +1 -0
- package/dist/locales/it.js +74 -0
- package/dist/locales/it.js.map +1 -0
- package/dist/locales/ja.d.ts +3 -0
- package/dist/locales/ja.d.ts.map +1 -0
- package/dist/locales/ja.js +74 -0
- package/dist/locales/ja.js.map +1 -0
- package/dist/locales/ko.d.ts +3 -0
- package/dist/locales/ko.d.ts.map +1 -0
- package/dist/locales/ko.js +74 -0
- package/dist/locales/ko.js.map +1 -0
- package/dist/locales/nl.d.ts +3 -0
- package/dist/locales/nl.d.ts.map +1 -0
- package/dist/locales/nl.js +74 -0
- package/dist/locales/nl.js.map +1 -0
- package/dist/locales/no.d.ts +3 -0
- package/dist/locales/no.d.ts.map +1 -0
- package/dist/locales/no.js +74 -0
- package/dist/locales/no.js.map +1 -0
- package/dist/locales/pl.d.ts +3 -0
- package/dist/locales/pl.d.ts.map +1 -0
- package/dist/locales/pl.js +74 -0
- package/dist/locales/pl.js.map +1 -0
- package/dist/locales/pt-BR.d.ts +3 -0
- package/dist/locales/pt-BR.d.ts.map +1 -0
- package/dist/locales/pt-BR.js +74 -0
- package/dist/locales/pt-BR.js.map +1 -0
- package/dist/locales/pt.d.ts +3 -0
- package/dist/locales/pt.d.ts.map +1 -0
- package/dist/locales/pt.js +74 -0
- package/dist/locales/pt.js.map +1 -0
- package/dist/locales/ru.d.ts +3 -0
- package/dist/locales/ru.d.ts.map +1 -0
- package/dist/locales/ru.js +74 -0
- package/dist/locales/ru.js.map +1 -0
- package/dist/locales/sv.d.ts +3 -0
- package/dist/locales/sv.d.ts.map +1 -0
- package/dist/locales/sv.js +74 -0
- package/dist/locales/sv.js.map +1 -0
- package/dist/locales/sw.d.ts +3 -0
- package/dist/locales/sw.d.ts.map +1 -0
- package/dist/locales/sw.js +74 -0
- package/dist/locales/sw.js.map +1 -0
- package/dist/locales/th.d.ts +3 -0
- package/dist/locales/th.d.ts.map +1 -0
- package/dist/locales/th.js +74 -0
- package/dist/locales/th.js.map +1 -0
- package/dist/locales/tr.d.ts +3 -0
- package/dist/locales/tr.d.ts.map +1 -0
- package/dist/locales/tr.js +74 -0
- package/dist/locales/tr.js.map +1 -0
- package/dist/locales/types.d.ts +60 -0
- package/dist/locales/types.d.ts.map +1 -0
- package/dist/locales/types.js +2 -0
- package/dist/locales/types.js.map +1 -0
- package/dist/locales/vi.d.ts +3 -0
- package/dist/locales/vi.d.ts.map +1 -0
- package/dist/locales/vi.js +74 -0
- package/dist/locales/vi.js.map +1 -0
- package/dist/locales/zh.d.ts +3 -0
- package/dist/locales/zh.d.ts.map +1 -0
- package/dist/locales/zh.js +74 -0
- package/dist/locales/zh.js.map +1 -0
- package/dist/locales.d.ts +54 -0
- package/dist/locales.d.ts.map +1 -0
- package/dist/locales.js +732 -0
- package/dist/locales.js.map +1 -0
- package/package.json +73 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2025-08-10
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
**Core Features**
|
|
13
|
+
- Complete validation engine with JIT compilation for 2x performance boost
|
|
14
|
+
- Trait-based plugin architecture for maximum extensibility
|
|
15
|
+
- Zero runtime dependencies with < 8KB bundle size (minified + gzipped)
|
|
16
|
+
- Full TypeScript support with perfect type inference and IntelliSense
|
|
17
|
+
- Comprehensive error system with detailed formatting and debugging
|
|
18
|
+
|
|
19
|
+
**Schema Types**
|
|
20
|
+
- **Primitive schemas**: `string`, `number`, `boolean`, `bigint`, `null`, `undefined`, `literal`
|
|
21
|
+
- **Complex types**: `object`, `array`, `tuple`, `union`, `intersection`, `record`, `map`, `set`
|
|
22
|
+
- **Advanced types**: `lazy` (recursive), `promise`, `function`, `discriminatedUnion`
|
|
23
|
+
- **Branded types**: Create distinct types that prevent value mixing
|
|
24
|
+
- **Template literal support**: Advanced string pattern validation
|
|
25
|
+
|
|
26
|
+
**String Validation**
|
|
27
|
+
- Email validation (RFC 5322 compliant)
|
|
28
|
+
- URL validation (supports http/https/ftp)
|
|
29
|
+
- UUID validation (v1-v5 supported)
|
|
30
|
+
- CUID and CUID2 support
|
|
31
|
+
- ULID format validation
|
|
32
|
+
- Custom regex patterns
|
|
33
|
+
- DateTime and IP address formats
|
|
34
|
+
- Base64 encoding validation
|
|
35
|
+
- Length, content, and format constraints
|
|
36
|
+
|
|
37
|
+
**Number Validation**
|
|
38
|
+
- Integer and float validation
|
|
39
|
+
- Range validation (min/max/gt/lt)
|
|
40
|
+
- Safe integer validation
|
|
41
|
+
- Finite number checks
|
|
42
|
+
- Multiple/step validation
|
|
43
|
+
- Precision constraints
|
|
44
|
+
- Special number handling (NaN, Infinity)
|
|
45
|
+
|
|
46
|
+
**Object & Array Features**
|
|
47
|
+
- Nested object validation with strict/passthrough/strip modes
|
|
48
|
+
- Array length constraints and element validation
|
|
49
|
+
- Tuple validation with exact type inference
|
|
50
|
+
- Record validation with key/value constraints
|
|
51
|
+
- Deep object merging and extension
|
|
52
|
+
- Partial and required modifiers
|
|
53
|
+
- Pick and omit operations
|
|
54
|
+
|
|
55
|
+
**Union & Intersection Types**
|
|
56
|
+
- Standard unions with type inference
|
|
57
|
+
- **Discriminated unions with O(1) performance** (up to 12x faster than regular unions)
|
|
58
|
+
- Intersection types for combining schemas
|
|
59
|
+
- Enum validation with compile-time safety
|
|
60
|
+
|
|
61
|
+
**Modifiers & Transformations**
|
|
62
|
+
- `optional()`: Make fields optional (T | undefined)
|
|
63
|
+
- `nullable()`: Allow null values (T | null)
|
|
64
|
+
- `nullish()`: Allow null or undefined (T | null | undefined)
|
|
65
|
+
- `default()`: Provide default values
|
|
66
|
+
- `catch()`: Fallback values on validation errors
|
|
67
|
+
- `transform()`: Data transformation pipeline
|
|
68
|
+
- `refine()` and `superRefine()`: Custom validation logic
|
|
69
|
+
- `pipe()`: Sequential transformation chains
|
|
70
|
+
|
|
71
|
+
**Async Support**
|
|
72
|
+
- `parseAsync()` and `safeParseAsync()` methods
|
|
73
|
+
- Async refinement functions
|
|
74
|
+
- Promise schema validation
|
|
75
|
+
- Async transform functions
|
|
76
|
+
|
|
77
|
+
**Plugin System**
|
|
78
|
+
- Built-in plugins: DateTime, i18n, Custom Formats
|
|
79
|
+
- Plugin hooks: beforeParse, afterParse, onError
|
|
80
|
+
- Custom schema registration
|
|
81
|
+
- Transform and validator registration
|
|
82
|
+
- Configurable plugin loading
|
|
83
|
+
|
|
84
|
+
**Built-in Plugins**
|
|
85
|
+
- **DateTime Plugin**: Date, time, and datetime validation with timezone support
|
|
86
|
+
- **i18n Plugin**: Multi-language error messages (English, Spanish, French, German, Chinese, Japanese)
|
|
87
|
+
- **Custom Formats Plugin**: Credit cards, IP addresses, hex colors, Base64, MAC addresses, ISBN/EAN
|
|
88
|
+
|
|
89
|
+
**Error Handling**
|
|
90
|
+
- Detailed error paths and messages
|
|
91
|
+
- Error formatting and flattening utilities
|
|
92
|
+
- Custom error messages with interpolation
|
|
93
|
+
- Structured error reporting
|
|
94
|
+
- Error caching for performance
|
|
95
|
+
|
|
96
|
+
**Security Features**
|
|
97
|
+
- Automatic prototype pollution protection
|
|
98
|
+
- Input sanitization safeguards
|
|
99
|
+
- DoS attack mitigation with size limits
|
|
100
|
+
- Safe error messages (no sensitive data leakage)
|
|
101
|
+
- Schema validation prevents code execution
|
|
102
|
+
|
|
103
|
+
### Performance
|
|
104
|
+
- 2x faster than Zod v4 in object validation benchmarks
|
|
105
|
+
- < 8KB core bundle size (minified + gzipped)
|
|
106
|
+
- Optimized validation paths with JIT compilation
|
|
107
|
+
- Memory-efficient with object pooling
|
|
108
|
+
|
|
109
|
+
### Documentation
|
|
110
|
+
- Complete API documentation
|
|
111
|
+
- Migration guide from Zod
|
|
112
|
+
- Performance optimization guide
|
|
113
|
+
- TypeScript integration examples
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ersin Koc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|