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,28 +1,28 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
var ConcatSource = require("webpack-core/lib/ConcatSource");
|
6
|
-
|
7
|
-
function JsonpExportMainTemplatePlugin(name) {
|
8
|
-
this.name = name;
|
9
|
-
}
|
10
|
-
module.exports = JsonpExportMainTemplatePlugin;
|
11
|
-
JsonpExportMainTemplatePlugin.prototype.apply = function(compilation) {
|
12
|
-
var mainTemplate = compilation.mainTemplate;
|
13
|
-
compilation.templatesPlugin("render-with-entry", function(source, chunk, hash) {
|
14
|
-
var name = mainTemplate.applyPluginsWaterfall("asset-path", this.name || "", {
|
15
|
-
hash: hash,
|
16
|
-
chunk: chunk
|
17
|
-
});
|
18
|
-
return new ConcatSource(name + "(", source, ");");
|
19
|
-
}.bind(this));
|
20
|
-
mainTemplate.plugin("global-hash-paths", function(paths) {
|
21
|
-
if(this.name) paths.push(this.name);
|
22
|
-
return paths;
|
23
|
-
}.bind(this));
|
24
|
-
mainTemplate.plugin("hash", function(hash) {
|
25
|
-
hash.update("jsonp export");
|
26
|
-
hash.update(this.name + "");
|
27
|
-
}.bind(this));
|
28
|
-
};
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
var ConcatSource = require("webpack-core/lib/ConcatSource");
|
6
|
+
|
7
|
+
function JsonpExportMainTemplatePlugin(name) {
|
8
|
+
this.name = name;
|
9
|
+
}
|
10
|
+
module.exports = JsonpExportMainTemplatePlugin;
|
11
|
+
JsonpExportMainTemplatePlugin.prototype.apply = function(compilation) {
|
12
|
+
var mainTemplate = compilation.mainTemplate;
|
13
|
+
compilation.templatesPlugin("render-with-entry", function(source, chunk, hash) {
|
14
|
+
var name = mainTemplate.applyPluginsWaterfall("asset-path", this.name || "", {
|
15
|
+
hash: hash,
|
16
|
+
chunk: chunk
|
17
|
+
});
|
18
|
+
return new ConcatSource(name + "(", source, ");");
|
19
|
+
}.bind(this));
|
20
|
+
mainTemplate.plugin("global-hash-paths", function(paths) {
|
21
|
+
if(this.name) paths.push(this.name);
|
22
|
+
return paths;
|
23
|
+
}.bind(this));
|
24
|
+
mainTemplate.plugin("hash", function(hash) {
|
25
|
+
hash.update("jsonp export");
|
26
|
+
hash.update(this.name + "");
|
27
|
+
}.bind(this));
|
28
|
+
};
|
@@ -1,26 +1,26 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
var ConcatSource = require("webpack-core/lib/ConcatSource");
|
6
|
-
var Template = require("./Template");
|
7
|
-
|
8
|
-
function JsonpHotUpdateChunkTemplatePlugin() {}
|
9
|
-
module.exports = JsonpHotUpdateChunkTemplatePlugin;
|
10
|
-
|
11
|
-
JsonpHotUpdateChunkTemplatePlugin.prototype.apply = function(hotUpdateChunkTemplate) {
|
12
|
-
hotUpdateChunkTemplate.plugin("render", function(modulesSource, modules, hash, id) {
|
13
|
-
var jsonpFunction = this.outputOptions.hotUpdateFunction || Template.toIdentifier("webpackHotUpdate" + (this.outputOptions.library || ""));
|
14
|
-
var source = new ConcatSource();
|
15
|
-
source.add(jsonpFunction + "(" + JSON.stringify(id) + ",");
|
16
|
-
source.add(modulesSource);
|
17
|
-
source.add(")");
|
18
|
-
return source;
|
19
|
-
});
|
20
|
-
hotUpdateChunkTemplate.plugin("hash", function(hash) {
|
21
|
-
hash.update("JsonpHotUpdateChunkTemplatePlugin");
|
22
|
-
hash.update("3");
|
23
|
-
hash.update(this.outputOptions.hotUpdateFunction + "");
|
24
|
-
hash.update(this.outputOptions.library + "");
|
25
|
-
});
|
26
|
-
};
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
var ConcatSource = require("webpack-core/lib/ConcatSource");
|
6
|
+
var Template = require("./Template");
|
7
|
+
|
8
|
+
function JsonpHotUpdateChunkTemplatePlugin() {}
|
9
|
+
module.exports = JsonpHotUpdateChunkTemplatePlugin;
|
10
|
+
|
11
|
+
JsonpHotUpdateChunkTemplatePlugin.prototype.apply = function(hotUpdateChunkTemplate) {
|
12
|
+
hotUpdateChunkTemplate.plugin("render", function(modulesSource, modules, hash, id) {
|
13
|
+
var jsonpFunction = this.outputOptions.hotUpdateFunction || Template.toIdentifier("webpackHotUpdate" + (this.outputOptions.library || ""));
|
14
|
+
var source = new ConcatSource();
|
15
|
+
source.add(jsonpFunction + "(" + JSON.stringify(id) + ",");
|
16
|
+
source.add(modulesSource);
|
17
|
+
source.add(")");
|
18
|
+
return source;
|
19
|
+
});
|
20
|
+
hotUpdateChunkTemplate.plugin("hash", function(hash) {
|
21
|
+
hash.update("JsonpHotUpdateChunkTemplatePlugin");
|
22
|
+
hash.update("3");
|
23
|
+
hash.update(this.outputOptions.hotUpdateFunction + "");
|
24
|
+
hash.update(this.outputOptions.library + "");
|
25
|
+
});
|
26
|
+
};
|
@@ -1,56 +1,56 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
/*globals hotAddUpdateChunk parentHotUpdateCallback document XMLHttpRequest $require$ $hotChunkFilename$ $hotMainFilename$ */
|
6
|
-
module.exports = function() {
|
7
|
-
function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars
|
8
|
-
hotAddUpdateChunk(chunkId, moreModules);
|
9
|
-
if(parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
|
10
|
-
}
|
11
|
-
|
12
|
-
function hotDownloadUpdateChunk(chunkId) { // eslint-disable-line no-unused-vars
|
13
|
-
var head = document.getElementsByTagName("head")[0];
|
14
|
-
var script = document.createElement("script");
|
15
|
-
script.type = "text/javascript";
|
16
|
-
script.charset = "utf-8";
|
17
|
-
script.src = $require$.p + $hotChunkFilename$;
|
18
|
-
head.appendChild(script);
|
19
|
-
}
|
20
|
-
|
21
|
-
function hotDownloadManifest(callback) { // eslint-disable-line no-unused-vars
|
22
|
-
if(typeof XMLHttpRequest === "undefined")
|
23
|
-
return callback(new Error("No browser support"));
|
24
|
-
try {
|
25
|
-
var request = new XMLHttpRequest();
|
26
|
-
var requestPath = $require$.p + $hotMainFilename$;
|
27
|
-
request.open("GET", requestPath, true);
|
28
|
-
request.timeout = 10000;
|
29
|
-
request.send(null);
|
30
|
-
} catch(err) {
|
31
|
-
return callback(err);
|
32
|
-
}
|
33
|
-
request.onreadystatechange = function() {
|
34
|
-
if(request.readyState !== 4) return;
|
35
|
-
if(request.status === 0) {
|
36
|
-
// timeout
|
37
|
-
callback(new Error("Manifest request to " + requestPath + " timed out."));
|
38
|
-
} else if(request.status === 404) {
|
39
|
-
// no update available
|
40
|
-
callback();
|
41
|
-
} else if(request.status !== 200 && request.status !== 304) {
|
42
|
-
// other failure
|
43
|
-
callback(new Error("Manifest request to " + requestPath + " failed."));
|
44
|
-
} else {
|
45
|
-
// success
|
46
|
-
try {
|
47
|
-
var update = JSON.parse(request.responseText);
|
48
|
-
} catch(e) {
|
49
|
-
callback(e);
|
50
|
-
return;
|
51
|
-
}
|
52
|
-
callback(null, update);
|
53
|
-
}
|
54
|
-
};
|
55
|
-
}
|
56
|
-
};
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
/*globals hotAddUpdateChunk parentHotUpdateCallback document XMLHttpRequest $require$ $hotChunkFilename$ $hotMainFilename$ */
|
6
|
+
module.exports = function() {
|
7
|
+
function webpackHotUpdateCallback(chunkId, moreModules) { // eslint-disable-line no-unused-vars
|
8
|
+
hotAddUpdateChunk(chunkId, moreModules);
|
9
|
+
if(parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
|
10
|
+
}
|
11
|
+
|
12
|
+
function hotDownloadUpdateChunk(chunkId) { // eslint-disable-line no-unused-vars
|
13
|
+
var head = document.getElementsByTagName("head")[0];
|
14
|
+
var script = document.createElement("script");
|
15
|
+
script.type = "text/javascript";
|
16
|
+
script.charset = "utf-8";
|
17
|
+
script.src = $require$.p + $hotChunkFilename$;
|
18
|
+
head.appendChild(script);
|
19
|
+
}
|
20
|
+
|
21
|
+
function hotDownloadManifest(callback) { // eslint-disable-line no-unused-vars
|
22
|
+
if(typeof XMLHttpRequest === "undefined")
|
23
|
+
return callback(new Error("No browser support"));
|
24
|
+
try {
|
25
|
+
var request = new XMLHttpRequest();
|
26
|
+
var requestPath = $require$.p + $hotMainFilename$;
|
27
|
+
request.open("GET", requestPath, true);
|
28
|
+
request.timeout = 10000;
|
29
|
+
request.send(null);
|
30
|
+
} catch(err) {
|
31
|
+
return callback(err);
|
32
|
+
}
|
33
|
+
request.onreadystatechange = function() {
|
34
|
+
if(request.readyState !== 4) return;
|
35
|
+
if(request.status === 0) {
|
36
|
+
// timeout
|
37
|
+
callback(new Error("Manifest request to " + requestPath + " timed out."));
|
38
|
+
} else if(request.status === 404) {
|
39
|
+
// no update available
|
40
|
+
callback();
|
41
|
+
} else if(request.status !== 200 && request.status !== 304) {
|
42
|
+
// other failure
|
43
|
+
callback(new Error("Manifest request to " + requestPath + " failed."));
|
44
|
+
} else {
|
45
|
+
// success
|
46
|
+
try {
|
47
|
+
var update = JSON.parse(request.responseText);
|
48
|
+
} catch(e) {
|
49
|
+
callback(e);
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
callback(null, update);
|
53
|
+
}
|
54
|
+
};
|
55
|
+
}
|
56
|
+
};
|
@@ -1,162 +1,162 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
var Template = require("./Template");
|
6
|
-
|
7
|
-
function JsonpMainTemplatePlugin() {}
|
8
|
-
module.exports = JsonpMainTemplatePlugin;
|
9
|
-
|
10
|
-
JsonpMainTemplatePlugin.prototype.constructor = JsonpMainTemplatePlugin;
|
11
|
-
JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
|
12
|
-
mainTemplate.plugin("local-vars", function(source, chunk) {
|
13
|
-
if(chunk.chunks.length > 0) {
|
14
|
-
return this.asString([
|
15
|
-
source,
|
16
|
-
"",
|
17
|
-
"// object to store loaded and loading chunks",
|
18
|
-
"// \"0\" means \"already loaded\"",
|
19
|
-
"// Array means \"loading\", array contains callbacks",
|
20
|
-
"var installedChunks = {",
|
21
|
-
this.indent(
|
22
|
-
chunk.ids.map(function(id) {
|
23
|
-
return id + ":0";
|
24
|
-
}).join(",\n")
|
25
|
-
),
|
26
|
-
"};"
|
27
|
-
]);
|
28
|
-
}
|
29
|
-
return source;
|
30
|
-
});
|
31
|
-
mainTemplate.plugin("jsonp-script", function(_, chunk, hash) {
|
32
|
-
var filename = this.outputOptions.filename || "bundle.js";
|
33
|
-
var chunkFilename = this.outputOptions.chunkFilename || "[id]." + filename;
|
34
|
-
var chunkMaps = chunk.getChunkMaps();
|
35
|
-
var crossOriginLoading = this.outputOptions.crossOriginLoading;
|
36
|
-
return this.asString([
|
37
|
-
"var script = document.createElement('script');",
|
38
|
-
"script.type = 'text/javascript';",
|
39
|
-
"script.charset = 'utf-8';",
|
40
|
-
"script.async = true;",
|
41
|
-
crossOriginLoading ? "script.crossOrigin = '" + crossOriginLoading + "';" : "",
|
42
|
-
"script.src = " + this.requireFn + ".p + " +
|
43
|
-
this.applyPluginsWaterfall("asset-path", JSON.stringify(chunkFilename), {
|
44
|
-
hash: "\" + " + this.renderCurrentHashCode(hash) + " + \"",
|
45
|
-
hashWithLength: function(length) {
|
46
|
-
return "\" + " + this.renderCurrentHashCode(hash, length) + " + \"";
|
47
|
-
}.bind(this),
|
48
|
-
chunk: {
|
49
|
-
id: "\" + chunkId + \"",
|
50
|
-
hash: "\" + " + JSON.stringify(chunkMaps.hash) + "[chunkId] + \"",
|
51
|
-
hashWithLength: function(length) {
|
52
|
-
var shortChunkHashMap = {};
|
53
|
-
Object.keys(chunkMaps.hash).forEach(function(chunkId) {
|
54
|
-
if(typeof chunkMaps.hash[chunkId] === "string")
|
55
|
-
shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr(0, length);
|
56
|
-
});
|
57
|
-
return "\" + " + JSON.stringify(shortChunkHashMap) + "[chunkId] + \"";
|
58
|
-
},
|
59
|
-
name: "\" + (" + JSON.stringify(chunkMaps.name) + "[chunkId]||chunkId) + \""
|
60
|
-
}
|
61
|
-
}) + ";"
|
62
|
-
]);
|
63
|
-
});
|
64
|
-
mainTemplate.plugin("require-ensure", function(_, chunk, hash) {
|
65
|
-
var filename = this.outputOptions.filename || "bundle.js";
|
66
|
-
var chunkFilename = this.outputOptions.chunkFilename || "[id]." + filename;
|
67
|
-
return this.asString([
|
68
|
-
"// \"0\" is the signal for \"already loaded\"",
|
69
|
-
"if(installedChunks[chunkId] === 0)",
|
70
|
-
this.indent("return callback.call(null, " + this.requireFn + ");"),
|
71
|
-
"",
|
72
|
-
"// an array means \"currently loading\".",
|
73
|
-
"if(installedChunks[chunkId] !== undefined) {",
|
74
|
-
this.indent("installedChunks[chunkId].push(callback);"),
|
75
|
-
"} else {",
|
76
|
-
this.indent([
|
77
|
-
"// start chunk loading",
|
78
|
-
"installedChunks[chunkId] = [callback];",
|
79
|
-
"var head = document.getElementsByTagName('head')[0];",
|
80
|
-
this.applyPluginsWaterfall("jsonp-script", "", chunk, hash),
|
81
|
-
"head.appendChild(script);"
|
82
|
-
]),
|
83
|
-
"}"
|
84
|
-
]);
|
85
|
-
});
|
86
|
-
mainTemplate.plugin("bootstrap", function(source, chunk, hash) {
|
87
|
-
if(chunk.chunks.length > 0) {
|
88
|
-
var jsonpFunction = this.outputOptions.jsonpFunction || Template.toIdentifier("webpackJsonp" + (this.outputOptions.library || ""));
|
89
|
-
return this.asString([
|
90
|
-
source,
|
91
|
-
"",
|
92
|
-
"// install a JSONP callback for chunk loading",
|
93
|
-
"var parentJsonpFunction = window[" + JSON.stringify(jsonpFunction) + "];",
|
94
|
-
"window[" + JSON.stringify(jsonpFunction) + "] = function webpackJsonpCallback(chunkIds, moreModules) {",
|
95
|
-
this.indent([
|
96
|
-
"// add \"moreModules\" to the modules object,",
|
97
|
-
"// then flag all \"chunkIds\" as loaded and fire callback",
|
98
|
-
"var moduleId, chunkId, i = 0, callbacks = [];",
|
99
|
-
"for(;i < chunkIds.length; i++) {",
|
100
|
-
this.indent([
|
101
|
-
"chunkId = chunkIds[i];",
|
102
|
-
"if(installedChunks[chunkId])",
|
103
|
-
this.indent("callbacks.push.apply(callbacks, installedChunks[chunkId]);"),
|
104
|
-
"installedChunks[chunkId] = 0;"
|
105
|
-
]),
|
106
|
-
"}",
|
107
|
-
"for(moduleId in moreModules) {",
|
108
|
-
this.indent(this.renderAddModule(hash, chunk, "moduleId", "moreModules[moduleId]")),
|
109
|
-
"}",
|
110
|
-
"if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);",
|
111
|
-
"while(callbacks.length)",
|
112
|
-
this.indent("callbacks.shift().call(null, " + this.requireFn + ");"), (this.entryPointInChildren(chunk) ? [
|
113
|
-
"if(moreModules[0]) {",
|
114
|
-
this.indent([
|
115
|
-
"installedModules[0] = 0;",
|
116
|
-
"return " + this.requireFn + "(0);"
|
117
|
-
]),
|
118
|
-
"}"
|
119
|
-
] : "")
|
120
|
-
]),
|
121
|
-
"};"
|
122
|
-
]);
|
123
|
-
}
|
124
|
-
return source;
|
125
|
-
});
|
126
|
-
mainTemplate.plugin("hot-bootstrap", function(source, chunk, hash) {
|
127
|
-
var hotUpdateChunkFilename = this.outputOptions.hotUpdateChunkFilename;
|
128
|
-
var hotUpdateMainFilename = this.outputOptions.hotUpdateMainFilename;
|
129
|
-
var hotUpdateFunction = this.outputOptions.hotUpdateFunction || Template.toIdentifier("webpackHotUpdate" + (this.outputOptions.library || ""));
|
130
|
-
var currentHotUpdateChunkFilename = this.applyPluginsWaterfall("asset-path", JSON.stringify(hotUpdateChunkFilename), {
|
131
|
-
hash: "\" + " + this.renderCurrentHashCode(hash) + " + \"",
|
132
|
-
hashWithLength: function(length) {
|
133
|
-
return "\" + " + this.renderCurrentHashCode(hash, length) + " + \"";
|
134
|
-
}.bind(this),
|
135
|
-
chunk: {
|
136
|
-
id: "\" + chunkId + \""
|
137
|
-
}
|
138
|
-
});
|
139
|
-
var currentHotUpdateMainFilename = this.applyPluginsWaterfall("asset-path", JSON.stringify(hotUpdateMainFilename), {
|
140
|
-
hash: "\" + " + this.renderCurrentHashCode(hash) + " + \"",
|
141
|
-
hashWithLength: function(length) {
|
142
|
-
return "\" + " + this.renderCurrentHashCode(hash, length) + " + \"";
|
143
|
-
}.bind(this)
|
144
|
-
});
|
145
|
-
|
146
|
-
return source + "\n" +
|
147
|
-
"var parentHotUpdateCallback = this[" + JSON.stringify(hotUpdateFunction) + "];\n" +
|
148
|
-
"this[" + JSON.stringify(hotUpdateFunction) + "] = " + Template.getFunctionContent(require("./JsonpMainTemplate.runtime.js"))
|
149
|
-
.replace(/\$require\$/g, this.requireFn)
|
150
|
-
.replace(/\$hotMainFilename\$/g, currentHotUpdateMainFilename)
|
151
|
-
.replace(/\$hotChunkFilename\$/g, currentHotUpdateChunkFilename)
|
152
|
-
.replace(/\$hash\$/g, JSON.stringify(hash));
|
153
|
-
});
|
154
|
-
mainTemplate.plugin("hash", function(hash) {
|
155
|
-
hash.update("jsonp");
|
156
|
-
hash.update("4");
|
157
|
-
hash.update(this.outputOptions.filename + "");
|
158
|
-
hash.update(this.outputOptions.chunkFilename + "");
|
159
|
-
hash.update(this.outputOptions.jsonpFunction + "");
|
160
|
-
hash.update(this.outputOptions.library + "");
|
161
|
-
});
|
162
|
-
};
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
var Template = require("./Template");
|
6
|
+
|
7
|
+
function JsonpMainTemplatePlugin() {}
|
8
|
+
module.exports = JsonpMainTemplatePlugin;
|
9
|
+
|
10
|
+
JsonpMainTemplatePlugin.prototype.constructor = JsonpMainTemplatePlugin;
|
11
|
+
JsonpMainTemplatePlugin.prototype.apply = function(mainTemplate) {
|
12
|
+
mainTemplate.plugin("local-vars", function(source, chunk) {
|
13
|
+
if(chunk.chunks.length > 0) {
|
14
|
+
return this.asString([
|
15
|
+
source,
|
16
|
+
"",
|
17
|
+
"// object to store loaded and loading chunks",
|
18
|
+
"// \"0\" means \"already loaded\"",
|
19
|
+
"// Array means \"loading\", array contains callbacks",
|
20
|
+
"var installedChunks = {",
|
21
|
+
this.indent(
|
22
|
+
chunk.ids.map(function(id) {
|
23
|
+
return id + ":0";
|
24
|
+
}).join(",\n")
|
25
|
+
),
|
26
|
+
"};"
|
27
|
+
]);
|
28
|
+
}
|
29
|
+
return source;
|
30
|
+
});
|
31
|
+
mainTemplate.plugin("jsonp-script", function(_, chunk, hash) {
|
32
|
+
var filename = this.outputOptions.filename || "bundle.js";
|
33
|
+
var chunkFilename = this.outputOptions.chunkFilename || "[id]." + filename;
|
34
|
+
var chunkMaps = chunk.getChunkMaps();
|
35
|
+
var crossOriginLoading = this.outputOptions.crossOriginLoading;
|
36
|
+
return this.asString([
|
37
|
+
"var script = document.createElement('script');",
|
38
|
+
"script.type = 'text/javascript';",
|
39
|
+
"script.charset = 'utf-8';",
|
40
|
+
"script.async = true;",
|
41
|
+
crossOriginLoading ? "script.crossOrigin = '" + crossOriginLoading + "';" : "",
|
42
|
+
"script.src = " + this.requireFn + ".p + " +
|
43
|
+
this.applyPluginsWaterfall("asset-path", JSON.stringify(chunkFilename), {
|
44
|
+
hash: "\" + " + this.renderCurrentHashCode(hash) + " + \"",
|
45
|
+
hashWithLength: function(length) {
|
46
|
+
return "\" + " + this.renderCurrentHashCode(hash, length) + " + \"";
|
47
|
+
}.bind(this),
|
48
|
+
chunk: {
|
49
|
+
id: "\" + chunkId + \"",
|
50
|
+
hash: "\" + " + JSON.stringify(chunkMaps.hash) + "[chunkId] + \"",
|
51
|
+
hashWithLength: function(length) {
|
52
|
+
var shortChunkHashMap = {};
|
53
|
+
Object.keys(chunkMaps.hash).forEach(function(chunkId) {
|
54
|
+
if(typeof chunkMaps.hash[chunkId] === "string")
|
55
|
+
shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substr(0, length);
|
56
|
+
});
|
57
|
+
return "\" + " + JSON.stringify(shortChunkHashMap) + "[chunkId] + \"";
|
58
|
+
},
|
59
|
+
name: "\" + (" + JSON.stringify(chunkMaps.name) + "[chunkId]||chunkId) + \""
|
60
|
+
}
|
61
|
+
}) + ";"
|
62
|
+
]);
|
63
|
+
});
|
64
|
+
mainTemplate.plugin("require-ensure", function(_, chunk, hash) {
|
65
|
+
var filename = this.outputOptions.filename || "bundle.js";
|
66
|
+
var chunkFilename = this.outputOptions.chunkFilename || "[id]." + filename;
|
67
|
+
return this.asString([
|
68
|
+
"// \"0\" is the signal for \"already loaded\"",
|
69
|
+
"if(installedChunks[chunkId] === 0)",
|
70
|
+
this.indent("return callback.call(null, " + this.requireFn + ");"),
|
71
|
+
"",
|
72
|
+
"// an array means \"currently loading\".",
|
73
|
+
"if(installedChunks[chunkId] !== undefined) {",
|
74
|
+
this.indent("installedChunks[chunkId].push(callback);"),
|
75
|
+
"} else {",
|
76
|
+
this.indent([
|
77
|
+
"// start chunk loading",
|
78
|
+
"installedChunks[chunkId] = [callback];",
|
79
|
+
"var head = document.getElementsByTagName('head')[0];",
|
80
|
+
this.applyPluginsWaterfall("jsonp-script", "", chunk, hash),
|
81
|
+
"head.appendChild(script);"
|
82
|
+
]),
|
83
|
+
"}"
|
84
|
+
]);
|
85
|
+
});
|
86
|
+
mainTemplate.plugin("bootstrap", function(source, chunk, hash) {
|
87
|
+
if(chunk.chunks.length > 0) {
|
88
|
+
var jsonpFunction = this.outputOptions.jsonpFunction || Template.toIdentifier("webpackJsonp" + (this.outputOptions.library || ""));
|
89
|
+
return this.asString([
|
90
|
+
source,
|
91
|
+
"",
|
92
|
+
"// install a JSONP callback for chunk loading",
|
93
|
+
"var parentJsonpFunction = window[" + JSON.stringify(jsonpFunction) + "];",
|
94
|
+
"window[" + JSON.stringify(jsonpFunction) + "] = function webpackJsonpCallback(chunkIds, moreModules) {",
|
95
|
+
this.indent([
|
96
|
+
"// add \"moreModules\" to the modules object,",
|
97
|
+
"// then flag all \"chunkIds\" as loaded and fire callback",
|
98
|
+
"var moduleId, chunkId, i = 0, callbacks = [];",
|
99
|
+
"for(;i < chunkIds.length; i++) {",
|
100
|
+
this.indent([
|
101
|
+
"chunkId = chunkIds[i];",
|
102
|
+
"if(installedChunks[chunkId])",
|
103
|
+
this.indent("callbacks.push.apply(callbacks, installedChunks[chunkId]);"),
|
104
|
+
"installedChunks[chunkId] = 0;"
|
105
|
+
]),
|
106
|
+
"}",
|
107
|
+
"for(moduleId in moreModules) {",
|
108
|
+
this.indent(this.renderAddModule(hash, chunk, "moduleId", "moreModules[moduleId]")),
|
109
|
+
"}",
|
110
|
+
"if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);",
|
111
|
+
"while(callbacks.length)",
|
112
|
+
this.indent("callbacks.shift().call(null, " + this.requireFn + ");"), (this.entryPointInChildren(chunk) ? [
|
113
|
+
"if(moreModules[0]) {",
|
114
|
+
this.indent([
|
115
|
+
"installedModules[0] = 0;",
|
116
|
+
"return " + this.requireFn + "(0);"
|
117
|
+
]),
|
118
|
+
"}"
|
119
|
+
] : "")
|
120
|
+
]),
|
121
|
+
"};"
|
122
|
+
]);
|
123
|
+
}
|
124
|
+
return source;
|
125
|
+
});
|
126
|
+
mainTemplate.plugin("hot-bootstrap", function(source, chunk, hash) {
|
127
|
+
var hotUpdateChunkFilename = this.outputOptions.hotUpdateChunkFilename;
|
128
|
+
var hotUpdateMainFilename = this.outputOptions.hotUpdateMainFilename;
|
129
|
+
var hotUpdateFunction = this.outputOptions.hotUpdateFunction || Template.toIdentifier("webpackHotUpdate" + (this.outputOptions.library || ""));
|
130
|
+
var currentHotUpdateChunkFilename = this.applyPluginsWaterfall("asset-path", JSON.stringify(hotUpdateChunkFilename), {
|
131
|
+
hash: "\" + " + this.renderCurrentHashCode(hash) + " + \"",
|
132
|
+
hashWithLength: function(length) {
|
133
|
+
return "\" + " + this.renderCurrentHashCode(hash, length) + " + \"";
|
134
|
+
}.bind(this),
|
135
|
+
chunk: {
|
136
|
+
id: "\" + chunkId + \""
|
137
|
+
}
|
138
|
+
});
|
139
|
+
var currentHotUpdateMainFilename = this.applyPluginsWaterfall("asset-path", JSON.stringify(hotUpdateMainFilename), {
|
140
|
+
hash: "\" + " + this.renderCurrentHashCode(hash) + " + \"",
|
141
|
+
hashWithLength: function(length) {
|
142
|
+
return "\" + " + this.renderCurrentHashCode(hash, length) + " + \"";
|
143
|
+
}.bind(this)
|
144
|
+
});
|
145
|
+
|
146
|
+
return source + "\n" +
|
147
|
+
"var parentHotUpdateCallback = this[" + JSON.stringify(hotUpdateFunction) + "];\n" +
|
148
|
+
"this[" + JSON.stringify(hotUpdateFunction) + "] = " + Template.getFunctionContent(require("./JsonpMainTemplate.runtime.js"))
|
149
|
+
.replace(/\$require\$/g, this.requireFn)
|
150
|
+
.replace(/\$hotMainFilename\$/g, currentHotUpdateMainFilename)
|
151
|
+
.replace(/\$hotChunkFilename\$/g, currentHotUpdateChunkFilename)
|
152
|
+
.replace(/\$hash\$/g, JSON.stringify(hash));
|
153
|
+
});
|
154
|
+
mainTemplate.plugin("hash", function(hash) {
|
155
|
+
hash.update("jsonp");
|
156
|
+
hash.update("4");
|
157
|
+
hash.update(this.outputOptions.filename + "");
|
158
|
+
hash.update(this.outputOptions.chunkFilename + "");
|
159
|
+
hash.update(this.outputOptions.jsonpFunction + "");
|
160
|
+
hash.update(this.outputOptions.library + "");
|
161
|
+
});
|
162
|
+
};
|
@@ -1,17 +1,17 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
var JsonpMainTemplatePlugin = require("./JsonpMainTemplatePlugin");
|
6
|
-
var JsonpChunkTemplatePlugin = require("./JsonpChunkTemplatePlugin");
|
7
|
-
var JsonpHotUpdateChunkTemplatePlugin = require("./JsonpHotUpdateChunkTemplatePlugin");
|
8
|
-
|
9
|
-
function JsonpTemplatePlugin() {}
|
10
|
-
module.exports = JsonpTemplatePlugin;
|
11
|
-
JsonpTemplatePlugin.prototype.apply = function(compiler) {
|
12
|
-
compiler.plugin("this-compilation", function(compilation) {
|
13
|
-
compilation.mainTemplate.apply(new JsonpMainTemplatePlugin());
|
14
|
-
compilation.chunkTemplate.apply(new JsonpChunkTemplatePlugin());
|
15
|
-
compilation.hotUpdateChunkTemplate.apply(new JsonpHotUpdateChunkTemplatePlugin());
|
16
|
-
});
|
17
|
-
};
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
var JsonpMainTemplatePlugin = require("./JsonpMainTemplatePlugin");
|
6
|
+
var JsonpChunkTemplatePlugin = require("./JsonpChunkTemplatePlugin");
|
7
|
+
var JsonpHotUpdateChunkTemplatePlugin = require("./JsonpHotUpdateChunkTemplatePlugin");
|
8
|
+
|
9
|
+
function JsonpTemplatePlugin() {}
|
10
|
+
module.exports = JsonpTemplatePlugin;
|
11
|
+
JsonpTemplatePlugin.prototype.apply = function(compiler) {
|
12
|
+
compiler.plugin("this-compilation", function(compilation) {
|
13
|
+
compilation.mainTemplate.apply(new JsonpMainTemplatePlugin());
|
14
|
+
compilation.chunkTemplate.apply(new JsonpChunkTemplatePlugin());
|
15
|
+
compilation.hotUpdateChunkTemplate.apply(new JsonpHotUpdateChunkTemplatePlugin());
|
16
|
+
});
|
17
|
+
};
|