svelte-parse
Version:
An increidbly relaxed svelte-parser
478 lines (477 loc) • 8.71 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n export let image = undefined;\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 3,
"column": 1,
"offset": 41
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 3,
"column": 10,
"offset": 50
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 3,
"column": 10,
"offset": 50
},
"end": {
"line": 5,
"column": 1,
"offset": 52
}
}
},
{
"type": "svelteStyle",
"tagName": "style",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n .container img {\n width: 100%;\n }\n\n",
"position": {
"start": {
"line": 5,
"column": 8,
"offset": 59
},
"end": {
"line": 10,
"column": 1,
"offset": 101
}
}
}
],
"position": {
"start": {
"line": 5,
"column": 1,
"offset": 52
},
"end": {
"line": 10,
"column": 9,
"offset": 109
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 10,
"column": 9,
"offset": 109
},
"end": {
"line": 12,
"column": 1,
"offset": 111
}
}
},
{
"type": "svelteElement",
"tagName": "div",
"properties": [
{
"type": "svelteProperty",
"name": "class",
"value": [
{
"type": "text",
"value": "container",
"position": {
"start": {
"line": 12,
"column": 13,
"offset": 123
},
"end": {
"line": 12,
"column": 23,
"offset": 133
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 12,
"column": 6,
"offset": 116
},
"end": {
"line": 12,
"column": 23,
"offset": 133
}
}
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 12,
"column": 24,
"offset": 134
},
"end": {
"line": 13,
"column": 3,
"offset": 137
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "Hello form Tab2!",
"position": {
"start": {
"line": 13,
"column": 6,
"offset": 140
},
"end": {
"line": 13,
"column": 22,
"offset": 156
}
}
}
],
"position": {
"start": {
"line": 13,
"column": 3,
"offset": 137
},
"end": {
"line": 13,
"column": 26,
"offset": 160
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 13,
"column": 26,
"offset": 160
},
"end": {
"line": 14,
"column": 3,
"offset": 163
}
}
},
{
"type": "svelteBranchingBlock",
"name": "if",
"branches": [
{
"type": "svelteBranch",
"name": "if",
"expression": {
"type": "svelteExpression",
"value": "image",
"position": {
"start": {
"line": 14,
"column": 8,
"offset": 168
},
"end": {
"line": 14,
"column": 13,
"offset": 173
}
}
},
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 14,
"column": 14,
"offset": 174
},
"end": {
"line": 15,
"column": 5,
"offset": 179
}
}
},
{
"type": "svelteElement",
"tagName": "img",
"properties": [
{
"type": "svelteProperty",
"name": "src",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 15,
"column": 14,
"offset": 188
},
"end": {
"line": 15,
"column": 21,
"offset": 195
}
},
"expression": {
"type": "svelteExpression",
"value": "image",
"position": {
"start": {
"line": 15,
"column": 15,
"offset": 189
},
"end": {
"line": 15,
"column": 20,
"offset": 194
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 15,
"column": 10,
"offset": 184
},
"end": {
"line": 15,
"column": 21,
"offset": 195
}
}
},
{
"type": "svelteProperty",
"name": "alt",
"value": [
{
"type": "text",
"value": "example",
"position": {
"start": {
"line": 15,
"column": 27,
"offset": 201
},
"end": {}
}
},
{
"type": "text",
"value": " ",
"position": {
"start": {
"line": 15,
"column": 34,
"offset": 208
},
"end": {}
}
},
{
"type": "text",
"value": "image",
"position": {
"start": {
"line": 15,
"column": 35,
"offset": 209
},
"end": {
"line": 15,
"column": 41,
"offset": 215
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 15,
"column": 22,
"offset": 196
},
"end": {
"line": 15,
"column": 41,
"offset": 215
}
}
}
],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 15,
"column": 5,
"offset": 179
},
"end": {
"line": 15,
"column": 44,
"offset": 218
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 15,
"column": 44,
"offset": 218
},
"end": {
"line": 16,
"column": 3,
"offset": 221
}
}
}
],
"position": {
"start": {
"line": 14,
"column": 3,
"offset": 163
},
"end": {
"line": 16,
"column": 3,
"offset": 221
}
}
}
],
"position": {
"start": {
"line": 14,
"column": 3,
"offset": 163
},
"end": {
"line": 16,
"column": 8,
"offset": 226
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 16,
"column": 8,
"offset": 226
},
"end": {
"line": 17,
"column": 1,
"offset": 227
}
}
}
],
"position": {
"start": {
"line": 12,
"column": 1,
"offset": 111
},
"end": {
"line": 17,
"column": 7,
"offset": 233
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 17,
"column": 7,
"offset": 233
}
}
}