clean up interop require
This commit is contained in:
@@ -62,7 +62,6 @@ export default class File {
|
||||
"create-decorated-object",
|
||||
"tagged-template-literal",
|
||||
"tagged-template-literal-loose",
|
||||
"interop-require",
|
||||
"to-array",
|
||||
"to-consumable-array",
|
||||
"sliced-to-array",
|
||||
@@ -74,6 +73,7 @@ export default class File {
|
||||
"define-property",
|
||||
"async-to-generator",
|
||||
"interop-require-wildcard",
|
||||
"interop-require-default",
|
||||
"typeof",
|
||||
"extends",
|
||||
"get",
|
||||
@@ -83,7 +83,10 @@ export default class File {
|
||||
"temporal-undefined",
|
||||
"temporal-assert-defined",
|
||||
"self-global",
|
||||
"default-props"
|
||||
"default-props",
|
||||
|
||||
// legacy
|
||||
"interop-require",
|
||||
];
|
||||
|
||||
static soloHelpers = [
|
||||
|
||||
@@ -55,7 +55,7 @@ export default class CommonJSFormatter extends DefaultFormatter {
|
||||
var uid = this.scope.generateUidBasedOnNode(node, "import");
|
||||
|
||||
nodes.push(t.variableDeclaration("var", [
|
||||
t.variableDeclarator(uid, t.callExpression(this.file.addHelper("interop-require-wildcard"), [ref]))
|
||||
t.variableDeclarator(uid, t.callExpression(this.file.addHelper("interop-require-default"), [ref]))
|
||||
]));
|
||||
|
||||
this.internalRemap[variableName.name] = t.memberExpression(uid, t.identifier("default"));
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
(function (obj) {
|
||||
return obj && obj.__esModule ? obj : { default: obj };
|
||||
})
|
||||
@@ -2,15 +2,13 @@
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
} else {
|
||||
var hop = Object.prototype.hasOwnProperty;
|
||||
var es_obj = { "default": obj };
|
||||
var newObj = {};
|
||||
if (typeof obj === "object" && obj !== null) {
|
||||
for (var key in obj) {
|
||||
if (key !== "default" && hop.call(obj, key)) {
|
||||
es_obj[key] = obj[key];
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
return es_obj;
|
||||
newObj.default = obj;
|
||||
return newObj;
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user