@menapo/vi18n 0.1.0 → 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 (119) hide show
  1. package/README.md +14 -14
  2. package/dist/{apply-Bre-lY9J.js → apply-FAHl1R6T.js} +69 -89
  3. package/dist/{captured-Bj8bO6vd.js → captured-CTjjDF5o.js} +196 -217
  4. package/dist/{check-DyrAbv73.js → check-DwFwOB1d.js} +66 -84
  5. package/dist/cli.js +2 -3
  6. package/dist/{collect-Cx4_SKOe.js → collect-CYATDjdo.js} +1 -2
  7. package/dist/collisions-uMTuq36M.js +215 -0
  8. package/dist/compile-CEvH-6sY.js +240 -0
  9. package/dist/{compile-Cc97JaW2.js → compile-DqkofbiO.js} +376 -331
  10. package/dist/concurrency-BCY_4zcr.js +1 -0
  11. package/dist/concurrency-Dy2ny50V.js +107 -0
  12. package/dist/config.d.ts +1 -5
  13. package/dist/config.js +4 -5
  14. package/dist/{types-D3QGM8XO.js → diagnostics-1onDF6Ua.js} +26 -26
  15. package/dist/{dir-zw6bGMKQ.js → dir-TGLYuOZb.js} +34 -37
  16. package/dist/{duplicates-yuRljQ6h.js → duplicates-CsUXRX2J.js} +10 -27
  17. package/dist/engine-Bf7nVigL.js +556 -0
  18. package/dist/engine.d.ts +1 -5
  19. package/dist/engine.js +297 -168
  20. package/dist/exchange-DYG9RZoT.js +41 -0
  21. package/dist/{exclude-Du-Zd_qI.js → exclude-vMnm3lqU.js} +2 -3
  22. package/dist/{export-DGsMbcTZ.js → export-BYq0gfLd.js} +17 -38
  23. package/dist/{extract-Dujlsgnk.js → extract-CYtuEo8u.js} +114 -82
  24. package/dist/{formats-KPIg-08V.js → formats-ChV1LVH_.js} +352 -276
  25. package/dist/fs-ezCMZeDV.js +52 -0
  26. package/dist/i18next-1waHziMy.js +1 -0
  27. package/dist/i18next-D66Icz3L.js +1907 -0
  28. package/dist/{import-Cwdhcywt.js → import-BApbQlmm.js} +81 -75
  29. package/dist/index.d.ts +1 -13
  30. package/dist/index.js +14 -16
  31. package/dist/{init-BecCTvKi.js → init-J7AwwA5e.js} +466 -501
  32. package/dist/{library-D5CWvTQs.js → library-BfSOBeBd.js} +975 -451
  33. package/dist/lingui-Ee2farVo.js +902 -0
  34. package/dist/lint.d.ts +0 -4
  35. package/dist/lint.js +69 -82
  36. package/dist/{load-gW-oJt1Q.js → load-BFLLqY8x.js} +272 -147
  37. package/dist/{load-CQRz4PpM.js → load-CMwhukZ4.js} +1211 -1115
  38. package/dist/{locales-DX4MOBFE.js → locales-DxLDrx-h.js} +271 -237
  39. package/dist/{lsp-Cq1Nuu-Q.js → lsp-BC7xDGON.js} +4 -5
  40. package/dist/{match-BGr8EXB3.js → match-BLDcj610.js} +11 -4
  41. package/dist/{mcp-Cf0T7qPW.js → mcp-Cka8ywDF.js} +4 -5
  42. package/dist/{merge-driver-CpiiSVIc.js → merge-driver-B04Apm29.js} +138 -122
  43. package/dist/migrate-D7TNl6SD.js +2169 -0
  44. package/dist/migrate-khCY8TE0.js +1 -0
  45. package/dist/{openai-CTaMDcl-.js → openai-RWw0YlAx.js} +128 -87
  46. package/dist/{output-DsaHKHEt.js → output-CF9uvk_-.js} +15 -9
  47. package/dist/parse.d.ts +1 -3
  48. package/dist/parse.js +7 -8
  49. package/dist/{pipeline-wxS0SApG.js → pipeline-B30irGMD.js} +1 -1
  50. package/dist/{pipeline-C7g11THL.js → pipeline-sgl_q_op.js} +387 -359
  51. package/dist/project-DSzWKU3C.js +544 -0
  52. package/dist/{pseudo-DRv30iN5.js → pseudo-DNbNNVGP.js} +125 -3
  53. package/dist/{raw-C4Y6vyGY.js → raw-YsYZMS9n.js} +52 -29
  54. package/dist/react-intl-tzGIk6G3.js +634 -0
  55. package/dist/restore-BG_zMpSj.js +199 -0
  56. package/dist/rewrite-hAcRJwiZ.js +415 -0
  57. package/dist/{rich-DCUKl5HM.js → rich-ApY1Dm4S.js} +35 -28
  58. package/dist/rolldown-runtime-C1I3wEg2.js +43 -0
  59. package/dist/{rolldown-runtime-D7D4PA-g.js → rolldown-runtime-D8jQpDG7.js} +1 -2
  60. package/dist/run-CFzR3V93.js +647 -0
  61. package/dist/scan-worker.d.ts +2 -4
  62. package/dist/scan-worker.js +1 -1
  63. package/dist/{scoped-BMYpSthj.js → scoped-h3KE8XWW.js} +3 -4
  64. package/dist/{server-BDkykMjb.js → server-WlxZH0oX.js} +275 -330
  65. package/dist/{server-qv3mz70d.js → server-ceuzzkal.js} +292 -386
  66. package/dist/server.d.ts +1 -17
  67. package/dist/server.js +415 -381
  68. package/dist/{sitemap-DV3o8QD7.js → sitemap-796jJKUT.js} +21 -33
  69. package/dist/{sources-D19czDSA.js → sources-DuOdM02f.js} +712 -373
  70. package/dist/{status-DZArW5aE.js → status-CTH3qI-0.js} +30 -30
  71. package/dist/{stdio-FPOKQAgu.js → stdio-D9kTzyqB.js} +2 -4
  72. package/dist/{stdio-CVaJfxA7.js → stdio-FWIVU3P4.js} +1 -2
  73. package/dist/sync-CpL0Qsgw.js +1352 -0
  74. package/dist/{t-DC-c9zE5.js → t-gvEXx25s.js} +76 -53
  75. package/dist/test.d.ts +5 -16
  76. package/dist/test.js +77 -48
  77. package/dist/translate-BrfVRkjl.js +336 -0
  78. package/dist/{ts-BaU5yOf0.js → ts-BX6kwig5.js} +25 -14
  79. package/dist/{types-DtvQ7UdD.js → types-3kwyaCAm.js} +1 -2
  80. package/dist/{types-DsdWBG0b.d.ts → types-BaG1LboH.d.ts} +2 -6
  81. package/dist/{types-CgUCkFU1.d.ts → types-Cy2bPdSg.d.ts} +14 -20
  82. package/dist/types-Ds_vebja.js +41 -0
  83. package/dist/{units-CQ5Q99RC.js → units-VVLgQ7x7.js} +7 -16
  84. package/dist/{url-CRfCOhUI.js → url-Bpc6wLea.js} +24 -11
  85. package/dist/{url-CsBkRaJy.js → url-D2_VlEeH.js} +25 -12
  86. package/dist/{validate-D6DJepZv.js → validate-PGgMsasz.js} +3 -5
  87. package/dist/{validate-BxpupdAf.js → validate-zv4-IZyZ.js} +690 -377
  88. package/dist/{version-BlyLGlOa.js → version-BFs370Ce.js} +3 -5
  89. package/dist/{vite-scan-B_YW4X_a.js → vite-scan-DFKSGVE9.js} +87 -92
  90. package/dist/vite.d.ts +2 -6
  91. package/dist/vite.js +6482 -6018
  92. package/dist/vue-i18n-CBmZqHbG.js +806 -0
  93. package/dist/{which-C6PFI1Dm.js → which-BpyJyBkX.js} +44 -37
  94. package/dist/{worker-84U6uYB3.js → worker-BjzVqJVO.js} +454 -608
  95. package/package.json +8 -8
  96. package/dist/check-D34P-S--.js +0 -1
  97. package/dist/codec-DuvU2VQy.js +0 -207
  98. package/dist/collisions-CfpZU8e4.js +0 -217
  99. package/dist/compile-B5Mz6WJm.js +0 -245
  100. package/dist/concurrency-C9UUWuDC.js +0 -96
  101. package/dist/concurrency-DONL7t4V.js +0 -1
  102. package/dist/engine-B7p40M__.js +0 -531
  103. package/dist/i18next-CrUnKFfh.js +0 -1596
  104. package/dist/i18next-Rgo-v9l0.js +0 -1
  105. package/dist/lingui--PcOOYry.js +0 -833
  106. package/dist/messages-Cxa-5tR0.js +0 -166
  107. package/dist/migrate-CntqvrW4.js +0 -1
  108. package/dist/migrate-dPgq9uzy.js +0 -1484
  109. package/dist/project-Dwx7iPm6.js +0 -381
  110. package/dist/project-pXipT8iG.js +0 -1046
  111. package/dist/react-intl-CaBVwJ9u.js +0 -519
  112. package/dist/restore-Btq66Tid.js +0 -175
  113. package/dist/rewrite-CiTRAICl.js +0 -803
  114. package/dist/run-DYD_VXKy.js +0 -694
  115. package/dist/runtime-DTMmliT1.js +0 -64
  116. package/dist/sync-CcVzger_.js +0 -658
  117. package/dist/translate-DZR3MkSA.js +0 -299
  118. package/dist/types-wSh9fCBY.js +0 -11
  119. package/dist/vue-i18n-CEMnpv7k.js +0 -651
@@ -1,4 +1,4 @@
1
- //#region src/runtime/url.ts
1
+ // src/runtime/url.ts
2
2
  /**
3
3
  * Whether localized paths and domains are compiled in (§6 D134). The plugin
4
4
  * defines `__VI18N_ROUTES__` false for a config with neither, which folds
@@ -13,7 +13,22 @@ const baseOf = (config) => {
13
13
  return b[0] === "/" ? b.replace(/\/?$/, "/") : "/";
14
14
  };
15
15
  /** The part of `pathname` after the base, or null when the pathname is outside it. */
16
- const rest = (pathname, base) => pathname.startsWith(base) ? pathname.slice(base.length) : pathname + "/" === base ? "" : null;
16
+ const rest = (pathname, base) => {
17
+ if (pathname.startsWith(base)) return pathname.slice(base.length);
18
+ return pathname + "/" === base ? "" : null;
19
+ };
20
+ /**
21
+ * The locale an unprefixed path belongs to: the host's on a listed host
22
+ * (§6 D135), else the source locale; none under `prefix` and `no_prefix`,
23
+ * where every locale is prefixed or none is.
24
+ */
25
+ const unprefixedLocale = (config) => {
26
+ const url = config.routing.url;
27
+ if (url === "prefix" || url === "no_prefix") return void 0;
28
+ return ROUTES && config.routing.home || config.sourceLocale;
29
+ };
30
+ /** `s` with every regular-expression metacharacter escaped. */
31
+ const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
17
32
  /**
18
33
  * Collapses leading slashes and backslashes to one `/`. Browsers read `//host`
19
34
  * and `/\host` as another origin, so a same-origin path such as
@@ -47,7 +62,7 @@ function splitLocalePath(pathname, config) {
47
62
  }
48
63
  if (ROUTES) return {
49
64
  locale: null,
50
- path: translate(pathname, unprefixed(config), config, 1)
65
+ path: translate(pathname, unprefixedLocale(config), config, 1)
51
66
  };
52
67
  return {
53
68
  locale: null,
@@ -99,8 +114,12 @@ function pathRule(from, to) {
99
114
  let source = "";
100
115
  let template = "";
101
116
  let n = 0;
102
- for (const s of segmentsOf(from)) source += s === "**" ? "((?:/[^/]+)*)" : s === "*" ? "/([^/]+)" : "/" + s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
103
- for (const s of segmentsOf(to)) template += s === "**" ? "$" + ++n : s === "*" ? "/$" + ++n : "/" + s.replace(/\$/g, "$$$$");
117
+ for (const s of segmentsOf(from)) if (s === "**") source += "((?:/[^/]+)*)";
118
+ else if (s === "*") source += "/([^/]+)";
119
+ else source += "/" + escapeRegExp(s);
120
+ for (const s of segmentsOf(to)) if (s === "**") template += "$" + ++n;
121
+ else if (s === "*") template += "/$" + ++n;
122
+ else template += "/" + s.replace(/\$/g, "$$$$");
104
123
  return [new RegExp("^" + source + "$"), template];
105
124
  }
106
125
  /**
@@ -124,11 +143,6 @@ function pathTable(paths) {
124
143
  return table;
125
144
  }
126
145
  const compiled = /* @__PURE__ */ new WeakMap();
127
- /** The locale of an unprefixed path: the host's, else the source locale; none under `prefix`. */
128
- const unprefixed = (config) => {
129
- const url = config.routing.url;
130
- return url === "prefix" || url === "no_prefix" ? void 0 : config.routing.home ?? config.sourceLocale;
131
- };
132
146
  /**
133
147
  * `path` (a pathname with base) in locale `l` (`back` 0: from a route path)
134
148
  * or back to its route path (`back` 1). A path outside the base, the root
@@ -168,5 +182,4 @@ const atHome = (config, home) => home === config.routing.home ? config : {
168
182
  home
169
183
  }
170
184
  };
171
- //#endregion
172
185
  export { pathTable as a, localizedPathsFor as i, localeOrigin as n, localizePath as r, atHome as t };
@@ -1,4 +1,4 @@
1
- //#region src/runtime/url.ts
1
+ // src/runtime/url.ts
2
2
  /**
3
3
  * Whether localized paths and domains are compiled in (§6 D134). The plugin
4
4
  * defines `__VI18N_ROUTES__` false for a config with neither, which folds
@@ -13,7 +13,22 @@ const baseOf = (config) => {
13
13
  return b[0] === "/" ? b.replace(/\/?$/, "/") : "/";
14
14
  };
15
15
  /** The part of `pathname` after the base, or null when the pathname is outside it. */
16
- const rest = (pathname, base) => pathname.startsWith(base) ? pathname.slice(base.length) : pathname + "/" === base ? "" : null;
16
+ const rest = (pathname, base) => {
17
+ if (pathname.startsWith(base)) return pathname.slice(base.length);
18
+ return pathname + "/" === base ? "" : null;
19
+ };
20
+ /**
21
+ * The locale an unprefixed path belongs to: the host's on a listed host
22
+ * (§6 D135), else the source locale; none under `prefix` and `no_prefix`,
23
+ * where every locale is prefixed or none is.
24
+ */
25
+ const unprefixedLocale = (config) => {
26
+ const url = config.routing.url;
27
+ if (url === "prefix" || url === "no_prefix") return void 0;
28
+ return ROUTES && config.routing.home || config.sourceLocale;
29
+ };
30
+ /** `s` with every regular-expression metacharacter escaped. */
31
+ const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
17
32
  /**
18
33
  * Collapses leading slashes and backslashes to one `/`. Browsers read `//host`
19
34
  * and `/\host` as another origin, so a same-origin path such as
@@ -47,7 +62,7 @@ function splitLocalePath(pathname, config) {
47
62
  }
48
63
  if (ROUTES) return {
49
64
  locale: null,
50
- path: translate(pathname, unprefixed(config), config, 1)
65
+ path: translate(pathname, unprefixedLocale(config), config, 1)
51
66
  };
52
67
  return {
53
68
  locale: null,
@@ -99,8 +114,12 @@ function pathRule(from, to) {
99
114
  let source = "";
100
115
  let template = "";
101
116
  let n = 0;
102
- for (const s of segmentsOf(from)) source += s === "**" ? "((?:/[^/]+)*)" : s === "*" ? "/([^/]+)" : "/" + s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
103
- for (const s of segmentsOf(to)) template += s === "**" ? "$" + ++n : s === "*" ? "/$" + ++n : "/" + s.replace(/\$/g, "$$$$");
117
+ for (const s of segmentsOf(from)) if (s === "**") source += "((?:/[^/]+)*)";
118
+ else if (s === "*") source += "/([^/]+)";
119
+ else source += "/" + escapeRegExp(s);
120
+ for (const s of segmentsOf(to)) if (s === "**") template += "$" + ++n;
121
+ else if (s === "*") template += "/$" + ++n;
122
+ else template += "/" + s.replace(/\$/g, "$$$$");
104
123
  return [new RegExp("^" + source + "$"), template];
105
124
  }
106
125
  /**
@@ -124,11 +143,6 @@ function pathTable(paths) {
124
143
  return table;
125
144
  }
126
145
  const compiled = /* @__PURE__ */ new WeakMap();
127
- /** The locale of an unprefixed path: the host's, else the source locale; none under `prefix`. */
128
- const unprefixed = (config) => {
129
- const url = config.routing.url;
130
- return url === "prefix" || url === "no_prefix" ? void 0 : config.routing.home ?? config.sourceLocale;
131
- };
132
146
  /**
133
147
  * `path` (a pathname with base) in locale `l` (`back` 0: from a route path)
134
148
  * or back to its route path (`back` 1). A path outside the base, the root
@@ -221,5 +235,4 @@ function matchRoute(patterns, path) {
221
235
  }
222
236
  return null;
223
237
  }
224
- //#endregion
225
- export { hostLocale as a, localizedPathsFor as c, splitLocalePath as d, awayHref as i, matchRoute as l, atHome as n, localeOrigin as o, atHost as r, localizePath as s, ROUTES as t, routePath as u };
238
+ export { baseOf as a, localeOrigin as c, matchRoute as d, routePath as f, awayHref as i, localizePath as l, unprefixedLocale as m, atHome as n, escapeRegExp as o, splitLocalePath as p, atHost as r, hostLocale as s, ROUTES as t, localizedPathsFor as u };
@@ -1,5 +1,5 @@
1
- import { d as diagnosticError, f as isDiagnosticError, i as normalizeSource, l as positionAt, o as isMF2Form, u as quoteStarts } from "./compile-Cc97JaW2.js";
2
- //#region src/core/icu/structure.ts
1
+ import { d as diagnosticError, f as isDiagnosticError, i as normalizeSource, l as positionAt, o as isMF2Form, u as quoteStarts } from "./compile-DqkofbiO.js";
2
+ // src/core/icu/structure.ts
3
3
  /**
4
4
  * What a translation must keep from its source (INTERNALS §2.1.2).
5
5
  *
@@ -79,8 +79,7 @@ function use(name, kind, inPlural, structure, required) {
79
79
  function describe(kind) {
80
80
  return kind === "argument" ? "a plain argument" : `{…, ${kind}}`;
81
81
  }
82
- //#endregion
83
- //#region src/core/icu/validate.ts
82
+ // src/core/icu/validate.ts
84
83
  /**
85
84
  * Message validation (INTERNALS §2.1.3, PLAN §5.4), run at extract, compile,
86
85
  * AI post-check and CI. Parse errors are thrown by the parser; everything
@@ -361,5 +360,4 @@ function positionOf(text, char) {
361
360
  function hex(code) {
362
361
  return code.toString(16).toUpperCase().padStart(4, "0");
363
362
  }
364
- //#endregion
365
363
  export { validateTranslation as n, validateSource as t };