seek-oss / playroom

Design with JSX, powered by your own component library.
MIT License
4.48k stars 182 forks source link

Use smaller React pragmas to minimise the amount of data passed between iframes #304

Closed mrm007 closed 10 months ago

mrm007 commented 10 months ago

Fixes #297.

Happy to bikeshed the names R_F and R_cE because they might clash with other global identifiers that were provided via the scope option. The shortened pragma names should not contain any characters that need to be encoded, so only use characters from this list (while still being valid JavaScript identifier names):

A–Z a–z 0–9 - _ . ! ~ * ' ( )
changeset-bot[bot] commented 10 months ago

🦋 Changeset detected

Latest commit: 286e42c2a9dd39b96a734a10031d75994e527736

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | -------- | ----- | | playroom | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

askoufis commented 10 months ago

Also needs a changeset.

mrm007 commented 10 months ago

Seems somewhere inbetween the responsiveness of the pre-sucrase version and current playroom master.

That is to be expected, since we are running the Babel transform just for validation and Sucrase transform for the actual compilation. Ideally we would just parse, not transform.

https://github.com/seek-oss/playroom/compare/8b91070cd49f13f7c4d1574784ae9863d244fcf8...smaller-react-pragmas

I'll run some tests with Braid.

askoufis commented 10 months ago

Tested the latest commit's snapshot in a large braid playroom, and it feels just as good as the sucrase-only version, maybe even slightly better. 👏

braid.playrooom-react-pragmas-NEW.URL.txt