Home / File/ importFile.js — react Source File

importFile.js — react Source File

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

File javascript BabelCompiler 8 imports 2 dependents

Entity Profile

Dependency Diagram

graph LR
  7413ab6d_5a4b_26b9_6ff5_21bf96ba027f["importFile.js"]
  a9fa5571_b040_365c_40f4_cd5d0a8cdc2f["index.js"]
  7413ab6d_5a4b_26b9_6ff5_21bf96ba027f --> a9fa5571_b040_365c_40f4_cd5d0a8cdc2f
  a3f7147d_da0b_56dc_ffc9_a9e2bbc4526a["preprocessData.js"]
  7413ab6d_5a4b_26b9_6ff5_21bf96ba027f --> a3f7147d_da0b_56dc_ffc9_a9e2bbc4526a
  be28072d_a059_0346_2a4c_412726599426["preprocessData"]
  7413ab6d_5a4b_26b9_6ff5_21bf96ba027f --> be28072d_a059_0346_2a4c_412726599426
  3a5f9bc5_a9d9_a302_c2cf_3bd912ebac45["readInputData.js"]
  7413ab6d_5a4b_26b9_6ff5_21bf96ba027f --> 3a5f9bc5_a9d9_a302_c2cf_3bd912ebac45
  13abdd7e_19d6_ddf6_8ae1_57dfb3f3b72f["InvalidProfileError.js"]
  7413ab6d_5a4b_26b9_6ff5_21bf96ba027f --> 13abdd7e_19d6_ddf6_8ae1_57dfb3f3b72f
  faa5ed90_bf45_aadf_762b_9cbd1a91aa65["InvalidProfileError"]
  7413ab6d_5a4b_26b9_6ff5_21bf96ba027f --> faa5ed90_bf45_aadf_762b_9cbd1a91aa65
  9d86b2e6_5b25_ddf2_2d79_d951fa88ae3f["runtime"]
  7413ab6d_5a4b_26b9_6ff5_21bf96ba027f --> 9d86b2e6_5b25_ddf2_2d79_d951fa88ae3f
  1e1c6095_7712_f38a_035a_19c1ebe7c4ed["speedscope"]
  7413ab6d_5a4b_26b9_6ff5_21bf96ba027f --> 1e1c6095_7712_f38a_035a_19c1ebe7c4ed
  51cbb66f_221d_b34b_381a_d1e86f8c7d7a["importFile.worker.js"]
  51cbb66f_221d_b34b_381a_d1e86f8c7d7a --> 7413ab6d_5a4b_26b9_6ff5_21bf96ba027f
  a9fa5571_b040_365c_40f4_cd5d0a8cdc2f["index.js"]
  a9fa5571_b040_365c_40f4_cd5d0a8cdc2f --> 7413ab6d_5a4b_26b9_6ff5_21bf96ba027f
  style 7413ab6d_5a4b_26b9_6ff5_21bf96ba027f 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 'regenerator-runtime/runtime';

import type {TimelineEvent} from '@elg/speedscope';
import type {ImportWorkerOutputData} from './index';

import preprocessData from './preprocessData';
import {readInputData} from './readInputData';
import InvalidProfileError from './InvalidProfileError';

export async function importFile(file: File): Promise<ImportWorkerOutputData> {
  try {
    const readFile = await readInputData(file);
    const events: TimelineEvent[] = JSON.parse(readFile);
    if (events.length === 0) {
      throw new InvalidProfileError('No profiling data found in file.');
    }

    const processedData = await preprocessData(events);

    return {
      status: 'SUCCESS',
      processedData,
    };
  } catch (error) {
    if (error instanceof InvalidProfileError) {
      return {
        status: 'INVALID_PROFILE_ERROR',
        error,
      };
    } else {
      return {
        status: 'UNEXPECTED_ERROR',
        error,
      };
    }
  }
}

Domain

Frequently Asked Questions

What does importFile.js do?
importFile.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does importFile.js depend on?
importFile.js imports 8 module(s): InvalidProfileError, InvalidProfileError.js, index.js, preprocessData, preprocessData.js, readInputData.js, runtime, speedscope.
What files import importFile.js?
importFile.js is imported by 2 file(s): importFile.worker.js, index.js.
Where is importFile.js in the architecture?
importFile.js is located at packages/react-devtools-timeline/src/import-worker/importFile.js (domain: BabelCompiler, directory: packages/react-devtools-timeline/src/import-worker).

Analyze Your Own Codebase

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

Try Supermodel Free