i18next-cli 1.73.1 → 1.73.3

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
@@ -37,7 +37,7 @@ const program = new commander.Command();
37
37
  program
38
38
  .name('i18next-cli')
39
39
  .description('A unified, high-performance i18next CLI.')
40
- .version('1.73.1') // This string is replaced with the actual version at build time by rollup
40
+ .version('1.73.3') // This string is replaced with the actual version at build time by rollup
41
41
  .addHelpText('after', '\nUsing an AI coding agent? Install the i18next-localization skill: npx skills add i18next/i18next-cli\n');
42
42
  // new: global config override option
43
43
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
@@ -345,29 +345,26 @@ function isSimpleTemplateLiteral(literal) {
345
345
  * @param object - Object expression to search
346
346
  * @param propName - Property name to find
347
347
  * @param identifierResolver - callback to resolve Identifier type values when needed
348
+ * @param expressionResolver - callback to statically resolve any other non-literal value (e.g. `STRINGS.key`); '' is kept when it returns undefined
348
349
  * @returns String value if found, empty string if property exists but isn't a string, undefined if not found
349
350
  *
350
351
  * @private
351
352
  */
352
- function getObjectPropValue(object, propName, identifierResolver) {
353
+ function getObjectPropValue(object, propName, identifierResolver, expressionResolver) {
353
354
  const prop = getObjectProperty(object, propName);
354
355
  if (prop?.type === 'KeyValueProperty') {
355
356
  const val = prop.value;
356
357
  if (val.type === 'StringLiteral')
357
358
  return val.value;
358
- if (val.type === 'Identifier') {
359
- if (identifierResolver) {
360
- return identifierResolver(val.value);
361
- }
362
- return '';
363
- }
359
+ if (val.type === 'Identifier' && identifierResolver)
360
+ return identifierResolver(val.value);
364
361
  if (val.type === 'TemplateLiteral' && isSimpleTemplateLiteral(val))
365
362
  return val.quasis[0].cooked;
366
363
  if (val.type === 'BooleanLiteral')
367
364
  return val.value;
368
365
  if (val.type === 'NumericLiteral')
369
366
  return val.value;
370
- return ''; // Indicate presence for other types
367
+ return expressionResolver?.(val) ?? ''; // Indicate presence for other types
371
368
  }
372
369
  return undefined;
373
370
  }
@@ -29,6 +29,18 @@ class CallExpressionHandler {
29
29
  this.getCurrentCode = getCurrentCode;
30
30
  this.resolveIdentifier = resolveIdentifier;
31
31
  }
32
+ /**
33
+ * Statically resolves a non-literal default value such as `STRINGS.key`, `DEFAULT_TEXT`
34
+ * or `` `Hi ${NAME}` `` (#293). Ambiguous expressions (ternaries, unions) yield undefined.
35
+ */
36
+ resolveDefaultValue = (expr) => {
37
+ const values = this.expressionResolver.resolvePossibleKeyStringValues(expr);
38
+ return values.length === 1 ? values[0] : undefined;
39
+ };
40
+ /** `getObjectPropValue` for `defaultValue*` props, so `{ defaultValue: STRINGS.key }` resolves too. */
41
+ getDefaultValueProp(options, propName) {
42
+ return astUtils.getObjectPropValue(options, propName, undefined, this.resolveDefaultValue);
43
+ }
32
44
  /**
33
45
  * Computes line and column from a node's normalised span.
34
46
  * For call / new expressions the location points to the first argument
@@ -125,6 +137,9 @@ class CallExpressionHandler {
125
137
  else if (arg2.type === 'TemplateLiteral' && astUtils.isSimpleTemplateLiteral(arg2)) {
126
138
  defaultValue = arg2.quasis[0].cooked;
127
139
  }
140
+ else {
141
+ defaultValue = this.resolveDefaultValue(arg2);
142
+ }
128
143
  }
129
144
  if (node.arguments.length > 2) {
130
145
  const arg3 = node.arguments[2].expression;
@@ -132,7 +147,7 @@ class CallExpressionHandler {
132
147
  options = arg3;
133
148
  }
134
149
  }
135
- const defaultValueFromOptions = options ? astUtils.getObjectPropValue(options, 'defaultValue') : undefined;
150
+ const defaultValueFromOptions = options ? this.getDefaultValueProp(options, 'defaultValue') : undefined;
136
151
  const finalDefaultValue = (typeof defaultValueFromOptions === 'string' ? defaultValueFromOptions : defaultValue);
137
152
  // Helper: detect if options object contains any defaultValue* properties
138
153
  const optionsHasDefaultProps = (opts) => {
@@ -809,15 +824,15 @@ class CallExpressionHandler {
809
824
  // When defaultValue_zero is present in the options, include 'zero' in the
810
825
  // categories so that key_zero is generated with the correct default value.
811
826
  // See: https://www.i18next.com/translation-function/plurals#special-zero
812
- const zeroDefault = astUtils.getObjectPropValue(options, `defaultValue${pluralSeparator}zero`);
827
+ const zeroDefault = this.getDefaultValueProp(options, `defaultValue${pluralSeparator}zero`);
813
828
  if (typeof zeroDefault === 'string' && !allPluralCategories.has('zero')) {
814
829
  allPluralCategories.add('zero');
815
830
  }
816
831
  const pluralCategories = Array.from(allPluralCategories).sort();
817
832
  // Get all possible default values once at the start
818
- const defaultValue = astUtils.getObjectPropValue(options, 'defaultValue');
819
- const otherDefault = astUtils.getObjectPropValue(options, `defaultValue${pluralSeparator}other`);
820
- const ordinalOtherDefault = astUtils.getObjectPropValue(options, `defaultValue${pluralSeparator}ordinal${pluralSeparator}other`);
833
+ const defaultValue = this.getDefaultValueProp(options, 'defaultValue');
834
+ const otherDefault = this.getDefaultValueProp(options, `defaultValue${pluralSeparator}other`);
835
+ const ordinalOtherDefault = this.getDefaultValueProp(options, `defaultValue${pluralSeparator}ordinal${pluralSeparator}other`);
821
836
  // Handle context - both static and dynamic
822
837
  const contextPropValue = astUtils.getObjectPropValueExpression(options, 'context');
823
838
  const keysToGenerate = [];
@@ -875,7 +890,7 @@ class CallExpressionHandler {
875
890
  }
876
891
  if (primaryIsSingleOther || (pluralCategories.length === 1 && pluralCategories[0] === 'other')) {
877
892
  for (const { key: baseKey, context } of keysToGenerate) {
878
- const specificOther = astUtils.getObjectPropValue(options, `defaultValue${pluralSeparator}other`);
893
+ const specificOther = this.getDefaultValueProp(options, `defaultValue${pluralSeparator}other`);
879
894
  // Final default resolution:
880
895
  // 1) plural-specific defaultValue_other
881
896
  // 2) general defaultValue (from options)
@@ -913,7 +928,7 @@ class CallExpressionHandler {
913
928
  for (const category of pluralCategories) {
914
929
  // 1. Look for the most specific default value
915
930
  const specificDefaultKey = isOrdinal ? `defaultValue${pluralSeparator}ordinal${pluralSeparator}${category}` : `defaultValue${pluralSeparator}${category}`;
916
- const specificDefault = astUtils.getObjectPropValue(options, specificDefaultKey);
931
+ const specificDefault = this.getDefaultValueProp(options, specificDefaultKey);
917
932
  // 2. Determine the final default value using the ORIGINAL fallback chain with corrections
918
933
  let finalDefaultValue;
919
934
  if (typeof specificDefault === 'string') {
@@ -982,7 +997,7 @@ class CallExpressionHandler {
982
997
  catch (e) {
983
998
  this.logger.warn(`Could not determine plural rules for language "${this.config.extract?.primaryLanguage}". Falling back to simple key extraction.`);
984
999
  // Fallback to a simple key if Intl API fails
985
- const defaultValue = defaultValueFromCall || astUtils.getObjectPropValue(options, 'defaultValue');
1000
+ const defaultValue = defaultValueFromCall || this.getDefaultValueProp(options, 'defaultValue');
986
1001
  this.pluginContext.addKey({ key, ns, defaultValue: typeof defaultValue === 'string' ? defaultValue : key, locations });
987
1002
  }
988
1003
  }
package/dist/esm/cli.js CHANGED
@@ -31,7 +31,7 @@ const program = new Command();
31
31
  program
32
32
  .name('i18next-cli')
33
33
  .description('A unified, high-performance i18next CLI.')
34
- .version('1.73.1') // This string is replaced with the actual version at build time by rollup
34
+ .version('1.73.3') // This string is replaced with the actual version at build time by rollup
35
35
  .addHelpText('after', '\nUsing an AI coding agent? Install the i18next-localization skill: npx skills add i18next/i18next-cli\n');
36
36
  // new: global config override option
37
37
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
@@ -343,29 +343,26 @@ function isSimpleTemplateLiteral(literal) {
343
343
  * @param object - Object expression to search
344
344
  * @param propName - Property name to find
345
345
  * @param identifierResolver - callback to resolve Identifier type values when needed
346
+ * @param expressionResolver - callback to statically resolve any other non-literal value (e.g. `STRINGS.key`); '' is kept when it returns undefined
346
347
  * @returns String value if found, empty string if property exists but isn't a string, undefined if not found
347
348
  *
348
349
  * @private
349
350
  */
350
- function getObjectPropValue(object, propName, identifierResolver) {
351
+ function getObjectPropValue(object, propName, identifierResolver, expressionResolver) {
351
352
  const prop = getObjectProperty(object, propName);
352
353
  if (prop?.type === 'KeyValueProperty') {
353
354
  const val = prop.value;
354
355
  if (val.type === 'StringLiteral')
355
356
  return val.value;
356
- if (val.type === 'Identifier') {
357
- if (identifierResolver) {
358
- return identifierResolver(val.value);
359
- }
360
- return '';
361
- }
357
+ if (val.type === 'Identifier' && identifierResolver)
358
+ return identifierResolver(val.value);
362
359
  if (val.type === 'TemplateLiteral' && isSimpleTemplateLiteral(val))
363
360
  return val.quasis[0].cooked;
364
361
  if (val.type === 'BooleanLiteral')
365
362
  return val.value;
366
363
  if (val.type === 'NumericLiteral')
367
364
  return val.value;
368
- return ''; // Indicate presence for other types
365
+ return expressionResolver?.(val) ?? ''; // Indicate presence for other types
369
366
  }
370
367
  return undefined;
371
368
  }
@@ -1,6 +1,6 @@
1
1
  import { safePluralRules } from '../../utils/plural-rules.js';
2
2
  import { parseNestedReferences } from '../../utils/nesting.js';
3
- import { lineColumnFromOffset, isSimpleTemplateLiteral, getObjectPropValue, getObjectPropValueExpression } from './ast-utils.js';
3
+ import { getObjectPropValue, lineColumnFromOffset, isSimpleTemplateLiteral, getObjectPropValueExpression } from './ast-utils.js';
4
4
  import { matchesFunctionPattern } from '../utils/function-matcher.js';
5
5
 
6
6
  // Helper to escape regex characters
@@ -27,6 +27,18 @@ class CallExpressionHandler {
27
27
  this.getCurrentCode = getCurrentCode;
28
28
  this.resolveIdentifier = resolveIdentifier;
29
29
  }
30
+ /**
31
+ * Statically resolves a non-literal default value such as `STRINGS.key`, `DEFAULT_TEXT`
32
+ * or `` `Hi ${NAME}` `` (#293). Ambiguous expressions (ternaries, unions) yield undefined.
33
+ */
34
+ resolveDefaultValue = (expr) => {
35
+ const values = this.expressionResolver.resolvePossibleKeyStringValues(expr);
36
+ return values.length === 1 ? values[0] : undefined;
37
+ };
38
+ /** `getObjectPropValue` for `defaultValue*` props, so `{ defaultValue: STRINGS.key }` resolves too. */
39
+ getDefaultValueProp(options, propName) {
40
+ return getObjectPropValue(options, propName, undefined, this.resolveDefaultValue);
41
+ }
30
42
  /**
31
43
  * Computes line and column from a node's normalised span.
32
44
  * For call / new expressions the location points to the first argument
@@ -123,6 +135,9 @@ class CallExpressionHandler {
123
135
  else if (arg2.type === 'TemplateLiteral' && isSimpleTemplateLiteral(arg2)) {
124
136
  defaultValue = arg2.quasis[0].cooked;
125
137
  }
138
+ else {
139
+ defaultValue = this.resolveDefaultValue(arg2);
140
+ }
126
141
  }
127
142
  if (node.arguments.length > 2) {
128
143
  const arg3 = node.arguments[2].expression;
@@ -130,7 +145,7 @@ class CallExpressionHandler {
130
145
  options = arg3;
131
146
  }
132
147
  }
133
- const defaultValueFromOptions = options ? getObjectPropValue(options, 'defaultValue') : undefined;
148
+ const defaultValueFromOptions = options ? this.getDefaultValueProp(options, 'defaultValue') : undefined;
134
149
  const finalDefaultValue = (typeof defaultValueFromOptions === 'string' ? defaultValueFromOptions : defaultValue);
135
150
  // Helper: detect if options object contains any defaultValue* properties
136
151
  const optionsHasDefaultProps = (opts) => {
@@ -807,15 +822,15 @@ class CallExpressionHandler {
807
822
  // When defaultValue_zero is present in the options, include 'zero' in the
808
823
  // categories so that key_zero is generated with the correct default value.
809
824
  // See: https://www.i18next.com/translation-function/plurals#special-zero
810
- const zeroDefault = getObjectPropValue(options, `defaultValue${pluralSeparator}zero`);
825
+ const zeroDefault = this.getDefaultValueProp(options, `defaultValue${pluralSeparator}zero`);
811
826
  if (typeof zeroDefault === 'string' && !allPluralCategories.has('zero')) {
812
827
  allPluralCategories.add('zero');
813
828
  }
814
829
  const pluralCategories = Array.from(allPluralCategories).sort();
815
830
  // Get all possible default values once at the start
816
- const defaultValue = getObjectPropValue(options, 'defaultValue');
817
- const otherDefault = getObjectPropValue(options, `defaultValue${pluralSeparator}other`);
818
- const ordinalOtherDefault = getObjectPropValue(options, `defaultValue${pluralSeparator}ordinal${pluralSeparator}other`);
831
+ const defaultValue = this.getDefaultValueProp(options, 'defaultValue');
832
+ const otherDefault = this.getDefaultValueProp(options, `defaultValue${pluralSeparator}other`);
833
+ const ordinalOtherDefault = this.getDefaultValueProp(options, `defaultValue${pluralSeparator}ordinal${pluralSeparator}other`);
819
834
  // Handle context - both static and dynamic
820
835
  const contextPropValue = getObjectPropValueExpression(options, 'context');
821
836
  const keysToGenerate = [];
@@ -873,7 +888,7 @@ class CallExpressionHandler {
873
888
  }
874
889
  if (primaryIsSingleOther || (pluralCategories.length === 1 && pluralCategories[0] === 'other')) {
875
890
  for (const { key: baseKey, context } of keysToGenerate) {
876
- const specificOther = getObjectPropValue(options, `defaultValue${pluralSeparator}other`);
891
+ const specificOther = this.getDefaultValueProp(options, `defaultValue${pluralSeparator}other`);
877
892
  // Final default resolution:
878
893
  // 1) plural-specific defaultValue_other
879
894
  // 2) general defaultValue (from options)
@@ -911,7 +926,7 @@ class CallExpressionHandler {
911
926
  for (const category of pluralCategories) {
912
927
  // 1. Look for the most specific default value
913
928
  const specificDefaultKey = isOrdinal ? `defaultValue${pluralSeparator}ordinal${pluralSeparator}${category}` : `defaultValue${pluralSeparator}${category}`;
914
- const specificDefault = getObjectPropValue(options, specificDefaultKey);
929
+ const specificDefault = this.getDefaultValueProp(options, specificDefaultKey);
915
930
  // 2. Determine the final default value using the ORIGINAL fallback chain with corrections
916
931
  let finalDefaultValue;
917
932
  if (typeof specificDefault === 'string') {
@@ -980,7 +995,7 @@ class CallExpressionHandler {
980
995
  catch (e) {
981
996
  this.logger.warn(`Could not determine plural rules for language "${this.config.extract?.primaryLanguage}". Falling back to simple key extraction.`);
982
997
  // Fallback to a simple key if Intl API fails
983
- const defaultValue = defaultValueFromCall || getObjectPropValue(options, 'defaultValue');
998
+ const defaultValue = defaultValueFromCall || this.getDefaultValueProp(options, 'defaultValue');
984
999
  this.pluginContext.addKey({ key, ns, defaultValue: typeof defaultValue === 'string' ? defaultValue : key, locations });
985
1000
  }
986
1001
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-cli",
3
- "version": "1.73.1",
3
+ "version": "1.73.3",
4
4
  "description": "A unified, high-performance i18next CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -65,6 +65,7 @@
65
65
  "eslint-plugin-import": "^2.32.0",
66
66
  "memfs": "^4.68.1",
67
67
  "neostandard": "^0.13.0",
68
+ "react": "^19.2.8",
68
69
  "rollup": "^4.62.4",
69
70
  "typescript": "^6.0.3",
70
71
  "unplugin-swc": "^1.5.11",
@@ -85,7 +86,6 @@
85
86
  "magic-string": "^1.2.2",
86
87
  "minimatch": "^10.2.6",
87
88
  "ora": "^9.4.1",
88
- "react": "^19.2.8",
89
89
  "react-i18next": "^17.0.12",
90
90
  "yaml": "^2.9.0"
91
91
  }
@@ -137,10 +137,11 @@ type IdentifierResolver = (name: string) => string | boolean | number | undefine
137
137
  * @param object - Object expression to search
138
138
  * @param propName - Property name to find
139
139
  * @param identifierResolver - callback to resolve Identifier type values when needed
140
+ * @param expressionResolver - callback to statically resolve any other non-literal value (e.g. `STRINGS.key`); '' is kept when it returns undefined
140
141
  * @returns String value if found, empty string if property exists but isn't a string, undefined if not found
141
142
  *
142
143
  * @private
143
144
  */
144
- export declare function getObjectPropValue(object: ObjectExpression, propName: string, identifierResolver?: IdentifierResolver): string | boolean | number | undefined;
145
+ export declare function getObjectPropValue(object: ObjectExpression, propName: string, identifierResolver?: IdentifierResolver, expressionResolver?: (expr: Expression) => string | undefined): string | boolean | number | undefined;
145
146
  export {};
146
147
  //# sourceMappingURL=ast-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ast-utils.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/ast-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAc,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE1F;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CA2BzD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CA0BhE;AAED;;;;;;GAMG;AACH,wBA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AM,GAAG,UAAU,GAAG,SAAS,CAKhH;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAE1E;AAED,KAAK,kBAAkB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;AAEjF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAE,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAa7N"}
@@ -11,6 +11,13 @@ export declare class CallExpressionHandler {
11
11
  private getCurrentCode;
12
12
  private resolveIdentifier;
13
13
  constructor(config: Omit<I18nextToolkitConfig, 'plugins'>, pluginContext: PluginContext, logger: Logger, expressionResolver: ExpressionResolver, getCurrentFile: () => string, getCurrentCode: () => string, resolveIdentifier?: (name: string) => string | undefined);
14
+ /**
15
+ * Statically resolves a non-literal default value such as `STRINGS.key`, `DEFAULT_TEXT`
16
+ * or `` `Hi ${NAME}` `` (#293). Ambiguous expressions (ternaries, unions) yield undefined.
17
+ */
18
+ private resolveDefaultValue;
19
+ /** `getObjectPropValue` for `defaultValue*` props, so `{ defaultValue: STRINGS.key }` resolves too. */
20
+ private getDefaultValueProp;
14
21
  /**
15
22
  * Computes line and column from a node's normalised span.
16
23
  * For call / new expressions the location points to the first argument
@@ -1 +1 @@
1
- {"version":3,"file":"call-expression-handler.d.ts","sourceRoot":"","sources":["../../../src/extractor/parsers/call-expression-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAA6C,MAAM,WAAW,CAAA;AAC1F,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,EAAgB,SAAS,EA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