Skip to content

Commit 3f704ed

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update corepack to 0.34.4
PR-URL: #60643 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 04e360f commit 3f704ed

File tree

3 files changed

+93
-64
lines changed

3 files changed

+93
-64
lines changed

deps/corepack/CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
## [0.34.4](https://github.com/nodejs/corepack/compare/v0.34.3...v0.34.4) (2025-11-14)
4+
5+
6+
### Bug Fixes
7+
8+
* bump pnpm version in `config.json` ([#768](https://github.com/nodejs/corepack/issues/768)) ([99a9a6e](https://github.com/nodejs/corepack/commit/99a9a6eb1b6e918ceb896b3d558bb5ed583bdc70))
9+
* ignore devEngines version range when CLI provides a version ([#762](https://github.com/nodejs/corepack/issues/762)) ([ac518c4](https://github.com/nodejs/corepack/commit/ac518c4106f8d9ceb4e85e6c3614b1eba5d03fcb))
10+
* use `lstatSync` in `generatePosixLink` ([#767](https://github.com/nodejs/corepack/issues/767)) ([a02bea0](https://github.com/nodejs/corepack/commit/a02bea078eb584ed7492ec561626987e35386bae))
11+
12+
## [0.34.3](https://github.com/nodejs/corepack/compare/v0.34.2...v0.34.3) (2025-11-07)
13+
14+
15+
### Bug Fixes
16+
17+
* update package manager versions ([#765](https://github.com/nodejs/corepack/issues/765)) ([13a2e98](https://github.com/nodejs/corepack/commit/13a2e989ee37694a7ec1b1d60acdaa28f90642d1))
18+
* Yarn switch install support and tests ([#761](https://github.com/nodejs/corepack/issues/761)) ([d04d483](https://github.com/nodejs/corepack/commit/d04d4839aeecaf4fca989c577f6c000dc90be933))
19+
320
## [0.34.2](https://github.com/nodejs/corepack/compare/v0.34.1...v0.34.2) (2025-10-31)
421

522

deps/corepack/dist/lib/corepack.cjs

Lines changed: 74 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -21677,7 +21677,7 @@ function String2(descriptor, ...args) {
2167721677
}
2167821678

2167921679
// package.json
21680-
var version = "0.34.2";
21680+
var version = "0.34.4";
2168121681

2168221682
// sources/Engine.ts
2168321683
var import_fs6 = __toESM(require("fs"));
@@ -21728,7 +21728,7 @@ var config_default = {
2172821728
}
2172921729
},
2173021730
pnpm: {
21731-
default: "10.20.0+sha1.a9bfe8cf88011d4758e1acbeb0da8883ecbd52ce",
21731+
default: "10.22.0+sha1.3e9e4d522d30f3cf4cabb7506f5d15b89feffd04",
2173221732
fetchLatestFrom: {
2173321733
type: "npm",
2173421734
package: "pnpm"
@@ -21792,7 +21792,7 @@ var config_default = {
2179221792
package: "yarn"
2179321793
},
2179421794
transparent: {
21795-
default: "4.10.3+sha224.6020b3cdcdfbd7dbc24b7a7b75d58a249ce36068a8bf97d39aa8cc6d",
21795+
default: "4.11.0+sha224.209a3e277c6bbc03df6e4206fbfcb0c1621c27ecf0688f79a0c619f0",
2179621796
commands: [
2179721797
[
2179821798
"yarn",
@@ -22099,6 +22099,50 @@ async function getProxyAgent(input) {
2209922099
return new ProxyAgent(proxy);
2210022100
}
2210122101

22102+
// sources/nodeUtils.ts
22103+
var import_os2 = __toESM(require("os"));
22104+
function isNodeError(err) {
22105+
return !!err?.code;
22106+
}
22107+
function isExistError(err) {
22108+
return err.code === `EEXIST` || err.code === `ENOTEMPTY`;
22109+
}
22110+
function getEndOfLine(content) {
22111+
const matches = content.match(/\r?\n/g);
22112+
if (matches === null)
22113+
return import_os2.default.EOL;
22114+
const crlf = matches.filter((nl) => nl === `\r
22115+
`).length;
22116+
const lf = matches.length - crlf;
22117+
return crlf > lf ? `\r
22118+
` : `
22119+
`;
22120+
}
22121+
function normalizeLineEndings(originalContent, newContent) {
22122+
return newContent.replace(/\r?\n/g, getEndOfLine(originalContent));
22123+
}
22124+
function getIndent(content) {
22125+
const indentMatch = content.match(/^[ \t]+/m);
22126+
if (indentMatch) {
22127+
return indentMatch[0];
22128+
} else {
22129+
return ` `;
22130+
}
22131+
}
22132+
function stripBOM(content) {
22133+
if (content.charCodeAt(0) === 65279) {
22134+
return content.slice(1);
22135+
} else {
22136+
return content;
22137+
}
22138+
}
22139+
function readPackageJson(content) {
22140+
return {
22141+
data: JSON.parse(stripBOM(content) || `{}`),
22142+
indent: getIndent(content)
22143+
};
22144+
}
22145+
2210222146
// sources/corepackUtils.ts
2210322147
var YARN_SWITCH_REGEX = /[/\\]switch[/\\]bin[/\\]/;
2210422148
function isYarnSwitchPath(p) {
@@ -22156,7 +22200,7 @@ async function findInstalledVersion(installTarget, descriptor) {
2215622200
try {
2215722201
cacheDirectory = await import_fs4.default.promises.opendir(installFolder);
2215822202
} catch (error) {
22159-
if (error.code === `ENOENT`) {
22203+
if (isNodeError(error) && error.code === `ENOENT`) {
2216022204
return null;
2216122205
} else {
2216222206
throw error;
@@ -22228,9 +22272,13 @@ async function download(installTarget, url, algo, binPath = null) {
2222822272
try {
2222922273
await renameSafe(downloadedBin, outputFile);
2223022274
} catch (err) {
22231-
if (err?.code === `ENOENT`)
22275+
if (isNodeError(err) && err.code === `ENOENT`)
2223222276
throw new Error(`Cannot locate '${binPath}' in downloaded tarball`, { cause: err });
22233-
throw err;
22277+
if (isNodeError(err) && isExistError(err)) {
22278+
await import_fs4.default.promises.rm(downloadedBin);
22279+
} else {
22280+
throw err;
22281+
}
2223422282
}
2223522283
const fileStream = import_fs4.default.createReadStream(outputFile);
2223622284
hash = fileStream.pipe((0, import_crypto2.createHash)(algo));
@@ -22258,7 +22306,7 @@ async function installVersion(installTarget, locator, { spec }) {
2225822306
bin: corepackData.bin
2225922307
};
2226022308
} catch (err) {
22261-
if (err?.code !== `ENOENT`) {
22309+
if (isNodeError(err) && err.code !== `ENOENT`) {
2226222310
throw err;
2226322311
}
2226422312
}
@@ -22336,8 +22384,8 @@ async function installVersion(installTarget, locator, { spec }) {
2233622384
try {
2233722385
await renameSafe(tmpFolder, installFolder);
2233822386
} catch (err) {
22339-
if (err.code === `ENOTEMPTY` || // On Windows the error code is EPERM so we check if it is a directory
22340-
err.code === `EPERM` && (await import_fs4.default.promises.stat(installFolder)).isDirectory()) {
22387+
if (isNodeError(err) && (isExistError(err) || // On Windows the error code is EPERM so we check if it is a directory
22388+
err.code === `EPERM` && (await import_fs4.default.promises.stat(installFolder)).isDirectory())) {
2234122389
log(`Another instance of corepack installed ${locator.name}@${locator.reference}`);
2234222390
await import_fs4.default.promises.rm(tmpFolder, { recursive: true, force: true });
2234322391
} else {
@@ -22376,7 +22424,7 @@ async function renameUnderWindows(oldPath, newPath) {
2237622424
await import_fs4.default.promises.rename(oldPath, newPath);
2237722425
break;
2237822426
} catch (err) {
22379-
if ((err.code === `ENOENT` || err.code === `EPERM`) && i < retries - 1) {
22427+
if (isNodeError(err) && (err.code === `ENOENT` || err.code === `EPERM`) && i < retries - 1) {
2238022428
await (0, import_promises2.setTimeout)(100 * 2 ** i);
2238122429
continue;
2238222430
} else {
@@ -22467,44 +22515,6 @@ var import_valid = __toESM(require_valid());
2246722515
var import_valid2 = __toESM(require_valid2());
2246822516
var import_util = require("util");
2246922517

22470-
// sources/nodeUtils.ts
22471-
var import_os2 = __toESM(require("os"));
22472-
function getEndOfLine(content) {
22473-
const matches = content.match(/\r?\n/g);
22474-
if (matches === null)
22475-
return import_os2.default.EOL;
22476-
const crlf = matches.filter((nl) => nl === `\r
22477-
`).length;
22478-
const lf = matches.length - crlf;
22479-
return crlf > lf ? `\r
22480-
` : `
22481-
`;
22482-
}
22483-
function normalizeLineEndings(originalContent, newContent) {
22484-
return newContent.replace(/\r?\n/g, getEndOfLine(originalContent));
22485-
}
22486-
function getIndent(content) {
22487-
const indentMatch = content.match(/^[ \t]+/m);
22488-
if (indentMatch) {
22489-
return indentMatch[0];
22490-
} else {
22491-
return ` `;
22492-
}
22493-
}
22494-
function stripBOM(content) {
22495-
if (content.charCodeAt(0) === 65279) {
22496-
return content.slice(1);
22497-
} else {
22498-
return content;
22499-
}
22500-
}
22501-
function readPackageJson(content) {
22502-
return {
22503-
data: JSON.parse(stripBOM(content) || `{}`),
22504-
indent: getIndent(content)
22505-
};
22506-
}
22507-
2250822518
// sources/types.ts
2250922519
var SupportedPackageManagers = /* @__PURE__ */ ((SupportedPackageManagers3) => {
2251022520
SupportedPackageManagers3["Npm"] = `npm`;
@@ -22691,7 +22701,7 @@ async function loadSpec(initialCwd) {
2269122701
onFail: selection.data.devEngines.packageManager.onFail
2269222702
},
2269322703
// Lazy-loading it so we do not throw errors on commands that do not need valid spec.
22694-
getSpec: () => parseSpec(rawPmSpec, import_path4.default.relative(initialCwd, selection.manifestPath))
22704+
getSpec: ({ enforceExactVersion = true } = {}) => parseSpec(rawPmSpec, import_path4.default.relative(initialCwd, selection.manifestPath), { enforceExactVersion })
2269522705
};
2269622706
}
2269722707

@@ -22874,7 +22884,7 @@ var Engine = class {
2287422884
* project using the default package managers, and configure it so that we
2287522885
* don't need to ask again in the future.
2287622886
*/
22877-
async findProjectSpec(initialCwd, locator, { transparent = false } = {}) {
22887+
async findProjectSpec(initialCwd, locator, { transparent = false, binaryVersion } = {}) {
2287822888
const fallbackDescriptor = { name: locator.name, range: `${locator.reference}` };
2287922889
if (import_process3.default.env.COREPACK_ENABLE_PROJECT_SPEC === `0`) {
2288022890
if (typeof locator.reference === `function`)
@@ -22909,7 +22919,7 @@ var Engine = class {
2290922919
return fallbackDescriptor;
2291022920
}
2291122921
case `Found`: {
22912-
const spec = result.getSpec();
22922+
const spec = result.getSpec({ enforceExactVersion: !binaryVersion });
2291322923
if (spec.name !== locator.name) {
2291422924
if (transparent) {
2291522925
if (typeof locator.reference === `function`)
@@ -22948,7 +22958,7 @@ var Engine = class {
2294822958
reference: fallbackReference
2294922959
};
2295022960
}
22951-
const descriptor = await this.findProjectSpec(cwd, fallbackLocator, { transparent: isTransparentCommand });
22961+
const descriptor = await this.findProjectSpec(cwd, fallbackLocator, { transparent: isTransparentCommand, binaryVersion });
2295222962
if (binaryVersion)
2295322963
descriptor.range = binaryVersion;
2295422964
const resolved = await this.resolveDescriptor(descriptor, { allowTags: true });
@@ -23148,17 +23158,19 @@ var EnableCommand = class extends Command {
2314823158
async generatePosixLink(installDirectory, distFolder, binName) {
2314923159
const file = import_path7.default.join(installDirectory, binName);
2315023160
const symlink = import_path7.default.relative(installDirectory, import_path7.default.join(distFolder, `${binName}.js`));
23151-
if (import_fs9.default.existsSync(file)) {
23152-
const currentSymlink = await import_fs9.default.promises.readlink(file);
23153-
if (binName.includes(`yarn`) && isYarnSwitchPath(await import_fs9.default.promises.realpath(file))) {
23154-
console.warn(`${binName} is already installed in ${file} and points to a Yarn Switch install - skipping`);
23155-
return;
23156-
}
23157-
if (currentSymlink !== symlink) {
23158-
await import_fs9.default.promises.unlink(file);
23159-
} else {
23160-
return;
23161+
const stats = import_fs9.default.lstatSync(file, { throwIfNoEntry: false });
23162+
if (stats) {
23163+
if (stats.isSymbolicLink()) {
23164+
const currentSymlink = await import_fs9.default.promises.readlink(file);
23165+
if (binName.includes(`yarn`) && isYarnSwitchPath(await import_fs9.default.promises.realpath(file))) {
23166+
console.warn(`${binName} is already installed in ${file} and points to a Yarn Switch install - skipping`);
23167+
return;
23168+
}
23169+
if (currentSymlink === symlink) {
23170+
return;
23171+
}
2316123172
}
23173+
await import_fs9.default.promises.unlink(file);
2316223174
}
2316323175
await import_fs9.default.promises.symlink(symlink, file);
2316423176
}

deps/corepack/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "corepack",
3-
"version": "0.34.2",
3+
"version": "0.34.4",
44
"homepage": "https://github.com/nodejs/corepack#readme",
55
"bugs": {
66
"url": "https://github.com/nodejs/corepack/issues"
@@ -16,7 +16,7 @@
1616
"./package.json": "./package.json"
1717
},
1818
"license": "MIT",
19-
"packageManager": "yarn@4.10.3+sha224.6020b3cdcdfbd7dbc24b7a7b75d58a249ce36068a8bf97d39aa8cc6d",
19+
"packageManager": "yarn@4.11.0+sha224.209a3e277c6bbc03df6e4206fbfcb0c1621c27ecf0688f79a0c619f0",
2020
"devDependencies": {
2121
"@types/debug": "^4.1.5",
2222
"@types/node": "^20.4.6",

0 commit comments

Comments
 (0)