diff --git a/.changeset/ninety-shoes-clean.md b/.changeset/ninety-shoes-clean.md new file mode 100644 index 00000000..78119b9e --- /dev/null +++ b/.changeset/ninety-shoes-clean.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": patch +--- + +feat: update `$inspect` types diff --git a/package.json b/package.json index 2df8e531..c2414270 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "prettier-plugin-svelte": "^3.1.2", "rimraf": "^5.0.5", "semver": "^7.5.4", - "svelte": "^5.0.0-next.25", + "svelte": "^5.0.0-next.37", "svelte2tsx": "^0.7.0", "typescript": "~5.1.6", "typescript-eslint-parser-for-extra-files": "^0.6.0" diff --git a/src/parser/typescript/analyze/index.ts b/src/parser/typescript/analyze/index.ts index 6db90a46..584282e9 100644 --- a/src/parser/typescript/analyze/index.ts +++ b/src/parser/typescript/analyze/index.ts @@ -343,7 +343,7 @@ function analyzeRuneVariables( } case "$inspect": { appendDeclareFunctionVirtualScripts(globalName, [ - `(value: T, callback?: (value: T, type: 'init' | 'update') => void): void`, + `(...values: T): { with: (fn: (type: 'init' | 'update', ...values: T) => void) => void }`, ]); break; } 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 deleted file mode 100644 index 47e37b86..00000000 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/11-$inspect-input.svelte +++ /dev/null @@ -1,9 +0,0 @@ - - - - diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-input.svelte new file mode 100644 index 00000000..4bdc7004 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$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-1-$inspect-output.json similarity index 79% rename from tests/fixtures/parser/ast/svelte5/docs/runes/11-$inspect-output.json rename to tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-output.json index 423edefd..f4eaaa8c 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/11-$inspect-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-output.json @@ -51,17 +51,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -73,17 +73,17 @@ "raw": "0", "value": 0, "range": [ - 29, - 30 + 30, + 31 ], "loc": { "start": { "line": 2, - "column": 20 + "column": 21 }, "end": { "line": 2, - "column": 21 + "column": 22 } } } @@ -92,64 +92,64 @@ "type": "Identifier", "name": "$state", "range": [ - 22, - 28 + 23, + 29 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 19 + "column": 20 } } }, "optional": false, "range": [ - 22, - 31 + 23, + 32 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 22 + "column": 23 } } }, "range": [ - 14, - 31 + 15, + 32 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 22 + "column": 23 } } } ], "range": [ - 10, - 32 + 11, + 33 ], "loc": { "start": { "line": 2, - "column": 1 + "column": 2 }, "end": { "line": 2, - "column": 23 + "column": 24 } } }, @@ -163,17 +163,17 @@ "type": "Identifier", "name": "message", "range": [ - 38, - 45 + 40, + 47 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 12 + "column": 13 } } }, @@ -182,20 +182,20 @@ "arguments": [ { "type": "Literal", - "raw": "'hello'", + "raw": "\"hello\"", "value": "hello", "range": [ - 55, - 62 + 57, + 64 ], "loc": { "start": { "line": 3, - "column": 22 + "column": 23 }, "end": { "line": 3, - "column": 29 + "column": 30 } } } @@ -204,64 +204,64 @@ "type": "Identifier", "name": "$state", "range": [ - 48, - 54 + 50, + 56 ], "loc": { "start": { "line": 3, - "column": 15 + "column": 16 }, "end": { "line": 3, - "column": 21 + "column": 22 } } }, "optional": false, "range": [ - 48, - 63 + 50, + 65 ], "loc": { "start": { "line": 3, - "column": 15 + "column": 16 }, "end": { "line": 3, - "column": 30 + "column": 31 } } }, "range": [ - 38, - 63 + 40, + 65 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 30 + "column": 31 } } } ], "range": [ - 34, - 64 + 36, + 66 ], "loc": { "start": { "line": 3, - "column": 1 + "column": 2 }, "end": { "line": 3, - "column": 31 + "column": 32 } } }, @@ -271,135 +271,38 @@ "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": "Identifier", + "name": "count", + "range": [ + 79, + 84 + ], + "loc": { + "start": { + "line": 5, + "column": 11 }, - { - "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 - } - } + "end": { + "line": 5, + "column": 16 } - ], + } + }, + { + "type": "Identifier", + "name": "message", "range": [ - 76, - 94 + 86, + 93 ], "loc": { "start": { "line": 5, - "column": 10 + "column": 18 }, "end": { "line": 5, - "column": 28 + "column": 25 } } } @@ -408,48 +311,48 @@ "type": "Identifier", "name": "$inspect", "range": [ - 67, - 75 + 70, + 78 ], "loc": { "start": { "line": 5, - "column": 1 + "column": 2 }, "end": { "line": 5, - "column": 9 + "column": 10 } } }, "optional": false, "range": [ - 67, - 95 + 70, + 94 ], "loc": { "start": { "line": 5, - "column": 1 + "column": 2 }, "end": { "line": 5, - "column": 29 + "column": 26 } } }, "range": [ - 67, - 96 + 70, + 95 ], "loc": { "start": { "line": 5, - "column": 1 + "column": 2 }, "end": { "line": 5, - "column": 30 + "column": 27 } } } @@ -457,8 +360,8 @@ "endTag": { "type": "SvelteEndTag", "range": [ - 150, - 159 + 149, + 158 ], "loc": { "start": { @@ -473,7 +376,7 @@ }, "range": [ 0, - 159 + 158 ], "loc": { "start": { @@ -490,8 +393,8 @@ "type": "SvelteText", "value": "\n\n", "range": [ - 159, - 161 + 158, + 160 ], "loc": { "start": { @@ -511,8 +414,8 @@ "type": "SvelteName", "name": "button", "range": [ - 162, - 168 + 161, + 167 ], "loc": { "start": { @@ -534,8 +437,8 @@ "type": "SvelteName", "name": "onclick", "range": [ - 169, - 176 + 168, + 175 ], "loc": { "start": { @@ -568,11 +471,11 @@ "loc": { "start": { "line": 8, - "column": 23 + "column": 24 }, "end": { "line": 8, - "column": 28 + "column": 29 } } }, @@ -585,11 +488,11 @@ "loc": { "start": { "line": 8, - "column": 23 + "column": 24 }, "end": { "line": 8, - "column": 30 + "column": 31 } } }, @@ -604,11 +507,11 @@ "loc": { "start": { "line": 8, - "column": 17 + "column": 18 }, "end": { "line": 8, - "column": 30 + "column": 31 } } }, @@ -619,18 +522,18 @@ "loc": { "start": { "line": 8, - "column": 16 + "column": 17 }, "end": { "line": 8, - "column": 31 + "column": 32 } } } ], "range": [ - 169, - 192 + 168, + 193 ], "loc": { "start": { @@ -639,15 +542,15 @@ }, "end": { "line": 8, - "column": 31 + "column": 33 } } } ], "selfClosing": false, "range": [ - 161, - 193 + 160, + 194 ], "loc": { "start": { @@ -656,7 +559,7 @@ }, "end": { "line": 8, - "column": 32 + "column": 34 } } }, @@ -665,17 +568,17 @@ "type": "SvelteText", "value": "Increment", "range": [ - 193, - 202 + 194, + 203 ], "loc": { "start": { "line": 8, - "column": 32 + "column": 34 }, "end": { "line": 8, - "column": 41 + "column": 43 } } } @@ -683,23 +586,23 @@ "endTag": { "type": "SvelteEndTag", "range": [ - 202, - 211 + 203, + 212 ], "loc": { "start": { "line": 8, - "column": 41 + "column": 43 }, "end": { "line": 8, - "column": 50 + "column": 52 } } }, "range": [ - 161, - 211 + 160, + 212 ], "loc": { "start": { @@ -708,7 +611,7 @@ }, "end": { "line": 8, - "column": 50 + "column": 52 } } }, @@ -716,13 +619,13 @@ "type": "SvelteText", "value": "\n", "range": [ - 211, - 212 + 212, + 213 ], "loc": { "start": { "line": 8, - "column": 50 + "column": 52 }, "end": { "line": 9, @@ -737,8 +640,8 @@ "type": "SvelteName", "name": "input", "range": [ - 213, - 218 + 214, + 219 ], "loc": { "start": { @@ -763,8 +666,8 @@ "type": "SvelteName", "name": "value", "range": [ - 224, - 229 + 225, + 230 ], "loc": { "start": { @@ -779,8 +682,8 @@ }, "modifiers": [], "range": [ - 219, - 229 + 220, + 230 ], "loc": { "start": { @@ -797,24 +700,24 @@ "type": "Identifier", "name": "message", "range": [ - 231, - 238 + 233, + 240 ], "loc": { "start": { "line": 9, - "column": 19 + "column": 20 }, "end": { "line": 9, - "column": 26 + "column": 27 } } }, "shorthand": false, "range": [ - 219, - 239 + 220, + 242 ], "loc": { "start": { @@ -823,15 +726,15 @@ }, "end": { "line": 9, - "column": 27 + "column": 29 } } } ], "selfClosing": true, "range": [ - 212, - 242 + 213, + 245 ], "loc": { "start": { @@ -840,15 +743,15 @@ }, "end": { "line": 9, - "column": 30 + "column": 32 } } }, "children": [], "endTag": null, "range": [ - 212, - 242 + 213, + 245 ], "loc": { "start": { @@ -857,7 +760,7 @@ }, "end": { "line": 9, - "column": 30 + "column": 32 } } } @@ -868,17 +771,17 @@ "type": "Line", "value": " will console.log when `count` or `message` change", "range": [ - 97, - 149 + 96, + 148 ], "loc": { "start": { "line": 5, - "column": 31 + "column": 28 }, "end": { "line": 5, - "column": 83 + "column": 80 } } } @@ -942,17 +845,17 @@ "type": "Keyword", "value": "let", "range": [ - 10, - 13 + 11, + 14 ], "loc": { "start": { "line": 2, - "column": 1 + "column": 2 }, "end": { "line": 2, - "column": 4 + "column": 5 } } }, @@ -960,17 +863,17 @@ "type": "Identifier", "value": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -978,17 +881,17 @@ "type": "Punctuator", "value": "=", "range": [ - 20, - 21 + 21, + 22 ], "loc": { "start": { "line": 2, - "column": 11 + "column": 12 }, "end": { "line": 2, - "column": 12 + "column": 13 } } }, @@ -996,17 +899,17 @@ "type": "Identifier", "value": "$state", "range": [ - 22, - 28 + 23, + 29 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 19 + "column": 20 } } }, @@ -1014,17 +917,17 @@ "type": "Punctuator", "value": "(", "range": [ - 28, - 29 + 29, + 30 ], "loc": { "start": { "line": 2, - "column": 19 + "column": 20 }, "end": { "line": 2, - "column": 20 + "column": 21 } } }, @@ -1032,17 +935,17 @@ "type": "Numeric", "value": "0", "range": [ - 29, - 30 + 30, + 31 ], "loc": { "start": { "line": 2, - "column": 20 + "column": 21 }, "end": { "line": 2, - "column": 21 + "column": 22 } } }, @@ -1050,17 +953,17 @@ "type": "Punctuator", "value": ")", "range": [ - 30, - 31 + 31, + 32 ], "loc": { "start": { "line": 2, - "column": 21 + "column": 22 }, "end": { "line": 2, - "column": 22 + "column": 23 } } }, @@ -1068,17 +971,17 @@ "type": "Punctuator", "value": ";", "range": [ - 31, - 32 + 32, + 33 ], "loc": { "start": { "line": 2, - "column": 22 + "column": 23 }, "end": { "line": 2, - "column": 23 + "column": 24 } } }, @@ -1086,17 +989,17 @@ "type": "Keyword", "value": "let", "range": [ - 34, - 37 + 36, + 39 ], "loc": { "start": { "line": 3, - "column": 1 + "column": 2 }, "end": { "line": 3, - "column": 4 + "column": 5 } } }, @@ -1104,17 +1007,17 @@ "type": "Identifier", "value": "message", "range": [ - 38, - 45 + 40, + 47 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 12 + "column": 13 } } }, @@ -1122,17 +1025,17 @@ "type": "Punctuator", "value": "=", "range": [ - 46, - 47 + 48, + 49 ], "loc": { "start": { "line": 3, - "column": 13 + "column": 14 }, "end": { "line": 3, - "column": 14 + "column": 15 } } }, @@ -1140,17 +1043,17 @@ "type": "Identifier", "value": "$state", "range": [ - 48, - 54 + 50, + 56 ], "loc": { "start": { "line": 3, - "column": 15 + "column": 16 }, "end": { "line": 3, - "column": 21 + "column": 22 } } }, @@ -1158,35 +1061,35 @@ "type": "Punctuator", "value": "(", "range": [ - 54, - 55 + 56, + 57 ], "loc": { "start": { "line": 3, - "column": 21 + "column": 22 }, "end": { "line": 3, - "column": 22 + "column": 23 } } }, { "type": "String", - "value": "'hello'", + "value": "\"hello\"", "range": [ - 55, - 62 + 57, + 64 ], "loc": { "start": { "line": 3, - "column": 22 + "column": 23 }, "end": { "line": 3, - "column": 29 + "column": 30 } } }, @@ -1194,17 +1097,17 @@ "type": "Punctuator", "value": ")", "range": [ - 62, - 63 + 64, + 65 ], "loc": { "start": { "line": 3, - "column": 29 + "column": 30 }, "end": { "line": 3, - "column": 30 + "column": 31 } } }, @@ -1212,17 +1115,17 @@ "type": "Punctuator", "value": ";", "range": [ - 63, - 64 + 65, + 66 ], "loc": { "start": { "line": 3, - "column": 30 + "column": 31 }, "end": { "line": 3, - "column": 31 + "column": 32 } } }, @@ -1230,31 +1133,13 @@ "type": "Identifier", "value": "$inspect", "range": [ - 67, - 75 + 70, + 78 ], "loc": { "start": { "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 9 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 75, - 76 - ], - "loc": { - "start": { - "line": 5, - "column": 9 + "column": 2 }, "end": { "line": 5, @@ -1264,10 +1149,10 @@ }, { "type": "Punctuator", - "value": "{", + "value": "(", "range": [ - 76, - 77 + 78, + 79 ], "loc": { "start": { @@ -1284,17 +1169,17 @@ "type": "Identifier", "value": "count", "range": [ - 78, - 83 + 79, + 84 ], "loc": { "start": { "line": 5, - "column": 12 + "column": 11 }, "end": { "line": 5, - "column": 17 + "column": 16 } } }, @@ -1302,17 +1187,17 @@ "type": "Punctuator", "value": ",", "range": [ - 83, - 84 + 84, + 85 ], "loc": { "start": { "line": 5, - "column": 17 + "column": 16 }, "end": { "line": 5, - "column": 18 + "column": 17 } } }, @@ -1320,23 +1205,23 @@ "type": "Identifier", "value": "message", "range": [ - 85, - 92 + 86, + 93 ], "loc": { "start": { "line": 5, - "column": 19 + "column": 18 }, "end": { "line": 5, - "column": 26 + "column": 25 } } }, { "type": "Punctuator", - "value": "}", + "value": ")", "range": [ 93, 94 @@ -1344,17 +1229,17 @@ "loc": { "start": { "line": 5, - "column": 27 + "column": 25 }, "end": { "line": 5, - "column": 28 + "column": 26 } } }, { "type": "Punctuator", - "value": ")", + "value": ";", "range": [ 94, 95 @@ -1362,29 +1247,11 @@ "loc": { "start": { "line": 5, - "column": 28 - }, - "end": { - "line": 5, - "column": 29 - } - } - }, - { - "type": "Punctuator", - "value": ";", - "range": [ - 95, - 96 - ], - "loc": { - "start": { - "line": 5, - "column": 29 + "column": 26 }, "end": { "line": 5, - "column": 30 + "column": 27 } } }, @@ -1392,8 +1259,8 @@ "type": "Punctuator", "value": "<", "range": [ - 150, - 151 + 149, + 150 ], "loc": { "start": { @@ -1410,8 +1277,8 @@ "type": "Punctuator", "value": "/", "range": [ - 151, - 152 + 150, + 151 ], "loc": { "start": { @@ -1428,8 +1295,8 @@ "type": "HTMLIdentifier", "value": "script", "range": [ - 152, - 158 + 151, + 157 ], "loc": { "start": { @@ -1446,8 +1313,8 @@ "type": "Punctuator", "value": ">", "range": [ - 158, - 159 + 157, + 158 ], "loc": { "start": { @@ -1464,8 +1331,8 @@ "type": "HTMLText", "value": "\n\n", "range": [ - 159, - 161 + 158, + 160 ], "loc": { "start": { @@ -1482,8 +1349,8 @@ "type": "Punctuator", "value": "<", "range": [ - 161, - 162 + 160, + 161 ], "loc": { "start": { @@ -1500,8 +1367,8 @@ "type": "HTMLIdentifier", "value": "button", "range": [ - 162, - 168 + 161, + 167 ], "loc": { "start": { @@ -1518,8 +1385,8 @@ "type": "HTMLIdentifier", "value": "onclick", "range": [ - 169, - 176 + 168, + 175 ], "loc": { "start": { @@ -1536,8 +1403,8 @@ "type": "Punctuator", "value": "=", "range": [ - 176, - 177 + 175, + 176 ], "loc": { "start": { @@ -1550,6 +1417,24 @@ } } }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, { "type": "Punctuator", "value": "{", @@ -1560,11 +1445,11 @@ "loc": { "start": { "line": 8, - "column": 16 + "column": 17 }, "end": { "line": 8, - "column": 17 + "column": 18 } } }, @@ -1578,11 +1463,11 @@ "loc": { "start": { "line": 8, - "column": 17 + "column": 18 }, "end": { "line": 8, - "column": 18 + "column": 19 } } }, @@ -1596,11 +1481,11 @@ "loc": { "start": { "line": 8, - "column": 18 + "column": 19 }, "end": { "line": 8, - "column": 19 + "column": 20 } } }, @@ -1614,11 +1499,11 @@ "loc": { "start": { "line": 8, - "column": 20 + "column": 21 }, "end": { "line": 8, - "column": 22 + "column": 23 } } }, @@ -1632,11 +1517,11 @@ "loc": { "start": { "line": 8, - "column": 23 + "column": 24 }, "end": { "line": 8, - "column": 28 + "column": 29 } } }, @@ -1650,11 +1535,11 @@ "loc": { "start": { "line": 8, - "column": 28 + "column": 29 }, "end": { "line": 8, - "column": 30 + "column": 31 } } }, @@ -1668,17 +1553,17 @@ "loc": { "start": { "line": 8, - "column": 30 + "column": 31 }, "end": { "line": 8, - "column": 31 + "column": 32 } } }, { "type": "Punctuator", - "value": ">", + "value": "\"", "range": [ 192, 193 @@ -1686,11 +1571,29 @@ "loc": { "start": { "line": 8, - "column": 31 + "column": 32 }, "end": { "line": 8, - "column": 32 + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 193, + 194 + ], + "loc": { + "start": { + "line": 8, + "column": 33 + }, + "end": { + "line": 8, + "column": 34 } } }, @@ -1698,17 +1601,17 @@ "type": "HTMLText", "value": "Increment", "range": [ - 193, - 202 + 194, + 203 ], "loc": { "start": { "line": 8, - "column": 32 + "column": 34 }, "end": { "line": 8, - "column": 41 + "column": 43 } } }, @@ -1716,17 +1619,17 @@ "type": "Punctuator", "value": "<", "range": [ - 202, - 203 + 203, + 204 ], "loc": { "start": { "line": 8, - "column": 41 + "column": 43 }, "end": { "line": 8, - "column": 42 + "column": 44 } } }, @@ -1734,17 +1637,17 @@ "type": "Punctuator", "value": "/", "range": [ - 203, - 204 + 204, + 205 ], "loc": { "start": { "line": 8, - "column": 42 + "column": 44 }, "end": { "line": 8, - "column": 43 + "column": 45 } } }, @@ -1752,17 +1655,17 @@ "type": "HTMLIdentifier", "value": "button", "range": [ - 204, - 210 + 205, + 211 ], "loc": { "start": { "line": 8, - "column": 43 + "column": 45 }, "end": { "line": 8, - "column": 49 + "column": 51 } } }, @@ -1770,17 +1673,17 @@ "type": "Punctuator", "value": ">", "range": [ - 210, - 211 + 211, + 212 ], "loc": { "start": { "line": 8, - "column": 49 + "column": 51 }, "end": { "line": 8, - "column": 50 + "column": 52 } } }, @@ -1788,13 +1691,13 @@ "type": "HTMLText", "value": "\n", "range": [ - 211, - 212 + 212, + 213 ], "loc": { "start": { "line": 8, - "column": 50 + "column": 52 }, "end": { "line": 9, @@ -1806,8 +1709,8 @@ "type": "Punctuator", "value": "<", "range": [ - 212, - 213 + 213, + 214 ], "loc": { "start": { @@ -1824,8 +1727,8 @@ "type": "HTMLIdentifier", "value": "input", "range": [ - 213, - 218 + 214, + 219 ], "loc": { "start": { @@ -1842,8 +1745,8 @@ "type": "HTMLIdentifier", "value": "bind", "range": [ - 219, - 223 + 220, + 224 ], "loc": { "start": { @@ -1860,8 +1763,8 @@ "type": "Punctuator", "value": ":", "range": [ - 223, - 224 + 224, + 225 ], "loc": { "start": { @@ -1878,8 +1781,8 @@ "type": "HTMLIdentifier", "value": "value", "range": [ - 224, - 229 + 225, + 230 ], "loc": { "start": { @@ -1896,8 +1799,8 @@ "type": "Punctuator", "value": "=", "range": [ - 229, - 230 + 230, + 231 ], "loc": { "start": { @@ -1912,10 +1815,10 @@ }, { "type": "Punctuator", - "value": "{", + "value": "\"", "range": [ - 230, - 231 + 231, + 232 ], "loc": { "start": { @@ -1929,11 +1832,11 @@ } }, { - "type": "Identifier", - "value": "message", + "type": "Punctuator", + "value": "{", "range": [ - 231, - 238 + 232, + 233 ], "loc": { "start": { @@ -1942,21 +1845,21 @@ }, "end": { "line": 9, - "column": 26 + "column": 20 } } }, { - "type": "Punctuator", - "value": "}", + "type": "Identifier", + "value": "message", "range": [ - 238, - 239 + 233, + 240 ], "loc": { "start": { "line": 9, - "column": 26 + "column": 20 }, "end": { "line": 9, @@ -1966,7 +1869,7 @@ }, { "type": "Punctuator", - "value": "/", + "value": "}", "range": [ 240, 241 @@ -1974,17 +1877,17 @@ "loc": { "start": { "line": 9, - "column": 28 + "column": 27 }, "end": { "line": 9, - "column": 29 + "column": 28 } } }, { "type": "Punctuator", - "value": ">", + "value": "\"", "range": [ 241, 242 @@ -1992,18 +1895,54 @@ "loc": { "start": { "line": 9, - "column": 29 + "column": 28 }, "end": { + "line": 9, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 243, + 244 + ], + "loc": { + "start": { "line": 9, "column": 30 + }, + "end": { + "line": 9, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 244, + 245 + ], + "loc": { + "start": { + "line": 9, + "column": 31 + }, + "end": { + "line": 9, + "column": 32 } } } ], "range": [ 0, - 243 + 246 ], "loc": { "start": { diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-$inspect-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-scope-output.json similarity index 81% rename from tests/fixtures/parser/ast/svelte5/docs/runes/11-$inspect-scope-output.json rename to tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-scope-output.json index a8557464..0410ba54 100644 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/11-$inspect-scope-output.json +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-scope-output.json @@ -29,17 +29,17 @@ "type": "Identifier", "name": "$state", "range": [ - 22, - 28 + 23, + 29 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 19 + "column": 20 } } }, @@ -52,17 +52,17 @@ "type": "Identifier", "name": "$state", "range": [ - 48, - 54 + 50, + 56 ], "loc": { "start": { "line": 3, - "column": 15 + "column": 16 }, "end": { "line": 3, - "column": 21 + "column": 22 } } }, @@ -100,17 +100,17 @@ "type": "Identifier", "name": "$inspect", "range": [ - 67, - 75 + 70, + 78 ], "loc": { "start": { "line": 5, - "column": 1 + "column": 2 }, "end": { "line": 5, - "column": 9 + "column": 10 } } }, @@ -133,17 +133,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -155,17 +155,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -175,17 +175,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -197,17 +197,17 @@ "raw": "0", "value": 0, "range": [ - 29, - 30 + 30, + 31 ], "loc": { "start": { "line": 2, - "column": 20 + "column": 21 }, "end": { "line": 2, - "column": 21 + "column": 22 } } } @@ -216,48 +216,48 @@ "type": "Identifier", "name": "$state", "range": [ - 22, - 28 + 23, + 29 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 19 + "column": 20 } } }, "optional": false, "range": [ - 22, - 31 + 23, + 32 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 22 + "column": 23 } } }, "range": [ - 14, - 31 + 15, + 32 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 22 + "column": 23 } } } @@ -269,17 +269,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -289,17 +289,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -309,17 +309,17 @@ "type": "Identifier", "name": "count", "range": [ - 78, - 83 + 79, + 84 ], "loc": { "start": { "line": 5, - "column": 12 + "column": 11 }, "end": { "line": 5, - "column": 17 + "column": 16 } } }, @@ -329,17 +329,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -355,11 +355,11 @@ "loc": { "start": { "line": 8, - "column": 23 + "column": 24 }, "end": { "line": 8, - "column": 28 + "column": 29 } } }, @@ -369,17 +369,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -393,17 +393,17 @@ "type": "Identifier", "name": "message", "range": [ - 38, - 45 + 40, + 47 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 12 + "column": 13 } } } @@ -415,17 +415,17 @@ "type": "Identifier", "name": "message", "range": [ - 38, - 45 + 40, + 47 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 12 + "column": 13 } } }, @@ -435,17 +435,17 @@ "type": "Identifier", "name": "message", "range": [ - 38, - 45 + 40, + 47 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 12 + "column": 13 } } }, @@ -454,20 +454,20 @@ "arguments": [ { "type": "Literal", - "raw": "'hello'", + "raw": "\"hello\"", "value": "hello", "range": [ - 55, - 62 + 57, + 64 ], "loc": { "start": { "line": 3, - "column": 22 + "column": 23 }, "end": { "line": 3, - "column": 29 + "column": 30 } } } @@ -476,48 +476,48 @@ "type": "Identifier", "name": "$state", "range": [ - 48, - 54 + 50, + 56 ], "loc": { "start": { "line": 3, - "column": 15 + "column": 16 }, "end": { "line": 3, - "column": 21 + "column": 22 } } }, "optional": false, "range": [ - 48, - 63 + 50, + 65 ], "loc": { "start": { "line": 3, - "column": 15 + "column": 16 }, "end": { "line": 3, - "column": 30 + "column": 31 } } }, "range": [ - 38, - 63 + 40, + 65 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 30 + "column": 31 } } } @@ -529,17 +529,17 @@ "type": "Identifier", "name": "message", "range": [ - 38, - 45 + 40, + 47 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 12 + "column": 13 } } }, @@ -549,17 +549,17 @@ "type": "Identifier", "name": "message", "range": [ - 38, - 45 + 40, + 47 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 12 + "column": 13 } } } @@ -569,17 +569,17 @@ "type": "Identifier", "name": "message", "range": [ - 85, - 92 + 86, + 93 ], "loc": { "start": { "line": 5, - "column": 19 + "column": 18 }, "end": { "line": 5, - "column": 26 + "column": 25 } } }, @@ -589,17 +589,17 @@ "type": "Identifier", "name": "message", "range": [ - 38, - 45 + 40, + 47 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 12 + "column": 13 } } } @@ -609,17 +609,17 @@ "type": "Identifier", "name": "message", "range": [ - 231, - 238 + 233, + 240 ], "loc": { "start": { "line": 9, - "column": 19 + "column": 20 }, "end": { "line": 9, - "column": 26 + "column": 27 } } }, @@ -629,17 +629,17 @@ "type": "Identifier", "name": "message", "range": [ - 38, - 45 + 40, + 47 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 12 + "column": 13 } } } @@ -653,17 +653,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -673,17 +673,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -693,17 +693,17 @@ "type": "Identifier", "name": "$state", "range": [ - 22, - 28 + 23, + 29 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 19 + "column": 20 } } }, @@ -716,17 +716,17 @@ "type": "Identifier", "name": "message", "range": [ - 38, - 45 + 40, + 47 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 12 + "column": 13 } } }, @@ -736,17 +736,17 @@ "type": "Identifier", "name": "message", "range": [ - 38, - 45 + 40, + 47 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 12 + "column": 13 } } } @@ -756,17 +756,17 @@ "type": "Identifier", "name": "$state", "range": [ - 48, - 54 + 50, + 56 ], "loc": { "start": { "line": 3, - "column": 15 + "column": 16 }, "end": { "line": 3, - "column": 21 + "column": 22 } } }, @@ -779,17 +779,17 @@ "type": "Identifier", "name": "$inspect", "range": [ - 67, - 75 + 70, + 78 ], "loc": { "start": { "line": 5, - "column": 1 + "column": 2 }, "end": { "line": 5, - "column": 9 + "column": 10 } } }, @@ -802,17 +802,17 @@ "type": "Identifier", "name": "count", "range": [ - 78, - 83 + 79, + 84 ], "loc": { "start": { "line": 5, - "column": 12 + "column": 11 }, "end": { "line": 5, - "column": 17 + "column": 16 } } }, @@ -822,17 +822,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -842,17 +842,17 @@ "type": "Identifier", "name": "message", "range": [ - 85, - 92 + 86, + 93 ], "loc": { "start": { "line": 5, - "column": 19 + "column": 18 }, "end": { "line": 5, - "column": 26 + "column": 25 } } }, @@ -862,17 +862,17 @@ "type": "Identifier", "name": "message", "range": [ - 38, - 45 + 40, + 47 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 12 + "column": 13 } } } @@ -882,17 +882,17 @@ "type": "Identifier", "name": "message", "range": [ - 231, - 238 + 233, + 240 ], "loc": { "start": { "line": 9, - "column": 19 + "column": 20 }, "end": { "line": 9, - "column": 26 + "column": 27 } } }, @@ -902,17 +902,17 @@ "type": "Identifier", "name": "message", "range": [ - 38, - 45 + 40, + 47 ], "loc": { "start": { "line": 3, - "column": 5 + "column": 6 }, "end": { "line": 3, - "column": 12 + "column": 13 } } } @@ -934,11 +934,11 @@ "loc": { "start": { "line": 8, - "column": 23 + "column": 24 }, "end": { "line": 8, - "column": 28 + "column": 29 } } }, @@ -948,17 +948,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -977,11 +977,11 @@ "loc": { "start": { "line": 8, - "column": 23 + "column": 24 }, "end": { "line": 8, - "column": 28 + "column": 29 } } }, @@ -991,17 +991,17 @@ "type": "Identifier", "name": "count", "range": [ - 14, - 19 + 15, + 20 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -1015,17 +1015,17 @@ "type": "Identifier", "name": "$state", "range": [ - 22, - 28 + 23, + 29 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 19 + "column": 20 } } }, @@ -1038,17 +1038,17 @@ "type": "Identifier", "name": "$state", "range": [ - 48, - 54 + 50, + 56 ], "loc": { "start": { "line": 3, - "column": 15 + "column": 16 }, "end": { "line": 3, - "column": 21 + "column": 22 } } }, @@ -1061,17 +1061,17 @@ "type": "Identifier", "name": "$inspect", "range": [ - 67, - 75 + 70, + 78 ], "loc": { "start": { "line": 5, - "column": 1 + "column": 2 }, "end": { "line": 5, - "column": 9 + "column": 10 } } }, diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-ts-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-ts-input.svelte new file mode 100644 index 00000000..759aeeee --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-ts-input.svelte @@ -0,0 +1,9 @@ + + + + diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-ts-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-ts-output.json new file mode 100644 index 00000000..7db62744 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-ts-output.json @@ -0,0 +1,2194 @@ +{ + "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": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "optional": false, + "range": [ + 33, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 25, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + ], + "range": [ + 21, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "message", + "range": [ + 50, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "\"hello\"", + "value": "hello", + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 30 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 60, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 31 + } + } + }, + "range": [ + 50, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 31 + } + } + } + ], + "range": [ + 46, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 32 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Identifier", + "name": "message", + "range": [ + 96, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 25 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "optional": false, + "range": [ + 80, + 104 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "range": [ + 80, + 105 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 27 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 159, + 168 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + "range": [ + 0, + 168 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 168, + 170 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 8, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 171, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 178, + 185 + ], + "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": [ + 194, + 199 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 29 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 194, + 201 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 188, + 201 + ], + "loc": { + "start": { + "line": 8, + "column": 18 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + "range": [ + 187, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 32 + } + } + } + ], + "range": [ + 178, + 203 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 33 + } + } + } + ], + "selfClosing": false, + "range": [ + 170, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 34 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "Increment", + "range": [ + 204, + 213 + ], + "loc": { + "start": { + "line": 8, + "column": 34 + }, + "end": { + "line": 8, + "column": 43 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 213, + 222 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 52 + } + } + }, + "range": [ + 170, + 222 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 52 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 8, + "column": 52 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "input", + "range": [ + 224, + 229 + ], + "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": [ + 235, + 240 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "modifiers": [], + "range": [ + 230, + 240 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + "expression": { + "type": "Identifier", + "name": "message", + "range": [ + 243, + 250 + ], + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + "shorthand": false, + "range": [ + 230, + 252 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 29 + } + } + } + ], + "selfClosing": true, + "range": [ + 223, + 255 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 32 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 223, + 255 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 32 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " will console.log when `count` or `message` change", + "range": [ + 106, + 158 + ], + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 80 + } + } + } + ], + "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": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Numeric", + "value": "0", + "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": "Punctuator", + "value": ";", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 46, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 50, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 66, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "String", + "value": "\"hello\"", + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 31 + }, + "end": { + "line": 3, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "$inspect", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 96, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 103, + 104 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 160, + 161 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 161, + 167 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 168, + 170 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 8, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 171, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onclick", + "range": [ + 178, + 185 + ], + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 185, + 186 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 186, + 187 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 187, + 188 + ], + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 8, + "column": 18 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 8, + "column": 19 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 191, + 193 + ], + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "c", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "o", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 8, + "column": 25 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "u", + "range": [ + 196, + 197 + ], + "loc": { + "start": { + "line": 8, + "column": 26 + }, + "end": { + "line": 8, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "n", + "range": [ + 197, + 198 + ], + "loc": { + "start": { + "line": 8, + "column": 27 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + { + "type": "Identifier", + "value": "t", + "range": [ + 198, + 199 + ], + "loc": { + "start": { + "line": 8, + "column": 28 + }, + "end": { + "line": 8, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 199, + 200 + ], + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "+", + "range": [ + 200, + 201 + ], + "loc": { + "start": { + "line": 8, + "column": 30 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 31 + }, + "end": { + "line": 8, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 8, + "column": 32 + }, + "end": { + "line": 8, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 203, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 33 + }, + "end": { + "line": 8, + "column": 34 + } + } + }, + { + "type": "HTMLText", + "value": "Increment", + "range": [ + 204, + 213 + ], + "loc": { + "start": { + "line": 8, + "column": 34 + }, + "end": { + "line": 8, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 213, + 214 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 8, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 214, + 215 + ], + "loc": { + "start": { + "line": 8, + "column": 44 + }, + "end": { + "line": 8, + "column": 45 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 215, + 221 + ], + "loc": { + "start": { + "line": 8, + "column": 45 + }, + "end": { + "line": 8, + "column": 51 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 221, + 222 + ], + "loc": { + "start": { + "line": 8, + "column": 51 + }, + "end": { + "line": 8, + "column": 52 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 8, + "column": 52 + }, + "end": { + "line": 9, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 223, + 224 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "input", + "range": [ + 224, + 229 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "bind", + "range": [ + 230, + 234 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ":", + "range": [ + 234, + 235 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "value", + "range": [ + 235, + 240 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 240, + 241 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 241, + 242 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 242, + 243 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "message", + "range": [ + 243, + 250 + ], + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 250, + 251 + ], + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 9, + "column": 28 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 253, + 254 + ], + "loc": { + "start": { + "line": 9, + "column": 30 + }, + "end": { + "line": 9, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 254, + 255 + ], + "loc": { + "start": { + "line": 9, + "column": 31 + }, + "end": { + "line": 9, + "column": 32 + } + } + } + ], + "range": [ + 0, + 256 + ], + "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-1-$inspect-ts-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$inspect-ts-scope-output.json new file mode 100644 index 00000000..6dbde91f --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-1-$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": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "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": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "optional": false, + "range": [ + 33, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 25, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 194, + 199 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + } + ] + }, + { + "name": "message", + "identifiers": [ + { + "type": "Identifier", + "name": "message", + "range": [ + 50, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "message", + "range": [ + 50, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "message", + "range": [ + 50, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "\"hello\"", + "value": "hello", + "range": [ + 67, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 30 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 60, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 31 + } + } + }, + "range": [ + 50, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 31 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 50, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 50, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 96, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 50, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 243, + 250 + ], + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 50, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 50, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 50, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 96, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 50, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "message", + "range": [ + 243, + 250 + ], + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "message", + "range": [ + 50, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 194, + 199 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 194, + 199 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 60, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 80, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "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-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-input.svelte new file mode 100644 index 00000000..f0598c0e --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-input.svelte @@ -0,0 +1,11 @@ + + + diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-no-unused-vars-result.json new file mode 100644 index 00000000..11265b50 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-no-unused-vars-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "count", + "line": 4, + "column": 31 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-output.json new file mode 100644 index 00000000..e79635ef --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-output.json @@ -0,0 +1,1886 @@ +{ + "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": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "optional": false, + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 15, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + ], + "range": [ + 11, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "DebuggerStatement", + "range": [ + 112, + 121 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 15 + } + } + } + ], + "range": [ + 104, + 171 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "type", + "range": [ + 85, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "operator": "===", + "right": { + "type": "Literal", + "raw": "\"update\"", + "value": "update", + "range": [ + 94, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "range": [ + 85, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "range": [ + 81, + 171 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 7, + "column": 5 + } + } + } + ], + "range": [ + 75, + 175 + ], + "loc": { + "start": { + "line": 4, + "column": 40 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Identifier", + "name": "count", + "range": [ + 65, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 35 + } + } + } + ], + "range": [ + 58, + 175 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 8, + "column": 3 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 46, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 16 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 37, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "optional": false, + "range": [ + 37, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "with", + "range": [ + 53, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "range": [ + 37, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 37, + 176 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 8, + "column": 4 + } + } + }, + "range": [ + 37, + 177 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 8, + "column": 5 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 178, + 187 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "range": [ + 0, + 187 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 187, + 189 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 190, + 196 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 197, + 204 + ], + "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": [ + 213, + 218 + ], + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + "operator": "++", + "prefix": false, + "range": [ + 213, + 220 + ], + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [], + "range": [ + 207, + 220 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + "range": [ + 206, + 221 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 32 + } + } + } + ], + "range": [ + 197, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 33 + } + } + } + ], + "selfClosing": false, + "range": [ + 189, + 223 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 34 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "Increment", + "range": [ + 223, + 232 + ], + "loc": { + "start": { + "line": 11, + "column": 34 + }, + "end": { + "line": 11, + "column": 43 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 232, + 241 + ], + "loc": { + "start": { + "line": 11, + "column": 43 + }, + "end": { + "line": 11, + "column": 52 + } + } + }, + "range": [ + 189, + 241 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 52 + } + } + } + ], + "sourceType": "module", + "comments": [ + { + "type": "Line", + "value": " or `console.trace`, or whatever you want", + "range": [ + 122, + 165 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 59 + } + } + } + ], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Numeric", + "value": "0", + "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": "Punctuator", + "value": ";", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "$inspect", + "range": [ + 37, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 46, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "with", + "range": [ + 53, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 28 + }, + "end": { + "line": 4, + "column": 29 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 65, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 72, + 74 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 4, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 4, + "column": 40 + }, + "end": { + "line": 4, + "column": 41 + } + } + }, + { + "type": "Keyword", + "value": "if", + "range": [ + 81, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + { + "type": "Identifier", + "value": "type", + "range": [ + 85, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "===", + "range": [ + 90, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "String", + "value": "\"update\"", + "range": [ + 94, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + { + "type": "Keyword", + "value": "debugger", + "range": [ + 112, + 120 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 120, + 121 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 175, + 176 + ], + "loc": { + "start": { + "line": 8, + "column": 3 + }, + "end": { + "line": 8, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 176, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 179, + 180 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 180, + 186 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 186, + 187 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 187, + 189 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 190, + 196 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onclick", + "range": [ + 197, + 204 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 15 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 204, + 205 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 11, + "column": 16 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 206, + 207 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 207, + 208 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 208, + 209 + ], + "loc": { + "start": { + "line": 11, + "column": 19 + }, + "end": { + "line": 11, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 210, + 212 + ], + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 213, + 218 + ], + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "++", + "range": [ + 218, + 220 + ], + "loc": { + "start": { + "line": 11, + "column": 29 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 11, + "column": 31 + }, + "end": { + "line": 11, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "\"", + "range": [ + 221, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 32 + }, + "end": { + "line": 11, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 11, + "column": 33 + }, + "end": { + "line": 11, + "column": 34 + } + } + }, + { + "type": "HTMLText", + "value": "Increment", + "range": [ + 223, + 232 + ], + "loc": { + "start": { + "line": 11, + "column": 34 + }, + "end": { + "line": 11, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 232, + 233 + ], + "loc": { + "start": { + "line": 11, + "column": 43 + }, + "end": { + "line": 11, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 233, + 234 + ], + "loc": { + "start": { + "line": 11, + "column": 44 + }, + "end": { + "line": 11, + "column": 45 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 234, + 240 + ], + "loc": { + "start": { + "line": 11, + "column": 45 + }, + "end": { + "line": 11, + "column": 51 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 240, + 241 + ], + "loc": { + "start": { + "line": 11, + "column": 51 + }, + "end": { + "line": 11, + "column": 52 + } + } + } + ], + "range": [ + 0, + 242 + ], + "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/11-2-$inspect-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-scope-output.json new file mode 100644 index 00000000..12416a90 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$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": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "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": [ + 37, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "optional": false, + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 15, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 46, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 213, + 218 + ], + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 37, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 46, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "type", + "identifiers": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "DebuggerStatement", + "range": [ + 112, + 121 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 15 + } + } + } + ], + "range": [ + 104, + 171 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "type", + "range": [ + 85, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "operator": "===", + "right": { + "type": "Literal", + "raw": "\"update\"", + "value": "update", + "range": [ + 94, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "range": [ + 85, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "range": [ + 81, + 171 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 7, + "column": 5 + } + } + } + ], + "range": [ + 75, + 175 + ], + "loc": { + "start": { + "line": 4, + "column": 40 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Identifier", + "name": "count", + "range": [ + 65, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 35 + } + } + } + ], + "range": [ + 58, + 175 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 8, + "column": 3 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "type", + "range": [ + 85, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + } + } + ] + }, + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 65, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 35 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 65, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "DebuggerStatement", + "range": [ + 112, + 121 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 15 + } + } + } + ], + "range": [ + 104, + 171 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "type", + "range": [ + 85, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "operator": "===", + "right": { + "type": "Literal", + "raw": "\"update\"", + "value": "update", + "range": [ + 94, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "range": [ + 85, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "range": [ + 81, + 171 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 7, + "column": 5 + } + } + } + ], + "range": [ + 75, + 175 + ], + "loc": { + "start": { + "line": 4, + "column": 40 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Identifier", + "name": "count", + "range": [ + 65, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 35 + } + } + } + ], + "range": [ + 58, + 175 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 8, + "column": 3 + } + } + } + } + ], + "references": [] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "type", + "range": [ + 85, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "type", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + } + } + ], + "childScopes": [ + { + "type": "block", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + } + ], + "through": [] + }, + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 213, + 218 + ], + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 213, + 218 + ], + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 37, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "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 index 3edb00e1..244edb52 100644 --- 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 @@ -1,9 +1,11 @@ - - + diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-no-unused-vars-result.json new file mode 100644 index 00000000..11265b50 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-no-unused-vars-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "count", + "line": 4, + "column": 31 + } +] \ No newline at end of file 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 index 0cfa7780..0a711bb8 100644 --- 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 @@ -108,17 +108,17 @@ "type": "Identifier", "name": "count", "range": [ - 24, - 29 + 25, + 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -130,17 +130,17 @@ "raw": "0", "value": 0, "range": [ - 39, - 40 + 40, + 41 ], "loc": { "start": { "line": 2, - "column": 20 + "column": 21 }, "end": { "line": 2, - "column": 21 + "column": 22 } } } @@ -149,364 +149,381 @@ "type": "Identifier", "name": "$state", "range": [ - 32, - 38 + 33, + 39 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 19 + "column": 20 } } }, "optional": false, "range": [ - 32, - 41 + 33, + 42 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 22 + "column": 23 } } }, "range": [ - 24, - 41 + 25, + 42 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 22 + "column": 23 } } } ], "range": [ - 20, - 42 + 21, + 43 ], "loc": { "start": { "line": 2, - "column": 1 + "column": 2 }, "end": { "line": 2, - "column": 23 + "column": 24 } } }, { - "type": "VariableDeclaration", - "kind": "let", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "message", + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "DebuggerStatement", + "range": [ + 122, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 15 + } + } + } + ], + "range": [ + 114, + 181 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "type", + "range": [ + 95, + 99 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "operator": "===", + "right": { + "type": "Literal", + "raw": "\"update\"", + "value": "update", + "range": [ + 104, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "range": [ + 95, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "range": [ + 91, + 181 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 7, + "column": 5 + } + } + } + ], + "range": [ + 85, + 185 + ], + "loc": { + "start": { + "line": 4, + "column": 40 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 69, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Identifier", + "name": "count", + "range": [ + 75, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 35 + } + } + } + ], "range": [ - 48, - 55 + 68, + 185 ], "loc": { "start": { - "line": 3, - "column": 5 + "line": 4, + "column": 23 }, "end": { - "line": 3, - "column": 12 + "line": 8, + "column": 3 } } - }, - "init": { + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { "type": "CallExpression", "arguments": [ { - "type": "Literal", - "raw": "'hello'", - "value": "hello", + "type": "Identifier", + "name": "count", "range": [ - 65, - 72 + 56, + 61 ], "loc": { "start": { - "line": 3, - "column": 22 + "line": 4, + "column": 11 }, "end": { - "line": 3, - "column": 29 + "line": 4, + "column": 16 } } } ], "callee": { "type": "Identifier", - "name": "$state", + "name": "$inspect", "range": [ - 58, - 64 + 47, + 55 ], "loc": { "start": { - "line": 3, - "column": 15 + "line": 4, + "column": 2 }, "end": { - "line": 3, - "column": 21 + "line": 4, + "column": 10 } } }, "optional": false, "range": [ - 58, - 73 + 47, + 62 ], "loc": { "start": { - "line": 3, - "column": 15 + "line": 4, + "column": 2 }, "end": { - "line": 3, - "column": 30 + "line": 4, + "column": 17 } } }, - "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 - } - } - } - ], + "optional": false, + "property": { + "type": "Identifier", + "name": "with", "range": [ - 86, - 104 + 63, + 67 ], "loc": { "start": { - "line": 5, - "column": 10 + "line": 4, + "column": 18 }, "end": { - "line": 5, - "column": 28 + "line": 4, + "column": 22 } } - } - ], - "callee": { - "type": "Identifier", - "name": "$inspect", + }, "range": [ - 77, - 85 + 47, + 67 ], "loc": { "start": { - "line": 5, - "column": 1 + "line": 4, + "column": 2 }, "end": { - "line": 5, - "column": 9 + "line": 4, + "column": 22 } } }, "optional": false, "range": [ - 77, - 105 + 47, + 186 ], "loc": { "start": { - "line": 5, - "column": 1 + "line": 4, + "column": 2 }, "end": { - "line": 5, - "column": 29 + "line": 8, + "column": 4 } } }, "range": [ - 77, - 106 + 47, + 187 ], "loc": { "start": { - "line": 5, - "column": 1 + "line": 4, + "column": 2 }, "end": { - "line": 5, - "column": 30 + "line": 8, + "column": 5 } } } @@ -514,23 +531,23 @@ "endTag": { "type": "SvelteEndTag", "range": [ - 107, - 116 + 188, + 197 ], "loc": { "start": { - "line": 6, + "line": 9, "column": 0 }, "end": { - "line": 6, + "line": 9, "column": 9 } } }, "range": [ 0, - 116 + 197 ], "loc": { "start": { @@ -538,7 +555,7 @@ "column": 0 }, "end": { - "line": 6, + "line": 9, "column": 9 } } @@ -547,16 +564,16 @@ "type": "SvelteText", "value": "\n\n", "range": [ - 116, - 118 + 197, + 199 ], "loc": { "start": { - "line": 6, + "line": 9, "column": 9 }, "end": { - "line": 8, + "line": 11, "column": 0 } } @@ -568,16 +585,16 @@ "type": "SvelteName", "name": "button", "range": [ - 119, - 125 + 200, + 206 ], "loc": { "start": { - "line": 8, + "line": 11, "column": 1 }, "end": { - "line": 8, + "line": 11, "column": 7 } } @@ -591,16 +608,16 @@ "type": "SvelteName", "name": "onclick", "range": [ - 126, - 133 + 207, + 214 ], "loc": { "start": { - "line": 8, + "line": 11, "column": 8 }, "end": { - "line": 8, + "line": 11, "column": 15 } } @@ -619,34 +636,34 @@ "type": "Identifier", "name": "count", "range": [ - 141, - 146 + 223, + 228 ], "loc": { "start": { - "line": 8, - "column": 23 + "line": 11, + "column": 24 }, "end": { - "line": 8, - "column": 28 + "line": 11, + "column": 29 } } }, "operator": "++", "prefix": false, "range": [ - 141, - 148 + 223, + 230 ], "loc": { "start": { - "line": 8, - "column": 23 + "line": 11, + "column": 24 }, "end": { - "line": 8, - "column": 30 + "line": 11, + "column": 31 } } }, @@ -655,65 +672,65 @@ "id": null, "params": [], "range": [ - 135, - 148 + 217, + 230 ], "loc": { "start": { - "line": 8, - "column": 17 + "line": 11, + "column": 18 }, "end": { - "line": 8, - "column": 30 + "line": 11, + "column": 31 } } }, "range": [ - 134, - 149 + 216, + 231 ], "loc": { "start": { - "line": 8, - "column": 16 + "line": 11, + "column": 17 }, "end": { - "line": 8, - "column": 31 + "line": 11, + "column": 32 } } } ], "range": [ - 126, - 149 + 207, + 232 ], "loc": { "start": { - "line": 8, + "line": 11, "column": 8 }, "end": { - "line": 8, - "column": 31 + "line": 11, + "column": 33 } } } ], "selfClosing": false, "range": [ - 118, - 150 + 199, + 233 ], "loc": { "start": { - "line": 8, + "line": 11, "column": 0 }, "end": { - "line": 8, - "column": 32 + "line": 11, + "column": 34 } } }, @@ -722,17 +739,17 @@ "type": "SvelteText", "value": "Increment", "range": [ - 150, - 159 + 233, + 242 ], "loc": { "start": { - "line": 8, - "column": 32 + "line": 11, + "column": 34 }, "end": { - "line": 8, - "column": 41 + "line": 11, + "column": 43 } } } @@ -740,203 +757,73 @@ "endTag": { "type": "SvelteEndTag", "range": [ - 159, - 168 + 242, + 251 ], "loc": { "start": { - "line": 8, - "column": 41 + "line": 11, + "column": 43 }, "end": { - "line": 8, - "column": 50 + "line": 11, + "column": 52 } } }, "range": [ - 118, - 168 + 199, + 251 ], "loc": { "start": { - "line": 8, + "line": 11, "column": 0 }, "end": { - "line": 8, - "column": 50 + "line": 11, + "column": 52 } } - }, + } + ], + "sourceType": "module", + "comments": [ { - "type": "SvelteText", - "value": "\n", + "type": "Line", + "value": " or `console.trace`, or whatever you want", "range": [ - 168, - 169 + 132, + 175 ], "loc": { "start": { - "line": 8, - "column": 50 + "line": 6, + "column": 16 }, "end": { - "line": 9, + "line": 6, + "column": 59 + } + } + } + ], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, "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 + }, + "end": { + "line": 1, + "column": 1 } } }, @@ -1070,17 +957,17 @@ "type": "Keyword", "value": "let", "range": [ - 20, - 23 + 21, + 24 ], "loc": { "start": { "line": 2, - "column": 1 + "column": 2 }, "end": { "line": 2, - "column": 4 + "column": 5 } } }, @@ -1088,17 +975,17 @@ "type": "Identifier", "value": "count", "range": [ - 24, - 29 + 25, + 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -1106,17 +993,17 @@ "type": "Punctuator", "value": "=", "range": [ - 30, - 31 + 31, + 32 ], "loc": { "start": { "line": 2, - "column": 11 + "column": 12 }, "end": { "line": 2, - "column": 12 + "column": 13 } } }, @@ -1124,31 +1011,13 @@ "type": "Identifier", "value": "$state", "range": [ - 32, - 38 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 19 - } - } - }, - { - "type": "Punctuator", - "value": "(", - "range": [ - 38, + 33, 39 ], "loc": { "start": { "line": 2, - "column": 19 + "column": 14 }, "end": { "line": 2, @@ -1157,8 +1026,8 @@ } }, { - "type": "Numeric", - "value": "0", + "type": "Punctuator", + "value": "(", "range": [ 39, 40 @@ -1175,8 +1044,8 @@ } }, { - "type": "Punctuator", - "value": ")", + "type": "Numeric", + "value": "0", "range": [ 40, 41 @@ -1194,7 +1063,7 @@ }, { "type": "Punctuator", - "value": ";", + "value": ")", "range": [ 41, 42 @@ -1211,200 +1080,200 @@ } }, { - "type": "Keyword", - "value": "let", + "type": "Punctuator", + "value": ";", "range": [ - 44, - 47 + 42, + 43 ], "loc": { "start": { - "line": 3, - "column": 1 + "line": 2, + "column": 23 }, "end": { - "line": 3, - "column": 4 + "line": 2, + "column": 24 } } }, { "type": "Identifier", - "value": "message", + "value": "$inspect", "range": [ - 48, + 47, 55 ], "loc": { "start": { - "line": 3, - "column": 5 + "line": 4, + "column": 2 }, "end": { - "line": 3, - "column": 12 + "line": 4, + "column": 10 } } }, { "type": "Punctuator", - "value": "=", + "value": "(", "range": [ - 56, - 57 + 55, + 56 ], "loc": { "start": { - "line": 3, - "column": 13 + "line": 4, + "column": 10 }, "end": { - "line": 3, - "column": 14 + "line": 4, + "column": 11 } } }, { "type": "Identifier", - "value": "$state", + "value": "count", "range": [ - 58, - 64 + 56, + 61 ], "loc": { "start": { - "line": 3, - "column": 15 + "line": 4, + "column": 11 }, "end": { - "line": 3, - "column": 21 + "line": 4, + "column": 16 } } }, { "type": "Punctuator", - "value": "(", + "value": ")", "range": [ - 64, - 65 + 61, + 62 ], "loc": { "start": { - "line": 3, - "column": 21 + "line": 4, + "column": 16 }, "end": { - "line": 3, - "column": 22 + "line": 4, + "column": 17 } } }, { - "type": "String", - "value": "'hello'", + "type": "Punctuator", + "value": ".", "range": [ - 65, - 72 + 62, + 63 ], "loc": { "start": { - "line": 3, - "column": 22 + "line": 4, + "column": 17 }, "end": { - "line": 3, - "column": 29 + "line": 4, + "column": 18 } } }, { - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "with", "range": [ - 72, - 73 + 63, + 67 ], "loc": { "start": { - "line": 3, - "column": 29 + "line": 4, + "column": 18 }, "end": { - "line": 3, - "column": 30 + "line": 4, + "column": 22 } } }, { "type": "Punctuator", - "value": ";", + "value": "(", "range": [ - 73, - 74 + 67, + 68 ], "loc": { "start": { - "line": 3, - "column": 30 + "line": 4, + "column": 22 }, "end": { - "line": 3, - "column": 31 + "line": 4, + "column": 23 } } }, { - "type": "Identifier", - "value": "$inspect", + "type": "Punctuator", + "value": "(", "range": [ - 77, - 85 + 68, + 69 ], "loc": { "start": { - "line": 5, - "column": 1 + "line": 4, + "column": 23 }, "end": { - "line": 5, - "column": 9 + "line": 4, + "column": 24 } } }, { - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "type", "range": [ - 85, - 86 + 69, + 73 ], "loc": { "start": { - "line": 5, - "column": 9 + "line": 4, + "column": 24 }, "end": { - "line": 5, - "column": 10 + "line": 4, + "column": 28 } } }, { "type": "Punctuator", - "value": "{", + "value": ",", "range": [ - 86, - 87 + 73, + 74 ], "loc": { "start": { - "line": 5, - "column": 10 + "line": 4, + "column": 28 }, "end": { - "line": 5, - "column": 11 + "line": 4, + "column": 29 } } }, @@ -1412,773 +1281,773 @@ "type": "Identifier", "value": "count", "range": [ - 88, - 93 + 75, + 80 ], "loc": { "start": { - "line": 5, - "column": 12 + "line": 4, + "column": 30 }, "end": { - "line": 5, - "column": 17 + "line": 4, + "column": 35 } } }, { "type": "Punctuator", - "value": ",", + "value": ")", "range": [ - 93, - 94 + 80, + 81 ], "loc": { "start": { - "line": 5, - "column": 17 + "line": 4, + "column": 35 }, "end": { - "line": 5, - "column": 18 + "line": 4, + "column": 36 } } }, { - "type": "Identifier", - "value": "message", + "type": "Punctuator", + "value": "=>", "range": [ - 95, - 102 + 82, + 84 ], "loc": { "start": { - "line": 5, - "column": 19 + "line": 4, + "column": 37 }, "end": { - "line": 5, - "column": 26 + "line": 4, + "column": 39 } } }, { "type": "Punctuator", - "value": "}", + "value": "{", "range": [ - 103, - 104 + 85, + 86 ], "loc": { "start": { - "line": 5, - "column": 27 + "line": 4, + "column": 40 }, "end": { - "line": 5, - "column": 28 + "line": 4, + "column": 41 } } }, { - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "if", "range": [ - 104, - 105 + 91, + 93 ], "loc": { "start": { "line": 5, - "column": 28 + "column": 4 }, "end": { "line": 5, - "column": 29 + "column": 6 } } }, { "type": "Punctuator", - "value": ";", + "value": "(", "range": [ - 105, - 106 + 94, + 95 ], "loc": { "start": { "line": 5, - "column": 29 + "column": 7 }, "end": { "line": 5, - "column": 30 + "column": 8 } } }, { - "type": "Punctuator", - "value": "<", + "type": "Identifier", + "value": "type", "range": [ - 107, - 108 + 95, + 99 ], "loc": { "start": { - "line": 6, - "column": 0 + "line": 5, + "column": 8 }, "end": { - "line": 6, - "column": 1 + "line": 5, + "column": 12 } } }, { "type": "Punctuator", - "value": "/", + "value": "===", "range": [ - 108, - 109 + 100, + 103 ], "loc": { "start": { - "line": 6, - "column": 1 + "line": 5, + "column": 13 }, "end": { - "line": 6, - "column": 2 + "line": 5, + "column": 16 } } }, { - "type": "HTMLIdentifier", - "value": "script", + "type": "String", + "value": "\"update\"", "range": [ - 109, - 115 + 104, + 112 ], "loc": { "start": { - "line": 6, - "column": 2 + "line": 5, + "column": 17 }, "end": { - "line": 6, - "column": 8 + "line": 5, + "column": 25 } } }, { "type": "Punctuator", - "value": ">", + "value": ")", "range": [ - 115, - 116 + 112, + 113 ], "loc": { "start": { - "line": 6, - "column": 8 + "line": 5, + "column": 25 }, "end": { - "line": 6, - "column": 9 + "line": 5, + "column": 26 } } }, { - "type": "HTMLText", - "value": "\n\n", + "type": "Punctuator", + "value": "{", "range": [ - 116, - 118 + 114, + 115 ], "loc": { "start": { - "line": 6, - "column": 9 + "line": 5, + "column": 27 }, "end": { - "line": 8, - "column": 0 + "line": 5, + "column": 28 } } }, { - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "debugger", "range": [ - 118, - 119 + 122, + 130 ], "loc": { "start": { - "line": 8, - "column": 0 + "line": 6, + "column": 6 }, "end": { - "line": 8, - "column": 1 + "line": 6, + "column": 14 } } }, { - "type": "HTMLIdentifier", - "value": "button", + "type": "Punctuator", + "value": ";", "range": [ - 119, - 125 + 130, + 131 ], "loc": { "start": { - "line": 8, - "column": 1 + "line": 6, + "column": 14 }, "end": { - "line": 8, - "column": 7 + "line": 6, + "column": 15 } } }, { - "type": "HTMLIdentifier", - "value": "onclick", + "type": "Punctuator", + "value": "}", "range": [ - 126, - 133 + 180, + 181 ], "loc": { "start": { - "line": 8, - "column": 8 + "line": 7, + "column": 4 }, "end": { - "line": 8, - "column": 15 + "line": 7, + "column": 5 } } }, { "type": "Punctuator", - "value": "=", + "value": "}", "range": [ - 133, - 134 + 184, + 185 ], "loc": { "start": { "line": 8, - "column": 15 + "column": 2 }, "end": { "line": 8, - "column": 16 + "column": 3 } } }, { "type": "Punctuator", - "value": "{", + "value": ")", "range": [ - 134, - 135 + 185, + 186 ], "loc": { "start": { "line": 8, - "column": 16 + "column": 3 }, "end": { "line": 8, - "column": 17 + "column": 4 } } }, { "type": "Punctuator", - "value": "(", + "value": ";", "range": [ - 135, - 136 + 186, + 187 ], "loc": { "start": { "line": 8, - "column": 17 + "column": 4 }, "end": { "line": 8, - "column": 18 + "column": 5 } } }, { "type": "Punctuator", - "value": ")", + "value": "<", "range": [ - 136, - 137 + 188, + 189 ], "loc": { "start": { - "line": 8, - "column": 18 + "line": 9, + "column": 0 }, "end": { - "line": 8, - "column": 19 + "line": 9, + "column": 1 } } }, { "type": "Punctuator", - "value": "=>", + "value": "/", "range": [ - 138, - 140 + 189, + 190 ], "loc": { "start": { - "line": 8, - "column": 20 + "line": 9, + "column": 1 }, "end": { - "line": 8, - "column": 22 + "line": 9, + "column": 2 } } }, { - "type": "Identifier", - "value": "c", + "type": "HTMLIdentifier", + "value": "script", "range": [ - 141, - 142 + 190, + 196 ], "loc": { "start": { - "line": 8, - "column": 23 + "line": 9, + "column": 2 }, "end": { - "line": 8, - "column": 24 + "line": 9, + "column": 8 } } }, { - "type": "Identifier", - "value": "o", + "type": "Punctuator", + "value": ">", "range": [ - 142, - 143 + 196, + 197 ], "loc": { "start": { - "line": 8, - "column": 24 + "line": 9, + "column": 8 }, "end": { - "line": 8, - "column": 25 + "line": 9, + "column": 9 } } }, { - "type": "Identifier", - "value": "u", + "type": "HTMLText", + "value": "\n\n", "range": [ - 143, - 144 + 197, + 199 ], "loc": { "start": { - "line": 8, - "column": 25 + "line": 9, + "column": 9 }, "end": { - "line": 8, - "column": 26 + "line": 11, + "column": 0 } } }, { - "type": "Identifier", - "value": "n", + "type": "Punctuator", + "value": "<", "range": [ - 144, - 145 + 199, + 200 ], "loc": { "start": { - "line": 8, - "column": 26 + "line": 11, + "column": 0 }, "end": { - "line": 8, - "column": 27 + "line": 11, + "column": 1 } } }, { - "type": "Identifier", - "value": "t", + "type": "HTMLIdentifier", + "value": "button", "range": [ - 145, - 146 + 200, + 206 ], "loc": { "start": { - "line": 8, - "column": 27 + "line": 11, + "column": 1 }, "end": { - "line": 8, - "column": 28 + "line": 11, + "column": 7 } } }, { - "type": "Punctuator", - "value": "+", + "type": "HTMLIdentifier", + "value": "onclick", "range": [ - 146, - 147 + 207, + 214 ], "loc": { "start": { - "line": 8, - "column": 28 + "line": 11, + "column": 8 }, "end": { - "line": 8, - "column": 29 + "line": 11, + "column": 15 } } }, { "type": "Punctuator", - "value": "+", + "value": "=", "range": [ - 147, - 148 + 214, + 215 ], "loc": { "start": { - "line": 8, - "column": 29 + "line": 11, + "column": 15 }, "end": { - "line": 8, - "column": 30 + "line": 11, + "column": 16 } } }, { "type": "Punctuator", - "value": "}", + "value": "\"", "range": [ - 148, - 149 + 215, + 216 ], "loc": { "start": { - "line": 8, - "column": 30 + "line": 11, + "column": 16 }, "end": { - "line": 8, - "column": 31 + "line": 11, + "column": 17 } } }, { "type": "Punctuator", - "value": ">", + "value": "{", "range": [ - 149, - 150 + 216, + 217 ], "loc": { "start": { - "line": 8, - "column": 31 + "line": 11, + "column": 17 }, "end": { - "line": 8, - "column": 32 + "line": 11, + "column": 18 } } }, { - "type": "HTMLText", - "value": "Increment", + "type": "Punctuator", + "value": "(", "range": [ - 150, - 159 + 217, + 218 ], "loc": { "start": { - "line": 8, - "column": 32 + "line": 11, + "column": 18 }, "end": { - "line": 8, - "column": 41 + "line": 11, + "column": 19 } } }, { "type": "Punctuator", - "value": "<", + "value": ")", "range": [ - 159, - 160 + 218, + 219 ], "loc": { "start": { - "line": 8, - "column": 41 + "line": 11, + "column": 19 }, "end": { - "line": 8, - "column": 42 + "line": 11, + "column": 20 } } }, { "type": "Punctuator", - "value": "/", + "value": "=>", "range": [ - 160, - 161 + 220, + 222 ], "loc": { "start": { - "line": 8, - "column": 42 + "line": 11, + "column": 21 }, "end": { - "line": 8, - "column": 43 + "line": 11, + "column": 23 } } }, { - "type": "HTMLIdentifier", - "value": "button", + "type": "Identifier", + "value": "c", "range": [ - 161, - 167 + 223, + 224 ], "loc": { "start": { - "line": 8, - "column": 43 + "line": 11, + "column": 24 }, "end": { - "line": 8, - "column": 49 + "line": 11, + "column": 25 } } }, { - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "o", "range": [ - 167, - 168 + 224, + 225 ], "loc": { "start": { - "line": 8, - "column": 49 + "line": 11, + "column": 25 }, "end": { - "line": 8, - "column": 50 + "line": 11, + "column": 26 } } }, { - "type": "HTMLText", - "value": "\n", + "type": "Identifier", + "value": "u", "range": [ - 168, - 169 + 225, + 226 ], "loc": { "start": { - "line": 8, - "column": 50 + "line": 11, + "column": 26 }, "end": { - "line": 9, - "column": 0 + "line": 11, + "column": 27 } } }, { - "type": "Punctuator", - "value": "<", + "type": "Identifier", + "value": "n", "range": [ - 169, - 170 + 226, + 227 ], "loc": { "start": { - "line": 9, - "column": 0 + "line": 11, + "column": 27 }, "end": { - "line": 9, - "column": 1 + "line": 11, + "column": 28 } } }, { - "type": "HTMLIdentifier", - "value": "input", + "type": "Identifier", + "value": "t", "range": [ - 170, - 175 + 227, + 228 ], "loc": { "start": { - "line": 9, - "column": 1 + "line": 11, + "column": 28 }, "end": { - "line": 9, - "column": 6 + "line": 11, + "column": 29 } } }, { - "type": "HTMLIdentifier", - "value": "bind", + "type": "Punctuator", + "value": "+", "range": [ - 176, - 180 + 228, + 229 ], "loc": { "start": { - "line": 9, - "column": 7 + "line": 11, + "column": 29 }, "end": { - "line": 9, - "column": 11 + "line": 11, + "column": 30 } } }, { "type": "Punctuator", - "value": ":", + "value": "+", "range": [ - 180, - 181 + 229, + 230 ], "loc": { "start": { - "line": 9, - "column": 11 + "line": 11, + "column": 30 }, "end": { - "line": 9, - "column": 12 + "line": 11, + "column": 31 } } }, { - "type": "HTMLIdentifier", - "value": "value", + "type": "Punctuator", + "value": "}", "range": [ - 181, - 186 + 230, + 231 ], "loc": { "start": { - "line": 9, - "column": 12 + "line": 11, + "column": 31 }, "end": { - "line": 9, - "column": 17 + "line": 11, + "column": 32 } } }, { "type": "Punctuator", - "value": "=", + "value": "\"", "range": [ - 186, - 187 + 231, + 232 ], "loc": { "start": { - "line": 9, - "column": 17 + "line": 11, + "column": 32 }, "end": { - "line": 9, - "column": 18 + "line": 11, + "column": 33 } } }, { "type": "Punctuator", - "value": "{", + "value": ">", "range": [ - 187, - 188 + 232, + 233 ], "loc": { "start": { - "line": 9, - "column": 18 + "line": 11, + "column": 33 }, "end": { - "line": 9, - "column": 19 + "line": 11, + "column": 34 } } }, { - "type": "Identifier", - "value": "message", + "type": "HTMLText", + "value": "Increment", "range": [ - 188, - 195 + 233, + 242 ], "loc": { "start": { - "line": 9, - "column": 19 + "line": 11, + "column": 34 }, "end": { - "line": 9, - "column": 26 + "line": 11, + "column": 43 } } }, { "type": "Punctuator", - "value": "}", + "value": "<", "range": [ - 195, - 196 + 242, + 243 ], "loc": { "start": { - "line": 9, - "column": 26 + "line": 11, + "column": 43 }, "end": { - "line": 9, - "column": 27 + "line": 11, + "column": 44 } } }, @@ -2186,17 +2055,35 @@ "type": "Punctuator", "value": "/", "range": [ - 197, - 198 + 243, + 244 ], "loc": { "start": { - "line": 9, - "column": 28 + "line": 11, + "column": 44 }, "end": { - "line": 9, - "column": 29 + "line": 11, + "column": 45 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 244, + 250 + ], + "loc": { + "start": { + "line": 11, + "column": 45 + }, + "end": { + "line": 11, + "column": 51 } } }, @@ -2204,24 +2091,24 @@ "type": "Punctuator", "value": ">", "range": [ - 198, - 199 + 250, + 251 ], "loc": { "start": { - "line": 9, - "column": 29 + "line": 11, + "column": 51 }, "end": { - "line": 9, - "column": 30 + "line": 11, + "column": 52 } } } ], "range": [ 0, - 200 + 252 ], "loc": { "start": { @@ -2229,7 +2116,7 @@ "column": 0 }, "end": { - "line": 10, + "line": 12, "column": 0 } } 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 index 361cefeb..fe7b1e2e 100644 --- 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 @@ -29,40 +29,17 @@ "type": "Identifier", "name": "$state", "range": [ - 32, - 38 + 33, + 39 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "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 + "column": 20 } } }, @@ -100,17 +77,17 @@ "type": "Identifier", "name": "$inspect", "range": [ - 77, - 85 + 47, + 55 ], "loc": { "start": { - "line": 5, - "column": 1 + "line": 4, + "column": 2 }, "end": { - "line": 5, - "column": 9 + "line": 4, + "column": 10 } } }, @@ -133,17 +110,17 @@ "type": "Identifier", "name": "count", "range": [ - 24, - 29 + 25, + 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -155,17 +132,17 @@ "type": "Identifier", "name": "count", "range": [ - 24, - 29 + 25, + 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -175,17 +152,17 @@ "type": "Identifier", "name": "count", "range": [ - 24, - 29 + 25, + 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -197,17 +174,17 @@ "raw": "0", "value": 0, "range": [ - 39, - 40 + 40, + 41 ], "loc": { "start": { "line": 2, - "column": 20 + "column": 21 }, "end": { "line": 2, - "column": 21 + "column": 22 } } } @@ -216,48 +193,48 @@ "type": "Identifier", "name": "$state", "range": [ - 32, - 38 + 33, + 39 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 19 + "column": 20 } } }, "optional": false, "range": [ - 32, - 41 + 33, + 42 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "end": { "line": 2, - "column": 22 + "column": 23 } } }, "range": [ - 24, - 41 + 25, + 42 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 22 + "column": 23 } } } @@ -269,17 +246,17 @@ "type": "Identifier", "name": "count", "range": [ - 24, - 29 + 25, + 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -289,17 +266,17 @@ "type": "Identifier", "name": "count", "range": [ - 24, - 29 + 25, + 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -309,17 +286,17 @@ "type": "Identifier", "name": "count", "range": [ - 88, - 93 + 56, + 61 ], "loc": { "start": { - "line": 5, - "column": 12 + "line": 4, + "column": 11 }, "end": { - "line": 5, - "column": 17 + "line": 4, + "column": 16 } } }, @@ -329,17 +306,17 @@ "type": "Identifier", "name": "count", "range": [ - 24, - 29 + 25, + 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -349,17 +326,17 @@ "type": "Identifier", "name": "count", "range": [ - 141, - 146 + 223, + 228 ], "loc": { "start": { - "line": 8, - "column": 23 + "line": 11, + "column": 24 }, "end": { - "line": 8, - "column": 28 + "line": 11, + "column": 29 } } }, @@ -369,277 +346,17 @@ "type": "Identifier", "name": "count", "range": [ - 24, - 29 + 25, + 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "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 + "column": 11 } } } @@ -653,17 +370,17 @@ "type": "Identifier", "name": "count", "range": [ - 24, - 29 + 25, + 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } }, @@ -673,17 +390,17 @@ "type": "Identifier", "name": "count", "range": [ - 24, - 29 + 25, + 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -693,80 +410,17 @@ "type": "Identifier", "name": "$state", "range": [ - 32, - 38 + 33, + 39 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "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 + "column": 20 } } }, @@ -779,17 +433,17 @@ "type": "Identifier", "name": "$inspect", "range": [ - 77, - 85 + 47, + 55 ], "loc": { "start": { - "line": 5, - "column": 1 + "line": 4, + "column": 2 }, "end": { - "line": 5, - "column": 9 + "line": 4, + "column": 10 } } }, @@ -802,17 +456,17 @@ "type": "Identifier", "name": "count", "range": [ - 88, - 93 + 56, + 61 ], "loc": { "start": { - "line": 5, - "column": 12 + "line": 4, + "column": 11 }, "end": { - "line": 5, - "column": 17 + "line": 4, + "column": 16 } } }, @@ -822,103 +476,589 @@ "type": "Identifier", "name": "count", "range": [ - 24, - 29 + 25, + 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } - }, + } + ], + "childScopes": [ { - "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 - } + "type": "function", + "variables": [ + { + "name": "type", + "identifiers": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 69, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "type", + "range": [ + 69, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "DebuggerStatement", + "range": [ + 122, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 15 + } + } + } + ], + "range": [ + 114, + 181 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "type", + "range": [ + 95, + 99 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "operator": "===", + "right": { + "type": "Literal", + "raw": "\"update\"", + "value": "update", + "range": [ + 104, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "range": [ + 95, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "range": [ + 91, + 181 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 7, + "column": 5 + } + } + } + ], + "range": [ + 85, + 185 + ], + "loc": { + "start": { + "line": 4, + "column": 40 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 69, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Identifier", + "name": "count", + "range": [ + 75, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 35 + } + } + } + ], + "range": [ + 68, + 185 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 8, + "column": 3 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "type", + "range": [ + 95, + 99 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "type", + "range": [ + 69, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + } + } + ] + }, + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 75, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 35 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 75, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "alternate": null, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "DebuggerStatement", + "range": [ + 122, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 15 + } + } + } + ], + "range": [ + 114, + 181 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "test": { + "type": "BinaryExpression", + "left": { + "type": "Identifier", + "name": "type", + "range": [ + 95, + 99 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "operator": "===", + "right": { + "type": "Literal", + "raw": "\"update\"", + "value": "update", + "range": [ + 104, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "range": [ + 95, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "range": [ + 91, + 181 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 7, + "column": 5 + } + } + } + ], + "range": [ + 85, + 185 + ], + "loc": { + "start": { + "line": 4, + "column": 40 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 69, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": "Identifier", + "name": "count", + "range": [ + 75, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 35 + } + } + } + ], + "range": [ + 68, + 185 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 8, + "column": 3 + } + } + } + } + ], + "references": [] } - } - }, - { - "identifier": { - "type": "Identifier", - "name": "message", - "range": [ - 188, - 195 - ], - "loc": { - "start": { - "line": 9, - "column": 19 + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "type", + "range": [ + 95, + 99 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 12 + } + } }, - "end": { - "line": 9, - "column": 26 + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "type", + "range": [ + 69, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } } } - }, - "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": "block", + "variables": [], + "references": [], + "childScopes": [], + "through": [] } - } - } - ], - "childScopes": [ + ], + "through": [] + }, { "type": "function", "variables": [], @@ -928,17 +1068,17 @@ "type": "Identifier", "name": "count", "range": [ - 141, - 146 + 223, + 228 ], "loc": { "start": { - "line": 8, - "column": 23 + "line": 11, + "column": 24 }, "end": { - "line": 8, - "column": 28 + "line": 11, + "column": 29 } } }, @@ -948,17 +1088,17 @@ "type": "Identifier", "name": "count", "range": [ - 24, - 29 + 25, + 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -971,17 +1111,17 @@ "type": "Identifier", "name": "count", "range": [ - 141, - 146 + 223, + 228 ], "loc": { "start": { - "line": 8, - "column": 23 + "line": 11, + "column": 24 }, "end": { - "line": 8, - "column": 28 + "line": 11, + "column": 29 } } }, @@ -991,17 +1131,17 @@ "type": "Identifier", "name": "count", "range": [ - 24, - 29 + 25, + 30 ], "loc": { "start": { "line": 2, - "column": 5 + "column": 6 }, "end": { "line": 2, - "column": 10 + "column": 11 } } } @@ -1015,40 +1155,17 @@ "type": "Identifier", "name": "$state", "range": [ - 32, - 38 + 33, + 39 ], "loc": { "start": { "line": 2, - "column": 13 + "column": 14 }, "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 + "column": 20 } } }, @@ -1061,17 +1178,17 @@ "type": "Identifier", "name": "$inspect", "range": [ - 77, - 85 + 47, + 55 ], "loc": { "start": { - "line": 5, - "column": 1 + "line": 4, + "column": 2 }, "end": { - "line": 5, - "column": 9 + "line": 4, + "column": 10 } } }, 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 deleted file mode 100644 index 0f8721ce..00000000 --- a/tests/fixtures/parser/ast/svelte5/docs/runes/11-2-$inspect-ts-type-output.svelte +++ /dev/null @@ -1,9 +0,0 @@ - - - - diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-input.svelte new file mode 100644 index 00000000..ec6fb104 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-input.svelte @@ -0,0 +1,5 @@ + diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-output.json new file mode 100644 index 00000000..e6cca05a --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-output.json @@ -0,0 +1,879 @@ +{ + "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": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "optional": false, + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 15, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + ], + "range": [ + 11, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 58, + 65 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "trace", + "range": [ + 66, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + "range": [ + 58, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 36 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 46, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 16 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 37, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "optional": false, + "range": [ + 37, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "with", + "range": [ + 53, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "range": [ + 37, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 37, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "range": [ + 37, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 38 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 74, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "range": [ + 0, + 83 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "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": [ + 11, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Numeric", + "value": "0", + "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": "Punctuator", + "value": ";", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "$inspect", + "range": [ + 37, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 45, + 46 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 46, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "with", + "range": [ + 53, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 58, + 65 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "trace", + "range": [ + 66, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 71, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 36 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 72, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 4, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 76, + 82 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + } + ], + "range": [ + 0, + 84 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-prefer-const-result.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-prefer-const-result.json new file mode 100644 index 00000000..d0b164c6 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "count", + "line": 2, + "column": 7 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-scope-output.json new file mode 100644 index 00000000..28fd9e9d --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-scope-output.json @@ -0,0 +1,577 @@ +{ + "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": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "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": [ + 37, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "optional": false, + "range": [ + 23, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 15, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 46, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 37, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 46, + 51 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 15, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 58, + 65 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 23, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 37, + 45 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 58, + 65 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 58, + 65 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-input.svelte new file mode 100644 index 00000000..eecaa652 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-input.svelte @@ -0,0 +1,5 @@ + diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-output.json new file mode 100644 index 00000000..3a146be6 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-output.json @@ -0,0 +1,1026 @@ +{ + "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": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "optional": false, + "range": [ + 33, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 25, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + ], + "range": [ + 21, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "console", + "range": [ + 68, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "trace", + "range": [ + 76, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + "range": [ + 68, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 36 + } + } + } + ], + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 16 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "optional": false, + "range": [ + 47, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "optional": false, + "property": { + "type": "Identifier", + "name": "with", + "range": [ + 63, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "range": [ + 47, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "optional": false, + "range": [ + 47, + 82 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + "range": [ + 47, + 83 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 38 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 84, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "range": [ + 0, + 93 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "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": "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": [ + 21, + 24 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Numeric", + "value": "0", + "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": "Punctuator", + "value": ";", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "$inspect", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": "Identifier", + "value": "count", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 61, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": "Keyword", + "value": "with", + "range": [ + 63, + 67 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 67, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "console", + "range": [ + 68, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ".", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 31 + } + } + }, + { + "type": "Identifier", + "value": "trace", + "range": [ + 76, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 4, + "column": 36 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 82, + 83 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 4, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 86, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + } + ], + "range": [ + 0, + 94 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-prefer-const-result.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-prefer-const-result.json new file mode 100644 index 00000000..d0b164c6 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-prefer-const-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "prefer-const", + "code": "count", + "line": 2, + "column": 7 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-scope-output.json new file mode 100644 index 00000000..60129978 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/runes/11-3-$inspect-ts-scope-output.json @@ -0,0 +1,577 @@ +{ + "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": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "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": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "count", + "identifiers": [ + { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "0", + "value": 0, + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "optional": false, + "range": [ + 33, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "range": [ + 25, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 23 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "count", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "count", + "range": [ + 25, + 30 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 11 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 68, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$inspect", + "range": [ + 47, + 55 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 68, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "console", + "range": [ + 68, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file