diff --git a/.changeset/tiny-foxes-roll.md b/.changeset/tiny-foxes-roll.md new file mode 100644 index 0000000000..16a706ea5d --- /dev/null +++ b/.changeset/tiny-foxes-roll.md @@ -0,0 +1,5 @@ +--- +"@pnpm/hoist": patch +--- + +Do not print a warning if a skipped optional dependency cannot be hoisted. diff --git a/packages/hoist/src/index.ts b/packages/hoist/src/index.ts index e1c64eeb91..1456bbdfa8 100644 --- a/packages/hoist/src/index.ts +++ b/packages/hoist/src/index.ts @@ -6,13 +6,15 @@ import { nameVerFromPkgSnapshot, } from '@pnpm/lockfile-utils' import lockfileWalker, { LockfileWalkerStep } from '@pnpm/lockfile-walker' -import logger, { globalWarn } from '@pnpm/logger' +import logger from '@pnpm/logger' import matcher from '@pnpm/matcher' import symlinkDependency from '@pnpm/symlink-dependency' import { HoistedDependencies } from '@pnpm/types' import * as dp from 'dependency-path' import * as R from 'ramda' +const hoistLogger = logger('hoist') + export default async function hoistByLockfile ( opts: { lockfile: Lockfile @@ -194,8 +196,8 @@ async function symlinkHoistedDependencies ( .map(async ([depPath, pkgAliases]) => { const pkgSnapshot = opts.lockfile.packages![depPath] if (!pkgSnapshot) { - globalWarn(`Failed to find "${depPath}" in lockfile during hoisting. ` + - `Next aliases will not be hoisted: ${Object.keys(pkgAliases).join(', ')}`) + // This dependency is probably a skipped optional dependency. + hoistLogger.debug({ hoistFailedFor: depPath }) return } const pkgName = nameVerFromPkgSnapshot(depPath, pkgSnapshot).name