Yagiz Nizipli
15530fea4c
lib: merge cjs and esm package json reader caches
...
PR-URL: https://github.com/nodejs/node/pull/48477
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2023-07-03 10:42:27 -03:00
Yagiz Nizipli
32bda81c31
lib: reduce url getters on makeRequireFunction
...
PR-URL: https://github.com/nodejs/node/pull/48492
Refs: https://github.com/nodejs/performance/issues/92
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-07-03 10:38:39 -03:00
Antoine du Hamel
e9c9d187b9
typings: fix JSDoc in ESM loader modules
...
PR-URL: https://github.com/nodejs/node/pull/48424
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Mestery <mestery@protonmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2023-07-03 10:35:41 -03:00
Yagiz Nizipli
4ec2d925b1
module: reduce url invocations in esm/load.js
...
PR-URL: https://github.com/nodejs/node/pull/48337
Refs: https://github.com/nodejs/performance/issues/92
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-07-03 10:32:47 -03:00
RafaelGSS
d0a8264ec9
policy: handle mainModule.__proto__ bypass
...
PR-URL: https://github.com/nodejs-private/node-private/pull/416
Fixes: https://hackerone.com/bugs?subject=nodejs&report_id=1877919
Reviewed-By: Rich Trott <rtrott@gmail.com >
CVE-ID: CVE-2023-30581
2023-06-19 12:10:41 -03:00
Antoine du Hamel
11a3434810
esm: remove support for arrays in import internal method
...
This avoids initializing arrays that we never use, and simplifies the
implementation overall.
PR-URL: https://github.com/nodejs/node/pull/48296
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-06-05 11:35:26 +02:00
Yagiz Nizipli
6d6bf3ee52
module: reduce the number of URL initializations
...
PR-URL: https://github.com/nodejs/node/pull/48272
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
Reviewed-By: Mestery <mestery@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-06-04 14:31:32 +02:00
Antoine du Hamel
3b00f3afef
esm: handle globalPreload hook returning a nullish value
...
PR-URL: https://github.com/nodejs/node/pull/48249
Fixes: https://github.com/nodejs/node/issues/48240
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-06-04 14:31:11 +02:00
Antoine du Hamel
3c7846d7e1
esm: handle more error types thrown from the loader thread
...
PR-URL: https://github.com/nodejs/node/pull/48247
Refs: https://github.com/nodejs/node/issues/48240
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-06-04 14:31:11 +02:00
Gil Tayar
f380953103
module: change default resolver to not throw on unknown scheme
...
Fixes https://github.com/nodejs/loaders/issues/138
PR-URL: https://github.com/nodejs/node/pull/47824
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-05-30 11:36:15 +02:00
Antoine du Hamel
1ec640ac70
esm: do not use 'beforeExit' on the main thread
...
PR-URL: https://github.com/nodejs/node/pull/47964
Fixes: https://github.com/nodejs/node/issues/47929
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2023-05-15 11:37:35 +02:00
Darshan Sen
c19385c154
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-05-12 11:57:09 +02:00
Moshe Atlow
7323902a40
tools: fix jsdoc lint
...
PR-URL: https://github.com/nodejs/node/pull/47789
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Mestery <mestery@protonmail.com >
2023-05-12 11:56:59 +02:00
Antoine du Hamel
a793cf401d
esm: rename URLCanParse to be consistent
...
PR-URL: https://github.com/nodejs/node/pull/47668
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-05-02 09:34:05 +02:00
Yagiz Nizipli
21ff33127a
lib: improve esm resolve performance
...
PR-URL: https://github.com/nodejs/node/pull/46652
Refs: https://github.com/nodejs/performance/issues/39
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Erick Wendel <erick.workspace@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2023-05-02 09:34:04 +02:00
Joyee Cheung
91e4a7cdee
loader: use default loader as cascaded loader in the in loader worker
...
Use the default loader as the cascaded loader in the loader worker.
Otherwise we spawn loader workers in the loader workers indefinitely.
PR-URL: https://github.com/nodejs/node/pull/47620
Fixes: https://github.com/nodejs/node/issues/47566
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2023-05-02 09:34:02 +02:00
Antoine du Hamel
fbb6b72f87
esm: remove support for deprecated hooks
...
Those have been deprecated for a while, it's time.
PR-URL: https://github.com/nodejs/node/pull/47580
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-05-02 09:33:59 +02:00
Antoine du Hamel
c150976c4f
esm: initialize import.meta on eval
...
PR-URL: https://github.com/nodejs/node/pull/47551
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-05-02 09:33:59 +02:00
Antoine du Hamel
55f70f6395
esm: propagate process.exit from the loader thread to the main thread
...
PR-URL: https://github.com/nodejs/node/pull/47548
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-05-02 09:33:58 +02:00
Yagiz Nizipli
269482f61f
esm: avoid accessing lazy getters for urls
...
PR-URL: https://github.com/nodejs/node/pull/47542
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-05-02 09:33:53 +02:00
Yagiz Nizipli
889add68e5
esm: avoid try/catch when validating urls
...
PR-URL: https://github.com/nodejs/node/pull/47541
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2023-05-02 09:33:53 +02:00
2613a9ced9
esm: move hook execution to separate thread
...
PR-URL: https://github.com/nodejs/node/pull/44710
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
Co-authored-by: Geoffrey Booth <webadmin@geoffreybooth.com >
Co-authored-by: Michaël Zasso <targos@protonmail.com >
2023-04-13 16:48:54 -03:00
Joyee Cheung
631c3ef3de
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-04-13 16:48:51 -03:00
Chengzhong Wu
698508afa8
src: bootstrap prepare stack trace callback in shadow realm
...
Bootstrap per-realm callbacks like `prepare_stack_trace_callback` in
the ShadowRealm. This enables stack trace decoration in the ShadowRealm.
PR-URL: https://github.com/nodejs/node/pull/47107
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-04-13 16:48:50 -03:00
Antoine du Hamel
aa5eb58d3b
esm: skip file: URL conversion to path when possible
...
PR-URL: https://github.com/nodejs/node/pull/46305
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-04-01 07:43:38 +00:00
Rafael Gonzaga
1726da9300
permission: add path separator to loader check
...
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com >
PR-URL: https://github.com/nodejs/node/pull/47030
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2023-03-15 14:27:26 +00:00
Antoine du Hamel
0c4f8f255a
esm: fix import assertion warning
...
Refs: https://github.com/nodejs/node/pull/46901#discussion_r1122242913
PR-URL: https://github.com/nodejs/node/pull/46971
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-03-07 10:32:47 +00:00
Antoine du Hamel
ab8942848b
lib: enforce use of trailing commas
...
PR-URL: https://github.com/nodejs/node/pull/46881
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-03-06 10:44:14 +01:00
Yagiz Nizipli
027841c964
url: use private properties for brand check
...
PR-URL: https://github.com/nodejs/node/pull/46904
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2023-03-03 21:34:56 +00:00
Antoine du Hamel
5a7491b5ac
esm: add a runtime warning when using import assertions
...
PR-URL: https://github.com/nodejs/node/pull/46901
Refs: https://github.com/nodejs/node/issues/46830
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-03-03 18:31:12 +00:00
Rafael Gonzaga
00c222593e
src,process: add permission model
...
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com >
PR-URL: https://github.com/nodejs/node/pull/44004
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2023-02-23 18:11:51 +00:00
sinkhaha
a2bbe5ff21
lib: delete module findPath unused params
...
PR-URL: https://github.com/nodejs/node/pull/45371
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-02-17 06:55:38 +00:00
RafaelGSS
9b7db62276
lib: makeRequireFunction patch when experimental policy
...
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com >
Refs: https://hackerone.com/bugs?subject=nodejs&report_id=1747642
CVE-ID: CVE-2023-23918
PR-URL: https://github.com/nodejs-private/node-private/pull/358
Reviewed-by: Bradley Farias <bradley.meck@gmail.com >
Reviewed-by: Matteo Collina <matteo.collina@gmail.com >
2023-02-16 18:49:20 -03:00
RafaelGSS and Bradley Farias
af91400886
policy: makeRequireFunction on mainModule.require
...
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com >
Co-authored-by: Bradley Farias <bradley.meck@gmail.com >
Refs: https://hackerone.com/bugs?subject=nodejs&report_id=1747642
CVE-ID: CVE-2023-23918
PR-URL: https://github.com/nodejs-private/node-private/pull/358
Reviewed-by: Bradley Farias <bradley.meck@gmail.com >
Reviewed-by: Matteo Collina <matteo.collina@gmail.com >
2023-02-16 18:49:02 -03:00
Antoine du Hamel
cbcefdf253
lib: enforce use of trailing commas in more files
...
Some part of the codebase already use trailing commas, this commit is
adding a lint rule to ensure it stays this way.
This commit also adds the rule for a few files that were missing only
one or two trailing commas.
PR-URL: https://github.com/nodejs/node/pull/46655
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2023-02-16 18:47:24 +01:00
Antoine du Hamel
fe514bf960
lib: enforce use of trailing commas for functions
...
PR-URL: https://github.com/nodejs/node/pull/46629
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2023-02-14 18:45:16 +01:00
Antoine du Hamel
31ea7be98d
esm: mark importAssertions as required
...
We already always specify a value, and failing to do so would likely be
a bug.
PR-URL: https://github.com/nodejs/node/pull/46164
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2023-01-12 21:11:11 +00:00
Geoffrey Booth
91ca2d4041
esm: allow resolve to return import assertions
...
PR-URL: https://github.com/nodejs/node/pull/46153
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-01-12 01:57:45 +00:00
Jordan Harband
757c104147
tools: add prefer-proto rule
...
fixup: add support for `Object.create(null)`
fixup: extend to any 1-argument Object.create call
fixup: add tests
PR-URL: https://github.com/nodejs/node/pull/46083
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-01-10 05:38:36 +00:00
Antoine du Hamel
693b6fbeac
module: fix unintended mutation
...
Refs: https://github.com/nodejs/node/pull/46061#issuecomment-1372246648
PR-URL: https://github.com/nodejs/node/pull/46108
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-01-07 15:36:51 +00:00
Geoffrey Booth
12c0571c8f
module: move test reporter loading
...
Move the logic for handling --test-reporter out of the
general module loader and into the test_runner subsystem.
PR-URL: https://github.com/nodejs/node/pull/45923
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-12-22 21:40:32 +00:00
Geoffrey Booth
7738844fe3
esm: move hooks handling into separate class
...
PR-URL: https://github.com/nodejs/node/pull/45869
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2022-12-20 07:36:45 +00:00
Moshe Atlow
a1b27b25bb
test_runner: add reporters
...
PR-URL: https://github.com/nodejs/node/pull/45712
Fixes: https://github.com/nodejs/node/issues/45648
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2022-12-19 17:35:57 +00:00
Antoine du Hamel
ca2ec902e9
tools: add ArrayPrototypeConcat to the list of primordials to avoid
...
PR-URL: https://github.com/nodejs/node/pull/44445
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-12-17 19:15:24 +00:00
Maël Nison
12f6da731c
esm: leverage loaders when resolving subsequent loaders
...
PR-URL: https://github.com/nodejs/node/pull/43772
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2022-12-17 04:23:11 +00:00
Joyee Cheung
995440b791
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
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2022-12-16 12:44:14 +01:00
Joyee Cheung
36608c14b7
modules: move callbacks and conditions into modules/esm/utils.js
...
This moves the following utils into modules/esm/utils.js:
- Code related to default conditions
- The callbackMap (which is now created in the module instead of
hanging off the module_wrap binding, since the C++ land
does not need it).
- Per-isolate module callbacks
These are self-contained code that can be included into the
built-in snapshot.
PR-URL: https://github.com/nodejs/node/pull/45849
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2022-12-16 12:44:10 +01:00
Joyee Cheung
0c4f5c40ad
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
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2022-12-16 12:44:06 +01:00
Joyee Cheung
9d9bdfc693
modules: move modules/cjs/helpers.js to modules/helpers.js
...
The helpers are actually shared by the two loaders, so move them
under modules/ directly.
PR-URL: https://github.com/nodejs/node/pull/45849
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2022-12-16 12:43:56 +01:00
Joyee Cheung
265ea1e74e
bootstrap: lazy load non-essential modules
...
It turns out that even with startup snapshots, there is a non-trivial
overhead for loading internal modules. This patch makes the loading
of the non-essential modules lazy again.
Caveat: we have to make some of the globals lazily-loaded too,
so the WPT runner is updated to test what the state of the global
scope is after the globals are accessed (and replaced with the
loaded value).
PR-URL: https://github.com/nodejs/node/pull/45659
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Tierney Cyren <hello@bnb.im >
2022-12-09 22:37:35 +00:00