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

feat: support precompiled JSX transform #4177

Merged
merged 5 commits into from
Nov 7, 2023
Merged

feat: support precompiled JSX transform #4177

merged 5 commits into from
Nov 7, 2023

Conversation

marvinhagemeister
Copy link
Member

@marvinhagemeister marvinhagemeister commented Oct 30, 2023

This PR adds support for the new precompile JSX transform that will ship with the next deno version. The new deno version will come out this week.

The idea behind the precompile JSX transform is that instead of allocating a full vnode object + props for every element, we precompile HTML nodes during the JSX transpilation step to strings. During rendering we then need to mostly only concatenate strings together.

Demo: https://github.com/marvinhagemeister/deno-jsx-precompile-preact-demo

See preactjs/preact-render-to-string#322 .

@github-actions
Copy link

github-actions bot commented Oct 30, 2023

Size Change: +1.8 kB (3%)

Total Size: 59.2 kB

Filename Size Change
jsx-runtime/dist/jsxRuntime.js 963 B +598 B (62%) 🆘
jsx-runtime/dist/jsxRuntime.module.js 938 B +607 B (64%) 🆘
jsx-runtime/dist/jsxRuntime.umd.js 1.04 kB +598 B (57%) 🆘
ℹ️ View Unchanged
Filename Size Change
compat/dist/compat.js 3.97 kB 0 B
compat/dist/compat.module.js 3.9 kB 0 B
compat/dist/compat.umd.js 4.04 kB 0 B
debug/dist/debug.js 3.52 kB 0 B
debug/dist/debug.module.js 3.52 kB 0 B
debug/dist/debug.umd.js 3.6 kB 0 B
devtools/dist/devtools.js 232 B 0 B
devtools/dist/devtools.module.js 240 B 0 B
devtools/dist/devtools.umd.js 315 B 0 B
dist/preact.js 4.42 kB 0 B
dist/preact.min.js 4.46 kB 0 B
dist/preact.min.module.js 4.45 kB 0 B
dist/preact.min.umd.js 4.48 kB 0 B
dist/preact.module.js 4.45 kB 0 B
dist/preact.umd.js 4.49 kB 0 B
hooks/dist/hooks.js 1.53 kB 0 B
hooks/dist/hooks.module.js 1.56 kB 0 B
hooks/dist/hooks.umd.js 1.62 kB 0 B
test-utils/dist/testUtils.js 453 B 0 B
test-utils/dist/testUtils.module.js 454 B 0 B
test-utils/dist/testUtils.umd.js 536 B 0 B

compressed-size-action

@coveralls
Copy link

coveralls commented Oct 30, 2023

Coverage Status

coverage: 99.464% (+0.04%) from 99.429%
when pulling 975779a on jsxssr
into 046af87 on main.

const ENCODED_ENTITIES = /["&<]/;

/** @param {string} str */
export function encodeEntities(str) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

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

I am so excited for this!

Copy link
Member

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

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

Should tree-shake out so I am okay with the increase in total size for the ssr perf gains

@marvinhagemeister marvinhagemeister merged commit 99709ae into main Nov 7, 2023
2 checks passed
@marvinhagemeister marvinhagemeister deleted the jsxssr branch November 7, 2023 14:23
@JoviDeCroock JoviDeCroock mentioned this pull request Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants