Skip to content

Commit 4ce6115

Browse files
huntiefacebook-github-bot
authored andcommitted
Update ReactPrivate and InitializeCore imports (0.87 Strict API) (#36986) (#57753)
Summary: ## Summary Migrate internal `Libraries/` import subpaths from `react-native` to the incoming dedicated entry points in React Native 0.87. **Motivation** See [**RFC0894: Removing deep imports from react-native**](react-native-community/discussions-and-proposals#894) **Changes** The `react-private-interface` entry point has been created explicitly for the private contract between React ↔ React Native, and is 1:1 with the previous `ReactNativePrivateInterface` module. Both of the below `Libraries/` paths still exist, but are deprecated — this is a lagging migration that will enable cleanup in a future RN version. - `react-native/Libraries/Core/InitializeCore` → `react-native/setup-env` [#57475](#57475) - `react-native/Libraries/ReactPrivate/ReactNativePrivateInterface` → `react-native/react-private-interface` [#57495](#57495) ## Test Plan Flow DiffTrain build for [96fcba90138e9f1a73ee1cc4f79a653ec12fc3a9](react/react@96fcba9) Reviewed By: hoxyq Differential Revision: D113928305
1 parent ece0efe commit 4ce6115

4 files changed

Lines changed: 13 additions & 9 deletions

File tree

jest.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ module.exports = {
2727
},
2828
resolver: './packages/jest-preset/jest/resolver.js',
2929
moduleNameMapper: {
30-
// `resolver.js` strips `exports`, so alias this subpath to its `src/` impl.
30+
// `resolver.js` strips `exports`, so alias these subpaths to their `src/` impl.
31+
'^react-native/react-private-interface$':
32+
'<rootDir>/packages/react-native/src/react-private-interface.js',
3133
'^react-native/setup-env$':
3234
'<rootDir>/packages/react-native/src/setup-env.js',
3335
},

packages/jest-preset/jest-preset.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ module.exports = {
1818
platforms: ['android', 'ios', 'native'],
1919
},
2020
moduleNameMapper: {
21-
// `setup-env` is a secondary entry point exposed via the package's
22-
// `exports`, but `./jest/resolver.js` strips `exports` and the generic
23-
// mapper below resolves subpaths as literal directory paths. Alias it
24-
// explicitly so it resolves to its `src/` implementation.
21+
// `setup-env` and `react-private-interface` are secondary entry points
22+
// exposed via the package's `exports`, but `./jest/resolver.js` strips
23+
// `exports` and the generic mapper below resolves subpaths as literal
24+
// directory paths. Alias them explicitly so they resolve to their `src/`
25+
// implementations.
26+
'^react-native/react-private-interface$': `${path.dirname(require.resolve('react-native'))}/src/react-private-interface.js`,
2527
'^react-native/setup-env$': `${path.dirname(require.resolve('react-native'))}/src/setup-env.js`,
2628
'^react-native($|/.*)': `${path.dirname(require.resolve('react-native'))}/$1`,
2729
},

packages/react-native/Libraries/Renderer/shims/ReactFabric.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
* @noformat
88
* @nolint
99
* @flow
10-
* @generated SignedSource<<cf323fc5ca893bab5669c7d321660412>>
10+
* @generated SignedSource<<8b6b4d01340cfba2de5eabc3936dfbdd>>
1111
*/
1212

1313
'use strict';
1414

15-
import {BatchedBridge} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
15+
import {BatchedBridge} from 'react-native/react-private-interface';
1616

1717
import type {ReactFabricType} from './ReactNativeTypes';
1818

packages/react-native/Libraries/Renderer/shims/createReactNativeComponentClass.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
* @noformat
88
* @nolint
99
* @flow strict-local
10-
* @generated SignedSource<<52163887de05f1cff05388145cf85b3b>>
10+
* @generated SignedSource<<26e94f747da2450a86c1e314470813f5>>
1111
*/
1212

1313
'use strict';
1414

15-
import {ReactNativeViewConfigRegistry} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
15+
import {ReactNativeViewConfigRegistry} from 'react-native/react-private-interface';
1616
import {type ViewConfig} from './ReactNativeTypes';
1717

1818
const {register} = ReactNativeViewConfigRegistry;

0 commit comments

Comments
 (0)