-
Notifications
You must be signed in to change notification settings - Fork 361
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
toStringWithSourceMap
behaves incorrectly if SourceNode
s source is null
or is an empty string
#444
Comments
I think we've gotten around this effectively with documentation, but perhaps I don't understand adequately. Is it still an issue going forward? |
At least, an error should be thrown in the |
(sorry, just noticed which repo this was on. I agree with Mingun that this is still an issue) |
It isn't crystal clear what would be the expectation when passing a null source. We might convert any falsy Today when passing null, we generate:
v3 specification isn't saying much about the expected content of |
From consistency point of view I think that {version: 3, sources: [null], names: [], mappings: "MAAA,I"} would the best solution for {version: 3, sources: [""], names: [], mappings: "MAAA,I"} would the best solution for |
Would you have an example of a real usecase so that I can better understand what it means IRL to have null or empty named sources? |
No. I found this issue when I write tests for peggy in peggyjs/peggy#163. I don't think, that using As I said early, I will be satisfied with support in some form, that will provide consistent behavior, or throwing out an exception from |
When
source
set tonull
, mapping does not generated.When
source
set to empty string there is an error during mapping calculation (not duringSourceNode
creation as expected if empty string is forbidden).This code snippet demonstrates both problems: https://runkit.com/embed/47lduu6k2173
Source code of the snippet:
The text was updated successfully, but these errors were encountered: