Joyee Cheung
1d6a62662c
src: move import.meta initializer to native land
...
When the source text module is compiled without custom callbacks,
instead of calling into JS land from the per-isolate import.meta
initializer and then back to C++ land to set up lazy data
properties, just do the initialization all in C++ land.
Only import.meta.resolve initialization will call back
into JS land to generate a closure that call the cascaded loader
for resolution.
In addition, simplify the loader structure by merging
allowImportMetaResolve into isForAsyncLoaderHookWorker - the two
are essentially equivalent, as import.meta.resolve is only
allowed in a non-loader-hook worker thread's loader.
PR-URL: https://github.com/nodejs/node/pull/60603
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2025-11-08 16:33:34 +00:00
Marco Ippolito
8e5c80d108
module: mark type stripping as stable
...
PR-URL: https://github.com/nodejs/node/pull/60600
Refs: https://github.com/nodejs/typescript/issues/24
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruy Adorno <ruy@vlt.sh >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2025-11-08 09:36:45 +00:00
Renegade334
21b0fe4b28
lib: replace global SharedArrayBuffer constructor with bound method
...
PR-URL: https://github.com/nodejs/node/pull/60497
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2025-11-03 13:23:20 +00:00
Joyee Cheung
3e31baeda6
esm: use sync loading/resolving on non-loader-hook thread
...
ESM resolution and loading is now always synchronous from a
non-loader-hook thread. If no asynchrnous loader hooks are
registered, the resolution/loading is entirely synchronous.
If asynchronous loader hooks are registered, these would be
synchronous on the non-loader-hook thread, and asynchronous
on the loader hook thread.
This avoids several races caused by async/sync loading sharing
the same cache. In particular, asynchronous loader hooks
now works with `require(esm)` - previously it tends to break
due to races.
In addition, when an asynchronous loader hook
returns a promise that never settles, the main thread no longer
silently exits with exit code 13, leaving the code below
any module loading calls silently ignored without being executed.
Instead, it now throws ERR_ASYNC_LOADER_REQUEST_NEVER_SETTLED
which can be caught and handled by the main thread. If the module
request comes from `import()`, the never-settling promise is
now relayed to the result returned by `import()`.
Drive-by: when annotating the error about importing undetectable
named exports from CommonJS, it now no longer reload the source
code of the CommonJS module, and instead reuses format information
cached when the module was loaded for linking.
PR-URL: https://github.com/nodejs/node/pull/60380
Fixes: https://github.com/nodejs/node/issues/59666
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2025-10-31 20:45:10 +00:00
Joyee Cheung
b19525a33c
module: refactor and clarify async loader hook customizations
...
- This updates the comments that assume loader hooks must be async
- Differentiate the sync/async loader hook paths in naming
`#customizations` is now `#asyncLoaderHooks` to make it clear
it's from the async APIs.
- Differentiate the paths running on the loader hook thread
(affects the loading of async other loader hooks and are async)
v.s. paths on the main thread calling out to code on the loader
hook thread (do not handle loading of other async loader hooks, and
can be sync by blocking).
- `Hooks` is now `AsyncLoaderHooksOnLoaderHookWorker`
- `CustomizedModuleLoader` is now
`AsyncLoaderHooksProxiedToLoaderHookWorker` and moved into
`lib/internal/modules/esm/hooks.js` as it implements the same
interface as `AsyncLoaderHooksOnLoaderHookWorker`
- `HooksProxy` is now `AsyncLoaderHookWorker`
- Adjust the JSDoc accordingly
- Clarify the "loader worker" as the "async loader hook worker"
i.e. when there's no _async_ loader hook registered, there won't
be this worker, to avoid the misconception that this worker
is spawned unconditionally.
- The code run on the loader hook worker to process
`--experimental-loader` is moved into
`lib/internal/modules/esm/worker.js` for clarity.
- The initialization configuration `forceDefaultLoader` is split
into `shouldSpawnLoaderHookWorker` and `shouldPreloadModules`
as those can be separate.
- `--experimental-vm-modules` is now processed during pre-execution
and no longer part of the initialization of the built-in ESM
loader, as it only exposes the vm APIs of ESM, and is unrelated
to built-in ESM loading.
PR-URL: https://github.com/nodejs/node/pull/60278
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2025-10-23 13:42:23 +00:00
Joyee Cheung
170848bc18
module: handle null source from async loader hooks in sync hooks
...
This relaxes the validation in sync hooks so that it accepts
the quirky nullish source returned by the default step of the
async loader when the module being loaded is CommonJS.
When there are no customization hooks registered, a saner
synchronous default load step is used to use a property
instead of a reset nullish source to signify that the module
should go through the CJS monkey patching routes and reduce
excessive reloading from disk.
PR-URL: https://github.com/nodejs/node/pull/59929
Fixes: https://github.com/nodejs/node/issues/59384
Fixes: https://github.com/nodejs/node/issues/57327
Refs: https://github.com/nodejs/node/issues/59666
Refs: https://github.com/dygabo/load_module_test
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2025-10-14 16:28:22 +00:00
Marco Ippolito
69144e96c2
module: use sync cjs when importing cts
...
PR-URL: https://github.com/nodejs/node/pull/60072
Fixes: https://github.com/nodejs/node/issues/59963
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2025-10-02 03:49:26 +00:00
Joyee Cheung
c46260284c
module: only put directly require-d ESM into require.cache
...
This reduces the impact of
https://redirect.github.com/nodejs/node/pull/59679
by delaying the require.cache population of ESM until they
are directly required. After that, it's necessary for them
to be in the cache to maintain correctness.
PR-URL: https://github.com/nodejs/node/pull/59874
Refs: https://github.com/nodejs/node/issues/59868
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2025-09-17 13:13:59 +00:00
Chengzhong Wu
c742220be9
lib,src: cache ModuleWrap.hasAsyncGraph
...
`v8::Module::IsGraphAsync()` traverses the dependencies to find if they
contain TLA each time. `ModuleWrap.hasAsyncGraph` caches the result
and exposes the property to JS land so that the presence of the property
`module.hasAsyncGraph` can be consistent.
This also allows C++ access of cached `hasAsyncGraph`.
This merges the `intantiateSync`/`instantiate` and
`getNamespaceSync`/`getNamespace` as they are always sync.
PR-URL: https://github.com/nodejs/node/pull/59703
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2025-09-11 12:54:24 +00:00
Joyee Cheung
916929863d
esm: populate separate cache for require(esm) in imported CJS
...
Otherwise if the ESM happens to be cached separately by the ESM loader
before it gets loaded with `require(esm)` from within an imported
CJS file (which uses a re-invented require() with a couple of quirks,
including a separate cache), it won't be able to load the esm properly
from the cache.
PR-URL: https://github.com/nodejs/node/pull/59679
Refs: https://github.com/nodejs/node/issues/59666
Refs: https://github.com/nodejs/node/issues/52697
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2025-09-08 14:59:31 +00:00
Joyee Cheung
3ffc3d73ac
esm: fix missed renaming in ModuleJob.runSync
...
https://redirect.github.com/nodejs/node/pull/59675 missed a case
when renaming .async to .hasAsyncGraph. This fixes that and add
a test that would previously crash with the missed rename.
PR-URL: https://github.com/nodejs/node/pull/59724
Refs: https://github.com/nodejs/node/pull/59675
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2025-09-04 10:01:32 +00:00
Joyee Cheung
fb22c7f414
src: separate module.hasAsyncGraph and module.hasTopLevelAwait
...
Clarify the names - hasAsyncGraph means either the module or its
dependencies contains top-level await; hasTopLevelAwait means the
module itself contains top-level await. Theoratically the former
can be inferred from iterating over the dependencies but for the
built-in loader it's currently not fully reliable until we eliminate
async linking.
Also remove the hasTopLevelAwait method - we can simply put it
on the module wrap for source text modules right after compilation.
PR-URL: https://github.com/nodejs/node/pull/59675
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2025-09-01 14:59:04 +00:00
René
196f5466af
lib: revert to using default derived class constructors
...
PR-URL: https://github.com/nodejs/node/pull/59650
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-08-30 14:28:10 +00:00
Joyee Cheung
7535aa1f72
esm: link modules synchronously when no async loader hooks are used
...
When no async loader hooks are registered, perform the linking as
synchronously as possible to reduce the chance of races from the
the shared module loading cache.
PR-URL: https://github.com/nodejs/node/pull/59519
Fixes: https://github.com/nodejs/node/issues/59366
Refs: https://github.com/abejfehr/node-22.18-issue-repro
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2025-08-20 14:31:08 +00:00
Joyee Cheung
db70ceb49f
esm: show race error message for inner module job race
...
The race can not only happen when the ESM is loaded by
the CommonJS loader, but can also happen to inner
module jobs in the dependency graph.
PR-URL: https://github.com/nodejs/node/pull/59519
Fixes: https://github.com/nodejs/node/issues/59366
Refs: https://github.com/abejfehr/node-22.18-issue-repro
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2025-08-20 14:31:08 +00:00
Joyee Cheung
af5d1c93ce
esm: sync-ify module translation
...
This completes the TODO to compile WASM synchronously and thus
making translation (i.e. compilation + instantiation) synchronous.
PR-URL: https://github.com/nodejs/node/pull/59453
Refs: https://github.com/nodejs/node/issues/55782
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2025-08-14 14:28:40 +00:00
Joyee Cheung
6ea421a3d3
module: fix conditions override in synchronous resolve hooks
...
1. Make sure that the conditions are converted into arrays when
being passed into user hooks.
2. Pass the conditions from user hooks into the ESM resolution
so that it takes effect.
PR-URL: https://github.com/nodejs/node/pull/59011
Fixes: https://github.com/nodejs/node/issues/59003
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2025-07-26 09:13:11 +00:00
Guy Bedford
0df15188d7
esm: unflag --experimental-wasm-modules
...
PR-URL: https://github.com/nodejs/node/pull/57038
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2025-07-22 13:24:06 -07:00
Guy Bedford
35e599b3d0
esm: js-string Wasm builtins in ESM Integration
...
PR-URL: https://github.com/nodejs/node/pull/59020
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2025-07-18 15:50:52 -07:00
Yagiz Nizipli
0fd1ecded6
meta: enable jsdoc/check-tag-names rule
...
PR-URL: https://github.com/nodejs/node/pull/58521
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-07-18 09:28:21 +00:00
Joyee Cheung
793a2792d5
module: throw error when re-runing errored module jobs
...
Re-evaluating an errored ESM should lead to rejecting
the rejection again - this is also the case when importing
it twice. In the case of retrying with
require after import, just throw the cached error.
Drive-by: add some debug logs.
PR-URL: https://github.com/nodejs/node/pull/58957
Fixes: https://github.com/nodejs/node/issues/58945
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-07-09 16:39:29 +00:00
Chengzhong Wu
cc856b3d5d
module: link module with a module request record
...
When a module is being statically linked with module requests, if two
module requests with a same specifier but different attributes are
resolved to two modules, the module requests should be linked to these
two modules.
PR-URL: https://github.com/nodejs/node/pull/58886
Refs: https://tc39.es/ecma262/#sec-HostLoadImportedModule
Refs: https://github.com/tc39/proposal-import-attributes?tab=readme-ov-file#how-would-this-proposal-work-with-caching
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2025-07-04 19:56:08 +00:00
Mert Can Altin
6ce6fdbf21
module: update tests for combined ambiguous module syntax error
...
PR-URL: https://github.com/nodejs/node/pull/55874
Fixes: https://github.com/nodejs/node/issues/55776
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2025-06-24 21:49:31 +00:00
Marco Ippolito
bba07d7e1e
module: fix typescript import.meta.main
...
PR-URL: https://github.com/nodejs/node/pull/58661
Fixes: https://github.com/nodejs/node/issues/58660
Reviewed-By: Xuguang Mei <meixuguang@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2025-06-12 11:21:54 +00:00
Jacob Smith
5e1537c30b
esm: syncify default path of ModuleLoader.load
...
PR-URL: https://github.com/nodejs/node/pull/57419
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2025-06-11 21:53:56 +00:00
Joyee Cheung
8c17ceb38f
module: allow cycles in require() in the CJS handling in ESM loader
...
When --import is used, the ESM loader is used to handle even pure
CJS entry points, and it can run into CJS module facades in the
evaluating state when the parent CJS module is being evaluated.
In this case it should be allowed, since the ESM <-> CJS cycles
that are meant to be disallowed (for the time being) should
already be detected before evaluation and wouldn't get here,
and CJS <-> CJS cycles are fine.
PR-URL: https://github.com/nodejs/node/pull/58598
Fixes: https://github.com/nodejs/node/issues/58515
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2025-06-11 09:33:16 +00:00
Chengzhong Wu
7ffa029750
src,lib: obtain sourceURL in magic comments from V8
...
Obtain sourceURL magic comments via V8 API to avoid a second round of
extraction of magic comments.
Updates source map snapshot normalization to allow testing full path
names inside the test outputs.
PR-URL: https://github.com/nodejs/node/pull/58389
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2025-05-30 09:47:20 +00:00
Guy Bedford
a7e4a40298
esm: unwrap WebAssembly.Global on Wasm Namespaces
...
PR-URL: https://github.com/nodejs/node/pull/57525
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2025-05-27 11:40:28 -07:00
Joe and Antoine du Hamel
bbc059378b
esm: implement import.meta.main
...
Boolean value to check if an ES Module is the entrypoint of the
current process.
Implements: #57226
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/57804
Fixes: https://github.com/nodejs/node/issues/57226
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2025-05-26 22:31:54 +00:00
Aditi
6f045771fa
errors: show url of unsupported attributes in the error message
...
PR-URL: https://github.com/nodejs/node/pull/58303
Fixes: https://github.com/nodejs/node/issues/56930
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2025-05-26 21:19:23 +00:00
Chengzhong Wu
a436f7b492
fs: unexpose internal constants
...
`EXTENSIONLESS_FORMAT_JAVASCRIPT` and `EXTENSIONLESS_FORMAT_WASM` are
only used internally through binding `getFormatOfExtensionlessFile`.
They should not be exposed publicly.
PR-URL: https://github.com/nodejs/node/pull/58327
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: LiviaMedeiros <livia@cirno.name >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
2025-05-16 19:40:17 +00:00
Carlos Espa
b6189c352c
module: clarify cjs global-like error on ModuleJobSync
...
PR-URL: https://github.com/nodejs/node/pull/56491
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2025-05-16 06:39:28 +00:00
Joyee Cheung
e0766f9a73
module: handle instantiated async module jobs in require(esm)
...
When require(esm) encounters a cached module job that is instantiated
but not yet evaluated, run the evaluation. This catches an edge case
previously missed in https://github.com/nodejs/node/pull/57187 .
PR-URL: https://github.com/nodejs/node/pull/58067
Fixes: https://github.com/nodejs/node/issues/58061
Reviewed-By: Jacob Smith <jacob@frende.me >
2025-05-08 20:10:32 +00:00
Antoine du Hamel
50cfc6ca63
esm: avoid import.meta setup costs for unused properties
...
PR-URL: https://github.com/nodejs/node/pull/57286
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com >
2025-04-29 22:55:33 +02:00
Yagiz Nizipli
5ed1bcbd9b
src: fix internalModuleStat v8 fast path
...
PR-URL: https://github.com/nodejs/node/pull/58054
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
2025-04-29 17:53:12 +00:00
haykam821
bc09144aa6
module: fix incorrect formatting in require(esm) cycle error message
...
Fixes: https://github.com/nodejs/node/issues/57451
PR-URL: https://github.com/nodejs/node/pull/57453
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-04-09 11:47:58 +00:00
Gürgün Dayıoğlu
a20acd407d
lib: limit split function calls to prevent excessive array length
...
PR-URL: https://github.com/nodejs/node/pull/57501
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2025-03-18 15:52:50 +00:00
Guy Bedford
fbe37d501e
esm: fix module.exports export on CJS modules
...
PR-URL: https://github.com/nodejs/node/pull/57366
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-03-09 13:51:04 -07:00
Joyee Cheung
0aa3dddfeb
module: handle cached linked async jobs in require(esm)
...
This handles two cases caused by using Promise.all() with
multiple dynamic import() that can make an asynchronously
linked module job that has finished/failed linking but
has not yet started actual evaluation appear in the load
cache when another require request is in turn to handle
it.
- When the cached async job has finished linking but has not
started its evaluation because the async run() task would be
later in line, start the evaluation from require() with
runSync().
- When the cached async job have already encountered a linking
error that gets wrapped into a rejection, but is still later
in line to throw on it, just unwrap and throw the linking error
from require().
PR-URL: https://github.com/nodejs/node/pull/57187
Fixes: https://github.com/nodejs/node/issues/57172
Refs: https://github.com/shufo/prettier-plugin-blade/issues/311
Refs: https://github.com/fisker/prettier-plugin-blade-311
Refs: https://github.com/mochajs/mocha/issues/5290
Refs: https://github.com/JoshuaKGoldberg/repros/tree/mocha-missing-module-cyclic
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2025-03-04 07:34:34 +00:00
Guy Bedford
db4dcc05ac
esm: support source phase imports for WebAssembly
...
PR-URL: https://github.com/nodejs/node/pull/56919
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2025-02-28 09:52:47 -08:00
Chengzhong Wu
90ab559f4d
typings: fix ImportModuleDynamicallyCallback return type
...
PR-URL: https://github.com/nodejs/node/pull/57160
Refs: https://github.com/nodejs/node/pull/56919/files#r1955336054
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2025-02-21 18:06:34 +01:00
Joyee Cheung
8d10bc7b09
module: improve error message from asynchronicity in require(esm)
...
- Improve the error message that shows up when there is a race
from doing require(esm) and import(esm) at the same time.
- Improve error message of ERR_REQUIRE_ASYNC_MODULE by showing
parent and target file names, if available.
Drive-by: split the require(tla) tests since we are modifying
the tests already.
PR-URL: https://github.com/nodejs/node/pull/57126
Refs: https://github.com/fisker/prettier-issue-17139
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2025-02-20 17:22:08 +00:00
Chengzhong Wu
b11ee4cad3
lib: allow skipping source maps in node_modules
...
Files in `node_modules` are not authored by the user directly and the
original sources are less relevant to the user.
Skipping source maps in `node_modules` improves the general
performance. Add `module.setSourceMapsSupport(enabled, options)` to
skip source maps in `node_modules` if it is needed. This moves
all source maps related API to `node:module` and this a step to
promote the source maps API to stable.
PR-URL: https://github.com/nodejs/node/pull/56639
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-01-23 22:44:10 +00:00
Jacob Smith and Carlos Espa
ba6800d1d6
esm: fix jsdoc type refs to ModuleJobBase in esm/loader
...
Co-Authored-By: Carlos Espa <43477095+Ceres6@users.noreply.github.com >
PR-URL: https://github.com/nodejs/node/pull/56499
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2025-01-10 14:44:43 +01:00
Marco Ippolito
da3f388c14
module: support eval with ts syntax detection
...
PR-URL: https://github.com/nodejs/node/pull/56285
Refs: https://github.com/nodejs/typescript/issues/17
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2024-12-24 16:48:02 +00:00
Chengzhong Wu
b6df12819d
esm: add experimental support for addon modules
...
PR-URL: https://github.com/nodejs/node/pull/55844
Fixes: https://github.com/nodejs/node/issues/40541
Fixes: https://github.com/nodejs/node/issues/55821
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2024-12-20 11:59:08 +00:00
Shima Ryuhei
2063245b1f
module: prevent main thread exiting before esm worker ends
...
PR-URL: https://github.com/nodejs/node/pull/56183
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2024-12-10 23:52:29 +00:00
Joyee Cheung
1215a8bf12
module: use synchronous hooks for preparsing in import(cjs)
...
PR-URL: https://github.com/nodejs/node/pull/55698
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2024-12-09 23:27:09 +00:00
Joyee Cheung
e85964610c
module: implement module.registerHooks()
...
PR-URL: https://github.com/nodejs/node/pull/55698
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2024-12-09 23:27:08 +00:00
Geoffrey Booth
94c327c753
module: remove --experimental-default-type
...
PR-URL: https://github.com/nodejs/node/pull/56092
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
2024-12-02 22:43:55 +00:00