a simple boolean is just fine

This commit is contained in:
Jan Potoms 2018-04-06 08:53:40 +02:00
parent c629dac485
commit 33e876a84a
1 changed files with 3 additions and 9 deletions

View File

@ -74,7 +74,7 @@ class CommonJsRequireDependencyParserPlugin {
return true;
});
const createHandler = ({ callNew = false }) => expr => {
const createHandler = callNew => expr => {
if (expr.arguments.length !== 1) return;
let localModule;
const param = parser.evaluateExpression(expr.arguments[0]);
@ -121,16 +121,10 @@ class CommonJsRequireDependencyParserPlugin {
};
parser.hooks.call
.for("require")
.tap(
"CommonJsRequireDependencyParserPlugin",
createHandler({ callNew: false })
);
.tap("CommonJsRequireDependencyParserPlugin", createHandler(false));
parser.hooks.new
.for("require")
.tap(
"CommonJsRequireDependencyParserPlugin",
createHandler({ callNew: true })
);
.tap("CommonJsRequireDependencyParserPlugin", createHandler(true));
}
}
module.exports = CommonJsRequireDependencyParserPlugin;