Skip to content

Expose build entry point for AssetRegistry (#57232)#57232

Open
huntie wants to merge 2 commits into
react:mainfrom
huntie:export-D108750303
Open

Expose build entry point for AssetRegistry (#57232)#57232
huntie wants to merge 2 commits into
react:mainfrom
huntie:export-D108750303

Conversation

@huntie

@huntie huntie commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary:

Problem

Following D108750303, we now expose an AssetsRegistry API from 'react-native'.

This is great, as we need to replace a deep /Libraries/... import in Metro configs (transformer.assetRegistryPath):

https://www.internalfb.com/code/fbsource/[31661d52e803d77356725429f44331135601b634]/xplat/js/react-native-github/packages/metro-config/src/index.flow.js?lines=87

Unfortunately, we can't quite reuse the new AssetRegistry API from the index module, as we'd break Metro's API contract (generate an inline require) — we need a dedicated wrapper module that can be read without destructuring.

This diff

Adds a new 'react-native/asset-registry' secondary entry point, intended/documented for this Metro config use case — and deprecates react-native/assets-registry/registry.

  • Solves the above problem (migrated in our own react-native/metro-config use).
  • Remains consistent with D108750302 (we intend to remove react-native/assets-registry at a later date).
  • As a bonus, fixes the longstanding naming inconsistency between react-native/assets-registry and 'react-native/Libraries/Image/AssetRegistry'AssetRegistry (singular) is now canonical.

Changelog:

  • [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).
  • [General][Deprecated] - assets-registry: react-native/assets-registry/registry is deprecated. Please use the AssetRegistry API (apps/library code) and/or the react-native/asset-registry entrypoint (Metro/build configs).

Reviewed By: javache

Differential Revision: D108750303

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 16, 2026
@meta-codesync

meta-codesync Bot commented Jun 16, 2026

Copy link
Copy Markdown

@huntie has exported this pull request. If you are a Meta employee, you can view the originating Diff in D108750303.

@github-actions

Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_NON_BREAKING

@huntie

huntie commented Jun 16, 2026

Copy link
Copy Markdown
Member Author

cc @byCedric

huntie added 2 commits June 25, 2026 03:18
Summary: Resolves T275935135.

Differential Revision: D108750302
Summary:
Pull Request resolved: react#57232

**Problem**

Following D108750303, we now expose an `AssetsRegistry` API from `'react-native'`.

This is great, as we need to replace a deep `/Libraries/...` import in Metro configs (`transformer.assetRegistryPath`):

https://www.internalfb.com/code/fbsource/[31661d52e803d77356725429f44331135601b634]/xplat/js/react-native-github/packages/metro-config/src/index.flow.js?lines=87

**Unfortunately**, we can't quite reuse the new `AssetRegistry` API from the index module, as we'd break Metro's API contract (generate an inline require) — we need a dedicated wrapper module that can be read without destructuring.

**This diff**

Adds a new `'react-native/asset-registry'` secondary entry point, intended/documented for this Metro config use case — and deprecates `react-native/assets-registry/registry`.

- Solves the above problem (migrated in our own `react-native/metro-config` use).
- Remains consistent with D108750302 (we intend to remove `react-native/assets-registry` at a later date).
- As a bonus, fixes the longstanding naming inconsistency between `react-native/assets-registry` and `'react-native/Libraries/Image/AssetRegistry'` — `AssetRegistry` (singular) is now canonical.

Changelog:
- [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).
- [General][Deprecated] - **assets-registry**: `react-native/assets-registry/registry` is deprecated. Please use the `AssetRegistry` API (apps/library code) and/or the `react-native/asset-registry` entrypoint (Metro/build configs).

Reviewed By: javache

Differential Revision: D108750303
@huntie huntie force-pushed the export-D108750303 branch from 80824e6 to ca9e8e2 Compare June 25, 2026 11:19
@meta-codesync meta-codesync Bot changed the title Expose build entry point for AssetRegistry Expose build entry point for AssetRegistry (#57232) Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant