Skip to content

module map refactor

Daniel Lamando edited this page Feb 16, 2023 · 1 revision

TODO: enable multiple ModuleMap modes

Types of module map:

  1. 'per-file' graph, direct from deno info without collapsing
  2. 'pkgs-overview' graph, built from per-file graph & collapses everything into their modules
  3. 'pkg-focus' graph, shows all files within one module + immediate upstream/downstreams (also emits as subgraphs)

Ways that module maps are used

per-file graphs are used as input when constructing the other graphs

original graph behavior

  1. deno_graph builds and emits raw JSON payload
  2. deno_graph JSON is translated directly into a 'per-file' ModuleMap
  3. A new 'pkgs-overview' ModuleMap is constructed using every node in the original 'per-file' map
  4. The 'pkgs-overview' ModuleMap is serialized as GraphViz text without subgraphs
  5. The dependencies-of feature renders the GraphViz into SVG and possibly inserts interaction buttons

focus-on graph behavior

  1. (same as above) deno_graph builds and emits raw JSON payload
  2. (same as above) deno_graph JSON is translated directly into a 'per-file' ModuleMap
  3. A new 'pkg-focus' ModuleMap is constructed from a subset of the original 'per-file' map's nodes, plus direct connections outside
  4. The 'pkg-focus' ModuleMap is serialized as GraphViz text including one or more subgraphs
  5. (same as above) The dependencies-of feature renders the GraphViz into SVG and possibly inserts interaction buttons