Skip to content

Commit 90ab23a

Browse files
committed
Merge branch 'master' into fix/hmr-before-node-stuff
# Conflicts: # lib/HotModuleReplacementPlugin.js
2 parents 8dd3307 + 15ab027 commit 90ab23a

File tree

1,278 files changed

+28822
-21969
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,278 files changed

+28822
-21969
lines changed

.eslintrc.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module.exports = {
55
"env": {
66
"node": true,
77
"es6": true,
8+
"mocha": true,
89
},
910
"parserOptions": { "ecmaVersion": 2017 },
1011
"rules": {
@@ -46,12 +47,13 @@ module.exports = {
4647
"case": { "after": true },
4748
"return": { "after": true },
4849
"finally": { "after": true },
49-
"do": { "after": true }
50+
"do": { "after": true },
51+
"of": { "after": true }
5052
}
5153
}],
5254
"no-console": "off",
5355
"valid-jsdoc": "error",
54-
"node/no-unsupported-features": ["error", { version: 4 }],
56+
"node/no-unsupported-features": "error",
5557
"node/no-deprecated-api": "error",
5658
"node/no-missing-import": "error",
5759
"node/no-missing-require": [

.github/ISSUE_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919

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

22-
**Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.**
22+
**Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.**

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/test/fixtures/temp-cache-fixture
55
/benchmark/js
66
/benchmark/fixtures
7-
/examples/**/js
7+
/examples/**/dist
88
/coverage
99
.DS_Store
1010
*.log

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ matrix:
2424
- os: linux
2525
node_js: "6"
2626
env: NO_WATCH_TESTS=1 JOB_PART=integration
27-
- os: linux
28-
node_js: "4"
29-
env: NO_WATCH_TESTS=1 JOB_PART=integration
3027
- os: osx
3128
node_js: "8"
3229
env: NO_WATCH_TESTS=1 JOB_PART=integration
@@ -35,7 +32,9 @@ matrix:
3532
fast_finish: true
3633

3734
install:
38-
- bash ./ci/travis-install.sh
35+
- yarn --frozen-lockfile
36+
- yarn link --frozen-lockfile || true
37+
- yarn link webpack --frozen-lockfile
3938

4039
script: npm run travis:$JOB_PART
4140

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ If you are still having difficulty after looking over your configuration careful
1313
a question to [StackOverflow with the webpack tag](http://stackoverflow.com/tags/webpack). Questions
1414
that include your webpack.config.js and relevant files are more likely to receive responses.
1515

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

1818
## Contributing to the webpack ecosystem
1919

@@ -60,4 +60,4 @@ documentation.
6060

6161
## Discussions
6262

63-
Gitters is only for small questions. To discuss in long a subject, please send on gitters a link to your forum or blog.
63+
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.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ yarn add webpack --dev
5252

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

55-
> 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).
55+
> This README reflects Webpack v2.x and v3.x. The Webpack v1.x documentation has been deprecated and deleted.
5656
5757
webpack is a bundler for modules. The main purpose is to bundle JavaScript
5858
files for usage in a browser, yet it is also capable of transforming, bundling,
@@ -217,14 +217,14 @@ or are automatically applied via regex from your webpack configuration.
217217
|Name|Status|Description|
218218
|:--:|:----:|:----------|
219219
|<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|
220-
|<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|
220+
|<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|
221221
|<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|
222222
|<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|
223223

224224

225225

226226
[vue-npm]: https://img.shields.io/npm/v/vue-loader.svg
227-
[polymer-npm]: https://img.shields.io/npm/v/polymer-loader.svg
227+
[polymer-npm]: https://img.shields.io/npm/v/polymer-webpack-loader.svg
228228
[angular-npm]: https://img.shields.io/npm/v/angular2-template-loader.svg
229229
[riot-npm]: https://img.shields.io/npm/v/riot-tag-loader.svg
230230

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

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

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

437437
<div align="center">
438438

benchmark/benchmark.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const benchmarkOptions = {
1515

1616
function runTimes(compiler, times, deferred) {
1717
fs.writeFileSync(path.join(fixtures, "0.js"), "module.exports = " + Math.random(), "utf-8");
18-
compiler.run((err, stats) => {
18+
compiler.run(err => {
1919
if(err) throw err;
2020
if(times === 1)
2121
deferred.resolve();
@@ -30,12 +30,12 @@ const tests = {
3030
(size, deferred) => {
3131
webpack({
3232
context: fixtures,
33-
entry: "./" + size + ".js",
33+
entry: `./${size}.js`,
3434
output: {
3535
path: outputPath,
3636
filename: "bundle.js"
3737
}
38-
}, (err, stats) => {
38+
}, err => {
3939
if(err) throw err;
4040
deferred.resolve();
4141
});
@@ -46,66 +46,66 @@ const tests = {
4646
(size, deferred) => {
4747
webpack({
4848
context: fixtures,
49-
entry: "./" + size + ".big.js",
49+
entry: `./${size}.big.js`,
5050
output: {
5151
path: outputPath,
5252
filename: "bundle.js"
5353
},
5454
devtool: "eval"
55-
}, (err, stats) => {
55+
}, err => {
5656
if(err) throw err;
5757
deferred.resolve();
58-
})
58+
});
5959
}
6060
],
6161
"sourcemap build": [
6262
[0, 1, 2, 5, 10, 15],
6363
(size, deferred) => {
6464
webpack({
6565
context: fixtures,
66-
entry: "./" + size + ".big.js",
66+
entry: `./${size}.big.js`,
6767
output: {
6868
path: outputPath,
6969
filename: "bundle.js"
7070
},
7171
devtool: "source-map"
72-
}, (err, stats) => {
72+
}, err => {
7373
if(err) throw err;
7474
deferred.resolve();
75-
})
75+
});
7676
}
7777
],
7878
"cheap sourcemap build": [
7979
[0, 1, 2, 5, 10, 15],
8080
(size, deferred) => {
8181
webpack({
8282
context: fixtures,
83-
entry: "./" + size + ".big.js",
83+
entry: `./${size}.big.js`,
8484
output: {
8585
path: outputPath,
8686
filename: "bundle.js"
8787
},
8888
devtool: "cheap-source-map"
89-
}, function(err, stats) {
89+
}, err => {
9090
if(err) throw err;
9191
deferred.resolve();
92-
})
92+
});
9393
}
9494
],
9595
"build w/ chunks": [
9696
[0, 1, 5, 10, 50, 100, 200],
9797
(size, deferred) => {
9898
webpack({
9999
context: fixtures,
100-
entry: "./" + size + ".async.js",
100+
entry: `./${size}.async.js`,
101101
output: {
102102
path: outputPath,
103103
filename: "bundle.js"
104104
}
105-
}, function(err, stats) {
105+
}, err => {
106106
if(err) throw err;
107107
deferred.resolve();
108-
})
108+
});
109109
}
110110
],
111111
"build w/ chunks": [
@@ -118,10 +118,10 @@ const tests = {
118118
path: outputPath,
119119
filename: "bundle.js"
120120
}
121-
}, function(err, stats) {
121+
}, err => {
122122
if(err) throw err;
123123
deferred.resolve();
124-
})
124+
});
125125
}
126126
],
127127
"incremental": [
@@ -161,7 +161,7 @@ const tests = {
161161
var compiler = webpack({
162162
cache: true,
163163
context: fixtures,
164-
entry: "./" + size + ".js",
164+
entry: `./${size}.js`,
165165
output: {
166166
path: outputPath,
167167
filename: "bundle.js"
@@ -176,7 +176,7 @@ const tests = {
176176
var compiler = webpack({
177177
cache: true,
178178
context: fixtures,
179-
entry: "./" + size + ".js",
179+
entry: `./${size}.js`,
180180
output: {
181181
path: outputPath,
182182
filename: "bundle.js"
@@ -191,7 +191,7 @@ const tests = {
191191
var compiler = webpack({
192192
cache: true,
193193
context: fixtures,
194-
entry: "./" + size + ".js",
194+
entry: `./${size}.js`,
195195
output: {
196196
path: outputPath,
197197
filename: "bundle.js"
@@ -204,17 +204,17 @@ const tests = {
204204

205205
const suite = new Benchmark.Suite;
206206

207-
Object.keys(tests).filter((name) => (process.argv.length > 2) ? name.indexOf(process.argv[2]) >= 0 : true)
208-
.forEach((name) => {
207+
Object.keys(tests).filter(name => process.argv.length > 2 ? name.includes(process.argv[2]) : true)
208+
.forEach(name => {
209209
const test = tests[name];
210-
test[0].forEach((size) => {
211-
suite.add(name + " " + size, (deferred) => {
210+
test[0].forEach(size => {
211+
suite.add(`${name} ${size}`, deferred => {
212212
test[1](size, deferred);
213213
}, benchmarkOptions);
214214
});
215215
});
216216

217-
suite.on("cycle", (event) => {
217+
suite.on("cycle", event => {
218218
process.stderr.write("\n");
219219
const b = event.target;
220220
console.log(b.name + "\t" + Math.floor(1000 * (b.stats.mean - b.stats.moe)) + "\t" + Math.floor(1000 * (b.stats.mean + b.stats.moe)));

benchmark/createFixtures.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@ try {
77
fs.mkdirSync(fixtures);
88
} catch(e) {}
99

10+
function generateRequireString(conditional, suffix) {
11+
const prefixedSuffix = suffix ? `.${suffix}` : "";
12+
return `require(${JSON.stringify(`./${conditional}${prefixedSuffix}.js`)});`;
13+
}
14+
1015
for(let i = 0; i < 10000; i++) {
1116
const source = [];
1217
if(i > 8)
13-
source.push("require(" + JSON.stringify("./" + (i / 8 | 0) + ".js") + ");");
18+
source.push(generateRequireString((i / 8 | 0)));
1419
if(i > 4)
15-
source.push("require(" + JSON.stringify("./" + (i / 4 | 0) + ".js") + ");");
20+
source.push(generateRequireString((i / 4 | 0)));
1621
if(i > 2)
17-
source.push("require(" + JSON.stringify("./" + (i / 2 | 0) + ".js") + ");");
22+
source.push(generateRequireString((i / 2 | 0)));
1823
if(i > 0)
19-
source.push("require(" + JSON.stringify("./" + (i - 1) + ".js") + ");");
24+
source.push(generateRequireString((i - 1)));
2025
source.push("module.exports = " + i + ";");
2126
fs.writeFileSync(path.join(fixtures, i + ".js"), source.join("\n"), "utf-8");
2227
}
@@ -25,13 +30,13 @@ for(let i = 0; i < 10000; i++) {
2530
const source = [];
2631
source.push("require.ensure([], function(require) {");
2732
if(i > 8)
28-
source.push("require(" + JSON.stringify("./" + (i / 8 | 0) + ".async.js") + ");");
33+
source.push(generateRequireString((i / 8 | 0), "async"));
2934
if(i > 4)
30-
source.push("require(" + JSON.stringify("./" + (i / 4 | 0) + ".async.js") + ");");
35+
source.push(generateRequireString((i / 4 | 0), "async"));
3136
if(i > 2)
32-
source.push("require(" + JSON.stringify("./" + (i / 2 | 0) + ".async.js") + ");");
37+
source.push(generateRequireString((i / 2 | 0), "async"));
3338
if(i > 0)
34-
source.push("require(" + JSON.stringify("./" + (i - 1) + ".async.js") + ");");
39+
source.push(generateRequireString((i - 1), "async"));
3540
source.push("});");
3641
source.push("module.exports = " + i + ";");
3742
fs.writeFileSync(path.join(fixtures, i + ".async.js"), source.join("\n"), "utf-8");
@@ -40,13 +45,13 @@ for(let i = 0; i < 10000; i++) {
4045
for(let i = 0; i < 100; i++) {
4146
const source = [];
4247
if(i > 8)
43-
source.push("require(" + JSON.stringify("./" + (i / 8 | 0) + ".big.js") + ");");
48+
source.push(generateRequireString((i / 8 | 0), "big"));
4449
if(i > 4)
45-
source.push("require(" + JSON.stringify("./" + (i / 4 | 0) + ".big.js") + ");");
50+
source.push(generateRequireString((i / 4 | 0), "big"));
4651
if(i > 2)
47-
source.push("require(" + JSON.stringify("./" + (i / 2 | 0) + ".big.js") + ");");
52+
source.push(generateRequireString((i / 2 | 0), "big"));
4853
if(i > 0)
49-
source.push("require(" + JSON.stringify("./" + (i - 1) + ".big.js") + ");");
54+
source.push(generateRequireString((i - 1), "big"));
5055
for(let j = 0; j < 300; j++)
5156
source.push("if(Math.random())hello.world();test.a.b.c.d();x(1,2,3,4);var a,b,c,d,e,f;");
5257
source.push("module.exports = " + i + ";");

bin/config-optimist.js

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)