@oxog/vld 2.1.0 → 2.2.5

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.
Files changed (220) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +1296 -1235
  3. package/dist/chunks/errors-core-Cqi4-9ew.js +1 -0
  4. package/dist/chunks/index-CkbfQQ4n.js +1 -0
  5. package/dist/chunks/index-yjpbvFgw.js +1 -0
  6. package/dist/chunks/ip-validation-g5LWgy9t.js +1 -0
  7. package/dist/chunks/security-Dy24T8N7.js +1 -0
  8. package/dist/cjs/chunks/errors-core-DKPohm9I.cjs +1 -0
  9. package/dist/cjs/chunks/index-BEV9nG0N.cjs +1 -0
  10. package/dist/cjs/chunks/index-ZjHAxYdA.cjs +1 -0
  11. package/dist/cjs/chunks/ip-validation-BZqPamPC.cjs +1 -0
  12. package/dist/cjs/chunks/security-aXZVI7qW.cjs +1 -0
  13. package/dist/cjs/cli/bin.cjs +1 -505
  14. package/dist/cjs/cli/index.cjs +1 -209
  15. package/dist/cjs/codecs/index.cjs +1 -45
  16. package/dist/cjs/coercion/index.cjs +1 -588
  17. package/dist/cjs/compat/emitter.cjs +1 -184
  18. package/dist/cjs/compat/result.cjs +1 -189
  19. package/dist/cjs/errors.cjs +1 -180
  20. package/dist/cjs/index.cjs +1 -1894
  21. package/dist/cjs/kernel.cjs +1 -415
  22. package/dist/cjs/locales/af.cjs +1 -108
  23. package/dist/cjs/locales/ar.cjs +1 -108
  24. package/dist/cjs/locales/bn.cjs +1 -108
  25. package/dist/cjs/locales/da.cjs +1 -108
  26. package/dist/cjs/locales/de.cjs +1 -108
  27. package/dist/cjs/locales/en.cjs +1 -108
  28. package/dist/cjs/locales/es-MX.cjs +1 -107
  29. package/dist/cjs/locales/es.cjs +1 -96
  30. package/dist/cjs/locales/fi.cjs +1 -108
  31. package/dist/cjs/locales/fr.cjs +1 -96
  32. package/dist/cjs/locales/hi.cjs +1 -108
  33. package/dist/cjs/locales/id.cjs +1 -108
  34. package/dist/cjs/locales/index.cjs +1 -43
  35. package/dist/cjs/locales/it.cjs +1 -108
  36. package/dist/cjs/locales/ja.cjs +1 -108
  37. package/dist/cjs/locales/ko.cjs +1 -108
  38. package/dist/cjs/locales/lazy.cjs +1 -188
  39. package/dist/cjs/locales/nl.cjs +1 -108
  40. package/dist/cjs/locales/no.cjs +1 -108
  41. package/dist/cjs/locales/pl.cjs +1 -108
  42. package/dist/cjs/locales/pt-BR.cjs +1 -108
  43. package/dist/cjs/locales/pt.cjs +1 -108
  44. package/dist/cjs/locales/ru.cjs +1 -108
  45. package/dist/cjs/locales/runtime.cjs +1 -51
  46. package/dist/cjs/locales/sv.cjs +1 -108
  47. package/dist/cjs/locales/sw.cjs +1 -108
  48. package/dist/cjs/locales/th.cjs +1 -108
  49. package/dist/cjs/locales/tr.cjs +1 -108
  50. package/dist/cjs/locales/vi.cjs +1 -108
  51. package/dist/cjs/locales/zh.cjs +1 -108
  52. package/dist/cjs/mini.cjs +1 -242
  53. package/dist/cjs/pigment.cjs +1 -207
  54. package/dist/cjs/plugins/index.cjs +1 -12
  55. package/dist/cjs/registry.cjs +1 -37
  56. package/dist/cjs/v3/index.cjs +1 -425
  57. package/dist/cjs/v4/core/index.cjs +1 -894
  58. package/dist/cjs/v4/index.cjs +1 -425
  59. package/dist/cjs/v4/locales/index.cjs +1 -130
  60. package/dist/cjs/v4/mini/index.cjs +1 -509
  61. package/dist/cjs/v4-mini/index.cjs +1 -532
  62. package/dist/cjs/validators/any.cjs +1 -40
  63. package/dist/cjs/validators/array.cjs +1 -283
  64. package/dist/cjs/validators/base.cjs +1 -887
  65. package/dist/cjs/validators/base64.cjs +1 -73
  66. package/dist/cjs/validators/bigint.cjs +1 -232
  67. package/dist/cjs/validators/boolean.cjs +1 -146
  68. package/dist/cjs/validators/codec.cjs +1 -205
  69. package/dist/cjs/validators/custom.cjs +1 -71
  70. package/dist/cjs/validators/date.cjs +1 -278
  71. package/dist/cjs/validators/discriminated-union.cjs +1 -130
  72. package/dist/cjs/validators/enum.cjs +1 -154
  73. package/dist/cjs/validators/file.cjs +1 -130
  74. package/dist/cjs/validators/function.cjs +1 -63
  75. package/dist/cjs/validators/hex.cjs +1 -70
  76. package/dist/cjs/validators/index.cjs +1 -123
  77. package/dist/cjs/validators/intersection.cjs +1 -120
  78. package/dist/cjs/validators/json.cjs +1 -70
  79. package/dist/cjs/validators/lazy.cjs +1 -53
  80. package/dist/cjs/validators/literal.cjs +1 -64
  81. package/dist/cjs/validators/map.cjs +1 -218
  82. package/dist/cjs/validators/nan.cjs +1 -41
  83. package/dist/cjs/validators/never.cjs +1 -36
  84. package/dist/cjs/validators/null.cjs +1 -43
  85. package/dist/cjs/validators/number.cjs +1 -427
  86. package/dist/cjs/validators/object.cjs +1 -868
  87. package/dist/cjs/validators/promise.cjs +1 -115
  88. package/dist/cjs/validators/record.cjs +1 -262
  89. package/dist/cjs/validators/set.cjs +1 -203
  90. package/dist/cjs/validators/string-bool.cjs +1 -124
  91. package/dist/cjs/validators/string-formats.cjs +1 -168
  92. package/dist/cjs/validators/string.cjs +1 -12
  93. package/dist/cjs/validators/symbol.cjs +1 -62
  94. package/dist/cjs/validators/template-literal.cjs +1 -108
  95. package/dist/cjs/validators/tuple.cjs +1 -187
  96. package/dist/cjs/validators/uint8array.cjs +1 -106
  97. package/dist/cjs/validators/undefined.cjs +1 -43
  98. package/dist/cjs/validators/union.cjs +1 -191
  99. package/dist/cjs/validators/unknown.cjs +1 -40
  100. package/dist/cjs/validators/void.cjs +1 -48
  101. package/dist/cjs/validators/xor.cjs +1 -69
  102. package/dist/cli/bin.js +1 -406
  103. package/dist/cli/index.js +1 -205
  104. package/dist/codecs/index.js +1 -11
  105. package/dist/coercion/index.js +1 -579
  106. package/dist/compat/emitter.js +1 -180
  107. package/dist/compat/result.js +1 -170
  108. package/dist/errors-core.d.ts +20 -1
  109. package/dist/errors.js +1 -171
  110. package/dist/index.d.ts +248 -357
  111. package/dist/index.js +1 -1534
  112. package/dist/kernel.js +1 -409
  113. package/dist/locales/af.js +1 -106
  114. package/dist/locales/ar.js +1 -106
  115. package/dist/locales/bn.js +1 -106
  116. package/dist/locales/da.js +1 -106
  117. package/dist/locales/de.js +1 -106
  118. package/dist/locales/en.js +1 -106
  119. package/dist/locales/es-MX.js +1 -105
  120. package/dist/locales/es.js +1 -94
  121. package/dist/locales/fi.js +1 -106
  122. package/dist/locales/fr.js +1 -94
  123. package/dist/locales/hi.js +1 -106
  124. package/dist/locales/id.js +1 -106
  125. package/dist/locales/index.js +1 -29
  126. package/dist/locales/it.js +1 -106
  127. package/dist/locales/ja.js +1 -106
  128. package/dist/locales/ko.js +1 -106
  129. package/dist/locales/lazy.js +1 -177
  130. package/dist/locales/nl.js +1 -106
  131. package/dist/locales/no.js +1 -106
  132. package/dist/locales/pl.js +1 -106
  133. package/dist/locales/pt-BR.js +1 -106
  134. package/dist/locales/pt.js +1 -106
  135. package/dist/locales/ru.js +1 -106
  136. package/dist/locales/runtime.js +1 -41
  137. package/dist/locales/sv.js +1 -106
  138. package/dist/locales/sw.js +1 -106
  139. package/dist/locales/th.js +1 -106
  140. package/dist/locales/tr.js +1 -106
  141. package/dist/locales/vi.js +1 -106
  142. package/dist/locales/zh.js +1 -106
  143. package/dist/mini.d.ts +3 -3
  144. package/dist/mini.js +1 -156
  145. package/dist/pigment.js +1 -180
  146. package/dist/plugins/index.js +1 -1
  147. package/dist/registry.js +1 -34
  148. package/dist/utils/json-schema.d.ts +10 -1
  149. package/dist/v3/index.js +1 -46
  150. package/dist/v4/core/index.d.ts +28 -16
  151. package/dist/v4/core/index.js +1 -277
  152. package/dist/v4/index.js +1 -50
  153. package/dist/v4/locales/index.d.ts +4 -0
  154. package/dist/v4/locales/index.js +1 -77
  155. package/dist/v4/mini/index.js +1 -47
  156. package/dist/v4-mini/index.d.ts +1 -1
  157. package/dist/v4-mini/index.js +1 -75
  158. package/dist/validators/any.js +1 -37
  159. package/dist/validators/array.d.ts +7 -0
  160. package/dist/validators/array.js +1 -279
  161. package/dist/validators/base.d.ts +63 -8
  162. package/dist/validators/base.js +1 -868
  163. package/dist/validators/base64.js +1 -68
  164. package/dist/validators/bigint.js +1 -228
  165. package/dist/validators/boolean.js +1 -142
  166. package/dist/validators/codec.js +1 -200
  167. package/dist/validators/custom.js +1 -67
  168. package/dist/validators/date.js +1 -274
  169. package/dist/validators/discriminated-union.d.ts +2 -2
  170. package/dist/validators/discriminated-union.js +1 -123
  171. package/dist/validators/enum.js +1 -150
  172. package/dist/validators/file.js +1 -125
  173. package/dist/validators/function.js +1 -58
  174. package/dist/validators/hex.js +1 -65
  175. package/dist/validators/index.d.ts +1 -1
  176. package/dist/validators/index.js +1 -35
  177. package/dist/validators/intersection.js +1 -116
  178. package/dist/validators/json.js +1 -66
  179. package/dist/validators/lazy.js +1 -50
  180. package/dist/validators/literal.d.ts +7 -3
  181. package/dist/validators/literal.js +1 -60
  182. package/dist/validators/map.js +1 -214
  183. package/dist/validators/nan.js +1 -38
  184. package/dist/validators/never.js +1 -32
  185. package/dist/validators/null.js +1 -40
  186. package/dist/validators/number.d.ts +20 -1
  187. package/dist/validators/number.js +1 -423
  188. package/dist/validators/object.d.ts +12 -2
  189. package/dist/validators/object.js +1 -864
  190. package/dist/validators/promise.js +1 -111
  191. package/dist/validators/record.d.ts +11 -8
  192. package/dist/validators/record.js +1 -258
  193. package/dist/validators/set.js +1 -199
  194. package/dist/validators/string-bool.js +1 -120
  195. package/dist/validators/string-formats.d.ts +58 -62
  196. package/dist/validators/string-formats.js +1 -135
  197. package/dist/validators/string.d.ts +47 -10
  198. package/dist/validators/string.js +1 -4
  199. package/dist/validators/symbol.js +1 -58
  200. package/dist/validators/template-literal.js +1 -103
  201. package/dist/validators/tuple.d.ts +17 -13
  202. package/dist/validators/tuple.js +1 -183
  203. package/dist/validators/uint8array.js +1 -101
  204. package/dist/validators/undefined.js +1 -40
  205. package/dist/validators/union.js +1 -187
  206. package/dist/validators/unknown.js +1 -37
  207. package/dist/validators/void.js +1 -44
  208. package/dist/validators/xor.d.ts +2 -2
  209. package/dist/validators/xor.js +1 -66
  210. package/package.json +239 -238
  211. package/dist/chunks/errors-core-BeiFUtZM.js +0 -81
  212. package/dist/chunks/index-0R2ntSud.js +0 -508
  213. package/dist/chunks/index-BvH403Yy.js +0 -88
  214. package/dist/chunks/security-B0Pd_vSY.js +0 -35
  215. package/dist/chunks/string-BJRQod3t.js +0 -530
  216. package/dist/cjs/chunks/errors-core-DWxLFs2f.cjs +0 -83
  217. package/dist/cjs/chunks/index-BkI37108.cjs +0 -538
  218. package/dist/cjs/chunks/index-Cc3bjUMX.cjs +0 -91
  219. package/dist/cjs/chunks/security-Dc3Jh13T.cjs +0 -37
  220. package/dist/cjs/chunks/string-BKZrc4hs.cjs +0 -533
@@ -1,108 +1 @@
1
- 'use strict';
2
-
3
- const it = {
4
- // String validation messages
5
- invalidString: 'Stringa non valida',
6
- stringMin: (min) => `La stringa deve avere almeno ${min} caratteri`,
7
- stringMax: (max) => `La stringa non può avere più di ${max} caratteri`,
8
- stringLength: (length) => `La stringa deve avere esattamente ${length} caratteri`,
9
- stringEmail: 'Indirizzo email non valido',
10
- stringUrl: 'URL non valido',
11
- stringUuid: 'UUID non valido',
12
- stringRegex: 'Formato non valido',
13
- stringStartsWith: (prefix) => `La stringa deve iniziare con "${prefix}"`,
14
- stringEndsWith: (suffix) => `La stringa deve finire con "${suffix}"`,
15
- stringIncludes: (substring) => `La stringa deve contenere "${substring}"`,
16
- stringIp: 'Indirizzo IP non valido',
17
- stringIpv4: 'Indirizzo IPv4 non valido',
18
- stringIpv6: 'Indirizzo IPv6 non valido',
19
- stringEmpty: 'La stringa non può essere vuota',
20
- // Number validation messages
21
- invalidNumber: 'Numero non valido',
22
- numberMin: (min) => `Il numero deve essere almeno ${min}`,
23
- numberMax: (max) => `Il numero non può essere maggiore di ${max}`,
24
- numberInt: 'Il numero deve essere intero',
25
- numberPositive: 'Il numero deve essere positivo',
26
- numberNegative: 'Il numero deve essere negativo',
27
- numberNonnegative: 'Il numero non può essere negativo',
28
- numberNonpositive: 'Il numero non può essere positivo',
29
- numberFinite: 'Il numero deve essere finito',
30
- numberSafe: 'Il numero deve essere un intero sicuro',
31
- numberMultipleOf: (value) => `Il numero deve essere multiplo di ${value}`,
32
- // Boolean validation messages
33
- invalidBoolean: 'Valore booleano non valido',
34
- // Date validation messages
35
- invalidDate: 'Data non valida',
36
- dateMin: (date) => `La data deve essere dopo ${date.toISOString()}`,
37
- dateMax: (date) => `La data deve essere prima di ${date.toISOString()}`,
38
- // Object validation messages
39
- invalidObject: 'Oggetto non valido',
40
- unexpectedKeys: (keys) => `Chiavi impreviste: ${keys.join(', ')}`,
41
- // Array validation messages
42
- invalidArray: 'Array non valido',
43
- arrayMin: (min) => `L'array deve avere almeno ${min} elementi`,
44
- arrayMax: (max) => `L'array non può avere più di ${max} elementi`,
45
- arrayLength: (length) => `L'array deve avere esattamente ${length} elementi`,
46
- arrayEmpty: 'L\'array non può essere vuoto',
47
- arrayItem: (index, error) => `Elemento non valido all'indice ${index}: ${error}`,
48
- // Object field validation
49
- objectField: (field, error) => `Campo non valido "${field}": ${error}`,
50
- // Union validation messages
51
- unionNoMatch: (errors) => `Nessun membro dell'unione corrisponde: ${errors.join(', ')}`,
52
- // Intersection validation messages
53
- intersectionError: (error) => `Validazione intersezione fallita: ${error}`,
54
- // Literal validation messages
55
- literalExpected: (expected, received) => `Previsto ${expected}, ricevuto ${received}`,
56
- // Enum validation messages
57
- enumExpected: (values, received) => `Previsto uno di [${values.join(', ')}], ricevuto ${received}`,
58
- // Special type validation messages
59
- expectedUndefined: 'Previsto undefined',
60
- neverType: 'Il tipo never non può essere analizzato',
61
- // New advanced type validation messages
62
- invalidBigint: 'Bigint non valido',
63
- invalidSymbol: 'Simbolo non valido',
64
- invalidTuple: 'Tupla non valida',
65
- tupleLength: (expected, received) => `La tupla deve avere esattamente ${expected} elementi, ricevuti ${received}`,
66
- invalidRecord: 'Record non valido',
67
- invalidSet: 'Set non valido',
68
- invalidMap: 'Map non valida',
69
- // Transformation and refinement messages
70
- transformError: (error) => `Trasformazione fallita: ${error}`,
71
- refinementError: (error) => `Raffinamento fallito: ${error}`,
72
- customValidationError: (error) => `Validazione personalizzata fallita: ${error}`,
73
- // Coercion messages
74
- coercionFailed: (type, value) => `Impossibile convertire ${JSON.stringify(value)} in ${type}`,
75
- // Codec messages
76
- codecDecodeFailed: 'Failed to decode value',
77
- codecEncodeFailed: 'Failed to encode value',
78
- codecAsyncNotSupported: 'Async codec operations require using parseAsync/encodeAsync methods',
79
- // Base64/Hex messages
80
- invalidBase64: 'Invalid base64 string',
81
- invalidHex: 'Invalid hexadecimal string',
82
- // Uint8Array messages
83
- expectedUint8Array: 'Expected Uint8Array',
84
- uint8ArrayMinLength: (min) => `Uint8Array must have at least ${min} bytes`,
85
- uint8ArrayMaxLength: (max) => `Uint8Array must have at most ${max} bytes`,
86
- uint8ArrayExactLength: (length) => `Uint8Array must have exactly ${length} bytes`,
87
- // Generic type error messages
88
- expectedString: 'Expected string',
89
- stringExpected: (received, expected) => `Previsto ${expected}, ricevuto ${received}`,
90
- stringBoolExpected: (validValues, received) => `Stringa booleana non valida. Previsto uno di: ${validValues}, ricevuto: "${received}"`,
91
- invalidJson: 'JSON non valido',
92
- stringPatternInvalid: 'La stringa non corrisponde al pattern richiesto',
93
- // File validation messages
94
- invalidFile: 'Expected a File object',
95
- fileNotSupported: 'File API not supported in this environment',
96
- fileMinSize: (min) => `File size must be at least ${min} bytes`,
97
- fileMaxSize: (max) => `File size must not exceed ${max} bytes`,
98
- fileMimeType: (allowed) => `Invalid file type. Expected: ${allowed.join(", ")}`,
99
- // Function validation messages
100
- invalidFunction: 'È prevista una funzione',
101
- // CIDR validation messages
102
- stringCidrv4: 'Blocco CIDR IPv4 non valido',
103
- stringCidrv6: 'Blocco CIDR IPv6 non valido',
104
- // Safe extend validation messages
105
- safeExtendOverlap: (keys) => `Impossibile sovrascrivere chiavi esistenti: ${keys.join(', ')}. Usa extend() per sovrascrivere.`
106
- };
107
-
108
- exports.it = it;
1
+ "use strict";const e={invalidString:"Stringa non valida",stringMin:e=>`La stringa deve avere almeno ${e} caratteri`,stringMax:e=>`La stringa non può avere più di ${e} caratteri`,stringLength:e=>`La stringa deve avere esattamente ${e} caratteri`,stringEmail:"Indirizzo email non valido",stringUrl:"URL non valido",stringUuid:"UUID non valido",stringRegex:"Formato non valido",stringStartsWith:e=>`La stringa deve iniziare con "${e}"`,stringEndsWith:e=>`La stringa deve finire con "${e}"`,stringIncludes:e=>`La stringa deve contenere "${e}"`,stringIp:"Indirizzo IP non valido",stringIpv4:"Indirizzo IPv4 non valido",stringIpv6:"Indirizzo IPv6 non valido",stringEmpty:"La stringa non può essere vuota",invalidNumber:"Numero non valido",numberMin:e=>`Il numero deve essere almeno ${e}`,numberMax:e=>`Il numero non può essere maggiore di ${e}`,numberInt:"Il numero deve essere intero",numberPositive:"Il numero deve essere positivo",numberNegative:"Il numero deve essere negativo",numberNonnegative:"Il numero non può essere negativo",numberNonpositive:"Il numero non può essere positivo",numberFinite:"Il numero deve essere finito",numberSafe:"Il numero deve essere un intero sicuro",numberMultipleOf:e=>`Il numero deve essere multiplo di ${e}`,invalidBoolean:"Valore booleano non valido",invalidDate:"Data non valida",dateMin:e=>`La data deve essere dopo ${e.toISOString()}`,dateMax:e=>`La data deve essere prima di ${e.toISOString()}`,invalidObject:"Oggetto non valido",unexpectedKeys:e=>`Chiavi impreviste: ${e.join(", ")}`,invalidArray:"Array non valido",arrayMin:e=>`L'array deve avere almeno ${e} elementi`,arrayMax:e=>`L'array non può avere più di ${e} elementi`,arrayLength:e=>`L'array deve avere esattamente ${e} elementi`,arrayEmpty:"L'array non può essere vuoto",arrayItem:(e,i)=>`Elemento non valido all'indice ${e}: ${i}`,objectField:(e,i)=>`Campo non valido "${e}": ${i}`,unionNoMatch:e=>`Nessun membro dell'unione corrisponde: ${e.join(", ")}`,intersectionError:e=>`Validazione intersezione fallita: ${e}`,literalExpected:(e,i)=>`Previsto ${e}, ricevuto ${i}`,enumExpected:(e,i)=>`Previsto uno di [${e.join(", ")}], ricevuto ${i}`,expectedUndefined:"Previsto undefined",neverType:"Il tipo never non può essere analizzato",invalidBigint:"Bigint non valido",invalidSymbol:"Simbolo non valido",invalidTuple:"Tupla non valida",tupleLength:(e,i)=>`La tupla deve avere esattamente ${e} elementi, ricevuti ${i}`,invalidRecord:"Record non valido",invalidSet:"Set non valido",invalidMap:"Map non valida",transformError:e=>`Trasformazione fallita: ${e}`,refinementError:e=>`Raffinamento fallito: ${e}`,customValidationError:e=>`Validazione personalizzata fallita: ${e}`,coercionFailed:(e,i)=>`Impossibile convertire ${JSON.stringify(i)} in ${e}`,codecDecodeFailed:"Failed to decode value",codecEncodeFailed:"Failed to encode value",codecAsyncNotSupported:"Async codec operations require using parseAsync/encodeAsync methods",invalidBase64:"Invalid base64 string",invalidHex:"Invalid hexadecimal string",expectedUint8Array:"Expected Uint8Array",uint8ArrayMinLength:e=>`Uint8Array must have at least ${e} bytes`,uint8ArrayMaxLength:e=>`Uint8Array must have at most ${e} bytes`,uint8ArrayExactLength:e=>`Uint8Array must have exactly ${e} bytes`,expectedString:"Expected string",stringExpected:(e,i)=>`Previsto ${i}, ricevuto ${e}`,stringBoolExpected:(e,i)=>`Stringa booleana non valida. Previsto uno di: ${e}, ricevuto: "${i}"`,invalidJson:"JSON non valido",stringPatternInvalid:"La stringa non corrisponde al pattern richiesto",invalidFile:"Expected a File object",fileNotSupported:"File API not supported in this environment",fileMinSize:e=>`File size must be at least ${e} bytes`,fileMaxSize:e=>`File size must not exceed ${e} bytes`,fileMimeType:e=>`Invalid file type. Expected: ${e.join(", ")}`,invalidFunction:"È prevista una funzione",stringCidrv4:"Blocco CIDR IPv4 non valido",stringCidrv6:"Blocco CIDR IPv6 non valido",safeExtendOverlap:e=>`Impossibile sovrascrivere chiavi esistenti: ${e.join(", ")}. Usa extend() per sovrascrivere.`};exports.it=e;
@@ -1,108 +1 @@
1
- 'use strict';
2
-
3
- const ja = {
4
- // String validation messages
5
- invalidString: '無効な文字列',
6
- stringMin: (min) => `文字列は${min}文字以上である必要があります`,
7
- stringMax: (max) => `文字列は${max}文字以下である必要があります`,
8
- stringLength: (length) => `文字列はちょうど${length}文字である必要があります`,
9
- stringEmail: '無効なメールアドレス',
10
- stringUrl: '無効なURL',
11
- stringUuid: '無効なUUID',
12
- stringRegex: '無効なフォーマット',
13
- stringStartsWith: (prefix) => `文字列は「${prefix}」で始まる必要があります`,
14
- stringEndsWith: (suffix) => `文字列は「${suffix}」で終わる必要があります`,
15
- stringIncludes: (substring) => `文字列は「${substring}」を含む必要があります`,
16
- stringIp: '無効なIPアドレス',
17
- stringIpv4: '無効なIPv4アドレス',
18
- stringIpv6: '無効なIPv6アドレス',
19
- stringEmpty: '文字列は空にできません',
20
- // Number validation messages
21
- invalidNumber: '無効な数値',
22
- numberMin: (min) => `数値は${min}以上である必要があります`,
23
- numberMax: (max) => `数値は${max}以下である必要があります`,
24
- numberInt: '数値は整数である必要があります',
25
- numberPositive: '数値は正の値である必要があります',
26
- numberNegative: '数値は負の値である必要があります',
27
- numberNonnegative: '数値は負の値にできません',
28
- numberNonpositive: '数値は正の値にできません',
29
- numberFinite: '数値は有限である必要があります',
30
- numberSafe: '数値は安全な整数である必要があります',
31
- numberMultipleOf: (value) => `数値は${value}の倍数である必要があります`,
32
- // Boolean validation messages
33
- invalidBoolean: '無効なブール値',
34
- // Date validation messages
35
- invalidDate: '無効な日付',
36
- dateMin: (date) => `日付は${date.toISOString()}より後である必要があります`,
37
- dateMax: (date) => `日付は${date.toISOString()}より前である必要があります`,
38
- // Object validation messages
39
- invalidObject: '無効なオブジェクト',
40
- unexpectedKeys: (keys) => `予期しないキー: ${keys.join(', ')}`,
41
- // Array validation messages
42
- invalidArray: '無効な配列',
43
- arrayMin: (min) => `配列は${min}個以上の要素が必要です`,
44
- arrayMax: (max) => `配列は${max}個以下の要素でなければなりません`,
45
- arrayLength: (length) => `配列はちょうど${length}個の要素が必要です`,
46
- arrayEmpty: '配列は空にできません',
47
- arrayItem: (index, error) => `インデックス${index}の無効な要素: ${error}`,
48
- // Object field validation
49
- objectField: (field, error) => `無効なフィールド「${field}」: ${error}`,
50
- // Union validation messages
51
- unionNoMatch: (errors) => `どのユニオンメンバーもマッチしませんでした: ${errors.join(', ')}`,
52
- // Intersection validation messages
53
- intersectionError: (error) => `交差検証に失敗しました: ${error}`,
54
- // Literal validation messages
55
- literalExpected: (expected, received) => `${expected}が期待されましたが、${received}を受け取りました`,
56
- // Enum validation messages
57
- enumExpected: (values, received) => `[${values.join(', ')}]のいずれかが期待されましたが、${received}を受け取りました`,
58
- // Special type validation messages
59
- expectedUndefined: 'undefinedが期待されました',
60
- neverType: 'neverタイプは解析できません',
61
- // New advanced type validation messages
62
- invalidBigint: '無効なbigint',
63
- invalidSymbol: '無効なシンボル',
64
- invalidTuple: '無効なタプル',
65
- tupleLength: (expected, received) => `タプルはちょうど${expected}個の要素が必要ですが、${received}個を受け取りました`,
66
- invalidRecord: '無効なレコード',
67
- invalidSet: '無効なSet',
68
- invalidMap: '無効なMap',
69
- // Transformation and refinement messages
70
- transformError: (error) => `変換に失敗しました: ${error}`,
71
- refinementError: (error) => `リファインメントに失敗しました: ${error}`,
72
- customValidationError: (error) => `カスタム検証が失敗しました: ${error}`,
73
- // Coercion messages
74
- coercionFailed: (type, value) => `${JSON.stringify(value)}を${type}に変換できません`,
75
- // Codec messages
76
- codecDecodeFailed: 'Failed to decode value',
77
- codecEncodeFailed: 'Failed to encode value',
78
- codecAsyncNotSupported: 'Async codec operations require using parseAsync/encodeAsync methods',
79
- // Base64/Hex messages
80
- invalidBase64: 'Invalid base64 string',
81
- invalidHex: 'Invalid hexadecimal string',
82
- // Uint8Array messages
83
- expectedUint8Array: 'Expected Uint8Array',
84
- uint8ArrayMinLength: (min) => `Uint8Array must have at least ${min} bytes`,
85
- uint8ArrayMaxLength: (max) => `Uint8Array must have at most ${max} bytes`,
86
- uint8ArrayExactLength: (length) => `Uint8Array must have exactly ${length} bytes`,
87
- // Generic type error messages
88
- expectedString: 'Expected string',
89
- stringExpected: (received, expected) => `${expected}が期待されましたが、${received}を受け取りました`,
90
- stringBoolExpected: (validValues, received) => `無効なブール文字列です。次のいずれかである必要があります: ${validValues}、受け取りました: "${received}"`,
91
- invalidJson: '無効なJSON',
92
- stringPatternInvalid: '文字列が必要なパターンと一致しません',
93
- // File validation messages
94
- invalidFile: 'Expected a File object',
95
- fileNotSupported: 'File API not supported in this environment',
96
- fileMinSize: (min) => `File size must be at least ${min} bytes`,
97
- fileMaxSize: (max) => `File size must not exceed ${max} bytes`,
98
- fileMimeType: (allowed) => `Invalid file type. Expected: ${allowed.join(", ")}`,
99
- // Function validation messages
100
- invalidFunction: '関数が期待されました',
101
- // CIDR validation messages
102
- stringCidrv4: '無効なIPv4 CIDRブロック',
103
- stringCidrv6: '無効なIPv6 CIDRブロック',
104
- // Safe extend validation messages
105
- safeExtendOverlap: (keys) => `既存のキーを上書きできません: ${keys.join(', ')}。上書きしたい場合はextend()を使用してください。`
106
- };
107
-
108
- exports.ja = ja;
1
+ "use strict";const e={invalidString:"無効な文字列",stringMin:e=>`文字列は${e}文字以上である必要があります`,stringMax:e=>`文字列は${e}文字以下である必要があります`,stringLength:e=>`文字列はちょうど${e}文字である必要があります`,stringEmail:"無効なメールアドレス",stringUrl:"無効なURL",stringUuid:"無効なUUID",stringRegex:"無効なフォーマット",stringStartsWith:e=>`文字列は「${e}」で始まる必要があります`,stringEndsWith:e=>`文字列は「${e}」で終わる必要があります`,stringIncludes:e=>`文字列は「${e}」を含む必要があります`,stringIp:"無効なIPアドレス",stringIpv4:"無効なIPv4アドレス",stringIpv6:"無効なIPv6アドレス",stringEmpty:"文字列は空にできません",invalidNumber:"無効な数値",numberMin:e=>`数値は${e}以上である必要があります`,numberMax:e=>`数値は${e}以下である必要があります`,numberInt:"数値は整数である必要があります",numberPositive:"数値は正の値である必要があります",numberNegative:"数値は負の値である必要があります",numberNonnegative:"数値は負の値にできません",numberNonpositive:"数値は正の値にできません",numberFinite:"数値は有限である必要があります",numberSafe:"数値は安全な整数である必要があります",numberMultipleOf:e=>`数値は${e}の倍数である必要があります`,invalidBoolean:"無効なブール値",invalidDate:"無効な日付",dateMin:e=>`日付は${e.toISOString()}より後である必要があります`,dateMax:e=>`日付は${e.toISOString()}より前である必要があります`,invalidObject:"無効なオブジェクト",unexpectedKeys:e=>`予期しないキー: ${e.join(", ")}`,invalidArray:"無効な配列",arrayMin:e=>`配列は${e}個以上の要素が必要です`,arrayMax:e=>`配列は${e}個以下の要素でなければなりません`,arrayLength:e=>`配列はちょうど${e}個の要素が必要です`,arrayEmpty:"配列は空にできません",arrayItem:(e,i)=>`インデックス${e}の無効な要素: ${i}`,objectField:(e,i)=>`無効なフィールド「${e}」: ${i}`,unionNoMatch:e=>`どのユニオンメンバーもマッチしませんでした: ${e.join(", ")}`,intersectionError:e=>`交差検証に失敗しました: ${e}`,literalExpected:(e,i)=>`${e}が期待されましたが、${i}を受け取りました`,enumExpected:(e,i)=>`[${e.join(", ")}]のいずれかが期待されましたが、${i}を受け取りました`,expectedUndefined:"undefinedが期待されました",neverType:"neverタイプは解析できません",invalidBigint:"無効なbigint",invalidSymbol:"無効なシンボル",invalidTuple:"無効なタプル",tupleLength:(e,i)=>`タプルはちょうど${e}個の要素が必要ですが、${i}個を受け取りました`,invalidRecord:"無効なレコード",invalidSet:"無効なSet",invalidMap:"無効なMap",transformError:e=>`変換に失敗しました: ${e}`,refinementError:e=>`リファインメントに失敗しました: ${e}`,customValidationError:e=>`カスタム検証が失敗しました: ${e}`,coercionFailed:(e,i)=>`${JSON.stringify(i)}を${e}に変換できません`,codecDecodeFailed:"Failed to decode value",codecEncodeFailed:"Failed to encode value",codecAsyncNotSupported:"Async codec operations require using parseAsync/encodeAsync methods",invalidBase64:"Invalid base64 string",invalidHex:"Invalid hexadecimal string",expectedUint8Array:"Expected Uint8Array",uint8ArrayMinLength:e=>`Uint8Array must have at least ${e} bytes`,uint8ArrayMaxLength:e=>`Uint8Array must have at most ${e} bytes`,uint8ArrayExactLength:e=>`Uint8Array must have exactly ${e} bytes`,expectedString:"Expected string",stringExpected:(e,i)=>`${i}が期待されましたが、${e}を受け取りました`,stringBoolExpected:(e,i)=>`無効なブール文字列です。次のいずれかである必要があります: ${e}、受け取りました: "${i}"`,invalidJson:"無効なJSON",stringPatternInvalid:"文字列が必要なパターンと一致しません",invalidFile:"Expected a File object",fileNotSupported:"File API not supported in this environment",fileMinSize:e=>`File size must be at least ${e} bytes`,fileMaxSize:e=>`File size must not exceed ${e} bytes`,fileMimeType:e=>`Invalid file type. Expected: ${e.join(", ")}`,invalidFunction:"関数が期待されました",stringCidrv4:"無効なIPv4 CIDRブロック",stringCidrv6:"無効なIPv6 CIDRブロック",safeExtendOverlap:e=>`既存のキーを上書きできません: ${e.join(", ")}。上書きしたい場合はextend()を使用してください。`};exports.ja=e;
@@ -1,108 +1 @@
1
- 'use strict';
2
-
3
- const ko = {
4
- // String validation messages
5
- invalidString: '유효하지 않은 문자열',
6
- stringMin: (min) => `문자열은 최소 ${min}자여야 합니다`,
7
- stringMax: (max) => `문자열은 최대 ${max}자여야 합니다`,
8
- stringLength: (length) => `문자열은 정확히 ${length}자여야 합니다`,
9
- stringEmail: '유효하지 않은 이메일 주소',
10
- stringUrl: '유효하지 않은 URL',
11
- stringUuid: '유효하지 않은 UUID',
12
- stringRegex: '유효하지 않은 형식',
13
- stringStartsWith: (prefix) => `문자열은 "${prefix}"로 시작해야 합니다`,
14
- stringEndsWith: (suffix) => `문자열은 "${suffix}"로 끝나야 합니다`,
15
- stringIncludes: (substring) => `문자열은 "${substring}"을 포함해야 합니다`,
16
- stringIp: '유효하지 않은 IP 주소',
17
- stringIpv4: '유효하지 않은 IPv4 주소',
18
- stringIpv6: '유효하지 않은 IPv6 주소',
19
- stringEmpty: '문자열은 비어있을 수 없습니다',
20
- // Number validation messages
21
- invalidNumber: '유효하지 않은 숫자',
22
- numberMin: (min) => `숫자는 최소 ${min}이어야 합니다`,
23
- numberMax: (max) => `숫자는 최대 ${max}이어야 합니다`,
24
- numberInt: '숫자는 정수여야 합니다',
25
- numberPositive: '숫자는 양수여야 합니다',
26
- numberNegative: '숫자는 음수여야 합니다',
27
- numberNonnegative: '숫자는 음수일 수 없습니다',
28
- numberNonpositive: '숫자는 양수일 수 없습니다',
29
- numberFinite: '숫자는 유한해야 합니다',
30
- numberSafe: '숫자는 안전한 정수여야 합니다',
31
- numberMultipleOf: (value) => `숫자는 ${value}의 배수여야 합니다`,
32
- // Boolean validation messages
33
- invalidBoolean: '유효하지 않은 불린 값',
34
- // Date validation messages
35
- invalidDate: '유효하지 않은 날짜',
36
- dateMin: (date) => `날짜는 ${date.toISOString()} 이후여야 합니다`,
37
- dateMax: (date) => `날짜는 ${date.toISOString()} 이전이어야 합니다`,
38
- // Object validation messages
39
- invalidObject: '유효하지 않은 객체',
40
- unexpectedKeys: (keys) => `예상치 못한 키: ${keys.join(', ')}`,
41
- // Array validation messages
42
- invalidArray: '유효하지 않은 배열',
43
- arrayMin: (min) => `배열은 최소 ${min}개의 요소가 있어야 합니다`,
44
- arrayMax: (max) => `배열은 최대 ${max}개의 요소가 있어야 합니다`,
45
- arrayLength: (length) => `배열은 정확히 ${length}개의 요소가 있어야 합니다`,
46
- arrayEmpty: '배열은 비어있을 수 없습니다',
47
- arrayItem: (index, error) => `인덱스 ${index}의 유효하지 않은 요소: ${error}`,
48
- // Object field validation
49
- objectField: (field, error) => `유효하지 않은 필드 "${field}": ${error}`,
50
- // Union validation messages
51
- unionNoMatch: (errors) => `어떤 유니온 멤버도 일치하지 않았습니다: ${errors.join(', ')}`,
52
- // Intersection validation messages
53
- intersectionError: (error) => `교집합 검증에 실패했습니다: ${error}`,
54
- // Literal validation messages
55
- literalExpected: (expected, received) => `${expected}가 예상되었지만 ${received}를 받았습니다`,
56
- // Enum validation messages
57
- enumExpected: (values, received) => `[${values.join(', ')}] 중 하나가 예상되었지만 ${received}를 받았습니다`,
58
- // Special type validation messages
59
- expectedUndefined: 'undefined가 예상되었습니다',
60
- neverType: 'never 타입은 파싱할 수 없습니다',
61
- // New advanced type validation messages
62
- invalidBigint: '유효하지 않은 bigint',
63
- invalidSymbol: '유효하지 않은 심볼',
64
- invalidTuple: '유효하지 않은 튜플',
65
- tupleLength: (expected, received) => `튜플은 정확히 ${expected}개의 요소가 있어야 하지만 ${received}개를 받았습니다`,
66
- invalidRecord: '유효하지 않은 레코드',
67
- invalidSet: '유효하지 않은 Set',
68
- invalidMap: '유효하지 않은 Map',
69
- // Transformation and refinement messages
70
- transformError: (error) => `변환 실패: ${error}`,
71
- refinementError: (error) => `정제 실패: ${error}`,
72
- customValidationError: (error) => `사용자 정의 유효성 검사 실패: ${error}`,
73
- // Coercion messages
74
- coercionFailed: (type, value) => `${JSON.stringify(value)}를 ${type}로 강제 변환할 수 없습니다`,
75
- // Codec messages
76
- codecDecodeFailed: 'Failed to decode value',
77
- codecEncodeFailed: 'Failed to encode value',
78
- codecAsyncNotSupported: 'Async codec operations require using parseAsync/encodeAsync methods',
79
- // Base64/Hex messages
80
- invalidBase64: 'Invalid base64 string',
81
- invalidHex: 'Invalid hexadecimal string',
82
- // Uint8Array messages
83
- expectedUint8Array: 'Expected Uint8Array',
84
- uint8ArrayMinLength: (min) => `Uint8Array must have at least ${min} bytes`,
85
- uint8ArrayMaxLength: (max) => `Uint8Array must have at most ${max} bytes`,
86
- uint8ArrayExactLength: (length) => `Uint8Array must have exactly ${length} bytes`,
87
- // Generic type error messages
88
- expectedString: 'Expected string',
89
- stringExpected: (received, expected) => `${expected}가 예상되었지만 ${received}를 받았습니다`,
90
- stringBoolExpected: (validValues, received) => `잘못된 불린 문자열입니다. 다음 중 하나여야 합니다: ${validValues}, 받은 값: "${received}"`,
91
- invalidJson: '잘못된 JSON',
92
- stringPatternInvalid: '문자열이 필요한 패턴과 일치하지 않습니다',
93
- // File validation messages
94
- invalidFile: 'Expected a File object',
95
- fileNotSupported: 'File API not supported in this environment',
96
- fileMinSize: (min) => `File size must be at least ${min} bytes`,
97
- fileMaxSize: (max) => `File size must not exceed ${max} bytes`,
98
- fileMimeType: (allowed) => `Invalid file type. Expected: ${allowed.join(", ")}`,
99
- // Function validation messages
100
- invalidFunction: '함수가 예상되었습니다',
101
- // CIDR validation messages
102
- stringCidrv4: '유효하지 않은 IPv4 CIDR 블록',
103
- stringCidrv6: '유효하지 않은 IPv6 CIDR 블록',
104
- // Safe extend validation messages
105
- safeExtendOverlap: (keys) => `기존 키를 덮어쓸 수 없습니다: ${keys.join(', ')}. 덮어쓰려면 extend()를 사용하세요.`
106
- };
107
-
108
- exports.ko = ko;
1
+ "use strict";const e={invalidString:"유효하지 않은 문자열",stringMin:e=>`문자열은 최소 ${e}자여야 합니다`,stringMax:e=>`문자열은 최대 ${e}자여야 합니다`,stringLength:e=>`문자열은 정확히 ${e}자여야 합니다`,stringEmail:"유효하지 않은 이메일 주소",stringUrl:"유효하지 않은 URL",stringUuid:"유효하지 않은 UUID",stringRegex:"유효하지 않은 형식",stringStartsWith:e=>`문자열은 "${e}"로 시작해야 합니다`,stringEndsWith:e=>`문자열은 "${e}"로 끝나야 합니다`,stringIncludes:e=>`문자열은 "${e}"을 포함해야 합니다`,stringIp:"유효하지 않은 IP 주소",stringIpv4:"유효하지 않은 IPv4 주소",stringIpv6:"유효하지 않은 IPv6 주소",stringEmpty:"문자열은 비어있을 수 없습니다",invalidNumber:"유효하지 않은 숫자",numberMin:e=>`숫자는 최소 ${e}이어야 합니다`,numberMax:e=>`숫자는 최대 ${e}이어야 합니다`,numberInt:"숫자는 정수여야 합니다",numberPositive:"숫자는 양수여야 합니다",numberNegative:"숫자는 음수여야 합니다",numberNonnegative:"숫자는 음수일 수 없습니다",numberNonpositive:"숫자는 양수일 수 없습니다",numberFinite:"숫자는 유한해야 합니다",numberSafe:"숫자는 안전한 정수여야 합니다",numberMultipleOf:e=>`숫자는 ${e}의 배수여야 합니다`,invalidBoolean:"유효하지 않은 불린 값",invalidDate:"유효하지 않은 날짜",dateMin:e=>`날짜는 ${e.toISOString()} 이후여야 합니다`,dateMax:e=>`날짜는 ${e.toISOString()} 이전이어야 합니다`,invalidObject:"유효하지 않은 객체",unexpectedKeys:e=>`예상치 못한 키: ${e.join(", ")}`,invalidArray:"유효하지 않은 배열",arrayMin:e=>`배열은 최소 ${e}개의 요소가 있어야 합니다`,arrayMax:e=>`배열은 최대 ${e}개의 요소가 있어야 합니다`,arrayLength:e=>`배열은 정확히 ${e}개의 요소가 있어야 합니다`,arrayEmpty:"배열은 비어있을 수 없습니다",arrayItem:(e,i)=>`인덱스 ${e}의 유효하지 않은 요소: ${i}`,objectField:(e,i)=>`유효하지 않은 필드 "${e}": ${i}`,unionNoMatch:e=>`어떤 유니온 멤버도 일치하지 않았습니다: ${e.join(", ")}`,intersectionError:e=>`교집합 검증에 실패했습니다: ${e}`,literalExpected:(e,i)=>`${e}가 예상되었지만 ${i}를 받았습니다`,enumExpected:(e,i)=>`[${e.join(", ")}] 중 하나가 예상되었지만 ${i}를 받았습니다`,expectedUndefined:"undefined가 예상되었습니다",neverType:"never 타입은 파싱할 수 없습니다",invalidBigint:"유효하지 않은 bigint",invalidSymbol:"유효하지 않은 심볼",invalidTuple:"유효하지 않은 튜플",tupleLength:(e,i)=>`튜플은 정확히 ${e}개의 요소가 있어야 하지만 ${i}개를 받았습니다`,invalidRecord:"유효하지 않은 레코드",invalidSet:"유효하지 않은 Set",invalidMap:"유효하지 않은 Map",transformError:e=>`변환 실패: ${e}`,refinementError:e=>`정제 실패: ${e}`,customValidationError:e=>`사용자 정의 유효성 검사 실패: ${e}`,coercionFailed:(e,i)=>`${JSON.stringify(i)}를 ${e}로 강제 변환할 수 없습니다`,codecDecodeFailed:"Failed to decode value",codecEncodeFailed:"Failed to encode value",codecAsyncNotSupported:"Async codec operations require using parseAsync/encodeAsync methods",invalidBase64:"Invalid base64 string",invalidHex:"Invalid hexadecimal string",expectedUint8Array:"Expected Uint8Array",uint8ArrayMinLength:e=>`Uint8Array must have at least ${e} bytes`,uint8ArrayMaxLength:e=>`Uint8Array must have at most ${e} bytes`,uint8ArrayExactLength:e=>`Uint8Array must have exactly ${e} bytes`,expectedString:"Expected string",stringExpected:(e,i)=>`${i}가 예상되었지만 ${e}를 받았습니다`,stringBoolExpected:(e,i)=>`잘못된 불린 문자열입니다. 다음 중 하나여야 합니다: ${e}, 받은 값: "${i}"`,invalidJson:"잘못된 JSON",stringPatternInvalid:"문자열이 필요한 패턴과 일치하지 않습니다",invalidFile:"Expected a File object",fileNotSupported:"File API not supported in this environment",fileMinSize:e=>`File size must be at least ${e} bytes`,fileMaxSize:e=>`File size must not exceed ${e} bytes`,fileMimeType:e=>`Invalid file type. Expected: ${e.join(", ")}`,invalidFunction:"함수가 예상되었습니다",stringCidrv4:"유효하지 않은 IPv4 CIDR 블록",stringCidrv6:"유효하지 않은 IPv6 CIDR 블록",safeExtendOverlap:e=>`기존 키를 덮어쓸 수 없습니다: ${e.join(", ")}. 덮어쓰려면 extend()를 사용하세요.`};exports.ko=e;
@@ -1,188 +1 @@
1
- 'use strict';
2
-
3
- var locales_runtime = require('./runtime.cjs');
4
- require('./en.cjs');
5
-
6
- /**
7
- * VLD Lazy Locale System
8
- *
9
- * This module provides lazy loading for locale files to reduce bundle size.
10
- * English is always bundled as a fallback; other languages are loaded on demand.
11
- *
12
- * @example
13
- * ```typescript
14
- * // Async loading (recommended for web apps)
15
- * import { setLocaleAsync, getMessages } from '@oxog/vld/locales';
16
- * await setLocaleAsync('tr');
17
- *
18
- * // Static import (for SSR or known locales)
19
- * import { tr } from '@oxog/vld/locales/tr';
20
- * import { registerLocale } from '@oxog/vld/locales';
21
- * registerLocale('tr', tr);
22
- * ```
23
- */
24
- const localeLoaders = {
25
- // Base languages
26
- tr: () => Promise.resolve().then(function () { return require('./tr.cjs'); }).then(m => m.tr),
27
- es: () => Promise.resolve().then(function () { return require('./es.cjs'); }).then(m => m.es),
28
- fr: () => Promise.resolve().then(function () { return require('./fr.cjs'); }).then(m => m.fr),
29
- de: () => Promise.resolve().then(function () { return require('./de.cjs'); }).then(m => m.de),
30
- it: () => Promise.resolve().then(function () { return require('./it.cjs'); }).then(m => m.it),
31
- pt: () => Promise.resolve().then(function () { return require('./pt.cjs'); }).then(m => m.pt),
32
- ru: () => Promise.resolve().then(function () { return require('./ru.cjs'); }).then(m => m.ru),
33
- ja: () => Promise.resolve().then(function () { return require('./ja.cjs'); }).then(m => m.ja),
34
- ko: () => Promise.resolve().then(function () { return require('./ko.cjs'); }).then(m => m.ko),
35
- zh: () => Promise.resolve().then(function () { return require('./zh.cjs'); }).then(m => m.zh),
36
- ar: () => Promise.resolve().then(function () { return require('./ar.cjs'); }).then(m => m.ar),
37
- hi: () => Promise.resolve().then(function () { return require('./hi.cjs'); }).then(m => m.hi),
38
- nl: () => Promise.resolve().then(function () { return require('./nl.cjs'); }).then(m => m.nl),
39
- pl: () => Promise.resolve().then(function () { return require('./pl.cjs'); }).then(m => m.pl),
40
- // Major European Languages
41
- da: () => Promise.resolve().then(function () { return require('./da.cjs'); }).then(m => m.da),
42
- sv: () => Promise.resolve().then(function () { return require('./sv.cjs'); }).then(m => m.sv),
43
- no: () => Promise.resolve().then(function () { return require('./no.cjs'); }).then(m => m.no),
44
- fi: () => Promise.resolve().then(function () { return require('./fi.cjs'); }).then(m => m.fi),
45
- // Major Asian Languages
46
- th: () => Promise.resolve().then(function () { return require('./th.cjs'); }).then(m => m.th),
47
- vi: () => Promise.resolve().then(function () { return require('./vi.cjs'); }).then(m => m.vi),
48
- id: () => Promise.resolve().then(function () { return require('./id.cjs'); }).then(m => m.id),
49
- bn: () => Promise.resolve().then(function () { return require('./bn.cjs'); }).then(m => m.bn),
50
- // African Languages
51
- sw: () => Promise.resolve().then(function () { return require('./sw.cjs'); }).then(m => m.sw),
52
- af: () => Promise.resolve().then(function () { return require('./af.cjs'); }).then(m => m.af),
53
- // American Languages
54
- 'pt-BR': () => Promise.resolve().then(function () { return require('./pt-BR.cjs'); }).then(m => m.ptBR),
55
- 'es-MX': () => Promise.resolve().then(function () { return require('./es-MX.cjs'); }).then(m => m.esMX),
56
- };
57
- // ============================================
58
- // Public API
59
- // ============================================
60
- /**
61
- * Set the current locale asynchronously (lazy loading)
62
- * This is the recommended way to load locales in web applications.
63
- *
64
- * @param locale - The locale to set
65
- * @throws Error if the locale is not supported
66
- *
67
- * @example
68
- * ```typescript
69
- * await setLocaleAsync('tr');
70
- * // Now all validation errors will be in Turkish
71
- * ```
72
- */
73
- async function setLocaleAsync(locale) {
74
- // If already loaded, just switch
75
- if (locales_runtime.isLocaleLoaded(locale)) {
76
- locales_runtime.setLocale(locale);
77
- return;
78
- }
79
- // If English, it's already bundled
80
- if (locale === 'en') {
81
- locales_runtime.setLocale('en');
82
- return;
83
- }
84
- // Try to load dynamically
85
- const loader = localeLoaders[locale];
86
- if (!loader) {
87
- console.warn(`Locale "${locale}" not available. Falling back to English.`);
88
- return;
89
- }
90
- try {
91
- const messages = await loader();
92
- locales_runtime.registerLocale(locale, messages);
93
- locales_runtime.setLocale(locale);
94
- }
95
- catch (error) {
96
- console.warn(`Failed to load locale "${locale}". Falling back to English.`, error);
97
- }
98
- }
99
- /**
100
- * Set the current locale synchronously
101
- * Only works if the locale has been pre-loaded or registered.
102
- *
103
- * @param locale - The locale to set
104
- * @throws Error if the locale is not preloaded
105
- *
106
- * @example
107
- * ```typescript
108
- * import { tr } from '@oxog/vld/locales/tr';
109
- * import { registerLocale, setLocale } from '@oxog/vld/locales';
110
- * registerLocale('tr', tr);
111
- * setLocale('tr'); // Now works synchronously
112
- * ```
113
- */
114
- function setLocale(locale) {
115
- if (locales_runtime.isLocaleLoaded(locale)) {
116
- locales_runtime.setLocale(locale);
117
- return;
118
- }
119
- throw new Error(`Locale "${locale}" not preloaded. Use setLocaleAsync() for lazy loading ` +
120
- `or import the locale directly: import { ${locale} } from '@oxog/vld/locales/${locale}'`);
121
- }
122
- /**
123
- * Register a locale for synchronous access
124
- * Use this after importing a locale file directly.
125
- *
126
- * @param locale - The locale code
127
- * @param messages - The locale messages object
128
- *
129
- * @example
130
- * ```typescript
131
- * import { tr } from '@oxog/vld/locales/tr';
132
- * import { registerLocale } from '@oxog/vld/locales';
133
- * registerLocale('tr', tr);
134
- * ```
135
- */
136
- /**
137
- * Check if a locale is supported (can be lazy loaded)
138
- *
139
- * @param locale - The locale to check
140
- */
141
- function isLocaleSupported(locale) {
142
- return locale === 'en' || locale in localeLoaders;
143
- }
144
- /**
145
- * Get list of all supported locales
146
- */
147
- function getSupportedLocales() {
148
- return ['en', ...Object.keys(localeLoaders)];
149
- }
150
- /**
151
- * Preload multiple locales in parallel
152
- * Useful for SSR or when you know which locales will be needed.
153
- *
154
- * @param locales - Array of locale codes to preload
155
- *
156
- * @example
157
- * ```typescript
158
- * // Preload Turkish, German, and French
159
- * await preloadLocales(['tr', 'de', 'fr']);
160
- * ```
161
- */
162
- async function preloadLocales(locales) {
163
- await Promise.all(locales.map(async (locale) => {
164
- if (!locales_runtime.isLocaleLoaded(locale) && locale !== 'en') {
165
- const loader = localeLoaders[locale];
166
- if (loader) {
167
- try {
168
- const messages = await loader();
169
- locales_runtime.registerLocale(locale, messages);
170
- }
171
- catch {
172
- // Silently ignore preload failures
173
- }
174
- }
175
- }
176
- }));
177
- }
178
-
179
- exports.getLocale = locales_runtime.getLocale;
180
- exports.getMessages = locales_runtime.getMessages;
181
- exports.getMessagesForLocale = locales_runtime.getMessagesForLocale;
182
- exports.isLocaleLoaded = locales_runtime.isLocaleLoaded;
183
- exports.registerLocale = locales_runtime.registerLocale;
184
- exports.getSupportedLocales = getSupportedLocales;
185
- exports.isLocaleSupported = isLocaleSupported;
186
- exports.preloadLocales = preloadLocales;
187
- exports.setLocale = setLocale;
188
- exports.setLocaleAsync = setLocaleAsync;
1
+ "use strict";var e=require("./runtime.cjs");require("./en.cjs");const r={tr:()=>Promise.resolve().then(function(){return require("./tr.cjs")}).then(e=>e.tr),es:()=>Promise.resolve().then(function(){return require("./es.cjs")}).then(e=>e.es),fr:()=>Promise.resolve().then(function(){return require("./fr.cjs")}).then(e=>e.fr),de:()=>Promise.resolve().then(function(){return require("./de.cjs")}).then(e=>e.de),it:()=>Promise.resolve().then(function(){return require("./it.cjs")}).then(e=>e.it),pt:()=>Promise.resolve().then(function(){return require("./pt.cjs")}).then(e=>e.pt),ru:()=>Promise.resolve().then(function(){return require("./ru.cjs")}).then(e=>e.ru),ja:()=>Promise.resolve().then(function(){return require("./ja.cjs")}).then(e=>e.ja),ko:()=>Promise.resolve().then(function(){return require("./ko.cjs")}).then(e=>e.ko),zh:()=>Promise.resolve().then(function(){return require("./zh.cjs")}).then(e=>e.zh),ar:()=>Promise.resolve().then(function(){return require("./ar.cjs")}).then(e=>e.ar),hi:()=>Promise.resolve().then(function(){return require("./hi.cjs")}).then(e=>e.hi),nl:()=>Promise.resolve().then(function(){return require("./nl.cjs")}).then(e=>e.nl),pl:()=>Promise.resolve().then(function(){return require("./pl.cjs")}).then(e=>e.pl),da:()=>Promise.resolve().then(function(){return require("./da.cjs")}).then(e=>e.da),sv:()=>Promise.resolve().then(function(){return require("./sv.cjs")}).then(e=>e.sv),no:()=>Promise.resolve().then(function(){return require("./no.cjs")}).then(e=>e.no),fi:()=>Promise.resolve().then(function(){return require("./fi.cjs")}).then(e=>e.fi),th:()=>Promise.resolve().then(function(){return require("./th.cjs")}).then(e=>e.th),vi:()=>Promise.resolve().then(function(){return require("./vi.cjs")}).then(e=>e.vi),id:()=>Promise.resolve().then(function(){return require("./id.cjs")}).then(e=>e.id),bn:()=>Promise.resolve().then(function(){return require("./bn.cjs")}).then(e=>e.bn),sw:()=>Promise.resolve().then(function(){return require("./sw.cjs")}).then(e=>e.sw),af:()=>Promise.resolve().then(function(){return require("./af.cjs")}).then(e=>e.af),"pt-BR":()=>Promise.resolve().then(function(){return require("./pt-BR.cjs")}).then(e=>e.ptBR),"es-MX":()=>Promise.resolve().then(function(){return require("./es-MX.cjs")}).then(e=>e.esMX)};exports.getLocale=e.getLocale,exports.getMessages=e.getMessages,exports.getMessagesForLocale=e.getMessagesForLocale,exports.isLocaleLoaded=e.isLocaleLoaded,exports.registerLocale=e.registerLocale,exports.getSupportedLocales=function(){return["en",...Object.keys(r)]},exports.isLocaleSupported=function(e){return"en"===e||e in r},exports.preloadLocales=async function(t){await Promise.all(t.map(async t=>{if(!e.isLocaleLoaded(t)&&"en"!==t){const n=r[t];if(n)try{const r=await n();e.registerLocale(t,r)}catch{}}}))},exports.setLocale=function(r){if(!e.isLocaleLoaded(r))throw new Error(`Locale "${r}" not preloaded. Use setLocaleAsync() for lazy loading or import the locale directly: import { ${r} } from '@oxog/vld/locales/${r}'`);e.setLocale(r)},exports.setLocaleAsync=async function(t){if(e.isLocaleLoaded(t))return void e.setLocale(t);if("en"===t)return void e.setLocale("en");const n=r[t];if(n)try{const r=await n();e.registerLocale(t,r),e.setLocale(t)}catch(e){console.warn(`Failed to load locale "${t}". Falling back to English.`,e)}else console.warn(`Locale "${t}" not available. Falling back to English.`)};