parseSourceMaps() — react Function Reference
Architecture documentation for the parseSourceMaps() function in parseSourceAndMetadata.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 8c28c20e_c018_805c_fb8b_af3ef055a8d3["parseSourceMaps()"] 76da1f28_5fe1_2c37_5657_67756acc6f55["parseSourceAndMetadata.js"] 8c28c20e_c018_805c_fb8b_af3ef055a8d3 -->|defined in| 76da1f28_5fe1_2c37_5657_67756acc6f55 fba84d46_f44f_7ea7_9af3_a0121e3e1415["parseSourceAndMetadata()"] fba84d46_f44f_7ea7_9af3_a0121e3e1415 -->|calls| 8c28c20e_c018_805c_fb8b_af3ef055a8d3 style 8c28c20e_c018_805c_fb8b_af3ef055a8d3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.js lines 383–436
function parseSourceMaps(
locationKeyToHookSourceAndMetadata: LocationKeyToHookSourceAndMetadata,
locationKeyToHookParsedMetadata: LocationKeyToHookParsedMetadata,
) {
locationKeyToHookSourceAndMetadata.forEach(
(hookSourceAndMetadata, locationKey) => {
const hookParsedMetadata =
locationKeyToHookParsedMetadata.get(locationKey);
if (hookParsedMetadata == null) {
throw Error(`Expected to find HookParsedMetadata for "${locationKey}"`);
}
const {runtimeSourceURL, sourceMapJSON} = hookSourceAndMetadata;
// If we've already loaded the source map info for this file,
// we can skip reloading it (and more importantly, re-parsing it).
const runtimeMetadata = runtimeURLToMetadataCache.get(runtimeSourceURL);
if (runtimeMetadata != null) {
if (__DEBUG__) {
console.groupCollapsed(
`parseHookNames() Found cached runtime metadata for file "${runtimeSourceURL}"`,
);
console.log(runtimeMetadata);
console.groupEnd();
}
hookParsedMetadata.metadataConsumer = runtimeMetadata.metadataConsumer;
hookParsedMetadata.sourceMapConsumer =
runtimeMetadata.sourceMapConsumer;
} else {
if (sourceMapJSON != null) {
const sourceMapConsumer = withSyncPerfMeasurements(
'new SourceMapConsumer(sourceMapJSON)',
() => SourceMapConsumer(sourceMapJSON),
);
const metadataConsumer = withSyncPerfMeasurements(
'new SourceMapMetadataConsumer(sourceMapJSON)',
() => new SourceMapMetadataConsumer(sourceMapJSON),
);
hookParsedMetadata.metadataConsumer = metadataConsumer;
hookParsedMetadata.sourceMapConsumer = sourceMapConsumer;
// Only set once to avoid triggering eviction/cleanup code.
runtimeURLToMetadataCache.set(runtimeSourceURL, {
metadataConsumer: metadataConsumer,
sourceMapConsumer: sourceMapConsumer,
});
}
}
},
);
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does parseSourceMaps() do?
parseSourceMaps() is a function in the react codebase, defined in packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.js.
Where is parseSourceMaps() defined?
parseSourceMaps() is defined in packages/react-devtools-shared/src/hooks/parseHookNames/parseSourceAndMetadata.js at line 383.
What calls parseSourceMaps()?
parseSourceMaps() is called by 1 function(s): parseSourceAndMetadata.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free