Add support for src directory in react-native (#42385)

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

This adds support for having JS files in a `src` directory within the `react-native` package. The plan is to have 2 subdirectories there:
* `react-native/src/private` for private modules, with any nested directories (e.g.: `react-native/src/private/dom/nodes/ReadOnlyNode.js`).
* `react-native/src/public` for public modules, without nested directories. The plan is that the individual modules created in this directory will be public through the index module or directly via something like `react-native/View` (mapped to `react-native/src/public/View`, or a `dist` directory in the published npm package—details TBD).

The enforcement of private modules being inaccessible from outside the `react-native` package will be added soon by huntie.

Changelog: [internal]

Reviewed By: huntie

Differential Revision: D52875999

fbshipit-source-id: 914ed806f2cb86857e2cb7b760292c2190b5b14e
This commit is contained in:
Rubén Norte
2024-01-22 04:05:20 -08:00
committed by Facebook GitHub Bot
parent a7586947d7
commit 3c2c48609d
3 changed files with 9 additions and 2 deletions
+4 -1
View File
@@ -60,7 +60,10 @@ module.exports = {
},
},
{
files: ['packages/react-native/Libraries/**/*.js'],
files: [
'packages/react-native/Libraries/**/*.js',
'packages/react-native/src/**/*.js',
],
rules: {
'@react-native/platform-colors': 2,
'@react-native/specs/react-native-modules': 2,
+4 -1
View File
@@ -56,7 +56,10 @@ module.exports = {
'denodeify',
],
testEnvironment: 'node',
collectCoverageFrom: ['packages/react-native/Libraries/**/*.js'],
collectCoverageFrom: [
'packages/react-native/Libraries/**/*.js',
'packages/react-native/src/**/*.js',
],
coveragePathIgnorePatterns: [
'/__tests__/',
'/vendor/',
+1
View File
@@ -79,6 +79,7 @@
"sdks/hermes-engine",
"sdks/hermesc",
"settings.gradle.kts",
"src",
"template.config.js",
"template",
"!template/node_modules",