@ultimat3/i18n 18.0.0 → 19.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/package.json +2 -2
- package/src/extract.ts +6 -1
- package/src/index.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/i18n",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.1.0",
|
|
4
4
|
"description": "Dependency-free translator, catalog flattening, locale negotiation and loud missing-key rendering",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -35,6 +35,6 @@
|
|
|
35
35
|
"test": "bun test"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ultimat3/core": "
|
|
38
|
+
"@ultimat3/core": "19.1.0"
|
|
39
39
|
}
|
|
40
40
|
}
|
package/src/extract.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* a translation gap is a build error, not a ticket.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { stripComments } from '@ultimat3/core';
|
|
7
8
|
import { type Catalog, catalogKeys } from './catalog';
|
|
8
9
|
import { catalogMissingKeys } from './errors';
|
|
9
10
|
import { PLURAL_CATEGORIES } from './interpolate';
|
|
@@ -72,7 +73,11 @@ export function extractKeys(
|
|
|
72
73
|
const usages: KeyUsage[] = [];
|
|
73
74
|
const dynamic: DynamicUsage[] = [];
|
|
74
75
|
|
|
75
|
-
|
|
76
|
+
// Over the COMMENT-STRIPPED text, never the raw file: a `// … t('…', { … })` in a comment matched
|
|
77
|
+
// the shape above and produced a phantom key that `x i18n sync` would have written into every
|
|
78
|
+
// catalog as `"…": "⟦…⟧"` (measured 2026-09-05). The mask keeps every newline and every string
|
|
79
|
+
// literal in place, so an index into it is an index into `source` and the positions below hold.
|
|
80
|
+
for (const match of stripComments(source).matchAll(pattern)) {
|
|
76
81
|
const argument = (match[1] ?? '').trim();
|
|
77
82
|
const index = match.index ?? 0;
|
|
78
83
|
const position = positionOf(source, index);
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
/** Public surface of @ultimat3/i18n. Explicit exports only. */
|
|
2
2
|
|
|
3
|
+
// Anchored on purpose, and NOT by the `sideEffects` array: Bun reads any array as `false` and drops
|
|
4
|
+
// the module regardless (oven-sh/bun#40650). `registerBaseCatalog` here fills the catalog `t()`
|
|
5
|
+
// falls back to, and `t()` never imports this module — so without the bare import every framework
|
|
6
|
+
// string renders as its ⟦key⟧ placeholder. `SIDE_EFFECTS_ANCHORS` carries the argument and
|
|
7
|
+
// `bun run side-effects` enforces it.
|
|
8
|
+
import './framework';
|
|
9
|
+
|
|
3
10
|
export {
|
|
4
11
|
type Catalog,
|
|
5
12
|
catalogKeys,
|