Repository navigation
Conversation
|
@cortinico has exported this pull request. If you are a Meta employee, you can view the originating Diff in D130252821. |
Metro review: Looks goodRisk: low · Commit: The title and description describe a React Native bump to Metro 0.88.0, but the diff only makes Findings
Verified
Not run: No benchmark: 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', () => { |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
robhogan
left a comment
There was a problem hiding this comment.
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
c076d43 to
8b78d31
Compare
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:
"exports"are read from the package root, and"browser"redirections apply after them, so some subpath imports resolve to a different build.resolver.unstable_resolveExportsFromPackageRootandresolver.unstable_applyBrowserSpecAfterExportsturn either off.resolver.emptyModulePathdefaults tometro:runtime/modules/empty-module. Custom resolvers already have to delegatemetro:specifiers they don't handle, formetro: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
transformer.asyncRequireModulePath,transformer.allowOptionalDependenciesandwatchFolders: [])react-native/metro-babel-transformerpassessupportsInlineModulesto Babel in the caller, asmetro-babel-transformerdoes, so that presets and plugins can tell whethermetro:inlinespecifiers (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-transformerpasses Metro'ssupportsInlineModulesto Babel presets and pluginsX-link: react/react-native#59831
Test Plan:
New unit test for
supportsInlineModules, which fails fortrueandfalsewithout 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