fix: missing space when importing run as in migration (#13361)

* fix: missing space when importing run as in migration

* chore: add test
pull/13366/head
Paolo Ricciuti 1 month ago committed by GitHub
parent bc2d30c558
commit c5fa0b46e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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) {

@ -0,0 +1,14 @@
<script>
let count = 0;
let run = true;
$: console.log(count);
$: if (count > 10 && run) {
alert('too high')
}
$: {
console.log('foo');
if (x) break $;
console.log('bar');
}
$: $count = 1;
</script>

@ -0,0 +1,22 @@
<script>
import { run as run_1 } from 'svelte/legacy';
let count = 0;
let run = true;
run_1(() => {
console.log(count);
});
run_1(() => {
if (count > 10 && run) {
alert('too high')
}
});
run_1(() => {
console.log('foo');
if (x) return;
console.log('bar');
});
run_1(() => {
$count = 1;
});
</script>
Loading…
Cancel
Save