rollup-plugin-babel
Advanced tools
Comparing version 3.0.4 to 3.0.5
@@ -42,32 +42,34 @@ 'use strict'; | ||
var preflightCheckResults = {}; | ||
function createPreflightCheck () { | ||
var preflightCheckResults = {}; | ||
function preflightCheck ( options, dir ) { | ||
if ( !preflightCheckResults[ dir ] ) { | ||
var helpers; | ||
return function ( options, dir ) { | ||
if ( !preflightCheckResults[ dir ] ) { | ||
var helpers; | ||
options = Object.assign( {}, options ); | ||
delete options.only; | ||
delete options.ignore; | ||
options = Object.assign( {}, options ); | ||
delete options.only; | ||
delete options.ignore; | ||
options.filename = path.join( dir, 'x.js' ); | ||
options.filename = path.join( dir, 'x.js' ); | ||
options.plugins = [ importHelperPlugin ].concat(options.plugins || []); | ||
options.plugins = [ importHelperPlugin ].concat(options.plugins || []); | ||
var check = babelCore.transform( 'export default class Foo {}', options ).code; | ||
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. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information' ); } | ||
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. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information' ); } | ||
if ( ~check.indexOf( 'import _classCallCheck from' ) ) { helpers = RUNTIME; } | ||
else if ( ~check.indexOf( 'function _classCallCheck' ) ) { helpers = INLINE; } | ||
else if ( ~check.indexOf( 'babelHelpers' ) ) { helpers = BUNDLED; } | ||
if ( ~check.indexOf( 'import _classCallCheck from' ) ) { 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!' ); | ||
else { | ||
throw new Error( 'An unexpected situation arose. Please raise an issue at https://github.com/rollup/rollup-plugin-babel/issues. Thanks!' ); | ||
} | ||
preflightCheckResults[ dir ] = helpers; | ||
} | ||
preflightCheckResults[ dir ] = helpers; | ||
} | ||
return preflightCheckResults[ dir ]; | ||
return preflightCheckResults[ dir ]; | ||
}; | ||
} | ||
@@ -89,2 +91,3 @@ | ||
var filter = rollupPluginutils.createFilter( options.include, options.exclude ); | ||
var preflightCheck = createPreflightCheck(); | ||
delete options.include; | ||
@@ -91,0 +94,0 @@ delete options.exclude; |
@@ -40,32 +40,34 @@ import { dirname, join } from 'path'; | ||
var preflightCheckResults = {}; | ||
function createPreflightCheck () { | ||
var preflightCheckResults = {}; | ||
function preflightCheck ( options, dir ) { | ||
if ( !preflightCheckResults[ dir ] ) { | ||
var helpers; | ||
return function ( options, dir ) { | ||
if ( !preflightCheckResults[ dir ] ) { | ||
var helpers; | ||
options = Object.assign( {}, options ); | ||
delete options.only; | ||
delete options.ignore; | ||
options = Object.assign( {}, options ); | ||
delete options.only; | ||
delete options.ignore; | ||
options.filename = join( dir, 'x.js' ); | ||
options.filename = join( dir, 'x.js' ); | ||
options.plugins = [ importHelperPlugin ].concat(options.plugins || []); | ||
options.plugins = [ importHelperPlugin ].concat(options.plugins || []); | ||
var check = transform( 'export default class Foo {}', options ).code; | ||
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. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information' ); } | ||
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. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information' ); } | ||
if ( ~check.indexOf( 'import _classCallCheck from' ) ) { helpers = RUNTIME; } | ||
else if ( ~check.indexOf( 'function _classCallCheck' ) ) { helpers = INLINE; } | ||
else if ( ~check.indexOf( 'babelHelpers' ) ) { helpers = BUNDLED; } | ||
if ( ~check.indexOf( 'import _classCallCheck from' ) ) { 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!' ); | ||
else { | ||
throw new Error( 'An unexpected situation arose. Please raise an issue at https://github.com/rollup/rollup-plugin-babel/issues. Thanks!' ); | ||
} | ||
preflightCheckResults[ dir ] = helpers; | ||
} | ||
preflightCheckResults[ dir ] = helpers; | ||
} | ||
return preflightCheckResults[ dir ]; | ||
return preflightCheckResults[ dir ]; | ||
}; | ||
} | ||
@@ -87,2 +89,3 @@ | ||
var filter = createFilter( options.include, options.exclude ); | ||
var preflightCheck = createPreflightCheck(); | ||
delete options.include; | ||
@@ -89,0 +92,0 @@ delete options.exclude; |
{ | ||
"name": "rollup-plugin-babel", | ||
"version": "3.0.4", | ||
"version": "3.0.5", | ||
"description": "Seamless integration between Rollup and Babel.", | ||
@@ -5,0 +5,0 @@ "main": "dist/rollup-plugin-babel.cjs.js", |
import { dirname } from 'path'; | ||
import { buildExternalHelpers, transform } from 'babel-core'; | ||
import { createFilter } from 'rollup-pluginutils'; | ||
import preflightCheck from './preflightCheck.js'; | ||
import createPreflightCheck from './preflightCheck.js'; | ||
import { warnOnce } from './utils.js'; | ||
@@ -15,2 +15,3 @@ import { RUNTIME, BUNDLED, HELPERS } from './constants.js'; | ||
const filter = createFilter( options.include, options.exclude ); | ||
const preflightCheck = createPreflightCheck(); | ||
delete options.include; | ||
@@ -17,0 +18,0 @@ delete options.exclude; |
@@ -6,32 +6,34 @@ import { join } from 'path'; | ||
let preflightCheckResults = {}; | ||
export default function createPreflightCheck () { | ||
let preflightCheckResults = {}; | ||
export default function preflightCheck ( options, dir ) { | ||
if ( !preflightCheckResults[ dir ] ) { | ||
let helpers; | ||
return ( options, dir ) => { | ||
if ( !preflightCheckResults[ dir ] ) { | ||
let helpers; | ||
options = Object.assign( {}, options ); | ||
delete options.only; | ||
delete options.ignore; | ||
options = Object.assign( {}, options ); | ||
delete options.only; | ||
delete options.ignore; | ||
options.filename = join( dir, 'x.js' ); | ||
options.filename = join( dir, 'x.js' ); | ||
options.plugins = [ importHelperPlugin ].concat(options.plugins || []); | ||
options.plugins = [ importHelperPlugin ].concat(options.plugins || []); | ||
const check = transform( 'export default class Foo {}', options ).code; | ||
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. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information' ); | ||
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. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information' ); | ||
if ( ~check.indexOf( 'import _classCallCheck from' ) ) helpers = RUNTIME; | ||
else if ( ~check.indexOf( 'function _classCallCheck' ) ) helpers = INLINE; | ||
else if ( ~check.indexOf( 'babelHelpers' ) ) helpers = BUNDLED; | ||
if ( ~check.indexOf( 'import _classCallCheck from' ) ) 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!' ); | ||
else { | ||
throw new Error( 'An unexpected situation arose. Please raise an issue at https://github.com/rollup/rollup-plugin-babel/issues. Thanks!' ); | ||
} | ||
preflightCheckResults[ dir ] = helpers; | ||
} | ||
preflightCheckResults[ dir ] = helpers; | ||
} | ||
return preflightCheckResults[ dir ]; | ||
return preflightCheckResults[ dir ]; | ||
}; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27877
417