Skip to content

Refactor graphs bundle to ES module syntax

Mike Greiling requested to merge refactor-graphs-bundle into master

What does this MR do?

Part of an effort to limit the messy javascript global scope (#20983 (closed))

This refactors the contents of graphs_bundle from:

graphs_bundle.js
├── stat_graph_contributors_graph.js
├── stat_graph_contributors_util.js
├── stat_graph_contributors.js
└── stat_graph.js

with the following side effects:

window.d3
window.ContributorsGraph
window.ContributorsMasterGraph
window.ContributorsAuthorGraph
window.ContributorsStatGraphUtil
window.ContributorsStatGraph
window.StatGraph

to

graphs_bundle.js
└─┬ stat_graph_contributors.js
  ├── stat_graph_contributors_util.js
  └── stat_graph_contributors_graph.js

with only one side effect:

window.ContributorsStatGraph

This MR also removes IIFEs, replaces CJS require syntax with ES import syntax, and directly exports classes and objects rather than relying on window. No changes were made to the classes themselves.

Are there points in the code the reviewer needs to double check?

all tests should pass, and the project -> graphs page should function as it normally does

Why was this MR needed?

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Merge request reports