Merge branch 'master' into webpack-2

Conflicts:
	hot/dev-server.js
	hot/only-dev-server.js
	hot/poll.js
	hot/signal.js
	lib/ChunkTemplate.js
	lib/HotModuleReplacement.runtime.js
	lib/HotModuleReplacementPlugin.js
	lib/JsonpMainTemplatePlugin.js
	lib/MainTemplate.js
	lib/NormalModule.js
	lib/Parser.js
	lib/RecordIdsPlugin.js
	lib/WebpackOptionsApply.js
	lib/dependencies/RequireEnsureDependency.js
	lib/node/OldNodeWatchFileSystem.js
	lib/optimize/OccurrenceOrderPlugin.js
	package.json
This commit is contained in:
Tobias Koppers 2015-07-17 09:30:37 +02:00
commit 431a4c791c
138 changed files with 1326 additions and 995 deletions

View File

@ -2,17 +2,27 @@
"env": { "env": {
"node": true "node": true
}, },
"plugins": [
"nodeca"
],
"rules": { "rules": {
"strict": 0, "strict": 0,
"camelcase": 0,
"curly": 0, "curly": 0,
"indent": [0, "tab"],
"nodeca/indent": [2, "tabs", 1 ],
"eol-last": 1, "eol-last": 1,
"no-shadow": 0, "no-shadow": 0,
"no-redeclare": 1, "no-redeclare": 1,
"no-extra-bind": 1, "no-extra-bind": 1,
"no-empty": 0,
"no-process-exit": 1,
"no-underscore-dangle": 0, "no-underscore-dangle": 0,
"no-use-before-define": 0, "no-use-before-define": 0,
"no-unused-vars": 0,
"consistent-return": 0, "consistent-return": 0,
"no-inner-declarations": 1, "no-inner-declarations": 1,
"no-loop-func": 1 "no-loop-func": 1,
"space-before-function-paren": [2, "never"]
} }
} }

1
.gitignore vendored
View File

@ -6,3 +6,4 @@
/examples/*/js /examples/*/js
/coverage /coverage
.DS_Store .DS_Store
*.log

25
.jsbeautifyrc Normal file
View File

@ -0,0 +1,25 @@
{
"js": {
"allowed_file_extensions": ["js", "json", "jshintrc", "jsbeautifyrc"],
"brace_style": "collapse",
"break_chained_methods": false,
"e4x": true,
"eval_code": false,
"end_with_newline": true,
"indent_char": "\t",
"indent_level": 0,
"indent_size": 1,
"indent_with_tabs": true,
"jslint_happy": false,
"jslint_happy_align_switch_case": true,
"space_after_anon_function": false,
"keep_array_indentation": false,
"keep_function_indentation": false,
"max_preserve_newlines": 2,
"preserve_newlines": true,
"space_before_conditional": false,
"space_in_paren": false,
"unescape_strings": false,
"wrap_line_length": 0
}
}

View File

@ -1,6 +1,22 @@
[![webpack](http://webpack.github.io/assets/logo.png)](http://webpack.github.io) [![webpack](http://webpack.github.io/assets/logo.png)](http://webpack.github.io)
[![NPM version][npm-image]][npm-url] [![Gitter chat][gitter-image]][gitter-url] [![Gittip donate button][gittip-image]][gittip-url]
[![NPM version][npm-image]][npm-url] [![Gitter chat][gitter-image]][gitter-url] [![Downloads][downloads-image]][downloads-url]
[![NPM][nodei-image]][nodei-url]
build
[![Build Status][travis-image]][travis-url] [![Appveyor Status][appveyor-image]][appveyor-url] [![Coverage Status][coveralls-image]][coveralls-url]
dependencies
[![Dependency Status][david-image]][david-url] [![devDependency Status][david-dev-image]][david-dev-url] [![peerDependency Status][david-peer-image]][david-peer-url]
donation
[![Gittip donate button][gittip-image]][gittip-url] [![Donate to sokra][donate-image]][donate-url]
[documentation](http://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=top) [documentation](http://webpack.github.io/docs/?utm_source=github&utm_medium=readme&utm_campaign=top)
@ -97,6 +113,7 @@ Please see [Using Loaders](http://webpack.github.io/docs/using-loaders.html) for
**styling** **styling**
* [`style`](https://github.com/webpack/style-loader): Add exports of a module as style to DOM * [`style`](https://github.com/webpack/style-loader): Add exports of a module as style to DOM
* [`css`](https://github.com/webpack/css-loader): Loads css file with resolved imports and returns css code * [`css`](https://github.com/webpack/css-loader): Loads css file with resolved imports and returns css code
* [`cssnext`](https://github.com/cssnext/cssnext-loader): Loads and compiles a css file using [cssnext](http://cssnext.io/)
* [`less`](https://github.com/webpack/less-loader): Loads and compiles a less file * [`less`](https://github.com/webpack/less-loader): Loads and compiles a less file
* [`sass`](https://github.com/jtangelder/sass-loader): Loads and compiles a scss file * [`sass`](https://github.com/jtangelder/sass-loader): Loads and compiles a scss file
* [`stylus`](https://github.com/shama/stylus-loader): Loads and compiles a stylus file * [`stylus`](https://github.com/shama/stylus-loader): Loads and compiles a stylus file
@ -202,7 +219,7 @@ function loadTemplateAsync (name, callback) {
## Tests ## Tests
You can run the Node tests with `npm test`. [![Build status (linux)][travis-image]][travis-url] [![Build status (windows)][appveyor-image]][appveyor-url] [![Test coverage][coveralls-image]][coveralls-url] You can run the Node tests with `npm test`.
You can run the browser tests: You can run the browser tests:
@ -257,8 +274,6 @@ This is a free-time project. The time I invest in it fluctuates. If you use webp
I'm very thankful for every dollar. If you leave your username or email, I may show my thanks by giving you extra support. I'm very thankful for every dollar. If you leave your username or email, I may show my thanks by giving you extra support.
[![Donate to sokra][donate-image]][donate-url]
## Dependencies ## Dependencies
@ -272,7 +287,6 @@ I'm very thankful for every dollar. If you leave your username or email, I may s
* [mkdirp](https://github.com/substack/node-mkdirp) * [mkdirp](https://github.com/substack/node-mkdirp)
* [clone](https://github.com/pvorb/node-clone) * [clone](https://github.com/pvorb/node-clone)
[![Dependency status][david-image]][david-url]
[travis-url]: http://travis-ci.org/webpack/webpack [travis-url]: http://travis-ci.org/webpack/webpack
[travis-image]: https://img.shields.io/travis/webpack/webpack.svg [travis-image]: https://img.shields.io/travis/webpack/webpack.svg
@ -282,8 +296,16 @@ I'm very thankful for every dollar. If you leave your username or email, I may s
[coveralls-image]: https://img.shields.io/coveralls/webpack/webpack.svg [coveralls-image]: https://img.shields.io/coveralls/webpack/webpack.svg
[npm-url]: https://npmjs.org/package/webpack [npm-url]: https://npmjs.org/package/webpack
[npm-image]: https://img.shields.io/npm/v/webpack.svg [npm-image]: https://img.shields.io/npm/v/webpack.svg
[downloads-image]: http://img.shields.io/npm/dm/webpack.svg
[downloads-url]: http://badge.fury.io/js/webpack
[david-url]: https://david-dm.org/webpack/webpack [david-url]: https://david-dm.org/webpack/webpack
[david-image]: https://img.shields.io/david/webpack/webpack.svg [david-image]: https://img.shields.io/david/webpack/webpack.svg
[david-dev-url]: https://david-dm.org/webpack/webpack#info=devDependencies
[david-dev-image]: https://david-dm.org/webpack/webpack/dev-status.svg
[david-peer-url]: https://david-dm.org/webpack/webpack#info=peerDependencies
[david-peer-image]: https://david-dm.org/webpack/webpack/peer-status.svg
[nodei-image]: https://nodei.co/npm/webpack.png?downloads=true&downloadRank=true&stars=true
[nodei-url]: https://nodei.co/npm/webpack
[donate-url]: http://sokra.github.io/ [donate-url]: http://sokra.github.io/
[donate-image]: https://img.shields.io/badge/donate-sokra-brightgreen.svg [donate-image]: https://img.shields.io/badge/donate-sokra-brightgreen.svg
[gittip-url]: https://www.gittip.com/sokra/ [gittip-url]: https://www.gittip.com/sokra/

View File

@ -16,7 +16,7 @@ matrix:
install: install:
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) - ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)
- npm install - npm install --msvs_version=2013
build: off build: off

View File

@ -25,7 +25,9 @@ function runTimes(compiler, times, deferred) {
} }
var tests = { var tests = {
"normal build": [[0, 1, 5, 10, 50, 100, 200], function(size, deferred) { "normal build": [
[0, 1, 5, 10, 50, 100, 200],
function(size, deferred) {
webpack({ webpack({
context: fixtures, context: fixtures,
entry: "./" + size + ".js", entry: "./" + size + ".js",
@ -37,8 +39,11 @@ var tests = {
if(err) throw err; if(err) throw err;
deferred.resolve(); deferred.resolve();
}); });
}], }
"eval dev build": [[0, 1, 2, 5, 10, 15], function(size, deferred) { ],
"eval dev build": [
[0, 1, 2, 5, 10, 15],
function(size, deferred) {
webpack({ webpack({
context: fixtures, context: fixtures,
entry: "./" + size + ".big.js", entry: "./" + size + ".big.js",
@ -51,8 +56,11 @@ var tests = {
if(err) throw err; if(err) throw err;
deferred.resolve(); deferred.resolve();
}) })
}], }
"sourcemap build": [[0, 1, 2, 5, 10, 15], function(size, deferred) { ],
"sourcemap build": [
[0, 1, 2, 5, 10, 15],
function(size, deferred) {
webpack({ webpack({
context: fixtures, context: fixtures,
entry: "./" + size + ".big.js", entry: "./" + size + ".big.js",
@ -65,8 +73,11 @@ var tests = {
if(err) throw err; if(err) throw err;
deferred.resolve(); deferred.resolve();
}) })
}], }
"cheap sourcemap build": [[0, 1, 2, 5, 10, 15], function(size, deferred) { ],
"cheap sourcemap build": [
[0, 1, 2, 5, 10, 15],
function(size, deferred) {
webpack({ webpack({
context: fixtures, context: fixtures,
entry: "./" + size + ".big.js", entry: "./" + size + ".big.js",
@ -79,8 +90,11 @@ var tests = {
if(err) throw err; if(err) throw err;
deferred.resolve(); deferred.resolve();
}) })
}], }
"build w/ chunks": [[0, 1, 5, 10, 50, 100, 200], function(size, deferred) { ],
"build w/ chunks": [
[0, 1, 5, 10, 50, 100, 200],
function(size, deferred) {
webpack({ webpack({
context: fixtures, context: fixtures,
entry: "./" + size + ".async.js", entry: "./" + size + ".async.js",
@ -92,8 +106,11 @@ var tests = {
if(err) throw err; if(err) throw err;
deferred.resolve(); deferred.resolve();
}) })
}], }
"build w/ chunks": [[0, 1, 5, 10, 50, 100, 200], function(size, deferred) { ],
"build w/ chunks": [
[0, 1, 5, 10, 50, 100, 200],
function(size, deferred) {
webpack({ webpack({
context: fixtures, context: fixtures,
entry: "./" + size + ".async.js", entry: "./" + size + ".async.js",
@ -105,8 +122,11 @@ var tests = {
if(err) throw err; if(err) throw err;
deferred.resolve(); deferred.resolve();
}) })
}], }
"incremental": [[0, 1, 5, 10, 50, 100, 200], function(size, deferred) { ],
"incremental": [
[0, 1, 5, 10, 50, 100, 200],
function(size, deferred) {
var compiler = webpack({ var compiler = webpack({
cache: true, cache: true,
context: fixtures, context: fixtures,
@ -117,8 +137,11 @@ var tests = {
} }
}); });
runTimes(compiler, 2, deferred); runTimes(compiler, 2, deferred);
}], }
"incremental cheap sourcemap": [[1, 2, 3, 4, 5, 6], function(size, deferred) { ],
"incremental cheap sourcemap": [
[1, 2, 3, 4, 5, 6],
function(size, deferred) {
var compiler = webpack({ var compiler = webpack({
cache: true, cache: true,
context: fixtures, context: fixtures,
@ -130,8 +153,11 @@ var tests = {
devtool: "cheap-source-map" devtool: "cheap-source-map"
}); });
runTimes(compiler, size, deferred); runTimes(compiler, size, deferred);
}], }
"incremental2": [[0, 1, 5, 10, 50, 100, 200], function(size, deferred) { ],
"incremental2": [
[0, 1, 5, 10, 50, 100, 200],
function(size, deferred) {
var compiler = webpack({ var compiler = webpack({
cache: true, cache: true,
context: fixtures, context: fixtures,
@ -142,8 +168,11 @@ var tests = {
} }
}); });
runTimes(compiler, 3, deferred); runTimes(compiler, 3, deferred);
}], }
"incremental4": [[0, 1, 5, 10, 50, 100, 200], function(size, deferred) { ],
"incremental4": [
[0, 1, 5, 10, 50, 100, 200],
function(size, deferred) {
var compiler = webpack({ var compiler = webpack({
cache: true, cache: true,
context: fixtures, context: fixtures,
@ -154,8 +183,11 @@ var tests = {
} }
}); });
runTimes(compiler, 5, deferred); runTimes(compiler, 5, deferred);
}], }
"incremental16": [[0, 1, 5, 10, 50, 100, 200], function(size, deferred) { ],
"incremental16": [
[0, 1, 5, 10, 50, 100, 200],
function(size, deferred) {
var compiler = webpack({ var compiler = webpack({
cache: true, cache: true,
context: fixtures, context: fixtures,
@ -166,7 +198,8 @@ var tests = {
} }
}); });
runTimes(compiler, 17, deferred); runTimes(compiler, 17, deferred);
}], }
],
}; };
var suite = new Benchmark.Suite; var suite = new Benchmark.Suite;
@ -190,4 +223,6 @@ suite.on("cycle", function(event) {
console.log(b.name + "\t" + Math.floor(1000 * (b.stats.mean - b.stats.moe)) + "\t" + Math.floor(1000 * (b.stats.mean + b.stats.moe))); console.log(b.name + "\t" + Math.floor(1000 * (b.stats.mean - b.stats.moe)) + "\t" + Math.floor(1000 * (b.stats.mean + b.stats.moe)));
}); });
suite.run({ async: true }); suite.run({
async: true
});

View File

@ -3,19 +3,20 @@ var fs = require("fs");
var fixtures = path.join(__dirname, "fixtures"); var fixtures = path.join(__dirname, "fixtures");
try { fs.mkdirSync(fixtures); } catch(e) {} try {
fs.mkdirSync(fixtures);
} catch(e) {}
for(var i = 0; i < 1000; i++) { for(var i = 0; i < 1000; i++) {
var source = []; var source = [];
if(i > 8) if(i > 8)
source.push("require("+ JSON.stringify("./" + (i / 8 | 0) + ".js") + ");"); source.push("require(" + JSON.stringify("./" + (i / 8 | 0) + ".js") + ");");
if(i > 4) if(i > 4)
source.push("require("+ JSON.stringify("./" + (i / 4 | 0) + ".js") + ");"); source.push("require(" + JSON.stringify("./" + (i / 4 | 0) + ".js") + ");");
if(i > 2) if(i > 2)
source.push("require("+ JSON.stringify("./" + (i / 2 | 0) + ".js") + ");"); source.push("require(" + JSON.stringify("./" + (i / 2 | 0) + ".js") + ");");
if(i > 0) if(i > 0)
source.push("require("+ JSON.stringify("./" + (i - 1) + ".js") + ");"); source.push("require(" + JSON.stringify("./" + (i - 1) + ".js") + ");");
source.push("module.exports = " + i + ";"); source.push("module.exports = " + i + ";");
fs.writeFileSync(path.join(fixtures, i + ".js"), source.join("\n"), "utf-8"); fs.writeFileSync(path.join(fixtures, i + ".js"), source.join("\n"), "utf-8");
} }
@ -24,13 +25,13 @@ for(var i = 0; i < 1000; i++) {
var source = []; var source = [];
source.push("require.ensure([], function(require) {"); source.push("require.ensure([], function(require) {");
if(i > 8) if(i > 8)
source.push("require("+ JSON.stringify("./" + (i / 8 | 0) + ".async.js") + ");"); source.push("require(" + JSON.stringify("./" + (i / 8 | 0) + ".async.js") + ");");
if(i > 4) if(i > 4)
source.push("require("+ JSON.stringify("./" + (i / 4 | 0) + ".async.js") + ");"); source.push("require(" + JSON.stringify("./" + (i / 4 | 0) + ".async.js") + ");");
if(i > 2) if(i > 2)
source.push("require("+ JSON.stringify("./" + (i / 2 | 0) + ".async.js") + ");"); source.push("require(" + JSON.stringify("./" + (i / 2 | 0) + ".async.js") + ");");
if(i > 0) if(i > 0)
source.push("require("+ JSON.stringify("./" + (i - 1) + ".async.js") + ");"); source.push("require(" + JSON.stringify("./" + (i - 1) + ".async.js") + ");");
source.push("});"); source.push("});");
source.push("module.exports = " + i + ";"); source.push("module.exports = " + i + ";");
fs.writeFileSync(path.join(fixtures, i + ".async.js"), source.join("\n"), "utf-8"); fs.writeFileSync(path.join(fixtures, i + ".async.js"), source.join("\n"), "utf-8");
@ -39,13 +40,13 @@ for(var i = 0; i < 1000; i++) {
for(var i = 0; i < 100; i++) { for(var i = 0; i < 100; i++) {
var source = []; var source = [];
if(i > 8) if(i > 8)
source.push("require("+ JSON.stringify("./" + (i / 8 | 0) + ".big.js") + ");"); source.push("require(" + JSON.stringify("./" + (i / 8 | 0) + ".big.js") + ");");
if(i > 4) if(i > 4)
source.push("require("+ JSON.stringify("./" + (i / 4 | 0) + ".big.js") + ");"); source.push("require(" + JSON.stringify("./" + (i / 4 | 0) + ".big.js") + ");");
if(i > 2) if(i > 2)
source.push("require("+ JSON.stringify("./" + (i / 2 | 0) + ".big.js") + ");"); source.push("require(" + JSON.stringify("./" + (i / 2 | 0) + ".big.js") + ");");
if(i > 0) if(i > 0)
source.push("require("+ JSON.stringify("./" + (i - 1) + ".big.js") + ");"); source.push("require(" + JSON.stringify("./" + (i - 1) + ".big.js") + ");");
for(var j = 0; j < 300; j++) for(var j = 0; j < 300; j++)
source.push("if(Math.random())hello.world();test.a.b.c.d();x(1,2,3,4);var a,b,c,d,e,f;"); source.push("if(Math.random())hello.world();test.a.b.c.d();x(1,2,3,4);var a,b,c,d,e,f;");
source.push("module.exports = " + i + ";"); source.push("module.exports = " + i + ";");

View File

@ -265,6 +265,12 @@ module.exports = function(optimist, argv, convertOptions) {
}); });
ifArg("output-file", function(value) { ifArg("output-file", function(value) {
console.warn("output.file will be deprecated: Use 'output.filename' instead");
ensureObject(options, "output");
options.output.filename = value;
});
ifArg("output-filename", function(value) {
ensureObject(options, "output"); ensureObject(options, "output");
options.output.filename = value; options.output.filename = value;
}); });

View File

@ -28,7 +28,10 @@ if(module.hot) {
} }
}).catch(function(err) { }).catch(function(err) {
if(module.hot.status() in {abort: 1, fail: 1}) { if(module.hot.status() in {
abort: 1,
fail: 1
}) {
console.warn("[HMR] Cannot apply update. Need to do a full reload!"); console.warn("[HMR] Cannot apply update. Need to do a full reload!");
console.warn("[HMR] " + err.stack || err.message); console.warn("[HMR] " + err.stack || err.message);
window.location.reload(); window.location.reload();
@ -39,7 +42,7 @@ if(module.hot) {
}; };
var addEventListener = window.addEventListener ? function(eventName, listener) { var addEventListener = window.addEventListener ? function(eventName, listener) {
window.addEventListener(eventName, listener, false); window.addEventListener(eventName, listener, false);
} : function (eventName, listener) { } : function(eventName, listener) {
window.attachEvent("on" + eventName, listener); window.attachEvent("on" + eventName, listener);
}; };
addEventListener("message", function(event) { addEventListener("message", function(event) {

View File

@ -20,7 +20,10 @@ if(module.hot) {
ignoreUnaccepted: true ignoreUnaccepted: true
}, function(err, renewedModules) { }, function(err, renewedModules) {
if(err) { if(err) {
if(module.hot.status() in {abort: 1, fail: 1}) { if(module.hot.status() in {
abort: 1,
fail: 1
}) {
console.warn("[HMR] Cannot apply update. Need to do a full reload!"); console.warn("[HMR] Cannot apply update. Need to do a full reload!");
console.warn("[HMR] " + err.stack || err.message); console.warn("[HMR] " + err.stack || err.message);
} else { } else {
@ -40,7 +43,10 @@ if(module.hot) {
} }
}); });
}).catch(function(err) { }).catch(function(err) {
if(module.hot.status() in {abort: 1, fail: 1}) { if(module.hot.status() in {
abort: 1,
fail: 1
}) {
console.warn("[HMR] Cannot check for update. Need to do a full reload!"); console.warn("[HMR] Cannot check for update. Need to do a full reload!");
console.warn("[HMR] " + err.stack || err.message); console.warn("[HMR] " + err.stack || err.message);
} else { } else {
@ -50,7 +56,7 @@ if(module.hot) {
}; };
var addEventListener = window.addEventListener ? function(eventName, listener) { var addEventListener = window.addEventListener ? function(eventName, listener) {
window.addEventListener(eventName, listener, false); window.addEventListener(eventName, listener, false);
} : function (eventName, listener) { } : function(eventName, listener) {
window.attachEvent("on" + eventName, listener); window.attachEvent("on" + eventName, listener);
}; };
addEventListener("message", function(event) { addEventListener("message", function(event) {

View File

@ -5,6 +5,7 @@
/*globals __resourceQuery */ /*globals __resourceQuery */
if(module.hot) { if(module.hot) {
var hotPollInterval = +(__resourceQuery.substr(1)) || (10 * 60 * 1000); var hotPollInterval = +(__resourceQuery.substr(1)) || (10 * 60 * 1000);
function checkForUpdate(fromUpdate) { function checkForUpdate(fromUpdate) {
if(module.hot.status() === "idle") { if(module.hot.status() === "idle") {
module.hot.check(true).then(function(updatedModules) { module.hot.check(true).then(function(updatedModules) {
@ -15,7 +16,10 @@ if(module.hot) {
require("./log-apply-result")(updatedModules, updatedModules); require("./log-apply-result")(updatedModules, updatedModules);
checkForUpdate(true); checkForUpdate(true);
}).catch(function(err) { }).catch(function(err) {
if(module.hot.status() in {abort: 1, fail: 1}) { if(module.hot.status() in {
abort: 1,
fail: 1
}) {
console.warn("[HMR] Cannot apply update."); console.warn("[HMR] Cannot apply update.");
console.warn("[HMR] " + err.stack || err.message); console.warn("[HMR] " + err.stack || err.message);
console.warn("[HMR] You need to restart the application!"); console.warn("[HMR] You need to restart the application!");

View File

@ -18,7 +18,10 @@ if(module.hot) {
ignoreUnaccepted: true ignoreUnaccepted: true
}, function(err, renewedModules) { }, function(err, renewedModules) {
if(err) { if(err) {
if(module.hot.status() in {abort: 1, fail: 1}) { if(module.hot.status() in {
abort: 1,
fail: 1
}) {
console.warn("[HMR] Cannot apply update (Need to do a full reload!)"); console.warn("[HMR] Cannot apply update (Need to do a full reload!)");
console.warn("[HMR] " + err.stack || err.message); console.warn("[HMR] " + err.stack || err.message);
console.warn("[HMR] You need to restart the application!"); console.warn("[HMR] You need to restart the application!");
@ -33,7 +36,10 @@ if(module.hot) {
checkForUpdate(true); checkForUpdate(true);
}); });
}).catch(function(err) { }).catch(function(err) {
if(module.hot.status() in {abort: 1, fail: 1}) { if(module.hot.status() in {
abort: 1,
fail: 1
}) {
console.warn("[HMR] Cannot apply update."); console.warn("[HMR] Cannot apply update.");
console.warn("[HMR] " + err.stack || err.message); console.warn("[HMR] " + err.stack || err.message);
console.warn("[HMR] You need to restart the application!"); console.warn("[HMR] You need to restart the application!");

View File

@ -7,8 +7,7 @@ var BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
var NullFactory = require("./NullFactory"); var NullFactory = require("./NullFactory");
function APIPlugin() { function APIPlugin() {}
}
module.exports = APIPlugin; module.exports = APIPlugin;
var REPLACEMENTS = { var REPLACEMENTS = {
@ -25,8 +24,7 @@ var REPLACEMENT_TYPES = {
__webpack_modules__: "object", // eslint-disable-line camelcase __webpack_modules__: "object", // eslint-disable-line camelcase
__webpack_chunk_load__: "function" // eslint-disable-line camelcase __webpack_chunk_load__: "function" // eslint-disable-line camelcase
}; };
var IGNORES = [ var IGNORES = [];
];
APIPlugin.prototype.apply = function(compiler) { APIPlugin.prototype.apply = function(compiler) {
compiler.plugin("compilation", function(compilation) { compiler.plugin("compilation", function(compilation) {
compilation.dependencyFactories.set(ConstDependency, new NullFactory()); compilation.dependencyFactories.set(ConstDependency, new NullFactory());

View File

@ -33,7 +33,7 @@ AmdMainTemplatePlugin.prototype.apply = function(compilation) {
} }
}.bind(this)); }.bind(this));
mainTemplate.plugin("global-hash-paths", function(paths) { mainTemplate.plugin("global-hash-paths", function(paths) {
if (this.name) paths.push(this.name); if(this.name) paths.push(this.name);
return paths; return paths;
}.bind(this)); }.bind(this));
mainTemplate.plugin("hash", function(hash) { mainTemplate.plugin("hash", function(hash) {

View File

@ -6,8 +6,7 @@ var async = require("async");
var PrefetchDependency = require("./dependencies/PrefetchDependency"); var PrefetchDependency = require("./dependencies/PrefetchDependency");
var NormalModule = require("./NormalModule"); var NormalModule = require("./NormalModule");
function AutomaticPrefetchPlugin() { function AutomaticPrefetchPlugin() {}
}
module.exports = AutomaticPrefetchPlugin; module.exports = AutomaticPrefetchPlugin;
AutomaticPrefetchPlugin.prototype.apply = function(compiler) { AutomaticPrefetchPlugin.prototype.apply = function(compiler) {
compiler.plugin("compilation", function(compilation, params) { compiler.plugin("compilation", function(compilation, params) {

View File

@ -138,6 +138,3 @@ BasicEvaluatedExpression.prototype.setRange = function(range) {
this.range = range; this.range = range;
return this; return this;
}; };

View File

@ -73,7 +73,11 @@ Chunk.prototype.addBlock = function(block) {
}; };
Chunk.prototype.addOrigin = function(module, loc) { Chunk.prototype.addOrigin = function(module, loc) {
this.origins.push({module: module, loc: loc, name: this.name}); this.origins.push({
module: module,
loc: loc,
name: this.name
});
}; };
Chunk.prototype.remove = function(reason) { Chunk.prototype.remove = function(reason) {
@ -123,6 +127,7 @@ Chunk.prototype.integrate = function(other, reason) {
m.rewriteChunkInReasons(other, [this]); m.rewriteChunkInReasons(other, [this]);
}, this); }, this);
other.modules.length = 0; other.modules.length = 0;
function moveChunks(chunks, kind, onChunk) { function moveChunks(chunks, kind, onChunk) {
chunks.forEach(function(c) { chunks.forEach(function(c) {
var idx = c[kind].indexOf(other); var idx = c[kind].indexOf(other);
@ -164,7 +169,7 @@ Chunk.prototype.integrate = function(other, reason) {
}; };
Chunk.prototype.isEmpty = function() { Chunk.prototype.isEmpty = function() {
return (this.modules.length === 0); return this.modules.length === 0;
}; };
Chunk.prototype.updateHash = function(hash) { Chunk.prototype.updateHash = function(hash) {

View File

@ -17,7 +17,7 @@ ChunkTemplate.prototype.render = function(chunk, moduleTemplate, dependencyTempl
var core = this.applyPluginsWaterfall("modules", modules, chunk, moduleTemplate, dependencyTemplates); var core = this.applyPluginsWaterfall("modules", modules, chunk, moduleTemplate, dependencyTemplates);
var source = this.applyPluginsWaterfall("render", core, chunk, moduleTemplate, dependencyTemplates); var source = this.applyPluginsWaterfall("render", core, chunk, moduleTemplate, dependencyTemplates);
if(chunk.modules.some(function(module) { if(chunk.modules.some(function(module) {
return (module.entry); return module.entry;
})) { })) {
source = this.applyPluginsWaterfall("render-with-entry", source, chunk); source = this.applyPluginsWaterfall("render-with-entry", source, chunk);
} }

View File

@ -9,8 +9,7 @@ var ModuleAliasPlugin = require("enhanced-resolve/lib/ModuleAliasPlugin");
var NullFactory = require("./NullFactory"); var NullFactory = require("./NullFactory");
function CompatibilityPlugin() { function CompatibilityPlugin() {}
}
module.exports = CompatibilityPlugin; module.exports = CompatibilityPlugin;
CompatibilityPlugin.prototype.apply = function(compiler) { CompatibilityPlugin.prototype.apply = function(compiler) {

View File

@ -114,6 +114,7 @@ Compilation.prototype.buildModule = function(module, thisCallback) {
this.applyPlugins("build-module", module); this.applyPlugins("build-module", module);
if(module.building) return module.building.push(thisCallback); if(module.building) return module.building.push(thisCallback);
var building = module.building = [thisCallback]; var building = module.building = [thisCallback];
function callback(err) { function callback(err) {
module.building = undefined; module.building = undefined;
building.forEach(function(cb) { building.forEach(function(cb) {
@ -140,6 +141,7 @@ Compilation.prototype.buildModule = function(module, thisCallback) {
Compilation.prototype.processModuleDependencies = function(module, callback) { Compilation.prototype.processModuleDependencies = function(module, callback) {
var dependencies = []; var dependencies = [];
function addDependency(dep) { function addDependency(dep) {
for(var i = 0; i < dependencies.length; i++) { for(var i = 0; i < dependencies.length; i++) {
if(dep.isEqualResource(dependencies[i][0])) { if(dep.isEqualResource(dependencies[i][0])) {
@ -148,6 +150,7 @@ Compilation.prototype.processModuleDependencies = function(module, callback) {
} }
dependencies.push([dep]); dependencies.push([dep]);
} }
function addDependenciesBlock(block) { function addDependenciesBlock(block) {
if(block.dependencies) { if(block.dependencies) {
block.dependencies.forEach(addDependency); block.dependencies.forEach(addDependency);
@ -211,6 +214,7 @@ Compilation.prototype.addModuleDependencies = function(module, dependencies, bai
return !d.optional; return !d.optional;
}).length === 0; }).length === 0;
} }
function errorOrWarningAndCallback(err) { function errorOrWarningAndCallback(err) {
if(isOptional()) { if(isOptional()) {
return warningAndCallback(err); return warningAndCallback(err);
@ -446,6 +450,7 @@ Compilation.prototype.rebuildModule = function(module, thisCallback) {
return module.rebuilding.push(thisCallback); return module.rebuilding.push(thisCallback);
} }
var rebuilding = module.rebuilding = [thisCallback]; var rebuilding = module.rebuilding = [thisCallback];
function callback(err) { function callback(err) {
module.rebuilding = undefined; module.rebuilding = undefined;
rebuilding.forEach(function(cb) { rebuilding.forEach(function(cb) {
@ -624,6 +629,7 @@ Compilation.prototype.processDependenciesBlockForChunk = function processDepende
this.processDependenciesBlockForChunk(b, c); this.processDependenciesBlockForChunk(b, c);
}, this); }, this);
} }
function iteratorDependency(d) { function iteratorDependency(d) {
if(!d.module) { if(!d.module) {
return; return;
@ -656,6 +662,7 @@ Compilation.prototype.removeChunkFromDependencies = function removeChunkFromDepe
this.removeChunkFromDependencies(b, c); this.removeChunkFromDependencies(b, c);
}, this); }, this);
}, this); }, this);
function iteratorDependency(d) { function iteratorDependency(d) {
if(!d.module) { if(!d.module) {
return; return;
@ -853,7 +860,7 @@ Compilation.prototype.createChunkAssets = function createChunkAssets() {
} }
}; };
Compilation.prototype.getPath = function (filename, data) { Compilation.prototype.getPath = function(filename, data) {
data = data || {}; data = data || {};
data.hash = data.hash || this.hash; data.hash = data.hash || this.hash;
return this.mainTemplate.applyPluginsWaterfall("asset-path", filename, data); return this.mainTemplate.applyPluginsWaterfall("asset-path", filename, data);

View File

@ -124,7 +124,7 @@ Watching.prototype.invalidate = function() {
}; };
Watching.prototype.close = function(callback) { Watching.prototype.close = function(callback) {
if(callback === undefined) callback = function(){}; if(callback === undefined) callback = function() {};
if(this.watcher) { if(this.watcher) {
this.watcher.close(); this.watcher.close();
@ -272,6 +272,7 @@ Compiler.prototype.emitAssets = function(compilation, callback) {
var dir = path.dirname(targetFile); var dir = path.dirname(targetFile);
this.outputFileSystem.mkdirp(this.outputFileSystem.join(outputPath, dir), writeOut.bind(this)); this.outputFileSystem.mkdirp(this.outputFileSystem.join(outputPath, dir), writeOut.bind(this));
} else writeOut.call(this); } else writeOut.call(this);
function writeOut(err) { function writeOut(err) {
if(err) return callback(err); if(err) return callback(err);
var targetPath = this.outputFileSystem.join(outputPath, targetFile); var targetPath = this.outputFileSystem.join(outputPath, targetFile);

View File

@ -7,8 +7,7 @@ var BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
var NullFactory = require("./NullFactory"); var NullFactory = require("./NullFactory");
function ConstPlugin() { function ConstPlugin() {}
}
module.exports = ConstPlugin; module.exports = ConstPlugin;
ConstPlugin.prototype.apply = function(compiler) { ConstPlugin.prototype.apply = function(compiler) {

View File

@ -185,5 +185,7 @@ ContextModule.prototype.source = function() {
ContextModule.prototype.size = function() { ContextModule.prototype.size = function() {
return this.dependencies.map(function(dep) { return this.dependencies.map(function(dep) {
return dep.userRequest.length + 5; return dep.userRequest.length + 5;
}).reduce(function(a, b) { return a + b; }, 160); }).reduce(function(a, b) {
return a + b;
}, 160);
}; };

View File

@ -123,7 +123,9 @@ ContextModuleFactory.prototype.resolveDependencies = function resolveDependencie
if(!result) return callback(null, []); if(!result) return callback(null, []);
callback(null, result.filter(function(i) { return !!i; }).reduce(function(a, i) { callback(null, result.filter(function(i) {
return !!i;
}).reduce(function(a, i) {
return a.concat(i); return a.concat(i);
}, [])); }, []));
}); });

View File

@ -53,7 +53,7 @@ ContextReplacementPlugin.prototype.apply = function(compiler) {
if(typeof newContentCallback === "function") { if(typeof newContentCallback === "function") {
var origResource = result.resource; var origResource = result.resource;
newContentCallback(result); newContentCallback(result);
if (result.resource !== origResource) { if(result.resource !== origResource) {
result.resource = path.resolve(origResource, result.resource); result.resource = path.resolve(origResource, result.resource);
} }
} else { } else {

View File

@ -28,12 +28,14 @@ DefinePlugin.prototype.apply = function(compiler) {
applyDefine(prefix + key, code); applyDefine(prefix + key, code);
}); });
}(this.definitions, "")); }(this.definitions, ""));
function stringifyObj(obj) { function stringifyObj(obj) {
return "{" + Object.keys(obj).map(function(key) { return "{" + Object.keys(obj).map(function(key) {
var code = obj[key]; var code = obj[key];
return JSON.stringify(key) + ":" + toCode(code); return JSON.stringify(key) + ":" + toCode(code);
}).join(",") + "}"; }).join(",") + "}";
} }
function toCode(code) { function toCode(code) {
if(code === null) return "null"; if(code === null) return "null";
else if(code === undefined) return "undefined"; else if(code === undefined) return "undefined";
@ -42,13 +44,17 @@ DefinePlugin.prototype.apply = function(compiler) {
else if(typeof code === "object") return stringifyObj(code); else if(typeof code === "object") return stringifyObj(code);
else return code + ""; else return code + "";
} }
function applyDefineKey(prefix, key) { function applyDefineKey(prefix, key) {
var splittedKey = key.split("."); var splittedKey = key.split(".");
splittedKey.slice(1).forEach(function(_, i) { splittedKey.slice(1).forEach(function(_, i) {
var fullKey = prefix + splittedKey.slice(0, i + 1).join("."); var fullKey = prefix + splittedKey.slice(0, i + 1).join(".");
compiler.parser.plugin("can-rename " + fullKey, function() { return true; }); compiler.parser.plugin("can-rename " + fullKey, function() {
return true;
});
}); });
} }
function applyDefine(key, code) { function applyDefine(key, code) {
var isTypeof = /^typeof\s+/.test(key); var isTypeof = /^typeof\s+/.test(key);
if(isTypeof) key = key.replace(/^typeof\s+/, ""); if(isTypeof) key = key.replace(/^typeof\s+/, "");
@ -92,6 +98,7 @@ DefinePlugin.prototype.apply = function(compiler) {
return true; return true;
}); });
} }
function applyObjectDefine(key, obj) { function applyObjectDefine(key, obj) {
var code = stringifyObj(obj); var code = stringifyObj(obj);
compiler.parser.plugin("can-rename " + key, function() { compiler.parser.plugin("can-rename " + key, function() {

View File

@ -8,7 +8,7 @@ function Dependency() {
} }
module.exports = Dependency; module.exports = Dependency;
Dependency.prototype.isEqualResource = function(/* other */) { Dependency.prototype.isEqualResource = function( /* other */ ) {
return false; return false;
}; };

View File

@ -13,7 +13,7 @@ EnvironmentPlugin.prototype.apply = function(compiler) {
compiler.apply(new DefinePlugin(this.keys.reduce(function(definitions, key) { compiler.apply(new DefinePlugin(this.keys.reduce(function(definitions, key) {
var value = process.env[key]; var value = process.env[key];
if (value === undefined) { if(value === undefined) {
compiler.plugin("this-compilation", function(compilation) { compiler.plugin("this-compilation", function(compilation) {
var error = new Error(key + " environment variable is undefined."); var error = new Error(key + " environment variable is undefined.");
error.name = "EnvVariableNotDefinedError"; error.name = "EnvVariableNotDefinedError";

View File

@ -20,7 +20,7 @@ EvalDevToolModuleTemplatePlugin.prototype.apply = function(moduleTemplate) {
ModuleFilenameHelpers.createFooter(module, this.requestShortener), ModuleFilenameHelpers.createFooter(module, this.requestShortener),
self.sourceUrlComment.replace(/\[url\]/g, encodeURI(str).replace(/%2F/g, "/").replace(/%20/g, "_").replace(/%5E/g, "^").replace(/%5C/g, "\\").replace(/^\//, "")) self.sourceUrlComment.replace(/\[url\]/g, encodeURI(str).replace(/%2F/g, "/").replace(/%20/g, "_").replace(/%5E/g, "^").replace(/%5C/g, "\\").replace(/^\//, ""))
].join("\n"); ].join("\n");
return new RawSource("eval(" + JSON.stringify(content + footer) + ");" ); return new RawSource("eval(" + JSON.stringify(content + footer) + ");");
}); });
moduleTemplate.plugin("hash", function(hash) { moduleTemplate.plugin("hash", function(hash) {
hash.update("EvalDevToolModuleTemplatePlugin"); hash.update("EvalDevToolModuleTemplatePlugin");

View File

@ -58,7 +58,7 @@ EvalSourceMapDevToolModuleTemplatePlugin.prototype.apply = function(moduleTempla
sourceMap.sourceRoot = ""; sourceMap.sourceRoot = "";
sourceMap.file = module.id + ".js"; sourceMap.file = module.id + ".js";
var footer = self.sourceMapComment.replace(/\[url\]/g, "data:application/json;base64," + new Buffer(JSON.stringify(sourceMap)).toString("base64")); var footer = self.sourceMapComment.replace(/\[url\]/g, "data:application/json;base64," + new Buffer(JSON.stringify(sourceMap)).toString("base64"));
source.__EvalSourceMapDevToolData = new RawSource("eval(" + JSON.stringify(content + footer) + ");" ); source.__EvalSourceMapDevToolData = new RawSource("eval(" + JSON.stringify(content + footer) + ");");
return source.__EvalSourceMapDevToolData; return source.__EvalSourceMapDevToolData;
}); });
moduleTemplate.plugin("hash", function(hash) { moduleTemplate.plugin("hash", function(hash) {

View File

@ -7,8 +7,7 @@ var BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
var NullFactory = require("./NullFactory"); var NullFactory = require("./NullFactory");
function ExtendedAPIPlugin() { function ExtendedAPIPlugin() {}
}
module.exports = ExtendedAPIPlugin; module.exports = ExtendedAPIPlugin;
var REPLACEMENTS = { var REPLACEMENTS = {

View File

@ -16,6 +16,7 @@ ExternalModuleFactoryPlugin.prototype.apply = function(normalModuleFactory) {
return function(data, callback) { return function(data, callback) {
var context = data.context; var context = data.context;
var dependency = data.dependency; var dependency = data.dependency;
function handleExternal(value, type, callback) { function handleExternal(value, type, callback) {
if(typeof type === "function") { if(typeof type === "function") {
callback = type; callback = type;
@ -53,7 +54,7 @@ ExternalModuleFactoryPlugin.prototype.apply = function(normalModuleFactory) {
} }
callback(null, module); callback(null, module);
}); });
} while(!async); } while (!async);
async = false; async = false;
}()); }());
return; return;

View File

@ -5,8 +5,7 @@
var ConcatSource = require("webpack-core/lib/ConcatSource"); var ConcatSource = require("webpack-core/lib/ConcatSource");
var PrefixSource = require("webpack-core/lib/PrefixSource"); var PrefixSource = require("webpack-core/lib/PrefixSource");
function FunctionModuleTemplatePlugin() { function FunctionModuleTemplatePlugin() {}
}
module.exports = FunctionModuleTemplatePlugin; module.exports = FunctionModuleTemplatePlugin;
FunctionModuleTemplatePlugin.prototype.apply = function(moduleTemplate) { FunctionModuleTemplatePlugin.prototype.apply = function(moduleTemplate) {

View File

@ -40,6 +40,7 @@ module.exports = function() {
finishChunkLoading(); finishChunkLoading();
throw err; throw err;
}); });
function finishChunkLoading() { function finishChunkLoading() {
hotChunksLoading--; hotChunksLoading--;
if(hotStatus === "prepare") { if(hotStatus === "prepare") {
@ -82,7 +83,8 @@ module.exports = function() {
hot._selfDeclined = true; hot._selfDeclined = true;
else if(typeof dep === "number") else if(typeof dep === "number")
hot._declinedDependencies[dep] = true; hot._declinedDependencies[dep] = true;
else for(var i = 0; i < dep.length; i++) else
for(var i = 0; i < dep.length; i++)
hot._declinedDependencies[dep[i]] = true; hot._declinedDependencies[dep[i]] = true;
}, },
dispose: function(callback) { dispose: function(callback) {
@ -138,7 +140,8 @@ module.exports = function() {
var hotUpdate, hotUpdateNewHash; var hotUpdate, hotUpdateNewHash;
function toModuleId(id) { function toModuleId(id) {
return (+id) + "" === id ? +id : id; var isNumber = (+id) + "" === id;
return isNumber ? +id : id;
} }
function hotCheck(apply) { function hotCheck(apply) {
@ -166,7 +169,8 @@ module.exports = function() {
}; };
}); });
hotUpdate = {}; hotUpdate = {};
/*foreachInstalledChunks*/ { // eslint-disable-line no-lone-blocks /*foreachInstalledChunks*/
{ // eslint-disable-line no-lone-blocks
/*globals chunkId */ /*globals chunkId */
hotEnsureUpdateChunk(chunkId); hotEnsureUpdateChunk(chunkId);
} }
@ -240,6 +244,9 @@ module.exports = function() {
if(module.hot._selfDeclined) { if(module.hot._selfDeclined) {
return new Error("Aborted because of self decline: " + moduleId); return new Error("Aborted because of self decline: " + moduleId);
} }
if($require$.s === moduleId) {
return;
}
for(var i = 0; i < module.parents.length; i++) { for(var i = 0; i < module.parents.length; i++) {
var parentId = module.parents[i]; var parentId = module.parents[i];
var parent = installedModules[parentId]; var parent = installedModules[parentId];
@ -261,6 +268,7 @@ module.exports = function() {
return [outdatedModules, outdatedDependencies]; return [outdatedModules, outdatedDependencies];
} }
function addAllToSet(a, b) { function addAllToSet(a, b) {
for(var i = 0; i < b.length; i++) { for(var i = 0; i < b.length; i++) {
var item = b[i]; var item = b[i];

View File

@ -51,7 +51,9 @@ HotModuleReplacementPlugin.prototype.apply = function(compiler) {
}); });
records.chunkModuleIds = {}; records.chunkModuleIds = {};
this.chunks.forEach(function(chunk) { this.chunks.forEach(function(chunk) {
records.chunkModuleIds[chunk.id] = chunk.modules.map(function(m) { return m.id; }); records.chunkModuleIds[chunk.id] = chunk.modules.map(function(m) {
return m.id;
});
}); });
}); });
var initialPass = false; var initialPass = false;

View File

@ -12,7 +12,10 @@ module.exports = HotUpdateChunkTemplate;
HotUpdateChunkTemplate.prototype = Object.create(Template.prototype); HotUpdateChunkTemplate.prototype = Object.create(Template.prototype);
HotUpdateChunkTemplate.prototype.render = function(id, modules, hash, moduleTemplate, dependencyTemplates) { HotUpdateChunkTemplate.prototype.render = function(id, modules, hash, moduleTemplate, dependencyTemplates) {
var modulesSource = this.renderChunkModules({ id: id, modules: modules }, moduleTemplate, dependencyTemplates); var modulesSource = this.renderChunkModules({
id: id,
modules: modules
}, moduleTemplate, dependencyTemplates);
var core = this.applyPluginsWaterfall("modules", modulesSource, modules, moduleTemplate, dependencyTemplates); var core = this.applyPluginsWaterfall("modules", modulesSource, modules, moduleTemplate, dependencyTemplates);
var source = this.applyPluginsWaterfall("render", core, modules, hash, id, moduleTemplate, dependencyTemplates); var source = this.applyPluginsWaterfall("render", core, modules, hash, id, moduleTemplate, dependencyTemplates);
return source; return source;

View File

@ -5,8 +5,7 @@
var ConcatSource = require("webpack-core/lib/ConcatSource"); var ConcatSource = require("webpack-core/lib/ConcatSource");
var Template = require("./Template"); var Template = require("./Template");
function JsonpChunkTemplatePlugin() { function JsonpChunkTemplatePlugin() {}
}
module.exports = JsonpChunkTemplatePlugin; module.exports = JsonpChunkTemplatePlugin;
JsonpChunkTemplatePlugin.prototype.apply = function(chunkTemplate) { JsonpChunkTemplatePlugin.prototype.apply = function(chunkTemplate) {

View File

@ -18,7 +18,7 @@ JsonpExportMainTemplatePlugin.prototype.apply = function(compilation) {
return new ConcatSource(name + "(", source, ");"); return new ConcatSource(name + "(", source, ");");
}.bind(this)); }.bind(this));
mainTemplate.plugin("global-hash-paths", function(paths) { mainTemplate.plugin("global-hash-paths", function(paths) {
if (this.name) paths.push(this.name); if(this.name) paths.push(this.name);
return paths; return paths;
}.bind(this)); }.bind(this));
mainTemplate.plugin("hash", function(hash) { mainTemplate.plugin("hash", function(hash) {

View File

@ -5,9 +5,7 @@
var ConcatSource = require("webpack-core/lib/ConcatSource"); var ConcatSource = require("webpack-core/lib/ConcatSource");
var Template = require("./Template"); var Template = require("./Template");
function JsonpHotUpdateChunkTemplatePlugin() {}
function JsonpHotUpdateChunkTemplatePlugin() {
}
module.exports = JsonpHotUpdateChunkTemplatePlugin; module.exports = JsonpHotUpdateChunkTemplatePlugin;
JsonpHotUpdateChunkTemplatePlugin.prototype.apply = function(hotUpdateChunkTemplate) { JsonpHotUpdateChunkTemplatePlugin.prototype.apply = function(hotUpdateChunkTemplate) {

View File

@ -4,8 +4,7 @@
*/ */
var Template = require("./Template"); var Template = require("./Template");
function JsonpMainTemplatePlugin() { function JsonpMainTemplatePlugin() {}
}
module.exports = JsonpMainTemplatePlugin; module.exports = JsonpMainTemplatePlugin;
JsonpMainTemplatePlugin.prototype.constructor = JsonpMainTemplatePlugin; JsonpMainTemplatePlugin.prototype.constructor = JsonpMainTemplatePlugin;
@ -107,8 +106,7 @@ JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
"}", "}",
"if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);", "if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);",
"while(resolves.length)", "while(resolves.length)",
this.indent("resolves.shift()();"), this.indent("resolves.shift()();"), (this.entryPointInChildren(chunk) ? [
(this.entryPointInChildren(chunk) ? [
"if(executeModule + 1) { // typeof executeModule === \"number\"", "if(executeModule + 1) { // typeof executeModule === \"number\"",
this.indent([ this.indent([
"return " + this.requireFn + "(executeModule);" "return " + this.requireFn + "(executeModule);"

View File

@ -6,8 +6,7 @@ var JsonpMainTemplatePlugin = require("./JsonpMainTemplatePlugin");
var JsonpChunkTemplatePlugin = require("./JsonpChunkTemplatePlugin"); var JsonpChunkTemplatePlugin = require("./JsonpChunkTemplatePlugin");
var JsonpHotUpdateChunkTemplatePlugin = require("./JsonpHotUpdateChunkTemplatePlugin"); var JsonpHotUpdateChunkTemplatePlugin = require("./JsonpHotUpdateChunkTemplatePlugin");
function JsonpTemplatePlugin() { function JsonpTemplatePlugin() {}
}
module.exports = JsonpTemplatePlugin; module.exports = JsonpTemplatePlugin;
JsonpTemplatePlugin.prototype.apply = function(compiler) { JsonpTemplatePlugin.prototype.apply = function(compiler) {
compiler.plugin("this-compilation", function(compilation) { compiler.plugin("this-compilation", function(compilation) {

View File

@ -38,7 +38,7 @@ function MainTemplate(outputOptions) {
source.add(")"); source.add(")");
return source; return source;
}); });
this.plugin("local-vars", function(source/*, chunk, hash*/) { this.plugin("local-vars", function(source /*, chunk, hash*/ ) {
return this.asString([ return this.asString([
source, source,
"// The module cache", "// The module cache",
@ -67,7 +67,7 @@ function MainTemplate(outputOptions) {
"return module.exports;" "return module.exports;"
]); ]);
}); });
this.plugin("module-obj", function(/*source, chunk, hash, varModuleId*/) { this.plugin("module-obj", function( /*source, chunk, hash, varModuleId*/ ) {
return this.asString([ return this.asString([
"exports: {},", "exports: {},",
"id: moduleId,", "id: moduleId,",
@ -122,7 +122,7 @@ MainTemplate.prototype.render = function(hash, chunk, moduleTemplate, dependency
buf.push(this.asString(this.applyPluginsWaterfall("startup", "", chunk, hash))); buf.push(this.asString(this.applyPluginsWaterfall("startup", "", chunk, hash)));
var source = this.applyPluginsWaterfall("render", new OriginalSource(this.prefix(buf, " \t") + "\n", "webpack/bootstrap " + hash), chunk, hash, moduleTemplate, dependencyTemplates); var source = this.applyPluginsWaterfall("render", new OriginalSource(this.prefix(buf, " \t") + "\n", "webpack/bootstrap " + hash), chunk, hash, moduleTemplate, dependencyTemplates);
if(chunk.modules.some(function(module) { if(chunk.modules.some(function(module) {
return (module.entry); return module.entry;
})) { })) {
source = this.applyPluginsWaterfall("render-with-entry", source, chunk, hash); source = this.applyPluginsWaterfall("render-with-entry", source, chunk, hash);
} }
@ -145,15 +145,16 @@ MainTemplate.prototype.renderCurrentHashCode = function(hash, length) {
}; };
MainTemplate.prototype.entryPointInChildren = function(chunk) { MainTemplate.prototype.entryPointInChildren = function(chunk) {
return (function checkChildren(chunk, alreadyCheckedChunks) { function checkChildren(chunk, alreadyCheckedChunks) {
return chunk.chunks.some(function(child) { return chunk.chunks.some(function(child) {
if(alreadyCheckedChunks.indexOf(child) >= 0) return; if(alreadyCheckedChunks.indexOf(child) >= 0) return;
alreadyCheckedChunks.push(child); alreadyCheckedChunks.push(child);
return child.modules.some(function(module) { return child.modules.some(function(module) {
return (module.entry); return module.entry;
}) || checkChildren(child, alreadyCheckedChunks); }) || checkChildren(child, alreadyCheckedChunks);
}); });
}(chunk, [])); }
return checkChildren(chunk, []);
}; };
MainTemplate.prototype.getPublicPath = function(options) { MainTemplate.prototype.getPublicPath = function(options) {

View File

@ -6,6 +6,7 @@ var DependenciesBlock = require("./DependenciesBlock");
var ModuleReason = require("./ModuleReason"); var ModuleReason = require("./ModuleReason");
var debugId = 1000; var debugId = 1000;
function Module() { function Module() {
DependenciesBlock.call(this); DependenciesBlock.call(this);
this.context = null; this.context = null;
@ -99,7 +100,7 @@ Module.prototype.toString = function() {
return "Module[" + (this.id || this.debugId) + "]"; return "Module[" + (this.id || this.debugId) + "]";
}; };
Module.prototype.needRebuild = function(/* fileTimestamps, contextTimestamps */) { Module.prototype.needRebuild = function( /* fileTimestamps, contextTimestamps */ ) {
return true; return true;
}; };

View File

@ -66,7 +66,20 @@ ModuleFilenameHelpers.createFilename = function createFilename(module, moduleFil
var allLoaders = getBefore(identifier, "!"); var allLoaders = getBefore(identifier, "!");
var query = getAfter(resource, "?"); var query = getAfter(resource, "?");
var resourcePath = resource.substr(0, resource.length - query.length); var resourcePath = resource.substr(0, resource.length - query.length);
return (moduleFilenameTemplate if(typeof moduleFilenameTemplate === "function") {
return moduleFilenameTemplate({
identifier: identifier,
shortIdentifier: shortIdentifier,
resource: resource,
resourcePath: resourcePath,
absoluteResourcePath: absoluteResourcePath,
allLoaders: allLoaders,
query: query,
moduleId: moduleId,
hash: hash
});
}
return moduleFilenameTemplate
.replace(ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE, identifier) .replace(ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE, identifier)
.replace(ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE, shortIdentifier) .replace(ModuleFilenameHelpers.REGEXP_LOADERS_RESOURCE, shortIdentifier)
.replace(ModuleFilenameHelpers.REGEXP_RESOURCE, resource) .replace(ModuleFilenameHelpers.REGEXP_RESOURCE, resource)
@ -76,8 +89,7 @@ ModuleFilenameHelpers.createFilename = function createFilename(module, moduleFil
.replace(ModuleFilenameHelpers.REGEXP_LOADERS, loaders) .replace(ModuleFilenameHelpers.REGEXP_LOADERS, loaders)
.replace(ModuleFilenameHelpers.REGEXP_QUERY, query) .replace(ModuleFilenameHelpers.REGEXP_QUERY, query)
.replace(ModuleFilenameHelpers.REGEXP_ID, moduleId) .replace(ModuleFilenameHelpers.REGEXP_ID, moduleId)
.replace(ModuleFilenameHelpers.REGEXP_HASH, hash) .replace(ModuleFilenameHelpers.REGEXP_HASH, hash);
);
}; };
ModuleFilenameHelpers.createFooter = function createFooter(module, requestShortener) { ModuleFilenameHelpers.createFooter = function createFooter(module, requestShortener) {
@ -93,7 +105,9 @@ ModuleFilenameHelpers.createFooter = function createFooter(module, requestShorte
" ** WEBPACK FOOTER", " ** WEBPACK FOOTER",
" ** " + module.readableIdentifier(requestShortener), " ** " + module.readableIdentifier(requestShortener),
" ** module id = " + module.id, " ** module id = " + module.id,
" ** module chunks = " + module.chunks.map(function(c) { return c.id; }).join(" "), " ** module chunks = " + module.chunks.map(function(c) {
return c.id;
}).join(" "),
" **/" " **/"
].join("\n"); ].join("\n");
} }
@ -121,7 +135,6 @@ ModuleFilenameHelpers.replaceDuplicates = function replaceDuplicates(array, fn,
}); });
}; };
ModuleFilenameHelpers.matchPart = function matchPart(str, test) { ModuleFilenameHelpers.matchPart = function matchPart(str, test) {
if(!test) return true; if(!test) return true;
test = asRegExp(test); test = asRegExp(test);

View File

@ -122,13 +122,17 @@ function MultiStats(stats) {
MultiStats.prototype.hasErrors = function() { MultiStats.prototype.hasErrors = function() {
return this.stats.map(function(stat) { return this.stats.map(function(stat) {
return stat.hasErrors(); return stat.hasErrors();
}).reduce(function(a, b) { return a || b; }, false); }).reduce(function(a, b) {
return a || b;
}, false);
}; };
MultiStats.prototype.hasWarnings = function() { MultiStats.prototype.hasWarnings = function() {
return this.stats.map(function(stat) { return this.stats.map(function(stat) {
return stat.hasWarnings(); return stat.hasWarnings();
}).reduce(function(a, b) { return a || b; }, false); }).reduce(function(a, b) {
return a || b;
}, false);
}; };
MultiStats.prototype.toJson = function(options, forToString) { MultiStats.prototype.toJson = function(options, forToString) {

View File

@ -2,8 +2,7 @@
MIT License http://www.opensource.org/licenses/mit-license.php MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra Author Tobias Koppers @sokra
*/ */
function NewWatchingPlugin() { function NewWatchingPlugin() {}
}
module.exports = NewWatchingPlugin; module.exports = NewWatchingPlugin;
NewWatchingPlugin.prototype.apply = function(compiler) { NewWatchingPlugin.prototype.apply = function(compiler) {

View File

@ -2,8 +2,7 @@
MIT License http://www.opensource.org/licenses/mit-license.php MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra Author Tobias Koppers @sokra
*/ */
function NoErrorsPlugin() { function NoErrorsPlugin() {}
}
module.exports = NoErrorsPlugin; module.exports = NoErrorsPlugin;
NoErrorsPlugin.prototype.apply = function(compiler) { NoErrorsPlugin.prototype.apply = function(compiler) {
compiler.plugin("should-emit", function(compilation) { compiler.plugin("should-emit", function(compilation) {

View File

@ -19,13 +19,18 @@ NodeStuffPlugin.prototype.apply = function(compiler) {
compilation.dependencyFactories.set(ConstDependency, new NullFactory()); compilation.dependencyFactories.set(ConstDependency, new NullFactory());
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template()); compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
}); });
function ignore() { return true; }
function ignore() {
return true;
}
function setConstant(expressionName, value) { function setConstant(expressionName, value) {
compiler.parser.plugin("expression " + expressionName, function() { compiler.parser.plugin("expression " + expressionName, function() {
this.state.current.addVariable(expressionName, JSON.stringify(value)); this.state.current.addVariable(expressionName, JSON.stringify(value));
return true; return true;
}); });
} }
function setModuleConstant(expressionName, fn) { function setModuleConstant(expressionName, fn) {
compiler.parser.plugin("expression " + expressionName, function() { compiler.parser.plugin("expression " + expressionName, function() {
this.state.current.addVariable(expressionName, JSON.stringify(fn(this.state.module))); this.state.current.addVariable(expressionName, JSON.stringify(fn(this.state.module)));

View File

@ -125,21 +125,30 @@ NormalModule.prototype.source = function(dependencyTemplates, outputOptions, req
var _source = this._source; var _source = this._source;
if(!_source) return new RawSource("throw new Error('No source available');"); if(!_source) return new RawSource("throw new Error('No source available');");
var source = new ReplaceSource(_source); var source = new ReplaceSource(_source);
this._cachedSource = { source: source, hash: hash }; this._cachedSource = {
source: source,
hash: hash
};
var topLevelBlock = this; var topLevelBlock = this;
function doDep(dep) { function doDep(dep) {
var template = dependencyTemplates.get(dep.Class); var template = dependencyTemplates.get(dep.Class);
if(!template) throw new Error("No template for dependency: " + dep.Class.name); if(!template) throw new Error("No template for dependency: " + dep.Class.name);
template.apply(dep, source, outputOptions, requestShortener, dependencyTemplates); template.apply(dep, source, outputOptions, requestShortener, dependencyTemplates);
} }
function doVariable(availableVars, vars, variable) { function doVariable(availableVars, vars, variable) {
var name = variable.name; var name = variable.name;
var expr = variable.expressionSource(dependencyTemplates, outputOptions, requestShortener); var expr = variable.expressionSource(dependencyTemplates, outputOptions, requestShortener);
if(availableVars.some(function(v) { if(availableVars.some(function(v) {
return v.name === name && v.expression.source() === expr.source(); return v.name === name && v.expression.source() === expr.source();
})) return; })) return;
vars.push({name: name, expression: expr}); vars.push({
name: name,
expression: expr
});
} }
function doBlock(availableVars, block) { function doBlock(availableVars, block) {
block.dependencies.forEach(doDep); block.dependencies.forEach(doDep);
var vars = []; var vars = [];
@ -149,6 +158,7 @@ NormalModule.prototype.source = function(dependencyTemplates, outputOptions, req
var varExpressions = []; var varExpressions = [];
var varStartCode = ""; var varStartCode = "";
var varEndCode = ""; var varEndCode = "";
function emitFunction() { function emitFunction() {
if(varNames.length === 0) return; if(varNames.length === 0) return;
@ -218,13 +228,16 @@ NormalModule.prototype.getSourceHash = function() {
NormalModule.prototype.getAllModuleDependencies = function() { NormalModule.prototype.getAllModuleDependencies = function() {
var list = []; var list = [];
function doDep(dep) { function doDep(dep) {
if(dep.module && list.indexOf(dep.module) < 0) if(dep.module && list.indexOf(dep.module) < 0)
list.push(dep.module); list.push(dep.module);
} }
function doVariable(variable) { function doVariable(variable) {
variable.dependencies.forEach(doDep); variable.dependencies.forEach(doDep);
} }
function doBlock(block) { function doBlock(block) {
block.variables.forEach(doVariable); block.variables.forEach(doVariable);
block.dependencies.forEach(doDep); block.dependencies.forEach(doDep);
@ -260,6 +273,7 @@ NormalModule.prototype.createTemplate = function(keepModules, roots) {
return array.join("|"); return array.join("|");
}; };
var args = template.arguments = []; var args = template.arguments = [];
function doDeps(deps) { function doDeps(deps) {
return deps.map(function(dep) { return deps.map(function(dep) {
if(dep.module && keepModules.indexOf(dep.module) < 0) { if(dep.module && keepModules.indexOf(dep.module) < 0) {
@ -271,6 +285,7 @@ NormalModule.prototype.createTemplate = function(keepModules, roots) {
} }
}); });
} }
function doBlock(block, newBlock) { function doBlock(block, newBlock) {
block.variables.forEach(function(variable) { block.variables.forEach(function(variable) {
var newDependencies = doDeps(variable.dependencies); var newDependencies = doDeps(variable.dependencies);
@ -289,13 +304,16 @@ NormalModule.prototype.createTemplate = function(keepModules, roots) {
NormalModule.prototype.getTemplateArguments = function(keepModules) { NormalModule.prototype.getTemplateArguments = function(keepModules) {
var list = []; var list = [];
function doDep(dep) { function doDep(dep) {
if(dep.module && keepModules.indexOf(dep.module) < 0) if(dep.module && keepModules.indexOf(dep.module) < 0)
list.push(dep.module); list.push(dep.module);
} }
function doVariable(variable) { function doVariable(variable) {
variable.dependencies.forEach(doDep); variable.dependencies.forEach(doDep);
} }
function doBlock(block) { function doBlock(block) {
block.variables.forEach(doVariable); block.variables.forEach(doVariable);
block.dependencies.forEach(doDep); block.dependencies.forEach(doDep);

View File

@ -119,6 +119,7 @@ function NormalModuleFactory(context, resolvers, parser, options) {
onDoneResolving.call(this); onDoneResolving.call(this);
}.bind(this)); }.bind(this));
} }
function onDoneResolving() { function onDoneResolving() {
callback(null, { callback(null, {
context: context, context: context,

View File

@ -4,6 +4,7 @@
*/ */
var path = require("path"); var path = require("path");
function NormalModuleReplacementPlugin(resourceRegExp, newResource) { function NormalModuleReplacementPlugin(resourceRegExp, newResource) {
this.resourceRegExp = resourceRegExp; this.resourceRegExp = resourceRegExp;
this.newResource = newResource; this.newResource = newResource;
@ -16,7 +17,7 @@ NormalModuleReplacementPlugin.prototype.apply = function(compiler) {
nmf.plugin("before-resolve", function(result, callback) { nmf.plugin("before-resolve", function(result, callback) {
if(!result) return callback(); if(!result) return callback();
if(resourceRegExp.test(result.request)) { if(resourceRegExp.test(result.request)) {
if (typeof newResource === "function") { if(typeof newResource === "function") {
newResource(result); newResource(result);
} else { } else {
result.request = newResource; result.request = newResource;
@ -27,7 +28,7 @@ NormalModuleReplacementPlugin.prototype.apply = function(compiler) {
nmf.plugin("after-resolve", function(result, callback) { nmf.plugin("after-resolve", function(result, callback) {
if(!result) return callback(); if(!result) return callback();
if(resourceRegExp.test(result.resource)) { if(resourceRegExp.test(result.resource)) {
if (typeof newResource === "function") { if(typeof newResource === "function") {
newResource(result); newResource(result);
} else { } else {
result.resource = path.resolve(path.dirname(result.resource), newResource); result.resource = path.resolve(path.dirname(result.resource), newResource);

View File

@ -2,8 +2,7 @@
MIT License http://www.opensource.org/licenses/mit-license.php MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra Author Tobias Koppers @sokra
*/ */
function NullFactory() { function NullFactory() {}
}
module.exports = NullFactory; module.exports = NullFactory;
NullFactory.prototype.create = function(context, dependency, callback) { NullFactory.prototype.create = function(context, dependency, callback) {

View File

@ -4,8 +4,7 @@
*/ */
var OldNodeWatchFileSystem = require("./node/OldNodeWatchFileSystem"); var OldNodeWatchFileSystem = require("./node/OldNodeWatchFileSystem");
function OldWatchingPlugin() { function OldWatchingPlugin() {}
}
module.exports = OldWatchingPlugin; module.exports = OldWatchingPlugin;
OldWatchingPlugin.prototype.apply = function(compiler) { OldWatchingPlugin.prototype.apply = function(compiler) {

View File

@ -2,10 +2,9 @@
MIT License http://www.opensource.org/licenses/mit-license.php MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra Author Tobias Koppers @sokra
*/ */
function OptionsApply() { function OptionsApply() {}
}
module.exports = OptionsApply; module.exports = OptionsApply;
OptionsApply.prototype.process = function(/* options, compiler */) { OptionsApply.prototype.process = function( /* options, compiler */ ) {
}; };

View File

@ -15,8 +15,6 @@ module.exports = Parser;
// Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API // Syntax: https://developer.mozilla.org/en/SpiderMonkey/Parser_API
Parser.prototype = Object.create(Tapable.prototype); Parser.prototype = Object.create(Tapable.prototype);
Parser.prototype.initializeEvaluating = function() { Parser.prototype.initializeEvaluating = function() {
function joinRanges(startRange, endRange) { function joinRanges(startRange, endRange) {
@ -325,7 +323,9 @@ Parser.prototype.initializeEvaluating = function() {
var items = expr.elements.map(function(element) { var items = expr.elements.map(function(element) {
return element !== null && this.evaluateExpression(element); return element !== null && this.evaluateExpression(element);
}, this); }, this);
if(items.filter(function(i) { return !i; }).length > 0) return; if(items.filter(function(i) {
return !i;
}).length > 0) return;
return new BasicEvaluatedExpression().setItems(items).setRange(expr.range); return new BasicEvaluatedExpression().setItems(items).setRange(expr.range);
}); });
}; };
@ -390,10 +390,10 @@ Parser.prototype.walkSwitchStatement = function walkSwitchStatement(statement) {
}; };
Parser.prototype.walkReturnStatement = Parser.prototype.walkReturnStatement =
Parser.prototype.walkThrowStatement = function walkArgumentStatement(statement) { Parser.prototype.walkThrowStatement = function walkArgumentStatement(statement) {
if(statement.argument) if(statement.argument)
this.walkExpression(statement.argument); this.walkExpression(statement.argument);
}; };
Parser.prototype.walkTryStatement = function walkTryStatement(statement) { Parser.prototype.walkTryStatement = function walkTryStatement(statement) {
if(this.scope.inTry) { if(this.scope.inTry) {
@ -410,10 +410,10 @@ Parser.prototype.walkTryStatement = function walkTryStatement(statement) {
}; };
Parser.prototype.walkWhileStatement = Parser.prototype.walkWhileStatement =
Parser.prototype.walkDoWhileStatement = function walkLoopStatement(statement) { Parser.prototype.walkDoWhileStatement = function walkLoopStatement(statement) {
this.walkExpression(statement.test); this.walkExpression(statement.test);
this.walkStatement(statement.body); this.walkStatement(statement.body);
}; };
Parser.prototype.walkForStatement = function walkForStatement(statement) { Parser.prototype.walkForStatement = function walkForStatement(statement) {
if(statement.init) { if(statement.init) {
@ -650,10 +650,10 @@ Parser.prototype.walkUnaryExpression = function walkUnaryExpression(expression)
}; };
Parser.prototype.walkBinaryExpression = Parser.prototype.walkBinaryExpression =
Parser.prototype.walkLogicalExpression = function walkLeftRightExpression(expression) { Parser.prototype.walkLogicalExpression = function walkLeftRightExpression(expression) {
this.walkExpression(expression.left); this.walkExpression(expression.left);
this.walkExpression(expression.right); this.walkExpression(expression.right);
}; };
Parser.prototype.walkAssignmentExpression = function walkAssignmentExpression(expression) { Parser.prototype.walkAssignmentExpression = function walkAssignmentExpression(expression) {
var renameIdentifier = this.getRenameIdentifier(expression.right); var renameIdentifier = this.getRenameIdentifier(expression.right);
@ -821,11 +821,22 @@ Parser.prototype.parseCalculatedString = function parseCalculatedString(expressi
var left = this.parseCalculatedString(expression.left); var left = this.parseCalculatedString(expression.left);
var right = this.parseCalculatedString(expression.right); var right = this.parseCalculatedString(expression.right);
if(left.code) { if(left.code) {
return {range: left.range, value: left.value, code: true}; return {
range: left.range,
value: left.value,
code: true
};
} else if(right.code) { } else if(right.code) {
return {range: [left.range[0], right.range ? right.range[1] : left.range[1]], value: left.value + right.value, code: true}; return {
range: [left.range[0], right.range ? right.range[1] : left.range[1]],
value: left.value + right.value,
code: true
};
} else { } else {
return {range: [left.range[0], right.range[1]], value: left.value + right.value}; return {
range: [left.range[0], right.range[1]],
value: left.value + right.value
};
} }
} }
break; break;
@ -843,11 +854,21 @@ Parser.prototype.parseCalculatedString = function parseCalculatedString(expressi
else if(!alternate.code) else if(!alternate.code)
items.push(alternate); items.push(alternate);
else break; else break;
return {value: "", code: true, conditional: items}; return {
value: "",
code: true,
conditional: items
};
case "Literal": case "Literal":
return {range: expression.range, value: expression.value + ""}; return {
range: expression.range,
value: expression.value + ""
};
} }
return {value: "", code: true}; return {
value: "",
code: true
};
}; };
["parseString", "parseCalculatedString"].forEach(function(fn) { ["parseString", "parseCalculatedString"].forEach(function(fn) {
@ -866,7 +887,12 @@ Parser.prototype.parseCalculatedString = function parseCalculatedString(expressi
}); });
Parser.prototype.parse = function parse(source, initialState) { Parser.prototype.parse = function parse(source, initialState) {
var ast = acorn.parse(source, {ranges: true, locations: true, ecmaVersion: 6, sourceType: "module"}); var ast = acorn.parse(source, {
ranges: true,
locations: true,
ecmaVersion: 6,
sourceType: "module"
});
if(!ast || typeof ast !== "object") if(!ast || typeof ast !== "object")
throw new Error("Source couldn't be parsed"); throw new Error("Source couldn't be parsed");
var oldScope = this.scope; var oldScope = this.scope;
@ -885,7 +911,12 @@ Parser.prototype.parse = function parse(source, initialState) {
}; };
Parser.prototype.evaluate = function evaluate(source) { Parser.prototype.evaluate = function evaluate(source) {
var ast = acorn.parse("(" + source + ")", {ranges: true, locations: true, ecmaVersion: 6, sourceType: "module"}); var ast = acorn.parse("(" + source + ")", {
ranges: true,
locations: true,
ecmaVersion: 6,
sourceType: "module"
});
if(!ast || typeof ast !== "object" || ast.type !== "Program") if(!ast || typeof ast !== "object" || ast.type !== "Program")
throw new Error("evaluate: Source couldn't be parsed"); throw new Error("evaluate: Source couldn't be parsed");
if(ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement") if(ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement")

View File

@ -27,6 +27,7 @@ ProgressPlugin.prototype.apply = function(compiler) {
var lastModulesCount = 0; var lastModulesCount = 0;
var moduleCount = 1; var moduleCount = 1;
var doneModules = 0; var doneModules = 0;
function update() { function update() {
handler(0.1 + (doneModules / Math.max(lastModulesCount, moduleCount)) * 0.6, doneModules + "/" + moduleCount + " build modules"); handler(0.1 + (doneModules / Math.max(lastModulesCount, moduleCount)) * 0.6, doneModules + "/" + moduleCount + " build modules");
} }

View File

@ -22,7 +22,9 @@ ProvidePlugin.prototype.apply = function(compiler) {
if(splittedName.length > 0) { if(splittedName.length > 0) {
splittedName.slice(1).forEach(function(_, i) { splittedName.slice(1).forEach(function(_, i) {
var name = splittedName.slice(0, i + 1).join("."); var name = splittedName.slice(0, i + 1).join(".");
compiler.parser.plugin("can-rename " + name, function() { return true; }); compiler.parser.plugin("can-rename " + name, function() {
return true;
});
}); });
} }
compiler.parser.plugin("expression " + name, function(expr) { compiler.parser.plugin("expression " + name, function(expr) {

View File

@ -4,8 +4,7 @@
*/ */
var path = require("path"); var path = require("path");
function RecordIdsPlugin() { function RecordIdsPlugin() {}
}
module.exports = RecordIdsPlugin; module.exports = RecordIdsPlugin;
function makeRelative(compiler, identifier) { function makeRelative(compiler, identifier) {

View File

@ -6,14 +6,14 @@ var ConstDependency = require("./dependencies/ConstDependency");
var NullFactory = require("./NullFactory"); var NullFactory = require("./NullFactory");
function RequireJsStuffPlugin() { function RequireJsStuffPlugin() {}
}
module.exports = RequireJsStuffPlugin; module.exports = RequireJsStuffPlugin;
RequireJsStuffPlugin.prototype.apply = function(compiler) { RequireJsStuffPlugin.prototype.apply = function(compiler) {
compiler.plugin("compilation", function(compilation) { compiler.plugin("compilation", function(compilation) {
compilation.dependencyFactories.set(ConstDependency, new NullFactory()); compilation.dependencyFactories.set(ConstDependency, new NullFactory());
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template()); compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
}); });
function remove(expr) { function remove(expr) {
var dep = new ConstDependency(";", expr.range); var dep = new ConstDependency(";", expr.range);
dep.loc = expr.loc; dep.loc = expr.loc;

View File

@ -24,8 +24,8 @@ SetVarMainTemplatePlugin.prototype.apply = function(compilation) {
return new ConcatSource(prefix, source); return new ConcatSource(prefix, source);
} }
}.bind(this)); }.bind(this));
mainTemplate.plugin("global-hash-paths", function (paths) { mainTemplate.plugin("global-hash-paths", function(paths) {
if (this.varExpression) paths.push(this.varExpression); if(this.varExpression) paths.push(this.varExpression);
return paths; return paths;
}); });
mainTemplate.plugin("hash", function(hash) { mainTemplate.plugin("hash", function(hash) {

View File

@ -127,7 +127,8 @@ SourceMapDevToolPlugin.prototype.apply = function(compiler) {
currentSourceMappingURLComment = currentSourceMappingURLComment.replace(/^\n\/\/(.*)$/, "\n/*$1*/"); currentSourceMappingURLComment = currentSourceMappingURLComment.replace(/^\n\/\/(.*)$/, "\n/*$1*/");
} }
if(sourceMapFilename) { if(sourceMapFilename) {
var filename = file, query = ""; var filename = file,
query = "";
var idx = filename.indexOf("?"); var idx = filename.indexOf("?");
if(idx >= 0) { if(idx >= 0) {
query = filename.substr(idx); query = filename.substr(idx);
@ -165,4 +166,3 @@ function basename(name) {
if(name.indexOf("/") < 0) return name; if(name.indexOf("/") < 0) return name;
return name.substr(name.lastIndexOf("/") + 1); return name.substr(name.lastIndexOf("/") + 1);
} }

View File

@ -20,7 +20,10 @@ Stats.prototype.hasErrors = function() {
Stats.prototype.toJson = function toJson(options, forToString) { Stats.prototype.toJson = function toJson(options, forToString) {
if(!options) options = {}; if(!options) options = {};
function d(v, def) { return v === undefined ? def : v; }
function d(v, def) {
return v === undefined ? def : v;
}
var compilation = this.compilation; var compilation = this.compilation;
var requestShortener = new RequestShortener(d(options.context, process.cwd())); var requestShortener = new RequestShortener(d(options.context, process.cwd()));
var showHash = d(options.hash, true); var showHash = d(options.hash, true);
@ -59,23 +62,28 @@ Stats.prototype.toJson = function toJson(options, forToString) {
} }
function sortByField(field) { function sortByField(field) {
if(!field) return function() { return 0; }; if(!field) return function() {
return 0;
};
if(field[0] === "!") { if(field[0] === "!") {
field = field.substr(1); field = field.substr(1);
return function(a, b) { return function(a, b) {
if(a[field] === b[field]) return 0; if(a[field] === b[field]) return 0;
return (a[field] < b[field]) ? 1 : -1; return a[field] < b[field] ? 1 : -1;
}; };
} }
return function(a, b) { return function(a, b) {
if(a[field] === b[field]) return 0; if(a[field] === b[field]) return 0;
return (a[field] < b[field]) ? -1 : 1; return a[field] < b[field] ? -1 : 1;
}; };
} }
function formatError(e) { function formatError(e) {
var text = ""; var text = "";
if(typeof e === "string") if(typeof e === "string")
e = {message: e}; e = {
message: e
};
if(e.chunk) { if(e.chunk) {
text += "chunk " + (e.chunk.name || e.chunk.id) + text += "chunk " + (e.chunk.name || e.chunk.id) +
(e.chunk.entry ? " [entry]" : e.chunk.initial ? " [initial]" : "") + "\n"; (e.chunk.entry ? " [entry]" : e.chunk.initial ? " [initial]" : "") + "\n";
@ -159,6 +167,7 @@ Stats.prototype.toJson = function toJson(options, forToString) {
}); });
obj.assets.sort(sortByField(sortAssets)); obj.assets.sort(sortByField(sortAssets));
} }
function fnModule(module) { function fnModule(module) {
var obj = { var obj = {
id: module.id, id: module.id,
@ -192,7 +201,9 @@ Stats.prototype.toJson = function toJson(options, forToString) {
userRequest: reason.dependency.userRequest userRequest: reason.dependency.userRequest
}; };
var dep = reason.dependency; var dep = reason.dependency;
if(dep.templateModules) obj.templateModules = dep.templateModules.map(function(module) { return module.id; }); if(dep.templateModules) obj.templateModules = dep.templateModules.map(function(module) {
return module.id;
});
if(typeof dep.loc === "object") obj.loc = dep.loc.start.line + ":" + dep.loc.start.column + "-" + if(typeof dep.loc === "object") obj.loc = dep.loc.start.line + ":" + dep.loc.start.column + "-" +
(dep.loc.start.line !== dep.loc.end.line ? dep.loc.end.line + ":" : "") + dep.loc.end.column; (dep.loc.start.line !== dep.loc.end.line ? dep.loc.end.line + ":" : "") + dep.loc.end.column;
return obj; return obj;
@ -213,7 +224,9 @@ Stats.prototype.toJson = function toJson(options, forToString) {
initial: !!chunk.initial, initial: !!chunk.initial,
entry: !!chunk.entry, entry: !!chunk.entry,
extraAsync: !!chunk.extraAsync, extraAsync: !!chunk.extraAsync,
size: chunk.modules.reduce(function(size, module) { return size + module.size(); }, 0), size: chunk.modules.reduce(function(size, module) {
return size + module.size();
}, 0),
names: chunk.name ? [chunk.name] : [], names: chunk.name ? [chunk.name] : [],
files: chunk.files.slice(), files: chunk.files.slice(),
hash: chunk.renderedHash, hash: chunk.renderedHash,
@ -263,7 +276,10 @@ Stats.prototype.toJson = function toJson(options, forToString) {
Stats.prototype.toString = function toString(options) { Stats.prototype.toString = function toString(options) {
if(!options) options = {}; if(!options) options = {};
function d(v, def) { return v === undefined ? def : v; }
function d(v, def) {
return v === undefined ? def : v;
}
var useColors = d(options.colors, false); var useColors = d(options.colors, false);
var obj = this.toJson(options, true); var obj = this.toJson(options, true);
@ -273,39 +289,47 @@ Stats.prototype.toString = function toString(options) {
Stats.jsonToString = function jsonToString(obj, useColors) { Stats.jsonToString = function jsonToString(obj, useColors) {
var buf = []; var buf = [];
function normal(str) { function normal(str) {
buf.push(str); buf.push(str);
} }
function bold(str) { function bold(str) {
if(useColors) buf.push("\u001b[1m"); if(useColors) buf.push("\u001b[1m");
buf.push(str); buf.push(str);
if(useColors) buf.push("\u001b[22m"); if(useColors) buf.push("\u001b[22m");
} }
function yellow(str) { function yellow(str) {
if(useColors) buf.push("\u001b[1m\u001b[33m"); if(useColors) buf.push("\u001b[1m\u001b[33m");
buf.push(str); buf.push(str);
if(useColors) buf.push("\u001b[39m\u001b[22m"); if(useColors) buf.push("\u001b[39m\u001b[22m");
} }
function red(str) { function red(str) {
if(useColors) buf.push("\u001b[1m\u001b[31m"); if(useColors) buf.push("\u001b[1m\u001b[31m");
buf.push(str); buf.push(str);
if(useColors) buf.push("\u001b[39m\u001b[22m"); if(useColors) buf.push("\u001b[39m\u001b[22m");
} }
function green(str) { function green(str) {
if(useColors) buf.push("\u001b[1m\u001b[32m"); if(useColors) buf.push("\u001b[1m\u001b[32m");
buf.push(str); buf.push(str);
if(useColors) buf.push("\u001b[39m\u001b[22m"); if(useColors) buf.push("\u001b[39m\u001b[22m");
} }
function cyan(str) { function cyan(str) {
if(useColors) buf.push("\u001b[1m\u001b[36m"); if(useColors) buf.push("\u001b[1m\u001b[36m");
buf.push(str); buf.push(str);
if(useColors) buf.push("\u001b[39m\u001b[22m"); if(useColors) buf.push("\u001b[39m\u001b[22m");
} }
function magenta(str) { function magenta(str) {
if(useColors) buf.push("\u001b[1m\u001b[35m"); if(useColors) buf.push("\u001b[1m\u001b[35m");
buf.push(str); buf.push(str);
if(useColors) buf.push("\u001b[39m\u001b[22m"); if(useColors) buf.push("\u001b[39m\u001b[22m");
} }
function coloredTime(time) { function coloredTime(time) {
var times = [800, 400, 200, 100]; var times = [800, 400, 200, 100];
if(obj.time) { if(obj.time) {
@ -322,9 +346,11 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
else else
red(time + "ms"); red(time + "ms");
} }
function newline() { function newline() {
buf.push("\n"); buf.push("\n");
} }
function table(array, formats, align, splitter) { function table(array, formats, align, splitter) {
var rows = array.length; var rows = array.length;
var cols = array[0].length; var cols = array[0].length;
@ -356,6 +382,7 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
newline(); newline();
} }
} }
function formatSize(size) { function formatSize(size) {
if(size <= 0) return "0 bytes"; if(size <= 0) return "0 bytes";
@ -388,7 +415,9 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
newline(); newline();
} }
if(obj.assets && obj.assets.length > 0) { if(obj.assets && obj.assets.length > 0) {
var t = [["Asset", "Size", "Chunks", "", "Chunk Names"]]; var t = [
["Asset", "Size", "Chunks", "", "Chunk Names"]
];
obj.assets.forEach(function(asset) { obj.assets.forEach(function(asset) {
t.push([ t.push([
asset.name, asset.name,
@ -414,10 +443,12 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
} }
}); });
} }
function processProfile(module) { function processProfile(module) {
if(module.profile) { if(module.profile) {
normal(" "); normal(" ");
var sum = 0, allowSum = true; var sum = 0,
allowSum = true;
var path = []; var path = [];
var current = module; var current = module;
while(current.issuer) { while(current.issuer) {
@ -453,6 +484,7 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
newline(); newline();
} }
} }
function processModuleAttributes(module) { function processModuleAttributes(module) {
normal(" "); normal(" ");
normal(formatSize(module.size)); normal(formatSize(module.size));

View File

@ -28,7 +28,8 @@ Template.prototype.indent = function indent(str) {
} else { } else {
str = str.trimRight(); str = str.trimRight();
if(!str) return ""; if(!str) return "";
return (str[0] === "\n" ? "" : "\t") + str.replace(/\n([^\n])/g, "\n\t$1"); var ind = (str[0] === "\n" ? "" : "\t");
return ind + str.replace(/\n([^\n])/g, "\n\t$1");
} }
}; };
@ -38,7 +39,8 @@ Template.prototype.prefix = function(str, prefix) {
} }
str = str.trim(); str = str.trim();
if(!str) return ""; if(!str) return "";
return (str[0] === "\n" ? "" : prefix) + str.replace(/\n([^\n])/g, "\n" + prefix + "$1"); var ind = (str[0] === "\n" ? "" : prefix);
return ind + str.replace(/\n([^\n])/g, "\n" + prefix + "$1");
}; };
Template.prototype.asString = function(str) { Template.prototype.asString = function(str) {
@ -64,8 +66,11 @@ Template.prototype.getModulesArrayBounds = function(modules) {
minId = 0; minId = 0;
} }
var objectOverhead = modules.map(function(module) { var objectOverhead = modules.map(function(module) {
return (module.id + "").length + 2; var idLength = (module.id + "").length;
}).reduce(function(a, b) { return a + b; }, -1); return idLength + 2;
}).reduce(function(a, b) {
return a + b;
}, -1);
var arrayOverhead = minId === 0 ? maxId : 16 + ("" + minId).length + maxId; var arrayOverhead = minId === 0 ? maxId : 16 + ("" + minId).length + maxId;
return arrayOverhead < objectOverhead ? [minId, maxId] : false; return arrayOverhead < objectOverhead ? [minId, maxId] : false;
}; };

View File

@ -32,7 +32,7 @@ function TemplatedPathPlugin() {}
module.exports = TemplatedPathPlugin; module.exports = TemplatedPathPlugin;
function withHashLength(replacer, handlerFn) { function withHashLength(replacer, handlerFn) {
return function (_, hashLength) { return function(_, hashLength) {
var length = hashLength && parseInt(hashLength, 10); var length = hashLength && parseInt(hashLength, 10);
if(length && handlerFn) { if(length && handlerFn) {
return handlerFn(length); return handlerFn(length);
@ -43,11 +43,11 @@ function withHashLength(replacer, handlerFn) {
} }
function getReplacer(value, allowEmpty) { function getReplacer(value, allowEmpty) {
return function (match) { return function(match) {
// last argument in replacer is the entire input string // last argument in replacer is the entire input string
var input = arguments[arguments.length - 1]; var input = arguments[arguments.length - 1];
if (value == null) { if(value == null) {
if (!allowEmpty) throw new Error("Path variable " + match + " not implemented in this context: " + input); if(!allowEmpty) throw new Error("Path variable " + match + " not implemented in this context: " + input);
return ""; return "";
} else { } else {
return "" + value; return "" + value;

View File

@ -31,7 +31,8 @@ UmdMainTemplatePlugin.prototype.apply = function(compilation) {
var externals = chunk.modules.filter(function(m) { var externals = chunk.modules.filter(function(m) {
return m.external; return m.external;
}); });
var optionalExternals = [], requiredExternals = []; var optionalExternals = [],
requiredExternals = [];
if(this.optionalAmdExternalAsGlobal) { if(this.optionalAmdExternalAsGlobal) {
externals.forEach(function(m) { externals.forEach(function(m) {
if(m.optional) { if(m.optional) {
@ -51,11 +52,13 @@ UmdMainTemplatePlugin.prototype.apply = function(compilation) {
chunk: chunk chunk: chunk
}); });
} }
function externalsDepsArray(modules) { function externalsDepsArray(modules) {
return "[" + replaceKeys(modules.map(function(m) { return "[" + replaceKeys(modules.map(function(m) {
return JSON.stringify(typeof m.request === "object" ? m.request.amd : m.request); return JSON.stringify(typeof m.request === "object" ? m.request.amd : m.request);
}).join(", ")) + "]"; }).join(", ")) + "]";
} }
function externalsRootArray(modules) { function externalsRootArray(modules) {
return replaceKeys(modules.map(function(m) { return replaceKeys(modules.map(function(m) {
var request = m.request; var request = m.request;
@ -63,6 +66,7 @@ UmdMainTemplatePlugin.prototype.apply = function(compilation) {
return "root" + accessorToObjectAccess([].concat(request)); return "root" + accessorToObjectAccess([].concat(request));
}).join(", ")); }).join(", "));
} }
function externalsRequireArray(type) { function externalsRequireArray(type) {
return replaceKeys(externals.map(function(m) { return replaceKeys(externals.map(function(m) {
var request = m.request; var request = m.request;
@ -77,6 +81,7 @@ UmdMainTemplatePlugin.prototype.apply = function(compilation) {
return expr; return expr;
}).join(", ")); }).join(", "));
} }
function externalsArguments(modules) { function externalsArguments(modules) {
return modules.map(function(m) { return modules.map(function(m) {
return "__WEBPACK_EXTERNAL_MODULE_" + m.id + "__"; return "__WEBPACK_EXTERNAL_MODULE_" + m.id + "__";
@ -99,20 +104,17 @@ UmdMainTemplatePlugin.prototype.apply = function(compilation) {
" module.exports = factory(" + externalsRequireArray("commonjs2") + ");\n" + " module.exports = factory(" + externalsRequireArray("commonjs2") + ");\n" +
" else if(typeof define === 'function' && define.amd)\n" + " else if(typeof define === 'function' && define.amd)\n" +
(requiredExternals.length > 0 ? (requiredExternals.length > 0 ?
" define(" + externalsDepsArray(requiredExternals) + ", " + amdFactory + ");\n" " define(" + externalsDepsArray(requiredExternals) + ", " + amdFactory + ");\n" :
:
" define(" + amdFactory + ");\n" " define(" + amdFactory + ");\n"
) + ) +
(this.name ? (this.name ?
" else if(typeof exports === 'object')\n" + " else if(typeof exports === 'object')\n" +
" exports[" + JSON.stringify(replaceKeys([].concat(this.name).pop())) + "] = factory(" + externalsRequireArray("commonjs") + ");\n" + " exports[" + JSON.stringify(replaceKeys([].concat(this.name).pop())) + "] = factory(" + externalsRequireArray("commonjs") + ");\n" +
" else\n" + " else\n" +
" " + replaceKeys(accessorAccess("root", this.name)) + " = factory(" + externalsRootArray(externals) + ");\n" " " + replaceKeys(accessorAccess("root", this.name)) + " = factory(" + externalsRootArray(externals) + ");\n" :
:
" else {\n" + " else {\n" +
(externals.length > 0 ? (externals.length > 0 ?
" var a = typeof exports === 'object' ? factory(" + externalsRequireArray("commonjs") + ") : factory(" + externalsRootArray(externals) + ");\n" " var a = typeof exports === 'object' ? factory(" + externalsRequireArray("commonjs") + ") : factory(" + externalsRootArray(externals) + ");\n" :
:
" var a = factory();\n" " var a = factory();\n"
) + ) +
" for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n" + " for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n" +
@ -121,7 +123,7 @@ UmdMainTemplatePlugin.prototype.apply = function(compilation) {
"})(this, function(" + externalsArguments(externals) + ") {\nreturn ", "webpack/universalModuleDefinition"), source, "\n});\n"); "})(this, function(" + externalsArguments(externals) + ") {\nreturn ", "webpack/universalModuleDefinition"), source, "\n});\n");
}.bind(this)); }.bind(this));
mainTemplate.plugin("global-hash-paths", function(paths) { mainTemplate.plugin("global-hash-paths", function(paths) {
if (this.name) paths = paths.concat(this.name); if(this.name) paths = paths.concat(this.name);
return paths; return paths;
}.bind(this)); }.bind(this));
mainTemplate.plugin("hash", function(hash) { mainTemplate.plugin("hash", function(hash) {

View File

@ -4,8 +4,7 @@
*/ */
var CaseSensitiveModulesWarning = require("./CaseSensitiveModulesWarning"); var CaseSensitiveModulesWarning = require("./CaseSensitiveModulesWarning");
function WarnCaseSensitiveModulesPlugin() { function WarnCaseSensitiveModulesPlugin() {}
}
module.exports = WarnCaseSensitiveModulesPlugin; module.exports = WarnCaseSensitiveModulesPlugin;
WarnCaseSensitiveModulesPlugin.prototype.apply = function(compiler) { WarnCaseSensitiveModulesPlugin.prototype.apply = function(compiler) {

View File

@ -4,8 +4,8 @@ function WatchIgnorePlugin(paths) {
module.exports = WatchIgnorePlugin; module.exports = WatchIgnorePlugin;
WatchIgnorePlugin.prototype.apply = function (compiler) { WatchIgnorePlugin.prototype.apply = function(compiler) {
compiler.plugin("after-environment", function () { compiler.plugin("after-environment", function() {
compiler.watchFileSystem = new IgnoringWatchFileSystem(compiler.watchFileSystem, this.paths); compiler.watchFileSystem = new IgnoringWatchFileSystem(compiler.watchFileSystem, this.paths);
}.bind(this)); }.bind(this));
}; };
@ -15,25 +15,27 @@ function IgnoringWatchFileSystem(wfs, paths) {
this.paths = paths; this.paths = paths;
} }
IgnoringWatchFileSystem.prototype.watch = function (files, dirs, missing, startTime, delay, callback, callbackUndelayed) { IgnoringWatchFileSystem.prototype.watch = function(files, dirs, missing, startTime, delay, callback, callbackUndelayed) {
var ignored = function (path) { var ignored = function(path) {
return this.paths.some(function (p) { return this.paths.some(function(p) {
return ((p instanceof RegExp) ? p.test(path) : path.indexOf(p) === 0); return p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0;
}); });
}.bind(this); }.bind(this);
var notIgnored = function (path) { return !ignored(path); }; var notIgnored = function(path) {
return !ignored(path);
};
var ignoredFiles = files.filter(ignored); var ignoredFiles = files.filter(ignored);
var ignoredDirs = dirs.filter(ignored); var ignoredDirs = dirs.filter(ignored);
this.wfs.watch(files.filter(notIgnored), dirs.filter(notIgnored), missing, startTime, delay, function (err, filesModified, dirsModified, fileTimestamps, dirTimestamps) { this.wfs.watch(files.filter(notIgnored), dirs.filter(notIgnored), missing, startTime, delay, function(err, filesModified, dirsModified, fileTimestamps, dirTimestamps) {
if(err) return callback(err); if(err) return callback(err);
ignoredFiles.forEach(function (path) { ignoredFiles.forEach(function(path) {
fileTimestamps[path] = 1; fileTimestamps[path] = 1;
}); });
ignoredDirs.forEach(function (path) { ignoredDirs.forEach(function(path) {
dirTimestamps[path] = 1; dirTimestamps[path] = 1;
}); });

View File

@ -51,7 +51,6 @@ var FileAppendPlugin = require("enhanced-resolve/lib/FileAppendPlugin");
var DirectoryResultPlugin = require("enhanced-resolve/lib/DirectoryResultPlugin"); var DirectoryResultPlugin = require("enhanced-resolve/lib/DirectoryResultPlugin");
var ResultSymlinkPlugin = require("enhanced-resolve/lib/ResultSymlinkPlugin"); var ResultSymlinkPlugin = require("enhanced-resolve/lib/ResultSymlinkPlugin");
function WebpackOptionsApply() { function WebpackOptionsApply() {
OptionsApply.call(this); OptionsApply.call(this);
} }
@ -173,7 +172,8 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
legacy ? "\n/*\n//@ sourceMappingURL=[url]\n*/" : legacy ? "\n/*\n//@ sourceMappingURL=[url]\n*/" :
modern ? "\n//# sourceMappingURL=[url]" : modern ? "\n//# sourceMappingURL=[url]" :
null; null;
compiler.apply(new (evalWrapped ? EvalSourceMapDevToolPlugin : SourceMapDevToolPlugin)({ var Plugin = evalWrapped ? EvalSourceMapDevToolPlugin : SourceMapDevToolPlugin;
compiler.apply(new Plugin({
filename: inline ? null : options.output.sourceMapFilename, filename: inline ? null : options.output.sourceMapFilename,
moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate, moduleFilenameTemplate: options.output.devtoolModuleFilenameTemplate,
fallbackModuleFilenameTemplate: options.output.devtoolFallbackModuleFilenameTemplate, fallbackModuleFilenameTemplate: options.output.devtoolFallbackModuleFilenameTemplate,

View File

@ -72,34 +72,25 @@ WebpackOptionsDefaulter.prototype.process = function(options) {
function defaultByTarget(value, web, webworker, node, nodeWebkit, def) { function defaultByTarget(value, web, webworker, node, nodeWebkit, def) {
if(value !== undefined) return value; if(value !== undefined) return value;
switch(options.target) { switch(options.target) {
case "web": return web; case "web":
case "webworker": return webworker; return web;
case "node": case "async-node": return node; case "webworker":
case "node-webkit": return nodeWebkit; return webworker;
default: return def; case "node":
case "async-node":
return node;
case "node-webkit":
return nodeWebkit;
default:
return def;
} }
} }
options.resolve.modulesDirectories = defaultByTarget(options.resolve.modulesDirectories, options.resolve.modulesDirectories = defaultByTarget(options.resolve.modulesDirectories, ["web_modules", "node_modules"], ["webworker_modules", "web_modules", "node_modules"], ["node_modules"], ["node_modules", "web_modules"], ["node_modules"]);
["web_modules", "node_modules"],
["webworker_modules", "web_modules", "node_modules"],
["node_modules"],
["node_modules", "web_modules"],
["node_modules"]);
options.resolveLoader.modulesDirectories = defaultByTarget(options.resolveLoader.modulesDirectories, options.resolveLoader.modulesDirectories = defaultByTarget(options.resolveLoader.modulesDirectories, ["web_loaders", "web_modules", "node_loaders", "node_modules"], ["webworker_loaders", "web_loaders", "web_modules", "node_loaders", "node_modules"], ["node_loaders", "node_modules"], ["node_loaders", "web_loaders", "node_modules", "web_modules"], ["node_modules"]);
["web_loaders", "web_modules", "node_loaders", "node_modules"],
["webworker_loaders", "web_loaders", "web_modules", "node_loaders", "node_modules"],
["node_loaders", "node_modules"],
["node_loaders", "web_loaders", "node_modules", "web_modules"],
["node_modules"]);
options.resolve.packageMains = defaultByTarget(options.resolve.packageMains, options.resolve.packageMains = defaultByTarget(options.resolve.packageMains, ["webpack", "browser", "web", "browserify", ["jam", "main"], "main"], ["webpackWorker", "webworker", "webpack", "browser", "web", "browserify", ["jam", "main"], "main"], ["webpackNode", "node", "main"], ["webpackNodeWebkit", "webpackNode", "node", "main", "web"], ["main"]);
["webpack", "browser", "web", "browserify", ["jam", "main"], "main"],
["webpackWorker", "webworker", "webpack", "browser", "web", "browserify", ["jam", "main"], "main"],
["webpackNode", "node", "main"],
["webpackNodeWebkit", "webpackNode", "node", "main", "web"],
["main"]);
options.resolve.packageAlias = defaultByTarget(options.resolve.packageAlias, options.resolve.packageAlias = defaultByTarget(options.resolve.packageAlias,
"browser", "browser",
@ -108,31 +99,11 @@ WebpackOptionsDefaulter.prototype.process = function(options) {
"node-webkit", "node-webkit",
false); false);
options.resolveLoader.packageMains = defaultByTarget(options.resolveLoader.packageMains, options.resolveLoader.packageMains = defaultByTarget(options.resolveLoader.packageMains, ["webpackLoader", "webLoader", "loader", "main"], ["webpackWorkerLoader", "webworkerLoader", "webLoader", "loader", "main"], ["webpackNodeLoader", "nodeLoader", "loader", "main"], ["webpackNodeWebkitLoader", "webpackNodeLoader", "nodeLoader", "loader", "webLoader", "main"], ["loader", "main"]);
["webpackLoader", "webLoader", "loader", "main"],
["webpackWorkerLoader", "webworkerLoader", "webLoader", "loader", "main"],
["webpackNodeLoader", "nodeLoader", "loader", "main"],
["webpackNodeWebkitLoader", "webpackNodeLoader", "nodeLoader", "loader", "webLoader", "main"],
["loader", "main"]);
options.resolve.extensions = defaultByTarget(options.resolve.extensions, options.resolve.extensions = defaultByTarget(options.resolve.extensions, ["", ".webpack.js", ".web.js", ".js", ".json"], ["", ".webpack-worker.js", ".webworker.js", ".web.js", ".js", ".json"], ["", ".webpack-node.js", ".js", ".json", ".node"], ["", ".webpack-node-webkit.js", ".webpack-node.js", ".js", ".json", ".node", ".web.js"], ["", ".js", ".json"]);
["", ".webpack.js", ".web.js", ".js", ".json"],
["", ".webpack-worker.js", ".webworker.js", ".web.js", ".js", ".json"],
["", ".webpack-node.js", ".js", ".json", ".node"],
["", ".webpack-node-webkit.js", ".webpack-node.js", ".js", ".json", ".node", ".web.js"],
["", ".js", ".json"]);
options.resolveLoader.extensions = defaultByTarget(options.resolveLoader.extensions, options.resolveLoader.extensions = defaultByTarget(options.resolveLoader.extensions, ["", ".webpack-loader.js", ".web-loader.js", ".loader.js", ".js"], ["", ".webpack-worker-loader.js", ".webpack-loader.js", ".webworker-loader.js", ".web-loader.js", ".loader.js", ".js"], ["", ".webpack-node-loader.js", ".loader.js", ".js"], ["", ".webpack-node-webkit-loader.js", ".webpack-node-loader.js", ".loader.js", ".web-loader.js", ".js"], ["", ".js"]);
["", ".webpack-loader.js", ".web-loader.js", ".loader.js", ".js"],
["", ".webpack-worker-loader.js", ".webpack-loader.js", ".webworker-loader.js", ".web-loader.js", ".loader.js", ".js"],
["", ".webpack-node-loader.js", ".loader.js", ".js"],
["", ".webpack-node-webkit-loader.js", ".webpack-node-loader.js", ".loader.js", ".web-loader.js", ".js"],
["", ".js"]);
options.resolveLoader.moduleTemplates = defaultByTarget(options.resolveLoader.moduleTemplates, options.resolveLoader.moduleTemplates = defaultByTarget(options.resolveLoader.moduleTemplates, ["*-webpack-loader", "*-web-loader", "*-loader", "*"], ["*-webpack-worker-loader", "*-webworker-loader", "*-web-loader", "*-loader", "*"], ["*-webpack-node-loader", "*-node-loader", "*-loader", "*"], ["*-webpack-node-webkit-loader", "*-webpack-node-loader", "*-node-loader", "*-loader", "*-web-loader", "*"], ["*-loader", "*"]);
["*-webpack-loader", "*-web-loader", "*-loader", "*"],
["*-webpack-worker-loader", "*-webworker-loader", "*-web-loader", "*-loader", "*"],
["*-webpack-node-loader", "*-node-loader", "*-loader", "*"],
["*-webpack-node-webkit-loader", "*-webpack-node-loader", "*-node-loader", "*-loader", "*-web-loader", "*"],
["*-loader", "*"]);
}; };

View File

@ -22,6 +22,7 @@ AMDDefineDependency.Template = function AMDRequireDependencyTemplate() {};
AMDDefineDependency.Template.prototype.apply = function(dep, source) { AMDDefineDependency.Template.prototype.apply = function(dep, source) {
var localModuleVar = dep.localModule && dep.localModule.used && dep.localModule.variableName(); var localModuleVar = dep.localModule && dep.localModule.used && dep.localModule.variableName();
function replace(def, text) { function replace(def, text) {
if(localModuleVar) text = text.replace(/XXX/g, localModuleVar.replace(/\$/g, "$$$$")); if(localModuleVar) text = text.replace(/XXX/g, localModuleVar.replace(/\$/g, "$$$$"));
if(localModuleVar) def = def.replace(/XXX/g, localModuleVar.replace(/\$/g, "$$$$")); if(localModuleVar) def = def.replace(/XXX/g, localModuleVar.replace(/\$/g, "$$$$"));

View File

@ -90,7 +90,8 @@ AMDDefineDependencyParserPlugin.prototype.apply = function(parser) {
obj = fn = expr.arguments[2]; obj = fn = expr.arguments[2];
} }
break; break;
default: return; default:
return;
} }
var fnParams = null; var fnParams = null;
var fnParamsOffset = 0; var fnParamsOffset = 0;
@ -237,4 +238,3 @@ AMDDefineDependencyParserPlugin.prototype.apply = function(parser) {
return true; return true;
}); });
}; };

View File

@ -38,6 +38,7 @@ AMDPlugin.prototype.apply = function(compiler) {
return true; return true;
}); });
} }
function setExpressionToModule(expr, module) { function setExpressionToModule(expr, module) {
compiler.parser.plugin("expression " + expr, function(expr) { compiler.parser.plugin("expression " + expr, function(expr) {
var dep = new AMDRequireItemDependency(module, expr.range); var dep = new AMDRequireItemDependency(module, expr.range);

View File

@ -22,4 +22,3 @@ function AMDRequireDependenciesBlock(expr, arrayRange, functionRange, module, lo
module.exports = AMDRequireDependenciesBlock; module.exports = AMDRequireDependenciesBlock;
AMDRequireDependenciesBlock.prototype = Object.create(AsyncDependenciesBlock.prototype); AMDRequireDependenciesBlock.prototype = Object.create(AsyncDependenciesBlock.prototype);

View File

@ -134,4 +134,3 @@ AMDRequireDependenciesBlockParserPlugin.prototype.apply = function(parser) {
return true; return true;
}); });
}; };

View File

@ -89,4 +89,3 @@ CommonJsRequireDependencyParserPlugin.prototype.apply = function(parser) {
return true; return true;
}); });
}; };

View File

@ -27,8 +27,7 @@ module.exports = AbstractPlugin.create({
this.state.current.addDependency(dep); this.state.current.addDependency(dep);
return true; return true;
}, },
"export declaration": function() { "export declaration": function() {},
},
"export specifier": function(statement, id, name) { "export specifier": function(statement, id, name) {
var dep = new HarmonyExportSpecifierDependency(null, id, name, statement.range[1] + 0.5); var dep = new HarmonyExportSpecifierDependency(null, id, name, statement.range[1] + 0.5);
dep.loc = statement.loc; dep.loc = statement.loc;
@ -42,4 +41,3 @@ module.exports = AbstractPlugin.create({
return true; return true;
} }
}); });

View File

@ -30,4 +30,3 @@ module.exports = AbstractPlugin.create({
return true; return true;
} }
}); });

View File

@ -12,8 +12,7 @@ var NullFactory = require("../NullFactory");
var HarmonyImportDependencyParserPlugin = require("./HarmonyImportDependencyParserPlugin"); var HarmonyImportDependencyParserPlugin = require("./HarmonyImportDependencyParserPlugin");
var HarmonyExportDependencyParserPlugin = require("./HarmonyExportDependencyParserPlugin"); var HarmonyExportDependencyParserPlugin = require("./HarmonyExportDependencyParserPlugin");
function HarmonyModulesPlugin() { function HarmonyModulesPlugin() {}
}
module.exports = HarmonyModulesPlugin; module.exports = HarmonyModulesPlugin;
HarmonyModulesPlugin.prototype.apply = function(compiler) { HarmonyModulesPlugin.prototype.apply = function(compiler) {

View File

@ -19,7 +19,8 @@ LabeledModuleDependency.prototype.type = "labeled require";
LabeledModuleDependency.Template = function LabeledModuleDependencyTemplate() {}; LabeledModuleDependency.Template = function LabeledModuleDependencyTemplate() {};
LabeledModuleDependency.Template.prototype.apply = function(dep, source, outputOptions, requestShortener) { LabeledModuleDependency.Template.prototype.apply = function(dep, source, outputOptions, requestShortener) {
var comment = "", content; var comment = "",
content;
if(outputOptions.pathinfo) comment = "/*! " + requestShortener.shorten(dep.request) + " */ "; if(outputOptions.pathinfo) comment = "/*! " + requestShortener.shorten(dep.request) + " */ ";
if(dep.module && dep.module.meta && dep.module.meta.exports) { if(dep.module && dep.module.meta && dep.module.meta.exports) {
content = "var __WEBPACK_LABELED_MODULE__" + Template.toIdentifier(dep.module.id) + " = __webpack_require__(" + comment + JSON.stringify(dep.module.id) + ")"; content = "var __WEBPACK_LABELED_MODULE__" + Template.toIdentifier(dep.module.id) + " = __webpack_require__(" + comment + JSON.stringify(dep.module.id) + ")";

View File

@ -74,4 +74,3 @@ module.exports = AbstractPlugin.create({
} }
} }
}); });

View File

@ -9,8 +9,7 @@ var NullFactory = require("../NullFactory");
var LabeledModuleDependencyParserPlugin = require("./LabeledModuleDependencyParserPlugin"); var LabeledModuleDependencyParserPlugin = require("./LabeledModuleDependencyParserPlugin");
function LabeledModulesPlugin() { function LabeledModulesPlugin() {}
}
module.exports = LabeledModulesPlugin; module.exports = LabeledModulesPlugin;
LabeledModulesPlugin.prototype.apply = function(compiler) { LabeledModulesPlugin.prototype.apply = function(compiler) {

View File

@ -4,8 +4,7 @@
*/ */
var LoaderDependency = require("./LoaderDependency"); var LoaderDependency = require("./LoaderDependency");
function LoaderPlugin() { function LoaderPlugin() {}
}
module.exports = LoaderPlugin; module.exports = LoaderPlugin;
LoaderPlugin.prototype.apply = function(compiler) { LoaderPlugin.prototype.apply = function(compiler) {
@ -19,7 +18,9 @@ LoaderPlugin.prototype.apply = function(compiler) {
loaderContext.loadModule = function loadModule(request, callback) { loaderContext.loadModule = function loadModule(request, callback) {
var dep = new LoaderDependency(request); var dep = new LoaderDependency(request);
dep.loc = request; dep.loc = request;
compilation.addModuleDependencies(module, [[dep]], true, "lm", false, function(err) { compilation.addModuleDependencies(module, [
[dep]
], true, "lm", false, function(err) {
if(err) return callback(err); if(err) return callback(err);
module = dep.module; module = dep.module;

View File

@ -27,18 +27,17 @@ LocalModulesHelpers.getLocalModule = function(state, name, namedModule) {
}; };
function lookup(parent, mod) { function lookup(parent, mod) {
if (mod.charAt(0) !== ".") return mod; if(mod.charAt(0) !== ".") return mod;
var path = parent.split("/") var path = parent.split("/"),
, segs = mod.split("/"); segs = mod.split("/");
path.pop(); path.pop();
for (var i = 0; i < segs.length; i++) { for(var i = 0; i < segs.length; i++) {
var seg = segs[i]; var seg = segs[i];
if (seg === "..") path.pop(); if(seg === "..") path.pop();
else if (seg !== ".") path.push(seg); else if(seg !== ".") path.push(seg);
} }
return path.join("/"); return path.join("/");
} }

View File

@ -31,4 +31,3 @@ module.exports = AbstractPlugin.create({
} }
} }
}); });

View File

@ -32,7 +32,7 @@ RequireContextPlugin.prototype.apply = function(compiler) {
callback(null, items.map(function(obj) { callback(null, items.map(function(obj) {
return extensions.filter(function(ext) { return extensions.filter(function(ext) {
var l = obj.request.length; var l = obj.request.length;
return (l > ext.length && obj.request.substr(l - ext.length, l) === ext); return l > ext.length && obj.request.substr(l - ext.length, l) === ext;
}).map(function(ext) { }).map(function(ext) {
var l = obj.request.length; var l = obj.request.length;
return { return {

View File

@ -18,4 +18,3 @@ function RequireEnsureDependenciesBlock(expr, fnExpression, chunkName, chunkName
module.exports = RequireEnsureDependenciesBlock; module.exports = RequireEnsureDependenciesBlock;
RequireEnsureDependenciesBlock.prototype = Object.create(AsyncDependenciesBlock.prototype); RequireEnsureDependenciesBlock.prototype = Object.create(AsyncDependenciesBlock.prototype);

View File

@ -9,7 +9,8 @@ var getFunctionExpression = require("./getFunctionExpression");
module.exports = AbstractPlugin.create({ module.exports = AbstractPlugin.create({
"call require.ensure": function(expr) { "call require.ensure": function(expr) {
var chunkName = null, chunkNameRange = null; var chunkName = null,
chunkNameRange = null;
switch(expr.arguments.length) { switch(expr.arguments.length) {
case 3: case 3:
var chunkNameExpr = this.evaluateExpression(expr.arguments[2]); var chunkNameExpr = this.evaluateExpression(expr.arguments[2]);
@ -63,4 +64,3 @@ module.exports = AbstractPlugin.create({
} }
} }
}); });

View File

@ -20,9 +20,8 @@ RequireEnsureDependency.Template = function RequireEnsureDependencyTemplate() {}
RequireEnsureDependency.Template.prototype.apply = function(dep, source, outputOptions, requestShortener) { RequireEnsureDependency.Template.prototype.apply = function(dep, source, outputOptions, requestShortener) {
var depBlock = dep.block; var depBlock = dep.block;
var wrapper = DepBlockHelpers.getLoadDepBlockWrapper(depBlock, outputOptions, requestShortener, /*require.e*/"nsure"); var wrapper = DepBlockHelpers.getLoadDepBlockWrapper(depBlock, outputOptions, requestShortener, /*require.e*/ "nsure");
wrapper[1] = ".bind(null, __webpack_require__)" + wrapper[1]; wrapper[1] = ".bind(null, __webpack_require__)" + wrapper[1];
source.replace(depBlock.expr.range[0], depBlock.expr.arguments[1].range[0] - 1, wrapper[0]); source.replace(depBlock.expr.range[0], depBlock.expr.arguments[1].range[0] - 1, wrapper[0]);
source.replace(depBlock.expr.arguments[1].range[1], depBlock.expr.range[1] - 1, wrapper[1]); source.replace(depBlock.expr.arguments[1].range[1], depBlock.expr.range[1] - 1, wrapper[1]);
}; };

View File

@ -12,8 +12,7 @@ var RequireEnsureDependenciesBlockParserPlugin = require("./RequireEnsureDepende
var BasicEvaluatedExpression = require("../BasicEvaluatedExpression"); var BasicEvaluatedExpression = require("../BasicEvaluatedExpression");
function RequireEnsurePlugin() { function RequireEnsurePlugin() {}
}
module.exports = RequireEnsurePlugin; module.exports = RequireEnsurePlugin;
RequireEnsurePlugin.prototype.apply = function(compiler) { RequireEnsurePlugin.prototype.apply = function(compiler) {

View File

@ -16,4 +16,3 @@ module.exports = AbstractPlugin.create({
return true; return true;
} }
}); });

View File

@ -8,8 +8,7 @@ var ConstDependency = require("./ConstDependency");
var BasicEvaluatedExpression = require("../BasicEvaluatedExpression"); var BasicEvaluatedExpression = require("../BasicEvaluatedExpression");
function RequireIncludePlugin() { function RequireIncludePlugin() {}
}
module.exports = RequireIncludePlugin; module.exports = RequireIncludePlugin;
RequireIncludePlugin.prototype.apply = function(compiler) { RequireIncludePlugin.prototype.apply = function(compiler) {

View File

@ -67,4 +67,3 @@ RequireResolveDependencyParserPlugin.prototype.apply = function(parser) {
return true; return true;
}); });
}; };

View File

@ -15,4 +15,3 @@ function SystemImportDependenciesBlock(request, range, module, loc) {
module.exports = SystemImportDependenciesBlock; module.exports = SystemImportDependenciesBlock;
SystemImportDependenciesBlock.prototype = Object.create(AsyncDependenciesBlock.prototype); SystemImportDependenciesBlock.prototype = Object.create(AsyncDependenciesBlock.prototype);

View File

@ -33,4 +33,3 @@ SystemImportParserPlugin.prototype.apply = function(parser) {
} }
}); });
}; };

View File

@ -28,6 +28,7 @@ SystemPlugin.prototype.apply = function(compiler) {
return true; return true;
}); });
} }
function setNotSupported(expr) { function setNotSupported(expr) {
compiler.parser.plugin("expression " + expr, function(expr) { compiler.parser.plugin("expression " + expr, function(expr) {
var dep = new ConstDependency("(void 0)", expr.range); var dep = new ConstDependency("(void 0)", expr.range);

View File

@ -16,7 +16,6 @@ TemplateArgumentDependency.prototype.updateHash = function(hash) {
hash.update(this.name); hash.update(this.name);
}; };
TemplateArgumentDependency.Template = function TemplateArgumentDependencyTemplate() {}; TemplateArgumentDependency.Template = function TemplateArgumentDependencyTemplate() {};
TemplateArgumentDependency.Template.prototype.apply = function(dep, source, outputOptions, requestShortener, dependencyTemplates) { TemplateArgumentDependency.Template.prototype.apply = function(dep, source, outputOptions, requestShortener, dependencyTemplates) {

View File

@ -4,8 +4,7 @@
*/ */
var ConcatSource = require("webpack-core/lib/ConcatSource"); var ConcatSource = require("webpack-core/lib/ConcatSource");
function NodeChunkTemplatePlugin() { function NodeChunkTemplatePlugin() {}
}
module.exports = NodeChunkTemplatePlugin; module.exports = NodeChunkTemplatePlugin;
NodeChunkTemplatePlugin.prototype.apply = function(chunkTemplate) { NodeChunkTemplatePlugin.prototype.apply = function(chunkTemplate) {

View File

@ -7,8 +7,7 @@ var NodeOutputFileSystem = require("./NodeOutputFileSystem");
var NodeJsInputFileSystem = require("enhanced-resolve/lib/NodeJsInputFileSystem"); var NodeJsInputFileSystem = require("enhanced-resolve/lib/NodeJsInputFileSystem");
var CachedInputFileSystem = require("enhanced-resolve/lib/CachedInputFileSystem"); var CachedInputFileSystem = require("enhanced-resolve/lib/CachedInputFileSystem");
function NodeEnvironmentPlugin() { function NodeEnvironmentPlugin() {}
}
module.exports = NodeEnvironmentPlugin; module.exports = NodeEnvironmentPlugin;
NodeEnvironmentPlugin.prototype.apply = function(compiler) { NodeEnvironmentPlugin.prototype.apply = function(compiler) {
compiler.inputFileSystem = new NodeJsInputFileSystem(); compiler.inputFileSystem = new NodeJsInputFileSystem();

View File

@ -4,8 +4,7 @@
*/ */
var ConcatSource = require("webpack-core/lib/ConcatSource"); var ConcatSource = require("webpack-core/lib/ConcatSource");
function NodeHotUpdateChunkTemplatePlugin() { function NodeHotUpdateChunkTemplatePlugin() {}
}
module.exports = NodeHotUpdateChunkTemplatePlugin; module.exports = NodeHotUpdateChunkTemplatePlugin;
NodeHotUpdateChunkTemplatePlugin.prototype.apply = function(hotUpdateChunkTemplate) { NodeHotUpdateChunkTemplatePlugin.prototype.apply = function(hotUpdateChunkTemplate) {

View File

@ -4,8 +4,7 @@
*/ */
var ExternalsPlugin = require("../ExternalsPlugin"); var ExternalsPlugin = require("../ExternalsPlugin");
function NodeTargetPlugin() { function NodeTargetPlugin() {}
}
module.exports = NodeTargetPlugin; module.exports = NodeTargetPlugin;
NodeTargetPlugin.prototype.apply = function(compiler) { NodeTargetPlugin.prototype.apply = function(compiler) {

Some files were not shown because too many files have changed in this diff Show More