cloudstructs 0.9.13 → 0.9.14

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 (367) hide show
  1. package/.jsii +3 -3
  2. package/assets/slack-textract/detect.lambda/index.js +14 -9
  3. package/lib/codecommit-mirror/index.js +2 -2
  4. package/lib/dmarc/index.js +1 -1
  5. package/lib/ecs-service-roller/index.js +2 -2
  6. package/lib/email-receiver/receiver.js +1 -1
  7. package/lib/email-receiver/whitelist.lambda.js +2 -3
  8. package/lib/mjml-template/index.js +1 -1
  9. package/lib/saml-identity-provider/index.js +2 -2
  10. package/lib/slack-app/manifest.js +1 -1
  11. package/lib/slack-app/provider.lambda.js +2 -3
  12. package/lib/slack-app/slack-app.js +2 -2
  13. package/lib/slack-events/events.lambda.js +2 -3
  14. package/lib/slack-events/index.js +1 -1
  15. package/lib/slack-events/signature.js +2 -3
  16. package/lib/slack-textract/detect.lambda.js +2 -3
  17. package/lib/slack-textract/index.js +1 -1
  18. package/lib/ssl-server-test/analyze.lambda.js +2 -3
  19. package/lib/ssl-server-test/extract-grade.lambda.js +2 -3
  20. package/lib/ssl-server-test/index.js +1 -1
  21. package/lib/state-machine-cr-provider/index.js +1 -1
  22. package/lib/state-machine-cr-provider/runtime/http.js +3 -3
  23. package/lib/state-machine-cr-provider/runtime/index.js +5 -5
  24. package/lib/static-website/index.js +1 -1
  25. package/lib/static-website/origin-request.edge-lambda.js +2 -3
  26. package/lib/toolkit-cleaner/clean-images.lambda.js +2 -3
  27. package/lib/toolkit-cleaner/clean-objects.lambda.js +2 -3
  28. package/lib/toolkit-cleaner/extract-template-hashes.lambda.js +2 -3
  29. package/lib/toolkit-cleaner/get-stack-names.lambda.js +2 -3
  30. package/lib/toolkit-cleaner/index.js +1 -1
  31. package/lib/url-shortener/index.js +1 -1
  32. package/lib/url-shortener/redirect.edge-lambda.js +2 -3
  33. package/lib/url-shortener/shortener.lambda.js +2 -3
  34. package/node_modules/@babel/runtime/helpers/extends.js +2 -2
  35. package/node_modules/@babel/runtime/helpers/get.js +2 -2
  36. package/node_modules/@babel/runtime/helpers/getPrototypeOf.js +2 -2
  37. package/node_modules/@babel/runtime/helpers/setPrototypeOf.js +2 -2
  38. package/node_modules/@babel/runtime/helpers/typeof.js +2 -2
  39. package/node_modules/@babel/runtime/helpers/wrapNativeSuper.js +2 -2
  40. package/node_modules/@babel/runtime/package.json +1 -1
  41. package/node_modules/@slack/logger/node_modules/@types/node/README.md +1 -1
  42. package/node_modules/@slack/logger/node_modules/@types/node/globals.d.ts +47 -48
  43. package/node_modules/@slack/logger/node_modules/@types/node/http.d.ts +13 -0
  44. package/node_modules/@slack/logger/node_modules/@types/node/index.d.ts +1 -0
  45. package/node_modules/@slack/logger/node_modules/@types/node/package.json +2 -2
  46. package/node_modules/@slack/logger/node_modules/@types/node/path.d.ts +9 -0
  47. package/node_modules/@slack/logger/node_modules/@types/node/process.d.ts +35 -0
  48. package/node_modules/@slack/logger/node_modules/@types/node/sqlite.d.ts +213 -0
  49. package/node_modules/@slack/logger/node_modules/@types/node/worker_threads.d.ts +18 -0
  50. package/node_modules/@slack/logger/node_modules/undici-types/package.json +1 -1
  51. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
  52. package/node_modules/@slack/web-api/node_modules/@types/node/globals.d.ts +47 -48
  53. package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +13 -0
  54. package/node_modules/@slack/web-api/node_modules/@types/node/index.d.ts +1 -0
  55. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
  56. package/node_modules/@slack/web-api/node_modules/@types/node/path.d.ts +9 -0
  57. package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +35 -0
  58. package/node_modules/@slack/web-api/node_modules/@types/node/sqlite.d.ts +213 -0
  59. package/node_modules/@slack/web-api/node_modules/@types/node/worker_threads.d.ts +18 -0
  60. package/node_modules/@slack/web-api/node_modules/undici-types/package.json +1 -1
  61. package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +1 -1
  62. package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +5 -5
  63. package/node_modules/@types/cacheable-request/node_modules/@types/node/async_hooks.d.ts +5 -5
  64. package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +12 -1
  65. package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +2 -2
  66. package/node_modules/@types/cacheable-request/node_modules/@types/node/cluster.d.ts +15 -15
  67. package/node_modules/@types/cacheable-request/node_modules/@types/node/console.d.ts +17 -17
  68. package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +5 -78
  69. package/node_modules/@types/cacheable-request/node_modules/@types/node/dgram.d.ts +1 -1
  70. package/node_modules/@types/cacheable-request/node_modules/@types/node/diagnostics_channel.d.ts +1 -1
  71. package/node_modules/@types/cacheable-request/node_modules/@types/node/dns.d.ts +18 -17
  72. package/node_modules/@types/cacheable-request/node_modules/@types/node/domain.d.ts +1 -1
  73. package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +1 -1
  74. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +19 -0
  75. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +75 -2
  76. package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +99 -1
  77. package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +15 -2
  78. package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +2 -2
  79. package/node_modules/@types/cacheable-request/node_modules/@types/node/https.d.ts +1 -1
  80. package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +1 -0
  81. package/node_modules/@types/cacheable-request/node_modules/@types/node/inspector.d.ts +1 -1
  82. package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +0 -14
  83. package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +1 -1
  84. package/node_modules/@types/cacheable-request/node_modules/@types/node/os.d.ts +3 -3
  85. package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +3 -3
  86. package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +10 -1
  87. package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +45 -9
  88. package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +178 -19
  89. package/node_modules/@types/cacheable-request/node_modules/@types/node/punycode.d.ts +1 -1
  90. package/node_modules/@types/cacheable-request/node_modules/@types/node/querystring.d.ts +1 -1
  91. package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +10 -10
  92. package/node_modules/@types/cacheable-request/node_modules/@types/node/repl.d.ts +12 -12
  93. package/node_modules/@types/cacheable-request/node_modules/@types/node/sea.d.ts +1 -1
  94. package/node_modules/@types/cacheable-request/node_modules/@types/node/sqlite.d.ts +213 -0
  95. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +9 -9
  96. package/node_modules/@types/cacheable-request/node_modules/@types/node/string_decoder.d.ts +1 -1
  97. package/node_modules/@types/cacheable-request/node_modules/@types/node/test.d.ts +378 -101
  98. package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +1 -1
  99. package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +5 -2
  100. package/node_modules/@types/cacheable-request/node_modules/@types/node/trace_events.d.ts +6 -6
  101. package/node_modules/@types/cacheable-request/node_modules/@types/node/tty.d.ts +1 -1
  102. package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +19 -2
  103. package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +8 -2
  104. package/node_modules/@types/cacheable-request/node_modules/@types/node/v8.d.ts +2 -2
  105. package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +5 -7
  106. package/node_modules/@types/cacheable-request/node_modules/@types/node/wasi.d.ts +1 -1
  107. package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +19 -1
  108. package/node_modules/@types/cacheable-request/node_modules/@types/node/zlib.d.ts +12 -3
  109. package/node_modules/@types/cacheable-request/node_modules/undici-types/LICENSE +21 -0
  110. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/balanced-pool.d.ts +11 -0
  111. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/client.d.ts +12 -1
  112. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/diagnostics-channel.d.ts +1 -2
  113. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/dispatcher.d.ts +18 -4
  114. package/node_modules/@types/cacheable-request/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  115. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/errors.d.ts +21 -0
  116. package/node_modules/@types/cacheable-request/node_modules/undici-types/eventsource.d.ts +63 -0
  117. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/fetch.d.ts +25 -25
  118. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/formdata.d.ts +1 -1
  119. package/node_modules/@types/cacheable-request/node_modules/undici-types/handlers.d.ts +15 -0
  120. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/index.d.ts +10 -2
  121. package/node_modules/@types/cacheable-request/node_modules/undici-types/interceptors.d.ts +15 -0
  122. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/mock-interceptor.d.ts +4 -4
  123. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/package.json +1 -1
  124. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/pool.d.ts +11 -0
  125. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/proxy-agent.d.ts +0 -2
  126. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/readable.d.ts +2 -3
  127. package/node_modules/@types/cacheable-request/node_modules/undici-types/retry-agent.d.ts +8 -0
  128. package/node_modules/@types/cacheable-request/node_modules/undici-types/retry-handler.d.ts +116 -0
  129. package/node_modules/@types/cacheable-request/node_modules/undici-types/util.d.ts +18 -0
  130. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/webidl.d.ts +10 -8
  131. package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/websocket.d.ts +22 -1
  132. package/node_modules/@types/keyv/node_modules/@types/node/README.md +1 -1
  133. package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +5 -5
  134. package/node_modules/@types/keyv/node_modules/@types/node/async_hooks.d.ts +5 -5
  135. package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +12 -1
  136. package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +2 -2
  137. package/node_modules/@types/keyv/node_modules/@types/node/cluster.d.ts +15 -15
  138. package/node_modules/@types/keyv/node_modules/@types/node/console.d.ts +17 -17
  139. package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +5 -78
  140. package/node_modules/@types/keyv/node_modules/@types/node/dgram.d.ts +1 -1
  141. package/node_modules/@types/keyv/node_modules/@types/node/diagnostics_channel.d.ts +1 -1
  142. package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +18 -17
  143. package/node_modules/@types/keyv/node_modules/@types/node/domain.d.ts +1 -1
  144. package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +1 -1
  145. package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +19 -0
  146. package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +75 -2
  147. package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +99 -1
  148. package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +15 -2
  149. package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +2 -2
  150. package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +1 -1
  151. package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +1 -0
  152. package/node_modules/@types/keyv/node_modules/@types/node/inspector.d.ts +1 -1
  153. package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +0 -14
  154. package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +1 -1
  155. package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +3 -3
  156. package/node_modules/@types/keyv/node_modules/@types/node/package.json +3 -3
  157. package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +10 -1
  158. package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +45 -9
  159. package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +178 -19
  160. package/node_modules/@types/keyv/node_modules/@types/node/punycode.d.ts +1 -1
  161. package/node_modules/@types/keyv/node_modules/@types/node/querystring.d.ts +1 -1
  162. package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +10 -10
  163. package/node_modules/@types/keyv/node_modules/@types/node/repl.d.ts +12 -12
  164. package/node_modules/@types/keyv/node_modules/@types/node/sea.d.ts +1 -1
  165. package/node_modules/@types/keyv/node_modules/@types/node/sqlite.d.ts +213 -0
  166. package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +9 -9
  167. package/node_modules/@types/keyv/node_modules/@types/node/string_decoder.d.ts +1 -1
  168. package/node_modules/@types/keyv/node_modules/@types/node/test.d.ts +378 -101
  169. package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +1 -1
  170. package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +5 -2
  171. package/node_modules/@types/keyv/node_modules/@types/node/trace_events.d.ts +6 -6
  172. package/node_modules/@types/keyv/node_modules/@types/node/tty.d.ts +1 -1
  173. package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +19 -2
  174. package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +8 -2
  175. package/node_modules/@types/keyv/node_modules/@types/node/v8.d.ts +2 -2
  176. package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +5 -7
  177. package/node_modules/@types/keyv/node_modules/@types/node/wasi.d.ts +1 -1
  178. package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +19 -1
  179. package/node_modules/@types/keyv/node_modules/@types/node/zlib.d.ts +12 -3
  180. package/node_modules/@types/keyv/node_modules/undici-types/LICENSE +21 -0
  181. package/node_modules/@types/keyv/node_modules/undici-types/README.md +6 -0
  182. package/node_modules/@types/keyv/node_modules/undici-types/agent.d.ts +31 -0
  183. package/node_modules/@types/keyv/node_modules/undici-types/api.d.ts +43 -0
  184. package/node_modules/@types/keyv/node_modules/undici-types/balanced-pool.d.ts +29 -0
  185. package/node_modules/@types/keyv/node_modules/undici-types/cache.d.ts +36 -0
  186. package/node_modules/@types/keyv/node_modules/undici-types/client.d.ts +108 -0
  187. package/node_modules/@types/keyv/node_modules/undici-types/connector.d.ts +34 -0
  188. package/node_modules/@types/keyv/node_modules/undici-types/content-type.d.ts +21 -0
  189. package/node_modules/@types/keyv/node_modules/undici-types/cookies.d.ts +28 -0
  190. package/node_modules/@types/keyv/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  191. package/node_modules/@types/keyv/node_modules/undici-types/dispatcher.d.ts +255 -0
  192. package/node_modules/@types/keyv/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  193. package/node_modules/@types/keyv/node_modules/undici-types/errors.d.ts +149 -0
  194. package/node_modules/@types/keyv/node_modules/undici-types/eventsource.d.ts +63 -0
  195. package/node_modules/@types/keyv/node_modules/undici-types/fetch.d.ts +209 -0
  196. package/node_modules/@types/keyv/node_modules/undici-types/file.d.ts +39 -0
  197. package/node_modules/@types/keyv/node_modules/undici-types/filereader.d.ts +54 -0
  198. package/node_modules/@types/keyv/node_modules/undici-types/formdata.d.ts +108 -0
  199. package/node_modules/@types/keyv/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  200. package/node_modules/@types/keyv/node_modules/undici-types/global-origin.d.ts +7 -0
  201. package/node_modules/@types/keyv/node_modules/undici-types/handlers.d.ts +15 -0
  202. package/node_modules/@types/keyv/node_modules/undici-types/header.d.ts +4 -0
  203. package/node_modules/@types/keyv/node_modules/undici-types/index.d.ts +71 -0
  204. package/node_modules/@types/keyv/node_modules/undici-types/interceptors.d.ts +15 -0
  205. package/node_modules/@types/keyv/node_modules/undici-types/mock-agent.d.ts +50 -0
  206. package/node_modules/@types/keyv/node_modules/undici-types/mock-client.d.ts +25 -0
  207. package/node_modules/@types/keyv/node_modules/undici-types/mock-errors.d.ts +12 -0
  208. package/node_modules/@types/keyv/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  209. package/node_modules/@types/keyv/node_modules/undici-types/mock-pool.d.ts +25 -0
  210. package/node_modules/@types/keyv/node_modules/undici-types/package.json +55 -0
  211. package/node_modules/@types/keyv/node_modules/undici-types/patch.d.ts +71 -0
  212. package/node_modules/@types/keyv/node_modules/undici-types/pool-stats.d.ts +19 -0
  213. package/node_modules/@types/keyv/node_modules/undici-types/pool.d.ts +39 -0
  214. package/node_modules/@types/keyv/node_modules/undici-types/proxy-agent.d.ts +28 -0
  215. package/node_modules/@types/keyv/node_modules/undici-types/readable.d.ts +60 -0
  216. package/node_modules/@types/keyv/node_modules/undici-types/retry-agent.d.ts +8 -0
  217. package/node_modules/@types/keyv/node_modules/undici-types/retry-handler.d.ts +116 -0
  218. package/node_modules/@types/keyv/node_modules/undici-types/util.d.ts +18 -0
  219. package/node_modules/@types/keyv/node_modules/undici-types/webidl.d.ts +222 -0
  220. package/node_modules/@types/keyv/node_modules/undici-types/websocket.d.ts +152 -0
  221. package/node_modules/@types/responselike/node_modules/@types/node/README.md +1 -1
  222. package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +5 -5
  223. package/node_modules/@types/responselike/node_modules/@types/node/async_hooks.d.ts +5 -5
  224. package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +12 -1
  225. package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +2 -2
  226. package/node_modules/@types/responselike/node_modules/@types/node/cluster.d.ts +15 -15
  227. package/node_modules/@types/responselike/node_modules/@types/node/console.d.ts +17 -17
  228. package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +5 -78
  229. package/node_modules/@types/responselike/node_modules/@types/node/dgram.d.ts +1 -1
  230. package/node_modules/@types/responselike/node_modules/@types/node/diagnostics_channel.d.ts +1 -1
  231. package/node_modules/@types/responselike/node_modules/@types/node/dns.d.ts +18 -17
  232. package/node_modules/@types/responselike/node_modules/@types/node/domain.d.ts +1 -1
  233. package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +1 -1
  234. package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +19 -0
  235. package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +75 -2
  236. package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +99 -1
  237. package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +15 -2
  238. package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +2 -2
  239. package/node_modules/@types/responselike/node_modules/@types/node/https.d.ts +1 -1
  240. package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +1 -0
  241. package/node_modules/@types/responselike/node_modules/@types/node/inspector.d.ts +1 -1
  242. package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +0 -14
  243. package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +1 -1
  244. package/node_modules/@types/responselike/node_modules/@types/node/os.d.ts +3 -3
  245. package/node_modules/@types/responselike/node_modules/@types/node/package.json +3 -3
  246. package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +10 -1
  247. package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +45 -9
  248. package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +178 -19
  249. package/node_modules/@types/responselike/node_modules/@types/node/punycode.d.ts +1 -1
  250. package/node_modules/@types/responselike/node_modules/@types/node/querystring.d.ts +1 -1
  251. package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +10 -10
  252. package/node_modules/@types/responselike/node_modules/@types/node/repl.d.ts +12 -12
  253. package/node_modules/@types/responselike/node_modules/@types/node/sea.d.ts +1 -1
  254. package/node_modules/@types/responselike/node_modules/@types/node/sqlite.d.ts +213 -0
  255. package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +9 -9
  256. package/node_modules/@types/responselike/node_modules/@types/node/string_decoder.d.ts +1 -1
  257. package/node_modules/@types/responselike/node_modules/@types/node/test.d.ts +378 -101
  258. package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +1 -1
  259. package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +5 -2
  260. package/node_modules/@types/responselike/node_modules/@types/node/trace_events.d.ts +6 -6
  261. package/node_modules/@types/responselike/node_modules/@types/node/tty.d.ts +1 -1
  262. package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +19 -2
  263. package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +8 -2
  264. package/node_modules/@types/responselike/node_modules/@types/node/v8.d.ts +2 -2
  265. package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +5 -7
  266. package/node_modules/@types/responselike/node_modules/@types/node/wasi.d.ts +1 -1
  267. package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +19 -1
  268. package/node_modules/@types/responselike/node_modules/@types/node/zlib.d.ts +12 -3
  269. package/node_modules/@types/responselike/node_modules/undici-types/LICENSE +21 -0
  270. package/node_modules/@types/responselike/node_modules/undici-types/README.md +6 -0
  271. package/node_modules/@types/responselike/node_modules/undici-types/agent.d.ts +31 -0
  272. package/node_modules/@types/responselike/node_modules/undici-types/api.d.ts +43 -0
  273. package/node_modules/@types/responselike/node_modules/undici-types/balanced-pool.d.ts +29 -0
  274. package/node_modules/@types/responselike/node_modules/undici-types/cache.d.ts +36 -0
  275. package/node_modules/@types/responselike/node_modules/undici-types/client.d.ts +108 -0
  276. package/node_modules/@types/responselike/node_modules/undici-types/connector.d.ts +34 -0
  277. package/node_modules/@types/responselike/node_modules/undici-types/content-type.d.ts +21 -0
  278. package/node_modules/@types/responselike/node_modules/undici-types/cookies.d.ts +28 -0
  279. package/node_modules/@types/responselike/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  280. package/node_modules/@types/responselike/node_modules/undici-types/dispatcher.d.ts +255 -0
  281. package/node_modules/@types/responselike/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  282. package/node_modules/@types/responselike/node_modules/undici-types/errors.d.ts +149 -0
  283. package/node_modules/@types/responselike/node_modules/undici-types/eventsource.d.ts +63 -0
  284. package/node_modules/@types/responselike/node_modules/undici-types/fetch.d.ts +209 -0
  285. package/node_modules/@types/responselike/node_modules/undici-types/file.d.ts +39 -0
  286. package/node_modules/@types/responselike/node_modules/undici-types/filereader.d.ts +54 -0
  287. package/node_modules/@types/responselike/node_modules/undici-types/formdata.d.ts +108 -0
  288. package/node_modules/@types/responselike/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  289. package/node_modules/@types/responselike/node_modules/undici-types/global-origin.d.ts +7 -0
  290. package/node_modules/@types/responselike/node_modules/undici-types/handlers.d.ts +15 -0
  291. package/node_modules/@types/responselike/node_modules/undici-types/header.d.ts +4 -0
  292. package/node_modules/@types/responselike/node_modules/undici-types/index.d.ts +71 -0
  293. package/node_modules/@types/responselike/node_modules/undici-types/interceptors.d.ts +15 -0
  294. package/node_modules/@types/responselike/node_modules/undici-types/mock-agent.d.ts +50 -0
  295. package/node_modules/@types/responselike/node_modules/undici-types/mock-client.d.ts +25 -0
  296. package/node_modules/@types/responselike/node_modules/undici-types/mock-errors.d.ts +12 -0
  297. package/node_modules/@types/responselike/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  298. package/node_modules/@types/responselike/node_modules/undici-types/mock-pool.d.ts +25 -0
  299. package/node_modules/@types/responselike/node_modules/undici-types/package.json +55 -0
  300. package/node_modules/@types/responselike/node_modules/undici-types/patch.d.ts +71 -0
  301. package/node_modules/@types/responselike/node_modules/undici-types/pool-stats.d.ts +19 -0
  302. package/node_modules/@types/responselike/node_modules/undici-types/pool.d.ts +39 -0
  303. package/node_modules/@types/responselike/node_modules/undici-types/proxy-agent.d.ts +28 -0
  304. package/node_modules/@types/responselike/node_modules/undici-types/readable.d.ts +60 -0
  305. package/node_modules/@types/responselike/node_modules/undici-types/retry-agent.d.ts +8 -0
  306. package/node_modules/@types/responselike/node_modules/undici-types/retry-handler.d.ts +116 -0
  307. package/node_modules/@types/responselike/node_modules/undici-types/util.d.ts +18 -0
  308. package/node_modules/@types/responselike/node_modules/undici-types/webidl.d.ts +222 -0
  309. package/node_modules/@types/responselike/node_modules/undici-types/websocket.d.ts +152 -0
  310. package/node_modules/axios/CHANGELOG.md +16 -0
  311. package/node_modules/axios/README.md +6 -57
  312. package/node_modules/axios/dist/axios.js +29 -22
  313. package/node_modules/axios/dist/axios.js.map +1 -1
  314. package/node_modules/axios/dist/axios.min.js +1 -1
  315. package/node_modules/axios/dist/axios.min.js.map +1 -1
  316. package/node_modules/axios/dist/browser/axios.cjs +17 -10
  317. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  318. package/node_modules/axios/dist/esm/axios.js +17 -10
  319. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  320. package/node_modules/axios/dist/esm/axios.min.js +1 -1
  321. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  322. package/node_modules/axios/dist/node/axios.cjs +18 -11
  323. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  324. package/node_modules/axios/lib/adapters/fetch.js +4 -1
  325. package/node_modules/axios/lib/adapters/http.js +1 -1
  326. package/node_modules/axios/lib/core/AxiosError.js +5 -2
  327. package/node_modules/axios/lib/env/data.js +1 -1
  328. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +1 -1
  329. package/node_modules/axios/lib/platform/common/utils.js +5 -4
  330. package/node_modules/axios/package.json +1 -1
  331. package/node_modules/foreground-child/dist/commonjs/index.d.ts +4 -2
  332. package/node_modules/foreground-child/dist/commonjs/index.d.ts.map +1 -1
  333. package/node_modules/foreground-child/dist/commonjs/index.js +4 -2
  334. package/node_modules/foreground-child/dist/commonjs/index.js.map +1 -1
  335. package/node_modules/foreground-child/dist/esm/index.d.ts +4 -2
  336. package/node_modules/foreground-child/dist/esm/index.d.ts.map +1 -1
  337. package/node_modules/foreground-child/dist/esm/index.js +4 -2
  338. package/node_modules/foreground-child/dist/esm/index.js.map +1 -1
  339. package/node_modules/foreground-child/package.json +1 -1
  340. package/node_modules/juice/package.json +3 -3
  341. package/node_modules/uglify-js/bin/uglifyjs +6 -3
  342. package/node_modules/uglify-js/lib/compress.js +117 -75
  343. package/node_modules/uglify-js/lib/minify.js +4 -3
  344. package/node_modules/uglify-js/lib/output.js +16 -5
  345. package/node_modules/uglify-js/package.json +1 -1
  346. package/node_modules/uglify-js/tools/node.js +6 -1
  347. package/package.json +18 -18
  348. package/node_modules/undici-types/handlers.d.ts +0 -9
  349. package/node_modules/undici-types/interceptors.d.ts +0 -5
  350. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/README.md +0 -0
  351. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/agent.d.ts +0 -0
  352. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/api.d.ts +0 -0
  353. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/cache.d.ts +0 -0
  354. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/connector.d.ts +0 -0
  355. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/content-type.d.ts +0 -0
  356. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/cookies.d.ts +0 -0
  357. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/file.d.ts +0 -0
  358. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/filereader.d.ts +0 -0
  359. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/global-dispatcher.d.ts +0 -0
  360. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/global-origin.d.ts +0 -0
  361. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/header.d.ts +0 -0
  362. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/mock-agent.d.ts +0 -0
  363. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/mock-client.d.ts +0 -0
  364. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/mock-errors.d.ts +0 -0
  365. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/mock-pool.d.ts +0 -0
  366. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/patch.d.ts +0 -0
  367. /package/node_modules/{undici-types → @types/cacheable-request/node_modules/undici-types}/pool-stats.d.ts +0 -0
@@ -155,6 +155,9 @@ export default isFetchSupported && (async (config) => {
155
155
  withCredentials = withCredentials ? 'include' : 'omit';
156
156
  }
157
157
 
158
+ // Cloudflare Workers throws when credentials are defined
159
+ // see https://github.com/cloudflare/workerd/issues/902
160
+ const isCredentialsSupported = "credentials" in Request.prototype;
158
161
  request = new Request(url, {
159
162
  ...fetchOptions,
160
163
  signal: composedSignal,
@@ -162,7 +165,7 @@ export default isFetchSupported && (async (config) => {
162
165
  headers: headers.normalize().toJSON(),
163
166
  body: data,
164
167
  duplex: "half",
165
- credentials: withCredentials
168
+ credentials: isCredentialsSupported ? withCredentials : undefined
166
169
  });
167
170
 
168
171
  let response = await fetch(request);
@@ -229,7 +229,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
229
229
 
230
230
  // Parse url
231
231
  const fullPath = buildFullPath(config.baseURL, config.url);
232
- const parsed = new URL(fullPath, utils.hasBrowserEnv ? platform.origin : undefined);
232
+ const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
233
233
  const protocol = parsed.protocol || supportedProtocols[0];
234
234
 
235
235
  if (protocol === 'data:') {
@@ -27,7 +27,10 @@ function AxiosError(message, code, config, request, response) {
27
27
  code && (this.code = code);
28
28
  config && (this.config = config);
29
29
  request && (this.request = request);
30
- response && (this.response = response);
30
+ if (response) {
31
+ this.response = response;
32
+ this.status = response.status ? response.status : null;
33
+ }
31
34
  }
32
35
 
33
36
  utils.inherits(AxiosError, Error, {
@@ -47,7 +50,7 @@ utils.inherits(AxiosError, Error, {
47
50
  // Axios
48
51
  config: utils.toJSONObject(this.config),
49
52
  code: this.code,
50
- status: this.response && this.response.status ? this.response.status : null
53
+ status: this.status
51
54
  };
52
55
  }
53
56
  });
@@ -1 +1 @@
1
- export const VERSION = "1.7.4";
1
+ export const VERSION = "1.7.5";
@@ -8,7 +8,7 @@ export default platform.hasStandardBrowserEnv ?
8
8
  // Standard browser envs have full support of the APIs needed to test
9
9
  // whether the request URL is of the same origin as current location.
10
10
  (function standardBrowserEnv() {
11
- const msie = /(msie|trident)/i.test(navigator.userAgent);
11
+ const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
12
12
  const urlParsingNode = document.createElement('a');
13
13
  let originURL;
14
14
 
@@ -1,5 +1,7 @@
1
1
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
2
2
 
3
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
4
+
3
5
  /**
4
6
  * Determine if we're running in a standard browser environment
5
7
  *
@@ -17,10 +19,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
17
19
  *
18
20
  * @returns {boolean}
19
21
  */
20
- const hasStandardBrowserEnv = (
21
- (product) => {
22
- return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
23
- })(typeof navigator !== 'undefined' && navigator.product);
22
+ const hasStandardBrowserEnv = hasBrowserEnv &&
23
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
24
24
 
25
25
  /**
26
26
  * Determine if we're running in a standard browser webWorker environment
@@ -46,5 +46,6 @@ export {
46
46
  hasBrowserEnv,
47
47
  hasStandardBrowserWebWorkerEnv,
48
48
  hasStandardBrowserEnv,
49
+ _navigator as navigator,
49
50
  origin
50
51
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axios",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
4
4
  "description": "Promise based HTTP client for the browser and node.js",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- import { ChildProcessByStdio, SpawnOptions } from 'child_process';
3
+ import { ChildProcessByStdio, SpawnOptions, ChildProcess } from 'child_process';
4
4
  /**
5
5
  * The signature for the cleanup method.
6
6
  *
@@ -21,7 +21,9 @@ import { ChildProcessByStdio, SpawnOptions } from 'child_process';
21
21
  * If a signal string is returned, then the parent process is killed with
22
22
  * the same signal that caused the child to exit.
23
23
  */
24
- export type Cleanup = (code: number | null, signal: null | NodeJS.Signals) => void | undefined | number | NodeJS.Signals | false | Promise<void | undefined | number | NodeJS.Signals | false>;
24
+ export type Cleanup = (code: number | null, signal: null | NodeJS.Signals, processInfo: {
25
+ watchdogPid?: ChildProcess['pid'];
26
+ }) => void | undefined | number | NodeJS.Signals | false | Promise<void | undefined | number | NodeJS.Signals | false>;
25
27
  export type FgArgs = [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup] | [
26
28
  program: [cmd: string, ...args: string[]],
27
29
  opts?: SpawnOptions,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,mBAAmB,EAInB,YAAY,EACb,MAAM,eAAe,CAAA;AAUtB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC,OAAO,KAE3B,IAAI,GACJ,SAAS,GACT,MAAM,GACN,MAAM,CAAC,OAAO,GACd,KAAK,GACL,OAAO,CAAC,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,CAAA;AAE/D,MAAM,MAAM,MAAM,GACd,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,GA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B,OAAO,CAAC,EAAE,OAAO,GAChB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"}
@@ -63,7 +63,7 @@ function foregroundChild(...fgArgs) {
63
63
  };
64
64
  const removeOnExit = (0, signal_exit_1.onExit)(childHangup);
65
65
  (0, proxy_signals_js_1.proxySignals)(child);
66
- (0, watchdog_js_1.watchdog)(child);
66
+ const dog = (0, watchdog_js_1.watchdog)(child);
67
67
  let done = false;
68
68
  child.on('close', async (code, signal) => {
69
69
  /* c8 ignore start */
@@ -71,7 +71,9 @@ function foregroundChild(...fgArgs) {
71
71
  return;
72
72
  /* c8 ignore stop */
73
73
  done = true;
74
- const result = cleanup(code, signal);
74
+ const result = cleanup(code, signal, {
75
+ watchdogPid: dog.pid,
76
+ });
75
77
  const res = isPromise(result) ? await result : result;
76
78
  removeOnExit();
77
79
  if (res === false)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iDAMsB;AACtB,8DAAoC;AACpC,6CAAoC;AACpC,yDAAiD;AACjD,+CAAwC;AAExC,qBAAqB;AACrB,MAAM,KAAK,GAAG,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,qBAAU,CAAC,CAAC,CAAC,qBAAS,CAAA;AAmDpE;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,CAC7B,MAAc,EAMd,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC,GAAG,MAAM,CAAA;IACrE,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,OAAO,GAAG,IAAI,CAAA;QACd,SAAS,GAAG,EAAE,CAAA;QACd,IAAI,GAAG,EAAE,CAAA;IACX,CAAC;SAAM,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,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AA;gBACjC,qBAAqB;YACvB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;YACtC,CAAC;YACD,oBAAoB;QACtB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAA;QACzB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAA;QAErC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC1C,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC5C,KAAK,CAAC,IAAI,CACR,OAAuB,EACvB,UAAoC,CACrC,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAvFD,0CAuFC;AAED,MAAM,SAAS,GAAG,CAAC,CAAM,EAAqB,EAAE,CAC9C,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAA","sourcesContent":["import {\n ChildProcessByStdio,\n SendHandle,\n Serializable,\n spawn as nodeSpawn,\n SpawnOptions,\n} from 'child_process'\nimport crossSpawn from 'cross-spawn'\nimport { onExit } from 'signal-exit'\nimport { proxySignals } from './proxy-signals.js'\nimport { watchdog } from './watchdog.js'\n\n/* c8 ignore start */\nconst spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn\n/* c8 ignore stop */\n\n/**\n * The signature for the cleanup method.\n *\n * Arguments indicate the exit status of the child process.\n *\n * If a Promise is returned, then the process is not terminated\n * until it resolves, and the resolution value is treated as the\n * exit status (if a number) or signal exit (if a signal string).\n *\n * If `undefined` is returned, then no change is made, and the parent\n * exits in the same way that the child exited.\n *\n * If boolean `false` is returned, then the parent's exit is canceled.\n *\n * If a number is returned, then the parent process exits with the number\n * as its exitCode.\n *\n * If a signal string is returned, then the parent process is killed with\n * the same signal that caused the child to exit.\n */\nexport type Cleanup = (\n code: number | null,\n signal: null | NodeJS.Signals,\n) =>\n | void\n | undefined\n | number\n | NodeJS.Signals\n | false\n | Promise<void | undefined | number | NodeJS.Signals | false>\n\nexport type FgArgs =\n | [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup]\n | [\n program: [cmd: string, ...args: string[]],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n | [program: string, cleanup?: Cleanup]\n | [program: string, opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, args?: string[], cleanup?: Cleanup]\n | [\n program: string,\n args?: string[],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n\n/**\n * Normalizes the arguments passed to `foregroundChild`.\n *\n * Exposed for testing.\n *\n * @internal\n */\nexport const normalizeFgArgs = (\n fgArgs: FgArgs,\n): [\n program: string,\n args: string[],\n spawnOpts: SpawnOptions,\n cleanup: Cleanup,\n] => {\n let [program, args = [], spawnOpts = {}, cleanup = () => {}] = fgArgs\n if (typeof args === 'function') {\n cleanup = args\n spawnOpts = {}\n args = []\n } else if (!!args && typeof args === 'object' && !Array.isArray(args)) {\n if (typeof spawnOpts === 'function') cleanup = spawnOpts\n spawnOpts = args\n args = []\n } else if (typeof spawnOpts === 'function') {\n cleanup = spawnOpts\n spawnOpts = {}\n }\n if (Array.isArray(program)) {\n const [pp, ...pa] = program\n program = pp\n args = pa\n }\n return [program, args, { ...spawnOpts }, cleanup]\n}\n\n/**\n * Spawn the specified program as a \"foreground\" process, or at least as\n * close as is possible given node's lack of exec-without-fork.\n *\n * Cleanup method may be used to modify or ignore the result of the child's\n * exit code or signal. If cleanup returns undefined (or a Promise that\n * resolves to undefined), then the parent will exit in the same way that\n * the child did.\n *\n * Return boolean `false` to prevent the parent's exit entirely.\n */\nexport function foregroundChild(\n cmd: string | [cmd: string, ...args: string[]],\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n args?: string[],\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n args?: string[],\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n ...fgArgs: FgArgs\n): ChildProcessByStdio<null, null, null> {\n const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs)\n\n spawnOpts.stdio = [0, 1, 2]\n if (process.send) {\n spawnOpts.stdio.push('ipc')\n }\n\n const child = spawn(program, args, spawnOpts) as ChildProcessByStdio<\n null,\n null,\n null\n >\n\n const childHangup = () => {\n try {\n child.kill('SIGHUP')\n\n /* c8 ignore start */\n } catch (_) {\n // SIGHUP is weird on windows\n child.kill('SIGTERM')\n }\n /* c8 ignore stop */\n }\n const removeOnExit = onExit(childHangup)\n\n proxySignals(child)\n watchdog(child)\n\n let done = false\n child.on('close', async (code, signal) => {\n /* c8 ignore start */\n if (done) return\n /* c8 ignore stop */\n done = true\n const result = cleanup(code, signal)\n const res = isPromise(result) ? await result : result\n removeOnExit()\n\n if (res === false) return\n else if (typeof res === 'string') {\n signal = res\n code = null\n } else if (typeof res === 'number') {\n code = res\n signal = null\n }\n\n if (signal) {\n // If there is nothing else keeping the event loop alive,\n // then there's a race between a graceful exit and getting\n // the signal to this process. Put this timeout here to\n // make sure we're still alive to get the signal, and thus\n // exit with the intended signal code.\n /* istanbul ignore next */\n setTimeout(() => {}, 2000)\n try {\n process.kill(process.pid, signal)\n /* c8 ignore start */\n } catch (_) {\n process.kill(process.pid, 'SIGTERM')\n }\n /* c8 ignore stop */\n } else {\n process.exit(code || 0)\n }\n })\n\n if (process.send) {\n process.removeAllListeners('message')\n\n child.on('message', (message, sendHandle) => {\n process.send?.(message, sendHandle)\n })\n\n process.on('message', (message, sendHandle) => {\n child.send(\n message as Serializable,\n sendHandle as SendHandle | undefined,\n )\n })\n }\n\n return child\n}\n\nconst isPromise = (o: any): o is Promise<any> =>\n !!o && typeof o === 'object' && typeof o.then === 'function'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iDAOsB;AACtB,8DAAoC;AACpC,6CAAoC;AACpC,yDAAiD;AACjD,+CAAwC;AAExC,qBAAqB;AACrB,MAAM,KAAK,GAAG,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,qBAAU,CAAC,CAAC,CAAC,qBAAS,CAAA;AAsDpE;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,CAC7B,MAAc,EAMd,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC,GAAG,MAAM,CAAA;IACrE,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,OAAO,GAAG,IAAI,CAAA;QACd,SAAS,GAAG,EAAE,CAAA;QACd,IAAI,GAAG,EAAE,CAAA;IACX,CAAC;SAAM,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACtE,IAAI,OAAO,SAAS,KAAK,UAAU;YAAE,OAAO,GAAG,SAAS,CAAA;QACxD,SAAS,GAAG,IAAI,CAAA;QAChB,IAAI,GAAG,EAAE,CAAA;IACX,CAAC;SAAM,IAAI,OAAO,SAAS,KAAK,U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,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAA;QACzB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAA;QAErC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC1C,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC5C,KAAK,CAAC,IAAI,CACR,OAAuB,EACvB,UAAoC,CACrC,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAzFD,0CAyFC;AAED,MAAM,SAAS,GAAG,CAAC,CAAM,EAAqB,EAAE,CAC9C,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAA","sourcesContent":["import {\n ChildProcessByStdio,\n SendHandle,\n Serializable,\n spawn as nodeSpawn,\n SpawnOptions,\n ChildProcess,\n} from 'child_process'\nimport crossSpawn from 'cross-spawn'\nimport { onExit } from 'signal-exit'\nimport { proxySignals } from './proxy-signals.js'\nimport { watchdog } from './watchdog.js'\n\n/* c8 ignore start */\nconst spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn\n/* c8 ignore stop */\n\n/**\n * The signature for the cleanup method.\n *\n * Arguments indicate the exit status of the child process.\n *\n * If a Promise is returned, then the process is not terminated\n * until it resolves, and the resolution value is treated as the\n * exit status (if a number) or signal exit (if a signal string).\n *\n * If `undefined` is returned, then no change is made, and the parent\n * exits in the same way that the child exited.\n *\n * If boolean `false` is returned, then the parent's exit is canceled.\n *\n * If a number is returned, then the parent process exits with the number\n * as its exitCode.\n *\n * If a signal string is returned, then the parent process is killed with\n * the same signal that caused the child to exit.\n */\nexport type Cleanup = (\n code: number | null,\n signal: null | NodeJS.Signals,\n processInfo: {\n watchdogPid?: ChildProcess['pid']\n },\n) =>\n | void\n | undefined\n | number\n | NodeJS.Signals\n | false\n | Promise<void | undefined | number | NodeJS.Signals | false>\n\nexport type FgArgs =\n | [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup]\n | [\n program: [cmd: string, ...args: string[]],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n | [program: string, cleanup?: Cleanup]\n | [program: string, opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, args?: string[], cleanup?: Cleanup]\n | [\n program: string,\n args?: string[],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n\n/**\n * Normalizes the arguments passed to `foregroundChild`.\n *\n * Exposed for testing.\n *\n * @internal\n */\nexport const normalizeFgArgs = (\n fgArgs: FgArgs,\n): [\n program: string,\n args: string[],\n spawnOpts: SpawnOptions,\n cleanup: Cleanup,\n] => {\n let [program, args = [], spawnOpts = {}, cleanup = () => {}] = fgArgs\n if (typeof args === 'function') {\n cleanup = args\n spawnOpts = {}\n args = []\n } else if (!!args && typeof args === 'object' && !Array.isArray(args)) {\n if (typeof spawnOpts === 'function') cleanup = spawnOpts\n spawnOpts = args\n args = []\n } else if (typeof spawnOpts === 'function') {\n cleanup = spawnOpts\n spawnOpts = {}\n }\n if (Array.isArray(program)) {\n const [pp, ...pa] = program\n program = pp\n args = pa\n }\n return [program, args, { ...spawnOpts }, cleanup]\n}\n\n/**\n * Spawn the specified program as a \"foreground\" process, or at least as\n * close as is possible given node's lack of exec-without-fork.\n *\n * Cleanup method may be used to modify or ignore the result of the child's\n * exit code or signal. If cleanup returns undefined (or a Promise that\n * resolves to undefined), then the parent will exit in the same way that\n * the child did.\n *\n * Return boolean `false` to prevent the parent's exit entirely.\n */\nexport function foregroundChild(\n cmd: string | [cmd: string, ...args: string[]],\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n args?: string[],\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n args?: string[],\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n ...fgArgs: FgArgs\n): ChildProcessByStdio<null, null, null> {\n const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs)\n\n spawnOpts.stdio = [0, 1, 2]\n if (process.send) {\n spawnOpts.stdio.push('ipc')\n }\n\n const child = spawn(program, args, spawnOpts) as ChildProcessByStdio<\n null,\n null,\n null\n >\n\n const childHangup = () => {\n try {\n child.kill('SIGHUP')\n\n /* c8 ignore start */\n } catch (_) {\n // SIGHUP is weird on windows\n child.kill('SIGTERM')\n }\n /* c8 ignore stop */\n }\n const removeOnExit = onExit(childHangup)\n\n proxySignals(child)\n const dog = watchdog(child)\n\n let done = false\n child.on('close', async (code, signal) => {\n /* c8 ignore start */\n if (done) return\n /* c8 ignore stop */\n done = true\n const result = cleanup(code, signal, {\n watchdogPid: dog.pid,\n })\n const res = isPromise(result) ? await result : result\n removeOnExit()\n\n if (res === false) return\n else if (typeof res === 'string') {\n signal = res\n code = null\n } else if (typeof res === 'number') {\n code = res\n signal = null\n }\n\n if (signal) {\n // If there is nothing else keeping the event loop alive,\n // then there's a race between a graceful exit and getting\n // the signal to this process. Put this timeout here to\n // make sure we're still alive to get the signal, and thus\n // exit with the intended signal code.\n /* istanbul ignore next */\n setTimeout(() => {}, 2000)\n try {\n process.kill(process.pid, signal)\n /* c8 ignore start */\n } catch (_) {\n process.kill(process.pid, 'SIGTERM')\n }\n /* c8 ignore stop */\n } else {\n process.exit(code || 0)\n }\n })\n\n if (process.send) {\n process.removeAllListeners('message')\n\n child.on('message', (message, sendHandle) => {\n process.send?.(message, sendHandle)\n })\n\n process.on('message', (message, sendHandle) => {\n child.send(\n message as Serializable,\n sendHandle as SendHandle | undefined,\n )\n })\n }\n\n return child\n}\n\nconst isPromise = (o: any): o is Promise<any> =>\n !!o && typeof o === 'object' && typeof o.then === 'function'\n"]}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
  /// <reference types="node" resolution-mode="require"/>
3
- import { ChildProcessByStdio, SpawnOptions } from 'child_process';
3
+ import { ChildProcessByStdio, SpawnOptions, ChildProcess } from 'child_process';
4
4
  /**
5
5
  * The signature for the cleanup method.
6
6
  *
@@ -21,7 +21,9 @@ import { ChildProcessByStdio, SpawnOptions } from 'child_process';
21
21
  * If a signal string is returned, then the parent process is killed with
22
22
  * the same signal that caused the child to exit.
23
23
  */
24
- export type Cleanup = (code: number | null, signal: null | NodeJS.Signals) => void | undefined | number | NodeJS.Signals | false | Promise<void | undefined | number | NodeJS.Signals | false>;
24
+ export type Cleanup = (code: number | null, signal: null | NodeJS.Signals, processInfo: {
25
+ watchdogPid?: ChildProcess['pid'];
26
+ }) => void | undefined | number | NodeJS.Signals | false | Promise<void | undefined | number | NodeJS.Signals | false>;
25
27
  export type FgArgs = [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup] | [
26
28
  program: [cmd: string, ...args: string[]],
27
29
  opts?: SpawnOptions,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,OAAO,EACL,mBAAmB,EAInB,YAAY,EACb,MAAM,eAAe,CAAA;AAUtB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC,OAAO,KAE3B,IAAI,GACJ,SAAS,GACT,MAAM,GACN,MAAM,CAA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,OAAO,GAChB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACxC,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,SAAS,CAAC,EAAE,YAAY,EACxB,OAAO,CAAC,EAAE,OAAO,GAChB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA"}
@@ -56,7 +56,7 @@ export function foregroundChild(...fgArgs) {
56
56
  };
57
57
  const removeOnExit = onExit(childHangup);
58
58
  proxySignals(child);
59
- watchdog(child);
59
+ const dog = watchdog(child);
60
60
  let done = false;
61
61
  child.on('close', async (code, signal) => {
62
62
  /* c8 ignore start */
@@ -64,7 +64,9 @@ export function foregroundChild(...fgArgs) {
64
64
  return;
65
65
  /* c8 ignore stop */
66
66
  done = true;
67
- const result = cleanup(code, signal);
67
+ const result = cleanup(code, signal, {
68
+ watchdogPid: dog.pid,
69
+ });
68
70
  const res = isPromise(result) ? await result : result;
69
71
  removeOnExit();
70
72
  if (res === false)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,SAAS,GAEnB,MAAM,eAAe,CAAA;AACtB,OAAO,UAAU,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,qBAAqB;AACrB,MAAM,KAAK,GAAG,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAA;AAmDpE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,MAAc,EAMd,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,IAAI,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'\nimport crossSpawn from 'cross-spawn'\nimport { onExit } from 'signal-exit'\nimport { proxySignals } from './proxy-signals.js'\nimport { watchdog } from './watchdog.js'\n\n/* c8 ignore start */\nconst spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn\n/* c8 ignore stop */\n\n/**\n * The signature for the cleanup method.\n *\n * Arguments indicate the exit status of the child process.\n *\n * If a Promise is returned, then the process is not terminated\n * until it resolves, and the resolution value is treated as the\n * exit status (if a number) or signal exit (if a signal string).\n *\n * If `undefined` is returned, then no change is made, and the parent\n * exits in the same way that the child exited.\n *\n * If boolean `false` is returned, then the parent's exit is canceled.\n *\n * If a number is returned, then the parent process exits with the number\n * as its exitCode.\n *\n * If a signal string is returned, then the parent process is killed with\n * the same signal that caused the child to exit.\n */\nexport type Cleanup = (\n code: number | null,\n signal: null | NodeJS.Signals,\n) =>\n | void\n | undefined\n | number\n | NodeJS.Signals\n | false\n | Promise<void | undefined | number | NodeJS.Signals | false>\n\nexport type FgArgs =\n | [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup]\n | [\n program: [cmd: string, ...args: string[]],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n | [program: string, cleanup?: Cleanup]\n | [program: string, opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, args?: string[], cleanup?: Cleanup]\n | [\n program: string,\n args?: string[],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n\n/**\n * Normalizes the arguments passed to `foregroundChild`.\n *\n * Exposed for testing.\n *\n * @internal\n */\nexport const normalizeFgArgs = (\n fgArgs: FgArgs,\n): [\n program: string,\n args: string[],\n spawnOpts: SpawnOptions,\n cleanup: Cleanup,\n] => {\n let [program, args = [], spawnOpts = {}, cleanup = () => {}] = fgArgs\n if (typeof args === 'function') {\n cleanup = args\n spawnOpts = {}\n args = []\n } else if (!!args && typeof args === 'object' && !Array.isArray(args)) {\n if (typeof spawnOpts === 'function') cleanup = spawnOpts\n spawnOpts = args\n args = []\n } else if (typeof spawnOpts === 'function') {\n cleanup = spawnOpts\n spawnOpts = {}\n }\n if (Array.isArray(program)) {\n const [pp, ...pa] = program\n program = pp\n args = pa\n }\n return [program, args, { ...spawnOpts }, cleanup]\n}\n\n/**\n * Spawn the specified program as a \"foreground\" process, or at least as\n * close as is possible given node's lack of exec-without-fork.\n *\n * Cleanup method may be used to modify or ignore the result of the child's\n * exit code or signal. If cleanup returns undefined (or a Promise that\n * resolves to undefined), then the parent will exit in the same way that\n * the child did.\n *\n * Return boolean `false` to prevent the parent's exit entirely.\n */\nexport function foregroundChild(\n cmd: string | [cmd: string, ...args: string[]],\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n args?: string[],\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n args?: string[],\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n ...fgArgs: FgArgs\n): ChildProcessByStdio<null, null, null> {\n const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs)\n\n spawnOpts.stdio = [0, 1, 2]\n if (process.send) {\n spawnOpts.stdio.push('ipc')\n }\n\n const child = spawn(program, args, spawnOpts) as ChildProcessByStdio<\n null,\n null,\n null\n >\n\n const childHangup = () => {\n try {\n child.kill('SIGHUP')\n\n /* c8 ignore start */\n } catch (_) {\n // SIGHUP is weird on windows\n child.kill('SIGTERM')\n }\n /* c8 ignore stop */\n }\n const removeOnExit = onExit(childHangup)\n\n proxySignals(child)\n watchdog(child)\n\n let done = false\n child.on('close', async (code, signal) => {\n /* c8 ignore start */\n if (done) return\n /* c8 ignore stop */\n done = true\n const result = cleanup(code, signal)\n const res = isPromise(result) ? await result : result\n removeOnExit()\n\n if (res === false) return\n else if (typeof res === 'string') {\n signal = res\n code = null\n } else if (typeof res === 'number') {\n code = res\n signal = null\n }\n\n if (signal) {\n // If there is nothing else keeping the event loop alive,\n // then there's a race between a graceful exit and getting\n // the signal to this process. Put this timeout here to\n // make sure we're still alive to get the signal, and thus\n // exit with the intended signal code.\n /* istanbul ignore next */\n setTimeout(() => {}, 2000)\n try {\n process.kill(process.pid, signal)\n /* c8 ignore start */\n } catch (_) {\n process.kill(process.pid, 'SIGTERM')\n }\n /* c8 ignore stop */\n } else {\n process.exit(code || 0)\n }\n })\n\n if (process.send) {\n process.removeAllListeners('message')\n\n child.on('message', (message, sendHandle) => {\n process.send?.(message, sendHandle)\n })\n\n process.on('message', (message, sendHandle) => {\n child.send(\n message as Serializable,\n sendHandle as SendHandle | undefined,\n )\n })\n }\n\n return child\n}\n\nconst isPromise = (o: any): o is Promise<any> =>\n !!o && typeof o === 'object' && typeof o.then === 'function'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,SAAS,GAGnB,MAAM,eAAe,CAAA;AACtB,OAAO,UAAU,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,qBAAqB;AACrB,MAAM,KAAK,GAAG,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAA;AAsDpE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,MAAc,EAMd,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC,GAAG,MAAM,CAAA;IACrE,IAAI,OAAO,IAAI,KAAK,U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sCAAsC;YACtC,0BAA0B;YAC1B,UAAU,CAAC,GAAG,EAAE,GAAE,CAAC,EAAE,IAAI,CAAC,CAAA;YAC1B,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;gBACjC,qBAAqB;YACvB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;YACtC,CAAC;YACD,oBAAoB;QACtB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAA;QACzB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAA;QAErC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC1C,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC5C,KAAK,CAAC,IAAI,CACR,OAAuB,EACvB,UAAoC,CACrC,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,CAAM,EAAqB,EAAE,CAC9C,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAA","sourcesContent":["import {\n ChildProcessByStdio,\n SendHandle,\n Serializable,\n spawn as nodeSpawn,\n SpawnOptions,\n ChildProcess,\n} from 'child_process'\nimport crossSpawn from 'cross-spawn'\nimport { onExit } from 'signal-exit'\nimport { proxySignals } from './proxy-signals.js'\nimport { watchdog } from './watchdog.js'\n\n/* c8 ignore start */\nconst spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn\n/* c8 ignore stop */\n\n/**\n * The signature for the cleanup method.\n *\n * Arguments indicate the exit status of the child process.\n *\n * If a Promise is returned, then the process is not terminated\n * until it resolves, and the resolution value is treated as the\n * exit status (if a number) or signal exit (if a signal string).\n *\n * If `undefined` is returned, then no change is made, and the parent\n * exits in the same way that the child exited.\n *\n * If boolean `false` is returned, then the parent's exit is canceled.\n *\n * If a number is returned, then the parent process exits with the number\n * as its exitCode.\n *\n * If a signal string is returned, then the parent process is killed with\n * the same signal that caused the child to exit.\n */\nexport type Cleanup = (\n code: number | null,\n signal: null | NodeJS.Signals,\n processInfo: {\n watchdogPid?: ChildProcess['pid']\n },\n) =>\n | void\n | undefined\n | number\n | NodeJS.Signals\n | false\n | Promise<void | undefined | number | NodeJS.Signals | false>\n\nexport type FgArgs =\n | [program: string | [cmd: string, ...args: string[]], cleanup?: Cleanup]\n | [\n program: [cmd: string, ...args: string[]],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n | [program: string, cleanup?: Cleanup]\n | [program: string, opts?: SpawnOptions, cleanup?: Cleanup]\n | [program: string, args?: string[], cleanup?: Cleanup]\n | [\n program: string,\n args?: string[],\n opts?: SpawnOptions,\n cleanup?: Cleanup,\n ]\n\n/**\n * Normalizes the arguments passed to `foregroundChild`.\n *\n * Exposed for testing.\n *\n * @internal\n */\nexport const normalizeFgArgs = (\n fgArgs: FgArgs,\n): [\n program: string,\n args: string[],\n spawnOpts: SpawnOptions,\n cleanup: Cleanup,\n] => {\n let [program, args = [], spawnOpts = {}, cleanup = () => {}] = fgArgs\n if (typeof args === 'function') {\n cleanup = args\n spawnOpts = {}\n args = []\n } else if (!!args && typeof args === 'object' && !Array.isArray(args)) {\n if (typeof spawnOpts === 'function') cleanup = spawnOpts\n spawnOpts = args\n args = []\n } else if (typeof spawnOpts === 'function') {\n cleanup = spawnOpts\n spawnOpts = {}\n }\n if (Array.isArray(program)) {\n const [pp, ...pa] = program\n program = pp\n args = pa\n }\n return [program, args, { ...spawnOpts }, cleanup]\n}\n\n/**\n * Spawn the specified program as a \"foreground\" process, or at least as\n * close as is possible given node's lack of exec-without-fork.\n *\n * Cleanup method may be used to modify or ignore the result of the child's\n * exit code or signal. If cleanup returns undefined (or a Promise that\n * resolves to undefined), then the parent will exit in the same way that\n * the child did.\n *\n * Return boolean `false` to prevent the parent's exit entirely.\n */\nexport function foregroundChild(\n cmd: string | [cmd: string, ...args: string[]],\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n args?: string[],\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n program: string,\n args?: string[],\n spawnOpts?: SpawnOptions,\n cleanup?: Cleanup,\n): ChildProcessByStdio<null, null, null>\nexport function foregroundChild(\n ...fgArgs: FgArgs\n): ChildProcessByStdio<null, null, null> {\n const [program, args, spawnOpts, cleanup] = normalizeFgArgs(fgArgs)\n\n spawnOpts.stdio = [0, 1, 2]\n if (process.send) {\n spawnOpts.stdio.push('ipc')\n }\n\n const child = spawn(program, args, spawnOpts) as ChildProcessByStdio<\n null,\n null,\n null\n >\n\n const childHangup = () => {\n try {\n child.kill('SIGHUP')\n\n /* c8 ignore start */\n } catch (_) {\n // SIGHUP is weird on windows\n child.kill('SIGTERM')\n }\n /* c8 ignore stop */\n }\n const removeOnExit = onExit(childHangup)\n\n proxySignals(child)\n const dog = watchdog(child)\n\n let done = false\n child.on('close', async (code, signal) => {\n /* c8 ignore start */\n if (done) return\n /* c8 ignore stop */\n done = true\n const result = cleanup(code, signal, {\n watchdogPid: dog.pid,\n })\n const res = isPromise(result) ? await result : result\n removeOnExit()\n\n if (res === false) return\n else if (typeof res === 'string') {\n signal = res\n code = null\n } else if (typeof res === 'number') {\n code = res\n signal = null\n }\n\n if (signal) {\n // If there is nothing else keeping the event loop alive,\n // then there's a race between a graceful exit and getting\n // the signal to this process. Put this timeout here to\n // make sure we're still alive to get the signal, and thus\n // exit with the intended signal code.\n /* istanbul ignore next */\n setTimeout(() => {}, 2000)\n try {\n process.kill(process.pid, signal)\n /* c8 ignore start */\n } catch (_) {\n process.kill(process.pid, 'SIGTERM')\n }\n /* c8 ignore stop */\n } else {\n process.exit(code || 0)\n }\n })\n\n if (process.send) {\n process.removeAllListeners('message')\n\n child.on('message', (message, sendHandle) => {\n process.send?.(message, sendHandle)\n })\n\n process.on('message', (message, sendHandle) => {\n child.send(\n message as Serializable,\n sendHandle as SendHandle | undefined,\n )\n })\n }\n\n return child\n}\n\nconst isPromise = (o: any): o is Promise<any> =>\n !!o && typeof o === 'object' && typeof o.then === 'function'\n"]}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreground-child",
3
- "version": "3.2.1",
3
+ "version": "3.3.0",
4
4
  "description": "Run a child as if it's the foreground process. Give it stdio. Exit when it exits.",
5
5
  "main": "./dist/commonjs/index.js",
6
6
  "types": "./dist/commonjs/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juice",
3
- "version": "10.0.0",
3
+ "version": "10.0.1",
4
4
  "description": "Inlines css into html source",
5
5
  "bin": "bin/juice",
6
6
  "main": "index.js",
@@ -35,14 +35,14 @@
35
35
  "node": ">=10.0.0"
36
36
  },
37
37
  "dependencies": {
38
- "cheerio": "^1.0.0-rc.12",
38
+ "cheerio": "1.0.0-rc.12",
39
39
  "commander": "^6.1.0",
40
40
  "mensch": "^0.3.4",
41
41
  "slick": "^1.12.2",
42
42
  "web-resource-inliner": "^6.0.1"
43
43
  },
44
44
  "devDependencies": {
45
- "@types/node": "^18.15.3",
45
+ "@types/node": "^22.2.0",
46
46
  "batch": "0.6.1",
47
47
  "browserify": "^17.0.0",
48
48
  "cross-spawn": "^7.0.3",
@@ -467,11 +467,14 @@ function run() {
467
467
  } else if (output) {
468
468
  var code;
469
469
  if (result.ast) {
470
- var opts = {};
470
+ var output_options = {};
471
+ for (var name in UglifyJS.default_options("output")) {
472
+ if (name in options) output_options[name] = options[name];
473
+ }
471
474
  for (var name in options.output) {
472
- if (!/^ast|code$/.test(name)) opts[name] = options.output[name];
475
+ if (!/^ast|code$/.test(name)) output_options[name] = options.output[name];
473
476
  }
474
- code = UglifyJS.AST_Node.from_mozilla_ast(result.ast.to_mozilla_ast()).print_to_string(opts);
477
+ code = UglifyJS.AST_Node.from_mozilla_ast(result.ast.to_mozilla_ast()).print_to_string(output_options);
475
478
  } else {
476
479
  code = result.code;
477
480
  }