MCPcopy
hub / github.com/webpack/webpack / enterModule

Method enterModule

lib/optimize/ConcatenatedModule.js:1210–1324  ·  view source on GitHub ↗
(connection, runtimeCondition, nonDeferAccess)

Source from the content-addressed store, hash-verified

1208 * @returns {void}
1209 */
1210 const enterModule = (connection, runtimeCondition, nonDeferAccess) => {
1211 const module = connection.module;
1212 if (!module) return;
1213 const existingEntry = existingEntries.get(module);
1214 if (
1215 existingEntry &&
1216 existingEntry.runtimeCondition === true &&
1217 existingEntry.nonDeferAccess === true
1218 ) {
1219 return;
1220 }
1221 if (modulesSet.has(module)) {
1222 existingEntries.set(module, {
1223 runtimeCondition: true,
1224 nonDeferAccess: true
1225 });
1226 if (runtimeCondition !== true) {
1227 throw new Error(
1228 `Cannot runtime-conditional concatenate a module (${module.identifier()} in ${this.rootModule.identifier()}, ${runtimeConditionToString(
1229 runtimeCondition
1230 )}). This should not happen.`
1231 );
1232 }
1233 if (nonDeferAccess !== true) {
1234 throw new Error(
1235 `Cannot deferred concatenate a module (${module.identifier()} in ${this.rootModule.identifier()}. This should not happen.`
1236 );
1237 }
1238 const imports = getConcatenatedImports(module);
1239 for (const {
1240 connection,
1241 runtimeCondition,
1242 nonDeferAccess
1243 } of imports) {
1244 enterModule(connection, runtimeCondition, nonDeferAccess);
1245 }
1246 list.push({
1247 type: "concatenated",
1248 module: connection.module,
1249 runtimeCondition,
1250 nonDeferAccess
1251 });
1252 } else {
1253 /** @type {RuntimeSpec | boolean} */
1254 let reducedRuntimeCondition;
1255 /** @type {NonDeferAccess} */
1256 let reducedNonDeferAccess;
1257 if (existingEntry !== undefined) {
1258 reducedRuntimeCondition = subtractRuntimeCondition(
1259 runtimeCondition,
1260 existingEntry.runtimeCondition,
1261 runtime
1262 );
1263 reducedNonDeferAccess = subtractNonDeferAccess(
1264 nonDeferAccess,
1265 existingEntry.nonDeferAccess
1266 );
1267 if (

Callers

nothing calls this directly

Calls 11

runtimeConditionToStringFunction · 0.85
subtractRuntimeConditionFunction · 0.85
subtractNonDeferAccessFunction · 0.85
mergeNonDeferAccessFunction · 0.85
mergeRuntimeConditionFunction · 0.85
getMethod · 0.45
hasMethod · 0.45
setMethod · 0.45
identifierMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected