@Singtaa: Please consider leaving a review on the Asset Store if you enjoy using OneJS. It really helps us a lot! And, I promise it'll take less time than debugging your last script.😊 Oh also, OneJS V2 is now out of preview!
VERSION
Doc Menu

New in V2

Puerts

OneJS V2 has changed from using Jint to Puerts. Jint is a pure .Net JS interpreter so it has great interop ergonomics (i.e. it's one of the few interpreters that supports operator overloading) and a small build size (~8MB). Downside of Jint is the slow interop performance, especially when it comes to dealing with deep recursive functions (like the diff functions in Preact).

Puerts provides 3 native backends (QuickJS, V8, and NodeJS) and is much more performant than Jint (roughly 20x to 100x). Its static wrappers and blittable optimizations can also eliminate GC allocations during interop. Having 3 backends to choose from is also nice. Use QuickJS for its small build size (~20MB). Use V8 for raw speed. Use NodeJS for stuff like node modules and WebAssembly.

(Use npm run switch to quickly change the backend. Just make sure the Unity editor is closed before doing so.)

ESBuild

OneJS V2 now uses an ESBuild workflow, bundling everything into a single file for easier deployment. It automatically handles node modules and has experimental Custom Editor/Inspector support.

ScriptEngine

Due to the switching to Puerts, some of the interop settings for ScriptEngine has changed. You can directly expose Unity/.Net objects as global variables. It's similar to the old way except you don't need to require() anymore on the JS side. You can just access the global name directly.

Type definition conversion has been removed because Puerts does .d.ts generation automatically. OneJS provides some helper methods for this via the DTSGen class.