diff --git a/.flowconfig b/.flowconfig index 1faa6debeb19..96277a41df5f 100644 --- a/.flowconfig +++ b/.flowconfig @@ -69,6 +69,11 @@ munge_underscores=true module.name_mapper='^react-native$' -> '/packages/react-native/index.js' module.name_mapper='^react-native/\(.*\)$' -> '/packages/react-native/\1' module.name_mapper='^@react-native/dev-middleware$' -> '/packages/dev-middleware' +; [macOS] Resolve workspace self-references (incl. @react-native/fantom) in yarn pnpm mode +module.name_mapper='^@react-native/fantom$' -> '/private/react-native-fantom/src/index.js' +module.name_mapper='^@react-native/fantom/\(.*\)$' -> '/private/react-native-fantom/\1' +module.name_mapper='^@react-native/core-cli-utils$' -> '/packages/core-cli-utils/src/index.flow.js' +; macOS] module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\|xml\)$' -> '/packages/react-native/Libraries/Image/RelativeImageStub' module.system.haste.module_ref_prefix=m# diff --git a/.prettierrc b/.prettierrc index a3f4c89ec6a2..91d36cb6e41e 100644 --- a/.prettierrc +++ b/.prettierrc @@ -6,6 +6,7 @@ "singleQuote": true, "trailingComma": "all", "endOfLine": "lf", + "plugins": ["prettier-plugin-hermes-parser"], "overrides": [ { "files": ["*.code-workspace"], diff --git a/.yarnrc.yml b/.yarnrc.yml index 2d4e1303d05c..2fb7124f02d3 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1,7 +1,44 @@ enableScripts: false -nodeLinker: node-modules +nodeLinker: pnpm # [macOS] npmMinimalAgeGate: 7d yarnPath: .yarn/releases/yarn-4.12.0.cjs + +# [macOS] Declare direct dependencies that upstream package manifests omit and that +# were previously resolved via a hoisted node_modules. In yarn pnpm mode the strict, +# non-hoisted layout requires them. Centralizing them here keeps the upstream-tracked +# manifests pristine. Third-party only: yarn.config.cjs constraints don't govern +# packageExtensions, so no @react-native/* deps belong here (they must stay in a +# manifest to remain under release-branch version-pinning). +packageExtensions: + "@react-native/codegen@*": + dependencies: + "@babel/parser": "^7.25.2" + "@react-native/babel-plugin-codegen@*": + dependencies: + "@babel/plugin-syntax-flow": "^7.25.0" + "@react-native/core-cli-utils@*": + dependencies: + "metro": "^0.82.5" + "@react-native/metro-babel-transformer@*": + dependencies: + "metro-babel-transformer": "^0.82.5" + "@react-native/compatibility-check@*": + dependencies: + "invariant": "^2.2.4" + "@react-native/tester@*": + dependencies: + "metro-config": "^0.82.5" + "@react-native/eslint-plugin-monorepo@*": + dependencies: + "hermes-estree": "0.29.1" + "@react-native/fantom@*": + dependencies: + "jest-docblock": "^29.7.0" + "jest-message-util": "^29.7.0" + "metro": "^0.82.5" + "metro-config": "^0.82.5" + "source-map": "^0.6.1" +# macOS] diff --git a/docsite/.yarnrc.yml b/docsite/.yarnrc.yml new file mode 100644 index 000000000000..dc4cc3e1cf71 --- /dev/null +++ b/docsite/.yarnrc.yml @@ -0,0 +1,2 @@ +# Keep the standalone docsite on node-modules; Docusaurus needs hoisted deps. +nodeLinker: node-modules diff --git a/package.json b/package.json index 52efcc047118..81e9d164210e 100644 --- a/package.json +++ b/package.json @@ -53,18 +53,28 @@ "@babel/core": "^7.25.2", "@babel/eslint-parser": "^7.25.1", "@babel/generator": "^7.25.0", + "@babel/parser": "^7.25.2", "@babel/plugin-syntax-typescript": "^7.25.4", "@babel/plugin-transform-regenerator": "^7.24.7", "@babel/preset-env": "^7.25.3", "@babel/preset-flow": "^7.24.7", + "@babel/runtime": "^7.25.2", + "@babel/traverse": "^7.25.2", + "@babel/types": "^7.25.2", "@changesets/cli": "^2.28.1", "@electron/packager": "^18.3.6", "@jest/create-cache-key-function": "^29.7.0", "@microsoft/api-extractor": "^7.52.2", + "@react-native/babel-preset": "workspace:*", + "@react-native/eslint-config": "workspace:*", + "@react-native/eslint-plugin": "workspace:*", + "@react-native/eslint-plugin-monorepo": "workspace:*", + "@react-native/eslint-plugin-specs": "workspace:*", "@react-native/metro-babel-transformer": "workspace:*", "@react-native/metro-config": "workspace:*", "@tsconfig/node22": "22.0.2", "@types/react": "^19.1.0", + "@typescript-eslint/eslint-plugin": "^7.1.1", "@typescript-eslint/parser": "^7.1.1", "@yarnpkg/types": "^4.0.1", "ansi-styles": "^4.2.1", @@ -84,6 +94,7 @@ "eslint-plugin-jest": "^27.9.0", "eslint-plugin-jsx-a11y": "^6.6.0", "eslint-plugin-react": "^7.30.1", + "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-native": "^4.0.0", "eslint-plugin-redundant-undefined": "^0.4.0", "eslint-plugin-relay": "^1.8.3", @@ -91,6 +102,7 @@ "flow-bin": "^0.275.0", "glob": "^7.1.1", "hermes-eslint": "0.29.1", + "hermes-estree": "0.29.1", "hermes-transform": "0.29.1", "inquirer": "^7.1.0", "jest": "^29.7.0", @@ -98,9 +110,12 @@ "jest-diff": "^29.7.0", "jest-junit": "^10.0.0", "jest-snapshot": "^29.7.0", + "jsonc-eslint-parser": "^2.3.0", "markdownlint-cli2": "^0.22.0", "markdownlint-rule-relative-links": "^3.0.0", + "metro": "^0.82.5", "metro-babel-register": "^0.82.5", + "metro-config": "^0.82.5", "metro-memory-fs": "^0.82.5", "metro-transform-plugins": "^0.82.5", "micromatch": "^4.0.4", @@ -118,6 +133,7 @@ "tinybench": "^3.1.0", "typescript": "5.8.3", "ws": "^6.2.3", + "yargs": "^17.6.2", "zx": "^8.2.4" }, "resolutions": { diff --git a/packages/rn-tester/metro.config.js b/packages/rn-tester/metro.config.js index 445adfde474a..7ed5386ac94c 100644 --- a/packages/rn-tester/metro.config.js +++ b/packages/rn-tester/metro.config.js @@ -39,6 +39,7 @@ const config = { blockList: [/..\/react-native\/sdks\/hermes/], extraNodeModules: { 'react-native': path.resolve(__dirname, '../react-native'), + 'react-native-macos': path.resolve(__dirname, '../react-native'), // [macOS] resolve the react-native -> react-native-macos redirect in yarn pnpm mode }, platforms: ['ios', 'macos', 'android'], // [macOS] }, diff --git a/yarn.lock b/yarn.lock index 305e0c9812e4..d5f250b9a590 100644 --- a/yarn.lock +++ b/yarn.lock @@ -387,7 +387,7 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.29.7": +"@babel/parser@npm:^7.25.2, @babel/parser@npm:^7.29.7": version: 7.29.7 resolution: "@babel/parser@npm:7.29.7" dependencies: @@ -566,6 +566,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-syntax-flow@npm:^7.25.0": + version: 7.29.7 + resolution: "@babel/plugin-syntax-flow@npm:7.29.7" + dependencies: + "@babel/helper-plugin-utils": "npm:^7.29.7" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 10c0/b2e330dd0dc535c7364937ce2b29a06065e60b1d523db75f36ab4fb89e4ba664e2230cbb1937b35712c9a0ebafc3358f323d6e6b22247d5ebad12fdd3e1f6e98 + languageName: node + linkType: hard + "@babel/plugin-syntax-import-assertions@npm:^7.26.0": version: 7.26.0 resolution: "@babel/plugin-syntax-import-assertions@npm:7.26.0" @@ -1543,6 +1554,13 @@ __metadata: languageName: node linkType: hard +"@babel/runtime@npm:^7.25.2": + version: 7.29.7 + resolution: "@babel/runtime@npm:7.29.7" + checksum: 10c0/ca11572f7146b21e0bde6a9ed4bb6a89eafbee5f0944c7eb54d0d8a2dac962c33638a1d611e14faa71dfbb92b4b5f9236232208568a6b7d5c6f3f39ddb91771e + languageName: node + linkType: hard + "@babel/template@npm:^7.25.0, @babel/template@npm:^7.25.9, @babel/template@npm:^7.27.2, @babel/template@npm:^7.3.3": version: 7.27.2 resolution: "@babel/template@npm:7.27.2" @@ -1580,6 +1598,21 @@ __metadata: languageName: node linkType: hard +"@babel/traverse@npm:^7.25.2, @babel/traverse@npm:^7.29.7": + version: 7.29.7 + resolution: "@babel/traverse@npm:7.29.7" + dependencies: + "@babel/code-frame": "npm:^7.29.7" + "@babel/generator": "npm:^7.29.7" + "@babel/helper-globals": "npm:^7.29.7" + "@babel/parser": "npm:^7.29.7" + "@babel/template": "npm:^7.29.7" + "@babel/types": "npm:^7.29.7" + debug: "npm:^4.3.1" + checksum: 10c0/e256a1fbdb956555b76f3c285b1e453f6bedec8b3afb61751d99d933efd11c7d79caf5ddf2493570058a9f7deaa1b48324380d7c1aa1443fd9508becbf56331a + languageName: node + linkType: hard + "@babel/traverse@npm:^7.25.3, @babel/traverse@npm:^7.25.9, @babel/traverse@npm:^7.27.1, @babel/traverse@npm:^7.28.3, @babel/traverse@npm:^7.28.4": version: 7.28.4 resolution: "@babel/traverse@npm:7.28.4" @@ -1595,21 +1628,6 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.29.7": - version: 7.29.7 - resolution: "@babel/traverse@npm:7.29.7" - dependencies: - "@babel/code-frame": "npm:^7.29.7" - "@babel/generator": "npm:^7.29.7" - "@babel/helper-globals": "npm:^7.29.7" - "@babel/parser": "npm:^7.29.7" - "@babel/template": "npm:^7.29.7" - "@babel/types": "npm:^7.29.7" - debug: "npm:^4.3.1" - checksum: 10c0/e256a1fbdb956555b76f3c285b1e453f6bedec8b3afb61751d99d933efd11c7d79caf5ddf2493570058a9f7deaa1b48324380d7c1aa1443fd9508becbf56331a - languageName: node - linkType: hard - "@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.25.2, @babel/types@npm:^7.25.9, @babel/types@npm:^7.26.7, @babel/types@npm:^7.27.1, @babel/types@npm:^7.27.3, @babel/types@npm:^7.28.2, @babel/types@npm:^7.28.4, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4": version: 7.28.4 resolution: "@babel/types@npm:7.28.4" @@ -3075,18 +3093,28 @@ __metadata: "@babel/core": "npm:^7.25.2" "@babel/eslint-parser": "npm:^7.25.1" "@babel/generator": "npm:^7.25.0" + "@babel/parser": "npm:^7.25.2" "@babel/plugin-syntax-typescript": "npm:^7.25.4" "@babel/plugin-transform-regenerator": "npm:^7.24.7" "@babel/preset-env": "npm:^7.25.3" "@babel/preset-flow": "npm:^7.24.7" + "@babel/runtime": "npm:^7.25.2" + "@babel/traverse": "npm:^7.25.2" + "@babel/types": "npm:^7.25.2" "@changesets/cli": "npm:^2.28.1" "@electron/packager": "npm:^18.3.6" "@jest/create-cache-key-function": "npm:^29.7.0" "@microsoft/api-extractor": "npm:^7.52.2" + "@react-native/babel-preset": "workspace:*" + "@react-native/eslint-config": "workspace:*" + "@react-native/eslint-plugin": "workspace:*" + "@react-native/eslint-plugin-monorepo": "workspace:*" + "@react-native/eslint-plugin-specs": "workspace:*" "@react-native/metro-babel-transformer": "workspace:*" "@react-native/metro-config": "workspace:*" "@tsconfig/node22": "npm:22.0.2" "@types/react": "npm:^19.1.0" + "@typescript-eslint/eslint-plugin": "npm:^7.1.1" "@typescript-eslint/parser": "npm:^7.1.1" "@yarnpkg/types": "npm:^4.0.1" ansi-styles: "npm:^4.2.1" @@ -3106,6 +3134,7 @@ __metadata: eslint-plugin-jest: "npm:^27.9.0" eslint-plugin-jsx-a11y: "npm:^6.6.0" eslint-plugin-react: "npm:^7.30.1" + eslint-plugin-react-hooks: "npm:^5.2.0" eslint-plugin-react-native: "npm:^4.0.0" eslint-plugin-redundant-undefined: "npm:^0.4.0" eslint-plugin-relay: "npm:^1.8.3" @@ -3113,6 +3142,7 @@ __metadata: flow-bin: "npm:^0.275.0" glob: "npm:^7.1.1" hermes-eslint: "npm:0.29.1" + hermes-estree: "npm:0.29.1" hermes-transform: "npm:0.29.1" inquirer: "npm:^7.1.0" jest: "npm:^29.7.0" @@ -3120,9 +3150,12 @@ __metadata: jest-diff: "npm:^29.7.0" jest-junit: "npm:^10.0.0" jest-snapshot: "npm:^29.7.0" + jsonc-eslint-parser: "npm:^2.3.0" markdownlint-cli2: "npm:^0.22.0" markdownlint-rule-relative-links: "npm:^3.0.0" + metro: "npm:^0.82.5" metro-babel-register: "npm:^0.82.5" + metro-config: "npm:^0.82.5" metro-memory-fs: "npm:^0.82.5" metro-transform-plugins: "npm:^0.82.5" micromatch: "npm:^4.0.4" @@ -3140,6 +3173,7 @@ __metadata: tinybench: "npm:^3.1.0" typescript: "npm:5.8.3" ws: "npm:^6.2.3" + yargs: "npm:^17.6.2" zx: "npm:^8.2.4" languageName: unknown linkType: soft @@ -3374,7 +3408,7 @@ __metadata: languageName: unknown linkType: soft -"@react-native/eslint-config@workspace:packages/eslint-config-react-native": +"@react-native/eslint-config@workspace:*, @react-native/eslint-config@workspace:packages/eslint-config-react-native": version: 0.0.0-use.local resolution: "@react-native/eslint-config@workspace:packages/eslint-config-react-native" dependencies: @@ -3398,7 +3432,7 @@ __metadata: languageName: unknown linkType: soft -"@react-native/eslint-plugin-monorepo@workspace:private/eslint-plugin-monorepo": +"@react-native/eslint-plugin-monorepo@workspace:*, @react-native/eslint-plugin-monorepo@workspace:private/eslint-plugin-monorepo": version: 0.0.0-use.local resolution: "@react-native/eslint-plugin-monorepo@workspace:private/eslint-plugin-monorepo" dependencies: @@ -3406,7 +3440,7 @@ __metadata: languageName: unknown linkType: soft -"@react-native/eslint-plugin-specs@workspace:packages/eslint-plugin-specs": +"@react-native/eslint-plugin-specs@workspace:*, @react-native/eslint-plugin-specs@workspace:packages/eslint-plugin-specs": version: 0.0.0-use.local resolution: "@react-native/eslint-plugin-specs@workspace:packages/eslint-plugin-specs" dependencies: @@ -10064,7 +10098,7 @@ __metadata: languageName: node linkType: hard -"metro-babel-transformer@npm:0.82.5": +"metro-babel-transformer@npm:0.82.5, metro-babel-transformer@npm:^0.82.5": version: 0.82.5 resolution: "metro-babel-transformer@npm:0.82.5" dependencies: