-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix(cli): Don't strip shebangs from modules #13220
fix(cli): Don't strip shebangs from modules #13220
Conversation
Deno's module loader currently strips a shebang if a module file starts with one. However, this is no longer necessary, since there is a stage-3 TC39 that adds support for shebangs (or "hashbangs") to the language (https://github.com/tc39/proposal-hashbang), and V8, `tsc` and `swc` all support it. Furthermore, stripping shebangs causes a correctness bug with JSON modules, since a JSON file with a shebang should not parse as a JSON module, yet it does with this stripping. This change fixes this. Closes denoland#13129.
For the record: this change affects the output of |
I think this change is desirable, but it will most likely break cached sources once released. We need to be extra careful not to repeat situation in 1.16 when users had to use @kitsonk WDYT? |
I'm not too sure how the cache works, but it seems like the worst case scenario would be errors being off by one line, right? |
Not necessarily, I think in the CDP inspector a file might not load at all if source map is broken. |
@kitsonk do you have any objections to landing this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, let's land it and keep an eye out on any failures in canary.
Deno's module loader currently strips a shebang if a module file starts with one. However, this is no longer necessary, since there is a stage-3 TC39 that adds support for shebangs (or "hashbangs") to the language, and V8,
tsc
andswc
all support it.Furthermore, stripping shebangs causes a correctness bug with JSON modules, since a JSON file with a shebang should not parse as a JSON module, yet it does with this stripping. This change fixes this.
Closes #13129.