i18next-cli 1.53.2 → 1.54.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.
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.53.2'); // This string is replaced with the actual version at build time by rollup
34
+ .version('1.54.1'); // 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
@@ -689,21 +689,27 @@ function buildNewTranslationsForNs(nsKeys, existingTranslations, config, locale,
689
689
  else {
690
690
  // Non-primary locale behavior
691
691
  const isVariantKey = key.includes(pluralSeparator) || key.includes(contextSeparator);
692
+ const primaryDivergedFromDefault = Boolean(defaultValue$1 &&
693
+ !primaryShouldPreserveObject &&
694
+ (primaryExistingValue === undefined ||
695
+ primaryIsStaleObject ||
696
+ ((!isVariantKey || explicitDefault) &&
697
+ primaryExistingValue !== defaultValue.resolveDefaultValue(defaultValue$1, key, namespace || config?.extract?.defaultNS || 'translation', primaryLanguage, defaultValue$1))));
698
+ const syncExplicitDefault = Boolean(syncAll &&
699
+ locale !== primaryLanguage &&
700
+ explicitDefault &&
701
+ primaryDivergedFromDefault);
692
702
  const syncDerivedDefault = Boolean(syncAll &&
693
703
  locale !== primaryLanguage &&
694
704
  syncPrimaryWithDefaults &&
695
705
  trustDerivedDefaults &&
696
706
  defaultValue$1 &&
697
707
  isDerivedDefault &&
698
- !primaryShouldPreserveObject &&
699
- (primaryExistingValue === undefined ||
700
- primaryIsStaleObject ||
701
- ((!isVariantKey || explicitDefault) &&
702
- primaryExistingValue !== defaultValue.resolveDefaultValue(defaultValue$1, key, namespace || config?.extract?.defaultNS || 'translation', primaryLanguage, defaultValue$1))));
703
- if (syncAll && locale !== primaryLanguage && (explicitDefault || syncDerivedDefault)) {
704
- // When syncAll is requested, clear (reset) any existing translations for keys
705
- // that had explicit defaults in code so the primary default can be propagated
706
- // while secondary locales get a blank/placeholder value.
708
+ primaryDivergedFromDefault);
709
+ if (syncAll && locale !== primaryLanguage && (syncExplicitDefault || syncDerivedDefault)) {
710
+ // When syncAll is requested and the primary value has actually diverged from the
711
+ // code-provided default, clear secondary translations so the new primary default
712
+ // can be propagated while secondary locales get a blank/placeholder value.
707
713
  valueToSet = defaultValue.resolveDefaultValue(emptyDefaultValue, key, namespace || config?.extract?.defaultNS || 'translation', locale, defaultValue$1);
708
714
  }
709
715
  else {
@@ -160,7 +160,7 @@ ${i18nextResourcesForTs.mergeResourcesAsInterface(resources, { optimize: !!enabl
160
160
  const defaultNS = config.extract.defaultNS === false ? 'false' : `'${config.extract.defaultNS || 'translation'}'`;
161
161
  const fallbackNS = config.extract.fallbackNS === false ? 'false' : `'${config.extract.fallbackNS}'`;
162
162
  const fileContent = `// This file is automatically generated by i18next-cli, because it was not existing. You can edit it based on your needs: https://www.i18next.com/overview/typescript#custom-type-options
163
- import Resources from './${importPath}';
163
+ import type Resources from './${importPath}';
164
164
 
165
165
  declare module 'i18next' {
166
166
  interface CustomTypeOptions {
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.53.2'); // This string is replaced with the actual version at build time by rollup
32
+ .version('1.54.1'); // 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
@@ -687,21 +687,27 @@ function buildNewTranslationsForNs(nsKeys, existingTranslations, config, locale,
687
687
  else {
688
688
  // Non-primary locale behavior
689
689
  const isVariantKey = key.includes(pluralSeparator) || key.includes(contextSeparator);
690
+ const primaryDivergedFromDefault = Boolean(defaultValue &&
691
+ !primaryShouldPreserveObject &&
692
+ (primaryExistingValue === undefined ||
693
+ primaryIsStaleObject ||
694
+ ((!isVariantKey || explicitDefault) &&
695
+ primaryExistingValue !== resolveDefaultValue(defaultValue, key, namespace || config?.extract?.defaultNS || 'translation', primaryLanguage, defaultValue))));
696
+ const syncExplicitDefault = Boolean(syncAll &&
697
+ locale !== primaryLanguage &&
698
+ explicitDefault &&
699
+ primaryDivergedFromDefault);
690
700
  const syncDerivedDefault = Boolean(syncAll &&
691
701
  locale !== primaryLanguage &&
692
702
  syncPrimaryWithDefaults &&
693
703
  trustDerivedDefaults &&
694
704
  defaultValue &&
695
705
  isDerivedDefault &&
696
- !primaryShouldPreserveObject &&
697
- (primaryExistingValue === undefined ||
698
- primaryIsStaleObject ||
699
- ((!isVariantKey || explicitDefault) &&
700
- primaryExistingValue !== resolveDefaultValue(defaultValue, key, namespace || config?.extract?.defaultNS || 'translation', primaryLanguage, defaultValue))));
701
- if (syncAll && locale !== primaryLanguage && (explicitDefault || syncDerivedDefault)) {
702
- // When syncAll is requested, clear (reset) any existing translations for keys
703
- // that had explicit defaults in code so the primary default can be propagated
704
- // while secondary locales get a blank/placeholder value.
706
+ primaryDivergedFromDefault);
707
+ if (syncAll && locale !== primaryLanguage && (syncExplicitDefault || syncDerivedDefault)) {
708
+ // When syncAll is requested and the primary value has actually diverged from the
709
+ // code-provided default, clear secondary translations so the new primary default
710
+ // can be propagated while secondary locales get a blank/placeholder value.
705
711
  valueToSet = resolveDefaultValue(emptyDefaultValue, key, namespace || config?.extract?.defaultNS || 'translation', locale, defaultValue);
706
712
  }
707
713
  else {
@@ -158,7 +158,7 @@ ${mergeResourcesAsInterface(resources, { optimize: !!enableSelector, indentation
158
158
  const defaultNS = config.extract.defaultNS === false ? 'false' : `'${config.extract.defaultNS || 'translation'}'`;
159
159
  const fallbackNS = config.extract.fallbackNS === false ? 'false' : `'${config.extract.fallbackNS}'`;
160
160
  const fileContent = `// This file is automatically generated by i18next-cli, because it was not existing. You can edit it based on your needs: https://www.i18next.com/overview/typescript#custom-type-options
161
- import Resources from './${importPath}';
161
+ import type Resources from './${importPath}';
162
162
 
163
163
  declare module 'i18next' {
164
164
  interface CustomTypeOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-cli",
3
- "version": "1.53.2",
3
+ "version": "1.54.1",
4
4
  "description": "A unified, high-performance i18next CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -56,36 +56,36 @@
56
56
  "@rollup/plugin-terser": "^1.0.0",
57
57
  "@rollup/plugin-typescript": "^12.3.0",
58
58
  "@types/inquirer": "^9.0.9",
59
- "@types/node": "^25.5.2",
59
+ "@types/node": "^25.6.0",
60
60
  "@types/react": "^19.2.14",
61
- "@typescript-eslint/parser": "^8.58.0",
62
- "@vitest/coverage-v8": "^4.1.2",
63
- "eslint": "^9.39.2",
61
+ "@typescript-eslint/parser": "^8.58.2",
62
+ "@vitest/coverage-v8": "^4.1.4",
63
+ "eslint": "^9.39.4",
64
64
  "eslint-import-resolver-typescript": "^4.4.4",
65
65
  "eslint-plugin-import": "^2.32.0",
66
- "memfs": "^4.57.1",
66
+ "memfs": "^4.57.2",
67
67
  "neostandard": "^0.13.0",
68
68
  "rollup": "^4.60.1",
69
- "typescript": "^6.0.2",
69
+ "typescript": "^6.0.3",
70
70
  "unplugin-swc": "^1.5.9",
71
- "vitest": "^4.1.2"
71
+ "vitest": "^4.1.4"
72
72
  },
73
73
  "dependencies": {
74
74
  "@croct/json5-parser": "^0.2.2",
75
- "@swc/core": "^1.15.21",
75
+ "@swc/core": "^1.15.26",
76
76
  "chokidar": "^5.0.0",
77
77
  "commander": "^14.0.3",
78
78
  "execa": "^9.6.1",
79
79
  "glob": "^13.0.6",
80
- "i18next-resources-for-ts": "^2.0.2",
81
- "inquirer": "^13.3.2",
80
+ "i18next-resources-for-ts": "^2.1.0",
81
+ "inquirer": "^13.4.1",
82
82
  "jiti": "^2.6.1",
83
83
  "jsonc-parser": "^3.3.1",
84
84
  "magic-string": "^0.30.21",
85
85
  "minimatch": "^10.2.5",
86
86
  "ora": "^9.3.0",
87
- "react": "^19.2.4",
88
- "react-i18next": "^17.0.2",
87
+ "react": "^19.2.5",
88
+ "react-i18next": "^17.0.4",
89
89
  "yaml": "^2.8.3"
90
90
  }
91
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"translation-manager.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/translation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAo8B9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAC/B,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,MAAM,EAAE,oBAAoB,EAC5B,EACE,uBAA+B,EAC/B,OAAe,EACf,oBAA4B,EAC5B,MAA4B,EAC7B,GAAE;IACD,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;CACX,GACL,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAiK9B"}
1
+ {"version":3,"file":"translation-manager.d.ts","sourceRoot":"","sources":["../../../src/extractor/core/translation-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AA88B9F;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAC/B,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,MAAM,EAAE,oBAAoB,EAC5B,EACE,uBAA+B,EAC/B,OAAe,EACf,oBAA4B,EAC5B,MAA4B,EAC7B,GAAE;IACD,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;CACX,GACL,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAiK9B"}