i18next-cli 1.23.7 → 1.24.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/CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.24.1](https://github.com/i18next/i18next-cli/compare/v1.24.0...v1.24.1) - 2025-11-12
9
+
10
+ - Windows fix for new **CLI:** command `rename-key`
11
+
12
+ ## [1.24.0](https://github.com/i18next/i18next-cli/compare/v1.23.6...v1.24.0) - 2025-11-12
13
+
14
+ - **CLI:** Introduced the `rename-key` command for safely refactoring translation keys across your entire codebase. This new command updates both source files and translation JSON files atomically, automatically handling namespaces, plurals, and multiple locales. [109](https://github.com/i18next/i18next-cli/issues/109)
15
+ - improved Trans component parsing further [102](https://github.com/i18next/i18next-cli/issues/102)
16
+
8
17
  ## [1.23.7](https://github.com/i18next/i18next-cli/compare/v1.23.6...v1.23.7) - 2025-11-12
9
18
 
10
19
  - improved Trans component parsing further [102](https://github.com/i18next/i18next-cli/issues/102)
package/README.md CHANGED
@@ -213,6 +213,33 @@ npx i18next-cli migrate-config
213
213
  npx i18next-cli migrate-config i18next-parser.config.mjs
214
214
  ```
215
215
 
216
+ ### `rename-key`
217
+
218
+ Safely refactor translation keys across your entire codebase. This command updates both source files and translation files atomically.
219
+
220
+ ```bash
221
+ npx i18next-cli rename-key <oldKey> <newKey> [options]
222
+ ```
223
+
224
+ **Options:**
225
+ - `--dry-run`: Preview changes without modifying any files
226
+
227
+ **Usage Examples:**
228
+
229
+ ```bash
230
+ # Basic rename
231
+ npx i18next-cli rename-key "old.key" "new.key"
232
+
233
+ # With namespace prefix
234
+ npx i18next-cli rename-key "common:button.submit" "common:button.save"
235
+
236
+ # Preview changes without modifying files
237
+ npx i18next-cli rename-key "old.key" "new.key" --dry-run
238
+
239
+ # Refactor from mnemonic ID to meaningful key
240
+ npx i18next-cli rename-key "Invalid username or password" "login.form.invalid-credentials"
241
+ ```
242
+
216
243
  ### Locize Integration
217
244
 
218
245
  **Prerequisites:** The locize commands require `locize-cli` to be installed:
package/dist/cjs/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var e=require("commander"),t=require("chokidar"),o=require("glob"),n=require("minimatch"),i=require("chalk"),a=require("./config.js"),r=require("./heuristic-config.js"),c=require("./extractor/core/extractor.js");require("node:path"),require("node:fs/promises"),require("jiti");var s=require("./types-generator.js"),l=require("./syncer.js"),u=require("./migrator.js"),g=require("./init.js"),d=require("./linter.js"),p=require("./status.js"),f=require("./locize.js");const m=new e.Command;m.name("i18next-cli").description("A unified, high-performance i18next CLI.").version("1.23.7"),m.option("-c, --config <path>","Path to i18next-cli config file (overrides detection)"),m.command("extract").description("Extract translation keys from source files and update resource files.").option("-w, --watch","Watch for file changes and re-run the extractor.").option("--ci","Exit with a non-zero status code if any files are updated.").option("--dry-run","Run the extractor without writing any files to disk.").option("--sync-primary","Sync primary language values with default values from code.").action(async e=>{try{const o=m.opts().config,i=await a.ensureConfig(o),r=async()=>{const t=await c.runExtractor(i,{isWatchMode:!!e.watch,isDryRun:!!e.dryRun,syncPrimaryWithDefaults:!!e.syncPrimary});return e.ci&&!t?(console.log("✅ No files were updated."),process.exit(0)):e.ci&&t&&(console.error("❌ Some files were updated. This should not happen in CI mode."),process.exit(1)),t};if(await r(),e.watch){console.log("\nWatching for changes...");const e=await w(i.extract.input),o=y(i.extract.ignore),a=h(i.extract.output),c=[...o,...a].filter(Boolean),s=e.filter(e=>!c.some(t=>n.minimatch(e,t,{dot:!0})));t.watch(s,{ignored:/node_modules/,persistent:!0}).on("change",e=>{console.log(`\nFile changed: ${e}`),r()})}}catch(e){console.error("Error running extractor:",e),process.exit(1)}}),m.command("status [locale]").description("Display translation status. Provide a locale for a detailed key-by-key view.").option("-n, --namespace <ns>","Filter the status report by a specific namespace").action(async(e,t)=>{const o=m.opts().config;let n=await a.loadConfig(o);if(!n){console.log(i.blue("No config file found. Attempting to detect project structure..."));const e=await r.detectConfig();e||(console.error(i.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${i.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(i.green("Project structure detected successfully!")),n=e}await p.runStatus(n,{detail:e,namespace:t.namespace})}),m.command("types").description("Generate TypeScript definitions from translation resource files.").option("-w, --watch","Watch for file changes and re-run the type generator.").action(async e=>{const o=m.opts().config,i=await a.ensureConfig(o),r=()=>s.runTypesGenerator(i);if(await r(),e.watch){console.log("\nWatching for changes...");const e=await w(i.types?.input||[]),o=[...y(i.extract?.ignore)].filter(Boolean),a=e.filter(e=>!o.some(t=>n.minimatch(e,t,{dot:!0})));t.watch(a,{persistent:!0}).on("change",e=>{console.log(`\nFile changed: ${e}`),r()})}}),m.command("sync").description("Synchronize secondary language files with the primary language file.").action(async()=>{const e=m.opts().config,t=await a.ensureConfig(e);await l.runSyncer(t)}),m.command("migrate-config [configPath]").description("Migrate a legacy i18next-parser.config.js to the new format.").action(async e=>{await u.runMigrator(e)}),m.command("init").description("Create a new i18next.config.ts/js file with an interactive setup wizard.").action(g.runInit),m.command("lint").description("Find potential issues like hardcoded strings in your codebase.").option("-w, --watch","Watch for file changes and re-run the linter.").action(async e=>{const o=m.opts().config,c=async()=>{let e=await a.loadConfig(o);if(!e){console.log(i.blue("No config file found. Attempting to detect project structure..."));const t=await r.detectConfig();t||(console.error(i.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${i.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(i.green("Project structure detected successfully!")),e=t}await d.runLinterCli(e)};if(await c(),e.watch){console.log("\nWatching for changes...");const e=await a.loadConfig(o);if(e?.extract?.input){const o=await w(e.extract.input),i=[...y(e.extract.ignore),...h(e.extract.output)].filter(Boolean),a=o.filter(e=>!i.some(t=>n.minimatch(e,t,{dot:!0})));t.watch(a,{ignored:/node_modules/,persistent:!0}).on("change",e=>{console.log(`\nFile changed: ${e}`),c()})}}}),m.command("locize-sync").description("Synchronize local translations with your locize project.").option("--update-values","Update values of existing translations on locize.").option("--src-lng-only","Check for changes in source language only.").option("--compare-mtime","Compare modification times when syncing.").option("--dry-run","Run the command without making any changes.").action(async e=>{const t=m.opts().config,o=await a.ensureConfig(t);await f.runLocizeSync(o,e)}),m.command("locize-download").description("Download all translations from your locize project.").action(async e=>{const t=m.opts().config,o=await a.ensureConfig(t);await f.runLocizeDownload(o,e)}),m.command("locize-migrate").description("Migrate local translation files to a new locize project.").action(async e=>{const t=m.opts().config,o=await a.ensureConfig(t);await f.runLocizeMigrate(o,e)}),m.parse(process.argv);const y=e=>Array.isArray(e)?e:e?[e]:[],h=e=>e&&"string"==typeof e?[e.replace(/\{\{[^}]+\}\}/g,"*")]:[],w=async(e=[])=>{const t=y(e),n=await Promise.all(t.map(e=>o.glob(e||"",{nodir:!0})));return Array.from(new Set(n.flat()))};
2
+ "use strict";var e=require("commander"),o=require("chokidar"),t=require("glob"),n=require("minimatch"),i=require("chalk"),r=require("./config.js"),a=require("./heuristic-config.js"),c=require("./extractor/core/extractor.js");require("node:path"),require("node:fs/promises"),require("jiti");var s=require("./types-generator.js"),l=require("./syncer.js"),u=require("./migrator.js"),d=require("./init.js"),g=require("./linter.js"),f=require("./status.js"),p=require("./locize.js"),m=require("./rename-key.js");const y=new e.Command;y.name("i18next-cli").description("A unified, high-performance i18next CLI.").version("1.24.1"),y.option("-c, --config <path>","Path to i18next-cli config file (overrides detection)"),y.command("extract").description("Extract translation keys from source files and update resource files.").option("-w, --watch","Watch for file changes and re-run the extractor.").option("--ci","Exit with a non-zero status code if any files are updated.").option("--dry-run","Run the extractor without writing any files to disk.").option("--sync-primary","Sync primary language values with default values from code.").action(async e=>{try{const t=y.opts().config,i=await r.ensureConfig(t),a=async()=>{const o=await c.runExtractor(i,{isWatchMode:!!e.watch,isDryRun:!!e.dryRun,syncPrimaryWithDefaults:!!e.syncPrimary});return e.ci&&!o?(console.log("✅ No files were updated."),process.exit(0)):e.ci&&o&&(console.error("❌ Some files were updated. This should not happen in CI mode."),process.exit(1)),o};if(await a(),e.watch){console.log("\nWatching for changes...");const e=await x(i.extract.input),t=h(i.extract.ignore),r=w(i.extract.output),c=[...t,...r].filter(Boolean),s=e.filter(e=>!c.some(o=>n.minimatch(e,o,{dot:!0})));o.watch(s,{ignored:/node_modules/,persistent:!0}).on("change",e=>{console.log(`\nFile changed: ${e}`),a()})}}catch(e){console.error("Error running extractor:",e),process.exit(1)}}),y.command("status [locale]").description("Display translation status. Provide a locale for a detailed key-by-key view.").option("-n, --namespace <ns>","Filter the status report by a specific namespace").action(async(e,o)=>{const t=y.opts().config;let n=await r.loadConfig(t);if(!n){console.log(i.blue("No config file found. Attempting to detect project structure..."));const e=await a.detectConfig();e||(console.error(i.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${i.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(i.green("Project structure detected successfully!")),n=e}await f.runStatus(n,{detail:e,namespace:o.namespace})}),y.command("types").description("Generate TypeScript definitions from translation resource files.").option("-w, --watch","Watch for file changes and re-run the type generator.").action(async e=>{const t=y.opts().config,i=await r.ensureConfig(t),a=()=>s.runTypesGenerator(i);if(await a(),e.watch){console.log("\nWatching for changes...");const e=await x(i.types?.input||[]),t=[...h(i.extract?.ignore)].filter(Boolean),r=e.filter(e=>!t.some(o=>n.minimatch(e,o,{dot:!0})));o.watch(r,{persistent:!0}).on("change",e=>{console.log(`\nFile changed: ${e}`),a()})}}),y.command("sync").description("Synchronize secondary language files with the primary language file.").action(async()=>{const e=y.opts().config,o=await r.ensureConfig(e);await l.runSyncer(o)}),y.command("migrate-config [configPath]").description("Migrate a legacy i18next-parser.config.js to the new format.").action(async e=>{await u.runMigrator(e)}),y.command("init").description("Create a new i18next.config.ts/js file with an interactive setup wizard.").action(d.runInit),y.command("lint").description("Find potential issues like hardcoded strings in your codebase.").option("-w, --watch","Watch for file changes and re-run the linter.").action(async e=>{const t=y.opts().config,c=async()=>{let e=await r.loadConfig(t);if(!e){console.log(i.blue("No config file found. Attempting to detect project structure..."));const o=await a.detectConfig();o||(console.error(i.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${i.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(i.green("Project structure detected successfully!")),e=o}await g.runLinterCli(e)};if(await c(),e.watch){console.log("\nWatching for changes...");const e=await r.loadConfig(t);if(e?.extract?.input){const t=await x(e.extract.input),i=[...h(e.extract.ignore),...w(e.extract.output)].filter(Boolean),r=t.filter(e=>!i.some(o=>n.minimatch(e,o,{dot:!0})));o.watch(r,{ignored:/node_modules/,persistent:!0}).on("change",e=>{console.log(`\nFile changed: ${e}`),c()})}}}),y.command("locize-sync").description("Synchronize local translations with your locize project.").option("--update-values","Update values of existing translations on locize.").option("--src-lng-only","Check for changes in source language only.").option("--compare-mtime","Compare modification times when syncing.").option("--dry-run","Run the command without making any changes.").action(async e=>{const o=y.opts().config,t=await r.ensureConfig(o);await p.runLocizeSync(t,e)}),y.command("locize-download").description("Download all translations from your locize project.").action(async e=>{const o=y.opts().config,t=await r.ensureConfig(o);await p.runLocizeDownload(t,e)}),y.command("locize-migrate").description("Migrate local translation files to a new locize project.").action(async e=>{const o=y.opts().config,t=await r.ensureConfig(o);await p.runLocizeMigrate(t,e)}),y.command("rename-key <oldKey> <newKey>").description("Rename a translation key across all source files and translation files.").option("--dry-run","Preview changes without modifying files").action(async(e,o,t)=>{try{const n=y.opts().config,a=await r.ensureConfig(n),c=await m.runRenameKey(a,e,o,t);c.success||(c.conflicts&&(console.error(i.red("\n❌ Conflicts detected:")),c.conflicts.forEach(e=>console.error(` - ${e}`))),c.error&&console.error(i.red(`\n❌ ${c.error}`)),process.exit(1));0===c.sourceFiles.reduce((e,o)=>e+o.changes,0)&&console.log(i.yellow(`\n⚠️ No usages found for "${e}"`))}catch(e){console.error(i.red("Error renaming key:"),e),process.exit(1)}}),y.parse(process.argv);const h=e=>Array.isArray(e)?e:e?[e]:[],w=e=>e&&"string"==typeof e?[e.replace(/\{\{[^}]+\}\}/g,"*")]:[],x=async(e=[])=>{const o=h(e),n=await Promise.all(o.map(e=>t.glob(e||"",{nodir:!0})));return Array.from(new Set(n.flat()))};
@@ -1 +1 @@
1
- "use strict";var e=require("./ast-utils.js");function t(t){if(t)return"StringLiteral"===t.type?t.value:"TemplateLiteral"===t.type&&e.isSimpleTemplateLiteral(t)?t.quasis[0].cooked:void 0}function n(e){return"StringLiteral"===e.value?.type?e.value.value:"JSXExpressionContainer"===e.value?.type?t(e.value.expression):void 0}exports.extractFromTransComponent=function(i,r){const s=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"i18nKey"===e.name.value),o=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"defaults"===e.name.value),p=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"count"===e.name.value),a=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"values"===e.name.value);let l;p||"JSXAttribute"!==a?.type||"JSXExpressionContainer"!==a.value?.type||"ObjectExpression"!==a.value.expression.type||(l=e.getObjectPropValueExpression(a.value.expression,"count"));const u=!!p||!!l,y=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"tOptions"===e.name.value),f="JSXAttribute"===y?.type&&"JSXExpressionContainer"===y.value?.type&&"ObjectExpression"===y.value.expression.type?y.value.expression:void 0,c=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"ordinal"===e.name.value),g=!!c,d=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"context"===e.name.value);let v="JSXAttribute"===d?.type&&"JSXExpressionContainer"===d.value?.type?d.value.expression:"JSXAttribute"===d?.type&&"StringLiteral"===d.value?.type?d.value:void 0;const S=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"ns"===e.name.value);let x;x="JSXAttribute"===S?.type?n(S):void 0,f&&(void 0===x&&(x=e.getObjectPropValue(f,"ns")),void 0===v&&(v=e.getObjectPropValueExpression(f,"context")));const J=function(e,n){if(!e||0===e.length)return"";const i=new Set(n.extract.transKeepBasicHtmlNodesFor??["br","strong","i","p"]),r=e=>e&&"JSXText"===e.type&&/^\s*$/.test(e.value)&&e.value.includes("\n");function s(e,n,o=!1,p=!1){if(!e||!e.length)return;const a=p&&e.filter(e=>e&&"JSXElement"===e.type&&"p"===e.opening?.name?.value).length>1;let l=0,u=e.length-1;for(;l<=u&&r(e[l]);)l++;for(;u>=l&&r(e[u]);)u--;const y=l<=u?e.slice(l,u+1):[],f=y.some(e=>e&&("JSXElement"===e.type||"JSXFragment"===e.type));for(let e=0;e<y.length;e++){const p=y[e];if(p)if("JSXText"!==p.type){if("JSXExpressionContainer"===p.type){if(o&&!f&&p.expression){const e=p.expression.type;if("ObjectExpression"===e){const e=p.expression.properties&&p.expression.properties[0];if(e&&"KeyValueProperty"===e.type)continue}const n=t(p.expression);if(void 0!==n){if(!(/^\s*$/.test(n)&&!n.includes("\n")))continue}else if("Identifier"===e||"MemberExpression"===e||"CallExpression"===e)continue}const i=t(p.expression);if(void 0!==i){const t=/^\s*$/.test(i)&&!i.includes("\n"),s=y[e-1],o=y[e+1];if(t){const t=y[e+2];if(o&&"JSXText"===o.type&&r(o)&&t&&("JSXElement"===t.type||"JSXFragment"===t.type)){const t=y[e-1],n=y[e-2];if(!t||"JSXText"!==t.type&&n&&"JSXExpressionContainer"===n.type)continue}if(s&&("JSXElement"===s.type||"JSXFragment"===s.type)&&o&&"JSXText"===o.type&&r(o))continue;const i=!o||"JSXText"===o.type&&!r(o);if(s&&"JSXText"===s.type&&i){const e=n[n.length-1];if(e&&"JSXText"===e.type){e.value=String(e.value)+p.expression.value;continue}}if(s&&("JSXElement"===s.type||"JSXFragment"===s.type)&&o&&"JSXText"===o.type&&r(o))continue}}n.push(p);continue}if("JSXElement"===p.type){const e=p.opening&&p.opening.name&&"Identifier"===p.opening.name.type?p.opening.name.value:void 0;if(e&&i.has(e)){const i=p.opening&&Array.isArray(p.opening.attributes)&&p.opening.attributes.length>0,r=p.children||[],o=1===r.length&&("JSXText"===r[0]?.type||"JSXExpressionContainer"===r[0]?.type&&void 0!==t(r[0].expression)),l=!r.length,u=o;i&&!o?(n.push(p),s(p.children||[],n,!0)):l?n.push(p):u||("p"===e&&a?(n.push(p),s(p.children||[],n,!0,!1)):s(p.children||[],n,!1,!1));continue}n.push(p),s(p.children||[],n,!0);continue}"JSXFragment"!==p.type||s(p.children||[],n,o)}else{if(o&&!f)continue;if(o&&r(p))continue;if(r(p)){const t=y[e-1],i=y[e+1];if(t&&("JSXElement"===t.type||"JSXFragment"===t.type)&&i&&("JSXElement"===i.type||"JSXFragment"===i.type))continue;const r=n[n.length-1],s=y[e-1];if(r){if(s&&"JSXExpressionContainer"===s.type)continue;if("JSXText"===r.type&&s&&"JSXText"===s.type){r.value=String(r.value)+p.value;continue}}}if(o&&f&&0===e)continue;n.push(p)}}}const o=[];s(e,o,!1,!0);const p=e=>String(e).replace(/^\s*\n\s*/g,"").replace(/\s*\n\s*$/g,"");function a(e,n,s=!1){if(!e||0===e.length)return"";let l="",u=0;for(let y=0;y<e.length;y++){const f=e[y];if(f)if("JSXText"!==f.type){if("JSXExpressionContainer"===f.type){const e=f.expression;if(!e)continue;const n=t(e);if(void 0!==n)l+=n;else if("Identifier"===e.type)l+=`{{${e.value}}}`;else if("ObjectExpression"===e.type){const t=e.properties[0];t&&"KeyValueProperty"===t.type&&t.key&&"Identifier"===t.key.type?l+=`{{${t.key.value}}}`:t&&"Identifier"===t.type?l+=`{{${t.value}}}`:l+="{{value}}"}else"MemberExpression"===e.type&&e.property&&"Identifier"===e.property.type?l+=`{{${e.property.value}}}`:"CallExpression"===e.type&&"Identifier"===e.callee?.type?l+=`{{${e.callee.value}}}`:l+="{{value}}";continue}if("JSXElement"===f.type){let c;f.opening&&f.opening.name&&"Identifier"===f.opening.name.type&&(c=f.opening.name.value);const g=s?u:void 0;if(s&&"JSXElement"===f.type&&u++,c&&i.has(c)){const s=f.opening&&Array.isArray(f.opening.attributes)&&f.opening.attributes.length>0,u=f.children||[],d=u.length>0,v=1===u.length&&("JSXText"===u[0]?.type||"JSXExpressionContainer"===u[0]?.type&&void 0!==t(u[0].expression));if(!d||v){const t=v?a(u,void 0):"";if(""!==String(t).trim())l+=`<${c}>${t}</${c}>`;else{const t=e[y-1];t&&"JSXText"===t.type&&/\n\s*$/.test(t.value)&&(l=l.replace(/\s+$/,"")),l+=`<${c} />`}}else if(s&&!v){const e=u;if(e.some(e=>e&&("JSXText"===e.type||"JSXExpressionContainer"===e.type)&&-1!==o.indexOf(e))){const t=o.indexOf(f),n=a(e,void 0);l+=`<${t}>${p(n)}</${t}>`}else{const t=new Map;let r=0;for(const n of e)if(n&&"JSXElement"===n.type){const e=n.opening&&n.opening.name&&"Identifier"===n.opening.name.type?n.opening.name.value:void 0;if(e&&i.has(e)){const e=n.opening&&Array.isArray(n.opening.attributes)&&n.opening.attributes.length>0,i=n.children||[],s=1===i.length&&"JSXText"===i[0]?.type;(e||i.length&&!s)&&t.set(n,r++)}else t.set(n,r++)}const s=n&&n.has(f)?n.get(f):o.indexOf(f),u=a(e,t.size?t:void 0);l+=`<${s}>${p(u)}</${s}>`}}else{const e=o.indexOf(f);if(-1!==e){const n=void 0!==g?g:e;if((()=>{let e=!1;for(const t of u)if(t)if("JSXElement"!==t.type){if("JSXExpressionContainer"===t.type&&-1!==o.indexOf(t))return e;if("JSXText"===t.type&&-1!==o.indexOf(t)){if(r(t))continue;if(!e)return!0;if(u.slice(u.indexOf(t)+1).some(e=>e&&"JSXElement"===e.type))return!0}}else e=!0;return!1})()){const e=a(u,void 0,!1);l+=`<${n}>${p(e)}</${n}>`;continue}const s=new Map;let y=n;for(const e of u)if(e&&"JSXElement"===e.type){const n=e.opening&&e.opening.name&&"Identifier"===e.opening.name.type?e.opening.name.value:void 0;if(n&&i.has(n)){const n=e.opening&&Array.isArray(e.opening.attributes)&&e.opening.attributes.length>0,i=e.children||[],r=1===i.length&&("JSXText"===i[0]?.type||"JSXExpressionContainer"===i[0]?.type&&void 0!==t(i[0].expression));!n&&(!i.length||r)||s.set(e,y++)}else s.set(e,y++)}const f=a(u,s.size>0?s:void 0,!1);l+=`<${n}>${p(f)}</${n}>`}else{const e=a(u,void 0,!1);l+=`<${c}>${p(e)}</${c}>`}}}else{const e=f.children||[];if(e.some(e=>e&&("JSXText"===e.type||"JSXExpressionContainer"===e.type)&&-1!==o.indexOf(e))){const t=o.indexOf(f),n=a(e,void 0);l+=`<${t}>${p(n)}</${t}>`}else{const t=new Map;let r=0;for(const n of e)if(n&&"JSXElement"===n.type){const e=n.opening&&n.opening.name&&"Identifier"===n.opening.name.type?n.opening.name.value:void 0;if(e&&i.has(e)){const e=n.opening&&Array.isArray(n.opening.attributes)&&n.opening.attributes.length>0,i=n.children||[],s=1===i.length&&"JSXText"===i[0]?.type;!e&&(!i.length||s)||t.set(n,r++)}else t.set(n,r++)}const s=n&&n.has(f)?n.get(f):o.indexOf(f),u=a(e,t.size?t:void 0);l+=`<${s}>${p(u)}</${s}>`}}continue}"JSXFragment"!==f.type||(l+=a(f.children||[]))}else{if(r(f))continue;l+=f.value}}return l}const l=a(e,void 0,!0),u=String(l).replace(/<br \/>\s*\n\s*/g,"<br />").replace(/\s+/g," ");return u.replace(/\s+\./g,".").trim()}(i.children,r);let X;const m="JSXAttribute"===o?.type?n(o):void 0;if(void 0!==m)X=m;else{const e=r.extract.defaultValue;X="string"==typeof e?e:""}let h,b;if("JSXAttribute"===s?.type){if("StringLiteral"===s.value?.type){if(h=s.value,b=h.value,!b||""===b.trim())return null;if(x&&"StringLiteral"===h.type){const e=r.extract.nsSeparator??":",t=h.value;if(e&&t.startsWith(`${x}${e}`)){if(b=t.slice(`${x}${e}`.length),!b||""===b.trim())return null;h={...h,value:b}}}}else"JSXExpressionContainer"===s.value?.type&&"JSXEmptyExpression"!==s.value.expression.type&&(h=s.value.expression);if(!h)return null}return o||!b||J.trim()?!o&&J.trim()&&(X=J):X=b,{keyExpression:h,serializedChildren:J,ns:x,defaultValue:X,hasCount:u,isOrdinal:g,contextExpression:v,optionsNode:f,explicitDefault:void 0!==m||(e=>{if(!e||!Array.isArray(e.properties))return!1;for(const t of e.properties)if(t&&"KeyValueProperty"===t.type&&t.key){const e="Identifier"===t.key.type&&t.key.value||"StringLiteral"===t.key.type&&t.key.value;if("string"==typeof e&&e.startsWith("defaultValue"))return!0}return!1})(f)}};
1
+ "use strict";var e=require("./ast-utils.js");function t(t){if(t)return"StringLiteral"===t.type?t.value:"TemplateLiteral"===t.type&&e.isSimpleTemplateLiteral(t)?t.quasis[0].cooked:void 0}function n(e){return"StringLiteral"===e.value?.type?e.value.value:"JSXExpressionContainer"===e.value?.type?t(e.value.expression):void 0}exports.extractFromTransComponent=function(i,r){const s=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"i18nKey"===e.name.value),o=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"defaults"===e.name.value),p=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"count"===e.name.value),a=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"values"===e.name.value);let l;p||"JSXAttribute"!==a?.type||"JSXExpressionContainer"!==a.value?.type||"ObjectExpression"!==a.value.expression.type||(l=e.getObjectPropValueExpression(a.value.expression,"count"));const u=!!p||!!l,y=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"tOptions"===e.name.value),c="JSXAttribute"===y?.type&&"JSXExpressionContainer"===y.value?.type&&"ObjectExpression"===y.value.expression.type?y.value.expression:void 0,f=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"ordinal"===e.name.value),g=!!f,d=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"context"===e.name.value);let v="JSXAttribute"===d?.type&&"JSXExpressionContainer"===d.value?.type?d.value.expression:"JSXAttribute"===d?.type&&"StringLiteral"===d.value?.type?d.value:void 0;const S=i.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"ns"===e.name.value);let x;x="JSXAttribute"===S?.type?n(S):void 0,c&&(void 0===x&&(x=e.getObjectPropValue(c,"ns")),void 0===v&&(v=e.getObjectPropValueExpression(c,"context")));const m=function(e,n){if(!e||0===e.length)return"";const i=new Set(n.extract.transKeepBasicHtmlNodesFor??["br","strong","i","p"]),r=e=>e&&"JSXText"===e.type&&/^\s*$/.test(e.value)&&e.value.includes("\n");function s(e,n,o=!1,p=!1){if(!e||!e.length)return;const a=p&&e.filter(e=>e&&"JSXElement"===e.type&&"p"===e.opening?.name?.value).length>1;let l=0,u=e.length-1;for(;l<=u&&r(e[l]);)l++;for(;u>=l&&r(e[u]);)u--;const y=l<=u?e.slice(l,u+1):[],c=y.some(e=>e&&("JSXElement"===e.type||"JSXFragment"===e.type));for(let e=0;e<y.length;e++){const p=y[e];if(p)if("JSXText"!==p.type){if("JSXExpressionContainer"===p.type){if(o&&!c&&p.expression){const e=p.expression.type;if("ObjectExpression"===e){const e=p.expression.properties&&p.expression.properties[0];if(e&&"KeyValueProperty"===e.type)continue}const n=t(p.expression);if(void 0!==n){if(!(/^\s*$/.test(n)&&!n.includes("\n")))continue}else if("Identifier"===e||"MemberExpression"===e||"CallExpression"===e)continue}const i=t(p.expression);if(void 0!==i){const t=/^\s*$/.test(i)&&!i.includes("\n"),s=y[e-1],o=y[e+1];if(t){const t=y[e+2];if(o&&"JSXText"===o.type&&r(o)&&t&&("JSXElement"===t.type||"JSXFragment"===t.type)){const t=y[e-1],n=y[e-2];if(!t||"JSXText"!==t.type&&n&&"JSXExpressionContainer"===n.type)continue}if(s&&("JSXElement"===s.type||"JSXFragment"===s.type)&&o&&"JSXText"===o.type&&r(o))continue;const i=!o||"JSXText"===o.type&&!r(o);if(s&&"JSXText"===s.type&&i){const e=n[n.length-1];if(e&&"JSXText"===e.type){e.value=String(e.value)+p.expression.value;continue}}if(s&&("JSXElement"===s.type||"JSXFragment"===s.type)&&o&&"JSXText"===o.type&&r(o))continue}}n.push(p);continue}if("JSXElement"===p.type){const e=p.opening&&p.opening.name&&"Identifier"===p.opening.name.type?p.opening.name.value:void 0;if(e&&i.has(e)){const i=p.opening&&Array.isArray(p.opening.attributes)&&p.opening.attributes.length>0,r=p.children||[],o=1===r.length&&("JSXText"===r[0]?.type||"JSXExpressionContainer"===r[0]?.type&&void 0!==t(r[0].expression)),l=!r.length,u=o;i&&!o?(n.push(p),s(p.children||[],n,!0)):l?n.push(p):u||("p"===e&&a?(n.push(p),s(p.children||[],n,!0,!1)):s(p.children||[],n,!1,!1));continue}n.push(p),s(p.children||[],n,!0);continue}"JSXFragment"!==p.type||s(p.children||[],n,o)}else{if(o&&!c)continue;if(o&&r(p))continue;if(r(p)){const t=y[e-1],i=y[e+1];if(t&&("JSXElement"===t.type||"JSXFragment"===t.type)&&i&&("JSXElement"===i.type||"JSXFragment"===i.type))continue;const r=n[n.length-1],s=y[e-1];if(r){if(s&&"JSXExpressionContainer"===s.type)continue;if("JSXText"===r.type&&s&&"JSXText"===s.type){r.value=String(r.value)+p.value;continue}}}if(o&&c&&0===e)continue;n.push(p)}}}const o=[];s(e,o,!1,!0);const p=e=>String(e).replace(/^\s*\n\s*/g,"").replace(/\s*\n\s*$/g,"");function a(e,n,s=!1){if(!e||0===e.length)return"";let l="",u=0;for(let y=0;y<e.length;y++){const c=e[y];if(c){if("JSXText"===c.type){if(r(c))continue;const t=e[y+1];if(/\n\s*$/.test(c.value)&&t&&"JSXElement"===t.type){const t=c.value.replace(/\n\s*$/,"");if(t.trim()){const n=e[y+2],i=n&&"JSXText"===n.type&&!r(n)&&/[a-zA-Z0-9]/.test(n.value),s=/^\s/.test(t),o=t.trim(),p=s?" "+o:o;l+=/\s\n/.test(c.value)||i?p+" ":p;continue}}l+=c.value;continue}if("JSXExpressionContainer"===c.type){const e=c.expression;if(!e)continue;const n=t(e);if(void 0!==n)l+=n;else if("Identifier"===e.type)l+=`{{${e.value}}}`;else if("ObjectExpression"===e.type){const t=e.properties[0];t&&"KeyValueProperty"===t.type&&t.key&&"Identifier"===t.key.type?l+=`{{${t.key.value}}}`:t&&"Identifier"===t.type?l+=`{{${t.value}}}`:l+="{{value}}"}else"MemberExpression"===e.type&&e.property&&"Identifier"===e.property.type?l+=`{{${e.property.value}}}`:"CallExpression"===e.type&&"Identifier"===e.callee?.type?l+=`{{${e.callee.value}}}`:l+="{{value}}";continue}if("JSXElement"===c.type){let f;c.opening&&c.opening.name&&"Identifier"===c.opening.name.type&&(f=c.opening.name.value);const g=s?u:void 0;if(s&&"JSXElement"===c.type&&u++,f&&i.has(f)){const s=c.opening&&Array.isArray(c.opening.attributes)&&c.opening.attributes.length>0,u=c.children||[],d=u.length>0,v=1===u.length&&("JSXText"===u[0]?.type||"JSXExpressionContainer"===u[0]?.type&&void 0!==t(u[0].expression));if(!d||v){const t=v?a(u,void 0):"";if(""!==String(t).trim())l+=`<${f}>${t}</${f}>`;else{const t=e[y-1];t&&"JSXText"===t.type&&/\n\s*$/.test(t.value)&&(l=l.replace(/\s+$/,"")),l+=`<${f} />`}}else if(s&&!v){const e=u;if(e.some(e=>e&&("JSXText"===e.type||"JSXExpressionContainer"===e.type)&&-1!==o.indexOf(e))){const t=o.indexOf(c),n=a(e,void 0);l+=`<${t}>${p(n)}</${t}>`}else{const t=new Map;let r=0;for(const n of e)if(n&&"JSXElement"===n.type){const e=n.opening&&n.opening.name&&"Identifier"===n.opening.name.type?n.opening.name.value:void 0;if(e&&i.has(e)){const e=n.opening&&Array.isArray(n.opening.attributes)&&n.opening.attributes.length>0,i=n.children||[],s=1===i.length&&"JSXText"===i[0]?.type;(e||i.length&&!s)&&t.set(n,r++)}else t.set(n,r++)}const s=n&&n.has(c)?n.get(c):o.indexOf(c),u=a(e,t.size?t:void 0);l+=`<${s}>${p(u)}</${s}>`}}else{const e=o.indexOf(c);if(-1!==e){const n=void 0!==g?g:e;if((()=>{let e=!1;for(const t of u)if(t)if("JSXElement"!==t.type){if("JSXExpressionContainer"===t.type&&-1!==o.indexOf(t))return e;if("JSXText"===t.type&&-1!==o.indexOf(t)){if(r(t))continue;if(!e)return!0;if(u.slice(u.indexOf(t)+1).some(e=>e&&"JSXElement"===e.type))return!0}}else e=!0;return!1})()){const e=a(u,void 0,!1);l+=`<${n}>${p(e)}</${n}>`;continue}const s=new Map;let y=n;for(const e of u)if(e&&"JSXElement"===e.type){const n=e.opening&&e.opening.name&&"Identifier"===e.opening.name.type?e.opening.name.value:void 0;if(n&&i.has(n)){const n=e.opening&&Array.isArray(e.opening.attributes)&&e.opening.attributes.length>0,i=e.children||[],r=1===i.length&&("JSXText"===i[0]?.type||"JSXExpressionContainer"===i[0]?.type&&void 0!==t(i[0].expression));!n&&(!i.length||r)||s.set(e,y++)}else s.set(e,y++)}const c=a(u,s.size>0?s:void 0,!1);l+=`<${n}>${p(c)}</${n}>`}else{const e=a(u,void 0,!1);l+=`<${f}>${p(e)}</${f}>`}}}else{const e=c.children||[];if(e.some(e=>e&&("JSXText"===e.type||"JSXExpressionContainer"===e.type)&&-1!==o.indexOf(e))){const t=o.indexOf(c),n=a(e,void 0);l+=`<${t}>${p(n)}</${t}>`}else{const t=new Map;let r=0;for(const n of e)if(n&&"JSXElement"===n.type){const e=n.opening&&n.opening.name&&"Identifier"===n.opening.name.type?n.opening.name.value:void 0;if(e&&i.has(e)){const e=n.opening&&Array.isArray(n.opening.attributes)&&n.opening.attributes.length>0,i=n.children||[],s=1===i.length&&"JSXText"===i[0]?.type;!e&&(!i.length||s)||t.set(n,r++)}else t.set(n,r++)}const s=n&&n.has(c)?n.get(c):o.indexOf(c),u=a(e,t.size?t:void 0);l+=`<${s}>${p(u)}</${s}>`}}continue}"JSXFragment"!==c.type||(l+=a(c.children||[]))}}return l}const l=a(e,void 0,!0),u=String(l).replace(/<br \/>\s*\n\s*/g,"<br />").replace(/\s+/g," ");return u.replace(/\s+\./g,".").trim()}(i.children,r);let J;const X="JSXAttribute"===o?.type?n(o):void 0;if(void 0!==X)J=X;else{const e=r.extract.defaultValue;J="string"==typeof e?e:""}let h,b;if("JSXAttribute"===s?.type){if("StringLiteral"===s.value?.type){if(h=s.value,b=h.value,!b||""===b.trim())return null;if(x&&"StringLiteral"===h.type){const e=r.extract.nsSeparator??":",t=h.value;if(e&&t.startsWith(`${x}${e}`)){if(b=t.slice(`${x}${e}`.length),!b||""===b.trim())return null;h={...h,value:b}}}}else"JSXExpressionContainer"===s.value?.type&&"JSXEmptyExpression"!==s.value.expression.type&&(h=s.value.expression);if(!h)return null}return o||!b||m.trim()?!o&&m.trim()&&(J=m):J=b,{keyExpression:h,serializedChildren:m,ns:x,defaultValue:J,hasCount:u,isOrdinal:g,contextExpression:v,optionsNode:c,explicitDefault:void 0!==X||(e=>{if(!e||!Array.isArray(e.properties))return!1;for(const t of e.properties)if(t&&"KeyValueProperty"===t.type&&t.key){const e="Identifier"===t.key.type&&t.key.value||"StringLiteral"===t.key.type&&t.key.value;if("string"==typeof e&&e.startsWith("defaultValue"))return!0}return!1})(c)}};
package/dist/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var r=require("./config.js"),e=require("./extractor/core/extractor.js"),t=require("./extractor/core/key-finder.js"),n=require("./extractor/core/translation-manager.js"),s=require("./linter.js"),o=require("./syncer.js"),a=require("./status.js"),i=require("./types-generator.js");exports.defineConfig=r.defineConfig,exports.extract=e.extract,exports.runExtractor=e.runExtractor,exports.findKeys=t.findKeys,exports.getTranslations=n.getTranslations,exports.runLinter=s.runLinter,exports.runSyncer=o.runSyncer,exports.runStatus=a.runStatus,exports.runTypesGenerator=i.runTypesGenerator;
1
+ "use strict";var r=require("./config.js"),e=require("./extractor/core/extractor.js"),t=require("./extractor/core/key-finder.js"),n=require("./extractor/core/translation-manager.js"),s=require("./linter.js"),o=require("./syncer.js"),a=require("./status.js"),u=require("./types-generator.js"),i=require("./rename-key.js");exports.defineConfig=r.defineConfig,exports.extract=e.extract,exports.runExtractor=e.runExtractor,exports.findKeys=t.findKeys,exports.getTranslations=n.getTranslations,exports.runLinter=s.runLinter,exports.runSyncer=o.runSyncer,exports.runStatus=a.runStatus,exports.runTypesGenerator=u.runTypesGenerator,exports.runRenameKey=i.runRenameKey;
@@ -0,0 +1 @@
1
+ "use strict";var e=require("glob"),t=require("node:fs/promises"),n=require("./utils/logger.js"),r=require("./utils/file-utils.js"),o=require("node:path"),a=require("./utils/nested-object.js"),i=require("./utils/funnel-msg-tracker.js"),s=require("chalk");function c(e,t){const n=t.extract.nsSeparator??":";if(n&&e.includes(n)){const[t,...r]=e.split(n);return{namespace:t,key:r.join(n),fullKey:e}}return{namespace:t.extract.defaultNS||"translation",key:e,fullKey:e}}async function l(e,t,n,r){return function(e,t,n,r){let o=0,a=e;const i=r.extract.nsSeparator??":",s=e=>i&&e.includes(String(i))?n.fullKey:n.key,c=r.extract.functions||["t","*.t"],l=[];for(const e of c)if(e.startsWith("*.")){const n=u(e.substring(1));l.push({pattern:new RegExp(`\\w+${n}\\((['"\`])${u(t.fullKey)}\\1`,"g"),original:t.fullKey}),l.push({pattern:new RegExp(`\\w+${n}\\((['"\`])${u(t.key)}\\1`,"g"),original:t.key})}else{const n=u(e);l.push({pattern:new RegExp(`\\b${n}\\((['"\`])${u(t.fullKey)}\\1`,"g"),original:t.fullKey}),l.push({pattern:new RegExp(`\\b${n}\\((['"\`])${u(t.key)}\\1`,"g"),original:t.key})}for(const{pattern:e,original:t}of l)if(e.test(a)){const n=s(t);a=a.replace(e,(e,t)=>{o++;const r=e.match(/^(\w+(?:\.\w+)*)\(/);return r?`${r[1]}(${t}${n}${t}`:e})}const f=[{pattern:new RegExp(`i18nKey=(['"\`])${u(t.fullKey)}\\1`,"g"),original:t.fullKey},{pattern:new RegExp(`i18nKey=(['"\`])${u(t.key)}\\1`,"g"),original:t.key}];for(const{pattern:e,original:t}of f)if(e.test(a)){const n=s(t);a=a.replace(e,(e,t)=>(o++,`i18nKey=${t}${n}${t}`))}return{newCode:a,changes:o}}(e,t,n,r)}function u(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function f(e,t,n){if(!1===n)return void delete e[t];const r=t.split(String(n));let o=e;for(let e=0;e<r.length-1;e++){if(!o[r[e]])return;o=o[r[e]]}delete o[r[r.length-1]]}exports.runRenameKey=async function(u,g,p,y={},d=new n.ConsoleLogger){const{dryRun:w=!1}=y,h=function(e,t){if(!e||!e.trim())return{valid:!1,error:"Old key cannot be empty"};if(!t||!t.trim())return{valid:!1,error:"New key cannot be empty"};if(e===t)return{valid:!1,error:"Old and new keys are identical"};return{valid:!0}}(g,p);if(!h.valid)return{success:!1,sourceFiles:[],translationFiles:[],error:h.error};const $=c(g,u),m=c(p,u),k=await async function(e,t){const n=[];for(const i of t.locales){const s=r.getOutputPath(t.extract.output,i,e.namespace),c=o.resolve(process.cwd(),s);try{const o=await r.loadTranslationFile(c);if(o){const r=t.extract.keySeparator??".";void 0!==a.getNestedValue(o,e.key,r)&&n.push(`${i}:${e.fullKey}`)}}catch{}}return n}(m,u);if(k.length>0)return{success:!1,sourceFiles:[],translationFiles:[],conflicts:k,error:"Target key already exists in translation files"};d.info(`🔍 Scanning for usages of "${g}"...`);const x=await async function(n,r,o,a,i){const s=["node_modules/**"],c=Array.isArray(o.extract.ignore)?o.extract.ignore:o.extract.ignore?[o.extract.ignore]:[],u=Array.isArray(o.extract.input)?o.extract.input:[o.extract.input],f=u.map(e=>e.replace(/\\/g,"/")),g=await e.glob(f,{ignore:[...s,...c],cwd:process.cwd()}),p=[];for(const e of g){const s=await t.readFile(e,"utf-8"),{newCode:c,changes:u}=await l(s,n,r,o);u>0&&(a||await t.writeFile(e,c,"utf-8"),p.push({path:e,changes:u}),i.info(` ${a?"(dry-run) ":""}✓ ${e} (${u} ${1===u?"change":"changes"})`))}p.length>0&&i.info(`\n📝 Source file changes: ${p.length} file${1===p.length?"":"s"}`);return p}($,m,u,w,d),F=await async function(e,n,i,s,c){const l=[],u=i.extract.keySeparator??".";for(const g of i.locales){const p=r.getOutputPath(i.extract.output,g,e.namespace),y=o.resolve(process.cwd(),p);try{const o=await r.loadTranslationFile(y);if(!o)continue;const g=a.getNestedValue(o,e.key,u);if(void 0===g)continue;if(f(o,e.key,u),a.setNestedValue(o,n.key,g,u),!s){const e=r.serializeTranslationFile(o,i.extract.outputFormat,i.extract.indentation);await t.writeFile(y,e,"utf-8")}l.push({path:y,updated:!0}),c.info(` ${s?"(dry-run) ":""}✓ ${y}`)}catch(e){}}l.length>0&&c.info(`\n📦 Translation file updates: ${l.length} file${1===l.length?"":"s"}`);return l}($,m,u,w,d),K=x.reduce((e,t)=>e+t.changes,0);return!w&&K>0?(d.info("\n✨ Successfully renamed key!"),d.info(` Old: "${g}"`),d.info(` New: "${p}"`),await async function(){if(!await i.shouldShowFunnel("rename-key"))return;return console.log(s.yellow.bold("\n💡 Tip: Managing translations across multiple projects?")),console.log(" With locize, you can rename, move, and copy translation keys directly"),console.log(" in the web interface—no CLI needed. Perfect for collaboration with"),console.log(" translators and managing complex refactoring across namespaces."),console.log(` Learn more: ${s.cyan("https://www.locize.com/docs/how-can-a-segment-key-be-copied-moved-or-renamed")}`),i.recordFunnelShown("rename-key")}()):0===K&&d.info(`\n⚠️ No usages found for "${g}"`),{success:!0,sourceFiles:x,translationFiles:F}};
package/dist/esm/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{Command as t}from"commander";import o from"chokidar";import{glob as e}from"glob";import{minimatch as i}from"minimatch";import n from"chalk";import{ensureConfig as a,loadConfig as r}from"./config.js";import{detectConfig as c}from"./heuristic-config.js";import{runExtractor as s}from"./extractor/core/extractor.js";import"node:path";import"node:fs/promises";import"jiti";import{runTypesGenerator as l}from"./types-generator.js";import{runSyncer as p}from"./syncer.js";import{runMigrator as m}from"./migrator.js";import{runInit as f}from"./init.js";import{runLinterCli as d}from"./linter.js";import{runStatus as g}from"./status.js";import{runLocizeSync as u,runLocizeDownload as y,runLocizeMigrate as h}from"./locize.js";const w=new t;w.name("i18next-cli").description("A unified, high-performance i18next CLI.").version("1.23.7"),w.option("-c, --config <path>","Path to i18next-cli config file (overrides detection)"),w.command("extract").description("Extract translation keys from source files and update resource files.").option("-w, --watch","Watch for file changes and re-run the extractor.").option("--ci","Exit with a non-zero status code if any files are updated.").option("--dry-run","Run the extractor without writing any files to disk.").option("--sync-primary","Sync primary language values with default values from code.").action(async t=>{try{const e=w.opts().config,n=await a(e),r=async()=>{const o=await s(n,{isWatchMode:!!t.watch,isDryRun:!!t.dryRun,syncPrimaryWithDefaults:!!t.syncPrimary});return t.ci&&!o?(console.log("✅ No files were updated."),process.exit(0)):t.ci&&o&&(console.error("❌ Some files were updated. This should not happen in CI mode."),process.exit(1)),o};if(await r(),t.watch){console.log("\nWatching for changes...");const t=await z(n.extract.input),e=x(n.extract.ignore),a=j(n.extract.output),c=[...e,...a].filter(Boolean),s=t.filter(t=>!c.some(o=>i(t,o,{dot:!0})));o.watch(s,{ignored:/node_modules/,persistent:!0}).on("change",t=>{console.log(`\nFile changed: ${t}`),r()})}}catch(t){console.error("Error running extractor:",t),process.exit(1)}}),w.command("status [locale]").description("Display translation status. Provide a locale for a detailed key-by-key view.").option("-n, --namespace <ns>","Filter the status report by a specific namespace").action(async(t,o)=>{const e=w.opts().config;let i=await r(e);if(!i){console.log(n.blue("No config file found. Attempting to detect project structure..."));const t=await c();t||(console.error(n.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${n.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(n.green("Project structure detected successfully!")),i=t}await g(i,{detail:t,namespace:o.namespace})}),w.command("types").description("Generate TypeScript definitions from translation resource files.").option("-w, --watch","Watch for file changes and re-run the type generator.").action(async t=>{const e=w.opts().config,n=await a(e),r=()=>l(n);if(await r(),t.watch){console.log("\nWatching for changes...");const t=await z(n.types?.input||[]),e=[...x(n.extract?.ignore)].filter(Boolean),a=t.filter(t=>!e.some(o=>i(t,o,{dot:!0})));o.watch(a,{persistent:!0}).on("change",t=>{console.log(`\nFile changed: ${t}`),r()})}}),w.command("sync").description("Synchronize secondary language files with the primary language file.").action(async()=>{const t=w.opts().config,o=await a(t);await p(o)}),w.command("migrate-config [configPath]").description("Migrate a legacy i18next-parser.config.js to the new format.").action(async t=>{await m(t)}),w.command("init").description("Create a new i18next.config.ts/js file with an interactive setup wizard.").action(f),w.command("lint").description("Find potential issues like hardcoded strings in your codebase.").option("-w, --watch","Watch for file changes and re-run the linter.").action(async t=>{const e=w.opts().config,a=async()=>{let t=await r(e);if(!t){console.log(n.blue("No config file found. Attempting to detect project structure..."));const o=await c();o||(console.error(n.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${n.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(n.green("Project structure detected successfully!")),t=o}await d(t)};if(await a(),t.watch){console.log("\nWatching for changes...");const t=await r(e);if(t?.extract?.input){const e=await z(t.extract.input),n=[...x(t.extract.ignore),...j(t.extract.output)].filter(Boolean),r=e.filter(t=>!n.some(o=>i(t,o,{dot:!0})));o.watch(r,{ignored:/node_modules/,persistent:!0}).on("change",t=>{console.log(`\nFile changed: ${t}`),a()})}}}),w.command("locize-sync").description("Synchronize local translations with your locize project.").option("--update-values","Update values of existing translations on locize.").option("--src-lng-only","Check for changes in source language only.").option("--compare-mtime","Compare modification times when syncing.").option("--dry-run","Run the command without making any changes.").action(async t=>{const o=w.opts().config,e=await a(o);await u(e,t)}),w.command("locize-download").description("Download all translations from your locize project.").action(async t=>{const o=w.opts().config,e=await a(o);await y(e,t)}),w.command("locize-migrate").description("Migrate local translation files to a new locize project.").action(async t=>{const o=w.opts().config,e=await a(o);await h(e,t)}),w.parse(process.argv);const x=t=>Array.isArray(t)?t:t?[t]:[],j=t=>t&&"string"==typeof t?[t.replace(/\{\{[^}]+\}\}/g,"*")]:[],z=async(t=[])=>{const o=x(t),i=await Promise.all(o.map(t=>e(t||"",{nodir:!0})));return Array.from(new Set(i.flat()))};
2
+ import{Command as o}from"commander";import e from"chokidar";import{glob as t}from"glob";import{minimatch as n}from"minimatch";import i from"chalk";import{ensureConfig as a,loadConfig as r}from"./config.js";import{detectConfig as c}from"./heuristic-config.js";import{runExtractor as s}from"./extractor/core/extractor.js";import"node:path";import"node:fs/promises";import"jiti";import{runTypesGenerator as l}from"./types-generator.js";import{runSyncer as p}from"./syncer.js";import{runMigrator as f}from"./migrator.js";import{runInit as m}from"./init.js";import{runLinterCli as d}from"./linter.js";import{runStatus as g}from"./status.js";import{runLocizeSync as u,runLocizeDownload as y,runLocizeMigrate as h}from"./locize.js";import{runRenameKey as w}from"./rename-key.js";const x=new o;x.name("i18next-cli").description("A unified, high-performance i18next CLI.").version("1.24.1"),x.option("-c, --config <path>","Path to i18next-cli config file (overrides detection)"),x.command("extract").description("Extract translation keys from source files and update resource files.").option("-w, --watch","Watch for file changes and re-run the extractor.").option("--ci","Exit with a non-zero status code if any files are updated.").option("--dry-run","Run the extractor without writing any files to disk.").option("--sync-primary","Sync primary language values with default values from code.").action(async o=>{try{const t=x.opts().config,i=await a(t),r=async()=>{const e=await s(i,{isWatchMode:!!o.watch,isDryRun:!!o.dryRun,syncPrimaryWithDefaults:!!o.syncPrimary});return o.ci&&!e?(console.log("✅ No files were updated."),process.exit(0)):o.ci&&e&&(console.error("❌ Some files were updated. This should not happen in CI mode."),process.exit(1)),e};if(await r(),o.watch){console.log("\nWatching for changes...");const o=await z(i.extract.input),t=j(i.extract.ignore),a=k(i.extract.output),c=[...t,...a].filter(Boolean),s=o.filter(o=>!c.some(e=>n(o,e,{dot:!0})));e.watch(s,{ignored:/node_modules/,persistent:!0}).on("change",o=>{console.log(`\nFile changed: ${o}`),r()})}}catch(o){console.error("Error running extractor:",o),process.exit(1)}}),x.command("status [locale]").description("Display translation status. Provide a locale for a detailed key-by-key view.").option("-n, --namespace <ns>","Filter the status report by a specific namespace").action(async(o,e)=>{const t=x.opts().config;let n=await r(t);if(!n){console.log(i.blue("No config file found. Attempting to detect project structure..."));const o=await c();o||(console.error(i.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${i.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(i.green("Project structure detected successfully!")),n=o}await g(n,{detail:o,namespace:e.namespace})}),x.command("types").description("Generate TypeScript definitions from translation resource files.").option("-w, --watch","Watch for file changes and re-run the type generator.").action(async o=>{const t=x.opts().config,i=await a(t),r=()=>l(i);if(await r(),o.watch){console.log("\nWatching for changes...");const o=await z(i.types?.input||[]),t=[...j(i.extract?.ignore)].filter(Boolean),a=o.filter(o=>!t.some(e=>n(o,e,{dot:!0})));e.watch(a,{persistent:!0}).on("change",o=>{console.log(`\nFile changed: ${o}`),r()})}}),x.command("sync").description("Synchronize secondary language files with the primary language file.").action(async()=>{const o=x.opts().config,e=await a(o);await p(e)}),x.command("migrate-config [configPath]").description("Migrate a legacy i18next-parser.config.js to the new format.").action(async o=>{await f(o)}),x.command("init").description("Create a new i18next.config.ts/js file with an interactive setup wizard.").action(m),x.command("lint").description("Find potential issues like hardcoded strings in your codebase.").option("-w, --watch","Watch for file changes and re-run the linter.").action(async o=>{const t=x.opts().config,a=async()=>{let o=await r(t);if(!o){console.log(i.blue("No config file found. Attempting to detect project structure..."));const e=await c();e||(console.error(i.red("Could not automatically detect your project structure.")),console.log(`Please create a config file first by running: ${i.cyan("npx i18next-cli init")}`),process.exit(1)),console.log(i.green("Project structure detected successfully!")),o=e}await d(o)};if(await a(),o.watch){console.log("\nWatching for changes...");const o=await r(t);if(o?.extract?.input){const t=await z(o.extract.input),i=[...j(o.extract.ignore),...k(o.extract.output)].filter(Boolean),r=t.filter(o=>!i.some(e=>n(o,e,{dot:!0})));e.watch(r,{ignored:/node_modules/,persistent:!0}).on("change",o=>{console.log(`\nFile changed: ${o}`),a()})}}}),x.command("locize-sync").description("Synchronize local translations with your locize project.").option("--update-values","Update values of existing translations on locize.").option("--src-lng-only","Check for changes in source language only.").option("--compare-mtime","Compare modification times when syncing.").option("--dry-run","Run the command without making any changes.").action(async o=>{const e=x.opts().config,t=await a(e);await u(t,o)}),x.command("locize-download").description("Download all translations from your locize project.").action(async o=>{const e=x.opts().config,t=await a(e);await y(t,o)}),x.command("locize-migrate").description("Migrate local translation files to a new locize project.").action(async o=>{const e=x.opts().config,t=await a(e);await h(t,o)}),x.command("rename-key <oldKey> <newKey>").description("Rename a translation key across all source files and translation files.").option("--dry-run","Preview changes without modifying files").action(async(o,e,t)=>{try{const n=x.opts().config,r=await a(n),c=await w(r,o,e,t);c.success||(c.conflicts&&(console.error(i.red("\n❌ Conflicts detected:")),c.conflicts.forEach(o=>console.error(` - ${o}`))),c.error&&console.error(i.red(`\n❌ ${c.error}`)),process.exit(1));0===c.sourceFiles.reduce((o,e)=>o+e.changes,0)&&console.log(i.yellow(`\n⚠️ No usages found for "${o}"`))}catch(o){console.error(i.red("Error renaming key:"),o),process.exit(1)}}),x.parse(process.argv);const j=o=>Array.isArray(o)?o:o?[o]:[],k=o=>o&&"string"==typeof o?[o.replace(/\{\{[^}]+\}\}/g,"*")]:[],z=async(o=[])=>{const e=j(o),n=await Promise.all(e.map(o=>t(o||"",{nodir:!0})));return Array.from(new Set(n.flat()))};
@@ -1 +1 @@
1
- import{getObjectPropValueExpression as e,getObjectPropValue as t,isSimpleTemplateLiteral as n}from"./ast-utils.js";function i(e){if(e)return"StringLiteral"===e.type?e.value:"TemplateLiteral"===e.type&&n(e)?e.quasis[0].cooked:void 0}function r(e){return"StringLiteral"===e.value?.type?e.value.value:"JSXExpressionContainer"===e.value?.type?i(e.value.expression):void 0}function o(n,o){const s=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"i18nKey"===e.name.value),p=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"defaults"===e.name.value),a=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"count"===e.name.value),l=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"values"===e.name.value);let u;a||"JSXAttribute"!==l?.type||"JSXExpressionContainer"!==l.value?.type||"ObjectExpression"!==l.value.expression.type||(u=e(l.value.expression,"count"));const y=!!a||!!u,f=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"tOptions"===e.name.value),c="JSXAttribute"===f?.type&&"JSXExpressionContainer"===f.value?.type&&"ObjectExpression"===f.value.expression.type?f.value.expression:void 0,g=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"ordinal"===e.name.value),d=!!g,v=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"context"===e.name.value);let S="JSXAttribute"===v?.type&&"JSXExpressionContainer"===v.value?.type?v.value.expression:"JSXAttribute"===v?.type&&"StringLiteral"===v.value?.type?v.value:void 0;const x=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"ns"===e.name.value);let J;J="JSXAttribute"===x?.type?r(x):void 0,c&&(void 0===J&&(J=t(c,"ns")),void 0===S&&(S=e(c,"context")));const X=function(e,t){if(!e||0===e.length)return"";const n=new Set(t.extract.transKeepBasicHtmlNodesFor??["br","strong","i","p"]),r=e=>e&&"JSXText"===e.type&&/^\s*$/.test(e.value)&&e.value.includes("\n");function o(e,t,s=!1,p=!1){if(!e||!e.length)return;const a=p&&e.filter(e=>e&&"JSXElement"===e.type&&"p"===e.opening?.name?.value).length>1;let l=0,u=e.length-1;for(;l<=u&&r(e[l]);)l++;for(;u>=l&&r(e[u]);)u--;const y=l<=u?e.slice(l,u+1):[],f=y.some(e=>e&&("JSXElement"===e.type||"JSXFragment"===e.type));for(let e=0;e<y.length;e++){const p=y[e];if(p)if("JSXText"!==p.type){if("JSXExpressionContainer"===p.type){if(s&&!f&&p.expression){const e=p.expression.type;if("ObjectExpression"===e){const e=p.expression.properties&&p.expression.properties[0];if(e&&"KeyValueProperty"===e.type)continue}const t=i(p.expression);if(void 0!==t){if(!(/^\s*$/.test(t)&&!t.includes("\n")))continue}else if("Identifier"===e||"MemberExpression"===e||"CallExpression"===e)continue}const n=i(p.expression);if(void 0!==n){const i=/^\s*$/.test(n)&&!n.includes("\n"),o=y[e-1],s=y[e+1];if(i){const n=y[e+2];if(s&&"JSXText"===s.type&&r(s)&&n&&("JSXElement"===n.type||"JSXFragment"===n.type)){const t=y[e-1],n=y[e-2];if(!t||"JSXText"!==t.type&&n&&"JSXExpressionContainer"===n.type)continue}if(o&&("JSXElement"===o.type||"JSXFragment"===o.type)&&s&&"JSXText"===s.type&&r(s))continue;const i=!s||"JSXText"===s.type&&!r(s);if(o&&"JSXText"===o.type&&i){const e=t[t.length-1];if(e&&"JSXText"===e.type){e.value=String(e.value)+p.expression.value;continue}}if(o&&("JSXElement"===o.type||"JSXFragment"===o.type)&&s&&"JSXText"===s.type&&r(s))continue}}t.push(p);continue}if("JSXElement"===p.type){const e=p.opening&&p.opening.name&&"Identifier"===p.opening.name.type?p.opening.name.value:void 0;if(e&&n.has(e)){const n=p.opening&&Array.isArray(p.opening.attributes)&&p.opening.attributes.length>0,r=p.children||[],s=1===r.length&&("JSXText"===r[0]?.type||"JSXExpressionContainer"===r[0]?.type&&void 0!==i(r[0].expression)),l=!r.length,u=s;n&&!s?(t.push(p),o(p.children||[],t,!0)):l?t.push(p):u||("p"===e&&a?(t.push(p),o(p.children||[],t,!0,!1)):o(p.children||[],t,!1,!1));continue}t.push(p),o(p.children||[],t,!0);continue}"JSXFragment"!==p.type||o(p.children||[],t,s)}else{if(s&&!f)continue;if(s&&r(p))continue;if(r(p)){const n=y[e-1],i=y[e+1];if(n&&("JSXElement"===n.type||"JSXFragment"===n.type)&&i&&("JSXElement"===i.type||"JSXFragment"===i.type))continue;const r=t[t.length-1],o=y[e-1];if(r){if(o&&"JSXExpressionContainer"===o.type)continue;if("JSXText"===r.type&&o&&"JSXText"===o.type){r.value=String(r.value)+p.value;continue}}}if(s&&f&&0===e)continue;t.push(p)}}}const s=[];o(e,s,!1,!0);const p=e=>String(e).replace(/^\s*\n\s*/g,"").replace(/\s*\n\s*$/g,"");function a(e,t,o=!1){if(!e||0===e.length)return"";let l="",u=0;for(let y=0;y<e.length;y++){const f=e[y];if(f)if("JSXText"!==f.type){if("JSXExpressionContainer"===f.type){const e=f.expression;if(!e)continue;const t=i(e);if(void 0!==t)l+=t;else if("Identifier"===e.type)l+=`{{${e.value}}}`;else if("ObjectExpression"===e.type){const t=e.properties[0];t&&"KeyValueProperty"===t.type&&t.key&&"Identifier"===t.key.type?l+=`{{${t.key.value}}}`:t&&"Identifier"===t.type?l+=`{{${t.value}}}`:l+="{{value}}"}else"MemberExpression"===e.type&&e.property&&"Identifier"===e.property.type?l+=`{{${e.property.value}}}`:"CallExpression"===e.type&&"Identifier"===e.callee?.type?l+=`{{${e.callee.value}}}`:l+="{{value}}";continue}if("JSXElement"===f.type){let c;f.opening&&f.opening.name&&"Identifier"===f.opening.name.type&&(c=f.opening.name.value);const g=o?u:void 0;if(o&&"JSXElement"===f.type&&u++,c&&n.has(c)){const o=f.opening&&Array.isArray(f.opening.attributes)&&f.opening.attributes.length>0,u=f.children||[],d=u.length>0,v=1===u.length&&("JSXText"===u[0]?.type||"JSXExpressionContainer"===u[0]?.type&&void 0!==i(u[0].expression));if(!d||v){const t=v?a(u,void 0):"";if(""!==String(t).trim())l+=`<${c}>${t}</${c}>`;else{const t=e[y-1];t&&"JSXText"===t.type&&/\n\s*$/.test(t.value)&&(l=l.replace(/\s+$/,"")),l+=`<${c} />`}}else if(o&&!v){const e=u;if(e.some(e=>e&&("JSXText"===e.type||"JSXExpressionContainer"===e.type)&&-1!==s.indexOf(e))){const t=s.indexOf(f),n=a(e,void 0);l+=`<${t}>${p(n)}</${t}>`}else{const i=new Map;let r=0;for(const t of e)if(t&&"JSXElement"===t.type){const e=t.opening&&t.opening.name&&"Identifier"===t.opening.name.type?t.opening.name.value:void 0;if(e&&n.has(e)){const e=t.opening&&Array.isArray(t.opening.attributes)&&t.opening.attributes.length>0,n=t.children||[],o=1===n.length&&"JSXText"===n[0]?.type;(e||n.length&&!o)&&i.set(t,r++)}else i.set(t,r++)}const o=t&&t.has(f)?t.get(f):s.indexOf(f),u=a(e,i.size?i:void 0);l+=`<${o}>${p(u)}</${o}>`}}else{const e=s.indexOf(f);if(-1!==e){const t=void 0!==g?g:e;if((()=>{let e=!1;for(const t of u)if(t)if("JSXElement"!==t.type){if("JSXExpressionContainer"===t.type&&-1!==s.indexOf(t))return e;if("JSXText"===t.type&&-1!==s.indexOf(t)){if(r(t))continue;if(!e)return!0;if(u.slice(u.indexOf(t)+1).some(e=>e&&"JSXElement"===e.type))return!0}}else e=!0;return!1})()){const e=a(u,void 0,!1);l+=`<${t}>${p(e)}</${t}>`;continue}const o=new Map;let y=t;for(const e of u)if(e&&"JSXElement"===e.type){const t=e.opening&&e.opening.name&&"Identifier"===e.opening.name.type?e.opening.name.value:void 0;if(t&&n.has(t)){const t=e.opening&&Array.isArray(e.opening.attributes)&&e.opening.attributes.length>0,n=e.children||[],r=1===n.length&&("JSXText"===n[0]?.type||"JSXExpressionContainer"===n[0]?.type&&void 0!==i(n[0].expression));!t&&(!n.length||r)||o.set(e,y++)}else o.set(e,y++)}const f=a(u,o.size>0?o:void 0,!1);l+=`<${t}>${p(f)}</${t}>`}else{const e=a(u,void 0,!1);l+=`<${c}>${p(e)}</${c}>`}}}else{const e=f.children||[];if(e.some(e=>e&&("JSXText"===e.type||"JSXExpressionContainer"===e.type)&&-1!==s.indexOf(e))){const t=s.indexOf(f),n=a(e,void 0);l+=`<${t}>${p(n)}</${t}>`}else{const i=new Map;let r=0;for(const t of e)if(t&&"JSXElement"===t.type){const e=t.opening&&t.opening.name&&"Identifier"===t.opening.name.type?t.opening.name.value:void 0;if(e&&n.has(e)){const e=t.opening&&Array.isArray(t.opening.attributes)&&t.opening.attributes.length>0,n=t.children||[],o=1===n.length&&"JSXText"===n[0]?.type;!e&&(!n.length||o)||i.set(t,r++)}else i.set(t,r++)}const o=t&&t.has(f)?t.get(f):s.indexOf(f),u=a(e,i.size?i:void 0);l+=`<${o}>${p(u)}</${o}>`}}continue}"JSXFragment"!==f.type||(l+=a(f.children||[]))}else{if(r(f))continue;l+=f.value}}return l}const l=a(e,void 0,!0),u=String(l).replace(/<br \/>\s*\n\s*/g,"<br />").replace(/\s+/g," ");return u.replace(/\s+\./g,".").trim()}(n.children,o);let m;const h="JSXAttribute"===p?.type?r(p):void 0;if(void 0!==h)m=h;else{const e=o.extract.defaultValue;m="string"==typeof e?e:""}let b,E;if("JSXAttribute"===s?.type){if("StringLiteral"===s.value?.type){if(b=s.value,E=b.value,!E||""===E.trim())return null;if(J&&"StringLiteral"===b.type){const e=o.extract.nsSeparator??":",t=b.value;if(e&&t.startsWith(`${J}${e}`)){if(E=t.slice(`${J}${e}`.length),!E||""===E.trim())return null;b={...b,value:E}}}}else"JSXExpressionContainer"===s.value?.type&&"JSXEmptyExpression"!==s.value.expression.type&&(b=s.value.expression);if(!b)return null}p||!E||X.trim()?!p&&X.trim()&&(m=X):m=E;return{keyExpression:b,serializedChildren:X,ns:J,defaultValue:m,hasCount:y,isOrdinal:d,contextExpression:S,optionsNode:c,explicitDefault:void 0!==h||(e=>{if(!e||!Array.isArray(e.properties))return!1;for(const t of e.properties)if(t&&"KeyValueProperty"===t.type&&t.key){const e="Identifier"===t.key.type&&t.key.value||"StringLiteral"===t.key.type&&t.key.value;if("string"==typeof e&&e.startsWith("defaultValue"))return!0}return!1})(c)}}export{o as extractFromTransComponent};
1
+ import{getObjectPropValueExpression as e,getObjectPropValue as t,isSimpleTemplateLiteral as n}from"./ast-utils.js";function i(e){if(e)return"StringLiteral"===e.type?e.value:"TemplateLiteral"===e.type&&n(e)?e.quasis[0].cooked:void 0}function s(e){return"StringLiteral"===e.value?.type?e.value.value:"JSXExpressionContainer"===e.value?.type?i(e.value.expression):void 0}function r(n,r){const o=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"i18nKey"===e.name.value),p=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"defaults"===e.name.value),a=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"count"===e.name.value),l=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"values"===e.name.value);let u;a||"JSXAttribute"!==l?.type||"JSXExpressionContainer"!==l.value?.type||"ObjectExpression"!==l.value.expression.type||(u=e(l.value.expression,"count"));const y=!!a||!!u,f=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"tOptions"===e.name.value),c="JSXAttribute"===f?.type&&"JSXExpressionContainer"===f.value?.type&&"ObjectExpression"===f.value.expression.type?f.value.expression:void 0,g=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"ordinal"===e.name.value),d=!!g,v=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"context"===e.name.value);let S="JSXAttribute"===v?.type&&"JSXExpressionContainer"===v.value?.type?v.value.expression:"JSXAttribute"===v?.type&&"StringLiteral"===v.value?.type?v.value:void 0;const x=n.opening.attributes?.find(e=>"JSXAttribute"===e.type&&"Identifier"===e.name.type&&"ns"===e.name.value);let J;J="JSXAttribute"===x?.type?s(x):void 0,c&&(void 0===J&&(J=t(c,"ns")),void 0===S&&(S=e(c,"context")));const X=function(e,t){if(!e||0===e.length)return"";const n=new Set(t.extract.transKeepBasicHtmlNodesFor??["br","strong","i","p"]),s=e=>e&&"JSXText"===e.type&&/^\s*$/.test(e.value)&&e.value.includes("\n");function r(e,t,o=!1,p=!1){if(!e||!e.length)return;const a=p&&e.filter(e=>e&&"JSXElement"===e.type&&"p"===e.opening?.name?.value).length>1;let l=0,u=e.length-1;for(;l<=u&&s(e[l]);)l++;for(;u>=l&&s(e[u]);)u--;const y=l<=u?e.slice(l,u+1):[],f=y.some(e=>e&&("JSXElement"===e.type||"JSXFragment"===e.type));for(let e=0;e<y.length;e++){const p=y[e];if(p)if("JSXText"!==p.type){if("JSXExpressionContainer"===p.type){if(o&&!f&&p.expression){const e=p.expression.type;if("ObjectExpression"===e){const e=p.expression.properties&&p.expression.properties[0];if(e&&"KeyValueProperty"===e.type)continue}const t=i(p.expression);if(void 0!==t){if(!(/^\s*$/.test(t)&&!t.includes("\n")))continue}else if("Identifier"===e||"MemberExpression"===e||"CallExpression"===e)continue}const n=i(p.expression);if(void 0!==n){const i=/^\s*$/.test(n)&&!n.includes("\n"),r=y[e-1],o=y[e+1];if(i){const n=y[e+2];if(o&&"JSXText"===o.type&&s(o)&&n&&("JSXElement"===n.type||"JSXFragment"===n.type)){const t=y[e-1],n=y[e-2];if(!t||"JSXText"!==t.type&&n&&"JSXExpressionContainer"===n.type)continue}if(r&&("JSXElement"===r.type||"JSXFragment"===r.type)&&o&&"JSXText"===o.type&&s(o))continue;const i=!o||"JSXText"===o.type&&!s(o);if(r&&"JSXText"===r.type&&i){const e=t[t.length-1];if(e&&"JSXText"===e.type){e.value=String(e.value)+p.expression.value;continue}}if(r&&("JSXElement"===r.type||"JSXFragment"===r.type)&&o&&"JSXText"===o.type&&s(o))continue}}t.push(p);continue}if("JSXElement"===p.type){const e=p.opening&&p.opening.name&&"Identifier"===p.opening.name.type?p.opening.name.value:void 0;if(e&&n.has(e)){const n=p.opening&&Array.isArray(p.opening.attributes)&&p.opening.attributes.length>0,s=p.children||[],o=1===s.length&&("JSXText"===s[0]?.type||"JSXExpressionContainer"===s[0]?.type&&void 0!==i(s[0].expression)),l=!s.length,u=o;n&&!o?(t.push(p),r(p.children||[],t,!0)):l?t.push(p):u||("p"===e&&a?(t.push(p),r(p.children||[],t,!0,!1)):r(p.children||[],t,!1,!1));continue}t.push(p),r(p.children||[],t,!0);continue}"JSXFragment"!==p.type||r(p.children||[],t,o)}else{if(o&&!f)continue;if(o&&s(p))continue;if(s(p)){const n=y[e-1],i=y[e+1];if(n&&("JSXElement"===n.type||"JSXFragment"===n.type)&&i&&("JSXElement"===i.type||"JSXFragment"===i.type))continue;const s=t[t.length-1],r=y[e-1];if(s){if(r&&"JSXExpressionContainer"===r.type)continue;if("JSXText"===s.type&&r&&"JSXText"===r.type){s.value=String(s.value)+p.value;continue}}}if(o&&f&&0===e)continue;t.push(p)}}}const o=[];r(e,o,!1,!0);const p=e=>String(e).replace(/^\s*\n\s*/g,"").replace(/\s*\n\s*$/g,"");function a(e,t,r=!1){if(!e||0===e.length)return"";let l="",u=0;for(let y=0;y<e.length;y++){const f=e[y];if(f){if("JSXText"===f.type){if(s(f))continue;const t=e[y+1];if(/\n\s*$/.test(f.value)&&t&&"JSXElement"===t.type){const t=f.value.replace(/\n\s*$/,"");if(t.trim()){const n=e[y+2],i=n&&"JSXText"===n.type&&!s(n)&&/[a-zA-Z0-9]/.test(n.value),r=/^\s/.test(t),o=t.trim(),p=r?" "+o:o;l+=/\s\n/.test(f.value)||i?p+" ":p;continue}}l+=f.value;continue}if("JSXExpressionContainer"===f.type){const e=f.expression;if(!e)continue;const t=i(e);if(void 0!==t)l+=t;else if("Identifier"===e.type)l+=`{{${e.value}}}`;else if("ObjectExpression"===e.type){const t=e.properties[0];t&&"KeyValueProperty"===t.type&&t.key&&"Identifier"===t.key.type?l+=`{{${t.key.value}}}`:t&&"Identifier"===t.type?l+=`{{${t.value}}}`:l+="{{value}}"}else"MemberExpression"===e.type&&e.property&&"Identifier"===e.property.type?l+=`{{${e.property.value}}}`:"CallExpression"===e.type&&"Identifier"===e.callee?.type?l+=`{{${e.callee.value}}}`:l+="{{value}}";continue}if("JSXElement"===f.type){let c;f.opening&&f.opening.name&&"Identifier"===f.opening.name.type&&(c=f.opening.name.value);const g=r?u:void 0;if(r&&"JSXElement"===f.type&&u++,c&&n.has(c)){const r=f.opening&&Array.isArray(f.opening.attributes)&&f.opening.attributes.length>0,u=f.children||[],d=u.length>0,v=1===u.length&&("JSXText"===u[0]?.type||"JSXExpressionContainer"===u[0]?.type&&void 0!==i(u[0].expression));if(!d||v){const t=v?a(u,void 0):"";if(""!==String(t).trim())l+=`<${c}>${t}</${c}>`;else{const t=e[y-1];t&&"JSXText"===t.type&&/\n\s*$/.test(t.value)&&(l=l.replace(/\s+$/,"")),l+=`<${c} />`}}else if(r&&!v){const e=u;if(e.some(e=>e&&("JSXText"===e.type||"JSXExpressionContainer"===e.type)&&-1!==o.indexOf(e))){const t=o.indexOf(f),n=a(e,void 0);l+=`<${t}>${p(n)}</${t}>`}else{const i=new Map;let s=0;for(const t of e)if(t&&"JSXElement"===t.type){const e=t.opening&&t.opening.name&&"Identifier"===t.opening.name.type?t.opening.name.value:void 0;if(e&&n.has(e)){const e=t.opening&&Array.isArray(t.opening.attributes)&&t.opening.attributes.length>0,n=t.children||[],r=1===n.length&&"JSXText"===n[0]?.type;(e||n.length&&!r)&&i.set(t,s++)}else i.set(t,s++)}const r=t&&t.has(f)?t.get(f):o.indexOf(f),u=a(e,i.size?i:void 0);l+=`<${r}>${p(u)}</${r}>`}}else{const e=o.indexOf(f);if(-1!==e){const t=void 0!==g?g:e;if((()=>{let e=!1;for(const t of u)if(t)if("JSXElement"!==t.type){if("JSXExpressionContainer"===t.type&&-1!==o.indexOf(t))return e;if("JSXText"===t.type&&-1!==o.indexOf(t)){if(s(t))continue;if(!e)return!0;if(u.slice(u.indexOf(t)+1).some(e=>e&&"JSXElement"===e.type))return!0}}else e=!0;return!1})()){const e=a(u,void 0,!1);l+=`<${t}>${p(e)}</${t}>`;continue}const r=new Map;let y=t;for(const e of u)if(e&&"JSXElement"===e.type){const t=e.opening&&e.opening.name&&"Identifier"===e.opening.name.type?e.opening.name.value:void 0;if(t&&n.has(t)){const t=e.opening&&Array.isArray(e.opening.attributes)&&e.opening.attributes.length>0,n=e.children||[],s=1===n.length&&("JSXText"===n[0]?.type||"JSXExpressionContainer"===n[0]?.type&&void 0!==i(n[0].expression));!t&&(!n.length||s)||r.set(e,y++)}else r.set(e,y++)}const f=a(u,r.size>0?r:void 0,!1);l+=`<${t}>${p(f)}</${t}>`}else{const e=a(u,void 0,!1);l+=`<${c}>${p(e)}</${c}>`}}}else{const e=f.children||[];if(e.some(e=>e&&("JSXText"===e.type||"JSXExpressionContainer"===e.type)&&-1!==o.indexOf(e))){const t=o.indexOf(f),n=a(e,void 0);l+=`<${t}>${p(n)}</${t}>`}else{const i=new Map;let s=0;for(const t of e)if(t&&"JSXElement"===t.type){const e=t.opening&&t.opening.name&&"Identifier"===t.opening.name.type?t.opening.name.value:void 0;if(e&&n.has(e)){const e=t.opening&&Array.isArray(t.opening.attributes)&&t.opening.attributes.length>0,n=t.children||[],r=1===n.length&&"JSXText"===n[0]?.type;!e&&(!n.length||r)||i.set(t,s++)}else i.set(t,s++)}const r=t&&t.has(f)?t.get(f):o.indexOf(f),u=a(e,i.size?i:void 0);l+=`<${r}>${p(u)}</${r}>`}}continue}"JSXFragment"!==f.type||(l+=a(f.children||[]))}}return l}const l=a(e,void 0,!0),u=String(l).replace(/<br \/>\s*\n\s*/g,"<br />").replace(/\s+/g," ");return u.replace(/\s+\./g,".").trim()}(n.children,r);let m;const h="JSXAttribute"===p?.type?s(p):void 0;if(void 0!==h)m=h;else{const e=r.extract.defaultValue;m="string"==typeof e?e:""}let E,b;if("JSXAttribute"===o?.type){if("StringLiteral"===o.value?.type){if(E=o.value,b=E.value,!b||""===b.trim())return null;if(J&&"StringLiteral"===E.type){const e=r.extract.nsSeparator??":",t=E.value;if(e&&t.startsWith(`${J}${e}`)){if(b=t.slice(`${J}${e}`.length),!b||""===b.trim())return null;E={...E,value:b}}}}else"JSXExpressionContainer"===o.value?.type&&"JSXEmptyExpression"!==o.value.expression.type&&(E=o.value.expression);if(!E)return null}p||!b||X.trim()?!p&&X.trim()&&(m=X):m=b;return{keyExpression:E,serializedChildren:X,ns:J,defaultValue:m,hasCount:y,isOrdinal:d,contextExpression:S,optionsNode:c,explicitDefault:void 0!==h||(e=>{if(!e||!Array.isArray(e.properties))return!1;for(const t of e.properties)if(t&&"KeyValueProperty"===t.type&&t.key){const e="Identifier"===t.key.type&&t.key.value||"StringLiteral"===t.key.type&&t.key.value;if("string"==typeof e&&e.startsWith("defaultValue"))return!0}return!1})(c)}}export{r as extractFromTransComponent};
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- export{defineConfig}from"./config.js";export{extract,runExtractor}from"./extractor/core/extractor.js";export{findKeys}from"./extractor/core/key-finder.js";export{getTranslations}from"./extractor/core/translation-manager.js";export{runLinter}from"./linter.js";export{runSyncer}from"./syncer.js";export{runStatus}from"./status.js";export{runTypesGenerator}from"./types-generator.js";
1
+ export{defineConfig}from"./config.js";export{extract,runExtractor}from"./extractor/core/extractor.js";export{findKeys}from"./extractor/core/key-finder.js";export{getTranslations}from"./extractor/core/translation-manager.js";export{runLinter}from"./linter.js";export{runSyncer}from"./syncer.js";export{runStatus}from"./status.js";export{runTypesGenerator}from"./types-generator.js";export{runRenameKey}from"./rename-key.js";
@@ -0,0 +1 @@
1
+ import{glob as e}from"glob";import{readFile as t,writeFile as n}from"node:fs/promises";import{ConsoleLogger as r}from"./utils/logger.js";import{getOutputPath as o,loadTranslationFile as a,serializeTranslationFile as i}from"./utils/file-utils.js";import{resolve as s}from"node:path";import{getNestedValue as c,setNestedValue as l}from"./utils/nested-object.js";import{shouldShowFunnel as u,recordFunnelShown as f}from"./utils/funnel-msg-tracker.js";import p from"chalk";async function g(g,m,h,$={},k=new r){const{dryRun:x=!1}=$,K=function(e,t){if(!e||!e.trim())return{valid:!1,error:"Old key cannot be empty"};if(!t||!t.trim())return{valid:!1,error:"New key cannot be empty"};if(e===t)return{valid:!1,error:"Old and new keys are identical"};return{valid:!0}}(m,h);if(!K.valid)return{success:!1,sourceFiles:[],translationFiles:[],error:K.error};const b=y(m,g),v=y(h,g),S=await async function(e,t){const n=[];for(const r of t.locales){const i=o(t.extract.output,r,e.namespace),l=s(process.cwd(),i);try{const o=await a(l);if(o){const a=t.extract.keySeparator??".";void 0!==c(o,e.key,a)&&n.push(`${r}:${e.fullKey}`)}}catch{}}return n}(v,g);if(S.length>0)return{success:!1,sourceFiles:[],translationFiles:[],conflicts:S,error:"Target key already exists in translation files"};k.info(`🔍 Scanning for usages of "${m}"...`);const j=await async function(r,o,a,i,s){const c=["node_modules/**"],l=Array.isArray(a.extract.ignore)?a.extract.ignore:a.extract.ignore?[a.extract.ignore]:[],u=Array.isArray(a.extract.input)?a.extract.input:[a.extract.input],f=u.map(e=>e.replace(/\\/g,"/")),p=await e(f,{ignore:[...c,...l],cwd:process.cwd()}),g=[];for(const e of p){const c=await t(e,"utf-8"),{newCode:l,changes:u}=await d(c,r,o,a);u>0&&(i||await n(e,l,"utf-8"),g.push({path:e,changes:u}),s.info(` ${i?"(dry-run) ":""}✓ ${e} (${u} ${1===u?"change":"changes"})`))}g.length>0&&s.info(`\n📝 Source file changes: ${g.length} file${1===g.length?"":"s"}`);return g}(b,v,g,x,k),F=await async function(e,t,r,u,f){const p=[],g=r.extract.keySeparator??".";for(const y of r.locales){const d=o(r.extract.output,y,e.namespace),m=s(process.cwd(),d);try{const o=await a(m);if(!o)continue;const s=c(o,e.key,g);if(void 0===s)continue;if(w(o,e.key,g),l(o,t.key,s,g),!u){const e=i(o,r.extract.outputFormat,r.extract.indentation);await n(m,e,"utf-8")}p.push({path:m,updated:!0}),f.info(` ${u?"(dry-run) ":""}✓ ${m}`)}catch(e){}}p.length>0&&f.info(`\n📦 Translation file updates: ${p.length} file${1===p.length?"":"s"}`);return p}(b,v,g,x,k),R=j.reduce((e,t)=>e+t.changes,0);return!x&&R>0?(k.info("\n✨ Successfully renamed key!"),k.info(` Old: "${m}"`),k.info(` New: "${h}"`),await async function(){if(!await u("rename-key"))return;return console.log(p.yellow.bold("\n💡 Tip: Managing translations across multiple projects?")),console.log(" With locize, you can rename, move, and copy translation keys directly"),console.log(" in the web interface—no CLI needed. Perfect for collaboration with"),console.log(" translators and managing complex refactoring across namespaces."),console.log(` Learn more: ${p.cyan("https://www.locize.com/docs/how-can-a-segment-key-be-copied-moved-or-renamed")}`),f("rename-key")}()):0===R&&k.info(`\n⚠️ No usages found for "${m}"`),{success:!0,sourceFiles:j,translationFiles:F}}function y(e,t){const n=t.extract.nsSeparator??":";if(n&&e.includes(n)){const[t,...r]=e.split(n);return{namespace:t,key:r.join(n),fullKey:e}}return{namespace:t.extract.defaultNS||"translation",key:e,fullKey:e}}async function d(e,t,n,r){return function(e,t,n,r){let o=0,a=e;const i=r.extract.nsSeparator??":",s=e=>i&&e.includes(String(i))?n.fullKey:n.key,c=r.extract.functions||["t","*.t"],l=[];for(const e of c)if(e.startsWith("*.")){const n=m(e.substring(1));l.push({pattern:new RegExp(`\\w+${n}\\((['"\`])${m(t.fullKey)}\\1`,"g"),original:t.fullKey}),l.push({pattern:new RegExp(`\\w+${n}\\((['"\`])${m(t.key)}\\1`,"g"),original:t.key})}else{const n=m(e);l.push({pattern:new RegExp(`\\b${n}\\((['"\`])${m(t.fullKey)}\\1`,"g"),original:t.fullKey}),l.push({pattern:new RegExp(`\\b${n}\\((['"\`])${m(t.key)}\\1`,"g"),original:t.key})}for(const{pattern:e,original:t}of l)if(e.test(a)){const n=s(t);a=a.replace(e,(e,t)=>{o++;const r=e.match(/^(\w+(?:\.\w+)*)\(/);return r?`${r[1]}(${t}${n}${t}`:e})}const u=[{pattern:new RegExp(`i18nKey=(['"\`])${m(t.fullKey)}\\1`,"g"),original:t.fullKey},{pattern:new RegExp(`i18nKey=(['"\`])${m(t.key)}\\1`,"g"),original:t.key}];for(const{pattern:e,original:t}of u)if(e.test(a)){const n=s(t);a=a.replace(e,(e,t)=>(o++,`i18nKey=${t}${n}${t}`))}return{newCode:a,changes:o}}(e,t,n,r)}function m(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function w(e,t,n){if(!1===n)return void delete e[t];const r=t.split(String(n));let o=e;for(let e=0;e<r.length-1;e++){if(!o[r[e]])return;o=o[r[e]]}delete o[r[r.length-1]]}export{g as runRenameKey};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next-cli",
3
- "version": "1.23.7",
3
+ "version": "1.24.1",
4
4
  "description": "A unified, high-performance i18next CLI.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.ts CHANGED
@@ -15,6 +15,7 @@ import { runInit } from './init'
15
15
  import { runLinterCli } from './linter'
16
16
  import { runStatus } from './status'
17
17
  import { runLocizeSync, runLocizeDownload, runLocizeMigrate } from './locize'
18
+ import { runRenameKey } from './rename-key'
18
19
  import type { I18nextToolkitConfig } from './types'
19
20
 
20
21
  const program = new Command()
@@ -22,7 +23,7 @@ const program = new Command()
22
23
  program
23
24
  .name('i18next-cli')
24
25
  .description('A unified, high-performance i18next CLI.')
25
- .version('1.23.7')
26
+ .version('1.24.1')
26
27
 
27
28
  // new: global config override option
28
29
  program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)')
@@ -235,6 +236,38 @@ program
235
236
  await runLocizeMigrate(config, options)
236
237
  })
237
238
 
239
+ program
240
+ .command('rename-key <oldKey> <newKey>')
241
+ .description('Rename a translation key across all source files and translation files.')
242
+ .option('--dry-run', 'Preview changes without modifying files')
243
+ .action(async (oldKey, newKey, options) => {
244
+ try {
245
+ const cfgPath = program.opts().config
246
+ const config = await ensureConfig(cfgPath)
247
+
248
+ const result = await runRenameKey(config, oldKey, newKey, options)
249
+
250
+ if (!result.success) {
251
+ if (result.conflicts) {
252
+ console.error(chalk.red('\n❌ Conflicts detected:'))
253
+ result.conflicts.forEach(c => console.error(` - ${c}`))
254
+ }
255
+ if (result.error) {
256
+ console.error(chalk.red(`\n❌ ${result.error}`))
257
+ }
258
+ process.exit(1)
259
+ }
260
+
261
+ const totalChanges = result.sourceFiles.reduce((sum, f) => sum + f.changes, 0)
262
+ if (totalChanges === 0) {
263
+ console.log(chalk.yellow(`\n⚠️ No usages found for "${oldKey}"`))
264
+ }
265
+ } catch (error) {
266
+ console.error(chalk.red('Error renaming key:'), error)
267
+ process.exit(1)
268
+ }
269
+ })
270
+
238
271
  program.parse(process.argv)
239
272
 
240
273
  const toArray = (v: any) => Array.isArray(v) ? v : (v ? [v] : [])
@@ -600,6 +600,39 @@ function serializeJSXChildren (children: any[], config: I18nextToolkitConfig): s
600
600
 
601
601
  if (node.type === 'JSXText') {
602
602
  if (isFormattingWhitespace(node)) continue
603
+
604
+ const nextNode = nodes[i + 1]
605
+
606
+ // If this text node ends with newline+whitespace and is followed by an element,
607
+ if (/\n\s*$/.test(node.value) && nextNode && nextNode.type === 'JSXElement') {
608
+ const textWithoutTrailingNewline = node.value.replace(/\n\s*$/, '')
609
+ if (textWithoutTrailingNewline.trim()) {
610
+ // Check if there's text content AFTER the next element (not counting punctuation-only or formatting)
611
+ const nodeAfterNext = nodes[i + 2]
612
+ const hasTextAfter = nodeAfterNext &&
613
+ nodeAfterNext.type === 'JSXText' &&
614
+ !isFormattingWhitespace(nodeAfterNext) &&
615
+ // Check if it's not just punctuation (period, comma, etc.)
616
+ /[a-zA-Z0-9]/.test(nodeAfterNext.value)
617
+
618
+ // Preserve leading whitespace
619
+ const hasLeadingSpace = /^\s/.test(textWithoutTrailingNewline)
620
+ const trimmed = textWithoutTrailingNewline.trim()
621
+ const withLeading = hasLeadingSpace ? ' ' + trimmed : trimmed
622
+
623
+ // Add trailing space only if:
624
+ // 1. There was a space before the newline, OR
625
+ // 2. There's meaningful text (not just punctuation) after the next element
626
+ const hasSpaceBeforeNewline = /\s\n/.test(node.value)
627
+ if (hasSpaceBeforeNewline || hasTextAfter) {
628
+ out += withLeading + ' '
629
+ } else {
630
+ out += withLeading
631
+ }
632
+ continue
633
+ }
634
+ }
635
+
603
636
  out += node.value
604
637
  continue
605
638
  }
package/src/index.ts CHANGED
@@ -4,7 +4,8 @@ export type {
4
4
  PluginContext,
5
5
  ExtractedKey,
6
6
  TranslationResult,
7
- ExtractedKeysMap
7
+ ExtractedKeysMap,
8
+ RenameKeyResult
8
9
  } from './types'
9
10
  export { defineConfig } from './config'
10
11
  export {
@@ -18,3 +19,4 @@ export { runLinter } from './linter'
18
19
  export { runSyncer } from './syncer'
19
20
  export { runStatus } from './status'
20
21
  export { runTypesGenerator } from './types-generator'
22
+ export { runRenameKey } from './rename-key'
@@ -0,0 +1,398 @@
1
+ import { glob } from 'glob'
2
+ import { readFile, writeFile } from 'node:fs/promises'
3
+ import type { I18nextToolkitConfig, Logger, RenameKeyResult } from './types'
4
+ import { ConsoleLogger } from './utils/logger'
5
+ import { loadTranslationFile, serializeTranslationFile, getOutputPath } from './utils/file-utils'
6
+ import { resolve } from 'node:path'
7
+ import { getNestedValue, setNestedValue } from './utils/nested-object'
8
+ import { shouldShowFunnel, recordFunnelShown } from './utils/funnel-msg-tracker'
9
+ import chalk from 'chalk'
10
+
11
+ /**
12
+ * Renames a translation key across all source files and translation files.
13
+ *
14
+ * This function performs a comprehensive key rename operation:
15
+ * 1. Validates the old and new key names
16
+ * 2. Checks for conflicts in translation files
17
+ * 3. Updates all occurrences in source code (AST-based)
18
+ * 4. Updates all translation files for all locales
19
+ * 5. Preserves the original translation values
20
+ *
21
+ * @param config - The i18next toolkit configuration
22
+ * @param oldKey - The current key to rename (may include namespace prefix)
23
+ * @param newKey - The new key name (may include namespace prefix)
24
+ * @param options - Rename options (dry-run mode, etc.)
25
+ * @param logger - Logger instance for output
26
+ * @returns Result object with update status and file lists
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * // Basic rename
31
+ * const result = await runRenameKey(config, 'old.key', 'new.key')
32
+ *
33
+ * // With namespace
34
+ * const result = await runRenameKey(config, 'common:button.submit', 'common:button.save')
35
+ *
36
+ * // Dry run to preview changes
37
+ * const result = await runRenameKey(config, 'old.key', 'new.key', { dryRun: true })
38
+ * ```
39
+ */
40
+ export async function runRenameKey (
41
+ config: I18nextToolkitConfig,
42
+ oldKey: string,
43
+ newKey: string,
44
+ options: {
45
+ dryRun?: boolean
46
+ } = {},
47
+ logger: Logger = new ConsoleLogger()
48
+ ): Promise<RenameKeyResult> {
49
+ const { dryRun = false } = options
50
+
51
+ // Validate keys
52
+ const validation = validateKeys(oldKey, newKey, config)
53
+ if (!validation.valid) {
54
+ return {
55
+ success: false,
56
+ sourceFiles: [],
57
+ translationFiles: [],
58
+ error: validation.error
59
+ }
60
+ }
61
+
62
+ // Parse namespace from keys
63
+ const oldParts = parseKeyWithNamespace(oldKey, config)
64
+ const newParts = parseKeyWithNamespace(newKey, config)
65
+
66
+ // Check for conflicts in translation files
67
+ const conflicts = await checkConflicts(newParts, config)
68
+ if (conflicts.length > 0) {
69
+ return {
70
+ success: false,
71
+ sourceFiles: [],
72
+ translationFiles: [],
73
+ conflicts,
74
+ error: 'Target key already exists in translation files'
75
+ }
76
+ }
77
+
78
+ logger.info(`🔍 Scanning for usages of "${oldKey}"...`)
79
+
80
+ // Find and update source files
81
+ const sourceResults = await updateSourceFiles(oldParts, newParts, config, dryRun, logger)
82
+
83
+ // Update translation files
84
+ const translationResults = await updateTranslationFiles(oldParts, newParts, config, dryRun, logger)
85
+
86
+ const totalChanges = sourceResults.reduce((sum, r) => sum + r.changes, 0)
87
+
88
+ if (!dryRun && totalChanges > 0) {
89
+ logger.info('\n✨ Successfully renamed key!')
90
+ logger.info(` Old: "${oldKey}"`)
91
+ logger.info(` New: "${newKey}"`)
92
+
93
+ // Show locize funnel after successful rename
94
+ await printLocizeFunnel()
95
+ } else if (totalChanges === 0) {
96
+ logger.info(`\n⚠️ No usages found for "${oldKey}"`)
97
+ }
98
+
99
+ return {
100
+ success: true,
101
+ sourceFiles: sourceResults,
102
+ translationFiles: translationResults
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Prints a promotional message for the locize rename/move workflow.
108
+ * This message is shown after a successful key rename operation.
109
+ */
110
+ async function printLocizeFunnel () {
111
+ if (!(await shouldShowFunnel('rename-key'))) return
112
+
113
+ console.log(chalk.yellow.bold('\n💡 Tip: Managing translations across multiple projects?'))
114
+ console.log(' With locize, you can rename, move, and copy translation keys directly')
115
+ console.log(' in the web interface—no CLI needed. Perfect for collaboration with')
116
+ console.log(' translators and managing complex refactoring across namespaces.')
117
+ console.log(` Learn more: ${chalk.cyan('https://www.locize.com/docs/how-can-a-segment-key-be-copied-moved-or-renamed')}`)
118
+
119
+ return recordFunnelShown('rename-key')
120
+ }
121
+
122
+ interface KeyParts {
123
+ namespace?: string
124
+ key: string
125
+ fullKey: string
126
+ }
127
+
128
+ function parseKeyWithNamespace (key: string, config: I18nextToolkitConfig): KeyParts {
129
+ const nsSeparator = config.extract.nsSeparator ?? ':'
130
+
131
+ if (nsSeparator && key.includes(nsSeparator)) {
132
+ const [ns, ...rest] = key.split(nsSeparator)
133
+ return {
134
+ namespace: ns,
135
+ key: rest.join(nsSeparator),
136
+ fullKey: key
137
+ }
138
+ }
139
+
140
+ return {
141
+ namespace: config.extract.defaultNS || 'translation',
142
+ key,
143
+ fullKey: key
144
+ }
145
+ }
146
+
147
+ function validateKeys (oldKey: string, newKey: string, config: I18nextToolkitConfig): { valid: boolean; error?: string } {
148
+ if (!oldKey || !oldKey.trim()) {
149
+ return { valid: false, error: 'Old key cannot be empty' }
150
+ }
151
+
152
+ if (!newKey || !newKey.trim()) {
153
+ return { valid: false, error: 'New key cannot be empty' }
154
+ }
155
+
156
+ if (oldKey === newKey) {
157
+ return { valid: false, error: 'Old and new keys are identical' }
158
+ }
159
+
160
+ return { valid: true }
161
+ }
162
+
163
+ async function checkConflicts (newParts: KeyParts, config: I18nextToolkitConfig): Promise<string[]> {
164
+ const conflicts: string[] = []
165
+
166
+ for (const locale of config.locales) {
167
+ const outputPath = getOutputPath(config.extract.output, locale, newParts.namespace)
168
+ const fullPath = resolve(process.cwd(), outputPath)
169
+
170
+ try {
171
+ const existingTranslations = await loadTranslationFile(fullPath)
172
+ if (existingTranslations) {
173
+ const keySeparator = config.extract.keySeparator ?? '.'
174
+ const value = getNestedValue(existingTranslations, newParts.key, keySeparator)
175
+ if (value !== undefined) {
176
+ conflicts.push(`${locale}:${newParts.fullKey}`)
177
+ }
178
+ }
179
+ } catch {
180
+ // File doesn't exist, no conflict
181
+ }
182
+ }
183
+
184
+ return conflicts
185
+ }
186
+
187
+ async function updateSourceFiles (
188
+ oldParts: KeyParts,
189
+ newParts: KeyParts,
190
+ config: I18nextToolkitConfig,
191
+ dryRun: boolean,
192
+ logger: Logger
193
+ ): Promise<Array<{ path: string; changes: number }>> {
194
+ const defaultIgnore = ['node_modules/**']
195
+ const userIgnore = Array.isArray(config.extract.ignore)
196
+ ? config.extract.ignore
197
+ : config.extract.ignore ? [config.extract.ignore] : []
198
+
199
+ // Normalize input patterns for cross-platform compatibility
200
+ const inputPatterns = Array.isArray(config.extract.input)
201
+ ? config.extract.input
202
+ : [config.extract.input]
203
+
204
+ const normalizedPatterns = inputPatterns.map(pattern =>
205
+ pattern.replace(/\\/g, '/')
206
+ )
207
+
208
+ const sourceFiles = await glob(normalizedPatterns, {
209
+ ignore: [...defaultIgnore, ...userIgnore],
210
+ cwd: process.cwd()
211
+ })
212
+
213
+ const results: Array<{ path: string; changes: number }> = []
214
+
215
+ for (const file of sourceFiles) {
216
+ const code = await readFile(file, 'utf-8')
217
+ const { newCode, changes } = await replaceKeyInSource(code, oldParts, newParts, config)
218
+
219
+ if (changes > 0) {
220
+ if (!dryRun) {
221
+ await writeFile(file, newCode, 'utf-8')
222
+ }
223
+ results.push({ path: file, changes })
224
+ logger.info(` ${dryRun ? '(dry-run) ' : ''}✓ ${file} (${changes} ${changes === 1 ? 'change' : 'changes'})`)
225
+ }
226
+ }
227
+
228
+ if (results.length > 0) {
229
+ logger.info(`\n📝 Source file changes: ${results.length} file${results.length === 1 ? '' : 's'}`)
230
+ }
231
+
232
+ return results
233
+ }
234
+
235
+ async function replaceKeyInSource (
236
+ code: string,
237
+ oldParts: KeyParts,
238
+ newParts: KeyParts,
239
+ config: I18nextToolkitConfig
240
+ ): Promise<{ newCode: string; changes: number }> {
241
+ // Use regex-based replacement which is more reliable than AST manipulation
242
+ return replaceKeyWithRegex(code, oldParts, newParts, config)
243
+ }
244
+
245
+ function replaceKeyWithRegex (
246
+ code: string,
247
+ oldParts: KeyParts,
248
+ newParts: KeyParts,
249
+ config: I18nextToolkitConfig
250
+ ): { newCode: string; changes: number } {
251
+ let changes = 0
252
+ let newCode = code
253
+ const nsSeparator = config.extract.nsSeparator ?? ':'
254
+
255
+ // Helper to determine which key form to use in replacement
256
+ const getReplacementKey = (originalKey: string): string => {
257
+ const hasNamespace = nsSeparator && originalKey.includes(String(nsSeparator))
258
+ return hasNamespace ? newParts.fullKey : newParts.key
259
+ }
260
+
261
+ // Pattern 1: Function calls - respect configured functions
262
+ const configuredFunctions = config.extract.functions || ['t', '*.t']
263
+ const functionPatterns: Array<{ pattern: RegExp; original: string }> = []
264
+
265
+ for (const fnPattern of configuredFunctions) {
266
+ if (fnPattern.startsWith('*.')) {
267
+ // Wildcard pattern like '*.t' - match any prefix
268
+ const suffix = fnPattern.substring(1) // '.t'
269
+ const escapedSuffix = escapeRegex(suffix)
270
+
271
+ // Match: anyIdentifier.t('key')
272
+ functionPatterns.push({
273
+ pattern: new RegExp(`\\w+${escapedSuffix}\\((['"\`])${escapeRegex(oldParts.fullKey)}\\1`, 'g'),
274
+ original: oldParts.fullKey
275
+ })
276
+ functionPatterns.push({
277
+ pattern: new RegExp(`\\w+${escapedSuffix}\\((['"\`])${escapeRegex(oldParts.key)}\\1`, 'g'),
278
+ original: oldParts.key
279
+ })
280
+ } else {
281
+ // Exact function name
282
+ const escapedFn = escapeRegex(fnPattern)
283
+ functionPatterns.push({
284
+ pattern: new RegExp(`\\b${escapedFn}\\((['"\`])${escapeRegex(oldParts.fullKey)}\\1`, 'g'),
285
+ original: oldParts.fullKey
286
+ })
287
+ functionPatterns.push({
288
+ pattern: new RegExp(`\\b${escapedFn}\\((['"\`])${escapeRegex(oldParts.key)}\\1`, 'g'),
289
+ original: oldParts.key
290
+ })
291
+ }
292
+ }
293
+
294
+ for (const { pattern, original } of functionPatterns) {
295
+ if (pattern.test(newCode)) {
296
+ const replacement = getReplacementKey(original)
297
+ newCode = newCode.replace(pattern, (match, quote) => {
298
+ changes++
299
+ // Preserve the function name part, only replace the key
300
+ const functionNameMatch = match.match(/^(\w+(?:\.\w+)*)\(/)
301
+ if (functionNameMatch) {
302
+ return `${functionNameMatch[1]}(${quote}${replacement}${quote}`
303
+ }
304
+ return match
305
+ })
306
+ }
307
+ }
308
+
309
+ // Pattern 2: JSX i18nKey attribute - respect configured transComponents
310
+ // const transComponents = config.extract.transComponents || ['Trans']
311
+
312
+ // Create a pattern that matches i18nKey on any of the configured components
313
+ // This is a simplified approach - for more complex cases, consider AST-based replacement
314
+ const i18nKeyPatterns = [
315
+ { pattern: new RegExp(`i18nKey=(['"\`])${escapeRegex(oldParts.fullKey)}\\1`, 'g'), original: oldParts.fullKey },
316
+ { pattern: new RegExp(`i18nKey=(['"\`])${escapeRegex(oldParts.key)}\\1`, 'g'), original: oldParts.key }
317
+ ]
318
+
319
+ for (const { pattern, original } of i18nKeyPatterns) {
320
+ if (pattern.test(newCode)) {
321
+ const replacement = getReplacementKey(original)
322
+ newCode = newCode.replace(pattern, (match, quote) => {
323
+ changes++
324
+ return `i18nKey=${quote}${replacement}${quote}`
325
+ })
326
+ }
327
+ }
328
+
329
+ return { newCode, changes }
330
+ }
331
+
332
+ function escapeRegex (str: string): string {
333
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
334
+ }
335
+
336
+ async function updateTranslationFiles (
337
+ oldParts: KeyParts,
338
+ newParts: KeyParts,
339
+ config: I18nextToolkitConfig,
340
+ dryRun: boolean,
341
+ logger: Logger
342
+ ): Promise<Array<{ path: string; updated: boolean }>> {
343
+ const results: Array<{ path: string; updated: boolean }> = []
344
+ const keySeparator = config.extract.keySeparator ?? '.'
345
+
346
+ for (const locale of config.locales) {
347
+ const outputPath = getOutputPath(config.extract.output, locale, oldParts.namespace)
348
+ const fullPath = resolve(process.cwd(), outputPath)
349
+
350
+ try {
351
+ const translations = await loadTranslationFile(fullPath)
352
+ if (!translations) continue
353
+
354
+ const oldValue = getNestedValue(translations, oldParts.key, keySeparator)
355
+ if (oldValue === undefined) continue
356
+
357
+ // Remove old key
358
+ deleteNestedValue(translations, oldParts.key, keySeparator)
359
+
360
+ // Add new key with same value
361
+ setNestedValue(translations, newParts.key, oldValue, keySeparator)
362
+
363
+ if (!dryRun) {
364
+ const content = serializeTranslationFile(
365
+ translations,
366
+ config.extract.outputFormat,
367
+ config.extract.indentation
368
+ )
369
+ await writeFile(fullPath, content, 'utf-8')
370
+ }
371
+
372
+ results.push({ path: fullPath, updated: true })
373
+ logger.info(` ${dryRun ? '(dry-run) ' : ''}✓ ${fullPath}`)
374
+ } catch (error) {
375
+ // File doesn't exist or couldn't be processed
376
+ }
377
+ }
378
+
379
+ if (results.length > 0) {
380
+ logger.info(`\n📦 Translation file updates: ${results.length} file${results.length === 1 ? '' : 's'}`)
381
+ }
382
+
383
+ return results
384
+ }
385
+
386
+ function deleteNestedValue (obj: any, path: string, separator: string | boolean): void {
387
+ if (separator === false) {
388
+ delete obj[path]
389
+ return
390
+ }
391
+ const keys = path.split(String(separator))
392
+ let current = obj
393
+ for (let i = 0; i < keys.length - 1; i++) {
394
+ if (!current[keys[i]]) return
395
+ current = current[keys[i]]
396
+ }
397
+ delete current[keys[keys.length - 1]]
398
+ }
package/src/types.ts CHANGED
@@ -561,3 +561,11 @@ export interface ASTVisitorHooks {
561
561
  * ```
562
562
  */
563
563
  export type ExtractedKeysMap = Map<string, ExtractedKey>
564
+
565
+ export interface RenameKeyResult {
566
+ success: boolean
567
+ sourceFiles: Array<{ path: string; changes: number }>
568
+ translationFiles: Array<{ path: string; updated: boolean }>
569
+ conflicts?: string[]
570
+ error?: string
571
+ }
package/types/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- export type { I18nextToolkitConfig, Plugin, PluginContext, ExtractedKey, TranslationResult, ExtractedKeysMap } from './types';
1
+ export type { I18nextToolkitConfig, Plugin, PluginContext, ExtractedKey, TranslationResult, ExtractedKeysMap, RenameKeyResult } from './types';
2
2
  export { defineConfig } from './config';
3
3
  export { extract, findKeys, getTranslations, runExtractor } from './extractor';
4
4
  export { runLinter } from './linter';
5
5
  export { runSyncer } from './syncer';
6
6
  export { runStatus } from './status';
7
7
  export { runTypesGenerator } from './types-generator';
8
+ export { runRenameKey } from './rename-key';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,MAAM,EACN,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EACL,OAAO,EACP,QAAQ,EACR,eAAe,EACf,YAAY,EACb,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,MAAM,EACN,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EAChB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EACL,OAAO,EACP,QAAQ,EACR,eAAe,EACf,YAAY,EACb,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA"}
@@ -0,0 +1,34 @@
1
+ import type { I18nextToolkitConfig, Logger, RenameKeyResult } from './types';
2
+ /**
3
+ * Renames a translation key across all source files and translation files.
4
+ *
5
+ * This function performs a comprehensive key rename operation:
6
+ * 1. Validates the old and new key names
7
+ * 2. Checks for conflicts in translation files
8
+ * 3. Updates all occurrences in source code (AST-based)
9
+ * 4. Updates all translation files for all locales
10
+ * 5. Preserves the original translation values
11
+ *
12
+ * @param config - The i18next toolkit configuration
13
+ * @param oldKey - The current key to rename (may include namespace prefix)
14
+ * @param newKey - The new key name (may include namespace prefix)
15
+ * @param options - Rename options (dry-run mode, etc.)
16
+ * @param logger - Logger instance for output
17
+ * @returns Result object with update status and file lists
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * // Basic rename
22
+ * const result = await runRenameKey(config, 'old.key', 'new.key')
23
+ *
24
+ * // With namespace
25
+ * const result = await runRenameKey(config, 'common:button.submit', 'common:button.save')
26
+ *
27
+ * // Dry run to preview changes
28
+ * const result = await runRenameKey(config, 'old.key', 'new.key', { dryRun: true })
29
+ * ```
30
+ */
31
+ export declare function runRenameKey(config: I18nextToolkitConfig, oldKey: string, newKey: string, options?: {
32
+ dryRun?: boolean;
33
+ }, logger?: Logger): Promise<RenameKeyResult>;
34
+ //# sourceMappingURL=rename-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rename-key.d.ts","sourceRoot":"","sources":["../src/rename-key.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAQ5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,OAAO,CAAA;CACZ,EACN,MAAM,GAAE,MAA4B,GACnC,OAAO,CAAC,eAAe,CAAC,CAwD1B"}
package/types/types.d.ts CHANGED
@@ -482,4 +482,17 @@ export interface ASTVisitorHooks {
482
482
  * ```
483
483
  */
484
484
  export type ExtractedKeysMap = Map<string, ExtractedKey>;
485
+ export interface RenameKeyResult {
486
+ success: boolean;
487
+ sourceFiles: Array<{
488
+ path: string;
489
+ changes: number;
490
+ }>;
491
+ translationFiles: Array<{
492
+ path: string;
493
+ updated: boolean;
494
+ }>;
495
+ conflicts?: string[];
496
+ error?: string;
497
+ }
485
498
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEnE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,oBAAoB;IACnC,iEAAiE;IACjE,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,2DAA2D;IAC3D,OAAO,EAAE;QACP,oEAAoE;QACpE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAEzB,4DAA4D;QAC5D,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAE3B,mGAAmG;QACnG,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;QAEpE;;;WAGG;QACH,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;QAE3B,uEAAuE;QACvE,YAAY,CAAC,EAAE,MAA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