remove v1 parser tests

pull/1348/head
Rich Harris 6 years ago
parent 4fe8d95a6d
commit 21168bf5f1

@ -2,7 +2,7 @@ import assert from 'assert';
import fs from 'fs';
import { svelte, tryToLoadJson } from '../helpers.js';
describe('parse', () => {
describe.only('parse', () => {
fs.readdirSync('test/parser/samples').forEach(dir => {
if (dir[0] === '.') return;
@ -18,48 +18,35 @@ describe('parse', () => {
(solo ? it.only : it)(dir, () => {
const options = tryToLoadJson(`test/parser/samples/${dir}/options.json`) || {};
function test(options, input, expectedOutput, expectedError, outputFile) {
options.parser = 'v2'; // TODO remove
const input = fs.readFileSync(`test/parser/samples/${dir}/input.html`, 'utf-8').replace(/\s+$/, '');
const expectedOutput = tryToLoadJson(`test/parser/samples/${dir}/output.json`);
const expectedError = tryToLoadJson(`test/parser/samples/${dir}/error.json`);
try {
const actual = svelte.parse(input, options);
fs.writeFileSync(`test/parser/samples/${dir}/_actual.json`, JSON.stringify(actual, null, '\t'));
assert.deepEqual(actual.html, expectedOutput.html);
assert.deepEqual(actual.css, expectedOutput.css);
assert.deepEqual(actual.js, expectedOutput.js);
} catch (err) {
if (err.name !== 'ParseError') throw err;
if (!expectedError) throw err;
try {
const actual = svelte.parse(input, options);
fs.writeFileSync(outputFile, JSON.stringify(actual, null, '\t'));
assert.deepEqual(actual.html, expectedOutput.html);
assert.deepEqual(actual.css, expectedOutput.css);
assert.deepEqual(actual.js, expectedOutput.js);
} catch (err) {
if (err.name !== 'ParseError') throw err;
if (!expectedError) throw err;
try {
assert.equal(err.code, expectedError.code);
assert.equal(err.message, expectedError.message);
assert.deepEqual(err.loc, expectedError.loc);
assert.equal(err.pos, expectedError.pos);
assert.equal(err.toString().split('\n')[0], `${expectedError.message} (${expectedError.loc.line}:${expectedError.loc.column})`);
} catch (err2) {
const e = err2.code === 'MODULE_NOT_FOUND' ? err : err2;
throw e;
}
assert.equal(err.code, expectedError.code);
assert.equal(err.message, expectedError.message);
assert.deepEqual(err.loc, expectedError.loc);
assert.equal(err.pos, expectedError.pos);
assert.equal(err.toString().split('\n')[0], `${expectedError.message} (${expectedError.loc.line}:${expectedError.loc.column})`);
} catch (err2) {
const e = err2.code === 'MODULE_NOT_FOUND' ? err : err2;
throw e;
}
}
// TODO remove v1 tests
test(
options,
fs.readFileSync(`test/parser/samples/${dir}/input.html`, 'utf-8').replace(/\s+$/, ''),
tryToLoadJson(`test/parser/samples/${dir}/output.json`),
tryToLoadJson(`test/parser/samples/${dir}/error.json`),
`test/parser/samples/${dir}/_actual.json`
);
test(
Object.assign({ parser: 'v2' }, options),
fs.readFileSync(`test/parser/samples/${dir}/input-v2.html`, 'utf-8').replace(/\s+$/, ''),
tryToLoadJson(`test/parser/samples/${dir}/output-v2.json`),
tryToLoadJson(`test/parser/samples/${dir}/error-v2.json`),
`test/parser/samples/${dir}/_actual-v2.json`
);
});
});

@ -1 +0,0 @@
<input use:tooltip="t('tooltip msg')">

@ -1,47 +0,0 @@
{
"hash": 1937205193,
"html": {
"start": 0,
"end": 38,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 38,
"type": "Element",
"name": "input",
"attributes": [
{
"start": 7,
"end": 37,
"type": "Action",
"name": "tooltip",
"expression": {
"type": "CallExpression",
"start": 20,
"end": 36,
"callee": {
"type": "Identifier",
"start": 20,
"end": 21,
"name": "t"
},
"arguments": [
{
"type": "Literal",
"start": 22,
"end": 35,
"value": "tooltip msg",
"raw": "'tooltip msg'"
}
]
}
}
],
"children": []
}
]
},
"css": null,
"js": null
}

@ -1,33 +0,0 @@
{
"hash": 1937205193,
"html": {
"start": 0,
"end": 29,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 29,
"type": "Element",
"name": "input",
"attributes": [
{
"start": 7,
"end": 28,
"type": "Action",
"name": "tooltip",
"expression": {
"type": "Identifier",
"start": 20,
"end": 27,
"name": "message"
}
}
],
"children": []
}
]
},
"css": null,
"js": null
}

@ -1 +0,0 @@
<input use:tooltip="'tooltip msg'">

@ -1,34 +0,0 @@
{
"hash": 1937205193,
"html": {
"start": 0,
"end": 35,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 35,
"type": "Element",
"name": "input",
"attributes": [
{
"start": 7,
"end": 34,
"type": "Action",
"name": "tooltip",
"expression": {
"type": "Literal",
"start": 20,
"end": 33,
"value": "tooltip msg",
"raw": "'tooltip msg'"
}
}
],
"children": []
}
]
},
"css": null,
"js": null
}

@ -1,28 +0,0 @@
{
"hash": 1937205193,
"html": {
"start": 0,
"end": 21,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 21,
"type": "Element",
"name": "input",
"attributes": [
{
"start": 7,
"end": 20,
"type": "Action",
"name": "autofocus",
"expression": null
}
],
"children": []
}
]
},
"css": null,
"js": null
}

@ -1 +0,0 @@
<textarea readonly={readonly}></textarea>

@ -1 +1 @@
<textarea readonly='{{readonly}}'></textarea>
<textarea readonly={readonly}></textarea>

@ -1,40 +0,0 @@
{
"hash": "7xolfv",
"html": {
"start": 0,
"end": 41,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 41,
"type": "Element",
"name": "textarea",
"attributes": [
{
"start": 10,
"end": 29,
"type": "Attribute",
"name": "readonly",
"value": [
{
"start": 19,
"end": 29,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 20,
"end": 28,
"name": "readonly"
}
}
]
}
],
"children": []
}
]
},
"css": null,
"js": null
}

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

@ -1 +1 @@
<div class='{{class}}'></div>
<div class={class}></div>

@ -1,40 +0,0 @@
{
"hash": "l0cddf",
"html": {
"start": 0,
"end": 25,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 25,
"type": "Element",
"name": "div",
"attributes": [
{
"start": 5,
"end": 18,
"type": "Attribute",
"name": "class",
"value": [
{
"start": 11,
"end": 18,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 12,
"end": 17,
"name": "class"
}
}
]
}
],
"children": []
}
]
},
"css": null,
"js": null
}

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

@ -1 +0,0 @@
<div style='color: {color};'>{color}</div>

@ -1 +1 @@
<div style='color: {{color}};'>{{color}}</div>
<div style='color: {color};'>{color}</div>

@ -1,64 +0,0 @@
{
"hash": "ehtsx6",
"html": {
"start": 0,
"end": 42,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 42,
"type": "Element",
"name": "div",
"attributes": [
{
"start": 5,
"end": 28,
"type": "Attribute",
"name": "style",
"value": [
{
"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,
"type": "Text",
"data": ";"
}
]
}
],
"children": [
{
"start": 29,
"end": 36,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 30,
"end": 35,
"name": "color"
}
}
]
}
]
},
"css": null,
"js": null
}

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

@ -1 +0,0 @@
<div data-foo='&quot;quoted&quot;'></div>

@ -1,35 +0,0 @@
{
"hash": 1563956934,
"html": {
"start": 0,
"end": 41,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 41,
"type": "Element",
"name": "div",
"attributes": [
{
"start": 5,
"end": 34,
"type": "Attribute",
"name": "data-foo",
"value": [
{
"start": 15,
"end": 33,
"type": "Text",
"data": "\"quoted\""
}
]
}
],
"children": []
}
]
},
"css": null,
"js": null
}

@ -1 +1 @@
<div id='x' class='y'></div>
<div id='x' class='y'></div>

@ -1,49 +0,0 @@
{
"hash": 507039402,
"html": {
"start": 0,
"end": 28,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 28,
"type": "Element",
"name": "div",
"attributes": [
{
"start": 5,
"end": 11,
"type": "Attribute",
"name": "id",
"value": [
{
"start": 9,
"end": 10,
"type": "Text",
"data": "x"
}
]
},
{
"start": 12,
"end": 21,
"type": "Attribute",
"name": "class",
"value": [
{
"start": 19,
"end": 20,
"type": "Text",
"data": "y"
}
]
}
],
"children": []
}
]
},
"css": null,
"js": null
}

@ -1,40 +0,0 @@
{
"hash": 1705925892,
"html": {
"start": 0,
"end": 11,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 11,
"type": "Element",
"name": "div",
"attributes": [
{
"start": 5,
"end": 9,
"type": "Attribute",
"name": "id",
"value": [
{
"type": "AttributeShorthand",
"start": 6,
"end": 8,
"expression": {
"type": "Identifier",
"start": 6,
"end": 8,
"name": "id"
}
}
]
}
],
"children": []
}
]
},
"css": null,
"js": null
}

@ -2,18 +2,18 @@
"hash": 1705925892,
"html": {
"start": 0,
"end": 10,
"end": 11,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 10,
"end": 11,
"type": "Element",
"name": "div",
"attributes": [
{
"start": 5,
"end": 8,
"end": 9,
"type": "Attribute",
"name": "id",
"value": [

@ -1 +1 @@
<textarea readonly></textarea>
<textarea readonly></textarea>

@ -1,28 +0,0 @@
{
"hash": 606864228,
"html": {
"start": 0,
"end": 30,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 30,
"type": "Element",
"name": "textarea",
"attributes": [
{
"start": 10,
"end": 18,
"type": "Attribute",
"name": "readonly",
"value": true
}
],
"children": []
}
]
},
"css": null,
"js": null
}

@ -1 +1 @@
<div class='foo'></div>
<div class='foo'></div>

@ -1,35 +0,0 @@
{
"hash": 1493227373,
"html": {
"start": 0,
"end": 23,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 23,
"type": "Element",
"name": "div",
"attributes": [
{
"start": 5,
"end": 16,
"type": "Attribute",
"name": "class",
"value": [
{
"start": 12,
"end": 15,
"type": "Text",
"data": "foo"
}
]
}
],
"children": []
}
]
},
"css": null,
"js": null
}

@ -1,9 +0,0 @@
{
"code": "duplicate-attribute",
"message": "Attributes need to be unique",
"loc": {
"line": 1,
"column": 17
},
"pos": 17
}

@ -1 +0,0 @@
<div class='foo' class='bar'></div>

@ -1 +1 @@
<div class='foo' class='bar'></div>
<div class='foo' class='bar'></div>

@ -1 +1 @@
<div class=foo></div>
<div class=foo></div>

@ -1,35 +0,0 @@
{
"hash": 3488539025,
"html": {
"start": 0,
"end": 21,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 21,
"type": "Element",
"name": "div",
"attributes": [
{
"start": 5,
"end": 14,
"type": "Attribute",
"name": "class",
"value": [
{
"start": 11,
"end": 14,
"type": "Text",
"data": "foo"
}
]
}
],
"children": []
}
]
},
"css": null,
"js": null
}

@ -1,7 +0,0 @@
{#await thePromise}
<p>loading...</p>
{:then theValue}
<p>the value is {theValue}</p>
{:catch theError}
<p>oh no! {theError.message}</p>
{/await}

@ -1,7 +1,7 @@
{{#await thePromise}}
{#await thePromise}
<p>loading...</p>
{{then theValue}}
<p>the value is {{theValue}}</p>
{{catch theError}}
<p>oh no! {{theError.message}}</p>
{{/await}}
{:then theValue}
<p>the value is {theValue}</p>
{:catch theError}
<p>oh no! {theError.message}</p>
{/await}

@ -1,161 +0,0 @@
{
"hash": "1b28gs9",
"html": {
"start": 0,
"end": 148,
"type": "Fragment",
"children": [
{
"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,
"type": "Text",
"data": "\n\t"
},
{
"start": 21,
"end": 38,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 24,
"end": 34,
"type": "Text",
"data": "loading..."
}
]
},
{
"start": 38,
"end": 39,
"type": "Text",
"data": "\n"
}
]
},
"then": {
"start": 39,
"end": 88,
"type": "ThenBlock",
"children": [
{
"start": 55,
"end": 57,
"type": "Text",
"data": "\n\t"
},
{
"start": 57,
"end": 87,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 60,
"end": 73,
"type": "Text",
"data": "the value is "
},
{
"start": 73,
"end": 83,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 74,
"end": 82,
"name": "theValue"
}
}
]
},
{
"start": 87,
"end": 88,
"type": "Text",
"data": "\n"
}
]
},
"catch": {
"start": 88,
"end": 140,
"type": "CatchBlock",
"children": [
{
"start": 105,
"end": 107,
"type": "Text",
"data": "\n\t"
},
{
"start": 107,
"end": 139,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 110,
"end": 117,
"type": "Text",
"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": 139,
"end": 140,
"type": "Text",
"data": "\n"
}
]
}
}
]
},
"css": null,
"js": null
}

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

@ -1 +1 @@
<Widget bind:foo/>
<Widget bind:foo/>

@ -1,33 +0,0 @@
{
"hash": 3088875001,
"html": {
"start": 0,
"end": 18,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 18,
"type": "Element",
"name": "Widget",
"attributes": [
{
"start": 8,
"end": 16,
"type": "Binding",
"name": "foo",
"value": {
"type": "Identifier",
"start": 13,
"end": 16,
"name": "foo"
}
}
],
"children": []
}
]
},
"css": null,
"js": null
}

@ -1 +0,0 @@
<input bind:value='name'>

@ -1 +1 @@
<input bind:value='name'>
<input bind:value='name'>

@ -1,33 +0,0 @@
{
"hash": 1937205193,
"html": {
"start": 0,
"end": 25,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 25,
"type": "Element",
"name": "input",
"attributes": [
{
"start": 7,
"end": 24,
"type": "Binding",
"name": "value",
"value": {
"type": "Identifier",
"start": 19,
"end": 23,
"name": "name"
}
}
],
"children": []
}
]
},
"css": null,
"js": null
}

@ -1 +1 @@
<!-- a comment -->
<!-- a comment -->

@ -1,18 +0,0 @@
{
"hash": 3294612990,
"html": {
"start": 0,
"end": 18,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 18,
"type": "Comment",
"data": " a comment "
}
]
},
"css": null,
"js": null
}

@ -1 +0,0 @@
<svelte:component this="{foo ? Foo : Bar}"></svelte:component>

@ -1 +1 @@
<:Component {foo ? Foo : Bar}></:Component>
<svelte:component this="{foo ? Foo : Bar}"></svelte:component>

@ -1,43 +0,0 @@
{
"hash": "2u5ec3",
"html": {
"start": 0,
"end": 62,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 62,
"type": "Element",
"name": "svelte:component",
"attributes": [],
"children": [],
"expression": {
"type": "ConditionalExpression",
"start": 25,
"end": 40,
"test": {
"type": "Identifier",
"start": 25,
"end": 28,
"name": "foo"
},
"consequent": {
"type": "Identifier",
"start": 31,
"end": 34,
"name": "Foo"
},
"alternate": {
"type": "Identifier",
"start": 37,
"end": 40,
"name": "Bar"
}
}
}
]
},
"css": null,
"js": null
}

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

@ -1 +1 @@
<p>Hello &amp; World</p>
<p>Hello &amp; World</p>

@ -1,27 +0,0 @@
{
"hash": 2365862121,
"html": {
"start": 0,
"end": 24,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 24,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 3,
"end": 20,
"type": "Text",
"data": "Hello & World"
}
]
}
]
},
"css": null,
"js": null
}

@ -1 +1 @@
Hello &amp; World
Hello &amp; World

@ -1,18 +0,0 @@
{
"hash": 156753432,
"html": {
"start": 0,
"end": 17,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 17,
"type": "Text",
"data": "Hello & World"
}
]
},
"css": null,
"js": null
}

@ -1,7 +0,0 @@
<div ref:foo/>
<style>
ref:foo {
color: red;
}
</style>

@ -4,4 +4,4 @@
ref:foo {
color: red;
}
</style>
</style>

@ -1,96 +0,0 @@
{
"hash": 1104014177,
"html": {
"start": 0,
"end": 14,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 14,
"type": "Element",
"name": "div",
"attributes": [
{
"start": 5,
"end": 12,
"type": "Ref",
"name": "foo"
}
],
"children": []
},
{
"start": 14,
"end": 16,
"type": "Text",
"data": "\n\n"
}
]
},
"css": {
"start": 16,
"end": 60,
"attributes": [],
"children": [
{
"type": "Rule",
"selector": {
"type": "SelectorList",
"children": [
{
"type": "Selector",
"children": [
{
"type": "RefSelector",
"start": 25,
"end": 32,
"name": "foo"
}
],
"start": 25,
"end": 32
}
],
"start": 25,
"end": 32
},
"block": {
"type": "Block",
"children": [
{
"type": "Declaration",
"important": false,
"property": "color",
"value": {
"type": "Value",
"children": [
{
"type": "Identifier",
"name": "red",
"start": 44,
"end": 47
}
],
"start": 43,
"end": 47
},
"start": 37,
"end": 47
}
],
"start": 33,
"end": 51
},
"start": 25,
"end": 51
}
],
"content": {
"start": 23,
"end": 52,
"styles": "\n\tref:foo {\n\t\tcolor: red;\n\t}\n"
}
},
"js": null
}

@ -1,7 +0,0 @@
<div>foo</div>
<style>
div {
color: red;
}
</style>

@ -4,4 +4,4 @@
div {
color: red;
}
</style>
</style>

@ -1,96 +0,0 @@
{
"hash": 1147407419,
"html": {
"start": 0,
"end": 14,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 14,
"type": "Element",
"name": "div",
"attributes": [],
"children": [
{
"start": 5,
"end": 8,
"type": "Text",
"data": "foo"
}
]
},
{
"start": 14,
"end": 16,
"type": "Text",
"data": "\n\n"
}
]
},
"css": {
"start": 16,
"end": 56,
"attributes": [],
"children": [
{
"type": "Rule",
"selector": {
"type": "SelectorList",
"children": [
{
"type": "Selector",
"children": [
{
"type": "TypeSelector",
"name": "div",
"start": 25,
"end": 28
}
],
"start": 25,
"end": 28
}
],
"start": 25,
"end": 28
},
"block": {
"type": "Block",
"children": [
{
"type": "Declaration",
"important": false,
"property": "color",
"value": {
"type": "Value",
"children": [
{
"type": "Identifier",
"name": "red",
"start": 40,
"end": 43
}
],
"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
}

@ -1,9 +0,0 @@
<script>
export default {
oncreate() {
import('./foo.js').then(foo => {
console.log(foo.default);
});
}
}
</script>

@ -1,182 +0,0 @@
{
"hash": 1867472549,
"html": {
"start": null,
"end": null,
"type": "Fragment",
"children": []
},
"css": null,
"js": {
"start": 0,
"end": 131,
"attributes": [],
"content": {
"type": "Program",
"start": 8,
"end": 122,
"body": [
{
"type": "ExportDefaultDeclaration",
"start": 10,
"end": 121,
"declaration": {
"type": "ObjectExpression",
"start": 25,
"end": 121,
"properties": [
{
"type": "Property",
"start": 29,
"end": 118,
"method": true,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 29,
"end": 37,
"name": "oncreate"
},
"kind": "init",
"value": {
"type": "FunctionExpression",
"start": 37,
"end": 118,
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 40,
"end": 118,
"body": [
{
"type": "ExpressionStatement",
"start": 45,
"end": 114,
"expression": {
"type": "CallExpression",
"start": 45,
"end": 113,
"callee": {
"type": "MemberExpression",
"start": 45,
"end": 68,
"object": {
"type": "CallExpression",
"start": 45,
"end": 63,
"callee": {
"type": "Import",
"start": 45,
"end": 51
},
"arguments": [
{
"type": "Literal",
"start": 52,
"end": 62,
"value": "./foo.js",
"raw": "'./foo.js'"
}
]
},
"property": {
"type": "Identifier",
"start": 64,
"end": 68,
"name": "then"
},
"computed": false
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 69,
"end": 112,
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 69,
"end": 72,
"name": "foo"
}
],
"body": {
"type": "BlockStatement",
"start": 76,
"end": 112,
"body": [
{
"type": "ExpressionStatement",
"start": 82,
"end": 107,
"expression": {
"type": "CallExpression",
"start": 82,
"end": 106,
"callee": {
"type": "MemberExpression",
"start": 82,
"end": 93,
"object": {
"type": "Identifier",
"start": 82,
"end": 89,
"name": "console"
},
"property": {
"type": "Identifier",
"start": 90,
"end": 93,
"name": "log"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 94,
"end": 105,
"object": {
"type": "Identifier",
"start": 94,
"end": 97,
"name": "foo"
},
"property": {
"type": "Identifier",
"start": 98,
"end": 105,
"name": "default"
},
"computed": false
}
]
}
}
]
}
}
]
}
}
]
}
}
}
]
}
}
],
"sourceType": "module"
}
}
}

@ -1,3 +0,0 @@
{#each animals as [key, value]}
<p>{key}: {value}</p>
{/each}

@ -1,3 +1,3 @@
{{#each animals as [key, value]}}
<p>{{key}}: {{value}}</p>
{{/each}}
{#each animals as [key, value]}
<p>{key}: {value}</p>
{/each}

@ -1,67 +0,0 @@
{
"hash": "gtdm5e",
"html": {
"start": 0,
"end": 62,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 62,
"type": "EachBlock",
"expression": {
"type": "Identifier",
"start": 7,
"end": 14,
"name": "animals"
},
"children": [
{
"start": 33,
"end": 54,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 36,
"end": 41,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 37,
"end": 40,
"name": "key"
}
},
{
"start": 41,
"end": 43,
"type": "Text",
"data": ": "
},
{
"start": 43,
"end": 50,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 44,
"end": 49,
"name": "value"
}
}
]
}
],
"destructuredContexts": [
"key",
"value"
],
"context": "key_value"
}
]
},
"css": null,
"js": null
}

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

@ -1,5 +0,0 @@
{#each animals as animal}
<p>{animal}</p>
{:else}
<p>no animals</p>
{/each}

@ -1,5 +1,5 @@
{{#each animals as animal}}
<p>{{animal}}</p>
{{else}}
{#each animals as animal}
<p>{animal}</p>
{:else}
<p>no animals</p>
{{/each}}
{/each}

@ -1,68 +0,0 @@
{
"hash": "ljl07n",
"html": {
"start": 0,
"end": 77,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 77,
"type": "EachBlock",
"expression": {
"type": "Identifier",
"start": 7,
"end": 14,
"name": "animals"
},
"children": [
{
"start": 27,
"end": 42,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 30,
"end": 38,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 31,
"end": 37,
"name": "animal"
}
}
]
}
],
"context": "animal",
"else": {
"start": 50,
"end": 70,
"type": "ElseBlock",
"children": [
{
"start": 52,
"end": 69,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 55,
"end": 65,
"type": "Text",
"data": "no animals"
}
]
}
]
}
}
]
},
"css": null,
"js": null
}

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

@ -1,3 +0,0 @@
{#each animals as animal, i}
<p>{i}: {animal}</p>
{/each}

@ -1,3 +1,3 @@
{{#each animals as animal, i}}
<p>{{i}}: {{animal}}</p>
{{/each}}
{#each animals as animal, i}
<p>{i}: {animal}</p>
{/each}

@ -1,64 +0,0 @@
{
"hash": "1143n2g",
"html": {
"start": 0,
"end": 58,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 58,
"type": "EachBlock",
"expression": {
"type": "Identifier",
"start": 7,
"end": 14,
"name": "animals"
},
"children": [
{
"start": 30,
"end": 50,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 33,
"end": 36,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 34,
"end": 35,
"name": "i"
}
},
{
"start": 36,
"end": 38,
"type": "Text",
"data": ": "
},
{
"start": 38,
"end": 46,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 39,
"end": 45,
"name": "animal"
}
}
]
}
],
"context": "animal",
"index": "i"
}
]
},
"css": null,
"js": null
}

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

@ -1,3 +0,0 @@
{#each todos as todo (todo.id)}
<p>{todo}</p>
{/each}

@ -1,3 +1,3 @@
{{#each todos as todo @id}}
<p>{{todo}}</p>
{{/each}}
{#each todos as todo (todo.id)}
<p>{todo}</p>
{/each}

@ -1,47 +0,0 @@
{
"hash": "1x6az5m",
"html": {
"start": 0,
"end": 54,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 54,
"type": "EachBlock",
"expression": {
"type": "Identifier",
"start": 7,
"end": 12,
"name": "todos"
},
"children": [
{
"start": 33,
"end": 46,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 36,
"end": 42,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 37,
"end": 41,
"name": "todo"
}
}
]
}
],
"context": "todo",
"key": "id"
}
]
},
"css": null,
"js": null
}

@ -1,5 +1,5 @@
{
"hash": 2025411181,
"hash": "1x6az5m",
"html": {
"start": 0,
"end": 54,
@ -11,26 +11,26 @@
"type": "EachBlock",
"expression": {
"type": "Identifier",
"start": 8,
"end": 13,
"start": 7,
"end": 12,
"name": "todos"
},
"children": [
{
"start": 29,
"end": 44,
"start": 33,
"end": 46,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 32,
"end": 40,
"start": 36,
"end": 42,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 34,
"end": 38,
"start": 37,
"end": 41,
"name": "todo"
}
}

@ -1,3 +0,0 @@
{#each animals as animal}
<p>{animal}</p>
{/each}

@ -1,3 +1,3 @@
{{#each animals as animal}}
<p>{{animal}}</p>
{{/each}}
{#each animals as animal}
<p>{animal}</p>
{/each}

@ -1,46 +0,0 @@
{
"hash": "mzeq0s",
"html": {
"start": 0,
"end": 50,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 50,
"type": "EachBlock",
"expression": {
"type": "Identifier",
"start": 7,
"end": 14,
"name": "animals"
},
"children": [
{
"start": 27,
"end": 42,
"type": "Element",
"name": "p",
"attributes": [],
"children": [
{
"start": 30,
"end": 38,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 31,
"end": 37,
"name": "animal"
}
}
]
}
],
"context": "animal"
}
]
},
"css": null,
"js": null
}

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

@ -1 +1 @@
<h1>hello {{name}}!</h1>
<h1>hello {name}!</h1>

@ -1,44 +0,0 @@
{
"hash": 1265376132,
"html": {
"start": 0,
"end": 22,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 22,
"type": "Element",
"name": "h1",
"attributes": [],
"children": [
{
"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,
"type": "Text",
"data": "!"
}
]
}
]
},
"css": null,
"js": null
}

@ -2,12 +2,12 @@
"hash": 1265376132,
"html": {
"start": 0,
"end": 24,
"end": 22,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 24,
"end": 22,
"type": "Element",
"name": "h1",
"attributes": [],
@ -20,18 +20,18 @@
},
{
"start": 10,
"end": 18,
"end": 16,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 12,
"end": 16,
"start": 11,
"end": 15,
"name": "name"
}
},
{
"start": 18,
"end": 19,
"start": 16,
"end": 17,
"type": "Text",
"data": "!"
}

@ -1 +1 @@
<span>test</span>
<span>test</span>

@ -1,27 +0,0 @@
{
"hash": 611274658,
"html": {
"start": 0,
"end": 17,
"type": "Fragment",
"children": [
{
"start": 0,
"end": 17,
"type": "Element",
"name": "span",
"attributes": [],
"children": [
{
"start": 6,
"end": 10,
"type": "Text",
"data": "test"
}
]
}
]
},
"css": null,
"js": null
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save