Antoine du Hamel
3059262185
esm: fix broken assertion in legacyMainResolve
...
PR-URL: https://github.com/nodejs/node/pull/55708
Fixes: https://github.com/nodejs/node/issues/55692
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2024-11-07 17:51:24 +01:00
Nicolò Ribaudo
ac37e554a5
esm: mark import attributes and JSON module as stable
...
The two proposals reached stage 4 at the October 2024 meeting.
PR-URL: https://github.com/nodejs/node/pull/55333
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2024-11-02 18:50:27 +01:00
Bruce MacNaughton
84b0ead758
esm: fix hook name in error message
...
PR-URL: https://github.com/nodejs/node/pull/50466
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-11-02 18:42:15 +01:00
RafaelGSS
85abedf1ff
lib,esm: handle bypass network-import via data:
...
PR-URL: https://github.com/nodejs-private/node-private/pull/522
Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/602
CVE-ID: CVE-2024-22020
2024-07-02 16:16:05 -03:00
Joyee Cheung
fe66e9d06e
vm: reject in importModuleDynamically without --experimental-vm-modules
...
Users cannot access any API that can be used to return a module or
module namespace in this callback without --experimental-vm-modules
anyway, so this would eventually lead to a rejection. This patch
rejects in this case with our own error message and use a constant
host-defined option for the rejection, so that scripts with the
same source can still be compiled using the compilation cache
if no `import()` is actually called in the script.
PR-URL: https://github.com/nodejs/node/pull/50137
Backport-PR-URL: https://github.com/nodejs/node/pull/51004
Refs: https://github.com/nodejs/node/issues/35375
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-03-15 17:56:10 +00:00
Joyee Cheung
052e095c6b
vm: use internal versions of compileFunction and Script
...
Instead of using the public versions of the vm APIs internally,
use the internal versions so that we can skip unnecessary
argument validation.
The public versions would need special care to the generation
of host-defined options to hit the isolate compilation cache
when imporModuleDynamically isn't used, while internally it's
almost always used, so this allows us to handle the host-defined
options separately.
PR-URL: https://github.com/nodejs/node/pull/50137
Backport-PR-URL: https://github.com/nodejs/node/pull/51004
Refs: https://github.com/nodejs/node/issues/35375
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-03-15 17:56:06 +00:00
Joyee Cheung
6291c107d0
vm: use default HDO when importModuleDynamically is not set
...
This makes it possile to hit the in-isolate compilation cache when
host-defined options are not necessary.
PR-URL: https://github.com/nodejs/node/pull/49950
Backport-PR-URL: https://github.com/nodejs/node/pull/51004
Refs: https://github.com/nodejs/node/issues/35375
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2024-03-15 17:55:58 +00:00
Joyee Cheung
a86a2e14a3
module: use symbol in WeakMap to manage host defined options
...
Previously when managing the importModuleDynamically callback of
vm.compileFunction(), we use an ID number as the host defined option
and maintain a per-Environment ID -> CompiledFnEntry map to retain
the top-level referrer function returned by vm.compileFunction() in
order to pass it back to the callback, but it would leak because with
how we used v8::Persistent to maintain this reference, V8 would not
be able to understand the cycle and would just think that the
CompiledFnEntry was supposed to live forever. We made an attempt
to make that reference known to V8 by making the CompiledFnEntry weak
and using a private symbol to make CompiledFnEntry strongly
references the top-level referrer function in
https://github.com/nodejs/node/pull/46785 , but that turned out to be
unsound, because the there's no guarantee that the top-level function
must be alive while import() can still be initiated from that
function, since V8 could discard the top-level function and only keep
inner functions alive, so relying on the top-level function to keep
the CompiledFnEntry alive could result in use-after-free which caused
a revert of that fix.
With this patch we use a symbol in the host defined options instead of
a number, because with the stage-3 symbol-as-weakmap-keys proposal
we could directly use that symbol to keep the referrer alive using a
WeakMap. As a bonus this also keeps the other kinds of referrers
alive as long as import() can still be initiated from that
Script/Module, so this also fixes the long-standing crash caused by
vm.Script being GC'ed too early when its importModuleDynamically
callback still needs it.
PR-URL: https://github.com/nodejs/node/pull/48510
Backport-PR-URL: https://github.com/nodejs/node/pull/51004
Refs: https://github.com/nodejs/node/issues/44211
Refs: https://github.com/nodejs/node/issues/42080
Refs: https://github.com/nodejs/node/issues/47096
Refs: https://github.com/nodejs/node/issues/43205
Refs: https://github.com/nodejs/node/issues/38695
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2024-03-15 17:55:29 +00:00
André Alves
981aa7866d
lib: fix MIME overmatch in data URLs
...
This commit adds the delimiters ^ and $ to the regex that matches the
MIME types for `data:` URLs.
PR-URL: https://github.com/nodejs/node/pull/49104
Fixes: https://github.com/nodejs/node/issues/48957
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-11-26 20:32:33 +01:00
Antoine du Hamel
92734d4480
esm: use import attributes instead of import assertions
...
The old import assertions proposal has been
renamed to "import attributes" with the follwing major changes:
1. The keyword is now `with` instead of `assert`.
2. Unknown assertions cause an error rather than being ignored,
This commit updates the documentation to encourage folks to use the new
syntax, and add aliases for module customization hooks.
PR-URL: https://github.com/nodejs/node/pull/50140
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Fixes: https://github.com/nodejs/node/issues/50134
Refs: https://github.com/v8/v8/commit/159c82c5e6392e78b9bba7161b1bed6e23758984
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2023-11-23 10:52:48 +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
João Lenon
a67fa2a107
util: add getCwdSafe internal util fn
...
This function was first implemented in #46826 , but at some point
of the PR implementation this fn was no longer related to the PR.
Refs: https://github.com/nodejs/node/pull/46826#discussion_r1225431178
PR-URL: https://github.com/nodejs/node/pull/48434
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-11-23 10:52:03 +01:00
Geoffrey Booth
fe691984b2
esm: unflag extensionless javascript and wasm in module scope
...
PR-URL: https://github.com/nodejs/node/pull/49974
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2023-11-23 10:51:52 +01:00
Geoffrey Booth
56bd9a88ac
esm: --experimental-default-type flag to flip module defaults
...
PR-URL: https://github.com/nodejs/node/pull/49869
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-11-23 10:51:31 +01:00
Antoine du Hamel and Geoffrey Booth
72644d62e7
esm: improve JSDoc annotation of internal functions
...
Co-authored-by: Geoffrey Booth <webadmin@geoffreybooth.com >
PR-URL: https://github.com/nodejs/node/pull/49959
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2023-11-23 10:51:20 +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
97579895f2
module, esm: jsdoc for modules files
...
PR-URL: https://github.com/nodejs/node/pull/49523
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 >
2023-11-23 10:51:02 +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
Yagiz Nizipli
fe26f8a860
lib: merge cjs and esm package json reader caches
...
PR-URL: https://github.com/nodejs/node/pull/48477
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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-11-23 10:50:24 +01:00
Antoine du Hamel
c12685f82d
esm: fix cache collision on JSON files using file: URL
...
PR-URL: https://github.com/nodejs/node/pull/49887
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Fixes: https://github.com/nodejs/node/issues/49724
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2023-11-23 10:50:11 +01:00
Jacob Smith
ed8dd33493
esm: identify parent importing a url with invalid host
...
PR-URL: https://github.com/nodejs/node/pull/49736
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2023-11-23 10:50:01 +01:00
Geoffrey Booth
12cb700478
esm: update loaders warning
...
PR-URL: https://github.com/nodejs/node/pull/49633
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2023-11-23 10:49:35 +01:00
Antoine du Hamel
47193a347e
esm: fix support for URL instances in register
...
PR-URL: https://github.com/nodejs/node/pull/49655
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-11-23 10:49:23 +01:00
Antoine du Hamel
945609487c
typings: fix missing property in ExportedHooks
...
PR-URL: https://github.com/nodejs/node/pull/49567
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2023-11-23 10:48:39 +01:00
Antoine du Hamel
4be5612bae
esm: remove return value for Module.register
...
The current API shape si not great because it's too limited and
redundant with the use of `MessagePort`.
PR-URL: https://github.com/nodejs/node/pull/49529
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-11-23 10:48:30 +01:00
Antoine du Hamel
01ca6d277d
esm: fix globalPreload warning
...
PR-URL: https://github.com/nodejs/node/pull/49069
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Fixes: https://github.com/nodejs/node/issues/49026
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-11-23 10:46:11 +01:00
Guy Bedford
c1a84398b4
esm: unflag import.meta.resolve
...
PR-URL: https://github.com/nodejs/node/pull/49028
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2023-11-23 10:46:00 +01:00
Guy Bedford
ef43f084e9
esm: import.meta.resolve exact module not found errors should return
...
PR-URL: https://github.com/nodejs/node/pull/49038
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-11-23 10:45:47 +01:00
Antoine du Hamel
385f24c9cc
esm: protect ERR_UNSUPPORTED_DIR_IMPORT against prototype pollution
...
PR-URL: https://github.com/nodejs/node/pull/49060
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-11-23 10:45:17 +01:00
Izaak Schroeder
10e7c3a376
esm: add initialize hook, integrate with register
...
Follows @giltayar's proposed API:
> `register` can pass any data it wants to the loader, which will be
passed to the exported `initialize` function of the loader.
Additionally, if the user of `register` wants to communicate with the
loader, it can just create a `MessageChannel` and pass the port to the
loader as data.
The `register` API is now:
```ts
interface Options {
parentUrl?: string;
data?: any;
transferList?: any[];
}
function register(loader: string, parentUrl?: string): any;
function register(loader: string, options?: Options): any;
```
This API is backwards compatible with the old one (new arguments are
optional and at the end) and allows for passing data into the new
`initialize` hook. If this hook returns data it is passed back to
`register`:
```ts
function initialize(data: any): Promise<any>;
```
**NOTE**: Currently there is no mechanism for a loader to exchange
ownership of something back to the caller.
Refs: https://github.com/nodejs/loaders/issues/147
PR-URL: https://github.com/nodejs/node/pull/48842
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2023-11-23 10:44:54 +01:00
Antoine du Hamel
f96b610268
esm: fix typo parentUrl -> parentURL
...
PR-URL: https://github.com/nodejs/node/pull/48999
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
2023-11-23 10:44:42 +01:00
Antoine du Hamel
14e148ee6c
module: ensure successful import returns the same result
...
PR-URL: https://github.com/nodejs/node/pull/46662
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2023-11-23 10:43:44 +01:00
Izaak Schroeder
03c1b5e647
esm: unflag Module.register and allow nested loader import()
...
Major functional changes:
- Allow `import()` to work within loaders that require other loaders,
- Unflag the use of `Module.register`.
A new interface `Customizations` has been created in order to unify
`ModuleLoader` (previously `DefaultModuleLoader`), `Hooks` and
`CustomizedModuleLoader` all of which now implement it:
```ts
interface LoadResult {
format: ModuleFormat;
source: ModuleSource;
}
interface ResolveResult {
format: string;
url: URL['href'];
}
interface Customizations {
allowImportMetaResolve: boolean;
load(url: string, context: object): Promise<LoadResult>
resolve(
originalSpecifier:
string, parentURL: string,
importAssertions: Record<string, string>
): Promise<ResolveResult>
resolveSync(
originalSpecifier:
string, parentURL: string,
importAssertions: Record<string, string>
) ResolveResult;
register(specifier: string, parentUrl: string): any;
forceLoadHooks(): void;
importMetaInitialize(meta, context, loader): void;
}
```
The `ModuleLoader` class now has `setCustomizations` which takes an
object of this shape and delegates its responsibilities to this object
if present.
Note that two properties `allowImportMetaResolve` and `resolveSync`
exist now as a mechanism for `import.meta.resolve` – since `Hooks`
does not implement `resolveSync` other loaders cannot use
`import.meta.resolve`; `allowImportMetaResolve` is a way of checking
for that case instead of invoking `resolveSync` and erroring.
Fixes https://github.com/nodejs/node/issues/48515
Closes https://github.com/nodejs/node/pull/48439
PR-URL: https://github.com/nodejs/node/pull/48559
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2023-11-23 10:43:33 +01:00
Antoine du Hamel
63aa5d7270
esm: add back globalPreload tests and fix failing ones
...
PR-URL: https://github.com/nodejs/node/pull/48779
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Fixes: https://github.com/nodejs/node/issues/48778
Fixes: https://github.com/nodejs/node/issues/48516
Refs: https://github.com/nodejs/node/pull/46402
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-11-23 10:43:20 +01:00
João Lenon
65dfe85f03
module: implement register utility
...
PR-URL: https://github.com/nodejs/node/pull/46826
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2023-11-23 10:43:08 +01:00
Antoine du Hamel
2ef80f12b9
typings: fix JSDoc in ESM loader modules
...
PR-URL: https://github.com/nodejs/node/pull/48424
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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-11-23 10:42:56 +01:00
Antoine du Hamel
1c7be606f1
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
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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-11-23 10:42:45 +01:00
Antoine du Hamel
655111fa00
esm: handle globalPreload hook returning a nullish value
...
PR-URL: https://github.com/nodejs/node/pull/48249
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Fixes: https://github.com/nodejs/node/issues/48240
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-11-23 10:42:35 +01:00
Antoine du Hamel
9938a8bf13
esm: handle more error types thrown from the loader thread
...
PR-URL: https://github.com/nodejs/node/pull/48247
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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-11-23 10:42:20 +01:00
Antoine du Hamel
8cab32a5d1
esm: do not use 'beforeExit' on the main thread
...
PR-URL: https://github.com/nodejs/node/pull/47964
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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-11-23 10:42:06 +01:00
Antoine du Hamel
b61efcce95
esm: rename URLCanParse to be consistent
...
PR-URL: https://github.com/nodejs/node/pull/47668
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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-11-23 10:22:09 +01:00
Joyee Cheung
b77a6b2376
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
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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-11-23 10:21:52 +01:00
Antoine du Hamel
ca20f5931d
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
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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-11-23 10:21:32 +01:00
Antoine du Hamel
5de37a1e37
esm: initialize import.meta on eval
...
PR-URL: https://github.com/nodejs/node/pull/47551
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-11-23 10:21:18 +01:00
Antoine du Hamel
39fbce7313
esm: propagate process.exit from the loader thread to the main thread
...
PR-URL: https://github.com/nodejs/node/pull/47548
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2023-11-23 10:21:01 +01:00
Yagiz Nizipli
2a528b76e6
esm: avoid try/catch when validating urls
...
PR-URL: https://github.com/nodejs/node/pull/47541
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 >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2023-11-23 10:19:23 +01:00
bac9b1758f
esm: move hook execution to separate thread
...
PR-URL: https://github.com/nodejs/node/pull/44710
Backport-PR-URL: https://github.com/nodejs/node/pull/50669
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-11-23 10:19:07 +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
Antoine du Hamel
dfa444477a
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-11-10 14:59:42 +01:00
Yagiz Nizipli
9a4b57d6d4
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-11-10 14:22:49 +01:00