rollup-plugin-strip-shebang
A Rollup.js plugin to remove and optionally extract shebang.
Install
npm i rollup-plugin-strip-shebang
Usage
// example.js#!/usr/bin/env node console;
// rollup.config.js; input: "example.js" output: file: "bin/cli.js" format: "cjs" plugins: ;
Features
- Target file filtering (see include & exclude)
- Capture stripped shebang (see capture option)
- Sourcemap support (see sourcemap option)
Options
include / exclude
minimatch pattern to be used as filter, see createFilter
documentation.
syntax
include: Array<string | RegExp> | string | RegExp | null;exclude: Array<string | RegExp> | string | RegExp | null;
capture
You can pass a capture function
or object
to get the stripped shebang in case you need it later.
function
syntax
capture:void;
example
let shebang;... plugins: ...console;
object
syntax
capture: Object;
example
let capture = {};... plugins: ...console;
sourcemap
You can pass sourcemap: false
to speed things up a bit if you don't need source maps. Anything other than false
will default to true
.
syntax
sourcemap: boolean = true;
example
... output: file: "bin/lib.js" sourcemap: false plugins: ...
⚠️ Note that you will get a warning if you set rollup to generate source maps and set this to
false
.
License
MIT © 2019 Manuel Fernández