From 993add6c4626cda87a1daa0eb6a2d18a27ba1a34 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Mon, 15 Apr 2024 22:54:51 +0200 Subject: [PATCH 1/2] feat: add self-closing-tags migration Companion to sveltejs/svelte#11114. This adds an npx svelte-migrate self-closing-tags migration that replaces all the self-closing non-void elements in your .svelte files. --- .changeset/sixty-walls-act.md | 5 + .../default/src/routes/sverdle/+page.svelte | 2 +- .../anchor-afternavigate/+page.svelte | 2 +- .../anchor-onmount/+page.svelte | 2 +- .../data-sveltekit/noscroll/+page.svelte | 2 +- .../noscroll/target/+page.svelte | 2 +- .../routes/iframes/nested/parent/+page.svelte | 2 +- .../src/routes/no-ssr/margin/+page.svelte | 2 +- .../basics/src/routes/routing/+page.svelte | 2 +- .../scroll/cross-document/a/+page.svelte | 2 +- .../migrations/self-closing-tags/index.js | 38 ++++ .../migrations/self-closing-tags/migrate.js | 184 ++++++++++++++++++ .../self-closing-tags/migrate.spec.js | 30 +++ packages/migrate/package.json | 1 + pnpm-lock.yaml | 3 + .../src/routes/home/Video.svelte | 2 +- 16 files changed, 271 insertions(+), 10 deletions(-) create mode 100644 .changeset/sixty-walls-act.md create mode 100644 packages/migrate/migrations/self-closing-tags/index.js create mode 100644 packages/migrate/migrations/self-closing-tags/migrate.js create mode 100644 packages/migrate/migrations/self-closing-tags/migrate.spec.js diff --git a/.changeset/sixty-walls-act.md b/.changeset/sixty-walls-act.md new file mode 100644 index 000000000000..f3271cbfd42b --- /dev/null +++ b/.changeset/sixty-walls-act.md @@ -0,0 +1,5 @@ +--- +"svelte-migrate": minor +--- + +feat: add self-closing-tags migration diff --git a/packages/create-svelte/templates/default/src/routes/sverdle/+page.svelte b/packages/create-svelte/templates/default/src/routes/sverdle/+page.svelte index 68ab6400de82..42d987106d37 100644 --- a/packages/create-svelte/templates/default/src/routes/sverdle/+page.svelte +++ b/packages/create-svelte/templates/default/src/routes/sverdle/+page.svelte @@ -200,7 +200,7 @@ stageHeight: window.innerHeight, colors: ['#ff3e00', '#40b3ff', '#676778'] }} - /> + > {/if}