raw
current commit
230502.5 · doc: create maintaining folder for deps

Maintaining Single Executable Applications support

Support for single executable applicationsgithub is one of the key technical priorities identified for the success of Node.js.

High level strategy

From the Next-10 discussionsgithub there are 2 approaches the project believes are important to support:

Compile with Node.js into executable

This is the approach followed by boxednodegithub.

No additional code within the Node.js project is needed to support the option of compiling a bundled application along with Node.js into a single executable application.

Bundle into existing Node.js executable

This is the approach followed by pkggithub.

The project does not plan to provide the complete solution but instead the key elements which are required in the Node.js executable in order to enable bundling with the pre-built Node.js binaries. This includes:

It is left up to external tools/solutions to:

However, the project also maintains a separate tool, postjectgithub, for injecting arbitrary read-only resources into the binary such as those needed for bundling the application into the runtime.

Planning

Planning for this feature takes place in the single-executable repositorygithub.

Upcoming features

Currently, only running a single embedded CommonJS file is supported but support for the following features are in the list of work we’d like to get to:

Disabling single executable application support

To disable single executable application support, build Node.js with the --disable-single-executable-application configuration option.

Implementation

When built with single executable application support, the Node.js process uses postject-api.hgithub to check if the NODE_SEA_BLOB section exists in the binary. If it is found, it passes the buffer to single_executable_application.jsgithub, which executes the contents of the embedded script.