nicolo-ribaudo / yarn-plugin-jsr

A Yarn plugin to improve the developer experience when working with JSR.
5 stars 0 forks source link

Native JSR support? #1

Open XiNiHa opened 6 months ago

XiNiHa commented 6 months ago

It looks like this plugin uses the npm compat layer. Is it possible to directly use the JSR registry instead? Or is that a Yarn limitation?

nicolo-ribaudo commented 6 months ago

It is more of a limitation of pre-installing the dependencies (via an "install") command rather than resolving them at runtime, like Deno does.

Suppose there is a @lodash/lodash library with a bunch of entry-points (./map, ./reduce, etc). In Deno, you would add @lodash/lodash to you deno.json#imports and then at runtime Deno sees that you are importing @lodash/lodash/map and downloads it.

Give that Yarn downloads file before runtime execution, there is no way to know which imports you will use and thus it would still have to download all of them just in case. For this, using the JSR api directly doesn't give any benefit over just using the npm compat layer.