@psnext/slingcli 2.4.20260520-3 → 2.4.20260520-4

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 (1292) hide show
  1. package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +5 -5
  2. package/node_modules/@aws-sdk/token-providers/package.json +3 -3
  3. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +23 -0
  4. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +1 -1
  5. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +557 -385
  6. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +13 -82
  7. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +61 -144
  8. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js +14 -36
  9. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +234 -96
  10. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +85 -55
  11. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +101 -0
  12. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +231 -0
  13. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +42 -0
  14. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +114 -0
  15. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +39 -0
  16. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +3 -2
  17. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js +50 -0
  18. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +125 -73
  19. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +86 -8
  20. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +85 -56
  21. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +103 -18
  22. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +4 -4
  23. package/node_modules/@earendil-works/pi-agent-core/dist/node.js +3 -0
  24. package/node_modules/@earendil-works/pi-agent-core/package.json +23 -10
  25. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +11 -3
  26. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +117 -353
  27. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +35 -32
  28. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +5 -2
  29. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +19 -2
  30. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +35 -4
  31. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +24 -10
  32. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js +10 -0
  33. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +19 -2
  34. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js +13 -2
  35. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js +6 -4
  36. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +2 -2
  37. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js +97 -0
  38. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js +1 -1
  39. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +3 -1
  40. package/node_modules/@earendil-works/pi-ai/package.json +15 -20
  41. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/config-selector.js +1 -1
  42. package/node_modules/@earendil-works/pi-coding-agent/dist/cli.js +4 -6
  43. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +45 -22
  44. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js +4 -5
  45. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +127 -151
  46. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +1 -1
  47. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.js +1 -1
  48. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.js +25 -15
  49. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/template.js +17 -3
  50. package/node_modules/@earendil-works/pi-coding-agent/dist/core/http-dispatcher.js +48 -0
  51. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.js +2 -2
  52. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +71 -33
  53. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.js +6 -4
  54. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +1 -1
  55. package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js +39 -9
  56. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js +20 -0
  57. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js +2 -5
  58. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js +7 -4
  59. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +1 -0
  60. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.js +1 -1
  61. package/node_modules/@earendil-works/pi-coding-agent/dist/index.js +1 -0
  62. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +7 -11
  63. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.js +1 -1
  64. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/config-selector.js +7 -4
  65. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/countdown-timer.js +2 -2
  66. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-editor.js +14 -6
  67. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-selector.js +6 -1
  68. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/footer.js +2 -2
  69. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +2 -2
  70. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +15 -0
  71. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +99 -17
  72. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/dark.json +5 -4
  73. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/light.json +5 -4
  74. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +83 -41
  75. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.js +1 -1
  76. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js +62 -7
  77. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.js +52 -0
  78. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/child-process.js +9 -7
  79. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/html.js +40 -0
  80. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/mime.js +59 -16
  81. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/paths.js +16 -0
  82. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/shell.js +6 -1
  83. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/syntax-highlight.js +118 -0
  84. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/tools-manager.js +80 -8
  85. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/version-check.js +9 -4
  86. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/windows-self-update.js +77 -0
  87. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/LICENSE +21 -0
  88. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Agent.md +84 -0
  89. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
  90. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
  91. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/CacheStore.md +164 -0
  92. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Client.md +287 -0
  93. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/ClientStats.md +27 -0
  94. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Connector.md +115 -0
  95. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/ContentType.md +57 -0
  96. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Cookies.md +101 -0
  97. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Debug.md +62 -0
  98. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +315 -0
  99. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Dispatcher.md +1427 -0
  100. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +159 -0
  101. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Errors.md +49 -0
  102. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/EventSource.md +45 -0
  103. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Fetch.md +60 -0
  104. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/GlobalInstallation.md +141 -0
  105. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/H2CClient.md +263 -0
  106. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/MockAgent.md +603 -0
  107. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/MockCallHistory.md +197 -0
  108. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +43 -0
  109. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/MockClient.md +81 -0
  110. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
  111. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/MockPool.md +555 -0
  112. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Pool.md +84 -0
  113. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
  114. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/ProxyAgent.md +229 -0
  115. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/RedirectHandler.md +98 -0
  116. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/RetryAgent.md +49 -0
  117. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/RetryHandler.md +116 -0
  118. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/RoundRobinPool.md +145 -0
  119. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/SnapshotAgent.md +639 -0
  120. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +274 -0
  121. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Util.md +25 -0
  122. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/WebSocket.md +141 -0
  123. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
  124. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
  125. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/best-practices/crawling.md +58 -0
  126. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +231 -0
  127. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/best-practices/mocking-request.md +190 -0
  128. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
  129. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +224 -0
  130. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/best-practices/writing-tests.md +63 -0
  131. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/index-fetch.js +65 -0
  132. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/index.js +236 -0
  133. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/abort-signal.js +59 -0
  134. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/api-connect.js +112 -0
  135. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/api-pipeline.js +265 -0
  136. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/api-request.js +238 -0
  137. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/api-stream.js +270 -0
  138. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/api-upgrade.js +121 -0
  139. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/index.js +7 -0
  140. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/readable.js +581 -0
  141. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/cache/memory-cache-store.js +234 -0
  142. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/cache/sqlite-cache-store.js +463 -0
  143. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/connect.js +153 -0
  144. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/constants.js +120 -0
  145. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/diagnostics.js +227 -0
  146. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/errors.js +477 -0
  147. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/request.js +535 -0
  148. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/socks5-client.js +422 -0
  149. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/socks5-utils.js +212 -0
  150. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/symbols.js +76 -0
  151. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/tree.js +160 -0
  152. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/util.js +1019 -0
  153. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/agent.js +172 -0
  154. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/balanced-pool.js +214 -0
  155. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client-h1.js +1669 -0
  156. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client-h2.js +1326 -0
  157. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client.js +666 -0
  158. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/dispatcher-base.js +184 -0
  159. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/dispatcher.js +44 -0
  160. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +107 -0
  161. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +146 -0
  162. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
  163. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/h2c-client.js +51 -0
  164. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/pool-base.js +232 -0
  165. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/pool.js +143 -0
  166. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/proxy-agent.js +343 -0
  167. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
  168. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/round-robin-pool.js +159 -0
  169. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +264 -0
  170. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/encoding/index.js +33 -0
  171. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/global.js +62 -0
  172. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/cache-handler.js +586 -0
  173. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/cache-revalidation-handler.js +124 -0
  174. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/decorator-handler.js +66 -0
  175. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/deduplication-handler.js +460 -0
  176. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/redirect-handler.js +192 -0
  177. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/retry-handler.js +407 -0
  178. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/cache.js +508 -0
  179. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/decompress.js +285 -0
  180. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/deduplicate.js +117 -0
  181. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/dns.js +571 -0
  182. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/dump.js +112 -0
  183. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/redirect.js +21 -0
  184. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/response-error.js +95 -0
  185. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/retry.js +19 -0
  186. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/llhttp/constants.js +531 -0
  187. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
  188. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
  189. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/llhttp/utils.js +12 -0
  190. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-agent.js +232 -0
  191. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-call-history.js +248 -0
  192. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-client.js +68 -0
  193. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-errors.js +29 -0
  194. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
  195. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-pool.js +68 -0
  196. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-symbols.js +32 -0
  197. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-utils.js +501 -0
  198. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
  199. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/snapshot-agent.js +363 -0
  200. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/snapshot-recorder.js +623 -0
  201. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/snapshot-utils.js +158 -0
  202. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/util/cache.js +408 -0
  203. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/util/date.js +653 -0
  204. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/util/runtime-features.js +93 -0
  205. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/util/stats.js +32 -0
  206. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/util/timers.js +425 -0
  207. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cache/cache.js +862 -0
  208. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
  209. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cache/util.js +45 -0
  210. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cookies/constants.js +12 -0
  211. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cookies/index.js +199 -0
  212. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cookies/parse.js +322 -0
  213. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cookies/util.js +282 -0
  214. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/eventsource/eventsource-stream.js +494 -0
  215. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/eventsource/eventsource.js +501 -0
  216. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/eventsource/util.js +29 -0
  217. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/LICENSE +21 -0
  218. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/body.js +503 -0
  219. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/constants.js +131 -0
  220. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/data-url.js +596 -0
  221. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/formdata-parser.js +586 -0
  222. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/formdata.js +278 -0
  223. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/global.js +40 -0
  224. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/headers.js +719 -0
  225. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/index.js +2403 -0
  226. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/request.js +1115 -0
  227. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/response.js +641 -0
  228. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/util.js +1522 -0
  229. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/infra/index.js +229 -0
  230. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/subresource-integrity/Readme.md +9 -0
  231. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +307 -0
  232. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/webidl/index.js +1004 -0
  233. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/connection.js +329 -0
  234. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/constants.js +126 -0
  235. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/events.js +331 -0
  236. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/frame.js +127 -0
  237. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/permessage-deflate.js +100 -0
  238. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/receiver.js +490 -0
  239. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/sender.js +109 -0
  240. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/stream/websocketerror.js +104 -0
  241. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/stream/websocketstream.js +491 -0
  242. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/util.js +347 -0
  243. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/websocket.js +756 -0
  244. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/package.json +152 -0
  245. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/scripts/strip-comments.js +10 -0
  246. package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +1803 -0
  247. package/node_modules/@earendil-works/pi-coding-agent/package.json +34 -36
  248. package/node_modules/@earendil-works/pi-tui/dist/components/image.js +27 -14
  249. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +4 -4
  250. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +11 -5
  251. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +22 -0
  252. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +27 -15
  253. package/node_modules/@earendil-works/pi-tui/package.json +9 -12
  254. package/node_modules/cross-spawn/LICENSE +21 -0
  255. package/node_modules/cross-spawn/README.md +89 -0
  256. package/node_modules/cross-spawn/index.js +39 -0
  257. package/node_modules/cross-spawn/lib/enoent.js +59 -0
  258. package/node_modules/cross-spawn/lib/parse.js +91 -0
  259. package/node_modules/cross-spawn/lib/util/escape.js +47 -0
  260. package/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
  261. package/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
  262. package/node_modules/cross-spawn/package.json +73 -0
  263. package/node_modules/isexe/.npmignore +2 -0
  264. package/node_modules/isexe/README.md +51 -0
  265. package/node_modules/isexe/index.js +57 -0
  266. package/node_modules/isexe/mode.js +41 -0
  267. package/node_modules/isexe/package.json +31 -0
  268. package/node_modules/isexe/test/basic.js +221 -0
  269. package/node_modules/isexe/windows.js +42 -0
  270. package/node_modules/path-key/index.d.ts +40 -0
  271. package/node_modules/path-key/index.js +16 -0
  272. package/node_modules/path-key/package.json +39 -0
  273. package/node_modules/path-key/readme.md +61 -0
  274. package/node_modules/shebang-command/index.js +19 -0
  275. package/node_modules/shebang-command/license +9 -0
  276. package/node_modules/shebang-command/package.json +34 -0
  277. package/node_modules/shebang-command/readme.md +34 -0
  278. package/node_modules/shebang-regex/index.d.ts +22 -0
  279. package/node_modules/shebang-regex/index.js +2 -0
  280. package/node_modules/shebang-regex/package.json +35 -0
  281. package/node_modules/shebang-regex/readme.md +33 -0
  282. package/node_modules/which/README.md +54 -0
  283. package/node_modules/which/bin/node-which +52 -0
  284. package/node_modules/which/package.json +43 -0
  285. package/node_modules/which/which.js +125 -0
  286. package/package.json +6 -6
  287. package/slingshot/index.js +259 -255
  288. package/node_modules/@borewit/text-codec/LICENSE.txt +0 -9
  289. package/node_modules/@borewit/text-codec/README.md +0 -87
  290. package/node_modules/@borewit/text-codec/lib/index.d.ts +0 -6
  291. package/node_modules/@borewit/text-codec/lib/index.js +0 -380
  292. package/node_modules/@borewit/text-codec/package.json +0 -70
  293. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.js +0 -3
  294. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.js +0 -92
  295. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.js +0 -42
  296. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.js +0 -31
  297. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.js +0 -170
  298. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.js +0 -90
  299. package/node_modules/@tokenizer/inflate/LICENSE +0 -15
  300. package/node_modules/@tokenizer/inflate/README.md +0 -114
  301. package/node_modules/@tokenizer/inflate/lib/GzipHandler.d.ts +0 -6
  302. package/node_modules/@tokenizer/inflate/lib/GzipHandler.js +0 -19
  303. package/node_modules/@tokenizer/inflate/lib/ZipHandler.d.ts +0 -26
  304. package/node_modules/@tokenizer/inflate/lib/ZipHandler.js +0 -233
  305. package/node_modules/@tokenizer/inflate/lib/ZipToken.d.ts +0 -94
  306. package/node_modules/@tokenizer/inflate/lib/ZipToken.js +0 -117
  307. package/node_modules/@tokenizer/inflate/lib/index.d.ts +0 -3
  308. package/node_modules/@tokenizer/inflate/lib/index.js +0 -2
  309. package/node_modules/@tokenizer/inflate/package.json +0 -76
  310. package/node_modules/@tokenizer/token/README.md +0 -19
  311. package/node_modules/@tokenizer/token/index.d.ts +0 -30
  312. package/node_modules/@tokenizer/token/package.json +0 -33
  313. package/node_modules/@tootallnate/quickjs-emscripten/LICENSE +0 -21
  314. package/node_modules/@tootallnate/quickjs-emscripten/README.md +0 -597
  315. package/node_modules/@tootallnate/quickjs-emscripten/c/interface.c +0 -819
  316. package/node_modules/@tootallnate/quickjs-emscripten/dist/asyncify-helpers.d.ts +0 -24
  317. package/node_modules/@tootallnate/quickjs-emscripten/dist/asyncify-helpers.js +0 -53
  318. package/node_modules/@tootallnate/quickjs-emscripten/dist/asyncify-helpers.js.map +0 -1
  319. package/node_modules/@tootallnate/quickjs-emscripten/dist/context-asyncify.d.ts +0 -48
  320. package/node_modules/@tootallnate/quickjs-emscripten/dist/context-asyncify.js +0 -58
  321. package/node_modules/@tootallnate/quickjs-emscripten/dist/context-asyncify.js.map +0 -1
  322. package/node_modules/@tootallnate/quickjs-emscripten/dist/context.d.ts +0 -371
  323. package/node_modules/@tootallnate/quickjs-emscripten/dist/context.js +0 -691
  324. package/node_modules/@tootallnate/quickjs-emscripten/dist/context.js.map +0 -1
  325. package/node_modules/@tootallnate/quickjs-emscripten/dist/debug.d.ts +0 -5
  326. package/node_modules/@tootallnate/quickjs-emscripten/dist/debug.js +0 -6
  327. package/node_modules/@tootallnate/quickjs-emscripten/dist/debug.js.map +0 -1
  328. package/node_modules/@tootallnate/quickjs-emscripten/dist/deferred-promise.d.ts +0 -75
  329. package/node_modules/@tootallnate/quickjs-emscripten/dist/deferred-promise.js +0 -96
  330. package/node_modules/@tootallnate/quickjs-emscripten/dist/deferred-promise.js.map +0 -1
  331. package/node_modules/@tootallnate/quickjs-emscripten/dist/emscripten-types.d.ts +0 -97
  332. package/node_modules/@tootallnate/quickjs-emscripten/dist/emscripten-types.js +0 -15
  333. package/node_modules/@tootallnate/quickjs-emscripten/dist/emscripten-types.js.map +0 -1
  334. package/node_modules/@tootallnate/quickjs-emscripten/dist/errors.d.ts +0 -28
  335. package/node_modules/@tootallnate/quickjs-emscripten/dist/errors.js +0 -58
  336. package/node_modules/@tootallnate/quickjs-emscripten/dist/errors.js.map +0 -1
  337. package/node_modules/@tootallnate/quickjs-emscripten/dist/esmHelpers.d.ts +0 -9
  338. package/node_modules/@tootallnate/quickjs-emscripten/dist/esmHelpers.js +0 -19
  339. package/node_modules/@tootallnate/quickjs-emscripten/dist/esmHelpers.js.map +0 -1
  340. package/node_modules/@tootallnate/quickjs-emscripten/dist/generated/emscripten-module.WASM_RELEASE_SYNC.d.ts +0 -5
  341. package/node_modules/@tootallnate/quickjs-emscripten/dist/generated/emscripten-module.WASM_RELEASE_SYNC.js +0 -387
  342. package/node_modules/@tootallnate/quickjs-emscripten/dist/generated/emscripten-module.WASM_RELEASE_SYNC.js.map +0 -1
  343. package/node_modules/@tootallnate/quickjs-emscripten/dist/generated/ffi.WASM_RELEASE_SYNC.d.ts +0 -67
  344. package/node_modules/@tootallnate/quickjs-emscripten/dist/generated/ffi.WASM_RELEASE_SYNC.js +0 -71
  345. package/node_modules/@tootallnate/quickjs-emscripten/dist/generated/ffi.WASM_RELEASE_SYNC.js.map +0 -1
  346. package/node_modules/@tootallnate/quickjs-emscripten/dist/index.d.ts +0 -75
  347. package/node_modules/@tootallnate/quickjs-emscripten/dist/index.js +0 -128
  348. package/node_modules/@tootallnate/quickjs-emscripten/dist/index.js.map +0 -1
  349. package/node_modules/@tootallnate/quickjs-emscripten/dist/lifetime.d.ts +0 -115
  350. package/node_modules/@tootallnate/quickjs-emscripten/dist/lifetime.js +0 -227
  351. package/node_modules/@tootallnate/quickjs-emscripten/dist/lifetime.js.map +0 -1
  352. package/node_modules/@tootallnate/quickjs-emscripten/dist/memory.d.ts +0 -18
  353. package/node_modules/@tootallnate/quickjs-emscripten/dist/memory.js +0 -41
  354. package/node_modules/@tootallnate/quickjs-emscripten/dist/memory.js.map +0 -1
  355. package/node_modules/@tootallnate/quickjs-emscripten/dist/module-asyncify.d.ts +0 -53
  356. package/node_modules/@tootallnate/quickjs-emscripten/dist/module-asyncify.js +0 -97
  357. package/node_modules/@tootallnate/quickjs-emscripten/dist/module-asyncify.js.map +0 -1
  358. package/node_modules/@tootallnate/quickjs-emscripten/dist/module-test.d.ts +0 -27
  359. package/node_modules/@tootallnate/quickjs-emscripten/dist/module-test.js +0 -77
  360. package/node_modules/@tootallnate/quickjs-emscripten/dist/module-test.js.map +0 -1
  361. package/node_modules/@tootallnate/quickjs-emscripten/dist/module.d.ts +0 -152
  362. package/node_modules/@tootallnate/quickjs-emscripten/dist/module.js +0 -302
  363. package/node_modules/@tootallnate/quickjs-emscripten/dist/module.js.map +0 -1
  364. package/node_modules/@tootallnate/quickjs-emscripten/dist/runtime-asyncify.d.ts +0 -38
  365. package/node_modules/@tootallnate/quickjs-emscripten/dist/runtime-asyncify.js +0 -49
  366. package/node_modules/@tootallnate/quickjs-emscripten/dist/runtime-asyncify.js.map +0 -1
  367. package/node_modules/@tootallnate/quickjs-emscripten/dist/runtime.d.ts +0 -174
  368. package/node_modules/@tootallnate/quickjs-emscripten/dist/runtime.js +0 -300
  369. package/node_modules/@tootallnate/quickjs-emscripten/dist/runtime.js.map +0 -1
  370. package/node_modules/@tootallnate/quickjs-emscripten/dist/types-ffi.d.ts +0 -114
  371. package/node_modules/@tootallnate/quickjs-emscripten/dist/types-ffi.js +0 -38
  372. package/node_modules/@tootallnate/quickjs-emscripten/dist/types-ffi.js.map +0 -1
  373. package/node_modules/@tootallnate/quickjs-emscripten/dist/types.d.ts +0 -158
  374. package/node_modules/@tootallnate/quickjs-emscripten/dist/types.js +0 -58
  375. package/node_modules/@tootallnate/quickjs-emscripten/dist/types.js.map +0 -1
  376. package/node_modules/@tootallnate/quickjs-emscripten/dist/variants.d.ts +0 -113
  377. package/node_modules/@tootallnate/quickjs-emscripten/dist/variants.js +0 -169
  378. package/node_modules/@tootallnate/quickjs-emscripten/dist/variants.js.map +0 -1
  379. package/node_modules/@tootallnate/quickjs-emscripten/dist/vm-interface.d.ts +0 -68
  380. package/node_modules/@tootallnate/quickjs-emscripten/dist/vm-interface.js +0 -12
  381. package/node_modules/@tootallnate/quickjs-emscripten/dist/vm-interface.js.map +0 -1
  382. package/node_modules/@tootallnate/quickjs-emscripten/package.json +0 -60
  383. package/node_modules/@types/mime-types/LICENSE +0 -21
  384. package/node_modules/@types/mime-types/README.md +0 -28
  385. package/node_modules/@types/mime-types/index.d.ts +0 -9
  386. package/node_modules/@types/mime-types/package.json +0 -25
  387. package/node_modules/@types/yauzl/LICENSE +0 -21
  388. package/node_modules/@types/yauzl/README.md +0 -15
  389. package/node_modules/@types/yauzl/index.d.ts +0 -110
  390. package/node_modules/@types/yauzl/package.json +0 -27
  391. package/node_modules/ansi-regex/index.d.ts +0 -33
  392. package/node_modules/ansi-regex/index.js +0 -14
  393. package/node_modules/ansi-regex/license +0 -9
  394. package/node_modules/ansi-regex/package.json +0 -61
  395. package/node_modules/ansi-regex/readme.md +0 -66
  396. package/node_modules/ansi-styles/index.d.ts +0 -345
  397. package/node_modules/ansi-styles/index.js +0 -163
  398. package/node_modules/ansi-styles/package.json +0 -56
  399. package/node_modules/ansi-styles/readme.md +0 -152
  400. package/node_modules/any-promise/.jshintrc +0 -4
  401. package/node_modules/any-promise/.npmignore +0 -7
  402. package/node_modules/any-promise/LICENSE +0 -19
  403. package/node_modules/any-promise/README.md +0 -161
  404. package/node_modules/any-promise/implementation.d.ts +0 -3
  405. package/node_modules/any-promise/implementation.js +0 -1
  406. package/node_modules/any-promise/index.d.ts +0 -73
  407. package/node_modules/any-promise/index.js +0 -1
  408. package/node_modules/any-promise/loader.js +0 -78
  409. package/node_modules/any-promise/optional.js +0 -6
  410. package/node_modules/any-promise/package.json +0 -45
  411. package/node_modules/any-promise/register/bluebird.d.ts +0 -1
  412. package/node_modules/any-promise/register/bluebird.js +0 -2
  413. package/node_modules/any-promise/register/es6-promise.d.ts +0 -1
  414. package/node_modules/any-promise/register/es6-promise.js +0 -2
  415. package/node_modules/any-promise/register/lie.d.ts +0 -1
  416. package/node_modules/any-promise/register/lie.js +0 -2
  417. package/node_modules/any-promise/register/native-promise-only.d.ts +0 -1
  418. package/node_modules/any-promise/register/native-promise-only.js +0 -2
  419. package/node_modules/any-promise/register/pinkie.d.ts +0 -1
  420. package/node_modules/any-promise/register/pinkie.js +0 -2
  421. package/node_modules/any-promise/register/promise.d.ts +0 -1
  422. package/node_modules/any-promise/register/promise.js +0 -2
  423. package/node_modules/any-promise/register/q.d.ts +0 -1
  424. package/node_modules/any-promise/register/q.js +0 -2
  425. package/node_modules/any-promise/register/rsvp.d.ts +0 -1
  426. package/node_modules/any-promise/register/rsvp.js +0 -2
  427. package/node_modules/any-promise/register/vow.d.ts +0 -1
  428. package/node_modules/any-promise/register/vow.js +0 -2
  429. package/node_modules/any-promise/register/when.d.ts +0 -1
  430. package/node_modules/any-promise/register/when.js +0 -2
  431. package/node_modules/any-promise/register-shim.js +0 -18
  432. package/node_modules/any-promise/register.d.ts +0 -17
  433. package/node_modules/any-promise/register.js +0 -94
  434. package/node_modules/ast-types/.github/dependabot.yml +0 -9
  435. package/node_modules/ast-types/.github/workflows/main.yml +0 -29
  436. package/node_modules/ast-types/LICENSE +0 -20
  437. package/node_modules/ast-types/README.md +0 -512
  438. package/node_modules/ast-types/def/babel-core.d.ts +0 -2
  439. package/node_modules/ast-types/def/babel-core.js +0 -256
  440. package/node_modules/ast-types/def/babel.d.ts +0 -2
  441. package/node_modules/ast-types/def/babel.js +0 -11
  442. package/node_modules/ast-types/def/core.d.ts +0 -2
  443. package/node_modules/ast-types/def/core.js +0 -298
  444. package/node_modules/ast-types/def/es-proposals.d.ts +0 -2
  445. package/node_modules/ast-types/def/es-proposals.js +0 -33
  446. package/node_modules/ast-types/def/es2020.d.ts +0 -2
  447. package/node_modules/ast-types/def/es2020.js +0 -16
  448. package/node_modules/ast-types/def/es6.d.ts +0 -2
  449. package/node_modules/ast-types/def/es6.js +0 -210
  450. package/node_modules/ast-types/def/es7.d.ts +0 -2
  451. package/node_modules/ast-types/def/es7.js +0 -34
  452. package/node_modules/ast-types/def/esprima.d.ts +0 -2
  453. package/node_modules/ast-types/def/esprima.js +0 -49
  454. package/node_modules/ast-types/def/flow.d.ts +0 -2
  455. package/node_modules/ast-types/def/flow.js +0 -292
  456. package/node_modules/ast-types/def/jsx.d.ts +0 -2
  457. package/node_modules/ast-types/def/jsx.js +0 -103
  458. package/node_modules/ast-types/def/type-annotations.d.ts +0 -7
  459. package/node_modules/ast-types/def/type-annotations.js +0 -40
  460. package/node_modules/ast-types/def/typescript.d.ts +0 -2
  461. package/node_modules/ast-types/def/typescript.js +0 -344
  462. package/node_modules/ast-types/fork.d.ts +0 -42
  463. package/node_modules/ast-types/fork.js +0 -52
  464. package/node_modules/ast-types/gen/builders.d.ts +0 -2584
  465. package/node_modules/ast-types/gen/builders.js +0 -2
  466. package/node_modules/ast-types/gen/kinds.d.ts +0 -264
  467. package/node_modules/ast-types/gen/kinds.js +0 -2
  468. package/node_modules/ast-types/gen/namedTypes.d.ts +0 -1809
  469. package/node_modules/ast-types/gen/namedTypes.js +0 -6
  470. package/node_modules/ast-types/gen/visitor.d.ts +0 -268
  471. package/node_modules/ast-types/gen/visitor.js +0 -2
  472. package/node_modules/ast-types/lib/equiv.d.ts +0 -5
  473. package/node_modules/ast-types/lib/equiv.js +0 -154
  474. package/node_modules/ast-types/lib/node-path.d.ts +0 -22
  475. package/node_modules/ast-types/lib/node-path.js +0 -411
  476. package/node_modules/ast-types/lib/path-visitor.d.ts +0 -52
  477. package/node_modules/ast-types/lib/path-visitor.js +0 -343
  478. package/node_modules/ast-types/lib/path.d.ts +0 -25
  479. package/node_modules/ast-types/lib/path.js +0 -331
  480. package/node_modules/ast-types/lib/scope.d.ts +0 -26
  481. package/node_modules/ast-types/lib/scope.js +0 -318
  482. package/node_modules/ast-types/lib/shared.d.ts +0 -13
  483. package/node_modules/ast-types/lib/shared.js +0 -47
  484. package/node_modules/ast-types/lib/types.d.ts +0 -136
  485. package/node_modules/ast-types/lib/types.js +0 -780
  486. package/node_modules/ast-types/main.d.ts +0 -28
  487. package/node_modules/ast-types/main.js +0 -53
  488. package/node_modules/ast-types/package.json +0 -65
  489. package/node_modules/ast-types/tsconfig.json +0 -21
  490. package/node_modules/ast-types/types.d.ts +0 -6
  491. package/node_modules/ast-types/types.js +0 -2
  492. package/node_modules/basic-ftp/LICENSE.txt +0 -19
  493. package/node_modules/basic-ftp/README.md +0 -244
  494. package/node_modules/basic-ftp/dist/Client.d.ts +0 -340
  495. package/node_modules/basic-ftp/dist/Client.js +0 -785
  496. package/node_modules/basic-ftp/dist/FileInfo.d.ts +0 -80
  497. package/node_modules/basic-ftp/dist/FileInfo.js +0 -92
  498. package/node_modules/basic-ftp/dist/FtpContext.d.ts +0 -175
  499. package/node_modules/basic-ftp/dist/FtpContext.js +0 -375
  500. package/node_modules/basic-ftp/dist/ProgressTracker.d.ts +0 -45
  501. package/node_modules/basic-ftp/dist/ProgressTracker.js +0 -72
  502. package/node_modules/basic-ftp/dist/StringEncoding.d.ts +0 -1
  503. package/node_modules/basic-ftp/dist/StringEncoding.js +0 -2
  504. package/node_modules/basic-ftp/dist/StringWriter.d.ts +0 -10
  505. package/node_modules/basic-ftp/dist/StringWriter.js +0 -29
  506. package/node_modules/basic-ftp/dist/index.d.ts +0 -9
  507. package/node_modules/basic-ftp/dist/index.js +0 -28
  508. package/node_modules/basic-ftp/dist/netUtils.d.ts +0 -21
  509. package/node_modules/basic-ftp/dist/netUtils.js +0 -66
  510. package/node_modules/basic-ftp/dist/parseControlResponse.d.ts +0 -22
  511. package/node_modules/basic-ftp/dist/parseControlResponse.js +0 -66
  512. package/node_modules/basic-ftp/dist/parseList.d.ts +0 -5
  513. package/node_modules/basic-ftp/dist/parseList.js +0 -79
  514. package/node_modules/basic-ftp/dist/parseListDOS.d.ts +0 -12
  515. package/node_modules/basic-ftp/dist/parseListDOS.js +0 -52
  516. package/node_modules/basic-ftp/dist/parseListMLSD.d.ts +0 -20
  517. package/node_modules/basic-ftp/dist/parseListMLSD.js +0 -187
  518. package/node_modules/basic-ftp/dist/parseListUnix.d.ts +0 -12
  519. package/node_modules/basic-ftp/dist/parseListUnix.js +0 -155
  520. package/node_modules/basic-ftp/dist/transfer.d.ts +0 -39
  521. package/node_modules/basic-ftp/dist/transfer.js +0 -318
  522. package/node_modules/basic-ftp/package.json +0 -52
  523. package/node_modules/buffer-crc32/LICENSE +0 -19
  524. package/node_modules/buffer-crc32/README.md +0 -47
  525. package/node_modules/buffer-crc32/index.js +0 -111
  526. package/node_modules/buffer-crc32/package.json +0 -39
  527. package/node_modules/cli-highlight/LICENSE.txt +0 -15
  528. package/node_modules/cli-highlight/README.md +0 -88
  529. package/node_modules/cli-highlight/bin/highlight +0 -2
  530. package/node_modules/cli-highlight/dist/cli.d.ts +0 -1
  531. package/node_modules/cli-highlight/dist/cli.js +0 -102
  532. package/node_modules/cli-highlight/dist/cli.js.map +0 -1
  533. package/node_modules/cli-highlight/dist/index.d.ts +0 -53
  534. package/node_modules/cli-highlight/dist/index.js +0 -112
  535. package/node_modules/cli-highlight/dist/index.js.map +0 -1
  536. package/node_modules/cli-highlight/dist/test/test.d.ts +0 -1
  537. package/node_modules/cli-highlight/dist/test/test.js +0 -62
  538. package/node_modules/cli-highlight/dist/test/test.js.map +0 -1
  539. package/node_modules/cli-highlight/dist/theme.d.ts +0 -270
  540. package/node_modules/cli-highlight/dist/theme.js +0 -265
  541. package/node_modules/cli-highlight/dist/theme.js.map +0 -1
  542. package/node_modules/cli-highlight/node_modules/chalk/index.d.ts +0 -415
  543. package/node_modules/cli-highlight/node_modules/chalk/package.json +0 -68
  544. package/node_modules/cli-highlight/node_modules/chalk/readme.md +0 -341
  545. package/node_modules/cli-highlight/node_modules/chalk/source/index.js +0 -229
  546. package/node_modules/cli-highlight/node_modules/chalk/source/templates.js +0 -134
  547. package/node_modules/cli-highlight/node_modules/chalk/source/util.js +0 -39
  548. package/node_modules/cli-highlight/package.json +0 -129
  549. package/node_modules/cliui/LICENSE.txt +0 -14
  550. package/node_modules/cliui/README.md +0 -141
  551. package/node_modules/cliui/build/index.cjs +0 -302
  552. package/node_modules/cliui/build/lib/index.js +0 -287
  553. package/node_modules/cliui/build/lib/string-utils.js +0 -27
  554. package/node_modules/cliui/index.mjs +0 -13
  555. package/node_modules/cliui/node_modules/ansi-regex/index.d.ts +0 -37
  556. package/node_modules/cliui/node_modules/ansi-regex/index.js +0 -10
  557. package/node_modules/cliui/node_modules/ansi-regex/license +0 -9
  558. package/node_modules/cliui/node_modules/ansi-regex/package.json +0 -55
  559. package/node_modules/cliui/node_modules/ansi-regex/readme.md +0 -78
  560. package/node_modules/cliui/node_modules/strip-ansi/index.d.ts +0 -17
  561. package/node_modules/cliui/node_modules/strip-ansi/index.js +0 -4
  562. package/node_modules/cliui/node_modules/strip-ansi/license +0 -9
  563. package/node_modules/cliui/node_modules/strip-ansi/package.json +0 -54
  564. package/node_modules/cliui/node_modules/strip-ansi/readme.md +0 -46
  565. package/node_modules/cliui/package.json +0 -83
  566. package/node_modules/color-convert/LICENSE +0 -21
  567. package/node_modules/color-convert/README.md +0 -68
  568. package/node_modules/color-convert/conversions.js +0 -839
  569. package/node_modules/color-convert/index.js +0 -81
  570. package/node_modules/color-convert/package.json +0 -48
  571. package/node_modules/color-convert/route.js +0 -97
  572. package/node_modules/color-name/LICENSE +0 -8
  573. package/node_modules/color-name/README.md +0 -11
  574. package/node_modules/color-name/index.js +0 -152
  575. package/node_modules/color-name/package.json +0 -28
  576. package/node_modules/degenerator/README.md +0 -117
  577. package/node_modules/degenerator/dist/compile.d.ts +0 -11
  578. package/node_modules/degenerator/dist/compile.d.ts.map +0 -1
  579. package/node_modules/degenerator/dist/compile.js +0 -107
  580. package/node_modules/degenerator/dist/compile.js.map +0 -1
  581. package/node_modules/degenerator/dist/degenerator.d.ts +0 -12
  582. package/node_modules/degenerator/dist/degenerator.d.ts.map +0 -1
  583. package/node_modules/degenerator/dist/degenerator.js +0 -156
  584. package/node_modules/degenerator/dist/degenerator.js.map +0 -1
  585. package/node_modules/degenerator/dist/index.d.ts +0 -3
  586. package/node_modules/degenerator/dist/index.d.ts.map +0 -1
  587. package/node_modules/degenerator/dist/index.js +0 -19
  588. package/node_modules/degenerator/dist/index.js.map +0 -1
  589. package/node_modules/degenerator/package.json +0 -42
  590. package/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
  591. package/node_modules/emoji-regex/README.md +0 -73
  592. package/node_modules/emoji-regex/es2015/index.js +0 -6
  593. package/node_modules/emoji-regex/es2015/text.js +0 -6
  594. package/node_modules/emoji-regex/index.d.ts +0 -23
  595. package/node_modules/emoji-regex/index.js +0 -6
  596. package/node_modules/emoji-regex/package.json +0 -50
  597. package/node_modules/emoji-regex/text.js +0 -6
  598. package/node_modules/end-of-stream/LICENSE +0 -21
  599. package/node_modules/end-of-stream/README.md +0 -54
  600. package/node_modules/end-of-stream/index.js +0 -96
  601. package/node_modules/end-of-stream/package.json +0 -37
  602. package/node_modules/escalade/dist/index.js +0 -22
  603. package/node_modules/escalade/dist/index.mjs +0 -22
  604. package/node_modules/escalade/index.d.mts +0 -11
  605. package/node_modules/escalade/index.d.ts +0 -15
  606. package/node_modules/escalade/license +0 -9
  607. package/node_modules/escalade/package.json +0 -74
  608. package/node_modules/escalade/readme.md +0 -211
  609. package/node_modules/escalade/sync/index.d.mts +0 -9
  610. package/node_modules/escalade/sync/index.d.ts +0 -13
  611. package/node_modules/escalade/sync/index.js +0 -18
  612. package/node_modules/escalade/sync/index.mjs +0 -18
  613. package/node_modules/escodegen/LICENSE.BSD +0 -21
  614. package/node_modules/escodegen/README.md +0 -84
  615. package/node_modules/escodegen/bin/escodegen.js +0 -77
  616. package/node_modules/escodegen/bin/esgenerate.js +0 -64
  617. package/node_modules/escodegen/escodegen.js +0 -2667
  618. package/node_modules/escodegen/package.json +0 -63
  619. package/node_modules/esprima/LICENSE.BSD +0 -21
  620. package/node_modules/esprima/README.md +0 -46
  621. package/node_modules/esprima/bin/esparse.js +0 -139
  622. package/node_modules/esprima/bin/esvalidate.js +0 -236
  623. package/node_modules/esprima/dist/esprima.js +0 -6709
  624. package/node_modules/esprima/package.json +0 -112
  625. package/node_modules/estraverse/.jshintrc +0 -16
  626. package/node_modules/estraverse/LICENSE.BSD +0 -19
  627. package/node_modules/estraverse/README.md +0 -153
  628. package/node_modules/estraverse/estraverse.js +0 -805
  629. package/node_modules/estraverse/gulpfile.js +0 -70
  630. package/node_modules/estraverse/package.json +0 -40
  631. package/node_modules/esutils/LICENSE.BSD +0 -19
  632. package/node_modules/esutils/README.md +0 -174
  633. package/node_modules/esutils/lib/ast.js +0 -144
  634. package/node_modules/esutils/lib/code.js +0 -135
  635. package/node_modules/esutils/lib/keyword.js +0 -165
  636. package/node_modules/esutils/lib/utils.js +0 -33
  637. package/node_modules/esutils/package.json +0 -44
  638. package/node_modules/extract-zip/LICENSE +0 -23
  639. package/node_modules/extract-zip/cli.js +0 -19
  640. package/node_modules/extract-zip/index.d.ts +0 -21
  641. package/node_modules/extract-zip/index.js +0 -173
  642. package/node_modules/extract-zip/package.json +0 -80
  643. package/node_modules/extract-zip/readme.md +0 -57
  644. package/node_modules/fd-slicer/.npmignore +0 -2
  645. package/node_modules/fd-slicer/.travis.yml +0 -7
  646. package/node_modules/fd-slicer/CHANGELOG.md +0 -49
  647. package/node_modules/fd-slicer/LICENSE +0 -21
  648. package/node_modules/fd-slicer/README.md +0 -199
  649. package/node_modules/fd-slicer/index.js +0 -296
  650. package/node_modules/fd-slicer/package.json +0 -36
  651. package/node_modules/fd-slicer/test/test.js +0 -350
  652. package/node_modules/file-type/core.d.ts +0 -253
  653. package/node_modules/file-type/core.js +0 -2899
  654. package/node_modules/file-type/index.d.ts +0 -98
  655. package/node_modules/file-type/index.js +0 -163
  656. package/node_modules/file-type/license +0 -9
  657. package/node_modules/file-type/package.json +0 -290
  658. package/node_modules/file-type/readme.md +0 -667
  659. package/node_modules/file-type/supported.js +0 -360
  660. package/node_modules/file-type/util.js +0 -60
  661. package/node_modules/get-caller-file/LICENSE.md +0 -6
  662. package/node_modules/get-caller-file/README.md +0 -41
  663. package/node_modules/get-caller-file/index.d.ts +0 -2
  664. package/node_modules/get-caller-file/index.js +0 -22
  665. package/node_modules/get-caller-file/index.js.map +0 -1
  666. package/node_modules/get-caller-file/package.json +0 -42
  667. package/node_modules/get-stream/buffer-stream.js +0 -52
  668. package/node_modules/get-stream/index.d.ts +0 -108
  669. package/node_modules/get-stream/index.js +0 -60
  670. package/node_modules/get-stream/license +0 -9
  671. package/node_modules/get-stream/package.json +0 -50
  672. package/node_modules/get-stream/readme.md +0 -124
  673. package/node_modules/get-uri/LICENSE +0 -22
  674. package/node_modules/get-uri/README.md +0 -109
  675. package/node_modules/get-uri/dist/data.d.ts +0 -16
  676. package/node_modules/get-uri/dist/data.js +0 -43
  677. package/node_modules/get-uri/dist/data.js.map +0 -1
  678. package/node_modules/get-uri/dist/file.d.ts +0 -17
  679. package/node_modules/get-uri/dist/file.js +0 -57
  680. package/node_modules/get-uri/dist/file.js.map +0 -1
  681. package/node_modules/get-uri/dist/ftp.d.ts +0 -14
  682. package/node_modules/get-uri/dist/ftp.js +0 -93
  683. package/node_modules/get-uri/dist/ftp.js.map +0 -1
  684. package/node_modules/get-uri/dist/http-error.d.ts +0 -8
  685. package/node_modules/get-uri/dist/http-error.js +0 -15
  686. package/node_modules/get-uri/dist/http-error.js.map +0 -1
  687. package/node_modules/get-uri/dist/http.d.ts +0 -29
  688. package/node_modules/get-uri/dist/http.js +0 -191
  689. package/node_modules/get-uri/dist/http.js.map +0 -1
  690. package/node_modules/get-uri/dist/https.d.ts +0 -6
  691. package/node_modules/get-uri/dist/https.js +0 -16
  692. package/node_modules/get-uri/dist/https.js.map +0 -1
  693. package/node_modules/get-uri/dist/index.d.ts +0 -37
  694. package/node_modules/get-uri/dist/index.js +0 -57
  695. package/node_modules/get-uri/dist/index.js.map +0 -1
  696. package/node_modules/get-uri/dist/notfound.d.ts +0 -10
  697. package/node_modules/get-uri/dist/notfound.js +0 -16
  698. package/node_modules/get-uri/dist/notfound.js.map +0 -1
  699. package/node_modules/get-uri/dist/notmodified.d.ts +0 -10
  700. package/node_modules/get-uri/dist/notmodified.js +0 -17
  701. package/node_modules/get-uri/dist/notmodified.js.map +0 -1
  702. package/node_modules/get-uri/node_modules/data-uri-to-buffer/LICENSE +0 -22
  703. package/node_modules/get-uri/node_modules/data-uri-to-buffer/README.md +0 -61
  704. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/common.d.ts +0 -17
  705. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/common.d.ts.map +0 -1
  706. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/common.js +0 -54
  707. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/common.js.map +0 -1
  708. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/index.d.ts +0 -8
  709. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/index.d.ts.map +0 -1
  710. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/index.js +0 -48
  711. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/index.js.map +0 -1
  712. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/node.d.ts +0 -8
  713. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/node.d.ts.map +0 -1
  714. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/node.js +0 -26
  715. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/node.js.map +0 -1
  716. package/node_modules/get-uri/node_modules/data-uri-to-buffer/package.json +0 -48
  717. package/node_modules/get-uri/package.json +0 -58
  718. package/node_modules/has-flag/index.d.ts +0 -39
  719. package/node_modules/has-flag/index.js +0 -8
  720. package/node_modules/has-flag/license +0 -9
  721. package/node_modules/has-flag/package.json +0 -46
  722. package/node_modules/has-flag/readme.md +0 -89
  723. package/node_modules/ieee754/LICENSE +0 -11
  724. package/node_modules/ieee754/README.md +0 -51
  725. package/node_modules/ieee754/index.d.ts +0 -10
  726. package/node_modules/ieee754/index.js +0 -85
  727. package/node_modules/ieee754/package.json +0 -52
  728. package/node_modules/ip-address/LICENSE +0 -19
  729. package/node_modules/ip-address/README.md +0 -278
  730. package/node_modules/ip-address/dist/address-error.d.ts +0 -4
  731. package/node_modules/ip-address/dist/address-error.js +0 -12
  732. package/node_modules/ip-address/dist/address-error.js.map +0 -1
  733. package/node_modules/ip-address/dist/common.d.ts +0 -20
  734. package/node_modules/ip-address/dist/common.js +0 -67
  735. package/node_modules/ip-address/dist/common.js.map +0 -1
  736. package/node_modules/ip-address/dist/ip-address.d.ts +0 -7
  737. package/node_modules/ip-address/dist/ip-address.js +0 -35
  738. package/node_modules/ip-address/dist/ip-address.js.map +0 -1
  739. package/node_modules/ip-address/dist/ipv4.d.ts +0 -267
  740. package/node_modules/ip-address/dist/ipv4.js +0 -485
  741. package/node_modules/ip-address/dist/ipv4.js.map +0 -1
  742. package/node_modules/ip-address/dist/ipv6.d.ts +0 -489
  743. package/node_modules/ip-address/dist/ipv6.js +0 -1217
  744. package/node_modules/ip-address/dist/ipv6.js.map +0 -1
  745. package/node_modules/ip-address/dist/v4/constants.d.ts +0 -4
  746. package/node_modules/ip-address/dist/v4/constants.js +0 -8
  747. package/node_modules/ip-address/dist/v4/constants.js.map +0 -1
  748. package/node_modules/ip-address/dist/v6/constants.d.ts +0 -44
  749. package/node_modules/ip-address/dist/v6/constants.js +0 -81
  750. package/node_modules/ip-address/dist/v6/constants.js.map +0 -1
  751. package/node_modules/ip-address/dist/v6/helpers.d.ts +0 -18
  752. package/node_modules/ip-address/dist/v6/helpers.js +0 -54
  753. package/node_modules/ip-address/dist/v6/helpers.js.map +0 -1
  754. package/node_modules/ip-address/dist/v6/regular-expressions.d.ts +0 -5
  755. package/node_modules/ip-address/dist/v6/regular-expressions.js +0 -95
  756. package/node_modules/ip-address/dist/v6/regular-expressions.js.map +0 -1
  757. package/node_modules/ip-address/package.json +0 -88
  758. package/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
  759. package/node_modules/is-fullwidth-code-point/index.js +0 -50
  760. package/node_modules/is-fullwidth-code-point/license +0 -9
  761. package/node_modules/is-fullwidth-code-point/package.json +0 -42
  762. package/node_modules/is-fullwidth-code-point/readme.md +0 -39
  763. package/node_modules/mime-db/HISTORY.md +0 -541
  764. package/node_modules/mime-db/LICENSE +0 -23
  765. package/node_modules/mime-db/README.md +0 -109
  766. package/node_modules/mime-db/db.json +0 -9342
  767. package/node_modules/mime-db/index.js +0 -12
  768. package/node_modules/mime-db/package.json +0 -56
  769. package/node_modules/mime-types/HISTORY.md +0 -428
  770. package/node_modules/mime-types/LICENSE +0 -23
  771. package/node_modules/mime-types/README.md +0 -126
  772. package/node_modules/mime-types/index.js +0 -211
  773. package/node_modules/mime-types/mimeScore.js +0 -57
  774. package/node_modules/mime-types/package.json +0 -49
  775. package/node_modules/mz/LICENSE +0 -22
  776. package/node_modules/mz/README.md +0 -106
  777. package/node_modules/mz/child_process.js +0 -8
  778. package/node_modules/mz/crypto.js +0 -9
  779. package/node_modules/mz/dns.js +0 -16
  780. package/node_modules/mz/fs.js +0 -62
  781. package/node_modules/mz/index.js +0 -8
  782. package/node_modules/mz/package.json +0 -44
  783. package/node_modules/mz/readline.js +0 -64
  784. package/node_modules/mz/zlib.js +0 -13
  785. package/node_modules/netmask/CHANGELOG.md +0 -66
  786. package/node_modules/netmask/LICENSE.md +0 -21
  787. package/node_modules/netmask/README.md +0 -112
  788. package/node_modules/netmask/dist/netmask.d.ts +0 -21
  789. package/node_modules/netmask/dist/netmask.js +0 -68
  790. package/node_modules/netmask/dist/netmask4.d.ts +0 -20
  791. package/node_modules/netmask/dist/netmask4.js +0 -189
  792. package/node_modules/netmask/dist/netmask6.d.ts +0 -20
  793. package/node_modules/netmask/dist/netmask6.js +0 -187
  794. package/node_modules/netmask/package.json +0 -45
  795. package/node_modules/object-assign/index.js +0 -90
  796. package/node_modules/object-assign/license +0 -21
  797. package/node_modules/object-assign/package.json +0 -42
  798. package/node_modules/object-assign/readme.md +0 -61
  799. package/node_modules/once/README.md +0 -79
  800. package/node_modules/once/once.js +0 -42
  801. package/node_modules/once/package.json +0 -33
  802. package/node_modules/pac-proxy-agent/LICENSE +0 -22
  803. package/node_modules/pac-proxy-agent/README.md +0 -27
  804. package/node_modules/pac-proxy-agent/dist/index.d.ts +0 -60
  805. package/node_modules/pac-proxy-agent/dist/index.d.ts.map +0 -1
  806. package/node_modules/pac-proxy-agent/dist/index.js +0 -238
  807. package/node_modules/pac-proxy-agent/dist/index.js.map +0 -1
  808. package/node_modules/pac-proxy-agent/package.json +0 -58
  809. package/node_modules/pac-resolver/LICENSE +0 -22
  810. package/node_modules/pac-resolver/README.md +0 -59
  811. package/node_modules/pac-resolver/dist/dateRange.d.ts +0 -67
  812. package/node_modules/pac-resolver/dist/dateRange.d.ts.map +0 -1
  813. package/node_modules/pac-resolver/dist/dateRange.js +0 -73
  814. package/node_modules/pac-resolver/dist/dateRange.js.map +0 -1
  815. package/node_modules/pac-resolver/dist/dnsDomainIs.d.ts +0 -23
  816. package/node_modules/pac-resolver/dist/dnsDomainIs.d.ts.map +0 -1
  817. package/node_modules/pac-resolver/dist/dnsDomainIs.js +0 -30
  818. package/node_modules/pac-resolver/dist/dnsDomainIs.js.map +0 -1
  819. package/node_modules/pac-resolver/dist/dnsDomainLevels.d.ts +0 -18
  820. package/node_modules/pac-resolver/dist/dnsDomainLevels.d.ts.map +0 -1
  821. package/node_modules/pac-resolver/dist/dnsDomainLevels.js +0 -28
  822. package/node_modules/pac-resolver/dist/dnsDomainLevels.js.map +0 -1
  823. package/node_modules/pac-resolver/dist/dnsResolve.d.ts +0 -16
  824. package/node_modules/pac-resolver/dist/dnsResolve.d.ts.map +0 -1
  825. package/node_modules/pac-resolver/dist/dnsResolve.js +0 -32
  826. package/node_modules/pac-resolver/dist/dnsResolve.js.map +0 -1
  827. package/node_modules/pac-resolver/dist/index.d.ts +0 -50
  828. package/node_modules/pac-resolver/dist/index.d.ts.map +0 -1
  829. package/node_modules/pac-resolver/dist/index.js +0 -87
  830. package/node_modules/pac-resolver/dist/index.js.map +0 -1
  831. package/node_modules/pac-resolver/dist/ip.d.ts +0 -8
  832. package/node_modules/pac-resolver/dist/ip.d.ts.map +0 -1
  833. package/node_modules/pac-resolver/dist/ip.js +0 -50
  834. package/node_modules/pac-resolver/dist/ip.js.map +0 -1
  835. package/node_modules/pac-resolver/dist/isInNet.d.ts +0 -24
  836. package/node_modules/pac-resolver/dist/isInNet.d.ts.map +0 -1
  837. package/node_modules/pac-resolver/dist/isInNet.js +0 -42
  838. package/node_modules/pac-resolver/dist/isInNet.js.map +0 -1
  839. package/node_modules/pac-resolver/dist/isPlainHostName.d.ts +0 -18
  840. package/node_modules/pac-resolver/dist/isPlainHostName.d.ts.map +0 -1
  841. package/node_modules/pac-resolver/dist/isPlainHostName.js +0 -23
  842. package/node_modules/pac-resolver/dist/isPlainHostName.js.map +0 -1
  843. package/node_modules/pac-resolver/dist/isResolvable.d.ts +0 -8
  844. package/node_modules/pac-resolver/dist/isResolvable.d.ts.map +0 -1
  845. package/node_modules/pac-resolver/dist/isResolvable.js +0 -23
  846. package/node_modules/pac-resolver/dist/isResolvable.js.map +0 -1
  847. package/node_modules/pac-resolver/dist/localHostOrDomainIs.d.ts +0 -26
  848. package/node_modules/pac-resolver/dist/localHostOrDomainIs.d.ts.map +0 -1
  849. package/node_modules/pac-resolver/dist/localHostOrDomainIs.js +0 -40
  850. package/node_modules/pac-resolver/dist/localHostOrDomainIs.js.map +0 -1
  851. package/node_modules/pac-resolver/dist/myIpAddress.d.ts +0 -16
  852. package/node_modules/pac-resolver/dist/myIpAddress.d.ts.map +0 -1
  853. package/node_modules/pac-resolver/dist/myIpAddress.js +0 -50
  854. package/node_modules/pac-resolver/dist/myIpAddress.js.map +0 -1
  855. package/node_modules/pac-resolver/dist/shExpMatch.d.ts +0 -23
  856. package/node_modules/pac-resolver/dist/shExpMatch.d.ts.map +0 -1
  857. package/node_modules/pac-resolver/dist/shExpMatch.js +0 -41
  858. package/node_modules/pac-resolver/dist/shExpMatch.js.map +0 -1
  859. package/node_modules/pac-resolver/dist/timeRange.d.ts +0 -43
  860. package/node_modules/pac-resolver/dist/timeRange.d.ts.map +0 -1
  861. package/node_modules/pac-resolver/dist/timeRange.js +0 -92
  862. package/node_modules/pac-resolver/dist/timeRange.js.map +0 -1
  863. package/node_modules/pac-resolver/dist/util.d.ts +0 -6
  864. package/node_modules/pac-resolver/dist/util.d.ts.map +0 -1
  865. package/node_modules/pac-resolver/dist/util.js +0 -22
  866. package/node_modules/pac-resolver/dist/util.js.map +0 -1
  867. package/node_modules/pac-resolver/dist/weekdayRange.d.ts +0 -45
  868. package/node_modules/pac-resolver/dist/weekdayRange.d.ts.map +0 -1
  869. package/node_modules/pac-resolver/dist/weekdayRange.js +0 -91
  870. package/node_modules/pac-resolver/dist/weekdayRange.js.map +0 -1
  871. package/node_modules/pac-resolver/package.json +0 -47
  872. package/node_modules/parse5/LICENSE +0 -19
  873. package/node_modules/parse5/README.md +0 -38
  874. package/node_modules/parse5/lib/common/doctype.js +0 -162
  875. package/node_modules/parse5/lib/common/error-codes.js +0 -65
  876. package/node_modules/parse5/lib/common/foreign-content.js +0 -265
  877. package/node_modules/parse5/lib/common/html.js +0 -272
  878. package/node_modules/parse5/lib/common/unicode.js +0 -109
  879. package/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js +0 -43
  880. package/node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js +0 -52
  881. package/node_modules/parse5/lib/extensions/error-reporting/preprocessor-mixin.js +0 -24
  882. package/node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js +0 -17
  883. package/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js +0 -35
  884. package/node_modules/parse5/lib/extensions/location-info/parser-mixin.js +0 -222
  885. package/node_modules/parse5/lib/extensions/location-info/tokenizer-mixin.js +0 -146
  886. package/node_modules/parse5/lib/extensions/position-tracking/preprocessor-mixin.js +0 -64
  887. package/node_modules/parse5/lib/index.js +0 -29
  888. package/node_modules/parse5/lib/parser/formatting-element-list.js +0 -181
  889. package/node_modules/parse5/lib/parser/index.js +0 -2956
  890. package/node_modules/parse5/lib/parser/open-element-stack.js +0 -482
  891. package/node_modules/parse5/lib/serializer/index.js +0 -176
  892. package/node_modules/parse5/lib/tokenizer/index.js +0 -2196
  893. package/node_modules/parse5/lib/tokenizer/named-entity-data.js +0 -5
  894. package/node_modules/parse5/lib/tokenizer/preprocessor.js +0 -159
  895. package/node_modules/parse5/lib/tree-adapters/default.js +0 -217
  896. package/node_modules/parse5/lib/utils/merge-options.js +0 -13
  897. package/node_modules/parse5/lib/utils/mixin.js +0 -39
  898. package/node_modules/parse5/package.json +0 -35
  899. package/node_modules/parse5-htmlparser2-tree-adapter/LICENSE +0 -19
  900. package/node_modules/parse5-htmlparser2-tree-adapter/README.md +0 -34
  901. package/node_modules/parse5-htmlparser2-tree-adapter/lib/index.js +0 -348
  902. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/LICENSE +0 -19
  903. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/README.md +0 -38
  904. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/doctype.js +0 -162
  905. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/error-codes.js +0 -65
  906. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/foreign-content.js +0 -265
  907. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/html.js +0 -272
  908. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/unicode.js +0 -109
  909. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js +0 -43
  910. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js +0 -52
  911. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/error-reporting/preprocessor-mixin.js +0 -24
  912. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js +0 -17
  913. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js +0 -35
  914. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/location-info/parser-mixin.js +0 -223
  915. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/location-info/tokenizer-mixin.js +0 -146
  916. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/position-tracking/preprocessor-mixin.js +0 -64
  917. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/index.js +0 -29
  918. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/parser/formatting-element-list.js +0 -181
  919. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/parser/index.js +0 -2956
  920. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/parser/open-element-stack.js +0 -482
  921. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/serializer/index.js +0 -176
  922. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/tokenizer/index.js +0 -2196
  923. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/tokenizer/named-entity-data.js +0 -5
  924. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/tokenizer/preprocessor.js +0 -159
  925. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/tree-adapters/default.js +0 -221
  926. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/utils/merge-options.js +0 -13
  927. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/utils/mixin.js +0 -39
  928. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/package.json +0 -35
  929. package/node_modules/parse5-htmlparser2-tree-adapter/package.json +0 -27
  930. package/node_modules/pend/LICENSE +0 -23
  931. package/node_modules/pend/README.md +0 -41
  932. package/node_modules/pend/index.js +0 -55
  933. package/node_modules/pend/package.json +0 -18
  934. package/node_modules/pend/test.js +0 -137
  935. package/node_modules/proxy-agent/LICENSE +0 -22
  936. package/node_modules/proxy-agent/README.md +0 -59
  937. package/node_modules/proxy-agent/dist/index.d.ts +0 -62
  938. package/node_modules/proxy-agent/dist/index.d.ts.map +0 -1
  939. package/node_modules/proxy-agent/dist/index.js +0 -138
  940. package/node_modules/proxy-agent/dist/index.js.map +0 -1
  941. package/node_modules/proxy-agent/node_modules/lru-cache/LICENSE +0 -15
  942. package/node_modules/proxy-agent/node_modules/lru-cache/README.md +0 -1117
  943. package/node_modules/proxy-agent/node_modules/lru-cache/index.d.ts +0 -869
  944. package/node_modules/proxy-agent/node_modules/lru-cache/index.js +0 -1227
  945. package/node_modules/proxy-agent/node_modules/lru-cache/index.mjs +0 -1227
  946. package/node_modules/proxy-agent/node_modules/lru-cache/package.json +0 -96
  947. package/node_modules/proxy-agent/package.json +0 -60
  948. package/node_modules/proxy-from-env/.eslintrc +0 -29
  949. package/node_modules/proxy-from-env/.travis.yml +0 -10
  950. package/node_modules/proxy-from-env/LICENSE +0 -20
  951. package/node_modules/proxy-from-env/README.md +0 -131
  952. package/node_modules/proxy-from-env/index.js +0 -108
  953. package/node_modules/proxy-from-env/package.json +0 -34
  954. package/node_modules/proxy-from-env/test.js +0 -483
  955. package/node_modules/pump/.github/FUNDING.yml +0 -2
  956. package/node_modules/pump/.travis.yml +0 -5
  957. package/node_modules/pump/LICENSE +0 -21
  958. package/node_modules/pump/README.md +0 -74
  959. package/node_modules/pump/SECURITY.md +0 -5
  960. package/node_modules/pump/empty.js +0 -1
  961. package/node_modules/pump/index.js +0 -86
  962. package/node_modules/pump/package.json +0 -30
  963. package/node_modules/pump/test-browser.js +0 -66
  964. package/node_modules/pump/test-node.js +0 -53
  965. package/node_modules/require-directory/.jshintrc +0 -67
  966. package/node_modules/require-directory/.npmignore +0 -1
  967. package/node_modules/require-directory/.travis.yml +0 -3
  968. package/node_modules/require-directory/LICENSE +0 -22
  969. package/node_modules/require-directory/README.markdown +0 -184
  970. package/node_modules/require-directory/index.js +0 -86
  971. package/node_modules/require-directory/package.json +0 -40
  972. package/node_modules/smart-buffer/.prettierrc.yaml +0 -5
  973. package/node_modules/smart-buffer/.travis.yml +0 -13
  974. package/node_modules/smart-buffer/LICENSE +0 -20
  975. package/node_modules/smart-buffer/README.md +0 -633
  976. package/node_modules/smart-buffer/build/smartbuffer.js +0 -1233
  977. package/node_modules/smart-buffer/build/smartbuffer.js.map +0 -1
  978. package/node_modules/smart-buffer/build/utils.js +0 -108
  979. package/node_modules/smart-buffer/build/utils.js.map +0 -1
  980. package/node_modules/smart-buffer/docs/CHANGELOG.md +0 -70
  981. package/node_modules/smart-buffer/docs/README_v3.md +0 -367
  982. package/node_modules/smart-buffer/docs/ROADMAP.md +0 -0
  983. package/node_modules/smart-buffer/package.json +0 -79
  984. package/node_modules/smart-buffer/typings/smartbuffer.d.ts +0 -755
  985. package/node_modules/smart-buffer/typings/utils.d.ts +0 -66
  986. package/node_modules/socks/.eslintrc.cjs +0 -11
  987. package/node_modules/socks/.prettierrc.yaml +0 -7
  988. package/node_modules/socks/LICENSE +0 -20
  989. package/node_modules/socks/README.md +0 -686
  990. package/node_modules/socks/build/client/socksclient.js +0 -793
  991. package/node_modules/socks/build/client/socksclient.js.map +0 -1
  992. package/node_modules/socks/build/common/constants.js +0 -108
  993. package/node_modules/socks/build/common/constants.js.map +0 -1
  994. package/node_modules/socks/build/common/helpers.js +0 -167
  995. package/node_modules/socks/build/common/helpers.js.map +0 -1
  996. package/node_modules/socks/build/common/receivebuffer.js +0 -43
  997. package/node_modules/socks/build/common/receivebuffer.js.map +0 -1
  998. package/node_modules/socks/build/common/util.js +0 -25
  999. package/node_modules/socks/build/common/util.js.map +0 -1
  1000. package/node_modules/socks/build/index.js +0 -18
  1001. package/node_modules/socks/build/index.js.map +0 -1
  1002. package/node_modules/socks/docs/examples/index.md +0 -17
  1003. package/node_modules/socks/docs/examples/javascript/associateExample.md +0 -90
  1004. package/node_modules/socks/docs/examples/javascript/bindExample.md +0 -83
  1005. package/node_modules/socks/docs/examples/javascript/connectExample.md +0 -258
  1006. package/node_modules/socks/docs/examples/typescript/associateExample.md +0 -93
  1007. package/node_modules/socks/docs/examples/typescript/bindExample.md +0 -86
  1008. package/node_modules/socks/docs/examples/typescript/connectExample.md +0 -265
  1009. package/node_modules/socks/docs/index.md +0 -5
  1010. package/node_modules/socks/docs/migratingFromV1.md +0 -86
  1011. package/node_modules/socks/package.json +0 -58
  1012. package/node_modules/socks/typings/client/socksclient.d.ts +0 -162
  1013. package/node_modules/socks/typings/common/constants.d.ts +0 -151
  1014. package/node_modules/socks/typings/common/helpers.d.ts +0 -17
  1015. package/node_modules/socks/typings/common/receivebuffer.d.ts +0 -12
  1016. package/node_modules/socks/typings/common/util.d.ts +0 -14
  1017. package/node_modules/socks/typings/index.d.ts +0 -1
  1018. package/node_modules/socks-proxy-agent/LICENSE +0 -22
  1019. package/node_modules/socks-proxy-agent/README.md +0 -50
  1020. package/node_modules/socks-proxy-agent/dist/index.d.ts +0 -27
  1021. package/node_modules/socks-proxy-agent/dist/index.d.ts.map +0 -1
  1022. package/node_modules/socks-proxy-agent/dist/index.js +0 -195
  1023. package/node_modules/socks-proxy-agent/dist/index.js.map +0 -1
  1024. package/node_modules/socks-proxy-agent/package.json +0 -142
  1025. package/node_modules/source-map/LICENSE +0 -28
  1026. package/node_modules/source-map/README.md +0 -742
  1027. package/node_modules/source-map/dist/source-map.debug.js +0 -3234
  1028. package/node_modules/source-map/dist/source-map.js +0 -3233
  1029. package/node_modules/source-map/dist/source-map.min.js +0 -2
  1030. package/node_modules/source-map/dist/source-map.min.js.map +0 -1
  1031. package/node_modules/source-map/lib/array-set.js +0 -121
  1032. package/node_modules/source-map/lib/base64-vlq.js +0 -140
  1033. package/node_modules/source-map/lib/base64.js +0 -67
  1034. package/node_modules/source-map/lib/binary-search.js +0 -111
  1035. package/node_modules/source-map/lib/mapping-list.js +0 -79
  1036. package/node_modules/source-map/lib/quick-sort.js +0 -114
  1037. package/node_modules/source-map/lib/source-map-consumer.js +0 -1145
  1038. package/node_modules/source-map/lib/source-map-generator.js +0 -425
  1039. package/node_modules/source-map/lib/source-node.js +0 -413
  1040. package/node_modules/source-map/lib/util.js +0 -488
  1041. package/node_modules/source-map/package.json +0 -73
  1042. package/node_modules/source-map/source-map.d.ts +0 -98
  1043. package/node_modules/source-map/source-map.js +0 -8
  1044. package/node_modules/string-width/index.d.ts +0 -29
  1045. package/node_modules/string-width/index.js +0 -47
  1046. package/node_modules/string-width/license +0 -9
  1047. package/node_modules/string-width/node_modules/ansi-regex/index.d.ts +0 -37
  1048. package/node_modules/string-width/node_modules/ansi-regex/index.js +0 -10
  1049. package/node_modules/string-width/node_modules/ansi-regex/license +0 -9
  1050. package/node_modules/string-width/node_modules/ansi-regex/package.json +0 -55
  1051. package/node_modules/string-width/node_modules/ansi-regex/readme.md +0 -78
  1052. package/node_modules/string-width/node_modules/strip-ansi/index.d.ts +0 -17
  1053. package/node_modules/string-width/node_modules/strip-ansi/index.js +0 -4
  1054. package/node_modules/string-width/node_modules/strip-ansi/license +0 -9
  1055. package/node_modules/string-width/node_modules/strip-ansi/package.json +0 -54
  1056. package/node_modules/string-width/node_modules/strip-ansi/readme.md +0 -46
  1057. package/node_modules/string-width/package.json +0 -56
  1058. package/node_modules/string-width/readme.md +0 -50
  1059. package/node_modules/strip-ansi/index.d.ts +0 -15
  1060. package/node_modules/strip-ansi/index.js +0 -19
  1061. package/node_modules/strip-ansi/license +0 -9
  1062. package/node_modules/strip-ansi/package.json +0 -59
  1063. package/node_modules/strip-ansi/readme.md +0 -37
  1064. package/node_modules/strtok3/LICENSE.txt +0 -21
  1065. package/node_modules/strtok3/README.md +0 -399
  1066. package/node_modules/strtok3/lib/AbstractTokenizer.d.ts +0 -76
  1067. package/node_modules/strtok3/lib/AbstractTokenizer.js +0 -111
  1068. package/node_modules/strtok3/lib/BlobTokenizer.d.ts +0 -29
  1069. package/node_modules/strtok3/lib/BlobTokenizer.js +0 -53
  1070. package/node_modules/strtok3/lib/BufferTokenizer.d.ts +0 -29
  1071. package/node_modules/strtok3/lib/BufferTokenizer.js +0 -52
  1072. package/node_modules/strtok3/lib/FileTokenizer.d.ts +0 -37
  1073. package/node_modules/strtok3/lib/FileTokenizer.js +0 -61
  1074. package/node_modules/strtok3/lib/ReadStreamTokenizer.d.ts +0 -34
  1075. package/node_modules/strtok3/lib/ReadStreamTokenizer.js +0 -107
  1076. package/node_modules/strtok3/lib/core.d.ts +0 -40
  1077. package/node_modules/strtok3/lib/core.js +0 -62
  1078. package/node_modules/strtok3/lib/index.d.ts +0 -16
  1079. package/node_modules/strtok3/lib/index.js +0 -22
  1080. package/node_modules/strtok3/lib/stream/AbstractStreamReader.d.ts +0 -54
  1081. package/node_modules/strtok3/lib/stream/AbstractStreamReader.js +0 -71
  1082. package/node_modules/strtok3/lib/stream/Deferred.d.ts +0 -6
  1083. package/node_modules/strtok3/lib/stream/Deferred.js +0 -10
  1084. package/node_modules/strtok3/lib/stream/Errors.d.ts +0 -10
  1085. package/node_modules/strtok3/lib/stream/Errors.js +0 -16
  1086. package/node_modules/strtok3/lib/stream/StreamReader.d.ts +0 -29
  1087. package/node_modules/strtok3/lib/stream/StreamReader.js +0 -83
  1088. package/node_modules/strtok3/lib/stream/WebStreamByobReader.d.ts +0 -14
  1089. package/node_modules/strtok3/lib/stream/WebStreamByobReader.js +0 -27
  1090. package/node_modules/strtok3/lib/stream/WebStreamDefaultReader.d.ts +0 -19
  1091. package/node_modules/strtok3/lib/stream/WebStreamDefaultReader.js +0 -62
  1092. package/node_modules/strtok3/lib/stream/WebStreamReader.d.ts +0 -14
  1093. package/node_modules/strtok3/lib/stream/WebStreamReader.js +0 -13
  1094. package/node_modules/strtok3/lib/stream/WebStreamReaderFactory.d.ts +0 -5
  1095. package/node_modules/strtok3/lib/stream/WebStreamReaderFactory.js +0 -19
  1096. package/node_modules/strtok3/lib/stream/index.d.ts +0 -6
  1097. package/node_modules/strtok3/lib/stream/index.js +0 -5
  1098. package/node_modules/strtok3/lib/types.d.ts +0 -139
  1099. package/node_modules/strtok3/lib/types.js +0 -1
  1100. package/node_modules/strtok3/package.json +0 -94
  1101. package/node_modules/supports-color/browser.js +0 -5
  1102. package/node_modules/supports-color/index.js +0 -135
  1103. package/node_modules/supports-color/license +0 -9
  1104. package/node_modules/supports-color/package.json +0 -53
  1105. package/node_modules/supports-color/readme.md +0 -76
  1106. package/node_modules/thenify/LICENSE +0 -22
  1107. package/node_modules/thenify/README.md +0 -120
  1108. package/node_modules/thenify/index.js +0 -77
  1109. package/node_modules/thenify/package.json +0 -31
  1110. package/node_modules/thenify-all/LICENSE +0 -22
  1111. package/node_modules/thenify-all/README.md +0 -66
  1112. package/node_modules/thenify-all/index.js +0 -73
  1113. package/node_modules/thenify-all/package.json +0 -34
  1114. package/node_modules/token-types/LICENSE.txt +0 -9
  1115. package/node_modules/token-types/README.md +0 -120
  1116. package/node_modules/token-types/lib/index.d.ts +0 -135
  1117. package/node_modules/token-types/lib/index.js +0 -401
  1118. package/node_modules/token-types/package.json +0 -81
  1119. package/node_modules/uint8array-extras/index.d.ts +0 -331
  1120. package/node_modules/uint8array-extras/index.js +0 -318
  1121. package/node_modules/uint8array-extras/license +0 -9
  1122. package/node_modules/uint8array-extras/package.json +0 -54
  1123. package/node_modules/uint8array-extras/readme.md +0 -318
  1124. package/node_modules/uuid/LICENSE.md +0 -9
  1125. package/node_modules/uuid/README.md +0 -491
  1126. package/node_modules/uuid/dist/index.d.ts +0 -15
  1127. package/node_modules/uuid/dist/index.js +0 -14
  1128. package/node_modules/uuid/dist/max.d.ts +0 -2
  1129. package/node_modules/uuid/dist/max.js +0 -1
  1130. package/node_modules/uuid/dist/md5.d.ts +0 -2
  1131. package/node_modules/uuid/dist/md5.js +0 -135
  1132. package/node_modules/uuid/dist/nil.d.ts +0 -2
  1133. package/node_modules/uuid/dist/nil.js +0 -1
  1134. package/node_modules/uuid/dist/parse.d.ts +0 -3
  1135. package/node_modules/uuid/dist/parse.js +0 -9
  1136. package/node_modules/uuid/dist/regex.d.ts +0 -2
  1137. package/node_modules/uuid/dist/regex.js +0 -1
  1138. package/node_modules/uuid/dist/rng.d.ts +0 -1
  1139. package/node_modules/uuid/dist/rng.js +0 -4
  1140. package/node_modules/uuid/dist/sha1.d.ts +0 -2
  1141. package/node_modules/uuid/dist/sha1.js +0 -70
  1142. package/node_modules/uuid/dist/stringify.d.ts +0 -3
  1143. package/node_modules/uuid/dist/stringify.js +0 -35
  1144. package/node_modules/uuid/dist/types.d.ts +0 -22
  1145. package/node_modules/uuid/dist/types.js +0 -1
  1146. package/node_modules/uuid/dist/uuid-bin.d.ts +0 -1
  1147. package/node_modules/uuid/dist/uuid-bin.js +0 -70
  1148. package/node_modules/uuid/dist/v1.d.ts +0 -11
  1149. package/node_modules/uuid/dist/v1.js +0 -83
  1150. package/node_modules/uuid/dist/v1ToV6.d.ts +0 -3
  1151. package/node_modules/uuid/dist/v1ToV6.js +0 -10
  1152. package/node_modules/uuid/dist/v3.d.ts +0 -9
  1153. package/node_modules/uuid/dist/v3.js +0 -9
  1154. package/node_modules/uuid/dist/v35.d.ts +0 -7
  1155. package/node_modules/uuid/dist/v35.js +0 -39
  1156. package/node_modules/uuid/dist/v4.d.ts +0 -4
  1157. package/node_modules/uuid/dist/v4.js +0 -29
  1158. package/node_modules/uuid/dist/v5.d.ts +0 -9
  1159. package/node_modules/uuid/dist/v5.js +0 -9
  1160. package/node_modules/uuid/dist/v6.d.ts +0 -4
  1161. package/node_modules/uuid/dist/v6.js +0 -20
  1162. package/node_modules/uuid/dist/v6ToV1.d.ts +0 -2
  1163. package/node_modules/uuid/dist/v6ToV1.js +0 -10
  1164. package/node_modules/uuid/dist/v7.d.ts +0 -9
  1165. package/node_modules/uuid/dist/v7.js +0 -65
  1166. package/node_modules/uuid/dist/validate.d.ts +0 -2
  1167. package/node_modules/uuid/dist/validate.js +0 -5
  1168. package/node_modules/uuid/dist/version.d.ts +0 -2
  1169. package/node_modules/uuid/dist/version.js +0 -8
  1170. package/node_modules/uuid/dist-node/bin/uuid +0 -2
  1171. package/node_modules/uuid/dist-node/index.js +0 -14
  1172. package/node_modules/uuid/dist-node/max.js +0 -1
  1173. package/node_modules/uuid/dist-node/md5.js +0 -11
  1174. package/node_modules/uuid/dist-node/nil.js +0 -1
  1175. package/node_modules/uuid/dist-node/parse.js +0 -9
  1176. package/node_modules/uuid/dist-node/regex.js +0 -1
  1177. package/node_modules/uuid/dist-node/rng.js +0 -4
  1178. package/node_modules/uuid/dist-node/sha1.js +0 -11
  1179. package/node_modules/uuid/dist-node/stringify.js +0 -35
  1180. package/node_modules/uuid/dist-node/types.js +0 -1
  1181. package/node_modules/uuid/dist-node/uuid-bin.js +0 -70
  1182. package/node_modules/uuid/dist-node/v1.js +0 -83
  1183. package/node_modules/uuid/dist-node/v1ToV6.js +0 -10
  1184. package/node_modules/uuid/dist-node/v3.js +0 -9
  1185. package/node_modules/uuid/dist-node/v35.js +0 -39
  1186. package/node_modules/uuid/dist-node/v4.js +0 -29
  1187. package/node_modules/uuid/dist-node/v5.js +0 -9
  1188. package/node_modules/uuid/dist-node/v6.js +0 -20
  1189. package/node_modules/uuid/dist-node/v6ToV1.js +0 -10
  1190. package/node_modules/uuid/dist-node/v7.js +0 -65
  1191. package/node_modules/uuid/dist-node/validate.js +0 -5
  1192. package/node_modules/uuid/dist-node/version.js +0 -8
  1193. package/node_modules/uuid/package.json +0 -110
  1194. package/node_modules/wrap-ansi/index.js +0 -216
  1195. package/node_modules/wrap-ansi/license +0 -9
  1196. package/node_modules/wrap-ansi/node_modules/ansi-regex/index.d.ts +0 -37
  1197. package/node_modules/wrap-ansi/node_modules/ansi-regex/index.js +0 -10
  1198. package/node_modules/wrap-ansi/node_modules/ansi-regex/license +0 -9
  1199. package/node_modules/wrap-ansi/node_modules/ansi-regex/package.json +0 -55
  1200. package/node_modules/wrap-ansi/node_modules/ansi-regex/readme.md +0 -78
  1201. package/node_modules/wrap-ansi/node_modules/strip-ansi/index.d.ts +0 -17
  1202. package/node_modules/wrap-ansi/node_modules/strip-ansi/index.js +0 -4
  1203. package/node_modules/wrap-ansi/node_modules/strip-ansi/license +0 -9
  1204. package/node_modules/wrap-ansi/node_modules/strip-ansi/package.json +0 -54
  1205. package/node_modules/wrap-ansi/node_modules/strip-ansi/readme.md +0 -46
  1206. package/node_modules/wrap-ansi/package.json +0 -62
  1207. package/node_modules/wrap-ansi/readme.md +0 -91
  1208. package/node_modules/wrappy/README.md +0 -36
  1209. package/node_modules/wrappy/package.json +0 -29
  1210. package/node_modules/wrappy/wrappy.js +0 -33
  1211. package/node_modules/y18n/LICENSE +0 -13
  1212. package/node_modules/y18n/README.md +0 -127
  1213. package/node_modules/y18n/build/index.cjs +0 -203
  1214. package/node_modules/y18n/build/lib/cjs.js +0 -6
  1215. package/node_modules/y18n/build/lib/index.js +0 -174
  1216. package/node_modules/y18n/build/lib/platform-shims/node.js +0 -19
  1217. package/node_modules/y18n/index.mjs +0 -8
  1218. package/node_modules/y18n/package.json +0 -70
  1219. package/node_modules/yargs/LICENSE +0 -21
  1220. package/node_modules/yargs/README.md +0 -202
  1221. package/node_modules/yargs/browser.mjs +0 -7
  1222. package/node_modules/yargs/build/index.cjs +0 -2920
  1223. package/node_modules/yargs/build/lib/argsert.js +0 -62
  1224. package/node_modules/yargs/build/lib/command.js +0 -382
  1225. package/node_modules/yargs/build/lib/completion-templates.js +0 -47
  1226. package/node_modules/yargs/build/lib/completion.js +0 -128
  1227. package/node_modules/yargs/build/lib/middleware.js +0 -53
  1228. package/node_modules/yargs/build/lib/parse-command.js +0 -32
  1229. package/node_modules/yargs/build/lib/typings/common-types.js +0 -9
  1230. package/node_modules/yargs/build/lib/typings/yargs-parser-types.js +0 -1
  1231. package/node_modules/yargs/build/lib/usage.js +0 -548
  1232. package/node_modules/yargs/build/lib/utils/apply-extends.js +0 -59
  1233. package/node_modules/yargs/build/lib/utils/is-promise.js +0 -5
  1234. package/node_modules/yargs/build/lib/utils/levenshtein.js +0 -26
  1235. package/node_modules/yargs/build/lib/utils/obj-filter.js +0 -10
  1236. package/node_modules/yargs/build/lib/utils/process-argv.js +0 -17
  1237. package/node_modules/yargs/build/lib/utils/set-blocking.js +0 -12
  1238. package/node_modules/yargs/build/lib/utils/which-module.js +0 -10
  1239. package/node_modules/yargs/build/lib/validation.js +0 -308
  1240. package/node_modules/yargs/build/lib/yargs-factory.js +0 -1143
  1241. package/node_modules/yargs/build/lib/yerror.js +0 -7
  1242. package/node_modules/yargs/helpers/helpers.mjs +0 -10
  1243. package/node_modules/yargs/helpers/index.js +0 -14
  1244. package/node_modules/yargs/helpers/package.json +0 -3
  1245. package/node_modules/yargs/index.cjs +0 -39
  1246. package/node_modules/yargs/index.mjs +0 -8
  1247. package/node_modules/yargs/lib/platform-shims/browser.mjs +0 -92
  1248. package/node_modules/yargs/lib/platform-shims/esm.mjs +0 -67
  1249. package/node_modules/yargs/locales/be.json +0 -46
  1250. package/node_modules/yargs/locales/de.json +0 -46
  1251. package/node_modules/yargs/locales/en.json +0 -51
  1252. package/node_modules/yargs/locales/es.json +0 -46
  1253. package/node_modules/yargs/locales/fi.json +0 -49
  1254. package/node_modules/yargs/locales/fr.json +0 -53
  1255. package/node_modules/yargs/locales/hi.json +0 -49
  1256. package/node_modules/yargs/locales/hu.json +0 -46
  1257. package/node_modules/yargs/locales/id.json +0 -50
  1258. package/node_modules/yargs/locales/it.json +0 -46
  1259. package/node_modules/yargs/locales/ja.json +0 -51
  1260. package/node_modules/yargs/locales/ko.json +0 -49
  1261. package/node_modules/yargs/locales/nb.json +0 -44
  1262. package/node_modules/yargs/locales/nl.json +0 -49
  1263. package/node_modules/yargs/locales/nn.json +0 -44
  1264. package/node_modules/yargs/locales/pirate.json +0 -13
  1265. package/node_modules/yargs/locales/pl.json +0 -49
  1266. package/node_modules/yargs/locales/pt.json +0 -45
  1267. package/node_modules/yargs/locales/pt_BR.json +0 -48
  1268. package/node_modules/yargs/locales/ru.json +0 -46
  1269. package/node_modules/yargs/locales/th.json +0 -46
  1270. package/node_modules/yargs/locales/tr.json +0 -48
  1271. package/node_modules/yargs/locales/zh_CN.json +0 -48
  1272. package/node_modules/yargs/locales/zh_TW.json +0 -47
  1273. package/node_modules/yargs/package.json +0 -122
  1274. package/node_modules/yargs/yargs +0 -9
  1275. package/node_modules/yargs-parser/LICENSE.txt +0 -14
  1276. package/node_modules/yargs-parser/README.md +0 -518
  1277. package/node_modules/yargs-parser/browser.js +0 -29
  1278. package/node_modules/yargs-parser/build/index.cjs +0 -1042
  1279. package/node_modules/yargs-parser/build/lib/index.js +0 -59
  1280. package/node_modules/yargs-parser/build/lib/string-utils.js +0 -65
  1281. package/node_modules/yargs-parser/build/lib/tokenize-arg-string.js +0 -40
  1282. package/node_modules/yargs-parser/build/lib/yargs-parser-types.js +0 -12
  1283. package/node_modules/yargs-parser/build/lib/yargs-parser.js +0 -1037
  1284. package/node_modules/yargs-parser/package.json +0 -87
  1285. package/node_modules/yauzl/LICENSE +0 -21
  1286. package/node_modules/yauzl/README.md +0 -658
  1287. package/node_modules/yauzl/index.js +0 -796
  1288. package/node_modules/yauzl/package.json +0 -40
  1289. /package/node_modules/{once → isexe}/LICENSE +0 -0
  1290. /package/node_modules/{ansi-styles → path-key}/license +0 -0
  1291. /package/node_modules/{cli-highlight/node_modules/chalk → shebang-regex}/license +0 -0
  1292. /package/node_modules/{wrappy → which}/LICENSE +0 -0
@@ -0,0 +1,2403 @@
1
+ // https://github.com/Ethan-Arrowood/undici-fetch
2
+
3
+ 'use strict'
4
+
5
+ const {
6
+ makeNetworkError,
7
+ makeAppropriateNetworkError,
8
+ filterResponse,
9
+ makeResponse,
10
+ fromInnerResponse,
11
+ getResponseState
12
+ } = require('./response')
13
+ const { HeadersList } = require('./headers')
14
+ const { Request, cloneRequest, getRequestDispatcher, getRequestState } = require('./request')
15
+ const zlib = require('node:zlib')
16
+ const {
17
+ makePolicyContainer,
18
+ clonePolicyContainer,
19
+ requestBadPort,
20
+ TAOCheck,
21
+ appendRequestOriginHeader,
22
+ responseLocationURL,
23
+ requestCurrentURL,
24
+ setRequestReferrerPolicyOnRedirect,
25
+ tryUpgradeRequestToAPotentiallyTrustworthyURL,
26
+ createOpaqueTimingInfo,
27
+ appendFetchMetadata,
28
+ corsCheck,
29
+ crossOriginResourcePolicyCheck,
30
+ determineRequestsReferrer,
31
+ coarsenedSharedCurrentTime,
32
+ sameOrigin,
33
+ isCancelled,
34
+ isAborted,
35
+ isErrorLike,
36
+ fullyReadBody,
37
+ readableStreamClose,
38
+ urlIsLocal,
39
+ urlIsHttpHttpsScheme,
40
+ urlHasHttpsScheme,
41
+ clampAndCoarsenConnectionTimingInfo,
42
+ simpleRangeHeaderValue,
43
+ buildContentRange,
44
+ createInflate,
45
+ extractMimeType,
46
+ hasAuthenticationEntry,
47
+ includesCredentials,
48
+ isTraversableNavigable
49
+ } = require('./util')
50
+ const assert = require('node:assert')
51
+ const { safelyExtractBody, extractBody } = require('./body')
52
+ const {
53
+ redirectStatusSet,
54
+ nullBodyStatus,
55
+ safeMethodsSet,
56
+ requestBodyHeader,
57
+ subresourceSet
58
+ } = require('./constants')
59
+ const EE = require('node:events')
60
+ const { Readable, pipeline, finished, isErrored, isReadable } = require('node:stream')
61
+ const { addAbortListener, bufferToLowerCasedHeaderName } = require('../../core/util')
62
+ const { dataURLProcessor, serializeAMimeType, minimizeSupportedMimeType } = require('./data-url')
63
+ const { getGlobalDispatcher } = require('../../global')
64
+ const { webidl } = require('../webidl')
65
+ const { STATUS_CODES } = require('node:http')
66
+ const { bytesMatch } = require('../subresource-integrity/subresource-integrity')
67
+ const { isomorphicEncode } = require('../infra')
68
+
69
+ const GET_OR_HEAD = ['GET', 'HEAD']
70
+
71
+ const defaultUserAgent = typeof __UNDICI_IS_NODE__ !== 'undefined' || typeof esbuildDetection !== 'undefined'
72
+ ? 'node'
73
+ : 'undici'
74
+
75
+ /** @type {import('buffer').resolveObjectURL} */
76
+ let resolveObjectURL
77
+
78
+ function appendHeadersListFromResponseHeaders (headersList, headers, rawHeaders) {
79
+ if (Array.isArray(rawHeaders)) {
80
+ for (let i = 0; i < rawHeaders.length; i += 2) {
81
+ const nameStr = bufferToLowerCasedHeaderName(rawHeaders[i])
82
+ const value = rawHeaders[i + 1]
83
+
84
+ if (Array.isArray(value) && !Buffer.isBuffer(value)) {
85
+ for (const val of value) {
86
+ headersList.append(nameStr, val.toString('latin1'), true)
87
+ }
88
+ } else {
89
+ headersList.append(nameStr, value.toString('latin1'), true)
90
+ }
91
+ }
92
+
93
+ return
94
+ }
95
+
96
+ for (const [name, value] of Object.entries(headers ?? {})) {
97
+ if (Array.isArray(value)) {
98
+ for (const entry of value) {
99
+ headersList.append(name, `${entry}`, true)
100
+ }
101
+ } else {
102
+ headersList.append(name, `${value}`, true)
103
+ }
104
+ }
105
+ }
106
+
107
+ class Fetch extends EE {
108
+ constructor (dispatcher) {
109
+ super()
110
+
111
+ this.dispatcher = dispatcher
112
+ this.connection = null
113
+ this.dump = false
114
+ this.state = 'ongoing'
115
+ }
116
+
117
+ terminate (reason) {
118
+ if (this.state !== 'ongoing') {
119
+ return
120
+ }
121
+
122
+ this.state = 'terminated'
123
+ this.connection?.destroy(reason)
124
+ this.emit('terminated', reason)
125
+ }
126
+
127
+ // https://fetch.spec.whatwg.org/#fetch-controller-abort
128
+ abort (error) {
129
+ if (this.state !== 'ongoing') {
130
+ return
131
+ }
132
+
133
+ // 1. Set controller’s state to "aborted".
134
+ this.state = 'aborted'
135
+
136
+ // 2. Let fallbackError be an "AbortError" DOMException.
137
+ // 3. Set error to fallbackError if it is not given.
138
+ if (!error) {
139
+ error = new DOMException('The operation was aborted.', 'AbortError')
140
+ }
141
+
142
+ // 4. Let serializedError be StructuredSerialize(error).
143
+ // If that threw an exception, catch it, and let
144
+ // serializedError be StructuredSerialize(fallbackError).
145
+
146
+ // 5. Set controller’s serialized abort reason to serializedError.
147
+ this.serializedAbortReason = error
148
+
149
+ this.connection?.destroy(error)
150
+ this.emit('terminated', error)
151
+ }
152
+ }
153
+
154
+ function handleFetchDone (response) {
155
+ finalizeAndReportTiming(response, 'fetch')
156
+ }
157
+
158
+ // https://fetch.spec.whatwg.org/#fetch-method
159
+ function fetch (input, init = undefined) {
160
+ webidl.argumentLengthCheck(arguments, 1, 'globalThis.fetch')
161
+
162
+ // 1. Let p be a new promise.
163
+ let p = Promise.withResolvers()
164
+
165
+ // 2. Let requestObject be the result of invoking the initial value of
166
+ // Request as constructor with input and init as arguments. If this throws
167
+ // an exception, reject p with it and return p.
168
+ let requestObject
169
+
170
+ try {
171
+ requestObject = new Request(input, init)
172
+ } catch (e) {
173
+ p.reject(e)
174
+ return p.promise
175
+ }
176
+
177
+ // 3. Let request be requestObject’s request.
178
+ const request = getRequestState(requestObject)
179
+
180
+ // 4. If requestObject’s signal’s aborted flag is set, then:
181
+ if (requestObject.signal.aborted) {
182
+ // 1. Abort the fetch() call with p, request, null, and
183
+ // requestObject’s signal’s abort reason.
184
+ abortFetch(p, request, null, requestObject.signal.reason, null)
185
+
186
+ // 2. Return p.
187
+ return p.promise
188
+ }
189
+
190
+ // 5. Let globalObject be request’s client’s global object.
191
+ const globalObject = request.client.globalObject
192
+
193
+ // 6. If globalObject is a ServiceWorkerGlobalScope object, then set
194
+ // request’s service-workers mode to "none".
195
+ if (globalObject?.constructor?.name === 'ServiceWorkerGlobalScope') {
196
+ request.serviceWorkers = 'none'
197
+ }
198
+
199
+ // 7. Let responseObject be null.
200
+ let responseObject = null
201
+
202
+ // 8. Let relevantRealm be this’s relevant Realm.
203
+
204
+ // 9. Let locallyAborted be false.
205
+ let locallyAborted = false
206
+
207
+ // 10. Let controller be null.
208
+ let controller = null
209
+
210
+ // 11. Add the following abort steps to requestObject’s signal:
211
+ addAbortListener(
212
+ requestObject.signal,
213
+ () => {
214
+ // 1. Set locallyAborted to true.
215
+ locallyAborted = true
216
+
217
+ // 2. Assert: controller is non-null.
218
+ assert(controller != null)
219
+
220
+ // 3. Abort controller with requestObject’s signal’s abort reason.
221
+ controller.abort(requestObject.signal.reason)
222
+
223
+ const realResponse = responseObject?.deref()
224
+
225
+ // 4. Abort the fetch() call with p, request, responseObject,
226
+ // and requestObject’s signal’s abort reason.
227
+ abortFetch(p, request, realResponse, requestObject.signal.reason, controller.controller)
228
+ }
229
+ )
230
+
231
+ // 12. Let handleFetchDone given response response be to finalize and
232
+ // report timing with response, globalObject, and "fetch".
233
+ // see function handleFetchDone
234
+
235
+ // 13. Set controller to the result of calling fetch given request,
236
+ // with processResponseEndOfBody set to handleFetchDone, and processResponse
237
+ // given response being these substeps:
238
+
239
+ const processResponse = (response) => {
240
+ // 1. If locallyAborted is true, terminate these substeps.
241
+ if (locallyAborted) {
242
+ return
243
+ }
244
+
245
+ // 2. If response’s aborted flag is set, then:
246
+ if (response.aborted) {
247
+ // 1. Let deserializedError be the result of deserialize a serialized
248
+ // abort reason given controller’s serialized abort reason and
249
+ // relevantRealm.
250
+
251
+ // 2. Abort the fetch() call with p, request, responseObject, and
252
+ // deserializedError.
253
+
254
+ abortFetch(p, request, responseObject, controller.serializedAbortReason, controller.controller)
255
+ return
256
+ }
257
+
258
+ // 3. If response is a network error, then reject p with a TypeError
259
+ // and terminate these substeps.
260
+ if (response.type === 'error') {
261
+ p.reject(new TypeError('fetch failed', { cause: response.error }))
262
+ return
263
+ }
264
+
265
+ // 4. Set responseObject to the result of creating a Response object,
266
+ // given response, "immutable", and relevantRealm.
267
+ responseObject = new WeakRef(fromInnerResponse(response, 'immutable'))
268
+
269
+ // 5. Resolve p with responseObject.
270
+ p.resolve(responseObject.deref())
271
+ p = null
272
+ }
273
+
274
+ controller = fetching({
275
+ request,
276
+ processResponseEndOfBody: handleFetchDone,
277
+ processResponse,
278
+ dispatcher: getRequestDispatcher(requestObject), // undici
279
+ // Keep requestObject alive to prevent its AbortController from being GC'd
280
+ // See https://github.com/nodejs/undici/issues/4627
281
+ requestObject
282
+ })
283
+
284
+ // 14. Return p.
285
+ return p.promise
286
+ }
287
+
288
+ // https://fetch.spec.whatwg.org/#finalize-and-report-timing
289
+ function finalizeAndReportTiming (response, initiatorType = 'other') {
290
+ // 1. If response is an aborted network error, then return.
291
+ if (response.type === 'error' && response.aborted) {
292
+ return
293
+ }
294
+
295
+ // 2. If response’s URL list is null or empty, then return.
296
+ if (!response.urlList?.length) {
297
+ return
298
+ }
299
+
300
+ // 3. Let originalURL be response’s URL list[0].
301
+ const originalURL = response.urlList[0]
302
+
303
+ // 4. Let timingInfo be response’s timing info.
304
+ let timingInfo = response.timingInfo
305
+
306
+ // 5. Let cacheState be response’s cache state.
307
+ let cacheState = response.cacheState
308
+
309
+ // 6. If originalURL’s scheme is not an HTTP(S) scheme, then return.
310
+ if (!urlIsHttpHttpsScheme(originalURL)) {
311
+ return
312
+ }
313
+
314
+ // 7. If timingInfo is null, then return.
315
+ if (timingInfo === null) {
316
+ return
317
+ }
318
+
319
+ // 8. If response’s timing allow passed flag is not set, then:
320
+ if (!response.timingAllowPassed) {
321
+ // 1. Set timingInfo to a the result of creating an opaque timing info for timingInfo.
322
+ timingInfo = createOpaqueTimingInfo({
323
+ startTime: timingInfo.startTime
324
+ })
325
+
326
+ // 2. Set cacheState to the empty string.
327
+ cacheState = ''
328
+ }
329
+
330
+ // 9. Set timingInfo’s end time to the coarsened shared current time
331
+ // given global’s relevant settings object’s cross-origin isolated
332
+ // capability.
333
+ // TODO: given global’s relevant settings object’s cross-origin isolated
334
+ // capability?
335
+ timingInfo.endTime = coarsenedSharedCurrentTime()
336
+
337
+ // 10. Set response’s timing info to timingInfo.
338
+ response.timingInfo = timingInfo
339
+
340
+ // 11. Mark resource timing for timingInfo, originalURL, initiatorType,
341
+ // global, and cacheState.
342
+ markResourceTiming(
343
+ timingInfo,
344
+ originalURL.href,
345
+ initiatorType,
346
+ globalThis,
347
+ cacheState,
348
+ '', // bodyType
349
+ response.status
350
+ )
351
+ }
352
+
353
+ // https://w3c.github.io/resource-timing/#dfn-mark-resource-timing
354
+ const markResourceTiming = performance.markResourceTiming
355
+
356
+ // https://fetch.spec.whatwg.org/#abort-fetch
357
+ function abortFetch (p, request, responseObject, error, controller /* undici-specific */) {
358
+ // 1. Reject promise with error.
359
+ if (p) {
360
+ // We might have already resolved the promise at this stage
361
+ p.reject(error)
362
+ }
363
+
364
+ // 2. If request’s body is not null and is readable, then cancel request’s
365
+ // body with error.
366
+ if (request.body?.stream != null && isReadable(request.body.stream)) {
367
+ request.body.stream.cancel(error).catch((err) => {
368
+ if (err.code === 'ERR_INVALID_STATE') {
369
+ // Node bug?
370
+ return
371
+ }
372
+ throw err
373
+ })
374
+ }
375
+
376
+ // 3. If responseObject is null, then return.
377
+ if (responseObject == null) {
378
+ return
379
+ }
380
+
381
+ // 4. Let response be responseObject’s response.
382
+ const response = getResponseState(responseObject)
383
+
384
+ // 5. If response’s body is not null and is readable, then error response’s
385
+ // body with error.
386
+ if (response.body?.stream != null && isReadable(response.body.stream)) {
387
+ controller.error(error)
388
+ }
389
+ }
390
+
391
+ // https://fetch.spec.whatwg.org/#fetching
392
+ function fetching ({
393
+ request,
394
+ processRequestBodyChunkLength,
395
+ processRequestEndOfBody,
396
+ processResponse,
397
+ processResponseEndOfBody,
398
+ processResponseConsumeBody,
399
+ useParallelQueue = false,
400
+ dispatcher = getGlobalDispatcher(), // undici
401
+ requestObject = null // Keep alive to prevent AbortController GC, see #4627
402
+ }) {
403
+ // Ensure that the dispatcher is set accordingly
404
+ assert(dispatcher)
405
+
406
+ // 1. Let taskDestination be null.
407
+ let taskDestination = null
408
+
409
+ // 2. Let crossOriginIsolatedCapability be false.
410
+ let crossOriginIsolatedCapability = false
411
+
412
+ // 3. If request’s client is non-null, then:
413
+ if (request.client != null) {
414
+ // 1. Set taskDestination to request’s client’s global object.
415
+ taskDestination = request.client.globalObject
416
+
417
+ // 2. Set crossOriginIsolatedCapability to request’s client’s cross-origin
418
+ // isolated capability.
419
+ crossOriginIsolatedCapability =
420
+ request.client.crossOriginIsolatedCapability
421
+ }
422
+
423
+ // 4. If useParallelQueue is true, then set taskDestination to the result of
424
+ // starting a new parallel queue.
425
+ // TODO
426
+
427
+ // 5. Let timingInfo be a new fetch timing info whose start time and
428
+ // post-redirect start time are the coarsened shared current time given
429
+ // crossOriginIsolatedCapability.
430
+ const currentTime = coarsenedSharedCurrentTime(crossOriginIsolatedCapability)
431
+ const timingInfo = createOpaqueTimingInfo({
432
+ startTime: currentTime
433
+ })
434
+
435
+ // 6. Let fetchParams be a new fetch params whose
436
+ // request is request,
437
+ // timing info is timingInfo,
438
+ // process request body chunk length is processRequestBodyChunkLength,
439
+ // process request end-of-body is processRequestEndOfBody,
440
+ // process response is processResponse,
441
+ // process response consume body is processResponseConsumeBody,
442
+ // process response end-of-body is processResponseEndOfBody,
443
+ // task destination is taskDestination,
444
+ // and cross-origin isolated capability is crossOriginIsolatedCapability.
445
+ const fetchParams = {
446
+ controller: new Fetch(dispatcher),
447
+ request,
448
+ timingInfo,
449
+ processRequestBodyChunkLength,
450
+ processRequestEndOfBody,
451
+ processResponse,
452
+ processResponseConsumeBody,
453
+ processResponseEndOfBody,
454
+ taskDestination,
455
+ crossOriginIsolatedCapability,
456
+ // Keep requestObject alive to prevent its AbortController from being GC'd
457
+ requestObject
458
+ }
459
+
460
+ // 7. If request’s body is a byte sequence, then set request’s body to
461
+ // request’s body as a body.
462
+ // NOTE: Since fetching is only called from fetch, body should already be
463
+ // extracted.
464
+ assert(!request.body || request.body.stream)
465
+
466
+ // 8. If request’s window is "client", then set request’s window to request’s
467
+ // client, if request’s client’s global object is a Window object; otherwise
468
+ // "no-window".
469
+ if (request.window === 'client') {
470
+ // TODO: What if request.client is null?
471
+ request.window =
472
+ request.client?.globalObject?.constructor?.name === 'Window'
473
+ ? request.client
474
+ : 'no-window'
475
+ }
476
+
477
+ // 9. If request’s origin is "client", then set request’s origin to request’s
478
+ // client’s origin.
479
+ if (request.origin === 'client') {
480
+ request.origin = request.client.origin
481
+ }
482
+
483
+ // 10. If all of the following conditions are true:
484
+ // TODO
485
+
486
+ // 11. If request’s policy container is "client", then:
487
+ if (request.policyContainer === 'client') {
488
+ // 1. If request’s client is non-null, then set request’s policy
489
+ // container to a clone of request’s client’s policy container. [HTML]
490
+ if (request.client != null) {
491
+ request.policyContainer = clonePolicyContainer(
492
+ request.client.policyContainer
493
+ )
494
+ } else {
495
+ // 2. Otherwise, set request’s policy container to a new policy
496
+ // container.
497
+ request.policyContainer = makePolicyContainer()
498
+ }
499
+ }
500
+
501
+ // 12. If request’s header list does not contain `Accept`, then:
502
+ if (!request.headersList.contains('accept', true)) {
503
+ // 1. Let value be `*/*`.
504
+ const value = '*/*'
505
+
506
+ // 2. A user agent should set value to the first matching statement, if
507
+ // any, switching on request’s destination:
508
+ // "document"
509
+ // "frame"
510
+ // "iframe"
511
+ // `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`
512
+ // "image"
513
+ // `image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5`
514
+ // "style"
515
+ // `text/css,*/*;q=0.1`
516
+ // TODO
517
+
518
+ // 3. Append `Accept`/value to request’s header list.
519
+ request.headersList.append('accept', value, true)
520
+ }
521
+
522
+ // 13. If request’s header list does not contain `Accept-Language`, then
523
+ // user agents should append `Accept-Language`/an appropriate value to
524
+ // request’s header list.
525
+ if (!request.headersList.contains('accept-language', true)) {
526
+ request.headersList.append('accept-language', '*', true)
527
+ }
528
+
529
+ // 14. If request’s priority is null, then use request’s initiator and
530
+ // destination appropriately in setting request’s priority to a
531
+ // user-agent-defined object.
532
+ if (request.priority === null) {
533
+ // TODO
534
+ }
535
+
536
+ // 15. If request is a subresource request, then:
537
+ if (subresourceSet.has(request.destination)) {
538
+ // TODO
539
+ }
540
+
541
+ // 16. Run main fetch given fetchParams.
542
+ mainFetch(fetchParams, false)
543
+
544
+ // 17. Return fetchParam's controller
545
+ return fetchParams.controller
546
+ }
547
+
548
+ // https://fetch.spec.whatwg.org/#concept-main-fetch
549
+ async function mainFetch (fetchParams, recursive) {
550
+ try {
551
+ // 1. Let request be fetchParams’s request.
552
+ const request = fetchParams.request
553
+
554
+ // 2. Let response be null.
555
+ let response = null
556
+
557
+ // 3. If request’s local-URLs-only flag is set and request’s current URL is
558
+ // not local, then set response to a network error.
559
+ if (request.localURLsOnly && !urlIsLocal(requestCurrentURL(request))) {
560
+ response = makeNetworkError('local URLs only')
561
+ }
562
+
563
+ // 4. Run report Content Security Policy violations for request.
564
+ // TODO
565
+
566
+ // 5. Upgrade request to a potentially trustworthy URL, if appropriate.
567
+ tryUpgradeRequestToAPotentiallyTrustworthyURL(request)
568
+
569
+ // 6. If should request be blocked due to a bad port, should fetching request
570
+ // be blocked as mixed content, or should request be blocked by Content
571
+ // Security Policy returns blocked, then set response to a network error.
572
+ if (requestBadPort(request) === 'blocked') {
573
+ response = makeNetworkError('bad port')
574
+ }
575
+ // TODO: should fetching request be blocked as mixed content?
576
+ // TODO: should request be blocked by Content Security Policy?
577
+
578
+ // 7. If request’s referrer policy is the empty string, then set request’s
579
+ // referrer policy to request’s policy container’s referrer policy.
580
+ if (request.referrerPolicy === '') {
581
+ request.referrerPolicy = request.policyContainer.referrerPolicy
582
+ }
583
+
584
+ // 8. If request’s referrer is not "no-referrer", then set request’s
585
+ // referrer to the result of invoking determine request’s referrer.
586
+ if (request.referrer !== 'no-referrer') {
587
+ request.referrer = determineRequestsReferrer(request)
588
+ }
589
+
590
+ // 9. Set request’s current URL’s scheme to "https" if all of the following
591
+ // conditions are true:
592
+ // - request’s current URL’s scheme is "http"
593
+ // - request’s current URL’s host is a domain
594
+ // - Matching request’s current URL’s host per Known HSTS Host Domain Name
595
+ // Matching results in either a superdomain match with an asserted
596
+ // includeSubDomains directive or a congruent match (with or without an
597
+ // asserted includeSubDomains directive). [HSTS]
598
+ // TODO
599
+
600
+ // 10. If recursive is false, then run the remaining steps in parallel.
601
+ // TODO
602
+
603
+ // 11. If response is null, then set response to the result of running
604
+ // the steps corresponding to the first matching statement:
605
+ if (response === null) {
606
+ const currentURL = requestCurrentURL(request)
607
+ if (
608
+ // - request’s current URL’s origin is same origin with request’s origin,
609
+ // and request’s response tainting is "basic"
610
+ (sameOrigin(currentURL, request.url) && request.responseTainting === 'basic') ||
611
+ // request’s current URL’s scheme is "data"
612
+ (currentURL.protocol === 'data:') ||
613
+ // - request’s mode is "navigate" or "websocket"
614
+ (request.mode === 'navigate' || request.mode === 'websocket')
615
+ ) {
616
+ // 1. Set request’s response tainting to "basic".
617
+ request.responseTainting = 'basic'
618
+
619
+ // 2. Return the result of running scheme fetch given fetchParams.
620
+ response = await schemeFetch(fetchParams)
621
+
622
+ // request’s mode is "same-origin"
623
+ } else if (request.mode === 'same-origin') {
624
+ // 1. Return a network error.
625
+ response = makeNetworkError('request mode cannot be "same-origin"')
626
+
627
+ // request’s mode is "no-cors"
628
+ } else if (request.mode === 'no-cors') {
629
+ // 1. If request’s redirect mode is not "follow", then return a network
630
+ // error.
631
+ if (request.redirect !== 'follow') {
632
+ response = makeNetworkError(
633
+ 'redirect mode cannot be "follow" for "no-cors" request'
634
+ )
635
+ } else {
636
+ // 2. Set request’s response tainting to "opaque".
637
+ request.responseTainting = 'opaque'
638
+
639
+ // 3. Return the result of running scheme fetch given fetchParams.
640
+ response = await schemeFetch(fetchParams)
641
+ }
642
+ // request’s current URL’s scheme is not an HTTP(S) scheme
643
+ } else if (!urlIsHttpHttpsScheme(requestCurrentURL(request))) {
644
+ // Return a network error.
645
+ response = makeNetworkError('URL scheme must be a HTTP(S) scheme')
646
+
647
+ // - request’s use-CORS-preflight flag is set
648
+ // - request’s unsafe-request flag is set and either request’s method is
649
+ // not a CORS-safelisted method or CORS-unsafe request-header names with
650
+ // request’s header list is not empty
651
+ // 1. Set request’s response tainting to "cors".
652
+ // 2. Let corsWithPreflightResponse be the result of running HTTP fetch
653
+ // given fetchParams and true.
654
+ // 3. If corsWithPreflightResponse is a network error, then clear cache
655
+ // entries using request.
656
+ // 4. Return corsWithPreflightResponse.
657
+ // TODO
658
+
659
+ // Otherwise
660
+ } else {
661
+ // 1. Set request’s response tainting to "cors".
662
+ request.responseTainting = 'cors'
663
+
664
+ // 2. Return the result of running HTTP fetch given fetchParams.
665
+ response = await httpFetch(fetchParams)
666
+ }
667
+ }
668
+
669
+ // 12. If recursive is true, then return response.
670
+ if (recursive) {
671
+ return response
672
+ }
673
+
674
+ // 13. If response is not a network error and response is not a filtered
675
+ // response, then:
676
+ if (response.status !== 0 && !response.internalResponse) {
677
+ // If request’s response tainting is "cors", then:
678
+ if (request.responseTainting === 'cors') {
679
+ // 1. Let headerNames be the result of extracting header list values
680
+ // given `Access-Control-Expose-Headers` and response’s header list.
681
+ // TODO
682
+ // 2. If request’s credentials mode is not "include" and headerNames
683
+ // contains `*`, then set response’s CORS-exposed header-name list to
684
+ // all unique header names in response’s header list.
685
+ // TODO
686
+ // 3. Otherwise, if headerNames is not null or failure, then set
687
+ // response’s CORS-exposed header-name list to headerNames.
688
+ // TODO
689
+ }
690
+
691
+ // Set response to the following filtered response with response as its
692
+ // internal response, depending on request’s response tainting:
693
+ if (request.responseTainting === 'basic') {
694
+ response = filterResponse(response, 'basic')
695
+ } else if (request.responseTainting === 'cors') {
696
+ response = filterResponse(response, 'cors')
697
+ } else if (request.responseTainting === 'opaque') {
698
+ response = filterResponse(response, 'opaque')
699
+ } else {
700
+ assert(false)
701
+ }
702
+ }
703
+
704
+ // 14. Let internalResponse be response, if response is a network error,
705
+ // and response’s internal response otherwise.
706
+ let internalResponse =
707
+ response.status === 0 ? response : response.internalResponse
708
+
709
+ // 15. If internalResponse’s URL list is empty, then set it to a clone of
710
+ // request’s URL list.
711
+ if (internalResponse.urlList.length === 0) {
712
+ internalResponse.urlList.push(...request.urlList)
713
+ }
714
+
715
+ // 16. If request’s timing allow failed flag is unset, then set
716
+ // internalResponse’s timing allow passed flag.
717
+ if (!request.timingAllowFailed) {
718
+ response.timingAllowPassed = true
719
+ }
720
+
721
+ // 17. If response is not a network error and any of the following returns
722
+ // blocked
723
+ // - should internalResponse to request be blocked as mixed content
724
+ // - should internalResponse to request be blocked by Content Security Policy
725
+ // - should internalResponse to request be blocked due to its MIME type
726
+ // - should internalResponse to request be blocked due to nosniff
727
+ // TODO
728
+
729
+ // 18. If response’s type is "opaque", internalResponse’s status is 206,
730
+ // internalResponse’s range-requested flag is set, and request’s header
731
+ // list does not contain `Range`, then set response and internalResponse
732
+ // to a network error.
733
+ if (
734
+ response.type === 'opaque' &&
735
+ internalResponse.status === 206 &&
736
+ internalResponse.rangeRequested &&
737
+ !request.headers.contains('range', true)
738
+ ) {
739
+ response = internalResponse = makeNetworkError()
740
+ }
741
+
742
+ // 19. If response is not a network error and either request’s method is
743
+ // `HEAD` or `CONNECT`, or internalResponse’s status is a null body status,
744
+ // set internalResponse’s body to null and disregard any enqueuing toward
745
+ // it (if any).
746
+ if (
747
+ response.status !== 0 &&
748
+ (request.method === 'HEAD' ||
749
+ request.method === 'CONNECT' ||
750
+ nullBodyStatus.includes(internalResponse.status))
751
+ ) {
752
+ internalResponse.body = null
753
+ fetchParams.controller.dump = true
754
+ }
755
+
756
+ // 20. If request’s integrity metadata is not the empty string, then:
757
+ if (request.integrity) {
758
+ // 1. Let processBodyError be this step: run fetch finale given fetchParams
759
+ // and a network error.
760
+ const processBodyError = (reason) =>
761
+ fetchFinale(fetchParams, makeNetworkError(reason))
762
+
763
+ // 2. If request’s response tainting is "opaque", or response’s body is null,
764
+ // then run processBodyError and abort these steps.
765
+ if (request.responseTainting === 'opaque' || response.body == null) {
766
+ processBodyError(response.error)
767
+ return
768
+ }
769
+
770
+ // 3. Let processBody given bytes be these steps:
771
+ const processBody = (bytes) => {
772
+ // 1. If bytes do not match request’s integrity metadata,
773
+ // then run processBodyError and abort these steps. [SRI]
774
+ if (!bytesMatch(bytes, request.integrity)) {
775
+ processBodyError('integrity mismatch')
776
+ return
777
+ }
778
+
779
+ // 2. Set response’s body to bytes as a body.
780
+ response.body = safelyExtractBody(bytes)[0]
781
+
782
+ // 3. Run fetch finale given fetchParams and response.
783
+ fetchFinale(fetchParams, response)
784
+ }
785
+
786
+ // 4. Fully read response’s body given processBody and processBodyError.
787
+ fullyReadBody(response.body, processBody, processBodyError)
788
+ } else {
789
+ // 21. Otherwise, run fetch finale given fetchParams and response.
790
+ fetchFinale(fetchParams, response)
791
+ }
792
+ } catch (err) {
793
+ fetchParams.controller.terminate(err)
794
+ }
795
+ }
796
+
797
+ // https://fetch.spec.whatwg.org/#concept-scheme-fetch
798
+ // given a fetch params fetchParams
799
+ function schemeFetch (fetchParams) {
800
+ // Note: since the connection is destroyed on redirect, which sets fetchParams to a
801
+ // cancelled state, we do not want this condition to trigger *unless* there have been
802
+ // no redirects. See https://github.com/nodejs/undici/issues/1776
803
+ // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams.
804
+ if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) {
805
+ return Promise.resolve(makeAppropriateNetworkError(fetchParams))
806
+ }
807
+
808
+ // 2. Let request be fetchParams’s request.
809
+ const { request } = fetchParams
810
+
811
+ const { protocol: scheme } = requestCurrentURL(request)
812
+
813
+ // 3. Switch on request’s current URL’s scheme and run the associated steps:
814
+ switch (scheme) {
815
+ case 'about:': {
816
+ // If request’s current URL’s path is the string "blank", then return a new response
817
+ // whose status message is `OK`, header list is « (`Content-Type`, `text/html;charset=utf-8`) »,
818
+ // and body is the empty byte sequence as a body.
819
+
820
+ // Otherwise, return a network error.
821
+ return Promise.resolve(makeNetworkError('about scheme is not supported'))
822
+ }
823
+ case 'blob:': {
824
+ if (!resolveObjectURL) {
825
+ resolveObjectURL = require('node:buffer').resolveObjectURL
826
+ }
827
+
828
+ // 1. Let blobURLEntry be request’s current URL’s blob URL entry.
829
+ const blobURLEntry = requestCurrentURL(request)
830
+
831
+ // https://github.com/web-platform-tests/wpt/blob/7b0ebaccc62b566a1965396e5be7bb2bc06f841f/FileAPI/url/resources/fetch-tests.js#L52-L56
832
+ // Buffer.resolveObjectURL does not ignore URL queries.
833
+ if (blobURLEntry.search.length !== 0) {
834
+ return Promise.resolve(makeNetworkError('NetworkError when attempting to fetch resource.'))
835
+ }
836
+
837
+ const blob = resolveObjectURL(blobURLEntry.toString())
838
+
839
+ // 2. If request’s method is not `GET`, blobURLEntry is null, or blobURLEntry’s
840
+ // object is not a Blob object, then return a network error.
841
+ if (request.method !== 'GET' || !webidl.is.Blob(blob)) {
842
+ return Promise.resolve(makeNetworkError('invalid method'))
843
+ }
844
+
845
+ // 3. Let blob be blobURLEntry’s object.
846
+ // Note: done above
847
+
848
+ // 4. Let response be a new response.
849
+ const response = makeResponse()
850
+
851
+ // 5. Let fullLength be blob’s size.
852
+ const fullLength = blob.size
853
+
854
+ // 6. Let serializedFullLength be fullLength, serialized and isomorphic encoded.
855
+ const serializedFullLength = isomorphicEncode(`${fullLength}`)
856
+
857
+ // 7. Let type be blob’s type.
858
+ const type = blob.type
859
+
860
+ // 8. If request’s header list does not contain `Range`:
861
+ // 9. Otherwise:
862
+ if (!request.headersList.contains('range', true)) {
863
+ // 1. Let bodyWithType be the result of safely extracting blob.
864
+ // Note: in the FileAPI a blob "object" is a Blob *or* a MediaSource.
865
+ // In node, this can only ever be a Blob. Therefore we can safely
866
+ // use extractBody directly.
867
+ const bodyWithType = extractBody(blob)
868
+
869
+ // 2. Set response’s status message to `OK`.
870
+ response.statusText = 'OK'
871
+
872
+ // 3. Set response’s body to bodyWithType’s body.
873
+ response.body = bodyWithType[0]
874
+
875
+ // 4. Set response’s header list to « (`Content-Length`, serializedFullLength), (`Content-Type`, type) ».
876
+ response.headersList.set('content-length', serializedFullLength, true)
877
+ response.headersList.set('content-type', type, true)
878
+ } else {
879
+ // 1. Set response’s range-requested flag.
880
+ response.rangeRequested = true
881
+
882
+ // 2. Let rangeHeader be the result of getting `Range` from request’s header list.
883
+ const rangeHeader = request.headersList.get('range', true)
884
+
885
+ // 3. Let rangeValue be the result of parsing a single range header value given rangeHeader and true.
886
+ const rangeValue = simpleRangeHeaderValue(rangeHeader, true)
887
+
888
+ // 4. If rangeValue is failure, then return a network error.
889
+ if (rangeValue === 'failure') {
890
+ return Promise.resolve(makeNetworkError('failed to fetch the data URL'))
891
+ }
892
+
893
+ // 5. Let (rangeStart, rangeEnd) be rangeValue.
894
+ let { rangeStartValue: rangeStart, rangeEndValue: rangeEnd } = rangeValue
895
+
896
+ // 6. If rangeStart is null:
897
+ // 7. Otherwise:
898
+ if (rangeStart === null) {
899
+ // 1. Set rangeStart to fullLength − rangeEnd.
900
+ rangeStart = fullLength - rangeEnd
901
+
902
+ // 2. Set rangeEnd to rangeStart + rangeEnd − 1.
903
+ rangeEnd = rangeStart + rangeEnd - 1
904
+ } else {
905
+ // 1. If rangeStart is greater than or equal to fullLength, then return a network error.
906
+ if (rangeStart >= fullLength) {
907
+ return Promise.resolve(makeNetworkError('Range start is greater than the blob\'s size.'))
908
+ }
909
+
910
+ // 2. If rangeEnd is null or rangeEnd is greater than or equal to fullLength, then set
911
+ // rangeEnd to fullLength − 1.
912
+ if (rangeEnd === null || rangeEnd >= fullLength) {
913
+ rangeEnd = fullLength - 1
914
+ }
915
+ }
916
+
917
+ // 8. Let slicedBlob be the result of invoking slice blob given blob, rangeStart,
918
+ // rangeEnd + 1, and type.
919
+ const slicedBlob = blob.slice(rangeStart, rangeEnd + 1, type)
920
+
921
+ // 9. Let slicedBodyWithType be the result of safely extracting slicedBlob.
922
+ // Note: same reason as mentioned above as to why we use extractBody
923
+ const slicedBodyWithType = extractBody(slicedBlob)
924
+
925
+ // 10. Set response’s body to slicedBodyWithType’s body.
926
+ response.body = slicedBodyWithType[0]
927
+
928
+ // 11. Let serializedSlicedLength be slicedBlob’s size, serialized and isomorphic encoded.
929
+ const serializedSlicedLength = isomorphicEncode(`${slicedBlob.size}`)
930
+
931
+ // 12. Let contentRange be the result of invoking build a content range given rangeStart,
932
+ // rangeEnd, and fullLength.
933
+ const contentRange = buildContentRange(rangeStart, rangeEnd, fullLength)
934
+
935
+ // 13. Set response’s status to 206.
936
+ response.status = 206
937
+
938
+ // 14. Set response’s status message to `Partial Content`.
939
+ response.statusText = 'Partial Content'
940
+
941
+ // 15. Set response’s header list to « (`Content-Length`, serializedSlicedLength),
942
+ // (`Content-Type`, type), (`Content-Range`, contentRange) ».
943
+ response.headersList.set('content-length', serializedSlicedLength, true)
944
+ response.headersList.set('content-type', type, true)
945
+ response.headersList.set('content-range', contentRange, true)
946
+ }
947
+
948
+ // 10. Return response.
949
+ return Promise.resolve(response)
950
+ }
951
+ case 'data:': {
952
+ // 1. Let dataURLStruct be the result of running the
953
+ // data: URL processor on request’s current URL.
954
+ const currentURL = requestCurrentURL(request)
955
+ const dataURLStruct = dataURLProcessor(currentURL)
956
+
957
+ // 2. If dataURLStruct is failure, then return a
958
+ // network error.
959
+ if (dataURLStruct === 'failure') {
960
+ return Promise.resolve(makeNetworkError('failed to fetch the data URL'))
961
+ }
962
+
963
+ // 3. Let mimeType be dataURLStruct’s MIME type, serialized.
964
+ const mimeType = serializeAMimeType(dataURLStruct.mimeType)
965
+
966
+ // 4. Return a response whose status message is `OK`,
967
+ // header list is « (`Content-Type`, mimeType) »,
968
+ // and body is dataURLStruct’s body as a body.
969
+ return Promise.resolve(makeResponse({
970
+ statusText: 'OK',
971
+ headersList: [
972
+ ['content-type', { name: 'Content-Type', value: mimeType }]
973
+ ],
974
+ body: safelyExtractBody(dataURLStruct.body)[0]
975
+ }))
976
+ }
977
+ case 'file:': {
978
+ // For now, unfortunate as it is, file URLs are left as an exercise for the reader.
979
+ // When in doubt, return a network error.
980
+ return Promise.resolve(makeNetworkError('not implemented... yet...'))
981
+ }
982
+ case 'http:':
983
+ case 'https:': {
984
+ // Return the result of running HTTP fetch given fetchParams.
985
+
986
+ return httpFetch(fetchParams)
987
+ .catch((err) => makeNetworkError(err))
988
+ }
989
+ default: {
990
+ return Promise.resolve(makeNetworkError('unknown scheme'))
991
+ }
992
+ }
993
+ }
994
+
995
+ // https://fetch.spec.whatwg.org/#finalize-response
996
+ function finalizeResponse (fetchParams, response) {
997
+ // 1. Set fetchParams’s request’s done flag.
998
+ fetchParams.request.done = true
999
+
1000
+ // 2, If fetchParams’s process response done is not null, then queue a fetch
1001
+ // task to run fetchParams’s process response done given response, with
1002
+ // fetchParams’s task destination.
1003
+ if (fetchParams.processResponseDone != null) {
1004
+ queueMicrotask(() => fetchParams.processResponseDone(response))
1005
+ }
1006
+ }
1007
+
1008
+ // https://fetch.spec.whatwg.org/#fetch-finale
1009
+ function fetchFinale (fetchParams, response) {
1010
+ // 1. Let timingInfo be fetchParams’s timing info.
1011
+ let timingInfo = fetchParams.timingInfo
1012
+
1013
+ // 2. If response is not a network error and fetchParams’s request’s client is a secure context,
1014
+ // then set timingInfo’s server-timing headers to the result of getting, decoding, and splitting
1015
+ // `Server-Timing` from response’s internal response’s header list.
1016
+ // TODO
1017
+
1018
+ // 3. Let processResponseEndOfBody be the following steps:
1019
+ const processResponseEndOfBody = () => {
1020
+ // 1. Let unsafeEndTime be the unsafe shared current time.
1021
+ const unsafeEndTime = Date.now() // ?
1022
+
1023
+ // 2. If fetchParams’s request’s destination is "document", then set fetchParams’s controller’s
1024
+ // full timing info to fetchParams’s timing info.
1025
+ if (fetchParams.request.destination === 'document') {
1026
+ fetchParams.controller.fullTimingInfo = timingInfo
1027
+ }
1028
+
1029
+ // 3. Set fetchParams’s controller’s report timing steps to the following steps given a global object global:
1030
+ fetchParams.controller.reportTimingSteps = () => {
1031
+ // 1. If fetchParams’s request’s URL’s scheme is not an HTTP(S) scheme, then return.
1032
+ if (!urlIsHttpHttpsScheme(fetchParams.request.url)) {
1033
+ return
1034
+ }
1035
+
1036
+ // 2. Set timingInfo’s end time to the relative high resolution time given unsafeEndTime and global.
1037
+ timingInfo.endTime = unsafeEndTime
1038
+
1039
+ // 3. Let cacheState be response’s cache state.
1040
+ let cacheState = response.cacheState
1041
+
1042
+ // 4. Let bodyInfo be response’s body info.
1043
+ const bodyInfo = response.bodyInfo
1044
+
1045
+ // 5. If response’s timing allow passed flag is not set, then set timingInfo to the result of creating an
1046
+ // opaque timing info for timingInfo and set cacheState to the empty string.
1047
+ if (!response.timingAllowPassed) {
1048
+ timingInfo = createOpaqueTimingInfo(timingInfo)
1049
+
1050
+ cacheState = ''
1051
+ }
1052
+
1053
+ // 6. Let responseStatus be 0.
1054
+ let responseStatus = 0
1055
+
1056
+ // 7. If fetchParams’s request’s mode is not "navigate" or response’s has-cross-origin-redirects is false:
1057
+ if (fetchParams.request.mode !== 'navigate' || !response.hasCrossOriginRedirects) {
1058
+ // 1. Set responseStatus to response’s status.
1059
+ responseStatus = response.status
1060
+
1061
+ // 2. Let mimeType be the result of extracting a MIME type from response’s header list.
1062
+ const mimeType = extractMimeType(response.headersList)
1063
+
1064
+ // 3. If mimeType is not failure, then set bodyInfo’s content type to the result of minimizing a supported MIME type given mimeType.
1065
+ if (mimeType !== 'failure') {
1066
+ bodyInfo.contentType = minimizeSupportedMimeType(mimeType)
1067
+ }
1068
+ }
1069
+
1070
+ // 8. If fetchParams’s request’s initiator type is non-null, then mark resource timing given timingInfo,
1071
+ // fetchParams’s request’s URL, fetchParams’s request’s initiator type, global, cacheState, bodyInfo,
1072
+ // and responseStatus.
1073
+ if (fetchParams.request.initiatorType != null) {
1074
+ markResourceTiming(timingInfo, fetchParams.request.url.href, fetchParams.request.initiatorType, globalThis, cacheState, bodyInfo, responseStatus)
1075
+ }
1076
+ }
1077
+
1078
+ // 4. Let processResponseEndOfBodyTask be the following steps:
1079
+ const processResponseEndOfBodyTask = () => {
1080
+ // 1. Set fetchParams’s request’s done flag.
1081
+ fetchParams.request.done = true
1082
+
1083
+ // 2. If fetchParams’s process response end-of-body is non-null, then run fetchParams’s process
1084
+ // response end-of-body given response.
1085
+ if (fetchParams.processResponseEndOfBody != null) {
1086
+ queueMicrotask(() => fetchParams.processResponseEndOfBody(response))
1087
+ }
1088
+
1089
+ // 3. If fetchParams’s request’s initiator type is non-null and fetchParams’s request’s client’s
1090
+ // global object is fetchParams’s task destination, then run fetchParams’s controller’s report
1091
+ // timing steps given fetchParams’s request’s client’s global object.
1092
+ if (fetchParams.request.initiatorType != null) {
1093
+ fetchParams.controller.reportTimingSteps()
1094
+ }
1095
+ }
1096
+
1097
+ // 5. Queue a fetch task to run processResponseEndOfBodyTask with fetchParams’s task destination
1098
+ queueMicrotask(() => processResponseEndOfBodyTask())
1099
+ }
1100
+
1101
+ // 4. If fetchParams’s process response is non-null, then queue a fetch task to run fetchParams’s
1102
+ // process response given response, with fetchParams’s task destination.
1103
+ if (fetchParams.processResponse != null) {
1104
+ queueMicrotask(() => {
1105
+ fetchParams.processResponse(response)
1106
+ fetchParams.processResponse = null
1107
+ })
1108
+ }
1109
+
1110
+ // 5. Let internalResponse be response, if response is a network error; otherwise response’s internal response.
1111
+ const internalResponse = response.type === 'error' ? response : (response.internalResponse ?? response)
1112
+
1113
+ // 6. If internalResponse’s body is null, then run processResponseEndOfBody.
1114
+ // 7. Otherwise:
1115
+ if (internalResponse.body == null) {
1116
+ processResponseEndOfBody()
1117
+ } else {
1118
+ // mcollina: all the following steps of the specs are skipped.
1119
+ // The internal transform stream is not needed.
1120
+ // See https://github.com/nodejs/undici/pull/3093#issuecomment-2050198541
1121
+
1122
+ // 1. Let transformStream be a new TransformStream.
1123
+ // 2. Let identityTransformAlgorithm be an algorithm which, given chunk, enqueues chunk in transformStream.
1124
+ // 3. Set up transformStream with transformAlgorithm set to identityTransformAlgorithm and flushAlgorithm
1125
+ // set to processResponseEndOfBody.
1126
+ // 4. Set internalResponse’s body’s stream to the result of internalResponse’s body’s stream piped through transformStream.
1127
+
1128
+ finished(internalResponse.body.stream, () => {
1129
+ processResponseEndOfBody()
1130
+ })
1131
+ }
1132
+ }
1133
+
1134
+ // https://fetch.spec.whatwg.org/#http-fetch
1135
+ async function httpFetch (fetchParams) {
1136
+ // 1. Let request be fetchParams’s request.
1137
+ const request = fetchParams.request
1138
+
1139
+ // 2. Let response be null.
1140
+ let response = null
1141
+
1142
+ // 3. Let actualResponse be null.
1143
+ let actualResponse = null
1144
+
1145
+ // 4. Let timingInfo be fetchParams’s timing info.
1146
+ const timingInfo = fetchParams.timingInfo
1147
+
1148
+ // 5. If request’s service-workers mode is "all", then:
1149
+ if (request.serviceWorkers === 'all') {
1150
+ // TODO
1151
+ }
1152
+
1153
+ // 6. If response is null, then:
1154
+ if (response === null) {
1155
+ // 1. If makeCORSPreflight is true and one of these conditions is true:
1156
+ // TODO
1157
+
1158
+ // 2. If request’s redirect mode is "follow", then set request’s
1159
+ // service-workers mode to "none".
1160
+ if (request.redirect === 'follow') {
1161
+ request.serviceWorkers = 'none'
1162
+ }
1163
+
1164
+ // 3. Set response and actualResponse to the result of running
1165
+ // HTTP-network-or-cache fetch given fetchParams.
1166
+ actualResponse = response = await httpNetworkOrCacheFetch(fetchParams)
1167
+
1168
+ // 4. If request’s response tainting is "cors" and a CORS check
1169
+ // for request and response returns failure, then return a network error.
1170
+ if (
1171
+ request.responseTainting === 'cors' &&
1172
+ corsCheck(request, response) === 'failure'
1173
+ ) {
1174
+ return makeNetworkError('cors failure')
1175
+ }
1176
+
1177
+ // 5. If the TAO check for request and response returns failure, then set
1178
+ // request’s timing allow failed flag.
1179
+ if (TAOCheck(request, response) === 'failure') {
1180
+ request.timingAllowFailed = true
1181
+ }
1182
+ }
1183
+
1184
+ // 7. If either request’s response tainting or response’s type
1185
+ // is "opaque", and the cross-origin resource policy check with
1186
+ // request’s origin, request’s client, request’s destination,
1187
+ // and actualResponse returns blocked, then return a network error.
1188
+ if (
1189
+ (request.responseTainting === 'opaque' || response.type === 'opaque') &&
1190
+ crossOriginResourcePolicyCheck(
1191
+ request.origin,
1192
+ request.client,
1193
+ request.destination,
1194
+ actualResponse
1195
+ ) === 'blocked'
1196
+ ) {
1197
+ return makeNetworkError('blocked')
1198
+ }
1199
+
1200
+ // 8. If actualResponse’s status is a redirect status, then:
1201
+ if (redirectStatusSet.has(actualResponse.status)) {
1202
+ // 1. If actualResponse’s status is not 303, request’s body is not null,
1203
+ // and the connection uses HTTP/2, then user agents may, and are even
1204
+ // encouraged to, transmit an RST_STREAM frame.
1205
+ // See, https://github.com/whatwg/fetch/issues/1288
1206
+ if (request.redirect !== 'manual') {
1207
+ fetchParams.controller.connection.destroy(undefined, false)
1208
+ }
1209
+
1210
+ // 2. Switch on request’s redirect mode:
1211
+ if (request.redirect === 'error') {
1212
+ // Set response to a network error.
1213
+ response = makeNetworkError('unexpected redirect')
1214
+ } else if (request.redirect === 'manual') {
1215
+ // Set response to an opaque-redirect filtered response whose internal
1216
+ // response is actualResponse.
1217
+ // NOTE(spec): On the web this would return an `opaqueredirect` response,
1218
+ // but that doesn't make sense server side.
1219
+ // See https://github.com/nodejs/undici/issues/1193.
1220
+ response = actualResponse
1221
+ } else if (request.redirect === 'follow') {
1222
+ // Set response to the result of running HTTP-redirect fetch given
1223
+ // fetchParams and response.
1224
+ response = await httpRedirectFetch(fetchParams, response)
1225
+ } else {
1226
+ assert(false)
1227
+ }
1228
+ }
1229
+
1230
+ // 9. Set response’s timing info to timingInfo.
1231
+ response.timingInfo = timingInfo
1232
+
1233
+ // 10. Return response.
1234
+ return response
1235
+ }
1236
+
1237
+ // https://fetch.spec.whatwg.org/#http-redirect-fetch
1238
+ function httpRedirectFetch (fetchParams, response) {
1239
+ // 1. Let request be fetchParams’s request.
1240
+ const request = fetchParams.request
1241
+
1242
+ // 2. Let actualResponse be response, if response is not a filtered response,
1243
+ // and response’s internal response otherwise.
1244
+ const actualResponse = response.internalResponse
1245
+ ? response.internalResponse
1246
+ : response
1247
+
1248
+ // 3. Let locationURL be actualResponse’s location URL given request’s current
1249
+ // URL’s fragment.
1250
+ let locationURL
1251
+
1252
+ try {
1253
+ locationURL = responseLocationURL(
1254
+ actualResponse,
1255
+ requestCurrentURL(request).hash
1256
+ )
1257
+
1258
+ // 4. If locationURL is null, then return response.
1259
+ if (locationURL == null) {
1260
+ return response
1261
+ }
1262
+ } catch (err) {
1263
+ // 5. If locationURL is failure, then return a network error.
1264
+ return Promise.resolve(makeNetworkError(err))
1265
+ }
1266
+
1267
+ // 6. If locationURL’s scheme is not an HTTP(S) scheme, then return a network
1268
+ // error.
1269
+ if (!urlIsHttpHttpsScheme(locationURL)) {
1270
+ return Promise.resolve(makeNetworkError('URL scheme must be a HTTP(S) scheme'))
1271
+ }
1272
+
1273
+ // 7. If request’s redirect count is 20, then return a network error.
1274
+ if (request.redirectCount === 20) {
1275
+ return Promise.resolve(makeNetworkError('redirect count exceeded'))
1276
+ }
1277
+
1278
+ // 8. Increase request’s redirect count by 1.
1279
+ request.redirectCount += 1
1280
+
1281
+ // 9. If request’s mode is "cors", locationURL includes credentials, and
1282
+ // request’s origin is not same origin with locationURL’s origin, then return
1283
+ // a network error.
1284
+ if (
1285
+ request.mode === 'cors' &&
1286
+ (locationURL.username || locationURL.password) &&
1287
+ !sameOrigin(request, locationURL)
1288
+ ) {
1289
+ return Promise.resolve(makeNetworkError('cross origin not allowed for request mode "cors"'))
1290
+ }
1291
+
1292
+ // 10. If request’s response tainting is "cors" and locationURL includes
1293
+ // credentials, then return a network error.
1294
+ if (
1295
+ request.responseTainting === 'cors' &&
1296
+ (locationURL.username || locationURL.password)
1297
+ ) {
1298
+ return Promise.resolve(makeNetworkError(
1299
+ 'URL cannot contain credentials for request mode "cors"'
1300
+ ))
1301
+ }
1302
+
1303
+ // 11. If actualResponse’s status is not 303, request’s body is non-null,
1304
+ // and request’s body’s source is null, then return a network error.
1305
+ if (
1306
+ actualResponse.status !== 303 &&
1307
+ request.body != null &&
1308
+ request.body.source == null
1309
+ ) {
1310
+ return Promise.resolve(makeNetworkError())
1311
+ }
1312
+
1313
+ // 12. If one of the following is true
1314
+ // - actualResponse’s status is 301 or 302 and request’s method is `POST`
1315
+ // - actualResponse’s status is 303 and request’s method is not `GET` or `HEAD`
1316
+ if (
1317
+ ([301, 302].includes(actualResponse.status) && request.method === 'POST') ||
1318
+ (actualResponse.status === 303 &&
1319
+ !GET_OR_HEAD.includes(request.method))
1320
+ ) {
1321
+ // then:
1322
+ // 1. Set request’s method to `GET` and request’s body to null.
1323
+ request.method = 'GET'
1324
+ request.body = null
1325
+
1326
+ // 2. For each headerName of request-body-header name, delete headerName from
1327
+ // request’s header list.
1328
+ for (const headerName of requestBodyHeader) {
1329
+ request.headersList.delete(headerName)
1330
+ }
1331
+ }
1332
+
1333
+ // 13. If request’s current URL’s origin is not same origin with locationURL’s
1334
+ // origin, then for each headerName of CORS non-wildcard request-header name,
1335
+ // delete headerName from request’s header list.
1336
+ if (!sameOrigin(requestCurrentURL(request), locationURL)) {
1337
+ // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
1338
+ request.headersList.delete('authorization', true)
1339
+
1340
+ // https://fetch.spec.whatwg.org/#authentication-entries
1341
+ request.headersList.delete('proxy-authorization', true)
1342
+
1343
+ // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
1344
+ request.headersList.delete('cookie', true)
1345
+ request.headersList.delete('host', true)
1346
+ }
1347
+
1348
+ // 14. If request's body is non-null, then set request's body to the first return
1349
+ // value of safely extracting request's body's source.
1350
+ if (request.body != null) {
1351
+ assert(request.body.source != null)
1352
+ request.body = safelyExtractBody(request.body.source)[0]
1353
+ }
1354
+
1355
+ // 15. Let timingInfo be fetchParams’s timing info.
1356
+ const timingInfo = fetchParams.timingInfo
1357
+
1358
+ // 16. Set timingInfo’s redirect end time and post-redirect start time to the
1359
+ // coarsened shared current time given fetchParams’s cross-origin isolated
1360
+ // capability.
1361
+ timingInfo.redirectEndTime = timingInfo.postRedirectStartTime =
1362
+ coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability)
1363
+
1364
+ // 17. If timingInfo’s redirect start time is 0, then set timingInfo’s
1365
+ // redirect start time to timingInfo’s start time.
1366
+ if (timingInfo.redirectStartTime === 0) {
1367
+ timingInfo.redirectStartTime = timingInfo.startTime
1368
+ }
1369
+
1370
+ // 18. Append locationURL to request’s URL list.
1371
+ request.urlList.push(locationURL)
1372
+
1373
+ // 19. Invoke set request’s referrer policy on redirect on request and
1374
+ // actualResponse.
1375
+ setRequestReferrerPolicyOnRedirect(request, actualResponse)
1376
+
1377
+ // 20. Return the result of running main fetch given fetchParams and true.
1378
+ return mainFetch(fetchParams, true)
1379
+ }
1380
+
1381
+ // https://fetch.spec.whatwg.org/#http-network-or-cache-fetch
1382
+ async function httpNetworkOrCacheFetch (
1383
+ fetchParams,
1384
+ isAuthenticationFetch = false,
1385
+ isNewConnectionFetch = false
1386
+ ) {
1387
+ // 1. Let request be fetchParams’s request.
1388
+ const request = fetchParams.request
1389
+
1390
+ // 2. Let httpFetchParams be null.
1391
+ let httpFetchParams = null
1392
+
1393
+ // 3. Let httpRequest be null.
1394
+ let httpRequest = null
1395
+
1396
+ // 4. Let response be null.
1397
+ let response = null
1398
+
1399
+ // 5. Let storedResponse be null.
1400
+ // TODO: cache
1401
+
1402
+ // 6. Let httpCache be null.
1403
+ const httpCache = null
1404
+
1405
+ // 7. Let the revalidatingFlag be unset.
1406
+ const revalidatingFlag = false
1407
+
1408
+ // 8. Run these steps, but abort when the ongoing fetch is terminated:
1409
+
1410
+ // 1. If request’s window is "no-window" and request’s redirect mode is
1411
+ // "error", then set httpFetchParams to fetchParams and httpRequest to
1412
+ // request.
1413
+ if (request.window === 'no-window' && request.redirect === 'error') {
1414
+ httpFetchParams = fetchParams
1415
+ httpRequest = request
1416
+ } else {
1417
+ // Otherwise:
1418
+
1419
+ // 1. Set httpRequest to a clone of request.
1420
+ httpRequest = cloneRequest(request)
1421
+
1422
+ // 2. Set httpFetchParams to a copy of fetchParams.
1423
+ httpFetchParams = { ...fetchParams }
1424
+
1425
+ // 3. Set httpFetchParams’s request to httpRequest.
1426
+ httpFetchParams.request = httpRequest
1427
+ }
1428
+
1429
+ // 3. Let includeCredentials be true if one of
1430
+ const includeCredentials =
1431
+ request.credentials === 'include' ||
1432
+ (request.credentials === 'same-origin' &&
1433
+ request.responseTainting === 'basic')
1434
+
1435
+ // 4. Let contentLength be httpRequest’s body’s length, if httpRequest’s
1436
+ // body is non-null; otherwise null.
1437
+ const contentLength = httpRequest.body ? httpRequest.body.length : null
1438
+
1439
+ // 5. Let contentLengthHeaderValue be null.
1440
+ let contentLengthHeaderValue = null
1441
+
1442
+ // 6. If httpRequest’s body is null and httpRequest’s method is `POST` or
1443
+ // `PUT`, then set contentLengthHeaderValue to `0`.
1444
+ if (
1445
+ httpRequest.body == null &&
1446
+ ['POST', 'PUT'].includes(httpRequest.method)
1447
+ ) {
1448
+ contentLengthHeaderValue = '0'
1449
+ }
1450
+
1451
+ // 7. If contentLength is non-null, then set contentLengthHeaderValue to
1452
+ // contentLength, serialized and isomorphic encoded.
1453
+ if (contentLength != null) {
1454
+ contentLengthHeaderValue = isomorphicEncode(`${contentLength}`)
1455
+ }
1456
+
1457
+ // 8. If contentLengthHeaderValue is non-null, then append
1458
+ // `Content-Length`/contentLengthHeaderValue to httpRequest’s header
1459
+ // list.
1460
+ if (
1461
+ contentLengthHeaderValue != null &&
1462
+ !httpRequest.headersList.contains('content-length', true)
1463
+ ) {
1464
+ httpRequest.headersList.append('content-length', contentLengthHeaderValue, true)
1465
+ }
1466
+
1467
+ // 9. If contentLengthHeaderValue is non-null, then append (`Content-Length`,
1468
+ // contentLengthHeaderValue) to httpRequest’s header list.
1469
+
1470
+ // 10. If contentLength is non-null and httpRequest’s keepalive is true,
1471
+ // then:
1472
+ if (contentLength != null && httpRequest.keepalive) {
1473
+ // NOTE: keepalive is a noop outside of browser context.
1474
+ }
1475
+
1476
+ // 11. If httpRequest’s referrer is a URL, then append
1477
+ // `Referer`/httpRequest’s referrer, serialized and isomorphic encoded,
1478
+ // to httpRequest’s header list.
1479
+ if (webidl.is.URL(httpRequest.referrer)) {
1480
+ httpRequest.headersList.append('referer', isomorphicEncode(httpRequest.referrer.href), true)
1481
+ }
1482
+
1483
+ // 12. Append a request `Origin` header for httpRequest.
1484
+ appendRequestOriginHeader(httpRequest)
1485
+
1486
+ // 13. Append the Fetch metadata headers for httpRequest. [FETCH-METADATA]
1487
+ appendFetchMetadata(httpRequest)
1488
+
1489
+ // 14. If httpRequest’s header list does not contain `User-Agent`, then
1490
+ // user agents should append `User-Agent`/default `User-Agent` value to
1491
+ // httpRequest’s header list.
1492
+ if (!httpRequest.headersList.contains('user-agent', true)) {
1493
+ httpRequest.headersList.append('user-agent', defaultUserAgent, true)
1494
+ }
1495
+
1496
+ // 15. If httpRequest’s cache mode is "default" and httpRequest’s header
1497
+ // list contains `If-Modified-Since`, `If-None-Match`,
1498
+ // `If-Unmodified-Since`, `If-Match`, or `If-Range`, then set
1499
+ // httpRequest’s cache mode to "no-store".
1500
+ if (
1501
+ httpRequest.cache === 'default' &&
1502
+ (httpRequest.headersList.contains('if-modified-since', true) ||
1503
+ httpRequest.headersList.contains('if-none-match', true) ||
1504
+ httpRequest.headersList.contains('if-unmodified-since', true) ||
1505
+ httpRequest.headersList.contains('if-match', true) ||
1506
+ httpRequest.headersList.contains('if-range', true))
1507
+ ) {
1508
+ httpRequest.cache = 'no-store'
1509
+ }
1510
+
1511
+ // 16. If httpRequest’s cache mode is "no-cache", httpRequest’s prevent
1512
+ // no-cache cache-control header modification flag is unset, and
1513
+ // httpRequest’s header list does not contain `Cache-Control`, then append
1514
+ // `Cache-Control`/`max-age=0` to httpRequest’s header list.
1515
+ if (
1516
+ httpRequest.cache === 'no-cache' &&
1517
+ !httpRequest.preventNoCacheCacheControlHeaderModification &&
1518
+ !httpRequest.headersList.contains('cache-control', true)
1519
+ ) {
1520
+ httpRequest.headersList.append('cache-control', 'max-age=0', true)
1521
+ }
1522
+
1523
+ // 17. If httpRequest’s cache mode is "no-store" or "reload", then:
1524
+ if (httpRequest.cache === 'no-store' || httpRequest.cache === 'reload') {
1525
+ // 1. If httpRequest’s header list does not contain `Pragma`, then append
1526
+ // `Pragma`/`no-cache` to httpRequest’s header list.
1527
+ if (!httpRequest.headersList.contains('pragma', true)) {
1528
+ httpRequest.headersList.append('pragma', 'no-cache', true)
1529
+ }
1530
+
1531
+ // 2. If httpRequest’s header list does not contain `Cache-Control`,
1532
+ // then append `Cache-Control`/`no-cache` to httpRequest’s header list.
1533
+ if (!httpRequest.headersList.contains('cache-control', true)) {
1534
+ httpRequest.headersList.append('cache-control', 'no-cache', true)
1535
+ }
1536
+ }
1537
+
1538
+ // 18. If httpRequest’s header list contains `Range`, then append
1539
+ // `Accept-Encoding`/`identity` to httpRequest’s header list.
1540
+ if (httpRequest.headersList.contains('range', true)) {
1541
+ httpRequest.headersList.append('accept-encoding', 'identity', true)
1542
+ }
1543
+
1544
+ // 19. Modify httpRequest’s header list per HTTP. Do not append a given
1545
+ // header if httpRequest’s header list contains that header’s name.
1546
+ // TODO: https://github.com/whatwg/fetch/issues/1285#issuecomment-896560129
1547
+ if (!httpRequest.headersList.contains('accept-encoding', true)) {
1548
+ if (urlHasHttpsScheme(requestCurrentURL(httpRequest))) {
1549
+ httpRequest.headersList.append('accept-encoding', 'br, gzip, deflate', true)
1550
+ } else {
1551
+ httpRequest.headersList.append('accept-encoding', 'gzip, deflate', true)
1552
+ }
1553
+ }
1554
+
1555
+ httpRequest.headersList.delete('host', true)
1556
+
1557
+ // 21. If includeCredentials is true, then:
1558
+ if (includeCredentials) {
1559
+ // 1. If the user agent is not configured to block cookies for httpRequest
1560
+ // (see section 7 of [COOKIES]), then:
1561
+ // TODO: credentials
1562
+
1563
+ // 2. If httpRequest’s header list does not contain `Authorization`, then:
1564
+ if (!httpRequest.headersList.contains('authorization', true)) {
1565
+ // 1. Let authorizationValue be null.
1566
+ let authorizationValue = null
1567
+
1568
+ // 2. If there’s an authentication entry for httpRequest and either
1569
+ // httpRequest’s use-URL-credentials flag is unset or httpRequest’s
1570
+ // current URL does not include credentials, then set
1571
+ // authorizationValue to authentication entry.
1572
+ if (hasAuthenticationEntry(httpRequest) && (
1573
+ httpRequest.useURLCredentials === undefined || !includesCredentials(requestCurrentURL(httpRequest))
1574
+ )) {
1575
+ // TODO
1576
+ } else if (includesCredentials(requestCurrentURL(httpRequest)) && isAuthenticationFetch) {
1577
+ // 3. Otherwise, if httpRequest’s current URL does include credentials
1578
+ // and isAuthenticationFetch is true, set authorizationValue to
1579
+ // httpRequest’s current URL, converted to an `Authorization` value
1580
+ const { username, password } = requestCurrentURL(httpRequest)
1581
+ authorizationValue = `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`
1582
+ }
1583
+
1584
+ // 4. If authorizationValue is non-null, then append (`Authorization`,
1585
+ // authorizationValue) to httpRequest’s header list.
1586
+ if (authorizationValue !== null) {
1587
+ httpRequest.headersList.append('Authorization', authorizationValue, false)
1588
+ }
1589
+ }
1590
+ }
1591
+
1592
+ // 21. If there’s a proxy-authentication entry, use it as appropriate.
1593
+ // TODO: proxy-authentication
1594
+
1595
+ // 22. Set httpCache to the result of determining the HTTP cache
1596
+ // partition, given httpRequest.
1597
+ // TODO: cache
1598
+
1599
+ // 23. If httpCache is null, then set httpRequest’s cache mode to
1600
+ // "no-store".
1601
+ if (httpCache == null) {
1602
+ httpRequest.cache = 'no-store'
1603
+ }
1604
+
1605
+ // 24. If httpRequest’s cache mode is neither "no-store" nor "reload",
1606
+ // then:
1607
+ if (httpRequest.cache !== 'no-store' && httpRequest.cache !== 'reload') {
1608
+ // TODO: cache
1609
+ }
1610
+
1611
+ // 9. If aborted, then return the appropriate network error for fetchParams.
1612
+ // TODO
1613
+
1614
+ // 10. If response is null, then:
1615
+ if (response == null) {
1616
+ // 1. If httpRequest’s cache mode is "only-if-cached", then return a
1617
+ // network error.
1618
+ if (httpRequest.cache === 'only-if-cached') {
1619
+ return makeNetworkError('only if cached')
1620
+ }
1621
+
1622
+ // 2. Let forwardResponse be the result of running HTTP-network fetch
1623
+ // given httpFetchParams, includeCredentials, and isNewConnectionFetch.
1624
+ const forwardResponse = await httpNetworkFetch(
1625
+ httpFetchParams,
1626
+ includeCredentials,
1627
+ isNewConnectionFetch
1628
+ )
1629
+
1630
+ // 3. If httpRequest’s method is unsafe and forwardResponse’s status is
1631
+ // in the range 200 to 399, inclusive, invalidate appropriate stored
1632
+ // responses in httpCache, as per the "Invalidation" chapter of HTTP
1633
+ // Caching, and set storedResponse to null. [HTTP-CACHING]
1634
+ if (
1635
+ !safeMethodsSet.has(httpRequest.method) &&
1636
+ forwardResponse.status >= 200 &&
1637
+ forwardResponse.status <= 399
1638
+ ) {
1639
+ // TODO: cache
1640
+ }
1641
+
1642
+ // 4. If the revalidatingFlag is set and forwardResponse’s status is 304,
1643
+ // then:
1644
+ if (revalidatingFlag && forwardResponse.status === 304) {
1645
+ // TODO: cache
1646
+ }
1647
+
1648
+ // 5. If response is null, then:
1649
+ if (response == null) {
1650
+ // 1. Set response to forwardResponse.
1651
+ response = forwardResponse
1652
+
1653
+ // 2. Store httpRequest and forwardResponse in httpCache, as per the
1654
+ // "Storing Responses in Caches" chapter of HTTP Caching. [HTTP-CACHING]
1655
+ // TODO: cache
1656
+ }
1657
+ }
1658
+
1659
+ // 11. Set response’s URL list to a clone of httpRequest’s URL list.
1660
+ response.urlList = [...httpRequest.urlList]
1661
+
1662
+ // 12. If httpRequest’s header list contains `Range`, then set response’s
1663
+ // range-requested flag.
1664
+ if (httpRequest.headersList.contains('range', true)) {
1665
+ response.rangeRequested = true
1666
+ }
1667
+
1668
+ // 13. Set response’s request-includes-credentials to includeCredentials.
1669
+ response.requestIncludesCredentials = includeCredentials
1670
+
1671
+ // 14. If response’s status is 401, httpRequest’s response tainting is not "cors",
1672
+ // includeCredentials is true, and request’s traversable for user prompts is
1673
+ // a traversable navigable:
1674
+ //
1675
+ // In Node.js there is no traversable navigable to prompt the user, but we
1676
+ // still need to handle URL-embedded credentials so authentication retries
1677
+ // for WebSocket handshakes continue to work.
1678
+ if (response.status === 401 && httpRequest.responseTainting !== 'cors' && includeCredentials && (
1679
+ request.useURLCredentials !== undefined ||
1680
+ isTraversableNavigable(request.traversableForUserPrompts)
1681
+ )) {
1682
+ // 2. If request’s body is non-null, then:
1683
+ if (request.body != null) {
1684
+ // 1. If request’s body’s source is null, then return a network error.
1685
+ if (request.body.source == null) {
1686
+ // Note: In Node.js, this code path should not be reached because
1687
+ // isTraversableNavigable() returns false for non-navigable contexts.
1688
+ // However, we handle it gracefully by returning the response instead of
1689
+ // a network error, as we won't actually retry the request.
1690
+ // This aligns with the Fetch spec discussion in whatwg/fetch#1132,
1691
+ // which allows implementations flexibility when credentials can't be obtained.
1692
+ return response
1693
+ }
1694
+
1695
+ // 2. Set request’s body to the body of the result of safely extracting
1696
+ // request’s body’s source.
1697
+ request.body = safelyExtractBody(request.body.source)[0]
1698
+ }
1699
+
1700
+ // 3. If request’s use-URL-credentials flag is unset or isAuthenticationFetch is
1701
+ // true, then:
1702
+ if (request.useURLCredentials === undefined || isAuthenticationFetch) {
1703
+ // 1. If fetchParams is canceled, then return the appropriate network error
1704
+ // for fetchParams.
1705
+ if (isCancelled(fetchParams)) {
1706
+ return makeAppropriateNetworkError(fetchParams)
1707
+ }
1708
+
1709
+ // 2. Let username and password be the result of prompting the end user for a
1710
+ // username and password, respectively, in request’s traversable for user prompts.
1711
+ // TODO
1712
+
1713
+ // 3. Set the username given request’s current URL and username.
1714
+ // requestCurrentURL(request).username = TODO
1715
+
1716
+ // 4. Set the password given request’s current URL and password.
1717
+ // requestCurrentURL(request).password = TODO
1718
+
1719
+ // In browsers, the user will be prompted to enter a username/password before the request
1720
+ // is re-sent. To prevent an infinite 401 loop, return the response for now.
1721
+ // https://github.com/nodejs/undici/pull/4756
1722
+ return response
1723
+ }
1724
+
1725
+ // 4. Set response to the result of running HTTP-network-or-cache fetch given
1726
+ // fetchParams and true.
1727
+ fetchParams.controller.connection.destroy()
1728
+
1729
+ response = await httpNetworkOrCacheFetch(fetchParams, true)
1730
+ }
1731
+
1732
+ // 15. If response’s status is 407, then:
1733
+ if (response.status === 407) {
1734
+ // 1. If request’s window is "no-window", then return a network error.
1735
+ if (request.window === 'no-window') {
1736
+ return makeNetworkError()
1737
+ }
1738
+
1739
+ // 2. ???
1740
+
1741
+ // 3. If fetchParams is canceled, then return the appropriate network error for fetchParams.
1742
+ if (isCancelled(fetchParams)) {
1743
+ return makeAppropriateNetworkError(fetchParams)
1744
+ }
1745
+
1746
+ // 4. Prompt the end user as appropriate in request’s window and store
1747
+ // the result as a proxy-authentication entry. [HTTP-AUTH]
1748
+ // TODO: Invoke some kind of callback?
1749
+
1750
+ // 5. Set response to the result of running HTTP-network-or-cache fetch given
1751
+ // fetchParams.
1752
+ // TODO
1753
+ return makeNetworkError('proxy authentication required')
1754
+ }
1755
+
1756
+ // 16. If all of the following are true
1757
+ if (
1758
+ // response’s status is 421
1759
+ response.status === 421 &&
1760
+ // isNewConnectionFetch is false
1761
+ !isNewConnectionFetch &&
1762
+ // request’s body is null, or request’s body is non-null and request’s body’s source is non-null
1763
+ (request.body == null || request.body.source != null)
1764
+ ) {
1765
+ // then:
1766
+
1767
+ // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams.
1768
+ if (isCancelled(fetchParams)) {
1769
+ return makeAppropriateNetworkError(fetchParams)
1770
+ }
1771
+
1772
+ // 2. Set response to the result of running HTTP-network-or-cache
1773
+ // fetch given fetchParams, isAuthenticationFetch, and true.
1774
+
1775
+ // TODO (spec): The spec doesn't specify this but we need to cancel
1776
+ // the active response before we can start a new one.
1777
+ // https://github.com/whatwg/fetch/issues/1293
1778
+ fetchParams.controller.connection.destroy()
1779
+
1780
+ response = await httpNetworkOrCacheFetch(
1781
+ fetchParams,
1782
+ isAuthenticationFetch,
1783
+ true
1784
+ )
1785
+ }
1786
+
1787
+ // 17. If isAuthenticationFetch is true, then create an authentication entry
1788
+ if (isAuthenticationFetch) {
1789
+ // TODO
1790
+ }
1791
+
1792
+ // 18. Return response.
1793
+ return response
1794
+ }
1795
+
1796
+ // https://fetch.spec.whatwg.org/#http-network-fetch
1797
+ async function httpNetworkFetch (
1798
+ fetchParams,
1799
+ includeCredentials = false,
1800
+ forceNewConnection = false
1801
+ ) {
1802
+ assert(!fetchParams.controller.connection || fetchParams.controller.connection.destroyed)
1803
+
1804
+ fetchParams.controller.connection = {
1805
+ abort: null,
1806
+ destroyed: false,
1807
+ destroy (err, abort = true) {
1808
+ if (!this.destroyed) {
1809
+ this.destroyed = true
1810
+ if (abort) {
1811
+ this.abort?.(err ?? new DOMException('The operation was aborted.', 'AbortError'))
1812
+ }
1813
+ }
1814
+ }
1815
+ }
1816
+
1817
+ // 1. Let request be fetchParams’s request.
1818
+ const request = fetchParams.request
1819
+
1820
+ // 2. Let response be null.
1821
+ let response = null
1822
+
1823
+ // 3. Let timingInfo be fetchParams’s timing info.
1824
+ const timingInfo = fetchParams.timingInfo
1825
+
1826
+ // 4. Let httpCache be the result of determining the HTTP cache partition,
1827
+ // given request.
1828
+ // TODO: cache
1829
+ const httpCache = null
1830
+
1831
+ // 5. If httpCache is null, then set request’s cache mode to "no-store".
1832
+ if (httpCache == null) {
1833
+ request.cache = 'no-store'
1834
+ }
1835
+
1836
+ // 6. Let networkPartitionKey be the result of determining the network
1837
+ // partition key given request.
1838
+ // TODO
1839
+
1840
+ // 7. Let newConnection be "yes" if forceNewConnection is true; otherwise
1841
+ // "no".
1842
+ const newConnection = forceNewConnection ? 'yes' : 'no' // eslint-disable-line no-unused-vars
1843
+
1844
+ // 8. Switch on request’s mode:
1845
+ if (request.mode === 'websocket') {
1846
+ // Let connection be the result of obtaining a WebSocket connection,
1847
+ // given request’s current URL.
1848
+ // TODO
1849
+ } else {
1850
+ // Let connection be the result of obtaining a connection, given
1851
+ // networkPartitionKey, request’s current URL’s origin,
1852
+ // includeCredentials, and forceNewConnection.
1853
+ // TODO
1854
+ }
1855
+
1856
+ // 9. Run these steps, but abort when the ongoing fetch is terminated:
1857
+
1858
+ // 1. If connection is failure, then return a network error.
1859
+
1860
+ // 2. Set timingInfo’s final connection timing info to the result of
1861
+ // calling clamp and coarsen connection timing info with connection’s
1862
+ // timing info, timingInfo’s post-redirect start time, and fetchParams’s
1863
+ // cross-origin isolated capability.
1864
+
1865
+ // 3. If connection is not an HTTP/2 connection, request’s body is non-null,
1866
+ // and request’s body’s source is null, then append (`Transfer-Encoding`,
1867
+ // `chunked`) to request’s header list.
1868
+
1869
+ // 4. Set timingInfo’s final network-request start time to the coarsened
1870
+ // shared current time given fetchParams’s cross-origin isolated
1871
+ // capability.
1872
+
1873
+ // 5. Set response to the result of making an HTTP request over connection
1874
+ // using request with the following caveats:
1875
+
1876
+ // - Follow the relevant requirements from HTTP. [HTTP] [HTTP-SEMANTICS]
1877
+ // [HTTP-COND] [HTTP-CACHING] [HTTP-AUTH]
1878
+
1879
+ // - If request’s body is non-null, and request’s body’s source is null,
1880
+ // then the user agent may have a buffer of up to 64 kibibytes and store
1881
+ // a part of request’s body in that buffer. If the user agent reads from
1882
+ // request’s body beyond that buffer’s size and the user agent needs to
1883
+ // resend request, then instead return a network error.
1884
+
1885
+ // - Set timingInfo’s final network-response start time to the coarsened
1886
+ // shared current time given fetchParams’s cross-origin isolated capability,
1887
+ // immediately after the user agent’s HTTP parser receives the first byte
1888
+ // of the response (e.g., frame header bytes for HTTP/2 or response status
1889
+ // line for HTTP/1.x).
1890
+
1891
+ // - Wait until all the headers are transmitted.
1892
+
1893
+ // - Any responses whose status is in the range 100 to 199, inclusive,
1894
+ // and is not 101, are to be ignored, except for the purposes of setting
1895
+ // timingInfo’s final network-response start time above.
1896
+
1897
+ // - If request’s header list contains `Transfer-Encoding`/`chunked` and
1898
+ // response is transferred via HTTP/1.0 or older, then return a network
1899
+ // error.
1900
+
1901
+ // - If the HTTP request results in a TLS client certificate dialog, then:
1902
+
1903
+ // 1. If request’s window is an environment settings object, make the
1904
+ // dialog available in request’s window.
1905
+
1906
+ // 2. Otherwise, return a network error.
1907
+
1908
+ // To transmit request’s body body, run these steps:
1909
+ let requestBody = null
1910
+ // 1. If body is null and fetchParams’s process request end-of-body is
1911
+ // non-null, then queue a fetch task given fetchParams’s process request
1912
+ // end-of-body and fetchParams’s task destination.
1913
+ if (request.body == null && fetchParams.processRequestEndOfBody) {
1914
+ queueMicrotask(() => fetchParams.processRequestEndOfBody())
1915
+ } else if (request.body != null) {
1916
+ // 2. Otherwise, if body is non-null:
1917
+
1918
+ // 1. Let processBodyChunk given bytes be these steps:
1919
+ const processBodyChunk = async function * (bytes) {
1920
+ // 1. If the ongoing fetch is terminated, then abort these steps.
1921
+ if (isCancelled(fetchParams)) {
1922
+ return
1923
+ }
1924
+
1925
+ // 2. Run this step in parallel: transmit bytes.
1926
+ yield bytes
1927
+
1928
+ // 3. If fetchParams’s process request body is non-null, then run
1929
+ // fetchParams’s process request body given bytes’s length.
1930
+ fetchParams.processRequestBodyChunkLength?.(bytes.byteLength)
1931
+ }
1932
+
1933
+ // 2. Let processEndOfBody be these steps:
1934
+ const processEndOfBody = () => {
1935
+ // 1. If fetchParams is canceled, then abort these steps.
1936
+ if (isCancelled(fetchParams)) {
1937
+ return
1938
+ }
1939
+
1940
+ // 2. If fetchParams’s process request end-of-body is non-null,
1941
+ // then run fetchParams’s process request end-of-body.
1942
+ if (fetchParams.processRequestEndOfBody) {
1943
+ fetchParams.processRequestEndOfBody()
1944
+ }
1945
+ }
1946
+
1947
+ // 3. Let processBodyError given e be these steps:
1948
+ const processBodyError = (e) => {
1949
+ // 1. If fetchParams is canceled, then abort these steps.
1950
+ if (isCancelled(fetchParams)) {
1951
+ return
1952
+ }
1953
+
1954
+ // 2. If e is an "AbortError" DOMException, then abort fetchParams’s controller.
1955
+ if (e.name === 'AbortError') {
1956
+ fetchParams.controller.abort()
1957
+ } else {
1958
+ fetchParams.controller.terminate(e)
1959
+ }
1960
+ }
1961
+
1962
+ // 4. Incrementally read request’s body given processBodyChunk, processEndOfBody,
1963
+ // processBodyError, and fetchParams’s task destination.
1964
+ requestBody = (async function * () {
1965
+ try {
1966
+ for await (const bytes of request.body.stream) {
1967
+ yield * processBodyChunk(bytes)
1968
+ }
1969
+ processEndOfBody()
1970
+ } catch (err) {
1971
+ processBodyError(err)
1972
+ }
1973
+ })()
1974
+ }
1975
+
1976
+ try {
1977
+ // socket is only provided for websockets
1978
+ const { body, status, statusText, headersList, socket } = await dispatch({ body: requestBody })
1979
+
1980
+ if (socket) {
1981
+ response = makeResponse({ status, statusText, headersList, socket })
1982
+ } else {
1983
+ const iterator = body[Symbol.asyncIterator]()
1984
+ fetchParams.controller.next = () => iterator.next()
1985
+
1986
+ response = makeResponse({ status, statusText, headersList })
1987
+ }
1988
+ } catch (err) {
1989
+ // 10. If aborted, then:
1990
+ if (err.name === 'AbortError') {
1991
+ // 1. If connection uses HTTP/2, then transmit an RST_STREAM frame.
1992
+ fetchParams.controller.connection.destroy()
1993
+
1994
+ // 2. Return the appropriate network error for fetchParams.
1995
+ return makeAppropriateNetworkError(fetchParams, err)
1996
+ }
1997
+
1998
+ return makeNetworkError(err)
1999
+ }
2000
+
2001
+ // 11. Let pullAlgorithm be an action that resumes the ongoing fetch
2002
+ // if it is suspended.
2003
+ const pullAlgorithm = () => {
2004
+ return fetchParams.controller.resume()
2005
+ }
2006
+
2007
+ // 12. Let cancelAlgorithm be an algorithm that aborts fetchParams’s
2008
+ // controller with reason, given reason.
2009
+ const cancelAlgorithm = (reason) => {
2010
+ // If the aborted fetch was already terminated, then we do not
2011
+ // need to do anything.
2012
+ if (!isCancelled(fetchParams)) {
2013
+ fetchParams.controller.abort(reason)
2014
+ }
2015
+ }
2016
+
2017
+ // 13. Let highWaterMark be a non-negative, non-NaN number, chosen by
2018
+ // the user agent.
2019
+ // TODO
2020
+
2021
+ // 14. Let sizeAlgorithm be an algorithm that accepts a chunk object
2022
+ // and returns a non-negative, non-NaN, non-infinite number, chosen by the user agent.
2023
+ // TODO
2024
+
2025
+ // 15. Let stream be a new ReadableStream.
2026
+ // 16. Set up stream with byte reading support with pullAlgorithm set to pullAlgorithm,
2027
+ // cancelAlgorithm set to cancelAlgorithm.
2028
+ const stream = new ReadableStream(
2029
+ {
2030
+ start (controller) {
2031
+ fetchParams.controller.controller = controller
2032
+ },
2033
+ pull: pullAlgorithm,
2034
+ cancel: cancelAlgorithm,
2035
+ type: 'bytes'
2036
+ }
2037
+ )
2038
+
2039
+ // 17. Run these steps, but abort when the ongoing fetch is terminated:
2040
+
2041
+ // 1. Set response’s body to a new body whose stream is stream.
2042
+ response.body = { stream, source: null, length: null }
2043
+
2044
+ // 2. If response is not a network error and request’s cache mode is
2045
+ // not "no-store", then update response in httpCache for request.
2046
+ // TODO
2047
+
2048
+ // 3. If includeCredentials is true and the user agent is not configured
2049
+ // to block cookies for request (see section 7 of [COOKIES]), then run the
2050
+ // "set-cookie-string" parsing algorithm (see section 5.2 of [COOKIES]) on
2051
+ // the value of each header whose name is a byte-case-insensitive match for
2052
+ // `Set-Cookie` in response’s header list, if any, and request’s current URL.
2053
+ // TODO
2054
+
2055
+ // 18. If aborted, then:
2056
+ // TODO
2057
+
2058
+ // 19. Run these steps in parallel:
2059
+
2060
+ // 1. Run these steps, but abort when fetchParams is canceled:
2061
+ if (!fetchParams.controller.resume) {
2062
+ fetchParams.controller.on('terminated', onAborted)
2063
+ }
2064
+
2065
+ fetchParams.controller.resume = async () => {
2066
+ // 1. While true
2067
+ while (true) {
2068
+ // 1-3. See onData...
2069
+
2070
+ // 4. Set bytes to the result of handling content codings given
2071
+ // codings and bytes.
2072
+ let bytes
2073
+ let isFailure
2074
+ try {
2075
+ const { done, value } = await fetchParams.controller.next()
2076
+
2077
+ if (isAborted(fetchParams)) {
2078
+ break
2079
+ }
2080
+
2081
+ bytes = done ? undefined : value
2082
+ } catch (err) {
2083
+ if (fetchParams.controller.ended && !timingInfo.encodedBodySize) {
2084
+ // zlib doesn't like empty streams.
2085
+ bytes = undefined
2086
+ } else {
2087
+ bytes = err
2088
+
2089
+ // err may be propagated from the result of calling readablestream.cancel,
2090
+ // which might not be an error. https://github.com/nodejs/undici/issues/2009
2091
+ isFailure = true
2092
+ }
2093
+ }
2094
+
2095
+ if (bytes === undefined) {
2096
+ // 2. Otherwise, if the bytes transmission for response’s message
2097
+ // body is done normally and stream is readable, then close
2098
+ // stream, finalize response for fetchParams and response, and
2099
+ // abort these in-parallel steps.
2100
+ readableStreamClose(fetchParams.controller.controller)
2101
+
2102
+ finalizeResponse(fetchParams, response)
2103
+
2104
+ return
2105
+ }
2106
+
2107
+ // 5. Increase timingInfo’s decoded body size by bytes’s length.
2108
+ timingInfo.decodedBodySize += bytes?.byteLength ?? 0
2109
+
2110
+ // 6. If bytes is failure, then terminate fetchParams’s controller.
2111
+ if (isFailure) {
2112
+ fetchParams.controller.terminate(bytes)
2113
+ return
2114
+ }
2115
+
2116
+ // 7. Enqueue a Uint8Array wrapping an ArrayBuffer containing bytes
2117
+ // into stream.
2118
+ const buffer = new Uint8Array(bytes)
2119
+ if (buffer.byteLength) {
2120
+ fetchParams.controller.controller.enqueue(buffer)
2121
+ }
2122
+
2123
+ // 8. If stream is errored, then terminate the ongoing fetch.
2124
+ if (isErrored(stream)) {
2125
+ fetchParams.controller.terminate()
2126
+ return
2127
+ }
2128
+
2129
+ // 9. If stream doesn’t need more data ask the user agent to suspend
2130
+ // the ongoing fetch.
2131
+ if (fetchParams.controller.controller.desiredSize <= 0) {
2132
+ return
2133
+ }
2134
+ }
2135
+ }
2136
+
2137
+ // 2. If aborted, then:
2138
+ function onAborted (reason) {
2139
+ // 2. If fetchParams is aborted, then:
2140
+ if (isAborted(fetchParams)) {
2141
+ // 1. Set response’s aborted flag.
2142
+ response.aborted = true
2143
+
2144
+ // 2. If stream is readable, then error stream with the result of
2145
+ // deserialize a serialized abort reason given fetchParams’s
2146
+ // controller’s serialized abort reason and an
2147
+ // implementation-defined realm.
2148
+ if (isReadable(stream)) {
2149
+ fetchParams.controller.controller.error(
2150
+ fetchParams.controller.serializedAbortReason
2151
+ )
2152
+ }
2153
+ } else {
2154
+ // 3. Otherwise, if stream is readable, error stream with a TypeError.
2155
+ if (isReadable(stream)) {
2156
+ fetchParams.controller.controller.error(new TypeError('terminated', {
2157
+ cause: isErrorLike(reason) ? reason : undefined
2158
+ }))
2159
+ }
2160
+ }
2161
+
2162
+ // 4. If connection uses HTTP/2, then transmit an RST_STREAM frame.
2163
+ // 5. Otherwise, the user agent should close connection unless it would be bad for performance to do so.
2164
+ fetchParams.controller.connection.destroy()
2165
+ }
2166
+
2167
+ // 20. Return response.
2168
+ return response
2169
+
2170
+ function dispatch ({ body }) {
2171
+ const url = requestCurrentURL(request)
2172
+ /** @type {import('../../..').Agent} */
2173
+ const agent = fetchParams.controller.dispatcher
2174
+
2175
+ const path = url.pathname + url.search
2176
+ const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === '?'
2177
+
2178
+ return dispatchWithProtocolPreference(body)
2179
+
2180
+ function dispatchWithProtocolPreference (body, allowH2) {
2181
+ return new Promise((resolve, reject) => agent.dispatch(
2182
+ {
2183
+ path: hasTrailingQuestionMark ? `${path}?` : path,
2184
+ origin: url.origin,
2185
+ method: request.method,
2186
+ body: agent.isMockActive ? request.body && (request.body.source || request.body.stream) : body,
2187
+ // Preserve the serialized fetch body for MockAgent net-connect fallthroughs.
2188
+ __mockAgentBodyForDispatch: body,
2189
+ headers: request.headersList.entries,
2190
+ maxRedirections: 0,
2191
+ upgrade: request.mode === 'websocket' ? 'websocket' : undefined,
2192
+ ...(allowH2 === false ? { allowH2 } : null)
2193
+ },
2194
+ {
2195
+ body: null,
2196
+ abort: null,
2197
+
2198
+ onRequestStart (controller) {
2199
+ // TODO (fix): Do we need connection here?
2200
+ const { connection } = fetchParams.controller
2201
+
2202
+ // Set timingInfo’s final connection timing info to the result of calling clamp and coarsen
2203
+ // connection timing info with connection’s timing info, timingInfo’s post-redirect start
2204
+ // time, and fetchParams’s cross-origin isolated capability.
2205
+ // TODO: implement connection timing
2206
+ timingInfo.finalConnectionTimingInfo = clampAndCoarsenConnectionTimingInfo(undefined, timingInfo.postRedirectStartTime, fetchParams.crossOriginIsolatedCapability)
2207
+
2208
+ const abort = (reason) => controller.abort(reason)
2209
+
2210
+ if (connection.destroyed) {
2211
+ abort(new DOMException('The operation was aborted.', 'AbortError'))
2212
+ } else {
2213
+ fetchParams.controller.on('terminated', abort)
2214
+ this.abort = connection.abort = abort
2215
+ }
2216
+
2217
+ // Set timingInfo’s final network-request start time to the coarsened shared current time given
2218
+ // fetchParams’s cross-origin isolated capability.
2219
+ timingInfo.finalNetworkRequestStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability)
2220
+ },
2221
+
2222
+ onResponseStarted () {
2223
+ // Set timingInfo’s final network-response start time to the coarsened shared current
2224
+ // time given fetchParams’s cross-origin isolated capability, immediately after the
2225
+ // user agent’s HTTP parser receives the first byte of the response (e.g., frame header
2226
+ // bytes for HTTP/2 or response status line for HTTP/1.x).
2227
+ timingInfo.finalNetworkResponseStartTime = coarsenedSharedCurrentTime(fetchParams.crossOriginIsolatedCapability)
2228
+ },
2229
+
2230
+ onResponseStart (controller, status, headers, statusText) {
2231
+ if (status < 200) {
2232
+ return
2233
+ }
2234
+
2235
+ const rawHeaders = controller?.rawHeaders ?? []
2236
+ const headersList = new HeadersList()
2237
+ appendHeadersListFromResponseHeaders(headersList, headers, rawHeaders)
2238
+ const location = headersList.get('location', true)
2239
+
2240
+ this.body = new Readable({ read: () => controller.resume() })
2241
+
2242
+ const willFollow = location && request.redirect === 'follow' &&
2243
+ redirectStatusSet.has(status)
2244
+
2245
+ const decoders = []
2246
+
2247
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
2248
+ if (request.method !== 'HEAD' && request.method !== 'CONNECT' && !nullBodyStatus.includes(status) && !willFollow) {
2249
+ // https://www.rfc-editor.org/rfc/rfc7231#section-3.1.2.1
2250
+ const contentEncoding = headersList.get('content-encoding', true)
2251
+ // "All content-coding values are case-insensitive..."
2252
+ /** @type {string[]} */
2253
+ const codings = contentEncoding ? contentEncoding.toLowerCase().split(',') : []
2254
+
2255
+ // Limit the number of content-encodings to prevent resource exhaustion.
2256
+ // CVE fix similar to urllib3 (GHSA-gm62-xv2j-4w53) and curl (CVE-2022-32206).
2257
+ const maxContentEncodings = 5
2258
+ if (codings.length > maxContentEncodings) {
2259
+ reject(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
2260
+ return
2261
+ }
2262
+
2263
+ for (let i = codings.length - 1; i >= 0; --i) {
2264
+ const coding = codings[i].trim()
2265
+ // https://www.rfc-editor.org/rfc/rfc9112.html#section-7.2
2266
+ if (coding === 'x-gzip' || coding === 'gzip') {
2267
+ decoders.push(zlib.createGunzip({
2268
+ // Be less strict when decoding compressed responses, since sometimes
2269
+ // servers send slightly invalid responses that are still accepted
2270
+ // by common browsers.
2271
+ // Always using Z_SYNC_FLUSH is what cURL does.
2272
+ flush: zlib.constants.Z_SYNC_FLUSH,
2273
+ finishFlush: zlib.constants.Z_SYNC_FLUSH
2274
+ }))
2275
+ } else if (coding === 'deflate') {
2276
+ decoders.push(createInflate({
2277
+ flush: zlib.constants.Z_SYNC_FLUSH,
2278
+ finishFlush: zlib.constants.Z_SYNC_FLUSH
2279
+ }))
2280
+ } else if (coding === 'br') {
2281
+ decoders.push(zlib.createBrotliDecompress({
2282
+ flush: zlib.constants.BROTLI_OPERATION_FLUSH,
2283
+ finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
2284
+ }))
2285
+ } else if (coding === 'zstd') {
2286
+ decoders.push(zlib.createZstdDecompress({
2287
+ flush: zlib.constants.ZSTD_e_continue,
2288
+ finishFlush: zlib.constants.ZSTD_e_end
2289
+ }))
2290
+ } else {
2291
+ decoders.length = 0
2292
+ break
2293
+ }
2294
+ }
2295
+ }
2296
+
2297
+ const onError = (err) => this.onResponseError(controller, err)
2298
+
2299
+ resolve({
2300
+ status,
2301
+ statusText,
2302
+ headersList,
2303
+ body: decoders.length
2304
+ ? pipeline(this.body, ...decoders, (err) => {
2305
+ if (err) {
2306
+ this.onResponseError(controller, err)
2307
+ }
2308
+ }).on('error', onError)
2309
+ : this.body.on('error', onError)
2310
+ })
2311
+ },
2312
+
2313
+ onResponseData (controller, chunk) {
2314
+ if (fetchParams.controller.dump) {
2315
+ return
2316
+ }
2317
+
2318
+ // 1. If one or more bytes have been transmitted from response’s
2319
+ // message body, then:
2320
+
2321
+ // 1. Let bytes be the transmitted bytes.
2322
+ const bytes = chunk
2323
+
2324
+ // 2. Let codings be the result of extracting header list values
2325
+ // given `Content-Encoding` and response’s header list.
2326
+ // See pullAlgorithm.
2327
+
2328
+ // 3. Increase timingInfo’s encoded body size by bytes’s length.
2329
+ timingInfo.encodedBodySize += bytes.byteLength
2330
+
2331
+ // 4. See pullAlgorithm...
2332
+
2333
+ if (this.body.push(bytes) === false) {
2334
+ controller.pause()
2335
+ }
2336
+ },
2337
+
2338
+ onResponseEnd () {
2339
+ if (this.abort) {
2340
+ fetchParams.controller.off('terminated', this.abort)
2341
+ }
2342
+
2343
+ fetchParams.controller.ended = true
2344
+
2345
+ this.body?.push(null)
2346
+ },
2347
+
2348
+ onResponseError (_controller, error) {
2349
+ if (this.abort) {
2350
+ fetchParams.controller.off('terminated', this.abort)
2351
+ }
2352
+
2353
+ if (
2354
+ request.mode === 'websocket' &&
2355
+ allowH2 !== false &&
2356
+ error?.code === 'UND_ERR_INFO' &&
2357
+ error?.message === 'HTTP/2: Extended CONNECT protocol not supported by server'
2358
+ ) {
2359
+ // The origin negotiated H2, but RFC 8441 websocket support is unavailable.
2360
+ // Retry the opening handshake on a fresh HTTP/1.1-only connection instead.
2361
+ resolve(dispatchWithProtocolPreference(body, false))
2362
+ return
2363
+ }
2364
+
2365
+ this.body?.destroy(error)
2366
+
2367
+ fetchParams.controller.terminate(error)
2368
+
2369
+ reject(error)
2370
+ },
2371
+
2372
+ onRequestUpgrade (controller, status, headers, socket) {
2373
+ // We need to support 200 for websocket over h2 as per RFC-8441
2374
+ // Absence of session means H1
2375
+ if ((socket.session != null && status !== 200) || (socket.session == null && status !== 101)) {
2376
+ return false
2377
+ }
2378
+
2379
+ const rawHeaders = controller?.rawHeaders ?? []
2380
+ const headersList = new HeadersList()
2381
+ appendHeadersListFromResponseHeaders(headersList, headers, rawHeaders)
2382
+
2383
+ resolve({
2384
+ status,
2385
+ statusText: STATUS_CODES[status],
2386
+ headersList,
2387
+ socket
2388
+ })
2389
+
2390
+ return true
2391
+ }
2392
+ }
2393
+ ))
2394
+ }
2395
+ }
2396
+ }
2397
+
2398
+ module.exports = {
2399
+ fetch,
2400
+ Fetch,
2401
+ fetching,
2402
+ finalizeAndReportTiming
2403
+ }