Skip to content

Deduplicate resolved sources when flattening indexed maps - #57

Open
mayankdhingra02 wants to merge 1 commit into
jridgewell:mainfrom
mayankdhingra02:fix-flattened-source-identities
Open

mayankdhingra02 wants to merge 1 commit into
jridgewell:mainfrom
mayankdhingra02:fix-flattened-source-identities

Conversation

@mayankdhingra02

Copy link
Copy Markdown

Flattened sections currently append duplicate source entries. A reverse lookup for a source shared by two sections then sees only the first section's mappings. For example, two sections mapping to original.js:1:0 return only the first generated position.

Assign one index per resolved source URL and remap each section's segments and ignored-source indices to that index. Preserve first-seen source content, names, section clipping and range markers. Sources that resolve to different URLs remain separate.

Fixes #53.

Tested:

  • Full workspace build and tests on Node 20.20.2 and 26.12.1: 485 tests pass and one existing pending test per runtime, including ESLint, formatting and type builds.
  • Five new regressions fail on the original source; all six new tests pass with the fix.
  • Packed CommonJS and ESM consumer checks pass on both runtimes.

Use resolved source URLs to share indices across indexed-map sections.
Remap segments and ignored sources so reverse lookups include every
section while retaining first-seen content and existing name offsets.

Fixes jridgewell#53.

Signed-off-by: Mayank Dhingra <mayankdhingra02@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop using append() in FlattenMap

1 participant