-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat(astro): Exposes extra APIs for script and testing #12052
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 0cd9fc0 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
* @internal only used for testing | ||
* When building multiple projects in the same execution (e.g. during tests), disabling | ||
* this option can greatly improve performance at the cost of some extra memory usage. | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep this internal still. I imagine for external libraries this shouldn't have a significant impact if not used since it only mattered for Astro having tons of tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Astro has around 2,000 tests. For companies requiring high reliability, it is not uncommon to have very exhaustive testing on libraries (at least for the companies I know that fit that description, including mine).
Multiple of our libraries for Next have over 10k tests each. Libraries for Astro (which we are working on) won't be any less tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't related to the number of test, but the number of builds for tests. Astro has many builds to test different permutations of all features and I doubt the same is needed for external libraries. Even so, Astro's test suite is due for some fixtures reduction because some fixtures could be combined, so in practice this option isn't really encouraged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been months, and we talked about this on the call in the meantime. Now that I've changed downstream packages, it seems the effects are the opposite of what I expected.
At the scale of Inox Tools, this indeed doesn't make much difference regarding performance. Initializing the compiler was a very small part of the test time. However, it does have a big difference in memory usage. Contrary to my expectations, it reduces memory usage by about 20% when tests have concurrency enabled.
Although it uses more memory as an overhead in later steps by not discarding the compiler, it actually saves memory overall. Without disabling teardown, tests running on the same isolate can discard the compiler while it's still in use by a different test, resulting in multiple instances of the compiler service existing in memory at the same time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Fryuni for kicking off this! I am going to block this PR for now, while we agreed on a plan on how to ship this new feature on Discord.
!preview test-apis |
Snapshots have been released for the following packages:
Publish Log
Build Log
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the meeting we had, I am good now. Happy to merge it!
Co-authored-by: Matt Kane <[email protected]>
Should there be? 😅 |
@Fryuni what's the status of the PR? Considering this is a minor and we are exposing new APIs, I believe we should document them. Happy to help if needed. |
CodSpeed Performance ReportMerging #12052 will not alter performanceComparing Summary
|
Coming back to this PR (finally). I opened Fryuni/inox-tools#203 updating the Previously we talked about testing it out on the adapters repo, but since they are now part of this repo I don't think that would be necessary. |
Just reminding @Fryuni to loop me in re: what might be required for docs! Just because something wasn't documented before doesn't mean it shouldn't have been... 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just quick changeset comments!
Co-authored-by: Sarah Rainsberger <[email protected]>
|
||
Fixes incorrect config update when calling `updateConfig` from `astro:build:setup` hook. | ||
|
||
The function previously called a custom update config function made for merging an Astro config, Now it calls the appropriate `mergeConfig` utility exported by Vite that updates functional options correctly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function previously called a custom update config function made for merging an Astro config, Now it calls the appropriate `mergeConfig` utility exported by Vite that updates functional options correctly. | |
The function previously called a custom update config function made for merging an Astro config. Now it calls the appropriate `mergeConfig()` utility exported by Vite that updates functional options correctly. |
just nits!
- `mergeConfig` allows users to merge partially defined Astro configurations on top of a base config while following the merge rules of `updateConfig` available for integrations; | ||
- `validateConfig` allows users to validate that a given value is a valid Astro configuration and fills in default values as necessary; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `mergeConfig` allows users to merge partially defined Astro configurations on top of a base config while following the merge rules of `updateConfig` available for integrations; | |
- `validateConfig` allows users to validate that a given value is a valid Astro configuration and fills in default values as necessary; | |
- `mergeConfig()` allows users to merge partially defined Astro configurations on top of a base config while following the merge rules of `updateConfig()` available for integrations. | |
- `validateConfig()` allows users to validate that a given value is a valid Astro configuration and fills in default values as necessary. | |
These helpers are particularly useful for integration authors and for developers writing scripts that need to manipulate Astro configurations programmatically. |
nits!
Also, I like Matt's wording from the blog here!
- `devOutput` (default `false`): output a development-based build similar to code transformed in `astro dev`; | ||
- `teardownCompiler` (default `true`): teardown the compiler WASM instance after build. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `devOutput` (default `false`): output a development-based build similar to code transformed in `astro dev`; | |
- `teardownCompiler` (default `true`): teardown the compiler WASM instance after build. | |
- `devOutput` (default `false`): output a development-based build similar to code transformed in `astro dev`. | |
- `teardownCompiler` (default `true`): teardown the compiler WASM instance after build. | |
These options provide more control when running Astro builds programmatically, especially for testing scenarios or custom build pipelines. |
Same kind of nits/addition of blog post extra context!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving for docs, with some nits below and additional "commentary" for your consideration @Fryuni ! I trust you to take it from here! 🫡
Also noting, to remind myself as much as anyone, I did not see any new error messages added to accompany this feature.
Changes
Testing
There was no change in logic. The behavior for all changed functions was already tested.
Docs
build
API should be updatedastro/config
, so nothing to update. The two functions newly exported would go in such a reference.