Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lines resolved to wrong file silently #9

Open
corvidism opened this issue Mar 25, 2022 · 1 comment
Open

Lines resolved to wrong file silently #9

corvidism opened this issue Mar 25, 2022 · 1 comment

Comments

@corvidism
Copy link

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...)

@corvidism
Copy link
Author

I dove into the code and unfortunately, I think the resolution failure itself is caused by this bug in source-map: mozilla/source-map#261 Which looks a bit abandoned, sigh.

Still, it would be nice if this module could at least signal that this error happened. Maybe use the error key?

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

No branches or pull requests

1 participant