@intlayer/engine 9.5.9-canary.0 → 9.5.10

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 (248) hide show
  1. package/dist/cjs/_virtual/_utils_asset.cjs +1 -1
  2. package/dist/cjs/build.cjs +4 -4
  3. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +2 -2
  4. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +3 -3
  5. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +1 -1
  6. package/dist/cjs/buildIntlayerDictionary/writeNestedDictionary.cjs +3 -3
  7. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +2 -2
  8. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +2 -2
  9. package/dist/cjs/cleanOutputDir.cjs +1 -1
  10. package/dist/cjs/cleanRemovedContentDeclaration.cjs +1 -1
  11. package/dist/cjs/cli.cjs +10 -3
  12. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +1 -1
  13. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +2 -2
  14. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +2 -2
  15. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +2 -2
  16. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +2 -2
  17. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +2 -2
  18. package/dist/cjs/createType/createModuleAugmentation.cjs +3 -3
  19. package/dist/cjs/createType/createType.cjs +1 -1
  20. package/dist/cjs/docReview/index.cjs +5 -5
  21. package/dist/cjs/docReview/pipeline.cjs +4 -4
  22. package/dist/cjs/docReview/reviewReport.cjs.map +1 -1
  23. package/dist/cjs/fetchDistantDictionaries.cjs +1 -1
  24. package/dist/cjs/handleContentDeclarationFileChange.cjs +2 -2
  25. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +1 -1
  26. package/dist/cjs/init/cms.cjs +35 -0
  27. package/dist/cjs/init/cms.cjs.map +1 -1
  28. package/dist/cjs/init/documentationRouter.cjs +141 -0
  29. package/dist/cjs/init/documentationRouter.cjs.map +1 -0
  30. package/dist/cjs/init/frameworkSetup/backend/index.cjs +138 -0
  31. package/dist/cjs/init/frameworkSetup/backend/index.cjs.map +1 -0
  32. package/dist/cjs/init/frameworkSetup/backend/transforms.cjs +223 -0
  33. package/dist/cjs/init/frameworkSetup/backend/transforms.cjs.map +1 -0
  34. package/dist/cjs/init/frameworkSetup/index.cjs +9 -3
  35. package/dist/cjs/init/frameworkSetup/index.cjs.map +1 -1
  36. package/dist/cjs/init/frameworkSetup/localeRouting.cjs +13 -0
  37. package/dist/cjs/init/frameworkSetup/localeRouting.cjs.map +1 -0
  38. package/dist/cjs/init/frameworkSetup/nextAppRouter/index.cjs +34 -7
  39. package/dist/cjs/init/frameworkSetup/nextAppRouter/index.cjs.map +1 -1
  40. package/dist/cjs/init/frameworkSetup/nextAppRouter/restructure.cjs +1 -1
  41. package/dist/cjs/init/frameworkSetup/nextAppRouter/templates.cjs +56 -0
  42. package/dist/cjs/init/frameworkSetup/nextAppRouter/templates.cjs.map +1 -1
  43. package/dist/cjs/init/frameworkSetup/nextAppRouter/transforms.cjs +2 -2
  44. package/dist/cjs/init/frameworkSetup/nextAppRouter/transforms.cjs.map +1 -1
  45. package/dist/cjs/init/frameworkSetup/tanstackStart/index.cjs +32 -3
  46. package/dist/cjs/init/frameworkSetup/tanstackStart/index.cjs.map +1 -1
  47. package/dist/cjs/init/frameworkSetup/tanstackStart/restructure.cjs +1 -1
  48. package/dist/cjs/init/frameworkSetup/tanstackStart/templates.cjs +58 -0
  49. package/dist/cjs/init/frameworkSetup/tanstackStart/templates.cjs.map +1 -1
  50. package/dist/cjs/init/frameworkSetup/tanstackStart/transforms.cjs +94 -14
  51. package/dist/cjs/init/frameworkSetup/tanstackStart/transforms.cjs.map +1 -1
  52. package/dist/cjs/init/index.cjs +46 -159
  53. package/dist/cjs/init/index.cjs.map +1 -1
  54. package/dist/cjs/init/utils/configManipulation.cjs +39 -0
  55. package/dist/cjs/init/utils/configManipulation.cjs.map +1 -1
  56. package/dist/cjs/init/utils/fileSystem.cjs +1 -1
  57. package/dist/cjs/init/utils/githubActions.cjs +1 -1
  58. package/dist/cjs/init/utils/index.cjs +10 -0
  59. package/dist/cjs/init/utils/intlayerDependencies.cjs +1 -1
  60. package/dist/cjs/init/utils/lintConfig.cjs +52 -0
  61. package/dist/cjs/init/utils/lintConfig.cjs.map +1 -0
  62. package/dist/cjs/init/utils/packageManager.cjs +63 -14
  63. package/dist/cjs/init/utils/packageManager.cjs.map +1 -1
  64. package/dist/cjs/init/utils/urlRoutingFramework.cjs +41 -0
  65. package/dist/cjs/init/utils/urlRoutingFramework.cjs.map +1 -0
  66. package/dist/cjs/initConfig/index.cjs +5 -2
  67. package/dist/cjs/initConfig/index.cjs.map +1 -1
  68. package/dist/cjs/installLSP.cjs +1 -1
  69. package/dist/cjs/installMCP/installMCP.cjs +1 -1
  70. package/dist/cjs/installSkills/index.cjs +1 -1
  71. package/dist/cjs/listDictionariesPath.cjs +1 -1
  72. package/dist/cjs/listGitFiles.cjs +1 -1
  73. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +2 -2
  74. package/dist/cjs/loadDictionaries/index.cjs +1 -1
  75. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +2 -2
  76. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +1 -1
  77. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +1 -1
  78. package/dist/cjs/loadDictionaries/loadMarkdownContentDeclaration.cjs +1 -1
  79. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs +104 -43
  80. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs.map +1 -1
  81. package/dist/cjs/logConfigDetails.cjs +1 -1
  82. package/dist/cjs/prepareIntlayer.cjs +4 -4
  83. package/dist/cjs/scan/index.cjs +1 -1
  84. package/dist/cjs/scan/scanWebsite.cjs +1 -1
  85. package/dist/cjs/syncPluginKit/createFileAdapter.cjs +1 -1
  86. package/dist/cjs/syncPluginKit/index.cjs +1 -1
  87. package/dist/cjs/utils/buildComponentFilesList.cjs +1 -1
  88. package/dist/cjs/utils/contentWatcherLock.cjs +2 -2
  89. package/dist/cjs/utils/index.cjs +4 -4
  90. package/dist/cjs/utils/readDictionariesFromDisk.cjs +1 -1
  91. package/dist/cjs/utils/runOnce.cjs +1 -1
  92. package/dist/cjs/utils/runParallel/pidTree.cjs +1 -1
  93. package/dist/cjs/utils/withFileLock.cjs +1 -1
  94. package/dist/cjs/watcher.cjs +6 -6
  95. package/dist/cjs/writeConfiguration/index.cjs +1 -1
  96. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +2 -2
  97. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +1 -1
  98. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +4 -4
  99. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +3 -3
  100. package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs +1 -1
  101. package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs +1 -1
  102. package/dist/cjs/writeFileIfChanged.cjs +1 -1
  103. package/dist/esm/_virtual/_utils_asset.mjs +1 -1
  104. package/dist/esm/build.mjs +4 -4
  105. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +2 -2
  106. package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs +3 -3
  107. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +1 -1
  108. package/dist/esm/buildIntlayerDictionary/writeNestedDictionary.mjs +3 -3
  109. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +2 -2
  110. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +2 -2
  111. package/dist/esm/cleanOutputDir.mjs +1 -1
  112. package/dist/esm/cleanRemovedContentDeclaration.mjs +1 -1
  113. package/dist/esm/cli.mjs +8 -6
  114. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +1 -1
  115. package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs +2 -2
  116. package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs +2 -2
  117. package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs +2 -2
  118. package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs +2 -2
  119. package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs +2 -2
  120. package/dist/esm/createType/createModuleAugmentation.mjs +3 -3
  121. package/dist/esm/createType/createType.mjs +1 -1
  122. package/dist/esm/docReview/index.mjs +5 -5
  123. package/dist/esm/docReview/pipeline.mjs +4 -4
  124. package/dist/esm/docReview/reviewReport.mjs.map +1 -1
  125. package/dist/esm/fetchDistantDictionaries.mjs +1 -1
  126. package/dist/esm/handleContentDeclarationFileChange.mjs +2 -2
  127. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +1 -1
  128. package/dist/esm/init/cms.mjs +35 -2
  129. package/dist/esm/init/cms.mjs.map +1 -1
  130. package/dist/esm/init/documentationRouter.mjs +139 -0
  131. package/dist/esm/init/documentationRouter.mjs.map +1 -0
  132. package/dist/esm/init/frameworkSetup/backend/index.mjs +130 -0
  133. package/dist/esm/init/frameworkSetup/backend/index.mjs.map +1 -0
  134. package/dist/esm/init/frameworkSetup/backend/transforms.mjs +216 -0
  135. package/dist/esm/init/frameworkSetup/backend/transforms.mjs.map +1 -0
  136. package/dist/esm/init/frameworkSetup/index.mjs +9 -3
  137. package/dist/esm/init/frameworkSetup/index.mjs.map +1 -1
  138. package/dist/esm/init/frameworkSetup/localeRouting.mjs +12 -0
  139. package/dist/esm/init/frameworkSetup/localeRouting.mjs.map +1 -0
  140. package/dist/esm/init/frameworkSetup/nextAppRouter/index.mjs +36 -9
  141. package/dist/esm/init/frameworkSetup/nextAppRouter/index.mjs.map +1 -1
  142. package/dist/esm/init/frameworkSetup/nextAppRouter/restructure.mjs +1 -1
  143. package/dist/esm/init/frameworkSetup/nextAppRouter/templates.mjs +54 -1
  144. package/dist/esm/init/frameworkSetup/nextAppRouter/templates.mjs.map +1 -1
  145. package/dist/esm/init/frameworkSetup/nextAppRouter/transforms.mjs +2 -2
  146. package/dist/esm/init/frameworkSetup/nextAppRouter/transforms.mjs.map +1 -1
  147. package/dist/esm/init/frameworkSetup/tanstackStart/index.mjs +35 -6
  148. package/dist/esm/init/frameworkSetup/tanstackStart/index.mjs.map +1 -1
  149. package/dist/esm/init/frameworkSetup/tanstackStart/restructure.mjs +1 -1
  150. package/dist/esm/init/frameworkSetup/tanstackStart/templates.mjs +56 -1
  151. package/dist/esm/init/frameworkSetup/tanstackStart/templates.mjs.map +1 -1
  152. package/dist/esm/init/frameworkSetup/tanstackStart/transforms.mjs +94 -15
  153. package/dist/esm/init/frameworkSetup/tanstackStart/transforms.mjs.map +1 -1
  154. package/dist/esm/init/index.mjs +42 -158
  155. package/dist/esm/init/index.mjs.map +1 -1
  156. package/dist/esm/init/utils/configManipulation.mjs +38 -1
  157. package/dist/esm/init/utils/configManipulation.mjs.map +1 -1
  158. package/dist/esm/init/utils/fileSystem.mjs +1 -1
  159. package/dist/esm/init/utils/githubActions.mjs +1 -1
  160. package/dist/esm/init/utils/index.mjs +5 -3
  161. package/dist/esm/init/utils/intlayerDependencies.mjs +1 -1
  162. package/dist/esm/init/utils/lintConfig.mjs +50 -0
  163. package/dist/esm/init/utils/lintConfig.mjs.map +1 -0
  164. package/dist/esm/init/utils/packageManager.mjs +61 -15
  165. package/dist/esm/init/utils/packageManager.mjs.map +1 -1
  166. package/dist/esm/init/utils/urlRoutingFramework.mjs +40 -0
  167. package/dist/esm/init/utils/urlRoutingFramework.mjs.map +1 -0
  168. package/dist/esm/initConfig/index.mjs +5 -2
  169. package/dist/esm/initConfig/index.mjs.map +1 -1
  170. package/dist/esm/installLSP.mjs +1 -1
  171. package/dist/esm/installMCP/installMCP.mjs +1 -1
  172. package/dist/esm/installSkills/index.mjs +1 -1
  173. package/dist/esm/listDictionariesPath.mjs +1 -1
  174. package/dist/esm/listGitFiles.mjs +1 -1
  175. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +2 -2
  176. package/dist/esm/loadDictionaries/index.mjs +1 -1
  177. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +2 -2
  178. package/dist/esm/loadDictionaries/loadDictionaries.mjs +1 -1
  179. package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs +1 -1
  180. package/dist/esm/loadDictionaries/loadMarkdownContentDeclaration.mjs +1 -1
  181. package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs +105 -44
  182. package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs.map +1 -1
  183. package/dist/esm/logConfigDetails.mjs +1 -1
  184. package/dist/esm/prepareIntlayer.mjs +4 -4
  185. package/dist/esm/scan/index.mjs +1 -1
  186. package/dist/esm/scan/scanWebsite.mjs +1 -1
  187. package/dist/esm/syncPluginKit/createFileAdapter.mjs +1 -1
  188. package/dist/esm/syncPluginKit/index.mjs +1 -1
  189. package/dist/esm/utils/buildComponentFilesList.mjs +1 -1
  190. package/dist/esm/utils/contentWatcherLock.mjs +2 -2
  191. package/dist/esm/utils/index.mjs +4 -4
  192. package/dist/esm/utils/readDictionariesFromDisk.mjs +1 -1
  193. package/dist/esm/utils/runOnce.mjs +1 -1
  194. package/dist/esm/utils/runParallel/pidTree.mjs +1 -1
  195. package/dist/esm/utils/withFileLock.mjs +1 -1
  196. package/dist/esm/watcher.mjs +6 -6
  197. package/dist/esm/writeConfiguration/index.mjs +1 -1
  198. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +2 -2
  199. package/dist/esm/writeContentDeclaration/transformJSFile.mjs +1 -1
  200. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +4 -4
  201. package/dist/esm/writeContentDeclaration/writeJSFile.mjs +3 -3
  202. package/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs +1 -1
  203. package/dist/esm/writeContentDeclaration/writeYamlFile.mjs +1 -1
  204. package/dist/esm/writeFileIfChanged.mjs +1 -1
  205. package/dist/types/cli.d.ts +5 -3
  206. package/dist/types/docReview/reviewReport.d.ts.map +1 -1
  207. package/dist/types/formatDictionary.d.ts +2 -2
  208. package/dist/types/init/cms.d.ts +11 -0
  209. package/dist/types/init/cms.d.ts.map +1 -1
  210. package/dist/types/init/documentationRouter.d.ts +64 -0
  211. package/dist/types/init/documentationRouter.d.ts.map +1 -0
  212. package/dist/types/init/frameworkSetup/backend/index.d.ts +16 -0
  213. package/dist/types/init/frameworkSetup/backend/index.d.ts.map +1 -0
  214. package/dist/types/init/frameworkSetup/backend/transforms.d.ts +37 -0
  215. package/dist/types/init/frameworkSetup/backend/transforms.d.ts.map +1 -0
  216. package/dist/types/init/frameworkSetup/index.d.ts.map +1 -1
  217. package/dist/types/init/frameworkSetup/localeRouting.d.ts +11 -0
  218. package/dist/types/init/frameworkSetup/localeRouting.d.ts.map +1 -0
  219. package/dist/types/init/frameworkSetup/nextAppRouter/index.d.ts +5 -5
  220. package/dist/types/init/frameworkSetup/nextAppRouter/index.d.ts.map +1 -1
  221. package/dist/types/init/frameworkSetup/nextAppRouter/templates.d.ts +12 -0
  222. package/dist/types/init/frameworkSetup/nextAppRouter/templates.d.ts.map +1 -1
  223. package/dist/types/init/frameworkSetup/nextAppRouter/transforms.d.ts +10 -1
  224. package/dist/types/init/frameworkSetup/nextAppRouter/transforms.d.ts.map +1 -1
  225. package/dist/types/init/frameworkSetup/tanstackStart/index.d.ts +3 -2
  226. package/dist/types/init/frameworkSetup/tanstackStart/index.d.ts.map +1 -1
  227. package/dist/types/init/frameworkSetup/tanstackStart/templates.d.ts +10 -0
  228. package/dist/types/init/frameworkSetup/tanstackStart/templates.d.ts.map +1 -1
  229. package/dist/types/init/frameworkSetup/tanstackStart/transforms.d.ts +12 -0
  230. package/dist/types/init/frameworkSetup/tanstackStart/transforms.d.ts.map +1 -1
  231. package/dist/types/init/frameworkSetup/types.d.ts +6 -0
  232. package/dist/types/init/frameworkSetup/types.d.ts.map +1 -1
  233. package/dist/types/init/index.d.ts +15 -1
  234. package/dist/types/init/index.d.ts.map +1 -1
  235. package/dist/types/init/utils/configManipulation.d.ts +14 -0
  236. package/dist/types/init/utils/configManipulation.d.ts.map +1 -1
  237. package/dist/types/init/utils/index.d.ts +5 -3
  238. package/dist/types/init/utils/lintConfig.d.ts +28 -0
  239. package/dist/types/init/utils/lintConfig.d.ts.map +1 -0
  240. package/dist/types/init/utils/packageManager.d.ts +29 -6
  241. package/dist/types/init/utils/packageManager.d.ts.map +1 -1
  242. package/dist/types/init/utils/urlRoutingFramework.d.ts +9 -0
  243. package/dist/types/init/utils/urlRoutingFramework.d.ts.map +1 -0
  244. package/dist/types/initConfig/index.d.ts +3 -1
  245. package/dist/types/initConfig/index.d.ts.map +1 -1
  246. package/dist/types/loadDictionaries/logTypeScriptErrors.d.ts +4 -0
  247. package/dist/types/loadDictionaries/logTypeScriptErrors.d.ts.map +1 -1
  248. package/package.json +8 -8
@@ -1,5 +1,5 @@
1
- let node_fs = require("node:fs");
2
1
  let node_path = require("node:path");
2
+ let node_fs = require("node:fs");
3
3
  let node_url = require("node:url");
4
4
 
5
5
  //#region \0utils:asset
@@ -1,6 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_utils_readDictionariesFromDisk = require('./utils/readDictionariesFromDisk.cjs');
3
3
  const require_buildIntlayerDictionary_buildIntlayerDictionary = require('./buildIntlayerDictionary/buildIntlayerDictionary.cjs');
4
+ const require_buildIntlayerDictionary_processContentDeclaration = require('./buildIntlayerDictionary/processContentDeclaration.cjs');
5
+ const require_cleanOutputDir = require('./cleanOutputDir.cjs');
4
6
  const require_createDictionaryEntryPoint_generateDictionaryListContent = require('./createDictionaryEntryPoint/generateDictionaryListContent.cjs');
5
7
  const require_createDictionaryEntryPoint_getBuiltDictionariesPath = require('./createDictionaryEntryPoint/getBuiltDictionariesPath.cjs');
6
8
  const require_createDictionaryEntryPoint_getBuiltDynamicDictionariesPath = require('./createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs');
@@ -10,13 +12,11 @@ const require_createDictionaryEntryPoint_getBuiltUnmergedDictionariesPath = requ
10
12
  const require_createDictionaryEntryPoint_createDictionaryEntryPoint = require('./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs');
11
13
  const require_createType_createModuleAugmentation = require('./createType/createModuleAugmentation.cjs');
12
14
  const require_createType_createType = require('./createType/createType.cjs');
13
- const require_buildIntlayerDictionary_processContentDeclaration = require('./buildIntlayerDictionary/processContentDeclaration.cjs');
14
- const require_loadDictionaries_loadContentDeclaration = require('./loadDictionaries/loadContentDeclaration.cjs');
15
- const require_loadDictionaries_loadLocalDictionaries = require('./loadDictionaries/loadLocalDictionaries.cjs');
16
15
  const require_formatDictionary = require('./formatDictionary.cjs');
16
+ const require_loadDictionaries_loadContentDeclaration = require('./loadDictionaries/loadContentDeclaration.cjs');
17
17
  const require_loadDictionaries_loadRemoteDictionaries = require('./loadDictionaries/loadRemoteDictionaries.cjs');
18
18
  const require_loadDictionaries_loadDictionaries = require('./loadDictionaries/loadDictionaries.cjs');
19
- const require_cleanOutputDir = require('./cleanOutputDir.cjs');
19
+ const require_loadDictionaries_loadLocalDictionaries = require('./loadDictionaries/loadLocalDictionaries.cjs');
20
20
  const require_writeConfiguration_index = require('./writeConfiguration/index.cjs');
21
21
  const require_prepareIntlayer = require('./prepareIntlayer.cjs');
22
22
  const require_writeContentDeclaration_detectExportedComponentName = require('./writeContentDeclaration/detectExportedComponentName.cjs');
@@ -2,11 +2,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_utils_parallelize = require('../utils/parallelize.cjs');
3
3
  const require_writeFileIfChanged = require('../writeFileIfChanged.cjs');
4
4
  const require_writeJsonIfChanged = require('../writeJsonIfChanged.cjs');
5
- let node_fs_promises = require("node:fs/promises");
6
5
  let node_path = require("node:path");
7
6
  let _intlayer_config_logger = require("@intlayer/config/logger");
8
- let _intlayer_config_utils = require("@intlayer/config/utils");
9
7
  let _intlayer_config_defaultValues = require("@intlayer/config/defaultValues");
8
+ let _intlayer_config_utils = require("@intlayer/config/utils");
9
+ let node_fs_promises = require("node:fs/promises");
10
10
  let _intlayer_core_dictionaryManipulator = require("@intlayer/core/dictionaryManipulator");
11
11
  let _intlayer_core_plugins = require("@intlayer/core/plugins");
12
12
 
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_utils_getPathHash = require('../utils/getPathHash.cjs');
2
3
  const require_utils_parallelize = require('../utils/parallelize.cjs');
3
4
  const require_writeFileIfChanged = require('../writeFileIfChanged.cjs');
4
- const require_utils_getPathHash = require('../utils/getPathHash.cjs');
5
- let node_fs_promises = require("node:fs/promises");
6
5
  let node_path = require("node:path");
7
6
  let _intlayer_config_logger = require("@intlayer/config/logger");
8
- let _intlayer_config_utils = require("@intlayer/config/utils");
9
7
  let _intlayer_config_defaultValues = require("@intlayer/config/defaultValues");
8
+ let _intlayer_config_utils = require("@intlayer/config/utils");
9
+ let node_fs_promises = require("node:fs/promises");
10
10
 
11
11
  //#region src/buildIntlayerDictionary/writeFetchDictionary.ts
12
12
  /**
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_utils_parallelize = require('../utils/parallelize.cjs');
3
3
  const require_writeJsonIfChanged = require('../writeJsonIfChanged.cjs');
4
- let node_fs_promises = require("node:fs/promises");
5
4
  let node_path = require("node:path");
6
5
  let _intlayer_config_logger = require("@intlayer/config/logger");
7
6
  let _intlayer_config_utils = require("@intlayer/config/utils");
7
+ let node_fs_promises = require("node:fs/promises");
8
8
  let _intlayer_core_dictionaryManipulator = require("@intlayer/core/dictionaryManipulator");
9
9
 
10
10
  //#region src/buildIntlayerDictionary/writeMergedDictionary.ts
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_utils_getPathHash = require('../utils/getPathHash.cjs');
2
3
  const require_utils_parallelize = require('../utils/parallelize.cjs');
3
4
  const require_writeFileIfChanged = require('../writeFileIfChanged.cjs');
4
- const require_utils_getPathHash = require('../utils/getPathHash.cjs');
5
- let node_fs_promises = require("node:fs/promises");
6
5
  let node_path = require("node:path");
7
6
  let _intlayer_config_logger = require("@intlayer/config/logger");
8
- let _intlayer_config_utils = require("@intlayer/config/utils");
9
7
  let _intlayer_config_defaultValues = require("@intlayer/config/defaultValues");
8
+ let _intlayer_config_utils = require("@intlayer/config/utils");
9
+ let node_fs_promises = require("node:fs/promises");
10
10
 
11
11
  //#region src/buildIntlayerDictionary/writeNestedDictionary.ts
12
12
  /**
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_utils_parallelize = require('../utils/parallelize.cjs');
3
- const require_writeJsonIfChanged = require('../writeJsonIfChanged.cjs');
4
3
  const require_filterInvalidDictionaries = require('../filterInvalidDictionaries.cjs');
4
+ const require_writeJsonIfChanged = require('../writeJsonIfChanged.cjs');
5
5
  const require_buildIntlayerDictionary_writeUnmergedDictionary = require('./writeUnmergedDictionary.cjs');
6
6
  const require_loadDictionaries_loadRemoteDictionaries = require('../loadDictionaries/loadRemoteDictionaries.cjs');
7
- let node_fs_promises = require("node:fs/promises");
8
7
  let node_path = require("node:path");
9
8
  let _intlayer_config_logger = require("@intlayer/config/logger");
9
+ let node_fs_promises = require("node:fs/promises");
10
10
  let _intlayer_core_dictionaryManipulator = require("@intlayer/core/dictionaryManipulator");
11
11
 
12
12
  //#region src/buildIntlayerDictionary/writeRemoteDictionary.ts
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_utils_parallelize = require('../utils/parallelize.cjs');
3
- const require_writeJsonIfChanged = require('../writeJsonIfChanged.cjs');
4
3
  const require_filterInvalidDictionaries = require('../filterInvalidDictionaries.cjs');
5
- let node_fs_promises = require("node:fs/promises");
4
+ const require_writeJsonIfChanged = require('../writeJsonIfChanged.cjs');
6
5
  let node_path = require("node:path");
7
6
  let _intlayer_config_logger = require("@intlayer/config/logger");
8
7
  let _intlayer_config_utils = require("@intlayer/config/utils");
8
+ let node_fs_promises = require("node:fs/promises");
9
9
  let _intlayer_core_dictionaryManipulator = require("@intlayer/core/dictionaryManipulator");
10
10
 
11
11
  //#region src/buildIntlayerDictionary/writeUnmergedDictionary.ts
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let _intlayer_config_logger = require("@intlayer/config/logger");
2
3
  let node_fs = require("node:fs");
3
4
  let node_fs_promises = require("node:fs/promises");
4
- let _intlayer_config_logger = require("@intlayer/config/logger");
5
5
 
6
6
  //#region src/cleanOutputDir.ts
7
7
  const cleanOutputDir = async (configuration) => {
@@ -3,11 +3,11 @@ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_utils_readDictionariesFromDisk = require('./utils/readDictionariesFromDisk.cjs');
4
4
  const require_writeJsonIfChanged = require('./writeJsonIfChanged.cjs');
5
5
  const require_createDictionaryEntryPoint_createDictionaryEntryPoint = require('./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs');
6
- let node_fs_promises = require("node:fs/promises");
7
6
  let node_path = require("node:path");
8
7
  let _intlayer_config_logger = require("@intlayer/config/logger");
9
8
  let fast_glob = require("fast-glob");
10
9
  fast_glob = require_runtime.__toESM(fast_glob);
10
+ let node_fs_promises = require("node:fs/promises");
11
11
  let _intlayer_config_client = require("@intlayer/config/client");
12
12
 
13
13
  //#region src/cleanRemovedContentDeclaration.ts
package/dist/cjs/cli.cjs CHANGED
@@ -1,25 +1,28 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_logConfigDetails = require('./logConfigDetails.cjs');
3
+ const require_detectFormatCommand = require('./detectFormatCommand.cjs');
2
4
  const require_listDictionariesPath = require('./listDictionariesPath.cjs');
3
5
  const require_prepareIntlayer = require('./prepareIntlayer.cjs');
4
6
  const require_writeContentDeclaration_detectExportedComponentName = require('./writeContentDeclaration/detectExportedComponentName.cjs');
5
7
  const require_writeContentDeclaration_transformJSFile = require('./writeContentDeclaration/transformJSFile.cjs');
6
- const require_detectFormatCommand = require('./detectFormatCommand.cjs');
7
8
  const require_getContentDeclarationFileTemplate_getContentDeclarationFileTemplate = require('./getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs');
8
9
  const require_writeContentDeclaration_writeJSFile = require('./writeContentDeclaration/writeJSFile.cjs');
9
10
  const require_writeContentDeclaration_writeContentDeclaration = require('./writeContentDeclaration/writeContentDeclaration.cjs');
10
- const require_installLSP = require('./installLSP.cjs');
11
11
  const require_listProjects = require('./listProjects.cjs');
12
12
  const require_init_cms = require('./init/cms.cjs');
13
+ const require_init_documentationRouter = require('./init/documentationRouter.cjs');
13
14
  const require_init_utils_packageManager = require('./init/utils/packageManager.cjs');
14
15
  const require_init_utils_nextCompilerBabel = require('./init/utils/nextCompilerBabel.cjs');
16
+ const require_init_utils_urlRoutingFramework = require('./init/utils/urlRoutingFramework.cjs');
15
17
  const require_init_upgradeIntlayerPackages = require('./init/upgradeIntlayerPackages.cjs');
16
18
  const require_init_index = require('./init/index.cjs');
19
+ const require_installLSP = require('./installLSP.cjs');
17
20
  const require_installSkills_index = require('./installSkills/index.cjs');
18
21
  const require_installMCP_installMCP = require('./installMCP/installMCP.cjs');
19
22
  const require_listGitFiles = require('./listGitFiles.cjs');
20
- const require_logConfigDetails = require('./logConfigDetails.cjs');
21
23
 
22
24
  exports.COMPAT_I18N_LIBRARIES = require_init_utils_packageManager.COMPAT_I18N_LIBRARIES;
25
+ exports.DocumentationRouter = require_init_documentationRouter.DocumentationRouter;
23
26
  exports.NEXT_INTLAYER_BABEL_CONFIG_CONTENT = require_init_utils_nextCompilerBabel.NEXT_INTLAYER_BABEL_CONFIG_CONTENT;
24
27
  exports.PLATFORMS = require_installSkills_index.PLATFORMS;
25
28
  exports.PLATFORMS_METADATA = require_installSkills_index.PLATFORMS_METADATA;
@@ -32,8 +35,11 @@ exports.detectPackageManager = require_init_utils_packageManager.detectPackageMa
32
35
  exports.enableEditorInConfig = require_init_cms.enableEditorInConfig;
33
36
  exports.getContentDeclarationFileTemplate = require_getContentDeclarationFileTemplate_getContentDeclarationFileTemplate.getContentDeclarationFileTemplate;
34
37
  exports.getDefaultApplicationURL = require_init_index.getDefaultApplicationURL;
38
+ exports.getDocumentationUrl = require_init_documentationRouter.getDocumentationUrl;
35
39
  exports.getGitRootDir = require_listProjects.getGitRootDir;
36
40
  exports.getInitialSkills = require_installSkills_index.getInitialSkills;
41
+ exports.hasLintTooling = require_init_utils_packageManager.hasLintTooling;
42
+ exports.hasUrlRoutingFramework = require_init_utils_urlRoutingFramework.hasUrlRoutingFramework;
37
43
  exports.initIntlayer = require_init_index.initIntlayer;
38
44
  exports.installLSP = require_installLSP.installLSP;
39
45
  exports.installMCP = require_installMCP_installMCP.installMCP;
@@ -45,6 +51,7 @@ exports.listGitFiles = require_listGitFiles.listGitFiles;
45
51
  exports.listGitLines = require_listGitFiles.listGitLines;
46
52
  exports.listProjects = require_listProjects.listProjects;
47
53
  exports.logConfigDetails = require_logConfigDetails.logConfigDetails;
54
+ exports.logInitSuccessMessage = require_init_index.logInitSuccessMessage;
48
55
  exports.prepareIntlayer = require_prepareIntlayer.prepareIntlayer;
49
56
  exports.setupCmsCredentials = require_init_cms.setupCmsCredentials;
50
57
  exports.transformJSFile = require_writeContentDeclaration_transformJSFile.transformJSFile;
@@ -7,9 +7,9 @@ const require_createDictionaryEntryPoint_getBuiltDynamicDictionariesPath = requi
7
7
  const require_createDictionaryEntryPoint_getBuiltFetchDictionariesPath = require('./getBuiltFetchDictionariesPath.cjs');
8
8
  const require_createDictionaryEntryPoint_getBuiltRemoteDictionariesPath = require('./getBuiltRemoteDictionariesPath.cjs');
9
9
  const require_createDictionaryEntryPoint_getBuiltUnmergedDictionariesPath = require('./getBuiltUnmergedDictionariesPath.cjs');
10
- let node_fs_promises = require("node:fs/promises");
11
10
  let node_path = require("node:path");
12
11
  let _intlayer_config_node = require("@intlayer/config/node");
12
+ let node_fs_promises = require("node:fs/promises");
13
13
 
14
14
  //#region src/createDictionaryEntryPoint/createDictionaryEntryPoint.ts
15
15
  const writeDictionaryFiles = async (paths, fileName, importType, functionName, format, configuration = (0, _intlayer_config_node.getConfiguration)()) => {
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let node_fs = require("node:fs");
4
- let node_fs_promises = require("node:fs/promises");
5
3
  let node_path = require("node:path");
6
4
  let _intlayer_config_utils = require("@intlayer/config/utils");
7
5
  let fast_glob = require("fast-glob");
8
6
  fast_glob = require_runtime.__toESM(fast_glob);
7
+ let node_fs = require("node:fs");
8
+ let node_fs_promises = require("node:fs/promises");
9
9
 
10
10
  //#region src/createDictionaryEntryPoint/getBuiltDictionariesPath.ts
11
11
  /**
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let node_fs = require("node:fs");
4
- let node_fs_promises = require("node:fs/promises");
5
3
  let node_path = require("node:path");
6
4
  let _intlayer_config_utils = require("@intlayer/config/utils");
7
5
  let fast_glob = require("fast-glob");
8
6
  fast_glob = require_runtime.__toESM(fast_glob);
7
+ let node_fs = require("node:fs");
8
+ let node_fs_promises = require("node:fs/promises");
9
9
 
10
10
  //#region src/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.ts
11
11
  /**
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let node_fs = require("node:fs");
4
- let node_fs_promises = require("node:fs/promises");
5
3
  let node_path = require("node:path");
6
4
  let _intlayer_config_utils = require("@intlayer/config/utils");
7
5
  let fast_glob = require("fast-glob");
8
6
  fast_glob = require_runtime.__toESM(fast_glob);
7
+ let node_fs = require("node:fs");
8
+ let node_fs_promises = require("node:fs/promises");
9
9
 
10
10
  //#region src/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.ts
11
11
  /**
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let node_fs = require("node:fs");
4
- let node_fs_promises = require("node:fs/promises");
5
3
  let node_path = require("node:path");
6
4
  let _intlayer_config_utils = require("@intlayer/config/utils");
7
5
  let fast_glob = require("fast-glob");
8
6
  fast_glob = require_runtime.__toESM(fast_glob);
7
+ let node_fs = require("node:fs");
8
+ let node_fs_promises = require("node:fs/promises");
9
9
 
10
10
  //#region src/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.ts
11
11
  /**
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let node_fs = require("node:fs");
4
- let node_fs_promises = require("node:fs/promises");
5
3
  let node_path = require("node:path");
6
4
  let _intlayer_config_utils = require("@intlayer/config/utils");
7
5
  let fast_glob = require("fast-glob");
8
6
  fast_glob = require_runtime.__toESM(fast_glob);
7
+ let node_fs = require("node:fs");
8
+ let node_fs_promises = require("node:fs/promises");
9
9
 
10
10
  //#region src/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.ts
11
11
  /**
@@ -1,13 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_writeFileIfChanged = require('../writeFileIfChanged.cjs');
4
3
  const require_utils_getPathHash = require('../utils/getPathHash.cjs');
5
- let node_fs_promises = require("node:fs/promises");
4
+ const require_writeFileIfChanged = require('../writeFileIfChanged.cjs');
6
5
  let node_path = require("node:path");
7
6
  let _intlayer_config_utils = require("@intlayer/config/utils");
8
- let _intlayer_core_localization = require("@intlayer/core/localization");
9
7
  let fast_glob = require("fast-glob");
10
8
  fast_glob = require_runtime.__toESM(fast_glob);
9
+ let node_fs_promises = require("node:fs/promises");
10
+ let _intlayer_core_localization = require("@intlayer/core/localization");
11
11
 
12
12
  //#region src/createType/createModuleAugmentation.ts
13
13
  const getTypeName = (key) => `${(0, _intlayer_config_utils.kebabCaseToCamelCase)(key)}Content`;
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_utils_parallelize = require('../utils/parallelize.cjs');
3
3
  const require_writeFileIfChanged = require('../writeFileIfChanged.cjs');
4
- let node_fs_promises = require("node:fs/promises");
5
4
  let node_path = require("node:path");
5
+ let node_fs_promises = require("node:fs/promises");
6
6
 
7
7
  //#region src/createType/createType.ts
8
8
  const generateTypeScriptType = (dictionary) => {
@@ -1,13 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_docReview_mapChangedLinesToBlocks = require('./mapChangedLinesToBlocks.cjs');
2
+ const require_docReview_normalizeBlock = require('./normalizeBlock.cjs');
3
+ const require_docReview_fingerprintBlock = require('./fingerprintBlock.cjs');
4
+ const require_docReview_segmentDocument = require('./segmentDocument.cjs');
5
+ const require_docReview_planActions = require('./planActions.cjs');
3
6
  const require_docReview_computeSimilarity = require('./computeSimilarity.cjs');
4
7
  const require_docReview_alignBlocks = require('./alignBlocks.cjs');
5
- const require_docReview_fingerprintBlock = require('./fingerprintBlock.cjs');
6
- const require_docReview_normalizeBlock = require('./normalizeBlock.cjs');
8
+ const require_docReview_mapChangedLinesToBlocks = require('./mapChangedLinesToBlocks.cjs');
7
9
  const require_docReview_rebuildDocument = require('./rebuildDocument.cjs');
8
- const require_docReview_segmentDocument = require('./segmentDocument.cjs');
9
10
  const require_docReview_pipeline = require('./pipeline.cjs');
10
- const require_docReview_planActions = require('./planActions.cjs');
11
11
  const require_docReview_reviewReport = require('./reviewReport.cjs');
12
12
 
13
13
  exports.alignBaseAndTargetBlocks = require_docReview_alignBlocks.alignBaseAndTargetBlocks;
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_docReview_mapChangedLinesToBlocks = require('./mapChangedLinesToBlocks.cjs');
3
- const require_docReview_alignBlocks = require('./alignBlocks.cjs');
4
- const require_docReview_fingerprintBlock = require('./fingerprintBlock.cjs');
5
2
  const require_docReview_normalizeBlock = require('./normalizeBlock.cjs');
6
- const require_docReview_rebuildDocument = require('./rebuildDocument.cjs');
3
+ const require_docReview_fingerprintBlock = require('./fingerprintBlock.cjs');
7
4
  const require_docReview_segmentDocument = require('./segmentDocument.cjs');
5
+ const require_docReview_alignBlocks = require('./alignBlocks.cjs');
6
+ const require_docReview_mapChangedLinesToBlocks = require('./mapChangedLinesToBlocks.cjs');
7
+ const require_docReview_rebuildDocument = require('./rebuildDocument.cjs');
8
8
 
9
9
  //#region src/docReview/pipeline.ts
10
10
  /** Fingerprint a list of already-segmented blocks (context = neighbours). */
@@ -1 +1 @@
1
- {"version":3,"file":"reviewReport.cjs","names":["buildAlignmentPlan","colorize","ANSIColors","colorizeNumber"],"sources":["../../../src/docReview/reviewReport.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizeNumber } from '@intlayer/config/logger';\nimport { buildAlignmentPlan } from './pipeline';\n\n/**\n * The kind of change detected for a block when reviewing a translation against\n * its base document.\n *\n * - `review`: the base block changed and its translation must be updated.\n * - `insert_new`: the base block has no translation yet and must be added.\n * - `delete`: the target block no longer exists in the base and should be removed.\n */\nexport type ReviewBlockAction = 'review' | 'insert_new' | 'delete';\n\n/** A 1-based, inclusive line range within a document. */\nexport type LineRange = {\n start: number;\n end: number;\n};\n\n/**\n * A single block that diverges between the base document and its translation.\n *\n * This is the unit an external translator (AI client, human, or agent) needs to\n * act on: it carries the base content to translate, the existing translation to\n * update, and where each lives so the change can be located in the file.\n */\nexport type ReviewReportBlock = {\n /** What should happen to this block. */\n action: ReviewBlockAction;\n /** Line range of the block in the base document (omitted for pure deletions). */\n baseLineRange?: LineRange;\n /** Line range of the block in the target document (omitted for new insertions). */\n targetLineRange?: LineRange;\n /** Raw markdown of the base block (omitted for pure deletions). */\n baseContent?: string;\n /** Existing translation of the block (omitted for new insertions). */\n targetContent?: string;\n};\n\nexport type ReviewReportSummary = {\n /** Number of blocks reused as-is (unchanged translation). */\n reuse: number;\n /** Number of blocks whose translation must be updated. */\n review: number;\n /** Number of blocks missing a translation. */\n insertNew: number;\n /** Number of stale target blocks to delete. */\n delete: number;\n};\n\nexport type ReviewReport = {\n /** Only the blocks that diverge (review, insert_new, delete). */\n blocks: ReviewReportBlock[];\n /** Counts per action over the whole document, including reused blocks. */\n summary: ReviewReportSummary;\n};\n\nexport type BuildReviewReportInput = {\n /** The base (source) document, used as the translation reference. */\n baseText: string;\n /** The existing target (translated) document, possibly empty. */\n targetText: string;\n /**\n * 1-based line numbers that changed in the base document.\n *\n * When omitted the whole document is compared, and only inserted and deleted\n * blocks are reported (no aligned block is flagged for review since there is\n * no way to know which ones changed). An empty array means nothing changed,\n * and no block at all is reported.\n */\n changedLines?: number[];\n};\n\n/**\n * Compare a base markdown document with its translation and report only the\n * blocks that need attention, with their line ranges and content.\n *\n * Reusable across the CLI (`doc review --log`), the backend (comparing two\n * translation contents stored in database), and agents that generate the\n * missing translations.\n *\n * @param input - The base/target texts and optional changed lines.\n * @returns The divergent blocks and a per-action summary.\n */\nexport const buildReviewReport = ({\n baseText,\n targetText,\n changedLines,\n}: BuildReviewReportInput): ReviewReport => {\n const { baseBlocks, targetBlocks, plan } = buildAlignmentPlan({\n baseText,\n targetText,\n changedLines,\n });\n\n const summary: ReviewReportSummary = {\n reuse: 0,\n review: 0,\n insertNew: 0,\n delete: 0,\n };\n\n const blocks: ReviewReportBlock[] = [];\n\n for (const [actionIndex, action] of plan.actions.entries()) {\n if (action.kind === 'reuse') {\n summary.reuse += 1;\n continue;\n }\n\n if (action.kind === 'review') {\n summary.review += 1;\n const baseBlock = baseBlocks[action.baseIndex];\n\n if (!baseBlock) continue;\n\n const targetBlock =\n action.targetIndex !== null ? targetBlocks[action.targetIndex] : null;\n\n blocks.push({\n action: 'review',\n baseLineRange: { start: baseBlock.lineStart, end: baseBlock.lineEnd },\n targetLineRange: targetBlock\n ? { start: targetBlock.lineStart, end: targetBlock.lineEnd }\n : undefined,\n baseContent: baseBlock.content,\n targetContent: targetBlock?.content,\n });\n continue;\n }\n\n if (action.kind === 'insert_new') {\n summary.insertNew += 1;\n const baseBlock = baseBlocks[action.baseIndex];\n\n if (!baseBlock) continue;\n\n // Find the target line after which the new block should be inserted:\n // scan backwards for the last action that produced a target block.\n let insertAfterLine: number | undefined;\n for (let prevIndex = actionIndex - 1; prevIndex >= 0; prevIndex--) {\n const prevAction = plan.actions[prevIndex];\n if (!prevAction) continue;\n\n let targetIdx: number | null = null;\n if (prevAction.kind === 'reuse') targetIdx = prevAction.targetIndex;\n else if (\n prevAction.kind === 'review' &&\n prevAction.targetIndex !== null\n )\n targetIdx = prevAction.targetIndex;\n else if (prevAction.kind === 'delete')\n targetIdx = prevAction.targetIndex;\n\n if (targetIdx !== null) {\n const prevTargetBlock = targetBlocks[targetIdx];\n if (prevTargetBlock) {\n insertAfterLine = prevTargetBlock.lineEnd + 1;\n break;\n }\n }\n }\n\n blocks.push({\n action: 'insert_new',\n baseLineRange: { start: baseBlock.lineStart, end: baseBlock.lineEnd },\n targetLineRange:\n insertAfterLine !== undefined\n ? { start: insertAfterLine, end: insertAfterLine }\n : undefined,\n baseContent: baseBlock.content,\n });\n continue;\n }\n\n if (action.kind === 'delete') {\n summary.delete += 1;\n const targetBlock = targetBlocks[action.targetIndex];\n\n if (!targetBlock) continue;\n\n blocks.push({\n action: 'delete',\n targetLineRange: {\n start: targetBlock.lineStart,\n end: targetBlock.lineEnd,\n },\n targetContent: targetBlock.content,\n });\n }\n }\n\n return { blocks, summary };\n};\n\n/** Render a line range as a blue colored string, or an orange dash when absent. */\nconst colorizeLineRange = (range?: LineRange): string => {\n if (!range) return colorize('—', ANSIColors.ORANGE);\n const rangeStr =\n range.start === range.end\n ? `L${range.start}`\n : `L${range.start}-${range.end}`;\n return colorize(rangeStr, ANSIColors.BLUE);\n};\n\n/**\n * Colorize a count with green when zero (nothing to do) and a caller-supplied\n * non-zero color (orange for warnings, red for destructive actions).\n */\nconst colorizeCount = (\n count: number,\n nonZeroColor: (typeof ANSIColors)[keyof typeof ANSIColors]\n): string =>\n colorizeNumber(count, {\n zero: ANSIColors.GREEN,\n one: nonZeroColor,\n two: nonZeroColor,\n few: nonZeroColor,\n many: nonZeroColor,\n other: nonZeroColor,\n });\n\n/**\n * Render a {@link ReviewReport} as a human and agent readable log.\n *\n * Each divergent block is printed with its action, the base/target line ranges,\n * the base content to translate, and the existing translation to update.\n *\n * @param report - The report to format.\n * @param options - Optional labels for the base and target locales.\n * @returns A multi-line string describing every block that needs attention.\n */\nexport const formatReviewReport = (\n report: ReviewReport,\n options?: { baseLabel?: string; targetLabel?: string }\n): string => {\n const baseLabel = options?.baseLabel ?? 'base';\n const targetLabel = options?.targetLabel ?? 'target';\n\n const { summary, blocks } = report;\n\n // Build the summary header piece-by-piece so each count uses its own color.\n const header = [\n colorize('Review report: ', ANSIColors.ORANGE),\n colorizeCount(blocks.length, ANSIColors.ORANGE),\n colorize(' block(s) need attention (review=', ANSIColors.ORANGE),\n colorizeCount(summary.review, ANSIColors.ORANGE),\n colorize(', new=', ANSIColors.ORANGE),\n colorizeCount(summary.insertNew, ANSIColors.ORANGE),\n colorize(', delete=', ANSIColors.ORANGE),\n colorizeCount(summary.delete, ANSIColors.RED),\n colorize(', reuse=', ANSIColors.ORANGE),\n colorizeNumber(summary.reuse),\n colorize(').', ANSIColors.ORANGE),\n ].join('');\n\n if (blocks.length === 0) {\n return `${header}\\n${colorize('No changes needed.', ANSIColors.GREEN)}`;\n }\n\n const sections = blocks.map((block, index) => {\n const lines: string[] = [];\n\n // Block header: each token colored individually.\n const blockHeader = [\n colorize('--- Block ', ANSIColors.ORANGE),\n colorizeNumber(index + 1),\n colorize('/', ANSIColors.ORANGE),\n colorizeNumber(blocks.length),\n colorize(` [${block.action}] `, ANSIColors.ORANGE),\n baseLabel,\n colorize(' ', ANSIColors.ORANGE),\n colorizeLineRange(block.baseLineRange),\n colorize(' → ', ANSIColors.ORANGE),\n targetLabel,\n colorize(' ', ANSIColors.ORANGE),\n colorizeLineRange(block.targetLineRange),\n colorize(' ---', ANSIColors.ORANGE),\n ].join('');\n\n lines.push(blockHeader);\n\n if (block.baseContent !== undefined) {\n lines.push(colorize(`[${baseLabel}]`, ANSIColors.BEIGE));\n lines.push(colorize(block.baseContent.trimEnd(), ANSIColors.GREY));\n }\n\n if (block.targetContent !== undefined) {\n lines.push(colorize(`[${targetLabel}]`, ANSIColors.BEIGE));\n lines.push(colorize(block.targetContent.trimEnd(), ANSIColors.GREY));\n } else if (block.action === 'insert_new') {\n lines.push(colorize(`[${targetLabel}]`, ANSIColors.BEIGE));\n lines.push(colorize('(missing — to be translated)', ANSIColors.ORANGE));\n }\n\n return lines.join('\\n');\n });\n\n const editingNote = colorize(\n 'Tip: start editing from the last block — working bottom-up keeps earlier line numbers accurate.',\n ANSIColors.GREY\n );\n\n return [header, '', ...sections, '', editingNote].join('\\n');\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqFA,MAAa,qBAAqB,EAChC,UACA,YACA,mBAC0C;CAC1C,MAAM,EAAE,YAAY,cAAc,SAASA,8CAAmB;EAC5D;E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AAC;CAED,MAAM,kBAAcD,kCAClB,mGACAC,wBAAW,IACb;CAEA,OAAO;EAAC;EAAQ;EAAI,GAAG;EAAU;EAAI;CAAW,CAAC,CAAC,KAAK,IAAI;AAC7D"}
1
+ {"version":3,"file":"reviewReport.cjs","names":["buildAlignmentPlan","colorize","ANSIColors","colorizeNumber"],"sources":["../../../src/docReview/reviewReport.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport {\n type ANSIColorsType,\n colorize,\n colorizeNumber,\n} from '@intlayer/config/logger';\nimport { buildAlignmentPlan } from './pipeline';\n\n/**\n * The kind of change detected for a block when reviewing a translation against\n * its base document.\n *\n * - `review`: the base block changed and its translation must be updated.\n * - `insert_new`: the base block has no translation yet and must be added.\n * - `delete`: the target block no longer exists in the base and should be removed.\n */\nexport type ReviewBlockAction = 'review' | 'insert_new' | 'delete';\n\n/** A 1-based, inclusive line range within a document. */\nexport type LineRange = {\n start: number;\n end: number;\n};\n\n/**\n * A single block that diverges between the base document and its translation.\n *\n * This is the unit an external translator (AI client, human, or agent) needs to\n * act on: it carries the base content to translate, the existing translation to\n * update, and where each lives so the change can be located in the file.\n */\nexport type ReviewReportBlock = {\n /** What should happen to this block. */\n action: ReviewBlockAction;\n /** Line range of the block in the base document (omitted for pure deletions). */\n baseLineRange?: LineRange;\n /** Line range of the block in the target document (omitted for new insertions). */\n targetLineRange?: LineRange;\n /** Raw markdown of the base block (omitted for pure deletions). */\n baseContent?: string;\n /** Existing translation of the block (omitted for new insertions). */\n targetContent?: string;\n};\n\nexport type ReviewReportSummary = {\n /** Number of blocks reused as-is (unchanged translation). */\n reuse: number;\n /** Number of blocks whose translation must be updated. */\n review: number;\n /** Number of blocks missing a translation. */\n insertNew: number;\n /** Number of stale target blocks to delete. */\n delete: number;\n};\n\nexport type ReviewReport = {\n /** Only the blocks that diverge (review, insert_new, delete). */\n blocks: ReviewReportBlock[];\n /** Counts per action over the whole document, including reused blocks. */\n summary: ReviewReportSummary;\n};\n\nexport type BuildReviewReportInput = {\n /** The base (source) document, used as the translation reference. */\n baseText: string;\n /** The existing target (translated) document, possibly empty. */\n targetText: string;\n /**\n * 1-based line numbers that changed in the base document.\n *\n * When omitted the whole document is compared, and only inserted and deleted\n * blocks are reported (no aligned block is flagged for review since there is\n * no way to know which ones changed). An empty array means nothing changed,\n * and no block at all is reported.\n */\n changedLines?: number[];\n};\n\n/**\n * Compare a base markdown document with its translation and report only the\n * blocks that need attention, with their line ranges and content.\n *\n * Reusable across the CLI (`doc review --log`), the backend (comparing two\n * translation contents stored in database), and agents that generate the\n * missing translations.\n *\n * @param input - The base/target texts and optional changed lines.\n * @returns The divergent blocks and a per-action summary.\n */\nexport const buildReviewReport = ({\n baseText,\n targetText,\n changedLines,\n}: BuildReviewReportInput): ReviewReport => {\n const { baseBlocks, targetBlocks, plan } = buildAlignmentPlan({\n baseText,\n targetText,\n changedLines,\n });\n\n const summary: ReviewReportSummary = {\n reuse: 0,\n review: 0,\n insertNew: 0,\n delete: 0,\n };\n\n const blocks: ReviewReportBlock[] = [];\n\n for (const [actionIndex, action] of plan.actions.entries()) {\n if (action.kind === 'reuse') {\n summary.reuse += 1;\n continue;\n }\n\n if (action.kind === 'review') {\n summary.review += 1;\n const baseBlock = baseBlocks[action.baseIndex];\n\n if (!baseBlock) continue;\n\n const targetBlock =\n action.targetIndex !== null ? targetBlocks[action.targetIndex] : null;\n\n blocks.push({\n action: 'review',\n baseLineRange: { start: baseBlock.lineStart, end: baseBlock.lineEnd },\n targetLineRange: targetBlock\n ? { start: targetBlock.lineStart, end: targetBlock.lineEnd }\n : undefined,\n baseContent: baseBlock.content,\n targetContent: targetBlock?.content,\n });\n continue;\n }\n\n if (action.kind === 'insert_new') {\n summary.insertNew += 1;\n const baseBlock = baseBlocks[action.baseIndex];\n\n if (!baseBlock) continue;\n\n // Find the target line after which the new block should be inserted:\n // scan backwards for the last action that produced a target block.\n let insertAfterLine: number | undefined;\n for (let prevIndex = actionIndex - 1; prevIndex >= 0; prevIndex--) {\n const prevAction = plan.actions[prevIndex];\n if (!prevAction) continue;\n\n let targetIdx: number | null = null;\n if (prevAction.kind === 'reuse') targetIdx = prevAction.targetIndex;\n else if (\n prevAction.kind === 'review' &&\n prevAction.targetIndex !== null\n )\n targetIdx = prevAction.targetIndex;\n else if (prevAction.kind === 'delete')\n targetIdx = prevAction.targetIndex;\n\n if (targetIdx !== null) {\n const prevTargetBlock = targetBlocks[targetIdx];\n if (prevTargetBlock) {\n insertAfterLine = prevTargetBlock.lineEnd + 1;\n break;\n }\n }\n }\n\n blocks.push({\n action: 'insert_new',\n baseLineRange: { start: baseBlock.lineStart, end: baseBlock.lineEnd },\n targetLineRange:\n insertAfterLine !== undefined\n ? { start: insertAfterLine, end: insertAfterLine }\n : undefined,\n baseContent: baseBlock.content,\n });\n continue;\n }\n\n if (action.kind === 'delete') {\n summary.delete += 1;\n const targetBlock = targetBlocks[action.targetIndex];\n\n if (!targetBlock) continue;\n\n blocks.push({\n action: 'delete',\n targetLineRange: {\n start: targetBlock.lineStart,\n end: targetBlock.lineEnd,\n },\n targetContent: targetBlock.content,\n });\n }\n }\n\n return { blocks, summary };\n};\n\n/** Render a line range as a blue colored string, or an orange dash when absent. */\nconst colorizeLineRange = (range?: LineRange): string => {\n if (!range) return colorize('—', ANSIColors.ORANGE);\n const rangeStr =\n range.start === range.end\n ? `L${range.start}`\n : `L${range.start}-${range.end}`;\n return colorize(rangeStr, ANSIColors.BLUE);\n};\n\n/**\n * Colorize a count with green when zero (nothing to do) and a caller-supplied\n * non-zero color (orange for warnings, red for destructive actions).\n */\nconst colorizeCount = (count: number, nonZeroColor: ANSIColorsType): string =>\n colorizeNumber(count, {\n zero: ANSIColors.GREEN,\n one: nonZeroColor,\n two: nonZeroColor,\n few: nonZeroColor,\n many: nonZeroColor,\n other: nonZeroColor,\n });\n\n/**\n * Render a {@link ReviewReport} as a human and agent readable log.\n *\n * Each divergent block is printed with its action, the base/target line ranges,\n * the base content to translate, and the existing translation to update.\n *\n * @param report - The report to format.\n * @param options - Optional labels for the base and target locales.\n * @returns A multi-line string describing every block that needs attention.\n */\nexport const formatReviewReport = (\n report: ReviewReport,\n options?: { baseLabel?: string; targetLabel?: string }\n): string => {\n const baseLabel = options?.baseLabel ?? 'base';\n const targetLabel = options?.targetLabel ?? 'target';\n\n const { summary, blocks } = report;\n\n // Build the summary header piece-by-piece so each count uses its own color.\n const header = [\n colorize('Review report: ', ANSIColors.ORANGE),\n colorizeCount(blocks.length, ANSIColors.ORANGE),\n colorize(' block(s) need attention (review=', ANSIColors.ORANGE),\n colorizeCount(summary.review, ANSIColors.ORANGE),\n colorize(', new=', ANSIColors.ORANGE),\n colorizeCount(summary.insertNew, ANSIColors.ORANGE),\n colorize(', delete=', ANSIColors.ORANGE),\n colorizeCount(summary.delete, ANSIColors.RED),\n colorize(', reuse=', ANSIColors.ORANGE),\n colorizeNumber(summary.reuse),\n colorize(').', ANSIColors.ORANGE),\n ].join('');\n\n if (blocks.length === 0) {\n return `${header}\\n${colorize('No changes needed.', ANSIColors.GREEN)}`;\n }\n\n const sections = blocks.map((block, index) => {\n const lines: string[] = [];\n\n // Block header: each token colored individually.\n const blockHeader = [\n colorize('--- Block ', ANSIColors.ORANGE),\n colorizeNumber(index + 1),\n colorize('/', ANSIColors.ORANGE),\n colorizeNumber(blocks.length),\n colorize(` [${block.action}] `, ANSIColors.ORANGE),\n baseLabel,\n colorize(' ', ANSIColors.ORANGE),\n colorizeLineRange(block.baseLineRange),\n colorize(' → ', ANSIColors.ORANGE),\n targetLabel,\n colorize(' ', ANSIColors.ORANGE),\n colorizeLineRange(block.targetLineRange),\n colorize(' ---', ANSIColors.ORANGE),\n ].join('');\n\n lines.push(blockHeader);\n\n if (block.baseContent !== undefined) {\n lines.push(colorize(`[${baseLabel}]`, ANSIColors.BEIGE));\n lines.push(colorize(block.baseContent.trimEnd(), ANSIColors.GREY));\n }\n\n if (block.targetContent !== undefined) {\n lines.push(colorize(`[${targetLabel}]`, ANSIColors.BEIGE));\n lines.push(colorize(block.targetContent.trimEnd(), ANSIColors.GREY));\n } else if (block.action === 'insert_new') {\n lines.push(colorize(`[${targetLabel}]`, ANSIColors.BEIGE));\n lines.push(colorize('(missing — to be translated)', ANSIColors.ORANGE));\n }\n\n return lines.join('\\n');\n });\n\n const editingNote = colorize(\n 'Tip: start editing from the last block — working bottom-up keeps earlier line numbers accurate.',\n ANSIColors.GREY\n );\n\n return [header, '', ...sections, '', editingNote].join('\\n');\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyFA,MAAa,qBAAqB,EAChC,UACA,YACA,mBAC0C;CAC1C,MAAM,EAAE,YAAY,cAAc,SAASA,8CAAmB;EAC5D;EACA;EACA;CACF,CAAC;CAED,MAAM,UAA+B;EACnC,OAAO;EACP,QAAQ;EACR,WAAW;EACX,QAAQ;CACV;CAEA,MAAM,SAA8B,CAAC;CAErC,KAAK,MAAM,CAAC,aAAa,WAAW,KAAK,QAAQ,QAAQ,GAAG;EAC1D,IAAI,OAAO,SAAS,SAAS;GAC3B,QAAQ,SAAS;GACjB;EACF;EAEA,IAAI,OAAO,SAAS,UAAU;GAC5B,QAAQ,UAAU;GAClB,MAAM,YAAY,WAAW,OAAO;GAEpC,IAAI,CAAC,WAAW;GAEhB,MAAM,cACJ,OAAO,gBAAgB,OAAO,aAAa,OAAO,eAAe;GAEnE,OAAO,KAAK;IACV,QAAQ;IACR,eAAe;KAAE,OAAO,UAAU;KAAW,KAAK,UAAU;IAAQ;IACpE,iBAAiB,cACb;KAAE,OAAO,YAAY;KAAW,KAAK,YAAY;IAAQ,IACzD;IACJ,aAAa,UAAU;IACvB,eAAe,aAAa;GAC9B,CAAC;GACD;EACF;EAEA,IAAI,OAAO,SAAS,cAAc;GAChC,QAAQ,aAAa;GACrB,MAAM,YAAY,WAAW,OAAO;GAEpC,IAAI,CAAC,WAAW;GAIhB,IAAI;GACJ,KAAK,IAAI,YAAY,cAAc,GAAG,aAAa,GAAG,aAAa;IACjE,MAAM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SAAKD,kCAAS,MAAM,YAAY,QAAQ,GAAGC,wBAAW,IAAI,CAAC;EACnE;EAEA,IAAI,MAAM,kBAAkB,QAAW;GACrC,MAAM,SAAKD,kCAAS,IAAI,YAAY,IAAIC,wBAAW,KAAK,CAAC;GACzD,MAAM,SAAKD,kCAAS,MAAM,cAAc,QAAQ,GAAGC,wBAAW,IAAI,CAAC;EACrE,OAAO,IAAI,MAAM,WAAW,cAAc;GACxC,MAAM,SAAKD,kCAAS,IAAI,YAAY,IAAIC,wBAAW,KAAK,CAAC;GACzD,MAAM,SAAKD,kCAAS,gCAAgCC,wBAAW,MAAM,CAAC;EACxE;EAEA,OAAO,MAAM,KAAK,IAAI;CACxB,CAAC;CAED,MAAM,kBAAcD,kCAClB,mGACAC,wBAAW,IACb;CAEA,OAAO;EAAC;EAAQ;EAAI,GAAG;EAAU;EAAI;CAAW,CAAC,CAAC,KAAK,IAAI;AAC7D"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_utils_parallelize = require('./utils/parallelize.cjs');
3
2
  const require_utils_chunkArray = require('./utils/chunkArray.cjs');
3
+ const require_utils_parallelize = require('./utils/parallelize.cjs');
4
4
  let _intlayer_config_logger = require("@intlayer/config/logger");
5
5
  let _intlayer_config_node = require("@intlayer/config/node");
6
6
  let _intlayer_config_utils = require("@intlayer/config/utils");
@@ -7,10 +7,10 @@ const require_createType_createModuleAugmentation = require('./createType/create
7
7
  const require_createType_createType = require('./createType/createType.cjs');
8
8
  const require_loadDictionaries_loadLocalDictionaries = require('./loadDictionaries/loadLocalDictionaries.cjs');
9
9
  const require_cleanRemovedContentDeclaration = require('./cleanRemovedContentDeclaration.cjs');
10
- let node_fs = require("node:fs");
11
- let node_fs_promises = require("node:fs/promises");
12
10
  let node_path = require("node:path");
13
11
  let _intlayer_config_logger = require("@intlayer/config/logger");
12
+ let node_fs = require("node:fs");
13
+ let node_fs_promises = require("node:fs/promises");
14
14
 
15
15
  //#region src/handleContentDeclarationFileChange.ts
16
16
  const handleContentDeclarationFileChange = async (filePath, config) => {
@@ -4,8 +4,8 @@ const require_buildIntlayerDictionary_buildIntlayerDictionary = require('./build
4
4
  const require_createType_createModuleAugmentation = require('./createType/createModuleAugmentation.cjs');
5
5
  const require_createType_createType = require('./createType/createType.cjs');
6
6
  const require_loadDictionaries_loadLocalDictionaries = require('./loadDictionaries/loadLocalDictionaries.cjs');
7
- const require_cleanRemovedContentDeclaration = require('./cleanRemovedContentDeclaration.cjs');
8
7
  const require_listDictionariesPath = require('./listDictionariesPath.cjs');
8
+ const require_cleanRemovedContentDeclaration = require('./cleanRemovedContentDeclaration.cjs');
9
9
  let node_path = require("node:path");
10
10
  let _intlayer_config_logger = require("@intlayer/config/logger");
11
11
 
@@ -121,6 +121,39 @@ const setRoutingModeInConfig = async (rootDir, mode) => {
121
121
  return configFile;
122
122
  };
123
123
  /**
124
+ * Sets `routing.enableProxy` in the project's Intlayer configuration file.
125
+ * Returns the config file that was updated, or `undefined` when none was found.
126
+ */
127
+ const setEnableProxyInConfig = async (rootDir, enableProxy) => {
128
+ const configFile = await findIntlayerConfigFile(rootDir);
129
+ if (!configFile) return void 0;
130
+ const extension = configFile.split(".").pop();
131
+ const content = await require_init_utils_fileSystem.readFileFromRoot(rootDir, configFile);
132
+ const updatedContent = require_init_utils_configManipulation.setIntlayerConfigEnableProxy(content, extension, enableProxy);
133
+ if (updatedContent !== content) {
134
+ await require_init_utils_fileSystem.writeFileToRoot(rootDir, configFile, updatedContent);
135
+ (0, _intlayer_config_logger.logger)(`${_intlayer_config_logger.v} Set ${(0, _intlayer_config_logger.colorize)(`routing.enableProxy = ${enableProxy}`, _intlayer_config_colors.GREY_LIGHT)} in ${(0, _intlayer_config_logger.colorizePath)(configFile)}`);
136
+ }
137
+ return configFile;
138
+ };
139
+ /**
140
+ * Reduces `routing` in the project's Intlayer configuration file to its
141
+ * `storage` entry. Returns the config file that was updated, or `undefined`
142
+ * when none was found.
143
+ */
144
+ const setRoutingStorageOnlyInConfig = async (rootDir) => {
145
+ const configFile = await findIntlayerConfigFile(rootDir);
146
+ if (!configFile) return void 0;
147
+ const extension = configFile.split(".").pop();
148
+ const content = await require_init_utils_fileSystem.readFileFromRoot(rootDir, configFile);
149
+ const updatedContent = require_init_utils_configManipulation.setIntlayerConfigRoutingStorageOnly(content, extension);
150
+ if (updatedContent !== content) {
151
+ await require_init_utils_fileSystem.writeFileToRoot(rootDir, configFile, updatedContent);
152
+ (0, _intlayer_config_logger.logger)(`${_intlayer_config_logger.v} Kept only ${(0, _intlayer_config_logger.colorize)("routing.storage", _intlayer_config_colors.GREY_LIGHT)} in ${(0, _intlayer_config_logger.colorizePath)(configFile)} (no URL routing in this project)`);
153
+ }
154
+ return configFile;
155
+ };
156
+ /**
124
157
  * Sets `compiler.output` in the project's Intlayer configuration file to the
125
158
  * given `{{variable}}` path template. Returns the config file that was updated,
126
159
  * or `undefined` when none was found.
@@ -152,7 +185,9 @@ exports.INTLAYER_CONFIG_FILE_CANDIDATES = INTLAYER_CONFIG_FILE_CANDIDATES;
152
185
  exports.enableEditorInConfig = enableEditorInConfig;
153
186
  exports.findEnvFile = findEnvFile;
154
187
  exports.setCompilerOutputInConfig = setCompilerOutputInConfig;
188
+ exports.setEnableProxyInConfig = setEnableProxyInConfig;
155
189
  exports.setRoutingModeInConfig = setRoutingModeInConfig;
190
+ exports.setRoutingStorageOnlyInConfig = setRoutingStorageOnlyInConfig;
156
191
  exports.setupCmsCredentials = setupCmsCredentials;
157
192
  exports.writeCmsCredentialsToEnv = writeCmsCredentialsToEnv;
158
193
  //# sourceMappingURL=cms.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cms.cjs","names":["exists","fg","readFileFromRoot","writeFileToRoot","v","colorizePath","colorize","ANSIColors","x","enableIntlayerEditorConfig","setIntlayerConfigRoutingMode","setIntlayerConfigCompilerOutput"],"sources":["../../../src/init/cms.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizePath, logger, v, x } from '@intlayer/config/logger';\nimport fg from 'fast-glob';\nimport {\n enableIntlayerEditorConfig,\n type RoutingMode,\n setIntlayerConfigCompilerOutput,\n setIntlayerConfigRoutingMode,\n} from './utils/configManipulation';\nimport { exists, readFileFromRoot, writeFileToRoot } from './utils/fileSystem';\n\n/**\n * Intlayer configuration file candidates, ordered by the precedence used when\n * resolving which file to mutate.\n */\nexport const INTLAYER_CONFIG_FILE_CANDIDATES = [\n 'intlayer.config.ts',\n 'intlayer.config.mjs',\n 'intlayer.config.js',\n 'intlayer.config.cjs',\n 'intlayer.config.json',\n] as const;\n\n/**\n * Environment files searched (most-preferred first) when persisting the CMS\n * credentials. The first existing match is reused; otherwise a `.env` file is\n * created at the project root.\n */\nconst ENV_FILE_CANDIDATES = ['.env', '.env.local', '.env.development'] as const;\n\n/** Credentials returned by the CMS login flow (access key pair). */\nexport type CmsCredentials = {\n clientId: string;\n clientSecret: string;\n};\n\n/**\n * Resolves the first existing Intlayer configuration file at the project root,\n * or `undefined` when none is present.\n */\nconst findIntlayerConfigFile = async (\n rootDir: string\n): Promise<(typeof INTLAYER_CONFIG_FILE_CANDIDATES)[number] | undefined> => {\n for (const candidate of INTLAYER_CONFIG_FILE_CANDIDATES) {\n if (await exists(rootDir, candidate)) {\n return candidate;\n }\n }\n\n return undefined;\n};\n\n/**\n * Locates the environment file the CMS credentials should be written to. Uses\n * `fast-glob` to detect an existing dotenv file at the project root, preferring\n * a plain `.env`; falls back to `.env` (to be created) when none exist.\n */\nexport const findEnvFile = async (rootDir: string): Promise<string> => {\n const matches = await fg([...ENV_FILE_CANDIDATES], {\n cwd: rootDir,\n dot: true,\n deep: 1,\n onlyFiles: true,\n });\n\n return (\n ENV_FILE_CANDIDATES.find((candidate) => matches.includes(candidate)) ??\n '.env'\n );\n};\n\n/**\n * Inserts or updates a `KEY=value` line in dotenv file content. An existing\n * assignment of the same key is replaced in place; otherwise the line is\n * appended with a trailing newline.\n */\nconst upsertEnvVariable = (\n content: string,\n key: string,\n value: string\n): string => {\n const line = `${key}=${value}`;\n const keyMatcher = new RegExp(`^${key}=.*$`, 'm');\n\n if (keyMatcher.test(content)) {\n return content.replace(keyMatcher, line);\n }\n\n const needsLeadingNewline = content.length > 0 && !content.endsWith('\\n');\n\n return `${content}${needsLeadingNewline ? '\\n' : ''}${line}\\n`;\n};\n\n/**\n * Persists the CMS access-key credentials to the project's environment file as\n * `INTLAYER_CLIENT_ID` / `INTLAYER_CLIENT_SECRET`. The target file is detected\n * with {@link findEnvFile} and created when missing. Returns the relative path\n * of the file that was written.\n */\nexport const writeCmsCredentialsToEnv = async (\n rootDir: string,\n { clientId, clientSecret }: CmsCredentials\n): Promise<string> => {\n const envFile = await findEnvFile(rootDir);\n\n let content = '';\n if (await exists(rootDir, envFile)) {\n content = await readFileFromRoot(rootDir, envFile);\n }\n\n let updatedContent = content;\n updatedContent = upsertEnvVariable(\n updatedContent,\n 'INTLAYER_CLIENT_ID',\n clientId\n );\n updatedContent = upsertEnvVariable(\n updatedContent,\n 'INTLAYER_CLIENT_SECRET',\n clientSecret\n );\n\n await writeFileToRoot(rootDir, envFile, updatedContent);\n logger(\n `${v} Saved Intlayer CMS credentials to ${colorizePath(envFile)} (${colorize('INTLAYER_CLIENT_ID', ANSIColors.GREY_LIGHT)}, ${colorize('INTLAYER_CLIENT_SECRET', ANSIColors.GREY_LIGHT)})`\n );\n\n return envFile;\n};\n\n/**\n * Enables the Intlayer visual editor in the project's configuration file:\n * flips `editor.enabled` to `true` and wires `clientId` / `clientSecret` to the\n * matching environment variables. JSON configs cannot reference `process.env`,\n * so they are skipped with a warning. Returns the config file that was updated,\n * or `undefined` when no editable config was found.\n */\nexport const enableEditorInConfig = async (\n rootDir: string\n): Promise<string | undefined> => {\n const configFile = await findIntlayerConfigFile(rootDir);\n\n if (!configFile) {\n logger(\n `${x} Could not find an Intlayer configuration file to enable the editor.`,\n { level: 'warn' }\n );\n return undefined;\n }\n\n const extension = configFile.split('.').pop()!;\n\n if (extension === 'json') {\n logger(\n `${x} ${colorizePath(configFile)} is a JSON config and cannot reference environment variables. Enable the editor and set clientId/clientSecret manually.`,\n { level: 'warn' }\n );\n return undefined;\n }\n\n const content = await readFileFromRoot(rootDir, configFile);\n const updatedContent = enableIntlayerEditorConfig(content);\n\n if (updatedContent !== content) {\n await writeFileToRoot(rootDir, configFile, updatedContent);\n logger(`${v} Enabled the Intlayer editor in ${colorizePath(configFile)}`);\n } else {\n logger(\n `${v} ${colorizePath(configFile)} already has the Intlayer editor enabled`\n );\n }\n\n return configFile;\n};\n\n/**\n * Sets `routing.mode` in the project's Intlayer configuration file. Returns the\n * config file that was updated, or `undefined` when none was found.\n */\nexport const setRoutingModeInConfig = async (\n rootDir: string,\n mode: RoutingMode\n): Promise<string | undefined> => {\n const configFile = await findIntlayerConfigFile(rootDir);\n\n if (!configFile) return undefined;\n\n const extension = configFile.split('.').pop()!;\n const content = await readFileFromRoot(rootDir, configFile);\n const updatedContent = setIntlayerConfigRoutingMode(content, extension, mode);\n\n if (updatedContent !== content) {\n await writeFileToRoot(rootDir, configFile, updatedContent);\n logger(\n `${v} Set ${colorize(`routing.mode = '${mode}'`, ANSIColors.GREY_LIGHT)} in ${colorizePath(configFile)}`\n );\n }\n\n return configFile;\n};\n\n/**\n * Sets `compiler.output` in the project's Intlayer configuration file to the\n * given `{{variable}}` path template. Returns the config file that was updated,\n * or `undefined` when none was found.\n */\nexport const setCompilerOutputInConfig = async (\n rootDir: string,\n outputTemplate: string\n): Promise<string | undefined> => {\n const configFile = await findIntlayerConfigFile(rootDir);\n\n if (!configFile) return undefined;\n\n const extension = configFile.split('.').pop()!;\n const content = await readFileFromRoot(rootDir, configFile);\n const updatedContent = setIntlayerConfigCompilerOutput(\n content,\n extension,\n outputTemplate\n );\n\n if (updatedContent !== content) {\n await writeFileToRoot(rootDir, configFile, updatedContent);\n logger(\n `${v} Set ${colorize(`compiler.output = '${outputTemplate}'`, ANSIColors.GREY_LIGHT)} in ${colorizePath(configFile)}`\n );\n }\n\n return configFile;\n};\n\n/**\n * Completes the CMS setup once credentials are received from the login flow:\n * writes them to the environment file and enables the editor in the Intlayer\n * configuration file.\n */\nexport const setupCmsCredentials = async (\n rootDir: string,\n credentials: CmsCredentials\n): Promise<void> => {\n await writeCmsCredentialsToEnv(rootDir, credentials);\n await enableEditorInConfig(rootDir);\n};\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,kCAAkC;CAC7C;CACA;CACA;CACA;CACA;AACF;;;;;;AAOA,MAAM,sBAAsB;CAAC;CAAQ;CAAc;AAAkB;;;;;AAYrE,MAAM,yBAAyB,OAC7B,YAC0E;CAC1E,KAAK,MAAM,aAAa,iCACtB,IAAI,MAAMA,qCAAO,SAAS,SAAS,GACjC,OAAO;AAKb;;;;;;AAOA,MAAa,cAAc,OAAO,YAAqC;CACrE,MAAM,UAAU,UAAMC,mBAAG,CAAC,GAAG,mBAAmB,GAAG;EACjD,KAAK;EACL,KAAK;EACL,MAAM;EACN,WAAW;CACb,CAAC;CAED,OACE,oBAAoB,MAAM,cAAc,QAAQ,SAAS,SAAS,CAAC,KACnE;AAEJ;;;;;;AAOA,MAAM,qBACJ,SACA,KACA,UACW;CACX,MAAM,OAAO,GAAG,IAAI,GAAG;CACvB,MAAM,aAAa,IAAI,OAAO,IAAI,IAAI,OAAO,GAAG;CAEhD,IAAI,WAAW,KAAK,OAAO,GACzB,OAAO,QAAQ,QAAQ,YAAY,IAAI;CAKzC,OAAO,GAAG,UAFkB,QAAQ,SAAS,KAAK,CAAC,QAAQ,SAAS,IAAI,IAE9B,OAAO,KAAK,KAAK;AAC7D;;;;;;;AAQA,MAAa,2BAA2B,OACtC,SACA,EAAE,UAAU,mBACQ;CACpB,MAAM,UAAU,MAAM,YAAY,OAAO;CAEzC,IAAI,UAAU;CACd,IAAI,MAAMD,qCAAO,SAAS,OAAO,GAC/B,UAAU,MAAME,+CAAiB,SAAS,OAAO;CAGnD,IAAI,iBAAiB;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,oCACE,GAAGC,0BAAE,WAAOE,kCAAS,mBAAmB,KAAK,IAAIC,wBAAW,UAAU,EAAE,UAAMF,sCAAa,UAAU,GACvG;CACF;CAEA,OAAO;AACT;;;;;;AAOA,MAAa,4BAA4B,OACvC,SACA,mBACgC;CAChC,MAAM,aAAa,MAAM,uBAAuB,OAAO;CAEvD,IAAI,CAAC,YAAY,OAAO;CAExB,MAAM,YAAY,WAAW,MAAM,GAAG,CAAC,CAAC,IAAI;CAC5C,MAAM,UAAU,MAAMH,+CAAiB,SAAS,UAAU;CAC1D,MAAM,iBAAiBS,sEACrB,SACA,WACA,cACF;CAEA,IAAI,mBAAmB,SAAS;EAC9B,MAAMR,8CAAgB,SAAS,YAAY,cAAc;EACzD,oCACE,GAAGC,0BAAE,WAAOE,kCAAS,sBAAsB,eAAe,IAAIC,wBAAW,UAAU,EAAE,UAAMF,sCAAa,UAAU,GACpH;CACF;CAEA,OAAO;AACT;;;;;;AAOA,MAAa,sBAAsB,OACjC,SACA,gBACkB;CAClB,MAAM,yBAAyB,SAAS,WAAW;CACnD,MAAM,qBAAqB,OAAO;AACpC"}
1
+ {"version":3,"file":"cms.cjs","names":["exists","fg","readFileFromRoot","writeFileToRoot","v","colorizePath","colorize","ANSIColors","x","enableIntlayerEditorConfig","setIntlayerConfigRoutingMode","setIntlayerConfigEnableProxy","setIntlayerConfigRoutingStorageOnly","setIntlayerConfigCompilerOutput"],"sources":["../../../src/init/cms.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizePath, logger, v, x } from '@intlayer/config/logger';\nimport fg from 'fast-glob';\nimport {\n enableIntlayerEditorConfig,\n type RoutingMode,\n setIntlayerConfigCompilerOutput,\n setIntlayerConfigEnableProxy,\n setIntlayerConfigRoutingMode,\n setIntlayerConfigRoutingStorageOnly,\n} from './utils/configManipulation';\nimport { exists, readFileFromRoot, writeFileToRoot } from './utils/fileSystem';\n\n/**\n * Intlayer configuration file candidates, ordered by the precedence used when\n * resolving which file to mutate.\n */\nexport const INTLAYER_CONFIG_FILE_CANDIDATES = [\n 'intlayer.config.ts',\n 'intlayer.config.mjs',\n 'intlayer.config.js',\n 'intlayer.config.cjs',\n 'intlayer.config.json',\n] as const;\n\n/**\n * Environment files searched (most-preferred first) when persisting the CMS\n * credentials. The first existing match is reused; otherwise a `.env` file is\n * created at the project root.\n */\nconst ENV_FILE_CANDIDATES = ['.env', '.env.local', '.env.development'] as const;\n\n/** Credentials returned by the CMS login flow (access key pair). */\nexport type CmsCredentials = {\n clientId: string;\n clientSecret: string;\n};\n\n/**\n * Resolves the first existing Intlayer configuration file at the project root,\n * or `undefined` when none is present.\n */\nconst findIntlayerConfigFile = async (\n rootDir: string\n): Promise<(typeof INTLAYER_CONFIG_FILE_CANDIDATES)[number] | undefined> => {\n for (const candidate of INTLAYER_CONFIG_FILE_CANDIDATES) {\n if (await exists(rootDir, candidate)) {\n return candidate;\n }\n }\n\n return undefined;\n};\n\n/**\n * Locates the environment file the CMS credentials should be written to. Uses\n * `fast-glob` to detect an existing dotenv file at the project root, preferring\n * a plain `.env`; falls back to `.env` (to be created) when none exist.\n */\nexport const findEnvFile = async (rootDir: string): Promise<string> => {\n const matches = await fg([...ENV_FILE_CANDIDATES], {\n cwd: rootDir,\n dot: true,\n deep: 1,\n onlyFiles: true,\n });\n\n return (\n ENV_FILE_CANDIDATES.find((candidate) => matches.includes(candidate)) ??\n '.env'\n );\n};\n\n/**\n * Inserts or updates a `KEY=value` line in dotenv file content. An existing\n * assignment of the same key is replaced in place; otherwise the line is\n * appended with a trailing newline.\n */\nconst upsertEnvVariable = (\n content: string,\n key: string,\n value: string\n): string => {\n const line = `${key}=${value}`;\n const keyMatcher = new RegExp(`^${key}=.*$`, 'm');\n\n if (keyMatcher.test(content)) {\n return content.replace(keyMatcher, line);\n }\n\n const needsLeadingNewline = content.length > 0 && !content.endsWith('\\n');\n\n return `${content}${needsLeadingNewline ? '\\n' : ''}${line}\\n`;\n};\n\n/**\n * Persists the CMS access-key credentials to the project's environment file as\n * `INTLAYER_CLIENT_ID` / `INTLAYER_CLIENT_SECRET`. The target file is detected\n * with {@link findEnvFile} and created when missing. Returns the relative path\n * of the file that was written.\n */\nexport const writeCmsCredentialsToEnv = async (\n rootDir: string,\n { clientId, clientSecret }: CmsCredentials\n): Promise<string> => {\n const envFile = await findEnvFile(rootDir);\n\n let content = '';\n if (await exists(rootDir, envFile)) {\n content = await readFileFromRoot(rootDir, envFile);\n }\n\n let updatedContent = content;\n updatedContent = upsertEnvVariable(\n updatedContent,\n 'INTLAYER_CLIENT_ID',\n clientId\n );\n updatedContent = upsertEnvVariable(\n updatedContent,\n 'INTLAYER_CLIENT_SECRET',\n clientSecret\n );\n\n await writeFileToRoot(rootDir, envFile, updatedContent);\n logger(\n `${v} Saved Intlayer CMS credentials to ${colorizePath(envFile)} (${colorize('INTLAYER_CLIENT_ID', ANSIColors.GREY_LIGHT)}, ${colorize('INTLAYER_CLIENT_SECRET', ANSIColors.GREY_LIGHT)})`\n );\n\n return envFile;\n};\n\n/**\n * Enables the Intlayer visual editor in the project's configuration file:\n * flips `editor.enabled` to `true` and wires `clientId` / `clientSecret` to the\n * matching environment variables. JSON configs cannot reference `process.env`,\n * so they are skipped with a warning. Returns the config file that was updated,\n * or `undefined` when no editable config was found.\n */\nexport const enableEditorInConfig = async (\n rootDir: string\n): Promise<string | undefined> => {\n const configFile = await findIntlayerConfigFile(rootDir);\n\n if (!configFile) {\n logger(\n `${x} Could not find an Intlayer configuration file to enable the editor.`,\n { level: 'warn' }\n );\n return undefined;\n }\n\n const extension = configFile.split('.').pop()!;\n\n if (extension === 'json') {\n logger(\n `${x} ${colorizePath(configFile)} is a JSON config and cannot reference environment variables. Enable the editor and set clientId/clientSecret manually.`,\n { level: 'warn' }\n );\n return undefined;\n }\n\n const content = await readFileFromRoot(rootDir, configFile);\n const updatedContent = enableIntlayerEditorConfig(content);\n\n if (updatedContent !== content) {\n await writeFileToRoot(rootDir, configFile, updatedContent);\n logger(`${v} Enabled the Intlayer editor in ${colorizePath(configFile)}`);\n } else {\n logger(\n `${v} ${colorizePath(configFile)} already has the Intlayer editor enabled`\n );\n }\n\n return configFile;\n};\n\n/**\n * Sets `routing.mode` in the project's Intlayer configuration file. Returns the\n * config file that was updated, or `undefined` when none was found.\n */\nexport const setRoutingModeInConfig = async (\n rootDir: string,\n mode: RoutingMode\n): Promise<string | undefined> => {\n const configFile = await findIntlayerConfigFile(rootDir);\n\n if (!configFile) return undefined;\n\n const extension = configFile.split('.').pop()!;\n const content = await readFileFromRoot(rootDir, configFile);\n const updatedContent = setIntlayerConfigRoutingMode(content, extension, mode);\n\n if (updatedContent !== content) {\n await writeFileToRoot(rootDir, configFile, updatedContent);\n logger(\n `${v} Set ${colorize(`routing.mode = '${mode}'`, ANSIColors.GREY_LIGHT)} in ${colorizePath(configFile)}`\n );\n }\n\n return configFile;\n};\n\n/**\n * Sets `routing.enableProxy` in the project's Intlayer configuration file.\n * Returns the config file that was updated, or `undefined` when none was found.\n */\nexport const setEnableProxyInConfig = async (\n rootDir: string,\n enableProxy: boolean\n): Promise<string | undefined> => {\n const configFile = await findIntlayerConfigFile(rootDir);\n\n if (!configFile) return undefined;\n\n const extension = configFile.split('.').pop()!;\n const content = await readFileFromRoot(rootDir, configFile);\n const updatedContent = setIntlayerConfigEnableProxy(\n content,\n extension,\n enableProxy\n );\n\n if (updatedContent !== content) {\n await writeFileToRoot(rootDir, configFile, updatedContent);\n logger(\n `${v} Set ${colorize(`routing.enableProxy = ${enableProxy}`, ANSIColors.GREY_LIGHT)} in ${colorizePath(configFile)}`\n );\n }\n\n return configFile;\n};\n\n/**\n * Reduces `routing` in the project's Intlayer configuration file to its\n * `storage` entry. Returns the config file that was updated, or `undefined`\n * when none was found.\n */\nexport const setRoutingStorageOnlyInConfig = async (\n rootDir: string\n): Promise<string | undefined> => {\n const configFile = await findIntlayerConfigFile(rootDir);\n\n if (!configFile) return undefined;\n\n const extension = configFile.split('.').pop()!;\n const content = await readFileFromRoot(rootDir, configFile);\n const updatedContent = setIntlayerConfigRoutingStorageOnly(\n content,\n extension\n );\n\n if (updatedContent !== content) {\n await writeFileToRoot(rootDir, configFile, updatedContent);\n logger(\n `${v} Kept only ${colorize('routing.storage', ANSIColors.GREY_LIGHT)} in ${colorizePath(configFile)} (no URL routing in this project)`\n );\n }\n\n return configFile;\n};\n\n/**\n * Sets `compiler.output` in the project's Intlayer configuration file to the\n * given `{{variable}}` path template. Returns the config file that was updated,\n * or `undefined` when none was found.\n */\nexport const setCompilerOutputInConfig = async (\n rootDir: string,\n outputTemplate: string\n): Promise<string | undefined> => {\n const configFile = await findIntlayerConfigFile(rootDir);\n\n if (!configFile) return undefined;\n\n const extension = configFile.split('.').pop()!;\n const content = await readFileFromRoot(rootDir, configFile);\n const updatedContent = setIntlayerConfigCompilerOutput(\n content,\n extension,\n outputTemplate\n );\n\n if (updatedContent !== content) {\n await writeFileToRoot(rootDir, configFile, updatedContent);\n logger(\n `${v} Set ${colorize(`compiler.output = '${outputTemplate}'`, ANSIColors.GREY_LIGHT)} in ${colorizePath(configFile)}`\n );\n }\n\n return configFile;\n};\n\n/**\n * Completes the CMS setup once credentials are received from the login flow:\n * writes them to the environment file and enables the editor in the Intlayer\n * configuration file.\n */\nexport const setupCmsCredentials = async (\n rootDir: string,\n credentials: CmsCredentials\n): Promise<void> => {\n await writeCmsCredentialsToEnv(rootDir, credentials);\n await enableEditorInConfig(rootDir);\n};\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAa,kCAAkC;CAC7C;CACA;CACA;CACA;CACA;AACF;;;;;;AAOA,MAAM,sBAAsB;CAAC;CAAQ;CAAc;AAAkB;;;;;AAYrE,MAAM,yBAAyB,OAC7B,YAC0E;CAC1E,KAAK,MAAM,aAAa,iCACtB,IAAI,MAAMA,qCAAO,SAAS,SAAS,GACjC,OAAO;AAKb;;;;;;AAOA,MAAa,cAAc,OAAO,YAAqC;CACrE,MAAM,UAAU,UAAMC,mBAAG,CAAC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