2023-02-18 03:49:18 +01:00
|
|
|
# Single executable applications
|
|
|
|
|
2023-02-20 20:31:58 +01:00
|
|
|
<!--introduced_in=v19.7.0-->
|
2023-02-18 03:49:18 +01:00
|
|
|
|
2023-05-25 17:54:46 +02:00
|
|
|
<!-- YAML
|
|
|
|
added:
|
|
|
|
- v19.7.0
|
|
|
|
- v18.16.0
|
2023-07-21 00:57:00 +02:00
|
|
|
changes:
|
2023-08-15 20:09:46 +02:00
|
|
|
- version: v20.6.0
|
2023-07-21 00:57:00 +02:00
|
|
|
pr-url: https://github.com/nodejs/node/pull/46824
|
|
|
|
description: Added support for "useSnapshot".
|
2023-08-15 20:09:46 +02:00
|
|
|
- version: v20.6.0
|
2023-07-26 12:10:35 +02:00
|
|
|
pr-url: https://github.com/nodejs/node/pull/48191
|
|
|
|
description: Added support for "useCodeCache".
|
2023-05-25 17:54:46 +02:00
|
|
|
-->
|
|
|
|
|
2024-02-17 19:03:26 +01:00
|
|
|
> Stability: 1.1 - Active development
|
2023-02-18 03:49:18 +01:00
|
|
|
|
2023-05-21 20:10:07 +02:00
|
|
|
<!-- source_link=src/node_sea.cc -->
|
2023-02-18 03:49:18 +01:00
|
|
|
|
|
|
|
This feature allows the distribution of a Node.js application conveniently to a
|
|
|
|
system that does not have Node.js installed.
|
|
|
|
|
|
|
|
Node.js supports the creation of [single executable applications][] by allowing
|
2023-04-09 20:31:15 +02:00
|
|
|
the injection of a blob prepared by Node.js, which can contain a bundled script,
|
|
|
|
into the `node` binary. During start up, the program checks if anything has been
|
|
|
|
injected. If the blob is found, it executes the script in the blob. Otherwise
|
|
|
|
Node.js operates as it normally does.
|
2023-02-18 03:49:18 +01:00
|
|
|
|
2023-04-09 20:31:15 +02:00
|
|
|
The single executable application feature currently only supports running a
|
|
|
|
single embedded script using the [CommonJS][] module system.
|
2023-02-18 03:49:18 +01:00
|
|
|
|
2023-04-09 20:31:15 +02:00
|
|
|
Users can create a single executable application from their bundled script
|
|
|
|
with the `node` binary itself and any tool which can inject resources into the
|
|
|
|
binary.
|
2023-02-18 03:49:18 +01:00
|
|
|
|
|
|
|
Here are the steps for creating a single executable application using one such
|
|
|
|
tool, [postject][]:
|
|
|
|
|
|
|
|
1. Create a JavaScript file:
|
2023-05-20 00:14:03 +02:00
|
|
|
```bash
|
|
|
|
echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js
|
2023-02-18 03:49:18 +01:00
|
|
|
```
|
|
|
|
|
2023-04-09 20:31:15 +02:00
|
|
|
2. Create a configuration file building a blob that can be injected into the
|
|
|
|
single executable application (see
|
|
|
|
[Generating single executable preparation blobs][] for details):
|
2023-05-20 00:14:03 +02:00
|
|
|
```bash
|
|
|
|
echo '{ "main": "hello.js", "output": "sea-prep.blob" }' > sea-config.json
|
2023-04-09 20:31:15 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
3. Generate the blob to be injected:
|
2023-05-20 00:14:03 +02:00
|
|
|
```bash
|
|
|
|
node --experimental-sea-config sea-config.json
|
2023-04-09 20:31:15 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
4. Create a copy of the `node` executable and name it according to your needs:
|
2023-04-22 08:48:33 +02:00
|
|
|
|
|
|
|
* On systems other than Windows:
|
|
|
|
|
2023-05-20 00:14:03 +02:00
|
|
|
```bash
|
|
|
|
cp $(command -v node) hello
|
2023-02-18 03:49:18 +01:00
|
|
|
```
|
|
|
|
|
2023-04-22 08:48:33 +02:00
|
|
|
* On Windows:
|
|
|
|
|
2023-05-21 13:27:16 +02:00
|
|
|
```text
|
2023-07-06 21:28:59 +02:00
|
|
|
node -e "require('fs').copyFileSync(process.execPath, 'hello.exe')"
|
2023-04-22 08:48:33 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
The `.exe` extension is necessary.
|
|
|
|
|
2023-04-28 11:02:55 +02:00
|
|
|
5. Remove the signature of the binary (macOS and Windows only):
|
2023-02-22 09:34:16 +01:00
|
|
|
|
|
|
|
* On macOS:
|
|
|
|
|
2023-05-20 00:14:03 +02:00
|
|
|
```bash
|
|
|
|
codesign --remove-signature hello
|
2023-02-22 09:34:16 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
* On Windows (optional):
|
|
|
|
|
|
|
|
[signtool][] can be used from the installed [Windows SDK][]. If this step is
|
|
|
|
skipped, ignore any signature-related warning from postject.
|
|
|
|
|
2023-05-21 13:27:16 +02:00
|
|
|
```powershell
|
2023-05-20 00:14:03 +02:00
|
|
|
signtool remove /s hello.exe
|
2023-02-22 09:34:16 +01:00
|
|
|
```
|
|
|
|
|
2023-04-09 20:31:15 +02:00
|
|
|
6. Inject the blob into the copied binary by running `postject` with
|
2023-02-18 03:49:18 +01:00
|
|
|
the following options:
|
|
|
|
|
2023-04-22 08:48:33 +02:00
|
|
|
* `hello` / `hello.exe` - The name of the copy of the `node` executable
|
|
|
|
created in step 4.
|
2023-04-09 20:31:15 +02:00
|
|
|
* `NODE_SEA_BLOB` - The name of the resource / note / section in the binary
|
|
|
|
where the contents of the blob will be stored.
|
|
|
|
* `sea-prep.blob` - The name of the blob created in step 1.
|
|
|
|
* `--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2` - The
|
2023-02-18 03:49:18 +01:00
|
|
|
[fuse][] used by the Node.js project to detect if a file has been injected.
|
2023-04-09 20:31:15 +02:00
|
|
|
* `--macho-segment-name NODE_SEA` (only needed on macOS) - The name of the
|
|
|
|
segment in the binary where the contents of the blob will be
|
2023-02-18 03:49:18 +01:00
|
|
|
stored.
|
|
|
|
|
|
|
|
To summarize, here is the required command for each platform:
|
|
|
|
|
2023-04-22 08:48:33 +02:00
|
|
|
* On Linux:
|
2023-05-20 00:14:03 +02:00
|
|
|
```bash
|
|
|
|
npx postject hello NODE_SEA_BLOB sea-prep.blob \
|
2023-04-09 20:31:15 +02:00
|
|
|
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
|
2023-02-18 03:49:18 +01:00
|
|
|
```
|
|
|
|
|
2023-05-20 02:00:01 +02:00
|
|
|
* On Windows - PowerShell:
|
|
|
|
```powershell
|
|
|
|
npx postject hello.exe NODE_SEA_BLOB sea-prep.blob `
|
|
|
|
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
|
|
|
|
```
|
|
|
|
|
|
|
|
* On Windows - Command Prompt:
|
|
|
|
```text
|
|
|
|
npx postject hello.exe NODE_SEA_BLOB sea-prep.blob ^
|
2023-04-22 08:48:33 +02:00
|
|
|
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
|
|
|
|
```
|
|
|
|
|
2023-02-18 03:49:18 +01:00
|
|
|
* On macOS:
|
2023-05-20 00:14:03 +02:00
|
|
|
```bash
|
|
|
|
npx postject hello NODE_SEA_BLOB sea-prep.blob \
|
2023-04-09 20:31:15 +02:00
|
|
|
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
|
|
|
|
--macho-segment-name NODE_SEA
|
2023-02-18 03:49:18 +01:00
|
|
|
```
|
|
|
|
|
2023-04-28 11:02:55 +02:00
|
|
|
7. Sign the binary (macOS and Windows only):
|
2023-02-22 09:34:16 +01:00
|
|
|
|
|
|
|
* On macOS:
|
|
|
|
|
2023-05-20 00:14:03 +02:00
|
|
|
```bash
|
|
|
|
codesign --sign - hello
|
2023-02-22 09:34:16 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
* On Windows (optional):
|
|
|
|
|
|
|
|
A certificate needs to be present for this to work. However, the unsigned
|
|
|
|
binary would still be runnable.
|
|
|
|
|
2023-05-21 13:27:16 +02:00
|
|
|
```powershell
|
2023-05-20 00:14:03 +02:00
|
|
|
signtool sign /fd SHA256 hello.exe
|
2023-02-22 09:34:16 +01:00
|
|
|
```
|
|
|
|
|
2023-04-09 20:31:15 +02:00
|
|
|
8. Run the binary:
|
2023-04-22 08:48:33 +02:00
|
|
|
|
|
|
|
* On systems other than Windows
|
|
|
|
|
2023-02-18 03:49:18 +01:00
|
|
|
```console
|
|
|
|
$ ./hello world
|
|
|
|
Hello, world!
|
2023-04-22 08:48:33 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
* On Windows
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ .\hello.exe world
|
|
|
|
Hello, world!
|
2023-02-18 03:49:18 +01:00
|
|
|
```
|
|
|
|
|
2023-04-09 20:31:15 +02:00
|
|
|
## Generating single executable preparation blobs
|
|
|
|
|
|
|
|
Single executable preparation blobs that are injected into the application can
|
|
|
|
be generated using the `--experimental-sea-config` flag of the Node.js binary
|
|
|
|
that will be used to build the single executable. It takes a path to a
|
|
|
|
configuration file in JSON format. If the path passed to it isn't absolute,
|
|
|
|
Node.js will use the path relative to the current working directory.
|
|
|
|
|
|
|
|
The configuration currently reads the following top-level fields:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"main": "/path/to/bundled/script.js",
|
2023-05-04 17:27:54 +02:00
|
|
|
"output": "/path/to/write/the/generated/blob.blob",
|
2023-07-21 00:57:00 +02:00
|
|
|
"disableExperimentalSEAWarning": true, // Default: false
|
2023-07-26 12:10:35 +02:00
|
|
|
"useSnapshot": false, // Default: false
|
2023-11-14 19:13:03 +01:00
|
|
|
"useCodeCache": true, // Default: false
|
|
|
|
"assets": { // Optional
|
|
|
|
"a.dat": "/path/to/a.dat",
|
|
|
|
"b.txt": "/path/to/b.txt"
|
|
|
|
}
|
2023-04-09 20:31:15 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
If the paths are not absolute, Node.js will use the path relative to the
|
|
|
|
current working directory. The version of the Node.js binary used to produce
|
|
|
|
the blob must be the same as the one to which the blob will be injected.
|
|
|
|
|
2024-07-31 11:01:38 +02:00
|
|
|
Note: When generating cross-platform SEAs (e.g., generating a SEA
|
|
|
|
for `linux-x64` on `darwin-arm64`), `useCodeCache` and `useSnapshot`
|
|
|
|
must be set to false to avoid generating incompatible executables.
|
|
|
|
Since code cache and snapshots can only be loaded on the same platform
|
|
|
|
where they are compiled, the generated executable might crash on startup when
|
|
|
|
trying to load code cache or snapshots built on a different platform.
|
|
|
|
|
2023-11-14 19:13:03 +01:00
|
|
|
### Assets
|
|
|
|
|
|
|
|
Users can include assets by adding a key-path dictionary to the configuration
|
|
|
|
as the `assets` field. At build time, Node.js would read the assets from the
|
|
|
|
specified paths and bundle them into the preparation blob. In the generated
|
|
|
|
executable, users can retrieve the assets using the [`sea.getAsset()`][] and
|
|
|
|
[`sea.getAssetAsBlob()`][] APIs.
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"main": "/path/to/bundled/script.js",
|
|
|
|
"output": "/path/to/write/the/generated/blob.blob",
|
|
|
|
"assets": {
|
|
|
|
"a.jpg": "/path/to/a.jpg",
|
|
|
|
"b.txt": "/path/to/b.txt"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
The single-executable application can access the assets as follows:
|
|
|
|
|
|
|
|
```cjs
|
2024-08-06 10:24:23 +02:00
|
|
|
const { getAsset, getAssetAsBlob, getRawAsset } = require('node:sea');
|
2023-11-14 19:13:03 +01:00
|
|
|
// Returns a copy of the data in an ArrayBuffer.
|
|
|
|
const image = getAsset('a.jpg');
|
|
|
|
// Returns a string decoded from the asset as UTF8.
|
|
|
|
const text = getAsset('b.txt', 'utf8');
|
|
|
|
// Returns a Blob containing the asset.
|
|
|
|
const blob = getAssetAsBlob('a.jpg');
|
2023-11-28 18:58:15 +01:00
|
|
|
// Returns an ArrayBuffer containing the raw asset without copying.
|
|
|
|
const raw = getRawAsset('a.jpg');
|
2023-11-14 19:13:03 +01:00
|
|
|
```
|
|
|
|
|
2024-08-06 10:24:23 +02:00
|
|
|
See documentation of the [`sea.getAsset()`][], [`sea.getAssetAsBlob()`][] and [`sea.getRawAsset()`][]
|
2023-11-14 19:13:03 +01:00
|
|
|
APIs for more information.
|
|
|
|
|
2023-07-21 00:57:00 +02:00
|
|
|
### Startup snapshot support
|
|
|
|
|
|
|
|
The `useSnapshot` field can be used to enable startup snapshot support. In this
|
|
|
|
case the `main` script would not be when the final executable is launched.
|
|
|
|
Instead, it would be run when the single executable application preparation
|
|
|
|
blob is generated on the building machine. The generated preparation blob would
|
|
|
|
then include a snapshot capturing the states initialized by the `main` script.
|
|
|
|
The final executable with the preparation blob injected would deserialize
|
|
|
|
the snapshot at run time.
|
|
|
|
|
|
|
|
When `useSnapshot` is true, the main script must invoke the
|
|
|
|
[`v8.startupSnapshot.setDeserializeMainFunction()`][] API to configure code
|
|
|
|
that needs to be run when the final executable is launched by the users.
|
|
|
|
|
|
|
|
The typical pattern for an application to use snapshot in a single executable
|
|
|
|
application is:
|
|
|
|
|
|
|
|
1. At build time, on the building machine, the main script is run to
|
|
|
|
initialize the heap to a state that's ready to take user input. The script
|
|
|
|
should also configure a main function with
|
|
|
|
[`v8.startupSnapshot.setDeserializeMainFunction()`][]. This function will be
|
|
|
|
compiled and serialized into the snapshot, but not invoked at build time.
|
|
|
|
2. At run time, the main function will be run on top of the deserialized heap
|
|
|
|
on the user machine to process user input and generate output.
|
|
|
|
|
|
|
|
The general constraints of the startup snapshot scripts also apply to the main
|
|
|
|
script when it's used to build snapshot for the single executable application,
|
|
|
|
and the main script can use the [`v8.startupSnapshot` API][] to adapt to
|
|
|
|
these constraints. See
|
|
|
|
[documentation about startup snapshot support in Node.js][].
|
|
|
|
|
2023-07-26 12:10:35 +02:00
|
|
|
### V8 code cache support
|
|
|
|
|
|
|
|
When `useCodeCache` is set to `true` in the configuration, during the generation
|
|
|
|
of the single executable preparation blob, Node.js will compile the `main`
|
|
|
|
script to generate the V8 code cache. The generated code cache would be part of
|
|
|
|
the preparation blob and get injected into the final executable. When the single
|
|
|
|
executable application is launched, instead of compiling the `main` script from
|
|
|
|
scratch, Node.js would use the code cache to speed up the compilation, then
|
|
|
|
execute the script, which would improve the startup performance.
|
|
|
|
|
|
|
|
**Note:** `import()` does not work when `useCodeCache` is `true`.
|
|
|
|
|
2023-11-14 19:13:03 +01:00
|
|
|
## In the injected main script
|
2023-02-18 03:49:18 +01:00
|
|
|
|
2023-11-14 19:13:03 +01:00
|
|
|
### Single-executable application API
|
2023-02-18 03:49:18 +01:00
|
|
|
|
2023-11-14 19:13:03 +01:00
|
|
|
The `node:sea` builtin allows interaction with the single-executable application
|
|
|
|
from the JavaScript main script embedded into the executable.
|
|
|
|
|
|
|
|
#### `sea.isSea()`
|
|
|
|
|
|
|
|
<!-- YAML
|
2024-03-25 20:33:26 +01:00
|
|
|
added:
|
|
|
|
- v21.7.0
|
|
|
|
- v20.12.0
|
2023-11-14 19:13:03 +01:00
|
|
|
-->
|
|
|
|
|
|
|
|
* Returns: {boolean} Whether this script is running inside a single-executable
|
|
|
|
application.
|
|
|
|
|
|
|
|
### `sea.getAsset(key[, encoding])`
|
|
|
|
|
|
|
|
<!-- YAML
|
2024-03-25 20:33:26 +01:00
|
|
|
added:
|
|
|
|
- v21.7.0
|
|
|
|
- v20.12.0
|
2023-11-14 19:13:03 +01:00
|
|
|
-->
|
|
|
|
|
|
|
|
This method can be used to retrieve the assets configured to be bundled into the
|
|
|
|
single-executable application at build time.
|
|
|
|
An error is thrown when no matching asset can be found.
|
|
|
|
|
|
|
|
* `key` {string} the key for the asset in the dictionary specified by the
|
|
|
|
`assets` field in the single-executable application configuration.
|
|
|
|
* `encoding` {string} If specified, the asset will be decoded as
|
|
|
|
a string. Any encoding supported by the `TextDecoder` is accepted.
|
|
|
|
If unspecified, an `ArrayBuffer` containing a copy of the asset would be
|
|
|
|
returned instead.
|
|
|
|
* Returns: {string|ArrayBuffer}
|
|
|
|
|
|
|
|
### `sea.getAssetAsBlob(key[, options])`
|
|
|
|
|
|
|
|
<!-- YAML
|
2024-03-25 20:33:26 +01:00
|
|
|
added:
|
|
|
|
- v21.7.0
|
|
|
|
- v20.12.0
|
2023-11-14 19:13:03 +01:00
|
|
|
-->
|
|
|
|
|
|
|
|
Similar to [`sea.getAsset()`][], but returns the result in a [`Blob`][].
|
|
|
|
An error is thrown when no matching asset can be found.
|
|
|
|
|
|
|
|
* `key` {string} the key for the asset in the dictionary specified by the
|
|
|
|
`assets` field in the single-executable application configuration.
|
|
|
|
* `options` {Object}
|
|
|
|
* `type` {string} An optional mime type for the blob.
|
|
|
|
* Returns: {Blob}
|
|
|
|
|
2023-11-28 18:58:15 +01:00
|
|
|
### `sea.getRawAsset(key)`
|
|
|
|
|
|
|
|
<!-- YAML
|
2024-03-25 20:33:26 +01:00
|
|
|
added:
|
|
|
|
- v21.7.0
|
|
|
|
- v20.12.0
|
2023-11-28 18:58:15 +01:00
|
|
|
-->
|
|
|
|
|
|
|
|
This method can be used to retrieve the assets configured to be bundled into the
|
|
|
|
single-executable application at build time.
|
|
|
|
An error is thrown when no matching asset can be found.
|
|
|
|
|
2024-08-15 13:11:01 +02:00
|
|
|
Unlike `sea.getAsset()` or `sea.getAssetAsBlob()`, this method does not
|
2023-11-28 18:58:15 +01:00
|
|
|
return a copy. Instead, it returns the raw asset bundled inside the executable.
|
|
|
|
|
|
|
|
For now, users should avoid writing to the returned array buffer. If the
|
|
|
|
injected section is not marked as writable or not aligned properly,
|
|
|
|
writes to the returned array buffer is likely to result in a crash.
|
|
|
|
|
|
|
|
* `key` {string} the key for the asset in the dictionary specified by the
|
|
|
|
`assets` field in the single-executable application configuration.
|
|
|
|
* Returns: {string|ArrayBuffer}
|
|
|
|
|
2023-11-14 19:13:03 +01:00
|
|
|
### `require(id)` in the injected main script is not file based
|
|
|
|
|
|
|
|
`require()` in the injected main script is not the same as the [`require()`][]
|
2023-02-18 03:49:18 +01:00
|
|
|
available to modules that are not injected. It also does not have any of the
|
|
|
|
properties that non-injected [`require()`][] has except [`require.main`][]. It
|
|
|
|
can only be used to load built-in modules. Attempting to load a module that can
|
|
|
|
only be found in the file system will throw an error.
|
|
|
|
|
|
|
|
Instead of relying on a file based `require()`, users can bundle their
|
|
|
|
application into a standalone JavaScript file to inject into the executable.
|
|
|
|
This also ensures a more deterministic dependency graph.
|
|
|
|
|
|
|
|
However, if a file based `require()` is still needed, that can also be achieved:
|
|
|
|
|
|
|
|
```js
|
|
|
|
const { createRequire } = require('node:module');
|
|
|
|
require = createRequire(__filename);
|
|
|
|
```
|
|
|
|
|
2023-11-14 19:13:03 +01:00
|
|
|
### `__filename` and `module.filename` in the injected main script
|
2023-02-18 03:49:18 +01:00
|
|
|
|
2023-11-14 19:13:03 +01:00
|
|
|
The values of `__filename` and `module.filename` in the injected main script
|
|
|
|
are equal to [`process.execPath`][].
|
2023-02-18 03:49:18 +01:00
|
|
|
|
2023-11-14 19:13:03 +01:00
|
|
|
### `__dirname` in the injected main script
|
2023-02-18 03:49:18 +01:00
|
|
|
|
2023-11-14 19:13:03 +01:00
|
|
|
The value of `__dirname` in the injected main script is equal to the directory
|
|
|
|
name of [`process.execPath`][].
|
|
|
|
|
|
|
|
## Notes
|
2023-02-18 03:49:18 +01:00
|
|
|
|
|
|
|
### Single executable application creation process
|
|
|
|
|
|
|
|
A tool aiming to create a single executable Node.js application must
|
2023-04-09 20:31:15 +02:00
|
|
|
inject the contents of the blob prepared with `--experimental-sea-config"`
|
|
|
|
into:
|
2023-02-18 03:49:18 +01:00
|
|
|
|
2023-04-09 20:31:15 +02:00
|
|
|
* a resource named `NODE_SEA_BLOB` if the `node` binary is a [PE][] file
|
|
|
|
* a section named `NODE_SEA_BLOB` in the `NODE_SEA` segment if the `node` binary
|
2023-02-18 03:49:18 +01:00
|
|
|
is a [Mach-O][] file
|
2023-04-09 20:31:15 +02:00
|
|
|
* a note named `NODE_SEA_BLOB` if the `node` binary is an [ELF][] file
|
2023-02-18 03:49:18 +01:00
|
|
|
|
|
|
|
Search the binary for the
|
2023-04-09 20:31:15 +02:00
|
|
|
`NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2:0` [fuse][] string and flip the
|
2023-02-18 03:49:18 +01:00
|
|
|
last character to `1` to indicate that a resource has been injected.
|
|
|
|
|
|
|
|
### Platform support
|
|
|
|
|
|
|
|
Single-executable support is tested regularly on CI only on the following
|
|
|
|
platforms:
|
|
|
|
|
|
|
|
* Windows
|
|
|
|
* macOS
|
2023-03-11 09:58:52 +01:00
|
|
|
* Linux (all distributions [supported by Node.js][] except Alpine and all
|
2023-05-24 12:49:05 +02:00
|
|
|
architectures [supported by Node.js][] except s390x)
|
2023-02-18 03:49:18 +01:00
|
|
|
|
|
|
|
This is due to a lack of better tools to generate single-executables that can be
|
|
|
|
used to test this feature on other platforms.
|
|
|
|
|
|
|
|
Suggestions for other resource injection tools/workflows are welcomed. Please
|
|
|
|
start a discussion at <https://github.com/nodejs/single-executable/discussions>
|
|
|
|
to help us document them.
|
|
|
|
|
|
|
|
[CommonJS]: modules.md#modules-commonjs-modules
|
|
|
|
[ELF]: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
|
2023-04-09 20:31:15 +02:00
|
|
|
[Generating single executable preparation blobs]: #generating-single-executable-preparation-blobs
|
2023-02-18 03:49:18 +01:00
|
|
|
[Mach-O]: https://en.wikipedia.org/wiki/Mach-O
|
|
|
|
[PE]: https://en.wikipedia.org/wiki/Portable_Executable
|
2023-02-22 09:34:16 +01:00
|
|
|
[Windows SDK]: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/
|
2023-11-14 19:13:03 +01:00
|
|
|
[`Blob`]: https://developer.mozilla.org/en-US/docs/Web/API/Blob
|
2023-02-18 03:49:18 +01:00
|
|
|
[`process.execPath`]: process.md#processexecpath
|
|
|
|
[`require()`]: modules.md#requireid
|
|
|
|
[`require.main`]: modules.md#accessing-the-main-module
|
2023-11-14 19:13:03 +01:00
|
|
|
[`sea.getAsset()`]: #seagetassetkey-encoding
|
|
|
|
[`sea.getAssetAsBlob()`]: #seagetassetasblobkey-options
|
2024-08-06 10:24:23 +02:00
|
|
|
[`sea.getRawAsset()`]: #seagetrawassetkey
|
2023-07-21 00:57:00 +02:00
|
|
|
[`v8.startupSnapshot.setDeserializeMainFunction()`]: v8.md#v8startupsnapshotsetdeserializemainfunctioncallback-data
|
|
|
|
[`v8.startupSnapshot` API]: v8.md#startup-snapshot-api
|
|
|
|
[documentation about startup snapshot support in Node.js]: cli.md#--build-snapshot
|
2023-02-18 03:49:18 +01:00
|
|
|
[fuse]: https://www.electronjs.org/docs/latest/tutorial/fuses
|
|
|
|
[postject]: https://github.com/nodejs/postject
|
2023-02-22 09:34:16 +01:00
|
|
|
[signtool]: https://learn.microsoft.com/en-us/windows/win32/seccrypto/signtool
|
2023-02-18 03:49:18 +01:00
|
|
|
[single executable applications]: https://github.com/nodejs/single-executable
|
2023-03-11 09:58:52 +01:00
|
|
|
[supported by Node.js]: https://github.com/nodejs/node/blob/main/BUILDING.md#platform-list
|