@pnpm/exe 11.0.6 → 11.0.8
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.
- package/dist/node-gyp-bin/node-gyp +0 -0
- package/dist/node-gyp-bin/node-gyp.cmd +0 -0
- package/dist/node_modules/node-gyp/.release-please-manifest.json +1 -1
- package/dist/node_modules/node-gyp/bin/node-gyp.js +0 -0
- package/dist/node_modules/node-gyp/gyp/.release-please-manifest.json +1 -1
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +11 -3
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +2 -3
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +1 -1
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +2 -1
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +26 -16
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +1 -1
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +1 -1
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +2 -2
- package/dist/node_modules/node-gyp/gyp/pylib/packaging/metadata.py +3 -20
- package/dist/node_modules/node-gyp/gyp/pylib/packaging/tags.py +2 -14
- package/dist/node_modules/node-gyp/gyp/pyproject.toml +5 -3
- package/dist/node_modules/node-gyp/lib/download.js +55 -8
- package/dist/node_modules/node-gyp/lib/find-visualstudio.js +1 -1
- package/dist/node_modules/node-gyp/lib/process-release.js +17 -19
- package/dist/node_modules/node-gyp/package.json +3 -3
- package/dist/node_modules/{safer-buffer → undici}/LICENSE +1 -1
- package/dist/node_modules/undici/index-fetch.js +35 -0
- package/dist/node_modules/undici/index.js +169 -0
- package/dist/node_modules/undici/lib/api/abort-signal.js +57 -0
- package/dist/node_modules/undici/lib/api/api-connect.js +108 -0
- package/dist/node_modules/undici/lib/api/api-pipeline.js +251 -0
- package/dist/node_modules/undici/lib/api/api-request.js +214 -0
- package/dist/node_modules/undici/lib/api/api-stream.js +220 -0
- package/dist/node_modules/undici/lib/api/api-upgrade.js +108 -0
- package/dist/node_modules/undici/lib/api/index.js +7 -0
- package/dist/node_modules/undici/lib/api/readable.js +385 -0
- package/dist/node_modules/undici/lib/api/util.js +93 -0
- package/dist/node_modules/undici/lib/core/connect.js +240 -0
- package/dist/node_modules/undici/lib/core/constants.js +118 -0
- package/dist/node_modules/undici/lib/core/diagnostics.js +202 -0
- package/dist/node_modules/undici/lib/core/errors.js +425 -0
- package/dist/node_modules/undici/lib/core/request.js +405 -0
- package/dist/node_modules/undici/lib/core/symbols.js +67 -0
- package/dist/node_modules/undici/lib/core/tree.js +152 -0
- package/dist/node_modules/undici/lib/core/util.js +719 -0
- package/dist/node_modules/undici/lib/dispatcher/agent.js +130 -0
- package/dist/node_modules/undici/lib/dispatcher/balanced-pool.js +209 -0
- package/dist/node_modules/undici/lib/dispatcher/client-h1.js +1370 -0
- package/dist/node_modules/undici/lib/dispatcher/client-h2.js +744 -0
- package/dist/node_modules/undici/lib/dispatcher/client.js +623 -0
- package/dist/node_modules/undici/lib/dispatcher/dispatcher-base.js +198 -0
- package/dist/node_modules/undici/lib/dispatcher/dispatcher.js +65 -0
- package/dist/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +160 -0
- package/dist/node_modules/undici/lib/dispatcher/fixed-queue.js +117 -0
- package/dist/node_modules/undici/lib/dispatcher/pool-base.js +194 -0
- package/dist/node_modules/undici/lib/dispatcher/pool-stats.js +34 -0
- package/dist/node_modules/undici/lib/dispatcher/pool.js +107 -0
- package/dist/node_modules/undici/lib/dispatcher/proxy-agent.js +274 -0
- package/dist/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
- package/dist/node_modules/undici/lib/global.js +32 -0
- package/dist/node_modules/undici/lib/handler/decorator-handler.js +44 -0
- package/dist/node_modules/undici/lib/handler/redirect-handler.js +232 -0
- package/dist/node_modules/undici/lib/handler/retry-handler.js +374 -0
- package/dist/node_modules/undici/lib/interceptor/dns.js +375 -0
- package/dist/node_modules/undici/lib/interceptor/dump.js +123 -0
- package/dist/node_modules/undici/lib/interceptor/redirect-interceptor.js +21 -0
- package/dist/node_modules/undici/lib/interceptor/redirect.js +24 -0
- package/dist/node_modules/undici/lib/interceptor/response-error.js +86 -0
- package/dist/node_modules/undici/lib/interceptor/retry.js +19 -0
- package/dist/node_modules/undici/lib/llhttp/.gitkeep +0 -0
- package/dist/node_modules/undici/lib/llhttp/constants.js +278 -0
- package/dist/node_modules/undici/lib/llhttp/llhttp-wasm.js +5 -0
- package/dist/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +5 -0
- package/dist/node_modules/undici/lib/llhttp/utils.js +15 -0
- package/dist/node_modules/undici/lib/mock/mock-agent.js +160 -0
- package/dist/node_modules/undici/lib/mock/mock-client.js +59 -0
- package/dist/node_modules/undici/lib/mock/mock-errors.js +28 -0
- package/dist/node_modules/undici/lib/mock/mock-interceptor.js +207 -0
- package/dist/node_modules/undici/lib/mock/mock-pool.js +59 -0
- package/dist/node_modules/undici/lib/mock/mock-symbols.js +23 -0
- package/dist/node_modules/undici/lib/mock/mock-utils.js +367 -0
- package/dist/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
- package/dist/node_modules/undici/lib/mock/pluralizer.js +29 -0
- package/dist/node_modules/undici/lib/util/timers.js +423 -0
- package/dist/node_modules/undici/lib/web/cache/cache.js +859 -0
- package/dist/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
- package/dist/node_modules/undici/lib/web/cache/symbols.js +5 -0
- package/dist/node_modules/undici/lib/web/cache/util.js +45 -0
- package/dist/node_modules/undici/lib/web/cookies/constants.js +12 -0
- package/dist/node_modules/undici/lib/web/cookies/index.js +184 -0
- package/dist/node_modules/undici/lib/web/cookies/parse.js +317 -0
- package/dist/node_modules/undici/lib/web/cookies/util.js +282 -0
- package/dist/node_modules/undici/lib/web/eventsource/eventsource-stream.js +398 -0
- package/dist/node_modules/undici/lib/web/eventsource/eventsource.js +480 -0
- package/dist/node_modules/undici/lib/web/eventsource/util.js +37 -0
- package/dist/node_modules/{@npmcli/redact → undici/lib/web/fetch}/LICENSE +1 -1
- package/dist/node_modules/undici/lib/web/fetch/body.js +529 -0
- package/dist/node_modules/undici/lib/web/fetch/constants.js +124 -0
- package/dist/node_modules/undici/lib/web/fetch/data-url.js +744 -0
- package/dist/node_modules/undici/lib/web/fetch/dispatcher-weakref.js +46 -0
- package/dist/node_modules/undici/lib/web/fetch/file.js +126 -0
- package/dist/node_modules/undici/lib/web/fetch/formdata-parser.js +474 -0
- package/dist/node_modules/undici/lib/web/fetch/formdata.js +252 -0
- package/dist/node_modules/undici/lib/web/fetch/global.js +40 -0
- package/dist/node_modules/undici/lib/web/fetch/headers.js +687 -0
- package/dist/node_modules/undici/lib/web/fetch/index.js +2272 -0
- package/dist/node_modules/undici/lib/web/fetch/request.js +1037 -0
- package/dist/node_modules/undici/lib/web/fetch/response.js +610 -0
- package/dist/node_modules/undici/lib/web/fetch/symbols.js +9 -0
- package/dist/node_modules/undici/lib/web/fetch/util.js +1632 -0
- package/dist/node_modules/undici/lib/web/fetch/webidl.js +695 -0
- package/dist/node_modules/undici/lib/web/fileapi/encoding.js +290 -0
- package/dist/node_modules/undici/lib/web/fileapi/filereader.js +344 -0
- package/dist/node_modules/undici/lib/web/fileapi/progressevent.js +78 -0
- package/dist/node_modules/undici/lib/web/fileapi/symbols.js +10 -0
- package/dist/node_modules/undici/lib/web/fileapi/util.js +391 -0
- package/dist/node_modules/undici/lib/web/websocket/connection.js +371 -0
- package/dist/node_modules/undici/lib/web/websocket/constants.js +66 -0
- package/dist/node_modules/undici/lib/web/websocket/events.js +329 -0
- package/dist/node_modules/undici/lib/web/websocket/frame.js +96 -0
- package/dist/node_modules/undici/lib/web/websocket/permessage-deflate.js +100 -0
- package/dist/node_modules/undici/lib/web/websocket/receiver.js +490 -0
- package/dist/node_modules/undici/lib/web/websocket/sender.js +104 -0
- package/dist/node_modules/undici/lib/web/websocket/symbols.js +12 -0
- package/dist/node_modules/undici/lib/web/websocket/util.js +322 -0
- package/dist/node_modules/undici/lib/web/websocket/websocket.js +592 -0
- package/dist/node_modules/undici/package.json +160 -0
- package/dist/node_modules/undici/scripts/strip-comments.js +8 -0
- package/dist/node_modules/yallist/package.json +51 -12
- package/dist/pnpm.mjs +4529 -3898
- package/dist/worker.js +76 -73
- package/package.json +21 -13
- package/setup.js +17 -3
- package/dist/node_modules/@gar/promise-retry/LICENSE +0 -20
- package/dist/node_modules/@gar/promise-retry/lib/index.js +0 -62
- package/dist/node_modules/@gar/promise-retry/lib/retry.js +0 -109
- package/dist/node_modules/@gar/promise-retry/package.json +0 -45
- package/dist/node_modules/@npmcli/agent/lib/agents.js +0 -206
- package/dist/node_modules/@npmcli/agent/lib/dns.js +0 -53
- package/dist/node_modules/@npmcli/agent/lib/errors.js +0 -61
- package/dist/node_modules/@npmcli/agent/lib/index.js +0 -56
- package/dist/node_modules/@npmcli/agent/lib/options.js +0 -86
- package/dist/node_modules/@npmcli/agent/lib/proxy.js +0 -88
- package/dist/node_modules/@npmcli/agent/package.json +0 -60
- package/dist/node_modules/@npmcli/fs/lib/common/get-options.js +0 -20
- package/dist/node_modules/@npmcli/fs/lib/common/node.js +0 -9
- package/dist/node_modules/@npmcli/fs/lib/cp/LICENSE +0 -15
- package/dist/node_modules/@npmcli/fs/lib/cp/errors.js +0 -129
- package/dist/node_modules/@npmcli/fs/lib/cp/index.js +0 -22
- package/dist/node_modules/@npmcli/fs/lib/cp/polyfill.js +0 -428
- package/dist/node_modules/@npmcli/fs/lib/index.js +0 -13
- package/dist/node_modules/@npmcli/fs/lib/move-file.js +0 -78
- package/dist/node_modules/@npmcli/fs/lib/readdir-scoped.js +0 -20
- package/dist/node_modules/@npmcli/fs/lib/with-temp-dir.js +0 -39
- package/dist/node_modules/@npmcli/fs/package.json +0 -54
- package/dist/node_modules/@npmcli/redact/lib/deep-map.js +0 -71
- package/dist/node_modules/@npmcli/redact/lib/error.js +0 -28
- package/dist/node_modules/@npmcli/redact/lib/index.js +0 -44
- package/dist/node_modules/@npmcli/redact/lib/matchers.js +0 -88
- package/dist/node_modules/@npmcli/redact/lib/server.js +0 -59
- package/dist/node_modules/@npmcli/redact/lib/utils.js +0 -202
- package/dist/node_modules/@npmcli/redact/package.json +0 -52
- package/dist/node_modules/agent-base/LICENSE +0 -22
- package/dist/node_modules/agent-base/dist/helpers.js +0 -66
- package/dist/node_modules/agent-base/dist/index.js +0 -178
- package/dist/node_modules/agent-base/package.json +0 -46
- package/dist/node_modules/balanced-match/dist/commonjs/index.js +0 -59
- package/dist/node_modules/balanced-match/dist/esm/index.js +0 -54
- package/dist/node_modules/balanced-match/package.json +0 -68
- package/dist/node_modules/brace-expansion/LICENSE +0 -23
- package/dist/node_modules/brace-expansion/dist/commonjs/index.js +0 -201
- package/dist/node_modules/brace-expansion/dist/commonjs/package.json +0 -3
- package/dist/node_modules/brace-expansion/dist/esm/index.js +0 -197
- package/dist/node_modules/brace-expansion/dist/esm/package.json +0 -3
- package/dist/node_modules/brace-expansion/package.json +0 -64
- package/dist/node_modules/cacache/lib/content/path.js +0 -29
- package/dist/node_modules/cacache/lib/content/read.js +0 -165
- package/dist/node_modules/cacache/lib/content/rm.js +0 -18
- package/dist/node_modules/cacache/lib/content/write.js +0 -206
- package/dist/node_modules/cacache/lib/entry-index.js +0 -336
- package/dist/node_modules/cacache/lib/get.js +0 -170
- package/dist/node_modules/cacache/lib/index.js +0 -42
- package/dist/node_modules/cacache/lib/memoization.js +0 -72
- package/dist/node_modules/cacache/lib/put.js +0 -80
- package/dist/node_modules/cacache/lib/rm.js +0 -31
- package/dist/node_modules/cacache/lib/util/glob.js +0 -7
- package/dist/node_modules/cacache/lib/util/hash-to-segments.js +0 -7
- package/dist/node_modules/cacache/lib/util/tmp.js +0 -32
- package/dist/node_modules/cacache/lib/verify.js +0 -258
- package/dist/node_modules/cacache/package.json +0 -81
- package/dist/node_modules/debug/LICENSE +0 -20
- package/dist/node_modules/debug/package.json +0 -64
- package/dist/node_modules/debug/src/browser.js +0 -272
- package/dist/node_modules/debug/src/common.js +0 -292
- package/dist/node_modules/debug/src/index.js +0 -10
- package/dist/node_modules/debug/src/node.js +0 -263
- package/dist/node_modules/fs-minipass/LICENSE +0 -15
- package/dist/node_modules/fs-minipass/lib/index.js +0 -443
- package/dist/node_modules/fs-minipass/package.json +0 -54
- package/dist/node_modules/glob/dist/commonjs/glob.js +0 -248
- package/dist/node_modules/glob/dist/commonjs/has-magic.js +0 -27
- package/dist/node_modules/glob/dist/commonjs/ignore.js +0 -119
- package/dist/node_modules/glob/dist/commonjs/index.js +0 -68
- package/dist/node_modules/glob/dist/commonjs/index.min.js +0 -4
- package/dist/node_modules/glob/dist/commonjs/package.json +0 -3
- package/dist/node_modules/glob/dist/commonjs/pattern.js +0 -223
- package/dist/node_modules/glob/dist/commonjs/processor.js +0 -301
- package/dist/node_modules/glob/dist/commonjs/walker.js +0 -387
- package/dist/node_modules/glob/dist/esm/glob.js +0 -244
- package/dist/node_modules/glob/dist/esm/has-magic.js +0 -23
- package/dist/node_modules/glob/dist/esm/ignore.js +0 -115
- package/dist/node_modules/glob/dist/esm/index.js +0 -55
- package/dist/node_modules/glob/dist/esm/index.min.js +0 -4
- package/dist/node_modules/glob/dist/esm/package.json +0 -3
- package/dist/node_modules/glob/dist/esm/pattern.js +0 -219
- package/dist/node_modules/glob/dist/esm/processor.js +0 -294
- package/dist/node_modules/glob/dist/esm/walker.js +0 -381
- package/dist/node_modules/glob/package.json +0 -98
- package/dist/node_modules/http-cache-semantics/LICENSE +0 -9
- package/dist/node_modules/http-cache-semantics/index.js +0 -928
- package/dist/node_modules/http-cache-semantics/package.json +0 -22
- package/dist/node_modules/http-proxy-agent/LICENSE +0 -22
- package/dist/node_modules/http-proxy-agent/dist/index.js +0 -148
- package/dist/node_modules/http-proxy-agent/package.json +0 -47
- package/dist/node_modules/https-proxy-agent/LICENSE +0 -22
- package/dist/node_modules/https-proxy-agent/dist/index.js +0 -180
- package/dist/node_modules/https-proxy-agent/dist/parse-proxy-response.js +0 -101
- package/dist/node_modules/https-proxy-agent/package.json +0 -50
- package/dist/node_modules/iconv-lite/LICENSE +0 -21
- package/dist/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -532
- package/dist/node_modules/iconv-lite/encodings/dbcs-data.js +0 -185
- package/dist/node_modules/iconv-lite/encodings/index.js +0 -23
- package/dist/node_modules/iconv-lite/encodings/internal.js +0 -218
- package/dist/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -75
- package/dist/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
- package/dist/node_modules/iconv-lite/encodings/sbcs-data.js +0 -178
- package/dist/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
- package/dist/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
- package/dist/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
- package/dist/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
- package/dist/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
- package/dist/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
- package/dist/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -56
- package/dist/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
- package/dist/node_modules/iconv-lite/encodings/utf16.js +0 -187
- package/dist/node_modules/iconv-lite/encodings/utf32.js +0 -307
- package/dist/node_modules/iconv-lite/encodings/utf7.js +0 -283
- package/dist/node_modules/iconv-lite/lib/bom-handling.js +0 -48
- package/dist/node_modules/iconv-lite/lib/helpers/merge-exports.js +0 -13
- package/dist/node_modules/iconv-lite/lib/index.js +0 -182
- package/dist/node_modules/iconv-lite/lib/streams.js +0 -105
- package/dist/node_modules/iconv-lite/package.json +0 -70
- package/dist/node_modules/ip-address/LICENSE +0 -19
- package/dist/node_modules/ip-address/dist/address-error.js +0 -12
- package/dist/node_modules/ip-address/dist/common.js +0 -46
- package/dist/node_modules/ip-address/dist/ip-address.js +0 -35
- package/dist/node_modules/ip-address/dist/ipv4.js +0 -360
- package/dist/node_modules/ip-address/dist/ipv6.js +0 -1003
- package/dist/node_modules/ip-address/dist/v4/constants.js +0 -8
- package/dist/node_modules/ip-address/dist/v6/constants.js +0 -76
- package/dist/node_modules/ip-address/dist/v6/helpers.js +0 -45
- package/dist/node_modules/ip-address/dist/v6/regular-expressions.js +0 -95
- package/dist/node_modules/ip-address/package.json +0 -78
- package/dist/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +0 -10
- package/dist/node_modules/lru-cache/dist/commonjs/index.js +0 -1692
- package/dist/node_modules/lru-cache/dist/commonjs/index.min.js +0 -2
- package/dist/node_modules/lru-cache/dist/commonjs/package.json +0 -3
- package/dist/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +0 -4
- package/dist/node_modules/lru-cache/dist/esm/browser/index.js +0 -1688
- package/dist/node_modules/lru-cache/dist/esm/browser/index.min.js +0 -2
- package/dist/node_modules/lru-cache/dist/esm/diagnostics-channel.js +0 -19
- package/dist/node_modules/lru-cache/dist/esm/index.js +0 -1688
- package/dist/node_modules/lru-cache/dist/esm/index.min.js +0 -2
- package/dist/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +0 -7
- package/dist/node_modules/lru-cache/dist/esm/node/index.js +0 -1688
- package/dist/node_modules/lru-cache/dist/esm/node/index.min.js +0 -2
- package/dist/node_modules/lru-cache/dist/esm/package.json +0 -3
- package/dist/node_modules/lru-cache/package.json +0 -126
- package/dist/node_modules/make-fetch-happen/LICENSE +0 -16
- package/dist/node_modules/make-fetch-happen/lib/cache/entry.js +0 -471
- package/dist/node_modules/make-fetch-happen/lib/cache/errors.js +0 -11
- package/dist/node_modules/make-fetch-happen/lib/cache/index.js +0 -49
- package/dist/node_modules/make-fetch-happen/lib/cache/key.js +0 -17
- package/dist/node_modules/make-fetch-happen/lib/cache/policy.js +0 -161
- package/dist/node_modules/make-fetch-happen/lib/fetch.js +0 -118
- package/dist/node_modules/make-fetch-happen/lib/index.js +0 -41
- package/dist/node_modules/make-fetch-happen/lib/options.js +0 -59
- package/dist/node_modules/make-fetch-happen/lib/pipeline.js +0 -41
- package/dist/node_modules/make-fetch-happen/lib/remote.js +0 -134
- package/dist/node_modules/make-fetch-happen/package.json +0 -75
- package/dist/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +0 -14
- package/dist/node_modules/minimatch/dist/commonjs/ast.js +0 -845
- package/dist/node_modules/minimatch/dist/commonjs/brace-expressions.js +0 -150
- package/dist/node_modules/minimatch/dist/commonjs/escape.js +0 -30
- package/dist/node_modules/minimatch/dist/commonjs/index.js +0 -1127
- package/dist/node_modules/minimatch/dist/commonjs/package.json +0 -3
- package/dist/node_modules/minimatch/dist/commonjs/unescape.js +0 -38
- package/dist/node_modules/minimatch/dist/esm/assert-valid-pattern.js +0 -10
- package/dist/node_modules/minimatch/dist/esm/ast.js +0 -841
- package/dist/node_modules/minimatch/dist/esm/brace-expressions.js +0 -146
- package/dist/node_modules/minimatch/dist/esm/escape.js +0 -26
- package/dist/node_modules/minimatch/dist/esm/index.js +0 -1114
- package/dist/node_modules/minimatch/dist/esm/package.json +0 -3
- package/dist/node_modules/minimatch/dist/esm/unescape.js +0 -34
- package/dist/node_modules/minimatch/package.json +0 -73
- package/dist/node_modules/minipass-collect/LICENSE +0 -15
- package/dist/node_modules/minipass-collect/index.js +0 -71
- package/dist/node_modules/minipass-collect/package.json +0 -30
- package/dist/node_modules/minipass-fetch/LICENSE +0 -28
- package/dist/node_modules/minipass-fetch/lib/abort-error.js +0 -17
- package/dist/node_modules/minipass-fetch/lib/blob.js +0 -97
- package/dist/node_modules/minipass-fetch/lib/body.js +0 -360
- package/dist/node_modules/minipass-fetch/lib/fetch-error.js +0 -32
- package/dist/node_modules/minipass-fetch/lib/headers.js +0 -267
- package/dist/node_modules/minipass-fetch/lib/index.js +0 -376
- package/dist/node_modules/minipass-fetch/lib/request.js +0 -282
- package/dist/node_modules/minipass-fetch/lib/response.js +0 -90
- package/dist/node_modules/minipass-fetch/package.json +0 -70
- package/dist/node_modules/minipass-flush/index.js +0 -39
- package/dist/node_modules/minipass-flush/node_modules/minipass/LICENSE +0 -15
- package/dist/node_modules/minipass-flush/node_modules/minipass/index.js +0 -649
- package/dist/node_modules/minipass-flush/node_modules/minipass/package.json +0 -56
- package/dist/node_modules/minipass-flush/package.json +0 -42
- package/dist/node_modules/minipass-pipeline/LICENSE +0 -15
- package/dist/node_modules/minipass-pipeline/index.js +0 -128
- package/dist/node_modules/minipass-pipeline/node_modules/minipass/LICENSE +0 -15
- package/dist/node_modules/minipass-pipeline/node_modules/minipass/index.js +0 -649
- package/dist/node_modules/minipass-pipeline/node_modules/minipass/package.json +0 -56
- package/dist/node_modules/minipass-pipeline/package.json +0 -29
- package/dist/node_modules/minipass-sized/LICENSE +0 -15
- package/dist/node_modules/minipass-sized/dist/commonjs/index.js +0 -69
- package/dist/node_modules/minipass-sized/dist/commonjs/package.json +0 -3
- package/dist/node_modules/minipass-sized/dist/esm/index.js +0 -64
- package/dist/node_modules/minipass-sized/dist/esm/package.json +0 -3
- package/dist/node_modules/minipass-sized/package.json +0 -69
- package/dist/node_modules/ms/index.js +0 -162
- package/dist/node_modules/ms/package.json +0 -38
- package/dist/node_modules/negotiator/LICENSE +0 -24
- package/dist/node_modules/negotiator/index.js +0 -83
- package/dist/node_modules/negotiator/lib/charset.js +0 -169
- package/dist/node_modules/negotiator/lib/encoding.js +0 -205
- package/dist/node_modules/negotiator/lib/language.js +0 -179
- package/dist/node_modules/negotiator/lib/mediaType.js +0 -294
- package/dist/node_modules/negotiator/package.json +0 -43
- package/dist/node_modules/p-map/index.js +0 -283
- package/dist/node_modules/p-map/license +0 -9
- package/dist/node_modules/p-map/package.json +0 -57
- package/dist/node_modules/path-scurry/dist/commonjs/index.js +0 -2018
- package/dist/node_modules/path-scurry/dist/commonjs/package.json +0 -3
- package/dist/node_modules/path-scurry/dist/esm/index.js +0 -1983
- package/dist/node_modules/path-scurry/dist/esm/package.json +0 -3
- package/dist/node_modules/path-scurry/package.json +0 -72
- package/dist/node_modules/safer-buffer/dangerous.js +0 -58
- package/dist/node_modules/safer-buffer/package.json +0 -34
- package/dist/node_modules/safer-buffer/safer.js +0 -77
- package/dist/node_modules/safer-buffer/tests.js +0 -406
- package/dist/node_modules/smart-buffer/.prettierrc.yaml +0 -5
- package/dist/node_modules/smart-buffer/LICENSE +0 -20
- package/dist/node_modules/smart-buffer/build/smartbuffer.js +0 -1233
- package/dist/node_modules/smart-buffer/build/utils.js +0 -108
- package/dist/node_modules/smart-buffer/package.json +0 -79
- package/dist/node_modules/socks/.eslintrc.cjs +0 -11
- package/dist/node_modules/socks/.prettierrc.yaml +0 -7
- package/dist/node_modules/socks/LICENSE +0 -20
- package/dist/node_modules/socks/build/client/socksclient.js +0 -793
- package/dist/node_modules/socks/build/common/constants.js +0 -108
- package/dist/node_modules/socks/build/common/helpers.js +0 -167
- package/dist/node_modules/socks/build/common/receivebuffer.js +0 -43
- package/dist/node_modules/socks/build/common/util.js +0 -25
- package/dist/node_modules/socks/build/index.js +0 -18
- package/dist/node_modules/socks/package.json +0 -58
- package/dist/node_modules/socks-proxy-agent/LICENSE +0 -22
- package/dist/node_modules/socks-proxy-agent/dist/index.js +0 -195
- package/dist/node_modules/socks-proxy-agent/package.json +0 -142
- package/dist/node_modules/ssri/lib/index.js +0 -550
- package/dist/node_modules/ssri/package.json +0 -66
- package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/package.json +0 -3
- package/dist/node_modules/tar/node_modules/yallist/dist/esm/package.json +0 -3
- package/dist/node_modules/tar/node_modules/yallist/package.json +0 -68
- package/dist/node_modules/yallist/LICENSE +0 -15
- package/dist/node_modules/yallist/iterator.js +0 -8
- package/dist/node_modules/yallist/yallist.js +0 -426
- /package/dist/node_modules/{tar/node_modules/yallist → yallist}/dist/commonjs/index.js +0 -0
- /package/dist/node_modules/{balanced-match → yallist}/dist/commonjs/package.json +0 -0
- /package/dist/node_modules/{tar/node_modules/yallist → yallist}/dist/esm/index.js +0 -0
- /package/dist/node_modules/{balanced-match → yallist}/dist/esm/package.json +0 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const DispatcherBase = require('./dispatcher-base')
|
|
4
|
+
const FixedQueue = require('./fixed-queue')
|
|
5
|
+
const { kConnected, kSize, kRunning, kPending, kQueued, kBusy, kFree, kUrl, kClose, kDestroy, kDispatch } = require('../core/symbols')
|
|
6
|
+
const PoolStats = require('./pool-stats')
|
|
7
|
+
|
|
8
|
+
const kClients = Symbol('clients')
|
|
9
|
+
const kNeedDrain = Symbol('needDrain')
|
|
10
|
+
const kQueue = Symbol('queue')
|
|
11
|
+
const kClosedResolve = Symbol('closed resolve')
|
|
12
|
+
const kOnDrain = Symbol('onDrain')
|
|
13
|
+
const kOnConnect = Symbol('onConnect')
|
|
14
|
+
const kOnDisconnect = Symbol('onDisconnect')
|
|
15
|
+
const kOnConnectionError = Symbol('onConnectionError')
|
|
16
|
+
const kGetDispatcher = Symbol('get dispatcher')
|
|
17
|
+
const kAddClient = Symbol('add client')
|
|
18
|
+
const kRemoveClient = Symbol('remove client')
|
|
19
|
+
const kStats = Symbol('stats')
|
|
20
|
+
|
|
21
|
+
class PoolBase extends DispatcherBase {
|
|
22
|
+
constructor (opts) {
|
|
23
|
+
super(opts)
|
|
24
|
+
|
|
25
|
+
this[kQueue] = new FixedQueue()
|
|
26
|
+
this[kClients] = []
|
|
27
|
+
this[kQueued] = 0
|
|
28
|
+
|
|
29
|
+
const pool = this
|
|
30
|
+
|
|
31
|
+
this[kOnDrain] = function onDrain (origin, targets) {
|
|
32
|
+
const queue = pool[kQueue]
|
|
33
|
+
|
|
34
|
+
let needDrain = false
|
|
35
|
+
|
|
36
|
+
while (!needDrain) {
|
|
37
|
+
const item = queue.shift()
|
|
38
|
+
if (!item) {
|
|
39
|
+
break
|
|
40
|
+
}
|
|
41
|
+
pool[kQueued]--
|
|
42
|
+
needDrain = !this.dispatch(item.opts, item.handler)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
this[kNeedDrain] = needDrain
|
|
46
|
+
|
|
47
|
+
if (!this[kNeedDrain] && pool[kNeedDrain]) {
|
|
48
|
+
pool[kNeedDrain] = false
|
|
49
|
+
pool.emit('drain', origin, [pool, ...targets])
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (pool[kClosedResolve] && queue.isEmpty()) {
|
|
53
|
+
Promise
|
|
54
|
+
.all(pool[kClients].map(c => c.close()))
|
|
55
|
+
.then(pool[kClosedResolve])
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
this[kOnConnect] = (origin, targets) => {
|
|
60
|
+
pool.emit('connect', origin, [pool, ...targets])
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this[kOnDisconnect] = (origin, targets, err) => {
|
|
64
|
+
pool.emit('disconnect', origin, [pool, ...targets], err)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
this[kOnConnectionError] = (origin, targets, err) => {
|
|
68
|
+
pool.emit('connectionError', origin, [pool, ...targets], err)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this[kStats] = new PoolStats(this)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
get [kBusy] () {
|
|
75
|
+
return this[kNeedDrain]
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
get [kConnected] () {
|
|
79
|
+
return this[kClients].filter(client => client[kConnected]).length
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
get [kFree] () {
|
|
83
|
+
return this[kClients].filter(client => client[kConnected] && !client[kNeedDrain]).length
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
get [kPending] () {
|
|
87
|
+
let ret = this[kQueued]
|
|
88
|
+
for (const { [kPending]: pending } of this[kClients]) {
|
|
89
|
+
ret += pending
|
|
90
|
+
}
|
|
91
|
+
return ret
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
get [kRunning] () {
|
|
95
|
+
let ret = 0
|
|
96
|
+
for (const { [kRunning]: running } of this[kClients]) {
|
|
97
|
+
ret += running
|
|
98
|
+
}
|
|
99
|
+
return ret
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
get [kSize] () {
|
|
103
|
+
let ret = this[kQueued]
|
|
104
|
+
for (const { [kSize]: size } of this[kClients]) {
|
|
105
|
+
ret += size
|
|
106
|
+
}
|
|
107
|
+
return ret
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
get stats () {
|
|
111
|
+
return this[kStats]
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async [kClose] () {
|
|
115
|
+
if (this[kQueue].isEmpty()) {
|
|
116
|
+
await Promise.all(this[kClients].map(c => c.close()))
|
|
117
|
+
} else {
|
|
118
|
+
await new Promise((resolve) => {
|
|
119
|
+
this[kClosedResolve] = resolve
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async [kDestroy] (err) {
|
|
125
|
+
while (true) {
|
|
126
|
+
const item = this[kQueue].shift()
|
|
127
|
+
if (!item) {
|
|
128
|
+
break
|
|
129
|
+
}
|
|
130
|
+
item.handler.onError(err)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
await Promise.all(this[kClients].map(c => c.destroy(err)))
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
[kDispatch] (opts, handler) {
|
|
137
|
+
const dispatcher = this[kGetDispatcher]()
|
|
138
|
+
|
|
139
|
+
if (!dispatcher) {
|
|
140
|
+
this[kNeedDrain] = true
|
|
141
|
+
this[kQueue].push({ opts, handler })
|
|
142
|
+
this[kQueued]++
|
|
143
|
+
} else if (!dispatcher.dispatch(opts, handler)) {
|
|
144
|
+
dispatcher[kNeedDrain] = true
|
|
145
|
+
this[kNeedDrain] = !this[kGetDispatcher]()
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return !this[kNeedDrain]
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
[kAddClient] (client) {
|
|
152
|
+
client
|
|
153
|
+
.on('drain', this[kOnDrain])
|
|
154
|
+
.on('connect', this[kOnConnect])
|
|
155
|
+
.on('disconnect', this[kOnDisconnect])
|
|
156
|
+
.on('connectionError', this[kOnConnectionError])
|
|
157
|
+
|
|
158
|
+
this[kClients].push(client)
|
|
159
|
+
|
|
160
|
+
if (this[kNeedDrain]) {
|
|
161
|
+
queueMicrotask(() => {
|
|
162
|
+
if (this[kNeedDrain]) {
|
|
163
|
+
this[kOnDrain](client[kUrl], [this, client])
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return this
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
[kRemoveClient] (client) {
|
|
172
|
+
client.close(() => {
|
|
173
|
+
const idx = this[kClients].indexOf(client)
|
|
174
|
+
if (idx !== -1) {
|
|
175
|
+
this[kClients].splice(idx, 1)
|
|
176
|
+
}
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
this[kNeedDrain] = this[kClients].some(dispatcher => (
|
|
180
|
+
!dispatcher[kNeedDrain] &&
|
|
181
|
+
dispatcher.closed !== true &&
|
|
182
|
+
dispatcher.destroyed !== true
|
|
183
|
+
))
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
module.exports = {
|
|
188
|
+
PoolBase,
|
|
189
|
+
kClients,
|
|
190
|
+
kNeedDrain,
|
|
191
|
+
kAddClient,
|
|
192
|
+
kRemoveClient,
|
|
193
|
+
kGetDispatcher
|
|
194
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const { kFree, kConnected, kPending, kQueued, kRunning, kSize } = require('../core/symbols')
|
|
2
|
+
const kPool = Symbol('pool')
|
|
3
|
+
|
|
4
|
+
class PoolStats {
|
|
5
|
+
constructor (pool) {
|
|
6
|
+
this[kPool] = pool
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
get connected () {
|
|
10
|
+
return this[kPool][kConnected]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get free () {
|
|
14
|
+
return this[kPool][kFree]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get pending () {
|
|
18
|
+
return this[kPool][kPending]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get queued () {
|
|
22
|
+
return this[kPool][kQueued]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get running () {
|
|
26
|
+
return this[kPool][kRunning]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
get size () {
|
|
30
|
+
return this[kPool][kSize]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = PoolStats
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
PoolBase,
|
|
5
|
+
kClients,
|
|
6
|
+
kNeedDrain,
|
|
7
|
+
kAddClient,
|
|
8
|
+
kGetDispatcher
|
|
9
|
+
} = require('./pool-base')
|
|
10
|
+
const Client = require('./client')
|
|
11
|
+
const {
|
|
12
|
+
InvalidArgumentError
|
|
13
|
+
} = require('../core/errors')
|
|
14
|
+
const util = require('../core/util')
|
|
15
|
+
const { kUrl, kInterceptors } = require('../core/symbols')
|
|
16
|
+
const buildConnector = require('../core/connect')
|
|
17
|
+
|
|
18
|
+
const kOptions = Symbol('options')
|
|
19
|
+
const kConnections = Symbol('connections')
|
|
20
|
+
const kFactory = Symbol('factory')
|
|
21
|
+
|
|
22
|
+
function defaultFactory (origin, opts) {
|
|
23
|
+
return new Client(origin, opts)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
class Pool extends PoolBase {
|
|
27
|
+
constructor (origin, {
|
|
28
|
+
connections,
|
|
29
|
+
factory = defaultFactory,
|
|
30
|
+
connect,
|
|
31
|
+
connectTimeout,
|
|
32
|
+
tls,
|
|
33
|
+
maxCachedSessions,
|
|
34
|
+
socketPath,
|
|
35
|
+
autoSelectFamily,
|
|
36
|
+
autoSelectFamilyAttemptTimeout,
|
|
37
|
+
allowH2,
|
|
38
|
+
...options
|
|
39
|
+
} = {}) {
|
|
40
|
+
if (connections != null && (!Number.isFinite(connections) || connections < 0)) {
|
|
41
|
+
throw new InvalidArgumentError('invalid connections')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (typeof factory !== 'function') {
|
|
45
|
+
throw new InvalidArgumentError('factory must be a function.')
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') {
|
|
49
|
+
throw new InvalidArgumentError('connect must be a function or an object')
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (typeof connect !== 'function') {
|
|
53
|
+
connect = buildConnector({
|
|
54
|
+
...tls,
|
|
55
|
+
maxCachedSessions,
|
|
56
|
+
allowH2,
|
|
57
|
+
socketPath,
|
|
58
|
+
timeout: connectTimeout,
|
|
59
|
+
...(autoSelectFamily ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : undefined),
|
|
60
|
+
...connect
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
super(options)
|
|
65
|
+
|
|
66
|
+
this[kInterceptors] = options.interceptors?.Pool && Array.isArray(options.interceptors.Pool)
|
|
67
|
+
? options.interceptors.Pool
|
|
68
|
+
: []
|
|
69
|
+
this[kConnections] = connections || null
|
|
70
|
+
this[kUrl] = util.parseOrigin(origin)
|
|
71
|
+
this[kOptions] = { ...util.deepClone(options), connect, allowH2 }
|
|
72
|
+
this[kOptions].interceptors = options.interceptors
|
|
73
|
+
? { ...options.interceptors }
|
|
74
|
+
: undefined
|
|
75
|
+
this[kFactory] = factory
|
|
76
|
+
|
|
77
|
+
this.on('connectionError', (origin, targets, error) => {
|
|
78
|
+
// If a connection error occurs, we remove the client from the pool,
|
|
79
|
+
// and emit a connectionError event. They will not be re-used.
|
|
80
|
+
// Fixes https://github.com/nodejs/undici/issues/3895
|
|
81
|
+
for (const target of targets) {
|
|
82
|
+
// Do not use kRemoveClient here, as it will close the client,
|
|
83
|
+
// but the client cannot be closed in this state.
|
|
84
|
+
const idx = this[kClients].indexOf(target)
|
|
85
|
+
if (idx !== -1) {
|
|
86
|
+
this[kClients].splice(idx, 1)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
[kGetDispatcher] () {
|
|
93
|
+
for (const client of this[kClients]) {
|
|
94
|
+
if (!client[kNeedDrain]) {
|
|
95
|
+
return client
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (!this[kConnections] || this[kClients].length < this[kConnections]) {
|
|
100
|
+
const dispatcher = this[kFactory](this[kUrl], this[kOptions])
|
|
101
|
+
this[kAddClient](dispatcher)
|
|
102
|
+
return dispatcher
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
module.exports = Pool
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { kProxy, kClose, kDestroy, kDispatch, kInterceptors } = require('../core/symbols')
|
|
4
|
+
const { URL } = require('node:url')
|
|
5
|
+
const Agent = require('./agent')
|
|
6
|
+
const Pool = require('./pool')
|
|
7
|
+
const DispatcherBase = require('./dispatcher-base')
|
|
8
|
+
const { InvalidArgumentError, RequestAbortedError, SecureProxyConnectionError } = require('../core/errors')
|
|
9
|
+
const buildConnector = require('../core/connect')
|
|
10
|
+
const Client = require('./client')
|
|
11
|
+
|
|
12
|
+
const kAgent = Symbol('proxy agent')
|
|
13
|
+
const kClient = Symbol('proxy client')
|
|
14
|
+
const kProxyHeaders = Symbol('proxy headers')
|
|
15
|
+
const kRequestTls = Symbol('request tls settings')
|
|
16
|
+
const kProxyTls = Symbol('proxy tls settings')
|
|
17
|
+
const kConnectEndpoint = Symbol('connect endpoint function')
|
|
18
|
+
const kTunnelProxy = Symbol('tunnel proxy')
|
|
19
|
+
|
|
20
|
+
function defaultProtocolPort (protocol) {
|
|
21
|
+
return protocol === 'https:' ? 443 : 80
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function defaultFactory (origin, opts) {
|
|
25
|
+
return new Pool(origin, opts)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const noop = () => {}
|
|
29
|
+
|
|
30
|
+
function defaultAgentFactory (origin, opts) {
|
|
31
|
+
if (opts.connections === 1) {
|
|
32
|
+
return new Client(origin, opts)
|
|
33
|
+
}
|
|
34
|
+
return new Pool(origin, opts)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
class Http1ProxyWrapper extends DispatcherBase {
|
|
38
|
+
#client
|
|
39
|
+
|
|
40
|
+
constructor (proxyUrl, { headers = {}, connect, factory }) {
|
|
41
|
+
super()
|
|
42
|
+
if (!proxyUrl) {
|
|
43
|
+
throw new InvalidArgumentError('Proxy URL is mandatory')
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
this[kProxyHeaders] = headers
|
|
47
|
+
if (factory) {
|
|
48
|
+
this.#client = factory(proxyUrl, { connect })
|
|
49
|
+
} else {
|
|
50
|
+
this.#client = new Client(proxyUrl, { connect })
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
[kDispatch] (opts, handler) {
|
|
55
|
+
const onHeaders = handler.onHeaders
|
|
56
|
+
handler.onHeaders = function (statusCode, data, resume) {
|
|
57
|
+
if (statusCode === 407) {
|
|
58
|
+
if (typeof handler.onError === 'function') {
|
|
59
|
+
handler.onError(new InvalidArgumentError('Proxy Authentication Required (407)'))
|
|
60
|
+
}
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
if (onHeaders) onHeaders.call(this, statusCode, data, resume)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Rewrite request as an HTTP1 Proxy request, without tunneling.
|
|
67
|
+
const {
|
|
68
|
+
origin,
|
|
69
|
+
path = '/',
|
|
70
|
+
headers = {}
|
|
71
|
+
} = opts
|
|
72
|
+
|
|
73
|
+
opts.path = origin + path
|
|
74
|
+
|
|
75
|
+
if (!('host' in headers) && !('Host' in headers)) {
|
|
76
|
+
const { host } = new URL(origin)
|
|
77
|
+
headers.host = host
|
|
78
|
+
}
|
|
79
|
+
opts.headers = { ...this[kProxyHeaders], ...headers }
|
|
80
|
+
|
|
81
|
+
return this.#client[kDispatch](opts, handler)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async [kClose] () {
|
|
85
|
+
return this.#client.close()
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async [kDestroy] (err) {
|
|
89
|
+
return this.#client.destroy(err)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
class ProxyAgent extends DispatcherBase {
|
|
94
|
+
constructor (opts) {
|
|
95
|
+
super()
|
|
96
|
+
|
|
97
|
+
if (!opts || (typeof opts === 'object' && !(opts instanceof URL) && !opts.uri)) {
|
|
98
|
+
throw new InvalidArgumentError('Proxy uri is mandatory')
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const { clientFactory = defaultFactory } = opts
|
|
102
|
+
if (typeof clientFactory !== 'function') {
|
|
103
|
+
throw new InvalidArgumentError('Proxy opts.clientFactory must be a function.')
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const { proxyTunnel = true } = opts
|
|
107
|
+
|
|
108
|
+
const url = this.#getUrl(opts)
|
|
109
|
+
const { href, origin, port, protocol, username, password, hostname: proxyHostname } = url
|
|
110
|
+
|
|
111
|
+
this[kProxy] = { uri: href, protocol }
|
|
112
|
+
this[kInterceptors] = opts.interceptors?.ProxyAgent && Array.isArray(opts.interceptors.ProxyAgent)
|
|
113
|
+
? opts.interceptors.ProxyAgent
|
|
114
|
+
: []
|
|
115
|
+
this[kRequestTls] = opts.requestTls
|
|
116
|
+
this[kProxyTls] = opts.proxyTls
|
|
117
|
+
this[kProxyHeaders] = opts.headers || {}
|
|
118
|
+
this[kTunnelProxy] = proxyTunnel
|
|
119
|
+
|
|
120
|
+
if (opts.auth && opts.token) {
|
|
121
|
+
throw new InvalidArgumentError('opts.auth cannot be used in combination with opts.token')
|
|
122
|
+
} else if (opts.auth) {
|
|
123
|
+
/* @deprecated in favour of opts.token */
|
|
124
|
+
this[kProxyHeaders]['proxy-authorization'] = `Basic ${opts.auth}`
|
|
125
|
+
} else if (opts.token) {
|
|
126
|
+
this[kProxyHeaders]['proxy-authorization'] = opts.token
|
|
127
|
+
} else if (username && password) {
|
|
128
|
+
this[kProxyHeaders]['proxy-authorization'] = `Basic ${Buffer.from(`${decodeURIComponent(username)}:${decodeURIComponent(password)}`).toString('base64')}`
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const connect = buildConnector({ ...opts.proxyTls })
|
|
132
|
+
this[kConnectEndpoint] = buildConnector({ ...opts.requestTls })
|
|
133
|
+
|
|
134
|
+
const agentFactory = opts.factory || defaultAgentFactory
|
|
135
|
+
const factory = (origin, options) => {
|
|
136
|
+
const { protocol } = new URL(origin)
|
|
137
|
+
if (!this[kTunnelProxy] && protocol === 'http:' && this[kProxy].protocol === 'http:') {
|
|
138
|
+
return new Http1ProxyWrapper(this[kProxy].uri, {
|
|
139
|
+
headers: this[kProxyHeaders],
|
|
140
|
+
connect,
|
|
141
|
+
factory: agentFactory
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
return agentFactory(origin, options)
|
|
145
|
+
}
|
|
146
|
+
this[kClient] = clientFactory(url, { connect })
|
|
147
|
+
this[kAgent] = new Agent({
|
|
148
|
+
...opts,
|
|
149
|
+
factory,
|
|
150
|
+
connect: async (opts, callback) => {
|
|
151
|
+
let requestedPath = opts.host
|
|
152
|
+
if (!opts.port) {
|
|
153
|
+
requestedPath += `:${defaultProtocolPort(opts.protocol)}`
|
|
154
|
+
}
|
|
155
|
+
try {
|
|
156
|
+
const { socket, statusCode } = await this[kClient].connect({
|
|
157
|
+
origin,
|
|
158
|
+
port,
|
|
159
|
+
path: requestedPath,
|
|
160
|
+
signal: opts.signal,
|
|
161
|
+
headers: {
|
|
162
|
+
...this[kProxyHeaders],
|
|
163
|
+
host: opts.host
|
|
164
|
+
},
|
|
165
|
+
servername: this[kProxyTls]?.servername || proxyHostname
|
|
166
|
+
})
|
|
167
|
+
if (statusCode !== 200) {
|
|
168
|
+
socket.on('error', noop).destroy()
|
|
169
|
+
callback(new RequestAbortedError(`Proxy response (${statusCode}) !== 200 when HTTP Tunneling`))
|
|
170
|
+
}
|
|
171
|
+
if (opts.protocol !== 'https:') {
|
|
172
|
+
callback(null, socket)
|
|
173
|
+
return
|
|
174
|
+
}
|
|
175
|
+
let servername
|
|
176
|
+
if (this[kRequestTls]) {
|
|
177
|
+
servername = this[kRequestTls].servername
|
|
178
|
+
} else {
|
|
179
|
+
servername = opts.servername
|
|
180
|
+
}
|
|
181
|
+
this[kConnectEndpoint]({ ...opts, servername, httpSocket: socket }, callback)
|
|
182
|
+
} catch (err) {
|
|
183
|
+
if (err.code === 'ERR_TLS_CERT_ALTNAME_INVALID') {
|
|
184
|
+
// Throw a custom error to avoid loop in client.js#connect
|
|
185
|
+
callback(new SecureProxyConnectionError(err))
|
|
186
|
+
} else {
|
|
187
|
+
callback(err)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
dispatch (opts, handler) {
|
|
195
|
+
const headers = buildHeaders(opts.headers)
|
|
196
|
+
throwIfProxyAuthIsSent(headers)
|
|
197
|
+
|
|
198
|
+
if (headers && !('host' in headers) && !('Host' in headers)) {
|
|
199
|
+
const { host } = new URL(opts.origin)
|
|
200
|
+
headers.host = host
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return this[kAgent].dispatch(
|
|
204
|
+
{
|
|
205
|
+
...opts,
|
|
206
|
+
headers
|
|
207
|
+
},
|
|
208
|
+
handler
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @param {import('../types/proxy-agent').ProxyAgent.Options | string | URL} opts
|
|
214
|
+
* @returns {URL}
|
|
215
|
+
*/
|
|
216
|
+
#getUrl (opts) {
|
|
217
|
+
if (typeof opts === 'string') {
|
|
218
|
+
return new URL(opts)
|
|
219
|
+
} else if (opts instanceof URL) {
|
|
220
|
+
return opts
|
|
221
|
+
} else {
|
|
222
|
+
return new URL(opts.uri)
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async [kClose] () {
|
|
227
|
+
await this[kAgent].close()
|
|
228
|
+
await this[kClient].close()
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async [kDestroy] () {
|
|
232
|
+
await this[kAgent].destroy()
|
|
233
|
+
await this[kClient].destroy()
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @param {string[] | Record<string, string>} headers
|
|
239
|
+
* @returns {Record<string, string>}
|
|
240
|
+
*/
|
|
241
|
+
function buildHeaders (headers) {
|
|
242
|
+
// When using undici.fetch, the headers list is stored
|
|
243
|
+
// as an array.
|
|
244
|
+
if (Array.isArray(headers)) {
|
|
245
|
+
/** @type {Record<string, string>} */
|
|
246
|
+
const headersPair = {}
|
|
247
|
+
|
|
248
|
+
for (let i = 0; i < headers.length; i += 2) {
|
|
249
|
+
headersPair[headers[i]] = headers[i + 1]
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return headersPair
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return headers
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @param {Record<string, string>} headers
|
|
260
|
+
*
|
|
261
|
+
* Previous versions of ProxyAgent suggests the Proxy-Authorization in request headers
|
|
262
|
+
* Nevertheless, it was changed and to avoid a security vulnerability by end users
|
|
263
|
+
* this check was created.
|
|
264
|
+
* It should be removed in the next major version for performance reasons
|
|
265
|
+
*/
|
|
266
|
+
function throwIfProxyAuthIsSent (headers) {
|
|
267
|
+
const existProxyAuth = headers && Object.keys(headers)
|
|
268
|
+
.find((key) => key.toLowerCase() === 'proxy-authorization')
|
|
269
|
+
if (existProxyAuth) {
|
|
270
|
+
throw new InvalidArgumentError('Proxy-Authorization should be sent in ProxyAgent constructor')
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
module.exports = ProxyAgent
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const Dispatcher = require('./dispatcher')
|
|
4
|
+
const RetryHandler = require('../handler/retry-handler')
|
|
5
|
+
|
|
6
|
+
class RetryAgent extends Dispatcher {
|
|
7
|
+
#agent = null
|
|
8
|
+
#options = null
|
|
9
|
+
constructor (agent, options = {}) {
|
|
10
|
+
super(options)
|
|
11
|
+
this.#agent = agent
|
|
12
|
+
this.#options = options
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
dispatch (opts, handler) {
|
|
16
|
+
const retry = new RetryHandler({
|
|
17
|
+
...opts,
|
|
18
|
+
retryOptions: this.#options
|
|
19
|
+
}, {
|
|
20
|
+
dispatch: this.#agent.dispatch.bind(this.#agent),
|
|
21
|
+
handler
|
|
22
|
+
})
|
|
23
|
+
return this.#agent.dispatch(opts, retry)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
close () {
|
|
27
|
+
return this.#agent.close()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
destroy () {
|
|
31
|
+
return this.#agent.destroy()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = RetryAgent
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// We include a version number for the Dispatcher API. In case of breaking changes,
|
|
4
|
+
// this version number must be increased to avoid conflicts.
|
|
5
|
+
const globalDispatcher = Symbol.for('undici.globalDispatcher.1')
|
|
6
|
+
const { InvalidArgumentError } = require('./core/errors')
|
|
7
|
+
const Agent = require('./dispatcher/agent')
|
|
8
|
+
|
|
9
|
+
if (getGlobalDispatcher() === undefined) {
|
|
10
|
+
setGlobalDispatcher(new Agent())
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function setGlobalDispatcher (agent) {
|
|
14
|
+
if (!agent || typeof agent.dispatch !== 'function') {
|
|
15
|
+
throw new InvalidArgumentError('Argument agent must implement Agent')
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(globalThis, globalDispatcher, {
|
|
18
|
+
value: agent,
|
|
19
|
+
writable: true,
|
|
20
|
+
enumerable: false,
|
|
21
|
+
configurable: false
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getGlobalDispatcher () {
|
|
26
|
+
return globalThis[globalDispatcher]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = {
|
|
30
|
+
setGlobalDispatcher,
|
|
31
|
+
getGlobalDispatcher
|
|
32
|
+
}
|