svelte-parse
Version:
An increidbly relaxed svelte-parser
283 lines (282 loc) • 4.68 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\timport { time, elapsed } from './stores.js';\n\n\tconst formatter = new Intl.DateTimeFormat('en', {\n\t\thour12: true,\n\t\thour: 'numeric',\n\t\tminute: '2-digit',\n\t\tsecond: '2-digit'\n\t});\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 10,
"column": 1,
"offset": 188
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 10,
"column": 10,
"offset": 197
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 10,
"column": 10,
"offset": 197
},
"end": {
"line": 12,
"column": 1,
"offset": 199
}
}
},
{
"type": "svelteElement",
"tagName": "h1",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "The time is ",
"position": {
"start": {
"line": 12,
"column": 5,
"offset": 203
},
"end": {
"line": 12,
"column": 17,
"offset": 215
}
}
},
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 12,
"column": 17,
"offset": 215
},
"end": {
"line": 12,
"column": 42,
"offset": 240
}
},
"expression": {
"type": "svelteExpression",
"value": "formatter.format($time)",
"position": {
"start": {
"line": 12,
"column": 18,
"offset": 216
},
"end": {
"line": 12,
"column": 41,
"offset": 239
}
}
}
}
],
"position": {
"start": {
"line": 12,
"column": 1,
"offset": 199
},
"end": {
"line": 12,
"column": 47,
"offset": 245
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 12,
"column": 47,
"offset": 245
},
"end": {
"line": 14,
"column": 1,
"offset": 247
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\tThis page has been open for\n\t",
"position": {
"start": {
"line": 14,
"column": 4,
"offset": 250
},
"end": {
"line": 16,
"column": 2,
"offset": 281
}
}
},
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 16,
"column": 2,
"offset": 281
},
"end": {
"line": 16,
"column": 12,
"offset": 291
}
},
"expression": {
"type": "svelteExpression",
"value": "$elapsed",
"position": {
"start": {
"line": 16,
"column": 3,
"offset": 282
},
"end": {
"line": 16,
"column": 11,
"offset": 290
}
}
}
},
{
"type": "text",
"value": " ",
"position": {
"start": {
"line": 16,
"column": 12,
"offset": 291
},
"end": {
"line": 16,
"column": 13,
"offset": 292
}
}
},
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 16,
"column": 13,
"offset": 292
},
"end": {
"line": 16,
"column": 52,
"offset": 331
}
},
"expression": {
"type": "svelteExpression",
"value": "$elapsed === 1 ? 'second' : 'seconds'",
"position": {
"start": {
"line": 16,
"column": 14,
"offset": 293
},
"end": {
"line": 16,
"column": 51,
"offset": 330
}
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 16,
"column": 52,
"offset": 331
},
"end": {
"line": 17,
"column": 1,
"offset": 332
}
}
}
],
"position": {
"start": {
"line": 14,
"column": 1,
"offset": 247
},
"end": {
"line": 17,
"column": 5,
"offset": 336
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 17,
"column": 5,
"offset": 336
}
}
}