5.0
Rewrite Optimizing Template Compiler
Since TypeScript compiler project is moving away from javascript and switching to Go, in the near future it will be necessary to move away from typescript compiler as a parsing/semantic analysis library.
I am planning to rewrite it in Rust with oxc library and package it as native binaries (~1.5Mb). It will be implemented as a simple module transformer that can run in parallel and just transforms templates without any hoisting/dedupe optimizations. All such optimizations are already implemented in the oveo javascript optimizer.
- Automatic hoisting heuristics will be much more conservative, it will bailout if there is a conditional on the hoisting path.
- ~String (attribute/event names) deduplication algorithm won't be able to sort strings.~
Basic Template Compiler that doesn't require any precompilation won't change.
Rename useLayoutEffect()
To avoid confusion with React semantics, useLayoutEffect() will be renamed to useAnimationFrameEffect().
Node.prototype.moveBefore()
Displaced nodes will be moved with moveBefore() method in browsers that support this method.
@localvoid does this mean near-instant compiles?
Yes, it will be way much faster. And it will be able to run in multiple threads (it is the main reason why deduplicated strings will be unsorted).
EDIT: Forgot that right now string opcodes are updated during chunk transformation and strings are sorted when the first renderChunk() hook is invoked, so it is still possible to parallelize and keep sorted strings.
Sorted strings are important for reproducible builds.
void elements still supported in templates?
https://github.com/localvoid/ivi/commit/8c9a4d865a745b03fb02771971fa2d2b6374d6e3
🤔
Just want to simplify parser, since it already supports <div/> syntax with any elements. It only affects parsing, when static template is generated, void elements are converted to <input>. But I can bring it back.
please bring it back, since it's valid html :)
Brought back void elements parsing. Hope that there won't be any necessary changes in the foreseeable future :)
Since oxc is still in development and regularly updated, I am going to publish @ivi/compiler with updated oxc library each monday.
thanks! will try v5 in the next few days.
tried it, no surprises yet :)
can probably close issue.