diff --git a/packages/svelte/src/compiler/phases/2-analyze/index.js b/packages/svelte/src/compiler/phases/2-analyze/index.js index d8864268d3..51318ce638 100644 --- a/packages/svelte/src/compiler/phases/2-analyze/index.js +++ b/packages/svelte/src/compiler/phases/2-analyze/index.js @@ -219,7 +219,8 @@ export function analyze_module(ast, options) { module: { ast, scope, scopes }, name: options.filename || 'module', warnings, - accessors: false + accessors: false, + runes: true }; } diff --git a/packages/svelte/src/compiler/phases/3-transform/client/utils.js b/packages/svelte/src/compiler/phases/3-transform/client/utils.js index 132869f29d..0807a7e8ac 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/utils.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/utils.js @@ -152,7 +152,11 @@ export function serialize_set_binding(node, context, fallback) { if (left.object.type === 'ThisExpression' && left.property.type === 'PrivateIdentifier') { if (context.state.private_state.has(left.property.name) && !state.in_constructor) { const value = get_assignment_value(node, context); - return b.call('$.set', left, value); + return b.call( + '$.set', + left, + context.state.analysis.runes && should_proxy(value) ? b.call('$.proxy', value) : value + ); } } // @ts-expect-error @@ -202,7 +206,11 @@ export function serialize_set_binding(node, context, fallback) { if (is_store) { return b.call('$.store_set', serialize_get_binding(b.id(left_name), state), value); } else { - return b.call('$.set', b.id(left_name), value); + return b.call( + '$.set', + b.id(left_name), + context.state.analysis.runes && should_proxy(value) ? b.call('$.proxy', value) : value + ); } } else { if (is_store) { @@ -385,7 +393,8 @@ export function should_proxy(node) { !node || node.type === 'Literal' || node.type === 'ArrowFunctionExpression' || - node.type === 'FunctionExpression' + node.type === 'FunctionExpression' || + (node.type === 'Identifier' && node.name === 'undefined') ) { return false; } diff --git a/packages/svelte/src/compiler/phases/scope.js b/packages/svelte/src/compiler/phases/scope.js index 4e5e17fc1d..178c2d0d79 100644 --- a/packages/svelte/src/compiler/phases/scope.js +++ b/packages/svelte/src/compiler/phases/scope.js @@ -100,7 +100,8 @@ export class Scope { is_called: false, prop_alias: null, expression: null, - mutation: null + mutation: null, + reassigned: false }; this.declarations.set(node.name, binding); this.root.conflicts.add(node.name); diff --git a/packages/svelte/src/compiler/phases/types.d.ts b/packages/svelte/src/compiler/phases/types.d.ts index 8ee2cce170..f7e411447b 100644 --- a/packages/svelte/src/compiler/phases/types.d.ts +++ b/packages/svelte/src/compiler/phases/types.d.ts @@ -46,6 +46,7 @@ export interface Analysis { module: Js; name: string; // TODO should this be filename? it's used in `compileModule` as well as `compile` warnings: RawWarning[]; + runes: boolean; // TODO figure out if we can move this to ComponentAnalysis accessors: boolean; diff --git a/packages/svelte/tests/parser-legacy/samples/action-duplicate/output.json b/packages/svelte/tests/parser-legacy/samples/action-duplicate/output.json index 99e9a0d154..c310754298 100644 --- a/packages/svelte/tests/parser-legacy/samples/action-duplicate/output.json +++ b/packages/svelte/tests/parser-legacy/samples/action-duplicate/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 35, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 35, - "type": "Element", "name": "input", "attributes": [ { @@ -31,4 +31,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/action-with-call/output.json b/packages/svelte/tests/parser-legacy/samples/action-with-call/output.json index f1d5293746..af416ffac2 100644 --- a/packages/svelte/tests/parser-legacy/samples/action-with-call/output.json +++ b/packages/svelte/tests/parser-legacy/samples/action-with-call/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 40, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 40, - "type": "Element", "name": "input", "attributes": [ { @@ -73,4 +73,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/action-with-identifier/output.json b/packages/svelte/tests/parser-legacy/samples/action-with-identifier/output.json index 4931f29ea9..229ab78006 100644 --- a/packages/svelte/tests/parser-legacy/samples/action-with-identifier/output.json +++ b/packages/svelte/tests/parser-legacy/samples/action-with-identifier/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 29, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 29, - "type": "Element", "name": "input", "attributes": [ { @@ -38,4 +38,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/action-with-literal/output.json b/packages/svelte/tests/parser-legacy/samples/action-with-literal/output.json index e59e5e2d70..5a6529a933 100644 --- a/packages/svelte/tests/parser-legacy/samples/action-with-literal/output.json +++ b/packages/svelte/tests/parser-legacy/samples/action-with-literal/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 37, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 37, - "type": "Element", "name": "input", "attributes": [ { @@ -39,4 +39,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/action/output.json b/packages/svelte/tests/parser-legacy/samples/action/output.json index 0ed95d4ee8..55cbff860b 100644 --- a/packages/svelte/tests/parser-legacy/samples/action/output.json +++ b/packages/svelte/tests/parser-legacy/samples/action/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 21, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 21, - "type": "Element", "name": "input", "attributes": [ { @@ -23,4 +23,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/animation/output.json b/packages/svelte/tests/parser-legacy/samples/animation/output.json index 3f967587f8..9a30d6200d 100644 --- a/packages/svelte/tests/parser-legacy/samples/animation/output.json +++ b/packages/svelte/tests/parser-legacy/samples/animation/output.json @@ -1,34 +1,18 @@ { "html": { + "type": "Fragment", "start": 0, "end": 70, - "type": "Fragment", "children": [ { + "type": "EachBlock", "start": 0, "end": 70, - "type": "EachBlock", - "expression": { - "type": "Identifier", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "name": "things" - }, "children": [ { + "type": "Element", "start": 33, "end": 62, - "type": "Element", "name": "div", "attributes": [ { @@ -42,9 +26,9 @@ ], "children": [ { + "type": "Text", "start": 51, "end": 56, - "type": "Text", "raw": "flips", "data": "flips" } @@ -57,6 +41,22 @@ "start": 17, "end": 22 }, + "expression": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "name": "things" + }, "key": { "type": "Identifier", "start": 24, @@ -76,4 +76,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-class-directive/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-class-directive/output.json index 88708ebb6e..8c27c8bcb4 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-class-directive/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-class-directive/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 29, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 29, - "type": "Element", "name": "div", "attributes": [ { @@ -38,4 +38,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-containing-solidus/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-containing-solidus/output.json index a02fb12ae8..c67811fab9 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-containing-solidus/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-containing-solidus/output.json @@ -1,19 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 41, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 41, - "type": "Element", "name": "a", "attributes": [ { + "type": "Attribute", "start": 3, "end": 30, - "type": "Attribute", "name": "href", "value": [ { @@ -28,9 +28,9 @@ ], "children": [ { + "type": "Text", "start": 31, "end": 37, - "type": "Text", "raw": "Google", "data": "Google" } @@ -38,4 +38,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-curly-bracket/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-curly-bracket/output.json index 077e307dff..a137dd795b 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-curly-bracket/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-curly-bracket/output.json @@ -1,19 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 18, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 18, - "type": "Element", "name": "input", "attributes": [ { + "type": "Attribute", "start": 7, "end": 15, - "type": "Attribute", "name": "foo", "value": [ { @@ -24,9 +24,9 @@ "data": "a" }, { + "type": "MustacheTag", "start": 12, "end": 15, - "type": "MustacheTag", "expression": { "type": "Literal", "start": 13, @@ -52,4 +52,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-dynamic-boolean/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-dynamic-boolean/output.json index b87a654670..5462eaf713 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-dynamic-boolean/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-dynamic-boolean/output.json @@ -1,25 +1,25 @@ { "html": { + "type": "Fragment", "start": 0, "end": 41, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 41, - "type": "Element", "name": "textarea", "attributes": [ { + "type": "Attribute", "start": 10, "end": 29, - "type": "Attribute", "name": "readonly", "value": [ { + "type": "MustacheTag", "start": 19, "end": 29, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 20, @@ -44,4 +44,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-dynamic/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-dynamic/output.json index 4926b645ab..6acc5ebeb1 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-dynamic/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-dynamic/output.json @@ -1,19 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 42, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 42, - "type": "Element", "name": "div", "attributes": [ { + "type": "Attribute", "start": 5, "end": 28, - "type": "Attribute", "name": "style", "value": [ { @@ -24,9 +24,9 @@ "data": "color: " }, { + "type": "MustacheTag", "start": 19, "end": 26, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 20, @@ -56,9 +56,9 @@ ], "children": [ { + "type": "MustacheTag", "start": 29, "end": 36, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 30, @@ -80,4 +80,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-empty/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-empty/output.json index 04b28f8d4a..478ba2e525 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-empty/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-empty/output.json @@ -1,19 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 38, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 38, - "type": "Element", "name": "div", "attributes": [ { + "type": "Attribute", "start": 5, "end": 9, - "type": "Attribute", "name": "a", "value": [ { @@ -26,15 +26,15 @@ ] }, { + "type": "Attribute", "start": 10, "end": 16, - "type": "Attribute", "name": "b", "value": [ { + "type": "MustacheTag", "start": 12, "end": 16, - "type": "MustacheTag", "expression": { "type": "Literal", "start": 13, @@ -56,9 +56,9 @@ ] }, { + "type": "Attribute", "start": 17, "end": 21, - "type": "Attribute", "name": "c", "value": [ { @@ -71,15 +71,15 @@ ] }, { + "type": "Attribute", "start": 22, "end": 30, - "type": "Attribute", "name": "d", "value": [ { + "type": "MustacheTag", "start": 25, "end": 29, - "type": "MustacheTag", "expression": { "type": "Literal", "start": 26, @@ -105,4 +105,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-escaped/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-escaped/output.json index 71eb553a71..74fa6f2aec 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-escaped/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-escaped/output.json @@ -1,19 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 83, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 83, - "type": "Element", "name": "div", "attributes": [ { + "type": "Attribute", "start": 5, "end": 76, - "type": "Attribute", "name": "data-foo", "value": [ { @@ -30,4 +30,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-multiple/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-multiple/output.json index ce098fa537..80bbdf0e21 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-multiple/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-multiple/output.json @@ -1,19 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 28, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 28, - "type": "Element", "name": "div", "attributes": [ { + "type": "Attribute", "start": 5, "end": 11, - "type": "Attribute", "name": "id", "value": [ { @@ -26,9 +26,9 @@ ] }, { + "type": "Attribute", "start": 12, "end": 21, - "type": "Attribute", "name": "class", "value": [ { @@ -45,4 +45,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-shorthand/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-shorthand/output.json index 4bfb7af187..5aeb2aa09b 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-shorthand/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-shorthand/output.json @@ -1,25 +1,25 @@ { "html": { + "type": "Fragment", "start": 0, "end": 11, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 11, - "type": "Element", "name": "div", "attributes": [ { + "type": "Attribute", "start": 5, "end": 9, - "type": "Attribute", "name": "id", "value": [ { + "type": "AttributeShorthand", "start": 6, "end": 8, - "type": "AttributeShorthand", "expression": { "start": 6, "end": 8, @@ -34,4 +34,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-static-boolean/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-static-boolean/output.json index cf65d54592..a059934e40 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-static-boolean/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-static-boolean/output.json @@ -1,19 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 30, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 30, - "type": "Element", "name": "textarea", "attributes": [ { + "type": "Attribute", "start": 10, "end": 18, - "type": "Attribute", "name": "readonly", "value": true } @@ -22,4 +22,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-static/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-static/output.json index b4fff2cd06..94608a0eba 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-static/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-static/output.json @@ -1,19 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 23, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 23, - "type": "Element", "name": "div", "attributes": [ { + "type": "Attribute", "start": 5, "end": 16, - "type": "Attribute", "name": "class", "value": [ { @@ -30,4 +30,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-style-directive-modifiers/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-style-directive-modifiers/output.json index 1587c2a3fb..45bb6f0e2e 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-style-directive-modifiers/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-style-directive-modifiers/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 43, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 43, - "type": "Element", "name": "div", "attributes": [ { @@ -15,12 +15,14 @@ "end": 36, "type": "StyleDirective", "name": "color", - "modifiers": ["important"], + "modifiers": [ + "important" + ], "value": [ { + "type": "MustacheTag", "start": 27, "end": 36, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 28, @@ -45,4 +47,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-style-directive-shorthand/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-style-directive-shorthand/output.json index 80fb4f741f..4ad7aaf7f7 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-style-directive-shorthand/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-style-directive-shorthand/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 23, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 23, - "type": "Element", "name": "div", "attributes": [ { @@ -23,4 +23,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-style-directive-string/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-style-directive-string/output.json index 505e9333e1..9693f97782 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-style-directive-string/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-style-directive-string/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 252, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 29, - "type": "Element", "name": "div", "attributes": [ { @@ -30,24 +30,24 @@ "children": [] }, { + "type": "Text", "start": 29, "end": 30, - "type": "Text", "raw": "\n", "data": "\n" }, { + "type": "Element", "start": 30, "end": 59, - "type": "Element", "name": "div", "attributes": [ { "start": 35, "end": 52, "type": "StyleDirective", - "modifiers": [], "name": "color", + "modifiers": [], "value": [ { "start": 48, @@ -62,16 +62,16 @@ "children": [] }, { + "type": "Text", "start": 59, "end": 60, - "type": "Text", "raw": "\n", "data": "\n" }, { + "type": "Element", "start": 60, "end": 87, - "type": "Element", "name": "div", "attributes": [ { @@ -94,16 +94,16 @@ "children": [] }, { + "type": "Text", "start": 87, "end": 88, - "type": "Text", "raw": "\n", "data": "\n" }, { + "type": "Element", "start": 88, "end": 127, - "type": "Element", "name": "div", "attributes": [ { @@ -121,9 +121,9 @@ "data": "red" }, { + "type": "MustacheTag", "start": 109, "end": 119, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 110, @@ -147,16 +147,16 @@ "children": [] }, { + "type": "Text", "start": 127, "end": 128, - "type": "Text", "raw": "\n", "data": "\n" }, { + "type": "Element", "start": 128, "end": 167, - "type": "Element", "name": "div", "attributes": [ { @@ -174,9 +174,9 @@ "data": "red" }, { + "type": "MustacheTag", "start": 149, "end": 159, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 150, @@ -200,16 +200,16 @@ "children": [] }, { + "type": "Text", "start": 167, "end": 168, - "type": "Text", "raw": "\n", "data": "\n" }, { + "type": "Element", "start": 168, "end": 205, - "type": "Element", "name": "div", "attributes": [ { @@ -227,9 +227,9 @@ "data": "red" }, { + "type": "MustacheTag", "start": 188, "end": 198, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 189, @@ -253,16 +253,16 @@ "children": [] }, { + "type": "Text", "start": 205, "end": 206, - "type": "Text", "raw": "\n", "data": "\n" }, { + "type": "Element", "start": 206, "end": 252, - "type": "Element", "name": "div", "attributes": [ { @@ -273,9 +273,9 @@ "modifiers": [], "value": [ { + "type": "MustacheTag", "start": 223, "end": 245, - "type": "MustacheTag", "expression": { "type": "TemplateLiteral", "start": 224, @@ -359,4 +359,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-style-directive/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-style-directive/output.json index b7983a769e..08e2032db3 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-style-directive/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-style-directive/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 33, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 33, - "type": "Element", "name": "div", "attributes": [ { @@ -18,9 +18,9 @@ "modifiers": [], "value": [ { + "type": "MustacheTag", "start": 17, "end": 26, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 18, @@ -45,4 +45,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-style/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-style/output.json index 8dd604523d..d029f9ef71 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-style/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-style/output.json @@ -1,19 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 34, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 34, - "type": "Element", "name": "div", "attributes": [ { + "type": "Attribute", "start": 5, "end": 24, - "type": "Attribute", "name": "style", "value": [ { @@ -28,9 +28,9 @@ ], "children": [ { + "type": "Text", "start": 25, "end": 28, - "type": "Text", "raw": "red", "data": "red" } @@ -38,4 +38,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-unquoted/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-unquoted/output.json index 582ca0a2f3..b82bec517d 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-unquoted/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-unquoted/output.json @@ -1,19 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 21, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 21, - "type": "Element", "name": "div", "attributes": [ { + "type": "Attribute", "start": 5, "end": 14, - "type": "Attribute", "name": "class", "value": [ { @@ -30,4 +30,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/attribute-with-whitespace/output.json b/packages/svelte/tests/parser-legacy/samples/attribute-with-whitespace/output.json index dbd1d8d60a..31652f1fd5 100644 --- a/packages/svelte/tests/parser-legacy/samples/attribute-with-whitespace/output.json +++ b/packages/svelte/tests/parser-legacy/samples/attribute-with-whitespace/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 38, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 38, - "type": "Element", "name": "button", "attributes": [ { @@ -36,9 +36,9 @@ ], "children": [ { + "type": "Text", "start": 24, "end": 29, - "type": "Text", "raw": "Click", "data": "Click" } @@ -46,4 +46,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/await-catch/output.json b/packages/svelte/tests/parser-legacy/samples/await-catch/output.json index 163d061302..2567f1c3c4 100644 --- a/packages/svelte/tests/parser-legacy/samples/await-catch/output.json +++ b/packages/svelte/tests/parser-legacy/samples/await-catch/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 99, - "type": "Fragment", "children": [ { + "type": "AwaitBlock", "start": 0, "end": 99, - "type": "AwaitBlock", "expression": { "type": "Identifier", "start": 8, @@ -32,37 +32,37 @@ "end": 55 }, "pending": { + "type": "PendingBlock", "start": 19, "end": 39, - "type": "PendingBlock", "children": [ { + "type": "Text", "start": 19, "end": 21, - "type": "Text", "raw": "\n\t", "data": "\n\t" }, { + "type": "Element", "start": 21, "end": 38, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "Text", "start": 24, "end": 34, - "type": "Text", "raw": "loading...", "data": "loading..." } ] }, { + "type": "Text", "start": 38, "end": 39, - "type": "Text", "raw": "\n", "data": "\n" } @@ -70,42 +70,42 @@ "skip": false }, "then": { + "type": "ThenBlock", "start": null, "end": null, - "type": "ThenBlock", "children": [], "skip": true }, "catch": { + "type": "CatchBlock", "start": 39, "end": 91, - "type": "CatchBlock", "children": [ { + "type": "Text", "start": 56, "end": 58, - "type": "Text", "raw": "\n\t", "data": "\n\t" }, { + "type": "Element", "start": 58, "end": 90, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "Text", "start": 61, "end": 68, - "type": "Text", "raw": "oh no! ", "data": "oh no! " }, { + "type": "MustacheTag", "start": 68, "end": 86, - "type": "MustacheTag", "expression": { "type": "MemberExpression", "start": 69, @@ -159,9 +159,9 @@ ] }, { + "type": "Text", "start": 90, "end": 91, - "type": "Text", "raw": "\n", "data": "\n" } @@ -171,4 +171,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/await-then-catch/output.json b/packages/svelte/tests/parser-legacy/samples/await-then-catch/output.json index 18b484b0c0..7aebac3d00 100644 --- a/packages/svelte/tests/parser-legacy/samples/await-then-catch/output.json +++ b/packages/svelte/tests/parser-legacy/samples/await-then-catch/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 148, - "type": "Fragment", "children": [ { + "type": "AwaitBlock", "start": 0, "end": 148, - "type": "AwaitBlock", "expression": { "type": "Identifier", "start": 8, @@ -37,37 +37,37 @@ "end": 104 }, "pending": { + "type": "PendingBlock", "start": 19, "end": 39, - "type": "PendingBlock", "children": [ { + "type": "Text", "start": 19, "end": 21, - "type": "Text", "raw": "\n\t", "data": "\n\t" }, { + "type": "Element", "start": 21, "end": 38, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "Text", "start": 24, "end": 34, - "type": "Text", "raw": "loading...", "data": "loading..." } ] }, { + "type": "Text", "start": 38, "end": 39, - "type": "Text", "raw": "\n", "data": "\n" } @@ -75,35 +75,35 @@ "skip": false }, "then": { + "type": "ThenBlock", "start": 39, "end": 88, - "type": "ThenBlock", "children": [ { + "type": "Text", "start": 55, "end": 57, - "type": "Text", "raw": "\n\t", "data": "\n\t" }, { + "type": "Element", "start": 57, "end": 87, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "Text", "start": 60, "end": 73, - "type": "Text", "raw": "the value is ", "data": "the value is " }, { + "type": "MustacheTag", "start": 73, "end": 83, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 74, @@ -124,9 +124,9 @@ ] }, { + "type": "Text", "start": 87, "end": 88, - "type": "Text", "raw": "\n", "data": "\n" } @@ -134,35 +134,35 @@ "skip": false }, "catch": { + "type": "CatchBlock", "start": 88, "end": 140, - "type": "CatchBlock", "children": [ { + "type": "Text", "start": 105, "end": 107, - "type": "Text", "raw": "\n\t", "data": "\n\t" }, { + "type": "Element", "start": 107, "end": 139, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "Text", "start": 110, "end": 117, - "type": "Text", "raw": "oh no! ", "data": "oh no! " }, { + "type": "MustacheTag", "start": 117, "end": 135, - "type": "MustacheTag", "expression": { "type": "MemberExpression", "start": 118, @@ -216,9 +216,9 @@ ] }, { + "type": "Text", "start": 139, "end": 140, - "type": "Text", "raw": "\n", "data": "\n" } @@ -228,4 +228,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/binding-shorthand/output.json b/packages/svelte/tests/parser-legacy/samples/binding-shorthand/output.json index a86d3f635d..9d31edabf7 100644 --- a/packages/svelte/tests/parser-legacy/samples/binding-shorthand/output.json +++ b/packages/svelte/tests/parser-legacy/samples/binding-shorthand/output.json @@ -1,20 +1,20 @@ { "html": { + "type": "Fragment", "start": 30, "end": 48, - "type": "Fragment", "children": [ { + "type": "Text", "start": 28, "end": 30, - "type": "Text", "raw": "\n\n", "data": "\n\n" }, { + "type": "InlineComponent", "start": 30, "end": 48, - "type": "InlineComponent", "name": "Widget", "attributes": [ { @@ -109,4 +109,4 @@ "sourceType": "module" } } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/binding/output.json b/packages/svelte/tests/parser-legacy/samples/binding/output.json index 3dad94d3da..288f9182ab 100644 --- a/packages/svelte/tests/parser-legacy/samples/binding/output.json +++ b/packages/svelte/tests/parser-legacy/samples/binding/output.json @@ -1,20 +1,20 @@ { "html": { + "type": "Fragment", "start": 31, "end": 56, - "type": "Fragment", "children": [ { + "type": "Text", "start": 29, "end": 31, - "type": "Text", "raw": "\n\n", "data": "\n\n" }, { + "type": "Element", "start": 31, "end": 56, - "type": "Element", "name": "input", "attributes": [ { @@ -119,4 +119,4 @@ "sourceType": "module" } } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/comment-with-ignores/output.json b/packages/svelte/tests/parser-legacy/samples/comment-with-ignores/output.json index e15150a09d..9994b01a24 100644 --- a/packages/svelte/tests/parser-legacy/samples/comment-with-ignores/output.json +++ b/packages/svelte/tests/parser-legacy/samples/comment-with-ignores/output.json @@ -1,16 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 30, - "type": "Fragment", "children": [ { + "type": "Comment", "start": 0, "end": 30, - "type": "Comment", "data": " svelte-ignore foo bar ", - "ignores": ["foo", "bar"] + "ignores": [ + "foo", + "bar" + ] } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/comment/output.json b/packages/svelte/tests/parser-legacy/samples/comment/output.json index b3f050d650..a721ddd8dc 100644 --- a/packages/svelte/tests/parser-legacy/samples/comment/output.json +++ b/packages/svelte/tests/parser-legacy/samples/comment/output.json @@ -1,16 +1,16 @@ { "html": { + "type": "Fragment", "start": 0, "end": 18, - "type": "Fragment", "children": [ { + "type": "Comment", "start": 0, "end": 18, - "type": "Comment", "data": " a comment ", "ignores": [] } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/component-dynamic/output.json b/packages/svelte/tests/parser-legacy/samples/component-dynamic/output.json index 06e17f8092..7e7267498f 100644 --- a/packages/svelte/tests/parser-legacy/samples/component-dynamic/output.json +++ b/packages/svelte/tests/parser-legacy/samples/component-dynamic/output.json @@ -1,16 +1,14 @@ { "html": { + "type": "Fragment", "start": 0, "end": 62, - "type": "Fragment", "children": [ { - "start": 0, - "end": 62, "type": "InlineComponent", "name": "svelte:component", - "attributes": [], - "children": [], + "start": 0, + "end": 62, "expression": { "type": "ConditionalExpression", "start": 25, @@ -73,8 +71,10 @@ }, "name": "Bar" } - } + }, + "attributes": [], + "children": [] } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/convert-entities-in-element/output.json b/packages/svelte/tests/parser-legacy/samples/convert-entities-in-element/output.json index 15784cbcb6..3025f2c800 100644 --- a/packages/svelte/tests/parser-legacy/samples/convert-entities-in-element/output.json +++ b/packages/svelte/tests/parser-legacy/samples/convert-entities-in-element/output.json @@ -1,20 +1,20 @@ { "html": { + "type": "Fragment", "start": 0, "end": 24, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 24, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "Text", "start": 3, "end": 20, - "type": "Text", "raw": "Hello & World", "data": "Hello & World" } @@ -22,4 +22,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/convert-entities/output.json b/packages/svelte/tests/parser-legacy/samples/convert-entities/output.json index 5a3ad64c20..c43621cc6b 100644 --- a/packages/svelte/tests/parser-legacy/samples/convert-entities/output.json +++ b/packages/svelte/tests/parser-legacy/samples/convert-entities/output.json @@ -1,16 +1,16 @@ { "html": { + "type": "Fragment", "start": 0, "end": 17, - "type": "Fragment", "children": [ { + "type": "Text", "start": 0, "end": 17, - "type": "Text", "raw": "Hello & World", "data": "Hello & World" } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/css/output.json b/packages/svelte/tests/parser-legacy/samples/css/output.json index 31d3d145a9..712c884faf 100644 --- a/packages/svelte/tests/parser-legacy/samples/css/output.json +++ b/packages/svelte/tests/parser-legacy/samples/css/output.json @@ -1,29 +1,29 @@ { "html": { + "type": "Fragment", "start": 0, "end": 14, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 14, - "type": "Element", "name": "div", "attributes": [], "children": [ { + "type": "Text", "start": 5, "end": 8, - "type": "Text", "raw": "foo", "data": "foo" } ] }, { + "type": "Text", "start": 14, "end": 16, - "type": "Text", "raw": "\n\n", "data": "\n\n" } @@ -39,9 +39,13 @@ "type": "Rule", "prelude": { "type": "SelectorList", + "start": 25, + "end": 28, "children": [ { "type": "Selector", + "start": 25, + "end": 28, "children": [ { "type": "TypeSelector", @@ -49,27 +53,23 @@ "start": 25, "end": 28 } - ], - "start": 25, - "end": 28 + ] } - ], - "start": 25, - "end": 28 + ] }, "block": { "type": "Block", + "start": 29, + "end": 47, "children": [ { "type": "Declaration", - "property": "color", - "value": "red", "start": 33, - "end": 43 + "end": 43, + "property": "color", + "value": "red" } - ], - "start": 29, - "end": 47 + ] }, "start": 25, "end": 47 @@ -81,4 +81,4 @@ "styles": "\n\tdiv {\n\t\tcolor: red;\n\t}\n" } } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/dynamic-element-string/output.json b/packages/svelte/tests/parser-legacy/samples/dynamic-element-string/output.json index 9e9245b1ae..0c20da2ba0 100644 --- a/packages/svelte/tests/parser-legacy/samples/dynamic-element-string/output.json +++ b/packages/svelte/tests/parser-legacy/samples/dynamic-element-string/output.json @@ -1,30 +1,31 @@ { "html": { + "type": "Fragment", "start": 0, "end": 101, - "type": "Fragment", "children": [ { - "start": 0, - "end": 44, "type": "Element", "name": "svelte:element", + "start": 0, + "end": 44, + "tag": "div", "attributes": [], - "children": [], - "tag": "div" + "children": [] }, { "type": "Text", "start": 44, "end": 45, - "data": "\n", - "raw": "\n" + "raw": "\n", + "data": "\n" }, { - "start": 45, - "end": 101, "type": "Element", "name": "svelte:element", + "start": 45, + "end": 101, + "tag": "div", "attributes": [ { "type": "Attribute", @@ -33,18 +34,17 @@ "name": "class", "value": [ { - "type": "Text", "start": 79, "end": 82, - "data": "foo", - "raw": "foo" + "type": "Text", + "raw": "foo", + "data": "foo" } ] } ], - "children": [], - "tag": "div" + "children": [] } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/dynamic-element-variable/output.json b/packages/svelte/tests/parser-legacy/samples/dynamic-element-variable/output.json index 53769e94e3..7c75c8bc2a 100644 --- a/packages/svelte/tests/parser-legacy/samples/dynamic-element-variable/output.json +++ b/packages/svelte/tests/parser-legacy/samples/dynamic-element-variable/output.json @@ -1,17 +1,16 @@ { "html": { + "type": "Fragment", "start": 0, "end": 101, - "type": "Fragment", "children": [ { - "start": 0, - "end": 44, "type": "Element", "name": "svelte:element", - "attributes": [], - "children": [], + "start": 0, + "end": 44, "tag": { + "type": "Identifier", "start": 22, "end": 25, "loc": { @@ -24,23 +23,39 @@ "column": 25 } }, - "name": "tag", - "type": "Identifier" - } + "name": "tag" + }, + "attributes": [], + "children": [] }, { "type": "Text", "start": 44, "end": 45, - "data": "\n", - "raw": "\n" + "raw": "\n", + "data": "\n" }, { - "start": 45, - "end": 101, "type": "Element", "name": "svelte:element", - "children": [], + "start": 45, + "end": 101, + "tag": { + "type": "Identifier", + "start": 67, + "end": 70, + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "name": "tag" + }, "attributes": [ { "type": "Attribute", @@ -49,32 +64,17 @@ "name": "class", "value": [ { - "type": "Text", "start": 79, "end": 82, - "data": "foo", - "raw": "foo" + "type": "Text", + "raw": "foo", + "data": "foo" } ] } ], - "tag": { - "start": 67, - "end": 70, - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "name": "tag", - "type": "Identifier" - } + "children": [] } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/dynamic-import/output.json b/packages/svelte/tests/parser-legacy/samples/dynamic-import/output.json index 14ae36ae3a..070bd17248 100644 --- a/packages/svelte/tests/parser-legacy/samples/dynamic-import/output.json +++ b/packages/svelte/tests/parser-legacy/samples/dynamic-import/output.json @@ -1,8 +1,8 @@ { "html": { + "type": "Fragment", "start": null, "end": null, - "type": "Fragment", "children": [] }, "instance": { @@ -479,4 +479,4 @@ "sourceType": "module" } } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/each-block-destructured/output.json b/packages/svelte/tests/parser-legacy/samples/each-block-destructured/output.json index 9cbeb2be6c..68b4b1f535 100644 --- a/packages/svelte/tests/parser-legacy/samples/each-block-destructured/output.json +++ b/packages/svelte/tests/parser-legacy/samples/each-block-destructured/output.json @@ -1,48 +1,32 @@ { "html": { + "type": "Fragment", "start": 41, "end": 112, - "type": "Fragment", "children": [ { + "type": "Text", "start": 39, "end": 41, - "type": "Text", "raw": "\n\n", "data": "\n\n" }, { + "type": "EachBlock", "start": 41, "end": 112, - "type": "EachBlock", - "expression": { - "type": "Identifier", - "start": 48, - "end": 55, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 14 - } - }, - "name": "animals" - }, "children": [ { + "type": "Element", "start": 83, "end": 104, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "MustacheTag", "start": 86, "end": 91, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 87, @@ -61,16 +45,16 @@ } }, { + "type": "Text", "start": 91, "end": 93, - "type": "Text", "raw": ": ", "data": ": " }, { + "type": "MustacheTag", "start": 93, "end": 100, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 94, @@ -170,6 +154,22 @@ } } ] + }, + "expression": { + "type": "Identifier", + "start": 48, + "end": 55, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "name": "animals" } } ] @@ -265,4 +265,4 @@ "sourceType": "module" } } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/each-block-else/output.json b/packages/svelte/tests/parser-legacy/samples/each-block-else/output.json index 935195985f..f474bb1ec0 100644 --- a/packages/svelte/tests/parser-legacy/samples/each-block-else/output.json +++ b/packages/svelte/tests/parser-legacy/samples/each-block-else/output.json @@ -1,41 +1,25 @@ { "html": { + "type": "Fragment", "start": 0, "end": 77, - "type": "Fragment", "children": [ { + "type": "EachBlock", "start": 0, "end": 77, - "type": "EachBlock", - "expression": { - "type": "Identifier", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "animals" - }, "children": [ { + "type": "Element", "start": 27, "end": 42, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "MustacheTag", "start": 30, "end": 38, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 31, @@ -62,22 +46,38 @@ "start": 18, "end": 24 }, + "expression": { + "type": "Identifier", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": "animals" + }, "else": { + "type": "ElseBlock", "start": 50, "end": 70, - "type": "ElseBlock", "children": [ { + "type": "Element", "start": 52, "end": 69, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "Text", "start": 55, "end": 65, - "type": "Text", "raw": "no animals", "data": "no animals" } @@ -88,4 +88,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/each-block-indexed/output.json b/packages/svelte/tests/parser-legacy/samples/each-block-indexed/output.json index ff5d574326..c3b2549d9c 100644 --- a/packages/svelte/tests/parser-legacy/samples/each-block-indexed/output.json +++ b/packages/svelte/tests/parser-legacy/samples/each-block-indexed/output.json @@ -1,41 +1,25 @@ { "html": { + "type": "Fragment", "start": 0, "end": 58, - "type": "Fragment", "children": [ { + "type": "EachBlock", "start": 0, "end": 58, - "type": "EachBlock", - "expression": { - "type": "Identifier", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "animals" - }, "children": [ { + "type": "Element", "start": 30, "end": 50, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "MustacheTag", "start": 33, "end": 36, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 34, @@ -54,16 +38,16 @@ } }, { + "type": "Text", "start": 36, "end": 38, - "type": "Text", "raw": ": ", "data": ": " }, { + "type": "MustacheTag", "start": 38, "end": 46, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 39, @@ -90,8 +74,24 @@ "start": 18, "end": 24 }, + "expression": { + "type": "Identifier", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": "animals" + }, "index": "i" } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/each-block-keyed/output.json b/packages/svelte/tests/parser-legacy/samples/each-block-keyed/output.json index e4e9689851..f02798e220 100644 --- a/packages/svelte/tests/parser-legacy/samples/each-block-keyed/output.json +++ b/packages/svelte/tests/parser-legacy/samples/each-block-keyed/output.json @@ -1,41 +1,25 @@ { "html": { + "type": "Fragment", "start": 0, "end": 54, - "type": "Fragment", "children": [ { + "type": "EachBlock", "start": 0, "end": 54, - "type": "EachBlock", - "expression": { - "type": "Identifier", - "start": 7, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 12 - } - }, - "name": "todos" - }, "children": [ { + "type": "Element", "start": 33, "end": 46, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "MustacheTag", "start": 36, "end": 42, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 37, @@ -62,6 +46,22 @@ "start": 16, "end": 20 }, + "expression": { + "type": "Identifier", + "start": 7, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 12 + } + }, + "name": "todos" + }, "key": { "type": "MemberExpression", "start": 22, @@ -114,4 +114,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/each-block/output.json b/packages/svelte/tests/parser-legacy/samples/each-block/output.json index 39373ea2a5..5600d61312 100644 --- a/packages/svelte/tests/parser-legacy/samples/each-block/output.json +++ b/packages/svelte/tests/parser-legacy/samples/each-block/output.json @@ -1,41 +1,25 @@ { "html": { + "type": "Fragment", "start": 0, "end": 50, - "type": "Fragment", "children": [ { + "type": "EachBlock", "start": 0, "end": 50, - "type": "EachBlock", - "expression": { - "type": "Identifier", - "start": 7, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 14 - } - }, - "name": "animals" - }, "children": [ { + "type": "Element", "start": 27, "end": 42, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "MustacheTag", "start": 30, "end": 38, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 31, @@ -61,8 +45,24 @@ "name": "animal", "start": 18, "end": 24 + }, + "expression": { + "type": "Identifier", + "start": 7, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "name": "animals" } } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/element-with-attribute-empty-string/output.json b/packages/svelte/tests/parser-legacy/samples/element-with-attribute-empty-string/output.json index 8e8768eb62..afdcbf4297 100644 --- a/packages/svelte/tests/parser-legacy/samples/element-with-attribute-empty-string/output.json +++ b/packages/svelte/tests/parser-legacy/samples/element-with-attribute-empty-string/output.json @@ -1,19 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 43, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 21, - "type": "Element", "name": "span", "attributes": [ { + "type": "Attribute", "start": 6, "end": 13, - "type": "Attribute", "name": "attr", "value": [ { @@ -29,22 +29,22 @@ "children": [] }, { + "type": "Text", "start": 21, "end": 22, - "type": "Text", "raw": "\n", "data": "\n" }, { + "type": "Element", "start": 22, "end": 43, - "type": "Element", "name": "span", "attributes": [ { + "type": "Attribute", "start": 28, "end": 35, - "type": "Attribute", "name": "attr", "value": [ { @@ -61,4 +61,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/element-with-attribute/output.json b/packages/svelte/tests/parser-legacy/samples/element-with-attribute/output.json index a80344101e..b6740a6135 100644 --- a/packages/svelte/tests/parser-legacy/samples/element-with-attribute/output.json +++ b/packages/svelte/tests/parser-legacy/samples/element-with-attribute/output.json @@ -1,19 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 49, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 24, - "type": "Element", "name": "span", "attributes": [ { + "type": "Attribute", "start": 6, "end": 16, - "type": "Attribute", "name": "attr", "value": [ { @@ -29,22 +29,22 @@ "children": [] }, { + "type": "Text", "start": 24, "end": 25, - "type": "Text", "raw": "\n", "data": "\n" }, { + "type": "Element", "start": 25, "end": 49, - "type": "Element", "name": "span", "attributes": [ { + "type": "Attribute", "start": 31, "end": 41, - "type": "Attribute", "name": "attr", "value": [ { @@ -61,4 +61,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/element-with-mustache/output.json b/packages/svelte/tests/parser-legacy/samples/element-with-mustache/output.json index cb4ededf05..9bb92244ce 100644 --- a/packages/svelte/tests/parser-legacy/samples/element-with-mustache/output.json +++ b/packages/svelte/tests/parser-legacy/samples/element-with-mustache/output.json @@ -1,27 +1,27 @@ { "html": { + "type": "Fragment", "start": 0, "end": 22, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 22, - "type": "Element", "name": "h1", "attributes": [], "children": [ { + "type": "Text", "start": 4, "end": 10, - "type": "Text", "raw": "hello ", "data": "hello " }, { + "type": "MustacheTag", "start": 10, "end": 16, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 11, @@ -40,9 +40,9 @@ } }, { + "type": "Text", "start": 16, "end": 17, - "type": "Text", "raw": "!", "data": "!" } @@ -50,4 +50,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/element-with-text/output.json b/packages/svelte/tests/parser-legacy/samples/element-with-text/output.json index 0106e75b45..d8bb9e9c11 100644 --- a/packages/svelte/tests/parser-legacy/samples/element-with-text/output.json +++ b/packages/svelte/tests/parser-legacy/samples/element-with-text/output.json @@ -1,20 +1,20 @@ { "html": { + "type": "Fragment", "start": 0, "end": 17, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 17, - "type": "Element", "name": "span", "attributes": [], "children": [ { + "type": "Text", "start": 6, "end": 10, - "type": "Text", "raw": "test", "data": "test" } @@ -22,4 +22,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/elements/output.json b/packages/svelte/tests/parser-legacy/samples/elements/output.json index c530d4376c..97513445d6 100644 --- a/packages/svelte/tests/parser-legacy/samples/elements/output.json +++ b/packages/svelte/tests/parser-legacy/samples/elements/output.json @@ -1,19 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 15, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 15, - "type": "Element", "name": "!doctype", "attributes": [ { + "type": "Attribute", "start": 10, "end": 14, - "type": "Attribute", "name": "html", "value": true } @@ -22,4 +22,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/event-handler/output.json b/packages/svelte/tests/parser-legacy/samples/event-handler/output.json index e19804f20f..396e314da5 100644 --- a/packages/svelte/tests/parser-legacy/samples/event-handler/output.json +++ b/packages/svelte/tests/parser-legacy/samples/event-handler/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 97, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 61, - "type": "Element", "name": "button", "attributes": [ { @@ -105,25 +105,25 @@ ], "children": [ { + "type": "Text", "start": 46, "end": 52, - "type": "Text", "raw": "toggle", "data": "toggle" } ] }, { + "type": "Text", "start": 61, "end": 63, - "type": "Text", "raw": "\n\n", "data": "\n\n" }, { + "type": "IfBlock", "start": 63, "end": 97, - "type": "IfBlock", "expression": { "type": "Identifier", "start": 68, @@ -142,16 +142,16 @@ }, "children": [ { + "type": "Element", "start": 78, "end": 91, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "Text", "start": 81, "end": 87, - "type": "Text", "raw": "hello!", "data": "hello!" } @@ -161,4 +161,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/if-block-else/output.json b/packages/svelte/tests/parser-legacy/samples/if-block-else/output.json index 6427685583..34efb9fd7b 100644 --- a/packages/svelte/tests/parser-legacy/samples/if-block-else/output.json +++ b/packages/svelte/tests/parser-legacy/samples/if-block-else/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 51, - "type": "Fragment", "children": [ { + "type": "IfBlock", "start": 0, "end": 51, - "type": "IfBlock", "expression": { "type": "Identifier", "start": 5, @@ -26,16 +26,16 @@ }, "children": [ { + "type": "Element", "start": 11, "end": 21, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "Text", "start": 14, "end": 17, - "type": "Text", "raw": "foo", "data": "foo" } @@ -43,21 +43,21 @@ } ], "else": { + "type": "ElseBlock", "start": 29, "end": 46, - "type": "ElseBlock", "children": [ { + "type": "Element", "start": 31, "end": 45, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "Text", "start": 34, "end": 41, - "type": "Text", "raw": "not foo", "data": "not foo" } @@ -68,4 +68,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/if-block-elseif/output.json b/packages/svelte/tests/parser-legacy/samples/if-block-elseif/output.json index 2fdeddcf8c..2ae1f06cc9 100644 --- a/packages/svelte/tests/parser-legacy/samples/if-block-elseif/output.json +++ b/packages/svelte/tests/parser-legacy/samples/if-block-elseif/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 89, - "type": "Fragment", "children": [ { + "type": "IfBlock", "start": 0, "end": 89, - "type": "IfBlock", "expression": { "type": "BinaryExpression", "start": 5, @@ -59,16 +59,16 @@ }, "children": [ { + "type": "Element", "start": 14, "end": 41, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "Text", "start": 17, "end": 37, - "type": "Text", "raw": "x is greater than 10", "data": "x is greater than 10" } @@ -76,15 +76,14 @@ } ], "else": { + "type": "ElseBlock", "start": 58, "end": 84, - "type": "ElseBlock", "children": [ { + "type": "IfBlock", "start": 58, "end": 89, - "type": "IfBlock", - "elseif": true, "expression": { "type": "BinaryExpression", "start": 52, @@ -136,26 +135,27 @@ }, "children": [ { + "type": "Element", "start": 60, "end": 83, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "Text", "start": 63, "end": 79, - "type": "Text", "raw": "x is less than 5", "data": "x is less than 5" } ] } - ] + ], + "elseif": true } ] } } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/if-block/output.json b/packages/svelte/tests/parser-legacy/samples/if-block/output.json index 4c6fd97520..1c60df0d31 100644 --- a/packages/svelte/tests/parser-legacy/samples/if-block/output.json +++ b/packages/svelte/tests/parser-legacy/samples/if-block/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 17, - "type": "Fragment", "children": [ { + "type": "IfBlock", "start": 0, "end": 17, - "type": "IfBlock", "expression": { "type": "Identifier", "start": 5, @@ -26,9 +26,9 @@ }, "children": [ { + "type": "Text", "start": 9, "end": 12, - "type": "Text", "raw": "bar", "data": "bar" } @@ -36,4 +36,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/implicitly-closed-li/output.json b/packages/svelte/tests/parser-legacy/samples/implicitly-closed-li/output.json index d46de69dd6..be5fba538e 100644 --- a/packages/svelte/tests/parser-legacy/samples/implicitly-closed-li/output.json +++ b/packages/svelte/tests/parser-legacy/samples/implicitly-closed-li/output.json @@ -1,66 +1,66 @@ { "html": { + "type": "Fragment", "start": 0, "end": 31, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 31, - "type": "Element", "name": "ul", "attributes": [], "children": [ { + "type": "Text", "start": 4, "end": 6, - "type": "Text", "raw": "\n\t", "data": "\n\t" }, { + "type": "Element", "start": 6, "end": 13, - "type": "Element", "name": "li", "attributes": [], "children": [ { + "type": "Text", "start": 10, "end": 13, - "type": "Text", "raw": "a\n\t", "data": "a\n\t" } ] }, { + "type": "Element", "start": 13, "end": 20, - "type": "Element", "name": "li", "attributes": [], "children": [ { + "type": "Text", "start": 17, "end": 20, - "type": "Text", "raw": "b\n\t", "data": "b\n\t" } ] }, { + "type": "Element", "start": 20, "end": 26, - "type": "Element", "name": "li", "attributes": [], "children": [ { + "type": "Text", "start": 24, "end": 26, - "type": "Text", "raw": "c\n", "data": "c\n" } @@ -70,4 +70,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/javascript-comments/output.json b/packages/svelte/tests/parser-legacy/samples/javascript-comments/output.json index 951cf05ff8..422ce81535 100644 --- a/packages/svelte/tests/parser-legacy/samples/javascript-comments/output.json +++ b/packages/svelte/tests/parser-legacy/samples/javascript-comments/output.json @@ -295,4 +295,4 @@ "sourceType": "module" } } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/nbsp/output.json b/packages/svelte/tests/parser-legacy/samples/nbsp/output.json index ec231bbe73..a120b08f32 100644 --- a/packages/svelte/tests/parser-legacy/samples/nbsp/output.json +++ b/packages/svelte/tests/parser-legacy/samples/nbsp/output.json @@ -1,20 +1,20 @@ { "html": { + "type": "Fragment", "start": 0, "end": 19, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 19, - "type": "Element", "name": "span", "attributes": [], "children": [ { + "type": "Text", "start": 6, "end": 12, - "type": "Text", "raw": " ", "data": " " } @@ -22,4 +22,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/no-error-if-before-closing/output.json b/packages/svelte/tests/parser-legacy/samples/no-error-if-before-closing/output.json index 4350d3cb5b..769719471e 100644 --- a/packages/svelte/tests/parser-legacy/samples/no-error-if-before-closing/output.json +++ b/packages/svelte/tests/parser-legacy/samples/no-error-if-before-closing/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 148, - "type": "Fragment", "children": [ { + "type": "IfBlock", "start": 0, "end": 33, - "type": "IfBlock", "expression": { "type": "Literal", "start": 5, @@ -27,32 +27,32 @@ }, "children": [ { + "type": "Element", "start": 12, "end": 19, - "type": "Element", "name": "input", "attributes": [], "children": [] } ], "else": { + "type": "ElseBlock", "start": 27, "end": 28, - "type": "ElseBlock", "children": [] } }, { + "type": "Text", "start": 33, "end": 35, - "type": "Text", "raw": "\n\n", "data": "\n\n" }, { + "type": "IfBlock", "start": 35, "end": 65, - "type": "IfBlock", "expression": { "type": "Literal", "start": 40, @@ -72,32 +72,32 @@ }, "children": [ { + "type": "Element", "start": 47, "end": 51, - "type": "Element", "name": "br", "attributes": [], "children": [] } ], "else": { + "type": "ElseBlock", "start": 59, "end": 60, - "type": "ElseBlock", "children": [] } }, { + "type": "Text", "start": 65, "end": 67, - "type": "Text", "raw": "\n\n", "data": "\n\n" }, { + "type": "AwaitBlock", "start": 67, "end": 108, - "type": "AwaitBlock", "expression": { "type": "Literal", "start": 75, @@ -123,29 +123,29 @@ }, "error": null, "pending": { + "type": "PendingBlock", "start": 80, "end": 90, - "type": "PendingBlock", "children": [ { + "type": "Text", "start": 80, "end": 82, - "type": "Text", "raw": "\n\t", "data": "\n\t" }, { + "type": "Element", "start": 82, "end": 89, - "type": "Element", "name": "input", "attributes": [], "children": [] }, { + "type": "Text", "start": 89, "end": 90, - "type": "Text", "raw": "\n", "data": "\n" } @@ -153,14 +153,14 @@ "skip": false }, "then": { + "type": "ThenBlock", "start": 90, "end": 100, - "type": "ThenBlock", "children": [ { + "type": "Text", "start": 99, "end": 100, - "type": "Text", "raw": "\n", "data": "\n" } @@ -168,24 +168,24 @@ "skip": false }, "catch": { + "type": "CatchBlock", "start": null, "end": null, - "type": "CatchBlock", "children": [], "skip": true } }, { + "type": "Text", "start": 108, "end": 110, - "type": "Text", "raw": "\n\n", "data": "\n\n" }, { + "type": "AwaitBlock", "start": 110, "end": 148, - "type": "AwaitBlock", "expression": { "type": "Literal", "start": 118, @@ -211,29 +211,29 @@ }, "error": null, "pending": { + "type": "PendingBlock", "start": 123, "end": 130, - "type": "PendingBlock", "children": [ { + "type": "Text", "start": 123, "end": 125, - "type": "Text", "raw": "\n\t", "data": "\n\t" }, { + "type": "Element", "start": 125, "end": 129, - "type": "Element", "name": "br", "attributes": [], "children": [] }, { + "type": "Text", "start": 129, "end": 130, - "type": "Text", "raw": "\n", "data": "\n" } @@ -241,14 +241,14 @@ "skip": false }, "then": { + "type": "ThenBlock", "start": 130, "end": 140, - "type": "ThenBlock", "children": [ { + "type": "Text", "start": 139, "end": 140, - "type": "Text", "raw": "\n", "data": "\n" } @@ -256,13 +256,13 @@ "skip": false }, "catch": { + "type": "CatchBlock", "start": null, "end": null, - "type": "CatchBlock", "children": [], "skip": true } } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/raw-mustaches/output.json b/packages/svelte/tests/parser-legacy/samples/raw-mustaches/output.json index 3c349b472f..b8e1da7499 100644 --- a/packages/svelte/tests/parser-legacy/samples/raw-mustaches/output.json +++ b/packages/svelte/tests/parser-legacy/samples/raw-mustaches/output.json @@ -1,27 +1,27 @@ { "html": { + "type": "Fragment", "start": 0, "end": 34, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 34, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "Text", "start": 3, "end": 4, - "type": "Text", "raw": " ", "data": " " }, { + "type": "RawMustacheTag", "start": 4, "end": 16, - "type": "RawMustacheTag", "expression": { "type": "Identifier", "start": 11, @@ -40,16 +40,16 @@ } }, { + "type": "Text", "start": 16, "end": 17, - "type": "Text", "raw": " ", "data": " " }, { + "type": "RawMustacheTag", "start": 17, "end": 29, - "type": "RawMustacheTag", "expression": { "type": "Identifier", "start": 24, @@ -68,9 +68,9 @@ } }, { + "type": "Text", "start": 29, "end": 30, - "type": "Text", "raw": " ", "data": " " } @@ -78,4 +78,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/refs/output.json b/packages/svelte/tests/parser-legacy/samples/refs/output.json index 75f5d2d52a..0ecccbf957 100644 --- a/packages/svelte/tests/parser-legacy/samples/refs/output.json +++ b/packages/svelte/tests/parser-legacy/samples/refs/output.json @@ -1,20 +1,20 @@ { "html": { + "type": "Fragment", "start": 30, "end": 63, - "type": "Fragment", "children": [ { + "type": "Text", "start": 28, "end": 30, - "type": "Text", "raw": "\n\n", "data": "\n\n" }, { + "type": "Element", "start": 30, "end": 63, - "type": "Element", "name": "canvas", "attributes": [ { @@ -119,4 +119,4 @@ "sourceType": "module" } } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/script-attribute-with-curly-braces/output.json b/packages/svelte/tests/parser-legacy/samples/script-attribute-with-curly-braces/output.json index af4ec56a68..e9298ec50c 100644 --- a/packages/svelte/tests/parser-legacy/samples/script-attribute-with-curly-braces/output.json +++ b/packages/svelte/tests/parser-legacy/samples/script-attribute-with-curly-braces/output.json @@ -1,34 +1,34 @@ { "html": { + "type": "Fragment", "start": 79, "end": 101, - "type": "Fragment", "children": [ { + "type": "Text", "start": 77, "end": 79, - "type": "Text", "raw": "\n\n", "data": "\n\n" }, { + "type": "Element", "start": 79, "end": 101, - "type": "Element", "name": "h1", "attributes": [], "children": [ { + "type": "Text", "start": 83, "end": 89, - "type": "Text", "raw": "Hello ", "data": "Hello " }, { + "type": "MustacheTag", "start": 89, "end": 95, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 90, @@ -47,9 +47,9 @@ } }, { + "type": "Text", "start": 95, "end": 96, - "type": "Text", "raw": "!", "data": "!" } @@ -147,4 +147,4 @@ "sourceType": "module" } } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/script-comment-only/output.json b/packages/svelte/tests/parser-legacy/samples/script-comment-only/output.json index b04a823e8d..502d5df576 100644 --- a/packages/svelte/tests/parser-legacy/samples/script-comment-only/output.json +++ b/packages/svelte/tests/parser-legacy/samples/script-comment-only/output.json @@ -52,4 +52,4 @@ ] } } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/script-context-module-unquoted/output.json b/packages/svelte/tests/parser-legacy/samples/script-context-module-unquoted/output.json index 072e101782..7d7e9d1305 100644 --- a/packages/svelte/tests/parser-legacy/samples/script-context-module-unquoted/output.json +++ b/packages/svelte/tests/parser-legacy/samples/script-context-module-unquoted/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 62, "end": 60, - "type": "Fragment", "children": [ { + "type": "Text", "start": 60, "end": 62, - "type": "Text", "raw": "\n\n", "data": "\n\n" } @@ -175,4 +175,4 @@ "sourceType": "module" } } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/script/output.json b/packages/svelte/tests/parser-legacy/samples/script/output.json index efa31bddb8..e30414a2a8 100644 --- a/packages/svelte/tests/parser-legacy/samples/script/output.json +++ b/packages/svelte/tests/parser-legacy/samples/script/output.json @@ -1,34 +1,34 @@ { "html": { + "type": "Fragment", "start": 41, "end": 63, - "type": "Fragment", "children": [ { + "type": "Text", "start": 39, "end": 41, - "type": "Text", "raw": "\n\n", "data": "\n\n" }, { + "type": "Element", "start": 41, "end": 63, - "type": "Element", "name": "h1", "attributes": [], "children": [ { + "type": "Text", "start": 45, "end": 51, - "type": "Text", "raw": "Hello ", "data": "Hello " }, { + "type": "MustacheTag", "start": 51, "end": 57, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 52, @@ -47,9 +47,9 @@ } }, { + "type": "Text", "start": 57, "end": 58, - "type": "Text", "raw": "!", "data": "!" } @@ -147,4 +147,4 @@ "sourceType": "module" } } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/self-closing-element/output.json b/packages/svelte/tests/parser-legacy/samples/self-closing-element/output.json index 34052615d7..fe59cac4b7 100644 --- a/packages/svelte/tests/parser-legacy/samples/self-closing-element/output.json +++ b/packages/svelte/tests/parser-legacy/samples/self-closing-element/output.json @@ -1,17 +1,17 @@ { "html": { + "type": "Fragment", "start": 0, "end": 6, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 6, - "type": "Element", "name": "div", "attributes": [], "children": [] } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/self-reference/output.json b/packages/svelte/tests/parser-legacy/samples/self-reference/output.json index 77bffaaa3d..44547698fd 100644 --- a/packages/svelte/tests/parser-legacy/samples/self-reference/output.json +++ b/packages/svelte/tests/parser-legacy/samples/self-reference/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 57, - "type": "Fragment", "children": [ { + "type": "IfBlock", "start": 0, "end": 57, - "type": "IfBlock", "expression": { "type": "BinaryExpression", "start": 5, @@ -59,21 +59,21 @@ }, "children": [ { - "start": 17, - "end": 51, "type": "InlineComponent", "name": "svelte:self", + "start": 17, + "end": 51, "attributes": [ { + "type": "Attribute", "start": 30, "end": 49, - "type": "Attribute", "name": "depth", "value": [ { + "type": "MustacheTag", "start": 37, "end": 48, - "type": "MustacheTag", "expression": { "type": "BinaryExpression", "start": 38, @@ -133,4 +133,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/slotted-element/output.json b/packages/svelte/tests/parser-legacy/samples/slotted-element/output.json index 7028a367ff..c6717f3074 100644 --- a/packages/svelte/tests/parser-legacy/samples/slotted-element/output.json +++ b/packages/svelte/tests/parser-legacy/samples/slotted-element/output.json @@ -1,26 +1,26 @@ { "html": { + "type": "Fragment", "start": 0, "end": 45, - "type": "Fragment", "children": [ { + "type": "InlineComponent", "start": 0, "end": 45, - "type": "InlineComponent", "name": "Component", "attributes": [], "children": [ { + "type": "Element", "start": 11, "end": 33, - "type": "Element", "name": "div", "attributes": [ { + "type": "Attribute", "start": 16, "end": 26, - "type": "Attribute", "name": "slot", "value": [ { @@ -39,4 +39,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/space-between-mustaches/output.json b/packages/svelte/tests/parser-legacy/samples/space-between-mustaches/output.json index c552a84b02..7553651864 100644 --- a/packages/svelte/tests/parser-legacy/samples/space-between-mustaches/output.json +++ b/packages/svelte/tests/parser-legacy/samples/space-between-mustaches/output.json @@ -1,27 +1,27 @@ { "html": { + "type": "Fragment", "start": 0, "end": 24, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 24, - "type": "Element", "name": "p", "attributes": [], "children": [ { + "type": "Text", "start": 3, "end": 4, - "type": "Text", "raw": " ", "data": " " }, { + "type": "MustacheTag", "start": 4, "end": 7, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 5, @@ -40,16 +40,16 @@ } }, { + "type": "Text", "start": 7, "end": 8, - "type": "Text", "raw": " ", "data": " " }, { + "type": "MustacheTag", "start": 8, "end": 11, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 9, @@ -68,16 +68,16 @@ } }, { + "type": "Text", "start": 11, "end": 14, - "type": "Text", "raw": " : ", "data": " : " }, { + "type": "MustacheTag", "start": 14, "end": 17, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 15, @@ -96,9 +96,9 @@ } }, { + "type": "Text", "start": 17, "end": 20, - "type": "Text", "raw": " : ", "data": " : " } @@ -106,4 +106,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/spread/output.json b/packages/svelte/tests/parser-legacy/samples/spread/output.json index e0a45f9d75..b1d80bd5d4 100644 --- a/packages/svelte/tests/parser-legacy/samples/spread/output.json +++ b/packages/svelte/tests/parser-legacy/samples/spread/output.json @@ -1,19 +1,19 @@ { "html": { + "type": "Fragment", "start": 0, "end": 22, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 22, - "type": "Element", "name": "div", "attributes": [ { + "type": "Spread", "start": 5, "end": 15, - "type": "Spread", "expression": { "type": "Identifier", "start": 9, @@ -36,4 +36,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/style-inside-head/output.json b/packages/svelte/tests/parser-legacy/samples/style-inside-head/output.json index 5082c55343..25588b950b 100644 --- a/packages/svelte/tests/parser-legacy/samples/style-inside-head/output.json +++ b/packages/svelte/tests/parser-legacy/samples/style-inside-head/output.json @@ -1,27 +1,27 @@ { "html": { + "type": "Fragment", "start": 0, "end": 42, - "type": "Fragment", "children": [ { - "start": 0, - "end": 42, "type": "Head", "name": "svelte:head", + "start": 0, + "end": 42, "attributes": [], "children": [ { + "type": "Element", "start": 13, "end": 28, - "type": "Element", "name": "style", "attributes": [], "children": [ { + "type": "Text", "start": 20, "end": 20, - "type": "Text", "data": "" } ] @@ -30,4 +30,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/textarea-children/output.json b/packages/svelte/tests/parser-legacy/samples/textarea-children/output.json index cdb4b885d1..62a295c135 100644 --- a/packages/svelte/tests/parser-legacy/samples/textarea-children/output.json +++ b/packages/svelte/tests/parser-legacy/samples/textarea-children/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 61, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 61, - "type": "Element", "name": "textarea", "attributes": [], "children": [ @@ -19,9 +19,9 @@ "data": "\n\t

not actually an element. " }, { + "type": "MustacheTag", "start": 40, "end": 45, - "type": "MustacheTag", "expression": { "type": "Identifier", "start": 41, @@ -50,4 +50,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/svelte/tests/parser-legacy/samples/textarea-end-tag/output.json b/packages/svelte/tests/parser-legacy/samples/textarea-end-tag/output.json index 9693db2729..145de96560 100644 --- a/packages/svelte/tests/parser-legacy/samples/textarea-end-tag/output.json +++ b/packages/svelte/tests/parser-legacy/samples/textarea-end-tag/output.json @@ -1,13 +1,13 @@ { "html": { + "type": "Fragment", "start": 0, "end": 117, - "type": "Fragment", "children": [ { + "type": "Element", "start": 0, "end": 117, - "type": "Element", "name": "textarea", "attributes": [], "children": [ @@ -19,9 +19,9 @@ "data": "\n\t

not actu $.set(count, $.get(count) + 1), + onmousedown: () => $.set(count, $.proxy($.get(count) + 1)), onmouseup, children: ($$anchor, $$slotProps) => { /* Init */ @@ -31,4 +31,4 @@ export default function Function_prop_no_getter($$anchor, $$props) { $.close_frag($$anchor, fragment); $.pop(); -} +} \ No newline at end of file diff --git a/packages/svelte/tests/snapshot/samples/function-prop-no-getter/_expected/server/index.svelte.js b/packages/svelte/tests/snapshot/samples/function-prop-no-getter/_expected/server/index.svelte.js index 578409e0a4..ffd6a820bc 100644 --- a/packages/svelte/tests/snapshot/samples/function-prop-no-getter/_expected/server/index.svelte.js +++ b/packages/svelte/tests/snapshot/samples/function-prop-no-getter/_expected/server/index.svelte.js @@ -25,4 +25,4 @@ export default function Function_prop_no_getter($$payload, $$props) { $$payload.out += `${anchor}`; $.pop(); -} +} \ No newline at end of file diff --git a/packages/svelte/tests/snapshot/samples/svelte-element/_expected/client/index.svelte.js b/packages/svelte/tests/snapshot/samples/svelte-element/_expected/client/index.svelte.js index 263b00e526..eb370793ac 100644 --- a/packages/svelte/tests/snapshot/samples/svelte-element/_expected/client/index.svelte.js +++ b/packages/svelte/tests/snapshot/samples/svelte-element/_expected/client/index.svelte.js @@ -14,4 +14,4 @@ export default function Svelte_element($$anchor, $$props) { $.element(node, () => $.get(tag)); $.close_frag($$anchor, fragment); $.pop(); -} +} \ No newline at end of file diff --git a/packages/svelte/tests/snapshot/samples/svelte-element/_expected/server/index.svelte.js b/packages/svelte/tests/snapshot/samples/svelte-element/_expected/server/index.svelte.js index 6c4e6ee8b0..405a452271 100644 --- a/packages/svelte/tests/snapshot/samples/svelte-element/_expected/server/index.svelte.js +++ b/packages/svelte/tests/snapshot/samples/svelte-element/_expected/server/index.svelte.js @@ -24,4 +24,4 @@ export default function Svelte_element($$payload, $$props) { $$payload.out += `${anchor}`; $.bind_props($$props, { tag }); $.pop(); -} +} \ No newline at end of file