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
|
@@ -1,1413 +1,1420 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
|
-
"use strict";
|
|
6
|
-
|
|
7
|
-
const Module = require("../Module");
|
|
8
|
-
const Template = require("../Template");
|
|
9
|
-
const Parser = require("../Parser");
|
|
10
|
-
const eslintScope = require("eslint-scope");
|
|
11
|
-
const { ConcatSource, ReplaceSource } = require("webpack-sources");
|
|
12
|
-
const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency");
|
|
13
|
-
const HarmonyImportSideEffectDependency = require("../dependencies/HarmonyImportSideEffectDependency");
|
|
14
|
-
const HarmonyImportSpecifierDependency = require("../dependencies/HarmonyImportSpecifierDependency");
|
|
15
|
-
const HarmonyExportSpecifierDependency = require("../dependencies/HarmonyExportSpecifierDependency");
|
|
16
|
-
const HarmonyExportExpressionDependency = require("../dependencies/HarmonyExportExpressionDependency");
|
|
17
|
-
const HarmonyExportImportedSpecifierDependency = require("../dependencies/HarmonyExportImportedSpecifierDependency");
|
|
18
|
-
const HarmonyCompatibilityDependency = require("../dependencies/HarmonyCompatibilityDependency");
|
|
19
|
-
const createHash = require("../util/createHash");
|
|
20
|
-
|
|
21
|
-
const ensureNsObjSource = (
|
|
22
|
-
info,
|
|
23
|
-
moduleToInfoMap,
|
|
24
|
-
requestShortener,
|
|
25
|
-
strictHarmonyModule
|
|
26
|
-
) => {
|
|
27
|
-
if (!info.hasNamespaceObject) {
|
|
28
|
-
info.hasNamespaceObject = true;
|
|
29
|
-
const name = info.exportMap.get(true);
|
|
30
|
-
const nsObj = [`var ${name} = {};`];
|
|
31
|
-
for (const exportName of info.module.buildMeta.providedExports) {
|
|
32
|
-
const finalName = getFinalName(
|
|
33
|
-
info,
|
|
34
|
-
exportName,
|
|
35
|
-
moduleToInfoMap,
|
|
36
|
-
requestShortener,
|
|
37
|
-
false,
|
|
38
|
-
strictHarmonyModule
|
|
39
|
-
);
|
|
40
|
-
nsObj.push(
|
|
41
|
-
`__webpack_require__.d(${name}, ${JSON.stringify(
|
|
42
|
-
exportName
|
|
43
|
-
)}, function() { return ${finalName}; });`
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
info.namespaceObjectSource = nsObj.join("\n") + "\n";
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const getExternalImport = (
|
|
51
|
-
importedModule,
|
|
52
|
-
info,
|
|
53
|
-
exportName,
|
|
54
|
-
asCall,
|
|
55
|
-
strictHarmonyModule
|
|
56
|
-
) => {
|
|
57
|
-
const used = importedModule.isUsed(exportName);
|
|
58
|
-
if (!used) return "/* unused reexport */undefined";
|
|
59
|
-
const comment =
|
|
60
|
-
used !== exportName ? ` ${Template.toNormalComment(exportName)}` : "";
|
|
61
|
-
switch (importedModule.buildMeta.exportsType) {
|
|
62
|
-
case "named":
|
|
63
|
-
if (exportName === "default") {
|
|
64
|
-
return info.name;
|
|
65
|
-
} else if (exportName === true) {
|
|
66
|
-
info.interopNamespaceObjectUsed = true;
|
|
67
|
-
return info.interopNamespaceObjectName;
|
|
68
|
-
} else {
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
case "namespace":
|
|
72
|
-
if (exportName === true) {
|
|
73
|
-
return info.name;
|
|
74
|
-
} else {
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
default:
|
|
78
|
-
if (strictHarmonyModule) {
|
|
79
|
-
if (exportName === "default") {
|
|
80
|
-
return info.name;
|
|
81
|
-
} else if (exportName === true) {
|
|
82
|
-
info.interopNamespaceObjectUsed = true;
|
|
83
|
-
return info.interopNamespaceObjectName;
|
|
84
|
-
} else {
|
|
85
|
-
return "/* non-default import from non-esm module */undefined";
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
if (exportName === "default") {
|
|
89
|
-
info.interopDefaultAccessUsed = true;
|
|
90
|
-
return asCall
|
|
91
|
-
? `${info.interopDefaultAccessName}()`
|
|
92
|
-
: `${info.interopDefaultAccessName}.a`;
|
|
93
|
-
} else if (exportName === true) {
|
|
94
|
-
return info.name;
|
|
95
|
-
} else {
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
const reference = `${info.name}[${JSON.stringify(used)}${comment}]`;
|
|
101
|
-
if (asCall) return `Object(${reference})`;
|
|
102
|
-
return reference;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const getFinalName = (
|
|
106
|
-
info,
|
|
107
|
-
exportName,
|
|
108
|
-
moduleToInfoMap,
|
|
109
|
-
requestShortener,
|
|
110
|
-
asCall,
|
|
111
|
-
strictHarmonyModule
|
|
112
|
-
) => {
|
|
113
|
-
switch (info.type) {
|
|
114
|
-
case "concatenated": {
|
|
115
|
-
const directExport = info.exportMap.get(exportName);
|
|
116
|
-
if (directExport) {
|
|
117
|
-
if (exportName === true)
|
|
118
|
-
ensureNsObjSource(
|
|
119
|
-
info,
|
|
120
|
-
moduleToInfoMap,
|
|
121
|
-
requestShortener,
|
|
122
|
-
strictHarmonyModule
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
scopeSet1.
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
for
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
if (
|
|
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
|
-
this.
|
|
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
|
-
|
|
296
|
-
|
|
297
|
-
this.
|
|
298
|
-
|
|
299
|
-
this.
|
|
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
|
-
// populate
|
|
330
|
-
for (const
|
|
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
|
-
return
|
|
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
|
-
|
|
425
|
-
|
|
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
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
) {
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
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
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
innerDependencyTemplates.set(
|
|
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
|
-
|
|
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
|
-
"
|
|
711
|
-
"
|
|
712
|
-
"
|
|
713
|
-
|
|
714
|
-
"
|
|
715
|
-
"
|
|
716
|
-
"
|
|
717
|
-
"
|
|
718
|
-
|
|
719
|
-
"
|
|
720
|
-
"
|
|
721
|
-
"
|
|
722
|
-
"
|
|
723
|
-
"
|
|
724
|
-
"
|
|
725
|
-
"
|
|
726
|
-
"
|
|
727
|
-
"
|
|
728
|
-
|
|
729
|
-
"
|
|
730
|
-
"
|
|
731
|
-
"
|
|
732
|
-
"
|
|
733
|
-
"
|
|
734
|
-
"
|
|
735
|
-
"
|
|
736
|
-
"
|
|
737
|
-
"
|
|
738
|
-
"
|
|
739
|
-
|
|
740
|
-
"
|
|
741
|
-
"
|
|
742
|
-
"
|
|
743
|
-
"
|
|
744
|
-
"
|
|
745
|
-
"
|
|
746
|
-
"
|
|
747
|
-
"
|
|
748
|
-
"
|
|
749
|
-
"
|
|
750
|
-
"
|
|
751
|
-
"
|
|
752
|
-
"
|
|
753
|
-
"
|
|
754
|
-
"
|
|
755
|
-
"
|
|
756
|
-
"
|
|
757
|
-
"
|
|
758
|
-
"
|
|
759
|
-
"
|
|
760
|
-
"
|
|
761
|
-
"
|
|
762
|
-
"
|
|
763
|
-
"
|
|
764
|
-
"
|
|
765
|
-
"
|
|
766
|
-
"
|
|
767
|
-
"
|
|
768
|
-
"
|
|
769
|
-
"
|
|
770
|
-
"
|
|
771
|
-
"
|
|
772
|
-
"
|
|
773
|
-
"
|
|
774
|
-
"
|
|
775
|
-
"
|
|
776
|
-
"
|
|
777
|
-
"
|
|
778
|
-
"
|
|
779
|
-
"
|
|
780
|
-
"
|
|
781
|
-
"
|
|
782
|
-
"
|
|
783
|
-
"
|
|
784
|
-
"
|
|
785
|
-
"
|
|
786
|
-
"
|
|
787
|
-
"
|
|
788
|
-
"
|
|
789
|
-
"
|
|
790
|
-
"
|
|
791
|
-
"
|
|
792
|
-
"
|
|
793
|
-
"
|
|
794
|
-
"
|
|
795
|
-
"
|
|
796
|
-
"
|
|
797
|
-
"
|
|
798
|
-
"
|
|
799
|
-
"
|
|
800
|
-
"
|
|
801
|
-
"
|
|
802
|
-
"
|
|
803
|
-
"
|
|
804
|
-
"
|
|
805
|
-
"
|
|
806
|
-
"
|
|
807
|
-
"
|
|
808
|
-
"
|
|
809
|
-
"
|
|
810
|
-
"
|
|
811
|
-
"
|
|
812
|
-
"
|
|
813
|
-
"
|
|
814
|
-
|
|
815
|
-
"
|
|
816
|
-
"
|
|
817
|
-
"
|
|
818
|
-
"
|
|
819
|
-
"
|
|
820
|
-
"
|
|
821
|
-
"
|
|
822
|
-
"
|
|
823
|
-
"
|
|
824
|
-
"
|
|
825
|
-
|
|
826
|
-
"
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
const
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
`
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
info.
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
const
|
|
1179
|
-
const
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
content = `__WEBPACK_MODULE_REFERENCE__${
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
if (dep.originModule === this.rootModule) {
|
|
1255
|
-
this.originalTemplate.
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1
|
+
/*
|
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
+
Author Tobias Koppers @sokra
|
|
4
|
+
*/
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
const Module = require("../Module");
|
|
8
|
+
const Template = require("../Template");
|
|
9
|
+
const Parser = require("../Parser");
|
|
10
|
+
const eslintScope = require("eslint-scope");
|
|
11
|
+
const { ConcatSource, ReplaceSource } = require("webpack-sources");
|
|
12
|
+
const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency");
|
|
13
|
+
const HarmonyImportSideEffectDependency = require("../dependencies/HarmonyImportSideEffectDependency");
|
|
14
|
+
const HarmonyImportSpecifierDependency = require("../dependencies/HarmonyImportSpecifierDependency");
|
|
15
|
+
const HarmonyExportSpecifierDependency = require("../dependencies/HarmonyExportSpecifierDependency");
|
|
16
|
+
const HarmonyExportExpressionDependency = require("../dependencies/HarmonyExportExpressionDependency");
|
|
17
|
+
const HarmonyExportImportedSpecifierDependency = require("../dependencies/HarmonyExportImportedSpecifierDependency");
|
|
18
|
+
const HarmonyCompatibilityDependency = require("../dependencies/HarmonyCompatibilityDependency");
|
|
19
|
+
const createHash = require("../util/createHash");
|
|
20
|
+
|
|
21
|
+
const ensureNsObjSource = (
|
|
22
|
+
info,
|
|
23
|
+
moduleToInfoMap,
|
|
24
|
+
requestShortener,
|
|
25
|
+
strictHarmonyModule
|
|
26
|
+
) => {
|
|
27
|
+
if (!info.hasNamespaceObject) {
|
|
28
|
+
info.hasNamespaceObject = true;
|
|
29
|
+
const name = info.exportMap.get(true);
|
|
30
|
+
const nsObj = [`var ${name} = {};`, `__webpack_require__.r(${name});`];
|
|
31
|
+
for (const exportName of info.module.buildMeta.providedExports) {
|
|
32
|
+
const finalName = getFinalName(
|
|
33
|
+
info,
|
|
34
|
+
exportName,
|
|
35
|
+
moduleToInfoMap,
|
|
36
|
+
requestShortener,
|
|
37
|
+
false,
|
|
38
|
+
strictHarmonyModule
|
|
39
|
+
);
|
|
40
|
+
nsObj.push(
|
|
41
|
+
`__webpack_require__.d(${name}, ${JSON.stringify(
|
|
42
|
+
exportName
|
|
43
|
+
)}, function() { return ${finalName}; });`
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
info.namespaceObjectSource = nsObj.join("\n") + "\n";
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const getExternalImport = (
|
|
51
|
+
importedModule,
|
|
52
|
+
info,
|
|
53
|
+
exportName,
|
|
54
|
+
asCall,
|
|
55
|
+
strictHarmonyModule
|
|
56
|
+
) => {
|
|
57
|
+
const used = importedModule.isUsed(exportName);
|
|
58
|
+
if (!used) return "/* unused reexport */undefined";
|
|
59
|
+
const comment =
|
|
60
|
+
used !== exportName ? ` ${Template.toNormalComment(exportName)}` : "";
|
|
61
|
+
switch (importedModule.buildMeta.exportsType) {
|
|
62
|
+
case "named":
|
|
63
|
+
if (exportName === "default") {
|
|
64
|
+
return info.name;
|
|
65
|
+
} else if (exportName === true) {
|
|
66
|
+
info.interopNamespaceObjectUsed = true;
|
|
67
|
+
return info.interopNamespaceObjectName;
|
|
68
|
+
} else {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
case "namespace":
|
|
72
|
+
if (exportName === true) {
|
|
73
|
+
return info.name;
|
|
74
|
+
} else {
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
default:
|
|
78
|
+
if (strictHarmonyModule) {
|
|
79
|
+
if (exportName === "default") {
|
|
80
|
+
return info.name;
|
|
81
|
+
} else if (exportName === true) {
|
|
82
|
+
info.interopNamespaceObjectUsed = true;
|
|
83
|
+
return info.interopNamespaceObjectName;
|
|
84
|
+
} else {
|
|
85
|
+
return "/* non-default import from non-esm module */undefined";
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
if (exportName === "default") {
|
|
89
|
+
info.interopDefaultAccessUsed = true;
|
|
90
|
+
return asCall
|
|
91
|
+
? `${info.interopDefaultAccessName}()`
|
|
92
|
+
: `${info.interopDefaultAccessName}.a`;
|
|
93
|
+
} else if (exportName === true) {
|
|
94
|
+
return info.name;
|
|
95
|
+
} else {
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const reference = `${info.name}[${JSON.stringify(used)}${comment}]`;
|
|
101
|
+
if (asCall) return `Object(${reference})`;
|
|
102
|
+
return reference;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const getFinalName = (
|
|
106
|
+
info,
|
|
107
|
+
exportName,
|
|
108
|
+
moduleToInfoMap,
|
|
109
|
+
requestShortener,
|
|
110
|
+
asCall,
|
|
111
|
+
strictHarmonyModule
|
|
112
|
+
) => {
|
|
113
|
+
switch (info.type) {
|
|
114
|
+
case "concatenated": {
|
|
115
|
+
const directExport = info.exportMap.get(exportName);
|
|
116
|
+
if (directExport) {
|
|
117
|
+
if (exportName === true) {
|
|
118
|
+
ensureNsObjSource(
|
|
119
|
+
info,
|
|
120
|
+
moduleToInfoMap,
|
|
121
|
+
requestShortener,
|
|
122
|
+
strictHarmonyModule
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
const name = info.internalNames.get(directExport);
|
|
126
|
+
if (!name) {
|
|
127
|
+
throw new Error(
|
|
128
|
+
`The export "${directExport}" in "${info.module.readableIdentifier(
|
|
129
|
+
requestShortener
|
|
130
|
+
)}" has no internal name`
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
return name;
|
|
134
|
+
}
|
|
135
|
+
const reexport = info.reexportMap.get(exportName);
|
|
136
|
+
if (reexport) {
|
|
137
|
+
const refInfo = moduleToInfoMap.get(reexport.module);
|
|
138
|
+
if (refInfo) {
|
|
139
|
+
// module is in the concatenation
|
|
140
|
+
return getFinalName(
|
|
141
|
+
refInfo,
|
|
142
|
+
reexport.exportName,
|
|
143
|
+
moduleToInfoMap,
|
|
144
|
+
requestShortener,
|
|
145
|
+
asCall,
|
|
146
|
+
strictHarmonyModule
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const problem =
|
|
151
|
+
`Cannot get final name for export "${exportName}" in "${info.module.readableIdentifier(
|
|
152
|
+
requestShortener
|
|
153
|
+
)}"` +
|
|
154
|
+
` (known exports: ${Array.from(info.exportMap.keys())
|
|
155
|
+
.filter(name => name !== true)
|
|
156
|
+
.join(" ")}, ` +
|
|
157
|
+
`known reexports: ${Array.from(info.reexportMap.keys()).join(" ")})`;
|
|
158
|
+
return `${Template.toNormalComment(problem)} undefined`;
|
|
159
|
+
}
|
|
160
|
+
case "external": {
|
|
161
|
+
const importedModule = info.module;
|
|
162
|
+
return getExternalImport(
|
|
163
|
+
importedModule,
|
|
164
|
+
info,
|
|
165
|
+
exportName,
|
|
166
|
+
asCall,
|
|
167
|
+
strictHarmonyModule
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const addScopeSymbols1 = (s, nameSet, scopeSet) => {
|
|
174
|
+
let scope = s;
|
|
175
|
+
while (scope) {
|
|
176
|
+
if (scopeSet.has(scope)) break;
|
|
177
|
+
scopeSet.add(scope);
|
|
178
|
+
for (const variable of scope.variables) {
|
|
179
|
+
nameSet.add(variable.name);
|
|
180
|
+
}
|
|
181
|
+
scope = scope.upper;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const addScopeSymbols2 = (s, nameSet, scopeSet1, scopeSet2) => {
|
|
186
|
+
let scope = s;
|
|
187
|
+
while (scope) {
|
|
188
|
+
if (scopeSet1.has(scope)) break;
|
|
189
|
+
if (scopeSet2.has(scope)) break;
|
|
190
|
+
scopeSet1.add(scope);
|
|
191
|
+
for (const variable of scope.variables) {
|
|
192
|
+
nameSet.add(variable.name);
|
|
193
|
+
}
|
|
194
|
+
scope = scope.upper;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const getAllReferences = variable => {
|
|
199
|
+
let set = variable.references;
|
|
200
|
+
// Look for inner scope variables too (like in class Foo { t() { Foo } })
|
|
201
|
+
const identifiers = new Set(variable.identifiers);
|
|
202
|
+
for (const scope of variable.scope.childScopes) {
|
|
203
|
+
for (const innerVar of scope.variables) {
|
|
204
|
+
if (innerVar.identifiers.some(id => identifiers.has(id))) {
|
|
205
|
+
set = set.concat(innerVar.references);
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return set;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const getPathInAst = (ast, node) => {
|
|
214
|
+
if (ast === node) {
|
|
215
|
+
return [];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const nr = node.range;
|
|
219
|
+
|
|
220
|
+
const enterNode = n => {
|
|
221
|
+
if (!n) return undefined;
|
|
222
|
+
const r = n.range;
|
|
223
|
+
if (r) {
|
|
224
|
+
if (r[0] <= nr[0] && r[1] >= nr[1]) {
|
|
225
|
+
const path = getPathInAst(n, node);
|
|
226
|
+
if (path) {
|
|
227
|
+
path.push(n);
|
|
228
|
+
return path;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return undefined;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
var i;
|
|
236
|
+
if (Array.isArray(ast)) {
|
|
237
|
+
for (i = 0; i < ast.length; i++) {
|
|
238
|
+
const enterResult = enterNode(ast[i]);
|
|
239
|
+
if (typeof enterResult !== "undefined") return enterResult;
|
|
240
|
+
}
|
|
241
|
+
} else if (ast && typeof ast === "object") {
|
|
242
|
+
const keys = Object.keys(ast);
|
|
243
|
+
for (i = 0; i < keys.length; i++) {
|
|
244
|
+
const value = ast[keys[i]];
|
|
245
|
+
if (Array.isArray(value)) {
|
|
246
|
+
const pathResult = getPathInAst(value, node);
|
|
247
|
+
if (typeof pathResult !== "undefined") return pathResult;
|
|
248
|
+
} else if (value && typeof value === "object") {
|
|
249
|
+
const enterResult = enterNode(value);
|
|
250
|
+
if (typeof enterResult !== "undefined") return enterResult;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
class ConcatenatedModule extends Module {
|
|
257
|
+
constructor(rootModule, modules) {
|
|
258
|
+
super("javascript/esm", null);
|
|
259
|
+
super.setChunks(rootModule._chunks);
|
|
260
|
+
|
|
261
|
+
// Info from Factory
|
|
262
|
+
this.rootModule = rootModule;
|
|
263
|
+
|
|
264
|
+
// Info from Compilation
|
|
265
|
+
this.index = rootModule.index;
|
|
266
|
+
this.index2 = rootModule.index2;
|
|
267
|
+
this.depth = rootModule.depth;
|
|
268
|
+
|
|
269
|
+
// Info from Optimization
|
|
270
|
+
this.used = rootModule.used;
|
|
271
|
+
this.usedExports = rootModule.usedExports;
|
|
272
|
+
|
|
273
|
+
// Info from Build
|
|
274
|
+
this.buildInfo = {
|
|
275
|
+
strict: true,
|
|
276
|
+
cacheable: modules.every(m => m.buildInfo.cacheable),
|
|
277
|
+
moduleArgument: rootModule.buildInfo.moduleArgument,
|
|
278
|
+
exportsArgument: rootModule.buildInfo.exportsArgument,
|
|
279
|
+
fileDependencies: new Set(),
|
|
280
|
+
contextDependencies: new Set(),
|
|
281
|
+
assets: undefined
|
|
282
|
+
};
|
|
283
|
+
this.built = modules.some(m => m.built);
|
|
284
|
+
this.buildMeta = rootModule.buildMeta;
|
|
285
|
+
|
|
286
|
+
// Caching
|
|
287
|
+
this._numberOfConcatenatedModules = modules.length;
|
|
288
|
+
|
|
289
|
+
// Graph
|
|
290
|
+
const modulesSet = new Set(modules);
|
|
291
|
+
this.reasons = rootModule.reasons.filter(
|
|
292
|
+
reason =>
|
|
293
|
+
!(reason.dependency instanceof HarmonyImportDependency) ||
|
|
294
|
+
!modulesSet.has(reason.module)
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
this.dependencies = [];
|
|
298
|
+
|
|
299
|
+
this.warnings = [];
|
|
300
|
+
this.errors = [];
|
|
301
|
+
this._orderedConcatenationList = this._createOrderedConcatenationList(
|
|
302
|
+
rootModule,
|
|
303
|
+
modulesSet
|
|
304
|
+
);
|
|
305
|
+
for (const info of this._orderedConcatenationList) {
|
|
306
|
+
if (info.type === "concatenated") {
|
|
307
|
+
const m = info.module;
|
|
308
|
+
|
|
309
|
+
// populate dependencies
|
|
310
|
+
for (const d of m.dependencies.filter(
|
|
311
|
+
dep =>
|
|
312
|
+
!(dep instanceof HarmonyImportDependency) ||
|
|
313
|
+
!modulesSet.has(dep._module)
|
|
314
|
+
)) {
|
|
315
|
+
this.dependencies.push(d);
|
|
316
|
+
}
|
|
317
|
+
// populate file dependencies
|
|
318
|
+
if (m.buildInfo.fileDependencies) {
|
|
319
|
+
for (const file of m.buildInfo.fileDependencies) {
|
|
320
|
+
this.buildInfo.fileDependencies.add(file);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
// populate context dependencies
|
|
324
|
+
if (m.buildInfo.contextDependencies) {
|
|
325
|
+
for (const context of m.buildInfo.contextDependencies) {
|
|
326
|
+
this.buildInfo.contextDependencies.add(context);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
// populate warnings
|
|
330
|
+
for (const warning of m.warnings) {
|
|
331
|
+
this.warnings.push(warning);
|
|
332
|
+
}
|
|
333
|
+
// populate errors
|
|
334
|
+
for (const error of m.errors) {
|
|
335
|
+
this.errors.push(error);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
if (m.buildInfo.assets) {
|
|
339
|
+
if (this.buildInfo.assets === undefined) {
|
|
340
|
+
this.buildInfo.assets = Object.create(null);
|
|
341
|
+
}
|
|
342
|
+
Object.assign(this.buildInfo.assets, m.buildInfo.assets);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
this._identifier = this._createIdentifier();
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
get modules() {
|
|
350
|
+
return this._orderedConcatenationList
|
|
351
|
+
.filter(info => info.type === "concatenated")
|
|
352
|
+
.map(info => info.module);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
identifier() {
|
|
356
|
+
return this._identifier;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
readableIdentifier(requestShortener) {
|
|
360
|
+
return (
|
|
361
|
+
this.rootModule.readableIdentifier(requestShortener) +
|
|
362
|
+
` + ${this._numberOfConcatenatedModules - 1} modules`
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
libIdent(options) {
|
|
367
|
+
return this.rootModule.libIdent(options);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
nameForCondition() {
|
|
371
|
+
return this.rootModule.nameForCondition();
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
build(options, compilation, resolver, fs, callback) {
|
|
375
|
+
throw new Error("Cannot build this module. It should be already built.");
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
size() {
|
|
379
|
+
// Guess size from embedded modules
|
|
380
|
+
return this._orderedConcatenationList.reduce((sum, info) => {
|
|
381
|
+
switch (info.type) {
|
|
382
|
+
case "concatenated":
|
|
383
|
+
return sum + info.module.size();
|
|
384
|
+
case "external":
|
|
385
|
+
return sum + 5;
|
|
386
|
+
}
|
|
387
|
+
return sum;
|
|
388
|
+
}, 0);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
_createOrderedConcatenationList(rootModule, modulesSet) {
|
|
392
|
+
const list = [];
|
|
393
|
+
const set = new Set();
|
|
394
|
+
|
|
395
|
+
const getConcatenatedImports = module => {
|
|
396
|
+
return module.dependencies
|
|
397
|
+
.filter(dep => dep instanceof HarmonyImportDependency)
|
|
398
|
+
.sort((a, b) => a.sourceOrder - b.sourceOrder)
|
|
399
|
+
.map(dep => () => {
|
|
400
|
+
const ref = dep.getReference();
|
|
401
|
+
return ref && ref.module;
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
const enterModule = getModule => {
|
|
406
|
+
const module = getModule();
|
|
407
|
+
if (!module) return;
|
|
408
|
+
if (set.has(module)) return;
|
|
409
|
+
set.add(module);
|
|
410
|
+
if (modulesSet.has(module)) {
|
|
411
|
+
const imports = getConcatenatedImports(module);
|
|
412
|
+
imports.forEach(enterModule);
|
|
413
|
+
list.push({
|
|
414
|
+
type: "concatenated",
|
|
415
|
+
module
|
|
416
|
+
});
|
|
417
|
+
} else {
|
|
418
|
+
list.push({
|
|
419
|
+
type: "external",
|
|
420
|
+
get module() {
|
|
421
|
+
// We need to use a getter here, because the module in the dependency
|
|
422
|
+
// could be replaced by some other process (i. e. also replaced with a
|
|
423
|
+
// concatenated module)
|
|
424
|
+
return getModule();
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
enterModule(() => rootModule);
|
|
431
|
+
|
|
432
|
+
return list;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
_createIdentifier() {
|
|
436
|
+
let orderedConcatenationListIdentifiers = "";
|
|
437
|
+
for (let i = 0; i < this._orderedConcatenationList.length; i++) {
|
|
438
|
+
if (this._orderedConcatenationList[i].type === "concatenated") {
|
|
439
|
+
orderedConcatenationListIdentifiers += this._orderedConcatenationList[
|
|
440
|
+
i
|
|
441
|
+
].module.identifier();
|
|
442
|
+
orderedConcatenationListIdentifiers += " ";
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
const hash = createHash("md4");
|
|
446
|
+
hash.update(orderedConcatenationListIdentifiers);
|
|
447
|
+
return this.rootModule.identifier() + " " + hash.digest("hex");
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
source(dependencyTemplates, runtimeTemplate) {
|
|
451
|
+
const requestShortener = runtimeTemplate.requestShortener;
|
|
452
|
+
// Metainfo for each module
|
|
453
|
+
const modulesWithInfo = this._orderedConcatenationList.map((info, idx) => {
|
|
454
|
+
switch (info.type) {
|
|
455
|
+
case "concatenated": {
|
|
456
|
+
const exportMap = new Map();
|
|
457
|
+
const reexportMap = new Map();
|
|
458
|
+
for (const dep of info.module.dependencies) {
|
|
459
|
+
if (dep instanceof HarmonyExportSpecifierDependency) {
|
|
460
|
+
if (!exportMap.has(dep.name)) {
|
|
461
|
+
exportMap.set(dep.name, dep.id);
|
|
462
|
+
}
|
|
463
|
+
} else if (dep instanceof HarmonyExportExpressionDependency) {
|
|
464
|
+
if (!exportMap.has("default")) {
|
|
465
|
+
exportMap.set("default", "__WEBPACK_MODULE_DEFAULT_EXPORT__");
|
|
466
|
+
}
|
|
467
|
+
} else if (
|
|
468
|
+
dep instanceof HarmonyExportImportedSpecifierDependency
|
|
469
|
+
) {
|
|
470
|
+
const exportName = dep.name;
|
|
471
|
+
const importName = dep.id;
|
|
472
|
+
const importedModule = dep._module;
|
|
473
|
+
if (exportName && importName) {
|
|
474
|
+
if (!reexportMap.has(exportName)) {
|
|
475
|
+
reexportMap.set(exportName, {
|
|
476
|
+
module: importedModule,
|
|
477
|
+
exportName: importName,
|
|
478
|
+
dependency: dep
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
} else if (exportName) {
|
|
482
|
+
if (!reexportMap.has(exportName)) {
|
|
483
|
+
reexportMap.set(exportName, {
|
|
484
|
+
module: importedModule,
|
|
485
|
+
exportName: true,
|
|
486
|
+
dependency: dep
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
} else if (importedModule) {
|
|
490
|
+
for (const name of importedModule.buildMeta.providedExports) {
|
|
491
|
+
if (dep.activeExports.has(name) || name === "default") {
|
|
492
|
+
continue;
|
|
493
|
+
}
|
|
494
|
+
if (!reexportMap.has(name)) {
|
|
495
|
+
reexportMap.set(name, {
|
|
496
|
+
module: importedModule,
|
|
497
|
+
exportName: name,
|
|
498
|
+
dependency: dep
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return {
|
|
506
|
+
type: "concatenated",
|
|
507
|
+
module: info.module,
|
|
508
|
+
index: idx,
|
|
509
|
+
ast: undefined,
|
|
510
|
+
internalSource: undefined,
|
|
511
|
+
source: undefined,
|
|
512
|
+
globalScope: undefined,
|
|
513
|
+
moduleScope: undefined,
|
|
514
|
+
internalNames: new Map(),
|
|
515
|
+
exportMap: exportMap,
|
|
516
|
+
reexportMap: reexportMap,
|
|
517
|
+
hasNamespaceObject: false,
|
|
518
|
+
namespaceObjectSource: null
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
case "external":
|
|
522
|
+
return {
|
|
523
|
+
type: "external",
|
|
524
|
+
module: info.module,
|
|
525
|
+
index: idx,
|
|
526
|
+
name: undefined,
|
|
527
|
+
interopNamespaceObjectUsed: false,
|
|
528
|
+
interopNamespaceObjectName: undefined,
|
|
529
|
+
interopDefaultAccessUsed: false,
|
|
530
|
+
interopDefaultAccessName: undefined
|
|
531
|
+
};
|
|
532
|
+
default:
|
|
533
|
+
throw new Error(`Unsupported concatenation entry type ${info.type}`);
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
// Create mapping from module to info
|
|
538
|
+
const moduleToInfoMap = new Map();
|
|
539
|
+
for (const m of modulesWithInfo) {
|
|
540
|
+
moduleToInfoMap.set(m.module, m);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// Configure template decorators for dependencies
|
|
544
|
+
const innerDependencyTemplates = new Map(dependencyTemplates);
|
|
545
|
+
|
|
546
|
+
innerDependencyTemplates.set(
|
|
547
|
+
HarmonyImportSpecifierDependency,
|
|
548
|
+
new HarmonyImportSpecifierDependencyConcatenatedTemplate(
|
|
549
|
+
dependencyTemplates.get(HarmonyImportSpecifierDependency),
|
|
550
|
+
moduleToInfoMap
|
|
551
|
+
)
|
|
552
|
+
);
|
|
553
|
+
innerDependencyTemplates.set(
|
|
554
|
+
HarmonyImportSideEffectDependency,
|
|
555
|
+
new HarmonyImportSideEffectDependencyConcatenatedTemplate(
|
|
556
|
+
dependencyTemplates.get(HarmonyImportSideEffectDependency),
|
|
557
|
+
moduleToInfoMap
|
|
558
|
+
)
|
|
559
|
+
);
|
|
560
|
+
innerDependencyTemplates.set(
|
|
561
|
+
HarmonyExportSpecifierDependency,
|
|
562
|
+
new HarmonyExportSpecifierDependencyConcatenatedTemplate(
|
|
563
|
+
dependencyTemplates.get(HarmonyExportSpecifierDependency),
|
|
564
|
+
this.rootModule
|
|
565
|
+
)
|
|
566
|
+
);
|
|
567
|
+
innerDependencyTemplates.set(
|
|
568
|
+
HarmonyExportExpressionDependency,
|
|
569
|
+
new HarmonyExportExpressionDependencyConcatenatedTemplate(
|
|
570
|
+
dependencyTemplates.get(HarmonyExportExpressionDependency),
|
|
571
|
+
this.rootModule
|
|
572
|
+
)
|
|
573
|
+
);
|
|
574
|
+
innerDependencyTemplates.set(
|
|
575
|
+
HarmonyExportImportedSpecifierDependency,
|
|
576
|
+
new HarmonyExportImportedSpecifierDependencyConcatenatedTemplate(
|
|
577
|
+
dependencyTemplates.get(HarmonyExportImportedSpecifierDependency),
|
|
578
|
+
this.rootModule,
|
|
579
|
+
moduleToInfoMap
|
|
580
|
+
)
|
|
581
|
+
);
|
|
582
|
+
innerDependencyTemplates.set(
|
|
583
|
+
HarmonyCompatibilityDependency,
|
|
584
|
+
new HarmonyCompatibilityDependencyConcatenatedTemplate(
|
|
585
|
+
dependencyTemplates.get(HarmonyCompatibilityDependency),
|
|
586
|
+
this.rootModule,
|
|
587
|
+
moduleToInfoMap
|
|
588
|
+
)
|
|
589
|
+
);
|
|
590
|
+
|
|
591
|
+
// Must use full identifier in our cache here to ensure that the source
|
|
592
|
+
// is updated should our dependencies list change.
|
|
593
|
+
innerDependencyTemplates.set(
|
|
594
|
+
"hash",
|
|
595
|
+
innerDependencyTemplates.get("hash") + this.identifier()
|
|
596
|
+
);
|
|
597
|
+
|
|
598
|
+
// Generate source code and analyse scopes
|
|
599
|
+
// Prepare a ReplaceSource for the final source
|
|
600
|
+
for (const info of modulesWithInfo) {
|
|
601
|
+
if (info.type === "concatenated") {
|
|
602
|
+
const m = info.module;
|
|
603
|
+
const source = m.source(innerDependencyTemplates, runtimeTemplate);
|
|
604
|
+
const code = source.source();
|
|
605
|
+
let ast;
|
|
606
|
+
try {
|
|
607
|
+
ast = Parser.parse(code, {
|
|
608
|
+
sourceType: "module"
|
|
609
|
+
});
|
|
610
|
+
} catch (err) {
|
|
611
|
+
if (
|
|
612
|
+
err.loc &&
|
|
613
|
+
typeof err.loc === "object" &&
|
|
614
|
+
typeof err.loc.line === "number"
|
|
615
|
+
) {
|
|
616
|
+
const lineNumber = err.loc.line;
|
|
617
|
+
const lines = code.split("\n");
|
|
618
|
+
err.message +=
|
|
619
|
+
"\n| " +
|
|
620
|
+
lines
|
|
621
|
+
.slice(Math.max(0, lineNumber - 3), lineNumber + 2)
|
|
622
|
+
.join("\n| ");
|
|
623
|
+
}
|
|
624
|
+
throw err;
|
|
625
|
+
}
|
|
626
|
+
const scopeManager = eslintScope.analyze(ast, {
|
|
627
|
+
ecmaVersion: 6,
|
|
628
|
+
sourceType: "module",
|
|
629
|
+
optimistic: true,
|
|
630
|
+
ignoreEval: true,
|
|
631
|
+
impliedStrict: true
|
|
632
|
+
});
|
|
633
|
+
const globalScope = scopeManager.acquire(ast);
|
|
634
|
+
const moduleScope = globalScope.childScopes[0];
|
|
635
|
+
const resultSource = new ReplaceSource(source);
|
|
636
|
+
info.ast = ast;
|
|
637
|
+
info.internalSource = source;
|
|
638
|
+
info.source = resultSource;
|
|
639
|
+
info.globalScope = globalScope;
|
|
640
|
+
info.moduleScope = moduleScope;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// List of all used names to avoid conflicts
|
|
645
|
+
const allUsedNames = new Set([
|
|
646
|
+
"__WEBPACK_MODULE_DEFAULT_EXPORT__", // avoid using this internal name
|
|
647
|
+
|
|
648
|
+
"abstract",
|
|
649
|
+
"arguments",
|
|
650
|
+
"async",
|
|
651
|
+
"await",
|
|
652
|
+
"boolean",
|
|
653
|
+
"break",
|
|
654
|
+
"byte",
|
|
655
|
+
"case",
|
|
656
|
+
"catch",
|
|
657
|
+
"char",
|
|
658
|
+
"class",
|
|
659
|
+
"const",
|
|
660
|
+
"continue",
|
|
661
|
+
"debugger",
|
|
662
|
+
"default",
|
|
663
|
+
"delete",
|
|
664
|
+
"do",
|
|
665
|
+
"double",
|
|
666
|
+
"else",
|
|
667
|
+
"enum",
|
|
668
|
+
"eval",
|
|
669
|
+
"export",
|
|
670
|
+
"extends",
|
|
671
|
+
"false",
|
|
672
|
+
"final",
|
|
673
|
+
"finally",
|
|
674
|
+
"float",
|
|
675
|
+
"for",
|
|
676
|
+
"function",
|
|
677
|
+
"goto",
|
|
678
|
+
"if",
|
|
679
|
+
"implements",
|
|
680
|
+
"import",
|
|
681
|
+
"in",
|
|
682
|
+
"instanceof",
|
|
683
|
+
"int",
|
|
684
|
+
"interface",
|
|
685
|
+
"let",
|
|
686
|
+
"long",
|
|
687
|
+
"native",
|
|
688
|
+
"new",
|
|
689
|
+
"null",
|
|
690
|
+
"package",
|
|
691
|
+
"private",
|
|
692
|
+
"protected",
|
|
693
|
+
"public",
|
|
694
|
+
"return",
|
|
695
|
+
"short",
|
|
696
|
+
"static",
|
|
697
|
+
"super",
|
|
698
|
+
"switch",
|
|
699
|
+
"synchronized",
|
|
700
|
+
"this",
|
|
701
|
+
"throw",
|
|
702
|
+
"throws",
|
|
703
|
+
"transient",
|
|
704
|
+
"true",
|
|
705
|
+
"try",
|
|
706
|
+
"typeof",
|
|
707
|
+
"var",
|
|
708
|
+
"void",
|
|
709
|
+
"volatile",
|
|
710
|
+
"while",
|
|
711
|
+
"with",
|
|
712
|
+
"yield",
|
|
713
|
+
|
|
714
|
+
"module",
|
|
715
|
+
"__dirname",
|
|
716
|
+
"__filename",
|
|
717
|
+
"exports",
|
|
718
|
+
|
|
719
|
+
"Array",
|
|
720
|
+
"Date",
|
|
721
|
+
"eval",
|
|
722
|
+
"function",
|
|
723
|
+
"hasOwnProperty",
|
|
724
|
+
"Infinity",
|
|
725
|
+
"isFinite",
|
|
726
|
+
"isNaN",
|
|
727
|
+
"isPrototypeOf",
|
|
728
|
+
"length",
|
|
729
|
+
"Math",
|
|
730
|
+
"NaN",
|
|
731
|
+
"name",
|
|
732
|
+
"Number",
|
|
733
|
+
"Object",
|
|
734
|
+
"prototype",
|
|
735
|
+
"String",
|
|
736
|
+
"toString",
|
|
737
|
+
"undefined",
|
|
738
|
+
"valueOf",
|
|
739
|
+
|
|
740
|
+
"alert",
|
|
741
|
+
"all",
|
|
742
|
+
"anchor",
|
|
743
|
+
"anchors",
|
|
744
|
+
"area",
|
|
745
|
+
"assign",
|
|
746
|
+
"blur",
|
|
747
|
+
"button",
|
|
748
|
+
"checkbox",
|
|
749
|
+
"clearInterval",
|
|
750
|
+
"clearTimeout",
|
|
751
|
+
"clientInformation",
|
|
752
|
+
"close",
|
|
753
|
+
"closed",
|
|
754
|
+
"confirm",
|
|
755
|
+
"constructor",
|
|
756
|
+
"crypto",
|
|
757
|
+
"decodeURI",
|
|
758
|
+
"decodeURIComponent",
|
|
759
|
+
"defaultStatus",
|
|
760
|
+
"document",
|
|
761
|
+
"element",
|
|
762
|
+
"elements",
|
|
763
|
+
"embed",
|
|
764
|
+
"embeds",
|
|
765
|
+
"encodeURI",
|
|
766
|
+
"encodeURIComponent",
|
|
767
|
+
"escape",
|
|
768
|
+
"event",
|
|
769
|
+
"fileUpload",
|
|
770
|
+
"focus",
|
|
771
|
+
"form",
|
|
772
|
+
"forms",
|
|
773
|
+
"frame",
|
|
774
|
+
"innerHeight",
|
|
775
|
+
"innerWidth",
|
|
776
|
+
"layer",
|
|
777
|
+
"layers",
|
|
778
|
+
"link",
|
|
779
|
+
"location",
|
|
780
|
+
"mimeTypes",
|
|
781
|
+
"navigate",
|
|
782
|
+
"navigator",
|
|
783
|
+
"frames",
|
|
784
|
+
"frameRate",
|
|
785
|
+
"hidden",
|
|
786
|
+
"history",
|
|
787
|
+
"image",
|
|
788
|
+
"images",
|
|
789
|
+
"offscreenBuffering",
|
|
790
|
+
"open",
|
|
791
|
+
"opener",
|
|
792
|
+
"option",
|
|
793
|
+
"outerHeight",
|
|
794
|
+
"outerWidth",
|
|
795
|
+
"packages",
|
|
796
|
+
"pageXOffset",
|
|
797
|
+
"pageYOffset",
|
|
798
|
+
"parent",
|
|
799
|
+
"parseFloat",
|
|
800
|
+
"parseInt",
|
|
801
|
+
"password",
|
|
802
|
+
"pkcs11",
|
|
803
|
+
"plugin",
|
|
804
|
+
"prompt",
|
|
805
|
+
"propertyIsEnum",
|
|
806
|
+
"radio",
|
|
807
|
+
"reset",
|
|
808
|
+
"screenX",
|
|
809
|
+
"screenY",
|
|
810
|
+
"scroll",
|
|
811
|
+
"secure",
|
|
812
|
+
"select",
|
|
813
|
+
"self",
|
|
814
|
+
"setInterval",
|
|
815
|
+
"setTimeout",
|
|
816
|
+
"status",
|
|
817
|
+
"submit",
|
|
818
|
+
"taint",
|
|
819
|
+
"text",
|
|
820
|
+
"textarea",
|
|
821
|
+
"top",
|
|
822
|
+
"unescape",
|
|
823
|
+
"untaint",
|
|
824
|
+
"window",
|
|
825
|
+
|
|
826
|
+
"onblur",
|
|
827
|
+
"onclick",
|
|
828
|
+
"onerror",
|
|
829
|
+
"onfocus",
|
|
830
|
+
"onkeydown",
|
|
831
|
+
"onkeypress",
|
|
832
|
+
"onkeyup",
|
|
833
|
+
"onmouseover",
|
|
834
|
+
"onload",
|
|
835
|
+
"onmouseup",
|
|
836
|
+
"onmousedown",
|
|
837
|
+
"onsubmit"
|
|
838
|
+
]);
|
|
839
|
+
|
|
840
|
+
// Set of already checked scopes
|
|
841
|
+
const alreadyCheckedScopes = new Set();
|
|
842
|
+
|
|
843
|
+
// get all global names
|
|
844
|
+
for (const info of modulesWithInfo) {
|
|
845
|
+
const superClassExpressions = [];
|
|
846
|
+
|
|
847
|
+
// ignore symbols from moduleScope
|
|
848
|
+
if (info.moduleScope) {
|
|
849
|
+
alreadyCheckedScopes.add(info.moduleScope);
|
|
850
|
+
|
|
851
|
+
// The super class expression in class scopes behaves weird
|
|
852
|
+
// We store ranges of all super class expressions to make
|
|
853
|
+
// renaming to work correctly
|
|
854
|
+
for (const childScope of info.moduleScope.childScopes) {
|
|
855
|
+
if (childScope.type !== "class") continue;
|
|
856
|
+
if (!childScope.block.superClass) continue;
|
|
857
|
+
superClassExpressions.push({
|
|
858
|
+
range: childScope.block.superClass.range,
|
|
859
|
+
variables: childScope.variables
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
// add global symbols
|
|
865
|
+
if (info.globalScope) {
|
|
866
|
+
for (const reference of info.globalScope.through) {
|
|
867
|
+
const name = reference.identifier.name;
|
|
868
|
+
if (
|
|
869
|
+
/^__WEBPACK_MODULE_REFERENCE__\d+_([\da-f]+|ns)(_call)?(_strict)?__$/.test(
|
|
870
|
+
name
|
|
871
|
+
)
|
|
872
|
+
) {
|
|
873
|
+
for (const expr of superClassExpressions) {
|
|
874
|
+
if (
|
|
875
|
+
expr.range[0] <= reference.identifier.range[0] &&
|
|
876
|
+
expr.range[1] >= reference.identifier.range[1]
|
|
877
|
+
) {
|
|
878
|
+
for (const variable of expr.variables) {
|
|
879
|
+
allUsedNames.add(variable.name);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
addScopeSymbols1(
|
|
884
|
+
reference.from,
|
|
885
|
+
allUsedNames,
|
|
886
|
+
alreadyCheckedScopes
|
|
887
|
+
);
|
|
888
|
+
} else {
|
|
889
|
+
allUsedNames.add(name);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
// generate names for symbols
|
|
896
|
+
for (const info of modulesWithInfo) {
|
|
897
|
+
switch (info.type) {
|
|
898
|
+
case "concatenated": {
|
|
899
|
+
const namespaceObjectName = this.findNewName(
|
|
900
|
+
"namespaceObject",
|
|
901
|
+
allUsedNames,
|
|
902
|
+
null,
|
|
903
|
+
info.module.readableIdentifier(requestShortener)
|
|
904
|
+
);
|
|
905
|
+
allUsedNames.add(namespaceObjectName);
|
|
906
|
+
info.internalNames.set(namespaceObjectName, namespaceObjectName);
|
|
907
|
+
info.exportMap.set(true, namespaceObjectName);
|
|
908
|
+
for (const variable of info.moduleScope.variables) {
|
|
909
|
+
const name = variable.name;
|
|
910
|
+
if (allUsedNames.has(name)) {
|
|
911
|
+
const references = getAllReferences(variable);
|
|
912
|
+
const symbolsInReferences = new Set();
|
|
913
|
+
const alreadyCheckedInnerScopes = new Set();
|
|
914
|
+
for (const ref of references) {
|
|
915
|
+
addScopeSymbols2(
|
|
916
|
+
ref.from,
|
|
917
|
+
symbolsInReferences,
|
|
918
|
+
alreadyCheckedInnerScopes,
|
|
919
|
+
alreadyCheckedScopes
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
const newName = this.findNewName(
|
|
923
|
+
name,
|
|
924
|
+
allUsedNames,
|
|
925
|
+
symbolsInReferences,
|
|
926
|
+
info.module.readableIdentifier(requestShortener)
|
|
927
|
+
);
|
|
928
|
+
allUsedNames.add(newName);
|
|
929
|
+
info.internalNames.set(name, newName);
|
|
930
|
+
const source = info.source;
|
|
931
|
+
const allIdentifiers = new Set(
|
|
932
|
+
references.map(r => r.identifier).concat(variable.identifiers)
|
|
933
|
+
);
|
|
934
|
+
for (const identifier of allIdentifiers) {
|
|
935
|
+
const r = identifier.range;
|
|
936
|
+
const path = getPathInAst(info.ast, identifier);
|
|
937
|
+
if (
|
|
938
|
+
path &&
|
|
939
|
+
path.length > 1 &&
|
|
940
|
+
path[1].type === "Property" &&
|
|
941
|
+
path[1].shorthand
|
|
942
|
+
) {
|
|
943
|
+
source.insert(r[1], `: ${newName}`);
|
|
944
|
+
} else {
|
|
945
|
+
source.replace(r[0], r[1] - 1, newName);
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
} else {
|
|
949
|
+
allUsedNames.add(name);
|
|
950
|
+
info.internalNames.set(name, name);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
break;
|
|
954
|
+
}
|
|
955
|
+
case "external": {
|
|
956
|
+
const externalName = this.findNewName(
|
|
957
|
+
"",
|
|
958
|
+
allUsedNames,
|
|
959
|
+
null,
|
|
960
|
+
info.module.readableIdentifier(requestShortener)
|
|
961
|
+
);
|
|
962
|
+
allUsedNames.add(externalName);
|
|
963
|
+
info.name = externalName;
|
|
964
|
+
if (
|
|
965
|
+
info.module.buildMeta.exportsType === "named" ||
|
|
966
|
+
!info.module.buildMeta.exportsType
|
|
967
|
+
) {
|
|
968
|
+
const externalNameInterop = this.findNewName(
|
|
969
|
+
"namespaceObject",
|
|
970
|
+
allUsedNames,
|
|
971
|
+
null,
|
|
972
|
+
info.module.readableIdentifier(requestShortener)
|
|
973
|
+
);
|
|
974
|
+
allUsedNames.add(externalNameInterop);
|
|
975
|
+
info.interopNamespaceObjectName = externalNameInterop;
|
|
976
|
+
}
|
|
977
|
+
if (!info.module.buildMeta.exportsType) {
|
|
978
|
+
const externalNameInterop = this.findNewName(
|
|
979
|
+
"default",
|
|
980
|
+
allUsedNames,
|
|
981
|
+
null,
|
|
982
|
+
info.module.readableIdentifier(requestShortener)
|
|
983
|
+
);
|
|
984
|
+
allUsedNames.add(externalNameInterop);
|
|
985
|
+
info.interopDefaultAccessName = externalNameInterop;
|
|
986
|
+
}
|
|
987
|
+
break;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
// Find and replace referenced to modules
|
|
993
|
+
for (const info of modulesWithInfo) {
|
|
994
|
+
if (info.type === "concatenated") {
|
|
995
|
+
for (const reference of info.globalScope.through) {
|
|
996
|
+
const name = reference.identifier.name;
|
|
997
|
+
const match = /^__WEBPACK_MODULE_REFERENCE__(\d+)_([\da-f]+|ns)(_call)?(_strict)?__$/.exec(
|
|
998
|
+
name
|
|
999
|
+
);
|
|
1000
|
+
if (match) {
|
|
1001
|
+
const referencedModule = modulesWithInfo[+match[1]];
|
|
1002
|
+
let exportName;
|
|
1003
|
+
if (match[2] === "ns") {
|
|
1004
|
+
exportName = true;
|
|
1005
|
+
} else {
|
|
1006
|
+
const exportData = match[2];
|
|
1007
|
+
exportName = Buffer.from(exportData, "hex").toString("utf-8");
|
|
1008
|
+
}
|
|
1009
|
+
const asCall = !!match[3];
|
|
1010
|
+
const strictHarmonyModule = !!match[4];
|
|
1011
|
+
const finalName = getFinalName(
|
|
1012
|
+
referencedModule,
|
|
1013
|
+
exportName,
|
|
1014
|
+
moduleToInfoMap,
|
|
1015
|
+
requestShortener,
|
|
1016
|
+
asCall,
|
|
1017
|
+
strictHarmonyModule
|
|
1018
|
+
);
|
|
1019
|
+
const r = reference.identifier.range;
|
|
1020
|
+
const source = info.source;
|
|
1021
|
+
source.replace(r[0], r[1] - 1, finalName);
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
const result = new ConcatSource();
|
|
1028
|
+
|
|
1029
|
+
// add harmony compatibility flag (must be first because of possible circular dependencies)
|
|
1030
|
+
const usedExports = this.rootModule.usedExports;
|
|
1031
|
+
if (usedExports === true) {
|
|
1032
|
+
result.add(
|
|
1033
|
+
runtimeTemplate.defineEsModuleFlagStatement({
|
|
1034
|
+
exportsArgument: this.exportsArgument
|
|
1035
|
+
})
|
|
1036
|
+
);
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
// define required namespace objects (must be before evaluation modules)
|
|
1040
|
+
for (const info of modulesWithInfo) {
|
|
1041
|
+
if (info.namespaceObjectSource) {
|
|
1042
|
+
result.add(info.namespaceObjectSource);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
// evaluate modules in order
|
|
1047
|
+
for (const info of modulesWithInfo) {
|
|
1048
|
+
switch (info.type) {
|
|
1049
|
+
case "concatenated":
|
|
1050
|
+
result.add(
|
|
1051
|
+
`\n// CONCATENATED MODULE: ${info.module.readableIdentifier(
|
|
1052
|
+
requestShortener
|
|
1053
|
+
)}\n`
|
|
1054
|
+
);
|
|
1055
|
+
result.add(info.source);
|
|
1056
|
+
break;
|
|
1057
|
+
case "external":
|
|
1058
|
+
result.add(
|
|
1059
|
+
`\n// EXTERNAL MODULE: ${info.module.readableIdentifier(
|
|
1060
|
+
requestShortener
|
|
1061
|
+
)}\n`
|
|
1062
|
+
);
|
|
1063
|
+
result.add(
|
|
1064
|
+
`var ${info.name} = __webpack_require__(${JSON.stringify(
|
|
1065
|
+
info.module.id
|
|
1066
|
+
)});\n`
|
|
1067
|
+
);
|
|
1068
|
+
if (info.interopNamespaceObjectUsed) {
|
|
1069
|
+
if (info.module.buildMeta.exportsType === "named") {
|
|
1070
|
+
result.add(
|
|
1071
|
+
`var ${
|
|
1072
|
+
info.interopNamespaceObjectName
|
|
1073
|
+
} = /*#__PURE__*/__webpack_require__.t(${info.name}, 2);\n`
|
|
1074
|
+
);
|
|
1075
|
+
} else if (!info.module.buildMeta.exportsType) {
|
|
1076
|
+
result.add(
|
|
1077
|
+
`var ${
|
|
1078
|
+
info.interopNamespaceObjectName
|
|
1079
|
+
} = /*#__PURE__*/__webpack_require__.t(${info.name});\n`
|
|
1080
|
+
);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
if (info.interopDefaultAccessUsed) {
|
|
1084
|
+
result.add(
|
|
1085
|
+
`var ${
|
|
1086
|
+
info.interopDefaultAccessName
|
|
1087
|
+
} = /*#__PURE__*/__webpack_require__.n(${info.name});\n`
|
|
1088
|
+
);
|
|
1089
|
+
}
|
|
1090
|
+
break;
|
|
1091
|
+
default:
|
|
1092
|
+
throw new Error(`Unsupported concatenation entry type ${info.type}`);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
return result;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
findNewName(oldName, usedNamed1, usedNamed2, extraInfo) {
|
|
1100
|
+
let name = oldName;
|
|
1101
|
+
|
|
1102
|
+
if (name === "__WEBPACK_MODULE_DEFAULT_EXPORT__") name = "";
|
|
1103
|
+
|
|
1104
|
+
// Remove uncool stuff
|
|
1105
|
+
extraInfo = extraInfo.replace(
|
|
1106
|
+
/\.+\/|(\/index)?\.([a-zA-Z0-9]{1,4})($|\s|\?)|\s*\+\s*\d+\s*modules/g,
|
|
1107
|
+
""
|
|
1108
|
+
);
|
|
1109
|
+
|
|
1110
|
+
const splittedInfo = extraInfo.split("/");
|
|
1111
|
+
while (splittedInfo.length) {
|
|
1112
|
+
name = splittedInfo.pop() + (name ? "_" + name : "");
|
|
1113
|
+
const nameIdent = Template.toIdentifier(name);
|
|
1114
|
+
if (
|
|
1115
|
+
!usedNamed1.has(nameIdent) &&
|
|
1116
|
+
(!usedNamed2 || !usedNamed2.has(nameIdent))
|
|
1117
|
+
)
|
|
1118
|
+
return nameIdent;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
let i = 0;
|
|
1122
|
+
let nameWithNumber = Template.toIdentifier(`${name}_${i}`);
|
|
1123
|
+
while (
|
|
1124
|
+
usedNamed1.has(nameWithNumber) ||
|
|
1125
|
+
(usedNamed2 && usedNamed2.has(nameWithNumber))
|
|
1126
|
+
) {
|
|
1127
|
+
i++;
|
|
1128
|
+
nameWithNumber = Template.toIdentifier(`${name}_${i}`);
|
|
1129
|
+
}
|
|
1130
|
+
return nameWithNumber;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
updateHash(hash) {
|
|
1134
|
+
for (const info of this._orderedConcatenationList) {
|
|
1135
|
+
switch (info.type) {
|
|
1136
|
+
case "concatenated":
|
|
1137
|
+
info.module.updateHash(hash);
|
|
1138
|
+
break;
|
|
1139
|
+
case "external":
|
|
1140
|
+
hash.update(`${info.module.id}`);
|
|
1141
|
+
break;
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
super.updateHash(hash);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
class HarmonyImportSpecifierDependencyConcatenatedTemplate {
|
|
1149
|
+
constructor(originalTemplate, modulesMap) {
|
|
1150
|
+
this.originalTemplate = originalTemplate;
|
|
1151
|
+
this.modulesMap = modulesMap;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
getHarmonyInitOrder(dep) {
|
|
1155
|
+
const module = dep._module;
|
|
1156
|
+
const info = this.modulesMap.get(module);
|
|
1157
|
+
if (!info) {
|
|
1158
|
+
return this.originalTemplate.getHarmonyInitOrder(dep);
|
|
1159
|
+
}
|
|
1160
|
+
return NaN;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
harmonyInit(dep, source, runtimeTemplate, dependencyTemplates) {
|
|
1164
|
+
const module = dep._module;
|
|
1165
|
+
const info = this.modulesMap.get(module);
|
|
1166
|
+
if (!info) {
|
|
1167
|
+
this.originalTemplate.harmonyInit(
|
|
1168
|
+
dep,
|
|
1169
|
+
source,
|
|
1170
|
+
runtimeTemplate,
|
|
1171
|
+
dependencyTemplates
|
|
1172
|
+
);
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
apply(dep, source, runtime, dependencyTemplates) {
|
|
1178
|
+
const module = dep._module;
|
|
1179
|
+
const info = this.modulesMap.get(module);
|
|
1180
|
+
if (!info) {
|
|
1181
|
+
this.originalTemplate.apply(dep, source, runtime, dependencyTemplates);
|
|
1182
|
+
return;
|
|
1183
|
+
}
|
|
1184
|
+
let content;
|
|
1185
|
+
const callFlag = dep.call ? "_call" : "";
|
|
1186
|
+
const strictFlag = dep.originModule.buildMeta.strictHarmonyModule
|
|
1187
|
+
? "_strict"
|
|
1188
|
+
: "";
|
|
1189
|
+
if (dep._id === null) {
|
|
1190
|
+
content = `__WEBPACK_MODULE_REFERENCE__${info.index}_ns${strictFlag}__`;
|
|
1191
|
+
} else if (dep.namespaceObjectAsContext) {
|
|
1192
|
+
content = `__WEBPACK_MODULE_REFERENCE__${
|
|
1193
|
+
info.index
|
|
1194
|
+
}_ns${strictFlag}__[${JSON.stringify(dep._id)}]`;
|
|
1195
|
+
} else {
|
|
1196
|
+
const exportData = Buffer.from(dep._id, "utf-8").toString("hex");
|
|
1197
|
+
content = `__WEBPACK_MODULE_REFERENCE__${
|
|
1198
|
+
info.index
|
|
1199
|
+
}_${exportData}${callFlag}${strictFlag}__`;
|
|
1200
|
+
}
|
|
1201
|
+
if (dep.shorthand) {
|
|
1202
|
+
content = dep.name + ": " + content;
|
|
1203
|
+
}
|
|
1204
|
+
source.replace(dep.range[0], dep.range[1] - 1, content);
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
class HarmonyImportSideEffectDependencyConcatenatedTemplate {
|
|
1209
|
+
constructor(originalTemplate, modulesMap) {
|
|
1210
|
+
this.originalTemplate = originalTemplate;
|
|
1211
|
+
this.modulesMap = modulesMap;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
getHarmonyInitOrder(dep) {
|
|
1215
|
+
const module = dep._module;
|
|
1216
|
+
const info = this.modulesMap.get(module);
|
|
1217
|
+
if (!info) {
|
|
1218
|
+
return this.originalTemplate.getHarmonyInitOrder(dep);
|
|
1219
|
+
}
|
|
1220
|
+
return NaN;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
harmonyInit(dep, source, runtime, dependencyTemplates) {
|
|
1224
|
+
const module = dep._module;
|
|
1225
|
+
const info = this.modulesMap.get(module);
|
|
1226
|
+
if (!info) {
|
|
1227
|
+
this.originalTemplate.harmonyInit(
|
|
1228
|
+
dep,
|
|
1229
|
+
source,
|
|
1230
|
+
runtime,
|
|
1231
|
+
dependencyTemplates
|
|
1232
|
+
);
|
|
1233
|
+
return;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
apply(dep, source, runtime, dependencyTemplates) {
|
|
1238
|
+
const module = dep._module;
|
|
1239
|
+
const info = this.modulesMap.get(module);
|
|
1240
|
+
if (!info) {
|
|
1241
|
+
this.originalTemplate.apply(dep, source, runtime, dependencyTemplates);
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
class HarmonyExportSpecifierDependencyConcatenatedTemplate {
|
|
1248
|
+
constructor(originalTemplate, rootModule) {
|
|
1249
|
+
this.originalTemplate = originalTemplate;
|
|
1250
|
+
this.rootModule = rootModule;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
getHarmonyInitOrder(dep) {
|
|
1254
|
+
if (dep.originModule === this.rootModule) {
|
|
1255
|
+
return this.originalTemplate.getHarmonyInitOrder(dep);
|
|
1256
|
+
}
|
|
1257
|
+
return NaN;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
harmonyInit(dep, source, runtime, dependencyTemplates) {
|
|
1261
|
+
if (dep.originModule === this.rootModule) {
|
|
1262
|
+
this.originalTemplate.harmonyInit(
|
|
1263
|
+
dep,
|
|
1264
|
+
source,
|
|
1265
|
+
runtime,
|
|
1266
|
+
dependencyTemplates
|
|
1267
|
+
);
|
|
1268
|
+
return;
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
apply(dep, source, runtime, dependencyTemplates) {
|
|
1273
|
+
if (dep.originModule === this.rootModule) {
|
|
1274
|
+
this.originalTemplate.apply(dep, source, runtime, dependencyTemplates);
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
class HarmonyExportExpressionDependencyConcatenatedTemplate {
|
|
1280
|
+
constructor(originalTemplate, rootModule) {
|
|
1281
|
+
this.originalTemplate = originalTemplate;
|
|
1282
|
+
this.rootModule = rootModule;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
apply(dep, source, runtime, dependencyTemplates) {
|
|
1286
|
+
let content =
|
|
1287
|
+
"/* harmony default export */ var __WEBPACK_MODULE_DEFAULT_EXPORT__ = ";
|
|
1288
|
+
if (dep.originModule === this.rootModule) {
|
|
1289
|
+
const used = dep.originModule.isUsed("default");
|
|
1290
|
+
const exportsName = dep.originModule.exportsArgument;
|
|
1291
|
+
if (used) content += `${exportsName}[${JSON.stringify(used)}] = `;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
if (dep.range) {
|
|
1295
|
+
source.replace(dep.rangeStatement[0], dep.range[0] - 1, content + "(");
|
|
1296
|
+
source.replace(dep.range[1], dep.rangeStatement[1] - 1, ");");
|
|
1297
|
+
return;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
source.replace(dep.rangeStatement[0], dep.rangeStatement[1] - 1, content);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
class HarmonyExportImportedSpecifierDependencyConcatenatedTemplate {
|
|
1305
|
+
constructor(originalTemplate, rootModule, modulesMap) {
|
|
1306
|
+
this.originalTemplate = originalTemplate;
|
|
1307
|
+
this.rootModule = rootModule;
|
|
1308
|
+
this.modulesMap = modulesMap;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
getExports(dep) {
|
|
1312
|
+
const importModule = dep._module;
|
|
1313
|
+
if (dep.id) {
|
|
1314
|
+
// export { named } from "module"
|
|
1315
|
+
return [
|
|
1316
|
+
{
|
|
1317
|
+
name: dep.name,
|
|
1318
|
+
id: dep.id,
|
|
1319
|
+
module: importModule
|
|
1320
|
+
}
|
|
1321
|
+
];
|
|
1322
|
+
}
|
|
1323
|
+
if (dep.name) {
|
|
1324
|
+
// export * as abc from "module"
|
|
1325
|
+
return [
|
|
1326
|
+
{
|
|
1327
|
+
name: dep.name,
|
|
1328
|
+
id: true,
|
|
1329
|
+
module: importModule
|
|
1330
|
+
}
|
|
1331
|
+
];
|
|
1332
|
+
}
|
|
1333
|
+
// export * from "module"
|
|
1334
|
+
return importModule.buildMeta.providedExports
|
|
1335
|
+
.filter(exp => exp !== "default" && !dep.activeExports.has(exp))
|
|
1336
|
+
.map(exp => {
|
|
1337
|
+
return {
|
|
1338
|
+
name: exp,
|
|
1339
|
+
id: exp,
|
|
1340
|
+
module: importModule
|
|
1341
|
+
};
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
getHarmonyInitOrder(dep) {
|
|
1346
|
+
const module = dep._module;
|
|
1347
|
+
const info = this.modulesMap.get(module);
|
|
1348
|
+
if (!info) {
|
|
1349
|
+
return this.originalTemplate.getHarmonyInitOrder(dep);
|
|
1350
|
+
}
|
|
1351
|
+
return NaN;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
harmonyInit(dep, source, runtime, dependencyTemplates) {
|
|
1355
|
+
const module = dep._module;
|
|
1356
|
+
const info = this.modulesMap.get(module);
|
|
1357
|
+
if (!info) {
|
|
1358
|
+
this.originalTemplate.harmonyInit(
|
|
1359
|
+
dep,
|
|
1360
|
+
source,
|
|
1361
|
+
runtime,
|
|
1362
|
+
dependencyTemplates
|
|
1363
|
+
);
|
|
1364
|
+
return;
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
apply(dep, source, runtime, dependencyTemplates) {
|
|
1369
|
+
if (dep.originModule === this.rootModule) {
|
|
1370
|
+
if (this.modulesMap.get(dep._module)) {
|
|
1371
|
+
const exportDefs = this.getExports(dep);
|
|
1372
|
+
for (const def of exportDefs) {
|
|
1373
|
+
const info = this.modulesMap.get(def.module);
|
|
1374
|
+
const used = dep.originModule.isUsed(def.name);
|
|
1375
|
+
if (!used) {
|
|
1376
|
+
source.insert(
|
|
1377
|
+
-1,
|
|
1378
|
+
`/* unused concated harmony import ${dep.name} */\n`
|
|
1379
|
+
);
|
|
1380
|
+
}
|
|
1381
|
+
let finalName;
|
|
1382
|
+
const strictFlag = dep.originModule.buildMeta.strictHarmonyModule
|
|
1383
|
+
? "_strict"
|
|
1384
|
+
: "";
|
|
1385
|
+
if (def.id === true) {
|
|
1386
|
+
finalName = `__WEBPACK_MODULE_REFERENCE__${
|
|
1387
|
+
info.index
|
|
1388
|
+
}_ns${strictFlag}__`;
|
|
1389
|
+
} else {
|
|
1390
|
+
const exportData = Buffer.from(def.id, "utf-8").toString("hex");
|
|
1391
|
+
finalName = `__WEBPACK_MODULE_REFERENCE__${
|
|
1392
|
+
info.index
|
|
1393
|
+
}_${exportData}${strictFlag}__`;
|
|
1394
|
+
}
|
|
1395
|
+
const exportsName = this.rootModule.exportsArgument;
|
|
1396
|
+
const content = `/* concated harmony reexport */__webpack_require__.d(${exportsName}, ${JSON.stringify(
|
|
1397
|
+
used
|
|
1398
|
+
)}, function() { return ${finalName}; });\n`;
|
|
1399
|
+
source.insert(-1, content);
|
|
1400
|
+
}
|
|
1401
|
+
} else {
|
|
1402
|
+
this.originalTemplate.apply(dep, source, runtime, dependencyTemplates);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
class HarmonyCompatibilityDependencyConcatenatedTemplate {
|
|
1409
|
+
constructor(originalTemplate, rootModule, modulesMap) {
|
|
1410
|
+
this.originalTemplate = originalTemplate;
|
|
1411
|
+
this.rootModule = rootModule;
|
|
1412
|
+
this.modulesMap = modulesMap;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
apply(dep, source, runtime, dependencyTemplates) {
|
|
1416
|
+
// do nothing
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
module.exports = ConcatenatedModule;
|