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

Support Svelte 5 (experimental) #9098

Merged
merged 6 commits into from
Nov 15, 2023
Merged

Support Svelte 5 (experimental) #9098

merged 6 commits into from
Nov 15, 2023

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Nov 14, 2023

Changes

Add experimental support for Svelte 5. This PR needs more testing, but seems to cover the common cases.

NOTE: When testing this locally, the svelte devdep in @astrojs/svelte needs to be bumped to 5.0.0-next.1.

Testing

n/a. manual testing for now until Svelte 5 is stable.

Docs

Updated README to note supported Svelte versions

Copy link

changeset-bot bot commented Nov 14, 2023

🦋 Changeset detected

Latest commit: 6e49574

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: svelte Related to Svelte (scope) pkg: integration Related to any renderer integration (scope) labels Nov 14, 2023
Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

Looks good so far! Bummer that slots continue to be hacky, but I guess Astro's use case is quite niche.

packages/integrations/svelte/src/index.ts Outdated Show resolved Hide resolved
};

if (!isSvelte5) {
// @ts-ignore
defaultOptions.compilerOptions.hydratable = true;
Copy link
Member

Choose a reason for hiding this comment

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

Interesting! Hydration is removed in Svelte 5? Is there any way to use hydratable Svelte components (4.0 or earlier) in a Svelte 5 project?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hydratable is enabled by default in Svelte 5. If you pass hydratable: true, it'll show a warning that you don't have to pass it now. I'll add a note here.

@github-actions github-actions bot added the pr: docs A PR that includes documentation for review label Nov 15, 2023
@bluwy bluwy marked this pull request as ready for review November 15, 2023 14:54
@bluwy
Copy link
Member Author

bluwy commented Nov 15, 2023

Ready for review! The new -v5.js files are mostly copies of the non-v5.js files, but with Svelte 5 code. Mainly because Svelte 5 needs to import certain modules that doesn't exist in Svelte 4, so it needs a separate file.

Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

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

Nice! Everything LGTM. This is very similar to how we've handled majors for React in the past.

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.

LGTM @bluwy !

@bluwy bluwy merged commit a600c14 into main Nov 15, 2023
13 checks passed
@bluwy bluwy deleted the svelte-5-support branch November 15, 2023 15:40
This was referenced Nov 15, 2023
peng added a commit to peng/astro that referenced this pull request Nov 17, 2023
* main:
  feat(i18n): add `Astro.currentLocale` (withastro#9101)
  [ci] release (withastro#9107)
  Add compatibility with cloudflare node (withastro#8925)
  [ci] format
  Cancel response stream when connection closes (withastro#9071)
  [ci] format
  feat(i18n): apply specific routing logic only to pages (withastro#9091)
  feat(dev-overlay): Hide plugins into a separate menu when there's too many enabled (withastro#9102)
  [ci] format
  Support Svelte 5 (experimental) (withastro#9098)
  [ci] release (withastro#9078)
  [ci] format
  Refactor shikiji syntax highlighting code (withastro#9083)
  [ci] format
  fix: Query params trigger the trailingSlash error in preview mode (withastro#9045)
  fix(assets): bundling regression for specific config on non-Node runtimes (withastro#9087)
natemoo-re added a commit that referenced this pull request Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: integration Related to any renderer integration (scope) pkg: svelte Related to Svelte (scope) pr: docs A PR that includes documentation for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants