From b7f9c9c95444fb15d20eaa170253f1c3982c1148 Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Sun, 26 May 2019 14:48:10 +0200 Subject: [PATCH] always add raw property to text nodes --- src/parse/state/tag.ts | 36 ++++++++----------- src/parse/state/text.ts | 4 +-- .../samples/action-with-call/output.json | 5 +-- .../action-with-identifier/output.json | 5 +-- .../samples/action-with-literal/output.json | 5 +-- test/parser/samples/action/output.json | 5 +-- test/parser/samples/animation/output.json | 6 ++-- .../attribute-containing-solidus/output.json | 7 ++-- .../attribute-dynamic-boolean/output.json | 5 +-- .../attribute-dynamic-reserved/output.json | 5 +-- .../samples/attribute-dynamic/output.json | 9 +++-- .../samples/attribute-escaped/output.json | 9 ++--- .../samples/attribute-multiple/output.json | 7 ++-- .../samples/attribute-shorthand/output.json | 5 +-- .../attribute-static-boolean/output.json | 5 +-- .../samples/attribute-static/output.json | 6 ++-- .../samples/attribute-unquoted/output.json | 6 ++-- .../samples/await-then-catch/output.json | 28 +++++++++------ .../samples/binding-shorthand/output.json | 1 + test/parser/samples/binding/output.json | 1 + test/parser/samples/comment/output.json | 5 +-- .../samples/component-dynamic/output.json | 5 +-- .../convert-entities-in-element/output.json | 9 ++--- .../samples/convert-entities/output.json | 9 ++--- test/parser/samples/css/output.json | 6 ++-- .../parser/samples/dynamic-import/output.json | 5 ++- .../each-block-destructured/output.json | 8 ++--- .../samples/each-block-else/output.json | 6 ++-- .../samples/each-block-indexed/output.json | 6 ++-- .../samples/each-block-keyed/output.json | 5 +-- test/parser/samples/each-block/output.json | 5 +-- .../samples/element-with-mustache/output.json | 7 ++-- .../samples/element-with-text/output.json | 6 ++-- test/parser/samples/elements/output.json | 5 +-- test/parser/samples/event-handler/output.json | 10 +++--- test/parser/samples/if-block-else/output.json | 7 ++-- .../samples/if-block-elseif/output.json | 2 ++ test/parser/samples/if-block/output.json | 6 ++-- .../samples/implicitly-closed-li/output.json | 9 ++--- test/parser/samples/nbsp/output.json | 9 ++--- test/parser/samples/raw-mustaches/output.json | 8 ++--- test/parser/samples/refs/output.json | 1 + .../samples/script-comment-only/output.json | 1 + .../output.json | 3 ++ .../script-comment-trailing/output.json | 3 ++ test/parser/samples/script/output.json | 3 ++ .../samples/self-closing-element/output.json | 5 +-- .../parser/samples/self-reference/output.json | 5 +-- .../space-between-mustaches/output.json | 9 ++--- test/parser/samples/spread/output.json | 5 +-- .../samples/textarea-children/output.json | 9 +++-- .../transition-intro-no-params/output.json | 6 ++-- .../samples/transition-intro/output.json | 6 ++-- .../samples/unusual-identifier/output.json | 5 +-- .../whitespace-leading-trailing/output.json | 7 ++-- .../samples/whitespace-normal/output.json | 8 ++--- test/parser/samples/yield/output.json | 5 +-- 57 files changed, 150 insertions(+), 229 deletions(-) diff --git a/src/parse/state/tag.ts b/src/parse/state/tag.ts index d6e9706714..108cfce3e1 100644 --- a/src/parse/state/tag.ts +++ b/src/parse/state/tag.ts @@ -476,35 +476,28 @@ function read_sequence(parser: Parser, done: () => boolean): Node[] { start: parser.index, end: null, type: 'Text', - data: '', + raw: '', + data: null }; + function flush() { + if (current_chunk.raw) { + current_chunk.data = decode_character_references(current_chunk.raw); + current_chunk.end = parser.index; + chunks.push(current_chunk); + } + } + const chunks: Node[] = []; while (parser.index < parser.template.length) { const index = parser.index; if (done()) { - current_chunk.end = parser.index; - - if (current_chunk.data) chunks.push(current_chunk); - - chunks.forEach(chunk => { - if (chunk.type === 'Text') { - let decoded = decode_character_references(chunk.data); - if (chunk.data != decoded) { - chunk.raw = chunk.data; - chunk.data = decoded; - } - } - }); - + flush(); return chunks; } else if (parser.eat('{')) { - if (current_chunk.data) { - current_chunk.end = index; - chunks.push(current_chunk); - } + flush(); parser.allow_whitespace(); const expression = read_expression(parser); @@ -522,10 +515,11 @@ function read_sequence(parser: Parser, done: () => boolean): Node[] { start: parser.index, end: null, type: 'Text', - data: '', + raw: '', + data: null }; } else { - current_chunk.data += parser.template[parser.index++]; + current_chunk.raw += parser.template[parser.index++]; } } diff --git a/src/parse/state/text.ts b/src/parse/state/text.ts index 503d79aa08..1d9099055e 100644 --- a/src/parse/state/text.ts +++ b/src/parse/state/text.ts @@ -18,11 +18,9 @@ export default function text(parser: Parser) { start, end: parser.index, type: 'Text', + raw: data, data: decode_character_references(data), }; - if (node.data != data) - node.raw = data; - parser.current().children.push(node); } diff --git a/test/parser/samples/action-with-call/output.json b/test/parser/samples/action-with-call/output.json index d6aaa72892..e910f0b49f 100644 --- a/test/parser/samples/action-with-call/output.json +++ b/test/parser/samples/action-with-call/output.json @@ -41,8 +41,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/action-with-identifier/output.json b/test/parser/samples/action-with-identifier/output.json index d58b9097b7..435aee4444 100644 --- a/test/parser/samples/action-with-identifier/output.json +++ b/test/parser/samples/action-with-identifier/output.json @@ -27,8 +27,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/action-with-literal/output.json b/test/parser/samples/action-with-literal/output.json index 4a6f596d10..01a6b67549 100644 --- a/test/parser/samples/action-with-literal/output.json +++ b/test/parser/samples/action-with-literal/output.json @@ -28,8 +28,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/action/output.json b/test/parser/samples/action/output.json index 2f553b5efa..9828e200dd 100644 --- a/test/parser/samples/action/output.json +++ b/test/parser/samples/action/output.json @@ -22,8 +22,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/animation/output.json b/test/parser/samples/animation/output.json index 8332b3ad04..f4d183eb5c 100644 --- a/test/parser/samples/animation/output.json +++ b/test/parser/samples/animation/output.json @@ -35,6 +35,7 @@ "start": 51, "end": 56, "type": "Text", + "raw": "flips", "data": "flips" } ] @@ -54,8 +55,5 @@ } } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/attribute-containing-solidus/output.json b/test/parser/samples/attribute-containing-solidus/output.json index 95372bd77d..f1158b4f50 100644 --- a/test/parser/samples/attribute-containing-solidus/output.json +++ b/test/parser/samples/attribute-containing-solidus/output.json @@ -20,6 +20,7 @@ "start": 8, "end": 30, "type": "Text", + "raw": "https://www.google.com", "data": "https://www.google.com" } ] @@ -30,13 +31,11 @@ "start": 31, "end": 37, "type": "Text", + "raw": "Google", "data": "Google" } ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/attribute-dynamic-boolean/output.json b/test/parser/samples/attribute-dynamic-boolean/output.json index 81a19f49b9..478144152a 100644 --- a/test/parser/samples/attribute-dynamic-boolean/output.json +++ b/test/parser/samples/attribute-dynamic-boolean/output.json @@ -33,8 +33,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/attribute-dynamic-reserved/output.json b/test/parser/samples/attribute-dynamic-reserved/output.json index 3a830d448f..22be3c9087 100644 --- a/test/parser/samples/attribute-dynamic-reserved/output.json +++ b/test/parser/samples/attribute-dynamic-reserved/output.json @@ -33,8 +33,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/attribute-dynamic/output.json b/test/parser/samples/attribute-dynamic/output.json index 50d8ec60a5..a48f376876 100644 --- a/test/parser/samples/attribute-dynamic/output.json +++ b/test/parser/samples/attribute-dynamic/output.json @@ -18,8 +18,9 @@ "value": [ { "start": 12, - "end": 19, + "end": 20, "type": "Text", + "raw": "color: ", "data": "color: " }, { @@ -37,6 +38,7 @@ "start": 26, "end": 27, "type": "Text", + "raw": ";", "data": ";" } ] @@ -57,8 +59,5 @@ ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/attribute-escaped/output.json b/test/parser/samples/attribute-escaped/output.json index 79b135eb86..e60a8c2531 100644 --- a/test/parser/samples/attribute-escaped/output.json +++ b/test/parser/samples/attribute-escaped/output.json @@ -20,8 +20,8 @@ "start": 15, "end": 33, "type": "Text", - "data": "\"quoted\"", - "raw": ""quoted"" + "raw": ""quoted"", + "data": "\"quoted\"" } ] } @@ -29,8 +29,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/attribute-multiple/output.json b/test/parser/samples/attribute-multiple/output.json index 668409c0ef..c4be13e6ee 100644 --- a/test/parser/samples/attribute-multiple/output.json +++ b/test/parser/samples/attribute-multiple/output.json @@ -20,6 +20,7 @@ "start": 9, "end": 10, "type": "Text", + "raw": "x", "data": "x" } ] @@ -34,6 +35,7 @@ "start": 19, "end": 20, "type": "Text", + "raw": "y", "data": "y" } ] @@ -42,8 +44,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/attribute-shorthand/output.json b/test/parser/samples/attribute-shorthand/output.json index 08ddf5eda9..f23e62b04e 100644 --- a/test/parser/samples/attribute-shorthand/output.json +++ b/test/parser/samples/attribute-shorthand/output.json @@ -33,8 +33,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/attribute-static-boolean/output.json b/test/parser/samples/attribute-static-boolean/output.json index f63b5734e0..7d635004c1 100644 --- a/test/parser/samples/attribute-static-boolean/output.json +++ b/test/parser/samples/attribute-static-boolean/output.json @@ -21,8 +21,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/attribute-static/output.json b/test/parser/samples/attribute-static/output.json index 3185e48736..37b41d9a89 100644 --- a/test/parser/samples/attribute-static/output.json +++ b/test/parser/samples/attribute-static/output.json @@ -20,6 +20,7 @@ "start": 12, "end": 15, "type": "Text", + "raw": "foo", "data": "foo" } ] @@ -28,8 +29,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/attribute-unquoted/output.json b/test/parser/samples/attribute-unquoted/output.json index c7556f2eba..11fa397819 100644 --- a/test/parser/samples/attribute-unquoted/output.json +++ b/test/parser/samples/attribute-unquoted/output.json @@ -20,6 +20,7 @@ "start": 11, "end": 14, "type": "Text", + "raw": "foo", "data": "foo" } ] @@ -28,8 +29,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/await-then-catch/output.json b/test/parser/samples/await-then-catch/output.json index f62ad16574..ac598a403a 100644 --- a/test/parser/samples/await-then-catch/output.json +++ b/test/parser/samples/await-then-catch/output.json @@ -19,13 +19,13 @@ "pending": { "start": 19, "end": 39, - "skip": false, "type": "PendingBlock", "children": [ { "start": 19, "end": 21, "type": "Text", + "raw": "\n\t", "data": "\n\t" }, { @@ -39,6 +39,7 @@ "start": 24, "end": 34, "type": "Text", + "raw": "loading...", "data": "loading..." } ] @@ -47,20 +48,22 @@ "start": 38, "end": 39, "type": "Text", + "raw": "\n", "data": "\n" } - ] + ], + "skip": false }, "then": { "start": 39, "end": 88, - "skip": false, "type": "ThenBlock", "children": [ { "start": 55, "end": 57, "type": "Text", + "raw": "\n\t", "data": "\n\t" }, { @@ -74,6 +77,7 @@ "start": 60, "end": 73, "type": "Text", + "raw": "the value is ", "data": "the value is " }, { @@ -93,20 +97,22 @@ "start": 87, "end": 88, "type": "Text", + "raw": "\n", "data": "\n" } - ] + ], + "skip": false }, "catch": { "start": 88, "end": 140, - "skip": false, "type": "CatchBlock", "children": [ { "start": 105, "end": 107, "type": "Text", + "raw": "\n\t", "data": "\n\t" }, { @@ -120,6 +126,7 @@ "start": 110, "end": 117, "type": "Text", + "raw": "oh no! ", "data": "oh no! " }, { @@ -151,14 +158,13 @@ "start": 139, "end": 140, "type": "Text", + "raw": "\n", "data": "\n" } - ] + ], + "skip": false } } ] - }, - "css": null, - "instance": null, - "module": null -} + } +} \ No newline at end of file diff --git a/test/parser/samples/binding-shorthand/output.json b/test/parser/samples/binding-shorthand/output.json index 8f92101042..7fe7acb5b3 100644 --- a/test/parser/samples/binding-shorthand/output.json +++ b/test/parser/samples/binding-shorthand/output.json @@ -8,6 +8,7 @@ "start": 28, "end": 30, "type": "Text", + "raw": "\n\n", "data": "\n\n" }, { diff --git a/test/parser/samples/binding/output.json b/test/parser/samples/binding/output.json index d084050617..72ad60202c 100644 --- a/test/parser/samples/binding/output.json +++ b/test/parser/samples/binding/output.json @@ -8,6 +8,7 @@ "start": 29, "end": 31, "type": "Text", + "raw": "\n\n", "data": "\n\n" }, { diff --git a/test/parser/samples/comment/output.json b/test/parser/samples/comment/output.json index 89295c188a..2a57c4fa5d 100644 --- a/test/parser/samples/comment/output.json +++ b/test/parser/samples/comment/output.json @@ -11,8 +11,5 @@ "data": " a comment " } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/component-dynamic/output.json b/test/parser/samples/component-dynamic/output.json index c2e4e3ee79..77837d1ca9 100644 --- a/test/parser/samples/component-dynamic/output.json +++ b/test/parser/samples/component-dynamic/output.json @@ -36,8 +36,5 @@ } } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/convert-entities-in-element/output.json b/test/parser/samples/convert-entities-in-element/output.json index 92b5aafb00..c830c276de 100644 --- a/test/parser/samples/convert-entities-in-element/output.json +++ b/test/parser/samples/convert-entities-in-element/output.json @@ -15,14 +15,11 @@ "start": 3, "end": 20, "type": "Text", - "data": "Hello & World", - "raw": "Hello & World" + "raw": "Hello & World", + "data": "Hello & World" } ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/convert-entities/output.json b/test/parser/samples/convert-entities/output.json index 967895383d..f4cc1a6662 100644 --- a/test/parser/samples/convert-entities/output.json +++ b/test/parser/samples/convert-entities/output.json @@ -8,12 +8,9 @@ "start": 0, "end": 17, "type": "Text", - "data": "Hello & World", - "raw": "Hello & World" + "raw": "Hello & World", + "data": "Hello & World" } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/css/output.json b/test/parser/samples/css/output.json index 3127e01c71..12d74ae7f8 100644 --- a/test/parser/samples/css/output.json +++ b/test/parser/samples/css/output.json @@ -15,6 +15,7 @@ "start": 5, "end": 8, "type": "Text", + "raw": "foo", "data": "foo" } ] @@ -23,6 +24,7 @@ "start": 14, "end": 16, "type": "Text", + "raw": "\n\n", "data": "\n\n" } ] @@ -90,7 +92,5 @@ "end": 48, "styles": "\n\tdiv {\n\t\tcolor: red;\n\t}\n" } - }, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/dynamic-import/output.json b/test/parser/samples/dynamic-import/output.json index c0d4a45e0d..fa1acf7d9b 100644 --- a/test/parser/samples/dynamic-import/output.json +++ b/test/parser/samples/dynamic-import/output.json @@ -5,7 +5,6 @@ "type": "Fragment", "children": [] }, - "css": null, "instance": { "start": 0, "end": 146, @@ -66,8 +65,8 @@ "start": 54, "end": 134, "id": null, - "generator": false, "expression": false, + "generator": false, "async": false, "params": [], "body": { @@ -120,8 +119,8 @@ "start": 88, "end": 129, "id": null, - "generator": false, "expression": false, + "generator": false, "async": false, "params": [ { diff --git a/test/parser/samples/each-block-destructured/output.json b/test/parser/samples/each-block-destructured/output.json index 0c4b1a5c54..6368b445d6 100644 --- a/test/parser/samples/each-block-destructured/output.json +++ b/test/parser/samples/each-block-destructured/output.json @@ -37,6 +37,7 @@ "start": 50, "end": 52, "type": "Text", + "raw": ": ", "data": ": " }, { @@ -80,8 +81,5 @@ } } ] - }, - "css": null, - "instance": null, - "module": null -} + } +} \ No newline at end of file diff --git a/test/parser/samples/each-block-else/output.json b/test/parser/samples/each-block-else/output.json index aefc8c2f39..1e8ac455e6 100644 --- a/test/parser/samples/each-block-else/output.json +++ b/test/parser/samples/each-block-else/output.json @@ -58,6 +58,7 @@ "start": 55, "end": 65, "type": "Text", + "raw": "no animals", "data": "no animals" } ] @@ -66,8 +67,5 @@ } } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/each-block-indexed/output.json b/test/parser/samples/each-block-indexed/output.json index 7518652468..77417ba67a 100644 --- a/test/parser/samples/each-block-indexed/output.json +++ b/test/parser/samples/each-block-indexed/output.json @@ -37,6 +37,7 @@ "start": 36, "end": 38, "type": "Text", + "raw": ": ", "data": ": " }, { @@ -62,8 +63,5 @@ "index": "i" } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/each-block-keyed/output.json b/test/parser/samples/each-block-keyed/output.json index fe893bcdb9..11cdd45ff1 100644 --- a/test/parser/samples/each-block-keyed/output.json +++ b/test/parser/samples/each-block-keyed/output.json @@ -62,8 +62,5 @@ } } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/each-block/output.json b/test/parser/samples/each-block/output.json index c16a71ad5d..6a60823952 100644 --- a/test/parser/samples/each-block/output.json +++ b/test/parser/samples/each-block/output.json @@ -44,8 +44,5 @@ } } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/element-with-mustache/output.json b/test/parser/samples/element-with-mustache/output.json index c8a386d681..f7c2e9936b 100644 --- a/test/parser/samples/element-with-mustache/output.json +++ b/test/parser/samples/element-with-mustache/output.json @@ -15,6 +15,7 @@ "start": 4, "end": 10, "type": "Text", + "raw": "hello ", "data": "hello " }, { @@ -32,13 +33,11 @@ "start": 16, "end": 17, "type": "Text", + "raw": "!", "data": "!" } ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/element-with-text/output.json b/test/parser/samples/element-with-text/output.json index 70f6163c93..b0e0f5c6cc 100644 --- a/test/parser/samples/element-with-text/output.json +++ b/test/parser/samples/element-with-text/output.json @@ -15,13 +15,11 @@ "start": 6, "end": 10, "type": "Text", + "raw": "test", "data": "test" } ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/elements/output.json b/test/parser/samples/elements/output.json index d216f7f5d8..75548c20f0 100644 --- a/test/parser/samples/elements/output.json +++ b/test/parser/samples/elements/output.json @@ -21,8 +21,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/event-handler/output.json b/test/parser/samples/event-handler/output.json index b1fe89fc2a..f792ffadcc 100644 --- a/test/parser/samples/event-handler/output.json +++ b/test/parser/samples/event-handler/output.json @@ -21,8 +21,8 @@ "start": 19, "end": 43, "id": null, - "generator": false, "expression": true, + "generator": false, "async": false, "params": [], "body": { @@ -58,6 +58,7 @@ "start": 46, "end": 52, "type": "Text", + "raw": "toggle", "data": "toggle" } ] @@ -66,6 +67,7 @@ "start": 61, "end": 63, "type": "Text", + "raw": "\n\n", "data": "\n\n" }, { @@ -90,6 +92,7 @@ "start": 81, "end": 87, "type": "Text", + "raw": "hello!", "data": "hello!" } ] @@ -97,8 +100,5 @@ ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/if-block-else/output.json b/test/parser/samples/if-block-else/output.json index dedf2797c4..8b22cfa26b 100644 --- a/test/parser/samples/if-block-else/output.json +++ b/test/parser/samples/if-block-else/output.json @@ -26,6 +26,7 @@ "start": 14, "end": 17, "type": "Text", + "raw": "foo", "data": "foo" } ] @@ -47,6 +48,7 @@ "start": 34, "end": 41, "type": "Text", + "raw": "not foo", "data": "not foo" } ] @@ -55,8 +57,5 @@ } } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/if-block-elseif/output.json b/test/parser/samples/if-block-elseif/output.json index 188b57aaad..54fb53dacb 100644 --- a/test/parser/samples/if-block-elseif/output.json +++ b/test/parser/samples/if-block-elseif/output.json @@ -39,6 +39,7 @@ "start": 17, "end": 37, "type": "Text", + "raw": "x is greater than 10", "data": "x is greater than 10" } ] @@ -85,6 +86,7 @@ "start": 63, "end": 79, "type": "Text", + "raw": "x is less than 5", "data": "x is less than 5" } ] diff --git a/test/parser/samples/if-block/output.json b/test/parser/samples/if-block/output.json index d560824766..1714bb7141 100644 --- a/test/parser/samples/if-block/output.json +++ b/test/parser/samples/if-block/output.json @@ -19,13 +19,11 @@ "start": 9, "end": 12, "type": "Text", + "raw": "bar", "data": "bar" } ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/implicitly-closed-li/output.json b/test/parser/samples/implicitly-closed-li/output.json index caf69d7109..f46a2b1a26 100644 --- a/test/parser/samples/implicitly-closed-li/output.json +++ b/test/parser/samples/implicitly-closed-li/output.json @@ -15,6 +15,7 @@ "start": 4, "end": 6, "type": "Text", + "raw": "\n\t", "data": "\n\t" }, { @@ -28,6 +29,7 @@ "start": 10, "end": 13, "type": "Text", + "raw": "a\n\t", "data": "a\n\t" } ] @@ -43,6 +45,7 @@ "start": 17, "end": 20, "type": "Text", + "raw": "b\n\t", "data": "b\n\t" } ] @@ -58,6 +61,7 @@ "start": 24, "end": 26, "type": "Text", + "raw": "c\n", "data": "c\n" } ] @@ -65,8 +69,5 @@ ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/nbsp/output.json b/test/parser/samples/nbsp/output.json index c47257c873..044de64cba 100644 --- a/test/parser/samples/nbsp/output.json +++ b/test/parser/samples/nbsp/output.json @@ -15,14 +15,11 @@ "start": 6, "end": 12, "type": "Text", - "data": " ", - "raw": " " + "raw": " ", + "data": " " } ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/raw-mustaches/output.json b/test/parser/samples/raw-mustaches/output.json index 1d92b21c85..1b3d9b7a9c 100644 --- a/test/parser/samples/raw-mustaches/output.json +++ b/test/parser/samples/raw-mustaches/output.json @@ -15,6 +15,7 @@ "start": 3, "end": 4, "type": "Text", + "raw": " ", "data": " " }, { @@ -32,6 +33,7 @@ "start": 16, "end": 17, "type": "Text", + "raw": " ", "data": " " }, { @@ -49,13 +51,11 @@ "start": 29, "end": 30, "type": "Text", + "raw": " ", "data": " " } ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/refs/output.json b/test/parser/samples/refs/output.json index d15753b0a2..e09383f9b6 100644 --- a/test/parser/samples/refs/output.json +++ b/test/parser/samples/refs/output.json @@ -8,6 +8,7 @@ "start": 28, "end": 30, "type": "Text", + "raw": "\n\n", "data": "\n\n" }, { diff --git a/test/parser/samples/script-comment-only/output.json b/test/parser/samples/script-comment-only/output.json index 95ca769b20..ba28434318 100644 --- a/test/parser/samples/script-comment-only/output.json +++ b/test/parser/samples/script-comment-only/output.json @@ -8,6 +8,7 @@ "start": 43, "end": 45, "type": "Text", + "raw": "\n\n", "data": "\n\n" }, { diff --git a/test/parser/samples/script-comment-trailing-multiline/output.json b/test/parser/samples/script-comment-trailing-multiline/output.json index d4a45911a1..7d01599efa 100644 --- a/test/parser/samples/script-comment-trailing-multiline/output.json +++ b/test/parser/samples/script-comment-trailing-multiline/output.json @@ -8,6 +8,7 @@ "start": 77, "end": 79, "type": "Text", + "raw": "\n\n", "data": "\n\n" }, { @@ -21,6 +22,7 @@ "start": 83, "end": 89, "type": "Text", + "raw": "Hello ", "data": "Hello " }, { @@ -38,6 +40,7 @@ "start": 95, "end": 96, "type": "Text", + "raw": "!", "data": "!" } ] diff --git a/test/parser/samples/script-comment-trailing/output.json b/test/parser/samples/script-comment-trailing/output.json index 92d431b558..bc8f3e4e67 100644 --- a/test/parser/samples/script-comment-trailing/output.json +++ b/test/parser/samples/script-comment-trailing/output.json @@ -8,6 +8,7 @@ "start": 66, "end": 68, "type": "Text", + "raw": "\n\n", "data": "\n\n" }, { @@ -21,6 +22,7 @@ "start": 72, "end": 78, "type": "Text", + "raw": "Hello ", "data": "Hello " }, { @@ -38,6 +40,7 @@ "start": 84, "end": 85, "type": "Text", + "raw": "!", "data": "!" } ] diff --git a/test/parser/samples/script/output.json b/test/parser/samples/script/output.json index 95966f5dc6..75aa0a7d2c 100644 --- a/test/parser/samples/script/output.json +++ b/test/parser/samples/script/output.json @@ -8,6 +8,7 @@ "start": 39, "end": 41, "type": "Text", + "raw": "\n\n", "data": "\n\n" }, { @@ -21,6 +22,7 @@ "start": 45, "end": 51, "type": "Text", + "raw": "Hello ", "data": "Hello " }, { @@ -38,6 +40,7 @@ "start": 57, "end": 58, "type": "Text", + "raw": "!", "data": "!" } ] diff --git a/test/parser/samples/self-closing-element/output.json b/test/parser/samples/self-closing-element/output.json index 47eea2f333..63ff17a466 100644 --- a/test/parser/samples/self-closing-element/output.json +++ b/test/parser/samples/self-closing-element/output.json @@ -13,8 +13,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/self-reference/output.json b/test/parser/samples/self-reference/output.json index de5112a087..92dfdfe4d0 100644 --- a/test/parser/samples/self-reference/output.json +++ b/test/parser/samples/self-reference/output.json @@ -72,8 +72,5 @@ ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/space-between-mustaches/output.json b/test/parser/samples/space-between-mustaches/output.json index c89409daeb..9a367bd2c1 100644 --- a/test/parser/samples/space-between-mustaches/output.json +++ b/test/parser/samples/space-between-mustaches/output.json @@ -15,6 +15,7 @@ "start": 3, "end": 4, "type": "Text", + "raw": " ", "data": " " }, { @@ -32,6 +33,7 @@ "start": 7, "end": 8, "type": "Text", + "raw": " ", "data": " " }, { @@ -49,6 +51,7 @@ "start": 11, "end": 14, "type": "Text", + "raw": " : ", "data": " : " }, { @@ -66,13 +69,11 @@ "start": 17, "end": 20, "type": "Text", + "raw": " : ", "data": " : " } ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/spread/output.json b/test/parser/samples/spread/output.json index 3986da3578..73a0dc9777 100644 --- a/test/parser/samples/spread/output.json +++ b/test/parser/samples/spread/output.json @@ -25,8 +25,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/textarea-children/output.json b/test/parser/samples/textarea-children/output.json index 3b403458fc..90f31f3caf 100644 --- a/test/parser/samples/textarea-children/output.json +++ b/test/parser/samples/textarea-children/output.json @@ -16,8 +16,9 @@ "value": [ { "start": 10, - "end": 40, + "end": 41, "type": "Text", + "raw": "\n\t

not actually an element. ", "data": "\n\t

not actually an element. " }, { @@ -35,6 +36,7 @@ "start": 45, "end": 50, "type": "Text", + "raw": "

\n", "data": "

\n" } ] @@ -43,8 +45,5 @@ "children": [] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/transition-intro-no-params/output.json b/test/parser/samples/transition-intro-no-params/output.json index edb15457e6..91b50f3ec8 100644 --- a/test/parser/samples/transition-intro-no-params/output.json +++ b/test/parser/samples/transition-intro-no-params/output.json @@ -26,13 +26,11 @@ "start": 13, "end": 21, "type": "Text", + "raw": "fades in", "data": "fades in" } ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/transition-intro/output.json b/test/parser/samples/transition-intro/output.json index 5583dd89bc..418bb97e16 100644 --- a/test/parser/samples/transition-intro/output.json +++ b/test/parser/samples/transition-intro/output.json @@ -54,13 +54,11 @@ "start": 31, "end": 39, "type": "Text", + "raw": "fades in", "data": "fades in" } ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/unusual-identifier/output.json b/test/parser/samples/unusual-identifier/output.json index c0d4ecc3ff..e4a2a18619 100644 --- a/test/parser/samples/unusual-identifier/output.json +++ b/test/parser/samples/unusual-identifier/output.json @@ -44,8 +44,5 @@ } } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/whitespace-leading-trailing/output.json b/test/parser/samples/whitespace-leading-trailing/output.json index f164af01ba..e4f387856e 100644 --- a/test/parser/samples/whitespace-leading-trailing/output.json +++ b/test/parser/samples/whitespace-leading-trailing/output.json @@ -8,6 +8,7 @@ "start": 0, "end": 6, "type": "Text", + "raw": "\n\n\t\t\t\t", "data": "\n\n\t\t\t\t" }, { @@ -21,13 +22,11 @@ "start": 9, "end": 32, "type": "Text", + "raw": "just chillin' over here", "data": "just chillin' over here" } ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/whitespace-normal/output.json b/test/parser/samples/whitespace-normal/output.json index e4ce956331..acbae7ae17 100644 --- a/test/parser/samples/whitespace-normal/output.json +++ b/test/parser/samples/whitespace-normal/output.json @@ -15,6 +15,7 @@ "start": 4, "end": 10, "type": "Text", + "raw": "Hello ", "data": "Hello " }, { @@ -39,6 +40,7 @@ "start": 24, "end": 26, "type": "Text", + "raw": "! ", "data": "! " } ] @@ -54,6 +56,7 @@ "start": 41, "end": 53, "type": "Text", + "raw": "How are you?", "data": "How are you?" } ] @@ -61,8 +64,5 @@ ] } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file diff --git a/test/parser/samples/yield/output.json b/test/parser/samples/yield/output.json index 16ea79d8e8..b2e4b9430f 100644 --- a/test/parser/samples/yield/output.json +++ b/test/parser/samples/yield/output.json @@ -16,8 +16,5 @@ } } ] - }, - "css": null, - "instance": null, - "module": null + } } \ No newline at end of file