Skip to content
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

refactor: use pipeline in Development mode #8115

Merged
merged 1 commit into from
Aug 17, 2023
Merged

Conversation

ematipico
Copy link
Member

Changes

This PR takes the pipeline concept into development mode.

The DevPipeline is very similar to the BuildPipeline. Like in the previous PR, the pipeline object is passed around, and functions request from it all the information that is needed.

This refactor removes the need for DevelopmentEnviroment: AstroSettings and ModuleLoader are stored in the DevPipeline, and functions use its getters getSettings and getModuleLoader.

I also removed tryRenderRoute, which was deprecated.

Testing

I updated some unit tests to use this new DevPipeline. Eventually, we should use a new TestPipeline for these kinds of tests, but not in this PR.

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Aug 17, 2023

⚠️ No Changeset found

Latest commit: 6f607ae

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Aug 17, 2023
Comment on lines +65 to +70
async loadRenderers() {
const renderers = await Promise.all(
this.#settings.renderers.map((r) => loadRenderer(r, this.#loader))
);
this.env.renderers = renderers.filter(Boolean) as SSRLoadedRenderer[];
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you can notice, the side effects stay inside the pipeline, so we can better control them.

@ematipico ematipico requested review from bluwy and matthewp August 17, 2023 13:32
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I notice this conflicts with the endpoint simple object deprecation + refactor I'm doing, so that callEndpoint can directly return a Response. Will hold that off for a bit until this is merged.

@ematipico
Copy link
Member Author

Looks great! I notice this conflicts with the endpoint simple object deprecation + refactor I'm doing, so that callEndpoint can directly return a Response. Will hold that off for a bit until this is merged.

Thank you! I had imagined :(

@ematipico ematipico merged commit bbf0b74 into next Aug 17, 2023
@ematipico ematipico deleted the feat/dev-pipeline-plt-764 branch August 17, 2023 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants