1.2.10 • Published 4 years ago

rollup-plugin-strip-shebang v1.2.10

Weekly downloads
560
License
MIT
Repository
github
Last release
4 years ago

rollup-plugin-strip-shebang

CircleCI npm codecov dependencies dev dependencies peer dependencies packagephobia bundlephobia types Known Vulnerabilities license

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.log("Hi!");
// rollup.config.js
import stripShebang from "rollup-plugin-strip-shebang";

export default {

  input: "example.js",

  output: {
    file: "bin/cli.js",
    format: "cjs"
  },

  plugins: [
    stripShebang()
  ]

};

Features

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: (shebang: string) => void;

example

let shebang;
...
  plugins: [
    strip({
      capture(capturedShebang) {
        shebang = capturedShebang;
      },
    }),
  ]
...
console.log(shebang);

object

syntax

capture: Object;

example

let capture = {};
...
  plugins: [
    strip({
      capture,
    }),
  ]
...
console.log(capture.shebang);

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: [
    strip({
      sourcemap: false,
    }),
  ]
...

:warning: 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

1.2.10

4 years ago

1.2.9

4 years ago

1.2.8

4 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.20

5 years ago

1.1.19

5 years ago

1.1.18

5 years ago

1.1.17

5 years ago

1.1.16

5 years ago

1.1.15

5 years ago

1.1.14

5 years ago

1.1.13

5 years ago

1.1.12

5 years ago

1.1.11

5 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago