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
package/lib/MultiModule.js
CHANGED
@@ -1,71 +1,71 @@
|
|
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 MultiModule(context, dependencies, name) {
|
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
|
-
}
|
16
|
-
module.exports = MultiModule;
|
17
|
-
|
18
|
-
MultiModule.prototype = Object.create(Module.prototype);
|
19
|
-
|
20
|
-
MultiModule.prototype.identifier = function() {
|
21
|
-
return "multi " + this.name;
|
22
|
-
};
|
23
|
-
|
24
|
-
MultiModule.prototype.readableIdentifier = function() {
|
25
|
-
return "multi " + this.name;
|
26
|
-
};
|
27
|
-
|
28
|
-
MultiModule.prototype.disconnect = function disconnect() {
|
29
|
-
this.built = false;
|
30
|
-
Module.prototype.disconnect.call(this);
|
31
|
-
};
|
32
|
-
|
33
|
-
MultiModule.prototype.build = function build(options, compilation, resolver, fs, callback) {
|
34
|
-
this.built = true;
|
35
|
-
return callback();
|
36
|
-
};
|
37
|
-
|
38
|
-
MultiModule.prototype.source = function(dependencyTemplates, outputOptions) {
|
39
|
-
var str = [];
|
40
|
-
this.dependencies.forEach(function(dep, idx) {
|
41
|
-
if(dep.module) {
|
42
|
-
if(idx === this.dependencies.length - 1)
|
43
|
-
str.push("module.exports = ");
|
44
|
-
str.push("__webpack_require__(");
|
45
|
-
if(outputOptions.pathinfo)
|
46
|
-
str.push("/*! " + dep.request + " */");
|
47
|
-
str.push("" + JSON.stringify(dep.module.id));
|
48
|
-
str.push(")");
|
49
|
-
} else {
|
50
|
-
str.push("(function webpackMissingModule() { throw new Error(");
|
51
|
-
str.push(JSON.stringify("Cannot find module \"" + dep.request + "\""));
|
52
|
-
str.push("); }())");
|
53
|
-
}
|
54
|
-
str.push(";\n");
|
55
|
-
}, this);
|
56
|
-
return new RawSource(str.join(""));
|
57
|
-
};
|
58
|
-
|
59
|
-
MultiModule.prototype.needRebuild = function needRebuild() {
|
60
|
-
return false;
|
61
|
-
};
|
62
|
-
|
63
|
-
MultiModule.prototype.size = function() {
|
64
|
-
return 16 + this.dependencies.length * 12;
|
65
|
-
};
|
66
|
-
|
67
|
-
MultiModule.prototype.updateHash = function(hash) {
|
68
|
-
hash.update("multi module");
|
69
|
-
hash.update(this.name || "");
|
70
|
-
Module.prototype.updateHash.call(this, hash);
|
71
|
-
};
|
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 MultiModule(context, dependencies, name) {
|
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
|
+
}
|
16
|
+
module.exports = MultiModule;
|
17
|
+
|
18
|
+
MultiModule.prototype = Object.create(Module.prototype);
|
19
|
+
|
20
|
+
MultiModule.prototype.identifier = function() {
|
21
|
+
return "multi " + this.name;
|
22
|
+
};
|
23
|
+
|
24
|
+
MultiModule.prototype.readableIdentifier = function() {
|
25
|
+
return "multi " + this.name;
|
26
|
+
};
|
27
|
+
|
28
|
+
MultiModule.prototype.disconnect = function disconnect() {
|
29
|
+
this.built = false;
|
30
|
+
Module.prototype.disconnect.call(this);
|
31
|
+
};
|
32
|
+
|
33
|
+
MultiModule.prototype.build = function build(options, compilation, resolver, fs, callback) {
|
34
|
+
this.built = true;
|
35
|
+
return callback();
|
36
|
+
};
|
37
|
+
|
38
|
+
MultiModule.prototype.source = function(dependencyTemplates, outputOptions) {
|
39
|
+
var str = [];
|
40
|
+
this.dependencies.forEach(function(dep, idx) {
|
41
|
+
if(dep.module) {
|
42
|
+
if(idx === this.dependencies.length - 1)
|
43
|
+
str.push("module.exports = ");
|
44
|
+
str.push("__webpack_require__(");
|
45
|
+
if(outputOptions.pathinfo)
|
46
|
+
str.push("/*! " + dep.request + " */");
|
47
|
+
str.push("" + JSON.stringify(dep.module.id));
|
48
|
+
str.push(")");
|
49
|
+
} else {
|
50
|
+
str.push("(function webpackMissingModule() { throw new Error(");
|
51
|
+
str.push(JSON.stringify("Cannot find module \"" + dep.request + "\""));
|
52
|
+
str.push("); }())");
|
53
|
+
}
|
54
|
+
str.push(";\n");
|
55
|
+
}, this);
|
56
|
+
return new RawSource(str.join(""));
|
57
|
+
};
|
58
|
+
|
59
|
+
MultiModule.prototype.needRebuild = function needRebuild() {
|
60
|
+
return false;
|
61
|
+
};
|
62
|
+
|
63
|
+
MultiModule.prototype.size = function() {
|
64
|
+
return 16 + this.dependencies.length * 12;
|
65
|
+
};
|
66
|
+
|
67
|
+
MultiModule.prototype.updateHash = function(hash) {
|
68
|
+
hash.update("multi module");
|
69
|
+
hash.update(this.name || "");
|
70
|
+
Module.prototype.updateHash.call(this, hash);
|
71
|
+
};
|
@@ -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 MultiModule = require("./MultiModule");
|
7
|
-
|
8
|
-
function MultiModuleFactory() {
|
9
|
-
Tapable.call(this);
|
10
|
-
}
|
11
|
-
module.exports = MultiModuleFactory;
|
12
|
-
|
13
|
-
MultiModuleFactory.prototype = Object.create(Tapable.prototype);
|
14
|
-
MultiModuleFactory.prototype.constructor = MultiModuleFactory;
|
15
|
-
|
16
|
-
MultiModuleFactory.prototype.create = function(context, dependency, callback) {
|
17
|
-
callback(null, new MultiModule(context, dependency.dependencies, dependency.name));
|
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 MultiModule = require("./MultiModule");
|
7
|
+
|
8
|
+
function MultiModuleFactory() {
|
9
|
+
Tapable.call(this);
|
10
|
+
}
|
11
|
+
module.exports = MultiModuleFactory;
|
12
|
+
|
13
|
+
MultiModuleFactory.prototype = Object.create(Tapable.prototype);
|
14
|
+
MultiModuleFactory.prototype.constructor = MultiModuleFactory;
|
15
|
+
|
16
|
+
MultiModuleFactory.prototype.create = function(context, dependency, callback) {
|
17
|
+
callback(null, new MultiModule(context, dependency.dependencies, dependency.name));
|
18
|
+
};
|
@@ -1,21 +1,21 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
function NamedModulesPlugin(options) {
|
6
|
-
this.options = options || {};
|
7
|
-
}
|
8
|
-
module.exports = NamedModulesPlugin;
|
9
|
-
NamedModulesPlugin.prototype.apply = function(compiler) {
|
10
|
-
compiler.plugin("compilation", function(compilation) {
|
11
|
-
compilation.plugin("before-module-ids", function(modules) {
|
12
|
-
modules.forEach(function(module) {
|
13
|
-
if(module.id === null && module.libIdent) {
|
14
|
-
module.id = module.libIdent({
|
15
|
-
context: this.options.context || compiler.options.context
|
16
|
-
});
|
17
|
-
}
|
18
|
-
}, this);
|
19
|
-
}.bind(this));
|
20
|
-
}.bind(this));
|
21
|
-
};
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
function NamedModulesPlugin(options) {
|
6
|
+
this.options = options || {};
|
7
|
+
}
|
8
|
+
module.exports = NamedModulesPlugin;
|
9
|
+
NamedModulesPlugin.prototype.apply = function(compiler) {
|
10
|
+
compiler.plugin("compilation", function(compilation) {
|
11
|
+
compilation.plugin("before-module-ids", function(modules) {
|
12
|
+
modules.forEach(function(module) {
|
13
|
+
if(module.id === null && module.libIdent) {
|
14
|
+
module.id = module.libIdent({
|
15
|
+
context: this.options.context || compiler.options.context
|
16
|
+
});
|
17
|
+
}
|
18
|
+
}, this);
|
19
|
+
}.bind(this));
|
20
|
+
}.bind(this));
|
21
|
+
};
|
package/lib/NewWatchingPlugin.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
function NewWatchingPlugin() {}
|
6
|
-
module.exports = NewWatchingPlugin;
|
7
|
-
|
8
|
-
NewWatchingPlugin.prototype.apply = function(compiler) {
|
9
|
-
compiler.plugin("compilation", function(compilation) {
|
10
|
-
compilation.warnings.push(new Error("The 'NewWatchingPlugin' is no longer necessary (now default)"));
|
11
|
-
});
|
12
|
-
};
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
function NewWatchingPlugin() {}
|
6
|
+
module.exports = NewWatchingPlugin;
|
7
|
+
|
8
|
+
NewWatchingPlugin.prototype.apply = function(compiler) {
|
9
|
+
compiler.plugin("compilation", function(compilation) {
|
10
|
+
compilation.warnings.push(new Error("The 'NewWatchingPlugin' is no longer necessary (now default)"));
|
11
|
+
});
|
12
|
+
};
|
package/lib/NoErrorsPlugin.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
|
-
function NoErrorsPlugin() {}
|
6
|
-
module.exports = NoErrorsPlugin;
|
7
|
-
NoErrorsPlugin.prototype.apply = function(compiler) {
|
8
|
-
compiler.plugin("should-emit", function(compilation) {
|
9
|
-
if(compilation.errors.length > 0)
|
10
|
-
return false;
|
11
|
-
});
|
12
|
-
compiler.plugin("compilation", function(compilation) {
|
13
|
-
compilation.plugin("should-record", function() {
|
14
|
-
if(compilation.errors.length > 0)
|
15
|
-
return false;
|
16
|
-
});
|
17
|
-
});
|
18
|
-
};
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
function NoErrorsPlugin() {}
|
6
|
+
module.exports = NoErrorsPlugin;
|
7
|
+
NoErrorsPlugin.prototype.apply = function(compiler) {
|
8
|
+
compiler.plugin("should-emit", function(compilation) {
|
9
|
+
if(compilation.errors.length > 0)
|
10
|
+
return false;
|
11
|
+
});
|
12
|
+
compiler.plugin("compilation", function(compilation) {
|
13
|
+
compilation.plugin("should-record", function() {
|
14
|
+
if(compilation.errors.length > 0)
|
15
|
+
return false;
|
16
|
+
});
|
17
|
+
});
|
18
|
+
};
|
package/lib/NodeStuffPlugin.js
CHANGED
@@ -1,99 +1,99 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
var path = require("path");
|
6
|
-
var ModuleParserHelpers = require("./ModuleParserHelpers");
|
7
|
-
var ConstDependency = require("./dependencies/ConstDependency");
|
8
|
-
var BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
|
9
|
-
var UnsupportedFeatureWarning = require("./UnsupportedFeatureWarning");
|
10
|
-
|
11
|
-
var NullFactory = require("./NullFactory");
|
12
|
-
|
13
|
-
function NodeStuffPlugin(options) {
|
14
|
-
this.options = options;
|
15
|
-
}
|
16
|
-
module.exports = NodeStuffPlugin;
|
17
|
-
NodeStuffPlugin.prototype.apply = function(compiler) {
|
18
|
-
compiler.plugin("compilation", function(compilation) {
|
19
|
-
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
|
20
|
-
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
|
21
|
-
});
|
22
|
-
|
23
|
-
function ignore() {
|
24
|
-
return true;
|
25
|
-
}
|
26
|
-
|
27
|
-
function setConstant(expressionName, value) {
|
28
|
-
compiler.parser.plugin("expression " + expressionName, function() {
|
29
|
-
this.state.current.addVariable(expressionName, JSON.stringify(value));
|
30
|
-
return true;
|
31
|
-
});
|
32
|
-
}
|
33
|
-
|
34
|
-
function setModuleConstant(expressionName, fn) {
|
35
|
-
compiler.parser.plugin("expression " + expressionName, function() {
|
36
|
-
this.state.current.addVariable(expressionName, JSON.stringify(fn(this.state.module)));
|
37
|
-
return true;
|
38
|
-
});
|
39
|
-
}
|
40
|
-
var context = compiler.context;
|
41
|
-
if(this.options.__filename === "mock") {
|
42
|
-
setConstant("__filename", "/index.js");
|
43
|
-
} else if(this.options.__filename) {
|
44
|
-
setModuleConstant("__filename", function(module) {
|
45
|
-
return path.relative(context, module.resource);
|
46
|
-
});
|
47
|
-
}
|
48
|
-
compiler.parser.plugin("evaluate Identifier __filename", function(expr) {
|
49
|
-
if(!this.state.module) return;
|
50
|
-
var res = new BasicEvaluatedExpression();
|
51
|
-
res.setString(this.state.module.splitQuery(this.state.module.resource)[0]);
|
52
|
-
res.setRange(expr.range);
|
53
|
-
return res;
|
54
|
-
});
|
55
|
-
if(this.options.__dirname === "mock") {
|
56
|
-
setConstant("__dirname", "/");
|
57
|
-
} else if(this.options.__dirname) {
|
58
|
-
setModuleConstant("__dirname", function(module) {
|
59
|
-
return path.relative(context, module.context);
|
60
|
-
});
|
61
|
-
}
|
62
|
-
compiler.parser.plugin("evaluate Identifier __dirname", function(expr) {
|
63
|
-
if(!this.state.module) return;
|
64
|
-
var res = new BasicEvaluatedExpression();
|
65
|
-
res.setString(this.state.module.context);
|
66
|
-
res.setRange(expr.range);
|
67
|
-
return res;
|
68
|
-
});
|
69
|
-
compiler.parser.plugin("expression require.main", function(expr) {
|
70
|
-
var dep = new ConstDependency("__webpack_require__.c[0]", expr.range);
|
71
|
-
dep.loc = expr.loc;
|
72
|
-
this.state.current.addDependency(dep);
|
73
|
-
return true;
|
74
|
-
});
|
75
|
-
compiler.parser.plugin("expression require.extensions", function(expr) {
|
76
|
-
var dep = new ConstDependency("(void 0)", expr.range);
|
77
|
-
dep.loc = expr.loc;
|
78
|
-
this.state.current.addDependency(dep);
|
79
|
-
if(!this.state.module) return;
|
80
|
-
this.state.module.warnings.push(new UnsupportedFeatureWarning(this.state.module, "require.extensions is not supported by webpack. Use a loader instead."));
|
81
|
-
return true;
|
82
|
-
});
|
83
|
-
compiler.parser.plugin("expression module.exports", ignore);
|
84
|
-
compiler.parser.plugin("expression module.loaded", ignore);
|
85
|
-
compiler.parser.plugin("expression module.id", ignore);
|
86
|
-
compiler.parser.plugin("evaluate Identifier module.hot", function(expr) {
|
87
|
-
return new BasicEvaluatedExpression().setBoolean(false).setRange(expr.range);
|
88
|
-
});
|
89
|
-
compiler.parser.plugin("expression module", function() {
|
90
|
-
var moduleJsPath = path.join(__dirname, "..", "buildin", "module.js");
|
91
|
-
if(this.state.module.context) {
|
92
|
-
moduleJsPath = path.relative(this.state.module.context, moduleJsPath);
|
93
|
-
if(!/^[A-Z]:/i.test(moduleJsPath)) {
|
94
|
-
moduleJsPath = "./" + moduleJsPath.replace(/\\/g, "/");
|
95
|
-
}
|
96
|
-
}
|
97
|
-
return ModuleParserHelpers.addParsedVariable(this, "module", "require(" + JSON.stringify(moduleJsPath) + ")(module)");
|
98
|
-
});
|
99
|
-
};
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
var path = require("path");
|
6
|
+
var ModuleParserHelpers = require("./ModuleParserHelpers");
|
7
|
+
var ConstDependency = require("./dependencies/ConstDependency");
|
8
|
+
var BasicEvaluatedExpression = require("./BasicEvaluatedExpression");
|
9
|
+
var UnsupportedFeatureWarning = require("./UnsupportedFeatureWarning");
|
10
|
+
|
11
|
+
var NullFactory = require("./NullFactory");
|
12
|
+
|
13
|
+
function NodeStuffPlugin(options) {
|
14
|
+
this.options = options;
|
15
|
+
}
|
16
|
+
module.exports = NodeStuffPlugin;
|
17
|
+
NodeStuffPlugin.prototype.apply = function(compiler) {
|
18
|
+
compiler.plugin("compilation", function(compilation) {
|
19
|
+
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
|
20
|
+
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
|
21
|
+
});
|
22
|
+
|
23
|
+
function ignore() {
|
24
|
+
return true;
|
25
|
+
}
|
26
|
+
|
27
|
+
function setConstant(expressionName, value) {
|
28
|
+
compiler.parser.plugin("expression " + expressionName, function() {
|
29
|
+
this.state.current.addVariable(expressionName, JSON.stringify(value));
|
30
|
+
return true;
|
31
|
+
});
|
32
|
+
}
|
33
|
+
|
34
|
+
function setModuleConstant(expressionName, fn) {
|
35
|
+
compiler.parser.plugin("expression " + expressionName, function() {
|
36
|
+
this.state.current.addVariable(expressionName, JSON.stringify(fn(this.state.module)));
|
37
|
+
return true;
|
38
|
+
});
|
39
|
+
}
|
40
|
+
var context = compiler.context;
|
41
|
+
if(this.options.__filename === "mock") {
|
42
|
+
setConstant("__filename", "/index.js");
|
43
|
+
} else if(this.options.__filename) {
|
44
|
+
setModuleConstant("__filename", function(module) {
|
45
|
+
return path.relative(context, module.resource);
|
46
|
+
});
|
47
|
+
}
|
48
|
+
compiler.parser.plugin("evaluate Identifier __filename", function(expr) {
|
49
|
+
if(!this.state.module) return;
|
50
|
+
var res = new BasicEvaluatedExpression();
|
51
|
+
res.setString(this.state.module.splitQuery(this.state.module.resource)[0]);
|
52
|
+
res.setRange(expr.range);
|
53
|
+
return res;
|
54
|
+
});
|
55
|
+
if(this.options.__dirname === "mock") {
|
56
|
+
setConstant("__dirname", "/");
|
57
|
+
} else if(this.options.__dirname) {
|
58
|
+
setModuleConstant("__dirname", function(module) {
|
59
|
+
return path.relative(context, module.context);
|
60
|
+
});
|
61
|
+
}
|
62
|
+
compiler.parser.plugin("evaluate Identifier __dirname", function(expr) {
|
63
|
+
if(!this.state.module) return;
|
64
|
+
var res = new BasicEvaluatedExpression();
|
65
|
+
res.setString(this.state.module.context);
|
66
|
+
res.setRange(expr.range);
|
67
|
+
return res;
|
68
|
+
});
|
69
|
+
compiler.parser.plugin("expression require.main", function(expr) {
|
70
|
+
var dep = new ConstDependency("__webpack_require__.c[0]", expr.range);
|
71
|
+
dep.loc = expr.loc;
|
72
|
+
this.state.current.addDependency(dep);
|
73
|
+
return true;
|
74
|
+
});
|
75
|
+
compiler.parser.plugin("expression require.extensions", function(expr) {
|
76
|
+
var dep = new ConstDependency("(void 0)", expr.range);
|
77
|
+
dep.loc = expr.loc;
|
78
|
+
this.state.current.addDependency(dep);
|
79
|
+
if(!this.state.module) return;
|
80
|
+
this.state.module.warnings.push(new UnsupportedFeatureWarning(this.state.module, "require.extensions is not supported by webpack. Use a loader instead."));
|
81
|
+
return true;
|
82
|
+
});
|
83
|
+
compiler.parser.plugin("expression module.exports", ignore);
|
84
|
+
compiler.parser.plugin("expression module.loaded", ignore);
|
85
|
+
compiler.parser.plugin("expression module.id", ignore);
|
86
|
+
compiler.parser.plugin("evaluate Identifier module.hot", function(expr) {
|
87
|
+
return new BasicEvaluatedExpression().setBoolean(false).setRange(expr.range);
|
88
|
+
});
|
89
|
+
compiler.parser.plugin("expression module", function() {
|
90
|
+
var moduleJsPath = path.join(__dirname, "..", "buildin", "module.js");
|
91
|
+
if(this.state.module.context) {
|
92
|
+
moduleJsPath = path.relative(this.state.module.context, moduleJsPath);
|
93
|
+
if(!/^[A-Z]:/i.test(moduleJsPath)) {
|
94
|
+
moduleJsPath = "./" + moduleJsPath.replace(/\\/g, "/");
|
95
|
+
}
|
96
|
+
}
|
97
|
+
return ModuleParserHelpers.addParsedVariable(this, "module", "require(" + JSON.stringify(moduleJsPath) + ")(module)");
|
98
|
+
});
|
99
|
+
};
|