Skip to content

Commit 7cbd78c

Browse files
committed
Merge branch 'master' into webpack-2
Conflicts: .travis.yml bin/config-optimist.js test/statsCases/define-plugin/expected.txt
2 parents 060ba5e + 3c7b13f commit 7cbd78c

27 files changed

+171
-46
lines changed

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
sudo: false
22
language: node_js
33
node_js:
4+
- "0.12"
45
- node
56
- iojs-1
67
- iojs-2
@@ -10,7 +11,11 @@ env:
1011
- NO_WATCH_TESTS=1
1112

1213
before_install:
13-
- '[ "${TRAVIS_NODE_VERSION}" != "0.10" ] || npm install -g npm'
14+
- '[ "${TRAVIS_NODE_VERSION}" != "0.10" ] || npm install -g npm@^2'
15+
16+
before_script:
17+
- npm link
18+
- npm link webpack
1419

1520
after_success:
1621
- cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ MIT (http://www.opensource.org/licenses/mit-license.php)
254254
(In chronological order)
255255

256256
* @google for [Google Web Toolkit (GWT)](https://code.google.com/p/google-web-toolkit), which aims to compile Java to JavaScript. It features a similar [Code Splitting](https://code.google.com/p/google-web-toolkit/wiki/CodeSplitting) as webpack.
257-
* @medikoo for [modules-webmake](https://github.com/medikoo/modules-webmake), which is a simlar project. webpack was born because I wanted Code Splitting for modules-webpack. Interestingly the [Code Splitting issue is still open](https://github.com/medikoo/modules-webmake/issues/7) (thanks also to @Phoscur for the discussion).
257+
* @medikoo for [modules-webmake](https://github.com/medikoo/modules-webmake), which is a similar project. webpack was born because I wanted Code Splitting for modules-webpack. Interestingly the [Code Splitting issue is still open](https://github.com/medikoo/modules-webmake/issues/7) (thanks also to @Phoscur for the discussion).
258258
* @substack for [browserify](http://browserify.org/), which is a similar project and source for many ideas.
259259
* @jrburke for [require.js](http://requirejs.org/), which is a similar project and source for many ideas.
260260
* @defunctzombie for the [browser-field spec](https://gist.github.com/defunctzombie/4339901), which makes modules available for node.js, browserify and webpack.

bin/config-optimist.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = function(optimist) {
22
optimist
33
.boolean("help").alias("help", "h").alias("help", "?").describe("help")
4-
.string("config").describe("config")
4+
.string("config").alias("config", "c").describe("config")
55
.string("env").describe("env", "Enviroment passed to the config, when it is a function")
66
.string("context").describe("context")
77
.string("entry").describe("entry")
@@ -24,6 +24,7 @@ module.exports = function(optimist) {
2424
.string("target").describe("target")
2525
.boolean("cache").describe("cache").default("cache", true)
2626
.boolean("watch").alias("watch", "w").describe("watch")
27+
.boolean("watch-stdin").alias("watch-stdin", "stdin").describe("watch which closes when stdin ends")
2728
.describe("watch-aggregate-timeout")
2829
.describe("watch-poll")
2930
.boolean("hot").alias("hot", "h").describe("hot")

bin/convert-argv.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ module.exports = function(optimist, argv, convertOptions) {
137137
options.watchOptions.poll = true;
138138
}
139139

140+
if(argv["watch-stdin"]) {
141+
options.watchOptions = options.watchOptions || {};
142+
options.watchOptions.stdin = true;
143+
options.watch = true;
144+
}
145+
140146
function processOptions(options) {
141147
function ifArg(name, fn, init, finalize) {
142148
if(Array.isArray(argv[name])) {
@@ -507,6 +513,7 @@ module.exports = function(optimist, argv, convertOptions) {
507513
throw new Error("'output.filename' is required, either in config file or as --output-file");
508514
} else {
509515
optimist.showHelp();
516+
console.error("Output filename not configured.");
510517
process.exit(-1);
511518
}
512519
}

bin/webpack.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ function compilerCallback(err, stats) {
172172
if(options.watch) {
173173
var primaryOptions = !Array.isArray(options) ? options : options[0];
174174
var watchOptions = primaryOptions.watchOptions || primaryOptions.watch || {};
175+
if(watchOptions.stdin) {
176+
process.stdin.on('end', function() {
177+
process.exit(0)
178+
});
179+
process.stdin.resume();
180+
}
175181
compiler.watch(watchOptions, compilerCallback);
176182
} else
177183
compiler.run(compilerCallback);

lib/Compilation.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ function Compilation(compiler) {
5959
module.exports = Compilation;
6060

6161
Compilation.prototype = Object.create(Tapable.prototype);
62+
Compilation.prototype.constructor = Compilation;
63+
6264
Compilation.prototype.templatesPlugin = function(name, fn) {
6365
this.mainTemplate.plugin(name, fn);
6466
this.chunkTemplate.plugin(name, fn);

lib/Compiler.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ function Compiler() {
166166
module.exports = Compiler;
167167

168168
Compiler.prototype = Object.create(Tapable.prototype);
169+
Compiler.prototype.constructor = Compiler;
169170

170171
Compiler.Watching = Watching;
171172
Compiler.prototype.watch = function(watchOptions, handler) {

lib/ContextModuleFactory.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ function ContextModuleFactory(resolvers) {
1616
module.exports = ContextModuleFactory;
1717

1818
ContextModuleFactory.prototype = Object.create(Tapable.prototype);
19+
ContextModuleFactory.prototype.constructor = ContextModuleFactory;
20+
1921
ContextModuleFactory.prototype.create = function(context, dependency, callback) {
2022
this.applyPluginsAsyncWaterfall("before-resolve", {
2123
context: context,

lib/DllModuleFactory.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ function DllModuleFactory() {
1111
module.exports = DllModuleFactory;
1212

1313
DllModuleFactory.prototype = Object.create(Tapable.prototype);
14+
DllModuleFactory.prototype.constructor = DllModuleFactory;
15+
1416
DllModuleFactory.prototype.create = function(context, dependency, callback) {
1517
callback(null, new DllModule(context, dependency.dependencies, dependency.name, dependency.type));
1618
};

lib/LibraryTemplatePlugin.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ function accessorAccess(base, accessor, joinWith) {
2222
}).join(joinWith || "; ");
2323
}
2424

25-
function LibraryTemplatePlugin(name, target) {
25+
function LibraryTemplatePlugin(name, target, umdNamedDefine) {
2626
this.name = name;
2727
this.target = target;
28+
this.umdNamedDefine = umdNamedDefine;
2829
}
2930
module.exports = LibraryTemplatePlugin;
3031
LibraryTemplatePlugin.prototype.apply = function(compiler) {
@@ -60,7 +61,10 @@ LibraryTemplatePlugin.prototype.apply = function(compiler) {
6061
case "umd":
6162
case "umd2":
6263
var UmdMainTemplatePlugin = require("./UmdMainTemplatePlugin");
63-
compilation.apply(new UmdMainTemplatePlugin(this.name, this.target === "umd2"));
64+
compilation.apply(new UmdMainTemplatePlugin(this.name, {
65+
optionalAmdExternalAsGlobal: this.target === "umd2",
66+
namedDefine: this.umdNamedDefine
67+
}));
6468
break;
6569
case "jsonp":
6670
var JsonpExportMainTemplatePlugin = require("./JsonpExportMainTemplatePlugin");

0 commit comments

Comments
 (0)