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

feat(assets): Allow users to set a custom endpoint to use for image optimization #8467

Merged
merged 6 commits into from
Sep 13, 2023

Conversation

Princesseuh
Copy link
Member

Changes

What the title says!

Q: Why do we need this?
A: It unlocks the ability for adapters to set a endpoint that's more suited to their platform. For instance, maybe the Deno adapter would set an endpoint that uses Deno.readFile instead of using a fetch. We don't have those endpoints yet, but we could with this!

In addition, this is a nice things for users who want more control over the endpoint, especially in SSR you might want to use an empty endpoint or something to avoid having the image service bundled in completely.

This is ultimately a stepping stone to fix those three issues:

Testing

Added a test

Docs

Added docs!

@Princesseuh Princesseuh requested a review from a team as a code owner September 8, 2023 16:50
@changeset-bot
Copy link

changeset-bot bot commented Sep 8, 2023

🦋 Changeset detected

Latest commit: eeabe3e

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Sep 8, 2023
@github-actions github-actions bot added the semver: minor Change triggers a `minor` release label Sep 8, 2023
Copy link
Contributor

@github-actions github-actions bot left a 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.

Copy link
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

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

Thanks @Princesseuh! Just a couple of docs notes from me.

packages/astro/src/@types/astro.ts Outdated Show resolved Hide resolved
* {
* image: {
* // Example: Use a custom image endpoint
* endpoint: './src/image-endpoint.ts',
Copy link
Member

Choose a reason for hiding this comment

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

Do we have docs we could link to for what the contents of image-endpoint.ts should look like?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't, but there's kinda no defined shape for it, it's a normal endpoint, you can technically answer anything you want from it.

@Princesseuh Princesseuh merged commit ecc65ab into main Sep 13, 2023
@Princesseuh Princesseuh deleted the feat/custom-image-endpoint branch September 13, 2023 16:15
@astrobot-houston astrobot-houston mentioned this pull request Sep 13, 2023
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) semver: minor Change triggers a `minor` release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants