Feature: support cross-file transform inputs with cache and watch invalidation
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.6k
- Forks
- 696
- Avg merge
- 8m
- Merged PRs (30d)
- 7
Description
Metro has no supported way for a transform to state that its output depends on some other source file or graph-derived value.
For example:
// Card.tsx
export const Card = ({children}) => <View>{children}</View>;
// Screen.tsx
export const Screen = () => (
<Card>
<Text>Hello</Text>
</Card>
);
Say that we wanted to transform Screen.tsx, but only if Card.tsx wraps its children under a View. If Card later changes its wrapper component to something else, we need to undo this transformation.
Currently, this is not possible. If Card.tsx changes, Metro transforms Card.tsx, but not the unchanged Screen.tsx. Instead, it returns the old, transformed Screen.tsx from its cache because its cache key does not include Card.tsx.
I see two possible designs:
- A transform-dependency API that records additional file paths or input hashes.
- A graph-level analysis hook that runs after dependency discovery but before final transforms, and provides immutable per-file data to workers.
Related: #918, #1488, and #1605.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named; start by reading related issues #918, #1488, and #1605, then trace Metro's transform cache and watch invalidation behavior. The work is done when a concrete design is selected and cross-file dependencies correctly invalidate cached transforms, including the Card.tsx and Screen.tsx example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100