skuba 11.1.0-jest30-20250620003740 → 12.0.0-enforce-file-extensions-20250618112549

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 (421) hide show
  1. package/jest/moduleNameMapper.js +4 -1
  2. package/jest/transform.js +15 -1
  3. package/jest-preset.js +7 -4
  4. package/lib/api/buildkite/annotate.js +2 -2
  5. package/lib/api/buildkite/annotate.js.map +1 -1
  6. package/lib/api/buildkite/index.d.ts +3 -3
  7. package/lib/api/buildkite/index.js +2 -2
  8. package/lib/api/buildkite/index.js.map +1 -1
  9. package/lib/api/git/commitAllChanges.d.ts +2 -2
  10. package/lib/api/git/commitAllChanges.js +3 -3
  11. package/lib/api/git/commitAllChanges.js.map +1 -1
  12. package/lib/api/git/getChangedFiles.js +1 -1
  13. package/lib/api/git/getChangedFiles.js.map +1 -1
  14. package/lib/api/git/index.d.ts +12 -12
  15. package/lib/api/git/index.js +11 -11
  16. package/lib/api/git/index.js.map +1 -1
  17. package/lib/api/git/pull.js +2 -2
  18. package/lib/api/git/pull.js.map +1 -1
  19. package/lib/api/git/push.js +2 -2
  20. package/lib/api/git/push.js.map +1 -1
  21. package/lib/api/git/reset.js +1 -1
  22. package/lib/api/git/reset.js.map +1 -1
  23. package/lib/api/github/checkRun.js +4 -4
  24. package/lib/api/github/checkRun.js.map +1 -1
  25. package/lib/api/github/environment.js +1 -1
  26. package/lib/api/github/environment.js.map +1 -1
  27. package/lib/api/github/index.d.ts +7 -7
  28. package/lib/api/github/index.js +6 -6
  29. package/lib/api/github/index.js.map +1 -1
  30. package/lib/api/github/issueComment.js +4 -4
  31. package/lib/api/github/issueComment.js.map +1 -1
  32. package/lib/api/github/pullRequest.js +3 -3
  33. package/lib/api/github/pullRequest.js.map +1 -1
  34. package/lib/api/github/push.d.ts +1 -1
  35. package/lib/api/github/push.js +3 -3
  36. package/lib/api/github/push.js.map +1 -1
  37. package/lib/api/jest/index.js +2 -2
  38. package/lib/api/jest/index.js.map +1 -1
  39. package/lib/api/net/compose.js +1 -1
  40. package/lib/api/net/compose.js.map +1 -1
  41. package/lib/api/net/index.d.ts +1 -1
  42. package/lib/api/net/index.js +1 -1
  43. package/lib/api/net/index.js.map +1 -1
  44. package/lib/api/net/waitFor.d.ts +1 -1
  45. package/lib/api/net/waitFor.js +2 -2
  46. package/lib/api/net/waitFor.js.map +1 -1
  47. package/lib/cli/adapter/eslint.d.ts +1 -1
  48. package/lib/cli/adapter/eslint.js +1 -1
  49. package/lib/cli/adapter/eslint.js.map +1 -1
  50. package/lib/cli/adapter/prettier.d.ts +1 -1
  51. package/lib/cli/adapter/prettier.js +4 -4
  52. package/lib/cli/adapter/prettier.js.map +2 -2
  53. package/lib/cli/build/assets.d.ts +1 -1
  54. package/lib/cli/build/assets.js +4 -4
  55. package/lib/cli/build/assets.js.map +1 -1
  56. package/lib/cli/build/esbuild.js +3 -3
  57. package/lib/cli/build/esbuild.js.map +1 -1
  58. package/lib/cli/build/index.js +6 -6
  59. package/lib/cli/build/index.js.map +1 -1
  60. package/lib/cli/build/tsc.d.ts +1 -1
  61. package/lib/cli/build/tsc.js +2 -2
  62. package/lib/cli/build/tsc.js.map +1 -1
  63. package/lib/cli/buildPackage/index.js +3 -3
  64. package/lib/cli/buildPackage/index.js.map +1 -1
  65. package/lib/cli/configure/analyseConfiguration.d.ts +2 -2
  66. package/lib/cli/configure/analyseConfiguration.js +2 -2
  67. package/lib/cli/configure/analyseConfiguration.js.map +1 -1
  68. package/lib/cli/configure/analyseDependencies.d.ts +1 -1
  69. package/lib/cli/configure/analyseDependencies.js +6 -6
  70. package/lib/cli/configure/analyseDependencies.js.map +1 -1
  71. package/lib/cli/configure/analysis/files.js +1 -1
  72. package/lib/cli/configure/analysis/files.js.map +1 -1
  73. package/lib/cli/configure/analysis/git.js +2 -2
  74. package/lib/cli/configure/analysis/git.js.map +1 -1
  75. package/lib/cli/configure/analysis/package.d.ts +1 -1
  76. package/lib/cli/configure/analysis/package.js +2 -2
  77. package/lib/cli/configure/analysis/package.js.map +1 -1
  78. package/lib/cli/configure/analysis/project.d.ts +1 -1
  79. package/lib/cli/configure/analysis/project.js +4 -4
  80. package/lib/cli/configure/analysis/project.js.map +2 -2
  81. package/lib/cli/configure/dependencies/index.d.ts +5 -5
  82. package/lib/cli/configure/dependencies/index.js +5 -5
  83. package/lib/cli/configure/dependencies/index.js.map +1 -1
  84. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.d.ts +2 -2
  85. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +1 -1
  86. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
  87. package/lib/cli/configure/dependencies/seekKoala.d.ts +2 -2
  88. package/lib/cli/configure/dependencies/seekKoala.js +1 -1
  89. package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
  90. package/lib/cli/configure/dependencies/skuba.d.ts +2 -2
  91. package/lib/cli/configure/dependencies/skuba.js +1 -1
  92. package/lib/cli/configure/dependencies/skuba.js.map +1 -1
  93. package/lib/cli/configure/dependencies/skubaDeps.d.ts +1 -1
  94. package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
  95. package/lib/cli/configure/dependencies/skubaDive.d.ts +2 -2
  96. package/lib/cli/configure/dependencies/skubaDive.js +1 -1
  97. package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
  98. package/lib/cli/configure/ensureTemplateCompletion.d.ts +1 -1
  99. package/lib/cli/configure/ensureTemplateCompletion.js +6 -6
  100. package/lib/cli/configure/ensureTemplateCompletion.js.map +1 -1
  101. package/lib/cli/configure/getEntryPoint.d.ts +2 -2
  102. package/lib/cli/configure/getEntryPoint.js +3 -3
  103. package/lib/cli/configure/getEntryPoint.js.map +1 -1
  104. package/lib/cli/configure/getProjectType.d.ts +2 -2
  105. package/lib/cli/configure/getProjectType.js +3 -3
  106. package/lib/cli/configure/getProjectType.js.map +1 -1
  107. package/lib/cli/configure/index.js +14 -14
  108. package/lib/cli/configure/index.js.map +1 -1
  109. package/lib/cli/configure/modules/eslint.d.ts +1 -1
  110. package/lib/cli/configure/modules/eslint.js +4 -4
  111. package/lib/cli/configure/modules/eslint.js.map +1 -1
  112. package/lib/cli/configure/modules/ignore.d.ts +1 -1
  113. package/lib/cli/configure/modules/ignore.js +2 -2
  114. package/lib/cli/configure/modules/ignore.js.map +1 -1
  115. package/lib/cli/configure/modules/index.d.ts +1 -1
  116. package/lib/cli/configure/modules/index.js +10 -10
  117. package/lib/cli/configure/modules/index.js.map +1 -1
  118. package/lib/cli/configure/modules/jest.d.ts +1 -1
  119. package/lib/cli/configure/modules/jest.js +4 -4
  120. package/lib/cli/configure/modules/jest.js.map +1 -1
  121. package/lib/cli/configure/modules/nodemon.d.ts +1 -1
  122. package/lib/cli/configure/modules/nodemon.js +1 -1
  123. package/lib/cli/configure/modules/nodemon.js.map +1 -1
  124. package/lib/cli/configure/modules/package.d.ts +1 -1
  125. package/lib/cli/configure/modules/package.js +4 -4
  126. package/lib/cli/configure/modules/package.js.map +1 -1
  127. package/lib/cli/configure/modules/prettier.d.ts +1 -1
  128. package/lib/cli/configure/modules/prettier.js +4 -4
  129. package/lib/cli/configure/modules/prettier.js.map +1 -1
  130. package/lib/cli/configure/modules/renovate.d.ts +1 -1
  131. package/lib/cli/configure/modules/renovate.js +5 -5
  132. package/lib/cli/configure/modules/renovate.js.map +1 -1
  133. package/lib/cli/configure/modules/serverless.d.ts +1 -1
  134. package/lib/cli/configure/modules/serverless.js.map +1 -1
  135. package/lib/cli/configure/modules/skubaDive.d.ts +1 -1
  136. package/lib/cli/configure/modules/skubaDive.js +4 -4
  137. package/lib/cli/configure/modules/skubaDive.js.map +1 -1
  138. package/lib/cli/configure/modules/tslint.d.ts +1 -1
  139. package/lib/cli/configure/modules/tslint.js +1 -1
  140. package/lib/cli/configure/modules/tslint.js.map +1 -1
  141. package/lib/cli/configure/processing/deleteFiles.d.ts +1 -1
  142. package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
  143. package/lib/cli/configure/processing/json.js +2 -2
  144. package/lib/cli/configure/processing/json.js.map +1 -1
  145. package/lib/cli/configure/processing/loadFiles.d.ts +1 -1
  146. package/lib/cli/configure/processing/loadFiles.js.map +1 -1
  147. package/lib/cli/configure/processing/module.d.ts +1 -1
  148. package/lib/cli/configure/processing/module.js +1 -1
  149. package/lib/cli/configure/processing/module.js.map +1 -1
  150. package/lib/cli/configure/processing/package.d.ts +1 -1
  151. package/lib/cli/configure/processing/package.js +2 -2
  152. package/lib/cli/configure/processing/package.js.map +1 -1
  153. package/lib/cli/configure/processing/prettier.d.ts +1 -1
  154. package/lib/cli/configure/processing/prettier.js +6 -8
  155. package/lib/cli/configure/processing/prettier.js.map +3 -3
  156. package/lib/cli/configure/processing/typescript.js +1 -1
  157. package/lib/cli/configure/processing/typescript.js.map +1 -1
  158. package/lib/cli/configure/types.d.ts +2 -2
  159. package/lib/cli/configure/types.js.map +1 -1
  160. package/lib/cli/format/index.js +5 -5
  161. package/lib/cli/format/index.js.map +1 -1
  162. package/lib/cli/help/index.js +2 -2
  163. package/lib/cli/help/index.js.map +1 -1
  164. package/lib/cli/init/getConfig.d.ts +3 -3
  165. package/lib/cli/init/getConfig.js +9 -9
  166. package/lib/cli/init/getConfig.js.map +1 -1
  167. package/lib/cli/init/git.js +2 -2
  168. package/lib/cli/init/git.js.map +1 -1
  169. package/lib/cli/init/index.js +15 -15
  170. package/lib/cli/init/index.js.map +1 -1
  171. package/lib/cli/init/prompts.d.ts +1 -1
  172. package/lib/cli/init/prompts.js +2 -2
  173. package/lib/cli/init/prompts.js.map +1 -1
  174. package/lib/cli/init/types.js +2 -2
  175. package/lib/cli/init/types.js.map +1 -1
  176. package/lib/cli/init/writePackageJson.d.ts +1 -1
  177. package/lib/cli/init/writePackageJson.js +2 -2
  178. package/lib/cli/init/writePackageJson.js.map +1 -1
  179. package/lib/cli/lint/annotate/buildkite/eslint.d.ts +1 -1
  180. package/lib/cli/lint/annotate/buildkite/eslint.js +1 -1
  181. package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
  182. package/lib/cli/lint/annotate/buildkite/index.d.ts +4 -4
  183. package/lib/cli/lint/annotate/buildkite/index.js +5 -5
  184. package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
  185. package/lib/cli/lint/annotate/buildkite/internal.d.ts +1 -1
  186. package/lib/cli/lint/annotate/buildkite/internal.js +1 -1
  187. package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
  188. package/lib/cli/lint/annotate/buildkite/prettier.d.ts +1 -1
  189. package/lib/cli/lint/annotate/buildkite/prettier.js +1 -1
  190. package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
  191. package/lib/cli/lint/annotate/buildkite/tsc.d.ts +1 -1
  192. package/lib/cli/lint/annotate/buildkite/tsc.js +1 -1
  193. package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
  194. package/lib/cli/lint/annotate/github/eslint.d.ts +2 -2
  195. package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
  196. package/lib/cli/lint/annotate/github/index.d.ts +4 -4
  197. package/lib/cli/lint/annotate/github/index.js +6 -6
  198. package/lib/cli/lint/annotate/github/index.js.map +2 -2
  199. package/lib/cli/lint/annotate/github/internal.d.ts +2 -2
  200. package/lib/cli/lint/annotate/github/internal.js.map +1 -1
  201. package/lib/cli/lint/annotate/github/prettier.d.ts +2 -2
  202. package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
  203. package/lib/cli/lint/annotate/github/tsc.d.ts +2 -2
  204. package/lib/cli/lint/annotate/github/tsc.js.map +1 -1
  205. package/lib/cli/lint/annotate/index.d.ts +4 -4
  206. package/lib/cli/lint/annotate/index.js +2 -2
  207. package/lib/cli/lint/annotate/index.js.map +1 -1
  208. package/lib/cli/lint/autofix.d.ts +2 -2
  209. package/lib/cli/lint/autofix.js +11 -11
  210. package/lib/cli/lint/autofix.js.map +1 -1
  211. package/lib/cli/lint/eslint.d.ts +2 -2
  212. package/lib/cli/lint/eslint.js +3 -3
  213. package/lib/cli/lint/eslint.js.map +1 -1
  214. package/lib/cli/lint/external.d.ts +3 -3
  215. package/lib/cli/lint/external.js +3 -3
  216. package/lib/cli/lint/external.js.map +1 -1
  217. package/lib/cli/lint/index.js +8 -8
  218. package/lib/cli/lint/index.js.map +1 -1
  219. package/lib/cli/lint/internal.d.ts +1 -1
  220. package/lib/cli/lint/internal.js +5 -5
  221. package/lib/cli/lint/internal.js.map +1 -1
  222. package/lib/cli/lint/internalLints/detectBadCodeowners.d.ts +2 -2
  223. package/lib/cli/lint/internalLints/detectBadCodeowners.js +2 -2
  224. package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
  225. package/lib/cli/lint/internalLints/noSkubaTemplateJs.d.ts +2 -2
  226. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +2 -2
  227. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +1 -1
  228. package/lib/cli/lint/internalLints/patchRenovateConfig.d.ts +2 -2
  229. package/lib/cli/lint/internalLints/patchRenovateConfig.js +5 -5
  230. package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +1 -1
  231. package/lib/cli/lint/internalLints/refreshConfigFiles.d.ts +3 -3
  232. package/lib/cli/lint/internalLints/refreshConfigFiles.js +7 -7
  233. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +1 -1
  234. package/lib/cli/lint/internalLints/upgrade/index.d.ts +3 -3
  235. package/lib/cli/lint/internalLints/upgrade/index.js +4 -4
  236. package/lib/cli/lint/internalLints/upgrade/index.js.map +1 -1
  237. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.d.ts +1 -1
  238. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +1 -1
  239. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js.map +1 -1
  240. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.d.ts +1 -1
  241. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js +1 -1
  242. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js.map +2 -2
  243. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.d.ts +1 -1
  244. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +2 -2
  245. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +1 -1
  246. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.d.ts +1 -1
  247. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +4 -4
  248. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +2 -2
  249. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.d.ts +1 -1
  250. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +1 -1
  251. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js.map +2 -2
  252. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.d.ts +1 -1
  253. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +4 -4
  254. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +2 -2
  255. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.d.ts +1 -1
  256. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +4 -4
  257. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +2 -2
  258. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.d.ts +1 -1
  259. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +2 -2
  260. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +2 -2
  261. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.d.ts +1 -1
  262. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +3 -3
  263. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +2 -2
  264. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.d.ts +1 -1
  265. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +1 -1
  266. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +1 -1
  267. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.d.ts +1 -1
  268. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +1 -1
  269. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +2 -2
  270. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.d.ts +1 -1
  271. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js +1 -1
  272. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js.map +2 -2
  273. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.d.ts +1 -1
  274. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +5 -5
  275. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +1 -1
  276. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.d.ts +1 -1
  277. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +1 -1
  278. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js.map +2 -2
  279. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.d.ts +1 -1
  280. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +1 -1
  281. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +2 -2
  282. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.d.ts +1 -1
  283. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js +1 -1
  284. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js.map +2 -2
  285. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.d.ts +1 -1
  286. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +5 -5
  287. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +2 -2
  288. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.d.ts +1 -1
  289. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js +1 -1
  290. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js.map +1 -1
  291. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.d.ts +1 -1
  292. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js +1 -1
  293. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
  294. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.d.ts +1 -1
  295. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +1 -1
  296. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +1 -1
  297. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.d.ts +1 -1
  298. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +2 -2
  299. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +2 -2
  300. package/lib/cli/lint/prettier.d.ts +2 -2
  301. package/lib/cli/lint/prettier.js +3 -3
  302. package/lib/cli/lint/prettier.js.map +1 -1
  303. package/lib/cli/lint/tsc.d.ts +1 -1
  304. package/lib/cli/lint/tsc.js +1 -1
  305. package/lib/cli/lint/tsc.js.map +1 -1
  306. package/lib/cli/migrate/index.js +2 -2
  307. package/lib/cli/migrate/index.js.map +1 -1
  308. package/lib/cli/migrate/nodeVersion/checks.js +1 -1
  309. package/lib/cli/migrate/nodeVersion/checks.js.map +1 -1
  310. package/lib/cli/migrate/nodeVersion/index.js +3 -3
  311. package/lib/cli/migrate/nodeVersion/index.js.map +1 -1
  312. package/lib/cli/node/index.js +3 -3
  313. package/lib/cli/node/index.js.map +1 -1
  314. package/lib/cli/release/index.js +1 -1
  315. package/lib/cli/release/index.js.map +1 -1
  316. package/lib/cli/start/index.js +4 -4
  317. package/lib/cli/start/index.js.map +1 -1
  318. package/lib/cli/test/reporters/github/annotations.d.ts +1 -1
  319. package/lib/cli/test/reporters/github/annotations.js.map +1 -1
  320. package/lib/cli/test/reporters/github/index.js +5 -5
  321. package/lib/cli/test/reporters/github/index.js.map +2 -2
  322. package/lib/cli/test/reporters/prettier/index.d.ts +4 -0
  323. package/lib/cli/test/reporters/prettier/index.js +67 -0
  324. package/lib/cli/test/reporters/prettier/index.js.map +7 -0
  325. package/lib/cli/version/index.js +2 -2
  326. package/lib/cli/version/index.js.map +1 -1
  327. package/lib/index.d.ts +5 -5
  328. package/lib/index.js +5 -5
  329. package/lib/index.js.map +1 -1
  330. package/lib/skuba.js +8 -8
  331. package/lib/skuba.js.map +1 -1
  332. package/lib/utils/args.js +1 -1
  333. package/lib/utils/args.js.map +1 -1
  334. package/lib/utils/copy.js +2 -2
  335. package/lib/utils/copy.js.map +1 -1
  336. package/lib/utils/dir.js +2 -2
  337. package/lib/utils/dir.js.map +1 -1
  338. package/lib/utils/error.js +2 -2
  339. package/lib/utils/error.js.map +1 -1
  340. package/lib/utils/exec.d.ts +1 -1
  341. package/lib/utils/exec.js +2 -2
  342. package/lib/utils/exec.js.map +1 -1
  343. package/lib/utils/help.js +2 -2
  344. package/lib/utils/help.js.map +1 -1
  345. package/lib/utils/logo.js +3 -3
  346. package/lib/utils/logo.js.map +1 -1
  347. package/lib/utils/manifest.js +1 -1
  348. package/lib/utils/manifest.js.map +1 -1
  349. package/lib/utils/packageManager.js +1 -1
  350. package/lib/utils/packageManager.js.map +1 -1
  351. package/lib/utils/template.js +2 -2
  352. package/lib/utils/template.js.map +1 -1
  353. package/lib/utils/version.js +2 -2
  354. package/lib/utils/version.js.map +1 -1
  355. package/lib/utils/wait.js +2 -2
  356. package/lib/utils/wait.js.map +1 -1
  357. package/lib/utils/worker.d.ts +3 -3
  358. package/lib/utils/worker.js +1 -1
  359. package/lib/utils/worker.js.map +1 -1
  360. package/lib/wrapper/functionHandler.js +3 -3
  361. package/lib/wrapper/functionHandler.js.map +1 -1
  362. package/lib/wrapper/http.js +1 -1
  363. package/lib/wrapper/http.js.map +1 -1
  364. package/lib/wrapper/index.js +3 -3
  365. package/lib/wrapper/index.js.map +1 -1
  366. package/lib/wrapper/main.js +2 -2
  367. package/lib/wrapper/main.js.map +1 -1
  368. package/lib/wrapper/requestListener.js +2 -2
  369. package/lib/wrapper/requestListener.js.map +1 -1
  370. package/package.json +12 -12
  371. package/template/express-rest-api/src/app.test.ts +1 -1
  372. package/template/express-rest-api/src/app.ts +3 -3
  373. package/template/express-rest-api/src/framework/logging.ts +1 -1
  374. package/template/express-rest-api/src/framework/metrics.ts +2 -2
  375. package/template/express-rest-api/src/listen.ts +4 -4
  376. package/template/greeter/package.json +1 -1
  377. package/template/greeter/src/app.test.ts +1 -1
  378. package/template/koa-rest-api/src/api/healthCheck.ts +1 -1
  379. package/template/koa-rest-api/src/api/index.ts +3 -3
  380. package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +2 -2
  381. package/template/koa-rest-api/src/api/jobs/getJobs.ts +4 -4
  382. package/template/koa-rest-api/src/api/jobs/index.ts +3 -3
  383. package/template/koa-rest-api/src/api/jobs/postJob.test.ts +3 -3
  384. package/template/koa-rest-api/src/api/jobs/postJob.ts +6 -6
  385. package/template/koa-rest-api/src/api/smokeTest.ts +2 -2
  386. package/template/koa-rest-api/src/app.test.ts +2 -2
  387. package/template/koa-rest-api/src/app.ts +3 -3
  388. package/template/koa-rest-api/src/framework/logging.ts +1 -1
  389. package/template/koa-rest-api/src/framework/metrics.ts +2 -2
  390. package/template/koa-rest-api/src/framework/server.test.ts +5 -5
  391. package/template/koa-rest-api/src/framework/server.ts +3 -3
  392. package/template/koa-rest-api/src/framework/validation.test.ts +4 -4
  393. package/template/koa-rest-api/src/framework/validation.ts +1 -1
  394. package/template/koa-rest-api/src/listen.ts +4 -4
  395. package/template/koa-rest-api/src/storage/jobs.ts +1 -1
  396. package/template/koa-rest-api/src/testing/logging.ts +1 -1
  397. package/template/koa-rest-api/src/testing/metrics.ts +1 -1
  398. package/template/koa-rest-api/src/testing/server.ts +1 -1
  399. package/template/koa-rest-api/src/testing/types.ts +1 -1
  400. package/template/koa-rest-api/tsconfig.json +18 -0
  401. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
  402. package/template/lambda-sqs-worker-cdk/infra/index.ts +2 -2
  403. package/template/lambda-sqs-worker-cdk/package.json +1 -1
  404. package/template/lambda-sqs-worker-cdk/src/app.test.ts +6 -6
  405. package/template/lambda-sqs-worker-cdk/src/app.ts +10 -7
  406. package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +4 -4
  407. package/template/lambda-sqs-worker-cdk/src/framework/handler.ts +2 -2
  408. package/template/lambda-sqs-worker-cdk/src/framework/logging.ts +1 -1
  409. package/template/lambda-sqs-worker-cdk/src/framework/metrics.ts +1 -1
  410. package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +2 -2
  411. package/template/lambda-sqs-worker-cdk/src/mapping/jobScorer.ts +2 -2
  412. package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +3 -3
  413. package/template/lambda-sqs-worker-cdk/src/services/jobScorer.ts +3 -3
  414. package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +3 -3
  415. package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.ts +2 -2
  416. package/template/lambda-sqs-worker-cdk/src/testing/handler.ts +1 -1
  417. package/template/lambda-sqs-worker-cdk/src/testing/logging.ts +1 -1
  418. package/template/lambda-sqs-worker-cdk/src/testing/services.ts +2 -2
  419. package/template/lambda-sqs-worker-cdk/src/testing/types.ts +1 -1
  420. package/template/oss-npm-package/src/index.test.ts +1 -1
  421. package/template/private-npm-package/src/index.test.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/api/github/push.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport type { CreateCommitOnBranchInput } from '@octokit/graphql-schema';\nimport fs from 'fs-extra';\n\nimport * as Git from '../git';\n\nimport { apiTokenFromEnvironment } from './environment';\nimport { graphql } from './octokit';\n\ninterface CreateCommitResult {\n createCommitOnBranch: {\n commit: {\n oid: string;\n };\n };\n}\n\ninterface UploadAllFileChangesParams {\n dir: string;\n /**\n * The branch name\n */\n branch: string;\n /**\n * The headline of the commit message\n */\n messageHeadline: string;\n\n /**\n * File changes to exclude from the upload.\n *\n * Defaults to `[]` (no exclusions).\n */\n ignore?: Git.ChangedFile[];\n /**\n * The body of the commit message\n */\n messageBody?: string;\n /**\n * Updates the local Git repository to match the new remote branch state\n */\n updateLocal?: boolean;\n}\n\n/**\n * Retrieves all file changes from the local Git repository using\n * `getChangedFiles`, then uploads the changes to a specified GitHub branch\n * using `uploadFileChanges`.\n *\n * Returns the commit ID, or `undefined` if there are no changes to commit.\n *\n * The file changes will appear as verified commits on GitHub.\n *\n * This will not update the local Git repository unless `updateLocal` is\n * specified.\n */\nexport const uploadAllFileChanges = async ({\n branch,\n dir,\n messageHeadline,\n\n ignore,\n messageBody,\n updateLocal = false,\n}: UploadAllFileChangesParams): Promise<string | undefined> => {\n const changedFiles = await Git.getChangedFiles({ dir, ignore });\n\n if (!changedFiles.length) {\n return;\n }\n\n const fileChanges = await readFileChanges(dir, changedFiles);\n\n const commitId = await uploadFileChanges({\n dir,\n branch,\n messageHeadline,\n messageBody,\n fileChanges,\n });\n\n if (updateLocal) {\n await Promise.all(\n [...fileChanges.additions, ...fileChanges.deletions].map((file) =>\n fs.rm(file.path),\n ),\n );\n\n await Git.fastForwardBranch({\n ref: branch,\n auth: { type: 'gitHubApp' },\n dir,\n });\n }\n\n return commitId;\n};\n\ninterface FileAddition {\n contents: unknown;\n path: string;\n}\n\ninterface FileDeletion {\n path: string;\n}\n\nexport interface FileChanges {\n additions: FileAddition[];\n deletions: FileDeletion[];\n}\n\n/**\n * Takes a list of `ChangedFiles`, reads them from the file system, and maps\n * them to GitHub GraphQL `FileChanges`.\n *\n * https://docs.github.com/en/graphql/reference/input-objects#filechanges\n */\nexport const readFileChanges = async (\n dir: string,\n changedFiles: Git.ChangedFile[],\n): Promise<FileChanges> => {\n const { added, deleted } = changedFiles.reduce<{\n added: string[];\n deleted: string[];\n }>(\n (files, changedFile) => {\n const filePath = changedFile.path;\n if (changedFile.state === 'deleted') {\n files.deleted.push(filePath);\n } else {\n files.added.push(filePath);\n }\n\n return files;\n },\n { added: [], deleted: [] },\n );\n\n const gitRoot = await Git.findRoot({ dir });\n\n const toRootPath = (filePath: string) => {\n if (!gitRoot) {\n return filePath;\n }\n\n return path.resolve(gitRoot, filePath);\n };\n\n const additions: FileAddition[] = await Promise.all(\n added.map(async (filePath) => ({\n path: filePath,\n contents: await fs.promises.readFile(toRootPath(filePath), {\n encoding: 'base64',\n }),\n })),\n );\n\n const deletions: FileDeletion[] = deleted.map((filePath) => ({\n path: filePath,\n }));\n\n return {\n additions,\n deletions,\n };\n};\n\ninterface UploadFileChangesParams {\n dir: string;\n /**\n * The branch name\n */\n branch: string;\n /**\n * The headline of the commit message\n */\n messageHeadline: string;\n /**\n * The body of the commit message\n */\n messageBody?: string;\n /**\n * File additions and deletions\n */\n fileChanges: FileChanges;\n}\n\n/**\n * Uploads file changes from the local workspace to a specified GitHub branch.\n *\n * The file changes will appear as verified commits on GitHub.\n *\n * This will not update the local Git repository.\n */\nexport const uploadFileChanges = async ({\n dir,\n branch,\n messageHeadline,\n messageBody,\n fileChanges,\n}: UploadFileChangesParams): Promise<string> => {\n const authToken = apiTokenFromEnvironment();\n if (!authToken) {\n throw new Error(\n 'Could not read a GitHub API token from the environment. Please set GITHUB_API_TOKEN or GITHUB_TOKEN.',\n );\n }\n\n const [{ owner, repo }, headCommitId] = await Promise.all([\n Git.getOwnerAndRepo({ dir }),\n Git.getHeadCommitId({ dir }),\n ]);\n\n const input: CreateCommitOnBranchInput = {\n branch: {\n repositoryNameWithOwner: `${owner}/${repo}`,\n branchName: branch,\n },\n message: {\n headline: messageHeadline,\n body: messageBody,\n },\n expectedHeadOid: headCommitId,\n clientMutationId: 'skuba',\n fileChanges,\n };\n\n const result = await graphql<CreateCommitResult>(\n `\n mutation Mutation($input: CreateCommitOnBranchInput!) {\n createCommitOnBranch(input: $input) {\n commit {\n oid\n }\n }\n }\n `,\n {\n input,\n headers: {\n authorization: `Bearer ${authToken}`,\n },\n },\n );\n\n return result.createCommitOnBranch.commit.oid;\n};\n"],
4
+ "sourcesContent": ["import path from 'path';\n\nimport type { CreateCommitOnBranchInput } from '@octokit/graphql-schema';\nimport fs from 'fs-extra';\n\nimport * as Git from '../git/index.js';\n\nimport { apiTokenFromEnvironment } from './environment.js';\nimport { graphql } from './octokit.js';\n\ninterface CreateCommitResult {\n createCommitOnBranch: {\n commit: {\n oid: string;\n };\n };\n}\n\ninterface UploadAllFileChangesParams {\n dir: string;\n /**\n * The branch name\n */\n branch: string;\n /**\n * The headline of the commit message\n */\n messageHeadline: string;\n\n /**\n * File changes to exclude from the upload.\n *\n * Defaults to `[]` (no exclusions).\n */\n ignore?: Git.ChangedFile[];\n /**\n * The body of the commit message\n */\n messageBody?: string;\n /**\n * Updates the local Git repository to match the new remote branch state\n */\n updateLocal?: boolean;\n}\n\n/**\n * Retrieves all file changes from the local Git repository using\n * `getChangedFiles`, then uploads the changes to a specified GitHub branch\n * using `uploadFileChanges`.\n *\n * Returns the commit ID, or `undefined` if there are no changes to commit.\n *\n * The file changes will appear as verified commits on GitHub.\n *\n * This will not update the local Git repository unless `updateLocal` is\n * specified.\n */\nexport const uploadAllFileChanges = async ({\n branch,\n dir,\n messageHeadline,\n\n ignore,\n messageBody,\n updateLocal = false,\n}: UploadAllFileChangesParams): Promise<string | undefined> => {\n const changedFiles = await Git.getChangedFiles({ dir, ignore });\n\n if (!changedFiles.length) {\n return;\n }\n\n const fileChanges = await readFileChanges(dir, changedFiles);\n\n const commitId = await uploadFileChanges({\n dir,\n branch,\n messageHeadline,\n messageBody,\n fileChanges,\n });\n\n if (updateLocal) {\n await Promise.all(\n [...fileChanges.additions, ...fileChanges.deletions].map((file) =>\n fs.rm(file.path),\n ),\n );\n\n await Git.fastForwardBranch({\n ref: branch,\n auth: { type: 'gitHubApp' },\n dir,\n });\n }\n\n return commitId;\n};\n\ninterface FileAddition {\n contents: unknown;\n path: string;\n}\n\ninterface FileDeletion {\n path: string;\n}\n\nexport interface FileChanges {\n additions: FileAddition[];\n deletions: FileDeletion[];\n}\n\n/**\n * Takes a list of `ChangedFiles`, reads them from the file system, and maps\n * them to GitHub GraphQL `FileChanges`.\n *\n * https://docs.github.com/en/graphql/reference/input-objects#filechanges\n */\nexport const readFileChanges = async (\n dir: string,\n changedFiles: Git.ChangedFile[],\n): Promise<FileChanges> => {\n const { added, deleted } = changedFiles.reduce<{\n added: string[];\n deleted: string[];\n }>(\n (files, changedFile) => {\n const filePath = changedFile.path;\n if (changedFile.state === 'deleted') {\n files.deleted.push(filePath);\n } else {\n files.added.push(filePath);\n }\n\n return files;\n },\n { added: [], deleted: [] },\n );\n\n const gitRoot = await Git.findRoot({ dir });\n\n const toRootPath = (filePath: string) => {\n if (!gitRoot) {\n return filePath;\n }\n\n return path.resolve(gitRoot, filePath);\n };\n\n const additions: FileAddition[] = await Promise.all(\n added.map(async (filePath) => ({\n path: filePath,\n contents: await fs.promises.readFile(toRootPath(filePath), {\n encoding: 'base64',\n }),\n })),\n );\n\n const deletions: FileDeletion[] = deleted.map((filePath) => ({\n path: filePath,\n }));\n\n return {\n additions,\n deletions,\n };\n};\n\ninterface UploadFileChangesParams {\n dir: string;\n /**\n * The branch name\n */\n branch: string;\n /**\n * The headline of the commit message\n */\n messageHeadline: string;\n /**\n * The body of the commit message\n */\n messageBody?: string;\n /**\n * File additions and deletions\n */\n fileChanges: FileChanges;\n}\n\n/**\n * Uploads file changes from the local workspace to a specified GitHub branch.\n *\n * The file changes will appear as verified commits on GitHub.\n *\n * This will not update the local Git repository.\n */\nexport const uploadFileChanges = async ({\n dir,\n branch,\n messageHeadline,\n messageBody,\n fileChanges,\n}: UploadFileChangesParams): Promise<string> => {\n const authToken = apiTokenFromEnvironment();\n if (!authToken) {\n throw new Error(\n 'Could not read a GitHub API token from the environment. Please set GITHUB_API_TOKEN or GITHUB_TOKEN.',\n );\n }\n\n const [{ owner, repo }, headCommitId] = await Promise.all([\n Git.getOwnerAndRepo({ dir }),\n Git.getHeadCommitId({ dir }),\n ]);\n\n const input: CreateCommitOnBranchInput = {\n branch: {\n repositoryNameWithOwner: `${owner}/${repo}`,\n branchName: branch,\n },\n message: {\n headline: messageHeadline,\n body: messageBody,\n },\n expectedHeadOid: headCommitId,\n clientMutationId: 'skuba',\n fileChanges,\n };\n\n const result = await graphql<CreateCommitResult>(\n `\n mutation Mutation($input: CreateCommitOnBranchInput!) {\n createCommitOnBranch(input: $input) {\n commit {\n oid\n }\n }\n }\n `,\n {\n input,\n headers: {\n authorization: `Bearer ${authToken}`,\n },\n },\n );\n\n return result.createCommitOnBranch.commit.oid;\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAGjB,sBAAe;AAEf,UAAqB;AAErB,yBAAwC;AACxC,qBAAwB;AAiDjB,MAAM,uBAAuB,OAAO;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA,cAAc;AAChB,MAA+D;AAC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gBAAAD,QAAG,SAAS,SAAS,WAAW,QAAQ,GAAG;AAAA,QACzD,UAAU;AAAA,MACZ,CAAC;AAAA,IACH,EAAE;AAAA,EACJ;AAEA,QAAM,YAA4B,QAAQ,IAAI,CAAC,cAAc;AAAA,IAC3D,MAAM;AAAA,EACR,EAAE;AAEF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AA6BO,MAAM,oBAAoB,OAAO;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAgD;AAC9C,QAAM,gBAAY,4CAAwB;AAC1C,MAAI,CAAC,WAAW;AACd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,CAAC,EAAE,OAAO,KAAK,GAAG,YAAY,IAAI,MAAM,QAAQ,IAAI;AAAA,IACxD,IAAI,gBAAgB,EAAE,IAAI,CAAC;AAAA,IAC3B,IAAI,gBAAgB,EAAE,IAAI,CAAC;AAAA,EAC7B,CAAC;AAED,QAAM,QAAmC;AAAA,IACvC,QAAQ;AAAA,MACN,yBAAyB,GAAG,KAAK,IAAI,IAAI;AAAA,MACzC,YAAY;AAAA,IACd;AAAA,IACA,SAAS;AAAA,MACP,UAAU;AAAA,MACV,MAAM;AAAA,IACR;AAAA,IACA,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB;AAAA,EACF;AAEA,QAAM,SAAS,UAAM;AAAA,IACnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASA;AAAA,MACE;AAAA,MACA,SAAS;AAAA,QACP,eAAe,UAAU,SAAS;AAAA,MACpC;AAAA,IACF;AAAA,EACF;AAEA,SAAO,OAAO,qBAAqB,OAAO;AAC5C;",
6
6
  "names": ["fs", "path"]
7
7
  }
@@ -31,8 +31,8 @@ __export(jest_exports, {
31
31
  mergePreset: () => mergePreset
32
32
  });
33
33
  module.exports = __toCommonJS(jest_exports);
34
- var import_jest_preset = __toESM(require("../../../jest-preset"));
35
- var import_record = require("../../cli/configure/processing/record");
34
+ var import_jest_preset = __toESM(require("../../../jest-preset.js"));
35
+ var import_record = require("../../cli/configure/processing/record.js");
36
36
  const mergePreset = ({
37
37
  projects,
38
38
  ...options
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/api/jest/index.ts"],
4
- "sourcesContent": ["import type { Config } from '@jest/types';\n\nimport jestPreset from '../../../jest-preset';\nimport { mergeRaw } from '../../cli/configure/processing/record';\n\n// Avoid TS4082 in Jest configuration files:\n// Default export of the module has or is using private name `ConfigGlobals`.\nexport type { Config } from '@jest/types';\n\n/**\n * Set of Jest options that are recommended and supported for customisation.\n *\n * While we technically accept anything compatible with `Config.InitialOptions`,\n * these are tacitly endorsed for our use cases and receive IntelliSense.\n */\ntype DefaultOptions =\n | 'collectCoverage'\n | 'collectCoverageFrom'\n | 'coveragePathIgnorePatterns'\n | 'coverageThreshold'\n | 'displayName'\n | 'globals'\n | 'globalSetup'\n | 'globalTeardown'\n | 'projects'\n | 'setupFiles'\n | 'setupFilesAfterEnv'\n | 'snapshotSerializers'\n | 'testEnvironment'\n | 'testPathIgnorePatterns'\n | 'testTimeout'\n | 'watchPathIgnorePatterns';\n\n/**\n * Merge additional Jest options into the **skuba** preset.\n *\n * This concatenates array options like `testPathIgnorePatterns`.\n */\nexport const mergePreset = <\n AdditionalOptions extends keyof Config.InitialOptions,\n>({\n projects,\n ...options\n}: Pick<\n Config.InitialOptions,\n AdditionalOptions | DefaultOptions\n>): Config.InitialOptions => {\n const root = mergeRaw(jestPreset, options);\n\n return {\n ...root,\n\n projects: projects?.map((project) => {\n if (typeof project === 'string') {\n return project;\n }\n\n return {\n moduleNameMapper: root.moduleNameMapper,\n transform: root.transform,\n ...project,\n };\n }),\n };\n};\n"],
4
+ "sourcesContent": ["import type { Config } from '@jest/types';\n\nimport jestPreset from '../../../jest-preset.js';\nimport { mergeRaw } from '../../cli/configure/processing/record.js';\n\n// Avoid TS4082 in Jest configuration files:\n// Default export of the module has or is using private name `ConfigGlobals`.\nexport type { Config } from '@jest/types';\n\n/**\n * Set of Jest options that are recommended and supported for customisation.\n *\n * While we technically accept anything compatible with `Config.InitialOptions`,\n * these are tacitly endorsed for our use cases and receive IntelliSense.\n */\ntype DefaultOptions =\n | 'collectCoverage'\n | 'collectCoverageFrom'\n | 'coveragePathIgnorePatterns'\n | 'coverageThreshold'\n | 'displayName'\n | 'globals'\n | 'globalSetup'\n | 'globalTeardown'\n | 'projects'\n | 'setupFiles'\n | 'setupFilesAfterEnv'\n | 'snapshotSerializers'\n | 'testEnvironment'\n | 'testPathIgnorePatterns'\n | 'testTimeout'\n | 'watchPathIgnorePatterns';\n\n/**\n * Merge additional Jest options into the **skuba** preset.\n *\n * This concatenates array options like `testPathIgnorePatterns`.\n */\nexport const mergePreset = <\n AdditionalOptions extends keyof Config.InitialOptions,\n>({\n projects,\n ...options\n}: Pick<\n Config.InitialOptions,\n AdditionalOptions | DefaultOptions\n>): Config.InitialOptions => {\n const root = mergeRaw(jestPreset, options);\n\n return {\n ...root,\n\n projects: projects?.map((project) => {\n if (typeof project === 'string') {\n return project;\n }\n\n return {\n moduleNameMapper: root.moduleNameMapper,\n transform: root.transform,\n ...project,\n };\n }),\n };\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAAuB;AACvB,oBAAyB;AAmClB,MAAM,cAAc,CAEzB;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAG6B;AAC3B,QAAM,WAAO,wBAAS,mBAAAA,SAAY,OAAO;AAEzC,SAAO;AAAA,IACL,GAAG;AAAA,IAEH,UAAU,UAAU,IAAI,CAAC,YAAY;AACnC,UAAI,OAAO,YAAY,UAAU;AAC/B,eAAO;AAAA,MACT;AAEA,aAAO;AAAA,QACL,kBAAkB,KAAK;AAAA,QACvB,WAAW,KAAK;AAAA,QAChB,GAAG;AAAA,MACL;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
6
6
  "names": ["jestPreset"]
7
7
  }
@@ -21,7 +21,7 @@ __export(compose_exports, {
21
21
  resolveComposeAddress: () => resolveComposeAddress
22
22
  });
23
23
  module.exports = __toCommonJS(compose_exports);
24
- var import_exec = require("../../utils/exec");
24
+ var import_exec = require("../../utils/exec.js");
25
25
  const portStringToNumber = (portString) => {
26
26
  const port = Number(portString);
27
27
  if (!Number.isSafeInteger(port)) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/api/net/compose.ts"],
4
- "sourcesContent": ["import { createExec } from '../../utils/exec';\n\nconst portStringToNumber = (portString: string) => {\n const port = Number(portString);\n\n if (!Number.isSafeInteger(port)) {\n throw Error(`received non-integer port: '${portString}'`);\n }\n\n return port;\n};\n\nexport const resolveComposeAddress = async (\n privateHost: string,\n privatePort: number,\n) => {\n const exec = createExec({ stdio: 'pipe' });\n\n const { stdout } = await exec(\n 'docker',\n 'compose',\n 'port',\n privateHost,\n String(privatePort),\n );\n\n const [host, portString] = stdout.trim().split(':');\n\n if (!host || !portString) {\n throw Error(`Docker Compose returned unrecognised address: '${stdout}'`);\n }\n\n return { host, port: portStringToNumber(portString) };\n};\n"],
4
+ "sourcesContent": ["import { createExec } from '../../utils/exec.js';\n\nconst portStringToNumber = (portString: string) => {\n const port = Number(portString);\n\n if (!Number.isSafeInteger(port)) {\n throw Error(`received non-integer port: '${portString}'`);\n }\n\n return port;\n};\n\nexport const resolveComposeAddress = async (\n privateHost: string,\n privatePort: number,\n) => {\n const exec = createExec({ stdio: 'pipe' });\n\n const { stdout } = await exec(\n 'docker',\n 'compose',\n 'port',\n privateHost,\n String(privatePort),\n );\n\n const [host, portString] = stdout.trim().split(':');\n\n if (!host || !portString) {\n throw Error(`Docker Compose returned unrecognised address: '${stdout}'`);\n }\n\n return { host, port: portStringToNumber(portString) };\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2B;AAE3B,MAAM,qBAAqB,CAAC,eAAuB;AACjD,QAAM,OAAO,OAAO,UAAU;AAE9B,MAAI,CAAC,OAAO,cAAc,IAAI,GAAG;AAC/B,UAAM,MAAM,+BAA+B,UAAU,GAAG;AAAA,EAC1D;AAEA,SAAO;AACT;AAEO,MAAM,wBAAwB,OACnC,aACA,gBACG;AACH,QAAM,WAAO,wBAAW,EAAE,OAAO,OAAO,CAAC;AAEzC,QAAM,EAAE,OAAO,IAAI,MAAM;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,WAAW;AAAA,EACpB;AAEA,QAAM,CAAC,MAAM,UAAU,IAAI,OAAO,KAAK,EAAE,MAAM,GAAG;AAElD,MAAI,CAAC,QAAQ,CAAC,YAAY;AACxB,UAAM,MAAM,kDAAkD,MAAM,GAAG;AAAA,EACzE;AAEA,SAAO,EAAE,MAAM,MAAM,mBAAmB,UAAU,EAAE;AACtD;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- export { waitFor } from './waitFor';
1
+ export { waitFor } from './waitFor.js';
@@ -21,7 +21,7 @@ __export(net_exports, {
21
21
  waitFor: () => import_waitFor.waitFor
22
22
  });
23
23
  module.exports = __toCommonJS(net_exports);
24
- var import_waitFor = require("./waitFor");
24
+ var import_waitFor = require("./waitFor.js");
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  waitFor
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/api/net/index.ts"],
4
- "sourcesContent": ["export { waitFor } from './waitFor';\n"],
4
+ "sourcesContent": ["export { waitFor } from './waitFor.js';\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import { type SocketAddress } from './socket';
1
+ import { type SocketAddress } from './socket.js';
2
2
  /**
3
3
  * Wait for a resource to start listening on a socket address.
4
4
  *
@@ -21,8 +21,8 @@ __export(waitFor_exports, {
21
21
  waitFor: () => waitFor
22
22
  });
23
23
  module.exports = __toCommonJS(waitFor_exports);
24
- var import_compose = require("./compose");
25
- var import_socket = require("./socket");
24
+ var import_compose = require("./compose.js");
25
+ var import_socket = require("./socket.js");
26
26
  const waitFor = async ({
27
27
  host = "localhost",
28
28
  port,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/api/net/waitFor.ts"],
4
- "sourcesContent": ["import { resolveComposeAddress } from './compose';\nimport { type SocketAddress, pollSocket } from './socket';\n\n/**\n * Wait for a resource to start listening on a socket address.\n *\n * The socket is polled on an interval until it accepts a connection or the\n * `timeout` is reached.\n */\nexport const waitFor = async ({\n host = 'localhost',\n port,\n resolveCompose = false,\n timeout = 15_000,\n}: {\n host?: string;\n\n port: number;\n\n /**\n * Whether to treat the `host` and `port` arguments as a private Docker\n * Compose network address and to resolve them to a public local address.\n *\n * This is typically:\n *\n * - Enabled locally, when the application is running directly on the machine\n * - Disabled in CI, when running in a container on the Docker Compose network\n */\n resolveCompose?: boolean;\n\n timeout?: number;\n}): Promise<SocketAddress> => {\n const resolvedAddress = resolveCompose\n ? await resolveComposeAddress(host, port)\n : { host, port };\n\n await pollSocket(resolvedAddress.host, resolvedAddress.port, timeout);\n\n return resolvedAddress;\n};\n"],
4
+ "sourcesContent": ["import { resolveComposeAddress } from './compose.js';\nimport { type SocketAddress, pollSocket } from './socket.js';\n\n/**\n * Wait for a resource to start listening on a socket address.\n *\n * The socket is polled on an interval until it accepts a connection or the\n * `timeout` is reached.\n */\nexport const waitFor = async ({\n host = 'localhost',\n port,\n resolveCompose = false,\n timeout = 15_000,\n}: {\n host?: string;\n\n port: number;\n\n /**\n * Whether to treat the `host` and `port` arguments as a private Docker\n * Compose network address and to resolve them to a public local address.\n *\n * This is typically:\n *\n * - Enabled locally, when the application is running directly on the machine\n * - Disabled in CI, when running in a container on the Docker Compose network\n */\n resolveCompose?: boolean;\n\n timeout?: number;\n}): Promise<SocketAddress> => {\n const resolvedAddress = resolveCompose\n ? await resolveComposeAddress(host, port)\n : { host, port };\n\n await pollSocket(resolvedAddress.host, resolvedAddress.port, timeout);\n\n return resolvedAddress;\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAsC;AACtC,oBAA+C;AAQxC,MAAM,UAAU,OAAO;AAAA,EAC5B,OAAO;AAAA,EACP;AAAA,EACA,iBAAiB;AAAA,EACjB,UAAU;AACZ,MAiB8B;AAC5B,QAAM,kBAAkB,iBACpB,UAAM,sCAAsB,MAAM,IAAI,IACtC,EAAE,MAAM,KAAK;AAEjB,YAAM,0BAAW,gBAAgB,MAAM,gBAAgB,MAAM,OAAO;AAEpE,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import { type Linter } from 'eslint';
2
- import { type Logger } from '../../utils/logging';
2
+ import { type Logger } from '../../utils/logging.js';
3
3
  export interface ESLintResult {
4
4
  messages: Linter.LintMessage[];
5
5
  filePath: string;
@@ -34,7 +34,7 @@ module.exports = __toCommonJS(eslint_exports);
34
34
  var import_path = __toESM(require("path"));
35
35
  var import_chalk = __toESM(require("chalk"));
36
36
  var import_eslint = require("eslint");
37
- var import_logging = require("../../utils/logging");
37
+ var import_logging = require("../../utils/logging.js");
38
38
  const symbolForResult = (result) => {
39
39
  if (result.errorCount) {
40
40
  return import_chalk.default.red("\u25CB");
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/adapter/eslint.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport chalk from 'chalk';\nimport { type ESLint, type Linter, loadESLint } from 'eslint';\n\nimport { type Logger, pluralise } from '../../utils/logging';\n\nconst symbolForResult = (result: ESLint.LintResult) => {\n if (result.errorCount) {\n return chalk.red('\u25CB');\n }\n\n return result.warningCount ? chalk.yellow('\u25CD') : chalk.green('\u25CB');\n};\n\nexport interface ESLintResult {\n messages: Linter.LintMessage[];\n filePath: string;\n}\n\nexport interface ESLintOutput {\n errors: ESLintResult[];\n fixable: boolean;\n ok: boolean;\n output: string;\n warnings: ESLintResult[];\n}\n\nexport const runESLint = async (\n mode: 'format' | 'lint',\n logger: Logger,\n overrideConfigFile?: string,\n): Promise<ESLintOutput> => {\n logger.debug('Initialising ESLint...');\n\n const cwd = process.cwd();\n\n const ESLint = await loadESLint({ useFlatConfig: true });\n const engine = new ESLint({\n cache: true,\n fix: mode === 'format',\n overrideConfigFile,\n overrideConfig: {\n linterOptions: {\n reportUnusedDisableDirectives: true,\n },\n },\n });\n\n logger.debug('Processing files...');\n\n const start = process.hrtime.bigint();\n\n const [formatter, { type, results }] = await Promise.all([\n engine.loadFormatter(),\n lintFiles(engine),\n ]);\n\n if (type === 'no-config') {\n logger.plain(\n 'skuba could not find an eslint config file. Do you need to run format or configure?',\n );\n return { ok: false, fixable: false, errors: [], warnings: [], output: '' };\n }\n\n const end = process.hrtime.bigint();\n\n logger.plain(\n `Processed ${pluralise(results.length, 'file')} in ${logger.timing(\n start,\n end,\n )}.`,\n );\n\n const errors: ESLintResult[] = [];\n const warnings: ESLintResult[] = [];\n let fixable = false;\n\n for (const result of results) {\n const relativePath = path.relative(cwd, result.filePath);\n if (result.fixableErrorCount + result.fixableWarningCount) {\n fixable = true;\n }\n\n if (result.errorCount) {\n errors.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n if (result.warningCount) {\n warnings.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n logger.debug(symbolForResult(result), relativePath);\n }\n\n const ok = errors.length === 0;\n\n await ESLint.outputFixes(results);\n\n const output = await formatter.format(\n results,\n engine.getRulesMetaForResults(results),\n );\n\n if (output) {\n logger.plain(output);\n }\n\n return { errors, fixable, ok, output, warnings };\n};\n\nconst lintFiles = async (engine: ESLint) => {\n try {\n const result = await engine.lintFiles([]);\n return { type: 'results', results: result } as const;\n } catch (error) {\n if (\n error instanceof Error &&\n error.message === 'Could not find config file.'\n ) {\n return { type: 'no-config', results: undefined } as const;\n }\n throw error;\n }\n};\n"],
4
+ "sourcesContent": ["import path from 'path';\n\nimport chalk from 'chalk';\nimport { type ESLint, type Linter, loadESLint } from 'eslint';\n\nimport { type Logger, pluralise } from '../../utils/logging.js';\n\nconst symbolForResult = (result: ESLint.LintResult) => {\n if (result.errorCount) {\n return chalk.red('\u25CB');\n }\n\n return result.warningCount ? chalk.yellow('\u25CD') : chalk.green('\u25CB');\n};\n\nexport interface ESLintResult {\n messages: Linter.LintMessage[];\n filePath: string;\n}\n\nexport interface ESLintOutput {\n errors: ESLintResult[];\n fixable: boolean;\n ok: boolean;\n output: string;\n warnings: ESLintResult[];\n}\n\nexport const runESLint = async (\n mode: 'format' | 'lint',\n logger: Logger,\n overrideConfigFile?: string,\n): Promise<ESLintOutput> => {\n logger.debug('Initialising ESLint...');\n\n const cwd = process.cwd();\n\n const ESLint = await loadESLint({ useFlatConfig: true });\n const engine = new ESLint({\n cache: true,\n fix: mode === 'format',\n overrideConfigFile,\n overrideConfig: {\n linterOptions: {\n reportUnusedDisableDirectives: true,\n },\n },\n });\n\n logger.debug('Processing files...');\n\n const start = process.hrtime.bigint();\n\n const [formatter, { type, results }] = await Promise.all([\n engine.loadFormatter(),\n lintFiles(engine),\n ]);\n\n if (type === 'no-config') {\n logger.plain(\n 'skuba could not find an eslint config file. Do you need to run format or configure?',\n );\n return { ok: false, fixable: false, errors: [], warnings: [], output: '' };\n }\n\n const end = process.hrtime.bigint();\n\n logger.plain(\n `Processed ${pluralise(results.length, 'file')} in ${logger.timing(\n start,\n end,\n )}.`,\n );\n\n const errors: ESLintResult[] = [];\n const warnings: ESLintResult[] = [];\n let fixable = false;\n\n for (const result of results) {\n const relativePath = path.relative(cwd, result.filePath);\n if (result.fixableErrorCount + result.fixableWarningCount) {\n fixable = true;\n }\n\n if (result.errorCount) {\n errors.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n if (result.warningCount) {\n warnings.push({\n filePath: relativePath,\n messages: result.messages,\n });\n }\n\n logger.debug(symbolForResult(result), relativePath);\n }\n\n const ok = errors.length === 0;\n\n await ESLint.outputFixes(results);\n\n const output = await formatter.format(\n results,\n engine.getRulesMetaForResults(results),\n );\n\n if (output) {\n logger.plain(output);\n }\n\n return { errors, fixable, ok, output, warnings };\n};\n\nconst lintFiles = async (engine: ESLint) => {\n try {\n const result = await engine.lintFiles([]);\n return { type: 'results', results: result } as const;\n } catch (error) {\n if (\n error instanceof Error &&\n error.message === 'Could not find config file.'\n ) {\n return { type: 'no-config', results: undefined } as const;\n }\n throw error;\n }\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,mBAAkB;AAClB,oBAAqD;AAErD,qBAAuC;AAEvC,MAAM,kBAAkB,CAAC,WAA8B;AACrD,MAAI,OAAO,YAAY;AACrB,WAAO,aAAAA,QAAM,IAAI,QAAG;AAAA,EACtB;AAEA,SAAO,OAAO,eAAe,aAAAA,QAAM,OAAO,QAAG,IAAI,aAAAA,QAAM,MAAM,QAAG;AAClE;AAeO,MAAM,YAAY,OACvB,MACA,QACA,uBAC0B;AAC1B,SAAO,MAAM,wBAAwB;AAErC,QAAM,MAAM,QAAQ,IAAI;AAExB,QAAM,SAAS,UAAM,0BAAW,EAAE,eAAe,KAAK,CAAC;AACvD,QAAM,SAAS,IAAI,OAAO;AAAA,IACxB,OAAO;AAAA,IACP,KAAK,SAAS;AAAA,IACd;AAAA,IACA,gBAAgB;AAAA,MACd,eAAe;AAAA,QACb,+BAA+B;AAAA,MACjC;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO,MAAM,qBAAqB;AAElC,QAAM,QAAQ,QAAQ,OAAO,OAAO;AAEpC,QAAM,CA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WAAmB;AAC1C,MAAI;AACF,UAAM,SAAS,MAAM,OAAO,UAAU,CAAC,CAAC;AACxC,WAAO,EAAE,MAAM,WAAW,SAAS,OAAO;AAAA,EAC5C,SAAS,OAAO;AACd,QACE,iBAAiB,SACjB,MAAM,YAAY,+BAClB;AACA,aAAO,EAAE,MAAM,aAAa,SAAS,OAAU;AAAA,IACjD;AACA,UAAM;AAAA,EACR;AACF;",
6
6
  "names": ["chalk", "path"]
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import { type Options } from 'prettier';
2
- import { type Logger } from '../../utils/logging';
2
+ import { type Logger } from '../../utils/logging.js';
3
3
  /**
4
4
  * Infers a parser for the specified filepath.
5
5
  *
@@ -36,10 +36,10 @@ module.exports = __toCommonJS(prettier_exports);
36
36
  var import_path = __toESM(require("path"));
37
37
  var import_fs_extra = __toESM(require("fs-extra"));
38
38
  var import_prettier = require("prettier");
39
- var import_dir = require("../../utils/dir");
40
- var import_logging = require("../../utils/logging");
41
- var import_manifest = require("../../utils/manifest");
42
- var import_package = require("../configure/processing/package");
39
+ var import_dir = require("../../utils/dir.js");
40
+ var import_logging = require("../../utils/logging.js");
41
+ var import_manifest = require("../../utils/manifest.js");
42
+ var import_package = require("../configure/processing/package.js");
43
43
  let languages;
44
44
  const inferParser = async (filepath) => {
45
45
  const filename = import_path.default.basename(filepath).toLowerCase();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/adapter/prettier.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport {\n type Options,\n type SupportLanguage,\n check,\n format,\n getSupportInfo,\n resolveConfig,\n} from 'prettier';\n\nimport { crawlDirectory } from '../../utils/dir';\nimport { type Logger, pluralise } from '../../utils/logging';\nimport { getConsumerManifest } from '../../utils/manifest';\nimport { formatPackage, parsePackage } from '../configure/processing/package';\n\nlet languages: SupportLanguage[] | undefined;\n\n/**\n * Infers a parser for the specified filepath.\n *\n * This is a cut-down version of Prettier's built-in function of the same name;\n * ours operates purely on the `filepath` string and does not perform file I/O.\n * Prettier's internal `getInterpreter` function can open a file to read the\n * shebang, and its file descriptor usage can throw warnings on worker threads:\n *\n * ```console\n * Warning: File descriptor 123 closed but not opened in unmanaged mode\n * at Object.closeSync (node:fs:530:11)\n * at Object.closeSync (node_modules/graceful-fs/graceful-fs.js:74:20)\n * ...\n * ```\n *\n * References:\n *\n * - https://github.com/prettier/prettier/blob/2.4.1/src/main/options.js#L167\n * - seek-oss/skuba#659\n */\nexport const inferParser = async (\n filepath: string,\n): Promise<string | undefined> => {\n const filename = path.basename(filepath).toLowerCase();\n\n languages ??= (await getSupportInfo()).languages;\n\n const firstLanguage = languages.find(\n (language) =>\n language.extensions?.some((extension) => filename.endsWith(extension)) ||\n language.filenames?.some((name) => name.toLowerCase() === filename),\n );\n\n return firstLanguage?.parsers[0];\n};\n\nconst isPackageJsonOk = async ({\n data,\n filepath,\n}: {\n data: string;\n filepath: string;\n}): Promise<boolean> => {\n if (path.basename(filepath) !== 'package.json') {\n return true;\n }\n\n try {\n const packageJson = parsePackage(data);\n\n return !packageJson || (await formatPackage(packageJson)) === data;\n } catch {\n // Be more lenient about our custom formatting and don't throw if it errors.\n }\n\n return true;\n};\n\ninterface File {\n data: string;\n options: Options;\n filepath: string;\n}\n\ninterface Result {\n count: number;\n errored: Array<{ err?: unknown; filepath: string }>;\n touched: string[];\n unparsed: string[];\n}\n\nexport const formatOrLintFile = async (\n { data, filepath, options }: File,\n mode: 'format' | 'lint',\n result: Result | null,\n): Promise<string | undefined> => {\n if (mode === 'lint') {\n let ok: boolean;\n try {\n ok =\n (await check(data, options)) &&\n (await isPackageJsonOk({ data, filepath }));\n } catch (err) {\n result?.errored.push({ err, filepath });\n return;\n }\n\n if (!ok) {\n result?.errored.push({ filepath });\n }\n\n return;\n }\n\n let formatted: string;\n try {\n formatted = await format(data, options);\n } catch (err) {\n result?.errored.push({ err, filepath });\n return;\n }\n\n // Perform additional formatting (i.e. sorting) on a `package.json` manifest.\n try {\n if (path.basename(filepath) === 'package.json') {\n const packageJson = parsePackage(formatted);\n if (packageJson) {\n formatted = await formatPackage(packageJson);\n }\n }\n } catch {\n // Be more lenient about our custom formatting and don't throw if it errors.\n }\n\n if (formatted === data) {\n return;\n }\n\n result?.touched.push(filepath);\n return formatted;\n};\n\nexport interface PrettierOutput {\n ok: boolean;\n result: Result;\n}\n\n/**\n * Formats/lints files with Prettier.\n *\n * Prettier doesn't provide a higher-level Node.js API that replicates the\n * behaviour of its CLI, so we have to plumb together its lower-level functions.\n * On the other hand, this affords more flexibility in how we track and report\n * on progress and results.\n */\nexport const runPrettier = async (\n mode: 'format' | 'lint',\n logger: Logger,\n cwd = process.cwd(),\n): Promise<PrettierOutput> => {\n logger.debug('Initialising Prettier...');\n\n const start = process.hrtime.bigint();\n\n const manifest = await getConsumerManifest(cwd);\n\n const directory = manifest ? path.dirname(manifest.path) : cwd;\n\n logger.debug(\n manifest ? 'Detected project root:' : 'Detected working directory:',\n directory,\n );\n\n logger.debug('Discovering files...');\n\n // Match Prettier's opinion of respecting `.gitignore`.\n // This avoids exhibiting different behaviour than a Prettier IDE integration,\n // though it may present headaches if `.gitignore` and `.prettierignore` rules\n // conflict.\n const relativeFilepaths = await crawlDirectory(directory, [\n '.gitignore',\n '.prettierignore',\n ]);\n\n logger.debug(`Discovered ${pluralise(relativeFilepaths.length, 'file')}.`);\n\n const result: Result = {\n count: relativeFilepaths.length,\n errored: [],\n touched: [],\n unparsed: [],\n };\n\n logger.debug(mode === 'format' ? 'Formatting' : 'Linting', 'files...');\n\n for (const relativeFilepath of relativeFilepaths) {\n // Use relative paths to keep log output cleaner, particularly in the common\n // case where we are executing against the current working directory.\n const filepath = path.relative(\n process.cwd(),\n path.join(directory, relativeFilepath),\n );\n\n // Infer parser upfront so we can skip unsupported files.\n const parser = await inferParser(filepath);\n\n logger.debug(filepath);\n logger.debug(' parser:', parser ?? '-');\n\n if (!parser) {\n result.unparsed.push(filepath);\n continue;\n }\n\n const [config, data] = await Promise.all([\n resolveConfig(filepath),\n fs.promises.readFile(filepath, 'utf-8'),\n ]);\n\n const file: File = {\n data,\n filepath,\n options: { ...config, filepath },\n };\n\n const formatted = await formatOrLintFile(file, mode, result);\n\n if (typeof formatted === 'string') {\n await fs.promises.writeFile(filepath, formatted);\n }\n }\n\n const end = process.hrtime.bigint();\n\n logger.plain(\n `Processed ${pluralise(\n result.count - result.unparsed.length,\n 'file',\n )} in ${logger.timing(start, end)}.`,\n );\n\n if (result.touched.length) {\n logger.plain(`Formatted ${pluralise(result.touched.length, 'file')}:`);\n for (const filepath of result.touched) {\n logger.warn(filepath);\n }\n }\n\n if (result.errored.length) {\n logger.plain(`Flagged ${pluralise(result.errored.length, 'file')}:`);\n for (const { err, filepath } of result.errored) {\n logger.warn(\n filepath,\n ...(typeof err === 'string' || err instanceof Error\n ? [String(err)]\n : []),\n );\n }\n }\n\n return { ok: result.errored.length === 0, result };\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AACf,sBAOO;AAEP,iBAA+B;AAC/B,qBAAuC;AACvC,sBAAoC;AACpC,qBAA4C;AAE5C,IAAI;AAsBG,MAAM,cAAc,OACzB,aACgC;AAChC,QAAM,WAAW,YAAAA,QAAK,SAAS,QAAQ,EAAE,YAAY;AAErD,iBAAe,UAAM,gCAAe,GAAG;AAEvC,QAAM,gBAAgB,UAAU;AAAA,IAC9B,CAAC,aACC,SAAS,YAAY,KAAK,CAAC,cAAc,SAAS,SAAS,SAAS,CAAC,KACrE,SAAS,WAAW,KAAK,CAAC,SAAS,KAAK,YAAY,MAAM,QAAQ;AAAA,EACtE;AAEA,SAAO,eAAe,QAAQ,CAAC;AACjC;AAEA,MAAM,kBAAkB,OAAO;AAAA,EAC7B;AAAA,EACA;AACF,MAGwB;AACtB,MAAI,YAAAA,QAAK,SAAS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QAAQ,OAAO,SAAS;AAAA,MAC/B;AAAA,IACF,CAAC,OAAO,OAAO,OAAO,OAAO,GAAG,CAAC;AAAA,EACnC;AAEA,MAAI,OAAO,QAAQ,QAAQ;AACzB,WAAO,MAAM,iBAAa,0BAAU,OAAO,QAAQ,QAAQ,MAAM,CAAC,GAAG;AACrE,eAAW,YAAY,OAAO,SAAS;AACrC,aAAO,KAAK,QAAQ;AAAA,IACtB;AAAA,EACF;AAEA,MAAI,OAAO,QAAQ,QAAQ;AACzB,WAAO,MAAM,eAAW,0BAAU,OAAO,QAAQ,QAAQ,MAAM,CAAC,GAAG;AACnE,eAAW,EAAE,KAAK,SAAS,KAAK,OAAO,SAAS;AAC9C,aAAO;AAAA,QACL;AAAA,QACA,GAAI,OAAO,QAAQ,YAAY,eAAe,QAC1C,CAAC,OAAO,GAAG,CAAC,IACZ,CAAC;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,IAAI,OAAO,QAAQ,WAAW,GAAG,OAAO;AACnD;",
4
+ "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport {\n type Options,\n type SupportLanguage,\n check,\n format,\n getSupportInfo,\n resolveConfig,\n} from 'prettier';\n\nimport { crawlDirectory } from '../../utils/dir.js';\nimport { type Logger, pluralise } from '../../utils/logging.js';\nimport { getConsumerManifest } from '../../utils/manifest.js';\nimport {\n formatPackage,\n parsePackage,\n} from '../configure/processing/package.js';\n\nlet languages: SupportLanguage[] | undefined;\n\n/**\n * Infers a parser for the specified filepath.\n *\n * This is a cut-down version of Prettier's built-in function of the same name;\n * ours operates purely on the `filepath` string and does not perform file I/O.\n * Prettier's internal `getInterpreter` function can open a file to read the\n * shebang, and its file descriptor usage can throw warnings on worker threads:\n *\n * ```console\n * Warning: File descriptor 123 closed but not opened in unmanaged mode\n * at Object.closeSync (node:fs:530:11)\n * at Object.closeSync (node_modules/graceful-fs/graceful-fs.js:74:20)\n * ...\n * ```\n *\n * References:\n *\n * - https://github.com/prettier/prettier/blob/2.4.1/src/main/options.js#L167\n * - seek-oss/skuba#659\n */\nexport const inferParser = async (\n filepath: string,\n): Promise<string | undefined> => {\n const filename = path.basename(filepath).toLowerCase();\n\n languages ??= (await getSupportInfo()).languages;\n\n const firstLanguage = languages.find(\n (language) =>\n language.extensions?.some((extension) => filename.endsWith(extension)) ||\n language.filenames?.some((name) => name.toLowerCase() === filename),\n );\n\n return firstLanguage?.parsers[0];\n};\n\nconst isPackageJsonOk = async ({\n data,\n filepath,\n}: {\n data: string;\n filepath: string;\n}): Promise<boolean> => {\n if (path.basename(filepath) !== 'package.json') {\n return true;\n }\n\n try {\n const packageJson = parsePackage(data);\n\n return !packageJson || (await formatPackage(packageJson)) === data;\n } catch {\n // Be more lenient about our custom formatting and don't throw if it errors.\n }\n\n return true;\n};\n\ninterface File {\n data: string;\n options: Options;\n filepath: string;\n}\n\ninterface Result {\n count: number;\n errored: Array<{ err?: unknown; filepath: string }>;\n touched: string[];\n unparsed: string[];\n}\n\nexport const formatOrLintFile = async (\n { data, filepath, options }: File,\n mode: 'format' | 'lint',\n result: Result | null,\n): Promise<string | undefined> => {\n if (mode === 'lint') {\n let ok: boolean;\n try {\n ok =\n (await check(data, options)) &&\n (await isPackageJsonOk({ data, filepath }));\n } catch (err) {\n result?.errored.push({ err, filepath });\n return;\n }\n\n if (!ok) {\n result?.errored.push({ filepath });\n }\n\n return;\n }\n\n let formatted: string;\n try {\n formatted = await format(data, options);\n } catch (err) {\n result?.errored.push({ err, filepath });\n return;\n }\n\n // Perform additional formatting (i.e. sorting) on a `package.json` manifest.\n try {\n if (path.basename(filepath) === 'package.json') {\n const packageJson = parsePackage(formatted);\n if (packageJson) {\n formatted = await formatPackage(packageJson);\n }\n }\n } catch {\n // Be more lenient about our custom formatting and don't throw if it errors.\n }\n\n if (formatted === data) {\n return;\n }\n\n result?.touched.push(filepath);\n return formatted;\n};\n\nexport interface PrettierOutput {\n ok: boolean;\n result: Result;\n}\n\n/**\n * Formats/lints files with Prettier.\n *\n * Prettier doesn't provide a higher-level Node.js API that replicates the\n * behaviour of its CLI, so we have to plumb together its lower-level functions.\n * On the other hand, this affords more flexibility in how we track and report\n * on progress and results.\n */\nexport const runPrettier = async (\n mode: 'format' | 'lint',\n logger: Logger,\n cwd = process.cwd(),\n): Promise<PrettierOutput> => {\n logger.debug('Initialising Prettier...');\n\n const start = process.hrtime.bigint();\n\n const manifest = await getConsumerManifest(cwd);\n\n const directory = manifest ? path.dirname(manifest.path) : cwd;\n\n logger.debug(\n manifest ? 'Detected project root:' : 'Detected working directory:',\n directory,\n );\n\n logger.debug('Discovering files...');\n\n // Match Prettier's opinion of respecting `.gitignore`.\n // This avoids exhibiting different behaviour than a Prettier IDE integration,\n // though it may present headaches if `.gitignore` and `.prettierignore` rules\n // conflict.\n const relativeFilepaths = await crawlDirectory(directory, [\n '.gitignore',\n '.prettierignore',\n ]);\n\n logger.debug(`Discovered ${pluralise(relativeFilepaths.length, 'file')}.`);\n\n const result: Result = {\n count: relativeFilepaths.length,\n errored: [],\n touched: [],\n unparsed: [],\n };\n\n logger.debug(mode === 'format' ? 'Formatting' : 'Linting', 'files...');\n\n for (const relativeFilepath of relativeFilepaths) {\n // Use relative paths to keep log output cleaner, particularly in the common\n // case where we are executing against the current working directory.\n const filepath = path.relative(\n process.cwd(),\n path.join(directory, relativeFilepath),\n );\n\n // Infer parser upfront so we can skip unsupported files.\n const parser = await inferParser(filepath);\n\n logger.debug(filepath);\n logger.debug(' parser:', parser ?? '-');\n\n if (!parser) {\n result.unparsed.push(filepath);\n continue;\n }\n\n const [config, data] = await Promise.all([\n resolveConfig(filepath),\n fs.promises.readFile(filepath, 'utf-8'),\n ]);\n\n const file: File = {\n data,\n filepath,\n options: { ...config, filepath },\n };\n\n const formatted = await formatOrLintFile(file, mode, result);\n\n if (typeof formatted === 'string') {\n await fs.promises.writeFile(filepath, formatted);\n }\n }\n\n const end = process.hrtime.bigint();\n\n logger.plain(\n `Processed ${pluralise(\n result.count - result.unparsed.length,\n 'file',\n )} in ${logger.timing(start, end)}.`,\n );\n\n if (result.touched.length) {\n logger.plain(`Formatted ${pluralise(result.touched.length, 'file')}:`);\n for (const filepath of result.touched) {\n logger.warn(filepath);\n }\n }\n\n if (result.errored.length) {\n logger.plain(`Flagged ${pluralise(result.errored.length, 'file')}:`);\n for (const { err, filepath } of result.errored) {\n logger.warn(\n filepath,\n ...(typeof err === 'string' || err instanceof Error\n ? [String(err)]\n : []),\n );\n }\n }\n\n return { ok: result.errored.length === 0, result };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AACf,sBAOO;AAEP,iBAA+B;AAC/B,qBAAuC;AACvC,sBAAoC;AACpC,qBAGO;AAEP,IAAI;AAsBG,MAAM,cAAc,OACzB,aACgC;AAChC,QAAM,WAAW,YAAAA,QAAK,SAAS,QAAQ,EAAE,YAAY;AAErD,iBAAe,UAAM,gCAAe,GAAG;AAEvC,QAAM,gBAAgB,UAAU;AAAA,IAC9B,CAAC,aACC,SAAS,YAAY,KAAK,CAAC,cAAc,SAAS,SAAS,SAAS,CAAC,KACrE,SAAS,WAAW,KAAK,CAAC,SAAS,KAAK,YAAY,MAAM,QAAQ;AAAA,EACtE;AAEA,SAAO,eAAe,QAAQ,CAAC;AACjC;AAEA,MAAM,kBAAkB,OAAO;AAAA,EAC7B;AAAA,EACA;AACF,MAGwB;AACtB,MAAI,YAAAA,QAAK,SAAS,QAAQ,MAAM,gBAAgB;AAC9C,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,kBAAc,6BAAa,IAAI;AAErC,WAAO,CAAC,eAAgB,UAAM,8BAAc,WAAW,MAAO;AAAA,EAChE,QAAQ;AAAA,EAER;AAEA,SAAO;AACT;AAeO,MAAM,mBAAmB,OAC9B,EAAE,MAAM,UAAU,QAAQ,GAC1B,MACA,WACgC;AAChC,MAAI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AAA,EACF;AAEA,MAAI,OAAO,QAAQ,QAAQ;AACzB,WAAO,MAAM,eAAW,0BAAU,OAAO,QAAQ,QAAQ,MAAM,CAAC,GAAG;AACnE,eAAW,EAAE,KAAK,SAAS,KAAK,OAAO,SAAS;AAC9C,aAAO;AAAA,QACL;AAAA,QACA,GAAI,OAAO,QAAQ,YAAY,eAAe,QAC1C,CAAC,OAAO,GAAG,CAAC,IACZ,CAAC;AAAA,MACP;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,IAAI,OAAO,QAAQ,WAAW,GAAG,OAAO;AACnD;",
6
6
  "names": ["path", "fs"]
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import { type Color } from 'chalk';
2
- import { type Logger } from '../../utils/logging';
2
+ import { type Logger } from '../../utils/logging.js';
3
3
  export declare const copyAssets: (destinationDir: string, logger?: Logger) => Promise<void>;
4
4
  interface CopyAssetsConfig {
5
5
  outDir: string;
@@ -35,10 +35,10 @@ module.exports = __toCommonJS(assets_exports);
35
35
  var import_path = __toESM(require("path"));
36
36
  var import_chalk = __toESM(require("chalk"));
37
37
  var import_fs_extra = __toESM(require("fs-extra"));
38
- var import_copy = require("../../utils/copy");
39
- var import_dir = require("../../utils/dir");
40
- var import_logging = require("../../utils/logging");
41
- var import_manifest = require("../../utils/manifest");
38
+ var import_copy = require("../../utils/copy.js");
39
+ var import_dir = require("../../utils/dir.js");
40
+ var import_logging = require("../../utils/logging.js");
41
+ var import_manifest = require("../../utils/manifest.js");
42
42
  const copyAssets = async (destinationDir, logger = import_logging.log) => {
43
43
  const manifest = await (0, import_manifest.getConsumerManifest)();
44
44
  if (!manifest) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/build/assets.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport chalk, { type Color } from 'chalk';\nimport fs from 'fs-extra';\n\nimport { copyFile } from '../../utils/copy';\nimport { buildPatternToFilepathMap, crawlDirectory } from '../../utils/dir';\nimport { type Logger, createLogger, log } from '../../utils/logging';\nimport {\n getConsumerManifest,\n getEntryPointFromManifest,\n getPropFromConsumerManifest,\n} from '../../utils/manifest';\n\nexport const copyAssets = async (\n destinationDir: string,\n logger: Logger = log,\n) => {\n const manifest = await getConsumerManifest();\n if (!manifest) {\n return;\n }\n\n const assets = await getPropFromConsumerManifest<string, string[]>('assets');\n if (!assets) {\n return;\n }\n\n const entryPoint = await getEntryPointFromManifest();\n if (!entryPoint) {\n return;\n }\n\n const pathSegments = entryPoint.split(path.sep);\n const srcDir = (pathSegments.length > 1 && pathSegments[0]) || '';\n const resolvedSrcDir = path.resolve(path.dirname(manifest.path), srcDir);\n const resolvedDestinationDir = path.resolve(\n path.dirname(manifest.path),\n destinationDir,\n );\n\n const allFiles = await crawlDirectory(resolvedSrcDir);\n const filesByPattern = buildPatternToFilepathMap(assets, allFiles, {\n cwd: resolvedSrcDir,\n dot: true,\n });\n const matchedFiles = Array.from(\n new Set(Object.values(filesByPattern).flat()),\n );\n\n await Promise.all(\n matchedFiles.map(async (filename) => {\n logger.subtle(`Copying ${filename}`);\n\n await fs.promises.mkdir(\n path.dirname(path.join(resolvedDestinationDir, filename)),\n { recursive: true },\n );\n await copyFile(\n path.join(resolvedSrcDir, filename),\n path.join(resolvedDestinationDir, filename),\n { processors: [] },\n );\n }),\n );\n};\n\ninterface CopyAssetsConfig {\n outDir: string;\n name: string;\n prefixColor: typeof Color;\n}\n\nexport const copyAssetsConcurrently = async (configs: CopyAssetsConfig[]) => {\n const maxNameLength = configs.reduce(\n (length, command) => Math.max(length, command.name.length),\n 0,\n );\n\n await Promise.all(\n configs.map(({ outDir, name, prefixColor }) =>\n copyAssets(\n outDir,\n createLogger({\n debug: false,\n prefixes: [chalk[prefixColor](`${name.padEnd(maxNameLength)} \u2502`)],\n }),\n ),\n ),\n );\n};\n"],
4
+ "sourcesContent": ["import path from 'path';\n\nimport chalk, { type Color } from 'chalk';\nimport fs from 'fs-extra';\n\nimport { copyFile } from '../../utils/copy.js';\nimport { buildPatternToFilepathMap, crawlDirectory } from '../../utils/dir.js';\nimport { type Logger, createLogger, log } from '../../utils/logging.js';\nimport {\n getConsumerManifest,\n getEntryPointFromManifest,\n getPropFromConsumerManifest,\n} from '../../utils/manifest.js';\n\nexport const copyAssets = async (\n destinationDir: string,\n logger: Logger = log,\n) => {\n const manifest = await getConsumerManifest();\n if (!manifest) {\n return;\n }\n\n const assets = await getPropFromConsumerManifest<string, string[]>('assets');\n if (!assets) {\n return;\n }\n\n const entryPoint = await getEntryPointFromManifest();\n if (!entryPoint) {\n return;\n }\n\n const pathSegments = entryPoint.split(path.sep);\n const srcDir = (pathSegments.length > 1 && pathSegments[0]) || '';\n const resolvedSrcDir = path.resolve(path.dirname(manifest.path), srcDir);\n const resolvedDestinationDir = path.resolve(\n path.dirname(manifest.path),\n destinationDir,\n );\n\n const allFiles = await crawlDirectory(resolvedSrcDir);\n const filesByPattern = buildPatternToFilepathMap(assets, allFiles, {\n cwd: resolvedSrcDir,\n dot: true,\n });\n const matchedFiles = Array.from(\n new Set(Object.values(filesByPattern).flat()),\n );\n\n await Promise.all(\n matchedFiles.map(async (filename) => {\n logger.subtle(`Copying ${filename}`);\n\n await fs.promises.mkdir(\n path.dirname(path.join(resolvedDestinationDir, filename)),\n { recursive: true },\n );\n await copyFile(\n path.join(resolvedSrcDir, filename),\n path.join(resolvedDestinationDir, filename),\n { processors: [] },\n );\n }),\n );\n};\n\ninterface CopyAssetsConfig {\n outDir: string;\n name: string;\n prefixColor: typeof Color;\n}\n\nexport const copyAssetsConcurrently = async (configs: CopyAssetsConfig[]) => {\n const maxNameLength = configs.reduce(\n (length, command) => Math.max(length, command.name.length),\n 0,\n );\n\n await Promise.all(\n configs.map(({ outDir, name, prefixColor }) =>\n copyAssets(\n outDir,\n createLogger({\n debug: false,\n prefixes: [chalk[prefixColor](`${name.padEnd(maxNameLength)} \u2502`)],\n }),\n ),\n ),\n );\n};\n"],
5
5
  "mappings": ";;;;;;;;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KAAK,gBAAgB,QAAQ;AAAA,QAClC,YAAAA,QAAK,KAAK,wBAAwB,QAAQ;AAAA,QAC1C,EAAE,YAAY,CAAC,EAAE;AAAA,MACnB;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAQO,MAAM,yBAAyB,OAAO,YAAgC;AAC3E,QAAM,gBAAgB,QAAQ;AAAA,IAC5B,CAAC,QAAQ,YAAY,KAAK,IAAI,QAAQ,QAAQ,KAAK,MAAM;AAAA,IACzD;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,QAAQ;AAAA,MAAI,CAAC,EAAE,QAAQ,MAAM,YAAY,MACvC;AAAA,QACE;AAAA,YACA,6BAAa;AAAA,UACX,OAAO;AAAA,UACP,UAAU,CAAC,aAAAE,QAAM,WAAW,EAAE,GAAG,KAAK,OAAO,aAAa,CAAC,SAAI,CAAC;AAAA,QAClE,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": ["path", "fs", "chalk"]
7
7
  }
@@ -35,9 +35,9 @@ var import_util = require("util");
35
35
  var import_tsconfig_paths = __toESM(require("@esbuild-plugins/tsconfig-paths"));
36
36
  var import_esbuild = require("esbuild");
37
37
  var import_typescript = require("typescript");
38
- var import_logging = require("../../utils/logging");
39
- var import_args = require("./args");
40
- var import_tsc = require("./tsc");
38
+ var import_logging = require("../../utils/logging.js");
39
+ var import_args = require("./args.js");
40
+ var import_tsc = require("./tsc.js");
41
41
  const esbuild = async ({ debug }, args = process.argv.slice(2)) => {
42
42
  const log = (0, import_logging.createLogger)({ debug });
43
43
  const tscArgs = (0, import_args.parseTscArgs)(args);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/build/esbuild.ts"],
4
- "sourcesContent": ["import { inspect } from 'util';\n\nimport tsconfigPaths from '@esbuild-plugins/tsconfig-paths';\nimport { build } from 'esbuild';\nimport { ModuleKind, ModuleResolutionKind, ScriptTarget } from 'typescript';\n\nimport { createLogger } from '../../utils/logging';\n\nimport { parseTscArgs } from './args';\nimport { readTsconfig, tsc } from './tsc';\n\ninterface EsbuildParameters {\n debug: boolean;\n}\n\nexport const esbuild = async (\n { debug }: EsbuildParameters,\n args = process.argv.slice(2),\n) => {\n const log = createLogger({ debug });\n\n const tscArgs = parseTscArgs(args);\n\n if (tscArgs.build) {\n log.err(\n 'skuba does not currently support the tsc --build flag with esbuild',\n );\n process.exitCode = 1;\n return;\n }\n\n const parsedCommandLine = readTsconfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { fileNames: entryPoints, options: compilerOptions } =\n parsedCommandLine;\n\n log.debug(log.bold('Files'));\n entryPoints.forEach((filepath) => log.debug(filepath));\n\n log.debug(log.bold('Compiler options'));\n log.debug(inspect(compilerOptions));\n\n const start = process.hrtime.bigint();\n\n // TODO: support `bundle`, `minify`, `splitting`, `treeShaking`\n const bundle = false;\n\n await build({\n bundle,\n entryPoints,\n format: compilerOptions.module === ModuleKind.CommonJS ? 'cjs' : undefined,\n outdir: compilerOptions.outDir,\n logLevel: debug ? 'debug' : 'info',\n logLimit: 0,\n platform:\n compilerOptions.moduleResolution === ModuleResolutionKind.NodeJs\n ? 'node'\n : undefined,\n plugins: bundle\n ? []\n : [\n // evanw/esbuild#394\n tsconfigPaths({\n tsconfig: { baseUrl: compilerOptions.baseUrl, compilerOptions },\n }),\n ],\n sourcemap: compilerOptions.sourceMap,\n // TODO: as of 0.18, the esbuild CLI no longer infers the target property to\n // avoid ambiguity where multiple `tsconfig.json`s are involved in a build.\n // This would be unusual for a typical SEEK project but we can still explore\n // an explicit setting once we implement `skuba.config.ts` (#1167).\n target: compilerOptions.target\n ? ScriptTarget[compilerOptions.target].toLocaleLowerCase()\n : undefined,\n tsconfig: tscArgs.pathname,\n });\n\n const end = process.hrtime.bigint();\n\n log.plain(`Built in ${log.timing(start, end)}.`);\n\n if (compilerOptions.declaration) {\n await tsc([\n '--declaration',\n '--emitDeclarationOnly',\n ...(tscArgs.project ? ['--project', tscArgs.project] : []),\n ]);\n }\n};\n"],
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport tsconfigPaths from '@esbuild-plugins/tsconfig-paths';\nimport { build } from 'esbuild';\nimport { ModuleKind, ModuleResolutionKind, ScriptTarget } from 'typescript';\n\nimport { createLogger } from '../../utils/logging.js';\n\nimport { parseTscArgs } from './args.js';\nimport { readTsconfig, tsc } from './tsc.js';\n\ninterface EsbuildParameters {\n debug: boolean;\n}\n\nexport const esbuild = async (\n { debug }: EsbuildParameters,\n args = process.argv.slice(2),\n) => {\n const log = createLogger({ debug });\n\n const tscArgs = parseTscArgs(args);\n\n if (tscArgs.build) {\n log.err(\n 'skuba does not currently support the tsc --build flag with esbuild',\n );\n process.exitCode = 1;\n return;\n }\n\n const parsedCommandLine = readTsconfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { fileNames: entryPoints, options: compilerOptions } =\n parsedCommandLine;\n\n log.debug(log.bold('Files'));\n entryPoints.forEach((filepath) => log.debug(filepath));\n\n log.debug(log.bold('Compiler options'));\n log.debug(inspect(compilerOptions));\n\n const start = process.hrtime.bigint();\n\n // TODO: support `bundle`, `minify`, `splitting`, `treeShaking`\n const bundle = false;\n\n await build({\n bundle,\n entryPoints,\n format: compilerOptions.module === ModuleKind.CommonJS ? 'cjs' : undefined,\n outdir: compilerOptions.outDir,\n logLevel: debug ? 'debug' : 'info',\n logLimit: 0,\n platform:\n compilerOptions.moduleResolution === ModuleResolutionKind.NodeJs\n ? 'node'\n : undefined,\n plugins: bundle\n ? []\n : [\n // evanw/esbuild#394\n tsconfigPaths({\n tsconfig: { baseUrl: compilerOptions.baseUrl, compilerOptions },\n }),\n ],\n sourcemap: compilerOptions.sourceMap,\n // TODO: as of 0.18, the esbuild CLI no longer infers the target property to\n // avoid ambiguity where multiple `tsconfig.json`s are involved in a build.\n // This would be unusual for a typical SEEK project but we can still explore\n // an explicit setting once we implement `skuba.config.ts` (#1167).\n target: compilerOptions.target\n ? ScriptTarget[compilerOptions.target].toLocaleLowerCase()\n : undefined,\n tsconfig: tscArgs.pathname,\n });\n\n const end = process.hrtime.bigint();\n\n log.plain(`Built in ${log.timing(start, end)}.`);\n\n if (compilerOptions.declaration) {\n await tsc([\n '--declaration',\n '--emitDeclarationOnly',\n ...(tscArgs.project ? ['--project', tscArgs.project] : []),\n ]);\n }\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,4BAA0B;AAC1B,qBAAsB;AACtB,wBAA+D;AAE/D,qBAA6B;AAE7B,kBAA6B;AAC7B,iBAAkC;AAM3B,MAAM,UAAU,OACrB,EAAE,MAAM,GACR,OAAO,QAAQ,KAAK,MAAM,CAAC,MACxB;AACH,QAAM,UAAM,6BAAa,EAAE,MAAM,CAAC;AAElC,QAAM,cAAU,0BAAa,IAAI;AAEjC,MAAI,QAAQ,OAAO;AACjB,QAAI;AAAA,MACF;AAAA,IACF;AACA,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,QAAM,wBAAoB,yBAAa,MAAM,GAAG;AAEhD,MAAI,CAAC,qBAAqB,QAAQ,UAAU;AAC1C;AAAA,EACF;AAEA,QAAM,EAAE,WAAW,aAAa,SAAS,gBAAgB,IACvD;AAEF,MAAI,MAAM,IAAI,KAAK,OAAO,CAAC;AAC3B,cAAY,QAAQ,CAAC,aAAa,IAAI,MAAM,QAAQ,CAAC;AAErD,MAAI,MAAM,IAAI,KAAK,kBAAkB,CAAC;AACtC,MAAI,UAAM,qBAAQ,eAAe,CAAC;AAElC,QAAM,QAAQ,QAAQ,OAAO,OAAO;AAGpC,QAAM,SAAS;AAEf,YAAM,sBAAM;AAAA,IACV;AAAA,IACA;AAAA,IACA,QAAQ,gBAAgB,WAAW,6BAAW,WAAW,QAAQ;AAAA,IACjE,QAAQ,gBAAgB;AAAA,IACxB,UAAU,QAAQ,UAAU;AAAA,IAC5B,UAAU;AAAA,IACV,UACE,gBAAgB,qBAAqB,uCAAqB,SACtD,SACA;AAAA,IACN,SAAS,SACL,CAAC,IACD;AAAA;AAAA,UAEE,sBAAAA,SAAc;AAAA,QACZ,UAAU,EAAE,SAAS,gBAAgB,SAAS,gBAAgB;AAAA,MAChE,CAAC;AAAA,IACH;AAAA,IACJ,WAAW,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,IAK3B,QAAQ,gBAAgB,SACpB,+BAAa,gBAAgB,MAAM,EAAE,kBAAkB,IACvD;AAAA,IACJ,UAAU,QAAQ;AAAA,EACpB,CAAC;AAED,QAAM,MAAM,QAAQ,OAAO,OAAO;AAElC,MAAI,MAAM,YAAY,IAAI,OAAO,OAAO,GAAG,CAAC,GAAG;AAE/C,MAAI,gBAAgB,aAAa;AAC/B,cAAM,gBAAI;AAAA,MACR;AAAA,MACA;AAAA,MACA,GAAI,QAAQ,UAAU,CAAC,aAAa,QAAQ,OAAO,IAAI,CAAC;AAAA,IAC1D,CAAC;AAAA,EACH;AACF;",
6
6
  "names": ["tsconfigPaths"]
7
7
  }
@@ -32,12 +32,12 @@ __export(build_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(build_exports);
34
34
  var import_chalk = __toESM(require("chalk"));
35
- var import_args = require("../../utils/args");
36
- var import_logging = require("../../utils/logging");
37
- var import_manifest = require("../../utils/manifest");
38
- var import_assets = require("./assets");
39
- var import_esbuild = require("./esbuild");
40
- var import_tsc = require("./tsc");
35
+ var import_args = require("../../utils/args.js");
36
+ var import_logging = require("../../utils/logging.js");
37
+ var import_manifest = require("../../utils/manifest.js");
38
+ var import_assets = require("./assets.js");
39
+ var import_esbuild = require("./esbuild.js");
40
+ var import_tsc = require("./tsc.js");
41
41
  const build = async (args = process.argv.slice(2)) => {
42
42
  const tool = await (0, import_manifest.getStringPropFromConsumerManifest)("build");
43
43
  switch (tool) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/build/index.ts"],
4
- "sourcesContent": ["import chalk from 'chalk';\n\nimport { hasDebugFlag } from '../../utils/args';\nimport { log } from '../../utils/logging';\nimport { getStringPropFromConsumerManifest } from '../../utils/manifest';\n\nimport { copyAssets } from './assets';\nimport { esbuild } from './esbuild';\nimport { readTsconfig, tsc } from './tsc';\n\nexport const build = async (args = process.argv.slice(2)) => {\n // TODO: define a unified `package.json#/skuba` schema and parser so we don't\n // need all these messy lookups.\n const tool = await getStringPropFromConsumerManifest('build');\n\n switch (tool) {\n case 'esbuild': {\n const debug = hasDebugFlag(args);\n\n log.plain(chalk.yellow('esbuild'));\n await esbuild({ debug }, args);\n break;\n }\n\n // TODO: flip the default case over to `esbuild` in skuba vNext.\n case undefined:\n case 'tsc': {\n log.plain(chalk.blue('tsc'));\n await tsc(args);\n break;\n }\n\n default: {\n log.err(\n 'We don\u2019t support the build tool specified in your',\n log.bold('package.json'),\n 'yet:',\n );\n log.err(log.subtle(JSON.stringify({ skuba: { build: tool } }, null, 2)));\n process.exitCode = 1;\n return;\n }\n }\n\n const parsedCommandLine = readTsconfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { options: compilerOptions } = parsedCommandLine;\n\n if (!compilerOptions.outDir) {\n return;\n }\n\n await copyAssets(compilerOptions.outDir);\n};\n"],
4
+ "sourcesContent": ["import chalk from 'chalk';\n\nimport { hasDebugFlag } from '../../utils/args.js';\nimport { log } from '../../utils/logging.js';\nimport { getStringPropFromConsumerManifest } from '../../utils/manifest.js';\n\nimport { copyAssets } from './assets.js';\nimport { esbuild } from './esbuild.js';\nimport { readTsconfig, tsc } from './tsc.js';\n\nexport const build = async (args = process.argv.slice(2)) => {\n // TODO: define a unified `package.json#/skuba` schema and parser so we don't\n // need all these messy lookups.\n const tool = await getStringPropFromConsumerManifest('build');\n\n switch (tool) {\n case 'esbuild': {\n const debug = hasDebugFlag(args);\n\n log.plain(chalk.yellow('esbuild'));\n await esbuild({ debug }, args);\n break;\n }\n\n // TODO: flip the default case over to `esbuild` in skuba vNext.\n case undefined:\n case 'tsc': {\n log.plain(chalk.blue('tsc'));\n await tsc(args);\n break;\n }\n\n default: {\n log.err(\n 'We don\u2019t support the build tool specified in your',\n log.bold('package.json'),\n 'yet:',\n );\n log.err(log.subtle(JSON.stringify({ skuba: { build: tool } }, null, 2)));\n process.exitCode = 1;\n return;\n }\n }\n\n const parsedCommandLine = readTsconfig(args, log);\n\n if (!parsedCommandLine || process.exitCode) {\n return;\n }\n\n const { options: compilerOptions } = parsedCommandLine;\n\n if (!compilerOptions.outDir) {\n return;\n }\n\n await copyAssets(compilerOptions.outDir);\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,kBAA6B;AAC7B,qBAAoB;AACpB,sBAAkD;AAElD,oBAA2B;AAC3B,qBAAwB;AACxB,iBAAkC;AAE3B,MAAM,QAAQ,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAG3D,QAAM,OAAO,UAAM,mDAAkC,OAAO;AAE5D,UAAQ,MAAM;AAAA,IACZ,KAAK,WAAW;AACd,YAAM,YAAQ,0BAAa,IAAI;AAE/B,yBAAI,MAAM,aAAAA,QAAM,OAAO,SAAS,CAAC;AACjC,gBAAM,wBAAQ,EAAE,MAAM,GAAG,IAAI;AAC7B;AAAA,IACF;AAAA;AAAA,IAGA,KAAK;AAAA,IACL,KAAK,OAAO;AACV,yBAAI,MAAM,aAAAA,QAAM,KAAK,KAAK,CAAC;AAC3B,gBAAM,gBAAI,IAAI;AACd;AAAA,IACF;AAAA,IAEA,SAAS;AACP,yBAAI;AAAA,QACF;AAAA,QACA,mBAAI,KAAK,cAAc;AAAA,QACvB;AAAA,MACF;AACA,yBAAI,IAAI,mBAAI,OAAO,KAAK,UAAU,EAAE,OAAO,EAAE,OAAO,KAAK,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;AACvE,cAAQ,WAAW;AACnB;AAAA,IACF;AAAA,EACF;AAEA,QAAM,wBAAoB,yBAAa,MAAM,kBAAG;AAEhD,MAAI,CAAC,qBAAqB,QAAQ,UAAU;AAC1C;AAAA,EACF;AAEA,QAAM,EAAE,SAAS,gBAAgB,IAAI;AAErC,MAAI,CAAC,gBAAgB,QAAQ;AAC3B;AAAA,EACF;AAEA,YAAM,0BAAW,gBAAgB,MAAM;AACzC;",
6
6
  "names": ["chalk"]
7
7
  }
@@ -1,4 +1,4 @@
1
1
  import ts from 'typescript';
2
- import type { Logger } from '../../utils/logging';
2
+ import type { Logger } from '../../utils/logging.js';
3
3
  export declare const tsc: (args?: string[]) => Promise<import("execa").ExecaReturnValue<string>>;
4
4
  export declare const readTsconfig: (args: string[] | undefined, log: Logger) => ts.ParsedCommandLine | undefined;
@@ -33,8 +33,8 @@ __export(tsc_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(tsc_exports);
35
35
  var import_typescript = __toESM(require("typescript"));
36
- var import_exec = require("../../utils/exec");
37
- var import_args = require("./args");
36
+ var import_exec = require("../../utils/exec.js");
37
+ var import_args = require("./args.js");
38
38
  const DEFAULT_ARGS = ["--project", "tsconfig.build.json"];
39
39
  const formatHost = {
40
40
  getCanonicalFileName: (fileName) => fileName,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/build/tsc.ts"],
4
- "sourcesContent": ["import ts from 'typescript';\n\nimport { exec } from '../../utils/exec';\nimport type { Logger } from '../../utils/logging';\n\nimport { parseTscArgs } from './args';\n\nconst DEFAULT_ARGS = ['--project', 'tsconfig.build.json'] as const;\n\nconst formatHost: ts.FormatDiagnosticsHost = {\n getCanonicalFileName: (fileName) => fileName,\n getCurrentDirectory: ts.sys.getCurrentDirectory.bind(undefined),\n getNewLine: () => ts.sys.newLine,\n};\n\nconst tsconfigCache = new Map<string, ts.ParsedCommandLine>();\nconst computeCacheKey = (args: string[]) => Array.from(args).sort().toString();\n\nexport const tsc = async (args = process.argv.slice(2)) => {\n const tscArgs = parseTscArgs(args);\n\n // Build flag is incompatible with project flag.\n const defaultArgs = tscArgs.build || tscArgs.project ? [] : DEFAULT_ARGS;\n\n return exec('tsc', ...defaultArgs, ...args);\n};\n\nexport const readTsconfig = (args = process.argv.slice(2), log: Logger) => {\n const tscArgs = parseTscArgs(args);\n\n let parsedCommandLine = tsconfigCache.get(computeCacheKey(args));\n\n if (!parsedCommandLine) {\n log.debug(\n log.bold(\n 'tsconfig',\n ...(tscArgs.project ? ['--project', tscArgs.project] : []),\n ),\n );\n log.debug(tscArgs.pathname);\n\n const tsconfigFile = ts.findConfigFile(\n tscArgs.dirname,\n ts.sys.fileExists.bind(undefined),\n tscArgs.basename,\n );\n if (!tsconfigFile) {\n log.err(`Could not find ${tscArgs.pathname}.`);\n process.exitCode = 1;\n return;\n }\n\n const readConfigFile = ts.readConfigFile(\n tsconfigFile,\n ts.sys.readFile.bind(undefined),\n );\n if (readConfigFile.error) {\n log.err(`Could not read ${tscArgs.pathname}.`);\n log.subtle(ts.formatDiagnostic(readConfigFile.error, formatHost));\n process.exitCode = 1;\n return;\n }\n\n parsedCommandLine = ts.parseJsonConfigFileContent(\n readConfigFile.config,\n ts.sys,\n tscArgs.dirname,\n );\n tsconfigCache.set(computeCacheKey(args), parsedCommandLine);\n }\n\n if (parsedCommandLine.errors.length) {\n log.err(`Could not parse ${tscArgs.pathname}.`);\n log.subtle(ts.formatDiagnostics(parsedCommandLine.errors, formatHost));\n process.exitCode = 1;\n return;\n }\n\n return parsedCommandLine;\n};\n"],
4
+ "sourcesContent": ["import ts from 'typescript';\n\nimport { exec } from '../../utils/exec.js';\nimport type { Logger } from '../../utils/logging.js';\n\nimport { parseTscArgs } from './args.js';\n\nconst DEFAULT_ARGS = ['--project', 'tsconfig.build.json'] as const;\n\nconst formatHost: ts.FormatDiagnosticsHost = {\n getCanonicalFileName: (fileName) => fileName,\n getCurrentDirectory: ts.sys.getCurrentDirectory.bind(undefined),\n getNewLine: () => ts.sys.newLine,\n};\n\nconst tsconfigCache = new Map<string, ts.ParsedCommandLine>();\nconst computeCacheKey = (args: string[]) => Array.from(args).sort().toString();\n\nexport const tsc = async (args = process.argv.slice(2)) => {\n const tscArgs = parseTscArgs(args);\n\n // Build flag is incompatible with project flag.\n const defaultArgs = tscArgs.build || tscArgs.project ? [] : DEFAULT_ARGS;\n\n return exec('tsc', ...defaultArgs, ...args);\n};\n\nexport const readTsconfig = (args = process.argv.slice(2), log: Logger) => {\n const tscArgs = parseTscArgs(args);\n\n let parsedCommandLine = tsconfigCache.get(computeCacheKey(args));\n\n if (!parsedCommandLine) {\n log.debug(\n log.bold(\n 'tsconfig',\n ...(tscArgs.project ? ['--project', tscArgs.project] : []),\n ),\n );\n log.debug(tscArgs.pathname);\n\n const tsconfigFile = ts.findConfigFile(\n tscArgs.dirname,\n ts.sys.fileExists.bind(undefined),\n tscArgs.basename,\n );\n if (!tsconfigFile) {\n log.err(`Could not find ${tscArgs.pathname}.`);\n process.exitCode = 1;\n return;\n }\n\n const readConfigFile = ts.readConfigFile(\n tsconfigFile,\n ts.sys.readFile.bind(undefined),\n );\n if (readConfigFile.error) {\n log.err(`Could not read ${tscArgs.pathname}.`);\n log.subtle(ts.formatDiagnostic(readConfigFile.error, formatHost));\n process.exitCode = 1;\n return;\n }\n\n parsedCommandLine = ts.parseJsonConfigFileContent(\n readConfigFile.config,\n ts.sys,\n tscArgs.dirname,\n );\n tsconfigCache.set(computeCacheKey(args), parsedCommandLine);\n }\n\n if (parsedCommandLine.errors.length) {\n log.err(`Could not parse ${tscArgs.pathname}.`);\n log.subtle(ts.formatDiagnostics(parsedCommandLine.errors, formatHost));\n process.exitCode = 1;\n return;\n }\n\n return parsedCommandLine;\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAe;AAEf,kBAAqB;AAGrB,kBAA6B;AAE7B,MAAM,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xB,UAAI,IAAI,kBAAkB,QAAQ,QAAQ,GAAG;AAC7C,UAAI,OAAO,kBAAAA,QAAG,iBAAiB,eAAe,OAAO,UAAU,CAAC;AAChE,cAAQ,WAAW;AACnB;AAAA,IACF;AAEA,wBAAoB,kBAAAA,QAAG;AAAA,MACrB,eAAe;AAAA,MACf,kBAAAA,QAAG;AAAA,MACH,QAAQ;AAAA,IACV;AACA,kBAAc,IAAI,gBAAgB,IAAI,GAAG,iBAAiB;AAAA,EAC5D;AAEA,MAAI,kBAAkB,OAAO,QAAQ;AACnC,QAAI,IAAI,mBAAmB,QAAQ,QAAQ,GAAG;AAC9C,QAAI,OAAO,kBAAAA,QAAG,kBAAkB,kBAAkB,QAAQ,UAAU,CAAC;AACrE,YAAQ,WAAW;AACnB;AAAA,EACF;AAEA,SAAO;AACT;",
6
6
  "names": ["ts"]
7
7
  }
@@ -21,9 +21,9 @@ __export(buildPackage_exports, {
21
21
  buildPackage: () => buildPackage
22
22
  });
23
23
  module.exports = __toCommonJS(buildPackage_exports);
24
- var import_args = require("../../utils/args");
25
- var import_exec = require("../../utils/exec");
26
- var import_assets = require("../build/assets");
24
+ var import_args = require("../../utils/args.js");
25
+ var import_exec = require("../../utils/exec.js");
26
+ var import_assets = require("../build/assets.js");
27
27
  const buildPackage = async (args = process.argv.slice(2)) => {
28
28
  await (0, import_exec.execConcurrently)(
29
29
  [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/buildPackage/index.ts"],
4
- "sourcesContent": ["import { hasSerialFlag } from '../../utils/args';\nimport { execConcurrently } from '../../utils/exec';\nimport { copyAssetsConcurrently } from '../build/assets';\n\nexport const buildPackage = async (args = process.argv.slice(2)) => {\n await execConcurrently(\n [\n {\n command:\n 'tsc --module CommonJS --outDir lib-commonjs --project tsconfig.build.json',\n name: 'commonjs',\n prefixColor: 'green',\n },\n {\n command:\n 'tsc --module ES2015 --outDir lib-es2015 --project tsconfig.build.json',\n name: 'es2015',\n prefixColor: 'yellow',\n },\n {\n command:\n 'tsc --allowJS false --declaration --emitDeclarationOnly --outDir lib-types --project tsconfig.build.json',\n name: 'types',\n prefixColor: 'blue',\n },\n ],\n {\n maxProcesses: hasSerialFlag(args) ? 1 : undefined,\n },\n );\n\n await copyAssetsConcurrently([\n {\n outDir: 'lib-commonjs',\n name: 'commonjs',\n prefixColor: 'green',\n },\n {\n outDir: 'lib-es2015',\n name: 'es2015',\n prefixColor: 'yellow',\n },\n ]);\n};\n"],
4
+ "sourcesContent": ["import { hasSerialFlag } from '../../utils/args.js';\nimport { execConcurrently } from '../../utils/exec.js';\nimport { copyAssetsConcurrently } from '../build/assets.js';\n\nexport const buildPackage = async (args = process.argv.slice(2)) => {\n await execConcurrently(\n [\n {\n command:\n 'tsc --module CommonJS --outDir lib-commonjs --project tsconfig.build.json',\n name: 'commonjs',\n prefixColor: 'green',\n },\n {\n command:\n 'tsc --module ES2015 --outDir lib-es2015 --project tsconfig.build.json',\n name: 'es2015',\n prefixColor: 'yellow',\n },\n {\n command:\n 'tsc --allowJS false --declaration --emitDeclarationOnly --outDir lib-types --project tsconfig.build.json',\n name: 'types',\n prefixColor: 'blue',\n },\n ],\n {\n maxProcesses: hasSerialFlag(args) ? 1 : undefined,\n },\n );\n\n await copyAssetsConcurrently([\n {\n outDir: 'lib-commonjs',\n name: 'commonjs',\n prefixColor: 'green',\n },\n {\n outDir: 'lib-es2015',\n name: 'es2015',\n prefixColor: 'yellow',\n },\n ]);\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA8B;AAC9B,kBAAiC;AACjC,oBAAuC;AAEhC,MAAM,eAAe,OAAO,OAAO,QAAQ,KAAK,MAAM,CAAC,MAAM;AAClE,YAAM;AAAA,IACJ;AAAA,MACE;AAAA,QACE,SACE;AAAA,QACF,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,MACA;AAAA,QACE,SACE;AAAA,QACF,MAAM;AAAA,QACN,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA;AAAA,MACE,kBAAc,2BAAc,IAAI,IAAI,IAAI;AAAA,IAC1C;AAAA,EACF;AAEA,YAAM,sCAAuB;AAAA,IAC3B;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,EACF,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
- import type { ProjectType } from '../../utils/manifest';
2
- import type { PackageManagerConfig } from '../../utils/packageManager';
1
+ import type { ProjectType } from '../../utils/manifest.js';
2
+ import type { PackageManagerConfig } from '../../utils/packageManager.js';
3
3
  interface Props {
4
4
  destinationRoot: string;
5
5
  entryPoint: string;
@@ -33,8 +33,8 @@ __export(analyseConfiguration_exports, {
33
33
  module.exports = __toCommonJS(analyseConfiguration_exports);
34
34
  var import_path = __toESM(require("path"));
35
35
  var import_fs_extra = __toESM(require("fs-extra"));
36
- var import_logging = require("../../utils/logging");
37
- var import_project = require("./analysis/project");
36
+ var import_logging = require("../../utils/logging.js");
37
+ var import_project = require("./analysis/project.js");
38
38
  const analyseConfiguration = async (props) => {
39
39
  import_logging.log.newline();
40
40
  import_logging.log.plain(import_logging.log.bold("Config:"));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/configure/analyseConfiguration.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\n\nimport { log } from '../../utils/logging';\nimport type { ProjectType } from '../../utils/manifest';\nimport type { PackageManagerConfig } from '../../utils/packageManager';\n\nimport { diffFiles } from './analysis/project';\n\ninterface Props {\n destinationRoot: string;\n entryPoint: string;\n firstRun: boolean;\n packageManager: PackageManagerConfig;\n type: ProjectType;\n}\n\nexport const analyseConfiguration = async (\n props: Props,\n): Promise<undefined | (() => Promise<void>)> => {\n log.newline();\n log.plain(log.bold('Config:'));\n\n const files = await diffFiles(props);\n\n if (Object.keys(files).length === 0) {\n log.newline();\n log.ok('\u2714 No changes');\n return;\n }\n\n log.newline();\n Object.entries(files)\n .sort(([filenameA], [filenameB]) => filenameA.localeCompare(filenameB))\n .forEach(([filename, { operation }]) => log.plain(operation, filename));\n\n return async () => {\n const dirnames = [\n ...new Set(Object.keys(files).map((filename) => path.dirname(filename))),\n ];\n\n await Promise.all(\n dirnames.map((dirname) =>\n fs.promises.mkdir(dirname, { recursive: true }),\n ),\n );\n\n await Promise.all(\n Object.entries(files).map(([filename, { data }]) =>\n data === undefined\n ? fs.promises.rm(filename)\n : fs.promises.writeFile(filename, data),\n ),\n );\n };\n};\n"],
4
+ "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\n\nimport { log } from '../../utils/logging.js';\nimport type { ProjectType } from '../../utils/manifest.js';\nimport type { PackageManagerConfig } from '../../utils/packageManager.js';\n\nimport { diffFiles } from './analysis/project.js';\n\ninterface Props {\n destinationRoot: string;\n entryPoint: string;\n firstRun: boolean;\n packageManager: PackageManagerConfig;\n type: ProjectType;\n}\n\nexport const analyseConfiguration = async (\n props: Props,\n): Promise<undefined | (() => Promise<void>)> => {\n log.newline();\n log.plain(log.bold('Config:'));\n\n const files = await diffFiles(props);\n\n if (Object.keys(files).length === 0) {\n log.newline();\n log.ok('\u2714 No changes');\n return;\n }\n\n log.newline();\n Object.entries(files)\n .sort(([filenameA], [filenameB]) => filenameA.localeCompare(filenameB))\n .forEach(([filename, { operation }]) => log.plain(operation, filename));\n\n return async () => {\n const dirnames = [\n ...new Set(Object.keys(files).map((filename) => path.dirname(filename))),\n ];\n\n await Promise.all(\n dirnames.map((dirname) =>\n fs.promises.mkdir(dirname, { recursive: true }),\n ),\n );\n\n await Promise.all(\n Object.entries(files).map(([filename,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names": ["path", "fs"]
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import type { NormalizedReadResult } from 'read-pkg-up';
2
- import type { ProjectType } from '../../utils/manifest';
2
+ import type { ProjectType } from '../../utils/manifest.js';
3
3
  interface Props {
4
4
  destinationRoot: string;
5
5
  include: (pathname: string) => boolean;
@@ -33,12 +33,12 @@ __export(analyseDependencies_exports, {
33
33
  module.exports = __toCommonJS(analyseDependencies_exports);
34
34
  var import_path = __toESM(require("path"));
35
35
  var import_fs_extra = __toESM(require("fs-extra"));
36
- var import_copy = require("../../utils/copy");
37
- var import_logging = require("../../utils/logging");
38
- var import_version = require("../../utils/version");
39
- var import_package = require("./analysis/package");
40
- var dependencyMutators = __toESM(require("./dependencies"));
41
- var import_package2 = require("./processing/package");
36
+ var import_copy = require("../../utils/copy.js");
37
+ var import_logging = require("../../utils/logging.js");
38
+ var import_version = require("../../utils/version.js");
39
+ var import_package = require("./analysis/package.js");
40
+ var dependencyMutators = __toESM(require("./dependencies/index.js"));
41
+ var import_package2 = require("./processing/package.js");
42
42
  const logDiff = (diff) => {
43
43
  const entries = Object.entries(diff);
44
44
  if (entries.length === 0) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/configure/analyseDependencies.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport type { NormalizedReadResult } from 'read-pkg-up';\n\nimport { type TextProcessor, copyFiles } from '../../utils/copy';\nimport { log } from '../../utils/logging';\nimport type { ProjectType } from '../../utils/manifest';\nimport { getLatestNpmVersion, getSkubaVersion } from '../../utils/version';\n\nimport { diffDependencies } from './analysis/package';\nimport * as dependencyMutators from './dependencies';\nimport { formatPackage } from './processing/package';\nimport type { DependencyDiff } from './types';\n\nconst logDiff = (diff: DependencyDiff): boolean => {\n const entries = Object.entries(diff);\n\n if (entries.length === 0) {\n log.ok('\u2714 No changes');\n\n return false;\n }\n\n Object.entries(diff)\n .sort(([nameA], [nameB]) => nameA.localeCompare(nameB))\n .forEach(([name, { operation, version }]) =>\n log.plain(operation, name, log.formatSubtle(version)),\n );\n\n return true;\n};\n\nconst pinUnspecifiedVersions = async (\n dependencies: Record<string, string>,\n): Promise<void> => {\n const updates = await Promise.all(\n Object.entries(dependencies)\n .filter(([, version]) => version === '*')\n .map(async ([name]) => {\n const version = await (name === 'skuba'\n ? getSkubaVersion()\n : getLatestNpmVersion(name));\n\n if (version === null) {\n throw new Error(`Failed to fetch latest version of ${name}`);\n }\n\n return [name, version] as const;\n }),\n );\n\n updates.forEach(([name, version]) => {\n dependencies[name] = version;\n });\n};\n\ninterface Props {\n destinationRoot: string;\n include: (pathname: string) => boolean;\n manifest: NormalizedReadResult;\n type: ProjectType;\n}\n\nexport const analyseDependencies = async ({\n destinationRoot,\n include,\n manifest: { packageJson },\n type,\n}: Props): Promise<undefined | (() => Promise<void>)> => {\n const input = {\n dependencies: packageJson.dependencies ?? {},\n devDependencies: packageJson.devDependencies ?? {},\n type,\n };\n\n const output = {\n dependencies: { ...input.dependencies },\n devDependencies: { ...input.devDependencies },\n type,\n };\n\n const processors = Object.values(dependencyMutators).reduce<TextProcessor[]>(\n (acc, mutate) => {\n const newProcessors = mutate(output);\n acc.push(...newProcessors);\n return acc;\n },\n [],\n );\n\n await Promise.all([\n pinUnspecifiedVersions(output.dependencies),\n pinUnspecifiedVersions(output.devDependencies),\n ]);\n\n const dependencyDiff = diffDependencies({\n old: input.dependencies,\n new: output.dependencies,\n });\n\n log.newline();\n log.plain(log.bold('Dependencies:'));\n\n log.newline();\n const hasDependencyDiff = logDiff(dependencyDiff);\n\n const devDependencyDiff = diffDependencies({\n old: input.devDependencies,\n new: output.devDependencies,\n });\n\n log.newline();\n log.plain(log.bold('Dev dependencies:'));\n\n log.newline();\n const hasDevDependencyDiff = logDiff(devDependencyDiff);\n\n const packageJsonFilepath = path.join(destinationRoot, 'package.json');\n\n if (!hasDependencyDiff && !hasDevDependencyDiff) {\n return;\n }\n\n return async () => {\n const updatedPackageJson = await formatPackage({\n ...packageJson,\n dependencies: output.dependencies,\n devDependencies: output.devDependencies,\n });\n\n await fs.promises.writeFile(packageJsonFilepath, updatedPackageJson);\n\n if (processors.length === 0) {\n return;\n }\n\n await copyFiles({\n sourceRoot: destinationRoot,\n destinationRoot,\n include,\n processors,\n });\n };\n};\n"],
4
+ "sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport type { NormalizedReadResult } from 'read-pkg-up';\n\nimport { type TextProcessor, copyFiles } from '../../utils/copy.js';\nimport { log } from '../../utils/logging.js';\nimport type { ProjectType } from '../../utils/manifest.js';\nimport { getLatestNpmVersion, getSkubaVersion } from '../../utils/version.js';\n\nimport { diffDependencies } from './analysis/package.js';\nimport * as dependencyMutators from './dependencies/index.js';\nimport { formatPackage } from './processing/package.js';\nimport type { DependencyDiff } from './types.js';\n\nconst logDiff = (diff: DependencyDiff): boolean => {\n const entries = Object.entries(diff);\n\n if (entries.length === 0) {\n log.ok('\u2714 No changes');\n\n return false;\n }\n\n Object.entries(diff)\n .sort(([nameA], [nameB]) => nameA.localeCompare(nameB))\n .forEach(([name, { operation, version }]) =>\n log.plain(operation, name, log.formatSubtle(version)),\n );\n\n return true;\n};\n\nconst pinUnspecifiedVersions = async (\n dependencies: Record<string, string>,\n): Promise<void> => {\n const updates = await Promise.all(\n Object.entries(dependencies)\n .filter(([, version]) => version === '*')\n .map(async ([name]) => {\n const version = await (name === 'skuba'\n ? getSkubaVersion()\n : getLatestNpmVersion(name));\n\n if (version === null) {\n throw new Error(`Failed to fetch latest version of ${name}`);\n }\n\n return [name, version] as const;\n }),\n );\n\n updates.forEach(([name, version]) => {\n dependencies[name] = version;\n });\n};\n\ninterface Props {\n destinationRoot: string;\n include: (pathname: string) => boolean;\n manifest: NormalizedReadResult;\n type: ProjectType;\n}\n\nexport const analyseDependencies = async ({\n destinationRoot,\n include,\n manifest: { packageJson },\n type,\n}: Props): Promise<undefined | (() => Promise<void>)> => {\n const input = {\n dependencies: packageJson.dependencies ?? {},\n devDependencies: packageJson.devDependencies ?? {},\n type,\n };\n\n const output = {\n dependencies: { ...input.dependencies },\n devDependencies: { ...input.devDependencies },\n type,\n };\n\n const processors = Object.values(dependencyMutators).reduce<TextProcessor[]>(\n (acc, mutate) => {\n const newProcessors = mutate(output);\n acc.push(...newProcessors);\n return acc;\n },\n [],\n );\n\n await Promise.all([\n pinUnspecifiedVersions(output.dependencies),\n pinUnspecifiedVersions(output.devDependencies),\n ]);\n\n const dependencyDiff = diffDependencies({\n old: input.dependencies,\n new: output.dependencies,\n });\n\n log.newline();\n log.plain(log.bold('Dependencies:'));\n\n log.newline();\n const hasDependencyDiff = logDiff(dependencyDiff);\n\n const devDependencyDiff = diffDependencies({\n old: input.devDependencies,\n new: output.devDependencies,\n });\n\n log.newline();\n log.plain(log.bold('Dev dependencies:'));\n\n log.newline();\n const hasDevDependencyDiff = logDiff(devDependencyDiff);\n\n const packageJsonFilepath = path.join(destinationRoot, 'package.json');\n\n if (!hasDependencyDiff && !hasDevDependencyDiff) {\n return;\n }\n\n return async () => {\n const updatedPackageJson = await formatPackage({\n ...packageJson,\n dependencies: output.dependencies,\n devDependencies: output.devDependencies,\n });\n\n await fs.promises.writeFile(packageJsonFilepath, updatedPackageJson);\n\n if (processors.length === 0) {\n return;\n }\n\n await copyFiles({\n sourceRoot: destinationRoot,\n destinationRoot,\n include,\n processors,\n });\n };\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AAGf,kBAA8C;AAC9C,qBAAoB;AAEpB,qBAAqD;AAErD,qBAAiC;AACjC,yBAAoC;AACpC,IAAAA,kBAA8B;AAG9B,MAAM,UAAU,CAAC,SAAkC;AACjD,QAAM,UAAU,OAAO,QAAQ,IAAI;AAEnC,MAAI,QAAQ,WAAW,GAAG;AACxB,uBAAI,GAAG,mBAAc;AAErB,WAAO;AAAA,EACT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