skuba 14.0.0-esmify-skuba-20251105034821 → 14.0.0-hacky-hack-lang-json-20260109051908

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 (408) hide show
  1. package/config/eslint.js +1 -1
  2. package/config/jest.js +1 -0
  3. package/config/prettier.d.ts +4 -8
  4. package/config/prettier.js +2 -10
  5. package/jest/moduleNameMapper.js +64 -0
  6. package/jest/transform.js +62 -0
  7. package/jest/tsConfig.js +26 -0
  8. package/jest-preset.js +37 -0
  9. package/lib/api/jest/index.d.ts +15 -0
  10. package/lib/api/jest/index.js +59 -0
  11. package/lib/api/jest/index.js.map +7 -0
  12. package/lib/cli/adapter/eslint.js +45 -11
  13. package/lib/cli/adapter/eslint.js.map +3 -3
  14. package/lib/cli/adapter/prettier.js +67 -39
  15. package/lib/cli/adapter/prettier.js.map +2 -2
  16. package/lib/cli/build/args.js +42 -8
  17. package/lib/cli/build/args.js.map +2 -2
  18. package/lib/cli/build/assets.d.ts +3 -2
  19. package/lib/cli/build/assets.js +60 -28
  20. package/lib/cli/build/assets.js.map +3 -3
  21. package/lib/cli/build/esbuild.d.ts +4 -2
  22. package/lib/cli/build/esbuild.js +64 -23
  23. package/lib/cli/build/esbuild.js.map +2 -2
  24. package/lib/cli/build/index.js +53 -21
  25. package/lib/cli/build/index.js.map +2 -2
  26. package/lib/cli/build/tsc.js +60 -24
  27. package/lib/cli/build/tsc.js.map +3 -3
  28. package/lib/cli/buildPackage/index.js +32 -8
  29. package/lib/cli/buildPackage/index.js.map +1 -1
  30. package/lib/cli/configure/analyseConfiguration.js +50 -16
  31. package/lib/cli/configure/analyseConfiguration.js.map +2 -2
  32. package/lib/cli/configure/analyseDependencies.d.ts +1 -1
  33. package/lib/cli/configure/analyseDependencies.js +59 -25
  34. package/lib/cli/configure/analyseDependencies.js.map +3 -3
  35. package/lib/cli/configure/analysis/diff.js +29 -5
  36. package/lib/cli/configure/analysis/diff.js.map +2 -2
  37. package/lib/cli/configure/analysis/files.js +42 -8
  38. package/lib/cli/configure/analysis/files.js.map +2 -2
  39. package/lib/cli/configure/analysis/git.js +46 -12
  40. package/lib/cli/configure/analysis/git.js.map +2 -2
  41. package/lib/cli/configure/analysis/package.d.ts +3 -2
  42. package/lib/cli/configure/analysis/package.js +45 -10
  43. package/lib/cli/configure/analysis/package.js.map +3 -3
  44. package/lib/cli/configure/analysis/project.js +50 -18
  45. package/lib/cli/configure/analysis/project.js.map +2 -2
  46. package/lib/cli/configure/dependencies/index.js +35 -7
  47. package/lib/cli/configure/dependencies/index.js.map +1 -1
  48. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js +28 -4
  49. package/lib/cli/configure/dependencies/seekDatadogCustomMetrics.js.map +1 -1
  50. package/lib/cli/configure/dependencies/seekKoala.js +28 -4
  51. package/lib/cli/configure/dependencies/seekKoala.js.map +1 -1
  52. package/lib/cli/configure/dependencies/skuba.js +28 -4
  53. package/lib/cli/configure/dependencies/skuba.js.map +1 -1
  54. package/lib/cli/configure/dependencies/skubaDeps.js +26 -2
  55. package/lib/cli/configure/dependencies/skubaDeps.js.map +1 -1
  56. package/lib/cli/configure/dependencies/skubaDive.js +29 -4
  57. package/lib/cli/configure/dependencies/skubaDive.js.map +1 -1
  58. package/lib/cli/configure/ensureTemplateCompletion.d.ts +1 -1
  59. package/lib/cli/configure/ensureTemplateCompletion.js +63 -32
  60. package/lib/cli/configure/ensureTemplateCompletion.js.map +3 -3
  61. package/lib/cli/configure/getEntryPoint.d.ts +2 -2
  62. package/lib/cli/configure/getEntryPoint.js +51 -19
  63. package/lib/cli/configure/getEntryPoint.js.map +3 -3
  64. package/lib/cli/configure/getProjectType.d.ts +1 -1
  65. package/lib/cli/configure/getProjectType.js +36 -17
  66. package/lib/cli/configure/getProjectType.js.map +2 -2
  67. package/lib/cli/configure/index.js +91 -56
  68. package/lib/cli/configure/index.js.map +3 -3
  69. package/lib/cli/configure/modules/eslint.js +34 -10
  70. package/lib/cli/configure/modules/eslint.js.map +1 -1
  71. package/lib/cli/configure/modules/ignore.js +32 -8
  72. package/lib/cli/configure/modules/ignore.js.map +1 -1
  73. package/lib/cli/configure/modules/index.js +44 -18
  74. package/lib/cli/configure/modules/index.js.map +2 -2
  75. package/lib/cli/configure/modules/jest.d.ts +2 -0
  76. package/lib/cli/configure/modules/jest.js +86 -0
  77. package/lib/cli/configure/modules/jest.js.map +7 -0
  78. package/lib/cli/configure/modules/nodemon.js +28 -4
  79. package/lib/cli/configure/modules/nodemon.js.map +1 -1
  80. package/lib/cli/configure/modules/package.js +34 -10
  81. package/lib/cli/configure/modules/package.js.map +1 -1
  82. package/lib/cli/configure/modules/prettier.js +35 -11
  83. package/lib/cli/configure/modules/prettier.js.map +1 -1
  84. package/lib/cli/configure/modules/renovate.js +40 -17
  85. package/lib/cli/configure/modules/renovate.js.map +2 -2
  86. package/lib/cli/configure/modules/serverless.js +26 -2
  87. package/lib/cli/configure/modules/serverless.js.map +1 -1
  88. package/lib/cli/configure/modules/tslint.js +28 -4
  89. package/lib/cli/configure/modules/tslint.js.map +1 -1
  90. package/lib/cli/configure/processing/configFile.js +39 -3
  91. package/lib/cli/configure/processing/configFile.js.map +1 -1
  92. package/lib/cli/configure/processing/deleteFiles.js +26 -2
  93. package/lib/cli/configure/processing/deleteFiles.js.map +1 -1
  94. package/lib/cli/configure/processing/javascript.js +27 -2
  95. package/lib/cli/configure/processing/javascript.js.map +1 -1
  96. package/lib/cli/configure/processing/json.js +31 -6
  97. package/lib/cli/configure/processing/json.js.map +1 -1
  98. package/lib/cli/configure/processing/loadFiles.js +26 -2
  99. package/lib/cli/configure/processing/loadFiles.js.map +1 -1
  100. package/lib/cli/configure/processing/module.js +28 -4
  101. package/lib/cli/configure/processing/module.js.map +1 -1
  102. package/lib/cli/configure/processing/package.d.ts +67 -1
  103. package/lib/cli/configure/processing/package.js +45 -8
  104. package/lib/cli/configure/processing/package.js.map +3 -3
  105. package/lib/cli/configure/processing/prettier.js +38 -4
  106. package/lib/cli/configure/processing/prettier.js.map +2 -2
  107. package/lib/cli/configure/processing/record.js +41 -5
  108. package/lib/cli/configure/processing/record.js.map +2 -2
  109. package/lib/cli/configure/processing/typescript.js +63 -26
  110. package/lib/cli/configure/processing/typescript.js.map +2 -2
  111. package/lib/cli/configure/types.d.ts +4 -15
  112. package/lib/cli/configure/types.js +16 -0
  113. package/lib/cli/configure/types.js.map +3 -3
  114. package/lib/cli/format/index.js +44 -20
  115. package/lib/cli/format/index.js.map +2 -2
  116. package/lib/cli/help/index.js +30 -6
  117. package/lib/cli/help/index.js.map +1 -1
  118. package/lib/cli/init/getConfig.d.ts +2 -2
  119. package/lib/cli/init/getConfig.js +121 -102
  120. package/lib/cli/init/getConfig.js.map +3 -3
  121. package/lib/cli/init/git.js +51 -16
  122. package/lib/cli/init/git.js.map +2 -2
  123. package/lib/cli/init/index.js +98 -67
  124. package/lib/cli/init/index.js.map +2 -2
  125. package/lib/cli/init/prompts.d.ts +13 -10
  126. package/lib/cli/init/prompts.js +56 -35
  127. package/lib/cli/init/prompts.js.map +2 -2
  128. package/lib/cli/init/types.d.ts +1 -1
  129. package/lib/cli/init/types.js +41 -7
  130. package/lib/cli/init/types.js.map +1 -1
  131. package/lib/cli/init/validation.js +30 -2
  132. package/lib/cli/init/validation.js.map +1 -1
  133. package/lib/cli/init/writePackageJson.js +42 -8
  134. package/lib/cli/init/writePackageJson.js.map +2 -2
  135. package/lib/cli/lint/annotate/buildkite/eslint.js +37 -3
  136. package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
  137. package/lib/cli/lint/annotate/buildkite/index.js +45 -11
  138. package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
  139. package/lib/cli/lint/annotate/buildkite/internal.js +37 -3
  140. package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
  141. package/lib/cli/lint/annotate/buildkite/prettier.js +37 -3
  142. package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
  143. package/lib/cli/lint/annotate/buildkite/tsc.js +37 -3
  144. package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
  145. package/lib/cli/lint/annotate/github/eslint.js +26 -2
  146. package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
  147. package/lib/cli/lint/annotate/github/index.js +45 -11
  148. package/lib/cli/lint/annotate/github/index.js.map +1 -1
  149. package/lib/cli/lint/annotate/github/internal.js +26 -2
  150. package/lib/cli/lint/annotate/github/internal.js.map +1 -1
  151. package/lib/cli/lint/annotate/github/prettier.js +26 -2
  152. package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
  153. package/lib/cli/lint/annotate/github/tsc.js +28 -4
  154. package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
  155. package/lib/cli/lint/annotate/index.js +30 -6
  156. package/lib/cli/lint/annotate/index.js.map +1 -1
  157. package/lib/cli/lint/autofix.d.ts +5 -0
  158. package/lib/cli/lint/autofix.js +80 -40
  159. package/lib/cli/lint/autofix.js.map +2 -2
  160. package/lib/cli/lint/eslint.js +51 -16
  161. package/lib/cli/lint/eslint.js.map +3 -3
  162. package/lib/cli/lint/external.js +51 -19
  163. package/lib/cli/lint/external.js.map +2 -2
  164. package/lib/cli/lint/index.js +50 -28
  165. package/lib/cli/lint/index.js.map +2 -2
  166. package/lib/cli/lint/internal.js +44 -18
  167. package/lib/cli/lint/internal.js.map +2 -2
  168. package/lib/cli/lint/internalLints/detectBadCodeowners.js +33 -8
  169. package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
  170. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +46 -14
  171. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +3 -3
  172. package/lib/cli/lint/internalLints/patchRenovateConfig.js +55 -21
  173. package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
  174. package/lib/cli/lint/internalLints/refreshConfigFiles.js +64 -35
  175. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +3 -3
  176. package/lib/cli/lint/internalLints/upgrade/index.d.ts +2 -2
  177. package/lib/cli/lint/internalLints/upgrade/index.js +105 -41
  178. package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
  179. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +28 -4
  180. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js.map +1 -1
  181. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js +45 -11
  182. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js.map +2 -2
  183. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +30 -6
  184. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +1 -1
  185. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +65 -34
  186. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +2 -2
  187. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +46 -11
  188. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js.map +2 -2
  189. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js +28 -4
  190. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +1 -1
  191. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +59 -23
  192. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +2 -2
  193. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js +28 -4
  194. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +1 -1
  195. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +46 -11
  196. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +2 -2
  197. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +30 -6
  198. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +1 -1
  199. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +46 -11
  200. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +2 -2
  201. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +46 -11
  202. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +2 -2
  203. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js +28 -4
  204. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +1 -1
  205. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +46 -11
  206. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +2 -2
  207. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js +67 -29
  208. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js.map +2 -2
  209. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js +34 -10
  210. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js.map +1 -1
  211. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js +45 -11
  212. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js.map +2 -2
  213. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +63 -17
  214. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +2 -2
  215. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +50 -15
  216. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
  217. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js +40 -0
  218. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js.map +7 -0
  219. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.d.ts +3 -0
  220. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js +149 -0
  221. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js.map +7 -0
  222. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js +55 -0
  223. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js.map +7 -0
  224. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +51 -17
  225. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +2 -2
  226. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +34 -10
  227. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +1 -1
  228. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +44 -10
  229. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +2 -2
  230. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +46 -12
  231. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +2 -2
  232. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +28 -4
  233. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +1 -1
  234. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +49 -15
  235. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +2 -2
  236. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js +45 -11
  237. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js.map +2 -2
  238. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +34 -10
  239. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +1 -1
  240. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +45 -11
  241. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js.map +2 -2
  242. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +45 -11
  243. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +2 -2
  244. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js +47 -13
  245. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js.map +2 -2
  246. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js +28 -4
  247. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js.map +1 -1
  248. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js +45 -11
  249. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
  250. package/lib/cli/lint/prettier.js +50 -15
  251. package/lib/cli/lint/prettier.js.map +3 -3
  252. package/lib/cli/lint/tsc.js +28 -4
  253. package/lib/cli/lint/tsc.js.map +1 -1
  254. package/lib/cli/lint/types.js +16 -0
  255. package/lib/cli/lint/types.js.map +3 -3
  256. package/lib/cli/migrate/index.d.ts +5 -0
  257. package/lib/cli/migrate/index.js +79 -15
  258. package/lib/cli/migrate/index.js.map +2 -2
  259. package/lib/cli/migrate/nodeVersion/checks.d.ts +1 -14
  260. package/lib/cli/migrate/nodeVersion/checks.js +51 -120
  261. package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
  262. package/lib/cli/migrate/nodeVersion/index.d.ts +8 -2
  263. package/lib/cli/migrate/nodeVersion/index.js +239 -65
  264. package/lib/cli/migrate/nodeVersion/index.js.map +3 -3
  265. package/lib/cli/migrate/nodeVersion/upgrade.d.ts +8 -0
  266. package/lib/cli/migrate/nodeVersion/upgrade.js +179 -0
  267. package/lib/cli/migrate/nodeVersion/upgrade.js.map +7 -0
  268. package/lib/cli/node/index.js +57 -20
  269. package/lib/cli/node/index.js.map +3 -3
  270. package/lib/cli/release/index.js +28 -4
  271. package/lib/cli/release/index.js.map +1 -1
  272. package/lib/cli/start/index.js +50 -16
  273. package/lib/cli/start/index.js.map +3 -3
  274. package/lib/cli/test/index.js +44 -4
  275. package/lib/cli/test/index.js.map +2 -2
  276. package/lib/cli/test/reporters/github/annotations.d.ts +9 -0
  277. package/lib/cli/test/reporters/github/annotations.js +102 -0
  278. package/lib/cli/test/reporters/github/annotations.js.map +7 -0
  279. package/lib/cli/test/reporters/github/index.d.ts +5 -0
  280. package/lib/cli/test/reporters/github/index.js +74 -0
  281. package/lib/cli/test/reporters/github/index.js.map +7 -0
  282. package/lib/cli/version/index.js +30 -6
  283. package/lib/cli/version/index.js.map +1 -1
  284. package/lib/index.d.ts +1 -0
  285. package/lib/index.js +46 -6
  286. package/lib/index.js.map +2 -2
  287. package/lib/skuba.js +45 -26
  288. package/lib/skuba.js.map +3 -3
  289. package/lib/utils/args.js +43 -6
  290. package/lib/utils/args.js.map +2 -2
  291. package/lib/utils/command.js +42 -4
  292. package/lib/utils/command.js.map +3 -3
  293. package/lib/utils/copy.js +57 -20
  294. package/lib/utils/copy.js.map +2 -2
  295. package/lib/utils/dir.js +72 -32
  296. package/lib/utils/dir.js.map +2 -2
  297. package/lib/utils/env.js +26 -2
  298. package/lib/utils/env.js.map +1 -1
  299. package/lib/utils/error.js +47 -10
  300. package/lib/utils/error.js.map +1 -1
  301. package/lib/utils/exec.d.ts +3 -2
  302. package/lib/utils/exec.js +62 -24
  303. package/lib/utils/exec.js.map +3 -3
  304. package/lib/utils/fs.js +40 -6
  305. package/lib/utils/fs.js.map +2 -2
  306. package/lib/utils/help.js +30 -6
  307. package/lib/utils/help.js.map +1 -1
  308. package/lib/utils/logging.d.ts +9 -10
  309. package/lib/utils/logging.js +38 -11
  310. package/lib/utils/logging.js.map +2 -2
  311. package/lib/utils/logo.js +52 -25
  312. package/lib/utils/logo.js.map +2 -2
  313. package/lib/utils/manifest.d.ts +2 -3
  314. package/lib/utils/manifest.js +48 -8
  315. package/lib/utils/manifest.js.map +3 -3
  316. package/lib/utils/npmrc.js +26 -2
  317. package/lib/utils/npmrc.js.map +1 -1
  318. package/lib/utils/packageManager.js +49 -12
  319. package/lib/utils/packageManager.js.map +2 -2
  320. package/lib/utils/port.js +39 -4
  321. package/lib/utils/port.js.map +2 -2
  322. package/lib/utils/sleep.js +26 -2
  323. package/lib/utils/sleep.js.map +1 -1
  324. package/lib/utils/template.js +55 -18
  325. package/lib/utils/template.js.map +3 -3
  326. package/lib/utils/validation.js +31 -2
  327. package/lib/utils/validation.js.map +1 -1
  328. package/lib/utils/version.js +46 -9
  329. package/lib/utils/version.js.map +2 -2
  330. package/lib/utils/wait.js +32 -7
  331. package/lib/utils/wait.js.map +1 -1
  332. package/lib/utils/worker.d.ts +3 -3
  333. package/lib/utils/worker.js +35 -10
  334. package/lib/utils/worker.js.map +1 -1
  335. package/lib/wrapper/function-arguments.d.js +1 -0
  336. package/lib/wrapper/functionHandler.js +49 -18
  337. package/lib/wrapper/functionHandler.js.map +2 -2
  338. package/lib/wrapper/http.js +43 -8
  339. package/lib/wrapper/http.js.map +2 -2
  340. package/lib/wrapper/index.js +7 -6
  341. package/lib/wrapper/index.js.map +1 -1
  342. package/lib/wrapper/main.js +42 -8
  343. package/lib/wrapper/main.js.map +3 -3
  344. package/lib/wrapper/requestListener.js +47 -13
  345. package/lib/wrapper/requestListener.js.map +2 -2
  346. package/lib/wrapper/server.js +28 -4
  347. package/lib/wrapper/server.js.map +2 -2
  348. package/package.json +44 -45
  349. package/template/base/_.prettierrc.js +1 -1
  350. package/template/base/_eslint.config.js +1 -1
  351. package/template/base/_pnpm-workspace.yaml +4 -3
  352. package/template/base/jest.config.ts +19 -0
  353. package/template/base/jest.setup.ts +3 -0
  354. package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
  355. package/template/express-rest-api/.nvmrc +1 -1
  356. package/template/express-rest-api/package.json +8 -9
  357. package/template/express-rest-api/skuba.template.js +1 -1
  358. package/template/express-rest-api/src/app.test.ts +0 -1
  359. package/template/greeter/.buildkite/pipeline.yml +1 -1
  360. package/template/greeter/.nvmrc +1 -1
  361. package/template/greeter/package.json +4 -5
  362. package/template/greeter/skuba.template.js +1 -1
  363. package/template/greeter/src/app.test.ts +1 -3
  364. package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
  365. package/template/koa-rest-api/.nvmrc +1 -1
  366. package/template/koa-rest-api/package.json +9 -11
  367. package/template/koa-rest-api/skuba.template.js +1 -1
  368. package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +0 -2
  369. package/template/koa-rest-api/src/api/jobs/postJob.test.ts +0 -2
  370. package/template/koa-rest-api/src/app.test.ts +0 -2
  371. package/template/koa-rest-api/src/framework/server.test.ts +2 -2
  372. package/template/koa-rest-api/src/framework/validation.test.ts +0 -2
  373. package/template/koa-rest-api/src/testing/metrics.ts +0 -2
  374. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
  375. package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
  376. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +7 -21
  377. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +9 -11
  378. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +3 -3
  379. package/template/lambda-sqs-worker-cdk/infra/config.ts +2 -4
  380. package/template/lambda-sqs-worker-cdk/package.json +9 -9
  381. package/template/lambda-sqs-worker-cdk/skuba.template.js +13 -1
  382. package/template/lambda-sqs-worker-cdk/src/app.test.ts +13 -22
  383. package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +0 -1
  384. package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +31 -33
  385. package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +2 -8
  386. package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +2 -3
  387. package/template/lambda-sqs-worker-cdk/src/testing/services.ts +3 -4
  388. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  389. package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
  390. package/template/oss-npm-package/.nvmrc +1 -1
  391. package/template/oss-npm-package/_package.json +0 -1
  392. package/template/oss-npm-package/skuba.template.js +1 -1
  393. package/template/oss-npm-package/src/index.test.ts +0 -2
  394. package/template/private-npm-package/.nvmrc +1 -1
  395. package/template/private-npm-package/_package.json +1 -2
  396. package/template/private-npm-package/skuba.template.js +2 -2
  397. package/template/private-npm-package/src/index.test.ts +0 -2
  398. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +0 -11
  399. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +0 -7
  400. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +0 -34
  401. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +0 -7
  402. package/lib/enquirer.d.js +0 -1
  403. package/lib/enquirer.d.js.map +0 -7
  404. package/lib/eslint.d.js +0 -1
  405. package/lib/eslint.d.js.map +0 -7
  406. package/template/base/vitest.config.ts +0 -25
  407. /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/index.d.ts +0 -0
  408. /package/lib/cli/lint/internalLints/upgrade/patches/{9.1.0 → 13.1.1}/upgradeNode.d.ts +0 -0
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/8.2.1/index.ts"],
4
4
  "sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryCollapseDuplicateMergeKeys } from './collapseDuplicateMergeKeys.js';\nimport { tryMoveNpmrcMounts } from './moveNpmrcMounts.js';\nimport { tryPatchDockerComposeFiles } from './patchDockerCompose.js';\nimport { tryPatchDockerImages } from './patchDockerImages.js';\n\nexport const patches: Patches = [\n {\n apply: tryCollapseDuplicateMergeKeys,\n description: 'Collapse duplicate merge keys in .buildkite files',\n },\n {\n apply: tryPatchDockerComposeFiles,\n description: 'Remove version field from docker-compose files',\n },\n {\n apply: tryPatchDockerImages,\n description:\n 'Update docker image references to use public.ecr.aws and remove --platform flag',\n },\n {\n apply: tryMoveNpmrcMounts,\n description: 'Move .npmrc mounts from tmp/.npmrc to /tmp/.npmrc',\n },\n];\n"],
5
- "mappings": "AAEA,SAAS,qCAAqC;AAC9C,SAAS,0BAA0B;AACnC,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AAE9B,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,wCAA8C;AAC9C,6BAAmC;AACnC,gCAA2C;AAC3C,+BAAqC;AAE9B,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,11 +1,44 @@
1
- import { inspect } from "util";
2
- import { glob } from "fast-glob";
3
- import fs from "fs-extra";
4
- import { log } from "../../../../../../utils/logging.js";
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 moveNpmrcMounts_exports = {};
30
+ __export(moveNpmrcMounts_exports, {
31
+ tryMoveNpmrcMounts: () => tryMoveNpmrcMounts
32
+ });
33
+ module.exports = __toCommonJS(moveNpmrcMounts_exports);
34
+ var import_util = require("util");
35
+ var import_fast_glob = require("fast-glob");
36
+ var import_fs_extra = __toESM(require("fs-extra"));
37
+ var import_logging = require("../../../../../../utils/logging.js");
5
38
  const moveNpmrcMounts = async ({
6
39
  mode
7
40
  }) => {
8
- const buildkiteFiles = await glob(
41
+ const buildkiteFiles = await (0, import_fast_glob.glob)(
9
42
  ["{apps/*/,packages/*/,./}.buildkite/**/*.y*ml"],
10
43
  { onlyFiles: true }
11
44
  );
@@ -13,7 +46,7 @@ const moveNpmrcMounts = async ({
13
46
  return { result: "skip", reason: "no Buildkite files found" };
14
47
  }
15
48
  const input = await Promise.all(
16
- buildkiteFiles.map((name) => fs.promises.readFile(name, "utf-8"))
49
+ buildkiteFiles.map((name) => import_fs_extra.default.promises.readFile(name, "utf-8"))
17
50
  );
18
51
  const replaced = input.map(moveNpmrcMountsInFile);
19
52
  if (replaced.every((r, i) => r === input[i])) {
@@ -29,7 +62,7 @@ const moveNpmrcMounts = async ({
29
62
  buildkiteFiles.flatMap(
30
63
  (name, i) => replaced[i] !== input[i] ? (
31
64
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
32
- [fs.promises.writeFile(name, replaced[i])]
65
+ [import_fs_extra.default.promises.writeFile(name, replaced[i])]
33
66
  ) : []
34
67
  )
35
68
  );
@@ -47,12 +80,13 @@ const tryMoveNpmrcMounts = async (config) => {
47
80
  try {
48
81
  return await moveNpmrcMounts(config);
49
82
  } catch (err) {
50
- log.warn("Failed to move .npmrc mounts");
51
- log.subtle(inspect(err));
83
+ import_logging.log.warn("Failed to move .npmrc mounts");
84
+ import_logging.log.subtle((0, import_util.inspect)(err));
52
85
  return { result: "skip", reason: "due to an error" };
53
86
  }
54
87
  };
55
- export {
88
+ // Annotate the CommonJS export names for ESM import in node:
89
+ 0 && (module.exports = {
56
90
  tryMoveNpmrcMounts
57
- };
91
+ });
58
92
  //# sourceMappingURL=moveNpmrcMounts.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.ts"],
4
4
  "sourcesContent": ["import { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst moveNpmrcMounts: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n const buildkiteFiles = await glob(\n ['{apps/*/,packages/*/,./}.buildkite/**/*.y*ml'],\n { onlyFiles: true },\n );\n\n if (buildkiteFiles.length === 0) {\n return { result: 'skip', reason: 'no Buildkite files found' };\n }\n\n const input = await Promise.all(\n buildkiteFiles.map((name) => fs.promises.readFile(name, 'utf-8')),\n );\n\n const replaced = input.map(moveNpmrcMountsInFile);\n\n if (replaced.every((r, i) => r === input[i])) {\n return {\n result: 'skip',\n reason: 'no .npmrc mounts found need to be updated',\n };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n await Promise.all(\n buildkiteFiles.flatMap((name, i) =>\n replaced[i] !== input[i]\n ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n [fs.promises.writeFile(name, replaced[i]!)]\n : [],\n ),\n );\n\n return { result: 'apply' };\n};\n\nconst secret = /^(\\s*)secrets: id=npm,src=tmp\\/\\.npmrc(\\s*#?.*)$/gm;\nconst outputPath = /^(\\s*)output-path: tmp\\/(\\s*#?.*)$/gm;\n\nconst moveNpmrcMountsInFile = (input: string) => {\n if (!secret.test(input) || !outputPath.test(input)) {\n return input;\n }\n\n return input\n .replaceAll(secret, '$1secrets: id=npm,src=/tmp/.npmrc$2')\n .replaceAll(outputPath, '$1output-path: /tmp/$2');\n};\n\nexport const tryMoveNpmrcMounts: PatchFunction = async (config) => {\n try {\n return await moveNpmrcMounts(config);\n } catch (err) {\n log.warn('Failed to move .npmrc mounts');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
- "mappings": "AAAA,SAAS,eAAe;AAExB,SAAS,YAAY;AACrB,OAAO,QAAQ;AAEf,SAAS,WAAW;AAGpB,MAAM,kBAAiC,OAAO;AAAA,EAC5C;AACF,MAAgC;AAC9B,QAAM,iBAAiB,MAAM;AAAA,IAC3B,CAAC,8CAA8C;AAAA,IAC/C,EAAE,WAAW,KAAK;AAAA,EACpB;AAEA,MAAI,eAAe,WAAW,GAAG;AAC/B,WAAO,EAAE,QAAQ,QAAQ,QAAQ,2BAA2B;AAAA,EAC9D;AAEA,QAAM,QAAQ,MAAM,QAAQ;AAAA,IAC1B,eAAe,IAAI,CAAC,SAAS,GAAG,SAAS,SAAS,MAAM,OAA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QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
+ "names": ["fs"]
7
7
  }
@@ -1,11 +1,44 @@
1
- import { inspect } from "util";
2
- import fg from "fast-glob";
3
- import fs from "fs-extra";
4
- import { log } from "../../../../../../utils/logging.js";
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 patchDockerCompose_exports = {};
30
+ __export(patchDockerCompose_exports, {
31
+ tryPatchDockerComposeFiles: () => tryPatchDockerComposeFiles
32
+ });
33
+ module.exports = __toCommonJS(patchDockerCompose_exports);
34
+ var import_util = require("util");
35
+ var import_fast_glob = __toESM(require("fast-glob"));
36
+ var import_fs_extra = __toESM(require("fs-extra"));
37
+ var import_logging = require("../../../../../../utils/logging.js");
5
38
  const DOCKER_COMPOSE_VERSION_REGEX = /^version: ['"]?\d+(\.\d+)*['"]?\n*/m;
6
39
  const fetchFiles = async (files) => Promise.all(
7
40
  files.map(async (file) => {
8
- const contents = await fs.readFile(file, "utf8");
41
+ const contents = await import_fs_extra.default.readFile(file, "utf8");
9
42
  return {
10
43
  file,
11
44
  contents
@@ -15,7 +48,7 @@ const fetchFiles = async (files) => Promise.all(
15
48
  const patchDockerComposeFiles = async ({
16
49
  mode
17
50
  }) => {
18
- const maybeDockerComposeFiles = await fg(["docker-compose*.yml"]);
51
+ const maybeDockerComposeFiles = await (0, import_fast_glob.default)(["docker-compose*.yml"]);
19
52
  if (!maybeDockerComposeFiles.length) {
20
53
  return {
21
54
  result: "skip",
@@ -43,7 +76,7 @@ const patchDockerComposeFiles = async ({
43
76
  DOCKER_COMPOSE_VERSION_REGEX,
44
77
  ""
45
78
  );
46
- await fs.writeFile(file, patchedContents);
79
+ await import_fs_extra.default.writeFile(file, patchedContents);
47
80
  })
48
81
  );
49
82
  return { result: "apply" };
@@ -52,12 +85,13 @@ const tryPatchDockerComposeFiles = async (config) => {
52
85
  try {
53
86
  return await patchDockerComposeFiles(config);
54
87
  } catch (err) {
55
- log.warn("Failed to patch pnpm packageManager CI configuration.");
56
- log.subtle(inspect(err));
88
+ import_logging.log.warn("Failed to patch pnpm packageManager CI configuration.");
89
+ import_logging.log.subtle((0, import_util.inspect)(err));
57
90
  return { result: "skip", reason: "due to an error" };
58
91
  }
59
92
  };
60
- export {
93
+ // Annotate the CommonJS export names for ESM import in node:
94
+ 0 && (module.exports = {
61
95
  tryPatchDockerComposeFiles
62
- };
96
+ });
63
97
  //# sourceMappingURL=patchDockerCompose.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.ts"],
4
4
  "sourcesContent": ["import { inspect } from 'util';\n\nimport fg from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst DOCKER_COMPOSE_VERSION_REGEX = /^version: ['\"]?\\d+(\\.\\d+)*['\"]?\\n*/m;\n\nconst fetchFiles = async (files: string[]) =>\n Promise.all(\n files.map(async (file) => {\n const contents = await fs.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\nconst patchDockerComposeFiles: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n const maybeDockerComposeFiles = await fg(['docker-compose*.yml']);\n\n if (!maybeDockerComposeFiles.length) {\n return {\n result: 'skip',\n reason: 'no docker-compose files found',\n };\n }\n\n const dockerComposeFiles = await fetchFiles(maybeDockerComposeFiles);\n\n const dockerComposeFilesToPatch = dockerComposeFiles.filter(({ contents }) =>\n DOCKER_COMPOSE_VERSION_REGEX.exec(contents),\n );\n\n if (!dockerComposeFilesToPatch.length) {\n return {\n result: 'skip',\n reason: 'no docker-compose files to patch',\n };\n }\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await Promise.all(\n dockerComposeFilesToPatch.map(async ({ file, contents }) => {\n const patchedContents = contents.replace(\n DOCKER_COMPOSE_VERSION_REGEX,\n '',\n );\n await fs.writeFile(file, patchedContents);\n }),\n );\n\n return { result: 'apply' };\n};\n\nexport const tryPatchDockerComposeFiles: PatchFunction = async (config) => {\n try {\n return await patchDockerComposeFiles(config);\n } catch (err) {\n log.warn('Failed to patch pnpm packageManager CI configuration.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
- "mappings": "AAAA,SAAS,eAAe;AAExB,OAAO,QAAQ;AACf,OAAO,QAAQ;AAEf,SAAS,WAAW;AAGpB,MAAM,+BAA+B;AAErC,MAAM,aAAa,OAAO,UACxB,QAAQ;AAAA,EACN,MAAM,IAAI,OAAO,SAAS;AACxB,UAAM,WAAW,MAAM,GAAG,SAAS,MAAM,MAAM;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"names": ["fs", "fg"]
7
7
  }
@@ -1,14 +1,47 @@
1
- import { inspect } from "util";
2
- import fg from "fast-glob";
3
- import fs from "fs-extra";
4
- import { log } from "../../../../../../utils/logging.js";
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 patchDockerImages_exports = {};
30
+ __export(patchDockerImages_exports, {
31
+ tryPatchDockerImages: () => tryPatchDockerImages
32
+ });
33
+ module.exports = __toCommonJS(patchDockerImages_exports);
34
+ var import_util = require("util");
35
+ var import_fast_glob = __toESM(require("fast-glob"));
36
+ var import_fs_extra = __toESM(require("fs-extra"));
37
+ var import_logging = require("../../../../../../utils/logging.js");
5
38
  const DOCKER_IMAGE_REGEX = /^(FROM\s?.*)(\s)(node|python)(:.*)/gm;
6
39
  const DOCKER_IMAGE_PLATFORM_REGEX = /^(FROM\s?.*)(--platform=[^\s]+) /gm;
7
40
  const DOCKER_COMPOSE_IMAGE_REGEX = /^(\s+image:\s)(node|python)(:.*)/gm;
8
41
  const PUBLIC_ECR = "public.ecr.aws/docker/library/";
9
42
  const fetchFiles = async (files) => Promise.all(
10
43
  files.map(async (file) => {
11
- const contents = await fs.readFile(file, "utf8");
44
+ const contents = await import_fs_extra.default.readFile(file, "utf8");
12
45
  return {
13
46
  file,
14
47
  contents
@@ -35,8 +68,8 @@ const patchDockerImages = async ({
35
68
  mode
36
69
  }) => {
37
70
  const [maybeDockerFilesPaths, maybeDockerComposePaths] = await Promise.all([
38
- fg(["Dockerfile*"]),
39
- fg(["docker-compose*.y*ml"])
71
+ (0, import_fast_glob.default)(["Dockerfile*"]),
72
+ (0, import_fast_glob.default)(["docker-compose*.y*ml"])
40
73
  ]);
41
74
  if (!maybeDockerFilesPaths.length && !maybeDockerComposePaths.length) {
42
75
  return {
@@ -77,7 +110,7 @@ const patchDockerImages = async ({
77
110
  "$1"
78
111
  );
79
112
  }
80
- await fs.writeFile(file, patchedContents);
113
+ await import_fs_extra.default.writeFile(file, patchedContents);
81
114
  }
82
115
  );
83
116
  const dockerComposeFilePatches = dockerComposeFilesToPatch.map(
@@ -86,7 +119,7 @@ const patchDockerImages = async ({
86
119
  DOCKER_COMPOSE_IMAGE_REGEX,
87
120
  `$1${PUBLIC_ECR}$2$3`
88
121
  );
89
- await fs.writeFile(file, patchedContents);
122
+ await import_fs_extra.default.writeFile(file, patchedContents);
90
123
  }
91
124
  );
92
125
  await Promise.all([...dockerFilePatches, ...dockerComposeFilePatches]);
@@ -96,12 +129,13 @@ const tryPatchDockerImages = async (config) => {
96
129
  try {
97
130
  return await patchDockerImages(config);
98
131
  } catch (err) {
99
- log.warn("Failed to patch Docker images");
100
- log.subtle(inspect(err));
132
+ import_logging.log.warn("Failed to patch Docker images");
133
+ import_logging.log.subtle((0, import_util.inspect)(err));
101
134
  return { result: "skip", reason: "due to an error" };
102
135
  }
103
136
  };
104
- export {
137
+ // Annotate the CommonJS export names for ESM import in node:
138
+ 0 && (module.exports = {
105
139
  tryPatchDockerImages
106
- };
140
+ });
107
141
  //# sourceMappingURL=patchDockerImages.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.ts"],
4
4
  "sourcesContent": ["import { inspect } from 'util';\n\nimport fg from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst DOCKER_IMAGE_REGEX = /^(FROM\\s?.*)(\\s)(node|python)(:.*)/gm;\nconst DOCKER_IMAGE_PLATFORM_REGEX = /^(FROM\\s?.*)(--platform=[^\\s]+) /gm;\nconst DOCKER_COMPOSE_IMAGE_REGEX = /^(\\s+image:\\s)(node|python)(:.*)/gm;\nconst PUBLIC_ECR = 'public.ecr.aws/docker/library/';\n\nconst fetchFiles = async (files: string[]) =>\n Promise.all(\n files.map(async (file) => {\n const contents = await fs.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\nconst isInvalidPlatformFlagUsage = (contents: string) => {\n const matches = [...contents.matchAll(DOCKER_IMAGE_PLATFORM_REGEX)];\n\n if (!matches.length) {\n return false;\n }\n\n const uniquePlatforms = [\n ...new Set(matches.map(([, , platform]) => platform as string)),\n ];\n\n // Multiple --platform flags are used which may indicate a multi arch build\n if (uniquePlatforms.length > 1) {\n return false;\n }\n\n // Avoid patching as they may be using args to set the platform\n if (uniquePlatforms[0]?.startsWith('--platform=$')) {\n return false;\n }\n\n return true;\n};\n\nconst patchDockerImages: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n const [maybeDockerFilesPaths, maybeDockerComposePaths] = await Promise.all([\n fg(['Dockerfile*']),\n fg(['docker-compose*.y*ml']),\n ]);\n\n if (!maybeDockerFilesPaths.length && !maybeDockerComposePaths.length) {\n return {\n result: 'skip',\n reason: 'no Dockerfile or docker-compose files found',\n };\n }\n\n const [dockerFiles, dockerComposeFiles] = await Promise.all([\n fetchFiles(maybeDockerFilesPaths),\n fetchFiles(maybeDockerComposePaths),\n ]);\n\n const dockerFilesToPatch = dockerFiles.filter(\n ({ contents }) =>\n DOCKER_IMAGE_REGEX.exec(contents) ?? isInvalidPlatformFlagUsage(contents),\n );\n\n const dockerComposeFilesToPatch = dockerComposeFiles.filter(({ contents }) =>\n DOCKER_COMPOSE_IMAGE_REGEX.exec(contents),\n );\n\n if (!dockerFilesToPatch.length && !dockerComposeFilesToPatch.length) {\n return {\n result: 'skip',\n reason: 'no Dockerfile or docker-compose files to patch',\n };\n }\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n const dockerFilePatches = dockerFilesToPatch.map(\n async ({ file, contents }) => {\n let patchedContents = contents.replace(\n DOCKER_IMAGE_REGEX,\n `$1$2${PUBLIC_ECR}$3$4`,\n );\n\n if (isInvalidPlatformFlagUsage(contents)) {\n patchedContents = patchedContents.replace(\n DOCKER_IMAGE_PLATFORM_REGEX,\n '$1',\n );\n }\n\n await fs.writeFile(file, patchedContents);\n },\n );\n\n const dockerComposeFilePatches = dockerComposeFilesToPatch.map(\n async ({ file, contents }) => {\n const patchedContents = contents.replace(\n DOCKER_COMPOSE_IMAGE_REGEX,\n `$1${PUBLIC_ECR}$2$3`,\n );\n await fs.writeFile(file, patchedContents);\n },\n );\n\n await Promise.all([...dockerFilePatches, ...dockerComposeFilePatches]);\n\n return { result: 'apply' };\n};\n\nexport const tryPatchDockerImages: PatchFunction = async (config) => {\n try {\n return await patchDockerImages(config);\n } catch (err) {\n log.warn('Failed to patch Docker images');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
- "mappings": "AAAA,SAAS,eAAe;AAExB,OAAO,QAAQ;AACf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AAI,KAAK,+BAA+B;AACxC,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
+ "names": ["fs", "fg"]
7
7
  }
@@ -1,11 +1,35 @@
1
- import { tryPatchPnpmDockerImages } from "./patchPnpmDockerImages.js";
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 __exports = {};
20
+ __export(__exports, {
21
+ patches: () => patches
22
+ });
23
+ module.exports = __toCommonJS(__exports);
24
+ var import_patchPnpmDockerImages = require("./patchPnpmDockerImages.js");
2
25
  const patches = [
3
26
  {
4
- apply: tryPatchPnpmDockerImages,
27
+ apply: import_patchPnpmDockerImages.tryPatchPnpmDockerImages,
5
28
  description: "Use pinned pnpm version in Dockerfiles"
6
29
  }
7
30
  ];
8
- export {
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
9
33
  patches
10
- };
34
+ });
11
35
  //# sourceMappingURL=index.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/9.0.1/index.ts"],
4
4
  "sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryPatchPnpmDockerImages } from './patchPnpmDockerImages.js';\n\nexport const patches: Patches = [\n {\n apply: tryPatchPnpmDockerImages,\n description: 'Use pinned pnpm version in Dockerfiles',\n },\n];\n"],
5
- "mappings": "AAEA,SAAS,gCAAgC;AAElC,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mCAAyC;AAElC,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,13 +1,46 @@
1
- import { inspect } from "util";
2
- import fg from "fast-glob";
3
- import fs from "fs-extra";
4
- import { log } from "../../../../../../utils/logging.js";
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 patchPnpmDockerImages_exports = {};
30
+ __export(patchPnpmDockerImages_exports, {
31
+ tryPatchPnpmDockerImages: () => tryPatchPnpmDockerImages
32
+ });
33
+ module.exports = __toCommonJS(patchPnpmDockerImages_exports);
34
+ var import_util = require("util");
35
+ var import_fast_glob = __toESM(require("fast-glob"));
36
+ var import_fs_extra = __toESM(require("fs-extra"));
37
+ var import_logging = require("../../../../../../utils/logging.js");
5
38
  const DOCKER_IMAGE_CONFIG_REGEX = /^(RUN --mount=type=bind,source=package.json,target=package.json \\\n(\s+)corepack enable pnpm && corepack install(?:.|\n)+?RUN )(pnpm config set store-dir \/root\/.pnpm-store)/gm;
6
39
  const DOCKER_IMAGE_FETCH_REGEX = /^(RUN --mount=type=bind,source=.npmrc,target=.npmrc \\\n)((?:(?!--mount=type=bind,source=package\.json,target=package\.json)[\s\S])+?\n(\s+)pnpm (fetch|install))/gm;
7
40
  const PACKAGE_JSON_MOUNT = "--mount=type=bind,source=package.json,target=package.json \\\n";
8
41
  const fetchFiles = async (files) => Promise.all(
9
42
  files.map(async (file) => {
10
- const contents = await fs.readFile(file, "utf8");
43
+ const contents = await import_fs_extra.default.readFile(file, "utf8");
11
44
  return {
12
45
  file,
13
46
  contents
@@ -17,7 +50,7 @@ const fetchFiles = async (files) => Promise.all(
17
50
  const patchPnpmDockerImages = async ({
18
51
  mode
19
52
  }) => {
20
- const maybeDockerFilesPaths = await fg(["Dockerfile*"]);
53
+ const maybeDockerFilesPaths = await (0, import_fast_glob.default)(["Dockerfile*"]);
21
54
  if (!maybeDockerFilesPaths.length) {
22
55
  return {
23
56
  result: "skip",
@@ -48,7 +81,7 @@ const patchPnpmDockerImages = async ({
48
81
  DOCKER_IMAGE_FETCH_REGEX,
49
82
  (_, npmrcLine, rest, whitespace) => `${npmrcLine}${whitespace}${PACKAGE_JSON_MOUNT}${rest}`
50
83
  );
51
- await fs.writeFile(file, patchedContents);
84
+ await import_fs_extra.default.writeFile(file, patchedContents);
52
85
  })
53
86
  );
54
87
  return { result: "apply" };
@@ -57,12 +90,13 @@ const tryPatchPnpmDockerImages = async (config) => {
57
90
  try {
58
91
  return await patchPnpmDockerImages(config);
59
92
  } catch (err) {
60
- log.warn("Failed to patch Docker images");
61
- log.subtle(inspect(err));
93
+ import_logging.log.warn("Failed to patch Docker images");
94
+ import_logging.log.subtle((0, import_util.inspect)(err));
62
95
  return { result: "skip", reason: "due to an error" };
63
96
  }
64
97
  };
65
- export {
98
+ // Annotate the CommonJS export names for ESM import in node:
99
+ 0 && (module.exports = {
66
100
  tryPatchPnpmDockerImages
67
- };
101
+ });
68
102
  //# sourceMappingURL=patchPnpmDockerImages.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.ts"],
4
4
  "sourcesContent": ["import { inspect } from 'util';\n\nimport fg from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst DOCKER_IMAGE_CONFIG_REGEX =\n /^(RUN --mount=type=bind,source=package.json,target=package.json \\\\\\n(\\s+)corepack enable pnpm && corepack install(?:.|\\n)+?RUN )(pnpm config set store-dir \\/root\\/.pnpm-store)/gm;\nconst DOCKER_IMAGE_FETCH_REGEX =\n /^(RUN --mount=type=bind,source=.npmrc,target=.npmrc \\\\\\n)((?:(?!--mount=type=bind,source=package\\.json,target=package\\.json)[\\s\\S])+?\\n(\\s+)pnpm (fetch|install))/gm;\n\nconst PACKAGE_JSON_MOUNT =\n '--mount=type=bind,source=package.json,target=package.json \\\\\\n';\n\nconst fetchFiles = async (files: string[]) =>\n Promise.all(\n files.map(async (file) => {\n const contents = await fs.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\nconst patchPnpmDockerImages: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n const maybeDockerFilesPaths = await fg(['Dockerfile*']);\n\n if (!maybeDockerFilesPaths.length) {\n return {\n result: 'skip',\n reason: 'no Dockerfiles found',\n };\n }\n\n const dockerFiles = await fetchFiles(maybeDockerFilesPaths);\n\n const dockerFilesToPatch = dockerFiles.filter(\n ({ contents }) =>\n DOCKER_IMAGE_CONFIG_REGEX.exec(contents) ??\n DOCKER_IMAGE_FETCH_REGEX.exec(contents),\n );\n\n if (!dockerFilesToPatch.length) {\n return {\n result: 'skip',\n reason: 'no Dockerfiles to patch',\n };\n }\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await Promise.all(\n dockerFilesToPatch.map(async ({ file, contents }) => {\n const patchedContents = contents\n .replace(\n DOCKER_IMAGE_CONFIG_REGEX,\n (_, earlyCommands, whitespace, pnpmSetConfigLine) =>\n `${earlyCommands}${PACKAGE_JSON_MOUNT}${whitespace}${pnpmSetConfigLine}`,\n )\n .replace(\n DOCKER_IMAGE_FETCH_REGEX,\n (_, npmrcLine, rest, whitespace) =>\n `${npmrcLine}${whitespace}${PACKAGE_JSON_MOUNT}${rest}`,\n );\n\n await fs.writeFile(file, patchedContents);\n }),\n );\n\n return { result: 'apply' };\n};\n\nexport const tryPatchPnpmDockerImages: PatchFunction = async (config) => {\n try {\n return await patchPnpmDockerImages(config);\n } catch (err) {\n log.warn('Failed to patch Docker images');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
- "mappings": "AAAA,SAAS,eAAe;AAExB,OAAO,QAAQ;AACf,OAAO,QAAQ;AAEf,SAAS,WAAW;AAGpB,MAAM,4BACJ;AACF,MAAM,2BACJ;AAEF,MAAM,qBACJ;AAEF,MAAM,aAAa,OAAO,UACxB,QAAQ;AAAA,EACN,MAAM,IAAI,OAAO,SAAS;AACxB,UAAM,WAAW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kB,GAAG,UAAU,GAAG,iBAAiB;AAAA,MAC1E,EACC;AAAA,QACC;AAAA,QACA,CAAC,GAAG,WAAW,MAAM,eACnB,GAAG,SAAS,GAAG,UAAU,GAAG,kBAAkB,GAAG,IAAI;AAAA,MACzD;AAEF,YAAM,gBAAAD,QAAG,UAAU,MAAM,eAAe;AAAA,IAC1C,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,2BAA0C,OAAO,WAAW;AACvE,MAAI;AACF,WAAO,MAAM,sBAAsB,MAAM;AAAA,EAC3C,SAAS,KAAK;AACZ,uBAAI,KAAK,+BAA+B;AACxC,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
+ "names": ["fs", "fg"]
7
7
  }
@@ -1,23 +1,58 @@
1
- import path from "path";
2
- import { isMainThread } from "worker_threads";
3
- import chalk from "chalk";
4
- import { createLogger } from "../../utils/logging.js";
5
- import { execWorkerThread, postWorkerOutput } from "../../utils/worker.js";
6
- import { runPrettier } from "../adapter/prettier.js";
7
- const LOG_PREFIX = chalk.cyan("Prettier \u2502");
8
- const runPrettierInCurrentThread = ({ debug }) => runPrettier("lint", createLogger({ debug, prefixes: [LOG_PREFIX] }));
9
- const runPrettierInWorkerThread = (input) => execWorkerThread(
10
- path.posix.join(import.meta.dirname, "prettier.js"),
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 prettier_exports = {};
30
+ __export(prettier_exports, {
31
+ runPrettierInCurrentThread: () => runPrettierInCurrentThread,
32
+ runPrettierInWorkerThread: () => runPrettierInWorkerThread
33
+ });
34
+ module.exports = __toCommonJS(prettier_exports);
35
+ var import_node_util = require("node:util");
36
+ var import_path = __toESM(require("path"));
37
+ var import_worker_threads = require("worker_threads");
38
+ var import_logging = require("../../utils/logging.js");
39
+ var import_worker = require("../../utils/worker.js");
40
+ var import_prettier = require("../adapter/prettier.js");
41
+ const LOG_PREFIX = (0, import_node_util.styleText)("cyan", "Prettier \u2502");
42
+ const runPrettierInCurrentThread = ({ debug }) => (0, import_prettier.runPrettier)("lint", (0, import_logging.createLogger)({ debug, prefixes: [LOG_PREFIX] }));
43
+ const runPrettierInWorkerThread = (input) => (0, import_worker.execWorkerThread)(
44
+ import_path.default.posix.join(__dirname, "prettier.js"),
11
45
  input
12
46
  );
13
- if (!isMainThread) {
14
- postWorkerOutput(
47
+ if (!import_worker_threads.isMainThread) {
48
+ (0, import_worker.postWorkerOutput)(
15
49
  runPrettierInCurrentThread,
16
- createLogger({ debug: false, prefixes: [LOG_PREFIX] })
50
+ (0, import_logging.createLogger)({ debug: false, prefixes: [LOG_PREFIX] })
17
51
  );
18
52
  }
19
- export {
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
20
55
  runPrettierInCurrentThread,
21
56
  runPrettierInWorkerThread
22
- };
57
+ });
23
58
  //# sourceMappingURL=prettier.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/cli/lint/prettier.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 PrettierOutput, runPrettier } from '../adapter/prettier.js';\n\nimport type { Input } from './types.js';\n\nconst LOG_PREFIX = chalk.cyan('Prettier \u2502');\n\nexport const runPrettierInCurrentThread = ({ debug }: Input) =>\n runPrettier('lint', createLogger({ debug, prefixes: [LOG_PREFIX] }));\n\nexport const runPrettierInWorkerThread = (input: Input) =>\n execWorkerThread<Input, PrettierOutput>(\n path.posix.join(import.meta.dirname, 'prettier.js'),\n input,\n );\n\nif (!isMainThread) {\n postWorkerOutput(\n runPrettierInCurrentThread,\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,SAA8B,mBAAmB;AAIjD,MAAM,aAAa,MAAM,KAAK,iBAAY;AAEnC,MAAM,6BAA6B,CAAC,EAAE,MAAM,MACjD,YAAY,QAAQ,aAAa,EAAE,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;AAE9D,MAAM,4BAA4B,CAAC,UACxC;AAAA,EACE,KAAK,MAAM,KAAK,YAAY,SAAS,aAAa;AAAA,EAClD;AACF;AAEF,IAAI,CAAC,cAAc;AACjB;AAAA,IACE;AAAA,IACA,aAAa,EAAE,OAAO,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;AAAA,EACvD;AACF;",
6
- "names": []
4
+ "sourcesContent": ["import { styleText } from 'node:util';\nimport path from 'path';\nimport { isMainThread } from 'worker_threads';\n\nimport { createLogger } from '../../utils/logging.js';\nimport { execWorkerThread, postWorkerOutput } from '../../utils/worker.js';\nimport { type PrettierOutput, runPrettier } from '../adapter/prettier.js';\n\nimport type { Input } from './types.js';\n\nconst LOG_PREFIX = styleText('cyan', 'Prettier \u2502');\n\nexport const runPrettierInCurrentThread = ({ debug }: Input) =>\n runPrettier('lint', createLogger({ debug, prefixes: [LOG_PREFIX] }));\n\nexport const runPrettierInWorkerThread = (input: Input) =>\n execWorkerThread<Input, PrettierOutput>(\n path.posix.join(__dirname, 'prettier.js'),\n input,\n );\n\nif (!isMainThread) {\n postWorkerOutput(\n runPrettierInCurrentThread,\n createLogger({ debug: false, prefixes: [LOG_PREFIX] }),\n );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAC1B,kBAAiB;AACjB,4BAA6B;AAE7B,qBAA6B;AAC7B,oBAAmD;AACnD,sBAAiD;AAIjD,MAAM,iBAAa,4BAAU,QAAQ,iBAAY;AAE1C,MAAM,6BAA6B,CAAC,EAAE,MAAM,UACjD,6BAAY,YAAQ,6BAAa,EAAE,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC;AAE9D,MAAM,4BAA4B,CAAC,cACxC;AAAA,EACE,YAAAA,QAAK,MAAM,KAAK,WAAW,aAAa;AAAA,EACxC;AACF;AAEF,IAAI,CAAC,oCAAc;AACjB;AAAA,IACE;AAAA,QACA,6BAAa,EAAE,OAAO,OAAO,UAAU,CAAC,UAAU,EAAE,CAAC;AAAA,EACvD;AACF;",
6
+ "names": ["path"]
7
7
  }