@intlayer/cli 8.2.2 → 8.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/dist/cjs/IntlayerEventListener.cjs +1 -1
  2. package/dist/cjs/IntlayerEventListener.cjs.map +1 -1
  3. package/dist/cjs/auth/login.cjs +2 -2
  4. package/dist/cjs/auth/login.cjs.map +1 -1
  5. package/dist/cjs/build.cjs +1 -1
  6. package/dist/cjs/build.cjs.map +1 -1
  7. package/dist/cjs/ci.cjs +1 -1
  8. package/dist/cjs/ci.cjs.map +1 -1
  9. package/dist/cjs/cli.cjs +1 -1
  10. package/dist/cjs/cli.cjs.map +1 -1
  11. package/dist/cjs/config.cjs +1 -1
  12. package/dist/cjs/config.cjs.map +1 -1
  13. package/dist/cjs/extract.cjs +1 -1
  14. package/dist/cjs/extract.cjs.map +1 -1
  15. package/dist/cjs/fill/deepMergeContent.cjs +1 -1
  16. package/dist/cjs/fill/deepMergeContent.cjs.map +1 -1
  17. package/dist/cjs/fill/fill.cjs +1 -1
  18. package/dist/cjs/fill/fill.cjs.map +1 -1
  19. package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs +1 -1
  20. package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs.map +1 -1
  21. package/dist/cjs/fill/listTranslationsTasks.cjs +1 -1
  22. package/dist/cjs/fill/translateDictionary.cjs +1 -1
  23. package/dist/cjs/fill/translateDictionary.cjs.map +1 -1
  24. package/dist/cjs/fill/writeFill.cjs +1 -1
  25. package/dist/cjs/fill/writeFill.cjs.map +1 -1
  26. package/dist/cjs/getTargetDictionary.cjs +1 -1
  27. package/dist/cjs/init.cjs +1 -1
  28. package/dist/cjs/initMCP.cjs +1 -1
  29. package/dist/cjs/initSkills.cjs +1 -1
  30. package/dist/cjs/listContentDeclaration.cjs +1 -1
  31. package/dist/cjs/listProjects.cjs +1 -1
  32. package/dist/cjs/liveSync.cjs +1 -1
  33. package/dist/cjs/liveSync.cjs.map +1 -1
  34. package/dist/cjs/pull.cjs +1 -1
  35. package/dist/cjs/pull.cjs.map +1 -1
  36. package/dist/cjs/push/pullLog.cjs +1 -1
  37. package/dist/cjs/push/push.cjs +1 -1
  38. package/dist/cjs/push/push.cjs.map +1 -1
  39. package/dist/cjs/pushConfig.cjs +1 -1
  40. package/dist/cjs/pushConfig.cjs.map +1 -1
  41. package/dist/cjs/reviewDoc/reviewDoc.cjs +1 -1
  42. package/dist/cjs/reviewDoc/reviewDoc.cjs.map +1 -1
  43. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +1 -1
  44. package/dist/cjs/searchDoc.cjs +1 -1
  45. package/dist/cjs/searchDoc.cjs.map +1 -1
  46. package/dist/cjs/test/listMissingTranslations.cjs +1 -1
  47. package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
  48. package/dist/cjs/test/test.cjs +1 -1
  49. package/dist/cjs/translateDoc/translateDoc.cjs +1 -1
  50. package/dist/cjs/translateDoc/translateDoc.cjs.map +1 -1
  51. package/dist/cjs/translateDoc/translateFile.cjs +2 -2
  52. package/dist/cjs/watch.cjs +1 -1
  53. package/dist/cjs/watch.cjs.map +1 -1
  54. package/dist/esm/IntlayerEventListener.mjs +1 -1
  55. package/dist/esm/IntlayerEventListener.mjs.map +1 -1
  56. package/dist/esm/auth/login.mjs +2 -2
  57. package/dist/esm/auth/login.mjs.map +1 -1
  58. package/dist/esm/build.mjs +1 -1
  59. package/dist/esm/build.mjs.map +1 -1
  60. package/dist/esm/ci.mjs +1 -1
  61. package/dist/esm/ci.mjs.map +1 -1
  62. package/dist/esm/cli.mjs +1 -1
  63. package/dist/esm/cli.mjs.map +1 -1
  64. package/dist/esm/config.mjs +1 -1
  65. package/dist/esm/config.mjs.map +1 -1
  66. package/dist/esm/extract.mjs +1 -1
  67. package/dist/esm/extract.mjs.map +1 -1
  68. package/dist/esm/fill/deepMergeContent.mjs +1 -1
  69. package/dist/esm/fill/deepMergeContent.mjs.map +1 -1
  70. package/dist/esm/fill/fill.mjs +1 -1
  71. package/dist/esm/fill/fill.mjs.map +1 -1
  72. package/dist/esm/fill/getFilterMissingContentPerLocale.mjs +1 -1
  73. package/dist/esm/fill/getFilterMissingContentPerLocale.mjs.map +1 -1
  74. package/dist/esm/fill/listTranslationsTasks.mjs +1 -1
  75. package/dist/esm/fill/translateDictionary.mjs +1 -1
  76. package/dist/esm/fill/translateDictionary.mjs.map +1 -1
  77. package/dist/esm/fill/writeFill.mjs +1 -1
  78. package/dist/esm/fill/writeFill.mjs.map +1 -1
  79. package/dist/esm/getTargetDictionary.mjs +1 -1
  80. package/dist/esm/init.mjs +1 -1
  81. package/dist/esm/initMCP.mjs +1 -1
  82. package/dist/esm/initSkills.mjs +1 -1
  83. package/dist/esm/listContentDeclaration.mjs +1 -1
  84. package/dist/esm/listProjects.mjs +1 -1
  85. package/dist/esm/liveSync.mjs +1 -1
  86. package/dist/esm/liveSync.mjs.map +1 -1
  87. package/dist/esm/pull.mjs +1 -1
  88. package/dist/esm/pull.mjs.map +1 -1
  89. package/dist/esm/push/pullLog.mjs +1 -1
  90. package/dist/esm/push/push.mjs +1 -1
  91. package/dist/esm/push/push.mjs.map +1 -1
  92. package/dist/esm/pushConfig.mjs +1 -1
  93. package/dist/esm/pushConfig.mjs.map +1 -1
  94. package/dist/esm/reviewDoc/reviewDoc.mjs +1 -1
  95. package/dist/esm/reviewDoc/reviewDoc.mjs.map +1 -1
  96. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +1 -1
  97. package/dist/esm/searchDoc.mjs +1 -1
  98. package/dist/esm/searchDoc.mjs.map +1 -1
  99. package/dist/esm/test/listMissingTranslations.mjs +1 -1
  100. package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
  101. package/dist/esm/test/test.mjs +1 -1
  102. package/dist/esm/translateDoc/translateDoc.mjs +1 -1
  103. package/dist/esm/translateDoc/translateDoc.mjs.map +1 -1
  104. package/dist/esm/translateDoc/translateFile.mjs +2 -2
  105. package/dist/esm/watch.mjs +1 -1
  106. package/dist/esm/watch.mjs.map +1 -1
  107. package/dist/types/auth/login.d.ts.map +1 -1
  108. package/dist/types/build.d.ts.map +1 -1
  109. package/dist/types/cli.d.ts.map +1 -1
  110. package/dist/types/config.d.ts.map +1 -1
  111. package/dist/types/extract.d.ts.map +1 -1
  112. package/dist/types/fill/fill.d.ts.map +1 -1
  113. package/dist/types/fill/getFilterMissingContentPerLocale.d.ts.map +1 -1
  114. package/dist/types/fill/translateDictionary.d.ts.map +1 -1
  115. package/dist/types/pull.d.ts.map +1 -1
  116. package/dist/types/push/push.d.ts.map +1 -1
  117. package/dist/types/pushConfig.d.ts.map +1 -1
  118. package/dist/types/reviewDoc/reviewDoc.d.ts.map +1 -1
  119. package/dist/types/searchDoc.d.ts.map +1 -1
  120. package/dist/types/test/listMissingTranslations.d.ts.map +1 -1
  121. package/dist/types/watch.d.ts.map +1 -1
  122. package/package.json +14 -14
@@ -1,2 +1,2 @@
1
- import{checkCMSAuth as e}from"../utils/checkAccess.mjs";import{PushLogger as t}from"../pushLog.mjs";import{getIntlayerAPIProxy as n}from"@intlayer/api";import{formatPath as r,parallelize as i}from"@intlayer/chokidar/utils";import{getConfiguration as a}from"@intlayer/config/node";import{join as o}from"node:path";import{listGitFiles as s}from"@intlayer/chokidar/cli";import{ANSIColors as c,colorize as l,colorizeKey as u,getAppLogger as d}from"@intlayer/config/logger";import*as f from"node:fs/promises";import{getUnmergedDictionaries as p}from"@intlayer/unmerged-dictionaries-entry";import{prepareIntlayer as m,writeContentDeclaration as h}from"@intlayer/chokidar/build";const g={pushed:{icon:`✔`,color:c.GREEN},modified:{icon:`✔`,color:c.GREEN},error:{icon:`✖`,color:c.RED},default:{icon:`⏲`,color:c.BLUE}},_=e=>g[e]??g.default,v=async r=>{let f=a(r?.configOptions),g=d(f);r?.build===!0?await m(f,{forceRun:!0}):r?.build===void 0&&await m(f);try{if(!await e(f))return;let a=n(void 0,f),d=p(f),m=Object.values(d).flat(),v=Array.from(new Set(m.map(e=>e.location).filter(e=>e&&![`remote`,`local`,`hybrid`].includes(e)))),b=[];if(v.length>0){let{multiselect:e,confirm:t,isCancel:n}=await import(`@clack/prompts`);if(v.length===1){let e=await t({message:`Do you want to push dictionaries with custom location ${l(v[0],c.BLUE,c.RESET)}?`,initialValue:!1});if(n(e))return;e&&(b=[v[0]])}else{let t=await e({message:`Select custom locations to push:`,options:v.map(e=>({value:e,label:e})),required:!1});if(n(t))return;b=t}}let x=m.filter(e=>{let t=e.location??f.dictionary?.location??`local`;return t===`remote`||t===`hybrid`||b.includes(t)});if(x.length===0){g(`No dictionaries found to push. Only dictionaries with location ${l(`remote`,c.BLUE,c.RESET)}, ${l(`hybrid`,c.BLUE,c.RESET)} or selected custom locations are pushed.`,{level:`warn`}),g(`You can set the location in your dictionary file (e.g. ${l(`{ key: 'my-key', location: 'hybrid', ... }`,c.BLUE,c.RESET)} or globally in your intlayer.config.ts file (e.g. ${l(`{ dictionary: { location: 'hybrid' } }`,c.BLUE,c.RESET)}).`,{level:`info`});return}let S=Object.keys(d);if(r?.dictionaries){let e=r.dictionaries.filter(e=>!S.includes(e));e.length>0&&g(`The following dictionaries do not exist: ${e.join(`, `)} and have been ignored.`,{level:`error`}),x=x.filter(e=>r.dictionaries?.includes(e.key))}if(r?.gitOptions){let e=await s(r.gitOptions);x=x.filter(t=>e.includes(o(f.content.baseDir,t.filePath??``)))}if(x.length===0){g(`No local dictionaries found`,{level:`error`});return}g(`Pushing dictionaries:`);let C=x.map(e=>({dictionary:e,status:`pending`})),w=new t;w.update(C.map(e=>({dictionaryKey:e.dictionary.key,status:`pending`})));let T=[];await i(C,async e=>{e.status=`pushing`,w.update([{dictionaryKey:e.dictionary.key,status:`pushing`}]);try{let t=await a.dictionary.pushDictionaries([e.dictionary]),n=t.data?.updatedDictionaries??[],r=t.data?.newDictionaries??[],i=[...n,...r];for(let e of i){let t=d[e.key]?.find(t=>t.localId===e.localId);t&&await h({...t,id:e.id},f)}n.some(t=>t.key===e.dictionary.key)?(e.status=`modified`,T.push(e.dictionary),w.update([{dictionaryKey:e.dictionary.key,status:`modified`}])):r.some(t=>t.key===e.dictionary.key)?(e.status=`pushed`,T.push(e.dictionary),w.update([{dictionaryKey:e.dictionary.key,status:`pushed`}])):e.status=`unknown`}catch(t){e.status=`error`,e.error=t,e.errorMessage=`Error pushing dictionary ${e.dictionary.key}: ${t}`,w.update([{dictionaryKey:e.dictionary.key,status:`error`}])}},5),w.finish();for(let e of C){let{icon:t,color:n}=_(e.status);g(` - ${u(e.dictionary.key)} ${c.GREY}[${n}${t} ${e.status}${c.GREY}]${c.RESET}`)}for(let e of C)e.errorMessage&&g(e.errorMessage,{level:`error`});let E=r?.deleteLocaleDictionary,D=r?.keepLocaleDictionary;if(E&&D)throw Error(`Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options.`);if(E)await y(T,r);else if(!D){let e=T.filter(e=>e.location===`remote`),t=e.map(e=>e.key);if(e.length>0){let{confirm:n,isCancel:i}=await import(`@clack/prompts`),a=await n({message:`Do you want to delete the local dictionaries that were successfully pushed? ${l(`(Dictionaries:`,c.GREY,c.RESET)} ${u(t)}${l(`)`,c.GREY,c.RESET)}`,initialValue:!1});if(i(a))return;a&&await y(e,r)}}}catch(e){g(e,{level:`error`})}},y=async(e,t)=>{let n=d(a(t?.configOptions)),i=new Set;for(let t of e){let{filePath:e}=t;if(!e){n(`Dictionary ${u(t.key)} does not have a file path`,{level:`error`});continue}i.add(e)}for(let e of i)try{let t=await f.lstat(e);t.isFile()?(await f.unlink(e),n(`Deleted file ${r(e)}`,{})):t.isDirectory()?n(`Path is a directory ${r(e)}, skipping.`,{}):n(`Unknown file type for ${r(e)}, skipping.`,{})}catch(t){n(`Error deleting ${r(e)}: ${t}`,{level:`error`})}};export{v as push};
1
+ import{checkCMSAuth as e}from"../utils/checkAccess.mjs";import{PushLogger as t}from"../pushLog.mjs";import{getIntlayerAPIProxy as n}from"@intlayer/api";import{ANSIColors as r,colorize as i,colorizeKey as a,getAppLogger as o}from"@intlayer/config/logger";import{listGitFiles as s,logConfigDetails as c}from"@intlayer/chokidar/cli";import{formatPath as l,parallelize as u}from"@intlayer/chokidar/utils";import{getConfiguration as d}from"@intlayer/config/node";import{join as f}from"node:path";import*as p from"node:fs/promises";import{getUnmergedDictionaries as m}from"@intlayer/unmerged-dictionaries-entry";import{prepareIntlayer as h,writeContentDeclaration as g}from"@intlayer/chokidar/build";const _={pushed:{icon:`✔`,color:r.GREEN},modified:{icon:`✔`,color:r.GREEN},error:{icon:`✖`,color:r.RED},default:{icon:`⏲`,color:r.BLUE}},v=e=>_[e]??_.default,y=async l=>{let p=d(l?.configOptions);c(l?.configOptions);let _=o(p);l?.build===!0?await h(p,{forceRun:!0}):l?.build===void 0&&await h(p);try{if(!await e(p))return;let o=n(void 0,p),c=m(p),d=Object.values(c).flat(),h=Array.from(new Set(d.map(e=>e.location).filter(e=>e&&![`remote`,`local`,`hybrid`].includes(e)))),y=[];if(h.length>0){let{multiselect:e,confirm:t,isCancel:n}=await import(`@clack/prompts`);if(h.length===1){let e=await t({message:`Do you want to push dictionaries with custom location ${i(h[0],r.BLUE,r.RESET)}?`,initialValue:!1});if(n(e))return;e&&(y=[h[0]])}else{let t=await e({message:`Select custom locations to push:`,options:h.map(e=>({value:e,label:e})),required:!1});if(n(t))return;y=t}}let x=d.filter(e=>{let t=e.location??p.dictionary?.location??`local`;return t===`remote`||t===`hybrid`||y.includes(t)});if(x.length===0){_(`No dictionaries found to push. Only dictionaries with location ${i(`remote`,r.BLUE,r.RESET)}, ${i(`hybrid`,r.BLUE,r.RESET)} or selected custom locations are pushed.`,{level:`warn`}),_(`You can set the location in your dictionary file (e.g. ${i(`{ key: 'my-key', location: 'hybrid', ... }`,r.BLUE,r.RESET)} or globally in your intlayer.config.ts file (e.g. ${i(`{ dictionary: { location: 'hybrid' } }`,r.BLUE,r.RESET)}).`,{level:`info`});return}let S=Object.keys(c);if(l?.dictionaries){let e=l.dictionaries.filter(e=>!S.includes(e));e.length>0&&_(`The following dictionaries do not exist: ${e.join(`, `)} and have been ignored.`,{level:`error`}),x=x.filter(e=>l.dictionaries?.includes(e.key))}if(l?.gitOptions){let e=await s(l.gitOptions);x=x.filter(t=>e.includes(f(p.content.baseDir,t.filePath??``)))}if(x.length===0){_(`No local dictionaries found`,{level:`error`});return}_(`Pushing dictionaries:`);let C=x.map(e=>({dictionary:e,status:`pending`})),w=new t;w.update(C.map(e=>({dictionaryKey:e.dictionary.key,status:`pending`})));let T=[];await u(C,async e=>{e.status=`pushing`,w.update([{dictionaryKey:e.dictionary.key,status:`pushing`}]);try{let t=await o.dictionary.pushDictionaries([e.dictionary]),n=t.data?.updatedDictionaries??[],r=t.data?.newDictionaries??[],i=[...n,...r];for(let e of i){let t=c[e.key]?.find(t=>t.localId===e.localId);t&&await g({...t,id:e.id},p)}n.some(t=>t.key===e.dictionary.key)?(e.status=`modified`,T.push(e.dictionary),w.update([{dictionaryKey:e.dictionary.key,status:`modified`}])):r.some(t=>t.key===e.dictionary.key)?(e.status=`pushed`,T.push(e.dictionary),w.update([{dictionaryKey:e.dictionary.key,status:`pushed`}])):e.status=`unknown`}catch(t){e.status=`error`,e.error=t,e.errorMessage=`Error pushing dictionary ${e.dictionary.key}: ${t}`,w.update([{dictionaryKey:e.dictionary.key,status:`error`}])}},5),w.finish();for(let e of C){let{icon:t,color:n}=v(e.status);_(` - ${a(e.dictionary.key)} ${r.GREY}[${n}${t} ${e.status}${r.GREY}]${r.RESET}`)}for(let e of C)e.errorMessage&&_(e.errorMessage,{level:`error`});let E=l?.deleteLocaleDictionary,D=l?.keepLocaleDictionary;if(E&&D)throw Error(`Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options.`);if(E)await b(T,l);else if(!D){let e=T.filter(e=>e.location===`remote`),t=e.map(e=>e.key);if(e.length>0){let{confirm:n,isCancel:o}=await import(`@clack/prompts`),s=await n({message:`Do you want to delete the local dictionaries that were successfully pushed? ${i(`(Dictionaries:`,r.GREY,r.RESET)} ${a(t)}${i(`)`,r.GREY,r.RESET)}`,initialValue:!1});if(o(s))return;s&&await b(e,l)}}}catch(e){_(e,{level:`error`})}},b=async(e,t)=>{let n=o(d(t?.configOptions)),r=new Set;for(let t of e){let{filePath:e}=t;if(!e){n(`Dictionary ${a(t.key)} does not have a file path`,{level:`error`});continue}r.add(e)}for(let e of r)try{let t=await p.lstat(e);t.isFile()?(await p.unlink(e),n(`Deleted file ${l(e)}`,{})):t.isDirectory()?n(`Path is a directory ${l(e)}, skipping.`,{}):n(`Unknown file type for ${l(e)}, skipping.`,{})}catch(t){n(`Error deleting ${l(e)}: ${t}`,{level:`error`})}};export{y as push};
2
2
  //# sourceMappingURL=push.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"push.mjs","names":[],"sources":["../../../src/push/push.ts"],"sourcesContent":["import * as fsPromises from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n prepareIntlayer,\n writeContentDeclaration,\n} from '@intlayer/chokidar/build';\nimport { type ListGitFilesOptions, listGitFiles } from '@intlayer/chokidar/cli';\nimport { formatPath, parallelize } from '@intlayer/chokidar/utils';\nimport {\n ANSIColors,\n colorize,\n colorizeKey,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { Dictionary } from '@intlayer/types';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport { PushLogger, type PushStatus } from '../pushLog';\nimport { checkCMSAuth } from '../utils/checkAccess';\n\ntype PushOptions = {\n deleteLocaleDictionary?: boolean;\n keepLocaleDictionary?: boolean;\n dictionaries?: string[];\n gitOptions?: ListGitFilesOptions;\n configOptions?: GetConfigurationOptions;\n build?: boolean;\n};\n\ntype DictionariesStatus = {\n dictionary: Dictionary;\n status: 'pending' | 'pushing' | 'modified' | 'pushed' | 'unknown' | 'error';\n error?: Error;\n errorMessage?: string;\n};\n\n// Print per-dictionary summary similar to loadDictionaries\nconst statusIconsAndColors = {\n pushed: { icon: '✔', color: ANSIColors.GREEN },\n modified: { icon: '✔', color: ANSIColors.GREEN },\n error: { icon: '✖', color: ANSIColors.RED },\n default: { icon: '⏲', color: ANSIColors.BLUE },\n};\n\nconst getIconAndColor = (status: DictionariesStatus['status']) => {\n return (\n statusIconsAndColors[status as keyof typeof statusIconsAndColors] ??\n statusIconsAndColors.default\n );\n};\n\n/**\n * Get all local dictionaries and push them simultaneously.\n */\nexport const push = async (options?: PushOptions): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n if (options?.build === true) {\n await prepareIntlayer(config, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(config);\n }\n\n try {\n const hasCMSAuth = await checkCMSAuth(config);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n const allDictionaries = Object.values(unmergedDictionariesRecord).flat();\n\n const customLocations = Array.from(\n new Set(\n allDictionaries\n .map((dictionary) => dictionary.location)\n .filter(\n (location) =>\n location && !['remote', 'local', 'hybrid'].includes(location)\n )\n )\n ) as string[];\n\n let selectedCustomLocations: string[] = [];\n\n if (customLocations.length > 0) {\n const { multiselect, confirm, isCancel } = await import('@clack/prompts');\n\n if (customLocations.length === 1) {\n const shouldPush = await confirm({\n message: `Do you want to push dictionaries with custom location ${colorize(customLocations[0], ANSIColors.BLUE, ANSIColors.RESET)}?`,\n initialValue: false,\n });\n\n if (isCancel(shouldPush)) {\n return;\n }\n\n if (shouldPush) {\n selectedCustomLocations = [customLocations[0]];\n }\n } else {\n const selected = await multiselect({\n message: 'Select custom locations to push:',\n options: customLocations.map((location) => ({\n value: location,\n label: location,\n })),\n required: false,\n });\n\n if (isCancel(selected)) {\n return;\n }\n\n selectedCustomLocations = selected as string[];\n }\n }\n\n let dictionaries: Dictionary[] = allDictionaries.filter((dictionary) => {\n const location =\n dictionary.location ?? config.dictionary?.location ?? 'local';\n\n return (\n location === 'remote' ||\n location === 'hybrid' ||\n selectedCustomLocations.includes(location)\n );\n });\n\n // Check if the dictionaries list is empty after filtering by location\n if (dictionaries.length === 0) {\n appLogger(\n `No dictionaries found to push. Only dictionaries with location ${colorize('remote', ANSIColors.BLUE, ANSIColors.RESET)}, ${colorize('hybrid', ANSIColors.BLUE, ANSIColors.RESET)} or selected custom locations are pushed.`,\n { level: 'warn' }\n );\n appLogger(\n `You can set the location in your dictionary file (e.g. ${colorize(\"{ key: 'my-key', location: 'hybrid', ... }\", ANSIColors.BLUE, ANSIColors.RESET)} or globally in your intlayer.config.ts file (e.g. ${colorize(\"{ dictionary: { location: 'hybrid' } }\", ANSIColors.BLUE, ANSIColors.RESET)}).`,\n { level: 'info' }\n );\n return;\n }\n\n const existingDictionariesKeys: string[] = Object.keys(\n unmergedDictionariesRecord\n );\n\n if (options?.dictionaries) {\n // Check if the provided dictionaries exist\n const noneExistingDictionariesOption = options.dictionaries.filter(\n (dictionaryId) => !existingDictionariesKeys.includes(dictionaryId)\n );\n\n if (noneExistingDictionariesOption.length > 0) {\n appLogger(\n `The following dictionaries do not exist: ${noneExistingDictionariesOption.join(\n ', '\n )} and have been ignored.`,\n {\n level: 'error',\n }\n );\n }\n\n // Filter the dictionaries from the provided list of IDs\n dictionaries = dictionaries.filter((dictionary) =>\n options.dictionaries?.includes(dictionary.key)\n );\n }\n\n if (options?.gitOptions) {\n const gitFiles = await listGitFiles(options.gitOptions);\n\n dictionaries = dictionaries.filter((dictionary) =>\n gitFiles.includes(\n join(config.content.baseDir, dictionary.filePath ?? '')\n )\n );\n }\n\n // Check if the dictionaries list is empty\n if (dictionaries.length === 0) {\n appLogger('No local dictionaries found', {\n level: 'error',\n });\n return;\n }\n\n appLogger('Pushing dictionaries:');\n\n // Prepare dictionaries statuses\n const dictionariesStatuses: DictionariesStatus[] = dictionaries.map(\n (dictionary) => ({\n dictionary,\n status: 'pending',\n })\n );\n\n // Initialize aggregated logger similar to loadDictionaries\n const logger = new PushLogger();\n logger.update(\n dictionariesStatuses.map<PushStatus>((s) => ({\n dictionaryKey: s.dictionary.key,\n status: 'pending',\n }))\n );\n\n const successfullyPushedDictionaries: Dictionary[] = [];\n\n const processDictionary = async (\n statusObj: DictionariesStatus\n ): Promise<void> => {\n statusObj.status = 'pushing';\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushing' },\n ]);\n\n try {\n const pushResult = await intlayerAPI.dictionary.pushDictionaries([\n statusObj.dictionary,\n ]);\n\n const updatedDictionaries = pushResult.data?.updatedDictionaries ?? [];\n const newDictionaries = pushResult.data?.newDictionaries ?? [];\n\n const allDictionaries = [...updatedDictionaries, ...newDictionaries];\n\n for (const remoteDictionaryData of allDictionaries) {\n const localDictionary = unmergedDictionariesRecord[\n remoteDictionaryData.key\n ]?.find(\n (dictionary) => dictionary.localId === remoteDictionaryData.localId\n );\n\n if (!localDictionary) continue;\n\n await writeContentDeclaration(\n { ...localDictionary, id: remoteDictionaryData.id },\n config\n );\n }\n\n if (\n updatedDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'modified';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'modified' },\n ]);\n } else if (\n newDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'pushed';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushed' },\n ]);\n } else {\n statusObj.status = 'unknown';\n }\n } catch (error) {\n statusObj.status = 'error';\n statusObj.error = error as Error;\n statusObj.errorMessage = `Error pushing dictionary ${statusObj.dictionary.key}: ${error}`;\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'error' },\n ]);\n }\n };\n\n // Process dictionaries in parallel with a concurrency limit (reuse parallelize)\n await parallelize(dictionariesStatuses, processDictionary, 5);\n\n // Stop the logger and render final state\n logger.finish();\n\n for (const dictionaryStatus of dictionariesStatuses) {\n const { icon, color } = getIconAndColor(dictionaryStatus.status);\n appLogger(\n ` - ${colorizeKey(dictionaryStatus.dictionary.key)} ${ANSIColors.GREY}[${color}${icon} ${dictionaryStatus.status}${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n // Output any error messages\n for (const statusObj of dictionariesStatuses) {\n if (statusObj.errorMessage) {\n appLogger(statusObj.errorMessage, {\n level: 'error',\n });\n }\n }\n\n // Handle delete or keep options\n const deleteOption = options?.deleteLocaleDictionary;\n const keepOption = options?.keepLocaleDictionary;\n\n if (deleteOption && keepOption) {\n throw new Error(\n 'Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options.'\n );\n }\n\n if (deleteOption) {\n // Delete only the successfully pushed dictionaries\n await deleteLocalDictionaries(successfullyPushedDictionaries, options);\n } else if (keepOption) {\n // Do nothing, keep the local dictionaries\n } else {\n // Ask the user\n const remoteDictionaries = successfullyPushedDictionaries.filter(\n (dictionary) => dictionary.location === 'remote'\n );\n const remoteDictionariesKeys = remoteDictionaries.map(\n (dictionary) => dictionary.key\n );\n\n if (remoteDictionaries.length > 0) {\n const { confirm, isCancel } = await import('@clack/prompts');\n\n const shouldDelete = await confirm({\n message: `Do you want to delete the local dictionaries that were successfully pushed? ${colorize('(Dictionaries:', ANSIColors.GREY, ANSIColors.RESET)} ${colorizeKey(remoteDictionariesKeys)}${colorize(')', ANSIColors.GREY, ANSIColors.RESET)}`,\n initialValue: false,\n });\n\n if (isCancel(shouldDelete)) {\n return;\n }\n\n if (shouldDelete) {\n await deleteLocalDictionaries(remoteDictionaries, options);\n }\n }\n }\n } catch (error) {\n appLogger(error, {\n level: 'error',\n });\n }\n};\n\nconst deleteLocalDictionaries = async (\n dictionariesToDelete: Dictionary[],\n options?: PushOptions\n): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n // Use a Set to collect all unique file paths\n const filePathsSet: Set<string> = new Set();\n\n for (const dictionary of dictionariesToDelete) {\n const { filePath } = dictionary;\n\n if (!filePath) {\n appLogger(\n `Dictionary ${colorizeKey(dictionary.key)} does not have a file path`,\n {\n level: 'error',\n }\n );\n continue;\n }\n\n filePathsSet.add(filePath);\n }\n\n for (const filePath of filePathsSet) {\n try {\n const stats = await fsPromises.lstat(filePath);\n\n if (stats.isFile()) {\n await fsPromises.unlink(filePath);\n appLogger(`Deleted file ${formatPath(filePath)}`, {});\n } else if (stats.isDirectory()) {\n appLogger(`Path is a directory ${formatPath(filePath)}, skipping.`, {});\n } else {\n appLogger(\n `Unknown file type for ${formatPath(filePath)}, skipping.`,\n {}\n );\n }\n } catch (err) {\n appLogger(`Error deleting ${formatPath(filePath)}: ${err}`, {\n level: 'error',\n });\n }\n }\n};\n"],"mappings":"gqBAyCA,MAAM,EAAuB,CAC3B,OAAQ,CAAE,KAAM,IAAK,MAAO,EAAW,MAAO,CAC9C,SAAU,CAAE,KAAM,IAAK,MAAO,EAAW,MAAO,CAChD,MAAO,CAAE,KAAM,IAAK,MAAO,EAAW,IAAK,CAC3C,QAAS,CAAE,KAAM,IAAK,MAAO,EAAW,KAAM,CAC/C,CAEK,EAAmB,GAErB,EAAqB,IACrB,EAAqB,QAOZ,EAAO,KAAO,IAAyC,CAClE,IAAM,EAAS,EAAiB,GAAS,cAAc,CACjD,EAAY,EAAa,EAAO,CAElC,GAAS,QAAU,GACrB,MAAM,EAAgB,EAAQ,CAAE,SAAU,GAAM,CAAC,CACjC,GAAS,QAAU,QACnC,MAAM,EAAgB,EAAO,CAG/B,GAAI,CAGF,GAAI,CAFe,MAAM,EAAa,EAAO,CAE5B,OAEjB,IAAM,EAAc,EAAoB,IAAA,GAAW,EAAO,CAEpD,EAA6B,EAAwB,EAAO,CAC5D,EAAkB,OAAO,OAAO,EAA2B,CAAC,MAAM,CAElE,EAAkB,MAAM,KAC5B,IAAI,IAC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M,CAAC,GAAG,EAAY,EAAuB,GAAG,EAAS,IAAK,EAAW,KAAM,EAAW,MAAM,GAC/O,aAAc,GACf,CAAC,CAEF,GAAI,EAAS,EAAa,CACxB,OAGE,GACF,MAAM,EAAwB,EAAoB,EAAQ,SAIzD,EAAO,CACd,EAAU,EAAO,CACf,MAAO,QACR,CAAC,GAIA,EAA0B,MAC9B,EACA,IACkB,CAElB,IAAM,EAAY,EADH,EAAiB,GAAS,cAAc,CACjB,CAGhC,EAA4B,IAAI,IAEtC,IAAK,IAAM,KAAc,EAAsB,CAC7C,GAAM,CAAE,YAAa,EAErB,GAAI,CAAC,EAAU,CACb,EACE,cAAc,EAAY,EAAW,IAAI,CAAC,4BAC1C,CACE,MAAO,QACR,CACF,CACD,SAGF,EAAa,IAAI,EAAS,CAG5B,IAAK,IAAM,KAAY,EACrB,GAAI,CACF,IAAM,EAAQ,MAAM,EAAW,MAAM,EAAS,CAE1C,EAAM,QAAQ,EAChB,MAAM,EAAW,OAAO,EAAS,CACjC,EAAU,gBAAgB,EAAW,EAAS,GAAI,EAAE,CAAC,EAC5C,EAAM,aAAa,CAC5B,EAAU,uBAAuB,EAAW,EAAS,CAAC,aAAc,EAAE,CAAC,CAEvE,EACE,yBAAyB,EAAW,EAAS,CAAC,aAC9C,EAAE,CACH,OAEI,EAAK,CACZ,EAAU,kBAAkB,EAAW,EAAS,CAAC,IAAI,IAAO,CAC1D,MAAO,QACR,CAAC"}
1
+ {"version":3,"file":"push.mjs","names":[],"sources":["../../../src/push/push.ts"],"sourcesContent":["import * as fsPromises from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { getIntlayerAPIProxy } from '@intlayer/api';\nimport {\n prepareIntlayer,\n writeContentDeclaration,\n} from '@intlayer/chokidar/build';\nimport {\n type ListGitFilesOptions,\n listGitFiles,\n logConfigDetails,\n} from '@intlayer/chokidar/cli';\nimport { formatPath, parallelize } from '@intlayer/chokidar/utils';\nimport {\n ANSIColors,\n colorize,\n colorizeKey,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { Dictionary } from '@intlayer/types';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport { PushLogger, type PushStatus } from '../pushLog';\nimport { checkCMSAuth } from '../utils/checkAccess';\n\ntype PushOptions = {\n deleteLocaleDictionary?: boolean;\n keepLocaleDictionary?: boolean;\n dictionaries?: string[];\n gitOptions?: ListGitFilesOptions;\n configOptions?: GetConfigurationOptions;\n build?: boolean;\n};\n\ntype DictionariesStatus = {\n dictionary: Dictionary;\n status: 'pending' | 'pushing' | 'modified' | 'pushed' | 'unknown' | 'error';\n error?: Error;\n errorMessage?: string;\n};\n\n// Print per-dictionary summary similar to loadDictionaries\nconst statusIconsAndColors = {\n pushed: { icon: '✔', color: ANSIColors.GREEN },\n modified: { icon: '✔', color: ANSIColors.GREEN },\n error: { icon: '✖', color: ANSIColors.RED },\n default: { icon: '⏲', color: ANSIColors.BLUE },\n};\n\nconst getIconAndColor = (status: DictionariesStatus['status']) => {\n return (\n statusIconsAndColors[status as keyof typeof statusIconsAndColors] ??\n statusIconsAndColors.default\n );\n};\n\n/**\n * Get all local dictionaries and push them simultaneously.\n */\nexport const push = async (options?: PushOptions): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n if (options?.build === true) {\n await prepareIntlayer(config, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(config);\n }\n\n try {\n const hasCMSAuth = await checkCMSAuth(config);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n const allDictionaries = Object.values(unmergedDictionariesRecord).flat();\n\n const customLocations = Array.from(\n new Set(\n allDictionaries\n .map((dictionary) => dictionary.location)\n .filter(\n (location) =>\n location && !['remote', 'local', 'hybrid'].includes(location)\n )\n )\n ) as string[];\n\n let selectedCustomLocations: string[] = [];\n\n if (customLocations.length > 0) {\n const { multiselect, confirm, isCancel } = await import('@clack/prompts');\n\n if (customLocations.length === 1) {\n const shouldPush = await confirm({\n message: `Do you want to push dictionaries with custom location ${colorize(customLocations[0], ANSIColors.BLUE, ANSIColors.RESET)}?`,\n initialValue: false,\n });\n\n if (isCancel(shouldPush)) {\n return;\n }\n\n if (shouldPush) {\n selectedCustomLocations = [customLocations[0]];\n }\n } else {\n const selected = await multiselect({\n message: 'Select custom locations to push:',\n options: customLocations.map((location) => ({\n value: location,\n label: location,\n })),\n required: false,\n });\n\n if (isCancel(selected)) {\n return;\n }\n\n selectedCustomLocations = selected as string[];\n }\n }\n\n let dictionaries: Dictionary[] = allDictionaries.filter((dictionary) => {\n const location =\n dictionary.location ?? config.dictionary?.location ?? 'local';\n\n return (\n location === 'remote' ||\n location === 'hybrid' ||\n selectedCustomLocations.includes(location)\n );\n });\n\n // Check if the dictionaries list is empty after filtering by location\n if (dictionaries.length === 0) {\n appLogger(\n `No dictionaries found to push. Only dictionaries with location ${colorize('remote', ANSIColors.BLUE, ANSIColors.RESET)}, ${colorize('hybrid', ANSIColors.BLUE, ANSIColors.RESET)} or selected custom locations are pushed.`,\n { level: 'warn' }\n );\n appLogger(\n `You can set the location in your dictionary file (e.g. ${colorize(\"{ key: 'my-key', location: 'hybrid', ... }\", ANSIColors.BLUE, ANSIColors.RESET)} or globally in your intlayer.config.ts file (e.g. ${colorize(\"{ dictionary: { location: 'hybrid' } }\", ANSIColors.BLUE, ANSIColors.RESET)}).`,\n { level: 'info' }\n );\n return;\n }\n\n const existingDictionariesKeys: string[] = Object.keys(\n unmergedDictionariesRecord\n );\n\n if (options?.dictionaries) {\n // Check if the provided dictionaries exist\n const noneExistingDictionariesOption = options.dictionaries.filter(\n (dictionaryId) => !existingDictionariesKeys.includes(dictionaryId)\n );\n\n if (noneExistingDictionariesOption.length > 0) {\n appLogger(\n `The following dictionaries do not exist: ${noneExistingDictionariesOption.join(\n ', '\n )} and have been ignored.`,\n {\n level: 'error',\n }\n );\n }\n\n // Filter the dictionaries from the provided list of IDs\n dictionaries = dictionaries.filter((dictionary) =>\n options.dictionaries?.includes(dictionary.key)\n );\n }\n\n if (options?.gitOptions) {\n const gitFiles = await listGitFiles(options.gitOptions);\n\n dictionaries = dictionaries.filter((dictionary) =>\n gitFiles.includes(\n join(config.content.baseDir, dictionary.filePath ?? '')\n )\n );\n }\n\n // Check if the dictionaries list is empty\n if (dictionaries.length === 0) {\n appLogger('No local dictionaries found', {\n level: 'error',\n });\n return;\n }\n\n appLogger('Pushing dictionaries:');\n\n // Prepare dictionaries statuses\n const dictionariesStatuses: DictionariesStatus[] = dictionaries.map(\n (dictionary) => ({\n dictionary,\n status: 'pending',\n })\n );\n\n // Initialize aggregated logger similar to loadDictionaries\n const logger = new PushLogger();\n logger.update(\n dictionariesStatuses.map<PushStatus>((s) => ({\n dictionaryKey: s.dictionary.key,\n status: 'pending',\n }))\n );\n\n const successfullyPushedDictionaries: Dictionary[] = [];\n\n const processDictionary = async (\n statusObj: DictionariesStatus\n ): Promise<void> => {\n statusObj.status = 'pushing';\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushing' },\n ]);\n\n try {\n const pushResult = await intlayerAPI.dictionary.pushDictionaries([\n statusObj.dictionary,\n ]);\n\n const updatedDictionaries = pushResult.data?.updatedDictionaries ?? [];\n const newDictionaries = pushResult.data?.newDictionaries ?? [];\n\n const allDictionaries = [...updatedDictionaries, ...newDictionaries];\n\n for (const remoteDictionaryData of allDictionaries) {\n const localDictionary = unmergedDictionariesRecord[\n remoteDictionaryData.key\n ]?.find(\n (dictionary) => dictionary.localId === remoteDictionaryData.localId\n );\n\n if (!localDictionary) continue;\n\n await writeContentDeclaration(\n { ...localDictionary, id: remoteDictionaryData.id },\n config\n );\n }\n\n if (\n updatedDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'modified';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'modified' },\n ]);\n } else if (\n newDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'pushed';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushed' },\n ]);\n } else {\n statusObj.status = 'unknown';\n }\n } catch (error) {\n statusObj.status = 'error';\n statusObj.error = error as Error;\n statusObj.errorMessage = `Error pushing dictionary ${statusObj.dictionary.key}: ${error}`;\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'error' },\n ]);\n }\n };\n\n // Process dictionaries in parallel with a concurrency limit (reuse parallelize)\n await parallelize(dictionariesStatuses, processDictionary, 5);\n\n // Stop the logger and render final state\n logger.finish();\n\n for (const dictionaryStatus of dictionariesStatuses) {\n const { icon, color } = getIconAndColor(dictionaryStatus.status);\n appLogger(\n ` - ${colorizeKey(dictionaryStatus.dictionary.key)} ${ANSIColors.GREY}[${color}${icon} ${dictionaryStatus.status}${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n // Output any error messages\n for (const statusObj of dictionariesStatuses) {\n if (statusObj.errorMessage) {\n appLogger(statusObj.errorMessage, {\n level: 'error',\n });\n }\n }\n\n // Handle delete or keep options\n const deleteOption = options?.deleteLocaleDictionary;\n const keepOption = options?.keepLocaleDictionary;\n\n if (deleteOption && keepOption) {\n throw new Error(\n 'Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options.'\n );\n }\n\n if (deleteOption) {\n // Delete only the successfully pushed dictionaries\n await deleteLocalDictionaries(successfullyPushedDictionaries, options);\n } else if (keepOption) {\n // Do nothing, keep the local dictionaries\n } else {\n // Ask the user\n const remoteDictionaries = successfullyPushedDictionaries.filter(\n (dictionary) => dictionary.location === 'remote'\n );\n const remoteDictionariesKeys = remoteDictionaries.map(\n (dictionary) => dictionary.key\n );\n\n if (remoteDictionaries.length > 0) {\n const { confirm, isCancel } = await import('@clack/prompts');\n\n const shouldDelete = await confirm({\n message: `Do you want to delete the local dictionaries that were successfully pushed? ${colorize('(Dictionaries:', ANSIColors.GREY, ANSIColors.RESET)} ${colorizeKey(remoteDictionariesKeys)}${colorize(')', ANSIColors.GREY, ANSIColors.RESET)}`,\n initialValue: false,\n });\n\n if (isCancel(shouldDelete)) {\n return;\n }\n\n if (shouldDelete) {\n await deleteLocalDictionaries(remoteDictionaries, options);\n }\n }\n }\n } catch (error) {\n appLogger(error, {\n level: 'error',\n });\n }\n};\n\nconst deleteLocalDictionaries = async (\n dictionariesToDelete: Dictionary[],\n options?: PushOptions\n): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n // Use a Set to collect all unique file paths\n const filePathsSet: Set<string> = new Set();\n\n for (const dictionary of dictionariesToDelete) {\n const { filePath } = dictionary;\n\n if (!filePath) {\n appLogger(\n `Dictionary ${colorizeKey(dictionary.key)} does not have a file path`,\n {\n level: 'error',\n }\n );\n continue;\n }\n\n filePathsSet.add(filePath);\n }\n\n for (const filePath of filePathsSet) {\n try {\n const stats = await fsPromises.lstat(filePath);\n\n if (stats.isFile()) {\n await fsPromises.unlink(filePath);\n appLogger(`Deleted file ${formatPath(filePath)}`, {});\n } else if (stats.isDirectory()) {\n appLogger(`Path is a directory ${formatPath(filePath)}, skipping.`, {});\n } else {\n appLogger(\n `Unknown file type for ${formatPath(filePath)}, skipping.`,\n {}\n );\n }\n } catch (err) {\n appLogger(`Error deleting ${formatPath(filePath)}: ${err}`, {\n level: 'error',\n });\n }\n }\n};\n"],"mappings":"srBA6CA,MAAM,EAAuB,CAC3B,OAAQ,CAAE,KAAM,IAAK,MAAO,EAAW,MAAO,CAC9C,SAAU,CAAE,KAAM,IAAK,MAAO,EAAW,MAAO,CAChD,MAAO,CAAE,KAAM,IAAK,MAAO,EAAW,IAAK,CAC3C,QAAS,CAAE,KAAM,I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AAS,CAAC,aAAc,EAAE,CAAC,CAEvE,EACE,yBAAyB,EAAW,EAAS,CAAC,aAC9C,EAAE,CACH,OAEI,EAAK,CACZ,EAAU,kBAAkB,EAAW,EAAS,CAAC,IAAI,IAAO,CAC1D,MAAO,QACR,CAAC"}
@@ -1,2 +1,2 @@
1
- import{checkCMSAuth as e}from"./utils/checkAccess.mjs";import{getIntlayerAPIProxy as t}from"@intlayer/api";import{getConfiguration as n}from"@intlayer/config/node";import{getAppLogger as r}from"@intlayer/config/logger";const i=async i=>{let a=n(i?.configOptions),o=r(a);if(!await e(a,!1))return;let s=await t(void 0,a).project.pushProjectConfiguration(a);if(!s.data)throw Error(`Error pushing project configuration`);o(`Project configuration pushed successfully`),o(JSON.stringify(s.data,null,2))};export{i as pushConfig};
1
+ import{checkCMSAuth as e}from"./utils/checkAccess.mjs";import{getIntlayerAPIProxy as t}from"@intlayer/api";import{getAppLogger as n}from"@intlayer/config/logger";import{logConfigDetails as r}from"@intlayer/chokidar/cli";import{getConfiguration as i}from"@intlayer/config/node";const a=async a=>{let o=i(a?.configOptions);r(a?.configOptions);let s=n(o);if(!await e(o,!1))return;let c=await t(void 0,o).project.pushProjectConfiguration(o);if(!c.data)throw Error(`Error pushing project configuration`);s(`Project configuration pushed successfully`),s(JSON.stringify(c.data,null,2))};export{a as pushConfig};
2
2
  //# sourceMappingURL=pushConfig.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"pushConfig.mjs","names":[],"sources":["../../src/pushConfig.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { checkCMSAuth } from './utils/checkAccess';\n\ntype PushOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const pushConfig = async (options?: PushOptions) => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n const hasCMSAuth = await checkCMSAuth(config, false);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n // Push the project configuration\n const getDictionariesKeysResult =\n await intlayerAPI.project.pushProjectConfiguration(config);\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('Error pushing project configuration');\n }\n\n appLogger('Project configuration pushed successfully');\n\n appLogger(JSON.stringify(getDictionariesKeysResult.data, null, 2));\n};\n"],"mappings":"2NAYA,MAAa,EAAa,KAAO,IAA0B,CACzD,IAAM,EAAS,EAAiB,GAAS,cAAc,CACjD,EAAY,EAAa,EAAO,CAItC,GAAI,CAFe,MAAM,EAAa,EAAQ,GAAM,CAEnC,OAKjB,IAAM,EACJ,MAJkB,EAAoB,IAAA,GAAW,EAAO,CAItC,QAAQ,yBAAyB,EAAO,CAE5D,GAAI,CAAC,EAA0B,KAC7B,MAAU,MAAM,sCAAsC,CAGxD,EAAU,4CAA4C,CAEtD,EAAU,KAAK,UAAU,EAA0B,KAAM,KAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"pushConfig.mjs","names":[],"sources":["../../src/pushConfig.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\nimport { logConfigDetails } from '@intlayer/chokidar/cli';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { checkCMSAuth } from './utils/checkAccess';\n\ntype PushOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const pushConfig = async (options?: PushOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n const hasCMSAuth = await checkCMSAuth(config, false);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n // Push the project configuration\n const getDictionariesKeysResult =\n await intlayerAPI.project.pushProjectConfiguration(config);\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('Error pushing project configuration');\n }\n\n appLogger('Project configuration pushed successfully');\n\n appLogger(JSON.stringify(getDictionariesKeysResult.data, null, 2));\n};\n"],"mappings":"qRAaA,MAAa,EAAa,KAAO,IAA0B,CACzD,IAAM,EAAS,EAAiB,GAAS,cAAc,CACvD,EAAiB,GAAS,cAAc,CAExC,IAAM,EAAY,EAAa,EAAO,CAItC,GAAI,CAFe,MAAM,EAAa,EAAQ,GAAM,CAEnC,OAKjB,IAAM,EACJ,MAJkB,EAAoB,IAAA,GAAW,EAAO,CAItC,QAAQ,yBAAyB,EAAO,CAE5D,GAAI,CAAC,EAA0B,KAC7B,MAAU,MAAM,sCAAsC,CAGxD,EAAU,4CAA4C,CAEtD,EAAU,KAAK,UAAU,EAA0B,KAAM,KAAM,EAAE,CAAC"}
@@ -1,2 +1,2 @@
1
- import{setupAI as e}from"../utils/setupAI.mjs";import{checkFileModifiedRange as t}from"../utils/checkFileModifiedRange.mjs";import{getOutputFilePath as n}from"../utils/getOutputFilePath.mjs";import{reviewFileBlockAware as r}from"./reviewDocBlockAware.mjs";import{formatLocale as i,formatPath as a,parallelize as o}from"@intlayer/chokidar/utils";import{getConfiguration as s}from"@intlayer/config/node";import{join as c,relative as l}from"node:path";import{listGitFiles as u,listGitLines as d}from"@intlayer/chokidar/cli";import{ANSIColors as f,colorize as p,colorizeNumber as m,getAppLogger as h}from"@intlayer/config/logger";import{existsSync as g}from"node:fs";import _ from"fast-glob";const v=async({docPattern:v,locales:y,excludedGlobPattern:b,baseLocale:x,aiOptions:S,nbSimultaneousFileProcessed:C,configOptions:w,customInstructions:T,skipIfModifiedBefore:E,skipIfModifiedAfter:D,skipIfExists:O,gitOptions:k})=>{let A=s(w),j=h(A),M=await e(A,S);if(!M?.hasAIAccess)return;let{aiClient:N,aiConfig:P}=M;C&&C>10&&(j(`Warning: nbSimultaneousFileProcessed is set to ${C}, which is greater than 10. Setting it to 10.`),C=10);let F=await _(v,{ignore:b});if(k){let e=await u(k);e&&(F=F.filter(t=>e.some(e=>c(process.cwd(),t)===e)))}j(`Base locale is ${i(x)}`),j(`Reviewing ${m(y.length)} locales: [ ${i(y)} ]`),j(`Reviewing ${m(F.length)} files:`),j(F.map(e=>` - ${a(e)}\n`)),await o(F.flatMap(e=>y.map(o=>async()=>{j(`Reviewing file: ${a(e)} to ${i(o)}`);let s=c(A.content.baseDir,e),u=n(s,o,x);if(O&&g(u)){let e=l(A.content.baseDir,u);j(`${p(`⊘`,f.YELLOW)} File ${a(e)} already exists, skipping.`);return}if(g(u)){let e=t(u,{skipIfModifiedBefore:E,skipIfModifiedAfter:D});if(e.isSkipped){j(e.message);return}}else (E||D)&&j(`${p(`!`,f.YELLOW)} File ${a(u)} does not exist, skipping modification date check.`);let m;if(k){let e=await d(s,k);j(`Git changed lines: ${e.join(`, `)}`),m=e}await r(s,u,o,x,S,w,T,m,N,P)})),e=>e(),C??3)};export{v as reviewDoc};
1
+ import{setupAI as e}from"../utils/setupAI.mjs";import{checkFileModifiedRange as t}from"../utils/checkFileModifiedRange.mjs";import{getOutputFilePath as n}from"../utils/getOutputFilePath.mjs";import{reviewFileBlockAware as r}from"./reviewDocBlockAware.mjs";import{ANSIColors as i,colorize as a,colorizeNumber as o,getAppLogger as s}from"@intlayer/config/logger";import{listGitFiles as c,listGitLines as l,logConfigDetails as u}from"@intlayer/chokidar/cli";import{formatLocale as d,formatPath as f,parallelize as p}from"@intlayer/chokidar/utils";import{getConfiguration as m}from"@intlayer/config/node";import{join as h,relative as g}from"node:path";import{existsSync as _}from"node:fs";import v from"fast-glob";const y=async({docPattern:y,locales:b,excludedGlobPattern:x,baseLocale:S,aiOptions:C,nbSimultaneousFileProcessed:w,configOptions:T,customInstructions:E,skipIfModifiedBefore:D,skipIfModifiedAfter:O,skipIfExists:k,gitOptions:A})=>{let j=m(T);u(T);let M=s(j),N=await e(j,C);if(!N?.hasAIAccess)return;let{aiClient:P,aiConfig:F}=N;w&&w>10&&(M(`Warning: nbSimultaneousFileProcessed is set to ${w}, which is greater than 10. Setting it to 10.`),w=10);let I=await v(y,{ignore:x});if(A){let e=await c(A);e&&(I=I.filter(t=>e.some(e=>h(process.cwd(),t)===e)))}M(`Base locale is ${d(S)}`),M(`Reviewing ${o(b.length)} locales: [ ${d(b)} ]`),M(`Reviewing ${o(I.length)} files:`),M(I.map(e=>` - ${f(e)}\n`)),await p(I.flatMap(e=>b.map(o=>async()=>{M(`Reviewing file: ${f(e)} to ${d(o)}`);let s=h(j.content.baseDir,e),c=n(s,o,S);if(k&&_(c)){let e=g(j.content.baseDir,c);M(`${a(`⊘`,i.YELLOW)} File ${f(e)} already exists, skipping.`);return}if(_(c)){let e=t(c,{skipIfModifiedBefore:D,skipIfModifiedAfter:O});if(e.isSkipped){M(e.message);return}}else (D||O)&&M(`${a(`!`,i.YELLOW)} File ${f(c)} does not exist, skipping modification date check.`);let u;if(A){let e=await l(s,A);M(`Git changed lines: ${e.join(`, `)}`),u=e}await r(s,c,o,S,C,T,E,u,P,F)})),e=>e(),w??3)};export{y as reviewDoc};
2
2
  //# sourceMappingURL=reviewDoc.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"reviewDoc.mjs","names":[],"sources":["../../../src/reviewDoc/reviewDoc.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { join, relative } from 'node:path';\nimport type { AIOptions } from '@intlayer/api';\nimport {\n type ListGitFilesOptions,\n listGitFiles,\n listGitLines,\n} from '@intlayer/chokidar/cli';\nimport {\n formatLocale,\n formatPath,\n parallelize,\n} from '@intlayer/chokidar/utils';\nimport {\n ANSIColors,\n colorize,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { Locale } from '@intlayer/types';\nimport fg from 'fast-glob';\nimport { checkFileModifiedRange } from '../utils/checkFileModifiedRange';\nimport { getOutputFilePath } from '../utils/getOutputFilePath';\nimport { setupAI } from '../utils/setupAI';\nimport { reviewFileBlockAware } from './reviewDocBlockAware';\n\ntype ReviewDocOptions = {\n docPattern: string[];\n locales: Locale[];\n excludedGlobPattern: string[];\n baseLocale: Locale;\n aiOptions?: AIOptions;\n nbSimultaneousFileProcessed?: number;\n configOptions?: GetConfigurationOptions;\n customInstructions?: string;\n skipIfModifiedBefore?: number | string | Date;\n skipIfModifiedAfter?: number | string | Date;\n skipIfExists?: boolean;\n gitOptions?: ListGitFilesOptions;\n};\n\n/**\n * Main audit function: scans all .md files in \"en/\" (unless you specified DOC_LIST),\n * then audits them to each locale in LOCALE_LIST.\n */\nexport const reviewDoc = async ({\n docPattern,\n locales,\n excludedGlobPattern,\n baseLocale,\n aiOptions,\n nbSimultaneousFileProcessed,\n configOptions,\n customInstructions,\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n skipIfExists,\n gitOptions,\n}: ReviewDocOptions) => {\n const configuration = getConfiguration(configOptions);\n const appLogger = getAppLogger(configuration);\n\n const aiResult = await setupAI(configuration, aiOptions);\n\n if (!aiResult?.hasAIAccess) return;\n\n const { aiClient, aiConfig } = aiResult;\n\n if (nbSimultaneousFileProcessed && nbSimultaneousFileProcessed > 10) {\n appLogger(\n `Warning: nbSimultaneousFileProcessed is set to ${nbSimultaneousFileProcessed}, which is greater than 10. Setting it to 10.`\n );\n nbSimultaneousFileProcessed = 10; // Limit the number of simultaneous file processed to 10\n }\n\n let docList: string[] = await fg(docPattern, {\n ignore: excludedGlobPattern,\n });\n\n if (gitOptions) {\n const gitChangedFiles = await listGitFiles(gitOptions);\n\n if (gitChangedFiles) {\n // Convert dictionary file paths to be relative to git root for comparison\n\n // Filter dictionaries based on git changed files\n docList = docList.filter((path) =>\n gitChangedFiles.some((gitFile) => join(process.cwd(), path) === gitFile)\n );\n }\n }\n\n // OAuth handled by API proxy internally\n\n appLogger(`Base locale is ${formatLocale(baseLocale)}`);\n appLogger(\n `Reviewing ${colorizeNumber(locales.length)} locales: [ ${formatLocale(locales)} ]`\n );\n\n appLogger(`Reviewing ${colorizeNumber(docList.length)} files:`);\n appLogger(docList.map((path) => ` - ${formatPath(path)}\\n`));\n\n // Create all tasks to be processed\n const allTasks = docList.flatMap((docPath) =>\n locales.map((locale) => async () => {\n appLogger(\n `Reviewing file: ${formatPath(docPath)} to ${formatLocale(locale)}`\n );\n\n const absoluteBaseFilePath = join(configuration.content.baseDir, docPath);\n const outputFilePath = getOutputFilePath(\n absoluteBaseFilePath,\n locale,\n baseLocale\n );\n\n // Skip if file exists and skipIfExists option is enabled\n if (skipIfExists && existsSync(outputFilePath)) {\n const relativePath = relative(\n configuration.content.baseDir,\n outputFilePath\n );\n appLogger(\n `${colorize('⊘', ANSIColors.YELLOW)} File ${formatPath(relativePath)} already exists, skipping.`\n );\n return;\n }\n\n // Check modification range only if the file exists\n if (existsSync(outputFilePath)) {\n const fileModificationData = checkFileModifiedRange(outputFilePath, {\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n });\n\n if (fileModificationData.isSkipped) {\n appLogger(fileModificationData.message);\n return;\n }\n } else if (skipIfModifiedBefore || skipIfModifiedAfter) {\n // Log if we intended to check modification time but couldn't because the file doesn't exist\n appLogger(\n `${colorize('!', ANSIColors.YELLOW)} File ${formatPath(outputFilePath)} does not exist, skipping modification date check.`\n );\n }\n\n let changedLines: number[] | undefined;\n // FIXED: Enable git optimization that was previously commented out\n if (gitOptions) {\n const gitChangedLines = await listGitLines(\n absoluteBaseFilePath,\n gitOptions\n );\n\n appLogger(`Git changed lines: ${gitChangedLines.join(', ')}`);\n changedLines = gitChangedLines;\n }\n\n await reviewFileBlockAware(\n absoluteBaseFilePath,\n outputFilePath,\n locale as Locale,\n baseLocale,\n aiOptions,\n configOptions,\n customInstructions,\n changedLines,\n aiClient,\n aiConfig\n );\n })\n );\n\n await parallelize(\n allTasks,\n (task) => task(),\n nbSimultaneousFileProcessed ?? 3\n );\n};\n"],"mappings":"grBAiDA,MAAa,EAAY,MAAO,CAC9B,aACA,UACA,sBACA,aACA,YACA,8BACA,gBACA,qBACA,uBACA,sBACA,eACA,gBACsB,CACtB,IAAM,EAA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IAAK,EAAW,OAAO,CAAC,QAAQ,EAAW,EAAe,CAAC,oDACxE,CAGH,IAAI,EAEJ,GAAI,EAAY,CACd,IAAM,EAAkB,MAAM,EAC5B,EACA,EACD,CAED,EAAU,sBAAsB,EAAgB,KAAK,KAAK,GAAG,CAC7D,EAAe,EAGjB,MAAM,EACJ,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACD,EACD,CACH,CAIE,GAAS,GAAM,CAChB,GAA+B,EAChC"}
1
+ {"version":3,"file":"reviewDoc.mjs","names":[],"sources":["../../../src/reviewDoc/reviewDoc.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { join, relative } from 'node:path';\nimport type { AIOptions } from '@intlayer/api';\nimport {\n type ListGitFilesOptions,\n listGitFiles,\n listGitLines,\n logConfigDetails,\n} from '@intlayer/chokidar/cli';\nimport {\n formatLocale,\n formatPath,\n parallelize,\n} from '@intlayer/chokidar/utils';\nimport {\n ANSIColors,\n colorize,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { Locale } from '@intlayer/types';\nimport fg from 'fast-glob';\nimport { checkFileModifiedRange } from '../utils/checkFileModifiedRange';\nimport { getOutputFilePath } from '../utils/getOutputFilePath';\nimport { setupAI } from '../utils/setupAI';\nimport { reviewFileBlockAware } from './reviewDocBlockAware';\n\ntype ReviewDocOptions = {\n docPattern: string[];\n locales: Locale[];\n excludedGlobPattern: string[];\n baseLocale: Locale;\n aiOptions?: AIOptions;\n nbSimultaneousFileProcessed?: number;\n configOptions?: GetConfigurationOptions;\n customInstructions?: string;\n skipIfModifiedBefore?: number | string | Date;\n skipIfModifiedAfter?: number | string | Date;\n skipIfExists?: boolean;\n gitOptions?: ListGitFilesOptions;\n};\n\n/**\n * Main audit function: scans all .md files in \"en/\" (unless you specified DOC_LIST),\n * then audits them to each locale in LOCALE_LIST.\n */\nexport const reviewDoc = async ({\n docPattern,\n locales,\n excludedGlobPattern,\n baseLocale,\n aiOptions,\n nbSimultaneousFileProcessed,\n configOptions,\n customInstructions,\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n skipIfExists,\n gitOptions,\n}: ReviewDocOptions) => {\n const configuration = getConfiguration(configOptions);\n logConfigDetails(configOptions);\n\n const appLogger = getAppLogger(configuration);\n\n const aiResult = await setupAI(configuration, aiOptions);\n\n if (!aiResult?.hasAIAccess) return;\n\n const { aiClient, aiConfig } = aiResult;\n\n if (nbSimultaneousFileProcessed && nbSimultaneousFileProcessed > 10) {\n appLogger(\n `Warning: nbSimultaneousFileProcessed is set to ${nbSimultaneousFileProcessed}, which is greater than 10. Setting it to 10.`\n );\n nbSimultaneousFileProcessed = 10; // Limit the number of simultaneous file processed to 10\n }\n\n let docList: string[] = await fg(docPattern, {\n ignore: excludedGlobPattern,\n });\n\n if (gitOptions) {\n const gitChangedFiles = await listGitFiles(gitOptions);\n\n if (gitChangedFiles) {\n // Convert dictionary file paths to be relative to git root for comparison\n\n // Filter dictionaries based on git changed files\n docList = docList.filter((path) =>\n gitChangedFiles.some((gitFile) => join(process.cwd(), path) === gitFile)\n );\n }\n }\n\n // OAuth handled by API proxy internally\n\n appLogger(`Base locale is ${formatLocale(baseLocale)}`);\n appLogger(\n `Reviewing ${colorizeNumber(locales.length)} locales: [ ${formatLocale(locales)} ]`\n );\n\n appLogger(`Reviewing ${colorizeNumber(docList.length)} files:`);\n appLogger(docList.map((path) => ` - ${formatPath(path)}\\n`));\n\n // Create all tasks to be processed\n const allTasks = docList.flatMap((docPath) =>\n locales.map((locale) => async () => {\n appLogger(\n `Reviewing file: ${formatPath(docPath)} to ${formatLocale(locale)}`\n );\n\n const absoluteBaseFilePath = join(configuration.content.baseDir, docPath);\n const outputFilePath = getOutputFilePath(\n absoluteBaseFilePath,\n locale,\n baseLocale\n );\n\n // Skip if file exists and skipIfExists option is enabled\n if (skipIfExists && existsSync(outputFilePath)) {\n const relativePath = relative(\n configuration.content.baseDir,\n outputFilePath\n );\n appLogger(\n `${colorize('⊘', ANSIColors.YELLOW)} File ${formatPath(relativePath)} already exists, skipping.`\n );\n return;\n }\n\n // Check modification range only if the file exists\n if (existsSync(outputFilePath)) {\n const fileModificationData = checkFileModifiedRange(outputFilePath, {\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n });\n\n if (fileModificationData.isSkipped) {\n appLogger(fileModificationData.message);\n return;\n }\n } else if (skipIfModifiedBefore || skipIfModifiedAfter) {\n // Log if we intended to check modification time but couldn't because the file doesn't exist\n appLogger(\n `${colorize('!', ANSIColors.YELLOW)} File ${formatPath(outputFilePath)} does not exist, skipping modification date check.`\n );\n }\n\n let changedLines: number[] | undefined;\n // FIXED: Enable git optimization that was previously commented out\n if (gitOptions) {\n const gitChangedLines = await listGitLines(\n absoluteBaseFilePath,\n gitOptions\n );\n\n appLogger(`Git changed lines: ${gitChangedLines.join(', ')}`);\n changedLines = gitChangedLines;\n }\n\n await reviewFileBlockAware(\n absoluteBaseFilePath,\n outputFilePath,\n locale as Locale,\n baseLocale,\n aiOptions,\n configOptions,\n customInstructions,\n changedLines,\n aiClient,\n aiConfig\n );\n })\n );\n\n await parallelize(\n allTasks,\n (task) => task(),\n nbSimultaneousFileProcessed ?? 3\n );\n};\n"],"mappings":"ssBAkDA,MAAa,EAAY,MAAO,CAC9B,aACA,UACA,sBACA,aACA,YACA,8BACA,gBACA,qBACA,uBACA,sBACA,eACA,gBACsB,CACtB,IAAM,EAAgB,EAAiB,EAAc,CACrD,EAAiB,EAAc,CAE/B,IAAM,EAAY,EAAa,EAAc,CAEvC,EAAW,MAAM,EAAQ,EAAe,EAAU,CAExD,GAAI,CAAC,GAAU,YAAa,OAE5B,GAAM,CAAE,WAAU,YAAa,EAE3B,GAA+B,EAA8B,KAC/D,EACE,kDAAkD,EAA4B,+CAC/E,CACD,EAA8B,IAGhC,IAAI,EAAoB,MAAM,EAAG,EAAY,CAC3C,OAAQ,EACT,CAAC,CAEF,GAAI,EA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A+B,EAChC"}
@@ -1,2 +1,2 @@
1
- import{readAsset as e}from"../_virtual/_utils_asset.mjs";import{sanitizeChunk as t,validateTranslation as n}from"../translateDoc/validation.mjs";import{mergeReviewedSegments as r}from"../translation-alignment/rebuildDocument.mjs";import{buildAlignmentPlan as i}from"../translation-alignment/pipeline.mjs";import{chunkInference as a}from"../utils/chunkInference.mjs";import{fixChunkStartEndChars as o}from"../utils/fixChunkStartEndChars.mjs";import{formatLocale as s,formatPath as c}from"@intlayer/chokidar/utils";import{getConfiguration as l}from"@intlayer/config/node";import{dirname as u}from"node:path";import{ANSIColors as d,colon as f,colorize as p,colorizeNumber as m,getAppLogger as h}from"@intlayer/config/logger";import{retryManager as g}from"@intlayer/config/utils";import{mkdirSync as _,writeFileSync as v}from"node:fs";import{readFile as y}from"node:fs/promises";import{getLocaleName as b}from"@intlayer/core/localization";import{Locales as x}from"@intlayer/types";const S=async(S,C,w,T,E,D,O,k,A,j)=>{let M=l(D),N=h(M),P=await y(S,`utf-8`),F=await y(C,`utf-8`).catch(()=>``),I=e(`./prompts/REVIEW_PROMPT.md`,`utf-8`).replaceAll(`{{localeName}}`,`${s(w,!1)}`).replaceAll(`{{baseLocaleName}}`,`${s(T,!1)}`).replace(`{{applicationContext}}`,E?.applicationContext??`-`).replace(`{{customInstructions}}`,O??`-`),L=[f(`${d.GREY_DARK}[${c(S)}${d.GREY_DARK}] `,{colSize:40}),`→ ${d.RESET}`].join(``),R=[f(`${d.GREY_DARK}[${c(S)}${d.GREY_DARK}][${s(w)}${d.GREY_DARK}] `,{colSize:40}),`→ ${d.RESET}`].join(``),{englishBlocks:z,frenchBlocks:B,plan:V,segmentsToReview:H}=i({englishText:P,frenchText:F,changedLines:k});if(N(`${L}Block-aware alignment complete. Total blocks: EN=${m(z.length)}, FR=${m(B.length)}`),N(`${L}Actions: reuse=${m(V.actions.filter(e=>e.kind===`reuse`).length)}, review=${m(V.actions.filter(e=>e.kind===`review`).length)}, new=${m(V.actions.filter(e=>e.kind===`insert_new`).length)}, delete=${m(V.actions.filter(e=>e.kind===`delete`).length)}`),H.length===0){N(`${L}No segments need review, reusing existing translation`),_(u(C),{recursive:!0}),v(C,r(V,B,new Map)),N(`${p(`✔`,d.GREEN)} File ${c(C)} updated successfully (no changes needed).`);return}N(`${L}Segments to review: ${m(H.length)}`);let U=new Map;for(let e of H){let r=H.indexOf(e)+1,i=e.englishBlock,c=()=>`**BLOCK ${r} of ${H.length}** is the base block in ${s(T,!1)} as reference.\n///chunksStart///\n`+i.content+`///chunksEnd///`,l=()=>`**BLOCK ${r} of ${H.length}** is the current block to review in ${s(w,!1)}.\n///chunksStart///\n`+(e.frenchBlockText??``)+`///chunksEnd///`,u=await g(async()=>{let e=await a([{role:`system`,content:I},{role:`system`,content:c()},{role:`system`,content:l()},{role:`system`,content:`The next user message will be the **BLOCK ${m(r)} of ${m(H.length)}** that should be translated in ${b(w,x.ENGLISH)} (${w}).`},{role:`user`,content:i.content}],E,M,A,j);N(`${R}${m(e.tokenUsed)} tokens used - Block ${m(r)} of ${m(H.length)}`);let s=t(e?.fileContent,i.content);if(s=o(s,i.content),!n(i.content,s,N))throw Error(`Validation failed for chunk (structure or length mismatch). Retrying...`);return s})();U.set(e.actionIndex,u)}let W=r(V,B,U);_(u(C),{recursive:!0}),v(C,W),N(`${p(`✔`,d.GREEN)} File ${c(C)} created/updated successfully.`)};export{S as reviewFileBlockAware};
1
+ import{readAsset as e}from"../_virtual/_utils_asset.mjs";import{sanitizeChunk as t,validateTranslation as n}from"../translateDoc/validation.mjs";import{mergeReviewedSegments as r}from"../translation-alignment/rebuildDocument.mjs";import{buildAlignmentPlan as i}from"../translation-alignment/pipeline.mjs";import{chunkInference as a}from"../utils/chunkInference.mjs";import{fixChunkStartEndChars as o}from"../utils/fixChunkStartEndChars.mjs";import{ANSIColors as s,colon as c,colorize as l,colorizeNumber as u,getAppLogger as d}from"@intlayer/config/logger";import{formatLocale as f,formatPath as p}from"@intlayer/chokidar/utils";import{getConfiguration as m}from"@intlayer/config/node";import{dirname as h}from"node:path";import{retryManager as g}from"@intlayer/config/utils";import{mkdirSync as _,writeFileSync as v}from"node:fs";import{readFile as y}from"node:fs/promises";import{getLocaleName as b}from"@intlayer/core/localization";import{Locales as x}from"@intlayer/types";const S=async(S,C,w,T,E,D,O,k,A,j)=>{let M=m(D),N=d(M),P=await y(S,`utf-8`),F=await y(C,`utf-8`).catch(()=>``),I=e(`./prompts/REVIEW_PROMPT.md`,`utf-8`).replaceAll(`{{localeName}}`,`${f(w,!1)}`).replaceAll(`{{baseLocaleName}}`,`${f(T,!1)}`).replace(`{{applicationContext}}`,E?.applicationContext??`-`).replace(`{{customInstructions}}`,O??`-`),L=[c(`${s.GREY_DARK}[${p(S)}${s.GREY_DARK}] `,{colSize:40}),`→ ${s.RESET}`].join(``),R=[c(`${s.GREY_DARK}[${p(S)}${s.GREY_DARK}][${f(w)}${s.GREY_DARK}] `,{colSize:40}),`→ ${s.RESET}`].join(``),{englishBlocks:z,frenchBlocks:B,plan:V,segmentsToReview:H}=i({englishText:P,frenchText:F,changedLines:k});if(N(`${L}Block-aware alignment complete. Total blocks: EN=${u(z.length)}, FR=${u(B.length)}`),N(`${L}Actions: reuse=${u(V.actions.filter(e=>e.kind===`reuse`).length)}, review=${u(V.actions.filter(e=>e.kind===`review`).length)}, new=${u(V.actions.filter(e=>e.kind===`insert_new`).length)}, delete=${u(V.actions.filter(e=>e.kind===`delete`).length)}`),H.length===0){N(`${L}No segments need review, reusing existing translation`),_(h(C),{recursive:!0}),v(C,r(V,B,new Map)),N(`${l(`✔`,s.GREEN)} File ${p(C)} updated successfully (no changes needed).`);return}N(`${L}Segments to review: ${u(H.length)}`);let U=new Map;for(let e of H){let r=H.indexOf(e)+1,i=e.englishBlock,s=()=>`**BLOCK ${r} of ${H.length}** is the base block in ${f(T,!1)} as reference.\n///chunksStart///\n`+i.content+`///chunksEnd///`,c=()=>`**BLOCK ${r} of ${H.length}** is the current block to review in ${f(w,!1)}.\n///chunksStart///\n`+(e.frenchBlockText??``)+`///chunksEnd///`,l=await g(async()=>{let e=await a([{role:`system`,content:I},{role:`system`,content:s()},{role:`system`,content:c()},{role:`system`,content:`The next user message will be the **BLOCK ${u(r)} of ${u(H.length)}** that should be translated in ${b(w,x.ENGLISH)} (${w}).`},{role:`user`,content:i.content}],E,M,A,j);N(`${R}${u(e.tokenUsed)} tokens used - Block ${u(r)} of ${u(H.length)}`);let l=t(e?.fileContent,i.content);if(l=o(l,i.content),!n(i.content,l,N))throw Error(`Validation failed for chunk (structure or length mismatch). Retrying...`);return l})();U.set(e.actionIndex,l)}let W=r(V,B,U);_(h(C),{recursive:!0}),v(C,W),N(`${l(`✔`,s.GREEN)} File ${p(C)} created/updated successfully.`)};export{S as reviewFileBlockAware};
2
2
  //# sourceMappingURL=reviewDocBlockAware.mjs.map
@@ -1,2 +1,2 @@
1
- import{getSearchAPI as e}from"@intlayer/api";import{getConfiguration as t}from"@intlayer/config/node";import{colorizeKey as n,colorizeNumber as r,getAppLogger as i}from"@intlayer/config/logger";const a=async({query:a,limit:o=10,configOptions:s})=>{let c=t(s),l=i(c);try{let{searchDoc:t}=e(void 0,c),i=await t({input:a,limit:o.toString(),returnContent:`true`});if(!i.data||!Array.isArray(i.data)){l(`No relevant chunks found.`);return}let s=i.data;l(`Found ${r(s.length)} relevant chunks:`),s.forEach(e=>{l(`---`),l(`${n(`File`)}: ${e.fileKey}`),l(`${n(`Title`)}: ${e.docName}`),l(`${n(`URL`)}: ${e.docUrl}`),l(`${n(`Chunk`)}: ${e.chunkNumber}`),l(`${n(`Content`)}:`),l(e.content)})}catch(e){l(`Search failed: ${e instanceof Error?e.message:`An unknown error occurred`}`,{level:`error`})}};export{a as searchDoc};
1
+ import{getSearchAPI as e}from"@intlayer/api";import{colorizeKey as t,colorizeNumber as n,getAppLogger as r}from"@intlayer/config/logger";import{logConfigDetails as i}from"@intlayer/chokidar/cli";import{getConfiguration as a}from"@intlayer/config/node";const o=async({query:o,limit:s=10,configOptions:c})=>{let l=a(c);i(c);let u=r(l);try{let{searchDoc:r}=e(void 0,l),i=await r({input:o,limit:s.toString(),returnContent:`true`});if(!i.data||!Array.isArray(i.data)){u(`No relevant chunks found.`);return}let a=i.data;u(`Found ${n(a.length)} relevant chunks:`),a.forEach(e=>{u(`---`),u(`${t(`File`)}: ${e.fileKey}`),u(`${t(`Title`)}: ${e.docName}`),u(`${t(`URL`)}: ${e.docUrl}`),u(`${t(`Chunk`)}: ${e.chunkNumber}`),u(`${t(`Content`)}:`),u(e.content)})}catch(e){u(`Search failed: ${e instanceof Error?e.message:`An unknown error occurred`}`,{level:`error`})}};export{o as searchDoc};
2
2
  //# sourceMappingURL=searchDoc.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"searchDoc.mjs","names":[],"sources":["../../src/searchDoc.ts"],"sourcesContent":["import { getSearchAPI } from '@intlayer/api';\nimport {\n colorizeKey,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\n\ninterface SearchDocOptions {\n query: string;\n limit?: number;\n configOptions?: GetConfigurationOptions;\n}\n\nexport const searchDoc = async ({\n query,\n limit = 10,\n configOptions,\n}: SearchDocOptions) => {\n const config = getConfiguration(configOptions);\n const appLogger = getAppLogger(config);\n\n try {\n const { searchDoc } = getSearchAPI(undefined, config);\n const response = await searchDoc({\n input: query,\n limit: limit.toString(),\n returnContent: 'true',\n });\n\n if (!response.data || !Array.isArray(response.data)) {\n appLogger('No relevant chunks found.');\n return;\n }\n\n const chunks = response.data;\n\n appLogger(`Found ${colorizeNumber(chunks.length)} relevant chunks:`);\n\n chunks.forEach((chunk: any) => {\n appLogger('---');\n appLogger(`${colorizeKey('File')}: ${chunk.fileKey}`);\n appLogger(`${colorizeKey('Title')}: ${chunk.docName}`);\n appLogger(`${colorizeKey('URL')}: ${chunk.docUrl}`);\n appLogger(`${colorizeKey('Chunk')}: ${chunk.chunkNumber}`);\n appLogger(`${colorizeKey('Content')}:`);\n appLogger(chunk.content);\n });\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n appLogger(`Search failed: ${errorMessage}`, { level: 'error' });\n }\n};\n"],"mappings":"kMAiBA,MAAa,EAAY,MAAO,CAC9B,QACA,QAAQ,GACR,mBACsB,CACtB,IAAM,EAAS,EAAiB,EAAc,CACxC,EAAY,EAAa,EAAO,CAEtC,GAAI,CACF,GAAM,CAAE,aAAc,EAAa,IAAA,GAAW,EAAO,CAC/C,EAAW,MAAM,EAAU,CAC/B,MAAO,EACP,MAAO,EAAM,UAAU,CACvB,cAAe,OAChB,CAAC,CAEF,GAAI,CAAC,EAAS,MAAQ,CAAC,MAAM,QAAQ,EAAS,KAAK,CAAE,CACnD,EAAU,4BAA4B,CACtC,OAGF,IAAM,EAAS,EAAS,KAExB,EAAU,SAAS,EAAe,EAAO,OAAO,CAAC,mBAAmB,CAEpE,EAAO,QAAS,GAAe,CAC7B,EAAU,MAAM,CAChB,EAAU,GAAG,EAAY,OAAO,CAAC,IAAI,EAAM,UAAU,CACrD,EAAU,GAAG,EAAY,QAAQ,CAAC,IAAI,EAAM,UAAU,CACtD,EAAU,GAAG,EAAY,MAAM,CAAC,IAAI,EAAM,SAAS,CACnD,EAAU,GAAG,EAAY,QAAQ,CAAC,IAAI,EAAM,cAAc,CAC1D,EAAU,GAAG,EAAY,UAAU,CAAC,GAAG,CACvC,EAAU,EAAM,QAAQ,EACxB,OACK,EAAO,CAGd,EAAU,kBADR,aAAiB,MAAQ,EAAM,QAAU,8BACC,CAAE,MAAO,QAAS,CAAC"}
1
+ {"version":3,"file":"searchDoc.mjs","names":[],"sources":["../../src/searchDoc.ts"],"sourcesContent":["import { getSearchAPI } from '@intlayer/api';\nimport { logConfigDetails } from '@intlayer/chokidar/cli';\nimport {\n colorizeKey,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\n\ninterface SearchDocOptions {\n query: string;\n limit?: number;\n configOptions?: GetConfigurationOptions;\n}\n\nexport const searchDoc = async ({\n query,\n limit = 10,\n configOptions,\n}: SearchDocOptions) => {\n const config = getConfiguration(configOptions);\n logConfigDetails(configOptions);\n\n const appLogger = getAppLogger(config);\n\n try {\n const { searchDoc } = getSearchAPI(undefined, config);\n const response = await searchDoc({\n input: query,\n limit: limit.toString(),\n returnContent: 'true',\n });\n\n if (!response.data || !Array.isArray(response.data)) {\n appLogger('No relevant chunks found.');\n return;\n }\n\n const chunks = response.data;\n\n appLogger(`Found ${colorizeNumber(chunks.length)} relevant chunks:`);\n\n chunks.forEach((chunk: any) => {\n appLogger('---');\n appLogger(`${colorizeKey('File')}: ${chunk.fileKey}`);\n appLogger(`${colorizeKey('Title')}: ${chunk.docName}`);\n appLogger(`${colorizeKey('URL')}: ${chunk.docUrl}`);\n appLogger(`${colorizeKey('Chunk')}: ${chunk.chunkNumber}`);\n appLogger(`${colorizeKey('Content')}:`);\n appLogger(chunk.content);\n });\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n appLogger(`Search failed: ${errorMessage}`, { level: 'error' });\n }\n};\n"],"mappings":"4PAkBA,MAAa,EAAY,MAAO,CAC9B,QACA,QAAQ,GACR,mBACsB,CACtB,IAAM,EAAS,EAAiB,EAAc,CAC9C,EAAiB,EAAc,CAE/B,IAAM,EAAY,EAAa,EAAO,CAEtC,GAAI,CACF,GAAM,CAAE,aAAc,EAAa,IAAA,GAAW,EAAO,CAC/C,EAAW,MAAM,EAAU,CAC/B,MAAO,EACP,MAAO,EAAM,UAAU,CACvB,cAAe,OAChB,CAAC,CAEF,GAAI,CAAC,EAAS,MAAQ,CAAC,MAAM,QAAQ,EAAS,KAAK,CAAE,CACnD,EAAU,4BAA4B,CACtC,OAGF,IAAM,EAAS,EAAS,KAExB,EAAU,SAAS,EAAe,EAAO,OAAO,CAAC,mBAAmB,CAEpE,EAAO,QAAS,GAAe,CAC7B,EAAU,MAAM,CAChB,EAAU,GAAG,EAAY,OAAO,CAAC,IAAI,EAAM,UAAU,CACrD,EAAU,GAAG,EAAY,QAAQ,CAAC,IAAI,EAAM,UAAU,CACtD,EAAU,GAAG,EAAY,MAAM,CAAC,IAAI,EAAM,SAAS,CACnD,EAAU,GAAG,EAAY,QAAQ,CAAC,IAAI,EAAM,cAAc,CAC1D,EAAU,GAAG,EAAY,UAAU,CAAC,GAAG,CACvC,EAAU,EAAM,QAAQ,EACxB,OACK,EAAO,CAGd,EAAU,kBADR,aAAiB,MAAQ,EAAM,QAAU,8BACC,CAAE,MAAO,QAAS,CAAC"}
@@ -1,2 +1,2 @@
1
- import{getConfiguration as e}from"@intlayer/config/node";import{getUnmergedDictionaries as t}from"@intlayer/unmerged-dictionaries-entry";import{getMissingLocalesContentFromDictionary as n}from"@intlayer/core/plugins";import{getDictionaries as r}from"@intlayer/dictionaries-entry";const i=e=>{let i=t(e),a=r(e),o=[],{locales:s,requiredLocales:c}=e.internationalization,l=Object.keys(i);for(let e of l){let t=i[e],r=t.filter(e=>!e.locale);for(let t of r){let r=n(t,s);r.length>0&&o.push({key:e,id:t.id,filePath:t.filePath,locales:r})}if(t.filter(e=>e.locale).length===0)continue;let c=a[e],l=n(c,s);l.length>0&&o.push({key:e,locales:l})}let u=new Set(o.flatMap(e=>e.locales)),d=Array.from(u);return{missingTranslations:o,missingLocales:d,missingRequiredLocales:d.filter(e=>(c??s).includes(e))}},a=t=>i(e(t));export{a as listMissingTranslations,i as listMissingTranslationsWithConfig};
1
+ import{logConfigDetails as e}from"@intlayer/chokidar/cli";import{getConfiguration as t}from"@intlayer/config/node";import{getUnmergedDictionaries as n}from"@intlayer/unmerged-dictionaries-entry";import{getMissingLocalesContentFromDictionary as r}from"@intlayer/core/plugins";import{getDictionaries as i}from"@intlayer/dictionaries-entry";const a=e=>{let t=n(e),a=i(e),o=[],{locales:s,requiredLocales:c}=e.internationalization,l=Object.keys(t);for(let e of l){let n=t[e],i=n.filter(e=>!e.locale);for(let t of i){let n=r(t,s);n.length>0&&o.push({key:e,id:t.id,filePath:t.filePath,locales:n})}if(n.filter(e=>e.locale).length===0)continue;let c=a[e],l=r(c,s);l.length>0&&o.push({key:e,locales:l})}let u=new Set(o.flatMap(e=>e.locales)),d=Array.from(u);return{missingTranslations:o,missingLocales:d,missingRequiredLocales:d.filter(e=>(c??s).includes(e))}},o=n=>{let r=t(n);return e(n),a(r)};export{o as listMissingTranslations,a as listMissingTranslationsWithConfig};
2
2
  //# sourceMappingURL=listMissingTranslations.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"listMissingTranslations.mjs","names":[],"sources":["../../../src/test/listMissingTranslations.ts"],"sourcesContent":["import {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getMissingLocalesContentFromDictionary } from '@intlayer/core/plugins';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { Dictionary, IntlayerConfig, Locale } from '@intlayer/types';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\nexport const listMissingTranslationsWithConfig = (\n configuration: IntlayerConfig\n) => {\n const unmergedDictionariesRecord = getUnmergedDictionaries(configuration);\n const mergedDictionaries = getDictionaries(configuration);\n\n const missingTranslations: {\n key: string;\n filePath?: string;\n id?: string;\n locales: Locale[];\n }[] = [];\n\n const { locales, requiredLocales } = configuration.internationalization;\n\n const dictionariesKeys = Object.keys(unmergedDictionariesRecord);\n\n for (const dictionaryKey of dictionariesKeys) {\n const dictionaries: Dictionary[] =\n unmergedDictionariesRecord[dictionaryKey];\n\n const multilingualDictionary: Dictionary[] = dictionaries.filter(\n (dictionary) => !dictionary.locale\n );\n\n // Test all by merging all dictionaries to ensure no per-locale dictionary is missing\n for (const dictionary of multilingualDictionary) {\n const missingLocales = getMissingLocalesContentFromDictionary(\n dictionary,\n locales\n );\n\n if (missingLocales.length > 0) {\n missingTranslations.push({\n key: dictionaryKey,\n id: dictionary.id,\n filePath: dictionary.filePath,\n locales: missingLocales,\n });\n }\n }\n\n const perLocaleDictionary: Dictionary[] = dictionaries.filter(\n (dictionary) => dictionary.locale\n );\n\n if (perLocaleDictionary.length === 0) {\n continue;\n }\n\n const mergedDictionary = mergedDictionaries[dictionaryKey];\n\n const missingLocales = getMissingLocalesContentFromDictionary(\n mergedDictionary,\n locales\n );\n\n if (missingLocales.length > 0) {\n missingTranslations.push({\n key: dictionaryKey,\n locales: missingLocales,\n });\n }\n }\n\n const missingLocalesSet = new Set(\n missingTranslations.flatMap((t) => t.locales)\n );\n const missingLocales = Array.from(missingLocalesSet);\n\n const missingRequiredLocales = missingLocales.filter((locale) =>\n (requiredLocales ?? locales).includes(locale)\n );\n\n return { missingTranslations, missingLocales, missingRequiredLocales };\n};\n\nexport const listMissingTranslations = (\n configurationOptions?: GetConfigurationOptions\n) => {\n const configuration = getConfiguration(configurationOptions);\n\n return listMissingTranslationsWithConfig(configuration);\n};\n"],"mappings":"wRASA,MAAa,EACX,GACG,CACH,IAAM,EAA6B,EAAwB,EAAc,CACnE,EAAqB,EAAgB,EAAc,CAEnD,EAKA,EAAE,CAEF,CAAE,UAAS,mBAAoB,EAAc,qBAE7C,EAAmB,OAAO,KAAK,EAA2B,CAEhE,IAAK,IAAM,KAAiB,EAAkB,CAC5C,IAAM,EACJ,EAA2B,GAEvB,EAAuC,EAAa,OACvD,GAAe,CAAC,EAAW,OAC7B,CAGD,IAAK,IAAM,KAAc,EAAwB,CAC/C,IAAM,EAAiB,EACrB,EACA,EACD,CAEG,EAAe,OAAS,GAC1B,EAAoB,KAAK,CACvB,IAAK,EACL,GAAI,EAAW,GACf,SAAU,EAAW,SACrB,QAAS,EACV,CAAC,CAQN,GAJ0C,EAAa,OACpD,GAAe,EAAW,OAC5B,CAEuB,SAAW,EACjC,SAGF,IAAM,EAAmB,EAAmB,GAEtC,EAAiB,EACrB,EACA,EACD,CAEG,EAAe,OAAS,GAC1B,EAAoB,KAAK,CACvB,IAAK,EACL,QAAS,EACV,CAAC,CAIN,IAAM,EAAoB,IAAI,IAC5B,EAAoB,QAAS,GAAM,EAAE,QAAQ,CAC9C,CACK,EAAiB,MAAM,KAAK,EAAkB,CAMpD,MAAO,CAAE,sBAAqB,iBAAgB,uBAJf,EAAe,OAAQ,IACnD,GAAmB,GAAS,SAAS,EAAO,CAC9C,CAEqE,EAG3D,EACX,GAIO,EAFe,EAAiB,EAAqB,CAEL"}
1
+ {"version":3,"file":"listMissingTranslations.mjs","names":[],"sources":["../../../src/test/listMissingTranslations.ts"],"sourcesContent":["import { logConfigDetails } from '@intlayer/chokidar/cli';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getMissingLocalesContentFromDictionary } from '@intlayer/core/plugins';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { Dictionary, IntlayerConfig, Locale } from '@intlayer/types';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\nexport const listMissingTranslationsWithConfig = (\n configuration: IntlayerConfig\n) => {\n const unmergedDictionariesRecord = getUnmergedDictionaries(configuration);\n const mergedDictionaries = getDictionaries(configuration);\n\n const missingTranslations: {\n key: string;\n filePath?: string;\n id?: string;\n locales: Locale[];\n }[] = [];\n\n const { locales, requiredLocales } = configuration.internationalization;\n\n const dictionariesKeys = Object.keys(unmergedDictionariesRecord);\n\n for (const dictionaryKey of dictionariesKeys) {\n const dictionaries: Dictionary[] =\n unmergedDictionariesRecord[dictionaryKey];\n\n const multilingualDictionary: Dictionary[] = dictionaries.filter(\n (dictionary) => !dictionary.locale\n );\n\n // Test all by merging all dictionaries to ensure no per-locale dictionary is missing\n for (const dictionary of multilingualDictionary) {\n const missingLocales = getMissingLocalesContentFromDictionary(\n dictionary,\n locales\n );\n\n if (missingLocales.length > 0) {\n missingTranslations.push({\n key: dictionaryKey,\n id: dictionary.id,\n filePath: dictionary.filePath,\n locales: missingLocales,\n });\n }\n }\n\n const perLocaleDictionary: Dictionary[] = dictionaries.filter(\n (dictionary) => dictionary.locale\n );\n\n if (perLocaleDictionary.length === 0) {\n continue;\n }\n\n const mergedDictionary = mergedDictionaries[dictionaryKey];\n\n const missingLocales = getMissingLocalesContentFromDictionary(\n mergedDictionary,\n locales\n );\n\n if (missingLocales.length > 0) {\n missingTranslations.push({\n key: dictionaryKey,\n locales: missingLocales,\n });\n }\n }\n\n const missingLocalesSet = new Set(\n missingTranslations.flatMap((t) => t.locales)\n );\n const missingLocales = Array.from(missingLocalesSet);\n\n const missingRequiredLocales = missingLocales.filter((locale) =>\n (requiredLocales ?? locales).includes(locale)\n );\n\n return { missingTranslations, missingLocales, missingRequiredLocales };\n};\n\nexport const listMissingTranslations = (\n configurationOptions?: GetConfigurationOptions\n) => {\n const configuration = getConfiguration(configurationOptions);\n logConfigDetails(configurationOptions);\n\n return listMissingTranslationsWithConfig(configuration);\n};\n"],"mappings":"kVAUA,MAAa,EACX,GACG,CACH,IAAM,EAA6B,EAAwB,EAAc,CACnE,EAAqB,EAAgB,EAAc,CAEnD,EAKA,EAAE,CAEF,CAAE,UAAS,mBAAoB,EAAc,qBAE7C,EAAmB,OAAO,KAAK,EAA2B,CAEhE,IAAK,IAAM,KAAiB,EAAkB,CAC5C,IAAM,EACJ,EAA2B,GAEvB,EAAuC,EAAa,OACvD,GAAe,CAAC,EAAW,OAC7B,CAGD,IAAK,IAAM,KAAc,EAAwB,CAC/C,IAAM,EAAiB,EACrB,EACA,EACD,CAEG,EAAe,OAAS,GAC1B,EAAoB,KAAK,CACvB,IAAK,EACL,GAAI,EAAW,GACf,SAAU,EAAW,SACrB,QAAS,EACV,CAAC,CAQN,GAJ0C,EAAa,OACpD,GAAe,EAAW,OAC5B,CAEuB,SAAW,EACjC,SAGF,IAAM,EAAmB,EAAmB,GAEtC,EAAiB,EACrB,EACA,EACD,CAEG,EAAe,OAAS,GAC1B,EAAoB,KAAK,CACvB,IAAK,EACL,QAAS,EACV,CAAC,CAIN,IAAM,EAAoB,IAAI,IAC5B,EAAoB,QAAS,GAAM,EAAE,QAAQ,CAC9C,CACK,EAAiB,MAAM,KAAK,EAAkB,CAMpD,MAAO,CAAE,sBAAqB,iBAAgB,uBAJf,EAAe,OAAQ,IACnD,GAAmB,GAAS,SAAS,EAAO,CAC9C,CAEqE,EAG3D,EACX,GACG,CACH,IAAM,EAAgB,EAAiB,EAAqB,CAG5D,OAFA,EAAiB,EAAqB,CAE/B,EAAkC,EAAc"}
@@ -1,2 +1,2 @@
1
- import{listMissingTranslations as e}from"./listMissingTranslations.mjs";import{formatLocale as t,formatPath as n}from"@intlayer/chokidar/utils";import{getConfiguration as r}from"@intlayer/config/node";import{ANSIColors as i,colon as a,colorize as o,colorizeKey as s,colorizeNumber as c,getAppLogger as l}from"@intlayer/config/logger";import{prepareIntlayer as u}from"@intlayer/chokidar/build";const d=async d=>{let f=r(d?.configOptions),{locales:p,requiredLocales:m}=f.internationalization,h=l(f);d?.build===!0?await u(f,{forceRun:!0}):d?.build===void 0&&await u(f);let g=e(d?.configOptions),_=g.missingTranslations.map(e=>` - ${e.key}`).reduce((e,t)=>Math.max(e,t.length),0),v=g.missingTranslations.map(e=>t(e.locales,!1)).reduce((e,t)=>Math.max(e,t.length),0),y=g.missingTranslations.map(e=>[a(` - ${s(e.key)}`,{colSize:_,maxSize:40}),` - `,a(t(e.locales,i.RED),{colSize:v,maxSize:40}),e.filePath?` - ${n(e.filePath)}`:``,e.id?` - remote`:``].join(``));h(`Missing translations:`,{level:`info`}),y.forEach(e=>{h(e,{level:`info`})}),h(`Locales: ${t(p)}`),h(`Required locales: ${t(m??p)}`),h(`Missing locales: ${g.missingLocales.length===0?o(`-`,i.GREEN):t(g.missingLocales,i.RED)}`),h(`Missing required locales: ${g.missingRequiredLocales.length===0?o(`-`,i.GREEN):t(g.missingRequiredLocales,i.RED)}`),h(`Total missing locales: ${c(g.missingLocales.length,{one:i.RED,other:i.RED,zero:i.GREEN})}`),h(`Total missing required locales: ${c(g.missingRequiredLocales.length,{one:i.RED,other:i.RED,zero:i.GREEN})}`),g.missingRequiredLocales.length>0&&process.exit(1)};export{d as testMissingTranslations};
1
+ import{listMissingTranslations as e}from"./listMissingTranslations.mjs";import{ANSIColors as t,colon as n,colorize as r,colorizeKey as i,colorizeNumber as a,getAppLogger as o}from"@intlayer/config/logger";import{formatLocale as s,formatPath as c}from"@intlayer/chokidar/utils";import{getConfiguration as l}from"@intlayer/config/node";import{prepareIntlayer as u}from"@intlayer/chokidar/build";const d=async d=>{let f=l(d?.configOptions),{locales:p,requiredLocales:m}=f.internationalization,h=o(f);d?.build===!0?await u(f,{forceRun:!0}):d?.build===void 0&&await u(f);let g=e(d?.configOptions),_=g.missingTranslations.map(e=>` - ${e.key}`).reduce((e,t)=>Math.max(e,t.length),0),v=g.missingTranslations.map(e=>s(e.locales,!1)).reduce((e,t)=>Math.max(e,t.length),0),y=g.missingTranslations.map(e=>[n(` - ${i(e.key)}`,{colSize:_,maxSize:40}),` - `,n(s(e.locales,t.RED),{colSize:v,maxSize:40}),e.filePath?` - ${c(e.filePath)}`:``,e.id?` - remote`:``].join(``));h(`Missing translations:`,{level:`info`}),y.forEach(e=>{h(e,{level:`info`})}),h(`Locales: ${s(p)}`),h(`Required locales: ${s(m??p)}`),h(`Missing locales: ${g.missingLocales.length===0?r(`-`,t.GREEN):s(g.missingLocales,t.RED)}`),h(`Missing required locales: ${g.missingRequiredLocales.length===0?r(`-`,t.GREEN):s(g.missingRequiredLocales,t.RED)}`),h(`Total missing locales: ${a(g.missingLocales.length,{one:t.RED,other:t.RED,zero:t.GREEN})}`),h(`Total missing required locales: ${a(g.missingRequiredLocales.length,{one:t.RED,other:t.RED,zero:t.GREEN})}`),g.missingRequiredLocales.length>0&&process.exit(1)};export{d as testMissingTranslations};
2
2
  //# sourceMappingURL=test.mjs.map
@@ -1,2 +1,2 @@
1
- import{setupAI as e}from"../utils/setupAI.mjs";import{checkFileModifiedRange as t}from"../utils/checkFileModifiedRange.mjs";import{getOutputFilePath as n}from"../utils/getOutputFilePath.mjs";import{translateFile as r}from"./translateFile.mjs";import{pLimit as i,parallelize as a}from"@intlayer/chokidar/utils";import{getConfiguration as o}from"@intlayer/config/node";import{dirname as s,join as c}from"node:path";import{listGitFiles as l}from"@intlayer/chokidar/cli";import{ANSIColors as u,colorize as d,colorizeNumber as f,getAppLogger as p}from"@intlayer/config/logger";import{existsSync as m,mkdirSync as h,writeFileSync as g}from"node:fs";import _ from"fast-glob";import{performance as v}from"node:perf_hooks";const y=async({docPattern:y,locales:b,excludedGlobPattern:x,baseLocale:S,aiOptions:C,nbSimultaneousFileProcessed:w=20,configOptions:T,customInstructions:E,skipIfModifiedBefore:D,skipIfModifiedAfter:O,skipIfExists:k,gitOptions:A,flushStrategy:j=`incremental`})=>{let M=o(T),N=p(M),P=w,F=i(P),I=await _(y,{ignore:x}),L=await e(M,C);if(!L?.hasAIAccess)return;let{aiClient:R,aiConfig:z}=L;if(A){let e=await l(A);e&&(I=I.filter(t=>e.some(e=>c(process.cwd(),t)===e)))}let B=v.now();N(`Translating ${f(I.length)} files to ${f(b.length)} locales. \nGlobal Concurrency: ${f(P)} chunks in parallel.`);let V={count:0,maxErrors:5,shouldStop:!1};await a(I.flatMap(e=>b.map(i=>async()=>{if(V.shouldStop)return;let a=c(M.content.baseDir,e),o=n(a,i,S);if(k&&m(o))return;j===`incremental`&&!m(o)&&(h(s(o),{recursive:!0}),g(o,``));let l=t(o,{skipIfModifiedBefore:D,skipIfModifiedAfter:O});if(l.isSkipped){N(l.message);return}await r({baseFilePath:a,outputFilePath:o,locale:i,baseLocale:S,configuration:M,errorState:V,aiOptions:C,customInstructions:E,aiClient:R,aiConfig:z,flushStrategy:j,limit:F})})),e=>e(),50);let H=((v.now()-B)/1e3).toFixed(2);V.count>0?N(`Finished with ${V.count} errors in ${H}s.`):N(`${d(`✔`,u.GREEN)} Batch completed successfully in ${f(H)}s.`)};export{y as translateDoc};
1
+ import{setupAI as e}from"../utils/setupAI.mjs";import{checkFileModifiedRange as t}from"../utils/checkFileModifiedRange.mjs";import{getOutputFilePath as n}from"../utils/getOutputFilePath.mjs";import{translateFile as r}from"./translateFile.mjs";import{ANSIColors as i,colorize as a,colorizeNumber as o,getAppLogger as s}from"@intlayer/config/logger";import{listGitFiles as c,logConfigDetails as l}from"@intlayer/chokidar/cli";import{pLimit as u,parallelize as d}from"@intlayer/chokidar/utils";import{getConfiguration as f}from"@intlayer/config/node";import{dirname as p,join as m}from"node:path";import{existsSync as h,mkdirSync as g,writeFileSync as _}from"node:fs";import v from"fast-glob";import{performance as y}from"node:perf_hooks";const b=async({docPattern:b,locales:x,excludedGlobPattern:S,baseLocale:C,aiOptions:w,nbSimultaneousFileProcessed:T=20,configOptions:E,customInstructions:D,skipIfModifiedBefore:O,skipIfModifiedAfter:k,skipIfExists:A,gitOptions:j,flushStrategy:M=`incremental`})=>{let N=f(E);l(E);let P=s(N),F=T,I=u(F),L=await v(b,{ignore:S}),R=await e(N,w);if(!R?.hasAIAccess)return;let{aiClient:z,aiConfig:B}=R;if(j){let e=await c(j);e&&(L=L.filter(t=>e.some(e=>m(process.cwd(),t)===e)))}let V=y.now();P(`Translating ${o(L.length)} files to ${o(x.length)} locales. \nGlobal Concurrency: ${o(F)} chunks in parallel.`);let H={count:0,maxErrors:5,shouldStop:!1};await d(L.flatMap(e=>x.map(i=>async()=>{if(H.shouldStop)return;let a=m(N.content.baseDir,e),o=n(a,i,C);if(A&&h(o))return;M===`incremental`&&!h(o)&&(g(p(o),{recursive:!0}),_(o,``));let s=t(o,{skipIfModifiedBefore:O,skipIfModifiedAfter:k});if(s.isSkipped){P(s.message);return}await r({baseFilePath:a,outputFilePath:o,locale:i,baseLocale:C,configuration:N,errorState:H,aiOptions:w,customInstructions:D,aiClient:z,aiConfig:B,flushStrategy:M,limit:I})})),e=>e(),50);let U=((y.now()-V)/1e3).toFixed(2);H.count>0?P(`Finished with ${H.count} errors in ${U}s.`):P(`${a(`✔`,i.GREEN)} Batch completed successfully in ${o(U)}s.`)};export{b as translateDoc};
2
2
  //# sourceMappingURL=translateDoc.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"translateDoc.mjs","names":[],"sources":["../../../src/translateDoc/translateDoc.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { performance } from 'node:perf_hooks';\nimport { listGitFiles } from '@intlayer/chokidar/cli';\nimport { parallelize, pLimit } from '@intlayer/chokidar/utils';\nimport {\n ANSIColors,\n colorize,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { Locale } from '@intlayer/types';\nimport fg from 'fast-glob';\nimport { checkFileModifiedRange } from '../utils/checkFileModifiedRange';\nimport { getOutputFilePath } from '../utils/getOutputFilePath';\nimport { setupAI } from '../utils/setupAI';\nimport { translateFile } from './translateFile';\nimport type { ErrorState, TranslateDocOptions } from './types';\n\nexport const translateDoc = async ({\n docPattern,\n locales,\n excludedGlobPattern,\n baseLocale,\n aiOptions,\n nbSimultaneousFileProcessed = 20, // Default to a higher concurrency for chunks\n configOptions,\n customInstructions,\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n skipIfExists,\n gitOptions,\n flushStrategy = 'incremental',\n}: TranslateDocOptions) => {\n const configuration = getConfiguration(configOptions);\n const appLogger = getAppLogger(configuration);\n\n // 1. GLOBAL QUEUE SETUP\n // We use pLimit to create a single bottleneck for AI requests.\n // This queue is shared across all files and locales.\n const maxConcurrentChunks = nbSimultaneousFileProcessed;\n const globalChunkLimiter = pLimit(maxConcurrentChunks);\n\n let docList: string[] = await fg(docPattern, {\n ignore: excludedGlobPattern,\n });\n\n const aiResult = await setupAI(configuration, aiOptions);\n if (!aiResult?.hasAIAccess) return;\n const { aiClient, aiConfig } = aiResult;\n\n if (gitOptions) {\n const gitChangedFiles = await listGitFiles(gitOptions);\n if (gitChangedFiles) {\n docList = docList.filter((path) =>\n gitChangedFiles.some((gitFile) => join(process.cwd(), path) === gitFile)\n );\n }\n }\n\n const batchStartTime = performance.now();\n\n appLogger(\n `Translating ${colorizeNumber(docList.length)} files to ${colorizeNumber(locales.length)} locales. \\n` +\n `Global Concurrency: ${colorizeNumber(maxConcurrentChunks)} chunks in parallel.`\n );\n\n const errorState: ErrorState = {\n count: 0,\n maxErrors: 5,\n shouldStop: false,\n };\n\n // 2. FLATTENED TASK LIST\n // We create a task for every File x Locale combination.\n const allTasks = docList.flatMap((docPath) =>\n locales.map((locale) => async () => {\n if (errorState.shouldStop) return;\n\n const absoluteBaseFilePath = join(configuration.content.baseDir, docPath);\n const outputFilePath = getOutputFilePath(\n absoluteBaseFilePath,\n locale,\n baseLocale\n );\n\n // Skip logic\n if (skipIfExists && existsSync(outputFilePath)) return;\n\n if (flushStrategy === 'incremental' && !existsSync(outputFilePath)) {\n mkdirSync(dirname(outputFilePath), { recursive: true });\n writeFileSync(outputFilePath, '');\n }\n\n const fileModificationData = checkFileModifiedRange(outputFilePath, {\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n });\n\n if (fileModificationData.isSkipped) {\n appLogger(fileModificationData.message);\n return;\n }\n\n // Execute translation using the SHARED limiter\n await translateFile({\n baseFilePath: absoluteBaseFilePath,\n outputFilePath,\n locale: locale as Locale,\n baseLocale,\n configuration,\n errorState,\n aiOptions,\n customInstructions,\n aiClient,\n aiConfig,\n flushStrategy,\n limit: globalChunkLimiter, // Pass the global queue\n });\n })\n );\n\n // 3. HIGH-THROUGHPUT FILE OPENER\n // We open many files simultaneously (e.g., 50) to ensure the global chunk queue\n // is always saturated with work.\n // If we open too few files, the chunk queue might drain faster than we can read new files.\n const FILE_OPEN_LIMIT = 50;\n\n await parallelize(allTasks, (task) => task(), FILE_OPEN_LIMIT);\n\n const batchEndTime = performance.now();\n const batchDuration = ((batchEndTime - batchStartTime) / 1000).toFixed(2);\n\n if (errorState.count > 0) {\n appLogger(`Finished with ${errorState.count} errors in ${batchDuration}s.`);\n } else {\n appLogger(\n `${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W,CAClC,EAAU,EAAqB,QAAQ,CACvC,OAIF,MAAM,EAAc,CAClB,aAAc,EACd,iBACQ,SACR,aACA,gBACA,aACA,YACA,qBACA,WACA,WACA,gBACA,MAAO,EACR,CAAC,EACF,CACH,CAQ4B,GAAS,GAAM,CAFpB,GAEsC,CAG9D,IAAM,IADe,EAAY,KAAK,CACC,GAAkB,KAAM,QAAQ,EAAE,CAErE,EAAW,MAAQ,EACrB,EAAU,iBAAiB,EAAW,MAAM,aAAa,EAAc,IAAI,CAE3E,EACE,GAAG,EAAS,IAAK,EAAW,MAAM,CAAC,mCAAmC,EAAe,EAAc,CAAC,IACrG"}
1
+ {"version":3,"file":"translateDoc.mjs","names":[],"sources":["../../../src/translateDoc/translateDoc.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { performance } from 'node:perf_hooks';\nimport { listGitFiles, logConfigDetails } from '@intlayer/chokidar/cli';\nimport { parallelize, pLimit } from '@intlayer/chokidar/utils';\nimport {\n ANSIColors,\n colorize,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { Locale } from '@intlayer/types';\nimport fg from 'fast-glob';\nimport { checkFileModifiedRange } from '../utils/checkFileModifiedRange';\nimport { getOutputFilePath } from '../utils/getOutputFilePath';\nimport { setupAI } from '../utils/setupAI';\nimport { translateFile } from './translateFile';\nimport type { ErrorState, TranslateDocOptions } from './types';\n\nexport const translateDoc = async ({\n docPattern,\n locales,\n excludedGlobPattern,\n baseLocale,\n aiOptions,\n nbSimultaneousFileProcessed = 20, // Default to a higher concurrency for chunks\n configOptions,\n customInstructions,\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n skipIfExists,\n gitOptions,\n flushStrategy = 'incremental',\n}: TranslateDocOptions) => {\n const configuration = getConfiguration(configOptions);\n logConfigDetails(configOptions);\n\n const appLogger = getAppLogger(configuration);\n\n // 1. GLOBAL QUEUE SETUP\n // We use pLimit to create a single bottleneck for AI requests.\n // This queue is shared across all files and locales.\n const maxConcurrentChunks = nbSimultaneousFileProcessed;\n const globalChunkLimiter = pLimit(maxConcurrentChunks);\n\n let docList: string[] = await fg(docPattern, {\n ignore: excludedGlobPattern,\n });\n\n const aiResult = await setupAI(configuration, aiOptions);\n if (!aiResult?.hasAIAccess) return;\n const { aiClient, aiConfig } = aiResult;\n\n if (gitOptions) {\n const gitChangedFiles = await listGitFiles(gitOptions);\n if (gitChangedFiles) {\n docList = docList.filter((path) =>\n gitChangedFiles.some((gitFile) => join(process.cwd(), path) === gitFile)\n );\n }\n }\n\n const batchStartTime = performance.now();\n\n appLogger(\n `Translating ${colorizeNumber(docList.length)} files to ${colorizeNumber(locales.length)} locales. \\n` +\n `Global Concurrency: ${colorizeNumber(maxConcurrentChunks)} chunks in parallel.`\n );\n\n const errorState: ErrorState = {\n count: 0,\n maxErrors: 5,\n shouldStop: false,\n };\n\n // 2. FLATTENED TASK LIST\n // We create a task for every File x Locale combination.\n const allTasks = docList.flatMap((docPath) =>\n locales.map((locale) => async () => {\n if (errorState.shouldStop) return;\n\n const absoluteBaseFilePath = join(configuration.content.baseDir, docPath);\n const outputFilePath = getOutputFilePath(\n absoluteBaseFilePath,\n locale,\n baseLocale\n );\n\n // Skip logic\n if (skipIfExists && existsSync(outputFilePath)) return;\n\n if (flushStrategy === 'incremental' && !existsSync(outputFilePath)) {\n mkdirSync(dirname(outputFilePath), { recursive: true });\n writeFileSync(outputFilePath, '');\n }\n\n const fileModificationData = checkFileModifiedRange(outputFilePath, {\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n });\n\n if (fileModificationData.isSkipped) {\n appLogger(fileModificationData.message);\n return;\n }\n\n // Execute translation using the SHARED limiter\n await translateFile({\n baseFilePath: absoluteBaseFilePath,\n outputFilePath,\n locale: locale as Locale,\n baseLocale,\n configuration,\n errorState,\n aiOptions,\n customInstructions,\n aiClient,\n aiConfig,\n flushStrategy,\n limit: globalChunkLimiter, // Pass the global queue\n });\n })\n );\n\n // 3. HIGH-THROUGHPUT FILE OPENER\n // We open many files simultaneously (e.g., 50) to ensure the global chunk queue\n // is always saturated with work.\n // If we open too few files, the chunk queue might drain faster than we can read new files.\n const FILE_OPEN_LIMIT = 50;\n\n await parallelize(allTasks, (task) => task(), FILE_OPEN_LIMIT);\n\n const batchEndTime = performance.now();\n const batchDuration = ((batchEndTime - batchStartTime) / 1000).toFixed(2);\n\n if (errorState.count > 0) {\n appLogger(`Finished with ${errorState.count} errors in ${batchDuration}s.`);\n } else {\n appLogger(\n `${colorize('✔', ANSIColors.GREEN)} Batch completed successfully in ${colorizeNumber(batchDuration)}s.`\n );\n }\n};\n"],"mappings":"guBAoBA,MAAa,EAAe,MAAO,CACjC,aACA,UACA,sBACA,aACA,YACA,8BAA8B,GAC9B,gBACA,qBACA,uBACA,sBACA,eACA,aACA,gBAAgB,iBACS,CACzB,IAAM,EAAgB,EAAiB,EAAc,CACrD,EAAiB,EAAc,CAE/B,IAAM,EAAY,EAAa,EAAc,CAKvC,EAAsB,EACtB,EAAqB,EAAO,EAAoB,CAElD,EAAoB,MAAM,EAAG,EAAY,CAC3C,OAAQ,EACT,CAAC,CAEI,EAAW,MAAM,EAAQ,EAAe,EAAU,CACxD,GAAI,CAAC,GAAU,YAAa,OAC5B,GAAM,CAAE,WAAU,YAAa,EAE/B,GAAI,EAAY,CACd,IAAM,EAAkB,MAAM,EAAa,EAAW,CAClD,IACF,EAAU,EAAQ,OAAQ,GACxB,EAAgB,KAAM,GAAY,EAAK,QAAQ,KAAK,CAAE,EAAK,GAAK,EAAQ,CACzE,EAIL,IAAM,EAAiB,EAAY,KAAK,CAExC,EACE,eAAe,EAAe,EAAQ,OAAO,CAAC,YAAY,EAAe,EAAQ,OAAO,CAAC,kCAChE,EAAe,EAAoB,CAAC,sBAC9D,CAED,IAAM,EAAyB,CAC7B,MAAO,EACP,UAAW,EACX,WAAY,GACb,CAyDD,MAAM,EArDW,EAAQ,QAAS,GAChC,EAAQ,IAAK,GAAW,SAAY,CAClC,GAAI,EAAW,WAAY,OAE3B,IAAM,EAAuB,EAAK,EAAc,QAAQ,QAAS,EAAQ,CACnE,EAAiB,EACrB,EACA,EACA,EACD,CAGD,GAAI,GAAgB,EAAW,EAAe,CAAE,OAE5C,IAAkB,eAAiB,CAAC,EAAW,EAAe,GAChE,EAAU,EAAQ,EAAe,CAAE,CAAE,UAAW,GAAM,CAAC,CACvD,EAAc,EAAgB,GAAG,EAGnC,IAAM,EAAuB,EAAuB,EAAgB,CAClE,uBACA,sBACD,CAAC,CAEF,GAAI,EAAqB,UAAW,CAClC,EAAU,EAAqB,QAAQ,CACvC,OAIF,MAAM,EAAc,CAClB,aAAc,EACd,iBACQ,SACR,aACA,gBACA,aACA,YACA,qBACA,WACA,WACA,gBACA,MAAO,EACR,CAAC,EACF,CACH,CAQ4B,GAAS,GAAM,CAFpB,GAEsC,CAG9D,IAAM,IADe,EAAY,KAAK,CACC,GAAkB,KAAM,QAAQ,EAAE,CAErE,EAAW,MAAQ,EACrB,EAAU,iBAAiB,EAAW,MAAM,aAAa,EAAc,IAAI,CAE3E,EACE,GAAG,EAAS,IAAK,EAAW,MAAM,CAAC,mCAAmC,EAAe,EAAc,CAAC,IACrG"}
@@ -1,3 +1,3 @@
1
- import{readAsset as e}from"../_virtual/_utils_asset.mjs";import{sanitizeChunk as t,validateTranslation as n}from"./validation.mjs";import{chunkInference as r}from"../utils/chunkInference.mjs";import{fixChunkStartEndChars as i}from"../utils/fixChunkStartEndChars.mjs";import{chunkText as a}from"../utils/calculateChunks.mjs";import{formatLocale as o,formatPath as s}from"@intlayer/chokidar/utils";import{dirname as c,relative as l}from"node:path";import{ANSIColors as u,colon as d,colorize as f,colorizeNumber as p,getAppLogger as m}from"@intlayer/config/logger";import{retryManager as h}from"@intlayer/config/utils";import{mkdirSync as g,writeFileSync as _}from"node:fs";import{readFile as v}from"node:fs/promises";import{performance as y}from"node:perf_hooks";const b=async({baseFilePath:b,outputFilePath:x,locale:S,baseLocale:C,configuration:w,errorState:T,aiOptions:E,customInstructions:D,aiClient:O,aiConfig:k,flushStrategy:A=`incremental`,onChunkReceive:j,limit:M})=>{if(T.shouldStop)return null;let N=m(w,{config:{prefix:``}}),P=y.now();try{let F=a(await v(b,`utf-8`)),I=F.length,L=`${d(`${u.GREY_DARK}[${s(b)}${u.GREY_DARK}] `,{colSize:40})}${u.RESET}`,R=`${d(`${u.GREY_DARK}[${s(b)}${u.GREY_DARK}][${o(S)}${u.GREY_DARK}] `,{colSize:40})}${u.RESET}`;N(`${L}Split into ${p(I)} chunks. Queuing...`);let z=e(`./prompts/TRANSLATE_PROMPT.md`,`utf-8`).replaceAll(`{{localeName}}`,`${o(S,!1)}`).replaceAll(`{{baseLocaleName}}`,`${o(C,!1)}`).replace(`{{applicationContext}}`,E?.applicationContext??`-`).replace(`{{customInstructions}}`,D??`-`),B=Array(I).fill(``),V=M??(e=>e()),H=F.map((e,a)=>V(async()=>{if(T.shouldStop)return null;let o=m(w,{config:{prefix:`${R} ${u.GREY_DARK}[${a+1}/${I}] ${u.RESET}`}}),s=y.now(),l=a===0,d=e.content,f=()=>">>> CONTEXT: PREVIOUS SOURCE CONTENT <<<\n```\n"+(F[a-1]?.content??``)+"\n```\n>>> END PREVIOUS CONTEXT <<<",v=()=>">>> CONTEXT: NEXT CONTENT <<<\n```\n"+(F[a+1]?.content??``)+"\n```\n>>> END NEXT CONTEXT <<<";o(`Process started`);let{content:b,tokens:S}=await h(async()=>{let e=await r([{role:`system`,content:z},...F[a+1]?[{role:`system`,content:v()}]:[],...l?[]:[{role:`system`,content:f()}],{role:`system`,content:[`You are translating TARGET CHUNK (${a+1}/${I}).`,`Translate ONLY the target chunk. Preserve frontmatter/code exactly.`].join(`
2
- `)},{role:`user`,content:`>>> TARGET CHUNK START <<<\n${d}\n>>> TARGET CHUNK END <<<`}],E,w,O,k),s=t(e?.fileContent,d);if(s=i(s,d),!n(d,s,o))throw Error(`Validation failed for chunk ${a+1}/${I}`);return{content:s,tokens:e.tokenUsed}})(),C=(y.now()-s).toFixed(0);if(B[a]=b,j&&j(b,a,I),A===`incremental`&&B.slice(0,a+1).every(e=>e&&e!==``)){let e=0;for(;e<I&&B[e]&&B[e]!==``;)e++;let t=B.slice(0,e).join(``);g(c(x),{recursive:!0}),_(x,t)}o([`${p(S)} tokens used `,`${u.GREY_DARK}in ${p(C)}ms${u.RESET}`].join(``))}));await Promise.all(H);let U=B.join(``);(A===`end`||A===`incremental`)&&(g(c(x),{recursive:!0}),_(x,U));let W=((y.now()-P)/1e3).toFixed(2),G=l(w.content.baseDir,x);return N(`${f(`✔`,u.GREEN)} File ${s(G)} completed in ${p(W)}s.`),U}catch(e){T.count++;let t=e?.message??JSON.stringify(e);return N(`${f(`✖`,u.RED)} Error: ${t}`),T.count>=T.maxErrors&&(T.shouldStop=!0),null}};export{b as translateFile};
1
+ import{readAsset as e}from"../_virtual/_utils_asset.mjs";import{sanitizeChunk as t,validateTranslation as n}from"./validation.mjs";import{chunkInference as r}from"../utils/chunkInference.mjs";import{fixChunkStartEndChars as i}from"../utils/fixChunkStartEndChars.mjs";import{chunkText as a}from"../utils/calculateChunks.mjs";import{ANSIColors as o,colon as s,colorize as c,colorizeNumber as l,getAppLogger as u}from"@intlayer/config/logger";import{formatLocale as d,formatPath as f}from"@intlayer/chokidar/utils";import{dirname as p,relative as m}from"node:path";import{retryManager as h}from"@intlayer/config/utils";import{mkdirSync as g,writeFileSync as _}from"node:fs";import{readFile as v}from"node:fs/promises";import{performance as y}from"node:perf_hooks";const b=async({baseFilePath:b,outputFilePath:x,locale:S,baseLocale:C,configuration:w,errorState:T,aiOptions:E,customInstructions:D,aiClient:O,aiConfig:k,flushStrategy:A=`incremental`,onChunkReceive:j,limit:M})=>{if(T.shouldStop)return null;let N=u(w,{config:{prefix:``}}),P=y.now();try{let F=a(await v(b,`utf-8`)),I=F.length,L=`${s(`${o.GREY_DARK}[${f(b)}${o.GREY_DARK}] `,{colSize:40})}${o.RESET}`,R=`${s(`${o.GREY_DARK}[${f(b)}${o.GREY_DARK}][${d(S)}${o.GREY_DARK}] `,{colSize:40})}${o.RESET}`;N(`${L}Split into ${l(I)} chunks. Queuing...`);let z=e(`./prompts/TRANSLATE_PROMPT.md`,`utf-8`).replaceAll(`{{localeName}}`,`${d(S,!1)}`).replaceAll(`{{baseLocaleName}}`,`${d(C,!1)}`).replace(`{{applicationContext}}`,E?.applicationContext??`-`).replace(`{{customInstructions}}`,D??`-`),B=Array(I).fill(``),V=M??(e=>e()),H=F.map((e,a)=>V(async()=>{if(T.shouldStop)return null;let s=u(w,{config:{prefix:`${R} ${o.GREY_DARK}[${a+1}/${I}] ${o.RESET}`}}),c=y.now(),d=a===0,f=e.content,m=()=>">>> CONTEXT: PREVIOUS SOURCE CONTENT <<<\n```\n"+(F[a-1]?.content??``)+"\n```\n>>> END PREVIOUS CONTEXT <<<",v=()=>">>> CONTEXT: NEXT CONTENT <<<\n```\n"+(F[a+1]?.content??``)+"\n```\n>>> END NEXT CONTEXT <<<";s(`Process started`);let{content:b,tokens:S}=await h(async()=>{let e=await r([{role:`system`,content:z},...F[a+1]?[{role:`system`,content:v()}]:[],...d?[]:[{role:`system`,content:m()}],{role:`system`,content:[`You are translating TARGET CHUNK (${a+1}/${I}).`,`Translate ONLY the target chunk. Preserve frontmatter/code exactly.`].join(`
2
+ `)},{role:`user`,content:`>>> TARGET CHUNK START <<<\n${f}\n>>> TARGET CHUNK END <<<`}],E,w,O,k),o=t(e?.fileContent,f);if(o=i(o,f),!n(f,o,s))throw Error(`Validation failed for chunk ${a+1}/${I}`);return{content:o,tokens:e.tokenUsed}})(),C=(y.now()-c).toFixed(0);if(B[a]=b,j&&j(b,a,I),A===`incremental`&&B.slice(0,a+1).every(e=>e&&e!==``)){let e=0;for(;e<I&&B[e]&&B[e]!==``;)e++;let t=B.slice(0,e).join(``);g(p(x),{recursive:!0}),_(x,t)}s([`${l(S)} tokens used `,`${o.GREY_DARK}in ${l(C)}ms${o.RESET}`].join(``))}));await Promise.all(H);let U=B.join(``);(A===`end`||A===`incremental`)&&(g(p(x),{recursive:!0}),_(x,U));let W=((y.now()-P)/1e3).toFixed(2),G=m(w.content.baseDir,x);return N(`${c(`✔`,o.GREEN)} File ${f(G)} completed in ${l(W)}s.`),U}catch(e){T.count++;let t=e?.message??JSON.stringify(e);return N(`${c(`✖`,o.RED)} Error: ${t}`),T.count>=T.maxErrors&&(T.shouldStop=!0),null}};export{b as translateFile};
3
3
  //# sourceMappingURL=translateFile.mjs.map
@@ -1,2 +1,2 @@
1
- import{runParallel as e}from"@intlayer/chokidar/utils";import{watch as t}from"@intlayer/chokidar/watcher";import{getConfiguration as n}from"@intlayer/config/node";import{getAppLogger as r}from"@intlayer/config/logger";const i=async i=>{let a=r(n(i?.configOptions)),o;i?.with&&(o=e(i.with),o.result.catch(()=>{process.exit(1)}));let s=t({persistent:!0,skipPrepare:i?.skipPrepare??!1}),c=async()=>{process.off(`SIGINT`,c),process.off(`SIGTERM`,c),a(`Stopping Intlayer watcher...`);try{await s.close(),o&&`child`in o&&o.child?.kill(`SIGTERM`)}catch(e){console.error(`Error during shutdown:`,e)}finally{process.exit(0)}};process.on(`SIGINT`,c),process.on(`SIGTERM`,c)};export{i as watchContentDeclaration};
1
+ import{getAppLogger as e}from"@intlayer/config/logger";import{logConfigDetails as t}from"@intlayer/chokidar/cli";import{runParallel as n}from"@intlayer/chokidar/utils";import{watch as r}from"@intlayer/chokidar/watcher";import{getConfiguration as i}from"@intlayer/config/node";const a=async a=>{let o=i(a?.configOptions);t(a?.configOptions);let s=e(o),c;a?.with&&(c=n(a.with),c.result.catch(()=>{process.exit(1)}));let l=r({persistent:!0,skipPrepare:a?.skipPrepare??!1}),u=async()=>{process.off(`SIGINT`,u),process.off(`SIGTERM`,u),s(`Stopping Intlayer watcher...`);try{await l.close(),c&&`child`in c&&c.child?.kill(`SIGTERM`)}catch(e){console.error(`Error during shutdown:`,e)}finally{process.exit(0)}};process.on(`SIGINT`,u),process.on(`SIGTERM`,u)};export{a as watchContentDeclaration};
2
2
  //# sourceMappingURL=watch.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"watch.mjs","names":[],"sources":["../../src/watch.ts"],"sourcesContent":["import { runParallel } from '@intlayer/chokidar/utils';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\n\ntype WatchOptions = {\n skipPrepare?: boolean;\n with?: string | string[];\n configOptions?: GetConfigurationOptions;\n};\n\n/**\n * Get locales dictionaries .content.{json|ts|tsx|js|jsx|mjs|cjs} and build the JSON dictionaries in the .intlayer directory.\n * Watch mode available to get the change in the .content.{json|ts|tsx|js|jsx|mjs|cjs}\n */\nexport const watchContentDeclaration = async (options?: WatchOptions) => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n // Store references to the child process\n let parallelProcess: ReturnType<typeof runParallel> | undefined;\n\n if (options?.with) {\n parallelProcess = runParallel(options.with);\n // Handle the promise to avoid unhandled rejection\n parallelProcess.result.catch(() => {\n // Parallel process failed or was terminated\n process.exit(1);\n });\n }\n\n // Capture the watcher instance\n const watcher = watch({\n persistent: true,\n skipPrepare: options?.skipPrepare ?? false,\n });\n\n // Define a Graceful Shutdown function\n const handleShutdown = async () => {\n // Prevent multiple calls\n process.off('SIGINT', handleShutdown);\n process.off('SIGTERM', handleShutdown);\n\n appLogger('Stopping Intlayer watcher...');\n\n try {\n // Close the file watcher immediately to stop \"esbuild service not running\" errors\n await watcher.close();\n\n // If runParallel exposes the child process, we can try to kill it explicitly.\n // Even if it doesn't, process.exit() below usually cleans up attached children.\n if (parallelProcess && 'child' in parallelProcess) {\n // @ts-ignore - Assuming child exists on the return type if runParallel is based on spawn/exec\n parallelProcess.child?.kill('SIGTERM');\n }\n } catch (error) {\n console.error('Error during shutdown:', error);\n } finally {\n process.exit(0);\n }\n };\n\n // Attach Signal Listeners\n process.on('SIGINT', handleShutdown);\n process.on('SIGTERM', handleShutdown);\n};\n"],"mappings":"0NAkBA,MAAa,EAA0B,KAAO,IAA2B,CAEvE,IAAM,EAAY,EADH,EAAiB,GAAS,cAAc,CACjB,CAGlC,EAEA,GAAS,OACX,EAAkB,EAAY,EAAQ,KAAK,CAE3C,EAAgB,OAAO,UAAY,CAEjC,QAAQ,KAAK,EAAE,EACf,EAIJ,IAAM,EAAU,EAAM,CACpB,WAAY,GACZ,YAAa,GAAS,aAAe,GACtC,CAAC,CAGI,EAAiB,SAAY,CAEjC,QAAQ,IAAI,SAAU,EAAe,CACrC,QAAQ,IAAI,UAAW,EAAe,CAEtC,EAAU,+BAA+B,CAEzC,GAAI,CAEF,MAAM,EAAQ,OAAO,CAIjB,GAAmB,UAAW,GAEhC,EAAgB,OAAO,KAAK,UAAU,OAEjC,EAAO,CACd,QAAQ,MAAM,yBAA0B,EAAM,QACtC,CACR,QAAQ,KAAK,EAAE,GAKnB,QAAQ,GAAG,SAAU,EAAe,CACpC,QAAQ,GAAG,UAAW,EAAe"}
1
+ {"version":3,"file":"watch.mjs","names":[],"sources":["../../src/watch.ts"],"sourcesContent":["import { logConfigDetails } from '@intlayer/chokidar/cli';\nimport { runParallel } from '@intlayer/chokidar/utils';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\n\ntype WatchOptions = {\n skipPrepare?: boolean;\n with?: string | string[];\n configOptions?: GetConfigurationOptions;\n};\n\n/**\n * Get locales dictionaries .content.{json|ts|tsx|js|jsx|mjs|cjs} and build the JSON dictionaries in the .intlayer directory.\n * Watch mode available to get the change in the .content.{json|ts|tsx|js|jsx|mjs|cjs}\n */\nexport const watchContentDeclaration = async (options?: WatchOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n // Store references to the child process\n let parallelProcess: ReturnType<typeof runParallel> | undefined;\n\n if (options?.with) {\n parallelProcess = runParallel(options.with);\n // Handle the promise to avoid unhandled rejection\n parallelProcess.result.catch(() => {\n // Parallel process failed or was terminated\n process.exit(1);\n });\n }\n\n // Capture the watcher instance\n const watcher = watch({\n persistent: true,\n skipPrepare: options?.skipPrepare ?? false,\n });\n\n // Define a Graceful Shutdown function\n const handleShutdown = async () => {\n // Prevent multiple calls\n process.off('SIGINT', handleShutdown);\n process.off('SIGTERM', handleShutdown);\n\n appLogger('Stopping Intlayer watcher...');\n\n try {\n // Close the file watcher immediately to stop \"esbuild service not running\" errors\n await watcher.close();\n\n // If runParallel exposes the child process, we can try to kill it explicitly.\n // Even if it doesn't, process.exit() below usually cleans up attached children.\n if (parallelProcess && 'child' in parallelProcess) {\n // @ts-ignore - Assuming child exists on the return type if runParallel is based on spawn/exec\n parallelProcess.child?.kill('SIGTERM');\n }\n } catch (error) {\n console.error('Error during shutdown:', error);\n } finally {\n process.exit(0);\n }\n };\n\n // Attach Signal Listeners\n process.on('SIGINT', handleShutdown);\n process.on('SIGTERM', handleShutdown);\n};\n"],"mappings":"oRAmBA,MAAa,EAA0B,KAAO,IAA2B,CACvE,IAAM,EAAS,EAAiB,GAAS,cAAc,CACvD,EAAiB,GAAS,cAAc,CAExC,IAAM,EAAY,EAAa,EAAO,CAGlC,EAEA,GAAS,OACX,EAAkB,EAAY,EAAQ,KAAK,CAE3C,EAAgB,OAAO,UAAY,CAEjC,QAAQ,KAAK,EAAE,EACf,EAIJ,IAAM,EAAU,EAAM,CACpB,WAAY,GACZ,YAAa,GAAS,aAAe,GACtC,CAAC,CAGI,EAAiB,SAAY,CAEjC,QAAQ,IAAI,SAAU,EAAe,CACrC,QAAQ,IAAI,UAAW,EAAe,CAEtC,EAAU,+BAA+B,CAEzC,GAAI,CAEF,MAAM,EAAQ,OAAO,CAIjB,GAAmB,UAAW,GAEhC,EAAgB,OAAO,KAAK,UAAU,OAEjC,EAAO,CACd,QAAQ,MAAM,yBAA0B,EAAM,QACtC,CACR,QAAQ,KAAK,EAAE,GAKnB,QAAQ,GAAG,SAAU,EAAe,CACpC,QAAQ,GAAG,UAAW,EAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","names":[],"sources":["../../../src/auth/login.ts"],"mappings":";;;KAcK,YAAA;EACH,MAAA;EACA,aAAA,GAAgB,uBAAA;AAAA;AAAA,cAGL,KAAA,GAAe,OAAA,EAAS,YAAA,KAAY,OAAA"}
1
+ {"version":3,"file":"login.d.ts","names":[],"sources":["../../../src/auth/login.ts"],"mappings":";;;KAeK,YAAA;EACH,MAAA;EACA,aAAA,GAAgB,uBAAA;AAAA;AAAA,cAGL,KAAA,GAAe,OAAA,EAAS,YAAA,KAAY,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","names":[],"sources":["../../src/build.ts"],"mappings":";;;KAOK,YAAA;EACH,KAAA;EACA,WAAA;EACA,IAAA;EACA,aAAA,GAAgB,uBAAA;AAAA;;;;;cAOL,KAAA,GAAe,OAAA,GAAU,YAAA,KAAY,OAAA"}
1
+ {"version":3,"file":"build.d.ts","names":[],"sources":["../../src/build.ts"],"mappings":";;;KAQK,YAAA;EACH,KAAA;EACA,WAAA;EACA,IAAA;EACA,aAAA,GAAgB,uBAAA;AAAA;;;;;cAOL,KAAA,GAAe,OAAA,GAAU,YAAA,KAAY,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","names":[],"sources":["../../src/cli.ts"],"mappings":";;;cAyCa,OAAA;AAAA,KA2IR,UAAA;EACH,MAAA;EACA,OAAA;AAAA;AAAA,KAGU,oBAAA;EACV,OAAA;EACA,GAAA;EACA,OAAA;EACA,OAAA;EACA,UAAA;AAAA,IACE,UAAA;AANJ;;;;;;;;AAAA,cAuEa,MAAA,QAAa,OAAA"}
1
+ {"version":3,"file":"cli.d.ts","names":[],"sources":["../../src/cli.ts"],"mappings":";;;cAyCa,OAAA;AAAA,KA4IR,UAAA;EACH,MAAA;EACA,OAAA;AAAA;AAAA,KAGU,oBAAA;EACV,OAAA;EACA,GAAA;EACA,OAAA;EACA,OAAA;EACA,UAAA;AAAA,IACE,UAAA;AANJ;;;;;;;;AAAA,cAuEa,MAAA,QAAa,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","names":[],"sources":["../../src/config.ts"],"mappings":";;;KAMK,aAAA;EACH,aAAA,GAAgB,uBAAA;AAAA;AAAA,cAGL,SAAA,GAAa,OAAA,GAAU,aAAA"}
1
+ {"version":3,"file":"config.d.ts","names":[],"sources":["../../src/config.ts"],"mappings":";;;KAOK,aAAA;EACH,aAAA,GAAgB,uBAAA;AAAA;AAAA,cAGL,SAAA,GAAa,OAAA,GAAU,aAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"extract.d.ts","names":[],"sources":["../../src/extract.ts"],"mappings":";;;KAaK,cAAA;EACH,KAAA;EACA,yBAAA;EACA,aAAA,GAAgB,uBAAA;EAChB,QAAA;EACA,eAAA;AAAA;AAAA,cAoBW,OAAA,GAAiB,OAAA,EAAS,cAAA,KAAc,OAAA"}
1
+ {"version":3,"file":"extract.d.ts","names":[],"sources":["../../src/extract.ts"],"mappings":";;;KAcK,cAAA;EACH,KAAA;EACA,yBAAA;EACA,aAAA,GAAgB,uBAAA;EAChB,QAAA;EACA,eAAA;AAAA;AAAA,cAoBW,OAAA,GAAiB,OAAA,EAAS,cAAA,KAAc,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"fill.d.ts","names":[],"sources":["../../../src/fill/fill.ts"],"mappings":";;;;;;KAqCY,WAAA;EACV,YAAA,GAAe,MAAA;EACf,aAAA,GAAgB,MAAA,GAAS,MAAA;EACzB,IAAA;EACA,UAAA,GAAa,mBAAA;EACb,SAAA,GAAY,SAAA;EACZ,OAAA;EACA,wBAAA;EACA,iBAAA;EACA,KAAA;EACA,YAAA;AAAA,IACE,0BAAA;;;;cAKS,IAAA,GAAc,OAAA,GAAU,WAAA,KAAc,OAAA"}
1
+ {"version":3,"file":"fill.d.ts","names":[],"sources":["../../../src/fill/fill.ts"],"mappings":";;;;;;KAwCY,WAAA;EACV,YAAA,GAAe,MAAA;EACf,aAAA,GAAgB,MAAA,GAAS,MAAA;EACzB,IAAA;EACA,UAAA,GAAa,mBAAA;EACb,SAAA,GAAY,SAAA;EACZ,OAAA;EACA,wBAAA;EACA,iBAAA;EACA,KAAA;EACA,YAAA;AAAA,IACE,0BAAA;;;;cAKS,IAAA,GAAc,OAAA,GAAU,WAAA,KAAc,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"getFilterMissingContentPerLocale.d.ts","names":[],"sources":["../../../src/fill/getFilterMissingContentPerLocale.ts"],"mappings":";;;;;AA2DA;;;;;;cAAa,gCAAA,GACX,gBAAA,EAAkB,UAAA,EAClB,gBAAA,EAAkB,UAAA,iBACjB,UAAA"}
1
+ {"version":3,"file":"getFilterMissingContentPerLocale.d.ts","names":[],"sources":["../../../src/fill/getFilterMissingContentPerLocale.ts"],"mappings":";;;;;AAgEA;;;;;;cAAa,gCAAA,GACX,gBAAA,EAAkB,UAAA,EAClB,gBAAA,EAAkB,UAAA,iBACjB,UAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"translateDictionary.d.ts","names":[],"sources":["../../../src/fill/translateDictionary.ts"],"mappings":";;;;;;;;KAkCK,yBAAA,GAA4B,eAAA;EAC/B,gBAAA,EAAkB,UAAA;AAAA;AAAA,KAGf,0BAAA;EACH,IAAA;EACA,SAAA,GAAY,SAAA;EACZ,YAAA;EACA,QAAA,GAAW,UAAA,QAFU,yBAAA,CAGuB,gBAAA;EAE5C,SAAA;EACA,OAAA,IAAW,KAAA;EACX,aAAA,SAAsB,KAAA;EACtB,QAAA,GAAW,QAAA;EACX,QAAA,GAAW,QAAA;AAAA;AAAA,cAcA,mBAAA,GACX,IAAA,EAAM,eAAA,EACN,aAAA,EAAe,cAAA,EACf,OAAA,GAAU,0BAAA,KACT,OAAA,CAAQ,yBAAA"}
1
+ {"version":3,"file":"translateDictionary.d.ts","names":[],"sources":["../../../src/fill/translateDictionary.ts"],"mappings":";;;;;;;;KAkCK,yBAAA,GAA4B,eAAA;EAC/B,gBAAA,EAAkB,UAAA;AAAA;AAAA,KAGf,0BAAA;EACH,IAAA;EACA,SAAA,GAAY,SAAA;EACZ,YAAA;EACA,QAAA,GAAW,UAAA,QAFU,yBAAA,CAGuB,gBAAA;EAE5C,SAAA;EACA,OAAA,IAAW,KAAA;EACX,aAAA,SAAsB,KAAA;EACtB,QAAA,GAAW,QAAA;EACX,QAAA,GAAW,QAAA;AAAA;AAAA,cA+CA,mBAAA,GACX,IAAA,EAAM,eAAA,EACN,aAAA,EAAe,cAAA,EACf,OAAA,GAAU,0BAAA,KACT,OAAA,CAAQ,yBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"pull.d.ts","names":[],"sources":["../../src/pull.ts"],"mappings":";;;KAmBK,WAAA;EACH,YAAA;EACA,mBAAA;EACA,aAAA,GAAgB,uBAAA;AAAA;;;;;cAcL,IAAA,GAAc,OAAA,GAAU,WAAA,KAAc,OAAA"}
1
+ {"version":3,"file":"pull.d.ts","names":[],"sources":["../../src/pull.ts"],"mappings":";;;KAoBK,WAAA;EACH,YAAA;EACA,mBAAA;EACA,aAAA,GAAgB,uBAAA;AAAA;;;;;cAcL,IAAA,GAAc,OAAA,GAAU,WAAA,KAAc,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"push.d.ts","names":[],"sources":["../../../src/push/push.ts"],"mappings":";;;;KAwBK,WAAA;EACH,sBAAA;EACA,oBAAA;EACA,YAAA;EACA,UAAA,GAAa,mBAAA;EACb,aAAA,GAAgB,uBAAA;EAChB,KAAA;AAAA;;;;cA4BW,IAAA,GAAc,OAAA,GAAU,WAAA,KAAc,OAAA"}
1
+ {"version":3,"file":"push.d.ts","names":[],"sources":["../../../src/push/push.ts"],"mappings":";;;;KA4BK,WAAA;EACH,sBAAA;EACA,oBAAA;EACA,YAAA;EACA,UAAA,GAAa,mBAAA;EACb,aAAA,GAAgB,uBAAA;EAChB,KAAA;AAAA;;;;cA4BW,IAAA,GAAc,OAAA,GAAU,WAAA,KAAc,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"pushConfig.d.ts","names":[],"sources":["../../src/pushConfig.ts"],"mappings":";;;KAQK,WAAA;EACH,aAAA,GAAgB,uBAAA;AAAA;AAAA,cAGL,UAAA,GAAoB,OAAA,GAAU,WAAA,KAAW,OAAA"}
1
+ {"version":3,"file":"pushConfig.d.ts","names":[],"sources":["../../src/pushConfig.ts"],"mappings":";;;KASK,WAAA;EACH,aAAA,GAAgB,uBAAA;AAAA;AAAA,cAGL,UAAA,GAAoB,OAAA,GAAU,WAAA,KAAW,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"reviewDoc.d.ts","names":[],"sources":["../../../src/reviewDoc/reviewDoc.ts"],"mappings":";;;;;;KA8BK,gBAAA;EACH,UAAA;EACA,OAAA,EAAS,MAAA;EACT,mBAAA;EACA,UAAA,EAAY,MAAA;EACZ,SAAA,GAAY,SAAA;EACZ,2BAAA;EACA,aAAA,GAAgB,uBAAA;EAChB,kBAAA;EACA,oBAAA,qBAAyC,IAAA;EACzC,mBAAA,qBAAwC,IAAA;EACxC,YAAA;EACA,UAAA,GAAa,mBAAA;AAAA;;;;;cAOF,SAAA;EAAmB,UAAA;EAAA,OAAA;EAAA,mBAAA;EAAA,UAAA;EAAA,SAAA;EAAA,2BAAA;EAAA,aAAA;EAAA,kBAAA;EAAA,oBAAA;EAAA,mBAAA;EAAA,YAAA;EAAA;AAAA,GAa7B,gBAAA,KAAgB,OAAA"}
1
+ {"version":3,"file":"reviewDoc.d.ts","names":[],"sources":["../../../src/reviewDoc/reviewDoc.ts"],"mappings":";;;;;;KA+BK,gBAAA;EACH,UAAA;EACA,OAAA,EAAS,MAAA;EACT,mBAAA;EACA,UAAA,EAAY,MAAA;EACZ,SAAA,GAAY,SAAA;EACZ,2BAAA;EACA,aAAA,GAAgB,uBAAA;EAChB,kBAAA;EACA,oBAAA,qBAAyC,IAAA;EACzC,mBAAA,qBAAwC,IAAA;EACxC,YAAA;EACA,UAAA,GAAa,mBAAA;AAAA;;;;;cAOF,SAAA;EAAmB,UAAA;EAAA,OAAA;EAAA,mBAAA;EAAA,UAAA;EAAA,SAAA;EAAA,2BAAA;EAAA,aAAA;EAAA,kBAAA;EAAA,oBAAA;EAAA,mBAAA;EAAA,YAAA;EAAA;AAAA,GAa7B,gBAAA,KAAgB,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"searchDoc.d.ts","names":[],"sources":["../../src/searchDoc.ts"],"mappings":";;;UAWU,gBAAA;EACR,KAAA;EACA,KAAA;EACA,aAAA,GAAgB,uBAAA;AAAA;AAAA,cAGL,SAAA;EAAmB,KAAA;EAAA,KAAA;EAAA;AAAA,GAI7B,gBAAA,KAAgB,OAAA"}
1
+ {"version":3,"file":"searchDoc.d.ts","names":[],"sources":["../../src/searchDoc.ts"],"mappings":";;;UAYU,gBAAA;EACR,KAAA;EACA,KAAA;EACA,aAAA,GAAgB,uBAAA;AAAA;AAAA,cAGL,SAAA;EAAmB,KAAA;EAAA,KAAA;EAAA;AAAA,GAI7B,gBAAA,KAAgB,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"listMissingTranslations.d.ts","names":[],"sources":["../../../src/test/listMissingTranslations.ts"],"mappings":";;;;cASa,iCAAA,GACX,aAAA,EAAe,cAAA;;;;;aASJ,MAAA;EAAA;;;;cAmEA,uBAAA,GACX,oBAAA,GAAuB,uBAAA;;;;;aApEZ,MAAA;EAAA"}
1
+ {"version":3,"file":"listMissingTranslations.d.ts","names":[],"sources":["../../../src/test/listMissingTranslations.ts"],"mappings":";;;;cAUa,iCAAA,GACX,aAAA,EAAe,cAAA;;;;;aASJ,MAAA;EAAA;;;;cAmEA,uBAAA,GACX,oBAAA,GAAuB,uBAAA;;;;;aApEZ,MAAA;EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"watch.d.ts","names":[],"sources":["../../src/watch.ts"],"mappings":";;;KAQK,YAAA;EACH,WAAA;EACA,IAAA;EACA,aAAA,GAAgB,uBAAA;AAAA;;;;;cAOL,uBAAA,GAAiC,OAAA,GAAU,YAAA,KAAY,OAAA"}
1
+ {"version":3,"file":"watch.d.ts","names":[],"sources":["../../src/watch.ts"],"mappings":";;;KASK,YAAA;EACH,WAAA;EACA,IAAA;EACA,aAAA,GAAgB,uBAAA;AAAA;;;;;cAOL,uBAAA,GAAiC,OAAA,GAAU,YAAA,KAAY,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/cli",
3
- "version": "8.2.2",
3
+ "version": "8.2.3",
4
4
  "private": false,
5
5
  "description": "Provides uniform command-line interface scripts for Intlayer, used in packages like intlayer-cli and intlayer.",
6
6
  "keywords": [
@@ -67,33 +67,33 @@
67
67
  },
68
68
  "dependencies": {
69
69
  "@clack/prompts": "0.11.0",
70
- "@intlayer/ai": "8.2.2",
71
- "@intlayer/api": "8.2.2",
72
- "@intlayer/babel": "8.2.2",
73
- "@intlayer/chokidar": "8.2.2",
74
- "@intlayer/config": "8.2.2",
75
- "@intlayer/core": "8.2.2",
76
- "@intlayer/dictionaries-entry": "8.2.2",
77
- "@intlayer/remote-dictionaries-entry": "8.2.2",
78
- "@intlayer/types": "8.2.2",
79
- "@intlayer/unmerged-dictionaries-entry": "8.2.2",
70
+ "@intlayer/ai": "8.2.3",
71
+ "@intlayer/api": "8.2.3",
72
+ "@intlayer/babel": "8.2.3",
73
+ "@intlayer/chokidar": "8.2.3",
74
+ "@intlayer/config": "8.2.3",
75
+ "@intlayer/core": "8.2.3",
76
+ "@intlayer/dictionaries-entry": "8.2.3",
77
+ "@intlayer/remote-dictionaries-entry": "8.2.3",
78
+ "@intlayer/types": "8.2.3",
79
+ "@intlayer/unmerged-dictionaries-entry": "8.2.3",
80
80
  "commander": "14.0.3",
81
81
  "enquirer": "^2.4.1",
82
82
  "eventsource": "4.1.0",
83
83
  "fast-glob": "3.3.3"
84
84
  },
85
85
  "devDependencies": {
86
- "@types/node": "25.3.3",
86
+ "@types/node": "25.3.5",
87
87
  "@utils/ts-config": "1.0.4",
88
88
  "@utils/ts-config-types": "1.0.4",
89
89
  "@utils/tsdown-config": "1.0.4",
90
90
  "rimraf": "6.1.3",
91
- "tsdown": "0.20.3",
91
+ "tsdown": "0.21.0",
92
92
  "typescript": "5.9.3",
93
93
  "vitest": "4.0.18"
94
94
  },
95
95
  "peerDependencies": {
96
- "@intlayer/ai": "8.2.2"
96
+ "@intlayer/ai": "8.2.3"
97
97
  },
98
98
  "peerDependenciesMeta": {
99
99
  "@intlayer/ai": {