broccoli-bridge
A utility for bridging dependencies between Broccoli nodes, even if they aren't necessarily available at the time of instantiation.
Usage
Suppose you have two Broccoli plugins, A
and B
, that may be instantiated in any order in different areas of code, but A
depends on the output of B
.
const BroccoliBridge = require('broccoli-bridge');
let bridge = new BroccoliBridge();
let a = new PluginA([
inputOne,
bridge.placeholderFor('plugin-b')
]);
let b = new PluginB([inputTwo, inputThree]);
bridge.fulfill('plugin-b', b);
API
bridge.placeholderFor(name)
: returns a placeholder Broccoli node that will ultimately produce the content given by the node it's fulfilled withbridge.fulfill(name, node)
: designates a Broccoli node to provide content for any placeholder(s) with the given name
Note that placeholderFor(name)
may be called before or after name
has already been fulfilled without impacting behavior.
Warning
This package relies on an internal detail of the Broccoli Plugin
API, and may in principle break at any time.