App.svelte
runes
This component is not in runes mode.
To enable runes mode, either start using runes in your code, or add the following to the top of your component:
<svelte:options runes />
9
1
2
3
4
5
6
›
⌄
<script>
let name = 'world';
</script>
<h1>Hello {name}!</h1>
99
1
2
3
4
5
6
7
8
9
10
11
12
›
⌄
import "svelte/internal/disclose-version";
import * as $ from "svelte/internal/client";
var root = $.template(`<h1></h1>`);
export default function App($$anchor) {
let name = 'world';
var h1 = root();
h1.textContent = `Hello ${name ?? ""}!`;
$.append($$anchor, h1);
}
result = svelte.compile(source, {
generate: ,
});9
1
›
/* Add a <style> tag to see the CSS output */
Root {
- css: null
- js: []
- start: 41
- end: 63
- type: "Root"
fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (2)
Text {...}
- type: "Text"
- start: 39
- end: 41
- raw: "\n\n"
- data: "\n\n"
} RegularElement {...}
- type: "RegularElement"
- start: 41
- end: 63
- name: "h1"
- attributes: []
fragment: Fragment {...}
- type: "Fragment"
nodes: [...] (3)
Text {...}
- type: "Text"
- start: 45
- end: 51
- raw: "Hello "
- data: "Hello "
} ExpressionTag {...}
- type: "ExpressionTag"
- start: 51
- end: 57
expression: Identifier {...}
- type: "Identifier"
- start: 52
- end: 56
loc: {...}
start: {...}
- line: 5
- column: 11
}end: {...}
- line: 5
- column: 15
}
}- name: "name"
}
} Text {...}
- type: "Text"
- start: 57
- end: 58
- raw: "!"
- data: "!"
}
]
}
}
]
}- options: null
instance: Script {
- type: "Script"
- start: 0
- end: 39
- context: "default"
content: Program {...}
- type: "Program"
- start: 8
- end: 30
loc: {...}
start: {...}
- line: 1
- column: 0
}end: {...}
- line: 3
- column: 0
}
}body: [...] (1)
VariableDeclaration {...}
- type: "VariableDeclaration"
- start: 10
- end: 29
loc: {...}
start: {...}
- line: 2
- column: 1
}end: {...}
- line: 2
- column: 20
}
}declarations: [...] (1)
VariableDeclarator {...}
- type: "VariableDeclarator"
- start: 14
- end: 28
loc: {...}
start: {...}
- line: 2
- column: 5
}end: {...}
- line: 2
- column: 19
}
}id: Identifier {...}
- type: "Identifier"
- start: 14
- end: 18
loc: {...}
start: {...}
- line: 2
- column: 5
}end: {...}
- line: 2
- column: 9
}
}- name: "name"
}init: Literal {...}
- type: "Literal"
- start: 21
- end: 28
loc: {...}
start: {...}
- line: 2
- column: 12
}end: {...}
- line: 2
- column: 19
}
}- value: "world"
- raw: "'world'"
}
}
]- kind: "let"
}
]- sourceType: "module"
}- attributes: []
}
}
The AST is not public API and may change at any point in time