moduleFilters.js — react Source File
Architecture documentation for moduleFilters.js, a javascript file in the react codebase. 2 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR efac6299_4c18_f347_3941_cc54822e7b6f["moduleFilters.js"] 20cc2065_4b5b_fd6b_be12_28f36b0ff4cf["types.js"] efac6299_4c18_f347_3941_cc54822e7b6f --> 20cc2065_4b5b_fd6b_be12_28f36b0ff4cf 55d27179_f566_db64_927b_e95655abee00["constants"] efac6299_4c18_f347_3941_cc54822e7b6f --> 55d27179_f566_db64_927b_e95655abee00 d08702f1_e022_2394_00ee_ac0a9c33e2de["FlamechartView.js"] d08702f1_e022_2394_00ee_ac0a9c33e2de --> efac6299_4c18_f347_3941_cc54822e7b6f be4fdda3_5115_a130_e567_6efc2cb1e5a7["moduleFilters-test.js"] be4fdda3_5115_a130_e567_6efc2cb1e5a7 --> efac6299_4c18_f347_3941_cc54822e7b6f style efac6299_4c18_f347_3941_cc54822e7b6f 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 {
FlamechartStackFrame,
InternalModuleSourceToRanges,
} from '../../types';
import {
CHROME_WEBSTORE_EXTENSION_ID,
INTERNAL_EXTENSION_ID,
LOCAL_EXTENSION_ID,
} from 'react-devtools-shared/src/constants';
export function isInternalModule(
internalModuleSourceToRanges: InternalModuleSourceToRanges,
flamechartStackFrame: FlamechartStackFrame,
): boolean {
const {locationColumn, locationLine, scriptUrl} = flamechartStackFrame;
if (scriptUrl == null || locationColumn == null || locationLine == null) {
// This could indicate a browser-internal API like performance.mark().
return false;
}
// Internal modules are only registered if DevTools was running when the profile was captured,
// but DevTools should also hide its own frames to avoid over-emphasizing them.
if (
// Handle webpack-internal:// sources
scriptUrl.includes('/react-devtools') ||
scriptUrl.includes('/react_devtools') ||
// Filter out known extension IDs
scriptUrl.includes(CHROME_WEBSTORE_EXTENSION_ID) ||
scriptUrl.includes(INTERNAL_EXTENSION_ID) ||
scriptUrl.includes(LOCAL_EXTENSION_ID)
// Unfortunately this won't get everything, like relatively loaded chunks or Web Worker files.
) {
return true;
}
// Filter out React internal packages.
const ranges = internalModuleSourceToRanges.get(scriptUrl);
if (ranges != null) {
for (let i = 0; i < ranges.length; i++) {
const [startStackFrame, stopStackFrame] = ranges[i];
const isAfterStart =
// $FlowFixMe[invalid-compare] -- TODO: Revealed when adding types to error-stack-parser
locationLine > startStackFrame.lineNumber ||
(locationLine === startStackFrame.lineNumber &&
// $FlowFixMe[invalid-compare]
locationColumn >= startStackFrame.columnNumber);
const isBeforeStop =
// $FlowFixMe[invalid-compare]
locationLine < stopStackFrame.lineNumber ||
(locationLine === stopStackFrame.lineNumber &&
// $FlowFixMe[invalid-compare]
locationColumn <= stopStackFrame.columnNumber);
if (isAfterStart && isBeforeStop) {
return true;
}
}
}
return false;
}
Domain
Subdomains
Functions
Dependencies
- constants
- types.js
Imported By
Source
Frequently Asked Questions
What does moduleFilters.js do?
moduleFilters.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 moduleFilters.js?
moduleFilters.js defines 1 function(s): isInternalModule.
What does moduleFilters.js depend on?
moduleFilters.js imports 2 module(s): constants, types.js.
What files import moduleFilters.js?
moduleFilters.js is imported by 2 file(s): FlamechartView.js, moduleFilters-test.js.
Where is moduleFilters.js in the architecture?
moduleFilters.js is located at packages/react-devtools-timeline/src/content-views/utils/moduleFilters.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-timeline/src/content-views/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free