MCPcopy
hub / github.com/webpack/webpack / getUsedInfo

Method getUsedInfo

lib/ExportsInfo.js:1854–1894  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1852 }
1853
1854 getUsedInfo() {
1855 if (this._globalUsed !== undefined) {
1856 switch (this._globalUsed) {
1857 case UsageState.Unused:
1858 return "unused";
1859 case UsageState.NoInfo:
1860 return "no usage info";
1861 case UsageState.Unknown:
1862 return "maybe used (runtime-defined)";
1863 case UsageState.Used:
1864 return "used";
1865 case UsageState.OnlyPropertiesUsed:
1866 return "only properties used";
1867 }
1868 } else if (this._usedInRuntime !== undefined) {
1869 /** @type {Map<RuntimeUsageStateType, string[]>} */
1870 const map = new Map();
1871 for (const [runtime, used] of this._usedInRuntime) {
1872 const list = map.get(used);
1873 if (list !== undefined) list.push(runtime);
1874 else map.set(used, [runtime]);
1875 }
1876 // eslint-disable-next-line array-callback-return
1877 const specificInfo = Array.from(map, ([used, runtimes]) => {
1878 switch (used) {
1879 case UsageState.NoInfo:
1880 return `no usage info in ${runtimes.join(", ")}`;
1881 case UsageState.Unknown:
1882 return `maybe used in ${runtimes.join(", ")} (runtime-defined)`;
1883 case UsageState.Used:
1884 return `used in ${runtimes.join(", ")}`;
1885 case UsageState.OnlyPropertiesUsed:
1886 return `only properties used in ${runtimes.join(", ")}`;
1887 }
1888 });
1889 if (specificInfo.length > 0) {
1890 return specificInfo.join("; ");
1891 }
1892 }
1893 return this._hasUseInRuntimeInfo ? "unused" : "no usage info";
1894 }
1895
1896 getProvidedInfo() {
1897 switch (this.provided) {

Callers 2

printExportsInfoToSourceFunction · 0.80
applyMethod · 0.80

Calls 3

getMethod · 0.45
pushMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected