Skip to content

Graph refactor - #57

Merged
chadhietala merged 7 commits into
masterfrom
deleting-files
Jul 14, 2015
Merged

chadhietala merged 7 commits into
masterfrom
deleting-files

Conversation

@chadhietala

Copy link
Copy Markdown
Owner

This commit is an internal refactor to use a graph to represent the
imports inside of the application. The graph is now used as the source of
truth for what is actually synced to disk. The graph is also used to
determine what imports need to be pruned from the graph when the graph
mutates. Prior to this commit, we could not accurately prun away the the
the unreachable imports.

Reachability is determined by running the postorder
algorithm
for each of the root nodes. This effectively gives you all of the connected
nodes. You then simply get all of the nodes against the connected nodes.
What you are left with is the unreachable nodes. You then remove the
unreachable nodes from the graph.

Prior to this commit It was possible to have multiple versions of the
same library in the compiled output. This was due to the fact that we
would build a browserify bundle perch tree. This re-factor coaleases all
of the npm: imports into a single file and but can cache bust across
trees.

All APIs should be documented now.

Graph Visualization

We are using graphlib for generated the graph and walking algorithms. Chris also has graphlib-dot which allows you to serialize the graph into DOT and then consume it by dagre-d3. It's also super handy in debugging as I found.

This commit is an internal refactor to use a graph to represent the
imports inside of the application. The graph is now used as the source of
truth for what is actually synced to disk. The graph is also used to
determine what imports need to be pruned from the graph when the graph
mutates. Prior to this commit, we could not accurately prun away the the
the unreachable imports.

Reachability is determined by running the [postorder
algorithm](https://en.wikipedia.org/wiki/Tree_traversal#Post-order) for each of the root nodes. This effectively gives you all of the connected
nodes. You then simply get all of the nodes against the connected nodes.
What you are left with is the unreachable nodes. You then remove the
unreachable nodes from the graph.

Prior to this commit It was possible to have multiple versions of the
same library in the compiled output. This was due to the fact that we
would build a browserify bundle perch tree. This re-factor coaleases all
of the npm: imports into a single file and but can cache bust across
trees.

All APIs should be documented now.
@chadhietala chadhietala changed the title Deleting files Graph refactor Jul 11, 2015
chadhietala added a commit that referenced this pull request Jul 14, 2015
@chadhietala
chadhietala merged commit d1f4232 into master Jul 14, 2015
@chadhietala
chadhietala deleted the deleting-files branch July 25, 2015 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant