svelte-parse
Version:
An increidbly relaxed svelte-parser
243 lines (242 loc) • 3.98 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteElement",
"tagName": "button",
"properties": [
{
"type": "svelteDirective",
"name": "on",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 1,
"column": 19,
"offset": 18
},
"end": {
"line": 1,
"column": 45,
"offset": 44
}
},
"expression": {
"type": "svelteExpression",
"value": "() => visible = !visible",
"position": {
"start": {
"line": 1,
"column": 20,
"offset": 19
},
"end": {
"line": 1,
"column": 44,
"offset": 43
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 1,
"column": 46,
"offset": 45
}
},
"specifier": "click"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "toggle",
"position": {
"start": {
"line": 1,
"column": 47,
"offset": 46
},
"end": {
"line": 1,
"column": 53,
"offset": 52
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 1,
"column": 62,
"offset": 61
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 1,
"column": 62,
"offset": 61
},
"end": {
"line": 3,
"column": 1,
"offset": 63
}
}
},
{
"type": "svelteBranchingBlock",
"name": "if",
"branches": [
{
"type": "svelteBranch",
"name": "if",
"expression": {
"type": "svelteExpression",
"value": "visible",
"position": {
"start": {
"line": 3,
"column": 6,
"offset": 68
},
"end": {
"line": 3,
"column": 13,
"offset": 75
}
}
},
"children": [
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 3,
"column": 14,
"offset": 76
},
"end": {
"line": 4,
"column": 2,
"offset": 78
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "hello!",
"position": {
"start": {
"line": 4,
"column": 5,
"offset": 81
},
"end": {
"line": 4,
"column": 11,
"offset": 87
}
}
}
],
"position": {
"start": {
"line": 4,
"column": 2,
"offset": 78
},
"end": {
"line": 4,
"column": 15,
"offset": 91
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 4,
"column": 15,
"offset": 91
},
"end": {
"line": 5,
"column": 1,
"offset": 92
}
}
}
],
"position": {
"start": {
"line": 3,
"column": 1,
"offset": 63
},
"end": {
"line": 5,
"column": 1,
"offset": 92
}
}
}
],
"position": {
"start": {
"line": 3,
"column": 1,
"offset": 63
},
"end": {
"line": 5,
"column": 6,
"offset": 97
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 5,
"column": 6,
"offset": 97
}
}
}