Home / File/ index.ts — react Source File

index.ts — react Source File

Architecture documentation for index.ts, a typescript file in the react codebase. 16 imports, 0 dependents.

File typescript BabelCompiler Validation 16 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  18cd5de5_c350_7de1_3060_3c6253caf5c4["index.ts"]
  b656edc6_fe94_de98_6d14_11431f83e3a2["index.ts"]
  18cd5de5_c350_7de1_3060_3c6253caf5c4 --> b656edc6_fe94_de98_6d14_11431f83e3a2
  b2492fc0_a9d8_00bd_bf97_b0d63be823ba["compile"]
  18cd5de5_c350_7de1_3060_3c6253caf5c4 --> b2492fc0_a9d8_00bd_bf97_b0d63be823ba
  9ff31f2c_c740_f564_0d2e_d722cd4acd1a["algolia.ts"]
  18cd5de5_c350_7de1_3060_3c6253caf5c4 --> 9ff31f2c_c740_f564_0d2e_d722cd4acd1a
  551bb09d_a60c_2886_81c3_4a97ea78cf84["queryAlgolia"]
  18cd5de5_c350_7de1_3060_3c6253caf5c4 --> 551bb09d_a60c_2886_81c3_4a97ea78cf84
  c7a71b6d_e29d_8850_39e1_92461a363a63["assertExhaustive.ts"]
  18cd5de5_c350_7de1_3060_3c6253caf5c4 --> c7a71b6d_e29d_8850_39e1_92461a363a63
  6bf4d478_86ca_9959_04db_aae459f1dc87["assertExhaustive"]
  18cd5de5_c350_7de1_3060_3c6253caf5c4 --> 6bf4d478_86ca_9959_04db_aae459f1dc87
  a990453a_7717_776a_17fd_03fd2fdb9e90["runtimePerf.ts"]
  18cd5de5_c350_7de1_3060_3c6253caf5c4 --> a990453a_7717_776a_17fd_03fd2fdb9e90
  1c4e507e_4ef7_2552_475e_1d13bbcd9d49["measurePerformance"]
  18cd5de5_c350_7de1_3060_3c6253caf5c4 --> 1c4e507e_4ef7_2552_475e_1d13bbcd9d49
  c41109aa_ed41_cf13_fa67_3bdff2ead249["componentTree.ts"]
  18cd5de5_c350_7de1_3060_3c6253caf5c4 --> c41109aa_ed41_cf13_fa67_3bdff2ead249
  57865954_7b03_c1a5_a66e_86c37585fd74["parseReactComponentTree"]
  18cd5de5_c350_7de1_3060_3c6253caf5c4 --> 57865954_7b03_c1a5_a66e_86c37585fd74
  2d5752b1_d683_d1ef_f470_99b92ac499a8["mcp.js"]
  18cd5de5_c350_7de1_3060_3c6253caf5c4 --> 2d5752b1_d683_d1ef_f470_99b92ac499a8
  3e260645_4770_b58d_a173_0bc7fc5f22a7["stdio.js"]
  18cd5de5_c350_7de1_3060_3c6253caf5c4 --> 3e260645_4770_b58d_a173_0bc7fc5f22a7
  3d45252d_d5b7_7967_8ef9_8c2bccea9e5a["v4"]
  18cd5de5_c350_7de1_3060_3c6253caf5c4 --> 3d45252d_d5b7_7967_8ef9_8c2bccea9e5a
  6532b592_e173_3956_4bd1_d55d91adeefe["src"]
  18cd5de5_c350_7de1_3060_3c6253caf5c4 --> 6532b592_e173_3956_4bd1_d55d91adeefe
  style 18cd5de5_c350_7de1_3060_3c6253caf5c4 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.
 */

import {McpServer} from '@modelcontextprotocol/sdk/server/mcp.js';
import {StdioServerTransport} from '@modelcontextprotocol/sdk/server/stdio.js';
import {z} from 'zod/v4';
import {compile, type PrintedCompilerPipelineValue} from './compiler';
import {
  CompilerPipelineValue,
  printReactiveFunctionWithOutlined,
  printFunctionWithOutlined,
  PluginOptions,
  SourceLocation,
} from 'babel-plugin-react-compiler/src';
import * as cheerio from 'cheerio';
import {queryAlgolia} from './utils/algolia';
import assertExhaustive from './utils/assertExhaustive';
import {convert} from 'html-to-text';
import {measurePerformance} from './tools/runtimePerf';
import {parseReactComponentTree} from './tools/componentTree';

function calculateMean(values: number[]): string {
  return values.length > 0
    ? values.reduce((acc, curr) => acc + curr, 0) / values.length + 'ms'
    : 'could not collect';
}

const server = new McpServer({
  name: 'React',
  version: '0.0.0',
});

server.tool(
  'query-react-dev-docs',
  'This tool lets you search for official docs from react.dev. This always has the most up to date information on React. You can look for documentation on APIs such as <ViewTransition>, <Activity>, and hooks like useOptimistic, useSyncExternalStore, useTransition, and more. Whenever you think hard about React, use this tool to get more information before proceeding.',
  {
    query: z.string(),
  },
  async ({query}) => {
    try {
      const pages = await queryAlgolia(query);
      if (pages.length === 0) {
        return {
          content: [{type: 'text' as const, text: `No results`}],
        };
      }
      const content = pages.map(html => {
        const $ = cheerio.load(html);
        // react.dev should always have at least one <article> with the main content
        const article = $('article').html();
        if (article != null) {
          return {
            type: 'text' as const,
            text: convert(article),
          };
        } else {
// ... (438 more lines)

Domain

Subdomains

Frequently Asked Questions

What does index.ts do?
index.ts is a source file in the react codebase, written in typescript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in index.ts?
index.ts defines 2 function(s): calculateMean, main.
What does index.ts depend on?
index.ts imports 16 module(s): algolia.ts, assertExhaustive, assertExhaustive.ts, cheerio, compile, componentTree.ts, html-to-text, index.ts, and 8 more.
Where is index.ts in the architecture?
index.ts is located at compiler/packages/react-mcp-server/src/index.ts (domain: BabelCompiler, subdomain: Validation, directory: compiler/packages/react-mcp-server/src).

Analyze Your Own Codebase

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

Try Supermodel Free