compilation.ts — react Source File
Architecture documentation for compilation.ts, a typescript file in the react codebase. 6 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 9ba26589_c539_da05_fcd2_2ca7851645ba["compilation.ts"] 034b2d8c_7261_f40f_c380_2b5db8fde033["Output.tsx"] 9ba26589_c539_da05_fcd2_2ca7851645ba --> 034b2d8c_7261_f40f_c380_2b5db8fde033 ba38a3cc_fa9d_cd5d_0746_ec93bcb397e1["parser"] 9ba26589_c539_da05_fcd2_2ca7851645ba --> ba38a3cc_fa9d_cd5d_0746_ec93bcb397e1 78f0dea0_5a25_0652_2a88_959a2ce71a1f["hermes-parser"] 9ba26589_c539_da05_fcd2_2ca7851645ba --> 78f0dea0_5a25_0652_2a88_959a2ce71a1f 52e3d8d7_abf4_7343_1f98_3f701ec04082["types"] 9ba26589_c539_da05_fcd2_2ca7851645ba --> 52e3d8d7_abf4_7343_1f98_3f701ec04082 33e3aca7_66ee_ce27_72ad_b6d7fb17e06c["babel-plugin-react-compiler"] 9ba26589_c539_da05_fcd2_2ca7851645ba --> 33e3aca7_66ee_ce27_72ad_b6d7fb17e06c 102f7d62_f771_0080_dd43_d867f5a8bd55["core"] 9ba26589_c539_da05_fcd2_2ca7851645ba --> 102f7d62_f771_0080_dd43_d867f5a8bd55 6c4ddf93_cf1a_7b66_fd69_69c7c8032b25["EditorImpl.tsx"] 6c4ddf93_cf1a_7b66_fd69_69c7c8032b25 --> 9ba26589_c539_da05_fcd2_2ca7851645ba style 9ba26589_c539_da05_fcd2_2ca7851645ba 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 {parse as babelParse, ParseResult} from '@babel/parser';
import * as HermesParser from 'hermes-parser';
import * as t from '@babel/types';
import BabelPluginReactCompiler, {
CompilerError,
CompilerErrorDetail,
CompilerDiagnostic,
Effect,
ErrorCategory,
parseConfigPragmaForTests,
ValueKind,
type Hook,
PluginOptions,
CompilerPipelineValue,
parsePluginOptions,
printReactiveFunctionWithOutlined,
printFunctionWithOutlined,
type LoggerEvent,
} from 'babel-plugin-react-compiler';
import {transformFromAstSync} from '@babel/core';
import type {
CompilerOutput,
CompilerTransformOutput,
PrintedCompilerPipelineValue,
} from '../components/Editor/Output';
function parseInput(
input: string,
language: 'flow' | 'typescript',
): ParseResult<t.File> {
// Extract the first line to quickly check for custom test directives
if (language === 'flow') {
return HermesParser.parse(input, {
babel: true,
flow: 'all',
sourceType: 'module',
enableExperimentalComponentSyntax: true,
});
} else {
return babelParse(input, {
plugins: ['typescript', 'jsx'],
sourceType: 'module',
}) as ParseResult<t.File>;
}
}
function invokeCompiler(
source: string,
language: 'flow' | 'typescript',
options: PluginOptions,
): CompilerTransformOutput {
const ast = parseInput(source, language);
let result = transformFromAstSync(ast, source, {
// ... (249 more lines)
Domain
Subdomains
Dependencies
- Output.tsx
- babel-plugin-react-compiler
- core
- hermes-parser
- parser
- types
Source
Frequently Asked Questions
What does compilation.ts do?
compilation.ts is a source file in the react codebase, written in typescript. It belongs to the PlaygroundApp domain, Stores subdomain.
What functions are defined in compilation.ts?
compilation.ts defines 4 function(s): compile, invokeCompiler, parseInput, parseOptions.
What does compilation.ts depend on?
compilation.ts imports 6 module(s): Output.tsx, babel-plugin-react-compiler, core, hermes-parser, parser, types.
What files import compilation.ts?
compilation.ts is imported by 1 file(s): EditorImpl.tsx.
Where is compilation.ts in the architecture?
compilation.ts is located at compiler/apps/playground/lib/compilation.ts (domain: PlaygroundApp, subdomain: Stores, directory: compiler/apps/playground/lib).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free