Skip to content

Commit 7b5c351

Browse files
committed
Merge branch 'v4-beta3' into jest
# Conflicts: # test/BenchmarkTestCases.benchmark.js # test/CachePlugin.unittest.js # test/HotTestCases.test.js # test/NormalModule.unittest.js # test/ProfilingPlugin.unittest.js # test/TestCases.test.js # test/configCases/parsing/harmony-this/index.js # test/configCases/plugins/profiling-plugin/index.js # test/configCases/plugins/profiling-plugin/webpack.config.js # test/watchCases/runtime/static-import/0/index.js # yarn.lock
2 parents e04b476 + 4c25bfb commit 7b5c351

281 files changed

Lines changed: 3035 additions & 1392 deletions

File tree

Some content is hidden

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

‎.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.**

‎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 + ";");

‎examples/aggressive-merging/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ module.exports = {
6060

6161
```
6262
Hash: 0a1b2c3d4e5f6a7b8c9d
63-
Version: webpack next
63+
Version: webpack 4.0.0-beta.2
6464
Asset Size Chunks Chunk Names
6565
0.chunk.js 5.98 KiB 0 [emitted]
6666
1.chunk.js 405 bytes 1 [emitted]
@@ -108,7 +108,7 @@ chunk {4} pageA.bundle.js (pageA) 71 bytes >{0}< [entry] [rendered]
108108

109109
```
110110
Hash: 0a1b2c3d4e5f6a7b8c9d
111-
Version: webpack next
111+
Version: webpack 4.0.0-beta.2
112112
Asset Size Chunks Chunk Names
113113
0.chunk.js 173 bytes 0, 1 [emitted]
114114
1.chunk.js 118 bytes 1 [emitted]

‎examples/build-common.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const cp = require("child_process");
88
const path = require("path");
99
const tc = require("./template-common");
1010
const fs = require("fs");
11-
const async = require("async");
11+
const async = require("neo-async");
1212

1313
const extraArgs = "";
1414

0 commit comments

Comments
 (0)