Skip to content

Commit dbc02de

Browse files
committed
Merge branch 'next' into 5769_file_size_in_kibibytes
# Conflicts: # test/statsCases/aggressive-splitting-entry/expected.txt # test/statsCases/aggressive-splitting-on-demand/expected.txt # test/statsCases/chunks/expected.txt # test/statsCases/color-disabled/expected.txt # test/statsCases/color-enabled-custom/expected.txt # test/statsCases/color-enabled/expected.txt # test/statsCases/commons-chunk-min-size-0/expected.txt # test/statsCases/commons-chunk-min-size-Infinity/expected.txt # test/statsCases/commons-plugin-issue-4980/expected.txt # test/statsCases/define-plugin/expected.txt # test/statsCases/exclude-with-loader/expected.txt # test/statsCases/external/expected.txt # test/statsCases/filter-warnings/expected.txt # test/statsCases/import-weak/expected.txt # test/statsCases/limit-chunk-count-plugin/expected.txt # test/statsCases/max-modules-default/expected.txt # test/statsCases/max-modules/expected.txt # test/statsCases/module-trace-disabled-in-error/expected.txt # test/statsCases/module-trace-enabled-in-error/expected.txt # test/statsCases/named-chunks-plugin-async/expected.txt # test/statsCases/named-chunks-plugin/expected.txt # test/statsCases/optimize-chunks/expected.txt # test/statsCases/performance-disabled/expected.txt # test/statsCases/performance-error/expected.txt # test/statsCases/performance-no-async-chunks-shown/expected.txt # test/statsCases/performance-no-hints/expected.txt # test/statsCases/preset-detailed/expected.txt # test/statsCases/preset-normal-performance-ensure-filter-sourcemaps/expected.txt # test/statsCases/preset-normal-performance/expected.txt # test/statsCases/preset-normal/expected.txt # test/statsCases/preset-verbose/expected.txt # test/statsCases/resolve-plugin-context/expected.txt # test/statsCases/reverse-sort-modules/expected.txt # test/statsCases/separate-css-bundle/expected.txt # test/statsCases/simple-more-info/expected.txt # test/statsCases/simple/expected.txt # test/statsCases/tree-shaking/expected.txt # test/statsCases/warnings-uglifyjs/expected.txt
2 parents c9e3591 + 8915dbb commit dbc02de

589 files changed

Lines changed: 11301 additions & 5271 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.

‎.eslintrc.js‎

Lines changed: 2 additions & 1 deletion
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": {
@@ -51,7 +52,7 @@ module.exports = {
5152
}],
5253
"no-console": "off",
5354
"valid-jsdoc": "error",
54-
"node/no-unsupported-features": ["error", { version: 4 }],
55+
"node/no-unsupported-features": "error",
5556
"node/no-deprecated-api": "error",
5657
"node/no-missing-import": "error",
5758
"node/no-missing-require": [

‎.istanbul.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
instrumentation:
2+
excludes:
3+
- "**/*.runtime.js"

‎.travis.yml‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ matrix:
1717
env: NO_WATCH_TESTS=1 JOB_PART=lint
1818
- os: linux
1919
node_js: "8"
20-
env: NO_WATCH_TESTS=1 JOB_PART=test
20+
env: NO_WATCH_TESTS=1 JOB_PART=integration
2121
- os: linux
22-
node_js: "6"
23-
env: NO_WATCH_TESTS=1 JOB_PART=test
22+
node_js: "8"
23+
env: NO_WATCH_TESTS=1 JOB_PART=unit
2424
- os: linux
25-
node_js: "4"
26-
env: NO_WATCH_TESTS=1 JOB_PART=test
25+
node_js: "6"
26+
env: NO_WATCH_TESTS=1 JOB_PART=integration
2727
- os: osx
2828
node_js: "8"
29-
env: NO_WATCH_TESTS=1 JOB_PART=test
29+
env: NO_WATCH_TESTS=1 JOB_PART=integration
3030
allow_failures:
3131
- os: osx
3232
fast_finish: true
@@ -38,7 +38,7 @@ script: npm run travis:$JOB_PART
3838

3939
after_success:
4040
- cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose
41-
- cat ./coverage/coverage.json | node_modules/codecov.io/bin/codecov.io.js
41+
- bash <(curl -s https://codecov.io/bash) -F $JOB_PART
4242
- rm -rf ./coverage
4343

4444
notifications:

‎appveyor.yml‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ branches:
99
init:
1010
- git config --global core.autocrlf input
1111

12-
clone_depth: 50
13-
1412
# what combinations to test
1513
environment:
1614
matrix:
1715
- nodejs_version: 8
18-
job_part: test
16+
job_part: unit
17+
- nodejs_version: 8
18+
job_part: integration
1919
- nodejs_version: 6
20-
job_part: test
20+
job_part: integration
2121

2222
install:
2323
- ps: Install-Product node $env:nodejs_version x64
@@ -36,3 +36,4 @@ test_script:
3636
- npm --version
3737
- yarn --version
3838
- cmd: npm run appveyor:%job_part%
39+
- cmd: npm install -g codecov && codecov -F %job_part%

‎bin/convert-argv.js‎

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,11 @@ module.exports = function(yargs, argv, convertOptions) {
283283
}
284284
}
285285

286+
function addPlugin(options, plugin) {
287+
ensureArray(options, "plugins");
288+
options.plugins.unshift(plugin);
289+
}
290+
286291
ifArgPair("entry", function(name, entry) {
287292
if(typeof options.entry[name] !== "undefined" && options.entry[name] !== null) {
288293
options.entry[name] = [].concat(options.entry[name]).concat(entry);
@@ -328,9 +333,8 @@ module.exports = function(yargs, argv, convertOptions) {
328333
}, function() {
329334
defineObject = {};
330335
}, function() {
331-
ensureArray(options, "plugins");
332336
var DefinePlugin = require("../lib/DefinePlugin");
333-
options.plugins.push(new DefinePlugin(defineObject));
337+
addPlugin(options, new DefinePlugin(defineObject));
334338
});
335339

336340
ifArg("output-path", function(value) {
@@ -398,15 +402,13 @@ module.exports = function(yargs, argv, convertOptions) {
398402
mapArgToBoolean("cache");
399403

400404
ifBooleanArg("hot", function() {
401-
ensureArray(options, "plugins");
402405
var HotModuleReplacementPlugin = require("../lib/HotModuleReplacementPlugin");
403-
options.plugins.push(new HotModuleReplacementPlugin());
406+
addPlugin(options, new HotModuleReplacementPlugin());
404407
});
405408

406409
ifBooleanArg("debug", function() {
407-
ensureArray(options, "plugins");
408410
var LoaderOptionsPlugin = require("../lib/LoaderOptionsPlugin");
409-
options.plugins.push(new LoaderOptionsPlugin({
411+
addPlugin(options, new LoaderOptionsPlugin({
410412
debug: true
411413
}));
412414
});
@@ -438,41 +440,36 @@ module.exports = function(yargs, argv, convertOptions) {
438440
});
439441

440442
ifArg("optimize-max-chunks", function(value) {
441-
ensureArray(options, "plugins");
442443
var LimitChunkCountPlugin = require("../lib/optimize/LimitChunkCountPlugin");
443-
options.plugins.push(new LimitChunkCountPlugin({
444+
addPlugin(options, new LimitChunkCountPlugin({
444445
maxChunks: parseInt(value, 10)
445446
}));
446447
});
447448

448449
ifArg("optimize-min-chunk-size", function(value) {
449-
ensureArray(options, "plugins");
450450
var MinChunkSizePlugin = require("../lib/optimize/MinChunkSizePlugin");
451-
options.plugins.push(new MinChunkSizePlugin({
451+
addPlugin(options, new MinChunkSizePlugin({
452452
minChunkSize: parseInt(value, 10)
453453
}));
454454
});
455455

456456
ifBooleanArg("optimize-minimize", function() {
457-
ensureArray(options, "plugins");
458457
var UglifyJsPlugin = require("../lib/optimize/UglifyJsPlugin");
459458
var LoaderOptionsPlugin = require("../lib/LoaderOptionsPlugin");
460-
options.plugins.push(new UglifyJsPlugin({
459+
addPlugin(options, new UglifyJsPlugin({
461460
sourceMap: options.devtool && (options.devtool.indexOf("sourcemap") >= 0 || options.devtool.indexOf("source-map") >= 0)
462461
}));
463-
options.plugins.push(new LoaderOptionsPlugin({
462+
addPlugin(options, new LoaderOptionsPlugin({
464463
minimize: true
465464
}));
466465
});
467466

468467
ifArg("prefetch", function(request) {
469-
ensureArray(options, "plugins");
470468
var PrefetchPlugin = require("../lib/PrefetchPlugin");
471-
options.plugins.push(new PrefetchPlugin(request));
469+
addPlugin(options, new PrefetchPlugin(request));
472470
});
473471

474472
ifArg("provide", function(value) {
475-
ensureArray(options, "plugins");
476473
var idx = value.indexOf("=");
477474
var name;
478475
if(idx >= 0) {
@@ -482,12 +479,11 @@ module.exports = function(yargs, argv, convertOptions) {
482479
name = value;
483480
}
484481
var ProvidePlugin = require("../lib/ProvidePlugin");
485-
options.plugins.push(new ProvidePlugin(name, value));
482+
addPlugin(options, new ProvidePlugin(name, value));
486483
});
487484

488485
ifArg("plugin", function(value) {
489-
ensureArray(options, "plugins");
490-
options.plugins.push(loadPlugin(value));
486+
addPlugin(options, loadPlugin(value));
491487
});
492488

493489
mapArgToBoolean("bail");

‎bin/webpack.js‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,12 @@ yargs.parse(process.argv.slice(2), (err, argv, output) => {
211211
if(typeof outputOptions.context === "undefined")
212212
outputOptions.context = firstOptions.context;
213213

214+
ifArg("env", function(value) {
215+
if(outputOptions.env) {
216+
outputOptions._env = value;
217+
}
218+
});
219+
214220
ifArg("json", function(bool) {
215221
if(bool)
216222
outputOptions.json = bool;
@@ -327,16 +333,19 @@ yargs.parse(process.argv.slice(2), (err, argv, output) => {
327333
var compiler;
328334
try {
329335
compiler = webpack(options);
330-
} catch(e) {
331-
var WebpackOptionsValidationError = require("../lib/WebpackOptionsValidationError");
332-
if(e instanceof WebpackOptionsValidationError) {
336+
} catch(err) {
337+
if(err.name === "WebpackOptionsValidationError") {
333338
if(argv.color)
334-
console.error("\u001b[1m\u001b[31m" + e.message + "\u001b[39m\u001b[22m");
339+
console.error(
340+
`\u001b[1m\u001b[31m${err.message}\u001b[39m\u001b[22m`
341+
);
335342
else
336-
console.error(e.message);
337-
process.exit(1); // eslint-disable-line no-process-exit
343+
console.error(err.message);
344+
// eslint-disable-next-line no-process-exit
345+
process.exit(1);
338346
}
339-
throw e;
347+
348+
throw err;
340349
}
341350

342351
if(argv.progress) {

‎circle.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ machine:
88

99
dependencies:
1010
pre:
11-
- case $CIRCLE_NODE_INDEX in 0) NODE_VERSION=4 ;; 1) NODE_VERSION=8 ;; esac; nvm install $NODE_VERSION && nvm alias default $NODE_VERSION
11+
- case $CIRCLE_NODE_INDEX in 0) NODE_VERSION=6 ;; 1) NODE_VERSION=8 ;; esac; nvm install $NODE_VERSION && nvm alias default $NODE_VERSION
1212
override:
1313
- yarn
1414
- yarn link || true && yarn link webpack

‎codecov.yml‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,29 @@ coverage:
66
range: "70...100"
77
status:
88
project:
9-
default:
9+
default: off
10+
integration:
11+
flags: integration
1012
target: auto
13+
unit:
14+
flags: unit
15+
target: 0%
1116
patch:
12-
default:
13-
target: auto
17+
default: off
18+
integration:
19+
flags: integration
20+
target: 90%
21+
base: pr
22+
unit:
23+
flags: unit
24+
target: 0%
25+
base: pr
1426
changes:
15-
default:
16-
branches: null
17-
comment: off
27+
default: off
28+
integration:
29+
flags: integration
30+
target: 0%
31+
unit:
32+
flags: unit
33+
target: 0%
34+
comment: off

‎examples/README.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
[multiple-entry-points-commons-chunk-css-bundle](multiple-entry-points-commons-chunk-css-bundle)
2323

24-
[names-chunks](names-chunks) example demonstrating merging of chunks with named chunks
24+
[named-chunks](named-chunks) example demonstrating merging of chunks with named chunks
2525

2626
[two-explicit-vendor-chunks](two-explicit-vendor-chunks)
2727

@@ -106,6 +106,9 @@
106106
## Scope Hoisting
107107
[scope-hoisting](scope-hoisting)
108108

109+
## Pure Module
110+
[pure-module](pure-module)
111+
109112
## Source Map
110113
[source-map](source-map)
111114

‎examples/code-splitted-css-bundle/webpack.config.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var ExtractTextPlugin = require("extract-text-webpack-plugin");
22
module.exports = {
33
module: {
4-
loaders: [
4+
rules: [
55
{
66
test: /\.css$/,
77
use: ExtractTextPlugin.extract({

0 commit comments

Comments
 (0)