i18next-cli 1.51.4 → 1.51.5

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/dist/cjs/cli.js CHANGED
@@ -31,7 +31,7 @@ const program = new commander.Command();
31
31
  program
32
32
  .name('i18next-cli')
33
33
  .description('A unified, high-performance i18next CLI.')
34
- .version('1.51.4'); // This string is replaced with the actual version at build time by rollup
34
+ .version('1.51.5'); // This string is replaced with the actual version at build time by rollup
35
35
  // new: global config override option
36
36
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
37
37
  program
@@ -149,8 +149,20 @@ class ExpressionResolver {
149
149
  return;
150
150
  }
151
151
  }
152
- // For other initializers, try to resolve to one-or-more strings
152
+ // For other initializers, try to resolve to one-or-more strings.
153
+ // Also check the type annotation: when the type resolves to a broader set
154
+ // (e.g. an enum type), prefer it over the single initializer value.
155
+ // Example: `const status: Status = Status.New` — the init resolves to ["new"]
156
+ // but the type annotation `Status` resolves to ["new", "active", "done"].
153
157
  const vals = this.resolvePossibleStringValuesFromExpression(init);
158
+ const typeAnnotation = this.extractTypeAnnotation(node.id);
159
+ if (typeAnnotation) {
160
+ const typeVals = this.resolvePossibleStringValuesFromType(typeAnnotation);
161
+ if (typeVals.length > vals.length) {
162
+ this.variableTable.set(name, typeVals);
163
+ return;
164
+ }
165
+ }
154
166
  if (vals.length > 0) {
155
167
  this.variableTable.set(name, vals);
156
168
  return;
package/dist/esm/cli.js CHANGED
@@ -29,7 +29,7 @@ const program = new Command();
29
29
  program
30
30
  .name('i18next-cli')
31
31
  .description('A unified, high-performance i18next CLI.')
32
- .version('1.51.4'); // This string is replaced with the actual version at build time by rollup
32
+ .version('1.51.5'); // This string is replaced with the actual version at build time by rollup
33
33
  // new: global config override option
34
34
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
35
35
  program
@@ -147,8 +147,20 @@ class ExpressionResolver {
147
147
  return;
148
148
  }
149
149
  }
150
- // For other initializers, try to resolve to one-or-more strings
150
+ // For other initializers, try to resolve to one-or-more strings.
151
+ // Also check the type annotation: when the type resolves to a broader set
152
+ // (e.g. an enum type), prefer it over the single initializer value.
153
+ // Example: `const status: Status = Status.New` — the init resolves to ["new"]
154
+ // but the type annotation `Status` resolves to ["new", "active", "done"].
151
155
  const vals = this.resolvePossibleStringValuesFromExpression(init);
156
+ const typeAnnotation = this.extractTypeAnnotation(node.id);
157
+ if (typeAnnotation) {
158
+ const typeVals = this.resolvePossibleStringValuesFromType(typeAnnotation);
159
+ if (typeVals.length > vals.length) {
160
+ this.variableTable.set(name, typeVals);
161
+ return;
162
+ }
163
+ }
152
164
  if (vals.length > 0) {
153
165
  this.variableTable.set(name, vals);
154
166
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-cli",
3
- "version": "1.51.4",
3
+ "version": "1.51.5",
4
4
  "description": "A unified, high-performance i18next CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -85,7 +85,7 @@
85
85
  "minimatch": "^10.2.4",
86
86
  "ora": "^9.3.0",
87
87
  "react": "^19.2.4",
88
- "react-i18next": "^17.0.0",
88
+ "react-i18next": "^17.0.1",
89
89
  "yaml": "^2.8.3"
90
90
  }
91
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"expression-resolver.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/expression-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAkD,MAAM,WAAW,CAAA;AAC3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAErD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,KAAK,CAAiB;IAK9B,OAAO,CAAC,aAAa,CAA4D;IAGjF,OAAO,CAAC,eAAe,CAAiD;IAIxE,OAAO,CAAC,cAAc,CAAmC;IAIzD,OAAO,CAAC,mBAAmB,CAAmC;IAI9D,OAAO,CAAC,oBAAoB,CAAmC;IAI/D,OAA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