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

fix: Escape reserved JSON characters before bundling into JS file #84

Merged
merged 4 commits into from
Dec 29, 2022
Merged

fix: Escape reserved JSON characters before bundling into JS file #84

merged 4 commits into from
Dec 29, 2022

Conversation

kamilogorek
Copy link
Contributor

Fixes denoland/deno#14012 and removes unnecessary line-ending from the processed output, as before the trimming, it always ended up looking like this:

__default = JSON.parse(`{"foo": "bar"}
`);

Escaping is done using https://docs.rs/escape8259/ and verified correctness with the https://www.rfc-editor.org/rfc/rfc8259 itself. I didn't see a point vendoring such a small library, but if necessary, we can do that.

@CLAassistant
Copy link

CLAassistant commented Dec 22, 2022

CLA assistant check
All committers have signed the CLA.

@kamilogorek
Copy link
Contributor Author

cc @dsherret @bartlomieju

@kamilogorek
Copy link
Contributor Author

Can I ask for actions reapproval?

@bartlomieju
Copy link
Member

@kamilogorek done

@kamilogorek
Copy link
Contributor Author

Uh, did deno lint and deno fmt but forgot that it also consists of rust code and didn't run rust fmt 🙄

@kamilogorek
Copy link
Contributor Author

deno lint && deno fmt && deno test -A && cargo fmt && cargo test

Should be good now

@bartlomieju
Copy link
Member

@kamilogorek Windows CI is still not happy

@kamilogorek
Copy link
Contributor Author

kamilogorek commented Dec 29, 2022

Updated. I didnt pull EOL from deno_std/fs nor use isWindows from deno_std/_util/os as it's a simple oneliner, and for pulling whole dep for one tests sounds redundant.
We also need Raw.string anyway, so deno_std/fs/EOL couldn't be used directly.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for looking into this Kamil!

@bartlomieju bartlomieju merged commit 0b818cc into denoland:main Dec 29, 2022
@kamilogorek kamilogorek deleted the json-bundling-escaping branch December 29, 2022 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants