update parser tests

pull/676/head
Rich Harris 8 years ago
parent df1870df8b
commit c98e1f49d3

@ -77,10 +77,18 @@ export class Parser {
this.error('Unexpected end of input'); this.error('Unexpected end of input');
} }
// trim unnecessary whitespace if (this.html.children.length) {
// stripWhitespace(this.html.children); let start = this.html.children[0] && this.html.children[0].start;
// this.html.start = this.html.children[0] && this.html.children.start; while (/\s/.test(template[start])) start += 1;
// this.html.end = this.html.children[this.html.children.length] && this.html.children[this.html.children.length].end;
let end = this.html.children[this.html.children.length - 1] && this.html.children[this.html.children.length - 1].end;
while (/\s/.test(template[end - 1])) end -= 1;
this.html.start = start;
this.html.end = end;
} else {
this.html.start = this.html.end = null;
}
} }
current() { current() {

@ -2,7 +2,7 @@ import assert from 'assert';
import fs from 'fs'; import fs from 'fs';
import { svelte } from '../helpers.js'; import { svelte } from '../helpers.js';
describe.skip('parse', () => { describe('parse', () => {
fs.readdirSync('test/parser/samples').forEach(dir => { fs.readdirSync('test/parser/samples').forEach(dir => {
if (dir[0] === '.') return; if (dir[0] === '.') return;

@ -1,4 +1,5 @@
{ {
"hash": 3179574701,
"html": { "html": {
"start": 0, "start": 0,
"end": 45, "end": 45,
@ -21,9 +22,9 @@
"end": 32, "end": 32,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 22, "start": 22,
"end": 30, "end": 30,
"type": "Identifier",
"name": "readonly" "name": "readonly"
} }
} }

@ -1,5 +1,5 @@
{ {
"hash": 3305933215, "hash": 2788845841,
"html": { "html": {
"start": 0, "start": 0,
"end": 29, "end": 29,

@ -1,4 +1,5 @@
{ {
"hash": 804348386,
"html": { "html": {
"start": 0, "start": 0,
"end": 46, "end": 46,
@ -27,9 +28,9 @@
"end": 28, "end": 28,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 21, "start": 21,
"end": 26, "end": 26,
"type": "Identifier",
"name": "color" "name": "color"
} }
}, },
@ -48,9 +49,9 @@
"end": 40, "end": 40,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 33, "start": 33,
"end": 38, "end": 38,
"type": "Identifier",
"name": "color" "name": "color"
} }
} }

@ -1,4 +1,5 @@
{ {
"hash": 1563956934,
"html": { "html": {
"start": 0, "start": 0,
"end": 41, "end": 41,

@ -1,4 +1,5 @@
{ {
"hash": 507039402,
"html": { "html": {
"start": 0, "start": 0,
"end": 28, "end": 28,

@ -1,5 +1,5 @@
{ {
"hash": 4120363214, "hash": 1705925892,
"html": { "html": {
"start": 0, "start": 0,
"end": 10, "end": 10,
@ -18,9 +18,9 @@
"name": "id", "name": "id",
"value": [ "value": [
{ {
"type": "AttributeShorthand",
"start": 6, "start": 6,
"end": 8, "end": 8,
"type": "AttributeShorthand",
"expression": { "expression": {
"type": "Identifier", "type": "Identifier",
"start": 6, "start": 6,

@ -1,4 +1,5 @@
{ {
"hash": 606864228,
"html": { "html": {
"start": 0, "start": 0,
"end": 30, "end": 30,

@ -1,4 +1,5 @@
{ {
"hash": 1493227373,
"html": { "html": {
"start": 0, "start": 0,
"end": 23, "end": 23,

@ -1,4 +1,5 @@
{ {
"hash": 3488539025,
"html": { "html": {
"start": 0, "start": 0,
"end": 21, "end": 21,

@ -1,4 +1,5 @@
{ {
"hash": 3088875001,
"html": { "html": {
"start": 0, "start": 0,
"end": 18, "end": 18,

@ -1,4 +1,5 @@
{ {
"hash": 1937205193,
"html": { "html": {
"start": 0, "start": 0,
"end": 25, "end": 25,
@ -16,9 +17,9 @@
"type": "Binding", "type": "Binding",
"name": "value", "name": "value",
"value": { "value": {
"type": "Identifier",
"start": 19, "start": 19,
"end": 23, "end": 23,
"type": "Identifier",
"name": "name" "name": "name"
} }
} }

@ -1,4 +1,5 @@
{ {
"hash": 3294612990,
"html": { "html": {
"start": 0, "start": 0,
"end": 18, "end": 18,

@ -1,4 +1,5 @@
{ {
"hash": 2365862121,
"html": { "html": {
"start": 0, "start": 0,
"end": 24, "end": 24,

@ -1,4 +1,5 @@
{ {
"hash": 156753432,
"html": { "html": {
"start": 0, "start": 0,
"end": 17, "end": 17,

@ -1,4 +1,5 @@
{ {
"hash": 1147407419,
"html": { "html": {
"start": 0, "start": 0,
"end": 14, "end": 14,
@ -18,6 +19,12 @@
"data": "foo" "data": "foo"
} }
] ]
},
{
"start": 14,
"end": 16,
"type": "Text",
"data": "\n\n"
} }
] ]
}, },
@ -25,65 +32,65 @@
"start": 16, "start": 16,
"end": 56, "end": 56,
"attributes": [], "attributes": [],
"content": {
"start": 23,
"end": 48,
"styles": "\n\tdiv {\n\t\tcolor: red;\n\t}\n"
},
"children": [ "children": [
{ {
"type": "Rule", "type": "Rule",
"start": 25,
"end": 47,
"selector": { "selector": {
"type": "SelectorList", "type": "SelectorList",
"start": 25,
"end": 28,
"children": [ "children": [
{ {
"type": "Selector", "type": "Selector",
"start": 25,
"end": 28,
"children": [ "children": [
{ {
"type": "TypeSelector", "type": "TypeSelector",
"name": "div",
"start": 25, "start": 25,
"end": 28, "end": 28
"name": "div"
} }
] ],
"start": 25,
"end": 28
} }
] ],
"start": 25,
"end": 28
}, },
"block": { "block": {
"type": "Block", "type": "Block",
"start": 29,
"end": 47,
"children": [ "children": [
{ {
"type": "Declaration", "type": "Declaration",
"start": 33,
"end": 43,
"important": false, "important": false,
"property": "color", "property": "color",
"value": { "value": {
"type": "Value", "type": "Value",
"start": 39,
"end": 43,
"children": [ "children": [
{ {
"type": "Identifier", "type": "Identifier",
"name": "red",
"start": 40, "start": 40,
"end": 43, "end": 43
"name": "red"
}
]
} }
],
"start": 39,
"end": 43
},
"start": 33,
"end": 43
} }
] ],
"start": 29,
"end": 47
},
"start": 25,
"end": 47
} }
],
"content": {
"start": 23,
"end": 48,
"styles": "\n\tdiv {\n\t\tcolor: red;\n\t}\n"
} }
]
}, },
"js": null "js": null
} }

@ -1,4 +1,5 @@
{ {
"hash": 3238289871,
"html": { "html": {
"start": 0, "start": 0,
"end": 84, "end": 84,
@ -9,12 +10,11 @@
"end": 84, "end": 84,
"type": "EachBlock", "type": "EachBlock",
"expression": { "expression": {
"type": "Identifier",
"start": 8, "start": 8,
"end": 15, "end": 15,
"type": "Identifier",
"name": "animals" "name": "animals"
}, },
"context": "animal",
"children": [ "children": [
{ {
"start": 29, "start": 29,
@ -28,36 +28,37 @@
"end": 42, "end": 42,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 34, "start": 34,
"end": 40, "end": 40,
"type": "Identifier",
"name": "animal" "name": "animal"
} }
} }
] ]
} }
], ],
"context": "animal",
"else": { "else": {
"start": 55,
"end": 75,
"type": "ElseBlock",
"children": [ "children": [
{ {
"start": 57,
"end": 74,
"type": "Element",
"name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"data": "no animals",
"end": 70,
"start": 60, "start": 60,
"type": "Text" "end": 70,
"type": "Text",
"data": "no animals"
} }
], ]
"end": 74,
"name": "p",
"start": 57,
"type": "Element"
} }
], ]
"end": 75,
"start": 55,
"type": "ElseBlock"
} }
} }
] ]

@ -1,4 +1,5 @@
{ {
"hash": 2841674990,
"html": { "html": {
"start": 0, "start": 0,
"end": 66, "end": 66,
@ -9,13 +10,11 @@
"end": 66, "end": 66,
"type": "EachBlock", "type": "EachBlock",
"expression": { "expression": {
"type": "Identifier",
"start": 8, "start": 8,
"end": 15, "end": 15,
"type": "Identifier",
"name": "animals" "name": "animals"
}, },
"context": "animal",
"index": "i",
"children": [ "children": [
{ {
"start": 32, "start": 32,
@ -29,9 +28,9 @@
"end": 40, "end": 40,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 37, "start": 37,
"end": 38, "end": 38,
"type": "Identifier",
"name": "i" "name": "i"
} }
}, },
@ -46,15 +45,17 @@
"end": 52, "end": 52,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 44, "start": 44,
"end": 50, "end": 50,
"type": "Identifier",
"name": "animal" "name": "animal"
} }
} }
] ]
} }
] ],
"context": "animal",
"index": "i"
} }
] ]
}, },

@ -1,4 +1,5 @@
{ {
"hash": 2025411181,
"html": { "html": {
"start": 0, "start": 0,
"end": 54, "end": 54,
@ -9,13 +10,11 @@
"end": 54, "end": 54,
"type": "EachBlock", "type": "EachBlock",
"expression": { "expression": {
"type": "Identifier",
"start": 8, "start": 8,
"end": 13, "end": 13,
"type": "Identifier",
"name": "todos" "name": "todos"
}, },
"context": "todo",
"key": "id",
"children": [ "children": [
{ {
"start": 29, "start": 29,
@ -29,15 +28,17 @@
"end": 40, "end": 40,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 34, "start": 34,
"end": 38, "end": 38,
"type": "Identifier",
"name": "todo" "name": "todo"
} }
} }
] ]
} }
] ],
"context": "todo",
"key": "id"
} }
] ]
}, },

@ -1,4 +1,5 @@
{ {
"hash": 220340986,
"html": { "html": {
"start": 0, "start": 0,
"end": 56, "end": 56,
@ -9,12 +10,11 @@
"end": 56, "end": 56,
"type": "EachBlock", "type": "EachBlock",
"expression": { "expression": {
"type": "Identifier",
"start": 8, "start": 8,
"end": 15, "end": 15,
"type": "Identifier",
"name": "animals" "name": "animals"
}, },
"context": "animal",
"children": [ "children": [
{ {
"start": 29, "start": 29,
@ -28,15 +28,16 @@
"end": 42, "end": 42,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 34, "start": 34,
"end": 40, "end": 40,
"type": "Identifier",
"name": "animal" "name": "animal"
} }
} }
] ]
} }
] ],
"context": "animal"
} }
] ]
}, },

@ -1,4 +1,5 @@
{ {
"hash": 1265376132,
"html": { "html": {
"start": 0, "start": 0,
"end": 24, "end": 24,
@ -22,9 +23,9 @@
"end": 18, "end": 18,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 12, "start": 12,
"end": 16, "end": 16,
"type": "Identifier",
"name": "name" "name": "name"
} }
}, },

@ -1,4 +1,5 @@
{ {
"hash": 611274658,
"html": { "html": {
"start": 0, "start": 0,
"end": 17, "end": 17,

@ -1,22 +1,27 @@
{ {
"hash": 825536165,
"html": { "html": {
"start": 0, "start": 0,
"end": 15, "end": 15,
"type": "Fragment", "type": "Fragment",
"children": [{ "children": [
"attributes": [{ {
"end": 14, "start": 0,
"name": "html", "end": 15,
"type": "Element",
"name": "!doctype",
"attributes": [
{
"start": 10, "start": 10,
"end": 14,
"type": "Attribute", "type": "Attribute",
"name": "html",
"value": true "value": true
}], }
"children": [], ],
"end": 15, "children": []
"name": "!doctype", }
"start": 0, ]
"type": "Element"
}]
}, },
"css": null, "css": null,
"js": null "js": null

@ -1,4 +1,5 @@
{ {
"hash": 4260626221,
"html": { "html": {
"start": 0, "start": 0,
"end": 101, "end": 101,
@ -16,48 +17,48 @@
"type": "EventHandler", "type": "EventHandler",
"name": "click", "name": "click",
"expression": { "expression": {
"type": "CallExpression",
"start": 18, "start": 18,
"end": 44, "end": 44,
"type": "CallExpression",
"callee": { "callee": {
"type": "Identifier",
"start": 18, "start": 18,
"end": 21, "end": 21,
"type": "Identifier",
"name": "set" "name": "set"
}, },
"arguments": [ "arguments": [
{ {
"type": "ObjectExpression",
"start": 22, "start": 22,
"end": 43, "end": 43,
"type": "ObjectExpression",
"properties": [ "properties": [
{ {
"type": "Property",
"start": 24, "start": 24,
"end": 41, "end": 41,
"type": "Property",
"kind": "init",
"computed": false,
"method": false, "method": false,
"shorthand": false, "shorthand": false,
"computed": false,
"key": { "key": {
"type": "Identifier",
"start": 24, "start": 24,
"end": 31, "end": 31,
"type": "Identifier",
"name": "visible" "name": "visible"
}, },
"value": { "value": {
"type": "UnaryExpression",
"start": 33, "start": 33,
"end": 41, "end": 41,
"type": "UnaryExpression",
"operator": "!", "operator": "!",
"prefix": true, "prefix": true,
"argument": { "argument": {
"type": "Identifier",
"start": 34, "start": 34,
"end": 41, "end": 41,
"type": "Identifier",
"name": "visible" "name": "visible"
} }
} },
"kind": "init"
} }
] ]
} }
@ -67,10 +68,10 @@
], ],
"children": [ "children": [
{ {
"data": "toggle",
"start": 46, "start": 46,
"end": 52, "end": 52,
"type": "Text" "type": "Text",
"data": "toggle"
} }
] ]
}, },
@ -85,10 +86,10 @@
"end": 101, "end": 101,
"type": "IfBlock", "type": "IfBlock",
"expression": { "expression": {
"end": 76, "type": "Identifier",
"name": "visible",
"start": 69, "start": 69,
"type": "Identifier" "end": 76,
"name": "visible"
}, },
"children": [ "children": [
{ {
@ -99,10 +100,10 @@
"attributes": [], "attributes": [],
"children": [ "children": [
{ {
"data": "hello!",
"end": 89,
"start": 83, "start": 83,
"type": "Text" "end": 89,
"type": "Text",
"data": "hello!"
} }
] ]
} }

@ -1,4 +1,5 @@
{ {
"hash": 3134964533,
"html": { "html": {
"start": 0, "start": 0,
"end": 56, "end": 56,
@ -9,9 +10,9 @@
"end": 56, "end": 56,
"type": "IfBlock", "type": "IfBlock",
"expression": { "expression": {
"type": "Identifier",
"start": 6, "start": 6,
"end": 9, "end": 9,
"type": "Identifier",
"name": "foo" "name": "foo"
}, },
"children": [ "children": [

@ -1,4 +1,5 @@
{ {
"hash": 985817334,
"html": { "html": {
"start": 0, "start": 0,
"end": 93, "end": 93,
@ -9,20 +10,20 @@
"end": 93, "end": 93,
"type": "IfBlock", "type": "IfBlock",
"expression": { "expression": {
"type": "BinaryExpression",
"start": 6, "start": 6,
"end": 12, "end": 12,
"type": "BinaryExpression",
"operator": ">",
"left": { "left": {
"type": "Identifier",
"start": 6, "start": 6,
"end": 7, "end": 7,
"type": "Identifier",
"name": "x" "name": "x"
}, },
"operator": ">",
"right": { "right": {
"type": "Literal",
"start": 10, "start": 10,
"end": 12, "end": 12,
"type": "Literal",
"value": 10, "value": 10,
"raw": "10" "raw": "10"
} }
@ -55,20 +56,20 @@
"type": "IfBlock", "type": "IfBlock",
"elseif": true, "elseif": true,
"expression": { "expression": {
"type": "BinaryExpression",
"start": 53, "start": 53,
"end": 58, "end": 58,
"type": "BinaryExpression",
"operator": "<",
"left": { "left": {
"type": "Identifier",
"start": 53, "start": 53,
"end": 54, "end": 54,
"type": "Identifier",
"name": "x" "name": "x"
}, },
"operator": "<",
"right": { "right": {
"type": "Literal",
"start": 57, "start": 57,
"end": 58, "end": 58,
"type": "Literal",
"value": 5, "value": 5,
"raw": "5" "raw": "5"
} }

@ -1,4 +1,5 @@
{ {
"hash": 2374871934,
"html": { "html": {
"start": 0, "start": 0,
"end": 21, "end": 21,
@ -9,9 +10,9 @@
"end": 21, "end": 21,
"type": "IfBlock", "type": "IfBlock",
"expression": { "expression": {
"type": "Identifier",
"start": 6, "start": 6,
"end": 9, "end": 9,
"type": "Identifier",
"name": "foo" "name": "foo"
}, },
"children": [ "children": [

@ -1,5 +1,5 @@
{ {
"hash": 3806276940, "hash": 126082492,
"html": { "html": {
"start": 0, "start": 0,
"end": 31, "end": 31,
@ -12,6 +12,12 @@
"name": "ul", "name": "ul",
"attributes": [], "attributes": [],
"children": [ "children": [
{
"start": 4,
"end": 6,
"type": "Text",
"data": "\n\t"
},
{ {
"start": 6, "start": 6,
"end": 13, "end": 13,
@ -23,7 +29,7 @@
"start": 10, "start": 10,
"end": 13, "end": 13,
"type": "Text", "type": "Text",
"data": "a" "data": "a\n\t"
} }
] ]
}, },
@ -38,7 +44,7 @@
"start": 17, "start": 17,
"end": 20, "end": 20,
"type": "Text", "type": "Text",
"data": "b" "data": "b\n\t"
} }
] ]
}, },

@ -1,5 +1,5 @@
{ {
"hash": 2678229240, "hash": 4049070444,
"html": { "html": {
"start": 0, "start": 0,
"end": 19, "end": 19,

@ -1,4 +1,5 @@
{ {
"hash": 183399343,
"html": { "html": {
"start": 0, "start": 0,
"end": 30, "end": 30,
@ -11,14 +12,20 @@
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{
"start": 3,
"end": 4,
"type": "Text",
"data": " "
},
{ {
"start": 4, "start": 4,
"end": 14, "end": 14,
"type": "RawMustacheTag", "type": "RawMustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 7, "start": 7,
"end": 11, "end": 11,
"type": "Identifier",
"name": "raw1" "name": "raw1"
} }
}, },
@ -33,11 +40,17 @@
"end": 25, "end": 25,
"type": "RawMustacheTag", "type": "RawMustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 18, "start": 18,
"end": 22, "end": 22,
"type": "Identifier",
"name": "raw2" "name": "raw2"
} }
},
{
"start": 25,
"end": 26,
"type": "Text",
"data": " "
} }
] ]
} }

@ -1,4 +1,5 @@
{ {
"hash": 850398275,
"html": { "html": {
"start": 0, "start": 0,
"end": 25, "end": 25,

@ -1,4 +1,5 @@
{ {
"hash": 3451341610,
"html": { "html": {
"start": 0, "start": 0,
"end": 11, "end": 11,
@ -11,6 +12,12 @@
"name": "div", "name": "div",
"attributes": [], "attributes": [],
"children": [] "children": []
},
{
"start": 11,
"end": 13,
"type": "Text",
"data": "\n\n"
} }
] ]
}, },

@ -1,4 +1,5 @@
{ {
"hash": 1378757574,
"html": { "html": {
"start": 0, "start": 0,
"end": 24, "end": 24,
@ -22,9 +23,9 @@
"end": 18, "end": 18,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 12, "start": 12,
"end": 16, "end": 16,
"type": "Identifier",
"name": "name" "name": "name"
} }
}, },
@ -35,6 +36,12 @@
"data": "!" "data": "!"
} }
] ]
},
{
"start": 24,
"end": 26,
"type": "Text",
"data": "\n\n"
} }
] ]
}, },
@ -49,70 +56,70 @@
"end": 134, "end": 134,
"body": [ "body": [
{ {
"type": "ExportDefaultDeclaration",
"start": 36,
"end": 95,
"declaration": { "declaration": {
"type": "ObjectExpression",
"start": 51, "start": 51,
"end": 94, "end": 94,
"type": "ObjectExpression",
"properties": [ "properties": [
{ {
"type": "Property",
"start": 55, "start": 55,
"end": 91, "end": 91,
"type": "Property", "method": false,
"shorthand": false,
"computed": false, "computed": false,
"key": { "key": {
"type": "Identifier",
"start": 55, "start": 55,
"end": 59, "end": 59,
"type": "Identifier",
"name": "data" "name": "data"
}, },
"kind": "init",
"method": false,
"shorthand": false,
"value": { "value": {
"type": "ArrowFunctionExpression",
"start": 61, "start": 61,
"end": 91, "end": 91,
"type": "ArrowFunctionExpression", "id": null,
"generator": false,
"expression": true,
"async": false, "async": false,
"params": [],
"body": { "body": {
"type": "ObjectExpression",
"start": 68, "start": 68,
"end": 90, "end": 90,
"type": "ObjectExpression",
"properties": [ "properties": [
{ {
"type": "Property",
"start": 73, "start": 73,
"end": 86, "end": 86,
"type": "Property", "method": false,
"shorthand": false,
"computed": false, "computed": false,
"key": { "key": {
"type": "Identifier",
"start": 73, "start": 73,
"end": 77, "end": 77,
"type": "Identifier",
"name": "name" "name": "name"
}, },
"kind": "init",
"method": false,
"shorthand": false,
"value": { "value": {
"type": "Literal",
"start": 79, "start": 79,
"end": 86, "end": 86,
"type": "Literal", "value": "world",
"raw": "'world'", "raw": "'world'"
"value": "world" },
} "kind": "init"
} }
] ]
},
"expression": true,
"generator": false,
"id": null,
"params": []
} }
},
"kind": "init"
} }
] ]
}, }
"end": 95,
"start": 36,
"type": "ExportDefaultDeclaration"
} }
], ],
"sourceType": "module" "sourceType": "module"

@ -1,4 +1,5 @@
{ {
"hash": 619854804,
"html": { "html": {
"start": 0, "start": 0,
"end": 24, "end": 24,
@ -22,9 +23,9 @@
"end": 18, "end": 18,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 12, "start": 12,
"end": 16, "end": 16,
"type": "Identifier",
"name": "name" "name": "name"
} }
}, },
@ -35,6 +36,12 @@
"data": "!" "data": "!"
} }
] ]
},
{
"start": 24,
"end": 26,
"type": "Text",
"data": "\n\n"
} }
] ]
}, },
@ -49,70 +56,70 @@
"end": 123, "end": 123,
"body": [ "body": [
{ {
"type": "ExportDefaultDeclaration",
"start": 36,
"end": 95,
"declaration": { "declaration": {
"type": "ObjectExpression",
"start": 51, "start": 51,
"end": 94, "end": 94,
"type": "ObjectExpression",
"properties": [ "properties": [
{ {
"type": "Property",
"start": 55, "start": 55,
"end": 91, "end": 91,
"type": "Property", "method": false,
"shorthand": false,
"computed": false, "computed": false,
"key": { "key": {
"type": "Identifier",
"start": 55, "start": 55,
"end": 59, "end": 59,
"type": "Identifier",
"name": "data" "name": "data"
}, },
"kind": "init",
"method": false,
"shorthand": false,
"value": { "value": {
"type": "ArrowFunctionExpression",
"start": 61, "start": 61,
"end": 91, "end": 91,
"type": "ArrowFunctionExpression", "id": null,
"generator": false,
"expression": true,
"async": false, "async": false,
"params": [],
"body": { "body": {
"type": "ObjectExpression",
"start": 68, "start": 68,
"end": 90, "end": 90,
"type": "ObjectExpression",
"properties": [ "properties": [
{ {
"type": "Property",
"start": 73, "start": 73,
"end": 86, "end": 86,
"type": "Property", "method": false,
"shorthand": false,
"computed": false, "computed": false,
"key": { "key": {
"type": "Identifier",
"start": 73, "start": 73,
"end": 77, "end": 77,
"type": "Identifier",
"name": "name" "name": "name"
}, },
"kind": "init",
"method": false,
"shorthand": false,
"value": { "value": {
"type": "Literal",
"start": 79, "start": 79,
"end": 86, "end": 86,
"type": "Literal", "value": "world",
"raw": "'world'", "raw": "'world'"
"value": "world" },
} "kind": "init"
} }
] ]
},
"expression": true,
"generator": false,
"id": null,
"params": []
} }
},
"kind": "init"
} }
] ]
}, }
"end": 95,
"start": 36,
"type": "ExportDefaultDeclaration"
} }
], ],
"sourceType": "module" "sourceType": "module"

@ -1,4 +1,5 @@
{ {
"hash": 388108696,
"html": { "html": {
"start": 0, "start": 0,
"end": 24, "end": 24,
@ -22,9 +23,9 @@
"end": 18, "end": 18,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 12, "start": 12,
"end": 16, "end": 16,
"type": "Identifier",
"name": "name" "name": "name"
} }
}, },
@ -35,6 +36,12 @@
"data": "!" "data": "!"
} }
] ]
},
{
"start": 24,
"end": 26,
"type": "Text",
"data": "\n\n"
} }
] ]
}, },
@ -49,70 +56,70 @@
"end": 96, "end": 96,
"body": [ "body": [
{ {
"type": "ExportDefaultDeclaration",
"start": 36,
"end": 95,
"declaration": { "declaration": {
"type": "ObjectExpression",
"start": 51, "start": 51,
"end": 94, "end": 94,
"type": "ObjectExpression",
"properties": [ "properties": [
{ {
"type": "Property",
"start": 55, "start": 55,
"end": 91, "end": 91,
"type": "Property", "method": false,
"shorthand": false,
"computed": false, "computed": false,
"key": { "key": {
"type": "Identifier",
"start": 55, "start": 55,
"end": 59, "end": 59,
"type": "Identifier",
"name": "data" "name": "data"
}, },
"kind": "init",
"method": false,
"shorthand": false,
"value": { "value": {
"type": "ArrowFunctionExpression",
"start": 61, "start": 61,
"end": 91, "end": 91,
"type": "ArrowFunctionExpression", "id": null,
"generator": false,
"expression": true,
"async": false, "async": false,
"params": [],
"body": { "body": {
"type": "ObjectExpression",
"start": 68, "start": 68,
"end": 90, "end": 90,
"type": "ObjectExpression",
"properties": [ "properties": [
{ {
"type": "Property",
"start": 73, "start": 73,
"end": 86, "end": 86,
"type": "Property", "method": false,
"shorthand": false,
"computed": false, "computed": false,
"key": { "key": {
"type": "Identifier",
"start": 73, "start": 73,
"end": 77, "end": 77,
"type": "Identifier",
"name": "name" "name": "name"
}, },
"kind": "init",
"method": false,
"shorthand": false,
"value": { "value": {
"type": "Literal",
"start": 79, "start": 79,
"end": 86, "end": 86,
"type": "Literal", "value": "world",
"raw": "'world'", "raw": "'world'"
"value": "world" },
} "kind": "init"
} }
] ]
},
"expression": true,
"generator": false,
"id": null,
"params": []
} }
},
"kind": "init"
} }
] ]
}, }
"end": 95,
"start": 36,
"type": "ExportDefaultDeclaration"
} }
], ],
"sourceType": "module" "sourceType": "module"

@ -1,4 +1,5 @@
{ {
"hash": 4200201687,
"html": { "html": {
"start": 0, "start": 0,
"end": 6, "end": 6,

@ -1,5 +1,5 @@
{ {
"hash": 1792372370, "hash": 216762188,
"html": { "html": {
"start": 0, "start": 0,
"end": 57, "end": 57,

@ -1,4 +1,5 @@
{ {
"hash": 1185019088,
"html": { "html": {
"start": 0, "start": 0,
"end": 30, "end": 30,
@ -11,14 +12,20 @@
"name": "p", "name": "p",
"attributes": [], "attributes": [],
"children": [ "children": [
{
"start": 3,
"end": 4,
"type": "Text",
"data": " "
},
{ {
"start": 4, "start": 4,
"end": 9, "end": 9,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 6, "start": 6,
"end": 7, "end": 7,
"type": "Identifier",
"name": "a" "name": "a"
} }
}, },
@ -33,9 +40,9 @@
"end": 15, "end": 15,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 12, "start": 12,
"end": 13, "end": 13,
"type": "Identifier",
"name": "b" "name": "b"
} }
}, },
@ -50,9 +57,9 @@
"end": 23, "end": 23,
"type": "MustacheTag", "type": "MustacheTag",
"expression": { "expression": {
"type": "Identifier",
"start": 20, "start": 20,
"end": 21, "end": 21,
"type": "Identifier",
"name": "c" "name": "c"
} }
}, },
@ -60,7 +67,7 @@
"start": 23, "start": 23,
"end": 26, "end": 26,
"type": "Text", "type": "Text",
"data": " :" "data": " : "
} }
] ]
} }

@ -1,5 +1,5 @@
{ {
"hash": 3618147195, "hash": 2992234421,
"html": { "html": {
"start": 0, "start": 0,
"end": 63, "end": 63,

@ -1,5 +1,5 @@
{ {
"hash": 1535528483, "hash": 503236647,
"html": { "html": {
"start": 0, "start": 0,
"end": 27, "end": 27,

@ -1,5 +1,5 @@
{ {
"hash": 3160753914, "hash": 3731674194,
"html": { "html": {
"start": 0, "start": 0,
"end": 43, "end": 43,
@ -19,18 +19,17 @@
"intro": true, "intro": true,
"outro": false, "outro": false,
"expression": { "expression": {
"type": "ObjectExpression",
"start": 15, "start": 15,
"end": 27, "end": 27,
"type": "ObjectExpression",
"properties": [ "properties": [
{ {
"type": "Property",
"start": 16, "start": 16,
"end": 26, "end": 26,
"type": "Property",
"method": false, "method": false,
"computed": false,
"shorthand": false, "shorthand": false,
"kind": "init", "computed": false,
"key": { "key": {
"type": "Identifier", "type": "Identifier",
"start": 16, "start": 16,
@ -38,12 +37,13 @@
"name": "opacity" "name": "opacity"
}, },
"value": { "value": {
"type": "Literal",
"start": 25, "start": 25,
"end": 26, "end": 26,
"type": "Literal",
"value": 0, "value": 0,
"raw": "0" "raw": "0"
} },
"kind": "init"
} }
] ]
} }

@ -1,9 +1,16 @@
{ {
"hash": 424837432,
"html": { "html": {
"start": 6, "start": 6,
"end": 36, "end": 36,
"type": "Fragment", "type": "Fragment",
"children": [ "children": [
{
"start": 0,
"end": 6,
"type": "Text",
"data": "\n\n\t\t\t\t"
},
{ {
"start": 6, "start": 6,
"end": 36, "end": 36,

@ -1,4 +1,5 @@
{ {
"hash": 3659433152,
"html": { "html": {
"start": 0, "start": 0,
"end": 9, "end": 9,
@ -10,5 +11,7 @@
"type": "YieldTag" "type": "YieldTag"
} }
] ]
} },
"css": null,
"js": null
} }

@ -0,0 +1,13 @@
// this file will replace all the expected.js and expected-bundle.js files with
// their _actual equivalents. Only use it when you're sure that you haven't
// broken anything!
const fs = require("fs");
const glob = require("glob");
glob.sync("samples/*/_actual.json", { cwd: __dirname }).forEach(file => {
const actual = fs.readFileSync(`${__dirname}/${file}`, "utf-8");
fs.writeFileSync(
`${__dirname}/${file.replace("_actual", "output")}`,
actual
);
});
Loading…
Cancel
Save