Repository: nodejs/node
Pull request: deps: update corepack to 0.34.4

This is an automated update of corepack to 0.34.4.

Changed files:
filename: deps/corepack/CHANGELOG.md
patch: @@ -1,5 +1,22 @@
 # Changelog
 
+## [0.34.4](https://github.com/nodejs/corepack/compare/v0.34.3...v0.34.4) (2025-11-14)
+
+
+### Bug Fixes
+
+* bump pnpm version in `config.json` ([#768](https://github.com/nodejs/corepack/issues/768)) ([99a9a6e](https://github.com/nodejs/corepack/commit/99a9a6eb1b6e918ceb896b3d558bb5ed583bdc70))
+* 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))
+* use `lstatSync` in `generatePosixLink` ([#767](https://github.com/nodejs/corepack/issues/767)) ([a02bea0](https://github.com/nodejs/corepack/commit/a02bea078eb584ed7492ec561626987e35386bae))
+
+## [0.34.3](https://github.com/nodejs/corepack/compare/v0.34.2...v0.34.3) (2025-11-07)
+
+
+### Bug Fixes
+
+* update package manager versions ([#765](https://github.com/nodejs/corepack/issues/765)) ([13a2e98](https://github.com/nodejs/corepack/commit/13a2e989ee37694a7ec1b1d60acdaa28f90642d1))
+* Yarn switch install support and tests ([#761](https://github.com/nodejs/corepack/issues/761)) ([d04d483](https://github.com/nodejs/corepack/commit/d04d4839aeecaf4fca989c577f6c000dc90be933))
+
 ## [0.34.2](https://github.com/nodejs/corepack/compare/v0.34.1...v0.34.2) (2025-10-31)
 
 

filename: deps/corepack/dist/lib/corepack.cjs
patch: @@ -21677,7 +21677,7 @@ function String2(descriptor, ...args) {
 }
 
 // package.json
-var version = "0.34.2";
+var version = "0.34.4";
 
 // sources/Engine.ts
 var import_fs6 = __toESM(require("fs"));
@@ -21728,7 +21728,7 @@ var config_default = {
       }
     },
     pnpm: {
-      default: "10.20.0+sha1.a9bfe8cf88011d4758e1acbeb0da8883ecbd52ce",
+      default: "10.22.0+sha1.3e9e4d522d30f3cf4cabb7506f5d15b89feffd04",
       fetchLatestFrom: {
         type: "npm",
         package: "pnpm"
@@ -21792,7 +21792,7 @@ var config_default = {
         package: "yarn"
       },
       transparent: {
-        default: "4.10.3+sha224.6020b3cdcdfbd7dbc24b7a7b75d58a249ce36068a8bf97d39aa8cc6d",
+        default: "4.11.0+sha224.209a3e277c6bbc03df6e4206fbfcb0c1621c27ecf0688f79a0c619f0",
         commands: [
           [
             "yarn",
@@ -22099,6 +22099,50 @@ async function getProxyAgent(input) {
   return new ProxyAgent(proxy);
 }
 
+// sources/nodeUtils.ts
+var import_os2 = __toESM(require("os"));
+function isNodeError(err) {
+  return !!err?.code;
+}
+function isExistError(err) {
+  return err.code === `EEXIST` || err.code === `ENOTEMPTY`;
+}
+function getEndOfLine(content) {
+  const matches = content.match(/\r?\n/g);
+  if (matches === null)
+    return import_os2.default.EOL;
+  const crlf = matches.filter((nl) => nl === `\r
+`).length;
+  const lf = matches.length - crlf;
+  return crlf > lf ? `\r
+` : `
+`;
+}
+function normalizeLineEndings(originalContent, newContent) {
+  return newContent.replace(/\r?\n/g, getEndOfLine(originalContent));
+}
+function getIndent(content) {
+  const indentMatch = content.match(/^[ \t]+/m);
+  if (indentMatch) {
+    return indentMatch[0];
+  } else {
+    return `  `;
+  }
+}
+function stripBOM(content) {
+  if (content.charCodeAt(0) === 65279) {
+    return content.slice(1);
+  } else {
+    return content;
+  }
+}
+function readPackageJson(content) {
+  return {
+    data: JSON.parse(stripBOM(content) || `{}`),
+    indent: getIndent(content)
+  };
+}
+
 // sources/corepackUtils.ts
 var YARN_SWITCH_REGEX = /[/\\]switch[/\\]bin[/\\]/;
 function isYarnSwitchPath(p) {
@@ -22156,7 +22200,7 @@ async function findInstalledVersion(installTarget, descriptor) {
   try {
     cacheDirectory = await import_fs4.default.promises.opendir(installFolder);
   } catch (error) {
-    if (error.code === `ENOENT`) {
+    if (isNodeError(error) && error.code === `ENOENT`) {
       return null;
     } else {
       throw error;
@@ -22228,9 +22272,13 @@ async function download(installTarget, url, algo, binPath = null) {
     try {
       await renameSafe(downloadedBin, outputFile);
     } catch (err) {
-      if (err?.code === `ENOENT`)
+      if (isNodeError(err) && err.code === `ENOENT`)
         throw new Error(`Cannot locate '${binPath}' in downloaded tarball`, { cause: err });
-      throw err;
+      if (isNodeError(err) && isExistError(err)) {
+        await import_fs4.default.promises.rm(downloadedBin);
+      } else {
+        throw err;
+      }
     }
     const fileStream = import_fs4.default.createReadStream(outputFile);
     hash = fileStream.pipe((0, import_crypto2.createHash)(algo));
@@ -22258,7 +22306,7 @@ async function installVersion(installTarget, locator, { spec }) {
       bin: corepackData.bin
     };
   } catch (err) {
-    if (err?.code !== `ENOENT`) {
+    if (isNodeError(err) && err.code !== `ENOENT`) {
       throw err;
     }
   }
@@ -22336,8 +22384,8 @@ async function installVersion(installTarget, locator, { spec }) {
   try {
     await renameSafe(tmpFolder, installFolder);
   } catch (err) {
-    if (err.code === `ENOTEMPTY` || // On Windows the error code is EPERM so we check if it is a directory
-    err.code === `EPERM` && (await import_fs4.default.promises.stat(installFolder)).isDirectory()) {
+    if (isNodeError(err) && (isExistError(err) || // On Windows the error code is EPERM so we check if it is a directory
+    err.code === `EPERM` && (await import_fs4.default.promises.stat(installFolder)).isDirectory())) {
       log(`Another instance of corepack installed ${locator.name}@${locator.reference}`);
       await import_fs4.default.promises.rm(tmpFolder, { recursive: true, force: true });
     } else {
@@ -22376,7 +22424,7 @@ async function renameUnderWindows(oldPath, newPath) {
       await import_fs4.default.promises.rename(oldPath, newPath);
       break;
     } catch (err) {
-      if ((err.code === `ENOENT` || err.code === `EPERM`) && i < retries - 1) {
+      if (isNodeError(err) && (err.code === `ENOENT` || err.code === `EPERM`) && i < retries - 1) {
         await (0, import_promises2.setTimeout)(100 * 2 ** i);
         continue;
       } else {
@@ -22467,44 +22515,6 @@ var import_valid = __toESM(require_valid());
 var import_valid2 = __toESM(require_valid2());
 var import_util = require("util");
 
-// sources/nodeUtils.ts
-var import_os2 = __toESM(require("os"));
-function getEndOfLine(content) {
-  const matches = content.match(/\r?\n/g);
-  if (matches === null)
-    return import_os2.default.EOL;
-  const crlf = matches.filter((nl) => nl === `\r
-`).length;
-  const lf = matches.length - crlf;
-  return crlf > lf ? `\r
-` : `
-`;
-}
-function normalizeLineEndings(originalContent, newContent) {
-  return newContent.replace(/\r?\n/g, getEndOfLine(originalContent));
-}
-function getIndent(content) {
-  const indentMatch = content.match(/^[ \t]+/m);
-  if (indentMatch) {
-    return indentMatch[0];
-  } else {
-    return `  `;
-  }
-}
-function stripBOM(content) {
-  if (content.charCodeAt(0) === 65279) {
-    return content.slice(1);
-  } else {
-    return content;
-  }
-}
-function readPackageJson(content) {
-  return {
-    data: JSON.parse(stripBOM(content) || `{}`),
-    indent: getIndent(content)
-  };
-}
-
 // sources/types.ts
 var SupportedPackageManagers = /* @__PURE__ */ ((SupportedPackageManagers3) => {
   SupportedPackageManagers3["Npm"] = `npm`;
@@ -22691,7 +22701,7 @@ async function loadSpec(initialCwd) {
       onFail: selection.data.devEngines.packageManager.onFail
     },
     // Lazy-loading it so we do not throw errors on commands that do not need valid spec.
-    getSpec: () => parseSpec(rawPmSpec, import_path4.default.relative(initialCwd, selection.manifestPath))
+    getSpec: ({ enforceExactVersion = true } = {}) => parseSpec(rawPmSpec, import_path4.default.relative(initialCwd, selection.manifestPath), { enforceExactVersion })
   };
 }
 
@@ -22874,7 +22884,7 @@ var Engine = class {
    * project using the default package managers, and configure it so that we
    * don't need to ask again in the future.
    */
-  async findProjectSpec(initialCwd, locator, { transparent = false } = {}) {
+  async findProjectSpec(initialCwd, locator, { transparent = false, binaryVersion } = {}) {
     const fallbackDescriptor = { name: locator.name, range: `${locator.reference}` };
     if (import_process3.default.env.COREPACK_ENABLE_PROJECT_SPEC === `0`) {
       if (typeof locator.reference === `function`)
@@ -22909,7 +22919,7 @@ var Engine = class {
           return fallbackDescriptor;
         }
         case `Found`: {
-          const spec = result.getSpec();
+          const spec = result.getSpec({ enforceExactVersion: !binaryVersion });
           if (spec.name !== locator.name) {
             if (transparent) {
               if (typeof locator.reference === `function`)
@@ -22948,7 +22958,7 @@ var Engine = class {
         reference: fallbackReference
       };
     }
-    const descriptor = await this.findProjectSpec(cwd, fallbackLocator, { transparent: isTransparentCommand });
+    const descriptor = await this.findProjectSpec(cwd, fallbackLocator, { transparent: isTransparentCommand, binaryVersion });
     if (binaryVersion)
       descriptor.range = binaryVersion;
     const resolved = await this.resolveDescriptor(descriptor, { allowTags: true });
@@ -23148,17 +23158,19 @@ var EnableCommand = class extends Command {
   async generatePosixLink(installDirectory, distFolder, binName) {
     const file = import_path7.default.join(installDirectory, binName);
     const symlink = import_path7.default.relative(installDirectory, import_path7.default.join(distFolder, `${binName}.js`));
-    if (import_fs9.default.existsSync(file)) {
-      const currentSymlink = await import_fs9.default.promises.readlink(file);
-      if (binName.includes(`yarn`) && isYarnSwitchPath(await import_fs9.default.promises.realpath(file))) {
-        console.warn(`${binName} is already installed in ${file} and points to a Yarn Switch install - skipping`);
-        return;
-      }
-      if (currentSymlink !== symlink) {
-        await import_fs9.default.promises.unlink(file);
-      } else {
-        return;
+    const stats = import_fs9.default.lstatSync(file, { throwIfNoEntry: false });
+    if (stats) {
+      if (stats.isSymbolicLink()) {
+        const currentSymlink = await import_fs9.default.promises.readlink(file);
+        if (binName.includes(`yarn`) && isYarnSwitchPath(await import_fs9.default.promises.realpath(file))) {
+          console.warn(`${binName} is already installed in ${file} and points to a Yarn Switch install - skipping`);
+          return;
+        }
+        if (currentSymlink === symlink) {
+          return;
+        }
       }
+      await import_fs9.default.promises.unlink(file);
     }
     await import_fs9.default.promises.symlink(symlink, file);
   }

filename: deps/corepack/package.json
patch: @@ -1,6 +1,6 @@
 {
   "name": "corepack",
-  "version": "0.34.2",
+  "version": "0.34.4",
   "homepage": "https://github.com/nodejs/corepack#readme",
   "bugs": {
     "url": "https://github.com/nodejs/corepack/issues"
@@ -16,7 +16,7 @@
     "./package.json": "./package.json"
   },
   "license": "MIT",
-  "packageManager": "yarn@4.10.3+sha224.6020b3cdcdfbd7dbc24b7a7b75d58a249ce36068a8bf97d39aa8cc6d",
+  "packageManager": "yarn@4.11.0+sha224.209a3e277c6bbc03df6e4206fbfcb0c1621c27ecf0688f79a0c619f0",
   "devDependencies": {
     "@types/debug": "^4.1.5",
     "@types/node": "^20.4.6",