From 2f4936c0f50b6aa2ff4c86f11ab4e3c53d956422 Mon Sep 17 00:00:00 2001 From: Lars Francke Date: Mon, 28 Apr 2025 15:58:56 +0200 Subject: [PATCH 1/3] feat: The migration warning when slots cannot be migrated due to naming conflicts now states the name of the slot causing the issue --- .changeset/strong-coins-peel.md | 5 +++++ packages/svelte/src/compiler/migrate/index.js | 4 ++-- .../impossible-migrate-$derived-derived-var-3/output.svelte | 4 ++-- .../impossible-migrate-slot-change-name/output.svelte | 4 ++-- .../impossible-migrate-slot-non-identifier/output.svelte | 4 ++-- 5 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 .changeset/strong-coins-peel.md diff --git a/.changeset/strong-coins-peel.md b/.changeset/strong-coins-peel.md new file mode 100644 index 000000000000..d54b0c56e6b1 --- /dev/null +++ b/.changeset/strong-coins-peel.md @@ -0,0 +1,5 @@ +--- +'svelte': minor +--- + +The migration warning when slots cannot be migrated due to naming conflicts now states the name of the slot causing the issue diff --git a/packages/svelte/src/compiler/migrate/index.js b/packages/svelte/src/compiler/migrate/index.js index 75a9a6490539..2d5a4dcd9e5d 100644 --- a/packages/svelte/src/compiler/migrate/index.js +++ b/packages/svelte/src/compiler/migrate/index.js @@ -1307,7 +1307,7 @@ const template = { name = state.scope.generate(slot_name); if (name !== slot_name) { throw new MigrationError( - 'This migration would change the name of a slot making the component unusable' + `This migration would change the name of a slot (${slot_name} to ${name}) making the component unusable` ); } } @@ -1880,7 +1880,7 @@ function handle_identifier(node, state, path) { let new_name = state.scope.generate(name); if (new_name !== name) { throw new MigrationError( - 'This migration would change the name of a slot making the component unusable' + `This migration would change the name of a slot (${name} to ${new_name}) making the component unusable` ); } } diff --git a/packages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-3/output.svelte b/packages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-3/output.svelte index 9e4f086aedd3..26012e11151d 100644 --- a/packages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-3/output.svelte +++ b/packages/svelte/tests/migrate/samples/impossible-migrate-$derived-derived-var-3/output.svelte @@ -1,7 +1,7 @@ - + - \ No newline at end of file + diff --git a/packages/svelte/tests/migrate/samples/impossible-migrate-slot-change-name/output.svelte b/packages/svelte/tests/migrate/samples/impossible-migrate-slot-change-name/output.svelte index 2b6838a1d681..328966b63b6a 100644 --- a/packages/svelte/tests/migrate/samples/impossible-migrate-slot-change-name/output.svelte +++ b/packages/svelte/tests/migrate/samples/impossible-migrate-slot-change-name/output.svelte @@ -1,6 +1,6 @@ - + - \ No newline at end of file + diff --git a/packages/svelte/tests/migrate/samples/impossible-migrate-slot-non-identifier/output.svelte b/packages/svelte/tests/migrate/samples/impossible-migrate-slot-non-identifier/output.svelte index 6e5ab103109b..1e763577df34 100644 --- a/packages/svelte/tests/migrate/samples/impossible-migrate-slot-non-identifier/output.svelte +++ b/packages/svelte/tests/migrate/samples/impossible-migrate-slot-non-identifier/output.svelte @@ -1,2 +1,2 @@ - - \ No newline at end of file + + From 8f8f417705bb1c6347b065564cd7c3fc5120e89e Mon Sep 17 00:00:00 2001 From: Paolo Ricciuti Date: Wed, 30 Apr 2025 08:49:16 +0200 Subject: [PATCH 2/3] chore: update changeset --- .changeset/strong-coins-peel.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/strong-coins-peel.md b/.changeset/strong-coins-peel.md index d54b0c56e6b1..63cf22123e47 100644 --- a/.changeset/strong-coins-peel.md +++ b/.changeset/strong-coins-peel.md @@ -1,5 +1,5 @@ --- -'svelte': minor +'svelte': patch --- The migration warning when slots cannot be migrated due to naming conflicts now states the name of the slot causing the issue From 895b9a0add99c5b6d91a6710ed3283fc056d99d0 Mon Sep 17 00:00:00 2001 From: Paolo Ricciuti Date: Wed, 30 Apr 2025 08:50:43 +0200 Subject: [PATCH 3/3] chore: update changeset --- .changeset/strong-coins-peel.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/strong-coins-peel.md b/.changeset/strong-coins-peel.md index 63cf22123e47..013e8e44a107 100644 --- a/.changeset/strong-coins-peel.md +++ b/.changeset/strong-coins-peel.md @@ -2,4 +2,4 @@ 'svelte': patch --- -The migration warning when slots cannot be migrated due to naming conflicts now states the name of the slot causing the issue +fix: improve error message for migration errors when slot would be renamed