Repository navigation
Conversation
Currently, a bundle requested with `inlineSourceMap=true&excludeSource=true` still embeds `sourcesContent` in its inline source map, because `getAppendScripts` hard-codes `excludeSource: false`. This change is two parts: - Allow a custom serialiser to respect this option by threading `excludeSource` into `SerializerOptions`. - Fix the inline map in the default `baseJSBundle` serialiser. Categorising this as a fix because we weren't respecting the caller's request previously. `excludeSource` defaults to `false`, so bundles that don't set it are unchanged. Metro's `.map` endpoint, and the separate `map` returned by `Server.build()`, already respected the option. Changelog: [Fix] Respect `excludeSource` in inline source maps, and pass it to `serializer.customSerializer` Test plan: New unit tests for `baseJSBundle` and `Server` (bundle requests and `build()`). The `excludeSource=true` and custom serializer cases fail without the change. E2E: ran `Metro.runServer` on the integration test fixture and requested `TestBundle.bundle?platform=ios&dev=true&inlineSourceMap=true`, then decoded the inline map: | Query | Before | After | |---|---|---| | (none) | 8 of 9 sections with `sourcesContent`, 124,942 bytes | Unchanged, 124,942 bytes | | `&excludeSource=true` | 8 of 9 sections with `sourcesContent`, 124,961 bytes | 0 of 9, 71,461 bytes |
Metro review: Looks goodRisk: low · Commit: The PR adds No findings. Verified
Not run: I didn't re-run the E2E numbers from the description (inline map size on the integration fixture). The unit tests cover the same behavior. I skipped benchmarks because the change only forwards an existing option to the source map serializer, and leaving out Automated review by Claude. Advisory only: it never approves or blocks, and a maintainer makes the call. |
Currently, a bundle requested with
inlineSourceMap=true&excludeSource=truestill embedssourcesContentin its inline source map, becausegetAppendScriptshard-codesexcludeSource: false.This change is two parts:
excludeSourceintoSerializerOptions.baseJSBundleserialiser.Categorising this as a fix because we weren't respecting the caller's request previously.
excludeSourcedefaults tofalse, so bundles that don't set it are unchanged.Metro's
.mapendpoint, and the separatemapreturned byServer.build(), already respected the option.Changelog: [Fix] Respect
excludeSourcein inline source maps, and pass it toserializer.customSerializerTest plan:
New unit tests for
baseJSBundleandServer(bundle requests andbuild()). TheexcludeSource=trueand custom serializer cases fail without the change.E2E: ran
Metro.runServeron the integration test fixture and requestedTestBundle.bundle?platform=ios&dev=true&inlineSourceMap=true, then decoded the inline map:sourcesContent, 124,942 bytes&excludeSource=truesourcesContent, 124,961 bytes