Class NodeResolutionResult
java.lang.Object
org.openrewrite.javascript.marker.NodeResolutionResult
- All Implemented Interfaces:
org.openrewrite.marker.Marker,org.openrewrite.rpc.RpcCodec<NodeResolutionResult>
public class NodeResolutionResult
extends Object
implements org.openrewrite.marker.Marker, org.openrewrite.rpc.RpcCodec<NodeResolutionResult>
Contains metadata about a Node.js project, parsed from package.json and package-lock.json.
Attached as a marker to JS.CompilationUnit to provide dependency context for recipes.
Similar to MavenResolutionResult marker, this allows recipes to: - Query project dependencies - Check if specific packages are in use - Modify dependencies programmatically - Understand the project structure
The model separates requests (Dependency) from resolutions (ResolvedDependency): - The dependency arrays contain Dependency objects (what was requested) - The resolvedDependencies list contains what was actually installed
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a dependency request as declared in package.json.static classRepresents npm configuration from a specific scope.static enumRepresents the scope/source of an npmrc configuration.static enumRepresents the package manager used by a Node.js project.static classRepresents a resolved dependency from package-lock.json. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable NodeResolutionResult.ResolvedDependencygetResolvedDependency(String packageName) Look up a resolved dependency by package name.rpcReceive(NodeResolutionResult before, org.openrewrite.rpc.RpcReceiveQueue q) voidrpcSend(NodeResolutionResult after, org.openrewrite.rpc.RpcSendQueue q) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openrewrite.marker.Marker
getId, print, withId
-
Constructor Details
-
NodeResolutionResult
public NodeResolutionResult()
-
-
Method Details
-
getResolvedDependency
Look up a resolved dependency by package name.- Parameters:
packageName- The name of the package to look up- Returns:
- The resolved dependency, or null if not found
-
rpcSend
- Specified by:
rpcSendin interfaceorg.openrewrite.rpc.RpcCodec<NodeResolutionResult>
-
rpcReceive
public NodeResolutionResult rpcReceive(NodeResolutionResult before, org.openrewrite.rpc.RpcReceiveQueue q) - Specified by:
rpcReceivein interfaceorg.openrewrite.rpc.RpcCodec<NodeResolutionResult>
-