Fix asynchronous appEntrypoint
support
#9558
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
Fixes #9557, a regression which has broken the (admittedly niche) use case of an asynchronous
appEntrypoint
function. The changes introduced in #9362 led the potentially asynchronous setup method to be wrapped in a synchronous function, making theawait setup()
in[server,client].js
more-or-less useless. This PR makes the virtual module's wrapper methodasync
as well, bringing back support for asynchronousappEntrypoint
s.Testing
A simple test for this scenario was added, which leverages two components registered globally in the
appEntrypoint
script separated by a simulated asynchronous call to ensure that registration works correctly following an async call within an async entrypoint script.Docs
Not sure if docs will be needed as this is a pretty niche use case, but it is certainly nice to have. I'll be happy to add to the docs if it would be appropriate.
/cc @withastro/maintainers-docs