Skip to content

feature: ink -compile #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks
thesephist opened this issue Feb 2, 2021 · 1 comment
Open
2 tasks

feature: ink -compile #6

thesephist opened this issue Feb 2, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@thesephist
Copy link
Owner

thesephist commented Feb 2, 2021

Modeled after deno compile, it would be cool to be able to "compile" an Ink project into a single executable. Deno achieves this by producing binary of the form:

original deno binary + bundled JavaScript string + magic number (0xD3N0) + uint64 pointer to start of JS

We can do something very similar. To do this, we first need to write an Ink bundler that can compile Ink projects into a single Ink source file, or a "bundle" file.

There's no great reason why this feature has to be a part of the Ink project per se, as opposed to a separate project that does both the compile and bundle tasks.

  • Ink bundler
  • ink -compile
@thesephist thesephist added the enhancement New feature or request label Feb 2, 2021
@thesephist
Copy link
Owner Author

It's been a little over a year since, and there's now a precedence for this feature in another project of mine! It's called oak pack (named "pack" instead of "compile" to avoid confusion with the "build" command that does bundling and compilation to JavaScript).

oak pack works almost exactly as I've described it above, by appending a bundle file and signature bytes to the end of an executable. The bundler works through AST transformations in a way similar to the September project's compilation pipeline, so it would make sense to leverage the September toolchain for an "ink compile" feature as well. i.e. instead of september translate, a september pack or something.

Since Ink and Oak's module semantics are very nearly identical, I think an ink compile implementation can be almost a straight port of oak pack and associated dependencies. I don't write much Ink these days, but if I find a free few days I may hack on September again to add this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant