Rich-Harris / sorcery

Resolve a chain of sourcemaps back to the original source, like magic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sourceMappingURL can contain whitespace characters

MartinKolarik opened this issue · comments

I've just got a weird ENOENT error while trying to build Ractive, and after a while I was able to track it down to this line.

Ah, whoops. Thanks for tracking it down. I suspect whitespace characters are supposed to be %-encoded by the time they're used as a sourceMappingURL, probably something else I need to fix. In the meantime though, changing it to match = /^[^\n]+/.exec( substring ) ought to do the trick - does that sound about right?

I suspect whitespace characters are supposed to be %-encoded by the time they're used as a sourceMappingURL

Ah, yes, they are. In that case it's probably esperanto that needs fixing.

In the meantime though, changing it to match = /^[^\n]+/.exec( substring ) ought to do the trick - does that sound about right?

I think that would fail with CRLF endings. Probably an edge case, but changing it to /^[^\r\n]+/ is easy enough.

I think that would fail with CRLF endings

Good catch. Have released this as 0.4.0, and opened a corresponding issue on esperanto