diff --git a/.changeset/twenty-cats-shave.md b/.changeset/twenty-cats-shave.md new file mode 100644 index 00000000..70c42c69 --- /dev/null +++ b/.changeset/twenty-cats-shave.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": minor +--- + +feat: add support for `$inspect` and `$effect.root` diff --git a/explorer-v2/package.json b/explorer-v2/package.json index 6ebb779a..befd76f5 100644 --- a/explorer-v2/package.json +++ b/explorer-v2/package.json @@ -18,7 +18,7 @@ "eslint-scope": "^7.2.2", "esquery": "^1.5.0", "pako": "^2.1.0", - "svelte": "^5.0.0-next.10", + "svelte": "^5.0.0-next.17", "svelte-eslint-parser": "link:..", "tslib": "^2.6.2" }, diff --git a/package.json b/package.json index 9ced3996..c289f557 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "version:ci": "env-cmd -e version-ci pnpm run build:meta && changeset version" }, "peerDependencies": { - "svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.10" + "svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.17" }, "peerDependenciesMeta": { "svelte": { @@ -104,7 +104,7 @@ "prettier-plugin-svelte": "^3.0.0", "rimraf": "^5.0.1", "semver": "^7.5.1", - "svelte": "^5.0.0-next.10", + "svelte": "^5.0.0-next.17", "svelte2tsx": "^0.6.25", "typescript": "~5.1.3", "typescript-eslint-parser-for-extra-files": "^0.5.0" diff --git a/src/parser/globals.ts b/src/parser/globals.ts index aa3a2ea6..e1e528ad 100644 --- a/src/parser/globals.ts +++ b/src/parser/globals.ts @@ -6,6 +6,7 @@ export const globalsForRunes = [ "$derived", "$effect", "$props", + "$inspect", ] as const; const globalsForSvelte5 = [...globalsForSvelte4, ...globalsForRunes]; export const globals = svelteVersion.gte(5) diff --git a/src/parser/typescript/analyze/index.ts b/src/parser/typescript/analyze/index.ts index ed9fe303..6db90a46 100644 --- a/src/parser/typescript/analyze/index.ts +++ b/src/parser/typescript/analyze/index.ts @@ -256,6 +256,7 @@ function analyzeDollarDollarVariables( case "$derived": case "$effect": case "$props": + case "$inspect": // Processed by `analyzeRuneVariables`. break; default: { @@ -332,6 +333,7 @@ function analyzeRuneVariables( appendDeclareNamespaceVirtualScripts(globalName, [ "export function pre(fn: () => void | (() => void)): void;", "export function active(): boolean;", + "export function root(fn: () => void | (() => void)): () => void;", ]); break; } @@ -339,6 +341,12 @@ function analyzeRuneVariables( appendDeclareFunctionVirtualScripts(globalName, ["(): T"]); break; } + case "$inspect": { + appendDeclareFunctionVirtualScripts(globalName, [ + `(value: T, callback?: (value: T, type: 'init' | 'update') => void): void`, + ]); + break; + } default: { const _: never = globalName; throw Error(`Unknown global: ${_}`); diff --git a/tests/fixtures/parser/ast/$$slots-scope-output-svelte5.json b/tests/fixtures/parser/ast/$$slots-scope-output-svelte5.json index 77384a87..d9f29c65 100644 --- a/tests/fixtures/parser/ast/$$slots-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/$$slots-scope-output-svelte5.json @@ -65,6 +65,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/10-scope-output-svelte5.json b/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/10-scope-output-svelte5.json index d12c3a83..131c8df6 100644 --- a/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/10-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/10-scope-output-svelte5.json @@ -65,6 +65,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/11-scope-output-svelte5.json b/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/11-scope-output-svelte5.json index f5fdeda0..dcfd31e2 100644 --- a/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/11-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/docs/template-syntax/02-attributes-and-props/11-scope-output-svelte5.json @@ -65,6 +65,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/docs/template-syntax/13-slot/02-$$slots/01-scope-output-svelte5.json b/tests/fixtures/parser/ast/docs/template-syntax/13-slot/02-$$slots/01-scope-output-svelte5.json index 2f75bbb3..a19fa7b6 100644 --- a/tests/fixtures/parser/ast/docs/template-syntax/13-slot/02-$$slots/01-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/docs/template-syntax/13-slot/02-$$slots/01-scope-output-svelte5.json @@ -65,6 +65,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/fine-grained-reactivity/example01-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/fine-grained-reactivity/example01-scope-output.json index 7dd00c92..99ddfa91 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/fine-grained-reactivity/example01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/fine-grained-reactivity/example01-scope-output.json @@ -112,6 +112,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/functions/01-untrack-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/functions/01-untrack-scope-output.json index 7b0c1e2a..f10dd254 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/functions/01-untrack-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/functions/01-untrack-scope-output.json @@ -90,6 +90,12 @@ "resolved": null } ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/01-counter-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/01-counter-scope-output.json index cf2097bb..060bdff2 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/01-counter-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/01-counter-scope-output.json @@ -114,6 +114,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/02-tracking-dependencies-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/02-tracking-dependencies-scope-output.json index 9e59b1ee..3bb3ec4d 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/02-tracking-dependencies-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/02-tracking-dependencies-scope-output.json @@ -113,6 +113,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/03-untracking-dependencies-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/03-untracking-dependencies-scope-output.json index 35f01e12..2922ca84 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/03-untracking-dependencies-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/03-untracking-dependencies-scope-output.json @@ -113,6 +113,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/04-simple-component-props-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/04-simple-component-props-scope-output.json index 0cde141e..1e3331d4 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/04-simple-component-props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/04-simple-component-props-scope-output.json @@ -66,6 +66,12 @@ "resolved": null } ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/05-advanced-component-props-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/05-advanced-component-props-scope-output.json index aeae4efe..14b15863 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/05-advanced-component-props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/05-advanced-component-props-scope-output.json @@ -66,6 +66,12 @@ "resolved": null } ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/06-autoscroll-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/06-autoscroll-scope-output.json index be2b1ddf..f04a915b 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/06-autoscroll-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/old-vs-new/06-autoscroll-scope-output.json @@ -113,6 +113,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], 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 49fb45fa..79e0b079 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 @@ -66,6 +66,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/02-$derived-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/02-$derived-scope-output.json index d0aede02..bbbdf563 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/02-$derived-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/02-$derived-scope-output.json @@ -90,6 +90,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-scope-output.json index 683ea63d..956a1a7e 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/03-$effect-scope-output.json @@ -114,6 +114,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pre-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pre-scope-output.json index ab3d910e..4ab6c27f 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pre-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/04-$effect-pre-scope-output.json @@ -66,6 +66,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/05-$props-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/05-$props-scope-output.json index 6a56a722..e90d6d99 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/05-$props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/05-$props-scope-output.json @@ -66,6 +66,12 @@ "resolved": null } ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/06-$props-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/06-$props-scope-output.json index 2b5aa6ea..fd59558c 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/06-$props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/06-$props-scope-output.json @@ -66,6 +66,12 @@ "resolved": null } ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/07-$props-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/07-$props-scope-output.json index 308e284e..237784fc 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/07-$props-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/07-$props-scope-output.json @@ -66,6 +66,12 @@ "resolved": null } ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/08-$props-ts-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/08-$props-ts-scope-output.json index e81f27c0..71013d2e 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/08-$props-ts-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/08-$props-ts-scope-output.json @@ -66,6 +66,12 @@ "resolved": null } ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/09-how-to-opt-in-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/09-how-to-opt-in-scope-output.json index fbcac79c..2c234aed 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/09-how-to-opt-in-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/09-how-to-opt-in-scope-output.json @@ -42,6 +42,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-input.svelte new file mode 100644 index 00000000..8883f1cb --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-input.svelte @@ -0,0 +1,13 @@ + diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-no-unused-vars-result.json new file mode 100644 index 00000000..3a6dce3f --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-no-unused-vars-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "cleanup", + "line": 4, + "column": 8 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-output.json new file mode 100644 index 00000000..fd12cd28 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-output.json @@ -0,0 +1,1816 @@ +{ + "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": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 10, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "const", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "cleanup", + "range": [ + 41, + 48 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 20 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 93, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 101, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "range": [ + 93, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "optional": false, + "range": [ + 93, + 111 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "range": [ + 93, + 112 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 22 + } + } + } + ], + "range": [ + 88, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 82, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 7, + "column": 3 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$effect", + "range": [ + 74, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "optional": false, + "range": [ + 74, + 117 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 7, + "column": 4 + } + } + }, + "range": [ + 74, + 118 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "'effect root cleanup'", + "value": "effect root cleanup", + "range": [ + 152, + 173 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 36 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 140, + 147 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 148, + 151 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + "range": [ + 140, + 151 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + "optional": false, + "range": [ + 140, + 174 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 37 + } + } + }, + "range": [ + 140, + 175 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 38 + } + } + } + ], + "range": [ + 135, + 179 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 129, + 179 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "range": [ + 122, + 180 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 11, + "column": 4 + } + } + } + ], + "range": [ + 70, + 183 + ], + "loc": { + "start": { + "line": 4, + "column": 36 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 64, + 183 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 12, + "column": 2 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$effect", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 29 + } + } + }, + "range": [ + 51, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 29 + } + } + }, + "optional": false, + "range": [ + 51, + 184 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + "range": [ + 41, + 184 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ], + "range": [ + 35, + 185 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 12, + "column": 4 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 186, + 195 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + "range": [ + 0, + 195 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 13, + "column": 9 + } + } + } + ], + "sourceType": "module", + "comments": [], + "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": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "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": "const", + "range": [ + 35, + 40 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "cleanup", + "range": [ + 41, + 48 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "$effect", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "root", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 67, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 36 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + { + "type": "Identifier", + "value": "$effect", + "range": [ + 74, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 85, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 93, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "log", + "range": [ + 101, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 110, + 111 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 111, + 112 + ], + "loc": { + "start": { + "line": 6, + "column": 21 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 115, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 7, + "column": 3 + }, + "end": { + "line": 7, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": "Keyword", + "value": "return", + "range": [ + 122, + 128 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 129, + 130 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 130, + 131 + ], + "loc": { + "start": { + "line": 9, + "column": 10 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 132, + 134 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 140, + 147 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 10, + "column": 10 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "log", + "range": [ + 148, + 151 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 151, + 152 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + { + "type": "String", + "value": "'effect root cleanup'", + "range": [ + 152, + 173 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 173, + 174 + ], + "loc": { + "start": { + "line": 10, + "column": 36 + }, + "end": { + "line": 10, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 10, + "column": 37 + }, + "end": { + "line": 10, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 179, + 180 + ], + "loc": { + "start": { + "line": 11, + "column": 3 + }, + "end": { + "line": 11, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 184, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 186, + 187 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 187, + 188 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 188, + 194 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 9 + } + } + } + ], + "range": [ + 0, + 196 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 14, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-prefer-const-result.json b/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-prefer-const-result.json new file mode 100644 index 00000000..fea40c52 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "count", + "line": 2, + "column": 6 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-scope-output.json new file mode 100644 index 00000000..7db04369 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/10-$effect-root-scope-output.json @@ -0,0 +1,1593 @@ +{ + "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": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 74, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + }, + { + "name": "cleanup", + "identifiers": [ + { + "type": "Identifier", + "name": "cleanup", + "range": [ + 41, + 48 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 14 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "cleanup", + "range": [ + 41, + 48 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "cleanup", + "range": [ + 41, + 48 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 20 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 93, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 101, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "range": [ + 93, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "optional": false, + "range": [ + 93, + 111 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "range": [ + 93, + 112 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 22 + } + } + } + ], + "range": [ + 88, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 82, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 7, + "column": 3 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$effect", + "range": [ + 74, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "optional": false, + "range": [ + 74, + 117 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 7, + "column": 4 + } + } + }, + "range": [ + 74, + 118 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "'effect root cleanup'", + "value": "effect root cleanup", + "range": [ + 152, + 173 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 36 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 140, + 147 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "log", + "range": [ + 148, + 151 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + "range": [ + 140, + 151 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + "optional": false, + "range": [ + 140, + 174 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 37 + } + } + }, + "range": [ + 140, + 175 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 38 + } + } + } + ], + "range": [ + 135, + 179 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 129, + 179 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "range": [ + 122, + 180 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 11, + "column": 4 + } + } + } + ], + "range": [ + 70, + 183 + ], + "loc": { + "start": { + "line": 4, + "column": 36 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 64, + 183 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 12, + "column": 2 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "$effect", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 29 + } + } + }, + "range": [ + 51, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 29 + } + } + }, + "optional": false, + "range": [ + 51, + 184 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + "range": [ + 41, + 184 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "cleanup", + "range": [ + 41, + 48 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "cleanup", + "range": [ + 41, + 48 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 14 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "cleanup", + "range": [ + 41, + 48 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "cleanup", + "range": [ + 41, + 48 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 14 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 74, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 93, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 93, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + }, + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 140, + 147 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 140, + 147 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 74, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 93, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 140, + 147 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$effect", + "range": [ + 74, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 93, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 140, + 147 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 93, + 100 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 140, + 147 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-$inspect-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/11-$inspect-input.svelte new file mode 100644 index 00000000..47e37b86 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-$inspect-input.svelte @@ -0,0 +1,9 @@ + + + + diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-$inspect-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-$inspect-output.json new file mode 100644 index 00000000..423edefd --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-$inspect-output.json @@ -0,0 +1,2018 @@ +{ + "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": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 10, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "message", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "'hello'", + "value": "hello", + "range": [ + 55, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 29 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 48, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "optional": false, + "range": [ + 48, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + "range": [ + 38, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 30 + } + } + } + ], + "range": [ + 34, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 31 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "count", + "range": [ + 78, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "count", + "range": [ + 78, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "range": [ + 78, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "message", + "range": [ + 85, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "message", + "range": [ + 85, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "range": [ + 85, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 26 + } + } + } + ], + "range": [ + 76, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 28 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 67, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "optional": false, + "range": [ + 67, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "range": [ + 67, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 30 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 150, + 159 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "range": [ + 0, + 159 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 159, + 161 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 8, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 162, + 168 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 169, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "count", + "range": [ + 184, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 184, + 191 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 30 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 178, + 191 + ], + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 30 + } + } + }, + "range": [ + 177, + 192 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 31 + } + } + } + ], + "range": [ + 169, + 192 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 31 + } + } + } + ], + "selfClosing": false, + "range": [ + 161, + 193 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 32 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "Increment", + "range": [ + 193, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 32 + }, + "end": { + "line": 8, + "column": 41 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 202, + 211 + ], + "loc": { + "start": { + "line": 8, + "column": 41 + }, + "end": { + "line": 8, + "column": 50 + } + } + }, + "range": [ + 161, + 211 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 50 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 8, + "column": 50 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "input", + "range": [ + 213, + 218 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "Binding", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "value", + "range": [ + 224, + 229 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "modifiers": [], + "range": [ + 219, + 229 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "expression": { + "type": "Identifier", + "name": "message", + "range": [ + 231, + 238 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + "shorthand": false, + "range": [ + 219, + 239 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 27 + } + } + } + ], + "selfClosing": true, + "range": [ + 212, + 242 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 30 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 212, + 242 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 30 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " will console.log when `count` or `message` change", + "range": [ + 97, + 149 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 83 + } + } + } + ], + "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": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "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": [ + 34, + 37 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 46, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 48, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 54, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "String", + "value": "'hello'", + "range": [ + 55, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "$inspect", + "range": [ + 67, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 78, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 85, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 150, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 151, + 152 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 152, + 158 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 158, + 159 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 159, + 161 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 8, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 161, + 162 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 162, + 168 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onclick", + "range": [ + 169, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 177, + 178 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 179, + 180 + ], + "loc": { + "start": { + "line": 8, + "column": 18 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 181, + 183 + ], + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 184, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 189, + 191 + ], + "loc": { + "start": { + "line": 8, + "column": 28 + }, + "end": { + "line": 8, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 191, + 192 + ], + "loc": { + "start": { + "line": 8, + "column": 30 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 8, + "column": 31 + }, + "end": { + "line": 8, + "column": 32 + } + } + }, + { + "type": "HTMLText", + "value": "Increment", + "range": [ + 193, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 32 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 8, + "column": 41 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 203, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 42 + }, + "end": { + "line": 8, + "column": 43 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 204, + 210 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 49 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 210, + 211 + ], + "loc": { + "start": { + "line": 8, + "column": 49 + }, + "end": { + "line": 8, + "column": 50 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 211, + 212 + ], + "loc": { + "start": { + "line": 8, + "column": 50 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 212, + 213 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "input", + "range": [ + 213, + 218 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "bind", + "range": [ + 219, + 223 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 223, + 224 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "value", + "range": [ + 224, + 229 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 229, + 230 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 230, + 231 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 231, + 238 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 238, + 239 + ], + "loc": { + "start": { + "line": 9, + "column": 26 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 240, + 241 + ], + "loc": { + "start": { + "line": 9, + "column": 28 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 241, + 242 + ], + "loc": { + "start": { + "line": 9, + "column": 29 + }, + "end": { + "line": 9, + "column": 30 + } + } + } + ], + "range": [ + 0, + 243 + ], + "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/11-$inspect-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-$inspect-scope-output.json new file mode 100644 index 00000000..a8557464 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-$inspect-scope-output.json @@ -0,0 +1,1086 @@ +{ + "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": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 48, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 67, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 78, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 184, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + }, + { + "name": "message", + "identifiers": [ + { + "type": "Identifier", + "name": "message", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "message", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "message", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "'hello'", + "value": "hello", + "range": [ + 55, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 29 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 48, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "optional": false, + "range": [ + 48, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + "range": [ + 38, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 30 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 85, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 231, + 238 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 48, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 67, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 78, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 85, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 231, + 238 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 184, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 184, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 48, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 67, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-input.svelte new file mode 100644 index 00000000..3edb00e1 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-input.svelte @@ -0,0 +1,9 @@ + + + + diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-output.json new file mode 100644 index 00000000..0cfa7780 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-output.json @@ -0,0 +1,2236 @@ +{ + "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": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "lang", + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteLiteral", + "value": "ts", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "range": [ + 8, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 17 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "body": [ + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 32, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 24, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 20, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "message", + "range": [ + 48, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "'hello'", + "value": "hello", + "range": [ + 65, + 72 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 29 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 58, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "optional": false, + "range": [ + 58, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + "range": [ + 48, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 30 + } + } + } + ], + "range": [ + 44, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 31 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "count", + "range": [ + 88, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "count", + "range": [ + 88, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "range": [ + 88, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Property", + "kind": "init", + "computed": false, + "key": { + "type": "Identifier", + "name": "message", + "range": [ + 95, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "method": false, + "shorthand": true, + "value": { + "type": "Identifier", + "name": "message", + "range": [ + 95, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "range": [ + 95, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 26 + } + } + } + ], + "range": [ + 86, + 104 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 28 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 77, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "optional": false, + "range": [ + 77, + 105 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "range": [ + 77, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 30 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 107, + 116 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "range": [ + 0, + 116 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 116, + 118 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 8, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 119, + 125 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 126, + 133 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "count", + "range": [ + 141, + 146 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 141, + 148 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 30 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 135, + 148 + ], + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 30 + } + } + }, + "range": [ + 134, + 149 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 31 + } + } + } + ], + "range": [ + 126, + 149 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 31 + } + } + } + ], + "selfClosing": false, + "range": [ + 118, + 150 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 32 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "Increment", + "range": [ + 150, + 159 + ], + "loc": { + "start": { + "line": 8, + "column": 32 + }, + "end": { + "line": 8, + "column": 41 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 159, + 168 + ], + "loc": { + "start": { + "line": 8, + "column": 41 + }, + "end": { + "line": 8, + "column": 50 + } + } + }, + "range": [ + 118, + 168 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 50 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 8, + "column": 50 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "input", + "range": [ + 170, + 175 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteDirective", + "kind": "Binding", + "key": { + "type": "SvelteDirectiveKey", + "name": { + "type": "SvelteName", + "name": "value", + "range": [ + 181, + 186 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "modifiers": [], + "range": [ + 176, + 186 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "expression": { + "type": "Identifier", + "name": "message", + "range": [ + 188, + 195 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + "shorthand": false, + "range": [ + 176, + 196 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 27 + } + } + } + ], + "selfClosing": true, + "range": [ + 169, + 199 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 30 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 169, + 199 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 30 + } + } + } + ], + "sourceType": "module", + "comments": [], + "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": "HTMLIdentifier", + "value": "lang", + "range": [ + 8, + 12 + ], + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 12, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 13, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "HTMLText", + "value": "ts", + "range": [ + 14, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 17, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 20, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 44, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 48, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 58, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "String", + "value": "'hello'", + "range": [ + 65, + 72 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 73, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "$inspect", + "range": [ + 77, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 88, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 95, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 103, + 104 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 107, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 109, + 115 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 115, + 116 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 116, + 118 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 8, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 119, + 125 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onclick", + "range": [ + 126, + 133 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 8, + "column": 18 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 138, + 140 + ], + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 141, + 142 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "o", + "range": [ + 142, + 143 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "u", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 8, + "column": 25 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "n", + "range": [ + 144, + 145 + ], + "loc": { + "start": { + "line": 8, + "column": 26 + }, + "end": { + "line": 8, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "t", + "range": [ + 145, + 146 + ], + "loc": { + "start": { + "line": 8, + "column": 27 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 146, + 147 + ], + "loc": { + "start": { + "line": 8, + "column": 28 + }, + "end": { + "line": 8, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 8, + "column": 30 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 149, + 150 + ], + "loc": { + "start": { + "line": 8, + "column": 31 + }, + "end": { + "line": 8, + "column": 32 + } + } + }, + { + "type": "HTMLText", + "value": "Increment", + "range": [ + 150, + 159 + ], + "loc": { + "start": { + "line": 8, + "column": 32 + }, + "end": { + "line": 8, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 8, + "column": 41 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 160, + 161 + ], + "loc": { + "start": { + "line": 8, + "column": 42 + }, + "end": { + "line": 8, + "column": 43 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 161, + 167 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 49 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 8, + "column": 49 + }, + "end": { + "line": 8, + "column": 50 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 8, + "column": 50 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 169, + 170 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "input", + "range": [ + 170, + 175 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "bind", + "range": [ + 176, + 180 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 180, + 181 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "value", + "range": [ + 181, + 186 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 186, + 187 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 187, + 188 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 188, + 195 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 9, + "column": 26 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 197, + 198 + ], + "loc": { + "start": { + "line": 9, + "column": 28 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 198, + 199 + ], + "loc": { + "start": { + "line": 9, + "column": 29 + }, + "end": { + "line": 9, + "column": 30 + } + } + } + ], + "range": [ + 0, + 200 + ], + "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/11-2-$inspect-ts-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-scope-output.json new file mode 100644 index 00000000..361cefeb --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-scope-output.json @@ -0,0 +1,1086 @@ +{ + "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": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 58, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 77, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 32, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 24, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 88, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 141, + 146 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + }, + { + "name": "message", + "identifiers": [ + { + "type": "Identifier", + "name": "message", + "range": [ + 48, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "message", + "range": [ + 48, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "message", + "range": [ + 48, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "'hello'", + "value": "hello", + "range": [ + 65, + 72 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 29 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 58, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "optional": false, + "range": [ + 58, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + "range": [ + 48, + 73 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 30 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 48, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 48, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 95, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 48, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 188, + 195 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 48, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 48, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 48, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 58, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 77, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 88, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 95, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 48, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 188, + 195 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 48, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 12 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 141, + 146 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 141, + 146 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 58, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 77, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-type-output.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-type-output.svelte new file mode 100644 index 00000000..0f8721ce --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-type-output.svelte @@ -0,0 +1,9 @@ + + + + diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/12-$inspect-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/12-$inspect-input.svelte new file mode 100644 index 00000000..d9624c1b --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/12-$inspect-input.svelte @@ -0,0 +1,11 @@ + + + diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/12-$inspect-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/12-$inspect-output.json new file mode 100644 index 00000000..977789e1 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/12-$inspect-output.json @@ -0,0 +1,1739 @@ +{ + "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": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 10, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "DebuggerStatement", + "range": [ + 100, + 109 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 12 + } + } + } + ], + "range": [ + 95, + 157 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "type", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "operator": "===", + "right": { + "type": "Literal", + "raw": "'update'", + "value": "update", + "range": [ + 85, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 76, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 72, + 157 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + } + ], + "range": [ + 68, + 160 + ], + "loc": { + "start": { + "line": 4, + "column": 34 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 52, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 29 + } + } + } + ], + "range": [ + 51, + 160 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 35, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "optional": false, + "range": [ + 35, + 161 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "range": [ + 35, + 162 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 8, + "column": 4 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 163, + 172 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "range": [ + 0, + 172 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 172, + 174 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 175, + 181 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 182, + 189 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 15 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "UpdateExpression", + "argument": { + "type": "Identifier", + "name": "count", + "range": [ + 197, + 202 + ], + "loc": { + "start": { + "line": 11, + "column": 23 + }, + "end": { + "line": 11, + "column": 28 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 197, + 204 + ], + "loc": { + "start": { + "line": 11, + "column": 23 + }, + "end": { + "line": 11, + "column": 30 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 191, + 204 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 30 + } + } + }, + "range": [ + 190, + 205 + ], + "loc": { + "start": { + "line": 11, + "column": 16 + }, + "end": { + "line": 11, + "column": 31 + } + } + } + ], + "range": [ + 182, + 205 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 31 + } + } + } + ], + "selfClosing": false, + "range": [ + 174, + 206 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 32 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "Increment", + "range": [ + 206, + 215 + ], + "loc": { + "start": { + "line": 11, + "column": 32 + }, + "end": { + "line": 11, + "column": 41 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 215, + 224 + ], + "loc": { + "start": { + "line": 11, + "column": 41 + }, + "end": { + "line": 11, + "column": 50 + } + } + }, + "range": [ + 174, + 224 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 50 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " or `console.trace`, or whatever you want", + "range": [ + 110, + 153 + ], + "loc": { + "start": { + "line": 6, + "column": 13 + }, + "end": { + "line": 6, + "column": 56 + } + } + } + ], + "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": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "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": "Identifier", + "value": "$inspect", + "range": [ + 35, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 52, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 65, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 34 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + { + "type": "Keyword", + "value": "if", + "range": [ + 72, + 74 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "Identifier", + "value": "type", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "===", + "range": [ + 81, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": "String", + "value": "'update'", + "range": [ + 85, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 93, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 95, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Keyword", + "value": "debugger", + "range": [ + 100, + 108 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 156, + 157 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 160, + 161 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 161, + 162 + ], + "loc": { + "start": { + "line": 8, + "column": 3 + }, + "end": { + "line": 8, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 164, + 165 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 165, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 171, + 172 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 172, + 174 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 175, + 181 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onclick", + "range": [ + 182, + 189 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 190, + 191 + ], + "loc": { + "start": { + "line": 11, + "column": 16 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 191, + 192 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 194, + 196 + ], + "loc": { + "start": { + "line": 11, + "column": 20 + }, + "end": { + "line": 11, + "column": 22 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 197, + 202 + ], + "loc": { + "start": { + "line": 11, + "column": 23 + }, + "end": { + "line": 11, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 202, + 204 + ], + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 11, + "column": 30 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 11, + "column": 31 + }, + "end": { + "line": 11, + "column": 32 + } + } + }, + { + "type": "HTMLText", + "value": "Increment", + "range": [ + 206, + 215 + ], + "loc": { + "start": { + "line": 11, + "column": 32 + }, + "end": { + "line": 11, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 215, + 216 + ], + "loc": { + "start": { + "line": 11, + "column": 41 + }, + "end": { + "line": 11, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 216, + 217 + ], + "loc": { + "start": { + "line": 11, + "column": 42 + }, + "end": { + "line": 11, + "column": 43 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 217, + 223 + ], + "loc": { + "start": { + "line": 11, + "column": 43 + }, + "end": { + "line": 11, + "column": 49 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 223, + 224 + ], + "loc": { + "start": { + "line": 11, + "column": 49 + }, + "end": { + "line": 11, + "column": 50 + } + } + } + ], + "range": [ + 0, + 225 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/12-$inspect-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/12-$inspect-scope-output.json new file mode 100644 index 00000000..64442320 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/12-$inspect-scope-output.json @@ -0,0 +1,1203 @@ +{ + "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": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 35, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 197, + 202 + ], + "loc": { + "start": { + "line": 11, + "column": 23 + }, + "end": { + "line": 11, + "column": 28 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 35, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 52, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 52, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "DebuggerStatement", + "range": [ + 100, + 109 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 12 + } + } + } + ], + "range": [ + 95, + 157 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "type", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "operator": "===", + "right": { + "type": "Literal", + "raw": "'update'", + "value": "update", + "range": [ + 85, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 76, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 72, + 157 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + } + ], + "range": [ + 68, + 160 + ], + "loc": { + "start": { + "line": 4, + "column": 34 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 52, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 29 + } + } + } + ], + "range": [ + 51, + 160 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + } + ], + "references": [] + }, + { + "name": "type", + "identifiers": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 29 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 29 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "DebuggerStatement", + "range": [ + 100, + 109 + ], + "loc": { + "start": { + "line": 6, + "column": 3 + }, + "end": { + "line": 6, + "column": 12 + } + } + } + ], + "range": [ + 95, + 157 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "type", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "operator": "===", + "right": { + "type": "Literal", + "raw": "'update'", + "value": "update", + "range": [ + 85, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 76, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 72, + 157 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + } + ], + "range": [ + 68, + 160 + ], + "loc": { + "start": { + "line": 4, + "column": 34 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 52, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 29 + } + } + } + ], + "range": [ + 51, + 160 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "type", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 29 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "type", + "range": [ + 76, + 80 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 29 + } + } + } + } + ], + "childScopes": [ + { + "type": "block", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + } + ], + "through": [] + }, + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 197, + 202 + ], + "loc": { + "start": { + "line": 11, + "column": 23 + }, + "end": { + "line": 11, + "column": 28 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 197, + 202 + ], + "loc": { + "start": { + "line": 11, + "column": 23 + }, + "end": { + "line": 11, + "column": 28 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 35, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/13-$inspect-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/13-$inspect-input.svelte new file mode 100644 index 00000000..56758961 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/13-$inspect-input.svelte @@ -0,0 +1,7 @@ + diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/13-$inspect-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/13-$inspect-output.json new file mode 100644 index 00000000..cf45d73f --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/13-$inspect-output.json @@ -0,0 +1,912 @@ +{ + "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": "stuff", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "range": [ + 10, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "stuff", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "trace", + "range": [ + 59, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "range": [ + 51, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 30 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 35, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "optional": false, + "range": [ + 35, + 65 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 31 + } + } + }, + "range": [ + 35, + 66 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 32 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "stuff", + "range": [ + 69, + 74 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + "operator": "=", + "right": { + "type": "Literal", + "raw": "1", + "value": 1, + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "range": [ + 69, + 78 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "range": [ + 69, + 79 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 11 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 80, + 89 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + "range": [ + 0, + 89 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 9 + } + } + } + ], + "sourceType": "module", + "comments": [], + "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": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "stuff", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Numeric", + "value": "0", + "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": "Identifier", + "value": "$inspect", + "range": [ + 35, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "stuff", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "trace", + "range": [ + 59, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "stuff", + "range": [ + 69, + 74 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Numeric", + "value": "1", + "range": [ + 77, + 78 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 82, + 88 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + } + ], + "range": [ + 0, + 90 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/13-$inspect-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/13-$inspect-scope-output.json new file mode 100644 index 00000000..72b26464 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/13-$inspect-scope-output.json @@ -0,0 +1,657 @@ +{ + "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": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 35, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "stuff", + "identifiers": [ + { + "type": "Identifier", + "name": "stuff", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "stuff", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "stuff", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 14, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "stuff", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "stuff", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "stuff", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "stuff", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "stuff", + "range": [ + 69, + 74 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + "from": "module", + "init": false, + "resolved": { + "type": "Identifier", + "name": "stuff", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "stuff", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "stuff", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 35, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "stuff", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "stuff", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "stuff", + "range": [ + 69, + 74 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + "from": "module", + "init": false, + "resolved": { + "type": "Identifier", + "name": "stuff", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 35, + 43 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 51, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/01-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/01-scope-output.json index d6664fe6..272a4a0e 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/01-scope-output.json @@ -42,6 +42,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/02-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/02-scope-output.json index d52bdbf0..46555110 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/02-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/02-scope-output.json @@ -42,6 +42,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-scope-output.json index f2f80470..a3acfcf0 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/03-snippet-scope-scope-output.json @@ -66,6 +66,12 @@ "resolved": null } ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-scope-output.json index 044a04d7..5cdf4262 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/04-snippet-scope-scope-output.json @@ -42,6 +42,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-scope-output.json index d3a381f1..5efe5dde 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/05-snippet-scope-scope-output.json @@ -42,6 +42,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-scope-output.json index e618d0c1..830823da 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/06-passing-snippets-to-components-scope-output.json @@ -42,6 +42,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-scope-output.json index a765b752..d6e311a2 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/07-passing-snippets-to-components-scope-output.json @@ -42,6 +42,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-scope-output.json index 6aaf22c7..c900dfd1 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/08-passing-snippets-to-components-scope-output.json @@ -42,6 +42,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-scope-output.json index 8d5fae8f..b4a23f04 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/snippets/09-passing-snippets-to-components-scope-output.json @@ -66,6 +66,12 @@ "resolved": null } ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/01-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/01-scope-output.json index c28d4d8b..398f8e5b 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/01-scope-output.json @@ -66,6 +66,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/02-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/02-scope-output.json index f177577d..b7f11576 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/02-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/02-scope-output.json @@ -66,6 +66,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-scope-output.json index ff248e38..f01fe863 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-scope-output.json @@ -48,6 +48,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-ts-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-ts-scope-output.json index ff248e38..f01fe863 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-ts-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/universal-reactivity/03-ts-scope-output.json @@ -48,6 +48,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/svelte-ts-$derived01-scope-output.json b/tests/fixtures/parser/ast/svelte5/svelte-ts-$derived01-scope-output.json index 7b393ba6..e60dddd3 100644 --- a/tests/fixtures/parser/ast/svelte5/svelte-ts-$derived01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/svelte-ts-$derived01-scope-output.json @@ -72,6 +72,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/svelte-ts-$effect01-scope-output.json b/tests/fixtures/parser/ast/svelte5/svelte-ts-$effect01-scope-output.json index e6b02cb4..17cab6c0 100644 --- a/tests/fixtures/parser/ast/svelte5/svelte-ts-$effect01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/svelte-ts-$effect01-scope-output.json @@ -96,6 +96,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/svelte-ts-$props01-scope-output.json b/tests/fixtures/parser/ast/svelte5/svelte-ts-$props01-scope-output.json index 4220f961..023cd98c 100644 --- a/tests/fixtures/parser/ast/svelte5/svelte-ts-$props01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/svelte-ts-$props01-scope-output.json @@ -48,6 +48,12 @@ "resolved": null } ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-$derived01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-$derived01-scope-output.json index c4c8d3d9..53ac2c24 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-$derived01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-$derived01-scope-output.json @@ -90,6 +90,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-$effect01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-$effect01-scope-output.json index f3f9dbc1..fe38e7c5 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-$effect01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-$effect01-scope-output.json @@ -114,6 +114,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-$effectpre01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-$effectpre01-scope-output.json index cad52fc6..a44baec5 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-$effectpre01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-$effectpre01-scope-output.json @@ -114,6 +114,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-$props01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-$props01-scope-output.json index c3abab56..a387916d 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-$props01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-$props01-scope-output.json @@ -66,6 +66,12 @@ "resolved": null } ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-$state01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-$state01-scope-output.json index 38c277a5..d5c29fb3 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-$state01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-$state01-scope-output.json @@ -89,6 +89,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event01-scope-output.json index fd4ca9f8..d26b1e5f 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event01-scope-output.json @@ -42,6 +42,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event02-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event02-scope-output.json index 7382637a..18b2f1ba 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event02-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event02-scope-output.json @@ -42,6 +42,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event03-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event03-scope-output.json index b5f0e409..8f39c531 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event03-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event03-scope-output.json @@ -66,6 +66,12 @@ "resolved": null } ] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event04-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event04-scope-output.json index 27145165..86f0853b 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event04-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event04-scope-output.json @@ -42,6 +42,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event05-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event05-scope-output.json index c068e6c4..d2967c31 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event05-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event05-scope-output.json @@ -42,6 +42,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event06-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event06-scope-output.json index c1c755fe..93169ac8 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event06-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event06-scope-output.json @@ -42,6 +42,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event07-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event07-scope-output.json index edb8e8fa..68e636d6 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event07-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event07-scope-output.json @@ -66,6 +66,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-event08-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-event08-scope-output.json index 85f4859b..83e389b4 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-event08-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-event08-scope-output.json @@ -66,6 +66,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/svelte5/ts-snippet01-scope-output.json b/tests/fixtures/parser/ast/svelte5/ts-snippet01-scope-output.json index 9a8afa35..f7cacb4d 100644 --- a/tests/fixtures/parser/ast/svelte5/ts-snippet01-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/ts-snippet01-scope-output.json @@ -42,6 +42,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ], "references": [], diff --git a/tests/fixtures/parser/ast/ts-$$props01-scope-output-svelte5.json b/tests/fixtures/parser/ast/ts-$$props01-scope-output-svelte5.json index d1c0d303..7b00936f 100644 --- a/tests/fixtures/parser/ast/ts-$$props01-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/ts-$$props01-scope-output-svelte5.json @@ -89,6 +89,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-$$slots01-scope-output-svelte5.json b/tests/fixtures/parser/ast/ts-$$slots01-scope-output-svelte5.json index 9d05138e..7ef7f0bf 100644 --- a/tests/fixtures/parser/ast/ts-$$slots01-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/ts-$$slots01-scope-output-svelte5.json @@ -65,6 +65,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-$$slots02-no-slot-scope-output-svelte5.json b/tests/fixtures/parser/ast/ts-$$slots02-no-slot-scope-output-svelte5.json index 9d05138e..7ef7f0bf 100644 --- a/tests/fixtures/parser/ast/ts-$$slots02-no-slot-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/ts-$$slots02-no-slot-scope-output-svelte5.json @@ -65,6 +65,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-$$slots03-named-scope-output-svelte5.json b/tests/fixtures/parser/ast/ts-$$slots03-named-scope-output-svelte5.json index 9d05138e..7ef7f0bf 100644 --- a/tests/fixtures/parser/ast/ts-$$slots03-named-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/ts-$$slots03-named-scope-output-svelte5.json @@ -65,6 +65,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/ts-$$slots04-named-scope-output-svelte5.json b/tests/fixtures/parser/ast/ts-$$slots04-named-scope-output-svelte5.json index 9d05138e..7ef7f0bf 100644 --- a/tests/fixtures/parser/ast/ts-$$slots04-named-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/ts-$$slots04-named-scope-output-svelte5.json @@ -65,6 +65,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/fixtures/parser/ast/tutorial/optional-slots03-scope-output-svelte5.json b/tests/fixtures/parser/ast/tutorial/optional-slots03-scope-output-svelte5.json index a1cb3347..abd0baca 100644 --- a/tests/fixtures/parser/ast/tutorial/optional-slots03-scope-output-svelte5.json +++ b/tests/fixtures/parser/ast/tutorial/optional-slots03-scope-output-svelte5.json @@ -88,6 +88,12 @@ "identifiers": [], "defs": [], "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] } ] } \ No newline at end of file diff --git a/tests/src/parser/test-utils.ts b/tests/src/parser/test-utils.ts index 11745e56..04d11770 100644 --- a/tests/src/parser/test-utils.ts +++ b/tests/src/parser/test-utils.ts @@ -66,6 +66,12 @@ const SVELTE5_SCOPE_VARIABLES_BASE = [ defs: [], references: [], }, + { + name: "$inspect", + identifiers: [], + defs: [], + references: [], + }, ]; export function generateParserOptions( ...options: Linter.ParserOptions[]