# rollup-stream

> a wrapper around Rollup that returns a stream instead of a Promise

Latest version **1.24.1** (published 2017-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install rollup-stream
pnpm add rollup-stream
yarn add rollup-stream
bun add rollup-stream
```

## 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.24.1 |
| Published | 2017-09-11 |
| First published | 2015-11-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 68 |
| Author | Permutator |
| Maintainers | permutator |
| Keywords | rollup, gulpfriendly |

## Links

- npm: https://www.npmjs.com/package/rollup-stream
- Repository: https://github.com/permutatrix/rollup-stream
- Homepage: https://github.com/permutatrix/rollup-stream#readme
- Issues: https://github.com/permutatrix/rollup-stream/issues
- npm.io page: https://npm.io/package/rollup-stream

## Dependencies (1)

- [rollup](https://npm.io/package/rollup.md) ^0.49.2

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.24.1 (latest) — 2017-09-11
- 1.24.0 — 2017-09-11
- 1.23.1 — 2017-07-11
- 1.23.0 — 2017-07-11
- 1.22.0 — 2017-07-11
- 1.21.0 — 2017-06-21
- 1.20.0 — 2017-06-12
- 1.19.0 — 2017-01-18
- 1.18.0 — 2017-01-06
- 1.17.0 — 2017-01-06
- 1.16.0 — 2016-12-25
- 1.15.0 — 2016-12-25
- 1.14.0 — 2016-09-19
- 1.13.0 — 2016-09-10
- 1.12.0 — 2016-08-24
- … 15 more at https://npm.io/package/rollup-stream/versions

## README

# rollup-stream [![npm][npm-image]][npm-url] [![Dependency Status][david-image]][david-url] [![Build Status][travis-image]][travis-url]
This is a simple wrapper around [Rollup] that returns a readable stream instead
of a Promise, like Browserify's bundle() method. It's designed to make using
Rollup with [gulp] easier, but if you find another use for it, go ahead!

The options object is passed to Rollup's rollup() and generate() methods. This
currently works because there's no overlap between the names of the options
those methods take. Hopefully that won't change any time soon!

## Installation
```bash
npm install --save-dev rollup-stream
```

## Basic usage
```js
var gulp = require('gulp'),
    rollup = require('rollup-stream'),
    source = require('vinyl-source-stream');

gulp.task('rollup', function() {
  return rollup({
      input: './src/main.js'
    })
    
    // give the file the name you want to output with.
    .pipe(source('app.js'))
    
    // and output to ./dist/app.js as normal.
    .pipe(gulp.dest('./dist'));
});
```

## Usage with sourcemaps
```js
var gulp = require('gulp'),
    rollup = require('rollup-stream'),
    sourcemaps = require('gulp-sourcemaps'),
//  rename = require('gulp-rename'),
    source = require('vinyl-source-stream'),
    buffer = require('vinyl-buffer');

gulp.task('rollup', function() {
  return rollup({
      input: './src/main.js',
      sourcemap: true
    })
    
    // point to the entry file.
    .pipe(source('main.js', './src'))
    
    // buffer the output. most gulp plugins, including gulp-sourcemaps, don't support streams.
    .pipe(buffer())
    
    // tell gulp-sourcemaps to load the inline sourcemap produced by rollup-stream.
    .pipe(sourcemaps.init({loadMaps: true}))
        
        // transform the code further here.
        
    // if you want to output with a different name from the input file, use gulp-rename here.
//  .pipe(rename('index.js'))
    
    // write the sourcemap alongside the output file.
    .pipe(sourcemaps.write('.'))
    
    // and output to ./dist/main.js as normal.
    .pipe(gulp.dest('./dist'));
});
```

## Usage with caching
```js
var gulp = require('gulp'),
    rollup = require('rollup-stream'),
    source = require('vinyl-source-stream');

var cache;
gulp.task('rollup', function() {
  return rollup({
      input: './src/main.js',
      cache: cache
    })
    
    .on('bundle', function(bundle) {
      cache = bundle;
    })
    
    // after listening for the 'bundle' event, proceed as usual.
    .pipe(source('app.js'))
    .pipe(gulp.dest('./dist'));
});

gulp.task('watch', function() {
  gulp.watch('./src/**/*.js', ['rollup']);
});
```

## Usage with newer, older, or custom Rollup
```js
var gulp = require('gulp'),
    rollup = require('rollup-stream'),
    source = require('vinyl-source-stream');

gulp.task('rollup', function() {
  return rollup({
      input: './src/main.js',
      rollup: require('rollup')
    })
    
    // after passing options.rollup, proceed as usual.
    .pipe(source('app.js'))
    .pipe(gulp.dest('./dist'));
});
```

## Usage with Rollup config file
```js
var gulp = require('gulp'),
    rollup = require('rollup-stream'),
    source = require('vinyl-source-stream');

gulp.task('rollup', function() {
  return rollup('rollup.config.js')
    .pipe(source('app.js'))
    .pipe(gulp.dest('./dist'));
});
```


[npm-url]: https://npmjs.org/package/rollup-stream
[npm-image]: https://img.shields.io/npm/v/rollup-stream.svg
[david-url]: https://david-dm.org/Permutatrix/rollup-stream
[david-image]: https://img.shields.io/david/Permutatrix/rollup-stream/master.svg
[travis-url]: https://travis-ci.org/Permutatrix/rollup-stream
[travis-image]: https://img.shields.io/travis/Permutatrix/rollup-stream/master.svg

[Rollup]: https://www.npmjs.com/package/rollup
[gulp]: http://gulpjs.com/

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