svelte-parse
Version:
An increidbly relaxed svelte-parser
325 lines (324 loc) • 5.2 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\tlet name = '';\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 3,
"column": 1,
"offset": 25
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 3,
"column": 10,
"offset": 34
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 3,
"column": 10,
"offset": 34
},
"end": {
"line": 5,
"column": 1,
"offset": 36
}
}
},
{
"type": "svelteElement",
"tagName": "input",
"properties": [
{
"type": "svelteDirective",
"name": "bind",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 5,
"column": 19,
"offset": 54
},
"end": {
"line": 5,
"column": 25,
"offset": 60
}
},
"expression": {
"type": "svelteExpression",
"value": "name",
"position": {
"start": {
"line": 5,
"column": 20,
"offset": 55
},
"end": {
"line": 5,
"column": 24,
"offset": 59
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 5,
"column": 8,
"offset": 43
},
"end": {
"line": 5,
"column": 25,
"offset": 60
}
},
"specifier": "value"
},
{
"type": "svelteProperty",
"name": "placeholder",
"value": [
{
"type": "text",
"value": "enter",
"position": {
"start": {
"line": 5,
"column": 39,
"offset": 74
},
"end": {}
}
},
{
"type": "text",
"value": " ",
"position": {
"start": {
"line": 5,
"column": 44,
"offset": 79
},
"end": {}
}
},
{
"type": "text",
"value": "your",
"position": {
"start": {
"line": 5,
"column": 45,
"offset": 80
},
"end": {}
}
},
{
"type": "text",
"value": " ",
"position": {
"start": {
"line": 5,
"column": 49,
"offset": 84
},
"end": {}
}
},
{
"type": "text",
"value": "name",
"position": {
"start": {
"line": 5,
"column": 50,
"offset": 85
},
"end": {
"line": 5,
"column": 55,
"offset": 90
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 5,
"column": 26,
"offset": 61
},
"end": {
"line": 5,
"column": 55,
"offset": 90
}
}
}
],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 5,
"column": 1,
"offset": 36
},
"end": {
"line": 5,
"column": 56,
"offset": 91
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 5,
"column": 56,
"offset": 91
},
"end": {
"line": 6,
"column": 1,
"offset": 92
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "Hello ",
"position": {
"start": {
"line": 6,
"column": 4,
"offset": 95
},
"end": {
"line": 6,
"column": 10,
"offset": 101
}
}
},
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 6,
"column": 10,
"offset": 101
},
"end": {
"line": 6,
"column": 30,
"offset": 121
}
},
"expression": {
"type": "svelteExpression",
"value": "name || 'stranger'",
"position": {
"start": {
"line": 6,
"column": 11,
"offset": 102
},
"end": {
"line": 6,
"column": 29,
"offset": 120
}
}
}
},
{
"type": "text",
"value": "!",
"position": {
"start": {
"line": 6,
"column": 30,
"offset": 121
},
"end": {
"line": 6,
"column": 31,
"offset": 122
}
}
}
],
"position": {
"start": {
"line": 6,
"column": 1,
"offset": 92
},
"end": {
"line": 6,
"column": 35,
"offset": 126
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 6,
"column": 35,
"offset": 126
}
}
}