Skip to content

Conversation

@yanthomasdev
Copy link
Member

@yanthomasdev yanthomasdev commented May 22, 2025

Changes

This adds a new suppress option to the supportedAstroFeatures of setAdapter in core. You can either set "all" to suppress both the default and custom log, or "default" to only suppress the default log.

The idea is that integration authors can suppress the log if a feature is supported in a specific condition, or if the default log can be conflicting and confuse users. You can take #13817 as an example of when this happens.

Originally, I intended to make suppress a boolean option while also changing so you only log the custom message if provided, but doing so would imply a breaking change (I think?). So I went with this solution.

Testing

Added a new fixture: packages/astro/test/fixtures/feature-support-message-suppresion

Not sure how I'd go about testing this automatically, but manually:

pnpm install
pnpm build
cd packages/astro/test/fixtures/feature-support-message-suppresion
pnpm dev

You should see that the dev server has only a "This should be logged." warning from [adapter]. You can see in the fixture that there's an example of both using a suppress: "default" and suppress: "all".

setAdapter({
  name: 'astro-test-feature-support-message-suppression',
  supportedAstroFeatures: {
    staticOutput: "stable",
    hybridOutput: "stable",
    serverOutput: {
      support: "experimental",
      message: "This should be logged.",
      suppress: "default",
    },
    sharpImageService: {
      support: 'limited',
      message: 'This shouldn\'t be logged.',
      suppress: "all",
    },
  }
})

Docs

PR: withastro/docs#11825

@changeset-bot
Copy link

changeset-bot bot commented May 22, 2025

🦋 Changeset detected

Latest commit: 7fbd8a6

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: astro Related to the core `astro` package (scope) docs pr labels May 22, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented May 22, 2025

CodSpeed Performance Report

Merging #13842 will not alter performance

Comparing suppress-supported-features-log-option (908afe9) with main (fbcfa68)

Summary

✅ 6 untouched benchmarks

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Thank you @yanthomasdev! This is a new feature, so we need to add a minor changeset. If you really want you could direct this PR to the cloudflare one and do everything in one go. The next minor is in two weeks, so we have time

@github-actions github-actions bot added the semver: minor Change triggers a `minor` release label May 23, 2025
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.

@yanthomasdev yanthomasdev changed the base branch from main to cloudflare-log-improv May 23, 2025 23:43
Copy link
Contributor

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

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

Just a few typos in docs, otherwise all good

@ascorbic ascorbic added this to the v5.9.0 milestone Jun 3, 2025
Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

Two tiny suggestions for the changeset @yanthomasdev , but the messages look fantastic!

Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Matt Kane <[email protected]>
@yanthomasdev yanthomasdev merged commit 1790283 into cloudflare-log-improv Jun 3, 2025
15 checks passed
@yanthomasdev yanthomasdev deleted the suppress-supported-features-log-option branch June 3, 2025 12:59
@ascorbic ascorbic restored the suppress-supported-features-log-option branch June 3, 2025 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs pr 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