@ultimat3/i18n 19.0.0 → 19.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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/extract.ts +6 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/i18n",
3
- "version": "19.0.0",
3
+ "version": "19.1.1",
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": "19.0.0"
38
+ "@ultimat3/core": "19.1.1"
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
- for (const match of source.matchAll(pattern)) {
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);