MCPcopy
hub / github.com/webpack/webpack / _factorizeModule

Method _factorizeModule

lib/Compilation.js:2194–2273  ·  view source on GitHub ↗

* Processes the provided factorize module option. * @param {FactorizeModuleOptions} options options * @param {ModuleOrModuleFactoryResultCallback} callback callback * @returns {void}

(
		{
			currentProfile,
			factory,
			dependencies,
			originModule,
			factoryResult,
			contextInfo,
			context
		},
		callback
	)

Source from the content-addressed store, hash-verified

2192 * @returns {void}
2193 */
2194 _factorizeModule(
2195 {
2196 currentProfile,
2197 factory,
2198 dependencies,
2199 originModule,
2200 factoryResult,
2201 contextInfo,
2202 context
2203 },
2204 callback
2205 ) {
2206 if (currentProfile !== undefined) {
2207 currentProfile.markFactoryStart();
2208 }
2209 factory.create(
2210 {
2211 contextInfo: {
2212 issuer: originModule
2213 ? /** @type {NameForCondition} */ (originModule.nameForCondition())
2214 : "",
2215 issuerLayer: originModule ? originModule.layer : null,
2216 compiler: this.compiler.name,
2217 ...contextInfo
2218 },
2219 resolveOptions: originModule ? originModule.resolveOptions : undefined,
2220 context:
2221 context ||
2222 (originModule
2223 ? /** @type {string} */ (originModule.context)
2224 : this.compiler.context),
2225 dependencies
2226 },
2227 (err, result) => {
2228 if (result) {
2229 // TODO webpack 6: remove
2230 // For backward-compat
2231 if (result.module === undefined && result instanceof Module) {
2232 result = {
2233 module: result
2234 };
2235 }
2236 if (!factoryResult) {
2237 const {
2238 fileDependencies,
2239 contextDependencies,
2240 missingDependencies
2241 } = result;
2242 if (fileDependencies) {
2243 this.fileDependencies.addAll(fileDependencies);
2244 }
2245 if (contextDependencies) {
2246 this.contextDependencies.addAll(contextDependencies);
2247 }
2248 if (missingDependencies) {
2249 this.missingDependencies.addAll(missingDependencies);
2250 }
2251 }

Callers

nothing calls this directly

Calls 6

markFactoryStartMethod · 0.80
markFactoryEndMethod · 0.80
callbackFunction · 0.50
createMethod · 0.45
nameForConditionMethod · 0.45
addAllMethod · 0.45

Tested by

no test coverage detected