Skip to content

Conversation

@mmaietta
Copy link
Collaborator

@mmaietta mmaietta commented Dec 10, 2025

  • Extract fallback node collector (Traversal) to a separate class due to differing parsing logic from NPM collector object NpmDependency

… `env: { COREPACK_ENABLE_STRICT: "0", ...process.env },` to allow `npm list` to work across environments. extract fallback node collector (Traversal) to separate class due to differing parsing logic from NPM collector
@changeset-bot
Copy link

changeset-bot bot commented Dec 10, 2025

🦋 Changeset detected

Latest commit: 2e8ceea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
app-builder-lib Major
electron-builder Major
dmg-builder Major
electron-builder-squirrel-windows Major
electron-forge-maker-appimage Major
electron-forge-maker-nsis-web Major
electron-forge-maker-nsis Major
electron-forge-maker-snap Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mmaietta mmaietta marked this pull request as ready for review December 15, 2025 15:13
import { TraversalNodeModulesCollector } from "./traversalNodeModulesCollector"

export class BunNodeModulesCollector extends NpmNodeModulesCollector {
export class BunNodeModulesCollector extends TraversalNodeModulesCollector {
Copy link
Collaborator Author

@mmaietta mmaietta Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@beyondkmp note: this Bun collector uses the Traversal collector as base class. It returned far more node_modules in the collection that what npm list returned AND the original explicit PR implementation for Bun by a community member was manual traversal as well. Decided to leave it as-is. Albeit I just noticed that the logging below needs to be updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, why is it so much more? It seems there's an issue with npm list under Bun.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I couldn't figure that out but I do intend to investigate it further.

Within the scope of this PR, using TraversalNodeModulesCollector made sure none of the test snapshots changed.

I'll create a follow-up PR for COREPACK_STRICT_ENABLE=0 and we can retest both Yarn v1 and Bun approaches in that PR

# Conflicts:
#	packages/app-builder-lib/src/util/appFileCopier.ts
# Conflicts:
#	packages/app-builder-lib/src/node-module-collector/bunNodeModulesCollector.ts
#	packages/app-builder-lib/src/node-module-collector/nodeModulesCollector.ts
#	packages/app-builder-lib/src/util/appFileCopier.ts
#	test/src/helpers/packTester.ts
@mmaietta mmaietta requested a review from beyondkmp December 22, 2025 13:20
}

// 2) upward hoisted search, then 3) downward non-hoisted search
return (await this.upwardSearch(parentDir, pkgName, requiredRange)) || (await this.downwardSearch(parentDir, pkgName, requiredRange)) || null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this only reachable during manual traversal? Because if pnpm isn't hoisted, reaching this point will definitely cause issues.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's used in pnpm collector's getProductionDependencies. What's the issue here when pnpm isn't hoisted? We handle that usecase with the subsequent downward search.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants