- Recording: https://youtu.be/tYamVJ9KbiM
- GitHub Issue: #2
- Loaders team: @nodejs/loaders
- Geoffrey Booth, @GeoffreyBooth
- Michaël Zasso, @targos
- Stephen Belanger, @qard
- Jacob Smith, @JakobJingleheimer
- Bradley Farias, @bmeck
*Extracted from loaders-agenda labeled issues and pull requests from the nodejs org prior to the meeting.
esm: consolidate ESM Loader methods #37468
Needed answer on question of whether resolve can optionally return format, for when you know that already (e.g. from file extension). Group says yes. This was the last outstanding issue holding back that PR, pending Guy and Geoffrey’s reviews.
Allow main thread to be supplanted by another #38454
Use case: when running Node in environments that don’t permit flags, such as AWS Lambda, and the user wants to include instrumentation/monitoring that needs to be part of the preload phase such as via --loader.
Bradley suggests something similar to the Unix exec, where there’s some way to tell Node “hey, spawn this new child process and have it supplant the current (main) process.” Like a new method on process for example. This would be tricky to implement, but shouldn’t encounter too much resistance; most likely anticipated complaint is the risk that this could allow privilege escalation, but a) we look to OS sandboxing as the guard against that, and b) we could implement some kind of check that the new process doesn’t have greater privileges than the parent, though such a check would be hard to get secure.
Jakob mentioned that while testing his PR, he often was stumped by his loaders not behaving as expected, because he accidentally didn’t call next or didn’t call it in the code path he thought was being followed. We should perhaps have some kind of warning printed to users when next is never called, similar to fs.promises warning users when file descriptors aren’t garbage collected. We should open an issue to track this as a potential UX improvement (or discuss potentially always having each loader’s hooks always be called, though that introduces other issues that allowing short-circuiting solves).