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/RecordIdsPlugin.js
CHANGED
@@ -1,130 +1,130 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
var path = require("path");
|
6
|
-
|
7
|
-
function RecordIdsPlugin() {}
|
8
|
-
module.exports = RecordIdsPlugin;
|
9
|
-
|
10
|
-
function makeRelative(compiler, identifier) {
|
11
|
-
var context = compiler.context;
|
12
|
-
return identifier.split("|").map(function(str) {
|
13
|
-
return identifier.split("!").map(function(str) {
|
14
|
-
return path.relative(context, str);
|
15
|
-
}).join("!");
|
16
|
-
}).join("|");
|
17
|
-
}
|
18
|
-
|
19
|
-
RecordIdsPlugin.prototype.apply = function(compiler) {
|
20
|
-
compiler.plugin("compilation", function(compilation) {
|
21
|
-
compilation.plugin("record-modules", function(modules, records) {
|
22
|
-
records.nextFreeModuleId = compilation.nextFreeModuleId;
|
23
|
-
if(!records.modules) records.modules = {};
|
24
|
-
if(!records.modules.byIdentifier) records.modules.byIdentifier = {};
|
25
|
-
modules.forEach(function(module) {
|
26
|
-
var identifier = makeRelative(compiler, module.identifier());
|
27
|
-
records.modules.byIdentifier[identifier] = module.id;
|
28
|
-
});
|
29
|
-
});
|
30
|
-
compilation.plugin("revive-modules", function(modules, records) {
|
31
|
-
if(records.nextFreeModuleId)
|
32
|
-
compilation.nextFreeModuleId = records.nextFreeModuleId;
|
33
|
-
if(!records.modules || !records.modules.byIdentifier) return;
|
34
|
-
var usedIds = {
|
35
|
-
0: true
|
36
|
-
};
|
37
|
-
modules.forEach(function(module) {
|
38
|
-
if(module.id !== null) return;
|
39
|
-
var identifier = makeRelative(compiler, module.identifier());
|
40
|
-
var id = records.modules.byIdentifier[identifier];
|
41
|
-
if(id === undefined) return;
|
42
|
-
if(usedIds[id]) return;
|
43
|
-
usedIds[id] = true;
|
44
|
-
module.id = id;
|
45
|
-
});
|
46
|
-
});
|
47
|
-
|
48
|
-
function getDepBlockIdent(chunk, block) {
|
49
|
-
var ident = [];
|
50
|
-
if(block.chunks.length > 1)
|
51
|
-
ident.push(block.chunks.indexOf(chunk));
|
52
|
-
while(block.parent) {
|
53
|
-
var p = block.parent;
|
54
|
-
var idx = p.blocks.indexOf(block);
|
55
|
-
var l = p.blocks.length - 1;
|
56
|
-
ident.unshift(idx + "/" + l);
|
57
|
-
block = block.parent;
|
58
|
-
}
|
59
|
-
if(!block.identifier) return null;
|
60
|
-
ident.unshift(makeRelative(compiler, block.identifier()));
|
61
|
-
return ident.join(":");
|
62
|
-
}
|
63
|
-
compilation.plugin("record-chunks", function(chunks, records) {
|
64
|
-
records.nextFreeChunkId = compilation.nextFreeChunkId;
|
65
|
-
if(!records.chunks) records.chunks = {};
|
66
|
-
if(!records.chunks.byName) records.chunks.byName = {};
|
67
|
-
if(!records.chunks.byBlocks) records.chunks.byBlocks = {};
|
68
|
-
chunks.forEach(function(chunk) {
|
69
|
-
var name = chunk.name;
|
70
|
-
var blockIdents = chunk.blocks.map(getDepBlockIdent.bind(null, chunk)).filter(Boolean);
|
71
|
-
if(name) records.chunks.byName[name] = chunk.id;
|
72
|
-
blockIdents.forEach(function(blockIdent) {
|
73
|
-
records.chunks.byBlocks[blockIdent] = chunk.id;
|
74
|
-
});
|
75
|
-
});
|
76
|
-
});
|
77
|
-
compilation.plugin("revive-chunks", function(chunks, records) {
|
78
|
-
if(records.nextFreeChunkId)
|
79
|
-
compilation.nextFreeChunkId = records.nextFreeChunkId;
|
80
|
-
if(!records.chunks) return;
|
81
|
-
var usedIds = {};
|
82
|
-
if(records.chunks.byName) {
|
83
|
-
chunks.forEach(function(chunk) {
|
84
|
-
if(chunk.id !== null) return;
|
85
|
-
if(!chunk.name) return;
|
86
|
-
var id = records.chunks.byName[chunk.name];
|
87
|
-
if(id === undefined) return;
|
88
|
-
if(usedIds[id]) return;
|
89
|
-
usedIds[id] = true;
|
90
|
-
chunk.id = id;
|
91
|
-
});
|
92
|
-
}
|
93
|
-
if(records.chunks.byBlocks) {
|
94
|
-
var argumentedChunks = chunks.filter(function(chunk) {
|
95
|
-
return chunk.id === null;
|
96
|
-
}).map(function(chunk) {
|
97
|
-
return {
|
98
|
-
chunk: chunk,
|
99
|
-
blockIdents: chunk.blocks.map(getDepBlockIdent.bind(null, chunk)).filter(Boolean)
|
100
|
-
};
|
101
|
-
}).filter(function(arg) {
|
102
|
-
return arg.blockIdents.length > 0;
|
103
|
-
});
|
104
|
-
var blockIdentsCount = {};
|
105
|
-
argumentedChunks.forEach(function(arg, idx) {
|
106
|
-
arg.blockIdents.forEach(function(blockIdent) {
|
107
|
-
var id = records.chunks.byBlocks[blockIdent];
|
108
|
-
if(typeof id !== "number") return;
|
109
|
-
var accessor = id + ":" + idx;
|
110
|
-
blockIdentsCount[accessor] = (blockIdentsCount[accessor] || 0) + 1;
|
111
|
-
});
|
112
|
-
});
|
113
|
-
blockIdentsCount = Object.keys(blockIdentsCount).map(function(accessor) {
|
114
|
-
return [blockIdentsCount[accessor]].concat(accessor.split(":").map(Number));
|
115
|
-
}).sort(function(a, b) {
|
116
|
-
return b[0] - a[0];
|
117
|
-
});
|
118
|
-
blockIdentsCount.forEach(function(arg) {
|
119
|
-
var id = arg[1];
|
120
|
-
if(usedIds[id]) return;
|
121
|
-
var idx = arg[2];
|
122
|
-
var chunk = argumentedChunks[idx].chunk;
|
123
|
-
if(chunk.id !== null) return;
|
124
|
-
usedIds[id] = true;
|
125
|
-
chunk.id = id;
|
126
|
-
});
|
127
|
-
}
|
128
|
-
});
|
129
|
-
});
|
130
|
-
};
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
var path = require("path");
|
6
|
+
|
7
|
+
function RecordIdsPlugin() {}
|
8
|
+
module.exports = RecordIdsPlugin;
|
9
|
+
|
10
|
+
function makeRelative(compiler, identifier) {
|
11
|
+
var context = compiler.context;
|
12
|
+
return identifier.split("|").map(function(str) {
|
13
|
+
return identifier.split("!").map(function(str) {
|
14
|
+
return path.relative(context, str);
|
15
|
+
}).join("!");
|
16
|
+
}).join("|");
|
17
|
+
}
|
18
|
+
|
19
|
+
RecordIdsPlugin.prototype.apply = function(compiler) {
|
20
|
+
compiler.plugin("compilation", function(compilation) {
|
21
|
+
compilation.plugin("record-modules", function(modules, records) {
|
22
|
+
records.nextFreeModuleId = compilation.nextFreeModuleId;
|
23
|
+
if(!records.modules) records.modules = {};
|
24
|
+
if(!records.modules.byIdentifier) records.modules.byIdentifier = {};
|
25
|
+
modules.forEach(function(module) {
|
26
|
+
var identifier = makeRelative(compiler, module.identifier());
|
27
|
+
records.modules.byIdentifier[identifier] = module.id;
|
28
|
+
});
|
29
|
+
});
|
30
|
+
compilation.plugin("revive-modules", function(modules, records) {
|
31
|
+
if(records.nextFreeModuleId)
|
32
|
+
compilation.nextFreeModuleId = records.nextFreeModuleId;
|
33
|
+
if(!records.modules || !records.modules.byIdentifier) return;
|
34
|
+
var usedIds = {
|
35
|
+
0: true
|
36
|
+
};
|
37
|
+
modules.forEach(function(module) {
|
38
|
+
if(module.id !== null) return;
|
39
|
+
var identifier = makeRelative(compiler, module.identifier());
|
40
|
+
var id = records.modules.byIdentifier[identifier];
|
41
|
+
if(id === undefined) return;
|
42
|
+
if(usedIds[id]) return;
|
43
|
+
usedIds[id] = true;
|
44
|
+
module.id = id;
|
45
|
+
});
|
46
|
+
});
|
47
|
+
|
48
|
+
function getDepBlockIdent(chunk, block) {
|
49
|
+
var ident = [];
|
50
|
+
if(block.chunks.length > 1)
|
51
|
+
ident.push(block.chunks.indexOf(chunk));
|
52
|
+
while(block.parent) {
|
53
|
+
var p = block.parent;
|
54
|
+
var idx = p.blocks.indexOf(block);
|
55
|
+
var l = p.blocks.length - 1;
|
56
|
+
ident.unshift(idx + "/" + l);
|
57
|
+
block = block.parent;
|
58
|
+
}
|
59
|
+
if(!block.identifier) return null;
|
60
|
+
ident.unshift(makeRelative(compiler, block.identifier()));
|
61
|
+
return ident.join(":");
|
62
|
+
}
|
63
|
+
compilation.plugin("record-chunks", function(chunks, records) {
|
64
|
+
records.nextFreeChunkId = compilation.nextFreeChunkId;
|
65
|
+
if(!records.chunks) records.chunks = {};
|
66
|
+
if(!records.chunks.byName) records.chunks.byName = {};
|
67
|
+
if(!records.chunks.byBlocks) records.chunks.byBlocks = {};
|
68
|
+
chunks.forEach(function(chunk) {
|
69
|
+
var name = chunk.name;
|
70
|
+
var blockIdents = chunk.blocks.map(getDepBlockIdent.bind(null, chunk)).filter(Boolean);
|
71
|
+
if(name) records.chunks.byName[name] = chunk.id;
|
72
|
+
blockIdents.forEach(function(blockIdent) {
|
73
|
+
records.chunks.byBlocks[blockIdent] = chunk.id;
|
74
|
+
});
|
75
|
+
});
|
76
|
+
});
|
77
|
+
compilation.plugin("revive-chunks", function(chunks, records) {
|
78
|
+
if(records.nextFreeChunkId)
|
79
|
+
compilation.nextFreeChunkId = records.nextFreeChunkId;
|
80
|
+
if(!records.chunks) return;
|
81
|
+
var usedIds = {};
|
82
|
+
if(records.chunks.byName) {
|
83
|
+
chunks.forEach(function(chunk) {
|
84
|
+
if(chunk.id !== null) return;
|
85
|
+
if(!chunk.name) return;
|
86
|
+
var id = records.chunks.byName[chunk.name];
|
87
|
+
if(id === undefined) return;
|
88
|
+
if(usedIds[id]) return;
|
89
|
+
usedIds[id] = true;
|
90
|
+
chunk.id = id;
|
91
|
+
});
|
92
|
+
}
|
93
|
+
if(records.chunks.byBlocks) {
|
94
|
+
var argumentedChunks = chunks.filter(function(chunk) {
|
95
|
+
return chunk.id === null;
|
96
|
+
}).map(function(chunk) {
|
97
|
+
return {
|
98
|
+
chunk: chunk,
|
99
|
+
blockIdents: chunk.blocks.map(getDepBlockIdent.bind(null, chunk)).filter(Boolean)
|
100
|
+
};
|
101
|
+
}).filter(function(arg) {
|
102
|
+
return arg.blockIdents.length > 0;
|
103
|
+
});
|
104
|
+
var blockIdentsCount = {};
|
105
|
+
argumentedChunks.forEach(function(arg, idx) {
|
106
|
+
arg.blockIdents.forEach(function(blockIdent) {
|
107
|
+
var id = records.chunks.byBlocks[blockIdent];
|
108
|
+
if(typeof id !== "number") return;
|
109
|
+
var accessor = id + ":" + idx;
|
110
|
+
blockIdentsCount[accessor] = (blockIdentsCount[accessor] || 0) + 1;
|
111
|
+
});
|
112
|
+
});
|
113
|
+
blockIdentsCount = Object.keys(blockIdentsCount).map(function(accessor) {
|
114
|
+
return [blockIdentsCount[accessor]].concat(accessor.split(":").map(Number));
|
115
|
+
}).sort(function(a, b) {
|
116
|
+
return b[0] - a[0];
|
117
|
+
});
|
118
|
+
blockIdentsCount.forEach(function(arg) {
|
119
|
+
var id = arg[1];
|
120
|
+
if(usedIds[id]) return;
|
121
|
+
var idx = arg[2];
|
122
|
+
var chunk = argumentedChunks[idx].chunk;
|
123
|
+
if(chunk.id !== null) return;
|
124
|
+
usedIds[id] = true;
|
125
|
+
chunk.id = id;
|
126
|
+
});
|
127
|
+
}
|
128
|
+
});
|
129
|
+
});
|
130
|
+
};
|
package/lib/RequestShortener.js
CHANGED
@@ -1,56 +1,56 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
var path = require("path");
|
6
|
-
|
7
|
-
function RequestShortener(directory) {
|
8
|
-
directory = directory.replace(/\\/g, "/");
|
9
|
-
var parentDirectory = path.dirname(directory);
|
10
|
-
if(/[\/\\]$/.test(directory)) directory = directory.substr(0, directory.length - 1);
|
11
|
-
if(directory) {
|
12
|
-
var currentDirectoryRegExp = directory.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
13
|
-
currentDirectoryRegExp = new RegExp("^" + currentDirectoryRegExp + "|(!)" + currentDirectoryRegExp, "g");
|
14
|
-
|
15
|
-
this.currentDirectoryRegExp = currentDirectoryRegExp;
|
16
|
-
}
|
17
|
-
|
18
|
-
if(/[\/\\]$/.test(parentDirectory)) parentDirectory = parentDirectory.substr(0, parentDirectory.length - 1);
|
19
|
-
if(parentDirectory && parentDirectory !== directory) {
|
20
|
-
var parentDirectoryRegExp = parentDirectory.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
21
|
-
parentDirectoryRegExp = new RegExp("^" + parentDirectoryRegExp + "|(!)" + parentDirectoryRegExp, "g");
|
22
|
-
|
23
|
-
this.parentDirectoryRegExp = parentDirectoryRegExp;
|
24
|
-
}
|
25
|
-
|
26
|
-
if(__dirname.length >= 2) {
|
27
|
-
var buildins = path.join(__dirname, "..").replace(/\\/g, "/");
|
28
|
-
var buildinsAsModule = currentDirectoryRegExp && currentDirectoryRegExp.test(buildins);
|
29
|
-
var buildinsRegExp = buildins.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
30
|
-
buildinsRegExp = new RegExp("^" + buildinsRegExp + "|(!)" + buildinsRegExp, "g");
|
31
|
-
|
32
|
-
this.buildinsAsModule = buildinsAsModule;
|
33
|
-
this.buildinsRegExp = buildinsRegExp;
|
34
|
-
}
|
35
|
-
|
36
|
-
this.nodeModulesRegExp = /\/node_modules\//g;
|
37
|
-
this.indexJsRegExp = /\/index.js(!|\?|\(query\))/g;
|
38
|
-
}
|
39
|
-
module.exports = RequestShortener;
|
40
|
-
|
41
|
-
RequestShortener.prototype.shorten = function(request) {
|
42
|
-
if(!request)
|
43
|
-
return request;
|
44
|
-
request = request.replace(/\\/g, "/");
|
45
|
-
if(this.buildinsAsModule && this.buildinsRegExp)
|
46
|
-
request = request.replace(this.buildinsRegExp, "!(webpack)");
|
47
|
-
if(this.currentDirectoryRegExp)
|
48
|
-
request = request.replace(this.currentDirectoryRegExp, "!.");
|
49
|
-
if(this.parentDirectoryRegExp)
|
50
|
-
request = request.replace(this.parentDirectoryRegExp, "!..");
|
51
|
-
if(!this.buildinsAsModule && this.buildinsRegExp)
|
52
|
-
request = request.replace(this.buildinsRegExp, "!(webpack)");
|
53
|
-
request = request.replace(this.nodeModulesRegExp, "/~/");
|
54
|
-
request = request.replace(this.indexJsRegExp, "$1");
|
55
|
-
return request.replace(/^!|!$/, "");
|
56
|
-
};
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
var path = require("path");
|
6
|
+
|
7
|
+
function RequestShortener(directory) {
|
8
|
+
directory = directory.replace(/\\/g, "/");
|
9
|
+
var parentDirectory = path.dirname(directory);
|
10
|
+
if(/[\/\\]$/.test(directory)) directory = directory.substr(0, directory.length - 1);
|
11
|
+
if(directory) {
|
12
|
+
var currentDirectoryRegExp = directory.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
13
|
+
currentDirectoryRegExp = new RegExp("^" + currentDirectoryRegExp + "|(!)" + currentDirectoryRegExp, "g");
|
14
|
+
|
15
|
+
this.currentDirectoryRegExp = currentDirectoryRegExp;
|
16
|
+
}
|
17
|
+
|
18
|
+
if(/[\/\\]$/.test(parentDirectory)) parentDirectory = parentDirectory.substr(0, parentDirectory.length - 1);
|
19
|
+
if(parentDirectory && parentDirectory !== directory) {
|
20
|
+
var parentDirectoryRegExp = parentDirectory.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
21
|
+
parentDirectoryRegExp = new RegExp("^" + parentDirectoryRegExp + "|(!)" + parentDirectoryRegExp, "g");
|
22
|
+
|
23
|
+
this.parentDirectoryRegExp = parentDirectoryRegExp;
|
24
|
+
}
|
25
|
+
|
26
|
+
if(__dirname.length >= 2) {
|
27
|
+
var buildins = path.join(__dirname, "..").replace(/\\/g, "/");
|
28
|
+
var buildinsAsModule = currentDirectoryRegExp && currentDirectoryRegExp.test(buildins);
|
29
|
+
var buildinsRegExp = buildins.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
30
|
+
buildinsRegExp = new RegExp("^" + buildinsRegExp + "|(!)" + buildinsRegExp, "g");
|
31
|
+
|
32
|
+
this.buildinsAsModule = buildinsAsModule;
|
33
|
+
this.buildinsRegExp = buildinsRegExp;
|
34
|
+
}
|
35
|
+
|
36
|
+
this.nodeModulesRegExp = /\/node_modules\//g;
|
37
|
+
this.indexJsRegExp = /\/index.js(!|\?|\(query\))/g;
|
38
|
+
}
|
39
|
+
module.exports = RequestShortener;
|
40
|
+
|
41
|
+
RequestShortener.prototype.shorten = function(request) {
|
42
|
+
if(!request)
|
43
|
+
return request;
|
44
|
+
request = request.replace(/\\/g, "/");
|
45
|
+
if(this.buildinsAsModule && this.buildinsRegExp)
|
46
|
+
request = request.replace(this.buildinsRegExp, "!(webpack)");
|
47
|
+
if(this.currentDirectoryRegExp)
|
48
|
+
request = request.replace(this.currentDirectoryRegExp, "!.");
|
49
|
+
if(this.parentDirectoryRegExp)
|
50
|
+
request = request.replace(this.parentDirectoryRegExp, "!..");
|
51
|
+
if(!this.buildinsAsModule && this.buildinsRegExp)
|
52
|
+
request = request.replace(this.buildinsRegExp, "!(webpack)");
|
53
|
+
request = request.replace(this.nodeModulesRegExp, "/~/");
|
54
|
+
request = request.replace(this.indexJsRegExp, "$1");
|
55
|
+
return request.replace(/^!|!$/, "");
|
56
|
+
};
|
@@ -1,38 +1,38 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
var ConstDependency = require("./dependencies/ConstDependency");
|
6
|
-
|
7
|
-
var NullFactory = require("./NullFactory");
|
8
|
-
|
9
|
-
function RequireJsStuffPlugin() {}
|
10
|
-
module.exports = RequireJsStuffPlugin;
|
11
|
-
RequireJsStuffPlugin.prototype.apply = function(compiler) {
|
12
|
-
compiler.plugin("compilation", function(compilation) {
|
13
|
-
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
|
14
|
-
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
|
15
|
-
});
|
16
|
-
|
17
|
-
function remove(expr) {
|
18
|
-
var dep = new ConstDependency(";", expr.range);
|
19
|
-
dep.loc = expr.loc;
|
20
|
-
this.state.current.addDependency(dep);
|
21
|
-
return true;
|
22
|
-
}
|
23
|
-
compiler.parser.plugin("call require.config", remove);
|
24
|
-
compiler.parser.plugin("call requirejs.config", remove);
|
25
|
-
|
26
|
-
compiler.parser.plugin("expression require.version", function(expr) {
|
27
|
-
var dep = new ConstDependency(JSON.stringify("0.0.0"), expr.range);
|
28
|
-
dep.loc = expr.loc;
|
29
|
-
this.state.current.addDependency(dep);
|
30
|
-
return true;
|
31
|
-
});
|
32
|
-
compiler.parser.plugin("expression requirejs.onError", function(expr) {
|
33
|
-
var dep = new ConstDependency(JSON.stringify("__webpack_require__.onError"), expr.range);
|
34
|
-
dep.loc = expr.loc;
|
35
|
-
this.state.current.addDependency(dep);
|
36
|
-
return true;
|
37
|
-
});
|
38
|
-
};
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
var ConstDependency = require("./dependencies/ConstDependency");
|
6
|
+
|
7
|
+
var NullFactory = require("./NullFactory");
|
8
|
+
|
9
|
+
function RequireJsStuffPlugin() {}
|
10
|
+
module.exports = RequireJsStuffPlugin;
|
11
|
+
RequireJsStuffPlugin.prototype.apply = function(compiler) {
|
12
|
+
compiler.plugin("compilation", function(compilation) {
|
13
|
+
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
|
14
|
+
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
|
15
|
+
});
|
16
|
+
|
17
|
+
function remove(expr) {
|
18
|
+
var dep = new ConstDependency(";", expr.range);
|
19
|
+
dep.loc = expr.loc;
|
20
|
+
this.state.current.addDependency(dep);
|
21
|
+
return true;
|
22
|
+
}
|
23
|
+
compiler.parser.plugin("call require.config", remove);
|
24
|
+
compiler.parser.plugin("call requirejs.config", remove);
|
25
|
+
|
26
|
+
compiler.parser.plugin("expression require.version", function(expr) {
|
27
|
+
var dep = new ConstDependency(JSON.stringify("0.0.0"), expr.range);
|
28
|
+
dep.loc = expr.loc;
|
29
|
+
this.state.current.addDependency(dep);
|
30
|
+
return true;
|
31
|
+
});
|
32
|
+
compiler.parser.plugin("expression requirejs.onError", function(expr) {
|
33
|
+
var dep = new ConstDependency(JSON.stringify("__webpack_require__.onError"), expr.range);
|
34
|
+
dep.loc = expr.loc;
|
35
|
+
this.state.current.addDependency(dep);
|
36
|
+
return true;
|
37
|
+
});
|
38
|
+
};
|
package/lib/ResolverPlugin.js
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
function ResolverPlugin(plugins, types) {
|
6
|
-
if(!Array.isArray(plugins)) plugins = [plugins];
|
7
|
-
if(!types) types = ["normal"];
|
8
|
-
else if(!Array.isArray(types)) types = [types];
|
9
|
-
|
10
|
-
this.plugins = plugins;
|
11
|
-
this.types = types;
|
12
|
-
}
|
13
|
-
module.exports = ResolverPlugin;
|
14
|
-
|
15
|
-
ResolverPlugin.prototype.apply = function(compiler) {
|
16
|
-
this.types.forEach(function(type) {
|
17
|
-
this.plugins.forEach(function(plugin) {
|
18
|
-
compiler.resolvers[type].apply(plugin);
|
19
|
-
});
|
20
|
-
}, this);
|
21
|
-
};
|
22
|
-
|
23
|
-
ResolverPlugin.UnsafeCachePlugin = require("enhanced-resolve/lib/UnsafeCachePlugin");
|
24
|
-
ResolverPlugin.ModulesInDirectoriesPlugin = require("enhanced-resolve/lib/ModulesInDirectoriesPlugin");
|
25
|
-
ResolverPlugin.ModulesInRootPlugin = require("enhanced-resolve/lib/ModulesInRootPlugin");
|
26
|
-
ResolverPlugin.ModuleTemplatesPlugin = require("enhanced-resolve/lib/ModuleTemplatesPlugin");
|
27
|
-
ResolverPlugin.ModuleAsFilePlugin = require("enhanced-resolve/lib/ModuleAsFilePlugin");
|
28
|
-
ResolverPlugin.ModuleAsDirectoryPlugin = require("enhanced-resolve/lib/ModuleAsDirectoryPlugin");
|
29
|
-
ResolverPlugin.ModuleAliasPlugin = require("enhanced-resolve/lib/ModuleAliasPlugin");
|
30
|
-
ResolverPlugin.DirectoryDefaultFilePlugin = require("enhanced-resolve/lib/DirectoryDefaultFilePlugin");
|
31
|
-
ResolverPlugin.DirectoryDescriptionFilePlugin = require("enhanced-resolve/lib/DirectoryDescriptionFilePlugin");
|
32
|
-
ResolverPlugin.FileAppendPlugin = require("enhanced-resolve/lib/FileAppendPlugin");
|
33
|
-
ResolverPlugin.DirectoryResultPlugin = require("enhanced-resolve/lib/DirectoryResultPlugin");
|
34
|
-
ResolverPlugin.ResultSymlinkPlugin = require("enhanced-resolve/lib/ResultSymlinkPlugin");
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
function ResolverPlugin(plugins, types) {
|
6
|
+
if(!Array.isArray(plugins)) plugins = [plugins];
|
7
|
+
if(!types) types = ["normal"];
|
8
|
+
else if(!Array.isArray(types)) types = [types];
|
9
|
+
|
10
|
+
this.plugins = plugins;
|
11
|
+
this.types = types;
|
12
|
+
}
|
13
|
+
module.exports = ResolverPlugin;
|
14
|
+
|
15
|
+
ResolverPlugin.prototype.apply = function(compiler) {
|
16
|
+
this.types.forEach(function(type) {
|
17
|
+
this.plugins.forEach(function(plugin) {
|
18
|
+
compiler.resolvers[type].apply(plugin);
|
19
|
+
});
|
20
|
+
}, this);
|
21
|
+
};
|
22
|
+
|
23
|
+
ResolverPlugin.UnsafeCachePlugin = require("enhanced-resolve/lib/UnsafeCachePlugin");
|
24
|
+
ResolverPlugin.ModulesInDirectoriesPlugin = require("enhanced-resolve/lib/ModulesInDirectoriesPlugin");
|
25
|
+
ResolverPlugin.ModulesInRootPlugin = require("enhanced-resolve/lib/ModulesInRootPlugin");
|
26
|
+
ResolverPlugin.ModuleTemplatesPlugin = require("enhanced-resolve/lib/ModuleTemplatesPlugin");
|
27
|
+
ResolverPlugin.ModuleAsFilePlugin = require("enhanced-resolve/lib/ModuleAsFilePlugin");
|
28
|
+
ResolverPlugin.ModuleAsDirectoryPlugin = require("enhanced-resolve/lib/ModuleAsDirectoryPlugin");
|
29
|
+
ResolverPlugin.ModuleAliasPlugin = require("enhanced-resolve/lib/ModuleAliasPlugin");
|
30
|
+
ResolverPlugin.DirectoryDefaultFilePlugin = require("enhanced-resolve/lib/DirectoryDefaultFilePlugin");
|
31
|
+
ResolverPlugin.DirectoryDescriptionFilePlugin = require("enhanced-resolve/lib/DirectoryDescriptionFilePlugin");
|
32
|
+
ResolverPlugin.FileAppendPlugin = require("enhanced-resolve/lib/FileAppendPlugin");
|
33
|
+
ResolverPlugin.DirectoryResultPlugin = require("enhanced-resolve/lib/DirectoryResultPlugin");
|
34
|
+
ResolverPlugin.ResultSymlinkPlugin = require("enhanced-resolve/lib/ResultSymlinkPlugin");
|
@@ -1,36 +1,36 @@
|
|
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 SetVarMainTemplatePlugin(varExpression, copyObject) {
|
8
|
-
this.varExpression = varExpression;
|
9
|
-
this.copyObject = copyObject;
|
10
|
-
}
|
11
|
-
module.exports = SetVarMainTemplatePlugin;
|
12
|
-
SetVarMainTemplatePlugin.prototype.apply = function(compilation) {
|
13
|
-
var mainTemplate = compilation.mainTemplate;
|
14
|
-
compilation.templatesPlugin("render-with-entry", function(source, chunk, hash) {
|
15
|
-
var varExpression = mainTemplate.applyPluginsWaterfall("asset-path", this.varExpression, {
|
16
|
-
hash: hash,
|
17
|
-
chunk: chunk
|
18
|
-
});
|
19
|
-
if(this.copyObject) {
|
20
|
-
return new ConcatSource("(function(e, a) { for(var i in a) e[i] = a[i]; }(" +
|
21
|
-
varExpression + ", ", source, "))");
|
22
|
-
} else {
|
23
|
-
var prefix = varExpression + " =\n";
|
24
|
-
return new ConcatSource(prefix, source);
|
25
|
-
}
|
26
|
-
}.bind(this));
|
27
|
-
mainTemplate.plugin("global-hash-paths", function(paths) {
|
28
|
-
if(this.varExpression) paths.push(this.varExpression);
|
29
|
-
return paths;
|
30
|
-
});
|
31
|
-
mainTemplate.plugin("hash", function(hash) {
|
32
|
-
hash.update("set var");
|
33
|
-
hash.update(this.varExpression + "");
|
34
|
-
hash.update(this.copyObject + "");
|
35
|
-
}.bind(this));
|
36
|
-
};
|
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 SetVarMainTemplatePlugin(varExpression, copyObject) {
|
8
|
+
this.varExpression = varExpression;
|
9
|
+
this.copyObject = copyObject;
|
10
|
+
}
|
11
|
+
module.exports = SetVarMainTemplatePlugin;
|
12
|
+
SetVarMainTemplatePlugin.prototype.apply = function(compilation) {
|
13
|
+
var mainTemplate = compilation.mainTemplate;
|
14
|
+
compilation.templatesPlugin("render-with-entry", function(source, chunk, hash) {
|
15
|
+
var varExpression = mainTemplate.applyPluginsWaterfall("asset-path", this.varExpression, {
|
16
|
+
hash: hash,
|
17
|
+
chunk: chunk
|
18
|
+
});
|
19
|
+
if(this.copyObject) {
|
20
|
+
return new ConcatSource("(function(e, a) { for(var i in a) e[i] = a[i]; }(" +
|
21
|
+
varExpression + ", ", source, "))");
|
22
|
+
} else {
|
23
|
+
var prefix = varExpression + " =\n";
|
24
|
+
return new ConcatSource(prefix, source);
|
25
|
+
}
|
26
|
+
}.bind(this));
|
27
|
+
mainTemplate.plugin("global-hash-paths", function(paths) {
|
28
|
+
if(this.varExpression) paths.push(this.varExpression);
|
29
|
+
return paths;
|
30
|
+
});
|
31
|
+
mainTemplate.plugin("hash", function(hash) {
|
32
|
+
hash.update("set var");
|
33
|
+
hash.update(this.varExpression + "");
|
34
|
+
hash.update(this.copyObject + "");
|
35
|
+
}.bind(this));
|
36
|
+
};
|
package/lib/SingleEntryPlugin.js
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
var SingleEntryDependency = require("./dependencies/SingleEntryDependency");
|
6
|
-
|
7
|
-
function SingleEntryPlugin(context, entry, name) {
|
8
|
-
this.context = context;
|
9
|
-
this.entry = entry;
|
10
|
-
this.name = name;
|
11
|
-
}
|
12
|
-
module.exports = SingleEntryPlugin;
|
13
|
-
SingleEntryPlugin.prototype.apply = function(compiler) {
|
14
|
-
compiler.plugin("compilation", function(compilation, params) {
|
15
|
-
var normalModuleFactory = params.normalModuleFactory;
|
16
|
-
|
17
|
-
compilation.dependencyFactories.set(SingleEntryDependency, normalModuleFactory);
|
18
|
-
});
|
19
|
-
compiler.plugin("make", function(compilation, callback) {
|
20
|
-
var dep = new SingleEntryDependency(this.entry);
|
21
|
-
dep.loc = this.name;
|
22
|
-
compilation.addEntry(this.context, dep, this.name, callback);
|
23
|
-
}.bind(this));
|
24
|
-
};
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
var SingleEntryDependency = require("./dependencies/SingleEntryDependency");
|
6
|
+
|
7
|
+
function SingleEntryPlugin(context, entry, name) {
|
8
|
+
this.context = context;
|
9
|
+
this.entry = entry;
|
10
|
+
this.name = name;
|
11
|
+
}
|
12
|
+
module.exports = SingleEntryPlugin;
|
13
|
+
SingleEntryPlugin.prototype.apply = function(compiler) {
|
14
|
+
compiler.plugin("compilation", function(compilation, params) {
|
15
|
+
var normalModuleFactory = params.normalModuleFactory;
|
16
|
+
|
17
|
+
compilation.dependencyFactories.set(SingleEntryDependency, normalModuleFactory);
|
18
|
+
});
|
19
|
+
compiler.plugin("make", function(compilation, callback) {
|
20
|
+
var dep = new SingleEntryDependency(this.entry);
|
21
|
+
dep.loc = this.name;
|
22
|
+
compilation.addEntry(this.context, dep, this.name, callback);
|
23
|
+
}.bind(this));
|
24
|
+
};
|
package/lib/Source.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
/*
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
-
Author Tobias Koppers @sokra
|
4
|
-
*/
|
5
|
-
module.exports = require("webpack-core/lib/Source");
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
module.exports = require("webpack-core/lib/Source");
|