Upgrade to Prettier 2

This commit is contained in:
Mohsen Azimi 2020-03-28 18:10:15 -04:00
parent e964f0810c
commit 7b07a8db66
70 changed files with 251 additions and 270 deletions

View File

@ -2,6 +2,8 @@ module.exports = {
printWidth: 80, printWidth: 80,
useTabs: true, useTabs: true,
tabWidth: 2, tabWidth: 2,
trailingComma: "none",
arrowParens: "avoid",
overrides: [ overrides: [
{ {
files: "*.json", files: "*.json",

View File

@ -7,7 +7,7 @@ const outputPath = path.join(__dirname, "js");
const benchmarkOptions = { const benchmarkOptions = {
defer: true, defer: true,
onCycle: function() { onCycle: function () {
process.stderr.write("."); process.stderr.write(".");
}, },
minSamples: 10 minSamples: 10

View File

@ -12,7 +12,7 @@ if (module.hot) {
var check = function check() { var check = function check() {
module.hot module.hot
.check(true) .check(true)
.then(function(updatedModules) { .then(function (updatedModules) {
if (!updatedModules) { if (!updatedModules) {
log("warning", "[HMR] Cannot find update. Need to do a full reload!"); log("warning", "[HMR] Cannot find update. Need to do a full reload!");
log( log(
@ -33,7 +33,7 @@ if (module.hot) {
log("info", "[HMR] App is up to date."); log("info", "[HMR] App is up to date.");
} }
}) })
.catch(function(err) { .catch(function (err) {
var status = module.hot.status(); var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) { if (["abort", "fail"].indexOf(status) >= 0) {
log( log(
@ -48,7 +48,7 @@ if (module.hot) {
}); });
}; };
var hotEmitter = require("./emitter"); var hotEmitter = require("./emitter");
hotEmitter.on("webpackHotUpdate", function(currentHash) { hotEmitter.on("webpackHotUpdate", function (currentHash) {
lastHash = currentHash; lastHash = currentHash;
if (!upToDate() && module.hot.status() === "idle") { if (!upToDate() && module.hot.status() === "idle") {
log("info", "[HMR] Checking for updates on the server..."); log("info", "[HMR] Checking for updates on the server...");

View File

@ -2,8 +2,8 @@
MIT License http://www.opensource.org/licenses/mit-license.php MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra Author Tobias Koppers @sokra
*/ */
module.exports = function(updatedModules, renewedModules) { module.exports = function (updatedModules, renewedModules) {
var unacceptedModules = updatedModules.filter(function(moduleId) { var unacceptedModules = updatedModules.filter(function (moduleId) {
return renewedModules && renewedModules.indexOf(moduleId) < 0; return renewedModules && renewedModules.indexOf(moduleId) < 0;
}); });
var log = require("./log"); var log = require("./log");
@ -13,7 +13,7 @@ module.exports = function(updatedModules, renewedModules) {
"warning", "warning",
"[HMR] The following modules couldn't be hot updated: (They would need a full reload!)" "[HMR] The following modules couldn't be hot updated: (They would need a full reload!)"
); );
unacceptedModules.forEach(function(moduleId) { unacceptedModules.forEach(function (moduleId) {
log("warning", "[HMR] - " + moduleId); log("warning", "[HMR] - " + moduleId);
}); });
} }
@ -22,7 +22,7 @@ module.exports = function(updatedModules, renewedModules) {
log("info", "[HMR] Nothing hot updated."); log("info", "[HMR] Nothing hot updated.");
} else { } else {
log("info", "[HMR] Updated modules:"); log("info", "[HMR] Updated modules:");
renewedModules.forEach(function(moduleId) { renewedModules.forEach(function (moduleId) {
if (typeof moduleId === "string" && moduleId.indexOf("!") !== -1) { if (typeof moduleId === "string" && moduleId.indexOf("!") !== -1) {
var parts = moduleId.split("!"); var parts = moduleId.split("!");
log.groupCollapsed("info", "[HMR] - " + parts.pop()); log.groupCollapsed("info", "[HMR] - " + parts.pop());
@ -32,7 +32,7 @@ module.exports = function(updatedModules, renewedModules) {
log("info", "[HMR] - " + moduleId); log("info", "[HMR] - " + moduleId);
} }
}); });
var numberIds = renewedModules.every(function(moduleId) { var numberIds = renewedModules.every(function (moduleId) {
return typeof moduleId === "number"; return typeof moduleId === "number";
}); });
if (numberIds) if (numberIds)

View File

@ -11,14 +11,14 @@ function shouldLog(level) {
} }
function logGroup(logFn) { function logGroup(logFn) {
return function(level, msg) { return function (level, msg) {
if (shouldLog(level)) { if (shouldLog(level)) {
logFn(msg); logFn(msg);
} }
}; };
} }
module.exports = function(level, msg) { module.exports = function (level, msg) {
if (shouldLog(level)) { if (shouldLog(level)) {
if (level === "info") { if (level === "info") {
console.log(msg); console.log(msg);
@ -42,11 +42,11 @@ module.exports.groupCollapsed = logGroup(groupCollapsed);
module.exports.groupEnd = logGroup(groupEnd); module.exports.groupEnd = logGroup(groupEnd);
module.exports.setLogLevel = function(level) { module.exports.setLogLevel = function (level) {
logLevel = level; logLevel = level;
}; };
module.exports.formatError = function(err) { module.exports.formatError = function (err) {
var message = err.message; var message = err.message;
var stack = err.stack; var stack = err.stack;
if (!stack) { if (!stack) {

View File

@ -12,7 +12,7 @@ if (module.hot) {
var check = function check() { var check = function check() {
module.hot module.hot
.check() .check()
.then(function(updatedModules) { .then(function (updatedModules) {
if (!updatedModules) { if (!updatedModules) {
log("warning", "[HMR] Cannot find update. Need to do a full reload!"); log("warning", "[HMR] Cannot find update. Need to do a full reload!");
log( log(
@ -27,21 +27,21 @@ if (module.hot) {
ignoreUnaccepted: true, ignoreUnaccepted: true,
ignoreDeclined: true, ignoreDeclined: true,
ignoreErrored: true, ignoreErrored: true,
onUnaccepted: function(data) { onUnaccepted: function (data) {
log( log(
"warning", "warning",
"Ignored an update to unaccepted module " + "Ignored an update to unaccepted module " +
data.chain.join(" -> ") data.chain.join(" -> ")
); );
}, },
onDeclined: function(data) { onDeclined: function (data) {
log( log(
"warning", "warning",
"Ignored an update to declined module " + "Ignored an update to declined module " +
data.chain.join(" -> ") data.chain.join(" -> ")
); );
}, },
onErrored: function(data) { onErrored: function (data) {
log("error", data.error); log("error", data.error);
log( log(
"warning", "warning",
@ -53,7 +53,7 @@ if (module.hot) {
); );
} }
}) })
.then(function(renewedModules) { .then(function (renewedModules) {
if (!upToDate()) { if (!upToDate()) {
check(); check();
} }
@ -65,7 +65,7 @@ if (module.hot) {
} }
}); });
}) })
.catch(function(err) { .catch(function (err) {
var status = module.hot.status(); var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) { if (["abort", "fail"].indexOf(status) >= 0) {
log( log(
@ -79,7 +79,7 @@ if (module.hot) {
}); });
}; };
var hotEmitter = require("./emitter"); var hotEmitter = require("./emitter");
hotEmitter.on("webpackHotUpdate", function(currentHash) { hotEmitter.on("webpackHotUpdate", function (currentHash) {
lastHash = currentHash; lastHash = currentHash;
if (!upToDate()) { if (!upToDate()) {
var status = module.hot.status(); var status = module.hot.status();

View File

@ -11,7 +11,7 @@ if (module.hot) {
if (module.hot.status() === "idle") { if (module.hot.status() === "idle") {
module.hot module.hot
.check(true) .check(true)
.then(function(updatedModules) { .then(function (updatedModules) {
if (!updatedModules) { if (!updatedModules) {
if (fromUpdate) log("info", "[HMR] Update applied."); if (fromUpdate) log("info", "[HMR] Update applied.");
return; return;
@ -19,7 +19,7 @@ if (module.hot) {
require("./log-apply-result")(updatedModules, updatedModules); require("./log-apply-result")(updatedModules, updatedModules);
checkForUpdate(true); checkForUpdate(true);
}) })
.catch(function(err) { .catch(function (err) {
var status = module.hot.status(); var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) { if (["abort", "fail"].indexOf(status) >= 0) {
log("warning", "[HMR] Cannot apply update."); log("warning", "[HMR] Cannot apply update.");

View File

@ -8,7 +8,7 @@ if (module.hot) {
var checkForUpdate = function checkForUpdate(fromUpdate) { var checkForUpdate = function checkForUpdate(fromUpdate) {
module.hot module.hot
.check() .check()
.then(function(updatedModules) { .then(function (updatedModules) {
if (!updatedModules) { if (!updatedModules) {
if (fromUpdate) log("info", "[HMR] Update applied."); if (fromUpdate) log("info", "[HMR] Update applied.");
else log("warning", "[HMR] Cannot find update."); else log("warning", "[HMR] Cannot find update.");
@ -18,7 +18,7 @@ if (module.hot) {
return module.hot return module.hot
.apply({ .apply({
ignoreUnaccepted: true, ignoreUnaccepted: true,
onUnaccepted: function(data) { onUnaccepted: function (data) {
log( log(
"warning", "warning",
"Ignored an update to unaccepted module " + "Ignored an update to unaccepted module " +
@ -26,14 +26,14 @@ if (module.hot) {
); );
} }
}) })
.then(function(renewedModules) { .then(function (renewedModules) {
require("./log-apply-result")(updatedModules, renewedModules); require("./log-apply-result")(updatedModules, renewedModules);
checkForUpdate(true); checkForUpdate(true);
return null; return null;
}); });
}) })
.catch(function(err) { .catch(function (err) {
var status = module.hot.status(); var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) { if (["abort", "fail"].indexOf(status) >= 0) {
log("warning", "[HMR] Cannot apply update."); log("warning", "[HMR] Cannot apply update.");
@ -45,7 +45,7 @@ if (module.hot) {
}); });
}; };
process.on(__resourceQuery.substr(1) || "SIGUSR2", function() { process.on(__resourceQuery.substr(1) || "SIGUSR2", function () {
if (module.hot.status() !== "idle") { if (module.hot.status() !== "idle") {
log( log(
"warning", "warning",

View File

@ -126,7 +126,7 @@ Object.defineProperty(ChunkTemplate.prototype, "outputOptions", {
* @this {ChunkTemplate} * @this {ChunkTemplate}
* @returns {TODO} output options * @returns {TODO} output options
*/ */
function() { function () {
return this._outputOptions; return this._outputOptions;
}, },
"ChunkTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)", "ChunkTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)",

View File

@ -104,7 +104,7 @@ class ContextModule extends Module {
// Info from Factory // Info from Factory
this.resolveDependencies = resolveDependencies; this.resolveDependencies = resolveDependencies;
/** @type {ContextModuleOptions} */ /** @type {ContextModuleOptions} */
this.options = ({ this.options = {
resource: resource, resource: resource,
resourceQuery: resourceQuery, resourceQuery: resourceQuery,
mode: options.mode, mode: options.mode,
@ -116,7 +116,7 @@ class ContextModule extends Module {
chunkName: options.chunkName, chunkName: options.chunkName,
groupOptions: options.groupOptions, groupOptions: options.groupOptions,
namespaceObject: options.namespaceObject namespaceObject: options.namespaceObject
}); };
if (options.resolveOptions !== undefined) { if (options.resolveOptions !== undefined) {
this.resolveOptions = options.resolveOptions; this.resolveOptions = options.resolveOptions;
} }

View File

@ -79,8 +79,7 @@ class EvalSourceMapDevToolPlugin {
} else if (m instanceof ConcatenatedModule) { } else if (m instanceof ConcatenatedModule) {
const concatModule = /** @type {ConcatenatedModule} */ (m); const concatModule = /** @type {ConcatenatedModule} */ (m);
if (concatModule.rootModule instanceof NormalModule) { if (concatModule.rootModule instanceof NormalModule) {
const module = const module = /** @type {NormalModule} */ (concatModule.rootModule);
/** @type {NormalModule} */ (concatModule.rootModule);
if (!matchModule(module.resource)) { if (!matchModule(module.resource)) {
return source; return source;
} }

View File

@ -298,7 +298,7 @@ Object.defineProperty(MainTemplate.prototype, "outputOptions", {
* @this {MainTemplate} * @this {MainTemplate}
* @returns {TODO} output options * @returns {TODO} output options
*/ */
function() { function () {
return this._outputOptions; return this._outputOptions;
}, },
"MainTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)", "MainTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)",

View File

@ -703,11 +703,7 @@ class Module extends DependenciesBlock {
const sources = this.codeGeneration(sourceContext).sources; const sources = this.codeGeneration(sourceContext).sources;
return sourceContext.type return sourceContext.type
? sources.get(sourceContext.type) ? sources.get(sourceContext.type)
: sources.get( : sources.get(this.getSourceTypes().values().next().value);
this.getSourceTypes()
.values()
.next().value
);
} }
/** /**
@ -868,7 +864,7 @@ Object.defineProperty(Module.prototype, "errors", {
* @this {Module} * @this {Module}
* @returns {WebpackError[]} array * @returns {WebpackError[]} array
*/ */
function() { function () {
if (this._errors === undefined) { if (this._errors === undefined) {
this._errors = []; this._errors = [];
} }
@ -886,7 +882,7 @@ Object.defineProperty(Module.prototype, "warnings", {
* @this {Module} * @this {Module}
* @returns {WebpackError[]} array * @returns {WebpackError[]} array
*/ */
function() { function () {
if (this._warnings === undefined) { if (this._warnings === undefined) {
this._warnings = []; this._warnings = [];
} }

View File

@ -20,10 +20,7 @@ class ModuleDependencyError extends WebpackError {
super(err.message); super(err.message);
this.name = "ModuleDependencyError"; this.name = "ModuleDependencyError";
this.details = err.stack this.details = err.stack.split("\n").slice(1).join("\n");
.split("\n")
.slice(1)
.join("\n");
this.module = module; this.module = module;
this.loc = loc; this.loc = loc;
this.error = err; this.error = err;

View File

@ -19,10 +19,7 @@ module.exports = class ModuleDependencyWarning extends WebpackError {
super(err.message); super(err.message);
this.name = "ModuleDependencyWarning"; this.name = "ModuleDependencyWarning";
this.details = err.stack this.details = err.stack.split("\n").slice(1).join("\n");
.split("\n")
.slice(1)
.join("\n");
this.module = module; this.module = module;
this.loc = loc; this.loc = loc;
this.error = err; this.error = err;

View File

@ -88,10 +88,7 @@ ModuleFilenameHelpers.createFilename = (
shortIdentifier = module.readableIdentifier(requestShortener); shortIdentifier = module.readableIdentifier(requestShortener);
identifier = requestShortener.shorten(module.identifier()); identifier = requestShortener.shorten(module.identifier());
moduleId = chunkGraph.getModuleId(module); moduleId = chunkGraph.getModuleId(module);
absoluteResourcePath = module absoluteResourcePath = module.identifier().split("!").pop();
.identifier()
.split("!")
.pop();
hash = getHash(identifier); hash = getHash(identifier);
} }
const resource = shortIdentifier.split("!").pop(); const resource = shortIdentifier.split("!").pop();

View File

@ -140,7 +140,7 @@ Object.defineProperty(ModuleTemplate.prototype, "runtimeTemplate", {
* @this {ModuleTemplate} * @this {ModuleTemplate}
* @returns {TODO} output options * @returns {TODO} output options
*/ */
function() { function () {
return this._runtimeTemplate; return this._runtimeTemplate;
}, },
"ModuleTemplate.runtimeTemplate is deprecated (use Compilation.runtimeTemplate instead)", "ModuleTemplate.runtimeTemplate is deprecated (use Compilation.runtimeTemplate instead)",

View File

@ -117,9 +117,7 @@ const getNormalizedWebpackOptions = config => {
entry: nestedConfig(config.entry, entry => { entry: nestedConfig(config.entry, entry => {
if (typeof entry === "function") { if (typeof entry === "function") {
return () => return () =>
Promise.resolve() Promise.resolve().then(entry).then(getNormalizedEntryStatic);
.then(entry)
.then(getNormalizedEntryStatic);
} }
return getNormalizedEntryStatic(entry); return getNormalizedEntryStatic(entry);
}), }),

View File

@ -14,7 +14,7 @@ var $hmrDownloadManifest$ = undefined;
var $hmrDownloadUpdateHandlers$ = undefined; var $hmrDownloadUpdateHandlers$ = undefined;
var __webpack_require__ = undefined; var __webpack_require__ = undefined;
module.exports = function() { module.exports = function () {
var currentHash = $getFullHash$(); var currentHash = $getFullHash$();
var currentModuleData = {}; var currentModuleData = {};
var installedModules = $moduleCache$; var installedModules = $moduleCache$;
@ -36,11 +36,11 @@ module.exports = function() {
$hmrModuleData$ = currentModuleData; $hmrModuleData$ = currentModuleData;
$getFullHash$ = function() { $getFullHash$ = function () {
return currentHash; return currentHash;
}; };
$interceptModuleExecution$.push(function(options) { $interceptModuleExecution$.push(function (options) {
var module = options.module; var module = options.module;
var require = createRequire(options.require, options.id); var require = createRequire(options.require, options.id);
module.hot = createModuleHotObject(options.id, module); module.hot = createModuleHotObject(options.id, module);
@ -55,7 +55,7 @@ module.exports = function() {
function createRequire(require, moduleId) { function createRequire(require, moduleId) {
var me = installedModules[moduleId]; var me = installedModules[moduleId];
if (!me) return require; if (!me) return require;
var fn = function(request) { var fn = function (request) {
if (me.hot.active) { if (me.hot.active) {
if (installedModules[request]) { if (installedModules[request]) {
var parents = installedModules[request].parents; var parents = installedModules[request].parents;
@ -80,14 +80,14 @@ module.exports = function() {
} }
return require(request); return require(request);
}; };
var createPropertyDescriptor = function(name) { var createPropertyDescriptor = function (name) {
return { return {
configurable: true, configurable: true,
enumerable: true, enumerable: true,
get: function() { get: function () {
return require[name]; return require[name];
}, },
set: function(value) { set: function (value) {
require[name] = value; require[name] = value;
} }
}; };
@ -97,7 +97,7 @@ module.exports = function() {
Object.defineProperty(fn, name, createPropertyDescriptor(name)); Object.defineProperty(fn, name, createPropertyDescriptor(name));
} }
} }
fn.e = function(chunkId) { fn.e = function (chunkId) {
return trackBlockingPromise(require.e(chunkId)); return trackBlockingPromise(require.e(chunkId));
}; };
return fn; return fn;
@ -112,7 +112,7 @@ module.exports = function() {
_selfDeclined: false, _selfDeclined: false,
_disposeHandlers: [], _disposeHandlers: [],
_main: currentChildModule !== moduleId, _main: currentChildModule !== moduleId,
_requireSelf: function() { _requireSelf: function () {
currentParents = me.parents.slice(); currentParents = me.parents.slice();
currentChildModule = moduleId; currentChildModule = moduleId;
__webpack_require__(moduleId); __webpack_require__(moduleId);
@ -120,28 +120,28 @@ module.exports = function() {
// Module API // Module API
active: true, active: true,
accept: function(dep, callback) { accept: function (dep, callback) {
if (dep === undefined) hot._selfAccepted = true; if (dep === undefined) hot._selfAccepted = true;
else if (typeof dep === "function") hot._selfAccepted = dep; else if (typeof dep === "function") hot._selfAccepted = dep;
else if (typeof dep === "object" && dep !== null) else if (typeof dep === "object" && dep !== null)
for (var i = 0; i < dep.length; i++) for (var i = 0; i < dep.length; i++)
hot._acceptedDependencies[dep[i]] = callback || function() {}; hot._acceptedDependencies[dep[i]] = callback || function () {};
else hot._acceptedDependencies[dep] = callback || function() {}; else hot._acceptedDependencies[dep] = callback || function () {};
}, },
decline: function(dep) { decline: function (dep) {
if (dep === undefined) hot._selfDeclined = true; if (dep === undefined) hot._selfDeclined = true;
else if (typeof dep === "object" && dep !== null) else if (typeof dep === "object" && dep !== null)
for (var i = 0; i < dep.length; i++) for (var i = 0; i < dep.length; i++)
hot._declinedDependencies[dep[i]] = true; hot._declinedDependencies[dep[i]] = true;
else hot._declinedDependencies[dep] = true; else hot._declinedDependencies[dep] = true;
}, },
dispose: function(callback) { dispose: function (callback) {
hot._disposeHandlers.push(callback); hot._disposeHandlers.push(callback);
}, },
addDisposeHandler: function(callback) { addDisposeHandler: function (callback) {
hot._disposeHandlers.push(callback); hot._disposeHandlers.push(callback);
}, },
removeDisposeHandler: function(callback) { removeDisposeHandler: function (callback) {
var idx = hot._disposeHandlers.indexOf(callback); var idx = hot._disposeHandlers.indexOf(callback);
if (idx >= 0) hot._disposeHandlers.splice(idx, 1); if (idx >= 0) hot._disposeHandlers.splice(idx, 1);
}, },
@ -149,14 +149,14 @@ module.exports = function() {
// Management API // Management API
check: hotCheck, check: hotCheck,
apply: hotApply, apply: hotApply,
status: function(l) { status: function (l) {
if (!l) return currentStatus; if (!l) return currentStatus;
registeredStatusHandlers.push(l); registeredStatusHandlers.push(l);
}, },
addStatusHandler: function(l) { addStatusHandler: function (l) {
registeredStatusHandlers.push(l); registeredStatusHandlers.push(l);
}, },
removeStatusHandler: function(l) { removeStatusHandler: function (l) {
var idx = registeredStatusHandlers.indexOf(l); var idx = registeredStatusHandlers.indexOf(l);
if (idx >= 0) registeredStatusHandlers.splice(idx, 1); if (idx >= 0) registeredStatusHandlers.splice(idx, 1);
}, },
@ -179,7 +179,7 @@ module.exports = function() {
case "ready": case "ready":
setStatus("prepare"); setStatus("prepare");
blockingPromises.push(promise); blockingPromises.push(promise);
waitForBlockingPromises(function() { waitForBlockingPromises(function () {
setStatus("ready"); setStatus("ready");
}); });
return promise; return promise;
@ -195,7 +195,7 @@ module.exports = function() {
if (blockingPromises.length === 0) return fn(); if (blockingPromises.length === 0) return fn();
var blocker = blockingPromises; var blocker = blockingPromises;
blockingPromises = []; blockingPromises = [];
return Promise.all(blocker).then(function() { return Promise.all(blocker).then(function () {
return waitForBlockingPromises(fn); return waitForBlockingPromises(fn);
}); });
} }
@ -205,7 +205,7 @@ module.exports = function() {
throw new Error("check() is only allowed in idle status"); throw new Error("check() is only allowed in idle status");
} }
setStatus("check"); setStatus("check");
return $hmrDownloadManifest$().then(function(update) { return $hmrDownloadManifest$().then(function (update) {
if (!update) { if (!update) {
setStatus("idle"); setStatus("idle");
return null; return null;
@ -219,7 +219,7 @@ module.exports = function() {
currentUpdateApplyHandlers = []; currentUpdateApplyHandlers = [];
return Promise.all( return Promise.all(
Object.keys($hmrDownloadUpdateHandlers$).reduce(function( Object.keys($hmrDownloadUpdateHandlers$).reduce(function (
promises, promises,
key key
) { ) {
@ -234,8 +234,8 @@ module.exports = function() {
return promises; return promises;
}, },
[]) [])
).then(function() { ).then(function () {
return waitForBlockingPromises(function() { return waitForBlockingPromises(function () {
if (applyOnUpdate) { if (applyOnUpdate) {
return internalApply(applyOnUpdate); return internalApply(applyOnUpdate);
} else { } else {
@ -250,7 +250,7 @@ module.exports = function() {
function hotApply(options) { function hotApply(options) {
if (currentStatus !== "ready") { if (currentStatus !== "ready") {
return Promise.resolve().then(function() { return Promise.resolve().then(function () {
throw new Error("apply() is only allowed in ready status"); throw new Error("apply() is only allowed in ready status");
}); });
} }
@ -260,19 +260,19 @@ module.exports = function() {
function internalApply(options) { function internalApply(options) {
options = options || {}; options = options || {};
var results = currentUpdateApplyHandlers.map(function(handler) { var results = currentUpdateApplyHandlers.map(function (handler) {
return handler(options); return handler(options);
}); });
var errors = results var errors = results
.map(function(r) { .map(function (r) {
return r.error; return r.error;
}) })
.filter(Boolean); .filter(Boolean);
if (errors.length > 0) { if (errors.length > 0) {
setStatus("abort"); setStatus("abort");
return Promise.resolve().then(function() { return Promise.resolve().then(function () {
throw errors[0]; throw errors[0];
}); });
} }
@ -280,7 +280,7 @@ module.exports = function() {
// Now in "dispose" phase // Now in "dispose" phase
setStatus("dispose"); setStatus("dispose");
results.forEach(function(result) { results.forEach(function (result) {
if (result.dispose) result.dispose(); if (result.dispose) result.dispose();
}); });
@ -290,12 +290,12 @@ module.exports = function() {
currentHash = currentUpdateNewHash; currentHash = currentUpdateNewHash;
var error; var error;
var reportError = function(err) { var reportError = function (err) {
if (!error) error = err; if (!error) error = err;
}; };
var outdatedModules = []; var outdatedModules = [];
results.forEach(function(result) { results.forEach(function (result) {
if (result.apply) { if (result.apply) {
var modules = result.apply(reportError); var modules = result.apply(reportError);
if (modules) { if (modules) {
@ -309,7 +309,7 @@ module.exports = function() {
// handle errors in accept handlers and self accepted module load // handle errors in accept handlers and self accepted module load
if (error) { if (error) {
setStatus("fail"); setStatus("fail");
return Promise.resolve().then(function() { return Promise.resolve().then(function () {
throw error; throw error;
}); });
} }

View File

@ -13,12 +13,12 @@ var $moduleFactories$ = undefined;
var $hmrModuleData$ = undefined; var $hmrModuleData$ = undefined;
var __webpack_require__ = undefined; var __webpack_require__ = undefined;
module.exports = function() { module.exports = function () {
function getAffectedModuleEffects(updateModuleId) { function getAffectedModuleEffects(updateModuleId) {
var outdatedModules = [updateModuleId]; var outdatedModules = [updateModuleId];
var outdatedDependencies = {}; var outdatedDependencies = {};
var queue = outdatedModules.map(function(id) { var queue = outdatedModules.map(function (id) {
return { return {
chain: [id], chain: [id],
id: id id: id
@ -211,7 +211,7 @@ module.exports = function() {
var moduleOutdatedDependencies; var moduleOutdatedDependencies;
return { return {
dispose: function() { dispose: function () {
// $dispose$ // $dispose$
var idx; var idx;
@ -271,7 +271,7 @@ module.exports = function() {
} }
} }
}, },
apply: function(reportError) { apply: function (reportError) {
// insert new code // insert new code
for (var updateModuleId in appliedUpdate) { for (var updateModuleId in appliedUpdate) {
if ( if (

View File

@ -152,8 +152,7 @@ class JavascriptGenerator extends Generator {
* @returns {void} * @returns {void}
*/ */
sourceDependency(module, dependency, initFragments, source, generateContext) { sourceDependency(module, dependency, initFragments, source, generateContext) {
const constructor = const constructor = /** @type {new (...args: any[]) => Dependency} */ (dependency.constructor);
/** @type {new (...args: any[]) => Dependency} */ (dependency.constructor);
const template = generateContext.dependencyTemplates.get(constructor); const template = generateContext.dependencyTemplates.get(constructor);
if (!template) { if (!template) {
throw new Error( throw new Error(

View File

@ -907,9 +907,8 @@ class ConcatenatedModule extends Module {
}) })
.map(connection => ({ .map(connection => ({
connection, connection,
sourceOrder: sourceOrder: /** @type {HarmonyImportDependency} */ (connection.dependency)
/** @type {HarmonyImportDependency} */ (connection.dependency) .sourceOrder
.sourceOrder
})); }));
references.sort( references.sort(
concatComparators(bySourceOrder, keepOriginalOrder(references)) concatComparators(bySourceOrder, keepOriginalOrder(references))

View File

@ -234,8 +234,7 @@ class InnerGraphPlugin {
parser.hooks.expression parser.hooks.expression
.for(topLevelSymbolTag) .for(topLevelSymbolTag)
.tap("InnerGraphPlugin", () => { .tap("InnerGraphPlugin", () => {
const topLevelSymbol = const topLevelSymbol = /** @type {TopLevelSymbol} */ (parser.currentTagData);
/** @type {TopLevelSymbol} */ (parser.currentTagData);
const currentTopLevelSymbol = InnerGraph.getTopLevelSymbol( const currentTopLevelSymbol = InnerGraph.getTopLevelSymbol(
parser.state parser.state
); );

View File

@ -185,15 +185,16 @@ class ModuleConcatenationPlugin {
); );
const importingModuleTypes = new Map( const importingModuleTypes = new Map(
Array.from(importingModules).map( Array.from(importingModules).map(
m => /** @type {[Module, Set<string>]} */ ([ m =>
m, /** @type {[Module, Set<string>]} */ ([
new Set( m,
nonHarmonyConnections new Set(
.filter(c => c.originModule === m) nonHarmonyConnections
.map(c => c.dependency.type) .filter(c => c.originModule === m)
.sort() .map(c => c.dependency.type)
) .sort()
]) )
])
) )
); );
const names = Array.from(importingModules) const names = Array.from(importingModules)

View File

@ -1213,8 +1213,9 @@ module.exports = class SplitChunksPlugin {
minSizeValue > maxSizeValue minSizeValue > maxSizeValue
) { ) {
const keys = chunkConfig && chunkConfig.keys; const keys = chunkConfig && chunkConfig.keys;
const warningKey = `${keys && const warningKey = `${
keys.join()} ${minSizeValue} ${maxSizeValue}`; keys && keys.join()
} ${minSizeValue} ${maxSizeValue}`;
if (!incorrectMinMaxSizeSet.has(warningKey)) { if (!incorrectMinMaxSizeSet.has(warningKey)) {
incorrectMinMaxSizeSet.add(warningKey); incorrectMinMaxSizeSet.add(warningKey);
compilation.warnings.push( compilation.warnings.push(

View File

@ -435,8 +435,9 @@ const SIMPLE_EXTRACTORS = {
} }
let message = undefined; let message = undefined;
if (entry.type === LogType.time) { if (entry.type === LogType.time) {
message = `${entry.args[0]}: ${entry.args[1] * 1000 + message = `${entry.args[0]}: ${
entry.args[2] / 1000000}ms`; entry.args[1] * 1000 + entry.args[2] / 1000000
}ms`;
} else if (entry.args && entry.args.length > 0) { } else if (entry.args && entry.args.length > 0) {
message = util.format(entry.args[0], ...entry.args.slice(1)); message = util.format(entry.args[0], ...entry.args.slice(1));
} }
@ -500,22 +501,22 @@ const SIMPLE_EXTRACTORS = {
compilationAuxiliaryFileToChunks.get(asset.name) || []; compilationAuxiliaryFileToChunks.get(asset.name) || [];
object.chunkNames = uniqueOrderedArray( object.chunkNames = uniqueOrderedArray(
chunks, chunks,
c => ((c.name ? [c.name] : [])), c => (c.name ? [c.name] : []),
compareIds compareIds
); );
object.chunkIdHints = uniqueOrderedArray( object.chunkIdHints = uniqueOrderedArray(
chunks, chunks,
c => (Array.from(c.idNameHints)), c => Array.from(c.idNameHints),
compareIds compareIds
); );
object.auxiliaryChunkNames = uniqueOrderedArray( object.auxiliaryChunkNames = uniqueOrderedArray(
auxiliaryChunks, auxiliaryChunks,
c => ((c.name ? [c.name] : [])), c => (c.name ? [c.name] : []),
compareIds compareIds
); );
object.auxiliaryChunkIdHints = uniqueOrderedArray( object.auxiliaryChunkIdHints = uniqueOrderedArray(
auxiliaryChunks, auxiliaryChunks,
c => (Array.from(c.idNameHints)), c => Array.from(c.idNameHints),
compareIds compareIds
); );
object.emitted = compilation.emittedAssets.has(asset.name); object.emitted = compilation.emittedAssets.has(asset.name);
@ -986,25 +987,25 @@ const FILTER = {
} }
} }
}, },
"compilation.modules": ({ "compilation.modules": {
excludeModules: EXCLUDE_MODULES_FILTER("module"), excludeModules: EXCLUDE_MODULES_FILTER("module"),
"!orphanModules": (module, { compilation: { chunkGraph } }) => { "!orphanModules": (module, { compilation: { chunkGraph } }) => {
if (chunkGraph.getNumberOfModuleChunks(module) === 0) return false; if (chunkGraph.getNumberOfModuleChunks(module) === 0) return false;
}, },
...BASE_MODULES_FILTER ...BASE_MODULES_FILTER
}), },
"module.modules": ({ "module.modules": {
excludeModules: EXCLUDE_MODULES_FILTER("nested"), excludeModules: EXCLUDE_MODULES_FILTER("nested"),
...BASE_MODULES_FILTER ...BASE_MODULES_FILTER
}), },
"chunk.modules": ({ "chunk.modules": {
excludeModules: EXCLUDE_MODULES_FILTER("chunk"), excludeModules: EXCLUDE_MODULES_FILTER("chunk"),
...BASE_MODULES_FILTER ...BASE_MODULES_FILTER
}), },
"chunk.rootModules": ({ "chunk.rootModules": {
excludeModules: EXCLUDE_MODULES_FILTER("root-of-chunk"), excludeModules: EXCLUDE_MODULES_FILTER("root-of-chunk"),
...BASE_MODULES_FILTER ...BASE_MODULES_FILTER
}) }
}; };
/** @type {Record<string, (module: Module, context: UsualContext, options: UsualOptions, idx: number, i: number) => boolean | undefined>} */ /** @type {Record<string, (module: Module, context: UsualContext, options: UsualOptions, idx: number, i: number) => boolean | undefined>} */

View File

@ -152,12 +152,12 @@ const DEFAULTS = {
warnings: NORMAL_ON, warnings: NORMAL_ON,
publicPath: OFF_FOR_TO_STRING, publicPath: OFF_FOR_TO_STRING,
logging: ({ all }, { forToString }) => logging: ({ all }, { forToString }) =>
(forToString && all !== false ? "info" : false), forToString && all !== false ? "info" : false,
loggingDebug: () => [], loggingDebug: () => [],
loggingTrace: OFF_FOR_TO_STRING, loggingTrace: OFF_FOR_TO_STRING,
excludeModules: () => [], excludeModules: () => [],
excludeAssets: () => [], excludeAssets: () => [],
maxModules: (o, { forToString }) => ((forToString ? 15 : Infinity)), maxModules: (o, { forToString }) => (forToString ? 15 : Infinity),
modulesSort: () => "depth", modulesSort: () => "depth",
chunkModulesSort: () => "name", chunkModulesSort: () => "name",
chunkRootModulesSort: () => "name", chunkRootModulesSort: () => "name",

View File

@ -43,11 +43,7 @@ const printSizes = (sizes, { formatSize }) => {
} }
}; };
const mapLines = (str, fn) => const mapLines = (str, fn) => str.split("\n").map(fn).join("\n");
str
.split("\n")
.map(fn)
.join("\n");
/** /**
* @param {number} n a number * @param {number} n a number
@ -84,10 +80,10 @@ const SIMPLE_PRINTERS = {
"compilation.entrypoints": (entrypoints, context, printer) => "compilation.entrypoints": (entrypoints, context, printer) =>
Array.isArray(entrypoints) Array.isArray(entrypoints)
? undefined ? undefined
: printer.print(context.type, Object.values(entrypoints), ({ : printer.print(context.type, Object.values(entrypoints), {
...context, ...context,
chunkGroupKind: "Entrypoint" chunkGroupKind: "Entrypoint"
})), }),
"compilation.namedChunkGroups": (namedChunkGroups, context, printer) => { "compilation.namedChunkGroups": (namedChunkGroups, context, printer) => {
if (!Array.isArray(namedChunkGroups)) { if (!Array.isArray(namedChunkGroups)) {
const { const {
@ -100,10 +96,10 @@ const SIMPLE_PRINTERS = {
!Object.prototype.hasOwnProperty.call(entrypoints, group.name) !Object.prototype.hasOwnProperty.call(entrypoints, group.name)
); );
} }
return printer.print(context.type, chunkGroups, ({ return printer.print(context.type, chunkGroups, {
...context, ...context,
chunkGroupKind: "Chunk Group" chunkGroupKind: "Chunk Group"
})); });
} }
}, },
"compilation.assetsByChunkName": () => "", "compilation.assetsByChunkName": () => "",
@ -152,7 +148,7 @@ const SIMPLE_PRINTERS = {
"asset.size": ( "asset.size": (
size, size,
{ asset: { isOverSizeLimit }, yellow, green, formatSize } { asset: { isOverSizeLimit }, yellow, green, formatSize }
) => ((isOverSizeLimit ? yellow(formatSize(size)) : formatSize(size))), ) => (isOverSizeLimit ? yellow(formatSize(size)) : formatSize(size)),
"asset.emitted": (emitted, { green, formatFlag }) => "asset.emitted": (emitted, { green, formatFlag }) =>
emitted ? green(formatFlag("emitted")) : undefined, emitted ? green(formatFlag("emitted")) : undefined,
"asset.comparedForEmit": (comparedForEmit, { yellow, formatFlag }) => "asset.comparedForEmit": (comparedForEmit, { yellow, formatFlag }) =>
@ -167,7 +163,7 @@ const SIMPLE_PRINTERS = {
"asset.info.hotModuleReplacement": ( "asset.info.hotModuleReplacement": (
hotModuleReplacement, hotModuleReplacement,
{ green, formatFlag } { green, formatFlag }
) => ((hotModuleReplacement ? green(formatFlag("hmr")) : undefined)), ) => (hotModuleReplacement ? green(formatFlag("hmr")) : undefined),
assetChunk: (id, { formatChunkId }) => formatChunkId(id), assetChunk: (id, { formatChunkId }) => formatChunkId(id),
@ -350,8 +346,7 @@ const SIMPLE_PRINTERS = {
rendered ? green(formatFlag("rendered")) : undefined, rendered ? green(formatFlag("rendered")) : undefined,
"chunk.recorded": (recorded, { formatFlag, green }) => "chunk.recorded": (recorded, { formatFlag, green }) =>
recorded ? green(formatFlag("recorded")) : undefined, recorded ? green(formatFlag("recorded")) : undefined,
"chunk.reason": (reason, { yellow }) => "chunk.reason": (reason, { yellow }) => (reason ? yellow(reason) : undefined),
(reason ? yellow(reason) : undefined),
"chunk.rootModules": (modules, context) => { "chunk.rootModules": (modules, context) => {
let maxModuleId = 0; let maxModuleId = 0;
for (const module of modules) { for (const module of modules) {
@ -462,7 +457,7 @@ const SIMPLE_PRINTERS = {
loggingGroup: loggingGroup => loggingGroup: loggingGroup =>
loggingGroup.entries.length === 0 ? "" : undefined, loggingGroup.entries.length === 0 ? "" : undefined,
"loggingGroup.debug": (flag, { red }) => ((flag ? red("DEBUG") : undefined)), "loggingGroup.debug": (flag, { red }) => (flag ? red("DEBUG") : undefined),
"loggingGroup.name": (name, { bold }) => bold(`LOG from ${name}`), "loggingGroup.name": (name, { bold }) => bold(`LOG from ${name}`),
"loggingGroup.separator!": () => "\n", "loggingGroup.separator!": () => "\n",
"loggingGroup.filteredEntries": filteredEntries => "loggingGroup.filteredEntries": filteredEntries =>
@ -830,7 +825,7 @@ const SIMPLE_ELEMENT_JOINERS = {
if (maxModuleId >= 10) prefix += " "; if (maxModuleId >= 10) prefix += " ";
} }
return ( return (
(prefix + prefix +
joinExplicitNewLine( joinExplicitNewLine(
items.filter(item => { items.filter(item => {
switch (item.element) { switch (item.element) {
@ -846,13 +841,13 @@ const SIMPLE_ELEMENT_JOINERS = {
return true; return true;
}), }),
indenter indenter
)) )
); );
}, },
chunk: items => { chunk: items => {
let hasEntry = false; let hasEntry = false;
return ( return (
("chunk " + "chunk " +
joinExplicitNewLine( joinExplicitNewLine(
items.filter(item => { items.filter(item => {
switch (item.element) { switch (item.element) {
@ -866,7 +861,7 @@ const SIMPLE_ELEMENT_JOINERS = {
return true; return true;
}), }),
" " " "
)) )
); );
}, },
"chunk.childrenByOrder[]": items => `(${joinOneLine(items)})`, "chunk.childrenByOrder[]": items => `(${joinOneLine(items)})`,
@ -886,8 +881,8 @@ const SIMPLE_ELEMENT_JOINERS = {
break; break;
case "resolvedModule": case "resolvedModule":
return ( return (
(moduleReason.module !== moduleReason.resolvedModule && moduleReason.module !== moduleReason.resolvedModule &&
item.content) item.content
); );
} }
return true; return true;

View File

@ -74,7 +74,7 @@ exports.arrayToSetDeprecation = (set, name) => {
* @this {Set} * @this {Set}
* @returns {number} count * @returns {number} count
*/ */
set[method] = function() { set[method] = function () {
d(); d();
const array = Array.from(this); const array = Array.from(this);
return Array.prototype[method].apply(array, arguments); return Array.prototype[method].apply(array, arguments);
@ -97,7 +97,7 @@ exports.arrayToSetDeprecation = (set, name) => {
* @this {Set} * @this {Set}
* @returns {number} count * @returns {number} count
*/ */
set.push = function() { set.push = function () {
dPush(); dPush();
for (const item of Array.from(arguments)) { for (const item of Array.from(arguments)) {
this.add(item); this.add(item);
@ -117,7 +117,7 @@ exports.arrayToSetDeprecation = (set, name) => {
* @this {Set} a Set * @this {Set} a Set
* @returns {any} the value at this location * @returns {any} the value at this location
*/ */
const fn = function() { const fn = function () {
dIndexer(); dIndexer();
let i = 0; let i = 0;
for (const item of this) { for (const item of this) {

View File

@ -64,8 +64,7 @@ const validateSchema = (schema, options) => {
} }
if (error.keyword === "additionalProperties") { if (error.keyword === "additionalProperties") {
const params = const params = /** @type {import("ajv").AdditionalPropertiesParams} */ (error.params);
/** @type {import("ajv").AdditionalPropertiesParams} */ (error.params);
if ( if (
Object.prototype.hasOwnProperty.call( Object.prototype.hasOwnProperty.call(
DID_YOU_MEAN, DID_YOU_MEAN,

View File

@ -68,7 +68,7 @@
"mini-css-extract-plugin": "^0.8.0", "mini-css-extract-plugin": "^0.8.0",
"mini-svg-data-uri": "^1.1.3", "mini-svg-data-uri": "^1.1.3",
"open-cli": "^5.0.0", "open-cli": "^5.0.0",
"prettier": "^1.14.3", "prettier": "2",
"pretty-format": "^25.1.0", "pretty-format": "^25.1.0",
"pug": "^2.0.4", "pug": "^2.0.4",
"pug-loader": "^2.4.0", "pug-loader": "^2.4.0",

View File

@ -96,11 +96,7 @@ function execGetOutput(command, args, description) {
if (exitCode) { if (exitCode) {
reject(`${description} failed with exit code ${exitCode}`); reject(`${description} failed with exit code ${exitCode}`);
} else { } else {
resolve( resolve(Buffer.concat(buffers).toString("utf-8").trim());
Buffer.concat(buffers)
.toString("utf-8")
.trim()
);
} }
}); });
const buffers = []; const buffers = [];

View File

@ -6,9 +6,9 @@ const asyncLib = require("neo-async");
const Benchmark = require("benchmark"); const Benchmark = require("benchmark");
const { remove } = require("./helpers/remove"); const { remove } = require("./helpers/remove");
describe("BenchmarkTestCases", function() { describe("BenchmarkTestCases", function () {
const casesPath = path.join(__dirname, "benchmarkCases"); const casesPath = path.join(__dirname, "benchmarkCases");
const tests = fs.readdirSync(casesPath).filter(function(folder) { const tests = fs.readdirSync(casesPath).filter(function (folder) {
return ( return (
folder.indexOf("_") < 0 && folder.indexOf("_") < 0 &&
fs.existsSync(path.resolve(casesPath, folder, "webpack.config.js")) fs.existsSync(path.resolve(casesPath, folder, "webpack.config.js"))
@ -25,7 +25,7 @@ describe("BenchmarkTestCases", function() {
fs.mkdirSync(baselinesPath); fs.mkdirSync(baselinesPath);
} catch (e) {} // eslint-disable-line no-empty } catch (e) {} // eslint-disable-line no-empty
beforeAll(function(done) { beforeAll(function (done) {
const git = require("simple-git"); const git = require("simple-git");
const rootPath = path.join(__dirname, ".."); const rootPath = path.join(__dirname, "..");
getBaselineRevs(rootPath, (err, baselineRevisions) => { getBaselineRevs(rootPath, (err, baselineRevisions) => {
@ -231,7 +231,7 @@ describe("BenchmarkTestCases", function() {
const warmupCompiler = webpack(config, (err, stats) => { const warmupCompiler = webpack(config, (err, stats) => {
warmupCompiler.purgeInputFileSystem(); warmupCompiler.purgeInputFileSystem();
const bench = new Benchmark( const bench = new Benchmark(
function(deferred) { function (deferred) {
const compiler = webpack(config, (err, stats) => { const compiler = webpack(config, (err, stats) => {
compiler.purgeInputFileSystem(); compiler.purgeInputFileSystem();
if (err) { if (err) {
@ -249,7 +249,7 @@ describe("BenchmarkTestCases", function() {
maxTime: 30, maxTime: 30,
defer: true, defer: true,
initCount: 1, initCount: 1,
onComplete: function() { onComplete: function () {
const stats = bench.stats; const stats = bench.stats;
const n = stats.sample.length; const n = stats.sample.length;
const nSqrt = Math.sqrt(n); const nSqrt = Math.sqrt(n);
@ -276,10 +276,10 @@ describe("BenchmarkTestCases", function() {
tests.forEach(testName => { tests.forEach(testName => {
const testDirectory = path.join(casesPath, testName); const testDirectory = path.join(casesPath, testName);
let headStats = null; let headStats = null;
describe(`${testName} create benchmarks`, function() { describe(`${testName} create benchmarks`, function () {
baselines.forEach(baseline => { baselines.forEach(baseline => {
let baselineStats = null; let baselineStats = null;
it(`should benchmark ${baseline.name} (${baseline.rev})`, function(done) { it(`should benchmark ${baseline.name} (${baseline.rev})`, function (done) {
const outputDirectory = path.join( const outputDirectory = path.join(
__dirname, __dirname,
"js", "js",
@ -330,7 +330,7 @@ describe("BenchmarkTestCases", function() {
}, 180000); }, 180000);
if (baseline.name !== "HEAD") { if (baseline.name !== "HEAD") {
it(`HEAD should not be slower than ${baseline.name} (${baseline.rev})`, function() { it(`HEAD should not be slower than ${baseline.name} (${baseline.rev})`, function () {
if (baselineStats.maxConfidence < headStats.minConfidence) { if (baselineStats.maxConfidence < headStats.minConfidence) {
throw new Error( throw new Error(
`HEAD (${headStats.text}) is slower than ${baseline.name} (${baselineStats.text}) (90% confidence)` `HEAD (${headStats.text}) is slower than ${baseline.name} (${baselineStats.text}) (90% confidence)`

View File

@ -366,7 +366,7 @@ describe("Compiler", () => {
done(); done();
}); });
}); });
it("should not be run twice at a time (run)", function(done) { it("should not be run twice at a time (run)", function (done) {
const compiler = webpack({ const compiler = webpack({
context: __dirname, context: __dirname,
mode: "production", mode: "production",
@ -384,7 +384,7 @@ describe("Compiler", () => {
if (err) return done(); if (err) return done();
}); });
}); });
it("should not be run twice at a time (watch)", function(done) { it("should not be run twice at a time (watch)", function (done) {
const compiler = webpack({ const compiler = webpack({
context: __dirname, context: __dirname,
mode: "production", mode: "production",
@ -402,7 +402,7 @@ describe("Compiler", () => {
if (err) return done(); if (err) return done();
}); });
}); });
it("should not be run twice at a time (run - watch)", function(done) { it("should not be run twice at a time (run - watch)", function (done) {
const compiler = webpack({ const compiler = webpack({
context: __dirname, context: __dirname,
mode: "production", mode: "production",
@ -420,7 +420,7 @@ describe("Compiler", () => {
if (err) return done(); if (err) return done();
}); });
}); });
it("should not be run twice at a time (watch - run)", function(done) { it("should not be run twice at a time (watch - run)", function (done) {
const compiler = webpack({ const compiler = webpack({
context: __dirname, context: __dirname,
mode: "production", mode: "production",
@ -438,7 +438,7 @@ describe("Compiler", () => {
if (err) return done(); if (err) return done();
}); });
}); });
it("should not be run twice at a time (instance cb)", function(done) { it("should not be run twice at a time (instance cb)", function (done) {
const compiler = webpack( const compiler = webpack(
{ {
context: __dirname, context: __dirname,
@ -456,7 +456,7 @@ describe("Compiler", () => {
if (err) return done(); if (err) return done();
}); });
}); });
it("should run again correctly after first compilation", function(done) { it("should run again correctly after first compilation", function (done) {
const compiler = webpack({ const compiler = webpack({
context: __dirname, context: __dirname,
mode: "production", mode: "production",
@ -476,7 +476,7 @@ describe("Compiler", () => {
}); });
}); });
}); });
it("should watch again correctly after first compilation", function(done) { it("should watch again correctly after first compilation", function (done) {
const compiler = webpack({ const compiler = webpack({
context: __dirname, context: __dirname,
mode: "production", mode: "production",
@ -496,7 +496,7 @@ describe("Compiler", () => {
}); });
}); });
}); });
it("should run again correctly after first closed watch", function(done) { it("should run again correctly after first closed watch", function (done) {
const compiler = webpack({ const compiler = webpack({
context: __dirname, context: __dirname,
mode: "production", mode: "production",
@ -517,7 +517,7 @@ describe("Compiler", () => {
}); });
}); });
}); });
it("should watch again correctly after first closed watch", function(done) { it("should watch again correctly after first closed watch", function (done) {
const compiler = webpack({ const compiler = webpack({
context: __dirname, context: __dirname,
mode: "production", mode: "production",
@ -538,7 +538,7 @@ describe("Compiler", () => {
}); });
}); });
}); });
it("should run again correctly inside afterDone hook", function(done) { it("should run again correctly inside afterDone hook", function (done) {
const compiler = webpack({ const compiler = webpack({
context: __dirname, context: __dirname,
mode: "production", mode: "production",
@ -562,7 +562,7 @@ describe("Compiler", () => {
if (err) return done(err); if (err) return done(err);
}); });
}); });
it("should call afterDone hook after other callbacks (run)", function(done) { it("should call afterDone hook after other callbacks (run)", function (done) {
const compiler = webpack({ const compiler = webpack({
context: __dirname, context: __dirname,
mode: "production", mode: "production",
@ -586,7 +586,7 @@ describe("Compiler", () => {
runCb(); runCb();
}); });
}); });
it("should call afterDone hook after other callbacks (instance cb)", function(done) { it("should call afterDone hook after other callbacks (instance cb)", function (done) {
const instanceCb = jest.fn(); const instanceCb = jest.fn();
const compiler = webpack( const compiler = webpack(
{ {
@ -612,7 +612,7 @@ describe("Compiler", () => {
done(); done();
}); });
}); });
it("should call afterDone hook after other callbacks (watch)", function(done) { it("should call afterDone hook after other callbacks (watch)", function (done) {
const compiler = webpack({ const compiler = webpack({
context: __dirname, context: __dirname,
mode: "production", mode: "production",
@ -639,7 +639,7 @@ describe("Compiler", () => {
}); });
watch.invalidate(invalidateCb); watch.invalidate(invalidateCb);
}); });
it("should call afterDone hook after other callbacks (watch close)", function(done) { it("should call afterDone hook after other callbacks (watch close)", function (done) {
const compiler = webpack({ const compiler = webpack({
context: __dirname, context: __dirname,
mode: "production", mode: "production",
@ -666,7 +666,7 @@ describe("Compiler", () => {
}); });
watch.invalidate(invalidateCb); watch.invalidate(invalidateCb);
}); });
it("should flag watchMode as true in watch", function(done) { it("should flag watchMode as true in watch", function (done) {
const compiler = webpack({ const compiler = webpack({
context: __dirname, context: __dirname,
mode: "production", mode: "production",
@ -688,7 +688,7 @@ describe("Compiler", () => {
}); });
}); });
}); });
it("should use cache on second run call", function(done) { it("should use cache on second run call", function (done) {
const compiler = webpack({ const compiler = webpack({
context: __dirname, context: __dirname,
mode: "development", mode: "development",

View File

@ -43,7 +43,7 @@ describe("ConfigTestCases", () => {
categories.forEach(category => { categories.forEach(category => {
describe(category.name, () => { describe(category.name, () => {
category.tests.forEach(testName => { category.tests.forEach(testName => {
describe(testName, function() { describe(testName, function () {
const testDirectory = path.join(casesPath, category.name, testName); const testDirectory = path.join(casesPath, category.name, testName);
const outputDirectory = path.join( const outputDirectory = path.join(
__dirname, __dirname,
@ -84,7 +84,7 @@ describe("ConfigTestCases", () => {
options.output.filename = "bundle" + idx + ".js"; options.output.filename = "bundle" + idx + ".js";
}); });
let testConfig = { let testConfig = {
findBundle: function(i, options) { findBundle: function (i, options) {
const ext = path.extname(options.output.filename); const ext = path.extname(options.output.filename);
if ( if (
fs.existsSync( fs.existsSync(

View File

@ -18,7 +18,7 @@ describe("Examples", () => {
} }
it( it(
"should compile " + relativePath, "should compile " + relativePath,
function(done) { function (done) {
let options = {}; let options = {};
let webpackConfigPath = path.join(examplePath, "webpack.config.js"); let webpackConfigPath = path.join(examplePath, "webpack.config.js");
webpackConfigPath = webpackConfigPath =

View File

@ -9,7 +9,7 @@ describe("JavascriptParser", () => {
/* eslint-disable no-inner-declarations */ /* eslint-disable no-inner-declarations */
const testCases = { const testCases = {
"call ident": [ "call ident": [
function() { function () {
abc("test"); abc("test");
}, },
{ {
@ -17,7 +17,7 @@ describe("JavascriptParser", () => {
} }
], ],
"call member": [ "call member": [
function() { function () {
cde.abc("membertest"); cde.abc("membertest");
}, },
{ {
@ -25,7 +25,7 @@ describe("JavascriptParser", () => {
} }
], ],
"call member using bracket notation": [ "call member using bracket notation": [
function() { function () {
cde["abc"]("membertest"); cde["abc"]("membertest");
}, },
{ {
@ -33,7 +33,7 @@ describe("JavascriptParser", () => {
} }
], ],
"call inner member": [ "call inner member": [
function() { function () {
cde.ddd.abc("inner"); cde.ddd.abc("inner");
}, },
{ {
@ -41,7 +41,7 @@ describe("JavascriptParser", () => {
} }
], ],
"call inner member using bracket notation": [ "call inner member using bracket notation": [
function() { function () {
cde.ddd["abc"]("inner"); cde.ddd["abc"]("inner");
}, },
{ {
@ -49,7 +49,7 @@ describe("JavascriptParser", () => {
} }
], ],
expression: [ expression: [
function() { function () {
fgh; fgh;
}, },
{ {
@ -57,7 +57,7 @@ describe("JavascriptParser", () => {
} }
], ],
"expression sub": [ "expression sub": [
function() { function () {
fgh.sub; fgh.sub;
}, },
{ {
@ -65,7 +65,7 @@ describe("JavascriptParser", () => {
} }
], ],
"member expression": [ "member expression": [
function() { function () {
test[memberExpr]; test[memberExpr];
test[+memberExpr]; test[+memberExpr];
}, },
@ -74,8 +74,8 @@ describe("JavascriptParser", () => {
} }
], ],
"in function definition": [ "in function definition": [
function() { function () {
(function(abc, cde, fgh) { (function (abc, cde, fgh) {
abc("test"); abc("test");
cde.abc("test"); cde.abc("test");
cde.ddd.abc("test"); cde.ddd.abc("test");
@ -86,7 +86,7 @@ describe("JavascriptParser", () => {
{} {}
], ],
"const definition": [ "const definition": [
function() { function () {
let abc, cde, fgh; let abc, cde, fgh;
abc("test"); abc("test");
cde.abc("test"); cde.abc("test");
@ -97,7 +97,7 @@ describe("JavascriptParser", () => {
{} {}
], ],
"var definition": [ "var definition": [
function() { function () {
var abc, cde, fgh; var abc, cde, fgh;
abc("test"); abc("test");
cde.abc("test"); cde.abc("test");
@ -108,7 +108,7 @@ describe("JavascriptParser", () => {
{} {}
], ],
"function definition": [ "function definition": [
function() { function () {
function abc() {} function abc() {}
function cde() {} function cde() {}
@ -123,7 +123,7 @@ describe("JavascriptParser", () => {
{} {}
], ],
"class definition": [ "class definition": [
function() { function () {
class memberExpr { class memberExpr {
cde() { cde() {
abc("cde"); abc("cde");
@ -140,7 +140,7 @@ describe("JavascriptParser", () => {
} }
], ],
"in try": [ "in try": [
function() { function () {
try { try {
fgh.sub; fgh.sub;
fgh; fgh;
@ -160,7 +160,7 @@ describe("JavascriptParser", () => {
} }
], ],
"renaming with const": [ "renaming with const": [
function() { function () {
const xyz = abc; const xyz = abc;
xyz("test"); xyz("test");
}, },
@ -169,7 +169,7 @@ describe("JavascriptParser", () => {
} }
], ],
"renaming with var": [ "renaming with var": [
function() { function () {
var xyz = abc; var xyz = abc;
xyz("test"); xyz("test");
}, },
@ -178,7 +178,7 @@ describe("JavascriptParser", () => {
} }
], ],
"renaming with assignment": [ "renaming with assignment": [
function() { function () {
const xyz = abc; const xyz = abc;
xyz("test"); xyz("test");
}, },
@ -187,8 +187,8 @@ describe("JavascriptParser", () => {
} }
], ],
"renaming with IIFE": [ "renaming with IIFE": [
function() { function () {
!(function(xyz) { !(function (xyz) {
xyz("test"); xyz("test");
})(abc); })(abc);
}, },
@ -197,8 +197,8 @@ describe("JavascriptParser", () => {
} }
], ],
"renaming arguments with IIFE (called)": [ "renaming arguments with IIFE (called)": [
function() { function () {
!function(xyz) { !function (xyz) {
xyz("test"); xyz("test");
}.call(fgh, abc); }.call(fgh, abc);
}, },
@ -208,8 +208,8 @@ describe("JavascriptParser", () => {
} }
], ],
"renaming this's properties with IIFE (called)": [ "renaming this's properties with IIFE (called)": [
function() { function () {
!function() { !function () {
this.sub; this.sub;
}.call(ijk); }.call(ijk);
}, },
@ -218,9 +218,9 @@ describe("JavascriptParser", () => {
} }
], ],
"renaming this's properties with nested IIFE (called)": [ "renaming this's properties with nested IIFE (called)": [
function() { function () {
!function() { !function () {
!function() { !function () {
this.sub; this.sub;
}.call(this); }.call(this);
}.call(ijk); }.call(ijk);
@ -230,7 +230,7 @@ describe("JavascriptParser", () => {
} }
], ],
"new Foo(...)": [ "new Foo(...)": [
function() { function () {
new xyz("membertest"); new xyz("membertest");
}, },
{ {
@ -238,7 +238,7 @@ describe("JavascriptParser", () => {
} }
], ],
"spread calls/literals": [ "spread calls/literals": [
function() { function () {
var xyz = [...abc("xyz"), cde]; var xyz = [...abc("xyz"), cde];
Math.max(...fgh); Math.max(...fgh);
}, },

View File

@ -19,7 +19,7 @@ const createMultiCompiler = () => {
return compiler; return compiler;
}; };
describe("MultiCompiler", function() { describe("MultiCompiler", function () {
jest.setTimeout(20000); jest.setTimeout(20000);
it("should trigger 'run' for each child compiler", done => { it("should trigger 'run' for each child compiler", done => {
@ -53,7 +53,7 @@ describe("MultiCompiler", function() {
}); });
}); });
it("should not be run twice at a time (run)", function(done) { it("should not be run twice at a time (run)", function (done) {
const compiler = createMultiCompiler(); const compiler = createMultiCompiler();
compiler.run((err, stats) => { compiler.run((err, stats) => {
if (err) return done(err); if (err) return done(err);
@ -62,7 +62,7 @@ describe("MultiCompiler", function() {
if (err) return done(); if (err) return done();
}); });
}); });
it("should not be run twice at a time (watch)", function(done) { it("should not be run twice at a time (watch)", function (done) {
const compiler = createMultiCompiler(); const compiler = createMultiCompiler();
const watcher = compiler.watch({}, (err, stats) => { const watcher = compiler.watch({}, (err, stats) => {
if (err) return done(err); if (err) return done(err);
@ -71,7 +71,7 @@ describe("MultiCompiler", function() {
if (err) return watcher.close(done); if (err) return watcher.close(done);
}); });
}); });
it("should not be run twice at a time (run - watch)", function(done) { it("should not be run twice at a time (run - watch)", function (done) {
const compiler = createMultiCompiler(); const compiler = createMultiCompiler();
compiler.run((err, stats) => { compiler.run((err, stats) => {
if (err) return done(err); if (err) return done(err);
@ -80,7 +80,7 @@ describe("MultiCompiler", function() {
if (err) return done(); if (err) return done();
}); });
}); });
it("should not be run twice at a time (watch - run)", function(done) { it("should not be run twice at a time (watch - run)", function (done) {
const compiler = createMultiCompiler(); const compiler = createMultiCompiler();
let watcher; let watcher;
watcher = compiler.watch({}, (err, stats) => { watcher = compiler.watch({}, (err, stats) => {
@ -90,7 +90,7 @@ describe("MultiCompiler", function() {
if (err) return watcher.close(done); if (err) return watcher.close(done);
}); });
}); });
it("should not be run twice at a time (instance cb)", function(done) { it("should not be run twice at a time (instance cb)", function (done) {
const compiler = webpack( const compiler = webpack(
{ {
context: __dirname, context: __dirname,
@ -108,7 +108,7 @@ describe("MultiCompiler", function() {
if (err) return done(); if (err) return done();
}); });
}); });
it("should run again correctly after first compilation", function(done) { it("should run again correctly after first compilation", function (done) {
const compiler = createMultiCompiler(); const compiler = createMultiCompiler();
compiler.run((err, stats) => { compiler.run((err, stats) => {
if (err) return done(err); if (err) return done(err);
@ -119,7 +119,7 @@ describe("MultiCompiler", function() {
}); });
}); });
}); });
it("should watch again correctly after first compilation", function(done) { it("should watch again correctly after first compilation", function (done) {
const compiler = createMultiCompiler(); const compiler = createMultiCompiler();
compiler.run((err, stats) => { compiler.run((err, stats) => {
if (err) return done(err); if (err) return done(err);
@ -131,7 +131,7 @@ describe("MultiCompiler", function() {
}); });
}); });
}); });
it("should run again correctly after first closed watch", function(done) { it("should run again correctly after first closed watch", function (done) {
const compiler = createMultiCompiler(); const compiler = createMultiCompiler();
const watching = compiler.watch({}, (err, stats) => { const watching = compiler.watch({}, (err, stats) => {
if (err) return done(err); if (err) return done(err);
@ -143,7 +143,7 @@ describe("MultiCompiler", function() {
}); });
}); });
}); });
it("should watch again correctly after first closed watch", function(done) { it("should watch again correctly after first closed watch", function (done) {
const compiler = createMultiCompiler(); const compiler = createMultiCompiler();
const watching = compiler.watch({}, (err, stats) => { const watching = compiler.watch({}, (err, stats) => {
if (err) return done(err); if (err) return done(err);

View File

@ -5,7 +5,7 @@ const fs = require("graceful-fs");
const webpack = require("../"); const webpack = require("../");
const rimraf = require("rimraf"); const rimraf = require("rimraf");
describe("Profiling Plugin", function() { describe("Profiling Plugin", function () {
jest.setTimeout(15000); jest.setTimeout(15000);
it("should handle output path with folder creation", done => { it("should handle output path with folder creation", done => {

View File

@ -7,7 +7,7 @@ const captureStdio = require("./helpers/captureStdio");
let webpack; let webpack;
describe("ProgressPlugin", function() { describe("ProgressPlugin", function () {
let stderr; let stderr;
beforeEach(() => { beforeEach(() => {

View File

@ -85,7 +85,7 @@ describe("StatsTestCases", () => {
compilers.forEach(c => { compilers.forEach(c => {
const ifs = c.inputFileSystem; const ifs = c.inputFileSystem;
c.inputFileSystem = Object.create(ifs); c.inputFileSystem = Object.create(ifs);
c.inputFileSystem.readFile = function() { c.inputFileSystem.readFile = function () {
const args = Array.prototype.slice.call(arguments); const args = Array.prototype.slice.call(arguments);
const callback = args.pop(); const callback = args.pop();
ifs.readFile.apply( ifs.readFile.apply(

View File

@ -51,7 +51,7 @@ categories = categories.map(cat => {
const describeCases = config => { const describeCases = config => {
describe(config.name, () => { describe(config.name, () => {
categories.forEach(category => { categories.forEach(category => {
describe(category.name, function() { describe(category.name, function () {
jest.setTimeout(20000); jest.setTimeout(20000);
category.tests category.tests
@ -160,7 +160,7 @@ const describeCases = config => {
} }
] ]
}, },
plugins: (config.plugins || []).concat(function() { plugins: (config.plugins || []).concat(function () {
this.hooks.compilation.tap("TestCasesTest", compilation => { this.hooks.compilation.tap("TestCasesTest", compilation => {
[ [
"optimize", "optimize",

View File

@ -1,3 +1,3 @@
module.exports = { module.exports = {
entry: "./index" entry: "./index",
}; };

View File

@ -1,8 +1,8 @@
var testPlugin = function() { var testPlugin = function () {
var counter = 1; var counter = 1;
this.hooks.compilation.tap("TestPlugin", compilation => { this.hooks.compilation.tap("TestPlugin", compilation => {
var nr = counter++; var nr = counter++;
compilation.hooks.needAdditionalPass.tap("TestPlugin", function() { compilation.hooks.needAdditionalPass.tap("TestPlugin", function () {
if (nr < 5) return true; if (nr < 5) return true;
}); });
}); });

View File

@ -10,7 +10,7 @@ module.exports = {
filename: "[name].js" filename: "[name].js"
}, },
plugins: [ plugins: [
function() { function () {
/** /**
* @param {Compilation} compilation compilation * @param {Compilation} compilation compilation
* @returns {void} * @returns {void}

View File

@ -6,7 +6,7 @@ module.exports = {
concatenateModules: true concatenateModules: true
}, },
plugins: [ plugins: [
function() { function () {
this.hooks.compilation.tap( this.hooks.compilation.tap(
"Test", "Test",
/** /**

View File

@ -6,7 +6,7 @@ module.exports = {
concatenateModules: false concatenateModules: false
}, },
plugins: [ plugins: [
function() { function () {
this.hooks.compilation.tap("Test", compilation => { this.hooks.compilation.tap("Test", compilation => {
compilation.hooks.dependencyReferencedExports.tap( compilation.hooks.dependencyReferencedExports.tap(
"Test", "Test",

View File

@ -15,7 +15,7 @@ module.exports = {
filename: "[name].js" filename: "[name].js"
}, },
plugins: [ plugins: [
function() { function () {
/** /**
* @param {Compilation} compilation compilation * @param {Compilation} compilation compilation
* @returns {void} * @returns {void}

View File

@ -8,7 +8,7 @@ module.exports = {
filename: "[name].js" filename: "[name].js"
}, },
plugins: [ plugins: [
function() { function () {
/** /**
* @param {Compilation} compilation compilation * @param {Compilation} compilation compilation
* @returns {void} * @returns {void}

View File

@ -1,7 +1,7 @@
module.exports = { module.exports = {
mode: "development", mode: "development",
output: { output: {
devtoolModuleFilenameTemplate: function(info) { devtoolModuleFilenameTemplate: function (info) {
return "dummy:///" + info.resourcePath; return "dummy:///" + info.resourcePath;
} }
}, },

View File

@ -1,6 +1,6 @@
var testPlugin = function() { var testPlugin = function () {
this.hooks.compilation.tap("TestPlugin", compilation => { this.hooks.compilation.tap("TestPlugin", compilation => {
compilation.hooks.finishModules.tapAsync("TestPlugin", function( compilation.hooks.finishModules.tapAsync("TestPlugin", function (
_modules, _modules,
callback callback
) { ) {

View File

@ -222,7 +222,7 @@ module.exports = [
} }
]; ];
module.exports.forEach(function(options) { module.exports.forEach(function (options) {
options.plugins = options.plugins || []; options.plugins = options.plugins || [];
options.plugins.push( options.plugins.push(
new webpack.DefinePlugin({ new webpack.DefinePlugin({

View File

@ -7,8 +7,8 @@ module.exports = {
filename: "[name].js" filename: "[name].js"
}, },
plugins: [ plugins: [
function() { function () {
this.hooks.emit.tap("TestPlugin", function(compilation) { this.hooks.emit.tap("TestPlugin", function (compilation) {
delete compilation.assets["b.js"]; delete compilation.assets["b.js"];
}); });
} }

View File

@ -8,7 +8,7 @@ module.exports = {
{ {
loader: "./loader2", loader: "./loader2",
options: { options: {
f: function() { f: function () {
return "ok"; return "ok";
} }
} }
@ -24,7 +24,7 @@ module.exports = {
use: { use: {
loader: "./loader2", loader: "./loader2",
options: { options: {
f: function() { f: function () {
return "maybe"; return "maybe";
} }
} }
@ -35,7 +35,7 @@ module.exports = {
use: { use: {
loader: "./loader2", loader: "./loader2",
options: { options: {
f: function() { f: function () {
return "yes"; return "yes";
} }
} }
@ -50,7 +50,7 @@ module.exports = {
{ {
loader: "./loader2", loader: "./loader2",
options: { options: {
f: function() { f: function () {
return "ok"; return "ok";
} }
} }

View File

@ -9,7 +9,7 @@ module.exports = {
loader: "./loader2", loader: "./loader2",
ident: "loader2", ident: "loader2",
options: { options: {
f: function() { f: function () {
return "ok"; return "ok";
} }
} }
@ -23,7 +23,7 @@ module.exports = {
{ {
loader: "./loader2", loader: "./loader2",
options: { options: {
f: function() { f: function () {
return "ok"; return "ok";
} }
} }
@ -38,7 +38,7 @@ module.exports = {
test: /c\.js$/, test: /c\.js$/,
loader: "./loader2", loader: "./loader2",
options: { options: {
f: function() { f: function () {
return "ok"; return "ok";
} }
} }

View File

@ -1,6 +1,6 @@
module.exports = { module.exports = {
module: { module: {
noParse: function(content) { noParse: function (content) {
return /not-parsed/.test(content); return /not-parsed/.test(content);
} }
} }

View File

@ -9,7 +9,7 @@ module.exports = {
expect(compiler).toBeInstanceOf(Compiler); expect(compiler).toBeInstanceOf(Compiler);
} }
}, },
function(compiler) { function (compiler) {
expect(compiler).toBe(this); expect(compiler).toBe(this);
expect(compiler).toBeInstanceOf(Compiler); expect(compiler).toBeInstanceOf(Compiler);
} }

View File

@ -18,7 +18,7 @@ module.exports = {
NEGATIVE_ZER0: -0, NEGATIVE_ZER0: -0,
NEGATIVE_NUMBER: -100.25, NEGATIVE_NUMBER: -100.25,
POSITIVE_NUMBER: +100.25, POSITIVE_NUMBER: +100.25,
FUNCTION: /* istanbul ignore next */ function(a) { FUNCTION: /* istanbul ignore next */ function (a) {
return a + 1; return a + 1;
}, },
CODE: "(1+2)", CODE: "(1+2)",
@ -26,7 +26,7 @@ module.exports = {
OBJECT: { OBJECT: {
SUB: { SUB: {
UNDEFINED: undefined, UNDEFINED: undefined,
FUNCTION: /* istanbul ignore next */ function(a) { FUNCTION: /* istanbul ignore next */ function (a) {
return a + 1; return a + 1;
}, },
CODE: "(1+2)", CODE: "(1+2)",
@ -42,7 +42,7 @@ module.exports = {
wurst: "suppe", wurst: "suppe",
suppe: "wurst", suppe: "wurst",
RUNTIMEVALUE_CALLBACK_ARGUMENT_IS_A_MODULE: DefinePlugin.runtimeValue( RUNTIMEVALUE_CALLBACK_ARGUMENT_IS_A_MODULE: DefinePlugin.runtimeValue(
function({ module }) { function ({ module }) {
return module instanceof Module; return module instanceof Module;
} }
), ),

View File

@ -3,7 +3,7 @@ module.exports = {
rules: [ rules: [
{ {
test: /[ab]\.js$/, test: /[ab]\.js$/,
use: function(data) { use: function (data) {
return { return {
loader: "./loader", loader: "./loader",
options: { options: {

View File

@ -22,7 +22,7 @@ module.exports = {
{ {
loader: "./loader", loader: "./loader",
options: { options: {
get: function() { get: function () {
return "second-3"; return "second-3";
} }
} }

View File

@ -1,6 +1,6 @@
function createFunctionArrayFromUseArray(useArray) { function createFunctionArrayFromUseArray(useArray) {
return useArray.map(function(useItem) { return useArray.map(function (useItem) {
return function(data) { return function (data) {
return useItem; return useItem;
}; };
}); });
@ -15,7 +15,7 @@ var useArray = createFunctionArrayFromUseArray([
{ {
loader: "./loader", loader: "./loader",
options: { options: {
get: function() { get: function () {
return "second-3"; return "second-3";
} }
} }

View File

@ -22,7 +22,7 @@ module.exports = {
{ {
loader: "./loader", loader: "./loader",
options: { options: {
get: function() { get: function () {
return "second-3"; return "second-3";
} }
} }

View File

@ -1,5 +1,5 @@
exports.default = [ exports.default = [
function() { function () {
return {}; return {};
} }
]; ];

View File

@ -1,5 +1,5 @@
module.exports = [ module.exports = [
function() { function () {
return {}; return {};
} }
]; ];

View File

@ -18,7 +18,7 @@ module.exports = {
importAwait: true importAwait: true
}, },
plugins: [ plugins: [
function() { function () {
this.hooks.compilation.tap( this.hooks.compilation.tap(
"Test", "Test",
/** /**

View File

@ -14,7 +14,7 @@ module.exports = function PluginEnvironment() {
return hookName.replace(/[A-Z]/g, c => "-" + c.toLowerCase()); return hookName.replace(/[A-Z]/g, c => "-" + c.toLowerCase());
} }
this.getEnvironmentStub = function() { this.getEnvironmentStub = function () {
const hooks = new Map(); const hooks = new Map();
return { return {
plugin: addEvent, plugin: addEvent,
@ -49,7 +49,7 @@ module.exports = function PluginEnvironment() {
}; };
}; };
this.getEventBindings = function() { this.getEventBindings = function () {
return events; return events;
}; };
}; };

View File

@ -6,7 +6,7 @@ module.exports = (stdio, tty) => {
const write = stdio.write; const write = stdio.write;
const isTTY = stdio.isTTY; const isTTY = stdio.isTTY;
stdio.write = function(str) { stdio.write = function (str) {
logs.push(str); logs.push(str);
}; };
if (tty !== undefined) stdio.isTTY = tty; if (tty !== undefined) stdio.isTTY = tty;

View File

@ -13,7 +13,7 @@ const originalDeprecate = util.deprecate;
util.deprecate = (fn, message, code) => { util.deprecate = (fn, message, code) => {
const original = originalDeprecate(fn, message, code); const original = originalDeprecate(fn, message, code);
return function(...args) { return function (...args) {
if (interception) { if (interception) {
interception.set(`${code}: ${message}`, { code, message }); interception.set(`${code}: ${message}`, { code, message });
return fn.apply(this, args); return fn.apply(this, args);

View File

@ -47,7 +47,7 @@ expect.extend({
if (process.env.ALTERNATIVE_SORT) { if (process.env.ALTERNATIVE_SORT) {
const oldSort = Array.prototype.sort; const oldSort = Array.prototype.sort;
Array.prototype.sort = function(cmp) { Array.prototype.sort = function (cmp) {
oldSort.call(this, cmp); oldSort.call(this, cmp);
if (cmp) { if (cmp) {
for (let i = 1; i < this.length; i++) { for (let i = 1; i < this.length; i++) {

View File

@ -5313,7 +5313,12 @@ prettier-linter-helpers@^1.0.0:
dependencies: dependencies:
fast-diff "^1.1.2" fast-diff "^1.1.2"
prettier@^1.14.3, prettier@^1.19.1: prettier@2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.2.tgz#1ba8f3eb92231e769b7fcd7cb73ae1b6b74ade08"
integrity sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg==
prettier@^1.19.1:
version "1.19.1" version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==