broccoli-babel-transpiler
Advanced tools
Comparing version 5.6.0 to 5.6.1
35
index.js
@@ -51,5 +51,11 @@ 'use strict'; | ||
} | ||
if (this.options.helperWhiteList) { | ||
this.helperWhiteList = this.options.helperWhiteList; | ||
} | ||
// Note, Babel does not support this option so we must save it then | ||
// delete it from the options hash | ||
delete this.options.exportModuleMetadata; | ||
delete this.options.helperWhiteList; | ||
@@ -202,2 +208,10 @@ if (this.options.browserPolyfill) { | ||
if (this.helperWhiteList) { | ||
var invalidHelpers = transpiled.metadata.usedHelpers.filter(function(helper) { | ||
return this.helperWhiteList.indexOf(helper) === -1; | ||
}, this); | ||
validateHelpers(invalidHelpers, relativePath); | ||
} | ||
if (transpiled.metadata && transpiled.metadata.modules) { | ||
@@ -230,2 +244,23 @@ this.moduleMetadata[byImportName(key)] = transpiled.metadata.modules; | ||
function validateHelpers(invalidHelpers, relativePath) { | ||
if (invalidHelpers.length > 0) { | ||
var message = relativePath + ' was transformed and relies on `' + invalidHelpers[0] + '`, which was not included in the helper whitelist. Either add this helper to the whitelist or refactor to not be dependent on this runtime helper.'; | ||
if (invalidHelpers.length > 1) { | ||
var helpers = invalidHelpers.map(function(item, i) { | ||
if (i === invalidHelpers.length - 1) { | ||
return '& `' + item; | ||
} else if (i === invalidHelpers.length - 2) { | ||
return item + '`, '; | ||
} | ||
return item + '`, `'; | ||
}).join(''); | ||
message = relativePath + ' was transformed and relies on `' + helpers + '`, which were not included in the helper whitelist. Either add these helpers to the whitelist or refactor to not be dependent on these runtime helper.'; | ||
} | ||
throw new Error(message); | ||
} | ||
} | ||
module.exports = Babel; |
{ | ||
"name": "broccoli-babel-transpiler", | ||
"version": "5.6.0", | ||
"version": "5.6.1", | ||
"description": "A Broccoli plugin which transpile ES6 to readable ES5 by using babel.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
14987
4
211
0
104
0