flavor-code 1.3.23 → 1.4.0-beta.3

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 (156) hide show
  1. package/README.md +437 -434
  2. package/README.zh-CN.md +434 -431
  3. package/dist/agent/loop.d.ts +3 -0
  4. package/dist/{app-NTEUPJKJ.js → app-H7RYDMD3.js} +45 -157
  5. package/dist/{chunk-7OICVL2M.js → chunk-2BF7CVWZ.js} +0 -42
  6. package/dist/{chunk-VEUSROUQ.js → chunk-3BHKW5A7.js} +1 -1
  7. package/dist/{chunk-SUSLIHXO.js → chunk-IQAZ42TM.js} +1 -1
  8. package/dist/{chunk-RPFWB45Y.js → chunk-KBHWS7M6.js} +5 -5
  9. package/dist/{chunk-Z62P4LL7.js → chunk-NIKCPCJG.js} +9345 -8623
  10. package/dist/{chunk-RQTYHUMK.js → chunk-ZJCAQXA7.js} +17 -1
  11. package/dist/{claude-ink-6CEG2XZZ.js → claude-ink-ECZ6QF3P.js} +2 -3
  12. package/dist/cli-main.js +27 -11
  13. package/dist/config/load.d.ts +2 -0
  14. package/dist/desktop/main.js +1550 -816
  15. package/dist/desktop-renderer/assets/index-Bk6FYhyh.css +1 -0
  16. package/dist/desktop-renderer/assets/{index-D75ozXnZ.js → index-CYd5JkTR.js} +3 -3
  17. package/dist/desktop-renderer/assets/{interactive-terminal-CTFo4fK9.js → interactive-terminal-j52Ty3QO.js} +1 -1
  18. package/dist/desktop-renderer/index.html +2 -2
  19. package/dist/doctor.d.ts +38 -0
  20. package/dist/execution/docker.d.ts +5 -1
  21. package/dist/execution/types.d.ts +11 -0
  22. package/dist/git/service.d.ts +3 -3
  23. package/dist/git/tools.d.ts +1 -1
  24. package/dist/harness/local.d.ts +2 -0
  25. package/dist/init/project.d.ts +0 -6
  26. package/dist/jobs/registry.d.ts +2 -1
  27. package/dist/{load-4FWNXE6F.js → load-SLSL3IWR.js} +1 -1
  28. package/dist/sdk/index.js +4 -4
  29. package/dist/tools/lsp.d.ts +13 -10
  30. package/dist/tools/runtime.d.ts +2 -1
  31. package/dist/tools/search.d.ts +1 -0
  32. package/dist/tools/shell.d.ts +17 -12
  33. package/dist/tools/types.d.ts +2 -1
  34. package/dist/ui/commands.d.ts +1 -1
  35. package/dist/ui/session.d.ts +1 -0
  36. package/dist/update/check.d.ts +20 -0
  37. package/dist/utils/abort.d.ts +4 -0
  38. package/dist/utils/execFileNoThrow.d.ts +1 -0
  39. package/dist/utils/process-tree.d.ts +2 -0
  40. package/dist/utils/semver.d.ts +3 -0
  41. package/dist/utils/spawn-executable.d.ts +2 -0
  42. package/package.json +2 -2
  43. package//346/212/200/346/234/257/346/226/271/346/241/210/346/212/245/345/221/212.md +5848 -5848
  44. package/dist/astgraph/db.mjs +0 -237
  45. package/dist/astgraph/extract.mjs +0 -239
  46. package/dist/astgraph/flavor-plugin.json +0 -25
  47. package/dist/astgraph/grammars.mjs +0 -68
  48. package/dist/astgraph/index.js +0 -301
  49. package/dist/astgraph/indexer.mjs +0 -175
  50. package/dist/astgraph/query.mjs +0 -165
  51. package/dist/astgraph/resolve.mjs +0 -93
  52. package/dist/astgraph/vendor/tree-sitter-javascript.wasm +0 -0
  53. package/dist/astgraph/vendor/tree-sitter-tsx.wasm +0 -0
  54. package/dist/astgraph/vendor/tree-sitter-typescript.wasm +0 -0
  55. package/dist/astgraph/vendor/tree-sitter.js +0 -3980
  56. package/dist/astgraph/vendor/tree-sitter.wasm +0 -0
  57. package/dist/astgraph/vendor/zod/LICENSE +0 -21
  58. package/dist/astgraph/vendor/zod/index.js +0 -4
  59. package/dist/astgraph/vendor/zod/locales/index.js +0 -1
  60. package/dist/astgraph/vendor/zod/locales/package.json +0 -7
  61. package/dist/astgraph/vendor/zod/package.json +0 -135
  62. package/dist/astgraph/vendor/zod/v4/classic/checks.js +0 -1
  63. package/dist/astgraph/vendor/zod/v4/classic/coerce.js +0 -17
  64. package/dist/astgraph/vendor/zod/v4/classic/compat.js +0 -31
  65. package/dist/astgraph/vendor/zod/v4/classic/errors.js +0 -48
  66. package/dist/astgraph/vendor/zod/v4/classic/external.js +0 -20
  67. package/dist/astgraph/vendor/zod/v4/classic/from-json-schema.js +0 -599
  68. package/dist/astgraph/vendor/zod/v4/classic/index.js +0 -4
  69. package/dist/astgraph/vendor/zod/v4/classic/iso.js +0 -30
  70. package/dist/astgraph/vendor/zod/v4/classic/package.json +0 -7
  71. package/dist/astgraph/vendor/zod/v4/classic/parse.js +0 -15
  72. package/dist/astgraph/vendor/zod/v4/classic/schemas.js +0 -1395
  73. package/dist/astgraph/vendor/zod/v4/core/api.js +0 -1087
  74. package/dist/astgraph/vendor/zod/v4/core/checks.js +0 -575
  75. package/dist/astgraph/vendor/zod/v4/core/core.js +0 -78
  76. package/dist/astgraph/vendor/zod/v4/core/doc.js +0 -35
  77. package/dist/astgraph/vendor/zod/v4/core/errors.js +0 -185
  78. package/dist/astgraph/vendor/zod/v4/core/index.js +0 -16
  79. package/dist/astgraph/vendor/zod/v4/core/json-schema-generator.js +0 -95
  80. package/dist/astgraph/vendor/zod/v4/core/json-schema-processors.js +0 -601
  81. package/dist/astgraph/vendor/zod/v4/core/json-schema.js +0 -1
  82. package/dist/astgraph/vendor/zod/v4/core/package.json +0 -7
  83. package/dist/astgraph/vendor/zod/v4/core/parse.js +0 -93
  84. package/dist/astgraph/vendor/zod/v4/core/regexes.js +0 -139
  85. package/dist/astgraph/vendor/zod/v4/core/registries.js +0 -51
  86. package/dist/astgraph/vendor/zod/v4/core/schemas.js +0 -2239
  87. package/dist/astgraph/vendor/zod/v4/core/standard-schema.js +0 -1
  88. package/dist/astgraph/vendor/zod/v4/core/to-json-schema.js +0 -448
  89. package/dist/astgraph/vendor/zod/v4/core/util.js +0 -674
  90. package/dist/astgraph/vendor/zod/v4/core/versions.js +0 -5
  91. package/dist/astgraph/vendor/zod/v4/index.js +0 -3
  92. package/dist/astgraph/vendor/zod/v4/locales/ar.js +0 -106
  93. package/dist/astgraph/vendor/zod/v4/locales/az.js +0 -105
  94. package/dist/astgraph/vendor/zod/v4/locales/be.js +0 -156
  95. package/dist/astgraph/vendor/zod/v4/locales/bg.js +0 -120
  96. package/dist/astgraph/vendor/zod/v4/locales/ca.js +0 -107
  97. package/dist/astgraph/vendor/zod/v4/locales/cs.js +0 -111
  98. package/dist/astgraph/vendor/zod/v4/locales/da.js +0 -115
  99. package/dist/astgraph/vendor/zod/v4/locales/de.js +0 -108
  100. package/dist/astgraph/vendor/zod/v4/locales/el.js +0 -109
  101. package/dist/astgraph/vendor/zod/v4/locales/en.js +0 -113
  102. package/dist/astgraph/vendor/zod/v4/locales/eo.js +0 -109
  103. package/dist/astgraph/vendor/zod/v4/locales/es.js +0 -132
  104. package/dist/astgraph/vendor/zod/v4/locales/fa.js +0 -114
  105. package/dist/astgraph/vendor/zod/v4/locales/fi.js +0 -112
  106. package/dist/astgraph/vendor/zod/v4/locales/fr-CA.js +0 -107
  107. package/dist/astgraph/vendor/zod/v4/locales/fr.js +0 -125
  108. package/dist/astgraph/vendor/zod/v4/locales/he.js +0 -214
  109. package/dist/astgraph/vendor/zod/v4/locales/hr.js +0 -122
  110. package/dist/astgraph/vendor/zod/v4/locales/hu.js +0 -108
  111. package/dist/astgraph/vendor/zod/v4/locales/hy.js +0 -147
  112. package/dist/astgraph/vendor/zod/v4/locales/id.js +0 -106
  113. package/dist/astgraph/vendor/zod/v4/locales/index.js +0 -52
  114. package/dist/astgraph/vendor/zod/v4/locales/is.js +0 -109
  115. package/dist/astgraph/vendor/zod/v4/locales/it.js +0 -108
  116. package/dist/astgraph/vendor/zod/v4/locales/ja.js +0 -107
  117. package/dist/astgraph/vendor/zod/v4/locales/ka.js +0 -112
  118. package/dist/astgraph/vendor/zod/v4/locales/kh.js +0 -5
  119. package/dist/astgraph/vendor/zod/v4/locales/km.js +0 -110
  120. package/dist/astgraph/vendor/zod/v4/locales/ko.js +0 -111
  121. package/dist/astgraph/vendor/zod/v4/locales/lt.js +0 -203
  122. package/dist/astgraph/vendor/zod/v4/locales/mk.js +0 -109
  123. package/dist/astgraph/vendor/zod/v4/locales/ms.js +0 -107
  124. package/dist/astgraph/vendor/zod/v4/locales/nl.js +0 -110
  125. package/dist/astgraph/vendor/zod/v4/locales/no.js +0 -108
  126. package/dist/astgraph/vendor/zod/v4/locales/ota.js +0 -109
  127. package/dist/astgraph/vendor/zod/v4/locales/package.json +0 -7
  128. package/dist/astgraph/vendor/zod/v4/locales/pl.js +0 -109
  129. package/dist/astgraph/vendor/zod/v4/locales/ps.js +0 -114
  130. package/dist/astgraph/vendor/zod/v4/locales/pt.js +0 -108
  131. package/dist/astgraph/vendor/zod/v4/locales/ro.js +0 -119
  132. package/dist/astgraph/vendor/zod/v4/locales/ru.js +0 -156
  133. package/dist/astgraph/vendor/zod/v4/locales/sl.js +0 -109
  134. package/dist/astgraph/vendor/zod/v4/locales/sv.js +0 -110
  135. package/dist/astgraph/vendor/zod/v4/locales/ta.js +0 -110
  136. package/dist/astgraph/vendor/zod/v4/locales/th.js +0 -110
  137. package/dist/astgraph/vendor/zod/v4/locales/tr.js +0 -105
  138. package/dist/astgraph/vendor/zod/v4/locales/ua.js +0 -5
  139. package/dist/astgraph/vendor/zod/v4/locales/uk.js +0 -108
  140. package/dist/astgraph/vendor/zod/v4/locales/ur.js +0 -110
  141. package/dist/astgraph/vendor/zod/v4/locales/uz.js +0 -110
  142. package/dist/astgraph/vendor/zod/v4/locales/vi.js +0 -108
  143. package/dist/astgraph/vendor/zod/v4/locales/yo.js +0 -107
  144. package/dist/astgraph/vendor/zod/v4/locales/zh-CN.js +0 -109
  145. package/dist/astgraph/vendor/zod/v4/locales/zh-TW.js +0 -107
  146. package/dist/astgraph/vendor/zod/v4/mini/checks.js +0 -1
  147. package/dist/astgraph/vendor/zod/v4/mini/coerce.js +0 -22
  148. package/dist/astgraph/vendor/zod/v4/mini/external.js +0 -14
  149. package/dist/astgraph/vendor/zod/v4/mini/index.js +0 -3
  150. package/dist/astgraph/vendor/zod/v4/mini/iso.js +0 -34
  151. package/dist/astgraph/vendor/zod/v4/mini/package.json +0 -7
  152. package/dist/astgraph/vendor/zod/v4/mini/parse.js +0 -1
  153. package/dist/astgraph/vendor/zod/v4/mini/schemas.js +0 -961
  154. package/dist/astgraph/vendor/zod/v4/package.json +0 -7
  155. package/dist/chunk-OTYFL4AG.js +0 -16
  156. package/dist/desktop-renderer/assets/index-ZZsUx916.css +0 -1
@@ -1,132 +0,0 @@
1
- import * as util from "../core/util.js";
2
- const error = () => {
3
- const Sizable = {
4
- string: { unit: "caracteres", verb: "tener" },
5
- file: { unit: "bytes", verb: "tener" },
6
- array: { unit: "elementos", verb: "tener" },
7
- set: { unit: "elementos", verb: "tener" },
8
- };
9
- function getSizing(origin) {
10
- return Sizable[origin] ?? null;
11
- }
12
- const FormatDictionary = {
13
- regex: "entrada",
14
- email: "dirección de correo electrónico",
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: "fecha y hora ISO",
28
- date: "fecha ISO",
29
- time: "hora ISO",
30
- duration: "duración ISO",
31
- ipv4: "dirección IPv4",
32
- ipv6: "dirección IPv6",
33
- cidrv4: "rango IPv4",
34
- cidrv6: "rango IPv6",
35
- base64: "cadena codificada en base64",
36
- base64url: "URL codificada en base64",
37
- json_string: "cadena JSON",
38
- e164: "número E.164",
39
- jwt: "JWT",
40
- template_literal: "entrada",
41
- };
42
- const TypeDictionary = {
43
- nan: "NaN",
44
- string: "texto",
45
- number: "número",
46
- boolean: "booleano",
47
- array: "arreglo",
48
- object: "objeto",
49
- set: "conjunto",
50
- file: "archivo",
51
- date: "fecha",
52
- bigint: "número grande",
53
- symbol: "símbolo",
54
- undefined: "indefinido",
55
- null: "nulo",
56
- function: "función",
57
- map: "mapa",
58
- record: "registro",
59
- tuple: "tupla",
60
- enum: "enumeración",
61
- union: "unión",
62
- literal: "literal",
63
- promise: "promesa",
64
- void: "vacío",
65
- never: "nunca",
66
- unknown: "desconocido",
67
- any: "cualquiera",
68
- };
69
- return (issue) => {
70
- switch (issue.code) {
71
- case "invalid_type": {
72
- const expected = TypeDictionary[issue.expected] ?? issue.expected;
73
- const receivedType = util.parsedType(issue.input);
74
- const received = TypeDictionary[receivedType] ?? receivedType;
75
- if (/^[A-Z]/.test(issue.expected)) {
76
- return `Entrada inválida: se esperaba instanceof ${issue.expected}, recibido ${received}`;
77
- }
78
- return `Entrada inválida: se esperaba ${expected}, recibido ${received}`;
79
- }
80
- case "invalid_value":
81
- if (issue.values.length === 1)
82
- return `Entrada inválida: se esperaba ${util.stringifyPrimitive(issue.values[0])}`;
83
- return `Opción inválida: se esperaba una de ${util.joinValues(issue.values, "|")}`;
84
- case "too_big": {
85
- const adj = issue.inclusive ? "<=" : "<";
86
- const sizing = getSizing(issue.origin);
87
- const origin = TypeDictionary[issue.origin] ?? issue.origin;
88
- if (sizing)
89
- return `Demasiado grande: se esperaba que ${origin ?? "valor"} tuviera ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementos"}`;
90
- return `Demasiado grande: se esperaba que ${origin ?? "valor"} fuera ${adj}${issue.maximum.toString()}`;
91
- }
92
- case "too_small": {
93
- const adj = issue.inclusive ? ">=" : ">";
94
- const sizing = getSizing(issue.origin);
95
- const origin = TypeDictionary[issue.origin] ?? issue.origin;
96
- if (sizing) {
97
- return `Demasiado pequeño: se esperaba que ${origin} tuviera ${adj}${issue.minimum.toString()} ${sizing.unit}`;
98
- }
99
- return `Demasiado pequeño: se esperaba que ${origin} fuera ${adj}${issue.minimum.toString()}`;
100
- }
101
- case "invalid_format": {
102
- const _issue = issue;
103
- if (_issue.format === "starts_with")
104
- return `Cadena inválida: debe comenzar con "${_issue.prefix}"`;
105
- if (_issue.format === "ends_with")
106
- return `Cadena inválida: debe terminar en "${_issue.suffix}"`;
107
- if (_issue.format === "includes")
108
- return `Cadena inválida: debe incluir "${_issue.includes}"`;
109
- if (_issue.format === "regex")
110
- return `Cadena inválida: debe coincidir con el patrón ${_issue.pattern}`;
111
- return `Inválido ${FormatDictionary[_issue.format] ?? issue.format}`;
112
- }
113
- case "not_multiple_of":
114
- return `Número inválido: debe ser múltiplo de ${issue.divisor}`;
115
- case "unrecognized_keys":
116
- return `Llave${issue.keys.length > 1 ? "s" : ""} desconocida${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
117
- case "invalid_key":
118
- return `Llave inválida en ${TypeDictionary[issue.origin] ?? issue.origin}`;
119
- case "invalid_union":
120
- return "Entrada inválida";
121
- case "invalid_element":
122
- return `Valor inválido en ${TypeDictionary[issue.origin] ?? issue.origin}`;
123
- default:
124
- return `Entrada inválida`;
125
- }
126
- };
127
- };
128
- export default function () {
129
- return {
130
- localeError: error(),
131
- };
132
- }
@@ -1,114 +0,0 @@
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: "تاریخ و زمان ایزو",
28
- date: "تاریخ ایزو",
29
- time: "زمان ایزو",
30
- duration: "مدت زمان ایزو",
31
- ipv4: "IPv4 آدرس",
32
- ipv6: "IPv6 آدرس",
33
- cidrv4: "IPv4 دامنه",
34
- cidrv6: "IPv6 دامنه",
35
- base64: "base64-encoded رشته",
36
- base64url: "base64url-encoded رشته",
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
- }
62
- return `گزینه نامعتبر: می‌بایست یکی از ${util.joinValues(issue.values, "|")} می‌بود`;
63
- case "too_big": {
64
- const adj = issue.inclusive ? "<=" : "<";
65
- const sizing = getSizing(issue.origin);
66
- if (sizing) {
67
- return `خیلی بزرگ: ${issue.origin ?? "مقدار"} باید ${adj}${issue.maximum.toString()} ${sizing.unit ?? "عنصر"} باشد`;
68
- }
69
- return `خیلی بزرگ: ${issue.origin ?? "مقدار"} باید ${adj}${issue.maximum.toString()} باشد`;
70
- }
71
- case "too_small": {
72
- const adj = issue.inclusive ? ">=" : ">";
73
- const sizing = getSizing(issue.origin);
74
- if (sizing) {
75
- return `خیلی کوچک: ${issue.origin} باید ${adj}${issue.minimum.toString()} ${sizing.unit} باشد`;
76
- }
77
- return `خیلی کوچک: ${issue.origin} باید ${adj}${issue.minimum.toString()} باشد`;
78
- }
79
- case "invalid_format": {
80
- const _issue = issue;
81
- if (_issue.format === "starts_with") {
82
- return `رشته نامعتبر: باید با "${_issue.prefix}" شروع شود`;
83
- }
84
- if (_issue.format === "ends_with") {
85
- return `رشته نامعتبر: باید با "${_issue.suffix}" تمام شود`;
86
- }
87
- if (_issue.format === "includes") {
88
- return `رشته نامعتبر: باید شامل "${_issue.includes}" باشد`;
89
- }
90
- if (_issue.format === "regex") {
91
- return `رشته نامعتبر: باید با الگوی ${_issue.pattern} مطابقت داشته باشد`;
92
- }
93
- return `${FormatDictionary[_issue.format] ?? issue.format} نامعتبر`;
94
- }
95
- case "not_multiple_of":
96
- return `عدد نامعتبر: باید مضرب ${issue.divisor} باشد`;
97
- case "unrecognized_keys":
98
- return `کلید${issue.keys.length > 1 ? "های" : ""} ناشناس: ${util.joinValues(issue.keys, ", ")}`;
99
- case "invalid_key":
100
- return `کلید ناشناس در ${issue.origin}`;
101
- case "invalid_union":
102
- return `ورودی نامعتبر`;
103
- case "invalid_element":
104
- return `مقدار نامعتبر در ${issue.origin}`;
105
- default:
106
- return `ورودی نامعتبر`;
107
- }
108
- };
109
- };
110
- export default function () {
111
- return {
112
- localeError: error(),
113
- };
114
- }
@@ -1,112 +0,0 @@
1
- import * as util from "../core/util.js";
2
- const error = () => {
3
- const Sizable = {
4
- string: { unit: "merkkiä", subject: "merkkijonon" },
5
- file: { unit: "tavua", subject: "tiedoston" },
6
- array: { unit: "alkiota", subject: "listan" },
7
- set: { unit: "alkiota", subject: "joukon" },
8
- number: { unit: "", subject: "luvun" },
9
- bigint: { unit: "", subject: "suuren kokonaisluvun" },
10
- int: { unit: "", subject: "kokonaisluvun" },
11
- date: { unit: "", subject: "päivämäärän" },
12
- };
13
- function getSizing(origin) {
14
- return Sizable[origin] ?? null;
15
- }
16
- const FormatDictionary = {
17
- regex: "säännöllinen lauseke",
18
- email: "sähköpostiosoite",
19
- url: "URL-osoite",
20
- emoji: "emoji",
21
- uuid: "UUID",
22
- uuidv4: "UUIDv4",
23
- uuidv6: "UUIDv6",
24
- nanoid: "nanoid",
25
- guid: "GUID",
26
- cuid: "cuid",
27
- cuid2: "cuid2",
28
- ulid: "ULID",
29
- xid: "XID",
30
- ksuid: "KSUID",
31
- datetime: "ISO-aikaleima",
32
- date: "ISO-päivämäärä",
33
- time: "ISO-aika",
34
- duration: "ISO-kesto",
35
- ipv4: "IPv4-osoite",
36
- ipv6: "IPv6-osoite",
37
- cidrv4: "IPv4-alue",
38
- cidrv6: "IPv6-alue",
39
- base64: "base64-koodattu merkkijono",
40
- base64url: "base64url-koodattu merkkijono",
41
- json_string: "JSON-merkkijono",
42
- e164: "E.164-luku",
43
- jwt: "JWT",
44
- template_literal: "templaattimerkkijono",
45
- };
46
- const TypeDictionary = {
47
- nan: "NaN",
48
- };
49
- return (issue) => {
50
- switch (issue.code) {
51
- case "invalid_type": {
52
- const expected = TypeDictionary[issue.expected] ?? issue.expected;
53
- const receivedType = util.parsedType(issue.input);
54
- const received = TypeDictionary[receivedType] ?? receivedType;
55
- if (/^[A-Z]/.test(issue.expected)) {
56
- return `Virheellinen tyyppi: odotettiin instanceof ${issue.expected}, oli ${received}`;
57
- }
58
- return `Virheellinen tyyppi: odotettiin ${expected}, oli ${received}`;
59
- }
60
- case "invalid_value":
61
- if (issue.values.length === 1)
62
- return `Virheellinen syöte: täytyy olla ${util.stringifyPrimitive(issue.values[0])}`;
63
- return `Virheellinen valinta: täytyy olla yksi seuraavista: ${util.joinValues(issue.values, "|")}`;
64
- case "too_big": {
65
- const adj = issue.inclusive ? "<=" : "<";
66
- const sizing = getSizing(issue.origin);
67
- if (sizing) {
68
- return `Liian suuri: ${sizing.subject} täytyy olla ${adj}${issue.maximum.toString()} ${sizing.unit}`.trim();
69
- }
70
- return `Liian suuri: arvon täytyy olla ${adj}${issue.maximum.toString()}`;
71
- }
72
- case "too_small": {
73
- const adj = issue.inclusive ? ">=" : ">";
74
- const sizing = getSizing(issue.origin);
75
- if (sizing) {
76
- return `Liian pieni: ${sizing.subject} täytyy olla ${adj}${issue.minimum.toString()} ${sizing.unit}`.trim();
77
- }
78
- return `Liian pieni: arvon täytyy olla ${adj}${issue.minimum.toString()}`;
79
- }
80
- case "invalid_format": {
81
- const _issue = issue;
82
- if (_issue.format === "starts_with")
83
- return `Virheellinen syöte: täytyy alkaa "${_issue.prefix}"`;
84
- if (_issue.format === "ends_with")
85
- return `Virheellinen syöte: täytyy loppua "${_issue.suffix}"`;
86
- if (_issue.format === "includes")
87
- return `Virheellinen syöte: täytyy sisältää "${_issue.includes}"`;
88
- if (_issue.format === "regex") {
89
- return `Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${_issue.pattern}`;
90
- }
91
- return `Virheellinen ${FormatDictionary[_issue.format] ?? issue.format}`;
92
- }
93
- case "not_multiple_of":
94
- return `Virheellinen luku: täytyy olla luvun ${issue.divisor} monikerta`;
95
- case "unrecognized_keys":
96
- return `${issue.keys.length > 1 ? "Tuntemattomat avaimet" : "Tuntematon avain"}: ${util.joinValues(issue.keys, ", ")}`;
97
- case "invalid_key":
98
- return "Virheellinen avain tietueessa";
99
- case "invalid_union":
100
- return "Virheellinen unioni";
101
- case "invalid_element":
102
- return "Virheellinen arvo joukossa";
103
- default:
104
- return `Virheellinen syöte`;
105
- }
106
- };
107
- };
108
- export default function () {
109
- return {
110
- localeError: error(),
111
- };
112
- }
@@ -1,107 +0,0 @@
1
- import * as util from "../core/util.js";
2
- const error = () => {
3
- const Sizable = {
4
- string: { unit: "caractères", verb: "avoir" },
5
- file: { unit: "octets", verb: "avoir" },
6
- array: { unit: "éléments", verb: "avoir" },
7
- set: { unit: "éléments", verb: "avoir" },
8
- };
9
- function getSizing(origin) {
10
- return Sizable[origin] ?? null;
11
- }
12
- const FormatDictionary = {
13
- regex: "entrée",
14
- email: "adresse courriel",
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: "date-heure ISO",
28
- date: "date ISO",
29
- time: "heure ISO",
30
- duration: "durée ISO",
31
- ipv4: "adresse IPv4",
32
- ipv6: "adresse IPv6",
33
- cidrv4: "plage IPv4",
34
- cidrv6: "plage IPv6",
35
- base64: "chaîne encodée en base64",
36
- base64url: "chaîne encodée en base64url",
37
- json_string: "chaîne JSON",
38
- e164: "numéro E.164",
39
- jwt: "JWT",
40
- template_literal: "entrée",
41
- };
42
- const TypeDictionary = {
43
- nan: "NaN",
44
- };
45
- return (issue) => {
46
- switch (issue.code) {
47
- case "invalid_type": {
48
- const expected = TypeDictionary[issue.expected] ?? issue.expected;
49
- const receivedType = util.parsedType(issue.input);
50
- const received = TypeDictionary[receivedType] ?? receivedType;
51
- if (/^[A-Z]/.test(issue.expected)) {
52
- return `Entrée invalide : attendu instanceof ${issue.expected}, reçu ${received}`;
53
- }
54
- return `Entrée invalide : attendu ${expected}, reçu ${received}`;
55
- }
56
- case "invalid_value":
57
- if (issue.values.length === 1)
58
- return `Entrée invalide : attendu ${util.stringifyPrimitive(issue.values[0])}`;
59
- return `Option invalide : attendu l'une des valeurs suivantes ${util.joinValues(issue.values, "|")}`;
60
- case "too_big": {
61
- const adj = issue.inclusive ? "≤" : "<";
62
- const sizing = getSizing(issue.origin);
63
- if (sizing)
64
- return `Trop grand : attendu que ${issue.origin ?? "la valeur"} ait ${adj}${issue.maximum.toString()} ${sizing.unit}`;
65
- return `Trop grand : attendu que ${issue.origin ?? "la valeur"} soit ${adj}${issue.maximum.toString()}`;
66
- }
67
- case "too_small": {
68
- const adj = issue.inclusive ? "≥" : ">";
69
- const sizing = getSizing(issue.origin);
70
- if (sizing) {
71
- return `Trop petit : attendu que ${issue.origin} ait ${adj}${issue.minimum.toString()} ${sizing.unit}`;
72
- }
73
- return `Trop petit : attendu que ${issue.origin} soit ${adj}${issue.minimum.toString()}`;
74
- }
75
- case "invalid_format": {
76
- const _issue = issue;
77
- if (_issue.format === "starts_with") {
78
- return `Chaîne invalide : doit commencer par "${_issue.prefix}"`;
79
- }
80
- if (_issue.format === "ends_with")
81
- return `Chaîne invalide : doit se terminer par "${_issue.suffix}"`;
82
- if (_issue.format === "includes")
83
- return `Chaîne invalide : doit inclure "${_issue.includes}"`;
84
- if (_issue.format === "regex")
85
- return `Chaîne invalide : doit correspondre au motif ${_issue.pattern}`;
86
- return `${FormatDictionary[_issue.format] ?? issue.format} invalide`;
87
- }
88
- case "not_multiple_of":
89
- return `Nombre invalide : doit être un multiple de ${issue.divisor}`;
90
- case "unrecognized_keys":
91
- return `Clé${issue.keys.length > 1 ? "s" : ""} non reconnue${issue.keys.length > 1 ? "s" : ""} : ${util.joinValues(issue.keys, ", ")}`;
92
- case "invalid_key":
93
- return `Clé invalide dans ${issue.origin}`;
94
- case "invalid_union":
95
- return "Entrée invalide";
96
- case "invalid_element":
97
- return `Valeur invalide dans ${issue.origin}`;
98
- default:
99
- return `Entrée invalide`;
100
- }
101
- };
102
- };
103
- export default function () {
104
- return {
105
- localeError: error(),
106
- };
107
- }
@@ -1,125 +0,0 @@
1
- import * as util from "../core/util.js";
2
- const error = () => {
3
- const Sizable = {
4
- string: { unit: "caractères", verb: "avoir" },
5
- file: { unit: "octets", verb: "avoir" },
6
- array: { unit: "éléments", verb: "avoir" },
7
- set: { unit: "éléments", verb: "avoir" },
8
- };
9
- function getSizing(origin) {
10
- return Sizable[origin] ?? null;
11
- }
12
- const FormatDictionary = {
13
- regex: "entrée",
14
- email: "adresse e-mail",
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: "date et heure ISO",
28
- date: "date ISO",
29
- time: "heure ISO",
30
- duration: "durée ISO",
31
- ipv4: "adresse IPv4",
32
- ipv6: "adresse IPv6",
33
- cidrv4: "plage IPv4",
34
- cidrv6: "plage IPv6",
35
- base64: "chaîne encodée en base64",
36
- base64url: "chaîne encodée en base64url",
37
- json_string: "chaîne JSON",
38
- e164: "numéro E.164",
39
- jwt: "JWT",
40
- template_literal: "entrée",
41
- };
42
- const TypeDictionary = {
43
- string: "chaîne",
44
- number: "nombre",
45
- int: "entier",
46
- boolean: "booléen",
47
- bigint: "grand entier",
48
- symbol: "symbole",
49
- undefined: "indéfini",
50
- null: "null",
51
- never: "jamais",
52
- void: "vide",
53
- date: "date",
54
- array: "tableau",
55
- object: "objet",
56
- tuple: "tuple",
57
- record: "enregistrement",
58
- map: "carte",
59
- set: "ensemble",
60
- file: "fichier",
61
- nonoptional: "non-optionnel",
62
- nan: "NaN",
63
- function: "fonction",
64
- };
65
- return (issue) => {
66
- switch (issue.code) {
67
- case "invalid_type": {
68
- const expected = TypeDictionary[issue.expected] ?? issue.expected;
69
- const receivedType = util.parsedType(issue.input);
70
- const received = TypeDictionary[receivedType] ?? receivedType;
71
- if (/^[A-Z]/.test(issue.expected)) {
72
- return `Entrée invalide : instanceof ${issue.expected} attendu, ${received} reçu`;
73
- }
74
- return `Entrée invalide : ${expected} attendu, ${received} reçu`;
75
- }
76
- case "invalid_value":
77
- if (issue.values.length === 1)
78
- return `Entrée invalide : ${util.stringifyPrimitive(issue.values[0])} attendu`;
79
- return `Option invalide : une valeur parmi ${util.joinValues(issue.values, "|")} attendue`;
80
- case "too_big": {
81
- const adj = issue.inclusive ? "<=" : "<";
82
- const sizing = getSizing(issue.origin);
83
- if (sizing)
84
- return `Trop grand : ${TypeDictionary[issue.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "élément(s)"}`;
85
- return `Trop grand : ${TypeDictionary[issue.origin] ?? "valeur"} doit être ${adj}${issue.maximum.toString()}`;
86
- }
87
- case "too_small": {
88
- const adj = issue.inclusive ? ">=" : ">";
89
- const sizing = getSizing(issue.origin);
90
- if (sizing)
91
- return `Trop petit : ${TypeDictionary[issue.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
92
- return `Trop petit : ${TypeDictionary[issue.origin] ?? "valeur"} doit être ${adj}${issue.minimum.toString()}`;
93
- }
94
- case "invalid_format": {
95
- const _issue = issue;
96
- if (_issue.format === "starts_with")
97
- return `Chaîne invalide : doit commencer par "${_issue.prefix}"`;
98
- if (_issue.format === "ends_with")
99
- return `Chaîne invalide : doit se terminer par "${_issue.suffix}"`;
100
- if (_issue.format === "includes")
101
- return `Chaîne invalide : doit inclure "${_issue.includes}"`;
102
- if (_issue.format === "regex")
103
- return `Chaîne invalide : doit correspondre au modèle ${_issue.pattern}`;
104
- return `${FormatDictionary[_issue.format] ?? issue.format} invalide`;
105
- }
106
- case "not_multiple_of":
107
- return `Nombre invalide : doit être un multiple de ${issue.divisor}`;
108
- case "unrecognized_keys":
109
- return `Clé${issue.keys.length > 1 ? "s" : ""} non reconnue${issue.keys.length > 1 ? "s" : ""} : ${util.joinValues(issue.keys, ", ")}`;
110
- case "invalid_key":
111
- return `Clé invalide dans ${issue.origin}`;
112
- case "invalid_union":
113
- return "Entrée invalide";
114
- case "invalid_element":
115
- return `Valeur invalide dans ${issue.origin}`;
116
- default:
117
- return `Entrée invalide`;
118
- }
119
- };
120
- };
121
- export default function () {
122
- return {
123
- localeError: error(),
124
- };
125
- }