@intlayer/cli 8.9.7 → 8.10.0-canary.0

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 (206) hide show
  1. package/README.md +14 -0
  2. package/dist/cjs/IntlayerEventListener.cjs.map +1 -1
  3. package/dist/cjs/auth/login.cjs +3 -1
  4. package/dist/cjs/auth/login.cjs.map +1 -1
  5. package/dist/cjs/auth/sessionToken.cjs.map +1 -1
  6. package/dist/cjs/build.cjs.map +1 -1
  7. package/dist/cjs/bundle.cjs.map +1 -1
  8. package/dist/cjs/ci.cjs.map +1 -1
  9. package/dist/cjs/cli.cjs.map +1 -1
  10. package/dist/cjs/config.cjs +1 -1
  11. package/dist/cjs/config.cjs.map +1 -1
  12. package/dist/cjs/editor.cjs.map +1 -1
  13. package/dist/cjs/extract.cjs.map +1 -1
  14. package/dist/cjs/fill/deepMergeContent.cjs.map +1 -1
  15. package/dist/cjs/fill/extractTranslatableContent.cjs.map +1 -1
  16. package/dist/cjs/fill/fill.cjs.map +1 -1
  17. package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -1
  18. package/dist/cjs/fill/formatFillData.cjs.map +1 -1
  19. package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs.map +1 -1
  20. package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs.map +1 -1
  21. package/dist/cjs/fill/listTranslationsTasks.cjs.map +1 -1
  22. package/dist/cjs/fill/translateDictionary.cjs +2 -2
  23. package/dist/cjs/fill/translateDictionary.cjs.map +1 -1
  24. package/dist/cjs/fill/writeFill.cjs.map +1 -1
  25. package/dist/cjs/getTargetDictionary.cjs.map +1 -1
  26. package/dist/cjs/init.cjs.map +1 -1
  27. package/dist/cjs/initMCP.cjs.map +1 -1
  28. package/dist/cjs/initSkills.cjs.map +1 -1
  29. package/dist/cjs/listContentDeclaration.cjs.map +1 -1
  30. package/dist/cjs/listProjects.cjs.map +1 -1
  31. package/dist/cjs/liveSync.cjs.map +1 -1
  32. package/dist/cjs/pull.cjs +3 -4
  33. package/dist/cjs/pull.cjs.map +1 -1
  34. package/dist/cjs/push/pullLog.cjs.map +1 -1
  35. package/dist/cjs/push/push.cjs +1 -2
  36. package/dist/cjs/push/push.cjs.map +1 -1
  37. package/dist/cjs/pushConfig.cjs +6 -4
  38. package/dist/cjs/pushConfig.cjs.map +1 -1
  39. package/dist/cjs/pushLog.cjs.map +1 -1
  40. package/dist/cjs/reviewDoc/reviewDoc.cjs.map +1 -1
  41. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs.map +1 -1
  42. package/dist/cjs/searchDoc.cjs.map +1 -1
  43. package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
  44. package/dist/cjs/test/test.cjs.map +1 -1
  45. package/dist/cjs/translateDoc/translateDoc.cjs.map +1 -1
  46. package/dist/cjs/translateDoc/translateFile.cjs.map +1 -1
  47. package/dist/cjs/translateDoc/validation.cjs.map +1 -1
  48. package/dist/cjs/translation-alignment/alignBlocks.cjs.map +1 -1
  49. package/dist/cjs/translation-alignment/computeSimilarity.cjs.map +1 -1
  50. package/dist/cjs/translation-alignment/fingerprintBlock.cjs.map +1 -1
  51. package/dist/cjs/translation-alignment/mapChangedLinesToBlocks.cjs.map +1 -1
  52. package/dist/cjs/translation-alignment/normalizeBlock.cjs.map +1 -1
  53. package/dist/cjs/translation-alignment/pipeline.cjs.map +1 -1
  54. package/dist/cjs/translation-alignment/planActions.cjs.map +1 -1
  55. package/dist/cjs/translation-alignment/rebuildDocument.cjs.map +1 -1
  56. package/dist/cjs/translation-alignment/segmentDocument.cjs.map +1 -1
  57. package/dist/cjs/utils/calculateChunks.cjs.map +1 -1
  58. package/dist/cjs/utils/checkAccess.cjs +6 -0
  59. package/dist/cjs/utils/checkAccess.cjs.map +1 -1
  60. package/dist/cjs/utils/checkConfigConsistency.cjs.map +1 -1
  61. package/dist/cjs/utils/checkFileModifiedRange.cjs.map +1 -1
  62. package/dist/cjs/utils/checkLastUpdateTime.cjs.map +1 -1
  63. package/dist/cjs/utils/chunkInference.cjs +2 -2
  64. package/dist/cjs/utils/chunkInference.cjs.map +1 -1
  65. package/dist/cjs/utils/fixChunkStartEndChars.cjs.map +1 -1
  66. package/dist/cjs/utils/formatTimeDiff.cjs.map +1 -1
  67. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs.map +1 -1
  68. package/dist/cjs/utils/getOutputFilePath.cjs.map +1 -1
  69. package/dist/cjs/utils/getParentPackageJSON.cjs.map +1 -1
  70. package/dist/cjs/utils/listSpecialChars.cjs.map +1 -1
  71. package/dist/cjs/utils/mapChunksBetweenFiles.cjs.map +1 -1
  72. package/dist/cjs/utils/openBrowser.cjs.map +1 -1
  73. package/dist/cjs/utils/reorderParagraphs.cjs.map +1 -1
  74. package/dist/cjs/utils/setupAI.cjs.map +1 -1
  75. package/dist/cjs/watch.cjs.map +1 -1
  76. package/dist/esm/IntlayerEventListener.mjs.map +1 -1
  77. package/dist/esm/auth/login.mjs +3 -1
  78. package/dist/esm/auth/login.mjs.map +1 -1
  79. package/dist/esm/auth/sessionToken.mjs.map +1 -1
  80. package/dist/esm/build.mjs.map +1 -1
  81. package/dist/esm/bundle.mjs.map +1 -1
  82. package/dist/esm/ci.mjs.map +1 -1
  83. package/dist/esm/cli.mjs.map +1 -1
  84. package/dist/esm/config.mjs +2 -2
  85. package/dist/esm/config.mjs.map +1 -1
  86. package/dist/esm/editor.mjs.map +1 -1
  87. package/dist/esm/extract.mjs.map +1 -1
  88. package/dist/esm/fill/deepMergeContent.mjs.map +1 -1
  89. package/dist/esm/fill/extractTranslatableContent.mjs.map +1 -1
  90. package/dist/esm/fill/fill.mjs.map +1 -1
  91. package/dist/esm/fill/formatAutoFilledFilePath.mjs.map +1 -1
  92. package/dist/esm/fill/formatFillData.mjs.map +1 -1
  93. package/dist/esm/fill/getAvailableLocalesInDictionary.mjs.map +1 -1
  94. package/dist/esm/fill/getFilterMissingContentPerLocale.mjs.map +1 -1
  95. package/dist/esm/fill/listTranslationsTasks.mjs.map +1 -1
  96. package/dist/esm/fill/translateDictionary.mjs +2 -2
  97. package/dist/esm/fill/translateDictionary.mjs.map +1 -1
  98. package/dist/esm/fill/writeFill.mjs.map +1 -1
  99. package/dist/esm/getTargetDictionary.mjs.map +1 -1
  100. package/dist/esm/init.mjs.map +1 -1
  101. package/dist/esm/initMCP.mjs.map +1 -1
  102. package/dist/esm/initSkills.mjs.map +1 -1
  103. package/dist/esm/listContentDeclaration.mjs.map +1 -1
  104. package/dist/esm/listProjects.mjs.map +1 -1
  105. package/dist/esm/liveSync.mjs.map +1 -1
  106. package/dist/esm/pull.mjs +4 -5
  107. package/dist/esm/pull.mjs.map +1 -1
  108. package/dist/esm/push/pullLog.mjs.map +1 -1
  109. package/dist/esm/push/push.mjs +2 -3
  110. package/dist/esm/push/push.mjs.map +1 -1
  111. package/dist/esm/pushConfig.mjs +8 -6
  112. package/dist/esm/pushConfig.mjs.map +1 -1
  113. package/dist/esm/pushLog.mjs.map +1 -1
  114. package/dist/esm/reviewDoc/reviewDoc.mjs.map +1 -1
  115. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs.map +1 -1
  116. package/dist/esm/searchDoc.mjs.map +1 -1
  117. package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
  118. package/dist/esm/test/test.mjs.map +1 -1
  119. package/dist/esm/translateDoc/translateDoc.mjs.map +1 -1
  120. package/dist/esm/translateDoc/translateFile.mjs.map +1 -1
  121. package/dist/esm/translateDoc/validation.mjs.map +1 -1
  122. package/dist/esm/translation-alignment/alignBlocks.mjs.map +1 -1
  123. package/dist/esm/translation-alignment/computeSimilarity.mjs.map +1 -1
  124. package/dist/esm/translation-alignment/fingerprintBlock.mjs.map +1 -1
  125. package/dist/esm/translation-alignment/mapChangedLinesToBlocks.mjs.map +1 -1
  126. package/dist/esm/translation-alignment/normalizeBlock.mjs.map +1 -1
  127. package/dist/esm/translation-alignment/pipeline.mjs.map +1 -1
  128. package/dist/esm/translation-alignment/planActions.mjs.map +1 -1
  129. package/dist/esm/translation-alignment/rebuildDocument.mjs.map +1 -1
  130. package/dist/esm/translation-alignment/segmentDocument.mjs.map +1 -1
  131. package/dist/esm/utils/calculateChunks.mjs.map +1 -1
  132. package/dist/esm/utils/checkAccess.mjs +6 -1
  133. package/dist/esm/utils/checkAccess.mjs.map +1 -1
  134. package/dist/esm/utils/checkConfigConsistency.mjs.map +1 -1
  135. package/dist/esm/utils/checkFileModifiedRange.mjs.map +1 -1
  136. package/dist/esm/utils/checkLastUpdateTime.mjs.map +1 -1
  137. package/dist/esm/utils/chunkInference.mjs +2 -2
  138. package/dist/esm/utils/chunkInference.mjs.map +1 -1
  139. package/dist/esm/utils/fixChunkStartEndChars.mjs.map +1 -1
  140. package/dist/esm/utils/formatTimeDiff.mjs.map +1 -1
  141. package/dist/esm/utils/getIsFileUpdatedRecently.mjs.map +1 -1
  142. package/dist/esm/utils/getOutputFilePath.mjs.map +1 -1
  143. package/dist/esm/utils/getParentPackageJSON.mjs.map +1 -1
  144. package/dist/esm/utils/listSpecialChars.mjs.map +1 -1
  145. package/dist/esm/utils/mapChunksBetweenFiles.mjs.map +1 -1
  146. package/dist/esm/utils/openBrowser.mjs.map +1 -1
  147. package/dist/esm/utils/reorderParagraphs.mjs.map +1 -1
  148. package/dist/esm/utils/setupAI.mjs.map +1 -1
  149. package/dist/esm/watch.mjs.map +1 -1
  150. package/dist/types/IntlayerEventListener.d.ts.map +1 -1
  151. package/dist/types/auth/login.d.ts.map +1 -1
  152. package/dist/types/auth/sessionToken.d.ts +1 -1
  153. package/dist/types/auth/sessionToken.d.ts.map +1 -1
  154. package/dist/types/build.d.ts.map +1 -1
  155. package/dist/types/bundle.d.ts.map +1 -1
  156. package/dist/types/cli.d.ts.map +1 -1
  157. package/dist/types/config.d.ts.map +1 -1
  158. package/dist/types/editor.d.ts.map +1 -1
  159. package/dist/types/extract.d.ts.map +1 -1
  160. package/dist/types/fill/extractTranslatableContent.d.ts.map +1 -1
  161. package/dist/types/fill/fill.d.ts.map +1 -1
  162. package/dist/types/fill/formatFillData.d.ts.map +1 -1
  163. package/dist/types/fill/getAvailableLocalesInDictionary.d.ts.map +1 -1
  164. package/dist/types/fill/translateDictionary.d.ts +1 -2
  165. package/dist/types/fill/translateDictionary.d.ts.map +1 -1
  166. package/dist/types/index.d.ts +4 -4
  167. package/dist/types/init.d.ts.map +1 -1
  168. package/dist/types/initSkills.d.ts.map +1 -1
  169. package/dist/types/listContentDeclaration.d.ts.map +1 -1
  170. package/dist/types/listProjects.d.ts.map +1 -1
  171. package/dist/types/liveSync.d.ts.map +1 -1
  172. package/dist/types/pull.d.ts.map +1 -1
  173. package/dist/types/push/pullLog.d.ts.map +1 -1
  174. package/dist/types/push/push.d.ts.map +1 -1
  175. package/dist/types/pushConfig.d.ts.map +1 -1
  176. package/dist/types/pushLog.d.ts.map +1 -1
  177. package/dist/types/searchDoc.d.ts.map +1 -1
  178. package/dist/types/test/test.d.ts.map +1 -1
  179. package/dist/types/translateDoc/types.d.ts.map +1 -1
  180. package/dist/types/translateDoc/validation.d.ts.map +1 -1
  181. package/dist/types/translation-alignment/computeSimilarity.d.ts.map +1 -1
  182. package/dist/types/translation-alignment/normalizeBlock.d.ts.map +1 -1
  183. package/dist/types/translation-alignment/pipeline.d.ts.map +1 -1
  184. package/dist/types/translation-alignment/rebuildDocument.d.ts.map +1 -1
  185. package/dist/types/translation-alignment/segmentDocument.d.ts.map +1 -1
  186. package/dist/types/translation-alignment/types.d.ts.map +1 -1
  187. package/dist/types/utils/calculateChunks.d.ts.map +1 -1
  188. package/dist/types/utils/checkAccess.d.ts +3 -2
  189. package/dist/types/utils/checkAccess.d.ts.map +1 -1
  190. package/dist/types/utils/checkConfigConsistency.d.ts.map +1 -1
  191. package/dist/types/utils/checkFileModifiedRange.d.ts.map +1 -1
  192. package/dist/types/utils/checkLastUpdateTime.d.ts.map +1 -1
  193. package/dist/types/utils/chunkInference.d.ts.map +1 -1
  194. package/dist/types/utils/fixChunkStartEndChars.d.ts.map +1 -1
  195. package/dist/types/utils/formatTimeDiff.d.ts.map +1 -1
  196. package/dist/types/utils/getIsFileUpdatedRecently.d.ts.map +1 -1
  197. package/dist/types/utils/getOutputFilePath.d.ts.map +1 -1
  198. package/dist/types/utils/getParentPackageJSON.d.ts.map +1 -1
  199. package/dist/types/utils/listSpecialChars.d.ts.map +1 -1
  200. package/dist/types/utils/mapChunksBetweenFiles.d.ts.map +1 -1
  201. package/dist/types/utils/openBrowser.d.ts.map +1 -1
  202. package/dist/types/utils/reorderParagraphs.d.ts.map +1 -1
  203. package/dist/types/utils/setupAI.d.ts +1 -2
  204. package/dist/types/utils/setupAI.d.ts.map +1 -1
  205. package/dist/types/watch.d.ts.map +1 -1
  206. package/package.json +13 -13
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":["pathDirname"],"sources":["../../src/cli.ts"],"sourcesContent":["import { dirname as pathDirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { AIOptions as BaseAIOptions } from '@intlayer/api';\nimport type { DiffMode, ListGitFilesOptions } from '@intlayer/chokidar/cli';\nimport { setPrefix } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { CustomIntlayerConfig } from '@intlayer/types/config';\nimport { Command } from 'commander';\nimport { login } from './auth/login';\nimport { build } from './build';\nimport { bundle } from './bundle';\nimport { runCI } from './ci';\nimport { getConfig } from './config';\nimport { startEditor } from './editor';\nimport { extract } from './extract';\nimport { type FillOptions, fill } from './fill/fill';\nimport { init } from './init';\nimport { initMCP } from './initMCP';\nimport { initSkills } from './initSkills';\nimport { listContentDeclaration } from './listContentDeclaration';\nimport { listProjectsCommand } from './listProjects';\nimport { liveSync } from './liveSync';\nimport { pull } from './pull';\nimport { push } from './push/push';\nimport { pushConfig } from './pushConfig';\nimport { reviewDoc } from './reviewDoc/reviewDoc';\nimport { searchDoc } from './searchDoc';\nimport { testMissingTranslations } from './test';\nimport { translateDoc } from './translateDoc/translateDoc';\nimport { getParentPackageJSON } from './utils/getParentPackageJSON';\nimport { watchContentDeclaration } from './watch';\n\n// Extended AI options to include customPrompt\ntype AIOptions = BaseAIOptions & {\n customPrompt?: string;\n};\n\nconst isESModule = typeof import.meta.url === 'string';\n\nexport const dirname = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nconst packageJson = getParentPackageJSON(dirname);\n\nconst logOptions = [\n ['--verbose', 'Verbose (default to true using CLI)'],\n ['--prefix [prefix]', 'Prefix'],\n];\n\nconst configurationOptions = [\n ['--env-file [envFile]', 'Environment file'],\n ['-e, --env [env]', 'Environment'],\n ['--base-dir [baseDir]', 'Base directory'],\n ['--no-cache [noCache]', 'No cache'],\n ...logOptions,\n];\n\nconst aiOptions = [\n ['--provider [provider]', 'Provider'],\n ['--temperature [temperature]', 'Temperature'],\n ['--model [model]', 'Model'],\n ['--api-key [apiKey]', 'Provider API key'],\n ['--custom-prompt [prompt]', 'Custom prompt'],\n ['--application-context [applicationContext]', 'Application context'],\n ['--data-serialization [dataSerialization]', 'Data serialization'],\n];\n\nconst gitOptions = [\n ['--git-diff [gitDiff]', 'Git diff mode - Check git diff between two refs'],\n ['--git-diff-base [gitDiffBase]', 'Git diff base ref'],\n ['--git-diff-current [gitDiffCurrent]', 'Git diff current ref'],\n ['--uncommitted [uncommitted]', 'Uncommitted'],\n ['--unpushed [unpushed]', 'Unpushed'],\n ['--untracked [untracked]', 'Untracked'],\n];\n\nconst extractKeysFromOptions = (options: object, keys: string[]) =>\n keys.filter((key) => options[key as keyof typeof options] !== undefined);\n\n/**\n * Helper functions to apply common options to commands\n */\nconst applyOptions = (command: Command, options: string[][]) => {\n options.forEach(([flag, description]) => {\n command.option(flag, description);\n });\n return command;\n};\n\nconst removeUndefined = <T extends Record<string, any>>(obj: T): T =>\n Object.fromEntries(\n Object.entries(obj).filter(([_, value]) => value !== undefined)\n ) as T;\n\nconst applyConfigOptions = (command: Command) =>\n applyOptions(command, configurationOptions);\nconst applyAIOptions = (command: Command) => applyOptions(command, aiOptions);\nconst applyGitOptions = (command: Command) => applyOptions(command, gitOptions);\n\nconst extractAiOptions = (options: AIOptions): AIOptions | undefined => {\n const {\n apiKey,\n provider,\n model,\n temperature,\n applicationContext,\n customPrompt,\n dataSerialization,\n } = options;\n\n const configuration = getConfiguration();\n\n const { ai } = configuration;\n\n return removeUndefined({\n ...ai,\n apiKey: apiKey ?? configuration.ai?.apiKey,\n provider: provider ?? (configuration.ai?.provider as AIOptions['provider']),\n model: model ?? configuration.ai?.model,\n temperature: temperature ?? configuration.ai?.temperature,\n applicationContext:\n applicationContext ?? configuration.ai?.applicationContext,\n customPrompt: customPrompt ?? (configuration.ai as any)?.customPrompt,\n dataSerialization: dataSerialization ?? configuration.ai?.dataSerialization,\n });\n};\n\ntype GitOptions = {\n gitDiff?: boolean;\n gitDiffBase?: string;\n gitDiffCurrent?: string;\n uncommitted?: boolean;\n unpushed?: boolean;\n untracked?: boolean;\n};\n\nconst gitOptionKeys: (keyof GitOptions)[] = [\n 'gitDiff',\n 'gitDiffBase',\n 'gitDiffCurrent',\n 'uncommitted',\n 'unpushed',\n 'untracked',\n];\n\nconst extractGitOptions = (\n options: GitOptions\n): ListGitFilesOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(options, gitOptionKeys);\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) return undefined;\n\n const {\n gitDiff,\n gitDiffBase,\n gitDiffCurrent,\n uncommitted,\n unpushed,\n untracked,\n } = options;\n\n const mode = [\n gitDiff && 'gitDiff',\n uncommitted && 'uncommitted',\n unpushed && 'unpushed',\n untracked && 'untracked',\n ].filter(Boolean) as DiffMode[];\n\n return removeUndefined({\n mode,\n baseRef: gitDiffBase,\n currentRef: gitDiffCurrent,\n absolute: true,\n });\n};\n\ntype LogOptions = {\n prefix?: string;\n verbose?: boolean;\n};\n\nexport type ConfigurationOptions = {\n baseDir?: string;\n env?: string;\n envFile?: string;\n noCache?: boolean;\n checkTypes?: boolean;\n} & LogOptions;\n\nconst configurationOptionKeys: (keyof ConfigurationOptions)[] = [\n 'baseDir',\n 'env',\n 'envFile',\n 'verbose',\n 'prefix',\n 'checkTypes',\n];\n\nconst extractConfigOptions = (\n options: ConfigurationOptions & { with?: string }\n): GetConfigurationOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(\n options,\n configurationOptionKeys\n );\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) {\n return undefined;\n }\n\n const { baseDir, env, envFile, verbose, noCache, checkTypes } = options;\n\n const log = removeUndefined({\n mode:\n typeof verbose !== 'undefined'\n ? verbose\n ? 'verbose'\n : 'default'\n : undefined,\n });\n\n const build = removeUndefined({\n checkTypes,\n });\n\n const override: CustomIntlayerConfig = removeUndefined({\n log:\n Object.keys(log).length > 0\n ? (log as CustomIntlayerConfig['log'])\n : undefined,\n build: Object.keys(build).length > 0 ? build : undefined,\n });\n\n return removeUndefined({\n baseDir,\n env,\n envFile,\n override: Object.keys(override).length > 0 ? override : undefined,\n cache: typeof noCache !== 'undefined' ? !noCache : undefined,\n });\n};\n\n/**\n * Set the API for the CLI\n *\n * Example of commands:\n *\n * npm run intlayer build --watch\n * npm run intlayer push --dictionaries id1 id2 id3 --deleteLocaleDir\n */\nexport const setAPI = (): Command => {\n const isWithCommand = process.argv.includes('--with');\n\n if (!isWithCommand) {\n setPrefix('');\n }\n\n const program = new Command();\n\n program.version(packageJson.version!).description('Intlayer CLI');\n\n // Explicit version subcommand for convenience: `npx intlayer version`\n program\n .command('version')\n .description('Print the Intlayer CLI version')\n .action(() => {\n // Prefer the resolved package.json version; fallback to unknown\n // Keeping output minimal to align with common CLI behavior\n console.log(packageJson.version ?? 'unknown');\n });\n\n /**\n * AUTH\n */\n const loginCmd = program\n .command('login')\n .description('Login to Intlayer')\n .option('--cms-url [cmsUrl]', 'CMS URL');\n\n applyConfigOptions(loginCmd);\n\n loginCmd.action((options) => {\n const configOptions = extractConfigOptions(options) ?? {\n override: {\n log: {\n prefix: '',\n mode: 'verbose',\n },\n },\n };\n\n return login({\n cmsUrl: options.cmsUrl,\n configOptions,\n });\n });\n\n /**\n * INIT\n */\n const initCmd = program\n .command('init')\n .description('Initialize Intlayer in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .option('--no-gitignore', 'Do not add .intlayer to .gitignore')\n .action((options) =>\n init(options.projectRoot, {\n noGitignore: options.gitignore === false,\n })\n );\n\n initCmd\n .command('skills')\n .description('Initialize Intlayer skills in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action((options) => initSkills(options.projectRoot));\n\n initCmd\n .command('mcp')\n .description('Initialize Intlayer MCP server in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action((options) => initMCP(options.projectRoot));\n\n /**\n * DICTIONARIES\n */\n\n const dictionariesProgram = program\n .command('dictionary')\n .alias('dictionaries')\n .alias('dic')\n .description('Dictionaries operations');\n\n // Dictionary build command\n const buildOptions = {\n description: 'Build the dictionaries',\n options: [\n ['-w, --watch', 'Watch for changes'],\n ['--skip-prepare', 'Skip the prepare step'],\n ['--with [with...]', 'Start command in parallel with the build'],\n ['--check-types', 'Check TypeScript type and log errors'],\n ],\n };\n\n // Add build command to dictionaries program\n const dictionariesBuildCmd = dictionariesProgram\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(dictionariesBuildCmd, buildOptions.options);\n applyConfigOptions(dictionariesBuildCmd);\n dictionariesBuildCmd.action((options) => {\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootBuildCmd = program\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(rootBuildCmd, buildOptions.options);\n applyConfigOptions(rootBuildCmd);\n rootBuildCmd.action((options) => {\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const watchOptions = {\n description: 'Watch the dictionaries changes',\n options: [['--with [with...]', 'Start command in parallel with the build']],\n };\n\n // Add build command to dictionaries program\n const dictionariesWatchCmd = dictionariesProgram\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(dictionariesWatchCmd, watchOptions.options);\n applyConfigOptions(dictionariesWatchCmd);\n dictionariesWatchCmd.action((options) => {\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootWatchCmd = program\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(rootWatchCmd, watchOptions.options);\n applyConfigOptions(rootWatchCmd);\n rootWatchCmd.action((options) => {\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary pull command\n const pullOptions = {\n description: 'Pull dictionaries from the server',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to pull'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to pull (alias for --dictionaries)',\n ],\n ['--new-dictionaries-path [path]', 'Path to save the new dictionaries'],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--newDictionariesPath [path]',\n '[alias] Path to save the new dictionaries',\n ],\n ],\n };\n\n // Add pull command to dictionaries program\n const dictionariesPullCmd = dictionariesProgram\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(dictionariesPullCmd, pullOptions.options);\n applyConfigOptions(dictionariesPullCmd);\n dictionariesPullCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: {\n ...options.configOptions,\n baseDir: options.baseDir,\n },\n });\n });\n\n // Add pull command to root program as well\n const rootPullCmd = program\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(rootPullCmd, pullOptions.options);\n applyConfigOptions(rootPullCmd);\n rootPullCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary push command\n const pushOptions = {\n description:\n 'Push all dictionaries. Create or update the pushed dictionaries',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to push'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to push (alias for --dictionaries)',\n ],\n [\n '-r, --delete-locale-dictionary',\n 'Delete the local dictionaries after pushing',\n ],\n [\n '-k, --keep-locale-dictionary',\n 'Keep the local dictionaries after pushing',\n ],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--deleteLocaleDictionary',\n '[alias] Delete the local dictionaries after pushing',\n ],\n [\n '--keepLocaleDictionary',\n '[alias] Keep the local dictionaries after pushing',\n ],\n [\n '--build [build]',\n 'Build the dictionaries before pushing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build',\n ],\n ],\n };\n\n // Add push command to dictionaries program\n const dictionariesPushCmd = dictionariesProgram\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(dictionariesPushCmd, pushOptions.options);\n applyConfigOptions(dictionariesPushCmd);\n applyGitOptions(dictionariesPushCmd);\n\n dictionariesPushCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n // Add push command to root program as well\n const rootPushCmd = program\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(rootPushCmd, pushOptions.options);\n applyConfigOptions(rootPushCmd);\n applyGitOptions(rootPushCmd);\n\n rootPushCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * CONFIGURATION\n */\n\n // Define the parent command\n const configurationProgram = program\n .command('configuration')\n .alias('config')\n .alias('conf')\n .description('Configuration operations');\n\n const configGetCmd = configurationProgram\n .command('get')\n .description('Get the configuration');\n\n applyConfigOptions(configGetCmd);\n configGetCmd.action((options) => {\n getConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Define the `push config` subcommand and add it to the `push` command\n const configPushCmd = configurationProgram\n .command('push')\n .description('Push the configuration');\n\n applyConfigOptions(configPushCmd);\n configPushCmd.action((options) => {\n pushConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * PROJECTS\n */\n\n const projectsProgram = program\n .command('projects')\n .alias('project')\n .description('List Intlayer projects');\n\n const projectsListCmd = projectsProgram\n .command('list')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--json', 'Output the results as JSON');\n\n projectsListCmd.action((options) => {\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n });\n });\n\n // Add alias for projects list command at root level\n const rootProjectsListCmd = program\n .command('projects-list')\n .alias('pl')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--absolute', 'Output the results as absolute paths')\n .option('--json', 'Output the results as JSON');\n\n rootProjectsListCmd.action((options) => {\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n /**\n * CONTENT DECLARATION\n */\n\n const contentProgram = program\n .command('content')\n .description('Content declaration operations');\n\n contentProgram\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action((options) => {\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n // Add alias for content list command\n program\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action((options) => {\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n const testProgram = contentProgram\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n 'Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n );\n\n applyConfigOptions(testProgram);\n testProgram.action((options) => {\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add alias for content test command\n const rootTestCmd = program\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n 'Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n );\n\n applyConfigOptions(rootTestCmd);\n rootTestCmd.action((options) => {\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const fillProgram = program\n .command('fill')\n .description('Fill the dictionaries')\n .option('-f, --file [files...]', 'List of Dictionary files to fill')\n .option('--source-locale [sourceLocale]', 'Source locale to translate from')\n .option(\n '--output-locales [outputLocales...]',\n 'Target locales to translate to'\n )\n .option(\n '--mode [mode]',\n 'Fill mode: complete, review. Complete will fill all missing content, review will fill missing content and review existing keys',\n 'complete'\n )\n .option('-k, --keys [keys...]', 'Filter dictionaries based on keys')\n .option(\n '--key [keys...]',\n 'Filter dictionaries based on keys (alias for --keys)'\n )\n .option(\n '--excluded-keys [excludedKeys...]',\n 'Filter out dictionaries based on keys'\n )\n .option(\n '--excluded-key [excludedKeys...]',\n 'Filter out dictionaries based on keys (alias for --excluded-keys)'\n )\n .option(\n '--path-filter [pathFilters...]',\n 'Filter dictionaries based on glob pattern'\n )\n .option(\n '--build [build]',\n 'Build the dictionaries before filling to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n )\n .option(\n '--skip-metadata',\n 'Skip filling missing metadata (description, title, tags) for dictionaries'\n );\n\n applyConfigOptions(fillProgram);\n applyAIOptions(fillProgram);\n applyGitOptions(fillProgram);\n\n fillProgram.action((options) => {\n // Merge key aliases\n const keys = [...(options.keys ?? []), ...(options.key ?? [])];\n const excludedKeys = [\n ...(options.excludedKeys ?? []),\n ...(options.excludedKey ?? []),\n ];\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n return fill({\n ...options,\n keys: keys.length > 0 ? keys : undefined,\n excludedKeys: excludedKeys.length > 0 ? excludedKeys : undefined,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * DOCS\n */\n\n const docParams = [\n ['--doc-pattern [docPattern...]', 'Documentation pattern'],\n [\n '--excluded-glob-pattern [excludedGlobPattern...]',\n 'Excluded glob pattern',\n ],\n [\n '--nb-simultaneous-file-processed [nbSimultaneousFileProcessed]',\n 'Number of simultaneous file processed',\n ],\n ['--locales [locales...]', 'Locales'],\n ['--base-locale [baseLocale]', 'Base locale'],\n [\n '--custom-instructions [customInstructions]',\n 'Custom instructions added to the prompt. Usefull to apply specific rules regarding formatting, urls translation, etc.',\n ],\n [\n '--skip-if-modified-before [skipIfModifiedBefore]',\n 'Skip the file if it has been modified before the given time. Can be an absolute time as \"2025-12-05\" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.',\n ],\n [\n '--skip-if-modified-after [skipIfModifiedAfter]',\n 'Skip the file if it has been modified within the given time. Can be an absolute time as \"2025-12-05\" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.',\n ],\n ['--skip-if-exists', 'Skip the file if it already exists'],\n ];\n\n const docProgram = program\n .command('doc')\n .description('Documentation operations');\n\n const translateProgram = docProgram\n .command('translate')\n .description('Translate the documentation');\n\n applyConfigOptions(translateProgram);\n applyAIOptions(translateProgram);\n applyGitOptions(translateProgram);\n applyOptions(translateProgram, docParams);\n\n translateProgram.action((options) =>\n translateDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n })\n );\n\n const reviewProgram = docProgram\n .command('review')\n .description('Review the documentation');\n\n applyConfigOptions(reviewProgram);\n applyAIOptions(reviewProgram);\n applyGitOptions(reviewProgram);\n applyOptions(reviewProgram, docParams);\n\n reviewProgram.action((options) =>\n reviewDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n })\n );\n\n const searchProgram = docProgram\n .command('search')\n .description('Search the documentation')\n .argument('<query>', 'Search query')\n .option('--limit [limit]', 'Limit the number of results', '10');\n\n applyConfigOptions(searchProgram);\n\n searchProgram.action((query, options) =>\n searchDoc({\n query,\n limit: options.limit ? parseInt(options.limit, 10) : 10,\n configOptions: extractConfigOptions(options),\n })\n );\n\n /**\n * LIVE SYNC\n */\n\n const liveOptions = [\n ['--with [with...]', 'Start command in parallel with the live sync'],\n ];\n\n const liveCmd = program\n .command('live')\n .description(\n 'Live sync - Watch for changes made on the CMS and update the application content accordingly'\n );\n\n applyOptions(liveCmd, liveOptions);\n applyConfigOptions(liveCmd);\n\n liveCmd.action((options) => liveSync(options));\n\n /**\n * EDITOR\n */\n\n const editorProgram = program\n .command('editor')\n .description('Visual editor operations');\n\n const editorStartCmd = editorProgram\n .command('start')\n .description('Start the Intlayer visual editor');\n\n applyConfigOptions(editorStartCmd);\n\n editorStartCmd.action((options) => {\n startEditor({\n env: options.env,\n envFile: options.envFile,\n });\n });\n\n /**\n * EXTRACT\n */\n const extractProgram = program\n .command('extract')\n .alias('ext')\n .description(\n 'Extract strings from components to be placed in a .content file close to the component'\n );\n\n extractProgram\n .option('-f, --file [files...]', 'List of files to extract')\n .option('--code-only', 'Only extract the component code', false)\n .option('--declaration-only', 'Only generate content declaration', false)\n .action((options) => {\n extract({\n files: options.file,\n configOptions: extractConfigOptions(options),\n codeOnly: options.codeOnly,\n declarationOnly: options.declarationOnly,\n });\n });\n\n /**\n * STANDALONE\n */\n const bundleCmd = program\n .command('standalone')\n .description('Create a standalone bundle of the application content')\n .option(\n '-o, --outfile [outfile]',\n 'Output file for the bundle',\n 'intlayer-bundle.js'\n )\n .option('--packages [packages...]', 'List of packages to bundle')\n .option('--version [version]', 'Version of the packages to bundle')\n .option('--minify', 'Minify the output')\n .option('--platform [platform]', 'Target platform', 'browser')\n .option('--format [format]', 'Output format', 'esm')\n .action((options) => {\n bundle({\n outfile: options.outfile,\n bundlePackages: options.packages,\n version: options.version,\n minify: options.minify,\n platform: options.platform,\n format: options.format,\n configOptions: extractConfigOptions(options),\n });\n });\n\n applyConfigOptions(bundleCmd);\n\n program.parse(process.argv);\n\n /**\n * CI / AUTOMATION\n *\n * Used to iterate over all projects in a monorepo, and help to parse secrets\n */\n program\n .command('ci')\n .description(\n 'Run Intlayer commands with auto-injected credentials from INTLAYER_PROJECT_CREDENTIALS. Detects current project or iterates over all projects.'\n )\n .argument(\n '<command...>',\n 'The intlayer command to execute (e.g., \"fill\", \"push\")'\n )\n .allowUnknownOption() // Allows passing flags like --verbose to the subcommand\n .action((args) => {\n runCI(args);\n });\n\n return program;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,aAAa,OAAO,OAAO,KAAK,QAAQ;AAE9C,MAAa,UAAU,aACnBA,UAAY,cAAc,OAAO,KAAK,IAAI,CAAC,GAC3C;AAEJ,MAAM,cAAc,qBAAqB,QAAQ;AAOjD,MAAM,uBAAuB;CAC3B,CAAC,wBAAwB,mBAAmB;CAC5C,CAAC,mBAAmB,cAAc;CAClC,CAAC,wBAAwB,iBAAiB;CAC1C,CAAC,wBAAwB,WAAW;CACpC,GAAG,CATH,CAAC,aAAa,sCAAsC,EACpD,CAAC,qBAAqB,SAAS,CAQlB;CACd;AAED,MAAM,YAAY;CAChB,CAAC,yBAAyB,WAAW;CACrC,CAAC,+BAA+B,cAAc;CAC9C,CAAC,mBAAmB,QAAQ;CAC5B,CAAC,sBAAsB,mBAAmB;CAC1C,CAAC,4BAA4B,gBAAgB;CAC7C,CAAC,8CAA8C,sBAAsB;CACrE,CAAC,4CAA4C,qBAAqB;CACnE;AAED,MAAM,aAAa;CACjB,CAAC,wBAAwB,kDAAkD;CAC3E,CAAC,iCAAiC,oBAAoB;CACtD,CAAC,uCAAuC,uBAAuB;CAC/D,CAAC,+BAA+B,cAAc;CAC9C,CAAC,yBAAyB,WAAW;CACrC,CAAC,2BAA2B,YAAY;CACzC;AAED,MAAM,0BAA0B,SAAiB,SAC/C,KAAK,QAAQ,QAAQ,QAAQ,SAAiC,OAAU;;;;AAK1E,MAAM,gBAAgB,SAAkB,YAAwB;CAC9D,QAAQ,SAAS,CAAC,MAAM,iBAAiB;EACvC,QAAQ,OAAO,MAAM,YAAY;GACjC;CACF,OAAO;;AAGT,MAAM,mBAAkD,QACtD,OAAO,YACL,OAAO,QAAQ,IAAI,CAAC,QAAQ,CAAC,GAAG,WAAW,UAAU,OAAU,CAChE;AAEH,MAAM,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B,QAAQ,MAAM,QAAQ,KAAK;;;;;;CAO3B,QACG,QAAQ,KAAK,CACb,YACC,iJACD,CACA,SACC,gBACA,6DACD,CACA,oBAAoB,CACpB,QAAQ,SAAS;EAChB,MAAM,KAAK;GACX;CAEJ,OAAO"}
1
+ {"version":3,"file":"cli.mjs","names":["pathDirname"],"sources":["../../src/cli.ts"],"sourcesContent":["import { dirname as pathDirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { AIOptions as BaseAIOptions } from '@intlayer/api';\nimport type { DiffMode, ListGitFilesOptions } from '@intlayer/chokidar/cli';\nimport { setPrefix } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { CustomIntlayerConfig } from '@intlayer/types/config';\nimport { Command } from 'commander';\nimport { login } from './auth/login';\nimport { build } from './build';\nimport { bundle } from './bundle';\nimport { runCI } from './ci';\nimport { getConfig } from './config';\nimport { startEditor } from './editor';\nimport { extract } from './extract';\nimport { type FillOptions, fill } from './fill/fill';\nimport { init } from './init';\nimport { initMCP } from './initMCP';\nimport { initSkills } from './initSkills';\nimport { listContentDeclaration } from './listContentDeclaration';\nimport { listProjectsCommand } from './listProjects';\nimport { liveSync } from './liveSync';\nimport { pull } from './pull';\nimport { push } from './push/push';\nimport { pushConfig } from './pushConfig';\nimport { reviewDoc } from './reviewDoc/reviewDoc';\nimport { searchDoc } from './searchDoc';\nimport { testMissingTranslations } from './test';\nimport { translateDoc } from './translateDoc/translateDoc';\nimport { getParentPackageJSON } from './utils/getParentPackageJSON';\nimport { watchContentDeclaration } from './watch';\n\n// Extended AI options to include customPrompt\ntype AIOptions = BaseAIOptions & {\n customPrompt?: string;\n};\n\nconst isESModule = typeof import.meta.url === 'string';\n\nexport const dirname = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nconst packageJson = getParentPackageJSON(dirname);\n\nconst logOptions = [\n ['--verbose', 'Verbose (default to true using CLI)'],\n ['--prefix [prefix]', 'Prefix'],\n];\n\nconst configurationOptions = [\n ['--env-file [envFile]', 'Environment file'],\n ['-e, --env [env]', 'Environment'],\n ['--base-dir [baseDir]', 'Base directory'],\n ['--no-cache [noCache]', 'No cache'],\n ...logOptions,\n];\n\nconst aiOptions = [\n ['--provider [provider]', 'Provider'],\n ['--temperature [temperature]', 'Temperature'],\n ['--model [model]', 'Model'],\n ['--api-key [apiKey]', 'Provider API key'],\n ['--custom-prompt [prompt]', 'Custom prompt'],\n ['--application-context [applicationContext]', 'Application context'],\n ['--data-serialization [dataSerialization]', 'Data serialization'],\n];\n\nconst gitOptions = [\n ['--git-diff [gitDiff]', 'Git diff mode - Check git diff between two refs'],\n ['--git-diff-base [gitDiffBase]', 'Git diff base ref'],\n ['--git-diff-current [gitDiffCurrent]', 'Git diff current ref'],\n ['--uncommitted [uncommitted]', 'Uncommitted'],\n ['--unpushed [unpushed]', 'Unpushed'],\n ['--untracked [untracked]', 'Untracked'],\n];\n\nconst extractKeysFromOptions = (options: object, keys: string[]) =>\n keys.filter((key) => options[key as keyof typeof options] !== undefined);\n\n/**\n * Helper functions to apply common options to commands\n */\nconst applyOptions = (command: Command, options: string[][]) => {\n options.forEach(([flag, description]) => {\n command.option(flag, description);\n });\n return command;\n};\n\nconst removeUndefined = <T extends Record<string, any>>(obj: T): T =>\n Object.fromEntries(\n Object.entries(obj).filter(([_, value]) => value !== undefined)\n ) as T;\n\nconst applyConfigOptions = (command: Command) =>\n applyOptions(command, configurationOptions);\nconst applyAIOptions = (command: Command) => applyOptions(command, aiOptions);\nconst applyGitOptions = (command: Command) => applyOptions(command, gitOptions);\n\nconst extractAiOptions = (options: AIOptions): AIOptions | undefined => {\n const {\n apiKey,\n provider,\n model,\n temperature,\n applicationContext,\n customPrompt,\n dataSerialization,\n } = options;\n\n const configuration = getConfiguration();\n\n const { ai } = configuration;\n\n return removeUndefined({\n ...ai,\n apiKey: apiKey ?? configuration.ai?.apiKey,\n provider: provider ?? (configuration.ai?.provider as AIOptions['provider']),\n model: model ?? configuration.ai?.model,\n temperature: temperature ?? configuration.ai?.temperature,\n applicationContext:\n applicationContext ?? configuration.ai?.applicationContext,\n customPrompt: customPrompt ?? (configuration.ai as any)?.customPrompt,\n dataSerialization: dataSerialization ?? configuration.ai?.dataSerialization,\n });\n};\n\ntype GitOptions = {\n gitDiff?: boolean;\n gitDiffBase?: string;\n gitDiffCurrent?: string;\n uncommitted?: boolean;\n unpushed?: boolean;\n untracked?: boolean;\n};\n\nconst gitOptionKeys: (keyof GitOptions)[] = [\n 'gitDiff',\n 'gitDiffBase',\n 'gitDiffCurrent',\n 'uncommitted',\n 'unpushed',\n 'untracked',\n];\n\nconst extractGitOptions = (\n options: GitOptions\n): ListGitFilesOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(options, gitOptionKeys);\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) return undefined;\n\n const {\n gitDiff,\n gitDiffBase,\n gitDiffCurrent,\n uncommitted,\n unpushed,\n untracked,\n } = options;\n\n const mode = [\n gitDiff && 'gitDiff',\n uncommitted && 'uncommitted',\n unpushed && 'unpushed',\n untracked && 'untracked',\n ].filter(Boolean) as DiffMode[];\n\n return removeUndefined({\n mode,\n baseRef: gitDiffBase,\n currentRef: gitDiffCurrent,\n absolute: true,\n });\n};\n\ntype LogOptions = {\n prefix?: string;\n verbose?: boolean;\n};\n\nexport type ConfigurationOptions = {\n baseDir?: string;\n env?: string;\n envFile?: string;\n noCache?: boolean;\n checkTypes?: boolean;\n} & LogOptions;\n\nconst configurationOptionKeys: (keyof ConfigurationOptions)[] = [\n 'baseDir',\n 'env',\n 'envFile',\n 'verbose',\n 'prefix',\n 'checkTypes',\n];\n\nconst extractConfigOptions = (\n options: ConfigurationOptions & { with?: string }\n): GetConfigurationOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(\n options,\n configurationOptionKeys\n );\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) {\n return undefined;\n }\n\n const { baseDir, env, envFile, verbose, noCache, checkTypes } = options;\n\n const log = removeUndefined({\n mode:\n typeof verbose !== 'undefined'\n ? verbose\n ? 'verbose'\n : 'default'\n : undefined,\n });\n\n const build = removeUndefined({\n checkTypes,\n });\n\n const override: CustomIntlayerConfig = removeUndefined({\n log:\n Object.keys(log).length > 0\n ? (log as CustomIntlayerConfig['log'])\n : undefined,\n build: Object.keys(build).length > 0 ? build : undefined,\n });\n\n return removeUndefined({\n baseDir,\n env,\n envFile,\n override: Object.keys(override).length > 0 ? override : undefined,\n cache: typeof noCache !== 'undefined' ? !noCache : undefined,\n });\n};\n\n/**\n * Set the API for the CLI\n *\n * Example of commands:\n *\n * npm run intlayer build --watch\n * npm run intlayer push --dictionaries id1 id2 id3 --deleteLocaleDir\n */\nexport const setAPI = (): Command => {\n const isWithCommand = process.argv.includes('--with');\n\n if (!isWithCommand) {\n setPrefix('');\n }\n\n const program = new Command();\n\n program.version(packageJson.version!).description('Intlayer CLI');\n\n // Explicit version subcommand for convenience: `npx intlayer version`\n program\n .command('version')\n .description('Print the Intlayer CLI version')\n .action(() => {\n // Prefer the resolved package.json version; fallback to unknown\n // Keeping output minimal to align with common CLI behavior\n console.log(packageJson.version ?? 'unknown');\n });\n\n /**\n * AUTH\n */\n const loginCmd = program\n .command('login')\n .description('Login to Intlayer')\n .option('--cms-url [cmsUrl]', 'CMS URL');\n\n applyConfigOptions(loginCmd);\n\n loginCmd.action((options) => {\n const configOptions = extractConfigOptions(options) ?? {\n override: {\n log: {\n prefix: '',\n mode: 'verbose',\n },\n },\n };\n\n return login({\n cmsUrl: options.cmsUrl,\n configOptions,\n });\n });\n\n /**\n * INIT\n */\n const initCmd = program\n .command('init')\n .description('Initialize Intlayer in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .option('--no-gitignore', 'Do not add .intlayer to .gitignore')\n .action((options) =>\n init(options.projectRoot, {\n noGitignore: options.gitignore === false,\n })\n );\n\n initCmd\n .command('skills')\n .description('Initialize Intlayer skills in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action((options) => initSkills(options.projectRoot));\n\n initCmd\n .command('mcp')\n .description('Initialize Intlayer MCP server in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action((options) => initMCP(options.projectRoot));\n\n /**\n * DICTIONARIES\n */\n\n const dictionariesProgram = program\n .command('dictionary')\n .alias('dictionaries')\n .alias('dic')\n .description('Dictionaries operations');\n\n // Dictionary build command\n const buildOptions = {\n description: 'Build the dictionaries',\n options: [\n ['-w, --watch', 'Watch for changes'],\n ['--skip-prepare', 'Skip the prepare step'],\n ['--with [with...]', 'Start command in parallel with the build'],\n ['--check-types', 'Check TypeScript type and log errors'],\n ],\n };\n\n // Add build command to dictionaries program\n const dictionariesBuildCmd = dictionariesProgram\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(dictionariesBuildCmd, buildOptions.options);\n applyConfigOptions(dictionariesBuildCmd);\n dictionariesBuildCmd.action((options) => {\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootBuildCmd = program\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(rootBuildCmd, buildOptions.options);\n applyConfigOptions(rootBuildCmd);\n rootBuildCmd.action((options) => {\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const watchOptions = {\n description: 'Watch the dictionaries changes',\n options: [['--with [with...]', 'Start command in parallel with the build']],\n };\n\n // Add build command to dictionaries program\n const dictionariesWatchCmd = dictionariesProgram\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(dictionariesWatchCmd, watchOptions.options);\n applyConfigOptions(dictionariesWatchCmd);\n dictionariesWatchCmd.action((options) => {\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootWatchCmd = program\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(rootWatchCmd, watchOptions.options);\n applyConfigOptions(rootWatchCmd);\n rootWatchCmd.action((options) => {\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary pull command\n const pullOptions = {\n description: 'Pull dictionaries from the server',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to pull'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to pull (alias for --dictionaries)',\n ],\n ['--new-dictionaries-path [path]', 'Path to save the new dictionaries'],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--newDictionariesPath [path]',\n '[alias] Path to save the new dictionaries',\n ],\n ],\n };\n\n // Add pull command to dictionaries program\n const dictionariesPullCmd = dictionariesProgram\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(dictionariesPullCmd, pullOptions.options);\n applyConfigOptions(dictionariesPullCmd);\n dictionariesPullCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: {\n ...options.configOptions,\n baseDir: options.baseDir,\n },\n });\n });\n\n // Add pull command to root program as well\n const rootPullCmd = program\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(rootPullCmd, pullOptions.options);\n applyConfigOptions(rootPullCmd);\n rootPullCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary push command\n const pushOptions = {\n description:\n 'Push all dictionaries. Create or update the pushed dictionaries',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to push'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to push (alias for --dictionaries)',\n ],\n [\n '-r, --delete-locale-dictionary',\n 'Delete the local dictionaries after pushing',\n ],\n [\n '-k, --keep-locale-dictionary',\n 'Keep the local dictionaries after pushing',\n ],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--deleteLocaleDictionary',\n '[alias] Delete the local dictionaries after pushing',\n ],\n [\n '--keepLocaleDictionary',\n '[alias] Keep the local dictionaries after pushing',\n ],\n [\n '--build [build]',\n 'Build the dictionaries before pushing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build',\n ],\n ],\n };\n\n // Add push command to dictionaries program\n const dictionariesPushCmd = dictionariesProgram\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(dictionariesPushCmd, pushOptions.options);\n applyConfigOptions(dictionariesPushCmd);\n applyGitOptions(dictionariesPushCmd);\n\n dictionariesPushCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n // Add push command to root program as well\n const rootPushCmd = program\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(rootPushCmd, pushOptions.options);\n applyConfigOptions(rootPushCmd);\n applyGitOptions(rootPushCmd);\n\n rootPushCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * CONFIGURATION\n */\n\n // Define the parent command\n const configurationProgram = program\n .command('configuration')\n .alias('config')\n .alias('conf')\n .description('Configuration operations');\n\n const configGetCmd = configurationProgram\n .command('get')\n .description('Get the configuration');\n\n applyConfigOptions(configGetCmd);\n configGetCmd.action((options) => {\n getConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Define the `push config` subcommand and add it to the `push` command\n const configPushCmd = configurationProgram\n .command('push')\n .description('Push the configuration');\n\n applyConfigOptions(configPushCmd);\n configPushCmd.action((options) => {\n pushConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * PROJECTS\n */\n\n const projectsProgram = program\n .command('projects')\n .alias('project')\n .description('List Intlayer projects');\n\n const projectsListCmd = projectsProgram\n .command('list')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--json', 'Output the results as JSON');\n\n projectsListCmd.action((options) => {\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n });\n });\n\n // Add alias for projects list command at root level\n const rootProjectsListCmd = program\n .command('projects-list')\n .alias('pl')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--absolute', 'Output the results as absolute paths')\n .option('--json', 'Output the results as JSON');\n\n rootProjectsListCmd.action((options) => {\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n /**\n * CONTENT DECLARATION\n */\n\n const contentProgram = program\n .command('content')\n .description('Content declaration operations');\n\n contentProgram\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action((options) => {\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n // Add alias for content list command\n program\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action((options) => {\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n const testProgram = contentProgram\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n 'Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n );\n\n applyConfigOptions(testProgram);\n testProgram.action((options) => {\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add alias for content test command\n const rootTestCmd = program\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n 'Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n );\n\n applyConfigOptions(rootTestCmd);\n rootTestCmd.action((options) => {\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const fillProgram = program\n .command('fill')\n .description('Fill the dictionaries')\n .option('-f, --file [files...]', 'List of Dictionary files to fill')\n .option('--source-locale [sourceLocale]', 'Source locale to translate from')\n .option(\n '--output-locales [outputLocales...]',\n 'Target locales to translate to'\n )\n .option(\n '--mode [mode]',\n 'Fill mode: complete, review. Complete will fill all missing content, review will fill missing content and review existing keys',\n 'complete'\n )\n .option('-k, --keys [keys...]', 'Filter dictionaries based on keys')\n .option(\n '--key [keys...]',\n 'Filter dictionaries based on keys (alias for --keys)'\n )\n .option(\n '--excluded-keys [excludedKeys...]',\n 'Filter out dictionaries based on keys'\n )\n .option(\n '--excluded-key [excludedKeys...]',\n 'Filter out dictionaries based on keys (alias for --excluded-keys)'\n )\n .option(\n '--path-filter [pathFilters...]',\n 'Filter dictionaries based on glob pattern'\n )\n .option(\n '--build [build]',\n 'Build the dictionaries before filling to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n )\n .option(\n '--skip-metadata',\n 'Skip filling missing metadata (description, title, tags) for dictionaries'\n );\n\n applyConfigOptions(fillProgram);\n applyAIOptions(fillProgram);\n applyGitOptions(fillProgram);\n\n fillProgram.action((options) => {\n // Merge key aliases\n const keys = [...(options.keys ?? []), ...(options.key ?? [])];\n const excludedKeys = [\n ...(options.excludedKeys ?? []),\n ...(options.excludedKey ?? []),\n ];\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n return fill({\n ...options,\n keys: keys.length > 0 ? keys : undefined,\n excludedKeys: excludedKeys.length > 0 ? excludedKeys : undefined,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * DOCS\n */\n\n const docParams = [\n ['--doc-pattern [docPattern...]', 'Documentation pattern'],\n [\n '--excluded-glob-pattern [excludedGlobPattern...]',\n 'Excluded glob pattern',\n ],\n [\n '--nb-simultaneous-file-processed [nbSimultaneousFileProcessed]',\n 'Number of simultaneous file processed',\n ],\n ['--locales [locales...]', 'Locales'],\n ['--base-locale [baseLocale]', 'Base locale'],\n [\n '--custom-instructions [customInstructions]',\n 'Custom instructions added to the prompt. Usefull to apply specific rules regarding formatting, urls translation, etc.',\n ],\n [\n '--skip-if-modified-before [skipIfModifiedBefore]',\n 'Skip the file if it has been modified before the given time. Can be an absolute time as \"2025-12-05\" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.',\n ],\n [\n '--skip-if-modified-after [skipIfModifiedAfter]',\n 'Skip the file if it has been modified within the given time. Can be an absolute time as \"2025-12-05\" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.',\n ],\n ['--skip-if-exists', 'Skip the file if it already exists'],\n ];\n\n const docProgram = program\n .command('doc')\n .description('Documentation operations');\n\n const translateProgram = docProgram\n .command('translate')\n .description('Translate the documentation');\n\n applyConfigOptions(translateProgram);\n applyAIOptions(translateProgram);\n applyGitOptions(translateProgram);\n applyOptions(translateProgram, docParams);\n\n translateProgram.action((options) =>\n translateDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n })\n );\n\n const reviewProgram = docProgram\n .command('review')\n .description('Review the documentation');\n\n applyConfigOptions(reviewProgram);\n applyAIOptions(reviewProgram);\n applyGitOptions(reviewProgram);\n applyOptions(reviewProgram, docParams);\n\n reviewProgram.action((options) =>\n reviewDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n })\n );\n\n const searchProgram = docProgram\n .command('search')\n .description('Search the documentation')\n .argument('<query>', 'Search query')\n .option('--limit [limit]', 'Limit the number of results', '10');\n\n applyConfigOptions(searchProgram);\n\n searchProgram.action((query, options) =>\n searchDoc({\n query,\n limit: options.limit ? parseInt(options.limit, 10) : 10,\n configOptions: extractConfigOptions(options),\n })\n );\n\n /**\n * LIVE SYNC\n */\n\n const liveOptions = [\n ['--with [with...]', 'Start command in parallel with the live sync'],\n ];\n\n const liveCmd = program\n .command('live')\n .description(\n 'Live sync - Watch for changes made on the CMS and update the application content accordingly'\n );\n\n applyOptions(liveCmd, liveOptions);\n applyConfigOptions(liveCmd);\n\n liveCmd.action((options) => liveSync(options));\n\n /**\n * EDITOR\n */\n\n const editorProgram = program\n .command('editor')\n .description('Visual editor operations');\n\n const editorStartCmd = editorProgram\n .command('start')\n .description('Start the Intlayer visual editor');\n\n applyConfigOptions(editorStartCmd);\n\n editorStartCmd.action((options) => {\n startEditor({\n env: options.env,\n envFile: options.envFile,\n });\n });\n\n /**\n * EXTRACT\n */\n const extractProgram = program\n .command('extract')\n .alias('ext')\n .description(\n 'Extract strings from components to be placed in a .content file close to the component'\n );\n\n extractProgram\n .option('-f, --file [files...]', 'List of files to extract')\n .option('--code-only', 'Only extract the component code', false)\n .option('--declaration-only', 'Only generate content declaration', false)\n .action((options) => {\n extract({\n files: options.file,\n configOptions: extractConfigOptions(options),\n codeOnly: options.codeOnly,\n declarationOnly: options.declarationOnly,\n });\n });\n\n /**\n * STANDALONE\n */\n const bundleCmd = program\n .command('standalone')\n .description('Create a standalone bundle of the application content')\n .option(\n '-o, --outfile [outfile]',\n 'Output file for the bundle',\n 'intlayer-bundle.js'\n )\n .option('--packages [packages...]', 'List of packages to bundle')\n .option('--version [version]', 'Version of the packages to bundle')\n .option('--minify', 'Minify the output')\n .option('--platform [platform]', 'Target platform', 'browser')\n .option('--format [format]', 'Output format', 'esm')\n .action((options) => {\n bundle({\n outfile: options.outfile,\n bundlePackages: options.packages,\n version: options.version,\n minify: options.minify,\n platform: options.platform,\n format: options.format,\n configOptions: extractConfigOptions(options),\n });\n });\n\n applyConfigOptions(bundleCmd);\n\n program.parse(process.argv);\n\n /**\n * CI / AUTOMATION\n *\n * Used to iterate over all projects in a monorepo, and help to parse secrets\n */\n program\n .command('ci')\n .description(\n 'Run Intlayer commands with auto-injected credentials from INTLAYER_PROJECT_CREDENTIALS. Detects current project or iterates over all projects.'\n )\n .argument(\n '<command...>',\n 'The intlayer command to execute (e.g., \"fill\", \"push\")'\n )\n .allowUnknownOption() // Allows passing flags like --verbose to the subcommand\n .action((args) => {\n runCI(args);\n });\n\n return program;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,aAAa,OAAO,OAAO,KAAK,QAAQ;AAE9C,MAAa,UAAU,aACnBA,UAAY,cAAc,OAAO,KAAK,GAAG,CAAC,IAC1C;AAEJ,MAAM,cAAc,qBAAqB,OAAO;AAOhD,MAAM,uBAAuB;CAC3B,CAAC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@
1
1
  import { logConfigDetails } from "@intlayer/chokidar/cli";
2
- import { getAppLogger } from "@intlayer/config/logger";
2
+ import { colorizeObject, getAppLogger } from "@intlayer/config/logger";
3
3
  import { getConfiguration } from "@intlayer/config/node";
4
4
 
5
5
  //#region src/config.ts
6
6
  const getConfig = (options) => {
7
7
  const config = getConfiguration(options?.configOptions);
8
8
  logConfigDetails(options?.configOptions);
9
- getAppLogger(config)(JSON.stringify(config, null, 2));
9
+ getAppLogger(config)(colorizeObject(config));
10
10
  };
11
11
 
12
12
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","names":[],"sources":["../../src/config.ts"],"sourcesContent":["import { logConfigDetails } from '@intlayer/chokidar/cli';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\n\ntype ConfigOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const getConfig = (options?: ConfigOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n appLogger(JSON.stringify(config, null, 2));\n};\n"],"mappings":";;;;;AAWA,MAAa,aAAa,YAA4B;CACpD,MAAM,SAAS,iBAAiB,SAAS,cAAc;CACvD,iBAAiB,SAAS,cAAc;CAIxC,AAFkB,aAAa,OAEtB,CAAC,KAAK,UAAU,QAAQ,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"config.mjs","names":[],"sources":["../../src/config.ts"],"sourcesContent":["import { logConfigDetails } from '@intlayer/chokidar/cli';\nimport { colorizeObject, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\n\ntype ConfigOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const getConfig = (options?: ConfigOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n appLogger(colorizeObject(config));\n};\n"],"mappings":";;;;;AAWA,MAAa,aAAa,YAA4B;CACpD,MAAM,SAAS,iBAAiB,SAAS,aAAa;CACtD,iBAAiB,SAAS,aAAa;CAIvC,AAFkB,aAAa,MAEvB,EAAE,eAAe,MAAM,CAAC;AAClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"editor.mjs","names":["pathResolve","pathDirname"],"sources":["../../src/editor.ts"],"sourcesContent":["import { spawn } from 'node:child_process';\nimport { createRequire } from 'node:module';\nimport { dirname as pathDirname, resolve as pathResolve } from 'node:path';\nimport { isESModule } from '@intlayer/config/utils';\n\ntype StartEditorOptions = {\n env?: string;\n envFile?: string;\n};\n\nexport const startEditor = (options: StartEditorOptions): void => {\n const args: string[] = ['start'];\n\n if (options.env) args.push('--env', options.env);\n if (options.envFile) args.push('--env-file', options.envFile);\n\n const spawnNodeProcess = (binPath: string) =>\n spawn(process.execPath, [binPath, ...args], {\n stdio: 'inherit',\n env: { ...process.env },\n });\n\n const spawnWith = (cmd: string, cmdArgs: string[]) =>\n spawn(cmd, cmdArgs, {\n stdio: 'inherit',\n env: { ...process.env },\n });\n\n try {\n const requireFunction = isESModule\n ? createRequire(import.meta.url)\n : require;\n const pkgJsonPath = requireFunction.resolve('intlayer-editor/package.json');\n const pkgDir = pathDirname(pkgJsonPath);\n const binPath = pathResolve(pkgDir, 'bin', 'intlayer-editor.mjs');\n\n const child = spawnNodeProcess(binPath);\n child.on('error', () => runFallback());\n child.on('exit', (code) => {\n if (code === 255) process.exit(code ?? 0);\n });\n } catch {\n runFallback();\n }\n\n function runFallback() {\n const bun = spawnWith('bun', ['dlx', 'intlayer-editor', ...args]);\n bun.on('error', () => {\n const npx = spawnWith('npx', ['-y', 'intlayer-editor', ...args]);\n npx.on('error', (err) => {\n console.error('Unable to execute intlayer-editor via bun or npx.');\n console.error(String(err?.message ?? err));\n process.exit(1);\n });\n });\n }\n};\n"],"mappings":";;;;;;;AAUA,MAAa,eAAe,YAAsC;CAChE,MAAM,OAAiB,CAAC,QAAQ;CAEhC,IAAI,QAAQ,KAAK,KAAK,KAAK,SAAS,QAAQ,IAAI;CAChD,IAAI,QAAQ,SAAS,KAAK,KAAK,cAAc,QAAQ,QAAQ;CAE7D,MAAM,oBAAoB,YACxB,MAAM,QAAQ,UAAU,CAAC,SAAS,GAAG,KAAK,EAAE;EAC1C,OAAO;EACP,KAAK,EAAE,GAAG,QAAQ,KAAK;EACxB,CAAC;CAEJ,MAAM,aAAa,KAAa,YAC9B,MAAM,KAAK,SAAS;EAClB,OAAO;EACP,KAAK,EAAE,GAAG,QAAQ,KAAK;EACxB,CAAC;CAEJ,IAAI;EAQF,MAAM,QAAQ,iBAFEA,QADDC,SAJS,aACpB,cAAc,OAAO,KAAK,IAAI,cAEE,QAAQ,+BACN,CACJ,EAAE,OAAO,sBAEL,CAAC;EACvC,MAAM,GAAG,eAAe,aAAa,CAAC;EACtC,MAAM,GAAG,SAAS,SAAS;GACzB,IAAI,SAAS,KAAK,QAAQ,KAAK,QAAQ,EAAE;IACzC;SACI;EACN,aAAa;;CAGf,SAAS,cAAc;EAErB,AADY,UAAU,OAAO;GAAC;GAAO;GAAmB,GAAG;GAAK,CAC7D,CAAC,GAAG,eAAe;GAEpB,AADY,UAAU,OAAO;IAAC;IAAM;IAAmB,GAAG;IAAK,CAC5D,CAAC,GAAG,UAAU,QAAQ;IACvB,QAAQ,MAAM,oDAAoD;IAClE,QAAQ,MAAM,OAAO,KAAK,WAAW,IAAI,CAAC;IAC1C,QAAQ,KAAK,EAAE;KACf;IACF"}
1
+ {"version":3,"file":"editor.mjs","names":["pathResolve","pathDirname"],"sources":["../../src/editor.ts"],"sourcesContent":["import { spawn } from 'node:child_process';\nimport { createRequire } from 'node:module';\nimport { dirname as pathDirname, resolve as pathResolve } from 'node:path';\nimport { isESModule } from '@intlayer/config/utils';\n\ntype StartEditorOptions = {\n env?: string;\n envFile?: string;\n};\n\nexport const startEditor = (options: StartEditorOptions): void => {\n const args: string[] = ['start'];\n\n if (options.env) args.push('--env', options.env);\n if (options.envFile) args.push('--env-file', options.envFile);\n\n const spawnNodeProcess = (binPath: string) =>\n spawn(process.execPath, [binPath, ...args], {\n stdio: 'inherit',\n env: { ...process.env },\n });\n\n const spawnWith = (cmd: string, cmdArgs: string[]) =>\n spawn(cmd, cmdArgs, {\n stdio: 'inherit',\n env: { ...process.env },\n });\n\n try {\n const requireFunction = isESModule\n ? createRequire(import.meta.url)\n : require;\n const pkgJsonPath = requireFunction.resolve('intlayer-editor/package.json');\n const pkgDir = pathDirname(pkgJsonPath);\n const binPath = pathResolve(pkgDir, 'bin', 'intlayer-editor.mjs');\n\n const child = spawnNodeProcess(binPath);\n child.on('error', () => runFallback());\n child.on('exit', (code) => {\n if (code === 255) process.exit(code ?? 0);\n });\n } catch {\n runFallback();\n }\n\n function runFallback() {\n const bun = spawnWith('bun', ['dlx', 'intlayer-editor', ...args]);\n bun.on('error', () => {\n const npx = spawnWith('npx', ['-y', 'intlayer-editor', ...args]);\n npx.on('error', (err) => {\n console.error('Unable to execute intlayer-editor via bun or npx.');\n console.error(String(err?.message ?? err));\n process.exit(1);\n });\n });\n }\n};\n"],"mappings":";;;;;;;AAUA,MAAa,eAAe,YAAsC;CAChE,MAAM,OAAiB,CAAC,OAAO;CAE/B,IAAI,QAAQ,KAAK,KAAK,KAAK,SAAS,QAAQ,GAAG;CAC/C,IAAI,QAAQ,SAAS,KAAK,KAAK,cAAc,QAAQ,OAAO;CAE5D,MAAM,oBAAoB,YACxB,MAAM,QAAQ,UAAU,CAAC,SAAS,GAAG,IAAI,GAAG;EAC1C,OAAO;EACP,KAAK,EAAE,GAAG,QAAQ,IAAI;CACxB,CAAC;CAEH,MAAM,aAAa,KAAa,YAC9B,MAAM,KAAK,SAAS;EAClB,OAAO;EACP,KAAK,EAAE,GAAG,QAAQ,IAAI;CACxB,CAAC;CAEH,IAAI;EAQF,MAAM,QAAQ,iBAFEA,QADDC,SAJS,aACpB,cAAc,OAAO,KAAK,GAAG,eAEG,QAAQ,8BACP,CACJ,GAAG,OAAO,qBAEN,CAAC;EACtC,MAAM,GAAG,eAAe,YAAY,CAAC;EACrC,MAAM,GAAG,SAAS,SAAS;GACzB,IAAI,SAAS,KAAK,QAAQ,KAAK,QAAQ,CAAC;EAC1C,CAAC;CACH,QAAQ;EACN,YAAY;CACd;CAEA,SAAS,cAAc;EAErB,AADY,UAAU,OAAO;GAAC;GAAO;GAAmB,GAAG;EAAI,CAC7D,EAAE,GAAG,eAAe;GAEpB,AADY,UAAU,OAAO;IAAC;IAAM;IAAmB,GAAG;GAAI,CAC5D,EAAE,GAAG,UAAU,QAAQ;IACvB,QAAQ,MAAM,mDAAmD;IACjE,QAAQ,MAAM,OAAO,KAAK,WAAW,GAAG,CAAC;IACzC,QAAQ,KAAK,CAAC;GAChB,CAAC;EACH,CAAC;CACH;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"extract.mjs","names":[],"sources":["../../src/extract.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { relative, resolve } from 'node:path';\nimport type { PackageName } from '@intlayer/babel';\nimport { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { logConfigDetails } from '@intlayer/chokidar/cli';\nimport { buildComponentFilesList, formatPath } from '@intlayer/chokidar/utils';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger, x } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { FilePathPattern } from '@intlayer/types/filePathPattern';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport enquirer from 'enquirer';\n\ntype ExtractOptions = {\n files?: string[];\n output?: FilePathPattern;\n configOptions?: GetConfigurationOptions;\n codeOnly?: boolean;\n declarationOnly?: boolean;\n};\n\nexport const extract = async (options: ExtractOptions) => {\n const configuration = getConfiguration(options.configOptions);\n\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(configuration);\n\n const { baseDir } = configuration.system;\n const { output } = configuration.compiler;\n\n if (!output) {\n appLogger(\n `${x} No output configuration found. Add a ${colorize('compiler.output', ANSIColors.BLUE)} in your configuration.`,\n {\n level: 'error',\n }\n );\n return;\n }\n\n const { detectPackageName, extractContent } = await import('@intlayer/babel');\n\n // Detect package\n const packageName: PackageName = detectPackageName(baseDir);\n\n let filesToExtract = options.files ?? [];\n\n if (filesToExtract.length === 0) {\n // Await all promises simultaneously\n const fileList = buildComponentFilesList(configuration);\n\n // Flatten the nested arrays and remove duplicates\n // Relative paths for selection\n const choices = fileList.map((file) => {\n const relPath = relative(baseDir, file);\n\n return {\n value: file,\n label: relPath,\n };\n });\n\n if (choices.length === 0) {\n appLogger('No extractable files found in the project.');\n return;\n }\n\n const SELECT_ALL = '__select_all__';\n\n type PromptChoice = {\n name: string;\n enabled: boolean;\n disabled?: boolean | string;\n };\n\n type PromptContext = {\n choices: PromptChoice[];\n render(): void | Promise<void>;\n state: { submitted: boolean };\n selected: PromptChoice[];\n input: string;\n options: { multiple?: boolean };\n };\n\n let selectedFiles: string[] | symbol;\n try {\n const maxLen = Math.max((process.stdout.columns || 80) - 15, 20);\n const truncatePath = (path: string) =>\n path.length > maxLen ? `...${path.slice(-(maxLen - 3))}` : path;\n\n const { files: enquirerSelectedFiles } = await enquirer.prompt<{\n files: string[];\n }>({\n type: 'autocomplete',\n name: 'files',\n message: 'Select files to extract (Type to search):',\n multiple: true,\n // @ts-ignore limit exist but is not typed\n limit: 40,\n choices: [\n { name: SELECT_ALL, message: '────── Select all ──────' },\n ...choices.map((choice) => ({\n name: choice.value,\n message: truncatePath(choice.label),\n })),\n ],\n async toggle(\n this: PromptContext,\n choice: PromptChoice,\n enabled?: boolean\n ) {\n if (!choice || choice.disabled) return;\n choice.enabled = enabled == null ? !choice.enabled : enabled;\n\n if (choice.name === SELECT_ALL) {\n this.choices\n .filter((choiceEl) => choiceEl.name !== SELECT_ALL)\n .forEach((choiceEl) => {\n choiceEl.enabled = choice.enabled;\n });\n }\n\n return this.render();\n },\n format(this: PromptContext) {\n if (this.state?.submitted && this.options?.multiple) {\n return `${this.selected.filter((s) => s.name !== SELECT_ALL).length} file(s) selected`;\n }\n return this.input ?? '';\n },\n });\n\n selectedFiles = enquirerSelectedFiles.filter(\n (file) => file !== SELECT_ALL\n );\n } catch {\n selectedFiles = Symbol('cancel');\n }\n\n if (typeof selectedFiles === 'symbol') {\n // User cancelled\n process.exit(0);\n }\n\n filesToExtract = selectedFiles as string[];\n }\n\n if (filesToExtract.length === 0) {\n appLogger('No files selected for extraction.');\n return;\n }\n\n const absoluteFiles = filesToExtract\n .map((file) => resolve(baseDir, file))\n .filter((file) => {\n if (!existsSync(file)) {\n appLogger(`File not found: ${formatPath(file)}`);\n return false;\n }\n return true;\n });\n\n if (absoluteFiles.length === 0) {\n return;\n }\n\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n for (const filePath of absoluteFiles) {\n try {\n await extractContent(filePath, packageName, {\n unmergedDictionaries,\n configuration,\n codeOnly: options.codeOnly,\n declarationOnly: options.declarationOnly,\n });\n } catch (error) {\n appLogger(`Failed to transform ${filePath}: ${(error as Error).message}`);\n }\n }\n\n await prepareIntlayer(configuration); // Prepare Intlayer to apply the changes\n};\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAa,UAAU,OAAO,YAA4B;CACxD,MAAM,gBAAgB,iBAAiB,QAAQ,cAAc;CAE7D,iBAAiB,SAAS,cAAc;CAExC,MAAM,YAAY,aAAa,cAAc;CAE7C,MAAM,EAAE,YAAY,cAAc;CAClC,MAAM,EAAE,WAAW,cAAc;CAEjC,IAAI,CAAC,QAAQ;EACX,UACE,GAAG,EAAE,wCAAwC,SAAS,mBAAmB,WAAW,KAAK,CAAC,0BAC1F,EACE,OAAO,SACR,CACF;EACD;;CAGF,MAAM,EAAE,mBAAmB,mBAAmB,MAAM,OAAO;CAG3D,MAAM,cAA2B,kBAAkB,QAAQ;CAE3D,IAAI,iBAAiB,QAAQ,SAAS,EAAE;CAExC,IAAI,eAAe,WAAW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W,GAAG;EAC/B,UAAU,oCAAoC;EAC9C;;CAGF,MAAM,gBAAgB,eACnB,KAAK,SAAS,QAAQ,SAAS,KAAK,CAAC,CACrC,QAAQ,SAAS;EAChB,IAAI,CAAC,WAAW,KAAK,EAAE;GACrB,UAAU,mBAAmB,WAAW,KAAK,GAAG;GAChD,OAAO;;EAET,OAAO;GACP;CAEJ,IAAI,cAAc,WAAW,GAC3B;CAGF,MAAM,uBAAuB,wBAAwB,cAAc;CAEnE,KAAK,MAAM,YAAY,eACrB,IAAI;EACF,MAAM,eAAe,UAAU,aAAa;GAC1C;GACA;GACA,UAAU,QAAQ;GAClB,iBAAiB,QAAQ;GAC1B,CAAC;UACK,OAAO;EACd,UAAU,uBAAuB,SAAS,IAAK,MAAgB,UAAU;;CAI7E,MAAM,gBAAgB,cAAc"}
1
+ {"version":3,"file":"extract.mjs","names":[],"sources":["../../src/extract.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { relative, resolve } from 'node:path';\nimport type { PackageName } from '@intlayer/babel';\nimport { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { logConfigDetails } from '@intlayer/chokidar/cli';\nimport { buildComponentFilesList, formatPath } from '@intlayer/chokidar/utils';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger, x } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { FilePathPattern } from '@intlayer/types/filePathPattern';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport enquirer from 'enquirer';\n\ntype ExtractOptions = {\n files?: string[];\n output?: FilePathPattern;\n configOptions?: GetConfigurationOptions;\n codeOnly?: boolean;\n declarationOnly?: boolean;\n};\n\nexport const extract = async (options: ExtractOptions) => {\n const configuration = getConfiguration(options.configOptions);\n\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(configuration);\n\n const { baseDir } = configuration.system;\n const { output } = configuration.compiler;\n\n if (!output) {\n appLogger(\n `${x} No output configuration found. Add a ${colorize('compiler.output', ANSIColors.BLUE)} in your configuration.`,\n {\n level: 'error',\n }\n );\n return;\n }\n\n const { detectPackageName, extractContent } = await import('@intlayer/babel');\n\n // Detect package\n const packageName: PackageName = detectPackageName(baseDir);\n\n let filesToExtract = options.files ?? [];\n\n if (filesToExtract.length === 0) {\n // Await all promises simultaneously\n const fileList = buildComponentFilesList(configuration);\n\n // Flatten the nested arrays and remove duplicates\n // Relative paths for selection\n const choices = fileList.map((file) => {\n const relPath = relative(baseDir, file);\n\n return {\n value: file,\n label: relPath,\n };\n });\n\n if (choices.length === 0) {\n appLogger('No extractable files found in the project.');\n return;\n }\n\n const SELECT_ALL = '__select_all__';\n\n type PromptChoice = {\n name: string;\n enabled: boolean;\n disabled?: boolean | string;\n };\n\n type PromptContext = {\n choices: PromptChoice[];\n render(): void | Promise<void>;\n state: { submitted: boolean };\n selected: PromptChoice[];\n input: string;\n options: { multiple?: boolean };\n };\n\n let selectedFiles: string[] | symbol;\n try {\n const maxLen = Math.max((process.stdout.columns || 80) - 15, 20);\n const truncatePath = (path: string) =>\n path.length > maxLen ? `...${path.slice(-(maxLen - 3))}` : path;\n\n const { files: enquirerSelectedFiles } = await enquirer.prompt<{\n files: string[];\n }>({\n type: 'autocomplete',\n name: 'files',\n message: 'Select files to extract (Type to search):',\n multiple: true,\n // @ts-ignore limit exist but is not typed\n limit: 40,\n choices: [\n { name: SELECT_ALL, message: '────── Select all ──────' },\n ...choices.map((choice) => ({\n name: choice.value,\n message: truncatePath(choice.label),\n })),\n ],\n async toggle(\n this: PromptContext,\n choice: PromptChoice,\n enabled?: boolean\n ) {\n if (!choice || choice.disabled) return;\n choice.enabled = enabled == null ? !choice.enabled : enabled;\n\n if (choice.name === SELECT_ALL) {\n this.choices\n .filter((choiceEl) => choiceEl.name !== SELECT_ALL)\n .forEach((choiceEl) => {\n choiceEl.enabled = choice.enabled;\n });\n }\n\n return this.render();\n },\n format(this: PromptContext) {\n if (this.state?.submitted && this.options?.multiple) {\n return `${this.selected.filter((s) => s.name !== SELECT_ALL).length} file(s) selected`;\n }\n return this.input ?? '';\n },\n });\n\n selectedFiles = enquirerSelectedFiles.filter(\n (file) => file !== SELECT_ALL\n );\n } catch {\n selectedFiles = Symbol('cancel');\n }\n\n if (typeof selectedFiles === 'symbol') {\n // User cancelled\n process.exit(0);\n }\n\n filesToExtract = selectedFiles as string[];\n }\n\n if (filesToExtract.length === 0) {\n appLogger('No files selected for extraction.');\n return;\n }\n\n const absoluteFiles = filesToExtract\n .map((file) => resolve(baseDir, file))\n .filter((file) => {\n if (!existsSync(file)) {\n appLogger(`File not found: ${formatPath(file)}`);\n return false;\n }\n return true;\n });\n\n if (absoluteFiles.length === 0) {\n return;\n }\n\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n for (const filePath of absoluteFiles) {\n try {\n await extractContent(filePath, packageName, {\n unmergedDictionaries,\n configuration,\n codeOnly: options.codeOnly,\n declarationOnly: options.declarationOnly,\n });\n } catch (error) {\n appLogger(`Failed to transform ${filePath}: ${(error as Error).message}`);\n }\n }\n\n await prepareIntlayer(configuration); // Prepare Intlayer to apply the changes\n};\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAa,UAAU,OAAO,YAA4B;CACxD,MAAM,gBAAgB,iBAAiB,QAAQ,aAAa;CAE5D,iBAAiB,SAAS,aAAa;CAEvC,MAAM,YAAY,aAAa,aAAa;CAE5C,MAAM,EAAE,YAAY,cAAc;CAClC,MAAM,EAAE,WAAW,cAAc;CAEjC,IAAI,CAAC,QAAQ;EACX,UACE,GAAG,EAAE,wCAAwC,SAAS,mBAAmB,WAAW,IAAI,EAAE,0BAC1F,EACE,OAAO,QACT,CACF;EACA;CACF;CAEA,MAAM,EAAE,mBAAmB,mBAAmB,MAAM,OAAO;CAG3D,MAAM,cAA2B,kBAAkB,OAAO;CAE1D,IAAI,iBAAiB,QAAQ,SAAS,CAAC;CAEvC,IAAI,eAAe,WAAW,GAAG;EAM/B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AEA,IAAI,eAAe,WAAW,GAAG;EAC/B,UAAU,mCAAmC;EAC7C;CACF;CAEA,MAAM,gBAAgB,eACnB,KAAK,SAAS,QAAQ,SAAS,IAAI,CAAC,EACpC,QAAQ,SAAS;EAChB,IAAI,CAAC,WAAW,IAAI,GAAG;GACrB,UAAU,mBAAmB,WAAW,IAAI,GAAG;GAC/C,OAAO;EACT;EACA,OAAO;CACT,CAAC;CAEH,IAAI,cAAc,WAAW,GAC3B;CAGF,MAAM,uBAAuB,wBAAwB,aAAa;CAElE,KAAK,MAAM,YAAY,eACrB,IAAI;EACF,MAAM,eAAe,UAAU,aAAa;GAC1C;GACA;GACA,UAAU,QAAQ;GAClB,iBAAiB,QAAQ;EAC3B,CAAC;CACH,SAAS,OAAO;EACd,UAAU,uBAAuB,SAAS,IAAK,MAAgB,SAAS;CAC1E;CAGF,MAAM,gBAAgB,aAAa;AACrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"deepMergeContent.mjs","names":[],"sources":["../../../src/fill/deepMergeContent.ts"],"sourcesContent":["/**\n * Deep merge two plain objects (for per-locale content).\n * The second object's values take precedence over the first.\n *\n * @param target - The base object\n * @param source - The object to merge in (takes precedence)\n * @returns The merged object\n */\nexport const deepMergeContent = <T = any>(target: T, source: T): T => {\n // Handle null/undefined\n if (target === null || target === undefined) return source;\n if (source === null || source === undefined) return target;\n\n // Handle non-objects (primitives, arrays)\n if (\n typeof target !== 'object' ||\n typeof source !== 'object' ||\n Array.isArray(target) ||\n Array.isArray(source)\n ) {\n return source;\n }\n\n // Merge objects\n const result: any = { ...target };\n\n for (const key in source) {\n if (Object.hasOwn(source, key)) {\n const sourceValue = (source as any)[key];\n const targetValue = result[key];\n\n if (\n typeof sourceValue === 'object' &&\n sourceValue !== null &&\n !Array.isArray(sourceValue) &&\n typeof targetValue === 'object' &&\n targetValue !== null &&\n !Array.isArray(targetValue)\n ) {\n // Recursively merge nested objects\n result[key] = deepMergeContent(targetValue, sourceValue);\n } else {\n // Overwrite with source value\n result[key] = sourceValue;\n }\n }\n }\n\n return result;\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,oBAA6B,QAAW,WAAiB;CAEpE,IAAI,WAAW,QAAQ,WAAW,QAAW,OAAO;CACpD,IAAI,WAAW,QAAQ,WAAW,QAAW,OAAO;CAGpD,IACE,OAAO,WAAW,YAClB,OAAO,WAAW,YAClB,MAAM,QAAQ,OAAO,IACrB,MAAM,QAAQ,OAAO,EAErB,OAAO;CAIT,MAAM,SAAc,EAAE,GAAG,QAAQ;CAEjC,KAAK,MAAM,OAAO,QAChB,IAAI,OAAO,OAAO,QAAQ,IAAI,EAAE;EAC9B,MAAM,cAAe,OAAe;EACpC,MAAM,cAAc,OAAO;EAE3B,IACE,OAAO,gBAAgB,YACvB,gBAAgB,QAChB,CAAC,MAAM,QAAQ,YAAY,IAC3B,OAAO,gBAAgB,YACvB,gBAAgB,QAChB,CAAC,MAAM,QAAQ,YAAY,EAG3B,OAAO,OAAO,iBAAiB,aAAa,YAAY;OAGxD,OAAO,OAAO;;CAKpB,OAAO"}
1
+ {"version":3,"file":"deepMergeContent.mjs","names":[],"sources":["../../../src/fill/deepMergeContent.ts"],"sourcesContent":["/**\n * Deep merge two plain objects (for per-locale content).\n * The second object's values take precedence over the first.\n *\n * @param target - The base object\n * @param source - The object to merge in (takes precedence)\n * @returns The merged object\n */\nexport const deepMergeContent = <T = any>(target: T, source: T): T => {\n // Handle null/undefined\n if (target === null || target === undefined) return source;\n if (source === null || source === undefined) return target;\n\n // Handle non-objects (primitives, arrays)\n if (\n typeof target !== 'object' ||\n typeof source !== 'object' ||\n Array.isArray(target) ||\n Array.isArray(source)\n ) {\n return source;\n }\n\n // Merge objects\n const result: any = { ...target };\n\n for (const key in source) {\n if (Object.hasOwn(source, key)) {\n const sourceValue = (source as any)[key];\n const targetValue = result[key];\n\n if (\n typeof sourceValue === 'object' &&\n sourceValue !== null &&\n !Array.isArray(sourceValue) &&\n typeof targetValue === 'object' &&\n targetValue !== null &&\n !Array.isArray(targetValue)\n ) {\n // Recursively merge nested objects\n result[key] = deepMergeContent(targetValue, sourceValue);\n } else {\n // Overwrite with source value\n result[key] = sourceValue;\n }\n }\n }\n\n return result;\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,oBAA6B,QAAW,WAAiB;CAEpE,IAAI,WAAW,QAAQ,WAAW,QAAW,OAAO;CACpD,IAAI,WAAW,QAAQ,WAAW,QAAW,OAAO;CAGpD,IACE,OAAO,WAAW,YAClB,OAAO,WAAW,YAClB,MAAM,QAAQ,MAAM,KACpB,MAAM,QAAQ,MAAM,GAEpB,OAAO;CAIT,MAAM,SAAc,EAAE,GAAG,OAAO;CAEhC,KAAK,MAAM,OAAO,QAChB,IAAI,OAAO,OAAO,QAAQ,GAAG,GAAG;EAC9B,MAAM,cAAe,OAAe;EACpC,MAAM,cAAc,OAAO;EAE3B,IACE,OAAO,gBAAgB,YACvB,gBAAgB,QAChB,CAAC,MAAM,QAAQ,WAAW,KAC1B,OAAO,gBAAgB,YACvB,gBAAgB,QAChB,CAAC,MAAM,QAAQ,WAAW,GAG1B,OAAO,OAAO,iBAAiB,aAAa,WAAW;OAGvD,OAAO,OAAO;CAElB;CAGF,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"extractTranslatableContent.mjs","names":[],"sources":["../../../src/fill/extractTranslatableContent.ts"],"sourcesContent":["export type ExtractedContentProps = {\n index: number;\n path: (string | number)[];\n value: string;\n replacement?: Record<string, string>;\n};\n\nexport type ExtractedContentResult = {\n extractedContent: ExtractedContentProps[];\n translatableDictionary: Record<number, string>;\n};\n\nexport const extractTranslatableContent = (\n content: any,\n currentPath: (string | number)[] = [],\n state = {\n currentIndex: 1,\n extractedContent: [] as ExtractedContentProps[],\n translatableDictionary: {} as Record<number, string>,\n }\n): ExtractedContentResult => {\n if (typeof content === 'string') {\n const regex = /[{]+.*?[}]+/g;\n const replacement: Record<string, string> = {};\n let varIndex = 1;\n\n const modifiedContent = content.replace(regex, (matchStr) => {\n const placeholder = `<${varIndex}>`;\n replacement[placeholder] = matchStr;\n varIndex++;\n return placeholder;\n });\n\n // Only extract strings that contain at least one letter or number outside of placeholders.\n // This avoids extracting strings that are only spaces, special characters, or just variables.\n const contentWithoutPlaceholders = modifiedContent.replace(/<\\d+>/g, '');\n if (/[\\p{L}\\p{N}]/u.test(contentWithoutPlaceholders)) {\n state.extractedContent.push({\n index: state.currentIndex,\n path: currentPath,\n value: modifiedContent,\n replacement:\n Object.keys(replacement).length > 0 ? replacement : undefined,\n });\n state.translatableDictionary[state.currentIndex] = modifiedContent;\n state.currentIndex++;\n }\n } else if (Array.isArray(content)) {\n content.forEach((item, index) => {\n extractTranslatableContent(item, [...currentPath, index], state);\n });\n } else if (typeof content === 'object' && content !== null) {\n for (const key in content) {\n if (Object.hasOwn(content, key)) {\n extractTranslatableContent(content[key], [...currentPath, key], state);\n }\n }\n }\n\n return {\n extractedContent: state.extractedContent,\n translatableDictionary: state.translatableDictionary,\n };\n};\n\nexport const reinsertTranslatedContent = (\n baseContent: any,\n extractedContentProps: ExtractedContentProps[],\n translatedDictionary: Record<number, string>\n): any => {\n const result = structuredClone(baseContent);\n\n for (const { index, path, replacement } of extractedContentProps) {\n let translatedValue = translatedDictionary[index];\n\n if (translatedValue !== undefined) {\n if (replacement) {\n for (const [placeholder, originalVar] of Object.entries(replacement)) {\n translatedValue = translatedValue.replace(placeholder, originalVar);\n }\n }\n\n let current = result;\n for (let i = 0; i < path.length - 1; i++) {\n current = current[path[i]];\n }\n current[path[path.length - 1]] = translatedValue;\n }\n }\n\n return result;\n};\n"],"mappings":";AAYA,MAAa,8BACX,SACA,cAAmC,EAAE,EACrC,QAAQ;CACN,cAAc;CACd,kBAAkB,EAAE;CACpB,wBAAwB,EAAE;CAC3B,KAC0B;CAC3B,IAAI,OAAO,YAAY,UAAU;EAC/B,MAAM,QAAQ;EACd,MAAM,cAAsC,EAAE;EAC9C,IAAI,WAAW;EAEf,MAAM,kBAAkB,QAAQ,QA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["export type ExtractedContentProps = {\n index: number;\n path: (string | number)[];\n value: string;\n replacement?: Record<string, string>;\n};\n\nexport type ExtractedContentResult = {\n extractedContent: ExtractedContentProps[];\n translatableDictionary: Record<number, string>;\n};\n\nexport const extractTranslatableContent = (\n content: any,\n currentPath: (string | number)[] = [],\n state = {\n currentIndex: 1,\n extractedContent: [] as ExtractedContentProps[],\n translatableDictionary: {} as Record<number, string>,\n }\n): ExtractedContentResult => {\n if (typeof content === 'string') {\n const regex = /[{]+.*?[}]+/g;\n const replacement: Record<string, string> = {};\n let varIndex = 1;\n\n const modifiedContent = content.replace(regex, (matchStr) => {\n const placeholder = `<${varIndex}>`;\n replacement[placeholder] = matchStr;\n varIndex++;\n return placeholder;\n });\n\n // Only extract strings that contain at least one letter or number outside of placeholders.\n // This avoids extracting strings that are only spaces, special characters, or just variables.\n const contentWithoutPlaceholders = modifiedContent.replace(/<\\d+>/g, '');\n if (/[\\p{L}\\p{N}]/u.test(contentWithoutPlaceholders)) {\n state.extractedContent.push({\n index: state.currentIndex,\n path: currentPath,\n value: modifiedContent,\n replacement:\n Object.keys(replacement).length > 0 ? replacement : undefined,\n });\n state.translatableDictionary[state.currentIndex] = modifiedContent;\n state.currentIndex++;\n }\n } else if (Array.isArray(content)) {\n content.forEach((item, index) => {\n extractTranslatableContent(item, [...currentPath, index], state);\n });\n } else if (typeof content === 'object' && content !== null) {\n for (const key in content) {\n if (Object.hasOwn(content, key)) {\n extractTranslatableContent(content[key], [...currentPath, key], state);\n }\n }\n }\n\n return {\n extractedContent: state.extractedContent,\n translatableDictionary: state.translatableDictionary,\n };\n};\n\nexport const reinsertTranslatedContent = (\n baseContent: any,\n extractedContentProps: ExtractedContentProps[],\n translatedDictionary: Record<number, string>\n): any => {\n const result = structuredClone(baseContent);\n\n for (const { index, path, replacement } of extractedContentProps) {\n let translatedValue = translatedDictionary[index];\n\n if (translatedValue !== undefined) {\n if (replacement) {\n for (const [placeholder, originalVar] of Object.entries(replacement)) {\n translatedValue = translatedValue.replace(placeholder, originalVar);\n }\n }\n\n let current = result;\n for (let i = 0; i < path.length - 1; i++) {\n current = current[path[i]];\n }\n current[path[path.length - 1]] = translatedValue;\n }\n }\n\n return result;\n};\n"],"mappings":";AAYA,MAAa,8BACX,SACA,cAAmC,CAAC,GACpC,QAAQ;CACN,cAAc;CACd,kBAAkB,CAAC;CACnB,wBAAwB,CAAC;AAC3B,MAC2B;CAC3B,IAAI,OAAO,YAAY,UAAU;EAC/B,MAAM,QAAQ;EACd,MAAM,cAAsC,CAAC;EAC7C,IAAI,WAAW;EAEf,MAAM,kBAAkB,QAAQ,QAAQ,QAAQ,aAAa;GAC3D,MAAM,cAAc,IAAI,SAAS;GACjC,YAAY,eAAe;GAC3B;GACA,OAAO;EACT,CAAC;EAID,MAAM,6BAA6B,gBAAgB,QAAQ,UAAU,EAAE;EACvE,IAAI,gBAAgB,KAAK,0BAA0B,GAAG;GACpD,MAAM,iBAAiB,KAAK;IAC1B,OAAO,MAAM;IACb,MAAM;IACN,OAAO;IACP,aACE,OAAO,KAAK,WAAW,EAAE,SAAS,IAAI,cAAc;GACxD,CAAC;GACD,MAAM,uBAAuB,MAAM,gBAAgB;GACnD,MAAM;EACR;CACF,OAAO,IAAI,MAAM,QAAQ,OAAO,GAC9B,QAAQ,SAAS,MAAM,UAAU;EAC/B,2BAA2B,MAAM,CAAC,GAAG,aAAa,KAAK,GAAG,KAAK;CACjE,CAAC;MACI,IAAI,OAAO,YAAY,YAAY,YAAY,MACpD;OAAK,MAAM,OAAO,SAChB,IAAI,OAAO,OAAO,SAAS,GAAG,GAC5B,2BAA2B,QAAQ,MAAM,CAAC,GAAG,aAAa,GAAG,GAAG,KAAK;CAEzE;CAGF,OAAO;EACL,kBAAkB,MAAM;EACxB,wBAAwB,MAAM;CAChC;AACF;AAEA,MAAa,6BACX,aACA,uBACA,yBACQ;CACR,MAAM,SAAS,gBAAgB,WAAW;CAE1C,KAAK,MAAM,EAAE,OAAO,MAAM,iBAAiB,uBAAuB;EAChE,IAAI,kBAAkB,qBAAqB;EAE3C,IAAI,oBAAoB,QAAW;GACjC,IAAI,aACF,KAAK,MAAM,CAAC,aAAa,gBAAgB,OAAO,QAAQ,WAAW,GACjE,kBAAkB,gBAAgB,QAAQ,aAAa,WAAW;GAItE,IAAI,UAAU;GACd,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KACnC,UAAU,QAAQ,KAAK;GAEzB,QAAQ,KAAK,KAAK,SAAS,MAAM;EACnC;CACF;CAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"fill.mjs","names":[],"sources":["../../../src/fill/fill.ts"],"sourcesContent":["import { basename, join, relative } from 'node:path';\n\nimport type { AIOptions } from '@intlayer/api';\nimport {\n loadContentDeclarations,\n prepareIntlayer,\n writeContentDeclaration,\n} from '@intlayer/chokidar/build';\nimport {\n type ListGitFilesOptions,\n logConfigDetails,\n} from '@intlayer/chokidar/cli';\nimport {\n formatPath,\n getGlobalLimiter,\n getTaskLimiter,\n} from '@intlayer/chokidar/utils';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { Fill } from '@intlayer/types/dictionary';\nimport {\n ensureArray,\n type GetTargetDictionaryOptions,\n getTargetUnmergedDictionaries,\n} from '../getTargetDictionary';\nimport { setupAI } from '../utils/setupAI';\nimport {\n listTranslationsTasks,\n type TranslationTask,\n} from './listTranslationsTasks';\nimport { translateDictionary } from './translateDictionary';\nimport { writeFill } from './writeFill';\n\nconst NB_CONCURRENT_TRANSLATIONS = 7;\n\n// Arguments for the fill function\nexport type FillOptions = {\n sourceLocale?: Locale;\n outputLocales?: Locale | Locale[];\n mode?: 'complete' | 'review';\n gitOptions?: ListGitFilesOptions;\n aiOptions?: AIOptions; // Added aiOptions to be passed to translateJSON\n verbose?: boolean;\n nbConcurrentTranslations?: number;\n nbConcurrentTasks?: number; // NEW: number of tasks that may run at once\n build?: boolean;\n skipMetadata?: boolean;\n} & GetTargetDictionaryOptions;\n\n/**\n * Fill translations based on the provided options.\n */\nexport const fill = async (options?: FillOptions): Promise<void> => {\n const configuration = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(configuration);\n\n if (options?.build === true) {\n await prepareIntlayer(configuration, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(configuration);\n }\n\n const { defaultLocale, locales } = configuration.internationalization;\n const mode = options?.mode ?? 'complete';\n const baseLocale = options?.sourceLocale ?? defaultLocale;\n\n const outputLocales = options?.outputLocales\n ? ensureArray(options.outputLocales)\n : locales;\n\n const aiResult = await setupAI(configuration, options?.aiOptions);\n\n if (!aiResult?.hasAIAccess) return;\n\n const { aiClient, aiConfig, isCustomAI } = aiResult;\n\n if (isCustomAI && aiClient && aiConfig) {\n const { hasAIAccess, error } = await aiClient.checkAISDKAccess(aiConfig);\n if (!hasAIAccess) {\n appLogger(`${x} ${error}`);\n return;\n }\n }\n\n const targetUnmergedDictionaries =\n await getTargetUnmergedDictionaries(options);\n\n // Load the original source content declaration files to recover function-type\n // `fill` values that are lost when dictionaries are JSON-serialised into\n // unmerged_dictionaries.cjs. Dictionary-level fill takes priority over the\n // config-level fill, but we can only know that by reading the source files.\n const uniqueSourcePaths = [\n ...new Set(\n targetUnmergedDictionaries\n .filter((unmergedDictionary) =>\n ['local', 'hybrid'].includes(unmergedDictionary.location!)\n )\n .map((unmergedDictionary) => unmergedDictionary.filePath)\n .filter(Boolean) as string[]\n ),\n ];\n const sourceDictionaries = await loadContentDeclarations(\n uniqueSourcePaths.map((sourcePath) =>\n join(configuration.system.baseDir, sourcePath)\n ),\n configuration,\n undefined,\n {\n logError: false,\n }\n );\n // Map relative filePath → original fill value from the source file\n const originalFillByPath = new Map<string, Fill | undefined>();\n\n for (const dictionary of sourceDictionaries) {\n if (dictionary.filePath) {\n originalFillByPath.set(\n dictionary.filePath,\n dictionary.fill as Fill | undefined\n );\n }\n }\n\n const affectedDictionaryKeys = new Set<string>();\n\n targetUnmergedDictionaries.forEach((dict) => {\n affectedDictionaryKeys.add(dict.key);\n });\n\n const keysToProcess = Array.from(affectedDictionaryKeys);\n\n appLogger([\n 'Affected dictionary keys for processing:',\n keysToProcess.length > 0\n ? keysToProcess.map((key) => colorizeKey(key)).join(', ')\n : colorize('No keys found', ANSIColors.YELLOW),\n ]);\n\n if (keysToProcess.length === 0) return;\n\n /**\n * List the translations tasks\n *\n * Create a list of per-locale dictionaries to translate\n *\n * In 'complete' mode, filter only the missing locales to translate\n */\n const translationTasks: TranslationTask[] = listTranslationsTasks(\n targetUnmergedDictionaries.map((dictionary) => dictionary.localId!),\n outputLocales,\n mode,\n baseLocale,\n configuration\n );\n\n // AI calls in flight at once (translateJSON + metadata audit)\n const nbConcurrentTranslations =\n options?.nbConcurrentTranslations ?? NB_CONCURRENT_TRANSLATIONS;\n const globalLimiter = getGlobalLimiter(nbConcurrentTranslations);\n\n // NEW: number of *tasks* that may run at once (start/prepare/log/write)\n const nbConcurrentTasks = Math.max(\n 1,\n Math.min(\n options?.nbConcurrentTasks ?? nbConcurrentTranslations,\n translationTasks.length\n )\n );\n\n const taskLimiter = getTaskLimiter(nbConcurrentTasks);\n\n const runners = translationTasks.map((task) =>\n taskLimiter(async () => {\n const relativePath = relative(\n configuration?.system?.baseDir ?? process.cwd(),\n task?.dictionaryFilePath ?? ''\n );\n\n // log AFTER acquiring a task slot\n appLogger(\n `${task.dictionaryPreset} Processing ${colorizePath(basename(relativePath))}`,\n { level: 'info' }\n );\n\n const translationTaskResult = await translateDictionary(\n task,\n configuration,\n {\n mode,\n aiOptions: options?.aiOptions,\n fillMetadata: !options?.skipMetadata,\n onHandle: globalLimiter,\n aiClient,\n aiConfig,\n }\n );\n\n if (!translationTaskResult?.dictionaryOutput) return;\n\n const { dictionaryOutput, sourceLocale } = translationTaskResult;\n\n // Determine if we should write to separate files\n // - If dictionary has explicit fill setting (string, function, or object), use it\n // - If dictionary is per-locale AND has no explicit fill=false, use global fill config\n // - If dictionary is multilingual (no locale property), always write to same file\n //\n // NOTE: function-type fill values are lost during JSON serialisation of\n // unmerged_dictionaries.cjs. We recover them by checking the original\n // source file that was loaded above (originalFillByPath). Dictionary-level\n // fill always takes priority over config-level fill.\n const originalFill = originalFillByPath.get(\n dictionaryOutput.filePath ?? ''\n );\n\n // originalFill is undefined when the source file had no fill property; use\n // the (possibly JSON-preserved) dictionaryOutput.fill as a fallback so that\n // string/boolean fill values set directly on the dict still work.\n const dictFill: Fill | undefined =\n originalFill !== undefined ? originalFill : dictionaryOutput.fill;\n\n const hasDictionaryLevelFill =\n typeof dictFill === 'string' ||\n typeof dictFill === 'function' ||\n (typeof dictFill === 'object' && dictFill !== null);\n\n const isPerLocale = typeof dictionaryOutput.locale === 'string';\n\n const effectiveFill = hasDictionaryLevelFill\n ? dictFill\n : isPerLocale\n ? (configuration.dictionary?.fill ?? true)\n : false; // Multilingual dictionaries (no locale property) always write to same file unless explicitly set on the dictionary\n\n const isFillOtherFile =\n typeof effectiveFill === 'string' ||\n typeof effectiveFill === 'function' ||\n (typeof effectiveFill === 'object' && effectiveFill !== null);\n\n if (isFillOtherFile) {\n await writeFill(\n {\n ...dictionaryOutput,\n // Ensure fill is set on the dictionary for writeFill to use\n fill: effectiveFill,\n },\n outputLocales,\n [sourceLocale],\n configuration\n );\n } else {\n await writeContentDeclaration(dictionaryOutput, configuration);\n\n if (dictionaryOutput.filePath) {\n appLogger(\n `${task.dictionaryPreset} Content declaration written to ${formatPath(basename(dictionaryOutput.filePath))}`,\n { level: 'info' }\n );\n }\n }\n })\n );\n\n await Promise.all(runners);\n await (globalLimiter as any).onIdle();\n};\n"],"mappings":";;;;;;;;;;;;;;AAyCA,MAAM,6BAA6B;;;;AAmBnC,MAAa,OAAO,OAAO,YAAyC;CAClE,MAAM,gBAA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BAAkB,MAGxD,MAAM,UACJ;GACE,GAAG;GAEH,MAAM;GACP,EACD,eACA,CAAC,aAAa,EACd,cACD;OACI;GACL,MAAM,wBAAwB,kBAAkB,cAAc;GAE9D,IAAI,iBAAiB,UACnB,UACE,GAAG,KAAK,iBAAiB,kCAAkC,WAAW,SAAS,iBAAiB,SAAS,CAAC,IAC1G,EAAE,OAAO,QAAQ,CAClB;;GAGL,CACH;CAED,MAAM,QAAQ,IAAI,QAAQ;CAC1B,MAAO,cAAsB,QAAQ"}
1
+ {"version":3,"file":"fill.mjs","names":[],"sources":["../../../src/fill/fill.ts"],"sourcesContent":["import { basename, join, relative } from 'node:path';\nimport type { AIOptions } from '@intlayer/api';\nimport {\n loadContentDeclarations,\n prepareIntlayer,\n writeContentDeclaration,\n} from '@intlayer/chokidar/build';\nimport {\n type ListGitFilesOptions,\n logConfigDetails,\n} from '@intlayer/chokidar/cli';\nimport {\n formatPath,\n getGlobalLimiter,\n getTaskLimiter,\n} from '@intlayer/chokidar/utils';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { Fill } from '@intlayer/types/dictionary';\nimport {\n ensureArray,\n type GetTargetDictionaryOptions,\n getTargetUnmergedDictionaries,\n} from '../getTargetDictionary';\nimport { setupAI } from '../utils/setupAI';\nimport {\n listTranslationsTasks,\n type TranslationTask,\n} from './listTranslationsTasks';\nimport { translateDictionary } from './translateDictionary';\nimport { writeFill } from './writeFill';\n\nconst NB_CONCURRENT_TRANSLATIONS = 7;\n\n// Arguments for the fill function\nexport type FillOptions = {\n sourceLocale?: Locale;\n outputLocales?: Locale | Locale[];\n mode?: 'complete' | 'review';\n gitOptions?: ListGitFilesOptions;\n aiOptions?: AIOptions; // Added aiOptions to be passed to translateJSON\n verbose?: boolean;\n nbConcurrentTranslations?: number;\n nbConcurrentTasks?: number; // NEW: number of tasks that may run at once\n build?: boolean;\n skipMetadata?: boolean;\n} & GetTargetDictionaryOptions;\n\n/**\n * Fill translations based on the provided options.\n */\nexport const fill = async (options?: FillOptions): Promise<void> => {\n const configuration = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(configuration);\n\n if (options?.build === true) {\n await prepareIntlayer(configuration, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(configuration);\n }\n\n const { defaultLocale, locales } = configuration.internationalization;\n const mode = options?.mode ?? 'complete';\n const baseLocale = options?.sourceLocale ?? defaultLocale;\n\n const outputLocales = options?.outputLocales\n ? ensureArray(options.outputLocales)\n : locales;\n\n const aiResult = await setupAI(configuration, options?.aiOptions);\n\n if (!aiResult?.hasAIAccess) return;\n\n const { aiClient, aiConfig, isCustomAI } = aiResult;\n\n if (isCustomAI && aiClient && aiConfig) {\n const { hasAIAccess, error } = await aiClient.checkAISDKAccess(aiConfig);\n if (!hasAIAccess) {\n appLogger(`${x} ${error}`);\n return;\n }\n }\n\n const targetUnmergedDictionaries =\n await getTargetUnmergedDictionaries(options);\n\n // Load the original source content declaration files to recover function-type\n // `fill` values that are lost when dictionaries are JSON-serialised into\n // unmerged_dictionaries.cjs. Dictionary-level fill takes priority over the\n // config-level fill, but we can only know that by reading the source files.\n const uniqueSourcePaths = [\n ...new Set(\n targetUnmergedDictionaries\n .filter((unmergedDictionary) =>\n ['local', 'hybrid'].includes(unmergedDictionary.location!)\n )\n .map((unmergedDictionary) => unmergedDictionary.filePath)\n .filter(Boolean) as string[]\n ),\n ];\n const sourceDictionaries = await loadContentDeclarations(\n uniqueSourcePaths.map((sourcePath) =>\n join(configuration.system.baseDir, sourcePath)\n ),\n configuration,\n undefined,\n {\n logError: false,\n }\n );\n // Map relative filePath → original fill value from the source file\n const originalFillByPath = new Map<string, Fill | undefined>();\n\n for (const dictionary of sourceDictionaries) {\n if (dictionary.filePath) {\n originalFillByPath.set(\n dictionary.filePath,\n dictionary.fill as Fill | undefined\n );\n }\n }\n\n const affectedDictionaryKeys = new Set<string>();\n\n targetUnmergedDictionaries.forEach((dict) => {\n affectedDictionaryKeys.add(dict.key);\n });\n\n const keysToProcess = Array.from(affectedDictionaryKeys);\n\n appLogger([\n 'Affected dictionary keys for processing:',\n keysToProcess.length > 0\n ? keysToProcess.map((key) => colorizeKey(key)).join(', ')\n : colorize('No keys found', ANSIColors.YELLOW),\n ]);\n\n if (keysToProcess.length === 0) return;\n\n /**\n * List the translations tasks\n *\n * Create a list of per-locale dictionaries to translate\n *\n * In 'complete' mode, filter only the missing locales to translate\n */\n const translationTasks: TranslationTask[] = listTranslationsTasks(\n targetUnmergedDictionaries.map((dictionary) => dictionary.localId!),\n outputLocales,\n mode,\n baseLocale,\n configuration\n );\n\n // AI calls in flight at once (translateJSON + metadata audit)\n const nbConcurrentTranslations =\n options?.nbConcurrentTranslations ?? NB_CONCURRENT_TRANSLATIONS;\n const globalLimiter = getGlobalLimiter(nbConcurrentTranslations);\n\n // NEW: number of *tasks* that may run at once (start/prepare/log/write)\n const nbConcurrentTasks = Math.max(\n 1,\n Math.min(\n options?.nbConcurrentTasks ?? nbConcurrentTranslations,\n translationTasks.length\n )\n );\n\n const taskLimiter = getTaskLimiter(nbConcurrentTasks);\n\n const runners = translationTasks.map((task) =>\n taskLimiter(async () => {\n const relativePath = relative(\n configuration?.system?.baseDir ?? process.cwd(),\n task?.dictionaryFilePath ?? ''\n );\n\n // log AFTER acquiring a task slot\n appLogger(\n `${task.dictionaryPreset} Processing ${colorizePath(basename(relativePath))}`,\n { level: 'info' }\n );\n\n const translationTaskResult = await translateDictionary(\n task,\n configuration,\n {\n mode,\n aiOptions: options?.aiOptions,\n fillMetadata: !options?.skipMetadata,\n onHandle: globalLimiter,\n aiClient,\n aiConfig,\n }\n );\n\n if (!translationTaskResult?.dictionaryOutput) return;\n\n const { dictionaryOutput, sourceLocale } = translationTaskResult;\n\n // Determine if we should write to separate files\n // - If dictionary has explicit fill setting (string, function, or object), use it\n // - If dictionary is per-locale AND has no explicit fill=false, use global fill config\n // - If dictionary is multilingual (no locale property), always write to same file\n //\n // NOTE: function-type fill values are lost during JSON serialisation of\n // unmerged_dictionaries.cjs. We recover them by checking the original\n // source file that was loaded above (originalFillByPath). Dictionary-level\n // fill always takes priority over config-level fill.\n const originalFill = originalFillByPath.get(\n dictionaryOutput.filePath ?? ''\n );\n\n // originalFill is undefined when the source file had no fill property; use\n // the (possibly JSON-preserved) dictionaryOutput.fill as a fallback so that\n // string/boolean fill values set directly on the dict still work.\n const dictFill: Fill | undefined =\n originalFill !== undefined ? originalFill : dictionaryOutput.fill;\n\n const hasDictionaryLevelFill =\n typeof dictFill === 'string' ||\n typeof dictFill === 'function' ||\n (typeof dictFill === 'object' && dictFill !== null);\n\n const isPerLocale = typeof dictionaryOutput.locale === 'string';\n\n const effectiveFill = hasDictionaryLevelFill\n ? dictFill\n : isPerLocale\n ? (configuration.dictionary?.fill ?? true)\n : false; // Multilingual dictionaries (no locale property) always write to same file unless explicitly set on the dictionary\n\n const isFillOtherFile =\n typeof effectiveFill === 'string' ||\n typeof effectiveFill === 'function' ||\n (typeof effectiveFill === 'object' && effectiveFill !== null);\n\n if (isFillOtherFile) {\n await writeFill(\n {\n ...dictionaryOutput,\n // Ensure fill is set on the dictionary for writeFill to use\n fill: effectiveFill,\n },\n outputLocales,\n [sourceLocale],\n configuration\n );\n } else {\n await writeContentDeclaration(dictionaryOutput, configuration);\n\n if (dictionaryOutput.filePath) {\n appLogger(\n `${task.dictionaryPreset} Content declaration written to ${formatPath(basename(dictionaryOutput.filePath))}`,\n { level: 'info' }\n );\n }\n }\n })\n );\n\n await Promise.all(runners);\n await (globalLimiter as any).onIdle();\n};\n"],"mappings":";;;;;;;;;;;;;;AAwCA,MAAM,6BAA6B;;;;AAmBnC,MAAa,OAAO,OAAO,YAAyC;CAClE,MAAM,gBAAgB,iBAAiB,SAAS,aAAa;CAC7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D,MAAM,UACJ;GACE,GAAG;GAEH,MAAM;EACR,GACA,eACA,CAAC,YAAY,GACb,aACF;OACK;GACL,MAAM,wBAAwB,kBAAkB,aAAa;GAE7D,IAAI,iBAAiB,UACnB,UACE,GAAG,KAAK,iBAAiB,kCAAkC,WAAW,SAAS,iBAAiB,QAAQ,CAAC,KACzG,EAAE,OAAO,OAAO,CAClB;EAEJ;CACF,CAAC,CACH;CAEA,MAAM,QAAQ,IAAI,OAAO;CACzB,MAAO,cAAsB,OAAO;AACtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"formatAutoFilledFilePath.mjs","names":[],"sources":["../../../src/fill/formatAutoFilledFilePath.ts"],"sourcesContent":["import { basename, dirname, isAbsolute, normalize, resolve } from 'node:path';\nimport { getFormatFromExtension } from '@intlayer/chokidar/utils';\nimport { GREY_DARK } from '@intlayer/config/colors';\nimport { colorize, colorizePath } from '@intlayer/config/logger';\nimport { parseFilePathPattern } from '@intlayer/config/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { FilePathPattern } from '@intlayer/types/filePathPattern';\n\nexport const formatAutoFilledFilePath = async (\n autoFillField: FilePathPattern,\n dictionaryKey: string,\n dictionaryFilePath: string,\n baseDir: string,\n configuration: IntlayerConfig,\n locale?: Locale\n): Promise<string> => {\n // Validate inputs\n if (!autoFillField) {\n throw new Error('autoFillField must be provided');\n }\n if (!dictionaryKey || typeof dictionaryKey !== 'string') {\n throw new Error('dictionaryKey must be a non-empty string');\n }\n if (!dictionaryFilePath || typeof dictionaryFilePath !== 'string') {\n throw new Error('dictionaryFilePath must be a non-empty string');\n }\n if (!baseDir || typeof baseDir !== 'string') {\n throw new Error('baseDir must be a non-empty string');\n }\n\n // Extract the original filename accurately\n const base = basename(dictionaryFilePath);\n\n const { fileExtensions } = configuration.content;\n const extensionMatch = fileExtensions.find((ext) => base.endsWith(ext));\n\n const originalFileName = extensionMatch\n ? base.slice(0, -extensionMatch.length)\n : base.split('.')[0];\n\n console.log({ extensionMatch });\n\n if (!extensionMatch) {\n throw new Error(\n `No extension found for file ${colorizePath(dictionaryFilePath)}. Valid extensions are: ${colorize(\n fileExtensions.join(', '),\n GREY_DARK\n )}`\n );\n }\n\n // Replace placeholders in autoFillField\n const result: string = await parseFilePathPattern(autoFillField, {\n key: dictionaryKey,\n fileName: originalFileName,\n locale,\n extension: extensionMatch,\n format: getFormatFromExtension(extensionMatch),\n });\n\n // Normalize the dictionary file path - if it's relative, make it absolute relative to baseDir\n const absoluteDictionaryPath = isAbsolute(dictionaryFilePath)\n ? dictionaryFilePath\n : resolve(baseDir, dictionaryFilePath);\n\n // Handle relative paths (starting with ./ or ../)\n if (result.startsWith('./') || result.startsWith('../')) {\n const fileDir = dirname(absoluteDictionaryPath);\n const resolvedPath = resolve(fileDir, result);\n\n return resolvedPath;\n }\n\n // Handle absolute paths\n if (isAbsolute(result)) {\n const normalizedResult = normalize(result);\n const normalizedBaseDir = normalize(baseDir);\n\n // Check if it's relative to baseDir (starts with /)\n // but not a system path (like /usr/local)\n if (\n result.startsWith('/') &&\n !normalizedResult.startsWith(normalizedBaseDir)\n ) {\n // Try to resolve it relative to baseDir first\n const relativeToBase = resolve(baseDir, result.substring(1));\n\n // If the path doesn't exist in common system directories, treat as relative to baseDir\n if (\n !result.startsWith('/usr/') &&\n !result.startsWith('/etc/') &&\n !result.startsWith('/var/') &&\n !result.startsWith('/home/') &&\n !result.startsWith('/Users/')\n ) {\n return relativeToBase;\n }\n }\n\n // It's a true system absolute path\n return normalizedResult;\n }\n\n // Default case: treat as relative to baseDir\n return normalize(result);\n};\n"],"mappings":";;;;;;;AASA,MAAa,2BAA2B,OACtC,eACA,eACA,oBACA,SACA,eACA,WACoB;CAEpB,IAAI,CAAC,eACH,MAAM,IAAI,MAAM,iCAAiC;CAEnD,IAAI,CAAC,iBAAiB,OAAO,kBAAkB,UAC7C,MAAM,IAAI,MAAM,2CAA2C;CAE7D,IAAI,CAAC,sBAA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,OAAO"}
1
+ {"version":3,"file":"formatAutoFilledFilePath.mjs","names":[],"sources":["../../../src/fill/formatAutoFilledFilePath.ts"],"sourcesContent":["import { basename, dirname, isAbsolute, normalize, resolve } from 'node:path';\nimport { getFormatFromExtension } from '@intlayer/chokidar/utils';\nimport { GREY_DARK } from '@intlayer/config/colors';\nimport { colorize, colorizePath } from '@intlayer/config/logger';\nimport { parseFilePathPattern } from '@intlayer/config/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { FilePathPattern } from '@intlayer/types/filePathPattern';\n\nexport const formatAutoFilledFilePath = async (\n autoFillField: FilePathPattern,\n dictionaryKey: string,\n dictionaryFilePath: string,\n baseDir: string,\n configuration: IntlayerConfig,\n locale?: Locale\n): Promise<string> => {\n // Validate inputs\n if (!autoFillField) {\n throw new Error('autoFillField must be provided');\n }\n if (!dictionaryKey || typeof dictionaryKey !== 'string') {\n throw new Error('dictionaryKey must be a non-empty string');\n }\n if (!dictionaryFilePath || typeof dictionaryFilePath !== 'string') {\n throw new Error('dictionaryFilePath must be a non-empty string');\n }\n if (!baseDir || typeof baseDir !== 'string') {\n throw new Error('baseDir must be a non-empty string');\n }\n\n // Extract the original filename accurately\n const base = basename(dictionaryFilePath);\n\n const { fileExtensions } = configuration.content;\n const extensionMatch = fileExtensions.find((ext) => base.endsWith(ext));\n\n const originalFileName = extensionMatch\n ? base.slice(0, -extensionMatch.length)\n : base.split('.')[0];\n\n console.log({ extensionMatch });\n\n if (!extensionMatch) {\n throw new Error(\n `No extension found for file ${colorizePath(dictionaryFilePath)}. Valid extensions are: ${colorize(\n fileExtensions.join(', '),\n GREY_DARK\n )}`\n );\n }\n\n // Replace placeholders in autoFillField\n const result: string = await parseFilePathPattern(autoFillField, {\n key: dictionaryKey,\n fileName: originalFileName,\n locale,\n extension: extensionMatch,\n format: getFormatFromExtension(extensionMatch),\n });\n\n // Normalize the dictionary file path - if it's relative, make it absolute relative to baseDir\n const absoluteDictionaryPath = isAbsolute(dictionaryFilePath)\n ? dictionaryFilePath\n : resolve(baseDir, dictionaryFilePath);\n\n // Handle relative paths (starting with ./ or ../)\n if (result.startsWith('./') || result.startsWith('../')) {\n const fileDir = dirname(absoluteDictionaryPath);\n const resolvedPath = resolve(fileDir, result);\n\n return resolvedPath;\n }\n\n // Handle absolute paths\n if (isAbsolute(result)) {\n const normalizedResult = normalize(result);\n const normalizedBaseDir = normalize(baseDir);\n\n // Check if it's relative to baseDir (starts with /)\n // but not a system path (like /usr/local)\n if (\n result.startsWith('/') &&\n !normalizedResult.startsWith(normalizedBaseDir)\n ) {\n // Try to resolve it relative to baseDir first\n const relativeToBase = resolve(baseDir, result.substring(1));\n\n // If the path doesn't exist in common system directories, treat as relative to baseDir\n if (\n !result.startsWith('/usr/') &&\n !result.startsWith('/etc/') &&\n !result.startsWith('/var/') &&\n !result.startsWith('/home/') &&\n !result.startsWith('/Users/')\n ) {\n return relativeToBase;\n }\n }\n\n // It's a true system absolute path\n return normalizedResult;\n }\n\n // Default case: treat as relative to baseDir\n return normalize(result);\n};\n"],"mappings":";;;;;;;AASA,MAAa,2BAA2B,OACtC,eACA,eACA,oBACA,SACA,eACA,WACoB;CAEpB,IAAI,CAAC,eACH,MAAM,IAAI,MAAM,gCAAgC;CAElD,IAAI,CAAC,iBAAiB,OAAO,kBAAkB,UAC7C,MAAM,IAAI,MAAM,0CAA0C;CAE5D,IAAI,CAAC,sBAAsB,OAAO,uBAAuB,UACvD,MAAM,IAAI,MAAM,+CAA+C;CAEjE,IAAI,CAAC,WAAW,OAAO,YAAY,UACjC,MAAM,IAAI,MAAM,oCAAoC;CAItD,MAAM,OAAO,SAAS,kBAAkB;CAExC,MAAM,EAAE,mBAAmB,cAAc;CACzC,MAAM,iBAAiB,eAAe,MAAM,QAAQ,KAAK,SAAS,GAAG,CAAC;CAEtE,MAAM,mBAAmB,iBACrB,KAAK,MAAM,GAAG,CAAC,eAAe,MAAM,IACpC,KAAK,MAAM,GAAG,EAAE;CAEpB,QAAQ,IAAI,EAAE,eAAe,CAAC;CAE9B,IAAI,CAAC,gBACH,MAAM,IAAI,MACR,+BAA+B,aAAa,kBAAkB,EAAE,0BAA0B,SACxF,eAAe,KAAK,IAAI,GACxB,SACF,GACF;CAIF,MAAM,SAAiB,MAAM,qBAAqB,eAAe;EAC/D,KAAK;EACL,UAAU;EACV;EACA,WAAW;EACX,QAAQ,uBAAuB,cAAc;CAC/C,CAAC;CAGD,MAAM,yBAAyB,WAAW,kBAAkB,IACxD,qBACA,QAAQ,SAAS,kBAAkB;CAGvC,IAAI,OAAO,WAAW,IAAI,KAAK,OAAO,WAAW,KAAK,GAIpD,OAFqB,QADL,QAAQ,sBACW,GAAG,MAEpB;CAIpB,IAAI,WAAW,MAAM,GAAG;EACtB,MAAM,mBAAmB,UAAU,MAAM;EACzC,MAAM,oBAAoB,UAAU,OAAO;EAI3C,IACE,OAAO,WAAW,GAAG,KACrB,CAAC,iBAAiB,WAAW,iBAAiB,GAC9C;GAEA,MAAM,iBAAiB,QAAQ,SAAS,OAAO,UAAU,CAAC,CAAC;GAG3D,IACE,CAAC,OAAO,WAAW,OAAO,KAC1B,CAAC,OAAO,WAAW,OAAO,KAC1B,CAAC,OAAO,WAAW,OAAO,KAC1B,CAAC,OAAO,WAAW,QAAQ,KAC3B,CAAC,OAAO,WAAW,SAAS,GAE5B,OAAO;EAEX;EAGA,OAAO;CACT;CAGA,OAAO,UAAU,MAAM;AACzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"formatFillData.mjs","names":[],"sources":["../../../src/fill/formatFillData.ts"],"sourcesContent":["import { basename, dirname, extname, relative } from 'node:path';\nimport { getFormatFromExtension } from '@intlayer/chokidar/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { DictionaryKey, Fill } from '@intlayer/types/dictionary';\nimport type { FilePathPatternContext } from '@intlayer/types/filePathPattern';\nimport {\n getPatternForLocale,\n resolveOutputPattern,\n} from '../utils/getOutputFilePath';\n\nexport type FillData = {\n localeList: Locale[];\n filePath: string;\n isPerLocale: boolean;\n};\n\n/** Merge FillData entries that resolve to the same file path. */\nconst groupByFilePath = (entries: FillData[]): FillData[] =>\n entries.reduce((acc, curr) => {\n const existing = acc.find((item) => item.filePath === curr.filePath);\n if (existing) {\n for (const loc of curr.localeList) {\n if (!existing.localeList.includes(loc)) existing.localeList.push(loc);\n }\n // Multiple locales sharing one path → multilingual file\n existing.isPerLocale = false;\n } else {\n acc.push(curr);\n }\n return acc;\n }, [] as FillData[]);\n\nexport const formatFillData = async (\n fillField: Fill,\n localeList: Locale[],\n filePath: string,\n dictionaryKey: DictionaryKey,\n configuration: IntlayerConfig\n): Promise<FillData[]> => {\n if (!fillField || typeof fillField === 'boolean') return [];\n\n const { baseDir } = configuration.system;\n const { defaultLocale, locales } = configuration.internationalization;\n\n const extension = extname(filePath);\n const base = basename(filePath);\n\n const { fileExtensions } = configuration.content;\n const extensionMatch = fileExtensions.find((ext) => base.endsWith(ext));\n\n let cleanComponentFileName = extensionMatch\n ? base.slice(0, -extensionMatch.length)\n : base.split('.')[0];\n\n // Strip source locale if present\n const sourceLocaleMatch = locales.find((loc) =>\n cleanComponentFileName.endsWith(`.${loc}`)\n );\n if (sourceLocaleMatch) {\n cleanComponentFileName = cleanComponentFileName.slice(\n 0,\n -(sourceLocaleMatch.length + 1)\n );\n }\n\n const uncapitalizedName =\n cleanComponentFileName.charAt(0).toLowerCase() +\n cleanComponentFileName.slice(1);\n const componentFormat = getFormatFromExtension(extension);\n\n const getContext = (\n locale: Locale,\n patternString?: string\n ): FilePathPatternContext => {\n let format: FilePathPatternContext['format'] = 'json';\n if (patternString) {\n const extFormat = getFormatFromExtension(extname(patternString) as any);\n if (extFormat) format = extFormat as any;\n }\n return {\n key: dictionaryKey,\n componentDirPath: relative(baseDir, dirname(filePath)),\n componentFileName: cleanComponentFileName,\n fileName: uncapitalizedName,\n componentFormat:\n componentFormat as FilePathPatternContext['componentFormat'],\n componentExtension:\n extension as FilePathPatternContext['componentExtension'],\n format,\n locale,\n extension:\n configuration.content.fileExtensions.find((ext) =>\n ext.endsWith(extension)\n ) ?? configuration.content.fileExtensions[0],\n };\n };\n\n /**\n * Evaluate a scalar Fill pattern (string or function) for a list of locales.\n *\n * - Uses a dummy locale probe to detect whether the pattern varies per locale.\n * - `forcePerLocale` overrides the probe for object-fill entries where each\n * locale always maps to its own dedicated file regardless of whether the\n * path itself contains the locale string.\n */\n const processPattern = async (\n pattern: Fill,\n locales: Locale[],\n forcePerLocale = false\n ): Promise<FillData[]> => {\n const dummyLocale = '###########locale###########' as Locale;\n const patternString = typeof pattern === 'string' ? pattern : undefined;\n\n const dummyPath = await resolveOutputPattern(\n pattern,\n dummyLocale,\n getContext(dummyLocale, patternString),\n filePath,\n baseDir\n );\n const isPatternPerLocale =\n forcePerLocale ||\n (typeof dummyPath === 'string' && dummyPath.includes(dummyLocale));\n\n if (isPatternPerLocale) {\n const resolvedPaths: FillData[] = [];\n for (const locale of locales) {\n const absolutePath = await resolveOutputPattern(\n pattern,\n locale,\n getContext(locale, patternString),\n filePath,\n baseDir\n );\n if (absolutePath !== false) {\n resolvedPaths.push({\n filePath: absolutePath,\n localeList: [locale],\n isPerLocale: true,\n });\n }\n }\n return groupByFilePath(resolvedPaths);\n }\n\n // Single multilingual path — resolve using the default locale for context\n const absolutePath = await resolveOutputPattern(\n pattern,\n defaultLocale as Locale,\n getContext(defaultLocale as Locale, patternString),\n filePath,\n baseDir\n );\n if (absolutePath === false) return [];\n return [\n { filePath: absolutePath, localeList: locales, isPerLocale: false },\n ];\n };\n\n // Object fill: each locale key maps to its own pattern.\n // Object fill entries are always per-locale in intent (each locale → its own file).\n if (typeof fillField === 'object' && fillField !== null) {\n const results: FillData[] = [];\n for (const locale of localeList) {\n const pattern = getPatternForLocale(fillField, locale);\n if (pattern) {\n const res = await processPattern(pattern, [locale], true);\n results.push(...res);\n }\n }\n return groupByFilePath(results);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mjs","names":[],"sources":["../../../src/fill/formatFillData.ts"],"sourcesContent":["import { basename, dirname, extname, relative } from 'node:path';\nimport { getFormatFromExtension } from '@intlayer/chokidar/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { DictionaryKey, Fill } from '@intlayer/types/dictionary';\nimport type { FilePathPatternContext } from '@intlayer/types/filePathPattern';\nimport {\n getPatternForLocale,\n resolveOutputPattern,\n} from '../utils/getOutputFilePath';\n\nexport type FillData = {\n localeList: Locale[];\n filePath: string;\n isPerLocale: boolean;\n};\n\n/** Merge FillData entries that resolve to the same file path. */\nconst groupByFilePath = (entries: FillData[]): FillData[] =>\n entries.reduce((acc, curr) => {\n const existing = acc.find((item) => item.filePath === curr.filePath);\n if (existing) {\n for (const loc of curr.localeList) {\n if (!existing.localeList.includes(loc)) existing.localeList.push(loc);\n }\n // Multiple locales sharing one path → multilingual file\n existing.isPerLocale = false;\n } else {\n acc.push(curr);\n }\n return acc;\n }, [] as FillData[]);\n\nexport const formatFillData = async (\n fillField: Fill,\n localeList: Locale[],\n filePath: string,\n dictionaryKey: DictionaryKey,\n configuration: IntlayerConfig\n): Promise<FillData[]> => {\n if (!fillField || typeof fillField === 'boolean') return [];\n\n const { baseDir } = configuration.system;\n const { defaultLocale, locales } = configuration.internationalization;\n\n const extension = extname(filePath);\n const base = basename(filePath);\n\n const { fileExtensions } = configuration.content;\n const extensionMatch = fileExtensions.find((ext) => base.endsWith(ext));\n\n let cleanComponentFileName = extensionMatch\n ? base.slice(0, -extensionMatch.length)\n : base.split('.')[0];\n\n // Strip source locale if present\n const sourceLocaleMatch = locales.find((loc) =>\n cleanComponentFileName.endsWith(`.${loc}`)\n );\n if (sourceLocaleMatch) {\n cleanComponentFileName = cleanComponentFileName.slice(\n 0,\n -(sourceLocaleMatch.length + 1)\n );\n }\n\n const uncapitalizedName =\n cleanComponentFileName.charAt(0).toLowerCase() +\n cleanComponentFileName.slice(1);\n const componentFormat = getFormatFromExtension(extension);\n\n const getContext = (\n locale: Locale,\n patternString?: string\n ): FilePathPatternContext => {\n let format: FilePathPatternContext['format'] = 'json';\n if (patternString) {\n const extFormat = getFormatFromExtension(extname(patternString) as any);\n if (extFormat) format = extFormat as any;\n }\n return {\n key: dictionaryKey,\n componentDirPath: relative(baseDir, dirname(filePath)),\n componentFileName: cleanComponentFileName,\n fileName: uncapitalizedName,\n componentFormat:\n componentFormat as FilePathPatternContext['componentFormat'],\n componentExtension:\n extension as FilePathPatternContext['componentExtension'],\n format,\n locale,\n extension:\n configuration.content.fileExtensions.find((ext) =>\n ext.endsWith(extension)\n ) ?? configuration.content.fileExtensions[0],\n };\n };\n\n /**\n * Evaluate a scalar Fill pattern (string or function) for a list of locales.\n *\n * - Uses a dummy locale probe to detect whether the pattern varies per locale.\n * - `forcePerLocale` overrides the probe for object-fill entries where each\n * locale always maps to its own dedicated file regardless of whether the\n * path itself contains the locale string.\n */\n const processPattern = async (\n pattern: Fill,\n locales: Locale[],\n forcePerLocale = false\n ): Promise<FillData[]> => {\n const dummyLocale = '###########locale###########' as Locale;\n const patternString = typeof pattern === 'string' ? pattern : undefined;\n\n const dummyPath = await resolveOutputPattern(\n pattern,\n dummyLocale,\n getContext(dummyLocale, patternString),\n filePath,\n baseDir\n );\n const isPatternPerLocale =\n forcePerLocale ||\n (typeof dummyPath === 'string' && dummyPath.includes(dummyLocale));\n\n if (isPatternPerLocale) {\n const resolvedPaths: FillData[] = [];\n for (const locale of locales) {\n const absolutePath = await resolveOutputPattern(\n pattern,\n locale,\n getContext(locale, patternString),\n filePath,\n baseDir\n );\n if (absolutePath !== false) {\n resolvedPaths.push({\n filePath: absolutePath,\n localeList: [locale],\n isPerLocale: true,\n });\n }\n }\n return groupByFilePath(resolvedPaths);\n }\n\n // Single multilingual path — resolve using the default locale for context\n const absolutePath = await resolveOutputPattern(\n pattern,\n defaultLocale as Locale,\n getContext(defaultLocale as Locale, patternString),\n filePath,\n baseDir\n );\n if (absolutePath === false) return [];\n return [\n { filePath: absolutePath, localeList: locales, isPerLocale: false },\n ];\n };\n\n // Object fill: each locale key maps to its own pattern.\n // Object fill entries are always per-locale in intent (each locale → its own file).\n if (typeof fillField === 'object' && fillField !== null) {\n const results: FillData[] = [];\n for (const locale of localeList) {\n const pattern = getPatternForLocale(fillField, locale);\n if (pattern) {\n const res = await processPattern(pattern, [locale], true);\n results.push(...res);\n }\n }\n return groupByFilePath(results);\n }\n\n // Scalar string or function pattern\n return processPattern(fillField, localeList);\n};\n"],"mappings":";;;;;;AAkBA,MAAM,mBAAmB,YACvB,QAAQ,QAAQ,KAAK,SAAS;CAC5B,MAAM,WAAW,IAAI,MAAM,SAAS,KAAK,aAAa,KAAK,QAAQ;CACnE,IAAI,UAAU;EACZ,KAAK,MAAM,OAAO,KAAK,YACrB,IAAI,CAAC,SAAS,WAAW,SAAS,GAAG,GAAG,SAAS,WAAW,KAAK,GAAG;EAGtE,SAAS,cAAc;CACzB,OACE,IAAI,KAAK,IAAI;CAEf,OAAO;AACT,GAAG,CAAC,CAAe;AAErB,MAAa,iBAAiB,OAC5B,WACA,YACA,UACA,eACA,kBACwB;CACxB,IAAI,CAAC,aAAa,OAAO,cAAc,WAAW,OAAO,CAAC;CAE1D,MAAM,EAAE,YAAY,cAAc;CAClC,MAAM,EAAE,eAAe,YAAY,cAAc;CAEjD,MAAM,YAAY,QAAQ,QAAQ;CAClC,MAAM,OAAO,SAAS,QAAQ;CAE9B,MAAM,EAAE,mBAAmB,cAAc;CACzC,MAAM,iBAAiB,eAAe,MAAM,QAAQ,KAAK,SAAS,GAAG,CAAC;CAEtE,IAAI,yBAAyB,iBACzB,KAAK,MAAM,GAAG,CAAC,eAAe,MAAM,IACpC,KAAK,MAAM,GAAG,EAAE;CAGpB,MAAM,oBAAoB,QAAQ,MAAM,QACtC,uBAAuB,SAAS,IAAI,KAAK,CAC3C;CACA,IAAI,mBACF,yBAAyB,uBAAuB,MAC9C,GACA,EAAE,kBAAkB,SAAS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AAc,MAAM;EACvD,MAAM,UAAsB,CAAC;EAC7B,KAAK,MAAM,UAAU,YAAY;GAC/B,MAAM,UAAU,oBAAoB,WAAW,MAAM;GACrD,IAAI,SAAS;IACX,MAAM,MAAM,MAAM,eAAe,SAAS,CAAC,MAAM,GAAG,IAAI;IACxD,QAAQ,KAAK,GAAG,GAAG;GACrB;EACF;EACA,OAAO,gBAAgB,OAAO;CAChC;CAGA,OAAO,eAAe,WAAW,UAAU;AAC7C"}
@@ -1 +1 @@
1
- {"version":3,"file":"getAvailableLocalesInDictionary.mjs","names":[],"sources":["../../../src/fill/getAvailableLocalesInDictionary.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\nimport type { Locale } from '@intlayer/types/allLocales';\n\n/**\n * Recursively traverses dictionary content to find all locales that have actual translations.\n * Returns a Set of locale strings that are present in the translation nodes.\n */\nconst extractLocalesFromContent = (\n content: any,\n locales: Set<Locale> = new Set()\n): Set<Locale> => {\n if (!content || typeof content !== 'object') {\n return locales;\n }\n\n // Check if this is a translation node\n if (content.nodeType === 'translation' && content.translation) {\n // Add all locale keys from the translation map\n Object.keys(content.translation).forEach((locale) => {\n locales.add(locale as Locale);\n });\n }\n\n // Recursively check nested objects\n for (const value of Object.values(content)) {\n if (value && typeof value === 'object') {\n extractLocalesFromContent(value, locales);\n }\n }\n\n return locales;\n};\n\n/**\n * Gets all locales that have actual translations in the dictionary content.\n * Only returns locales that are present in at least one translation node.\n */\nexport const getAvailableLocalesInDictionary = (\n dictionary: Dictionary\n): Locale[] => {\n const localesSet = extractLocalesFromContent(dictionary.content);\n return Array.from(localesSet);\n};\n"],"mappings":";;;;;AAOA,MAAM,6BACJ,SACA,0BAAuB,IAAI,KAAK,KAChB;CAChB,IAAI,CAAC,WAAW,OAAO,YAAY,UACjC,OAAO;CAIT,IAAI,QAAQ,aAAa,iBAAiB,QAAQ,aAEhD,OAAO,KAAK,QAAQ,YAAY,CAAC,SAAS,WAAW;EACnD,QAAQ,IAAI,OAAiB;GAC7B;CAIJ,KAAK,MAAM,SAAS,OAAO,OAAO,QAAQ,EACxC,IAAI,SAAS,OAAO,UAAU,UAC5B,0BAA0B,OAAO,QAAQ;CAI7C,OAAO;;;;;;AAOT,MAAa,mCACX,eACa;CACb,MAAM,aAAa,0BAA0B,WAAW,QAAQ;CAChE,OAAO,MAAM,KAAK,WAAW"}
1
+ {"version":3,"file":"getAvailableLocalesInDictionary.mjs","names":[],"sources":["../../../src/fill/getAvailableLocalesInDictionary.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types/allLocales';\nimport type { Dictionary } from '@intlayer/types/dictionary';\n\n/**\n * Recursively traverses dictionary content to find all locales that have actual translations.\n * Returns a Set of locale strings that are present in the translation nodes.\n */\nconst extractLocalesFromContent = (\n content: any,\n locales: Set<Locale> = new Set()\n): Set<Locale> => {\n if (!content || typeof content !== 'object') {\n return locales;\n }\n\n // Check if this is a translation node\n if (content.nodeType === 'translation' && content.translation) {\n // Add all locale keys from the translation map\n Object.keys(content.translation).forEach((locale) => {\n locales.add(locale as Locale);\n });\n }\n\n // Recursively check nested objects\n for (const value of Object.values(content)) {\n if (value && typeof value === 'object') {\n extractLocalesFromContent(value, locales);\n }\n }\n\n return locales;\n};\n\n/**\n * Gets all locales that have actual translations in the dictionary content.\n * Only returns locales that are present in at least one translation node.\n */\nexport const getAvailableLocalesInDictionary = (\n dictionary: Dictionary\n): Locale[] => {\n const localesSet = extractLocalesFromContent(dictionary.content);\n return Array.from(localesSet);\n};\n"],"mappings":";;;;;AAOA,MAAM,6BACJ,SACA,0BAAuB,IAAI,IAAI,MACf;CAChB,IAAI,CAAC,WAAW,OAAO,YAAY,UACjC,OAAO;CAIT,IAAI,QAAQ,aAAa,iBAAiB,QAAQ,aAEhD,OAAO,KAAK,QAAQ,WAAW,EAAE,SAAS,WAAW;EACnD,QAAQ,IAAI,MAAgB;CAC9B,CAAC;CAIH,KAAK,MAAM,SAAS,OAAO,OAAO,OAAO,GACvC,IAAI,SAAS,OAAO,UAAU,UAC5B,0BAA0B,OAAO,OAAO;CAI5C,OAAO;AACT;;;;;AAMA,MAAa,mCACX,eACa;CACb,MAAM,aAAa,0BAA0B,WAAW,OAAO;CAC/D,OAAO,MAAM,KAAK,UAAU;AAC9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"getFilterMissingContentPerLocale.mjs","names":[],"sources":["../../../src/fill/getFilterMissingContentPerLocale.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\n\n/**\n * Recursively compares source content with target content and returns only the missing parts.\n * For per-locale files where content is simple JSON (not translation nodes).\n *\n * @param sourceContent - The source content to check\n * @param targetContent - The existing target content\n * @returns Only the content that's missing in the target\n */\nconst filterMissingContent = (sourceContent: any, targetContent: any): any => {\n // Source is null - only missing if target doesn't already have null\n if (sourceContent === null) {\n return targetContent === null ? undefined : null;\n }\n\n // If target doesn't exist or is null, all source content is missing\n if (targetContent === undefined || targetContent === null) {\n return sourceContent;\n }\n\n // Primitive values: if target exists (even if empty string), consider it translated\n if (typeof sourceContent !== 'object') {\n return undefined;\n }\n\n // Handle arrays\n if (Array.isArray(sourceContent)) {\n if (!Array.isArray(targetContent)) {\n return sourceContent;\n }\n\n const missingItems = sourceContent\n .map((item, index) => filterMissingContent(item, targetContent[index]))\n .filter((item) => item !== undefined);\n\n return missingItems.length > 0 ? missingItems : undefined;\n }\n\n // Handle objects\n const result: any = {};\n let hasMissingContent = false;\n\n for (const [key, value] of Object.entries(sourceContent)) {\n const targetValue = targetContent?.[key];\n const missingValue = filterMissingContent(value, targetValue);\n\n if (missingValue !== undefined) {\n result[key] = missingValue;\n hasMissingContent = true;\n }\n }\n\n return hasMissingContent ? result : undefined;\n};\n\n/**\n * Filters a dictionary to only include content that's missing in the target dictionary.\n * Used for per-locale content declarations in 'complete' mode.\n *\n * @param sourceDictionary - The source dictionary with content to translate\n * @param targetDictionary - The existing target dictionary\n * @returns A dictionary with only the missing content\n */\nexport const getFilterMissingContentPerLocale = (\n sourceDictionary: Dictionary,\n targetDictionary: Dictionary | undefined\n): Dictionary => {\n if (!targetDictionary || !targetDictionary.content) {\n // If no target exists, all source content is missing\n return sourceDictionary;\n }\n\n const missingContent = filterMissingContent(\n sourceDictionary.content,\n targetDictionary.content\n );\n\n return {\n ...sourceDictionary,\n content: missingContent ?? {},\n };\n};\n"],"mappings":";;;;;;;;;AAUA,MAAM,wBAAwB,eAAoB,kBAA4B;CAE5E,IAAI,kBAAkB,MACpB,OAAO,kBAAkB,OAAO,SAAY;CAI9C,IAAI,kBAAkB,UAAa,kBAAkB,MACnD,OAAO;CAIT,IAAI,OAAO,kBAAkB,UAC3B;CAIF,IAAI,MAAM,QAAQ,cAAc,EAAE;EAChC,IAAI,CAAC,MAAM,QAAQ,cAAc,EAC/B,OAAO;EAGT,MAAM,eAAe,cAClB,KAAK,MAAM,UAAU,qBAAqB,MAAM,cAAc,OAAO,CAAC,CACtE,QAAQ,SAAS,SAAS,OAAU;EAEvC,OAAO,aAAa,SAAS,IAAI,eAAe;;CAIlD,MAAM,SAAc,EAAE;CACtB,IAAI,oBAAoB;CAExB,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,cAAc,EAAE;EACxD,MAAM,cAAc,gBAAgB;EACpC,MAAM,eAAe,qBAAqB,OAAO,YAAY;EAE7D,IAAI,iBAAiB,QAAW;GAC9B,OAAO,OAAO;GACd,oBAAoB;;;CAIxB,OAAO,oBAAoB,SAAS;;;;;;;;;;AAWtC,MAAa,oCACX,kBACA,qBACe;CACf,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,SAEzC,OAAO;CAGT,MAAM,iBAAiB,qBACrB,iBAAiB,SACjB,iBAAiB,QAClB;CAED,OAAO;EACL,GAAG;EACH,SAAS,kBAAkB,EAAE;EAC9B"}
1
+ {"version":3,"file":"getFilterMissingContentPerLocale.mjs","names":[],"sources":["../../../src/fill/getFilterMissingContentPerLocale.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\n\n/**\n * Recursively compares source content with target content and returns only the missing parts.\n * For per-locale files where content is simple JSON (not translation nodes).\n *\n * @param sourceContent - The source content to check\n * @param targetContent - The existing target content\n * @returns Only the content that's missing in the target\n */\nconst filterMissingContent = (sourceContent: any, targetContent: any): any => {\n // Source is null - only missing if target doesn't already have null\n if (sourceContent === null) {\n return targetContent === null ? undefined : null;\n }\n\n // If target doesn't exist or is null, all source content is missing\n if (targetContent === undefined || targetContent === null) {\n return sourceContent;\n }\n\n // Primitive values: if target exists (even if empty string), consider it translated\n if (typeof sourceContent !== 'object') {\n return undefined;\n }\n\n // Handle arrays\n if (Array.isArray(sourceContent)) {\n if (!Array.isArray(targetContent)) {\n return sourceContent;\n }\n\n const missingItems = sourceContent\n .map((item, index) => filterMissingContent(item, targetContent[index]))\n .filter((item) => item !== undefined);\n\n return missingItems.length > 0 ? missingItems : undefined;\n }\n\n // Handle objects\n const result: any = {};\n let hasMissingContent = false;\n\n for (const [key, value] of Object.entries(sourceContent)) {\n const targetValue = targetContent?.[key];\n const missingValue = filterMissingContent(value, targetValue);\n\n if (missingValue !== undefined) {\n result[key] = missingValue;\n hasMissingContent = true;\n }\n }\n\n return hasMissingContent ? result : undefined;\n};\n\n/**\n * Filters a dictionary to only include content that's missing in the target dictionary.\n * Used for per-locale content declarations in 'complete' mode.\n *\n * @param sourceDictionary - The source dictionary with content to translate\n * @param targetDictionary - The existing target dictionary\n * @returns A dictionary with only the missing content\n */\nexport const getFilterMissingContentPerLocale = (\n sourceDictionary: Dictionary,\n targetDictionary: Dictionary | undefined\n): Dictionary => {\n if (!targetDictionary || !targetDictionary.content) {\n // If no target exists, all source content is missing\n return sourceDictionary;\n }\n\n const missingContent = filterMissingContent(\n sourceDictionary.content,\n targetDictionary.content\n );\n\n return {\n ...sourceDictionary,\n content: missingContent ?? {},\n };\n};\n"],"mappings":";;;;;;;;;AAUA,MAAM,wBAAwB,eAAoB,kBAA4B;CAE5E,IAAI,kBAAkB,MACpB,OAAO,kBAAkB,OAAO,SAAY;CAI9C,IAAI,kBAAkB,UAAa,kBAAkB,MACnD,OAAO;CAIT,IAAI,OAAO,kBAAkB,UAC3B;CAIF,IAAI,MAAM,QAAQ,aAAa,GAAG;EAChC,IAAI,CAAC,MAAM,QAAQ,aAAa,GAC9B,OAAO;EAGT,MAAM,eAAe,cAClB,KAAK,MAAM,UAAU,qBAAqB,MAAM,cAAc,MAAM,CAAC,EACrE,QAAQ,SAAS,SAAS,MAAS;EAEtC,OAAO,aAAa,SAAS,IAAI,eAAe;CAClD;CAGA,MAAM,SAAc,CAAC;CACrB,IAAI,oBAAoB;CAExB,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,aAAa,GAAG;EACxD,MAAM,cAAc,gBAAgB;EACpC,MAAM,eAAe,qBAAqB,OAAO,WAAW;EAE5D,IAAI,iBAAiB,QAAW;GAC9B,OAAO,OAAO;GACd,oBAAoB;EACtB;CACF;CAEA,OAAO,oBAAoB,SAAS;AACtC;;;;;;;;;AAUA,MAAa,oCACX,kBACA,qBACe;CACf,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,SAEzC,OAAO;CAGT,MAAM,iBAAiB,qBACrB,iBAAiB,SACjB,iBAAiB,OACnB;CAEA,OAAO;EACL,GAAG;EACH,SAAS,kBAAkB,CAAC;CAC9B;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"listTranslationsTasks.mjs","names":[],"sources":["../../../src/fill/listTranslationsTasks.ts"],"sourcesContent":["import { basename } from 'node:path';\nimport { formatLocale } from '@intlayer/chokidar/utils';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colon,\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport { getFilterTranslationsOnlyDictionary } from '@intlayer/core/plugins';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary, LocalDictionaryId } from '@intlayer/types/dictionary';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport { listMissingTranslationsWithConfig } from '../test';\n\nexport type TranslationTask = {\n dictionaryKey: string;\n dictionaryLocalId: LocalDictionaryId;\n sourceLocale: Locale;\n targetLocales: Locale[];\n dictionaryPreset: string;\n dictionaryFilePath: string;\n};\n\nexport const listTranslationsTasks = (\n localIds: LocalDictionaryId[],\n outputLocales: Locale[],\n mode: 'complete' | 'review',\n baseLocale: Locale,\n configuration: IntlayerConfig\n): TranslationTask[] => {\n const appLogger = getAppLogger(configuration);\n\n const mergedDictionariesRecord = getDictionaries(configuration);\n const unmergedDictionariesRecord = getUnmergedDictionaries(configuration);\n\n const allFlatDictionaries = Object.values(unmergedDictionariesRecord).flat();\n const dictionariesToProcess = allFlatDictionaries.filter((dictionary) =>\n localIds.includes(dictionary.localId!)\n );\n\n const { missingTranslations } =\n listMissingTranslationsWithConfig(configuration);\n\n const maxKeyLength = Math.max(\n ...dictionariesToProcess.map((dictionary) => dictionary.key.length)\n );\n\n const translationTasks: TranslationTask[] = [];\n\n for (const targetUnmergedDictionary of dictionariesToProcess) {\n const dictionaryPreset = colon(\n [\n ' - ',\n colorize('[', ANSIColors.GREY_DARK),\n colorizeKey(targetUnmergedDictionary.key),\n colorize(']', ANSIColors.GREY_DARK),\n ].join(''),\n { colSize: maxKeyLength + 6 }\n );\n\n const dictionaryKey = targetUnmergedDictionary.key;\n const dictionaryLocalId = targetUnmergedDictionary.localId!;\n const mainDictionaryToProcess: Dictionary =\n mergedDictionariesRecord[dictionaryKey];\n const dictionaryFilled = targetUnmergedDictionary.filled ?? false;\n\n if (dictionaryFilled === true) {\n continue;\n }\n\n const dictionaryFill =\n targetUnmergedDictionary.fill ?? configuration.dictionary?.fill ?? false;\n\n if (dictionaryFill === false) continue;\n\n const sourceLocale: Locale = (targetUnmergedDictionary.locale ??\n baseLocale) as Locale;\n\n if (!mainDictionaryToProcess) {\n appLogger(\n `${dictionaryPreset} Dictionary not found in dictionariesRecord. Skipping.`,\n {\n level: 'warn',\n }\n );\n continue;\n }\n\n if (!targetUnmergedDictionary.filePath) {\n appLogger(`${dictionaryPreset} Dictionary has no file path. Skipping.`, {\n level: 'warn',\n });\n continue;\n }\n\n const sourceLocaleContent = getFilterTranslationsOnlyDictionary(\n mainDictionaryToProcess,\n sourceLocale\n );\n\n if (\n Object.keys(sourceLocaleContent as Record<string, unknown>).length === 0\n ) {\n appLogger(\n `${dictionaryPreset} No content found for dictionary in source locale ${formatLocale(sourceLocale)}. Skipping translation for this dictionary.`,\n {\n level: 'warn',\n }\n );\n continue;\n }\n\n /**\n * In 'complete' mode, filter only the missing locales to translate\n *\n * Skip the dictionary if there are no missing locales to translate\n */\n let outputLocalesList: Locale[] = outputLocales as Locale[];\n\n if (mode === 'complete') {\n outputLocalesList =\n missingTranslations\n .find(\n (missingTranslation) => missingTranslation.key === dictionaryKey\n )\n ?.locales.filter((locale) => outputLocales.includes(locale)) ?? [];\n }\n\n if (outputLocalesList.length === 0) {\n appLogger(\n `${dictionaryPreset} ${colorize('No locales to fill, Skipping', ANSIColors.GREY_DARK)} ${colorizePath(basename(targetUnmergedDictionary.filePath))}`,\n {\n level: 'warn',\n }\n );\n continue;\n }\n\n translationTasks.push({\n dictionaryKey,\n dictionaryLocalId,\n sourceLocale,\n targetLocales: outputLocalesList,\n dictionaryPreset,\n dictionaryFilePath: targetUnmergedDictionary.filePath,\n });\n }\n\n // Return the list of tasks to execute\n return translationTasks;\n};\n"],"mappings":";;;;;;;;;;AA2BA,MAAa,yBACX,UACA,eACA,MACA,YACA,kBACsB;CACtB,MAAM,YAAY,aAAa,cAAc;CAE7C,MAAM,2BAA2B,gBAAgB,cAAc;CAC/D,MAAM,6BAA6B,wBAAwB,cAAc;CAGzE,MAAM,wBADsB,OAAO,OAAO,2BAA2B,CAAC,MACrB,CAAC,QAAQ,eACxD,SAAS,SAAS,WAAW,QAAS,CACvC;CAED,MAAM,EAAE,wBACN,kCAAkC,cAAc;C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AAiB,KAAK;GACpB;GACA;GACA;GACA,eAAe;GACf;GACA,oBAAoB,yBAAyB;GAC9C,CAAC;;CAIJ,OAAO"}
1
+ {"version":3,"file":"listTranslationsTasks.mjs","names":[],"sources":["../../../src/fill/listTranslationsTasks.ts"],"sourcesContent":["import { basename } from 'node:path';\nimport { formatLocale } from '@intlayer/chokidar/utils';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colon,\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport { getFilterTranslationsOnlyDictionary } from '@intlayer/core/plugins';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary, LocalDictionaryId } from '@intlayer/types/dictionary';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport { listMissingTranslationsWithConfig } from '../test';\n\nexport type TranslationTask = {\n dictionaryKey: string;\n dictionaryLocalId: LocalDictionaryId;\n sourceLocale: Locale;\n targetLocales: Locale[];\n dictionaryPreset: string;\n dictionaryFilePath: string;\n};\n\nexport const listTranslationsTasks = (\n localIds: LocalDictionaryId[],\n outputLocales: Locale[],\n mode: 'complete' | 'review',\n baseLocale: Locale,\n configuration: IntlayerConfig\n): TranslationTask[] => {\n const appLogger = getAppLogger(configuration);\n\n const mergedDictionariesRecord = getDictionaries(configuration);\n const unmergedDictionariesRecord = getUnmergedDictionaries(configuration);\n\n const allFlatDictionaries = Object.values(unmergedDictionariesRecord).flat();\n const dictionariesToProcess = allFlatDictionaries.filter((dictionary) =>\n localIds.includes(dictionary.localId!)\n );\n\n const { missingTranslations } =\n listMissingTranslationsWithConfig(configuration);\n\n const maxKeyLength = Math.max(\n ...dictionariesToProcess.map((dictionary) => dictionary.key.length)\n );\n\n const translationTasks: TranslationTask[] = [];\n\n for (const targetUnmergedDictionary of dictionariesToProcess) {\n const dictionaryPreset = colon(\n [\n ' - ',\n colorize('[', ANSIColors.GREY_DARK),\n colorizeKey(targetUnmergedDictionary.key),\n colorize(']', ANSIColors.GREY_DARK),\n ].join(''),\n { colSize: maxKeyLength + 6 }\n );\n\n const dictionaryKey = targetUnmergedDictionary.key;\n const dictionaryLocalId = targetUnmergedDictionary.localId!;\n const mainDictionaryToProcess: Dictionary =\n mergedDictionariesRecord[dictionaryKey];\n const dictionaryFilled = targetUnmergedDictionary.filled ?? false;\n\n if (dictionaryFilled === true) {\n continue;\n }\n\n const dictionaryFill =\n targetUnmergedDictionary.fill ?? configuration.dictionary?.fill ?? false;\n\n if (dictionaryFill === false) continue;\n\n const sourceLocale: Locale = (targetUnmergedDictionary.locale ??\n baseLocale) as Locale;\n\n if (!mainDictionaryToProcess) {\n appLogger(\n `${dictionaryPreset} Dictionary not found in dictionariesRecord. Skipping.`,\n {\n level: 'warn',\n }\n );\n continue;\n }\n\n if (!targetUnmergedDictionary.filePath) {\n appLogger(`${dictionaryPreset} Dictionary has no file path. Skipping.`, {\n level: 'warn',\n });\n continue;\n }\n\n const sourceLocaleContent = getFilterTranslationsOnlyDictionary(\n mainDictionaryToProcess,\n sourceLocale\n );\n\n if (\n Object.keys(sourceLocaleContent as Record<string, unknown>).length === 0\n ) {\n appLogger(\n `${dictionaryPreset} No content found for dictionary in source locale ${formatLocale(sourceLocale)}. Skipping translation for this dictionary.`,\n {\n level: 'warn',\n }\n );\n continue;\n }\n\n /**\n * In 'complete' mode, filter only the missing locales to translate\n *\n * Skip the dictionary if there are no missing locales to translate\n */\n let outputLocalesList: Locale[] = outputLocales as Locale[];\n\n if (mode === 'complete') {\n outputLocalesList =\n missingTranslations\n .find(\n (missingTranslation) => missingTranslation.key === dictionaryKey\n )\n ?.locales.filter((locale) => outputLocales.includes(locale)) ?? [];\n }\n\n if (outputLocalesList.length === 0) {\n appLogger(\n `${dictionaryPreset} ${colorize('No locales to fill, Skipping', ANSIColors.GREY_DARK)} ${colorizePath(basename(targetUnmergedDictionary.filePath))}`,\n {\n level: 'warn',\n }\n );\n continue;\n }\n\n translationTasks.push({\n dictionaryKey,\n dictionaryLocalId,\n sourceLocale,\n targetLocales: outputLocalesList,\n dictionaryPreset,\n dictionaryFilePath: targetUnmergedDictionary.filePath,\n });\n }\n\n // Return the list of tasks to execute\n return translationTasks;\n};\n"],"mappings":";;;;;;;;;;AA2BA,MAAa,yBACX,UACA,eACA,MACA,YACA,kBACsB;CACtB,MAAM,YAAY,aAAa,aAAa;CAE5C,MAAM,2BAA2B,gBAAgB,aAAa;CAC9D,MAAM,6BAA6B,wBAAwB,aAAa;CAGxE,MAAM,wBADsB,OAAO,OAAO,0BAA0B,EAAE,KACtB,EAAE,QAAQ,eACxD,SAAS,SAAS,WAAW,OAAQ,CACvC;CAEA,MAAM,EAAE,wBACN,kCAAkC,aAAa;CAEjD,MAAM,eAAe,KAAK,IACxB,GAAG,sBAAsB,KAAK,eAAe,WAAW,IAAI,MAAM,CACpE;CAEA,MAAM,mBAAsC,CAAC;CAE7C,KAAK,MAAM,4BAA4B,uBAAuB;EAC5D,MAAM,mBAAmB,MACvB;GACE;GACA,SAAS,KAAK,WAAW,SAAS;GAClC,YAAY,yBAAyB,GAAG;GACxC,SAAS,KAAK,WAAW,SAAS;EACpC,EAAE,KAAK,EAAE,GACT,EAAE,SAAS,eAAe,EAAE,CAC9B;EAEA,MAAM,gBAAgB,yBAAyB;EAC/C,MAAM,oBAAoB,yBAAyB;EACnD,MAAM,0BACJ,yBAAyB;EAG3B,KAFyB,yBAAyB,UAAU,WAEnC,MACvB;EAMF,KAFE,yBAAyB,QAAQ,cAAc,YAAY,QAAQ,WAE9C,OAAO;EAE9B,MAAM,eAAwB,yBAAyB,UACrD;EAEF,IAAI,CAAC,yBAAyB;GAC5B,UACE,GAAG,iBAAiB,yDACpB,EACE,OAAO,OACT,CACF;GACA;EACF;EAEA,IAAI,CAAC,yBAAyB,UAAU;GACtC,UAAU,GAAG,iBAAiB,0CAA0C,EACtE,OAAO,OACT,CAAC;GACD;EACF;EAEA,MAAM,sBAAsB,oCAC1B,yBACA,YACF;EAEA,IACE,OAAO,KAAK,mBAA8C,EAAE,WAAW,GACvE;GACA,UACE,GAAG,iBAAiB,oDAAoD,aAAa,YAAY,EAAE,8CACnG,EACE,OAAO,OACT,CACF;GACA;EACF;;;;;;EAOA,IAAI,oBAA8B;EAElC,IAAI,SAAS,YACX,oBACE,oBACG,MACE,uBAAuB,mBAAmB,QAAQ,aACrD,GACE,QAAQ,QAAQ,WAAW,cAAc,SAAS,MAAM,CAAC,KAAK,CAAC;EAGvE,IAAI,kBAAkB,WAAW,GAAG;GAClC,UACE,GAAG,iBAAiB,GAAG,SAAS,gCAAgC,WAAW,SAAS,EAAE,GAAG,aAAa,SAAS,yBAAyB,QAAQ,CAAC,KACjJ,EACE,OAAO,OACT,CACF;GACA;EACF;EAEA,iBAAiB,KAAK;GACpB;GACA;GACA;GACA,eAAe;GACf;GACA,oBAAoB,yBAAyB;EAC/C,CAAC;CACH;CAGA,OAAO;AACT"}
@@ -1,3 +1,4 @@
1
+ import { getAuthenticatedAPI } from "../utils/checkAccess.mjs";
1
2
  import { deepMergeContent } from "./deepMergeContent.mjs";
2
3
  import { extractTranslatableContent, reinsertTranslatedContent } from "./extractTranslatableContent.mjs";
3
4
  import { basename } from "node:path";
@@ -6,7 +7,6 @@ import * as ANSIColors from "@intlayer/config/colors";
6
7
  import { colon, colorize, colorizeNumber, colorizePath, getAppLogger } from "@intlayer/config/logger";
7
8
  import { getUnmergedDictionaries } from "@intlayer/unmerged-dictionaries-entry";
8
9
  import { getFilterMissingTranslationsDictionary, getMultilingualDictionary, getPerLocaleDictionary, insertContentInDictionary } from "@intlayer/core/plugins";
9
- import { getIntlayerAPIProxy } from "@intlayer/api";
10
10
  import { retryManager } from "@intlayer/config/utils";
11
11
 
12
12
  //#region src/fill/translateDictionary.ts
@@ -37,7 +37,7 @@ const MAX_FOLLOWING_ERRORS = 10;
37
37
  let followingErrors = 0;
38
38
  const translateDictionary = async (task, configuration, options) => {
39
39
  const appLogger = getAppLogger(configuration);
40
- const intlayerAPI = getIntlayerAPIProxy(void 0, configuration);
40
+ const intlayerAPI = await getAuthenticatedAPI(configuration);
41
41
  const { mode, aiOptions, fillMetadata, aiClient, aiConfig } = {
42
42
  mode: "complete",
43
43
  fillMetadata: true,