nearprotocol / assemblyscript

A TypeScript to WebAssembly compiler 🚀
https://assemblyscript.org
Apache License 2.0
8 stars 1 forks source link

Rework Near Bindings Compile in One Pass #40

Closed willemneal closed 5 years ago

willemneal commented 5 years ago

This uses the complier's current transform pass to instrument files that begin with//@nearfile. After transforming the files they are re-parsed and any new imports are read in using the new package resolution feature.

This means that this code could be moved to another repo and this branch would remain a mirror of the upstream.

Also by habit I haven't added the new dist files. So if you want to test out this branch just use the near_dist branch.

The example line to compile the test file is

asc test.ts --transform ./dist/index.js --runtime stub --binaryFile test.wasm --textFile test.wat --validate.

So far it passes the test.js provided already, but still needs some more robust testing.

vgrichina commented 5 years ago

@willemneal meta: can you create separate PR for unrelated assemblyscript changes and rebase on top of it (unless requires too much time)? Otherwise it's somewhat hard to see what are the relevant changes to be reviewed (vs unrelated assemblyscript changes).

willemneal commented 5 years ago

Yeah I'll make one now. The goal here was to try to change the internals as little as possible and in fact since I moved away from relying on the packaged compiler and instead just the parts I needed we don't even need to wait for my PR on upstream for fixing assemblyscript.d.ts.