@@ -21677,7 +21677,7 @@ function String2(descriptor, ...args) {
2167721677}
2167821678
2167921679// package.json
21680- var version = "0.34.2 ";
21680+ var version = "0.34.5 ";
2168121681
2168221682// sources/Engine.ts
2168321683var import_fs6 = __toESM(require("fs"));
@@ -21691,7 +21691,7 @@ var import_valid4 = __toESM(require_valid2());
2169121691var config_default = {
2169221692 definitions: {
2169321693 npm: {
21694- default: "11.6.2 +sha1.2af8ff1f23b279df1e5289db7c70cfedd0fe18c5 ",
21694+ default: "11.6.3 +sha1.3f581bca37cbdadf2be04346c0e5b0be96cdd54b ",
2169521695 fetchLatestFrom: {
2169621696 type: "npm",
2169721697 package: "npm"
@@ -21728,7 +21728,7 @@ var config_default = {
2172821728 }
2172921729 },
2173021730 pnpm: {
21731- default: "10.20 .0+sha1.a9bfe8cf88011d4758e1acbeb0da8883ecbd52ce ",
21731+ default: "10.23 .0+sha1.b4a44ab0dc2adf2e36371d11d8eb0dc78ffc976c ",
2173221732 fetchLatestFrom: {
2173321733 type: "npm",
2173421734 package: "pnpm"
@@ -21766,7 +21766,7 @@ var config_default = {
2176621766 ]
2176721767 }
2176821768 },
21769- ">=6.0.0 ": {
21769+ "6.x || 7.x || 8.x || 9.x || 10.x ": {
2177021770 url: "https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz",
2177121771 bin: {
2177221772 pnpm: "./bin/pnpm.cjs",
@@ -21782,6 +21782,23 @@ var config_default = {
2178221782 "install"
2178321783 ]
2178421784 }
21785+ },
21786+ ">=11.0.0": {
21787+ url: "https://registry.npmjs.org/pnpm/-/pnpm-{}.tgz",
21788+ bin: {
21789+ pnpm: "./bin/pnpm.mjs",
21790+ pnpx: "./bin/pnpx.mjs"
21791+ },
21792+ registry: {
21793+ type: "npm",
21794+ package: "pnpm"
21795+ },
21796+ commands: {
21797+ use: [
21798+ "pnpm",
21799+ "install"
21800+ ]
21801+ }
2178521802 }
2178621803 }
2178721804 },
@@ -21792,7 +21809,7 @@ var config_default = {
2179221809 package: "yarn"
2179321810 },
2179421811 transparent: {
21795- default: "4.10.3 +sha224.6020b3cdcdfbd7dbc24b7a7b75d58a249ce36068a8bf97d39aa8cc6d ",
21812+ default: "4.11.0 +sha224.209a3e277c6bbc03df6e4206fbfcb0c1621c27ecf0688f79a0c619f0 ",
2179621813 commands: [
2179721814 [
2179821815 "yarn",
@@ -22099,6 +22116,50 @@ async function getProxyAgent(input) {
2209922116 return new ProxyAgent(proxy);
2210022117}
2210122118
22119+ // sources/nodeUtils.ts
22120+ var import_os2 = __toESM(require("os"));
22121+ function isNodeError(err) {
22122+ return !!err?.code;
22123+ }
22124+ function isExistError(err) {
22125+ return err.code === `EEXIST` || err.code === `ENOTEMPTY`;
22126+ }
22127+ function getEndOfLine(content) {
22128+ const matches = content.match(/\r?\n/g);
22129+ if (matches === null)
22130+ return import_os2.default.EOL;
22131+ const crlf = matches.filter((nl) => nl === `\r
22132+ `).length;
22133+ const lf = matches.length - crlf;
22134+ return crlf > lf ? `\r
22135+ ` : `
22136+ `;
22137+ }
22138+ function normalizeLineEndings(originalContent, newContent) {
22139+ return newContent.replace(/\r?\n/g, getEndOfLine(originalContent));
22140+ }
22141+ function getIndent(content) {
22142+ const indentMatch = content.match(/^[ \t]+/m);
22143+ if (indentMatch) {
22144+ return indentMatch[0];
22145+ } else {
22146+ return ` `;
22147+ }
22148+ }
22149+ function stripBOM(content) {
22150+ if (content.charCodeAt(0) === 65279) {
22151+ return content.slice(1);
22152+ } else {
22153+ return content;
22154+ }
22155+ }
22156+ function readPackageJson(content) {
22157+ return {
22158+ data: JSON.parse(stripBOM(content) || `{}`),
22159+ indent: getIndent(content)
22160+ };
22161+ }
22162+
2210222163// sources/corepackUtils.ts
2210322164var YARN_SWITCH_REGEX = /[/\\]switch[/\\]bin[/\\]/;
2210422165function isYarnSwitchPath(p) {
@@ -22156,7 +22217,7 @@ async function findInstalledVersion(installTarget, descriptor) {
2215622217 try {
2215722218 cacheDirectory = await import_fs4.default.promises.opendir(installFolder);
2215822219 } catch (error) {
22159- if (error.code === `ENOENT`) {
22220+ if (isNodeError(error) && error.code === `ENOENT`) {
2216022221 return null;
2216122222 } else {
2216222223 throw error;
@@ -22228,9 +22289,13 @@ async function download(installTarget, url, algo, binPath = null) {
2222822289 try {
2222922290 await renameSafe(downloadedBin, outputFile);
2223022291 } catch (err) {
22231- if (err? .code === `ENOENT`)
22292+ if (isNodeError( err) && err .code === `ENOENT`)
2223222293 throw new Error(`Cannot locate '${binPath}' in downloaded tarball`, { cause: err });
22233- throw err;
22294+ if (isNodeError(err) && isExistError(err)) {
22295+ await import_fs4.default.promises.rm(downloadedBin);
22296+ } else {
22297+ throw err;
22298+ }
2223422299 }
2223522300 const fileStream = import_fs4.default.createReadStream(outputFile);
2223622301 hash = fileStream.pipe((0, import_crypto2.createHash)(algo));
@@ -22258,7 +22323,7 @@ async function installVersion(installTarget, locator, { spec }) {
2225822323 bin: corepackData.bin
2225922324 };
2226022325 } catch (err) {
22261- if (err? .code !== `ENOENT`) {
22326+ if (isNodeError( err) && err .code !== `ENOENT`) {
2226222327 throw err;
2226322328 }
2226422329 }
@@ -22336,8 +22401,8 @@ async function installVersion(installTarget, locator, { spec }) {
2233622401 try {
2233722402 await renameSafe(tmpFolder, installFolder);
2233822403 } 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()) {
22404+ if (isNodeError( err) && (isExistError(err) || // On Windows the error code is EPERM so we check if it is a directory
22405+ err.code === `EPERM` && (await import_fs4.default.promises.stat(installFolder)).isDirectory())) {
2234122406 log(`Another instance of corepack installed ${locator.name}@${locator.reference}`);
2234222407 await import_fs4.default.promises.rm(tmpFolder, { recursive: true, force: true });
2234322408 } else {
@@ -22376,7 +22441,7 @@ async function renameUnderWindows(oldPath, newPath) {
2237622441 await import_fs4.default.promises.rename(oldPath, newPath);
2237722442 break;
2237822443 } catch (err) {
22379- if ((err.code === `ENOENT` || err.code === `EPERM`) && i < retries - 1) {
22444+ if (isNodeError(err) && (err.code === `ENOENT` || err.code === `EPERM`) && i < retries - 1) {
2238022445 await (0, import_promises2.setTimeout)(100 * 2 ** i);
2238122446 continue;
2238222447 } else {
@@ -22467,44 +22532,6 @@ var import_valid = __toESM(require_valid());
2246722532var import_valid2 = __toESM(require_valid2());
2246822533var import_util = require("util");
2246922534
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-
2250822535// sources/types.ts
2250922536var SupportedPackageManagers = /* @__PURE__ */ ((SupportedPackageManagers3) => {
2251022537 SupportedPackageManagers3["Npm"] = `npm`;
@@ -22691,7 +22718,7 @@ async function loadSpec(initialCwd) {
2269122718 onFail: selection.data.devEngines.packageManager.onFail
2269222719 },
2269322720 // 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))
22721+ getSpec: ({ enforceExactVersion = true } = {} ) => parseSpec(rawPmSpec, import_path4.default.relative(initialCwd, selection.manifestPath), { enforceExactVersion } )
2269522722 };
2269622723}
2269722724
@@ -22874,7 +22901,7 @@ var Engine = class {
2287422901 * project using the default package managers, and configure it so that we
2287522902 * don't need to ask again in the future.
2287622903 */
22877- async findProjectSpec(initialCwd, locator, { transparent = false } = {}) {
22904+ async findProjectSpec(initialCwd, locator, { transparent = false, binaryVersion } = {}) {
2287822905 const fallbackDescriptor = { name: locator.name, range: `${locator.reference}` };
2287922906 if (import_process3.default.env.COREPACK_ENABLE_PROJECT_SPEC === `0`) {
2288022907 if (typeof locator.reference === `function`)
@@ -22909,7 +22936,7 @@ var Engine = class {
2290922936 return fallbackDescriptor;
2291022937 }
2291122938 case `Found`: {
22912- const spec = result.getSpec();
22939+ const spec = result.getSpec({ enforceExactVersion: !binaryVersion } );
2291322940 if (spec.name !== locator.name) {
2291422941 if (transparent) {
2291522942 if (typeof locator.reference === `function`)
@@ -22948,7 +22975,7 @@ var Engine = class {
2294822975 reference: fallbackReference
2294922976 };
2295022977 }
22951- const descriptor = await this.findProjectSpec(cwd, fallbackLocator, { transparent: isTransparentCommand });
22978+ const descriptor = await this.findProjectSpec(cwd, fallbackLocator, { transparent: isTransparentCommand, binaryVersion });
2295222979 if (binaryVersion)
2295322980 descriptor.range = binaryVersion;
2295422981 const resolved = await this.resolveDescriptor(descriptor, { allowTags: true });
@@ -23148,17 +23175,19 @@ var EnableCommand = class extends Command {
2314823175 async generatePosixLink(installDirectory, distFolder, binName) {
2314923176 const file = import_path7.default.join(installDirectory, binName);
2315023177 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;
23178+ const stats = import_fs9.default.lstatSync(file, { throwIfNoEntry: false });
23179+ if (stats) {
23180+ if (stats.isSymbolicLink()) {
23181+ const currentSymlink = await import_fs9.default.promises.readlink(file);
23182+ if (binName.includes(`yarn`) && isYarnSwitchPath(await import_fs9.default.promises.realpath(file))) {
23183+ console.warn(`${binName} is already installed in ${file} and points to a Yarn Switch install - skipping`);
23184+ return;
23185+ }
23186+ if (currentSymlink === symlink) {
23187+ return;
23188+ }
2316123189 }
23190+ await import_fs9.default.promises.unlink(file);
2316223191 }
2316323192 await import_fs9.default.promises.symlink(symlink, file);
2316423193 }
0 commit comments