add modules common strict formatter - fixes #418
This commit is contained in:
11
lib/6to5/transformation/modules/common-strict.js
Normal file
11
lib/6to5/transformation/modules/common-strict.js
Normal file
@@ -0,0 +1,11 @@
|
||||
module.exports = CommonJSStrictFormatter;
|
||||
|
||||
var CommonJSFormatter = require("./common");
|
||||
var util = require("../../util");
|
||||
|
||||
function CommonJSStrictFormatter() {
|
||||
this.noInteropExport = true;
|
||||
CommonJSFormatter.apply(this, arguments);
|
||||
}
|
||||
|
||||
util.inherits(CommonJSStrictFormatter, CommonJSFormatter);
|
||||
@@ -61,7 +61,7 @@ CommonJSFormatter.prototype.importDeclaration = function (node, nodes) {
|
||||
};
|
||||
|
||||
CommonJSFormatter.prototype.exportDeclaration = function (node, nodes) {
|
||||
if (node.default && !this.exportIdentifier) {
|
||||
if (node.default && !this.noInteropRequire && !this.noInteropExport) {
|
||||
var declar = node.declaration;
|
||||
var assign;
|
||||
|
||||
|
||||
@@ -31,11 +31,12 @@ transform._ensureTransformerNames = function (type, keys) {
|
||||
transform.transformers = {};
|
||||
|
||||
transform.moduleFormatters = {
|
||||
common: require("./modules/common"),
|
||||
system: require("./modules/system"),
|
||||
ignore: require("./modules/ignore"),
|
||||
amd: require("./modules/amd"),
|
||||
umd: require("./modules/umd")
|
||||
commonStrict: require("./modules/common-strict"),
|
||||
common: require("./modules/common"),
|
||||
system: require("./modules/system"),
|
||||
ignore: require("./modules/ignore"),
|
||||
amd: require("./modules/amd"),
|
||||
umd: require("./modules/umd")
|
||||
};
|
||||
|
||||
_.each({
|
||||
|
||||
Reference in New Issue
Block a user