Commit 80824e6
Expose build entry point for AssetRegistry
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).
Differential Revision: D1087503031 parent 6635de8 commit 80824e6
5 files changed
Lines changed: 39 additions & 19 deletions
File tree
- packages
- assets-registry
- metro-config/src
- react-native
- Libraries/Image
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
59 | 63 | | |
60 | 64 | | |
61 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments