MCPcopy
hub / github.com/webpack/webpack / setUnknownExportsProvided

Method setUnknownExportsProvided

lib/ExportsInfo.js:407–475  ·  view source on GitHub ↗

* Sets unknown exports provided. * @param {boolean=} canMangle true, if exports can still be mangled (defaults to false) * @param {ExportsSpecExcludeExports=} excludeExports list of unaffected exports * @param {Dependency=} targetKey use this as key for the target * @param {ModuleGraphConnec

(
		canMangle,
		excludeExports,
		targetKey,
		targetModule,
		priority
	)

Source from the content-addressed store, hash-verified

405 * @returns {boolean} true, if this call changed something
406 */
407 setUnknownExportsProvided(
408 canMangle,
409 excludeExports,
410 targetKey,
411 targetModule,
412 priority
413 ) {
414 let changed = false;
415 if (excludeExports) {
416 for (const name of excludeExports) {
417 // Make sure these entries exist, so they can get different info
418 this.getExportInfo(name);
419 }
420 }
421 for (const exportInfo of this._exports.values()) {
422 if (!canMangle && exportInfo.canMangleProvide !== false) {
423 exportInfo.canMangleProvide = false;
424 changed = true;
425 }
426 if (excludeExports && excludeExports.has(exportInfo.name)) continue;
427 if (exportInfo.provided !== true && exportInfo.provided !== null) {
428 exportInfo.provided = null;
429 changed = true;
430 }
431 if (targetKey) {
432 exportInfo.setTarget(
433 targetKey,
434 /** @type {ModuleGraphConnection} */
435 (targetModule),
436 [exportInfo.name],
437 -1
438 );
439 }
440 }
441 if (this._redirectTo !== undefined) {
442 if (
443 this._redirectTo.setUnknownExportsProvided(
444 canMangle,
445 excludeExports,
446 targetKey,
447 targetModule,
448 priority
449 )
450 ) {
451 changed = true;
452 }
453 } else {
454 if (
455 this._otherExportsInfo.provided !== true &&
456 this._otherExportsInfo.provided !== null
457 ) {
458 this._otherExportsInfo.provided = null;
459 changed = true;
460 }
461 if (!canMangle && this._otherExportsInfo.canMangleProvide !== false) {
462 this._otherExportsInfo.canMangleProvide = false;
463 changed = true;
464 }

Callers 2

applyMethod · 0.80
processExportsSpecMethod · 0.80

Calls 4

getExportInfoMethod · 0.95
setTargetMethod · 0.80
valuesMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected