Inline source map loading fails when data uri contains comma
I’m using Dart Sass cli to generate CSS with embeded sourcemap. The resulting sourcemap is percent-encoded with encodeURI, not encodeURIComponent and thus contains commas.
Because of this, the stripComment function fails by returning only the last segment of text after the last comma, which breaks sourcemap integrity and is not valid JSON.
I briefly search the source map spec to see if maybe it was a non-compliance on Dart Sass side, but I couldn’t found a clear answer:
Source maps are linked through URLs as defined in WHATWG URL; in particular, characters outside the set permitted to appear in URIs shall be percent-encoded and it may be a data URI. Using a data URI along with sourcesContent allows for a completely self-contained source map. source
And according to Wikipedia, it seams that commas are allowed in clear:
data:text/plain;charset=UTF-8;page=21,the%20data:1234,5678
A simple change in stripComment would allow to drop content up to the first comma only, and return the rest.
I’ll submit a pull request with that change, and corresponding tests, in case it is acceptable for you. But I’d be glad to have your opinion on this.