Skip to content

Add JS serialization#177

Merged
craquet merged 54 commits intodevelopmentfrom
js-serialization
Apr 2, 2026
Merged

Add JS serialization#177
craquet merged 54 commits intodevelopmentfrom
js-serialization

Conversation

@Pfeil
Copy link
Copy Markdown
Member

@Pfeil Pfeil commented Feb 13, 2026

  • Provide basic JS generator and boilerplate with roughly correct code, sharing most logic with the other generators
  • JS generator needs flag: traces yes/no
  • Translate TS boilerplate to JS at build time
  • Add ability to fetch and add boilerplate to JS generator
  • JS Zip Download contains one file including boilerplate
  • Proper sandbox execution trigger in UI
  • Make sure the Sandbox retrieves the code including boilerplate
  • Check if the syntax is fully valid
  • make jsonpath functionality available in boilerplate
  • jsonpointer functionality available in boilerplate
  • Make it run through completely / successfully
  • Consider a way to add jsonpointer.js and jsonpath.js ESM modules via package.json instead of having them in the repo directly
  • fix: Download button with JS packages code missing the boilerplate

@craquet
Copy link
Copy Markdown
Member

craquet commented Feb 23, 2026

I was able to find out already that the UI hanging was not your fault at all, everything looks good in that regard. Its actually the creation of a new Context in quickjs that hangs the UI for about 5 seconds every time. If we dont use the context, then there is no hang. I will look into it more

@craquet
Copy link
Copy Markdown
Member

craquet commented Feb 23, 2026

The research concludes:

  • Importing the async QuickJS runtime takes the 5 seconds that hang the UI
  • It makes no sense for us to use the async runtime, as it does not have to interact with async host code
  • WASM code runs in the main thread, always blocking the UI no matter if we use the async runtime or not

Solution: Use the normal QuickJS WASM runtime in a Web Worker (which runs in a separate thread)

Luckily, I have plenty of experience with web workers from NovaCrate, so I'll try to quickly take care of it

@Pfeil Pfeil force-pushed the js-serialization branch from 76222b6 to 04a35b1 Compare March 31, 2026 12:19
@Pfeil
Copy link
Copy Markdown
Member Author

Pfeil commented Mar 31, 2026

fixed. On my way to finalize things.

@Pfeil Pfeil marked this pull request as ready for review March 31, 2026 13:54
@Pfeil
Copy link
Copy Markdown
Member Author

Pfeil commented Mar 31, 2026

Notes:

  • The button to run the code is still included. I think it might be useful for development as we do not yet have a gui yet.
  • It will always run the JS code. I assume we'll remove this button anyway as soon as we have a GUI, and it does not make any sense for python.

@Pfeil Pfeil force-pushed the js-serialization branch from ce127ca to a3a61a8 Compare March 31, 2026 14:42
@Pfeil Pfeil requested a review from craquet March 31, 2026 14:44
Copy link
Copy Markdown
Member

@craquet craquet left a comment

Choose a reason for hiding this comment

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

Did not do a thorough review yet, but I noticed that the trace seems to break at least if-else blocks and functions with returns. We have to check if we can find a stable ignore list to ignore these edge cases or if we should take a different approach to tracing.

Maybe we could also leave the tracing out alltogether for this PR, as it is not central to the purpose of this PR and we have to get done until the conference :D

@Pfeil
Copy link
Copy Markdown
Member Author

Pfeil commented Apr 1, 2026

  • trace: Will give it another try. The trace functionality can be deactivated with a flag internally if we want to.

@Pfeil
Copy link
Copy Markdown
Member Author

Pfeil commented Apr 1, 2026

I think I improved the blacklisting in tracing properly now. But I also disabled it (see commit b16bb90) for now.

@Pfeil Pfeil requested a review from craquet April 1, 2026 13:12
@Pfeil Pfeil self-assigned this Apr 1, 2026
@craquet
Copy link
Copy Markdown
Member

craquet commented Apr 2, 2026

I only noticed that the otherwise blocks conditionals were flipped (returning otherwise even if either is truthy). Fixed that already. Everything else looks good

@craquet craquet merged commit 4256114 into development Apr 2, 2026
@craquet craquet deleted the js-serialization branch April 2, 2026 08:19
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.

2 participants