@intlayer/chokidar 6.1.6 → 7.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 (464) hide show
  1. package/dist/{cjs → assets}/getContentDeclarationFileTemplate/cjsTemplate.txt +3 -2
  2. package/dist/{cjs → assets}/getContentDeclarationFileTemplate/esmTemplate.txt +2 -1
  3. package/dist/{cjs → assets}/getContentDeclarationFileTemplate/jsonTemplate.txt +2 -1
  4. package/dist/{cjs → assets}/getContentDeclarationFileTemplate/tsTemplate.txt +2 -1
  5. package/dist/cjs/_virtual/_utils_asset.cjs +104 -0
  6. package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
  7. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +42 -80
  8. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
  9. package/dist/cjs/buildIntlayerDictionary/index.cjs +5 -25
  10. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +21 -42
  11. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -1
  12. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +79 -116
  13. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
  14. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +62 -86
  15. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -1
  16. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +48 -69
  17. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -1
  18. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +42 -52
  19. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -1
  20. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +60 -82
  21. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -1
  22. package/dist/cjs/cleanOutputDir.cjs +20 -60
  23. package/dist/cjs/cleanOutputDir.cjs.map +1 -1
  24. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +64 -103
  25. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
  26. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +41 -73
  27. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
  28. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +19 -49
  29. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -1
  30. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +20 -50
  31. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -1
  32. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +20 -50
  33. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -1
  34. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +19 -49
  35. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -1
  36. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +19 -49
  37. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -1
  38. package/dist/cjs/createDictionaryEntryPoint/index.cjs +15 -35
  39. package/dist/cjs/createType/createModuleAugmentation.cjs +56 -108
  40. package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -1
  41. package/dist/cjs/createType/createType.cjs +29 -58
  42. package/dist/cjs/createType/createType.cjs.map +1 -1
  43. package/dist/cjs/createType/index.cjs +7 -25
  44. package/dist/cjs/fetchDistantDictionaries.cjs +49 -77
  45. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  46. package/dist/cjs/filterInvalidDictionaries.cjs +26 -59
  47. package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
  48. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +32 -68
  49. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -1
  50. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +32 -51
  51. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -1
  52. package/dist/cjs/handleContentDeclarationFileChange.cjs +35 -56
  53. package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -1
  54. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +36 -0
  55. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -0
  56. package/dist/cjs/index.cjs +103 -156
  57. package/dist/cjs/listDictionariesPath.cjs +27 -59
  58. package/dist/cjs/listDictionariesPath.cjs.map +1 -1
  59. package/dist/cjs/listGitFiles.cjs +93 -162
  60. package/dist/cjs/listGitFiles.cjs.map +1 -1
  61. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +70 -0
  62. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -0
  63. package/dist/cjs/loadDictionaries/index.cjs +11 -29
  64. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +68 -90
  65. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  66. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +111 -166
  67. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  68. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +27 -53
  69. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
  70. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +60 -102
  71. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
  72. package/dist/cjs/loadDictionaries/log.cjs +107 -182
  73. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  74. package/dist/cjs/prepareIntlayer.cjs +73 -130
  75. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  76. package/dist/cjs/reduceDictionaryContent/applyMask.cjs +27 -61
  77. package/dist/cjs/reduceDictionaryContent/applyMask.cjs.map +1 -1
  78. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +10 -32
  79. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
  80. package/dist/cjs/utils/chunkJSON.cjs +329 -0
  81. package/dist/cjs/utils/chunkJSON.cjs.map +1 -0
  82. package/dist/cjs/utils/extractErrorMessage.cjs +92 -135
  83. package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -1
  84. package/dist/cjs/utils/formatter.cjs +19 -49
  85. package/dist/cjs/utils/formatter.cjs.map +1 -1
  86. package/dist/cjs/utils/getChunk.cjs +34 -0
  87. package/dist/cjs/utils/getChunk.cjs.map +1 -0
  88. package/dist/cjs/utils/getFileHash.cjs +9 -40
  89. package/dist/cjs/utils/getFileHash.cjs.map +1 -1
  90. package/dist/cjs/utils/getFormatFromExtension.cjs +23 -54
  91. package/dist/cjs/utils/getFormatFromExtension.cjs.map +1 -1
  92. package/dist/cjs/utils/kebabCaseToCamelCase.cjs +11 -36
  93. package/dist/cjs/utils/kebabCaseToCamelCase.cjs.map +1 -1
  94. package/dist/cjs/utils/pLimit.cjs +128 -0
  95. package/dist/cjs/utils/pLimit.cjs.map +1 -0
  96. package/dist/cjs/utils/parallelize.cjs +10 -169
  97. package/dist/cjs/utils/parallelize.cjs.map +1 -1
  98. package/dist/cjs/utils/parallelizeGlobal.cjs +29 -0
  99. package/dist/cjs/utils/parallelizeGlobal.cjs.map +1 -0
  100. package/dist/cjs/utils/reduceObjectFormat.cjs +31 -0
  101. package/dist/cjs/utils/reduceObjectFormat.cjs.map +1 -0
  102. package/dist/cjs/utils/resolveObjectPromises.cjs +18 -48
  103. package/dist/cjs/utils/resolveObjectPromises.cjs.map +1 -1
  104. package/dist/cjs/utils/runOnce.cjs +80 -57
  105. package/dist/cjs/utils/runOnce.cjs.map +1 -1
  106. package/dist/cjs/utils/runParallel.cjs +163 -74
  107. package/dist/cjs/utils/runParallel.cjs.map +1 -1
  108. package/dist/cjs/utils/sortAlphabetically.cjs +5 -27
  109. package/dist/cjs/utils/sortAlphabetically.cjs.map +1 -1
  110. package/dist/cjs/utils/splitTextByLine.cjs +11 -0
  111. package/dist/cjs/utils/splitTextByLine.cjs.map +1 -0
  112. package/dist/cjs/utils/verifyIdenticObjectFormat copy.cjs +54 -0
  113. package/dist/cjs/utils/verifyIdenticObjectFormat copy.cjs.map +1 -0
  114. package/dist/cjs/utils/verifyIdenticObjectFormat.cjs +60 -0
  115. package/dist/cjs/utils/verifyIdenticObjectFormat.cjs.map +1 -0
  116. package/dist/cjs/watcher.cjs +61 -83
  117. package/dist/cjs/watcher.cjs.map +1 -1
  118. package/dist/cjs/writeConfiguration/index.cjs +15 -35
  119. package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
  120. package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs +25 -51
  121. package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs.map +1 -1
  122. package/dist/cjs/writeContentDeclaration/dictionaryStatus.cjs +0 -17
  123. package/dist/cjs/writeContentDeclaration/index.cjs +9 -33
  124. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +77 -0
  125. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -0
  126. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +1731 -755
  127. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
  128. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +113 -112
  129. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  130. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +56 -66
  131. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
  132. package/dist/cjs/writeFileIfChanged.cjs +10 -43
  133. package/dist/cjs/writeFileIfChanged.cjs.map +1 -1
  134. package/dist/cjs/writeJsonIfChanged.cjs +14 -31
  135. package/dist/cjs/writeJsonIfChanged.cjs.map +1 -1
  136. package/dist/esm/_virtual/_utils_asset.mjs +100 -0
  137. package/dist/esm/_virtual/rolldown_runtime.mjs +8 -0
  138. package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs +35 -54
  139. package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs.map +1 -1
  140. package/dist/esm/buildIntlayerDictionary/index.mjs +4 -3
  141. package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs +18 -17
  142. package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs.map +1 -1
  143. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +69 -91
  144. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs.map +1 -1
  145. package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs +53 -61
  146. package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs.map +1 -1
  147. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +40 -42
  148. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs.map +1 -1
  149. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +35 -25
  150. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs.map +1 -1
  151. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +53 -56
  152. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs.map +1 -1
  153. package/dist/esm/cleanOutputDir.mjs +17 -36
  154. package/dist/esm/cleanOutputDir.mjs.map +1 -1
  155. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +51 -70
  156. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs.map +1 -1
  157. package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs +36 -47
  158. package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs.map +1 -1
  159. package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs +14 -14
  160. package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs.map +1 -1
  161. package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs +15 -15
  162. package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs.map +1 -1
  163. package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs +15 -15
  164. package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs.map +1 -1
  165. package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs +14 -14
  166. package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs.map +1 -1
  167. package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs +14 -14
  168. package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs.map +1 -1
  169. package/dist/esm/createDictionaryEntryPoint/index.mjs +9 -8
  170. package/dist/esm/createType/createModuleAugmentation.mjs +48 -71
  171. package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -1
  172. package/dist/esm/createType/createType.mjs +24 -35
  173. package/dist/esm/createType/createType.mjs.map +1 -1
  174. package/dist/esm/createType/index.mjs +4 -3
  175. package/dist/esm/fetchDistantDictionaries.mjs +45 -52
  176. package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
  177. package/dist/esm/filterInvalidDictionaries.mjs +22 -37
  178. package/dist/esm/filterInvalidDictionaries.mjs.map +1 -1
  179. package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs +31 -42
  180. package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs.map +1 -1
  181. package/dist/esm/handleAdditionalContentDeclarationFile.mjs +27 -24
  182. package/dist/esm/handleAdditionalContentDeclarationFile.mjs.map +1 -1
  183. package/dist/esm/handleContentDeclarationFileChange.mjs +30 -29
  184. package/dist/esm/handleContentDeclarationFileChange.mjs.map +1 -1
  185. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +34 -0
  186. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs.map +1 -0
  187. package/dist/esm/index.mjs +39 -99
  188. package/dist/esm/listDictionariesPath.mjs +24 -24
  189. package/dist/esm/listDictionariesPath.mjs.map +1 -1
  190. package/dist/esm/listGitFiles.mjs +83 -124
  191. package/dist/esm/listGitFiles.mjs.map +1 -1
  192. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +66 -0
  193. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -0
  194. package/dist/esm/loadDictionaries/index.mjs +6 -5
  195. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +61 -70
  196. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
  197. package/dist/esm/loadDictionaries/loadDictionaries.mjs +105 -146
  198. package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
  199. package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs +23 -31
  200. package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs.map +1 -1
  201. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +52 -74
  202. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
  203. package/dist/esm/loadDictionaries/log.mjs +105 -165
  204. package/dist/esm/loadDictionaries/log.mjs.map +1 -1
  205. package/dist/esm/prepareIntlayer.mjs +64 -97
  206. package/dist/esm/prepareIntlayer.mjs.map +1 -1
  207. package/dist/esm/reduceDictionaryContent/applyMask.mjs +26 -37
  208. package/dist/esm/reduceDictionaryContent/applyMask.mjs.map +1 -1
  209. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs +7 -7
  210. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -1
  211. package/dist/esm/utils/chunkJSON.mjs +327 -0
  212. package/dist/esm/utils/chunkJSON.mjs.map +1 -0
  213. package/dist/esm/utils/extractErrorMessage.mjs +91 -111
  214. package/dist/esm/utils/extractErrorMessage.mjs.map +1 -1
  215. package/dist/esm/utils/formatter.mjs +10 -12
  216. package/dist/esm/utils/formatter.mjs.map +1 -1
  217. package/dist/esm/utils/getChunk.mjs +34 -0
  218. package/dist/esm/utils/getChunk.mjs.map +1 -0
  219. package/dist/esm/utils/getFileHash.mjs +6 -5
  220. package/dist/esm/utils/getFileHash.mjs.map +1 -1
  221. package/dist/esm/utils/getFormatFromExtension.mjs +21 -29
  222. package/dist/esm/utils/getFormatFromExtension.mjs.map +1 -1
  223. package/dist/esm/utils/kebabCaseToCamelCase.mjs +10 -12
  224. package/dist/esm/utils/kebabCaseToCamelCase.mjs.map +1 -1
  225. package/dist/esm/utils/pLimit.mjs +126 -0
  226. package/dist/esm/utils/pLimit.mjs.map +1 -0
  227. package/dist/esm/utils/parallelize.mjs +10 -144
  228. package/dist/esm/utils/parallelize.mjs.map +1 -1
  229. package/dist/esm/utils/parallelizeGlobal.mjs +27 -0
  230. package/dist/esm/utils/parallelizeGlobal.mjs.map +1 -0
  231. package/dist/esm/utils/reduceObjectFormat.mjs +30 -0
  232. package/dist/esm/utils/reduceObjectFormat.mjs.map +1 -0
  233. package/dist/esm/utils/resolveObjectPromises.mjs +17 -24
  234. package/dist/esm/utils/resolveObjectPromises.mjs.map +1 -1
  235. package/dist/esm/utils/runOnce.mjs +76 -33
  236. package/dist/esm/utils/runOnce.mjs.map +1 -1
  237. package/dist/esm/utils/runParallel.mjs +160 -40
  238. package/dist/esm/utils/runParallel.mjs.map +1 -1
  239. package/dist/esm/utils/sortAlphabetically.mjs +4 -3
  240. package/dist/esm/utils/sortAlphabetically.mjs.map +1 -1
  241. package/dist/esm/utils/splitTextByLine.mjs +10 -0
  242. package/dist/esm/utils/splitTextByLine.mjs.map +1 -0
  243. package/dist/esm/utils/verifyIdenticObjectFormat copy.mjs +53 -0
  244. package/dist/esm/utils/verifyIdenticObjectFormat copy.mjs.map +1 -0
  245. package/dist/esm/utils/verifyIdenticObjectFormat.mjs +59 -0
  246. package/dist/esm/utils/verifyIdenticObjectFormat.mjs.map +1 -0
  247. package/dist/esm/watcher.mjs +53 -58
  248. package/dist/esm/watcher.mjs.map +1 -1
  249. package/dist/esm/writeConfiguration/index.mjs +11 -10
  250. package/dist/esm/writeConfiguration/index.mjs.map +1 -1
  251. package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs +24 -27
  252. package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs.map +1 -1
  253. package/dist/esm/writeContentDeclaration/dictionaryStatus.mjs +0 -1
  254. package/dist/esm/writeContentDeclaration/index.mjs +6 -7
  255. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +71 -0
  256. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -0
  257. package/dist/esm/writeContentDeclaration/transformJSFile.mjs +1726 -735
  258. package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -1
  259. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +105 -76
  260. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
  261. package/dist/esm/writeContentDeclaration/writeJSFile.mjs +48 -46
  262. package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
  263. package/dist/esm/writeFileIfChanged.mjs +7 -18
  264. package/dist/esm/writeFileIfChanged.mjs.map +1 -1
  265. package/dist/esm/writeJsonIfChanged.mjs +14 -7
  266. package/dist/esm/writeJsonIfChanged.mjs.map +1 -1
  267. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +14 -7
  268. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -1
  269. package/dist/types/buildIntlayerDictionary/index.d.ts +3 -3
  270. package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts +7 -2
  271. package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts.map +1 -1
  272. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +14 -10
  273. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -1
  274. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +8 -3
  275. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -1
  276. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +12 -7
  277. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -1
  278. package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts +8 -2
  279. package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts.map +1 -1
  280. package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts +10 -6
  281. package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts.map +1 -1
  282. package/dist/types/cleanOutputDir.d.ts +6 -1
  283. package/dist/types/cleanOutputDir.d.ts.map +1 -1
  284. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +6 -1
  285. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +1 -1
  286. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +6 -1
  287. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -1
  288. package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts +7 -1
  289. package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts.map +1 -1
  290. package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts +7 -1
  291. package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts.map +1 -1
  292. package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts +7 -1
  293. package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts.map +1 -1
  294. package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts +7 -1
  295. package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts.map +1 -1
  296. package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts +7 -1
  297. package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts.map +1 -1
  298. package/dist/types/createDictionaryEntryPoint/index.d.ts +8 -8
  299. package/dist/types/createType/createModuleAugmentation.d.ts +8 -5
  300. package/dist/types/createType/createModuleAugmentation.d.ts.map +1 -1
  301. package/dist/types/createType/createType.d.ts +7 -4
  302. package/dist/types/createType/createType.d.ts.map +1 -1
  303. package/dist/types/createType/index.d.ts +3 -3
  304. package/dist/types/fetchDistantDictionaries.d.ts +10 -7
  305. package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
  306. package/dist/types/filterInvalidDictionaries.d.ts +7 -4
  307. package/dist/types/filterInvalidDictionaries.d.ts.map +1 -1
  308. package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts +6 -2
  309. package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts.map +1 -1
  310. package/dist/types/handleAdditionalContentDeclarationFile.d.ts +6 -2
  311. package/dist/types/handleAdditionalContentDeclarationFile.d.ts.map +1 -1
  312. package/dist/types/handleContentDeclarationFileChange.d.ts +6 -2
  313. package/dist/types/handleContentDeclarationFileChange.d.ts.map +1 -1
  314. package/dist/types/handleUnlinkedContentDeclarationFile.d.ts +7 -0
  315. package/dist/types/handleUnlinkedContentDeclarationFile.d.ts.map +1 -0
  316. package/dist/types/index.d.ts +49 -33
  317. package/dist/types/listDictionariesPath.d.ts +7 -2
  318. package/dist/types/listDictionariesPath.d.ts.map +1 -1
  319. package/dist/types/listGitFiles.d.ts +24 -12
  320. package/dist/types/listGitFiles.d.ts.map +1 -1
  321. package/dist/types/loadDictionaries/getIntlayerBundle.d.ts +11 -0
  322. package/dist/types/loadDictionaries/getIntlayerBundle.d.ts.map +1 -0
  323. package/dist/types/loadDictionaries/index.d.ts +5 -5
  324. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +8 -5
  325. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -1
  326. package/dist/types/loadDictionaries/loadDictionaries.d.ts +18 -14
  327. package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -1
  328. package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts +6 -3
  329. package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts.map +1 -1
  330. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +13 -8
  331. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -1
  332. package/dist/types/loadDictionaries/log.d.ts +28 -24
  333. package/dist/types/loadDictionaries/log.d.ts.map +1 -1
  334. package/dist/types/prepareIntlayer.d.ts +12 -2
  335. package/dist/types/prepareIntlayer.d.ts.map +1 -1
  336. package/dist/types/reduceDictionaryContent/applyMask.d.ts +6 -2
  337. package/dist/types/reduceDictionaryContent/applyMask.d.ts.map +1 -1
  338. package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts +6 -2
  339. package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts.map +1 -1
  340. package/dist/types/utils/chunkJSON.d.ts +56 -0
  341. package/dist/types/utils/chunkJSON.d.ts.map +1 -0
  342. package/dist/types/utils/extractErrorMessage.d.ts +4 -1
  343. package/dist/types/utils/extractErrorMessage.d.ts.map +1 -1
  344. package/dist/types/utils/formatter.d.ts +8 -3
  345. package/dist/types/utils/formatter.d.ts.map +1 -1
  346. package/dist/types/utils/getChunk.d.ts +11 -0
  347. package/dist/types/utils/getChunk.d.ts.map +1 -0
  348. package/dist/types/utils/getFileHash.d.ts +4 -1
  349. package/dist/types/utils/getFileHash.d.ts.map +1 -1
  350. package/dist/types/utils/getFormatFromExtension.d.ts +7 -4
  351. package/dist/types/utils/getFormatFromExtension.d.ts.map +1 -1
  352. package/dist/types/utils/kebabCaseToCamelCase.d.ts +4 -1
  353. package/dist/types/utils/kebabCaseToCamelCase.d.ts.map +1 -1
  354. package/dist/types/utils/pLimit.d.ts +16 -0
  355. package/dist/types/utils/pLimit.d.ts.map +1 -0
  356. package/dist/types/utils/parallelize.d.ts +4 -13
  357. package/dist/types/utils/parallelize.d.ts.map +1 -1
  358. package/dist/types/utils/parallelizeGlobal.d.ts +22 -0
  359. package/dist/types/utils/parallelizeGlobal.d.ts.map +1 -0
  360. package/dist/types/utils/reduceObjectFormat.d.ts +17 -0
  361. package/dist/types/utils/reduceObjectFormat.d.ts.map +1 -0
  362. package/dist/types/utils/resolveObjectPromises.d.ts +4 -1
  363. package/dist/types/utils/resolveObjectPromises.d.ts.map +1 -1
  364. package/dist/types/utils/runOnce.d.ts +23 -2
  365. package/dist/types/utils/runOnce.d.ts.map +1 -1
  366. package/dist/types/utils/runParallel.d.ts +9 -6
  367. package/dist/types/utils/runParallel.d.ts.map +1 -1
  368. package/dist/types/utils/sortAlphabetically.d.ts +4 -1
  369. package/dist/types/utils/sortAlphabetically.d.ts.map +1 -1
  370. package/dist/types/utils/splitTextByLine.d.ts +5 -0
  371. package/dist/types/utils/splitTextByLine.d.ts.map +1 -0
  372. package/dist/types/utils/verifyIdenticObjectFormat copy.d.ts +23 -0
  373. package/dist/types/utils/verifyIdenticObjectFormat copy.d.ts.map +1 -0
  374. package/dist/types/utils/verifyIdenticObjectFormat.d.ts +23 -0
  375. package/dist/types/utils/verifyIdenticObjectFormat.d.ts.map +1 -0
  376. package/dist/types/watcher.d.ts +13 -9
  377. package/dist/types/watcher.d.ts.map +1 -1
  378. package/dist/types/writeConfiguration/index.d.ts +6 -2
  379. package/dist/types/writeConfiguration/index.d.ts.map +1 -1
  380. package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts +4 -1
  381. package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts.map +1 -1
  382. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts +4 -1
  383. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts.map +1 -1
  384. package/dist/types/writeContentDeclaration/index.d.ts +6 -7
  385. package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts +7 -0
  386. package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts.map +1 -0
  387. package/dist/types/writeContentDeclaration/transformJSFile.d.ts +33 -6
  388. package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +1 -1
  389. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +14 -6
  390. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
  391. package/dist/types/writeContentDeclaration/writeJSFile.d.ts +7 -3
  392. package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +1 -1
  393. package/dist/types/writeFileIfChanged.d.ts +7 -2
  394. package/dist/types/writeFileIfChanged.d.ts.map +1 -1
  395. package/dist/types/writeJsonIfChanged.d.ts +7 -2
  396. package/dist/types/writeJsonIfChanged.d.ts.map +1 -1
  397. package/package.json +48 -54
  398. package/LICENSE +0 -202
  399. package/dist/cjs/buildIntlayerDictionary/index.cjs.map +0 -1
  400. package/dist/cjs/createDictionaryEntryPoint/index.cjs.map +0 -1
  401. package/dist/cjs/createType/index.cjs.map +0 -1
  402. package/dist/cjs/handleUnlikedContentDeclarationFile.cjs +0 -57
  403. package/dist/cjs/handleUnlikedContentDeclarationFile.cjs.map +0 -1
  404. package/dist/cjs/index.cjs.map +0 -1
  405. package/dist/cjs/loadDictionaries/index.cjs.map +0 -1
  406. package/dist/cjs/mergeDictionaries.cjs +0 -143
  407. package/dist/cjs/mergeDictionaries.cjs.map +0 -1
  408. package/dist/cjs/orderDictionaries.cjs +0 -71
  409. package/dist/cjs/orderDictionaries.cjs.map +0 -1
  410. package/dist/cjs/prepareContentDeclaration.cjs +0 -93
  411. package/dist/cjs/prepareContentDeclaration.cjs.map +0 -1
  412. package/dist/cjs/processPerLocaleDictionary.cjs +0 -49
  413. package/dist/cjs/processPerLocaleDictionary.cjs.map +0 -1
  414. package/dist/cjs/utils/getExtention.cjs +0 -37
  415. package/dist/cjs/utils/getExtention.cjs.map +0 -1
  416. package/dist/cjs/writeContentDeclaration/dictionaryStatus.cjs.map +0 -1
  417. package/dist/cjs/writeContentDeclaration/formatCode.cjs +0 -78
  418. package/dist/cjs/writeContentDeclaration/formatCode.cjs.map +0 -1
  419. package/dist/cjs/writeContentDeclaration/index.cjs.map +0 -1
  420. package/dist/esm/buildIntlayerDictionary/index.mjs.map +0 -1
  421. package/dist/esm/createDictionaryEntryPoint/index.mjs.map +0 -1
  422. package/dist/esm/createType/index.mjs.map +0 -1
  423. package/dist/esm/getContentDeclarationFileTemplate/cjsTemplate.txt +0 -9
  424. package/dist/esm/getContentDeclarationFileTemplate/esmTemplate.txt +0 -9
  425. package/dist/esm/getContentDeclarationFileTemplate/jsonTemplate.txt +0 -5
  426. package/dist/esm/getContentDeclarationFileTemplate/tsTemplate.txt +0 -8
  427. package/dist/esm/handleUnlikedContentDeclarationFile.mjs +0 -33
  428. package/dist/esm/handleUnlikedContentDeclarationFile.mjs.map +0 -1
  429. package/dist/esm/index.mjs.map +0 -1
  430. package/dist/esm/loadDictionaries/index.mjs.map +0 -1
  431. package/dist/esm/mergeDictionaries.mjs +0 -109
  432. package/dist/esm/mergeDictionaries.mjs.map +0 -1
  433. package/dist/esm/orderDictionaries.mjs +0 -37
  434. package/dist/esm/orderDictionaries.mjs.map +0 -1
  435. package/dist/esm/prepareContentDeclaration.mjs +0 -72
  436. package/dist/esm/prepareContentDeclaration.mjs.map +0 -1
  437. package/dist/esm/processPerLocaleDictionary.mjs +0 -25
  438. package/dist/esm/processPerLocaleDictionary.mjs.map +0 -1
  439. package/dist/esm/utils/getExtention.mjs +0 -13
  440. package/dist/esm/utils/getExtention.mjs.map +0 -1
  441. package/dist/esm/writeContentDeclaration/dictionaryStatus.mjs.map +0 -1
  442. package/dist/esm/writeContentDeclaration/formatCode.mjs +0 -44
  443. package/dist/esm/writeContentDeclaration/formatCode.mjs.map +0 -1
  444. package/dist/esm/writeContentDeclaration/index.mjs.map +0 -1
  445. package/dist/types/buildIntlayerDictionary/index.d.ts.map +0 -1
  446. package/dist/types/createDictionaryEntryPoint/index.d.ts.map +0 -1
  447. package/dist/types/createType/index.d.ts.map +0 -1
  448. package/dist/types/handleUnlikedContentDeclarationFile.d.ts +0 -3
  449. package/dist/types/handleUnlikedContentDeclarationFile.d.ts.map +0 -1
  450. package/dist/types/index.d.ts.map +0 -1
  451. package/dist/types/loadDictionaries/index.d.ts.map +0 -1
  452. package/dist/types/mergeDictionaries.d.ts +0 -3
  453. package/dist/types/mergeDictionaries.d.ts.map +0 -1
  454. package/dist/types/orderDictionaries.d.ts +0 -10
  455. package/dist/types/orderDictionaries.d.ts.map +0 -1
  456. package/dist/types/prepareContentDeclaration.d.ts +0 -3
  457. package/dist/types/prepareContentDeclaration.d.ts.map +0 -1
  458. package/dist/types/processPerLocaleDictionary.d.ts +0 -32
  459. package/dist/types/processPerLocaleDictionary.d.ts.map +0 -1
  460. package/dist/types/utils/getExtention.d.ts +0 -3
  461. package/dist/types/utils/getExtention.d.ts.map +0 -1
  462. package/dist/types/writeContentDeclaration/formatCode.d.ts +0 -2
  463. package/dist/types/writeContentDeclaration/formatCode.d.ts.map +0 -1
  464. package/dist/types/writeContentDeclaration/index.d.ts.map +0 -1
@@ -1,82 +1,111 @@
1
- import { getConfiguration } from "@intlayer/config";
1
+ import { getFormatFromExtension } from "../utils/getFormatFromExtension.mjs";
2
+ import { processContentDeclarationContent } from "./processContentDeclarationContent.mjs";
3
+ import { writeJSFile } from "./writeJSFile.mjs";
4
+ import { dirname, extname, join, resolve } from "node:path";
5
+ import { getFilteredLocalesDictionary, getPerLocaleDictionary } from "@intlayer/core";
2
6
  import { getUnmergedDictionaries } from "@intlayer/unmerged-dictionaries-entry";
7
+ import { mkdir, rm, writeFile } from "node:fs/promises";
3
8
  import deepEqual from "deep-equal";
4
- import { mkdir, writeFile } from "fs/promises";
5
- import { dirname, extname, join } from "path";
6
- import { prepareContentDeclaration } from "../prepareContentDeclaration.mjs";
7
- import { writeJSFile } from "./writeJSFile.mjs";
8
- const DEFAULT_NEW_DICTIONARY_PATH = "intlayer-dictionaries";
9
- const formatContentDeclaration = async (dictionary) => {
10
- const preparedContentDeclaration = await prepareContentDeclaration(dictionary);
11
- const { filePath, $schema, ...dictionaryWithoutPath } = preparedContentDeclaration;
12
- const formattedContentDeclaration = {
13
- $schema: "https://intlayer.org/schema.json",
14
- ...dictionaryWithoutPath
15
- };
16
- return formattedContentDeclaration;
17
- };
18
- const writeContentDeclaration = async (dictionary, config = getConfiguration(), newDictionariesPath) => {
19
- const { content } = config;
20
- const { baseDir } = content;
21
- const newDictionaryRelativeLocationPath = newDictionariesPath ?? DEFAULT_NEW_DICTIONARY_PATH;
22
- const newDictionaryLocationPath = join(
23
- baseDir,
24
- newDictionaryRelativeLocationPath
25
- );
26
- const unmergedDictionariesRecord = getUnmergedDictionaries(config);
27
- const unmergedDictionaries = unmergedDictionariesRecord[dictionary.key];
28
- const existingDictionary = unmergedDictionaries.filter(
29
- (el) => el.localId === dictionary.localId
30
- );
31
- const formattedContentDeclaration = await formatContentDeclaration(dictionary);
32
- if (existingDictionary && dictionary.filePath) {
33
- const filePath = join(config.content.baseDir, dictionary.filePath);
34
- const isSameFile = deepEqual(existingDictionary, dictionary);
35
- if (isSameFile) {
36
- return {
37
- status: "up-to-date",
38
- path: filePath
39
- };
40
- }
41
- await writeFileWithDirectories(
42
- filePath,
43
- formattedContentDeclaration,
44
- config
45
- );
46
- return { status: "updated", path: filePath };
47
- }
48
- const contentDeclarationPath = join(
49
- newDictionaryLocationPath,
50
- `${dictionary.key}.content.json`
51
- );
52
- await writeFileWithDirectories(
53
- contentDeclarationPath,
54
- formattedContentDeclaration,
55
- config
56
- );
57
- return {
58
- status: "imported",
59
- path: contentDeclarationPath
60
- };
9
+
10
+ //#region src/writeContentDeclaration/writeContentDeclaration.ts
11
+ const formatContentDeclaration = async (dictionary, configuration, localeList) => {
12
+ /**
13
+ * Clean Markdown, Insertion, File, etc. node metadata
14
+ */
15
+ const processedDictionary = await processContentDeclarationContent(dictionary);
16
+ let content = processedDictionary.content;
17
+ /**
18
+ * Filter locales content
19
+ */
20
+ if (dictionary.locale) content = getPerLocaleDictionary(processedDictionary, dictionary.locale).content;
21
+ else if (localeList) content = getFilteredLocalesDictionary(processedDictionary, localeList).content;
22
+ let pluginFormatResult = {
23
+ ...dictionary,
24
+ content
25
+ };
26
+ /**
27
+ * Format the dictionary with the plugins
28
+ */
29
+ for await (const plugin of configuration.plugins ?? []) if (plugin.formatOutput) {
30
+ const formattedResult = await plugin.formatOutput?.({
31
+ dictionary: pluginFormatResult,
32
+ configuration
33
+ });
34
+ if (formattedResult) pluginFormatResult = formattedResult;
35
+ }
36
+ if (!(pluginFormatResult.content && pluginFormatResult.key)) return pluginFormatResult;
37
+ let result = {
38
+ key: dictionary.key,
39
+ content,
40
+ locale: dictionary.locale,
41
+ fill: dictionary.fill,
42
+ filled: dictionary.filled,
43
+ tags: dictionary.tags,
44
+ title: dictionary.title,
45
+ description: dictionary.description,
46
+ priority: dictionary.priority
47
+ };
48
+ if (getFormatFromExtension(dictionary.filePath ? extname(dictionary.filePath) : ".json") === "json" && pluginFormatResult.content && pluginFormatResult.key) result = {
49
+ $schema: "https://intlayer.org/schema.json",
50
+ ...result
51
+ };
52
+ return result;
61
53
  };
62
- const writeFileWithDirectories = async (filePath, data, configuration) => {
63
- const dir = dirname(filePath);
64
- await mkdir(dir, { recursive: true });
65
- const extension = extname(filePath);
66
- const acceptedExtensions = configuration.content.fileExtensions.map(
67
- (extension2) => extname(extension2)
68
- );
69
- if (!acceptedExtensions.includes(extension)) {
70
- throw new Error(`Invalid file extension: ${extension}, file: ${filePath}`);
71
- }
72
- if (extension === ".json") {
73
- const jsonDictionary = JSON.stringify(data, null, 2);
74
- await writeFile(filePath, jsonDictionary);
75
- return;
76
- }
77
- await writeJSFile(filePath, data, configuration);
54
+ const defaultOptions = { newDictionariesPath: "intlayer-dictionaries" };
55
+ const writeContentDeclaration = async (dictionary, configuration, options) => {
56
+ const { content } = configuration;
57
+ const { baseDir } = content;
58
+ const { newDictionariesPath, localeList } = {
59
+ ...defaultOptions,
60
+ ...options
61
+ };
62
+ const newDictionaryLocationPath = join(baseDir, newDictionariesPath);
63
+ const existingDictionary = getUnmergedDictionaries(configuration)[dictionary.key]?.find((el) => el.localId === dictionary.localId);
64
+ const formattedContentDeclaration = await formatContentDeclaration(dictionary, configuration, localeList);
65
+ if (existingDictionary?.filePath) {
66
+ const isSameContent = deepEqual(existingDictionary.content, dictionary.content);
67
+ const filePath = resolve(configuration.content.baseDir, existingDictionary.filePath);
68
+ if (isSameContent) return {
69
+ status: "up-to-date",
70
+ path: filePath
71
+ };
72
+ await writeFileWithDirectories(filePath, formattedContentDeclaration, configuration);
73
+ return {
74
+ status: "updated",
75
+ path: filePath
76
+ };
77
+ }
78
+ if (dictionary.filePath) {
79
+ const filePath = resolve(configuration.content.baseDir, dictionary.filePath);
80
+ await writeFileWithDirectories(filePath, formattedContentDeclaration, configuration);
81
+ return {
82
+ status: "created",
83
+ path: filePath
84
+ };
85
+ }
86
+ const contentDeclarationPath = join(newDictionaryLocationPath, `${dictionary.key}.content.json`);
87
+ await writeFileWithDirectories(contentDeclarationPath, formattedContentDeclaration, configuration);
88
+ return {
89
+ status: "imported",
90
+ path: contentDeclarationPath
91
+ };
78
92
  };
79
- export {
80
- writeContentDeclaration
93
+ const writeFileWithDirectories = async (absoluteFilePath, dictionary, configuration) => {
94
+ await mkdir(dirname(absoluteFilePath), { recursive: true });
95
+ const extension = extname(absoluteFilePath);
96
+ if (!configuration.content.fileExtensions.map((extension$1) => extname(extension$1)).includes(extension)) throw new Error(`Invalid file extension: ${extension}, file: ${absoluteFilePath}`);
97
+ if (extension === ".json") {
98
+ await writeFile(absoluteFilePath, `${JSON.stringify(dictionary, null, 2)}\n`);
99
+ return;
100
+ }
101
+ await writeJSFile(absoluteFilePath, dictionary, configuration);
102
+ try {
103
+ await rm(configuration.content.cacheDir, { recursive: true });
104
+ } catch (error) {
105
+ if (error && typeof error === "object" && "code" in error && error.code !== "ENOENT") throw error;
106
+ }
81
107
  };
108
+
109
+ //#endregion
110
+ export { writeContentDeclaration };
82
111
  //# sourceMappingURL=writeContentDeclaration.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport deepEqual from 'deep-equal';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { dirname, extname, join } 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 = getConfiguration(),\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 = join(\n baseDir,\n newDictionaryRelativeLocationPath\n );\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n const unmergedDictionaries = unmergedDictionariesRecord[\n dictionary.key\n ] as Dictionary[];\n\n const existingDictionary = unmergedDictionaries.filter(\n (el) => el.localId === dictionary.localId\n );\n\n const formattedContentDeclaration =\n await formatContentDeclaration(dictionary);\n\n if (existingDictionary && dictionary.filePath) {\n const filePath = join(config.content.baseDir, dictionary.filePath);\n\n // Compare existing dictionary with distant dictionary\n const isSameFile = deepEqual(existingDictionary, dictionary);\n\n // Up to date, nothing to do\n if (isSameFile) {\n return {\n status: 'up-to-date',\n path: filePath,\n };\n }\n\n await writeFileWithDirectories(\n filePath,\n formattedContentDeclaration,\n config\n );\n\n return { status: 'updated', path: filePath };\n }\n\n // No existing dictionary, write to new location\n const contentDeclarationPath = join(\n newDictionaryLocationPath,\n `${dictionary.key}.content.json`\n );\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration,\n config\n );\n\n return {\n status: 'imported',\n path: contentDeclarationPath,\n };\n};\n\nconst writeFileWithDirectories = async (\n filePath: string,\n data: string | Buffer,\n configuration: IntlayerConfig\n): Promise<void> => {\n // Extract the directory from the file path\n const dir = dirname(filePath);\n\n // Create the directory recursively\n await mkdir(dir, { recursive: true });\n\n const extension = extname(filePath);\n const acceptedExtensions = configuration.content.fileExtensions.map(\n (extension) => extname(extension)\n );\n\n if (!acceptedExtensions.includes(extension)) {\n throw new Error(`Invalid file extension: ${extension}, file: ${filePath}`);\n }\n\n if (extension === '.json') {\n const jsonDictionary = JSON.stringify(data, null, 2);\n\n // Write the file\n await writeFile(filePath, jsonDictionary);\n\n return;\n }\n\n await writeJSFile(filePath, data as unknown as Dictionary, configuration);\n};\n"],"mappings":"AAAA,SAAS,wBAAwB;AAGjC,SAAS,+BAA+B;AACxC,OAAO,eAAe;AACtB,SAAS,OAAO,iBAAiB;AACjC,SAAS,SAAS,SAAS,YAAY;AACvC,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,iBAAiB,GAC1C,wBACwD;AACxD,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,EAAE,QAAQ,IAAI;AAEpB,QAAM,oCACJ,uBAAuB;AACzB,QAAM,4BAA4B;AAAA,IAChC;AAAA,IACA;AAAA,EACF;AAEA,QAAM,6BAA6B,wBAAwB,MAAM;AACjE,QAAM,uBAAuB,2BAC3B,WAAW,GACb;AAEA,QAAM,qBAAqB,qBAAqB;AAAA,IAC9C,CAAC,OAAO,GAAG,YAAY,WAAW;AAAA,EACpC;AAEA,QAAM,8BACJ,MAAM,yBAAyB,UAAU;AAE3C,MAAI,sBAAsB,WAAW,UAAU;AAC7C,UAAM,WAAW,KAAK,OAAO,QAAQ,SAAS,WAAW,QAAQ;AAGjE,UAAM,aAAa,UAAU,oBAAoB,UAAU;AAG3D,QAAI,YAAY;AACd,aAAO;AAAA,QACL,QAAQ;AAAA,QACR,MAAM;AAAA,MACR;AAAA,IACF;AAEA,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,WAAO,EAAE,QAAQ,WAAW,MAAM,SAAS;AAAA,EAC7C;AAGA,QAAM,yBAAyB;AAAA,IAC7B;AAAA,IACA,GAAG,WAAW,GAAG;AAAA,EACnB;AAEA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AACF;AAEA,MAAM,2BAA2B,OAC/B,UACA,MACA,kBACkB;AAElB,QAAM,MAAM,QAAQ,QAAQ;AAG5B,QAAM,MAAM,KAAK,EAAE,WAAW,KAAK,CAAC;AAEpC,QAAM,YAAY,QAAQ,QAAQ;AAClC,QAAM,qBAAqB,cAAc,QAAQ,eAAe;AAAA,IAC9D,CAACA,eAAc,QAAQA,UAAS;AAAA,EAClC;AAEA,MAAI,CAAC,mBAAmB,SAAS,SAAS,GAAG;AAC3C,UAAM,IAAI,MAAM,2BAA2B,SAAS,WAAW,QAAQ,EAAE;AAAA,EAC3E;AAEA,MAAI,cAAc,SAAS;AACzB,UAAM,iBAAiB,KAAK,UAAU,MAAM,MAAM,CAAC;AAGnD,UAAM,UAAU,UAAU,cAAc;AAExC;AAAA,EACF;AAEA,QAAM,YAAY,UAAU,MAA+B,aAAa;AAC1E;","names":["extension"]}
1
+ {"version":3,"file":"writeContentDeclaration.mjs","names":["pluginFormatResult: any","result: Dictionary","extension"],"sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"sourcesContent":["import { mkdir, rm, writeFile } from 'node:fs/promises';\nimport { dirname, extname, join, resolve } from 'node:path';\nimport {\n getFilteredLocalesDictionary,\n getPerLocaleDictionary,\n} from '@intlayer/core';\nimport type {\n Dictionary,\n IntlayerConfig,\n Locale,\n LocalesValues,\n} from '@intlayer/types';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport deepEqual from 'deep-equal';\nimport {\n type Extension,\n getFormatFromExtension,\n} from '../utils/getFormatFromExtension';\nimport type { DictionaryStatus } from './dictionaryStatus';\nimport { processContentDeclarationContent } from './processContentDeclarationContent';\nimport { writeJSFile } from './writeJSFile';\n\nconst formatContentDeclaration = async (\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n localeList?: LocalesValues[]\n) => {\n /**\n * Clean Markdown, Insertion, File, etc. node metadata\n */\n const processedDictionary =\n await processContentDeclarationContent(dictionary);\n\n let content = processedDictionary.content;\n\n /**\n * Filter locales content\n */\n\n if (dictionary.locale) {\n content = getPerLocaleDictionary(\n processedDictionary,\n dictionary.locale\n ).content;\n } else if (localeList) {\n content = getFilteredLocalesDictionary(\n processedDictionary,\n localeList\n ).content;\n }\n\n let pluginFormatResult: any = {\n ...dictionary,\n content,\n } satisfies Dictionary;\n\n /**\n * Format the dictionary with the plugins\n */\n\n for await (const plugin of configuration.plugins ?? []) {\n if (plugin.formatOutput) {\n const formattedResult = await plugin.formatOutput?.({\n dictionary: pluginFormatResult,\n configuration,\n });\n\n if (formattedResult) {\n pluginFormatResult = formattedResult;\n }\n }\n }\n\n const isDictionaryFormat =\n pluginFormatResult.content && pluginFormatResult.key;\n\n if (!isDictionaryFormat) return pluginFormatResult;\n\n let result: Dictionary = {\n key: dictionary.key,\n content,\n locale: dictionary.locale,\n fill: dictionary.fill,\n filled: dictionary.filled,\n tags: dictionary.tags,\n title: dictionary.title,\n description: dictionary.description,\n priority: dictionary.priority,\n };\n\n /**\n * Add $schema to the dictionary\n */\n const extension = (\n dictionary.filePath ? extname(dictionary.filePath) : '.json'\n ) as Extension;\n const format = getFormatFromExtension(extension);\n\n if (\n format === 'json' &&\n pluginFormatResult.content &&\n pluginFormatResult.key\n ) {\n result = {\n $schema: 'https://intlayer.org/schema.json',\n ...result,\n };\n }\n\n return result;\n};\n\ntype WriteContentDeclarationOptions = {\n newDictionariesPath?: string;\n localeList?: LocalesValues[];\n fallbackLocale?: Locale;\n};\n\nconst defaultOptions = {\n newDictionariesPath: 'intlayer-dictionaries',\n} satisfies WriteContentDeclarationOptions;\n\nexport const writeContentDeclaration = async (\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n options?: WriteContentDeclarationOptions\n): Promise<{ status: DictionaryStatus; path: string }> => {\n const { content } = configuration;\n const { baseDir } = content;\n const { newDictionariesPath, localeList } = {\n ...defaultOptions,\n ...options,\n };\n\n const newDictionaryLocationPath = join(baseDir, newDictionariesPath);\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(configuration);\n const unmergedDictionaries = unmergedDictionariesRecord[\n dictionary.key\n ] as Dictionary[];\n\n const existingDictionary = unmergedDictionaries?.find(\n (el) => el.localId === dictionary.localId\n );\n\n const formattedContentDeclaration = await formatContentDeclaration(\n dictionary,\n configuration,\n localeList\n );\n\n if (existingDictionary?.filePath) {\n // Compare existing dictionary content with new dictionary content\n const isSameContent = deepEqual(\n existingDictionary.content,\n dictionary.content\n );\n\n const filePath = resolve(\n configuration.content.baseDir,\n existingDictionary.filePath\n );\n\n // Up to date, nothing to do\n if (isSameContent) {\n return {\n status: 'up-to-date',\n path: filePath,\n };\n }\n\n await writeFileWithDirectories(\n filePath,\n formattedContentDeclaration,\n configuration\n );\n\n return { status: 'updated', path: filePath };\n }\n\n if (dictionary.filePath) {\n const filePath = resolve(\n configuration.content.baseDir,\n dictionary.filePath\n );\n await writeFileWithDirectories(\n filePath,\n formattedContentDeclaration,\n configuration\n );\n\n return { status: 'created', path: filePath };\n }\n\n // No existing dictionary, write to new location\n const contentDeclarationPath = join(\n newDictionaryLocationPath,\n `${dictionary.key}.content.json`\n );\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration,\n configuration\n );\n\n return {\n status: 'imported',\n path: contentDeclarationPath,\n };\n};\n\nconst writeFileWithDirectories = async (\n absoluteFilePath: string,\n dictionary: Dictionary,\n configuration: IntlayerConfig\n): Promise<void> => {\n // Extract the directory from the file path\n const dir = dirname(absoluteFilePath);\n\n // Create the directory recursively\n await mkdir(dir, { recursive: true });\n\n const extension = extname(absoluteFilePath);\n const acceptedExtensions = configuration.content.fileExtensions.map(\n (extension) => extname(extension)\n );\n\n if (!acceptedExtensions.includes(extension)) {\n throw new Error(\n `Invalid file extension: ${extension}, file: ${absoluteFilePath}`\n );\n }\n\n if (extension === '.json') {\n const jsonDictionary = JSON.stringify(dictionary, null, 2);\n\n // Write the file\n await writeFile(absoluteFilePath, `${jsonDictionary}\\n`); // Add a new line at the end of the file to avoid formatting issues with VSCode\n\n return;\n }\n\n await writeJSFile(absoluteFilePath, dictionary, configuration);\n\n // remove the cache as content has changed\n // Will force a new preparation of the intlayer on next build\n try {\n await rm(configuration.content.cacheDir, { recursive: true });\n } catch (error) {\n if (\n error &&\n typeof error === 'object' &&\n 'code' in error &&\n (error as { code: string }).code !== 'ENOENT'\n ) {\n throw error;\n }\n }\n};\n"],"mappings":";;;;;;;;;;AAsBA,MAAM,2BAA2B,OAC/B,YACA,eACA,eACG;;;;CAIH,MAAM,sBACJ,MAAM,iCAAiC,WAAW;CAEpD,IAAI,UAAU,oBAAoB;;;;AAMlC,KAAI,WAAW,OACb,WAAU,uBACR,qBACA,WAAW,OACZ,CAAC;UACO,WACT,WAAU,6BACR,qBACA,WACD,CAAC;CAGJ,IAAIA,qBAA0B;EAC5B,GAAG;EACH;EACD;;;;AAMD,YAAW,MAAM,UAAU,cAAc,WAAW,EAAE,CACpD,KAAI,OAAO,cAAc;EACvB,MAAM,kBAAkB,MAAM,OAAO,eAAe;GAClD,YAAY;GACZ;GACD,CAAC;AAEF,MAAI,gBACF,sBAAqB;;AAQ3B,KAAI,EAFF,mBAAmB,WAAW,mBAAmB,KAE1B,QAAO;CAEhC,IAAIC,SAAqB;EACvB,KAAK,WAAW;EAChB;EACA,QAAQ,WAAW;EACnB,MAAM,WAAW;EACjB,QAAQ,WAAW;EACnB,MAAM,WAAW;EACjB,OAAO,WAAW;EAClB,aAAa,WAAW;EACxB,UAAU,WAAW;EACtB;AAUD,KAFe,uBAFb,WAAW,WAAW,QAAQ,WAAW,SAAS,GAAG,QAEP,KAGnC,UACX,mBAAmB,WACnB,mBAAmB,IAEnB,UAAS;EACP,SAAS;EACT,GAAG;EACJ;AAGH,QAAO;;AAST,MAAM,iBAAiB,EACrB,qBAAqB,yBACtB;AAED,MAAa,0BAA0B,OACrC,YACA,eACA,YACwD;CACxD,MAAM,EAAE,YAAY;CACpB,MAAM,EAAE,YAAY;CACpB,MAAM,EAAE,qBAAqB,eAAe;EAC1C,GAAG;EACH,GAAG;EACJ;CAED,MAAM,4BAA4B,KAAK,SAAS,oBAAoB;CAOpE,MAAM,qBAL6B,wBAAwB,cAAc,CAEvE,WAAW,MAGoC,MAC9C,OAAO,GAAG,YAAY,WAAW,QACnC;CAED,MAAM,8BAA8B,MAAM,yBACxC,YACA,eACA,WACD;AAED,KAAI,oBAAoB,UAAU;EAEhC,MAAM,gBAAgB,UACpB,mBAAmB,SACnB,WAAW,QACZ;EAED,MAAM,WAAW,QACf,cAAc,QAAQ,SACtB,mBAAmB,SACpB;AAGD,MAAI,cACF,QAAO;GACL,QAAQ;GACR,MAAM;GACP;AAGH,QAAM,yBACJ,UACA,6BACA,cACD;AAED,SAAO;GAAE,QAAQ;GAAW,MAAM;GAAU;;AAG9C,KAAI,WAAW,UAAU;EACvB,MAAM,WAAW,QACf,cAAc,QAAQ,SACtB,WAAW,SACZ;AACD,QAAM,yBACJ,UACA,6BACA,cACD;AAED,SAAO;GAAE,QAAQ;GAAW,MAAM;GAAU;;CAI9C,MAAM,yBAAyB,KAC7B,2BACA,GAAG,WAAW,IAAI,eACnB;AAED,OAAM,yBACJ,wBACA,6BACA,cACD;AAED,QAAO;EACL,QAAQ;EACR,MAAM;EACP;;AAGH,MAAM,2BAA2B,OAC/B,kBACA,YACA,kBACkB;AAKlB,OAAM,MAHM,QAAQ,iBAAiB,EAGpB,EAAE,WAAW,MAAM,CAAC;CAErC,MAAM,YAAY,QAAQ,iBAAiB;AAK3C,KAAI,CAJuB,cAAc,QAAQ,eAAe,KAC7D,gBAAc,QAAQC,YAAU,CAClC,CAEuB,SAAS,UAAU,CACzC,OAAM,IAAI,MACR,2BAA2B,UAAU,UAAU,mBAChD;AAGH,KAAI,cAAc,SAAS;AAIzB,QAAM,UAAU,kBAAkB,GAHX,KAAK,UAAU,YAAY,MAAM,EAAE,CAGN,IAAI;AAExD;;AAGF,OAAM,YAAY,kBAAkB,YAAY,cAAc;AAI9D,KAAI;AACF,QAAM,GAAG,cAAc,QAAQ,UAAU,EAAE,WAAW,MAAM,CAAC;UACtD,OAAO;AACd,MACE,SACA,OAAO,UAAU,YACjB,UAAU,SACT,MAA2B,SAAS,SAErC,OAAM"}
@@ -1,50 +1,52 @@
1
- import {
2
- getAppLogger,
3
- getConfiguration,
4
- logger
5
- } from "@intlayer/config";
6
- import { existsSync } from "fs";
7
- import { readFile, writeFile } from "fs/promises";
8
- import { extname } from "path";
9
1
  import { getContentDeclarationFileTemplate } from "../getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs";
10
- import {
11
- getFormatFromExtension
12
- } from "../utils/getFormatFromExtension.mjs";
13
- import { formatCode } from "./formatCode.mjs";
2
+ import { getFormatFromExtension } from "../utils/getFormatFromExtension.mjs";
14
3
  import { transformJSFile } from "./transformJSFile.mjs";
15
- const writeJSFile = async (filePath, dictionary, configuration = getConfiguration()) => {
16
- const { key, locale, autoFilled } = dictionary;
17
- const appLogger = getAppLogger(configuration);
18
- if (!existsSync(filePath)) {
19
- const fileExtension = extname(filePath);
20
- let format = getFormatFromExtension(fileExtension);
21
- appLogger("File does not exist, creating it", {
22
- isVerbose: true
23
- });
24
- const template = await getContentDeclarationFileTemplate(key, format, {
25
- locale,
26
- autoFilled
27
- });
28
- await writeFile(filePath, template, "utf-8");
29
- }
30
- const fileContent = await readFile(filePath, "utf-8");
31
- const finalCode = await transformJSFile(fileContent, dictionary);
32
- const formattedCode = await formatCode(filePath, finalCode);
33
- try {
34
- await writeFile(filePath, formattedCode, "utf-8");
35
- logger(`Successfully updated ${filePath}`, {
36
- level: "info",
37
- isVerbose: true
38
- });
39
- } catch (error) {
40
- const err = error;
41
- logger(`Failed to write updated file: ${filePath}`, {
42
- level: "error"
43
- });
44
- throw new Error(`Failed to write updated file ${filePath}: ${err.message}`);
45
- }
46
- };
47
- export {
48
- writeJSFile
4
+ import { existsSync } from "node:fs";
5
+ import { getAppLogger, logger } from "@intlayer/config";
6
+ import { extname } from "node:path";
7
+ import { readFile, writeFile } from "node:fs/promises";
8
+ import { execSync } from "node:child_process";
9
+
10
+ //#region src/writeContentDeclaration/writeJSFile.ts
11
+ /**
12
+ * Updates a JavaScript/TypeScript file based on the provided JSON instructions.
13
+ * It targets a specific dictionary object within the file (identified by its 'key' property)
14
+ * and updates its 'content' entries. Currently, it focuses on modifying arguments
15
+ * of 't' (translation) function calls.
16
+ */
17
+ const writeJSFile = async (filePath, dictionary, configuration) => {
18
+ const { key, locale, filled } = dictionary;
19
+ const appLogger = getAppLogger(configuration);
20
+ if (!existsSync(filePath)) {
21
+ const format = getFormatFromExtension(extname(filePath));
22
+ appLogger("File does not exist, creating it", { isVerbose: true });
23
+ await writeFile(filePath, await getContentDeclarationFileTemplate(key, format, {
24
+ locale,
25
+ filled
26
+ }), "utf-8");
27
+ }
28
+ const finalCode = await transformJSFile(await readFile(filePath, "utf-8"), dictionary);
29
+ try {
30
+ await writeFile(filePath, finalCode, "utf-8");
31
+ logger(`Successfully updated ${filePath}`, {
32
+ level: "info",
33
+ isVerbose: true
34
+ });
35
+ } catch (error) {
36
+ const err = error;
37
+ logger(`Failed to write updated file: ${filePath}`, { level: "error" });
38
+ throw new Error(`Failed to write updated file ${filePath}: ${err.message}`);
39
+ }
40
+ if (configuration.editor.formatCommand) try {
41
+ execSync(configuration.editor.formatCommand.replace("{{file}}", filePath), {
42
+ stdio: "inherit",
43
+ cwd: configuration.content.baseDir
44
+ });
45
+ } catch (error) {
46
+ console.error(error);
47
+ }
49
48
  };
49
+
50
+ //#endregion
51
+ export { writeJSFile };
50
52
  //# sourceMappingURL=writeJSFile.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/writeContentDeclaration/writeJSFile.ts"],"sourcesContent":["import {\n getAppLogger,\n getConfiguration,\n IntlayerConfig,\n logger,\n} from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { existsSync } from 'fs';\nimport { readFile, writeFile } from 'fs/promises';\nimport { extname } from 'path';\nimport { getContentDeclarationFileTemplate } from '../getContentDeclarationFileTemplate/getContentDeclarationFileTemplate';\nimport {\n Extension,\n getFormatFromExtension,\n} from '../utils/getFormatFromExtension';\nimport { formatCode } from './formatCode';\nimport { transformJSFile } from './transformJSFile';\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 configuration: IntlayerConfig = getConfiguration()\n): Promise<void> => {\n const { key, locale, autoFilled } = dictionary;\n const appLogger = getAppLogger(configuration);\n\n // Check if the file exist\n if (!existsSync(filePath)) {\n const fileExtension = extname(filePath) as Extension;\n\n let format = getFormatFromExtension(fileExtension);\n\n appLogger('File does not exist, creating it', {\n isVerbose: true,\n });\n const template = await getContentDeclarationFileTemplate(key, format, {\n locale,\n autoFilled,\n });\n\n await writeFile(filePath, template, 'utf-8');\n }\n\n const fileContent = await readFile(filePath, 'utf-8');\n\n const finalCode = await transformJSFile(fileContent, dictionary);\n\n const formattedCode = await formatCode(filePath, finalCode);\n\n // Write the modified code back to the file\n try {\n await writeFile(filePath, formattedCode, '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;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAEP,SAAS,kBAAkB;AAC3B,SAAS,UAAU,iBAAiB;AACpC,SAAS,eAAe;AACxB,SAAS,yCAAyC;AAClD;AAAA,EAEE;AAAA,OACK;AACP,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAQzB,MAAM,cAAc,OACzB,UACA,YACA,gBAAgC,iBAAiB,MAC/B;AAClB,QAAM,EAAE,KAAK,QAAQ,WAAW,IAAI;AACpC,QAAM,YAAY,aAAa,aAAa;AAG5C,MAAI,CAAC,WAAW,QAAQ,GAAG;AACzB,UAAM,gBAAgB,QAAQ,QAAQ;AAEtC,QAAI,SAAS,uBAAuB,aAAa;AAEjD,cAAU,oCAAoC;AAAA,MAC5C,WAAW;AAAA,IACb,CAAC;AACD,UAAM,WAAW,MAAM,kCAAkC,KAAK,QAAQ;AAAA,MACpE;AAAA,MACA;AAAA,IACF,CAAC;AAED,UAAM,UAAU,UAAU,UAAU,OAAO;AAAA,EAC7C;AAEA,QAAM,cAAc,MAAM,SAAS,UAAU,OAAO;AAEpD,QAAM,YAAY,MAAM,gBAAgB,aAAa,UAAU;AAE/D,QAAM,gBAAgB,MAAM,WAAW,UAAU,SAAS;AAG1D,MAAI;AACF,UAAM,UAAU,UAAU,eAAe,OAAO;AAChD,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,"file":"writeJSFile.mjs","names":[],"sources":["../../../src/writeContentDeclaration/writeJSFile.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { existsSync } from 'node:fs';\nimport { readFile, writeFile } from 'node:fs/promises';\nimport { extname } from 'node:path';\nimport { getAppLogger, logger } from '@intlayer/config';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { getContentDeclarationFileTemplate } from '../getContentDeclarationFileTemplate/getContentDeclarationFileTemplate';\nimport {\n type Extension,\n getFormatFromExtension,\n} from '../utils/getFormatFromExtension';\nimport { transformJSFile } from './transformJSFile';\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 configuration: IntlayerConfig\n): Promise<void> => {\n const { key, locale, filled } = dictionary;\n const appLogger = getAppLogger(configuration);\n\n // Check if the file exist\n if (!existsSync(filePath)) {\n const fileExtension = extname(filePath) as Extension;\n\n const format = getFormatFromExtension(fileExtension);\n\n appLogger('File does not exist, creating it', {\n isVerbose: true,\n });\n const template = await getContentDeclarationFileTemplate(key, format, {\n locale,\n filled,\n });\n\n await writeFile(filePath, template, 'utf-8');\n }\n\n const fileContent = await readFile(filePath, 'utf-8');\n\n const finalCode = await transformJSFile(fileContent, dictionary);\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 if (configuration.editor.formatCommand) {\n try {\n execSync(\n configuration.editor.formatCommand.replace('{{file}}', filePath),\n {\n stdio: 'inherit',\n cwd: configuration.content.baseDir,\n }\n );\n } catch (error) {\n console.error(error);\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAa,cAAc,OACzB,UACA,YACA,kBACkB;CAClB,MAAM,EAAE,KAAK,QAAQ,WAAW;CAChC,MAAM,YAAY,aAAa,cAAc;AAG7C,KAAI,CAAC,WAAW,SAAS,EAAE;EAGzB,MAAM,SAAS,uBAFO,QAAQ,SAAS,CAEa;AAEpD,YAAU,oCAAoC,EAC5C,WAAW,MACZ,CAAC;AAMF,QAAM,UAAU,UALC,MAAM,kCAAkC,KAAK,QAAQ;GACpE;GACA;GACD,CAAC,EAEkC,QAAQ;;CAK9C,MAAM,YAAY,MAAM,gBAFJ,MAAM,SAAS,UAAU,QAAQ,EAEA,WAAW;AAGhE,KAAI;AACF,QAAM,UAAU,UAAU,WAAW,QAAQ;AAC7C,SAAO,wBAAwB,YAAY;GACzC,OAAO;GACP,WAAW;GACZ,CAAC;UACK,OAAO;EACd,MAAM,MAAM;AACZ,SAAO,iCAAiC,YAAY,EAClD,OAAO,SACR,CAAC;AACF,QAAM,IAAI,MAAM,gCAAgC,SAAS,IAAI,IAAI,UAAU;;AAG7E,KAAI,cAAc,OAAO,cACvB,KAAI;AACF,WACE,cAAc,OAAO,cAAc,QAAQ,YAAY,SAAS,EAChE;GACE,OAAO;GACP,KAAK,cAAc,QAAQ;GAC5B,CACF;UACM,OAAO;AACd,UAAQ,MAAM,MAAM"}
@@ -1,22 +1,11 @@
1
- import { createHash } from "node:crypto";
2
- import { createReadStream } from "node:fs";
3
1
  import { writeFile } from "node:fs/promises";
4
- const hashFile = async (path) => {
5
- const h = createHash("sha256");
6
- const rs = createReadStream(path);
7
- rs.on("data", (chunk) => h.update(chunk));
8
- await new Promise((res, rej) => {
9
- rs.on("end", () => res());
10
- rs.on("error", rej);
11
- });
12
- return h.digest("hex");
13
- };
14
- const isReadableStream = (value) => !!value && typeof value === "object" && typeof value.pipe === "function";
2
+
3
+ //#region src/writeFileIfChanged.ts
15
4
  const writeFileIfChanged = async (path, dataOrStream, { encoding = "utf8" } = {}) => {
16
- await writeFile(path, dataOrStream, { encoding });
17
- return true;
18
- };
19
- export {
20
- writeFileIfChanged
5
+ await writeFile(path, dataOrStream, { encoding });
6
+ return true;
21
7
  };
8
+
9
+ //#endregion
10
+ export { writeFileIfChanged };
22
11
  //# sourceMappingURL=writeFileIfChanged.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/writeFileIfChanged.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { createReadStream } from 'node:fs';\nimport { writeFile } from 'node:fs/promises';\nimport { Readable } from 'node:stream';\n\nconst hashFile = async (path: string) => {\n const h = createHash('sha256');\n const rs = createReadStream(path);\n rs.on('data', (chunk) => h.update(chunk));\n await new Promise<void>((res, rej) => {\n rs.on('end', () => res());\n rs.on('error', rej);\n });\n return h.digest('hex');\n};\n\nconst isReadableStream = (value: unknown): value is Readable =>\n !!value &&\n typeof value === 'object' &&\n typeof (value as any).pipe === 'function';\n\nexport const writeFileIfChanged = async (\n path: string,\n dataOrStream: string,\n { encoding = 'utf8' }: { encoding?: BufferEncoding } = {}\n): Promise<boolean> => {\n // Disabled because it's too slow. Build time increases from 3s to 7s.\n await writeFile(path, dataOrStream, { encoding });\n\n // 1) write new content to temporary file (stream-safe)\n // const tmp = `${path}.tmp`;\n\n // if (isReadableStream(dataOrStream)) {\n // await pipeline(dataOrStream, createWriteStream(tmp));\n // } else {\n // // dataOrStream = string | Buffer\n // const buf = Buffer.isBuffer(dataOrStream)\n // ? dataOrStream\n // : Buffer.from(dataOrStream, encoding);\n // await writeFile(tmp, buf);\n // }\n\n // 2) if old file exists, compare hashes (streaming)\n // let same = false;\n // try {\n // const [oldHash, newHash] = await Promise.all([\n // hashFile(path),\n // hashFile(tmp),\n // ]);\n // same = oldHash === newHash;\n // } catch {\n // // old file missing -> will replace\n // }\n\n // if (same) {\n // await rm(tmp);\n // return false; // no change\n // }\n\n // 3) atomic replacement\n // On Unix, rename is atomic. On Windows, if file exists, we can delete it first.\n // try {\n // await rename(tmp, path);\n // } catch {\n // try {\n // await rm(path);\n // } catch {}\n // await rename(tmp, path);\n // }\n\n return true; // changed\n};\n"],"mappings":"AAAA,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AACjC,SAAS,iBAAiB;AAG1B,MAAM,WAAW,OAAO,SAAiB;AACvC,QAAM,IAAI,WAAW,QAAQ;AAC7B,QAAM,KAAK,iBAAiB,IAAI;AAChC,KAAG,GAAG,QAAQ,CAAC,UAAU,EAAE,OAAO,KAAK,CAAC;AACxC,QAAM,IAAI,QAAc,CAAC,KAAK,QAAQ;AACpC,OAAG,GAAG,OAAO,MAAM,IAAI,CAAC;AACxB,OAAG,GAAG,SAAS,GAAG;AAAA,EACpB,CAAC;AACD,SAAO,EAAE,OAAO,KAAK;AACvB;AAEA,MAAM,mBAAmB,CAAC,UACxB,CAAC,CAAC,SACF,OAAO,UAAU,YACjB,OAAQ,MAAc,SAAS;AAE1B,MAAM,qBAAqB,OAChC,MACA,cACA,EAAE,WAAW,OAAO,IAAmC,CAAC,MACnC;AAErB,QAAM,UAAU,MAAM,cAAc,EAAE,SAAS,CAAC;AA2ChD,SAAO;AACT;","names":[]}
1
+ {"version":3,"file":"writeFileIfChanged.mjs","names":[],"sources":["../../src/writeFileIfChanged.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\n// import { createHash } from 'node:crypto';\n// import { createReadStream } from 'node:fs';\n// import type { Readable } from 'node:stream';\n\n// const hashFile = async (path: string) => {\n// const h = createHash('sha256');\n// const rs = createReadStream(path);\n// rs.on('data', (chunk) => h.update(chunk));\n// await new Promise<void>((res, rej) => {\n// rs.on('end', () => res());\n// rs.on('error', rej);\n// });\n// return h.digest('hex');\n// };\n\n// const isReadableStream = (value: unknown): value is Readable =>\n// !!value &&\n// typeof value === 'object' &&\n// typeof (value as any).pipe === 'function';\n\nexport const writeFileIfChanged = async (\n path: string,\n dataOrStream: string,\n { encoding = 'utf8' }: { encoding?: BufferEncoding } = {}\n): Promise<boolean> => {\n // Disabled because it's too slow. Build time increases from 3s to 7s.\n await writeFile(path, dataOrStream, { encoding });\n\n // 1) write new content to temporary file (stream-safe)\n // const tmp = `${path}.tmp`;\n\n // if (isReadableStream(dataOrStream)) {\n // await pipeline(dataOrStream, createWriteStream(tmp));\n // } else {\n // // dataOrStream = string | Buffer\n // const buf = Buffer.isBuffer(dataOrStream)\n // ? dataOrStream\n // : Buffer.from(dataOrStream, encoding);\n // await writeFile(tmp, buf);\n // }\n\n // 2) if old file exists, compare hashes (streaming)\n // let same = false;\n // try {\n // const [oldHash, newHash] = await Promise.all([\n // hashFile(path),\n // hashFile(tmp),\n // ]);\n // same = oldHash === newHash;\n // } catch {\n // // old file missing -> will replace\n // }\n\n // if (same) {\n // await rm(tmp);\n // return false; // no change\n // }\n\n // 3) atomic replacement\n // On Unix, rename is atomic. On Windows, if file exists, we can delete it first.\n // try {\n // await rename(tmp, path);\n // } catch {\n // try {\n // await rm(path);\n // } catch {}\n // await rename(tmp, path);\n // }\n\n return true; // changed\n};\n"],"mappings":";;;AAqBA,MAAa,qBAAqB,OAChC,MACA,cACA,EAAE,WAAW,WAA0C,EAAE,KACpC;AAErB,OAAM,UAAU,MAAM,cAAc,EAAE,UAAU,CAAC;AA2CjD,QAAO"}
@@ -1,10 +1,17 @@
1
1
  import { writeFileIfChanged } from "./writeFileIfChanged.mjs";
2
- const writeJsonIfChanged = async (path, data, { pretty = process.env.NODE_ENV === "development" } = {}) => {
3
- const space = pretty ? 2 : void 0;
4
- const json = JSON.stringify(data, null, space);
5
- return await writeFileIfChanged(path, json);
6
- };
7
- export {
8
- writeJsonIfChanged
2
+
3
+ //#region src/writeJsonIfChanged.ts
4
+ const writeJsonIfChanged = async (path, data, { pretty = true } = {}) => {
5
+ const space = pretty ? 2 : void 0;
6
+ let json = "{}";
7
+ try {
8
+ json = JSON.stringify(data, null, space);
9
+ } catch (error) {
10
+ console.error(`Error while parsing data to JSON for ${path}:`, error);
11
+ }
12
+ return await writeFileIfChanged(path, json);
9
13
  };
14
+
15
+ //#endregion
16
+ export { writeJsonIfChanged };
10
17
  //# sourceMappingURL=writeJsonIfChanged.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/writeJsonIfChanged.ts"],"sourcesContent":["import { writeFileIfChanged } from './writeFileIfChanged';\n\nexport const writeJsonIfChanged = async <T>(\n path: string,\n data: T,\n { pretty = process.env.NODE_ENV === 'development' } = {}\n): Promise<boolean> => {\n const space = pretty ? 2 : undefined;\n const json = JSON.stringify(data, null, space);\n\n return await writeFileIfChanged(path, json);\n};\n"],"mappings":"AAAA,SAAS,0BAA0B;AAE5B,MAAM,qBAAqB,OAChC,MACA,MACA,EAAE,SAAS,QAAQ,IAAI,aAAa,cAAc,IAAI,CAAC,MAClC;AACrB,QAAM,QAAQ,SAAS,IAAI;AAC3B,QAAM,OAAO,KAAK,UAAU,MAAM,MAAM,KAAK;AAE7C,SAAO,MAAM,mBAAmB,MAAM,IAAI;AAC5C;","names":[]}
1
+ {"version":3,"file":"writeJsonIfChanged.mjs","names":[],"sources":["../../src/writeJsonIfChanged.ts"],"sourcesContent":["import { writeFileIfChanged } from './writeFileIfChanged';\n\nexport const writeJsonIfChanged = async <T>(\n path: string,\n data: T,\n { pretty = process.env.NODE_ENV === 'development' } = {}\n): Promise<boolean> => {\n const space = pretty ? 2 : undefined;\n\n let json = '{}';\n\n try {\n json = JSON.stringify(data, null, space);\n } catch (error) {\n console.error(`Error while parsing data to JSON for ${path}:`, error);\n }\n\n return await writeFileIfChanged(path, json);\n};\n"],"mappings":";;;AAEA,MAAa,qBAAqB,OAChC,MACA,MACA,EAAE,SAAS,SAA2C,EAAE,KACnC;CACrB,MAAM,QAAQ,SAAS,IAAI;CAE3B,IAAI,OAAO;AAEX,KAAI;AACF,SAAO,KAAK,UAAU,MAAM,MAAM,MAAM;UACjC,OAAO;AACd,UAAQ,MAAM,wCAAwC,KAAK,IAAI,MAAM;;AAGvE,QAAO,MAAM,mBAAmB,MAAM,KAAK"}
@@ -1,12 +1,19 @@
1
- import type { Dictionary } from '@intlayer/core';
2
- import { LocalizedDictionaryOutput } from './writeDynamicDictionary';
1
+ import { UnmergedDictionaryOutput } from "./writeUnmergedDictionary.js";
2
+ import { MergedDictionaryOutput } from "./writeMergedDictionary.js";
3
+ import { LocalizedDictionaryOutput } from "./writeDynamicDictionary.js";
4
+ import * as _intlayer_types5 from "@intlayer/types";
5
+ import { Dictionary } from "@intlayer/types";
6
+
7
+ //#region src/buildIntlayerDictionary/buildIntlayerDictionary.d.ts
3
8
  /**
4
9
  * This function transpile the bundled code to to make dictionaries as JSON files
5
10
  */
6
- export declare const buildDictionary: (localDictionariesEntries: Dictionary[], configuration?: import("@intlayer/config").IntlayerConfig, formats?: ("cjs" | "esm")[], importOtherDictionaries?: boolean) => Promise<{
7
- unmergedDictionaries: import("./writeUnmergedDictionary").UnmergedDictionaryOutput;
8
- mergedDictionaries: import("./writeMergedDictionary").MergedDictionaryOutput;
9
- dynamicDictionaries: LocalizedDictionaryOutput;
10
- fetchDictionaries: LocalizedDictionaryOutput;
11
+ declare const buildDictionary: (localDictionariesEntries: Dictionary[], configuration?: _intlayer_types5.IntlayerConfig, formats?: ("cjs" | "esm")[], importOtherDictionaries?: boolean) => Promise<{
12
+ unmergedDictionaries: UnmergedDictionaryOutput;
13
+ mergedDictionaries: MergedDictionaryOutput;
14
+ dynamicDictionaries: LocalizedDictionaryOutput;
15
+ fetchDictionaries: LocalizedDictionaryOutput;
11
16
  }>;
17
+ //#endregion
18
+ export { buildDictionary };
12
19
  //# sourceMappingURL=buildIntlayerDictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildIntlayerDictionary.d.ts","sourceRoot":"","sources":["../../../src/buildIntlayerDictionary/buildIntlayerDictionary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EACL,yBAAyB,EAE1B,MAAM,0BAA0B,CAAC;AAKlC;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,0BAA0B,UAAU,EAAE,EACtC,yDAAkC,EAClC,UAAS,CAAC,KAAK,GAAG,KAAK,CAAC,EAAmB,EAC3C,iCAA8B;;;;;EAkE/B,CAAC"}
1
+ {"version":3,"file":"buildIntlayerDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/buildIntlayerDictionary.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;cAca,4CACe,8BAAU,gBAAA,CACpC,mFAE8B;wBAFI;EAFvB,kBAsEZ,wBAAA;EArE2B,mBAAA,2BAAA;EAAU,iBACpC,2BAAA;CAAkC,CAAA"}
@@ -1,3 +1,3 @@
1
- export * from './buildIntlayerDictionary';
2
- export * from './processContentDeclaration';
3
- //# sourceMappingURL=index.d.ts.map
1
+ import { buildDictionary } from "./buildIntlayerDictionary.js";
2
+ import { processContentDeclaration } from "./processContentDeclaration.js";
3
+ export { buildDictionary, processContentDeclaration };
@@ -1,6 +1,11 @@
1
- import type { Dictionary } from '@intlayer/core';
1
+ import { Dictionary } from "@intlayer/types";
2
+
3
+ //#region src/buildIntlayerDictionary/processContentDeclaration.d.ts
4
+
2
5
  /**
3
6
  * Function to load, process the module and return the Intlayer Dictionary from the module file
4
7
  */
5
- export declare const processContentDeclaration: (contentDeclaration: Dictionary) => Promise<Dictionary | undefined>;
8
+ declare const processContentDeclaration: (contentDeclaration: Dictionary) => Promise<Dictionary | undefined>;
9
+ //#endregion
10
+ export { processContentDeclaration };
6
11
  //# sourceMappingURL=processContentDeclaration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"processContentDeclaration.d.ts","sourceRoot":"","sources":["../../../src/buildIntlayerDictionary/processContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;GAEG;AACH,eAAO,MAAM,yBAAyB,GACpC,oBAAoB,UAAU,KAC7B,OAAO,CAAC,UAAU,GAAG,SAAS,CAehC,CAAC"}
1
+ {"version":3,"file":"processContentDeclaration.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/processContentDeclaration.ts"],"sourcesContent":[],"mappings":";;;;;;AAOA;AACsB,cADT,yBACS,EAAA,CAAA,kBAAA,EAAA,UAAA,EAAA,GACnB,OADmB,CACX,UADW,GAAA,SAAA,CAAA"}
@@ -1,16 +1,18 @@
1
- import { Locales } from '@intlayer/config';
2
- import { type Dictionary } from '@intlayer/core';
3
- import { MergedDictionaryOutput } from './writeMergedDictionary';
4
- export type DictionaryResult = {
5
- dictionaryPath: string;
6
- dictionary: Dictionary;
1
+ import { MergedDictionaryOutput } from "./writeMergedDictionary.js";
2
+ import * as _intlayer_types0 from "@intlayer/types";
3
+ import { Dictionary, Locale } from "@intlayer/types";
4
+
5
+ //#region src/buildIntlayerDictionary/writeDynamicDictionary.d.ts
6
+ type DictionaryResult = {
7
+ dictionaryPath: string;
8
+ dictionary: Dictionary;
7
9
  };
8
- export type LocalizedDictionaryResult = Partial<Record<Locales, DictionaryResult>>;
9
- export type LocalizedDictionaryOutput = Record<string, LocalizedDictionaryResult>;
10
+ type LocalizedDictionaryResult = Partial<Record<Locale, DictionaryResult>>;
11
+ type LocalizedDictionaryOutput = Record<string, LocalizedDictionaryResult>;
10
12
  /**
11
13
  * This function generates the content of the dictionary list file
12
14
  */
13
- export declare const generateDictionaryEntryPoint: (localedDictionariesPathsRecord: LocalizedDictionaryResult, format?: "cjs" | "esm", configuration?: import("@intlayer/config").IntlayerConfig) => string;
15
+ declare const generateDictionaryEntryPoint: (localizedDictionariesPathsRecord: LocalizedDictionaryResult, format?: "cjs" | "esm", configuration?: _intlayer_types0.IntlayerConfig) => string;
14
16
  /**
15
17
  * Write the localized dictionaries to the dictionariesDir
16
18
  * @param mergedDictionaries - The merged dictionaries
@@ -27,5 +29,7 @@ export declare const generateDictionaryEntryPoint: (localedDictionariesPathsReco
27
29
  * // { key: 'home', content: { ... } },
28
30
  * ```
29
31
  */
30
- export declare const writeDynamicDictionary: (mergedDictionaries: MergedDictionaryOutput, configuration?: import("@intlayer/config").IntlayerConfig, formats?: ("cjs" | "esm")[]) => Promise<LocalizedDictionaryOutput>;
32
+ declare const writeDynamicDictionary: (mergedDictionaries: MergedDictionaryOutput, configuration?: _intlayer_types0.IntlayerConfig, formats?: ("cjs" | "esm")[]) => Promise<LocalizedDictionaryOutput>;
33
+ //#endregion
34
+ export { DictionaryResult, LocalizedDictionaryOutput, LocalizedDictionaryResult, generateDictionaryEntryPoint, writeDynamicDictionary };
31
35
  //# sourceMappingURL=writeDynamicDictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"writeDynamicDictionary.d.ts","sourceRoot":"","sources":["../../../src/buildIntlayerDictionary/writeDynamicDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,OAAO,EAER,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMtE,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,MAgCF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GACjC,oBAAoB,sBAAsB,EAC1C,yDAAkC,EAClC,UAAS,CAAC,KAAK,GAAG,KAAK,CAAC,EAAmB,KAC1C,OAAO,CAAC,yBAAyB,CAwEnC,CAAC"}
1
+ {"version":3,"file":"writeDynamicDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/writeDynamicDictionary.ts"],"sourcesContent":[],"mappings":";;;;;KAcY,gBAAA;;cAEE;AAFd,CAAA;AAKY,KAAA,yBAAA,GAA4B,OAAH,CACnC,MADmC,CAC5B,MAD4B,EACpB,gBADoB,CAAA,CAAA;AAC5B,KAGG,yBAAA,GAA4B,MAH/B,CAAA,MAAA,EAKP,yBALO,CAAA;;;;AADsC,cAYlC,4BAZkC,EAAA,CAAA,gCAAA,EAaX,yBAbW,EAAA,MAAA,CAAA,EAAA,KAAA,GAAA,KAAA,EAAA,aAAA,CAAA,EAac,gBAAA,CAE3D,cAf6C,EAAA,GAAA,MAAA;AAI/C;AAQA;AAsDA;;;;;;;;;;;;;;cAAa,6CACS,wCAAsB,gBAAA,CAC1C,gDAEC,QAAQ"}
@@ -1,8 +1,11 @@
1
- import type { LocalizedDictionaryOutput, LocalizedDictionaryResult } from './writeDynamicDictionary';
1
+ import { LocalizedDictionaryOutput, LocalizedDictionaryResult } from "./writeDynamicDictionary.js";
2
+ import * as _intlayer_types2 from "@intlayer/types";
3
+
4
+ //#region src/buildIntlayerDictionary/writeFetchDictionary.d.ts
2
5
  /**
3
6
  * This function generates the content of the dictionary list file
4
7
  */
5
- export declare const generateDictionaryEntryPoint: (localedDictionariesPathsRecord: LocalizedDictionaryResult, format?: "cjs" | "esm", configuration?: import("@intlayer/config").IntlayerConfig) => string;
8
+ declare const generateDictionaryEntryPoint: (localedDictionariesPathsRecord: LocalizedDictionaryResult, format?: "cjs" | "esm", configuration?: _intlayer_types2.IntlayerConfig) => string;
6
9
  /**
7
10
  * Write the localized dictionaries to the dictionariesDir
8
11
  * @param mergedDictionaries - The merged dictionaries
@@ -19,5 +22,7 @@ export declare const generateDictionaryEntryPoint: (localedDictionariesPathsReco
19
22
  * // { key: 'home', content: { ... } },
20
23
  * ```
21
24
  */
22
- export declare const writeFetchDictionary: (dynamicDictionaries: LocalizedDictionaryOutput, configuration?: import("@intlayer/config").IntlayerConfig, formats?: ("cjs" | "esm")[]) => Promise<LocalizedDictionaryOutput>;
25
+ declare const writeFetchDictionary: (dynamicDictionaries: LocalizedDictionaryOutput, configuration?: _intlayer_types2.IntlayerConfig, formats?: ("cjs" | "esm")[]) => Promise<LocalizedDictionaryOutput>;
26
+ //#endregion
27
+ export { generateDictionaryEntryPoint, writeFetchDictionary };
23
28
  //# sourceMappingURL=writeFetchDictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"writeFetchDictionary.d.ts","sourceRoot":"","sources":["../../../src/buildIntlayerDictionary/writeFetchDictionary.ts"],"names":[],"mappings":"AASA,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,CAoCnC,CAAC"}
1
+ {"version":3,"file":"writeFetchDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/writeFetchDictionary.ts"],"sourcesContent":[],"mappings":";;;;;;;AAiBa,cAAA,4BACqB,EAAA,CAAA,8BAAyB,EAAzB,yBAEE,EAAA,MAAA,CAAA,EAAA,KAAA,GAAA,KAAA,EAAA,aAAA,CAAA,EAFuB,gBAAA,CAEzD,cAAkC,EAAA,GAAA,MAAA;AA+CpC;;;;;;;;;;;;;;;;cAAa,4CACU,2CAAyB,gBAAA,CAC9C,gDAEC,QAAQ"}