@menapo/vi18n 0.0.0-stage → 0.1.1

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-BIKEuu6B.js +201 -0
  6. package/dist/check-HsmmpJZg.js +1 -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-BaDh0cHG.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-C2ENBRJe.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-C9Sy6UWv.js +103 -0
  25. package/dist/extract-C3S8btx0.js +298 -0
  26. package/dist/formats-9unqj_fZ.js +781 -0
  27. package/dist/i18next-9HAoxwUI.js +1 -0
  28. package/dist/i18next-BEJgv_S8.js +1596 -0
  29. package/dist/import-nANvQutw.js +225 -0
  30. package/dist/index.d.ts +156 -0
  31. package/dist/index.js +239 -0
  32. package/dist/init-C2ScuW6a.js +792 -0
  33. package/dist/library-D5CWvTQs.js +1882 -0
  34. package/dist/lingui-zUiCl9Um.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-RMMMc88P.js +31 -0
  41. package/dist/match-BGr8EXB3.js +89 -0
  42. package/dist/mcp-CHVwBoRP.js +28 -0
  43. package/dist/merge-driver-BTX87aVm.js +422 -0
  44. package/dist/messages-BfjIExyB.js +166 -0
  45. package/dist/migrate-IpLDMXmq.js +1484 -0
  46. package/dist/migrate-rCQuOGsf.js +1 -0
  47. package/dist/openai-CTaMDcl-.js +346 -0
  48. package/dist/output-DWE3SIUA.js +164 -0
  49. package/dist/parse.d.ts +62 -0
  50. package/dist/parse.js +156 -0
  51. package/dist/pipeline-C9Dbotkh.js +2031 -0
  52. package/dist/pipeline-DbX6rlo5.js +1 -0
  53. package/dist/project-Bw9UPIdx.js +1046 -0
  54. package/dist/project-C4GpaN-n.js +381 -0
  55. package/dist/pseudo-DRv30iN5.js +145 -0
  56. package/dist/raw-C4Y6vyGY.js +4708 -0
  57. package/dist/react-intl-BP0u-D5m.js +519 -0
  58. package/dist/restore-CiYv-jxS.js +175 -0
  59. package/dist/rewrite-EsIw_lsq.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-BEcnBbu-.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-Da1Ot9IN.js +10485 -0
  68. package/dist/server-deBOq2vq.js +11823 -0
  69. package/dist/server.d.ts +169 -0
  70. package/dist/server.js +1234 -0
  71. package/dist/sitemap-DJXzKoza.js +159 -0
  72. package/dist/sources-D19czDSA.js +2242 -0
  73. package/dist/status-zr4jY59Y.js +149 -0
  74. package/dist/stdio-CVaJfxA7.js +29 -0
  75. package/dist/stdio-FPOKQAgu.js +95 -0
  76. package/dist/sync-B9V2KFwb.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-CQnJfLjO.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-Byqi2guX.js +28 -0
  93. package/dist/vite-scan-CT_vsp4g.js +242 -0
  94. package/dist/vite.d.ts +34 -0
  95. package/dist/vite.js +7558 -0
  96. package/dist/vue-i18n-g0iGy6CZ.js +651 -0
  97. package/dist/which-BOemZ5Q8.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,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 };