14 Commits
Author SHA1 Message Date
Alex Hunt 89300acb9c Migrate Node.js builtin imports to node: scheme (#57611)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57611

Directly follows D112733139 (Metro).

**Motivation**

- New Node builtins are *only* available under the prefix (e.g. `node:sqlite`), as this allows Node to introduce them without ecosystem-breaking changes, so this is the direction of travel and the only choice that'll allow consistency.
- Encouraging them and grouping them separately makes it easier to reason about a module's 3rd party dependencies.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D112803684

fbshipit-source-id: 40668d746a7151b3aa4800ff8af997902a18d198
2026-07-21 09:01:41 -07:00
Alex Hunt 042833e699 Extend check-packages-test to validate additional required fields (#57510)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57510

Extend `check-packages-test.js` to catch two more classes of manifest drift: published packages missing required fields, and packages under `private/` missing the `private` flag.

**Motivation**

Inspired by https://github.com/react-native-community/template/pull/241 — avoid a missing field blocking a future RN package publish.

**Other changes**

- To satisfy the new `files` requirement, add an explicit `files` allowlist to the four config packages that lacked one. As a side effect, this saves some `__tests__`  files from being distributed.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D111471314

fbshipit-source-id: e13082d2282128936e22e3a7580b5e434c3b41b2
2026-07-10 12:27:14 -07:00
Alex Hunt 6cfde8f296 Move AssetRegistry implementation into main package, expose as public API (#57369)
Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57369

**Problem**

The separate `react-native/assets-registry` package includes a longstanding ecosystem footgun.

`registry.js` holds asset state in a module-scoped variable, which makes the package a stateful singleton: exactly one instance must exist per JS runtime, or registration and lookup diverge.

We provide no guarantee that this singleton requirement holds:

- The install layout — how the package manager dedupes packages in `node_modules` — decides how many copies exist, and `react-native`'s exact-version pin means third-party ranges never dedupe against it.

Effects:

- **Consumers silently break**: `expo-asset` and `expo-image` can land on a second copy: assets register in one, resolve as `undefined` from the other. Expo neutralizes this with a shim in `expo/cli` that redirects every registry import to a single virtual module — bare React Native + Metro has no such protection.
- **This blocks 1.0**: The ecosystem can't move from exact-version lockstep to semver ranges until stateful packages like the asset registry are safe to duplicate. Today, relaxing the pin would turn a latent footgun into a common one.

**To solve this**, move towards (but not quite yet) deleting `react-native/assets-registry`, in favour of a replacement `AssetRegistry` API offered directly by `react-native`.

**Key changes**

NOTE: **Reviewer note**: Browsing file changes on GitHub may be more focused — https://github.com/react/react-native/pull/57369/changes

NOTE: Squash of https://github.com/react/react-native/pull/57233 (D108750302) and https://github.com/react/react-native/pull/57232 (D108750303)

`'react-native'`:
- Add new `AssetRegistry` API, along with the `PackagerAsset` and `AssetDestPathResolver` root type exports in `react-native`.
- Add a new `'react-native/asset-registry'` secondary entry point — intended for Metro's `transformer.assetRegistryPath` config contract.

`react-native/assets-registry`:
- Update to source from this relocated implementation — fixing the duplicate install layout bug (where apps/frameworks enforce a single copy of `react-native`).

**Impact**

- **✅ Fixed**: Imports from either `react-native` or `react-native/assets-registry` in RN 0.87+ will be durable to duplicate package installs — Expo can remove their virtual module shim.
- **✅ Fixed**: Deep import `'react-native/Libraries/Image/AssetRegistry'` dependency removed (migrated in `react-native/metro-config`).

Changelog:
- [General][Fixed] - **assets-registry**: `react-native/assets-registry` now shares state across duplicate installs, sourcing from a relocated implementation in the `react-native` package
- [General][Added] - Add `AssetRegistry` API (replaces `react-native/assets-registry/registry`)
- [General][Breaking] - `react-native/Libraries/Image/AssetRegistry` is removed. Please use the `AssetRegistry` API (apps/library code) and/or the `react-native/asset-registry` entrypoint (Metro/build configs).

Reviewed By: robhogan

Differential Revision: D109019622

fbshipit-source-id: 75599a94a9aba084a1266f2128c448379d1596cd
2026-07-06 10:32:14 -07:00
Sam Zhou 82bffce573 Cleanup legacy flow types in react-native (#56300)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56300

Changelog: [Internal]

Reviewed By: marcoww6

Differential Revision: D99004126

fbshipit-source-id: dfedc13c867cb768777e2ba65256a2c40ffb1d08
2026-03-31 19:25:25 -07:00
Maciej Jastrzębski 8a740acdbc Fix updating peerDependencies for releases (#55630)
Summary:
Recently added `react-native/jest-preset` package is an optional peer dep to the main `react-native` package. However, it's version dep is not updated correctly for nightly builds.

Peer dep version for [latest nightly](https://www.npmjs.com/package/react-native/v/0.85.0-nightly-20260219-44901aaf9?activeTab=code) is :
```
"peerDependencies": {
    "eact-native/jest-preset": "0.84.0-main",
    // ....
  },
```

From my analysis this is because publishing scripts only update `deps` and `devDeps` but not `peerDeps`. Proposed change adds `peerDeps` to the list of potential deps locations to update

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[INTERNAL] [FIXED] - Fix peer deps version to `react-native/jest-preset`.

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

Reviewed By: cipolleschi

Differential Revision: D93850121

Pulled By: huntie

fbshipit-source-id: 9f24cf302aa93c5b3721ebfd571171ee9e5af712
2026-02-20 03:07:00 -08:00
Pieter De Baets 7ff4c218cf Remove references to integration/runner (#55342)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55342

This was the old fantom location and no longer used.

Changelog: [Internal]

Reviewed By: zeyap

Differential Revision: D91680127

fbshipit-source-id: d0015ed1668065487c156eabe535e35e75c52d3f
2026-02-02 15:48:22 -08:00
Alex Hunt f2948fb2ad Remove unused code from scm-utils (#55036)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55036

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D90107033

fbshipit-source-id: 701b02801a59ee0c910de772dfa75d924e78860b
2026-01-05 04:05:34 -08:00
Phil Pluckthun 41eace0093 Replace glob@^7.0.0 with tinyglobby@^0.2.15 (#54737)
Summary:
This replaces `glob@^7.0.0` with `tinyglobby@^0.2.15`. `glob@7` has been deprecated for a while and some versions after had security notices released for them. The plan is to backport this PR to `0.81.x` and onwards.

> [!NOTE]
> This is a stopgap solution until `fs.glob` becomes generally available with the EOL of Node v20

Succeeds:
- https://github.com/facebook/react-native/issues/54669
- https://github.com/facebook/react-native/issues/48875

## Changelog:

[GENERAL] [SECURITY] - Replace `glob@^7.0.0` with `tinyglobby@^0.2.15`

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

Test Plan:
- Ran all modified commands manually and `pod install in `rn-tester`
- NOTE: `ios-prebuild`-related scripts haven't been run manually yet

Reviewed By: robhogan

Differential Revision: D88069145

Pulled By: huntie

fbshipit-source-id: 0c455342a4c6d1d6605fd09fe47b418e5d751491
2025-12-03 05:45:48 -08:00
Riccardo Cipolleschi f45518f691 Use the right package.json when comparing react-native's versions (#54495)
Summary:
This is a port back in main of the commit a0e40ec09f we landed in the 0.83-stable branch to fix the release process of React Native.

## Changelog:
[Internal] -

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

Test Plan: GHA + tested while doing the release

Reviewed By: huntie

Differential Revision: D86766812

Pulled By: cipolleschi

fbshipit-source-id: 0e5664b3ceed32fd05fdfe3fca1bffead9d3eae1
2025-11-11 08:15:15 -08:00
Alex Hunt ee7575fec2 Fix publish-npm test mocks isolation (#54479)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54479

Fixes failing CI jobs on `0.83-stable`, e.g. https://github.com/facebook/react-native/actions/runs/19234912061/job/54982161510.

**Changes**

- Simplify main package `package.json` file read with existing `getWorkspaceRoot` util.
- Fix test by mocking `getWorkspaceRoot` (previously: read the real filesystem and caused test breakage outside `main`).
- Add additional `RC0 → RC1` test case.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D86674348

fbshipit-source-id: 0b8feb4cbf7b1ac7cf4cc560f066a0a10aec1b5f
2025-11-10 09:46:38 -08:00
Alex Hunt 7486a2bc50 Fix set-version script to update rn-tester (#54451)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54451

Restores behaviour pre-D76358273. `rn-tester` is a special case package that we do want to version, even though it's marked as `private: true`.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D86534510

fbshipit-source-id: 5557e22361bba82a6acaa5eab911002bb9894ae4
2025-11-07 17:13:23 -08:00
Rob Hogan cf45aa9dbc Bump Metro to 0.83.0 (#52576)
Summary:
Bump Metro to 0.83.0.

This release contains some breaking changes for integrators, and a minimum Node.js version of 22.14.

Full release notes: https://github.com/facebook/metro/releases/tag/v0.83.0

Changelog: [General][Changed] Bump Metro to ^0.83.0

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

Rollback Plan:

Differential Revision: D78171925

Pulled By: robhogan

fbshipit-source-id: 7ea5e04d285632a14dd71ba00da872d60f283840
2025-07-13 15:39:46 -07:00
Rob Hogan ec5bde62b6 Breaking: Use named exports in metro-babel-register (#52564)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52564

Currently, `metro-babel-register` has a function as its default export, to which we've tagged on various properties.

This tidies that up to a more idiomatic object of named exports, with `register` as a new one of them.

This also serves to make it more compatible with automatic TypeScript generation.

This is semver breaking, but `metro-babel-register` has very little usage outside Meta projects so isn't expected to be disruptive.

Changelog: [Internal]

Metro changelog:
```
 - **[Breaking]**: Move metro-babel-register's main function to a named export `register`
```

Reviewed By: huntie

Differential Revision: D78157559

fbshipit-source-id: c59c9820e9895007345561fed9ccec2273b925c8
2025-07-11 11:03:29 -07:00
Alex Hunt fc5e33b582 Reorganise shared script utils (#52473)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52473

Shared utils that were located in the root of `scripts/` are now colocated closer to their dependencies or moved to `scripts/shared/` — simplifying the root directory layout.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D77873875

fbshipit-source-id: e04dba41a1ef811d32793931033fdfa93afad0cd
2025-07-08 06:10:36 -07:00