# pipemaker

> Manages multiple transpilers with chaining

Latest version **0.7.0** (published 2021-09-23) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install pipemaker
pnpm add pipemaker
yarn add pipemaker
bun add pipemaker
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.7.0 |
| Published | 2021-09-23 |
| First published | 2016-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 17.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Brandon Carl |
| Maintainers | brandoncarl |

## Links

- npm: https://www.npmjs.com/package/pipemaker
- Repository: https://github.com/brandoncarl/pipemaker
- Homepage: https://github.com/brandoncarl/pipemaker#readme
- Issues: https://github.com/brandoncarl/pipemaker/issues
- npm.io page: https://npm.io/package/pipemaker

## Dependencies (2)

- [compilers](https://npm.io/package/compilers.md) ^2.0.0
- [lodash.assign](https://npm.io/package/lodash.assign.md) ^4.2.0

## Recent versions

- 0.7.0 (latest) — 2021-09-23
- 0.6.0 — 2016-11-28
- 0.5.0 — 2016-04-20
- 0.4.1 — 2016-03-19
- 0.4.0 — 2016-03-19
- 0.3.8 — 2016-03-01
- 0.3.7 — 2016-02-29
- 0.3.6 — 2016-02-28
- 0.3.5 — 2016-02-27
- 0.3.4 — 2016-02-27
- 0.3.3 — 2016-02-27
- 0.3.2 — 2016-02-27
- 0.3.1 — 2016-02-27
- 0.3.0 — 2016-02-26

## README

# Pipemaker

Powerful chaining of pre- and post-processors, with dynamic dependency downloading.


## Installation
```
$ npm install pipemaker
```

## Examples

```js
var pipemaker = new Pipemaker();

// Simple pipelines (extension, name)
pipemaker.addPipeline("jade");
pipemaker.addPipeline("coffee");
pipemaker.addPipeline("js", "dust");

// Chained pipelines (extension, chain)
pipemaker.addPipeline("css", "css>clean-css");
pipemaker.addPipeline("js", "javascript>uglify-js");
pipemaker.addPipeline("jbs", "jade>handlebars");

function next(err, compiled) { console.log(compiled); }

// Compile
pipemaker.compile("coffee", "console.log 'Hello'", next);
pipemaker.compile("handlebars", "Hello {{ name }}", { name : "Donald" }, next);
pipemaker.compileFile("./path-to/file.coffee", next);
```


## API

[Pipemaker](#Pipemaker) ⇒ <code>[Pipemaker](#Pipemaker)</code>
[.addPipeline(ext, [chain])](#Pipemaker+addPipeline) ⇒ <code>function</code>
[.compile(ext, str, [options], next)](#Pipemaker+compile)
[.compileBlock(lines, lineNo, [options], next)](#Pipemaker+compileBlock)
[.compileFile(filename, [options], next)](#Pipemaker+compileFile)
[.compileWildcard(str, [options], next)](#Pipemaker+compileWildcard)
[.createPipeline(chain)](#Pipemaker+createPipeline) ⇒ <code>function</code>
[.getPipeline(chain)](#Pipemaker+getPipeline) ⇒ <code>function</code>
[.hasPipeline(ext)](#Pipemaker+hasPipeline) ⇒ <code>Boolean</code>
[.removePipeline(ext)](#Pipemaker+removePipeline)

<a name="Pipemaker"></a>
### Pipemaker ⇒ <code>[Pipemaker](#Pipemaker)</code>
Constructor for Pipemaker class. Automatically installs packages by default.

**Returns**: <code>[Pipemaker](#Pipemaker)</code> - Instance of class.  

| Param | Type | Description |
| --- | --- | --- |
| mappings | <code>Object</code> | Keys correspond to extensions, values to pipeline names. |
| options | <code>Object</code> | Install directory `dir`, and whether to `fetch` if missing. |

**Example**  
```js
var pipemaker = new Pipemaker({ dir : process.cwd() });
```

<a name="Pipemaker+compile"></a>
### pipemaker.compile(ext, str, [options], next)
compiles a string using pipeline associated with ext

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| ext | <code>String</code> |  | The extension associated with string (e.g. "coffee"). |
| str | <code>String</code> |  | The string to be compiled. |
| [options] | <code>Object</code> | <code>{}</code> | Options to be passed to rendering pipeline. |
| next | <code>function</code> |  | Callback of type fn(err, compiled). |

**Example**  
```js
pipemaker.compile("coffee", "console.log 'Hello'", function(err, compiled) {
    console.log(compiled);
    // => console.log('Hello');
  });
```
<a name="Pipemaker+compileFile"></a>
### pipemaker.compileFile(filename, [options], next)
compiles a file using pipeline associated with file's extension

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| filename | <code>String</code> |  | Name of file. |
| [options] | <code>Object</code> | <code>{}</code> | Options to be passed to rendering pipeline. |
| next | <code>function</code> |  | Callback of type fn(err, compiled). |

**Example**  
```js
pipemaker.compileFile("app.coffee", function(err, compiled) {
    // Compiled version of app.coffee
  });
```
<a name="Pipemaker+compileWildcard"></a>
### pipemaker.compileWildcard(str, [options], next)
Compiles a wildcard string.


| Param | Type | Default | Description |
| --- | --- | --- | --- |
| str | <code>String</code> |  | The string to be compiled. |
| [options] | <code>Object</code> | <code>{}</code> | Options to be passed to rendering pipeline. |
| next | <code>function</code> |  | Callback of type fn(err, compiled). |

<a name="Pipemaker+compileBlock"></a>
### pipemaker.compileBlock(lines, lineNo, [options], next)
Recursively compiles a wildcard block.


| Param | Type | Default | Description |
| --- | --- | --- | --- |
| lines | <code>Array</code> |  | The lines to be compiled |
| lineNo | <code>Number</code> |  | The line number to start with |
| [options] | <code>Object</code> | <code>{}</code> | Options to be passed to rendering pipeline |
| next | <code>function</code> |  | Callback of type fn(err, compiled, numberOfLinesProcessed) |

<a name="Pipemaker+createPipeline"></a>
### pipemaker.createPipeline(chain) ⇒ <code>function</code>
Returns a compilation function based on input chain.

**Returns**: <code>function</code> - Compilation function fn(str, options, next).  

| Param | Type | Description |
| --- | --- | --- |
| chain | <code>String</code> | String containing names of pipelines to use. |

**Example**  
```js
pipemaker.createPipeline("jade");
  pipemaker.createPipeline("jade>handlebars");
  pipemaker.createPipeline("js>uglify-js");
```
<a name="Pipemaker+getPipeline"></a>
### pipemaker.getPipeline(chain) ⇒ <code>function</code>
Gets an pipeline based on chain, creating pipeline if necessary.

**Returns**: <code>function</code> - Compilation function fn(str, options, next).  

| Param | Type | Description |
| --- | --- | --- |
| chain | <code>String</code> | Chain of pipelines. |

**Example**  
```js
pipemaker.getPipeline("jade>handlebars");
```
<a name="Pipemaker+addPipeline"></a>
### pipemaker.addPipeline(ext, [chain]) ⇒ <code>function</code>
Adds an pipeline for an extension, creating pipeline if necessary.

**Returns**: <code>function</code> - Compilation function fn(str, options, next).  

| Param | Type | Description |
| --- | --- | --- |
| ext | <code>String</code> | File extension to be associated with pipeline. |
| [chain] | <code>String</code> | Optional chain for creating pipeline. |

<a name="Pipemaker+removePipeline"></a>
### pipemaker.removePipeline(ext)
Removes an pipeline by extension.


| Param | Type | Description |
| --- | --- | --- |
| ext | <code>String</code> | File extension to for removal. |

<a name="Pipemaker+hasPipeline"></a>
### pipemaker.hasPipeline(ext) ⇒ <code>Boolean</code>
Determines if an pipeline currently exists for an extension.

**Returns**: <code>Boolean</code> - Whether pipeline exists.  

| Param | Type | Description |
| --- | --- | --- |
| ext | <code>String</code> | File extension to check. |

## License
MIT

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