It would be nice if Node.js provided a Javascript API for generating SEA blobs. This would eliminate extra file creation and streamline the SEA creation process. I propose adding a function to the node:sea module/API (Typescript used for clarity):
/**
* Configuration options for generating a SEA blob
* @see https://nodejs.org/api/single-executable-applications.html#generating-single-executable-preparation-blobs
*/
interface BlobConfiguration {
main: string;
disableExperimentalSEAWarning?: boolean;
useSnapshot?: boolean;
useCodeCache?: boolean;
assets?: Record<string, string>;
}
/**
* Generates a SEA blob to be injected into an executable
* @param config configuration options for the blob
* @returns The blob contents in a buffer
*/
function generateBlob(config: BlobConfiguration): Buffer;
This new function in the SEA API would allow for more streamlined and readable code:
Currently, CLI commands and many files are involved in generating a SEA using Javascript.
For example:
It would be nice if Node.js provided a Javascript API for generating SEA blobs. This would eliminate extra file creation and streamline the SEA creation process. I propose adding a function to the
node:sea
module/API (Typescript used for clarity):This new function in the SEA API would allow for more streamlined and readable code:
Which could even be inlined:
Discussion Issue on nodejs/single-executable