From aa6a5e9b07632edb35eedac7e77e39b36d6834c7 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sat, 15 Jun 2024 21:17:02 +0900 Subject: [PATCH 1/3] support latest runes --- src/parser/typescript/analyze/index.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/parser/typescript/analyze/index.ts b/src/parser/typescript/analyze/index.ts index 8ccbe08b..bb27f6f7 100644 --- a/src/parser/typescript/analyze/index.ts +++ b/src/parser/typescript/analyze/index.ts @@ -319,7 +319,7 @@ function analyzeRuneVariables( continue; } switch (globalName) { - // See https://github.com/sveltejs/svelte/blob/bda32edb1a4f2d383d96071750d6bfa9421b2175/packages/svelte/types/index.d.ts#L2585 + // See https://github.com/sveltejs/svelte/blob/ccb3c90cd57ca9d764efab317ed1cb8e5282926e/packages/svelte/types/index.d.ts#L2646 case "$state": { appendDeclareFunctionVirtualScripts(globalName, [ "(initial: T): T", @@ -332,9 +332,12 @@ function analyzeRuneVariables( appendDeclareNamespaceVirtualScripts(globalName, [ "export function snapshot(state: T): T;", ]); + appendDeclareNamespaceVirtualScripts(globalName, [ + "export function is(a: any, b: any): boolean;", + ]); break; } - // See https://github.com/sveltejs/svelte/blob/bda32edb1a4f2d383d96071750d6bfa9421b2175/packages/svelte/types/index.d.ts#L2648 + // See https://github.com/sveltejs/svelte/blob/ccb3c90cd57ca9d764efab317ed1cb8e5282926e/packages/svelte/types/index.d.ts#L2751 case "$derived": { appendDeclareFunctionVirtualScripts(globalName, [ "(expression: T): T", @@ -344,36 +347,36 @@ function analyzeRuneVariables( ]); break; } - // See https://github.com/sveltejs/svelte/blob/bda32edb1a4f2d383d96071750d6bfa9421b2175/packages/svelte/types/index.d.ts#L2687 + // See https://github.com/sveltejs/svelte/blob/ccb3c90cd57ca9d764efab317ed1cb8e5282926e/packages/svelte/types/index.d.ts#L2811 case "$effect": { appendDeclareFunctionVirtualScripts(globalName, [ "(fn: () => void | (() => void)): void", ]); appendDeclareNamespaceVirtualScripts(globalName, [ "export function pre(fn: () => void | (() => void)): void;", - "export function active(): boolean;", + "export function tracking(): boolean;", "export function root(fn: () => void | (() => void)): () => void;", ]); break; } - // See https://github.com/sveltejs/svelte/blob/bda32edb1a4f2d383d96071750d6bfa9421b2175/packages/svelte/types/index.d.ts#L2768 + // See https://github.com/sveltejs/svelte/blob/ccb3c90cd57ca9d764efab317ed1cb8e5282926e/packages/svelte/types/index.d.ts#L2913 case "$props": { appendDeclareFunctionVirtualScripts(globalName, ["(): any"]); break; } - // See https://github.com/sveltejs/svelte/blob/bda32edb1a4f2d383d96071750d6bfa9421b2175/packages/svelte/types/index.d.ts#L2779 + // See https://github.com/sveltejs/svelte/blob/ccb3c90cd57ca9d764efab317ed1cb8e5282926e/packages/svelte/types/index.d.ts#L2924 case "$bindable": { appendDeclareFunctionVirtualScripts(globalName, ["(t?: T): T"]); break; } - // See https://github.com/sveltejs/svelte/blob/bda32edb1a4f2d383d96071750d6bfa9421b2175/packages/svelte/types/index.d.ts#L2799 + // See https://github.com/sveltejs/svelte/blob/ccb3c90cd57ca9d764efab317ed1cb8e5282926e/packages/svelte/types/index.d.ts#L2944 case "$inspect": { appendDeclareFunctionVirtualScripts(globalName, [ `(...values: T): { with: (fn: (type: 'init' | 'update', ...values: T) => void) => void }`, ]); break; } - // See https://github.com/sveltejs/svelte/blob/bda32edb1a4f2d383d96071750d6bfa9421b2175/packages/svelte/types/index.d.ts#L2822 + // See https://github.com/sveltejs/svelte/blob/ccb3c90cd57ca9d764efab317ed1cb8e5282926e/packages/svelte/types/index.d.ts#L2967 case "$host": { appendDeclareFunctionVirtualScripts(globalName, [ `(): El`, From 9fe1a461528e31f25f864e47420725f616c48502 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sat, 15 Jun 2024 21:28:14 +0900 Subject: [PATCH 2/3] add tests --- .../svelte5/docs/runes/01-$state-input.svelte | 6 +- .../docs/runes/01-$state-is-input.svelte | 9 + .../docs/runes/01-$state-is-output.json | 1838 +++++++++++++++ .../01-$state-is-prefer-const-result.json | 14 + .../docs/runes/01-$state-is-scope-output.json | 1237 +++++++++++ .../svelte5/docs/runes/01-$state-output.json | 420 ++-- .../docs/runes/01-$state-scope-output.json | 192 +- ...input.svelte => 03-1-$effect-input.svelte} | 0 ...t-output.json => 03-1-$effect-output.json} | 0 ... => 03-1-$effect-prefer-const-result.json} | 0 ...ut.json => 03-1-$effect-scope-output.json} | 0 .../runes/03-2-$effect-tracking-input.svelte | 10 + .../runes/03-2-$effect-tracking-output.json | 1971 +++++++++++++++++ .../03-2-$effect-tracking-scope-output.json | 550 +++++ 14 files changed, 5956 insertions(+), 291 deletions(-) create mode 100644 tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-output.json create mode 100644 tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-prefer-const-result.json create mode 100644 tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-scope-output.json rename tests/fixtures/parser/ast/svelte5/docs/runes/{03-$effect-input.svelte => 03-1-$effect-input.svelte} (100%) rename tests/fixtures/parser/ast/svelte5/docs/runes/{03-$effect-output.json => 03-1-$effect-output.json} (100%) rename tests/fixtures/parser/ast/svelte5/docs/runes/{03-$effect-prefer-const-result.json => 03-1-$effect-prefer-const-result.json} (100%) rename tests/fixtures/parser/ast/svelte5/docs/runes/{03-$effect-scope-output.json => 03-1-$effect-scope-output.json} (100%) create mode 100644 tests/fixtures/parser/ast/svelte5/docs/runes/03-2-$effect-tracking-input.svelte create mode 100644 tests/fixtures/parser/ast/svelte5/docs/runes/03-2-$effect-tracking-output.json create mode 100644 tests/fixtures/parser/ast/svelte5/docs/runes/03-2-$effect-tracking-scope-output.json diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-input.svelte index 0b5ebf4a..85253a4e 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-input.svelte +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-input.svelte @@ -1,7 +1,7 @@ - diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-input.svelte new file mode 100644 index 00000000..8ccc292b --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-input.svelte @@ -0,0 +1,9 @@ + diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-output.json new file mode 100644 index 00000000..f9918482 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-output.json @@ -0,0 +1,1838 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ObjectExpression", + "properties": [], + "range": [ + 28, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 21, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "optional": false, + "range": [ + 21, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 15, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 11, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 45, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + "range": [ + 39, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 14 + } + } + } + ], + "range": [ + 35, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "foo", + "range": [ + 52, + 55 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 56, + 59 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "range": [ + 52, + 59 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "bar", + "range": [ + 62, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "range": [ + 52, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "range": [ + 52, + 66 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "BinaryExpression", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "foo", + "range": [ + 82, + 85 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 86, + 89 + ], + "loc": { + "start": { + "line": 7, + "column": 18 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "range": [ + 82, + 89 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "operator": "===", + "right": { + "type": "Identifier", + "name": "bar", + "range": [ + 94, + 97 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 29 + } + } + }, + "range": [ + 82, + 97 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 29 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 78, + 81 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + "range": [ + 70, + 81 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + "optional": false, + "range": [ + 70, + 98 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 30 + } + } + }, + "range": [ + 70, + 99 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 31 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "CallExpression", + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "foo", + "range": [ + 165, + 168 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 27 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "bar", + "range": [ + 169, + 172 + ], + "loc": { + "start": { + "line": 8, + "column": 28 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + "range": [ + 165, + 172 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + { + "type": "Identifier", + "name": "bar", + "range": [ + 174, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 33 + }, + "end": { + "line": 8, + "column": 36 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$state", + "range": [ + 155, + 161 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "is", + "range": [ + 162, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + "range": [ + 155, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + "optional": false, + "range": [ + 155, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 37 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 143, + 150 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 151, + 154 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 13 + } + } + }, + "range": [ + 143, + 154 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 13 + } + } + }, + "optional": false, + "range": [ + 143, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 38 + } + } + }, + "range": [ + 143, + 180 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 39 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 189, + 198 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "range": [ + 0, + 198 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " false — `foo.bar` is a reactive proxy", + "range": [ + 100, + 140 + ], + "loc": { + "start": { + "line": 7, + "column": 32 + }, + "end": { + "line": 7, + "column": 72 + } + } + }, + { + "type": "Line", + "value": " true", + "range": [ + 181, + 188 + ], + "loc": { + "start": { + "line": 8, + "column": 40 + }, + "end": { + "line": 8, + "column": 47 + } + } + } + ], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 21, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 52, + 55 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 56, + 59 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 62, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "log", + "range": [ + 78, + 81 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 82, + 85 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 86, + 89 + ], + "loc": { + "start": { + "line": 7, + "column": 18 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "===", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 7, + "column": 22 + }, + "end": { + "line": 7, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 94, + 97 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 7, + "column": 29 + }, + "end": { + "line": 7, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 7, + "column": 30 + }, + "end": { + "line": 7, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 143, + 150 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "log", + "range": [ + 151, + 154 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 155, + 161 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 161, + 162 + ], + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "is", + "range": [ + 162, + 164 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "foo", + "range": [ + 165, + 168 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 8, + "column": 27 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 169, + 172 + ], + "loc": { + "start": { + "line": 8, + "column": 28 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 172, + 173 + ], + "loc": { + "start": { + "line": 8, + "column": 31 + }, + "end": { + "line": 8, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "bar", + "range": [ + 174, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 33 + }, + "end": { + "line": 8, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 177, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 36 + }, + "end": { + "line": 8, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 37 + }, + "end": { + "line": 8, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 179, + 180 + ], + "loc": { + "start": { + "line": 8, + "column": 38 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 190, + 191 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 191, + 197 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 197, + 198 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + } + ], + "range": [ + 0, + 199 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 10, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-prefer-const-result.json b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-prefer-const-result.json new file mode 100644 index 00000000..d0ed5f12 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-prefer-const-result.json @@ -0,0 +1,14 @@ +[ + { + "ruleId": "prefer-const", + "code": "foo", + "line": 2, + "column": 7 + }, + { + "ruleId": "prefer-const", + "code": "bar", + "line": 3, + "column": 7 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-scope-output.json new file mode 100644 index 00000000..bb8cdf9f --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-is-scope-output.json @@ -0,0 +1,1237 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 21, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 155, + 161 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$bindable", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "foo", + "identifiers": [ + { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ObjectExpression", + "properties": [], + "range": [ + 28, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 21, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "optional": false, + "range": [ + 21, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 15, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "foo", + "range": [ + 52, + 55 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "foo", + "range": [ + 82, + 85 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "foo", + "range": [ + 165, + 168 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + } + } + ] + }, + { + "name": "bar", + "identifiers": [ + { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 45, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + "range": [ + 39, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 14 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "bar", + "range": [ + 62, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "bar", + "range": [ + 94, + 97 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 29 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "bar", + "range": [ + 174, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 33 + }, + "end": { + "line": 8, + "column": 36 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 21, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "foo", + "range": [ + 52, + 55 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "bar", + "range": [ + 62, + 65 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "foo", + "range": [ + 82, + 85 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "bar", + "range": [ + 94, + 97 + ], + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 29 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 143, + 150 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 155, + 161 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "foo", + "range": [ + 165, + 168 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "foo", + "range": [ + 15, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 9 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "bar", + "range": [ + 174, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 33 + }, + "end": { + "line": 8, + "column": 36 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "bar", + "range": [ + 39, + 42 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 9 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 21, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 143, + 150 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 155, + 161 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 70, + 77 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 143, + 150 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-output.json index cfba0680..8df3da8a 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-output.json @@ -51,17 +51,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -73,17 +73,17 @@ "raw": "0", "value": 0, "range": [ - 29, - 30 + 30, + 31 ], "loc": { "start": { "line": 2, - "column": 20 + "column": 21 }, "end": { "line": 2, - "column": 21 + "column": 22 } } } @@ -92,64 +92,64 @@ "type": "Identifier", "name": "$state", "range": [ - 22, - 28 + 23, + 29 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 19 + "column": 20 } } }, "optional": false, "range": [ - 22, - 31 + 23, + 32 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 22 + "column": 23 } } }, "range": [ - 14, - 31 + 15, + 32 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 22 + "column": 23 } } } ], "range": [ - 10, - 32 + 11, + 33 ], "loc": { "start": { "line": 2, - "column": 1 + "column": 2 }, "end": { "line": 2, - "column": 23 + "column": 24 } } } @@ -157,8 +157,8 @@ "endTag": { "type": "SvelteEndTag", "range": [ - 33, - 42 + 34, + 43 ], "loc": { "start": { @@ -173,7 +173,7 @@ }, "range": [ 0, - 42 + 43 ], "loc": { "start": { @@ -190,8 +190,8 @@ "type": "SvelteText", "value": "\n\n", "range": [ - 42, - 44 + 43, + 45 ], "loc": { "start": { @@ -211,8 +211,8 @@ "type": "SvelteName", "name": "button", "range": [ - 45, - 51 + 46, + 52 ], "loc": { "start": { @@ -237,8 +237,8 @@ "type": "SvelteName", "name": "click", "range": [ - 55, - 60 + 56, + 61 ], "loc": { "start": { @@ -253,8 +253,8 @@ }, "modifiers": [], "range": [ - 52, - 60 + 53, + 61 ], "loc": { "start": { @@ -276,34 +276,34 @@ "type": "Identifier", "name": "count", "range": [ - 68, - 73 + 70, + 75 ], "loc": { "start": { "line": 5, - "column": 24 + "column": 25 }, "end": { "line": 5, - "column": 29 + "column": 30 } } }, "operator": "++", "prefix": false, "range": [ - 68, - 75 + 70, + 77 ], "loc": { "start": { "line": 5, - "column": 24 + "column": 25 }, "end": { "line": 5, - "column": 31 + "column": 32 } } }, @@ -312,23 +312,23 @@ "id": null, "params": [], "range": [ - 62, - 75 + 64, + 77 ], "loc": { "start": { "line": 5, - "column": 18 + "column": 19 }, "end": { "line": 5, - "column": 31 + "column": 32 } } }, "range": [ - 52, - 76 + 53, + 79 ], "loc": { "start": { @@ -337,15 +337,15 @@ }, "end": { "line": 5, - "column": 32 + "column": 34 } } } ], "selfClosing": false, "range": [ - 44, - 77 + 45, + 80 ], "loc": { "start": { @@ -354,26 +354,26 @@ }, "end": { "line": 5, - "column": 33 + "column": 35 } } }, "children": [ { "type": "SvelteText", - "value": "\n\tclicks: ", + "value": "\n clicks: ", "range": [ - 77, - 87 + 80, + 91 ], "loc": { "start": { "line": 5, - "column": 33 + "column": 35 }, "end": { "line": 6, - "column": 9 + "column": 10 } } }, @@ -384,32 +384,32 @@ "type": "Identifier", "name": "count", "range": [ - 88, - 93 + 92, + 97 ], "loc": { "start": { "line": 6, - "column": 10 + "column": 11 }, "end": { "line": 6, - "column": 15 + "column": 16 } } }, "range": [ - 87, - 94 + 91, + 98 ], "loc": { "start": { "line": 6, - "column": 9 + "column": 10 }, "end": { "line": 6, - "column": 16 + "column": 17 } } }, @@ -417,13 +417,13 @@ "type": "SvelteText", "value": "\n", "range": [ - 94, - 95 + 98, + 99 ], "loc": { "start": { "line": 6, - "column": 16 + "column": 17 }, "end": { "line": 7, @@ -435,8 +435,8 @@ "endTag": { "type": "SvelteEndTag", "range": [ - 95, - 104 + 99, + 108 ], "loc": { "start": { @@ -450,8 +450,8 @@ } }, "range": [ - 44, - 104 + 45, + 108 ], "loc": { "start": { @@ -526,17 +526,17 @@ "type": "Keyword", "value": "let", "range": [ - 10, - 13 + 11, + 14 ], "loc": { "start": { "line": 2, - "column": 1 + "column": 2 }, "end": { "line": 2, - "column": 4 + "column": 5 } } }, @@ -544,17 +544,17 @@ "type": "Identifier", "value": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -562,17 +562,17 @@ "type": "Punctuator", "value": "=", "range": [ - 20, - 21 + 21, + 22 ], "loc": { "start": { "line": 2, - "column": 11 + "column": 12 }, "end": { "line": 2, - "column": 12 + "column": 13 } } }, @@ -580,17 +580,17 @@ "type": "Identifier", "value": "$state", "range": [ - 22, - 28 + 23, + 29 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 19 + "column": 20 } } }, @@ -598,17 +598,17 @@ "type": "Punctuator", "value": "(", "range": [ - 28, - 29 + 29, + 30 ], "loc": { "start": { "line": 2, - "column": 19 + "column": 20 }, "end": { "line": 2, - "column": 20 + "column": 21 } } }, @@ -616,17 +616,17 @@ "type": "Numeric", "value": "0", "range": [ - 29, - 30 + 30, + 31 ], "loc": { "start": { "line": 2, - "column": 20 + "column": 21 }, "end": { "line": 2, - "column": 21 + "column": 22 } } }, @@ -634,17 +634,17 @@ "type": "Punctuator", "value": ")", "range": [ - 30, - 31 + 31, + 32 ], "loc": { "start": { "line": 2, - "column": 21 + "column": 22 }, "end": { "line": 2, - "column": 22 + "column": 23 } } }, @@ -652,17 +652,17 @@ "type": "Punctuator", "value": ";", "range": [ - 31, - 32 + 32, + 33 ], "loc": { "start": { "line": 2, - "column": 22 + "column": 23 }, "end": { "line": 2, - "column": 23 + "column": 24 } } }, @@ -670,8 +670,8 @@ "type": "Punctuator", "value": "<", "range": [ - 33, - 34 + 34, + 35 ], "loc": { "start": { @@ -688,8 +688,8 @@ "type": "Punctuator", "value": "/", "range": [ - 34, - 35 + 35, + 36 ], "loc": { "start": { @@ -706,8 +706,8 @@ "type": "HTMLIdentifier", "value": "script", "range": [ - 35, - 41 + 36, + 42 ], "loc": { "start": { @@ -724,8 +724,8 @@ "type": "Punctuator", "value": ">", "range": [ - 41, - 42 + 42, + 43 ], "loc": { "start": { @@ -742,8 +742,8 @@ "type": "HTMLText", "value": "\n\n", "range": [ - 42, - 44 + 43, + 45 ], "loc": { "start": { @@ -760,8 +760,8 @@ "type": "Punctuator", "value": "<", "range": [ - 44, - 45 + 45, + 46 ], "loc": { "start": { @@ -778,8 +778,8 @@ "type": "HTMLIdentifier", "value": "button", "range": [ - 45, - 51 + 46, + 52 ], "loc": { "start": { @@ -796,8 +796,8 @@ "type": "HTMLIdentifier", "value": "on", "range": [ - 52, - 54 + 53, + 55 ], "loc": { "start": { @@ -814,8 +814,8 @@ "type": "Punctuator", "value": ":", "range": [ - 54, - 55 + 55, + 56 ], "loc": { "start": { @@ -832,8 +832,8 @@ "type": "HTMLIdentifier", "value": "click", "range": [ - 55, - 60 + 56, + 61 ], "loc": { "start": { @@ -850,8 +850,8 @@ "type": "Punctuator", "value": "=", "range": [ - 60, - 61 + 61, + 62 ], "loc": { "start": { @@ -866,10 +866,10 @@ }, { "type": "Punctuator", - "value": "{", + "value": "\"", "range": [ - 61, - 62 + 62, + 63 ], "loc": { "start": { @@ -884,10 +884,10 @@ }, { "type": "Punctuator", - "value": "(", + "value": "{", "range": [ - 62, - 63 + 63, + 64 ], "loc": { "start": { @@ -902,10 +902,10 @@ }, { "type": "Punctuator", - "value": ")", + "value": "(", "range": [ - 63, - 64 + 64, + 65 ], "loc": { "start": { @@ -920,19 +920,37 @@ }, { "type": "Punctuator", - "value": "=>", + "value": ")", "range": [ 65, - 67 + 66 ], "loc": { "start": { + "line": 5, + "column": 20 + }, + "end": { "line": 5, "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 67, + 69 + ], + "loc": { + "start": { + "line": 5, + "column": 22 }, "end": { "line": 5, - "column": 23 + "column": 24 } } }, @@ -940,17 +958,17 @@ "type": "Identifier", "value": "count", "range": [ - 68, - 73 + 70, + 75 ], "loc": { "start": { "line": 5, - "column": 24 + "column": 25 }, "end": { "line": 5, - "column": 29 + "column": 30 } } }, @@ -958,17 +976,17 @@ "type": "Punctuator", "value": "++", "range": [ - 73, - 75 + 75, + 77 ], "loc": { "start": { "line": 5, - "column": 29 + "column": 30 }, "end": { "line": 5, - "column": 31 + "column": 32 } } }, @@ -976,17 +994,35 @@ "type": "Punctuator", "value": "}", "range": [ - 75, - 76 + 77, + 78 ], "loc": { "start": { "line": 5, - "column": 31 + "column": 32 }, "end": { "line": 5, - "column": 32 + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 5, + "column": 33 + }, + "end": { + "line": 5, + "column": 34 } } }, @@ -994,35 +1030,35 @@ "type": "Punctuator", "value": ">", "range": [ - 76, - 77 + 79, + 80 ], "loc": { "start": { "line": 5, - "column": 32 + "column": 34 }, "end": { "line": 5, - "column": 33 + "column": 35 } } }, { "type": "HTMLText", - "value": "\n\t", + "value": "\n ", "range": [ - 77, - 79 + 80, + 83 ], "loc": { "start": { "line": 5, - "column": 33 + "column": 35 }, "end": { "line": 6, - "column": 1 + "column": 2 } } }, @@ -1030,17 +1066,17 @@ "type": "HTMLText", "value": "clicks:", "range": [ - 79, - 86 + 83, + 90 ], "loc": { "start": { "line": 6, - "column": 1 + "column": 2 }, "end": { "line": 6, - "column": 8 + "column": 9 } } }, @@ -1048,17 +1084,17 @@ "type": "HTMLText", "value": " ", "range": [ - 86, - 87 + 90, + 91 ], "loc": { "start": { "line": 6, - "column": 8 + "column": 9 }, "end": { "line": 6, - "column": 9 + "column": 10 } } }, @@ -1066,17 +1102,17 @@ "type": "Punctuator", "value": "{", "range": [ - 87, - 88 + 91, + 92 ], "loc": { "start": { "line": 6, - "column": 9 + "column": 10 }, "end": { "line": 6, - "column": 10 + "column": 11 } } }, @@ -1084,17 +1120,17 @@ "type": "Identifier", "value": "count", "range": [ - 88, - 93 + 92, + 97 ], "loc": { "start": { "line": 6, - "column": 10 + "column": 11 }, "end": { "line": 6, - "column": 15 + "column": 16 } } }, @@ -1102,17 +1138,17 @@ "type": "Punctuator", "value": "}", "range": [ - 93, - 94 + 97, + 98 ], "loc": { "start": { "line": 6, - "column": 15 + "column": 16 }, "end": { "line": 6, - "column": 16 + "column": 17 } } }, @@ -1120,13 +1156,13 @@ "type": "HTMLText", "value": "\n", "range": [ - 94, - 95 + 98, + 99 ], "loc": { "start": { "line": 6, - "column": 16 + "column": 17 }, "end": { "line": 7, @@ -1138,8 +1174,8 @@ "type": "Punctuator", "value": "<", "range": [ - 95, - 96 + 99, + 100 ], "loc": { "start": { @@ -1156,8 +1192,8 @@ "type": "Punctuator", "value": "/", "range": [ - 96, - 97 + 100, + 101 ], "loc": { "start": { @@ -1174,8 +1210,8 @@ "type": "HTMLIdentifier", "value": "button", "range": [ - 97, - 103 + 101, + 107 ], "loc": { "start": { @@ -1192,8 +1228,8 @@ "type": "Punctuator", "value": ">", "range": [ - 103, - 104 + 107, + 108 ], "loc": { "start": { @@ -1209,7 +1245,7 @@ ], "range": [ 0, - 105 + 109 ], "loc": { "start": { diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-scope-output.json index 993e5812..144789e3 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/01-$state-scope-output.json @@ -29,17 +29,17 @@ "type": "Identifier", "name": "$state", "range": [ - 22, - 28 + 23, + 29 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 19 + "column": 20 } } }, @@ -98,17 +98,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -120,17 +120,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -140,17 +140,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -162,17 +162,17 @@ "raw": "0", "value": 0, "range": [ - 29, - 30 + 30, + 31 ], "loc": { "start": { "line": 2, - "column": 20 + "column": 21 }, "end": { "line": 2, - "column": 21 + "column": 22 } } } @@ -181,48 +181,48 @@ "type": "Identifier", "name": "$state", "range": [ - 22, - 28 + 23, + 29 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 19 + "column": 20 } } }, "optional": false, "range": [ - 22, - 31 + 23, + 32 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 22 + "column": 23 } } }, "range": [ - 14, - 31 + 15, + 32 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 22 + "column": 23 } } } @@ -234,17 +234,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -254,17 +254,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -274,17 +274,17 @@ "type": "Identifier", "name": "count", "range": [ - 68, - 73 + 70, + 75 ], "loc": { "start": { "line": 5, - "column": 24 + "column": 25 }, "end": { "line": 5, - "column": 29 + "column": 30 } } }, @@ -294,17 +294,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -314,17 +314,17 @@ "type": "Identifier", "name": "count", "range": [ - 88, - 93 + 92, + 97 ], "loc": { "start": { "line": 6, - "column": 10 + "column": 11 }, "end": { "line": 6, - "column": 15 + "column": 16 } } }, @@ -334,17 +334,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -358,17 +358,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -378,17 +378,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -398,17 +398,17 @@ "type": "Identifier", "name": "$state", "range": [ - 22, - 28 + 23, + 29 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 19 + "column": 20 } } }, @@ -421,17 +421,17 @@ "type": "Identifier", "name": "count", "range": [ - 88, - 93 + 92, + 97 ], "loc": { "start": { "line": 6, - "column": 10 + "column": 11 }, "end": { "line": 6, - "column": 15 + "column": 16 } } }, @@ -441,17 +441,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -467,17 +467,17 @@ "type": "Identifier", "name": "count", "range": [ - 68, - 73 + 70, + 75 ], "loc": { "start": { "line": 5, - "column": 24 + "column": 25 }, "end": { "line": 5, - "column": 29 + "column": 30 } } }, @@ -487,17 +487,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -510,17 +510,17 @@ "type": "Identifier", "name": "count", "range": [ - 68, - 73 + 70, + 75 ], "loc": { "start": { "line": 5, - "column": 24 + "column": 25 }, "end": { "line": 5, - "column": 29 + "column": 30 } } }, @@ -530,17 +530,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -554,17 +554,17 @@ "type": "Identifier", "name": "$state", "range": [ - 22, - 28 + 23, + 29 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 19 + "column": 20 } } }, diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/03-1-$effect-input.svelte similarity index 100% rename from tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-input.svelte rename to tests/fixtures/parser/ast/svelte5/docs/runes/03-1-$effect-input.svelte diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/03-1-$effect-output.json similarity index 100% rename from tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-output.json rename to tests/fixtures/parser/ast/svelte5/docs/runes/03-1-$effect-output.json diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-prefer-const-result.json b/tests/fixtures/parser/ast/svelte5/docs/runes/03-1-$effect-prefer-const-result.json similarity index 100% rename from tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-prefer-const-result.json rename to tests/fixtures/parser/ast/svelte5/docs/runes/03-1-$effect-prefer-const-result.json diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/03-1-$effect-scope-output.json similarity index 100% rename from tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-scope-output.json rename to tests/fixtures/parser/ast/svelte5/docs/runes/03-1-$effect-scope-output.json diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/03-2-$effect-tracking-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/03-2-$effect-tracking-input.svelte new file mode 100644 index 00000000..c869e4cb --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/03-2-$effect-tracking-input.svelte @@ -0,0 +1,10 @@ + + +

in template: {$effect.tracking()}

+ diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/03-2-$effect-tracking-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/03-2-$effect-tracking-output.json new file mode 100644 index 00000000..d8a5d90b --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/03-2-$effect-tracking-output.json @@ -0,0 +1,1971 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteScriptElement", + "name": { + "type": "SvelteName", + "name": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "\"in component setup:\"", + "value": "in component setup:", + "range": [ + 23, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$effect", + "range": [ + 46, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "tracking", + "range": [ + 54, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 45 + }, + "end": { + "line": 2, + "column": 53 + } + } + }, + "range": [ + 46, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 53 + } + } + }, + "optional": false, + "range": [ + 46, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 55 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 11, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "range": [ + 11, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "optional": false, + "range": [ + 11, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 56 + } + } + }, + "range": [ + 11, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 57 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "\"in effect:\"", + "value": "in effect:", + "range": [ + 111, + 123 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$effect", + "range": [ + 125, + 132 + ], + "loc": { + "start": { + "line": 5, + "column": 30 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "tracking", + "range": [ + 133, + 141 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 46 + } + } + }, + "range": [ + 125, + 141 + ], + "loc": { + "start": { + "line": 5, + "column": 30 + }, + "end": { + "line": 5, + "column": 46 + } + } + }, + "optional": false, + "range": [ + 125, + 143 + ], + "loc": { + "start": { + "line": 5, + "column": 30 + }, + "end": { + "line": 5, + "column": 48 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 99, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 107, + 110 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "range": [ + 99, + 110 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "optional": false, + "range": [ + 99, + 144 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 49 + } + } + }, + "range": [ + 99, + 145 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 50 + } + } + } + ], + "range": [ + 93, + 157 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 87, + 157 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$effect", + "range": [ + 79, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "optional": false, + "range": [ + 79, + 158 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 6, + "column": 4 + } + } + }, + "range": [ + 79, + 159 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 6, + "column": 5 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 160, + 169 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + "range": [ + 0, + 169 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 169, + 171 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "p", + "range": [ + 172, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 171, + 174 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "in template: ", + "range": [ + 174, + 187 + ], + "loc": { + "start": { + "line": 9, + "column": 3 + }, + "end": { + "line": 9, + "column": 16 + } + } + }, + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$effect", + "range": [ + 188, + 195 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 24 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "tracking", + "range": [ + 196, + 204 + ], + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 9, + "column": 33 + } + } + }, + "range": [ + 188, + 204 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 33 + } + } + }, + "optional": false, + "range": [ + 188, + 206 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 35 + } + } + }, + "range": [ + 187, + 207 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 36 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 207, + 211 + ], + "loc": { + "start": { + "line": 9, + "column": 36 + }, + "end": { + "line": 9, + "column": 40 + } + } + }, + "range": [ + 171, + 211 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 40 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 9, + "column": 40 + }, + "end": { + "line": 10, + "column": 0 + } + } + }, + { + "type": "SvelteHTMLComment", + "value": " true ", + "range": [ + 212, + 225 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 13 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " false", + "range": [ + 67, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 58 + }, + "end": { + "line": 2, + "column": 66 + } + } + }, + { + "type": "Line", + "value": " true", + "range": [ + 146, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 51 + }, + "end": { + "line": 5, + "column": 58 + } + } + } + ], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 11, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 18, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "log", + "range": [ + 19, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "String", + "value": "\"in component setup:\"", + "range": [ + 23, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "Identifier", + "value": "$effect", + "range": [ + 46, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + { + "type": "Identifier", + "value": "tracking", + "range": [ + 54, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 45 + }, + "end": { + "line": 2, + "column": 53 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 53 + }, + "end": { + "line": 2, + "column": 54 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 54 + }, + "end": { + "line": 2, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 55 + }, + "end": { + "line": 2, + "column": 56 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 56 + }, + "end": { + "line": 2, + "column": 57 + } + } + }, + { + "type": "Identifier", + "value": "$effect", + "range": [ + 79, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 90, + 92 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 99, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "log", + "range": [ + 107, + 110 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "String", + "value": "\"in effect:\"", + "range": [ + 111, + 123 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "$effect", + "range": [ + 125, + 132 + ], + "loc": { + "start": { + "line": 5, + "column": 30 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 132, + 133 + ], + "loc": { + "start": { + "line": 5, + "column": 37 + }, + "end": { + "line": 5, + "column": 38 + } + } + }, + { + "type": "Identifier", + "value": "tracking", + "range": [ + 133, + 141 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 141, + 142 + ], + "loc": { + "start": { + "line": 5, + "column": 46 + }, + "end": { + "line": 5, + "column": 47 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 142, + 143 + ], + "loc": { + "start": { + "line": 5, + "column": 47 + }, + "end": { + "line": 5, + "column": 48 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 5, + "column": 48 + }, + "end": { + "line": 5, + "column": 49 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 144, + 145 + ], + "loc": { + "start": { + "line": 5, + "column": 49 + }, + "end": { + "line": 5, + "column": 50 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 157, + 158 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 158, + 159 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 160, + 161 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 161, + 162 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 162, + 168 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 169, + 171 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 171, + 172 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 172, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 173, + 174 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": "HTMLText", + "value": "in", + "range": [ + 174, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 3 + }, + "end": { + "line": 9, + "column": 5 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 9, + "column": 5 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + { + "type": "HTMLText", + "value": "template:", + "range": [ + 177, + 186 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 186, + 187 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 187, + 188 + ], + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "$effect", + "range": [ + 188, + 195 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 9, + "column": 24 + }, + "end": { + "line": 9, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "tracking", + "range": [ + 196, + 204 + ], + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 9, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 9, + "column": 33 + }, + "end": { + "line": 9, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 9, + "column": 34 + }, + "end": { + "line": 9, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 206, + 207 + ], + "loc": { + "start": { + "line": 9, + "column": 35 + }, + "end": { + "line": 9, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 207, + 208 + ], + "loc": { + "start": { + "line": 9, + "column": 36 + }, + "end": { + "line": 9, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 208, + 209 + ], + "loc": { + "start": { + "line": 9, + "column": 37 + }, + "end": { + "line": 9, + "column": 38 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "p", + "range": [ + 209, + 210 + ], + "loc": { + "start": { + "line": 9, + "column": 38 + }, + "end": { + "line": 9, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 9, + "column": 39 + }, + "end": { + "line": 9, + "column": 40 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 9, + "column": 40 + }, + "end": { + "line": 10, + "column": 0 + } + } + }, + { + "type": "HTMLComment", + "value": "", + "range": [ + 212, + 225 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 13 + } + } + } + ], + "range": [ + 0, + 226 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 11, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/03-2-$effect-tracking-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/03-2-$effect-tracking-scope-output.json new file mode 100644 index 00000000..f11eee4b --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/03-2-$effect-tracking-scope-output.json @@ -0,0 +1,550 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 46, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 79, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 125, + 132 + ], + "loc": { + "start": { + "line": 5, + "column": 30 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 188, + 195 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$bindable", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 11, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 46, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 79, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 188, + 195 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 99, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 125, + 132 + ], + "loc": { + "start": { + "line": 5, + "column": 30 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 99, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 125, + 132 + ], + "loc": { + "start": { + "line": 5, + "column": 30 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 11, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 46, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 79, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 99, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 125, + 132 + ], + "loc": { + "start": { + "line": 5, + "column": 30 + }, + "end": { + "line": 5, + "column": 37 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 188, + 195 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 11, + 18 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 99, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file From 2132edb6f533fbcaaa9957a15e6fd564eafa3c96 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sat, 15 Jun 2024 21:29:54 +0900 Subject: [PATCH 3/3] add changeset --- .changeset/polite-ears-move.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/polite-ears-move.md diff --git a/.changeset/polite-ears-move.md b/.changeset/polite-ears-move.md new file mode 100644 index 00000000..740095e3 --- /dev/null +++ b/.changeset/polite-ears-move.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": minor +--- + +feat: support Svelte 5.0.0-next.155. (Add `$state.is` and replace `$effect.active` with `$effect.tracking`)