-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Case Study] Node 12 Experimental Loader hooks and Yarn P'n'P #272
Comments
Not yet, but it's still on my radar. It might be a post-v2 line, though. The resolution itself should be fairly easy - the more complex part will be zip loading: we need some way to tell Node that the vendors must be loaded through our hook (rather than through the regular fs as it would usually do). I'm not sure the experimental hooks expose this capability yet. |
It doesn't seem to be supported in Node 12, but Node 13 has a There's an example to load the source via HTTP, so using the same hook to load from a zip should be easy. |
@rkistner although technically true, it's a bit more complex in that various packages rely on doing things such as calling Ideally Node should expose a package interface that allows packages to access their own sources, but since the very concept of "package" doesn't exist in Node (everything is just modules), it's more difficult. Maybe we could provide the abstraction ourselves, though (similar to #918) ... |
What I would actually find very useful, is a linker mode between node-modules and pnp: Extract all the files to the filesystem, but without the It should be possible to implement this using just Node 12's loader hooks, without patching any |
Worth noting that using loader hooks would probably help fixing #906. |
I've started on a proof-of-concept of using loader hooks, coupled with a variation of the pnp installer that unplugs all modules. It appears to be feasible conceptually, but a major limitation is that Node's loader hooks are currently only supported for ES modules, not for CommonJS modules. This makes it unsuable for most of the current Node ecosystem. |
I don't think that's accurate, using The lack of stability of the feature at the moment, and the fact that it hasn't been fully backported to v10 at the moment make it a hard sell for shipping on v2 imho. |
The There are lots of discussions on the loader hooks in this thread: nodejs/modules#351 |
I'll close this as the loader hooks don't allow us to hook into the |
I couldn't find any resources for how Yarn P'n'P will work with Node 12 Experimental Loader hooks. With that all of the hacks to
fs
module to make pnp work would be unnecessary. Has design for this started yet?The text was updated successfully, but these errors were encountered: