mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Summary: Pull Request resolved: https://github.com/react/react-native/pull/57753 ## 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**](https://github.com/react-native-community/discussions-and-proposals/pull/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` [react/react-native#57475](https://github.com/react/react-native/pull/57475) - `react-native/Libraries/ReactPrivate/ReactNativePrivateInterface` → `react-native/react-private-interface` [react/react-native#57495](https://github.com/react/react-native/pull/57495) Changelog: [Internal] ## Test Plan Flow DiffTrain build for [96fcba90138e9f1a73ee1cc4f79a653ec12fc3a9](https://github.com/react/react/commit/96fcba90138e9f1a73ee1cc4f79a653ec12fc3a9) Reviewed By: hoxyq Differential Revision: D113928305 fbshipit-source-id: 65a0c4d5de1e7db381b878194c220927d5b9dec8
This commit is contained in:
1 parent
e55da68478
commit
fa0e6756d3
6 files changed
+16
-9
No files matched your search
+3
-1
@@ -27,7 +27,9 @@ module.exports = {
|
||||
},
|
||||
resolver: './packages/jest-preset/jest/resolver.js',
|
||||
moduleNameMapper: {
|
||||
// `resolver.js` strips `exports`, so alias this subpath to its `src/` impl.
|
||||
// `resolver.js` strips `exports`, so alias these subpaths to their `src/` impl.
|
||||
'^react-native/react-private-interface$':
|
||||
'<rootDir>/packages/react-native/src/react-private-interface.js',
|
||||
'^react-native/setup-env$':
|
||||
'<rootDir>/packages/react-native/src/setup-env.js',
|
||||
},
|
||||
|
||||
@@ -33,6 +33,8 @@ eslintTester.run('../no-deep-imports', rule, {
|
||||
"require('react-native/src/fb_internal/Foo')",
|
||||
"import 'react-native/setup-env';",
|
||||
"require('react-native/setup-env');",
|
||||
"import {BatchedBridge} from 'react-native/react-private-interface';",
|
||||
"require('react-native/react-private-interface');",
|
||||
],
|
||||
invalid: [
|
||||
{
|
||||
|
||||
@@ -201,6 +201,7 @@ module.exports = {
|
||||
|
||||
return (
|
||||
source.value === 'react-native/asset-registry' ||
|
||||
source.value === 'react-native/react-private-interface' ||
|
||||
source.value === 'react-native/setup-env'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,10 +18,12 @@ module.exports = {
|
||||
platforms: ['android', 'ios', 'native'],
|
||||
},
|
||||
moduleNameMapper: {
|
||||
// `setup-env` is a secondary entry point exposed via the package's
|
||||
// `exports`, but `./jest/resolver.js` strips `exports` and the generic
|
||||
// mapper below resolves subpaths as literal directory paths. Alias it
|
||||
// explicitly so it resolves to its `src/` implementation.
|
||||
// `setup-env` and `react-private-interface` are secondary entry points
|
||||
// exposed via the package's `exports`, but `./jest/resolver.js` strips
|
||||
// `exports` and the generic mapper below resolves subpaths as literal
|
||||
// directory paths. Alias them explicitly so they resolve to their `src/`
|
||||
// implementations.
|
||||
'^react-native/react-private-interface$': `${path.dirname(require.resolve('react-native'))}/src/react-private-interface.js`,
|
||||
'^react-native/setup-env$': `${path.dirname(require.resolve('react-native'))}/src/setup-env.js`,
|
||||
'^react-native($|/.*)': `${path.dirname(require.resolve('react-native'))}/$1`,
|
||||
},
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
* @noformat
|
||||
* @nolint
|
||||
* @flow
|
||||
* @generated SignedSource<<cf323fc5ca893bab5669c7d321660412>>
|
||||
* @generated SignedSource<<8b6b4d01340cfba2de5eabc3936dfbdd>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import {BatchedBridge} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
|
||||
import {BatchedBridge} from 'react-native/react-private-interface';
|
||||
|
||||
import type {ReactFabricType} from './ReactNativeTypes';
|
||||
|
||||
|
||||
+2
-2
@@ -7,12 +7,12 @@
|
||||
* @noformat
|
||||
* @nolint
|
||||
* @flow strict-local
|
||||
* @generated SignedSource<<52163887de05f1cff05388145cf85b3b>>
|
||||
* @generated SignedSource<<26e94f747da2450a86c1e314470813f5>>
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import {ReactNativeViewConfigRegistry} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
|
||||
import {ReactNativeViewConfigRegistry} from 'react-native/react-private-interface';
|
||||
import {type ViewConfig} from './ReactNativeTypes';
|
||||
|
||||
const {register} = ReactNativeViewConfigRegistry;
|
||||
|
||||
Reference in new issue
Block a user