Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't prune optional dependencies #8077

Draft
wants to merge 2 commits into
base: latest
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions workspaces/arborist/lib/arborist/build-ideal-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const { defaultLockfileVersion } = Shrinkwrap
const Node = require('../node.js')
const Link = require('../link.js')
const addRmPkgDeps = require('../add-rm-pkg-deps.js')
const optionalSet = require('../optional-set.js')
const { checkEngine, checkPlatform } = require('npm-install-checks')
const relpath = require('../relpath.js')
const resetDepFlags = require('../reset-dep-flags.js')
Expand Down Expand Up @@ -195,7 +194,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
await this.#applyUserRequests(options)
await this.#buildDeps()
await this.#fixDepFlags()
await this.#pruneFailedOptional()
await this.#throwFailure()
await this.#checkEngineAndPlatform()
} finally {
process.emit('timeEnd', 'idealTree')
Expand Down Expand Up @@ -1496,16 +1495,11 @@ This is a one-time fix-up, please be patient...
}
}

#pruneFailedOptional () {
#throwFailure () {
for (const node of this.#loadFailures) {
if (!node.optional) {
throw node.errors[0]
}

const set = optionalSet(node)
for (const node of set) {
node.parent = null
}
}
}
}
Loading