@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.
- package/LICENSE +49 -0
- package/README.md +110 -2
- package/dist/apply-Bre-lY9J.js +228 -0
- package/dist/captured-Bj8bO6vd.js +1034 -0
- package/dist/check-D34P-S--.js +1 -0
- package/dist/check-DyrAbv73.js +201 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +41 -0
- package/dist/codec-DuvU2VQy.js +207 -0
- package/dist/collect-Cx4_SKOe.js +13 -0
- package/dist/collisions-CfpZU8e4.js +217 -0
- package/dist/compile-B5Mz6WJm.js +245 -0
- package/dist/compile-Cc97JaW2.js +2502 -0
- package/dist/concurrency-C9UUWuDC.js +96 -0
- package/dist/concurrency-DONL7t4V.js +1 -0
- package/dist/config.d.ts +21 -0
- package/dist/config.js +39 -0
- package/dist/dir-zw6bGMKQ.js +290 -0
- package/dist/duplicates-yuRljQ6h.js +185 -0
- package/dist/engine-B7p40M__.js +531 -0
- package/dist/engine.d.ts +43 -0
- package/dist/engine.js +1241 -0
- package/dist/exclude-Du-Zd_qI.js +26 -0
- package/dist/export-DGsMbcTZ.js +103 -0
- package/dist/extract-Dujlsgnk.js +298 -0
- package/dist/formats-KPIg-08V.js +781 -0
- package/dist/i18next-CrUnKFfh.js +1596 -0
- package/dist/i18next-Rgo-v9l0.js +1 -0
- package/dist/import-Cwdhcywt.js +225 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.js +239 -0
- package/dist/init-BecCTvKi.js +792 -0
- package/dist/library-D5CWvTQs.js +1882 -0
- package/dist/lingui--PcOOYry.js +833 -0
- package/dist/lint.d.ts +105 -0
- package/dist/lint.js +971 -0
- package/dist/load-CQRz4PpM.js +2950 -0
- package/dist/load-gW-oJt1Q.js +747 -0
- package/dist/locales-DX4MOBFE.js +827 -0
- package/dist/lsp-Cq1Nuu-Q.js +31 -0
- package/dist/match-BGr8EXB3.js +89 -0
- package/dist/mcp-Cf0T7qPW.js +28 -0
- package/dist/merge-driver-CpiiSVIc.js +422 -0
- package/dist/messages-Cxa-5tR0.js +166 -0
- package/dist/migrate-CntqvrW4.js +1 -0
- package/dist/migrate-dPgq9uzy.js +1484 -0
- package/dist/openai-CTaMDcl-.js +346 -0
- package/dist/output-DsaHKHEt.js +164 -0
- package/dist/parse.d.ts +62 -0
- package/dist/parse.js +156 -0
- package/dist/pipeline-C7g11THL.js +2031 -0
- package/dist/pipeline-wxS0SApG.js +1 -0
- package/dist/project-Dwx7iPm6.js +381 -0
- package/dist/project-pXipT8iG.js +1046 -0
- package/dist/pseudo-DRv30iN5.js +145 -0
- package/dist/raw-C4Y6vyGY.js +4708 -0
- package/dist/react-intl-CaBVwJ9u.js +519 -0
- package/dist/restore-Btq66Tid.js +175 -0
- package/dist/rewrite-CiTRAICl.js +803 -0
- package/dist/rich-DCUKl5HM.js +97 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/run-DYD_VXKy.js +694 -0
- package/dist/runtime-DTMmliT1.js +64 -0
- package/dist/scan-worker.d.ts +62 -0
- package/dist/scan-worker.js +1 -0
- package/dist/scoped-BMYpSthj.js +44 -0
- package/dist/server-BDkykMjb.js +11823 -0
- package/dist/server-qv3mz70d.js +10485 -0
- package/dist/server.d.ts +169 -0
- package/dist/server.js +1234 -0
- package/dist/sitemap-DV3o8QD7.js +159 -0
- package/dist/sources-D19czDSA.js +2242 -0
- package/dist/status-DZArW5aE.js +149 -0
- package/dist/stdio-CVaJfxA7.js +29 -0
- package/dist/stdio-FPOKQAgu.js +95 -0
- package/dist/sync-CcVzger_.js +658 -0
- package/dist/t-DC-c9zE5.js +454 -0
- package/dist/test.d.ts +116 -0
- package/dist/test.js +319 -0
- package/dist/translate-DZR3MkSA.js +299 -0
- package/dist/ts-BaU5yOf0.js +4863 -0
- package/dist/types-CgUCkFU1.d.ts +707 -0
- package/dist/types-D3QGM8XO.js +146 -0
- package/dist/types-DsdWBG0b.d.ts +558 -0
- package/dist/types-DtvQ7UdD.js +1948 -0
- package/dist/types-wSh9fCBY.js +11 -0
- package/dist/units-CQ5Q99RC.js +150 -0
- package/dist/url-CRfCOhUI.js +172 -0
- package/dist/url-CsBkRaJy.js +225 -0
- package/dist/validate-BxpupdAf.js +2615 -0
- package/dist/validate-D6DJepZv.js +365 -0
- package/dist/version-BlyLGlOa.js +28 -0
- package/dist/vite-scan-B_YW4X_a.js +242 -0
- package/dist/vite.d.ts +34 -0
- package/dist/vite.js +7558 -0
- package/dist/vue-i18n-CEMnpv7k.js +651 -0
- package/dist/which-C6PFI1Dm.js +116 -0
- package/dist/worker-84U6uYB3.js +1656 -0
- package/package.json +97 -3
- package/schemas/catalog.json +57 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
//#region src/core/diagnostics.ts
|
|
2
|
+
/**
|
|
3
|
+
* The only way core code creates a throwable diagnostic, so every error that
|
|
4
|
+
* crosses a module boundary can be reported without knowing who threw it.
|
|
5
|
+
*/
|
|
6
|
+
function diagnosticError(diagnostic) {
|
|
7
|
+
const error = new Error(diagnostic.message);
|
|
8
|
+
error.name = "DiagnosticError";
|
|
9
|
+
error.diagnostic = diagnostic;
|
|
10
|
+
return error;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Recognises a {@link DiagnosticError} by shape rather than by class: errors
|
|
14
|
+
* thrown in a `vm` context or another bundled copy of vi18n fail `instanceof`,
|
|
15
|
+
* while `Object.prototype.toString` sees the internal error slot in any realm.
|
|
16
|
+
*/
|
|
17
|
+
function isDiagnosticError(error) {
|
|
18
|
+
if (typeof error !== "object" || error === null) return false;
|
|
19
|
+
if (!(error instanceof Error) && Object.prototype.toString.call(error) !== "[object Error]") return false;
|
|
20
|
+
const diagnostic = error.diagnostic;
|
|
21
|
+
return typeof diagnostic === "object" && diagnostic !== null && typeof diagnostic.code === "string";
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/config/types.ts
|
|
25
|
+
/** The only config file name (revision 4.2). */
|
|
26
|
+
const CONFIG_FILE = "vi18n.config.ts";
|
|
27
|
+
/** Import sources that always apply; `extraction.importSources` is appended to them. */
|
|
28
|
+
const DEFAULT_IMPORT_SOURCES = ["@menapo/vi18n", "@menapo/vi18n/server"];
|
|
29
|
+
/** Valid range of `ids.length`. */
|
|
30
|
+
const ID_LENGTH = {
|
|
31
|
+
min: 8,
|
|
32
|
+
max: 16,
|
|
33
|
+
default: 12
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Defaults (PLAN §5.7). Relative paths here are resolved against the config
|
|
37
|
+
* directory; `catalogs.path` becomes `locales/{locale}.json` when only
|
|
38
|
+
* `format: "json"` is given.
|
|
39
|
+
*/
|
|
40
|
+
const DEFAULT_CONFIG = {
|
|
41
|
+
sourceLocale: "en",
|
|
42
|
+
locales: ["en"],
|
|
43
|
+
pseudoLocales: [],
|
|
44
|
+
fallbacks: {},
|
|
45
|
+
project: {
|
|
46
|
+
include: ["src"],
|
|
47
|
+
extensions: [
|
|
48
|
+
".js",
|
|
49
|
+
".jsx",
|
|
50
|
+
".mjs",
|
|
51
|
+
".ts",
|
|
52
|
+
".tsx",
|
|
53
|
+
".mts",
|
|
54
|
+
".svelte",
|
|
55
|
+
".vue",
|
|
56
|
+
".astro",
|
|
57
|
+
".mdx"
|
|
58
|
+
],
|
|
59
|
+
exclude: [
|
|
60
|
+
"node_modules",
|
|
61
|
+
"/dist",
|
|
62
|
+
"/build",
|
|
63
|
+
"**/*.test.*",
|
|
64
|
+
"**/*.spec.*",
|
|
65
|
+
"**/__tests__/**"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
extraction: {
|
|
69
|
+
importSources: [...DEFAULT_IMPORT_SOURCES],
|
|
70
|
+
aliases: [],
|
|
71
|
+
globals: [],
|
|
72
|
+
keep: [],
|
|
73
|
+
dependencies: []
|
|
74
|
+
},
|
|
75
|
+
ids: { length: ID_LENGTH.default },
|
|
76
|
+
catalogs: {
|
|
77
|
+
format: "po",
|
|
78
|
+
path: "locales/{locale}.po",
|
|
79
|
+
msgid: "source",
|
|
80
|
+
icuFlag: false
|
|
81
|
+
},
|
|
82
|
+
output: {
|
|
83
|
+
split: {
|
|
84
|
+
shared: "per-set",
|
|
85
|
+
dupBelow: 1024,
|
|
86
|
+
minBytes: 1024,
|
|
87
|
+
maxBundlesPerRoot: null
|
|
88
|
+
},
|
|
89
|
+
guard: "auto",
|
|
90
|
+
manifestPath: "vi18n/{locale}/manifest.json",
|
|
91
|
+
manifest: "data",
|
|
92
|
+
baseEntries: [],
|
|
93
|
+
compactIds: false,
|
|
94
|
+
perLocale: false
|
|
95
|
+
},
|
|
96
|
+
routing: {
|
|
97
|
+
strategy: [
|
|
98
|
+
"url",
|
|
99
|
+
"cookie",
|
|
100
|
+
"header",
|
|
101
|
+
"default"
|
|
102
|
+
],
|
|
103
|
+
routeStrategies: {},
|
|
104
|
+
url: "prefix_except_default",
|
|
105
|
+
redirectRoot: false,
|
|
106
|
+
propagate: "header",
|
|
107
|
+
switch: "in-place",
|
|
108
|
+
cookie: {
|
|
109
|
+
name: "vi18n_locale",
|
|
110
|
+
maxAge: 31536e3
|
|
111
|
+
},
|
|
112
|
+
base: null,
|
|
113
|
+
paths: {},
|
|
114
|
+
domains: {}
|
|
115
|
+
},
|
|
116
|
+
ssr: {
|
|
117
|
+
timeZone: "UTC",
|
|
118
|
+
timeZoneFrom: {},
|
|
119
|
+
payload: "bundles",
|
|
120
|
+
catalogs: "auto",
|
|
121
|
+
maxLoadedLocales: 8,
|
|
122
|
+
normalizeSpaces: true
|
|
123
|
+
},
|
|
124
|
+
ai: {
|
|
125
|
+
provider: "gemini",
|
|
126
|
+
model: "gemini-3.8-flash",
|
|
127
|
+
exclude: [],
|
|
128
|
+
glossary: {},
|
|
129
|
+
doNotTranslate: [],
|
|
130
|
+
tone: {},
|
|
131
|
+
description: null,
|
|
132
|
+
apiKeyEnv: "GEMINI_API_KEY",
|
|
133
|
+
batchSize: 60,
|
|
134
|
+
concurrency: 4,
|
|
135
|
+
dev: false
|
|
136
|
+
},
|
|
137
|
+
defaults: { tags: {} },
|
|
138
|
+
devtools: false,
|
|
139
|
+
strict: {
|
|
140
|
+
missing: "warn",
|
|
141
|
+
invalid: "error",
|
|
142
|
+
moduleScope: "warn"
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
//#endregion
|
|
146
|
+
export { diagnosticError as a, ID_LENGTH as i, DEFAULT_CONFIG as n, isDiagnosticError as o, DEFAULT_IMPORT_SOURCES as r, CONFIG_FILE as t };
|