From bcf6b6a0202758080c101c00bb0442f0f53d95ff Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Tue, 10 May 2022 15:01:07 +0200 Subject: [PATCH] (chore) bump Svelte version (#1474) support for const in if blocks in new transformation #1470 --- packages/language-server/package.json | 2 +- packages/svelte2tsx/package.json | 2 +- .../test/htmlx2jsx/samples/if-block-const/expected.jsx | 10 ++++++++++ .../htmlx2jsx/samples/if-block-const/expectedv2.js | 10 ++++++++++ .../test/htmlx2jsx/samples/if-block-const/input.svelte | 10 ++++++++++ yarn.lock | 8 ++++---- 6 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 packages/svelte2tsx/test/htmlx2jsx/samples/if-block-const/expected.jsx create mode 100644 packages/svelte2tsx/test/htmlx2jsx/samples/if-block-const/expectedv2.js create mode 100644 packages/svelte2tsx/test/htmlx2jsx/samples/if-block-const/input.svelte diff --git a/packages/language-server/package.json b/packages/language-server/package.json index 9a14ee8e6..0ec222701 100644 --- a/packages/language-server/package.json +++ b/packages/language-server/package.json @@ -54,7 +54,7 @@ "lodash": "^4.17.21", "prettier": "2.5.1", "prettier-plugin-svelte": "~2.7.0", - "svelte": "^3.47.0", + "svelte": "^3.48.0", "svelte-preprocess": "~4.10.1", "svelte2tsx": "~0.5.0", "typescript": "*", diff --git a/packages/svelte2tsx/package.json b/packages/svelte2tsx/package.json index e976a57eb..2bf94c744 100644 --- a/packages/svelte2tsx/package.json +++ b/packages/svelte2tsx/package.json @@ -34,7 +34,7 @@ "rollup-plugin-delete": "^2.0.0", "source-map-support": "^0.5.16", "sourcemap-codec": "^1.4.8", - "svelte": "~3.47.0", + "svelte": "~3.48.0", "tiny-glob": "^0.2.6", "tslib": "^1.10.0", "typescript": "^4.6.2" diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/if-block-const/expected.jsx b/packages/svelte2tsx/test/htmlx2jsx/samples/if-block-const/expected.jsx new file mode 100644 index 000000000..937323313 --- /dev/null +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/if-block-const/expected.jsx @@ -0,0 +1,10 @@ +<>{(name == "world") ? <> + {@const hello = name} +

Hello {hello}

+ : (true) ? <> + {@const hello = name} +

Hello {hello}

+ : <> + {@const hello = name} +

Hello {hello}

+ } \ No newline at end of file diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/if-block-const/expectedv2.js b/packages/svelte2tsx/test/htmlx2jsx/samples/if-block-const/expectedv2.js new file mode 100644 index 000000000..33291a882 --- /dev/null +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/if-block-const/expectedv2.js @@ -0,0 +1,10 @@ +if(name == "world"){ + const hello = name; + { svelteHTML.createElement("h1", {}); hello; } +} else if (true){ + const hello = name; + { svelteHTML.createElement("h1", {}); hello; } +}else{ + const hello = name; + { svelteHTML.createElement("h1", {}); hello; } +} \ No newline at end of file diff --git a/packages/svelte2tsx/test/htmlx2jsx/samples/if-block-const/input.svelte b/packages/svelte2tsx/test/htmlx2jsx/samples/if-block-const/input.svelte new file mode 100644 index 000000000..05417176f --- /dev/null +++ b/packages/svelte2tsx/test/htmlx2jsx/samples/if-block-const/input.svelte @@ -0,0 +1,10 @@ +{#if name == "world"} + {@const hello = name} +

Hello {hello}

+{:else if true} + {@const hello = name} +

Hello {hello}

+{:else} + {@const hello = name} +

Hello {hello}

+{/if} diff --git a/yarn.lock b/yarn.lock index 363f8d603..307cb5616 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2539,10 +2539,10 @@ svelte-preprocess@~4.10.1: sorcery "^0.10.0" strip-indent "^3.0.0" -svelte@^3.47.0, svelte@~3.47.0: - version "3.47.0" - resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.47.0.tgz#ba46fe4aea99fc650d6939c215cd4694f5325a19" - integrity sha512-4JaJp3HEoTCGARRWZQIZDUanhYv0iyoHikklVHVLH9xFE9db22g4TDv7CPeNA8HD1JgjXI1vlhR1JZvvhaTu2Q== +svelte@^3.48.0, svelte@~3.48.0: + version "3.48.0" + resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.48.0.tgz#f98c866d45e155bad8e1e88f15f9c03cd28753d3" + integrity sha512-fN2YRm/bGumvjUpu6yI3BpvZnpIm9I6A7HR4oUNYd7ggYyIwSA/BX7DJ+UXXffLp6XNcUijyLvttbPVCYa/3xQ== table@^5.2.3: version "5.4.6"