Skip to content

Bump Metro to 0.88.0 (#2200) - #2200

Closed
cortinico wants to merge 1 commit into
mainfrom
export-D130252821
Closed

cortinico wants to merge 1 commit into
mainfrom
export-D130252821

Conversation

@cortinico

@cortinico cortinico commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Bump Metro to 0.88.0, a breaking release: https://github.com/react/metro/releases/tag/v0.88.0

Almost all of the breaking changes are integrator-facing, the others are resolver spec alignment. Users are most likely to notice:

  • Packages' "exports" are read from the package root, and "browser" redirections apply after them, so some subpath imports resolve to a different build. resolver.unstable_resolveExportsFromPackageRoot and resolver.unstable_applyBrowserSpecAfterExports turn either off.
  • resolver.emptyModulePath defaults to metro:runtime/modules/empty-module. Custom resolvers already have to delegate metro: specifiers they don't handle, for metro:babel-runtime, but code that reads the option as a file path breaks.

NOTE: I intend to pick this to 0.89.0-rc.1

Other changes in this PR

  • Removes the config defaults that now match Metro's core defaults (transformer.asyncRequireModulePath, transformer.allowOptionalDependencies and watchFolders: [])
  • Remove two Flow suppressions for transformer options that Metro's types now declare.
  • react-native/metro-babel-transformer passes supportsInlineModules to Babel in the caller, as metro-babel-transformer does, so that presets and plugins can tell whether metro:inline specifiers (Resolver: Add metro:inline specifiers for importer-anchored inline modules #2037) will resolve.

Changelog

[General] [Changed] - Bump Metro to 0.88.0
[General] [Added] - react-native/metro-babel-transformer passes Metro's supportsInlineModules to Babel presets and plugins

X-link: react/react-native#59831

Test Plan:

yarn install --frozen-lockfile --ignore-scripts
yarn flow-check
yarn test packages/metro-config packages/react-native-babel-transformer packages/community-cli-plugin

New unit test for supportsInlineModules, which fails for true and false without the change. getDefaultConfig() returns the same values for every option with and without the removed defaults.

Metro 0.88.0 was tested end to end in a React Native 0.89.0-rc.0 template app before release (#2192).

Reviewed By: vzaidman

Differential Revision: D130252821

Pulled By: cortinico

@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 Nov 9, 2026
@meta-codesync

meta-codesync Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Metro review: Looks good

Risk: low · Commit: c076d43 · 8 commands run

The title and description describe a React Native bump to Metro 0.88.0, but the diff only makes toBabelSegments emit a literal source: null for generated-only mappings and adds a test. The change is safe: with the locked source-map 0.5.7, output matched the merge base for every basic map tested, so it has no effect on valid inputs and the new test passes without it. The only remaining points are two nits: the description doesn't match the diff, and the test doesn't guard the change.

Findings

Verified
  • ✅ yarn jest --no-watchman packages/metro-source-map — 7 suites, 201 tests.
  • ✅ yarn jest --no-watchman packages/metro-source-map/src/__tests__/source-map-test.js -t 'keeps generated-only' (with source-map.js:367 temporarily restored to source: map.source) — The new test passes without the source change. The temporary edit was then undone, and git diff HEAD shows source-map.js back at the PR head.
  • ❌ yarn jest --no-watchman packages/metro-source-map/src/__tests__/review-differential-test.js — Base vs head: 8 of 9 pass, including 2000 fuzzed basic maps and the decodeVlqMap shape. The one failure is an index map, outside the declared BasicSourceMap input type, where source changes from undefined to null. Harmless.
  • ✅ yarn jest --no-watchman packages/metro-source-map/src/__tests__/review-sourcemap06-test.js — Inconclusive: the mock only applied to head, and base loaded its own 0.5.7 copy. Not used as evidence; replaced by the direct 0.6.1 call below.
  • ✅ node -e (print eachMapping sources from root node_modules/source-map 0.6.1, with and without sourceRoot) — Generated-only source is /src/ with a sourceRoot and . without one, so the literal only matters outside the declared range.
  • ✅ yarn jest --no-watchman packages/metro-source-map/src/__tests__/source-map-test.js packages/metro-transform-worker/src/__tests__/tuplesFromBabelDecodedMap-test.js packages/metro/src/DeltaBundler/Serializers — 11 suites, 111 tests, covering consumers of the source map code.
  • ✅ yarn eslint packages/metro-source-map/src/source-map.js packages/metro-source-map/src/__tests__/source-map-test.js — No lint problems printed. The exit code was masked by a pipe to tail, so this rests on the empty output.
  • ✅ npx npm@11 pack source-map@0.5.6 (package_manager tool) — Downloaded only. Extracting it was denied, so its code wasn't inspected.

Not run: No benchmark: toBabelSegments is on the flat VLQ decode path, but replacing a property read with a literal has no plausible cost. yarn typecheck and yarn verify-api-snapshots were not run because no types or exports changed. source-map 0.5.6, the lowest version in range, was not inspected because a permission denial blocked extracting the tarball; 0.5.7 is the locked and tested version. An earlier read-only command was also denied, so that information came from Read and Grep. Windows was not tested: no path handling changed.

Automated review by Claude. Advisory only: it never approves or blocks, and a maintainer makes the call.

).toMatchSnapshot();
});

test('keeps generated-only mappings sourceless with a source root', () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit · The new test passes with the source-map.js change reverted

The test reads like a regression test, but it can't fail under the source-map version this package depends on. metro-source-map declares source-map@^0.5.6, and the lockfile resolves that to 0.5.7. In 0.5.7, eachMapping only joins sourceRoot when source != null, so map.source is already null for a generated-only mapping, and source: map.source and source: null produce the same result.

The literal does matter under source-map 0.6.1, which is outside the declared range: its computeSourceURL turns the same mapping's source into /src/, or . with no sourceRoot. If this is groundwork for a source-map upgrade, the test becomes useful then. Either way, please say in the description that this is hardening rather than a fix for current behavior, or drop the test if no upgrade is planned.

Reproduced: Temporarily restored source: map.source at source-map.js:367 and ran yarn jest --no-watchman packages/metro-source-map/src/__tests__/source-map-test.js -t 'keeps generated-only': 1 passed. A direct call to SourceMapConsumer 0.6.1 from the root node_modules returned ["/src/","/src/input.js"]. The 0.5.7 behavior is at packages/metro-source-map/node_modules/source-map/lib/source-map-consumer.js:143-146. · id b6586948

column: map.generatedColumn,
},
source: map.source,
source: null,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit · The PR title, description and changelog describe a different change

The title, commit message and description cover bumping Metro to 0.88.0 in React Native: config default removal, Flow suppressions and react-native/metro-babel-transformer. None of that is in this diff, and metro-source-map is already at 0.88.0. As written, this commit would land in Metro's history as "Bump Metro to 0.88.0" while actually changing toBabelSegments.

The changelog entries also use React Native's [General] [Changed] and [General] [Added] format rather than a Metro scope. Suggested fix: retitle the PR to describe the toBabelSegments change and use something like Changelog: [Internal]. If the export picked up the wrong description or the wrong diff, correct that before merging.

Evidence: Compared pr.md and the head commit message with diff.patch: the diff changes only source-map.js and its test. packages/metro-source-map/package.json shows version 0.88.0 and isn't changed by the PR. · id c4777486

@cortinico
cortinico requested a review from robhogan November 9, 2026 13:58

@robhogan robhogan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine but I'm surprised it was needed? Are we using different Flow defs somewhere?

Summary:


Bump Metro to 0.88.0, a breaking release: https://github.com/react/metro/releases/tag/v0.88.0

Almost all of the breaking changes are integrator-facing, the others are resolver spec alignment. Users are most likely to notice:

 - Packages' `"exports"` are read from the package root, and `"browser"` redirections apply after them, so some subpath imports resolve to a different build. `resolver.unstable_resolveExportsFromPackageRoot` and `resolver.unstable_applyBrowserSpecAfterExports` turn either off.
 - `resolver.emptyModulePath` defaults to `metro:runtime/modules/empty-module`. Custom resolvers already have to delegate `metro:` specifiers they don't handle, for `metro:babel-runtime`, but code that reads the option as a file path breaks.
 
 **NOTE: *I intend to pick this to 0.89.0-rc.1***

### Other changes in this PR

 - Removes the config defaults that now match Metro's core defaults (`transformer.asyncRequireModulePath`, `transformer.allowOptionalDependencies` and `watchFolders: []`)
 - Remove two Flow suppressions for transformer options that Metro's types now declare.
 - `react-native/metro-babel-transformer` passes `supportsInlineModules` to Babel in the caller, as `metro-babel-transformer` does, so that presets and plugins can tell whether `metro:inline` specifiers (#2037) will resolve.

## Changelog

[General] [Changed] - Bump Metro to 0.88.0
[General] [Added] - `react-native/metro-babel-transformer` passes Metro's `supportsInlineModules` to Babel presets and plugins

X-link: react/react-native#59831

Test Plan:
```
yarn install --frozen-lockfile --ignore-scripts
yarn flow-check
yarn test packages/metro-config packages/react-native-babel-transformer packages/community-cli-plugin
```

New unit test for `supportsInlineModules`, which fails for `true` and `false` without the change. `getDefaultConfig()` returns the same values for every option with and without the removed defaults.

Metro 0.88.0 was tested end to end in a React Native 0.89.0-rc.0 template app before release (#2192).

Reviewed By: vzaidman

Differential Revision: D130252821

Pulled By: cortinico
@meta-codesync meta-codesync Bot changed the title Bump Metro to 0.88.0 Bump Metro to 0.88.0 (#2200) Nov 9, 2026
@robhogan
robhogan deleted the export-D130252821 branch November 10, 2026 08:06
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants