Skip to content

Commit

Permalink
Merge branch 'master' into fix/hmr-before-node-stuff
Browse files Browse the repository at this point in the history
# Conflicts:
#	lib/HotModuleReplacementPlugin.js
  • Loading branch information
sokra committed Feb 24, 2018
2 parents 8dd3307 + 15ab027 commit 90ab23a
Show file tree
Hide file tree
Showing 1,278 changed files with 28,822 additions and 21,969 deletions.
6 changes: 4 additions & 2 deletions .eslintrc.js
Expand Up @@ -5,6 +5,7 @@ module.exports = {
"env": {
"node": true,
"es6": true,
"mocha": true,
},
"parserOptions": { "ecmaVersion": 2017 },
"rules": {
Expand Down Expand Up @@ -46,12 +47,13 @@ module.exports = {
"case": { "after": true },
"return": { "after": true },
"finally": { "after": true },
"do": { "after": true }
"do": { "after": true },
"of": { "after": true }
}
}],
"no-console": "off",
"valid-jsdoc": "error",
"node/no-unsupported-features": ["error", { version: 4 }],
"node/no-unsupported-features": "error",
"node/no-deprecated-api": "error",
"node/no-missing-import": "error",
"node/no-missing-require": [
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Expand Up @@ -19,4 +19,4 @@

**If this is a feature request, what is motivation or use case for changing the behavior?**

**Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.**
**Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.**
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -4,7 +4,7 @@
/test/fixtures/temp-cache-fixture
/benchmark/js
/benchmark/fixtures
/examples/**/js
/examples/**/dist
/coverage
.DS_Store
*.log
Expand Down
7 changes: 3 additions & 4 deletions .travis.yml
Expand Up @@ -24,9 +24,6 @@ matrix:
- os: linux
node_js: "6"
env: NO_WATCH_TESTS=1 JOB_PART=integration
- os: linux
node_js: "4"
env: NO_WATCH_TESTS=1 JOB_PART=integration
- os: osx
node_js: "8"
env: NO_WATCH_TESTS=1 JOB_PART=integration
Expand All @@ -35,7 +32,9 @@ matrix:
fast_finish: true

install:
- bash ./ci/travis-install.sh
- yarn --frozen-lockfile
- yarn link --frozen-lockfile || true
- yarn link webpack --frozen-lockfile

script: npm run travis:$JOB_PART

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Expand Up @@ -13,7 +13,7 @@ If you are still having difficulty after looking over your configuration careful
a question to [StackOverflow with the webpack tag](http://stackoverflow.com/tags/webpack). Questions
that include your webpack.config.js and relevant files are more likely to receive responses.

**If you have discovered a bug or have a feature suggestion, feel free to create an issue on Github.**
**If you have discovered a bug or have a feature suggestion, please [create an issue on GitHub](https://github.com/webpack/webpack/issues/new).**

## Contributing to the webpack ecosystem

Expand Down Expand Up @@ -60,4 +60,4 @@ documentation.

## Discussions

Gitters is only for small questions. To discuss in long a subject, please send on gitters a link to your forum or blog.
Gitter is only for small questions. To discuss a subject in detail, please send a link to your forum or blog in the Gitter chat.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -52,7 +52,7 @@ yarn add webpack --dev

<h2 align="center">Introduction</h2>

> This README reflects Webpack v2.x and v3.x. The Webpack v1.x [documentation can be found here](https://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=top).
> This README reflects Webpack v2.x and v3.x. The Webpack v1.x documentation has been deprecated and deleted.
webpack is a bundler for modules. The main purpose is to bundle JavaScript
files for usage in a browser, yet it is also capable of transforming, bundling,
Expand Down Expand Up @@ -217,14 +217,14 @@ or are automatically applied via regex from your webpack configuration.
|Name|Status|Description|
|:--:|:----:|:----------|
|<a href="https://github.com/vuejs/vue-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/vue-9.svg"></a>|![vue-npm]|Loads and compiles Vue Components|
|<a href="https://github.com/JonDum/polymer-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/polymer.svg"></a>|![polymer-npm]|Process HTML & CSS with preprocessor of choice and `require()` Web Components like first-class modules|
|<a href="https://github.com/webpack-contrib/polymer-webpack-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/polymer.svg"></a>|![polymer-npm]|Process HTML & CSS with preprocessor of choice and `require()` Web Components like first-class modules|
|<a href="https://github.com/TheLarkInn/angular2-template-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/angular-icon-1.svg"></a>|![angular-npm]| Loads and compiles Angular 2 Components|
|<a href="https://github.com/riot/tag-loader"><img width="48" height="48" src="https://worldvectorlogo.com/logos/riot.svg"></a>|![riot-npm]| Riot official webpack loader|



[vue-npm]: https://img.shields.io/npm/v/vue-loader.svg
[polymer-npm]: https://img.shields.io/npm/v/polymer-loader.svg
[polymer-npm]: https://img.shields.io/npm/v/polymer-webpack-loader.svg
[angular-npm]: https://img.shields.io/npm/v/angular2-template-loader.svg
[riot-npm]: https://img.shields.io/npm/v/riot-tag-loader.svg

Expand Down Expand Up @@ -432,7 +432,7 @@ src="https://static.monei.net/monei-logo.svg" height="30" alt="MONEI"></a>

<h2 align="center">Silver Sponsors</h2>

[Become a sliver sponsor](https://opencollective.com/webpack#sponsor) and get your logo on our README on Github with a link to your site.
[Become a silver sponsor](https://opencollective.com/webpack#sponsor) and get your logo on our README on Github with a link to your site.

<div align="center">

Expand Down
50 changes: 25 additions & 25 deletions benchmark/benchmark.js
Expand Up @@ -15,7 +15,7 @@ const benchmarkOptions = {

function runTimes(compiler, times, deferred) {
fs.writeFileSync(path.join(fixtures, "0.js"), "module.exports = " + Math.random(), "utf-8");
compiler.run((err, stats) => {
compiler.run(err => {
if(err) throw err;
if(times === 1)
deferred.resolve();
Expand All @@ -30,12 +30,12 @@ const tests = {
(size, deferred) => {
webpack({
context: fixtures,
entry: "./" + size + ".js",
entry: `./${size}.js`,
output: {
path: outputPath,
filename: "bundle.js"
}
}, (err, stats) => {
}, err => {
if(err) throw err;
deferred.resolve();
});
Expand All @@ -46,66 +46,66 @@ const tests = {
(size, deferred) => {
webpack({
context: fixtures,
entry: "./" + size + ".big.js",
entry: `./${size}.big.js`,
output: {
path: outputPath,
filename: "bundle.js"
},
devtool: "eval"
}, (err, stats) => {
}, err => {
if(err) throw err;
deferred.resolve();
})
});
}
],
"sourcemap build": [
[0, 1, 2, 5, 10, 15],
(size, deferred) => {
webpack({
context: fixtures,
entry: "./" + size + ".big.js",
entry: `./${size}.big.js`,
output: {
path: outputPath,
filename: "bundle.js"
},
devtool: "source-map"
}, (err, stats) => {
}, err => {
if(err) throw err;
deferred.resolve();
})
});
}
],
"cheap sourcemap build": [
[0, 1, 2, 5, 10, 15],
(size, deferred) => {
webpack({
context: fixtures,
entry: "./" + size + ".big.js",
entry: `./${size}.big.js`,
output: {
path: outputPath,
filename: "bundle.js"
},
devtool: "cheap-source-map"
}, function(err, stats) {
}, err => {
if(err) throw err;
deferred.resolve();
})
});
}
],
"build w/ chunks": [
[0, 1, 5, 10, 50, 100, 200],
(size, deferred) => {
webpack({
context: fixtures,
entry: "./" + size + ".async.js",
entry: `./${size}.async.js`,
output: {
path: outputPath,
filename: "bundle.js"
}
}, function(err, stats) {
}, err => {
if(err) throw err;
deferred.resolve();
})
});
}
],
"build w/ chunks": [
Expand All @@ -118,10 +118,10 @@ const tests = {
path: outputPath,
filename: "bundle.js"
}
}, function(err, stats) {
}, err => {
if(err) throw err;
deferred.resolve();
})
});
}
],
"incremental": [
Expand Down Expand Up @@ -161,7 +161,7 @@ const tests = {
var compiler = webpack({
cache: true,
context: fixtures,
entry: "./" + size + ".js",
entry: `./${size}.js`,
output: {
path: outputPath,
filename: "bundle.js"
Expand All @@ -176,7 +176,7 @@ const tests = {
var compiler = webpack({
cache: true,
context: fixtures,
entry: "./" + size + ".js",
entry: `./${size}.js`,
output: {
path: outputPath,
filename: "bundle.js"
Expand All @@ -191,7 +191,7 @@ const tests = {
var compiler = webpack({
cache: true,
context: fixtures,
entry: "./" + size + ".js",
entry: `./${size}.js`,
output: {
path: outputPath,
filename: "bundle.js"
Expand All @@ -204,17 +204,17 @@ const tests = {

const suite = new Benchmark.Suite;

Object.keys(tests).filter((name) => (process.argv.length > 2) ? name.indexOf(process.argv[2]) >= 0 : true)
.forEach((name) => {
Object.keys(tests).filter(name => process.argv.length > 2 ? name.includes(process.argv[2]) : true)
.forEach(name => {
const test = tests[name];
test[0].forEach((size) => {
suite.add(name + " " + size, (deferred) => {
test[0].forEach(size => {
suite.add(`${name} ${size}`, deferred => {
test[1](size, deferred);
}, benchmarkOptions);
});
});

suite.on("cycle", (event) => {
suite.on("cycle", event => {
process.stderr.write("\n");
const b = event.target;
console.log(b.name + "\t" + Math.floor(1000 * (b.stats.mean - b.stats.moe)) + "\t" + Math.floor(1000 * (b.stats.mean + b.stats.moe)));
Expand Down
29 changes: 17 additions & 12 deletions benchmark/createFixtures.js
Expand Up @@ -7,16 +7,21 @@ try {
fs.mkdirSync(fixtures);
} catch(e) {}

function generateRequireString(conditional, suffix) {
const prefixedSuffix = suffix ? `.${suffix}` : "";
return `require(${JSON.stringify(`./${conditional}${prefixedSuffix}.js`)});`;
}

for(let i = 0; i < 10000; i++) {
const source = [];
if(i > 8)
source.push("require(" + JSON.stringify("./" + (i / 8 | 0) + ".js") + ");");
source.push(generateRequireString((i / 8 | 0)));
if(i > 4)
source.push("require(" + JSON.stringify("./" + (i / 4 | 0) + ".js") + ");");
source.push(generateRequireString((i / 4 | 0)));
if(i > 2)
source.push("require(" + JSON.stringify("./" + (i / 2 | 0) + ".js") + ");");
source.push(generateRequireString((i / 2 | 0)));
if(i > 0)
source.push("require(" + JSON.stringify("./" + (i - 1) + ".js") + ");");
source.push(generateRequireString((i - 1)));
source.push("module.exports = " + i + ";");
fs.writeFileSync(path.join(fixtures, i + ".js"), source.join("\n"), "utf-8");
}
Expand All @@ -25,13 +30,13 @@ for(let i = 0; i < 10000; i++) {
const source = [];
source.push("require.ensure([], function(require) {");
if(i > 8)
source.push("require(" + JSON.stringify("./" + (i / 8 | 0) + ".async.js") + ");");
source.push(generateRequireString((i / 8 | 0), "async"));
if(i > 4)
source.push("require(" + JSON.stringify("./" + (i / 4 | 0) + ".async.js") + ");");
source.push(generateRequireString((i / 4 | 0), "async"));
if(i > 2)
source.push("require(" + JSON.stringify("./" + (i / 2 | 0) + ".async.js") + ");");
source.push(generateRequireString((i / 2 | 0), "async"));
if(i > 0)
source.push("require(" + JSON.stringify("./" + (i - 1) + ".async.js") + ");");
source.push(generateRequireString((i - 1), "async"));
source.push("});");
source.push("module.exports = " + i + ";");
fs.writeFileSync(path.join(fixtures, i + ".async.js"), source.join("\n"), "utf-8");
Expand All @@ -40,13 +45,13 @@ for(let i = 0; i < 10000; i++) {
for(let i = 0; i < 100; i++) {
const source = [];
if(i > 8)
source.push("require(" + JSON.stringify("./" + (i / 8 | 0) + ".big.js") + ");");
source.push(generateRequireString((i / 8 | 0), "big"));
if(i > 4)
source.push("require(" + JSON.stringify("./" + (i / 4 | 0) + ".big.js") + ");");
source.push(generateRequireString((i / 4 | 0), "big"));
if(i > 2)
source.push("require(" + JSON.stringify("./" + (i / 2 | 0) + ".big.js") + ");");
source.push(generateRequireString((i / 2 | 0), "big"));
if(i > 0)
source.push("require(" + JSON.stringify("./" + (i - 1) + ".big.js") + ");");
source.push(generateRequireString((i - 1), "big"));
for(let j = 0; j < 300; j++)
source.push("if(Math.random())hello.world();test.a.b.c.d();x(1,2,3,4);var a,b,c,d,e,f;");
source.push("module.exports = " + i + ";");
Expand Down
48 changes: 0 additions & 48 deletions bin/config-optimist.js

This file was deleted.

0 comments on commit 90ab23a

Please sign in to comment.