-
Notifications
You must be signed in to change notification settings - Fork 18
graph: integrate edge modifiers #843
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
graph: integrate edge modifiers #843
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR integrates edge modifier functionality into the dependency graph, enabling installs to override current dependency values using a modifier query. Key changes include:
- Adding a new modifier property to Node and propagating modifier values through graph-building functions.
- Updating functions (install, addNodes, appendNodes, etc.) to load and apply a GraphModifier.
- Introducing a new check-nodes module that evaluates node modifications based on active modifiers.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/graph/src/node.ts | Adds a new "modifier" property to Node. |
src/graph/src/install.ts | Loads GraphModifier and passes it to the build logic. |
src/graph/src/ideal/get-importer-specs.ts | Extends importer specs options to include modifiers and tracks checks. |
src/graph/src/ideal/check-nodes.ts | Introduces node checking for modifiers and triggers dependency appends. |
src/graph/src/ideal/build.ts | Passes the modifiers option to the build process. |
src/graph/src/ideal/build-ideal-from-starting-graph.ts | Integrates modifier checks into the graph build process. |
src/graph/src/ideal/append-nodes.ts | Updates node appending logic to swap specs and update modifier entries. |
src/graph/src/ideal/add-nodes.ts | Incorporates modifiers in the add-nodes workflow. |
src/graph/src/graph.ts | Updates package placement to handle extra modifier information. |
src/graph/src/actual/load.ts | Extracts modifier extra information from depID when loading manifests. |
Comments suppressed due to low confidence (2)
src/graph/src/graph.ts:345
- [nitpick] Ensure that the semantics of the 'extra' parameter passed to getId are clearly documented, so downstream users understand how modifier information influences dependency identity.
const depId = id || (manifest && getId(spec, manifest, extra))
src/graph/src/actual/load.ts:289
- [nitpick] Consider adding a comment to explain the logic behind choosing between 'lastExtra' and 'maybeExtra', to clarify under which conditions each is used for modifier application.
extra = type === 'registry' || type === 'git' ? lastExtra : maybeExtra
aa209bc
to
8a9fbf9
Compare
Add the ability for installs to use edge modifiers by using the `"modifiers"` to define an object containing keys that use a subset of the Dependency Selector Syntax and a spec value to override the current value in use, e.g: ``` { "modifiers": { ":root > #eslint": "^8.0.0", "#react": "^16" } } ``` Refs: vltpkg/statusboard#64
8a9fbf9
to
2d4d71a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good and I built this PR locally and used it to install some simple modifiers which all worked!
Add the ability for installs to use edge modifiers by using the
"modifiers"
to define an object containing keys that use a subset of the Dependency Selector Syntax and a spec value to override the current value in use, e.g:Refs: https://github.com/vltpkg/statusboard/issues/64