Skip to content

Commit 90dc639

Browse files
authored
Merge branch 'next' into use-set-in-chunks
2 parents f6a0d51 + 1ff24a7 commit 90dc639

339 files changed

Lines changed: 5554 additions & 3221 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ module.exports = {
1919
"global-require": "off",
2020
"brace-style": "error",
2121
"eol-last": "error",
22-
"indent": ["error", "tab", { "SwitchCase": 1 }],
2322
"no-extra-bind": "warn",
2423
"no-empty": "off",
2524
"no-multiple-empty-lines": "error",
@@ -36,6 +35,7 @@ module.exports = {
3635
"space-before-function-paren": ["error", "never"],
3736
"space-before-blocks": "error",
3837
"object-curly-spacing": ["error", "always"],
38+
"indent": "off",
3939
"keyword-spacing": ["error", {
4040
"after": false,
4141
"overrides": {

‎.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/**/js
88
/coverage
99
.DS_Store
1010
*.log

‎.travis.yml‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
sudo: false
2+
dist: trusty
23
language: node_js
34

45
branches:
@@ -7,9 +8,7 @@ branches:
78
- next
89

910
cache:
10-
directories:
11-
- $HOME/.npm
12-
- $HOME/.yarn-cache
11+
yarn: true
1312

1413
matrix:
1514
include:
@@ -23,7 +22,7 @@ matrix:
2322
node_js: "6"
2423
env: NO_WATCH_TESTS=1 JOB_PART=test
2524
- os: linux
26-
node_js: "4.3"
25+
node_js: "4"
2726
env: NO_WATCH_TESTS=1 JOB_PART=test
2827
- os: osx
2928
node_js: "8"
@@ -32,7 +31,7 @@ matrix:
3231
- os: osx
3332
fast_finish: true
3433

35-
before_script:
34+
install:
3635
- bash ./ci/travis-install.sh
3736

3837
script: npm run travis:$JOB_PART

‎README.md‎

Lines changed: 187 additions & 15 deletions
Large diffs are not rendered by default.

‎benchmark/createBenchmark.js‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const webpack = require("webpack");
2+
const path = require("path");
3+
4+
webpack({
5+
context: __dirname,
6+
entry: "./createBenchmark/entry.js",
7+
output: {
8+
path: __dirname,
9+
filename: "benchmark-bundle.js"
10+
},
11+
target: "node",
12+
node: {
13+
__dirname: false
14+
},
15+
plugins: [
16+
new webpack.NamedModulesPlugin(),
17+
new webpack.IgnorePlugin(/^(fsevents|uglify-js)$/),
18+
new webpack.NormalModuleReplacementPlugin(/^.\/loadLoader$/, path.resolve(__dirname, "./createBenchmark/loadLoader"))
19+
]
20+
}, function(err, stats) {
21+
console.log(stats.toString());
22+
});

‎benchmark/createBenchmark/entry.js‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const webpack = require("webpack");
2+
const MemoryFs = require("memory-fs");
3+
const path = require("path");
4+
5+
const testCase = process.argv[2];
6+
7+
const config = {
8+
context: __dirname,
9+
entry: `./${testCase}`,
10+
output: {
11+
path: path.resolve(__dirname, "output-" + testCase)
12+
},
13+
devtool: process.argv[3]
14+
};
15+
16+
const compiler = webpack(config);
17+
compiler.run((err, stats) => {
18+
if(err) {
19+
console.error(err);
20+
} else {
21+
console.log(stats.toString({
22+
errorDetails: true
23+
}));
24+
}
25+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = (loader, callback) => {
2+
callback(new Error("Loaders are not supported"));
3+
}

‎benchmark/createTestCases.js‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
let avgJs = `
2+
const str = "we" + "do" + "some" + "ops";
3+
for(const x of str.split("")) {
4+
if(x.charCodeAt(0) > 40) {
5+
console.log("omg");
6+
} else {
7+
console.log(Math.random() * 2 + 3 * 2);
8+
}
9+
}
10+
11+
// Some comment
12+
switch(a.b.c.d.f.e.g.h.i) {
13+
case true:
14+
break;
15+
case "magic":
16+
throw new Error("Error!");
17+
case 9:
18+
(function() {
19+
// extra scope
20+
var x = 123;
21+
var y = 456;
22+
var z = x + z * x / y;
23+
x && y && (z = x ? y : x);
24+
}())
25+
}
26+
27+
function a() {}
28+
function b() {}
29+
function c() {}
30+
function d() {}
31+
function e() {}
32+
function f() {}
33+
`
34+
35+
for(var i = 0; i < 2; i++) {
36+
avgJs += `(function() {${avgJs}}());`;
37+
}
38+
39+
const fs = require("fs");
40+
const root = __dirname;
41+
42+
createTree(fs, 100, `${root}/modules-100`);
43+
createTree(fs, 500, `${root}/modules-500`);
44+
createTree(fs, 1000, `${root}/modules-1000`);
45+
createTree(fs, 3000, `${root}/modules-3000`);
46+
createTree(fs, 5000, `${root}/modules-5000`);
47+
48+
function createTree(fs, count, folder) {
49+
fs.mkdirSync(folder);
50+
let remaining = count - 1;
51+
52+
function make(prefix, count, depth) {
53+
if(count === 0) {
54+
fs.writeFileSync(`${folder}/${prefix}.js`, `export default 1;\n${avgJs}`);
55+
} else {
56+
const list = [];
57+
for(let i = 0; i < count; i++) {
58+
if(remaining-- <= 0) break;
59+
if(depth <= 4 && i >= 3 && i <= 4) {
60+
list.push(`const module${i} = import("./${prefix}-${i}");\ncounter += module${i};`);
61+
} else {
62+
list.push(`import module${i} from "./${prefix}-${i}";\ncounter += module${i};`);
63+
}
64+
make(`${prefix}-${i}`, depth > 4 || count > 30 ? 0 : count + depth + i ** 2, depth + 1);
65+
}
66+
fs.writeFileSync(`${folder}/${prefix}.js`, `let counter = 0;\n${list.join("\n")};\nexport default counter;\n${avgJs}`)
67+
}
68+
}
69+
make("index", 2, 0);
70+
}

‎bin/config-optimist.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module.exports = function(optimist) {
22
optimist
33
.boolean("help").alias("help", "h").alias("help", "?").describe("help")
44
.string("config").describe("config", "Path to the config file")
5+
.string("config-name").describe("config-name", "Name of the config to use")
56
.string("env").describe("env", "Environment passed to the config, when it is a function")
67
.string("context").describe("context", "The root directory for resolving entry point and stats")
78
.string("entry").describe("entry", "The entry point")

‎bin/config-yargs.js‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ module.exports = function(yargs) {
2020
defaultDescription: "webpack.config.js or webpackfile.js",
2121
requiresArg: true
2222
},
23+
"config-name": {
24+
type: "string",
25+
describe: "Name of the config to use",
26+
group: CONFIG_GROUP,
27+
requiresArg: true
28+
},
2329
"env": {
2430
describe: "Environment passed to the config, when it is a function",
2531
group: CONFIG_GROUP
@@ -166,7 +172,7 @@ module.exports = function(yargs) {
166172
requiresArg: true
167173
},
168174
"watch-poll": {
169-
type: "boolean",
175+
type: "string",
170176
describe: "The polling interval for watching (also enable polling)",
171177
group: ADVANCED_GROUP
172178
},
@@ -194,7 +200,7 @@ module.exports = function(yargs) {
194200
},
195201
"resolve-extensions": {
196202
"type": "array",
197-
describe: "Setup extensions that should be used to resolve modules (Example: --resolve-extensions .es6 .js)",
203+
describe: "Setup extensions that should be used to resolve modules (Example: --resolve-extensions .es6,.js)",
198204
group: RESOLVE_GROUP,
199205
requiresArg: true
200206
},
@@ -245,12 +251,14 @@ module.exports = function(yargs) {
245251
"bail": {
246252
type: "boolean",
247253
describe: "Abort the compilation on first error",
248-
group: ADVANCED_GROUP
254+
group: ADVANCED_GROUP,
255+
default: null
249256
},
250257
"profile": {
251258
type: "boolean",
252259
describe: "Profile the compilation and include information in stats",
253-
group: ADVANCED_GROUP
260+
group: ADVANCED_GROUP,
261+
default: null
254262
},
255263
"d": {
256264
type: "boolean",

0 commit comments

Comments
 (0)