mirror of https://github.com/webpack/webpack.git
rewrite cases where js beautify and eslint disagree on formatting
This commit is contained in:
parent
e74b2f9390
commit
cf00a1a22d
|
@ -28,10 +28,8 @@ if(module.hot) {
|
|||
}
|
||||
|
||||
}).catch(function(err) {
|
||||
if(module.hot.status() in {
|
||||
abort: 1,
|
||||
fail: 1
|
||||
}) {
|
||||
var status = module.hot.status();
|
||||
if(["abort", "fail"].indexOf(status) >= 0) {
|
||||
console.warn("[HMR] Cannot apply update. Need to do a full reload!");
|
||||
console.warn("[HMR] " + err.stack || err.message);
|
||||
window.location.reload();
|
||||
|
|
|
@ -29,10 +29,8 @@ if(module.hot) {
|
|||
console.log("[HMR] App is up to date.");
|
||||
}
|
||||
}).catch(function(err) {
|
||||
if(module.hot.status() in {
|
||||
abort: 1,
|
||||
fail: 1
|
||||
}) {
|
||||
var status = module.hot.status();
|
||||
if(["abort", "fail"].indexOf(status) >= 0) {
|
||||
console.warn("[HMR] Cannot apply update. Need to do a full reload!");
|
||||
console.warn("[HMR] " + err.stack || err.message);
|
||||
} else {
|
||||
|
@ -40,10 +38,8 @@ if(module.hot) {
|
|||
}
|
||||
});
|
||||
}).catch(function(err) {
|
||||
if(module.hot.status() in {
|
||||
abort: 1,
|
||||
fail: 1
|
||||
}) {
|
||||
var status = module.hot.status();
|
||||
if(["abort", "fail"].indexOf(status) >= 0) {
|
||||
console.warn("[HMR] Cannot check for update. Need to do a full reload!");
|
||||
console.warn("[HMR] " + err.stack || err.message);
|
||||
} else {
|
||||
|
|
|
@ -16,10 +16,8 @@ if(module.hot) {
|
|||
require("./log-apply-result")(updatedModules, updatedModules);
|
||||
checkForUpdate(true);
|
||||
}).catch(function(err) {
|
||||
if(module.hot.status() in {
|
||||
abort: 1,
|
||||
fail: 1
|
||||
}) {
|
||||
var status = module.hot.status();
|
||||
if(["abort", "fail"].indexOf(status) >= 0) {
|
||||
console.warn("[HMR] Cannot apply update.");
|
||||
console.warn("[HMR] " + err.stack || err.message);
|
||||
console.warn("[HMR] You need to restart the application!");
|
||||
|
|
|
@ -18,10 +18,8 @@ if(module.hot) {
|
|||
ignoreUnaccepted: true
|
||||
}, function(err, renewedModules) {
|
||||
if(err) {
|
||||
if(module.hot.status() in {
|
||||
abort: 1,
|
||||
fail: 1
|
||||
}) {
|
||||
var status = module.hot.status();
|
||||
if(["abort", "fail"].indexOf(status) >= 0) {
|
||||
console.warn("[HMR] Cannot apply update (Need to do a full reload!)");
|
||||
console.warn("[HMR] " + err.stack || err.message);
|
||||
console.warn("[HMR] You need to restart the application!");
|
||||
|
@ -36,10 +34,8 @@ if(module.hot) {
|
|||
checkForUpdate(true);
|
||||
});
|
||||
}).catch(function(err) {
|
||||
if(module.hot.status() in {
|
||||
abort: 1,
|
||||
fail: 1
|
||||
}) {
|
||||
var status = module.hot.status();
|
||||
if(["abort", "fail"].indexOf(status) >= 0) {
|
||||
console.warn("[HMR] Cannot apply update.");
|
||||
console.warn("[HMR] " + err.stack || err.message);
|
||||
console.warn("[HMR] You need to restart the application!");
|
||||
|
|
|
@ -177,15 +177,15 @@ NormalModule.prototype.build = function build(options, compilation, resolver, fs
|
|||
this.blocks.length = 0;
|
||||
this._cachedSource = null;
|
||||
if(options.module && options.module.noParse) {
|
||||
function testRegExp(regExp) {
|
||||
return typeof regExp === "string" ?
|
||||
this.request.indexOf(regExp) === 0 :
|
||||
regExp.test(this.request);
|
||||
}
|
||||
if(Array.isArray(options.module.noParse)) {
|
||||
if(options.module.noParse.some(function(regExp) {
|
||||
return typeof regExp === "string" ?
|
||||
this.request.indexOf(regExp) === 0 :
|
||||
regExp.test(this.request);
|
||||
}, this)) return callback();
|
||||
} else if(typeof options.module.noParse === "string" ?
|
||||
this.request.indexOf(options.module.noParse) === 0 :
|
||||
options.module.noParse.test(this.request)) {
|
||||
if(options.module.noParse.some(testRegExp, this))
|
||||
return callback();
|
||||
} else if(testRegExp.call(this, options.module.noParse)) {
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
|
@ -230,9 +230,11 @@ NormalModule.prototype.source = function(dependencyTemplates, outputOptions, req
|
|||
function doVariable(availableVars, vars, variable) {
|
||||
var name = variable.name;
|
||||
var expr = variable.expressionSource(dependencyTemplates, outputOptions, requestShortener);
|
||||
if(availableVars.some(function(v) {
|
||||
|
||||
function isEqual(v) {
|
||||
return v.name === name && v.expression.source() === expr.source();
|
||||
})) return;
|
||||
}
|
||||
if(availableVars.some(isEqual)) return;
|
||||
vars.push({
|
||||
name: name,
|
||||
expression: expr
|
||||
|
|
|
@ -337,9 +337,7 @@ Parser.prototype.initializeEvaluating = function() {
|
|||
var items = expr.elements.map(function(element) {
|
||||
return element !== null && this.evaluateExpression(element);
|
||||
}, this);
|
||||
if(items.filter(function(i) {
|
||||
return !i;
|
||||
}).length > 0) return;
|
||||
if(!items.every(Boolean)) return;
|
||||
return new BasicEvaluatedExpression().setItems(items).setRange(expr.range);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -63,10 +63,12 @@ Template.prototype.asString = function(str) {
|
|||
return str;
|
||||
};
|
||||
|
||||
function moduleIdIsNumber(module) {
|
||||
return typeof module.id === "number";
|
||||
}
|
||||
|
||||
Template.prototype.getModulesArrayBounds = function(modules) {
|
||||
if(modules.some(function(module) {
|
||||
return typeof module.id !== "number";
|
||||
}))
|
||||
if(!modules.every(moduleIdIsNumber))
|
||||
return false;
|
||||
var maxId = -Infinity;
|
||||
var minId = Infinity;
|
||||
|
|
|
@ -43,9 +43,11 @@ function debugIds(chunks) {
|
|||
var list = chunks.map(function(chunk) {
|
||||
return chunk.debugId;
|
||||
});
|
||||
if(list.some(function(dId) {
|
||||
var debugIdMissing = list.some(function(dId) {
|
||||
return typeof dId !== "number";
|
||||
})) return "no";
|
||||
});
|
||||
if(debugIdMissing)
|
||||
return "no";
|
||||
list.sort();
|
||||
return list.join(",");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue