diff --git a/.changeset/gold-geese-refuse.md b/.changeset/gold-geese-refuse.md new file mode 100644 index 00000000..f5e6b5bc --- /dev/null +++ b/.changeset/gold-geese-refuse.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": minor +--- + +feat: add support for `` diff --git a/package.json b/package.json index 0a86eb0e..db297e4c 100644 --- a/package.json +++ b/package.json @@ -55,10 +55,10 @@ } }, "dependencies": { - "eslint-scope": "^8.0.0", + "eslint-scope": "^8.2.0", "eslint-visitor-keys": "^3.4.3", "espree": "^9.6.1", - "postcss": "^8.4.39", + "postcss": "^8.4.49", "postcss-scss": "^4.0.9" }, "devDependencies": { @@ -94,8 +94,8 @@ "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-regexp": "^2.7.0", "eslint-plugin-svelte": "^2.46.1", - "eslint-plugin-yml": "^1.15.0", - "globals": "^15.12.0", + "eslint-plugin-yml": "^1.16.0", + "globals": "^15.13.0", "locate-character": "^3.0.0", "magic-string": "^0.30.14", "mocha": "^10.8.2", @@ -106,7 +106,7 @@ "prettier-plugin-svelte": "^3.3.2", "rimraf": "^6.0.1", "semver": "^7.6.3", - "svelte": "^5.2.11", + "svelte": "^5.3.1", "svelte2tsx": "^0.7.28", "typescript": "~5.7.2", "typescript-eslint": "^8.16.0", diff --git a/src/parser/analyze-scope.ts b/src/parser/analyze-scope.ts index acde052b..caa384c6 100644 --- a/src/parser/analyze-scope.ts +++ b/src/parser/analyze-scope.ts @@ -294,7 +294,9 @@ export function analyzeSnippetsScope( if ( parent.type === "SvelteElement" && (parent.kind === "component" || - (parent.kind === "special" && parent.name.name === "svelte:component")) + (parent.kind === "special" && + (parent.name.name === "svelte:component" || + parent.name.name === "svelte:boundary"))) ) { const scope = getScopeFromNode(scopeManager, snippet.id); const upperScope = scope.upper; diff --git a/src/parser/converts/element.ts b/src/parser/converts/element.ts index ef838c48..b220e493 100644 --- a/src/parser/converts/element.ts +++ b/src/parser/converts/element.ts @@ -210,6 +210,10 @@ export function* convertChildren( yield convertDocumentElement(child, parent, ctx); continue; } + if (child.type === "SvelteBoundary") { + yield convertSvelteBoundaryElement(child, parent, ctx); + continue; + } throw new Error(`Unknown type:${child.type}`); } @@ -415,7 +419,8 @@ function convertSpecialElement( | Compiler.SvelteDocument | Compiler.SvelteFragment | Compiler.SvelteSelf - | Compiler.SvelteOptionsRaw, + | Compiler.SvelteOptionsRaw + | Compiler.SvelteBoundary, parent: SvelteSpecialElement["parent"], ctx: Context, ): SvelteSpecialElement { @@ -898,6 +903,15 @@ function convertSlotTemplateElement( return convertSpecialElement(node, parent, ctx); } +/** Convert for element. */ +function convertSvelteBoundaryElement( + node: Compiler.SvelteBoundary, + parent: SvelteSpecialElement["parent"], + ctx: Context, +): SvelteSpecialElement { + return convertSpecialElement(node, parent, ctx); +} + /** Extract element tag and tokens */ export function extractElementTags< E extends SvelteScriptElement | SvelteElement | SvelteStyleElement, diff --git a/src/parser/svelte-ast-types-for-v5.ts b/src/parser/svelte-ast-types-for-v5.ts index 5e34c998..9c8fd9d9 100644 --- a/src/parser/svelte-ast-types-for-v5.ts +++ b/src/parser/svelte-ast-types-for-v5.ts @@ -26,6 +26,7 @@ export type SvelteHead = AST.SvelteHead; export type SvelteOptionsRaw = AST.SvelteOptionsRaw; export type SvelteSelf = AST.SvelteSelf; export type SvelteWindow = AST.SvelteWindow; +export type SvelteBoundary = AST.SvelteBoundary; export type IfBlock = AST.IfBlock; export type EachBlock = AST.EachBlock; @@ -59,7 +60,8 @@ export type ElementLike = | SvelteHead | SvelteOptionsRaw | SvelteSelf - | SvelteWindow; + | SvelteWindow + | SvelteBoundary; export type Block = EachBlock | IfBlock | AwaitBlock | KeyBlock | SnippetBlock; export type Directive = diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/01-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/01-input.svelte new file mode 100644 index 00000000..044589e8 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/01-input.svelte @@ -0,0 +1 @@ +... diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/01-no-undef-result.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/01-no-undef-result.json new file mode 100644 index 00000000..821f1859 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/01-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "handler", + "line": 1, + "column": 27 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/01-output.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/01-output.json new file mode 100644 index 00000000..60e6714d --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/01-output.json @@ -0,0 +1,424 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteElement", + "kind": "special", + "name": { + "type": "SvelteName", + "name": "svelte:boundary", + "range": [ + 1, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onerror", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "handler", + "range": [ + 26, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "range": [ + 25, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "range": [ + 17, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "...", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 38 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 38, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "svelte:boundary", + "range": [ + 1, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onerror", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Identifier", + "value": "handler", + "range": [ + 26, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 35 + } + } + }, + { + "type": "HTMLText", + "value": "...", + "range": [ + 35, + 38 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 1, + "column": 38 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "svelte:boundary", + "range": [ + 40, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 55 + }, + "end": { + "line": 1, + "column": 56 + } + } + } + ], + "range": [ + 0, + 57 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/01-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/01-scope-output.json new file mode 100644 index 00000000..e674e0ec --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/01-scope-output.json @@ -0,0 +1,148 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$bindable", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "handler", + "range": [ + 26, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "handler", + "range": [ + 26, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "handler", + "range": [ + 26, + 33 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 33 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-input.svelte new file mode 100644 index 00000000..ecee941f --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-input.svelte @@ -0,0 +1,7 @@ + + + + {#snippet failed(error, reset)} + + {/snippet} + diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-no-undef-result.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-no-undef-result.json new file mode 100644 index 00000000..d98f8d90 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "FlakyComponent", + "line": 2, + "column": 3 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-no-unused-vars-result.json new file mode 100644 index 00000000..7c68c70c --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-no-unused-vars-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "error", + "line": 4, + "column": 19 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-output.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-output.json new file mode 100644 index 00000000..2fa8291f --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-output.json @@ -0,0 +1,1224 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteElement", + "kind": "special", + "name": { + "type": "SvelteName", + "name": "svelte:boundary", + "range": [ + 1, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": false, + "range": [ + 0, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "component", + "name": { + "type": "Identifier", + "name": "FlakyComponent", + "range": [ + 20, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": true, + "range": [ + 19, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 19, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n\t", + "range": [ + 37, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + { + "type": "SvelteSnippetBlock", + "id": { + "type": "Identifier", + "name": "failed", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Identifier", + "name": "reset", + "range": [ + 64, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 30 + } + } + } + ], + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 75, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 82, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "reset", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "range": [ + 90, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 25 + } + } + } + ], + "range": [ + 82, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 25 + } + } + } + ], + "selfClosing": false, + "range": [ + 74, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "oops! try again", + "range": [ + 98, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 41 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 113, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 41 + }, + "end": { + "line": 5, + "column": 50 + } + } + }, + "range": [ + 74, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 50 + } + } + } + ], + "range": [ + 40, + 134 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 7, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 135, + 153 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + "range": [ + 0, + 153 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 18 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "svelte:boundary", + "range": [ + 1, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 17, + 19 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "FlakyComponent", + "range": [ + 20, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n\t", + "range": [ + 37, + 40 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 4, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#snippet", + "range": [ + 41, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": "Identifier", + "value": "failed", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "error", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + { + "type": "Identifier", + "value": "reset", + "range": [ + 64, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 70, + 71 + ], + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 32 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 74, + 75 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 75, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onclick", + "range": [ + 82, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 90, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Identifier", + "value": "reset", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "HTMLText", + "value": "oops!", + "range": [ + 98, + 103 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 103, + 104 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 32 + } + } + }, + { + "type": "HTMLText", + "value": "try", + "range": [ + 104, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 32 + }, + "end": { + "line": 5, + "column": 35 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 107, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + { + "type": "HTMLText", + "value": "again", + "range": [ + 108, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 36 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 113, + 114 + ], + "loc": { + "start": { + "line": 5, + "column": 41 + }, + "end": { + "line": 5, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 114, + 115 + ], + "loc": { + "start": { + "line": 5, + "column": 42 + }, + "end": { + "line": 5, + "column": 43 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 115, + 121 + ], + "loc": { + "start": { + "line": 5, + "column": 43 + }, + "end": { + "line": 5, + "column": 49 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 49 + }, + "end": { + "line": 5, + "column": 50 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 124, + 125 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/snippet", + "range": [ + 125, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 133, + 134 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 7, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "svelte:boundary", + "range": [ + 137, + 152 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 7, + "column": 18 + } + } + } + ], + "range": [ + 0, + 154 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-scope-output.json new file mode 100644 index 00000000..300d188e --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/02-scope-output.json @@ -0,0 +1,1186 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$bindable", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [], + "references": [], + "childScopes": [ + { + "type": "block", + "variables": [ + { + "name": "failed", + "identifiers": [ + { + "type": "Identifier", + "name": "failed", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 17 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "failed", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "node": { + "type": "SvelteSnippetBlock", + "id": { + "type": "Identifier", + "name": "failed", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Identifier", + "name": "reset", + "range": [ + 64, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 30 + } + } + } + ], + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 75, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 82, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "reset", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "range": [ + 90, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 25 + } + } + } + ], + "range": [ + 82, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 25 + } + } + } + ], + "selfClosing": false, + "range": [ + 74, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "oops! try again", + "range": [ + 98, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 41 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 113, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 41 + }, + "end": { + "line": 5, + "column": 50 + } + } + }, + "range": [ + 74, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 50 + } + } + } + ], + "range": [ + 40, + 134 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 6, + "column": 11 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "failed", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "from": "block", + "init": null, + "resolved": { + "type": "Identifier", + "name": "failed", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 17 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "FlakyComponent", + "range": [ + 20, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "error", + "identifiers": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "error", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + "node": { + "type": "SvelteSnippetBlock", + "id": { + "type": "Identifier", + "name": "failed", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Identifier", + "name": "reset", + "range": [ + 64, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 30 + } + } + } + ], + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 75, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 82, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "reset", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "range": [ + 90, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 25 + } + } + } + ], + "range": [ + 82, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 25 + } + } + } + ], + "selfClosing": false, + "range": [ + 74, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "oops! try again", + "range": [ + 98, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 41 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 113, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 41 + }, + "end": { + "line": 5, + "column": 50 + } + } + }, + "range": [ + 74, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 50 + } + } + } + ], + "range": [ + 40, + 134 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 6, + "column": 11 + } + } + } + } + ], + "references": [] + }, + { + "name": "reset", + "identifiers": [ + { + "type": "Identifier", + "name": "reset", + "range": [ + 64, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 30 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "reset", + "range": [ + 64, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "node": { + "type": "SvelteSnippetBlock", + "id": { + "type": "Identifier", + "name": "failed", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 57, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": "Identifier", + "name": "reset", + "range": [ + 64, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 30 + } + } + } + ], + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 75, + 81 + ], + "loc": { + "start": { + "line": 5, + "column": 3 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 82, + 89 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "reset", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "range": [ + 90, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 25 + } + } + } + ], + "range": [ + 82, + 97 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 25 + } + } + } + ], + "selfClosing": false, + "range": [ + 74, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "oops! try again", + "range": [ + 98, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 41 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 113, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 41 + }, + "end": { + "line": 5, + "column": 50 + } + } + }, + "range": [ + 74, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 50 + } + } + } + ], + "range": [ + 40, + 134 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 6, + "column": 11 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "reset", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "reset", + "range": [ + 64, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 30 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "reset", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "reset", + "range": [ + 64, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 30 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "FlakyComponent", + "range": [ + 20, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "FlakyComponent", + "range": [ + 20, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "FlakyComponent", + "range": [ + 20, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "from": "block", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/03-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/03-input.svelte new file mode 100644 index 00000000..bff9b704 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/03-input.svelte @@ -0,0 +1,5 @@ +{#snippet failed(error, reset)} + +{/snippet} + +... diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/03-no-unused-vars-result.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/03-no-unused-vars-result.json new file mode 100644 index 00000000..fb1745d1 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/03-no-unused-vars-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-unused-vars", + "code": "error", + "line": 1, + "column": 18 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/03-output.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/03-output.json new file mode 100644 index 00000000..534b9ba1 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/03-output.json @@ -0,0 +1,1167 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteSnippetBlock", + "id": { + "type": "Identifier", + "name": "failed", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "name": "reset", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 44, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "reset", + "range": [ + 53, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 52, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 27 + } + } + } + ], + "range": [ + 44, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 27 + } + } + } + ], + "selfClosing": false, + "range": [ + 36, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "oops! try again", + "range": [ + 60, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 43 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 75, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "range": [ + 36, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 52 + } + } + } + ], + "range": [ + 0, + 95 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 95, + 97 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "special", + "name": { + "type": "SvelteName", + "name": "svelte:boundary", + "range": [ + 98, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteShorthandAttribute", + "key": { + "type": "Identifier", + "name": "failed", + "range": [ + 115, + 121 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "value": { + "type": "Identifier", + "name": "failed", + "range": [ + 115, + 121 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "range": [ + 114, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 25 + } + } + } + ], + "selfClosing": false, + "range": [ + 97, + 123 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "...", + "range": [ + 123, + 126 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 29 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 126, + 144 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 47 + } + } + }, + "range": [ + 97, + 144 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 47 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "{", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#snippet", + "range": [ + 1, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "failed", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 16, + 17 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 17 + } + } + }, + { + "type": "Identifier", + "value": "error", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 22, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "Identifier", + "value": "reset", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 5 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onclick", + "range": [ + 44, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 52, + 53 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + { + "type": "Identifier", + "value": "reset", + "range": [ + 53, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 58, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "HTMLText", + "value": "oops!", + "range": [ + 60, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "HTMLText", + "value": "try", + "range": [ + 66, + 69 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": "HTMLText", + "value": "again", + "range": [ + 70, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 75, + 76 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 76, + 77 + ], + "loc": { + "start": { + "line": 2, + "column": 44 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 77, + 83 + ], + "loc": { + "start": { + "line": 2, + "column": 45 + }, + "end": { + "line": 2, + "column": 51 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 83, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 51 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/snippet", + "range": [ + 86, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 94, + 95 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 95, + 97 + ], + "loc": { + "start": { + "line": 3, + "column": 10 + }, + "end": { + "line": 5, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 97, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "svelte:boundary", + "range": [ + 98, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 114, + 115 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "failed", + "range": [ + 115, + 121 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 122, + 123 + ], + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "HTMLText", + "value": "...", + "range": [ + 123, + 126 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 126, + 127 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 127, + 128 + ], + "loc": { + "start": { + "line": 5, + "column": 30 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "svelte:boundary", + "range": [ + 128, + 143 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 46 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 5, + "column": 46 + }, + "end": { + "line": 5, + "column": 47 + } + } + } + ], + "range": [ + 0, + 145 + ], + "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/svelte-boundary/03-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/03-scope-output.json new file mode 100644 index 00000000..a0bf4ea2 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/03-scope-output.json @@ -0,0 +1,1123 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$bindable", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "failed", + "identifiers": [ + { + "type": "Identifier", + "name": "failed", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "failed", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "node": { + "type": "SvelteSnippetBlock", + "id": { + "type": "Identifier", + "name": "failed", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "name": "reset", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 44, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "reset", + "range": [ + 53, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 52, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 27 + } + } + } + ], + "range": [ + 44, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 27 + } + } + } + ], + "selfClosing": false, + "range": [ + 36, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "oops! try again", + "range": [ + 60, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 43 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 75, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "range": [ + 36, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 52 + } + } + } + ], + "range": [ + 0, + 95 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "failed", + "range": [ + 115, + 121 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "failed", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "failed", + "range": [ + 115, + 121 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "failed", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "error", + "identifiers": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "error", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "node": { + "type": "SvelteSnippetBlock", + "id": { + "type": "Identifier", + "name": "failed", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "name": "reset", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 44, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "reset", + "range": [ + 53, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 52, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 27 + } + } + } + ], + "range": [ + 44, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 27 + } + } + } + ], + "selfClosing": false, + "range": [ + 36, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "oops! try again", + "range": [ + 60, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 43 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 75, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "range": [ + 36, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 52 + } + } + } + ], + "range": [ + 0, + 95 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + } + ], + "references": [] + }, + { + "name": "reset", + "identifiers": [ + { + "type": "Identifier", + "name": "reset", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "reset", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "node": { + "type": "SvelteSnippetBlock", + "id": { + "type": "Identifier", + "name": "failed", + "range": [ + 10, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 17, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + { + "type": "Identifier", + "name": "reset", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + ], + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 37, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 44, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "Identifier", + "name": "reset", + "range": [ + 53, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 52, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 27 + } + } + } + ], + "range": [ + 44, + 59 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 27 + } + } + } + ], + "selfClosing": false, + "range": [ + 36, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "oops! try again", + "range": [ + 60, + 75 + ], + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 43 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 75, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 52 + } + } + }, + "range": [ + 36, + 84 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 52 + } + } + } + ], + "range": [ + 0, + 95 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "reset", + "range": [ + 53, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "reset", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "reset", + "range": [ + 53, + 58 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "reset", + "range": [ + 24, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 29 + } + } + } + } + ], + "childScopes": [], + "through": [] + } + ], + "through": [] + } + ], + "through": [] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/04-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/04-input.svelte new file mode 100644 index 00000000..2c42076f --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/04-input.svelte @@ -0,0 +1,3 @@ + report(e)}> + ... + diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/04-no-undef-result.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/04-no-undef-result.json new file mode 100644 index 00000000..e740daa6 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/04-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "report", + "line": 1, + "column": 34 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/04-output.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/04-output.json new file mode 100644 index 00000000..146d7f88 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/04-output.json @@ -0,0 +1,665 @@ +{ + "type": "Program", + "body": [ + { + "type": "SvelteElement", + "kind": "special", + "name": { + "type": "SvelteName", + "name": "svelte:boundary", + "range": [ + 1, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onerror", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "report", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "optional": false, + "range": [ + 33, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 26, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "range": [ + 25, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ], + "range": [ + 17, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 43 + } + } + } + ], + "selfClosing": false, + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t...\n", + "range": [ + 44, + 50 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 3, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 50, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + "range": [ + 0, + 68 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "svelte:boundary", + "range": [ + 1, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onerror", + "range": [ + 17, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 30, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "Identifier", + "value": "report", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 39, + 40 + ], + "loc": { + "start": { + "line": 1, + "column": 39 + }, + "end": { + "line": 1, + "column": 40 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 41 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 42 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 43 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 44, + 46 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 2, + "column": 1 + } + } + }, + { + "type": "HTMLText", + "value": "...", + "range": [ + 46, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 49, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 3, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 50, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "svelte:boundary", + "range": [ + 52, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 67, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + } + } + ], + "range": [ + 0, + 69 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/04-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/04-scope-output.json new file mode 100644 index 00000000..fa34fb76 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/04-scope-output.json @@ -0,0 +1,406 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$bindable", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [], + "references": [], + "childScopes": [ + { + "type": "function", + "variables": [ + { + "name": "e", + "identifiers": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "e", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "node": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "CallExpression", + "arguments": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "report", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "optional": false, + "range": [ + 33, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "expression": true, + "generator": false, + "id": null, + "params": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + ], + "range": [ + 26, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "e", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "e", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "report", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "e", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 40 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "e", + "range": [ + 27, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "report", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "report", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "report", + "range": [ + 33, + 39 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 39 + } + } + }, + "from": "function", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/05-input.svelte b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/05-input.svelte new file mode 100644 index 00000000..59b4a62d --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/05-input.svelte @@ -0,0 +1,22 @@ + + + + + + +{#if error} + +{/if} diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/05-no-undef-result.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/05-no-undef-result.json new file mode 100644 index 00000000..8088d6d7 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/05-no-undef-result.json @@ -0,0 +1,8 @@ +[ + { + "ruleId": "no-undef", + "code": "FlakyComponent", + "line": 12, + "column": 3 + } +] \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/05-output.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/05-output.json new file mode 100644 index 00000000..8a532fdb --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/05-output.json @@ -0,0 +1,2990 @@ +{ + "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": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "null", + "value": null, + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 24 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + "range": [ + 14, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 25 + } + } + } + ], + "range": [ + 10, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "VariableDeclaration", + "kind": "let", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 62, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 56, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 28 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 49, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 49, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + "range": [ + 41, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 29 + } + } + } + ], + "range": [ + 37, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "error", + "range": [ + 96, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "e", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 96, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 96, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "reset", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "r", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "range": [ + 109, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "range": [ + 109, + 119 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 12 + } + } + } + ], + "range": [ + 92, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "onerror", + "range": [ + 78, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Identifier", + "name": "r", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + } + ], + "range": [ + 69, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 123, + 132 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "range": [ + 0, + 132 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 132, + 134 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "SvelteElement", + "kind": "special", + "name": { + "type": "SvelteName", + "name": "svelte:boundary", + "range": [ + 135, + 150 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteShorthandAttribute", + "key": { + "type": "Identifier", + "name": "onerror", + "range": [ + 152, + 159 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + "value": { + "type": "Identifier", + "name": "onerror", + "range": [ + 152, + 159 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + "range": [ + 151, + 160 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 26 + } + } + } + ], + "selfClosing": false, + "range": [ + 134, + 161 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 27 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t", + "range": [ + 161, + 163 + ], + "loc": { + "start": { + "line": 11, + "column": 27 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "SvelteElement", + "kind": "component", + "name": { + "type": "Identifier", + "name": "FlakyComponent", + "range": [ + 164, + 178 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [], + "selfClosing": true, + "range": [ + 163, + 181 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + "children": [], + "endTag": null, + "range": [ + 163, + 181 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + { + "type": "SvelteText", + "value": "\n", + "range": [ + 181, + 182 + ], + "loc": { + "start": { + "line": 12, + "column": 19 + }, + "end": { + "line": 13, + "column": 0 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 182, + 200 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + "range": [ + 134, + 200 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + { + "type": "SvelteText", + "value": "\n\n", + "range": [ + 200, + 202 + ], + "loc": { + "start": { + "line": 13, + "column": 18 + }, + "end": { + "line": 15, + "column": 0 + } + } + }, + { + "type": "SvelteIfBlock", + "elseif": false, + "expression": { + "type": "Identifier", + "name": "error", + "range": [ + 207, + 212 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + "children": [ + { + "type": "SvelteElement", + "kind": "html", + "name": { + "type": "SvelteName", + "name": "button", + "range": [ + 216, + 222 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + "startTag": { + "type": "SvelteStartTag", + "attributes": [ + { + "type": "SvelteAttribute", + "key": { + "type": "SvelteName", + "name": "onclick", + "range": [ + 223, + 230 + ], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 16 + } + } + }, + "boolean": false, + "value": [ + { + "type": "SvelteMustacheTag", + "kind": "text", + "expression": { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "error", + "range": [ + 242, + 247 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "Literal", + "raw": "null", + "value": null, + "range": [ + 250, + 254 + ], + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 14 + } + } + }, + "range": [ + 242, + 254 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 14 + } + } + }, + "range": [ + 242, + 255 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 15 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "arguments": [], + "callee": { + "type": "Identifier", + "name": "reset", + "range": [ + 258, + 263 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + "optional": false, + "range": [ + 258, + 265 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + "range": [ + 258, + 266 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 10 + } + } + } + ], + "range": [ + 238, + 269 + ], + "loc": { + "start": { + "line": 16, + "column": 24 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 232, + 269 + ], + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + "range": [ + 231, + 270 + ], + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 19, + "column": 3 + } + } + } + ], + "range": [ + 223, + 270 + ], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 19, + "column": 3 + } + } + } + ], + "selfClosing": false, + "range": [ + 215, + 271 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 19, + "column": 4 + } + } + }, + "children": [ + { + "type": "SvelteText", + "value": "\n\t\toops! try again\n\t", + "range": [ + 271, + 291 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 21, + "column": 1 + } + } + } + ], + "endTag": { + "type": "SvelteEndTag", + "range": [ + 291, + 300 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 10 + } + } + }, + "range": [ + 215, + 300 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 21, + "column": 10 + } + } + } + ], + "else": null, + "range": [ + 202, + 306 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 22, + "column": 5 + } + } + } + ], + "sourceType": "module", + "comments": [], + "tokens": [ + { + "type": "Punctuator", + "value": "<", + "range": [ + 0, + 1 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 1, + 7 + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 7, + 8 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 2, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 20, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 28, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 33, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 34, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + { + "type": "Keyword", + "value": "let", + "range": [ + 37, + 40 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 47, + 48 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "$state", + "range": [ + 49, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 55, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 57, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 59, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 27 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 63, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 27 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + { + "type": "Keyword", + "value": "function", + "range": [ + 69, + 77 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "onerror", + "range": [ + 78, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ",", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + { + "type": "Identifier", + "value": "r", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 90, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 92, + 93 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "error", + "range": [ + 96, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "e", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "Identifier", + "value": "reset", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 115, + 116 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 9 + } + } + }, + { + "type": "Identifier", + "value": "r", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 124, + 125 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "script", + "range": [ + 125, + 131 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 131, + 132 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 132, + 134 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 11, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "svelte:boundary", + "range": [ + 135, + 150 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 151, + 152 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + { + "type": "Identifier", + "value": "onerror", + "range": [ + 152, + 159 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 11, + "column": 25 + }, + "end": { + "line": 11, + "column": 26 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 160, + 161 + ], + "loc": { + "start": { + "line": 11, + "column": 26 + }, + "end": { + "line": 11, + "column": 27 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 161, + 163 + ], + "loc": { + "start": { + "line": 11, + "column": 27 + }, + "end": { + "line": 12, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + { + "type": "Identifier", + "value": "FlakyComponent", + "range": [ + 164, + 178 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 179, + 180 + ], + "loc": { + "start": { + "line": 12, + "column": 17 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 180, + 181 + ], + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + { + "type": "HTMLText", + "value": "\n", + "range": [ + 181, + 182 + ], + "loc": { + "start": { + "line": 12, + "column": 19 + }, + "end": { + "line": 13, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "svelte:boundary", + "range": [ + 184, + 199 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 199, + 200 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + { + "type": "HTMLText", + "value": "\n\n", + "range": [ + 200, + 202 + ], + "loc": { + "start": { + "line": 13, + "column": 18 + }, + "end": { + "line": 15, + "column": 0 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 202, + 203 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "#if", + "range": [ + 203, + 206 + ], + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 4 + } + } + }, + { + "type": "Identifier", + "value": "error", + "range": [ + 207, + 212 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 212, + 213 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 215, + 216 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 2 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 216, + 222 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "onclick", + "range": [ + 223, + 230 + ], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 16 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 230, + 231 + ], + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 16, + "column": 17 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 231, + 232 + ], + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 232, + 233 + ], + "loc": { + "start": { + "line": 16, + "column": 18 + }, + "end": { + "line": 16, + "column": 19 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 233, + 234 + ], + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 20 + } + } + }, + { + "type": "Punctuator", + "value": "=>", + "range": [ + 235, + 237 + ], + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 23 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 238, + 239 + ], + "loc": { + "start": { + "line": 16, + "column": 24 + }, + "end": { + "line": 16, + "column": 25 + } + } + }, + { + "type": "Identifier", + "value": "error", + "range": [ + 242, + 247 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "=", + "range": [ + 248, + 249 + ], + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + } + }, + { + "type": "Null", + "value": "null", + "range": [ + 250, + 254 + ], + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 14 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 254, + 255 + ], + "loc": { + "start": { + "line": 17, + "column": 14 + }, + "end": { + "line": 17, + "column": 15 + } + } + }, + { + "type": "Identifier", + "value": "reset", + "range": [ + 258, + 263 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + { + "type": "Punctuator", + "value": "(", + "range": [ + 263, + 264 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + { + "type": "Punctuator", + "value": ")", + "range": [ + 264, + 265 + ], + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ";", + "range": [ + 265, + 266 + ], + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 268, + 269 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 269, + 270 + ], + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 3 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 270, + 271 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 4 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t\t", + "range": [ + 271, + 274 + ], + "loc": { + "start": { + "line": 19, + "column": 4 + }, + "end": { + "line": 20, + "column": 2 + } + } + }, + { + "type": "HTMLText", + "value": "oops!", + "range": [ + 274, + 279 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 279, + 280 + ], + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + { + "type": "HTMLText", + "value": "try", + "range": [ + 280, + 283 + ], + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 11 + } + } + }, + { + "type": "HTMLText", + "value": " ", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 20, + "column": 11 + }, + "end": { + "line": 20, + "column": 12 + } + } + }, + { + "type": "HTMLText", + "value": "again", + "range": [ + 284, + 289 + ], + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 17 + } + } + }, + { + "type": "HTMLText", + "value": "\n\t", + "range": [ + 289, + 291 + ], + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 21, + "column": 1 + } + } + }, + { + "type": "Punctuator", + "value": "<", + "range": [ + 291, + 292 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + { + "type": "Punctuator", + "value": "/", + "range": [ + 292, + 293 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": "HTMLIdentifier", + "value": "button", + "range": [ + 293, + 299 + ], + "loc": { + "start": { + "line": 21, + "column": 3 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": "Punctuator", + "value": ">", + "range": [ + 299, + 300 + ], + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 10 + } + } + }, + { + "type": "Punctuator", + "value": "{", + "range": [ + 301, + 302 + ], + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 1 + } + } + }, + { + "type": "MustacheKeyword", + "value": "/if", + "range": [ + 302, + 305 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 4 + } + } + }, + { + "type": "Punctuator", + "value": "}", + "range": [ + 305, + 306 + ], + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 5 + } + } + } + ], + "range": [ + 0, + 307 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 23, + "column": 0 + } + } +} \ No newline at end of file diff --git a/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/05-scope-output.json b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/05-scope-output.json new file mode 100644 index 00000000..d6f804d3 --- /dev/null +++ b/tests/fixtures/parser/ast/svelte5/docs/svelte-boundary/05-scope-output.json @@ -0,0 +1,2526 @@ +{ + "type": "global", + "variables": [ + { + "name": "$$slots", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$$restProps", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$state", + "identifiers": [], + "defs": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 49, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + }, + { + "name": "$derived", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$effect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$props", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$bindable", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$inspect", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "$host", + "identifiers": [], + "defs": [], + "references": [] + } + ], + "references": [], + "childScopes": [ + { + "type": "module", + "variables": [ + { + "name": "error", + "identifiers": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "Literal", + "raw": "null", + "value": null, + "range": [ + 29, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 24 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 22, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + "range": [ + 14, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 25 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "error", + "range": [ + 96, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "error", + "range": [ + 207, + 212 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "error", + "range": [ + 242, + 247 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ] + }, + { + "name": "reset", + "identifiers": [ + { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + ], + "defs": [ + { + "type": "Variable", + "name": { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "node": { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "init": { + "type": "CallExpression", + "arguments": [ + { + "type": "ArrowFunctionExpression", + "async": false, + "body": { + "type": "BlockStatement", + "body": [], + "range": [ + 62, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + "expression": false, + "generator": false, + "id": null, + "params": [], + "range": [ + 56, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 28 + } + } + } + ], + "callee": { + "type": "Identifier", + "name": "$state", + "range": [ + 49, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "optional": false, + "range": [ + 49, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + "range": [ + 41, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 29 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "reset", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "reset", + "range": [ + 258, + 263 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + } + ] + }, + { + "name": "onerror", + "identifiers": [ + { + "type": "Identifier", + "name": "onerror", + "range": [ + 78, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 17 + } + } + } + ], + "defs": [ + { + "type": "FunctionName", + "name": { + "type": "Identifier", + "name": "onerror", + "range": [ + 78, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "error", + "range": [ + 96, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "e", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 96, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 96, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "reset", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "r", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "range": [ + 109, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "range": [ + 109, + 119 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 12 + } + } + } + ], + "range": [ + 92, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "onerror", + "range": [ + 78, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Identifier", + "name": "r", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + } + ], + "range": [ + 69, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "onerror", + "range": [ + 152, + 159 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "onerror", + "range": [ + 78, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 17 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "from": "module", + "init": true, + "resolved": { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 49, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "onerror", + "range": [ + 152, + 159 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "onerror", + "range": [ + 78, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 17 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "FlakyComponent", + "range": [ + 164, + 178 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "error", + "range": [ + 207, + 212 + ], + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 10 + } + } + }, + "from": "module", + "init": null, + "resolved": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + } + ], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [], + "childScopes": [], + "through": [] + }, + { + "type": "function", + "variables": [ + { + "name": "arguments", + "identifiers": [], + "defs": [], + "references": [] + }, + { + "name": "e", + "identifiers": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "e", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "error", + "range": [ + 96, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "e", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 96, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 96, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "reset", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "r", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "range": [ + 109, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "range": [ + 109, + 119 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 12 + } + } + } + ], + "range": [ + 92, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "onerror", + "range": [ + 78, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Identifier", + "name": "r", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + } + ], + "range": [ + 69, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "e", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "e", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + } + } + ] + }, + { + "name": "r", + "identifiers": [ + { + "type": "Identifier", + "name": "r", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + } + ], + "defs": [ + { + "type": "Parameter", + "name": { + "type": "Identifier", + "name": "r", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + }, + "node": { + "type": "FunctionDeclaration", + "async": false, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "error", + "range": [ + 96, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "e", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 96, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 96, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "left": { + "type": "Identifier", + "name": "reset", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + "operator": "=", + "right": { + "type": "Identifier", + "name": "r", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "range": [ + 109, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "range": [ + 109, + 119 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 12 + } + } + } + ], + "range": [ + 92, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "expression": false, + "generator": false, + "id": { + "type": "Identifier", + "name": "onerror", + "range": [ + 78, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "e", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": "Identifier", + "name": "r", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + } + ], + "range": [ + 69, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + } + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "r", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "r", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + } + } + ] + } + ], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "error", + "range": [ + 96, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "e", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "e", + "range": [ + 86, + 87 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "reset", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "r", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 7, + "column": 10 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "r", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "error", + "range": [ + 96, + 101 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "reset", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + } + ] + }, + { + "type": "block", + "variables": [], + "references": [], + "childScopes": [ + { + "type": "function", + "variables": [], + "references": [ + { + "identifier": { + "type": "Identifier", + "name": "error", + "range": [ + 242, + 247 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "reset", + "range": [ + 258, + 263 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + } + ], + "childScopes": [], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "error", + "range": [ + 242, + 247 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "reset", + "range": [ + 258, + 263 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "error", + "range": [ + 242, + 247 + ], + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + "from": "function", + "init": false, + "resolved": { + "type": "Identifier", + "name": "error", + "range": [ + 14, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 10 + } + } + } + }, + { + "identifier": { + "type": "Identifier", + "name": "reset", + "range": [ + 258, + 263 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + "from": "function", + "init": null, + "resolved": { + "type": "Identifier", + "name": "reset", + "range": [ + 41, + 46 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 10 + } + } + } + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 22, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "$state", + "range": [ + 49, + 55 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "from": "module", + "init": null, + "resolved": null + }, + { + "identifier": { + "type": "Identifier", + "name": "FlakyComponent", + "range": [ + 164, + 178 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] + } + ], + "through": [ + { + "identifier": { + "type": "Identifier", + "name": "FlakyComponent", + "range": [ + 164, + 178 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + "from": "module", + "init": null, + "resolved": null + } + ] +} \ No newline at end of file