Skip to content

Lines resolved to wrong file silently #9

@corvidism

Description

@corvidism

Hi, I ran into a possible bug: when I try to resolve a position in a file that isn't covered by an inline source map mapping, the .resolve() method returns an object which points to the file itself instead of its source, and doesn't signal this "resolution failure" in any way.

I forked the repo and wrote some (failing) tests that demonstrate the problem: https://github.com/corvidism/get-source/pull/1/files

The TMP tests show this on a file where I discovered it. It's compiled from typescript, and it looks like the typescript compiler doesn't include the leading spaces in the mappings => when I try to resolve a line from column=1 (I don't have the column number), the resolution fails.

Obviously, the ideal would be if it resolved, but it should at least warn that the resolution failed. As it is, there's no way to detect it. (That, and perhaps the sourceFile could be set anyway? I mean, the filename is there, even if the mapping failed...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions