@intlayer/chokidar 5.8.1 → 6.0.0-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/dist/cjs/chokidar/watcher.cjs +15 -20
  2. package/dist/cjs/chokidar/watcher.cjs.map +1 -1
  3. package/dist/cjs/fetchDistantDictionaries.cjs +18 -37
  4. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  5. package/dist/cjs/{fetchDistantDictionaryKeys.cjs → fetchDistantDictionaryKeysAndUpdateTimestamp.cjs} +11 -19
  6. package/dist/cjs/fetchDistantDictionaryKeysAndUpdateTimestamp.cjs.map +1 -0
  7. package/dist/cjs/filterInvalidDictionaries.cjs +70 -0
  8. package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -0
  9. package/dist/cjs/getBuiltFetchDictionariesPath.cjs +52 -0
  10. package/dist/cjs/getBuiltFetchDictionariesPath.cjs.map +1 -0
  11. package/dist/cjs/getBuiltRemoteDictionariesPath.cjs +51 -0
  12. package/dist/cjs/getBuiltRemoteDictionariesPath.cjs.map +1 -0
  13. package/dist/cjs/index.cjs +13 -11
  14. package/dist/cjs/index.cjs.map +1 -1
  15. package/dist/cjs/loadDictionaries/index.cjs +4 -4
  16. package/dist/cjs/loadDictionaries/index.cjs.map +1 -1
  17. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +57 -17
  18. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  19. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +128 -53
  20. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  21. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +108 -0
  22. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -0
  23. package/dist/cjs/loadDictionaries/log.cjs +144 -0
  24. package/dist/cjs/loadDictionaries/log.cjs.map +1 -0
  25. package/dist/cjs/mergeDictionaries.cjs +18 -22
  26. package/dist/cjs/mergeDictionaries.cjs.map +1 -1
  27. package/dist/cjs/orderDictionaries.cjs +71 -0
  28. package/dist/cjs/orderDictionaries.cjs.map +1 -0
  29. package/dist/cjs/prepareContentDeclaration.cjs +4 -1
  30. package/dist/cjs/prepareContentDeclaration.cjs.map +1 -1
  31. package/dist/cjs/prepareIntlayer.cjs +9 -4
  32. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  33. package/dist/cjs/processPerLocaleDictionary.cjs.map +1 -1
  34. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.cjs +22 -8
  35. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.cjs.map +1 -1
  36. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.cjs +44 -42
  37. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.cjs.map +1 -1
  38. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.cjs +83 -0
  39. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.cjs.map +1 -0
  40. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.cjs +29 -21
  41. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.cjs.map +1 -1
  42. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.cjs +52 -0
  43. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.cjs.map +1 -0
  44. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.cjs +44 -29
  45. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.cjs.map +1 -1
  46. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs +39 -34
  47. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs.map +1 -1
  48. package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs +4 -6
  49. package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs.map +1 -1
  50. package/dist/cjs/transpiler/dictionary_to_type/createType.cjs +17 -16
  51. package/dist/cjs/transpiler/dictionary_to_type/createType.cjs.map +1 -1
  52. package/dist/cjs/utils/formatter.cjs +50 -0
  53. package/dist/cjs/utils/formatter.cjs.map +1 -0
  54. package/dist/cjs/utils/parallelize.cjs +43 -0
  55. package/dist/cjs/utils/parallelize.cjs.map +1 -0
  56. package/dist/cjs/utils/runOnce.cjs +2 -1
  57. package/dist/cjs/utils/runOnce.cjs.map +1 -1
  58. package/dist/cjs/writeContentDeclaration/dictionaryStatus.cjs.map +1 -1
  59. package/dist/cjs/writeContentDeclaration/formatCode.cjs +7 -4
  60. package/dist/cjs/writeContentDeclaration/formatCode.cjs.map +1 -1
  61. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +6 -2
  62. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  63. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +43 -25
  64. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
  65. package/dist/esm/chokidar/watcher.mjs +16 -21
  66. package/dist/esm/chokidar/watcher.mjs.map +1 -1
  67. package/dist/esm/fetchDistantDictionaries.mjs +24 -28
  68. package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
  69. package/dist/esm/fetchDistantDictionaryKeysAndUpdateTimestamp.mjs +21 -0
  70. package/dist/esm/fetchDistantDictionaryKeysAndUpdateTimestamp.mjs.map +1 -0
  71. package/dist/esm/filterInvalidDictionaries.mjs +40 -0
  72. package/dist/esm/filterInvalidDictionaries.mjs.map +1 -0
  73. package/dist/esm/getBuiltFetchDictionariesPath.mjs +18 -0
  74. package/dist/esm/getBuiltFetchDictionariesPath.mjs.map +1 -0
  75. package/dist/esm/getBuiltRemoteDictionariesPath.mjs +17 -0
  76. package/dist/esm/getBuiltRemoteDictionariesPath.mjs.map +1 -0
  77. package/dist/esm/index.mjs +10 -9
  78. package/dist/esm/index.mjs.map +1 -1
  79. package/dist/esm/loadDictionaries/index.mjs +2 -2
  80. package/dist/esm/loadDictionaries/index.mjs.map +1 -1
  81. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +61 -18
  82. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
  83. package/dist/esm/loadDictionaries/loadDictionaries.mjs +132 -53
  84. package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
  85. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +73 -0
  86. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -0
  87. package/dist/esm/loadDictionaries/log.mjs +125 -0
  88. package/dist/esm/loadDictionaries/log.mjs.map +1 -0
  89. package/dist/esm/mergeDictionaries.mjs +19 -23
  90. package/dist/esm/mergeDictionaries.mjs.map +1 -1
  91. package/dist/esm/orderDictionaries.mjs +37 -0
  92. package/dist/esm/orderDictionaries.mjs.map +1 -0
  93. package/dist/esm/prepareContentDeclaration.mjs +4 -1
  94. package/dist/esm/prepareContentDeclaration.mjs.map +1 -1
  95. package/dist/esm/prepareIntlayer.mjs +9 -4
  96. package/dist/esm/prepareIntlayer.mjs.map +1 -1
  97. package/dist/esm/processPerLocaleDictionary.mjs.map +1 -1
  98. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.mjs +25 -9
  99. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.mjs.map +1 -1
  100. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.mjs +45 -43
  101. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.mjs.map +1 -1
  102. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.mjs +58 -0
  103. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.mjs.map +1 -0
  104. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.mjs +29 -21
  105. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.mjs.map +1 -1
  106. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.mjs +28 -0
  107. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.mjs.map +1 -0
  108. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.mjs +45 -30
  109. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.mjs.map +1 -1
  110. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs +39 -34
  111. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs.map +1 -1
  112. package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs +4 -6
  113. package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs.map +1 -1
  114. package/dist/esm/transpiler/dictionary_to_type/createType.mjs +17 -16
  115. package/dist/esm/transpiler/dictionary_to_type/createType.mjs.map +1 -1
  116. package/dist/esm/utils/formatter.mjs +15 -0
  117. package/dist/esm/utils/formatter.mjs.map +1 -0
  118. package/dist/esm/utils/parallelize.mjs +9 -0
  119. package/dist/esm/utils/parallelize.mjs.map +1 -0
  120. package/dist/esm/utils/runOnce.mjs +2 -1
  121. package/dist/esm/utils/runOnce.mjs.map +1 -1
  122. package/dist/esm/writeContentDeclaration/formatCode.mjs +8 -5
  123. package/dist/esm/writeContentDeclaration/formatCode.mjs.map +1 -1
  124. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +6 -2
  125. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
  126. package/dist/esm/writeContentDeclaration/writeJSFile.mjs +40 -22
  127. package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
  128. package/dist/types/chokidar/watcher.d.ts.map +1 -1
  129. package/dist/types/fetchDistantDictionaries.d.ts +2 -1
  130. package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
  131. package/dist/types/fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts +3 -0
  132. package/dist/types/fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts.map +1 -0
  133. package/dist/types/filterInvalidDictionaries.d.ts +3 -0
  134. package/dist/types/filterInvalidDictionaries.d.ts.map +1 -0
  135. package/dist/types/getBuiltFetchDictionariesPath.d.ts +5 -0
  136. package/dist/types/getBuiltFetchDictionariesPath.d.ts.map +1 -0
  137. package/dist/types/getBuiltRemoteDictionariesPath.d.ts +5 -0
  138. package/dist/types/getBuiltRemoteDictionariesPath.d.ts.map +1 -0
  139. package/dist/types/index.d.ts +4 -4
  140. package/dist/types/index.d.ts.map +1 -1
  141. package/dist/types/loadDictionaries/index.d.ts +2 -2
  142. package/dist/types/loadDictionaries/index.d.ts.map +1 -1
  143. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +4 -1
  144. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -1
  145. package/dist/types/loadDictionaries/loadDictionaries.d.ts +11 -1
  146. package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -1
  147. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +6 -0
  148. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -0
  149. package/dist/types/loadDictionaries/log.d.ts +19 -0
  150. package/dist/types/loadDictionaries/log.d.ts.map +1 -0
  151. package/dist/types/mergeDictionaries.d.ts +1 -1
  152. package/dist/types/mergeDictionaries.d.ts.map +1 -1
  153. package/dist/types/orderDictionaries.d.ts +10 -0
  154. package/dist/types/orderDictionaries.d.ts.map +1 -0
  155. package/dist/types/prepareContentDeclaration.d.ts.map +1 -1
  156. package/dist/types/prepareIntlayer.d.ts.map +1 -1
  157. package/dist/types/processPerLocaleDictionary.d.ts +1 -1
  158. package/dist/types/transpiler/declaration_file_to_dictionary/index.d.ts +1 -0
  159. package/dist/types/transpiler/declaration_file_to_dictionary/index.d.ts.map +1 -1
  160. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.d.ts +4 -3
  161. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.d.ts.map +1 -1
  162. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.d.ts +1 -1
  163. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.d.ts.map +1 -1
  164. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.d.ts +23 -0
  165. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.d.ts.map +1 -0
  166. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.d.ts +1 -1
  167. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.d.ts.map +1 -1
  168. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.d.ts +19 -0
  169. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.d.ts.map +1 -0
  170. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.d.ts.map +1 -1
  171. package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts +1 -1
  172. package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts.map +1 -1
  173. package/dist/types/transpiler/dictionary_to_type/createModuleAugmentation.d.ts +1 -1
  174. package/dist/types/transpiler/dictionary_to_type/createModuleAugmentation.d.ts.map +1 -1
  175. package/dist/types/transpiler/dictionary_to_type/createType.d.ts +1 -1
  176. package/dist/types/transpiler/dictionary_to_type/createType.d.ts.map +1 -1
  177. package/dist/types/utils/formatter.d.ts +4 -0
  178. package/dist/types/utils/formatter.d.ts.map +1 -0
  179. package/dist/types/utils/parallelize.d.ts +2 -0
  180. package/dist/types/utils/parallelize.d.ts.map +1 -0
  181. package/dist/types/utils/runOnce.d.ts +1 -1
  182. package/dist/types/utils/runOnce.d.ts.map +1 -1
  183. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts +1 -1
  184. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts.map +1 -1
  185. package/dist/types/writeContentDeclaration/formatCode.d.ts.map +1 -1
  186. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +1 -1
  187. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
  188. package/dist/types/writeContentDeclaration/writeJSFile.d.ts +1 -1
  189. package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +1 -1
  190. package/package.json +17 -15
  191. package/dist/cjs/checkDictionaryChanges.cjs +0 -58
  192. package/dist/cjs/checkDictionaryChanges.cjs.map +0 -1
  193. package/dist/cjs/fetchDistantDictionaryKeys.cjs.map +0 -1
  194. package/dist/cjs/getFilteredLocalesContent.cjs +0 -70
  195. package/dist/cjs/getFilteredLocalesContent.cjs.map +0 -1
  196. package/dist/cjs/loadDictionaries/loadDistantDictionaries.cjs +0 -44
  197. package/dist/cjs/loadDictionaries/loadDistantDictionaries.cjs.map +0 -1
  198. package/dist/cjs/log.cjs +0 -296
  199. package/dist/cjs/log.cjs.map +0 -1
  200. package/dist/esm/checkDictionaryChanges.mjs +0 -37
  201. package/dist/esm/checkDictionaryChanges.mjs.map +0 -1
  202. package/dist/esm/fetchDistantDictionaryKeys.mjs +0 -29
  203. package/dist/esm/fetchDistantDictionaryKeys.mjs.map +0 -1
  204. package/dist/esm/getFilteredLocalesContent.mjs +0 -49
  205. package/dist/esm/getFilteredLocalesContent.mjs.map +0 -1
  206. package/dist/esm/loadDictionaries/loadDistantDictionaries.mjs +0 -20
  207. package/dist/esm/loadDictionaries/loadDistantDictionaries.mjs.map +0 -1
  208. package/dist/esm/log.mjs +0 -262
  209. package/dist/esm/log.mjs.map +0 -1
  210. package/dist/types/checkDictionaryChanges.d.ts +0 -3
  211. package/dist/types/checkDictionaryChanges.d.ts.map +0 -1
  212. package/dist/types/fetchDistantDictionaryKeys.d.ts +0 -3
  213. package/dist/types/fetchDistantDictionaryKeys.d.ts.map +0 -1
  214. package/dist/types/getFilteredLocalesContent.d.ts +0 -4
  215. package/dist/types/getFilteredLocalesContent.d.ts.map +0 -1
  216. package/dist/types/loadDictionaries/loadDistantDictionaries.d.ts +0 -8
  217. package/dist/types/loadDictionaries/loadDistantDictionaries.d.ts.map +0 -1
  218. package/dist/types/log.d.ts +0 -45
  219. package/dist/types/log.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport dictionariesRecord from '@intlayer/unmerged-dictionaries-entry';\nimport deepEqual from 'deep-equal';\nimport { existsSync } from 'fs';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { dirname, extname } from 'path';\nimport { prepareContentDeclaration } from '../prepareContentDeclaration';\nimport type { DictionaryStatus } from './dictionaryStatus';\nimport { writeJSFile } from './writeJSFile';\n\nconst DEFAULT_NEW_DICTIONARY_PATH = 'intlayer-dictionaries';\n\nconst formatContentDeclaration = async (dictionary: Dictionary) => {\n // Clean Markdown, Insertion, File, etc. node metadata\n const preparedContentDeclaration =\n await prepareContentDeclaration(dictionary);\n\n // Remove the filePath from the dictionary and set $schema\n const { filePath, $schema, ...dictionaryWithoutPath } =\n preparedContentDeclaration;\n\n const formattedContentDeclaration = {\n $schema: 'https://intlayer.org/schema.json',\n ...dictionaryWithoutPath,\n };\n\n return formattedContentDeclaration;\n};\n\nexport const writeContentDeclaration = async (\n dictionary: Dictionary,\n config: IntlayerConfig = configuration,\n newDictionariesPath?: string\n): Promise<{ status: DictionaryStatus; path: string }> => {\n const { content } = config;\n const { baseDir } = content;\n\n const newDictionaryRelativeLocationPath =\n newDictionariesPath ?? DEFAULT_NEW_DICTIONARY_PATH;\n const newDictionaryLocationPath = `${baseDir}/${newDictionaryRelativeLocationPath}`;\n\n const existingDictionary = (\n dictionariesRecord[dictionary.key] as Dictionary[]\n ).filter((el) => el.filePath === dictionary.filePath);\n\n const filePath = dictionary.filePath;\n const formattedContentDeclaration =\n await formatContentDeclaration(dictionary);\n\n if (existingDictionary) {\n // Compare existing dictionary with distant dictionary\n if (deepEqual(existingDictionary, dictionary)) {\n // Up to date, nothing to do\n return {\n status: 'up-to-date',\n path: filePath!,\n };\n } else {\n if (filePath) {\n await writeFileWithDirectories(filePath, formattedContentDeclaration);\n\n return { status: 'updated', path: filePath };\n } else {\n // Write the dictionary to the intlayer-dictionaries directory\n const contentDeclarationPath = `${newDictionaryLocationPath}/${dictionary.key}.content.json`;\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration\n );\n\n return {\n status: 'reimported in new location',\n path: contentDeclarationPath,\n };\n }\n }\n } else {\n // No existing dictionary, write to new location\n const contentDeclarationPath = `${newDictionaryLocationPath}/${dictionary.key}.content.json`;\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration\n );\n\n return {\n status: 'imported',\n path: contentDeclarationPath,\n };\n }\n};\n\nconst writeFileWithDirectories = async (\n filePath: string,\n data: string | Buffer\n): Promise<void> => {\n try {\n // Extract the directory from the file path\n const dir = dirname(filePath);\n\n // Check if the directory exists\n const directoryExists = existsSync(dir);\n\n if (!directoryExists) {\n // Create the directory recursively\n await mkdir(dir, { recursive: true });\n }\n\n const extention = extname(filePath);\n const acceptedExtensions = configuration.content.fileExtensions.map(\n (extention) => extname(extention)\n );\n\n if (!acceptedExtensions.includes(extention)) {\n throw new Error(\n `Invalid file extension: ${extention}, file: ${filePath}`\n );\n }\n\n if (extention === '.json') {\n const jsonDictionary = JSON.stringify(data, null, 2);\n\n // Write the file\n await writeFile(filePath, jsonDictionary);\n } else {\n await writeJSFile(filePath, data as unknown as Dictionary);\n }\n } catch (error) {\n throw new Error(`Error writing file to ${filePath}: ${error}`);\n }\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAG1B,OAAO,wBAAwB;AAC/B,OAAO,eAAe;AACtB,SAAS,kBAAkB;AAC3B,SAAS,OAAO,iBAAiB;AACjC,SAAS,SAAS,eAAe;AACjC,SAAS,iCAAiC;AAE1C,SAAS,mBAAmB;AAE5B,MAAM,8BAA8B;AAEpC,MAAM,2BAA2B,OAAO,eAA2B;AAEjE,QAAM,6BACJ,MAAM,0BAA0B,UAAU;AAG5C,QAAM,EAAE,UAAU,SAAS,GAAG,sBAAsB,IAClD;AAEF,QAAM,8BAA8B;AAAA,IAClC,SAAS;AAAA,IACT,GAAG;AAAA,EACL;AAEA,SAAO;AACT;AAEO,MAAM,0BAA0B,OACrC,YACA,SAAyB,eACzB,wBACwD;AACxD,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,EAAE,QAAQ,IAAI;AAEpB,QAAM,oCACJ,uBAAuB;AACzB,QAAM,4BAA4B,GAAG,OAAO,IAAI,iCAAiC;AAEjF,QAAM,qBACJ,mBAAmB,WAAW,GAAG,EACjC,OAAO,CAAC,OAAO,GAAG,aAAa,WAAW,QAAQ;AAEpD,QAAM,WAAW,WAAW;AAC5B,QAAM,8BACJ,MAAM,yBAAyB,UAAU;AAE3C,MAAI,oBAAoB;AAEtB,QAAI,UAAU,oBAAoB,UAAU,GAAG;AAE7C,aAAO;AAAA,QACL,QAAQ;AAAA,QACR,MAAM;AAAA,MACR;AAAA,IACF,OAAO;AACL,UAAI,UAAU;AACZ,cAAM,yBAAyB,UAAU,2B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":["import configuration from '@intlayer/config/built';\nimport { colorizePath, x, type IntlayerConfig } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport dictionariesRecord from '@intlayer/unmerged-dictionaries-entry';\nimport deepEqual from 'deep-equal';\nimport { existsSync } from 'fs';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { dirname, extname } from 'path';\nimport { prepareContentDeclaration } from '../prepareContentDeclaration';\nimport type { DictionaryStatus } from './dictionaryStatus';\nimport { writeJSFile } from './writeJSFile';\n\nconst DEFAULT_NEW_DICTIONARY_PATH = 'intlayer-dictionaries';\n\nconst formatContentDeclaration = async (dictionary: Dictionary) => {\n // Clean Markdown, Insertion, File, etc. node metadata\n const preparedContentDeclaration =\n await prepareContentDeclaration(dictionary);\n\n // Remove the filePath from the dictionary and set $schema\n const { filePath, $schema, ...dictionaryWithoutPath } =\n preparedContentDeclaration;\n\n const formattedContentDeclaration = {\n $schema: 'https://intlayer.org/schema.json',\n ...dictionaryWithoutPath,\n };\n\n return formattedContentDeclaration;\n};\n\nexport const writeContentDeclaration = async (\n dictionary: Dictionary,\n config: IntlayerConfig = configuration,\n newDictionariesPath?: string\n): Promise<{ status: DictionaryStatus; path: string }> => {\n const { content } = config;\n const { baseDir } = content;\n\n const newDictionaryRelativeLocationPath =\n newDictionariesPath ?? DEFAULT_NEW_DICTIONARY_PATH;\n const newDictionaryLocationPath = `${baseDir}/${newDictionaryRelativeLocationPath}`;\n\n const existingDictionary = (\n dictionariesRecord[dictionary.key] as Dictionary[]\n ).filter((el) => el.filePath === dictionary.filePath);\n\n const filePath = dictionary.filePath;\n const formattedContentDeclaration =\n await formatContentDeclaration(dictionary);\n\n if (existingDictionary) {\n // Compare existing dictionary with distant dictionary\n if (deepEqual(existingDictionary, dictionary)) {\n // Up to date, nothing to do\n return {\n status: 'up-to-date',\n path: filePath!,\n };\n } else {\n if (filePath) {\n await writeFileWithDirectories(filePath, formattedContentDeclaration);\n\n return { status: 'updated', path: filePath };\n } else {\n // Write the dictionary to the intlayer-dictionaries directory\n const contentDeclarationPath = `${newDictionaryLocationPath}/${dictionary.key}.content.json`;\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration\n );\n\n return {\n status: 'new content file',\n path: contentDeclarationPath,\n };\n }\n }\n } else {\n // No existing dictionary, write to new location\n const contentDeclarationPath = `${newDictionaryLocationPath}/${dictionary.key}.content.json`;\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration\n );\n\n return {\n status: 'imported',\n path: contentDeclarationPath,\n };\n }\n};\n\nconst writeFileWithDirectories = async (\n filePath: string,\n data: string | Buffer\n): Promise<void> => {\n try {\n // Extract the directory from the file path\n const dir = dirname(filePath);\n\n // Check if the directory exists\n const directoryExists = existsSync(dir);\n\n if (!directoryExists) {\n // Create the directory recursively\n await mkdir(dir, { recursive: true });\n }\n\n const extention = extname(filePath);\n const acceptedExtensions = configuration.content.fileExtensions.map(\n (extention) => extname(extention)\n );\n\n if (!acceptedExtensions.includes(extention)) {\n throw new Error(\n `Invalid file extension: ${extention}, file: ${filePath}`\n );\n }\n\n if (extention === '.json') {\n const jsonDictionary = JSON.stringify(data, null, 2);\n\n // Write the file\n await writeFile(filePath, jsonDictionary);\n } else {\n await writeJSFile(filePath, data as unknown as Dictionary);\n }\n } catch (error) {\n console.error(data);\n\n throw new Error(\n `${x} Error writing file to ${colorizePath(filePath)}: ${error}`\n );\n }\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAC1B,SAAS,cAAc,SAA8B;AAErD,OAAO,wBAAwB;AAC/B,OAAO,eAAe;AACtB,SAAS,kBAAkB;AAC3B,SAAS,OAAO,iBAAiB;AACjC,SAAS,SAAS,eAAe;AACjC,SAAS,iCAAiC;AAE1C,SAAS,mBAAmB;AAE5B,MAAM,8BAA8B;AAEpC,MAAM,2BAA2B,OAAO,eAA2B;AAEjE,QAAM,6BACJ,MAAM,0BAA0B,UAAU;AAG5C,QAAM,EAAE,UAAU,SAAS,GAAG,s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K,EAAE,WAAW,KAAK,CAAC;AAAA,IACtC;AAEA,UAAM,YAAY,QAAQ,QAAQ;AAClC,UAAM,qBAAqB,cAAc,QAAQ,eAAe;AAAA,MAC9D,CAACA,eAAc,QAAQA,UAAS;AAAA,IAClC;AAEA,QAAI,CAAC,mBAAmB,SAAS,SAAS,GAAG;AAC3C,YAAM,IAAI;AAAA,QACR,2BAA2B,SAAS,WAAW,QAAQ;AAAA,MACzD;AAAA,IACF;AAEA,QAAI,cAAc,SAAS;AACzB,YAAM,iBAAiB,KAAK,UAAU,MAAM,MAAM,CAAC;AAGnD,YAAM,UAAU,UAAU,cAAc;AAAA,IAC1C,OAAO;AACL,YAAM,YAAY,UAAU,IAA6B;AAAA,IAC3D;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,IAAI;AAElB,UAAM,IAAI;AAAA,MACR,GAAG,CAAC,0BAA0B,aAAa,QAAQ,CAAC,KAAK,KAAK;AAAA,IAChE;AAAA,EACF;AACF;","names":["extention"]}
@@ -1,6 +1,6 @@
1
- import generator from "@babel/generator";
1
+ import * as generate from "@babel/generator";
2
2
  import * as babelParser from "@babel/parser";
3
- import traverse from "@babel/traverse";
3
+ import * as babelTraverse from "@babel/traverse";
4
4
  import * as t from "@babel/types";
5
5
  import { getAppLogger, logger } from "@intlayer/config";
6
6
  import configuration from "@intlayer/config/built";
@@ -13,6 +13,20 @@ import { extname } from "path";
13
13
  import { getContentDeclarationFileTemplate } from "../getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs";
14
14
  import { formatCode } from "./formatCode.mjs";
15
15
  const writeJSFile = async (filePath, dictionary) => {
16
+ const normalizeTraverse = (mod) => {
17
+ const candidate = mod;
18
+ if (typeof candidate === "function") return candidate;
19
+ if (candidate?.default) {
20
+ if (typeof candidate.default === "function") return candidate.default;
21
+ if (typeof candidate.default?.default === "function")
22
+ return candidate.default.default;
23
+ if (typeof candidate.default?.traverse === "function")
24
+ return candidate.default.traverse;
25
+ }
26
+ if (typeof candidate?.traverse === "function") return candidate.traverse;
27
+ return candidate;
28
+ };
29
+ const traverse = normalizeTraverse(babelTraverse);
16
30
  const appLogger = getAppLogger(configuration);
17
31
  const {
18
32
  key: dictionaryIdentifierKey,
@@ -61,15 +75,17 @@ const writeJSFile = async (filePath, dictionary) => {
61
75
  traverse(ast, {
62
76
  ObjectExpression(path) {
63
77
  if (dictionaryObjectPath) return;
64
- const keyProp = path.node.properties.find((prop) => {
65
- if (!t.isObjectProperty(prop)) return false;
66
- if (!t.isIdentifier(prop.key) && !t.isStringLiteral(prop.key))
67
- return false;
68
- const keyName = t.isIdentifier(prop.key) ? prop.key.name : prop.key.value;
69
- if (keyName !== "key" || !t.isStringLiteral(prop.value)) return false;
70
- const propValue = prop.value.value;
71
- return propValue === dictionaryIdentifierKey;
72
- });
78
+ const keyProp = path.node.properties.find(
79
+ (prop) => {
80
+ if (!t.isObjectProperty(prop)) return false;
81
+ if (!t.isIdentifier(prop.key) && !t.isStringLiteral(prop.key))
82
+ return false;
83
+ const keyName = t.isIdentifier(prop.key) ? prop.key.name : prop.key.value;
84
+ if (keyName !== "key" || !t.isStringLiteral(prop.value)) return false;
85
+ const propValue = prop.value.value;
86
+ return propValue === dictionaryIdentifierKey;
87
+ }
88
+ );
73
89
  if (keyProp) {
74
90
  dictionaryObjectPath = path;
75
91
  path.stop();
@@ -120,17 +136,19 @@ const writeJSFile = async (filePath, dictionary) => {
120
136
  });
121
137
  traverse(ast, {
122
138
  ObjectExpression(path) {
123
- const props = path.node.properties.map((prop) => {
124
- if (!t.isObjectProperty(prop)) return "non-object-property";
125
- if (!t.isIdentifier(prop.key) && !t.isStringLiteral(prop.key))
126
- return "complex-key";
127
- const keyName = t.isIdentifier(prop.key) ? prop.key.name : prop.key.value;
128
- let valueDesc = "unknown-value";
129
- if (t.isStringLiteral(prop.value)) {
130
- valueDesc = `"${prop.value.value}"`;
139
+ const props = path.node.properties.map(
140
+ (prop) => {
141
+ if (!t.isObjectProperty(prop)) return "non-object-property";
142
+ if (!t.isIdentifier(prop.key) && !t.isStringLiteral(prop.key))
143
+ return "complex-key";
144
+ const keyName = t.isIdentifier(prop.key) ? prop.key.name : prop.key.value;
145
+ let valueDesc = "unknown-value";
146
+ if (t.isStringLiteral(prop.value)) {
147
+ valueDesc = `"${prop.value.value}"`;
148
+ }
149
+ return `${keyName}: ${valueDesc}`;
131
150
  }
132
- return `${keyName}: ${valueDesc}`;
133
- }).join(", ");
151
+ ).join(", ");
134
152
  appLogger(`Object: { ${props} }`);
135
153
  }
136
154
  });
@@ -270,7 +288,7 @@ const writeJSFile = async (filePath, dictionary) => {
270
288
  }
271
289
  mergeValueIntoProperty(targetPropertyPath, newEntryData, entryKeyToUpdate);
272
290
  }
273
- const generatedCode = generator(ast, {
291
+ const generatedCode = generate.generate(ast, {
274
292
  retainLines: true,
275
293
  comments: true,
276
294
  jsescOption: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/writeContentDeclaration/writeJSFile.ts"],"sourcesContent":["import generator from '@babel/generator';\nimport * as babelParser from '@babel/parser';\nimport traverse, { NodePath } from '@babel/traverse';\nimport * as t from '@babel/types';\nimport { getAppLogger, logger } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport {\n Dictionary,\n NodeType,\n TranslationContent,\n TypedNode,\n} from '@intlayer/core';\nimport { existsSync } from 'fs';\nimport { readFile, writeFile } from 'fs/promises';\nimport { extname } from 'path';\nimport { getContentDeclarationFileTemplate } from '../getContentDeclarationFileTemplate/getContentDeclarationFileTemplate';\nimport { formatCode } from './formatCode';\n\n/**\n * Updates a JavaScript/TypeScript file based on the provided JSON instructions.\n * It targets a specific dictionary object within the file (identified by its 'key' property)\n * and updates its 'content' entries. Currently, it focuses on modifying arguments\n * of 't' (translation) function calls.\n */\nexport const writeJSFile = async (\n filePath: string,\n dictionary: Dictionary\n): Promise<void> => {\n const appLogger = getAppLogger(configuration);\n\n const {\n key: dictionaryIdentifierKey,\n content: updatesToApply,\n locale,\n autoFilled,\n } = dictionary;\n const isPerLocaleDeclarationFile = typeof locale === 'string';\n\n // Check if the file exist\n if (!existsSync(filePath)) {\n const fileExtension = extname(filePath);\n\n let format = 'ts' as 'ts' | 'cjs' | 'esm';\n\n if (fileExtension === '.ts' || fileExtension === '.tsx') {\n format = 'ts';\n } else if (fileExtension === '.cjs' || fileExtension === '.cjsx') {\n format = 'cjs';\n } else {\n format = 'esm';\n }\n\n appLogger('File does not exist, creating it', {\n isVerbose: true,\n });\n const template = await getContentDeclarationFileTemplate(\n dictionaryIdentifierKey,\n format,\n { locale, autoFilled }\n );\n\n await writeFile(filePath, template, 'utf-8');\n }\n\n let sourceCode: string;\n try {\n sourceCode = await readFile(filePath, 'utf-8');\n } catch (error) {\n const err = error as Error;\n appLogger(`Failed to read file: ${filePath}`, {\n level: 'error',\n });\n throw new Error(`Failed to read file ${filePath}: ${err.message}`);\n }\n\n const ast = babelParser.parse(sourceCode, {\n sourceType: 'module',\n plugins: ['typescript', 'jsx'],\n tokens: true,\n });\n\n let dictionaryObjectPath: NodePath<t.ObjectExpression> | null = null;\n let dictionaryIdentifier: string | null = null;\n\n // First look for direct objects with the right key, regardless of variable assignments\n traverse(ast, {\n ObjectExpression(path) {\n if (dictionaryObjectPath) return; // Already found\n\n // Check if this object has a key property with the right value\n const keyProp = path.node.properties.find((prop) => {\n if (!t.isObjectProperty(prop)) return false;\n if (!t.isIdentifier(prop.key) && !t.isStringLiteral(prop.key))\n return false;\n\n const keyName = t.isIdentifier(prop.key)\n ? prop.key.name\n : prop.key.value;\n\n if (keyName !== 'key' || !t.isStringLiteral(prop.value)) return false;\n\n // Unescape the value for comparison\n const propValue = prop.value.value;\n // Compare actual string content, not just raw representation\n return propValue === dictionaryIdentifierKey;\n });\n\n if (keyProp) {\n dictionaryObjectPath = path;\n path.stop();\n }\n },\n });\n\n // If not found directly, look for variable declarations and exports\n if (!dictionaryObjectPath) {\n appLogger(`Looking for variable declarations`, {\n isVerbose: true,\n });\n\n // Collect all variable declarations with objects\n const candidateVars: { id: string; path: NodePath<t.ObjectExpression> }[] =\n [];\n\n traverse(ast, {\n VariableDeclarator(path) {\n const { node } = path;\n if (!t.isIdentifier(node.id)) return;\n\n let objPath: NodePath<t.ObjectExpression> | null = null;\n\n // Direct object assignment\n if (node.init && t.isObjectExpression(node.init)) {\n objPath = path.get('init') as NodePath<t.ObjectExpression>;\n }\n // Object with TS type assertion (satisfies/as)\n else if (\n node.init &&\n (t.isTSAsExpression(node.init) || t.isTSTypeAssertion(node.init)) &&\n t.isObjectExpression(node.init.expression)\n ) {\n objPath = path.get('init.expression') as NodePath<t.ObjectExpression>;\n }\n\n if (objPath) {\n candidateVars.push({ id: node.id.name, path: objPath });\n }\n },\n });\n\n appLogger(`Found ${candidateVars.length} candidate variables`, {\n isVerbose: true,\n });\n\n // Check each candidate for the key property\n for (const { id, path } of candidateVars) {\n const keyProp = path.node.properties.find((prop) => {\n if (!t.isObjectProperty(prop)) return false;\n if (!t.isIdentifier(prop.key) && !t.isStringLiteral(prop.key))\n return false;\n\n const keyName = t.isIdentifier(prop.key)\n ? prop.key.name\n : prop.key.value;\n return (\n keyName === 'key' &&\n t.isStringLiteral(prop.value) &&\n prop.value.value === dictionaryIdentifierKey\n );\n });\n\n if (keyProp) {\n appLogger(`Found match in variable: ${id}`);\n dictionaryObjectPath = path;\n dictionaryIdentifier = id;\n break;\n }\n }\n\n // If still not found, dump all object expressions for debugging\n if (!dictionaryObjectPath) {\n appLogger('Could not find dictionary object. Dumping all objects:', {\n isVerbose: true,\n });\n traverse(ast, {\n ObjectExpression(path) {\n const props = path.node.properties\n .map((prop) => {\n if (!t.isObjectProperty(prop)) return 'non-object-property';\n if (!t.isIdentifier(prop.key) && !t.isStringLiteral(prop.key))\n return 'complex-key';\n\n const keyName = t.isIdentifier(prop.key)\n ? prop.key.name\n : prop.key.value;\n let valueDesc = 'unknown-value';\n\n if (t.isStringLiteral(prop.value)) {\n valueDesc = `\"${prop.value.value}\"`;\n }\n\n return `${keyName}: ${valueDesc}`;\n })\n .join(', ');\n\n appLogger(`Object: { ${props} }`);\n },\n });\n }\n }\n\n if (!dictionaryObjectPath) {\n throw new Error(\n `Could not find dictionary object with key '${dictionaryIdentifierKey}' in ${filePath}`\n );\n }\n\n // Find the 'content' property within the identified dictionary object\n const contentPropertyPath = (\n (dictionaryObjectPath as any).get('properties') as NodePath<\n t.ObjectProperty | t.SpreadElement | t.ObjectMethod\n >[]\n ).find((propPath) => {\n if (!propPath.isObjectProperty()) return false;\n const propNode = propPath.node;\n const keyName = t.isIdentifier(propNode.key)\n ? propNode.key.name\n : t.isStringLiteral(propNode.key)\n ? propNode.key.value\n : null;\n return keyName === 'content';\n });\n\n if (\n !contentPropertyPath ||\n !contentPropertyPath.isObjectProperty() ||\n !(contentPropertyPath.get('value') as NodePath).isObjectExpression()\n ) {\n throw new Error(\n `Could not find 'content' object property, or it's not an object, in dictionary in ${filePath}`\n );\n }\n\n const contentObjectPath = contentPropertyPath.get(\n 'value'\n ) as NodePath<t.ObjectExpression>;\n\n /**\n * Build a Babel Expression for any JSON-serializable value or TypedNode.\n * - Translation nodes become t({...}) or string literal in per-locale files\n * - Objects recurse to ObjectExpression\n * - Arrays recurse to ArrayExpression\n * - Strings/numbers/booleans/null to corresponding literals\n */\n const buildValueNodeFromData = (data: any): t.Expression => {\n // Translation typed node\n if ((data as TypedNode)?.nodeType === NodeType.Translation) {\n const translationContent = data as TranslationContent;\n if (\n isPerLocaleDeclarationFile &&\n typeof locale === 'string' &&\n translationContent?.[NodeType.Translation]?.[locale] !== undefined\n ) {\n return buildValueNodeFromData(\n translationContent[NodeType.Translation][locale]\n );\n }\n const translationsObj = t.objectExpression(\n Object.entries(translationContent?.[NodeType.Translation] ?? {}).map(\n ([langKey, langValue]) => {\n const keyNode = t.isValidIdentifier(langKey)\n ? t.identifier(langKey)\n : t.stringLiteral(langKey);\n return t.objectProperty(keyNode, buildValueNodeFromData(langValue));\n }\n )\n );\n return t.callExpression(t.identifier('t'), [translationsObj]);\n }\n\n // Arrays\n if (Array.isArray(data)) {\n return t.arrayExpression(data.map((el) => buildValueNodeFromData(el)));\n }\n\n // Objects (plain)\n if (data && typeof data === 'object') {\n const props = Object.entries(data).map(([k, v]) => {\n const key = t.isValidIdentifier(k)\n ? t.identifier(k)\n : t.stringLiteral(k);\n return t.objectProperty(key, buildValueNodeFromData(v));\n });\n return t.objectExpression(props);\n }\n\n // Primitives\n switch (typeof data) {\n case 'string':\n return t.stringLiteral(data);\n case 'number':\n return t.numericLiteral(data);\n case 'boolean':\n return t.booleanLiteral(data);\n default:\n return t.nullLiteral();\n }\n };\n\n /** Ensure an object property exists on a given object expression path. */\n const ensureObjectProperty = (\n objPath: NodePath<t.ObjectExpression>,\n key: string\n ): NodePath<t.ObjectProperty> => {\n const existing = (\n objPath.get('properties') as NodePath<\n t.ObjectProperty | t.SpreadElement | t.ObjectMethod\n >[]\n ).find((propPath) => {\n if (!propPath.isObjectProperty()) return false;\n const propNode = propPath.node;\n const keyName = t.isIdentifier(propNode.key)\n ? propNode.key.name\n : t.isStringLiteral(propNode.key)\n ? propNode.key.value\n : null;\n return keyName === key;\n }) as NodePath<t.ObjectProperty> | undefined;\n\n if (existing) return existing;\n\n const keyNode = t.isValidIdentifier(key)\n ? t.identifier(key)\n : t.stringLiteral(key);\n const newProp = t.objectProperty(keyNode, t.objectExpression([]));\n objPath.node.properties.push(newProp);\n\n // Return a fresh path for the newly pushed property\n const props = objPath.get('properties') as NodePath<\n t.ObjectProperty | t.SpreadElement | t.ObjectMethod\n >[];\n return props[props.length - 1] as NodePath<t.ObjectProperty>;\n };\n\n /** Recursively merge a JSON-like value into an ObjectExpression property path. */\n const mergeValueIntoProperty = (\n propPath: NodePath<t.ObjectProperty>,\n value: any,\n propKeyForLogs: string\n ) => {\n const valuePath = propPath.get('value') as NodePath;\n\n // Translation typed node → either update t() args or replace value\n if ((value as TypedNode)?.nodeType === NodeType.Translation) {\n const translationContent = value as TranslationContent;\n if (\n valuePath.isCallExpression() &&\n t.isIdentifier(valuePath.node.callee) &&\n valuePath.node.callee.name === 't'\n ) {\n // Replace argument with the full translations object (simpler and robust)\n const translationsObj = t.objectExpression(\n Object.entries(translationContent?.[NodeType.Translation] ?? {}).map(\n ([langKey, langValue]) =>\n t.objectProperty(\n t.isValidIdentifier(langKey)\n ? t.identifier(langKey)\n : t.stringLiteral(langKey),\n buildValueNodeFromData(langValue)\n )\n )\n );\n\n if (isPerLocaleDeclarationFile && typeof locale === 'string') {\n const localized =\n translationContent?.[NodeType.Translation]?.[locale];\n if (localized !== undefined) {\n valuePath.replaceWith(buildValueNodeFromData(localized));\n return;\n }\n }\n\n (valuePath.node as t.CallExpression).arguments = [translationsObj];\n return;\n }\n\n // Otherwise, replace with a fresh node\n valuePath.replaceWith(buildValueNodeFromData(value));\n return;\n }\n\n // Arrays → replace entirely\n if (Array.isArray(value)) {\n valuePath.replaceWith(buildValueNodeFromData(value));\n return;\n }\n\n // Objects → ensure object expression and recurse into each key\n if (value && typeof value === 'object') {\n if (!valuePath.isObjectExpression()) {\n valuePath.replaceWith(t.objectExpression([]));\n }\n const objPath = valuePath as NodePath<t.ObjectExpression>;\n for (const [k, v] of Object.entries(value)) {\n const childProp = ensureObjectProperty(objPath, k);\n mergeValueIntoProperty(childProp, v, `${propKeyForLogs}.${k}`);\n }\n return;\n }\n\n // Primitives → replace\n valuePath.replaceWith(buildValueNodeFromData(value));\n return;\n };\n\n // Apply updates to each entry specified in the JSON (now supports deep nesting)\n for (const [entryKeyToUpdate, newEntryData] of Object.entries(\n updatesToApply\n )) {\n let targetPropertyPath = (\n contentObjectPath.get('properties') as NodePath<\n t.ObjectProperty | t.SpreadElement | t.ObjectMethod\n >[]\n ).find((propPath) => {\n if (!propPath.isObjectProperty()) return false;\n const propNode = propPath.node;\n const keyName = t.isIdentifier(propNode.key)\n ? propNode.key.name\n : t.isStringLiteral(propNode.key)\n ? propNode.key.value\n : null;\n return keyName === entryKeyToUpdate;\n }) as NodePath<t.ObjectProperty> | undefined;\n\n if (!targetPropertyPath) {\n const keyNode = t.isValidIdentifier(entryKeyToUpdate)\n ? t.identifier(entryKeyToUpdate)\n : t.stringLiteral(entryKeyToUpdate);\n // By default create an empty object; merge will replace if needed\n const newProperty = t.objectProperty(keyNode, t.objectExpression([]));\n contentObjectPath.node.properties.push(newProperty);\n const props = contentObjectPath.get('properties') as NodePath<\n t.ObjectProperty | t.SpreadElement | t.ObjectMethod\n >[];\n targetPropertyPath = props[\n props.length - 1\n ] as NodePath<t.ObjectProperty>;\n }\n\n mergeValueIntoProperty(targetPropertyPath, newEntryData, entryKeyToUpdate);\n }\n\n // Generate JavaScript/TypeScript code from the modified AST\n const generatedCode = generator(ast, {\n retainLines: true,\n comments: true,\n jsescOption: {\n minimal: true, // This ensures Unicode characters are not escaped\n },\n }).code;\n\n let finalCode = generatedCode;\n\n finalCode = await formatCode(filePath, finalCode);\n\n // Write the modified code back to the file\n try {\n await writeFile(filePath, finalCode, 'utf-8');\n logger(`Successfully updated ${filePath}`, {\n level: 'info',\n isVerbose: true,\n });\n } catch (error) {\n const err = error as Error;\n logger(`Failed to write updated file: ${filePath}`, {\n level: 'error',\n });\n throw new Error(`Failed to write updated file ${filePath}: ${err.message}`);\n }\n};\n"],"mappings":"AAAA,OAAO,eAAe;AACtB,YAAY,iBAAiB;AAC7B,OAAO,cAA4B;AACnC,YAAY,OAAO;AACnB,SAAS,cAAc,cAAc;AACrC,OAAO,mBAAmB;AAC1B;AAAA,EAEE;AAAA,OAGK;AACP,SAAS,kBAAkB;AAC3B,SAAS,UAAU,iBAAiB;AACpC,SAAS,eAAe;AACxB,SAAS,yCAAyC;AAClD,SAAS,kBAAkB;AAQpB,MAAM,cAAc,OACzB,UACA,eACkB;AAClB,QAAM,YAAY,aAAa,aAAa;AAE5C,QAAM;AAAA,IACJ,KAAK;AAAA,IACL,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,6BAA6B,OAAO,WAAW;AAGrD,MAAI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SAAS;AAC1B,YAAM,UAAU,EAAE,aAAa,SAAS,GAAG,IACvC,SAAS,IAAI,OACb,EAAE,gBAAgB,SAAS,GAAG,IAC5B,SAAS,IAAI,QACb;AACN,aAAO,YAAY;AAAA,IACrB,CAAC;AAED,QAAI,CAAC,oBAAoB;AACvB,YAAM,UAAU,EAAE,kBAAkB,gBAAgB,IAChD,EAAE,WAAW,gBAAgB,IAC7B,EAAE,cAAc,gBAAgB;AAEpC,YAAM,cAAc,EAAE,eAAe,SAAS,EAAE,iBAAiB,CAAC,CAAC,CAAC;AACpE,wBAAkB,KAAK,WAAW,KAAK,WAAW;AAClD,YAAM,QAAQ,kBAAkB,IAAI,YAAY;AAGhD,2BAAqB,MACnB,MAAM,SAAS,CACjB;AAAA,IACF;AAEA,2BAAuB,oBAAoB,cAAc,gBAAgB;AAAA,EAC3E;AAGA,QAAM,gBAAgB,UAAU,KAAK;AAAA,IACnC,aAAa;AAAA,IACb,UAAU;AAAA,IACV,aAAa;AAAA,MACX,SAAS;AAAA;AAAA,IACX;AAAA,EACF,CAAC,EAAE;AAEH,MAAI,YAAY;AAEhB,cAAY,MAAM,WAAW,UAAU,SAAS;AAGhD,MAAI;AACF,UAAM,UAAU,UAAU,WAAW,OAAO;AAC5C,WAAO,wBAAwB,QAAQ,IAAI;AAAA,MACzC,OAAO;AAAA,MACP,WAAW;AAAA,IACb,CAAC;AAAA,EACH,SAAS,OAAO;AACd,UAAM,MAAM;AACZ,WAAO,iCAAiC,QAAQ,IAAI;AAAA,MAClD,OAAO;AAAA,IACT,CAAC;AACD,UAAM,IAAI,MAAM,gCAAgC,QAAQ,KAAK,IAAI,OAAO,EAAE;AAAA,EAC5E;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/writeContentDeclaration/writeJSFile.ts"],"sourcesContent":["import * as generate from '@babel/generator';\nimport * as babelParser from '@babel/parser';\nimport type { NodePath } from '@babel/traverse';\nimport * as babelTraverse from '@babel/traverse';\nimport * as t from '@babel/types';\nimport { getAppLogger, logger } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport {\n Dictionary,\n NodeType,\n TranslationContent,\n TypedNode,\n} from '@intlayer/core';\nimport { existsSync } from 'fs';\nimport { readFile, writeFile } from 'fs/promises';\nimport { extname } from 'path';\nimport { getContentDeclarationFileTemplate } from '../getContentDeclarationFileTemplate/getContentDeclarationFileTemplate';\nimport { formatCode } from './formatCode';\n\n/**\n * Updates a JavaScriptå/TypeScript file based on the provided JSON instructions.\n * It targets a specific dictionary object within the file (identified by its 'key' property)\n * and updates its 'content' entries. Currently, it focuses on modifying arguments\n * of 't' (translation) function calls.\n */\nexport const writeJSFile = async (\n filePath: string,\n dictionary: Dictionary\n): Promise<void> => {\n // Ensure compatibility with various ESM/CJS interop shapes of @babel/traverse\n const normalizeTraverse = (mod: unknown) => {\n const candidate = mod as any;\n if (typeof candidate === 'function') return candidate;\n if (candidate?.default) {\n if (typeof candidate.default === 'function') return candidate.default;\n if (typeof candidate.default?.default === 'function')\n return candidate.default.default;\n if (typeof candidate.default?.traverse === 'function')\n return candidate.default.traverse;\n }\n if (typeof candidate?.traverse === 'function') return candidate.traverse;\n return candidate;\n };\n\n const traverse = normalizeTraverse(babelTraverse) as any;\n const appLogger = getAppLogger(configuration);\n\n const {\n key: dictionaryIdentifierKey,\n content: updatesToApply,\n locale,\n autoFilled,\n } = dictionary;\n const isPerLocaleDeclarationFile = typeof locale === 'string';\n\n // Check if the file exist\n if (!existsSync(filePath)) {\n const fileExtension = extname(filePath);\n\n let format = 'ts' as 'ts' | 'cjs' | 'esm';\n\n if (fileExtension === '.ts' || fileExtension === '.tsx') {\n format = 'ts';\n } else if (fileExtension === '.cjs' || fileExtension === '.cjsx') {\n format = 'cjs';\n } else {\n format = 'esm';\n }\n\n appLogger('File does not exist, creating it', {\n isVerbose: true,\n });\n const template = await getContentDeclarationFileTemplate(\n dictionaryIdentifierKey,\n format,\n { locale, autoFilled }\n );\n\n await writeFile(filePath, template, 'utf-8');\n }\n\n let sourceCode: string;\n try {\n sourceCode = await readFile(filePath, 'utf-8');\n } catch (error) {\n const err = error as Error;\n appLogger(`Failed to read file: ${filePath}`, {\n level: 'error',\n });\n throw new Error(`Failed to read file ${filePath}: ${err.message}`);\n }\n\n const ast = babelParser.parse(sourceCode, {\n sourceType: 'module',\n plugins: ['typescript', 'jsx'],\n tokens: true,\n });\n\n let dictionaryObjectPath: NodePath<t.ObjectExpression> | null = null;\n let dictionaryIdentifier: string | null = null;\n\n // First look for direct objects with the right key, regardless of variable assignments\n traverse(ast, {\n ObjectExpression(path: NodePath<t.ObjectExpression>) {\n if (dictionaryObjectPath) return; // Already found\n\n // Check if this object has a key property with the right value\n const keyProp = path.node.properties.find(\n (prop: t.ObjectProperty | t.SpreadElement | t.ObjectMethod) => {\n if (!t.isObjectProperty(prop)) return false;\n if (!t.isIdentifier(prop.key) && !t.isStringLiteral(prop.key))\n return false;\n\n const keyName = t.isIdentifier(prop.key)\n ? prop.key.name\n : prop.key.value;\n\n if (keyName !== 'key' || !t.isStringLiteral(prop.value)) return false;\n\n // Unescape the value for comparison\n const propValue = prop.value.value;\n // Compare actual string content, not just raw representation\n return propValue === dictionaryIdentifierKey;\n }\n );\n\n if (keyProp) {\n dictionaryObjectPath = path;\n path.stop();\n }\n },\n });\n\n // If not found directly, look for variable declarations and exports\n if (!dictionaryObjectPath) {\n appLogger(`Looking for variable declarations`, {\n isVerbose: true,\n });\n\n // Collect all variable declarations with objects\n const candidateVars: { id: string; path: NodePath<t.ObjectExpression> }[] =\n [];\n\n traverse(ast, {\n VariableDeclarator(path: NodePath<t.VariableDeclarator>) {\n const { node } = path;\n if (!t.isIdentifier(node.id)) return;\n\n let objPath: NodePath<t.ObjectExpression> | null = null;\n\n // Direct object assignment\n if (node.init && t.isObjectExpression(node.init)) {\n objPath = path.get('init') as NodePath<t.ObjectExpression>;\n }\n // Object with TS type assertion (satisfies/as)\n else if (\n node.init &&\n (t.isTSAsExpression(node.init) || t.isTSTypeAssertion(node.init)) &&\n t.isObjectExpression(node.init.expression)\n ) {\n objPath = path.get('init.expression') as NodePath<t.ObjectExpression>;\n }\n\n if (objPath) {\n candidateVars.push({ id: node.id.name, path: objPath });\n }\n },\n });\n\n appLogger(`Found ${candidateVars.length} candidate variables`, {\n isVerbose: true,\n });\n\n // Check each candidate for the key property\n for (const { id, path } of candidateVars) {\n const keyProp = path.node.properties.find((prop) => {\n if (!t.isObjectProperty(prop)) return false;\n if (!t.isIdentifier(prop.key) && !t.isStringLiteral(prop.key))\n return false;\n\n const keyName = t.isIdentifier(prop.key)\n ? prop.key.name\n : prop.key.value;\n return (\n keyName === 'key' &&\n t.isStringLiteral(prop.value) &&\n prop.value.value === dictionaryIdentifierKey\n );\n });\n\n if (keyProp) {\n appLogger(`Found match in variable: ${id}`);\n dictionaryObjectPath = path;\n dictionaryIdentifier = id;\n break;\n }\n }\n\n // If still not found, dump all object expressions for debugging\n if (!dictionaryObjectPath) {\n appLogger('Could not find dictionary object. Dumping all objects:', {\n isVerbose: true,\n });\n traverse(ast, {\n ObjectExpression(path: NodePath<t.ObjectExpression>) {\n const props = path.node.properties\n .map(\n (prop: t.ObjectProperty | t.SpreadElement | t.ObjectMethod) => {\n if (!t.isObjectProperty(prop)) return 'non-object-property';\n if (!t.isIdentifier(prop.key) && !t.isStringLiteral(prop.key))\n return 'complex-key';\n\n const keyName = t.isIdentifier(prop.key)\n ? prop.key.name\n : prop.key.value;\n let valueDesc = 'unknown-value';\n\n if (t.isStringLiteral(prop.value)) {\n valueDesc = `\"${prop.value.value}\"`;\n }\n\n return `${keyName}: ${valueDesc}`;\n }\n )\n .join(', ');\n\n appLogger(`Object: { ${props} }`);\n },\n });\n }\n }\n\n if (!dictionaryObjectPath) {\n throw new Error(\n `Could not find dictionary object with key '${dictionaryIdentifierKey}' in ${filePath}`\n );\n }\n\n // Find the 'content' property within the identified dictionary object\n const contentPropertyPath = (\n (dictionaryObjectPath as any).get('properties') as NodePath<\n t.ObjectProperty | t.SpreadElement | t.ObjectMethod\n >[]\n ).find((propPath) => {\n if (!propPath.isObjectProperty()) return false;\n const propNode = propPath.node;\n const keyName = t.isIdentifier(propNode.key)\n ? propNode.key.name\n : t.isStringLiteral(propNode.key)\n ? propNode.key.value\n : null;\n return keyName === 'content';\n });\n\n if (\n !contentPropertyPath ||\n !contentPropertyPath.isObjectProperty() ||\n !(contentPropertyPath.get('value') as NodePath).isObjectExpression()\n ) {\n throw new Error(\n `Could not find 'content' object property, or it's not an object, in dictionary in ${filePath}`\n );\n }\n\n const contentObjectPath = contentPropertyPath.get(\n 'value'\n ) as NodePath<t.ObjectExpression>;\n\n /**\n * Build a Babel Expression for any JSON-serializable value or TypedNode.\n * - Translation nodes become t({...}) or string literal in per-locale files\n * - Objects recurse to ObjectExpression\n * - Arrays recurse to ArrayExpression\n * - Strings/numbers/booleans/null to corresponding literals\n */\n const buildValueNodeFromData = (data: any): t.Expression => {\n // Translation typed node\n if ((data as TypedNode)?.nodeType === NodeType.Translation) {\n const translationContent = data as TranslationContent;\n if (\n isPerLocaleDeclarationFile &&\n typeof locale === 'string' &&\n translationContent?.[NodeType.Translation]?.[locale] !== undefined\n ) {\n return buildValueNodeFromData(\n translationContent[NodeType.Translation][locale]\n );\n }\n const translationsObj = t.objectExpression(\n Object.entries(translationContent?.[NodeType.Translation] ?? {}).map(\n ([langKey, langValue]) => {\n const keyNode = t.isValidIdentifier(langKey)\n ? t.identifier(langKey)\n : t.stringLiteral(langKey);\n return t.objectProperty(keyNode, buildValueNodeFromData(langValue));\n }\n )\n );\n return t.callExpression(t.identifier('t'), [translationsObj]);\n }\n\n // Arrays\n if (Array.isArray(data)) {\n return t.arrayExpression(data.map((el) => buildValueNodeFromData(el)));\n }\n\n // Objects (plain)\n if (data && typeof data === 'object') {\n const props = Object.entries(data).map(([k, v]) => {\n const key = t.isValidIdentifier(k)\n ? t.identifier(k)\n : t.stringLiteral(k);\n return t.objectProperty(key, buildValueNodeFromData(v));\n });\n return t.objectExpression(props);\n }\n\n // Primitives\n switch (typeof data) {\n case 'string':\n return t.stringLiteral(data);\n case 'number':\n return t.numericLiteral(data);\n case 'boolean':\n return t.booleanLiteral(data);\n default:\n return t.nullLiteral();\n }\n };\n\n /** Ensure an object property exists on a given object expression path. */\n const ensureObjectProperty = (\n objPath: NodePath<t.ObjectExpression>,\n key: string\n ): NodePath<t.ObjectProperty> => {\n const existing = (\n objPath.get('properties') as NodePath<\n t.ObjectProperty | t.SpreadElement | t.ObjectMethod\n >[]\n ).find((propPath) => {\n if (!propPath.isObjectProperty()) return false;\n const propNode = propPath.node;\n const keyName = t.isIdentifier(propNode.key)\n ? propNode.key.name\n : t.isStringLiteral(propNode.key)\n ? propNode.key.value\n : null;\n return keyName === key;\n }) as NodePath<t.ObjectProperty> | undefined;\n\n if (existing) return existing;\n\n const keyNode = t.isValidIdentifier(key)\n ? t.identifier(key)\n : t.stringLiteral(key);\n const newProp = t.objectProperty(keyNode, t.objectExpression([]));\n objPath.node.properties.push(newProp);\n\n // Return a fresh path for the newly pushed property\n const props = objPath.get('properties') as NodePath<\n t.ObjectProperty | t.SpreadElement | t.ObjectMethod\n >[];\n return props[props.length - 1] as NodePath<t.ObjectProperty>;\n };\n\n /** Recursively merge a JSON-like value into an ObjectExpression property path. */\n const mergeValueIntoProperty = (\n propPath: NodePath<t.ObjectProperty>,\n value: any,\n propKeyForLogs: string\n ) => {\n const valuePath = propPath.get('value') as NodePath;\n\n // Translation typed node → either update t() args or replace value\n if ((value as TypedNode)?.nodeType === NodeType.Translation) {\n const translationContent = value as TranslationContent;\n if (\n valuePath.isCallExpression() &&\n t.isIdentifier(valuePath.node.callee) &&\n valuePath.node.callee.name === 't'\n ) {\n // Replace argument with the full translations object (simpler and robust)\n const translationsObj = t.objectExpression(\n Object.entries(translationContent?.[NodeType.Translation] ?? {}).map(\n ([langKey, langValue]) =>\n t.objectProperty(\n t.isValidIdentifier(langKey)\n ? t.identifier(langKey)\n : t.stringLiteral(langKey),\n buildValueNodeFromData(langValue)\n )\n )\n );\n\n if (isPerLocaleDeclarationFile && typeof locale === 'string') {\n const localized =\n translationContent?.[NodeType.Translation]?.[locale];\n if (localized !== undefined) {\n valuePath.replaceWith(buildValueNodeFromData(localized));\n return;\n }\n }\n\n (valuePath.node as t.CallExpression).arguments = [translationsObj];\n return;\n }\n\n // Otherwise, replace with a fresh node\n valuePath.replaceWith(buildValueNodeFromData(value));\n return;\n }\n\n // Arrays → replace entirely\n if (Array.isArray(value)) {\n valuePath.replaceWith(buildValueNodeFromData(value));\n return;\n }\n\n // Objects → ensure object expression and recurse into each key\n if (value && typeof value === 'object') {\n if (!valuePath.isObjectExpression()) {\n valuePath.replaceWith(t.objectExpression([]));\n }\n const objPath = valuePath as NodePath<t.ObjectExpression>;\n for (const [k, v] of Object.entries(value)) {\n const childProp = ensureObjectProperty(objPath, k);\n mergeValueIntoProperty(childProp, v, `${propKeyForLogs}.${k}`);\n }\n return;\n }\n\n // Primitives → replace\n valuePath.replaceWith(buildValueNodeFromData(value));\n return;\n };\n\n // Apply updates to each entry specified in the JSON (now supports deep nesting)\n for (const [entryKeyToUpdate, newEntryData] of Object.entries(\n updatesToApply\n )) {\n let targetPropertyPath = (\n contentObjectPath.get('properties') as NodePath<\n t.ObjectProperty | t.SpreadElement | t.ObjectMethod\n >[]\n ).find((propPath) => {\n if (!propPath.isObjectProperty()) return false;\n const propNode = propPath.node;\n const keyName = t.isIdentifier(propNode.key)\n ? propNode.key.name\n : t.isStringLiteral(propNode.key)\n ? propNode.key.value\n : null;\n return keyName === entryKeyToUpdate;\n }) as NodePath<t.ObjectProperty> | undefined;\n\n if (!targetPropertyPath) {\n const keyNode = t.isValidIdentifier(entryKeyToUpdate)\n ? t.identifier(entryKeyToUpdate)\n : t.stringLiteral(entryKeyToUpdate);\n // By default create an empty object; merge will replace if needed\n const newProperty = t.objectProperty(keyNode, t.objectExpression([]));\n contentObjectPath.node.properties.push(newProperty);\n const props = contentObjectPath.get('properties') as NodePath<\n t.ObjectProperty | t.SpreadElement | t.ObjectMethod\n >[];\n targetPropertyPath = props[\n props.length - 1\n ] as NodePath<t.ObjectProperty>;\n }\n\n mergeValueIntoProperty(targetPropertyPath, newEntryData, entryKeyToUpdate);\n }\n\n // Generate JavaScript/TypeScript code from the modified AST\n const generatedCode = generate.generate(ast, {\n retainLines: true,\n comments: true,\n jsescOption: {\n minimal: true, // This ensures Unicode characters are not escaped\n },\n }).code;\n\n let finalCode = generatedCode;\n\n finalCode = await formatCode(filePath, finalCode);\n\n // Write the modified code back to the file\n try {\n await writeFile(filePath, finalCode, 'utf-8');\n logger(`Successfully updated ${filePath}`, {\n level: 'info',\n isVerbose: true,\n });\n } catch (error) {\n const err = error as Error;\n logger(`Failed to write updated file: ${filePath}`, {\n level: 'error',\n });\n throw new Error(`Failed to write updated file ${filePath}: ${err.message}`);\n }\n};\n"],"mappings":"AAAA,YAAY,cAAc;AAC1B,YAAY,iBAAiB;AAE7B,YAAY,mBAAmB;AAC/B,YAAY,OAAO;AACnB,SAAS,cAAc,cAAc;AACrC,OAAO,mBAAmB;AAC1B;AAAA,EAEE;AAAA,OAGK;AACP,SAAS,kBAAkB;AAC3B,SAAS,UAAU,iBAAiB;AACpC,SAAS,eAAe;AACxB,SAAS,yCAAyC;AAClD,SAAS,kBAAkB;AAQpB,MAAM,cAAc,OACzB,UACA,eACkB;AAElB,QAAM,oBAAoB,CAAC,QAAiB;AAC1C,UAAM,YAAY;AAClB,QAAI,OAAO,cAAc,WAAY,QAAO;AAC5C,QAAI,WAAW,SAAS;AACtB,UAAI,OAAO,UAAU,YAAY,WAAY,QAAO,UAAU;AAC9D,UAAI,OAAO,UAAU,SAAS,YAAY;AACxC,eAAO,UAAU,QAAQ;AAC3B,UAAI,OAAO,UAAU,SAAS,aAAa;AACzC,eAAO,UAAU,QAAQ;AAAA,IAC7B;AACA,QAAI,OAAO,WAAW,aAAa,WAAY,QAAO,UAAU;AAChE,WAAO;AAAA,EACT;AAEA,QAAM,WAAW,kBAAkB,aAAa;AAChD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,EAC5E;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../../../src/chokidar/watcher.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,KAAK,cAAc,EAGpB,MAAM,kBAAkB,CAAC;AAE1B,2FAA2F;AAC3F,OAAO,EAAE,KAAK,eAAe,EAA0B,MAAM,UAAU,CAAC;AAcxE,eAAO,MAAM,sCAAsC,GACjD,UAAU,MAAM,EAChB,gBAAgB,cAAc,kBAmC/B,CAAC;AAEF,eAAO,MAAM,mCAAmC,GAC9C,UAAU,MAAM,EAChB,gBAAgB,cAAc,kBAkC/B,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAC7C,UAAU,MAAM,EAChB,gBAAgB,cAAc,kBAqC/B,CAAC;AAEF,KAAK,YAAY,GAAG,eAAe,GAAG;IACpC,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACzC,CAAC;AAGF,eAAO,MAAM,KAAK,GAAI,UAAU,YAAY,QA+C3C,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAU,UAAU,YAAY,kBAUjE,CAAC"}
1
+ {"version":3,"file":"watcher.d.ts","sourceRoot":"","sources":["../../../src/chokidar/watcher.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,KAAK,cAAc,EAGpB,MAAM,kBAAkB,CAAC;AAE1B,2FAA2F;AAC3F,OAAO,EAAE,KAAK,eAAe,EAA0B,MAAM,UAAU,CAAC;AAexE,eAAO,MAAM,sCAAsC,GACjD,UAAU,MAAM,EAChB,gBAAgB,cAAc,kBA+B/B,CAAC;AAEF,eAAO,MAAM,mCAAmC,GAC9C,UAAU,MAAM,EAChB,gBAAgB,cAAc,kBAiC/B,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAC7C,UAAU,MAAM,EAChB,gBAAgB,cAAc,kBAoC/B,CAAC;AAEF,KAAK,YAAY,GAAG,eAAe,GAAG;IACpC,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,aAAa,CAAC,EAAE,uBAAuB,CAAC;CACzC,CAAC;AAGF,eAAO,MAAM,KAAK,GAAI,UAAU,YAAY,QA+C3C,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAU,UAAU,YAAY,kBAUjE,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { DictionaryAPI } from '@intlayer/backend';
2
+ import { DictionariesStatus } from './loadDictionaries';
2
3
  type FetchDistantDictionariesOptions = {
3
4
  dictionaryKeys: string[];
4
5
  newDictionariesPath?: string;
@@ -7,6 +8,6 @@ type FetchDistantDictionariesOptions = {
7
8
  /**
8
9
  * Fetch distant dictionaries and update the logger with their statuses.
9
10
  */
10
- export declare const fetchDistantDictionaries: (options: FetchDistantDictionariesOptions) => Promise<DictionaryAPI[]>;
11
+ export declare const fetchDistantDictionaries: (options: FetchDistantDictionariesOptions, onStatusUpdate?: (status: DictionariesStatus[]) => void) => Promise<DictionaryAPI[]>;
11
12
  export {};
12
13
  //# sourceMappingURL=fetchDistantDictionaries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchDistantDictionaries.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKvD,KAAK,+BAA+B,GAAG;IACrC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,+BAA+B,KACvC,OAAO,CAAC,aAAa,EAAE,CAoGzB,CAAC"}
1
+ {"version":3,"file":"fetchDistantDictionaries.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAOvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,KAAK,+BAA+B,GAAG;IACrC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,+BAA+B,EACxC,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,IAAI,KACtD,OAAO,CAAC,aAAa,EAAE,CA0FzB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type IntlayerConfig } from '@intlayer/config';
2
+ export declare const fetchDistantDictionaryKeysAndUpdateTimestamp: (configuration?: IntlayerConfig) => Promise<Record<string, number>>;
3
+ //# sourceMappingURL=fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaryKeysAndUpdateTimestamp.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEzE,eAAO,MAAM,4CAA4C,GACvD,gBAAe,cAAmC,KACjD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAwBhC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Dictionary } from '@intlayer/core';
2
+ export declare const filterInvalidDictionaries: (dictionaries: (Dictionary | undefined)[] | undefined) => Dictionary[];
3
+ //# sourceMappingURL=filterInvalidDictionaries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterInvalidDictionaries.d.ts","sourceRoot":"","sources":["../../src/filterInvalidDictionaries.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,eAAO,MAAM,yBAAyB,GACpC,cAAc,CAAC,UAAU,GAAG,SAAS,CAAC,EAAE,GAAG,SAAS,KACnD,UAAU,EAiCZ,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This function generates a list of dictionaries in the main directory
3
+ */
4
+ export declare const getBuiltFetchDictionariesPath: (configuration?: import("@intlayer/config").IntlayerConfig, format?: "cjs" | "esm") => string[];
5
+ //# sourceMappingURL=getBuiltFetchDictionariesPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBuiltFetchDictionariesPath.d.ts","sourceRoot":"","sources":["../../src/getBuiltFetchDictionariesPath.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,6BAA6B,GACxC,yDAAkC,EAClC,SAAQ,KAAK,GAAG,KAAa,aAgB9B,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This function generates a list of dictionaries in the main directory
3
+ */
4
+ export declare const getBuiltRemoteDictionariesPath: (configuration?: import("@intlayer/config").IntlayerConfig) => string[];
5
+ //# sourceMappingURL=getBuiltRemoteDictionariesPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBuiltRemoteDictionariesPath.d.ts","sourceRoot":"","sources":["../../src/getBuiltRemoteDictionariesPath.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,8BAA8B,GACzC,yDAAkC,aAcnC,CAAC"}
@@ -1,14 +1,12 @@
1
- export { checkDictionaryChanges } from './checkDictionaryChanges';
2
1
  export { buildAndWatchIntlayer, handleAdditionalContentDeclarationFile, handleContentDeclarationFileChange, watch, } from './chokidar/watcher';
3
2
  export { cleanOutputDir } from './cleanOutputDir';
4
3
  export { fetchDistantDictionaries } from './fetchDistantDictionaries';
5
- export { fetchDistantDictionaryKeys } from './fetchDistantDictionaryKeys';
4
+ export { fetchDistantDictionaryKeysAndUpdateTimestamp } from './fetchDistantDictionaryKeysAndUpdateTimestamp';
6
5
  export { getBuiltDictionariesPath } from './getBuiltDictionariesPath';
7
6
  export { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';
8
- export { getFilteredLocalesContent } from './getFilteredLocalesContent';
9
7
  export { listDictionaries } from './listDictionariesPath';
10
8
  export { listGitFiles, listGitLines, type DiffMode, type ListGitFilesOptions, type ListGitLinesOptions, } from './listGitFiles';
11
- export { loadDictionaries, loadDistantDictionaries, loadLocalDictionaries, } from './loadDictionaries/index';
9
+ export { loadDictionaries, loadLocalDictionaries, loadRemoteDictionaries, } from './loadDictionaries/index';
12
10
  export { mergeDictionaries } from './mergeDictionaries';
13
11
  export { prepareContentDeclaration } from './prepareContentDeclaration';
14
12
  export { prepareIntlayer } from './prepareIntlayer';
@@ -17,8 +15,10 @@ export { reduceDictionaryContent } from './reduceDictionaryContent/reduceDiction
17
15
  export { buildDictionary } from './transpiler/declaration_file_to_dictionary/index';
18
16
  export { createDictionaryEntryPoint, generateDictionaryListContent, } from './transpiler/dictionary_to_main';
19
17
  export { createModuleAugmentation } from './transpiler/dictionary_to_type/createModuleAugmentation';
18
+ export { formatLocale, formatPath } from './utils/formatter';
20
19
  export { getFileHash } from './utils/getFileHash';
21
20
  export { kebabCaseToCamelCase } from './utils/kebabCaseToCamelCase';
21
+ export { parallelize } from './utils/parallelize';
22
22
  export { resolveObjectPromises } from './utils/resolveObjectPromises';
23
23
  export { runOnce } from './utils/runOnce';
24
24
  export { sortAlphabetically } from './utils/sortAlphabetically';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACL,qBAAqB,EACrB,sCAAsC,EACtC,kCAAkC,EAClC,KAAK,GACN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EA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O,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,GACtB,MAAM,2BAA2B,CAAC"}
@@ -1,5 +1,5 @@
1
+ export * from './loadContentDeclaration';
1
2
  export * from './loadDictionaries';
2
- export * from './loadDistantDictionaries';
3
3
  export * from './loadLocalDictionaries';
4
- export * from './loadContentDeclaration';
4
+ export * from './loadRemoteDictionaries';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC"}
@@ -1,3 +1,6 @@
1
+ import { IntlayerConfig } from '@intlayer/config';
1
2
  import type { Dictionary } from '@intlayer/core';
2
- export declare const loadContentDeclarations: (contentDeclarationFilePath: string[], projectRequire?: NodeJS.Require) => Promise<Dictionary[]>;
3
+ import { DictionariesStatus } from './loadDictionaries';
4
+ export declare const formatLocalDictionaries: (dictionariesRecord: Record<string, Dictionary>) => Dictionary[];
5
+ export declare const loadContentDeclarations: (contentDeclarationFilePath: string[], configuration?: IntlayerConfig, projectRequire?: NodeJS.Require, onStatusUpdate?: (status: DictionariesStatus[]) => void) => Promise<Dictionary[]>;
3
6
  //# sourceMappingURL=loadContentDeclaration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadContentDeclaration.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,eAAO,MAAM,uBAAuB,GAClC,4BAA4B,MAAM,EAAE,EACpC,+BAA+B,KAC9B,OAAO,CAAC,UAAU,EAAE,CAwBtB,CAAC"}
1
+ {"version":3,"file":"loadContentDeclaration.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadContentDeclaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EAEf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,eAAO,MAAM,uBAAuB,GAClC,oBAAoB,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,KAC7C,UAAU,EAMR,CAAC;AAEN,eAAO,MAAM,uBAAuB,GAClC,4BAA4B,MAAM,EAAE,EACpC,gBAAe,cAAmC,EAClD,+BAA+B,EAC/B,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,IAAI,KACtD,OAAO,CAAC,UAAU,EAAE,CA0DtB,CAAC"}
@@ -1,3 +1,13 @@
1
+ import { type IntlayerConfig } from '@intlayer/config';
1
2
  import type { Dictionary } from '@intlayer/core';
2
- export declare const loadDictionaries: (contentDeclarationsPaths: string[] | string, configuration?: import("@intlayer/config").IntlayerConfig, projectRequire?: NodeJS.Require) => Promise<Dictionary[]>;
3
+ export type DictionariesStatus = {
4
+ dictionaryKey: string;
5
+ type: 'local' | 'remote';
6
+ status: 'pending' | 'fetching' | 'fetched' | 'error' | 'imported' | 'found' | 'building' | 'built';
7
+ error?: string;
8
+ };
9
+ export declare const loadDictionaries: (contentDeclarationsPaths: string[] | string, configuration?: IntlayerConfig, projectRequire?: NodeJS.Require) => Promise<{
10
+ localDictionaries: Dictionary[];
11
+ remoteDictionaries: Dictionary[];
12
+ }>;
3
13
  //# sourceMappingURL=loadDictionaries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadDictionaries.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAQjD,eAAO,MAAM,gBAAgB,GAC3B,0BAA0B,MAAM,EAAE,GAAG,MAAM,EAC3C,yDAAkC,EAClC,+BAA+B,KAC9B,OAAO,CAAC,UAAU,EAAE,CAqFtB,CAAC"}
1
+ {"version":3,"file":"loadDictionaries.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMjD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzB,MAAM,EACF,SAAS,GACT,UAAU,GACV,SAAS,GACT,OAAO,GACP,UAAU,GACV,OAAO,GACP,UAAU,GACV,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA6GF,eAAO,MAAM,gBAAgB,GAC3B,0BAA0B,MAAM,EAAE,GAAG,MAAM,EAC3C,gBAAe,cAAmC,EAClD,+BAA+B,KAC9B,OAAO,CAAC;IACT,iBAAiB,EAAE,UAAU,EAAE,CAAC;IAChC,kBAAkB,EAAE,UAAU,EAAE,CAAC;CAClC,CAuEA,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { DictionaryAPI } from '@intlayer/backend';
2
+ import type { Dictionary } from '@intlayer/core';
3
+ import { DictionariesStatus } from '../loadDictionaries/loadDictionaries';
4
+ export declare const formatDistantDictionaries: (dictionaries: DictionaryAPI[]) => Dictionary[];
5
+ export declare const loadRemoteDictionaries: (configuration?: import("@intlayer/config").IntlayerConfig, onStatusUpdate?: (status: DictionariesStatus[]) => void) => Promise<DictionaryAPI[]>;
6
+ //# sourceMappingURL=loadRemoteDictionaries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadRemoteDictionaries.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAIjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,eAAO,MAAM,yBAAyB,GACpC,cAAc,aAAa,EAAE,KAC5B,UAAU,EAKR,CAAC;AAEN,eAAO,MAAM,sBAAsB,GACjC,yDAAkC,EAClC,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,IAAI,KACtD,OAAO,CAAC,aAAa,EAAE,CAuGzB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { DictionariesStatus } from './loadDictionaries';
2
+ export declare class DictionariesLogger {
3
+ private statuses;
4
+ private spinnerTimer;
5
+ private spinnerIndex;
6
+ private renderedLines;
7
+ private readonly spinnerFrames;
8
+ private isFinished;
9
+ private readonly prefix;
10
+ private lastRenderedState;
11
+ constructor();
12
+ update(newStatuses: DictionariesStatus[]): void;
13
+ finish(): void;
14
+ private startSpinner;
15
+ private stopSpinner;
16
+ private render;
17
+ private computeProgress;
18
+ }
19
+ //# sourceMappingURL=log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/log.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAC/C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,iBAAiB,CAAc;;IAOvC,MAAM,CAAC,WAAW,EAAE,kBAAkB,EAAE;IAkBxC,MAAM;IAON,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,MAAM;IAwDd,OAAO,CAAC,eAAe;CAyCxB"}
@@ -1,3 +1,3 @@
1
- import type { Dictionary } from '@intlayer/core';
1
+ import { type Dictionary } from '@intlayer/core';
2
2
  export declare const mergeDictionaries: (dictionaries: Dictionary[]) => Dictionary;
3
3
  //# sourceMappingURL=mergeDictionaries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mergeDictionaries.d.ts","sourceRoot":"","sources":["../../src/mergeDictionaries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAuGjD,eAAO,MAAM,iBAAiB,GAAI,cAAc,UAAU,EAAE,KAAG,UAuC9D,CAAC"}
1
+ {"version":3,"file":"mergeDictionaries.d.ts","sourceRoot":"","sources":["../../src/mergeDictionaries.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,gBAAgB,CAAC;AAuG9D,eAAO,MAAM,iBAAiB,GAAI,cAAc,UAAU,EAAE,KAAG,UAoC9D,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Dictionary } from '@intlayer/core';
2
+ /**
3
+ * Orders dictionaries based on the dictionary priority strategy.
4
+ *
5
+ * @param dictionaries - Array of dictionaries to order
6
+ * @param priorityStrategy - The priority strategy ('local_first' or 'distant_first')
7
+ * @returns Ordered array of dictionaries
8
+ */
9
+ export declare const orderDictionaries: (dictionaries: Dictionary[], configuration?: import("@intlayer/config").IntlayerConfig) => Dictionary[];
10
+ //# sourceMappingURL=orderDictionaries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orderDictionaries.d.ts","sourceRoot":"","sources":["../../src/orderDictionaries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,cAAc,UAAU,EAAE,EAC1B,yDAA8B,KAC7B,UAAU,EAiDZ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"prepareContentDeclaration.d.ts","sourceRoot":"","sources":["../../src/prepareContentDeclaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,UAAU,EAQhB,MAAM,gBAAgB,CAAC;AAyFxB,eAAO,MAAM,yBAAyB,GAAU,YAAY,UAAU,iBAKlE,CAAC"}
1
+ {"version":3,"file":"prepareContentDeclaration.d.ts","sourceRoot":"","sources":["../../src/prepareContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,UAAU,EAQhB,MAAM,gBAAgB,CAAC;AA2FxB,eAAO,MAAM,yBAAyB,GAAU,YAAY,UAAU,iBAKlE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"prepareIntlayer.d.ts","sourceRoot":"","sources":["../../src/prepareIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,kBAAkB,CAAC;AAY1B,eAAO,MAAM,eAAe,GAC1B,gBAAe,cAAmC,EAClD,+BAA+B,EAC/B,eAAa,kBAwCd,CAAC"}
1
+ {"version":3,"file":"prepareIntlayer.d.ts","sourceRoot":"","sources":["../../src/prepareIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,kBAAkB,CAAC;AAa1B,eAAO,MAAM,eAAe,GAC1B,gBAAe,cAAmC,EAClD,+BAA+B,EAC/B,eAAa,kBA+Cd,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type Dictionary } from '@intlayer/core';
2
2
  /**
3
3
  *
4
- * Should transform per locale dictionaries to multi-locale dictionaries
4
+ * Should transform per local dictionaries to multi-local dictionaries
5
5
  *
6
6
  * Example:
7
7
  *
@@ -3,5 +3,6 @@ export declare const buildDictionary: (dictionaries: Dictionary[], configuration
3
3
  unmergedDictionaries: import("./intlayer_dictionary/writeUnmergedDictionary").UnmergedDictionaryOutput;
4
4
  mergedDictionaries: import("./intlayer_dictionary/writeMergedDictionary").MergedDictionaryOutput;
5
5
  dynamicDictionaries: import("./intlayer_dictionary/writeDynamicDictionary").LocalizedDictionaryOutput;
6
+ fetchDictionaries: import("./intlayer_dictionary/writeDynamicDictionary").LocalizedDictionaryOutput;
6
7
  }>;
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/declaration_file_to_dictionary/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAIjD,eAAO,MAAM,eAAe,GAC1B,cAAc,UAAU,EAAE,EAC1B,yDAAkC;;;;EAWnC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/declaration_file_to_dictionary/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAIjD,eAAO,MAAM,eAAe,GAC1B,cAAc,UAAU,EAAE,EAC1B,yDAAkC;;;;;EAWnC,CAAC"}
@@ -1,11 +1,12 @@
1
- import type { DictionaryAPI } from '@intlayer/backend';
2
1
  import type { Dictionary } from '@intlayer/core';
2
+ import { LocalizedDictionaryOutput } from './writeDynamicDictionary';
3
3
  /**
4
4
  * This function transpile the bundled code to to make dictionaries as JSON files
5
5
  */
6
- export declare const buildIntlayerDictionary: (contentDeclarations: (DictionaryAPI | Dictionary)[], configuration?: import("@intlayer/config").IntlayerConfig, formats?: ("cjs" | "esm")[]) => Promise<{
6
+ export declare const buildIntlayerDictionary: (localDictionariesEntries: Dictionary[], configuration?: import("@intlayer/config").IntlayerConfig, formats?: ("cjs" | "esm")[]) => Promise<{
7
7
  unmergedDictionaries: import("./writeUnmergedDictionary").UnmergedDictionaryOutput;
8
8
  mergedDictionaries: import("./writeMergedDictionary").MergedDictionaryOutput;
9
- dynamicDictionaries: import("./writeDynamicDictionary").LocalizedDictionaryOutput;
9
+ dynamicDictionaries: LocalizedDictionaryOutput;
10
+ fetchDictionaries: LocalizedDictionaryOutput;
10
11
  }>;
11
12
  //# sourceMappingURL=buildIntlayerDictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildIntlayerDictionary.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKjD;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,qBAAqB,CAAC,aAAa,GAAG,UAAU,CAAC,EAAE,EACnD,yDAAkC,EAClC,UAAS,CAAC,KAAK,GAAG,KAAK,CAAC,EAAmB;;;;EAuB5C,CAAC"}
1
+ {"version":3,"file":"buildIntlayerDictionary.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,yBAAyB,EAE1B,MAAM,0BAA0B,CAAC;AAKlC;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAClC,0BAA0B,UAAU,EAAE,EACtC,yDAAkC,EAClC,UAAS,CAAC,KAAK,GAAG,KAAK,CAAC,EAAmB;;;;;EAwC5C,CAAC"}
@@ -23,7 +23,7 @@ export declare const generateDictionaryEntryPoint: (localedDictionariesPathsReco
23
23
  * const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries);
24
24
  * console.log(finalDictionaries);
25
25
  *
26
- * // .intlayer/dictionaries/home.json
26
+ * // .intlayer/dynamic_dictionaries/home.json
27
27
  * // { key: 'home', content: { ... } },
28
28
  * ```
29
29
  */
@@ -1 +1 @@
1
- {"version":3,"file":"writeDynamicDictionary.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,MAAM,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAClC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAC5C,MAAM,EACN,yBAAyB,CAC1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GACvC,gCAAgC,yBAAyB,EACzD,SAAQ,KAAK,GAAG,KAAa,EAC7B,yDAAkC,KACjC,MA6BF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GACjC,oBAAoB,sBAAsB,EAC1C,yDAAkC,EAClC,UAAS,CAAC,KAAK,GAAG,KAAK,CAAC,EAAmB,KAC1C,OAAO,CAAC,yBAAyB,CA+DnC,CAAC"}
1
+ {"version":3,"file":"writeDynamicDictionary.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,OAAO,EAAiB,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,MAAM,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAClC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAC5C,MAAM,EACN,yBAAyB,CAC1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GACvC,gCAAgC,yBAAyB,EACzD,SAAQ,KAAK,GAAG,KAAa,EAC7B,yDAAkC,KACjC,MA4BF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GACjC,oBAAoB,sBAAsB,EAC1C,yDAAkC,EAClC,UAAS,CAAC,KAAK,GAAG,KAAK,CAAC,EAAmB,KAC1C,OAAO,CAAC,yBAAyB,CAiEnC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { LocalizedDictionaryOutput, LocalizedDictionaryResult } from './writeDynamicDictionary';
2
+ /**
3
+ * This function generates the content of the dictionary list file
4
+ */
5
+ export declare const generateDictionaryEntryPoint: (localedDictionariesPathsRecord: LocalizedDictionaryResult, format?: "cjs" | "esm", configuration?: import("@intlayer/config").IntlayerConfig) => string;
6
+ /**
7
+ * Write the localized dictionaries to the dictionariesDir
8
+ * @param mergedDictionaries - The merged dictionaries
9
+ * @param configuration - The configuration
10
+ * @returns The final dictionaries
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);
15
+ * const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries);
16
+ * console.log(finalDictionaries);
17
+ *
18
+ * // .intlayer/fetch_dictionaries/home.json
19
+ * // { key: 'home', content: { ... } },
20
+ * ```
21
+ */
22
+ export declare const writeFetchDictionary: (dynamicDictionaries: LocalizedDictionaryOutput, configuration?: import("@intlayer/config").IntlayerConfig, formats?: ("cjs" | "esm")[]) => Promise<LocalizedDictionaryOutput>;
23
+ //# sourceMappingURL=writeFetchDictionary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writeFetchDictionary.d.ts","sourceRoot":"","sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAElC;;GAEG;AACH,eAAO,MAAM,4BAA4B,GACvC,gCAAgC,yBAAyB,EACzD,SAAQ,KAAK,GAAG,KAAa,EAC7B,yDAAkC,KACjC,MA4BF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,GAC/B,qBAAqB,yBAAyB,EAC9C,yDAAkC,EAClC,UAAS,CAAC,KAAK,GAAG,KAAK,CAAC,EAAmB,KAC1C,OAAO,CAAC,yBAAyB,CA+BnC,CAAC"}