Skip to content

fix(sourcemap): start ranges after leading newlines - #390

Open
mayankdhingra02 wants to merge 1 commit into
Rich-Harris:masterfrom
mayankdhingra02:codex/map-newline-start-ranges
Open

mayankdhingra02 wants to merge 1 commit into
Rich-Harris:masterfrom
mayankdhingra02:codex/map-newline-start-ranges

Conversation

@mayankdhingra02

Copy link
Copy Markdown

hires: 'experimental-range' loses its starting mapping when an unedited chunk begins with a newline. Replacing aa with x in aa\nbb, for example, leaves the first b unmapped.

Start the range at the chunk’s first non-newline character, after advancing the source and generated locations. The range still spans subsequent newlines. Regression tests cover the reported edit, consecutive leading newlines with an intro, and bundled sources, checking both decoded and encoded maps.

Closes #389.

Validation: pnpm test (497 tests on Node 22.23.5, 24.22.2 and 26.13.0), pnpm run lint, and pnpm run typecheck. The build and publint checks also pass. Tests ran on macOS; the Linux and Windows matrix is left to CI.

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.

hires: "experimental-range" omits mappings when an unchanged chunk starts with a newline

1 participant