ember-rollup
Use rollup to add runtime dependencies to an ember-cli addon.
Last updated 19 days ago by asakusuma .
Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ember-rollup 
SYNC missed versions from official npm registry.

ember-rollup npm version Build Status

Use rollup to add runtime dependencies to an ember-cli addon.

Installation

npm i --save ember-rollup

What is this thing?

ember-rollup is not an addon, but rather a function that takes just two arguments:

  • An array of string module names. These modules must be present in dependencies in package.json.
  • The original object to be exported in index.js

Simply wrap the exports of your app/addon index.js with the function, and suddenly, ES6/2015 dependencies in your ember app! ember-rollup even handles babel for you. Modules are namespaced based on the addon name.

ember-rollup looks for a jsnext:main or module in package.json of imported modules. If not provided, it will fallback to main and assume a normal CommonJS module. If main is not provided, it will assume index.js.

Example

//my-addon/index.js
const emberRollup = require('ember-rollup');
const runtimeDependencies = ['my-module', 'rsvp'];

module.exports = emberRollup(runtimeDependencies, {
  name: 'my-addon',
  ...
});
//my-addon/app/my-thing.js
import myModule from 'my-addon/my-module';
import RSVP from 'my-addon/rsvp';

Custom Rollup Entry

Some packages don't specify jsnext:main or module in their package.json even though a module exists. You can manually point rollup to the module entry point file path using rollupEntry.

//my-addon/index.js
const emberRollup = require('ember-rollup');
const runtimeDependencies = [{
  name: '@reactivex/rxjs',
  namespaced: false,
  rollupEntry: 'dist/esm5_for_rollup/index.js'
}];

module.exports = emberRollup(runtimeDependencies, {
  name: 'my-addon',
  ...
});
//my-addon/app/my-thing.js
import { Observable } from 'rxjs';

Turning off addon namespacing

By default, module names are namespaced based on the addon. The reason being, an app might use two different addons that require two different versions of the same module. If you would rather force the app to only include one version of any given module, you can turn off namespacing.

//my-addon/index.js
const emberRollup = require('ember-rollup');
const runtimeDependencies = [{
  name: 'my-module',
  namespaced: false
}, 'rsvp'];

module.exports = emberRollup(runtimeDependencies, {
  name: 'my-addon',
  ...
});
//my-addon/app/my-thing.js
import myModule from 'my-module';
import RSVP from 'my-addon/rsvp';

Current Tags

  • 2.1.1                                ...           latest (19 days ago)

26 Versions

  • 2.1.1                                ...           19 days ago
  • 2.1.0                                ...           a year ago
  • 2.0.1                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           2 years ago
  • 0.3.8                                ...           2 years ago
  • 0.3.7                                ...           2 years ago
  • 0.3.6                                ...           2 years ago
  • 0.3.5                                ...           3 years ago
  • 0.3.4                                ...           3 years ago
  • 0.3.3                                ...           3 years ago
  • 0.3.2                                ...           3 years ago
  • 0.3.1                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.3                                ...           3 years ago
  • 0.2.2                                ...           3 years ago
  • 0.2.1                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Downloads
Today 0
This Week 0
This Month 26
Last Day 0
Last Week 26
Last Month 46
Dependencies (16)
Dev Dependencies (8)

Copyright 2014 - 2017 © taobao.org |