-
-
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] Improving how yarn and yarn plugins are distributed #2117
Comments
We support zip access for the packages because that's critical to the package manager model itself. By contrast, zip support for plugins would be "nice to have", but not critical. In this context, I'd prefer such "package bundle" initiative to wait until Node supports this kind of workflow by default (cf https://github.com/WICG/webpackage).
They support data URLs. While it's impractical, you can bundle your worker into a JS string that you then encode into your "real" plugin bundle. |
While this is also important for plugins, it's not just for plugins. The goal is to simplify the developer experience for both core yarn and for plugin developers, while also reducing repo size for end-users, and greatly improving |
I have some experience on the Yarn core 🙂, and this will not help. At best it would decrease the startup time, but in a way that would lead to the millisecond speedups being immediately lost to the time it takes to boot the wasm libzip and access the files. To be a net positive in terms of perfs, it requires a cooperative interpreter, hence nodejs/node#1278. That being said, the thread on Node is currently closed; I think it's a good time to reopen it / open a new one, if only to express that the ecosystem would now benefit from this in various aspects that didn't exist in 2016. |
Startup time is not really a big deal anyway, that's why I said partly 😆 Everything else is much more important. |
Just for kicks, here's a benchmark using hyperfine: I assume not much work is being done to get the version:
This uses
Looks like simply running |
More than you'd think, since we need to locate the configuration to find the |
Indeed, I guess it was parsing both yarn 1 and 2 via the global
Still |
What package is covered by this investigations?
@yarnpkg/berry
Describe the goal of the investigation
Investigate moving away from
webpack
and completely intozip
-file based bundling foryarn
itself, and for plugins.Investigation report
While experimenting with nodejs worker_threads it quickly became apparent than trying to work with them in the yarn codebase, or in plugins is unfeasible, because of the single-file philosophy enforced by webpack bundling.
There are a bunch of problems and inefficiencies with this approach:
yarn
needs to be executed, the entire bundle is parsed, regardless of which code-paths will be actually relevant for the command being ran.I think it would be worth investigating the following approach:
yarn pack
instead to bundle, and distribute plugins and yarn itself as azip
file.run-yarn.cjs
).yarn-berry.zip
) of separate, unobfuscated, non-bundled files. Optionally tree-shaken in-place via something like https://rollupjs.org/guide/en/#outputpreservemoduleszip
files, reducing support cost by making@yarnpkg/builder
unnecessary.zip
files, they could also be installed from a package registry by default, via the normalyarn
dependency installation mechanism.Benefits:
The text was updated successfully, but these errors were encountered: