@intlayer/chokidar 6.0.2 → 6.1.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 (292) hide show
  1. package/README.md +249 -66
  2. package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/buildIntlayerDictionary.cjs +18 -2
  3. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -0
  4. package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/index.cjs +4 -4
  5. package/dist/cjs/buildIntlayerDictionary/index.cjs.map +1 -0
  6. package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/processContentDeclaration.cjs +1 -1
  7. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -0
  8. package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeDynamicDictionary.cjs +3 -3
  9. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -0
  10. package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeFetchDictionary.cjs +2 -2
  11. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -0
  12. package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeMergedDictionary.cjs +4 -4
  13. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -0
  14. package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeRemoteDictionary.cjs +4 -4
  15. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -0
  16. package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeUnmergedDictionary.cjs +4 -4
  17. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -0
  18. package/dist/cjs/{transpiler/dictionary_to_main → createDictionaryEntryPoint}/createDictionaryEntryPoint.cjs +7 -7
  19. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -0
  20. package/dist/cjs/{transpiler/dictionary_to_main → createDictionaryEntryPoint}/generateDictionaryListContent.cjs +1 -1
  21. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -0
  22. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -0
  23. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -0
  24. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -0
  25. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -0
  26. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -0
  27. package/dist/cjs/createDictionaryEntryPoint/index.cjs +35 -0
  28. package/dist/cjs/createDictionaryEntryPoint/index.cjs.map +1 -0
  29. package/dist/cjs/{transpiler/dictionary_to_type → createType}/createModuleAugmentation.cjs +3 -3
  30. package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -0
  31. package/dist/cjs/{transpiler/dictionary_to_type → createType}/createType.cjs +1 -1
  32. package/dist/cjs/createType/createType.cjs.map +1 -0
  33. package/dist/cjs/{transpiler/dictionary_to_type → createType}/index.cjs +4 -4
  34. package/dist/cjs/createType/index.cjs.map +1 -0
  35. package/dist/cjs/filterInvalidDictionaries.cjs +32 -40
  36. package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
  37. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +54 -0
  38. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -0
  39. package/dist/cjs/handleContentDeclarationFileChange.cjs +59 -0
  40. package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -0
  41. package/dist/cjs/handleUnlikedContentDeclarationFile.cjs +57 -0
  42. package/dist/cjs/handleUnlikedContentDeclarationFile.cjs.map +1 -0
  43. package/dist/cjs/index.cjs +35 -12
  44. package/dist/cjs/index.cjs.map +1 -1
  45. package/dist/cjs/listDictionariesPath.cjs.map +1 -1
  46. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +6 -3
  47. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  48. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +8 -4
  49. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
  50. package/dist/cjs/prepareIntlayer.cjs +10 -8
  51. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  52. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +2 -2
  53. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
  54. package/dist/cjs/utils/extractErrorMessage.cjs +22 -10
  55. package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -1
  56. package/dist/cjs/utils/parallelize.cjs +139 -12
  57. package/dist/cjs/utils/parallelize.cjs.map +1 -1
  58. package/dist/cjs/utils/runParallel.cjs +77 -0
  59. package/dist/cjs/utils/runParallel.cjs.map +1 -0
  60. package/dist/cjs/watcher.cjs +89 -0
  61. package/dist/cjs/watcher.cjs.map +1 -0
  62. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +770 -0
  63. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -0
  64. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +46 -55
  65. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  66. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +12 -288
  67. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
  68. package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/buildIntlayerDictionary.mjs +18 -2
  69. package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs.map +1 -0
  70. package/dist/esm/buildIntlayerDictionary/index.mjs.map +1 -0
  71. package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/processContentDeclaration.mjs +1 -1
  72. package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs.map +1 -0
  73. package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeDynamicDictionary.mjs +3 -3
  74. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs.map +1 -0
  75. package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeFetchDictionary.mjs +2 -2
  76. package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs.map +1 -0
  77. package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeMergedDictionary.mjs +4 -4
  78. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs.map +1 -0
  79. package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeRemoteDictionary.mjs +4 -4
  80. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs.map +1 -0
  81. package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeUnmergedDictionary.mjs +4 -4
  82. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs.map +1 -0
  83. package/dist/esm/{transpiler/dictionary_to_main → createDictionaryEntryPoint}/createDictionaryEntryPoint.mjs +7 -7
  84. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs.map +1 -0
  85. package/dist/esm/{transpiler/dictionary_to_main → createDictionaryEntryPoint}/generateDictionaryListContent.mjs +1 -1
  86. package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs.map +1 -0
  87. package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs.map +1 -0
  88. package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs.map +1 -0
  89. package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs.map +1 -0
  90. package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs.map +1 -0
  91. package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs.map +1 -0
  92. package/dist/esm/createDictionaryEntryPoint/index.mjs +8 -0
  93. package/dist/esm/createDictionaryEntryPoint/index.mjs.map +1 -0
  94. package/dist/esm/{transpiler/dictionary_to_type → createType}/createModuleAugmentation.mjs +3 -3
  95. package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -0
  96. package/dist/esm/{transpiler/dictionary_to_type → createType}/createType.mjs +1 -1
  97. package/dist/esm/createType/createType.mjs.map +1 -0
  98. package/dist/esm/createType/index.mjs.map +1 -0
  99. package/dist/esm/filterInvalidDictionaries.mjs +29 -28
  100. package/dist/esm/filterInvalidDictionaries.mjs.map +1 -1
  101. package/dist/esm/handleAdditionalContentDeclarationFile.mjs +30 -0
  102. package/dist/esm/handleAdditionalContentDeclarationFile.mjs.map +1 -0
  103. package/dist/esm/handleContentDeclarationFileChange.mjs +35 -0
  104. package/dist/esm/handleContentDeclarationFileChange.mjs.map +1 -0
  105. package/dist/esm/handleUnlikedContentDeclarationFile.mjs +33 -0
  106. package/dist/esm/handleUnlikedContentDeclarationFile.mjs.map +1 -0
  107. package/dist/esm/index.mjs +29 -14
  108. package/dist/esm/index.mjs.map +1 -1
  109. package/dist/esm/listDictionariesPath.mjs.map +1 -1
  110. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +10 -4
  111. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
  112. package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs +12 -5
  113. package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs.map +1 -1
  114. package/dist/esm/prepareIntlayer.mjs +8 -9
  115. package/dist/esm/prepareIntlayer.mjs.map +1 -1
  116. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs +2 -2
  117. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -1
  118. package/dist/esm/utils/extractErrorMessage.mjs +22 -10
  119. package/dist/esm/utils/extractErrorMessage.mjs.map +1 -1
  120. package/dist/esm/utils/parallelize.mjs +137 -1
  121. package/dist/esm/utils/parallelize.mjs.map +1 -1
  122. package/dist/esm/utils/runParallel.mjs +43 -0
  123. package/dist/esm/utils/runParallel.mjs.map +1 -0
  124. package/dist/esm/watcher.mjs +67 -0
  125. package/dist/esm/watcher.mjs.map +1 -0
  126. package/dist/esm/writeContentDeclaration/transformJSFile.mjs +751 -0
  127. package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -0
  128. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +47 -56
  129. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
  130. package/dist/esm/writeContentDeclaration/writeJSFile.mjs +15 -279
  131. package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
  132. package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/buildIntlayerDictionary.d.ts +1 -1
  133. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -0
  134. package/dist/types/buildIntlayerDictionary/index.d.ts.map +1 -0
  135. package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts.map +1 -0
  136. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -0
  137. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -0
  138. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -0
  139. package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts.map +1 -0
  140. package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts.map +1 -0
  141. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +1 -0
  142. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -0
  143. package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts.map +1 -0
  144. package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts.map +1 -0
  145. package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts.map +1 -0
  146. package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts.map +1 -0
  147. package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts.map +1 -0
  148. package/dist/types/createDictionaryEntryPoint/index.d.ts +8 -0
  149. package/dist/types/createDictionaryEntryPoint/index.d.ts.map +1 -0
  150. package/dist/types/createType/createModuleAugmentation.d.ts.map +1 -0
  151. package/dist/types/createType/createType.d.ts.map +1 -0
  152. package/dist/types/createType/index.d.ts.map +1 -0
  153. package/dist/types/filterInvalidDictionaries.d.ts +3 -1
  154. package/dist/types/filterInvalidDictionaries.d.ts.map +1 -1
  155. package/dist/types/handleAdditionalContentDeclarationFile.d.ts +3 -0
  156. package/dist/types/handleAdditionalContentDeclarationFile.d.ts.map +1 -0
  157. package/dist/types/handleContentDeclarationFileChange.d.ts +3 -0
  158. package/dist/types/handleContentDeclarationFileChange.d.ts.map +1 -0
  159. package/dist/types/handleUnlikedContentDeclarationFile.d.ts +3 -0
  160. package/dist/types/handleUnlikedContentDeclarationFile.d.ts.map +1 -0
  161. package/dist/types/index.d.ts +12 -7
  162. package/dist/types/index.d.ts.map +1 -1
  163. package/dist/types/listDictionariesPath.d.ts +5 -0
  164. package/dist/types/listDictionariesPath.d.ts.map +1 -1
  165. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +1 -1
  166. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -1
  167. package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts +2 -1
  168. package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts.map +1 -1
  169. package/dist/types/prepareIntlayer.d.ts +1 -1
  170. package/dist/types/prepareIntlayer.d.ts.map +1 -1
  171. package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts +1 -1
  172. package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts.map +1 -1
  173. package/dist/types/utils/extractErrorMessage.d.ts.map +1 -1
  174. package/dist/types/utils/parallelize.d.ts +12 -0
  175. package/dist/types/utils/parallelize.d.ts.map +1 -1
  176. package/dist/types/utils/runParallel.d.ts +11 -0
  177. package/dist/types/utils/runParallel.d.ts.map +1 -0
  178. package/dist/types/watcher.d.ts +12 -0
  179. package/dist/types/watcher.d.ts.map +1 -0
  180. package/dist/types/writeContentDeclaration/transformJSFile.d.ts +9 -0
  181. package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +1 -0
  182. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
  183. package/dist/types/writeContentDeclaration/writeJSFile.d.ts +3 -2
  184. package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +1 -1
  185. package/package.json +24 -29
  186. package/dist/cjs/chokidar/index.cjs +0 -23
  187. package/dist/cjs/chokidar/index.cjs.map +0 -1
  188. package/dist/cjs/chokidar/watcher.cjs +0 -157
  189. package/dist/cjs/chokidar/watcher.cjs.map +0 -1
  190. package/dist/cjs/getBuiltDictionariesPath.cjs.map +0 -1
  191. package/dist/cjs/getBuiltDynamicDictionariesPath.cjs.map +0 -1
  192. package/dist/cjs/getBuiltFetchDictionariesPath.cjs.map +0 -1
  193. package/dist/cjs/getBuiltRemoteDictionariesPath.cjs.map +0 -1
  194. package/dist/cjs/getBuiltUnmergedDictionariesPath.cjs.map +0 -1
  195. package/dist/cjs/reduceDictionaryContent/buildMask.cjs +0 -49
  196. package/dist/cjs/reduceDictionaryContent/buildMask.cjs.map +0 -1
  197. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs.map +0 -1
  198. package/dist/cjs/transpiler/dictionary_to_main/generateDictionaryListContent.cjs.map +0 -1
  199. package/dist/cjs/transpiler/dictionary_to_main/index.cjs +0 -25
  200. package/dist/cjs/transpiler/dictionary_to_main/index.cjs.map +0 -1
  201. package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs.map +0 -1
  202. package/dist/cjs/transpiler/dictionary_to_type/createType.cjs.map +0 -1
  203. package/dist/cjs/transpiler/dictionary_to_type/index.cjs.map +0 -1
  204. package/dist/cjs/transpiler/intlayer_dictionary/buildIntlayerDictionary.cjs.map +0 -1
  205. package/dist/cjs/transpiler/intlayer_dictionary/index.cjs.map +0 -1
  206. package/dist/cjs/transpiler/intlayer_dictionary/processContentDeclaration.cjs.map +0 -1
  207. package/dist/cjs/transpiler/intlayer_dictionary/writeDynamicDictionary.cjs.map +0 -1
  208. package/dist/cjs/transpiler/intlayer_dictionary/writeFetchDictionary.cjs.map +0 -1
  209. package/dist/cjs/transpiler/intlayer_dictionary/writeMergedDictionary.cjs.map +0 -1
  210. package/dist/cjs/transpiler/intlayer_dictionary/writeRemoteDictionary.cjs.map +0 -1
  211. package/dist/cjs/transpiler/intlayer_dictionary/writeUnmergedDictionary.cjs.map +0 -1
  212. package/dist/esm/chokidar/index.mjs +0 -2
  213. package/dist/esm/chokidar/index.mjs.map +0 -1
  214. package/dist/esm/chokidar/watcher.mjs +0 -135
  215. package/dist/esm/chokidar/watcher.mjs.map +0 -1
  216. package/dist/esm/getBuiltDictionariesPath.mjs.map +0 -1
  217. package/dist/esm/getBuiltDynamicDictionariesPath.mjs.map +0 -1
  218. package/dist/esm/getBuiltFetchDictionariesPath.mjs.map +0 -1
  219. package/dist/esm/getBuiltRemoteDictionariesPath.mjs.map +0 -1
  220. package/dist/esm/getBuiltUnmergedDictionariesPath.mjs.map +0 -1
  221. package/dist/esm/reduceDictionaryContent/buildMask.mjs +0 -24
  222. package/dist/esm/reduceDictionaryContent/buildMask.mjs.map +0 -1
  223. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs.map +0 -1
  224. package/dist/esm/transpiler/dictionary_to_main/generateDictionaryListContent.mjs.map +0 -1
  225. package/dist/esm/transpiler/dictionary_to_main/index.mjs +0 -3
  226. package/dist/esm/transpiler/dictionary_to_main/index.mjs.map +0 -1
  227. package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs.map +0 -1
  228. package/dist/esm/transpiler/dictionary_to_type/createType.mjs.map +0 -1
  229. package/dist/esm/transpiler/dictionary_to_type/index.mjs.map +0 -1
  230. package/dist/esm/transpiler/intlayer_dictionary/buildIntlayerDictionary.mjs.map +0 -1
  231. package/dist/esm/transpiler/intlayer_dictionary/index.mjs.map +0 -1
  232. package/dist/esm/transpiler/intlayer_dictionary/processContentDeclaration.mjs.map +0 -1
  233. package/dist/esm/transpiler/intlayer_dictionary/writeDynamicDictionary.mjs.map +0 -1
  234. package/dist/esm/transpiler/intlayer_dictionary/writeFetchDictionary.mjs.map +0 -1
  235. package/dist/esm/transpiler/intlayer_dictionary/writeMergedDictionary.mjs.map +0 -1
  236. package/dist/esm/transpiler/intlayer_dictionary/writeRemoteDictionary.mjs.map +0 -1
  237. package/dist/esm/transpiler/intlayer_dictionary/writeUnmergedDictionary.mjs.map +0 -1
  238. package/dist/types/chokidar/index.d.ts +0 -2
  239. package/dist/types/chokidar/index.d.ts.map +0 -1
  240. package/dist/types/chokidar/watcher.d.ts +0 -14
  241. package/dist/types/chokidar/watcher.d.ts.map +0 -1
  242. package/dist/types/getBuiltDictionariesPath.d.ts.map +0 -1
  243. package/dist/types/getBuiltDynamicDictionariesPath.d.ts.map +0 -1
  244. package/dist/types/getBuiltFetchDictionariesPath.d.ts.map +0 -1
  245. package/dist/types/getBuiltRemoteDictionariesPath.d.ts.map +0 -1
  246. package/dist/types/getBuiltUnmergedDictionariesPath.d.ts.map +0 -1
  247. package/dist/types/reduceDictionaryContent/buildMask.d.ts +0 -5
  248. package/dist/types/reduceDictionaryContent/buildMask.d.ts.map +0 -1
  249. package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts.map +0 -1
  250. package/dist/types/transpiler/dictionary_to_main/generateDictionaryListContent.d.ts.map +0 -1
  251. package/dist/types/transpiler/dictionary_to_main/index.d.ts +0 -3
  252. package/dist/types/transpiler/dictionary_to_main/index.d.ts.map +0 -1
  253. package/dist/types/transpiler/dictionary_to_type/createModuleAugmentation.d.ts.map +0 -1
  254. package/dist/types/transpiler/dictionary_to_type/createType.d.ts.map +0 -1
  255. package/dist/types/transpiler/dictionary_to_type/index.d.ts.map +0 -1
  256. package/dist/types/transpiler/intlayer_dictionary/buildIntlayerDictionary.d.ts.map +0 -1
  257. package/dist/types/transpiler/intlayer_dictionary/index.d.ts.map +0 -1
  258. package/dist/types/transpiler/intlayer_dictionary/processContentDeclaration.d.ts.map +0 -1
  259. package/dist/types/transpiler/intlayer_dictionary/writeDynamicDictionary.d.ts.map +0 -1
  260. package/dist/types/transpiler/intlayer_dictionary/writeFetchDictionary.d.ts.map +0 -1
  261. package/dist/types/transpiler/intlayer_dictionary/writeMergedDictionary.d.ts.map +0 -1
  262. package/dist/types/transpiler/intlayer_dictionary/writeRemoteDictionary.d.ts.map +0 -1
  263. package/dist/types/transpiler/intlayer_dictionary/writeUnmergedDictionary.d.ts.map +0 -1
  264. /package/dist/cjs/{getBuiltDictionariesPath.cjs → createDictionaryEntryPoint/getBuiltDictionariesPath.cjs} +0 -0
  265. /package/dist/cjs/{getBuiltDynamicDictionariesPath.cjs → createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs} +0 -0
  266. /package/dist/cjs/{getBuiltFetchDictionariesPath.cjs → createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs} +0 -0
  267. /package/dist/cjs/{getBuiltRemoteDictionariesPath.cjs → createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs} +0 -0
  268. /package/dist/cjs/{getBuiltUnmergedDictionariesPath.cjs → createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs} +0 -0
  269. /package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/index.mjs +0 -0
  270. /package/dist/esm/{getBuiltDictionariesPath.mjs → createDictionaryEntryPoint/getBuiltDictionariesPath.mjs} +0 -0
  271. /package/dist/esm/{getBuiltDynamicDictionariesPath.mjs → createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs} +0 -0
  272. /package/dist/esm/{getBuiltFetchDictionariesPath.mjs → createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs} +0 -0
  273. /package/dist/esm/{getBuiltRemoteDictionariesPath.mjs → createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs} +0 -0
  274. /package/dist/esm/{getBuiltUnmergedDictionariesPath.mjs → createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs} +0 -0
  275. /package/dist/esm/{transpiler/dictionary_to_type → createType}/index.mjs +0 -0
  276. /package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/index.d.ts +0 -0
  277. /package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/processContentDeclaration.d.ts +0 -0
  278. /package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeDynamicDictionary.d.ts +0 -0
  279. /package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeFetchDictionary.d.ts +0 -0
  280. /package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeMergedDictionary.d.ts +0 -0
  281. /package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeRemoteDictionary.d.ts +0 -0
  282. /package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeUnmergedDictionary.d.ts +0 -0
  283. /package/dist/types/{transpiler/dictionary_to_main → createDictionaryEntryPoint}/createDictionaryEntryPoint.d.ts +0 -0
  284. /package/dist/types/{transpiler/dictionary_to_main → createDictionaryEntryPoint}/generateDictionaryListContent.d.ts +0 -0
  285. /package/dist/types/{getBuiltDictionariesPath.d.ts → createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts} +0 -0
  286. /package/dist/types/{getBuiltDynamicDictionariesPath.d.ts → createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts} +0 -0
  287. /package/dist/types/{getBuiltFetchDictionariesPath.d.ts → createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts} +0 -0
  288. /package/dist/types/{getBuiltRemoteDictionariesPath.d.ts → createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts} +0 -0
  289. /package/dist/types/{getBuiltUnmergedDictionariesPath.d.ts → createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts} +0 -0
  290. /package/dist/types/{transpiler/dictionary_to_type → createType}/createModuleAugmentation.d.ts +0 -0
  291. /package/dist/types/{transpiler/dictionary_to_type → createType}/createType.d.ts +0 -0
  292. /package/dist/types/{transpiler/dictionary_to_type → createType}/index.d.ts +0 -0
@@ -0,0 +1,35 @@
1
+ import { getAppLogger } from "@intlayer/config";
2
+ import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
3
+ import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
4
+ import { getBuiltDictionariesPath } from "./createDictionaryEntryPoint/getBuiltDictionariesPath.mjs";
5
+ import { createTypes } from "./createType/index.mjs";
6
+ import { loadLocalDictionaries } from "./loadDictionaries/loadLocalDictionaries.mjs";
7
+ import { formatPath } from "./utils/formatter.mjs";
8
+ const handleContentDeclarationFileChange = async (filePath, config) => {
9
+ const appLogger = getAppLogger(config);
10
+ appLogger(`Change detected: ${formatPath(filePath)}`, {
11
+ isVerbose: true
12
+ });
13
+ const localeDictionaries = await loadLocalDictionaries(filePath, config);
14
+ const dictionariesOutput = await buildDictionary(localeDictionaries, config);
15
+ const updatedDictionariesPaths = Object.values(
16
+ dictionariesOutput?.mergedDictionaries ?? {}
17
+ ).map((dictionary) => dictionary.dictionaryPath);
18
+ const allDictionariesPaths = getBuiltDictionariesPath(config);
19
+ createTypes(updatedDictionariesPaths);
20
+ appLogger("TypeScript types built", {
21
+ isVerbose: true
22
+ });
23
+ if (updatedDictionariesPaths.some(
24
+ (updatedDictionaryPath) => !allDictionariesPaths.includes(updatedDictionaryPath)
25
+ )) {
26
+ await createDictionaryEntryPoint(config);
27
+ appLogger("Dictionary list built", {
28
+ isVerbose: true
29
+ });
30
+ }
31
+ };
32
+ export {
33
+ handleContentDeclarationFileChange
34
+ };
35
+ //# sourceMappingURL=handleContentDeclarationFileChange.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/handleContentDeclarationFileChange.ts"],"sourcesContent":["import { type IntlayerConfig, getAppLogger } from '@intlayer/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { getBuiltDictionariesPath } from './createDictionaryEntryPoint/getBuiltDictionariesPath';\nimport { createTypes } from './createType';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileChange = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Change detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n const updatedDictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n const allDictionariesPaths: string[] = getBuiltDictionariesPath(config);\n\n createTypes(updatedDictionariesPaths);\n appLogger('TypeScript types built', {\n isVerbose: true,\n });\n\n if (\n updatedDictionariesPaths.some(\n (updatedDictionaryPath) =>\n !allDictionariesPaths.includes(updatedDictionaryPath)\n )\n ) {\n await createDictionaryEntryPoint(config);\n\n appLogger('Dictionary list built', {\n isVerbose: true,\n });\n }\n};\n"],"mappings":"AAAA,SAA8B,oBAAoB;AAClD,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C,SAAS,gCAAgC;AACzC,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,kBAAkB;AAEpB,MAAM,qCAAqC,OAChD,UACA,WACG;AACH,QAAM,YAAY,aAAa,MAAM;AAGrC,YAAU,oBAAoB,WAAW,QAAQ,CAAC,IAAI;AAAA,IACpD,WAAW;AAAA,EACb,CAAC;AAED,QAAM,qBAAqB,MAAM,sBAAsB,UAAU,MAAM;AAEvE,QAAM,qBAAqB,MAAM,gBAAgB,oBAAoB,MAAM;AAC3E,QAAM,2BAA2B,OAAO;AAAA,IACtC,oBAAoB,sBAAsB,CAAC;AAAA,EAC7C,EAAE,IAAI,CAAC,eAAe,WAAW,cAAc;AAE/C,QAAM,uBAAiC,yBAAyB,MAAM;AAEtE,cAAY,wBAAwB;AACpC,YAAU,0BAA0B;AAAA,IAClC,WAAW;AAAA,EACb,CAAC;AAED,MACE,yBAAyB;AAAA,IACvB,CAAC,0BACC,CAAC,qBAAqB,SAAS,qBAAqB;AAAA,EACxD,GACA;AACA,UAAM,2BAA2B,MAAM;AAEvC,cAAU,yBAAyB;AAAA,MACjC,WAAW;AAAA,IACb,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -0,0 +1,33 @@
1
+ import { getAppLogger } from "@intlayer/config";
2
+ import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
3
+ import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
4
+ import { createTypes } from "./createType/index.mjs";
5
+ import { createModuleAugmentation } from "./createType/createModuleAugmentation.mjs";
6
+ import { listDictionaries } from "./listDictionariesPath.mjs";
7
+ import { loadLocalDictionaries } from "./loadDictionaries/loadLocalDictionaries.mjs";
8
+ import { formatPath } from "./utils/formatter.mjs";
9
+ const handleUnlikedContentDeclarationFile = async (filePath, config) => {
10
+ const appLogger = getAppLogger(config);
11
+ appLogger(`Unlinked detected: ${formatPath(filePath)}`, {
12
+ isVerbose: true
13
+ });
14
+ const files = listDictionaries(config);
15
+ const localeDictionaries = await loadLocalDictionaries(files, config);
16
+ const dictionariesOutput = await buildDictionary(localeDictionaries, config);
17
+ const dictionariesPaths = Object.values(
18
+ dictionariesOutput?.mergedDictionaries ?? {}
19
+ ).map((dictionary) => dictionary.dictionaryPath);
20
+ await createTypes(dictionariesPaths);
21
+ await createDictionaryEntryPoint();
22
+ appLogger("Dictionaries rebuilt", {
23
+ isVerbose: true
24
+ });
25
+ await createModuleAugmentation();
26
+ appLogger("Module augmentation built", {
27
+ isVerbose: true
28
+ });
29
+ };
30
+ export {
31
+ handleUnlikedContentDeclarationFile
32
+ };
33
+ //# sourceMappingURL=handleUnlikedContentDeclarationFile.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/handleUnlikedContentDeclarationFile.ts"],"sourcesContent":["import { type IntlayerConfig, getAppLogger } from '@intlayer/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleUnlikedContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Unlinked detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const files: string[] = listDictionaries(config);\n\n const localeDictionaries = await loadLocalDictionaries(files, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths);\n\n await createDictionaryEntryPoint();\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await createModuleAugmentation();\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n};\n"],"mappings":"AAAA,SAA8B,oBAAoB;AAClD,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AACzC,SAAS,wBAAwB;AACjC,SAAS,6BAA6B;AACtC,SAAS,kBAAkB;AAEpB,MAAM,sCAAsC,OACjD,UACA,WACG;AACH,QAAM,YAAY,aAAa,MAAM;AAGrC,YAAU,sBAAsB,WAAW,QAAQ,CAAC,IAAI;AAAA,IACtD,WAAW;AAAA,EACb,CAAC;AAED,QAAM,QAAkB,iBAAiB,MAAM;AAE/C,QAAM,qBAAqB,MAAM,sBAAsB,OAAO,MAAM;AAEpE,QAAM,qBAAqB,MAAM,gBAAgB,oBAAoB,MAAM;AAE3E,QAAM,oBAAoB,OAAO;AAAA,IAC/B,oBAAoB,sBAAsB,CAAC;AAAA,EAC7C,EAAE,IAAI,CAAC,eAAe,WAAW,cAAc;AAE/C,QAAM,YAAY,iBAAiB;AAEnC,QAAM,2BAA2B;AAEjC,YAAU,wBAAwB;AAAA,IAChC,WAAW;AAAA,EACb,CAAC;AAED,QAAM,yBAAyB;AAE/B,YAAU,6BAA6B;AAAA,IACrC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
@@ -1,19 +1,29 @@
1
- import {
2
- buildAndWatchIntlayer,
3
- handleAdditionalContentDeclarationFile,
4
- handleContentDeclarationFileChange,
5
- watch
6
- } from "./chokidar/watcher.mjs";
1
+ import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
7
2
  import { cleanOutputDir } from "./cleanOutputDir.mjs";
3
+ import {
4
+ createDictionaryEntryPoint,
5
+ generateDictionaryListContent,
6
+ getBuiltDictionariesPath,
7
+ getBuiltDynamicDictionariesPath,
8
+ getBuiltFetchDictionariesPath,
9
+ getBuiltRemoteDictionariesPath,
10
+ getBuiltUnmergedDictionariesPath
11
+ } from "./createDictionaryEntryPoint/index.mjs";
12
+ import { createTypes } from "./createType/index.mjs";
13
+ import { createModuleAugmentation } from "./createType/createModuleAugmentation.mjs";
8
14
  import { fetchDistantDictionaries } from "./fetchDistantDictionaries.mjs";
9
- import { getBuiltDictionariesPath } from "./getBuiltDictionariesPath.mjs";
10
- import { getBuiltUnmergedDictionariesPath } from "./getBuiltUnmergedDictionariesPath.mjs";
15
+ import { isInvalidDictionary } from "./filterInvalidDictionaries.mjs";
16
+ import { getContentDeclarationFileTemplate } from "./getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs";
17
+ import { handleAdditionalContentDeclarationFile } from "./handleAdditionalContentDeclarationFile.mjs";
18
+ import { handleContentDeclarationFileChange } from "./handleContentDeclarationFileChange.mjs";
19
+ import { handleUnlikedContentDeclarationFile } from "./handleUnlikedContentDeclarationFile.mjs";
11
20
  import { listDictionaries } from "./listDictionariesPath.mjs";
12
21
  import {
13
22
  listGitFiles,
14
23
  listGitLines
15
24
  } from "./listGitFiles.mjs";
16
25
  import {
26
+ loadContentDeclarations,
17
27
  loadDictionaries,
18
28
  loadLocalDictionaries,
19
29
  loadRemoteDictionaries
@@ -23,12 +33,6 @@ import { prepareContentDeclaration } from "./prepareContentDeclaration.mjs";
23
33
  import { prepareIntlayer } from "./prepareIntlayer.mjs";
24
34
  import { processPerLocaleDictionary } from "./processPerLocaleDictionary.mjs";
25
35
  import { reduceDictionaryContent } from "./reduceDictionaryContent/reduceDictionaryContent.mjs";
26
- import {
27
- createDictionaryEntryPoint,
28
- generateDictionaryListContent
29
- } from "./transpiler/dictionary_to_main/index.mjs";
30
- import { createModuleAugmentation } from "./transpiler/dictionary_to_type/createModuleAugmentation.mjs";
31
- import { buildDictionary } from "./transpiler/intlayer_dictionary/buildIntlayerDictionary.mjs";
32
36
  import { extractErrorMessage } from "./utils/extractErrorMessage.mjs";
33
37
  import { formatLocale, formatPath } from "./utils/formatter.mjs";
34
38
  import { getExtension } from "./utils/getExtention.mjs";
@@ -37,7 +41,9 @@ import { kebabCaseToCamelCase } from "./utils/kebabCaseToCamelCase.mjs";
37
41
  import { parallelize } from "./utils/parallelize.mjs";
38
42
  import { resolveObjectPromises } from "./utils/resolveObjectPromises.mjs";
39
43
  import { runOnce } from "./utils/runOnce.mjs";
44
+ import { runParallel } from "./utils/runParallel.mjs";
40
45
  import { sortAlphabetically } from "./utils/sortAlphabetically.mjs";
46
+ import { buildAndWatchIntlayer, watch } from "./watcher.mjs";
41
47
  import {
42
48
  writeContentDeclaration
43
49
  } from "./writeContentDeclaration/index.mjs";
@@ -47,21 +53,29 @@ export {
47
53
  cleanOutputDir,
48
54
  createDictionaryEntryPoint,
49
55
  createModuleAugmentation,
56
+ createTypes,
50
57
  extractErrorMessage,
51
58
  fetchDistantDictionaries,
52
59
  formatLocale,
53
60
  formatPath,
54
61
  generateDictionaryListContent,
55
62
  getBuiltDictionariesPath,
63
+ getBuiltDynamicDictionariesPath,
64
+ getBuiltFetchDictionariesPath,
65
+ getBuiltRemoteDictionariesPath,
56
66
  getBuiltUnmergedDictionariesPath,
67
+ getContentDeclarationFileTemplate,
57
68
  getExtension,
58
69
  getFileHash,
59
70
  handleAdditionalContentDeclarationFile,
60
71
  handleContentDeclarationFileChange,
72
+ handleUnlikedContentDeclarationFile,
73
+ isInvalidDictionary,
61
74
  kebabCaseToCamelCase,
62
75
  listDictionaries,
63
76
  listGitFiles,
64
77
  listGitLines,
78
+ loadContentDeclarations,
65
79
  loadDictionaries,
66
80
  loadLocalDictionaries,
67
81
  loadRemoteDictionaries,
@@ -73,6 +87,7 @@ export {
73
87
  reduceDictionaryContent,
74
88
  resolveObjectPromises,
75
89
  runOnce,
90
+ runParallel,
76
91
  sortAlphabetically,
77
92
  watch,
78
93
  writeContentDeclaration
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export {\n buildAndWatchIntlayer,\n handleAdditionalContentDeclarationFile,\n handleContentDeclarationFileChange,\n watch,\n} from './chokidar/watcher';\nexport { cleanOutputDir } from './cleanOutputDir';\nexport { fetchDistantDictionaries } from './fetchDistantDictionaries';\nexport { getBuiltDictionariesPath } from './getBuiltDictionariesPath';\nexport { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';\nexport { listDictionaries } from './listDictionariesPath';\nexport {\n listGitFiles,\n listGitLines,\n type DiffMode,\n type ListGitFilesOptions,\n type ListGitLinesOptions,\n} from './listGitFiles';\nexport {\n loadDictionaries,\n loadLocalDictionaries,\n loadRemoteDictionaries,\n} from './loadDictionaries/index';\nexport { mergeDictionaries } from './mergeDictionaries';\nexport { prepareContentDeclaration } from './prepareContentDeclaration';\nexport { prepareIntlayer } from './prepareIntlayer';\nexport { processPerLocaleDictionary } from './processPerLocaleDictionary';\nexport { reduceDictionaryContent } from './reduceDictionaryContent/reduceDictionaryContent';\nexport {\n createDictionaryEntryPoint,\n generateDictionaryListContent,\n} from './transpiler/dictionary_to_main';\nexport { createModuleAugmentation } from './transpiler/dictionary_to_type/createModuleAugmentation';\nexport { buildDictionary } from './transpiler/intlayer_dictionary/buildIntlayerDictionary';\nexport { extractErrorMessage } from './utils/extractErrorMessage';\nexport { formatLocale, formatPath } from './utils/formatter';\nexport { getExtension } from './utils/getExtention';\nexport { getFileHash } from './utils/getFileHash';\nexport { kebabCaseToCamelCase } from './utils/kebabCaseToCamelCase';\nexport { parallelize } from './utils/parallelize';\nexport { resolveObjectPromises } from './utils/resolveObjectPromises';\nexport { runOnce } from './utils/runOnce';\nexport { sortAlphabetically } from './utils/sortAlphabetically';\nexport {\n writeContentDeclaration,\n type DictionaryStatus,\n} from './writeContentDeclaration';\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,gCAAgC;AACzC,SAAS,gCAAgC;AACzC,SAAS,wCAAwC;AACjD,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAClC,SAAS,iCAAiC;AAC1C,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C,SAAS,+BAA+B;AACxC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AACzC,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,SAAS,cAAc,kBAAkB;AACzC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,eAAe;AACxB,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,OAEK;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nexport { cleanOutputDir } from './cleanOutputDir';\nexport {\n createDictionaryEntryPoint,\n generateDictionaryListContent,\n getBuiltDictionariesPath,\n getBuiltDynamicDictionariesPath,\n getBuiltFetchDictionariesPath,\n getBuiltRemoteDictionariesPath,\n getBuiltUnmergedDictionariesPath,\n} from './createDictionaryEntryPoint';\nexport { createTypes } from './createType';\nexport { createModuleAugmentation } from './createType/createModuleAugmentation';\nexport { fetchDistantDictionaries } from './fetchDistantDictionaries';\nexport { isInvalidDictionary } from './filterInvalidDictionaries';\nexport { getContentDeclarationFileTemplate } from './getContentDeclarationFileTemplate/getContentDeclarationFileTemplate';\nexport { handleAdditionalContentDeclarationFile } from './handleAdditionalContentDeclarationFile';\nexport { handleContentDeclarationFileChange } from './handleContentDeclarationFileChange';\nexport { handleUnlikedContentDeclarationFile } from './handleUnlikedContentDeclarationFile';\nexport { listDictionaries } from './listDictionariesPath';\nexport {\n listGitFiles,\n listGitLines,\n type DiffMode,\n type ListGitFilesOptions,\n type ListGitLinesOptions,\n} from './listGitFiles';\nexport {\n loadContentDeclarations,\n loadDictionaries,\n loadLocalDictionaries,\n loadRemoteDictionaries,\n} from './loadDictionaries';\nexport { mergeDictionaries } from './mergeDictionaries';\nexport { prepareContentDeclaration } from './prepareContentDeclaration';\nexport { prepareIntlayer } from './prepareIntlayer';\nexport { processPerLocaleDictionary } from './processPerLocaleDictionary';\nexport { reduceDictionaryContent } from './reduceDictionaryContent/reduceDictionaryContent';\nexport { extractErrorMessage } from './utils/extractErrorMessage';\nexport { formatLocale, formatPath } from './utils/formatter';\nexport { getExtension } from './utils/getExtention';\nexport { getFileHash } from './utils/getFileHash';\nexport { kebabCaseToCamelCase } from './utils/kebabCaseToCamelCase';\nexport { parallelize } from './utils/parallelize';\nexport { resolveObjectPromises } from './utils/resolveObjectPromises';\nexport { runOnce } from './utils/runOnce';\nexport { runParallel, type ParallelHandle } from './utils/runParallel';\nexport { sortAlphabetically } from './utils/sortAlphabetically';\nexport { buildAndWatchIntlayer, watch } from './watcher';\nexport {\n writeContentDeclaration,\n type DictionaryStatus,\n} from './writeContentDeclaration';\n"],"mappings":"AAAA,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AACzC,SAAS,gCAAgC;AACzC,SAAS,2BAA2B;AACpC,SAAS,yCAAyC;AAClD,SAAS,8CAA8C;AACvD,SAAS,0CAA0C;AACnD,SAAS,2CAA2C;AACpD,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAClC,SAAS,iCAAiC;AAC1C,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C,SAAS,+BAA+B;AACxC,SAAS,2BAA2B;AACpC,SAAS,cAAc,kBAAkB;AACzC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,eAAe;AACxB,SAAS,mBAAwC;AACjD,SAAS,0BAA0B;AACnC,SAAS,uBAAuB,aAAa;AAC7C;AAAA,EACE;AAAA,OAEK;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/listDictionariesPath.ts"],"sourcesContent":["import { type IntlayerConfig, getConfiguration } from '@intlayer/config';\nimport fg from 'fast-glob';\n\nexport const listDictionaries = (\n configuration: IntlayerConfig = getConfiguration()\n): string[] => {\n const files: string[] = fg.sync(\n configuration.content.watchedFilesPatternWithPath,\n {\n ignore: [\n '**/node_modules/**',\n '**/.git/**',\n '**/.github/**',\n '**/.next/**',\n '**/.expo/**',\n '**/.expo-shared/**',\n '**/.vercel/**',\n '**/.cache/**',\n '**/dist/**',\n '**/build/**',\n '**/.intlayer/**',\n ],\n }\n );\n\n return files;\n};\n"],"mappings":"AAAA,SAA8B,wBAAwB;AACtD,OAAO,QAAQ;AAER,MAAM,mBAAmB,CAC9B,gBAAgC,iBAAiB,MACpC;AACb,QAAM,QAAkB,GAAG;AAAA,IACzB,cAAc,QAAQ;AAAA,IACtB;AAAA,MACE,QAAQ;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/listDictionariesPath.ts"],"sourcesContent":["import { type IntlayerConfig, getConfiguration } from '@intlayer/config';\nimport fg from 'fast-glob';\n\n/**\n * List all dictionaries absolute paths in the project\n * @param configuration - The configuration object\n * @returns An array of dictionary paths\n */\nexport const listDictionaries = (\n configuration: IntlayerConfig = getConfiguration()\n): string[] => {\n const files: string[] = fg.sync(\n configuration.content.watchedFilesPatternWithPath,\n {\n ignore: [\n '**/node_modules/**',\n '**/.git/**',\n '**/.github/**',\n '**/.next/**',\n '**/.expo/**',\n '**/.expo-shared/**',\n '**/.vercel/**',\n '**/.cache/**',\n '**/dist/**',\n '**/build/**',\n '**/.intlayer/**',\n ],\n }\n );\n\n return files;\n};\n"],"mappings":"AAAA,SAA8B,wBAAwB;AACtD,OAAO,QAAQ;AAOR,MAAM,mBAAmB,CAC9B,gBAAgC,iBAAiB,MACpC;AACb,QAAM,QAAkB,GAAG;AAAA,IACzB,cAAc,QAAQ;AAAA,IACtB;AAAA,MACE,QAAQ;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -4,10 +4,13 @@ import {
4
4
  loadExternalFile
5
5
  } from "@intlayer/config";
6
6
  import { relative } from "path";
7
- import { filterInvalidDictionaries } from "../filterInvalidDictionaries.mjs";
8
- import { processContentDeclaration } from "../transpiler/intlayer_dictionary/processContentDeclaration.mjs";
7
+ import { processContentDeclaration } from "../buildIntlayerDictionary/processContentDeclaration.mjs";
8
+ import {
9
+ filterInvalidDictionaries,
10
+ isInvalidDictionary
11
+ } from "../filterInvalidDictionaries.mjs";
9
12
  import { parallelize } from "../utils/parallelize.mjs";
10
- const formatLocalDictionaries = (dictionariesRecord) => Object.entries(dictionariesRecord).map(([relativePath, dict]) => ({
13
+ const formatLocalDictionaries = (dictionariesRecord, configuration) => Object.entries(dictionariesRecord).filter(([_relativePath, dict]) => isInvalidDictionary(dict, configuration)).map(([relativePath, dict]) => ({
11
14
  ...dict,
12
15
  localId: `${dict.key}::local::${relativePath}`,
13
16
  location: "locale",
@@ -24,7 +27,10 @@ const loadContentDeclarations = async (contentDeclarationFilePath, configuration
24
27
  },
25
28
  {}
26
29
  );
27
- const contentDeclarations = formatLocalDictionaries(dictionariesRecord);
30
+ const contentDeclarations = formatLocalDictionaries(
31
+ dictionariesRecord,
32
+ configuration
33
+ );
28
34
  const listFoundDictionaries = contentDeclarations.map((declaration) => ({
29
35
  dictionaryKey: declaration.key,
30
36
  type: "local",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/loadDictionaries/loadContentDeclaration.ts"],"sourcesContent":["import {\n ESMxCJSRequire,\n getConfiguration,\n IntlayerConfig,\n loadExternalFile,\n} from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { relative } from 'path';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { processContentDeclaration } from '../transpiler/intlayer_dictionary/processContentDeclaration';\nimport { parallelize } from '../utils/parallelize';\nimport { DictionariesStatus } from './loadDictionaries';\n\nexport const formatLocalDictionaries = (\n dictionariesRecord: Record<string, Dictionary>\n): Dictionary[] =>\n Object.entries(dictionariesRecord).map(([relativePath, dict]) => ({\n ...dict,\n localId: `${dict.key}::local::${relativePath}`,\n location: 'locale' as const,\n filePath: relativePath,\n }));\n\nexport const loadContentDeclarations = async (\n contentDeclarationFilePath: string[],\n configuration: IntlayerConfig = getConfiguration(),\n projectRequire = ESMxCJSRequire,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<Dictionary[]> => {\n const dictionariesRecord = contentDeclarationFilePath.reduce(\n (acc, path) => {\n const relativePath = relative(configuration.content.baseDir, path);\n return {\n ...acc,\n [relativePath]: loadExternalFile(path, undefined, projectRequire),\n };\n },\n {} as Record<string, Dictionary>\n );\n const contentDeclarations: Dictionary[] =\n formatLocalDictionaries(dictionariesRecord);\n\n const listFoundDictionaries = contentDeclarations.map((declaration) => ({\n dictionaryKey: declaration.key,\n type: 'local' as const,\n status: 'found' as const,\n }));\n\n onStatusUpdate?.(listFoundDictionaries);\n\n const processedDictionaries = await parallelize(\n contentDeclarations,\n async (contentDeclaration): Promise<Dictionary | undefined> => {\n if (!contentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: contentDeclaration.key,\n type: 'local',\n status: 'building',\n },\n ]);\n\n const processedContentDeclaration = await processContentDeclaration(\n contentDeclaration as Dictionary\n );\n\n if (!processedContentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: processedContentDeclaration.key,\n type: 'local',\n status: 'built',\n },\n ]);\n\n return processedContentDeclaration;\n }\n );\n\n return filterInvalidDictionaries(processedDictionaries);\n};\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAEP,SAAS,gBAAgB;AACzB,SAAS,iCAAiC;AAC1C,SAAS,iCAAiC;AAC1C,SAAS,mBAAmB;AAGrB,MAAM,0BAA0B,CACrC,uBAEA,OAAO,QAAQ,kBAAkB,EAAE,IAAI,CAAC,CAAC,cAAc,IAAI,OAAO;AAAA,EAChE,GAAG;AAAA,EACH,SAAS,GAAG,KAAK,GAAG,YAAY,YAAY;AAAA,EAC5C,UAAU;AAAA,EACV,UAAU;AACZ,EAAE;AAEG,MAAM,0BAA0B,OACrC,4BACA,gBAAgC,iBAAiB,GACjD,iBAAiB,gBACjB,mBAC0B;AAC1B,QAAM,qBAAqB,2BAA2B;AAAA,IACpD,CAAC,KAAK,SAAS;AACb,YAAM,eAAe,SAAS,cAAc,QAAQ,SAAS,IAAI;AACjE,aAAO;AAAA,QACL,GAAG;AAAA,QACH,CAAC,YAAY,GAAG,iBAAiB,MAAM,QAAW,cAAc;AAAA,MAClE;AAAA,IACF;AAAA,IACA,CAAC;AAAA,EACH;AACA,QAAM,sBACJ,wBAAwB,kBAAkB;AAE5C,QAAM,wBAAwB,oBAAoB,IAAI,CAAC,iBAAiB;AAAA,IACtE,eAAe,YAAY;AAAA,IAC3B,MAAM;AAAA,IACN,QAAQ;AAAA,EACV,EAAE;AAEF,mBAAiB,qBAAqB;AAEtC,QAAM,wBAAwB,MAAM;AAAA,IAClC;AAAA,IACA,OAAO,uBAAwD;AAC7D,UAAI,CAAC,oBAAoB;AACvB,eAAO;AAAA,MACT;AAEA,uBAAiB;AAAA,QACf;AAAA,UACE,eAAe,mBAAmB;AAAA,UAClC,MAAM;AAAA,UACN,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AAED,YAAM,8BAA8B,MAAM;AAAA,QACxC;AAAA,MACF;AAEA,UAAI,CAAC,6BAA6B;AAChC,eAAO;AAAA,MACT;AAEA,uBAAiB;AAAA,QACf;AAAA,UACE,eAAe,4BAA4B;AAAA,UAC3C,MAAM;AAAA,UACN,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AAED,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO,0BAA0B,qBAAqB;AACxD;","names":[]}
1
+ {"version":3,"sources":["../../../src/loadDictionaries/loadContentDeclaration.ts"],"sourcesContent":["import {\n ESMxCJSRequire,\n getConfiguration,\n IntlayerConfig,\n loadExternalFile,\n} from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { relative } from 'path';\nimport { processContentDeclaration } from '../buildIntlayerDictionary/processContentDeclaration';\nimport {\n filterInvalidDictionaries,\n isInvalidDictionary,\n} from '../filterInvalidDictionaries';\nimport { parallelize } from '../utils/parallelize';\nimport { DictionariesStatus } from './loadDictionaries';\n\nexport const formatLocalDictionaries = (\n dictionariesRecord: Record<string, Dictionary>,\n configuration?: IntlayerConfig\n): Dictionary[] =>\n Object.entries(dictionariesRecord)\n .filter(([_relativePath, dict]) => isInvalidDictionary(dict, configuration))\n .map(([relativePath, dict]) => ({\n ...dict,\n localId: `${dict.key}::local::${relativePath}`,\n location: 'locale' as const,\n filePath: relativePath,\n }));\n\nexport const loadContentDeclarations = async (\n contentDeclarationFilePath: string[],\n configuration: IntlayerConfig = getConfiguration(),\n projectRequire = ESMxCJSRequire,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<Dictionary[]> => {\n const dictionariesRecord = contentDeclarationFilePath.reduce(\n (acc, path) => {\n const relativePath = relative(configuration.content.baseDir, path);\n return {\n ...acc,\n [relativePath]: loadExternalFile(path, undefined, projectRequire),\n };\n },\n {} as Record<string, Dictionary>\n );\n const contentDeclarations: Dictionary[] = formatLocalDictionaries(\n dictionariesRecord,\n configuration\n );\n\n const listFoundDictionaries = contentDeclarations.map((declaration) => ({\n dictionaryKey: declaration.key,\n type: 'local' as const,\n status: 'found' as const,\n }));\n\n onStatusUpdate?.(listFoundDictionaries);\n\n const processedDictionaries = await parallelize(\n contentDeclarations,\n async (contentDeclaration): Promise<Dictionary | undefined> => {\n if (!contentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: contentDeclaration.key,\n type: 'local',\n status: 'building',\n },\n ]);\n\n const processedContentDeclaration = await processContentDeclaration(\n contentDeclaration as Dictionary\n );\n\n if (!processedContentDeclaration) {\n return undefined;\n }\n\n onStatusUpdate?.([\n {\n dictionaryKey: processedContentDeclaration.key,\n type: 'local',\n status: 'built',\n },\n ]);\n\n return processedContentDeclaration;\n }\n );\n\n return filterInvalidDictionaries(processedDictionaries);\n};\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAEP,SAAS,gBAAgB;AACzB,SAAS,iCAAiC;AAC1C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAGrB,MAAM,0BAA0B,CACrC,oBACA,kBAEA,OAAO,QAAQ,kBAAkB,EAC9B,OAAO,CAAC,CAAC,eAAe,IAAI,MAAM,oBAAoB,MAAM,aAAa,CAAC,EAC1E,IAAI,CAAC,CAAC,cAAc,IAAI,OAAO;AAAA,EAC9B,GAAG;AAAA,EACH,SAAS,GAAG,KAAK,GAAG,YAAY,YAAY;AAAA,EAC5C,UAAU;AAAA,EACV,UAAU;AACZ,EAAE;AAEC,MAAM,0BAA0B,OACrC,4BACA,gBAAgC,iBAAiB,GACjD,iBAAiB,gBACjB,mBAC0B;AAC1B,QAAM,qBAAqB,2BAA2B;AAAA,IACpD,CAAC,KAAK,SAAS;AACb,YAAM,eAAe,SAAS,cAAc,QAAQ,SAAS,IAAI;AACjE,aAAO;AAAA,QACL,GAAG;AAAA,QACH,CAAC,YAAY,GAAG,iBAAiB,MAAM,QAAW,cAAc;AAAA,MAClE;AAAA,IACF;AAAA,IACA,CAAC;AAAA,EACH;AACA,QAAM,sBAAoC;AAAA,IACxC;AAAA,IACA;AAAA,EACF;AAEA,QAAM,wBAAwB,oBAAoB,IAAI,CAAC,iBAAiB;AAAA,IACtE,eAAe,YAAY;AAAA,IAC3B,MAAM;AAAA,IACN,QAAQ;AAAA,EACV,EAAE;AAEF,mBAAiB,qBAAqB;AAEtC,QAAM,wBAAwB,MAAM;AAAA,IAClC;AAAA,IACA,OAAO,uBAAwD;AAC7D,UAAI,CAAC,oBAAoB;AACvB,eAAO;AAAA,MACT;AAEA,uBAAiB;AAAA,QACf;AAAA,UACE,eAAe,mBAAmB;AAAA,UAClC,MAAM;AAAA,UACN,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AAED,YAAM,8BAA8B,MAAM;AAAA,QACxC;AAAA,MACF;AAEA,UAAI,CAAC,6BAA6B;AAChC,eAAO;AAAA,MACT;AAEA,uBAAiB;AAAA,QACf;AAAA,UACE,eAAe,4BAA4B;AAAA,UAC3C,MAAM;AAAA,UACN,QAAQ;AAAA,QACV;AAAA,MACF,CAAC;AAED,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO,0BAA0B,qBAAqB;AACxD;","names":[]}
@@ -1,9 +1,12 @@
1
+ import {
2
+ ESMxCJSRequire,
3
+ getConfiguration
4
+ } from "@intlayer/config";
1
5
  import { mkdir } from "fs/promises";
2
- import { resolve, relative } from "path";
3
- import { getConfiguration } from "@intlayer/config";
6
+ import { relative, resolve } from "path";
4
7
  import { loadContentDeclarations } from "./loadContentDeclaration.mjs";
5
- const loadLocalDictionaries = async (contentDeclarationsPaths) => {
6
- const { content } = getConfiguration();
8
+ const loadLocalDictionaries = async (contentDeclarationsPaths, configuration = getConfiguration(), projectRequire = ESMxCJSRequire) => {
9
+ const { content } = configuration;
7
10
  const { dictionariesDir, baseDir } = content;
8
11
  if (typeof contentDeclarationsPaths === "string") {
9
12
  contentDeclarationsPaths = [contentDeclarationsPaths];
@@ -11,7 +14,11 @@ const loadLocalDictionaries = async (contentDeclarationsPaths) => {
11
14
  await mkdir(resolve(dictionariesDir), { recursive: true });
12
15
  const result = [];
13
16
  for await (const contentDeclarationPath of contentDeclarationsPaths) {
14
- const dictionary = await loadContentDeclarations([contentDeclarationPath]);
17
+ const dictionary = await loadContentDeclarations(
18
+ [contentDeclarationPath],
19
+ configuration,
20
+ projectRequire
21
+ );
15
22
  const relativeFilePath = relative(baseDir, contentDeclarationPath);
16
23
  const dictionaryWithPath = {
17
24
  ...dictionary[0],
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/loadDictionaries/loadLocalDictionaries.ts"],"sourcesContent":["import { mkdir } from 'fs/promises';\nimport { resolve, relative } from 'path';\nimport { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { loadContentDeclarations } from './loadContentDeclaration';\n\nexport const loadLocalDictionaries = async (\n contentDeclarationsPaths: string[] | string\n): Promise<Dictionary[]> => {\n const { content } = getConfiguration();\n const { dictionariesDir, baseDir } = content;\n\n if (typeof contentDeclarationsPaths === 'string') {\n contentDeclarationsPaths = [contentDeclarationsPaths];\n }\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(dictionariesDir), { recursive: true });\n\n const result: Dictionary[] = [];\n\n for await (const contentDeclarationPath of contentDeclarationsPaths) {\n const dictionary = await loadContentDeclarations([contentDeclarationPath]);\n\n const relativeFilePath = relative(baseDir, contentDeclarationPath);\n\n const dictionaryWithPath: Dictionary = {\n ...dictionary[0],\n filePath: relativeFilePath,\n };\n\n result.push(dictionaryWithPath);\n }\n\n return result;\n};\n"],"mappings":"AAAA,SAAS,aAAa;AACtB,SAAS,SAAS,gBAAgB;AAClC,SAAS,wBAAwB;AAEjC,SAAS,+BAA+B;AAEjC,MAAM,wBAAwB,OACnC,6BAC0B;AAC1B,QAAM,EAAE,QAAQ,IAAI,iBAAiB;AACrC,QAAM,EAAE,iBAAiB,QAAQ,IAAI;AAErC,MAAI,OAAO,6BAA6B,UAAU;AAChD,+BAA2B,CAAC,wBAAwB;AAAA,EACtD;AAGA,QAAM,MAAM,QAAQ,eAAe,GAAG,EAAE,WAAW,KAAK,CAAC;AAEzD,QAAM,SAAuB,CAAC;AAE9B,mBAAiB,0BAA0B,0BAA0B;AACnE,UAAM,aAAa,MAAM,wBAAwB,CAAC,sBAAsB,CAAC;AAEzE,UAAM,mBAAmB,SAAS,SAAS,sBAAsB;AAEjE,UAAM,qBAAiC;AAAA,MACrC,GAAG,WAAW,CAAC;AAAA,MACf,UAAU;AAAA,IACZ;AAEA,WAAO,KAAK,kBAAkB;AAAA,EAChC;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../src/loadDictionaries/loadLocalDictionaries.ts"],"sourcesContent":["import {\n ESMxCJSRequire,\n getConfiguration,\n type IntlayerConfig,\n} from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { mkdir } from 'fs/promises';\nimport { relative, resolve } from 'path';\nimport { loadContentDeclarations } from './loadContentDeclaration';\n\nexport const loadLocalDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig = getConfiguration(),\n projectRequire = ESMxCJSRequire\n): Promise<Dictionary[]> => {\n const { content } = configuration;\n const { dictionariesDir, baseDir } = content;\n\n if (typeof contentDeclarationsPaths === 'string') {\n contentDeclarationsPaths = [contentDeclarationsPaths];\n }\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(dictionariesDir), { recursive: true });\n\n const result: Dictionary[] = [];\n\n for await (const contentDeclarationPath of contentDeclarationsPaths) {\n const dictionary = await loadContentDeclarations(\n [contentDeclarationPath],\n configuration,\n projectRequire\n );\n\n const relativeFilePath = relative(baseDir, contentDeclarationPath);\n\n const dictionaryWithPath: Dictionary = {\n ...dictionary[0],\n filePath: relativeFilePath,\n };\n\n result.push(dictionaryWithPath);\n }\n\n return result;\n};\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,aAAa;AACtB,SAAS,UAAU,eAAe;AAClC,SAAS,+BAA+B;AAEjC,MAAM,wBAAwB,OACnC,0BACA,gBAAgC,iBAAiB,GACjD,iBAAiB,mBACS;AAC1B,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,EAAE,iBAAiB,QAAQ,IAAI;AAErC,MAAI,OAAO,6BAA6B,UAAU;AAChD,+BAA2B,CAAC,wBAAwB;AAAA,EACtD;AAGA,QAAM,MAAM,QAAQ,eAAe,GAAG,EAAE,WAAW,KAAK,CAAC;AAEzD,QAAM,SAAuB,CAAC;AAE9B,mBAAiB,0BAA0B,0BAA0B;AACnE,UAAM,aAAa,MAAM;AAAA,MACvB,CAAC,sBAAsB;AAAA,MACvB;AAAA,MACA;AAAA,IACF;AAEA,UAAM,mBAAmB,SAAS,SAAS,sBAAsB;AAEjE,UAAM,qBAAiC;AAAA,MACrC,GAAG,WAAW,CAAC;AAAA,MACf,UAAU;AAAA,IACZ;AAEA,WAAO,KAAK,kBAAkB;AAAA,EAChC;AAEA,SAAO;AACT;","names":[]}
@@ -6,18 +6,15 @@ import {
6
6
  getConfiguration
7
7
  } from "@intlayer/config";
8
8
  import packageJson from "@intlayer/config/package.json" with { type: "json" };
9
+ import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
10
+ import { writeRemoteDictionary } from "./buildIntlayerDictionary/writeRemoteDictionary.mjs";
9
11
  import { cleanOutputDir } from "./cleanOutputDir.mjs";
12
+ import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
13
+ import { createModuleAugmentation, createTypes } from "./createType/index.mjs";
10
14
  import { listDictionaries } from "./listDictionariesPath.mjs";
11
15
  import { loadDictionaries } from "./loadDictionaries/loadDictionaries.mjs";
12
- import { createDictionaryEntryPoint } from "./transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs";
13
- import {
14
- createModuleAugmentation,
15
- createTypes
16
- } from "./transpiler/dictionary_to_type/index.mjs";
17
- import { buildDictionary } from "./transpiler/intlayer_dictionary/buildIntlayerDictionary.mjs";
18
- import { writeRemoteDictionary } from "./transpiler/intlayer_dictionary/writeRemoteDictionary.mjs";
19
16
  import { writeConfiguration } from "./writeConfiguration/index.mjs";
20
- const prepareIntlayer = async (configuration = getConfiguration(), projectRequire = ESMxCJSRequire, clean = false) => {
17
+ const prepareIntlayer = async (configuration = getConfiguration(), projectRequire = ESMxCJSRequire, clean = false, format = ["cjs", "esm"]) => {
21
18
  const appLogger = getAppLogger(configuration);
22
19
  const preparationStartMs = Date.now();
23
20
  appLogger([
@@ -50,7 +47,9 @@ const prepareIntlayer = async (configuration = getConfiguration(), projectRequir
50
47
  );
51
48
  const dictionariesOutput = await buildDictionary(
52
49
  [...dictionaries.localDictionaries, ...dictionaries.remoteDictionaries],
53
- configuration
50
+ configuration,
51
+ format,
52
+ false
54
53
  );
55
54
  await writeRemoteDictionary(dictionaries.remoteDictionaries, configuration);
56
55
  const dictionariesPaths = Object.values(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/prepareIntlayer.ts"],"sourcesContent":["import {\n ANSIColors,\n ESMxCJSRequire,\n type IntlayerConfig,\n colorize,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport packageJson from '@intlayer/config/package.json' with { type: 'json' };\nimport { cleanOutputDir } from './cleanOutputDir';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadDictionaries } from './loadDictionaries/loadDictionaries';\nimport { createDictionaryEntryPoint } from './transpiler/dictionary_to_main/createDictionaryEntryPoint';\nimport {\n createModuleAugmentation,\n createTypes,\n} from './transpiler/dictionary_to_type/index';\nimport { buildDictionary } from './transpiler/intlayer_dictionary/buildIntlayerDictionary';\nimport { writeRemoteDictionary } from './transpiler/intlayer_dictionary/writeRemoteDictionary';\nimport { writeConfiguration } from './writeConfiguration';\n\nexport const prepareIntlayer = async (\n configuration: IntlayerConfig = getConfiguration(),\n projectRequire = ESMxCJSRequire,\n clean = false\n) => {\n const appLogger = getAppLogger(configuration);\n const preparationStartMs = Date.now();\n\n appLogger([\n 'Preparing Intlayer',\n colorize(`(v${packageJson.version})`, ANSIColors.GREY_DARK),\n ]);\n\n if (clean) {\n cleanOutputDir(configuration);\n }\n\n const files: string[] = listDictionaries(configuration);\n\n const dictionaries = await loadDictionaries(\n files,\n configuration,\n projectRequire\n );\n\n const dictionariesLoadedTime = Date.now();\n\n appLogger(\n [\n 'Content loaded',\n colorize(\n [\n dictionaries.remoteDictionaries.length > 0\n ? ` (Total: ${dictionariesLoadedTime - preparationStartMs}ms - Local: ${dictionaries.time.localDictionaries}ms - Remote: ${dictionaries.time.remoteDictionaries}ms)`\n : `(${dictionariesLoadedTime - preparationStartMs}ms)`,\n ].join(''),\n ANSIColors.GREY_DARK\n ),\n ],\n {\n isVerbose: true,\n }\n );\n\n // Build local dictionaries\n const dictionariesOutput = await buildDictionary(\n [...dictionaries.localDictionaries, ...dictionaries.remoteDictionaries],\n configuration\n );\n\n // Write remote dictionaries\n // Used as cache for next fetch\n await writeRemoteDictionary(dictionaries.remoteDictionaries, configuration);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths);\n\n await createDictionaryEntryPoint(configuration);\n\n const dictionariesBuiltTime = Date.now();\n\n appLogger([\n 'Dictionaries built',\n colorize(\n `(${dictionariesBuiltTime - preparationStartMs}ms)`,\n ANSIColors.GREY_DARK\n ),\n ]);\n\n await createModuleAugmentation(configuration);\n\n const moduleAugmentationBuiltTime = Date.now();\n\n appLogger(\n [\n 'Module augmentation built',\n colorize(\n `(${moduleAugmentationBuiltTime - dictionariesBuiltTime}ms)`,\n ANSIColors.GREY_DARK\n ),\n ],\n {\n isVerbose: true,\n }\n );\n\n await writeConfiguration(configuration);\n\n const configurationWrittenTime = Date.now();\n\n appLogger(\n [\n 'Configuration written',\n colorize(\n `(${configurationWrittenTime - preparationStartMs}ms)`,\n ANSIColors.GREY_DARK\n ),\n ],\n {\n isVerbose: true,\n }\n );\n\n const preparationElapsedMs = Date.now() - preparationStartMs;\n appLogger([`Done`, colorize(`${preparationElapsedMs}ms`, ANSIColors.GREEN)], {\n level: 'info',\n isVerbose: true,\n });\n};\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,iBAAiB,gCAAgC,KAAK,EAAE,MAAM,OAAO;AAC5E,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,0BAA0B;AAE5B,MAAM,kBAAkB,OAC7B,gBAAgC,iBAAiB,GACjD,iBAAiB,gBACjB,QAAQ,UACL;AACH,QAAM,YAAY,aAAa,aAAa;AAC5C,QAAM,qBAAqB,KAAK,IAAI;AAEpC,YAAU;AAAA,IACR;AAAA,IACA,SAAS,KAAK,YAAY,OAAO,KAAK,WAAW,SAAS;AAAA,EAC5D,CAAC;AAED,MAAI,OAAO;AACT,mBAAe,aAAa;AAAA,EAC9B;AAEA,QAAM,QAAkB,iBAAiB,aAAa;AAEtD,QAAM,eAAe,MAAM;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,yBAAyB,KAAK,IAAI;AAExC;AAAA,IACE;AAAA,MACE;AAAA,MACA;AAAA,QACE;AAAA,UACE,aAAa,mBAAmB,SAAS,IACrC,YAAY,yBAAyB,kBAAkB,eAAe,aAAa,KAAK,iBAAiB,gBAAgB,aAAa,KAAK,kBAAkB,QAC7J,IAAI,yBAAyB,kBAAkB;AAAA,QACrD,EAAE,KAAK,EAAE;AAAA,QACT,WAAW;AAAA,MACb;AAAA,IACF;AAAA,IACA;AAAA,MACE,WAAW;AAAA,IACb;AAAA,EACF;AAGA,QAAM,qBAAqB,MAAM;AAAA,IAC/B,CAAC,GAAG,aAAa,mBAAmB,GAAG,aAAa,kBAAkB;AAAA,IACtE;AAAA,EACF;AAIA,QAAM,sBAAsB,aAAa,oBAAoB,aAAa;AAE1E,QAAM,oBAAoB,OAAO;AAAA,IAC/B,oBAAoB,sBAAsB,CAAC;AAAA,EAC7C,EAAE,IAAI,CAAC,eAAe,WAAW,cAAc;AAE/C,QAAM,YAAY,iBAAiB;AAEnC,QAAM,2BAA2B,aAAa;AAE9C,QAAM,wBAAwB,KAAK,IAAI;AAEvC,YAAU;AAAA,IACR;AAAA,IACA;AAAA,MACE,IAAI,wBAAwB,kBAAkB;AAAA,MAC9C,WAAW;AAAA,IACb;AAAA,EACF,CAAC;AAED,QAAM,yBAAyB,aAAa;AAE5C,QAAM,8BAA8B,KAAK,IAAI;AAE7C;AAAA,IACE;AAAA,MACE;AAAA,MACA;AAAA,QACE,IAAI,8BAA8B,qBAAqB;AAAA,QACvD,WAAW;AAAA,MACb;AAAA,IACF;AAAA,IACA;AAAA,MACE,WAAW;AAAA,IACb;AAAA,EACF;AAEA,QAAM,mBAAmB,aAAa;AAEtC,QAAM,2BAA2B,KAAK,IAAI;AAE1C;AAAA,IACE;AAAA,MACE;AAAA,MACA;AAAA,QACE,IAAI,2BAA2B,kBAAkB;AAAA,QACjD,WAAW;AAAA,MACb;AAAA,IACF;AAAA,IACA;AAAA,MACE,WAAW;AAAA,IACb;AAAA,EACF;AAEA,QAAM,uBAAuB,KAAK,IAAI,IAAI;AAC1C,YAAU,CAAC,QAAQ,SAAS,GAAG,oBAAoB,MAAM,WAAW,KAAK,CAAC,GAAG;AAAA,IAC3E,OAAO;AAAA,IACP,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../src/prepareIntlayer.ts"],"sourcesContent":["import {\n ANSIColors,\n ESMxCJSRequire,\n type IntlayerConfig,\n colorize,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport packageJson from '@intlayer/config/package.json' with { type: 'json' };\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { writeRemoteDictionary } from './buildIntlayerDictionary/writeRemoteDictionary';\nimport { cleanOutputDir } from './cleanOutputDir';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createModuleAugmentation, createTypes } from './createType/index';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadDictionaries } from './loadDictionaries/loadDictionaries';\nimport { writeConfiguration } from './writeConfiguration';\n\nexport const prepareIntlayer = async (\n configuration: IntlayerConfig = getConfiguration(),\n projectRequire = ESMxCJSRequire,\n clean = false,\n format: ('cjs' | 'esm')[] = ['cjs', 'esm']\n) => {\n const appLogger = getAppLogger(configuration);\n const preparationStartMs = Date.now();\n\n appLogger([\n 'Preparing Intlayer',\n colorize(`(v${packageJson.version})`, ANSIColors.GREY_DARK),\n ]);\n\n if (clean) {\n cleanOutputDir(configuration);\n }\n\n const files: string[] = listDictionaries(configuration);\n\n const dictionaries = await loadDictionaries(\n files,\n configuration,\n projectRequire\n );\n\n const dictionariesLoadedTime = Date.now();\n\n appLogger(\n [\n 'Content loaded',\n colorize(\n [\n dictionaries.remoteDictionaries.length > 0\n ? ` (Total: ${dictionariesLoadedTime - preparationStartMs}ms - Local: ${dictionaries.time.localDictionaries}ms - Remote: ${dictionaries.time.remoteDictionaries}ms)`\n : `(${dictionariesLoadedTime - preparationStartMs}ms)`,\n ].join(''),\n ANSIColors.GREY_DARK\n ),\n ],\n {\n isVerbose: true,\n }\n );\n\n // Build local dictionaries\n const dictionariesOutput = await buildDictionary(\n [...dictionaries.localDictionaries, ...dictionaries.remoteDictionaries],\n configuration,\n format,\n false\n );\n\n // Write remote dictionaries\n // Used as cache for next fetch\n await writeRemoteDictionary(dictionaries.remoteDictionaries, configuration);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths);\n\n await createDictionaryEntryPoint(configuration);\n\n const dictionariesBuiltTime = Date.now();\n\n appLogger([\n 'Dictionaries built',\n colorize(\n `(${dictionariesBuiltTime - preparationStartMs}ms)`,\n ANSIColors.GREY_DARK\n ),\n ]);\n\n await createModuleAugmentation(configuration);\n\n const moduleAugmentationBuiltTime = Date.now();\n\n appLogger(\n [\n 'Module augmentation built',\n colorize(\n `(${moduleAugmentationBuiltTime - dictionariesBuiltTime}ms)`,\n ANSIColors.GREY_DARK\n ),\n ],\n {\n isVerbose: true,\n }\n );\n\n await writeConfiguration(configuration);\n\n const configurationWrittenTime = Date.now();\n\n appLogger(\n [\n 'Configuration written',\n colorize(\n `(${configurationWrittenTime - preparationStartMs}ms)`,\n ANSIColors.GREY_DARK\n ),\n ],\n {\n isVerbose: true,\n }\n );\n\n const preparationElapsedMs = Date.now() - preparationStartMs;\n appLogger([`Done`, colorize(`${preparationElapsedMs}ms`, ANSIColors.GREEN)], {\n level: 'info',\n isVerbose: true,\n });\n};\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,iBAAiB,gCAAgC,KAAK,EAAE,MAAM,OAAO;AAC5E,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,sBAAsB;AAC/B,SAAS,kCAAkC;AAC3C,SAAS,0BAA0B,mBAAmB;AACtD,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAE5B,MAAM,kBAAkB,OAC7B,gBAAgC,iBAAiB,GACjD,iBAAiB,gBACjB,QAAQ,OACR,SAA4B,CAAC,OAAO,KAAK,MACtC;AACH,QAAM,YAAY,aAAa,aAAa;AAC5C,QAAM,qBAAqB,KAAK,IAAI;AAEpC,YAAU;AAAA,IACR;AAAA,IACA,SAAS,KAAK,YAAY,OAAO,KAAK,WAAW,SAAS;AAAA,EAC5D,CAAC;AAED,MAAI,OAAO;AACT,mBAAe,aAAa;AAAA,EAC9B;AAEA,QAAM,QAAkB,iBAAiB,aAAa;AAEtD,QAAM,eAAe,MAAM;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,yBAAyB,KAAK,IAAI;AAExC;AAAA,IACE;AAAA,MACE;AAAA,MACA;AAAA,QACE;AAAA,UACE,aAAa,mBAAmB,SAAS,IACrC,YAAY,yBAAyB,kBAAkB,eAAe,aAAa,KAAK,iBAAiB,gBAAgB,aAAa,KAAK,kBAAkB,QAC7J,IAAI,yBAAyB,kBAAkB;AAAA,QACrD,EAAE,KAAK,EAAE;AAAA,QACT,WAAW;AAAA,MACb;AAAA,IACF;AAAA,IACA;AAAA,MACE,WAAW;AAAA,IACb;AAAA,EACF;AAGA,QAAM,qBAAqB,MAAM;AAAA,IAC/B,CAAC,GAAG,aAAa,mBAAmB,GAAG,aAAa,kBAAkB;AAAA,IACtE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAIA,QAAM,sBAAsB,aAAa,oBAAoB,aAAa;AAE1E,QAAM,oBAAoB,OAAO;AAAA,IAC/B,oBAAoB,sBAAsB,CAAC;AAAA,EAC7C,EAAE,IAAI,CAAC,eAAe,WAAW,cAAc;AAE/C,QAAM,YAAY,iBAAiB;AAEnC,QAAM,2BAA2B,aAAa;AAE9C,QAAM,wBAAwB,KAAK,IAAI;AAEvC,YAAU;AAAA,IACR;AAAA,IACA;AAAA,MACE,IAAI,wBAAwB,kBAAkB;AAAA,MAC9C,WAAW;AAAA,IACb;AAAA,EACF,CAAC;AAED,QAAM,yBAAyB,aAAa;AAE5C,QAAM,8BAA8B,KAAK,IAAI;AAE7C;AAAA,IACE;AAAA,MACE;AAAA,MACA;AAAA,QACE,IAAI,8BAA8B,qBAAqB;AAAA,QACvD,WAAW;AAAA,MACb;AAAA,IACF;AAAA,IACA;AAAA,MACE,WAAW;AAAA,IACb;AAAA,EACF;AAEA,QAAM,mBAAmB,aAAa;AAEtC,QAAM,2BAA2B,KAAK,IAAI;AAE1C;AAAA,IACE;AAAA,MACE;AAAA,MACA;AAAA,QACE,IAAI,2BAA2B,kBAAkB;AAAA,QACjD,WAAW;AAAA,MACb;AAAA,IACF;AAAA,IACA;AAAA,MACE,WAAW;AAAA,IACb;AAAA,EACF;AAEA,QAAM,uBAAuB,KAAK,IAAI,IAAI;AAC1C,YAAU,CAAC,QAAQ,SAAS,GAAG,oBAAoB,MAAM,WAAW,KAAK,CAAC,GAAG;AAAA,IAC3E,OAAO;AAAA,IACP,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
@@ -1,7 +1,7 @@
1
+ import { getMaskContent } from "@intlayer/core";
1
2
  import { applyMask } from "./applyMask.mjs";
2
- import { buildMask } from "./buildMask.mjs";
3
3
  const reduceDictionaryContent = (fullDictionary, partialDictionary) => {
4
- const mask = buildMask(partialDictionary);
4
+ const mask = getMaskContent(partialDictionary);
5
5
  const result = applyMask(fullDictionary, mask);
6
6
  return result;
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/reduceDictionaryContent/reduceDictionaryContent.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/core';\nimport { applyMask } from './applyMask';\nimport { buildMask } from './buildMask';\n\nexport const reduceDictionaryContent = (\n fullDictionary: Dictionary,\n partialDictionary: Dictionary\n) => {\n const mask = buildMask(partialDictionary);\n const result = applyMask(fullDictionary, mask);\n\n return result;\n};\n"],"mappings":"AACA,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAEnB,MAAM,0BAA0B,CACrC,gBACA,sBACG;AACH,QAAM,OAAO,UAAU,iBAAiB;AACxC,QAAM,SAAS,UAAU,gBAAgB,IAAI;AAE7C,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../src/reduceDictionaryContent/reduceDictionaryContent.ts"],"sourcesContent":["import { type Dictionary, getMaskContent } from '@intlayer/core';\nimport { applyMask } from './applyMask';\n\nexport const reduceDictionaryContent = (\n fullDictionary: Dictionary,\n partialDictionary: Dictionary\n) => {\n const mask = getMaskContent(partialDictionary);\n const result = applyMask(fullDictionary, mask);\n\n return result;\n};\n"],"mappings":"AAAA,SAA0B,sBAAsB;AAChD,SAAS,iBAAiB;AAEnB,MAAM,0BAA0B,CACrC,gBACA,sBACG;AACH,QAAM,OAAO,eAAe,iBAAiB;AAC7C,QAAM,SAAS,UAAU,gBAAgB,IAAI;AAE7C,SAAO;AACT;","names":[]}
@@ -21,16 +21,28 @@ const extractErrorMessage = (error) => {
21
21
  if (seen.has(value)) return void 0;
22
22
  seen.add(value);
23
23
  const obj = value;
24
- const stringCandidates = [
25
- typeof obj.message === "string" ? obj.message : void 0,
26
- typeof obj.error_description === "string" ? obj.error_description : void 0,
27
- typeof obj.error === "string" ? obj.error : void 0,
28
- typeof obj.title === "string" ? obj.title : void 0,
29
- typeof obj.code === "string" ? obj.code : void 0,
30
- typeof obj.statusText === "string" ? obj.statusText : void 0
31
- ];
32
- for (const candidate of stringCandidates) {
33
- if (candidate && candidate.trim()) return candidate;
24
+ if (typeof obj.message === "string" && obj.message.trim()) {
25
+ return obj.message;
26
+ }
27
+ if (typeof obj.error_description === "string" && obj.error_description.trim()) {
28
+ return obj.error_description;
29
+ }
30
+ if (typeof obj.error === "string" && obj.error.trim()) {
31
+ return obj.error;
32
+ }
33
+ const title = typeof obj.title === "string" ? obj.title.trim() : "";
34
+ const code = typeof obj.code === "string" ? obj.code.trim() : "";
35
+ if (title && code) {
36
+ return `${title} (${code})`;
37
+ }
38
+ if (title) {
39
+ return title;
40
+ }
41
+ if (code) {
42
+ return code;
43
+ }
44
+ if (typeof obj.statusText === "string" && obj.statusText.trim()) {
45
+ return obj.statusText;
34
46
  }
35
47
  const response = obj.response;
36
48
  if (response && typeof response === "object") {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/extractErrorMessage.ts"],"sourcesContent":["export const extractErrorMessage = (error: unknown): string => {\n const trimToSingleLine = (text: string): string =>\n text\n .split(/\\r?\\n/)\n .map((s) => s.trim())\n .filter(Boolean)[0] ?? text.trim();\n\n const looksLikeJson = (value: string): boolean => {\n const s = value.trim();\n if (!s) return false;\n const first = s[0];\n return first === '{' || first === '[' || first === '\"';\n };\n\n const sanitizeUnexpectedTokenMessage = (text: string): string => {\n // If the text mentions an invalid JSON parse, try to extract the meaningful part\n const t = text.trim();\n if (/Unexpected token/i.test(t) && /not valid JSON/i.test(t)) {\n const quoted = t.match(/\"([^\"]+)\"/);\n if (quoted && quoted[1]) return quoted[1];\n // Fallback: drop the leading parser error description\n const afterColon = t.split(':').slice(1).join(':').trim();\n if (afterColon) return afterColon;\n }\n return t;\n };\n\n const pickFieldsFromObject = (\n value: unknown,\n seen: Set<unknown>\n ): string | undefined => {\n if (!value || typeof value !== 'object') return undefined;\n if (seen.has(value)) return undefined;\n seen.add(value);\n\n const obj = value as Record<string, unknown>;\n\n const stringCandidates: Array<string | undefined> = [\n typeof obj.message === 'string' ? obj.message : undefined,\n typeof obj.error_description === 'string'\n ? obj.error_description\n : undefined,\n typeof obj.error === 'string' ? obj.error : undefined,\n typeof obj.title === 'string' ? obj.title : undefined,\n typeof obj.code === 'string' ? obj.code : undefined,\n typeof obj.statusText === 'string' ? obj.statusText : undefined,\n ];\n\n for (const candidate of stringCandidates) {\n if (candidate && candidate.trim()) return candidate;\n }\n\n // Common nested structures (Axios/Fetch-like)\n const response = obj.response as Record<string, unknown> | undefined;\n if (response && typeof response === 'object') {\n const data = response.data as unknown;\n const fromData = pickFieldsFromObject(data, seen);\n if (fromData) return fromData;\n }\n\n const data = obj.data as unknown;\n const fromData = pickFieldsFromObject(data, seen);\n if (fromData) return fromData;\n\n // Nested cause chain\n const cause = (obj as { cause?: unknown }).cause;\n const fromCause =\n pickFieldsFromObject(cause, seen) ??\n (typeof (cause as any)?.message === 'string'\n ? (cause as any).message\n : undefined);\n if (fromCause) return fromCause;\n\n // Arrays of errors\n const errors = obj.errors as unknown;\n if (Array.isArray(errors)) {\n for (const item of errors) {\n const fromItem = pickFieldsFromObject(item, seen);\n if (fromItem) return fromItem;\n if (typeof (item as any)?.message === 'string')\n return (item as any).message;\n }\n }\n\n return undefined;\n };\n\n const tryParseJsonString = (maybeJson: string): string | undefined => {\n if (!looksLikeJson(maybeJson)) return undefined;\n try {\n const parsed = JSON.parse(maybeJson);\n const picked = pickFieldsFromObject(parsed, new Set());\n if (picked) return picked;\n if (typeof parsed === 'string') return parsed;\n return undefined;\n } catch {\n return undefined;\n }\n };\n\n if (typeof error === 'string') {\n const cleaned = sanitizeUnexpectedTokenMessage(error);\n return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);\n }\n\n if (error && typeof error === 'object') {\n // Native Error instance\n if (error instanceof Error) {\n const cleaned = sanitizeUnexpectedTokenMessage(error.message);\n const fromMessage = tryParseJsonString(cleaned);\n if (fromMessage) return trimToSingleLine(fromMessage);\n // Dive into cause when present\n const fromCause = extractErrorMessage(error.cause as unknown);\n if (fromCause && fromCause !== 'An unknown error occurred')\n return trimToSingleLine(fromCause);\n return trimToSingleLine(cleaned);\n }\n\n // Generic object\n const seen = new Set<unknown>();\n const fromObject = pickFieldsFromObject(error, seen);\n if (fromObject) {\n const cleaned = sanitizeUnexpectedTokenMessage(fromObject);\n return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);\n }\n\n try {\n const serialized = JSON.stringify(error);\n return trimToSingleLine(serialized);\n } catch {\n return trimToSingleLine(String(error));\n }\n }\n\n return 'An unknown error occurred';\n};\n"],"mappings":"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","names":["data","fromData"]}
1
+ {"version":3,"sources":["../../../src/utils/extractErrorMessage.ts"],"sourcesContent":["export const extractErrorMessage = (error: unknown): string => {\n const trimToSingleLine = (text: string): string =>\n text\n .split(/\\r?\\n/)\n .map((s) => s.trim())\n .filter(Boolean)[0] ?? text.trim();\n\n const looksLikeJson = (value: string): boolean => {\n const s = value.trim();\n if (!s) return false;\n const first = s[0];\n return first === '{' || first === '[' || first === '\"';\n };\n\n const sanitizeUnexpectedTokenMessage = (text: string): string => {\n // If the text mentions an invalid JSON parse, try to extract the meaningful part\n const t = text.trim();\n if (/Unexpected token/i.test(t) && /not valid JSON/i.test(t)) {\n const quoted = t.match(/\"([^\"]+)\"/);\n if (quoted && quoted[1]) return quoted[1];\n // Fallback: drop the leading parser error description\n const afterColon = t.split(':').slice(1).join(':').trim();\n if (afterColon) return afterColon;\n }\n return t;\n };\n\n const pickFieldsFromObject = (\n value: unknown,\n seen: Set<unknown>\n ): string | undefined => {\n if (!value || typeof value !== 'object') return undefined;\n if (seen.has(value)) return undefined;\n seen.add(value);\n\n const obj = value as Record<string, unknown>;\n\n // Check for message first (highest priority)\n if (typeof obj.message === 'string' && obj.message.trim()) {\n return obj.message;\n }\n\n // Check for error_description\n if (\n typeof obj.error_description === 'string' &&\n obj.error_description.trim()\n ) {\n return obj.error_description;\n }\n\n // Check for error\n if (typeof obj.error === 'string' && obj.error.trim()) {\n return obj.error;\n }\n\n // Handle title and code combination\n const title = typeof obj.title === 'string' ? obj.title.trim() : '';\n const code = typeof obj.code === 'string' ? obj.code.trim() : '';\n\n if (title && code) {\n return `${title} (${code})`;\n }\n\n if (title) {\n return title;\n }\n\n if (code) {\n return code;\n }\n\n // Check for statusText\n if (typeof obj.statusText === 'string' && obj.statusText.trim()) {\n return obj.statusText;\n }\n\n // Common nested structures (Axios/Fetch-like)\n const response = obj.response as Record<string, unknown> | undefined;\n if (response && typeof response === 'object') {\n const data = response.data as unknown;\n const fromData = pickFieldsFromObject(data, seen);\n if (fromData) return fromData;\n }\n\n const data = obj.data as unknown;\n const fromData = pickFieldsFromObject(data, seen);\n if (fromData) return fromData;\n\n // Nested cause chain\n const cause = (obj as { cause?: unknown }).cause;\n const fromCause =\n pickFieldsFromObject(cause, seen) ??\n (typeof (cause as any)?.message === 'string'\n ? (cause as any).message\n : undefined);\n if (fromCause) return fromCause;\n\n // Arrays of errors\n const errors = obj.errors as unknown;\n if (Array.isArray(errors)) {\n for (const item of errors) {\n const fromItem = pickFieldsFromObject(item, seen);\n if (fromItem) return fromItem;\n if (typeof (item as any)?.message === 'string')\n return (item as any).message;\n }\n }\n\n return undefined;\n };\n\n const tryParseJsonString = (maybeJson: string): string | undefined => {\n if (!looksLikeJson(maybeJson)) return undefined;\n try {\n const parsed = JSON.parse(maybeJson);\n const picked = pickFieldsFromObject(parsed, new Set());\n if (picked) return picked;\n if (typeof parsed === 'string') return parsed;\n return undefined;\n } catch {\n return undefined;\n }\n };\n\n if (typeof error === 'string') {\n const cleaned = sanitizeUnexpectedTokenMessage(error);\n return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);\n }\n\n if (error && typeof error === 'object') {\n // Native Error instance\n if (error instanceof Error) {\n const cleaned = sanitizeUnexpectedTokenMessage(error.message);\n const fromMessage = tryParseJsonString(cleaned);\n if (fromMessage) return trimToSingleLine(fromMessage);\n // Dive into cause when present\n const fromCause = extractErrorMessage(error.cause as unknown);\n if (fromCause && fromCause !== 'An unknown error occurred')\n return trimToSingleLine(fromCause);\n return trimToSingleLine(cleaned);\n }\n\n // Generic object\n const seen = new Set<unknown>();\n const fromObject = pickFieldsFromObject(error, seen);\n if (fromObject) {\n const cleaned = sanitizeUnexpectedTokenMessage(fromObject);\n return tryParseJsonString(cleaned) ?? trimToSingleLine(cleaned);\n }\n\n try {\n const serialized = JSON.stringify(error);\n return trimToSingleLine(serialized);\n } catch {\n return trimToSingleLine(String(error));\n }\n }\n\n return 'An unknown error occurred';\n};\n"],"mappings":"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","names":["data","fromData"]}
@@ -1,9 +1,145 @@
1
- import pLimit from "p-limit";
1
+ class Node {
2
+ value;
3
+ next;
4
+ constructor(value) {
5
+ this.value = value;
6
+ }
7
+ }
8
+ class Queue {
9
+ #head;
10
+ #tail;
11
+ #size;
12
+ constructor() {
13
+ this.clear();
14
+ }
15
+ enqueue(value) {
16
+ const node = new Node(value);
17
+ if (this.#head) {
18
+ this.#tail.next = node;
19
+ this.#tail = node;
20
+ } else {
21
+ this.#head = node;
22
+ this.#tail = node;
23
+ }
24
+ this.#size++;
25
+ }
26
+ dequeue() {
27
+ const current = this.#head;
28
+ if (!current) {
29
+ return;
30
+ }
31
+ this.#head = current.next;
32
+ this.#size--;
33
+ return current.value;
34
+ }
35
+ peek() {
36
+ if (!this.#head) {
37
+ return;
38
+ }
39
+ return this.#head.value;
40
+ }
41
+ clear() {
42
+ this.#head = void 0;
43
+ this.#tail = void 0;
44
+ this.#size = 0;
45
+ }
46
+ get size() {
47
+ return this.#size;
48
+ }
49
+ *[Symbol.iterator]() {
50
+ let current = this.#head;
51
+ while (current) {
52
+ yield current.value;
53
+ current = current.next;
54
+ }
55
+ }
56
+ *drain() {
57
+ while (this.#head) {
58
+ yield this.dequeue();
59
+ }
60
+ }
61
+ }
62
+ const pLimit = (concurrency) => {
63
+ validateConcurrency(concurrency);
64
+ const queue = new Queue();
65
+ let activeCount = 0;
66
+ const resumeNext = () => {
67
+ if (activeCount < concurrency && queue.size > 0) {
68
+ activeCount++;
69
+ queue.dequeue()?.();
70
+ }
71
+ };
72
+ const next = () => {
73
+ activeCount--;
74
+ resumeNext();
75
+ };
76
+ const run = async (function_, resolve, arguments_) => {
77
+ const result = (async () => function_(...arguments_))();
78
+ resolve(result);
79
+ try {
80
+ await result;
81
+ } catch {
82
+ }
83
+ next();
84
+ };
85
+ const enqueue = (function_, resolve, arguments_) => {
86
+ new Promise((internalResolve) => {
87
+ queue.enqueue(internalResolve);
88
+ }).then(run.bind(void 0, function_, resolve, arguments_));
89
+ if (activeCount < concurrency) {
90
+ resumeNext();
91
+ }
92
+ };
93
+ const generator = (function_, ...arguments_) => new Promise((resolve) => {
94
+ enqueue(function_, resolve, arguments_);
95
+ });
96
+ Object.defineProperties(generator, {
97
+ activeCount: {
98
+ get: () => activeCount
99
+ },
100
+ pendingCount: {
101
+ get: () => queue.size
102
+ },
103
+ clearQueue: {
104
+ value() {
105
+ queue.clear();
106
+ }
107
+ },
108
+ concurrency: {
109
+ get: () => concurrency,
110
+ set(newConcurrency) {
111
+ validateConcurrency(newConcurrency);
112
+ concurrency = newConcurrency;
113
+ queueMicrotask(() => {
114
+ while (activeCount < concurrency && queue.size > 0) {
115
+ resumeNext();
116
+ }
117
+ });
118
+ }
119
+ },
120
+ map: {
121
+ async value(array, function_) {
122
+ const promises = array.map(
123
+ (value, index) => this(function_, value, index)
124
+ );
125
+ return Promise.all(promises);
126
+ }
127
+ }
128
+ });
129
+ return generator;
130
+ };
131
+ const validateConcurrency = (concurrency) => {
132
+ if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
133
+ throw new TypeError("Expected `concurrency` to be a number from 1 and up");
134
+ }
135
+ };
2
136
  const parallelize = async (items, callback, parallelLimit = 10) => {
3
137
  const limit = pLimit(parallelLimit);
4
138
  return Promise.all(items.map((item) => limit(() => callback(item))));
5
139
  };
6
140
  export {
141
+ Queue as default,
142
+ pLimit,
7
143
  parallelize
8
144
  };
9
145
  //# sourceMappingURL=parallelize.mjs.map