Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-babel

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-babel - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

.babelrc

4

CHANGELOG.md
# rollup-plugin-babel changelog
## 2.0.0
* Babel 6 compatible
## 1.0.0
* First release

16

index.js

@@ -0,1 +1,2 @@

var path = require( 'path' );
var babel = require( 'babel-core' );

@@ -21,14 +22,7 @@ var createFilter = require( 'rollup-pluginutils' ).createFilter;

// ensure es6.modules are blacklisted
if ( options.whitelist ) {
index = options.whitelist.indexOf( 'es6.modules' );
if ( ~index ) options.whitelist.splice( index, 1 );
}
// preflight check
var check = babel.transform( 'export default class Foo {}', assign({ filename: path.resolve( 'test.js' ) }, options ) ).code;
if ( ~check.indexOf( 'function _classCallCheck' ) ) throw new Error( 'External helpers are not enabled. Please add the "external-helpers-2" plugin or use the "es2015-rollup" preset. See https://github.com/rollup/rollup-plugin-babel#TK for more information' );
if ( !~check.indexOf( 'export default' ) ) throw new Error( 'It looks like your Babel configuration specifies a module transformer. Please disable it. If you\'re using the "es2015" preset, consider using "es2015-rollup" instead. See https://github.com/rollup/rollup-plugin-babel#TK for more information' );
if ( !options.blacklist ) options.blacklist = [];
index = options.blacklist.indexOf( 'es6.modules' );
if ( !~index ) options.blacklist.push( 'es6.modules' );
options.externalHelpers = true;
return {

@@ -35,0 +29,0 @@ transform: function ( code, id ) {

{
"name": "rollup-plugin-babel",
"version": "1.0.0",
"version": "2.0.0",
"devDependencies": {

@@ -14,5 +14,5 @@ "eslint": "^1.7.2",

"dependencies": {
"babel-core": "^5.8.25",
"babel-core": "6",
"rollup-pluginutils": "^1.1.0"
}
}
# rollup-plugin-babel
**experimental, depends on unreleased version of Rollup**
Seamless integration between Rollup and Babel.

@@ -11,3 +9,3 @@

* run the code through Babel first, being careful to disable the `es6.modules` transformer, or
* run the code through Babel first, being careful to exclude the module transformer, or
* run the code through Rollup first, and *then* pass it to Babel.

@@ -51,4 +49,36 @@

## Babel 5
The latest version of rollup-plugin-babel is designed to work with Babel 6. To use rollup-plugin-babel with Babel 5, install a 1.x version:
```bash
npm install --save-dev rollup-plugin-babel@1
```
## Babel 6
With Babel 5, rollup-plugin-babel overrides the configuration to ensure that module syntax is left alone and that external helpers are collected for inclusion at the top of the bundle.
Babel 6 works differently – there's no `blacklist` or `externalHelpers` options. Instead of using the `es2015` preset, install and use [babel-preset-es2015-rollup](https://github.com/rollup/babel-preset-es2015-rollup):
```js
// .babelrc
{
"presets": [ "es2015-rollup" ]
}
```
If you're not using the preset, be sure to include the external helpers plugin:
```js
// .babelrc
{
"plugins": [ "external-helpers-2" ]
}
```
## License
MIT

@@ -8,3 +8,6 @@ var assert = require( 'assert' );

describe( 'rollup-plugin-babel', function () {
this.timeout( 5000 );
it( 'runs code through babel', function () {
var start = Date.now();
return rollup.rollup({

@@ -14,6 +17,11 @@ entry: 'samples/basic/main.js',

}).then( function ( bundle ) {
console.log( 'bundled in %s ms', Date.now() - start );
start = Date.now();
const generated = bundle.generate();
console.log( 'generated in %s ms', Date.now() - start );
const code = generated.code;
assert.ok( code.indexOf( 'const' ) === -1, generated.code );
assert.ok( code.indexOf( 'const' ) === -1, code );
});

@@ -31,2 +39,3 @@ });

assert.ok( code.indexOf( 'babelHelpers.classCallCheck =' ) !== -1, generated.code );
assert.ok( code.indexOf( 'var _createClass =' ) === -1, generated.code );
});

@@ -33,0 +42,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc