Skip to content

Commit

Permalink
Merge branch 'master' into fix/node_modules_mangle
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Apr 11, 2017
2 parents dca8e62 + 813053e commit 26f79f5
Show file tree
Hide file tree
Showing 502 changed files with 16,079 additions and 10,297 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ indent_size = 2
indent_style = space
indent_size = 2

[*.yaml]
indent_style = space
indent_size = 2

[test/cases/parsing/bom/bomfile.{css,js}]
charset = utf-8-bom

Expand Down
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ matrix:
- os: linux
node_js: "7"
env: NO_WATCH_TESTS=1 JOB_PART=lint
- os: linux
node_js: "7"
env: NO_WATCH_TESTS=1 JOB_PART=benchmark
- os: linux
node_js: "7"
env: NO_WATCH_TESTS=1 JOB_PART=test
Expand All @@ -32,7 +29,6 @@ matrix:
env: NO_WATCH_TESTS=1 JOB_PART=test
allow_failures:
- os: osx
- env: NO_WATCH_TESTS=1 JOB_PART=benchmark
fast_finish: true

before_script:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ that include your webpack.config.js and relevant files are more likely to receiv
If you have created your own loader/plugin please include it on the relevant
documentation pages:

[List of loaders](https://webpack.github.io/docs/list-of-loaders.html)
[List of plugins](https://webpack.github.io/docs/list-of-plugins.html)
[List of loaders](https://webpack.js.org/loaders/) or [awesome-webpack](https://github.com/webpack-contrib/awesome-webpack#loaders)
[List of plugins](https://webpack.js.org/plugins) or [awesome-webpack](https://github.com/webpack-contrib/awesome-webpack#webpack-plugins)

## Setup

Expand Down
291 changes: 153 additions & 138 deletions README.md

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ environment:
job_part: test
- nodejs_version: 6
job_part: test
- nodejs_version: 7
job_part: benchmark

install:
- ps: Install-Product node $env:nodejs_version x64
Expand Down
10 changes: 5 additions & 5 deletions benchmark/createFixtures2.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ try {

function genModule(prefix, depth, asyncDepth, multiplex, r, circular) {
var source = [];
var async = depth >= asyncDepth;
if(!async)
var isAsync = depth >= asyncDepth;
if(!isAsync)
circular.push(path.resolve(fixtures, prefix + "/index.js"));
source.push("(function() {");
var m = (r % multiplex) + 1;
Expand All @@ -23,7 +23,7 @@ function genModule(prefix, depth, asyncDepth, multiplex, r, circular) {
sum += genModule(prefix + "/" + i, depth - 1, asyncDepth, multiplex, (r + i + depth) * m + i + depth, circular);
source.push("require(" + JSON.stringify("./" + i) + ");");
if(i === 0) {
if(async)
if(isAsync)
source.push("}); require.ensure([], function() {");
}
}
Expand All @@ -42,8 +42,8 @@ for(var i = 2; i < 14; i++) {
console.log("generated tree", i, count);
}

for(var i = 2; i < 14; i++) {
var count = genModule("async-tree-" + i, 6, 1, i, 0, []);
for(i = 2; i < 14; i++) {
count = genModule("async-tree-" + i, 6, 1, i, 0, []);
console.log("generated async tree", i, count);
}

Expand Down
5 changes: 2 additions & 3 deletions bin/config-optimist.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = function(optimist) {
optimist
.boolean("help").alias("help", "h").alias("help", "?").describe("help")
.string("config").describe("config", "Path to the config file")
.string("env").describe("env", "Enviroment passed to the config, when it is a function")
.string("env").describe("env", "Environment passed to the config, when it is a function")
.string("context").describe("context", "The root directory for resolving entry point and stats")
.string("entry").describe("entry", "The entry point")
.string("module-bind").describe("module-bind", "Bind an extension to a loader")
Expand All @@ -21,7 +21,7 @@ module.exports = function(optimist) {
.string("records-output-path").describe("records-output-path", "Path to the records file (writing)")
.string("records-path").describe("records-path", "Path to the records file")
.string("define").describe("define", "Define any free var in the bundle")
.string("target").describe("target", "The targeted execution enviroment")
.string("target").describe("target", "The targeted execution environment")
.boolean("cache").describe("cache", "Enable in memory caching").default("cache", true)
.boolean("watch").alias("watch", "w").describe("watch", "Watch the filesystem for changes")
.boolean("watch-stdin").alias("watch-stdin", "stdin").describe("Exit the process when stdin is closed")
Expand All @@ -39,7 +39,6 @@ module.exports = function(optimist) {
.boolean("optimize-minimize").describe("optimize-minimize", "Minimize javascript and switches loaders to minimizing")
.string("prefetch").describe("prefetch", "Prefetch this request")
.string("provide").describe("provide", "Provide these modules as free vars in all modules")
.boolean("labeled-modules").describe("labeled-modules", "Enables labeled modules")
.string("plugin").describe("plugin", "Load this plugin")
.boolean("bail").describe("bail", "Abort the compilation on first error")
.boolean("profile").describe("profile", "Profile the compilation and include information in stats")
Expand Down
4 changes: 2 additions & 2 deletions bin/config-yargs.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = function(yargs) {
requiresArg: true
},
"env": {
describe: "Enviroment passed to the config, when it is a function",
describe: "Environment passed to the config, when it is a function",
group: CONFIG_GROUP
},
"context": {
Expand Down Expand Up @@ -137,7 +137,7 @@ module.exports = function(yargs) {
},
"target": {
type: "string",
describe: "The targeted execution enviroment",
describe: "The targeted execution environment",
group: ADVANCED_GROUP,
requiresArg: true
},
Expand Down
12 changes: 8 additions & 4 deletions bin/convert-argv.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,11 @@ module.exports = function(yargs, argv, convertOptions) {
}

ifArgPair("entry", function(name, entry) {
options.entry[name] = entry;
if(typeof options.entry[name] !== "undefined" && options.entry[name] !== null) {
options.entry[name] = [].concat(options.entry[name]).concat(entry);
} else {
options.entry[name] = entry;
}
}, function() {
ensureObject(options, "entry");
});
Expand Down Expand Up @@ -316,7 +320,7 @@ module.exports = function(yargs, argv, convertOptions) {

ifArg("output-path", function(value) {
ensureObject(options, "output");
options.output.path = value;
options.output.path = path.resolve(value);
});

ifArg("output-filename", function(value) {
Expand Down Expand Up @@ -478,11 +482,11 @@ module.exports = function(yargs, argv, convertOptions) {
if(noOutputFilenameDefined) {
ensureObject(options, "output");
if(convertOptions && convertOptions.outputFilename) {
options.output.path = path.dirname(convertOptions.outputFilename);
options.output.path = path.resolve(path.dirname(convertOptions.outputFilename));
options.output.filename = path.basename(convertOptions.outputFilename);
} else if(argv._.length > 0) {
options.output.filename = argv._.pop();
options.output.path = path.dirname(options.output.filename);
options.output.path = path.resolve(path.dirname(options.output.filename));
options.output.filename = path.basename(options.output.filename);
} else if(configFileLoaded) {
throw new Error("'output.filename' is required, either in config file or as --output-filename");
Expand Down
4 changes: 2 additions & 2 deletions bin/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ try {
} catch(e) {}
var yargs = require("yargs")
.usage("webpack " + require("../package.json").version + "\n" +
"Usage: https://webpack.github.io/docs/cli.html\n" +
"Usage: https://webpack.js.org/api/cli/\n" +
"Usage without config file: webpack <entry> [<entry>] <output>\n" +
"Usage with config file: webpack");

Expand Down Expand Up @@ -266,7 +266,7 @@ function processOptions(options) {
});

if(!outputOptions.exclude)
outputOptions.exclude = ["node_modules", "bower_components", "jam", "components"];
outputOptions.exclude = ["node_modules", "bower_components", "components"];

if(argv["display-modules"]) {
outputOptions.maxModules = Infinity;
Expand Down
7 changes: 7 additions & 0 deletions buildin/system.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Provide a "System" global.
module.exports = {
// Make sure import is only used as "System.import"
import: function() {
throw new Error("System.import cannot be used indirectly");
}
};
34 changes: 15 additions & 19 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,58 @@
# examples

## commonjs
## [commonjs](commonjs)

example demonstrating a very simple program

## code-splitting
## [code-splitting](code-splitting)

example demonstrating a very simple case of Code Splitting.

## require.resolve
## [require.resolve](require.resolve)

example demonstrating how to cache clearing of modules with `require.resolve` and `require.cache`.

## require.context
## [require.context](require.context)

example demonstrating automatic creation of contexts when using variables in `require`.

## code-splitted-require.context
## [code-splitted-require.context](code-splitted-require.context)

example demonstrating contexts in a code-split environment.

## code-splitted-require.context-amd
## [code-splitted-require.context-amd](code-splitted-require.context-amd)

example demonstrating contexts in a code-split environment with AMD.

## loader
## [loader](loader)

example demonstrating the usage of loaders.

## coffee-script
## [coffee-script](coffee-script)

example demonstrating code written in coffee-script.

## code-splitting-bundle-loader
## [code-splitting-bundle-loader](code-splitting-bundle-loader)

example demonstrating Code Splitting through the builder loader

## names-chunks
## [names-chunks](names-chunks)

example demonstrating merging of chunks with named chunks

## labeled-modules
## [mixed](mixed)

example demonstrating Labeled Modules
example demonstrating mixing CommonJs and AMD

## mixed

example demonstrating mixing CommonJs, AMD, and Labeled Modules

## web-worker
## [web-worker](web-worker)

example demonstrating creating WebWorkers with webpack and the worker-loader.

## i18n
## [i18n](i18n)

example demonstrating localization.

## multiple-entry-points
## [multiple-entry-points](multiple-entry-points)

example demonstrating multiple entry points with Code Splitting.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,22 @@ module.exports = {
moveToParents: true
})
]
}
};
```

# Info

## Uncompressed

```
Hash: 06f18f1663d1b6555aff
Version: webpack 2.2.0-rc.2
Hash: 75bcce350a8b5f748873
Version: webpack 2.3.2
Asset Size Chunks Chunk Names
0.chunk.js 5.76 kB 0 [emitted]
1.chunk.js 397 bytes 1 [emitted]
pageB.bundle.js 6.17 kB 2 [emitted] pageB
pageA.bundle.js 6.14 kB 3 [emitted] pageA
pageC.bundle.js 5.94 kB 4 [emitted] pageC
1.chunk.js 401 bytes 1 [emitted]
pageB.bundle.js 6.41 kB 2 [emitted] pageB
pageA.bundle.js 6.38 kB 3 [emitted] pageA
pageC.bundle.js 6.17 kB 4 [emitted] pageC
Entrypoint pageA = pageA.bundle.js
Entrypoint pageB = pageB.bundle.js
Entrypoint pageC = pageC.bundle.js
Expand Down Expand Up @@ -101,8 +101,8 @@ chunk {4} pageC.bundle.js (pageC) 70 bytes [entry] [rendered]
## Minimized (uglify-js, no zip)

```
Hash: 06f18f1663d1b6555aff
Version: webpack 2.2.0-rc.2
Hash: 75bcce350a8b5f748873
Version: webpack 2.3.2
Asset Size Chunks Chunk Names
0.chunk.js 75 bytes 0 [emitted]
1.chunk.js 78 bytes 1 [emitted]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions examples/build-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var displayReasons = global.NO_REASONS ? "" : " --display-reasons --display-used
if (error !== null && remainingTimes === 1)
console.log(error);
try {
var readme = tc(fs.readFileSync(require("path").join(process.cwd(), "template.md"), "utf-8"), process.cwd(), stdout.replace(/[\r\n]*$/, ""), "min");
var readme = tc.replaceResults(fs.readFileSync(require("path").join(process.cwd(), "template.md"), "utf-8"), process.cwd(), stdout.replace(/[\r\n]*$/, ""), "min");
} catch(e) {
console.log(stderr);
throw e;
Expand All @@ -29,8 +29,8 @@ var displayReasons = global.NO_REASONS ? "" : " --display-reasons --display-used
console.log(stderr);
if (error !== null && remainingTimes === 1)
console.log(error);
readme = tc(readme, process.cwd(), stdout.replace(/[\r\n]*$/, ""));
readme = readme.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
readme = tc.replaceResults(readme, process.cwd(), stdout.replace(/[\r\n]*$/, ""));
readme = tc.replaceBase(readme);
fs.writeFile("README.md", readme, "utf-8", function() {});
if(remainingTimes > 1)
doIt(remainingTimes - 1);
Expand Down

0 comments on commit 26f79f5

Please sign in to comment.