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 2.0.1 to 2.1.0

4

CHANGELOG.md
# rollup-plugin-babel changelog
## 2.1.0
* Generate sourcemaps by default
## 2.0.1

@@ -4,0 +8,0 @@

@@ -20,2 +20,6 @@ var path = require( 'path' );

if ( options.sourceMap !== false ) options.sourceMaps = true;
if ( options.sourceMaps !== false ) options.sourceMaps = true;
delete options.sourceMap;
return {

@@ -22,0 +26,0 @@ transform: function ( code, id ) {

5

package.json
{
"name": "rollup-plugin-babel",
"version": "2.0.1",
"version": "2.1.0",
"description": "Seamless integration between Rollup and Babel.",

@@ -29,3 +29,4 @@ "keywords": [

"mocha": "^2.3.3",
"rollup": "^0.20.0"
"rollup": "^0.20.0",
"source-map": "^0.5.3"
},

@@ -32,0 +33,0 @@ "repository": {

@@ -36,4 +36,3 @@ # rollup-plugin-babel

babel({
exclude: 'node_modules/**',
sourceMap: true
exclude: 'node_modules/**'
})

@@ -40,0 +39,0 @@ ]

var assert = require( 'assert' );
var path = require( 'path' );
var rollup = require( 'rollup' );
var SourceMapConsumer = require( 'source-map' ).SourceMapConsumer;
var babelPlugin = require( '..' );

@@ -7,4 +9,26 @@

function getLocation ( source, charIndex ) {
var lines = source.split( '\n' );
var len = lines.length;
var lineStart = 0;
var i;
for ( i = 0; i < len; i += 1 ) {
var line = lines[i];
var lineEnd = lineStart + line.length + 1; // +1 for newline
if ( lineEnd > charIndex ) {
return { line: i + 1, column: charIndex - lineStart };
}
lineStart = lineEnd;
}
throw new Error( 'Could not determine location of character' );
}
describe( 'rollup-plugin-babel', function () {
this.timeout( 5000 );
this.timeout( 15000 );

@@ -18,5 +42,5 @@ it( 'runs code through babel', function () {

start = Date.now();
const generated = bundle.generate();
var generated = bundle.generate();
const code = generated.code;
var code = generated.code;

@@ -32,4 +56,4 @@ assert.ok( code.indexOf( 'const' ) === -1, code );

}).then( function ( bundle ) {
const generated = bundle.generate();
const code = generated.code;
var generated = bundle.generate();
var code = generated.code;

@@ -46,4 +70,4 @@ assert.ok( code.indexOf( 'babelHelpers.classCallCheck =' ) !== -1, generated.code );

}).then( function ( bundle ) {
const generated = bundle.generate();
const code = generated.code;
var generated = bundle.generate();
var code = generated.code;

@@ -61,4 +85,4 @@ assert.ok( code.indexOf( 'babelHelpers' ) === -1, generated.code );

}).then( function ( bundle ) {
const generated = bundle.generate();
const code = generated.code;
var generated = bundle.generate();
var code = generated.code;

@@ -69,2 +93,22 @@ assert.ok( code.indexOf( '${foo()}' ) === -1, generated.code );

});
it( 'generates sourcemap by default', function () {
return rollup.rollup({
entry: 'samples/class/main.js',
plugins: [ babelPlugin() ]
}).then( function ( bundle ) {
var generated = bundle.generate({ sourceMap: true });
var smc = new SourceMapConsumer( generated.map );
var loc = getLocation( generated.code, generated.code.indexOf( 'log' ) );
var original = smc.originalPositionFor( loc );
assert.deepEqual( original, {
source: path.resolve( 'samples/class/main.js' ),
line: 3,
column: 10,
name: null
});
});
});
});
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