Skip to content

[v24.x backport] sea: add --build-sea and support ESM entry point#62190

Open
himself65 wants to merge 6 commits intonodejs:v24.x-stagingfrom
himself65:v24.x-staging
Open

[v24.x backport] sea: add --build-sea and support ESM entry point#62190
himself65 wants to merge 6 commits intonodejs:v24.x-stagingfrom
himself65:v24.x-staging

Conversation

@himself65
Copy link
Member

Summary

Backport the --build-sea flag and ESM entry point support for Single Executable Applications to v24.x.

Cherry-picked from:

Refs: #62119

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/config
  • @nodejs/gyp
  • @nodejs/loaders
  • @nodejs/security-wg
  • @nodejs/single-executable
  • @nodejs/startup
  • @nodejs/tsc

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. v24.x Issues that can be reproduced on v24.x or PRs targeting the v24.x-staging branch. labels Mar 10, 2026
@himself65 himself65 force-pushed the v24.x-staging branch 2 times, most recently from 439b04c to 7124701 Compare March 10, 2026 18:50
joyeecheung and others added 6 commits March 10, 2026 12:04
Instead of relying on a WASM build of postject to perform the
injection, add LIEF as dependency and generate the SEA directly
from core via a new CLI option --build-sea which takes the SEA
config. This simplifies SEA generation for users and makes it
easier to debug/maintain the SEA building process.

PR-URL: nodejs#61167
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Only leave a smoking test for the postject-based workflow
in test-single-executable-application.js

PR-URL: nodejs#61167
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
PR-URL: nodejs#61581
Refs: nodejs#61579
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
PR-URL: nodejs#61708
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This uses the new StartExecutionCallbackWithModule embedder
API to support ESM entrypoint in SEA via a new configuration
field `"mainFormat"`. The behavior currently aligns with the
embedder API and is mostly in sync with the CommonJS entry
point behavior, except that support for code caching and
snapshot is left for follow-ups.

PR-URL: nodejs#61813
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This adds a embedder_module_hdo for identifying embedder-run
modules in the dynamic import handler and import.meta initializer,
and a SourceTextModuleTypes for customizing source text module
compilation in the JS land via compileSourceTextModule().
Also, refactors the existing embedder module compilation code
to reuse the builtin resolution logic.

PR-URL: nodejs#61654
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Aditi Singh <aditisingh1400@gmail.com>
@Renegade334 Renegade334 linked an issue Mar 10, 2026 that may be closed by this pull request
@himself65 himself65 added request-ci Add this label to start a Jenkins CI on a PR. and removed needs-ci PRs that need a full CI run. labels Mar 10, 2026
@github-actions github-actions bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Mar 10, 2026
@github-actions
Copy link
Contributor

Failed to start CI
   ⚠  No approving reviews found
   ✘  Refusing to run CI on potentially unsafe PR
https://github.com/nodejs/node/actions/runs/22922894129

@himself65 himself65 removed the request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. label Mar 10, 2026
@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 57.56881% with 185 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.06%. Comparing base (065c9b0) to head (fb276ad).
⚠️ Report is 140 commits behind head on v24.x-staging.

Files with missing lines Patch % Lines
src/node_sea_bin.cc 39.84% 146 Missing and 14 partials ⚠️
src/node_sea.cc 67.16% 15 Missing and 7 partials ⚠️
lib/internal/modules/esm/utils.js 92.68% 3 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##           v24.x-staging   #62190      +/-   ##
=================================================
- Coverage          90.10%   90.06%   -0.05%     
=================================================
  Files                667      671       +4     
  Lines             199019   200746    +1727     
  Branches           38911    39141     +230     
=================================================
+ Hits              179335   180807    +1472     
- Misses             12040    12244     +204     
- Partials            7644     7695      +51     
Files with missing lines Coverage Δ
lib/internal/main/embedding.js 88.88% <100.00%> (-0.10%) ⬇️
lib/internal/modules/helpers.js 98.30% <100.00%> (+0.13%) ⬆️
src/node.cc 75.32% <100.00%> (+0.59%) ⬆️
src/node_metadata.cc 92.85% <100.00%> (+0.31%) ⬆️
src/node_options.cc 84.42% <100.00%> (+0.15%) ⬆️
src/node_options.h 97.88% <ø> (+0.04%) ⬆️
src/node_sea.h 100.00% <100.00%> (ø)
lib/internal/modules/esm/utils.js 99.23% <92.68%> (-0.77%) ⬇️
src/node_sea.cc 89.70% <67.16%> (+4.63%) ⬆️
src/node_sea_bin.cc 41.72% <39.84%> (ø)

... and 165 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib / src Issues and PRs related to general changes in the lib or src directory. v24.x Issues that can be reproduced on v24.x or PRs targeting the v24.x-staging branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Backport Node SEA to v24.x

4 participants