flavor-code 1.2.13 → 1.2.14

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 (131) hide show
  1. package/README.md +3 -0
  2. package/README.zh-CN.md +3 -0
  3. package/dist/{app-Z3YWFIBB.js → app-UJAGMKD5.js} +2 -2
  4. package/dist/astgraph/db.mjs +237 -237
  5. package/dist/astgraph/extract.mjs +239 -239
  6. package/dist/astgraph/flavor-plugin.json +25 -25
  7. package/dist/astgraph/grammars.mjs +68 -68
  8. package/dist/astgraph/index.js +301 -301
  9. package/dist/astgraph/indexer.mjs +175 -175
  10. package/dist/astgraph/query.mjs +165 -165
  11. package/dist/astgraph/resolve.mjs +93 -93
  12. package/dist/astgraph/vendor/tree-sitter.js +3980 -3980
  13. package/dist/astgraph/vendor/zod/LICENSE +21 -21
  14. package/dist/astgraph/vendor/zod/index.js +4 -4
  15. package/dist/astgraph/vendor/zod/locales/index.js +1 -1
  16. package/dist/astgraph/vendor/zod/locales/package.json +7 -7
  17. package/dist/astgraph/vendor/zod/package.json +135 -135
  18. package/dist/astgraph/vendor/zod/v4/classic/checks.js +1 -1
  19. package/dist/astgraph/vendor/zod/v4/classic/coerce.js +17 -17
  20. package/dist/astgraph/vendor/zod/v4/classic/compat.js +31 -31
  21. package/dist/astgraph/vendor/zod/v4/classic/errors.js +48 -48
  22. package/dist/astgraph/vendor/zod/v4/classic/external.js +20 -20
  23. package/dist/astgraph/vendor/zod/v4/classic/from-json-schema.js +599 -599
  24. package/dist/astgraph/vendor/zod/v4/classic/index.js +4 -4
  25. package/dist/astgraph/vendor/zod/v4/classic/iso.js +30 -30
  26. package/dist/astgraph/vendor/zod/v4/classic/package.json +7 -7
  27. package/dist/astgraph/vendor/zod/v4/classic/parse.js +15 -15
  28. package/dist/astgraph/vendor/zod/v4/classic/schemas.js +1395 -1395
  29. package/dist/astgraph/vendor/zod/v4/core/api.js +1087 -1087
  30. package/dist/astgraph/vendor/zod/v4/core/checks.js +575 -575
  31. package/dist/astgraph/vendor/zod/v4/core/core.js +78 -78
  32. package/dist/astgraph/vendor/zod/v4/core/doc.js +35 -35
  33. package/dist/astgraph/vendor/zod/v4/core/errors.js +185 -185
  34. package/dist/astgraph/vendor/zod/v4/core/index.js +16 -16
  35. package/dist/astgraph/vendor/zod/v4/core/json-schema-generator.js +95 -95
  36. package/dist/astgraph/vendor/zod/v4/core/json-schema-processors.js +601 -601
  37. package/dist/astgraph/vendor/zod/v4/core/json-schema.js +1 -1
  38. package/dist/astgraph/vendor/zod/v4/core/package.json +7 -7
  39. package/dist/astgraph/vendor/zod/v4/core/parse.js +93 -93
  40. package/dist/astgraph/vendor/zod/v4/core/regexes.js +139 -139
  41. package/dist/astgraph/vendor/zod/v4/core/registries.js +51 -51
  42. package/dist/astgraph/vendor/zod/v4/core/schemas.js +2239 -2239
  43. package/dist/astgraph/vendor/zod/v4/core/standard-schema.js +1 -1
  44. package/dist/astgraph/vendor/zod/v4/core/to-json-schema.js +448 -448
  45. package/dist/astgraph/vendor/zod/v4/core/util.js +674 -674
  46. package/dist/astgraph/vendor/zod/v4/core/versions.js +5 -5
  47. package/dist/astgraph/vendor/zod/v4/index.js +3 -3
  48. package/dist/astgraph/vendor/zod/v4/locales/ar.js +106 -106
  49. package/dist/astgraph/vendor/zod/v4/locales/az.js +105 -105
  50. package/dist/astgraph/vendor/zod/v4/locales/be.js +156 -156
  51. package/dist/astgraph/vendor/zod/v4/locales/bg.js +120 -120
  52. package/dist/astgraph/vendor/zod/v4/locales/ca.js +107 -107
  53. package/dist/astgraph/vendor/zod/v4/locales/cs.js +111 -111
  54. package/dist/astgraph/vendor/zod/v4/locales/da.js +115 -115
  55. package/dist/astgraph/vendor/zod/v4/locales/de.js +108 -108
  56. package/dist/astgraph/vendor/zod/v4/locales/el.js +109 -109
  57. package/dist/astgraph/vendor/zod/v4/locales/en.js +113 -113
  58. package/dist/astgraph/vendor/zod/v4/locales/eo.js +109 -109
  59. package/dist/astgraph/vendor/zod/v4/locales/es.js +132 -132
  60. package/dist/astgraph/vendor/zod/v4/locales/fa.js +114 -114
  61. package/dist/astgraph/vendor/zod/v4/locales/fi.js +112 -112
  62. package/dist/astgraph/vendor/zod/v4/locales/fr-CA.js +107 -107
  63. package/dist/astgraph/vendor/zod/v4/locales/fr.js +125 -125
  64. package/dist/astgraph/vendor/zod/v4/locales/he.js +214 -214
  65. package/dist/astgraph/vendor/zod/v4/locales/hr.js +122 -122
  66. package/dist/astgraph/vendor/zod/v4/locales/hu.js +108 -108
  67. package/dist/astgraph/vendor/zod/v4/locales/hy.js +147 -147
  68. package/dist/astgraph/vendor/zod/v4/locales/id.js +106 -106
  69. package/dist/astgraph/vendor/zod/v4/locales/index.js +52 -52
  70. package/dist/astgraph/vendor/zod/v4/locales/is.js +109 -109
  71. package/dist/astgraph/vendor/zod/v4/locales/it.js +108 -108
  72. package/dist/astgraph/vendor/zod/v4/locales/ja.js +107 -107
  73. package/dist/astgraph/vendor/zod/v4/locales/ka.js +112 -112
  74. package/dist/astgraph/vendor/zod/v4/locales/kh.js +5 -5
  75. package/dist/astgraph/vendor/zod/v4/locales/km.js +110 -110
  76. package/dist/astgraph/vendor/zod/v4/locales/ko.js +111 -111
  77. package/dist/astgraph/vendor/zod/v4/locales/lt.js +203 -203
  78. package/dist/astgraph/vendor/zod/v4/locales/mk.js +109 -109
  79. package/dist/astgraph/vendor/zod/v4/locales/ms.js +107 -107
  80. package/dist/astgraph/vendor/zod/v4/locales/nl.js +110 -110
  81. package/dist/astgraph/vendor/zod/v4/locales/no.js +108 -108
  82. package/dist/astgraph/vendor/zod/v4/locales/ota.js +109 -109
  83. package/dist/astgraph/vendor/zod/v4/locales/package.json +7 -7
  84. package/dist/astgraph/vendor/zod/v4/locales/pl.js +109 -109
  85. package/dist/astgraph/vendor/zod/v4/locales/ps.js +114 -114
  86. package/dist/astgraph/vendor/zod/v4/locales/pt.js +108 -108
  87. package/dist/astgraph/vendor/zod/v4/locales/ro.js +119 -119
  88. package/dist/astgraph/vendor/zod/v4/locales/ru.js +156 -156
  89. package/dist/astgraph/vendor/zod/v4/locales/sl.js +109 -109
  90. package/dist/astgraph/vendor/zod/v4/locales/sv.js +110 -110
  91. package/dist/astgraph/vendor/zod/v4/locales/ta.js +110 -110
  92. package/dist/astgraph/vendor/zod/v4/locales/th.js +110 -110
  93. package/dist/astgraph/vendor/zod/v4/locales/tr.js +105 -105
  94. package/dist/astgraph/vendor/zod/v4/locales/ua.js +5 -5
  95. package/dist/astgraph/vendor/zod/v4/locales/uk.js +108 -108
  96. package/dist/astgraph/vendor/zod/v4/locales/ur.js +110 -110
  97. package/dist/astgraph/vendor/zod/v4/locales/uz.js +110 -110
  98. package/dist/astgraph/vendor/zod/v4/locales/vi.js +108 -108
  99. package/dist/astgraph/vendor/zod/v4/locales/yo.js +107 -107
  100. package/dist/astgraph/vendor/zod/v4/locales/zh-CN.js +109 -109
  101. package/dist/astgraph/vendor/zod/v4/locales/zh-TW.js +107 -107
  102. package/dist/astgraph/vendor/zod/v4/mini/checks.js +1 -1
  103. package/dist/astgraph/vendor/zod/v4/mini/coerce.js +22 -22
  104. package/dist/astgraph/vendor/zod/v4/mini/external.js +14 -14
  105. package/dist/astgraph/vendor/zod/v4/mini/index.js +3 -3
  106. package/dist/astgraph/vendor/zod/v4/mini/iso.js +34 -34
  107. package/dist/astgraph/vendor/zod/v4/mini/package.json +7 -7
  108. package/dist/astgraph/vendor/zod/v4/mini/parse.js +1 -1
  109. package/dist/astgraph/vendor/zod/v4/mini/schemas.js +961 -961
  110. package/dist/astgraph/vendor/zod/v4/package.json +7 -7
  111. package/dist/{chunk-Y5MZDG7I.js → chunk-4YXDGGIC.js} +4611 -3754
  112. package/dist/{chunk-XFCJXRJ2.js → chunk-IG4Z23CL.js} +6 -0
  113. package/dist/{chunk-G6Q2Y2A7.js → chunk-KL6TR2KG.js} +1 -1
  114. package/dist/cli.js +5 -5
  115. package/dist/config/schema.d.ts +6 -0
  116. package/dist/desktop/main.js +4900 -4038
  117. package/dist/desktop-renderer/assets/{index-CCnSpff0.js → index-CcD0D6x0.js} +1 -1
  118. package/dist/desktop-renderer/index.html +1 -1
  119. package/dist/evolve/loader.d.ts +21 -0
  120. package/dist/evolve/service.d.ts +37 -0
  121. package/dist/evolve/store.d.ts +91 -0
  122. package/dist/hooks/types.d.ts +5 -1
  123. package/dist/{load-6ZMEBHSG.js → load-GKA7P6RJ.js} +1 -1
  124. package/dist/plugins/host.d.ts +9 -0
  125. package/dist/plugins/types.d.ts +1 -0
  126. package/dist/sdk/index.js +3 -3
  127. package/dist/tools/shell.d.ts +13 -0
  128. package/dist/ui/commands.d.ts +5 -2
  129. package/dist/ui/session.d.ts +1 -0
  130. package/package.json +1 -1
  131. package//346/212/200/346/234/257/346/226/271/346/241/210/346/212/245/345/221/212.md +303 -1
@@ -1,109 +1,109 @@
1
- import * as util from "../core/util.js";
2
- const error = () => {
3
- const Sizable = {
4
- string: { unit: "stafi", verb: "að hafa" },
5
- file: { unit: "bæti", verb: "að hafa" },
6
- array: { unit: "hluti", verb: "að hafa" },
7
- set: { unit: "hluti", verb: "að hafa" },
8
- };
9
- function getSizing(origin) {
10
- return Sizable[origin] ?? null;
11
- }
12
- const FormatDictionary = {
13
- regex: "gildi",
14
- email: "netfang",
15
- url: "vefslóð",
16
- emoji: "emoji",
17
- uuid: "UUID",
18
- uuidv4: "UUIDv4",
19
- uuidv6: "UUIDv6",
20
- nanoid: "nanoid",
21
- guid: "GUID",
22
- cuid: "cuid",
23
- cuid2: "cuid2",
24
- ulid: "ULID",
25
- xid: "XID",
26
- ksuid: "KSUID",
27
- datetime: "ISO dagsetning og tími",
28
- date: "ISO dagsetning",
29
- time: "ISO tími",
30
- duration: "ISO tímalengd",
31
- ipv4: "IPv4 address",
32
- ipv6: "IPv6 address",
33
- cidrv4: "IPv4 range",
34
- cidrv6: "IPv6 range",
35
- base64: "base64-encoded strengur",
36
- base64url: "base64url-encoded strengur",
37
- json_string: "JSON strengur",
38
- e164: "E.164 tölugildi",
39
- jwt: "JWT",
40
- template_literal: "gildi",
41
- };
42
- const TypeDictionary = {
43
- nan: "NaN",
44
- number: "númer",
45
- array: "fylki",
46
- };
47
- return (issue) => {
48
- switch (issue.code) {
49
- case "invalid_type": {
50
- const expected = TypeDictionary[issue.expected] ?? issue.expected;
51
- const receivedType = util.parsedType(issue.input);
52
- const received = TypeDictionary[receivedType] ?? receivedType;
53
- if (/^[A-Z]/.test(issue.expected)) {
54
- return `Rangt gildi: Þú slóst inn ${received} þar sem á að vera instanceof ${issue.expected}`;
55
- }
56
- return `Rangt gildi: Þú slóst inn ${received} þar sem á að vera ${expected}`;
57
- }
58
- case "invalid_value":
59
- if (issue.values.length === 1)
60
- return `Rangt gildi: gert ráð fyrir ${util.stringifyPrimitive(issue.values[0])}`;
61
- return `Ógilt val: má vera eitt af eftirfarandi ${util.joinValues(issue.values, "|")}`;
62
- case "too_big": {
63
- const adj = issue.inclusive ? "<=" : "<";
64
- const sizing = getSizing(issue.origin);
65
- if (sizing)
66
- return `Of stórt: gert er ráð fyrir að ${issue.origin ?? "gildi"} hafi ${adj}${issue.maximum.toString()} ${sizing.unit ?? "hluti"}`;
67
- return `Of stórt: gert er ráð fyrir að ${issue.origin ?? "gildi"} sé ${adj}${issue.maximum.toString()}`;
68
- }
69
- case "too_small": {
70
- const adj = issue.inclusive ? ">=" : ">";
71
- const sizing = getSizing(issue.origin);
72
- if (sizing) {
73
- return `Of lítið: gert er ráð fyrir að ${issue.origin} hafi ${adj}${issue.minimum.toString()} ${sizing.unit}`;
74
- }
75
- return `Of lítið: gert er ráð fyrir að ${issue.origin} sé ${adj}${issue.minimum.toString()}`;
76
- }
77
- case "invalid_format": {
78
- const _issue = issue;
79
- if (_issue.format === "starts_with") {
80
- return `Ógildur strengur: verður að byrja á "${_issue.prefix}"`;
81
- }
82
- if (_issue.format === "ends_with")
83
- return `Ógildur strengur: verður að enda á "${_issue.suffix}"`;
84
- if (_issue.format === "includes")
85
- return `Ógildur strengur: verður að innihalda "${_issue.includes}"`;
86
- if (_issue.format === "regex")
87
- return `Ógildur strengur: verður að fylgja mynstri ${_issue.pattern}`;
88
- return `Rangt ${FormatDictionary[_issue.format] ?? issue.format}`;
89
- }
90
- case "not_multiple_of":
91
- return `Röng tala: verður að vera margfeldi af ${issue.divisor}`;
92
- case "unrecognized_keys":
93
- return `Óþekkt ${issue.keys.length > 1 ? "ir lyklar" : "ur lykill"}: ${util.joinValues(issue.keys, ", ")}`;
94
- case "invalid_key":
95
- return `Rangur lykill í ${issue.origin}`;
96
- case "invalid_union":
97
- return "Rangt gildi";
98
- case "invalid_element":
99
- return `Rangt gildi í ${issue.origin}`;
100
- default:
101
- return `Rangt gildi`;
102
- }
103
- };
104
- };
105
- export default function () {
106
- return {
107
- localeError: error(),
108
- };
109
- }
1
+ import * as util from "../core/util.js";
2
+ const error = () => {
3
+ const Sizable = {
4
+ string: { unit: "stafi", verb: "að hafa" },
5
+ file: { unit: "bæti", verb: "að hafa" },
6
+ array: { unit: "hluti", verb: "að hafa" },
7
+ set: { unit: "hluti", verb: "að hafa" },
8
+ };
9
+ function getSizing(origin) {
10
+ return Sizable[origin] ?? null;
11
+ }
12
+ const FormatDictionary = {
13
+ regex: "gildi",
14
+ email: "netfang",
15
+ url: "vefslóð",
16
+ emoji: "emoji",
17
+ uuid: "UUID",
18
+ uuidv4: "UUIDv4",
19
+ uuidv6: "UUIDv6",
20
+ nanoid: "nanoid",
21
+ guid: "GUID",
22
+ cuid: "cuid",
23
+ cuid2: "cuid2",
24
+ ulid: "ULID",
25
+ xid: "XID",
26
+ ksuid: "KSUID",
27
+ datetime: "ISO dagsetning og tími",
28
+ date: "ISO dagsetning",
29
+ time: "ISO tími",
30
+ duration: "ISO tímalengd",
31
+ ipv4: "IPv4 address",
32
+ ipv6: "IPv6 address",
33
+ cidrv4: "IPv4 range",
34
+ cidrv6: "IPv6 range",
35
+ base64: "base64-encoded strengur",
36
+ base64url: "base64url-encoded strengur",
37
+ json_string: "JSON strengur",
38
+ e164: "E.164 tölugildi",
39
+ jwt: "JWT",
40
+ template_literal: "gildi",
41
+ };
42
+ const TypeDictionary = {
43
+ nan: "NaN",
44
+ number: "númer",
45
+ array: "fylki",
46
+ };
47
+ return (issue) => {
48
+ switch (issue.code) {
49
+ case "invalid_type": {
50
+ const expected = TypeDictionary[issue.expected] ?? issue.expected;
51
+ const receivedType = util.parsedType(issue.input);
52
+ const received = TypeDictionary[receivedType] ?? receivedType;
53
+ if (/^[A-Z]/.test(issue.expected)) {
54
+ return `Rangt gildi: Þú slóst inn ${received} þar sem á að vera instanceof ${issue.expected}`;
55
+ }
56
+ return `Rangt gildi: Þú slóst inn ${received} þar sem á að vera ${expected}`;
57
+ }
58
+ case "invalid_value":
59
+ if (issue.values.length === 1)
60
+ return `Rangt gildi: gert ráð fyrir ${util.stringifyPrimitive(issue.values[0])}`;
61
+ return `Ógilt val: má vera eitt af eftirfarandi ${util.joinValues(issue.values, "|")}`;
62
+ case "too_big": {
63
+ const adj = issue.inclusive ? "<=" : "<";
64
+ const sizing = getSizing(issue.origin);
65
+ if (sizing)
66
+ return `Of stórt: gert er ráð fyrir að ${issue.origin ?? "gildi"} hafi ${adj}${issue.maximum.toString()} ${sizing.unit ?? "hluti"}`;
67
+ return `Of stórt: gert er ráð fyrir að ${issue.origin ?? "gildi"} sé ${adj}${issue.maximum.toString()}`;
68
+ }
69
+ case "too_small": {
70
+ const adj = issue.inclusive ? ">=" : ">";
71
+ const sizing = getSizing(issue.origin);
72
+ if (sizing) {
73
+ return `Of lítið: gert er ráð fyrir að ${issue.origin} hafi ${adj}${issue.minimum.toString()} ${sizing.unit}`;
74
+ }
75
+ return `Of lítið: gert er ráð fyrir að ${issue.origin} sé ${adj}${issue.minimum.toString()}`;
76
+ }
77
+ case "invalid_format": {
78
+ const _issue = issue;
79
+ if (_issue.format === "starts_with") {
80
+ return `Ógildur strengur: verður að byrja á "${_issue.prefix}"`;
81
+ }
82
+ if (_issue.format === "ends_with")
83
+ return `Ógildur strengur: verður að enda á "${_issue.suffix}"`;
84
+ if (_issue.format === "includes")
85
+ return `Ógildur strengur: verður að innihalda "${_issue.includes}"`;
86
+ if (_issue.format === "regex")
87
+ return `Ógildur strengur: verður að fylgja mynstri ${_issue.pattern}`;
88
+ return `Rangt ${FormatDictionary[_issue.format] ?? issue.format}`;
89
+ }
90
+ case "not_multiple_of":
91
+ return `Röng tala: verður að vera margfeldi af ${issue.divisor}`;
92
+ case "unrecognized_keys":
93
+ return `Óþekkt ${issue.keys.length > 1 ? "ir lyklar" : "ur lykill"}: ${util.joinValues(issue.keys, ", ")}`;
94
+ case "invalid_key":
95
+ return `Rangur lykill í ${issue.origin}`;
96
+ case "invalid_union":
97
+ return "Rangt gildi";
98
+ case "invalid_element":
99
+ return `Rangt gildi í ${issue.origin}`;
100
+ default:
101
+ return `Rangt gildi`;
102
+ }
103
+ };
104
+ };
105
+ export default function () {
106
+ return {
107
+ localeError: error(),
108
+ };
109
+ }
@@ -1,108 +1,108 @@
1
- import * as util from "../core/util.js";
2
- const error = () => {
3
- const Sizable = {
4
- string: { unit: "caratteri", verb: "avere" },
5
- file: { unit: "byte", verb: "avere" },
6
- array: { unit: "elementi", verb: "avere" },
7
- set: { unit: "elementi", verb: "avere" },
8
- };
9
- function getSizing(origin) {
10
- return Sizable[origin] ?? null;
11
- }
12
- const FormatDictionary = {
13
- regex: "input",
14
- email: "indirizzo email",
15
- url: "URL",
16
- emoji: "emoji",
17
- uuid: "UUID",
18
- uuidv4: "UUIDv4",
19
- uuidv6: "UUIDv6",
20
- nanoid: "nanoid",
21
- guid: "GUID",
22
- cuid: "cuid",
23
- cuid2: "cuid2",
24
- ulid: "ULID",
25
- xid: "XID",
26
- ksuid: "KSUID",
27
- datetime: "data e ora ISO",
28
- date: "data ISO",
29
- time: "ora ISO",
30
- duration: "durata ISO",
31
- ipv4: "indirizzo IPv4",
32
- ipv6: "indirizzo IPv6",
33
- cidrv4: "intervallo IPv4",
34
- cidrv6: "intervallo IPv6",
35
- base64: "stringa codificata in base64",
36
- base64url: "URL codificata in base64",
37
- json_string: "stringa JSON",
38
- e164: "numero E.164",
39
- jwt: "JWT",
40
- template_literal: "input",
41
- };
42
- const TypeDictionary = {
43
- nan: "NaN",
44
- number: "numero",
45
- array: "vettore",
46
- };
47
- return (issue) => {
48
- switch (issue.code) {
49
- case "invalid_type": {
50
- const expected = TypeDictionary[issue.expected] ?? issue.expected;
51
- const receivedType = util.parsedType(issue.input);
52
- const received = TypeDictionary[receivedType] ?? receivedType;
53
- if (/^[A-Z]/.test(issue.expected)) {
54
- return `Input non valido: atteso instanceof ${issue.expected}, ricevuto ${received}`;
55
- }
56
- return `Input non valido: atteso ${expected}, ricevuto ${received}`;
57
- }
58
- case "invalid_value":
59
- if (issue.values.length === 1)
60
- return `Input non valido: atteso ${util.stringifyPrimitive(issue.values[0])}`;
61
- return `Opzione non valida: atteso uno tra ${util.joinValues(issue.values, "|")}`;
62
- case "too_big": {
63
- const adj = issue.inclusive ? "<=" : "<";
64
- const sizing = getSizing(issue.origin);
65
- if (sizing)
66
- return `Troppo grande: ${issue.origin ?? "valore"} deve avere ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementi"}`;
67
- return `Troppo grande: ${issue.origin ?? "valore"} deve essere ${adj}${issue.maximum.toString()}`;
68
- }
69
- case "too_small": {
70
- const adj = issue.inclusive ? ">=" : ">";
71
- const sizing = getSizing(issue.origin);
72
- if (sizing) {
73
- return `Troppo piccolo: ${issue.origin} deve avere ${adj}${issue.minimum.toString()} ${sizing.unit}`;
74
- }
75
- return `Troppo piccolo: ${issue.origin} deve essere ${adj}${issue.minimum.toString()}`;
76
- }
77
- case "invalid_format": {
78
- const _issue = issue;
79
- if (_issue.format === "starts_with")
80
- return `Stringa non valida: deve iniziare con "${_issue.prefix}"`;
81
- if (_issue.format === "ends_with")
82
- return `Stringa non valida: deve terminare con "${_issue.suffix}"`;
83
- if (_issue.format === "includes")
84
- return `Stringa non valida: deve includere "${_issue.includes}"`;
85
- if (_issue.format === "regex")
86
- return `Stringa non valida: deve corrispondere al pattern ${_issue.pattern}`;
87
- return `Input non valido: ${FormatDictionary[_issue.format] ?? issue.format}`;
88
- }
89
- case "not_multiple_of":
90
- return `Numero non valido: deve essere un multiplo di ${issue.divisor}`;
91
- case "unrecognized_keys":
92
- return `Chiav${issue.keys.length > 1 ? "i" : "e"} non riconosciut${issue.keys.length > 1 ? "e" : "a"}: ${util.joinValues(issue.keys, ", ")}`;
93
- case "invalid_key":
94
- return `Chiave non valida in ${issue.origin}`;
95
- case "invalid_union":
96
- return "Input non valido";
97
- case "invalid_element":
98
- return `Valore non valido in ${issue.origin}`;
99
- default:
100
- return `Input non valido`;
101
- }
102
- };
103
- };
104
- export default function () {
105
- return {
106
- localeError: error(),
107
- };
108
- }
1
+ import * as util from "../core/util.js";
2
+ const error = () => {
3
+ const Sizable = {
4
+ string: { unit: "caratteri", verb: "avere" },
5
+ file: { unit: "byte", verb: "avere" },
6
+ array: { unit: "elementi", verb: "avere" },
7
+ set: { unit: "elementi", verb: "avere" },
8
+ };
9
+ function getSizing(origin) {
10
+ return Sizable[origin] ?? null;
11
+ }
12
+ const FormatDictionary = {
13
+ regex: "input",
14
+ email: "indirizzo email",
15
+ url: "URL",
16
+ emoji: "emoji",
17
+ uuid: "UUID",
18
+ uuidv4: "UUIDv4",
19
+ uuidv6: "UUIDv6",
20
+ nanoid: "nanoid",
21
+ guid: "GUID",
22
+ cuid: "cuid",
23
+ cuid2: "cuid2",
24
+ ulid: "ULID",
25
+ xid: "XID",
26
+ ksuid: "KSUID",
27
+ datetime: "data e ora ISO",
28
+ date: "data ISO",
29
+ time: "ora ISO",
30
+ duration: "durata ISO",
31
+ ipv4: "indirizzo IPv4",
32
+ ipv6: "indirizzo IPv6",
33
+ cidrv4: "intervallo IPv4",
34
+ cidrv6: "intervallo IPv6",
35
+ base64: "stringa codificata in base64",
36
+ base64url: "URL codificata in base64",
37
+ json_string: "stringa JSON",
38
+ e164: "numero E.164",
39
+ jwt: "JWT",
40
+ template_literal: "input",
41
+ };
42
+ const TypeDictionary = {
43
+ nan: "NaN",
44
+ number: "numero",
45
+ array: "vettore",
46
+ };
47
+ return (issue) => {
48
+ switch (issue.code) {
49
+ case "invalid_type": {
50
+ const expected = TypeDictionary[issue.expected] ?? issue.expected;
51
+ const receivedType = util.parsedType(issue.input);
52
+ const received = TypeDictionary[receivedType] ?? receivedType;
53
+ if (/^[A-Z]/.test(issue.expected)) {
54
+ return `Input non valido: atteso instanceof ${issue.expected}, ricevuto ${received}`;
55
+ }
56
+ return `Input non valido: atteso ${expected}, ricevuto ${received}`;
57
+ }
58
+ case "invalid_value":
59
+ if (issue.values.length === 1)
60
+ return `Input non valido: atteso ${util.stringifyPrimitive(issue.values[0])}`;
61
+ return `Opzione non valida: atteso uno tra ${util.joinValues(issue.values, "|")}`;
62
+ case "too_big": {
63
+ const adj = issue.inclusive ? "<=" : "<";
64
+ const sizing = getSizing(issue.origin);
65
+ if (sizing)
66
+ return `Troppo grande: ${issue.origin ?? "valore"} deve avere ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementi"}`;
67
+ return `Troppo grande: ${issue.origin ?? "valore"} deve essere ${adj}${issue.maximum.toString()}`;
68
+ }
69
+ case "too_small": {
70
+ const adj = issue.inclusive ? ">=" : ">";
71
+ const sizing = getSizing(issue.origin);
72
+ if (sizing) {
73
+ return `Troppo piccolo: ${issue.origin} deve avere ${adj}${issue.minimum.toString()} ${sizing.unit}`;
74
+ }
75
+ return `Troppo piccolo: ${issue.origin} deve essere ${adj}${issue.minimum.toString()}`;
76
+ }
77
+ case "invalid_format": {
78
+ const _issue = issue;
79
+ if (_issue.format === "starts_with")
80
+ return `Stringa non valida: deve iniziare con "${_issue.prefix}"`;
81
+ if (_issue.format === "ends_with")
82
+ return `Stringa non valida: deve terminare con "${_issue.suffix}"`;
83
+ if (_issue.format === "includes")
84
+ return `Stringa non valida: deve includere "${_issue.includes}"`;
85
+ if (_issue.format === "regex")
86
+ return `Stringa non valida: deve corrispondere al pattern ${_issue.pattern}`;
87
+ return `Input non valido: ${FormatDictionary[_issue.format] ?? issue.format}`;
88
+ }
89
+ case "not_multiple_of":
90
+ return `Numero non valido: deve essere un multiplo di ${issue.divisor}`;
91
+ case "unrecognized_keys":
92
+ return `Chiav${issue.keys.length > 1 ? "i" : "e"} non riconosciut${issue.keys.length > 1 ? "e" : "a"}: ${util.joinValues(issue.keys, ", ")}`;
93
+ case "invalid_key":
94
+ return `Chiave non valida in ${issue.origin}`;
95
+ case "invalid_union":
96
+ return "Input non valido";
97
+ case "invalid_element":
98
+ return `Valore non valido in ${issue.origin}`;
99
+ default:
100
+ return `Input non valido`;
101
+ }
102
+ };
103
+ };
104
+ export default function () {
105
+ return {
106
+ localeError: error(),
107
+ };
108
+ }
@@ -1,107 +1,107 @@
1
- import * as util from "../core/util.js";
2
- const error = () => {
3
- const Sizable = {
4
- string: { unit: "文字", verb: "である" },
5
- file: { unit: "バイト", verb: "である" },
6
- array: { unit: "要素", verb: "である" },
7
- set: { unit: "要素", verb: "である" },
8
- };
9
- function getSizing(origin) {
10
- return Sizable[origin] ?? null;
11
- }
12
- const FormatDictionary = {
13
- regex: "入力値",
14
- email: "メールアドレス",
15
- url: "URL",
16
- emoji: "絵文字",
17
- uuid: "UUID",
18
- uuidv4: "UUIDv4",
19
- uuidv6: "UUIDv6",
20
- nanoid: "nanoid",
21
- guid: "GUID",
22
- cuid: "cuid",
23
- cuid2: "cuid2",
24
- ulid: "ULID",
25
- xid: "XID",
26
- ksuid: "KSUID",
27
- datetime: "ISO日時",
28
- date: "ISO日付",
29
- time: "ISO時刻",
30
- duration: "ISO期間",
31
- ipv4: "IPv4アドレス",
32
- ipv6: "IPv6アドレス",
33
- cidrv4: "IPv4範囲",
34
- cidrv6: "IPv6範囲",
35
- base64: "base64エンコード文字列",
36
- base64url: "base64urlエンコード文字列",
37
- json_string: "JSON文字列",
38
- e164: "E.164番号",
39
- jwt: "JWT",
40
- template_literal: "入力値",
41
- };
42
- const TypeDictionary = {
43
- nan: "NaN",
44
- number: "数値",
45
- array: "配列",
46
- };
47
- return (issue) => {
48
- switch (issue.code) {
49
- case "invalid_type": {
50
- const expected = TypeDictionary[issue.expected] ?? issue.expected;
51
- const receivedType = util.parsedType(issue.input);
52
- const received = TypeDictionary[receivedType] ?? receivedType;
53
- if (/^[A-Z]/.test(issue.expected)) {
54
- return `無効な入力: instanceof ${issue.expected}が期待されましたが、${received}が入力されました`;
55
- }
56
- return `無効な入力: ${expected}が期待されましたが、${received}が入力されました`;
57
- }
58
- case "invalid_value":
59
- if (issue.values.length === 1)
60
- return `無効な入力: ${util.stringifyPrimitive(issue.values[0])}が期待されました`;
61
- return `無効な選択: ${util.joinValues(issue.values, "、")}のいずれかである必要があります`;
62
- case "too_big": {
63
- const adj = issue.inclusive ? "以下である" : "より小さい";
64
- const sizing = getSizing(issue.origin);
65
- if (sizing)
66
- return `大きすぎる値: ${issue.origin ?? "値"}は${issue.maximum.toString()}${sizing.unit ?? "要素"}${adj}必要があります`;
67
- return `大きすぎる値: ${issue.origin ?? "値"}は${issue.maximum.toString()}${adj}必要があります`;
68
- }
69
- case "too_small": {
70
- const adj = issue.inclusive ? "以上である" : "より大きい";
71
- const sizing = getSizing(issue.origin);
72
- if (sizing)
73
- return `小さすぎる値: ${issue.origin}は${issue.minimum.toString()}${sizing.unit}${adj}必要があります`;
74
- return `小さすぎる値: ${issue.origin}は${issue.minimum.toString()}${adj}必要があります`;
75
- }
76
- case "invalid_format": {
77
- const _issue = issue;
78
- if (_issue.format === "starts_with")
79
- return `無効な文字列: "${_issue.prefix}"で始まる必要があります`;
80
- if (_issue.format === "ends_with")
81
- return `無効な文字列: "${_issue.suffix}"で終わる必要があります`;
82
- if (_issue.format === "includes")
83
- return `無効な文字列: "${_issue.includes}"を含む必要があります`;
84
- if (_issue.format === "regex")
85
- return `無効な文字列: パターン${_issue.pattern}に一致する必要があります`;
86
- return `無効な${FormatDictionary[_issue.format] ?? issue.format}`;
87
- }
88
- case "not_multiple_of":
89
- return `無効な数値: ${issue.divisor}の倍数である必要があります`;
90
- case "unrecognized_keys":
91
- return `認識されていないキー${issue.keys.length > 1 ? "群" : ""}: ${util.joinValues(issue.keys, "、")}`;
92
- case "invalid_key":
93
- return `${issue.origin}内の無効なキー`;
94
- case "invalid_union":
95
- return "無効な入力";
96
- case "invalid_element":
97
- return `${issue.origin}内の無効な値`;
98
- default:
99
- return `無効な入力`;
100
- }
101
- };
102
- };
103
- export default function () {
104
- return {
105
- localeError: error(),
106
- };
107
- }
1
+ import * as util from "../core/util.js";
2
+ const error = () => {
3
+ const Sizable = {
4
+ string: { unit: "文字", verb: "である" },
5
+ file: { unit: "バイト", verb: "である" },
6
+ array: { unit: "要素", verb: "である" },
7
+ set: { unit: "要素", verb: "である" },
8
+ };
9
+ function getSizing(origin) {
10
+ return Sizable[origin] ?? null;
11
+ }
12
+ const FormatDictionary = {
13
+ regex: "入力値",
14
+ email: "メールアドレス",
15
+ url: "URL",
16
+ emoji: "絵文字",
17
+ uuid: "UUID",
18
+ uuidv4: "UUIDv4",
19
+ uuidv6: "UUIDv6",
20
+ nanoid: "nanoid",
21
+ guid: "GUID",
22
+ cuid: "cuid",
23
+ cuid2: "cuid2",
24
+ ulid: "ULID",
25
+ xid: "XID",
26
+ ksuid: "KSUID",
27
+ datetime: "ISO日時",
28
+ date: "ISO日付",
29
+ time: "ISO時刻",
30
+ duration: "ISO期間",
31
+ ipv4: "IPv4アドレス",
32
+ ipv6: "IPv6アドレス",
33
+ cidrv4: "IPv4範囲",
34
+ cidrv6: "IPv6範囲",
35
+ base64: "base64エンコード文字列",
36
+ base64url: "base64urlエンコード文字列",
37
+ json_string: "JSON文字列",
38
+ e164: "E.164番号",
39
+ jwt: "JWT",
40
+ template_literal: "入力値",
41
+ };
42
+ const TypeDictionary = {
43
+ nan: "NaN",
44
+ number: "数値",
45
+ array: "配列",
46
+ };
47
+ return (issue) => {
48
+ switch (issue.code) {
49
+ case "invalid_type": {
50
+ const expected = TypeDictionary[issue.expected] ?? issue.expected;
51
+ const receivedType = util.parsedType(issue.input);
52
+ const received = TypeDictionary[receivedType] ?? receivedType;
53
+ if (/^[A-Z]/.test(issue.expected)) {
54
+ return `無効な入力: instanceof ${issue.expected}が期待されましたが、${received}が入力されました`;
55
+ }
56
+ return `無効な入力: ${expected}が期待されましたが、${received}が入力されました`;
57
+ }
58
+ case "invalid_value":
59
+ if (issue.values.length === 1)
60
+ return `無効な入力: ${util.stringifyPrimitive(issue.values[0])}が期待されました`;
61
+ return `無効な選択: ${util.joinValues(issue.values, "、")}のいずれかである必要があります`;
62
+ case "too_big": {
63
+ const adj = issue.inclusive ? "以下である" : "より小さい";
64
+ const sizing = getSizing(issue.origin);
65
+ if (sizing)
66
+ return `大きすぎる値: ${issue.origin ?? "値"}は${issue.maximum.toString()}${sizing.unit ?? "要素"}${adj}必要があります`;
67
+ return `大きすぎる値: ${issue.origin ?? "値"}は${issue.maximum.toString()}${adj}必要があります`;
68
+ }
69
+ case "too_small": {
70
+ const adj = issue.inclusive ? "以上である" : "より大きい";
71
+ const sizing = getSizing(issue.origin);
72
+ if (sizing)
73
+ return `小さすぎる値: ${issue.origin}は${issue.minimum.toString()}${sizing.unit}${adj}必要があります`;
74
+ return `小さすぎる値: ${issue.origin}は${issue.minimum.toString()}${adj}必要があります`;
75
+ }
76
+ case "invalid_format": {
77
+ const _issue = issue;
78
+ if (_issue.format === "starts_with")
79
+ return `無効な文字列: "${_issue.prefix}"で始まる必要があります`;
80
+ if (_issue.format === "ends_with")
81
+ return `無効な文字列: "${_issue.suffix}"で終わる必要があります`;
82
+ if (_issue.format === "includes")
83
+ return `無効な文字列: "${_issue.includes}"を含む必要があります`;
84
+ if (_issue.format === "regex")
85
+ return `無効な文字列: パターン${_issue.pattern}に一致する必要があります`;
86
+ return `無効な${FormatDictionary[_issue.format] ?? issue.format}`;
87
+ }
88
+ case "not_multiple_of":
89
+ return `無効な数値: ${issue.divisor}の倍数である必要があります`;
90
+ case "unrecognized_keys":
91
+ return `認識されていないキー${issue.keys.length > 1 ? "群" : ""}: ${util.joinValues(issue.keys, "、")}`;
92
+ case "invalid_key":
93
+ return `${issue.origin}内の無効なキー`;
94
+ case "invalid_union":
95
+ return "無効な入力";
96
+ case "invalid_element":
97
+ return `${issue.origin}内の無効な値`;
98
+ default:
99
+ return `無効な入力`;
100
+ }
101
+ };
102
+ };
103
+ export default function () {
104
+ return {
105
+ localeError: error(),
106
+ };
107
+ }