From c5fa0b46e1b74bce71332e08636d4f74496efc43 Mon Sep 17 00:00:00 2001 From: Paolo Ricciuti Date: Sat, 21 Sep 2024 19:11:37 +0200 Subject: [PATCH] fix: missing space when importing run as in migration (#13361) * fix: missing space when importing run as in migration * chore: add test --- packages/svelte/src/compiler/migrate/index.js | 2 +- .../effects-with-alias-run/input.svelte | 14 ++++++++++++ .../effects-with-alias-run/output.svelte | 22 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 packages/svelte/tests/migrate/samples/effects-with-alias-run/input.svelte create mode 100644 packages/svelte/tests/migrate/samples/effects-with-alias-run/output.svelte diff --git a/packages/svelte/src/compiler/migrate/index.js b/packages/svelte/src/compiler/migrate/index.js index c60d2c8719..89f03cc3e3 100644 --- a/packages/svelte/src/compiler/migrate/index.js +++ b/packages/svelte/src/compiler/migrate/index.js @@ -71,7 +71,7 @@ export function migrate(source) { state = { ...state, scope: analysis.template.scope }; walk(parsed.fragment, state, template); - const run_import = `import { run${state.run_name === 'run' ? '' : `as ${state.run_name}`} } from 'svelte/legacy';`; + const run_import = `import { run${state.run_name === 'run' ? '' : ` as ${state.run_name}`} } from 'svelte/legacy';`; let added_legacy_import = false; if (state.props.length > 0 || analysis.uses_rest_props || analysis.uses_props) { diff --git a/packages/svelte/tests/migrate/samples/effects-with-alias-run/input.svelte b/packages/svelte/tests/migrate/samples/effects-with-alias-run/input.svelte new file mode 100644 index 0000000000..0ee06dd18b --- /dev/null +++ b/packages/svelte/tests/migrate/samples/effects-with-alias-run/input.svelte @@ -0,0 +1,14 @@ + diff --git a/packages/svelte/tests/migrate/samples/effects-with-alias-run/output.svelte b/packages/svelte/tests/migrate/samples/effects-with-alias-run/output.svelte new file mode 100644 index 0000000000..ac26da45e5 --- /dev/null +++ b/packages/svelte/tests/migrate/samples/effects-with-alias-run/output.svelte @@ -0,0 +1,22 @@ + \ No newline at end of file