* feat: add hydrate method, make hydration treeshakeable
Introduces a new `hydrate` method which does hydration. Refactors code so that hydration-related code is treeshaken out when not using that method.
closes#9533
part of #9827
* get docs building
* ugh
* one more
* Update packages/svelte/scripts/check-treeshakeability.js
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
* warn
* Update sites/svelte-5-preview/src/routes/docs/content/01-api/05-functions.md
---------
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Add source map merging for preprocessors and get tests passing.
- fixed some issues around the `sources` array where they weren't calculated relative to the input correctly
- adjusted some CSS tests because due to our own CSS parser the AST is less granular, so there are less mappings now. Don't think this is a problem, but worth thinking about
- removed enableSourcemap but only log a warning, the reason this was introduced was to mitigate a bug in Vite which occured when having the source map inlined into the SSR'd output. Since SSR doesn't contain inlined CSS anymore (and if it did, we would omit the source map) the reason for which it was introduced no longer exists
- files without js mapping in it have no source mappings yet (originally added in Svelte 4 for #6092)
* rename $derived.call to $derived.by
* more replacements, plus a compiler error
* regenerate types
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Closes#9420.
This PR creates an $effect.pre (before beforeUpdate and an $effect (for afterUpdate) and, inside those, listen for all locally declared signals plus reactive props. This does mean that we need to link the locally declared signals to the component context (the reverse of the current behaviour, wherein we link the component context to locally declared signals).
* give this another try
* fix: lint
* fix: Forgot to save
* feat: it works boiiii
* look, ok, it did work, i just needed to update the snapshots
* bruh
* changeset
* feat: ok I think the client snippet block finally works
* feat: current tests pass; I'm sure I'm missing stuff for new things
* fix: snapshot
* feat: I think non-destructured rest should work now?
* chore: duplicated computation
* feat: Tests (passing and failing
* feat: it's... alive?
* chore: Clean up my messes
* chore: devtime stuff
* fix: fmt
* chore: see if this fixes repl
* chore: make naming more offensive
* fix: Don't throw on missing keys, return undefined as it usually would
* Update packages/svelte/src/compiler/phases/1-parse/state/tag.js
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Update packages/svelte/src/compiler/phases/1-parse/state/tag.js
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* fix: Hopefully default param values now work
* dumb
* types
* feat: Test it
* fix: Turns out javascript parameters are optional
* feat: The Final Solution
* document function
* feat: Better bracket matching, unit tests
* feat: exclude test files from publish
* feat: More unit tests
* feat: Use more efficient parsing for @const
* Update .changeset/curvy-cups-cough.md
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Update packages/svelte/package.json
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Update packages/svelte/src/compiler/phases/1-parse/utils/bracket.js
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* fix: changesets
* chore: additional comments
* fix: kill foreach
* fix: foreach again
* feat: Docs
* Revert "fix: kill foreach"
This reverts commit 9a688cc543.
* fix: My own stupidity
* fix: style
* fix - maybe
* Update sites/svelte-5-preview/src/routes/docs/content/01-api/03-snippets.md
* Update tag.js
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
* Update .changeset/curvy-cups-cough.md
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* chore: Remove rest params
* Delete .changeset/eighty-rivers-wash.md
* fix: Honestly idk why it was broken but it's fixed now
* fix: var name lol
* fix: typegen
* fix: idk
* fix: It looks like a bunch of unformatted shit came in through main?? idk
* Revert "fix: It looks like a bunch of unformatted shit came in through main?? idk"
This reverts commit ab851d5627.
* fix: format again
* this is getting ridiculous
* Update tag.js
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
* fix errors
* simplify a bit
* use read_context
* use read_context for const as well
* remove unused code
* unused import
* unused export
* remove spread args. sorry elliott
* tidy up SnippetBlock interface
* fix test
* simplify
* tweak
* revert example, so that it matches the surrounding text
* move PropsWithChildren back to public.d.ts
* update typing docs, so that it flows from previous example
* temporarily revert const parsing changes, to get prettier working again (???)
* oops
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Someone could programmatically add a class to an element and Svelte doesn't see it, so having global be part of a modifier is necessary so that Svelte doesn't mark it as unused
fixes#10210
also add event and snippets section to old vs new
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* feat: add unstate utility function
* Update packages/svelte/src/internal/client/proxy/proxy.js
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* update docs
* add class support
* oops
* lint
* fix docs
* remove symbol and class support
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
* magic objects
* read length eagerly — triggers reconciliation
* nested magic
* tests
* more tests
* fix array memory leak
* skipped, partially passing array test
* Fix each
revert bad changes
* more 1337
* eliminate closures
* maybe this is unnecessary?
* only create sources for own properties
* more
* rename stuff
* shuffle things around
* emit $.proxy
* remove proxy helper from public API
* only create sources for writable properties
* update test
* get tests passing
* fix
* remove state-not-mutated warning, which is no longer valid
* track reassignments separately from mutations
* update test - effects no longer fire on mutations unnecessarily
* move util into utils file
* move each logic into its own module; breathe sigh of relief
* tweaks
* more tweaks
* improve runtime
* fix mistake
* ensure we proxy when assigning to state
* fix test
* handle frozen
* create sources when reading proxy properties inside deriveds
* only mutate in legacy mode
* add immutable to transform state
* remove unused second argument to derived
* remove unused second argument to source, and runtime immutable option to createRoot (not sure what that was doing there?)
* oops, backwards
* dedicated binding.kind for legacy reactive imports
* avoid using prop_source in more cases. bit hacky, could be tidier, but it works
* distinguish between source and mutable_source
* remove immutable option from mount
* remove unused apparatus around immutable option
* deprecate immutable
* fix
* tweak
* better default value handling
* remove unnecessary exports
* whitespace is free
* remove obsolete symbol from proxy
* cleanup ts
* improve runtime perf by removing version reads in has()
* add missing proxy call
* tune perf of has() more
* ensure we only create sources in effect_active()
* fix proxy of computed fields
* simplify and fix issue with indexed each blocks
* fix compiler errors around exported state
* only create source for state that is reassigned
* temporary fix, we should come up with something better than this
* readonly props
* fix test
* add test for bind:
* make readonly dev-only
* docs
* forbid setPrototypeOf
* lol whoops
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Dominic Gannaway <dg@domgan.com>
* rename file
* add snippet docs
* add note on deprecation
* they're not attributes
* event docs
* prettier
* remove unnecessary div
* Apply suggestions from code review
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* make example less confusing
* note breaking props.children change
---------
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* lets see if this works
* fix versions
* sigh
* debugging ci is sooo fun
* oh wow
* fix stuff, changelog, add back readme
* appease prettier
* format stuff
* feat: OnThisPage blog
### 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.
### Tests and linting
- [ ] Run the tests with `pnpm test` and lint the project with `pnpm lint`
* Bump site-kit
* Add content
Our core web vitals have really taken a hit since enabling edge serving. I ran various configs against pagespeed.web.dev and the traditional serverless functions do the best. That's at least partially because I believe serverless functions default to running in us-east-1 where our supabase instance is located. Therefore try going back to Serverless for a while to see the impact.
* use lighteningcss
* Update sites/svelte.dev/package.json
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
* Update vite
* use browserlist
---------
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
* Fix svelte.dev running locally instructions
After a clean clone, the `svelte` package needs to have its `/types`
directory generated for `pnpm dev` to work
* Update note about REPL
Firefox supports `import` in workers since version 114; confirmed that
the REPL works with `pnpm dev` in Firefox
* simplify nav
* updates
* fix link
* Dont need this anymore
* bump
---------
Co-authored-by: Rich Harris <git@rich-harris.dev>
Co-authored-by: Puru Vijay <devpuruvj@gmail.com>
* DocsNav
* Push
* Nav title on each page
* Install jridgewell sourcemap codec. Why it breaking suddenly
* Use theme store
* Use $nav_title
* use $page.data.nav_title
* Disable global prerendering
* Fix Suppprters section
* use new method
* Initially hidden nav functionality
* Minor fixes
* Simplify into one single nav
* Accomodate to the bottom nav
* Minor fixes
* nit
* Add selected to other pages as well
* New way of passing to navbar
* Code cleanup
* Directly pass list instead of components
* 14 days
* Fix comment
* Discord icon
* Homepage styles
* More tweak, extra CTA
* Bigger lowercase tagline
* Preload overpass for transitions demo
* Tweak for ipad air
* Remove letter spacing
* simplify home page styles (#8738)
* simplify
* fix
* slightly better use of space
* tiny bit more room
* read the docs
* crop image
* very minor tweak
* another breakpoint
* tweak
* actually it works down to 1400px
---------
Co-authored-by: Rich Harris <git@rich-harris.dev>
---------
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
Co-authored-by: Rich Harris <git@rich-harris.dev>
* DocsNav
* Push
* Nav title on each page
* Install jridgewell sourcemap codec. Why it breaking suddenly
* Use theme store
* Use $nav_title
* use $page.data.nav_title
* Disable global prerendering
* Fix Suppprters section
* use new method
* Initially hidden nav functionality
* Minor fixes
* Simplify into one single nav
* Accomodate to the bottom nav
* Minor fixes
* nit
* Add selected to other pages as well
* New way of passing to navbar
* Code cleanup
* Directly pass list instead of components
* 14 days
* Fix comment
* Discord icon
* Bump site-kit finally
* New FAQ, new renderer
* Push blog stuff
* Fix blog posts
* Add tutorial to be rendered
* Update documentation/content/blog/2023-03-09-zero-config-type-safety.md
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Update documentation/content/blog/2023-03-09-zero-config-type-safety.md
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Revamp a lot of renderer, make it (soft) compatible with sveltekit
* Remove markdown types
* Clean up faq +page
* Document stuff
* Make the options more explicity
* chore(site-2): Restructure docs pt 2 (#8604)
* Push
* Update readme
* Push
* inor accessibility fix
* minr stuff
* Add prepare
* Run prettier
* Remove test script
* pnpm update
* Update sites/svelte.dev/src/routes/examples/[slug]/+page.svelte
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Update sites/svelte.dev/package.json
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Push
* Push
* Fix Contents order
* Skip link to left sidemenu
* Add text class
* use top-nav slot
* Improve imagetools
* Fix aria-label
* Bump site-kit