webpack 1.13.3 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -22
- package/README.md +310 -310
- package/buildin/amd-define.js +1 -1
- package/buildin/amd-options.js +1 -1
- package/buildin/module.js +10 -10
- package/hot/dev-server.js +63 -63
- package/hot/log-apply-result.js +25 -25
- package/hot/only-dev-server.js +77 -77
- package/hot/poll.js +37 -37
- package/hot/signal.js +65 -65
- package/lib/APIPlugin.js +49 -49
- package/lib/AbstractPlugin.js +22 -22
- package/lib/AmdMainTemplatePlugin.js +43 -43
- package/lib/ArrayMap.js +50 -50
- package/lib/AsyncDependenciesBlock.js +39 -39
- package/lib/AutomaticPrefetchPlugin.js +35 -35
- package/lib/BannerPlugin.js +34 -34
- package/lib/BasicEvaluatedExpression.js +140 -140
- package/lib/CachePlugin.js +43 -43
- package/lib/CaseSensitiveModulesWarning.js +16 -16
- package/lib/Chunk.js +252 -252
- package/lib/ChunkRenderError.js +17 -17
- package/lib/ChunkTemplate.js +37 -37
- package/lib/CompatibilityPlugin.js +42 -42
- package/lib/Compilation.js +891 -891
- package/lib/Compiler.js +407 -407
- package/lib/ConcatSource.js +5 -5
- package/lib/ConstPlugin.js +54 -54
- package/lib/ContextModule.js +130 -130
- package/lib/ContextModuleFactory.js +132 -132
- package/lib/ContextReplacementPlugin.js +93 -93
- package/lib/CriticalDependenciesWarning.js +24 -24
- package/lib/DefinePlugin.js +126 -126
- package/lib/DelegatedModule.js +69 -69
- package/lib/DelegatedModuleFactoryPlugin.js +51 -51
- package/lib/DelegatedPlugin.js +21 -21
- package/lib/DependenciesBlock.js +57 -57
- package/lib/DependenciesBlockVariable.js +41 -41
- package/lib/Dependency.js +54 -54
- package/lib/DllEntryPlugin.js +32 -32
- package/lib/DllModule.js +55 -55
- package/lib/DllModuleFactory.js +18 -18
- package/lib/DllPlugin.js +30 -30
- package/lib/DllReferencePlugin.js +26 -26
- package/lib/EntryModuleNotFoundError.js +15 -15
- package/lib/EntryOptionPlugin.js +28 -28
- package/lib/EnvironmentPlugin.js +28 -28
- package/lib/EvalDevToolModulePlugin.js +17 -17
- package/lib/EvalDevToolModuleTemplatePlugin.js +29 -29
- package/lib/EvalSourceMapDevToolModuleTemplatePlugin.js +68 -68
- package/lib/EvalSourceMapDevToolPlugin.js +25 -25
- package/lib/ExtendedAPIPlugin.js +45 -45
- package/lib/ExternalModule.js +89 -89
- package/lib/ExternalModuleFactoryPlugin.js +86 -86
- package/lib/ExternalsPlugin.js +16 -16
- package/lib/FunctionModulePlugin.js +18 -18
- package/lib/FunctionModuleTemplatePlugin.js +39 -39
- package/lib/HotModuleReplacement.runtime.js +486 -486
- package/lib/HotModuleReplacementPlugin.js +223 -223
- package/lib/HotUpdateChunkTemplate.js +28 -28
- package/lib/IgnorePlugin.js +32 -32
- package/lib/JsonpChunkTemplatePlugin.js +26 -26
- package/lib/JsonpExportMainTemplatePlugin.js +28 -28
- package/lib/JsonpHotUpdateChunkTemplatePlugin.js +26 -26
- package/lib/JsonpMainTemplate.runtime.js +56 -56
- package/lib/JsonpMainTemplatePlugin.js +162 -162
- package/lib/JsonpTemplatePlugin.js +17 -17
- package/lib/LibManifestPlugin.js +49 -49
- package/lib/LibraryTemplatePlugin.js +77 -77
- package/lib/LoaderTargetPlugin.js +16 -16
- package/lib/MainTemplate.js +169 -169
- package/lib/MemoryOutputFileSystem.js +5 -5
- package/lib/Module.js +116 -116
- package/lib/ModuleFilenameHelpers.js +157 -157
- package/lib/ModuleNotFoundError.js +17 -17
- package/lib/ModuleParseError.js +26 -26
- package/lib/ModuleParserHelpers.js +21 -21
- package/lib/ModuleReason.js +9 -9
- package/lib/ModuleTemplate.js +23 -23
- package/lib/MovedToPluginWarningPlugin.js +17 -17
- package/lib/MultiCompiler.js +166 -166
- package/lib/MultiEntryPlugin.js +31 -31
- package/lib/MultiModule.js +71 -71
- package/lib/MultiModuleFactory.js +18 -18
- package/lib/NamedModulesPlugin.js +21 -21
- package/lib/NewWatchingPlugin.js +12 -12
- package/lib/NoErrorsPlugin.js +18 -18
- package/lib/NodeStuffPlugin.js +99 -99
- package/lib/NormalModule.js +322 -322
- package/lib/NormalModuleFactory.js +171 -171
- package/lib/NormalModuleReplacementPlugin.js +40 -40
- package/lib/NullFactory.js +10 -10
- package/lib/OldWatchingPlugin.js +14 -14
- package/lib/OptionsApply.js +10 -10
- package/lib/OriginalSource.js +5 -5
- package/lib/Parser.js +938 -938
- package/lib/PrefetchPlugin.js +25 -25
- package/lib/ProgressPlugin.js +80 -80
- package/lib/ProvidePlugin.js +48 -48
- package/lib/RawModule.js +65 -65
- package/lib/RawSource.js +5 -5
- package/lib/RecordIdsPlugin.js +130 -130
- package/lib/RequestShortener.js +56 -56
- package/lib/RequireJsStuffPlugin.js +38 -38
- package/lib/ResolverPlugin.js +34 -34
- package/lib/SetVarMainTemplatePlugin.js +36 -36
- package/lib/SingleEntryPlugin.js +24 -24
- package/lib/Source.js +5 -5
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +33 -33
- package/lib/SourceMapDevToolPlugin.js +168 -168
- package/lib/SourceMapSource.js +5 -5
- package/lib/Stats.js +732 -732
- package/lib/Template.js +119 -119
- package/lib/TemplatedPathPlugin.js +111 -111
- package/lib/UmdMainTemplatePlugin.js +146 -146
- package/lib/UnsupportedFeatureWarning.js +14 -14
- package/lib/WarnCaseSensitiveModulesPlugin.js +27 -27
- package/lib/WatchIgnorePlugin.js +45 -45
- package/lib/WebpackOptionsApply.js +376 -376
- package/lib/WebpackOptionsDefaulter.js +112 -112
- package/lib/dependencies/AMDDefineDependency.js +63 -63
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +240 -240
- package/lib/dependencies/AMDPlugin.js +115 -115
- package/lib/dependencies/AMDRequireArrayDependency.js +34 -34
- package/lib/dependencies/AMDRequireContextDependency.js +18 -18
- package/lib/dependencies/AMDRequireDependenciesBlock.js +25 -25
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +145 -145
- package/lib/dependencies/AMDRequireDependency.js +64 -64
- package/lib/dependencies/AMDRequireItemDependency.js +17 -17
- package/lib/dependencies/CommonJsPlugin.js +93 -93
- package/lib/dependencies/CommonJsRequireContextDependency.js +18 -18
- package/lib/dependencies/CommonJsRequireDependency.js +17 -17
- package/lib/dependencies/CommonJsRequireDependencyParserPlugin.js +91 -91
- package/lib/dependencies/ConstDependency.js +29 -29
- package/lib/dependencies/ContextDependency.js +24 -24
- package/lib/dependencies/ContextDependencyHelpers.js +34 -34
- package/lib/dependencies/ContextDependencyTemplateAsId.js +22 -22
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +31 -31
- package/lib/dependencies/ContextElementDependency.js +17 -17
- package/lib/dependencies/DelegatedSourceDependency.js +14 -14
- package/lib/dependencies/DepBlockHelpers.js +41 -41
- package/lib/dependencies/DllEntryDependency.js +17 -17
- package/lib/dependencies/LabeledExportsDependency.js +21 -21
- package/lib/dependencies/LabeledModuleDependency.js +36 -36
- package/lib/dependencies/LabeledModuleDependencyParserPlugin.js +76 -76
- package/lib/dependencies/LabeledModulesPlugin.js +26 -26
- package/lib/dependencies/LoaderDependency.js +14 -14
- package/lib/dependencies/LoaderPlugin.js +61 -61
- package/lib/dependencies/LocalModule.js +19 -19
- package/lib/dependencies/LocalModuleDependency.js +23 -23
- package/lib/dependencies/LocalModulesHelpers.js +43 -43
- package/lib/dependencies/ModuleDependency.js +20 -20
- package/lib/dependencies/ModuleDependencyTemplateAsId.js +22 -22
- package/lib/dependencies/ModuleDependencyTemplateAsRequireId.js +22 -22
- package/lib/dependencies/ModuleHotAcceptDependency.js +18 -18
- package/lib/dependencies/ModuleHotDeclineDependency.js +18 -18
- package/lib/dependencies/MultiEntryDependency.js +16 -16
- package/lib/dependencies/NullDependency.js +17 -17
- package/lib/dependencies/NullDependencyTemplate.js +8 -8
- package/lib/dependencies/PrefetchDependency.js +14 -14
- package/lib/dependencies/RequireContextDependency.js +17 -17
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +33 -33
- package/lib/dependencies/RequireContextPlugin.js +64 -64
- package/lib/dependencies/RequireEnsureDependenciesBlock.js +20 -20
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +66 -66
- package/lib/dependencies/RequireEnsureDependency.js +29 -29
- package/lib/dependencies/RequireEnsureItemDependency.js +16 -16
- package/lib/dependencies/RequireEnsurePlugin.js +38 -38
- package/lib/dependencies/RequireHeaderDependency.js +25 -25
- package/lib/dependencies/RequireIncludeDependency.js +25 -25
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +18 -18
- package/lib/dependencies/RequireIncludePlugin.js +31 -31
- package/lib/dependencies/RequireResolveContextDependency.js +18 -18
- package/lib/dependencies/RequireResolveDependency.js +17 -17
- package/lib/dependencies/RequireResolveDependencyParserPlugin.js +69 -69
- package/lib/dependencies/RequireResolveHeaderDependency.js +25 -25
- package/lib/dependencies/SingleEntryDependency.js +14 -14
- package/lib/dependencies/TemplateArgumentDependency.js +26 -26
- package/lib/dependencies/WebpackMissingModule.js +23 -23
- package/lib/dependencies/getFunctionExpression.js +43 -43
- package/lib/node/NodeChunkTemplatePlugin.js +22 -22
- package/lib/node/NodeEnvironmentPlugin.js +25 -25
- package/lib/node/NodeHotUpdateChunkTemplatePlugin.js +24 -24
- package/lib/node/NodeMainTemplate.runtime.js +20 -20
- package/lib/node/NodeMainTemplateAsync.runtime.js +34 -34
- package/lib/node/NodeMainTemplatePlugin.js +164 -164
- package/lib/node/NodeOutputFileSystem.js +17 -17
- package/lib/node/NodeSourcePlugin.js +85 -75
- package/lib/node/NodeTargetPlugin.js +12 -12
- package/lib/node/NodeTemplatePlugin.js +21 -21
- package/lib/node/NodeWatchFileSystem.js +65 -65
- package/lib/node/OldNodeWatchFileSystem.js +265 -265
- package/lib/optimize/AggressiveMergingPlugin.js +115 -115
- package/lib/optimize/CommonsChunkPlugin.js +178 -178
- package/lib/optimize/DedupePlugin.js +227 -227
- package/lib/optimize/FlagIncludedChunksPlugin.js +24 -24
- package/lib/optimize/LimitChunkCountPlugin.js +55 -55
- package/lib/optimize/MergeDuplicateChunksPlugin.js +30 -30
- package/lib/optimize/MinChunkSizePlugin.js +61 -61
- package/lib/optimize/OccurenceOrderPlugin.js +5 -5
- package/lib/optimize/OccurrenceOrderPlugin.js +91 -91
- package/lib/optimize/RemoveEmptyChunksPlugin.js +19 -19
- package/lib/optimize/RemoveParentModulesPlugin.js +50 -50
- package/lib/optimize/UglifyJsPlugin.js +146 -146
- package/lib/removeAndDo.js +13 -13
- package/lib/web/WebEnvironmentPlugin.js +16 -16
- package/lib/webpack.js +113 -113
- package/lib/webpack.web.js +27 -27
- package/lib/webworker/WebWorkerChunkTemplatePlugin.js +26 -26
- package/lib/webworker/WebWorkerMainTemplatePlugin.js +78 -78
- package/lib/webworker/WebWorkerTemplatePlugin.js +15 -15
- package/package.json +4 -4
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
var DelegatedModule = require("./DelegatedModule");
|
|
6
|
-
|
|
7
|
-
// options.source
|
|
8
|
-
// options.type
|
|
9
|
-
// options.context
|
|
10
|
-
// options.scope
|
|
11
|
-
// options.content
|
|
12
|
-
function DelegatedModuleFactoryPlugin(options) {
|
|
13
|
-
this.options = options;
|
|
14
|
-
options.type = options.type || "require";
|
|
15
|
-
options.extensions = options.extensions || ["", ".js"];
|
|
16
|
-
}
|
|
17
|
-
module.exports = DelegatedModuleFactoryPlugin;
|
|
18
|
-
|
|
19
|
-
DelegatedModuleFactoryPlugin.prototype.apply = function(normalModuleFactory) {
|
|
20
|
-
var scope = this.options.scope;
|
|
21
|
-
if(scope) {
|
|
22
|
-
normalModuleFactory.plugin("factory", function(factory) {
|
|
23
|
-
return function(data, callback) {
|
|
24
|
-
var dependency = data.dependency;
|
|
25
|
-
var request = dependency.request;
|
|
26
|
-
if(request && request.indexOf(scope + "/") === 0) {
|
|
27
|
-
var innerRequest = "." + request.substr(scope.length);
|
|
28
|
-
for(var i = 0; i < this.options.extensions.length; i++) {
|
|
29
|
-
var requestPlusExt = innerRequest + this.options.extensions[i];
|
|
30
|
-
if(requestPlusExt in this.options.content) {
|
|
31
|
-
var resolved = this.options.content[requestPlusExt];
|
|
32
|
-
return callback(null, new DelegatedModule(this.options.source, resolved, this.options.type, requestPlusExt));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return factory(data, callback);
|
|
37
|
-
}.bind(this);
|
|
38
|
-
}.bind(this));
|
|
39
|
-
} else {
|
|
40
|
-
normalModuleFactory.plugin("module", function(module) {
|
|
41
|
-
if(module.libIdent) {
|
|
42
|
-
var request = module.libIdent(this.options);
|
|
43
|
-
if(request && request in this.options.content) {
|
|
44
|
-
var resolved = this.options.content[request];
|
|
45
|
-
return new DelegatedModule(this.options.source, resolved, this.options.type, request);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return module;
|
|
49
|
-
}.bind(this));
|
|
50
|
-
}
|
|
51
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
var DelegatedModule = require("./DelegatedModule");
|
|
6
|
+
|
|
7
|
+
// options.source
|
|
8
|
+
// options.type
|
|
9
|
+
// options.context
|
|
10
|
+
// options.scope
|
|
11
|
+
// options.content
|
|
12
|
+
function DelegatedModuleFactoryPlugin(options) {
|
|
13
|
+
this.options = options;
|
|
14
|
+
options.type = options.type || "require";
|
|
15
|
+
options.extensions = options.extensions || ["", ".js"];
|
|
16
|
+
}
|
|
17
|
+
module.exports = DelegatedModuleFactoryPlugin;
|
|
18
|
+
|
|
19
|
+
DelegatedModuleFactoryPlugin.prototype.apply = function(normalModuleFactory) {
|
|
20
|
+
var scope = this.options.scope;
|
|
21
|
+
if(scope) {
|
|
22
|
+
normalModuleFactory.plugin("factory", function(factory) {
|
|
23
|
+
return function(data, callback) {
|
|
24
|
+
var dependency = data.dependency;
|
|
25
|
+
var request = dependency.request;
|
|
26
|
+
if(request && request.indexOf(scope + "/") === 0) {
|
|
27
|
+
var innerRequest = "." + request.substr(scope.length);
|
|
28
|
+
for(var i = 0; i < this.options.extensions.length; i++) {
|
|
29
|
+
var requestPlusExt = innerRequest + this.options.extensions[i];
|
|
30
|
+
if(requestPlusExt in this.options.content) {
|
|
31
|
+
var resolved = this.options.content[requestPlusExt];
|
|
32
|
+
return callback(null, new DelegatedModule(this.options.source, resolved, this.options.type, requestPlusExt));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return factory(data, callback);
|
|
37
|
+
}.bind(this);
|
|
38
|
+
}.bind(this));
|
|
39
|
+
} else {
|
|
40
|
+
normalModuleFactory.plugin("module", function(module) {
|
|
41
|
+
if(module.libIdent) {
|
|
42
|
+
var request = module.libIdent(this.options);
|
|
43
|
+
if(request && request in this.options.content) {
|
|
44
|
+
var resolved = this.options.content[request];
|
|
45
|
+
return new DelegatedModule(this.options.source, resolved, this.options.type, request);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return module;
|
|
49
|
+
}.bind(this));
|
|
50
|
+
}
|
|
51
|
+
};
|
package/lib/DelegatedPlugin.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
var DelegatedModuleFactoryPlugin = require("./DelegatedModuleFactoryPlugin");
|
|
6
|
-
var DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
|
|
7
|
-
|
|
8
|
-
function DelegatedPlugin(options) {
|
|
9
|
-
this.options = options;
|
|
10
|
-
}
|
|
11
|
-
module.exports = DelegatedPlugin;
|
|
12
|
-
DelegatedPlugin.prototype.apply = function(compiler) {
|
|
13
|
-
compiler.plugin("compilation", function(compilation, params) {
|
|
14
|
-
var normalModuleFactory = params.normalModuleFactory;
|
|
15
|
-
|
|
16
|
-
compilation.dependencyFactories.set(DelegatedSourceDependency, normalModuleFactory);
|
|
17
|
-
});
|
|
18
|
-
compiler.plugin("compile", function(params) {
|
|
19
|
-
params.normalModuleFactory.apply(new DelegatedModuleFactoryPlugin(this.options));
|
|
20
|
-
}.bind(this));
|
|
21
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
var DelegatedModuleFactoryPlugin = require("./DelegatedModuleFactoryPlugin");
|
|
6
|
+
var DelegatedSourceDependency = require("./dependencies/DelegatedSourceDependency");
|
|
7
|
+
|
|
8
|
+
function DelegatedPlugin(options) {
|
|
9
|
+
this.options = options;
|
|
10
|
+
}
|
|
11
|
+
module.exports = DelegatedPlugin;
|
|
12
|
+
DelegatedPlugin.prototype.apply = function(compiler) {
|
|
13
|
+
compiler.plugin("compilation", function(compilation, params) {
|
|
14
|
+
var normalModuleFactory = params.normalModuleFactory;
|
|
15
|
+
|
|
16
|
+
compilation.dependencyFactories.set(DelegatedSourceDependency, normalModuleFactory);
|
|
17
|
+
});
|
|
18
|
+
compiler.plugin("compile", function(params) {
|
|
19
|
+
params.normalModuleFactory.apply(new DelegatedModuleFactoryPlugin(this.options));
|
|
20
|
+
}.bind(this));
|
|
21
|
+
};
|
package/lib/DependenciesBlock.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
var DependenciesBlockVariable = require("./DependenciesBlockVariable");
|
|
6
|
-
|
|
7
|
-
function DependenciesBlock() {
|
|
8
|
-
this.dependencies = [];
|
|
9
|
-
this.blocks = [];
|
|
10
|
-
this.variables = [];
|
|
11
|
-
}
|
|
12
|
-
module.exports = DependenciesBlock;
|
|
13
|
-
|
|
14
|
-
DependenciesBlock.prototype.addBlock = function(block) {
|
|
15
|
-
this.blocks.push(block);
|
|
16
|
-
block.parent = this;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
DependenciesBlock.prototype.addVariable = function(name, expression, dependencies) {
|
|
20
|
-
for(var i = 0; i < this.variables.length; i++) {
|
|
21
|
-
var v = this.variables[i];
|
|
22
|
-
if(v.name === name && v.expression === expression) return;
|
|
23
|
-
}
|
|
24
|
-
this.variables.push(new DependenciesBlockVariable(name, expression, dependencies));
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
DependenciesBlock.prototype.addDependency = function(dependency) {
|
|
28
|
-
this.dependencies.push(dependency);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
DependenciesBlock.prototype.updateHash = function(hash) {
|
|
32
|
-
this.dependencies.forEach(function(d) {
|
|
33
|
-
d.updateHash(hash);
|
|
34
|
-
});
|
|
35
|
-
this.blocks.forEach(function(b) {
|
|
36
|
-
b.updateHash(hash);
|
|
37
|
-
});
|
|
38
|
-
this.variables.forEach(function(v) {
|
|
39
|
-
v.updateHash(hash);
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
DependenciesBlock.prototype.disconnect = function() {
|
|
44
|
-
function disconnect(i) {
|
|
45
|
-
i.disconnect();
|
|
46
|
-
}
|
|
47
|
-
this.dependencies.forEach(disconnect);
|
|
48
|
-
this.blocks.forEach(disconnect);
|
|
49
|
-
this.variables.forEach(disconnect);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
DependenciesBlock.prototype.hasDependencies = function() {
|
|
53
|
-
return this.dependencies.length > 0 ||
|
|
54
|
-
this.blocks.concat(this.variables).some(function(item) {
|
|
55
|
-
return item.hasDependencies();
|
|
56
|
-
});
|
|
57
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
var DependenciesBlockVariable = require("./DependenciesBlockVariable");
|
|
6
|
+
|
|
7
|
+
function DependenciesBlock() {
|
|
8
|
+
this.dependencies = [];
|
|
9
|
+
this.blocks = [];
|
|
10
|
+
this.variables = [];
|
|
11
|
+
}
|
|
12
|
+
module.exports = DependenciesBlock;
|
|
13
|
+
|
|
14
|
+
DependenciesBlock.prototype.addBlock = function(block) {
|
|
15
|
+
this.blocks.push(block);
|
|
16
|
+
block.parent = this;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
DependenciesBlock.prototype.addVariable = function(name, expression, dependencies) {
|
|
20
|
+
for(var i = 0; i < this.variables.length; i++) {
|
|
21
|
+
var v = this.variables[i];
|
|
22
|
+
if(v.name === name && v.expression === expression) return;
|
|
23
|
+
}
|
|
24
|
+
this.variables.push(new DependenciesBlockVariable(name, expression, dependencies));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
DependenciesBlock.prototype.addDependency = function(dependency) {
|
|
28
|
+
this.dependencies.push(dependency);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
DependenciesBlock.prototype.updateHash = function(hash) {
|
|
32
|
+
this.dependencies.forEach(function(d) {
|
|
33
|
+
d.updateHash(hash);
|
|
34
|
+
});
|
|
35
|
+
this.blocks.forEach(function(b) {
|
|
36
|
+
b.updateHash(hash);
|
|
37
|
+
});
|
|
38
|
+
this.variables.forEach(function(v) {
|
|
39
|
+
v.updateHash(hash);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
DependenciesBlock.prototype.disconnect = function() {
|
|
44
|
+
function disconnect(i) {
|
|
45
|
+
i.disconnect();
|
|
46
|
+
}
|
|
47
|
+
this.dependencies.forEach(disconnect);
|
|
48
|
+
this.blocks.forEach(disconnect);
|
|
49
|
+
this.variables.forEach(disconnect);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
DependenciesBlock.prototype.hasDependencies = function() {
|
|
53
|
+
return this.dependencies.length > 0 ||
|
|
54
|
+
this.blocks.concat(this.variables).some(function(item) {
|
|
55
|
+
return item.hasDependencies();
|
|
56
|
+
});
|
|
57
|
+
};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
var ReplaceSource = require("webpack-core/lib/ReplaceSource");
|
|
6
|
-
var RawSource = require("webpack-core/lib/RawSource");
|
|
7
|
-
|
|
8
|
-
function DependenciesBlockVariable(name, expression, dependencies) {
|
|
9
|
-
this.name = name;
|
|
10
|
-
this.expression = expression;
|
|
11
|
-
this.dependencies = dependencies || [];
|
|
12
|
-
}
|
|
13
|
-
module.exports = DependenciesBlockVariable;
|
|
14
|
-
|
|
15
|
-
DependenciesBlockVariable.prototype.updateHash = function(hash) {
|
|
16
|
-
hash.update(this.name);
|
|
17
|
-
hash.update(this.expression);
|
|
18
|
-
this.dependencies.forEach(function(d) {
|
|
19
|
-
d.updateHash(hash);
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
DependenciesBlockVariable.prototype.expressionSource = function(dependencyTemplates, outputOptions, requestShortener) {
|
|
24
|
-
var source = new ReplaceSource(new RawSource(this.expression));
|
|
25
|
-
this.dependencies.forEach(function(dep) {
|
|
26
|
-
var template = dependencyTemplates.get(dep.constructor);
|
|
27
|
-
if(!template) throw new Error("No template for dependency: " + dep.constructor.name);
|
|
28
|
-
template.apply(dep, source, outputOptions, requestShortener, dependencyTemplates);
|
|
29
|
-
});
|
|
30
|
-
return source;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
DependenciesBlockVariable.prototype.disconnect = function() {
|
|
34
|
-
this.dependencies.forEach(function(d) {
|
|
35
|
-
d.disconnect();
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
DependenciesBlockVariable.prototype.hasDependencies = function() {
|
|
40
|
-
return this.dependencies.length > 0;
|
|
41
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
var ReplaceSource = require("webpack-core/lib/ReplaceSource");
|
|
6
|
+
var RawSource = require("webpack-core/lib/RawSource");
|
|
7
|
+
|
|
8
|
+
function DependenciesBlockVariable(name, expression, dependencies) {
|
|
9
|
+
this.name = name;
|
|
10
|
+
this.expression = expression;
|
|
11
|
+
this.dependencies = dependencies || [];
|
|
12
|
+
}
|
|
13
|
+
module.exports = DependenciesBlockVariable;
|
|
14
|
+
|
|
15
|
+
DependenciesBlockVariable.prototype.updateHash = function(hash) {
|
|
16
|
+
hash.update(this.name);
|
|
17
|
+
hash.update(this.expression);
|
|
18
|
+
this.dependencies.forEach(function(d) {
|
|
19
|
+
d.updateHash(hash);
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
DependenciesBlockVariable.prototype.expressionSource = function(dependencyTemplates, outputOptions, requestShortener) {
|
|
24
|
+
var source = new ReplaceSource(new RawSource(this.expression));
|
|
25
|
+
this.dependencies.forEach(function(dep) {
|
|
26
|
+
var template = dependencyTemplates.get(dep.constructor);
|
|
27
|
+
if(!template) throw new Error("No template for dependency: " + dep.constructor.name);
|
|
28
|
+
template.apply(dep, source, outputOptions, requestShortener, dependencyTemplates);
|
|
29
|
+
});
|
|
30
|
+
return source;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
DependenciesBlockVariable.prototype.disconnect = function() {
|
|
34
|
+
this.dependencies.forEach(function(d) {
|
|
35
|
+
d.disconnect();
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
DependenciesBlockVariable.prototype.hasDependencies = function() {
|
|
40
|
+
return this.dependencies.length > 0;
|
|
41
|
+
};
|
package/lib/Dependency.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
function Dependency() {
|
|
6
|
-
this.module = null;
|
|
7
|
-
}
|
|
8
|
-
module.exports = Dependency;
|
|
9
|
-
|
|
10
|
-
Dependency.prototype.isEqualResource = function( /* other */ ) {
|
|
11
|
-
return false;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
Dependency.prototype.updateHash = function(hash) {
|
|
15
|
-
hash.update((this.module && this.module.id) + "");
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
Dependency.prototype.disconnect = function() {
|
|
19
|
-
this.module = null;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
Dependency.compare = function(a, b) {
|
|
23
|
-
return Dependency.compareLocations(a.loc, b.loc);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
Dependency.compareLocations = function(a, b) {
|
|
27
|
-
if(typeof a === "string") {
|
|
28
|
-
if(typeof b === "string") {
|
|
29
|
-
if(a < b) return -1;
|
|
30
|
-
if(a > b) return 1;
|
|
31
|
-
return 0;
|
|
32
|
-
} else if(typeof b === "object") {
|
|
33
|
-
return 1;
|
|
34
|
-
} else {
|
|
35
|
-
return 0;
|
|
36
|
-
}
|
|
37
|
-
} else if(typeof a === "object") {
|
|
38
|
-
if(typeof b === "string") {
|
|
39
|
-
return -1;
|
|
40
|
-
} else if(typeof b === "object") {
|
|
41
|
-
if(a.start) a = a.start;
|
|
42
|
-
if(b.start) b = b.start;
|
|
43
|
-
if(a.line < b.line) return -1;
|
|
44
|
-
if(a.line > b.line) return 1;
|
|
45
|
-
if(a.column < b.column) return -1;
|
|
46
|
-
if(a.column > b.column) return 1;
|
|
47
|
-
if(a.index < b.index) return -1;
|
|
48
|
-
if(a.index > b.index) return 1;
|
|
49
|
-
return 0;
|
|
50
|
-
} else {
|
|
51
|
-
return 0;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
function Dependency() {
|
|
6
|
+
this.module = null;
|
|
7
|
+
}
|
|
8
|
+
module.exports = Dependency;
|
|
9
|
+
|
|
10
|
+
Dependency.prototype.isEqualResource = function( /* other */ ) {
|
|
11
|
+
return false;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
Dependency.prototype.updateHash = function(hash) {
|
|
15
|
+
hash.update((this.module && this.module.id) + "");
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
Dependency.prototype.disconnect = function() {
|
|
19
|
+
this.module = null;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
Dependency.compare = function(a, b) {
|
|
23
|
+
return Dependency.compareLocations(a.loc, b.loc);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
Dependency.compareLocations = function(a, b) {
|
|
27
|
+
if(typeof a === "string") {
|
|
28
|
+
if(typeof b === "string") {
|
|
29
|
+
if(a < b) return -1;
|
|
30
|
+
if(a > b) return 1;
|
|
31
|
+
return 0;
|
|
32
|
+
} else if(typeof b === "object") {
|
|
33
|
+
return 1;
|
|
34
|
+
} else {
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
} else if(typeof a === "object") {
|
|
38
|
+
if(typeof b === "string") {
|
|
39
|
+
return -1;
|
|
40
|
+
} else if(typeof b === "object") {
|
|
41
|
+
if(a.start) a = a.start;
|
|
42
|
+
if(b.start) b = b.start;
|
|
43
|
+
if(a.line < b.line) return -1;
|
|
44
|
+
if(a.line > b.line) return 1;
|
|
45
|
+
if(a.column < b.column) return -1;
|
|
46
|
+
if(a.column > b.column) return 1;
|
|
47
|
+
if(a.index < b.index) return -1;
|
|
48
|
+
if(a.index > b.index) return 1;
|
|
49
|
+
return 0;
|
|
50
|
+
} else {
|
|
51
|
+
return 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
package/lib/DllEntryPlugin.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
var DllEntryDependency = require("./dependencies/DllEntryDependency");
|
|
6
|
-
var SingleEntryDependency = require("./dependencies/SingleEntryDependency");
|
|
7
|
-
var DllModuleFactory = require("./DllModuleFactory");
|
|
8
|
-
|
|
9
|
-
function DllEntryPlugin(context, entries, name, type) {
|
|
10
|
-
this.context = context;
|
|
11
|
-
this.entries = entries;
|
|
12
|
-
this.name = name;
|
|
13
|
-
this.type = type;
|
|
14
|
-
}
|
|
15
|
-
module.exports = DllEntryPlugin;
|
|
16
|
-
DllEntryPlugin.prototype.apply = function(compiler) {
|
|
17
|
-
compiler.plugin("compilation", function(compilation, params) {
|
|
18
|
-
var dllModuleFactory = new DllModuleFactory();
|
|
19
|
-
var normalModuleFactory = params.normalModuleFactory;
|
|
20
|
-
|
|
21
|
-
compilation.dependencyFactories.set(DllEntryDependency, dllModuleFactory);
|
|
22
|
-
|
|
23
|
-
compilation.dependencyFactories.set(SingleEntryDependency, normalModuleFactory);
|
|
24
|
-
});
|
|
25
|
-
compiler.plugin("make", function(compilation, callback) {
|
|
26
|
-
compilation.addEntry(this.context, new DllEntryDependency(this.entries.map(function(e, idx) {
|
|
27
|
-
var dep = new SingleEntryDependency(e);
|
|
28
|
-
dep.loc = this.name + ":" + idx;
|
|
29
|
-
return dep;
|
|
30
|
-
}, this), this.name, this.type), this.name, callback);
|
|
31
|
-
}.bind(this));
|
|
32
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
var DllEntryDependency = require("./dependencies/DllEntryDependency");
|
|
6
|
+
var SingleEntryDependency = require("./dependencies/SingleEntryDependency");
|
|
7
|
+
var DllModuleFactory = require("./DllModuleFactory");
|
|
8
|
+
|
|
9
|
+
function DllEntryPlugin(context, entries, name, type) {
|
|
10
|
+
this.context = context;
|
|
11
|
+
this.entries = entries;
|
|
12
|
+
this.name = name;
|
|
13
|
+
this.type = type;
|
|
14
|
+
}
|
|
15
|
+
module.exports = DllEntryPlugin;
|
|
16
|
+
DllEntryPlugin.prototype.apply = function(compiler) {
|
|
17
|
+
compiler.plugin("compilation", function(compilation, params) {
|
|
18
|
+
var dllModuleFactory = new DllModuleFactory();
|
|
19
|
+
var normalModuleFactory = params.normalModuleFactory;
|
|
20
|
+
|
|
21
|
+
compilation.dependencyFactories.set(DllEntryDependency, dllModuleFactory);
|
|
22
|
+
|
|
23
|
+
compilation.dependencyFactories.set(SingleEntryDependency, normalModuleFactory);
|
|
24
|
+
});
|
|
25
|
+
compiler.plugin("make", function(compilation, callback) {
|
|
26
|
+
compilation.addEntry(this.context, new DllEntryDependency(this.entries.map(function(e, idx) {
|
|
27
|
+
var dep = new SingleEntryDependency(e);
|
|
28
|
+
dep.loc = this.name + ":" + idx;
|
|
29
|
+
return dep;
|
|
30
|
+
}, this), this.name, this.type), this.name, callback);
|
|
31
|
+
}.bind(this));
|
|
32
|
+
};
|
package/lib/DllModule.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
var Module = require("./Module");
|
|
6
|
-
var RawSource = require("webpack-core/lib/RawSource");
|
|
7
|
-
|
|
8
|
-
function DllModule(context, dependencies, name, type) {
|
|
9
|
-
Module.call(this);
|
|
10
|
-
this.context = context;
|
|
11
|
-
this.dependencies = dependencies;
|
|
12
|
-
this.name = name;
|
|
13
|
-
this.built = false;
|
|
14
|
-
this.cacheable = true;
|
|
15
|
-
this.type = type;
|
|
16
|
-
}
|
|
17
|
-
module.exports = DllModule;
|
|
18
|
-
|
|
19
|
-
DllModule.prototype = Object.create(Module.prototype);
|
|
20
|
-
|
|
21
|
-
DllModule.prototype.identifier = function() {
|
|
22
|
-
return "dll " + this.name;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
DllModule.prototype.readableIdentifier = function() {
|
|
26
|
-
return "dll " + this.name;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
DllModule.prototype.disconnect = function disconnect() {
|
|
30
|
-
this.built = false;
|
|
31
|
-
Module.prototype.disconnect.call(this);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
DllModule.prototype.build = function build(options, compilation, resolver, fs, callback) {
|
|
35
|
-
this.built = true;
|
|
36
|
-
return callback();
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
DllModule.prototype.source = function() {
|
|
40
|
-
return new RawSource("module.exports = __webpack_require__;");
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
DllModule.prototype.needRebuild = function needRebuild() {
|
|
44
|
-
return false;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
DllModule.prototype.size = function() {
|
|
48
|
-
return 12;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
DllModule.prototype.updateHash = function(hash) {
|
|
52
|
-
hash.update("dll module");
|
|
53
|
-
hash.update(this.name || "");
|
|
54
|
-
Module.prototype.updateHash.call(this, hash);
|
|
55
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
var Module = require("./Module");
|
|
6
|
+
var RawSource = require("webpack-core/lib/RawSource");
|
|
7
|
+
|
|
8
|
+
function DllModule(context, dependencies, name, type) {
|
|
9
|
+
Module.call(this);
|
|
10
|
+
this.context = context;
|
|
11
|
+
this.dependencies = dependencies;
|
|
12
|
+
this.name = name;
|
|
13
|
+
this.built = false;
|
|
14
|
+
this.cacheable = true;
|
|
15
|
+
this.type = type;
|
|
16
|
+
}
|
|
17
|
+
module.exports = DllModule;
|
|
18
|
+
|
|
19
|
+
DllModule.prototype = Object.create(Module.prototype);
|
|
20
|
+
|
|
21
|
+
DllModule.prototype.identifier = function() {
|
|
22
|
+
return "dll " + this.name;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
DllModule.prototype.readableIdentifier = function() {
|
|
26
|
+
return "dll " + this.name;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
DllModule.prototype.disconnect = function disconnect() {
|
|
30
|
+
this.built = false;
|
|
31
|
+
Module.prototype.disconnect.call(this);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
DllModule.prototype.build = function build(options, compilation, resolver, fs, callback) {
|
|
35
|
+
this.built = true;
|
|
36
|
+
return callback();
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
DllModule.prototype.source = function() {
|
|
40
|
+
return new RawSource("module.exports = __webpack_require__;");
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
DllModule.prototype.needRebuild = function needRebuild() {
|
|
44
|
+
return false;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
DllModule.prototype.size = function() {
|
|
48
|
+
return 12;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
DllModule.prototype.updateHash = function(hash) {
|
|
52
|
+
hash.update("dll module");
|
|
53
|
+
hash.update(this.name || "");
|
|
54
|
+
Module.prototype.updateHash.call(this, hash);
|
|
55
|
+
};
|
package/lib/DllModuleFactory.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
var Tapable = require("tapable");
|
|
6
|
-
var DllModule = require("./DllModule");
|
|
7
|
-
|
|
8
|
-
function DllModuleFactory() {
|
|
9
|
-
Tapable.call(this);
|
|
10
|
-
}
|
|
11
|
-
module.exports = DllModuleFactory;
|
|
12
|
-
|
|
13
|
-
DllModuleFactory.prototype = Object.create(Tapable.prototype);
|
|
14
|
-
DllModuleFactory.prototype.constructor = DllModuleFactory;
|
|
15
|
-
|
|
16
|
-
DllModuleFactory.prototype.create = function(context, dependency, callback) {
|
|
17
|
-
callback(null, new DllModule(context, dependency.dependencies, dependency.name, dependency.type));
|
|
18
|
-
};
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
var Tapable = require("tapable");
|
|
6
|
+
var DllModule = require("./DllModule");
|
|
7
|
+
|
|
8
|
+
function DllModuleFactory() {
|
|
9
|
+
Tapable.call(this);
|
|
10
|
+
}
|
|
11
|
+
module.exports = DllModuleFactory;
|
|
12
|
+
|
|
13
|
+
DllModuleFactory.prototype = Object.create(Tapable.prototype);
|
|
14
|
+
DllModuleFactory.prototype.constructor = DllModuleFactory;
|
|
15
|
+
|
|
16
|
+
DllModuleFactory.prototype.create = function(context, dependency, callback) {
|
|
17
|
+
callback(null, new DllModule(context, dependency.dependencies, dependency.name, dependency.type));
|
|
18
|
+
};
|