Broccoli nodes, even if they aren't necessarily available at the time of instantiation.
UsageSuppose you have two Broccoli plugins,
B, that may be instantiated in any order in different areas of code, but
Adepends on the output of
const BroccoliBridge = require('broccoli-bridge'); // Stash your bridge instance somewhere central for later access let bridge = new BroccoliBridge(); // Create your `PluginA` instance using a placeholder... let a = new PluginA([ inputOne, bridge.placeholderFor('plugin-b') ]); // ...and then fill in that placeholder with the actual `PluginB` instance at any time before the build starts. let b = new PluginB([inputTwo, inputThree]); bridge.fulfill('plugin-b', b);
bridge.placeholderFor(name): returns a placeholder Broccoli node that will ultimately produce the content given by the node it's fulfilled with
bridge.fulfill(name, node): designates a Broccoli node to provide content for any placeholder(s) with the given name
placeholderFor(name)may be called before or after
namehas already been fulfilled without impacting behavior.
WarningThis package relies on an internal detail of the Broccoli
PluginAPI, and may in principle break at any time.