update parser for v2

pull/7738/head
Rich-Harris 8 years ago
parent 6aef662fa5
commit ac13b72bd6

@ -6,7 +6,7 @@ const literals = new Map([['true', true], ['false', false], ['null', null]]);
export default function readExpression(parser: Parser) { export default function readExpression(parser: Parser) {
const start = parser.index; const start = parser.index;
const name = parser.readUntil(/\s*}}/); const name = parser.readUntil(parser.v2 ? /\s*}/ : /\s*}}/);
if (name && /^[a-z]+$/.test(name)) { if (name && /^[a-z]+$/.test(name)) {
const end = start + name.length; const end = start + name.length;

@ -61,7 +61,7 @@ export default function mustache(parser: Parser) {
parser.eat(expected, true); parser.eat(expected, true);
parser.allowWhitespace(); parser.allowWhitespace();
parser.eat('}}', true); parser.eat(parser.v2 ? '}' : '}}', true);
while (block.elseif) { while (block.elseif) {
block.end = parser.index; block.end = parser.index;
@ -83,7 +83,7 @@ export default function mustache(parser: Parser) {
block.end = parser.index; block.end = parser.index;
parser.stack.pop(); parser.stack.pop();
} else if (parser.eat('elseif')) { } else if (parser.eat(parser.v2 ? ':elseif' : 'elseif')) {
const block = parser.current(); const block = parser.current();
if (block.type !== 'IfBlock') if (block.type !== 'IfBlock')
parser.error( parser.error(
@ -95,7 +95,7 @@ export default function mustache(parser: Parser) {
const expression = readExpression(parser); const expression = readExpression(parser);
parser.allowWhitespace(); parser.allowWhitespace();
parser.eat('}}', true); parser.eat(parser.v2 ? '}' : '}}', true);
block.else = { block.else = {
start: parser.index, start: parser.index,
@ -114,7 +114,7 @@ export default function mustache(parser: Parser) {
}; };
parser.stack.push(block.else.children[0]); parser.stack.push(block.else.children[0]);
} else if (parser.eat('else')) { } else if (parser.eat(parser.v2 ? ':else' : 'else')) {
const block = parser.current(); const block = parser.current();
if (block.type !== 'IfBlock' && block.type !== 'EachBlock') { if (block.type !== 'IfBlock' && block.type !== 'EachBlock') {
parser.error( parser.error(
@ -123,7 +123,7 @@ export default function mustache(parser: Parser) {
} }
parser.allowWhitespace(); parser.allowWhitespace();
parser.eat('}}', true); parser.eat(parser.v2 ? '}' : '}}', true);
block.else = { block.else = {
start: parser.index, start: parser.index,
@ -133,7 +133,7 @@ export default function mustache(parser: Parser) {
}; };
parser.stack.push(block.else); parser.stack.push(block.else);
} else if (parser.eat('then')) { } else if (parser.eat(parser.v2 ? ':then' : 'then')) {
// TODO DRY out this and the next section // TODO DRY out this and the next section
const pendingBlock = parser.current(); const pendingBlock = parser.current();
if (pendingBlock.type === 'PendingBlock') { if (pendingBlock.type === 'PendingBlock') {
@ -145,7 +145,7 @@ export default function mustache(parser: Parser) {
awaitBlock.value = parser.readIdentifier(); awaitBlock.value = parser.readIdentifier();
parser.allowWhitespace(); parser.allowWhitespace();
parser.eat('}}', true); parser.eat(parser.v2 ? '}' : '}}', true);
const thenBlock: Node = { const thenBlock: Node = {
start, start,
@ -157,7 +157,7 @@ export default function mustache(parser: Parser) {
awaitBlock.then = thenBlock; awaitBlock.then = thenBlock;
parser.stack.push(thenBlock); parser.stack.push(thenBlock);
} }
} else if (parser.eat('catch')) { } else if (parser.eat(parser.v2 ? ':catch' : 'catch')) {
const thenBlock = parser.current(); const thenBlock = parser.current();
if (thenBlock.type === 'ThenBlock') { if (thenBlock.type === 'ThenBlock') {
thenBlock.end = start; thenBlock.end = start;
@ -168,7 +168,7 @@ export default function mustache(parser: Parser) {
awaitBlock.error = parser.readIdentifier(); awaitBlock.error = parser.readIdentifier();
parser.allowWhitespace(); parser.allowWhitespace();
parser.eat('}}', true); parser.eat(parser.v2 ? '}' : '}}', true);
const catchBlock: Node = { const catchBlock: Node = {
start, start,
@ -288,7 +288,7 @@ export default function mustache(parser: Parser) {
parser.allowWhitespace(); parser.allowWhitespace();
} }
parser.eat('}}', true); parser.eat(parser.v2 ? '}' : '}}', true);
parser.current().children.push(block); parser.current().children.push(block);
parser.stack.push(block); parser.stack.push(block);
@ -302,6 +302,23 @@ export default function mustache(parser: Parser) {
// {{yield}} // {{yield}}
// TODO deprecate // TODO deprecate
parser.allowWhitespace(); parser.allowWhitespace();
if (parser.v2) {
const expressionEnd = parser.index;
parser.eat('}', true);
parser.current().children.push({
start,
end: parser.index,
type: 'MustacheTag',
expression: {
start: expressionEnd - 5,
end: expressionEnd,
type: 'Identifier',
name: 'yield'
}
});
} else {
parser.eat('}}', true); parser.eat('}}', true);
parser.current().children.push({ parser.current().children.push({
@ -312,12 +329,13 @@ export default function mustache(parser: Parser) {
attributes: [], attributes: [],
children: [] children: []
}); });
} else if (parser.eat('{')) { }
} else if (parser.eat(parser.v2 ? '@html' : '{')) {
// {{{raw}}} mustache // {{{raw}}} mustache
const expression = readExpression(parser); const expression = readExpression(parser);
parser.allowWhitespace(); parser.allowWhitespace();
parser.eat('}}}', true); parser.eat(parser.v2 ? '}' : '}}}', true);
parser.current().children.push({ parser.current().children.push({
start, start,

@ -170,7 +170,7 @@ export default function tag(parser: Parser) {
} }
} }
if (name === COMPONENT) { if (name === (parser.v2 ? 'svelte:component' : ':Component')) {
parser.eat('{', true); parser.eat('{', true);
element.expression = readExpression(parser); element.expression = readExpression(parser);
parser.allowWhitespace(); parser.allowWhitespace();
@ -249,6 +249,10 @@ export default function tag(parser: Parser) {
function readTagName(parser: Parser) { function readTagName(parser: Parser) {
const start = parser.index; const start = parser.index;
// TODO hoist these back to the top, post-v2
const SELF = parser.v2 ? 'svelte:self' : ':Self';
const COMPONENT = parser.v2 ? 'svelte:component' : ':Component';
if (parser.eat(SELF)) { if (parser.eat(SELF)) {
// check we're inside a block, otherwise this // check we're inside a block, otherwise this
// will cause infinite recursion // will cause infinite recursion
@ -289,14 +293,14 @@ function readTagName(parser: Parser) {
function readAttribute(parser: Parser, uniqueNames: Set<string>) { function readAttribute(parser: Parser, uniqueNames: Set<string>) {
const start = parser.index; const start = parser.index;
if (parser.eat('{{')) { if (parser.eat(parser.v2 ? '{' : '{{')) {
parser.allowWhitespace(); parser.allowWhitespace();
parser.eat('...', true, 'Expected spread operator (...)'); parser.eat('...', true, 'Expected spread operator (...)');
const expression = readExpression(parser); const expression = readExpression(parser);
parser.allowWhitespace(); parser.allowWhitespace();
parser.eat('}}', true); parser.eat(parser.v2 ? '}' : '}}', true);
return { return {
start, start,
@ -369,7 +373,7 @@ function readSequence(parser: Parser, done: () => boolean) {
}); });
return chunks; return chunks;
} else if (parser.eat('{{')) { } else if (parser.eat(parser.v2 ? '{' : '{{')) {
if (currentChunk.data) { if (currentChunk.data) {
currentChunk.end = index; currentChunk.end = index;
chunks.push(currentChunk); chunks.push(currentChunk);
@ -377,9 +381,7 @@ function readSequence(parser: Parser, done: () => boolean) {
const expression = readExpression(parser); const expression = readExpression(parser);
parser.allowWhitespace(); parser.allowWhitespace();
if (!parser.eat('}}')) { parser.eat(parser.v2 ? '}' : '}}', true);
parser.error(`Expected }}`);
}
chunks.push({ chunks.push({
start: index, start: index,

@ -20,8 +20,13 @@
{ {
"start": 19, "start": 19,
"end": 29, "end": 29,
"type": "Text", "type": "MustacheTag",
"data": "{readonly}" "expression": {
"type": "Identifier",
"start": 20,
"end": 28,
"name": "readonly"
}
} }
] ]
} }

@ -1,30 +1,30 @@
{ {
"hash": 3179574701, "hash": "7xolfv",
"html": { "html": {
"start": 0, "start": 0,
"end": 45, "end": 41,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 45, "end": 41,
"type": "Element", "type": "Element",
"name": "textarea", "name": "textarea",
"attributes": [ "attributes": [
{ {
"start": 10, "start": 10,
"end": 33, "end": 29,
"type": "Attribute", "type": "Attribute",
"name": "readonly", "name": "readonly",
"value": [ "value": [
{ {
"start": 20, "start": 19,
"end": 32, "end": 29,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 22, "start": 20,
"end": 30, "end": 28,
"name": "readonly" "name": "readonly"
} }
} }

@ -20,8 +20,13 @@
{ {
"start": 11, "start": 11,
"end": 18, "end": 18,
"type": "Text", "type": "MustacheTag",
"data": "{class}" "expression": {
"type": "Identifier",
"start": 12,
"end": 17,
"name": "class"
}
} }
] ]
} }

@ -1,30 +1,30 @@
{ {
"hash": 2788845841, "hash": "l0cddf",
"html": { "html": {
"start": 0, "start": 0,
"end": 29, "end": 25,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 29, "end": 25,
"type": "Element", "type": "Element",
"name": "div", "name": "div",
"attributes": [ "attributes": [
{ {
"start": 5, "start": 5,
"end": 22, "end": 18,
"type": "Attribute", "type": "Attribute",
"name": "class", "name": "class",
"value": [ "value": [
{ {
"start": 12, "start": 11,
"end": 21, "end": 18,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 14, "start": 12,
"end": 19, "end": 17,
"name": "class" "name": "class"
} }
} }

@ -19,9 +19,26 @@
"value": [ "value": [
{ {
"start": 12, "start": 12,
"end": 19,
"type": "Text",
"data": "color: "
},
{
"start": 19,
"end": 26,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 20,
"end": 25,
"name": "color"
}
},
{
"start": 26,
"end": 27, "end": 27,
"type": "Text", "type": "Text",
"data": "color: {color};" "data": ";"
} }
] ]
} }
@ -30,8 +47,13 @@
{ {
"start": 29, "start": 29,
"end": 36, "end": 36,
"type": "Text", "type": "MustacheTag",
"data": "{color}" "expression": {
"type": "Identifier",
"start": 30,
"end": 35,
"name": "color"
}
} }
] ]
} }

@ -1,19 +1,19 @@
{ {
"hash": 804348386, "hash": "ehtsx6",
"html": { "html": {
"start": 0, "start": 0,
"end": 46, "end": 42,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 46, "end": 42,
"type": "Element", "type": "Element",
"name": "div", "name": "div",
"attributes": [ "attributes": [
{ {
"start": 5, "start": 5,
"end": 30, "end": 28,
"type": "Attribute", "type": "Attribute",
"name": "style", "name": "style",
"value": [ "value": [
@ -25,18 +25,18 @@
}, },
{ {
"start": 19, "start": 19,
"end": 28, "end": 26,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 21, "start": 20,
"end": 26, "end": 25,
"name": "color" "name": "color"
} }
}, },
{ {
"start": 28, "start": 26,
"end": 29, "end": 27,
"type": "Text", "type": "Text",
"data": ";" "data": ";"
} }
@ -45,13 +45,13 @@
], ],
"children": [ "children": [
{ {
"start": 31, "start": 29,
"end": 40, "end": 36,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 33, "start": 30,
"end": 38, "end": 35,
"name": "color" "name": "color"
} }
} }

@ -1,15 +1,32 @@
{ {
"hash": "1rt0tho", "hash": "1b28gs9",
"html": { "html": {
"start": 0, "start": 0,
"end": 149, "end": 148,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 148,
"type": "AwaitBlock",
"expression": {
"type": "Identifier",
"start": 8,
"end": 18,
"name": "thePromise"
},
"value": "theValue",
"error": "theError",
"pending": {
"start": 19,
"end": 39,
"type": "PendingBlock",
"children": [
{
"start": 19,
"end": 21, "end": 21,
"type": "Text", "type": "Text",
"data": "{#await thePromise}\n\t" "data": "\n\t"
}, },
{ {
"start": 21, "start": 21,
@ -28,9 +45,22 @@
}, },
{ {
"start": 38, "start": 38,
"end": 39,
"type": "Text",
"data": "\n"
}
]
},
"then": {
"start": 39,
"end": 88,
"type": "ThenBlock",
"children": [
{
"start": 55,
"end": 57, "end": 57,
"type": "Text", "type": "Text",
"data": "\n{:then theValue}\n\t" "data": "\n\t"
}, },
{ {
"start": 57, "start": 57,
@ -41,38 +71,88 @@
"children": [ "children": [
{ {
"start": 60, "start": 60,
"end": 83, "end": 73,
"type": "Text", "type": "Text",
"data": "the value is {theValue}" "data": "the value is "
},
{
"start": 73,
"end": 83,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 74,
"end": 82,
"name": "theValue"
}
} }
] ]
}, },
{ {
"start": 87, "start": 87,
"end": 88,
"type": "Text",
"data": "\n"
}
]
},
"catch": {
"start": 88,
"end": 140,
"type": "CatchBlock",
"children": [
{
"start": 105,
"end": 107, "end": 107,
"type": "Text", "type": "Text",
"data": "\n{:catch theError}\n\t" "data": "\n\t"
}, },
{ {
"start": 107, "start": 107,
"end": 140, "end": 139,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 110, "start": 110,
"end": 136, "end": 117,
"type": "Text", "type": "Text",
"data": "oh no! {theError.message}}" "data": "oh no! "
},
{
"start": 117,
"end": 135,
"type": "MustacheTag",
"expression": {
"type": "MemberExpression",
"start": 118,
"end": 134,
"object": {
"type": "Identifier",
"start": 118,
"end": 126,
"name": "theError"
},
"property": {
"type": "Identifier",
"start": 127,
"end": 134,
"name": "message"
},
"computed": false
}
} }
] ]
}, },
{ {
"start": 140, "start": 139,
"end": 149, "end": 140,
"type": "Text", "type": "Text",
"data": "\n{/await}" "data": "\n"
}
]
}
} }
] ]
}, },

@ -3,5 +3,5 @@
{:then theValue} {:then theValue}
<p>the value is {theValue}</p> <p>the value is {theValue}</p>
{:catch theError} {:catch theError}
<p>oh no! {theError.message}}</p> <p>oh no! {theError.message}</p>
{/await} {/await}

@ -1,143 +1,143 @@
{ {
"hash": 1040536517, "hash": "1b28gs9",
"html": { "html": {
"start": 0, "start": 0,
"end": 158, "end": 148,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 158, "end": 148,
"type": "AwaitBlock", "type": "AwaitBlock",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 9, "start": 8,
"end": 19, "end": 18,
"name": "thePromise" "name": "thePromise"
}, },
"value": "theValue", "value": "theValue",
"error": "theError", "error": "theError",
"pending": { "pending": {
"start": 21, "start": 19,
"end": 41, "end": 39,
"type": "PendingBlock", "type": "PendingBlock",
"children": [ "children": [
{ {
"start": 21, "start": 19,
"end": 23, "end": 21,
"type": "Text", "type": "Text",
"data": "\n\t" "data": "\n\t"
}, },
{ {
"start": 23, "start": 21,
"end": 40, "end": 38,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 26, "start": 24,
"end": 36, "end": 34,
"type": "Text", "type": "Text",
"data": "loading..." "data": "loading..."
} }
] ]
}, },
{ {
"start": 40, "start": 38,
"end": 41, "end": 39,
"type": "Text", "type": "Text",
"data": "\n" "data": "\n"
} }
] ]
}, },
"then": { "then": {
"start": 41, "start": 39,
"end": 93, "end": 88,
"type": "ThenBlock", "type": "ThenBlock",
"children": [ "children": [
{ {
"start": 58, "start": 55,
"end": 60, "end": 57,
"type": "Text", "type": "Text",
"data": "\n\t" "data": "\n\t"
}, },
{ {
"start": 60, "start": 57,
"end": 92, "end": 87,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 63, "start": 60,
"end": 76, "end": 73,
"type": "Text", "type": "Text",
"data": "the value is " "data": "the value is "
}, },
{ {
"start": 76, "start": 73,
"end": 88, "end": 83,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 78, "start": 74,
"end": 86, "end": 82,
"name": "theValue" "name": "theValue"
} }
} }
] ]
}, },
{ {
"start": 92, "start": 87,
"end": 93, "end": 88,
"type": "Text", "type": "Text",
"data": "\n" "data": "\n"
} }
] ]
}, },
"catch": { "catch": {
"start": 93, "start": 88,
"end": 148, "end": 140,
"type": "CatchBlock", "type": "CatchBlock",
"children": [ "children": [
{ {
"start": 111, "start": 105,
"end": 113, "end": 107,
"type": "Text", "type": "Text",
"data": "\n\t" "data": "\n\t"
}, },
{ {
"start": 113, "start": 107,
"end": 147, "end": 139,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 116, "start": 110,
"end": 123, "end": 117,
"type": "Text", "type": "Text",
"data": "oh no! " "data": "oh no! "
}, },
{ {
"start": 123, "start": 117,
"end": 143, "end": 135,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "MemberExpression", "type": "MemberExpression",
"start": 125, "start": 118,
"end": 141, "end": 134,
"object": { "object": {
"type": "Identifier", "type": "Identifier",
"start": 125, "start": 118,
"end": 133, "end": 126,
"name": "theError" "name": "theError"
}, },
"property": { "property": {
"type": "Identifier", "type": "Identifier",
"start": 134, "start": 127,
"end": 141, "end": 134,
"name": "message" "name": "message"
}, },
"computed": false "computed": false
@ -146,8 +146,8 @@
] ]
}, },
{ {
"start": 147, "start": 139,
"end": 148, "end": 140,
"type": "Text", "type": "Text",
"data": "\n" "data": "\n"
} }

@ -10,56 +10,31 @@
"end": 55, "end": 55,
"type": "Element", "type": "Element",
"name": "svelte:component", "name": "svelte:component",
"attributes": [ "attributes": [],
{ "children": [],
"start": 18, "expression": {
"end": 23, "type": "ConditionalExpression",
"type": "Attribute", "start": 19,
"name": "{foo", "end": 34,
"value": true "test": {
}, "type": "Identifier",
{ "start": 19,
"start": 23, "end": 22,
"end": 25, "name": "foo"
"type": "Attribute",
"name": "?",
"value": true
}, },
{ "consequent": {
"type": "Identifier",
"start": 25, "start": 25,
"end": 29, "end": 28,
"type": "Attribute", "name": "Foo"
"name": "Foo",
"value": true
}, },
{ "alternate": {
"start": 29,
"end": 30,
"type": "Attribute",
"name": "",
"value": [
{
"type": "AttributeShorthand",
"start": 30,
"end": 30,
"expression": {
"type": "Identifier", "type": "Identifier",
"start": 30,
"end": 30,
"name": ""
}
}
]
},
{
"start": 31, "start": 31,
"end": 35, "end": 34,
"type": "Attribute", "name": "Bar"
"name": "Bar}", }
"value": true
} }
],
"children": []
} }
] ]
}, },

@ -1,37 +1,37 @@
{ {
"hash": 410218696, "hash": "7yh2k2",
"html": { "html": {
"start": 0, "start": 0,
"end": 43, "end": 55,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 43, "end": 55,
"type": "Element", "type": "Element",
"name": ":Component", "name": "svelte:component",
"attributes": [], "attributes": [],
"children": [], "children": [],
"expression": { "expression": {
"type": "ConditionalExpression", "type": "ConditionalExpression",
"start": 13, "start": 19,
"end": 28, "end": 34,
"test": { "test": {
"type": "Identifier", "type": "Identifier",
"start": 13, "start": 19,
"end": 16, "end": 22,
"name": "foo" "name": "foo"
}, },
"consequent": { "consequent": {
"type": "Identifier", "type": "Identifier",
"start": 19, "start": 25,
"end": 22, "end": 28,
"name": "Foo" "name": "Foo"
}, },
"alternate": { "alternate": {
"type": "Identifier", "type": "Identifier",
"start": 25, "start": 31,
"end": 28, "end": 34,
"name": "Bar" "name": "Bar"
} }
} }

@ -7,10 +7,15 @@
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 33, "end": 62,
"type": "Text", "type": "EachBlock",
"data": "{#each animals as [key, value]}\n\t" "expression": {
"type": "Identifier",
"start": 7,
"end": 14,
"name": "animals"
}, },
"children": [
{ {
"start": 33, "start": 33,
"end": 54, "end": 54,
@ -20,17 +25,40 @@
"children": [ "children": [
{ {
"start": 36, "start": 36,
"end": 50, "end": 41,
"type": "Text", "type": "MustacheTag",
"data": "{key}: {value}" "expression": {
"type": "Identifier",
"start": 37,
"end": 40,
"name": "key"
} }
]
}, },
{ {
"start": 54, "start": 41,
"end": 62, "end": 43,
"type": "Text", "type": "Text",
"data": "\n{/each}" "data": ": "
},
{
"start": 43,
"end": 50,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 44,
"end": 49,
"name": "value"
}
}
]
}
],
"destructuredContexts": [
"key",
"value"
],
"context": "key_value"
} }
] ]
}, },

@ -1,53 +1,53 @@
{ {
"hash": 2621498076, "hash": "gtdm5e",
"html": { "html": {
"start": 0, "start": 0,
"end": 70, "end": 62,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 70, "end": 62,
"type": "EachBlock", "type": "EachBlock",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 8, "start": 7,
"end": 15, "end": 14,
"name": "animals" "name": "animals"
}, },
"children": [ "children": [
{ {
"start": 35, "start": 33,
"end": 60, "end": 54,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 38, "start": 36,
"end": 45, "end": 41,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 40, "start": 37,
"end": 43, "end": 40,
"name": "key" "name": "key"
} }
}, },
{ {
"start": 45, "start": 41,
"end": 47, "end": 43,
"type": "Text", "type": "Text",
"data": ": " "data": ": "
}, },
{ {
"start": 47, "start": 43,
"end": 56, "end": 50,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 49, "start": 44,
"end": 54, "end": 49,
"name": "value" "name": "value"
} }
} }

@ -7,10 +7,15 @@
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 27, "end": 77,
"type": "Text", "type": "EachBlock",
"data": "{#each animals as animal}\n\t" "expression": {
"type": "Identifier",
"start": 7,
"end": 14,
"name": "animals"
}, },
"children": [
{ {
"start": 27, "start": 27,
"end": 42, "end": 42,
@ -21,17 +26,23 @@
{ {
"start": 30, "start": 30,
"end": 38, "end": 38,
"type": "Text", "type": "MustacheTag",
"data": "{animal}" "expression": {
"type": "Identifier",
"start": 31,
"end": 37,
"name": "animal"
}
} }
] ]
}, }
{ ],
"start": 42, "context": "animal",
"end": 52, "else": {
"type": "Text", "start": 50,
"data": "\n{:else}\n\t" "end": 70,
}, "type": "ElseBlock",
"children": [
{ {
"start": 52, "start": 52,
"end": 69, "end": 69,
@ -46,12 +57,9 @@
"data": "no animals" "data": "no animals"
} }
] ]
}, }
{ ]
"start": 69, }
"end": 77,
"type": "Text",
"data": "\n{/each}"
} }
] ]
}, },

@ -1,36 +1,36 @@
{ {
"hash": 3238289871, "hash": "ljl07n",
"html": { "html": {
"start": 0, "start": 0,
"end": 84, "end": 77,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 84, "end": 77,
"type": "EachBlock", "type": "EachBlock",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 8, "start": 7,
"end": 15, "end": 14,
"name": "animals" "name": "animals"
}, },
"children": [ "children": [
{ {
"start": 29, "start": 27,
"end": 46, "end": 42,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 32, "start": 30,
"end": 42, "end": 38,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 34, "start": 31,
"end": 40, "end": 37,
"name": "animal" "name": "animal"
} }
} }
@ -39,20 +39,20 @@
], ],
"context": "animal", "context": "animal",
"else": { "else": {
"start": 55, "start": 50,
"end": 75, "end": 70,
"type": "ElseBlock", "type": "ElseBlock",
"children": [ "children": [
{ {
"start": 57, "start": 52,
"end": 74, "end": 69,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 60, "start": 55,
"end": 70, "end": 65,
"type": "Text", "type": "Text",
"data": "no animals" "data": "no animals"
} }

@ -7,10 +7,15 @@
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 30, "end": 58,
"type": "Text", "type": "EachBlock",
"data": "{#each animals as animal, i}\n\t" "expression": {
"type": "Identifier",
"start": 7,
"end": 14,
"name": "animals"
}, },
"children": [
{ {
"start": 30, "start": 30,
"end": 50, "end": 50,
@ -20,17 +25,37 @@
"children": [ "children": [
{ {
"start": 33, "start": 33,
"end": 46, "end": 36,
"type": "Text", "type": "MustacheTag",
"data": "{i}: {animal}" "expression": {
"type": "Identifier",
"start": 34,
"end": 35,
"name": "i"
} }
]
}, },
{ {
"start": 50, "start": 36,
"end": 58, "end": 38,
"type": "Text", "type": "Text",
"data": "\n{/each}" "data": ": "
},
{
"start": 38,
"end": 46,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 39,
"end": 45,
"name": "animal"
}
}
]
}
],
"context": "animal",
"index": "i"
} }
] ]
}, },

@ -1,53 +1,53 @@
{ {
"hash": 2841674990, "hash": "1143n2g",
"html": { "html": {
"start": 0, "start": 0,
"end": 66, "end": 58,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 66, "end": 58,
"type": "EachBlock", "type": "EachBlock",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 8, "start": 7,
"end": 15, "end": 14,
"name": "animals" "name": "animals"
}, },
"children": [ "children": [
{ {
"start": 32, "start": 30,
"end": 56, "end": 50,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 35, "start": 33,
"end": 40, "end": 36,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 37, "start": 34,
"end": 38, "end": 35,
"name": "i" "name": "i"
} }
}, },
{ {
"start": 40, "start": 36,
"end": 42, "end": 38,
"type": "Text", "type": "Text",
"data": ": " "data": ": "
}, },
{ {
"start": 42, "start": 38,
"end": 52, "end": 46,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 44, "start": 39,
"end": 50, "end": 45,
"name": "animal" "name": "animal"
} }
} }

@ -7,10 +7,15 @@
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 27, "end": 50,
"type": "Text", "type": "EachBlock",
"data": "{#each animals as animal}\n\t" "expression": {
"type": "Identifier",
"start": 7,
"end": 14,
"name": "animals"
}, },
"children": [
{ {
"start": 27, "start": 27,
"end": 42, "end": 42,
@ -21,16 +26,18 @@
{ {
"start": 30, "start": 30,
"end": 38, "end": 38,
"type": "Text", "type": "MustacheTag",
"data": "{animal}" "expression": {
"type": "Identifier",
"start": 31,
"end": 37,
"name": "animal"
}
} }
] ]
}, }
{ ],
"start": 42, "context": "animal"
"end": 50,
"type": "Text",
"data": "\n{/each}"
} }
] ]
}, },

@ -1,36 +1,36 @@
{ {
"hash": 220340986, "hash": "mzeq0s",
"html": { "html": {
"start": 0, "start": 0,
"end": 56, "end": 50,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 56, "end": 50,
"type": "EachBlock", "type": "EachBlock",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 8, "start": 7,
"end": 15, "end": 14,
"name": "animals" "name": "animals"
}, },
"children": [ "children": [
{ {
"start": 29, "start": 27,
"end": 46, "end": 42,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 32, "start": 30,
"end": 42, "end": 38,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 34, "start": 31,
"end": 40, "end": 37,
"name": "animal" "name": "animal"
} }
} }

@ -77,10 +77,21 @@
}, },
{ {
"start": 61, "start": 61,
"end": 78, "end": 63,
"type": "Text", "type": "Text",
"data": "\n\n{#if visible}\n\t" "data": "\n\n"
}, },
{
"start": 63,
"end": 97,
"type": "IfBlock",
"expression": {
"type": "Identifier",
"start": 68,
"end": 75,
"name": "visible"
},
"children": [
{ {
"start": 78, "start": 78,
"end": 91, "end": 91,
@ -95,12 +106,8 @@
"data": "hello!" "data": "hello!"
} }
] ]
}, }
{ ]
"start": 91,
"end": 97,
"type": "Text",
"data": "\n{/if}"
} }
] ]
}, },

@ -1,8 +1,8 @@
{ {
"hash": 4260626221, "hash": "qi54it",
"html": { "html": {
"start": 0, "start": 0,
"end": 101, "end": 97,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
@ -83,25 +83,25 @@
}, },
{ {
"start": 63, "start": 63,
"end": 101, "end": 97,
"type": "IfBlock", "type": "IfBlock",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 69, "start": 68,
"end": 76, "end": 75,
"name": "visible" "name": "visible"
}, },
"children": [ "children": [
{ {
"start": 80, "start": 78,
"end": 93, "end": 91,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 83, "start": 81,
"end": 89, "end": 87,
"type": "Text", "type": "Text",
"data": "hello!" "data": "hello!"
} }

@ -7,10 +7,15 @@
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 11, "end": 51,
"type": "Text", "type": "IfBlock",
"data": "{#if foo}\n\t" "expression": {
"type": "Identifier",
"start": 5,
"end": 8,
"name": "foo"
}, },
"children": [
{ {
"start": 11, "start": 11,
"end": 21, "end": 21,
@ -25,13 +30,13 @@
"data": "foo" "data": "foo"
} }
] ]
}, }
{ ],
"start": 21, "else": {
"end": 31, "start": 29,
"type": "Text", "end": 46,
"data": "\n{:else}\n\t" "type": "ElseBlock",
}, "children": [
{ {
"start": 31, "start": 31,
"end": 45, "end": 45,
@ -46,12 +51,9 @@
"data": "not foo" "data": "not foo"
} }
] ]
}, }
{ ]
"start": 45, }
"end": 51,
"type": "Text",
"data": "\n{/if}"
} }
] ]
}, },

@ -1,31 +1,31 @@
{ {
"hash": 3134964533, "hash": "dbh411",
"html": { "html": {
"start": 0, "start": 0,
"end": 56, "end": 51,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 56, "end": 51,
"type": "IfBlock", "type": "IfBlock",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 6, "start": 5,
"end": 9, "end": 8,
"name": "foo" "name": "foo"
}, },
"children": [ "children": [
{ {
"start": 13, "start": 11,
"end": 23, "end": 21,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 16, "start": 14,
"end": 19, "end": 17,
"type": "Text", "type": "Text",
"data": "foo" "data": "foo"
} }
@ -33,20 +33,20 @@
} }
], ],
"else": { "else": {
"start": 32, "start": 29,
"end": 49, "end": 46,
"type": "ElseBlock", "type": "ElseBlock",
"children": [ "children": [
{ {
"start": 34, "start": 31,
"end": 48, "end": 45,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 37, "start": 34,
"end": 44, "end": 41,
"type": "Text", "type": "Text",
"data": "not foo" "data": "not foo"
} }

@ -0,0 +1,102 @@
{
"hash": "tzpuwu",
"html": {
"start": 0,
"end": 88,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 88,
"type": "IfBlock",
"expression": {
"type": "BinaryExpression",
"start": 5,
"end": 11,
"left": {
"type": "Identifier",
"start": 5,
"end": 6,
"name": "x"
},
"operator": ">",
"right": {
"type": "Literal",
"start": 9,
"end": 11,
"value": 10,
"raw": "10"
}
},
"children": [
{
"start": 14,
"end": 41,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 17,
"end": 37,
"type": "Text",
"data": "x is greater than 10"
}
]
}
],
"else": {
"start": 57,
"end": 83,
"type": "ElseBlock",
"children": [
{
"start": 57,
"end": 88,
"type": "IfBlock",
"elseif": true,
"expression": {
"type": "BinaryExpression",
"start": 51,
"end": 56,
"left": {
"type": "Identifier",
"start": 51,
"end": 52,
"name": "x"
},
"operator": "<",
"right": {
"type": "Literal",
"start": 55,
"end": 56,
"value": 5,
"raw": "5"
}
},
"children": [
{
"start": 59,
"end": 82,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 62,
"end": 78,
"type": "Text",
"data": "x is less than 5"
}
]
}
]
}
]
}
}
]
},
"css": null,
"js": null
}

@ -0,0 +1,102 @@
{
"hash": "tzpuwu",
"html": {
"start": 0,
"end": 88,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 88,
"type": "IfBlock",
"expression": {
"type": "BinaryExpression",
"start": 5,
"end": 11,
"left": {
"type": "Identifier",
"start": 5,
"end": 6,
"name": "x"
},
"operator": ">",
"right": {
"type": "Literal",
"start": 9,
"end": 11,
"value": 10,
"raw": "10"
}
},
"children": [
{
"start": 14,
"end": 41,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 17,
"end": 37,
"type": "Text",
"data": "x is greater than 10"
}
]
}
],
"else": {
"start": 57,
"end": 83,
"type": "ElseBlock",
"children": [
{
"start": 57,
"end": 88,
"type": "IfBlock",
"elseif": true,
"expression": {
"type": "BinaryExpression",
"start": 51,
"end": 56,
"left": {
"type": "Identifier",
"start": 51,
"end": 52,
"name": "x"
},
"operator": "<",
"right": {
"type": "Literal",
"start": 55,
"end": 56,
"value": 5,
"raw": "5"
}
},
"children": [
{
"start": 59,
"end": 82,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 62,
"end": 78,
"type": "Text",
"data": "x is less than 5"
}
]
}
]
}
]
}
}
]
},
"css": null,
"js": null
}

@ -8,8 +8,21 @@
{ {
"start": 0, "start": 0,
"end": 17, "end": 17,
"type": "IfBlock",
"expression": {
"type": "Identifier",
"start": 5,
"end": 8,
"name": "foo"
},
"children": [
{
"start": 9,
"end": 12,
"type": "Text", "type": "Text",
"data": "{#if foo}bar{/if}" "data": "bar"
}
]
} }
] ]
}, },

@ -1,24 +1,24 @@
{ {
"hash": 2374871934, "hash": "w7ju0y",
"html": { "html": {
"start": 0, "start": 0,
"end": 21, "end": 17,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 21, "end": 17,
"type": "IfBlock", "type": "IfBlock",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 6, "start": 5,
"end": 9, "end": 8,
"name": "foo" "name": "foo"
}, },
"children": [ "children": [
{ {
"start": 11, "start": 9,
"end": 14, "end": 12,
"type": "Text", "type": "Text",
"data": "bar" "data": "bar"
} }

@ -14,9 +14,43 @@
"children": [ "children": [
{ {
"start": 3, "start": 3,
"end": 4,
"type": "Text",
"data": " "
},
{
"start": 4,
"end": 16,
"type": "RawMustacheTag",
"expression": {
"type": "Identifier",
"start": 11,
"end": 15,
"name": "raw1"
}
},
{
"start": 16,
"end": 17,
"type": "Text",
"data": " "
},
{
"start": 17,
"end": 29,
"type": "RawMustacheTag",
"expression": {
"type": "Identifier",
"start": 24,
"end": 28,
"name": "raw2"
}
},
{
"start": 29,
"end": 30, "end": 30,
"type": "Text", "type": "Text",
"data": " {@html raw1} {@html raw2} " "data": " "
} }
] ]
} }

@ -1,13 +1,13 @@
{ {
"hash": 183399343, "hash": "9m9gjd",
"html": { "html": {
"start": 0, "start": 0,
"end": 30, "end": 34,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 30, "end": 34,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
@ -20,35 +20,35 @@
}, },
{ {
"start": 4, "start": 4,
"end": 14, "end": 16,
"type": "RawMustacheTag", "type": "RawMustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 7, "start": 11,
"end": 11, "end": 15,
"name": "raw1" "name": "raw1"
} }
}, },
{ {
"start": 14, "start": 16,
"end": 15, "end": 17,
"type": "Text", "type": "Text",
"data": " " "data": " "
}, },
{ {
"start": 15, "start": 17,
"end": 25, "end": 29,
"type": "RawMustacheTag", "type": "RawMustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 18, "start": 24,
"end": 22, "end": 28,
"name": "raw2" "name": "raw2"
} }
}, },
{ {
"start": 25, "start": 29,
"end": 26, "end": 30,
"type": "Text", "type": "Text",
"data": " " "data": " "
} }

@ -14,9 +14,26 @@
"children": [ "children": [
{ {
"start": 4, "start": 4,
"end": 10,
"type": "Text",
"data": "Hello "
},
{
"start": 10,
"end": 16,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 11,
"end": 15,
"name": "name"
}
},
{
"start": 16,
"end": 17, "end": 17,
"type": "Text", "type": "Text",
"data": "Hello {name}!" "data": "!"
} }
] ]
}, },

@ -1,13 +1,13 @@
{ {
"hash": 1378757574, "hash": "lvjec0",
"html": { "html": {
"start": 0, "start": 0,
"end": 24, "end": 22,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 24, "end": 22,
"type": "Element", "type": "Element",
"name": "h1", "name": "h1",
"attributes": [], "attributes": [],
@ -20,26 +20,26 @@
}, },
{ {
"start": 10, "start": 10,
"end": 18, "end": 16,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 12, "start": 11,
"end": 16, "end": 15,
"name": "name" "name": "name"
} }
}, },
{ {
"start": 18, "start": 16,
"end": 19, "end": 17,
"type": "Text", "type": "Text",
"data": "!" "data": "!"
} }
] ]
}, },
{ {
"start": 24, "start": 22,
"end": 26, "end": 24,
"type": "Text", "type": "Text",
"data": "\n\n" "data": "\n\n"
} }
@ -47,40 +47,40 @@
}, },
"css": null, "css": null,
"js": { "js": {
"start": 26, "start": 24,
"end": 143, "end": 141,
"attributes": [], "attributes": [],
"content": { "content": {
"type": "Program", "type": "Program",
"start": 34, "start": 32,
"end": 134, "end": 132,
"body": [ "body": [
{ {
"type": "ExportDefaultDeclaration", "type": "ExportDefaultDeclaration",
"start": 36, "start": 34,
"end": 95, "end": 93,
"declaration": { "declaration": {
"type": "ObjectExpression", "type": "ObjectExpression",
"start": 51, "start": 49,
"end": 94, "end": 92,
"properties": [ "properties": [
{ {
"type": "Property", "type": "Property",
"start": 55, "start": 53,
"end": 91, "end": 89,
"method": false, "method": false,
"shorthand": false, "shorthand": false,
"computed": false, "computed": false,
"key": { "key": {
"type": "Identifier", "type": "Identifier",
"start": 55, "start": 53,
"end": 59, "end": 57,
"name": "data" "name": "data"
}, },
"value": { "value": {
"type": "ArrowFunctionExpression", "type": "ArrowFunctionExpression",
"start": 61, "start": 59,
"end": 91, "end": 89,
"id": null, "id": null,
"generator": false, "generator": false,
"expression": true, "expression": true,
@ -88,26 +88,26 @@
"params": [], "params": [],
"body": { "body": {
"type": "ObjectExpression", "type": "ObjectExpression",
"start": 68, "start": 66,
"end": 90, "end": 88,
"properties": [ "properties": [
{ {
"type": "Property", "type": "Property",
"start": 73, "start": 71,
"end": 86, "end": 84,
"method": false, "method": false,
"shorthand": false, "shorthand": false,
"computed": false, "computed": false,
"key": { "key": {
"type": "Identifier", "type": "Identifier",
"start": 73, "start": 71,
"end": 77, "end": 75,
"name": "name" "name": "name"
}, },
"value": { "value": {
"type": "Literal", "type": "Literal",
"start": 79, "start": 77,
"end": 86, "end": 84,
"value": "world", "value": "world",
"raw": "'world'" "raw": "'world'"
}, },

@ -14,9 +14,26 @@
"children": [ "children": [
{ {
"start": 4, "start": 4,
"end": 10,
"type": "Text",
"data": "Hello "
},
{
"start": 10,
"end": 16,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 11,
"end": 15,
"name": "name"
}
},
{
"start": 16,
"end": 17, "end": 17,
"type": "Text", "type": "Text",
"data": "Hello {name}!" "data": "!"
} }
] ]
}, },

@ -1,13 +1,13 @@
{ {
"hash": 619854804, "hash": "19sno7e",
"html": { "html": {
"start": 0, "start": 0,
"end": 24, "end": 22,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 24, "end": 22,
"type": "Element", "type": "Element",
"name": "h1", "name": "h1",
"attributes": [], "attributes": [],
@ -20,26 +20,26 @@
}, },
{ {
"start": 10, "start": 10,
"end": 18, "end": 16,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 12, "start": 11,
"end": 16, "end": 15,
"name": "name" "name": "name"
} }
}, },
{ {
"start": 18, "start": 16,
"end": 19, "end": 17,
"type": "Text", "type": "Text",
"data": "!" "data": "!"
} }
] ]
}, },
{ {
"start": 24, "start": 22,
"end": 26, "end": 24,
"type": "Text", "type": "Text",
"data": "\n\n" "data": "\n\n"
} }
@ -47,40 +47,40 @@
}, },
"css": null, "css": null,
"js": { "js": {
"start": 26, "start": 24,
"end": 132, "end": 130,
"attributes": [], "attributes": [],
"content": { "content": {
"type": "Program", "type": "Program",
"start": 34, "start": 32,
"end": 123, "end": 121,
"body": [ "body": [
{ {
"type": "ExportDefaultDeclaration", "type": "ExportDefaultDeclaration",
"start": 36, "start": 34,
"end": 95, "end": 93,
"declaration": { "declaration": {
"type": "ObjectExpression", "type": "ObjectExpression",
"start": 51, "start": 49,
"end": 94, "end": 92,
"properties": [ "properties": [
{ {
"type": "Property", "type": "Property",
"start": 55, "start": 53,
"end": 91, "end": 89,
"method": false, "method": false,
"shorthand": false, "shorthand": false,
"computed": false, "computed": false,
"key": { "key": {
"type": "Identifier", "type": "Identifier",
"start": 55, "start": 53,
"end": 59, "end": 57,
"name": "data" "name": "data"
}, },
"value": { "value": {
"type": "ArrowFunctionExpression", "type": "ArrowFunctionExpression",
"start": 61, "start": 59,
"end": 91, "end": 89,
"id": null, "id": null,
"generator": false, "generator": false,
"expression": true, "expression": true,
@ -88,26 +88,26 @@
"params": [], "params": [],
"body": { "body": {
"type": "ObjectExpression", "type": "ObjectExpression",
"start": 68, "start": 66,
"end": 90, "end": 88,
"properties": [ "properties": [
{ {
"type": "Property", "type": "Property",
"start": 73, "start": 71,
"end": 86, "end": 84,
"method": false, "method": false,
"shorthand": false, "shorthand": false,
"computed": false, "computed": false,
"key": { "key": {
"type": "Identifier", "type": "Identifier",
"start": 73, "start": 71,
"end": 77, "end": 75,
"name": "name" "name": "name"
}, },
"value": { "value": {
"type": "Literal", "type": "Literal",
"start": 79, "start": 77,
"end": 86, "end": 84,
"value": "world", "value": "world",
"raw": "'world'" "raw": "'world'"
}, },

@ -14,9 +14,26 @@
"children": [ "children": [
{ {
"start": 4, "start": 4,
"end": 10,
"type": "Text",
"data": "Hello "
},
{
"start": 10,
"end": 16,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 11,
"end": 15,
"name": "name"
}
},
{
"start": 16,
"end": 17, "end": 17,
"type": "Text", "type": "Text",
"data": "Hello {name}!" "data": "!"
} }
] ]
}, },

@ -1,13 +1,13 @@
{ {
"hash": 388108696, "hash": "6jy7zq",
"html": { "html": {
"start": 0, "start": 0,
"end": 24, "end": 22,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 24, "end": 22,
"type": "Element", "type": "Element",
"name": "h1", "name": "h1",
"attributes": [], "attributes": [],
@ -20,26 +20,26 @@
}, },
{ {
"start": 10, "start": 10,
"end": 18, "end": 16,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 12, "start": 11,
"end": 16, "end": 15,
"name": "name" "name": "name"
} }
}, },
{ {
"start": 18, "start": 16,
"end": 19, "end": 17,
"type": "Text", "type": "Text",
"data": "!" "data": "!"
} }
] ]
}, },
{ {
"start": 24, "start": 22,
"end": 26, "end": 24,
"type": "Text", "type": "Text",
"data": "\n\n" "data": "\n\n"
} }
@ -47,40 +47,40 @@
}, },
"css": null, "css": null,
"js": { "js": {
"start": 26, "start": 24,
"end": 105, "end": 103,
"attributes": [], "attributes": [],
"content": { "content": {
"type": "Program", "type": "Program",
"start": 34, "start": 32,
"end": 96, "end": 94,
"body": [ "body": [
{ {
"type": "ExportDefaultDeclaration", "type": "ExportDefaultDeclaration",
"start": 36, "start": 34,
"end": 95, "end": 93,
"declaration": { "declaration": {
"type": "ObjectExpression", "type": "ObjectExpression",
"start": 51, "start": 49,
"end": 94, "end": 92,
"properties": [ "properties": [
{ {
"type": "Property", "type": "Property",
"start": 55, "start": 53,
"end": 91, "end": 89,
"method": false, "method": false,
"shorthand": false, "shorthand": false,
"computed": false, "computed": false,
"key": { "key": {
"type": "Identifier", "type": "Identifier",
"start": 55, "start": 53,
"end": 59, "end": 57,
"name": "data" "name": "data"
}, },
"value": { "value": {
"type": "ArrowFunctionExpression", "type": "ArrowFunctionExpression",
"start": 61, "start": 59,
"end": 91, "end": 89,
"id": null, "id": null,
"generator": false, "generator": false,
"expression": true, "expression": true,
@ -88,26 +88,26 @@
"params": [], "params": [],
"body": { "body": {
"type": "ObjectExpression", "type": "ObjectExpression",
"start": 68, "start": 66,
"end": 90, "end": 88,
"properties": [ "properties": [
{ {
"type": "Property", "type": "Property",
"start": 73, "start": 71,
"end": 86, "end": 84,
"method": false, "method": false,
"shorthand": false, "shorthand": false,
"computed": false, "computed": false,
"key": { "key": {
"type": "Identifier", "type": "Identifier",
"start": 73, "start": 71,
"end": 77, "end": 75,
"name": "name" "name": "name"
}, },
"value": { "value": {
"type": "Literal", "type": "Literal",
"start": 79, "start": 77,
"end": 86, "end": 84,
"value": "world", "value": "world",
"raw": "'world'" "raw": "'world'"
}, },

@ -7,10 +7,28 @@
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 17, "end": 57,
"type": "Text", "type": "IfBlock",
"data": "{#if depth > 1}\n\t" "expression": {
"type": "BinaryExpression",
"start": 5,
"end": 14,
"left": {
"type": "Identifier",
"start": 5,
"end": 10,
"name": "depth"
},
"operator": ">",
"right": {
"type": "Literal",
"start": 13,
"end": 14,
"value": 1,
"raw": "1"
}
}, },
"children": [
{ {
"start": 17, "start": 17,
"end": 51, "end": 51,
@ -26,19 +44,33 @@
{ {
"start": 37, "start": 37,
"end": 48, "end": 48,
"type": "Text", "type": "MustacheTag",
"data": "{depth - 1}" "expression": {
"type": "BinaryExpression",
"start": 38,
"end": 47,
"left": {
"type": "Identifier",
"start": 38,
"end": 43,
"name": "depth"
},
"operator": "-",
"right": {
"type": "Literal",
"start": 46,
"end": 47,
"value": 1,
"raw": "1"
}
}
} }
] ]
} }
], ],
"children": [] "children": []
}, }
{ ]
"start": 51,
"end": 57,
"type": "Text",
"data": "\n{/if}"
} }
] ]
}, },

@ -1,5 +1,5 @@
{ {
"hash": 216762188, "hash": "1wh7lqr",
"html": { "html": {
"start": 0, "start": 0,
"end": 57, "end": 57,
@ -11,55 +11,55 @@
"type": "IfBlock", "type": "IfBlock",
"expression": { "expression": {
"type": "BinaryExpression", "type": "BinaryExpression",
"start": 6, "start": 5,
"end": 15, "end": 14,
"left": { "left": {
"type": "Identifier", "type": "Identifier",
"start": 6, "start": 5,
"end": 11, "end": 10,
"name": "depth" "name": "depth"
}, },
"operator": ">", "operator": ">",
"right": { "right": {
"type": "Literal", "type": "Literal",
"start": 14, "start": 13,
"end": 15, "end": 14,
"value": 1, "value": 1,
"raw": "1" "raw": "1"
} }
}, },
"children": [ "children": [
{ {
"start": 19, "start": 17,
"end": 49, "end": 51,
"type": "Element", "type": "Element",
"name": ":Self", "name": "svelte:self",
"attributes": [ "attributes": [
{ {
"start": 26, "start": 30,
"end": 47, "end": 49,
"type": "Attribute", "type": "Attribute",
"name": "depth", "name": "depth",
"value": [ "value": [
{ {
"start": 33, "start": 37,
"end": 46, "end": 48,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "BinaryExpression", "type": "BinaryExpression",
"start": 35, "start": 38,
"end": 44, "end": 47,
"left": { "left": {
"type": "Identifier", "type": "Identifier",
"start": 35, "start": 38,
"end": 40, "end": 43,
"name": "depth" "name": "depth"
}, },
"operator": "-", "operator": "-",
"right": { "right": {
"type": "Literal", "type": "Literal",
"start": 43, "start": 46,
"end": 44, "end": 47,
"value": 1, "value": 1,
"raw": "1" "raw": "1"
} }

@ -14,9 +14,60 @@
"children": [ "children": [
{ {
"start": 3, "start": 3,
"end": 4,
"type": "Text",
"data": " "
},
{
"start": 4,
"end": 7,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 5,
"end": 6,
"name": "a"
}
},
{
"start": 7,
"end": 8,
"type": "Text",
"data": " "
},
{
"start": 8,
"end": 11,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 9,
"end": 10,
"name": "b"
}
},
{
"start": 11,
"end": 14,
"type": "Text",
"data": " : "
},
{
"start": 14,
"end": 17,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 15,
"end": 16,
"name": "c"
}
},
{
"start": 17,
"end": 20, "end": 20,
"type": "Text", "type": "Text",
"data": " {a} {b} : {c} : " "data": " : "
} }
] ]
} }

@ -1,13 +1,13 @@
{ {
"hash": 1185019088, "hash": "1n7rpsi",
"html": { "html": {
"start": 0, "start": 0,
"end": 30, "end": 24,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 30, "end": 24,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
@ -20,52 +20,52 @@
}, },
{ {
"start": 4, "start": 4,
"end": 9, "end": 7,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 6, "start": 5,
"end": 7, "end": 6,
"name": "a" "name": "a"
} }
}, },
{ {
"start": 9, "start": 7,
"end": 10, "end": 8,
"type": "Text", "type": "Text",
"data": " " "data": " "
}, },
{ {
"start": 10, "start": 8,
"end": 15, "end": 11,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 12, "start": 9,
"end": 13, "end": 10,
"name": "b" "name": "b"
} }
}, },
{ {
"start": 15, "start": 11,
"end": 18, "end": 14,
"type": "Text", "type": "Text",
"data": " : " "data": " : "
}, },
{ {
"start": 18, "start": 14,
"end": 23, "end": 17,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 20, "start": 15,
"end": 21, "end": 16,
"name": "c" "name": "c"
} }
}, },
{ {
"start": 23, "start": 17,
"end": 26, "end": 20,
"type": "Text", "type": "Text",
"data": " : " "data": " : "
} }

@ -14,9 +14,13 @@
{ {
"start": 5, "start": 5,
"end": 15, "end": 15,
"type": "Attribute", "type": "Spread",
"name": "{...props}", "expression": {
"value": true "type": "Identifier",
"start": 9,
"end": 14,
"name": "props"
}
} }
], ],
"children": [] "children": []

@ -1,24 +1,24 @@
{ {
"hash": "phg0l6", "hash": "z82kse",
"html": { "html": {
"start": 0, "start": 0,
"end": 24, "end": 22,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 24, "end": 22,
"type": "Element", "type": "Element",
"name": "div", "name": "div",
"attributes": [ "attributes": [
{ {
"start": 5, "start": 5,
"end": 17, "end": 15,
"type": "Spread", "type": "Spread",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 10, "start": 9,
"end": 15, "end": 14,
"name": "props" "name": "props"
} }
} }

@ -14,9 +14,26 @@
"children": [ "children": [
{ {
"start": 10, "start": 10,
"end": 40,
"type": "Text",
"data": "\n\t<p>not actually an element. "
},
{
"start": 40,
"end": 45,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 41,
"end": 44,
"name": "foo"
}
},
{
"start": 45,
"end": 50, "end": 50,
"type": "Text", "type": "Text",
"data": "\n\t<p>not actually an element. {foo}</p>\n" "data": "</p>\n"
} }
] ]
} }

@ -1,13 +1,13 @@
{ {
"hash": 2992234421, "hash": "1uyqul7",
"html": { "html": {
"start": 0, "start": 0,
"end": 63, "end": 61,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 63, "end": 61,
"type": "Element", "type": "Element",
"name": "textarea", "name": "textarea",
"attributes": [], "attributes": [],
@ -20,18 +20,18 @@
}, },
{ {
"start": 40, "start": 40,
"end": 47, "end": 45,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 42, "start": 41,
"end": 45, "end": 44,
"name": "foo" "name": "foo"
} }
}, },
{ {
"start": 47, "start": 45,
"end": 52, "end": 50,
"type": "Text", "type": "Text",
"data": "</p>\n" "data": "</p>\n"
} }

@ -7,10 +7,15 @@
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 22, "end": 41,
"type": "Text", "type": "EachBlock",
"data": "{#each things as 𐊧}\n\t" "expression": {
"type": "Identifier",
"start": 7,
"end": 13,
"name": "things"
}, },
"children": [
{ {
"start": 22, "start": 22,
"end": 33, "end": 33,
@ -21,16 +26,18 @@
{ {
"start": 25, "start": 25,
"end": 29, "end": 29,
"type": "Text", "type": "MustacheTag",
"data": "{𐊧}" "expression": {
"type": "Identifier",
"start": 26,
"end": 28,
"name": "𐊧"
}
} }
] ]
}, }
{ ],
"start": 33, "context": "𐊧"
"end": 41,
"type": "Text",
"data": "\n{/each}"
} }
] ]
}, },

@ -1,36 +1,36 @@
{ {
"hash": 795130236, "hash": "8weqxs",
"html": { "html": {
"start": 0, "start": 0,
"end": 47, "end": 41,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 47, "end": 41,
"type": "EachBlock", "type": "EachBlock",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 8, "start": 7,
"end": 14, "end": 13,
"name": "things" "name": "things"
}, },
"children": [ "children": [
{ {
"start": 24, "start": 22,
"end": 37, "end": 33,
"type": "Element", "type": "Element",
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 27, "start": 25,
"end": 33, "end": 29,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 29, "start": 26,
"end": 31, "end": 28,
"name": "𐊧" "name": "𐊧"
} }
} }

@ -27,9 +27,20 @@
"children": [ "children": [
{ {
"start": 18, "start": 18,
"end": 24,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 19,
"end": 23,
"name": "name"
}
},
{
"start": 24,
"end": 26, "end": 26,
"type": "Text", "type": "Text",
"data": "{name}! " "data": "! "
} }
] ]
}, },

@ -1,13 +1,13 @@
{ {
"hash": 2961389466, "hash": "1827l8g",
"html": { "html": {
"start": 0, "start": 0,
"end": 67, "end": 65,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 67, "end": 65,
"type": "Element", "type": "Element",
"name": "h1", "name": "h1",
"attributes": [], "attributes": [],
@ -20,40 +20,40 @@
}, },
{ {
"start": 10, "start": 10,
"end": 37, "end": 35,
"type": "Element", "type": "Element",
"name": "strong", "name": "strong",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 18, "start": 18,
"end": 26, "end": 24,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 20, "start": 19,
"end": 24, "end": 23,
"name": "name" "name": "name"
} }
}, },
{ {
"start": 26, "start": 24,
"end": 28, "end": 26,
"type": "Text", "type": "Text",
"data": "! " "data": "! "
} }
] ]
}, },
{ {
"start": 37, "start": 35,
"end": 62, "end": 60,
"type": "Element", "type": "Element",
"name": "span", "name": "span",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"start": 43, "start": 41,
"end": 55, "end": 53,
"type": "Text", "type": "Text",
"data": "How are you?" "data": "How are you?"
} }

@ -1,17 +1,20 @@
{ {
"hash": "1oiqcow", "hash": "1na2f8c",
"html": { "html": {
"start": 0, "start": 0,
"end": 9, "end": 7,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 9, "end": 7,
"type": "Element", "type": "MustacheTag",
"name": "slot", "expression": {
"attributes": [], "start": 1,
"children": [] "end": 6,
"type": "Identifier",
"name": "yield"
}
} }
] ]
}, },

@ -1,17 +1,20 @@
{ {
"hash": 3659433152, "hash": "1na2f8c",
"html": { "html": {
"start": 0, "start": 0,
"end": 9, "end": 7,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{ {
"start": 0, "start": 0,
"end": 9, "end": 7,
"type": "Element", "type": "MustacheTag",
"name": "slot", "expression": {
"attributes": [], "start": 1,
"children": [] "end": 6,
"type": "Identifier",
"name": "yield"
}
} }
] ]
}, },

Loading…
Cancel
Save