Geoffrey Booth
00c08539b6
test: fix edge snapshot stack traces
...
PR-URL: https://github.com/nodejs/node/pull/49659
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2023-11-23 10:53:41 +01:00
Geoffrey Booth
c3c945e654
esm: bypass CommonJS loader under --default-type
...
PR-URL: https://github.com/nodejs/node/pull/49986
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-11-23 10:52:13 +01:00
Geoffrey Booth
8c55f317a3
module: move helpers out of cjs loader
...
PR-URL: https://github.com/nodejs/node/pull/49912
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2023-11-23 10:51:10 +01:00
Geoffrey Booth
957725f601
esm: require braces for modules code
...
PR-URL: https://github.com/nodejs/node/pull/49657
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-11-23 10:50:35 +01:00
Darshan Sen
6f0458d0a6
module: refactor to use normalizeRequirableId in the CJS module loader
...
`BuiltinModule.normalizeRequirableId()` was introduced in
https://github.com/nodejs/node/pull/47779 to fix a bug in the require
function of SEAs and Snapshots, so that built-in modules with the
`node:` scheme could be required correctly. This change makes more use
of this API instead of `BuiltinModule.canBeRequiredByUsers()` and
`BuiltinModule.canBeRequiredWithoutScheme()` to reduce chances of
such bugs.
Signed-off-by: Darshan Sen <raisinten@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/47896
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2023-11-10 16:21:44 +01:00
Joyee Cheung
89ed24b94a
module: do less CJS module loader initialization at run time
...
This patch:
- Builds the set of modules that can be required by users with/without
the `node:` prefix at snapshot building time. We only modify it when
`--expose-internals` but the default set is now in the snapshot. At
run time the CJS module loader only creates a frozen array out of it.
- `BuiltinModule.canBeRequiredWithoutScheme()` is now enough to
determine if an id can be required without `node:` without an
additional call to `BuiltinModule.canBeRequiredByUsers()`
- Replace the pending-to-deprecate methods on `Module` with an internal
implementation that only queries the CLI flags when being invoked.
So we can install these methods in the snapshot.
PR-URL: https://github.com/nodejs/node/pull/47194
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2023-11-10 14:22:48 +01:00
Joyee Cheung
e0e09caafe
bootstrap: make CJS loader snapshotable
...
This patch makes the top-level access to runtime states in the
CJS loader lazy, and move the side-effects into a
initializeCJS() function that gets called during pre-execution.
As a result the CJS loader can be included into the built-in
snapshot.
PR-URL: https://github.com/nodejs/node/pull/45849
Backport-PR-URL: https://github.com/nodejs/node/pull/46425
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2023-11-10 09:49:23 +01:00
Joyee Cheung
c6b2f56723
lib: lazy-load deps in modules/run_main.js
...
So that the file can be snapshotted
PR-URL: https://github.com/nodejs/node/pull/45849
Backport-PR-URL: https://github.com/nodejs/node/pull/46425
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2023-11-10 09:49:23 +01:00
Moshe Atlow
c39b7c240e
esm: add --import flag
...
PR-URL: https://github.com/nodejs/node/pull/43942
Backport-PR-URL: https://github.com/nodejs/node/pull/49539
Fixes: https://github.com/nodejs/node/issues/40110
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-09-12 10:58:09 -04:00
Moshe Atlow
c46b31f3bf
lib: support FORCE_COLOR for non TTY streams
...
PR-URL: https://github.com/nodejs/node/pull/48034
Backport-PR-URL: https://github.com/nodejs/node/pull/48684
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2023-07-11 22:02:04 -04:00
Moshe Atlow
03dcf7bc94
test: migrate message tests to use assertSnapshot
...
PR-URL: https://github.com/nodejs/node/pull/47498
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2023-07-07 00:06:10 +03:00