New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pipemaker

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pipemaker

Manages multiple transpilers with chaining

latest
Source
npmnpm
Version
0.7.0
Version published
Maintainers
1
Created
Source

Pipemaker

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

Installation

$ npm install pipemaker

Examples

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

PipemakerPipemaker .addPipeline(ext, [chain])function .compile(ext, str, [options], next) .compileBlock(lines, lineNo, [options], next) .compileFile(filename, [options], next) .compileWildcard(str, [options], next) .createPipeline(chain)function .getPipeline(chain)function .hasPipeline(ext)Boolean .removePipeline(ext)

Pipemaker ⇒ Pipemaker

Constructor for Pipemaker class. Automatically installs packages by default.

Returns: Pipemaker - Instance of class.

ParamTypeDescription
mappingsObjectKeys correspond to extensions, values to pipeline names.
optionsObjectInstall directory dir, and whether to fetch if missing.

Example

var pipemaker = new Pipemaker({ dir : process.cwd() });

pipemaker.compile(ext, str, [options], next)

compiles a string using pipeline associated with ext

ParamTypeDefaultDescription
extStringThe extension associated with string (e.g. "coffee").
strStringThe string to be compiled.
[options]Object{}Options to be passed to rendering pipeline.
nextfunctionCallback of type fn(err, compiled).

Example

pipemaker.compile("coffee", "console.log 'Hello'", function(err, compiled) {
    console.log(compiled);
    // => console.log('Hello');
  });

pipemaker.compileFile(filename, [options], next)

compiles a file using pipeline associated with file's extension

ParamTypeDefaultDescription
filenameStringName of file.
[options]Object{}Options to be passed to rendering pipeline.
nextfunctionCallback of type fn(err, compiled).

Example

pipemaker.compileFile("app.coffee", function(err, compiled) {
    // Compiled version of app.coffee
  });

pipemaker.compileWildcard(str, [options], next)

Compiles a wildcard string.

ParamTypeDefaultDescription
strStringThe string to be compiled.
[options]Object{}Options to be passed to rendering pipeline.
nextfunctionCallback of type fn(err, compiled).

pipemaker.compileBlock(lines, lineNo, [options], next)

Recursively compiles a wildcard block.

ParamTypeDefaultDescription
linesArrayThe lines to be compiled
lineNoNumberThe line number to start with
[options]Object{}Options to be passed to rendering pipeline
nextfunctionCallback of type fn(err, compiled, numberOfLinesProcessed)

pipemaker.createPipeline(chain) ⇒ function

Returns a compilation function based on input chain.

Returns: function - Compilation function fn(str, options, next).

ParamTypeDescription
chainStringString containing names of pipelines to use.

Example

pipemaker.createPipeline("jade");
  pipemaker.createPipeline("jade>handlebars");
  pipemaker.createPipeline("js>uglify-js");

pipemaker.getPipeline(chain) ⇒ function

Gets an pipeline based on chain, creating pipeline if necessary.

Returns: function - Compilation function fn(str, options, next).

ParamTypeDescription
chainStringChain of pipelines.

Example

pipemaker.getPipeline("jade>handlebars");

pipemaker.addPipeline(ext, [chain]) ⇒ function

Adds an pipeline for an extension, creating pipeline if necessary.

Returns: function - Compilation function fn(str, options, next).

ParamTypeDescription
extStringFile extension to be associated with pipeline.
[chain]StringOptional chain for creating pipeline.

pipemaker.removePipeline(ext)

Removes an pipeline by extension.

ParamTypeDescription
extStringFile extension to for removal.

pipemaker.hasPipeline(ext) ⇒ Boolean

Determines if an pipeline currently exists for an extension.

Returns: Boolean - Whether pipeline exists.

ParamTypeDescription
extStringFile extension to check.

License

MIT

FAQs

Package last updated on 23 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts