entropic-dev / entropic

🦝 :package: a package registry for anything, but mostly javascript 🦝 🦝 🦝

Home Page:https://discourse.entropic.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Equivalent for Yarn's "Plug'n'play" feature

aslilac opened this issue · comments

Is this a feature request or a bug?

Feature request

Expected behavior:

For those who are unfamiliar

Yarn's Plug'n'play feature enables it to be incredibly fast and disk usage efficient. It not only improves install times, but can improve startup time as well.

Installs are simplified to only reading one or two files (a package manifest and a lock file) and writing one file (Yarn calls it .pnp.js, but I'm not really attached to the name) rather than writing a bunch of files in nested directories or creating symbolic links to a bunch of nested directories and other sad things.

At runtime, this single output file knows exactly where we have stored our local copies of each dependency so that we don't have to waste a bunch of time on file system traversals. In addition we are also able to throw errors when we try to import dependencies which are not declared in our package file instead of silently succeeding and then failing later when run somewhere else without that dependency.

Actual behavior:

Entropic currently defaults to being slow and creating huge node_modules folders like a sucker. ☹️

I would be willing to help implement this, but there are a few implementation details that would need to be worked out first. That, and deciding if this is a feature that people actually want/care about.

I know there has been a lot of discussion around the implementation that exists in tink and supporting the methodology that tink implements (which is very similar, at least on the surface, to the ideas in yarn's pnp)

Note that if you wish to do this, we have exported the PnP core as a generic package that you can use to generate and hydrate the PnP API as standardised. It still has some room for improvements (for example it ships with the Zip core which you might not need, and isn't documented yet), but I'd be happy to help merge improvements.

Yarn calls it .pnp.js, but I'm not really attached to the name

You probably should; some tools use the presence of this file to branch (although I hope it won't be needed later, once the node loader api has matured).