Closed bluwy closed 2 days ago
Latest commit: f1922389bdf5fbd266a2edd080cd7877f254ae7b
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Changes
We can use
require.resolve()
instead of theresolve
package for resolving.Also simplifies the resolving of
@astrojs/db
by hoisting it up so it can be resolved frompackages/astro/dist/cli/install-package.js
. While we could also install@astrojs/db
as a devdep inpackages/astro/package.json
to fix it, it would however create a cyclic workspace dependency betweenastro
,@astrojs/db
, and@astrojs/studio
.In order to simplify the code, I had to tweak the exports condition of
@astrojs/db
and@astrojs/studio
to allow importing ESM from CJS (byrequire.resolve
). This would also unblock a future Node.js feature where you could import ESM from CJS as long as there's no top-level await. In practice, I also find that it's best practice to use theimport
condition only if you have a correspondingrequire
condition.Testing
Tested manually in an external project and in one of the fixtures.
Docs
n/a. refactor only. I added a changeset as it removes a dependency (and would like to document this for users)