NPM.Resolver (NPM v0.6.0)

Copy Markdown View Source

HexSolver.Registry implementation for npm packages.

Bridges the npm registry to hex_solver's PubGrub dependency resolver. Packuments are cached in an ETS table for the duration of a resolution.

Summary

Functions

Clear the packument cache.

Resolve a set of root dependencies to exact versions.

Functions

clear_cache()

@spec clear_cache() :: :ok

Clear the packument cache.

resolve(root_deps, opts \\ [])

@spec resolve(
  %{required(String.t()) => String.t()},
  keyword()
) :: {:ok, %{required(String.t()) => String.t()}} | {:error, String.t()}

Resolve a set of root dependencies to exact versions.

Uses a two-phase approach:

  1. Try flat resolution with PubGrub
  2. On conflict, identify conflicting packages and retry with those excluded, tracking them as nested dependencies

Returns {:ok, %{name => version}} where the map includes a :nested key with nested package info when version conflicts exist.