test/dummy/node_modules/webpack/lib/ConstPlugin.js in disco_app-0.18.1 vs test/dummy/node_modules/webpack/lib/ConstPlugin.js in disco_app-0.18.2
- old
+ new
@@ -117,11 +117,10 @@
new ConstDependency.Template()
);
const handler = parser => {
parser.hooks.statementIf.tap("ConstPlugin", statement => {
- if (parser.scope.isAsmJs) return;
const param = parser.evaluateExpression(statement.test);
const bool = param.asBool();
if (typeof bool === "boolean") {
if (statement.test.type !== "Literal") {
const dep = new ConstDependency(`${bool}`, param.range);
@@ -188,11 +187,10 @@
}
});
parser.hooks.expressionConditionalOperator.tap(
"ConstPlugin",
expression => {
- if (parser.scope.isAsmJs) return;
const param = parser.evaluateExpression(expression.test);
const bool = param.asBool();
if (typeof bool === "boolean") {
if (expression.test.type !== "Literal") {
const dep = new ConstDependency(` ${bool}`, param.range);
@@ -224,11 +222,10 @@
}
);
parser.hooks.expressionLogicalOperator.tap(
"ConstPlugin",
expression => {
- if (parser.scope.isAsmJs) return;
if (
expression.operator === "&&" ||
expression.operator === "||"
) {
const param = parser.evaluateExpression(expression.left);
@@ -310,19 +307,17 @@
}
);
parser.hooks.evaluateIdentifier
.for("__resourceQuery")
.tap("ConstPlugin", expr => {
- if (parser.scope.isAsmJs) return;
if (!parser.state.module) return;
return ParserHelpers.evaluateToString(
getQuery(parser.state.module.resource)
)(expr);
});
parser.hooks.expression
.for("__resourceQuery")
.tap("ConstPlugin", () => {
- if (parser.scope.isAsmJs) return;
if (!parser.state.module) return;
parser.state.current.addVariable(
"__resourceQuery",
JSON.stringify(getQuery(parser.state.module.resource))
);