refactor(astro): add internal entry points for test#16473
refactor(astro): add internal entry points for test#16473ocavue wants to merge 3 commits intowithastro:mainfrom
Conversation
|
bb7b084 to
bdb23b3
Compare
bdb23b3 to
0cfd80d
Compare
ematipico
left a comment
There was a problem hiding this comment.
This is a bigger change that might require updating the contribution guidelines. Can you do that please?
|
Will do |
|
For test related things like loadFixture, could we instead have an internal workspace non published package? That would make more sense to me. For AstroLogger I'd say it depends. Feels like a may be public soon with Ema's work |
There are multiple approaches to doing it, each with different trade-offs. Here are three examples (I can think of more, but they are similar).
I chose 1 in this PR because it's the one with the fewest git diffs, doesn't require any prerequisites, and fits the existing file/package structure, so it's the easiest one to land. But I'm also open to other approaches. |
Changes
In other packages in this repo, we sometimes want to import the internal API from
astro. Previously, we relied on a long relative path, which is not only ugly but also doesn't function well for typescript project references.This PR introduces
astro/_internal/...entry points that export some internal APIs for testing purposes. Here are some examples:We don't want these
astro/_internal/...entry points to be published to the NPM registry. I use PNPM'spublishConfigfeature to override theexportsfield when publishing.Testing
Since we now have both
exportsandpublishConfig.exportsinpackages/astro/package.json, I've added a test inpackages/astro/test/exports.test.tsto ensure that these two objects stay in sync with each other. This prevents the case that someone adds a new entry point inexportsbut forgets to add it inpublishConfig.exports.Docs
No public API change so no changeset file.
CONTRIBUTING.mdis updated.Part of #16241