add back strict module formatters
This commit is contained in:
parent
2808bc2c90
commit
c7c99efa8e
14
lib/6to5/transformation/modules/_strict.js
Normal file
14
lib/6to5/transformation/modules/_strict.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
var util = require("../../util");
|
||||||
|
|
||||||
|
module.exports = function (Parent) {
|
||||||
|
var Constructor = function () {
|
||||||
|
this.noInteropRequire = true;
|
||||||
|
Parent.apply(this, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
util.inherits(Constructor, Parent);
|
||||||
|
|
||||||
|
return Constructor;
|
||||||
|
};
|
||||||
3
lib/6to5/transformation/modules/amd-strict.js
Normal file
3
lib/6to5/transformation/modules/amd-strict.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
module.exports = require("./_strict")(require("./amd"));
|
||||||
@ -99,7 +99,7 @@ AMDFormatter.prototype.importSpecifier = function (specifier, node, nodes) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
AMDFormatter.prototype.exportDeclaration = function (node) {
|
AMDFormatter.prototype.exportDeclaration = function (node) {
|
||||||
if (node.default && !this.noInteropRequire && !this.hasNonDefaultExports) {
|
if (this.doDefaultExportInterop(node)) {
|
||||||
this.passModuleArg = true;
|
this.passModuleArg = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3
lib/6to5/transformation/modules/common-strict.js
Normal file
3
lib/6to5/transformation/modules/common-strict.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
module.exports = require("./_strict")(require("./common"));
|
||||||
@ -60,8 +60,12 @@ CommonJSFormatter.prototype.importDeclaration = function (node, nodes) {
|
|||||||
}, true));
|
}, true));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CommonJSFormatter.prototype.doDefaultExportInterop = function (node) {
|
||||||
|
return node.default && !this.noInteropRequire && !this.hasNonDefaultExports;
|
||||||
|
};
|
||||||
|
|
||||||
CommonJSFormatter.prototype.exportDeclaration = function (node, nodes) {
|
CommonJSFormatter.prototype.exportDeclaration = function (node, nodes) {
|
||||||
if (node.default && !this.noInteropRequire && !this.hasNonDefaultExports) {
|
if (this.doDefaultExportInterop(node)) {
|
||||||
var declar = node.declaration;
|
var declar = node.declaration;
|
||||||
var assign = util.template("exports-default-assign", {
|
var assign = util.template("exports-default-assign", {
|
||||||
VALUE: this._pushStatement(declar, nodes)
|
VALUE: this._pushStatement(declar, nodes)
|
||||||
|
|||||||
3
lib/6to5/transformation/modules/umd-strict
Normal file
3
lib/6to5/transformation/modules/umd-strict
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
module.exports = require("./_strict")(require("./umd"));
|
||||||
@ -86,6 +86,9 @@ transform.deprecatedTransformerMap = {
|
|||||||
transform.transformers = object();
|
transform.transformers = object();
|
||||||
|
|
||||||
transform.moduleFormatters = {
|
transform.moduleFormatters = {
|
||||||
|
commonStrict: require("./modules/common-strict"),
|
||||||
|
amdStrict: require("./modules/amd-strict"),
|
||||||
|
umdStrict: require("./modules/umd-strict"),
|
||||||
common: require("./modules/common"),
|
common: require("./modules/common"),
|
||||||
system: require("./modules/system"),
|
system: require("./modules/system"),
|
||||||
ignore: require("./modules/ignore"),
|
ignore: require("./modules/ignore"),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user