@menapo/vi18n 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/{apply-Bre-lY9J.js → apply-FAHl1R6T.js} +69 -89
  2. package/dist/{captured-Bj8bO6vd.js → captured-CTjjDF5o.js} +196 -217
  3. package/dist/{check-BIKEuu6B.js → check-DwFwOB1d.js} +66 -84
  4. package/dist/cli.js +2 -3
  5. package/dist/{collect-Cx4_SKOe.js → collect-CYATDjdo.js} +1 -2
  6. package/dist/collisions-uMTuq36M.js +215 -0
  7. package/dist/compile-CEvH-6sY.js +240 -0
  8. package/dist/{compile-Cc97JaW2.js → compile-DqkofbiO.js} +376 -331
  9. package/dist/concurrency-BCY_4zcr.js +1 -0
  10. package/dist/concurrency-Dy2ny50V.js +107 -0
  11. package/dist/config.d.ts +1 -5
  12. package/dist/config.js +4 -5
  13. package/dist/{types-D3QGM8XO.js → diagnostics-1onDF6Ua.js} +26 -26
  14. package/dist/{dir-zw6bGMKQ.js → dir-TGLYuOZb.js} +34 -37
  15. package/dist/{duplicates-yuRljQ6h.js → duplicates-CsUXRX2J.js} +10 -27
  16. package/dist/engine-Bf7nVigL.js +556 -0
  17. package/dist/engine.d.ts +1 -5
  18. package/dist/engine.js +297 -168
  19. package/dist/exchange-DYG9RZoT.js +41 -0
  20. package/dist/{exclude-Du-Zd_qI.js → exclude-vMnm3lqU.js} +2 -3
  21. package/dist/{export-C9Sy6UWv.js → export-BYq0gfLd.js} +17 -38
  22. package/dist/{extract-C3S8btx0.js → extract-CYtuEo8u.js} +114 -82
  23. package/dist/{formats-9unqj_fZ.js → formats-ChV1LVH_.js} +352 -276
  24. package/dist/fs-ezCMZeDV.js +52 -0
  25. package/dist/i18next-1waHziMy.js +1 -0
  26. package/dist/i18next-D66Icz3L.js +1907 -0
  27. package/dist/{import-nANvQutw.js → import-BApbQlmm.js} +81 -75
  28. package/dist/index.d.ts +1 -13
  29. package/dist/index.js +14 -16
  30. package/dist/{init-C2ScuW6a.js → init-J7AwwA5e.js} +466 -501
  31. package/dist/{library-D5CWvTQs.js → library-BfSOBeBd.js} +975 -451
  32. package/dist/lingui-Ee2farVo.js +902 -0
  33. package/dist/lint.d.ts +0 -4
  34. package/dist/lint.js +68 -81
  35. package/dist/{load-gW-oJt1Q.js → load-BFLLqY8x.js} +272 -147
  36. package/dist/{load-CQRz4PpM.js → load-CMwhukZ4.js} +1211 -1115
  37. package/dist/{locales-DX4MOBFE.js → locales-DxLDrx-h.js} +271 -237
  38. package/dist/{lsp-RMMMc88P.js → lsp-BC7xDGON.js} +4 -5
  39. package/dist/{match-BGr8EXB3.js → match-BLDcj610.js} +11 -4
  40. package/dist/{mcp-CHVwBoRP.js → mcp-Cka8ywDF.js} +4 -5
  41. package/dist/{merge-driver-BTX87aVm.js → merge-driver-B04Apm29.js} +138 -122
  42. package/dist/migrate-D7TNl6SD.js +2169 -0
  43. package/dist/migrate-khCY8TE0.js +1 -0
  44. package/dist/{openai-CTaMDcl-.js → openai-RWw0YlAx.js} +128 -87
  45. package/dist/{output-DWE3SIUA.js → output-CF9uvk_-.js} +15 -9
  46. package/dist/parse.d.ts +1 -3
  47. package/dist/parse.js +7 -8
  48. package/dist/{pipeline-DbX6rlo5.js → pipeline-B30irGMD.js} +1 -1
  49. package/dist/{pipeline-C9Dbotkh.js → pipeline-sgl_q_op.js} +387 -359
  50. package/dist/project-DSzWKU3C.js +544 -0
  51. package/dist/{pseudo-DRv30iN5.js → pseudo-DNbNNVGP.js} +125 -3
  52. package/dist/{raw-C4Y6vyGY.js → raw-YsYZMS9n.js} +52 -29
  53. package/dist/react-intl-tzGIk6G3.js +634 -0
  54. package/dist/restore-BG_zMpSj.js +199 -0
  55. package/dist/rewrite-hAcRJwiZ.js +415 -0
  56. package/dist/{rich-DCUKl5HM.js → rich-ApY1Dm4S.js} +35 -28
  57. package/dist/rolldown-runtime-C1I3wEg2.js +43 -0
  58. package/dist/{rolldown-runtime-D7D4PA-g.js → rolldown-runtime-D8jQpDG7.js} +1 -2
  59. package/dist/run-CFzR3V93.js +647 -0
  60. package/dist/scan-worker.d.ts +2 -4
  61. package/dist/scan-worker.js +1 -1
  62. package/dist/{scoped-BMYpSthj.js → scoped-h3KE8XWW.js} +3 -4
  63. package/dist/{server-deBOq2vq.js → server-WlxZH0oX.js} +275 -330
  64. package/dist/{server-Da1Ot9IN.js → server-ceuzzkal.js} +292 -386
  65. package/dist/server.d.ts +1 -17
  66. package/dist/server.js +415 -381
  67. package/dist/{sitemap-DJXzKoza.js → sitemap-796jJKUT.js} +21 -33
  68. package/dist/{sources-D19czDSA.js → sources-DuOdM02f.js} +712 -373
  69. package/dist/{status-zr4jY59Y.js → status-CTH3qI-0.js} +30 -30
  70. package/dist/{stdio-FPOKQAgu.js → stdio-D9kTzyqB.js} +2 -4
  71. package/dist/{stdio-CVaJfxA7.js → stdio-FWIVU3P4.js} +1 -2
  72. package/dist/sync-CpL0Qsgw.js +1352 -0
  73. package/dist/{t-DC-c9zE5.js → t-gvEXx25s.js} +76 -53
  74. package/dist/test.d.ts +5 -16
  75. package/dist/test.js +77 -48
  76. package/dist/translate-BrfVRkjl.js +336 -0
  77. package/dist/{ts-BaU5yOf0.js → ts-BX6kwig5.js} +25 -14
  78. package/dist/{types-DtvQ7UdD.js → types-3kwyaCAm.js} +1 -2
  79. package/dist/{types-DsdWBG0b.d.ts → types-BaG1LboH.d.ts} +2 -6
  80. package/dist/{types-CgUCkFU1.d.ts → types-Cy2bPdSg.d.ts} +14 -20
  81. package/dist/types-Ds_vebja.js +41 -0
  82. package/dist/{units-CQ5Q99RC.js → units-VVLgQ7x7.js} +7 -16
  83. package/dist/{url-CRfCOhUI.js → url-Bpc6wLea.js} +24 -11
  84. package/dist/{url-CsBkRaJy.js → url-D2_VlEeH.js} +25 -12
  85. package/dist/{validate-D6DJepZv.js → validate-PGgMsasz.js} +3 -5
  86. package/dist/{validate-BxpupdAf.js → validate-zv4-IZyZ.js} +690 -377
  87. package/dist/{version-Byqi2guX.js → version-BFs370Ce.js} +3 -5
  88. package/dist/{vite-scan-CT_vsp4g.js → vite-scan-DFKSGVE9.js} +87 -92
  89. package/dist/vite.d.ts +2 -6
  90. package/dist/vite.js +6482 -6018
  91. package/dist/vue-i18n-CBmZqHbG.js +806 -0
  92. package/dist/{which-BOemZ5Q8.js → which-BpyJyBkX.js} +44 -37
  93. package/dist/{worker-84U6uYB3.js → worker-BjzVqJVO.js} +454 -608
  94. package/package.json +5 -5
  95. package/dist/check-HsmmpJZg.js +0 -1
  96. package/dist/codec-DuvU2VQy.js +0 -207
  97. package/dist/collisions-CfpZU8e4.js +0 -217
  98. package/dist/compile-BaDh0cHG.js +0 -245
  99. package/dist/concurrency-C9UUWuDC.js +0 -96
  100. package/dist/concurrency-DONL7t4V.js +0 -1
  101. package/dist/engine-C2ENBRJe.js +0 -531
  102. package/dist/i18next-9HAoxwUI.js +0 -1
  103. package/dist/i18next-BEJgv_S8.js +0 -1596
  104. package/dist/lingui-zUiCl9Um.js +0 -833
  105. package/dist/messages-BfjIExyB.js +0 -166
  106. package/dist/migrate-IpLDMXmq.js +0 -1484
  107. package/dist/migrate-rCQuOGsf.js +0 -1
  108. package/dist/project-Bw9UPIdx.js +0 -1046
  109. package/dist/project-C4GpaN-n.js +0 -381
  110. package/dist/react-intl-BP0u-D5m.js +0 -519
  111. package/dist/restore-CiYv-jxS.js +0 -175
  112. package/dist/rewrite-EsIw_lsq.js +0 -803
  113. package/dist/run-BEcnBbu-.js +0 -694
  114. package/dist/runtime-DTMmliT1.js +0 -64
  115. package/dist/sync-B9V2KFwb.js +0 -658
  116. package/dist/translate-CQnJfLjO.js +0 -299
  117. package/dist/types-wSh9fCBY.js +0 -11
  118. package/dist/vue-i18n-g0iGy6CZ.js +0 -651
@@ -0,0 +1 @@
1
+ export { c as migrate } from "./migrate-D7TNl6SD.js";
@@ -1,4 +1,4 @@
1
- import { a as diagnosticError } from "./types-D3QGM8XO.js";
1
+ import { t as diagnosticError } from "./diagnostics-1onDF6Ua.js";
2
2
  /** Longest wait between retries, whatever the server asks for. */
3
3
  const MAX_DELAY_MS = 6e4;
4
4
  /** Error bodies are quoted in messages; past this they are noise. */
@@ -72,14 +72,25 @@ function answerItems(text) {
72
72
  function field(value, name) {
73
73
  return typeof value === "object" && value !== null ? value[name] : void 0;
74
74
  }
75
- function count(value) {
75
+ /**
76
+ * Estimated USD at a price per 1M tokens; `NaN` without a price, so a
77
+ * `--max-cost` comparison can never pass by accident. Here rather than in
78
+ * prices.ts so `openaiCompatible` (in `/config`) does not carry Gemini's table.
79
+ */
80
+ function costAt(price, usage) {
81
+ if (price === null || price === void 0) return NaN;
82
+ return (usage.inputTokens * price.input + usage.outputTokens * price.output) / 1e6;
83
+ }
84
+ /** A token count from a provider's usage block: a positive finite number, else 0. */
85
+ function tokenCount(value) {
76
86
  return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
77
87
  }
78
- function parseJson(text) {
88
+ /** `JSON.parse`, or `fallback` when the text is not JSON. */
89
+ function parseJson(text, fallback) {
79
90
  try {
80
91
  return JSON.parse(text);
81
92
  } catch {
82
- return;
93
+ return fallback;
83
94
  }
84
95
  }
85
96
  /**
@@ -136,6 +147,31 @@ function providerError(message, key) {
136
147
  message: redact(message, key)
137
148
  });
138
149
  }
150
+ /** The key in `env[name]`; throws `missing` when it is unset or blank. */
151
+ function requireKey(env, name, missing) {
152
+ const key = readKey(env, name);
153
+ if (key === null) throw diagnosticError(missing());
154
+ return key;
155
+ }
156
+ /**
157
+ * A provider's `baseURL` without trailing slashes, and its origin; a value
158
+ * that is not a URL is a config error naming the call it was passed to.
159
+ */
160
+ function parseBaseURL(base, call) {
161
+ const trimmed = base.replace(/\/+$/, "");
162
+ try {
163
+ return {
164
+ base: trimmed,
165
+ origin: new URL(trimmed).origin
166
+ };
167
+ } catch {
168
+ throw diagnosticError({
169
+ code: "config-invalid",
170
+ severity: "error",
171
+ message: `${call}({ baseURL: ${JSON.stringify(trimmed)} }) is not a URL`
172
+ });
173
+ }
174
+ }
139
175
  /** The key in `env[name]`, or null when it is unset or blank. */
140
176
  function readKey(env, name) {
141
177
  const key = (env ?? globalThis.process?.env ?? {})[name];
@@ -174,91 +210,97 @@ const FORMATS = [
174
210
  "text"
175
211
  ];
176
212
  function openaiCompatible(options) {
177
- if (typeof options?.model !== "string" || options.model.trim() === "") throw diagnosticError({
178
- code: "config-invalid",
179
- severity: "error",
180
- message: "openaiCompatible() needs a model, e.g. { model: \"gpt-5-mini\" }"
181
- });
182
- const model = options.model;
183
- const base = (options.baseURL ?? "https://api.openai.com/v1").replace(/\/+$/, "");
184
- let origin;
185
- try {
186
- origin = new URL(base).origin;
187
- } catch {
188
- throw diagnosticError({
213
+ return new OpenAICompatibleProvider(options);
214
+ }
215
+ var OpenAICompatibleProvider = class {
216
+ name = "openai-compatible";
217
+ model;
218
+ apiKeyEnv;
219
+ url;
220
+ origin;
221
+ label;
222
+ format;
223
+ temperature = true;
224
+ options;
225
+ constructor(options) {
226
+ if (typeof options?.model !== "string" || options.model.trim() === "") throw diagnosticError({
189
227
  code: "config-invalid",
190
228
  severity: "error",
191
- message: `openaiCompatible({ baseURL: ${JSON.stringify(base)} }) is not a URL`
229
+ message: "openaiCompatible() needs a model, e.g. { model: \"gpt-5-mini\" }"
192
230
  });
231
+ this.options = options;
232
+ this.model = options.model;
233
+ const { base, origin } = parseBaseURL(options.baseURL ?? "https://api.openai.com/v1", "openaiCompatible");
234
+ this.origin = origin;
235
+ this.apiKeyEnv = options.apiKeyEnv ?? (origin === new URL("https://api.openai.com/v1").origin ? OPENAI_KEY_ENV : null);
236
+ this.url = `${base}/chat/completions`;
237
+ this.label = `${this.model} (${origin})`;
238
+ this.format = FORMATS.indexOf(options.responseFormat ?? "json_schema");
193
239
  }
194
- const apiKeyEnv = options.apiKeyEnv ?? (origin === new URL("https://api.openai.com/v1").origin ? OPENAI_KEY_ENV : null);
195
- const url = `${base}/chat/completions`;
196
- const label = `${model} (${origin})`;
197
- const missingKey = () => apiKeyEnv !== null && readKey(options.env, apiKeyEnv) === null ? {
198
- code: "ai-missing-key",
199
- severity: "error",
200
- message: `Set ${apiKeyEnv} to the API key of ${origin} to translate with ${model}`
201
- } : null;
202
- let format = FORMATS.indexOf(options.responseFormat ?? "json_schema");
203
- let temperature = true;
204
- return {
205
- name: "openai-compatible",
206
- model,
207
- apiKeyEnv,
208
- async translate(request, callOptions) {
209
- const problem = missingKey();
210
- if (problem !== null) throw diagnosticError(problem);
211
- const key = apiKeyEnv === null ? "" : readKey(options.env, apiKeyEnv);
212
- const headers = { "content-type": "application/json" };
213
- if (key !== "") headers.authorization = `Bearer ${key}`;
214
- for (;;) {
215
- const sentFormat = format;
216
- const sentTemperature = temperature;
217
- const answer = await exchange({
218
- fetch: options.fetch ?? globalThis.fetch,
219
- url,
220
- init: {
221
- method: "POST",
222
- headers,
223
- body: JSON.stringify(requestBody(request, model, FORMATS[sentFormat], sentTemperature))
224
- },
225
- key,
226
- label,
227
- signal: callOptions?.signal,
228
- onRateLimit: callOptions?.onRateLimit,
229
- isRateLimit: (answer) => answer.status === 429 && !quotaExhausted(answer.json),
230
- serverDelay: (answer) => retryAfterMsDelay(answer.headers),
231
- advice: "lower ai.concurrency or wait for the rate limit to reset"
232
- });
233
- if (answer.ok) return readAnswer(answer.json);
234
- if (answer.status === 400 || answer.status === 404) {
235
- const refused = refusedParameter(answer);
236
- if ((refused === "response_format" || refused === "unnamed") && sentFormat < FORMATS.length - 1) {
237
- format = Math.max(format, sentFormat + 1);
238
- continue;
239
- }
240
- if ((refused === "temperature" || refused === "unnamed") && sentTemperature) {
241
- temperature = false;
242
- continue;
243
- }
244
- }
245
- throw providerError(failureMessage(answer, label, key, apiKeyEnv, origin), key);
246
- }
247
- },
248
- estimateCost(usage) {
249
- const prices = options.prices;
250
- if (prices === void 0) return NaN;
251
- return (usage.inputTokens * prices.input + usage.outputTokens * prices.output) / 1e6;
252
- },
253
- missingKey,
254
- withModel(next) {
255
- return openaiCompatible({
256
- ...options,
257
- model: next
240
+ async translate(request, callOptions) {
241
+ const { apiKeyEnv } = this;
242
+ const key = apiKeyEnv === null ? "" : requireKey(this.options.env, apiKeyEnv, () => this.keyMissing(apiKeyEnv));
243
+ const headers = { "content-type": "application/json" };
244
+ if (key !== "") headers.authorization = `Bearer ${key}`;
245
+ for (;;) {
246
+ const sentFormat = this.format;
247
+ const sentTemperature = this.temperature;
248
+ const answer = await exchange({
249
+ fetch: this.options.fetch ?? globalThis.fetch,
250
+ url: this.url,
251
+ init: {
252
+ method: "POST",
253
+ headers,
254
+ body: JSON.stringify(requestBody(request, this.model, FORMATS[sentFormat], sentTemperature))
255
+ },
256
+ key,
257
+ label: this.label,
258
+ signal: callOptions?.signal,
259
+ onRateLimit: callOptions?.onRateLimit,
260
+ isRateLimit: (answer) => answer.status === 429 && !quotaExhausted(answer.json),
261
+ serverDelay: (answer) => retryAfterMsDelay(answer.headers),
262
+ advice: "lower ai.concurrency or wait for the rate limit to reset"
258
263
  });
264
+ if (answer.ok) return readAnswer(answer.json);
265
+ if (!this.fallBack(answer, sentFormat, sentTemperature)) throw providerError(failureMessage(answer, this.label, key, apiKeyEnv, this.origin), key);
259
266
  }
260
- };
261
- }
267
+ }
268
+ /** Whether a refused request is worth sending again without what the server refused. */
269
+ fallBack(answer, sentFormat, sentTemperature) {
270
+ if (answer.status !== 400 && answer.status !== 404) return false;
271
+ const refused = refusedParameter(answer);
272
+ if ((refused === "response_format" || refused === "unnamed") && sentFormat < FORMATS.length - 1) {
273
+ this.format = Math.max(this.format, sentFormat + 1);
274
+ return true;
275
+ }
276
+ if ((refused === "temperature" || refused === "unnamed") && sentTemperature) {
277
+ this.temperature = false;
278
+ return true;
279
+ }
280
+ return false;
281
+ }
282
+ estimateCost(usage) {
283
+ return costAt(this.options.prices, usage);
284
+ }
285
+ missingKey() {
286
+ const { apiKeyEnv } = this;
287
+ if (apiKeyEnv === null || readKey(this.options.env, apiKeyEnv) !== null) return null;
288
+ return this.keyMissing(apiKeyEnv);
289
+ }
290
+ withModel(next) {
291
+ return openaiCompatible({
292
+ ...this.options,
293
+ model: next
294
+ });
295
+ }
296
+ keyMissing(apiKeyEnv) {
297
+ return {
298
+ code: "ai-missing-key",
299
+ severity: "error",
300
+ message: `Set ${apiKeyEnv} to the API key of ${this.origin} to translate with ${this.model}`
301
+ };
302
+ }
303
+ };
262
304
  function requestBody(request, model, format, temperature) {
263
305
  const body = {
264
306
  model,
@@ -303,8 +345,8 @@ function readAnswer(json) {
303
345
  const result = { items: [] };
304
346
  const usage = field(json, "usage");
305
347
  if (usage !== void 0) result.usage = {
306
- inputTokens: count(field(usage, "prompt_tokens")),
307
- outputTokens: count(field(usage, "completion_tokens"))
348
+ inputTokens: tokenCount(field(usage, "prompt_tokens")),
349
+ outputTokens: tokenCount(field(usage, "completion_tokens"))
308
350
  };
309
351
  const choices = field(json, "choices");
310
352
  const content = field(field(Array.isArray(choices) ? choices[0] : void 0, "message"), "content");
@@ -342,5 +384,4 @@ function failureMessage(answer, label, key, apiKeyEnv, origin) {
342
384
  if ((answer.status === 401 || answer.status === 403) && apiKeyEnv === null) return `${base}; no key was sent: set apiKeyEnv to the variable holding the key of ${origin} (a key goes to a host other than OpenAI's only when apiKeyEnv names it)`;
343
385
  return base;
344
386
  }
345
- //#endregion
346
- export { answerItems as a, exchange as c, readKey as d, requestText as f, MAX_DELAY_MS as i, field as l, sleep as m, openaiCompatible as n, count as o, retryAfterDelay as p, openaiPreset as r, detail as s, PROVIDER_PRESETS as t, providerError as u };
387
+ export { tokenCount as _, answerItems as a, exchange as c, providerError as d, readKey as f, sleep as g, retryAfterDelay as h, MAX_DELAY_MS as i, field as l, requireKey as m, openaiCompatible as n, costAt as o, requestText as p, openaiPreset as r, detail as s, PROVIDER_PRESETS as t, parseBaseURL as u };
@@ -1,7 +1,14 @@
1
- import { t as VERSION } from "./version-Byqi2guX.js";
2
- import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
1
+ import { u as toPosix } from "./validate-zv4-IZyZ.js";
2
+ import "./library-BfSOBeBd.js";
3
+ import { t as VERSION } from "./version-BFs370Ce.js";
4
+ import { dirname, isAbsolute, join, relative, resolve } from "node:path";
3
5
  import { existsSync } from "node:fs";
4
- //#region src/cli/output.ts
6
+ // src/cli/errors.ts
7
+ /** How the CLI names a caught value in a message: an `Error`'s message, anything else as text. */
8
+ function errorMessage(error) {
9
+ return error instanceof Error ? error.message : String(error);
10
+ }
11
+ // src/cli/output.ts
5
12
  /**
6
13
  * Everything the CLI prints (INTERNALS §2.14): results on stdout, diagnostics
7
14
  * on stderr as `file:line:col severity code message`, GitHub workflow
@@ -32,13 +39,13 @@ function createOutput(io, format) {
32
39
  const absolute = (file) => isAbsolute(file) ? file : resolve(root, file);
33
40
  const display = (file) => {
34
41
  const rel = relative(io.cwd, absolute(file));
35
- return (rel === "" ? "." : rel).split(sep).join("/");
42
+ return toPosix(rel === "" ? "." : rel);
36
43
  };
37
44
  const repoPath = (file) => {
38
45
  if (gitRoot === void 0) gitRoot = findGitRoot(io.cwd);
39
46
  const abs = absolute(file);
40
47
  const rel = relative(gitRoot ?? io.cwd, abs);
41
- return (rel.startsWith("..") || isAbsolute(rel) ? abs : rel).split(sep).join("/");
48
+ return toPosix(rel.startsWith("..") || isAbsolute(rel) ? abs : rel);
42
49
  };
43
50
  const print = (diagnostic) => {
44
51
  if (format === "json") return;
@@ -145,8 +152,8 @@ function table(header, rows) {
145
152
  /** Posix path of `file` relative to `root` (absolute when outside it), as diagnostics store paths. */
146
153
  function rootRelative(root, file) {
147
154
  const rel = relative(root, file);
148
- if (rel === "" || rel.startsWith("..") || isAbsolute(rel)) return file.split(sep).join("/");
149
- return rel.split(sep).join("/");
155
+ if (rel === "" || rel.startsWith("..") || isAbsolute(rel)) return toPosix(file);
156
+ return toPosix(rel);
150
157
  }
151
158
  function countBySeverity(list) {
152
159
  const counts = {
@@ -160,5 +167,4 @@ function countBySeverity(list) {
160
167
  function plural(count, one, many = one + "s") {
161
168
  return `${count} ${count === 1 ? one : many}`;
162
169
  }
163
- //#endregion
164
- export { table as a, rootRelative as i, createOutput as n, plural as r, countBySeverity as t };
170
+ export { table as a, rootRelative as i, createOutput as n, errorMessage as o, plural as r, countBySeverity as t };
package/dist/parse.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { a as Message, b as Values, s as MessageRef } from "./types-DsdWBG0b.js";
2
- //#region src/parse/index.d.ts
1
+ import { a as Message, b as Values, s as MessageRef } from "./types-BaG1LboH.js";
3
2
  interface ParseOptions {
4
3
  /**
5
4
  * `"auto"` (default): ICU MessageFormat, or MessageFormat 2 when the text
@@ -58,5 +57,4 @@ export declare function format(message: string | ParsedMessage, values?: Values,
58
57
  * text and options while it is cached; returns the unsubscribe function.
59
58
  */
60
59
  export declare function onParseError(handler: (message: ParsedMessage) => void): () => void;
61
- //#endregion
62
60
  export type { ParseIssue, ParseOptions, ParsedMessage };
package/dist/parse.js CHANGED
@@ -1,8 +1,8 @@
1
- import { _ as DEV, b as trim, h as createScope, n as S, x as warnOnce } from "./dir-zw6bGMKQ.js";
2
- import { o as formatMessage, r as t } from "./t-DC-c9zE5.js";
3
- import { f as isDiagnosticError, i as normalizeSource, s as parseSource, t as compileMessage } from "./compile-Cc97JaW2.js";
4
- import { n as validateTranslation, t as validateSource } from "./validate-D6DJepZv.js";
5
- //#region src/parse/index.ts
1
+ import { f as isDiagnosticError, i as normalizeSource, s as parseSource, t as compileMessage } from "./compile-DqkofbiO.js";
2
+ import { n as validateTranslation, t as validateSource } from "./validate-PGgMsasz.js";
3
+ import { b as warnOnce, g as DEV, m as createScope, n as S, y as trim } from "./dir-TGLYuOZb.js";
4
+ import { o as formatMessage, r as t } from "./t-gvEXx25s.js";
5
+ // src/parse/index.ts
6
6
  /**
7
7
  * `@menapo/vi18n/parse` (PLAN §4.1, INTERNALS §3.6): messages that are not in
8
8
  * the code — a CMS, a database, a template an admin edits — parsed at
@@ -114,9 +114,9 @@ function build(text, syntax, sourceText, locale) {
114
114
  }
115
115
  }
116
116
  let ir;
117
- if (errors.length === 0) ir = compileMessage(ast);
117
+ if (ast !== null && errors.length === 0) ir = compileMessage(ast);
118
118
  else if (source !== null) ir = compileMessage(source);
119
- else ir = text.replace(/[‪-‮⁦-⁩]/g, "");
119
+ else ir = text.replace(/[\u202a-\u202e\u2066-\u2069]/g, "");
120
120
  return Object.freeze({
121
121
  id: "",
122
122
  message: text,
@@ -152,5 +152,4 @@ function report(parsed) {
152
152
  if (DEV) warnOnce(`onParseError handler threw: ${String(error)}`);
153
153
  }
154
154
  }
155
- //#endregion
156
155
  export { format, onParseError, parse };
@@ -1 +1 @@
1
- export { t as MAX_RETRIES, n as catalogPersister, r as createProvider, i as estimateUsage, a as firstRequests, o as planTranslations, s as replayProvider, c as runTranslations } from "./pipeline-C9Dbotkh.js";
1
+ export { t as MAX_RETRIES, n as catalogPersister, r as createProvider, i as estimateUsage, a as firstRequests, o as planTranslations, s as replayProvider, c as runTranslations } from "./pipeline-sgl_q_op.js";