Reanimated.ts — react Source File
Architecture documentation for Reanimated.ts, a typescript file in the react codebase. 5 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 4b6a2a26_9073_8d0b_6c3b_1cbce53fd41c["Reanimated.ts"] eb9d33f9_42c1_205c_93e6_8e1365a31839["utils.ts"] 4b6a2a26_9073_8d0b_6c3b_1cbce53fd41c --> eb9d33f9_42c1_205c_93e6_8e1365a31839 27d56ae1_023e_57f5_a306_f4be92e0daca["hasOwnProperty"] 4b6a2a26_9073_8d0b_6c3b_1cbce53fd41c --> 27d56ae1_023e_57f5_a306_f4be92e0daca 4828f3cc_e6ac_9239_d7f7_c05f7f60419c["Options.ts"] 4b6a2a26_9073_8d0b_6c3b_1cbce53fd41c --> 4828f3cc_e6ac_9239_d7f7_c05f7f60419c 21a2b730_5f06_ef81_dbab_759210c09f37["ParsedPluginOptions"] 4b6a2a26_9073_8d0b_6c3b_1cbce53fd41c --> 21a2b730_5f06_ef81_dbab_759210c09f37 102f7d62_f771_0080_dd43_d867f5a8bd55["core"] 4b6a2a26_9073_8d0b_6c3b_1cbce53fd41c --> 102f7d62_f771_0080_dd43_d867f5a8bd55 f3b73a1d_8eeb_a8b2_a886_c8b8c2f58490["BabelPlugin.ts"] f3b73a1d_8eeb_a8b2_a886_c8b8c2f58490 --> 4b6a2a26_9073_8d0b_6c3b_1cbce53fd41c style 4b6a2a26_9073_8d0b_6c3b_1cbce53fd41c 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 type * as BabelCore from '@babel/core';
import {hasOwnProperty} from '../Utils/utils';
import {ParsedPluginOptions} from './Options';
function hasModule(name: string): boolean {
if (typeof require === 'undefined') {
return false;
}
try {
return !!require.resolve(name);
} catch (error: any) {
if (
error.code === 'MODULE_NOT_FOUND' &&
error.message.indexOf(name) !== -1
) {
return false;
}
throw error;
}
}
/**
* Tries to detect if reanimated is installed by first looking for the presence of the babel plugin.
* However, babel-preset-expo includes it by default so it is occasionally ommitted. If so, we do
* a check to see if `react-native-animated` is requireable.
*
* See https://github.com/expo/expo/blob/e4b8d86442482c7316365a6b7ec1141eec73409d/packages/babel-preset-expo/src/index.ts#L300-L301
*/
export function pipelineUsesReanimatedPlugin(
plugins: Array<BabelCore.PluginItem> | null | undefined,
): boolean {
if (Array.isArray(plugins)) {
for (const plugin of plugins) {
if (hasOwnProperty(plugin, 'key')) {
const key = (plugin as any).key; // already checked
if (
typeof key === 'string' &&
key.indexOf('react-native-reanimated') !== -1
) {
return true;
}
}
}
}
return hasModule('react-native-reanimated');
}
export function injectReanimatedFlag(
options: ParsedPluginOptions,
): ParsedPluginOptions {
return {
...options,
environment: {
...options.environment,
enableCustomTypeDefinitionForReanimated: true,
},
};
}
Domain
Subdomains
Dependencies
Source
Frequently Asked Questions
What does Reanimated.ts do?
Reanimated.ts is a source file in the react codebase, written in typescript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in Reanimated.ts?
Reanimated.ts defines 3 function(s): hasModule, injectReanimatedFlag, pipelineUsesReanimatedPlugin.
What does Reanimated.ts depend on?
Reanimated.ts imports 5 module(s): Options.ts, ParsedPluginOptions, core, hasOwnProperty, utils.ts.
What files import Reanimated.ts?
Reanimated.ts is imported by 1 file(s): BabelPlugin.ts.
Where is Reanimated.ts in the architecture?
Reanimated.ts is located at compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Reanimated.ts (domain: BabelCompiler, subdomain: Entrypoint, directory: compiler/packages/babel-plugin-react-compiler/src/Entrypoint).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free