Skip to content

Graph: Refactor require.context inputs as a VirtualSource (rename RequireContext) - #2041

Open
robhogan wants to merge 1 commit into
mainfrom
pr2041
Open

robhogan wants to merge 1 commit into
mainfrom
pr2041

Conversation

@robhogan

@robhogan robhogan commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Graph threads a RequireContext per module from buildSubgraph through commit, snapshots and release, so that the transformer can render a context module's template. It's the one place Metro carries a transform's input on a dependency edge rather than reading it from disk.

This generalises that slot to VirtualSource, a union whose only member for now is require.context's parameters. ModuleData.resolvedContexts becomes virtualSources, and markModifiedContextModules only considers context entries.

This takes some of the noise out #2036 for ease of review, and should be read in the context of that design. No behaviour or API change.

Changelog: Internal

`Graph` threads a `RequireContext` per module from `buildSubgraph` through commit, snapshots and release, so that the transformer can render a context module's template. It's the one place Metro carries a transform's input on a dependency edge rather than reading it from disk.

This generalises that slot to `VirtualSource`, a tagged union whose only arm for now is a `require.context`'s parameters, so that a virtual module's source can travel the same way (#2036) rather than through a second mechanism beside it. `ModuleData.resolvedContexts` becomes `virtualSources`, and `markModifiedContextModules` only considers context entries.

Changelog: Internal
@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 Oct 8, 2026
@robhogan
robhogan added this pull request to stack #2042 October 8, 2026 12:56
@robhogan robhogan changed the title Graph: Carry require.context inputs as a VirtualSource Graph: Refactor require.context inputs as a VirtualSource (rename RequireContext) Oct 8, 2026
@robhogan
robhogan marked this pull request as ready for review October 8, 2026 13:29
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 8, 2026

This branch has not been deployed

No deployments
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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant