rollup-plugin-babel
Advanced tools
Comparing version 3.0.1 to 3.0.2
# rollup-plugin-babel changelog | ||
## 3.0.1 | ||
* Wasn't working, fix bug with transform (not using es2015-classes for preflight check) | ||
## 3.0.0 | ||
@@ -4,0 +8,0 @@ |
@@ -13,7 +13,26 @@ 'use strict'; | ||
function importHelperPlugin () { | ||
function importHelperPlugin (ref) { | ||
var t = ref.types; | ||
/** | ||
* This function is needed because of a bug in Babel 6.x, which prevents the | ||
* declaration of an ExportDefaultDeclaration to be replaced with an | ||
* expression. | ||
* That bug has been fixed in Babel 7. | ||
*/ | ||
function replaceWith (path$$1, replacement) { | ||
if ( | ||
path$$1.parentPath.isExportDefaultDeclaration() && | ||
t.isExpression(replacement) | ||
) { | ||
path$$1.parentPath.replaceWith(t.exportDefaultDeclaration(replacement)); | ||
} else { | ||
path$$1.replaceWith(replacement); | ||
} | ||
} | ||
return { | ||
visitor: { | ||
ClassDeclaration: function ClassDeclaration (path$$1, state) { | ||
path$$1.replaceWith(state.file.addHelper('classCallCheck')); | ||
replaceWith(path$$1, state.file.addHelper('classCallCheck')); | ||
} | ||
@@ -20,0 +39,0 @@ } |
@@ -11,7 +11,26 @@ import { dirname, join } from 'path'; | ||
function importHelperPlugin () { | ||
function importHelperPlugin (ref) { | ||
var t = ref.types; | ||
/** | ||
* This function is needed because of a bug in Babel 6.x, which prevents the | ||
* declaration of an ExportDefaultDeclaration to be replaced with an | ||
* expression. | ||
* That bug has been fixed in Babel 7. | ||
*/ | ||
function replaceWith (path$$1, replacement) { | ||
if ( | ||
path$$1.parentPath.isExportDefaultDeclaration() && | ||
t.isExpression(replacement) | ||
) { | ||
path$$1.parentPath.replaceWith(t.exportDefaultDeclaration(replacement)); | ||
} else { | ||
path$$1.replaceWith(replacement); | ||
} | ||
} | ||
return { | ||
visitor: { | ||
ClassDeclaration: function ClassDeclaration (path$$1, state) { | ||
path$$1.replaceWith(state.file.addHelper('classCallCheck')); | ||
replaceWith(path$$1, state.file.addHelper('classCallCheck')); | ||
} | ||
@@ -18,0 +37,0 @@ } |
{ | ||
"name": "rollup-plugin-babel", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Seamless integration between Rollup and Babel.", | ||
@@ -5,0 +5,0 @@ "main": "dist/rollup-plugin-babel.cjs.js", |
@@ -1,6 +0,23 @@ | ||
export default function importHelperPlugin () { | ||
export default function importHelperPlugin ({ types: t }) { | ||
/** | ||
* This function is needed because of a bug in Babel 6.x, which prevents the | ||
* declaration of an ExportDefaultDeclaration to be replaced with an | ||
* expression. | ||
* That bug has been fixed in Babel 7. | ||
*/ | ||
function replaceWith (path, replacement) { | ||
if ( | ||
path.parentPath.isExportDefaultDeclaration() && | ||
t.isExpression(replacement) | ||
) { | ||
path.parentPath.replaceWith(t.exportDefaultDeclaration(replacement)); | ||
} else { | ||
path.replaceWith(replacement); | ||
} | ||
} | ||
return { | ||
visitor: { | ||
ClassDeclaration (path, state) { | ||
path.replaceWith(state.file.addHelper('classCallCheck')); | ||
replaceWith(path, state.file.addHelper('classCallCheck')); | ||
} | ||
@@ -7,0 +24,0 @@ } |
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
26978
402