@menapo/vi18n 0.1.1 → 0.2.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.
- package/README.md +19 -0
- package/dist/{apply-Bre-lY9J.js → apply-Bg-3rB2m.js} +69 -89
- package/dist/{captured-Bj8bO6vd.js → captured-DfLk50Ji.js} +196 -217
- package/dist/{check-BIKEuu6B.js → check-CunekuYs.js} +76 -85
- package/dist/cli.js +2 -3
- package/dist/{collect-Cx4_SKOe.js → collect-CYATDjdo.js} +1 -2
- package/dist/collisions-CDSdtLQm.js +215 -0
- package/dist/{compile-Cc97JaW2.js → compile-DqkofbiO.js} +376 -331
- package/dist/compile-hva0qjhZ.js +240 -0
- package/dist/concurrency-BCY_4zcr.js +1 -0
- package/dist/concurrency-Dy2ny50V.js +107 -0
- package/dist/config.d.ts +1 -5
- package/dist/config.js +4 -5
- package/dist/{types-D3QGM8XO.js → diagnostics-LgIWyeSp.js} +28 -27
- package/dist/{dir-zw6bGMKQ.js → dir-TGLYuOZb.js} +34 -37
- package/dist/{duplicates-yuRljQ6h.js → duplicates-8cudcHNj.js} +10 -27
- package/dist/engine-ecRD8-IE.js +556 -0
- package/dist/engine.d.ts +1 -5
- package/dist/engine.js +297 -168
- package/dist/exchange-DjwlrTQ9.js +41 -0
- package/dist/{exclude-Du-Zd_qI.js → exclude-BFETmvde.js} +2 -3
- package/dist/{export-C9Sy6UWv.js → export-D2tsqWIr.js} +17 -38
- package/dist/{extract-C3S8btx0.js → extract-BxYchVmY.js} +114 -82
- package/dist/{formats-9unqj_fZ.js → formats-BaryZ2N7.js} +352 -276
- package/dist/fs-ezCMZeDV.js +52 -0
- package/dist/i18next-COO6o0tX.js +1907 -0
- package/dist/i18next-Dr7DCQlQ.js +1 -0
- package/dist/{import-nANvQutw.js → import-vSC29Cn4.js} +81 -75
- package/dist/index.d.ts +1 -13
- package/dist/index.js +14 -16
- package/dist/{init-C2ScuW6a.js → init-Cc7A-8VX.js} +466 -501
- package/dist/{library-D5CWvTQs.js → library-tp_xqzSY.js} +975 -451
- package/dist/lingui-BnnlqGXT.js +902 -0
- package/dist/lint.d.ts +0 -4
- package/dist/lint.js +70 -82
- package/dist/{load-gW-oJt1Q.js → load-BSIeGJ5v.js} +275 -148
- package/dist/{load-CQRz4PpM.js → load-SSrAeJVB.js} +1214 -1116
- package/dist/{locales-DX4MOBFE.js → locales-D0U-yVRm.js} +271 -237
- package/dist/{lsp-RMMMc88P.js → lsp-DvC11pBZ.js} +4 -5
- package/dist/{match-BGr8EXB3.js → match-BLDcj610.js} +11 -4
- package/dist/{mcp-CHVwBoRP.js → mcp-D2zzOTBy.js} +4 -5
- package/dist/{merge-driver-BTX87aVm.js → merge-driver-BLI8OtAc.js} +138 -122
- package/dist/migrate-1r43OBfe.js +1 -0
- package/dist/migrate-ChDGhlC-.js +2169 -0
- package/dist/{openai-CTaMDcl-.js → openai-CLn4puY8.js} +128 -87
- package/dist/{output-DWE3SIUA.js → output-D5tAt8q4.js} +15 -9
- package/dist/parse.d.ts +1 -3
- package/dist/parse.js +7 -8
- package/dist/{pipeline-C9Dbotkh.js → pipeline-BJSkkRYC.js} +387 -359
- package/dist/{pipeline-DbX6rlo5.js → pipeline-BeCc441z.js} +1 -1
- package/dist/project-B5KIO0q-.js +544 -0
- package/dist/{pseudo-DRv30iN5.js → pseudo-B2DUpoLu.js} +126 -3
- package/dist/{raw-C4Y6vyGY.js → raw-YsYZMS9n.js} +52 -29
- package/dist/react-intl-C8JehBBL.js +634 -0
- package/dist/rename-ZVGq9ZG1.js +577 -0
- package/dist/repeated-uuI1tUGg.js +85 -0
- package/dist/restore-xlBIrtRt.js +199 -0
- package/dist/rewrite-BwzXoBiA.js +415 -0
- package/dist/{rich-DCUKl5HM.js → rich-ApY1Dm4S.js} +35 -28
- package/dist/rolldown-runtime-C1I3wEg2.js +43 -0
- package/dist/{rolldown-runtime-D7D4PA-g.js → rolldown-runtime-D8jQpDG7.js} +1 -2
- package/dist/run-CQ9pDLSa.js +674 -0
- package/dist/scan-worker.d.ts +2 -4
- package/dist/scan-worker.js +1 -1
- package/dist/{scoped-BMYpSthj.js → scoped-h3KE8XWW.js} +3 -4
- package/dist/{server-Da1Ot9IN.js → server-Br8tAuG2.js} +312 -386
- package/dist/{server-deBOq2vq.js → server-DJRpUQVZ.js} +1059 -333
- package/dist/server.d.ts +1 -17
- package/dist/server.js +419 -379
- package/dist/{sitemap-DJXzKoza.js → sitemap-CSAkm6oi.js} +21 -33
- package/dist/{sources-D19czDSA.js → sources-DNVbYsgs.js} +713 -373
- package/dist/{status-zr4jY59Y.js → status-q6M3rBrh.js} +30 -30
- package/dist/{stdio-FPOKQAgu.js → stdio-D9kTzyqB.js} +2 -4
- package/dist/{stdio-CVaJfxA7.js → stdio-FWIVU3P4.js} +1 -2
- package/dist/sync-BNIAwMhR.js +1352 -0
- package/dist/{t-DC-c9zE5.js → t-gvEXx25s.js} +76 -53
- package/dist/test.d.ts +5 -16
- package/dist/test.js +126 -56
- package/dist/translate-BP4iVhOR.js +336 -0
- package/dist/{ts-BaU5yOf0.js → ts-BX6kwig5.js} +25 -14
- package/dist/{types-DtvQ7UdD.js → types-3kwyaCAm.js} +1 -2
- package/dist/{types-DsdWBG0b.d.ts → types-B4wNX6PA.d.ts} +6 -8
- package/dist/{types-CgUCkFU1.d.ts → types-_4UdFhR9.d.ts} +24 -21
- package/dist/types-xR2exI3L.js +42 -0
- package/dist/{units-CQ5Q99RC.js → units-DPPfCN7j.js} +7 -16
- package/dist/{url-CRfCOhUI.js → url-Bpc6wLea.js} +24 -11
- package/dist/{url-CsBkRaJy.js → url-D2_VlEeH.js} +25 -12
- package/dist/{validate-BxpupdAf.js → validate-CgzaDdOY.js} +690 -377
- package/dist/{validate-D6DJepZv.js → validate-PGgMsasz.js} +3 -5
- package/dist/{version-Byqi2guX.js → version-DC-J5WvV.js} +3 -5
- package/dist/{vite-scan-CT_vsp4g.js → vite-scan-kM8Ta3rO.js} +87 -92
- package/dist/vite.d.ts +2 -6
- package/dist/vite.js +6500 -6032
- package/dist/vue-i18n-_uIXlFVh.js +806 -0
- package/dist/{which-BOemZ5Q8.js → which-DFWk_KwN.js} +44 -37
- package/dist/{worker-84U6uYB3.js → worker-zlhNj4y3.js} +454 -608
- package/package.json +5 -5
- package/dist/check-HsmmpJZg.js +0 -1
- package/dist/codec-DuvU2VQy.js +0 -207
- package/dist/collisions-CfpZU8e4.js +0 -217
- package/dist/compile-BaDh0cHG.js +0 -245
- package/dist/concurrency-C9UUWuDC.js +0 -96
- package/dist/concurrency-DONL7t4V.js +0 -1
- package/dist/engine-C2ENBRJe.js +0 -531
- package/dist/i18next-9HAoxwUI.js +0 -1
- package/dist/i18next-BEJgv_S8.js +0 -1596
- package/dist/lingui-zUiCl9Um.js +0 -833
- package/dist/messages-BfjIExyB.js +0 -166
- package/dist/migrate-IpLDMXmq.js +0 -1484
- package/dist/migrate-rCQuOGsf.js +0 -1
- package/dist/project-Bw9UPIdx.js +0 -1046
- package/dist/project-C4GpaN-n.js +0 -381
- package/dist/react-intl-BP0u-D5m.js +0 -519
- package/dist/restore-CiYv-jxS.js +0 -175
- package/dist/rewrite-EsIw_lsq.js +0 -803
- package/dist/run-BEcnBbu-.js +0 -694
- package/dist/runtime-DTMmliT1.js +0 -64
- package/dist/sync-B9V2KFwb.js +0 -658
- package/dist/translate-CQnJfLjO.js +0 -299
- package/dist/types-wSh9fCBY.js +0 -11
- package/dist/vue-i18n-g0iGy6CZ.js +0 -651
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { r as resolveDuplicates } from "./duplicates-8cudcHNj.js";
|
|
2
|
+
import { A as usableTranslation, E as entryKey, T as entryCanonical } from "./library-tp_xqzSY.js";
|
|
3
|
+
import { m as tryCanonicalize } from "./validate-CgzaDdOY.js";
|
|
4
|
+
// src/core/exchange/units.ts
|
|
5
5
|
/**
|
|
6
6
|
* Catalog exchange (PLAN §4.4, §5.19, INTERNALS §2.6.9): one format-neutral
|
|
7
7
|
* view of a locale's entries that every export format writes, and the
|
|
@@ -37,14 +37,6 @@ function sourceIndexOf(sourceCatalog, layout, codec) {
|
|
|
37
37
|
}
|
|
38
38
|
return index;
|
|
39
39
|
}
|
|
40
|
-
function canonicalOrNull(text, codec) {
|
|
41
|
-
try {
|
|
42
|
-
return codec.canonicalize(text);
|
|
43
|
-
} catch (error) {
|
|
44
|
-
if (isDiagnosticError(error)) return null;
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
40
|
/**
|
|
49
41
|
* The canonical source and label an entry's translation belongs to, or null
|
|
50
42
|
* when the catalog cannot say (an `"id"`-layout entry whose label no known
|
|
@@ -56,7 +48,7 @@ function entrySource(entry, key, context) {
|
|
|
56
48
|
if (entry.label === null) return null;
|
|
57
49
|
for (const text of [context.sourceIndex?.get(key) ?? null, entry.source]) {
|
|
58
50
|
if (text === null) continue;
|
|
59
|
-
const canonical =
|
|
51
|
+
const canonical = tryCanonicalize(codec, text);
|
|
60
52
|
if (canonical !== null && codec.label(canonical) === entry.label) return {
|
|
61
53
|
canonical,
|
|
62
54
|
label: entry.label
|
|
@@ -106,7 +98,7 @@ function exchangeUnits(input) {
|
|
|
106
98
|
manual,
|
|
107
99
|
canonical: source.canonical,
|
|
108
100
|
sourceHash: codec.sourceHash(source.canonical),
|
|
109
|
-
label:
|
|
101
|
+
label: source.label
|
|
110
102
|
}, codec, locale).ok;
|
|
111
103
|
units.push({
|
|
112
104
|
id: key,
|
|
@@ -146,5 +138,4 @@ function parseExchangeKey(raw) {
|
|
|
146
138
|
label: raw.slice(at + 1)
|
|
147
139
|
};
|
|
148
140
|
}
|
|
149
|
-
|
|
150
|
-
export { exchangeKey as a, sourceIndexOf as c, entrySource as i, EXTENSIONS as n, exchangeUnits as o, canonicalOrNull as r, parseExchangeKey as s, EXCHANGE_FORMATS as t };
|
|
141
|
+
export { exchangeUnits as a, exchangeKey as i, EXTENSIONS as n, parseExchangeKey as o, entrySource as r, sourceIndexOf as s, EXCHANGE_FORMATS as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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) =>
|
|
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,
|
|
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))
|
|
103
|
-
|
|
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
|
-
|
|
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) =>
|
|
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,
|
|
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))
|
|
103
|
-
|
|
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
|
-
|
|
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 };
|