Description
In many of the discussions on this repo and in https://github.com/nodejs/node, we’ve considered various parts of Node that users might want to customize beyond just module resolution and loading. Within this repo one major use case discussed has been virtual filesystems, which would require hooking into many (if not all) of the fs
methods. In nodejs/node#43818 (comment) @cspotcode has compiled a great (incomplete) list of places where someone adding support for TypeScript to Node might want to customize Node:
- repl
- tab completion (current api insufficient)
- top-level await (mechanism not exposed)
- inherit configuration blob to worker_threads and child_processes (currently requires hacks)
- stack trace support (fix bugs & perf in node’s current implementation)
- stack trace cache setter (haven’t looked at this one in a while)
- proper APIs into node’s CJS exports discovery mechanism (discover ESM named exports in CJS source code, no way for transpiled code to contribute to this process)
I’m thinking perhaps a better name for this repo and the Loaders API itself would be “hooks” / Hooks API. This would better reflect even the existing API, since arguably globalPreload
has little to do with module resolution and loading. We could also move the loaders documentation out of the ESM page in the docs and into its own page. cc @nodejs/loaders
If the current loaders team likes this idea, I can open an issue on nodejs/admin to make it happen from a technical standpoint.
Update per #95 (comment), here are the new names:
- Team: “Customization.” (Likewise for this repo, GitHub group, etc.)
- Docs: new top-level section “Customization API.” Move “ESM » Loaders » Hooks” to “Customization API » Module Hooks”.
- Flag(s): No change for now, but reevaluate as part of moving loaders off-thread.