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: support server-rendering attributes of <svelte:html> blocks #13065

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dummdidumm
Copy link
Member

Companion to sveltejs/svelte#14397


Please don't delete this checklist! 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
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

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

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Copy link

changeset-bot bot commented Nov 27, 2024

🦋 Changeset detected

Latest commit: 832131f

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

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit 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

@Rich-Harris
Copy link
Member

preview: https://svelte-dev-git-preview-kit-13065-svelte.vercel.app/

this is an automated message

@@ -48,6 +48,7 @@ The `src` directory contains the meat of your project. Everything except `src/ro
- `%sveltekit.assets%` — either [`paths.assets`](configuration#paths), if specified, or a relative path to [`paths.base`](configuration#paths)
- `%sveltekit.nonce%` — a [CSP](configuration#csp) nonce for manually included links and scripts, if used
- `%sveltekit.env.[NAME]%` - this will be replaced at render time with the `[NAME]` environment variable, which must begin with the [`publicPrefix`](configuration#env) (usually `PUBLIC_`). It will fallback to `''` if not matched.
- `%svelte.htmlAttributes%` — the attributes collected from `<svelte:html>` blocks
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we should alphabetize these bullets?

@Conduitry
Copy link
Member

Has it been considered to make it a build-time error rather than a warning if someone tries to use <svelte:html> without the appropriate placeholder in their app.html? That feels safer to me. I can't imagine a good reason why someone would want to have these ignored.

I don't think doing that would be a breaking change. A given component starting to use <svelte:html> (or any other new Svelte feature) is what should be considered the breaking change. Solely upgrading SvelteKit wouldn't cause a problem.

@Rich-Harris
Copy link
Member

For that to work we'd need to read the source code of every imported component, even the ones in node_modules. We definitely could do that though it feels a bit on the grubby side

@Conduitry
Copy link
Member

Oh, right. How about a runtime error then, rather than the runtime warning this is emitting? I still think this is safer, and I still think it shouldn't be considered a breaking change in Kit - because the real breaking change is a library starting to use this new feature and bumping its Svelte peerdep.

@Rich-Harris
Copy link
Member

Per sveltejs/svelte#14397 (comment), I'm actually of the view that we shouldn't add this in any case (sorry)

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.

4 participants