@intlayer/chokidar 6.1.6 → 7.0.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,167 +1,98 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var listGitFiles_exports = {};
30
- __export(listGitFiles_exports, {
31
- listGitFiles: () => listGitFiles,
32
- listGitLines: () => listGitLines
33
- });
34
- module.exports = __toCommonJS(listGitFiles_exports);
35
- var import_config = require("@intlayer/config");
36
- var import_built = __toESM(require("@intlayer/config/built"));
37
- var import_fs = require("fs");
38
- var import_path = require("path");
39
- var import_simple_git = __toESM(require("simple-git"));
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ let node_fs = require("node:fs");
3
+ node_fs = require_rolldown_runtime.__toESM(node_fs);
4
+ let __intlayer_config = require("@intlayer/config");
5
+ __intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
6
+ let node_path = require("node:path");
7
+ node_path = require_rolldown_runtime.__toESM(node_path);
8
+ let __intlayer_config_built = require("@intlayer/config/built");
9
+ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
10
+ let simple_git = require("simple-git");
11
+ simple_git = require_rolldown_runtime.__toESM(simple_git);
12
+
13
+ //#region src/listGitFiles.ts
40
14
  const getGitRootDir = async () => {
41
- try {
42
- const git = (0, import_simple_git.default)();
43
- const rootDir = await git.revparse(["--show-toplevel"]);
44
- return rootDir.trim();
45
- } catch (error) {
46
- const appLogger = (0, import_config.getAppLogger)(import_built.default);
47
- appLogger("Error getting git root directory:" + error, {
48
- level: "error"
49
- });
50
- return null;
51
- }
15
+ try {
16
+ return (await (0, simple_git.default)().revparse(["--show-toplevel"])).trim();
17
+ } catch (error) {
18
+ (0, __intlayer_config.getAppLogger)(__intlayer_config_built.default)(`Error getting git root directory: ${error}`, { level: "error" });
19
+ return null;
20
+ }
52
21
  };
53
- const listGitFiles = async ({
54
- mode,
55
- baseRef = "origin/main",
56
- currentRef = "HEAD",
57
- // HEAD points to the current branch's latest commit
58
- absolute = true
59
- }) => {
60
- try {
61
- const git = (0, import_simple_git.default)();
62
- const diff = /* @__PURE__ */ new Set();
63
- if (mode.includes("untracked")) {
64
- const status = await git.status();
65
- status.not_added.forEach((f) => diff.add(f));
66
- }
67
- if (mode.includes("uncommitted")) {
68
- const uncommittedDiff = await git.diff(["--name-only", "HEAD"]);
69
- const uncommittedFiles = uncommittedDiff.split("\n").filter(Boolean);
70
- uncommittedFiles.forEach((file) => diff.add(file));
71
- }
72
- if (mode.includes("unpushed")) {
73
- const unpushedDiff = await git.diff(["--name-only", "@{push}...HEAD"]);
74
- const unpushedFiles = unpushedDiff.split("\n").filter(Boolean);
75
- unpushedFiles.forEach((file) => diff.add(file));
76
- }
77
- if (mode.includes("gitDiff")) {
78
- await git.fetch(baseRef);
79
- const diffBranch = await git.diff([
80
- "--name-only",
81
- `${baseRef}...${currentRef}`
82
- ]);
83
- const gitDiffFiles = diffBranch.split("\n").filter(Boolean);
84
- gitDiffFiles.forEach((file) => diff.add(file));
85
- }
86
- if (absolute) {
87
- const gitRootDir = await getGitRootDir();
88
- if (!gitRootDir) {
89
- return [];
90
- }
91
- return Array.from(diff).map((file) => (0, import_path.join)(gitRootDir, file));
92
- }
93
- return Array.from(diff);
94
- } catch (error) {
95
- console.warn("Failed to get changes list:", error);
96
- }
22
+ const listGitFiles = async ({ mode, baseRef = "origin/main", currentRef = "HEAD", absolute = true }) => {
23
+ try {
24
+ const git = (0, simple_git.default)();
25
+ const diff = /* @__PURE__ */ new Set();
26
+ if (mode.includes("untracked")) (await git.status()).not_added.forEach((f) => diff.add(f));
27
+ if (mode.includes("uncommitted")) (await git.diff(["--name-only", "HEAD"])).split("\n").filter(Boolean).forEach((file) => diff.add(file));
28
+ if (mode.includes("unpushed")) (await git.diff(["--name-only", "@{push}...HEAD"])).split("\n").filter(Boolean).forEach((file) => diff.add(file));
29
+ if (mode.includes("gitDiff")) {
30
+ await git.fetch(baseRef);
31
+ (await git.diff(["--name-only", `${baseRef}...${currentRef}`])).split("\n").filter(Boolean).forEach((file) => diff.add(file));
32
+ }
33
+ if (absolute) {
34
+ const gitRootDir = await getGitRootDir();
35
+ if (!gitRootDir) return [];
36
+ return Array.from(diff).map((file) => (0, node_path.join)(gitRootDir, file));
37
+ }
38
+ return Array.from(diff);
39
+ } catch (error) {
40
+ console.warn("Failed to get changes list:", error);
41
+ }
97
42
  };
98
- const listGitLines = async (filePath, {
99
- mode,
100
- baseRef = "origin/main",
101
- currentRef = "HEAD"
102
- // HEAD points to the current branch's latest commit
103
- }) => {
104
- const git = (0, import_simple_git.default)();
105
- const changedLines = /* @__PURE__ */ new Set();
106
- const collectLinesFromDiff = (diffOutput) => {
107
- const hunkRegex = /@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/g;
108
- let match;
109
- while ((match = hunkRegex.exec(diffOutput)) !== null) {
110
- const oldCount = match[2] ? Number(match[2]) : 1;
111
- const newStart = Number(match[3]);
112
- const newCount = match[4] ? Number(match[4]) : 1;
113
- if (newCount > 0) {
114
- for (let i = 0; i < newCount; i++) {
115
- changedLines.add(newStart + i);
116
- }
117
- }
118
- if (oldCount > 0 && newCount === 0) {
119
- if (newStart > 1) {
120
- changedLines.add(newStart - 1);
121
- }
122
- changedLines.add(newStart);
123
- }
124
- }
125
- };
126
- if (mode.includes("untracked")) {
127
- const status = await git.status();
128
- const isUntracked = status.not_added.includes(filePath);
129
- if (isUntracked) {
130
- try {
131
- const content = (0, import_fs.readFileSync)(filePath, "utf-8");
132
- content.split("\n").forEach((_, idx) => changedLines.add(idx + 1));
133
- } catch {
134
- }
135
- }
136
- }
137
- if (mode.includes("uncommitted")) {
138
- const diffOutput = await git.diff(["--unified=0", "HEAD", "--", filePath]);
139
- collectLinesFromDiff(diffOutput);
140
- }
141
- if (mode.includes("unpushed")) {
142
- const diffOutput = await git.diff([
143
- "--unified=0",
144
- "@{push}...HEAD",
145
- "--",
146
- filePath
147
- ]);
148
- collectLinesFromDiff(diffOutput);
149
- }
150
- if (mode.includes("gitDiff")) {
151
- await git.fetch(baseRef);
152
- const diffOutput = await git.diff([
153
- "--unified=0",
154
- `${baseRef}...${currentRef}`,
155
- "--",
156
- filePath
157
- ]);
158
- collectLinesFromDiff(diffOutput);
159
- }
160
- return Array.from(changedLines).sort((a, b) => a - b);
43
+ const listGitLines = async (filePath, { mode, baseRef = "origin/main", currentRef = "HEAD" }) => {
44
+ const git = (0, simple_git.default)();
45
+ const changedLines = /* @__PURE__ */ new Set();
46
+ /**
47
+ * Extracts line numbers from a diff generated with `--unified=0`.
48
+ * Each hunk header looks like: @@ -<oldStart>,<oldCount> +<newStart>,<newCount> @@
49
+ * We consider both the "+" (new) side for additions and the "-" (old) side for deletions.
50
+ * For deletions, we add the line before and after the deletion point in the current file.
51
+ */
52
+ const collectLinesFromDiff = (diffOutput) => {
53
+ const hunkRegex = /@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/g;
54
+ let match;
55
+ while ((match = hunkRegex.exec(diffOutput)) !== null) {
56
+ const oldCount = match[2] ? Number(match[2]) : 1;
57
+ const newStart = Number(match[3]);
58
+ const newCount = match[4] ? Number(match[4]) : 1;
59
+ if (newCount > 0) for (let i = 0; i < newCount; i++) changedLines.add(newStart + i);
60
+ if (oldCount > 0 && newCount === 0) {
61
+ if (newStart > 1) changedLines.add(newStart - 1);
62
+ changedLines.add(newStart);
63
+ }
64
+ }
65
+ };
66
+ if (mode.includes("untracked")) {
67
+ if ((await git.status()).not_added.includes(filePath)) try {
68
+ (0, node_fs.readFileSync)(filePath, "utf-8").split("\n").forEach((_, idx) => changedLines.add(idx + 1));
69
+ } catch {}
70
+ }
71
+ if (mode.includes("uncommitted")) collectLinesFromDiff(await git.diff([
72
+ "--unified=0",
73
+ "HEAD",
74
+ "--",
75
+ filePath
76
+ ]));
77
+ if (mode.includes("unpushed")) collectLinesFromDiff(await git.diff([
78
+ "--unified=0",
79
+ "@{push}...HEAD",
80
+ "--",
81
+ filePath
82
+ ]));
83
+ if (mode.includes("gitDiff")) {
84
+ await git.fetch(baseRef);
85
+ collectLinesFromDiff(await git.diff([
86
+ "--unified=0",
87
+ `${baseRef}...${currentRef}`,
88
+ "--",
89
+ filePath
90
+ ]));
91
+ }
92
+ return Array.from(changedLines).sort((a, b) => a - b);
161
93
  };
162
- // Annotate the CommonJS export names for ESM import in node:
163
- 0 && (module.exports = {
164
- listGitFiles,
165
- listGitLines
166
- });
94
+
95
+ //#endregion
96
+ exports.listGitFiles = listGitFiles;
97
+ exports.listGitLines = listGitLines;
167
98
  //# sourceMappingURL=listGitFiles.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/listGitFiles.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport { readFileSync } from 'fs';\nimport { join } from 'path';\nimport simpleGit from 'simple-git';\n\nexport type DiffMode = 'gitDiff' | 'uncommitted' | 'unpushed' | 'untracked';\n\nconst getGitRootDir = async (): Promise<string | null> => {\n try {\n const git = simpleGit();\n const rootDir = await git.revparse(['--show-toplevel']);\n return rootDir.trim();\n } catch (error) {\n const appLogger = getAppLogger(configuration);\n appLogger('Error getting git root directory:' + error, {\n level: 'error',\n });\n return null;\n }\n};\n\nexport type ListGitFilesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n absolute?: boolean;\n};\n\nexport const listGitFiles = async ({\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n absolute = true,\n}: ListGitFilesOptions) => {\n try {\n const git = simpleGit();\n const diff: Set<string> = new Set();\n\n if (mode.includes('untracked')) {\n const status = await git.status();\n status.not_added.forEach((f) => diff.add(f));\n }\n\n if (mode.includes('uncommitted')) {\n // Get uncommitted changes\n const uncommittedDiff = await git.diff(['--name-only', 'HEAD']);\n\n const uncommittedFiles = uncommittedDiff.split('\\n').filter(Boolean);\n\n uncommittedFiles.forEach((file) => diff.add(file));\n }\n\n if (mode.includes('unpushed')) {\n // Get unpushed commits\n const unpushedDiff = await git.diff(['--name-only', '@{push}...HEAD']);\n\n const unpushedFiles = unpushedDiff.split('\\n').filter(Boolean);\n\n unpushedFiles.forEach((file) => diff.add(file));\n }\n\n if (mode.includes('gitDiff')) {\n // Get the base branch (usually main/master) from CI environment\n\n await git.fetch(baseRef);\n\n const diffBranch = await git.diff([\n '--name-only',\n `${baseRef}...${currentRef}`,\n ]);\n\n const gitDiffFiles = diffBranch.split('\\n').filter(Boolean);\n\n gitDiffFiles.forEach((file) => diff.add(file));\n }\n\n if (absolute) {\n const gitRootDir = await getGitRootDir();\n if (!gitRootDir) {\n return [];\n }\n return Array.from(diff).map((file) => join(gitRootDir, file));\n }\n\n return Array.from(diff);\n } catch (error) {\n console.warn('Failed to get changes list:', error);\n }\n};\n\nexport type ListGitLinesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n};\n\nexport const listGitLines = async (\n filePath: string,\n {\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n }: ListGitLinesOptions\n): Promise<number[]> => {\n const git = simpleGit();\n // We collect **line numbers** (1-based) that were modified/added by the diff.\n // Using a Set ensures uniqueness when the same line is reported by several modes.\n const changedLines: Set<number> = new Set();\n\n /**\n * Extracts line numbers from a diff generated with `--unified=0`.\n * Each hunk header looks like: @@ -<oldStart>,<oldCount> +<newStart>,<newCount> @@\n * We consider both the \"+\" (new) side for additions and the \"-\" (old) side for deletions.\n * For deletions, we add the line before and after the deletion point in the current file.\n */\n const collectLinesFromDiff = (diffOutput: string) => {\n const hunkRegex = /@@ -(\\d+)(?:,(\\d+))? \\+(\\d+)(?:,(\\d+))? @@/g;\n let match: RegExpExecArray | null;\n\n while ((match = hunkRegex.exec(diffOutput)) !== null) {\n const oldCount = match[2] ? Number(match[2]) : 1;\n const newStart = Number(match[3]);\n const newCount = match[4] ? Number(match[4]) : 1;\n\n // Handle additions/modifications (+ side)\n if (newCount > 0) {\n for (let i = 0; i < newCount; i++) {\n changedLines.add(newStart + i);\n }\n }\n\n // Handle deletions (- side)\n if (oldCount > 0 && newCount === 0) {\n // For deletions, add the line before and after the deletion point\n // The deletion point in the new file is at newStart\n if (newStart > 1) {\n changedLines.add(newStart - 1); // Line before deletion\n }\n changedLines.add(newStart); // Line after deletion (if it exists)\n }\n }\n };\n\n // 1. Handle untracked files – when a file is untracked its entire content is new.\n if (mode.includes('untracked')) {\n const status = await git.status();\n const isUntracked = status.not_added.includes(filePath);\n if (isUntracked) {\n try {\n const content = readFileSync(filePath, 'utf-8');\n content.split('\\n').forEach((_, idx) => changedLines.add(idx + 1));\n } catch {\n // ignore read errors – file may have been deleted, etc.\n }\n }\n }\n\n // 2. Uncommitted changes (working tree vs HEAD)\n if (mode.includes('uncommitted')) {\n const diffOutput = await git.diff(['--unified=0', 'HEAD', '--', filePath]);\n collectLinesFromDiff(diffOutput);\n }\n\n // 3. Unpushed commits – compare local branch to its upstream\n if (mode.includes('unpushed')) {\n const diffOutput = await git.diff([\n '--unified=0',\n '@{push}...HEAD',\n '--',\n filePath,\n ]);\n collectLinesFromDiff(diffOutput);\n }\n\n // 4. Regular git diff between baseRef and currentRef (e.g., CI pull-request diff)\n if (mode.includes('gitDiff')) {\n await git.fetch(baseRef);\n const diffOutput = await git.diff([\n '--unified=0',\n `${baseRef}...${currentRef}`,\n '--',\n filePath,\n ]);\n collectLinesFromDiff(diffOutput);\n }\n\n // Return the list sorted for convenience\n return Array.from(changedLines).sort((a, b) => a - b);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA6B;AAC7B,mBAA0B;AAC1B,gBAA6B;AAC7B,kBAAqB;AACrB,wBAAsB;AAItB,MAAM,gBAAgB,YAAoC;AACxD,MAAI;AACF,UAAM,UAAM,kBAAAA,SAAU;AACtB,UAAM,UAAU,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC;AACtD,WAAO,QAAQ,KAAK;AAAA,EACtB,SAAS,OAAO;AACd,UAAM,gBAAY,4BAAa,aAAAC,OAAa;AAC5C,cAAU,sCAAsC,OAAO;AAAA,MACrD,OAAO;AAAA,IACT,CAAC;AACD,WAAO;AAAA,EACT;AACF;AASO,MAAM,eAAe,OAAO;AAAA,EACjC;AAAA,EACA,UAAU;AAAA,EACV,aAAa;AAAA;AAAA,EACb,WAAW;AACb,MAA2B;AACzB,MAAI;AACF,UAAM,UAAM,kBAAAD,SAAU;AACtB,UAAM,OAAoB,oBAAI,IAAI;AAElC,QAAI,KAAK,SAAS,WAAW,GAAG;AAC9B,YAAM,SAAS,MAAM,IAAI,OAAO;AAChC,aAAO,UAAU,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;AAAA,IAC7C;AAEA,QAAI,KAAK,SAAS,aAAa,GAAG;AAEhC,YAAM,kBAAkB,MAAM,IAAI,KAAK,CAAC,eAAe,MAAM,CAAC;AAE9D,YAAM,mBAAmB,gBAAgB,MAAM,IAAI,EAAE,OAAO,OAAO;AAEnE,uBAAiB,QAAQ,CAAC,SAAS,KAAK,IAAI,IAAI,CAAC;AAAA,IACnD;AAEA,QAAI,KAAK,SAAS,UAAU,GAAG;AAE7B,YAAM,eAAe,MAAM,IAAI,KAAK,CAAC,eAAe,gBAAgB,CAAC;AAErE,YAAM,gBAAgB,aAAa,MAAM,IAAI,EAAE,OAAO,OAAO;AAE7D,oBAAc,QAAQ,CAAC,SAAS,KAAK,IAAI,IAAI,CAAC;AAAA,IAChD;AAEA,QAAI,KAAK,SAAS,SAAS,GAAG;AAG5B,YAAM,IAAI,MAAM,OAAO;AAEvB,YAAM,aAAa,MAAM,IAAI,KAAK;AAAA,QAChC;AAAA,QACA,GAAG,OAAO,MAAM,UAAU;AAAA,MAC5B,CAAC;AAED,YAAM,eAAe,WAAW,MAAM,IAAI,EAAE,OAAO,OAAO;AAE1D,mBAAa,QAAQ,CAAC,SAAS,KAAK,IAAI,IAAI,CAAC;AAAA,IAC/C;AAEA,QAAI,UAAU;AACZ,YAAM,aAAa,MAAM,cAAc;AACvC,UAAI,CAAC,YAAY;AACf,eAAO,CAAC;AAAA,MACV;AACA,aAAO,MAAM,KAAK,IAAI,EAAE,IAAI,CAAC,aAAS,kBAAK,YAAY,IAAI,CAAC;AAAA,IAC9D;AAEA,WAAO,MAAM,KAAK,IAAI;AAAA,EACxB,SAAS,OAAO;AACd,YAAQ,KAAK,+BAA+B,KAAK;AAAA,EACnD;AACF;AAQO,MAAM,eAAe,OAC1B,UACA;AAAA,EACE;AAAA,EACA,UAAU;AAAA,EACV,aAAa;AAAA;AACf,MACsB;AACtB,QAAM,UAAM,kBAAAA,SAAU;AAGtB,QAAM,eAA4B,oBAAI,IAAI;AAQ1C,QAAM,uBAAuB,CAAC,eAAuB;AACnD,UAAM,YAAY;AAClB,QAAI;AAEJ,YAAQ,QAAQ,UAAU,KAAK,UAAU,OAAO,MAAM;AACpD,YAAM,WAAW,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,CAAC,IAAI;AAC/C,YAAM,WAAW,OAAO,MAAM,CAAC,CAAC;AAChC,YAAM,WAAW,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,CAAC,IAAI;AAG/C,UAAI,WAAW,GAAG;AAChB,iBAAS,IAAI,GAAG,IAAI,UAAU,KAAK;AACjC,uBAAa,IAAI,WAAW,CAAC;AAAA,QAC/B;AAAA,MACF;AAGA,UAAI,WAAW,KAAK,aAAa,GAAG;AAGlC,YAAI,WAAW,GAAG;AAChB,uBAAa,IAAI,WAAW,CAAC;AAAA,QAC/B;AACA,qBAAa,IAAI,QAAQ;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AAGA,MAAI,KAAK,SAAS,WAAW,GAAG;AAC9B,UAAM,SAAS,MAAM,IAAI,OAAO;AAChC,UAAM,cAAc,OAAO,UAAU,SAAS,QAAQ;AACtD,QAAI,aAAa;AACf,UAAI;AACF,cAAM,cAAU,wBAAa,UAAU,OAAO;AAC9C,gBAAQ,MAAM,IAAI,EAAE,QAAQ,CAAC,GAAG,QAAQ,aAAa,IAAI,MAAM,CAAC,CAAC;AAAA,MACnE,QAAQ;AAAA,MAER;AAAA,IACF;AAAA,EACF;AAGA,MAAI,KAAK,SAAS,aAAa,GAAG;AAChC,UAAM,aAAa,MAAM,IAAI,KAAK,CAAC,eAAe,QAAQ,MAAM,QAAQ,CAAC;AACzE,yBAAqB,UAAU;AAAA,EACjC;AAGA,MAAI,KAAK,SAAS,UAAU,GAAG;AAC7B,UAAM,aAAa,MAAM,IAAI,KAAK;AAAA,MAChC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AACD,yBAAqB,UAAU;AAAA,EACjC;AAGA,MAAI,KAAK,SAAS,SAAS,GAAG;AAC5B,UAAM,IAAI,MAAM,OAAO;AACvB,UAAM,aAAa,MAAM,IAAI,KAAK;AAAA,MAChC;AAAA,MACA,GAAG,OAAO,MAAM,UAAU;AAAA,MAC1B;AAAA,MACA;AAAA,IACF,CAAC;AACD,yBAAqB,UAAU;AAAA,EACjC;AAGA,SAAO,MAAM,KAAK,YAAY,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC;AACtD;","names":["simpleGit","configuration"]}
1
+ {"version":3,"file":"listGitFiles.cjs","names":["configuration","diff: Set<string>","changedLines: Set<number>","match: RegExpExecArray | null"],"sources":["../../src/listGitFiles.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { getAppLogger } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport simpleGit from 'simple-git';\n\nexport type DiffMode = 'gitDiff' | 'uncommitted' | 'unpushed' | 'untracked';\n\nconst getGitRootDir = async (): Promise<string | null> => {\n try {\n const git = simpleGit();\n const rootDir = await git.revparse(['--show-toplevel']);\n return rootDir.trim();\n } catch (error) {\n const appLogger = getAppLogger(configuration);\n appLogger(`Error getting git root directory: ${error}`, {\n level: 'error',\n });\n return null;\n }\n};\n\nexport type ListGitFilesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n absolute?: boolean;\n};\n\nexport const listGitFiles = async ({\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n absolute = true,\n}: ListGitFilesOptions) => {\n try {\n const git = simpleGit();\n const diff: Set<string> = new Set();\n\n if (mode.includes('untracked')) {\n const status = await git.status();\n status.not_added.forEach((f) => diff.add(f));\n }\n\n if (mode.includes('uncommitted')) {\n // Get uncommitted changes\n const uncommittedDiff = await git.diff(['--name-only', 'HEAD']);\n\n const uncommittedFiles = uncommittedDiff.split('\\n').filter(Boolean);\n\n uncommittedFiles.forEach((file) => diff.add(file));\n }\n\n if (mode.includes('unpushed')) {\n // Get unpushed commits\n const unpushedDiff = await git.diff(['--name-only', '@{push}...HEAD']);\n\n const unpushedFiles = unpushedDiff.split('\\n').filter(Boolean);\n\n unpushedFiles.forEach((file) => diff.add(file));\n }\n\n if (mode.includes('gitDiff')) {\n // Get the base branch (usually main/master) from CI environment\n\n await git.fetch(baseRef);\n\n const diffBranch = await git.diff([\n '--name-only',\n `${baseRef}...${currentRef}`,\n ]);\n\n const gitDiffFiles = diffBranch.split('\\n').filter(Boolean);\n\n gitDiffFiles.forEach((file) => diff.add(file));\n }\n\n if (absolute) {\n const gitRootDir = await getGitRootDir();\n if (!gitRootDir) {\n return [];\n }\n return Array.from(diff).map((file) => join(gitRootDir, file));\n }\n\n return Array.from(diff);\n } catch (error) {\n console.warn('Failed to get changes list:', error);\n }\n};\n\nexport type ListGitLinesOptions = {\n mode: DiffMode[];\n baseRef?: string;\n currentRef?: string;\n};\n\nexport const listGitLines = async (\n filePath: string,\n {\n mode,\n baseRef = 'origin/main',\n currentRef = 'HEAD', // HEAD points to the current branch's latest commit\n }: ListGitLinesOptions\n): Promise<number[]> => {\n const git = simpleGit();\n // We collect **line numbers** (1-based) that were modified/added by the diff.\n // Using a Set ensures uniqueness when the same line is reported by several modes.\n const changedLines: Set<number> = new Set();\n\n /**\n * Extracts line numbers from a diff generated with `--unified=0`.\n * Each hunk header looks like: @@ -<oldStart>,<oldCount> +<newStart>,<newCount> @@\n * We consider both the \"+\" (new) side for additions and the \"-\" (old) side for deletions.\n * For deletions, we add the line before and after the deletion point in the current file.\n */\n const collectLinesFromDiff = (diffOutput: string) => {\n const hunkRegex = /@@ -(\\d+)(?:,(\\d+))? \\+(\\d+)(?:,(\\d+))? @@/g;\n let match: RegExpExecArray | null;\n\n while ((match = hunkRegex.exec(diffOutput)) !== null) {\n const oldCount = match[2] ? Number(match[2]) : 1;\n const newStart = Number(match[3]);\n const newCount = match[4] ? Number(match[4]) : 1;\n\n // Handle additions/modifications (+ side)\n if (newCount > 0) {\n for (let i = 0; i < newCount; i++) {\n changedLines.add(newStart + i);\n }\n }\n\n // Handle deletions (- side)\n if (oldCount > 0 && newCount === 0) {\n // For deletions, add the line before and after the deletion point\n // The deletion point in the new file is at newStart\n if (newStart > 1) {\n changedLines.add(newStart - 1); // Line before deletion\n }\n changedLines.add(newStart); // Line after deletion (if it exists)\n }\n }\n };\n\n // 1. Handle untracked files – when a file is untracked its entire content is new.\n if (mode.includes('untracked')) {\n const status = await git.status();\n const isUntracked = status.not_added.includes(filePath);\n if (isUntracked) {\n try {\n const content = readFileSync(filePath, 'utf-8');\n content.split('\\n').forEach((_, idx) => changedLines.add(idx + 1));\n } catch {\n // ignore read errors – file may have been deleted, etc.\n }\n }\n }\n\n // 2. Uncommitted changes (working tree vs HEAD)\n if (mode.includes('uncommitted')) {\n const diffOutput = await git.diff(['--unified=0', 'HEAD', '--', filePath]);\n collectLinesFromDiff(diffOutput);\n }\n\n // 3. Unpushed commits – compare local branch to its upstream\n if (mode.includes('unpushed')) {\n const diffOutput = await git.diff([\n '--unified=0',\n '@{push}...HEAD',\n '--',\n filePath,\n ]);\n collectLinesFromDiff(diffOutput);\n }\n\n // 4. Regular git diff between baseRef and currentRef (e.g., CI pull-request diff)\n if (mode.includes('gitDiff')) {\n await git.fetch(baseRef);\n const diffOutput = await git.diff([\n '--unified=0',\n `${baseRef}...${currentRef}`,\n '--',\n filePath,\n ]);\n collectLinesFromDiff(diffOutput);\n }\n\n // Return the list sorted for convenience\n return Array.from(changedLines).sort((a, b) => a - b);\n};\n"],"mappings":"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"}
@@ -0,0 +1,70 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __intlayer_config = require("@intlayer/config");
3
+ __intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
4
+ let node_path = require("node:path");
5
+ node_path = require_rolldown_runtime.__toESM(node_path);
6
+ let node_fs_promises = require("node:fs/promises");
7
+ node_fs_promises = require_rolldown_runtime.__toESM(node_fs_promises);
8
+ let node_module = require("node:module");
9
+ node_module = require_rolldown_runtime.__toESM(node_module);
10
+
11
+ //#region src/loadDictionaries/getIntlayerBundle.ts
12
+ /**
13
+ * Rewrites selected bare specifiers (and any of their subpaths) to absolute file paths,
14
+ * using the provided localeRequire (either createRequire(import.meta.url) or require).
15
+ *
16
+ * Example:
17
+ * rewritePathsPlugin(["@intlayer/config", "@intlayer/core"], localeRequire)
18
+ * …will also rewrite "@intlayer/core/file" etc.
19
+ */
20
+ const rewritePathsPlugin = (replaceModules, excludeModules) => {
21
+ return {
22
+ name: "rewrite-paths",
23
+ setup(build) {
24
+ build.onResolve({ filter: /.*/ }, (args) => {
25
+ const exact = replaceModules[args.path];
26
+ if (excludeModules?.includes(args.path)) return null;
27
+ if (exact) return {
28
+ path: exact,
29
+ namespace: "intlayer-replace-modules",
30
+ external: true
31
+ };
32
+ for (const key of Object.keys(replaceModules)) if (args.path === key || args.path.startsWith(`${key}/`)) {
33
+ const sub = args.path.slice(key.length);
34
+ return {
35
+ path: replaceModules[key] + sub,
36
+ namespace: "intlayer-replace-modules",
37
+ external: true
38
+ };
39
+ }
40
+ });
41
+ }
42
+ };
43
+ };
44
+ /**
45
+ * Get the intlayer bundle to embed @intlayer/core and be able to mock @intlayer/config/built to mock the configuration file.
46
+ */
47
+ const getIntlayerBundle = async (configuration) => {
48
+ const rootRequire = __intlayer_config.ESMxCJSRequire;
49
+ const configPackageRequire = __intlayer_config.configESMxCJSRequire;
50
+ const localRequire = __intlayer_config.isESModule ? (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href) : require;
51
+ const configurationPath = (0, node_path.join)(configuration.content.configDir, `configuration.json`);
52
+ const replaceModules = {
53
+ deepmerge: localRequire.resolve("deepmerge"),
54
+ esbuild: configPackageRequire.resolve("esbuild"),
55
+ "@intlayer/config/built": configurationPath,
56
+ "@intlayer/config": localRequire.resolve("@intlayer/config"),
57
+ "@intlayer/config/client": localRequire.resolve("@intlayer/config/client"),
58
+ "@intlayer/core/file": localRequire.resolve("@intlayer/core/file")
59
+ };
60
+ const filePath = rootRequire.resolve("intlayer");
61
+ return await (0, __intlayer_config.bundleFile)(await (0, node_fs_promises.readFile)(filePath, "utf-8"), filePath, {
62
+ external: [...node_module.builtinModules, ...node_module.builtinModules.map((mod) => `node:${mod}`)],
63
+ minify: true,
64
+ plugins: [rewritePathsPlugin(replaceModules)]
65
+ }) ?? "";
66
+ };
67
+
68
+ //#endregion
69
+ exports.getIntlayerBundle = getIntlayerBundle;
70
+ //# sourceMappingURL=getIntlayerBundle.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getIntlayerBundle.cjs","names":["ESMxCJSRequire","configESMxCJSRequire","isESModule","builtinModules"],"sources":["../../../src/loadDictionaries/getIntlayerBundle.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { builtinModules, createRequire } from 'node:module';\nimport { join } from 'node:path';\nimport type { ESBuildPlugin } from '@intlayer/config';\nimport {\n bundleFile,\n configESMxCJSRequire,\n ESMxCJSRequire,\n isESModule,\n} from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\n\n/**\n * Rewrites selected bare specifiers (and any of their subpaths) to absolute file paths,\n * using the provided localeRequire (either createRequire(import.meta.url) or require).\n *\n * Example:\n * rewritePathsPlugin([\"@intlayer/config\", \"@intlayer/core\"], localeRequire)\n * …will also rewrite \"@intlayer/core/file\" etc.\n */\nconst rewritePathsPlugin = (\n replaceModules: Record<string, string>,\n excludeModules?: string[]\n): ESBuildPlugin => {\n return {\n name: 'rewrite-paths',\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n const exact = replaceModules[args.path];\n\n if (excludeModules?.includes(args.path)) {\n return null;\n }\n\n if (exact) {\n return {\n path: exact,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n\n // Optional: support subpaths like \"@intlayer/core/xyz\"\n for (const key of Object.keys(replaceModules)) {\n if (args.path === key || args.path.startsWith(`${key}/`)) {\n const sub = args.path.slice(key.length); // '' or '/...'\n return {\n path: replaceModules[key] + sub,\n namespace: 'intlayer-replace-modules',\n external: true, // ← prevents onLoad requirement\n };\n }\n }\n });\n },\n };\n};\n\n/**\n * Get the intlayer bundle to embed @intlayer/core and be able to mock @intlayer/config/built to mock the configuration file.\n */\nexport const getIntlayerBundle = async (configuration: IntlayerConfig) => {\n const rootRequire = ESMxCJSRequire;\n const configPackageRequire = configESMxCJSRequire;\n const localRequire = isESModule ? createRequire(import.meta.url) : require;\n\n const configurationPath = join(\n configuration.content.configDir,\n `configuration.json`\n );\n\n const replaceModules = {\n deepmerge: localRequire.resolve('deepmerge'),\n esbuild: configPackageRequire.resolve('esbuild'),\n '@intlayer/config/built': configurationPath,\n '@intlayer/config': localRequire.resolve('@intlayer/config'),\n '@intlayer/config/client': localRequire.resolve('@intlayer/config/client'),\n '@intlayer/core/file': localRequire.resolve('@intlayer/core/file'),\n };\n\n const filePath = rootRequire.resolve('intlayer');\n const code = await readFile(filePath, 'utf-8');\n\n const output = await bundleFile(code, filePath, {\n external: [\n ...builtinModules,\n ...builtinModules.map((mod) => `node:${mod}`),\n ],\n minify: true,\n plugins: [rewritePathsPlugin(replaceModules)],\n });\n\n return output ?? '';\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,MAAM,sBACJ,gBACA,mBACkB;AAClB,QAAO;EACL,MAAM;EACN,MAAM,OAAO;AACX,SAAM,UAAU,EAAE,QAAQ,MAAM,GAAG,SAAS;IAC1C,MAAM,QAAQ,eAAe,KAAK;AAElC,QAAI,gBAAgB,SAAS,KAAK,KAAK,CACrC,QAAO;AAGT,QAAI,MACF,QAAO;KACL,MAAM;KACN,WAAW;KACX,UAAU;KACX;AAIH,SAAK,MAAM,OAAO,OAAO,KAAK,eAAe,CAC3C,KAAI,KAAK,SAAS,OAAO,KAAK,KAAK,WAAW,GAAG,IAAI,GAAG,EAAE;KACxD,MAAM,MAAM,KAAK,KAAK,MAAM,IAAI,OAAO;AACvC,YAAO;MACL,MAAM,eAAe,OAAO;MAC5B,WAAW;MACX,UAAU;MACX;;KAGL;;EAEL;;;;;AAMH,MAAa,oBAAoB,OAAO,kBAAkC;CACxE,MAAM,cAAcA;CACpB,MAAM,uBAAuBC;CAC7B,MAAM,eAAeC,4GAA2C,GAAG;CAEnE,MAAM,wCACJ,cAAc,QAAQ,WACtB,qBACD;CAED,MAAM,iBAAiB;EACrB,WAAW,aAAa,QAAQ,YAAY;EAC5C,SAAS,qBAAqB,QAAQ,UAAU;EAChD,0BAA0B;EAC1B,oBAAoB,aAAa,QAAQ,mBAAmB;EAC5D,2BAA2B,aAAa,QAAQ,0BAA0B;EAC1E,uBAAuB,aAAa,QAAQ,sBAAsB;EACnE;CAED,MAAM,WAAW,YAAY,QAAQ,WAAW;AAYhD,QATe,wCAFF,qCAAe,UAAU,QAAQ,EAER,UAAU;EAC9C,UAAU,CACR,GAAGC,4BACH,GAAGA,2BAAe,KAAK,QAAQ,QAAQ,MAAM,CAC9C;EACD,QAAQ;EACR,SAAS,CAAC,mBAAmB,eAAe,CAAC;EAC9C,CAAC,IAEe"}
@@ -1,29 +1,11 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var loadDictionaries_exports = {};
17
- module.exports = __toCommonJS(loadDictionaries_exports);
18
- __reExport(loadDictionaries_exports, require('./loadContentDeclaration.cjs'), module.exports);
19
- __reExport(loadDictionaries_exports, require('./loadDictionaries.cjs'), module.exports);
20
- __reExport(loadDictionaries_exports, require('./loadLocalDictionaries.cjs'), module.exports);
21
- __reExport(loadDictionaries_exports, require('./loadRemoteDictionaries.cjs'), module.exports);
22
- // Annotate the CommonJS export names for ESM import in node:
23
- 0 && (module.exports = {
24
- ...require('./loadContentDeclaration.cjs'),
25
- ...require('./loadDictionaries.cjs'),
26
- ...require('./loadLocalDictionaries.cjs'),
27
- ...require('./loadRemoteDictionaries.cjs')
28
- });
29
- //# sourceMappingURL=index.cjs.map
1
+ const require_loadDictionaries_loadContentDeclaration = require('./loadContentDeclaration.cjs');
2
+ const require_loadDictionaries_loadLocalDictionaries = require('./loadLocalDictionaries.cjs');
3
+ const require_loadDictionaries_loadRemoteDictionaries = require('./loadRemoteDictionaries.cjs');
4
+ const require_loadDictionaries_loadDictionaries = require('./loadDictionaries.cjs');
5
+
6
+ exports.formatDistantDictionaries = require_loadDictionaries_loadRemoteDictionaries.formatDistantDictionaries;
7
+ exports.formatLocalDictionaries = require_loadDictionaries_loadContentDeclaration.formatLocalDictionaries;
8
+ exports.loadContentDeclarations = require_loadDictionaries_loadContentDeclaration.loadContentDeclarations;
9
+ exports.loadDictionaries = require_loadDictionaries_loadDictionaries.loadDictionaries;
10
+ exports.loadLocalDictionaries = require_loadDictionaries_loadLocalDictionaries.loadLocalDictionaries;
11
+ exports.loadRemoteDictionaries = require_loadDictionaries_loadRemoteDictionaries.loadRemoteDictionaries;
@@ -1,93 +1,71 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var loadContentDeclaration_exports = {};
20
- __export(loadContentDeclaration_exports, {
21
- formatLocalDictionaries: () => formatLocalDictionaries,
22
- loadContentDeclarations: () => loadContentDeclarations
23
- });
24
- module.exports = __toCommonJS(loadContentDeclaration_exports);
25
- var import_config = require("@intlayer/config");
26
- var import_path = require("path");
27
- var import_processContentDeclaration = require('../buildIntlayerDictionary/processContentDeclaration.cjs');
28
- var import_filterInvalidDictionaries = require('../filterInvalidDictionaries.cjs');
29
- var import_parallelize = require('../utils/parallelize.cjs');
30
- const formatLocalDictionaries = (dictionariesRecord, configuration) => Object.entries(dictionariesRecord).filter(([_relativePath, dict]) => (0, import_filterInvalidDictionaries.isInvalidDictionary)(dict, configuration)).map(([relativePath, dict]) => ({
31
- ...dict,
32
- localId: `${dict.key}::local::${relativePath}`,
33
- location: "locale",
34
- filePath: relativePath
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_utils_parallelize = require('../utils/parallelize.cjs');
3
+ const require_filterInvalidDictionaries = require('../filterInvalidDictionaries.cjs');
4
+ const require_buildIntlayerDictionary_processContentDeclaration = require('../buildIntlayerDictionary/processContentDeclaration.cjs');
5
+ const require_loadDictionaries_getIntlayerBundle = require('./getIntlayerBundle.cjs');
6
+ let __intlayer_config = require("@intlayer/config");
7
+ __intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
8
+ let node_path = require("node:path");
9
+ node_path = require_rolldown_runtime.__toESM(node_path);
10
+ let node_fs_promises = require("node:fs/promises");
11
+ node_fs_promises = require_rolldown_runtime.__toESM(node_fs_promises);
12
+
13
+ //#region src/loadDictionaries/loadContentDeclaration.ts
14
+ const formatLocalDictionaries = (dictionariesRecord, configuration) => Object.entries(dictionariesRecord).filter(([_relativePath, dict]) => require_filterInvalidDictionaries.isInvalidDictionary(dict, configuration)).map(([relativePath, dict]) => ({
15
+ ...dict,
16
+ localId: `${dict.key}::local::${relativePath}`,
17
+ location: "local",
18
+ filePath: relativePath
35
19
  }));
36
- const loadContentDeclarations = async (contentDeclarationFilePath, configuration = (0, import_config.getConfiguration)(), projectRequire = import_config.ESMxCJSRequire, onStatusUpdate) => {
37
- const dictionariesRecord = contentDeclarationFilePath.reduce(
38
- (acc, path) => {
39
- const relativePath = (0, import_path.relative)(configuration.content.baseDir, path);
40
- return {
41
- ...acc,
42
- [relativePath]: (0, import_config.loadExternalFile)(path, void 0, projectRequire)
43
- };
44
- },
45
- {}
46
- );
47
- const contentDeclarations = formatLocalDictionaries(
48
- dictionariesRecord,
49
- configuration
50
- );
51
- const listFoundDictionaries = contentDeclarations.map((declaration) => ({
52
- dictionaryKey: declaration.key,
53
- type: "local",
54
- status: "found"
55
- }));
56
- onStatusUpdate?.(listFoundDictionaries);
57
- const processedDictionaries = await (0, import_parallelize.parallelize)(
58
- contentDeclarations,
59
- async (contentDeclaration) => {
60
- if (!contentDeclaration) {
61
- return void 0;
62
- }
63
- onStatusUpdate?.([
64
- {
65
- dictionaryKey: contentDeclaration.key,
66
- type: "local",
67
- status: "building"
68
- }
69
- ]);
70
- const processedContentDeclaration = await (0, import_processContentDeclaration.processContentDeclaration)(
71
- contentDeclaration
72
- );
73
- if (!processedContentDeclaration) {
74
- return void 0;
75
- }
76
- onStatusUpdate?.([
77
- {
78
- dictionaryKey: processedContentDeclaration.key,
79
- type: "local",
80
- status: "built"
81
- }
82
- ]);
83
- return processedContentDeclaration;
84
- }
85
- );
86
- return (0, import_filterInvalidDictionaries.filterInvalidDictionaries)(processedDictionaries);
20
+ const loadContentDeclarations = async (contentDeclarationFilePath, configuration, onStatusUpdate) => {
21
+ const { build, content } = configuration;
22
+ const { set, isValid } = (0, __intlayer_config.localCache)(configuration, ["intlayer-bundle"], { ttlMs: 1e3 * 60 * 60 * 24 * 5 });
23
+ const filePath = (0, node_path.join)(content.cacheDir, "intlayer-bundle.cjs");
24
+ if (!await isValid()) {
25
+ await (0, node_fs_promises.writeFile)(filePath, await require_loadDictionaries_getIntlayerBundle.getIntlayerBundle(configuration));
26
+ await set("ok");
27
+ }
28
+ try {
29
+ const dictionariesPromises = contentDeclarationFilePath.map(async (path) => {
30
+ return {
31
+ relativePath: (0, node_path.relative)(configuration.content.baseDir, path),
32
+ dictionary: await (0, __intlayer_config.loadExternalFile)(path, {
33
+ projectRequire: build.require,
34
+ buildOptions: { banner: { js: [`globalThis.INTLAYER_FILE_PATH = '${path}';`, `globalThis.INTLAYER_BASE_DIR = '${configuration.content.baseDir}';`].join("\n") } },
35
+ aliases: { intlayer: filePath }
36
+ })
37
+ };
38
+ });
39
+ const contentDeclarations = formatLocalDictionaries((await Promise.all(dictionariesPromises)).reduce((acc, { relativePath, dictionary }) => {
40
+ acc[relativePath] = dictionary;
41
+ return acc;
42
+ }, {}), configuration);
43
+ const listFoundDictionaries = contentDeclarations.map((declaration) => ({
44
+ dictionaryKey: declaration.key,
45
+ type: "local",
46
+ status: "found"
47
+ }));
48
+ onStatusUpdate?.(listFoundDictionaries);
49
+ return require_filterInvalidDictionaries.filterInvalidDictionaries(await require_utils_parallelize.parallelize(contentDeclarations, async (contentDeclaration) => {
50
+ if (!contentDeclaration) return;
51
+ onStatusUpdate?.([{
52
+ dictionaryKey: contentDeclaration.key,
53
+ type: "local",
54
+ status: "building"
55
+ }]);
56
+ const processedContentDeclaration = await require_buildIntlayerDictionary_processContentDeclaration.processContentDeclaration(contentDeclaration);
57
+ if (!processedContentDeclaration) return;
58
+ onStatusUpdate?.([{
59
+ dictionaryKey: processedContentDeclaration.key,
60
+ type: "local",
61
+ status: "built"
62
+ }]);
63
+ return processedContentDeclaration;
64
+ }), configuration);
65
+ } finally {}
87
66
  };
88
- // Annotate the CommonJS export names for ESM import in node:
89
- 0 && (module.exports = {
90
- formatLocalDictionaries,
91
- loadContentDeclarations
92
- });
67
+
68
+ //#endregion
69
+ exports.formatLocalDictionaries = formatLocalDictionaries;
70
+ exports.loadContentDeclarations = loadContentDeclarations;
93
71
  //# sourceMappingURL=loadContentDeclaration.cjs.map