mirror of https://github.com/webpack/webpack.git
Merge branch 'master' into webpack-2
Conflicts: bin/convert-argv.js lib/webpack.js
This commit is contained in:
commit
66df34688e
|
@ -11,4 +11,7 @@ env:
|
|||
before_install:
|
||||
- '[ "${TRAVIS_NODE_VERSION}" != "0.10" ] || npm install -g npm'
|
||||
|
||||
after_success: cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose && rm -rf ./coverage
|
||||
after_success:
|
||||
- cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose
|
||||
- cat ./coverage/coverage.json | node_modules/codecov.io/bin/codecov.io.js
|
||||
- rm -rf ./coverage
|
||||
|
|
|
@ -9,7 +9,7 @@ that include your webpack.config.js and relevant files are more likely to receiv
|
|||
|
||||
**If you have discovered a bug or have a feature suggestion, feel free to create an issue on Github.**
|
||||
|
||||
If you have created your own loader/plugin please incude it on the relevant
|
||||
If you have created your own loader/plugin please include it on the relevant
|
||||
documentation pages:
|
||||
|
||||
[List of loaders](http://webpack.github.io/docs/list-of-loaders.html)
|
||||
|
|
|
@ -152,7 +152,7 @@ define(["amd-module", "../file"], function (amdModule, file) {
|
|||
// this is async
|
||||
require(["big-module/big/file"], function (big) {
|
||||
// For async dependencies, webpack splits
|
||||
// your application into multiple "chunks."
|
||||
// your application into multiple "chunks".
|
||||
// This part of your application is
|
||||
// loaded on demand (code-splitting).
|
||||
var stuff = require("../my/stuff");
|
||||
|
|
|
@ -82,7 +82,7 @@ module.exports = function(optimist, argv, convertOptions) {
|
|||
if(argv["watch"]) {
|
||||
// TODO remove this in next major version
|
||||
if(options.watch && typeof options.watch === "object") {
|
||||
console.warn("options.watch is deprecated: use options.watchOptions instead");
|
||||
console.warn("options.watch is deprecated: Use 'options.watchOptions' instead");
|
||||
options.watchOptions = options.watch;
|
||||
}
|
||||
// TODO remove this in next major version
|
||||
|
@ -463,6 +463,11 @@ module.exports = function(optimist, argv, convertOptions) {
|
|||
}
|
||||
|
||||
if(argv._.length > 0) {
|
||||
if(Array.isArray(options.entry) || typeof options.entry === "string") {
|
||||
options.entry = {
|
||||
main: options.entry
|
||||
};
|
||||
}
|
||||
ensureObject(options, "entry");
|
||||
function addTo(name, entry) {
|
||||
if(options.entry[name]) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## commonjs
|
||||
|
||||
example demonstrating a very simple programm
|
||||
example demonstrating a very simple program
|
||||
|
||||
## code-splitting
|
||||
|
||||
|
@ -10,11 +10,11 @@ example demonstrating a very simple case of Code Splitting.
|
|||
|
||||
## require.resolve
|
||||
|
||||
example demonstrating to cache clearing of modules with `require.resolve` and `require.cache`.
|
||||
example demonstrating how to cache clearing of modules with `require.resolve` and `require.cache`.
|
||||
|
||||
## require.context
|
||||
|
||||
example demonstrating to automatic creation of contexts when using variables in `require`.
|
||||
example demonstrating automatic creation of contexts when using variables in `require`.
|
||||
|
||||
## code-splitted-require.context
|
||||
|
||||
|
@ -26,7 +26,7 @@ example demonstrating contexts in a code-split environment with AMD.
|
|||
|
||||
## loader
|
||||
|
||||
example demonstrating to usage of loaders.
|
||||
example demonstrating the usage of loaders.
|
||||
|
||||
## coffee-script
|
||||
|
||||
|
@ -46,7 +46,7 @@ example demonstrating Labeled Modules
|
|||
|
||||
## mixed
|
||||
|
||||
example demonstrating mixing CommonJs, AMD and Labeled Modules
|
||||
example demonstrating mixing CommonJs, AMD, and Labeled Modules
|
||||
|
||||
## web-worker
|
||||
|
||||
|
@ -62,7 +62,7 @@ example demonstrating multiple entry points with Code Splitting.
|
|||
|
||||
# Requests
|
||||
|
||||
If you think a example is missing, please report it as issue. :)
|
||||
If you think an example is missing, please report it as issue. :)
|
||||
|
||||
# Build
|
||||
|
||||
|
|
|
@ -0,0 +1,175 @@
|
|||
# webpack.config.js
|
||||
|
||||
``` javascript
|
||||
var path = require("path");
|
||||
var webpack = require("../../");
|
||||
module.exports = {
|
||||
plugins: [
|
||||
new webpack.DllReferencePlugin({
|
||||
context: path.join(__dirname, "..", "dll"),
|
||||
manifest: require("../dll/js/alpha-manifest.json")
|
||||
}),
|
||||
new webpack.DllReferencePlugin({
|
||||
scope: "beta",
|
||||
manifest: require("../dll/js/beta-manifest.json")
|
||||
})
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
# example.js
|
||||
|
||||
``` javascript
|
||||
console.log(require("../dll/alpha"));
|
||||
console.log(require("../dll/a"));
|
||||
|
||||
console.log(require("beta/beta"));
|
||||
console.log(require("beta/b"));
|
||||
```
|
||||
|
||||
# js/output.js
|
||||
|
||||
``` javascript
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId])
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ exports: {},
|
||||
/******/ id: moduleId,
|
||||
/******/ loaded: false
|
||||
/******/ };
|
||||
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.loaded = true;
|
||||
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
|
||||
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "js/";
|
||||
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(0);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/*!********************!*\
|
||||
!*** ./example.js ***!
|
||||
\********************/
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
console.log(__webpack_require__(/*! ../dll/alpha */ 1));
|
||||
console.log(__webpack_require__(/*! ../dll/a */ 3));
|
||||
|
||||
console.log(__webpack_require__(/*! beta/beta */ 4));
|
||||
console.log(__webpack_require__(/*! beta/b */ 6));
|
||||
|
||||
|
||||
/***/ },
|
||||
/* 1 */
|
||||
/*!**************************************************************************!*\
|
||||
!*** delegated ./alpha.js from dll-reference alpha_fda802f3c408a66ef744 ***!
|
||||
\**************************************************************************/
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = (__webpack_require__(2))(1);
|
||||
|
||||
/***/ },
|
||||
/* 2 */
|
||||
/*!*********************************************!*\
|
||||
!*** external "alpha_fda802f3c408a66ef744" ***!
|
||||
\*********************************************/
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = alpha_fda802f3c408a66ef744;
|
||||
|
||||
/***/ },
|
||||
/* 3 */
|
||||
/*!**********************************************************************!*\
|
||||
!*** delegated ./a.js from dll-reference alpha_fda802f3c408a66ef744 ***!
|
||||
\**********************************************************************/
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = (__webpack_require__(2))(2);
|
||||
|
||||
/***/ },
|
||||
/* 4 */
|
||||
/*!************************************************************************!*\
|
||||
!*** delegated ./beta.js from dll-reference beta_fda802f3c408a66ef744 ***!
|
||||
\************************************************************************/
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = (__webpack_require__(5))(3);
|
||||
|
||||
/***/ },
|
||||
/* 5 */
|
||||
/*!********************************************!*\
|
||||
!*** external "beta_fda802f3c408a66ef744" ***!
|
||||
\********************************************/
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = beta_fda802f3c408a66ef744;
|
||||
|
||||
/***/ },
|
||||
/* 6 */
|
||||
/*!*********************************************************************!*\
|
||||
!*** delegated ./b.js from dll-reference beta_fda802f3c408a66ef744 ***!
|
||||
\*********************************************************************/
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = (__webpack_require__(5))(4);
|
||||
|
||||
/***/ }
|
||||
/******/ ]);
|
||||
```
|
||||
|
||||
# Info
|
||||
|
||||
## Uncompressed
|
||||
|
||||
```
|
||||
Hash: 0d8279ed7b443d36b536
|
||||
Version: webpack 1.9.5
|
||||
Time: 84ms
|
||||
Asset Size Chunks Chunk Names
|
||||
output.js 3.66 kB 0 [emitted] main
|
||||
chunk {0} output.js (main) 397 bytes [rendered]
|
||||
> main [0] ./example.js
|
||||
[0] ./example.js 145 bytes {0} [built]
|
||||
+ 6 hidden modules
|
||||
```
|
||||
|
||||
## Minimized (uglify-js, no zip)
|
||||
|
||||
```
|
||||
Hash: 1e9d431b3cebd3bcea12
|
||||
Version: webpack 1.9.5
|
||||
Time: 170ms
|
||||
Asset Size Chunks Chunk Names
|
||||
output.js 541 bytes 0 [emitted] main
|
||||
chunk {0} output.js (main) 397 bytes [rendered]
|
||||
> main [0] ./example.js
|
||||
[0] ./example.js 145 bytes {0} [built]
|
||||
+ 6 hidden modules
|
||||
```
|
|
@ -0,0 +1 @@
|
|||
require("../build-common");
|
|
@ -0,0 +1,8 @@
|
|||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<script src="../dll/js/MyDll.alpha.js" charset="utf-8"></script>
|
||||
<script src="../dll/js/MyDll.beta.js" charset="utf-8"></script>
|
||||
<script src="js/output.js" charset="utf-8"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,5 @@
|
|||
console.log(require("../dll/alpha"));
|
||||
console.log(require("../dll/a"));
|
||||
|
||||
console.log(require("beta/beta"));
|
||||
console.log(require("beta/b"));
|
|
@ -0,0 +1,31 @@
|
|||
# webpack.config.js
|
||||
|
||||
``` javascript
|
||||
{{webpack.config.js}}
|
||||
```
|
||||
|
||||
# example.js
|
||||
|
||||
``` javascript
|
||||
{{example.js}}
|
||||
```
|
||||
|
||||
# js/output.js
|
||||
|
||||
``` javascript
|
||||
{{js/output.js}}
|
||||
```
|
||||
|
||||
# Info
|
||||
|
||||
## Uncompressed
|
||||
|
||||
```
|
||||
{{stdout}}
|
||||
```
|
||||
|
||||
## Minimized (uglify-js, no zip)
|
||||
|
||||
```
|
||||
{{min:stdout}}
|
||||
```
|
|
@ -0,0 +1,14 @@
|
|||
var path = require("path");
|
||||
var webpack = require("../../");
|
||||
module.exports = {
|
||||
plugins: [
|
||||
new webpack.DllReferencePlugin({
|
||||
context: path.join(__dirname, "..", "dll"),
|
||||
manifest: require("../dll/js/alpha-manifest.json")
|
||||
}),
|
||||
new webpack.DllReferencePlugin({
|
||||
scope: "beta",
|
||||
manifest: require("../dll/js/beta-manifest.json")
|
||||
})
|
||||
]
|
||||
};
|
|
@ -0,0 +1,164 @@
|
|||
# webpack.config.js
|
||||
|
||||
``` javascript
|
||||
var path = require("path");
|
||||
var DllPlugin = require("../../lib/DllPlugin");
|
||||
module.exports = {
|
||||
entry: {
|
||||
alpha: ["./alpha", "./a"],
|
||||
beta: ["./beta", "./b"]
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, "js"),
|
||||
filename: "MyDll.[name].js",
|
||||
library: "[name]_[hash]"
|
||||
},
|
||||
plugins: [
|
||||
new DllPlugin({
|
||||
path: path.join(__dirname, "js", "[name]-manifest.json"),
|
||||
name: "[name]_[hash]"
|
||||
})
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
# js/MyDll.alpha.js
|
||||
|
||||
``` javascript
|
||||
var alpha_fda802f3c408a66ef744 =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId])
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ exports: {},
|
||||
/******/ id: moduleId,
|
||||
/******/ loaded: false
|
||||
/******/ };
|
||||
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.loaded = true;
|
||||
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
|
||||
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "js/";
|
||||
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(0);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/*!*****************!*\
|
||||
!*** dll alpha ***!
|
||||
\*****************/
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = __webpack_require__;
|
||||
|
||||
/***/ },
|
||||
/* 1 */
|
||||
/*!******************!*\
|
||||
!*** ./alpha.js ***!
|
||||
\******************/
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = "alpha";
|
||||
|
||||
/***/ },
|
||||
/* 2 */
|
||||
/*!**************!*\
|
||||
!*** ./a.js ***!
|
||||
\**************/
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
|
||||
module.exports = "a";
|
||||
|
||||
/***/ }
|
||||
/******/ ]);
|
||||
```
|
||||
|
||||
# js/alpha-manifest.json
|
||||
|
||||
``` javascript
|
||||
{
|
||||
"name": "alpha_fda802f3c408a66ef744",
|
||||
"content": {
|
||||
"./alpha.js": 1,
|
||||
"./a.js": 2
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
# Info
|
||||
|
||||
## Uncompressed
|
||||
|
||||
```
|
||||
Hash: fda802f3c408a66ef744
|
||||
Version: webpack 1.9.5
|
||||
Time: 47ms
|
||||
Asset Size Chunks Chunk Names
|
||||
MyDll.alpha.js 1.88 kB 0 [emitted] alpha
|
||||
MyDll.beta.js 1.89 kB 1 [emitted] beta
|
||||
chunk {0} MyDll.alpha.js (alpha) 58 bytes [rendered]
|
||||
> alpha [0] dll alpha
|
||||
[0] dll alpha 12 bytes {0} [built]
|
||||
[1] ./alpha.js 25 bytes {0} [built]
|
||||
single entry ./alpha [0] dll alpha
|
||||
[2] ./a.js 21 bytes {0} [built]
|
||||
single entry ./a [0] dll alpha
|
||||
chunk {1} MyDll.beta.js (beta) 57 bytes [rendered]
|
||||
> beta [0] dll beta
|
||||
[0] dll beta 12 bytes {1} [built]
|
||||
[3] ./beta.js 24 bytes {1} [built]
|
||||
single entry ./beta [0] dll beta
|
||||
[4] ./b.js 21 bytes {1} [built]
|
||||
single entry ./b [0] dll beta
|
||||
```
|
||||
|
||||
## Minimized (uglify-js, no zip)
|
||||
|
||||
```
|
||||
Hash: 28b01778c3ed267edad7
|
||||
Version: webpack 1.9.5
|
||||
Time: 130ms
|
||||
Asset Size Chunks Chunk Names
|
||||
MyDll.beta.js 330 bytes 0 [emitted] beta
|
||||
MyDll.alpha.js 330 bytes 1 [emitted] alpha
|
||||
chunk {0} MyDll.beta.js (beta) 57 bytes [rendered]
|
||||
> beta [0] dll beta
|
||||
[0] dll beta 12 bytes {0} [built]
|
||||
[3] ./b.js 21 bytes {0} [built]
|
||||
single entry ./b [0] dll beta
|
||||
[4] ./beta.js 24 bytes {0} [built]
|
||||
single entry ./beta [0] dll beta
|
||||
chunk {1} MyDll.alpha.js (alpha) 58 bytes [rendered]
|
||||
> alpha [0] dll alpha
|
||||
[0] dll alpha 12 bytes {1} [built]
|
||||
[1] ./a.js 21 bytes {1} [built]
|
||||
single entry ./a [0] dll alpha
|
||||
[2] ./alpha.js 25 bytes {1} [built]
|
||||
single entry ./alpha [0] dll alpha
|
||||
```
|
|
@ -0,0 +1 @@
|
|||
module.exports = "a";
|
|
@ -0,0 +1 @@
|
|||
module.exports = "alpha";
|
|
@ -0,0 +1 @@
|
|||
module.exports = "b";
|
|
@ -0,0 +1 @@
|
|||
module.exports = "beta";
|
|
@ -0,0 +1,2 @@
|
|||
global.NO_TARGET_ARGS = true;
|
||||
require("../build-common");
|
|
@ -0,0 +1,31 @@
|
|||
# webpack.config.js
|
||||
|
||||
``` javascript
|
||||
{{webpack.config.js}}
|
||||
```
|
||||
|
||||
# js/MyDll.alpha.js
|
||||
|
||||
``` javascript
|
||||
{{js/MyDll.alpha.js}}
|
||||
```
|
||||
|
||||
# js/alpha-manifest.json
|
||||
|
||||
``` javascript
|
||||
{{js/alpha-manifest.json}}
|
||||
```
|
||||
|
||||
# Info
|
||||
|
||||
## Uncompressed
|
||||
|
||||
```
|
||||
{{stdout}}
|
||||
```
|
||||
|
||||
## Minimized (uglify-js, no zip)
|
||||
|
||||
```
|
||||
{{min:stdout}}
|
||||
```
|
|
@ -0,0 +1,19 @@
|
|||
var path = require("path");
|
||||
var webpack = require("../../");
|
||||
module.exports = {
|
||||
entry: {
|
||||
alpha: ["./alpha", "./a"],
|
||||
beta: ["./beta", "./b"]
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, "js"),
|
||||
filename: "MyDll.[name].js",
|
||||
library: "[name]_[hash]"
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DllPlugin({
|
||||
path: path.join(__dirname, "js", "[name]-manifest.json"),
|
||||
name: "[name]_[hash]"
|
||||
})
|
||||
]
|
||||
};
|
|
@ -12,6 +12,7 @@ function APIPlugin() {
|
|||
module.exports = APIPlugin;
|
||||
|
||||
var REPLACEMENTS = {
|
||||
__webpack_require__: "__webpack_require__", // eslint-disable-line camelcase
|
||||
__webpack_public_path__: "__webpack_require__.p", // eslint-disable-line camelcase
|
||||
__webpack_modules__: "__webpack_require__.m", // eslint-disable-line camelcase
|
||||
__webpack_chunk_load__: "__webpack_require__.e", // eslint-disable-line camelcase
|
||||
|
|
|
@ -171,7 +171,7 @@ Compilation.prototype.addModuleDependencies = function(module, dependencies, bai
|
|||
for(var i = 0; i < dependencies.length; i++) {
|
||||
var factory = this.dependencyFactories.get(dependencies[i][0].Class);
|
||||
if(!factory) {
|
||||
return callback(new Error("No module factory availible for dependency type: " + dependencies[i][0].Class.name));
|
||||
return callback(new Error("No module factory available for dependency type: " + dependencies[i][0].Class.name));
|
||||
}
|
||||
factories[i] = [factory, dependencies[i]];
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ Compilation.prototype._addModuleChain = function process(context, dependency, on
|
|||
|
||||
var moduleFactory = this.dependencyFactories.get(dependency.Class);
|
||||
if(!moduleFactory) {
|
||||
throw new Error("No dependency factory availible for this dependency type: " + dependency.Class.name);
|
||||
throw new Error("No dependency factory available for this dependency type: " + dependency.Class.name);
|
||||
}
|
||||
|
||||
moduleFactory.create(context, dependency, function(err, module) {
|
||||
|
@ -427,7 +427,7 @@ Compilation.prototype.addEntry = function process(context, entry, name, callback
|
|||
|
||||
if(module) {
|
||||
if(module.reasons.length > 0) {
|
||||
return callback(new Error("module cannot be added as entry point, because its already in the bundle"));
|
||||
return callback(new Error("module cannot be added as entry point, because it's already in the bundle"));
|
||||
}
|
||||
this.preparedChunks.push({
|
||||
name: name,
|
||||
|
@ -491,7 +491,13 @@ Compilation.prototype.seal = function seal(callback) {
|
|||
chunk.initial = chunk.entry = true;
|
||||
chunk.addModule(module);
|
||||
module.addChunk(chunk);
|
||||
if(typeof module.index !== "number") {
|
||||
module.index = this.nextFreeModuleIndex++;
|
||||
}
|
||||
this.processDependenciesBlockForChunk(module, chunk);
|
||||
if(typeof module.index2 !== "number") {
|
||||
module.index2 = this.nextFreeModuleIndex2++;
|
||||
}
|
||||
}, this);
|
||||
this.sortModules(this.modules);
|
||||
this.applyPlugins("optimize");
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var Module = require("./Module");
|
||||
var OriginalSource = require("webpack-core/lib/OriginalSource");
|
||||
var RawSource = require("webpack-core/lib/RawSource");
|
||||
var WebpackMissingModule = require("./dependencies/WebpackMissingModule");
|
||||
var DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
|
||||
|
||||
function DelegatedModule(sourceRequest, request, type, userRequest) {
|
||||
Module.call(this);
|
||||
this.sourceRequest = sourceRequest;
|
||||
this.request = request;
|
||||
this.type = type;
|
||||
this.userRequest = userRequest;
|
||||
this.built = false;
|
||||
}
|
||||
module.exports = DelegatedModule;
|
||||
|
||||
DelegatedModule.prototype = Object.create(Module.prototype);
|
||||
|
||||
DelegatedModule.prototype.delegated = true;
|
||||
|
||||
DelegatedModule.prototype.identifier = function() {
|
||||
return "delegated " + JSON.stringify(this.request) + " from " + this.sourceRequest;
|
||||
};
|
||||
|
||||
DelegatedModule.prototype.readableIdentifier = function() {
|
||||
return "delegated " + this.userRequest + " from " + this.sourceRequest;
|
||||
};
|
||||
|
||||
DelegatedModule.prototype.needRebuild = function() {
|
||||
return false;
|
||||
};
|
||||
|
||||
DelegatedModule.prototype.build = function(options, compilation, resolver, fs, callback) {
|
||||
this.builtTime = new Date().getTime();
|
||||
this.dependencies.length = 0;
|
||||
this.addDependency(new DelegatedSourceDependency(this.sourceRequest));
|
||||
callback();
|
||||
};
|
||||
|
||||
DelegatedModule.prototype.source = function() {
|
||||
var sourceModule = this.dependencies[0].module;
|
||||
var str;
|
||||
if(!sourceModule) {
|
||||
str = WebpackMissingModule.moduleCode(this.sourceRequest);
|
||||
} else {
|
||||
str = "module.exports = (__webpack_require__(" + sourceModule.id + "))";
|
||||
switch(this.type) {
|
||||
case "require":
|
||||
str += "(" + JSON.stringify(this.request) + ");";
|
||||
break;
|
||||
case "object":
|
||||
str += "[" + JSON.stringify(this.request) + "];";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(this.useSourceMap) {
|
||||
return new OriginalSource(str, this.identifier());
|
||||
} else {
|
||||
return new RawSource(str);
|
||||
}
|
||||
};
|
||||
|
||||
DelegatedModule.prototype.size = function() {
|
||||
return 42;
|
||||
};
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var DelegatedModule = require("./DelegatedModule");
|
||||
|
||||
// options.source
|
||||
// options.type
|
||||
// options.context
|
||||
// options.scope
|
||||
// options.content
|
||||
function DelegatedModuleFactoryPlugin(options) {
|
||||
this.options = options;
|
||||
options.type = options.type || "require";
|
||||
options.extensions = options.extensions || ["", ".js"];
|
||||
}
|
||||
module.exports = DelegatedModuleFactoryPlugin;
|
||||
|
||||
DelegatedModuleFactoryPlugin.prototype.apply = function(normalModuleFactory) {
|
||||
var scope = this.options.scope;
|
||||
if(scope) {
|
||||
normalModuleFactory.plugin("factory", function(factory) {
|
||||
return function(data, callback) {
|
||||
var dependency = data.dependency;
|
||||
var request = dependency.request;
|
||||
if(request && request.indexOf(scope + "/") === 0) {
|
||||
var innerRequest = "." + request.substr(scope.length);
|
||||
for(var i = 0; i < this.options.extensions.length; i++) {
|
||||
var requestPlusExt = innerRequest + this.options.extensions[i];
|
||||
if(requestPlusExt in this.options.content) {
|
||||
var resolved = this.options.content[requestPlusExt];
|
||||
return callback(null, new DelegatedModule(this.options.source, resolved, this.options.type, requestPlusExt));
|
||||
}
|
||||
}
|
||||
}
|
||||
return factory(data, callback);
|
||||
}.bind(this);
|
||||
}.bind(this));
|
||||
} else {
|
||||
normalModuleFactory.plugin("module", function(module) {
|
||||
if(module.libIdent) {
|
||||
var request = module.libIdent(this.options);
|
||||
if(request && request in this.options.content) {
|
||||
var resolved = this.options.content[request];
|
||||
return new DelegatedModule(this.options.source, resolved, this.options.type, request);
|
||||
}
|
||||
}
|
||||
return module;
|
||||
}.bind(this));
|
||||
}
|
||||
};
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var DelegatedModuleFactoryPlugin = require("./DelegatedModuleFactoryPlugin");
|
||||
var DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
|
||||
|
||||
function DelegatedPlugin(options) {
|
||||
this.options = options;
|
||||
}
|
||||
module.exports = DelegatedPlugin;
|
||||
DelegatedPlugin.prototype.apply = function(compiler) {
|
||||
compiler.plugin("compilation", function(compilation, params) {
|
||||
var normalModuleFactory = params.normalModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(DelegatedSourceDependency, normalModuleFactory);
|
||||
});
|
||||
compiler.plugin("compile", function(params) {
|
||||
params.normalModuleFactory.apply(new DelegatedModuleFactoryPlugin(this.options));
|
||||
}.bind(this));
|
||||
};
|
|
@ -48,3 +48,10 @@ DependenciesBlock.prototype.disconnect = function() {
|
|||
this.blocks.forEach(disconnect);
|
||||
this.variables.forEach(disconnect);
|
||||
};
|
||||
|
||||
DependenciesBlock.prototype.hasDependencies = function() {
|
||||
return this.dependencies.length > 0 ||
|
||||
this.blocks.concat(this.variables).some(function(item) {
|
||||
return item.hasDependencies();
|
||||
});
|
||||
};
|
||||
|
|
|
@ -35,3 +35,7 @@ DependenciesBlockVariable.prototype.disconnect = function() {
|
|||
d.disconnect();
|
||||
});
|
||||
};
|
||||
|
||||
DependenciesBlockVariable.prototype.hasDependencies = function() {
|
||||
return this.dependencies.length > 0;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var DllEntryDependency = require("./dependencies/DllEntryDependency");
|
||||
var SingleEntryDependency = require("./dependencies/SingleEntryDependency");
|
||||
var DllModuleFactory = require("./DllModuleFactory");
|
||||
|
||||
function DllEntryPlugin(context, entries, name, type) {
|
||||
this.context = context;
|
||||
this.entries = entries;
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
module.exports = DllEntryPlugin;
|
||||
DllEntryPlugin.prototype.apply = function(compiler) {
|
||||
compiler.plugin("compilation", function(compilation, params) {
|
||||
var dllModuleFactory = new DllModuleFactory();
|
||||
var normalModuleFactory = params.normalModuleFactory;
|
||||
|
||||
compilation.dependencyFactories.set(DllEntryDependency, dllModuleFactory);
|
||||
|
||||
compilation.dependencyFactories.set(SingleEntryDependency, normalModuleFactory);
|
||||
});
|
||||
compiler.plugin("make", function(compilation, callback) {
|
||||
compilation.addEntry(this.context, new DllEntryDependency(this.entries.map(function(e, idx) {
|
||||
var dep = new SingleEntryDependency(e);
|
||||
dep.loc = this.name + ":" + idx;
|
||||
return dep;
|
||||
}, this), this.name, this.type), this.name, callback);
|
||||
}.bind(this));
|
||||
};
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var Module = require("./Module");
|
||||
var RawSource = require("webpack-core/lib/RawSource");
|
||||
|
||||
function DllModule(context, dependencies, name, type) {
|
||||
Module.call(this);
|
||||
this.context = context;
|
||||
this.dependencies = dependencies;
|
||||
this.name = name;
|
||||
this.built = false;
|
||||
this.cacheable = true;
|
||||
this.type = type;
|
||||
}
|
||||
module.exports = DllModule;
|
||||
|
||||
DllModule.prototype = Object.create(Module.prototype);
|
||||
|
||||
DllModule.prototype.identifier = function() {
|
||||
return "dll " + this.name;
|
||||
};
|
||||
|
||||
DllModule.prototype.readableIdentifier = function() {
|
||||
return "dll " + this.name;
|
||||
};
|
||||
|
||||
DllModule.prototype.disconnect = function disconnect() {
|
||||
this.built = false;
|
||||
Module.prototype.disconnect.call(this);
|
||||
};
|
||||
|
||||
DllModule.prototype.build = function build(options, compilation, resolver, fs, callback) {
|
||||
this.built = true;
|
||||
return callback();
|
||||
};
|
||||
|
||||
DllModule.prototype.source = function() {
|
||||
return new RawSource("module.exports = __webpack_require__;");
|
||||
};
|
||||
|
||||
DllModule.prototype.needRebuild = function needRebuild() {
|
||||
return false;
|
||||
};
|
||||
|
||||
DllModule.prototype.size = function() {
|
||||
return 12;
|
||||
};
|
||||
|
||||
DllModule.prototype.updateHash = function(hash) {
|
||||
hash.update("dll module");
|
||||
hash.update(this.name || "");
|
||||
Module.prototype.updateHash.call(this, hash);
|
||||
};
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var Tapable = require("tapable");
|
||||
var DllModule = require("./DllModule");
|
||||
|
||||
function DllModuleFactory() {
|
||||
Tapable.call(this);
|
||||
}
|
||||
module.exports = DllModuleFactory;
|
||||
|
||||
DllModuleFactory.prototype = Object.create(Tapable.prototype);
|
||||
DllModuleFactory.prototype.create = function(context, dependency, callback) {
|
||||
callback(null, new DllModule(context, dependency.dependencies, dependency.name, dependency.type));
|
||||
};
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var DllEntryPlugin = require("./DllEntryPlugin");
|
||||
var LibManifestPlugin = require("./LibManifestPlugin");
|
||||
|
||||
function DllPlugin(options) {
|
||||
this.options = options;
|
||||
}
|
||||
module.exports = DllPlugin;
|
||||
DllPlugin.prototype.apply = function(compiler) {
|
||||
compiler.plugin("entry-option", function(context, entry) {
|
||||
function itemToPlugin(item, name) {
|
||||
if(Array.isArray(item))
|
||||
return new DllEntryPlugin(context, item, name);
|
||||
else
|
||||
throw new Error("DllPlugin: supply an Array as entry");
|
||||
}
|
||||
if(typeof entry === "object") {
|
||||
Object.keys(entry).forEach(function(name) {
|
||||
compiler.apply(itemToPlugin(entry[name], name));
|
||||
});
|
||||
} else {
|
||||
compiler.apply(itemToPlugin(entry, "main"));
|
||||
}
|
||||
return true;
|
||||
});
|
||||
compiler.apply(new LibManifestPlugin(this.options));
|
||||
};
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var DelegatedPlugin = require("./DelegatedPlugin");
|
||||
var ExternalsPlugin = require("./ExternalsPlugin");
|
||||
|
||||
function DllReferencePlugin(options) {
|
||||
this.options = options;
|
||||
}
|
||||
module.exports = DllReferencePlugin;
|
||||
DllReferencePlugin.prototype.apply = function(compiler) {
|
||||
var name = this.options.name || this.options.manifest.name;
|
||||
var sourceType = this.options.sourceType || "var";
|
||||
var externals = {};
|
||||
var source = "dll-reference " + name;
|
||||
externals[source] = name;
|
||||
compiler.apply(new ExternalsPlugin(sourceType, externals));
|
||||
compiler.apply(new DelegatedPlugin({
|
||||
source: source,
|
||||
type: this.options.type,
|
||||
scope: this.options.scope,
|
||||
context: this.options.context,
|
||||
content: this.options.content || this.options.manifest.content
|
||||
}));
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var SingleEntryPlugin = require("./SingleEntryPlugin");
|
||||
var MultiEntryPlugin = require("./MultiEntryPlugin");
|
||||
|
||||
function EntryOptionPlugin() {}
|
||||
module.exports = EntryOptionPlugin;
|
||||
|
||||
EntryOptionPlugin.prototype.apply = function(compiler) {
|
||||
compiler.plugin("entry-option", function(context, entry) {
|
||||
function itemToPlugin(item, name) {
|
||||
if(Array.isArray(item))
|
||||
return new MultiEntryPlugin(context, item, name);
|
||||
else
|
||||
return new SingleEntryPlugin(context, item, name);
|
||||
}
|
||||
if(typeof entry === "string" || Array.isArray(entry)) {
|
||||
compiler.apply(itemToPlugin(entry, "main"));
|
||||
} else if(typeof entry === "object") {
|
||||
Object.keys(entry).forEach(function(name) {
|
||||
compiler.apply(itemToPlugin(entry[name], name));
|
||||
});
|
||||
}
|
||||
return true;
|
||||
});
|
||||
};
|
|
@ -12,7 +12,11 @@ module.exports = FunctionModuleTemplatePlugin;
|
|||
FunctionModuleTemplatePlugin.prototype.apply = function(moduleTemplate) {
|
||||
moduleTemplate.plugin("render", function(moduleSource, module) {
|
||||
var source = new ConcatSource();
|
||||
source.add("/***/ function(" + ["module", "exports", "__webpack_require__"].concat(module.arguments || []).join(", ") + ") {\n\n");
|
||||
var defaultArguments = ["module", "exports"];
|
||||
if((module.arguments && module.arguments.length !== 0) || module.hasDependencies()) {
|
||||
defaultArguments.push("__webpack_require__");
|
||||
}
|
||||
source.add("/***/ function(" + defaultArguments.concat(module.arguments || []).join(", ") + ") {\n\n");
|
||||
source.add(new PrefixSource(this.outputOptions.sourcePrefix, moduleSource));
|
||||
source.add("\n\n/***/ }");
|
||||
return source;
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var path = require("path");
|
||||
var async = require("async");
|
||||
|
||||
function LibManifestPlugin(options) {
|
||||
this.options = options;
|
||||
}
|
||||
module.exports = LibManifestPlugin;
|
||||
LibManifestPlugin.prototype.apply = function(compiler) {
|
||||
compiler.plugin("emit", function(compilation, callback) {
|
||||
async.forEach(compilation.chunks, function(chunk, callback) {
|
||||
if(!chunk.initial)
|
||||
return;
|
||||
var targetPath = compilation.getPath(this.options.path, {
|
||||
hash: compilation.hash,
|
||||
chunk: chunk
|
||||
});
|
||||
var name = compilation.getPath(this.options.name, {
|
||||
hash: compilation.hash,
|
||||
chunk: chunk
|
||||
});
|
||||
var manifest = {
|
||||
name: name,
|
||||
type: this.options.type,
|
||||
content: chunk.modules.reduce(function(obj, module) {
|
||||
if(module.libIdent) {
|
||||
var ident = module.libIdent({
|
||||
context: this.options.context || compiler.options.context
|
||||
});
|
||||
if(ident) {
|
||||
obj[ident] = module.id;
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}.bind(this), {})
|
||||
};
|
||||
var content = new Buffer(JSON.stringify(manifest, null, 2), "utf-8");
|
||||
compiler.outputFileSystem.mkdirp(path.dirname(targetPath), function(err) {
|
||||
if(err) return callback(err);
|
||||
compiler.outputFileSystem.writeFile(targetPath, content, callback);
|
||||
});
|
||||
}.bind(this), callback);
|
||||
}.bind(this));
|
||||
};
|
|
@ -2,6 +2,7 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var path = require("path");
|
||||
var Module = require("./Module");
|
||||
var NormalModuleMixin = require("webpack-core/lib/NormalModuleMixin");
|
||||
var SourceMapSource = require("webpack-core/lib/SourceMapSource");
|
||||
|
@ -38,6 +39,21 @@ NormalModule.prototype.readableIdentifier = function(requestShortener) {
|
|||
return requestShortener.shorten(this.userRequest);
|
||||
};
|
||||
|
||||
function contextify(options, request) {
|
||||
return request.split("!").map(function(r) {
|
||||
var rp = path.relative(options.context, r);
|
||||
if(path.sep === "\\")
|
||||
rp = rp.replace(/\\/g, "/");
|
||||
if(rp.indexOf("../") !== 0)
|
||||
rp = "./" + rp;
|
||||
return rp;
|
||||
}).join("!");
|
||||
}
|
||||
|
||||
NormalModule.prototype.libIdent = function(options) {
|
||||
return contextify(options, this.userRequest);
|
||||
};
|
||||
|
||||
NormalModule.prototype.fillLoaderContext = function fillLoaderContext(loaderContext, options, compilation) {
|
||||
loaderContext.webpack = true;
|
||||
loaderContext.sourceMap = !!this.useSourceMap;
|
||||
|
@ -107,7 +123,7 @@ NormalModule.prototype.source = function(dependencyTemplates, outputOptions, req
|
|||
return this._cachedSource.source;
|
||||
}
|
||||
var _source = this._source;
|
||||
if(!_source) return new RawSource("throw new Error('No source availible');");
|
||||
if(!_source) return new RawSource("throw new Error('No source available');");
|
||||
var source = new ReplaceSource(_source);
|
||||
this._cachedSource = { source: source, hash: hash };
|
||||
var topLevelBlock = this;
|
||||
|
|
|
@ -51,6 +51,9 @@ function NormalModuleFactory(context, resolvers, parser, options) {
|
|||
result.parser
|
||||
);
|
||||
}
|
||||
|
||||
createdModule = this.applyPluginsWaterfall("module", createdModule);
|
||||
|
||||
return callback(null, createdModule);
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
|
|
|
@ -369,7 +369,7 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
|
|||
bold(obj.version);
|
||||
newline();
|
||||
}
|
||||
if(obj.time) {
|
||||
if(typeof obj.time === "number") {
|
||||
normal("Time: ");
|
||||
bold(obj.time);
|
||||
normal("ms");
|
||||
|
|
|
@ -10,8 +10,7 @@ var EvalDevToolModulePlugin = require("./EvalDevToolModulePlugin");
|
|||
var SourceMapDevToolPlugin = require("./SourceMapDevToolPlugin");
|
||||
var EvalSourceMapDevToolPlugin = require("./EvalSourceMapDevToolPlugin");
|
||||
|
||||
var SingleEntryPlugin = require("./SingleEntryPlugin");
|
||||
var MultiEntryPlugin = require("./MultiEntryPlugin");
|
||||
var EntryOptionPlugin = require("./EntryOptionPlugin");
|
||||
var RecordIdsPlugin = require("./RecordIdsPlugin");
|
||||
|
||||
var APIPlugin = require("./APIPlugin");
|
||||
|
@ -113,6 +112,7 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
|
|||
);
|
||||
break;
|
||||
case "atom":
|
||||
case "electron":
|
||||
var NodeTemplatePlugin = require("./node/NodeTemplatePlugin");
|
||||
var NodeTargetPlugin = require("./node/NodeTargetPlugin");
|
||||
var ExternalsPlugin = require("./ExternalsPlugin");
|
||||
|
@ -140,7 +140,7 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
|
|||
"screen",
|
||||
"shell"
|
||||
]),
|
||||
new LoaderTargetPlugin("atom")
|
||||
new LoaderTargetPlugin(options.target)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
|
@ -191,19 +191,8 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
|
|||
compiler.apply(new EvalDevToolModulePlugin(comment, options.output.devtoolModuleFilenameTemplate));
|
||||
}
|
||||
|
||||
function itemToPlugin(item, name) {
|
||||
if(Array.isArray(item))
|
||||
return new MultiEntryPlugin(options.context, item, name);
|
||||
else
|
||||
return new SingleEntryPlugin(options.context, item, name);
|
||||
}
|
||||
if(typeof options.entry === "string" || Array.isArray(options.entry)) {
|
||||
compiler.apply(itemToPlugin(options.entry, "main"));
|
||||
} else if(typeof options.entry === "object") {
|
||||
Object.keys(options.entry).forEach(function(name) {
|
||||
compiler.apply(itemToPlugin(options.entry[name], name));
|
||||
});
|
||||
}
|
||||
compiler.apply(new EntryOptionPlugin());
|
||||
compiler.applyPluginsBailResult("entry-option", options.context, options.entry);
|
||||
|
||||
compiler.apply(
|
||||
new CompatibilityPlugin(),
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var ModuleDependency = require("./ModuleDependency");
|
||||
|
||||
function DelegatedSourceDependency(request) {
|
||||
ModuleDependency.call(this, request);
|
||||
this.Class = DelegatedSourceDependency;
|
||||
}
|
||||
module.exports = DelegatedSourceDependency;
|
||||
|
||||
DelegatedSourceDependency.prototype = Object.create(ModuleDependency.prototype);
|
||||
DelegatedSourceDependency.prototype.constructor = DelegatedSourceDependency;
|
||||
DelegatedSourceDependency.prototype.type = "delegated source";
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
var Dependency = require("../Dependency");
|
||||
|
||||
function DllEntryDependency(dependencies, name, type) {
|
||||
Dependency.call(this);
|
||||
this.Class = DllEntryDependency;
|
||||
this.dependencies = dependencies;
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
module.exports = DllEntryDependency;
|
||||
|
||||
DllEntryDependency.prototype = Object.create(Dependency.prototype);
|
||||
DllEntryDependency.prototype.constructor = DllEntryDependency;
|
||||
DllEntryDependency.prototype.type = "dll entry";
|
|
@ -89,7 +89,9 @@ exportPlugins(exports, ".", [
|
|||
"UmdMainTemplatePlugin",
|
||||
"NoErrorsPlugin",
|
||||
"NewWatchingPlugin",
|
||||
"EnvironmentPlugin"
|
||||
"EnvironmentPlugin",
|
||||
"DllPlugin",
|
||||
"DllReferencePlugin"
|
||||
]);
|
||||
exportPlugins(exports.optimize = {}, "./optimize", [
|
||||
"AggressiveMergingPlugin",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "webpack",
|
||||
"version": "1.9.8",
|
||||
"version": "1.9.10",
|
||||
"author": "Tobias Koppers @sokra",
|
||||
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.",
|
||||
"dependencies": {
|
||||
|
@ -25,6 +25,7 @@
|
|||
"devDependencies": {
|
||||
"benchmark": "^1.0.0",
|
||||
"bundle-loader": "~0.5.0",
|
||||
"codecov.io": "^0.1.2",
|
||||
"coffee-loader": "~0.7.1",
|
||||
"component-webpack-plugin": "~0.2.0",
|
||||
"coveralls": "^2.11.2",
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function(req) {
|
||||
return ["a", "b", "c"][req];
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
it("should delegate the modules", function() {
|
||||
require("./a").should.be.eql("a");
|
||||
require("./loader!./b").should.be.eql("b");
|
||||
require("./dir/c").should.be.eql("c");
|
||||
});
|
|
@ -0,0 +1,15 @@
|
|||
var DelegatedPlugin = require("../../../../lib/DelegatedPlugin");
|
||||
module.exports = {
|
||||
plugins: [
|
||||
new DelegatedPlugin({
|
||||
source: "./bundle",
|
||||
type: "require",
|
||||
context: __dirname,
|
||||
content: {
|
||||
"./a.js": 0,
|
||||
"./loader.js!./b.js": 1,
|
||||
"./dir/c.js": 2
|
||||
}
|
||||
})
|
||||
]
|
||||
};
|
|
@ -1,10 +1,10 @@
|
|||
Hash: c52d668f92c33bc92eac
|
||||
Time: Xms
|
||||
Asset Size Chunks Chunk Names
|
||||
bundle.js 3.85 kB 0 [emitted] main
|
||||
bundle.js 3.83 kB 0 [emitted] main
|
||||
1.bundle.js 159 bytes 1 [emitted]
|
||||
2.bundle.js 122 bytes 2 [emitted]
|
||||
3.bundle.js 222 bytes 3 [emitted]
|
||||
2.bundle.js 101 bytes 2 [emitted]
|
||||
3.bundle.js 180 bytes 3 [emitted]
|
||||
chunk {0} bundle.js (main) 73 bytes [rendered]
|
||||
[0] (webpack)/test/statsCases/chunks/index.js 51 bytes {0} [built]
|
||||
factory:Xms building:Xms = Xms
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
Hash: 7d078d6091918f9a6116
|
||||
Time: Xms
|
||||
Asset Size Chunks Chunk Names
|
||||
main.js 1.52 kB 0 [emitted] main
|
||||
chunk {0} main.js (main) 59 bytes [rendered]
|
||||
[0] (webpack)/test/statsCases/external/index.js 17 bytes {0} [built]
|
||||
[1] external "test" 42 bytes {0} [not cacheable]
|
|
@ -0,0 +1 @@
|
|||
require("test");
|
|
@ -0,0 +1,6 @@
|
|||
module.exports = {
|
||||
entry: "./index",
|
||||
externals: {
|
||||
test: "commonjs test"
|
||||
}
|
||||
};
|
|
@ -1,7 +1,7 @@
|
|||
Hash: 8a90900b466057087b35
|
||||
Time: Xms
|
||||
Asset Size Chunks Chunk Names
|
||||
bundle.js 1.41 kB 0 [emitted] main
|
||||
bundle.js 1.39 kB 0 [emitted] main
|
||||
chunk {0} bundle.js (main) 0 bytes [rendered]
|
||||
[0] (webpack)/test/statsCases/simple-more-info/index.js 0 bytes {0} [built]
|
||||
factory:Xms building:Xms = Xms
|
|
@ -1,6 +1,6 @@
|
|||
Hash: 8a90900b466057087b35
|
||||
Time: Xms
|
||||
Asset Size Chunks Chunk Names
|
||||
bundle.js 1.41 kB 0 [emitted] main
|
||||
bundle.js 1.39 kB 0 [emitted] main
|
||||
chunk {0} bundle.js (main) 0 bytes [rendered]
|
||||
[0] (webpack)/test/statsCases/simple/index.js 0 bytes {0} [built]
|
Loading…
Reference in New Issue