feat(nodejs): infer build edges from pnpm workspace: protocol dependencies - #4
Merged
Merged
Conversation
aster resolved inter-project edges from `file:` specifiers and from npm `workspaces` siblings by name, but ignored the `workspace:` protocol and never read `pnpm-workspace.yaml`. In pnpm/yarn-berry/bun workspaces this dropped the consumer->dependency build edge, so consumers built before their dependencies and `tsc` failed with TS2307/TS7016. - Parse `pnpm-workspace.yaml` `packages:` globs when discovering members, alongside the existing npm `workspaces` field. - Recognize every `workspace:` form and resolve it to a workspace member: by relative path for `./`/`../`, by aliased name for `name@range`, and by the dependency key for the range forms (`*`, `^`, `~`, semver). - Apply across `dependencies` and `devDependencies`, deduped by resolved path, mirroring how `file:` deps are wired. The resolved member feeds the same `<member>:build` edge as `file:`, so a dependency's build completes before its dependents'.
|
✅ Clean PR, @bruno-archastro! No blocking findings on
Reply |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enhances the Node.js plugin to correctly infer build dependencies between workspace members when using the pnpm
workspace:protocol (as well as yarn-berry/bun). Previously, onlyfile:specifiers and npmworkspacessiblings by name were recognized, causing consumers to build before their dependencies and resulting in TypeScript errors (TS2307/TS7016).Key changes:
pnpm-workspace.yamlpackages:globs alongside the existing npmworkspacesfield to discover workspace members.workspace:protocol and resolve them to workspace members:workspace:./pkg,workspace:../pkg) resolve by relative path.workspace:@scope/dep@*) resolve by aliased name.workspace:*,workspace:^,workspace:~,workspace:1.2.3, etc.) resolve by the dependency key.dependenciesanddevDependencies, deduped by resolved path.<member>:buildedge asfile:dependencies, ensuring a dependency's build completes before its dependents.workspace:forms, pnpm workspace discovery, and end-to-end build edge inference.whycommands for pnpm workspaces.This fixes build ordering issues in pnpm/yarn-berry/bun monorepos and ensures correct dependency resolution for all supported workspace protocols.