node/lib/internal/bootstrap
Joyee Cheung 87855a571b
lib: only build the ESM facade for builtins when they are needed
We previously build the ESM facade (synthetic modules re-exporting
builtin's exports) for builtins even when they are not directly
import'ed (which rarely happens for internal builtins as that
requires --expose-internals). This patch removes
the eager generation to avoid the overhead and the extra
promises created in facade building when it's not reqested by the user.
When the facade is needed the ESM loader that can be requested
it in the translator on-demand.

Drive-by: set the ModuleWrap prototype to null in the built-in
snapshot.

PR-URL: https://github.com/nodejs/node/pull/51669
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2024-02-21 00:15:44 +01:00
..
switches vm: support using the default loader to handle dynamic import() 2024-02-01 11:45:42 +00:00
web lib: enable WebSocket by default 2024-02-04 14:03:39 +00:00
node.js src: add process.loadEnvFile and util.parseEnv 2024-01-23 18:46:26 +00:00
realm.js lib: only build the ESM facade for builtins when they are needed 2024-02-21 00:15:44 +01:00
shadow_realm.js module: bootstrap module loaders in shadow realm 2023-11-13 22:09:47 +08:00