@intlayer/chokidar 8.4.0 → 8.4.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 (284) hide show
  1. package/dist/cjs/_utils_asset-SJVy1xMD.cjs +2 -0
  2. package/dist/cjs/build.cjs +1 -1
  3. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +1 -1
  4. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
  5. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +1 -1
  6. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -1
  7. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +1 -1
  8. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
  9. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +1 -1
  10. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -1
  11. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +1 -1
  12. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -1
  13. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +1 -1
  14. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -1
  15. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +1 -1
  16. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -1
  17. package/dist/cjs/{_virtual/_rolldown/runtime.cjs → chunk-Bmb41Sf3.cjs} +1 -1
  18. package/dist/cjs/cleanOutputDir.cjs +1 -1
  19. package/dist/cjs/cleanOutputDir.cjs.map +1 -1
  20. package/dist/cjs/cleanRemovedContentDeclaration.cjs +1 -1
  21. package/dist/cjs/cleanRemovedContentDeclaration.cjs.map +1 -1
  22. package/dist/cjs/cli.cjs +1 -1
  23. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +1 -1
  24. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
  25. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +1 -1
  26. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
  27. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +1 -1
  28. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -1
  29. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +1 -1
  30. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -1
  31. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +1 -1
  32. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -1
  33. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +1 -1
  34. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -1
  35. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +1 -1
  36. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -1
  37. package/dist/cjs/createType/createModuleAugmentation.cjs +1 -1
  38. package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -1
  39. package/dist/cjs/createType/createType.cjs +1 -1
  40. package/dist/cjs/createType/createType.cjs.map +1 -1
  41. package/dist/cjs/detectFormatCommand.cjs +1 -1
  42. package/dist/cjs/detectFormatCommand.cjs.map +1 -1
  43. package/dist/cjs/fetchDistantDictionaries.cjs +1 -1
  44. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  45. package/dist/cjs/filterInvalidDictionaries.cjs +1 -1
  46. package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
  47. package/dist/cjs/formatDictionary.cjs +1 -1
  48. package/dist/cjs/formatDictionary.cjs.map +1 -1
  49. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +1 -1
  50. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -1
  51. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +1 -1
  52. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -1
  53. package/dist/cjs/handleContentDeclarationFileChange.cjs +1 -1
  54. package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -1
  55. package/dist/cjs/handleContentDeclarationFileMoved.cjs +1 -1
  56. package/dist/cjs/handleContentDeclarationFileMoved.cjs.map +1 -1
  57. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +1 -1
  58. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -1
  59. package/dist/cjs/init/index.cjs +1 -1
  60. package/dist/cjs/init/index.cjs.map +1 -1
  61. package/dist/cjs/init/utils/configManipulation.cjs +1 -1
  62. package/dist/cjs/init/utils/configManipulation.cjs.map +1 -1
  63. package/dist/cjs/init/utils/fileSystem.cjs +1 -1
  64. package/dist/cjs/init/utils/fileSystem.cjs.map +1 -1
  65. package/dist/cjs/init/utils/tsConfig.cjs +1 -1
  66. package/dist/cjs/init/utils/tsConfig.cjs.map +1 -1
  67. package/dist/cjs/initConfig/index.cjs +1 -1
  68. package/dist/cjs/initConfig/index.cjs.map +1 -1
  69. package/dist/cjs/installMCP/installMCP.cjs +1 -1
  70. package/dist/cjs/installMCP/installMCP.cjs.map +1 -1
  71. package/dist/cjs/installSkills/index.cjs +1 -1
  72. package/dist/cjs/installSkills/index.cjs.map +1 -1
  73. package/dist/cjs/listDictionariesPath.cjs +1 -1
  74. package/dist/cjs/listDictionariesPath.cjs.map +1 -1
  75. package/dist/cjs/listGitFiles.cjs +1 -1
  76. package/dist/cjs/listGitFiles.cjs.map +1 -1
  77. package/dist/cjs/listProjects.cjs +1 -1
  78. package/dist/cjs/listProjects.cjs.map +1 -1
  79. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +1 -1
  80. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -1
  81. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +1 -1
  82. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  83. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +1 -1
  84. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  85. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +1 -1
  86. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
  87. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +1 -1
  88. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
  89. package/dist/cjs/loadDictionaries/log.cjs +1 -1
  90. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  91. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs +1 -1
  92. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs.map +1 -1
  93. package/dist/cjs/logConfigDetails.cjs +1 -1
  94. package/dist/cjs/logConfigDetails.cjs.map +1 -1
  95. package/dist/cjs/prepareIntlayer.cjs +1 -1
  96. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  97. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +1 -1
  98. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
  99. package/dist/cjs/utils/autoDecorateContent.cjs +1 -1
  100. package/dist/cjs/utils/autoDecorateContent.cjs.map +1 -1
  101. package/dist/cjs/utils/buildComponentFilesList.cjs +1 -1
  102. package/dist/cjs/utils/buildComponentFilesList.cjs.map +1 -1
  103. package/dist/cjs/utils/buildFilesList.cjs +1 -1
  104. package/dist/cjs/utils/buildFilesList.cjs.map +1 -1
  105. package/dist/cjs/utils/formatter.cjs +1 -1
  106. package/dist/cjs/utils/formatter.cjs.map +1 -1
  107. package/dist/cjs/utils/getPathHash.cjs +1 -1
  108. package/dist/cjs/utils/getPathHash.cjs.map +1 -1
  109. package/dist/cjs/utils/resolveRelativePath.cjs +1 -1
  110. package/dist/cjs/utils/resolveRelativePath.cjs.map +1 -1
  111. package/dist/cjs/utils/runOnce.cjs +1 -1
  112. package/dist/cjs/utils/runOnce.cjs.map +1 -1
  113. package/dist/cjs/utils/runParallel/bin.cjs +1 -1
  114. package/dist/cjs/utils/runParallel/bin.cjs.map +1 -1
  115. package/dist/cjs/utils/runParallel/index.cjs +1 -1
  116. package/dist/cjs/utils/runParallel/index.cjs.map +1 -1
  117. package/dist/cjs/utils/runParallel/pidTree.cjs +1 -1
  118. package/dist/cjs/utils/runParallel/pidTree.cjs.map +1 -1
  119. package/dist/cjs/utils/runParallel/ps.cjs +1 -1
  120. package/dist/cjs/utils/runParallel/ps.cjs.map +1 -1
  121. package/dist/cjs/utils/runParallel/runTask.cjs +1 -1
  122. package/dist/cjs/utils/runParallel/runTask.cjs.map +1 -1
  123. package/dist/cjs/utils/runParallel/spawnPosix.cjs +1 -1
  124. package/dist/cjs/utils/runParallel/spawnPosix.cjs.map +1 -1
  125. package/dist/cjs/utils/runParallel/spawnWin32.cjs +1 -1
  126. package/dist/cjs/utils/runParallel/spawnWin32.cjs.map +1 -1
  127. package/dist/cjs/utils/runParallel/wmic.cjs +1 -1
  128. package/dist/cjs/utils/runParallel/wmic.cjs.map +1 -1
  129. package/dist/cjs/watcher.cjs +1 -1
  130. package/dist/cjs/watcher.cjs.map +1 -1
  131. package/dist/cjs/writeConfiguration/index.cjs +1 -1
  132. package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
  133. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +1 -1
  134. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -1
  135. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +1 -1
  136. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
  137. package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs +1 -1
  138. package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs.map +1 -1
  139. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +1 -1
  140. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  141. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +1 -1
  142. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
  143. package/dist/cjs/writeFileIfChanged.cjs +1 -1
  144. package/dist/cjs/writeFileIfChanged.cjs.map +1 -1
  145. package/dist/esm/{_virtual/_utils_asset.mjs → _utils_asset-4w8dPH9r.mjs} +1 -1
  146. package/dist/esm/build.mjs +1 -1
  147. package/dist/esm/{_virtual/_rolldown/runtime.mjs → chunk-DDgYwkfe.mjs} +1 -1
  148. package/dist/esm/cli.mjs +1 -1
  149. package/dist/esm/init/index.mjs +1 -1
  150. package/dist/esm/init/index.mjs.map +1 -1
  151. package/dist/esm/init/utils/configManipulation.mjs +1 -1
  152. package/dist/esm/init/utils/configManipulation.mjs.map +1 -1
  153. package/dist/esm/initConfig/index.mjs +1 -1
  154. package/dist/esm/initConfig/index.mjs.map +1 -1
  155. package/dist/esm/installMCP/installMCP.mjs +1 -1
  156. package/dist/esm/installMCP/installMCP.mjs.map +1 -1
  157. package/dist/esm/installSkills/index.mjs +1 -1
  158. package/dist/esm/installSkills/index.mjs.map +1 -1
  159. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +1 -1
  160. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -1
  161. package/dist/esm/utils/formatter.mjs +1 -1
  162. package/dist/esm/utils/formatter.mjs.map +1 -1
  163. package/dist/esm/watcher.mjs +1 -1
  164. package/dist/esm/watcher.mjs.map +1 -1
  165. package/dist/esm/writeConfiguration/index.mjs +1 -1
  166. package/dist/esm/writeConfiguration/index.mjs.map +1 -1
  167. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -1
  168. package/dist/types/build.d.ts +20 -20
  169. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +2 -24
  170. package/dist/types/buildIntlayerDictionary/index.d.ts +2 -2
  171. package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts +2 -11
  172. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +2 -36
  173. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +1 -1
  174. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -1
  175. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +2 -30
  176. package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts +2 -34
  177. package/dist/types/buildIntlayerDictionary-BGj5jDFy.d.ts +24 -0
  178. package/dist/types/buildIntlayerDictionary-BGj5jDFy.d.ts.map +1 -0
  179. package/dist/types/cli.d.ts +6 -6
  180. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +2 -14
  181. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +2 -10
  182. package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts +2 -10
  183. package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts +2 -10
  184. package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts +2 -10
  185. package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts +2 -10
  186. package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts +2 -10
  187. package/dist/types/createDictionaryEntryPoint/index.d.ts +7 -7
  188. package/dist/types/createDictionaryEntryPoint-Bc5lHSiY.d.ts +14 -0
  189. package/dist/types/createDictionaryEntryPoint-Bc5lHSiY.d.ts.map +1 -0
  190. package/dist/types/createModuleAugmentation-D1eIVnjg.d.ts +9 -0
  191. package/dist/types/createModuleAugmentation-D1eIVnjg.d.ts.map +1 -0
  192. package/dist/types/createType/createModuleAugmentation.d.ts +2 -9
  193. package/dist/types/createType/createType.d.ts +2 -12
  194. package/dist/types/createType/index.d.ts +2 -2
  195. package/dist/types/createType--rDwdg2t.d.ts +12 -0
  196. package/dist/types/createType--rDwdg2t.d.ts.map +1 -0
  197. package/dist/types/detectExportedComponentName-DVXsp_FG.d.ts +12 -0
  198. package/dist/types/detectExportedComponentName-DVXsp_FG.d.ts.map +1 -0
  199. package/dist/types/dictionaryStatus-DPVO37qe.d.ts +5 -0
  200. package/dist/types/dictionaryStatus-DPVO37qe.d.ts.map +1 -0
  201. package/dist/types/fetchDistantDictionaries.d.ts +1 -1
  202. package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
  203. package/dist/types/generateDictionaryListContent-DAtHG6SR.d.ts +10 -0
  204. package/dist/types/generateDictionaryListContent-DAtHG6SR.d.ts.map +1 -0
  205. package/dist/types/getBuiltDictionariesPath-C4it65a1.d.ts +10 -0
  206. package/dist/types/getBuiltDictionariesPath-C4it65a1.d.ts.map +1 -0
  207. package/dist/types/getBuiltDynamicDictionariesPath-Cj9EWnjT.d.ts +10 -0
  208. package/dist/types/getBuiltDynamicDictionariesPath-Cj9EWnjT.d.ts.map +1 -0
  209. package/dist/types/getBuiltFetchDictionariesPath-1JleRhT3.d.ts +10 -0
  210. package/dist/types/getBuiltFetchDictionariesPath-1JleRhT3.d.ts.map +1 -0
  211. package/dist/types/getBuiltRemoteDictionariesPath-DHOmqNCr.d.ts +10 -0
  212. package/dist/types/getBuiltRemoteDictionariesPath-DHOmqNCr.d.ts.map +1 -0
  213. package/dist/types/getBuiltUnmergedDictionariesPath-GUmmLxTB.d.ts +10 -0
  214. package/dist/types/getBuiltUnmergedDictionariesPath-GUmmLxTB.d.ts.map +1 -0
  215. package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts +2 -7
  216. package/dist/types/getContentDeclarationFileTemplate/index.d.ts +1 -1
  217. package/dist/types/getContentDeclarationFileTemplate-Dz3rnFy9.d.ts +7 -0
  218. package/dist/types/getContentDeclarationFileTemplate-Dz3rnFy9.d.ts.map +1 -0
  219. package/dist/types/getFormatFromExtension-SdXYWfPx.d.ts +8 -0
  220. package/dist/types/getFormatFromExtension-SdXYWfPx.d.ts.map +1 -0
  221. package/dist/types/loadContentDeclaration-CBMS4vkA.d.ts +12 -0
  222. package/dist/types/loadContentDeclaration-CBMS4vkA.d.ts.map +1 -0
  223. package/dist/types/loadDictionaries/index.d.ts +4 -4
  224. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +2 -12
  225. package/dist/types/loadDictionaries/loadDictionaries.d.ts +2 -23
  226. package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts +2 -8
  227. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +2 -15
  228. package/dist/types/loadDictionaries/log.d.ts +1 -1
  229. package/dist/types/loadDictionaries-BIqHwtYE.d.ts +23 -0
  230. package/dist/types/loadDictionaries-BIqHwtYE.d.ts.map +1 -0
  231. package/dist/types/loadLocalDictionaries-CNmVaw0c.d.ts +8 -0
  232. package/dist/types/loadLocalDictionaries-CNmVaw0c.d.ts.map +1 -0
  233. package/dist/types/loadRemoteDictionaries-MoITTb7W.d.ts +15 -0
  234. package/dist/types/loadRemoteDictionaries-MoITTb7W.d.ts.map +1 -0
  235. package/dist/types/processContentDeclaration-CAvrHaIT.d.ts +11 -0
  236. package/dist/types/processContentDeclaration-CAvrHaIT.d.ts.map +1 -0
  237. package/dist/types/transformJSFile-Cg0LkeLb.d.ts +11 -0
  238. package/dist/types/transformJSFile-Cg0LkeLb.d.ts.map +1 -0
  239. package/dist/types/utils/getFormatFromExtension.d.ts +2 -8
  240. package/dist/types/utils/index.d.ts +1 -1
  241. package/dist/types/writeConfiguration/index.d.ts.map +1 -1
  242. package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts +2 -12
  243. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts +2 -5
  244. package/dist/types/writeContentDeclaration/index.d.ts +5 -5
  245. package/dist/types/writeContentDeclaration/transformJSFile.d.ts +2 -11
  246. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +2 -19
  247. package/dist/types/writeContentDeclaration/writeJSFile.d.ts +2 -14
  248. package/dist/types/writeContentDeclaration-XdGxj0KP.d.ts +19 -0
  249. package/dist/types/writeContentDeclaration-XdGxj0KP.d.ts.map +1 -0
  250. package/dist/types/writeDynamicDictionary-DE3SJg-g.d.ts +36 -0
  251. package/dist/types/writeDynamicDictionary-DE3SJg-g.d.ts.map +1 -0
  252. package/dist/types/writeJSFile-kK95jzg_.d.ts +14 -0
  253. package/dist/types/writeJSFile-kK95jzg_.d.ts.map +1 -0
  254. package/dist/types/writeMergedDictionary-C4EvgXbL.d.ts +30 -0
  255. package/dist/types/writeMergedDictionary-C4EvgXbL.d.ts.map +1 -0
  256. package/dist/types/writeUnmergedDictionary-Cxx51isz.d.ts +34 -0
  257. package/dist/types/writeUnmergedDictionary-Cxx51isz.d.ts.map +1 -0
  258. package/package.json +8 -8
  259. package/dist/cjs/_virtual/_utils_asset.cjs +0 -2
  260. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +0 -1
  261. package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts.map +0 -1
  262. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +0 -1
  263. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +0 -1
  264. package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts.map +0 -1
  265. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +0 -1
  266. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +0 -1
  267. package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts.map +0 -1
  268. package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts.map +0 -1
  269. package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts.map +0 -1
  270. package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts.map +0 -1
  271. package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts.map +0 -1
  272. package/dist/types/createType/createModuleAugmentation.d.ts.map +0 -1
  273. package/dist/types/createType/createType.d.ts.map +0 -1
  274. package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts.map +0 -1
  275. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +0 -1
  276. package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +0 -1
  277. package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts.map +0 -1
  278. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +0 -1
  279. package/dist/types/utils/getFormatFromExtension.d.ts.map +0 -1
  280. package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts.map +0 -1
  281. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts.map +0 -1
  282. package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +0 -1
  283. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +0 -1
  284. package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +0 -1
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../writeFileIfChanged.cjs`),n=require(`../utils/getPathHash.cjs`);let r=require(`node:fs/promises`),i=require(`node:path`),a=require(`fast-glob`);a=e.__toESM(a);let o=require(`@intlayer/config/utils`),s=require(`zod-to-ts`);const c=e=>`${(0,o.kebabCaseToCamelCase)(e)}Content`,l=e=>e.map(e=>` "${e}": 1;`).join(`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../chunk-Bmb41Sf3.cjs`),t=require(`../writeFileIfChanged.cjs`),n=require(`../utils/getPathHash.cjs`);let r=require(`node:fs/promises`),i=require(`node:path`),a=require(`fast-glob`);a=e.t(a);let o=require(`@intlayer/config/utils`),s=require(`zod-to-ts`);const c=e=>`${(0,o.kebabCaseToCamelCase)(e)}Content`,l=e=>e.map(e=>` "${e}": 1;`).join(`
2
2
  `),u=e=>{if(!e)return`any`;let t=e._def??e.def??e;switch(t.typeName??t.type){case`ZodString`:case`string`:return`string`;case`ZodNumber`:case`number`:return`number`;case`ZodBoolean`:case`boolean`:return`boolean`;case`ZodNull`:case`null`:return`null`;case`ZodUndefined`:case`undefined`:return`undefined`;case`ZodArray`:case`array`:return`${u(t.type??t.element)}[]`;case`ZodObject`:case`object`:{let e=typeof t.shape==`function`?t.shape():t.shape;return e?`{\n${Object.entries(e).map(([e,t])=>` "${e}": ${u(t)};`).join(`
3
3
  `)}\n }`:`Record<string, any>`}case`ZodOptional`:case`optional`:return`${u(t.innerType??t.wrapped)} | undefined`;case`ZodNullable`:case`nullable`:return`${u(t.innerType??t.wrapped)} | null`;case`ZodUnion`:case`union`:return(t.options??[]).map(u).join(` | `);case`ZodIntersection`:case`intersection`:return`${u(t.left)} & ${u(t.right)}`;case`ZodEnum`:case`enum`:return(t.values??[]).map(e=>`"${e}"`).join(` | `);case`ZodLiteral`:case`literal`:{let e=t.value;return typeof e==`string`?`"${e}"`:String(e)}default:return`any`}},d=(e,t)=>{let{internationalization:r,system:a,editor:o}=t,{moduleAugmentationDir:c}=a,{enabled:d}=o,{locales:f,requiredLocales:p,strictMode:m}=r,h=`import "intlayer";
4
4
  `,g=e.map(e=>({relativePath:`./${(0,i.relative)(c,e)}`,id:(0,i.basename)(e,(0,i.extname)(e)),hash:`_${n.getPathHash(e)}`}));for(let e of g)h+=`import ${e.hash} from '${e.relativePath}';\n`;h+=`
@@ -1 +1 @@
1
- {"version":3,"file":"createModuleAugmentation.cjs","names":["getPathHash","writeFileIfChanged"],"sources":["../../../src/createType/createModuleAugmentation.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { basename, extname, join, relative } from 'node:path';\nimport { kebabCaseToCamelCase, normalizePath } from '@intlayer/config/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport fg from 'fast-glob';\nimport { createAuxiliaryTypeStore, printNode, zodToTs } from 'zod-to-ts';\nimport { getPathHash } from '../utils';\nimport { writeFileIfChanged } from '../writeFileIfChanged';\n\nexport const getTypeName = (key: string): string =>\n `${kebabCaseToCamelCase(key)}Content`;\n\n/** Returns lines like: [Locales.FRENCH]: 1; */\nconst formatLocales = (locales: Locale[]) =>\n locales.map((locale) => ` \"${locale}\": 1;`).join('\\n');\n\nconst zodToTsString = (schema: any): string => {\n if (!schema) return 'any';\n\n // Support both real Zod objects (_def) and serialized versions (def or nested)\n const def = schema._def ?? schema.def ?? schema;\n\n // Handle serialized type names (sometimes 'type' instead of 'typeName')\n const typeName = def.typeName ?? def.type;\n\n switch (typeName) {\n case 'ZodString':\n case 'string':\n return 'string';\n case 'ZodNumber':\n case 'number':\n return 'number';\n case 'ZodBoolean':\n case 'boolean':\n return 'boolean';\n case 'ZodNull':\n case 'null':\n return 'null';\n case 'ZodUndefined':\n case 'undefined':\n return 'undefined';\n case 'ZodArray':\n case 'array':\n return `${zodToTsString(def.type ?? def.element)}[]`;\n case 'ZodObject':\n case 'object': {\n const shape = typeof def.shape === 'function' ? def.shape() : def.shape;\n if (!shape) return 'Record<string, any>';\n\n const entries = Object.entries(shape)\n .map(([k, v]) => ` \"${k}\": ${zodToTsString(v)};`)\n .join('\\n');\n return `{\\n${entries}\\n }`;\n }\n case 'ZodOptional':\n case 'optional':\n return `${zodToTsString(def.innerType ?? def.wrapped)} | undefined`;\n case 'ZodNullable':\n case 'nullable':\n return `${zodToTsString(def.innerType ?? def.wrapped)} | null`;\n case 'ZodUnion':\n case 'union': {\n const options = def.options ?? [];\n return options.map(zodToTsString).join(' | ');\n }\n case 'ZodIntersection':\n case 'intersection':\n return `${zodToTsString(def.left)} & ${zodToTsString(def.right)}`;\n case 'ZodEnum':\n case 'enum': {\n const values = def.values ?? [];\n return values.map((v: string) => `\"${v}\"`).join(' | ');\n }\n case 'ZodLiteral':\n case 'literal': {\n const value = def.value;\n return typeof value === 'string' ? `\"${value}\"` : String(value);\n }\n default:\n return 'any';\n }\n};\n\n/** Generate the content of the module augmentation file */\nconst generateTypeIndexContent = (\n typeFiles: string[],\n configuration: IntlayerConfig\n): string => {\n const { internationalization, system, editor } = configuration;\n const { moduleAugmentationDir } = system;\n const { enabled } = editor;\n const { locales, requiredLocales, strictMode } = internationalization;\n\n let fileContent = 'import \"intlayer\";\\n';\n\n // Build dictionary refs\n const dictionariesRef = typeFiles.map((dictionaryPath) => ({\n relativePath: `./${relative(moduleAugmentationDir, dictionaryPath)}`,\n id: basename(dictionaryPath, extname(dictionaryPath)),\n hash: `_${getPathHash(dictionaryPath)}`,\n }));\n\n // Import all dictionaries\n for (const dictionary of dictionariesRef) {\n fileContent += `import ${dictionary.hash} from '${dictionary.relativePath}';\\n`;\n }\n fileContent += '\\n';\n\n // Dictionary map entries (id: typeof <hash>)\n const formattedDictionaryMap: string = dictionariesRef\n .map((dictionary) => ` \"${dictionary.id}\": typeof ${dictionary.hash};`)\n .join('\\n');\n\n // Ensure required ⊆ declared; if empty, default required = declared\n const declared = locales;\n const requiredSanitized = requiredLocales?.length\n ? requiredLocales.filter((requiredLocales) =>\n declared.includes(requiredLocales)\n )\n : declared;\n\n const formattedDeclaredLocales = formatLocales(declared);\n const formattedRequiredLocales = formatLocales(requiredSanitized);\n\n // Build schema registry\n const schemas = configuration.schemas ?? {};\n const formattedSchemas = Object.entries(schemas)\n .map(([key, schema]) => {\n let typeStr = 'any';\n\n if (schema) {\n try {\n const { node } = zodToTs(schema, {\n auxiliaryTypeStore: createAuxiliaryTypeStore(),\n });\n // 133 is the kind for AnyKeyword in TypeScript\n if ((node as any).kind !== 133) {\n typeStr = printNode(node);\n } else {\n // Fallback to custom string generator if zodToTs returns any\n typeStr = zodToTsString(schema);\n }\n } catch (_e) {\n // Fallback to custom string generator\n typeStr = zodToTsString(schema);\n }\n }\n return ` \"${key}\": ${typeStr};`;\n })\n .join('\\n');\n\n // Choose strict mode registry key\n const strictKey =\n strictMode === 'strict'\n ? 'strict'\n : strictMode === 'inclusive'\n ? 'inclusive'\n : 'loose';\n\n /**\n * Module augmentation that ONLY adds keys to registries.\n * No types/aliases redefined here—avoids merge conflicts.\n */\n fileContent += `declare module 'intlayer' {\\n`;\n // Dictionaries registry\n fileContent += ` interface __DictionaryRegistry {\\n${formattedDictionaryMap}\\n }\\n\\n`;\n // Locales registries\n fileContent += ` interface __DeclaredLocalesRegistry {\\n${formattedDeclaredLocales}\\n }\\n\\n`;\n fileContent += ` interface __RequiredLocalesRegistry {\\n${formattedRequiredLocales}\\n }\\n\\n`;\n // Schema registry\n fileContent += ` interface __SchemaRegistry {\\n${formattedSchemas}\\n }\\n\\n`;\n // Resolved strict mode (narrow the literal at build time)\n fileContent += ` interface __StrictModeRegistry { mode: '${strictKey}' }\\n\\n`;\n // Editor registry\n fileContent += ` interface __EditorRegistry { enabled : ${enabled} } \\n`;\n fileContent += `}\\n`;\n\n return fileContent;\n};\n\n/** Generate the index file merging all the types */\nexport const createModuleAugmentation = async (\n configuration: IntlayerConfig\n) => {\n const { moduleAugmentationDir, typesDir } = configuration.system;\n\n await mkdir(moduleAugmentationDir, { recursive: true });\n\n const dictionariesTypesDefinitions: string[] = await fg(\n normalizePath(`${typesDir}/*.ts`),\n { ignore: ['**/*.d.ts'] }\n );\n\n const tsContent = generateTypeIndexContent(\n dictionariesTypesDefinitions,\n configuration\n );\n\n const tsFilePath = join(moduleAugmentationDir, 'intlayer.d.ts');\n await writeFileIfChanged(tsFilePath, tsContent);\n};\n"],"mappings":"mWAUA,MAAa,EAAe,GAC1B,IAAA,EAAA,EAAA,sBAAwB,EAAI,CAAC,SAGzB,EAAiB,GACrB,EAAQ,IAAK,GAAW,QAAQ,EAAO,OAAO,CAAC,KAAK;EAAK,CAErD,EAAiB,GAAwB,CA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C,EAAQ,OACnE,GAAe;EAER,GAII,EAA2B,KACtC,IACG,CACH,GAAM,CAAE,wBAAuB,YAAa,EAAc,OAE1D,MAAA,EAAA,EAAA,OAAY,EAAuB,CAAE,UAAW,GAAM,CAAC,CAOvD,IAAM,EAAY,EAL6B,MAAA,EAAA,EAAA,UAAA,EAAA,EAAA,eAC/B,GAAG,EAAS,OAAO,CACjC,CAAE,OAAQ,CAAC,YAAY,CAAE,CAC1B,CAIC,EACD,CAGD,MAAMC,EAAAA,oBAAAA,EAAAA,EAAAA,MADkB,EAAuB,gBAAgB,CAC1B,EAAU"}
1
+ {"version":3,"file":"createModuleAugmentation.cjs","names":["getPathHash","writeFileIfChanged"],"sources":["../../../src/createType/createModuleAugmentation.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { basename, extname, join, relative } from 'node:path';\nimport { kebabCaseToCamelCase, normalizePath } from '@intlayer/config/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport fg from 'fast-glob';\nimport { createAuxiliaryTypeStore, printNode, zodToTs } from 'zod-to-ts';\nimport { getPathHash } from '../utils';\nimport { writeFileIfChanged } from '../writeFileIfChanged';\n\nexport const getTypeName = (key: string): string =>\n `${kebabCaseToCamelCase(key)}Content`;\n\n/** Returns lines like: [Locales.FRENCH]: 1; */\nconst formatLocales = (locales: Locale[]) =>\n locales.map((locale) => ` \"${locale}\": 1;`).join('\\n');\n\nconst zodToTsString = (schema: any): string => {\n if (!schema) return 'any';\n\n // Support both real Zod objects (_def) and serialized versions (def or nested)\n const def = schema._def ?? schema.def ?? schema;\n\n // Handle serialized type names (sometimes 'type' instead of 'typeName')\n const typeName = def.typeName ?? def.type;\n\n switch (typeName) {\n case 'ZodString':\n case 'string':\n return 'string';\n case 'ZodNumber':\n case 'number':\n return 'number';\n case 'ZodBoolean':\n case 'boolean':\n return 'boolean';\n case 'ZodNull':\n case 'null':\n return 'null';\n case 'ZodUndefined':\n case 'undefined':\n return 'undefined';\n case 'ZodArray':\n case 'array':\n return `${zodToTsString(def.type ?? def.element)}[]`;\n case 'ZodObject':\n case 'object': {\n const shape = typeof def.shape === 'function' ? def.shape() : def.shape;\n if (!shape) return 'Record<string, any>';\n\n const entries = Object.entries(shape)\n .map(([k, v]) => ` \"${k}\": ${zodToTsString(v)};`)\n .join('\\n');\n return `{\\n${entries}\\n }`;\n }\n case 'ZodOptional':\n case 'optional':\n return `${zodToTsString(def.innerType ?? def.wrapped)} | undefined`;\n case 'ZodNullable':\n case 'nullable':\n return `${zodToTsString(def.innerType ?? def.wrapped)} | null`;\n case 'ZodUnion':\n case 'union': {\n const options = def.options ?? [];\n return options.map(zodToTsString).join(' | ');\n }\n case 'ZodIntersection':\n case 'intersection':\n return `${zodToTsString(def.left)} & ${zodToTsString(def.right)}`;\n case 'ZodEnum':\n case 'enum': {\n const values = def.values ?? [];\n return values.map((v: string) => `\"${v}\"`).join(' | ');\n }\n case 'ZodLiteral':\n case 'literal': {\n const value = def.value;\n return typeof value === 'string' ? `\"${value}\"` : String(value);\n }\n default:\n return 'any';\n }\n};\n\n/** Generate the content of the module augmentation file */\nconst generateTypeIndexContent = (\n typeFiles: string[],\n configuration: IntlayerConfig\n): string => {\n const { internationalization, system, editor } = configuration;\n const { moduleAugmentationDir } = system;\n const { enabled } = editor;\n const { locales, requiredLocales, strictMode } = internationalization;\n\n let fileContent = 'import \"intlayer\";\\n';\n\n // Build dictionary refs\n const dictionariesRef = typeFiles.map((dictionaryPath) => ({\n relativePath: `./${relative(moduleAugmentationDir, dictionaryPath)}`,\n id: basename(dictionaryPath, extname(dictionaryPath)),\n hash: `_${getPathHash(dictionaryPath)}`,\n }));\n\n // Import all dictionaries\n for (const dictionary of dictionariesRef) {\n fileContent += `import ${dictionary.hash} from '${dictionary.relativePath}';\\n`;\n }\n fileContent += '\\n';\n\n // Dictionary map entries (id: typeof <hash>)\n const formattedDictionaryMap: string = dictionariesRef\n .map((dictionary) => ` \"${dictionary.id}\": typeof ${dictionary.hash};`)\n .join('\\n');\n\n // Ensure required ⊆ declared; if empty, default required = declared\n const declared = locales;\n const requiredSanitized = requiredLocales?.length\n ? requiredLocales.filter((requiredLocales) =>\n declared.includes(requiredLocales)\n )\n : declared;\n\n const formattedDeclaredLocales = formatLocales(declared);\n const formattedRequiredLocales = formatLocales(requiredSanitized);\n\n // Build schema registry\n const schemas = configuration.schemas ?? {};\n const formattedSchemas = Object.entries(schemas)\n .map(([key, schema]) => {\n let typeStr = 'any';\n\n if (schema) {\n try {\n const { node } = zodToTs(schema, {\n auxiliaryTypeStore: createAuxiliaryTypeStore(),\n });\n // 133 is the kind for AnyKeyword in TypeScript\n if ((node as any).kind !== 133) {\n typeStr = printNode(node);\n } else {\n // Fallback to custom string generator if zodToTs returns any\n typeStr = zodToTsString(schema);\n }\n } catch (_e) {\n // Fallback to custom string generator\n typeStr = zodToTsString(schema);\n }\n }\n return ` \"${key}\": ${typeStr};`;\n })\n .join('\\n');\n\n // Choose strict mode registry key\n const strictKey =\n strictMode === 'strict'\n ? 'strict'\n : strictMode === 'inclusive'\n ? 'inclusive'\n : 'loose';\n\n /**\n * Module augmentation that ONLY adds keys to registries.\n * No types/aliases redefined here—avoids merge conflicts.\n */\n fileContent += `declare module 'intlayer' {\\n`;\n // Dictionaries registry\n fileContent += ` interface __DictionaryRegistry {\\n${formattedDictionaryMap}\\n }\\n\\n`;\n // Locales registries\n fileContent += ` interface __DeclaredLocalesRegistry {\\n${formattedDeclaredLocales}\\n }\\n\\n`;\n fileContent += ` interface __RequiredLocalesRegistry {\\n${formattedRequiredLocales}\\n }\\n\\n`;\n // Schema registry\n fileContent += ` interface __SchemaRegistry {\\n${formattedSchemas}\\n }\\n\\n`;\n // Resolved strict mode (narrow the literal at build time)\n fileContent += ` interface __StrictModeRegistry { mode: '${strictKey}' }\\n\\n`;\n // Editor registry\n fileContent += ` interface __EditorRegistry { enabled : ${enabled} } \\n`;\n fileContent += `}\\n`;\n\n return fileContent;\n};\n\n/** Generate the index file merging all the types */\nexport const createModuleAugmentation = async (\n configuration: IntlayerConfig\n) => {\n const { moduleAugmentationDir, typesDir } = configuration.system;\n\n await mkdir(moduleAugmentationDir, { recursive: true });\n\n const dictionariesTypesDefinitions: string[] = await fg(\n normalizePath(`${typesDir}/*.ts`),\n { ignore: ['**/*.d.ts'] }\n );\n\n const tsContent = generateTypeIndexContent(\n dictionariesTypesDefinitions,\n configuration\n );\n\n const tsFilePath = join(moduleAugmentationDir, 'intlayer.d.ts');\n await writeFileIfChanged(tsFilePath, tsContent);\n};\n"],"mappings":"iVAUA,MAAa,EAAe,GAC1B,IAAA,EAAA,EAAA,sBAAwB,EAAI,CAAC,SAGzB,EAAiB,GACrB,EAAQ,IAAK,GAAW,QAAQ,EAAO,OAAO,CAAC,KAAK;EAAK,CAErD,EAAiB,GAAwB,CAC7C,GAAI,CAAC,EAAQ,MAAO,MAGpB,IAAM,EAAM,EAAO,MAAQ,EAAO,KAAO,EAKzC,OAFiB,EAAI,UAAY,EAAI,KAErC,CACE,IAAK,YACL,IAAK,SACH,MAAO,SACT,IAAK,YACL,IAAK,SACH,MAAO,SACT,IAAK,aACL,IAAK,UACH,MAAO,UACT,IAAK,UACL,IAAK,OACH,MAAO,OACT,IAAK,eACL,IAAK,YACH,MAAO,YACT,IAAK,WACL,IAAK,QACH,MAAO,GAAG,EAAc,EAAI,MAAQ,EAAI,QAAQ,CAAC,IACnD,IAAK,YACL,IAAK,SAAU,CACb,IAAM,EAAQ,OAAO,EAAI,OAAU,WAAa,EAAI,OAAO,CAAG,EAAI,MAMlE,OALK,EAKE,MAHS,OAAO,QAAQ,EAAM,CAClC,KAAK,CAAC,EAAG,KAAO,UAAU,EAAE,KAAK,EAAc,EAAE,CAAC,GAAG,CACrD,KAAK;EAAK,CACQ,SALF,sBAOrB,IAAK,cACL,IAAK,WACH,MAAO,GAAG,EAAc,EAAI,WAAa,EAAI,QAAQ,CAAC,cACxD,IAAK,cACL,IAAK,WACH,MAA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B,IAAI,EAAU,MAEd,GAAI,EACF,GAAI,CACF,GAAM,CAAE,SAAA,EAAA,EAAA,SAAiB,EAAQ,CAC/B,oBAAA,EAAA,EAAA,2BAA8C,CAC/C,CAAC,CAEF,AACE,EADG,EAAa,OAAS,IAIf,EAAc,EAAO,EAH/B,EAAA,EAAA,WAAoB,EAAK,MAKhB,CAEX,EAAU,EAAc,EAAO,CAGnC,MAAO,QAAQ,EAAI,KAAK,EAAQ,IAChC,CACD,KAAK;EAAK,CAGP,EACJ,IAAe,SACX,SACA,IAAe,YACb,YACA,QAoBR,MAdA,IAAe;EAEf,GAAe,uCAAuC,EAAuB,WAE7E,GAAe,4CAA4C,EAAyB,WACpF,GAAe,4CAA4C,EAAyB,WAEpF,GAAe,mCAAmC,EAAiB,WAEnE,GAAe,6CAA6C,EAAU,SAEtE,GAAe,4CAA4C,EAAQ,OACnE,GAAe;EAER,GAII,EAA2B,KACtC,IACG,CACH,GAAM,CAAE,wBAAuB,YAAa,EAAc,OAE1D,MAAA,EAAA,EAAA,OAAY,EAAuB,CAAE,UAAW,GAAM,CAAC,CAOvD,IAAM,EAAY,EAL6B,MAAA,EAAA,EAAA,UAAA,EAAA,EAAA,eAC/B,GAAG,EAAS,OAAO,CACjC,CAAE,OAAQ,CAAC,YAAY,CAAE,CAC1B,CAIC,EACD,CAGD,MAAMC,EAAAA,oBAAAA,EAAAA,EAAAA,MADkB,EAAuB,gBAAgB,CAC1B,EAAU"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../utils/parallelize.cjs`);let t=require(`node:fs/promises`),n=require(`node:path`);const r=e=>`/* eslint-disable */\nexport default ${JSON.stringify(e,null,2)} as const;\n`,i=async(i,a)=>{let{system:o}=a,{typesDir:s}=o;return await(0,t.mkdir)(s,{recursive:!0}),(await e.parallelize(i,async e=>{if(!e.key)return;let i=r(e),a=(0,n.resolve)(s,`${e.key}.ts`);return await(0,t.writeFile)(a,i),a})).filter(Boolean)};exports.createTypes=i,exports.generateTypeScriptType=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-Bmb41Sf3.cjs`);const e=require(`../utils/parallelize.cjs`);let t=require(`node:fs/promises`),n=require(`node:path`);const r=e=>`/* eslint-disable */\nexport default ${JSON.stringify(e,null,2)} as const;\n`,i=async(i,a)=>{let{system:o}=a,{typesDir:s}=o;return await(0,t.mkdir)(s,{recursive:!0}),(await e.parallelize(i,async e=>{if(!e.key)return;let i=r(e),a=(0,n.resolve)(s,`${e.key}.ts`);return await(0,t.writeFile)(a,i),a})).filter(Boolean)};exports.createTypes=i,exports.generateTypeScriptType=r;
2
2
  //# sourceMappingURL=createType.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"createType.cjs","names":["parallelize"],"sources":["../../../src/createType/createType.ts"],"sourcesContent":["import { mkdir, writeFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { parallelize } from '../utils/parallelize';\n\nexport const generateTypeScriptType = (dictionary: Dictionary) => {\n const jsonString = JSON.stringify(dictionary, null, 2);\n\n return `/* eslint-disable */\\nexport default ${jsonString} as const;\\n`;\n};\n/**\n * This function generates a TypeScript type definition from a JSON object\n */\nexport const createTypes = async (\n dictionaries: Dictionary[],\n configuration: IntlayerConfig\n): Promise<string[]> => {\n const { system } = configuration;\n const { typesDir } = system;\n\n // Create type folders if they don't exist\n await mkdir(typesDir, { recursive: true });\n\n const results = await parallelize(\n dictionaries,\n async (dictionary): Promise<string | undefined> => {\n if (!dictionary.key) {\n return undefined;\n }\n\n const typeDefinition: string = generateTypeScriptType(dictionary);\n\n const outputPath: string = resolve(typesDir, `${dictionary.key}.ts`);\n\n await writeFile(outputPath, typeDefinition);\n\n return outputPath;\n }\n );\n\n return results.filter(Boolean) as string[];\n};\n"],"mappings":"qNAMA,MAAa,EAA0B,GAG9B,wCAFY,KAAK,UAAU,EAAY,KAAM,EAAE,CAEI,cAK/C,EAAc,MACzB,EACA,IACsB,CACtB,GAAM,CAAE,UAAW,EACb,CAAE,YAAa,EAsBrB,OAnBA,MAAA,EAAA,EAAA,OAAY,EAAU,CAAE,UAAW,GAAM,CAAC,EAE1B,MAAMA,EAAAA,YACpB,EACA,KAAO,IAA4C,CACjD,GAAI,CAAC,EAAW,IACd,OAGF,IAAM,EAAyB,EAAuB,EAAW,CAE3D,GAAA,EAAA,EAAA,SAA6B,EAAU,GAAG,EAAW,IAAI,KAAK,CAIpE,OAFA,MAAA,EAAA,EAAA,WAAgB,EAAY,EAAe,CAEpC,GAEV,EAEc,OAAO,QAAQ"}
1
+ {"version":3,"file":"createType.cjs","names":["parallelize"],"sources":["../../../src/createType/createType.ts"],"sourcesContent":["import { mkdir, writeFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { parallelize } from '../utils/parallelize';\n\nexport const generateTypeScriptType = (dictionary: Dictionary) => {\n const jsonString = JSON.stringify(dictionary, null, 2);\n\n return `/* eslint-disable */\\nexport default ${jsonString} as const;\\n`;\n};\n/**\n * This function generates a TypeScript type definition from a JSON object\n */\nexport const createTypes = async (\n dictionaries: Dictionary[],\n configuration: IntlayerConfig\n): Promise<string[]> => {\n const { system } = configuration;\n const { typesDir } = system;\n\n // Create type folders if they don't exist\n await mkdir(typesDir, { recursive: true });\n\n const results = await parallelize(\n dictionaries,\n async (dictionary): Promise<string | undefined> => {\n if (!dictionary.key) {\n return undefined;\n }\n\n const typeDefinition: string = generateTypeScriptType(dictionary);\n\n const outputPath: string = resolve(typesDir, `${dictionary.key}.ts`);\n\n await writeFile(outputPath, typeDefinition);\n\n return outputPath;\n }\n );\n\n return results.filter(Boolean) as string[];\n};\n"],"mappings":"yMAMA,MAAa,EAA0B,GAG9B,wCAFY,KAAK,UAAU,EAAY,KAAM,EAAE,CAEI,cAK/C,EAAc,MACzB,EACA,IACsB,CACtB,GAAM,CAAE,UAAW,EACb,CAAE,YAAa,EAsBrB,OAnBA,MAAA,EAAA,EAAA,OAAY,EAAU,CAAE,UAAW,GAAM,CAAC,EAE1B,MAAMA,EAAAA,YACpB,EACA,KAAO,IAA4C,CACjD,GAAI,CAAC,EAAW,IACd,OAGF,IAAM,EAAyB,EAAuB,EAAW,CAE3D,GAAA,EAAA,EAAA,SAA6B,EAAU,GAAG,EAAW,IAAI,KAAK,CAIpE,OAFA,MAAA,EAAA,EAAA,WAAgB,EAAY,EAAe,CAEpC,GAEV,EAEc,OAAO,QAAQ"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/config/utils`),t=null;const n=(n,r)=>{let{baseDir:i}=n.system,{formatCommand:a}=n.content,o=r??(0,e.getProjectRequire)(i);if(a)return a;if(t!==null)return t;try{return o.resolve(`prettier`),t=`prettier --write "{{file}}" --log-level silent`,t}catch{}try{return o.resolve(`biome`),t=`biome format "{{file}}" --write --log-level none`,t}catch{}try{return o.resolve(`eslint`),t=`eslint --fix "{{file}}" --quiet || node -e "process.exit(0)"`,t}catch{}t=void 0};exports.detectFormatCommand=n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./chunk-Bmb41Sf3.cjs`);let e=require(`@intlayer/config/utils`),t=null;const n=(n,r)=>{let{baseDir:i}=n.system,{formatCommand:a}=n.content,o=r??(0,e.getProjectRequire)(i);if(a)return a;if(t!==null)return t;try{return o.resolve(`prettier`),t=`prettier --write "{{file}}" --log-level silent`,t}catch{}try{return o.resolve(`biome`),t=`biome format "{{file}}" --write --log-level none`,t}catch{}try{return o.resolve(`eslint`),t=`eslint --fix "{{file}}" --quiet || node -e "process.exit(0)"`,t}catch{}t=void 0};exports.detectFormatCommand=n;
2
2
  //# sourceMappingURL=detectFormatCommand.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"detectFormatCommand.cjs","names":[],"sources":["../../src/detectFormatCommand.ts"],"sourcesContent":["import { getProjectRequire } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n\nlet cachedFormatCommand: string | undefined | null = null;\n\nexport const detectFormatCommand = (\n configuration: IntlayerConfig,\n projectRequireProp?: NodeJS.Require\n) => {\n const { baseDir } = configuration.system;\n const { formatCommand } = configuration.content;\n const projectRequire = projectRequireProp ?? getProjectRequire(baseDir);\n\n // Priority: Explicit configuration\n // We do not cache this because the user might change their config file active-session.\n if (formatCommand) {\n return formatCommand;\n }\n\n // Priority: Cached detection\n // If not null, we have already performed the expensive checks.\n if (cachedFormatCommand !== null) {\n return cachedFormatCommand;\n }\n\n // Perform Detection\n\n // Try Prettier\n try {\n projectRequire.resolve('prettier');\n cachedFormatCommand = 'prettier --write \"{{file}}\" --log-level silent';\n return cachedFormatCommand;\n } catch (_error) {\n // Prettier not found, continue\n }\n\n // Try Biome\n try {\n projectRequire.resolve('biome');\n cachedFormatCommand = 'biome format \"{{file}}\" --write --log-level none';\n return cachedFormatCommand;\n } catch (_error) {\n // Biome not found, continue\n }\n\n // Try ESLint\n try {\n projectRequire.resolve('eslint');\n cachedFormatCommand =\n 'eslint --fix \"{{file}}\" --quiet || node -e \"process.exit(0)\"';\n return cachedFormatCommand;\n } catch (_error) {\n // ESLint not found\n }\n\n // No formatter found\n // Set to undefined (not null) so we know we checked and found nothing.\n cachedFormatCommand = undefined;\n return undefined;\n};\n"],"mappings":"uJAGI,EAAiD,KAErD,MAAa,GACX,EACA,IACG,CACH,GAAM,CAAE,WAAY,EAAc,OAC5B,CAAE,iBAAkB,EAAc,QAClC,EAAiB,IAAA,EAAA,EAAA,mBAAwC,EAAQ,CAIvE,GAAI,EACF,OAAO,EAKT,GAAI,IAAwB,KAC1B,OAAO,EAMT,GAAI,CAGF,OAFA,EAAe,QAAQ,WAAW,CAClC,EAAsB,iDACf,OACQ,EAKjB,GAAI,CAGF,OAFA,EAAe,QAAQ,QAAQ,CAC/B,EAAsB,mDACf,OACQ,EAKjB,GAAI,CAIF,OAHA,EAAe,QAAQ,SAAS,CAChC,EACE,+DACK,OACQ,EAMjB,EAAsB,IAAA"}
1
+ {"version":3,"file":"detectFormatCommand.cjs","names":[],"sources":["../../src/detectFormatCommand.ts"],"sourcesContent":["import { getProjectRequire } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n\nlet cachedFormatCommand: string | undefined | null = null;\n\nexport const detectFormatCommand = (\n configuration: IntlayerConfig,\n projectRequireProp?: NodeJS.Require\n) => {\n const { baseDir } = configuration.system;\n const { formatCommand } = configuration.content;\n const projectRequire = projectRequireProp ?? getProjectRequire(baseDir);\n\n // Priority: Explicit configuration\n // We do not cache this because the user might change their config file active-session.\n if (formatCommand) {\n return formatCommand;\n }\n\n // Priority: Cached detection\n // If not null, we have already performed the expensive checks.\n if (cachedFormatCommand !== null) {\n return cachedFormatCommand;\n }\n\n // Perform Detection\n\n // Try Prettier\n try {\n projectRequire.resolve('prettier');\n cachedFormatCommand = 'prettier --write \"{{file}}\" --log-level silent';\n return cachedFormatCommand;\n } catch (_error) {\n // Prettier not found, continue\n }\n\n // Try Biome\n try {\n projectRequire.resolve('biome');\n cachedFormatCommand = 'biome format \"{{file}}\" --write --log-level none';\n return cachedFormatCommand;\n } catch (_error) {\n // Biome not found, continue\n }\n\n // Try ESLint\n try {\n projectRequire.resolve('eslint');\n cachedFormatCommand =\n 'eslint --fix \"{{file}}\" --quiet || node -e \"process.exit(0)\"';\n return cachedFormatCommand;\n } catch (_error) {\n // ESLint not found\n }\n\n // No formatter found\n // Set to undefined (not null) so we know we checked and found nothing.\n cachedFormatCommand = undefined;\n return undefined;\n};\n"],"mappings":"2IAGI,EAAiD,KAErD,MAAa,GACX,EACA,IACG,CACH,GAAM,CAAE,WAAY,EAAc,OAC5B,CAAE,iBAAkB,EAAc,QAClC,EAAiB,IAAA,EAAA,EAAA,mBAAwC,EAAQ,CAIvE,GAAI,EACF,OAAO,EAKT,GAAI,IAAwB,KAC1B,OAAO,EAMT,GAAI,CAGF,OAFA,EAAe,QAAQ,WAAW,CAClC,EAAsB,iDACf,OACQ,EAKjB,GAAI,CAGF,OAFA,EAAe,QAAQ,QAAQ,CAC/B,EAAsB,mDACf,OACQ,EAKjB,GAAI,CAIF,OAHA,EAAe,QAAQ,SAAS,CAChC,EACE,+DACK,OACQ,EAMjB,EAAsB,IAAA"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./utils/parallelize.cjs`);let t=require(`@intlayer/config/logger`),n=require(`@intlayer/config/node`),r=require(`@intlayer/api`);const i=async(i,a)=>{let o=(0,n.getConfiguration)(),s=(0,t.getAppLogger)(o);try{let t=(0,r.getIntlayerAPIProxy)(void 0,o),n=i.dictionaryKeys,s=async e=>{a?.([{dictionaryKey:e,type:`remote`,status:`fetching`}]);try{let n=(await t.dictionary.getDictionary(e)).data;if(!n)throw Error(`Dictionary ${e} not found on remote`);return a?.([{dictionaryKey:e,type:`remote`,status:`fetched`}]),n}catch(t){a?.([{dictionaryKey:e,type:`remote`,status:`error`,error:`Error fetching dictionary ${e}: ${t}`}]);return}};return(await e.parallelize(n,async e=>await s(e))).filter(e=>e!==void 0)}catch{return s(`${t.x} Failed to fetch distant dictionaries`,{level:`error`}),[]}};exports.fetchDistantDictionaries=i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./chunk-Bmb41Sf3.cjs`);const e=require(`./utils/parallelize.cjs`);let t=require(`@intlayer/config/logger`),n=require(`@intlayer/config/node`),r=require(`@intlayer/api`);const i=async(i,a)=>{let o=(0,n.getConfiguration)(),s=(0,t.getAppLogger)(o);try{let t=(0,r.getIntlayerAPIProxy)(void 0,o),n=i.dictionaryKeys,s=async e=>{a?.([{dictionaryKey:e,type:`remote`,status:`fetching`}]);try{let n=(await t.dictionary.getDictionary(e)).data;if(!n)throw Error(`Dictionary ${e} not found on remote`);return a?.([{dictionaryKey:e,type:`remote`,status:`fetched`}]),n}catch(t){a?.([{dictionaryKey:e,type:`remote`,status:`error`,error:`Error fetching dictionary ${e}: ${t}`}]);return}};return(await e.parallelize(n,async e=>await s(e))).filter(e=>e!==void 0)}catch{return s(`${t.x} Failed to fetch distant dictionaries`,{level:`error`}),[]}};exports.fetchDistantDictionaries=i;
2
2
  //# sourceMappingURL=fetchDistantDictionaries.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchDistantDictionaries.cjs","names":["parallelize","x"],"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, x } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { DictionariesStatus } from './loadDictionaries';\nimport { parallelize } from './utils/parallelize';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n const distantDictionariesKeys = options.dictionaryKeys;\n // Process dictionaries in parallel with a concurrency limit\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'fetching',\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult =\n await intlayerAPI.dictionary.getDictionary(dictionaryKey);\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n onStatusUpdate?.([\n { dictionaryKey, type: 'remote', status: 'fetched' },\n ]);\n\n return distantDictionary;\n } catch (error) {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'error',\n error: `Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n ]);\n return undefined;\n }\n };\n\n const result = await parallelize(\n distantDictionariesKeys,\n async (dictionaryKey) => await processDictionary(dictionaryKey)\n );\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict: DictionaryAPI | undefined): dict is DictionaryAPI =>\n dict !== undefined\n );\n\n return filteredResult;\n } catch (_error) {\n appLogger(`${x} Failed to fetch distant dictionaries`, { level: 'error' });\n return [];\n }\n};\n"],"mappings":"iQAiBA,MAAa,EAA2B,MACtC,EACA,IAC6B,CAC7B,IAAM,GAAA,EAAA,EAAA,mBAA2B,CAC3B,GAAA,EAAA,EAAA,cAAyB,EAAO,CACtC,GAAI,CACF,IAAM,GAAA,EAAA,EAAA,qBAAkC,IAAA,GAAW,EAAO,CAEpD,EAA0B,EAAQ,eAElC,EAAoB,KACxB,IACuC,CACvC,IAAiB,CACf,CACE,gBACA,KAAM,SACN,OAAQ,WACT,CACF,CAAC,CAEF,GAAI,CAKF,IAAM,GAFJ,MAAM,EAAY,WAAW,cAAc,EAAc,EAEb,KAE9C,GAAI,CAAC,EACH,MAAU,MAAM,cAAc,EAAc,sBAAsB,CAOpE,OAJA,IAAiB,CACf,CAAE,gBAAe,KAAM,SAAU,OAAQ,UAAW,CACrD,CAAC,CAEK,QACA,EAAO,CACd,IAAiB,CACf,CACE,gBACA,KAAM,SACN,OAAQ,QACR,MAAO,6BAA6B,EAAc,IAAI,IACvD,CACF,CAAC,CACF,SAeJ,OAXe,MAAMA,EAAAA,YACnB,EACA,KAAO,IAAkB,MAAM,EAAkB,EAAc,CAChE,EAG6B,OAC3B,GACC,IAAS,IAAA,GACZ,MAGc,CAEf,OADA,EAAU,GAAGC,EAAAA,EAAE,uCAAwC,CAAE,MAAO,QAAS,CAAC,CACnE,EAAE"}
1
+ {"version":3,"file":"fetchDistantDictionaries.cjs","names":["parallelize","x"],"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, x } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { DictionariesStatus } from './loadDictionaries';\nimport { parallelize } from './utils/parallelize';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n const distantDictionariesKeys = options.dictionaryKeys;\n // Process dictionaries in parallel with a concurrency limit\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'fetching',\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult =\n await intlayerAPI.dictionary.getDictionary(dictionaryKey);\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n onStatusUpdate?.([\n { dictionaryKey, type: 'remote', status: 'fetched' },\n ]);\n\n return distantDictionary;\n } catch (error) {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'error',\n error: `Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n ]);\n return undefined;\n }\n };\n\n const result = await parallelize(\n distantDictionariesKeys,\n async (dictionaryKey) => await processDictionary(dictionaryKey)\n );\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict: DictionaryAPI | undefined): dict is DictionaryAPI =>\n dict !== undefined\n );\n\n return filteredResult;\n } catch (_error) {\n appLogger(`${x} Failed to fetch distant dictionaries`, { level: 'error' });\n return [];\n }\n};\n"],"mappings":"qPAiBA,MAAa,EAA2B,MACtC,EACA,IAC6B,CAC7B,IAAM,GAAA,EAAA,EAAA,mBAA2B,CAC3B,GAAA,EAAA,EAAA,cAAyB,EAAO,CACtC,GAAI,CACF,IAAM,GAAA,EAAA,EAAA,qBAAkC,IAAA,GAAW,EAAO,CAEpD,EAA0B,EAAQ,eAElC,EAAoB,KACxB,IACuC,CACvC,IAAiB,CACf,CACE,gBACA,KAAM,SACN,OAAQ,WACT,CACF,CAAC,CAEF,GAAI,CAKF,IAAM,GAFJ,MAAM,EAAY,WAAW,cAAc,EAAc,EAEb,KAE9C,GAAI,CAAC,EACH,MAAU,MAAM,cAAc,EAAc,sBAAsB,CAOpE,OAJA,IAAiB,CACf,CAAE,gBAAe,KAAM,SAAU,OAAQ,UAAW,CACrD,CAAC,CAEK,QACA,EAAO,CACd,IAAiB,CACf,CACE,gBACA,KAAM,SACN,OAAQ,QACR,MAAO,6BAA6B,EAAc,IAAI,IACvD,CACF,CAAC,CACF,SAeJ,OAXe,MAAMA,EAAAA,YACnB,EACA,KAAO,IAAkB,MAAM,EAAkB,EAAc,CAChE,EAG6B,OAC3B,GACC,IAAS,IAAA,GACZ,MAGc,CAEf,OADA,EAAU,GAAGC,EAAAA,EAAE,uCAAwC,CAAE,MAAO,QAAS,CAAC,CACnE,EAAE"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./utils/formatter.cjs`);let t=require(`@intlayer/config/logger`),n=require(`@intlayer/core/interpreter`);const r=(r,i,a)=>{let o=(0,t.getAppLogger)(i);if(!r)return!1;let s=r.location===`local`||typeof r.filePath==`string`?`Local`:`Remote`,c=!!r.key,l=!!r.content;if(!c)return o(`${s} dictionary has no key`,{level:`error`}),!1;if(!l)return o(`${s} dictionary ${(0,t.colorizeKey)(r.key)} has no content - ${r.filePath?e.formatPath(r.filePath):(0,t.colorizePath)(`Remote`)}`,{level:`error`}),!1;if(r.schema&&a?.checkSchema&&!(typeof r.content==`function`||typeof r.content==`object`&&r.content!==null&&typeof r.content.then==`function`)){let a=i?.internationalization?.locales??[],c=i?.internationalization.strictMode===`strict`,l=typeof r.schema==`string`?i?.schemas?.[r.schema]:void 0;if(l&&typeof l.safeParse==`function`)for(let i of a){let a=(0,n.getContent)(r.content,{dictionaryKey:r.key,keyPath:[],locale:i},(0,n.getBasePlugins)(i,!c)),u=l.safeParse(a);if(!u.success)return o(`${s} dictionary ${(0,t.colorizeKey)(r.key)} has invalid content according to schema ${(0,t.colorize)(r.schema,t.ANSIColors.ORANGE)} for locale ${e.formatLocale(i)} - ${r.filePath?e.formatPath(r.filePath):(0,t.colorizePath)(`Remote`)}`,{level:`error`}),u.error.issues.forEach(n=>{o(`${t.x} Error: ${(0,t.colorizeKey)(r.key)} - ${e.formatLocale(i)} - ${(0,t.colorize)(`${n.path.join(`.`)}:`,t.ANSIColors.BLUE)} ${(0,t.colorize)(n.message,t.ANSIColors.GREY)}`,{level:`error`})}),!1}}return!0},i=(e,t,n)=>(e??[])?.filter(e=>r(e,t,n));exports.filterInvalidDictionaries=i,exports.isInvalidDictionary=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./chunk-Bmb41Sf3.cjs`);const e=require(`./utils/formatter.cjs`);let t=require(`@intlayer/config/logger`),n=require(`@intlayer/core/interpreter`);const r=(r,i,a)=>{let o=(0,t.getAppLogger)(i);if(!r)return!1;let s=r.location===`local`||typeof r.filePath==`string`?`Local`:`Remote`,c=!!r.key,l=!!r.content;if(!c)return o(`${s} dictionary has no key`,{level:`error`}),!1;if(!l)return o(`${s} dictionary ${(0,t.colorizeKey)(r.key)} has no content - ${r.filePath?e.formatPath(r.filePath):(0,t.colorizePath)(`Remote`)}`,{level:`error`}),!1;if(r.schema&&a?.checkSchema&&!(typeof r.content==`function`||typeof r.content==`object`&&r.content!==null&&typeof r.content.then==`function`)){let a=i?.internationalization?.locales??[],c=i?.internationalization.strictMode===`strict`,l=typeof r.schema==`string`?i?.schemas?.[r.schema]:void 0;if(l&&typeof l.safeParse==`function`)for(let i of a){let a=(0,n.getContent)(r.content,{dictionaryKey:r.key,keyPath:[],locale:i},(0,n.getBasePlugins)(i,!c)),u=l.safeParse(a);if(!u.success)return o(`${s} dictionary ${(0,t.colorizeKey)(r.key)} has invalid content according to schema ${(0,t.colorize)(r.schema,t.ANSIColors.ORANGE)} for locale ${e.formatLocale(i)} - ${r.filePath?e.formatPath(r.filePath):(0,t.colorizePath)(`Remote`)}`,{level:`error`}),u.error.issues.forEach(n=>{o(`${t.x} Error: ${(0,t.colorizeKey)(r.key)} - ${e.formatLocale(i)} - ${(0,t.colorize)(`${n.path.join(`.`)}:`,t.ANSIColors.BLUE)} ${(0,t.colorize)(n.message,t.ANSIColors.GREY)}`,{level:`error`})}),!1}}return!0},i=(e,t,n)=>(e??[])?.filter(e=>r(e,t,n));exports.filterInvalidDictionaries=i,exports.isInvalidDictionary=r;
2
2
  //# sourceMappingURL=filterInvalidDictionaries.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"filterInvalidDictionaries.cjs","names":["formatPath","ANSIColors","formatLocale","x"],"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getBasePlugins, getContent } from '@intlayer/core/interpreter';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { formatLocale, formatPath } from './utils/formatter';\n\ntype IsInvalidDictionaryOptions = { checkSchema: boolean };\n\nexport const isInvalidDictionary = (\n dictionary: Dictionary | undefined,\n configuration?: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): boolean => {\n const appLogger = getAppLogger(configuration);\n\n if (!dictionary) return false;\n\n const isLocal = Boolean(\n dictionary.location === 'local' || typeof dictionary.filePath === 'string'\n );\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n if (dictionary.schema && options?.checkSchema) {\n const isAsync =\n typeof dictionary.content === 'function' ||\n (typeof dictionary.content === 'object' &&\n dictionary.content !== null &&\n typeof (dictionary.content as any).then === 'function');\n\n if (!isAsync) {\n const locales = configuration?.internationalization?.locales ?? [];\n const isStrict =\n configuration?.internationalization.strictMode === 'strict';\n\n const schema =\n typeof dictionary.schema === 'string'\n ? configuration?.schemas?.[dictionary.schema]\n : undefined;\n\n if (schema && typeof schema.safeParse === 'function') {\n for (const locale of locales) {\n const resolvedContent = getContent(\n dictionary.content,\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n locale,\n },\n getBasePlugins(locale, !isStrict)\n );\n const result = (schema as any).safeParse(resolvedContent);\n\n if (!result.success) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has invalid content according to schema ${colorize(dictionary.schema as string, ANSIColors.ORANGE)} for locale ${formatLocale(locale)} - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n\n result.error.issues.forEach((issue: any) => {\n appLogger(\n `${x} Error: ${colorizeKey(dictionary.key)} - ${formatLocale(locale)} - ${colorize(`${issue.path.join('.')}:`, ANSIColors.BLUE)} ${colorize(issue.message, ANSIColors.GREY)}`,\n {\n level: 'error',\n }\n );\n });\n\n return false;\n }\n }\n }\n }\n }\n\n return true;\n};\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined,\n configuration: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): Dictionary[] =>\n (dictionaries ?? [])?.filter((dictionary) =>\n isInvalidDictionary(dictionary, configuration, options)\n ) as Dictionary[];\n"],"mappings":"yOAeA,MAAa,GACX,EACA,EACA,IACY,CACZ,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAc,CAE7C,GAAI,CAAC,EAAY,MAAO,GAKxB,IAAM,EAFJ,EAAW,WAAa,SAAW,OAAO,EAAW,UAAa,SAEzC,QAAU,SAC/B,EAAS,EAAQ,EAAW,IAC5B,EAAa,EAAQ,EAAW,QAEtC,GAAI,CAAC,EAKH,OAJA,EAAU,GAAG,EAAS,wBAAyB,CAC7C,MAAO,QACR,CAAC,CAEK,GAGT,GAAI,CAAC,EAOH,OANA,EACE,GAAG,EAAS,eAAA,EAAA,EAAA,aAA0B,EAAW,IAAI,CAAC,oBAAoB,EAAW,SAAWA,EAAAA,WAAW,EAAW,SAAS,EAAA,EAAA,EAAA,cAAgB,SAAS,GACxJ,CACE,MAAO,QACR,CACF,CACM,GAGT,GAAI,EAAW,QAAU,GAAS,aAO5B,EALF,OAAO,EAAW,SAAY,YAC7B,OAAO,EAAW,SAAY,UAC7B,EAAW,UAAY,MACvB,OAAQ,EAAW,QAAgB,MAAS,YAElC,CACZ,IAAM,EAAU,GAAe,sBAAsB,SAAW,EAAE,CAC5D,EACJ,GAAe,qBAAqB,aAAe,SAE/C,EACJ,OAAO,EAAW,QAAW,SACzB,GAAe,UAAU,EAAW,QACpC,IAAA,GAEN,GAAI,GAAU,OAAO,EAAO,WAAc,WACxC,IAAK,IAAM,KAAU,EAAS,CAC5B,IAAM,GAAA,EAAA,EAAA,YACJ,EAAW,QACX,CACE,cAAe,EAAW,IAC1B,QAAS,EAAE,CACX,SACD,EAAA,EAAA,EAAA,gBACc,EAAQ,CAAC,EAAS,CAClC,CACK,EAAU,EAAe,UAAU,EAAgB,CAEzD,GAAI,CAAC,EAAO,QAiBV,OAhBA,EACE,GAAG,EAAS,eAAA,EAAA,EAAA,aAA0B,EAAW,IAAI,CAAC,4CAAA,EAAA,EAAA,UAAoD,EAAW,OAAkBC,EAAAA,WAAW,OAAO,CAAC,cAAcC,EAAAA,aAAa,EAAO,CAAC,KAAK,EAAW,SAAWF,EAAAA,WAAW,EAAW,SAAS,EAAA,EAAA,EAAA,cAAgB,SAAS,GAChR,CACE,MAAO,QACR,CACF,CAED,EAAO,MAAM,OAAO,QAAS,GAAe,CAC1C,EACE,GAAGG,EAAAA,EAAE,WAAA,EAAA,EAAA,aAAsB,EAAW,IAAI,CAAC,KAAKD,EAAAA,aAAa,EAAO,CAAC,MAAA,EAAA,EAAA,UAAc,GAAG,EAAM,KAAK,KAAK,IAAI,CAAC,GAAID,EAAAA,WAAW,KAAK,CAAC,IAAA,EAAA,EAAA,UAAY,EAAM,QAASA,EAAAA,WAAW,KAAK,GAC3K,CACE,MAAO,QACR,CACF,EACD,CAEK,IAOjB,MAAO,IAGI,GACX,EACA,EACA,KAEC,GAAgB,EAAE,GAAG,OAAQ,GAC5B,EAAoB,EAAY,EAAe,EAAQ,CACxD"}
1
+ {"version":3,"file":"filterInvalidDictionaries.cjs","names":["formatPath","ANSIColors","formatLocale","x"],"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import {\n ANSIColors,\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getBasePlugins, getContent } from '@intlayer/core/interpreter';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { formatLocale, formatPath } from './utils/formatter';\n\ntype IsInvalidDictionaryOptions = { checkSchema: boolean };\n\nexport const isInvalidDictionary = (\n dictionary: Dictionary | undefined,\n configuration?: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): boolean => {\n const appLogger = getAppLogger(configuration);\n\n if (!dictionary) return false;\n\n const isLocal = Boolean(\n dictionary.location === 'local' || typeof dictionary.filePath === 'string'\n );\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n if (dictionary.schema && options?.checkSchema) {\n const isAsync =\n typeof dictionary.content === 'function' ||\n (typeof dictionary.content === 'object' &&\n dictionary.content !== null &&\n typeof (dictionary.content as any).then === 'function');\n\n if (!isAsync) {\n const locales = configuration?.internationalization?.locales ?? [];\n const isStrict =\n configuration?.internationalization.strictMode === 'strict';\n\n const schema =\n typeof dictionary.schema === 'string'\n ? configuration?.schemas?.[dictionary.schema]\n : undefined;\n\n if (schema && typeof schema.safeParse === 'function') {\n for (const locale of locales) {\n const resolvedContent = getContent(\n dictionary.content,\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n locale,\n },\n getBasePlugins(locale, !isStrict)\n );\n const result = (schema as any).safeParse(resolvedContent);\n\n if (!result.success) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has invalid content according to schema ${colorize(dictionary.schema as string, ANSIColors.ORANGE)} for locale ${formatLocale(locale)} - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n\n result.error.issues.forEach((issue: any) => {\n appLogger(\n `${x} Error: ${colorizeKey(dictionary.key)} - ${formatLocale(locale)} - ${colorize(`${issue.path.join('.')}:`, ANSIColors.BLUE)} ${colorize(issue.message, ANSIColors.GREY)}`,\n {\n level: 'error',\n }\n );\n });\n\n return false;\n }\n }\n }\n }\n }\n\n return true;\n};\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined,\n configuration: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): Dictionary[] =>\n (dictionaries ?? [])?.filter((dictionary) =>\n isInvalidDictionary(dictionary, configuration, options)\n ) as Dictionary[];\n"],"mappings":"6NAeA,MAAa,GACX,EACA,EACA,IACY,CACZ,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAc,CAE7C,GAAI,CAAC,EAAY,MAAO,GAKxB,IAAM,EAFJ,EAAW,WAAa,SAAW,OAAO,EAAW,UAAa,SAEzC,QAAU,SAC/B,EAAS,EAAQ,EAAW,IAC5B,EAAa,EAAQ,EAAW,QAEtC,GAAI,CAAC,EAKH,OAJA,EAAU,GAAG,EAAS,wBAAyB,CAC7C,MAAO,QACR,CAAC,CAEK,GAGT,GAAI,CAAC,EAOH,OANA,EACE,GAAG,EAAS,eAAA,EAAA,EAAA,aAA0B,EAAW,IAAI,CAAC,oBAAoB,EAAW,SAAWA,EAAAA,WAAW,EAAW,SAAS,EAAA,EAAA,EAAA,cAAgB,SAAS,GACxJ,CACE,MAAO,QACR,CACF,CACM,GAGT,GAAI,EAAW,QAAU,GAAS,aAO5B,EALF,OAAO,EAAW,SAAY,YAC7B,OAAO,EAAW,SAAY,UAC7B,EAAW,UAAY,MACvB,OAAQ,EAAW,QAAgB,MAAS,YAElC,CACZ,IAAM,EAAU,GAAe,sBAAsB,SAAW,EAAE,CAC5D,EACJ,GAAe,qBAAqB,aAAe,SAE/C,EACJ,OAAO,EAAW,QAAW,SACzB,GAAe,UAAU,EAAW,QACpC,IAAA,GAEN,GAAI,GAAU,OAAO,EAAO,WAAc,WACxC,IAAK,IAAM,KAAU,EAAS,CAC5B,IAAM,GAAA,EAAA,EAAA,YACJ,EAAW,QACX,CACE,cAAe,EAAW,IAC1B,QAAS,EAAE,CACX,SACD,EAAA,EAAA,EAAA,gBACc,EAAQ,CAAC,EAAS,CAClC,CACK,EAAU,EAAe,UAAU,EAAgB,CAEzD,GAAI,CAAC,EAAO,QAiBV,OAhBA,EACE,GAAG,EAAS,eAAA,EAAA,EAAA,aAA0B,EAAW,IAAI,CAAC,4CAAA,EAAA,EAAA,UAAoD,EAAW,OAAkBC,EAAAA,WAAW,OAAO,CAAC,cAAcC,EAAAA,aAAa,EAAO,CAAC,KAAK,EAAW,SAAWF,EAAAA,WAAW,EAAW,SAAS,EAAA,EAAA,EAAA,cAAgB,SAAS,GAChR,CACE,MAAO,QACR,CACF,CAED,EAAO,MAAM,OAAO,QAAS,GAAe,CAC1C,EACE,GAAGG,EAAAA,EAAE,WAAA,EAAA,EAAA,aAAsB,EAAW,IAAI,CAAC,KAAKD,EAAAA,aAAa,EAAO,CAAC,MAAA,EAAA,EAAA,UAAc,GAAG,EAAM,KAAK,KAAK,IAAI,CAAC,GAAID,EAAAA,WAAW,KAAK,CAAC,IAAA,EAAA,EAAA,UAAY,EAAM,QAASA,EAAAA,WAAW,KAAK,GAC3K,CACE,MAAO,QACR,CACF,EACD,CAEK,IAOjB,MAAO,IAGI,GACX,EACA,EACA,KAEC,GAAgB,EAAE,GAAG,OAAQ,GAC5B,EAAoB,EAAY,EAAe,EAAQ,CACxD"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/core/messageFormat`);const t=t=>t.format===`icu`?{...t,format:`intlayer`,content:(0,e.icuToIntlayerFormatter)(t.content)}:t.format===`i18next`?{...t,format:`intlayer`,content:(0,e.i18nextToIntlayerFormatter)(t.content)}:t.format===`vue-i18n`?{...t,format:`intlayer`,content:(0,e.vueI18nToIntlayerFormatter)(t.content)}:t,n=e=>e.map(t),r=t=>t.format===`icu`?{...t,format:`icu`,content:(0,e.intlayerToICUFormatter)(t.content)}:t.format===`i18next`?{...t,format:`i18next`,content:(0,e.intlayerToI18nextFormatter)(t.content)}:t.format===`vue-i18n`?{...t,format:`vue-i18n`,content:(0,e.intlayerToVueI18nFormatter)(t.content)}:t,i=e=>e.map(r);exports.formatDictionaries=n,exports.formatDictionariesOutput=i,exports.formatDictionary=t,exports.formatDictionaryOutput=r;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./chunk-Bmb41Sf3.cjs`);let e=require(`@intlayer/core/messageFormat`);const t=t=>t.format===`icu`?{...t,format:`intlayer`,content:(0,e.icuToIntlayerFormatter)(t.content)}:t.format===`i18next`?{...t,format:`intlayer`,content:(0,e.i18nextToIntlayerFormatter)(t.content)}:t.format===`vue-i18n`?{...t,format:`intlayer`,content:(0,e.vueI18nToIntlayerFormatter)(t.content)}:t,n=e=>e.map(t),r=t=>t.format===`icu`?{...t,format:`icu`,content:(0,e.intlayerToICUFormatter)(t.content)}:t.format===`i18next`?{...t,format:`i18next`,content:(0,e.intlayerToI18nextFormatter)(t.content)}:t.format===`vue-i18n`?{...t,format:`vue-i18n`,content:(0,e.intlayerToVueI18nFormatter)(t.content)}:t,i=e=>e.map(r);exports.formatDictionaries=n,exports.formatDictionariesOutput=i,exports.formatDictionary=t,exports.formatDictionaryOutput=r;
2
2
  //# sourceMappingURL=formatDictionary.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatDictionary.cjs","names":[],"sources":["../../src/formatDictionary.ts"],"sourcesContent":["import {\n i18nextToIntlayerFormatter,\n icuToIntlayerFormatter,\n intlayerToI18nextFormatter,\n intlayerToICUFormatter,\n intlayerToVueI18nFormatter,\n vueI18nToIntlayerFormatter,\n} from '@intlayer/core/messageFormat';\nimport type { Dictionary } from '@intlayer/types/dictionary';\n\nexport const formatDictionary = (dictionary: Dictionary): Dictionary => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: icuToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: i18nextToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: vueI18nToIntlayerFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionaries = (dictionaries: Dictionary[]): Dictionary[] =>\n dictionaries.map(formatDictionary);\n\nexport const formatDictionaryOutput = (dictionary: Dictionary) => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'icu',\n content: intlayerToICUFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'i18next',\n content: intlayerToI18nextFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'vue-i18n',\n content: intlayerToVueI18nFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionariesOutput = (dictionaries: Dictionary[]) =>\n dictionaries.map(formatDictionaryOutput);\n"],"mappings":"6JAUA,MAAa,EAAoB,GAC3B,EAAW,SAAW,MACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,wBAAgC,EAAW,QAAQ,CACpD,CAGC,EAAW,SAAW,UACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGC,EAAW,SAAW,WACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGI,EAGI,EAAsB,GACjC,EAAa,IAAI,EAAiB,CAEvB,EAA0B,GACjC,EAAW,SAAW,MACjB,CACL,GAAG,EACH,OAAQ,MACR,SAAA,EAAA,EAAA,wBAAgC,EAAW,QAAQ,CACpD,CAGC,EAAW,SAAW,UACjB,CACL,GAAG,EACH,OAAQ,UACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGC,EAAW,SAAW,WACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGI,EAGI,EAA4B,GACvC,EAAa,IAAI,EAAuB"}
1
+ {"version":3,"file":"formatDictionary.cjs","names":[],"sources":["../../src/formatDictionary.ts"],"sourcesContent":["import {\n i18nextToIntlayerFormatter,\n icuToIntlayerFormatter,\n intlayerToI18nextFormatter,\n intlayerToICUFormatter,\n intlayerToVueI18nFormatter,\n vueI18nToIntlayerFormatter,\n} from '@intlayer/core/messageFormat';\nimport type { Dictionary } from '@intlayer/types/dictionary';\n\nexport const formatDictionary = (dictionary: Dictionary): Dictionary => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: icuToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: i18nextToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: vueI18nToIntlayerFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionaries = (dictionaries: Dictionary[]): Dictionary[] =>\n dictionaries.map(formatDictionary);\n\nexport const formatDictionaryOutput = (dictionary: Dictionary) => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'icu',\n content: intlayerToICUFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'i18next',\n content: intlayerToI18nextFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'vue-i18n',\n content: intlayerToVueI18nFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionariesOutput = (dictionaries: Dictionary[]) =>\n dictionaries.map(formatDictionaryOutput);\n"],"mappings":"iJAUA,MAAa,EAAoB,GAC3B,EAAW,SAAW,MACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,wBAAgC,EAAW,QAAQ,CACpD,CAGC,EAAW,SAAW,UACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGC,EAAW,SAAW,WACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGI,EAGI,EAAsB,GACjC,EAAa,IAAI,EAAiB,CAEvB,EAA0B,GACjC,EAAW,SAAW,MACjB,CACL,GAAG,EACH,OAAQ,MACR,SAAA,EAAA,EAAA,wBAAgC,EAAW,QAAQ,CACpD,CAGC,EAAW,SAAW,UACjB,CACL,GAAG,EACH,OAAQ,UACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGC,EAAW,SAAW,WACjB,CACL,GAAG,EACH,OAAQ,WACR,SAAA,EAAA,EAAA,4BAAoC,EAAW,QAAQ,CACxD,CAGI,EAGI,EAA4B,GACvC,EAAa,IAAI,EAAuB"}
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/config/utils`);const t=async(t,n,r={},i)=>{let a=(0,e.kebabCaseToCamelCase)(t),o=a.charAt(0).toLowerCase()+a.slice(1),s=Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>`\n ${/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)?e:JSON.stringify(e)}: ${typeof t==`object`||typeof t==`string`?JSON.stringify(t):t},`).join(``),c;c=i?`{}`:n===`json`||n===`jsonc`||n===`json5`?[`{`,` "$schema": "https://intlayer.org/schema.json",`,` "key": "${t}",${s}`,` "content": {`,` }`,`}`].join(`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-Bmb41Sf3.cjs`);let e=require(`@intlayer/config/utils`);const t=async(t,n,r={},i)=>{let a=(0,e.kebabCaseToCamelCase)(t),o=a.charAt(0).toLowerCase()+a.slice(1),s=Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>`\n ${/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)?e:JSON.stringify(e)}: ${typeof t==`object`||typeof t==`string`?JSON.stringify(t):t},`).join(``),c;c=i?`{}`:n===`json`||n===`jsonc`||n===`json5`?[`{`,` "$schema": "https://intlayer.org/schema.json",`,` "key": "${t}",${s}`,` "content": {`,` }`,`}`].join(`
2
2
  `):[`{`,` key: '${t}',${s}`,` content: {`,` },`,`}`].join(`
3
3
  `);let l=`/** @type {import('intlayer').Dictionary${i?`['content']`:``}} **/`,u=i?`Dictionary['content']`:`Dictionary`;switch(n){case`ts`:return[`import { type Dictionary } from 'intlayer';`,``,`const ${o}Content = ${c} satisfies ${u};`,``,`export default ${o}Content;`,``].join(`
4
4
  `);case`cjs`:return[l,`const ${o}Content = ${c};`,``,`module.exports = ${o}Content;`,``].join(`
@@ -1 +1 @@
1
- {"version":3,"file":"getContentDeclarationFileTemplate.cjs","names":[],"sources":["../../../src/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.ts"],"sourcesContent":["import { kebabCaseToCamelCase } from '@intlayer/config/utils';\nimport type { Format } from '../utils/getFormatFromExtension';\n\nexport const getContentDeclarationFileTemplate = async (\n key: string,\n format: Format,\n fileParams: Record<string, any> = {},\n noMetadata?: boolean\n) => {\n const camelCaseKey = kebabCaseToCamelCase(key);\n const name = camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);\n\n const fileParamsString = Object.entries(fileParams)\n .filter(([, value]) => value !== undefined)\n .map(([paramKey, value]) => {\n const formattedKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(paramKey)\n ? paramKey\n : JSON.stringify(paramKey);\n\n const formattedValue =\n typeof value === 'object' || typeof value === 'string'\n ? JSON.stringify(value)\n : value;\n\n return `\\n ${formattedKey}: ${formattedValue},`;\n })\n .join('');\n\n let content: string;\n\n if (noMetadata) {\n content = '{}';\n } else if (format === 'json' || format === 'jsonc' || format === 'json5') {\n content = [\n '{',\n ' \"$schema\": \"https://intlayer.org/schema.json\",',\n ` \"key\": \"${key}\",${fileParamsString}`,\n ' \"content\": {',\n ' }',\n '}',\n ].join('\\n');\n } else {\n content = [\n '{',\n ` key: '${key}',${fileParamsString}`,\n ' content: {',\n ' },',\n '}',\n ].join('\\n');\n }\n\n const jsdoc = `/** @type {import('intlayer').Dictionary${noMetadata ? \"['content']\" : ''}} **/`;\n const satisfiesType = noMetadata ? \"Dictionary['content']\" : 'Dictionary';\n\n switch (format) {\n case 'ts':\n return [\n \"import { type Dictionary } from 'intlayer';\",\n '',\n `const ${name}Content = ${content} satisfies ${satisfiesType};`,\n '',\n `export default ${name}Content;`,\n '',\n ].join('\\n');\n\n case 'cjs':\n return [\n jsdoc,\n `const ${name}Content = ${content};`,\n '',\n `module.exports = ${name}Content;`,\n '',\n ].join('\\n');\n\n case 'json':\n case 'jsonc':\n case 'json5':\n return [content, ''].join('\\n');\n\n default: // esm\n return [\n jsdoc,\n `const ${name}Content = ${content};`,\n '',\n `export default ${name}Content;`,\n '',\n ].join('\\n');\n }\n};\n"],"mappings":"wJAGA,MAAa,EAAoC,MAC/C,EACA,EACA,EAAkC,EAAE,CACpC,IACG,CACH,IAAM,GAAA,EAAA,EAAA,sBAAoC,EAAI,CACxC,EAAO,EAAa,OAAO,EAAE,CAAC,aAAa,CAAG,EAAa,MAAM,EAAE,CAEnE,EAAmB,OAAO,QAAQ,EAAW,CAChD,QAAQ,EAAG,KAAW,IAAU,IAAA,GAAU,CAC1C,KAAK,CAAC,EAAU,KAUR,OATc,6BAA6B,KAAK,EAAS,CAC5D,EACA,KAAK,UAAU,EAAS,CAOD,IAJzB,OAAO,GAAU,UAAY,OAAO,GAAU,SAC1C,KAAK,UAAU,EAAM,CACrB,EAEwC,GAC9C,CACD,KAAK,GAAG,CAEP,EAEJ,AAYE,EAZE,EACQ,KACD,IAAW,QAAU,IAAW,SAAW,IAAW,QACrD,CACR,IACA,mDACA,aAAa,EAAI,IAAI,IACrB,iBACA,MACA,IACD,CAAC,KAAK;EAAK,CAEF,CACR,IACA,WAAW,EAAI,IAAI,IACnB,eACA,OACA,IACD,CAAC,KAAK;EAAK,CAGd,IAAM,EAAQ,2CAA2C,EAAa,cAAgB,GAAG,OACnF,EAAgB,EAAa,wBAA0B,aAE7D,OAAQ,EAAR,CACE,IAAK,KACH,MAAO,CACL,8CACA,GACA,SAAS,EAAK,YAAY,EAAQ,aAAa,EAAc,GAC7D,GACA,kBAAkB,EAAK,UACvB,GACD,CAAC,KAAK;EAAK,CAEd,IAAK,MACH,MAAO,CACL,EACA,SAAS,EAAK,YAAY,EAAQ,GAClC,GACA,oBAAoB,EAAK,UACzB,GACD,CAAC,KAAK;EAAK,CAEd,IAAK,OACL,IAAK,QACL,IAAK,QACH,MAAO,CAAC,EAAS,GAAG,CAAC,KAAK;EAAK,CAEjC,QACE,MAAO,CACL,EACA,SAAS,EAAK,YAAY,EAAQ,GAClC,GACA,kBAAkB,EAAK,UACvB,GACD,CAAC,KAAK;EAAK"}
1
+ {"version":3,"file":"getContentDeclarationFileTemplate.cjs","names":[],"sources":["../../../src/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.ts"],"sourcesContent":["import { kebabCaseToCamelCase } from '@intlayer/config/utils';\nimport type { Format } from '../utils/getFormatFromExtension';\n\nexport const getContentDeclarationFileTemplate = async (\n key: string,\n format: Format,\n fileParams: Record<string, any> = {},\n noMetadata?: boolean\n) => {\n const camelCaseKey = kebabCaseToCamelCase(key);\n const name = camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);\n\n const fileParamsString = Object.entries(fileParams)\n .filter(([, value]) => value !== undefined)\n .map(([paramKey, value]) => {\n const formattedKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(paramKey)\n ? paramKey\n : JSON.stringify(paramKey);\n\n const formattedValue =\n typeof value === 'object' || typeof value === 'string'\n ? JSON.stringify(value)\n : value;\n\n return `\\n ${formattedKey}: ${formattedValue},`;\n })\n .join('');\n\n let content: string;\n\n if (noMetadata) {\n content = '{}';\n } else if (format === 'json' || format === 'jsonc' || format === 'json5') {\n content = [\n '{',\n ' \"$schema\": \"https://intlayer.org/schema.json\",',\n ` \"key\": \"${key}\",${fileParamsString}`,\n ' \"content\": {',\n ' }',\n '}',\n ].join('\\n');\n } else {\n content = [\n '{',\n ` key: '${key}',${fileParamsString}`,\n ' content: {',\n ' },',\n '}',\n ].join('\\n');\n }\n\n const jsdoc = `/** @type {import('intlayer').Dictionary${noMetadata ? \"['content']\" : ''}} **/`;\n const satisfiesType = noMetadata ? \"Dictionary['content']\" : 'Dictionary';\n\n switch (format) {\n case 'ts':\n return [\n \"import { type Dictionary } from 'intlayer';\",\n '',\n `const ${name}Content = ${content} satisfies ${satisfiesType};`,\n '',\n `export default ${name}Content;`,\n '',\n ].join('\\n');\n\n case 'cjs':\n return [\n jsdoc,\n `const ${name}Content = ${content};`,\n '',\n `module.exports = ${name}Content;`,\n '',\n ].join('\\n');\n\n case 'json':\n case 'jsonc':\n case 'json5':\n return [content, ''].join('\\n');\n\n default: // esm\n return [\n jsdoc,\n `const ${name}Content = ${content};`,\n '',\n `export default ${name}Content;`,\n '',\n ].join('\\n');\n }\n};\n"],"mappings":"4IAGA,MAAa,EAAoC,MAC/C,EACA,EACA,EAAkC,EAAE,CACpC,IACG,CACH,IAAM,GAAA,EAAA,EAAA,sBAAoC,EAAI,CACxC,EAAO,EAAa,OAAO,EAAE,CAAC,aAAa,CAAG,EAAa,MAAM,EAAE,CAEnE,EAAmB,OAAO,QAAQ,EAAW,CAChD,QAAQ,EAAG,KAAW,IAAU,IAAA,GAAU,CAC1C,KAAK,CAAC,EAAU,KAUR,OATc,6BAA6B,KAAK,EAAS,CAC5D,EACA,KAAK,UAAU,EAAS,CAOD,IAJzB,OAAO,GAAU,UAAY,OAAO,GAAU,SAC1C,KAAK,UAAU,EAAM,CACrB,EAEwC,GAC9C,CACD,KAAK,GAAG,CAEP,EAEJ,AAYE,EAZE,EACQ,KACD,IAAW,QAAU,IAAW,SAAW,IAAW,QACrD,CACR,IACA,mDACA,aAAa,EAAI,IAAI,IACrB,iBACA,MACA,IACD,CAAC,KAAK;EAAK,CAEF,CACR,IACA,WAAW,EAAI,IAAI,IACnB,eACA,OACA,IACD,CAAC,KAAK;EAAK,CAGd,IAAM,EAAQ,2CAA2C,EAAa,cAAgB,GAAG,OACnF,EAAgB,EAAa,wBAA0B,aAE7D,OAAQ,EAAR,CACE,IAAK,KACH,MAAO,CACL,8CACA,GACA,SAAS,EAAK,YAAY,EAAQ,aAAa,EAAc,GAC7D,GACA,kBAAkB,EAAK,UACvB,GACD,CAAC,KAAK;EAAK,CAEd,IAAK,MACH,MAAO,CACL,EACA,SAAS,EAAK,YAAY,EAAQ,GAClC,GACA,oBAAoB,EAAK,UACzB,GACD,CAAC,KAAK;EAAK,CAEd,IAAK,OACL,IAAK,QACL,IAAK,QACH,MAAO,CAAC,EAAS,GAAG,CAAC,KAAK;EAAK,CAEjC,QACE,MAAO,CACL,EACA,SAAS,EAAK,YAAY,EAAQ,GAClC,GACA,kBAAkB,EAAK,UACvB,GACD,CAAC,KAAK;EAAK"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs`),t=require(`./utils/formatter.cjs`),n=require(`./buildIntlayerDictionary/buildIntlayerDictionary.cjs`),r=require(`./createType/createModuleAugmentation.cjs`),i=require(`./createType/createType.cjs`),a=require(`./loadDictionaries/loadLocalDictionaries.cjs`);let o=require(`@intlayer/config/logger`);const s=async(s,c)=>{let l=(0,o.getAppLogger)(c);l(`Additional file detected: ${t.formatPath(s)}`,{isVerbose:!0});let u=await n.buildDictionary(await a.loadLocalDictionaries(s,c),c);await i.createTypes(Object.values(u?.mergedDictionaries??{}).map(e=>e.dictionary),c),await e.createDictionaryEntryPoint(c),l(`Dictionaries built`,{isVerbose:!0}),r.createModuleAugmentation(c),l(`Module augmentation built`,{isVerbose:!0});for await(let e of c.plugins??[]){let{unmergedDictionaries:t,mergedDictionaries:n}=u;await e.afterBuild?.({dictionaries:{unmergedDictionaries:t,mergedDictionaries:n},configuration:c})}};exports.handleAdditionalContentDeclarationFile=s;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./chunk-Bmb41Sf3.cjs`);const e=require(`./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs`),t=require(`./utils/formatter.cjs`),n=require(`./buildIntlayerDictionary/buildIntlayerDictionary.cjs`),r=require(`./createType/createModuleAugmentation.cjs`),i=require(`./createType/createType.cjs`),a=require(`./loadDictionaries/loadLocalDictionaries.cjs`);let o=require(`@intlayer/config/logger`);const s=async(s,c)=>{let l=(0,o.getAppLogger)(c);l(`Additional file detected: ${t.formatPath(s)}`,{isVerbose:!0});let u=await n.buildDictionary(await a.loadLocalDictionaries(s,c),c);await i.createTypes(Object.values(u?.mergedDictionaries??{}).map(e=>e.dictionary),c),await e.createDictionaryEntryPoint(c),l(`Dictionaries built`,{isVerbose:!0}),r.createModuleAugmentation(c),l(`Module augmentation built`,{isVerbose:!0});for await(let e of c.plugins??[]){let{unmergedDictionaries:t,mergedDictionaries:n}=u;await e.afterBuild?.({dictionaries:{unmergedDictionaries:t,mergedDictionaries:n},configuration:c})}};exports.handleAdditionalContentDeclarationFile=s;
2
2
  //# sourceMappingURL=handleAdditionalContentDeclarationFile.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleAdditionalContentDeclarationFile.cjs","names":["formatPath","buildDictionary","loadLocalDictionaries","createTypes","createDictionaryEntryPoint"],"sources":["../../src/handleAdditionalContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createModuleAugmentation, createTypes } from './createType/index';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleAdditionalContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Additional file detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n await createDictionaryEntryPoint(config);\n\n appLogger('Dictionaries built', {\n isVerbose: true,\n });\n\n createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"ueAQA,MAAa,EAAyC,MACpD,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAGtC,EAAU,6BAA6BA,EAAAA,WAAW,EAAS,GAAI,CAC7D,UAAW,GACZ,CAAC,CAIF,IAAM,EAAqB,MAAMC,EAAAA,gBAFN,MAAMC,EAAAA,sBAAsB,EAAU,EAAO,CAEH,EAAO,CAM5E,MAAMC,EAAAA,YAJsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CAAC,IAAK,GAAe,EAAW,WAAW,CAEL,EAAO,CAE9C,MAAMC,EAAAA,2BAA2B,EAAO,CAExC,EAAU,qBAAsB,CAC9B,UAAW,GACZ,CAAC,CAEF,EAAA,yBAAyB,EAAO,CAEhC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,CAIF,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
1
+ {"version":3,"file":"handleAdditionalContentDeclarationFile.cjs","names":["formatPath","buildDictionary","loadLocalDictionaries","createTypes","createDictionaryEntryPoint"],"sources":["../../src/handleAdditionalContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createModuleAugmentation, createTypes } from './createType/index';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleAdditionalContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Additional file detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n await createDictionaryEntryPoint(config);\n\n appLogger('Dictionaries built', {\n isVerbose: true,\n });\n\n createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"2dAQA,MAAa,EAAyC,MACpD,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAGtC,EAAU,6BAA6BA,EAAAA,WAAW,EAAS,GAAI,CAC7D,UAAW,GACZ,CAAC,CAIF,IAAM,EAAqB,MAAMC,EAAAA,gBAFN,MAAMC,EAAAA,sBAAsB,EAAU,EAAO,CAEH,EAAO,CAM5E,MAAMC,EAAAA,YAJsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CAAC,IAAK,GAAe,EAAW,WAAW,CAEL,EAAO,CAE9C,MAAMC,EAAAA,2BAA2B,EAAO,CAExC,EAAU,qBAAsB,CAC9B,UAAW,GACZ,CAAC,CAEF,EAAA,yBAAyB,EAAO,CAEhC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,CAIF,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./createDictionaryEntryPoint/getBuiltDictionariesPath.cjs`),t=require(`./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs`),n=require(`./cleanRemovedContentDeclaration.cjs`),r=require(`./utils/formatter.cjs`),i=require(`./buildIntlayerDictionary/buildIntlayerDictionary.cjs`),a=require(`./createType/createModuleAugmentation.cjs`),o=require(`./createType/createType.cjs`),s=require(`./loadDictionaries/loadLocalDictionaries.cjs`);let c=require(`@intlayer/config/logger`);const l=async(l,u)=>{let d=(0,c.getAppLogger)(u);d(`Change detected: ${r.formatPath(l)}`,{isVerbose:!0});let f=await e.getBuiltDictionariesPath(u),p=await s.loadLocalDictionaries(l,u),m=await i.buildDictionary(p,u),h=Object.values(m?.mergedDictionaries??{}),g=h.map(e=>e.dictionaryPath),{excludeKeys:_,hasRebuilt:v}=await n.cleanRemovedContentDeclaration(l,p.map(e=>e.key),u),y=g.some(e=>!f.includes(e));(v||y)&&(v||(await t.createDictionaryEntryPoint(u,{excludeKeys:_}),d(`Dictionary list built`,{isVerbose:!0}))),await o.createTypes(h.map(e=>e.dictionary),u),d(`TypeScript types built`,{isVerbose:!0}),y&&(await a.createModuleAugmentation(u),d(`Module augmentation built`,{isVerbose:!0}));for await(let e of u.plugins??[]){let{unmergedDictionaries:t,mergedDictionaries:n}=m;await e.afterBuild?.({dictionaries:{unmergedDictionaries:t,mergedDictionaries:n},configuration:u})}};exports.handleContentDeclarationFileChange=l;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./chunk-Bmb41Sf3.cjs`);const e=require(`./createDictionaryEntryPoint/getBuiltDictionariesPath.cjs`),t=require(`./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs`),n=require(`./cleanRemovedContentDeclaration.cjs`),r=require(`./utils/formatter.cjs`),i=require(`./buildIntlayerDictionary/buildIntlayerDictionary.cjs`),a=require(`./createType/createModuleAugmentation.cjs`),o=require(`./createType/createType.cjs`),s=require(`./loadDictionaries/loadLocalDictionaries.cjs`);let c=require(`@intlayer/config/logger`);const l=async(l,u)=>{let d=(0,c.getAppLogger)(u);d(`Change detected: ${r.formatPath(l)}`,{isVerbose:!0});let f=await e.getBuiltDictionariesPath(u),p=await s.loadLocalDictionaries(l,u),m=await i.buildDictionary(p,u),h=Object.values(m?.mergedDictionaries??{}),g=h.map(e=>e.dictionaryPath),{excludeKeys:_,hasRebuilt:v}=await n.cleanRemovedContentDeclaration(l,p.map(e=>e.key),u),y=g.some(e=>!f.includes(e));(v||y)&&(v||(await t.createDictionaryEntryPoint(u,{excludeKeys:_}),d(`Dictionary list built`,{isVerbose:!0}))),await o.createTypes(h.map(e=>e.dictionary),u),d(`TypeScript types built`,{isVerbose:!0}),y&&(await a.createModuleAugmentation(u),d(`Module augmentation built`,{isVerbose:!0}));for await(let e of u.plugins??[]){let{unmergedDictionaries:t,mergedDictionaries:n}=m;await e.afterBuild?.({dictionaries:{unmergedDictionaries:t,mergedDictionaries:n},configuration:u})}};exports.handleContentDeclarationFileChange=l;
2
2
  //# sourceMappingURL=handleContentDeclarationFileChange.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleContentDeclarationFileChange.cjs","names":["formatPath","getBuiltDictionariesPath","loadLocalDictionaries","buildDictionary","cleanRemovedContentDeclaration","createDictionaryEntryPoint","createTypes","createModuleAugmentation"],"sources":["../../src/handleContentDeclarationFileChange.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { getBuiltDictionariesPath } from './createDictionaryEntryPoint/getBuiltDictionariesPath';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\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 allDictionariesPaths: string[] = await getBuiltDictionariesPath(config);\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n const updatedDictionaries = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n );\n const updatedDictionariesPaths = updatedDictionaries.map(\n (dictionary) => dictionary.dictionaryPath\n );\n\n const { excludeKeys, hasRebuilt } = await cleanRemovedContentDeclaration(\n filePath,\n localeDictionaries.map((dictionary) => dictionary.key),\n config\n );\n\n const hasNewDictionaries = updatedDictionariesPaths.some(\n (updatedDictionaryPath) =>\n !allDictionariesPaths.includes(updatedDictionaryPath)\n );\n\n // Rebuild Entry Point & Module Augmentation\n // These only need to be updated if the *list* of dictionaries changed (Add/Remove/Rename)\n if (hasRebuilt || hasNewDictionaries) {\n // If hasRebuilt is true, cleanRemovedContentDeclaration has already updated the entry point\n // to remove the old keys (and it likely included the new ones if they were already on disk).\n // If NOT hasRebuilt, we explicitly need to update the entry point to include the new dictionaries.\n if (!hasRebuilt) {\n await createDictionaryEntryPoint(config, { excludeKeys });\n appLogger('Dictionary list built', {\n isVerbose: true,\n });\n }\n }\n\n // Rebuild Types\n // Always regenerate types when a file changes, as the content structure (interface) might have changed\n // even if the key is the same.\n const dictionariesToBuild = updatedDictionaries.map(\n (dictionary) => dictionary.dictionary\n );\n\n await createTypes(dictionariesToBuild, config);\n appLogger('TypeScript types built', {\n isVerbose: true,\n });\n\n if (hasNewDictionaries) {\n await createModuleAugmentation(config);\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n }\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"gmBAWA,MAAa,EAAqC,MAChD,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAGtC,EAAU,oBAAoBA,EAAAA,WAAW,EAAS,GAAI,CACpD,UAAW,GACZ,CAAC,CAEF,IAAM,EAAiC,MAAMC,EAAAA,yBAAyB,EAAO,CAEvE,EAAqB,MAAMC,EAAAA,sBAAsB,EAAU,EAAO,CAElE,EAAqB,MAAMC,EAAAA,gBAAgB,EAAoB,EAAO,CACtE,EAAsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CACK,EAA2B,EAAoB,IAClD,GAAe,EAAW,eAC5B,CAEK,CAAE,cAAa,cAAe,MAAMC,EAAAA,+BACxC,EACA,EAAmB,IAAK,GAAe,EAAW,IAAI,CACtD,EACD,CAEK,EAAqB,EAAyB,KACjD,GACC,CAAC,EAAqB,SAAS,EAAsB,CACxD,EAIG,GAAc,KAIX,IACH,MAAMC,EAAAA,2BAA2B,EAAQ,CAAE,cAAa,CAAC,CACzD,EAAU,wBAAyB,CACjC,UAAW,GACZ,CAAC,GAWN,MAAMC,EAAAA,YAJsB,EAAoB,IAC7C,GAAe,EAAW,WAC5B,CAEsC,EAAO,CAC9C,EAAU,yBAA0B,CAClC,UAAW,GACZ,CAAC,CAEE,IACF,MAAMC,EAAAA,yBAAyB,EAAO,CACtC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,EAKJ,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
1
+ {"version":3,"file":"handleContentDeclarationFileChange.cjs","names":["formatPath","getBuiltDictionariesPath","loadLocalDictionaries","buildDictionary","cleanRemovedContentDeclaration","createDictionaryEntryPoint","createTypes","createModuleAugmentation"],"sources":["../../src/handleContentDeclarationFileChange.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { getBuiltDictionariesPath } from './createDictionaryEntryPoint/getBuiltDictionariesPath';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\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 allDictionariesPaths: string[] = await getBuiltDictionariesPath(config);\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n const updatedDictionaries = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n );\n const updatedDictionariesPaths = updatedDictionaries.map(\n (dictionary) => dictionary.dictionaryPath\n );\n\n const { excludeKeys, hasRebuilt } = await cleanRemovedContentDeclaration(\n filePath,\n localeDictionaries.map((dictionary) => dictionary.key),\n config\n );\n\n const hasNewDictionaries = updatedDictionariesPaths.some(\n (updatedDictionaryPath) =>\n !allDictionariesPaths.includes(updatedDictionaryPath)\n );\n\n // Rebuild Entry Point & Module Augmentation\n // These only need to be updated if the *list* of dictionaries changed (Add/Remove/Rename)\n if (hasRebuilt || hasNewDictionaries) {\n // If hasRebuilt is true, cleanRemovedContentDeclaration has already updated the entry point\n // to remove the old keys (and it likely included the new ones if they were already on disk).\n // If NOT hasRebuilt, we explicitly need to update the entry point to include the new dictionaries.\n if (!hasRebuilt) {\n await createDictionaryEntryPoint(config, { excludeKeys });\n appLogger('Dictionary list built', {\n isVerbose: true,\n });\n }\n }\n\n // Rebuild Types\n // Always regenerate types when a file changes, as the content structure (interface) might have changed\n // even if the key is the same.\n const dictionariesToBuild = updatedDictionaries.map(\n (dictionary) => dictionary.dictionary\n );\n\n await createTypes(dictionariesToBuild, config);\n appLogger('TypeScript types built', {\n isVerbose: true,\n });\n\n if (hasNewDictionaries) {\n await createModuleAugmentation(config);\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n }\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"olBAWA,MAAa,EAAqC,MAChD,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAGtC,EAAU,oBAAoBA,EAAAA,WAAW,EAAS,GAAI,CACpD,UAAW,GACZ,CAAC,CAEF,IAAM,EAAiC,MAAMC,EAAAA,yBAAyB,EAAO,CAEvE,EAAqB,MAAMC,EAAAA,sBAAsB,EAAU,EAAO,CAElE,EAAqB,MAAMC,EAAAA,gBAAgB,EAAoB,EAAO,CACtE,EAAsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CACK,EAA2B,EAAoB,IAClD,GAAe,EAAW,eAC5B,CAEK,CAAE,cAAa,cAAe,MAAMC,EAAAA,+BACxC,EACA,EAAmB,IAAK,GAAe,EAAW,IAAI,CACtD,EACD,CAEK,EAAqB,EAAyB,KACjD,GACC,CAAC,EAAqB,SAAS,EAAsB,CACxD,EAIG,GAAc,KAIX,IACH,MAAMC,EAAAA,2BAA2B,EAAQ,CAAE,cAAa,CAAC,CACzD,EAAU,wBAAyB,CACjC,UAAW,GACZ,CAAC,GAWN,MAAMC,EAAAA,YAJsB,EAAoB,IAC7C,GAAe,EAAW,WAC5B,CAEsC,EAAO,CAC9C,EAAU,yBAA0B,CAClC,UAAW,GACZ,CAAC,CAEE,IACF,MAAMC,EAAAA,yBAAyB,EAAO,CACtC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,EAKJ,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./cleanRemovedContentDeclaration.cjs`),t=require(`./utils/formatter.cjs`),n=require(`./loadDictionaries/loadLocalDictionaries.cjs`),r=require(`./handleContentDeclarationFileChange.cjs`);let i=require(`@intlayer/config/logger`);const a=async(a,o,s)=>{let c=(0,i.getAppLogger)(s);c(`File moved from ${t.formatPath(a)} to ${t.formatPath(o)}`,{isVerbose:!0});let l=[];try{l=(await n.loadLocalDictionaries(o,s)).map(e=>e.key)}catch{c(`Error parsing new file during move operation: ${t.formatPath(o)}`,{isVerbose:!0})}await e.cleanRemovedContentDeclaration(a,l,s),await r.handleContentDeclarationFileChange(o,s)};exports.handleContentDeclarationFileMoved=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./chunk-Bmb41Sf3.cjs`);const e=require(`./cleanRemovedContentDeclaration.cjs`),t=require(`./utils/formatter.cjs`),n=require(`./loadDictionaries/loadLocalDictionaries.cjs`),r=require(`./handleContentDeclarationFileChange.cjs`);let i=require(`@intlayer/config/logger`);const a=async(a,o,s)=>{let c=(0,i.getAppLogger)(s);c(`File moved from ${t.formatPath(a)} to ${t.formatPath(o)}`,{isVerbose:!0});let l=[];try{l=(await n.loadLocalDictionaries(o,s)).map(e=>e.key)}catch{c(`Error parsing new file during move operation: ${t.formatPath(o)}`,{isVerbose:!0})}await e.cleanRemovedContentDeclaration(a,l,s),await r.handleContentDeclarationFileChange(o,s)};exports.handleContentDeclarationFileMoved=a;
2
2
  //# sourceMappingURL=handleContentDeclarationFileMoved.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleContentDeclarationFileMoved.cjs","names":["formatPath","loadLocalDictionaries","cleanRemovedContentDeclaration","handleContentDeclarationFileChange"],"sources":["../../src/handleContentDeclarationFileMoved.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { handleContentDeclarationFileChange } from './handleContentDeclarationFileChange';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileMoved = async (\n oldFilePath: string,\n newFilePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n appLogger(\n `File moved from ${formatPath(oldFilePath)} to ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n\n let keysToKeep: string[] = [];\n\n try {\n // Pre-load the new file to identify the keys inside it.\n // We need to pass these keys to the cleaner so it knows NOT to completely delete\n // the dictionary artifacts (types/json) if the key has simply moved to a new file.\n const newLocaleDictionaries = await loadLocalDictionaries(\n newFilePath,\n config\n );\n keysToKeep = newLocaleDictionaries.map((d) => d.key);\n } catch {\n appLogger(\n `Error parsing new file during move operation: ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n // Proceed with empty keysToKeep; this will result in the old dictionary being cleaned up\n // entirely, and the new one being re-created in the next step.\n }\n\n // Clean up the artifacts associated with the old file path.\n // By passing 'keysToKeep', we instruct the cleaner to remove the specific file association\n // (filePath reference) from the dictionaries, but preserve the dictionary Entry Point and Types\n // if the key is still present in the new file.\n await cleanRemovedContentDeclaration(oldFilePath, keysToKeep, config);\n\n // Process the new file.\n // This will add the new file association, rebuild the dictionary JSONs with the new path,\n // and ensure types and module augmentation are up to date.\n await handleContentDeclarationFileChange(newFilePath, config);\n};\n"],"mappings":"mWAOA,MAAa,EAAoC,MAC/C,EACA,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAEtC,EACE,mBAAmBA,EAAAA,WAAW,EAAY,CAAC,MAAMA,EAAAA,WAAW,EAAY,GACxE,CACE,UAAW,GACZ,CACF,CAED,IAAI,EAAuB,EAAE,CAE7B,GAAI,CAQF,GAJ8B,MAAMC,EAAAA,sBAClC,EACA,EACD,EACkC,IAAK,GAAM,EAAE,IAAI,MAC9C,CACN,EACE,iDAAiDD,EAAAA,WAAW,EAAY,GACxE,CACE,UAAW,GACZ,CACF,CASH,MAAME,EAAAA,+BAA+B,EAAa,EAAY,EAAO,CAKrE,MAAMC,EAAAA,mCAAmC,EAAa,EAAO"}
1
+ {"version":3,"file":"handleContentDeclarationFileMoved.cjs","names":["formatPath","loadLocalDictionaries","cleanRemovedContentDeclaration","handleContentDeclarationFileChange"],"sources":["../../src/handleContentDeclarationFileMoved.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { handleContentDeclarationFileChange } from './handleContentDeclarationFileChange';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileMoved = async (\n oldFilePath: string,\n newFilePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n appLogger(\n `File moved from ${formatPath(oldFilePath)} to ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n\n let keysToKeep: string[] = [];\n\n try {\n // Pre-load the new file to identify the keys inside it.\n // We need to pass these keys to the cleaner so it knows NOT to completely delete\n // the dictionary artifacts (types/json) if the key has simply moved to a new file.\n const newLocaleDictionaries = await loadLocalDictionaries(\n newFilePath,\n config\n );\n keysToKeep = newLocaleDictionaries.map((d) => d.key);\n } catch {\n appLogger(\n `Error parsing new file during move operation: ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n // Proceed with empty keysToKeep; this will result in the old dictionary being cleaned up\n // entirely, and the new one being re-created in the next step.\n }\n\n // Clean up the artifacts associated with the old file path.\n // By passing 'keysToKeep', we instruct the cleaner to remove the specific file association\n // (filePath reference) from the dictionaries, but preserve the dictionary Entry Point and Types\n // if the key is still present in the new file.\n await cleanRemovedContentDeclaration(oldFilePath, keysToKeep, config);\n\n // Process the new file.\n // This will add the new file association, rebuild the dictionary JSONs with the new path,\n // and ensure types and module augmentation are up to date.\n await handleContentDeclarationFileChange(newFilePath, config);\n};\n"],"mappings":"uVAOA,MAAa,EAAoC,MAC/C,EACA,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAEtC,EACE,mBAAmBA,EAAAA,WAAW,EAAY,CAAC,MAAMA,EAAAA,WAAW,EAAY,GACxE,CACE,UAAW,GACZ,CACF,CAED,IAAI,EAAuB,EAAE,CAE7B,GAAI,CAQF,GAJ8B,MAAMC,EAAAA,sBAClC,EACA,EACD,EACkC,IAAK,GAAM,EAAE,IAAI,MAC9C,CACN,EACE,iDAAiDD,EAAAA,WAAW,EAAY,GACxE,CACE,UAAW,GACZ,CACF,CASH,MAAME,EAAAA,+BAA+B,EAAa,EAAY,EAAO,CAKrE,MAAMC,EAAAA,mCAAmC,EAAa,EAAO"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./cleanRemovedContentDeclaration.cjs`),t=require(`./utils/formatter.cjs`),n=require(`./buildIntlayerDictionary/buildIntlayerDictionary.cjs`),r=require(`./createType/createModuleAugmentation.cjs`),i=require(`./createType/createType.cjs`),a=require(`./loadDictionaries/loadLocalDictionaries.cjs`),o=require(`./listDictionariesPath.cjs`);let s=require(`node:path`),c=require(`@intlayer/config/logger`);const l=async(l,u)=>{let d=(0,c.getAppLogger)(u);d(`Unlinked detected: ${t.formatPath(l)}`,{isVerbose:!0});let f=await a.loadLocalDictionaries((await o.listDictionaries(u)).filter(e=>(0,s.normalize)(e)!==(0,s.normalize)(l)),u);await e.cleanRemovedContentDeclaration(l,[],u);let p=await n.buildDictionary(f,u);await i.createTypes(Object.values(p?.mergedDictionaries??{}).map(e=>e.dictionary),u),d(`Dictionaries rebuilt`,{isVerbose:!0}),await r.createModuleAugmentation(u),d(`Module augmentation built`,{isVerbose:!0});for await(let e of u.plugins??[]){let{unmergedDictionaries:t,mergedDictionaries:n}=p;await e.afterBuild?.({dictionaries:{unmergedDictionaries:t,mergedDictionaries:n},configuration:u})}};exports.handleUnlinkedContentDeclarationFile=l;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./chunk-Bmb41Sf3.cjs`);const e=require(`./cleanRemovedContentDeclaration.cjs`),t=require(`./utils/formatter.cjs`),n=require(`./buildIntlayerDictionary/buildIntlayerDictionary.cjs`),r=require(`./createType/createModuleAugmentation.cjs`),i=require(`./createType/createType.cjs`),a=require(`./loadDictionaries/loadLocalDictionaries.cjs`),o=require(`./listDictionariesPath.cjs`);let s=require(`node:path`),c=require(`@intlayer/config/logger`);const l=async(l,u)=>{let d=(0,c.getAppLogger)(u);d(`Unlinked detected: ${t.formatPath(l)}`,{isVerbose:!0});let f=await a.loadLocalDictionaries((await o.listDictionaries(u)).filter(e=>(0,s.normalize)(e)!==(0,s.normalize)(l)),u);await e.cleanRemovedContentDeclaration(l,[],u);let p=await n.buildDictionary(f,u);await i.createTypes(Object.values(p?.mergedDictionaries??{}).map(e=>e.dictionary),u),d(`Dictionaries rebuilt`,{isVerbose:!0}),await r.createModuleAugmentation(u),d(`Module augmentation built`,{isVerbose:!0});for await(let e of u.plugins??[]){let{unmergedDictionaries:t,mergedDictionaries:n}=p;await e.afterBuild?.({dictionaries:{unmergedDictionaries:t,mergedDictionaries:n},configuration:u})}};exports.handleUnlinkedContentDeclarationFile=l;
2
2
  //# sourceMappingURL=handleUnlinkedContentDeclarationFile.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleUnlinkedContentDeclarationFile.cjs","names":["formatPath","loadLocalDictionaries","listDictionaries","cleanRemovedContentDeclaration","buildDictionary","createTypes","createModuleAugmentation"],"sources":["../../src/handleUnlinkedContentDeclarationFile.ts"],"sourcesContent":["import { normalize } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\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 handleUnlinkedContentDeclarationFile = 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[] = await listDictionaries(config);\n\n const existingFiles = files.filter(\n (file) => normalize(file) !== normalize(filePath)\n );\n\n const localeDictionaries = await loadLocalDictionaries(existingFiles, config);\n\n await cleanRemovedContentDeclaration(filePath, [], config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"+gBAWA,MAAa,EAAuC,MAClD,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAGtC,EAAU,sBAAsBA,EAAAA,WAAW,EAAS,GAAI,CACtD,UAAW,GACZ,CAAC,CAQF,IAAM,EAAqB,MAAMC,EAAAA,uBANT,MAAMC,EAAAA,iBAAiB,EAAO,EAE1B,OACzB,IAAA,EAAA,EAAA,WAAmB,EAAK,IAAA,EAAA,EAAA,WAAe,EAAS,CAClD,CAEqE,EAAO,CAE7E,MAAMC,EAAAA,+BAA+B,EAAU,EAAE,CAAE,EAAO,CAE1D,IAAM,EAAqB,MAAMC,EAAAA,gBAAgB,EAAoB,EAAO,CAM5E,MAAMC,EAAAA,YAJsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CAAC,IAAK,GAAe,EAAW,WAAW,CAEL,EAAO,CAE9C,EAAU,uBAAwB,CAChC,UAAW,GACZ,CAAC,CAEF,MAAMC,EAAAA,yBAAyB,EAAO,CAEtC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,CAIF,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
1
+ {"version":3,"file":"handleUnlinkedContentDeclarationFile.cjs","names":["formatPath","loadLocalDictionaries","listDictionaries","cleanRemovedContentDeclaration","buildDictionary","createTypes","createModuleAugmentation"],"sources":["../../src/handleUnlinkedContentDeclarationFile.ts"],"sourcesContent":["import { normalize } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\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 handleUnlinkedContentDeclarationFile = 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[] = await listDictionaries(config);\n\n const existingFiles = files.filter(\n (file) => normalize(file) !== normalize(filePath)\n );\n\n const localeDictionaries = await loadLocalDictionaries(existingFiles, config);\n\n await cleanRemovedContentDeclaration(filePath, [], config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"mgBAWA,MAAa,EAAuC,MAClD,EACA,IACG,CACH,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAO,CAGtC,EAAU,sBAAsBA,EAAAA,WAAW,EAAS,GAAI,CACtD,UAAW,GACZ,CAAC,CAQF,IAAM,EAAqB,MAAMC,EAAAA,uBANT,MAAMC,EAAAA,iBAAiB,EAAO,EAE1B,OACzB,IAAA,EAAA,EAAA,WAAmB,EAAK,IAAA,EAAA,EAAA,WAAe,EAAS,CAClD,CAEqE,EAAO,CAE7E,MAAMC,EAAAA,+BAA+B,EAAU,EAAE,CAAE,EAAO,CAE1D,IAAM,EAAqB,MAAMC,EAAAA,gBAAgB,EAAoB,EAAO,CAM5E,MAAMC,EAAAA,YAJsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CAAC,IAAK,GAAe,EAAW,WAAW,CAEL,EAAO,CAE9C,EAAU,uBAAwB,CAChC,UAAW,GACZ,CAAC,CAEF,MAAMC,EAAAA,yBAAyB,EAAO,CAEtC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,CAIF,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../initConfig/index.cjs`),t=require(`./utils/configManipulation.cjs`),n=require(`./utils/fileSystem.cjs`),r=require(`./utils/jsonParser.cjs`),i=require(`./utils/tsConfig.cjs`);let a=require(`node:path`),o=require(`@intlayer/config/logger`),s=require(`@intlayer/config/node`),c=require(`@intlayer/config/utils`);const l={NextJS:`https://intlayer.org/doc/environment/nextjs.md`,NextJS_15:`https://intlayer.org/doc/environment/nextjs/15.md`,NextJS_14:`https://intlayer.org/doc/environment/nextjs/14.md`,CRA:`https://intlayer.org/doc/environment/create-react-app.md`,Astro:`https://intlayer.org/doc/environment/astro.md`,ViteAndReact:`https://intlayer.org/doc/environment/vite-and-react.md`,ViteAndReact_ReactRouterV7:`https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md`,ViteAndReact_ReactRouterV7_FSRoutes:`https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md`,ViteAndVue:`https://intlayer.org/doc/environment/vite-and-vue.md`,ViteAndSolid:`https://intlayer.org/doc/environment/vite-and-solid.md`,ViteAndSvelte:`https://intlayer.org/doc/environment/vite-and-svelte.md`,ViteAndPreact:`https://intlayer.org/doc/environment/vite-and-preact.md`,TanStackRouter:`https://intlayer.org/doc/environment/tanstack.md`,NuxtAndVue:`https://intlayer.org/doc/environment/nuxt-and-vue.md`,Angular:`https://intlayer.org/doc/environment/angular.md`,SvelteKit:`https://intlayer.org/doc/environment/sveltekit.md`,ReactNativeAndExpo:`https://intlayer.org/doc/environment/react-native-and-expo.md`,Lynx:`https://intlayer.org/doc/environment/lynx-and-react.md`,Express:`https://intlayer.org/doc/environment/express.md`,NestJS:`https://intlayer.org/doc/environment/nestjs.md`,Fastify:`https://intlayer.org/doc/environment/fastify.md`,Default:`https://intlayer.org/doc/get-started`,NextIntl:`https://intlayer.org/blog/intlayer-with-next-intl.md`,ReactI18Next:`https://intlayer.org/blog/intlayer-with-react-i18next.md`,ReactIntl:`https://intlayer.org/blog/intlayer-with-react-intl.md`,NextI18Next:`https://intlayer.org/blog/intlayer-with-next-i18next.md`,VueI18n:`https://intlayer.org/blog/intlayer-with-vue-i18n.md`},u=e=>{let t={...e.dependencies,...e.devDependencies},n=(e,t)=>!e||typeof e!=`string`?!1:RegExp(`^[\\^~]?${t}(?:\\.|$)`).test(e);if(t[`@lynx-js/react`]||t[`@lynx-js/core`])return l.Lynx;if(t[`react-native`]||t.expo)return l.ReactNativeAndExpo;if(t.next){let e=t.next;return n(e,14)?l.NextJS_14:n(e,15)?l.NextJS_15:l.NextJS}if(t.nuxt)return l.NuxtAndVue;if(t.astro)return l.Astro;if(t[`@sveltejs/kit`])return l.SvelteKit;if(t[`@tanstack/react-router`])return l.TanStackRouter;let r=t[`react-router`];if(r&&typeof r==`string`){if(t[`@react-router/fs-routes`])return l.ViteAndReact_ReactRouterV7_FSRoutes;if(n(r,7))return l.ViteAndReact_ReactRouterV7}return t.vite?t.vue?l.ViteAndVue:t[`solid-js`]?l.ViteAndSolid:t.svelte?l.ViteAndSvelte:t.preact?l.ViteAndPreact:l.ViteAndReact:t[`react-scripts`]?l.CRA:t[`@angular/core`]?l.Angular:t[`@nestjs/core`]?l.NestJS:t.express?l.Express:t.fastify?l.Fastify:t[`next-intl`]?l.NextIntl:t[`react-i18next`]||t.i18next?l.ReactI18Next:t[`react-intl`]?l.ReactIntl:t[`next-i18next`]?l.NextI18Next:t[`vue-i18n`]?l.VueI18n:l.Default},d=async l=>{(0,o.logger)((0,o.colorize)(`Checking Intlayer configuration...`,o.ANSIColors.CYAN));let d=`package.json`;await n.exists(l,d)||((0,o.logger)(`${o.x} No ${(0,o.colorizePath)(`package.json`)} found. Please run this script from the project root.`,{level:`error`}),process.exit(1));let f=await n.readFileFromRoot(l,d),p;try{p=JSON.parse(f)}catch{(0,o.logger)(`${o.x} Could not parse ${(0,o.colorizePath)(`package.json`)}.`,{level:`error`}),process.exit(1)}let m=u(p),h=`.gitignore`;if(await n.exists(l,h)){let e=await n.readFileFromRoot(l,h);e.includes(`intlayer`)?(0,o.logger)(`${o.v} ${(0,o.colorizePath)(h)} already includes .intlayer`):(await n.writeFileToRoot(l,h,`${e}\n# Intlayer\n.intlayer\n`),(0,o.logger)(`${o.v} Added ${(0,o.colorizePath)(`.intlayer`)} to ${(0,o.colorizePath)(h)}`))}let g=`.vscode`,_=(0,a.join)(g,`extensions.json`),v=`intlayer.intlayer-vs-code-extension`;try{let e={recommendations:[]};await n.exists(l,_)?e=r.parseJSONWithComments(await n.readFileFromRoot(l,_)):await n.ensureDirectory(l,g),e.recommendations||=[],e.recommendations.includes(v)?(0,o.logger)(`${o.v} ${(0,o.colorizePath)(_)} already includes ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)}`):(e.recommendations.push(v),await n.writeFileToRoot(l,_,JSON.stringify(e,null,2)),(0,o.logger)(`${o.v} Added ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)} to ${(0,o.colorizePath)(_)}`))}catch{(0,o.logger)(`${o.x} Could not update ${(0,o.colorizePath)(_)}. You may need to add ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)} manually.`,{level:`warn`})}let y=await i.findTsConfigFiles(l),b=!1;for(let e of y)if(await n.exists(l,e)){b=!0;try{let t=r.parseJSONWithComments(await n.readFileFromRoot(l,e)),i=`.intlayer/**/*.ts`,a=!1;t.include&&(Array.isArray(t.include)&&!t.include.some(e=>e.includes(`.intlayer`))?(t.include.push(i),a=!0):t.include.includes(i)&&(0,o.logger)(`${o.v} ${(0,o.colorizePath)(e)} already includes intlayer types`)),a&&(await n.writeFileToRoot(l,e,JSON.stringify(t,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include intlayer types`))}catch{(0,o.logger)(`${o.x} Could not parse or update ${(0,o.colorizePath)(e)}. You may need to add ${(0,o.colorizePath)(`.intlayer/types/**/*.ts`)} manually.`,{level:`warn`})}}await e.initConfig(b?`intlayer.config.ts`:`intlayer.config.mjs`,l);let x=!1;for(let e of[`vite.config.ts`,`vite.config.js`,`vite.config.mjs`])if(await n.exists(l,e)){x=!0;let r=await n.readFileFromRoot(l,e);r.includes(`vite-intlayer`)||(await n.writeFileToRoot(l,e,t.updateViteConfig(r,e.split(`.`).pop())),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include Intlayer plugin`));break}let S=[`next.config.js`,`next.config.mjs`,`next.config.ts`],C=!1;for(let e of S)if(await n.exists(l,e)){C=!0,x=!0;let r=await n.readFileFromRoot(l,e);r.includes(`next-intlayer`)||(await n.writeFileToRoot(l,e,t.updateNextConfig(r,e.split(`.`).pop())),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include Intlayer plugin`));break}if(C){let e=p.dependencies?.next||p.devDependencies?.next;if(e&&((e,t)=>{if(!e||typeof e!=`string`)return!1;let n=e.match(/^[^\d]*(\d+)/);return n?parseInt(n[1],10)>=t:!1})(e,16)){let e=p.scripts?.dev,t=`intlayer watch --with 'bun run --bun next dev'`;e&&e!==t&&e.includes(`next dev`)&&(p.scripts.dev=t,await n.writeFileToRoot(l,d,JSON.stringify(p,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(`package.json`)} dev script for Next.js >= 16`))}}for(let e of[`webpack.config.js`,`webpack.config.ts`,`webpack.config.mjs`,`webpack.config.cjs`])if(await n.exists(l,e)){x=!0,(0,o.logger)(`${o.v} Found ${(0,o.colorizePath)(e)}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`);break}if(!x){let e=(0,c.getAlias)({configuration:(0,s.getConfiguration)({baseDir:l})});if(b&&y.length>0){let t=y.find(e=>e===`tsconfig.json`)||y[0],i=r.parseJSONWithComments(await n.readFileFromRoot(l,t));i.compilerOptions??={},i.compilerOptions.paths??={};let a=!1;Object.entries(e).forEach(([e,t])=>{i.compilerOptions.paths[e]||(i.compilerOptions.paths[e]=[t],a=!0)}),a&&(await n.writeFileToRoot(l,t,JSON.stringify(i,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(t)} to include Intlayer aliases`))}else{let t=`jsconfig.json`;if(await n.exists(l,t)){let i=r.parseJSONWithComments(await n.readFileFromRoot(l,t));i.compilerOptions??={},i.compilerOptions.paths??={};let a=!1;Object.entries(e).forEach(([e,t])=>{i.compilerOptions.paths[e]||(i.compilerOptions.paths[e]=[t],a=!0)}),a&&(await n.writeFileToRoot(l,t,JSON.stringify(i,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(t)} to include Intlayer aliases`))}else{p.imports??={};let t=!1;Object.entries(e).forEach(([e,n])=>{let r=e.replace(`@`,`#`),i=n.startsWith(`.`)?n:`./${n}`;p.imports[r]||(p.imports[r]=i,t=!0)}),t&&(await n.writeFileToRoot(l,d,JSON.stringify(p,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(d)} to include Intlayer imports`))}}}(0,o.logger)(`${o.v} ${(0,o.colorize)(`Intlayer init setup complete.`,o.ANSIColors.GREEN)}`),(0,o.logger)([(0,o.colorize)(`Next →`,o.ANSIColors.MAGENTA),(0,o.colorize)(`Follow the instructions in the documentation to complete the setup:`,o.ANSIColors.GREY_LIGHT),(0,o.colorizePath)(m)])};exports.initIntlayer=d;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../chunk-Bmb41Sf3.cjs`);const e=require(`../initConfig/index.cjs`),t=require(`./utils/configManipulation.cjs`),n=require(`./utils/fileSystem.cjs`),r=require(`./utils/jsonParser.cjs`),i=require(`./utils/tsConfig.cjs`);let a=require(`node:path`),o=require(`@intlayer/config/logger`),s=require(`@intlayer/config/node`),c=require(`@intlayer/config/utils`);const l={NextJS:`https://intlayer.org/doc/environment/nextjs.md`,NextJS_15:`https://intlayer.org/doc/environment/nextjs/15.md`,NextJS_14:`https://intlayer.org/doc/environment/nextjs/14.md`,CRA:`https://intlayer.org/doc/environment/create-react-app.md`,Astro:`https://intlayer.org/doc/environment/astro.md`,ViteAndReact:`https://intlayer.org/doc/environment/vite-and-react.md`,ViteAndReact_ReactRouterV7:`https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md`,ViteAndReact_ReactRouterV7_FSRoutes:`https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md`,ViteAndVue:`https://intlayer.org/doc/environment/vite-and-vue.md`,ViteAndSolid:`https://intlayer.org/doc/environment/vite-and-solid.md`,ViteAndSvelte:`https://intlayer.org/doc/environment/vite-and-svelte.md`,ViteAndPreact:`https://intlayer.org/doc/environment/vite-and-preact.md`,TanStackRouter:`https://intlayer.org/doc/environment/tanstack.md`,NuxtAndVue:`https://intlayer.org/doc/environment/nuxt-and-vue.md`,Angular:`https://intlayer.org/doc/environment/angular.md`,SvelteKit:`https://intlayer.org/doc/environment/sveltekit.md`,ReactNativeAndExpo:`https://intlayer.org/doc/environment/react-native-and-expo.md`,Lynx:`https://intlayer.org/doc/environment/lynx-and-react.md`,Express:`https://intlayer.org/doc/environment/express.md`,NestJS:`https://intlayer.org/doc/environment/nestjs.md`,Fastify:`https://intlayer.org/doc/environment/fastify.md`,Default:`https://intlayer.org/doc/get-started`,NextIntl:`https://intlayer.org/blog/intlayer-with-next-intl.md`,ReactI18Next:`https://intlayer.org/blog/intlayer-with-react-i18next.md`,ReactIntl:`https://intlayer.org/blog/intlayer-with-react-intl.md`,NextI18Next:`https://intlayer.org/blog/intlayer-with-next-i18next.md`,VueI18n:`https://intlayer.org/blog/intlayer-with-vue-i18n.md`},u=e=>{let t={...e.dependencies,...e.devDependencies},n=(e,t)=>!e||typeof e!=`string`?!1:RegExp(`^[\\^~]?${t}(?:\\.|$)`).test(e);if(t[`@lynx-js/react`]||t[`@lynx-js/core`])return l.Lynx;if(t[`react-native`]||t.expo)return l.ReactNativeAndExpo;if(t.next){let e=t.next;return n(e,14)?l.NextJS_14:n(e,15)?l.NextJS_15:l.NextJS}if(t.nuxt)return l.NuxtAndVue;if(t.astro)return l.Astro;if(t[`@sveltejs/kit`])return l.SvelteKit;if(t[`@tanstack/react-router`])return l.TanStackRouter;let r=t[`react-router`];if(r&&typeof r==`string`){if(t[`@react-router/fs-routes`])return l.ViteAndReact_ReactRouterV7_FSRoutes;if(n(r,7))return l.ViteAndReact_ReactRouterV7}return t.vite?t.vue?l.ViteAndVue:t[`solid-js`]?l.ViteAndSolid:t.svelte?l.ViteAndSvelte:t.preact?l.ViteAndPreact:l.ViteAndReact:t[`react-scripts`]?l.CRA:t[`@angular/core`]?l.Angular:t[`@nestjs/core`]?l.NestJS:t.express?l.Express:t.fastify?l.Fastify:t[`next-intl`]?l.NextIntl:t[`react-i18next`]||t.i18next?l.ReactI18Next:t[`react-intl`]?l.ReactIntl:t[`next-i18next`]?l.NextI18Next:t[`vue-i18n`]?l.VueI18n:l.Default},d=async l=>{(0,o.logger)((0,o.colorize)(`Checking Intlayer configuration...`,o.ANSIColors.CYAN));let d=`package.json`;await n.exists(l,d)||((0,o.logger)(`${o.x} No ${(0,o.colorizePath)(`package.json`)} found. Please run this script from the project root.`,{level:`error`}),process.exit(1));let f=await n.readFileFromRoot(l,d),p;try{p=JSON.parse(f)}catch{(0,o.logger)(`${o.x} Could not parse ${(0,o.colorizePath)(`package.json`)}.`,{level:`error`}),process.exit(1)}let m=u(p),h=`.gitignore`;if(await n.exists(l,h)){let e=await n.readFileFromRoot(l,h);e.includes(`intlayer`)?(0,o.logger)(`${o.v} ${(0,o.colorizePath)(h)} already includes .intlayer`):(await n.writeFileToRoot(l,h,`${e}\n# Intlayer\n.intlayer\n`),(0,o.logger)(`${o.v} Added ${(0,o.colorizePath)(`.intlayer`)} to ${(0,o.colorizePath)(h)}`))}let g=`.vscode`,_=(0,a.join)(g,`extensions.json`),v=`intlayer.intlayer-vs-code-extension`;try{let e={recommendations:[]};await n.exists(l,_)?e=r.parseJSONWithComments(await n.readFileFromRoot(l,_)):await n.ensureDirectory(l,g),e.recommendations||=[],e.recommendations.includes(v)?(0,o.logger)(`${o.v} ${(0,o.colorizePath)(_)} already includes ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)}`):(e.recommendations.push(v),await n.writeFileToRoot(l,_,JSON.stringify(e,null,2)),(0,o.logger)(`${o.v} Added ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)} to ${(0,o.colorizePath)(_)}`))}catch{(0,o.logger)(`${o.x} Could not update ${(0,o.colorizePath)(_)}. You may need to add ${(0,o.colorize)(v,o.ANSIColors.MAGENTA)} manually.`,{level:`warn`})}let y=await i.findTsConfigFiles(l),b=!1;for(let e of y)if(await n.exists(l,e)){b=!0;try{let t=r.parseJSONWithComments(await n.readFileFromRoot(l,e)),i=`.intlayer/**/*.ts`,a=!1;t.include&&(Array.isArray(t.include)&&!t.include.some(e=>e.includes(`.intlayer`))?(t.include.push(i),a=!0):t.include.includes(i)&&(0,o.logger)(`${o.v} ${(0,o.colorizePath)(e)} already includes intlayer types`)),a&&(await n.writeFileToRoot(l,e,JSON.stringify(t,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include intlayer types`))}catch{(0,o.logger)(`${o.x} Could not parse or update ${(0,o.colorizePath)(e)}. You may need to add ${(0,o.colorizePath)(`.intlayer/types/**/*.ts`)} manually.`,{level:`warn`})}}await e.initConfig(b?`intlayer.config.ts`:`intlayer.config.mjs`,l);let x=!1;for(let e of[`vite.config.ts`,`vite.config.js`,`vite.config.mjs`])if(await n.exists(l,e)){x=!0;let r=await n.readFileFromRoot(l,e);r.includes(`vite-intlayer`)||(await n.writeFileToRoot(l,e,t.updateViteConfig(r,e.split(`.`).pop())),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include Intlayer plugin`));break}let S=[`next.config.js`,`next.config.mjs`,`next.config.ts`],C=!1;for(let e of S)if(await n.exists(l,e)){C=!0,x=!0;let r=await n.readFileFromRoot(l,e);r.includes(`next-intlayer`)||(await n.writeFileToRoot(l,e,t.updateNextConfig(r,e.split(`.`).pop())),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(e)} to include Intlayer plugin`));break}if(C){let e=p.dependencies?.next||p.devDependencies?.next;if(e&&((e,t)=>{if(!e||typeof e!=`string`)return!1;let n=e.match(/^[^\d]*(\d+)/);return n?parseInt(n[1],10)>=t:!1})(e,16)){let e=p.scripts?.dev,t=`intlayer watch --with 'bun run --bun next dev'`;e&&e!==t&&e.includes(`next dev`)&&(p.scripts.dev=t,await n.writeFileToRoot(l,d,JSON.stringify(p,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(`package.json`)} dev script for Next.js >= 16`))}}for(let e of[`webpack.config.js`,`webpack.config.ts`,`webpack.config.mjs`,`webpack.config.cjs`])if(await n.exists(l,e)){x=!0,(0,o.logger)(`${o.v} Found ${(0,o.colorizePath)(e)}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`);break}if(!x){let e=(0,c.getAlias)({configuration:(0,s.getConfiguration)({baseDir:l})});if(b&&y.length>0){let t=y.find(e=>e===`tsconfig.json`)||y[0],i=r.parseJSONWithComments(await n.readFileFromRoot(l,t));i.compilerOptions??={},i.compilerOptions.paths??={};let a=!1;Object.entries(e).forEach(([e,t])=>{i.compilerOptions.paths[e]||(i.compilerOptions.paths[e]=[t],a=!0)}),a&&(await n.writeFileToRoot(l,t,JSON.stringify(i,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(t)} to include Intlayer aliases`))}else{let t=`jsconfig.json`;if(await n.exists(l,t)){let i=r.parseJSONWithComments(await n.readFileFromRoot(l,t));i.compilerOptions??={},i.compilerOptions.paths??={};let a=!1;Object.entries(e).forEach(([e,t])=>{i.compilerOptions.paths[e]||(i.compilerOptions.paths[e]=[t],a=!0)}),a&&(await n.writeFileToRoot(l,t,JSON.stringify(i,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(t)} to include Intlayer aliases`))}else{p.imports??={};let t=!1;Object.entries(e).forEach(([e,n])=>{let r=e.replace(`@`,`#`),i=n.startsWith(`.`)?n:`./${n}`;p.imports[r]||(p.imports[r]=i,t=!0)}),t&&(await n.writeFileToRoot(l,d,JSON.stringify(p,null,2)),(0,o.logger)(`${o.v} Updated ${(0,o.colorizePath)(d)} to include Intlayer imports`))}}}(0,o.logger)(`${o.v} ${(0,o.colorize)(`Intlayer init setup complete.`,o.ANSIColors.GREEN)}`),(0,o.logger)([(0,o.colorize)(`Next →`,o.ANSIColors.MAGENTA),(0,o.colorize)(`Follow the instructions in the documentation to complete the setup:`,o.ANSIColors.GREY_LIGHT),(0,o.colorizePath)(m)])};exports.initIntlayer=d;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["ANSIColors","exists","x","readFileFromRoot","writeFileToRoot","v","parseJSONWithComments","ensureDirectory","findTsConfigFiles","initConfig","updateViteConfig","updateNextConfig"],"sources":["../../../src/init/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport {\n ANSIColors,\n colorize,\n colorizePath,\n logger,\n v,\n x,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\n\nimport { getAlias } from '@intlayer/config/utils';\nimport { initConfig } from '../initConfig';\nimport {\n ensureDirectory,\n exists,\n findTsConfigFiles,\n parseJSONWithComments,\n readFileFromRoot,\n updateNextConfig,\n updateViteConfig,\n writeFileToRoot,\n} from './utils';\n\n/**\n * Documentation URL Constants\n */\nconst DocumentationRouter = {\n NextJS: 'https://intlayer.org/doc/environment/nextjs.md',\n NextJS_15: 'https://intlayer.org/doc/environment/nextjs/15.md',\n NextJS_14: 'https://intlayer.org/doc/environment/nextjs/14.md',\n CRA: 'https://intlayer.org/doc/environment/create-react-app.md',\n Astro: 'https://intlayer.org/doc/environment/astro.md',\n ViteAndReact: 'https://intlayer.org/doc/environment/vite-and-react.md',\n ViteAndReact_ReactRouterV7:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md',\n ViteAndReact_ReactRouterV7_FSRoutes:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md',\n ViteAndVue: 'https://intlayer.org/doc/environment/vite-and-vue.md',\n ViteAndSolid: 'https://intlayer.org/doc/environment/vite-and-solid.md',\n ViteAndSvelte: 'https://intlayer.org/doc/environment/vite-and-svelte.md',\n ViteAndPreact: 'https://intlayer.org/doc/environment/vite-and-preact.md',\n TanStackRouter: 'https://intlayer.org/doc/environment/tanstack.md',\n NuxtAndVue: 'https://intlayer.org/doc/environment/nuxt-and-vue.md',\n Angular: 'https://intlayer.org/doc/environment/angular.md',\n SvelteKit: 'https://intlayer.org/doc/environment/sveltekit.md',\n ReactNativeAndExpo:\n 'https://intlayer.org/doc/environment/react-native-and-expo.md',\n Lynx: 'https://intlayer.org/doc/environment/lynx-and-react.md',\n Express: 'https://intlayer.org/doc/environment/express.md',\n NestJS: 'https://intlayer.org/doc/environment/nestjs.md',\n Fastify: 'https://intlayer.org/doc/environment/fastify.md',\n Default: 'https://intlayer.org/doc/get-started',\n\n // Check for competitors libs\n NextIntl: 'https://intlayer.org/blog/intlayer-with-next-intl.md',\n ReactI18Next: 'https://intlayer.org/blog/intlayer-with-react-i18next.md',\n ReactIntl: 'https://intlayer.org/blog/intlayer-with-react-intl.md',\n NextI18Next: 'https://intlayer.org/blog/intlayer-with-next-i18next.md',\n VueI18n: 'https://intlayer.org/blog/intlayer-with-vue-i18n.md',\n};\n\n/**\n * Helper: Detects the environment and returns the doc URL\n */\nconst getDocumentationUrl = (packageJson: any): string => {\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n /**\n * Helper to check if a version string matches a specific major version\n * Matches: \"15\", \"^15.0.0\", \"~15.2\", \"15.0.0-beta\"\n */\n const isVersion = (versionString: string, major: number): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const regex = new RegExp(`^[\\\\^~]?${major}(?:\\\\.|$)`);\n return regex.test(versionString);\n };\n\n // Mobile / Cross-platform\n if (deps['@lynx-js/react'] || deps['@lynx-js/core']) {\n return DocumentationRouter.Lynx;\n }\n if (deps['react-native'] || deps.expo) {\n return DocumentationRouter.ReactNativeAndExpo;\n }\n\n // Meta-frameworks (Next, Nuxt, Astro, SvelteKit)\n if (deps.next) {\n const version = deps.next;\n\n if (isVersion(version, 14)) {\n return DocumentationRouter.NextJS_14;\n }\n\n if (isVersion(version, 15)) {\n return DocumentationRouter.NextJS_15;\n }\n\n return DocumentationRouter.NextJS;\n }\n\n if (deps.nuxt) return DocumentationRouter.NuxtAndVue;\n if (deps.astro) return DocumentationRouter.Astro;\n if (deps['@sveltejs/kit']) return DocumentationRouter.SvelteKit;\n\n // Routers (TanStack & React Router v7)\n if (deps['@tanstack/react-router']) {\n return DocumentationRouter.TanStackRouter;\n }\n\n // Check for React Router v7\n const reactRouterVersion = deps['react-router'];\n if (reactRouterVersion && typeof reactRouterVersion === 'string') {\n // Distinguish between standard v7 and v7 with FS routes\n if (deps['@react-router/fs-routes']) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7_FSRoutes;\n }\n\n // Use Regex to ensure it is v7\n if (isVersion(reactRouterVersion, 7)) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7;\n }\n }\n\n // Vite Ecosystem (General)\n if (deps.vite) {\n if (deps.vue) return DocumentationRouter.ViteAndVue;\n if (deps['solid-js']) return DocumentationRouter.ViteAndSolid;\n if (deps.svelte) return DocumentationRouter.ViteAndSvelte;\n if (deps.preact) return DocumentationRouter.ViteAndPreact;\n\n // Default to React if Vite is present but specific other frameworks aren't found\n return DocumentationRouter.ViteAndReact;\n }\n\n // Other Web Frameworks\n if (deps['react-scripts']) return DocumentationRouter.CRA;\n if (deps['@angular/core']) return DocumentationRouter.Angular;\n\n // Backend\n if (deps['@nestjs/core']) return DocumentationRouter.NestJS;\n if (deps.express) return DocumentationRouter.Express;\n if (deps.fastify) return DocumentationRouter.Fastify;\n\n // Competitor Libs (Migration Guides)\n // We check these last as specific environment setup is usually higher priority,\n // but if no specific framework logic matched (or as a fallback), we guide to migration.\n if (deps['next-intl']) return DocumentationRouter.NextIntl;\n if (deps['react-i18next'] || deps.i18next)\n return DocumentationRouter.ReactI18Next;\n if (deps['react-intl']) return DocumentationRouter.ReactIntl;\n if (deps['next-i18next']) return DocumentationRouter.NextI18Next;\n if (deps['vue-i18n']) return DocumentationRouter.VueI18n;\n\n return DocumentationRouter.Default;\n};\n\n/**\n * MAIN LOGIC\n */\nexport const initIntlayer = async (rootDir: string) => {\n logger(colorize('Checking Intlayer configuration...', ANSIColors.CYAN));\n\n // READ PACKAGE.JSON\n const packageJsonPath = 'package.json';\n if (!(await exists(rootDir, packageJsonPath))) {\n logger(\n `${x} No ${colorizePath('package.json')} found. Please run this script from the project root.`,\n { level: 'error' }\n );\n process.exit(1);\n }\n\n const packageJsonContent = await readFileFromRoot(rootDir, packageJsonPath);\n let packageJson: Record<string, any>;\n try {\n packageJson = JSON.parse(packageJsonContent);\n } catch {\n logger(`${x} Could not parse ${colorizePath('package.json')}.`, {\n level: 'error',\n });\n process.exit(1);\n }\n\n // Determine the correct documentation URL based on dependencies\n const guideUrl = getDocumentationUrl(packageJson);\n\n // CHECK .GITIGNORE\n const gitignorePath = '.gitignore';\n if (await exists(rootDir, gitignorePath)) {\n const gitignoreContent = await readFileFromRoot(rootDir, gitignorePath);\n\n if (!gitignoreContent.includes('intlayer')) {\n const newContent = `${gitignoreContent}\\n# Intlayer\\n.intlayer\\n`;\n await writeFileToRoot(rootDir, gitignorePath, newContent);\n logger(\n `${v} Added ${colorizePath('.intlayer')} to ${colorizePath(gitignorePath)}`\n );\n } else {\n logger(`${v} ${colorizePath(gitignorePath)} already includes .intlayer`);\n }\n }\n\n // CHECK VS CODE EXTENSION RECOMMENDATIONS\n const vscodeDir = '.vscode';\n const extensionsJsonPath = join(vscodeDir, 'extensions.json');\n const extensionId = 'intlayer.intlayer-vs-code-extension';\n\n try {\n let extensionsConfig: { recommendations: string[] } = {\n recommendations: [],\n };\n\n if (await exists(rootDir, extensionsJsonPath)) {\n const content = await readFileFromRoot(rootDir, extensionsJsonPath);\n extensionsConfig = parseJSONWithComments(content);\n } else {\n await ensureDirectory(rootDir, vscodeDir);\n }\n\n if (!extensionsConfig.recommendations) {\n extensionsConfig.recommendations = [];\n }\n\n if (!extensionsConfig.recommendations.includes(extensionId)) {\n extensionsConfig.recommendations.push(extensionId);\n await writeFileToRoot(\n rootDir,\n extensionsJsonPath,\n JSON.stringify(extensionsConfig, null, 2)\n );\n logger(\n `${v} Added ${colorize(extensionId, ANSIColors.MAGENTA)} to ${colorizePath(extensionsJsonPath)}`\n );\n } else {\n logger(\n `${v} ${colorizePath(extensionsJsonPath)} already includes ${colorize(extensionId, ANSIColors.MAGENTA)}`\n );\n }\n } catch {\n logger(\n `${x} Could not update ${colorizePath(extensionsJsonPath)}. You may need to add ${colorize(extensionId, ANSIColors.MAGENTA)} manually.`,\n { level: 'warn' }\n );\n }\n\n // CHECK TSCONFIGS\n const tsConfigFiles = await findTsConfigFiles(rootDir);\n let hasTsConfig = false;\n\n for (const fileName of tsConfigFiles) {\n if (await exists(rootDir, fileName)) {\n hasTsConfig = true;\n try {\n const fileContent = await readFileFromRoot(rootDir, fileName);\n const config = parseJSONWithComments(fileContent);\n const typeDefinition = '.intlayer/**/*.ts';\n\n let updated = false;\n\n if (!config.include) {\n // Skip if no include array (solution-style)\n } else if (\n Array.isArray(config.include) &&\n !(config.include as string[]).some((pattern: string) =>\n pattern.includes('.intlayer')\n )\n ) {\n config.include.push(typeDefinition);\n updated = true;\n } else if (config.include.includes(typeDefinition)) {\n logger(\n `${v} ${colorizePath(fileName)} already includes intlayer types`\n );\n }\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n fileName,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(fileName)} to include intlayer types`\n );\n }\n } catch {\n logger(\n `${x} Could not parse or update ${colorizePath(fileName)}. You may need to add ${colorizePath('.intlayer/types/**/*.ts')} manually.`,\n { level: 'warn' }\n );\n }\n }\n }\n\n // INITIALIZE CONFIG FILE\n const format = hasTsConfig ? 'intlayer.config.ts' : 'intlayer.config.mjs';\n await initConfig(format, rootDir);\n\n let hasAliasConfiguration = false;\n\n // CHECK VITE CONFIG\n const viteConfigs = ['vite.config.ts', 'vite.config.js', 'vite.config.mjs'];\n\n for (const file of viteConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('vite-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateViteConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // CHECK NEXT CONFIG\n const nextConfigs = ['next.config.js', 'next.config.mjs', 'next.config.ts'];\n let isNextJsProject = false;\n\n for (const file of nextConfigs) {\n if (await exists(rootDir, file)) {\n isNextJsProject = true;\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('next-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateNextConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // UPDATE PACKAGE.JSON DEV SCRIPT FOR NEXT.JS >= 16\n if (isNextJsProject) {\n const nextVersion =\n packageJson.dependencies?.next || packageJson.devDependencies?.next;\n\n const isVersionGreaterOrEqual = (\n versionString: string,\n major: number\n ): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const match = versionString.match(/^[^\\d]*(\\d+)/);\n\n if (!match) return false;\n const majorVersion = parseInt(match[1], 10);\n return majorVersion >= major;\n };\n\n if (nextVersion && isVersionGreaterOrEqual(nextVersion, 16)) {\n const devScript = packageJson.scripts?.dev;\n const expectedScript = \"intlayer watch --with 'bun run --bun next dev'\";\n\n if (\n devScript &&\n devScript !== expectedScript &&\n devScript.includes('next dev')\n ) {\n packageJson.scripts.dev = expectedScript;\n\n await writeFileToRoot(\n rootDir,\n packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n\n logger(\n `${v} Updated ${colorizePath('package.json')} dev script for Next.js >= 16`\n );\n }\n }\n }\n\n // CHECK WEBPACK CONFIG\n const webpackConfigs = [\n 'webpack.config.js',\n 'webpack.config.ts',\n 'webpack.config.mjs',\n 'webpack.config.cjs',\n ];\n\n for (const file of webpackConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n logger(\n `${v} Found ${colorizePath(\n file\n )}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`\n );\n break;\n }\n }\n\n if (!hasAliasConfiguration) {\n const configuration = getConfiguration({ baseDir: rootDir });\n const aliases = getAlias({ configuration });\n\n if (hasTsConfig && tsConfigFiles.length > 0) {\n const tsConfigPath =\n tsConfigFiles.find((f) => f === 'tsconfig.json') || tsConfigFiles[0];\n const tsConfigContent = await readFileFromRoot(rootDir, tsConfigPath);\n const config = parseJSONWithComments(tsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n tsConfigPath,\n JSON.stringify(config, null, 2)\n );\n\n logger(\n `${v} Updated ${colorizePath(\n tsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n const jsConfigPath = 'jsconfig.json';\n\n if (await exists(rootDir, jsConfigPath)) {\n const jsConfigContent = await readFileFromRoot(rootDir, jsConfigPath);\n const config = parseJSONWithComments(jsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n jsConfigPath,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n jsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n packageJson.imports ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n const importAlias = alias.replace('@', '#');\n const importPath = path.startsWith('.') ? path : `./${path}`;\n\n if (!packageJson.imports[importAlias]) {\n packageJson.imports[importAlias] = importPath;\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n packageJsonPath\n )} to include Intlayer imports`\n );\n }\n }\n }\n }\n\n // FINAL SUCCESS MESSAGE\n logger(`${v} ${colorize('Intlayer init setup complete.', ANSIColors.GREEN)}`);\n logger([\n colorize('Next →', ANSIColors.MAGENTA),\n colorize(\n `Follow the instructions in the documentation to complete the setup:`,\n ANSIColors.GREY_LIGHT\n ),\n colorizePath(guideUrl),\n ]);\n};\n"],"mappings":"wbA2BA,MAAM,EAAsB,CAC1B,OAAQ,iDACR,UAAW,oDACX,UAAW,oDACX,IAAK,2DACL,MAAO,gDACP,aAAc,yDACd,2BACE,yEACF,oCACE,mFACF,WAAY,uDACZ,aAAc,yDACd,cAAe,0DACf,cAAe,0DACf,eAAgB,mDAChB,WAAY,uDACZ,QAAS,kDACT,UAAW,oDACX,mBACE,gEACF,KAAM,yDACN,QAAS,kDACT,OAAQ,iDACR,QAAS,kDACT,QAAS,uCAGT,SAAU,uDACV,aAAc,2DACd,UAAW,wDACX,YAAa,0DACb,QAAS,sDACV,CAKK,E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AA,WAAW,MAAM,GAAG,EAC7E,EAAA,EAAA,QAAO,gBACI,SAAUA,EAAAA,WAAW,QAAQ,gBAEpC,sEACAA,EAAAA,WAAW,WACZ,oBACY,EAAS,CACvB,CAAC"}
1
+ {"version":3,"file":"index.cjs","names":["ANSIColors","exists","x","readFileFromRoot","writeFileToRoot","v","parseJSONWithComments","ensureDirectory","findTsConfigFiles","initConfig","updateViteConfig","updateNextConfig"],"sources":["../../../src/init/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport {\n ANSIColors,\n colorize,\n colorizePath,\n logger,\n v,\n x,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\n\nimport { getAlias } from '@intlayer/config/utils';\nimport { initConfig } from '../initConfig';\nimport {\n ensureDirectory,\n exists,\n findTsConfigFiles,\n parseJSONWithComments,\n readFileFromRoot,\n updateNextConfig,\n updateViteConfig,\n writeFileToRoot,\n} from './utils';\n\n/**\n * Documentation URL Constants\n */\nconst DocumentationRouter = {\n NextJS: 'https://intlayer.org/doc/environment/nextjs.md',\n NextJS_15: 'https://intlayer.org/doc/environment/nextjs/15.md',\n NextJS_14: 'https://intlayer.org/doc/environment/nextjs/14.md',\n CRA: 'https://intlayer.org/doc/environment/create-react-app.md',\n Astro: 'https://intlayer.org/doc/environment/astro.md',\n ViteAndReact: 'https://intlayer.org/doc/environment/vite-and-react.md',\n ViteAndReact_ReactRouterV7:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md',\n ViteAndReact_ReactRouterV7_FSRoutes:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md',\n ViteAndVue: 'https://intlayer.org/doc/environment/vite-and-vue.md',\n ViteAndSolid: 'https://intlayer.org/doc/environment/vite-and-solid.md',\n ViteAndSvelte: 'https://intlayer.org/doc/environment/vite-and-svelte.md',\n ViteAndPreact: 'https://intlayer.org/doc/environment/vite-and-preact.md',\n TanStackRouter: 'https://intlayer.org/doc/environment/tanstack.md',\n NuxtAndVue: 'https://intlayer.org/doc/environment/nuxt-and-vue.md',\n Angular: 'https://intlayer.org/doc/environment/angular.md',\n SvelteKit: 'https://intlayer.org/doc/environment/sveltekit.md',\n ReactNativeAndExpo:\n 'https://intlayer.org/doc/environment/react-native-and-expo.md',\n Lynx: 'https://intlayer.org/doc/environment/lynx-and-react.md',\n Express: 'https://intlayer.org/doc/environment/express.md',\n NestJS: 'https://intlayer.org/doc/environment/nestjs.md',\n Fastify: 'https://intlayer.org/doc/environment/fastify.md',\n Default: 'https://intlayer.org/doc/get-started',\n\n // Check for competitors libs\n NextIntl: 'https://intlayer.org/blog/intlayer-with-next-intl.md',\n ReactI18Next: 'https://intlayer.org/blog/intlayer-with-react-i18next.md',\n ReactIntl: 'https://intlayer.org/blog/intlayer-with-react-intl.md',\n NextI18Next: 'https://intlayer.org/blog/intlayer-with-next-i18next.md',\n VueI18n: 'https://intlayer.org/blog/intlayer-with-vue-i18n.md',\n};\n\n/**\n * Helper: Detects the environment and returns the doc URL\n */\nconst getDocumentationUrl = (packageJson: any): string => {\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n /**\n * Helper to check if a version string matches a specific major version\n * Matches: \"15\", \"^15.0.0\", \"~15.2\", \"15.0.0-beta\"\n */\n const isVersion = (versionString: string, major: number): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const regex = new RegExp(`^[\\\\^~]?${major}(?:\\\\.|$)`);\n return regex.test(versionString);\n };\n\n // Mobile / Cross-platform\n if (deps['@lynx-js/react'] || deps['@lynx-js/core']) {\n return DocumentationRouter.Lynx;\n }\n if (deps['react-native'] || deps.expo) {\n return DocumentationRouter.ReactNativeAndExpo;\n }\n\n // Meta-frameworks (Next, Nuxt, Astro, SvelteKit)\n if (deps.next) {\n const version = deps.next;\n\n if (isVersion(version, 14)) {\n return DocumentationRouter.NextJS_14;\n }\n\n if (isVersion(version, 15)) {\n return DocumentationRouter.NextJS_15;\n }\n\n return DocumentationRouter.NextJS;\n }\n\n if (deps.nuxt) return DocumentationRouter.NuxtAndVue;\n if (deps.astro) return DocumentationRouter.Astro;\n if (deps['@sveltejs/kit']) return DocumentationRouter.SvelteKit;\n\n // Routers (TanStack & React Router v7)\n if (deps['@tanstack/react-router']) {\n return DocumentationRouter.TanStackRouter;\n }\n\n // Check for React Router v7\n const reactRouterVersion = deps['react-router'];\n if (reactRouterVersion && typeof reactRouterVersion === 'string') {\n // Distinguish between standard v7 and v7 with FS routes\n if (deps['@react-router/fs-routes']) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7_FSRoutes;\n }\n\n // Use Regex to ensure it is v7\n if (isVersion(reactRouterVersion, 7)) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7;\n }\n }\n\n // Vite Ecosystem (General)\n if (deps.vite) {\n if (deps.vue) return DocumentationRouter.ViteAndVue;\n if (deps['solid-js']) return DocumentationRouter.ViteAndSolid;\n if (deps.svelte) return DocumentationRouter.ViteAndSvelte;\n if (deps.preact) return DocumentationRouter.ViteAndPreact;\n\n // Default to React if Vite is present but specific other frameworks aren't found\n return DocumentationRouter.ViteAndReact;\n }\n\n // Other Web Frameworks\n if (deps['react-scripts']) return DocumentationRouter.CRA;\n if (deps['@angular/core']) return DocumentationRouter.Angular;\n\n // Backend\n if (deps['@nestjs/core']) return DocumentationRouter.NestJS;\n if (deps.express) return DocumentationRouter.Express;\n if (deps.fastify) return DocumentationRouter.Fastify;\n\n // Competitor Libs (Migration Guides)\n // We check these last as specific environment setup is usually higher priority,\n // but if no specific framework logic matched (or as a fallback), we guide to migration.\n if (deps['next-intl']) return DocumentationRouter.NextIntl;\n if (deps['react-i18next'] || deps.i18next)\n return DocumentationRouter.ReactI18Next;\n if (deps['react-intl']) return DocumentationRouter.ReactIntl;\n if (deps['next-i18next']) return DocumentationRouter.NextI18Next;\n if (deps['vue-i18n']) return DocumentationRouter.VueI18n;\n\n return DocumentationRouter.Default;\n};\n\n/**\n * MAIN LOGIC\n */\nexport const initIntlayer = async (rootDir: string) => {\n logger(colorize('Checking Intlayer configuration...', ANSIColors.CYAN));\n\n // READ PACKAGE.JSON\n const packageJsonPath = 'package.json';\n if (!(await exists(rootDir, packageJsonPath))) {\n logger(\n `${x} No ${colorizePath('package.json')} found. Please run this script from the project root.`,\n { level: 'error' }\n );\n process.exit(1);\n }\n\n const packageJsonContent = await readFileFromRoot(rootDir, packageJsonPath);\n let packageJson: Record<string, any>;\n try {\n packageJson = JSON.parse(packageJsonContent);\n } catch {\n logger(`${x} Could not parse ${colorizePath('package.json')}.`, {\n level: 'error',\n });\n process.exit(1);\n }\n\n // Determine the correct documentation URL based on dependencies\n const guideUrl = getDocumentationUrl(packageJson);\n\n // CHECK .GITIGNORE\n const gitignorePath = '.gitignore';\n if (await exists(rootDir, gitignorePath)) {\n const gitignoreContent = await readFileFromRoot(rootDir, gitignorePath);\n\n if (!gitignoreContent.includes('intlayer')) {\n const newContent = `${gitignoreContent}\\n# Intlayer\\n.intlayer\\n`;\n await writeFileToRoot(rootDir, gitignorePath, newContent);\n logger(\n `${v} Added ${colorizePath('.intlayer')} to ${colorizePath(gitignorePath)}`\n );\n } else {\n logger(`${v} ${colorizePath(gitignorePath)} already includes .intlayer`);\n }\n }\n\n // CHECK VS CODE EXTENSION RECOMMENDATIONS\n const vscodeDir = '.vscode';\n const extensionsJsonPath = join(vscodeDir, 'extensions.json');\n const extensionId = 'intlayer.intlayer-vs-code-extension';\n\n try {\n let extensionsConfig: { recommendations: string[] } = {\n recommendations: [],\n };\n\n if (await exists(rootDir, extensionsJsonPath)) {\n const content = await readFileFromRoot(rootDir, extensionsJsonPath);\n extensionsConfig = parseJSONWithComments(content);\n } else {\n await ensureDirectory(rootDir, vscodeDir);\n }\n\n if (!extensionsConfig.recommendations) {\n extensionsConfig.recommendations = [];\n }\n\n if (!extensionsConfig.recommendations.includes(extensionId)) {\n extensionsConfig.recommendations.push(extensionId);\n await writeFileToRoot(\n rootDir,\n extensionsJsonPath,\n JSON.stringify(extensionsConfig, null, 2)\n );\n logger(\n `${v} Added ${colorize(extensionId, ANSIColors.MAGENTA)} to ${colorizePath(extensionsJsonPath)}`\n );\n } else {\n logger(\n `${v} ${colorizePath(extensionsJsonPath)} already includes ${colorize(extensionId, ANSIColors.MAGENTA)}`\n );\n }\n } catch {\n logger(\n `${x} Could not update ${colorizePath(extensionsJsonPath)}. You may need to add ${colorize(extensionId, ANSIColors.MAGENTA)} manually.`,\n { level: 'warn' }\n );\n }\n\n // CHECK TSCONFIGS\n const tsConfigFiles = await findTsConfigFiles(rootDir);\n let hasTsConfig = false;\n\n for (const fileName of tsConfigFiles) {\n if (await exists(rootDir, fileName)) {\n hasTsConfig = true;\n try {\n const fileContent = await readFileFromRoot(rootDir, fileName);\n const config = parseJSONWithComments(fileContent);\n const typeDefinition = '.intlayer/**/*.ts';\n\n let updated = false;\n\n if (!config.include) {\n // Skip if no include array (solution-style)\n } else if (\n Array.isArray(config.include) &&\n !(config.include as string[]).some((pattern: string) =>\n pattern.includes('.intlayer')\n )\n ) {\n config.include.push(typeDefinition);\n updated = true;\n } else if (config.include.includes(typeDefinition)) {\n logger(\n `${v} ${colorizePath(fileName)} already includes intlayer types`\n );\n }\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n fileName,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(fileName)} to include intlayer types`\n );\n }\n } catch {\n logger(\n `${x} Could not parse or update ${colorizePath(fileName)}. You may need to add ${colorizePath('.intlayer/types/**/*.ts')} manually.`,\n { level: 'warn' }\n );\n }\n }\n }\n\n // INITIALIZE CONFIG FILE\n const format = hasTsConfig ? 'intlayer.config.ts' : 'intlayer.config.mjs';\n await initConfig(format, rootDir);\n\n let hasAliasConfiguration = false;\n\n // CHECK VITE CONFIG\n const viteConfigs = ['vite.config.ts', 'vite.config.js', 'vite.config.mjs'];\n\n for (const file of viteConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('vite-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateViteConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // CHECK NEXT CONFIG\n const nextConfigs = ['next.config.js', 'next.config.mjs', 'next.config.ts'];\n let isNextJsProject = false;\n\n for (const file of nextConfigs) {\n if (await exists(rootDir, file)) {\n isNextJsProject = true;\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('next-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateNextConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // UPDATE PACKAGE.JSON DEV SCRIPT FOR NEXT.JS >= 16\n if (isNextJsProject) {\n const nextVersion =\n packageJson.dependencies?.next || packageJson.devDependencies?.next;\n\n const isVersionGreaterOrEqual = (\n versionString: string,\n major: number\n ): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const match = versionString.match(/^[^\\d]*(\\d+)/);\n\n if (!match) return false;\n const majorVersion = parseInt(match[1], 10);\n return majorVersion >= major;\n };\n\n if (nextVersion && isVersionGreaterOrEqual(nextVersion, 16)) {\n const devScript = packageJson.scripts?.dev;\n const expectedScript = \"intlayer watch --with 'bun run --bun next dev'\";\n\n if (\n devScript &&\n devScript !== expectedScript &&\n devScript.includes('next dev')\n ) {\n packageJson.scripts.dev = expectedScript;\n\n await writeFileToRoot(\n rootDir,\n packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n\n logger(\n `${v} Updated ${colorizePath('package.json')} dev script for Next.js >= 16`\n );\n }\n }\n }\n\n // CHECK WEBPACK CONFIG\n const webpackConfigs = [\n 'webpack.config.js',\n 'webpack.config.ts',\n 'webpack.config.mjs',\n 'webpack.config.cjs',\n ];\n\n for (const file of webpackConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n logger(\n `${v} Found ${colorizePath(\n file\n )}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`\n );\n break;\n }\n }\n\n if (!hasAliasConfiguration) {\n const configuration = getConfiguration({ baseDir: rootDir });\n const aliases = getAlias({ configuration });\n\n if (hasTsConfig && tsConfigFiles.length > 0) {\n const tsConfigPath =\n tsConfigFiles.find((f) => f === 'tsconfig.json') || tsConfigFiles[0];\n const tsConfigContent = await readFileFromRoot(rootDir, tsConfigPath);\n const config = parseJSONWithComments(tsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n tsConfigPath,\n JSON.stringify(config, null, 2)\n );\n\n logger(\n `${v} Updated ${colorizePath(\n tsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n const jsConfigPath = 'jsconfig.json';\n\n if (await exists(rootDir, jsConfigPath)) {\n const jsConfigContent = await readFileFromRoot(rootDir, jsConfigPath);\n const config = parseJSONWithComments(jsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n jsConfigPath,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n jsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n packageJson.imports ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n const importAlias = alias.replace('@', '#');\n const importPath = path.startsWith('.') ? path : `./${path}`;\n\n if (!packageJson.imports[importAlias]) {\n packageJson.imports[importAlias] = importPath;\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n packageJsonPath\n )} to include Intlayer imports`\n );\n }\n }\n }\n }\n\n // FINAL SUCCESS MESSAGE\n logger(`${v} ${colorize('Intlayer init setup complete.', ANSIColors.GREEN)}`);\n logger([\n colorize('Next →', ANSIColors.MAGENTA),\n colorize(\n `Follow the instructions in the documentation to complete the setup:`,\n ANSIColors.GREY_LIGHT\n ),\n colorizePath(guideUrl),\n ]);\n};\n"],"mappings":"4aA2BA,MAAM,EAAsB,CAC1B,OAAQ,iDACR,UAAW,oDACX,UAAW,oDACX,IAAK,2DACL,MAAO,gDACP,aAAc,yDACd,2BACE,yEACF,oCACE,mFACF,WAAY,uDACZ,aAAc,yDACd,cAAe,0DACf,cAAe,0DACf,eAAgB,mDAChB,WAAY,uDACZ,QAAS,kDACT,UAAW,oDACX,mBACE,gEACF,KAAM,yDACN,QAAS,kDACT,OAAQ,iDACR,QAAS,kDACT,QAAS,uCAGT,SAAU,uDACV,aAAc,2DACd,UAAW,wDACX,YAAa,0DACb,QAAS,sDACV,CAKK,EAAuB,GAA6B,CACxD,IAAM,EAAO,CACX,GAAG,EAAY,aACf,GAAG,EAAY,gBAChB,CAMK,GAAa,EAAuB,IACpC,CAAC,GAAiB,OAAO,GAAkB,SAAiB,GAC9C,OAAO,WAAW,EAAM,WAAW,CACxC,KAAK,EAAc,CAIlC,GAAI,EAAK,mBAAqB,EAAK,iBACjC,OAAO,EAAoB,KAE7B,GAAI,EAAK,iBAAmB,EAAK,KAC/B,OAAO,EAAoB,mBAI7B,GAAI,EAAK,KAAM,CACb,IAAM,EAAU,EAAK,KAUrB,OARI,EAAU,EAAS,GAAG,CACjB,EAAoB,UAGzB,EAAU,EAAS,GAAG,CACjB,EAAoB,UAGtB,EAAoB,OAG7B,GAAI,EAAK,KAAM,OAAO,EAAoB,WAC1C,GAAI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AO,gBAAgB,MAAM,KAChC,EAAO,gBAAgB,MAAM,GAAS,CAAC,EAAK,CAC5C,EAAU,KAEZ,CAEE,IACF,MAAMC,EAAAA,gBACJ,EACA,EACA,KAAK,UAAU,EAAQ,KAAM,EAAE,CAChC,EACD,EAAA,EAAA,QACE,GAAGC,EAAAA,EAAE,YAAA,EAAA,EAAA,cACH,EACD,CAAC,8BACH,MAEE,CACL,EAAY,UAAY,EAAE,CAE1B,IAAI,EAAU,GAEd,OAAO,QAAQ,EAAQ,CAAC,SAAS,CAAC,EAAO,KAAU,CACjD,IAAM,EAAc,EAAM,QAAQ,IAAK,IAAI,CACrC,EAAa,EAAK,WAAW,IAAI,CAAG,EAAO,KAAK,IAEjD,EAAY,QAAQ,KACvB,EAAY,QAAQ,GAAe,EACnC,EAAU,KAEZ,CAEE,IACF,MAAMD,EAAAA,gBACJ,EACA,EACA,KAAK,UAAU,EAAa,KAAM,EAAE,CACrC,EACD,EAAA,EAAA,QACE,GAAGC,EAAAA,EAAE,YAAA,EAAA,EAAA,cACH,EACD,CAAC,8BACH,KAOT,EAAA,EAAA,QAAO,GAAGA,EAAAA,EAAE,IAAA,EAAA,EAAA,UAAY,gCAAiCL,EAAAA,WAAW,MAAM,GAAG,EAC7E,EAAA,EAAA,QAAO,gBACI,SAAUA,EAAAA,WAAW,QAAQ,gBAEpC,sEACAA,EAAAA,WAAW,WACZ,oBACY,EAAS,CACvB,CAAC"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../_virtual/_rolldown/runtime.cjs`);let t=require(`recast`);t=e.__toESM(t);const n=t.types.builders,r=t.types.namedTypes,i=(e,n)=>{let i=!1;return t.visit(e,{visitImportDeclaration(e){return e.node.source.value===n&&(i=!0),!1},visitCallExpression(e){let{callee:t,arguments:a}=e.node;return r.Identifier.check(t)&&t.name===`require`&&a[0]&&r.StringLiteral.check(a[0])&&a[0].value===n&&(i=!0),!1}}),i},a=(e,t,r,a)=>{if(i(e,a))return;let o=t?n.variableDeclaration(`const`,[n.variableDeclarator(n.objectPattern([n.objectProperty.from({key:n.identifier(r),value:n.identifier(r),shorthand:!0})]),n.callExpression(n.identifier(`require`),[n.stringLiteral(a)]))]):n.importDeclaration([n.importSpecifier(n.identifier(r))],n.stringLiteral(a));e.program.body.unshift(o)},o=(e,i)=>{let o=t.parse(e,{parser:require(`recast/parsers/typescript`)});a(o,i===`cjs`||e.includes(`module.exports`)&&!e.includes(`import `),`intlayer`,`vite-intlayer`);let s=e=>{if(!e||e.type!==`ObjectExpression`&&!r.ObjectExpression.check(e))return;let t=e.properties.find(e=>!e||!e.key?!1:(e.key.name||e.key.value)===`plugins`);t||(t=n.property(`init`,n.identifier(`plugins`),n.arrayExpression([])),e.properties.push(t));let i=t.value;i&&(i.type===`ArrayExpression`||r.ArrayExpression.check(i))&&(i.elements.some(e=>{let t=e?.callee;if(!t)return!1;let n=t.name||t.id?.name;return n===`intlayer`||n===`il`})||i.elements.push(n.callExpression(n.identifier(`intlayer`),[])))};return t.visit(o,{visitExportDefaultDeclaration(e){let t=e.node.declaration;if(r.ObjectExpression.check(t))s(t);else if(r.CallExpression.check(t)&&r.Identifier.check(t.callee)&&t.callee.name===`defineConfig`)r.ObjectExpression.check(t.arguments[0])&&s(t.arguments[0]);else if(r.Identifier.check(t)){let e=t.name;o.program.body.forEach(t=>{r.VariableDeclaration.check(t)&&t.declarations.forEach(t=>{r.VariableDeclarator.check(t)&&r.Identifier.check(t.id)&&t.id.name===e&&r.ObjectExpression.check(t.init)&&s(t.init)})})}return!1},visitAssignmentExpression(e){let{left:n,right:i}=e.node;return r.MemberExpression.check(n)&&t.print(n).code===`module.exports`&&(r.ObjectExpression.check(i)?s(i):r.CallExpression.check(i)&&r.Identifier.check(i.callee)&&i.callee.name===`defineConfig`&&r.ObjectExpression.check(i.arguments[0])&&s(i.arguments[0])),!1}}),t.print(o).code},s=(e,i)=>{let o=t.parse(e,{parser:require(`recast/parsers/typescript`)});return a(o,i===`cjs`||e.includes(`module.exports`),`withIntlayer`,`next-intlayer/server`),t.visit(o,{visitExportDefaultDeclaration(e){let t=e.node.declaration;return r.Expression.check(t)&&!(r.CallExpression.check(t)&&r.Identifier.check(t.callee)&&t.callee.name===`withIntlayer`)&&e.get(`declaration`).replace(n.callExpression(n.identifier(`withIntlayer`),[t])),!1},visitAssignmentExpression(e){let{left:i,right:a}=e.node;return r.MemberExpression.check(i)&&t.print(i).code===`module.exports`&&!(r.CallExpression.check(a)&&r.Identifier.check(a.callee)&&a.callee.name===`withIntlayer`)&&e.get(`right`).replace(n.callExpression(n.identifier(`withIntlayer`),[a])),!1}}),t.print(o).code};exports.updateNextConfig=s,exports.updateViteConfig=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../chunk-Bmb41Sf3.cjs`);let t=require(`recast`);t=e.t(t);const n=t.types.builders,r=t.types.namedTypes,i=(e,n)=>{let i=!1;return t.visit(e,{visitImportDeclaration(e){return e.node.source.value===n&&(i=!0),!1},visitCallExpression(e){let{callee:t,arguments:a}=e.node;return r.Identifier.check(t)&&t.name===`require`&&a[0]&&r.StringLiteral.check(a[0])&&a[0].value===n&&(i=!0),!1}}),i},a=(e,t,r,a)=>{if(i(e,a))return;let o=t?n.variableDeclaration(`const`,[n.variableDeclarator(n.objectPattern([n.objectProperty.from({key:n.identifier(r),value:n.identifier(r),shorthand:!0})]),n.callExpression(n.identifier(`require`),[n.stringLiteral(a)]))]):n.importDeclaration([n.importSpecifier(n.identifier(r))],n.stringLiteral(a));e.program.body.unshift(o)},o=(e,i)=>{let o=t.parse(e,{parser:require(`recast/parsers/typescript`)});a(o,i===`cjs`||e.includes(`module.exports`)&&!e.includes(`import `),`intlayer`,`vite-intlayer`);let s=e=>{if(!e||e.type!==`ObjectExpression`&&!r.ObjectExpression.check(e))return;let t=e.properties.find(e=>!e||!e.key?!1:(e.key.name||e.key.value)===`plugins`);t||(t=n.property(`init`,n.identifier(`plugins`),n.arrayExpression([])),e.properties.push(t));let i=t.value;i&&(i.type===`ArrayExpression`||r.ArrayExpression.check(i))&&(i.elements.some(e=>{let t=e?.callee;if(!t)return!1;let n=t.name||t.id?.name;return n===`intlayer`||n===`il`})||i.elements.push(n.callExpression(n.identifier(`intlayer`),[])))};return t.visit(o,{visitExportDefaultDeclaration(e){let t=e.node.declaration;if(r.ObjectExpression.check(t))s(t);else if(r.CallExpression.check(t)&&r.Identifier.check(t.callee)&&t.callee.name===`defineConfig`)r.ObjectExpression.check(t.arguments[0])&&s(t.arguments[0]);else if(r.Identifier.check(t)){let e=t.name;o.program.body.forEach(t=>{r.VariableDeclaration.check(t)&&t.declarations.forEach(t=>{r.VariableDeclarator.check(t)&&r.Identifier.check(t.id)&&t.id.name===e&&r.ObjectExpression.check(t.init)&&s(t.init)})})}return!1},visitAssignmentExpression(e){let{left:n,right:i}=e.node;return r.MemberExpression.check(n)&&t.print(n).code===`module.exports`&&(r.ObjectExpression.check(i)?s(i):r.CallExpression.check(i)&&r.Identifier.check(i.callee)&&i.callee.name===`defineConfig`&&r.ObjectExpression.check(i.arguments[0])&&s(i.arguments[0])),!1}}),t.print(o).code},s=(e,i)=>{let o=t.parse(e,{parser:require(`recast/parsers/typescript`)});return a(o,i===`cjs`||e.includes(`module.exports`),`withIntlayer`,`next-intlayer/server`),t.visit(o,{visitExportDefaultDeclaration(e){let t=e.node.declaration;return r.Expression.check(t)&&!(r.CallExpression.check(t)&&r.Identifier.check(t.callee)&&t.callee.name===`withIntlayer`)&&e.get(`declaration`).replace(n.callExpression(n.identifier(`withIntlayer`),[t])),!1},visitAssignmentExpression(e){let{left:i,right:a}=e.node;return r.MemberExpression.check(i)&&t.print(i).code===`module.exports`&&!(r.CallExpression.check(a)&&r.Identifier.check(a.callee)&&a.callee.name===`withIntlayer`)&&e.get(`right`).replace(n.callExpression(n.identifier(`withIntlayer`),[a])),!1}}),t.print(o).code};exports.updateNextConfig=s,exports.updateViteConfig=o;
2
2
  //# sourceMappingURL=configManipulation.cjs.map