Repository navigation
sea: support code cache for ESM entrypoint in SEA - #62158
Merged
Merged
Conversation
Collaborator
|
Review requested:
|
joyeecheung
commented
Mar 8, 2026
| // in the SEA code. Support it. | ||
| // Refs: https://github.com/nodejs/node/pull/48191#discussion_r1213271430 | ||
| // TODO(joyeecheung): this likely has been fixed by | ||
| // https://chromium-review.googlesource.com/c/v8/v8/+/5401780 - add a test |
Member
Author
There was a problem hiding this comment.
I noticed that this should already be fixed - and locally it works. But since it was talking about the CommonJS case I think it's out of scope of this PR, so I only left a TODO.
The initial support for ESM entrypoint in SEA didn't support code cache. This patch implements that by following a path similar to how code cache in CJS SEA entrypoint is supported: at build time we generate the code cache from C++ and put it into the sea blob, and at runtime we consume it via a special case in compilation routines - for CJS this was CompileFunctionForCJSLoader, in the case of SourceTextModule, it's in Module::New.
joyeecheung
force-pushed
the
esm-sea-code-cache
branch
from
March 8, 2026 21:54
6e05770 to
57e7b9f
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #62158 +/- ##
==========================================
- Coverage 89.66% 89.65% -0.01%
==========================================
Files 676 676
Lines 206543 206571 +28
Branches 39542 39552 +10
==========================================
+ Hits 185193 185202 +9
- Misses 13475 13484 +9
- Partials 7875 7885 +10
🚀 New features to boost your workflow:
|
aymen94
approved these changes
Mar 9, 2026
Collaborator
addaleax
approved these changes
Mar 9, 2026
The initial support for ESM entrypoint in SEA didn't support code cache. This patch implements that by following a path similar to how code cache in CJS SEA entrypoint is supported: at build time we generate the code cache from C++ and put it into the sea blob, and at runtime we consume it via a special case in compilation routines - for CJS this was
CompileFunctionForCJSLoader, in the case of SourceTextModule, it's in Module::New.
Refs: #61813