# broccoli-bridge

> A utility for bridging dependencies between Broccoli nodes

Latest version **1.0.0** (published 2018-07-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install broccoli-bridge
pnpm add broccoli-bridge
yarn add broccoli-bridge
bun add broccoli-bridge
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-07-24 |
| First published | 2018-07-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 6.0 |
| Dependencies | 3 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | dfreeman |

## Links

- npm: https://www.npmjs.com/package/broccoli-bridge
- Repository: https://github.com/dfreeman/broccoli-bridge
- npm.io page: https://npm.io/package/broccoli-bridge

## Dependencies (3)

- [fs-extra](https://npm.io/package/fs-extra.md) ^7.0.0
- [broccoli-plugin](https://npm.io/package/broccoli-plugin.md) ^1.3.0
- [symlink-or-copy](https://npm.io/package/symlink-or-copy.md) ^1.2.0

## Recent versions

- 1.0.0 (latest) — 2018-07-24

## README

# broccoli-bridge [![Build Status](https://travis-ci.org/dfreeman/broccoli-bridge.svg?branch=master)](https://travis-ci.org/dfreeman/broccoli-bridge)

A utility for bridging dependencies between [Broccoli](https://github.com/broccolijs/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`.

```js
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);
```

## API

- `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

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.

---
_Source: https://npm.io/package/broccoli-bridge · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
