Currently DevTools runs closure compiler with multiple passes to ensure that each module does not rely on other modules that are not its dependencies (either directly or transitively).
By generating a devtools front-end before the closure compilation step with closure module annotations, we can do a single-pass closure compilation and still verify module dependencies.
An entry file is generated for the closure compiler with a sorted list of modules:
goog.require("RuntimeModule")
goog.require("PlatformModule")
goog.require("CommonModule")
goog.require("HostModule")
goog.require("UIModule")
goog.require("DiffModule")
Each module is generated a module file that requires all the files in the module:
goog.provide("UIModule")
goog.require("UIModule.Widget")
goog.require("UIModule.View")
goog.require("UIModule.treeoutline")
goog.require("UIModule.InspectorView")
goog.require("UIModule.ActionRegistry")
goog.require("UIModule.ShortcutRegistry")
The first module file required from the module file above, will declare the namespace:
var UI = {};
Each of the module file will provide a sub namespace based on the file:
goog.provide("UIModule.Widget");
Currently DevTools runs closure compiler with multiple passes to ensure that each module does not rely on other modules that are not its dependencies (either directly or transitively).
By generating a devtools front-end before the closure compilation step with poisoned namespaces, we can do a single-pass closure compilation and still verify module dependencies
Comment 1 by chenwilliam@chromium.org
, Dec 20 2016