index.js — react Source File
Architecture documentation for index.js, a javascript file in the react codebase. 10 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 1fe61eb6_8e55_40d8_4d18_db1927e3d6fd["index.js"] c387cbce_0129_194c_6a44_3db01fd37956["loadSourceAndMetadata.js"] 1fe61eb6_8e55_40d8_4d18_db1927e3d6fd --> c387cbce_0129_194c_6a44_3db01fd37956 11e5792f_de52_fd5a_7ed1_eb0c53811c93["parseSourceAndMetadata.worker.js"] 1fe61eb6_8e55_40d8_4d18_db1927e3d6fd --> 11e5792f_de52_fd5a_7ed1_eb0c53811c93 76da1f28_5fe1_2c37_5657_67756acc6f55["parseSourceAndMetadata.js"] 1fe61eb6_8e55_40d8_4d18_db1927e3d6fd --> 76da1f28_5fe1_2c37_5657_67756acc6f55 a06ea974_2987_ab24_d4ec_5ad8921dd344["flattenHooksList"] 1fe61eb6_8e55_40d8_4d18_db1927e3d6fd --> a06ea974_2987_ab24_d4ec_5ad8921dd344 c1ede884_eff1_5699_b978_8ab7d7207919["loadSourceAndMetadata"] 1fe61eb6_8e55_40d8_4d18_db1927e3d6fd --> c1ede884_eff1_5699_b978_8ab7d7207919 741f125f_8d71_2134_c016_a18fb8f60d66["ReactDebugHooks"] 1fe61eb6_8e55_40d8_4d18_db1927e3d6fd --> 741f125f_8d71_2134_c016_a18fb8f60d66 aec7978f_0a19_ba93_de9e_ac8cf5ddc74b["types"] 1fe61eb6_8e55_40d8_4d18_db1927e3d6fd --> aec7978f_0a19_ba93_de9e_ac8cf5ddc74b 2e5d5bab_71fd_5a80_3fa3_895dcaab6301["FetchFileWithCachingContext"] 1fe61eb6_8e55_40d8_4d18_db1927e3d6fd --> 2e5d5bab_71fd_5a80_3fa3_895dcaab6301 ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] 1fe61eb6_8e55_40d8_4d18_db1927e3d6fd --> ac587885_e294_a1e9_b13f_5e7b920fdb42 7e1e25cd_0db6_762f_27ad_866e33149c52["PerformanceLoggingUtils"] 1fe61eb6_8e55_40d8_4d18_db1927e3d6fd --> 7e1e25cd_0db6_762f_27ad_866e33149c52 style 1fe61eb6_8e55_40d8_4d18_db1927e3d6fd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {HookSourceAndMetadata} from './loadSourceAndMetadata';
import type {HooksNode, HooksTree} from 'react-debug-tools/src/ReactDebugHooks';
import type {HookNames} from 'react-devtools-shared/src/frontend/types';
import type {FetchFileWithCaching} from 'react-devtools-shared/src/devtools/views/Components/FetchFileWithCachingContext';
import 'react';
import {withAsyncPerfMeasurements} from 'react-devtools-shared/src/PerformanceLoggingUtils';
import WorkerizedParseSourceAndMetadata from './parseSourceAndMetadata.worker';
import typeof * as ParseSourceAndMetadataModule from './parseSourceAndMetadata';
import {flattenHooksList, loadSourceAndMetadata} from './loadSourceAndMetadata';
const workerizedParseHookNames: ParseSourceAndMetadataModule =
WorkerizedParseSourceAndMetadata();
export function parseSourceAndMetadata(
hooksList: Array<HooksNode>,
locationKeyToHookSourceAndMetadata: Map<string, HookSourceAndMetadata>,
): Promise<HookNames | null> {
return workerizedParseHookNames.parseSourceAndMetadata(
hooksList,
locationKeyToHookSourceAndMetadata,
);
}
export const purgeCachedMetadata = workerizedParseHookNames.purgeCachedMetadata;
const EMPTY_MAP: HookNames = new Map();
export async function parseHookNames(
hooksTree: HooksTree,
fetchFileWithCaching: FetchFileWithCaching | null,
): Promise<HookNames | null> {
return withAsyncPerfMeasurements('parseHookNames', async () => {
const hooksList = flattenHooksList(hooksTree);
if (hooksList.length === 0) {
// This component tree contains no named hooks.
return EMPTY_MAP;
}
// Runs on the main/UI thread so it can reuse Network cache:
const locationKeyToHookSourceAndMetadata = await loadSourceAndMetadata(
hooksList,
fetchFileWithCaching,
);
// Runs in a Worker because it's CPU intensive:
return parseSourceAndMetadata(
hooksList,
locationKeyToHookSourceAndMetadata,
);
});
}
Domain
Subdomains
Functions
Dependencies
- FetchFileWithCachingContext
- PerformanceLoggingUtils
- ReactDebugHooks
- flattenHooksList
- loadSourceAndMetadata
- loadSourceAndMetadata.js
- parseSourceAndMetadata.js
- parseSourceAndMetadata.worker.js
- react
- types
Source
Frequently Asked Questions
What does index.js do?
index.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in index.js?
index.js defines 1 function(s): return.
What does index.js depend on?
index.js imports 10 module(s): FetchFileWithCachingContext, PerformanceLoggingUtils, ReactDebugHooks, flattenHooksList, loadSourceAndMetadata, loadSourceAndMetadata.js, parseSourceAndMetadata.js, parseSourceAndMetadata.worker.js, and 2 more.
Where is index.js in the architecture?
index.js is located at packages/react-devtools-shared/src/hooks/parseHookNames/index.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/hooks/parseHookNames).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free