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: add hasUnscopedGlobalCss to compile metadata #15450

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

paoloricciuti
Copy link
Member

Closes #15449

From my tests it should be basically it (it's missing the --global keyframes but i'm gonna add them now) but please try to break it.

No test because we don't have a test suite for the compiled output...should we add it?

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

Copy link

changeset-bot bot commented Mar 5, 2025

🦋 Changeset detected

Latest commit: ee4869f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Minor

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

@svelte-docs-bot
Copy link

Copy link
Contributor

github-actions bot commented Mar 5, 2025

Playground

pnpm add https://pkg.pr.new/svelte@15450

@Rich-Harris
Copy link
Member

This feels very specific to vite-plugin-svelte, and given that zimmerframe is already in the dependency graph for anyone using it, the cost of doing the work inside vite-plugin-svelte feels very small, especially with the .includes(':global') check.

Given that, do we really want to add it here? It adds more code to svelte than vite-plugin-svelte would be able to remove, and the 'other tools' argument feels a bit hypothetical.

If the answer is 'yes' then I'd at least suggest changing the API so that it's result.css?.hasGlobal rather than adding metadata.

@paoloricciuti
Copy link
Member Author

If the answer is 'yes' then I'd at least suggest changing the API so that it's result.css?.hasGlobal rather than adding metadata

Initially I added it there but it felt a bit wrong since we already have the metadata object. But if we want to move it it's fine too.

For the question of "should we do it" this could save one walk since we are already walking to analyze css but effectively does feels a bit specific.

At the end of the day the PR it's here, up to discuss if we want to do it, otherwise we can close it 😌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add "hasUnscopedGlobalCss" metadata to compiler ouput
3 participants