Skip to content
Permalink
Browse files
run prettier on existing code
  • Loading branch information
sokra committed Feb 25, 2018
1 parent 518d1e0 commit 5238159d211576bb313d99d487e415f3799af795
Showing 399 changed files with 18,970 additions and 12,632 deletions.
@@ -4,15 +4,17 @@ let webpackCliInstalled = false;
try {
require.resolve("webpack-cli");
webpackCliInstalled = true;
} catch(e) {
} catch (e) {
webpackCliInstalled = false;
}

if(webpackCliInstalled) {
if (webpackCliInstalled) {
require("webpack-cli"); // eslint-disable-line node/no-missing-require, node/no-extraneous-require, node/no-unpublished-require
} else {
console.error("The CLI moved into a separate package: webpack-cli.");
console.error("Please install 'webpack-cli' in addition to webpack itself to use the CLI.");
console.error(
"Please install 'webpack-cli' in addition to webpack itself to use the CLI."
);
console.error("-> When using npm: npm install webpack-cli -D");
console.error("-> When using yarn: yarn add webpack-cli -D");
process.exitCode = 1;
@@ -7,11 +7,10 @@ g = (function() {

try {
// This works if eval is allowed (see CSP)
g = g || Function("return this")() || (1,eval)("this");
} catch(e) {
g = g || Function("return this")() || (1, eval)("this");
} catch (e) {
// This works if the window reference is available
if(typeof window === "object")
g = window;
if (typeof window === "object") g = window;
}

// g can still be undefined, but nothing to do about it...
@@ -1,8 +1,8 @@
module.exports = function(originalModule) {
if(!originalModule.webpackPolyfill) {
if (!originalModule.webpackPolyfill) {
var module = Object.create(originalModule);
// module.parent = undefined by default
if(!module.children) module.children = [];
if (!module.children) module.children = [];
Object.defineProperty(module, "loaded", {
enumerable: true,
get: function() {
@@ -16,7 +16,7 @@ module.exports = function(originalModule) {
}
});
Object.defineProperty(module, "exports", {
enumerable: true,
enumerable: true
});
module.webpackPolyfill = 1;
}
@@ -1,9 +1,9 @@
module.exports = function(module) {
if(!module.webpackPolyfill) {
if (!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
if(!module.children) module.children = [];
if (!module.children) module.children = [];
Object.defineProperty(module, "loaded", {
enumerable: true,
get: function() {
@@ -1,10 +1,12 @@
module.exports = {
// mode: "development || "production",
module: {
rules: [{
test: /\.coffee$/,
loader: "coffee-loader"
}]
rules: [
{
test: /\.coffee$/,
loader: "coffee-loader"
}
]
},
resolve: {
extensions: [".web.coffee", ".web.js", ".coffee", ".js"]
@@ -8,12 +8,12 @@ module.exports = {
output: {
filename: "vendor.js", // best use [hash] here too
path: path.resolve(__dirname, "dist"),
library: "vendor_lib_[hash]",
library: "vendor_lib_[hash]"
},
plugins: [
new webpack.DllPlugin({
name: "vendor_lib_[hash]",
path: path.resolve(__dirname, "dist/vendor-manifest.json"),
}),
],
path: path.resolve(__dirname, "dist/vendor-manifest.json")
})
]
};
@@ -7,12 +7,12 @@ module.exports = {
entry: "./example-app",
output: {
filename: "app.js",
path: path.resolve(__dirname, "dist"),
path: path.resolve(__dirname, "dist")
},
plugins: [
new webpack.DllReferencePlugin({
context: ".",
manifest: require("../0-vendor/dist/vendor-manifest.json"), // eslint-disable-line
}),
],
manifest: require("../0-vendor/dist/vendor-manifest.json") // eslint-disable-line
})
]
};
@@ -1,7 +1,6 @@
var path = require("path");
var webpack = require("../../");
module.exports = [

{
name: "vendor",
// mode: "development || "production",
@@ -38,5 +37,4 @@ module.exports = [
})
]
}

];
@@ -6,7 +6,7 @@ module.exports = {
externals: [
"add",
{
"subtract": {
subtract: {
root: "subtract",
commonjs2: "./subtract",
commonjs: ["./math", "subtract"],
@@ -5,7 +5,7 @@ module.exports = {
// The entry points for the pages
// They also contains router
pageA: ["./aEntry", "./router"],
pageB: ["./bEntry", "./router"],
pageB: ["./bEntry", "./router"]
},
output: {
path: path.join(__dirname, "dist"),
@@ -1,8 +1,8 @@
var path = require("path");
var I18nPlugin = require("i18n-webpack-plugin");
var languages = {
"en": null,
"de": require("./de.json")
en: null,
de: require("./de.json")
};
module.exports = Object.keys(languages).map(function(language) {
return {
@@ -13,10 +13,6 @@ module.exports = Object.keys(languages).map(function(language) {
path: path.join(__dirname, "dist"),
filename: language + ".output.js"
},
plugins: [
new I18nPlugin(
languages[language]
)
]
plugins: [new I18nPlugin(languages[language])]
};
});
@@ -1,9 +1,11 @@
module.exports = {
// mode: "development || "production",
module: {
rules: [{
test: /\.css$/,
loader: "css-loader"
}]
rules: [
{
test: /\.css$/,
loader: "css-loader"
}
]
}
};
@@ -1,7 +1,6 @@
var path = require("path");
var webpack = require("../../");
module.exports = [

{
name: "mobile",
// mode: "development || "production",
@@ -31,5 +30,4 @@ module.exports = [
})
]
}

];
@@ -10,15 +10,15 @@ module.exports = [
"hidden-source-map",
"inline-source-map",
"nosources-source-map",
"source-map",
"source-map"
].map(devtool => ({
mode: "development",
entry: {
bundle: "coffee-loader!./example.coffee",
bundle: "coffee-loader!./example.coffee"
},
output: {
path: path.join(__dirname, "dist"),
filename: `./[name]-${devtool}.js`,
filename: `./[name]-${devtool}.js`
},
devtool,
optimization: {
@@ -5,10 +5,12 @@ module.exports = {
publicPath: "js/"
},
module: {
rules: [{
test: /\.wasm$/,
type: "webassembly/experimental"
}]
rules: [
{
test: /\.wasm$/,
type: "webassembly/experimental"
}
]
},
optimization: {
occurrenceOrder: true // To keep filename consistent between different modes (for example building only)
@@ -5,5 +5,4 @@
"rules": {
"node/exports-style": ["off"]
}

}
@@ -3,46 +3,54 @@
Author Tobias Koppers @sokra
*/
/*globals window __webpack_hash__ */
if(module.hot) {
if (module.hot) {
var lastHash;
var upToDate = function upToDate() {
return lastHash.indexOf(__webpack_hash__) >= 0;
};
var log = require("./log");
var check = function check() {
module.hot.check(true).then(function(updatedModules) {
if(!updatedModules) {
log("warning", "[HMR] Cannot find update. Need to do a full reload!");
log("warning", "[HMR] (Probably because of restarting the webpack-dev-server)");
window.location.reload();
return;
}
module.hot
.check(true)
.then(function(updatedModules) {
if (!updatedModules) {
log("warning", "[HMR] Cannot find update. Need to do a full reload!");
log(
"warning",
"[HMR] (Probably because of restarting the webpack-dev-server)"
);
window.location.reload();
return;
}

if(!upToDate()) {
check();
}
if (!upToDate()) {
check();
}

require("./log-apply-result")(updatedModules, updatedModules);
require("./log-apply-result")(updatedModules, updatedModules);

if(upToDate()) {
log("info", "[HMR] App is up to date.");
}

}).catch(function(err) {
var status = module.hot.status();
if(["abort", "fail"].indexOf(status) >= 0) {
log("warning", "[HMR] Cannot apply update. Need to do a full reload!");
log("warning", "[HMR] " + err.stack || err.message);
window.location.reload();
} else {
log("warning", "[HMR] Update failed: " + err.stack || err.message);
}
});
if (upToDate()) {
log("info", "[HMR] App is up to date.");
}
})
.catch(function(err) {
var status = module.hot.status();
if (["abort", "fail"].indexOf(status) >= 0) {
log(
"warning",
"[HMR] Cannot apply update. Need to do a full reload!"
);
log("warning", "[HMR] " + err.stack || err.message);
window.location.reload();
} else {
log("warning", "[HMR] Update failed: " + err.stack || err.message);
}
});
};
var hotEmitter = require("./emitter");
hotEmitter.on("webpackHotUpdate", function(currentHash) {
lastHash = currentHash;
if(!upToDate() && module.hot.status() === "idle") {
if (!upToDate() && module.hot.status() === "idle") {
log("info", "[HMR] Checking for updates on the server...");
check();
}
@@ -8,19 +8,22 @@ module.exports = function(updatedModules, renewedModules) {
});
var log = require("./log");

if(unacceptedModules.length > 0) {
log("warning", "[HMR] The following modules couldn't be hot updated: (They would need a full reload!)");
if (unacceptedModules.length > 0) {
log(
"warning",
"[HMR] The following modules couldn't be hot updated: (They would need a full reload!)"
);
unacceptedModules.forEach(function(moduleId) {
log("warning", "[HMR] - " + moduleId);
});
}

if(!renewedModules || renewedModules.length === 0) {
if (!renewedModules || renewedModules.length === 0) {
log("info", "[HMR] Nothing hot updated.");
} else {
log("info", "[HMR] Updated modules:");
renewedModules.forEach(function(moduleId) {
if(typeof moduleId === "string" && moduleId.indexOf("!") !== -1) {
if (typeof moduleId === "string" && moduleId.indexOf("!") !== -1) {
var parts = moduleId.split("!");
log.groupCollapsed("info", "[HMR] - " + parts.pop());
log("info", "[HMR] - " + moduleId);
@@ -32,7 +35,10 @@ module.exports = function(updatedModules, renewedModules) {
var numberIds = renewedModules.every(function(moduleId) {
return typeof moduleId === "number";
});
if(numberIds)
log("info", "[HMR] Consider using the NamedModulesPlugin for module names.");
if (numberIds)
log(
"info",
"[HMR] Consider using the NamedModulesPlugin for module names."
);
}
};
Loading

0 comments on commit 5238159

Please sign in to comment.