@menapo/vi18n 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/LICENSE +49 -0
  2. package/README.md +110 -2
  3. package/dist/apply-Bre-lY9J.js +228 -0
  4. package/dist/captured-Bj8bO6vd.js +1034 -0
  5. package/dist/check-D34P-S--.js +1 -0
  6. package/dist/check-DyrAbv73.js +201 -0
  7. package/dist/cli.d.ts +1 -0
  8. package/dist/cli.js +41 -0
  9. package/dist/codec-DuvU2VQy.js +207 -0
  10. package/dist/collect-Cx4_SKOe.js +13 -0
  11. package/dist/collisions-CfpZU8e4.js +217 -0
  12. package/dist/compile-B5Mz6WJm.js +245 -0
  13. package/dist/compile-Cc97JaW2.js +2502 -0
  14. package/dist/concurrency-C9UUWuDC.js +96 -0
  15. package/dist/concurrency-DONL7t4V.js +1 -0
  16. package/dist/config.d.ts +21 -0
  17. package/dist/config.js +39 -0
  18. package/dist/dir-zw6bGMKQ.js +290 -0
  19. package/dist/duplicates-yuRljQ6h.js +185 -0
  20. package/dist/engine-B7p40M__.js +531 -0
  21. package/dist/engine.d.ts +43 -0
  22. package/dist/engine.js +1241 -0
  23. package/dist/exclude-Du-Zd_qI.js +26 -0
  24. package/dist/export-DGsMbcTZ.js +103 -0
  25. package/dist/extract-Dujlsgnk.js +298 -0
  26. package/dist/formats-KPIg-08V.js +781 -0
  27. package/dist/i18next-CrUnKFfh.js +1596 -0
  28. package/dist/i18next-Rgo-v9l0.js +1 -0
  29. package/dist/import-Cwdhcywt.js +225 -0
  30. package/dist/index.d.ts +156 -0
  31. package/dist/index.js +239 -0
  32. package/dist/init-BecCTvKi.js +792 -0
  33. package/dist/library-D5CWvTQs.js +1882 -0
  34. package/dist/lingui--PcOOYry.js +833 -0
  35. package/dist/lint.d.ts +105 -0
  36. package/dist/lint.js +971 -0
  37. package/dist/load-CQRz4PpM.js +2950 -0
  38. package/dist/load-gW-oJt1Q.js +747 -0
  39. package/dist/locales-DX4MOBFE.js +827 -0
  40. package/dist/lsp-Cq1Nuu-Q.js +31 -0
  41. package/dist/match-BGr8EXB3.js +89 -0
  42. package/dist/mcp-Cf0T7qPW.js +28 -0
  43. package/dist/merge-driver-CpiiSVIc.js +422 -0
  44. package/dist/messages-Cxa-5tR0.js +166 -0
  45. package/dist/migrate-CntqvrW4.js +1 -0
  46. package/dist/migrate-dPgq9uzy.js +1484 -0
  47. package/dist/openai-CTaMDcl-.js +346 -0
  48. package/dist/output-DsaHKHEt.js +164 -0
  49. package/dist/parse.d.ts +62 -0
  50. package/dist/parse.js +156 -0
  51. package/dist/pipeline-C7g11THL.js +2031 -0
  52. package/dist/pipeline-wxS0SApG.js +1 -0
  53. package/dist/project-Dwx7iPm6.js +381 -0
  54. package/dist/project-pXipT8iG.js +1046 -0
  55. package/dist/pseudo-DRv30iN5.js +145 -0
  56. package/dist/raw-C4Y6vyGY.js +4708 -0
  57. package/dist/react-intl-CaBVwJ9u.js +519 -0
  58. package/dist/restore-Btq66Tid.js +175 -0
  59. package/dist/rewrite-CiTRAICl.js +803 -0
  60. package/dist/rich-DCUKl5HM.js +97 -0
  61. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  62. package/dist/run-DYD_VXKy.js +694 -0
  63. package/dist/runtime-DTMmliT1.js +64 -0
  64. package/dist/scan-worker.d.ts +62 -0
  65. package/dist/scan-worker.js +1 -0
  66. package/dist/scoped-BMYpSthj.js +44 -0
  67. package/dist/server-BDkykMjb.js +11823 -0
  68. package/dist/server-qv3mz70d.js +10485 -0
  69. package/dist/server.d.ts +169 -0
  70. package/dist/server.js +1234 -0
  71. package/dist/sitemap-DV3o8QD7.js +159 -0
  72. package/dist/sources-D19czDSA.js +2242 -0
  73. package/dist/status-DZArW5aE.js +149 -0
  74. package/dist/stdio-CVaJfxA7.js +29 -0
  75. package/dist/stdio-FPOKQAgu.js +95 -0
  76. package/dist/sync-CcVzger_.js +658 -0
  77. package/dist/t-DC-c9zE5.js +454 -0
  78. package/dist/test.d.ts +116 -0
  79. package/dist/test.js +319 -0
  80. package/dist/translate-DZR3MkSA.js +299 -0
  81. package/dist/ts-BaU5yOf0.js +4863 -0
  82. package/dist/types-CgUCkFU1.d.ts +707 -0
  83. package/dist/types-D3QGM8XO.js +146 -0
  84. package/dist/types-DsdWBG0b.d.ts +558 -0
  85. package/dist/types-DtvQ7UdD.js +1948 -0
  86. package/dist/types-wSh9fCBY.js +11 -0
  87. package/dist/units-CQ5Q99RC.js +150 -0
  88. package/dist/url-CRfCOhUI.js +172 -0
  89. package/dist/url-CsBkRaJy.js +225 -0
  90. package/dist/validate-BxpupdAf.js +2615 -0
  91. package/dist/validate-D6DJepZv.js +365 -0
  92. package/dist/version-BlyLGlOa.js +28 -0
  93. package/dist/vite-scan-B_YW4X_a.js +242 -0
  94. package/dist/vite.d.ts +34 -0
  95. package/dist/vite.js +7558 -0
  96. package/dist/vue-i18n-CEMnpv7k.js +651 -0
  97. package/dist/which-C6PFI1Dm.js +116 -0
  98. package/dist/worker-84U6uYB3.js +1656 -0
  99. package/package.json +97 -3
  100. package/schemas/catalog.json +57 -0
@@ -0,0 +1,97 @@
1
+ import { _ as DEV, n as S, x as warnOnce } from "./dir-zw6bGMKQ.js";
2
+ import { T as formatPart, a as caseOf, c as valueOf, i as argText, s as poundOf, t as lookup } from "./t-DC-c9zE5.js";
3
+ const ENTITIES = {
4
+ "&": "amp",
5
+ "<": "lt",
6
+ ">": "gt",
7
+ "\"": "quot",
8
+ "'": "#39"
9
+ };
10
+ /** A node with the framework's element key (`State.richKey`, set by React and Preact glue). */
11
+ const keyed = (node, key) => S.richKey?.(node, key) ?? node;
12
+ /**
13
+ * `rich` (nodes), `richParts` or `richHtml` (one string, or none) output for
14
+ * `key`. Without `scope` it renders in the active scope and subscribes the
15
+ * rendering computation; translators pass their own scope and never track.
16
+ */
17
+ function richIn(key, values, mode, scope) {
18
+ const s = scope ?? S.resolve();
19
+ const html = mode === 2;
20
+ const out = [];
21
+ /**
22
+ * Appends text, joining it to a preceding string so renderers get few
23
+ * nodes; in `richHtml` it is escaped first, as only handler output is trusted.
24
+ */
25
+ const text = (into, s, escape = html) => {
26
+ if (escape) s = s.replace(/[&<>"']/g, (c) => "&" + ENTITIES[c] + ";");
27
+ if (!s) return;
28
+ const last = into.length - 1;
29
+ if (typeof into[last] === "string") into[last] += s;
30
+ else into.push(s);
31
+ };
32
+ /**
33
+ * Walks `m` from index `from` (tags reuse their own array from index 2)
34
+ * into `into`. `n` is the `#` value of the innermost plural. Handler keys
35
+ * are part indexes (INTERNALS §3.1), so they never depend on argument
36
+ * values; in `rich`, parts that land in the parent's output from a nested
37
+ * list (a select or plural case, the children of a tag without handler)
38
+ * are offset by `k = (index + 1) * 1000` of their parent part, which keeps
39
+ * keys unique among the output siblings. `richHtml` output has no siblings
40
+ * to keep apart, so its handlers get the index in their own list.
41
+ */
42
+ const walk = (m, from, n, into, k) => {
43
+ if (typeof m === "string") return text(into, m);
44
+ for (let i = from; i < m.length; i++) {
45
+ const p = m[i];
46
+ if (typeof p === "string") text(into, p);
47
+ else if (p === 0) text(into, formatPart(4, void 0, n, s));
48
+ else {
49
+ const op = p[1];
50
+ const value = valueOf(values, p[0]);
51
+ const nested = (k + i + 1) * 1e3;
52
+ if (DEV && value == null && op !== 1 && !(op > 6)) warnOnce(`no value for {${p[0]}} in ${JSON.stringify(m)}`);
53
+ if (op > 6) {
54
+ const fn = typeof value === "function" ? value : S.tags?.[mode + p[0]];
55
+ if (fn || mode === 1) {
56
+ const children = [];
57
+ if (op === 7) walk(p, 2, n, children, 0);
58
+ if (mode === 1) into.push({
59
+ tag: p[0],
60
+ children
61
+ });
62
+ else if (html) text(into, "" + fn(children.join(""), i), false);
63
+ else into.push(keyed(fn(children, k + i), k + i));
64
+ } else {
65
+ if (DEV) warnOnce(`no handler for <${p[0]}> in ${html ? "richHtml" : "rich"}()`);
66
+ if (op === 7) walk(p, 2, n, into, nested);
67
+ }
68
+ } else if (op === void 0) {
69
+ if (!mode && value != null && !"stringnumberbigint".includes(typeof value) && !(value instanceof Date)) into.push(keyed(value, k + i));
70
+ else text(into, argText(value, s));
71
+ } else if (op < 4) {
72
+ const c = caseOf(p, value, s.locale);
73
+ if (c !== void 0) walk(c, 0, op === 1 ? n : poundOf(p, value), into, nested);
74
+ } else text(into, formatPart(op, p[2], value, s));
75
+ }
76
+ }
77
+ };
78
+ walk(lookup(s, key, !scope), 0, 0, out, 0);
79
+ return out;
80
+ }
81
+ /**
82
+ * Tag handlers come from `values` and receive `(children, key)`; React and
83
+ * Preact glue keys their results, and nodes passed as values, through
84
+ * `State.richKey`. A tag without a handler renders its children.
85
+ */
86
+ const rich = (message, values) => richIn(message, values, 0);
87
+ /**
88
+ * Escapes `& < > " '` in every text part and value; handlers get escaped
89
+ * children and only their output is trusted HTML.
90
+ */
91
+ const html = (message, values) => richIn(message, values, 2).join("");
92
+ const richHtml = html;
93
+ /** `string | { tag, children }` parts; arguments are stringified. */
94
+ const parts = (message, values) => richIn(message, values, 1);
95
+ const richParts = parts;
96
+ //#endregion
97
+ export { richParts as i, richHtml as n, richIn as r, rich as t };
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll as t };