Skip to content

Split "package multiple files together" and "Distribute a script w/ Node.js" #25

@arcanis

Description

@arcanis

I understand from the discussions I see here that the main use case currently talked about is shipping a completely standalone executable application. It's a reasonable one, but I have another: execute packaged scripts from an existing Node.js installation (and also to be to able to require the entry point from such packaged scripts, from existing Node.js processes) - similar to how Java knows how to run JAR files as if they were regular scripts, but without having to distribute the Java interpreter inside them, or how Python can natively import modules from zip files.

Fortunately, I don't think those two use cases are conflicting. Solving both would simply mean splitting the question statement:

  • How can we distribute an application, resources and all, inside a Node.js binary?

Into two:

  • How can we make Node.js understand the concept of packaged application (just like it understands json, wasm, etc)?
  • How can we distribute a entry point inside a Node.js binary (whether this entry point is js, wasm, or packaged app)?

Then, by answering those two questions, both use cases will be addressed.

"Can't we just postpone this concept of packaged application to a follow-up proposal, once SEA are solved?"

While, in a sense, the original question statement is a subset of the split one (because it allows fewer things), I believe the split question is a better start for a design discussion. Indeed, if we decide to focus the design on the single initial question, then whatever format we pick for storing the SEA resources will either:

  • constrain the packaged application design down the road (because we'll have to use the same format for consistency, even if it doesn't match all the requirements), or
  • bring technical debt on arrival (because we'll have one format for SEA resources and a different one for packaged application, where a single one would have been enough)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions