make the SourceMap node validation more precise and possibly slightly more performant; related to #385 #396
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.
make the SourceMap node validation more precise and possibly slightly more performant: check for the okay/good cases before checking the various error situations. Hence the first error check (with its extensive report message) has been moved down. The check has been duplicated for the 'generated' section of the mapping as that's another potential user app programmer error source.
The diff is a little large because I turned on
prettier
for all my branches for easier merging/diffing (once one has moved to aprettier
-formatted codebase).Extracted from SHA-1: 151593b * stricter validation for source and generated line/column: when they exist, they MUST be numbers. Related to #385 (which is not fixed by this, mind you). For this patch I choose to stick with the exception being thrown as that better ensures code/mapping quality AFAIAC.
As all error validation checks are now in a single spot and within a single conditional chunk, source-map can choose to resolve by, for example, providing a source-map option which enables/disables these checks.