webpack 4.9.1 → 4.10.2
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/README.md +755 -755
- package/SECURITY.md +9 -9
- package/buildin/global.js +20 -20
- package/buildin/harmony-module.js +24 -24
- package/buildin/module.js +22 -22
- package/hot/dev-server.js +61 -61
- package/hot/log-apply-result.js +44 -44
- package/hot/log.js +45 -45
- package/hot/only-dev-server.js +105 -105
- package/hot/poll.js +37 -37
- package/hot/signal.js +62 -62
- package/lib/APIPlugin.js +84 -84
- package/lib/AmdMainTemplatePlugin.js +87 -75
- package/lib/AsyncDependenciesBlock.js +66 -66
- package/lib/AsyncDependencyToInitialChunkError.js +31 -21
- package/lib/AutomaticPrefetchPlugin.js +50 -50
- package/lib/BannerPlugin.js +3 -1
- package/lib/BasicEvaluatedExpression.js +211 -208
- package/lib/CachePlugin.js +102 -95
- package/lib/CaseSensitiveModulesWarning.js +71 -53
- package/lib/Chunk.js +750 -722
- package/lib/ChunkGroup.js +13 -5
- package/lib/ChunkRenderError.js +32 -32
- package/lib/CompatibilityPlugin.js +63 -63
- package/lib/Compilation.js +1947 -1905
- package/lib/Compiler.js +508 -496
- package/lib/ConcurrentCompilationError.js +19 -19
- package/lib/ConstPlugin.js +258 -242
- package/lib/ContextExclusionPlugin.js +17 -17
- package/lib/ContextModule.js +749 -710
- package/lib/ContextModuleFactory.js +256 -245
- package/lib/ContextReplacementPlugin.js +133 -126
- package/lib/DefinePlugin.js +206 -197
- package/lib/DelegatedModule.js +101 -101
- package/lib/DelegatedModuleFactoryPlugin.js +89 -89
- package/lib/DelegatedPlugin.js +39 -39
- package/lib/DependenciesBlock.js +89 -87
- package/lib/DependenciesBlockVariable.js +52 -51
- package/lib/Dependency.js +51 -51
- package/lib/DllEntryPlugin.js +51 -51
- package/lib/DllModule.js +54 -54
- package/lib/DllModuleFactory.js +29 -29
- package/lib/DllPlugin.js +44 -42
- package/lib/DllReferencePlugin.js +84 -84
- package/lib/DynamicEntryPlugin.js +73 -71
- package/lib/EntryOptionPlugin.js +33 -33
- package/lib/EnvironmentPlugin.js +65 -65
- package/lib/ErrorHelpers.js +60 -57
- package/lib/EvalDevToolModulePlugin.js +27 -27
- package/lib/EvalDevToolModuleTemplatePlugin.js +61 -61
- package/lib/EvalSourceMapDevToolPlugin.js +41 -40
- package/lib/ExportPropertyMainTemplatePlugin.js +53 -40
- package/lib/ExtendedAPIPlugin.js +84 -84
- package/lib/ExternalModule.js +159 -159
- package/lib/ExternalModuleFactoryPlugin.js +110 -110
- package/lib/ExternalsPlugin.js +23 -23
- package/lib/FlagDependencyExportsPlugin.js +146 -146
- package/lib/FlagDependencyUsagePlugin.js +110 -104
- package/lib/FlagInitialModulesAsUsedPlugin.js +36 -36
- package/lib/FunctionModulePlugin.js +19 -19
- package/lib/FunctionModuleTemplatePlugin.js +100 -98
- package/lib/GraphHelpers.js +64 -64
- package/lib/HarmonyLinkingError.js +18 -18
- package/lib/HashedModuleIdsPlugin.js +53 -53
- package/lib/HotModuleReplacement.runtime.js +7 -3
- package/lib/HotModuleReplacementPlugin.js +413 -406
- package/lib/HotUpdateChunk.js +16 -16
- package/lib/HotUpdateChunkTemplate.js +78 -78
- package/lib/IgnorePlugin.js +71 -71
- package/lib/JavascriptGenerator.js +229 -228
- package/lib/JavascriptModulesPlugin.js +179 -184
- package/lib/JsonGenerator.js +42 -42
- package/lib/JsonModulesPlugin.js +30 -30
- package/lib/JsonParser.js +27 -26
- package/lib/LibManifestPlugin.js +86 -86
- package/lib/LibraryTemplatePlugin.js +153 -119
- package/lib/LoaderOptionsPlugin.js +53 -52
- package/lib/LoaderTargetPlugin.js +24 -24
- package/lib/MainTemplate.js +34 -9
- package/lib/Module.js +381 -377
- package/lib/ModuleBuildError.js +42 -42
- package/lib/ModuleDependencyError.js +35 -25
- package/lib/ModuleDependencyWarning.js +25 -25
- package/lib/ModuleError.js +28 -28
- package/lib/ModuleFilenameHelpers.js +178 -166
- package/lib/ModuleParseError.js +44 -44
- package/lib/ModuleReason.js +40 -40
- package/lib/ModuleTemplate.js +84 -84
- package/lib/ModuleWarning.js +30 -30
- package/lib/MultiCompiler.js +283 -271
- package/lib/MultiEntryPlugin.js +58 -58
- package/lib/MultiModule.js +81 -78
- package/lib/MultiModuleFactory.js +23 -23
- package/lib/MultiStats.js +92 -92
- package/lib/MultiWatching.js +38 -38
- package/lib/NamedChunksPlugin.js +29 -29
- package/lib/NamedModulesPlugin.js +57 -57
- package/lib/NoEmitOnErrorsPlugin.js +20 -20
- package/lib/NoModeWarning.js +23 -23
- package/lib/NodeStuffPlugin.js +179 -178
- package/lib/NormalModule.js +497 -490
- package/lib/NormalModuleFactory.js +501 -483
- package/lib/NormalModuleReplacementPlugin.js +51 -51
- package/lib/OptionsDefaulter.js +84 -80
- package/lib/Parser.js +2164 -2086
- package/lib/ParserHelpers.js +103 -100
- package/lib/PrefetchPlugin.js +37 -37
- package/lib/ProgressPlugin.js +231 -231
- package/lib/ProvidePlugin.js +86 -86
- package/lib/RawModule.js +56 -54
- package/lib/RecordIdsPlugin.js +166 -162
- package/lib/RemovedPluginError.js +13 -13
- package/lib/RequestShortener.js +81 -74
- package/lib/RequireJsStuffPlugin.js +69 -69
- package/lib/ResolverFactory.js +64 -64
- package/lib/RuleSet.js +555 -534
- package/lib/RuntimeTemplate.js +320 -277
- package/lib/SetVarMainTemplatePlugin.js +69 -57
- package/lib/SingleEntryPlugin.js +44 -44
- package/lib/SizeFormatHelpers.js +24 -24
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +49 -49
- package/lib/SourceMapDevToolPlugin.js +301 -300
- package/lib/Stats.js +1408 -1367
- package/lib/Template.js +4 -2
- package/lib/TemplatedPathPlugin.js +173 -170
- package/lib/UmdMainTemplatePlugin.js +304 -264
- package/lib/UseStrictPlugin.js +48 -48
- package/lib/WarnCaseSensitiveModulesPlugin.js +37 -36
- package/lib/WarnNoModeSetPlugin.js +17 -17
- package/lib/WatchIgnorePlugin.js +100 -100
- package/lib/Watching.js +194 -193
- package/lib/WebpackError.js +25 -19
- package/lib/WebpackOptionsApply.js +421 -405
- package/lib/WebpackOptionsDefaulter.js +347 -344
- package/lib/WebpackOptionsValidationError.js +345 -316
- package/lib/compareLocations.js +56 -56
- package/lib/dependencies/AMDDefineDependency.js +137 -137
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +336 -327
- package/lib/dependencies/AMDPlugin.js +250 -250
- package/lib/dependencies/AMDRequireArrayDependency.js +49 -49
- package/lib/dependencies/AMDRequireContextDependency.js +20 -20
- package/lib/dependencies/AMDRequireDependenciesBlock.js +43 -43
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +273 -270
- package/lib/dependencies/AMDRequireDependency.js +135 -135
- package/lib/dependencies/CommonJsPlugin.js +161 -161
- package/lib/dependencies/CommonJsRequireContextDependency.js +23 -23
- package/lib/dependencies/CommonJsRequireDependencyParserPlugin.js +130 -130
- package/lib/dependencies/ConstDependency.js +33 -33
- package/lib/dependencies/ContextDependency.js +68 -68
- package/lib/dependencies/ContextDependencyTemplateAsId.js +42 -42
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +38 -38
- package/lib/dependencies/ContextElementDependency.js +21 -21
- package/lib/dependencies/DelegatedExportsDependency.js +33 -33
- package/lib/dependencies/DependencyReference.js +18 -18
- package/lib/dependencies/HarmonyAcceptDependency.js +45 -45
- package/lib/dependencies/HarmonyAcceptImportDependency.js +23 -23
- package/lib/dependencies/HarmonyCompatibilityDependency.js +31 -31
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +92 -90
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +139 -139
- package/lib/dependencies/HarmonyExportExpressionDependency.js +53 -53
- package/lib/dependencies/HarmonyExportHeaderDependency.js +30 -30
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +620 -603
- package/lib/dependencies/HarmonyExportSpecifierDependency.js +54 -54
- package/lib/dependencies/HarmonyImportDependency.js +104 -94
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +217 -214
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +31 -31
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +166 -156
- package/lib/dependencies/HarmonyInitDependency.js +60 -60
- package/lib/dependencies/HarmonyModulesPlugin.js +146 -146
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +26 -26
- package/lib/dependencies/ImportContextDependency.js +23 -23
- package/lib/dependencies/ImportDependenciesBlock.js +18 -18
- package/lib/dependencies/ImportDependency.js +34 -34
- package/lib/dependencies/ImportEagerDependency.js +32 -32
- package/lib/dependencies/ImportParserPlugin.js +233 -232
- package/lib/dependencies/ImportPlugin.js +82 -82
- package/lib/dependencies/ImportWeakDependency.js +34 -34
- package/lib/dependencies/JsonExportsDependency.js +26 -26
- package/lib/dependencies/LoaderPlugin.js +98 -93
- package/lib/dependencies/LocalModuleDependency.js +28 -28
- package/lib/dependencies/LocalModulesHelpers.js +52 -45
- package/lib/dependencies/ModuleDependency.js +20 -20
- package/lib/dependencies/ModuleDependencyTemplateAsId.js +17 -17
- package/lib/dependencies/ModuleDependencyTemplateAsRequireId.js +17 -17
- package/lib/dependencies/MultiEntryDependency.js +20 -20
- package/lib/dependencies/NullDependency.js +20 -20
- package/lib/dependencies/RequireContextDependency.js +22 -22
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +56 -56
- package/lib/dependencies/RequireContextPlugin.js +143 -141
- package/lib/dependencies/RequireEnsureDependenciesBlock.js +33 -33
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +116 -112
- package/lib/dependencies/RequireEnsureDependency.js +58 -58
- package/lib/dependencies/RequireEnsurePlugin.js +74 -74
- package/lib/dependencies/RequireHeaderDependency.js +26 -26
- package/lib/dependencies/RequireIncludeDependency.js +39 -39
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +23 -23
- package/lib/dependencies/RequireIncludePlugin.js +61 -61
- package/lib/dependencies/RequireResolveContextDependency.js +23 -23
- package/lib/dependencies/RequireResolveDependencyParserPlugin.js +85 -85
- package/lib/dependencies/RequireResolveHeaderDependency.js +26 -26
- package/lib/dependencies/SingleEntryDependency.js +18 -18
- package/lib/dependencies/SystemPlugin.js +125 -125
- package/lib/dependencies/UnsupportedDependency.js +27 -27
- package/lib/dependencies/WebAssemblyImportDependency.js +48 -44
- package/lib/dependencies/WebpackMissingModule.js +20 -20
- package/lib/dependencies/getFunctionExpression.js +52 -52
- package/lib/formatLocation.js +61 -53
- package/lib/node/NodeChunkTemplatePlugin.js +31 -31
- package/lib/node/NodeEnvironmentPlugin.js +28 -28
- package/lib/node/NodeHotUpdateChunkTemplatePlugin.js +36 -36
- package/lib/node/NodeMainTemplate.runtime.js +27 -27
- package/lib/node/NodeMainTemplateAsync.runtime.js +44 -44
- package/lib/node/NodeMainTemplatePlugin.js +323 -320
- package/lib/node/NodeSourcePlugin.js +144 -140
- package/lib/node/NodeTargetPlugin.js +18 -18
- package/lib/node/NodeTemplatePlugin.js +31 -31
- package/lib/node/NodeWatchFileSystem.js +99 -82
- package/lib/node/ReadFileCompileWasmTemplatePlugin.js +52 -52
- package/lib/optimize/AggressiveMergingPlugin.js +87 -87
- package/lib/optimize/AggressiveSplittingPlugin.js +287 -281
- package/lib/optimize/ChunkModuleIdRangePlugin.js +68 -68
- package/lib/optimize/ConcatenatedModule.js +1420 -1413
- package/lib/optimize/EnsureChunkConditionsPlugin.js +70 -70
- package/lib/optimize/FlagIncludedChunksPlugin.js +99 -99
- package/lib/optimize/LimitChunkCountPlugin.js +66 -66
- package/lib/optimize/MergeDuplicateChunksPlugin.js +78 -75
- package/lib/optimize/MinChunkSizePlugin.js +77 -77
- package/lib/optimize/ModuleConcatenationPlugin.js +470 -457
- package/lib/optimize/OccurrenceOrderPlugin.js +133 -126
- package/lib/optimize/RemoveParentModulesPlugin.js +127 -117
- package/lib/optimize/RuntimeChunkPlugin.js +41 -41
- package/lib/optimize/SideEffectsFlagPlugin.js +158 -156
- package/lib/optimize/SplitChunksPlugin.js +709 -696
- package/lib/performance/AssetsOverSizeLimitWarning.js +30 -30
- package/lib/performance/EntrypointsOverSizeLimitWarning.js +31 -31
- package/lib/performance/NoAsyncChunksWarning.js +21 -21
- package/lib/performance/SizeLimitsPlugin.js +105 -105
- package/lib/util/Semaphore.js +41 -41
- package/lib/util/SortableSet.js +5 -2
- package/lib/util/StackedSetMap.js +12 -5
- package/lib/util/TrackingSet.js +35 -35
- package/lib/util/cachedMerge.js +35 -35
- package/lib/util/createHash.js +77 -77
- package/lib/util/identifier.js +76 -76
- package/lib/validateSchema.js +67 -67
- package/lib/wasm/UnsupportedWebAssemblyFeatureError.js +18 -18
- package/lib/wasm/WasmMainTemplatePlugin.js +310 -304
- package/lib/wasm/WebAssemblyGenerator.js +143 -19
- package/lib/wasm/WebAssemblyJavascriptGenerator.js +90 -107
- package/lib/wasm/WebAssemblyModulesPlugin.js +80 -80
- package/lib/wasm/WebAssemblyParser.js +28 -5
- package/lib/wasm/WebAssemblyUtils.js +48 -0
- package/lib/web/FetchCompileWasmTemplatePlugin.js +25 -25
- package/lib/web/JsonpChunkTemplatePlugin.js +47 -47
- package/lib/web/JsonpExportMainTemplatePlugin.js +47 -47
- package/lib/web/JsonpHotUpdateChunkTemplatePlugin.js +39 -39
- package/lib/web/JsonpMainTemplate.runtime.js +65 -64
- package/lib/web/JsonpMainTemplatePlugin.js +576 -574
- package/lib/web/JsonpTemplatePlugin.js +23 -23
- package/lib/webpack.js +183 -182
- package/lib/webpack.web.js +31 -31
- package/lib/webworker/WebWorkerChunkTemplatePlugin.js +35 -35
- package/lib/webworker/WebWorkerHotUpdateChunkTemplatePlugin.js +40 -40
- package/lib/webworker/WebWorkerMainTemplate.runtime.js +65 -64
- package/lib/webworker/WebWorkerMainTemplatePlugin.js +179 -179
- package/lib/webworker/WebWorkerTemplatePlugin.js +25 -25
- package/package.json +9 -8
- package/schemas/WebpackOptions.json +1988 -1988
- package/schemas/ajv.absolutePath.js +55 -55
- package/schemas/plugins/DllPlugin.json +32 -32
- package/schemas/plugins/DllReferencePlugin.json +99 -99
- package/schemas/plugins/HashedModuleIdsPlugin.json +24 -24
- package/schemas/plugins/LoaderOptionsPlugin.json +26 -26
- package/schemas/plugins/SourceMapDevToolPlugin.json +187 -187
- package/schemas/plugins/WatchIgnorePlugin.json +16 -16
- package/schemas/plugins/debug/ProfilingPlugin.json +12 -12
- package/schemas/plugins/optimize/AggressiveSplittingPlugin.json +22 -22
- package/schemas/plugins/optimize/LimitChunkCountPlugin.json +15 -15
- package/schemas/plugins/optimize/MinChunkSizePlugin.json +13 -13
package/lib/ContextModule.js
CHANGED
|
@@ -1,710 +1,749 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
"use strict";
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const util = require("util");
|
|
8
|
-
const { OriginalSource, RawSource } = require("webpack-sources");
|
|
9
|
-
const Module = require("./Module");
|
|
10
|
-
const AsyncDependenciesBlock = require("./AsyncDependenciesBlock");
|
|
11
|
-
const Template = require("./Template");
|
|
12
|
-
|
|
13
|
-
class ContextModule extends Module {
|
|
14
|
-
// type ContextMode = "sync" | "eager" | "weak" | "async-weak" | "lazy" | "lazy-once"
|
|
15
|
-
// type ContextOptions = { resource: string, recursive: boolean, regExp: RegExp, addon?: string, mode?: ContextMode, chunkName?: string, include?: RegExp, exclude?: RegExp, groupOptions?: Object }
|
|
16
|
-
// resolveDependencies: (fs: FS, options: ContextOptions, (err: Error?, dependencies: Dependency[]) => void) => void
|
|
17
|
-
// options: ContextOptions
|
|
18
|
-
constructor(resolveDependencies, options) {
|
|
19
|
-
let resource;
|
|
20
|
-
let resourceQuery;
|
|
21
|
-
const queryIdx = options.resource.indexOf("?");
|
|
22
|
-
if (queryIdx >= 0) {
|
|
23
|
-
resource = options.resource.substr(0, queryIdx);
|
|
24
|
-
resourceQuery = options.resource.substr(queryIdx);
|
|
25
|
-
} else {
|
|
26
|
-
resource = options.resource;
|
|
27
|
-
resourceQuery = "";
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
super("javascript/dynamic", resource);
|
|
31
|
-
|
|
32
|
-
// Info from Factory
|
|
33
|
-
this.resolveDependencies = resolveDependencies;
|
|
34
|
-
this.options = Object.assign({}, options, {
|
|
35
|
-
resource: resource,
|
|
36
|
-
resourceQuery: resourceQuery
|
|
37
|
-
});
|
|
38
|
-
if (options.resolveOptions !== undefined)
|
|
39
|
-
this.resolveOptions = options.resolveOptions;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (this.options.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (this.options.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (this.options.
|
|
85
|
-
identifier +=
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (this.options.
|
|
105
|
-
|
|
106
|
-
if (this.options.
|
|
107
|
-
identifier +=
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (this.options.
|
|
120
|
-
identifier +=
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (this.options.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (this.options.include)
|
|
135
|
-
identifier += ` include: ${this.prettyRegExp(this.options.include + "")}`;
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
)
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
if (
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
if
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
const
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
}
|
|
454
|
-
webpackAsyncContext.
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
const
|
|
465
|
-
const
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
${
|
|
476
|
-
|
|
477
|
-
function
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
e
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
webpackAsyncContext.
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
var
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
return
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
)
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
"use strict";
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const util = require("util");
|
|
8
|
+
const { OriginalSource, RawSource } = require("webpack-sources");
|
|
9
|
+
const Module = require("./Module");
|
|
10
|
+
const AsyncDependenciesBlock = require("./AsyncDependenciesBlock");
|
|
11
|
+
const Template = require("./Template");
|
|
12
|
+
|
|
13
|
+
class ContextModule extends Module {
|
|
14
|
+
// type ContextMode = "sync" | "eager" | "weak" | "async-weak" | "lazy" | "lazy-once"
|
|
15
|
+
// type ContextOptions = { resource: string, recursive: boolean, regExp: RegExp, addon?: string, mode?: ContextMode, chunkName?: string, include?: RegExp, exclude?: RegExp, groupOptions?: Object }
|
|
16
|
+
// resolveDependencies: (fs: FS, options: ContextOptions, (err: Error?, dependencies: Dependency[]) => void) => void
|
|
17
|
+
// options: ContextOptions
|
|
18
|
+
constructor(resolveDependencies, options) {
|
|
19
|
+
let resource;
|
|
20
|
+
let resourceQuery;
|
|
21
|
+
const queryIdx = options.resource.indexOf("?");
|
|
22
|
+
if (queryIdx >= 0) {
|
|
23
|
+
resource = options.resource.substr(0, queryIdx);
|
|
24
|
+
resourceQuery = options.resource.substr(queryIdx);
|
|
25
|
+
} else {
|
|
26
|
+
resource = options.resource;
|
|
27
|
+
resourceQuery = "";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
super("javascript/dynamic", resource);
|
|
31
|
+
|
|
32
|
+
// Info from Factory
|
|
33
|
+
this.resolveDependencies = resolveDependencies;
|
|
34
|
+
this.options = Object.assign({}, options, {
|
|
35
|
+
resource: resource,
|
|
36
|
+
resourceQuery: resourceQuery
|
|
37
|
+
});
|
|
38
|
+
if (options.resolveOptions !== undefined) {
|
|
39
|
+
this.resolveOptions = options.resolveOptions;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Info from Build
|
|
43
|
+
this._contextDependencies = new Set([this.context]);
|
|
44
|
+
|
|
45
|
+
if (typeof options.mode !== "string") {
|
|
46
|
+
throw new Error("options.mode is a required option");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
this._identifier = this._createIdentifier();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
updateCacheModule(module) {
|
|
53
|
+
this.resolveDependencies = module.resolveDependencies;
|
|
54
|
+
this.options = module.options;
|
|
55
|
+
this.resolveOptions = module.resolveOptions;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
prettyRegExp(regexString) {
|
|
59
|
+
// remove the "/" at the front and the beginning
|
|
60
|
+
// "/foo/" -> "foo"
|
|
61
|
+
return regexString.substring(1, regexString.length - 1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
contextify(context, request) {
|
|
65
|
+
return request
|
|
66
|
+
.split("!")
|
|
67
|
+
.map(subrequest => {
|
|
68
|
+
let rp = path.relative(context, subrequest);
|
|
69
|
+
if (path.sep === "\\") rp = rp.replace(/\\/g, "/");
|
|
70
|
+
if (rp.indexOf("../") !== 0) rp = "./" + rp;
|
|
71
|
+
return rp;
|
|
72
|
+
})
|
|
73
|
+
.join("!");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
_createIdentifier() {
|
|
77
|
+
let identifier = this.context;
|
|
78
|
+
if (this.options.resourceQuery) {
|
|
79
|
+
identifier += ` ${this.options.resourceQuery}`;
|
|
80
|
+
}
|
|
81
|
+
if (this.options.mode) {
|
|
82
|
+
identifier += ` ${this.options.mode}`;
|
|
83
|
+
}
|
|
84
|
+
if (!this.options.recursive) {
|
|
85
|
+
identifier += " nonrecursive";
|
|
86
|
+
}
|
|
87
|
+
if (this.options.addon) {
|
|
88
|
+
identifier += ` ${this.options.addon}`;
|
|
89
|
+
}
|
|
90
|
+
if (this.options.regExp) {
|
|
91
|
+
identifier += ` ${this.options.regExp}`;
|
|
92
|
+
}
|
|
93
|
+
if (this.options.include) {
|
|
94
|
+
identifier += ` include: ${this.options.include}`;
|
|
95
|
+
}
|
|
96
|
+
if (this.options.exclude) {
|
|
97
|
+
identifier += ` exclude: ${this.options.exclude}`;
|
|
98
|
+
}
|
|
99
|
+
if (this.options.groupOptions) {
|
|
100
|
+
identifier += ` groupOptions: ${JSON.stringify(
|
|
101
|
+
this.options.groupOptions
|
|
102
|
+
)}`;
|
|
103
|
+
}
|
|
104
|
+
if (this.options.namespaceObject === "strict") {
|
|
105
|
+
identifier += " strict namespace object";
|
|
106
|
+
} else if (this.options.namespaceObject) {
|
|
107
|
+
identifier += " namespace object";
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return identifier;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
identifier() {
|
|
114
|
+
return this._identifier;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
readableIdentifier(requestShortener) {
|
|
118
|
+
let identifier = requestShortener.shorten(this.context);
|
|
119
|
+
if (this.options.resourceQuery) {
|
|
120
|
+
identifier += ` ${this.options.resourceQuery}`;
|
|
121
|
+
}
|
|
122
|
+
if (this.options.mode) {
|
|
123
|
+
identifier += ` ${this.options.mode}`;
|
|
124
|
+
}
|
|
125
|
+
if (!this.options.recursive) {
|
|
126
|
+
identifier += " nonrecursive";
|
|
127
|
+
}
|
|
128
|
+
if (this.options.addon) {
|
|
129
|
+
identifier += ` ${requestShortener.shorten(this.options.addon)}`;
|
|
130
|
+
}
|
|
131
|
+
if (this.options.regExp) {
|
|
132
|
+
identifier += ` ${this.prettyRegExp(this.options.regExp + "")}`;
|
|
133
|
+
}
|
|
134
|
+
if (this.options.include) {
|
|
135
|
+
identifier += ` include: ${this.prettyRegExp(this.options.include + "")}`;
|
|
136
|
+
}
|
|
137
|
+
if (this.options.exclude) {
|
|
138
|
+
identifier += ` exclude: ${this.prettyRegExp(this.options.exclude + "")}`;
|
|
139
|
+
}
|
|
140
|
+
if (this.options.groupOptions) {
|
|
141
|
+
const groupOptions = this.options.groupOptions;
|
|
142
|
+
for (const key of Object.keys(groupOptions)) {
|
|
143
|
+
identifier += ` ${key}: ${groupOptions[key]}`;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (this.options.namespaceObject === "strict") {
|
|
147
|
+
identifier += " strict namespace object";
|
|
148
|
+
} else if (this.options.namespaceObject) {
|
|
149
|
+
identifier += " namespace object";
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return identifier;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
libIdent(options) {
|
|
156
|
+
let identifier = this.contextify(options.context, this.context);
|
|
157
|
+
if (this.options.mode) {
|
|
158
|
+
identifier += ` ${this.options.mode}`;
|
|
159
|
+
}
|
|
160
|
+
if (this.options.recursive) {
|
|
161
|
+
identifier += " recursive";
|
|
162
|
+
}
|
|
163
|
+
if (this.options.addon) {
|
|
164
|
+
identifier += ` ${this.contextify(options.context, this.options.addon)}`;
|
|
165
|
+
}
|
|
166
|
+
if (this.options.regExp) {
|
|
167
|
+
identifier += ` ${this.prettyRegExp(this.options.regExp + "")}`;
|
|
168
|
+
}
|
|
169
|
+
if (this.options.include) {
|
|
170
|
+
identifier += ` include: ${this.prettyRegExp(this.options.include + "")}`;
|
|
171
|
+
}
|
|
172
|
+
if (this.options.exclude) {
|
|
173
|
+
identifier += ` exclude: ${this.prettyRegExp(this.options.exclude + "")}`;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return identifier;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
needRebuild(fileTimestamps, contextTimestamps) {
|
|
180
|
+
const ts = contextTimestamps.get(this.context);
|
|
181
|
+
if (!ts) {
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return ts >= this.buildInfo.builtTime;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
build(options, compilation, resolver, fs, callback) {
|
|
189
|
+
this.built = true;
|
|
190
|
+
this.buildMeta = {};
|
|
191
|
+
this.buildInfo = {
|
|
192
|
+
builtTime: Date.now(),
|
|
193
|
+
contextDependencies: this._contextDependencies
|
|
194
|
+
};
|
|
195
|
+
this.resolveDependencies(fs, this.options, (err, dependencies) => {
|
|
196
|
+
if (err) return callback(err);
|
|
197
|
+
|
|
198
|
+
// abort if something failed
|
|
199
|
+
// this will create an empty context
|
|
200
|
+
if (!dependencies) {
|
|
201
|
+
callback();
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// enhance dependencies with meta info
|
|
206
|
+
for (const dep of dependencies) {
|
|
207
|
+
dep.loc = dep.userRequest;
|
|
208
|
+
dep.request = this.options.addon + dep.request;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (this.options.mode === "sync" || this.options.mode === "eager") {
|
|
212
|
+
// if we have an sync or eager context
|
|
213
|
+
// just add all dependencies and continue
|
|
214
|
+
this.dependencies = dependencies;
|
|
215
|
+
} else if (this.options.mode === "lazy-once") {
|
|
216
|
+
// for the lazy-once mode create a new async dependency block
|
|
217
|
+
// and add that block to this context
|
|
218
|
+
if (dependencies.length > 0) {
|
|
219
|
+
const block = new AsyncDependenciesBlock(
|
|
220
|
+
Object.assign({}, this.options.groupOptions, {
|
|
221
|
+
name: this.options.chunkName
|
|
222
|
+
}),
|
|
223
|
+
this
|
|
224
|
+
);
|
|
225
|
+
for (const dep of dependencies) {
|
|
226
|
+
block.addDependency(dep);
|
|
227
|
+
}
|
|
228
|
+
this.addBlock(block);
|
|
229
|
+
}
|
|
230
|
+
} else if (
|
|
231
|
+
this.options.mode === "weak" ||
|
|
232
|
+
this.options.mode === "async-weak"
|
|
233
|
+
) {
|
|
234
|
+
// we mark all dependencies as weak
|
|
235
|
+
for (const dep of dependencies) {
|
|
236
|
+
dep.weak = true;
|
|
237
|
+
}
|
|
238
|
+
this.dependencies = dependencies;
|
|
239
|
+
} else if (this.options.mode === "lazy") {
|
|
240
|
+
// if we are lazy create a new async dependency block per dependency
|
|
241
|
+
// and add all blocks to this context
|
|
242
|
+
let index = 0;
|
|
243
|
+
for (const dep of dependencies) {
|
|
244
|
+
let chunkName = this.options.chunkName;
|
|
245
|
+
if (chunkName) {
|
|
246
|
+
if (!/\[(index|request)\]/.test(chunkName)) {
|
|
247
|
+
chunkName += "[index]";
|
|
248
|
+
}
|
|
249
|
+
chunkName = chunkName.replace(/\[index\]/g, index++);
|
|
250
|
+
chunkName = chunkName.replace(
|
|
251
|
+
/\[request\]/g,
|
|
252
|
+
Template.toPath(dep.userRequest)
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
const block = new AsyncDependenciesBlock(
|
|
256
|
+
Object.assign({}, this.options.groupOptions, {
|
|
257
|
+
name: chunkName
|
|
258
|
+
}),
|
|
259
|
+
dep.module,
|
|
260
|
+
dep.loc,
|
|
261
|
+
dep.userRequest
|
|
262
|
+
);
|
|
263
|
+
block.addDependency(dep);
|
|
264
|
+
this.addBlock(block);
|
|
265
|
+
}
|
|
266
|
+
} else {
|
|
267
|
+
callback(
|
|
268
|
+
new Error(`Unsupported mode "${this.options.mode}" in context`)
|
|
269
|
+
);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
callback();
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
getUserRequestMap(dependencies) {
|
|
277
|
+
// if we filter first we get a new array
|
|
278
|
+
// therefor we dont need to create a clone of dependencies explicitly
|
|
279
|
+
// therefore the order of this is !important!
|
|
280
|
+
return dependencies
|
|
281
|
+
.filter(dependency => dependency.module)
|
|
282
|
+
.sort((a, b) => {
|
|
283
|
+
if (a.userRequest === b.userRequest) {
|
|
284
|
+
return 0;
|
|
285
|
+
}
|
|
286
|
+
return a.userRequest < b.userRequest ? -1 : 1;
|
|
287
|
+
})
|
|
288
|
+
.reduce((map, dep) => {
|
|
289
|
+
map[dep.userRequest] = dep.module.id;
|
|
290
|
+
return map;
|
|
291
|
+
}, Object.create(null));
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
getFakeMap(dependencies) {
|
|
295
|
+
if (!this.options.namespaceObject) {
|
|
296
|
+
return 9;
|
|
297
|
+
}
|
|
298
|
+
// if we filter first we get a new array
|
|
299
|
+
// therefor we dont need to create a clone of dependencies explicitly
|
|
300
|
+
// therefore the order of this is !important!
|
|
301
|
+
let hasNonHarmony = false;
|
|
302
|
+
let hasNamespace = false;
|
|
303
|
+
let hasNamed = false;
|
|
304
|
+
const fakeMap = dependencies
|
|
305
|
+
.filter(dependency => dependency.module)
|
|
306
|
+
.sort((a, b) => {
|
|
307
|
+
return b.module.id - a.module.id;
|
|
308
|
+
})
|
|
309
|
+
.reduce((map, dep) => {
|
|
310
|
+
const exportsType =
|
|
311
|
+
dep.module.buildMeta && dep.module.buildMeta.exportsType;
|
|
312
|
+
const id = dep.module.id;
|
|
313
|
+
if (!exportsType) {
|
|
314
|
+
map[id] = this.options.namespaceObject === "strict" ? 1 : 7;
|
|
315
|
+
hasNonHarmony = true;
|
|
316
|
+
} else if (exportsType === "namespace") {
|
|
317
|
+
map[id] = 9;
|
|
318
|
+
hasNamespace = true;
|
|
319
|
+
} else if (exportsType === "named") {
|
|
320
|
+
map[id] = 3;
|
|
321
|
+
hasNamed = true;
|
|
322
|
+
}
|
|
323
|
+
return map;
|
|
324
|
+
}, Object.create(null));
|
|
325
|
+
if (!hasNamespace && hasNonHarmony && !hasNamed) {
|
|
326
|
+
return this.options.namespaceObject === "strict" ? 1 : 7;
|
|
327
|
+
}
|
|
328
|
+
if (hasNamespace && !hasNonHarmony && !hasNamed) {
|
|
329
|
+
return 9;
|
|
330
|
+
}
|
|
331
|
+
if (!hasNamespace && !hasNonHarmony && hasNamed) {
|
|
332
|
+
return 3;
|
|
333
|
+
}
|
|
334
|
+
if (!hasNamespace && !hasNonHarmony && !hasNamed) {
|
|
335
|
+
return 9;
|
|
336
|
+
}
|
|
337
|
+
return fakeMap;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
getFakeMapInitStatement(fakeMap) {
|
|
341
|
+
return typeof fakeMap === "object"
|
|
342
|
+
? `var fakeMap = ${JSON.stringify(fakeMap, null, "\t")};`
|
|
343
|
+
: "";
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
getReturn(type) {
|
|
347
|
+
if (type === 9) {
|
|
348
|
+
return "__webpack_require__(id)";
|
|
349
|
+
}
|
|
350
|
+
return `__webpack_require__.t(id, ${type})`;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
getReturnModuleObjectSource(fakeMap, fakeMapDataExpression = "fakeMap[id]") {
|
|
354
|
+
if (typeof fakeMap === "number") {
|
|
355
|
+
return `return ${this.getReturn(fakeMap)};`;
|
|
356
|
+
}
|
|
357
|
+
return `return __webpack_require__.t(id, ${fakeMapDataExpression})`;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
getSyncSource(dependencies, id) {
|
|
361
|
+
const map = this.getUserRequestMap(dependencies);
|
|
362
|
+
const fakeMap = this.getFakeMap(dependencies);
|
|
363
|
+
const returnModuleObject = this.getReturnModuleObjectSource(fakeMap);
|
|
364
|
+
|
|
365
|
+
return `var map = ${JSON.stringify(map, null, "\t")};
|
|
366
|
+
${this.getFakeMapInitStatement(fakeMap)}
|
|
367
|
+
|
|
368
|
+
function webpackContext(req) {
|
|
369
|
+
var id = webpackContextResolve(req);
|
|
370
|
+
${returnModuleObject}
|
|
371
|
+
}
|
|
372
|
+
function webpackContextResolve(req) {
|
|
373
|
+
var id = map[req];
|
|
374
|
+
if(!(id + 1)) { // check for number or string
|
|
375
|
+
var e = new Error("Cannot find module '" + req + "'");
|
|
376
|
+
e.code = 'MODULE_NOT_FOUND';
|
|
377
|
+
throw e;
|
|
378
|
+
}
|
|
379
|
+
return id;
|
|
380
|
+
}
|
|
381
|
+
webpackContext.keys = function webpackContextKeys() {
|
|
382
|
+
return Object.keys(map);
|
|
383
|
+
};
|
|
384
|
+
webpackContext.resolve = webpackContextResolve;
|
|
385
|
+
module.exports = webpackContext;
|
|
386
|
+
webpackContext.id = ${JSON.stringify(id)};`;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
getWeakSyncSource(dependencies, id) {
|
|
390
|
+
const map = this.getUserRequestMap(dependencies);
|
|
391
|
+
const fakeMap = this.getFakeMap(dependencies);
|
|
392
|
+
const returnModuleObject = this.getReturnModuleObjectSource(fakeMap);
|
|
393
|
+
|
|
394
|
+
return `var map = ${JSON.stringify(map, null, "\t")};
|
|
395
|
+
${this.getFakeMapInitStatement(fakeMap)}
|
|
396
|
+
|
|
397
|
+
function webpackContext(req) {
|
|
398
|
+
var id = webpackContextResolve(req);
|
|
399
|
+
if(!__webpack_require__.m[id]) {
|
|
400
|
+
var e = new Error("Module '" + req + "' ('" + id + "') is not available (weak dependency)");
|
|
401
|
+
e.code = 'MODULE_NOT_FOUND';
|
|
402
|
+
throw e;
|
|
403
|
+
}
|
|
404
|
+
${returnModuleObject}
|
|
405
|
+
}
|
|
406
|
+
function webpackContextResolve(req) {
|
|
407
|
+
var id = map[req];
|
|
408
|
+
if(!(id + 1)) { // check for number or string
|
|
409
|
+
var e = new Error("Cannot find module '" + req + "'");
|
|
410
|
+
e.code = 'MODULE_NOT_FOUND';
|
|
411
|
+
throw e;
|
|
412
|
+
}
|
|
413
|
+
return id;
|
|
414
|
+
}
|
|
415
|
+
webpackContext.keys = function webpackContextKeys() {
|
|
416
|
+
return Object.keys(map);
|
|
417
|
+
};
|
|
418
|
+
webpackContext.resolve = webpackContextResolve;
|
|
419
|
+
webpackContext.id = ${JSON.stringify(id)};
|
|
420
|
+
module.exports = webpackContext;`;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
getAsyncWeakSource(dependencies, id) {
|
|
424
|
+
const map = this.getUserRequestMap(dependencies);
|
|
425
|
+
const fakeMap = this.getFakeMap(dependencies);
|
|
426
|
+
const returnModuleObject = this.getReturnModuleObjectSource(fakeMap);
|
|
427
|
+
|
|
428
|
+
return `var map = ${JSON.stringify(map, null, "\t")};
|
|
429
|
+
${this.getFakeMapInitStatement(fakeMap)}
|
|
430
|
+
|
|
431
|
+
function webpackAsyncContext(req) {
|
|
432
|
+
return webpackAsyncContextResolve(req).then(function(id) {
|
|
433
|
+
if(!__webpack_require__.m[id]) {
|
|
434
|
+
var e = new Error("Module '" + req + "' ('" + id + "') is not available (weak dependency)");
|
|
435
|
+
e.code = 'MODULE_NOT_FOUND';
|
|
436
|
+
throw e;
|
|
437
|
+
}
|
|
438
|
+
${returnModuleObject}
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
function webpackAsyncContextResolve(req) {
|
|
442
|
+
// Here Promise.resolve().then() is used instead of new Promise() to prevent
|
|
443
|
+
// uncaught exception popping up in devtools
|
|
444
|
+
return Promise.resolve().then(function() {
|
|
445
|
+
var id = map[req];
|
|
446
|
+
if(!(id + 1)) { // check for number or string
|
|
447
|
+
var e = new Error("Cannot find module '" + req + "'");
|
|
448
|
+
e.code = 'MODULE_NOT_FOUND';
|
|
449
|
+
throw e;
|
|
450
|
+
}
|
|
451
|
+
return id;
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
|
|
455
|
+
return Object.keys(map);
|
|
456
|
+
};
|
|
457
|
+
webpackAsyncContext.resolve = webpackAsyncContextResolve;
|
|
458
|
+
webpackAsyncContext.id = ${JSON.stringify(id)};
|
|
459
|
+
module.exports = webpackAsyncContext;`;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
getEagerSource(dependencies, id) {
|
|
463
|
+
const map = this.getUserRequestMap(dependencies);
|
|
464
|
+
const fakeMap = this.getFakeMap(dependencies);
|
|
465
|
+
const thenFunction =
|
|
466
|
+
fakeMap !== 9
|
|
467
|
+
? `function(id) {
|
|
468
|
+
${this.getReturnModuleObjectSource(fakeMap)}
|
|
469
|
+
}`
|
|
470
|
+
: "__webpack_require__";
|
|
471
|
+
return `var map = ${JSON.stringify(map, null, "\t")};
|
|
472
|
+
${this.getFakeMapInitStatement(fakeMap)}
|
|
473
|
+
|
|
474
|
+
function webpackAsyncContext(req) {
|
|
475
|
+
return webpackAsyncContextResolve(req).then(${thenFunction});
|
|
476
|
+
}
|
|
477
|
+
function webpackAsyncContextResolve(req) {
|
|
478
|
+
// Here Promise.resolve().then() is used instead of new Promise() to prevent
|
|
479
|
+
// uncaught exception popping up in devtools
|
|
480
|
+
return Promise.resolve().then(function() {
|
|
481
|
+
var id = map[req];
|
|
482
|
+
if(!(id + 1)) { // check for number or string
|
|
483
|
+
var e = new Error("Cannot find module '" + req + "'");
|
|
484
|
+
e.code = 'MODULE_NOT_FOUND';
|
|
485
|
+
throw e;
|
|
486
|
+
}
|
|
487
|
+
return id;
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
|
|
491
|
+
return Object.keys(map);
|
|
492
|
+
};
|
|
493
|
+
webpackAsyncContext.resolve = webpackAsyncContextResolve;
|
|
494
|
+
webpackAsyncContext.id = ${JSON.stringify(id)};
|
|
495
|
+
module.exports = webpackAsyncContext;`;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
getLazyOnceSource(block, dependencies, id, runtimeTemplate) {
|
|
499
|
+
const promise = runtimeTemplate.blockPromise({
|
|
500
|
+
block,
|
|
501
|
+
message: "lazy-once context"
|
|
502
|
+
});
|
|
503
|
+
const map = this.getUserRequestMap(dependencies);
|
|
504
|
+
const fakeMap = this.getFakeMap(dependencies);
|
|
505
|
+
const thenFunction =
|
|
506
|
+
fakeMap !== 9
|
|
507
|
+
? `function(id) {
|
|
508
|
+
${this.getReturnModuleObjectSource(fakeMap)};
|
|
509
|
+
}`
|
|
510
|
+
: "__webpack_require__";
|
|
511
|
+
|
|
512
|
+
return `var map = ${JSON.stringify(map, null, "\t")};
|
|
513
|
+
${this.getFakeMapInitStatement(fakeMap)}
|
|
514
|
+
|
|
515
|
+
function webpackAsyncContext(req) {
|
|
516
|
+
return webpackAsyncContextResolve(req).then(${thenFunction});
|
|
517
|
+
}
|
|
518
|
+
function webpackAsyncContextResolve(req) {
|
|
519
|
+
return ${promise}.then(function() {
|
|
520
|
+
var id = map[req];
|
|
521
|
+
if(!(id + 1)) { // check for number or string
|
|
522
|
+
var e = new Error("Cannot find module '" + req + "'");
|
|
523
|
+
e.code = 'MODULE_NOT_FOUND';
|
|
524
|
+
throw e;
|
|
525
|
+
}
|
|
526
|
+
return id;
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
|
|
530
|
+
return Object.keys(map);
|
|
531
|
+
};
|
|
532
|
+
webpackAsyncContext.resolve = webpackAsyncContextResolve;
|
|
533
|
+
webpackAsyncContext.id = ${JSON.stringify(id)};
|
|
534
|
+
module.exports = webpackAsyncContext;`;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
getLazySource(blocks, id) {
|
|
538
|
+
let hasMultipleOrNoChunks = false;
|
|
539
|
+
const fakeMap = this.getFakeMap(blocks.map(b => b.dependencies[0]));
|
|
540
|
+
const map = blocks
|
|
541
|
+
.filter(block => block.dependencies[0].module)
|
|
542
|
+
.map(block => ({
|
|
543
|
+
dependency: block.dependencies[0],
|
|
544
|
+
block: block,
|
|
545
|
+
userRequest: block.dependencies[0].userRequest
|
|
546
|
+
}))
|
|
547
|
+
.sort((a, b) => {
|
|
548
|
+
if (a.userRequest === b.userRequest) return 0;
|
|
549
|
+
return a.userRequest < b.userRequest ? -1 : 1;
|
|
550
|
+
})
|
|
551
|
+
.reduce((map, item) => {
|
|
552
|
+
const chunks =
|
|
553
|
+
(item.block.chunkGroup && item.block.chunkGroup.chunks) || [];
|
|
554
|
+
if (chunks.length !== 1) {
|
|
555
|
+
hasMultipleOrNoChunks = true;
|
|
556
|
+
}
|
|
557
|
+
const arrayStart = [item.dependency.module.id];
|
|
558
|
+
if (typeof fakeMap === "object") {
|
|
559
|
+
arrayStart.push(fakeMap[item.dependency.module.id]);
|
|
560
|
+
}
|
|
561
|
+
map[item.userRequest] = arrayStart.concat(
|
|
562
|
+
chunks.map(chunk => chunk.id)
|
|
563
|
+
);
|
|
564
|
+
|
|
565
|
+
return map;
|
|
566
|
+
}, Object.create(null));
|
|
567
|
+
|
|
568
|
+
const chunksStartPosition = typeof fakeMap === "object" ? 2 : 1;
|
|
569
|
+
const requestPrefix = hasMultipleOrNoChunks
|
|
570
|
+
? `Promise.all(ids.slice(${chunksStartPosition}).map(__webpack_require__.e))`
|
|
571
|
+
: `__webpack_require__.e(ids[${chunksStartPosition}])`;
|
|
572
|
+
const returnModuleObject = this.getReturnModuleObjectSource(
|
|
573
|
+
fakeMap,
|
|
574
|
+
"ids[1]"
|
|
575
|
+
);
|
|
576
|
+
|
|
577
|
+
return `var map = ${JSON.stringify(map, null, "\t")};
|
|
578
|
+
function webpackAsyncContext(req) {
|
|
579
|
+
var ids = map[req];
|
|
580
|
+
if(!ids) {
|
|
581
|
+
return Promise.resolve().then(function() {
|
|
582
|
+
var e = new Error("Cannot find module '" + req + "'");
|
|
583
|
+
e.code = 'MODULE_NOT_FOUND';
|
|
584
|
+
throw e;
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
return ${requestPrefix}.then(function() {
|
|
588
|
+
var id = ids[0];
|
|
589
|
+
${returnModuleObject}
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
webpackAsyncContext.keys = function webpackAsyncContextKeys() {
|
|
593
|
+
return Object.keys(map);
|
|
594
|
+
};
|
|
595
|
+
webpackAsyncContext.id = ${JSON.stringify(id)};
|
|
596
|
+
module.exports = webpackAsyncContext;`;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
getSourceForEmptyContext(id) {
|
|
600
|
+
return `function webpackEmptyContext(req) {
|
|
601
|
+
var e = new Error("Cannot find module '" + req + "'");
|
|
602
|
+
e.code = 'MODULE_NOT_FOUND';
|
|
603
|
+
throw e;
|
|
604
|
+
}
|
|
605
|
+
webpackEmptyContext.keys = function() { return []; };
|
|
606
|
+
webpackEmptyContext.resolve = webpackEmptyContext;
|
|
607
|
+
module.exports = webpackEmptyContext;
|
|
608
|
+
webpackEmptyContext.id = ${JSON.stringify(id)};`;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
getSourceForEmptyAsyncContext(id) {
|
|
612
|
+
return `function webpackEmptyAsyncContext(req) {
|
|
613
|
+
// Here Promise.resolve().then() is used instead of new Promise() to prevent
|
|
614
|
+
// uncaught exception popping up in devtools
|
|
615
|
+
return Promise.resolve().then(function() {
|
|
616
|
+
var e = new Error("Cannot find module '" + req + "'");
|
|
617
|
+
e.code = 'MODULE_NOT_FOUND';
|
|
618
|
+
throw e;
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
webpackEmptyAsyncContext.keys = function() { return []; };
|
|
622
|
+
webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext;
|
|
623
|
+
module.exports = webpackEmptyAsyncContext;
|
|
624
|
+
webpackEmptyAsyncContext.id = ${JSON.stringify(id)};`;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
getSourceString(asyncMode, runtimeTemplate) {
|
|
628
|
+
if (asyncMode === "lazy") {
|
|
629
|
+
if (this.blocks && this.blocks.length > 0) {
|
|
630
|
+
return this.getLazySource(this.blocks, this.id);
|
|
631
|
+
}
|
|
632
|
+
return this.getSourceForEmptyAsyncContext(this.id);
|
|
633
|
+
}
|
|
634
|
+
if (asyncMode === "eager") {
|
|
635
|
+
if (this.dependencies && this.dependencies.length > 0) {
|
|
636
|
+
return this.getEagerSource(this.dependencies, this.id);
|
|
637
|
+
}
|
|
638
|
+
return this.getSourceForEmptyAsyncContext(this.id);
|
|
639
|
+
}
|
|
640
|
+
if (asyncMode === "lazy-once") {
|
|
641
|
+
const block = this.blocks[0];
|
|
642
|
+
if (block) {
|
|
643
|
+
return this.getLazyOnceSource(
|
|
644
|
+
block,
|
|
645
|
+
block.dependencies,
|
|
646
|
+
this.id,
|
|
647
|
+
runtimeTemplate
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
return this.getSourceForEmptyAsyncContext(this.id);
|
|
651
|
+
}
|
|
652
|
+
if (asyncMode === "async-weak") {
|
|
653
|
+
if (this.dependencies && this.dependencies.length > 0) {
|
|
654
|
+
return this.getAsyncWeakSource(this.dependencies, this.id);
|
|
655
|
+
}
|
|
656
|
+
return this.getSourceForEmptyAsyncContext(this.id);
|
|
657
|
+
}
|
|
658
|
+
if (asyncMode === "weak") {
|
|
659
|
+
if (this.dependencies && this.dependencies.length > 0) {
|
|
660
|
+
return this.getWeakSyncSource(this.dependencies, this.id);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
if (this.dependencies && this.dependencies.length > 0) {
|
|
664
|
+
return this.getSyncSource(this.dependencies, this.id);
|
|
665
|
+
}
|
|
666
|
+
return this.getSourceForEmptyContext(this.id);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
getSource(sourceString) {
|
|
670
|
+
if (this.useSourceMap) {
|
|
671
|
+
return new OriginalSource(sourceString, this.identifier());
|
|
672
|
+
}
|
|
673
|
+
return new RawSource(sourceString);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
source(dependencyTemplates, runtimeTemplate) {
|
|
677
|
+
return this.getSource(
|
|
678
|
+
this.getSourceString(this.options.mode, runtimeTemplate)
|
|
679
|
+
);
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
size() {
|
|
683
|
+
// base penalty
|
|
684
|
+
const initialSize = 160;
|
|
685
|
+
|
|
686
|
+
// if we dont have dependencies we stop here.
|
|
687
|
+
return this.dependencies.reduce(
|
|
688
|
+
(size, dependency) => size + 5 + dependency.userRequest.length,
|
|
689
|
+
initialSize
|
|
690
|
+
);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// TODO remove in webpack 5
|
|
695
|
+
Object.defineProperty(ContextModule.prototype, "recursive", {
|
|
696
|
+
configurable: false,
|
|
697
|
+
get: util.deprecate(function() {
|
|
698
|
+
return this.options.recursive;
|
|
699
|
+
}, "ContextModule.recursive has been moved to ContextModule.options.recursive"),
|
|
700
|
+
set: util.deprecate(function(value) {
|
|
701
|
+
this.options.recursive = value;
|
|
702
|
+
}, "ContextModule.recursive has been moved to ContextModule.options.recursive")
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
// TODO remove in webpack 5
|
|
706
|
+
Object.defineProperty(ContextModule.prototype, "regExp", {
|
|
707
|
+
configurable: false,
|
|
708
|
+
get: util.deprecate(function() {
|
|
709
|
+
return this.options.regExp;
|
|
710
|
+
}, "ContextModule.regExp has been moved to ContextModule.options.regExp"),
|
|
711
|
+
set: util.deprecate(function(value) {
|
|
712
|
+
this.options.regExp = value;
|
|
713
|
+
}, "ContextModule.regExp has been moved to ContextModule.options.regExp")
|
|
714
|
+
});
|
|
715
|
+
|
|
716
|
+
// TODO remove in webpack 5
|
|
717
|
+
Object.defineProperty(ContextModule.prototype, "addon", {
|
|
718
|
+
configurable: false,
|
|
719
|
+
get: util.deprecate(function() {
|
|
720
|
+
return this.options.addon;
|
|
721
|
+
}, "ContextModule.addon has been moved to ContextModule.options.addon"),
|
|
722
|
+
set: util.deprecate(function(value) {
|
|
723
|
+
this.options.addon = value;
|
|
724
|
+
}, "ContextModule.addon has been moved to ContextModule.options.addon")
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
// TODO remove in webpack 5
|
|
728
|
+
Object.defineProperty(ContextModule.prototype, "async", {
|
|
729
|
+
configurable: false,
|
|
730
|
+
get: util.deprecate(function() {
|
|
731
|
+
return this.options.mode;
|
|
732
|
+
}, "ContextModule.async has been moved to ContextModule.options.mode"),
|
|
733
|
+
set: util.deprecate(function(value) {
|
|
734
|
+
this.options.mode = value;
|
|
735
|
+
}, "ContextModule.async has been moved to ContextModule.options.mode")
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
// TODO remove in webpack 5
|
|
739
|
+
Object.defineProperty(ContextModule.prototype, "chunkName", {
|
|
740
|
+
configurable: false,
|
|
741
|
+
get: util.deprecate(function() {
|
|
742
|
+
return this.options.chunkName;
|
|
743
|
+
}, "ContextModule.chunkName has been moved to ContextModule.options.chunkName"),
|
|
744
|
+
set: util.deprecate(function(value) {
|
|
745
|
+
this.options.chunkName = value;
|
|
746
|
+
}, "ContextModule.chunkName has been moved to ContextModule.options.chunkName")
|
|
747
|
+
});
|
|
748
|
+
|
|
749
|
+
module.exports = ContextModule;
|