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

fix(arborist): node.target can be null when it is a file dep or symlink #7027

Merged
merged 8 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion workspaces/arborist/lib/arborist/load-actual.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ module.exports = cls => class ActualLoader extends cls {

async #loadFSTree (node) {
const did = this.#actualTreeLoaded
if (!did.has(node.target.realpath)) {
if (!node.isLink && !did.has(node.target.realpath)) {
did.add(node.target.realpath)
await this.#loadFSChildren(node.target)
return Promise.all(
Expand Down
3 changes: 3 additions & 0 deletions workspaces/arborist/test/arborist/reify.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ const newArb = (opt) => new Arborist({

const reify = (path, opt) => newArb({ path, ...(opt || {}) }).reify(opt)

t.test('ljharb file dep', t =>
t.resolveMatchSnapshot(printReified(fixture(t, 'file-dep'))))

t.test('tarball deps with transitive tarball deps', t =>
t.resolveMatchSnapshot(printReified(fixture(t, 'tarball-dependencies'))))

Expand Down
9 changes: 9 additions & 0 deletions workspaces/arborist/test/fixtures/file-dep/fake/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"bundleDependencies": true,
"dependencies": {
"abbrev": "2.0.0"
},
"devDependencies": {
"has-package-exports": "file:."
lukekarrys marked this conversation as resolved.
Show resolved Hide resolved
}
}
6 changes: 6 additions & 0 deletions workspaces/arborist/test/fixtures/file-dep/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dependencies": {
"some-fake-name": "file:fake",
"has-package-exports": "^1.3.0"
}
}
Loading
Loading