[oden] Explain myself.
This commit is contained in:
parent
c02eb25873
commit
eb9fed759a
1 changed files with 24 additions and 2 deletions
26
README.md
26
README.md
|
|
@ -26,8 +26,8 @@ I'm using QuickJS, lightly patched, with my own bindings.
|
|||
|
||||
#### QuickJS
|
||||
|
||||
The easy alternative to QuickJS is to use Deno Core, which binds V8.
|
||||
Unfortunately, Deno Core has kind of a wild architecture, where it goes through flatbuf for all its communications, and keeps the JavaScript engine at arm's length.
|
||||
The easy alternative to QuickJS is to use Deno Core, which binds V8.
|
||||
Unfortunately, Deno Core has kind of a wild architecture, where it goes through flatbuf for all its communications, and keeps the JavaScript engine at arm's length.
|
||||
It doesn't expose things like "make a new native class."
|
||||
And while it feels "possible" to use (see https://deno.com/blog/roll-your-own-javascript-runtime-pt2), it was not quite as easy to use for what I wanted to do as you might like.
|
||||
|
||||
|
|
@ -44,3 +44,25 @@ See above about being abandoned: we have small patches in place to e.g. expose i
|
|||
#### My Own Bindings
|
||||
|
||||
The other bindings are maddeningly incomplete, and don't expose features I want to expose out of QuickJS.
|
||||
|
||||
### TypeScript
|
||||
|
||||
I'm using `deno_ast` to parse typescript at load time and "transpile" to javascript before loading.
|
||||
`deno_ast` is built on swc, which I really really don't like very much, but my other options are:
|
||||
|
||||
1. Actually use the typescript compiler.
|
||||
This is a neat idea but involves loading the compiler into QuickJS (which requires some patches to tsc since qjs is not node).
|
||||
Also the typescript compiler is SLOW (especially when run in QJS) and finicky.
|
||||
But this would be a full-fidelity option for sure.
|
||||
|
||||
2. Use tree-sitter to parse the typescript and strip the types out myself.
|
||||
The tree-sitter parser is fast and gives me everything with full fidelity.
|
||||
This *also* has the nice side-effect of letting me edit the source file in place, so source maps aren't a problem.
|
||||
The downside is that finding every part of TS that has to be cut out to make JS is time consuming and error prone and I don't want to do it, particularly.
|
||||
|
||||
3. Parse Typescript myself.
|
||||
I can write a parser, sure, doesn't bother me, but the syntax for typescript is not formally documented anywhere.
|
||||
And it has the same problem as #2 when it comes time to emit JS.
|
||||
|
||||
So for now, I stick with `deno_ast`.
|
||||
It does what I need it to do.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue