Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin-react-native/no-deep-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
}
Expand Down
10 changes: 6 additions & 4 deletions packages/jest-preset/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
},
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/Libraries/Renderer/shims/ReactFabric.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading