pull/16197/head
Rich Harris 4 months ago
commit f72d1a6326

@ -1,5 +0,0 @@
---
'svelte': patch
---
fix: correctly transform reassignments to class fields in SSR mode

@ -833,9 +833,9 @@ Svelte 5 is more strict about the HTML structure and will throw a compiler error
Assignments to destructured parts of a `@const` declaration are no longer allowed. It was an oversight that this was ever allowed.
### :is(...) and :where(...) are scoped
### :is(...), :has(...), and :where(...) are scoped
Previously, Svelte did not analyse selectors inside `:is(...)` and `:where(...)`, effectively treating them as global. Svelte 5 analyses them in the context of the current component. As such, some selectors may now be treated as unused if they were relying on this treatment. To fix this, use `:global(...)` inside the `:is(...)/:where(...)` selectors.
Previously, Svelte did not analyse selectors inside `:is(...)`, `:has(...)`, and `:where(...)`, effectively treating them as global. Svelte 5 analyses them in the context of the current component. As such, some selectors may now be treated as unused if they were relying on this treatment. To fix this, use `:global(...)` inside the `:is(...)/:has(...)/:where(...)` selectors.
When using Tailwind's `@apply` directive, add a `:global` selector to preserve rules that use Tailwind-generated `:is(...)` selectors:

@ -15,13 +15,10 @@
},
"scripts": {
"build": "pnpm -r --filter=./packages/* build",
"build:sites": "pnpm -r --filter=./sites/* build",
"preview-site": "npm run build --prefix sites/svelte-5-preview",
"check": "cd packages/svelte && pnpm build && cd ../../ && pnpm -r check",
"lint": "eslint && prettier --check .",
"format": "prettier --write .",
"test": "vitest run",
"test-output": "vitest run --coverage --reporter=json --outputFile=sites/svelte-5-preview/src/routes/status/results.json",
"changeset:version": "changeset version && pnpm -r generate:version && git add --all",
"changeset:publish": "changeset publish",
"bench": "node --allow-natives-syntax ./benchmarking/run.js",

@ -1,5 +1,25 @@
# svelte
## 5.33.14
### Patch Changes
- Revert "feat: enable TS autocomplete for Svelte HTML element definitions" ([#16063](https://github.com/sveltejs/svelte/pull/16063))
- fix: destructuring snippet arguments ([#16068](https://github.com/sveltejs/svelte/pull/16068))
## 5.33.13
### Patch Changes
- fix: avoid recursion error in `EachBlock` visitor ([#16058](https://github.com/sveltejs/svelte/pull/16058))
## 5.33.12
### Patch Changes
- fix: correctly transform reassignments to class fields in SSR mode ([#16051](https://github.com/sveltejs/svelte/pull/16051))
## 5.33.11
### Patch Changes

@ -2066,7 +2066,7 @@ export interface SvelteHTMLElements {
failed?: import('svelte').Snippet<[error: unknown, reset: () => void]>;
};
[name: string & {}]: { [name: string]: any };
[name: string]: { [name: string]: any };
}
export type ClassValue = string | import('clsx').ClassArray | import('clsx').ClassDictionary;

@ -2,7 +2,7 @@
"name": "svelte",
"description": "Cybernetically enhanced web apps",
"license": "MIT",
"version": "5.33.11",
"version": "5.33.14",
"type": "module",
"types": "./types/index.d.ts",
"engines": {

@ -77,6 +77,9 @@ export function EachBlock(node, context) {
* @returns {void}
*/
function collect_transitive_dependencies(binding, bindings) {
if (bindings.has(binding)) {
return;
}
bindings.add(binding);
if (binding.kind === 'legacy_reactive') {

@ -57,7 +57,7 @@ export function SnippetBlock(node, context) {
for (const path of paths) {
const name = /** @type {Identifier} */ (path.node).name;
const needs_derived = path.has_default_value; // to ensure that default value is only called once
const fn = b.thunk(/** @type {Expression} */ (context.visit(path.expression)));
const fn = b.thunk(/** @type {Expression} */ (context.visit(path.expression, child_state)));
declarations.push(b.let(path.node, needs_derived ? b.call('$.derived_safe_equal', fn) : fn));

@ -4,5 +4,5 @@
* The current version, as set in package.json.
* @type {string}
*/
export const VERSION = '5.33.11';
export const VERSION = '5.33.14';
export const PUBLIC_VERSION = '5';

@ -8,7 +8,7 @@ import * as svelteElements from './elements.js';
/**
* @internal do not use
*/
type HTMLProps<Property extends keyof svelteElements.SvelteHTMLElements, Override> = Omit<
type HTMLProps<Property extends string, Override> = Omit<
import('./elements.js').SvelteHTMLElements[Property],
keyof Override
> &
@ -250,7 +250,7 @@ declare global {
};
// don't type svelte:options, it would override the types in svelte/elements and it isn't extendable anyway
[name: string & {}]: { [name: string]: any };
[name: string]: { [name: string]: any };
}
}
}

@ -26,6 +26,7 @@ function clean_children(node, opts) {
});
attributes.forEach((attr) => {
// Strip out the special onload/onerror hydration events from the test output
if ((attr.name === 'onload' || attr.name === 'onerror') && attr.value === 'this.__e=event') {
return;
}
@ -67,6 +68,7 @@ function clean_children(node, opts) {
continue;
}
// add newlines for better readability and potentially recurse into children
if (child.nodeType === 1 || child.nodeType === 8) {
if (previous?.nodeType === 3) {
const prev = /** @type {Text} */ (previous);
@ -95,8 +97,9 @@ function clean_children(node, opts) {
text.data = text.data.trimEnd();
}
// indent code for better readability
if (has_element_children && node.parentNode) {
node.innerHTML = `\n\t${node.innerHTML.replace(/\n/g, '\n\t')}\n`;
node.innerHTML = `\n\ ${node.innerHTML.replace(/\n/g, '\n ')}\n`;
}
if (template) {

@ -0,0 +1,5 @@
import { test } from '../../test';
export default test({
html: `a`
});

@ -0,0 +1,9 @@
<script>
let array = $state(['a', 'b', 'c'])
</script>
{#snippet content([x])}
{x}
{/snippet}
{@render content(array)}
Loading…
Cancel
Save