diff --git a/.changeset/clean-melons-attack.md b/.changeset/clean-melons-attack.md deleted file mode 100644 index 8b5a9f2066..0000000000 --- a/.changeset/clean-melons-attack.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'svelte': patch ---- - -fix: include wrapping parentheses in `{@const}` declarator `end` position diff --git a/.changeset/quick-meals-shout.md b/.changeset/quick-meals-shout.md deleted file mode 100644 index 21871edd67..0000000000 --- a/.changeset/quick-meals-shout.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'svelte': patch ---- - -fix: don't notify `searchParams` subscribers when the URL changes without affecting the search string diff --git a/packages/svelte/CHANGELOG.md b/packages/svelte/CHANGELOG.md index 02dd84ddff..80b61facb0 100644 --- a/packages/svelte/CHANGELOG.md +++ b/packages/svelte/CHANGELOG.md @@ -1,5 +1,17 @@ # svelte +## 5.56.4 + +### Patch Changes + +- fix: include wrapping parentheses in `{@const}` declarator `end` position ([#18436](https://github.com/sveltejs/svelte/pull/18436)) + +- fix: always unset reactivity context after restoring it ([#18453](https://github.com/sveltejs/svelte/pull/18453)) + +- fix: don't notify `searchParams` subscribers when the URL changes without affecting the search string ([#18425](https://github.com/sveltejs/svelte/pull/18425)) + +- fix: strip `?` from optional parameters in ` + + + + + +

count: {count}

+

submits: {submits}

+

pending: {$effect.pending()}

+

{await a + await b}

diff --git a/packages/svelte/tests/snapshot/samples/typescript-optional-parameter/_expected/client/index.svelte.js b/packages/svelte/tests/snapshot/samples/typescript-optional-parameter/_expected/client/index.svelte.js new file mode 100644 index 0000000000..3593b6c65e --- /dev/null +++ b/packages/svelte/tests/snapshot/samples/typescript-optional-parameter/_expected/client/index.svelte.js @@ -0,0 +1,22 @@ +import 'svelte/internal/disclose-version'; +import 'svelte/internal/flags/legacy'; +import * as $ from 'svelte/internal/client'; + +export default function Typescript_optional_parameter($$anchor) { + // the `?` on the optional parameter must be stripped, but optional chaining + // (`x?.length`, `o?.b`) must be preserved + function a(x) { + return x?.length; + } + + const o = {}; + const v = o?.b?.c; + + a(); + $.next(); + + var text = $.text(); + + $.template_effect(() => $.set_text(text, v)); + $.append($$anchor, text); +} \ No newline at end of file diff --git a/packages/svelte/tests/snapshot/samples/typescript-optional-parameter/_expected/server/index.svelte.js b/packages/svelte/tests/snapshot/samples/typescript-optional-parameter/_expected/server/index.svelte.js new file mode 100644 index 0000000000..d6c5e271f0 --- /dev/null +++ b/packages/svelte/tests/snapshot/samples/typescript-optional-parameter/_expected/server/index.svelte.js @@ -0,0 +1,15 @@ +import * as $ from 'svelte/internal/server'; + +export default function Typescript_optional_parameter($$renderer) { + // the `?` on the optional parameter must be stripped, but optional chaining + // (`x?.length`, `o?.b`) must be preserved + function a(x) { + return x?.length; + } + + const o = {}; + const v = o?.b?.c; + + a(); + $$renderer.push(`${$.escape(v)}`); +} \ No newline at end of file diff --git a/packages/svelte/tests/snapshot/samples/typescript-optional-parameter/index.svelte b/packages/svelte/tests/snapshot/samples/typescript-optional-parameter/index.svelte new file mode 100644 index 0000000000..f6bcb53e47 --- /dev/null +++ b/packages/svelte/tests/snapshot/samples/typescript-optional-parameter/index.svelte @@ -0,0 +1,14 @@ + + +{v} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e86c927efe..6331fd0789 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -102,8 +102,8 @@ importers: specifier: ^1.2.1 version: 1.2.1 esrap: - specifier: ^2.2.11 - version: 2.2.11(@typescript-eslint/types@8.59.4) + specifier: ^2.2.12 + version: 2.2.12(@typescript-eslint/types@8.59.4) is-reference: specifier: ^3.0.3 version: 3.0.3 @@ -1418,8 +1418,8 @@ packages: resolution: {integrity: sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==} engines: {node: '>=0.10'} - esrap@2.2.11: - resolution: {integrity: sha512-gPdx+I+BjYEinNMQaBXFjbaJVyoPMU4ZODg5mE+M4DqVG9VusAVHHjcBX+zqyITlI0DIARwDMMzZwAWj36dRoQ==} + esrap@2.2.12: + resolution: {integrity: sha512-On0QbLyaiAkVC4eXtgnXK9Kh2opit+3rcUSOc45DqJ2s/X2eXAHsGOKRSJ6IDagQEW5vPyivANfXUiqgXC67Rw==} peerDependencies: '@typescript-eslint/types': ^8.2.0 peerDependenciesMeta: @@ -2886,7 +2886,7 @@ snapshots: '@jridgewell/gen-mapping@0.3.5': dependencies: '@jridgewell/set-array': 1.2.1 - '@jridgewell/sourcemap-codec': 1.5.0 + '@jridgewell/sourcemap-codec': 1.5.5 '@jridgewell/trace-mapping': 0.3.31 '@jridgewell/remapping@2.3.4': @@ -3695,7 +3695,7 @@ snapshots: dependencies: estraverse: 5.3.0 - esrap@2.2.11(@typescript-eslint/types@8.59.4): + esrap@2.2.12(@typescript-eslint/types@8.59.4): dependencies: '@jridgewell/sourcemap-codec': 1.5.5 optionalDependencies: