skuba 13.0.3 → 14.0.0-esmify-skuba-20251031140551

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 (516) hide show
  1. package/config/eslint.js +1 -1
  2. package/config/prettier.js +10 -2
  3. package/lib/cli/adapter/eslint.js +10 -46
  4. package/lib/cli/adapter/eslint.js.map +2 -2
  5. package/lib/cli/adapter/prettier.js +40 -72
  6. package/lib/cli/adapter/prettier.js.map +2 -2
  7. package/lib/cli/build/args.js +7 -43
  8. package/lib/cli/build/args.js.map +2 -2
  9. package/lib/cli/build/assets.js +27 -62
  10. package/lib/cli/build/assets.js.map +2 -2
  11. package/lib/cli/build/esbuild.js +20 -55
  12. package/lib/cli/build/esbuild.js.map +3 -3
  13. package/lib/cli/build/index.js +20 -56
  14. package/lib/cli/build/index.js.map +2 -2
  15. package/lib/cli/build/tsc.js +24 -66
  16. package/lib/cli/build/tsc.js.map +2 -2
  17. package/lib/cli/buildPackage/index.js +7 -33
  18. package/lib/cli/buildPackage/index.js.map +1 -1
  19. package/lib/cli/configure/analyseConfiguration.js +15 -51
  20. package/lib/cli/configure/analyseConfiguration.js.map +2 -2
  21. package/lib/cli/configure/analyseDependencies.js +24 -60
  22. package/lib/cli/configure/analyseDependencies.js.map +3 -3
  23. package/lib/cli/configure/analysis/diff.js +4 -40
  24. package/lib/cli/configure/analysis/diff.js.map +2 -2
  25. package/lib/cli/configure/analysis/files.js +7 -43
  26. package/lib/cli/configure/analysis/files.js.map +2 -2
  27. package/lib/cli/configure/analysis/git.js +11 -47
  28. package/lib/cli/configure/analysis/git.js.map +2 -2
  29. package/lib/cli/configure/analysis/package.js +10 -48
  30. package/lib/cli/configure/analysis/package.js.map +3 -3
  31. package/lib/cli/configure/analysis/project.js +18 -53
  32. package/lib/cli/configure/analysis/project.js.map +2 -2
  33. package/lib/cli/configure/dependencies/index.js +5 -39
  34. package/lib/cli/configure/dependencies/index.js.map +1 -1
  35. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +3 -29
  36. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
  37. package/lib/cli/configure/dependencies/seekKoala.js +3 -29
  38. package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
  39. package/lib/cli/configure/dependencies/skuba.js +3 -29
  40. package/lib/cli/configure/dependencies/skuba.js.map +1 -1
  41. package/lib/cli/configure/dependencies/skubaDeps.js +1 -27
  42. package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
  43. package/lib/cli/configure/dependencies/skubaDive.js +4 -32
  44. package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
  45. package/lib/cli/configure/ensureTemplateCompletion.js +31 -61
  46. package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
  47. package/lib/cli/configure/getEntryPoint.js +13 -49
  48. package/lib/cli/configure/getEntryPoint.js.map +3 -3
  49. package/lib/cli/configure/getProjectType.js +13 -36
  50. package/lib/cli/configure/getProjectType.js.map +2 -2
  51. package/lib/cli/configure/index.js +49 -85
  52. package/lib/cli/configure/index.js.map +3 -3
  53. package/lib/cli/configure/modules/eslint.js +9 -35
  54. package/lib/cli/configure/modules/eslint.js.map +1 -1
  55. package/lib/cli/configure/modules/ignore.js +7 -33
  56. package/lib/cli/configure/modules/ignore.js.map +1 -1
  57. package/lib/cli/configure/modules/index.js +17 -45
  58. package/lib/cli/configure/modules/index.js.map +2 -2
  59. package/lib/cli/configure/modules/nodemon.js +2 -28
  60. package/lib/cli/configure/modules/nodemon.js.map +1 -1
  61. package/lib/cli/configure/modules/package.js +9 -35
  62. package/lib/cli/configure/modules/package.js.map +1 -1
  63. package/lib/cli/configure/modules/prettier.js +10 -36
  64. package/lib/cli/configure/modules/prettier.js.map +1 -1
  65. package/lib/cli/configure/modules/renovate.js +17 -43
  66. package/lib/cli/configure/modules/renovate.js.map +2 -2
  67. package/lib/cli/configure/modules/serverless.js +1 -27
  68. package/lib/cli/configure/modules/serverless.js.map +1 -1
  69. package/lib/cli/configure/modules/tslint.js +2 -28
  70. package/lib/cli/configure/modules/tslint.js.map +1 -1
  71. package/lib/cli/configure/processing/configFile.js +4 -44
  72. package/lib/cli/configure/processing/configFile.js.map +1 -1
  73. package/lib/cli/configure/processing/deleteFiles.js +1 -27
  74. package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
  75. package/lib/cli/configure/processing/javascript.js +2 -30
  76. package/lib/cli/configure/processing/javascript.js.map +1 -1
  77. package/lib/cli/configure/processing/json.js +6 -34
  78. package/lib/cli/configure/processing/json.js.map +1 -1
  79. package/lib/cli/configure/processing/loadFiles.js +1 -27
  80. package/lib/cli/configure/processing/loadFiles.js.map +1 -1
  81. package/lib/cli/configure/processing/module.js +2 -28
  82. package/lib/cli/configure/processing/module.js.map +1 -1
  83. package/lib/cli/configure/processing/package.js +10 -52
  84. package/lib/cli/configure/processing/package.js.map +3 -3
  85. package/lib/cli/configure/processing/prettier.js +3 -39
  86. package/lib/cli/configure/processing/prettier.js.map +2 -2
  87. package/lib/cli/configure/processing/record.js +4 -44
  88. package/lib/cli/configure/processing/record.js.map +2 -2
  89. package/lib/cli/configure/processing/typescript.js +28 -70
  90. package/lib/cli/configure/processing/typescript.js.map +2 -2
  91. package/lib/cli/configure/types.js +0 -15
  92. package/lib/cli/configure/types.js.map +3 -3
  93. package/lib/cli/format/index.js +19 -55
  94. package/lib/cli/format/index.js.map +2 -2
  95. package/lib/cli/help/index.js +5 -31
  96. package/lib/cli/help/index.js.map +1 -1
  97. package/lib/cli/init/getConfig.js +75 -107
  98. package/lib/cli/init/getConfig.js.map +3 -3
  99. package/lib/cli/init/git.js +16 -54
  100. package/lib/cli/init/git.js.map +3 -3
  101. package/lib/cli/init/index.js +66 -99
  102. package/lib/cli/init/index.js.map +2 -2
  103. package/lib/cli/init/prompts.js +20 -56
  104. package/lib/cli/init/prompts.js.map +3 -3
  105. package/lib/cli/init/types.js +6 -42
  106. package/lib/cli/init/types.js.map +1 -1
  107. package/lib/cli/init/validation.js +5 -39
  108. package/lib/cli/init/validation.js.map +1 -1
  109. package/lib/cli/init/writePackageJson.js +7 -43
  110. package/lib/cli/init/writePackageJson.js.map +2 -2
  111. package/lib/cli/lint/annotate/buildkite/eslint.js +2 -38
  112. package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
  113. package/lib/cli/lint/annotate/buildkite/index.js +10 -46
  114. package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
  115. package/lib/cli/lint/annotate/buildkite/internal.js +2 -38
  116. package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
  117. package/lib/cli/lint/annotate/buildkite/prettier.js +2 -38
  118. package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
  119. package/lib/cli/lint/annotate/buildkite/tsc.js +2 -38
  120. package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
  121. package/lib/cli/lint/annotate/github/eslint.js +1 -27
  122. package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
  123. package/lib/cli/lint/annotate/github/index.js +10 -46
  124. package/lib/cli/lint/annotate/github/index.js.map +1 -1
  125. package/lib/cli/lint/annotate/github/internal.js +1 -27
  126. package/lib/cli/lint/annotate/github/internal.js.map +1 -1
  127. package/lib/cli/lint/annotate/github/prettier.js +1 -27
  128. package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
  129. package/lib/cli/lint/annotate/github/tsc.js +3 -29
  130. package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
  131. package/lib/cli/lint/annotate/index.js +5 -31
  132. package/lib/cli/lint/annotate/index.js.map +1 -1
  133. package/lib/cli/lint/autofix.js +38 -78
  134. package/lib/cli/lint/autofix.js.map +3 -3
  135. package/lib/cli/lint/eslint.js +14 -52
  136. package/lib/cli/lint/eslint.js.map +3 -3
  137. package/lib/cli/lint/external.js +18 -53
  138. package/lib/cli/lint/external.js.map +2 -2
  139. package/lib/cli/lint/index.js +24 -50
  140. package/lib/cli/lint/index.js.map +1 -1
  141. package/lib/cli/lint/internal.js +17 -53
  142. package/lib/cli/lint/internal.js.map +2 -2
  143. package/lib/cli/lint/internalLints/detectBadCodeowners.js +8 -36
  144. package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
  145. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +10 -46
  146. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +3 -3
  147. package/lib/cli/lint/internalLints/patchRenovateConfig.js +20 -56
  148. package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
  149. package/lib/cli/lint/internalLints/refreshConfigFiles.js +33 -68
  150. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +2 -2
  151. package/lib/cli/lint/internalLints/upgrade/index.js +21 -54
  152. package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
  153. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +3 -29
  154. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js.map +1 -1
  155. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js +10 -46
  156. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js.map +2 -2
  157. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +5 -31
  158. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +1 -1
  159. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +36 -73
  160. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +3 -3
  161. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +11 -49
  162. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js.map +2 -2
  163. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js +3 -29
  164. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +1 -1
  165. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +24 -64
  166. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +2 -2
  167. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js +3 -29
  168. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +1 -1
  169. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +11 -49
  170. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +2 -2
  171. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +5 -31
  172. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +1 -1
  173. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +11 -49
  174. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +2 -2
  175. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +11 -49
  176. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +2 -2
  177. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js +3 -29
  178. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +1 -1
  179. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +11 -49
  180. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +2 -2
  181. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js +32 -76
  182. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js.map +2 -2
  183. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js +9 -35
  184. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js.map +1 -1
  185. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js +10 -46
  186. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js.map +2 -2
  187. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +28 -88
  188. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +2 -2
  189. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +15 -53
  190. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
  191. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +16 -52
  192. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +2 -2
  193. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +9 -35
  194. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +1 -1
  195. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +9 -45
  196. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +2 -2
  197. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +11 -47
  198. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +2 -2
  199. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +3 -29
  200. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +1 -1
  201. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +14 -50
  202. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +2 -2
  203. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js +10 -46
  204. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js.map +2 -2
  205. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +9 -40
  206. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +2 -2
  207. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +10 -46
  208. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js.map +2 -2
  209. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +10 -46
  210. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +2 -2
  211. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js +12 -48
  212. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js.map +2 -2
  213. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js +3 -29
  214. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js.map +1 -1
  215. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js +10 -46
  216. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
  217. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +3 -29
  218. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +1 -1
  219. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +7 -33
  220. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +1 -1
  221. package/lib/cli/lint/prettier.js +13 -51
  222. package/lib/cli/lint/prettier.js.map +3 -3
  223. package/lib/cli/lint/tsc.js +3 -29
  224. package/lib/cli/lint/tsc.js.map +1 -1
  225. package/lib/cli/lint/types.js +0 -15
  226. package/lib/cli/lint/types.js.map +3 -3
  227. package/lib/cli/migrate/index.js +9 -35
  228. package/lib/cli/migrate/index.js.map +1 -1
  229. package/lib/cli/migrate/nodeVersion/checks.js +26 -68
  230. package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
  231. package/lib/cli/migrate/nodeVersion/index.js +24 -56
  232. package/lib/cli/migrate/nodeVersion/index.js.map +2 -2
  233. package/lib/cli/node/index.js +20 -60
  234. package/lib/cli/node/index.js.map +3 -3
  235. package/lib/cli/release/index.js +3 -29
  236. package/lib/cli/release/index.js.map +1 -1
  237. package/lib/cli/start/index.js +15 -51
  238. package/lib/cli/start/index.js.map +3 -3
  239. package/lib/cli/test/index.js +3 -45
  240. package/lib/cli/test/index.js.map +2 -2
  241. package/lib/cli/version/index.js +5 -31
  242. package/lib/cli/version/index.js.map +1 -1
  243. package/lib/config/prettier.d.ts +7 -0
  244. package/lib/index.js +4 -49
  245. package/lib/index.js.map +2 -2
  246. package/lib/skuba.js +26 -44
  247. package/lib/skuba.js.map +3 -3
  248. package/lib/{cli → src/cli}/configure/analyseDependencies.d.ts +1 -1
  249. package/lib/{cli → src/cli}/configure/analysis/package.d.ts +2 -3
  250. package/lib/{cli → src/cli}/configure/ensureTemplateCompletion.d.ts +1 -1
  251. package/lib/{cli → src/cli}/configure/getEntryPoint.d.ts +1 -1
  252. package/lib/{cli → src/cli}/configure/getProjectType.d.ts +1 -1
  253. package/lib/src/cli/configure/processing/package.d.ts +5 -0
  254. package/lib/{cli → src/cli}/configure/types.d.ts +15 -4
  255. package/lib/{cli → src/cli}/init/getConfig.d.ts +1 -1
  256. package/lib/{cli → src/cli}/init/prompts.d.ts +4 -4
  257. package/lib/{cli → src/cli}/lint/internalLints/upgrade/index.d.ts +1 -1
  258. package/lib/{index.d.ts → src/index.d.ts} +0 -1
  259. package/lib/src/utils/fs.d.ts +1 -0
  260. package/lib/{utils → src/utils}/manifest.d.ts +3 -2
  261. package/lib/src/utils/sleep.d.ts +5 -0
  262. package/lib/{utils → src/utils}/wait.d.ts +0 -4
  263. package/lib/{wrapper → src/wrapper}/http.d.ts +0 -6
  264. package/lib/src/wrapper/server.d.ts +7 -0
  265. package/lib/utils/args.js +8 -50
  266. package/lib/utils/args.js.map +2 -2
  267. package/lib/utils/command.js +6 -50
  268. package/lib/utils/command.js.map +3 -3
  269. package/lib/utils/copy.js +22 -64
  270. package/lib/utils/copy.js.map +2 -2
  271. package/lib/utils/dir.js +37 -84
  272. package/lib/utils/dir.js.map +3 -3
  273. package/lib/utils/env.js +1 -27
  274. package/lib/utils/env.js.map +1 -1
  275. package/lib/utils/error.js +11 -53
  276. package/lib/utils/error.js.map +1 -1
  277. package/lib/utils/exec.js +26 -70
  278. package/lib/utils/exec.js.map +3 -3
  279. package/lib/utils/fs.js +15 -0
  280. package/lib/utils/fs.js.map +7 -0
  281. package/lib/utils/help.js +5 -31
  282. package/lib/utils/help.js.map +1 -1
  283. package/lib/utils/logging.js +13 -55
  284. package/lib/utils/logging.js.map +2 -2
  285. package/lib/utils/logo.js +23 -59
  286. package/lib/utils/logo.js.map +2 -2
  287. package/lib/utils/manifest.js +12 -60
  288. package/lib/utils/manifest.js.map +3 -3
  289. package/lib/utils/npmrc.js +1 -27
  290. package/lib/utils/npmrc.js.map +1 -1
  291. package/lib/utils/packageManager.js +14 -56
  292. package/lib/utils/packageManager.js.map +2 -2
  293. package/lib/utils/port.js +4 -42
  294. package/lib/utils/port.js.map +2 -2
  295. package/lib/utils/sleep.js +9 -0
  296. package/lib/utils/sleep.js.map +7 -0
  297. package/lib/utils/template.js +21 -68
  298. package/lib/utils/template.js.map +3 -3
  299. package/lib/utils/validation.js +6 -42
  300. package/lib/utils/validation.js.map +1 -1
  301. package/lib/utils/version.js +11 -53
  302. package/lib/utils/version.js.map +2 -2
  303. package/lib/utils/wait.js +6 -42
  304. package/lib/utils/wait.js.map +2 -2
  305. package/lib/utils/worker.js +9 -37
  306. package/lib/utils/worker.js.map +1 -1
  307. package/lib/wrapper/functionHandler.js +17 -50
  308. package/lib/wrapper/functionHandler.js.map +2 -2
  309. package/lib/wrapper/http.js +7 -53
  310. package/lib/wrapper/http.js.map +3 -3
  311. package/lib/wrapper/index.js +6 -6
  312. package/lib/wrapper/index.js.map +1 -1
  313. package/lib/wrapper/main.js +7 -43
  314. package/lib/wrapper/main.js.map +3 -3
  315. package/lib/wrapper/requestListener.js +12 -47
  316. package/lib/wrapper/requestListener.js.map +3 -3
  317. package/lib/wrapper/server.js +9 -0
  318. package/lib/wrapper/server.js.map +7 -0
  319. package/package.json +20 -26
  320. package/template/base/_.prettierrc.js +1 -1
  321. package/template/base/_eslint.config.js +1 -1
  322. package/template/base/_pnpm-workspace.yaml +3 -2
  323. package/template/base/vitest.config.ts +25 -0
  324. package/template/express-rest-api/.gantry/dev.yml +2 -2
  325. package/template/express-rest-api/.gantry/prod.yml +2 -2
  326. package/template/express-rest-api/package.json +6 -5
  327. package/template/express-rest-api/skuba.template.js +1 -1
  328. package/template/express-rest-api/src/app.test.ts +1 -0
  329. package/template/greeter/package.json +4 -3
  330. package/template/greeter/skuba.template.js +1 -1
  331. package/template/greeter/src/app.test.ts +3 -1
  332. package/template/koa-rest-api/.gantry/dev.yml +2 -2
  333. package/template/koa-rest-api/.gantry/prod.yml +2 -2
  334. package/template/koa-rest-api/package.json +6 -5
  335. package/template/koa-rest-api/skuba.template.js +1 -1
  336. package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +2 -0
  337. package/template/koa-rest-api/src/api/jobs/postJob.test.ts +2 -0
  338. package/template/koa-rest-api/src/app.test.ts +2 -0
  339. package/template/koa-rest-api/src/framework/server.test.ts +2 -2
  340. package/template/koa-rest-api/src/framework/validation.test.ts +2 -0
  341. package/template/koa-rest-api/src/testing/metrics.ts +2 -0
  342. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +15 -3
  343. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +11 -9
  344. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +1 -1
  345. package/template/lambda-sqs-worker-cdk/package.json +6 -5
  346. package/template/lambda-sqs-worker-cdk/skuba.template.js +1 -1
  347. package/template/lambda-sqs-worker-cdk/src/app.test.ts +22 -13
  348. package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +1 -0
  349. package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +33 -31
  350. package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +8 -2
  351. package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +3 -2
  352. package/template/lambda-sqs-worker-cdk/src/testing/services.ts +4 -3
  353. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  354. package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
  355. package/template/oss-npm-package/_package.json +1 -0
  356. package/template/oss-npm-package/skuba.template.js +1 -1
  357. package/template/oss-npm-package/src/index.test.ts +2 -0
  358. package/template/private-npm-package/_package.json +1 -0
  359. package/template/private-npm-package/skuba.template.js +1 -1
  360. package/template/private-npm-package/src/index.test.ts +2 -0
  361. package/config/jest.js +0 -1
  362. package/config/prettier.d.ts +0 -4
  363. package/jest/moduleNameMapper.js +0 -64
  364. package/jest/transform.js +0 -62
  365. package/jest/tsConfig.js +0 -26
  366. package/jest-preset.js +0 -37
  367. package/lib/api/jest/index.d.ts +0 -15
  368. package/lib/api/jest/index.js +0 -59
  369. package/lib/api/jest/index.js.map +0 -7
  370. package/lib/cli/configure/modules/jest.d.ts +0 -2
  371. package/lib/cli/configure/modules/jest.js +0 -86
  372. package/lib/cli/configure/modules/jest.js.map +0 -7
  373. package/lib/cli/configure/processing/package.d.ts +0 -71
  374. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.d.ts +0 -2
  375. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +0 -144
  376. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +0 -7
  377. package/lib/cli/test/reporters/github/annotations.d.ts +0 -9
  378. package/lib/cli/test/reporters/github/annotations.js +0 -102
  379. package/lib/cli/test/reporters/github/annotations.js.map +0 -7
  380. package/lib/cli/test/reporters/github/index.d.ts +0 -5
  381. package/lib/cli/test/reporters/github/index.js +0 -74
  382. package/lib/cli/test/reporters/github/index.js.map +0 -7
  383. package/template/base/jest.config.ts +0 -19
  384. package/template/base/jest.setup.ts +0 -3
  385. /package/lib/{cli → src/cli}/adapter/eslint.d.ts +0 -0
  386. /package/lib/{cli → src/cli}/adapter/prettier.d.ts +0 -0
  387. /package/lib/{cli → src/cli}/build/args.d.ts +0 -0
  388. /package/lib/{cli → src/cli}/build/assets.d.ts +0 -0
  389. /package/lib/{cli → src/cli}/build/esbuild.d.ts +0 -0
  390. /package/lib/{cli → src/cli}/build/index.d.ts +0 -0
  391. /package/lib/{cli → src/cli}/build/tsc.d.ts +0 -0
  392. /package/lib/{cli → src/cli}/buildPackage/index.d.ts +0 -0
  393. /package/lib/{cli → src/cli}/configure/analyseConfiguration.d.ts +0 -0
  394. /package/lib/{cli → src/cli}/configure/analysis/diff.d.ts +0 -0
  395. /package/lib/{cli → src/cli}/configure/analysis/files.d.ts +0 -0
  396. /package/lib/{cli → src/cli}/configure/analysis/git.d.ts +0 -0
  397. /package/lib/{cli → src/cli}/configure/analysis/project.d.ts +0 -0
  398. /package/lib/{cli → src/cli}/configure/dependencies/index.d.ts +0 -0
  399. /package/lib/{cli → src/cli}/configure/dependencies/seekDatadogCustomMetrics.d.ts +0 -0
  400. /package/lib/{cli → src/cli}/configure/dependencies/seekKoala.d.ts +0 -0
  401. /package/lib/{cli → src/cli}/configure/dependencies/skuba.d.ts +0 -0
  402. /package/lib/{cli → src/cli}/configure/dependencies/skubaDeps.d.ts +0 -0
  403. /package/lib/{cli → src/cli}/configure/dependencies/skubaDive.d.ts +0 -0
  404. /package/lib/{cli → src/cli}/configure/index.d.ts +0 -0
  405. /package/lib/{cli → src/cli}/configure/modules/eslint.d.ts +0 -0
  406. /package/lib/{cli → src/cli}/configure/modules/ignore.d.ts +0 -0
  407. /package/lib/{cli → src/cli}/configure/modules/index.d.ts +0 -0
  408. /package/lib/{cli → src/cli}/configure/modules/nodemon.d.ts +0 -0
  409. /package/lib/{cli → src/cli}/configure/modules/package.d.ts +0 -0
  410. /package/lib/{cli → src/cli}/configure/modules/prettier.d.ts +0 -0
  411. /package/lib/{cli → src/cli}/configure/modules/renovate.d.ts +0 -0
  412. /package/lib/{cli → src/cli}/configure/modules/serverless.d.ts +0 -0
  413. /package/lib/{cli → src/cli}/configure/modules/tslint.d.ts +0 -0
  414. /package/lib/{cli → src/cli}/configure/processing/configFile.d.ts +0 -0
  415. /package/lib/{cli → src/cli}/configure/processing/deleteFiles.d.ts +0 -0
  416. /package/lib/{cli → src/cli}/configure/processing/javascript.d.ts +0 -0
  417. /package/lib/{cli → src/cli}/configure/processing/json.d.ts +0 -0
  418. /package/lib/{cli → src/cli}/configure/processing/loadFiles.d.ts +0 -0
  419. /package/lib/{cli → src/cli}/configure/processing/module.d.ts +0 -0
  420. /package/lib/{cli → src/cli}/configure/processing/prettier.d.ts +0 -0
  421. /package/lib/{cli → src/cli}/configure/processing/record.d.ts +0 -0
  422. /package/lib/{cli → src/cli}/configure/processing/typescript.d.ts +0 -0
  423. /package/lib/{cli → src/cli}/format/index.d.ts +0 -0
  424. /package/lib/{cli → src/cli}/help/index.d.ts +0 -0
  425. /package/lib/{cli → src/cli}/init/git.d.ts +0 -0
  426. /package/lib/{cli → src/cli}/init/index.d.ts +0 -0
  427. /package/lib/{cli → src/cli}/init/types.d.ts +0 -0
  428. /package/lib/{cli → src/cli}/init/validation.d.ts +0 -0
  429. /package/lib/{cli → src/cli}/init/writePackageJson.d.ts +0 -0
  430. /package/lib/{cli → src/cli}/lint/annotate/buildkite/eslint.d.ts +0 -0
  431. /package/lib/{cli → src/cli}/lint/annotate/buildkite/index.d.ts +0 -0
  432. /package/lib/{cli → src/cli}/lint/annotate/buildkite/internal.d.ts +0 -0
  433. /package/lib/{cli → src/cli}/lint/annotate/buildkite/prettier.d.ts +0 -0
  434. /package/lib/{cli → src/cli}/lint/annotate/buildkite/tsc.d.ts +0 -0
  435. /package/lib/{cli → src/cli}/lint/annotate/github/eslint.d.ts +0 -0
  436. /package/lib/{cli → src/cli}/lint/annotate/github/index.d.ts +0 -0
  437. /package/lib/{cli → src/cli}/lint/annotate/github/internal.d.ts +0 -0
  438. /package/lib/{cli → src/cli}/lint/annotate/github/prettier.d.ts +0 -0
  439. /package/lib/{cli → src/cli}/lint/annotate/github/tsc.d.ts +0 -0
  440. /package/lib/{cli → src/cli}/lint/annotate/index.d.ts +0 -0
  441. /package/lib/{cli → src/cli}/lint/autofix.d.ts +0 -0
  442. /package/lib/{cli → src/cli}/lint/eslint.d.ts +0 -0
  443. /package/lib/{cli → src/cli}/lint/external.d.ts +0 -0
  444. /package/lib/{cli → src/cli}/lint/index.d.ts +0 -0
  445. /package/lib/{cli → src/cli}/lint/internal.d.ts +0 -0
  446. /package/lib/{cli → src/cli}/lint/internalLints/detectBadCodeowners.d.ts +0 -0
  447. /package/lib/{cli → src/cli}/lint/internalLints/noSkubaTemplateJs.d.ts +0 -0
  448. /package/lib/{cli → src/cli}/lint/internalLints/patchRenovateConfig.d.ts +0 -0
  449. /package/lib/{cli → src/cli}/lint/internalLints/refreshConfigFiles.d.ts +0 -0
  450. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.0.4/index.d.ts +0 -0
  451. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.d.ts +0 -0
  452. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.1.0/index.d.ts +0 -0
  453. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.d.ts +0 -0
  454. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.d.ts +0 -0
  455. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.0.2/index.d.ts +0 -0
  456. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.d.ts +0 -0
  457. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.1.1/index.d.ts +0 -0
  458. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.d.ts +0 -0
  459. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.3.0/index.d.ts +0 -0
  460. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.d.ts +0 -0
  461. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.d.ts +0 -0
  462. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.0/index.d.ts +0 -0
  463. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.d.ts +0 -0
  464. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.d.ts +0 -0
  465. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/index.d.ts +0 -0
  466. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.d.ts +0 -0
  467. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.d.ts +0 -0
  468. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.d.ts +0 -0
  469. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.d.ts +0 -0
  470. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/7.3.1/index.d.ts +0 -0
  471. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.d.ts +0 -0
  472. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.d.ts +0 -0
  473. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.0.0/index.d.ts +0 -0
  474. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.d.ts +0 -0
  475. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.d.ts +0 -0
  476. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/index.d.ts +0 -0
  477. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.d.ts +0 -0
  478. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.d.ts +0 -0
  479. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.d.ts +0 -0
  480. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/9.0.1/index.d.ts +0 -0
  481. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.d.ts +0 -0
  482. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/9.1.0/index.d.ts +0 -0
  483. /package/lib/{cli → src/cli}/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.d.ts +0 -0
  484. /package/lib/{cli → src/cli}/lint/prettier.d.ts +0 -0
  485. /package/lib/{cli → src/cli}/lint/tsc.d.ts +0 -0
  486. /package/lib/{cli → src/cli}/lint/types.d.ts +0 -0
  487. /package/lib/{cli → src/cli}/migrate/index.d.ts +0 -0
  488. /package/lib/{cli → src/cli}/migrate/nodeVersion/checks.d.ts +0 -0
  489. /package/lib/{cli → src/cli}/migrate/nodeVersion/index.d.ts +0 -0
  490. /package/lib/{cli → src/cli}/node/index.d.ts +0 -0
  491. /package/lib/{cli → src/cli}/release/index.d.ts +0 -0
  492. /package/lib/{cli → src/cli}/start/index.d.ts +0 -0
  493. /package/lib/{cli → src/cli}/test/index.d.ts +0 -0
  494. /package/lib/{cli → src/cli}/version/index.d.ts +0 -0
  495. /package/lib/{skuba.d.ts → src/skuba.d.ts} +0 -0
  496. /package/lib/{utils → src/utils}/args.d.ts +0 -0
  497. /package/lib/{utils → src/utils}/command.d.ts +0 -0
  498. /package/lib/{utils → src/utils}/copy.d.ts +0 -0
  499. /package/lib/{utils → src/utils}/dir.d.ts +0 -0
  500. /package/lib/{utils → src/utils}/env.d.ts +0 -0
  501. /package/lib/{utils → src/utils}/error.d.ts +0 -0
  502. /package/lib/{utils → src/utils}/exec.d.ts +0 -0
  503. /package/lib/{utils → src/utils}/help.d.ts +0 -0
  504. /package/lib/{utils → src/utils}/logging.d.ts +0 -0
  505. /package/lib/{utils → src/utils}/logo.d.ts +0 -0
  506. /package/lib/{utils → src/utils}/npmrc.d.ts +0 -0
  507. /package/lib/{utils → src/utils}/packageManager.d.ts +0 -0
  508. /package/lib/{utils → src/utils}/port.d.ts +0 -0
  509. /package/lib/{utils → src/utils}/template.d.ts +0 -0
  510. /package/lib/{utils → src/utils}/validation.d.ts +0 -0
  511. /package/lib/{utils → src/utils}/version.d.ts +0 -0
  512. /package/lib/{utils → src/utils}/worker.d.ts +0 -0
  513. /package/lib/{wrapper → src/wrapper}/functionHandler.d.ts +0 -0
  514. /package/lib/{wrapper → src/wrapper}/index.d.ts +0 -0
  515. /package/lib/{wrapper → src/wrapper}/main.d.ts +0 -0
  516. /package/lib/{wrapper → src/wrapper}/requestListener.d.ts +0 -0
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/cli/lint/annotate/github/internal.ts"],
4
4
  "sourcesContent": ["import type { InternalLintResult } from '../../internal.js';\n\nimport type * as GitHub from '@skuba-lib/api/github';\n\nexport const createInternalAnnotations = (\n internal: InternalLintResult,\n): GitHub.Annotation[] =>\n (internal.annotations ?? []).map((annotation) => ({\n annotation_level: 'failure',\n start_line: annotation.start_line ?? 1,\n end_line: annotation.end_line ?? annotation.start_line ?? 1,\n path: annotation.path,\n message: annotation.message,\n title: 'skuba lint',\n }));\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,MAAM,4BAA4B,CACvC,cAEC,SAAS,eAAe,CAAC,GAAG,IAAI,CAAC,gBAAgB;AAAA,EAChD,kBAAkB;AAAA,EAClB,YAAY,WAAW,cAAc;AAAA,EACrC,UAAU,WAAW,YAAY,WAAW,cAAc;AAAA,EAC1D,MAAM,WAAW;AAAA,EACjB,SAAS,WAAW;AAAA,EACpB,OAAO;AACT,EAAE;",
5
+ "mappings": ";AAIO,aAAM,4BAA4B,CACvC,cAEC,SAAS,eAAe,CAAC,GAAG,IAAI,CAAC,gBAAgB;AAAA,EAChD,kBAAkB;AAAA,EAClB,YAAY,WAAW,cAAc;AAAA,EACrC,UAAU,WAAW,YAAY,WAAW,cAAc;AAAA,EAC1D,MAAM,WAAW;AAAA,EACjB,SAAS,WAAW;AAAA,EACpB,OAAO;AACT,EAAE;",
6
6
  "names": []
7
7
  }
@@ -1,27 +1,5 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var prettier_exports = {};
20
- __export(prettier_exports, {
21
- createPrettierAnnotations: () => createPrettierAnnotations
22
- });
23
- module.exports = __toCommonJS(prettier_exports);
24
- const createPrettierAnnotations = (prettier) => prettier.result.errored.map((result) => {
2
+ export const createPrettierAnnotations = (prettier) => prettier.result.errored.map((result) => {
25
3
  const message = result.err instanceof Error ? result.err.message : result.err;
26
4
  return {
27
5
  annotation_level: "failure",
@@ -32,8 +10,4 @@ const createPrettierAnnotations = (prettier) => prettier.result.errored.map((res
32
10
  title: "Prettier"
33
11
  };
34
12
  });
35
- // Annotate the CommonJS export names for ESM import in node:
36
- 0 && (module.exports = {
37
- createPrettierAnnotations
38
- });
39
13
  //# sourceMappingURL=prettier.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/cli/lint/annotate/github/prettier.ts"],
4
4
  "sourcesContent": ["import type { PrettierOutput } from '../../../adapter/prettier.js';\n\nimport type * as GitHub from '@skuba-lib/api/github';\n\nexport const createPrettierAnnotations = (\n prettier: PrettierOutput,\n): GitHub.Annotation[] =>\n prettier.result.errored.map((result) => {\n const message =\n result.err instanceof Error ? result.err.message : result.err;\n\n return {\n annotation_level: 'failure',\n start_line: 1,\n end_line: 1,\n path: result.filepath,\n message:\n typeof message === 'string' || message instanceof Error\n ? String(message)\n : 'This file has not been formatted.',\n title: 'Prettier',\n };\n });\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,MAAM,4BAA4B,CACvC,aAEA,SAAS,OAAO,QAAQ,IAAI,CAAC,WAAW;AACtC,QAAM,UACJ,OAAO,eAAe,QAAQ,OAAO,IAAI,UAAU,OAAO;AAE5D,SAAO;AAAA,IACL,kBAAkB;AAAA,IAClB,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,MAAM,OAAO;AAAA,IACb,SACE,OAAO,YAAY,YAAY,mBAAmB,QAC9C,OAAO,OAAO,IACd;AAAA,IACN,OAAO;AAAA,EACT;AACF,CAAC;",
5
+ "mappings": ";AAIO,aAAM,4BAA4B,CACvC,aAEA,SAAS,OAAO,QAAQ,IAAI,CAAC,WAAW;AACtC,QAAM,UACJ,OAAO,eAAe,QAAQ,OAAO,IAAI,UAAU,OAAO;AAE5D,SAAO;AAAA,IACL,kBAAkB;AAAA,IAClB,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,MAAM,OAAO;AAAA,IACb,SACE,OAAO,YAAY,YAAY,mBAAmB,QAC9C,OAAO,OAAO,IACd;AAAA,IACN,OAAO;AAAA,EACT;AACF,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,38 +1,16 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var tsc_exports = {};
20
- __export(tsc_exports, {
21
- createTscAnnotations: () => createTscAnnotations
22
- });
23
- module.exports = __toCommonJS(tsc_exports);
24
- var import_util = require("util");
2
+ import { stripVTControlCharacters as stripAnsi } from "util";
25
3
  const tscOutputRegex = /([^\s].*)[\(:](\d+)[,:](\d+)(?:\):\s+|\s+-\s+)(error|warning|info)\s+TS(\d+)\s*:\s*([\s\S]*?)(?=\n\S)(?=\n\D)/g;
26
4
  const annotationLevelMap = {
27
5
  error: "failure",
28
6
  warning: "warning",
29
7
  info: "notice"
30
8
  };
31
- const createTscAnnotations = (tscOk, tscOutputStream) => {
9
+ export const createTscAnnotations = (tscOk, tscOutputStream) => {
32
10
  if (tscOk) {
33
11
  return [];
34
12
  }
35
- const matches = (0, import_util.stripVTControlCharacters)(tscOutputStream.output()).matchAll(tscOutputRegex);
13
+ const matches = stripAnsi(tscOutputStream.output()).matchAll(tscOutputRegex);
36
14
  return Array.from(matches).flatMap(
37
15
  (match) => match?.length === 7 && match[1] && match[4] && match[5] && match[6] ? {
38
16
  annotation_level: annotationLevelMap[match[4]],
@@ -46,8 +24,4 @@ const createTscAnnotations = (tscOk, tscOutputStream) => {
46
24
  } : []
47
25
  );
48
26
  };
49
- // Annotate the CommonJS export names for ESM import in node:
50
- 0 && (module.exports = {
51
- createTscAnnotations
52
- });
53
27
  //# sourceMappingURL=tsc.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/cli/lint/annotate/github/tsc.ts"],
4
4
  "sourcesContent": ["import { stripVTControlCharacters as stripAnsi } from 'util';\n\nimport type { StreamInterceptor } from '../../../lint/external.js';\n\nimport type * as GitHub from '@skuba-lib/api/github';\n\ntype TscLevel = 'error' | 'warning' | 'info';\n\n/**\n * Matches the `tsc \u2502` prefix on each `tsc` log.\n */\n\n/**\n * Matches regular and pretty `tsc` output.\n *\n * For example, given the following input string:\n *\n * ```console\n * src/skuba.ts:43:7 - error TS2769: No overload matches this call.\n * Overload 1 of 2, '(obj: LogContext, msg?: string | undefined, ...args: any[]): void', gave the following error.\n * Argument of type 'unknown' is not assignable to parameter of type 'LogContext'.\n * Overload 2 of 2, '(msg?: string | undefined, ...args: any[]): void', gave the following error.\n * Argument of type 'unknown' is not assignable to parameter of type 'string | undefined'.\n * Type 'unknown' is not assignable to type 'string'.\n * ```\n *\n * This pattern will produce the following matches:\n *\n * 1. src/skuba.ts\n * 2. 43\n * 3. 7\n * 4. error\n * 5. 2769\n * 6. No overload matches this call [...] not assignable to type 'string'.\n */\nconst tscOutputRegex =\n /([^\\s].*)[\\(:](\\d+)[,:](\\d+)(?:\\):\\s+|\\s+-\\s+)(error|warning|info)\\s+TS(\\d+)\\s*:\\s*([\\s\\S]*?)(?=\\n\\S)(?=\\n\\D)/g;\n\nconst annotationLevelMap: Record<\n TscLevel,\n GitHub.Annotation['annotation_level']\n> = {\n error: 'failure',\n warning: 'warning',\n info: 'notice',\n};\n\nexport const createTscAnnotations = (\n tscOk: boolean,\n tscOutputStream: StreamInterceptor,\n): GitHub.Annotation[] => {\n if (tscOk) {\n return [];\n }\n\n const matches = stripAnsi(tscOutputStream.output()).matchAll(tscOutputRegex);\n return Array.from(matches).flatMap<GitHub.Annotation>((match) =>\n match?.length === 7 && match[1] && match[4] && match[5] && match[6]\n ? {\n annotation_level: annotationLevelMap[match[4] as TscLevel],\n path: match[1],\n start_line: Number(match[2]),\n end_line: Number(match[2]),\n start_column: Number(match[3]),\n end_column: Number(match[3]),\n message: match[6].trim(),\n title: `tsc (TS${match[5]})`,\n }\n : [],\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAsD;AAmCtD,MAAM,iBACJ;AAEF,MAAM,qBAGF;AAAA,EACF,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AACR;AAEO,MAAM,uBAAuB,CAClC,OACA,oBACwB;AACxB,MAAI,OAAO;AACT,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,cAAU,YAAAA,0BAAU,gBAAgB,OAAO,CAAC,EAAE,SAAS,cAAc;AAC3E,SAAO,MAAM,KAAK,OAAO,EAAE;AAAA,IAA2B,CAAC,UACrD,OAAO,WAAW,KAAK,MAAM,CAAC,KAAK,MAAM,CAAC,KAAK,MAAM,CAAC,KAAK,MAAM,CAAC,IAC9D;AAAA,MACE,kBAAkB,mBAAmB,MAAM,CAAC,CAAa;AAAA,MACzD,MAAM,MAAM,CAAC;AAAA,MACb,YAAY,OAAO,MAAM,CAAC,CAAC;AAAA,MAC3B,UAAU,OAAO,MAAM,CAAC,CAAC;AAAA,MACzB,cAAc,OAAO,MAAM,CAAC,CAAC;AAAA,MAC7B,YAAY,OAAO,MAAM,CAAC,CAAC;AAAA,MAC3B,SAAS,MAAM,CAAC,EAAE,KAAK;AAAA,MACvB,OAAO,UAAU,MAAM,CAAC,CAAC;AAAA,IAC3B,IACA,CAAC;AAAA,EACP;AACF;",
6
- "names": ["stripAnsi"]
5
+ "mappings": ";AAAA,SAAS,4BAA4B,iBAAiB;AAmCtD,MAAM,iBACJ;AAEF,MAAM,qBAGF;AAAA,EACF,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AACR;AAEO,aAAM,uBAAuB,CAClC,OACA,oBACwB;AACxB,MAAI,OAAO;AACT,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,UAAU,UAAU,gBAAgB,OAAO,CAAC,EAAE,SAAS,cAAc;AAC3E,SAAO,MAAM,KAAK,OAAO,EAAE;AAAA,IAA2B,CAAC,UACrD,OAAO,WAAW,KAAK,MAAM,CAAC,KAAK,MAAM,CAAC,KAAK,MAAM,CAAC,KAAK,MAAM,CAAC,IAC9D;AAAA,MACE,kBAAkB,mBAAmB,MAAM,CAAC,CAAa;AAAA,MACzD,MAAM,MAAM,CAAC;AAAA,MACb,YAAY,OAAO,MAAM,CAAC,CAAC;AAAA,MAC3B,UAAU,OAAO,MAAM,CAAC,CAAC;AAAA,MACzB,cAAc,OAAO,MAAM,CAAC,CAAC;AAAA,MAC7B,YAAY,OAAO,MAAM,CAAC,CAAC;AAAA,MAC3B,SAAS,MAAM,CAAC,EAAE,KAAK;AAAA,MACvB,OAAO,UAAU,MAAM,CAAC,CAAC;AAAA,IAC3B,IACA,CAAC;AAAA,EACP;AACF;",
6
+ "names": []
7
7
  }
@@ -1,32 +1,10 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var annotate_exports = {};
20
- __export(annotate_exports, {
21
- createAnnotations: () => createAnnotations
22
- });
23
- module.exports = __toCommonJS(annotate_exports);
24
- var import_buildkite = require("./buildkite/index.js");
25
- var import_github = require("./github/index.js");
26
- const createAnnotations = async (internal, eslint, prettier, tscOk, tscOutputStream) => {
2
+ import { createBuildkiteAnnotations } from "./buildkite/index.js";
3
+ import { createGitHubAnnotations } from "./github/index.js";
4
+ export const createAnnotations = async (internal, eslint, prettier, tscOk, tscOutputStream) => {
27
5
  await Promise.all([
28
- (0, import_github.createGitHubAnnotations)(internal, eslint, prettier, tscOk, tscOutputStream),
29
- (0, import_buildkite.createBuildkiteAnnotations)(
6
+ createGitHubAnnotations(internal, eslint, prettier, tscOk, tscOutputStream),
7
+ createBuildkiteAnnotations(
30
8
  internal,
31
9
  eslint,
32
10
  prettier,
@@ -35,8 +13,4 @@ const createAnnotations = async (internal, eslint, prettier, tscOk, tscOutputStr
35
13
  )
36
14
  ]);
37
15
  };
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- createAnnotations
41
- });
42
16
  //# sourceMappingURL=index.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/cli/lint/annotate/index.ts"],
4
4
  "sourcesContent": ["import type { ESLintOutput } from '../../../cli/adapter/eslint.js';\nimport type { PrettierOutput } from '../../../cli/adapter/prettier.js';\nimport type { StreamInterceptor } from '../external.js';\nimport type { InternalLintResult } from '../internal.js';\n\nimport { createBuildkiteAnnotations } from './buildkite/index.js';\nimport { createGitHubAnnotations } from './github/index.js';\n\nexport const createAnnotations = async (\n internal: InternalLintResult,\n eslint: ESLintOutput,\n prettier: PrettierOutput,\n tscOk: boolean,\n tscOutputStream: StreamInterceptor,\n): Promise<void> => {\n await Promise.all([\n createGitHubAnnotations(internal, eslint, prettier, tscOk, tscOutputStream),\n createBuildkiteAnnotations(\n internal,\n eslint,\n prettier,\n tscOk,\n tscOutputStream,\n ),\n ]);\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,uBAA2C;AAC3C,oBAAwC;AAEjC,MAAM,oBAAoB,OAC/B,UACA,QACA,UACA,OACA,oBACkB;AAClB,QAAM,QAAQ,IAAI;AAAA,QAChB,uCAAwB,UAAU,QAAQ,UAAU,OAAO,eAAe;AAAA,QAC1E;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
5
+ "mappings": ";AAKA,SAAS,kCAAkC;AAC3C,SAAS,+BAA+B;AAEjC,aAAM,oBAAoB,OAC/B,UACA,QACA,UACA,OACA,oBACkB;AAClB,QAAM,QAAQ,IAAI;AAAA,IAChB,wBAAwB,UAAU,QAAQ,UAAU,OAAO,eAAe;AAAA,IAC1E;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -1,60 +1,26 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var autofix_exports = {};
30
- __export(autofix_exports, {
31
- AUTOFIX_IGNORE_FILES_BASE: () => AUTOFIX_IGNORE_FILES_BASE,
32
- AUTOFIX_IGNORE_FILES_NPMRC: () => AUTOFIX_IGNORE_FILES_NPMRC,
33
- autofix: () => autofix
34
- });
35
- module.exports = __toCommonJS(autofix_exports);
36
- var import_util = require("util");
37
- var import_simple_git = __toESM(require("simple-git"));
38
- var import_env = require("../../utils/env.js");
39
- var import_logging = require("../../utils/logging.js");
40
- var import_npmrc = require("../../utils/npmrc.js");
41
- var import_wait = require("../../utils/wait.js");
42
- var import_eslint = require("../adapter/eslint.js");
43
- var import_prettier = require("../adapter/prettier.js");
44
- var import_project = require("../configure/analysis/project.js");
45
- var import_internal = require("./internal.js");
46
- var Buildkite = __toESM(require("@skuba-lib/api/buildkite"));
47
- var Git = __toESM(require("@skuba-lib/api/git"));
48
- var GitHub = __toESM(require("@skuba-lib/api/github"));
2
+ import { inspect } from "util";
3
+ import { simpleGit } from "simple-git";
4
+ import { isCiEnv } from "../../utils/env.js";
5
+ import { createLogger, log } from "../../utils/logging.js";
6
+ import { hasNpmrcSecret } from "../../utils/npmrc.js";
7
+ import { throwOnTimeout } from "../../utils/wait.js";
8
+ import { runESLint } from "../adapter/eslint.js";
9
+ import { runPrettier } from "../adapter/prettier.js";
10
+ import { createDestinationFileReader } from "../configure/analysis/project.js";
11
+ import { internalLint } from "./internal.js";
12
+ import * as Buildkite from "@skuba-lib/api/buildkite";
13
+ import * as Git from "@skuba-lib/api/git";
14
+ import * as GitHub from "@skuba-lib/api/github";
49
15
  const RENOVATE_DEFAULT_PREFIX = "renovate";
50
16
  const AUTOFIX_COMMIT_MESSAGE = "Run `skuba format`";
51
- const AUTOFIX_IGNORE_FILES_BASE = [
17
+ export const AUTOFIX_IGNORE_FILES_BASE = [
52
18
  {
53
19
  path: "Dockerfile-incunabulum",
54
20
  state: "added"
55
21
  }
56
22
  ];
57
- const AUTOFIX_IGNORE_FILES_NPMRC = [
23
+ export const AUTOFIX_IGNORE_FILES_NPMRC = [
58
24
  {
59
25
  path: ".npmrc",
60
26
  state: "added"
@@ -68,7 +34,7 @@ const shouldPush = async ({
68
34
  currentBranch,
69
35
  dir
70
36
  }) => {
71
- if (!(0, import_env.isCiEnv)()) {
37
+ if (!isCiEnv()) {
72
38
  return false;
73
39
  }
74
40
  const isDefaultBuildkiteBranch = currentBranch && [process.env.BUILDKITE_PIPELINE_DEFAULT_BRANCH, "master", "main"].includes(
@@ -83,7 +49,7 @@ const shouldPush = async ({
83
49
  await GitHub.getPullRequestNumber();
84
50
  } catch {
85
51
  const warning = "An autofix is available, but it was not pushed because an open pull request for this Renovate branch could not be found. If a pull request has since been created, retry the lint step to push the fix.";
86
- import_logging.log.warn(warning);
52
+ log.warn(warning);
87
53
  try {
88
54
  await Buildkite.annotate(Buildkite.md.terminal(warning));
89
55
  } catch {
@@ -102,13 +68,13 @@ const shouldPush = async ({
102
68
  return true;
103
69
  };
104
70
  const getIgnores = async (dir) => {
105
- const contents = await (0, import_project.createDestinationFileReader)(dir)(".npmrc");
106
- if ((0, import_npmrc.hasNpmrcSecret)(contents ?? "")) {
71
+ const contents = await createDestinationFileReader(dir)(".npmrc");
72
+ if (hasNpmrcSecret(contents ?? "")) {
107
73
  return [...AUTOFIX_IGNORE_FILES_BASE, ...AUTOFIX_IGNORE_FILES_NPMRC];
108
74
  }
109
75
  return AUTOFIX_IGNORE_FILES_BASE;
110
76
  };
111
- const autofix = async (params) => {
77
+ export const autofix = async (params) => {
112
78
  const dir = process.cwd();
113
79
  if (!params.eslint && !params.prettier && !params.internal) {
114
80
  return;
@@ -122,8 +88,8 @@ const autofix = async (params) => {
122
88
  return;
123
89
  }
124
90
  try {
125
- import_logging.log.newline();
126
- import_logging.log.warn(
91
+ log.newline();
92
+ log.warn(
127
93
  `Attempting to autofix issues (${[
128
94
  params.internal ? "skuba" : void 0,
129
95
  params.internal || params.eslint ? "ESLint" : void 0,
@@ -131,14 +97,14 @@ const autofix = async (params) => {
131
97
  // Prettier is always run
132
98
  ].filter((s) => s !== void 0).join(", ")})...`
133
99
  );
134
- const logger = (0, import_logging.createLogger)({ debug: params.debug });
100
+ const logger = createLogger({ debug: params.debug });
135
101
  if (params.internal) {
136
- await (0, import_internal.internalLint)("format");
102
+ await internalLint("format");
137
103
  }
138
104
  if (params.internal || params.eslint) {
139
- await (0, import_eslint.runESLint)("format", logger, params.eslintConfigFile);
105
+ await runESLint("format", logger, params.eslintConfigFile);
140
106
  }
141
- await (0, import_prettier.runPrettier)("format", logger);
107
+ await runPrettier("format", logger);
142
108
  if (process.env.GITHUB_ACTIONS) {
143
109
  const ref2 = await Git.commitAllChanges({
144
110
  dir,
@@ -146,20 +112,20 @@ const autofix = async (params) => {
146
112
  ignore: await getIgnores(dir)
147
113
  });
148
114
  if (!ref2) {
149
- return import_logging.log.warn("No autofixes detected.");
115
+ return log.warn("No autofixes detected.");
150
116
  }
151
- await (0, import_wait.throwOnTimeout)((0, import_simple_git.default)().push(), { s: 30 });
152
- import_logging.log.warn(`Pushed fix commit ${ref2}.`);
117
+ await throwOnTimeout(simpleGit().push(), { s: 30 });
118
+ log.warn(`Pushed fix commit ${ref2}.`);
153
119
  return;
154
120
  }
155
121
  if (!currentBranch) {
156
- import_logging.log.warn("Could not determine the current branch.");
157
- import_logging.log.warn(
122
+ log.warn("Could not determine the current branch.");
123
+ log.warn(
158
124
  "Please propagate BUILDKITE_BRANCH, GITHUB_HEAD_REF, GITHUB_REF_NAME, or the .git directory to your container."
159
125
  );
160
126
  return;
161
127
  }
162
- const ref = await (0, import_wait.throwOnTimeout)(
128
+ const ref = await throwOnTimeout(
163
129
  GitHub.uploadAllFileChanges({
164
130
  branch: currentBranch,
165
131
  dir,
@@ -169,23 +135,17 @@ const autofix = async (params) => {
169
135
  { s: 30 }
170
136
  );
171
137
  if (!ref) {
172
- return import_logging.log.warn("No autofixes detected.");
138
+ return log.warn("No autofixes detected.");
173
139
  }
174
- import_logging.log.warn(`Pushed fix commit ${ref}.`);
140
+ log.warn(`Pushed fix commit ${ref}.`);
175
141
  } catch (err) {
176
- import_logging.log.warn(import_logging.log.bold("Failed to push fix commit."));
177
- import_logging.log.warn(
178
- import_logging.log.bold(
142
+ log.warn(log.bold("Failed to push fix commit."));
143
+ log.warn(
144
+ log.bold(
179
145
  "Does your CI environment have write access to your Git repository?"
180
146
  )
181
147
  );
182
- import_logging.log.subtle((0, import_util.inspect)(err));
148
+ log.subtle(inspect(err));
183
149
  }
184
150
  };
185
- // Annotate the CommonJS export names for ESM import in node:
186
- 0 && (module.exports = {
187
- AUTOFIX_IGNORE_FILES_BASE,
188
- AUTOFIX_IGNORE_FILES_NPMRC,
189
- autofix
190
- });
191
151
  //# sourceMappingURL=autofix.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/lint/autofix.ts"],
4
- "sourcesContent": ["import { inspect } from 'util';\n\nimport simpleGit from 'simple-git';\n\nimport { isCiEnv } from '../../utils/env.js';\nimport { createLogger, log } from '../../utils/logging.js';\nimport { hasNpmrcSecret } from '../../utils/npmrc.js';\nimport { throwOnTimeout } from '../../utils/wait.js';\nimport { runESLint } from '../adapter/eslint.js';\nimport { runPrettier } from '../adapter/prettier.js';\nimport { createDestinationFileReader } from '../configure/analysis/project.js';\n\nimport { internalLint } from './internal.js';\nimport type { Input } from './types.js';\n\nimport * as Buildkite from '@skuba-lib/api/buildkite';\nimport * as Git from '@skuba-lib/api/git';\nimport * as GitHub from '@skuba-lib/api/github';\n\nconst RENOVATE_DEFAULT_PREFIX = 'renovate';\n\nconst AUTOFIX_COMMIT_MESSAGE = 'Run `skuba format`';\n\nexport const AUTOFIX_IGNORE_FILES_BASE: Git.ChangedFile[] = [\n {\n path: 'Dockerfile-incunabulum',\n state: 'added',\n },\n];\n\nexport const AUTOFIX_IGNORE_FILES_NPMRC: Git.ChangedFile[] = [\n {\n path: '.npmrc',\n state: 'added',\n },\n {\n path: '.npmrc',\n state: 'modified',\n },\n];\n\nconst shouldPush = async ({\n currentBranch,\n dir,\n}: {\n currentBranch?: string;\n dir: string;\n}) => {\n if (!isCiEnv()) {\n // We're not running in a CI environment so we don't need to push autofixes.\n // Ideally we'd drive this off of repository write permissions, but that is\n // non-trivial to infer without attempting an actual write.\n return false;\n }\n\n const isDefaultBuildkiteBranch =\n currentBranch &&\n [process.env.BUILDKITE_PIPELINE_DEFAULT_BRANCH, 'master', 'main'].includes(\n currentBranch,\n );\n\n const isProtectedGitHubBranch = process.env.GITHUB_REF_PROTECTED === 'true';\n\n if (isDefaultBuildkiteBranch || isProtectedGitHubBranch) {\n // The current branch is a protected branch.\n // We respect GitHub Flow; avoid pushing directly to the default branch.\n return false;\n }\n\n if (currentBranch?.startsWith(RENOVATE_DEFAULT_PREFIX)) {\n try {\n await GitHub.getPullRequestNumber();\n } catch {\n const warning =\n 'An autofix is available, but it was not pushed because an open pull request for this Renovate branch could not be found. If a pull request has since been created, retry the lint step to push the fix.';\n log.warn(warning);\n try {\n await Buildkite.annotate(Buildkite.md.terminal(warning));\n } catch {}\n\n return false;\n }\n }\n\n let headCommitMessage;\n try {\n headCommitMessage = await Git.getHeadCommitMessage({ dir });\n } catch {}\n\n if (headCommitMessage?.startsWith(AUTOFIX_COMMIT_MESSAGE)) {\n // Short circuit when the head commit appears to be one of our autofixes.\n // Repeating the same operation is unlikely to correct outstanding issues.\n return false;\n }\n\n // Allow the push attempt to go ahead if our guards have been cleared.\n return true;\n};\n\nconst getIgnores = async (dir: string): Promise<Git.ChangedFile[]> => {\n const contents = await createDestinationFileReader(dir)('.npmrc');\n\n // If an .npmrc has secrets, we need to ignore it\n if (hasNpmrcSecret(contents ?? '')) {\n return [...AUTOFIX_IGNORE_FILES_BASE, ...AUTOFIX_IGNORE_FILES_NPMRC];\n }\n\n return AUTOFIX_IGNORE_FILES_BASE;\n};\n\ninterface AutofixParameters {\n debug: Input['debug'];\n\n eslint: boolean;\n prettier: boolean;\n internal: boolean;\n\n eslintConfigFile?: string;\n}\n\nexport const autofix = async (params: AutofixParameters): Promise<void> => {\n const dir = process.cwd();\n\n if (!params.eslint && !params.prettier && !params.internal) {\n return;\n }\n\n let currentBranch;\n try {\n currentBranch = await Git.currentBranch({ dir });\n } catch {}\n\n if (!(await shouldPush({ currentBranch, dir }))) {\n return;\n }\n\n try {\n log.newline();\n\n log.warn(\n `Attempting to autofix issues (${[\n params.internal ? 'skuba' : undefined,\n params.internal || params.eslint ? 'ESLint' : undefined,\n 'Prettier', // Prettier is always run\n ]\n .filter((s) => s !== undefined)\n .join(', ')})...`,\n );\n\n const logger = createLogger({ debug: params.debug });\n\n if (params.internal) {\n await internalLint('format');\n }\n\n if (params.internal || params.eslint) {\n await runESLint('format', logger, params.eslintConfigFile);\n }\n\n // Unconditionally re-run Prettier; reaching here means we have pre-existing\n // format violations or may have created new ones through ESLint/internal fixes.\n await runPrettier('format', logger);\n\n if (process.env.GITHUB_ACTIONS) {\n // GitHub runners have Git installed locally\n const ref = await Git.commitAllChanges({\n dir,\n message: AUTOFIX_COMMIT_MESSAGE,\n\n ignore: await getIgnores(dir),\n });\n\n if (!ref) {\n return log.warn('No autofixes detected.');\n }\n\n await throwOnTimeout(simpleGit().push(), { s: 30 });\n log.warn(`Pushed fix commit ${ref}.`);\n return;\n }\n\n // Other CI Environments, use GitHub API\n if (!currentBranch) {\n log.warn('Could not determine the current branch.');\n log.warn(\n 'Please propagate BUILDKITE_BRANCH, GITHUB_HEAD_REF, GITHUB_REF_NAME, or the .git directory to your container.',\n );\n return;\n }\n\n const ref = await throwOnTimeout(\n GitHub.uploadAllFileChanges({\n branch: currentBranch,\n dir,\n messageHeadline: AUTOFIX_COMMIT_MESSAGE,\n\n ignore: await getIgnores(dir),\n }),\n { s: 30 },\n );\n\n if (!ref) {\n return log.warn('No autofixes detected.');\n }\n\n log.warn(`Pushed fix commit ${ref}.`);\n } catch (err) {\n log.warn(log.bold('Failed to push fix commit.'));\n log.warn(\n log.bold(\n 'Does your CI environment have write access to your Git repository?',\n ),\n );\n log.subtle(inspect(err));\n }\n};\n"],
5
- "mappings": "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",
6
- "names": ["ref", "simpleGit"]
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport { simpleGit } from 'simple-git';\n\nimport { isCiEnv } from '../../utils/env.js';\nimport { createLogger, log } from '../../utils/logging.js';\nimport { hasNpmrcSecret } from '../../utils/npmrc.js';\nimport { throwOnTimeout } from '../../utils/wait.js';\nimport { runESLint } from '../adapter/eslint.js';\nimport { runPrettier } from '../adapter/prettier.js';\nimport { createDestinationFileReader } from '../configure/analysis/project.js';\n\nimport { internalLint } from './internal.js';\nimport type { Input } from './types.js';\n\nimport * as Buildkite from '@skuba-lib/api/buildkite';\nimport * as Git from '@skuba-lib/api/git';\nimport * as GitHub from '@skuba-lib/api/github';\n\nconst RENOVATE_DEFAULT_PREFIX = 'renovate';\n\nconst AUTOFIX_COMMIT_MESSAGE = 'Run `skuba format`';\n\nexport const AUTOFIX_IGNORE_FILES_BASE: Git.ChangedFile[] = [\n {\n path: 'Dockerfile-incunabulum',\n state: 'added',\n },\n];\n\nexport const AUTOFIX_IGNORE_FILES_NPMRC: Git.ChangedFile[] = [\n {\n path: '.npmrc',\n state: 'added',\n },\n {\n path: '.npmrc',\n state: 'modified',\n },\n];\n\nconst shouldPush = async ({\n currentBranch,\n dir,\n}: {\n currentBranch?: string;\n dir: string;\n}) => {\n if (!isCiEnv()) {\n // We're not running in a CI environment so we don't need to push autofixes.\n // Ideally we'd drive this off of repository write permissions, but that is\n // non-trivial to infer without attempting an actual write.\n return false;\n }\n\n const isDefaultBuildkiteBranch =\n currentBranch &&\n [process.env.BUILDKITE_PIPELINE_DEFAULT_BRANCH, 'master', 'main'].includes(\n currentBranch,\n );\n\n const isProtectedGitHubBranch = process.env.GITHUB_REF_PROTECTED === 'true';\n\n if (isDefaultBuildkiteBranch || isProtectedGitHubBranch) {\n // The current branch is a protected branch.\n // We respect GitHub Flow; avoid pushing directly to the default branch.\n return false;\n }\n\n if (currentBranch?.startsWith(RENOVATE_DEFAULT_PREFIX)) {\n try {\n await GitHub.getPullRequestNumber();\n } catch {\n const warning =\n 'An autofix is available, but it was not pushed because an open pull request for this Renovate branch could not be found. If a pull request has since been created, retry the lint step to push the fix.';\n log.warn(warning);\n try {\n await Buildkite.annotate(Buildkite.md.terminal(warning));\n } catch {}\n\n return false;\n }\n }\n\n let headCommitMessage;\n try {\n headCommitMessage = await Git.getHeadCommitMessage({ dir });\n } catch {}\n\n if (headCommitMessage?.startsWith(AUTOFIX_COMMIT_MESSAGE)) {\n // Short circuit when the head commit appears to be one of our autofixes.\n // Repeating the same operation is unlikely to correct outstanding issues.\n return false;\n }\n\n // Allow the push attempt to go ahead if our guards have been cleared.\n return true;\n};\n\nconst getIgnores = async (dir: string): Promise<Git.ChangedFile[]> => {\n const contents = await createDestinationFileReader(dir)('.npmrc');\n\n // If an .npmrc has secrets, we need to ignore it\n if (hasNpmrcSecret(contents ?? '')) {\n return [...AUTOFIX_IGNORE_FILES_BASE, ...AUTOFIX_IGNORE_FILES_NPMRC];\n }\n\n return AUTOFIX_IGNORE_FILES_BASE;\n};\n\ninterface AutofixParameters {\n debug: Input['debug'];\n\n eslint: boolean;\n prettier: boolean;\n internal: boolean;\n\n eslintConfigFile?: string;\n}\n\nexport const autofix = async (params: AutofixParameters): Promise<void> => {\n const dir = process.cwd();\n\n if (!params.eslint && !params.prettier && !params.internal) {\n return;\n }\n\n let currentBranch;\n try {\n currentBranch = await Git.currentBranch({ dir });\n } catch {}\n\n if (!(await shouldPush({ currentBranch, dir }))) {\n return;\n }\n\n try {\n log.newline();\n\n log.warn(\n `Attempting to autofix issues (${[\n params.internal ? 'skuba' : undefined,\n params.internal || params.eslint ? 'ESLint' : undefined,\n 'Prettier', // Prettier is always run\n ]\n .filter((s) => s !== undefined)\n .join(', ')})...`,\n );\n\n const logger = createLogger({ debug: params.debug });\n\n if (params.internal) {\n await internalLint('format');\n }\n\n if (params.internal || params.eslint) {\n await runESLint('format', logger, params.eslintConfigFile);\n }\n\n // Unconditionally re-run Prettier; reaching here means we have pre-existing\n // format violations or may have created new ones through ESLint/internal fixes.\n await runPrettier('format', logger);\n\n if (process.env.GITHUB_ACTIONS) {\n // GitHub runners have Git installed locally\n const ref = await Git.commitAllChanges({\n dir,\n message: AUTOFIX_COMMIT_MESSAGE,\n\n ignore: await getIgnores(dir),\n });\n\n if (!ref) {\n return log.warn('No autofixes detected.');\n }\n\n await throwOnTimeout(simpleGit().push(), { s: 30 });\n log.warn(`Pushed fix commit ${ref}.`);\n return;\n }\n\n // Other CI Environments, use GitHub API\n if (!currentBranch) {\n log.warn('Could not determine the current branch.');\n log.warn(\n 'Please propagate BUILDKITE_BRANCH, GITHUB_HEAD_REF, GITHUB_REF_NAME, or the .git directory to your container.',\n );\n return;\n }\n\n const ref = await throwOnTimeout(\n GitHub.uploadAllFileChanges({\n branch: currentBranch,\n dir,\n messageHeadline: AUTOFIX_COMMIT_MESSAGE,\n\n ignore: await getIgnores(dir),\n }),\n { s: 30 },\n );\n\n if (!ref) {\n return log.warn('No autofixes detected.');\n }\n\n log.warn(`Pushed fix commit ${ref}.`);\n } catch (err) {\n log.warn(log.bold('Failed to push fix commit.'));\n log.warn(\n log.bold(\n 'Does your CI environment have write access to your Git repository?',\n ),\n );\n log.subtle(inspect(err));\n }\n};\n"],
5
+ "mappings": "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",
6
+ "names": ["ref"]
7
7
  }
@@ -1,62 +1,24 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var eslint_exports = {};
30
- __export(eslint_exports, {
31
- runESLintInCurrentThread: () => runESLintInCurrentThread,
32
- runESLintInWorkerThread: () => runESLintInWorkerThread
33
- });
34
- module.exports = __toCommonJS(eslint_exports);
35
- var import_path = __toESM(require("path"));
36
- var import_worker_threads = require("worker_threads");
37
- var import_chalk = __toESM(require("chalk"));
38
- var import_logging = require("../../utils/logging.js");
39
- var import_worker = require("../../utils/worker.js");
40
- var import_eslint = require("../adapter/eslint.js");
41
- const LOG_PREFIX = import_chalk.default.magenta("ESLint \u2502");
42
- const runESLintInCurrentThread = ({ debug, eslintConfigFile }) => (0, import_eslint.runESLint)(
2
+ import path from "path";
3
+ import { isMainThread } from "worker_threads";
4
+ import chalk from "chalk";
5
+ import { createLogger } from "../../utils/logging.js";
6
+ import { execWorkerThread, postWorkerOutput } from "../../utils/worker.js";
7
+ import { runESLint } from "../adapter/eslint.js";
8
+ const LOG_PREFIX = chalk.magenta("ESLint \u2502");
9
+ export const runESLintInCurrentThread = ({ debug, eslintConfigFile }) => runESLint(
43
10
  "lint",
44
- (0, import_logging.createLogger)({ debug, prefixes: [LOG_PREFIX] }),
11
+ createLogger({ debug, prefixes: [LOG_PREFIX] }),
45
12
  eslintConfigFile
46
13
  );
47
- const runESLintInWorkerThread = (input) => (0, import_worker.execWorkerThread)(
48
- import_path.default.posix.join(__dirname, "eslint.js"),
14
+ export const runESLintInWorkerThread = (input) => execWorkerThread(
15
+ path.posix.join(import.meta.dirname, "eslint.js"),
49
16
  input
50
17
  );
51
- if (!import_worker_threads.isMainThread) {
52
- (0, import_worker.postWorkerOutput)(
18
+ if (!isMainThread) {
19
+ postWorkerOutput(
53
20
  runESLintInCurrentThread,
54
- (0, import_logging.createLogger)({ debug: false, prefixes: [LOG_PREFIX] })
21
+ createLogger({ debug: false, prefixes: [LOG_PREFIX] })
55
22
  );
56
23
  }
57
- // Annotate the CommonJS export names for ESM import in node:
58
- 0 && (module.exports = {
59
- runESLintInCurrentThread,
60
- runESLintInWorkerThread
61
- });
62
24
  //# sourceMappingURL=eslint.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/lint/eslint.ts"],
4
- "sourcesContent": ["import path from 'path';\nimport { isMainThread } from 'worker_threads';\n\nimport chalk from 'chalk';\n\nimport { createLogger } from '../../utils/logging.js';\nimport { execWorkerThread, postWorkerOutput } from '../../utils/worker.js';\nimport { type ESLintOutput, runESLint } from '../adapter/eslint.js';\n\nimport type { Input } from './types.js';\n\nconst LOG_PREFIX = chalk.magenta('ESLint \u2502');\n\nexport const runESLintInCurrentThread = ({ debug, eslintConfigFile }: Input) =>\n runESLint(\n 'lint',\n createLogger({ debug, prefixes: [LOG_PREFIX] }),\n eslintConfigFile,\n );\n\nexport const runESLintInWorkerThread = (input: Input) =>\n execWorkerThread<Input, ESLintOutput>(\n path.posix.join(__dirname, 'eslint.js'),\n input,\n );\n\nif (!isMainThread) {\n postWorkerOutput(\n runESLintInCurrentThread,\n createLogger({ debug: false, prefixes: [LOG_PREFIX] }),\n );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,4BAA6B;AAE7B,mBAAkB;AAElB,qBAA6B;AAC7B,oBAAmD;AACnD,oBAA6C;AAI7C,MAAM,aAAa,aAAAA,QAAM,QAAQ,iBAAY;AAEtC,MAAM,2BAA2B,CAAC,EAAE,OAAO,iBAAiB,UACjE;AAAA,EACE;AAAA,MACA,6BAAa,EAAE,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;AAAA,EAC9C;AACF;AAEK,MAAM,0BAA0B,CAAC,cACtC;AAAA,EACE,YAAAC,QAAK,MAAM,KAAK,WAAW,WAAW;AAAA,EACtC;AACF;AAEF,IAAI,CAAC,oCAAc;AACjB;AAAA,IACE;AAAA,QACA,6BAAa,EAAE,OAAO,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;AAAA,EACvD;AACF;",
6
- "names": ["chalk", "path"]
4
+ "sourcesContent": ["import path from 'path';\nimport { isMainThread } from 'worker_threads';\n\nimport chalk from 'chalk';\n\nimport { createLogger } from '../../utils/logging.js';\nimport { execWorkerThread, postWorkerOutput } from '../../utils/worker.js';\nimport { type ESLintOutput, runESLint } from '../adapter/eslint.js';\n\nimport type { Input } from './types.js';\n\nconst LOG_PREFIX = chalk.magenta('ESLint \u2502');\n\nexport const runESLintInCurrentThread = ({ debug, eslintConfigFile }: Input) =>\n runESLint(\n 'lint',\n createLogger({ debug, prefixes: [LOG_PREFIX] }),\n eslintConfigFile,\n );\n\nexport const runESLintInWorkerThread = (input: Input) =>\n execWorkerThread<Input, ESLintOutput>(\n path.posix.join(import.meta.dirname, 'eslint.js'),\n input,\n );\n\nif (!isMainThread) {\n postWorkerOutput(\n runESLintInCurrentThread,\n createLogger({ debug: false, prefixes: [LOG_PREFIX] }),\n );\n}\n"],
5
+ "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,oBAAoB;AAE7B,OAAO,WAAW;AAElB,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB,wBAAwB;AACnD,SAA4B,iBAAiB;AAI7C,MAAM,aAAa,MAAM,QAAQ,iBAAY;AAEtC,aAAM,2BAA2B,CAAC,EAAE,OAAO,iBAAiB,MACjE;AAAA,EACE;AAAA,EACA,aAAa,EAAE,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;AAAA,EAC9C;AACF;AAEK,aAAM,0BAA0B,CAAC,UACtC;AAAA,EACE,KAAK,MAAM,KAAK,YAAY,SAAS,WAAW;AAAA,EAChD;AACF;AAEF,IAAI,CAAC,cAAc;AACjB;AAAA,IACE;AAAA,IACA,aAAa,EAAE,OAAO,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;AAAA,EACvD;AACF;",
6
+ "names": []
7
7
  }
@@ -1,43 +1,13 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var external_exports = {};
30
- __export(external_exports, {
31
- StreamInterceptor: () => StreamInterceptor,
32
- externalLint: () => externalLint
33
- });
34
- module.exports = __toCommonJS(external_exports);
35
- var import_stream = __toESM(require("stream"));
36
- var import_eslint = require("./eslint.js");
37
- var import_prettier = require("./prettier.js");
38
- var import_tsc = require("./tsc.js");
2
+ import stream from "stream";
3
+ import { runESLintInCurrentThread, runESLintInWorkerThread } from "./eslint.js";
4
+ import {
5
+ runPrettierInCurrentThread,
6
+ runPrettierInWorkerThread
7
+ } from "./prettier.js";
8
+ import { runTscInNewProcess } from "./tsc.js";
39
9
  const tscPrefixRegex = /^(.*?tsc\s+│.*?\s)/gm;
40
- class StreamInterceptor extends import_stream.default.Transform {
10
+ export class StreamInterceptor extends stream.Transform {
41
11
  chunks = [];
42
12
  output() {
43
13
  return Buffer.concat(this.chunks).toString().replace(tscPrefixRegex, "");
@@ -49,22 +19,22 @@ class StreamInterceptor extends import_stream.default.Transform {
49
19
  }
50
20
  const lintConcurrently = async ({ tscOutputStream, ...input }) => {
51
21
  const [eslint, prettier, tscOk] = await Promise.all([
52
- (0, import_eslint.runESLintInWorkerThread)(input),
53
- (0, import_prettier.runPrettierInWorkerThread)(input),
54
- (0, import_tsc.runTscInNewProcess)({ ...input, tscOutputStream })
22
+ runESLintInWorkerThread(input),
23
+ runPrettierInWorkerThread(input),
24
+ runTscInNewProcess({ ...input, tscOutputStream })
55
25
  ]);
56
26
  return { eslint, prettier, tscOk };
57
27
  };
58
28
  const lintSerially = async ({ tscOutputStream, ...input }) => {
59
- const eslint = await (0, import_eslint.runESLintInWorkerThread)(input);
60
- const prettier = await (0, import_prettier.runPrettierInWorkerThread)(input);
61
- const tscOk = await (0, import_tsc.runTscInNewProcess)({ ...input, tscOutputStream });
29
+ const eslint = await runESLintInWorkerThread(input);
30
+ const prettier = await runPrettierInWorkerThread(input);
31
+ const tscOk = await runTscInNewProcess({ ...input, tscOutputStream });
62
32
  return { eslint, prettier, tscOk };
63
33
  };
64
34
  const lintSeriallyWithoutWorkerThreads = async (input) => {
65
- const eslint = await (0, import_eslint.runESLintInCurrentThread)(input);
66
- const prettier = await (0, import_prettier.runPrettierInCurrentThread)(input);
67
- const tscOk = await (0, import_tsc.runTscInNewProcess)(input);
35
+ const eslint = await runESLintInCurrentThread(input);
36
+ const prettier = await runPrettierInCurrentThread(input);
37
+ const tscOk = await runTscInNewProcess(input);
68
38
  return { eslint, prettier, tscOk };
69
39
  };
70
40
  const selectLintFunction = (input) => {
@@ -74,7 +44,7 @@ const selectLintFunction = (input) => {
74
44
  const isSerial = input.debug || input.serial;
75
45
  return isSerial ? lintSerially : lintConcurrently;
76
46
  };
77
- const externalLint = async (input) => {
47
+ export const externalLint = async (input) => {
78
48
  const lint = selectLintFunction(input);
79
49
  const tscOutputStream = new StreamInterceptor();
80
50
  tscOutputStream.pipe(input.tscOutputStream ?? process.stdout);
@@ -86,9 +56,4 @@ const externalLint = async (input) => {
86
56
  tscOutputStream
87
57
  };
88
58
  };
89
- // Annotate the CommonJS export names for ESM import in node:
90
- 0 && (module.exports = {
91
- StreamInterceptor,
92
- externalLint
93
- });
94
59
  //# sourceMappingURL=external.js.map