-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(astro): Exposes extra APIs for script and testing (#12052)
Co-authored-by: Matt Kane <[email protected]> Co-authored-by: Sarah Rainsberger <[email protected]> Co-authored-by: Emanuele Stoppa <[email protected]> Co-authored-by: matthewp <[email protected]> Co-authored-by: sarah11918 <[email protected]> Co-authored-by: ematipico <[email protected]> Co-authored-by: bluwy <[email protected]> Co-authored-by: ascorbic <[email protected]> Co-authored-by: florian-lefebvre <[email protected]>
- Loading branch information
1 parent
eb47231
commit 5be12b2
Showing
7 changed files
with
48 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
'astro': minor | ||
--- | ||
|
||
Exposes extra APIs for scripting and testing. | ||
|
||
### Config helpers | ||
|
||
Two new helper functions exported from `astro/config`: | ||
|
||
- `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. | ||
|
||
### Programmatic build | ||
|
||
The `build` API now receives a second optional `BuildOptions` argument where users can specify: | ||
|
||
- `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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters