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: astro features #7815

Merged
merged 4 commits into from
Jul 28, 2023
Merged

feat: astro features #7815

merged 4 commits into from
Jul 28, 2023

Conversation

ematipico
Copy link
Member

Changes

Introducing Astro features. Astro features are features that astro has out the box, and sometimes users can opt-in.
Few examples:

  • staticOutput if a user uses a specific adapter, the adapter needs to be able to serve those static assets. An example is Cloudflare, which doesn't support it.
  • assets: not supported by those adapters that are incompatible with node

This PR adds a new API that adapters can use when registering one. It's called supportedFeatures, and it's a new way to tell Astro if and when an adapter is able to support certain features that are enabled via configuration.

The adapter can also tell Astro the kind of support:

  • stable
  • experimental
  • unsupported
  • deprecated

For now, this new API/object is not mandatory, but it will be in Astro 4.0.

The PR also updates the adapters that we maintain, and it adds the feature map to them.

About assets

There's a small caveat for the assets. Astro assets is a feature that is already turned on by default, meaning that Astro sets already a default service. This means that adapters that don't support assets will always get an error, which is inconvenient. I came up with a solution where we set the default after the adapter validation, although I don't like the solution very much, and I wonder if there's a better way to handle a case like this.

The assets feature is just an example; we might have the same problem with future features like this. What do you suggest?

Testing

I added new unit test cases and updated the existing ones.

Docs

I will create the changelog in another PR

@ematipico ematipico requested a review from a team as a code owner July 26, 2023 12:57
@changeset-bot
Copy link

changeset-bot bot commented Jul 26, 2023

🦋 Changeset detected

Latest commit: 728d4e7

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 pkg: integration Related to any renderer integration (scope) pkg: astro Related to the core `astro` package (scope) semver: minor Change triggers a `minor` release labels Jul 26, 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.

@ematipico ematipico force-pushed the feat/astro-features branch 4 times, most recently from 6f0715f to 48c1146 Compare July 26, 2023 13:30
@github-actions github-actions bot added the pkg: example Related to an example package (scope) label Jul 26, 2023
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.

The general validation logic looks great! Got some questions/comments about some things

packages/astro/src/integrations/index.ts Outdated Show resolved Hide resolved
packages/astro/src/integrations/index.ts Outdated Show resolved Hide resolved
packages/astro/src/integrations/index.ts Outdated Show resolved Hide resolved
packages/astro/src/@types/astro.ts Outdated Show resolved Hide resolved
@github-actions github-actions bot added pkg: svelte Related to Svelte (scope) pkg: vue Related to Vue (scope) 🚨 action Modifies GitHub Actions pkg: react Related to React (scope) pkg: preact Related to Preact (scope) pkg: solid Related to Solid (scope) pkg: lit Related to Lit (scope) pkg: create-astro Related to the `create-astro` package (scope) labels Jul 26, 2023
@ematipico ematipico changed the title feat: support features for adapters feat: astro features Jul 26, 2023
@ematipico ematipico force-pushed the feat/astro-features branch 2 times, most recently from 321d44d to 71ad64b Compare July 27, 2023 08:22
@github-actions github-actions bot removed pkg: svelte Related to Svelte (scope) pkg: vue Related to Vue (scope) 🚨 action Modifies GitHub Actions pkg: react Related to React (scope) pkg: preact Related to Preact (scope) labels Jul 27, 2023
@matthewp
Copy link
Contributor

Should the values be lower-case? When we have string flags like this elsewhere in the code I'm pretty sure they are lower-case.

@ematipico ematipico force-pushed the feat/astro-features branch 2 times, most recently from 5fc1afc to 4b3085e Compare July 27, 2023 14:09
@ematipico
Copy link
Member Author

@matthewp that's addressed now, thank you

packages/astro/src/integrations/index.ts Outdated Show resolved Hide resolved
packages/astro/src/integrations/index.ts Outdated Show resolved Hide resolved
.changeset/dirty-lies-cover.md Outdated Show resolved Hide resolved
@ematipico ematipico requested a review from bluwy July 28, 2023 08:22
@github-actions github-actions bot removed the pkg: example Related to an example package (scope) label Jul 28, 2023
@ematipico ematipico merged commit 3c25e5e into next Jul 28, 2023
@ematipico ematipico deleted the feat/astro-features branch July 28, 2023 11:15
ematipico added a commit that referenced this pull request Jul 31, 2023
ematipico added a commit that referenced this pull request Aug 1, 2023
ematipico added a commit that referenced this pull request Aug 1, 2023
ematipico added a commit that referenced this pull request Aug 3, 2023
ematipico added a commit that referenced this pull request Aug 8, 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) pkg: integration Related to any renderer integration (scope) semver: minor Change triggers a `minor` release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants