@intlayer/engine 9.3.0 → 9.3.2

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 (297) hide show
  1. package/README.md +24 -24
  2. package/dist/assets/initConfig/templates/cjs.txt +1 -1
  3. package/dist/assets/initConfig/templates/mjs.txt +1 -1
  4. package/dist/assets/initConfig/templates/ts.txt +1 -1
  5. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -2
  6. package/dist/cjs/_virtual/_utils_asset.cjs +2 -1
  7. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
  8. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +2 -1
  9. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
  10. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -1
  11. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +2 -1
  12. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -1
  13. package/dist/cjs/buildIntlayerDictionary/writeNestedDictionary.cjs.map +1 -1
  14. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +4 -2
  15. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -1
  16. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -1
  17. package/dist/cjs/cleanOutputDir.cjs.map +1 -1
  18. package/dist/cjs/cleanRemovedContentDeclaration.cjs +7 -4
  19. package/dist/cjs/cleanRemovedContentDeclaration.cjs.map +1 -1
  20. package/dist/cjs/cli.cjs +2 -0
  21. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +5 -3
  22. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
  23. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
  24. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -1
  25. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -1
  26. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -1
  27. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -1
  28. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -1
  29. package/dist/cjs/createType/createModuleAugmentation.cjs +2 -1
  30. package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -1
  31. package/dist/cjs/createType/createType.cjs.map +1 -1
  32. package/dist/cjs/detectFormatCommand.cjs.map +1 -1
  33. package/dist/cjs/docReview/alignBlocks.cjs +1 -1
  34. package/dist/cjs/docReview/alignBlocks.cjs.map +1 -1
  35. package/dist/cjs/docReview/computeSimilarity.cjs +0 -1
  36. package/dist/cjs/docReview/computeSimilarity.cjs.map +1 -1
  37. package/dist/cjs/docReview/mapChangedLinesToBlocks.cjs +0 -1
  38. package/dist/cjs/docReview/mapChangedLinesToBlocks.cjs.map +1 -1
  39. package/dist/cjs/docReview/normalizeBlock.cjs +0 -1
  40. package/dist/cjs/docReview/normalizeBlock.cjs.map +1 -1
  41. package/dist/cjs/docReview/planActions.cjs +0 -1
  42. package/dist/cjs/docReview/planActions.cjs.map +1 -1
  43. package/dist/cjs/docReview/rebuildDocument.cjs +0 -1
  44. package/dist/cjs/docReview/rebuildDocument.cjs.map +1 -1
  45. package/dist/cjs/docReview/reviewReport.cjs +2 -1
  46. package/dist/cjs/docReview/reviewReport.cjs.map +1 -1
  47. package/dist/cjs/docReview/segmentDocument.cjs +0 -1
  48. package/dist/cjs/docReview/segmentDocument.cjs.map +1 -1
  49. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  50. package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
  51. package/dist/cjs/formatDictionary.cjs.map +1 -1
  52. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -1
  53. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +4 -2
  54. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -1
  55. package/dist/cjs/handleContentDeclarationFileChange.cjs +6 -2
  56. package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -1
  57. package/dist/cjs/handleContentDeclarationFileMoved.cjs.map +1 -1
  58. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +4 -2
  59. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -1
  60. package/dist/cjs/init/cms.cjs.map +1 -1
  61. package/dist/cjs/init/frameworkSetup/nextAppRouter/detect.cjs.map +1 -1
  62. package/dist/cjs/init/frameworkSetup/nextAppRouter/index.cjs +1 -3
  63. package/dist/cjs/init/frameworkSetup/nextAppRouter/index.cjs.map +1 -1
  64. package/dist/cjs/init/frameworkSetup/nextAppRouter/restructure.cjs +2 -1
  65. package/dist/cjs/init/frameworkSetup/nextAppRouter/restructure.cjs.map +1 -1
  66. package/dist/cjs/init/frameworkSetup/nextAppRouter/templates.cjs +0 -1
  67. package/dist/cjs/init/frameworkSetup/nextAppRouter/templates.cjs.map +1 -1
  68. package/dist/cjs/init/frameworkSetup/tanstackStart/detect.cjs.map +1 -1
  69. package/dist/cjs/init/frameworkSetup/tanstackStart/index.cjs +3 -5
  70. package/dist/cjs/init/frameworkSetup/tanstackStart/index.cjs.map +1 -1
  71. package/dist/cjs/init/frameworkSetup/tanstackStart/restructure.cjs +2 -1
  72. package/dist/cjs/init/frameworkSetup/tanstackStart/restructure.cjs.map +1 -1
  73. package/dist/cjs/init/frameworkSetup/tanstackStart/templates.cjs +18 -12
  74. package/dist/cjs/init/frameworkSetup/tanstackStart/templates.cjs.map +1 -1
  75. package/dist/cjs/init/frameworkSetup/tanstackStart/transforms.cjs +57 -14
  76. package/dist/cjs/init/frameworkSetup/tanstackStart/transforms.cjs.map +1 -1
  77. package/dist/cjs/init/index.cjs +124 -45
  78. package/dist/cjs/init/index.cjs.map +1 -1
  79. package/dist/cjs/init/utils/configManipulation.cjs.map +1 -1
  80. package/dist/cjs/init/utils/fileSystem.cjs +3 -1
  81. package/dist/cjs/init/utils/fileSystem.cjs.map +1 -1
  82. package/dist/cjs/init/utils/githubActions.cjs.map +1 -1
  83. package/dist/cjs/init/utils/index.cjs +3 -0
  84. package/dist/cjs/init/utils/jsonParser.cjs +0 -1
  85. package/dist/cjs/init/utils/jsonParser.cjs.map +1 -1
  86. package/dist/cjs/init/utils/nextCompilerBabel.cjs.map +1 -1
  87. package/dist/cjs/init/utils/packageManager.cjs +105 -7
  88. package/dist/cjs/init/utils/packageManager.cjs.map +1 -1
  89. package/dist/cjs/init/utils/tsConfig.cjs.map +1 -1
  90. package/dist/cjs/init/utils/version.cjs +0 -1
  91. package/dist/cjs/init/utils/version.cjs.map +1 -1
  92. package/dist/cjs/initConfig/index.cjs +12 -8
  93. package/dist/cjs/initConfig/index.cjs.map +1 -1
  94. package/dist/cjs/installSkills/index.cjs.map +1 -1
  95. package/dist/cjs/listDictionariesPath.cjs +6 -5
  96. package/dist/cjs/listDictionariesPath.cjs.map +1 -1
  97. package/dist/cjs/listGitFiles.cjs.map +1 -1
  98. package/dist/cjs/listProjects.cjs +2 -1
  99. package/dist/cjs/listProjects.cjs.map +1 -1
  100. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +2 -1
  101. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -1
  102. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +8 -5
  103. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  104. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  105. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
  106. package/dist/cjs/loadDictionaries/loadMarkdownContentDeclaration.cjs.map +1 -1
  107. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
  108. package/dist/cjs/loadDictionaries/loadYamlContentDeclaration.cjs +2 -1
  109. package/dist/cjs/loadDictionaries/loadYamlContentDeclaration.cjs.map +1 -1
  110. package/dist/cjs/loadDictionaries/log.cjs +10 -6
  111. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  112. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs.map +1 -1
  113. package/dist/cjs/logConfigDetails.cjs +4 -3
  114. package/dist/cjs/logConfigDetails.cjs.map +1 -1
  115. package/dist/cjs/prepareIntlayer.cjs +5 -3
  116. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  117. package/dist/cjs/reduceDictionaryContent/applyMask.cjs +0 -1
  118. package/dist/cjs/reduceDictionaryContent/applyMask.cjs.map +1 -1
  119. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +2 -1
  120. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
  121. package/dist/cjs/scan/calculateScore.cjs +0 -1
  122. package/dist/cjs/scan/calculateScore.cjs.map +1 -1
  123. package/dist/cjs/scan/checks.cjs +1 -1
  124. package/dist/cjs/scan/checks.cjs.map +1 -1
  125. package/dist/cjs/scan/parseHtml.cjs +0 -1
  126. package/dist/cjs/scan/parseHtml.cjs.map +1 -1
  127. package/dist/cjs/scan/scanWebsite.cjs.map +1 -1
  128. package/dist/cjs/syncPluginKit/createFileAdapter.cjs +2 -1
  129. package/dist/cjs/syncPluginKit/createFileAdapter.cjs.map +1 -1
  130. package/dist/cjs/syncPluginKit/createSyncPlugin.cjs +4 -1
  131. package/dist/cjs/syncPluginKit/createSyncPlugin.cjs.map +1 -1
  132. package/dist/cjs/syncPluginKit/extractKeyAndLocaleFromPath.cjs +0 -1
  133. package/dist/cjs/syncPluginKit/extractKeyAndLocaleFromPath.cjs.map +1 -1
  134. package/dist/cjs/syncPluginKit/filePathPatternHelpers.cjs +0 -1
  135. package/dist/cjs/syncPluginKit/filePathPatternHelpers.cjs.map +1 -1
  136. package/dist/cjs/utils/autoDecorateContent.cjs.map +1 -1
  137. package/dist/cjs/utils/babelParser.cjs.map +1 -1
  138. package/dist/cjs/utils/buildComponentFilesList.cjs.map +1 -1
  139. package/dist/cjs/utils/buildFilesList.cjs.map +1 -1
  140. package/dist/cjs/utils/chunkArray.cjs +0 -1
  141. package/dist/cjs/utils/chunkArray.cjs.map +1 -1
  142. package/dist/cjs/utils/formatter.cjs.map +1 -1
  143. package/dist/cjs/utils/getContentExtension.cjs +1 -4
  144. package/dist/cjs/utils/getContentExtension.cjs.map +1 -1
  145. package/dist/cjs/utils/getFormatFromExtension.cjs +0 -1
  146. package/dist/cjs/utils/getFormatFromExtension.cjs.map +1 -1
  147. package/dist/cjs/utils/getPathHash.cjs +0 -1
  148. package/dist/cjs/utils/getPathHash.cjs.map +1 -1
  149. package/dist/cjs/utils/mergeChunks.cjs +0 -1
  150. package/dist/cjs/utils/mergeChunks.cjs.map +1 -1
  151. package/dist/cjs/utils/pLimit.cjs +0 -1
  152. package/dist/cjs/utils/pLimit.cjs.map +1 -1
  153. package/dist/cjs/utils/readDictionariesFromDisk.cjs.map +1 -1
  154. package/dist/cjs/utils/reduceObjectFormat.cjs +0 -1
  155. package/dist/cjs/utils/reduceObjectFormat.cjs.map +1 -1
  156. package/dist/cjs/utils/resolveObjectPromises.cjs +0 -1
  157. package/dist/cjs/utils/resolveObjectPromises.cjs.map +1 -1
  158. package/dist/cjs/utils/resolveRelativePath.cjs +4 -1
  159. package/dist/cjs/utils/resolveRelativePath.cjs.map +1 -1
  160. package/dist/cjs/utils/runOnce.cjs +2 -2
  161. package/dist/cjs/utils/runOnce.cjs.map +1 -1
  162. package/dist/cjs/utils/runParallel/bin.cjs.map +1 -1
  163. package/dist/cjs/utils/runParallel/bootstrap.cjs +0 -1
  164. package/dist/cjs/utils/runParallel/bootstrap.cjs.map +1 -1
  165. package/dist/cjs/utils/runParallel/index.cjs.map +1 -1
  166. package/dist/cjs/utils/runParallel/spawnPosix.cjs.map +1 -1
  167. package/dist/cjs/utils/runParallel/spawnWin32.cjs.map +1 -1
  168. package/dist/cjs/utils/sortAlphabetically.cjs +0 -1
  169. package/dist/cjs/utils/sortAlphabetically.cjs.map +1 -1
  170. package/dist/cjs/utils/splitTextByLine.cjs +0 -1
  171. package/dist/cjs/utils/splitTextByLine.cjs.map +1 -1
  172. package/dist/cjs/utils/verifyIdenticObjectFormat.cjs +0 -1
  173. package/dist/cjs/utils/verifyIdenticObjectFormat.cjs.map +1 -1
  174. package/dist/cjs/watcher.cjs +4 -2
  175. package/dist/cjs/watcher.cjs.map +1 -1
  176. package/dist/cjs/writeConfiguration/index.cjs +2 -1
  177. package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
  178. package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs +0 -1
  179. package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs.map +1 -1
  180. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -1
  181. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +26 -23
  182. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
  183. package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs +6 -5
  184. package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs.map +1 -1
  185. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +9 -3
  186. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  187. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +2 -1
  188. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
  189. package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs +2 -1
  190. package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs.map +1 -1
  191. package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs +4 -2
  192. package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs.map +1 -1
  193. package/dist/cjs/writeFileIfChanged.cjs.map +1 -1
  194. package/dist/esm/_virtual/_utils_asset.mjs +2 -1
  195. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +2 -1
  196. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs.map +1 -1
  197. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +2 -1
  198. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs.map +1 -1
  199. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +4 -2
  200. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs.map +1 -1
  201. package/dist/esm/cleanRemovedContentDeclaration.mjs +7 -4
  202. package/dist/esm/cleanRemovedContentDeclaration.mjs.map +1 -1
  203. package/dist/esm/cli.mjs +2 -2
  204. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +5 -3
  205. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs.map +1 -1
  206. package/dist/esm/createType/createModuleAugmentation.mjs +2 -1
  207. package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -1
  208. package/dist/esm/docReview/alignBlocks.mjs +1 -1
  209. package/dist/esm/docReview/alignBlocks.mjs.map +1 -1
  210. package/dist/esm/docReview/reviewReport.mjs +2 -1
  211. package/dist/esm/docReview/reviewReport.mjs.map +1 -1
  212. package/dist/esm/handleAdditionalContentDeclarationFile.mjs +4 -2
  213. package/dist/esm/handleAdditionalContentDeclarationFile.mjs.map +1 -1
  214. package/dist/esm/handleContentDeclarationFileChange.mjs +6 -2
  215. package/dist/esm/handleContentDeclarationFileChange.mjs.map +1 -1
  216. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +4 -2
  217. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs.map +1 -1
  218. package/dist/esm/init/frameworkSetup/nextAppRouter/index.mjs +1 -3
  219. package/dist/esm/init/frameworkSetup/nextAppRouter/index.mjs.map +1 -1
  220. package/dist/esm/init/frameworkSetup/nextAppRouter/restructure.mjs +2 -1
  221. package/dist/esm/init/frameworkSetup/nextAppRouter/restructure.mjs.map +1 -1
  222. package/dist/esm/init/frameworkSetup/tanstackStart/index.mjs +4 -6
  223. package/dist/esm/init/frameworkSetup/tanstackStart/index.mjs.map +1 -1
  224. package/dist/esm/init/frameworkSetup/tanstackStart/restructure.mjs +2 -1
  225. package/dist/esm/init/frameworkSetup/tanstackStart/restructure.mjs.map +1 -1
  226. package/dist/esm/init/frameworkSetup/tanstackStart/templates.mjs +17 -10
  227. package/dist/esm/init/frameworkSetup/tanstackStart/templates.mjs.map +1 -1
  228. package/dist/esm/init/frameworkSetup/tanstackStart/transforms.mjs +58 -15
  229. package/dist/esm/init/frameworkSetup/tanstackStart/transforms.mjs.map +1 -1
  230. package/dist/esm/init/index.mjs +125 -46
  231. package/dist/esm/init/index.mjs.map +1 -1
  232. package/dist/esm/init/utils/configManipulation.mjs.map +1 -1
  233. package/dist/esm/init/utils/fileSystem.mjs +3 -1
  234. package/dist/esm/init/utils/fileSystem.mjs.map +1 -1
  235. package/dist/esm/init/utils/index.mjs +2 -2
  236. package/dist/esm/init/utils/packageManager.mjs +103 -8
  237. package/dist/esm/init/utils/packageManager.mjs.map +1 -1
  238. package/dist/esm/initConfig/index.mjs +12 -8
  239. package/dist/esm/initConfig/index.mjs.map +1 -1
  240. package/dist/esm/listDictionariesPath.mjs +6 -5
  241. package/dist/esm/listDictionariesPath.mjs.map +1 -1
  242. package/dist/esm/listProjects.mjs +2 -1
  243. package/dist/esm/listProjects.mjs.map +1 -1
  244. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +2 -1
  245. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -1
  246. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +8 -5
  247. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
  248. package/dist/esm/loadDictionaries/loadYamlContentDeclaration.mjs +2 -1
  249. package/dist/esm/loadDictionaries/loadYamlContentDeclaration.mjs.map +1 -1
  250. package/dist/esm/loadDictionaries/log.mjs +10 -6
  251. package/dist/esm/loadDictionaries/log.mjs.map +1 -1
  252. package/dist/esm/logConfigDetails.mjs +4 -3
  253. package/dist/esm/logConfigDetails.mjs.map +1 -1
  254. package/dist/esm/prepareIntlayer.mjs +5 -3
  255. package/dist/esm/prepareIntlayer.mjs.map +1 -1
  256. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs +2 -1
  257. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -1
  258. package/dist/esm/scan/checks.mjs +1 -1
  259. package/dist/esm/scan/checks.mjs.map +1 -1
  260. package/dist/esm/syncPluginKit/createFileAdapter.mjs +2 -1
  261. package/dist/esm/syncPluginKit/createFileAdapter.mjs.map +1 -1
  262. package/dist/esm/syncPluginKit/createSyncPlugin.mjs +4 -1
  263. package/dist/esm/syncPluginKit/createSyncPlugin.mjs.map +1 -1
  264. package/dist/esm/utils/babelParser.mjs.map +1 -1
  265. package/dist/esm/utils/getContentExtension.mjs +1 -3
  266. package/dist/esm/utils/getContentExtension.mjs.map +1 -1
  267. package/dist/esm/utils/resolveRelativePath.mjs +4 -1
  268. package/dist/esm/utils/resolveRelativePath.mjs.map +1 -1
  269. package/dist/esm/utils/runOnce.mjs +2 -2
  270. package/dist/esm/utils/runOnce.mjs.map +1 -1
  271. package/dist/esm/watcher.mjs +4 -2
  272. package/dist/esm/watcher.mjs.map +1 -1
  273. package/dist/esm/writeConfiguration/index.mjs +2 -1
  274. package/dist/esm/writeConfiguration/index.mjs.map +1 -1
  275. package/dist/esm/writeContentDeclaration/transformJSFile.mjs +26 -23
  276. package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -1
  277. package/dist/esm/writeContentDeclaration/transformJSONFile.mjs +6 -5
  278. package/dist/esm/writeContentDeclaration/transformJSONFile.mjs.map +1 -1
  279. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +9 -3
  280. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
  281. package/dist/esm/writeContentDeclaration/writeJSFile.mjs +2 -1
  282. package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
  283. package/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs +2 -1
  284. package/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs.map +1 -1
  285. package/dist/esm/writeContentDeclaration/writeYamlFile.mjs +4 -2
  286. package/dist/esm/writeContentDeclaration/writeYamlFile.mjs.map +1 -1
  287. package/dist/types/cli.d.ts +2 -2
  288. package/dist/types/init/frameworkSetup/tanstackStart/templates.d.ts +9 -4
  289. package/dist/types/init/frameworkSetup/tanstackStart/templates.d.ts.map +1 -1
  290. package/dist/types/init/frameworkSetup/tanstackStart/transforms.d.ts +6 -2
  291. package/dist/types/init/frameworkSetup/tanstackStart/transforms.d.ts.map +1 -1
  292. package/dist/types/init/index.d.ts +2 -7
  293. package/dist/types/init/index.d.ts.map +1 -1
  294. package/dist/types/init/utils/index.d.ts +2 -2
  295. package/dist/types/init/utils/packageManager.d.ts +39 -6
  296. package/dist/types/init/utils/packageManager.d.ts.map +1 -1
  297. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"transforms.mjs","names":[],"sources":["../../../../../src/init/frameworkSetup/tanstackStart/transforms.ts"],"sourcesContent":["import * as recast from 'recast';\nimport { babelTsParser } from '../../../utils/babelParser';\nimport { ensureNamedImport } from '../../utils/astImports';\n\nconst { builders: b, namedTypes: n } = recast.types;\n\n/** babel-ts parser handles TypeScript *and* JSX. */\nconst parseTsx = (code: string): any =>\n recast.parse(code, { parser: babelTsParser });\n\n/** Result of a source transform. `code` is unchanged for any non-`wrapped` status. */\nexport type TransformResult = {\n code: string;\n status: 'wrapped' | 'already' | 'skipped';\n};\n\n/**\n * Finds the single function that returns the `<html>` document element. Returns\n * `null` when there is no such function, or more than one (ambiguous).\n */\nconst findHtmlDocumentFunction = (ast: any): any => {\n const found = new Set<any>();\n\n recast.visit(ast, {\n visitJSXOpeningElement(path) {\n const node = path.node;\n if (node.name?.type === 'JSXIdentifier' && node.name.name === 'html') {\n // Walk up to the nearest enclosing function node.\n let current = path.parentPath;\n while (current) {\n const value = current.value;\n if (\n value &&\n (n.FunctionDeclaration.check(value) ||\n n.FunctionExpression.check(value) ||\n n.ArrowFunctionExpression.check(value))\n ) {\n found.add(value);\n break;\n }\n current = current.parentPath;\n }\n }\n this.traverse(path);\n },\n });\n\n return found.size === 1 ? [...found][0] : null;\n};\n\n/**\n * Whether the binding pattern `node` introduces a variable named `name`.\n * Recurses through destructuring patterns so all of `const locale`,\n * `const { locale } = …`, `const { locale = fallback } = …`,\n * `const { foo: locale } = …`, `const [locale] = …` and `...locale` are\n * detected — not just a bare identifier.\n */\nconst patternBindsName = (node: any, name: string): boolean => {\n if (!node) return false;\n switch (node.type) {\n case 'Identifier':\n return node.name === name;\n case 'AssignmentPattern':\n // `locale = fallback`\n return patternBindsName(node.left, name);\n case 'RestElement':\n // `...locale`\n return patternBindsName(node.argument, name);\n case 'ArrayPattern':\n return node.elements.some((element: any) =>\n patternBindsName(element, name)\n );\n case 'ObjectPattern':\n return node.properties.some((property: any) =>\n property.type === 'RestElement'\n ? patternBindsName(property.argument, name)\n : // The *value* is the binding target (`{ foo: locale }` binds `locale`).\n patternBindsName(property.value, name)\n );\n default:\n return false;\n }\n};\n\n/**\n * Inserts `const locale = …` once, at the top of the function body. A single\n * self-contained statement is used (rather than an intermediate `params` const)\n * so it can never collide with a `params` variable the document already\n * declares. Expression-bodied arrow functions are first converted to a block so\n * the declaration has somewhere to live.\n *\n * No-ops when `locale` is already bound in the function — whether as a simple\n * identifier, through a destructuring pattern (e.g.\n * `const { locale = defaultLocale } = useLoaderData()`), or as a function\n * parameter — so the injected declaration never collides with one the document\n * already provides (which would produce an\n * `Identifier 'locale' has already been declared` parse error).\n */\nconst ensureLocaleFromParams = (funcNode: any): void => {\n if (funcNode.body?.type !== 'BlockStatement') {\n funcNode.body = b.blockStatement([b.returnStatement(funcNode.body)]);\n }\n\n const declaredInBody = funcNode.body.body.some(\n (stmt: any) =>\n stmt.type === 'VariableDeclaration' &&\n stmt.declarations.some((d: any) => patternBindsName(d.id, 'locale'))\n );\n const declaredInParams = (funcNode.params ?? []).some((param: any) =>\n patternBindsName(param, 'locale')\n );\n if (declaredInBody || declaredInParams) return;\n\n const statement = parseTsx(\n 'const locale = useParams({ strict: false }).locale ?? defaultLocale;'\n ).program.body[0];\n funcNode.body.body.unshift(statement);\n};\n\n/** Sets `lang={locale}` and `dir={getHTMLTextDir(locale)}` on the first `<html>` element. */\nconst setHtmlLangAndDir = (ast: any): void => {\n recast.visit(ast, {\n visitJSXOpeningElement(path) {\n const node = path.node;\n if (node.name?.type !== 'JSXIdentifier' || node.name.name !== 'html') {\n this.traverse(path);\n return;\n }\n\n const upsertAttribute = (name: string, value: any): void => {\n const existing = node.attributes?.find(\n (attr: any) =>\n attr.type === 'JSXAttribute' && attr.name?.name === name\n ) as any;\n if (existing) {\n existing.value = value;\n } else {\n node.attributes?.push(b.jsxAttribute(b.jsxIdentifier(name), value));\n }\n };\n\n upsertAttribute('lang', b.jsxExpressionContainer(b.identifier('locale')));\n upsertAttribute(\n 'dir',\n b.jsxExpressionContainer(\n b.callExpression(b.identifier('getHTMLTextDir'), [\n b.identifier('locale'),\n ])\n )\n );\n return false;\n },\n });\n};\n\n/**\n * Wraps the `{children}` of a TanStack Start root document with\n * `IntlayerProvider`, deriving the locale from the `{-$locale}` route param.\n * Safe and idempotent: bails (returns the original code) when the provider is\n * already present, when no `<html>` document function is found, or when there is\n * no `{children}` placeholder to wrap.\n */\nexport const wrapRootWithProvider = (code: string): TransformResult => {\n const ast = parseTsx(code);\n\n if (code.includes('IntlayerProvider')) return { code, status: 'already' };\n\n const funcNode = findHtmlDocumentFunction(ast);\n if (!funcNode) return { code, status: 'skipped' };\n\n let wrapped = false;\n recast.visit(funcNode, {\n visitJSXExpressionContainer(path) {\n if (wrapped) return false;\n const expression = path.node.expression;\n if (expression?.type === 'Identifier' && expression.name === 'children') {\n const template = parseTsx(\n 'const __wrap = <IntlayerProvider locale={locale}>{__child__}</IntlayerProvider>;'\n );\n const providerElement = template.program.body[0].declarations[0].init;\n providerElement.children = [path.node];\n path.replace(providerElement);\n wrapped = true;\n return false;\n }\n this.traverse(path);\n },\n });\n\n if (!wrapped) return { code, status: 'skipped' };\n\n ensureNamedImport(ast, 'IntlayerProvider', 'react-intlayer');\n ensureNamedImport(ast, 'useParams', '@tanstack/react-router');\n ensureNamedImport(ast, 'defaultLocale', 'intlayer');\n ensureNamedImport(ast, 'getHTMLTextDir', 'intlayer');\n ensureLocaleFromParams(funcNode);\n setHtmlLangAndDir(ast);\n\n return { code: recast.print(ast).code, status: 'wrapped' };\n};\n"],"mappings":";;;;;AAIA,MAAM,EAAE,UAAU,GAAG,YAAY,MAAM,OAAO;;AAG9C,MAAM,YAAY,SAChB,OAAO,MAAM,MAAM,EAAE,QAAQ,cAAc,CAAC;;;;;AAY9C,MAAM,4BAA4B,QAAkB;CAClD,MAAM,wBAAQ,IAAI,IAAS;CAE3B,OAAO,MAAM,KAAK,EAChB,uBAAuB,MAAM;EAC3B,MAAM,OAAO,KAAK;EAClB,IAAI,KAAK,MAAM,SAAS,mBAAmB,KAAK,KAAK,SAAS,QAAQ;GAEpE,IAAI,UAAU,KAAK;GACnB,OAAO,SAAS;IACd,MAAM,QAAQ,QAAQ;IACtB,IACE,UACC,EAAE,oBAAoB,MAAM,KAAK,KAChC,EAAE,mBAAmB,MAAM,KAAK,KAChC,EAAE,wBAAwB,MAAM,KAAK,IACvC;KACA,MAAM,IAAI,KAAK;KACf;IACF;IACA,UAAU,QAAQ;GACpB;EACF;EACA,KAAK,SAAS,IAAI;CACpB,EACF,CAAC;CAED,OAAO,MAAM,SAAS,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK;AAC5C;;;;;;;;AASA,MAAM,oBAAoB,MAAW,SAA0B;CAC7D,IAAI,CAAC,MAAM,OAAO;CAClB,QAAQ,KAAK,MAAb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3,"file":"transforms.mjs","names":[],"sources":["../../../../../src/init/frameworkSetup/tanstackStart/transforms.ts"],"sourcesContent":["import * as recast from 'recast';\nimport { babelTsParser } from '../../../utils/babelParser';\nimport {\n ensureNamedImport,\n firstInsertIndex,\n isModuleScopeBinding,\n} from '../../utils/astImports';\n\nconst { builders: b, namedTypes: n } = recast.types;\n\n/** Module-scope identifier bound to the locale route's typed API. */\nconst LOCALE_ROUTE_API_VARIABLE = 'localeRoute';\n\n/** babel-ts parser handles TypeScript *and* JSX. */\nconst parseTsx = (code: string): any =>\n recast.parse(code, { parser: babelTsParser });\n\n/** Result of a source transform. `code` is unchanged for any non-`wrapped` status. */\nexport type TransformResult = {\n code: string;\n status: 'wrapped' | 'already' | 'skipped';\n};\n\n/**\n * Finds the single function that returns the `<html>` document element. Returns\n * `null` when there is no such function, or more than one (ambiguous).\n */\nconst findHtmlDocumentFunction = (ast: any): any => {\n const found = new Set<any>();\n\n recast.visit(ast, {\n visitJSXOpeningElement(path) {\n const node = path.node;\n if (node.name?.type === 'JSXIdentifier' && node.name.name === 'html') {\n // Walk up to the nearest enclosing function node.\n let current = path.parentPath;\n while (current) {\n const value = current.value;\n if (\n value &&\n (n.FunctionDeclaration.check(value) ||\n n.FunctionExpression.check(value) ||\n n.ArrowFunctionExpression.check(value))\n ) {\n found.add(value);\n break;\n }\n current = current.parentPath;\n }\n }\n this.traverse(path);\n },\n });\n\n return found.size === 1 ? [...found][0] : null;\n};\n\n/**\n * Whether the binding pattern `node` introduces a variable named `name`.\n * Recurses through destructuring patterns so all of `const locale`,\n * `const { locale } = …`, `const { locale = fallback } = …`,\n * `const { foo: locale } = …`, `const [locale] = …` and `...locale` are\n * detected — not just a bare identifier.\n */\nconst patternBindsName = (node: any, name: string): boolean => {\n if (!node) return false;\n switch (node.type) {\n case 'Identifier':\n return node.name === name;\n case 'AssignmentPattern':\n // `locale = fallback`\n return patternBindsName(node.left, name);\n case 'RestElement':\n // `...locale`\n return patternBindsName(node.argument, name);\n case 'ArrayPattern':\n return node.elements.some((element: any) =>\n patternBindsName(element, name)\n );\n case 'ObjectPattern':\n return node.properties.some((property: any) =>\n property.type === 'RestElement'\n ? patternBindsName(property.argument, name)\n : // The *value* is the binding target (`{ foo: locale }` binds `locale`).\n patternBindsName(property.value, name)\n );\n default:\n return false;\n }\n};\n\n/**\n * Inserts `const { locale = defaultLocale } = localeRoute.useParams();` once, at\n * the top of the function body. The destructuring form binds only `locale`, so\n * it can never collide with a `params` variable the document already declares.\n * Expression-bodied arrow functions are first converted to a block so the\n * declaration has somewhere to live.\n *\n * No-ops when `locale` is already bound in the function — whether as a simple\n * identifier, through a destructuring pattern (e.g.\n * `const { locale = defaultLocale } = Route.useLoaderData()`), or as a function\n * parameter — so the injected declaration never collides with one the document\n * already provides (which would produce an\n * `Identifier 'locale' has already been declared` parse error).\n *\n * @returns `true` when the declaration was injected, `false` when the document\n * already binds `locale` itself. Callers use this to skip the imports and the\n * route API declaration the injected statement would have needed.\n */\nconst ensureLocaleFromParams = (funcNode: any): boolean => {\n if (funcNode.body?.type !== 'BlockStatement') {\n funcNode.body = b.blockStatement([b.returnStatement(funcNode.body)]);\n }\n\n const declaredInBody = funcNode.body.body.some(\n (stmt: any) =>\n stmt.type === 'VariableDeclaration' &&\n stmt.declarations.some((d: any) => patternBindsName(d.id, 'locale'))\n );\n const declaredInParams = (funcNode.params ?? []).some((param: any) =>\n patternBindsName(param, 'locale')\n );\n if (declaredInBody || declaredInParams) return false;\n\n const statement = parseTsx(\n `const { locale = defaultLocale } = ${LOCALE_ROUTE_API_VARIABLE}.useParams();`\n ).program.body[0];\n funcNode.body.body.unshift(statement);\n return true;\n};\n\n/**\n * Ensures the module-scope `const localeRoute = getRouteApi(\"/<segment>\");`\n * declaration the injected locale statement reads from, inserted right after the\n * import block.\n *\n * Referencing the locale route by id keeps the root document free of an import\n * of `<segment>/route` — importing a child route module from `__root` is\n * discouraged, since the generated route tree already imports the root.\n *\n * No-ops when `localeRoute` is already bound at module scope, reusing that\n * binding rather than redeclaring it (which would be a parse error).\n *\n * @returns `true` when the declaration was inserted, `false` when an existing\n * binding was reused.\n */\nconst ensureLocaleRouteApi = (ast: any, localeSegment: string): boolean => {\n if (isModuleScopeBinding(ast, LOCALE_ROUTE_API_VARIABLE)) return false;\n\n const declaration = parseTsx(\n `const ${LOCALE_ROUTE_API_VARIABLE} = getRouteApi(\"/${localeSegment}\");`\n ).program.body[0];\n ast.program.body.splice(firstInsertIndex(ast), 0, declaration);\n return true;\n};\n\n/**\n * Puts a blank line between the import block and the inserted route API\n * declaration — recast prints a spliced statement flush against the preceding\n * line, which reads as part of the imports.\n */\nconst separateRouteApiDeclaration = (printedCode: string): string =>\n printedCode.replace(\n new RegExp(\n `([^\\\\n])\\\\n(const ${LOCALE_ROUTE_API_VARIABLE} = getRouteApi\\\\()`\n ),\n '$1\\n\\n$2'\n );\n\n/** Sets `lang={locale}` and `dir={getHTMLTextDir(locale)}` on the first `<html>` element. */\nconst setHtmlLangAndDir = (ast: any): void => {\n recast.visit(ast, {\n visitJSXOpeningElement(path) {\n const node = path.node;\n if (node.name?.type !== 'JSXIdentifier' || node.name.name !== 'html') {\n this.traverse(path);\n return;\n }\n\n const upsertAttribute = (name: string, value: any): void => {\n const existing = node.attributes?.find(\n (attr: any) =>\n attr.type === 'JSXAttribute' && attr.name?.name === name\n ) as any;\n if (existing) {\n existing.value = value;\n } else {\n node.attributes?.push(b.jsxAttribute(b.jsxIdentifier(name), value));\n }\n };\n\n upsertAttribute('lang', b.jsxExpressionContainer(b.identifier('locale')));\n upsertAttribute(\n 'dir',\n b.jsxExpressionContainer(\n b.callExpression(b.identifier('getHTMLTextDir'), [\n b.identifier('locale'),\n ])\n )\n );\n return false;\n },\n });\n};\n\n/**\n * Wraps the `{children}` of a TanStack Start root document with\n * `IntlayerProvider`, deriving the locale from the locale segment route params.\n * Safe and idempotent: bails (returns the original code) when the provider is\n * already present, when no `<html>` document function is found, or when there is\n * no `{children}` placeholder to wrap.\n *\n * @param code Source of the project's `__root` document.\n * @param localeSegment Locale segment directory in use — `{-$locale}` for every\n * routing mode but `prefix-all`, which uses the required `$locale`.\n */\nexport const wrapRootWithProvider = (\n code: string,\n localeSegment: string\n): TransformResult => {\n const ast = parseTsx(code);\n\n if (code.includes('IntlayerProvider')) return { code, status: 'already' };\n\n const funcNode = findHtmlDocumentFunction(ast);\n if (!funcNode) return { code, status: 'skipped' };\n\n let wrapped = false;\n recast.visit(funcNode, {\n visitJSXExpressionContainer(path) {\n if (wrapped) return false;\n const expression = path.node.expression;\n if (expression?.type === 'Identifier' && expression.name === 'children') {\n const template = parseTsx(\n 'const __wrap = <IntlayerProvider locale={locale}>{__child__}</IntlayerProvider>;'\n );\n const providerElement = template.program.body[0].declarations[0].init;\n providerElement.children = [path.node];\n path.replace(providerElement);\n wrapped = true;\n return false;\n }\n this.traverse(path);\n },\n });\n\n if (!wrapped) return { code, status: 'skipped' };\n\n const injectedLocaleDeclaration = ensureLocaleFromParams(funcNode);\n\n ensureNamedImport(ast, 'IntlayerProvider', 'react-intlayer');\n // Only needed by the injected declaration: a document that already derives its\n // own `locale` must not be given unused imports or a stray route API const.\n let insertedRouteApi = false;\n if (injectedLocaleDeclaration) {\n ensureNamedImport(ast, 'getRouteApi', '@tanstack/react-router');\n ensureNamedImport(ast, 'defaultLocale', 'intlayer');\n insertedRouteApi = ensureLocaleRouteApi(ast, localeSegment);\n }\n ensureNamedImport(ast, 'getHTMLTextDir', 'intlayer');\n setHtmlLangAndDir(ast);\n\n const printedCode = recast.print(ast).code;\n\n return {\n code: insertedRouteApi\n ? separateRouteApiDeclaration(printedCode)\n : printedCode,\n status: 'wrapped',\n };\n};\n"],"mappings":";;;;;AAQA,MAAM,EAAE,UAAU,GAAG,YAAY,MAAM,OAAO;;AAG9C,MAAM,4BAA4B;;AAGlC,MAAM,YAAY,SAChB,OAAO,MAAM,MAAM,EAAE,QAAQ,cAAc,CAAC;;;;;AAY9C,MAAM,4BAA4B,QAAkB;CAClD,M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/index.mjs";
5
5
  import { isVersionAtLeast } from "./utils/version.mjs";
6
6
  import { setupFramework } from "./frameworkSetup/index.mjs";
7
- import { detectMissingIntlayerPackages, detectOutdatedIntlayerPackages, detectPackageManager, installPackages, upgradePackages } from "./utils/packageManager.mjs";
7
+ import { detectMissingIntlayerPackages, detectOutdatedIntlayerPackages, detectPackageManager, hasLintTooling, installPackages, upgradePackages } from "./utils/packageManager.mjs";
8
8
  import { getGithubWorkflows, resolveGithubWorkflowsContext } from "./utils/githubActions.mjs";
9
9
  import { parseJSONWithComments } from "./utils/jsonParser.mjs";
10
10
  import { setupNextCompilerBabelConfig } from "./utils/nextCompilerBabel.mjs";
@@ -32,17 +32,18 @@ const DocumentationRouter = {
32
32
  ViteAndSolid: "https://intlayer.org/doc/environment/vite-and-solid.md",
33
33
  ViteAndSvelte: "https://intlayer.org/doc/environment/vite-and-svelte.md",
34
34
  ViteAndPreact: "https://intlayer.org/doc/environment/vite-and-preact.md",
35
- TanStackRouter: "https://intlayer.org/doc/environment/tanstack.md",
35
+ TanStackRouter: "https://intlayer.org/doc/environment/tanstack-start.md",
36
36
  NuxtAndVue: "https://intlayer.org/doc/environment/nuxt-and-vue.md",
37
37
  Angular: "https://intlayer.org/doc/environment/angular.md",
38
38
  SvelteKit: "https://intlayer.org/doc/environment/sveltekit.md",
39
39
  ReactNativeAndExpo: "https://intlayer.org/doc/environment/react-native-and-expo.md",
40
40
  Lynx: "https://intlayer.org/doc/environment/lynx-and-react.md",
41
41
  Express: "https://intlayer.org/doc/environment/express.md",
42
- NestJS: "https://intlayer.org/doc/environment/nestjs.md",
42
+ NestJS: "https://intlayer.org/doc/environment/nest.md",
43
43
  Fastify: "https://intlayer.org/doc/environment/fastify.md",
44
44
  Default: "https://intlayer.org/doc/get-started",
45
45
  LSP: "https://intlayer.org/doc/lsp.md",
46
+ ESLint: "https://intlayer.org/doc/eslint.md",
46
47
  NextIntl: "https://intlayer.org/blog/intlayer-with-next-intl.md",
47
48
  ReactI18Next: "https://intlayer.org/blog/intlayer-with-react-i18next.md",
48
49
  ReactIntl: "https://intlayer.org/blog/intlayer-with-react-intl.md",
@@ -50,6 +51,26 @@ const DocumentationRouter = {
50
51
  VueI18n: "https://intlayer.org/blog/intlayer-with-vue-i18n.md"
51
52
  };
52
53
  /**
54
+ * The Intlayer lint setup, as `intlayer init` writes it into `.oxlintrc.json`.
55
+ *
56
+ * Declared locally on purpose: `@intlayer/engine` is installed by every Intlayer
57
+ * user, so it must not depend on a lint plugin to write a handful of strings
58
+ * into a JSON file. oxlint resolves a plugin's *rules* but not its shipped
59
+ * *configs*, so the preset cannot be referenced by name there either.
60
+ *
61
+ * Mirrors the `recommended` preset of `eslint-plugin-intlayer`; keep in sync
62
+ * when a rule is enabled by default there.
63
+ */
64
+ const LINT_PLUGIN_PACKAGE_NAME = "eslint-plugin-intlayer";
65
+ /** Intlayer's generated output — never source, never worth linting. */
66
+ const GENERATED_OUTPUT_GLOBS = ["**/.intlayer/**"];
67
+ /** Rules of the `recommended` preset, prefixed by the plugin namespace. */
68
+ const getRecommendedRules = () => ({
69
+ "intlayer/no-raw-text": "warn",
70
+ "intlayer/static-dictionary-key": "error",
71
+ "intlayer/no-dynamic-field-access": "error"
72
+ });
73
+ /**
53
74
  * Helper: Detects the environment and returns the doc URL
54
75
  */
55
76
  const getDocumentationUrl = (packageJson) => {
@@ -140,17 +161,13 @@ const initIntlayer = async (rootDir, options) => {
140
161
  ...packageJson.dependencies ?? {},
141
162
  ...packageJson.devDependencies ?? {}
142
163
  };
143
- const effectiveAllDeps = {
144
- ...allDeps,
145
- ...options?.hintDependencies ?? {}
146
- };
147
164
  const packageManager = detectPackageManager(rootDir);
148
- const linguiPresent = Boolean(effectiveAllDeps["@lingui/core"] || effectiveAllDeps["@lingui/react"] || effectiveAllDeps["@intlayer/lingui"]);
165
+ const linguiPresent = Boolean(allDeps["@lingui/core"] || allDeps["@lingui/react"] || allDeps["@intlayer/lingui"]);
149
166
  const linguiCatalog = linguiPresent ? await detectLinguiCatalogPattern(rootDir) : null;
150
- const hintLinguiJson = Boolean(options?.hintDependencies?.["__lingui_json__"]);
151
- const { packagesToInstall, devPackagesToInstall, compatSyncConfig, compatVitePluginConfig } = detectMissingIntlayerPackages(effectiveAllDeps, { linguiCatalogFormat: linguiCatalog?.format ?? (linguiPresent ? hintLinguiJson ? "json" : "po" : null) });
167
+ const linguiCatalogFormat = linguiCatalog?.format ?? (linguiPresent ? "po" : null);
168
+ const { packagesToInstall, devPackagesToInstall, compatSyncConfig, compatVitePluginConfig } = detectMissingIntlayerPackages(allDeps, { linguiCatalogFormat });
152
169
  const wantsJsonNamespaces = options?.contentStrategy === "json-namespaces" && !compatSyncConfig;
153
- if (wantsJsonNamespaces && !effectiveAllDeps["@intlayer/sync-json-plugin"] && !devPackagesToInstall.includes("@intlayer/sync-json-plugin")) devPackagesToInstall.push("@intlayer/sync-json-plugin");
170
+ if (wantsJsonNamespaces && !allDeps["@intlayer/sync-json-plugin"] && !devPackagesToInstall.includes("@intlayer/sync-json-plugin")) devPackagesToInstall.push("@intlayer/sync-json-plugin");
154
171
  if (!options?.noInstallPackages) {
155
172
  const withVersion = (packages) => options?.upgradeToVersion ? packages.map((pkg) => `${pkg}@${options.upgradeToVersion}`) : packages;
156
173
  if (packagesToInstall.length > 0) {
@@ -191,7 +208,8 @@ const initIntlayer = async (rootDir, options) => {
191
208
  if (!options?.noGitignore && await exists(rootDir, gitignorePath)) {
192
209
  const gitignoreContent = await readFileFromRoot(rootDir, gitignorePath);
193
210
  if (!gitignoreContent.includes("intlayer")) {
194
- await writeFileToRoot(rootDir, gitignorePath, `${gitignoreContent}\n# Intlayer\n.intlayer\n`);
211
+ const newContent = `${gitignoreContent}\n# Intlayer\n.intlayer\n`;
212
+ await writeFileToRoot(rootDir, gitignorePath, newContent);
195
213
  logger(`${v} Added ${colorizePath(".intlayer")} to ${colorizePath(gitignorePath)}`);
196
214
  } else logger(`${v} ${colorizePath(gitignorePath)} already includes .intlayer`);
197
215
  }
@@ -217,8 +235,10 @@ const initIntlayer = async (rootDir, options) => {
217
235
  const extensionId = "intlayer.intlayer-vs-code-extension";
218
236
  if (!options?.noVscodeExtension) try {
219
237
  let extensionsConfig = { recommendations: [] };
220
- if (await exists(rootDir, extensionsJsonPath)) extensionsConfig = parseJSONWithComments(await readFileFromRoot(rootDir, extensionsJsonPath));
221
- else await ensureDirectory(rootDir, vscodeDir);
238
+ if (await exists(rootDir, extensionsJsonPath)) {
239
+ const content = await readFileFromRoot(rootDir, extensionsJsonPath);
240
+ extensionsConfig = parseJSONWithComments(content);
241
+ } else await ensureDirectory(rootDir, vscodeDir);
222
242
  if (!extensionsConfig.recommendations) extensionsConfig.recommendations = [];
223
243
  if (!extensionsConfig.recommendations.includes(extensionId)) {
224
244
  extensionsConfig.recommendations.push(extensionId);
@@ -231,8 +251,10 @@ const initIntlayer = async (rootDir, options) => {
231
251
  const settingsJsonPath = join(vscodeDir, "settings.json");
232
252
  if (!options?.noLsp) try {
233
253
  let settingsConfig = {};
234
- if (await exists(rootDir, settingsJsonPath)) settingsConfig = parseJSONWithComments(await readFileFromRoot(rootDir, settingsJsonPath));
235
- else await ensureDirectory(rootDir, vscodeDir);
254
+ if (await exists(rootDir, settingsJsonPath)) {
255
+ const content = await readFileFromRoot(rootDir, settingsJsonPath);
256
+ settingsConfig = parseJSONWithComments(content);
257
+ } else await ensureDirectory(rootDir, vscodeDir);
236
258
  let settingsUpdated = false;
237
259
  if (!settingsConfig["intlayer.languageServer.command"]) {
238
260
  settingsConfig["intlayer.languageServer.command"] = "npx";
@@ -249,12 +271,48 @@ const initIntlayer = async (rootDir, options) => {
249
271
  } catch {
250
272
  logger(`${x} Could not update ${colorizePath(settingsJsonPath)}. You may need to add the LSP settings manually.`, { level: "warn" });
251
273
  }
274
+ if (!options?.noEslint && hasLintTooling(allDeps)) {
275
+ const oxlintConfigPath = ".oxlintrc.json";
276
+ if (await exists(rootDir, oxlintConfigPath)) try {
277
+ const content = await readFileFromRoot(rootDir, oxlintConfigPath);
278
+ const oxlintConfig = parseJSONWithComments(content);
279
+ oxlintConfig.jsPlugins ??= [];
280
+ oxlintConfig.rules ??= {};
281
+ oxlintConfig.ignorePatterns ??= [];
282
+ let oxlintUpdated = false;
283
+ for (const glob of GENERATED_OUTPUT_GLOBS) if (!oxlintConfig.ignorePatterns.includes(glob)) {
284
+ oxlintConfig.ignorePatterns.push(glob);
285
+ oxlintUpdated = true;
286
+ }
287
+ if (!oxlintConfig.jsPlugins.includes(LINT_PLUGIN_PACKAGE_NAME)) {
288
+ oxlintConfig.jsPlugins.push(LINT_PLUGIN_PACKAGE_NAME);
289
+ oxlintUpdated = true;
290
+ }
291
+ for (const [ruleName, severity] of Object.entries(getRecommendedRules())) if (!oxlintConfig.rules[ruleName]) {
292
+ oxlintConfig.rules[ruleName] = severity;
293
+ oxlintUpdated = true;
294
+ }
295
+ if (oxlintUpdated) {
296
+ await writeFileToRoot(rootDir, oxlintConfigPath, JSON.stringify(oxlintConfig, null, 2));
297
+ logger(`${v} Added the Intlayer lint rules to ${colorizePath(oxlintConfigPath)}`);
298
+ } else logger(`${v} ${colorizePath(oxlintConfigPath)} already includes the Intlayer lint rules`);
299
+ } catch {
300
+ logger(`${x} Could not update ${colorizePath(oxlintConfigPath)}. You may need to add ${colorize(LINT_PLUGIN_PACKAGE_NAME, ANSIColors.MAGENTA)} manually.`, { level: "warn" });
301
+ }
302
+ else logger([
303
+ colorize("Intlayer lint rules →", ANSIColors.MAGENTA),
304
+ colorize(`Add ${LINT_PLUGIN_PACKAGE_NAME} to your ESLint flat config to catch hardcoded text and dynamic calls the compiler cannot optimize:`, ANSIColors.GREY_LIGHT),
305
+ colorize(` import intlayer from '${LINT_PLUGIN_PACKAGE_NAME}';\n export default [...intlayer.configs.recommended];`, ANSIColors.GREY_LIGHT),
306
+ colorizePath(DocumentationRouter.ESLint)
307
+ ]);
308
+ }
252
309
  const tsConfigFiles = await findTsConfigFiles(rootDir);
253
310
  let hasTsConfig = false;
254
311
  for (const fileName of tsConfigFiles) if (await exists(rootDir, fileName)) {
255
312
  hasTsConfig = true;
256
313
  try {
257
- const config = parseJSONWithComments(await readFileFromRoot(rootDir, fileName));
314
+ const fileContent = await readFileFromRoot(rootDir, fileName);
315
+ const config = parseJSONWithComments(fileContent);
258
316
  const typeDefinition = "./.intlayer/**/*.ts";
259
317
  let updated = false;
260
318
  if (!config.include) {} else if (Array.isArray(config.include) && !config.include.some((pattern) => pattern.includes(".intlayer"))) {
@@ -298,7 +356,9 @@ const initIntlayer = async (rootDir, options) => {
298
356
  ]) if (await exists(rootDir, configFile)) {
299
357
  const configContent = await readFileFromRoot(rootDir, configFile);
300
358
  if (!configContent.includes(syncPluginPackage)) {
301
- await writeFileToRoot(rootDir, configFile, updateIntlayerConfigWithSyncPlugin(configContent, configFile.split(".").pop(), resolvedSyncConfig));
359
+ const extension = configFile.split(".").pop();
360
+ const updatedConfigContent = updateIntlayerConfigWithSyncPlugin(configContent, extension, resolvedSyncConfig);
361
+ await writeFileToRoot(rootDir, configFile, updatedConfigContent);
302
362
  logger(`${v} Updated ${colorizePath(configFile)} with ${syncPluginName} compat plugin`);
303
363
  } else logger(`${v} ${colorizePath(configFile)} already includes ${syncPluginName} plugin`);
304
364
  break;
@@ -318,15 +378,18 @@ const initIntlayer = async (rootDir, options) => {
318
378
  const { replacesVitePlugin } = compatVitePluginConfig;
319
379
  if (content.includes(compatVitePluginConfig.pluginPackageSource)) logger(`${v} ${colorizePath(file)} already includes ${compatVitePluginConfig.pluginPackageSource}`);
320
380
  else if (replacesVitePlugin && content.includes(replacesVitePlugin.fromPackageSource)) {
321
- await writeFileToRoot(rootDir, file, replaceViteConfigPluginImportSource(content, replacesVitePlugin.importName, replacesVitePlugin.fromPackageSource, compatVitePluginConfig.pluginPackageSource));
381
+ const updatedContent = replaceViteConfigPluginImportSource(content, replacesVitePlugin.importName, replacesVitePlugin.fromPackageSource, compatVitePluginConfig.pluginPackageSource);
382
+ await writeFileToRoot(rootDir, file, updatedContent);
322
383
  logger(`${v} Updated ${colorizePath(file)} to import ${replacesVitePlugin.importName} from ${compatVitePluginConfig.pluginPackageSource}`);
323
384
  } else {
324
- await writeFileToRoot(rootDir, file, updateViteConfigForCompatPlugin(content, extension, compatVitePluginConfig));
385
+ const updatedContent = updateViteConfigForCompatPlugin(content, extension, compatVitePluginConfig);
386
+ await writeFileToRoot(rootDir, file, updatedContent);
325
387
  logger(`${v} Updated ${colorizePath(file)} to include ${compatVitePluginConfig.pluginFunctionName} compat plugin`);
326
388
  }
327
389
  } else if (hasIntlayerVitePlugin(content)) logger(`${v} ${colorizePath(file)} already includes an Intlayer plugin`);
328
390
  else {
329
- await writeFileToRoot(rootDir, file, updateViteConfig(content, extension));
391
+ const updatedContent = updateViteConfig(content, extension);
392
+ await writeFileToRoot(rootDir, file, updatedContent);
330
393
  logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);
331
394
  }
332
395
  break;
@@ -342,20 +405,27 @@ const initIntlayer = async (rootDir, options) => {
342
405
  hasAliasConfiguration = true;
343
406
  const content = await readFileFromRoot(rootDir, file);
344
407
  const extension = file.split(".").pop();
345
- if (allDeps["next-i18next"]) if (!content.includes("@intlayer/next-i18next")) {
346
- await writeFileToRoot(rootDir, file, updateNextConfigForNextI18next(content, extension));
347
- logger(`${v} Updated ${colorizePath(file)} to include Intlayer next-i18next compat plugin`);
348
- } else logger(`${v} ${colorizePath(file)} already includes @intlayer/next-i18next`);
349
- else if (allDeps["next-intl"]) if (!content.includes("@intlayer/next-intl/plugin")) {
350
- await writeFileToRoot(rootDir, file, updateNextConfigForNextIntl(content, extension));
351
- logger(`${v} Updated ${colorizePath(file)} to include Intlayer next-intl compat plugin`);
352
- } else logger(`${v} ${colorizePath(file)} already includes @intlayer/next-intl/plugin`);
353
- else if (allDeps["next-translate"]) if (!content.includes("@intlayer/next-translate")) {
354
- await writeFileToRoot(rootDir, file, updateNextConfigForNextTranslate(content, extension));
355
- logger(`${v} Updated ${colorizePath(file)} to include Intlayer next-translate compat plugin`);
356
- } else logger(`${v} ${colorizePath(file)} already includes @intlayer/next-translate`);
357
- else if (!content.includes("next-intlayer")) {
358
- await writeFileToRoot(rootDir, file, updateNextConfig(content, extension));
408
+ if (allDeps["next-i18next"]) {
409
+ if (!content.includes("@intlayer/next-i18next")) {
410
+ const updatedContent = updateNextConfigForNextI18next(content, extension);
411
+ await writeFileToRoot(rootDir, file, updatedContent);
412
+ logger(`${v} Updated ${colorizePath(file)} to include Intlayer next-i18next compat plugin`);
413
+ } else logger(`${v} ${colorizePath(file)} already includes @intlayer/next-i18next`);
414
+ } else if (allDeps["next-intl"]) {
415
+ if (!content.includes("@intlayer/next-intl/plugin")) {
416
+ const updatedContent = updateNextConfigForNextIntl(content, extension);
417
+ await writeFileToRoot(rootDir, file, updatedContent);
418
+ logger(`${v} Updated ${colorizePath(file)} to include Intlayer next-intl compat plugin`);
419
+ } else logger(`${v} ${colorizePath(file)} already includes @intlayer/next-intl/plugin`);
420
+ } else if (allDeps["next-translate"]) {
421
+ if (!content.includes("@intlayer/next-translate")) {
422
+ const updatedContent = updateNextConfigForNextTranslate(content, extension);
423
+ await writeFileToRoot(rootDir, file, updatedContent);
424
+ logger(`${v} Updated ${colorizePath(file)} to include Intlayer next-translate compat plugin`);
425
+ } else logger(`${v} ${colorizePath(file)} already includes @intlayer/next-translate`);
426
+ } else if (!content.includes("next-intlayer")) {
427
+ const updatedContent = updateNextConfig(content, extension);
428
+ await writeFileToRoot(rootDir, file, updatedContent);
359
429
  logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);
360
430
  }
361
431
  break;
@@ -376,7 +446,9 @@ const initIntlayer = async (rootDir, options) => {
376
446
  if (file.startsWith("astro.config.")) {
377
447
  const content = await readFileFromRoot(rootDir, file);
378
448
  if (!content.includes("astro-intlayer")) {
379
- await writeFileToRoot(rootDir, file, updateAstroConfig(content, file.split(".").pop()));
449
+ const extension = file.split(".").pop();
450
+ const updatedContent = updateAstroConfig(content, extension);
451
+ await writeFileToRoot(rootDir, file, updatedContent);
380
452
  logger(`${v} Updated ${colorizePath(file)} to include Intlayer integration`);
381
453
  }
382
454
  }
@@ -385,12 +457,15 @@ const initIntlayer = async (rootDir, options) => {
385
457
  for (const file of ["nuxt.config.js", "nuxt.config.ts"]) if (await exists(rootDir, file)) {
386
458
  hasAliasConfiguration = true;
387
459
  const content = await readFileFromRoot(rootDir, file);
388
- if (allDeps["@nuxtjs/i18n"]) if (!content.includes("@intlayer/nuxtjs-i18n")) {
389
- await writeFileToRoot(rootDir, file, updateNuxtConfigForNuxtjsI18n(content));
390
- logger(`${v} Updated ${colorizePath(file)} to include @intlayer/nuxtjs-i18n module`);
391
- } else logger(`${v} ${colorizePath(file)} already includes @intlayer/nuxtjs-i18n`);
392
- else if (!content.includes("nuxt-intlayer")) {
393
- await writeFileToRoot(rootDir, file, updateNuxtConfig(content));
460
+ if (allDeps["@nuxtjs/i18n"]) {
461
+ if (!content.includes("@intlayer/nuxtjs-i18n")) {
462
+ const updatedContent = updateNuxtConfigForNuxtjsI18n(content);
463
+ await writeFileToRoot(rootDir, file, updatedContent);
464
+ logger(`${v} Updated ${colorizePath(file)} to include @intlayer/nuxtjs-i18n module`);
465
+ } else logger(`${v} ${colorizePath(file)} already includes @intlayer/nuxtjs-i18n`);
466
+ } else if (!content.includes("nuxt-intlayer")) {
467
+ const updatedContent = updateNuxtConfig(content);
468
+ await writeFileToRoot(rootDir, file, updatedContent);
394
469
  logger(`${v} Updated ${colorizePath(file)} to include Intlayer module`);
395
470
  }
396
471
  break;
@@ -412,7 +487,8 @@ const initIntlayer = async (rootDir, options) => {
412
487
  const content = await readFileFromRoot(rootDir, metroConfigFile);
413
488
  if (content.includes("react-native-intlayer")) logger(`${v} ${colorizePath(metroConfigFile)} already includes the Intlayer Metro plugin`);
414
489
  else {
415
- const updatedContent = updateMetroConfig(content, metroConfigFile.split(".").pop());
490
+ const extension = metroConfigFile.split(".").pop();
491
+ const updatedContent = updateMetroConfig(content, extension);
416
492
  if (updatedContent !== content) {
417
493
  await writeFileToRoot(rootDir, metroConfigFile, updatedContent);
418
494
  logger(`${v} Updated ${colorizePath(metroConfigFile)} to include the Intlayer Metro plugin`);
@@ -456,11 +532,13 @@ const initIntlayer = async (rootDir, options) => {
456
532
  ...backendIntlayerPackages
457
533
  ].some((pkg) => allDeps[pkg])) hasAliasConfiguration = true;
458
534
  if (!hasAliasConfiguration) {
459
- const aliases = getAlias({ configuration: getConfiguration({ baseDir: rootDir }) });
535
+ const configuration = getConfiguration({ baseDir: rootDir });
536
+ const aliases = getAlias({ configuration });
460
537
  if (hasTsConfig && tsConfigFiles.length > 0) {
461
538
  const tsConfigPath = tsConfigFiles.find((file) => file === "tsconfig.json") || tsConfigFiles[0];
462
539
  if (tsConfigPath) {
463
- const config = parseJSONWithComments(await readFileFromRoot(rootDir, tsConfigPath));
540
+ const tsConfigContent = await readFileFromRoot(rootDir, tsConfigPath);
541
+ const config = parseJSONWithComments(tsConfigContent);
464
542
  config.compilerOptions ??= {};
465
543
  config.compilerOptions.paths ??= {};
466
544
  let updated = false;
@@ -478,7 +556,8 @@ const initIntlayer = async (rootDir, options) => {
478
556
  } else {
479
557
  const jsConfigPath = "jsconfig.json";
480
558
  if (await exists(rootDir, jsConfigPath)) {
481
- const config = parseJSONWithComments(await readFileFromRoot(rootDir, jsConfigPath));
559
+ const jsConfigContent = await readFileFromRoot(rootDir, jsConfigPath);
560
+ const config = parseJSONWithComments(jsConfigContent);
482
561
  config.compilerOptions ??= {};
483
562
  config.compilerOptions.paths ??= {};
484
563
  let updated = false;