Replies: 6 comments 23 replies
-
Another thing this unblocks is compression - I've doing some work (slowly) to port JS2C to C++ in order to compress the sources using internal libraries (instead of relying on whatever python offers). When we have decent compression support for internal resources (like source code, snapshot and code cache) in core we can easily reuse that for SEA too. |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
@joyeecheung any thoughts on where the tooling should exist? Do you think it should be inside node or are you okay with having it as an external npm package (which might potentially be maintained in the nodejs org)? |
Beta Was this translation helpful? Give feedback.
-
My 2 cents. I do think that defining a generic format that we can use to embed different things while using the same tools to find/read etc. make sense. My initial thought is still that the tool to embed it is better outside of the node binary itself for the same reasons we talked about for SEA. The part which finds the blob, figures out what type it is etc. can likely be common code in Node.js itself and probably not too much different to start from what we have today, except that it would filter based on type. It might also makes sense to have a single pass where it finds/stores info for all injected segments and provide an API where Node.js code can ask for a segment of type X. For example the existing SEA code could ask for the application segment if there is one. In terms of generating the content for the blob, if that is using snapshots then it makes sense for the generation to be done by the node binary, but injection into the binary, signing etc I think could still be in an external tool. In terms of changes and syncing the two I think we should have a versioning mechanism in place so that support for a new format can be added without breaking existing workflows and make it easier to sync those changes between Node.js and whatever tool is used for the injection. |
Beta Was this translation helpful? Give feedback.
-
Another question I have while rebasing nodejs/node#46824: do we want the snapshot in SEA to be built specifically for SEA? For now it's possible to load snapshots in SEA even if the snapshot is not specifically built for SEA, but it might be useful in the future - I imagine this might be helpful if we happen to have to fix up the application state/code cache specifically for SEA. For example do we want the config file to look like this:
where the blob needs to be built by a
where we will just take entry.js and build the blob ourselves. Personally I think the latter is just more user-friendly, and the chance of needing the former while the latter is already available might be very thin. And if we only have the latter, starting from requiring the snapshot to be built for SEA seems safer and we could relax the restrictions if that turns out to be unnecessary. |
Beta Was this translation helpful? Give feedback.
-
Any thoughts on what the file format of the injected SEA resource blob should be like? Should we create our own custom format or is anyone aware of an existing file format that might work for our use case? Our use case for now is to be able to store some kind of a map but it doesn't have to be a map really because of these reasons:
Let me know if I missed something. I think this is what an appropriate file format would look like: unique magic bytes
size of value at index 0
value corresponding to index 0
size of value at index 1
value corresponding to index 1
size of value at index 2
value corresponding to index 2
... Here, all the |
Beta Was this translation helpful? Give feedback.
-
Now that we have an initial implementation of SEA in Node.js, we should decide how we're gonna embed other resources for the SEA like CLI arguments, snapshot blob (PR - nodejs/node#46824), etc.
I really like the idea that @joyeecheung suggested in nodejs/node#46824 (comment):
I wonder if anyone else has any better ideas.
If we're all good with the suggested approach, we should decide on the file format of the
config.json
file and thesea-prep.blob
file.cc @nodejs/single-executable
Beta Was this translation helpful? Give feedback.
All reactions