MCPcopy
hub / github.com/webpack/webpack / _findNewName

Method _findNewName

lib/optimize/ConcatenatedModule.js:1637–1663  ·  view source on GitHub ↗
(name, info, references)

Source from the content-addressed store, hash-verified

1635 * @returns {string | undefined} the new name or undefined if the name is not found
1636 */
1637 const _findNewName = (name, info, references) => {
1638 const { usedNames, alreadyCheckedScopes } = getUsedNamesInScopeInfo(
1639 usedNamesInScopeInfo,
1640 info.module.identifier(),
1641 name
1642 );
1643 if (allUsedNames.has(name) || usedNames.has(name)) {
1644 for (const ref of references) {
1645 addScopeSymbols(
1646 ref.from,
1647 usedNames,
1648 alreadyCheckedScopes,
1649 ignoredScopes
1650 );
1651 }
1652 const newName = findNewName(
1653 name,
1654 allUsedNames,
1655 usedNames,
1656 info.module.readableIdentifier(requestShortener)
1657 );
1658 allUsedNames.add(newName);
1659 info.internalNames.set(name, newName);
1660 topLevelDeclarations.add(newName);
1661 return newName;
1662 }
1663 };
1664
1665 /**
1666 * @param {string} name the name to find a new name for

Callers

nothing calls this directly

Calls 8

getUsedNamesInScopeInfoFunction · 0.85
addScopeSymbolsFunction · 0.85
findNewNameFunction · 0.85
identifierMethod · 0.45
hasMethod · 0.45
readableIdentifierMethod · 0.45
addMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected