RN: Move {packages => private}/react-native-fantom (#51938)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51938

Moves `packages/react-native-fantom` to `private/react-native-fantom`.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D76368959

fbshipit-source-id: 8d62f792229c10cd108dc849e8629d3174dc72c1
This commit is contained in:
Tim Yung
2025-06-11 23:49:51 -07:00
committed by Facebook GitHub Bot
parent c79e55f79d
commit d6f29c8afd
57 changed files with 25 additions and 30 deletions
+2 -2
View File
@@ -171,8 +171,8 @@ fix_*.patch
.metro-health-check*
# Jest Integration
/packages/react-native-fantom/build/
/packages/react-native-fantom/tester/build/
/private/react-native-fantom/build/
/private/react-native-fantom/tester/build/
# [Experimental] Generated TS type definitions
/packages/**/types_generated/
+1 -1
View File
@@ -90,7 +90,7 @@ TODO: Explain the different components of React Native at a high level.
- Jest
- ESLint
- Integration / E2E
- [Fantom](../packages/react-native-fantom/__docs__/README.md)
- [Fantom](../private/react-native-fantom/__docs__/README.md)
- Tooling
- React Native DevTools
+1 -1
View File
@@ -33,7 +33,7 @@
"test-typescript": "tsc -p packages/react-native/types/tsconfig.json",
"test-generated-typescript": "tsc -p packages/react-native/types_generated/tsconfig.test.json",
"test": "jest",
"fantom": "JS_DIR='..' yarn jest --config packages/react-native-fantom/config/jest.config.js",
"fantom": "JS_DIR='..' yarn jest --config private/react-native-fantom/config/jest.config.js",
"trigger-react-native-release": "node ./scripts/releases-local/trigger-react-native-release.js",
"update-lock": "npx yarn-deduplicate"
},
@@ -16,4 +16,4 @@ Fantom. These are not meant to be consumed directly.
### Part of
- [Fantom](../../../../../../../react-native-fantom/__docs__/README.md).
- [Fantom](../../../../../../../../private/react-native-fantom/__docs__/README.md).
@@ -92,7 +92,7 @@ For a full API reference, please see the [inline documentation](../src/index.js)
defined for the methods in the `@react-native/fantom` [module](../src/index.js).
You can check out existing files with the `-itest.js` suffix (e.g.:
[`View-itest`](../../react-native/Libraries/Components/View/__tests__/View-itest.js))
[`View-itest`](../../../packages/react-native/Libraries/Components/View/__tests__/View-itest.js))
for code examples.
Run the test using the following command from the root of the React Native
@@ -123,7 +123,7 @@ docblock at the top of the file. E.g.:
Available pragmas:
- `@fantom_flags`: used to set overrides for
[`ReactNativeFeatureFlags`](../../react-native/src/private/featureflags/__docs__/README.md).
[`ReactNativeFeatureFlags`](../../../packages/react-native/src/private/featureflags/__docs__/README.md).
- Example: `@fantom_flags name:value`.
- Multiple flags can be defined in different lines or in the same line
separated by spaces (e.g.: `@fantom_flags name:value otherName:otherValue`).
@@ -195,7 +195,7 @@ The results of Fabric are mounted in a mock UI tree that can be asserted against
and individual mounting instructions can be inspected.
You can even test your C++ code. For example, we have
[Fantom tests for the new View Culling optimization](../../react-native/Libraries/Components/ScrollView/__tests__/ScrollView-viewCulling-itest.js),
[Fantom tests for the new View Culling optimization](../../../packages/react-native/Libraries/Components/ScrollView/__tests__/ScrollView-viewCulling-itest.js),
which is written in C++.
#### How can I test logic related to <ScrollView /> scrolling?
@@ -343,6 +343,6 @@ The runner then follows these steps:
CLI.
- Hermes Compiler, to compile the JavaScript test code into Hermes bytecode.
- The
[React Native Feature Flags](../../react-native/src/private/featureflags/__docs__/README.md)
[React Native Feature Flags](../../../packages/react-native/src/private/featureflags/__docs__/README.md)
system, via the `@fantom_flags` pragmas defined in the docblock for test
files.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

@@ -19,15 +19,15 @@ const isCI =
// In CI, we want to prewarm the caches/builds before running the tests so
// that time isn't attributed to the first test that runs.
const globalSetup /*: ?string */ = isCI
? '<rootDir>/packages/react-native-fantom/runner/warmup/index.js'
? '<rootDir>/private/react-native-fantom/runner/warmup/index.js'
: null;
module.exports = {
rootDir: path.resolve(__dirname, '../../..') /*:: as string */,
roots: [
'<rootDir>/packages/react-native',
'<rootDir>/packages/react-native-fantom',
'<rootDir>/packages/polyfills',
'<rootDir>/private/react-native-fantom',
],
moduleFileExtensions: [
...baseConfig.moduleFileExtensions,
@@ -38,7 +38,7 @@ module.exports = {
testRegex: '/__tests__/.*-itest(\\.fb)?\\.js$',
testPathIgnorePatterns: baseConfig.testPathIgnorePatterns,
transformIgnorePatterns: ['.*'],
testRunner: '<rootDir>/packages/react-native-fantom/runner/index.js',
watchPathIgnorePatterns: ['<rootDir>/packages/react-native-fantom/build/'],
testRunner: '<rootDir>/private/react-native-fantom/runner/index.js',
watchPathIgnorePatterns: ['<rootDir>/private/react-native-fantom/build/'],
globalSetup,
};
@@ -1,7 +1,7 @@
{
"name": "@react-native/fantom",
"private": true,
"version": "0.80.0-main",
"version": "0.0.0",
"main": "src/index.js",
"description": "Internal integration testing and benchmarking tool for React Native",
"peerDependencies": {
@@ -209,7 +209,7 @@ module.exports = async function runTest(
const setupModulePath = path.resolve(__dirname, '../runtime/setup.js');
const featureFlagsModulePath = path.resolve(
__dirname,
'../../react-native/src/private/featureflags/ReactNativeFeatureFlags.js',
'../../../packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js',
);
const testResultsByConfig = [];
@@ -15,8 +15,8 @@ import type {
import type {MixedElement} from 'react';
import type {RootTag} from 'react-native';
import type ReactNativeDocument from 'react-native/src/private/webapis/dom/nodes/ReactNativeDocument';
import type ReadOnlyNode from 'react-native/src/private/webapis/dom/nodes/ReadOnlyNode';
import ReactNativeElement from '../../react-native/src/private/webapis/dom/nodes/ReadOnlyNode';
import * as Benchmark from './Benchmark';
import {getConstants} from './Constants';
import getFantomRenderedOutput from './getFantomRenderedOutput';
@@ -226,9 +226,7 @@ export function unstable_produceFramesForDuration(milliseconds: number) {
*
* Note: This API is marked as unstable and may change in future versions.
*/
export function unstable_getDirectManipulationProps(
node: ReactNativeElement,
): mixed {
export function unstable_getDirectManipulationProps(node: ReadOnlyNode): mixed {
const shadowNode = getNativeNodeReference(node);
return NativeFantom.getDirectManipulationProps(shadowNode);
}
@@ -394,7 +392,7 @@ export function createRoot(rootConfig?: RootConfig): Root {
* ```
*/
export function enqueueNativeEvent(
node: ReactNativeElement,
node: ReadOnlyNode,
type: string,
payload?: $ReadOnly<{[key: string]: mixed}>,
options?: $ReadOnly<{category?: NativeEventCategory, isUnique?: boolean}>,
@@ -425,7 +423,7 @@ export function enqueueNativeEvent(
* ```
*/
export function dispatchNativeEvent(
node: ReactNativeElement,
node: ReadOnlyNode,
type: string,
payload?: $ReadOnly<{[key: string]: mixed}>,
options?: $ReadOnly<{category?: NativeEventCategory, isUnique?: boolean}>,
@@ -487,7 +485,7 @@ export type ScrollEventOptions = {
* ```
*/
export function enqueueScrollEvent(
node: ReactNativeElement,
node: ReadOnlyNode,
options: ScrollEventOptions,
) {
const shadowNode = getNativeNodeReference(node);
@@ -525,10 +523,7 @@ export function enqueueScrollEvent(
* // Assert that changes from Fantom.scrollTo are in effect.
* ```
*/
export function scrollTo(
node: ReactNativeElement,
options: ScrollEventOptions,
) {
export function scrollTo(node: ReadOnlyNode, options: ScrollEventOptions) {
runOnUIThread(() => {
enqueueScrollEvent(node, options);
});
@@ -561,7 +556,7 @@ export function scrollTo(
* ```
*/
export function enqueueModalSizeUpdate(
node: ReactNativeElement,
node: ReadOnlyNode,
size: $ReadOnly<{width: number, height: number}>,
) {
const shadowNode = getNativeNodeReference(node);
@@ -642,7 +637,7 @@ if (typeof global.EventTarget === 'undefined') {
* @param node The node for which to create a reference counting function.
*/
export function createShadowNodeReferenceCounter(
node: ReactNativeElement,
node: ReadOnlyNode,
): () => number {
let shadowNode = getNativeNodeReference(node);
return NativeFantom.createShadowNodeReferenceCounter(shadowNode);
@@ -655,7 +650,7 @@ export function createShadowNodeReferenceCounter(
* @param node The node for which to create a revision getter.
*/
export function createShadowNodeRevisionGetter(
node: ReactNativeElement,
node: ReadOnlyNode,
): () => ?number {
let shadowNode = getNativeNodeReference(node);
return NativeFantom.createShadowNodeRevisionGetter(shadowNode);
@@ -8,7 +8,7 @@ set -e
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
BUILD_DIR="$SCRIPT_DIR/build"
REACT_NATIVE_ROOT_DIR=$(readlink -f "$SCRIPT_DIR/../../react-native")
REACT_NATIVE_ROOT_DIR=$(readlink -f "$SCRIPT_DIR/../../../packages/react-native")
cmake -S "$SCRIPT_DIR" -B "$BUILD_DIR" \
-DREACT_THIRD_PARTY_NDK_DIR="${REACT_NATIVE_ROOT_DIR}/ReactAndroid/build/third-party-ndk" \