skuba 14.0.0-esmify-skuba-20251105032119 → 14.0.0-hacky-hack-lang-json-20260108235938

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 (539) hide show
  1. package/config/eslint.js +1 -1
  2. package/config/jest.js +1 -0
  3. package/config/prettier.d.ts +4 -0
  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/{src/cli → 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 +8 -0
  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/{src/cli → 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/{src/cli → 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/{src/cli → 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/{src/cli → 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/{src/cli → 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 +71 -0
  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/{src/cli → 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/{src/cli → 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/{src/cli → 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.js +41 -7
  129. package/lib/cli/init/types.js.map +1 -1
  130. package/lib/cli/init/validation.js +30 -2
  131. package/lib/cli/init/validation.js.map +1 -1
  132. package/lib/cli/init/writePackageJson.js +42 -8
  133. package/lib/cli/init/writePackageJson.js.map +2 -2
  134. package/lib/cli/lint/annotate/buildkite/eslint.js +37 -3
  135. package/lib/cli/lint/annotate/buildkite/eslint.js.map +1 -1
  136. package/lib/cli/lint/annotate/buildkite/index.js +45 -11
  137. package/lib/cli/lint/annotate/buildkite/index.js.map +1 -1
  138. package/lib/cli/lint/annotate/buildkite/internal.js +37 -3
  139. package/lib/cli/lint/annotate/buildkite/internal.js.map +1 -1
  140. package/lib/cli/lint/annotate/buildkite/prettier.js +37 -3
  141. package/lib/cli/lint/annotate/buildkite/prettier.js.map +1 -1
  142. package/lib/cli/lint/annotate/buildkite/tsc.js +37 -3
  143. package/lib/cli/lint/annotate/buildkite/tsc.js.map +1 -1
  144. package/lib/cli/lint/annotate/github/eslint.js +26 -2
  145. package/lib/cli/lint/annotate/github/eslint.js.map +1 -1
  146. package/lib/cli/lint/annotate/github/index.js +45 -11
  147. package/lib/cli/lint/annotate/github/index.js.map +1 -1
  148. package/lib/cli/lint/annotate/github/internal.js +26 -2
  149. package/lib/cli/lint/annotate/github/internal.js.map +1 -1
  150. package/lib/cli/lint/annotate/github/prettier.js +26 -2
  151. package/lib/cli/lint/annotate/github/prettier.js.map +1 -1
  152. package/lib/cli/lint/annotate/github/tsc.js +28 -4
  153. package/lib/cli/lint/annotate/github/tsc.js.map +2 -2
  154. package/lib/cli/lint/annotate/index.js +30 -6
  155. package/lib/cli/lint/annotate/index.js.map +1 -1
  156. package/lib/{src/cli → cli}/lint/autofix.d.ts +5 -0
  157. package/lib/cli/lint/autofix.js +80 -40
  158. package/lib/cli/lint/autofix.js.map +2 -2
  159. package/lib/cli/lint/eslint.js +51 -16
  160. package/lib/cli/lint/eslint.js.map +3 -3
  161. package/lib/cli/lint/external.js +51 -19
  162. package/lib/cli/lint/external.js.map +2 -2
  163. package/lib/cli/lint/index.js +50 -28
  164. package/lib/cli/lint/index.js.map +2 -2
  165. package/lib/cli/lint/internal.js +44 -18
  166. package/lib/cli/lint/internal.js.map +2 -2
  167. package/lib/cli/lint/internalLints/detectBadCodeowners.js +33 -8
  168. package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +1 -1
  169. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js +46 -14
  170. package/lib/cli/lint/internalLints/noSkubaTemplateJs.js.map +3 -3
  171. package/lib/cli/lint/internalLints/patchRenovateConfig.js +55 -21
  172. package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
  173. package/lib/cli/lint/internalLints/refreshConfigFiles.js +64 -35
  174. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +3 -3
  175. package/lib/{src/cli → cli}/lint/internalLints/upgrade/index.d.ts +2 -2
  176. package/lib/cli/lint/internalLints/upgrade/index.js +105 -41
  177. package/lib/cli/lint/internalLints/upgrade/index.js.map +3 -3
  178. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js +28 -4
  179. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/index.js.map +1 -1
  180. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js +45 -11
  181. package/lib/cli/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.js.map +2 -2
  182. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +30 -6
  183. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +1 -1
  184. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +65 -34
  185. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +2 -2
  186. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js +46 -11
  187. package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.js.map +2 -2
  188. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js +28 -4
  189. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +1 -1
  190. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +59 -23
  191. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +2 -2
  192. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js +28 -4
  193. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/index.js.map +1 -1
  194. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js +46 -11
  195. package/lib/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.js.map +2 -2
  196. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js +30 -6
  197. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/index.js.map +1 -1
  198. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js +46 -11
  199. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.js.map +2 -2
  200. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js +46 -11
  201. package/lib/cli/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.js.map +2 -2
  202. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js +28 -4
  203. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/index.js.map +1 -1
  204. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js +46 -11
  205. package/lib/cli/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.js.map +2 -2
  206. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js +67 -29
  207. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.js.map +2 -2
  208. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js +34 -10
  209. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/index.js.map +1 -1
  210. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js +45 -11
  211. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.js.map +2 -2
  212. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js +63 -17
  213. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.js.map +2 -2
  214. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +50 -15
  215. package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
  216. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js +40 -0
  217. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/index.js.map +7 -0
  218. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.d.ts +3 -0
  219. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js +149 -0
  220. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/patchRootTsconfig.js.map +7 -0
  221. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js +55 -0
  222. package/lib/cli/lint/internalLints/upgrade/patches/13.1.1/upgradeNode.js.map +7 -0
  223. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +51 -17
  224. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +2 -2
  225. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +34 -10
  226. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +1 -1
  227. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +44 -10
  228. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +2 -2
  229. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +46 -12
  230. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +2 -2
  231. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +28 -4
  232. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +1 -1
  233. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +49 -15
  234. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +2 -2
  235. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js +45 -11
  236. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.js.map +2 -2
  237. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js +34 -10
  238. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/index.js.map +1 -1
  239. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js +45 -11
  240. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.js.map +2 -2
  241. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js +45 -11
  242. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.js.map +2 -2
  243. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js +47 -13
  244. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.js.map +2 -2
  245. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js +28 -4
  246. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/index.js.map +1 -1
  247. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js +45 -11
  248. package/lib/cli/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.js.map +2 -2
  249. package/lib/cli/lint/prettier.js +50 -15
  250. package/lib/cli/lint/prettier.js.map +3 -3
  251. package/lib/cli/lint/tsc.js +28 -4
  252. package/lib/cli/lint/tsc.js.map +1 -1
  253. package/lib/cli/lint/types.js +16 -0
  254. package/lib/cli/lint/types.js.map +3 -3
  255. package/lib/cli/migrate/index.d.ts +6 -0
  256. package/lib/cli/migrate/index.js +79 -15
  257. package/lib/cli/migrate/index.js.map +2 -2
  258. package/lib/cli/migrate/nodeVersion/checks.d.ts +1 -0
  259. package/lib/cli/migrate/nodeVersion/checks.js +51 -120
  260. package/lib/cli/migrate/nodeVersion/checks.js.map +2 -2
  261. package/lib/cli/migrate/nodeVersion/index.d.ts +10 -0
  262. package/lib/cli/migrate/nodeVersion/index.js +239 -65
  263. package/lib/cli/migrate/nodeVersion/index.js.map +3 -3
  264. package/lib/cli/migrate/nodeVersion/upgrade.d.ts +8 -0
  265. package/lib/cli/migrate/nodeVersion/upgrade.js +179 -0
  266. package/lib/cli/migrate/nodeVersion/upgrade.js.map +7 -0
  267. package/lib/cli/node/index.js +57 -20
  268. package/lib/cli/node/index.js.map +3 -3
  269. package/lib/cli/release/index.js +28 -4
  270. package/lib/cli/release/index.js.map +1 -1
  271. package/lib/cli/start/index.js +50 -16
  272. package/lib/cli/start/index.js.map +3 -3
  273. package/lib/cli/test/index.js +44 -4
  274. package/lib/cli/test/index.js.map +2 -2
  275. package/lib/cli/test/reporters/github/annotations.d.ts +9 -0
  276. package/lib/cli/test/reporters/github/annotations.js +102 -0
  277. package/lib/cli/test/reporters/github/annotations.js.map +7 -0
  278. package/lib/cli/test/reporters/github/index.d.ts +5 -0
  279. package/lib/cli/test/reporters/github/index.js +74 -0
  280. package/lib/cli/test/reporters/github/index.js.map +7 -0
  281. package/lib/cli/version/index.js +30 -6
  282. package/lib/cli/version/index.js.map +1 -1
  283. package/lib/{src/index.d.ts → index.d.ts} +1 -0
  284. package/lib/index.js +46 -6
  285. package/lib/index.js.map +2 -2
  286. package/lib/skuba.js +45 -26
  287. package/lib/skuba.js.map +3 -3
  288. package/lib/utils/args.js +43 -6
  289. package/lib/utils/args.js.map +2 -2
  290. package/lib/utils/command.js +42 -4
  291. package/lib/utils/command.js.map +3 -3
  292. package/lib/utils/copy.js +57 -20
  293. package/lib/utils/copy.js.map +2 -2
  294. package/lib/utils/dir.js +72 -32
  295. package/lib/utils/dir.js.map +2 -2
  296. package/lib/utils/env.js +26 -2
  297. package/lib/utils/env.js.map +1 -1
  298. package/lib/utils/error.js +47 -10
  299. package/lib/utils/error.js.map +1 -1
  300. package/lib/{src/utils → utils}/exec.d.ts +3 -2
  301. package/lib/utils/exec.js +62 -24
  302. package/lib/utils/exec.js.map +3 -3
  303. package/lib/utils/fs.js +40 -6
  304. package/lib/utils/fs.js.map +2 -2
  305. package/lib/utils/help.js +30 -6
  306. package/lib/utils/help.js.map +1 -1
  307. package/lib/{src/utils → utils}/logging.d.ts +9 -10
  308. package/lib/utils/logging.js +38 -11
  309. package/lib/utils/logging.js.map +2 -2
  310. package/lib/utils/logo.js +52 -25
  311. package/lib/utils/logo.js.map +2 -2
  312. package/lib/{src/utils → utils}/manifest.d.ts +2 -3
  313. package/lib/utils/manifest.js +48 -8
  314. package/lib/utils/manifest.js.map +3 -3
  315. package/lib/utils/npmrc.js +26 -2
  316. package/lib/utils/npmrc.js.map +1 -1
  317. package/lib/utils/packageManager.js +49 -12
  318. package/lib/utils/packageManager.js.map +2 -2
  319. package/lib/utils/port.js +39 -4
  320. package/lib/utils/port.js.map +2 -2
  321. package/lib/utils/sleep.js +26 -2
  322. package/lib/utils/sleep.js.map +1 -1
  323. package/lib/utils/template.js +55 -18
  324. package/lib/utils/template.js.map +3 -3
  325. package/lib/utils/validation.js +31 -2
  326. package/lib/utils/validation.js.map +1 -1
  327. package/lib/utils/version.js +46 -9
  328. package/lib/utils/version.js.map +2 -2
  329. package/lib/utils/wait.js +32 -7
  330. package/lib/utils/wait.js.map +1 -1
  331. package/lib/{src/utils → utils}/worker.d.ts +3 -3
  332. package/lib/utils/worker.js +35 -10
  333. package/lib/utils/worker.js.map +1 -1
  334. package/lib/wrapper/function-arguments.d.js +1 -0
  335. package/lib/wrapper/functionHandler.js +49 -18
  336. package/lib/wrapper/functionHandler.js.map +2 -2
  337. package/lib/wrapper/http.js +43 -8
  338. package/lib/wrapper/http.js.map +2 -2
  339. package/lib/wrapper/index.js +7 -6
  340. package/lib/wrapper/index.js.map +1 -1
  341. package/lib/wrapper/main.js +42 -8
  342. package/lib/wrapper/main.js.map +3 -3
  343. package/lib/wrapper/requestListener.js +47 -13
  344. package/lib/wrapper/requestListener.js.map +2 -2
  345. package/lib/wrapper/server.js +28 -4
  346. package/lib/wrapper/server.js.map +2 -2
  347. package/package.json +43 -45
  348. package/template/base/_.prettierrc.js +1 -1
  349. package/template/base/_eslint.config.js +1 -1
  350. package/template/base/_pnpm-workspace.yaml +4 -3
  351. package/template/base/jest.config.ts +19 -0
  352. package/template/base/jest.setup.ts +3 -0
  353. package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
  354. package/template/express-rest-api/.nvmrc +1 -1
  355. package/template/express-rest-api/package.json +8 -9
  356. package/template/express-rest-api/skuba.template.js +1 -1
  357. package/template/express-rest-api/src/app.test.ts +0 -1
  358. package/template/greeter/.buildkite/pipeline.yml +1 -1
  359. package/template/greeter/.nvmrc +1 -1
  360. package/template/greeter/package.json +4 -5
  361. package/template/greeter/skuba.template.js +1 -1
  362. package/template/greeter/src/app.test.ts +1 -3
  363. package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
  364. package/template/koa-rest-api/.nvmrc +1 -1
  365. package/template/koa-rest-api/package.json +9 -11
  366. package/template/koa-rest-api/skuba.template.js +1 -1
  367. package/template/koa-rest-api/src/api/jobs/getJobs.test.ts +0 -2
  368. package/template/koa-rest-api/src/api/jobs/postJob.test.ts +0 -2
  369. package/template/koa-rest-api/src/app.test.ts +0 -2
  370. package/template/koa-rest-api/src/framework/server.test.ts +2 -2
  371. package/template/koa-rest-api/src/framework/validation.test.ts +0 -2
  372. package/template/koa-rest-api/src/testing/metrics.ts +0 -2
  373. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +2 -2
  374. package/template/lambda-sqs-worker-cdk/.nvmrc +1 -1
  375. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +7 -21
  376. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +9 -11
  377. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +3 -3
  378. package/template/lambda-sqs-worker-cdk/infra/config.ts +2 -4
  379. package/template/lambda-sqs-worker-cdk/package.json +9 -9
  380. package/template/lambda-sqs-worker-cdk/skuba.template.js +13 -1
  381. package/template/lambda-sqs-worker-cdk/src/app.test.ts +13 -22
  382. package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +0 -1
  383. package/template/lambda-sqs-worker-cdk/src/framework/validation.test.ts +31 -33
  384. package/template/lambda-sqs-worker-cdk/src/services/jobScorer.test.ts +2 -8
  385. package/template/lambda-sqs-worker-cdk/src/services/pipelineEventSender.test.ts +2 -3
  386. package/template/lambda-sqs-worker-cdk/src/testing/services.ts +3 -4
  387. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  388. package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
  389. package/template/oss-npm-package/.nvmrc +1 -1
  390. package/template/oss-npm-package/_package.json +0 -1
  391. package/template/oss-npm-package/skuba.template.js +1 -1
  392. package/template/oss-npm-package/src/index.test.ts +0 -2
  393. package/template/private-npm-package/.nvmrc +1 -1
  394. package/template/private-npm-package/_package.json +1 -2
  395. package/template/private-npm-package/skuba.template.js +2 -2
  396. package/template/private-npm-package/src/index.test.ts +0 -2
  397. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js +0 -11
  398. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/index.js.map +0 -7
  399. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js +0 -34
  400. package/lib/cli/lint/internalLints/upgrade/patches/9.1.0/upgradeNode.js.map +0 -7
  401. package/lib/config/prettier.d.ts +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/lib/src/cli/build/esbuild.d.ts +0 -6
  407. package/lib/src/cli/configure/processing/package.d.ts +0 -5
  408. package/lib/src/cli/migrate/index.d.ts +0 -1
  409. package/lib/src/cli/migrate/nodeVersion/checks.d.ts +0 -14
  410. package/lib/src/cli/migrate/nodeVersion/index.d.ts +0 -4
  411. package/template/base/vitest.config.ts +0 -25
  412. package/lib/{src/cli → cli}/adapter/eslint.d.ts +0 -0
  413. package/lib/{src/cli → cli}/adapter/prettier.d.ts +0 -0
  414. package/lib/{src/cli → cli}/build/args.d.ts +0 -0
  415. package/lib/{src/cli → cli}/build/index.d.ts +0 -0
  416. package/lib/{src/cli → cli}/build/tsc.d.ts +0 -0
  417. package/lib/{src/cli → cli}/buildPackage/index.d.ts +0 -0
  418. package/lib/{src/cli → cli}/configure/analyseConfiguration.d.ts +0 -0
  419. package/lib/{src/cli → cli}/configure/analysis/diff.d.ts +0 -0
  420. package/lib/{src/cli → cli}/configure/analysis/files.d.ts +0 -0
  421. package/lib/{src/cli → cli}/configure/analysis/git.d.ts +0 -0
  422. package/lib/{src/cli → cli}/configure/analysis/project.d.ts +0 -0
  423. package/lib/{src/cli → cli}/configure/dependencies/index.d.ts +0 -0
  424. package/lib/{src/cli → cli}/configure/dependencies/seekDatadogCustomMetrics.d.ts +0 -0
  425. package/lib/{src/cli → cli}/configure/dependencies/seekKoala.d.ts +0 -0
  426. package/lib/{src/cli → cli}/configure/dependencies/skuba.d.ts +0 -0
  427. package/lib/{src/cli → cli}/configure/dependencies/skubaDeps.d.ts +0 -0
  428. package/lib/{src/cli → cli}/configure/dependencies/skubaDive.d.ts +0 -0
  429. package/lib/{src/cli → cli}/configure/index.d.ts +0 -0
  430. package/lib/{src/cli → cli}/configure/modules/eslint.d.ts +0 -0
  431. package/lib/{src/cli → cli}/configure/modules/ignore.d.ts +0 -0
  432. package/lib/{src/cli → cli}/configure/modules/index.d.ts +0 -0
  433. package/lib/{src/cli → cli}/configure/modules/nodemon.d.ts +0 -0
  434. package/lib/{src/cli → cli}/configure/modules/package.d.ts +0 -0
  435. package/lib/{src/cli → cli}/configure/modules/prettier.d.ts +0 -0
  436. package/lib/{src/cli → cli}/configure/modules/renovate.d.ts +0 -0
  437. package/lib/{src/cli → cli}/configure/modules/serverless.d.ts +0 -0
  438. package/lib/{src/cli → cli}/configure/modules/tslint.d.ts +0 -0
  439. package/lib/{src/cli → cli}/configure/processing/configFile.d.ts +0 -0
  440. package/lib/{src/cli → cli}/configure/processing/deleteFiles.d.ts +0 -0
  441. package/lib/{src/cli → cli}/configure/processing/javascript.d.ts +0 -0
  442. package/lib/{src/cli → cli}/configure/processing/json.d.ts +0 -0
  443. package/lib/{src/cli → cli}/configure/processing/loadFiles.d.ts +0 -0
  444. package/lib/{src/cli → cli}/configure/processing/module.d.ts +0 -0
  445. package/lib/{src/cli → cli}/configure/processing/prettier.d.ts +0 -0
  446. package/lib/{src/cli → cli}/configure/processing/record.d.ts +0 -0
  447. package/lib/{src/cli → cli}/configure/processing/typescript.d.ts +0 -0
  448. package/lib/{src/cli → cli}/format/index.d.ts +0 -0
  449. package/lib/{src/cli → cli}/help/index.d.ts +0 -0
  450. package/lib/{src/cli → cli}/init/git.d.ts +0 -0
  451. package/lib/{src/cli → cli}/init/index.d.ts +0 -0
  452. package/lib/{src/cli → cli}/init/types.d.ts +1 -1
  453. /package/lib/{src/cli → cli}/init/validation.d.ts +0 -0
  454. /package/lib/{src/cli → cli}/init/writePackageJson.d.ts +0 -0
  455. /package/lib/{src/cli → cli}/lint/annotate/buildkite/eslint.d.ts +0 -0
  456. /package/lib/{src/cli → cli}/lint/annotate/buildkite/index.d.ts +0 -0
  457. /package/lib/{src/cli → cli}/lint/annotate/buildkite/internal.d.ts +0 -0
  458. /package/lib/{src/cli → cli}/lint/annotate/buildkite/prettier.d.ts +0 -0
  459. /package/lib/{src/cli → cli}/lint/annotate/buildkite/tsc.d.ts +0 -0
  460. /package/lib/{src/cli → cli}/lint/annotate/github/eslint.d.ts +0 -0
  461. /package/lib/{src/cli → cli}/lint/annotate/github/index.d.ts +0 -0
  462. /package/lib/{src/cli → cli}/lint/annotate/github/internal.d.ts +0 -0
  463. /package/lib/{src/cli → cli}/lint/annotate/github/prettier.d.ts +0 -0
  464. /package/lib/{src/cli → cli}/lint/annotate/github/tsc.d.ts +0 -0
  465. /package/lib/{src/cli → cli}/lint/annotate/index.d.ts +0 -0
  466. /package/lib/{src/cli → cli}/lint/eslint.d.ts +0 -0
  467. /package/lib/{src/cli → cli}/lint/external.d.ts +0 -0
  468. /package/lib/{src/cli → cli}/lint/index.d.ts +0 -0
  469. /package/lib/{src/cli → cli}/lint/internal.d.ts +0 -0
  470. /package/lib/{src/cli → cli}/lint/internalLints/detectBadCodeowners.d.ts +0 -0
  471. /package/lib/{src/cli → cli}/lint/internalLints/noSkubaTemplateJs.d.ts +0 -0
  472. /package/lib/{src/cli → cli}/lint/internalLints/patchRenovateConfig.d.ts +0 -0
  473. /package/lib/{src/cli → cli}/lint/internalLints/refreshConfigFiles.d.ts +0 -0
  474. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.0.4/index.d.ts +0 -0
  475. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.0.4/removeYarnIgnoreOptionalFlags.d.ts +0 -0
  476. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.1.0/index.d.ts +0 -0
  477. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.d.ts +0 -0
  478. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/10.1.0/stopBundlingInCDKTests.d.ts +0 -0
  479. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.0.2/index.d.ts +0 -0
  480. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.d.ts +0 -0
  481. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.1.1/index.d.ts +0 -0
  482. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.d.ts +0 -0
  483. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.3.0/index.d.ts +0 -0
  484. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.3.0/patchApiTokenFromEnvironment.d.ts +0 -0
  485. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.3.0/patchDockerfileSyntaxDirective.d.ts +0 -0
  486. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.0/index.d.ts +0 -0
  487. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.0/patchDockerfileCIVariable.d.ts +0 -0
  488. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/configureTsConfigForESM.d.ts +0 -0
  489. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/index.d.ts +0 -0
  490. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/patchApiDockerfiles.d.ts +0 -0
  491. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/rewriteSrcImports.d.ts +0 -0
  492. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.d.ts +0 -0
  493. /package/lib/{src/cli/lint/internalLints/upgrade/patches/7.3.1 → cli/lint/internalLints/upgrade/patches/13.1.1}/index.d.ts +0 -0
  494. /package/lib/{src/cli/lint/internalLints/upgrade/patches/9.1.0 → cli/lint/internalLints/upgrade/patches/13.1.1}/upgradeNode.d.ts +0 -0
  495. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.d.ts +0 -0
  496. /package/lib/{src/cli/lint/internalLints/upgrade/patches/8.0.0 → cli/lint/internalLints/upgrade/patches/7.3.1}/index.d.ts +0 -0
  497. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.d.ts +0 -0
  498. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.d.ts +0 -0
  499. /package/lib/{src/cli/lint/internalLints/upgrade/patches/8.2.1 → cli/lint/internalLints/upgrade/patches/8.0.0}/index.d.ts +0 -0
  500. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.d.ts +0 -0
  501. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.2.1/collapseDuplicateMergeKeys.d.ts +0 -0
  502. /package/lib/{src/cli/lint/internalLints/upgrade/patches/9.0.1 → cli/lint/internalLints/upgrade/patches/8.2.1}/index.d.ts +0 -0
  503. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.2.1/moveNpmrcMounts.d.ts +0 -0
  504. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.2.1/patchDockerCompose.d.ts +0 -0
  505. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/8.2.1/patchDockerImages.d.ts +0 -0
  506. /package/lib/{src/cli/lint/internalLints/upgrade/patches/9.1.0 → cli/lint/internalLints/upgrade/patches/9.0.1}/index.d.ts +0 -0
  507. /package/lib/{src/cli → cli}/lint/internalLints/upgrade/patches/9.0.1/patchPnpmDockerImages.d.ts +0 -0
  508. /package/lib/{src/cli → cli}/lint/prettier.d.ts +0 -0
  509. /package/lib/{src/cli → cli}/lint/tsc.d.ts +0 -0
  510. /package/lib/{src/cli → cli}/lint/types.d.ts +0 -0
  511. /package/lib/{src/cli → cli}/node/index.d.ts +0 -0
  512. /package/lib/{src/cli → cli}/release/index.d.ts +0 -0
  513. /package/lib/{src/cli → cli}/start/index.d.ts +0 -0
  514. /package/lib/{src/cli → cli}/test/index.d.ts +0 -0
  515. /package/lib/{src/cli → cli}/version/index.d.ts +0 -0
  516. /package/lib/{src/skuba.d.ts → skuba.d.ts} +0 -0
  517. /package/lib/{src/utils → utils}/args.d.ts +0 -0
  518. /package/lib/{src/utils → utils}/command.d.ts +0 -0
  519. /package/lib/{src/utils → utils}/copy.d.ts +0 -0
  520. /package/lib/{src/utils → utils}/dir.d.ts +0 -0
  521. /package/lib/{src/utils → utils}/env.d.ts +0 -0
  522. /package/lib/{src/utils → utils}/error.d.ts +0 -0
  523. /package/lib/{src/utils → utils}/fs.d.ts +0 -0
  524. /package/lib/{src/utils → utils}/help.d.ts +0 -0
  525. /package/lib/{src/utils → utils}/logo.d.ts +0 -0
  526. /package/lib/{src/utils → utils}/npmrc.d.ts +0 -0
  527. /package/lib/{src/utils → utils}/packageManager.d.ts +0 -0
  528. /package/lib/{src/utils → utils}/port.d.ts +0 -0
  529. /package/lib/{src/utils → utils}/sleep.d.ts +0 -0
  530. /package/lib/{src/utils → utils}/template.d.ts +0 -0
  531. /package/lib/{src/utils → utils}/validation.d.ts +0 -0
  532. /package/lib/{src/utils → utils}/version.d.ts +0 -0
  533. /package/lib/{src/utils → utils}/wait.d.ts +0 -0
  534. /package/lib/{src/wrapper → wrapper}/functionHandler.d.ts +0 -0
  535. /package/lib/{src/wrapper → wrapper}/http.d.ts +0 -0
  536. /package/lib/{src/wrapper → wrapper}/index.d.ts +0 -0
  537. /package/lib/{src/wrapper → wrapper}/main.d.ts +0 -0
  538. /package/lib/{src/wrapper → wrapper}/requestListener.d.ts +0 -0
  539. /package/lib/{src/wrapper → wrapper}/server.d.ts +0 -0
@@ -1,32 +1,63 @@
1
- import fnArgs from "function-arguments";
2
- import { log } from "../utils/logging.js";
3
- import { isFunction, isObject } from "../utils/validation.js";
4
- import {
5
- createRequestListenerFromFunction,
6
- serveRequestListener
7
- } from "./http.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 functionHandler_exports = {};
30
+ __export(functionHandler_exports, {
31
+ runFunctionHandler: () => runFunctionHandler
32
+ });
33
+ module.exports = __toCommonJS(functionHandler_exports);
34
+ var import_function_arguments = __toESM(require("function-arguments"));
35
+ var import_logging = require("../utils/logging.js");
36
+ var import_validation = require("../utils/validation.js");
37
+ var import_http = require("./http.js");
8
38
  const runFunctionHandler = async ({
9
39
  availablePort,
10
40
  entryPoint,
11
41
  functionName
12
42
  }) => {
13
- if (!isObject(entryPoint)) {
14
- log.subtle(log.bold(functionName), "is not exported");
43
+ if (!(0, import_validation.isObject)(entryPoint)) {
44
+ import_logging.log.subtle(import_logging.log.bold(functionName), "is not exported");
15
45
  return;
16
46
  }
17
47
  const fn = entryPoint[functionName];
18
- if (!isFunction(fn)) {
19
- log.subtle(log.bold(functionName), "is not a function");
48
+ if (!(0, import_validation.isFunction)(fn)) {
49
+ import_logging.log.subtle(import_logging.log.bold(functionName), "is not a function");
20
50
  return;
21
51
  }
22
- log.warn(
23
- log.bold(functionName),
24
- `(${fnArgs(fn).map((arg) => arg || "?").join(", ")})`
52
+ import_logging.log.warn(
53
+ import_logging.log.bold(functionName),
54
+ `(${(0, import_function_arguments.default)(fn).map((arg) => arg || "?").join(", ")})`
25
55
  );
26
- const requestListener = createRequestListenerFromFunction(fn);
27
- return serveRequestListener(requestListener, availablePort);
56
+ const requestListener = (0, import_http.createRequestListenerFromFunction)(fn);
57
+ return (0, import_http.serveRequestListener)(requestListener, availablePort);
28
58
  };
29
- export {
59
+ // Annotate the CommonJS export names for ESM import in node:
60
+ 0 && (module.exports = {
30
61
  runFunctionHandler
31
- };
62
+ });
32
63
  //# sourceMappingURL=functionHandler.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/wrapper/functionHandler.ts"],
4
4
  "sourcesContent": ["import fnArgs from 'function-arguments';\n\nimport { log } from '../utils/logging.js';\nimport { isFunction, isObject } from '../utils/validation.js';\n\nimport {\n createRequestListenerFromFunction,\n serveRequestListener,\n} from './http.js';\n\ninterface Args {\n availablePort?: number;\n entryPoint: unknown;\n functionName: string;\n}\n\n/**\n * Create an HTTP server that calls into an exported function.\n */\nexport const runFunctionHandler = async ({\n availablePort,\n entryPoint,\n functionName,\n}: Args): Promise<void> => {\n if (!isObject(entryPoint)) {\n log.subtle(log.bold(functionName), 'is not exported');\n return;\n }\n\n const fn = entryPoint[functionName];\n\n if (!isFunction(fn)) {\n log.subtle(log.bold(functionName), 'is not a function');\n return;\n }\n\n log.warn(\n log.bold(functionName),\n `(${fnArgs(fn)\n // Add a `?` placeholder for unnamed arguments.\n .map((arg) => arg || '?')\n .join(', ')})`,\n );\n\n const requestListener = createRequestListenerFromFunction(fn);\n\n return serveRequestListener(requestListener, availablePort);\n};\n"],
5
- "mappings": "AAAA,OAAO,YAAY;AAEnB,SAAS,WAAW;AACpB,SAAS,YAAY,gBAAgB;AAErC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAWA,MAAM,qBAAqB,OAAO;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACF,MAA2B;AACzB,MAAI,CAAC,SAAS,UAAU,GAAG;AACzB,QAAI,OAAO,IAAI,KAAK,YAAY,GAAG,iBAAiB;AACpD;AAAA,EACF;AAEA,QAAM,KAAK,WAAW,YAAY;AAElC,MAAI,CAAC,WAAW,EAAE,GAAG;AACnB,QAAI,OAAO,IAAI,KAAK,YAAY,GAAG,mBAAmB;AACtD;AAAA,EACF;AAEA,MAAI;AAAA,IACF,IAAI,KAAK,YAAY;AAAA,IACrB,IAAI,OAAO,EAAE,EAEV,IAAI,CAAC,QAAQ,OAAO,GAAG,EACvB,KAAK,IAAI,CAAC;AAAA,EACf;AAEA,QAAM,kBAAkB,kCAAkC,EAAE;AAE5D,SAAO,qBAAqB,iBAAiB,aAAa;AAC5D;",
6
- "names": []
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAmB;AAEnB,qBAAoB;AACpB,wBAAqC;AAErC,kBAGO;AAWA,MAAM,qBAAqB,OAAO;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACF,MAA2B;AACzB,MAAI,KAAC,4BAAS,UAAU,GAAG;AACzB,uBAAI,OAAO,mBAAI,KAAK,YAAY,GAAG,iBAAiB;AACpD;AAAA,EACF;AAEA,QAAM,KAAK,WAAW,YAAY;AAElC,MAAI,KAAC,8BAAW,EAAE,GAAG;AACnB,uBAAI,OAAO,mBAAI,KAAK,YAAY,GAAG,mBAAmB;AACtD;AAAA,EACF;AAEA,qBAAI;AAAA,IACF,mBAAI,KAAK,YAAY;AAAA,IACrB,QAAI,0BAAAA,SAAO,EAAE,EAEV,IAAI,CAAC,QAAQ,OAAO,GAAG,EACvB,KAAK,IAAI,CAAC;AAAA,EACf;AAEA,QAAM,sBAAkB,+CAAkC,EAAE;AAE5D,aAAO,kCAAqB,iBAAiB,aAAa;AAC5D;",
6
+ "names": ["fnArgs"]
7
7
  }
@@ -1,6 +1,40 @@
1
- import http from "http";
2
- import util from "util";
3
- import { startServer } from "./server.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 http_exports = {};
30
+ __export(http_exports, {
31
+ createRequestListenerFromFunction: () => createRequestListenerFromFunction,
32
+ serveRequestListener: () => serveRequestListener
33
+ });
34
+ module.exports = __toCommonJS(http_exports);
35
+ var import_http = __toESM(require("http"));
36
+ var import_util = __toESM(require("util"));
37
+ var import_server = require("./server.js");
4
38
  const createRequestListenerFromFunction = (fn) => async (req, res) => {
5
39
  const writeResponse = (response) => new Promise(
6
40
  (resolve, reject) => response === void 0 ? res.end(resolve) : res.write(
@@ -21,15 +55,16 @@ const createRequestListenerFromFunction = (fn) => async (req, res) => {
21
55
  await writeResponse(JSON.stringify(response, null, 2));
22
56
  } catch (err) {
23
57
  res.writeHead(500);
24
- await writeResponse(util.inspect(err));
58
+ await writeResponse(import_util.default.inspect(err));
25
59
  }
26
60
  };
27
61
  const serveRequestListener = (requestListener, port) => {
28
- const server = http.createServer(requestListener);
29
- return startServer(server, port);
62
+ const server = import_http.default.createServer(requestListener);
63
+ return (0, import_server.startServer)(server, port);
30
64
  };
31
- export {
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
32
67
  createRequestListenerFromFunction,
33
68
  serveRequestListener
34
- };
69
+ });
35
70
  //# sourceMappingURL=http.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/wrapper/http.ts"],
4
4
  "sourcesContent": ["import http from 'http';\nimport util from 'util';\n\nimport { startServer } from './server.js';\n\n/**\n * Create an HTTP request listener based on the supplied function.\n *\n * - The request body is JSON parsed and passed into the function as parameters.\n * - The function's return value is JSON stringified into the response body.\n */\nexport const createRequestListenerFromFunction =\n (fn: (...args: unknown[]) => Promise<unknown>): http.RequestListener =>\n async (req, res) => {\n const writeResponse = (response: unknown) =>\n new Promise<void>((resolve, reject) =>\n response === undefined\n ? res.end(resolve)\n : res.write(response, 'utf8', (err) =>\n err ? reject(err) : res.end(resolve),\n ),\n );\n\n try {\n const requestBody = await new Promise<string>((resolve, reject) => {\n const data: Buffer[] = [];\n\n req\n .on('data', (chunk: Buffer) => data.push(chunk))\n .on('end', () => resolve(Buffer.concat(data).toString()))\n .on('error', (err) => reject(err));\n });\n\n // Treat an empty body as no arguments\n const jsonRequest: unknown = requestBody ? JSON.parse(requestBody) : [];\n\n // Pass a non-array request body as the first parameter\n const args: unknown[] = Array.isArray(jsonRequest)\n ? jsonRequest\n : [jsonRequest];\n\n const response: unknown = await fn(...args);\n\n res.writeHead(200, { 'Content-Type': 'application/json' });\n\n await writeResponse(JSON.stringify(response, null, 2));\n } catch (err) {\n res.writeHead(500);\n\n await writeResponse(util.inspect(err));\n }\n };\n\n/**\n * Create a HTTP server based on the supplied `http.RequestListener`.\n *\n * This function resolves when the server is closed.\n */\nexport const serveRequestListener = (\n requestListener: http.RequestListener,\n port?: number,\n) => {\n const server = http.createServer(requestListener);\n return startServer(server, port);\n};\n"],
5
- "mappings": "AAAA,OAAO,UAAU;AACjB,OAAO,UAAU;AAEjB,SAAS,mBAAmB;AAQrB,MAAM,oCACX,CAAC,OACD,OAAO,KAAK,QAAQ;AAClB,QAAM,gBAAgB,CAAC,aACrB,IAAI;AAAA,IAAc,CAAC,SAAS,WAC1B,aAAa,SACT,IAAI,IAAI,OAAO,IACf,IAAI;AAAA,MAAM;AAAA,MAAU;AAAA,MAAQ,CAAC,QAC3B,MAAM,OAAO,GAAG,IAAI,IAAI,IAAI,OAAO;AAAA,IACrC;AAAA,EACN;AAEF,MAAI;AACF,UAAM,cAAc,MAAM,IAAI,QAAgB,CAAC,SAAS,WAAW;AACjE,YAAM,OAAiB,CAAC;AAExB,UACG,GAAG,QAAQ,CAAC,UAAkB,KAAK,KAAK,KAAK,CAAC,EAC9C,GAAG,OAAO,MAAM,QAAQ,OAAO,OAAO,IAAI,EAAE,SAAS,CAAC,CAAC,EACvD,GAAG,SAAS,CAAC,QAAQ,OAAO,GAAG,CAAC;AAAA,IACrC,CAAC;AAGD,UAAM,cAAuB,cAAc,KAAK,MAAM,WAAW,IAAI,CAAC;AAGtE,UAAM,OAAkB,MAAM,QAAQ,WAAW,IAC7C,cACA,CAAC,WAAW;AAEhB,UAAM,WAAoB,MAAM,GAAG,GAAG,IAAI;AAE1C,QAAI,UAAU,KAAK,EAAE,gBAAgB,mBAAmB,CAAC;AAEzD,UAAM,cAAc,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAAA,EACvD,SAAS,KAAK;AACZ,QAAI,UAAU,GAAG;AAEjB,UAAM,cAAc,KAAK,QAAQ,GAAG,CAAC;AAAA,EACvC;AACF;AAOK,MAAM,uBAAuB,CAClC,iBACA,SACG;AACH,QAAM,SAAS,KAAK,aAAa,eAAe;AAChD,SAAO,YAAY,QAAQ,IAAI;AACjC;",
6
- "names": []
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAiB;AAEjB,oBAA4B;AAQrB,MAAM,oCACX,CAAC,OACD,OAAO,KAAK,QAAQ;AAClB,QAAM,gBAAgB,CAAC,aACrB,IAAI;AAAA,IAAc,CAAC,SAAS,WAC1B,aAAa,SACT,IAAI,IAAI,OAAO,IACf,IAAI;AAAA,MAAM;AAAA,MAAU;AAAA,MAAQ,CAAC,QAC3B,MAAM,OAAO,GAAG,IAAI,IAAI,IAAI,OAAO;AAAA,IACrC;AAAA,EACN;AAEF,MAAI;AACF,UAAM,cAAc,MAAM,IAAI,QAAgB,CAAC,SAAS,WAAW;AACjE,YAAM,OAAiB,CAAC;AAExB,UACG,GAAG,QAAQ,CAAC,UAAkB,KAAK,KAAK,KAAK,CAAC,EAC9C,GAAG,OAAO,MAAM,QAAQ,OAAO,OAAO,IAAI,EAAE,SAAS,CAAC,CAAC,EACvD,GAAG,SAAS,CAAC,QAAQ,OAAO,GAAG,CAAC;AAAA,IACrC,CAAC;AAGD,UAAM,cAAuB,cAAc,KAAK,MAAM,WAAW,IAAI,CAAC;AAGtE,UAAM,OAAkB,MAAM,QAAQ,WAAW,IAC7C,cACA,CAAC,WAAW;AAEhB,UAAM,WAAoB,MAAM,GAAG,GAAG,IAAI;AAE1C,QAAI,UAAU,KAAK,EAAE,gBAAgB,mBAAmB,CAAC;AAEzD,UAAM,cAAc,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAAA,EACvD,SAAS,KAAK;AACZ,QAAI,UAAU,GAAG;AAEjB,UAAM,cAAc,YAAAA,QAAK,QAAQ,GAAG,CAAC;AAAA,EACvC;AACF;AAOK,MAAM,uBAAuB,CAClC,iBACA,SACG;AACH,QAAM,SAAS,YAAAC,QAAK,aAAa,eAAe;AAChD,aAAO,2BAAY,QAAQ,IAAI;AACjC;",
6
+ "names": ["util", "http"]
7
7
  }
@@ -1,15 +1,16 @@
1
- import { handleCliError } from "../utils/error.js";
2
- import { log } from "../utils/logging.js";
3
- import { main } from "./main.js";
1
+ "use strict";
2
+ var import_error = require("../utils/error.js");
3
+ var import_logging = require("../utils/logging.js");
4
+ var import_main = require("./main.js");
4
5
  const ENTRY_POINT_VAR = "__SKUBA_ENTRY_POINT";
5
6
  const PORT_VAR = "__SKUBA_PORT";
6
7
  const rawEntryPoint = process.env[ENTRY_POINT_VAR];
7
8
  if (!rawEntryPoint) {
8
- throw new Error(`Missing environment variable: ${log.bold(ENTRY_POINT_VAR)}`);
9
+ throw new Error(`Missing environment variable: ${import_logging.log.bold(ENTRY_POINT_VAR)}`);
9
10
  }
10
11
  const rawPort = process.env[PORT_VAR];
11
12
  if (!rawPort) {
12
- throw new Error(`Missing environment variable: ${log.bold(PORT_VAR)}`);
13
+ throw new Error(`Missing environment variable: ${import_logging.log.bold(PORT_VAR)}`);
13
14
  }
14
- main(rawEntryPoint, rawPort).catch(handleCliError);
15
+ (0, import_main.main)(rawEntryPoint, rawPort).catch(import_error.handleCliError);
15
16
  //# sourceMappingURL=index.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/wrapper/index.ts"],
4
4
  "sourcesContent": ["/**\n * Wrapper around an entry point provided to `skuba node` or `skuba start`.\n *\n * Beyond simply loading the entry point, it supports the following features:\n *\n * - If you set the entry point to an exported function like `src/app#handler`,\n * it will spin up a local HTTP server that calls into the function.\n *\n * - If you `export =` or `export default` an Express or Koa application,\n * it will spin up a local HTTP server based on the request listener.\n */\n\nimport { handleCliError } from '../utils/error.js';\nimport { log } from '../utils/logging.js';\n\nimport { main } from './main.js';\n\nconst ENTRY_POINT_VAR = '__SKUBA_ENTRY_POINT';\nconst PORT_VAR = '__SKUBA_PORT';\n\nconst rawEntryPoint = process.env[ENTRY_POINT_VAR];\nif (!rawEntryPoint) {\n throw new Error(`Missing environment variable: ${log.bold(ENTRY_POINT_VAR)}`);\n}\n\nconst rawPort = process.env[PORT_VAR];\nif (!rawPort) {\n throw new Error(`Missing environment variable: ${log.bold(PORT_VAR)}`);\n}\n\nmain(rawEntryPoint, rawPort).catch(handleCliError);\n"],
5
- "mappings": "AAYA,SAAS,sBAAsB;AAC/B,SAAS,WAAW;AAEpB,SAAS,YAAY;AAErB,MAAM,kBAAkB;AACxB,MAAM,WAAW;AAEjB,MAAM,gBAAgB,QAAQ,IAAI,eAAe;AACjD,IAAI,CAAC,eAAe;AAClB,QAAM,IAAI,MAAM,iCAAiC,IAAI,KAAK,eAAe,CAAC,EAAE;AAC9E;AAEA,MAAM,UAAU,QAAQ,IAAI,QAAQ;AACpC,IAAI,CAAC,SAAS;AACZ,QAAM,IAAI,MAAM,iCAAiC,IAAI,KAAK,QAAQ,CAAC,EAAE;AACvE;AAEA,KAAK,eAAe,OAAO,EAAE,MAAM,cAAc;",
5
+ "mappings": ";AAYA,mBAA+B;AAC/B,qBAAoB;AAEpB,kBAAqB;AAErB,MAAM,kBAAkB;AACxB,MAAM,WAAW;AAEjB,MAAM,gBAAgB,QAAQ,IAAI,eAAe;AACjD,IAAI,CAAC,eAAe;AAClB,QAAM,IAAI,MAAM,iCAAiC,mBAAI,KAAK,eAAe,CAAC,EAAE;AAC9E;AAEA,MAAM,UAAU,QAAQ,IAAI,QAAQ;AACpC,IAAI,CAAC,SAAS;AACZ,QAAM,IAAI,MAAM,iCAAiC,mBAAI,KAAK,QAAQ,CAAC,EAAE;AACvE;AAAA,IAEA,kBAAK,eAAe,OAAO,EAAE,MAAM,2BAAc;",
6
6
  "names": []
7
7
  }
@@ -1,13 +1,47 @@
1
- import path from "path";
2
- import { runFunctionHandler } from "./functionHandler.js";
3
- import { runRequestListener } from "./requestListener.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 main_exports = {};
30
+ __export(main_exports, {
31
+ main: () => main
32
+ });
33
+ module.exports = __toCommonJS(main_exports);
34
+ var import_path = __toESM(require("path"));
35
+ var import_functionHandler = require("./functionHandler.js");
36
+ var import_requestListener = require("./requestListener.js");
4
37
  const main = async (rawEntryPoint, rawPort) => {
5
38
  const availablePort = Number(rawPort) || void 0;
6
- const [modulePath, functionName] = path.join(process.cwd(), rawEntryPoint).split("#", 2);
7
- const entryPoint = await import(modulePath);
8
- return functionName ? runFunctionHandler({ availablePort, entryPoint, functionName }) : runRequestListener({ availablePort, entryPoint });
39
+ const [modulePath, functionName] = import_path.default.join(process.cwd(), rawEntryPoint).split("#", 2);
40
+ const entryPoint = require(modulePath);
41
+ return functionName ? (0, import_functionHandler.runFunctionHandler)({ availablePort, entryPoint, functionName }) : (0, import_requestListener.runRequestListener)({ availablePort, entryPoint });
9
42
  };
10
- export {
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
11
45
  main
12
- };
46
+ });
13
47
  //# sourceMappingURL=main.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/wrapper/main.ts"],
4
- "sourcesContent": ["import path from 'path';\n\nimport { runFunctionHandler } from './functionHandler.js';\nimport { runRequestListener } from './requestListener.js';\n\nexport const main = async (rawEntryPoint: string, rawPort: string) => {\n const availablePort = Number(rawPort) || undefined;\n\n // Support exported function targeting, e.g. `src/module.ts#callMeMaybe`\n const [modulePath, functionName] = path\n .join(process.cwd(), rawEntryPoint)\n .split('#', 2);\n\n // Load entry point as module\n\n const entryPoint = (await import(modulePath as string)) as unknown;\n\n return functionName\n ? runFunctionHandler({ availablePort, entryPoint, functionName })\n : runRequestListener({ availablePort, entryPoint });\n};\n"],
5
- "mappings": "AAAA,OAAO,UAAU;AAEjB,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AAE5B,MAAM,OAAO,OAAO,eAAuB,YAAoB;AACpE,QAAM,gBAAgB,OAAO,OAAO,KAAK;AAGzC,QAAM,CAAC,YAAY,YAAY,IAAI,KAChC,KAAK,QAAQ,IAAI,GAAG,aAAa,EACjC,MAAM,KAAK,CAAC;AAIf,QAAM,aAAc,MAAM,OAAO;AAEjC,SAAO,eACH,mBAAmB,EAAE,eAAe,YAAY,aAAa,CAAC,IAC9D,mBAAmB,EAAE,eAAe,WAAW,CAAC;AACtD;",
6
- "names": []
4
+ "sourcesContent": ["import path from 'path';\n\nimport { runFunctionHandler } from './functionHandler.js';\nimport { runRequestListener } from './requestListener.js';\n\nexport const main = async (rawEntryPoint: string, rawPort: string) => {\n const availablePort = Number(rawPort) || undefined;\n\n // Support exported function targeting, e.g. `src/module.ts#callMeMaybe`\n const [modulePath, functionName] = path\n .join(process.cwd(), rawEntryPoint)\n .split('#', 2);\n\n // Load entry point as module\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const entryPoint = require(modulePath as string) as unknown;\n\n return functionName\n ? runFunctionHandler({ availablePort, entryPoint, functionName })\n : runRequestListener({ availablePort, entryPoint });\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,6BAAmC;AACnC,6BAAmC;AAE5B,MAAM,OAAO,OAAO,eAAuB,YAAoB;AACpE,QAAM,gBAAgB,OAAO,OAAO,KAAK;AAGzC,QAAM,CAAC,YAAY,YAAY,IAAI,YAAAA,QAChC,KAAK,QAAQ,IAAI,GAAG,aAAa,EACjC,MAAM,KAAK,CAAC;AAIf,QAAM,aAAa,QAAQ,UAAoB;AAE/C,SAAO,mBACH,2CAAmB,EAAE,eAAe,YAAY,aAAa,CAAC,QAC9D,2CAAmB,EAAE,eAAe,WAAW,CAAC;AACtD;",
6
+ "names": ["path"]
7
7
  }
@@ -1,8 +1,41 @@
1
- import http from "http";
2
- import { isFunction, isIpPort, isObject } from "../utils/validation.js";
3
- import { serveRequestListener } from "./http.js";
4
- import { startServer } from "./server.js";
5
- const isConfig = (data) => isFunction(data) || isObject(data);
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 requestListener_exports = {};
30
+ __export(requestListener_exports, {
31
+ runRequestListener: () => runRequestListener
32
+ });
33
+ module.exports = __toCommonJS(requestListener_exports);
34
+ var import_http = __toESM(require("http"));
35
+ var import_validation = require("../utils/validation.js");
36
+ var import_http2 = require("./http.js");
37
+ var import_server = require("./server.js");
38
+ const isConfig = (data) => (0, import_validation.isFunction)(data) || (0, import_validation.isObject)(data);
6
39
  const runRequestListener = async ({
7
40
  availablePort,
8
41
  entryPoint
@@ -17,20 +50,21 @@ const runRequestListener = async ({
17
50
  if (Object.keys(config).length === 0) {
18
51
  return;
19
52
  }
20
- const port = isIpPort(config.port) ? config.port : availablePort;
21
- if (typeof config !== "function" && config instanceof http.Server) {
22
- return startServer(config, port);
53
+ const port = (0, import_validation.isIpPort)(config.port) ? config.port : availablePort;
54
+ if (typeof config !== "function" && config instanceof import_http.default.Server) {
55
+ return (0, import_server.startServer)(config, port);
23
56
  }
24
- if (typeof config !== "function" && config.server && config.server instanceof http.Server) {
25
- return startServer(config.server, port);
57
+ if (typeof config !== "function" && config.server && config.server instanceof import_http.default.Server) {
58
+ return (0, import_server.startServer)(config.server, port);
26
59
  }
27
60
  const requestListener = typeof config === "function" ? config : config.requestListener ?? config.callback?.();
28
61
  if (typeof requestListener !== "function") {
29
62
  return;
30
63
  }
31
- return serveRequestListener(requestListener, port);
64
+ return (0, import_http2.serveRequestListener)(requestListener, port);
32
65
  };
33
- export {
66
+ // Annotate the CommonJS export names for ESM import in node:
67
+ 0 && (module.exports = {
34
68
  runRequestListener
35
- };
69
+ });
36
70
  //# sourceMappingURL=requestListener.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/wrapper/requestListener.ts"],
4
4
  "sourcesContent": ["import http from 'http';\n\nimport { isFunction, isIpPort, isObject } from '../utils/validation.js';\n\nimport { serveRequestListener } from './http.js';\nimport { startServer } from './server.js';\n\n// Express compatibility\ninterface FunctionConfig extends http.RequestListener {\n port?: number;\n}\n\ninterface ObjectConfig {\n // Koa compatibility\n callback?: () => http.RequestListener;\n\n requestListener?: http.RequestListener;\n\n // Fastify compatibility\n server?: http.Server;\n\n default?: Promise<unknown>;\n port?: unknown;\n}\n\nconst isConfig = (\n data: unknown,\n): data is Promise<FunctionConfig> | Promise<ObjectConfig> =>\n isFunction(data) || isObject(data);\n\ninterface Args {\n availablePort?: number;\n entryPoint: unknown;\n}\n\n/**\n * Create an HTTP server that calls into an exported `http.RequestListener`.\n *\n * This supports Express and Koa applications out of the box.\n */\nexport const runRequestListener = async ({\n availablePort,\n entryPoint,\n}: Args): Promise<void> => {\n if (!isConfig(entryPoint)) {\n // Assume an executable script with weird exports\n return;\n }\n\n let config: FunctionConfig | ObjectConfig = await entryPoint;\n\n if (typeof config === 'object' && isConfig(config.default)) {\n // Prefer `export default` over `export =`\n config = await config.default;\n }\n\n if (Object.keys(config).length === 0) {\n // Assume an executable script with no exports\n return;\n }\n\n const port = isIpPort(config.port) ? config.port : availablePort;\n\n // http.Server support\n if (typeof config !== 'function' && config instanceof http.Server) {\n return startServer(config, port);\n }\n\n // Fastify workaround\n if (\n typeof config !== 'function' &&\n config.server &&\n config.server instanceof http.Server\n ) {\n return startServer(config.server, port);\n }\n\n const requestListener =\n typeof config === 'function'\n ? config\n : (config.requestListener ?? config.callback?.());\n\n if (typeof requestListener !== 'function') {\n // Assume an executable script with non-request listener exports\n return;\n }\n\n return serveRequestListener(requestListener, port);\n};\n"],
5
- "mappings": "AAAA,OAAO,UAAU;AAEjB,SAAS,YAAY,UAAU,gBAAgB;AAE/C,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAoB5B,MAAM,WAAW,CACf,SAEA,WAAW,IAAI,KAAK,SAAS,IAAI;AAY5B,MAAM,qBAAqB,OAAO;AAAA,EACvC;AAAA,EACA;AACF,MAA2B;AACzB,MAAI,CAAC,SAAS,UAAU,GAAG;AAEzB;AAAA,EACF;AAEA,MAAI,SAAwC,MAAM;AAElD,MAAI,OAAO,WAAW,YAAY,SAAS,OAAO,OAAO,GAAG;AAE1D,aAAS,MAAM,OAAO;AAAA,EACxB;AAEA,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AAEpC;AAAA,EACF;AAEA,QAAM,OAAO,SAAS,OAAO,IAAI,IAAI,OAAO,OAAO;AAGnD,MAAI,OAAO,WAAW,cAAc,kBAAkB,KAAK,QAAQ;AACjE,WAAO,YAAY,QAAQ,IAAI;AAAA,EACjC;AAGA,MACE,OAAO,WAAW,cAClB,OAAO,UACP,OAAO,kBAAkB,KAAK,QAC9B;AACA,WAAO,YAAY,OAAO,QAAQ,IAAI;AAAA,EACxC;AAEA,QAAM,kBACJ,OAAO,WAAW,aACd,SACC,OAAO,mBAAmB,OAAO,WAAW;AAEnD,MAAI,OAAO,oBAAoB,YAAY;AAEzC;AAAA,EACF;AAEA,SAAO,qBAAqB,iBAAiB,IAAI;AACnD;",
6
- "names": []
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,wBAA+C;AAE/C,IAAAA,eAAqC;AACrC,oBAA4B;AAoB5B,MAAM,WAAW,CACf,aAEA,8BAAW,IAAI,SAAK,4BAAS,IAAI;AAY5B,MAAM,qBAAqB,OAAO;AAAA,EACvC;AAAA,EACA;AACF,MAA2B;AACzB,MAAI,CAAC,SAAS,UAAU,GAAG;AAEzB;AAAA,EACF;AAEA,MAAI,SAAwC,MAAM;AAElD,MAAI,OAAO,WAAW,YAAY,SAAS,OAAO,OAAO,GAAG;AAE1D,aAAS,MAAM,OAAO;AAAA,EACxB;AAEA,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AAEpC;AAAA,EACF;AAEA,QAAM,WAAO,4BAAS,OAAO,IAAI,IAAI,OAAO,OAAO;AAGnD,MAAI,OAAO,WAAW,cAAc,kBAAkB,YAAAC,QAAK,QAAQ;AACjE,eAAO,2BAAY,QAAQ,IAAI;AAAA,EACjC;AAGA,MACE,OAAO,WAAW,cAClB,OAAO,UACP,OAAO,kBAAkB,YAAAA,QAAK,QAC9B;AACA,eAAO,2BAAY,OAAO,QAAQ,IAAI;AAAA,EACxC;AAEA,QAAM,kBACJ,OAAO,WAAW,aACd,SACC,OAAO,mBAAmB,OAAO,WAAW;AAEnD,MAAI,OAAO,oBAAoB,YAAY;AAEzC;AAAA,EACF;AAEA,aAAO,mCAAqB,iBAAiB,IAAI;AACnD;",
6
+ "names": ["import_http", "http"]
7
7
  }
@@ -1,11 +1,35 @@
1
- import { log } from "../utils/logging.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 server_exports = {};
20
+ __export(server_exports, {
21
+ startServer: () => startServer
22
+ });
23
+ module.exports = __toCommonJS(server_exports);
24
+ var import_logging = require("../utils/logging.js");
2
25
  const startServer = (server, port) => new Promise(
3
26
  (resolve, reject) => server.listen(port).on("close", resolve).on("error", reject).on("listening", () => {
4
27
  const address = server.address();
5
- log.ok("listening on port", log.bold(address.port));
28
+ import_logging.log.ok("listening on port", import_logging.log.bold(String(address.port)));
6
29
  })
7
30
  );
8
- export {
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
9
33
  startServer
10
- };
34
+ });
11
35
  //# sourceMappingURL=server.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/wrapper/server.ts"],
4
- "sourcesContent": ["import type http from 'http';\nimport type { AddressInfo } from 'net';\n\nimport { log } from '../utils/logging.js';\n/**\n * Returns a HTTP server wrapped in a promise\n *\n * This function resolves when the server is closed.\n */\nexport const startServer = (server: http.Server, port?: number) =>\n new Promise<void>((resolve, reject) =>\n server\n .listen(port)\n .on('close', resolve)\n .on('error', reject)\n .on('listening', () => {\n const address = server.address() as AddressInfo;\n\n log.ok('listening on port', log.bold(address.port));\n }),\n );\n"],
5
- "mappings": "AAGA,SAAS,WAAW;AAMb,MAAM,cAAc,CAAC,QAAqB,SAC/C,IAAI;AAAA,EAAc,CAAC,SAAS,WAC1B,OACG,OAAO,IAAI,EACX,GAAG,SAAS,OAAO,EACnB,GAAG,SAAS,MAAM,EAClB,GAAG,aAAa,MAAM;AACrB,UAAM,UAAU,OAAO,QAAQ;AAE/B,QAAI,GAAG,qBAAqB,IAAI,KAAK,QAAQ,IAAI,CAAC;AAAA,EACpD,CAAC;AACL;",
4
+ "sourcesContent": ["import type http from 'http';\nimport type { AddressInfo } from 'net';\n\nimport { log } from '../utils/logging.js';\n\n/**\n * Returns a HTTP server wrapped in a promise\n *\n * This function resolves when the server is closed.\n */\nexport const startServer = (server: http.Server, port?: number) =>\n new Promise<void>((resolve, reject) =>\n server\n .listen(port)\n .on('close', resolve)\n .on('error', reject)\n .on('listening', () => {\n const address = server.address() as AddressInfo;\n\n log.ok('listening on port', log.bold(String(address.port)));\n }),\n );\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAoB;AAOb,MAAM,cAAc,CAAC,QAAqB,SAC/C,IAAI;AAAA,EAAc,CAAC,SAAS,WAC1B,OACG,OAAO,IAAI,EACX,GAAG,SAAS,OAAO,EACnB,GAAG,SAAS,MAAM,EAClB,GAAG,aAAa,MAAM;AACrB,UAAM,UAAU,OAAO,QAAQ;AAE/B,uBAAI,GAAG,qBAAqB,mBAAI,KAAK,OAAO,QAAQ,IAAI,CAAC,CAAC;AAAA,EAC5D,CAAC;AACL;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skuba",
3
- "version": "14.0.0-esmify-skuba-20251105032119",
3
+ "version": "14.0.0-hacky-hack-lang-json-20260108235938",
4
4
  "private": false,
5
5
  "description": "SEEK development toolkit for backend applications and packages",
6
6
  "homepage": "https://github.com/seek-oss/skuba#readme",
@@ -13,7 +13,6 @@
13
13
  },
14
14
  "license": "MIT",
15
15
  "sideEffects": false,
16
- "type": "module",
17
16
  "main": "lib/index.js",
18
17
  "types": "./lib/index.d.ts",
19
18
  "bin": {
@@ -21,10 +20,12 @@
21
20
  },
22
21
  "files": [
23
22
  "config/**/*",
23
+ "jest/**/*.js",
24
24
  "lib*/**/*.d.ts",
25
25
  "lib*/**/*.js",
26
26
  "lib*/**/*.js.map",
27
- "template/**/*"
27
+ "template/**/*",
28
+ "jest-preset.js"
28
29
  ],
29
30
  "remarkConfig": {
30
31
  "plugins": [
@@ -54,22 +55,21 @@
54
55
  ]
55
56
  },
56
57
  "dependencies": {
58
+ "@ast-grep/lang-json": "^0.0.5",
59
+ "@ast-grep/napi": "^0.40.0",
57
60
  "@esbuild-plugins/tsconfig-paths": "^0.1.0",
58
- "@eslint/migrate-config": "~1.3.8",
61
+ "@inquirer/prompts": "^7.9.0",
62
+ "@jest/types": "^30.0.0",
59
63
  "@octokit/graphql": "^9.0.0",
60
64
  "@octokit/graphql-schema": "^15.3.0",
61
65
  "@octokit/rest": "^22.0.0",
62
- "@octokit/types": "^15.0.0",
63
- "@types/node": "^22.0.0",
64
- "@vitest/coverage-v8": "^4.0.5",
65
- "@vitest/ui": "^4.0.5",
66
- "@vitest/utils": "^4.0.5",
67
- "chalk": "^4.1.0",
66
+ "@octokit/types": "^16.0.0",
67
+ "@types/jest": "^30.0.0",
68
+ "@types/node": "^24.10.2",
68
69
  "concurrently": "^9.0.0",
69
70
  "ejs": "^3.1.6",
70
- "enquirer": "^2.3.6",
71
- "esbuild": "~0.25.0",
72
- "eslint": "^9.11.1",
71
+ "esbuild": "~0.27.0",
72
+ "eslint": "^9.39.1",
73
73
  "execa": "^5.0.0",
74
74
  "fast-glob": "^3.3.2",
75
75
  "find-up": "^5.0.0",
@@ -80,6 +80,8 @@
80
80
  "ignore": "^7.0.0",
81
81
  "is-installed-globally": "^0.4.0",
82
82
  "isomorphic-git": "^1.11.1",
83
+ "jest": "^30.0.0",
84
+ "jest-watch-typeahead": "^3.0.1",
83
85
  "lodash.mergewith": "^4.6.2",
84
86
  "minimist": "^1.2.6",
85
87
  "normalize-package-data": "^7.0.0",
@@ -87,65 +89,61 @@
87
89
  "npm-run-path": "^4.0.1",
88
90
  "npm-which": "^3.0.1",
89
91
  "picomatch": "^4.0.0",
90
- "prettier": "~3.6.0",
92
+ "prettier": "~3.7.0",
91
93
  "prettier-plugin-packagejson": "^2.4.10",
92
- "read-package-up": "^11.0.0",
94
+ "read-pkg-up": "^7.0.1",
93
95
  "semantic-release": "^24.2.3",
94
96
  "simple-git": "^3.5.0",
97
+ "ts-dedent": "^2.2.0",
98
+ "ts-jest": "^29.4.0",
99
+ "ts-node": "^10.9.2",
95
100
  "tsconfig-paths": "^4.0.0",
96
101
  "tsconfig-seek": "2.0.0",
97
- "tsx": "^4.16.2",
102
+ "tsx": "^4.21.0",
98
103
  "typescript": "~5.9.0",
99
- "vitest": "^4.0.5",
100
104
  "zod": "^4.0.0",
101
- "@skuba-lib/api": "^1.1.0-esmify-skuba-20251105032119",
102
- "eslint-config-skuba": "7.3.0-esmify-skuba-20251105032119"
105
+ "@skuba-lib/api": "^2.0.0-hacky-hack-lang-json-20260108235938",
106
+ "eslint-config-skuba": "8.0.0-hacky-hack-lang-json-20260108235938"
103
107
  },
104
108
  "devDependencies": {
105
- "@changesets/cli": "2.29.7",
106
- "@changesets/get-github-info": "0.6.0",
109
+ "@changesets/cli": "2.29.8",
110
+ "@changesets/get-github-info": "0.7.0",
111
+ "@jest/reporters": "30.2.0",
112
+ "@jest/test-result": "30.2.0",
107
113
  "@types/ejs": "3.1.5",
108
- "@types/express": "5.0.3",
114
+ "@types/express": "5.0.6",
109
115
  "@types/fs-extra": "11.0.4",
110
- "@types/koa": "3.0.0",
116
+ "@types/koa": "3.0.1",
111
117
  "@types/lodash.mergewith": "4.6.9",
112
118
  "@types/minimist": "1.2.5",
113
119
  "@types/module-alias": "2.0.4",
114
- "@types/npm-registry-fetch": "8.0.8",
120
+ "@types/npm-registry-fetch": "8.0.9",
115
121
  "@types/npm-which": "3.0.4",
116
122
  "@types/picomatch": "4.0.2",
117
123
  "@types/semver": "7.7.1",
118
124
  "@types/supertest": "6.0.3",
119
- "enhanced-resolve": "5.18.3",
120
- "express": "5.1.0",
121
- "fastify": "5.6.1",
125
+ "enhanced-resolve": "5.18.4",
126
+ "express": "5.2.1",
127
+ "fastify": "5.6.2",
128
+ "jest-diff": "30.2.0",
122
129
  "jsonfile": "6.2.0",
123
- "koa": "3.0.3",
124
- "memfs": "4.49.0",
130
+ "koa": "3.1.1",
131
+ "memfs": "4.51.1",
125
132
  "remark-cli": "12.0.1",
126
133
  "remark-preset-lint-recommended": "7.0.1",
127
134
  "semver": "7.7.3",
128
135
  "supertest": "7.1.4",
129
- "ts-dedent": "^2.2.0",
130
136
  "type-fest": "2.19.0"
131
137
  },
132
- "peerDependencies": {
133
- "skuba-dive": "3.0.0-esmify-skuba-20251105032119"
134
- },
135
- "peerDependenciesMeta": {
136
- "skuba-dive": {
137
- "optional": true
138
- }
139
- },
140
138
  "engines": {
141
- "node": ">=20.9.0"
139
+ "node": ">=22.14.0"
142
140
  },
143
141
  "skuba": {
144
142
  "build": "esbuild",
145
143
  "entryPoint": "src/index.ts",
146
144
  "template": null,
147
145
  "type": "package",
148
- "version": "13.0.0"
146
+ "version": "13.1.1"
149
147
  },
150
148
  "scripts": {
151
149
  "build": "scripts/build.sh",
@@ -160,12 +158,12 @@
160
158
  "release": "pnpm --silent build && changeset publish",
161
159
  "skuba": "pnpm --silent build && pnpm --silent skuba:exec",
162
160
  "skuba:exec": "node lib/skuba",
163
- "stage": "changeset version && node ./.changeset/inject.cjs && pnpm format",
164
- "test": "pnpm --silent skuba test run",
165
- "test:ci": "pnpm --silent skuba test run",
166
- "test:int": "pnpm --silent skuba test run",
161
+ "stage": "changeset version && node ./.changeset/inject.js && pnpm format",
162
+ "test": "pnpm --silent skuba test --selectProjects unit",
163
+ "test:ci": "pnpm --silent skuba test --runInBand",
164
+ "test:int": "pnpm --silent skuba test --selectProjects integration --runInBand",
167
165
  "test:template": "scripts/test-template.sh",
168
166
  "test:template:updateSnapshot": "scripts/test-template.sh -u",
169
- "test:watch": "pnpm --silent skuba test"
167
+ "test:watch": "pnpm --silent skuba test --runInBand --watch"
170
168
  }
171
169
  }
@@ -1 +1 @@
1
- export { default } from 'skuba/config/prettier.js';
1
+ module.exports = require('skuba/config/prettier');
@@ -1 +1 @@
1
- export { default } from 'eslint-config-skuba';
1
+ module.exports = require('eslint-config-skuba');