UNPKG

svelte-parse

Version:

An increidbly relaxed svelte-parser

159 lines (158 loc) 2.68 kB
{ "type": "root", "children": [ { "type": "svelteScript", "tagName": "script", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n\timport { createEventDispatcher } from 'svelte';\n\n\tconst dispatch = createEventDispatcher();\n\n\tfunction sayHello() {\n\t\tdispatch('message', {\n\t\t\ttext: 'Hello!'\n\t\t});\n\t}\n", "position": { "start": { "line": 1, "column": 9, "offset": 8 }, "end": { "line": 11, "column": 1, "offset": 177 } } } ], "position": { "start": { "line": 1, "column": 1, "offset": 0 }, "end": { "line": 11, "column": 10, "offset": 186 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 11, "column": 10, "offset": 186 }, "end": { "line": 13, "column": 1, "offset": 188 } } }, { "type": "svelteElement", "tagName": "button", "properties": [ { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 13, "column": 18, "offset": 205 }, "end": { "line": 13, "column": 28, "offset": 215 } }, "expression": { "type": "svelteExpression", "value": "sayHello", "position": { "start": { "line": 13, "column": 19, "offset": 206 }, "end": { "line": 13, "column": 27, "offset": 214 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 13, "column": 9, "offset": 196 }, "end": { "line": 13, "column": 28, "offset": 215 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "text", "value": "\n\tClick to say hello\n", "position": { "start": { "line": 13, "column": 29, "offset": 216 }, "end": { "line": 15, "column": 1, "offset": 237 } } } ], "position": { "start": { "line": 13, "column": 1, "offset": 188 }, "end": { "line": 15, "column": 10, "offset": 246 } } } ], "position": { "start": { "column": 1, "line": 1, "offset": 0 }, "end": { "line": 15, "column": 10, "offset": 246 } } }