diff --git a/.gitattributes b/.gitattributes index 9f7d9377eaf426..82563e5d2fc91b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,6 @@ test/fixtures/* -text vcbuild.bat text eol=crlf +deps/npm/bin/npm text eol=lf +deps/npm/bin/npx text eol=lf +deps/corepack/shims/corepack text eol=lf tools/msvs/find_python.cmd text eol=crlf diff --git a/.github/label-pr-config.yml b/.github/label-pr-config.yml index 5f83de231262a5..e76fa3e4e694a7 100644 --- a/.github/label-pr-config.yml +++ b/.github/label-pr-config.yml @@ -26,7 +26,7 @@ subSystemLabels: /^src\/.*win32.*/: c++, windows /^src\/node_zlib/: c++, zlib /^src\/tracing/: c++, tracing - /^src\/node_api/: c++, node-api + /^src\/(?:node_api|js_native_api)/: c++, node-api /^src\/node_http2/: c++, http2 /^src\/node_report/: c++, report /^src\/node_wasi/: c++, wasi @@ -117,7 +117,8 @@ exlusiveLabels: /^test\/inspector\//: test, inspector /^test\/cctest\/test_inspector/: test, inspector /^test\/cctest\/test_url/: test, whatwg-url - /^test\/addons-napi\//: test, node-api + /^test\/node-api\//: test, node-api + /^test\/js-native-api\//: test, node-api /^test\/async-hooks\//: test, async_hooks /^test\/report\//: test, report /^test\/fixtures\/es-module/: test, esm diff --git a/.github/workflows/build-tarball.yml b/.github/workflows/build-tarball.yml index 4509450172f277..2ced884f35c539 100644 --- a/.github/workflows/build-tarball.yml +++ b/.github/workflows/build-tarball.yml @@ -29,7 +29,7 @@ concurrency: env: PYTHON_VERSION: '3.10' - FLAKY_TESTS: dontcare + FLAKY_TESTS: keep_retrying permissions: contents: read @@ -94,4 +94,4 @@ jobs: - name: Test run: | cd $TAR_DIR - make run-ci -j2 V=1 TEST_CI_ARGS="-p dots" + make run-ci -j2 V=1 TEST_CI_ARGS="-p dots --measure-flakiness 9" diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 3e7ec807a34799..9b5f81a816e2d0 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -24,7 +24,7 @@ concurrency: env: PYTHON_VERSION: '3.10' - FLAKY_TESTS: dontcare + FLAKY_TESTS: keep_retrying permissions: contents: read diff --git a/.github/workflows/coverage-linux.yml b/.github/workflows/coverage-linux.yml index abd69801f60045..db0a82c9e21d73 100644 --- a/.github/workflows/coverage-linux.yml +++ b/.github/workflows/coverage-linux.yml @@ -27,7 +27,7 @@ concurrency: env: PYTHON_VERSION: '3.10' - FLAKY_TESTS: dontcare + FLAKY_TESTS: keep_retrying permissions: contents: read @@ -53,7 +53,7 @@ jobs: # TODO(bcoe): fix the couple tests that fail with the inspector enabled. # The cause is most likely coverage's use of the inspector. - name: Test - run: NODE_V8_COVERAGE=coverage/tmp make test-cov -j2 V=1 TEST_CI_ARGS="-p dots" || exit 0 + run: NODE_V8_COVERAGE=coverage/tmp make test-cov -j2 V=1 TEST_CI_ARGS="-p dots --measure-flakiness 9" || exit 0 - name: Report JS run: npx c8 report --check-coverage env: diff --git a/.github/workflows/coverage-windows.yml b/.github/workflows/coverage-windows.yml index d9c5bfb58d61e6..78465acb17566d 100644 --- a/.github/workflows/coverage-windows.yml +++ b/.github/workflows/coverage-windows.yml @@ -29,7 +29,7 @@ concurrency: env: PYTHON_VERSION: '3.10' - FLAKY_TESTS: dontcare + FLAKY_TESTS: keep_retrying permissions: contents: read diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 72abb16ad5083c..76660343ca2f46 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -40,4 +40,4 @@ jobs: name: docs path: out/doc - name: Test - run: NODE=$(command -v node) make test-doc-ci TEST_CI_ARGS="-p actions" + run: NODE=$(command -v node) make test-doc-ci TEST_CI_ARGS="-p actions --measure-flakiness 9" diff --git a/.github/workflows/test-asan.yml b/.github/workflows/test-asan.yml index ba30449e90ba40..c8e7a09e2e4efd 100644 --- a/.github/workflows/test-asan.yml +++ b/.github/workflows/test-asan.yml @@ -31,7 +31,7 @@ concurrency: env: ASAN_OPTIONS: intercept_tls_get_addr=0 PYTHON_VERSION: '3.10' - FLAKY_TESTS: dontcare + FLAKY_TESTS: keep_retrying permissions: contents: read @@ -58,4 +58,4 @@ jobs: - name: Build run: make build-ci -j2 V=1 - name: Test - run: make run-ci -j2 V=1 TEST_CI_ARGS="-p actions -t 300" + run: make run-ci -j2 V=1 TEST_CI_ARGS="-p actions -t 300 --measure-flakiness 9" diff --git a/.github/workflows/test-internet.yml b/.github/workflows/test-internet.yml index 297ceea987a76a..4fcb18a14f5ce9 100644 --- a/.github/workflows/test-internet.yml +++ b/.github/workflows/test-internet.yml @@ -22,7 +22,7 @@ concurrency: env: PYTHON_VERSION: '3.10' - FLAKY_TESTS: dontcare + FLAKY_TESTS: keep_retrying permissions: contents: read diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 4cc09f22c25105..24196849d1bac8 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -24,7 +24,7 @@ concurrency: env: PYTHON_VERSION: '3.10' - FLAKY_TESTS: dontcare + FLAKY_TESTS: keep_retrying permissions: contents: read @@ -46,4 +46,4 @@ jobs: - name: Build run: make build-ci -j2 V=1 CONFIG_FLAGS="--error-on-warn" - name: Test - run: make run-ci -j2 V=1 TEST_CI_ARGS="-p actions" + run: make run-ci -j2 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9" diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 5f93730d666fc0..7faddc8eaedaec 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -30,7 +30,7 @@ concurrency: env: PYTHON_VERSION: '3.10' - FLAKY_TESTS: dontcare + FLAKY_TESTS: keep_retrying permissions: contents: read @@ -60,4 +60,4 @@ jobs: - name: Build run: make build-ci -j2 V=1 CONFIG_FLAGS="--error-on-warn" - name: Test - run: make run-ci -j2 V=1 TEST_CI_ARGS="-p actions" + run: make run-ci -j2 V=1 TEST_CI_ARGS="-p actions --measure-flakiness 9" diff --git a/.mailmap b/.mailmap index 6248917e68515d..f922b76746784f 100644 --- a/.mailmap +++ b/.mailmap @@ -67,7 +67,8 @@ Benjamin Waters Bert Belder Bert Belder Bert Belder -Beth Griggs +Beth Griggs +Beth Griggs Bidisha Pyne bl-ue <54780737+bl-ue@users.noreply.github.com> Brad Decker @@ -221,9 +222,10 @@ James Beavers James Bromwell <943160+thw0rted@users.noreply.github.com> James Hartig James Ide +James Ide James M Snell James Nimlos -James Sumners +James Sumners Jan Krems Jem Bezooyen Jem Bezooyen @@ -241,7 +243,7 @@ Jesús Leganés-Combarro 'piranna Jimb Esser Jithil P Ponnan Jithil P Ponnan -Jochen Eisinger +Jochen Eisinger Joe Shaw Johan Bergström Johan Dahlberg @@ -542,6 +544,7 @@ Vladimir de Turckheim vsemozhetbyt Vyacheslav Egorov Wang Xinyong +Wayne Zhang Wei-Wei Wu Weijia Wang Weijia Wang <381152119@qq.com> diff --git a/AUTHORS b/AUTHORS index 029eb68e36640f..f792f6357fe1a4 100644 --- a/AUTHORS +++ b/AUTHORS @@ -3481,5 +3481,14 @@ Alena Khineika Basit <1305718+mabaasit@users.noreply.github.com> Kid <44045911+kidonng@users.noreply.github.com> Jeremy Rose +Facundo Tuesca +Dan Castillo +Varun Sharma +txxnano +Jannis R +John Gee +Hrishikesh Kadam +KrayzeeKev +Airing # Generated by tools/update-authors.mjs diff --git a/README.md b/README.md index daa9476e31783f..5b6347020b9696 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ For information about the governance of the Node.js project, see * [apapirovski](https://github.com/apapirovski) - **Anatoli Papirovski** <> (he/him) * [BethGriggs](https://github.com/BethGriggs) - - **Beth Griggs** <> (she/her) + **Beth Griggs** <> (she/her) * [BridgeAR](https://github.com/BridgeAR) - **Ruben Bridgewater** <> (he/him) * [ChALkeR](https://github.com/ChALkeR) - @@ -279,7 +279,7 @@ For information about the governance of the Node.js project, see * [benjamingr](https://github.com/benjamingr) - **Benjamin Gruenbaum** <> * [BethGriggs](https://github.com/BethGriggs) - - **Beth Griggs** <> (she/her) + **Beth Griggs** <> (she/her) * [bmeck](https://github.com/bmeck) - **Bradley Farias** <> * [bnb](https://github.com/bnb) - @@ -314,6 +314,8 @@ For information about the governance of the Node.js project, see **Evan Lucas** <> (he/him) * [fhinkel](https://github.com/fhinkel) - **Franziska Hinkelmann** <> (she/her) +* [F3n67u](https://github.com/F3n67u) - + **Feng Yu** <> (he/him) * [Flarna](https://github.com/Flarna) - **Gerhard Stöbich** <> (he/they) * [gabrielschulhof](https://github.com/gabrielschulhof) - @@ -675,7 +677,7 @@ maintaining the Node.js project. Primary GPG keys for Node.js Releasers (some Releasers sign with subkeys): -* **Beth Griggs** <> +* **Beth Griggs** <> `4ED778F539E3634C779C87C6D7062848A1AB005C` * **Bryan English** <> `141F07595B7B3FFE74309A937405533BE57C7D57` diff --git a/deps/corepack/CHANGELOG.md b/deps/corepack/CHANGELOG.md index 5ff077fedddb57..56b4367692fa70 100644 --- a/deps/corepack/CHANGELOG.md +++ b/deps/corepack/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.12.1](https://github.com/nodejs/corepack/compare/v0.12.0...v0.12.1) (2022-07-21) + + +### Bug Fixes + +* **doc:** update DESIGN.md s/engines.pm/packageManager/ ([#141](https://github.com/nodejs/corepack/issues/141)) ([d6039c5](https://github.com/nodejs/corepack/commit/d6039c5b16cdddb33069b9aa864854ed16d17e4e)) +* update package manager versions ([#146](https://github.com/nodejs/corepack/issues/146)) ([fdb187a](https://github.com/nodejs/corepack/commit/fdb187a640de77df9b3688623ba510bdafda8702)) + ## [0.12.0](https://github.com/nodejs/corepack/compare/v0.11.2...v0.12.0) (2022-07-09) diff --git a/deps/corepack/dist/corepack.js b/deps/corepack/dist/corepack.js index 541cbeefa7203e..c7dbc6fa9f1a9c 100755 --- a/deps/corepack/dist/corepack.js +++ b/deps/corepack/dist/corepack.js @@ -3,9 +3,9 @@ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ "../../../.yarn/berry/cache/@zkochan-cmd-shim-npm-5.2.2-ae7b6d5b86-9.zip/node_modules/@zkochan/cmd-shim/index.js": +/***/ "../../../.yarn/berry/cache/@zkochan-cmd-shim-npm-5.3.0-8f73631a81-9.zip/node_modules/@zkochan/cmd-shim/index.js": /*!***********************************************************************************************************************!*\ - !*** ../../../.yarn/berry/cache/@zkochan-cmd-shim-npm-5.2.2-ae7b6d5b86-9.zip/node_modules/@zkochan/cmd-shim/index.js ***! + !*** ../../../.yarn/berry/cache/@zkochan-cmd-shim-npm-5.3.0-8f73631a81-9.zip/node_modules/@zkochan/cmd-shim/index.js ***! \***********************************************************************************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { @@ -219,6 +219,7 @@ function generateCmdShim(src, to, opts) { let prog = opts.prog; let args = opts.args || ''; const nodePath = normalizePathEnvVar(opts.nodePath).win32; + const prependToPath = normalizePathEnvVar(opts.prependToPath).win32; if (!prog) { prog = quotedPathToTarget; args = ''; @@ -241,6 +242,9 @@ function generateCmdShim(src, to, opts) { // node "%~dp0\.\node_modules\npm\bin\npm-cli.js" %* // ) let cmd = '@SETLOCAL\r\n'; + if (prependToPath) { + cmd += `@SET "PATH=${prependToPath}:%PATH%"\r\n`; + } if (nodePath) { cmd += `\ @IF NOT DEFINED NODE_PATH (\r @@ -319,6 +323,11 @@ case \`uname\` in esac `; + if (opts.prependToPath) { + sh += `\ +export PATH="${opts.prependToPath}:$PATH" +`; + } if (shNodePath) { sh += `\ if [ -z "$NODE_PATH" ]; then @@ -362,9 +371,12 @@ function generatePwshShim(src, to, opts) { shTarget = shTarget.split('\\').join('/'); const quotedPathToTarget = path.isAbsolute(shTarget) ? `"${shTarget}"` : `"$basedir/${shTarget}"`; let args = opts.args || ''; - let normalizedPathEnvVar = normalizePathEnvVar(opts.nodePath); - const nodePath = normalizedPathEnvVar.win32; - const shNodePath = normalizedPathEnvVar.posix; + let normalizedNodePathEnvVar = normalizePathEnvVar(opts.nodePath); + const nodePath = normalizedNodePathEnvVar.win32; + const shNodePath = normalizedNodePathEnvVar.posix; + let normalizedPrependPathEnvVar = normalizePathEnvVar(opts.prependToPath); + const prependPath = normalizedPrependPathEnvVar.win32; + const shPrependPath = normalizedPrependPathEnvVar.posix; if (!pwshProg) { pwshProg = quotedPathToTarget; args = ''; @@ -412,27 +424,41 @@ function generatePwshShim(src, to, opts) { $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent $exe="" +${(nodePath || prependPath) ? '$pathsep=":"\n' : ''}\ ${nodePath ? `\ -$pathsep=":" $env_node_path=$env:NODE_PATH $new_node_path="${nodePath}" ` : ''}\ +${prependPath ? `\ +$env_path=$env:PATH +$prepend_path="${prependPath}" +` : ''}\ if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { # Fix case when both the Windows and Linux builds of Node # are installed in the same directory $exe=".exe" -${nodePath ? ' $pathsep=";"\n' : ''}\ +${(nodePath || prependPath) ? ' $pathsep=";"\n' : ''}\ }`; - if (shNodePath) { + if (shNodePath || shPrependPath) { pwsh += `\ else { - $new_node_path="${shNodePath}" +${shNodePath ? ` $new_node_path="${shNodePath}"\n` : ''}\ +${shPrependPath ? ` $prepend_path="${shPrependPath}"\n` : ''}\ } +`; + } + if (shNodePath) { + pwsh += `\ if ([string]::IsNullOrEmpty($env_node_path)) { $env:NODE_PATH=$new_node_path } else { $env:NODE_PATH="$env_node_path$pathsep$new_node_path" } +`; + } + if (opts.prependToPath) { + pwsh += ` +$env:PATH="$prepend_path$pathsep$env:PATH" `; } if (pwshLongProg) { @@ -456,6 +482,7 @@ if (Test-Path ${pwshLongProg}) { $ret=$LASTEXITCODE } ${nodePath ? '$env:NODE_PATH=$env_node_path\n' : ''}\ +${prependPath ? '$env:PATH=$env_path\n' : ''}\ exit $ret `; } @@ -468,6 +495,7 @@ if ($MyInvocation.ExpectingInput) { & ${pwshProg} ${args} ${shTarget} ${progArgs}$args } ${nodePath ? '$env:NODE_PATH=$env_node_path\n' : ''}\ +${prependPath ? '$env:PATH=$env_path\n' : ''}\ exit $LASTEXITCODE `; } @@ -713,7 +741,7 @@ module.exports = cmdExtension || '.cmd' "use strict"; -const MiniPass = __webpack_require__(/*! minipass */ "../../../.yarn/berry/cache/minipass-npm-3.1.6-f032df1661-9.zip/node_modules/minipass/index.js") +const MiniPass = __webpack_require__(/*! minipass */ "../../../.yarn/berry/cache/minipass-npm-3.3.4-6cf48a6c5e-9.zip/node_modules/minipass/index.js") const EE = (__webpack_require__(/*! events */ "events").EventEmitter) const fs = __webpack_require__(/*! fs */ "fs") @@ -1685,9 +1713,9 @@ module.exports = LRUCache /***/ }), -/***/ "../../../.yarn/berry/cache/minipass-npm-3.1.6-f032df1661-9.zip/node_modules/minipass/index.js": +/***/ "../../../.yarn/berry/cache/minipass-npm-3.3.4-6cf48a6c5e-9.zip/node_modules/minipass/index.js": /*!*****************************************************************************************************!*\ - !*** ../../../.yarn/berry/cache/minipass-npm-3.1.6-f032df1661-9.zip/node_modules/minipass/index.js ***! + !*** ../../../.yarn/berry/cache/minipass-npm-3.3.4-6cf48a6c5e-9.zip/node_modules/minipass/index.js ***! \*****************************************************************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { @@ -1699,7 +1727,6 @@ const proc = typeof process === 'object' && process ? process : { } const EE = __webpack_require__(/*! events */ "events") const Stream = __webpack_require__(/*! stream */ "stream") -const Yallist = __webpack_require__(/*! yallist */ "../../../.yarn/berry/cache/yallist-npm-4.0.0-b493d9e907-9.zip/node_modules/yallist/yallist.js") const SD = (__webpack_require__(/*! string_decoder */ "string_decoder").StringDecoder) const EOF = Symbol('EOF') @@ -1721,6 +1748,12 @@ const BUFFERPUSH = Symbol('bufferPush') const BUFFERSHIFT = Symbol('bufferShift') const OBJECTMODE = Symbol('objectMode') const DESTROYED = Symbol('destroyed') +const EMITDATA = Symbol('emitData') +const EMITEND = Symbol('emitEnd') +const EMITEND2 = Symbol('emitEnd2') +const ASYNC = Symbol('async') + +const defer = fn => Promise.resolve().then(fn) // TODO remove when Node v8 support drops const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1' @@ -1745,14 +1778,46 @@ const isArrayBuffer = b => b instanceof ArrayBuffer || const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b) +class Pipe { + constructor (src, dest, opts) { + this.src = src + this.dest = dest + this.opts = opts + this.ondrain = () => src[RESUME]() + dest.on('drain', this.ondrain) + } + unpipe () { + this.dest.removeListener('drain', this.ondrain) + } + // istanbul ignore next - only here for the prototype + proxyErrors () {} + end () { + this.unpipe() + if (this.opts.end) + this.dest.end() + } +} + +class PipeProxyErrors extends Pipe { + unpipe () { + this.src.removeListener('error', this.proxyErrors) + super.unpipe() + } + constructor (src, dest, opts) { + super(src, dest, opts) + this.proxyErrors = er => dest.emit('error', er) + src.on('error', this.proxyErrors) + } +} + module.exports = class Minipass extends Stream { constructor (options) { super() this[FLOWING] = false // whether we're explicitly paused this[PAUSED] = false - this.pipes = new Yallist() - this.buffer = new Yallist() + this.pipes = [] + this.buffer = [] this[OBJECTMODE] = options && options.objectMode || false if (this[OBJECTMODE]) this[ENCODING] = null @@ -1760,6 +1825,7 @@ module.exports = class Minipass extends Stream { this[ENCODING] = options && options.encoding || null if (this[ENCODING] === 'buffer') this[ENCODING] = null + this[ASYNC] = options && !!options.async || false this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null this[EOF] = false this[EMITTED_END] = false @@ -1799,6 +1865,9 @@ module.exports = class Minipass extends Stream { get objectMode () { return this[OBJECTMODE] } set objectMode (om) { this[OBJECTMODE] = this[OBJECTMODE] || !!om } + get ['async'] () { return this[ASYNC] } + set ['async'] (a) { this[ASYNC] = this[ASYNC] || !!a } + write (chunk, encoding, cb) { if (this[EOF]) throw new Error('write after end') @@ -1817,6 +1886,8 @@ module.exports = class Minipass extends Stream { if (!encoding) encoding = 'utf8' + const fn = this[ASYNC] ? defer : f => f() + // convert array buffers and typed array views into buffers // at some point in the future, we may want to do the opposite! // leave strings and buffers as-is @@ -1831,19 +1902,40 @@ module.exports = class Minipass extends Stream { this.objectMode = true } - // this ensures at this point that the chunk is a buffer or string + // handle object mode up front, since it's simpler + // this yields better performance, fewer checks later. + if (this[OBJECTMODE]) { + /* istanbul ignore if - maybe impossible? */ + if (this.flowing && this[BUFFERLENGTH] !== 0) + this[FLUSH](true) + + if (this.flowing) + this.emit('data', chunk) + else + this[BUFFERPUSH](chunk) + + if (this[BUFFERLENGTH] !== 0) + this.emit('readable') + + if (cb) + fn(cb) + + return this.flowing + } + + // at this point the chunk is a buffer or string // don't buffer it up or send it to the decoder - if (!this.objectMode && !chunk.length) { + if (!chunk.length) { if (this[BUFFERLENGTH] !== 0) this.emit('readable') if (cb) - cb() + fn(cb) return this.flowing } // fast-path writing strings of same encoding to a stream with // an empty buffer, skipping the buffer/decoder dance - if (typeof chunk === 'string' && !this[OBJECTMODE] && + if (typeof chunk === 'string' && // unless it is a string already ready for us to use !(encoding === this[ENCODING] && !this[DECODER].lastNeed)) { chunk = Buffer.from(chunk, encoding) @@ -1852,27 +1944,20 @@ module.exports = class Minipass extends Stream { if (Buffer.isBuffer(chunk) && this[ENCODING]) chunk = this[DECODER].write(chunk) - if (this.flowing) { - // if we somehow have something in the buffer, but we think we're - // flowing, then we need to flush all that out first, or we get - // chunks coming in out of order. Can't emit 'drain' here though, - // because we're mid-write, so that'd be bad. - if (this[BUFFERLENGTH] !== 0) - this[FLUSH](true) + // Note: flushing CAN potentially switch us into not-flowing mode + if (this.flowing && this[BUFFERLENGTH] !== 0) + this[FLUSH](true) - // if we are still flowing after flushing the buffer we can emit the - // chunk otherwise we have to buffer it. - this.flowing - ? this.emit('data', chunk) - : this[BUFFERPUSH](chunk) - } else + if (this.flowing) + this.emit('data', chunk) + else this[BUFFERPUSH](chunk) if (this[BUFFERLENGTH] !== 0) this.emit('readable') if (cb) - cb() + fn(cb) return this.flowing } @@ -1881,35 +1966,31 @@ module.exports = class Minipass extends Stream { if (this[DESTROYED]) return null - try { - if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) - return null - - if (this[OBJECTMODE]) - n = null + if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) { + this[MAYBE_EMIT_END]() + return null + } - if (this.buffer.length > 1 && !this[OBJECTMODE]) { - if (this.encoding) - this.buffer = new Yallist([ - Array.from(this.buffer).join('') - ]) - else - this.buffer = new Yallist([ - Buffer.concat(Array.from(this.buffer), this[BUFFERLENGTH]) - ]) - } + if (this[OBJECTMODE]) + n = null - return this[READ](n || null, this.buffer.head.value) - } finally { - this[MAYBE_EMIT_END]() + if (this.buffer.length > 1 && !this[OBJECTMODE]) { + if (this.encoding) + this.buffer = [this.buffer.join('')] + else + this.buffer = [Buffer.concat(this.buffer, this[BUFFERLENGTH])] } + + const ret = this[READ](n || null, this.buffer[0]) + this[MAYBE_EMIT_END]() + return ret } [READ] (n, chunk) { if (n === chunk.length || n === null) this[BUFFERSHIFT]() else { - this.buffer.head.value = chunk.slice(n) + this.buffer[0] = chunk.slice(n) chunk = chunk.slice(0, n) this[BUFFERLENGTH] -= n } @@ -1985,7 +2066,7 @@ module.exports = class Minipass extends Stream { this[BUFFERLENGTH] += 1 else this[BUFFERLENGTH] += chunk.length - return this.buffer.push(chunk) + this.buffer.push(chunk) } [BUFFERSHIFT] () { @@ -1993,7 +2074,7 @@ module.exports = class Minipass extends Stream { if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1 else - this[BUFFERLENGTH] -= this.buffer.head.value.length + this[BUFFERLENGTH] -= this.buffer[0].length } return this.buffer.shift() } @@ -2019,35 +2100,52 @@ module.exports = class Minipass extends Stream { opts.end = false else opts.end = opts.end !== false + opts.proxyErrors = !!opts.proxyErrors - const p = { dest: dest, opts: opts, ondrain: _ => this[RESUME]() } - this.pipes.push(p) - - dest.on('drain', p.ondrain) - this[RESUME]() // piping an ended stream ends immediately - if (ended && p.opts.end) - p.dest.end() + if (ended) { + if (opts.end) + dest.end() + } else { + this.pipes.push(!opts.proxyErrors ? new Pipe(this, dest, opts) + : new PipeProxyErrors(this, dest, opts)) + if (this[ASYNC]) + defer(() => this[RESUME]()) + else + this[RESUME]() + } + return dest } + unpipe (dest) { + const p = this.pipes.find(p => p.dest === dest) + if (p) { + this.pipes.splice(this.pipes.indexOf(p), 1) + p.unpipe() + } + } + addListener (ev, fn) { return this.on(ev, fn) } on (ev, fn) { - try { - return super.on(ev, fn) - } finally { - if (ev === 'data' && !this.pipes.length && !this.flowing) - this[RESUME]() - else if (isEndish(ev) && this[EMITTED_END]) { - super.emit(ev) - this.removeAllListeners(ev) - } else if (ev === 'error' && this[EMITTED_ERROR]) { + const ret = super.on(ev, fn) + if (ev === 'data' && !this.pipes.length && !this.flowing) + this[RESUME]() + else if (ev === 'readable' && this[BUFFERLENGTH] !== 0) + super.emit('readable') + else if (isEndish(ev) && this[EMITTED_END]) { + super.emit(ev) + this.removeAllListeners(ev) + } else if (ev === 'error' && this[EMITTED_ERROR]) { + if (this[ASYNC]) + defer(() => fn.call(this, this[EMITTED_ERROR])) + else fn.call(this, this[EMITTED_ERROR]) - } } + return ret } get emittedEnd () { @@ -2070,65 +2168,84 @@ module.exports = class Minipass extends Stream { } } - emit (ev, data) { + emit (ev, data, ...extra) { // error and close are only events allowed after calling destroy() if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED]) return else if (ev === 'data') { - if (!data) - return - - if (this.pipes.length) - this.pipes.forEach(p => - p.dest.write(data) === false && this.pause()) + return !data ? false + : this[ASYNC] ? defer(() => this[EMITDATA](data)) + : this[EMITDATA](data) } else if (ev === 'end') { - // only actual end gets this treatment - if (this[EMITTED_END] === true) - return - - this[EMITTED_END] = true - this.readable = false - - if (this[DECODER]) { - data = this[DECODER].end() - if (data) { - this.pipes.forEach(p => p.dest.write(data)) - super.emit('data', data) - } - } - - this.pipes.forEach(p => { - p.dest.removeListener('drain', p.ondrain) - if (p.opts.end) - p.dest.end() - }) + return this[EMITEND]() } else if (ev === 'close') { this[CLOSED] = true // don't emit close before 'end' and 'finish' if (!this[EMITTED_END] && !this[DESTROYED]) return + const ret = super.emit('close') + this.removeAllListeners('close') + return ret } else if (ev === 'error') { this[EMITTED_ERROR] = data + const ret = super.emit('error', data) + this[MAYBE_EMIT_END]() + return ret + } else if (ev === 'resume') { + const ret = super.emit('resume') + this[MAYBE_EMIT_END]() + return ret + } else if (ev === 'finish' || ev === 'prefinish') { + const ret = super.emit(ev) + this.removeAllListeners(ev) + return ret } - // TODO: replace with a spread operator when Node v4 support drops - const args = new Array(arguments.length) - args[0] = ev - args[1] = data - if (arguments.length > 2) { - for (let i = 2; i < arguments.length; i++) { - args[i] = arguments[i] + // Some other unknown event + const ret = super.emit(ev, data, ...extra) + this[MAYBE_EMIT_END]() + return ret + } + + [EMITDATA] (data) { + for (const p of this.pipes) { + if (p.dest.write(data) === false) + this.pause() + } + const ret = super.emit('data', data) + this[MAYBE_EMIT_END]() + return ret + } + + [EMITEND] () { + if (this[EMITTED_END]) + return + + this[EMITTED_END] = true + this.readable = false + if (this[ASYNC]) + defer(() => this[EMITEND2]()) + else + this[EMITEND2]() + } + + [EMITEND2] () { + if (this[DECODER]) { + const data = this[DECODER].end() + if (data) { + for (const p of this.pipes) { + p.dest.write(data) + } + super.emit('data', data) } } - try { - return super.emit.apply(this, args) - } finally { - if (!isEndish(ev)) - this[MAYBE_EMIT_END]() - else - this.removeAllListeners(ev) + for (const p of this.pipes) { + p.end() } + const ret = super.emit('end') + this.removeAllListeners('end') + return ret } // const all = await stream.collect() @@ -2230,7 +2347,7 @@ module.exports = class Minipass extends Stream { this[DESTROYED] = true // throw away all buffered data, it's never coming out - this.buffer = new Yallist() + this.buffer.length = 0 this[BUFFERLENGTH] = 0 if (typeof this.close === 'function' && !this[CLOSED]) @@ -2395,7 +2512,7 @@ const Buffer = (__webpack_require__(/*! buffer */ "buffer").Buffer) const realZlib = __webpack_require__(/*! zlib */ "zlib") const constants = exports.constants = __webpack_require__(/*! ./constants.js */ "../../../.yarn/berry/cache/minizlib-npm-2.1.2-ea89cd0cfb-9.zip/node_modules/minizlib/constants.js") -const Minipass = __webpack_require__(/*! minipass */ "../../../.yarn/berry/cache/minipass-npm-3.1.6-f032df1661-9.zip/node_modules/minipass/index.js") +const Minipass = __webpack_require__(/*! minipass */ "../../../.yarn/berry/cache/minipass-npm-3.3.4-6cf48a6c5e-9.zip/node_modules/minipass/index.js") const OriginalBufferConcat = Buffer.concat @@ -6863,7 +6980,7 @@ class PackJob { } } -const MiniPass = __webpack_require__(/*! minipass */ "../../../.yarn/berry/cache/minipass-npm-3.1.6-f032df1661-9.zip/node_modules/minipass/index.js") +const MiniPass = __webpack_require__(/*! minipass */ "../../../.yarn/berry/cache/minipass-npm-3.3.4-6cf48a6c5e-9.zip/node_modules/minipass/index.js") const zlib = __webpack_require__(/*! minizlib */ "../../../.yarn/berry/cache/minizlib-npm-2.1.2-ea89cd0cfb-9.zip/node_modules/minizlib/index.js") const ReadEntry = __webpack_require__(/*! ./read-entry.js */ "../../../.yarn/berry/cache/tar-npm-6.1.11-e6ac3cba9c-9.zip/node_modules/tar/lib/read-entry.js") const WriteEntry = __webpack_require__(/*! ./write-entry.js */ "../../../.yarn/berry/cache/tar-npm-6.1.11-e6ac3cba9c-9.zip/node_modules/tar/lib/write-entry.js") @@ -8052,7 +8169,7 @@ module.exports = Pax "use strict"; -const MiniPass = __webpack_require__(/*! minipass */ "../../../.yarn/berry/cache/minipass-npm-3.1.6-f032df1661-9.zip/node_modules/minipass/index.js") +const MiniPass = __webpack_require__(/*! minipass */ "../../../.yarn/berry/cache/minipass-npm-3.3.4-6cf48a6c5e-9.zip/node_modules/minipass/index.js") const normPath = __webpack_require__(/*! ./normalize-windows-path.js */ "../../../.yarn/berry/cache/tar-npm-6.1.11-e6ac3cba9c-9.zip/node_modules/tar/lib/normalize-windows-path.js") const SLURP = Symbol('slurp') @@ -9510,7 +9627,7 @@ module.exports = { "use strict"; -const MiniPass = __webpack_require__(/*! minipass */ "../../../.yarn/berry/cache/minipass-npm-3.1.6-f032df1661-9.zip/node_modules/minipass/index.js") +const MiniPass = __webpack_require__(/*! minipass */ "../../../.yarn/berry/cache/minipass-npm-3.3.4-6cf48a6c5e-9.zip/node_modules/minipass/index.js") const Pax = __webpack_require__(/*! ./pax.js */ "../../../.yarn/berry/cache/tar-npm-6.1.11-e6ac3cba9c-9.zip/node_modules/tar/lib/pax.js") const Header = __webpack_require__(/*! ./header.js */ "../../../.yarn/berry/cache/tar-npm-6.1.11-e6ac3cba9c-9.zip/node_modules/tar/lib/header.js") const fs = __webpack_require__(/*! fs */ "fs") @@ -15234,7 +15351,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "EnableCommand": () => (/* binding */ EnableCommand) /* harmony export */ }); -/* harmony import */ var _zkochan_cmd_shim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @zkochan/cmd-shim */ "../../../.yarn/berry/cache/@zkochan-cmd-shim-npm-5.2.2-ae7b6d5b86-9.zip/node_modules/@zkochan/cmd-shim/index.js"); +/* harmony import */ var _zkochan_cmd_shim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @zkochan/cmd-shim */ "../../../.yarn/berry/cache/@zkochan-cmd-shim-npm-5.3.0-8f73631a81-9.zip/node_modules/@zkochan/cmd-shim/index.js"); /* harmony import */ var _zkochan_cmd_shim__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_zkochan_cmd_shim__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var clipanion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! clipanion */ "./.yarn/__virtual__/clipanion-virtual-72ec1bc418/4/.yarn/berry/cache/clipanion-npm-3.1.0-ced87dbbea-9.zip/node_modules/clipanion/lib/advanced/index.js"); /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! fs */ "fs"); @@ -16836,7 +16953,7 @@ const supportsColor = { /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"definitions":{"npm":{"default":"8.13.2+sha1.d79c851c1d9cc6c11efe708379fd5339580f8fec","transparent":{"commands":[["npm","init"],["npx"]]},"ranges":{"*":{"url":"https://registry.npmjs.org/npm/-/npm-{}.tgz","bin":{"npm":"./bin/npm-cli.js","npx":"./bin/npx-cli.js"},"registry":{"type":"npm","package":"npm"}}}},"pnpm":{"default":"7.5.0+sha1.d9fda828c036a7284bb8aa04c545691029dc75ae","transparent":{"commands":[["pnpm","init"],["pnpx"],["pnpm","dlx"]]},"ranges":{"<6.0.0":{"url":"https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz","bin":{"pnpm":"./bin/pnpm.js","pnpx":"./bin/pnpx.js"},"registry":{"type":"npm","package":"pnpm"}},">=6.0.0":{"url":"https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz","bin":{"pnpm":"./bin/pnpm.cjs","pnpx":"./bin/pnpx.cjs"},"registry":{"type":"npm","package":"pnpm"}}}},"yarn":{"default":"1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447","transparent":{"default":"3.2.1+sha1.712f0d3e236f0705a55d2b7c9be47a717d68dbef","commands":[["yarn","dlx"]]},"ranges":{"<2.0.0":{"url":"https://registry.yarnpkg.com/yarn/-/yarn-{}.tgz","bin":{"yarn":"./bin/yarn.js","yarnpkg":"./bin/yarn.js"},"registry":{"type":"npm","package":"yarn"}},">=2.0.0":{"name":"yarn","url":"https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js","bin":["yarn","yarnpkg"],"registry":{"type":"url","url":"https://repo.yarnpkg.com/tags","fields":{"tags":"latest","versions":"tags"}}}}}}}'); +module.exports = JSON.parse('{"definitions":{"npm":{"default":"8.15.0+sha1.d4b53cd29b13ea164f0f5767bca274dbe7d8f78d","transparent":{"commands":[["npm","init"],["npx"]]},"ranges":{"*":{"url":"https://registry.npmjs.org/npm/-/npm-{}.tgz","bin":{"npm":"./bin/npm-cli.js","npx":"./bin/npx-cli.js"},"registry":{"type":"npm","package":"npm"}}}},"pnpm":{"default":"7.5.2+sha1.89331cc7dc542e0d7a33fe4f423989f0c54e9604","transparent":{"commands":[["pnpm","init"],["pnpx"],["pnpm","dlx"]]},"ranges":{"<6.0.0":{"url":"https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz","bin":{"pnpm":"./bin/pnpm.js","pnpx":"./bin/pnpx.js"},"registry":{"type":"npm","package":"pnpm"}},">=6.0.0":{"url":"https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz","bin":{"pnpm":"./bin/pnpm.cjs","pnpx":"./bin/pnpx.cjs"},"registry":{"type":"npm","package":"pnpm"}}}},"yarn":{"default":"1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447","transparent":{"default":"3.2.2+sha224.634d0331703700cabfa9d9389835bd8f7426b0207ed6b74d8d34c81e","commands":[["yarn","dlx"]]},"ranges":{"<2.0.0":{"url":"https://registry.yarnpkg.com/yarn/-/yarn-{}.tgz","bin":{"yarn":"./bin/yarn.js","yarnpkg":"./bin/yarn.js"},"registry":{"type":"npm","package":"yarn"}},">=2.0.0":{"name":"yarn","url":"https://repo.yarnpkg.com/{}/packages/yarnpkg-cli/bin/yarn.js","bin":["yarn","yarnpkg"],"registry":{"type":"url","url":"https://repo.yarnpkg.com/tags","fields":{"tags":"latest","versions":"tags"}}}}}}}'); /***/ }), @@ -16847,7 +16964,7 @@ module.exports = JSON.parse('{"definitions":{"npm":{"default":"8.13.2+sha1.d79c8 /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"corepack","version":"0.12.0","homepage":"https://github.com/nodejs/corepack#readme","bugs":{"url":"https://github.com/nodejs/corepack/issues"},"repository":{"type":"git","url":"https://github.com/nodejs/corepack.git"},"license":"MIT","packageManager":"yarn@4.0.0-rc.6","devDependencies":{"@babel/core":"^7.14.3","@babel/plugin-transform-modules-commonjs":"^7.14.0","@babel/preset-typescript":"^7.13.0","@types/debug":"^4.1.5","@types/jest":"^27.0.0","@types/node":"^17.0.10","@types/semver":"^7.1.0","@types/tar":"^6.0.0","@types/which":"^2.0.0","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","@yarnpkg/eslint-config":"^1.0.0-rc.5","@yarnpkg/fslib":"^2.1.0","@zkochan/cmd-shim":"^5.0.0","babel-plugin-dynamic-import-node":"^2.3.3","clipanion":"^3.0.1","debug":"^4.1.1","eslint":"^8.0.0","eslint-plugin-arca":"^0.15.0","jest":"^28.0.0","nock":"^13.0.4","proxy-agent":"^5.0.0","semver":"^7.1.3","supports-color":"^9.0.0","tar":"^6.0.1","terser-webpack-plugin":"^5.1.2","ts-loader":"^9.0.0","ts-node":"^10.0.0","typescript":"^4.3.2","v8-compile-cache":"^2.3.0","webpack":"^5.38.1","webpack-cli":"^4.0.0","which":"^2.0.2"},"scripts":{"build":"rm -rf dist shims && webpack && ts-node ./mkshims.ts","corepack":"ts-node ./sources/_entryPoint.ts","lint":"yarn eslint","prepack":"yarn build","postpack":"rm -rf dist shims","typecheck":"tsc --noEmit","test":"yarn jest"},"files":["dist","shims","LICENSE.md"],"publishConfig":{"bin":{"corepack":"./dist/corepack.js","pnpm":"./dist/pnpm.js","pnpx":"./dist/pnpx.js","yarn":"./dist/yarn.js","yarnpkg":"./dist/yarnpkg.js"},"executableFiles":["./dist/npm.js","./dist/npx.js","./dist/pnpm.js","./dist/pnpx.js","./dist/yarn.js","./dist/yarnpkg.js","./dist/corepack.js","./shims/npm","./shims/npm.ps1","./shims/npx","./shims/npx.ps1","./shims/pnpm","./shims/pnpm.ps1","./shims/pnpx","./shims/pnpx.ps1","./shims/yarn","./shims/yarn.ps1","./shims/yarnpkg","./shims/yarnpkg.ps1"]},"resolutions":{"vm2":"patch:vm2@npm:3.9.9#.yarn/patches/vm2-npm-3.9.9-03fd1f4dc5.patch"}}'); +module.exports = JSON.parse('{"name":"corepack","version":"0.12.1","homepage":"https://github.com/nodejs/corepack#readme","bugs":{"url":"https://github.com/nodejs/corepack/issues"},"repository":{"type":"git","url":"https://github.com/nodejs/corepack.git"},"license":"MIT","packageManager":"yarn@4.0.0-rc.14+sha224.d3bee29dce07417588d640327d44f1e0b8182c240bc2beb0b81ccf6e","devDependencies":{"@babel/core":"^7.14.3","@babel/plugin-transform-modules-commonjs":"^7.14.0","@babel/preset-typescript":"^7.13.0","@types/debug":"^4.1.5","@types/jest":"^28.0.0","@types/node":"^18.0.0","@types/semver":"^7.1.0","@types/tar":"^6.0.0","@types/which":"^2.0.0","@typescript-eslint/eslint-plugin":"^5.0.0","@typescript-eslint/parser":"^5.0.0","@yarnpkg/eslint-config":"^1.0.0-rc.5","@yarnpkg/fslib":"^2.1.0","@zkochan/cmd-shim":"^5.0.0","babel-plugin-dynamic-import-node":"^2.3.3","clipanion":"^3.0.1","debug":"^4.1.1","eslint":"^8.0.0","eslint-plugin-arca":"^0.15.0","jest":"^28.0.0","nock":"^13.0.4","proxy-agent":"^5.0.0","semver":"^7.1.3","supports-color":"^9.0.0","tar":"^6.0.1","terser-webpack-plugin":"^5.1.2","ts-loader":"^9.0.0","ts-node":"^10.0.0","typescript":"^4.3.2","v8-compile-cache":"^2.3.0","webpack":"^5.38.1","webpack-cli":"^4.0.0","which":"^2.0.2"},"scripts":{"build":"rm -rf dist shims && webpack && ts-node ./mkshims.ts","corepack":"ts-node ./sources/_entryPoint.ts","lint":"yarn eslint","prepack":"yarn build","postpack":"rm -rf dist shims","typecheck":"tsc --noEmit","test":"yarn jest"},"files":["dist","shims","LICENSE.md"],"publishConfig":{"bin":{"corepack":"./dist/corepack.js","pnpm":"./dist/pnpm.js","pnpx":"./dist/pnpx.js","yarn":"./dist/yarn.js","yarnpkg":"./dist/yarnpkg.js"},"executableFiles":["./dist/npm.js","./dist/npx.js","./dist/pnpm.js","./dist/pnpx.js","./dist/yarn.js","./dist/yarnpkg.js","./dist/corepack.js","./shims/npm","./shims/npm.ps1","./shims/npx","./shims/npx.ps1","./shims/pnpm","./shims/pnpm.ps1","./shims/pnpx","./shims/pnpx.ps1","./shims/yarn","./shims/yarn.ps1","./shims/yarnpkg","./shims/yarnpkg.ps1"]},"resolutions":{"vm2":"patch:vm2@npm:3.9.9#.yarn/patches/vm2-npm-3.9.9-03fd1f4dc5.patch"}}'); /***/ }) diff --git a/deps/corepack/dist/vendors-_yarn_berry_cache_proxy-agent-npm-5_0_0-41772f4b01-9_zip_node_modules_proxy-agent_index_js.js b/deps/corepack/dist/vendors-_yarn_berry_cache_proxy-agent-npm-5_0_0-41772f4b01-9_zip_node_modules_proxy-agent_index_js.js index 4406f4966a4d0c..afb6a9b2b75a51 100644 --- a/deps/corepack/dist/vendors-_yarn_berry_cache_proxy-agent-npm-5_0_0-41772f4b01-9_zip_node_modules_proxy-agent_index_js.js +++ b/deps/corepack/dist/vendors-_yarn_berry_cache_proxy-agent-npm-5_0_0-41772f4b01-9_zip_node_modules_proxy-agent_index_js.js @@ -63,7 +63,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; const events_1 = __webpack_require__(/*! events */ "events"); -const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); +const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); const promisify_1 = __importDefault(__webpack_require__(/*! ./promisify */ "../../../.yarn/berry/cache/agent-base-npm-6.0.2-428f325a93-9.zip/node_modules/agent-base/dist/src/promisify.js")); const debug = debug_1.default('agent-base'); function isAgent(v) { @@ -20107,7 +20107,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); +const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); const stream_1 = __webpack_require__(/*! stream */ "stream"); const crypto_1 = __webpack_require__(/*! crypto */ "crypto"); const data_uri_to_buffer_1 = __importDefault(__webpack_require__(/*! data-uri-to-buffer */ "../../../.yarn/berry/cache/data-uri-to-buffer-npm-3.0.1-830646f9ee-9.zip/node_modules/data-uri-to-buffer/dist/src/index.js")); @@ -20170,7 +20170,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); +const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); const fs_1 = __webpack_require__(/*! fs */ "fs"); const fs_extra_1 = __webpack_require__(/*! fs-extra */ "../../../.yarn/berry/cache/fs-extra-npm-8.1.0-197473387f-9.zip/node_modules/fs-extra/lib/index.js"); const file_uri_to_path_1 = __importDefault(__webpack_require__(/*! file-uri-to-path */ "../../../.yarn/berry/cache/file-uri-to-path-npm-2.0.0-667f38da3a-9.zip/node_modules/file-uri-to-path/dist/src/index.js")); @@ -20246,7 +20246,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); const once_1 = __importDefault(__webpack_require__(/*! @tootallnate/once */ "../../../.yarn/berry/cache/@tootallnate-once-npm-1.1.2-0517220057-9.zip/node_modules/@tootallnate/once/dist/index.js")); const ftp_1 = __importDefault(__webpack_require__(/*! ftp */ "../../../.yarn/berry/cache/ftp-npm-0.3.10-348fb9ac23-9.zip/node_modules/ftp/lib/connection.js")); const path_1 = __webpack_require__(/*! path */ "path"); -const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); +const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); const notfound_1 = __importDefault(__webpack_require__(/*! ./notfound */ "../../../.yarn/berry/cache/get-uri-npm-3.0.2-53176650ff-9.zip/node_modules/get-uri/dist/notfound.js")); const notmodified_1 = __importDefault(__webpack_require__(/*! ./notmodified */ "../../../.yarn/berry/cache/get-uri-npm-3.0.2-53176650ff-9.zip/node_modules/get-uri/dist/notmodified.js")); const debug = debug_1.default('get-uri:ftp'); @@ -20402,7 +20402,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); const http_1 = __importDefault(__webpack_require__(/*! http */ "http")); const https_1 = __importDefault(__webpack_require__(/*! https */ "https")); const once_1 = __importDefault(__webpack_require__(/*! @tootallnate/once */ "../../../.yarn/berry/cache/@tootallnate-once-npm-1.1.2-0517220057-9.zip/node_modules/@tootallnate/once/dist/index.js")); -const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); +const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); const url_1 = __webpack_require__(/*! url */ "url"); const http_error_1 = __importDefault(__webpack_require__(/*! ./http-error */ "../../../.yarn/berry/cache/get-uri-npm-3.0.2-53176650ff-9.zip/node_modules/get-uri/dist/http-error.js")); const notfound_1 = __importDefault(__webpack_require__(/*! ./notfound */ "../../../.yarn/berry/cache/get-uri-npm-3.0.2-53176650ff-9.zip/node_modules/get-uri/dist/notfound.js")); @@ -20626,7 +20626,7 @@ exports["default"] = get; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; -const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); +const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); const url_1 = __webpack_require__(/*! url */ "url"); // Built-in protocols const data_1 = __importDefault(__webpack_require__(/*! ./data */ "../../../.yarn/berry/cache/get-uri-npm-3.0.2-53176650ff-9.zip/node_modules/get-uri/dist/data.js")); @@ -22044,7 +22044,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); const net_1 = __importDefault(__webpack_require__(/*! net */ "net")); const tls_1 = __importDefault(__webpack_require__(/*! tls */ "tls")); const url_1 = __importDefault(__webpack_require__(/*! url */ "url")); -const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); +const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); const once_1 = __importDefault(__webpack_require__(/*! @tootallnate/once */ "../../../.yarn/berry/cache/@tootallnate-once-npm-1.1.2-0517220057-9.zip/node_modules/@tootallnate/once/dist/index.js")); const agent_base_1 = __webpack_require__(/*! agent-base */ "../../../.yarn/berry/cache/agent-base-npm-6.0.2-428f325a93-9.zip/node_modules/agent-base/dist/src/index.js"); const debug = debug_1.default('http-proxy-agent'); @@ -22224,7 +22224,7 @@ const net_1 = __importDefault(__webpack_require__(/*! net */ "net")); const tls_1 = __importDefault(__webpack_require__(/*! tls */ "tls")); const url_1 = __importDefault(__webpack_require__(/*! url */ "url")); const assert_1 = __importDefault(__webpack_require__(/*! assert */ "assert")); -const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); +const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); const agent_base_1 = __webpack_require__(/*! agent-base */ "../../../.yarn/berry/cache/agent-base-npm-6.0.2-428f325a93-9.zip/node_modules/agent-base/dist/src/index.js"); const parse_proxy_response_1 = __importDefault(__webpack_require__(/*! ./parse-proxy-response */ "../../../.yarn/berry/cache/https-proxy-agent-npm-5.0.1-42d65f358e-9.zip/node_modules/https-proxy-agent/dist/parse-proxy-response.js")); const debug = debug_1.default('https-proxy-agent:agent'); @@ -22422,7 +22422,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); +const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); const debug = debug_1.default('https-proxy-agent:parse-proxy-response'); function parseProxyResponse(socket) { return new Promise((resolve, reject) => { @@ -25765,6 +25765,438 @@ ip.fromLong = function (ipl) { }; +/***/ }), + +/***/ "../../../.yarn/berry/cache/ip-npm-2.0.0-204facb3cc-9.zip/node_modules/ip/lib/ip.js": +/*!******************************************************************************************!*\ + !*** ../../../.yarn/berry/cache/ip-npm-2.0.0-204facb3cc-9.zip/node_modules/ip/lib/ip.js ***! + \******************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +const ip = exports; +const { Buffer } = __webpack_require__(/*! buffer */ "buffer"); +const os = __webpack_require__(/*! os */ "os"); + +ip.toBuffer = function (ip, buff, offset) { + offset = ~~offset; + + let result; + + if (this.isV4Format(ip)) { + result = buff || Buffer.alloc(offset + 4); + ip.split(/\./g).map((byte) => { + result[offset++] = parseInt(byte, 10) & 0xff; + }); + } else if (this.isV6Format(ip)) { + const sections = ip.split(':', 8); + + let i; + for (i = 0; i < sections.length; i++) { + const isv4 = this.isV4Format(sections[i]); + let v4Buffer; + + if (isv4) { + v4Buffer = this.toBuffer(sections[i]); + sections[i] = v4Buffer.slice(0, 2).toString('hex'); + } + + if (v4Buffer && ++i < 8) { + sections.splice(i, 0, v4Buffer.slice(2, 4).toString('hex')); + } + } + + if (sections[0] === '') { + while (sections.length < 8) sections.unshift('0'); + } else if (sections[sections.length - 1] === '') { + while (sections.length < 8) sections.push('0'); + } else if (sections.length < 8) { + for (i = 0; i < sections.length && sections[i] !== ''; i++); + const argv = [i, 1]; + for (i = 9 - sections.length; i > 0; i--) { + argv.push('0'); + } + sections.splice(...argv); + } + + result = buff || Buffer.alloc(offset + 16); + for (i = 0; i < sections.length; i++) { + const word = parseInt(sections[i], 16); + result[offset++] = (word >> 8) & 0xff; + result[offset++] = word & 0xff; + } + } + + if (!result) { + throw Error(`Invalid ip address: ${ip}`); + } + + return result; +}; + +ip.toString = function (buff, offset, length) { + offset = ~~offset; + length = length || (buff.length - offset); + + let result = []; + if (length === 4) { + // IPv4 + for (let i = 0; i < length; i++) { + result.push(buff[offset + i]); + } + result = result.join('.'); + } else if (length === 16) { + // IPv6 + for (let i = 0; i < length; i += 2) { + result.push(buff.readUInt16BE(offset + i).toString(16)); + } + result = result.join(':'); + result = result.replace(/(^|:)0(:0)*:0(:|$)/, '$1::$3'); + result = result.replace(/:{3,4}/, '::'); + } + + return result; +}; + +const ipv4Regex = /^(\d{1,3}\.){3,3}\d{1,3}$/; +const ipv6Regex = /^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i; + +ip.isV4Format = function (ip) { + return ipv4Regex.test(ip); +}; + +ip.isV6Format = function (ip) { + return ipv6Regex.test(ip); +}; + +function _normalizeFamily(family) { + if (family === 4) { + return 'ipv4'; + } + if (family === 6) { + return 'ipv6'; + } + return family ? family.toLowerCase() : 'ipv4'; +} + +ip.fromPrefixLen = function (prefixlen, family) { + if (prefixlen > 32) { + family = 'ipv6'; + } else { + family = _normalizeFamily(family); + } + + let len = 4; + if (family === 'ipv6') { + len = 16; + } + const buff = Buffer.alloc(len); + + for (let i = 0, n = buff.length; i < n; ++i) { + let bits = 8; + if (prefixlen < 8) { + bits = prefixlen; + } + prefixlen -= bits; + + buff[i] = ~(0xff >> bits) & 0xff; + } + + return ip.toString(buff); +}; + +ip.mask = function (addr, mask) { + addr = ip.toBuffer(addr); + mask = ip.toBuffer(mask); + + const result = Buffer.alloc(Math.max(addr.length, mask.length)); + + // Same protocol - do bitwise and + let i; + if (addr.length === mask.length) { + for (i = 0; i < addr.length; i++) { + result[i] = addr[i] & mask[i]; + } + } else if (mask.length === 4) { + // IPv6 address and IPv4 mask + // (Mask low bits) + for (i = 0; i < mask.length; i++) { + result[i] = addr[addr.length - 4 + i] & mask[i]; + } + } else { + // IPv6 mask and IPv4 addr + for (i = 0; i < result.length - 6; i++) { + result[i] = 0; + } + + // ::ffff:ipv4 + result[10] = 0xff; + result[11] = 0xff; + for (i = 0; i < addr.length; i++) { + result[i + 12] = addr[i] & mask[i + 12]; + } + i += 12; + } + for (; i < result.length; i++) { + result[i] = 0; + } + + return ip.toString(result); +}; + +ip.cidr = function (cidrString) { + const cidrParts = cidrString.split('/'); + + const addr = cidrParts[0]; + if (cidrParts.length !== 2) { + throw new Error(`invalid CIDR subnet: ${addr}`); + } + + const mask = ip.fromPrefixLen(parseInt(cidrParts[1], 10)); + + return ip.mask(addr, mask); +}; + +ip.subnet = function (addr, mask) { + const networkAddress = ip.toLong(ip.mask(addr, mask)); + + // Calculate the mask's length. + const maskBuffer = ip.toBuffer(mask); + let maskLength = 0; + + for (let i = 0; i < maskBuffer.length; i++) { + if (maskBuffer[i] === 0xff) { + maskLength += 8; + } else { + let octet = maskBuffer[i] & 0xff; + while (octet) { + octet = (octet << 1) & 0xff; + maskLength++; + } + } + } + + const numberOfAddresses = 2 ** (32 - maskLength); + + return { + networkAddress: ip.fromLong(networkAddress), + firstAddress: numberOfAddresses <= 2 + ? ip.fromLong(networkAddress) + : ip.fromLong(networkAddress + 1), + lastAddress: numberOfAddresses <= 2 + ? ip.fromLong(networkAddress + numberOfAddresses - 1) + : ip.fromLong(networkAddress + numberOfAddresses - 2), + broadcastAddress: ip.fromLong(networkAddress + numberOfAddresses - 1), + subnetMask: mask, + subnetMaskLength: maskLength, + numHosts: numberOfAddresses <= 2 + ? numberOfAddresses : numberOfAddresses - 2, + length: numberOfAddresses, + contains(other) { + return networkAddress === ip.toLong(ip.mask(other, mask)); + }, + }; +}; + +ip.cidrSubnet = function (cidrString) { + const cidrParts = cidrString.split('/'); + + const addr = cidrParts[0]; + if (cidrParts.length !== 2) { + throw new Error(`invalid CIDR subnet: ${addr}`); + } + + const mask = ip.fromPrefixLen(parseInt(cidrParts[1], 10)); + + return ip.subnet(addr, mask); +}; + +ip.not = function (addr) { + const buff = ip.toBuffer(addr); + for (let i = 0; i < buff.length; i++) { + buff[i] = 0xff ^ buff[i]; + } + return ip.toString(buff); +}; + +ip.or = function (a, b) { + a = ip.toBuffer(a); + b = ip.toBuffer(b); + + // same protocol + if (a.length === b.length) { + for (let i = 0; i < a.length; ++i) { + a[i] |= b[i]; + } + return ip.toString(a); + + // mixed protocols + } + let buff = a; + let other = b; + if (b.length > a.length) { + buff = b; + other = a; + } + + const offset = buff.length - other.length; + for (let i = offset; i < buff.length; ++i) { + buff[i] |= other[i - offset]; + } + + return ip.toString(buff); +}; + +ip.isEqual = function (a, b) { + a = ip.toBuffer(a); + b = ip.toBuffer(b); + + // Same protocol + if (a.length === b.length) { + for (let i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; + } + return true; + } + + // Swap + if (b.length === 4) { + const t = b; + b = a; + a = t; + } + + // a - IPv4, b - IPv6 + for (let i = 0; i < 10; i++) { + if (b[i] !== 0) return false; + } + + const word = b.readUInt16BE(10); + if (word !== 0 && word !== 0xffff) return false; + + for (let i = 0; i < 4; i++) { + if (a[i] !== b[i + 12]) return false; + } + + return true; +}; + +ip.isPrivate = function (addr) { + return /^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i + .test(addr) + || /^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) + || /^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i + .test(addr) + || /^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) + || /^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(addr) + || /^f[cd][0-9a-f]{2}:/i.test(addr) + || /^fe80:/i.test(addr) + || /^::1$/.test(addr) + || /^::$/.test(addr); +}; + +ip.isPublic = function (addr) { + return !ip.isPrivate(addr); +}; + +ip.isLoopback = function (addr) { + return /^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/ + .test(addr) + || /^fe80::1$/.test(addr) + || /^::1$/.test(addr) + || /^::$/.test(addr); +}; + +ip.loopback = function (family) { + // + // Default to `ipv4` + // + family = _normalizeFamily(family); + + if (family !== 'ipv4' && family !== 'ipv6') { + throw new Error('family must be ipv4 or ipv6'); + } + + return family === 'ipv4' ? '127.0.0.1' : 'fe80::1'; +}; + +// +// ### function address (name, family) +// #### @name {string|'public'|'private'} **Optional** Name or security +// of the network interface. +// #### @family {ipv4|ipv6} **Optional** IP family of the address (defaults +// to ipv4). +// +// Returns the address for the network interface on the current system with +// the specified `name`: +// * String: First `family` address of the interface. +// If not found see `undefined`. +// * 'public': the first public ip address of family. +// * 'private': the first private ip address of family. +// * undefined: First address with `ipv4` or loopback address `127.0.0.1`. +// +ip.address = function (name, family) { + const interfaces = os.networkInterfaces(); + + // + // Default to `ipv4` + // + family = _normalizeFamily(family); + + // + // If a specific network interface has been named, + // return the address. + // + if (name && name !== 'private' && name !== 'public') { + const res = interfaces[name].filter((details) => { + const itemFamily = _normalizeFamily(details.family); + return itemFamily === family; + }); + if (res.length === 0) { + return undefined; + } + return res[0].address; + } + + const all = Object.keys(interfaces).map((nic) => { + // + // Note: name will only be `public` or `private` + // when this is called. + // + const addresses = interfaces[nic].filter((details) => { + details.family = _normalizeFamily(details.family); + if (details.family !== family || ip.isLoopback(details.address)) { + return false; + } if (!name) { + return true; + } + + return name === 'public' ? ip.isPrivate(details.address) + : ip.isPublic(details.address); + }); + + return addresses.length ? addresses[0].address : undefined; + }).filter(Boolean); + + return !all.length ? ip.loopback(family) : all[0]; +}; + +ip.toLong = function (ip) { + let ipl = 0; + ip.split('.').forEach((octet) => { + ipl <<= 8; + ipl += parseInt(octet); + }); + return (ipl >>> 0); +}; + +ip.fromLong = function (ipl) { + return (`${ipl >>> 24}.${ + ipl >> 16 & 255}.${ + ipl >> 8 & 255}.${ + ipl & 255}`); +}; + + /***/ }), /***/ "../../../.yarn/berry/cache/isarray-npm-0.0.1-92e37e0a70-9.zip/node_modules/isarray/index.js": @@ -26513,7 +26945,7 @@ const tls_1 = __importDefault(__webpack_require__(/*! tls */ "tls")); const once_1 = __importDefault(__webpack_require__(/*! @tootallnate/once */ "../../../.yarn/berry/cache/@tootallnate-once-npm-1.1.2-0517220057-9.zip/node_modules/@tootallnate/once/dist/index.js")); const crypto_1 = __importDefault(__webpack_require__(/*! crypto */ "crypto")); const get_uri_1 = __importDefault(__webpack_require__(/*! get-uri */ "../../../.yarn/berry/cache/get-uri-npm-3.0.2-53176650ff-9.zip/node_modules/get-uri/dist/index.js")); -const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); +const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); const raw_body_1 = __importDefault(__webpack_require__(/*! raw-body */ "../../../.yarn/berry/cache/raw-body-npm-2.5.1-9dd1d9fff9-9.zip/node_modules/raw-body/index.js")); const url_1 = __webpack_require__(/*! url */ "url"); const http_proxy_agent_1 = __webpack_require__(/*! http-proxy-agent */ "../../../.yarn/berry/cache/http-proxy-agent-npm-4.0.1-ce9ef61788-9.zip/node_modules/http-proxy-agent/dist/index.js"); @@ -27655,7 +28087,7 @@ var url = __webpack_require__(/*! url */ "url"); var LRU = __webpack_require__(/*! lru-cache */ "../../../.yarn/berry/cache/lru-cache-npm-5.1.1-f475882a51-9.zip/node_modules/lru-cache/index.js"); var Agent = __webpack_require__(/*! agent-base */ "../../../.yarn/berry/cache/agent-base-npm-6.0.2-428f325a93-9.zip/node_modules/agent-base/dist/src/index.js"); var inherits = (__webpack_require__(/*! util */ "util").inherits); -var debug = __webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")('proxy-agent'); +var debug = __webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")('proxy-agent'); var getProxyForUrl = (__webpack_require__(/*! proxy-from-env */ "../../../.yarn/berry/cache/proxy-from-env-npm-1.1.0-c13d07f26b-9.zip/node_modules/proxy-from-env/index.js").getProxyForUrl); var http = __webpack_require__(/*! http */ "http"); @@ -31627,9 +32059,9 @@ exports.bigIntAndBufferInt64Check = bigIntAndBufferInt64Check; /***/ }), -/***/ "../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/client/socksclient.js": +/***/ "../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/client/socksclient.js": /*!******************************************************************************************************************!*\ - !*** ../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/client/socksclient.js ***! + !*** ../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/client/socksclient.js ***! \******************************************************************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { @@ -31648,12 +32080,12 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SocksClientError = exports.SocksClient = void 0; const events_1 = __webpack_require__(/*! events */ "events"); const net = __webpack_require__(/*! net */ "net"); -const ip = __webpack_require__(/*! ip */ "../../../.yarn/berry/cache/ip-npm-1.1.8-abea558b72-9.zip/node_modules/ip/lib/ip.js"); +const ip = __webpack_require__(/*! ip */ "../../../.yarn/berry/cache/ip-npm-2.0.0-204facb3cc-9.zip/node_modules/ip/lib/ip.js"); const smart_buffer_1 = __webpack_require__(/*! smart-buffer */ "../../../.yarn/berry/cache/smart-buffer-npm-4.2.0-5ac3f668bb-9.zip/node_modules/smart-buffer/build/smartbuffer.js"); -const constants_1 = __webpack_require__(/*! ../common/constants */ "../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/common/constants.js"); -const helpers_1 = __webpack_require__(/*! ../common/helpers */ "../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/common/helpers.js"); -const receivebuffer_1 = __webpack_require__(/*! ../common/receivebuffer */ "../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/common/receivebuffer.js"); -const util_1 = __webpack_require__(/*! ../common/util */ "../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/common/util.js"); +const constants_1 = __webpack_require__(/*! ../common/constants */ "../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/common/constants.js"); +const helpers_1 = __webpack_require__(/*! ../common/helpers */ "../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/common/helpers.js"); +const receivebuffer_1 = __webpack_require__(/*! ../common/receivebuffer */ "../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/common/receivebuffer.js"); +const util_1 = __webpack_require__(/*! ../common/util */ "../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/common/util.js"); Object.defineProperty(exports, "SocksClientError", ({ enumerable: true, get: function () { return util_1.SocksClientError; } })); class SocksClient extends events_1.EventEmitter { constructor(options) { @@ -31681,6 +32113,7 @@ class SocksClient extends events_1.EventEmitter { catch (err) { if (typeof callback === 'function') { callback(err); + // eslint-disable-next-line @typescript-eslint/no-explicit-any return resolve(err); // Resolves pending promise (prevents memory leaks). } else { @@ -31704,6 +32137,7 @@ class SocksClient extends events_1.EventEmitter { client.removeAllListeners(); if (typeof callback === 'function') { callback(err); + // eslint-disable-next-line @typescript-eslint/no-explicit-any resolve(err); // Resolves pending promise (prevents memory leaks). } else { @@ -31722,6 +32156,7 @@ class SocksClient extends events_1.EventEmitter { * @returns { Promise } */ static createConnectionChain(options, callback) { + // eslint-disable-next-line no-async-promise-executor return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { // Validate SocksClientChainOptions try { @@ -31730,6 +32165,7 @@ class SocksClient extends events_1.EventEmitter { catch (err) { if (typeof callback === 'function') { callback(err); + // eslint-disable-next-line @typescript-eslint/no-explicit-any return resolve(err); // Resolves pending promise (prevents memory leaks). } else { @@ -31742,7 +32178,6 @@ class SocksClient extends events_1.EventEmitter { (0, util_1.shuffleArray)(options.proxies); } try { - // tslint:disable-next-line:no-increment-decrement for (let i = 0; i < options.proxies.length; i++) { const nextProxy = options.proxies[i]; // If we've reached the last proxy in the chain, the destination is the actual destination, otherwise it's the next proxy. @@ -31776,6 +32211,7 @@ class SocksClient extends events_1.EventEmitter { catch (err) { if (typeof callback === 'function') { callback(err); + // eslint-disable-next-line @typescript-eslint/no-explicit-any resolve(err); // Resolves pending promise (prevents memory leaks). } else { @@ -32428,9 +32864,9 @@ exports.SocksClient = SocksClient; /***/ }), -/***/ "../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/common/constants.js": +/***/ "../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/common/constants.js": /*!****************************************************************************************************************!*\ - !*** ../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/common/constants.js ***! + !*** ../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/common/constants.js ***! \****************************************************************************************************************/ /***/ ((__unused_webpack_module, exports) => { @@ -32552,9 +32988,9 @@ exports.SocksClientState = SocksClientState; /***/ }), -/***/ "../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/common/helpers.js": +/***/ "../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/common/helpers.js": /*!**************************************************************************************************************!*\ - !*** ../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/common/helpers.js ***! + !*** ../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/common/helpers.js ***! \**************************************************************************************************************/ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { @@ -32562,8 +32998,8 @@ exports.SocksClientState = SocksClientState; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.validateSocksClientChainOptions = exports.validateSocksClientOptions = void 0; -const util_1 = __webpack_require__(/*! ./util */ "../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/common/util.js"); -const constants_1 = __webpack_require__(/*! ./constants */ "../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/common/constants.js"); +const util_1 = __webpack_require__(/*! ./util */ "../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/common/util.js"); +const constants_1 = __webpack_require__(/*! ./constants */ "../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/common/constants.js"); const stream = __webpack_require__(/*! stream */ "stream"); /** * Validates the provided SocksClientOptions @@ -32690,9 +33126,9 @@ function isValidTimeoutValue(value) { /***/ }), -/***/ "../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/common/receivebuffer.js": +/***/ "../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/common/receivebuffer.js": /*!********************************************************************************************************************!*\ - !*** ../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/common/receivebuffer.js ***! + !*** ../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/common/receivebuffer.js ***! \********************************************************************************************************************/ /***/ ((__unused_webpack_module, exports) => { @@ -32743,9 +33179,9 @@ exports.ReceiveBuffer = ReceiveBuffer; /***/ }), -/***/ "../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/common/util.js": +/***/ "../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/common/util.js": /*!***********************************************************************************************************!*\ - !*** ../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/common/util.js ***! + !*** ../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/common/util.js ***! \***********************************************************************************************************/ /***/ ((__unused_webpack_module, exports) => { @@ -32768,7 +33204,6 @@ exports.SocksClientError = SocksClientError; * @param array The array to shuffle. */ function shuffleArray(array) { - // tslint:disable-next-line:no-increment-decrement for (let i = array.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [array[i], array[j]] = [array[j], array[i]]; @@ -32779,9 +33214,9 @@ exports.shuffleArray = shuffleArray; /***/ }), -/***/ "../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/index.js": +/***/ "../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/index.js": /*!*****************************************************************************************************!*\ - !*** ../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/index.js ***! + !*** ../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/index.js ***! \*****************************************************************************************************/ /***/ (function(__unused_webpack_module, exports, __webpack_require__) { @@ -32789,7 +33224,11 @@ exports.shuffleArray = shuffleArray; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; @@ -32798,7 +33237,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__webpack_require__(/*! ./client/socksclient */ "../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/client/socksclient.js"), exports); +__exportStar(__webpack_require__(/*! ./client/socksclient */ "../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/client/socksclient.js"), exports); //# sourceMappingURL=index.js.map /***/ }), @@ -32827,9 +33266,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); const dns_1 = __importDefault(__webpack_require__(/*! dns */ "dns")); const tls_1 = __importDefault(__webpack_require__(/*! tls */ "tls")); const url_1 = __importDefault(__webpack_require__(/*! url */ "url")); -const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); +const debug_1 = __importDefault(__webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js")); const agent_base_1 = __webpack_require__(/*! agent-base */ "../../../.yarn/berry/cache/agent-base-npm-6.0.2-428f325a93-9.zip/node_modules/agent-base/dist/src/index.js"); -const socks_1 = __webpack_require__(/*! socks */ "../../../.yarn/berry/cache/socks-npm-2.6.2-94c1dcb8b8-9.zip/node_modules/socks/build/index.js"); +const socks_1 = __webpack_require__(/*! socks */ "../../../.yarn/berry/cache/socks-npm-2.7.0-cc1cb019db-9.zip/node_modules/socks/build/index.js"); const debug = debug_1.default('socks-proxy-agent'); function dnsLookup(host) { return new Promise((resolve, reject) => { @@ -39862,9 +40301,9 @@ try { /***/ }), -/***/ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/browser.js": +/***/ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/browser.js": /*!*******************************************************************************************************************************************!*\ - !*** ./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/browser.js ***! + !*** ./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/browser.js ***! \*******************************************************************************************************************************************/ /***/ ((module, exports, __webpack_require__) => { @@ -40122,7 +40561,7 @@ function localstorage() { } } -module.exports = __webpack_require__(/*! ./common */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/common.js")(exports); +module.exports = __webpack_require__(/*! ./common */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/common.js")(exports); const {formatters} = module.exports; @@ -40141,9 +40580,9 @@ formatters.j = function (v) { /***/ }), -/***/ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/common.js": +/***/ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/common.js": /*!******************************************************************************************************************************************!*\ - !*** ./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/common.js ***! + !*** ./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/common.js ***! \******************************************************************************************************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { @@ -40425,9 +40864,9 @@ module.exports = setup; /***/ }), -/***/ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js": +/***/ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js": /*!*****************************************************************************************************************************************!*\ - !*** ./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js ***! + !*** ./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/index.js ***! \*****************************************************************************************************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { @@ -40437,17 +40876,17 @@ module.exports = setup; */ if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { - module.exports = __webpack_require__(/*! ./browser.js */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/browser.js"); + module.exports = __webpack_require__(/*! ./browser.js */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/browser.js"); } else { - module.exports = __webpack_require__(/*! ./node.js */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/node.js"); + module.exports = __webpack_require__(/*! ./node.js */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/node.js"); } /***/ }), -/***/ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/node.js": +/***/ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/node.js": /*!****************************************************************************************************************************************!*\ - !*** ./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/node.js ***! + !*** ./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/node.js ***! \****************************************************************************************************************************************/ /***/ ((module, exports, __webpack_require__) => { @@ -40690,7 +41129,7 @@ function init(debug) { } } -module.exports = __webpack_require__(/*! ./common */ "./.yarn/__virtual__/debug-virtual-a35d5f160d/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/common.js")(exports); +module.exports = __webpack_require__(/*! ./common */ "./.yarn/__virtual__/debug-virtual-3720c848e9/4/.yarn/berry/cache/debug-npm-4.3.4-4513954577-9.zip/node_modules/debug/src/common.js")(exports); const {formatters} = module.exports; diff --git a/deps/corepack/package.json b/deps/corepack/package.json index b0591ef89e9cf6..12a1b1a8035629 100644 --- a/deps/corepack/package.json +++ b/deps/corepack/package.json @@ -1,6 +1,6 @@ { "name": "corepack", - "version": "0.12.0", + "version": "0.12.1", "homepage": "https://github.com/nodejs/corepack#readme", "bugs": { "url": "https://github.com/nodejs/corepack/issues" @@ -10,14 +10,14 @@ "url": "https://github.com/nodejs/corepack.git" }, "license": "MIT", - "packageManager": "yarn@4.0.0-rc.6", + "packageManager": "yarn@4.0.0-rc.14+sha224.d3bee29dce07417588d640327d44f1e0b8182c240bc2beb0b81ccf6e", "devDependencies": { "@babel/core": "^7.14.3", "@babel/plugin-transform-modules-commonjs": "^7.14.0", "@babel/preset-typescript": "^7.13.0", "@types/debug": "^4.1.5", - "@types/jest": "^27.0.0", - "@types/node": "^17.0.10", + "@types/jest": "^28.0.0", + "@types/node": "^18.0.0", "@types/semver": "^7.1.0", "@types/tar": "^6.0.0", "@types/which": "^2.0.0", diff --git a/deps/undici/src/docs/best-practices/proxy.md b/deps/undici/src/docs/best-practices/proxy.md index 256e8f9c147cdf..bf102955cc84d1 100644 --- a/deps/undici/src/docs/best-practices/proxy.md +++ b/deps/undici/src/docs/best-practices/proxy.md @@ -20,10 +20,10 @@ import { createServer } from 'http' import proxy from 'proxy' const server = await buildServer() -const proxy = await buildProxy() +const proxyServer = await buildProxy() const serverUrl = `http://localhost:${server.address().port}` -const proxyUrl = `http://localhost:${proxy.address().port}` +const proxyUrl = `http://localhost:${proxyServer.address().port}` server.on('request', (req, res) => { console.log(req.url) // '/hello?foo=bar' @@ -47,7 +47,7 @@ console.log(response.statusCode) // 200 console.log(JSON.parse(data)) // { hello: 'world' } server.close() -proxy.close() +proxyServer.close() client.close() function buildServer () { @@ -73,12 +73,12 @@ import { createServer } from 'http' import proxy from 'proxy' const server = await buildServer() -const proxy = await buildProxy() +const proxyServer = await buildProxy() const serverUrl = `http://localhost:${server.address().port}` -const proxyUrl = `http://localhost:${proxy.address().port}` +const proxyUrl = `http://localhost:${proxyServer.address().port}` -proxy.authenticate = function (req, fn) { +proxyServer.authenticate = function (req, fn) { fn(null, req.headers['proxy-authorization'] === `Basic ${Buffer.from('user:pass').toString('base64')}`) } @@ -107,7 +107,7 @@ console.log(response.statusCode) // 200 console.log(JSON.parse(data)) // { hello: 'world' } server.close() -proxy.close() +proxyServer.close() client.close() function buildServer () { @@ -124,3 +124,4 @@ function buildProxy () { }) } ``` + diff --git a/deps/undici/src/lib/balanced-pool.js b/deps/undici/src/lib/balanced-pool.js index bb5788a8c1aada..47468ec0460689 100644 --- a/deps/undici/src/lib/balanced-pool.js +++ b/deps/undici/src/lib/balanced-pool.js @@ -18,6 +18,17 @@ const { parseOrigin } = require('./core/util') const kFactory = Symbol('factory') const kOptions = Symbol('options') +const kGreatestCommonDivisor = Symbol('kGreatestCommonDivisor') +const kCurrentWeight = Symbol('kCurrentWeight') +const kIndex = Symbol('kIndex') +const kWeight = Symbol('kWeight') +const kMaxWeightPerServer = Symbol('kMaxWeightPerServer') +const kErrorPenalty = Symbol('kErrorPenalty') + +function getGreatestCommonDivisor (a, b) { + if (b === 0) return a + return getGreatestCommonDivisor(b, a % b) +} function defaultFactory (origin, opts) { return new Pool(origin, opts) @@ -28,6 +39,11 @@ class BalancedPool extends PoolBase { super() this[kOptions] = opts + this[kIndex] = -1 + this[kCurrentWeight] = 0 + + this[kMaxWeightPerServer] = this[kOptions].maxWeightPerServer || 100 + this[kErrorPenalty] = this[kOptions].errorPenalty || 15 if (!Array.isArray(upstreams)) { upstreams = [upstreams] @@ -42,6 +58,7 @@ class BalancedPool extends PoolBase { for (const upstream of upstreams) { this.addUpstream(upstream) } + this._updateBalancedPoolStats() } addUpstream (upstream) { @@ -54,12 +71,40 @@ class BalancedPool extends PoolBase { ))) { return this } + const pool = this[kFactory](upstreamOrigin, Object.assign({}, this[kOptions])) + + this[kAddClient](pool) + pool.on('connect', () => { + pool[kWeight] = Math.min(this[kMaxWeightPerServer], pool[kWeight] + this[kErrorPenalty]) + }) + + pool.on('connectionError', () => { + pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty]) + this._updateBalancedPoolStats() + }) + + pool.on('disconnect', (...args) => { + const err = args[2] + if (err && err.code === 'UND_ERR_SOCKET') { + // decrease the weight of the pool. + pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty]) + this._updateBalancedPoolStats() + } + }) + + for (const client of this[kClients]) { + client[kWeight] = this[kMaxWeightPerServer] + } - this[kAddClient](this[kFactory](upstreamOrigin, Object.assign({}, this[kOptions]))) + this._updateBalancedPoolStats() return this } + _updateBalancedPoolStats () { + this[kGreatestCommonDivisor] = this[kClients].map(p => p[kWeight]).reduce(getGreatestCommonDivisor, 0) + } + removeUpstream (upstream) { const upstreamOrigin = parseOrigin(upstream).origin @@ -100,10 +145,42 @@ class BalancedPool extends PoolBase { return } - this[kClients].splice(this[kClients].indexOf(dispatcher), 1) - this[kClients].push(dispatcher) + const allClientsBusy = this[kClients].map(pool => pool[kNeedDrain]).reduce((a, b) => a && b, true) + + if (allClientsBusy) { + return + } + + let counter = 0 + + let maxWeightIndex = this[kClients].findIndex(pool => !pool[kNeedDrain]) + + while (counter++ < this[kClients].length) { + this[kIndex] = (this[kIndex] + 1) % this[kClients].length + const pool = this[kClients][this[kIndex]] + + // find pool index with the largest weight + if (pool[kWeight] > this[kClients][maxWeightIndex][kWeight] && !pool[kNeedDrain]) { + maxWeightIndex = this[kIndex] + } + + // decrease the current weight every `this[kClients].length`. + if (this[kIndex] === 0) { + // Set the current weight to the next lower weight. + this[kCurrentWeight] = this[kCurrentWeight] - this[kGreatestCommonDivisor] + + if (this[kCurrentWeight] <= 0) { + this[kCurrentWeight] = this[kMaxWeightPerServer] + } + } + if (pool[kWeight] >= this[kCurrentWeight] && (!pool[kNeedDrain])) { + return pool + } + } - return dispatcher + this[kCurrentWeight] = this[kClients][maxWeightIndex][kWeight] + this[kIndex] = maxWeightIndex + return this[kClients][maxWeightIndex] } } diff --git a/deps/undici/src/lib/core/request.js b/deps/undici/src/lib/core/request.js index 0a3d85589580e1..4dc2fcca0db62c 100644 --- a/deps/undici/src/lib/core/request.js +++ b/deps/undici/src/lib/core/request.js @@ -7,6 +7,27 @@ const { const assert = require('assert') const util = require('./util') +// tokenRegExp and headerCharRegex have been lifted from +// https://github.com/nodejs/node/blob/main/lib/_http_common.js + +/** + * Verifies that the given val is a valid HTTP token + * per the rules defined in RFC 7230 + * See https://tools.ietf.org/html/rfc7230#section-3.2.6 + */ +const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/ + +/** + * Matches if val contains an invalid field-vchar + * field-value = *( field-content / obs-fold ) + * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] + * field-vchar = VCHAR / obs-text + */ +const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/ + +// Verifies that a given path is valid does not contain control chars \x00 to \x20 +const invalidPathRegex = /[^\u0021-\u00ff]/ + const kHandler = Symbol('handler') const channels = {} @@ -54,10 +75,14 @@ class Request { method !== 'CONNECT' ) { throw new InvalidArgumentError('path must be an absolute URL or start with a slash') + } else if (invalidPathRegex.exec(path) !== null) { + throw new InvalidArgumentError('invalid request path') } if (typeof method !== 'string') { throw new InvalidArgumentError('method must be a string') + } else if (tokenRegExp.exec(method) === null) { + throw new InvalidArgumentError('invalid request method') } if (upgrade && typeof upgrade !== 'string') { @@ -301,6 +326,10 @@ function processHeader (request, key, val) { key.toLowerCase() === 'expect' ) { throw new NotSupportedError('expect header not supported') + } else if (tokenRegExp.exec(key) === null) { + throw new InvalidArgumentError('invalid header key') + } else if (headerCharRegex.exec(val) !== null) { + throw new InvalidArgumentError(`invalid ${key} header`) } else { request.headers += `${key}: ${val}\r\n` } diff --git a/deps/undici/src/lib/fetch/body.js b/deps/undici/src/lib/fetch/body.js index 3fa70297948f5e..2a9f1c83d888d2 100644 --- a/deps/undici/src/lib/fetch/body.js +++ b/deps/undici/src/lib/fetch/body.js @@ -291,6 +291,10 @@ function bodyMixinMethods (instance) { const chunks = [] for await (const chunk of consumeBody(this[kState].body)) { + if (!isUint8Array(chunk)) { + throw new TypeError('Expected Uint8Array chunk') + } + // Assemble one final large blob with Uint8Array's can exhaust memory. // That's why we create create multiple blob's and using references chunks.push(new Blob([chunk])) @@ -314,6 +318,10 @@ function bodyMixinMethods (instance) { let offset = 0 for await (const chunk of consumeBody(this[kState].body)) { + if (!isUint8Array(chunk)) { + throw new TypeError('Expected Uint8Array chunk') + } + buffer.set(chunk, offset) offset += chunk.length } @@ -331,6 +339,10 @@ function bodyMixinMethods (instance) { let size = 0 for await (const chunk of consumeBody(this[kState].body)) { + if (!isUint8Array(chunk)) { + throw new TypeError('Expected Uint8Array chunk') + } + chunks.push(chunk) size += chunk.byteLength } @@ -355,6 +367,10 @@ function bodyMixinMethods (instance) { const textDecoder = new TextDecoder() for await (const chunk of consumeBody(this[kState].body)) { + if (!isUint8Array(chunk)) { + throw new TypeError('Expected Uint8Array chunk') + } + result += textDecoder.decode(chunk, { stream: true }) } diff --git a/deps/undici/src/lib/handler/redirect.js b/deps/undici/src/lib/handler/redirect.js index 998a8c2352b9a4..a464e052dc7038 100644 --- a/deps/undici/src/lib/handler/redirect.js +++ b/deps/undici/src/lib/handler/redirect.js @@ -186,7 +186,8 @@ function shouldRemoveHeader (header, removeContent, unknownOrigin) { return ( (header.length === 4 && header.toString().toLowerCase() === 'host') || (removeContent && header.toString().toLowerCase().indexOf('content-') === 0) || - (unknownOrigin && header.length === 13 && header.toString().toLowerCase() === 'authorization') + (unknownOrigin && header.length === 13 && header.toString().toLowerCase() === 'authorization') || + (unknownOrigin && header.length === 6 && header.toString().toLowerCase() === 'cookie') ) } diff --git a/deps/undici/src/lib/mock/mock-utils.js b/deps/undici/src/lib/mock/mock-utils.js index 14bfcb1187972b..80052223f8fb40 100644 --- a/deps/undici/src/lib/mock/mock-utils.js +++ b/deps/undici/src/lib/mock/mock-utils.js @@ -8,7 +8,7 @@ const { kOrigin, kGetNetConnect } = require('./mock-symbols') -const { buildURL } = require('../core/util') +const { buildURL, nop } = require('../core/util') function matchValue (match, value) { if (typeof match === 'string') { @@ -288,6 +288,7 @@ function mockDispatch (opts, handler) { const responseHeaders = generateKeyValues(headers) const responseTrailers = generateKeyValues(trailers) + handler.abort = nop handler.onHeaders(statusCode, responseHeaders, resume, getStatusText(statusCode)) handler.onData(Buffer.from(responseData)) handler.onComplete(responseTrailers) diff --git a/deps/undici/src/package.json b/deps/undici/src/package.json index 988d806471b244..1fde040055fadc 100644 --- a/deps/undici/src/package.json +++ b/deps/undici/src/package.json @@ -1,6 +1,6 @@ { "name": "undici", - "version": "5.7.0", + "version": "5.8.0", "description": "An HTTP/1.1 client, written from scratch for Node.js", "homepage": "https://undici.nodejs.org", "bugs": { diff --git a/deps/undici/undici.js b/deps/undici/undici.js index b5d416b06efb97..f59f177536a324 100644 --- a/deps/undici/undici.js +++ b/deps/undici/undici.js @@ -2227,6 +2227,9 @@ Content-Type: ${value.type || "application/octet-stream"}\r } const chunks = []; for await (const chunk of consumeBody(this[kState].body)) { + if (!isUint8Array(chunk)) { + throw new TypeError("Expected Uint8Array chunk"); + } chunks.push(new Blob([chunk])); } return new Blob(chunks, { type: this.headers.get("Content-Type") || "" }); @@ -2241,6 +2244,9 @@ Content-Type: ${value.type || "application/octet-stream"}\r const buffer2 = new Uint8Array(contentLength); let offset2 = 0; for await (const chunk of consumeBody(this[kState].body)) { + if (!isUint8Array(chunk)) { + throw new TypeError("Expected Uint8Array chunk"); + } buffer2.set(chunk, offset2); offset2 += chunk.length; } @@ -2249,6 +2255,9 @@ Content-Type: ${value.type || "application/octet-stream"}\r const chunks = []; let size = 0; for await (const chunk of consumeBody(this[kState].body)) { + if (!isUint8Array(chunk)) { + throw new TypeError("Expected Uint8Array chunk"); + } chunks.push(chunk); size += chunk.byteLength; } @@ -2267,6 +2276,9 @@ Content-Type: ${value.type || "application/octet-stream"}\r let result = ""; const textDecoder = new TextDecoder(); for await (const chunk of consumeBody(this[kState].body)) { + if (!isUint8Array(chunk)) { + throw new TypeError("Expected Uint8Array chunk"); + } result += textDecoder.decode(chunk, { stream: true }); } result += textDecoder.decode(); @@ -2350,6 +2362,9 @@ var require_request = __commonJS({ } = require_errors(); var assert = require("assert"); var util = require_util(); + var tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/; + var headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/; + var invalidPathRegex = /[^\u0021-\u00ff]/; var kHandler = Symbol("handler"); var channels = {}; var extractBody; @@ -2388,9 +2403,13 @@ var require_request = __commonJS({ throw new InvalidArgumentError("path must be a string"); } else if (path[0] !== "/" && !(path.startsWith("http://") || path.startsWith("https://")) && method !== "CONNECT") { throw new InvalidArgumentError("path must be an absolute URL or start with a slash"); + } else if (invalidPathRegex.exec(path) !== null) { + throw new InvalidArgumentError("invalid request path"); } if (typeof method !== "string") { throw new InvalidArgumentError("method must be a string"); + } else if (tokenRegExp.exec(method) === null) { + throw new InvalidArgumentError("invalid request method"); } if (upgrade && typeof upgrade !== "string") { throw new InvalidArgumentError("upgrade must be a string"); @@ -2562,6 +2581,10 @@ var require_request = __commonJS({ throw new InvalidArgumentError("invalid upgrade header"); } else if (key.length === 6 && key.toLowerCase() === "expect") { throw new NotSupportedError("expect header not supported"); + } else if (tokenRegExp.exec(key) === null) { + throw new InvalidArgumentError("invalid header key"); + } else if (headerCharRegex.exec(val) !== null) { + throw new InvalidArgumentError(`invalid ${key} header`); } else { request.headers += `${key}: ${val}\r `; @@ -2685,7 +2708,7 @@ var require_redirect = __commonJS({ } } function shouldRemoveHeader(header, removeContent, unknownOrigin) { - return header.length === 4 && header.toString().toLowerCase() === "host" || removeContent && header.toString().toLowerCase().indexOf("content-") === 0 || unknownOrigin && header.length === 13 && header.toString().toLowerCase() === "authorization"; + return header.length === 4 && header.toString().toLowerCase() === "host" || removeContent && header.toString().toLowerCase().indexOf("content-") === 0 || unknownOrigin && header.length === 13 && header.toString().toLowerCase() === "authorization" || unknownOrigin && header.length === 6 && header.toString().toLowerCase() === "cookie"; } function cleanRequestHeaders(headers, removeContent, unknownOrigin) { const ret = []; diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 2cb65860ae3715..02d2078295f8f5 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -1639,7 +1639,7 @@ in which the child process is launched. added: v0.1.90 --> -* {stream.Readable} +* {stream.Readable|null|undefined} A `Readable Stream` that represents the child process's `stderr`. @@ -1649,8 +1649,8 @@ then this will be `null`. `subprocess.stderr` is an alias for `subprocess.stdio[2]`. Both properties will refer to the same value. -The `subprocess.stderr` property can be `null` if the child process could -not be successfully spawned. +The `subprocess.stderr` property can be `null` or `undefined` +if the child process could not be successfully spawned. ### `subprocess.stdin` @@ -1658,7 +1658,7 @@ not be successfully spawned. added: v0.1.90 --> -* {stream.Writable} +* {stream.Writable|null|undefined} A `Writable Stream` that represents the child process's `stdin`. @@ -1671,8 +1671,8 @@ then this will be `null`. `subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will refer to the same value. -The `subprocess.stdin` property can be `undefined` if the child process could -not be successfully spawned. +The `subprocess.stdin` property can be `null` or `undefined` +if the child process could not be successfully spawned. ### `subprocess.stdio` @@ -1724,7 +1724,7 @@ not be successfully spawned. added: v0.1.90 --> -* {stream.Readable} +* {stream.Readable|null|undefined} A `Readable Stream` that represents the child process's `stdout`. @@ -1744,8 +1744,8 @@ subprocess.stdout.on('data', (data) => { }); ``` -The `subprocess.stdout` property can be `null` if the child process could -not be successfully spawned. +The `subprocess.stdout` property can be `null` or `undefined` +if the child process could not be successfully spawned. ### `subprocess.unref()` diff --git a/doc/api/http.md b/doc/api/http.md index d28895ee484303..d90be4c4818877 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -866,7 +866,7 @@ request.setHeader('Foo', 'bar'); request.setHeader('Cookie', ['foo=bar', 'bar=baz']); const headerNames = request.getHeaderNames(); -// headerNames === ['foo', 'Cookie'] +// headerNames === ['foo', 'cookie'] ``` ### `request.getHeaders()` @@ -1396,6 +1396,20 @@ This event is guaranteed to be passed an instance of the {net.Socket} class, a subclass of {stream.Duplex}, unless the user specifies a socket type other than {net.Socket}. +### Event: `'dropRequest'` + + + +* `request` {http.IncomingMessage} Arguments for the HTTP request, as it is in + the [`'request'`][] event +* `socket` {stream.Duplex} Network socket between the server and client + +When the number of requests on a socket reaches the threshold of +`server.maxRequestsPerSocket`, the server will drop new requests +and emit `'dropRequest'` event instead, then send `503` to client. + ### Event: `'request'` > Stability: 1 - Experimental @@ -1034,18 +1039,24 @@ added: REPLACEME times. If `true`, all values will be collected in an array. If `false`, values for the option are last-wins. **Default:** `false`. * `short` {string} A single character alias for the option. - * `strict`: {boolean} Should an error be thrown when unknown arguments + * `strict` {boolean} Should an error be thrown when unknown arguments are encountered, or when arguments are passed that do not match the `type` configured in `options`. **Default:** `true`. - * `allowPositionals`: {boolean} Whether this command accepts positional + * `allowPositionals` {boolean} Whether this command accepts positional arguments. **Default:** `false` if `strict` is `true`, otherwise `true`. + * `tokens` {boolean} Return the parsed tokens. This is useful for extending + the built-in behavior, from adding additional checks through to reprocessing + the tokens in different ways. + **Default:** `false`. * Returns: {Object} The parsed command line arguments: * `values` {Object} A mapping of parsed option names with their {string} or {boolean} values. * `positionals` {string\[]} Positional arguments. + * `tokens` {Object\[] | undefined} See [parseArgs tokens](#parseargs-tokens) + section. Only returned if `config` includes `tokens: true`. Provides a higher level API for command-line argument parsing than interacting with `process.argv` directly. Takes a specification for the expected arguments @@ -1094,6 +1105,114 @@ console.log(values, positionals); `util.parseArgs` is experimental and behavior may change. Join the conversation in [pkgjs/parseargs][] to contribute to the design. +### `parseArgs` `tokens` + +Detailed parse information is available for adding custom behaviours by +specifying `tokens: true` in the configuration. +The returned tokens have properties describing: + +* all tokens + * `kind` {string} One of 'option', 'positional', or 'option-terminator'. + * `index` {number} Index of element in `args` containing token. So the + source argument for a token is `args[token.index]`. +* option tokens + * `name` {string} Long name of option. + * `rawName` {string} How option used in args, like `-f` of `--foo`. + * `value` {string | undefined} Option value specified in args. + Undefined for boolean options. + * `inlineValue` {boolean | undefined} Whether option value specified inline, + like `--foo=bar`. +* positional tokens + * `value` {string} The value of the positional argument in args (i.e. `args[index]`). +* option-terminator token + +The returned tokens are in the order encountered in the input args. Options +that appear more than once in args produce a token for each use. Short option +groups like `-xy` expand to a token for each option. So `-xxx` produces +three tokens. + +For example to use the returned tokens to add support for a negated option +like `--no-color`, the tokens can be reprocessed to change the value stored +for the negated option. + +```mjs +import { parseArgs } from 'node:util'; + +const options = { + 'color': { type: 'boolean' }, + 'no-color': { type: 'boolean' }, + 'logfile': { type: 'string' }, + 'no-logfile': { type: 'boolean' }, +}; +const { values, tokens } = parseArgs({ options, tokens: true }); + +// Reprocess the option tokens and overwrite the returned values. +tokens + .filter((token) => token.kind === 'option') + .forEach((token) => { + if (token.name.startsWith('no-')) { + // Store foo:false for --no-foo + const positiveName = token.name.slice(3); + values[positiveName] = false; + delete values[token.name]; + } else { + // Resave value so last one wins if both --foo and --no-foo. + values[token.name] = token.value ?? true; + } + }); + +const color = values.color; +const logfile = values.logfile ?? 'default.log'; + +console.log({ logfile, color }); +``` + +```cjs +const { parseArgs } = require('node:util'); + +const options = { + 'color': { type: 'boolean' }, + 'no-color': { type: 'boolean' }, + 'logfile': { type: 'string' }, + 'no-logfile': { type: 'boolean' }, +}; +const { values, tokens } = parseArgs({ options, tokens: true }); + +// Reprocess the option tokens and overwrite the returned values. +tokens + .filter((token) => token.kind === 'option') + .forEach((token) => { + if (token.name.startsWith('no-')) { + // Store foo:false for --no-foo + const positiveName = token.name.slice(3); + values[positiveName] = false; + delete values[token.name]; + } else { + // Resave value so last one wins if both --foo and --no-foo. + values[token.name] = token.value ?? true; + } + }); + +const color = values.color; +const logfile = values.logfile ?? 'default.log'; + +console.log({ logfile, color }); +``` + +Example usage showing negated options, and when an option is used +multiple ways then last one wins. + +```console +$ node negate.js +{ logfile: 'default.log', color: undefined } +$ node negate.js --no-logfile --no-color +{ logfile: false, color: false } +$ node negate.js --logfile=test.log --color +{ logfile: 'test.log', color: true } +$ node negate.js --no-logfile --logfile=test.log --color --no-color +{ logfile: 'test.log', color: false } +``` + ## `util.promisify(original)`