Repository navigation
fix(consumer): preserve empty indexed source content - #547
Open
Hanabi9248 wants to merge 1 commit into
Open
Hanabi9248 wants to merge 1 commit into
Hanabi9248 wants to merge 1 commit into
Conversation
Treat empty source text as present while preserving missing-source behavior. Cover real indexed consumers and generator conversion, including nested sections. Signed-off-by: Hanabi <317387557+Hanabi9248@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #420.
An indexed source map containing
sourcesContent: ["a\nb\nc\n", ""]treats the second source as absent:sourceContentFor()discards the valid empty string and either throws or returns null.SourceMapGenerator.fromSourceMap()consequently throws instead of preserving the empty file.Accept content when it is non-null rather than truthy in
IndexedSourceMapConsumer.sourceContentFor. Keep searching sections for null/undefined and retain the existing unknown-source exception/nullOnMissing behavior. No generator or missing-content policy changes are needed.Validation on exact master
8c668f3dd3916e96d06131dec97c78a3e62bd0f3, Node.js v24.19.0:7fc7d86ea2eeaa49762fc0dbbd1c3086c0447ee3are bound to this base; no fake consumers, private-field replacement or WASM stubs.Browser integration, other Node.js versions and the full repository suite were not run; no dependencies or toolchains were installed. The nullOnMissing policy changes proposed in #391 are outside this fix.
AI assistance was used for investigation, implementation and validation.