Home / File/ ErrorTester.js — react Source File

ErrorTester.js — react Source File

Architecture documentation for ErrorTester.js, a javascript file in the react codebase. 2 imports, 1 dependents.

File javascript BabelCompiler Validation 2 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  622e536b_9c72_69d0_58d6_fc8851cbebb0["ErrorTester.js"]
  7429ce5c_162f_d2fd_dc90_4be96c3babff["ErrorTesterCompiled.js"]
  622e536b_9c72_69d0_58d6_fc8851cbebb0 --> 7429ce5c_162f_d2fd_dc90_4be96c3babff
  24a36b11_d722_13bc_2618_326e21791b68["error-stack-parser"]
  622e536b_9c72_69d0_58d6_fc8851cbebb0 --> 24a36b11_d722_13bc_2618_326e21791b68
  76da1f28_5fe1_2c37_5657_67756acc6f55["parseSourceAndMetadata.js"]
  76da1f28_5fe1_2c37_5657_67756acc6f55 --> 622e536b_9c72_69d0_58d6_fc8851cbebb0
  style 622e536b_9c72_69d0_58d6_fc8851cbebb0 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 ErrorStackParser from 'error-stack-parser';
import testErrorStack, {
  SOURCE_STACK_FRAME_LINE_NUMBER,
} from './ErrorTesterCompiled';

let sourceMapsAreAppliedToErrors: boolean | null = null;

// Source maps are automatically applied to Error stack frames.
export function areSourceMapsAppliedToErrors(): boolean {
  if (sourceMapsAreAppliedToErrors === null) {
    try {
      testErrorStack();
      sourceMapsAreAppliedToErrors = false;
    } catch (error) {
      const parsed = ErrorStackParser.parse(error);
      const topStackFrame = parsed[0];
      const lineNumber = topStackFrame.lineNumber;
      if (lineNumber === SOURCE_STACK_FRAME_LINE_NUMBER) {
        sourceMapsAreAppliedToErrors = true;
      }
    }
  }

  return sourceMapsAreAppliedToErrors === true;
}

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does ErrorTester.js do?
ErrorTester.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 ErrorTester.js?
ErrorTester.js defines 1 function(s): areSourceMapsAppliedToErrors.
What does ErrorTester.js depend on?
ErrorTester.js imports 2 module(s): ErrorTesterCompiled.js, error-stack-parser.
What files import ErrorTester.js?
ErrorTester.js is imported by 1 file(s): parseSourceAndMetadata.js.
Where is ErrorTester.js in the architecture?
ErrorTester.js is located at packages/react-devtools-shared/src/hooks/ErrorTester.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/hooks).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free