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.3.3 to 2.3.4

LICENSE.md

4

CHANGELOG.md
# rollup-plugin-babel changelog
## 2.3.4
* Ensure class transformer is present for preflight check, and only run check once per directory ([#23](https://github.com/rollup/rollup-plugin-babel/issues/23))
## 2.3.3

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

29

dist/rollup-plugin-babel.cjs.js
'use strict';
var path = require('path');
var babelCore = require('babel-core');

@@ -10,12 +11,24 @@ var rollupPluginutils = require('rollup-pluginutils');

function preflightCheck(localOpts) {
var check = babelCore.transform('export default class Foo {}', localOpts).code;
var preflightCheckResults = {};
if (! ~check.indexOf('export default') && ! ~check.indexOf('export { Foo as 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');
function preflightCheck(options, dir) {
var helpers = undefined;
if (~check.indexOf('import _classCallCheck from "babel-runtime')) return RUNTIME;
if (~check.indexOf('function _classCallCheck')) return INLINE;
if (~check.indexOf('babelHelpers')) return BUNDLED;
if (!preflightCheckResults[dir]) {
options = assign({}, options);
options.filename = path.join(dir, 'x.js');
throw new Error('An unexpected situation arose. Please raise an issue at https://github.com/rollup/rollup-plugin-babel/issues. Thanks!');
if (!options.plugins) options.plugins = [];
options.plugins.push('transform-es2015-classes');
var check = babelCore.transform('export default class Foo {}', options).code;
if (! ~check.indexOf('export default') && ! ~check.indexOf('export { Foo as 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#configuring-babel for more information');
if (~check.indexOf('import _classCallCheck from "babel-runtime')) helpers = RUNTIME;else if (~check.indexOf('function _classCallCheck')) helpers = INLINE;else if (~check.indexOf('babelHelpers')) helpers = BUNDLED;else {
throw new Error('An unexpected situation arose. Please raise an issue at https://github.com/rollup/rollup-plugin-babel/issues. Thanks!');
}
}
return preflightCheckResults[dir] = helpers;
}

@@ -57,4 +70,4 @@

var helpers = preflightCheck(options, path.dirname(id));
var localOpts = assign({ filename: id }, options);
var helpers = preflightCheck(localOpts);

@@ -61,0 +74,0 @@ var transformed = babelCore.transform(code, localOpts);

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

import { join, dirname } from 'path';
import { transform, buildExternalHelpers } from 'babel-core';

@@ -8,12 +9,24 @@ import { createFilter } from 'rollup-pluginutils';

function preflightCheck(localOpts) {
var check = transform('export default class Foo {}', localOpts).code;
var preflightCheckResults = {};
if (! ~check.indexOf('export default') && ! ~check.indexOf('export { Foo as 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');
function preflightCheck(options, dir) {
var helpers = undefined;
if (~check.indexOf('import _classCallCheck from "babel-runtime')) return RUNTIME;
if (~check.indexOf('function _classCallCheck')) return INLINE;
if (~check.indexOf('babelHelpers')) return BUNDLED;
if (!preflightCheckResults[dir]) {
options = assign({}, options);
options.filename = join(dir, 'x.js');
throw new Error('An unexpected situation arose. Please raise an issue at https://github.com/rollup/rollup-plugin-babel/issues. Thanks!');
if (!options.plugins) options.plugins = [];
options.plugins.push('transform-es2015-classes');
var check = transform('export default class Foo {}', options).code;
if (! ~check.indexOf('export default') && ! ~check.indexOf('export { Foo as 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#configuring-babel for more information');
if (~check.indexOf('import _classCallCheck from "babel-runtime')) helpers = RUNTIME;else if (~check.indexOf('function _classCallCheck')) helpers = INLINE;else if (~check.indexOf('babelHelpers')) helpers = BUNDLED;else {
throw new Error('An unexpected situation arose. Please raise an issue at https://github.com/rollup/rollup-plugin-babel/issues. Thanks!');
}
}
return preflightCheckResults[dir] = helpers;
}

@@ -55,4 +68,4 @@

var helpers = preflightCheck(options, dirname(id));
var localOpts = assign({ filename: id }, options);
var helpers = preflightCheck(localOpts);

@@ -59,0 +72,0 @@ var transformed = transform(code, localOpts);

{
"name": "rollup-plugin-babel",
"version": "2.3.3",
"version": "2.3.4",
"description": "Seamless integration between Rollup and Babel.",

@@ -23,2 +23,3 @@ "main": "dist/rollup-plugin-babel.cjs.js",

],
"license": "MIT",
"scripts": {

@@ -33,2 +34,3 @@ "test": "mocha --compilers js:babel-register",

"babel-core": "6",
"babel-plugin-transform-es2015-classes": "^6.3.15",
"object-assign": "^4.0.1",

@@ -35,0 +37,0 @@ "rollup-pluginutils": "^1.1.0"

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

import { dirname, join } from 'path';
import { buildExternalHelpers, transform } from 'babel-core';

@@ -8,12 +9,28 @@ import { createFilter } from 'rollup-pluginutils';

function preflightCheck ( localOpts ) {
var check = transform( 'export default class Foo {}', localOpts ).code;
let preflightCheckResults = {};
if ( !~check.indexOf( 'export default' ) && !~check.indexOf( 'export { Foo as 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' );
function preflightCheck ( options, dir ) {
let helpers;
if ( ~check.indexOf( 'import _classCallCheck from "babel-runtime' ) ) return RUNTIME;
if ( ~check.indexOf( 'function _classCallCheck' ) ) return INLINE;
if ( ~check.indexOf( 'babelHelpers' ) ) return BUNDLED;
if ( !preflightCheckResults[ dir ] ) {
options = assign( {}, options );
options.filename = join( dir, 'x.js' );
throw new Error( 'An unexpected situation arose. Please raise an issue at https://github.com/rollup/rollup-plugin-babel/issues. Thanks!' );
if ( !options.plugins ) options.plugins = [];
options.plugins.push( 'transform-es2015-classes' );
const check = transform( 'export default class Foo {}', options ).code;
if ( !~check.indexOf( 'export default' ) && !~check.indexOf( 'export { Foo as 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#configuring-babel for more information' );
if ( ~check.indexOf( 'import _classCallCheck from "babel-runtime' ) ) helpers = RUNTIME;
else if ( ~check.indexOf( 'function _classCallCheck' ) ) helpers = INLINE;
else if ( ~check.indexOf( 'babelHelpers' ) ) helpers = BUNDLED;
else {
throw new Error( 'An unexpected situation arose. Please raise an issue at https://github.com/rollup/rollup-plugin-babel/issues. Thanks!' );
}
}
return preflightCheckResults[ dir ] = helpers;
}

@@ -55,4 +72,4 @@

const helpers = preflightCheck( options, dirname( id ) );
var localOpts = assign({ filename: id }, options );
const helpers = preflightCheck( localOpts );

@@ -59,0 +76,0 @@ var transformed = transform( code, localOpts );

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