fix: ensure `$$slots` exists in runes mode (#9718)

fixes #9683
pull/9721/head
Simon H 1 year ago committed by GitHub
parent 4a8f0bc7e7
commit cb1ea1f2db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: ensure `$$slots` exists in runes mode

@ -892,6 +892,11 @@ const common_visitors = {
const parent = /** @type {import('estree').Node} */ (context.path.at(-1)); const parent = /** @type {import('estree').Node} */ (context.path.at(-1));
if (!is_reference(node, parent)) return; if (!is_reference(node, parent)) return;
if (node.name === '$$slots') {
context.state.analysis.uses_slots = true;
return;
}
const binding = context.state.scope.get(node.name); const binding = context.state.scope.get(node.name);
// if no binding, means some global variable // if no binding, means some global variable

@ -0,0 +1,6 @@
import { test } from '../../test';
// Test that $$slots exists in runes mode
export default test({
html: `<p>bar</p>`
});

@ -0,0 +1,7 @@
<script>
import Slot from './slot.svelte';
</script>
<Slot>
<p>bar</p>
</Slot>
Loading…
Cancel
Save