_getMetadataObjectsBySourceNames() — react Function Reference
Architecture documentation for the _getMetadataObjectsBySourceNames() function in SourceMapMetadataConsumer.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 8436bb82_dab4_7302_5fc5_eff8d217773c["_getMetadataObjectsBySourceNames()"] c91679b7_c93e_6e95_410e_81e24076c30a["SourceMapMetadataConsumer"] 8436bb82_dab4_7302_5fc5_eff8d217773c -->|defined in| c91679b7_c93e_6e95_410e_81e24076c30a c02a4f80_a820_866d_445a_6951aae599f7["_getMetadataBySource()"] c02a4f80_a820_866d_445a_6951aae599f7 -->|calls| 8436bb82_dab4_7302_5fc5_eff8d217773c 320a3b4e_798e_d179_0b68_c45b971d0001["normalizeSourcePath()"] 8436bb82_dab4_7302_5fc5_eff8d217773c -->|calls| 320a3b4e_798e_d179_0b68_c45b971d0001 style 8436bb82_dab4_7302_5fc5_eff8d217773c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-devtools-shared/src/hooks/SourceMapMetadataConsumer.js lines 131–184
_getMetadataObjectsBySourceNames(sourcemap: MixedSourceMap): MetadataMap {
if (sourcemap.mappings === undefined) {
const indexSourceMap: IndexSourceMap = sourcemap;
const metadataMap = new Map<string, ?ReactSourceMetadata>();
indexSourceMap.sections.forEach(section => {
const metadataMapForIndexMap = this._getMetadataObjectsBySourceNames(
section.map,
);
metadataMapForIndexMap.forEach((value, key) => {
metadataMap.set(key, value);
});
});
return metadataMap;
}
const metadataMap: MetadataMap = new Map();
const basicMap: BasicSourceMap = sourcemap;
const updateMap = (metadata: ReactSourceMetadata, sourceIndex: number) => {
let source = basicMap.sources[sourceIndex];
if (source != null) {
source = normalizeSourcePath(source, basicMap);
metadataMap.set(source, metadata);
}
};
if (
sourcemap.hasOwnProperty(REACT_SOURCES_EXTENSION_KEY) &&
sourcemap[REACT_SOURCES_EXTENSION_KEY] != null
) {
const reactMetadataArray = sourcemap[REACT_SOURCES_EXTENSION_KEY];
reactMetadataArray.filter(Boolean).forEach(updateMap);
} else if (
sourcemap.hasOwnProperty(FB_SOURCES_EXTENSION_KEY) &&
sourcemap[FB_SOURCES_EXTENSION_KEY] != null
) {
const fbMetadataArray = sourcemap[FB_SOURCES_EXTENSION_KEY];
if (fbMetadataArray != null) {
fbMetadataArray.forEach((fbMetadata, sourceIndex) => {
// When extending source maps with React metadata using the
// x_facebook_sources field, the position at index 1 on the
// metadata tuple is reserved for React metadata
const reactMetadata =
fbMetadata != null
? fbMetadata[REACT_METADATA_INDEX_IN_FB_METADATA]
: null;
if (reactMetadata != null) {
updateMap(reactMetadata, sourceIndex);
}
});
}
}
return metadataMap;
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does _getMetadataObjectsBySourceNames() do?
_getMetadataObjectsBySourceNames() is a function in the react codebase, defined in packages/react-devtools-shared/src/hooks/SourceMapMetadataConsumer.js.
Where is _getMetadataObjectsBySourceNames() defined?
_getMetadataObjectsBySourceNames() is defined in packages/react-devtools-shared/src/hooks/SourceMapMetadataConsumer.js at line 131.
What does _getMetadataObjectsBySourceNames() call?
_getMetadataObjectsBySourceNames() calls 1 function(s): normalizeSourcePath.
What calls _getMetadataObjectsBySourceNames()?
_getMetadataObjectsBySourceNames() is called by 1 function(s): _getMetadataBySource.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free