svelte-parse
Version:
An increidbly relaxed svelte-parser
159 lines (158 loc) • 2.56 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\timport { count } from './stores.js';\n\n\tfunction increment() {\n\t\tcount.update(n => n + 1);\n\t}\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 7,
"column": 1,
"offset": 103
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 7,
"column": 10,
"offset": 112
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 7,
"column": 10,
"offset": 112
},
"end": {
"line": 9,
"column": 1,
"offset": 114
}
}
},
{
"type": "svelteElement",
"tagName": "button",
"properties": [
{
"type": "svelteDirective",
"name": "on",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 9,
"column": 18,
"offset": 131
},
"end": {
"line": 9,
"column": 29,
"offset": 142
}
},
"expression": {
"type": "svelteExpression",
"value": "increment",
"position": {
"start": {
"line": 9,
"column": 19,
"offset": 132
},
"end": {
"line": 9,
"column": 28,
"offset": 141
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 9,
"column": 9,
"offset": 122
},
"end": {
"line": 9,
"column": 29,
"offset": 142
}
},
"specifier": "click"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\t+\n",
"position": {
"start": {
"line": 9,
"column": 30,
"offset": 143
},
"end": {
"line": 11,
"column": 1,
"offset": 147
}
}
}
],
"position": {
"start": {
"line": 9,
"column": 1,
"offset": 114
},
"end": {
"line": 11,
"column": 10,
"offset": 156
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 11,
"column": 10,
"offset": 156
}
}
}