Home / File/ index.js — react Source File

index.js — react Source File

Architecture documentation for index.js, a javascript file in the react codebase. 4 imports, 0 dependents.

File javascript BabelCompiler Optimization 4 imports 5 functions

Entity Profile

Dependency Diagram

graph LR
  856b3a4c_6a24_b2e9_eb47_87b4757da255["index.js"]
  58f9fd10_f90c_a67e_1fc0_b4ee68c1dec2["style.css"]
  856b3a4c_6a24_b2e9_eb47_87b4757da255 --> 58f9fd10_f90c_a67e_1fc0_b4ee68c1dec2
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  856b3a4c_6a24_b2e9_eb47_87b4757da255 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  8792c1c1_dca5_f137_73ea_c0e268fdbb22["client"]
  856b3a4c_6a24_b2e9_eb47_87b4757da255 --> 8792c1c1_dca5_f137_73ea_c0e268fdbb22
  884ba1fd_b5ec_eaf7_158b_5f70432f79eb["client"]
  856b3a4c_6a24_b2e9_eb47_87b4757da255 --> 884ba1fd_b5ec_eaf7_158b_5f70432f79eb
  style 856b3a4c_6a24_b2e9_eb47_87b4757da255 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {use, Suspense, useState, startTransition, Profiler} from 'react';
import ReactDOM from 'react-dom/client';
import {createFromFetch, encodeReply} from 'react-server-dom-webpack/client';

// TODO: This should be a dependency of the App but we haven't implemented CSS in Node yet.
import './style.css';

function findSourceMapURL(fileName) {
  return (
    document.location.origin +
    '/source-maps?name=' +
    encodeURIComponent(fileName)
  );
}

async function createWebSocketStream(url) {
  const ws = new WebSocket(url);
  ws.binaryType = 'arraybuffer';

  await new Promise((resolve, reject) => {
    ws.addEventListener('open', resolve, {once: true});
    ws.addEventListener('error', reject, {once: true});
  });

  const writable = new WritableStream({
    write(chunk) {
      ws.send(chunk);
    },
    close() {
      ws.close();
    },
    abort(reason) {
      ws.close(1000, reason && String(reason));
    },
  });

  const readable = new ReadableStream({
    start(controller) {
      ws.addEventListener('message', event => {
        controller.enqueue(event.data);
      });
      ws.addEventListener('close', () => {
        controller.close();
      });
      ws.addEventListener('error', err => {
        controller.error(err);
      });
    },
  });

  return {readable, writable};
}

let updateRoot;
async function callServer(id, args) {
  let response;
  if (process.env.NODE_ENV === 'development') {
    const requestId = crypto.randomUUID();
    const debugChannel = await createWebSocketStream(
      `ws://localhost:3001/debug-channel?id=${requestId}`
// ... (101 more lines)

Domain

Subdomains

Dependencies

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, Optimization subdomain.
What functions are defined in index.js?
index.js defines 5 function(s): Shell, callServer, createWebSocketStream, findSourceMapURL, hydrateApp.
What does index.js depend on?
index.js imports 4 module(s): client, client, react, style.css.
Where is index.js in the architecture?
index.js is located at fixtures/flight/src/index.js (domain: BabelCompiler, subdomain: Optimization, directory: fixtures/flight/src).

Analyze Your Own Codebase

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

Try Supermodel Free