-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
src: add initial support for single executable applications #45038
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
src: add initial support for single executable applications #45038
Conversation
|
Review requested:
|
Refs: nodejs/node#45038 Signed-off-by: Darshan Sen <[email protected]>
|
@RaisinTen Don't forget to list this PR in https://github.com/nodejs/single-executable's README, for the record :) |
|
Question: does the executable require node to be installed? |
|
Adding |
|
Please make it print the experimental warning if that isn’t happening already. |
Fixes the following error I came across while integrating Postject in
Node.js:
```console
../deps/postject/src/dist/postject-api.h:30:13: error: unused function 'postject_options_init' [-Werror,-Wunused-function]
static void postject_options_init(struct postject_options* options) {
^
1 error generated.
```
Refs: nodejs/node#45038
Signed-off-by: Darshan Sen <[email protected]>
|
Is it just me or the |
|
Off-topic: Having the source of |
ovflowd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super cool stuff! Super mega hyper excited for this!
@kapv89 no it does not. That's one of the main use cases for the single executables applications - so that it is possible to distribute a Node.js application to a user who does not already have Node.js installed on their system. |
@ovflowd it is the compiled version :) |
Do we need the compiled version? As |
|
@ovflowd as mentioned in #45066 (comment), that is the webassembly code which is precompiled in postject. It's built using the emsdk, not node-gyp. |
|
@danielleadams done - #47495! |
|
@RaisinTen If you have some time, would you mind putting together a small summary for the v18.16.0 release notes? Thanks! |
|
@danielleadams sure! Does this work? Add initial support for single executable applications Compile a JavaScript file into a single executable application: $ echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js
$ cp $(command -v node) hello
# On systems other than macOS:
$ npx postject hello NODE_JS_CODE hello.js \
--sentinel-fuse NODE_JS_FUSE_fce680ab2cc467b6e072b8b5df1996b2
# On macOS:
$ npx postject hello NODE_JS_CODE hello.js \
--sentinel-fuse NODE_JS_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
--macho-segment-name NODE_JS
$ ./hello world
Hello, world!Contributed by Darshan Sen in #45038 |
|
@RaisinTen perfect - thanks! |
|
something wrong? CentOS 8 |
|
@waitingsong which version of Node.js are you using? Does running |
issue: nodejs/postject#83 EDIT: |
|
it give me error |
|
@RezaErfani67 could you create an issue in https://github.com/nodejs/single-executable/issues? |
Compile a JavaScript file into a single executable application:
Signed-off-by: Darshan Sen [email protected]
It was decided in the Node.js Collaborator Summit that we want to come up with an MVP that is capable of compiling a single JavaScript file into a single executable application. More features will be added incrementally.
Meeting notes for reference: https://github.com/nodejs/single-executable/blob/c7008ecd67a395c7c902d602f2f116e2c5744bc9/meetings/2022-10-01.md
cc @nodejs/single-executable