davesnx / styled-ppx

Type-safe styled components for ReScript, Melange and native with type-safe CSS
https://styled-ppx.vercel.app
BSD 2-Clause "Simplified" License
399 stars 32 forks source link

Bug with rescript compilation #397

Closed ashton closed 7 months ago

ashton commented 8 months ago

Hey! I've installed "@davesnx/styled-ppx": "^0.50.0", and when trying to run my project using rescript (10.1.4) with rescript-react (0.11.0), it shows the following error image

It seems that the compilation of this line is generating triple quotes and thus, an invalid syntax in the .bs.js file. Cursor_and_less

lubegasimon commented 8 months ago

In the meantime, those can be fixed by manually escaping the quotes

ashton commented 8 months ago

Which quotes exactly? (version 0.40.1 is working perfectly)

lubegasimon commented 8 months ago

Which quotes exactly?

For example; case """ : to case "\"":

lubegasimon commented 8 months ago

(version 0.40.1 is working perfectly)

We shall investigate and fix what could be causing the regression. Thanks for the report

ashton commented 8 months ago

For example; case """: to case "\"":

but those are generated files, everytime I run a npm install this would be overwritten

ashton commented 8 months ago

Also, not sure if it's related, but the PPX itself is not being recognized by rescript: image

@lubegasimon Do you want me to open another issue?

lubegasimon commented 8 months ago

Also, not sure if it's related, but the PPX itself is not being recognized by rescript: image

@lubegasimon Do you want me to open another issue?

Yes, though it seems something is missing out during the installation. Does this -- https://styled-ppx.vercel.app/getting-started guide help?

ashton commented 8 months ago

I think I followed what the getting started said, not sure if something is off because is not a new installation but an upgrade:

image

lubegasimon commented 8 months ago

It seems that the compilation of this line is generating triple quotes and thus, an invalid syntax in the .bs.js file

No, one occurrence is at https://github.com/davesnx/styled-ppx/blob/b06c03a8af9c6976cd1c653e9d96dfaad6d0e976/packages/css/native/shared/Css_AtomicTypes.ml#L2281

davesnx commented 8 months ago

I believe the issue has been fixed in main, but didn't release a npm package yet. Let me try to reproduce and double-check ReScript and release a 0.51

davesnx commented 7 months ago

Updated the https://github.com/davesnx/try-styled-ppx repository with ReScript 10 and styled-ppx 0.53 working nicely