From cd20ecc7cbe8bbf2a47b71158a35cfd5b9891a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Fri, 8 Oct 2021 10:58:06 +0200 Subject: [PATCH] deps: upgrade Corepack to 0.10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/40374 Backport-PR-URL: https://github.com/nodejs/node/pull/40479 Reviewed-By: Michaël Zasso Reviewed-By: Tobias Nießen Reviewed-By: Antoine du Hamel Reviewed-By: Benjamin Gruenbaum Reviewed-By: Jiawen Geng Reviewed-By: James M Snell --- deps/corepack/README.md | 29 +-- deps/corepack/dist/corepack.js | 366 +++++++++++++++---------------- deps/corepack/package.json | 2 +- deps/corepack/shims/corepack.cmd | 0 deps/corepack/shims/corepack.ps1 | 0 deps/corepack/shims/npm.cmd | 0 deps/corepack/shims/npx.cmd | 0 deps/corepack/shims/pnpm.cmd | 0 deps/corepack/shims/pnpx.cmd | 0 deps/corepack/shims/yarn.cmd | 0 deps/corepack/shims/yarnpkg.cmd | 0 11 files changed, 191 insertions(+), 206 deletions(-) mode change 100644 => 100755 deps/corepack/shims/corepack.cmd mode change 100644 => 100755 deps/corepack/shims/corepack.ps1 mode change 100644 => 100755 deps/corepack/shims/npm.cmd mode change 100644 => 100755 deps/corepack/shims/npx.cmd mode change 100644 => 100755 deps/corepack/shims/pnpm.cmd mode change 100644 => 100755 deps/corepack/shims/pnpx.cmd mode change 100644 => 100755 deps/corepack/shims/yarn.cmd mode change 100644 => 100755 deps/corepack/shims/yarnpkg.cmd diff --git a/deps/corepack/README.md b/deps/corepack/README.md index d557a1b4fc3826..d58811c4cdaaee 100644 --- a/deps/corepack/README.md +++ b/deps/corepack/README.md @@ -1,6 +1,6 @@ # corepack -Corepack is a zero-runtime-dependency Node script that acts as a bridge between Node projects and the package managers they are intended to be used with during development. In practical terms, **Corepack will let you use Yarn and pnpm without having to install them** - just like what currently happens with npm, which is shipped by Node by default. +Corepack is a zero-runtime-dependency Node.js script that acts as a bridge between Node.js projects and the package managers they are intended to be used with during development. In practical terms, **Corepack will let you use Yarn and pnpm without having to install them** - just like what currently happens with npm, which is shipped by Node.js by default. **Important:** At the moment, Corepack only covers Yarn and pnpm. Given that we have little control on the npm project, we prefer to focus on the Yarn and pnpm use cases. As a result, Corepack doesn't have any effect at all on the way you use npm. @@ -8,7 +8,7 @@ Corepack is a zero-runtime-dependency Node script that acts as a bridge between ### Default Installs -Corepack isn't intended to be installed manually. While it's certainly possible, we're working with the Node TSC to provide Corepack by default starting from Node 15, thus ensuring that all package managers can be used with little to no friction. +Corepack is distributed by default with Node.js 16.9, but is opt-in for the time being. Run `corepack enable` to install the required shims. ### Manual Installs @@ -30,22 +30,7 @@ Then install Corepack: npm install -g corepack ``` -We do acknowledge the irony and overhead of using npm to install Corepack, which is at least part of why the preferred option is to use the Corepack version that will be distributed along with Node itself. - - - -### Prebuilt Binaries - -
-Click here to see how to download prebuilt Corepack Node distributions - -We have a few prebuilt Node binaries (based on the [following branch](https://github.com/arcanis/node/tree/mael/pmm)) that you can just download, unpack somewhere, and add to your `PATH` environment variable. - -1. Go to [this page](https://github.com/arcanis/pmm/actions?query=workflow%3ABuild) -2. Open the latest build (the one at the top) -3. Download the right artifact (Linux or Darwin) -4. Unzip the artifact, then untar it -5. Add the `node-v15.0.0-nightlyYYYY-MM-DDXXXX-linux-x64/bin` directory to your `$PATH` +We do acknowledge the irony and overhead of using npm to install Corepack, which is at least part of why the preferred option is to use the Corepack version that is distributed along with Node.js itself.
@@ -61,7 +46,7 @@ Just use your package managers as you usually would. Run `yarn install` in Yarn ## Known Good Releases -When running Yarn or pnpm within projects that don't list a supported package manager, Corepack will default to a set of Known Good Releases. In a way, you can compare this to Node, where each version ships with a specific version of npm. +When running Yarn or pnpm within projects that don't list a supported package manager, Corepack will default to a set of Known Good Releases. In a way, you can compare this to Node.js, where each version ships with a specific version of npm. The Known Good Releases can be updated system-wide using the `--activate` flag from the `corepack prepare` and `corepack hydrate` commands. @@ -89,7 +74,7 @@ Note that those commands still check whether the local project is configured for | --- | --- | | `--install-directory` | Add the shims to the specified location | -This command will detect where Node is installed and will create shims next to it for each of the specified package managers (or all of them if the command is called without parameters). Note that the npm shims will not be installed unless explicitly requested, as npm is currently distributed with Node through other means. +This command will detect where Node.js is installed and will create shims next to it for each of the specified package managers (or all of them if the command is called without parameters). Note that the npm shims will not be installed unless explicitly requested, as npm is currently distributed with Node.js through other means. ### `corepack disable [... name]` @@ -97,7 +82,7 @@ This command will detect where Node is installed and will create shims next to i | --- | --- | | `--install-directory` | Remove the shims to the specified location | -This command will detect where Node is installed and will remove the shims from there. +This command will detect where Node.js is installed and will remove the shims from there. ### `corepack prepare [... name@version]` @@ -119,7 +104,7 @@ This command will retrieve the given package manager from the specified archive ## Environment Variables -- `COREPACK_ENABLED` has no functional impact on Corepack itself; it's automatically being set in your environment by Corepack when it shells out to the underlying package managers, so that they can feature-detect its presence (useful for commands like `yarn init`). +- `COREPACK_ROOT` has no functional impact on Corepack itself; it's automatically being set in your environment by Corepack when it shells out to the underlying package managers, so that they can feature-detect its presence (useful for commands like `yarn init`). ## Contributing diff --git a/deps/corepack/dist/corepack.js b/deps/corepack/dist/corepack.js index ca368a487c4b20..f540b108b0a305 100755 --- a/deps/corepack/dist/corepack.js +++ b/deps/corepack/dist/corepack.js @@ -3029,7 +3029,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _config_json__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../config.json */ "./config.json"); /* harmony import */ var _folderUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./folderUtils */ "./sources/folderUtils.ts"); -/* harmony import */ var _pmmUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./pmmUtils */ "./sources/pmmUtils.ts"); +/* harmony import */ var _corepackUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./corepackUtils */ "./sources/corepackUtils.ts"); /* harmony import */ var _semverUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./semverUtils */ "./sources/semverUtils.ts"); /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./types */ "./sources/types.ts"); @@ -3119,7 +3119,7 @@ class Engine { const range = ranges.find(range => _semverUtils__WEBPACK_IMPORTED_MODULE_6__.satisfiesWithPrereleases(locator.reference, range)); if (typeof range === `undefined`) throw new Error(`Assertion failed: Specified resolution (${locator.reference}) isn't supported by any of ${ranges.join(`, `)}`); - const installedLocation = await _pmmUtils__WEBPACK_IMPORTED_MODULE_5__.installVersion(_folderUtils__WEBPACK_IMPORTED_MODULE_4__.getInstallFolder(), locator, { + const installedLocation = await _corepackUtils__WEBPACK_IMPORTED_MODULE_5__.installVersion(_folderUtils__WEBPACK_IMPORTED_MODULE_4__.getInstallFolder(), locator, { spec: definition.ranges[range], }); return { @@ -3138,7 +3138,7 @@ class Engine { // We only resolve tags from the latest registry entry const ranges = Object.keys(definition.ranges); const tagRange = ranges[ranges.length - 1]; - const tags = await _pmmUtils__WEBPACK_IMPORTED_MODULE_5__.fetchAvailableTags(definition.ranges[tagRange].registry); + const tags = await _corepackUtils__WEBPACK_IMPORTED_MODULE_5__.fetchAvailableTags(definition.ranges[tagRange].registry); if (!Object.prototype.hasOwnProperty.call(tags, descriptor.range)) throw new clipanion__WEBPACK_IMPORTED_MODULE_8__.UsageError(`Tag not found (${descriptor.range})`); finalDescriptor = { @@ -3148,14 +3148,14 @@ class Engine { } // If a compatible version is already installed, no need to query one // from the remote listings - const cachedVersion = await _pmmUtils__WEBPACK_IMPORTED_MODULE_5__.findInstalledVersion(_folderUtils__WEBPACK_IMPORTED_MODULE_4__.getInstallFolder(), finalDescriptor); + const cachedVersion = await _corepackUtils__WEBPACK_IMPORTED_MODULE_5__.findInstalledVersion(_folderUtils__WEBPACK_IMPORTED_MODULE_4__.getInstallFolder(), finalDescriptor); if (cachedVersion !== null && useCache) return { name: finalDescriptor.name, reference: cachedVersion }; const candidateRangeDefinitions = Object.keys(definition.ranges).filter(range => { return _semverUtils__WEBPACK_IMPORTED_MODULE_6__.satisfiesWithPrereleases(finalDescriptor.range, range); }); const tagResolutions = await Promise.all(candidateRangeDefinitions.map(async (range) => { - return [range, await _pmmUtils__WEBPACK_IMPORTED_MODULE_5__.fetchAvailableVersions(definition.ranges[range].registry)]; + return [range, await _corepackUtils__WEBPACK_IMPORTED_MODULE_5__.fetchAvailableVersions(definition.ranges[range].registry)]; })); // If a version is available under multiple strategies (for example if // Yarn is published to both the v1 package and git), we only care @@ -3607,180 +3607,10 @@ PrepareCommand.usage = clipanion__WEBPACK_IMPORTED_MODULE_3__.Command.Usage({ /***/ }), -/***/ "./sources/debugUtils.ts": -/*!*******************************!*\ - !*** ./sources/debugUtils.ts ***! - \*******************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "log": () => (/* binding */ log) -/* harmony export */ }); -/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/index.js"); -/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(debug__WEBPACK_IMPORTED_MODULE_0__); - -const log = debug__WEBPACK_IMPORTED_MODULE_0___default()(`corepack`); - - -/***/ }), - -/***/ "./sources/folderUtils.ts": -/*!********************************!*\ - !*** ./sources/folderUtils.ts ***! - \********************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "getInstallFolder": () => (/* binding */ getInstallFolder), -/* harmony export */ "getTemporaryFolder": () => (/* binding */ getTemporaryFolder) -/* harmony export */ }); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ "fs"); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! os */ "os"); -/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! path */ "path"); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); - - - -function getInstallFolder() { - var _a; - return (_a = process.env.COREPACK_HOME) !== null && _a !== void 0 ? _a : (0,path__WEBPACK_IMPORTED_MODULE_2__.join)((0,os__WEBPACK_IMPORTED_MODULE_1__.homedir)(), `.node/corepack`); -} -function getTemporaryFolder(target = (0,os__WEBPACK_IMPORTED_MODULE_1__.tmpdir)()) { - (0,fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync)(target, { recursive: true }); - while (true) { - const rnd = Math.random() * 0x100000000; - const hex = rnd.toString(16).padStart(8, `0`); - const path = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(target, `corepack-${process.pid}-${hex}`); - try { - (0,fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync)(path); - return path; - } - catch (error) { - if (error.code === `EEXIST`) { - continue; - } - else { - throw error; - } - } - } -} - - -/***/ }), - -/***/ "./sources/fsUtils.ts": -/*!****************************!*\ - !*** ./sources/fsUtils.ts ***! - \****************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "mutex": () => (/* binding */ mutex) -/* harmony export */ }); -async function mutex(p, cb) { - return await cb(); -} - - -/***/ }), - -/***/ "./sources/httpUtils.ts": -/*!******************************!*\ - !*** ./sources/httpUtils.ts ***! - \******************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "fetchUrlStream": () => (/* binding */ fetchUrlStream), -/* harmony export */ "fetchAsBuffer": () => (/* binding */ fetchAsBuffer), -/* harmony export */ "fetchAsJson": () => (/* binding */ fetchAsJson) -/* harmony export */ }); -/* harmony import */ var clipanion__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! clipanion */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/index.js"); - -async function fetchUrlStream(url, options = {}) { - if (process.env.COREPACK_ENABLE_NETWORK === `0`) - throw new clipanion__WEBPACK_IMPORTED_MODULE_0__.UsageError(`Network access disabled by the environment; can't reach ${url}`); - const { default: https } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! https */ "https", 23)); - return new Promise((resolve, reject) => { - const request = https.get(url, options, response => { - var _a; - const statusCode = (_a = response.statusCode) !== null && _a !== void 0 ? _a : 500; - if (!(statusCode >= 200 && statusCode < 300)) - return reject(new Error(`Server answered with HTTP ${statusCode}`)); - return resolve(response); - }); - request.on(`error`, err => { - reject(new Error(`Error when performing the request`)); - }); - }); -} -async function fetchAsBuffer(url, options) { - const response = await fetchUrlStream(url, options); - return new Promise((resolve, reject) => { - const chunks = []; - response.on(`data`, chunk => { - chunks.push(chunk); - }); - response.on(`error`, error => { - reject(error); - }); - response.on(`end`, () => { - resolve(Buffer.concat(chunks)); - }); - }); -} -async function fetchAsJson(url, options) { - const buffer = await fetchAsBuffer(url, options); - const asText = buffer.toString(); - try { - return JSON.parse(asText); - } - catch (error) { - const truncated = asText.length > 30 - ? `${asText.slice(0, 30)}...` - : asText; - throw new Error(`Couldn't parse JSON data: ${JSON.stringify(truncated)}`); - } -} - - -/***/ }), - -/***/ "./sources/miscUtils.ts": -/*!******************************!*\ - !*** ./sources/miscUtils.ts ***! - \******************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Cancellation": () => (/* binding */ Cancellation) -/* harmony export */ }); -class Cancellation extends Error { - constructor() { - super(`Cancelled operation`); - } -} - - -/***/ }), - -/***/ "./sources/pmmUtils.ts": -/*!*****************************!*\ - !*** ./sources/pmmUtils.ts ***! - \*****************************/ +/***/ "./sources/corepackUtils.ts": +/*!**********************************!*\ + !*** ./sources/corepackUtils.ts ***! + \**********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; @@ -3988,6 +3818,176 @@ function sigtermHandler() { } +/***/ }), + +/***/ "./sources/debugUtils.ts": +/*!*******************************!*\ + !*** ./sources/debugUtils.ts ***! + \*******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "log": () => (/* binding */ log) +/* harmony export */ }); +/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! debug */ "./.yarn/__virtual__/debug-virtual-d208043b83/0/cache/debug-npm-4.1.1-540248b3aa-1e681f5cce.zip/node_modules/debug/src/index.js"); +/* harmony import */ var debug__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(debug__WEBPACK_IMPORTED_MODULE_0__); + +const log = debug__WEBPACK_IMPORTED_MODULE_0___default()(`corepack`); + + +/***/ }), + +/***/ "./sources/folderUtils.ts": +/*!********************************!*\ + !*** ./sources/folderUtils.ts ***! + \********************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "getInstallFolder": () => (/* binding */ getInstallFolder), +/* harmony export */ "getTemporaryFolder": () => (/* binding */ getTemporaryFolder) +/* harmony export */ }); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fs */ "fs"); +/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! os */ "os"); +/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(os__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! path */ "path"); +/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__); + + + +function getInstallFolder() { + var _a; + return (_a = process.env.COREPACK_HOME) !== null && _a !== void 0 ? _a : (0,path__WEBPACK_IMPORTED_MODULE_2__.join)((0,os__WEBPACK_IMPORTED_MODULE_1__.homedir)(), `.node/corepack`); +} +function getTemporaryFolder(target = (0,os__WEBPACK_IMPORTED_MODULE_1__.tmpdir)()) { + (0,fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync)(target, { recursive: true }); + while (true) { + const rnd = Math.random() * 0x100000000; + const hex = rnd.toString(16).padStart(8, `0`); + const path = (0,path__WEBPACK_IMPORTED_MODULE_2__.join)(target, `corepack-${process.pid}-${hex}`); + try { + (0,fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync)(path); + return path; + } + catch (error) { + if (error.code === `EEXIST`) { + continue; + } + else { + throw error; + } + } + } +} + + +/***/ }), + +/***/ "./sources/fsUtils.ts": +/*!****************************!*\ + !*** ./sources/fsUtils.ts ***! + \****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "mutex": () => (/* binding */ mutex) +/* harmony export */ }); +async function mutex(p, cb) { + return await cb(); +} + + +/***/ }), + +/***/ "./sources/httpUtils.ts": +/*!******************************!*\ + !*** ./sources/httpUtils.ts ***! + \******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "fetchUrlStream": () => (/* binding */ fetchUrlStream), +/* harmony export */ "fetchAsBuffer": () => (/* binding */ fetchAsBuffer), +/* harmony export */ "fetchAsJson": () => (/* binding */ fetchAsJson) +/* harmony export */ }); +/* harmony import */ var clipanion__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! clipanion */ "./.yarn/__virtual__/clipanion-virtual-119dc92083/0/cache/clipanion-npm-3.0.1-901533eeed-3a4b0c1e7d.zip/node_modules/clipanion/lib/advanced/index.js"); + +async function fetchUrlStream(url, options = {}) { + if (process.env.COREPACK_ENABLE_NETWORK === `0`) + throw new clipanion__WEBPACK_IMPORTED_MODULE_0__.UsageError(`Network access disabled by the environment; can't reach ${url}`); + const { default: https } = await Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! https */ "https", 23)); + return new Promise((resolve, reject) => { + const request = https.get(url, options, response => { + var _a; + const statusCode = (_a = response.statusCode) !== null && _a !== void 0 ? _a : 500; + if (!(statusCode >= 200 && statusCode < 300)) + return reject(new Error(`Server answered with HTTP ${statusCode}`)); + return resolve(response); + }); + request.on(`error`, err => { + reject(new Error(`Error when performing the request`)); + }); + }); +} +async function fetchAsBuffer(url, options) { + const response = await fetchUrlStream(url, options); + return new Promise((resolve, reject) => { + const chunks = []; + response.on(`data`, chunk => { + chunks.push(chunk); + }); + response.on(`error`, error => { + reject(error); + }); + response.on(`end`, () => { + resolve(Buffer.concat(chunks)); + }); + }); +} +async function fetchAsJson(url, options) { + const buffer = await fetchAsBuffer(url, options); + const asText = buffer.toString(); + try { + return JSON.parse(asText); + } + catch (error) { + const truncated = asText.length > 30 + ? `${asText.slice(0, 30)}...` + : asText; + throw new Error(`Couldn't parse JSON data: ${JSON.stringify(truncated)}`); + } +} + + +/***/ }), + +/***/ "./sources/miscUtils.ts": +/*!******************************!*\ + !*** ./sources/miscUtils.ts ***! + \******************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "Cancellation": () => (/* binding */ Cancellation) +/* harmony export */ }); +class Cancellation extends Error { + constructor() { + super(`Cancelled operation`); + } +} + + /***/ }), /***/ "./sources/semverUtils.ts": @@ -14447,7 +14447,7 @@ try { /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"definitions":{"npm":{"default":"7.20.1","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":"6.11.0","transparent":{"commands":[["pnpm","init"],["pnpx"]]},"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.11","transparent":{"default":"3.0.0","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":"7.20.1","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":"6.11.0","transparent":{"commands":[["pnpm","init"],["pnpx"]]},"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.15","transparent":{"default":"3.0.0","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"}}}}}}}'); /***/ }), @@ -14458,7 +14458,7 @@ module.exports = JSON.parse('{"definitions":{"npm":{"default":"7.20.1","transpar /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"corepack","version":"0.9.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","bin":{"corepack":"./dist/corepack.js","pnpm":"./dist/pnpm.js","pnpx":"./dist/pnpx.js","yarn":"./dist/yarn.js","yarnpkg":"./dist/yarnpkg.js"},"packageManager":"yarn@3.0.0","devDependencies":{"@babel/core":"^7.14.3","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-decorators":"^7.14.2","@babel/plugin-proposal-nullish-coalescing-operator":"^7.10.4","@babel/plugin-transform-modules-commonjs":"^7.14.0","@babel/preset-typescript":"^7.13.0","@types/debug":"^4.1.5","@types/jest":"^26.0.23","@types/node":"^13.9.2","@types/semver":"^7.1.0","@types/tar":"^4.0.3","@types/which":"^1.3.2","@typescript-eslint/eslint-plugin":"^2.0.0","@typescript-eslint/parser":"^4.2.0","@yarnpkg/eslint-config":"^0.1.0","@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":"^7.10.0","eslint-plugin-arca":"^0.9.5","jest":"^26.0.0","nock":"^13.0.4","semver":"^7.1.3","supports-color":"^7.1.0","tar":"^6.0.1","terser-webpack-plugin":"^5.1.2","ts-loader":"^8.0.2","ts-node":"^8.10.2","typescript":"^4.3.2","v8-compile-cache":"^2.3.0","webpack":"^5.38.1","webpack-cli":"^3.3.11","which":"^2.0.2"},"scripts":{"build":"rm -rf dist && webpack && ts-node ./mkshims.ts","corepack":"ts-node ./sources/main.ts","prepack":"node ./.yarn/releases/*.*js build","postpack":"rm -rf dist shims","test":"yarn jest"},"files":["dist","shims","LICENSE.md"],"publishConfig":{"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"]}}'); +module.exports = JSON.parse('{"name":"corepack","version":"0.10.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","bin":{"corepack":"./dist/corepack.js","pnpm":"./dist/pnpm.js","pnpx":"./dist/pnpx.js","yarn":"./dist/yarn.js","yarnpkg":"./dist/yarnpkg.js"},"packageManager":"yarn@3.0.0","devDependencies":{"@babel/core":"^7.14.3","@babel/plugin-proposal-class-properties":"^7.13.0","@babel/plugin-proposal-decorators":"^7.14.2","@babel/plugin-proposal-nullish-coalescing-operator":"^7.10.4","@babel/plugin-transform-modules-commonjs":"^7.14.0","@babel/preset-typescript":"^7.13.0","@types/debug":"^4.1.5","@types/jest":"^26.0.23","@types/node":"^13.9.2","@types/semver":"^7.1.0","@types/tar":"^4.0.3","@types/which":"^1.3.2","@typescript-eslint/eslint-plugin":"^2.0.0","@typescript-eslint/parser":"^4.2.0","@yarnpkg/eslint-config":"^0.1.0","@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":"^7.10.0","eslint-plugin-arca":"^0.9.5","jest":"^26.0.0","nock":"^13.0.4","semver":"^7.1.3","supports-color":"^7.1.0","tar":"^6.0.1","terser-webpack-plugin":"^5.1.2","ts-loader":"^8.0.2","ts-node":"^8.10.2","typescript":"^4.3.2","v8-compile-cache":"^2.3.0","webpack":"^5.38.1","webpack-cli":"^3.3.11","which":"^2.0.2"},"scripts":{"build":"rm -rf dist && webpack && ts-node ./mkshims.ts","corepack":"ts-node ./sources/main.ts","prepack":"node ./.yarn/releases/*.*js build","postpack":"rm -rf dist shims","test":"yarn jest"},"files":["dist","shims","LICENSE.md"],"publishConfig":{"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"]}}'); /***/ }), @@ -14733,7 +14733,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _commands_Hydrate__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./commands/Hydrate */ "./sources/commands/Hydrate.ts"); /* harmony import */ var _commands_Prepare__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./commands/Prepare */ "./sources/commands/Prepare.ts"); /* harmony import */ var _miscUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./miscUtils */ "./sources/miscUtils.ts"); -/* harmony import */ var _pmmUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./pmmUtils */ "./sources/pmmUtils.ts"); +/* harmony import */ var _corepackUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./corepackUtils */ "./sources/corepackUtils.ts"); /* harmony import */ var _specUtils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./specUtils */ "./sources/specUtils.ts"); @@ -14799,7 +14799,7 @@ async function executePackageManagerRequest({ packageManager, binaryName, binary if (resolved === null) throw new clipanion__WEBPACK_IMPORTED_MODULE_8__.UsageError(`Failed to successfully resolve '${descriptor.range}' to a valid ${descriptor.name} release`); const installSpec = await context.engine.ensurePackageManager(resolved); - const exitCode = await _pmmUtils__WEBPACK_IMPORTED_MODULE_6__.runVersion(installSpec, resolved, binaryName, args, context); + const exitCode = await _corepackUtils__WEBPACK_IMPORTED_MODULE_6__.runVersion(installSpec, resolved, binaryName, args, context); return exitCode; } async function main(argv, context) { diff --git a/deps/corepack/package.json b/deps/corepack/package.json index 4c5a5b8fc7c2ff..ee03538ae867f6 100644 --- a/deps/corepack/package.json +++ b/deps/corepack/package.json @@ -1,6 +1,6 @@ { "name": "corepack", - "version": "0.9.0", + "version": "0.10.0", "homepage": "https://github.com/nodejs/corepack#readme", "bugs": { "url": "https://github.com/nodejs/corepack/issues" diff --git a/deps/corepack/shims/corepack.cmd b/deps/corepack/shims/corepack.cmd old mode 100644 new mode 100755 diff --git a/deps/corepack/shims/corepack.ps1 b/deps/corepack/shims/corepack.ps1 old mode 100644 new mode 100755 diff --git a/deps/corepack/shims/npm.cmd b/deps/corepack/shims/npm.cmd old mode 100644 new mode 100755 diff --git a/deps/corepack/shims/npx.cmd b/deps/corepack/shims/npx.cmd old mode 100644 new mode 100755 diff --git a/deps/corepack/shims/pnpm.cmd b/deps/corepack/shims/pnpm.cmd old mode 100644 new mode 100755 diff --git a/deps/corepack/shims/pnpx.cmd b/deps/corepack/shims/pnpx.cmd old mode 100644 new mode 100755 diff --git a/deps/corepack/shims/yarn.cmd b/deps/corepack/shims/yarn.cmd old mode 100644 new mode 100755 diff --git a/deps/corepack/shims/yarnpkg.cmd b/deps/corepack/shims/yarnpkg.cmd old mode 100644 new mode 100755